/* 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),hm?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=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;k4?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);f0;)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)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):I180?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=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.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=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=wt&&bt===T.length-1){ht=L[bt];break}if(ct>wt&&ct2){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?btwt;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=hT;S?k++:k--)_.push(k);return _}var hi=R,Cp=Lr,Tp=function(h){for(var f=[1,1],m=1;m=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.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 0");var L=Math.LOG10E*ll(_),I=Math.LOG10E*ll(S);k.push(_);for(var j=1;j200&&(te=!1)}for(var on={},Wn=0;Wn_?(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{(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={"&":"&","<":"<",">":">",'"':""","'":"'"},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=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]=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;v1||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`
`+Z+`
`;var W=this.options.langPrefix+this.options.escape(y,!0);return`
'+Z+`
`},w.prototype.blockquote=function(v){return`
`+v+`
`},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"'+v+" `},w.prototype.hr=function(){return this.options.xhtml?`
`:`
`},w.prototype.list=function(v,y){var A=y?"ol":"ul";return` <`+A+`> `+v+" `},w.prototype.listitem=function(v){return"
  • "+v+`
  • `},w.prototype.paragraph=function(v){return"

    "+v+`

    `},w.prototype.table=function(v,y){return` `+v+` `+y+`
    `},w.prototype.tablerow=function(v){return` `+v+` `},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+" `},w.prototype.strong=function(v){return""+v+""},w.prototype.em=function(v){return""+v+""},w.prototype.codespan=function(v){return""+v+""},w.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},w.prototype.del=function(v){return""+v+""},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='",O},w.prototype.image=function(v,y,A){var E=''+A+'":">",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:/^|^<\/?\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]+?(?=[\\?(?:\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&&/^/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.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;WAn error occured:

    "+this.options.escape(v.message+"",!0)+"
    ";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:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\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",//).setGroup("closed",/<(tag)[\s\S]+?<\/\1>/).setGroup("closing",/])*?>/).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 ?/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;J1&&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;J0?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;a0?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;sn,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;is-r).pop(),t}function Tn(n){return!isNaN(parseFloat(n))&&isFinite(n)}function Xn(n,t,e){return Math.abs(n-t)=n}function Wr(n,t,e){let i,s,r;for(i=0,s=n.length;il&&c=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function gs(n,t,e){e=e||(a=>n[a]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]gs(n,e,i=>n[i][t]>=e);function Il(n,t,e){let i=0,s=n.length;for(;ii&&n[s-1]>e;)s--;return i>0||s{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;eArray.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.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>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;ie.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;le.length){for(l=0;l0&&n.stroke()}}function Jn(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.xt.top-e&&n.y0&&r.strokeColor!=="",l,c;for(n.save(),n.font=s.string,Ug(n,r),l=0;l+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;re&&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;otn==="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!c.skip)),t.cubicInterpolationMode==="monotone")pm(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,a=n.length;rwindow.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;gl(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;ss&&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=oo({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||e1?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;sn!=="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;s0||!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;pe[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]x||d=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=0&&tthis.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{for(c.length+=e,o=c.length-1;o>=a;o--)c[o]=c[o-e]};for(l(r),o=t;os-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;s0?s[n-1]:null,o=nMath.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=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.basel.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=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;gUn($,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;a0&&!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;sn!=="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;$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)&&(re.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{!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{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;us)return l}return Math.max(s,1)}function rb(n){let t=[],e,i;for(e=0,i=n.length;en==="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(;ra+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;ri?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=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({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&&to*s?o/i:l/s:l*s0}_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;Pr.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{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{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;e0&&this.getParsed(e-1);for(let R=e;R0&&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[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;ue.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;ec.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{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{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{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;se.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{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{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;rr.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=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.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{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=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=so&&r>o;return{count:i,start:l,loop:t.loop,ilen:c(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?(FM&&(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;cn!=="borderDash"&&n!=="fill"};function ph(n,t,e,i){let s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-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;dp&&(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;ax&&(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=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;in.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-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 en.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;lt.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$!==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;R0&&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.dataIndexn!=="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&&te.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(Fb&&(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}),Ns=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(a0?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}:ns?{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;lt.r&&(o=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+o)),s.startt.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;c270||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{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{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=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=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+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;gx-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;e0?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=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=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(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 CTRL + SHIFT + I to open it."}function Dv(n){for(var t=window.atob(n),e=t.length,i=new Uint8Array(e),s=0;s` - 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;i1&&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+(r1&&(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||'
    ',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='
    '}),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;o32){let t=[],e=n.ctx.length/32;for(let i=0;in.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{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{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<{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=`

    Y Axis

    Set Data Fields (Comma seperated)

    `,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=`

    Line of Best Fit

    Create a line of best fit

    `,a=Y("td"),o=Y("input"),l=Lt(),c=Y("tr"),u=Y("td"),u.innerHTML=`

    Best Fit Line ID

    The line ID used to create the line of best fit

    `,d=Y("td"),g=Y("input"),p=Y("br"),b=Lt(),x=Y("tr"),M=Y("td"),M.innerHTML=`

    Line of Best Fit Title

    The title for the line of best fit

    `,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;ptChart Type

    Choose a Chart Type

    `,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=`

    Smoothness

    Changes the smoothness of the Chart

    `,R=Y("td"),F=Y("input"),z=Lt(),N=Y("tr"),X=Y("td"),X.innerHTML=`

    Width

    Changes the horizontal width

    `,U=Y("td"),nt=Y("input"),ot=Lt(),st=Y("tr"),kt=Y("td"),kt.innerHTML=`

    Fill

    Fill the underside of the Chart

    `,Ft=Y("td"),et=Y("input"),Ct=Lt(),yt=Y("tr"),Qt=Y("td"),Qt.innerHTML=`

    Distinct Colors

    Use distinct Colors for each Label

    `,de=Y("td"),rt=Y("input"),Ot=Lt(),It=Y("tr"),Wt=Y("td"),Wt.innerHTML=`

    Start at Zero

    Don't cut the graph at the bottom

    `,Ut=Y("td"),w=Y("input"),v=Lt(),y=Y("hr"),A=Lt(),E=Y("table"),O=Y("tr"),Z=Y("td"),Z.innerHTML=`

    X Axis

    Set Labels (Comma seperated)

    `,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;ptn[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{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:''},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{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 */