digital-garden/.obsidian/plugins/obsidian-charts/main.js

195 lines
316 KiB
JavaScript

/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source visit the plugins github repository (https://github.com/phibr0/obsidian-dictionary)
*/
var Xp=Object.create;var li=Object.defineProperty,Kp=Object.defineProperties,Zp=Object.getOwnPropertyDescriptor,Jp=Object.getOwnPropertyDescriptors,Qp=Object.getOwnPropertyNames,al=Object.getOwnPropertySymbols,tg=Object.getPrototypeOf,ol=Object.prototype.hasOwnProperty,eg=Object.prototype.propertyIsEnumerable;var ll=(n,t,e)=>t in n?li(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ci=(n,t)=>{for(var e in t||(t={}))ol.call(t,e)&&ll(n,e,t[e]);if(al)for(var e of al(t))eg.call(t,e)&&ll(n,e,t[e]);return n},hi=(n,t)=>Kp(n,Jp(t)),cl=n=>li(n,"__esModule",{value:!0});var Sr=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),ng=(n,t)=>{cl(n);for(var e in t)li(n,e,{get:t[e],enumerable:!0})},ig=(n,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qp(t))!ol.call(n,i)&&i!=="default"&&li(n,i,{get:()=>t[i],enumerable:!(e=Zp(t,i))||e.enumerable});return n},De=n=>ig(cl(li(n!=null?Xp(tg(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var wh=Sr((Ta,Pa)=>{(function(n,t){typeof Ta=="object"&&typeof Pa!="undefined"?Pa.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.chroma=t())})(Ta,function(){"use strict";for(var n=function(h,f,g){return f===void 0&&(f=0),g===void 0&&(g=1),h<f?f:h>g?g:h},t=n,e=function(h){h._clipped=!1,h._unclipped=h.slice(0);for(var f=0;f<=3;f++)f<3?((h[f]<0||h[f]>255)&&(h._clipped=!0),h[f]=t(h[f],0,255)):f===3&&(h[f]=t(h[f],0,1));return h},i={},s=0,r=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];s<r.length;s+=1){var a=r[s];i["[object "+a+"]"]=a.toLowerCase()}var o=function(h){return i[Object.prototype.toString.call(h)]||"object"},l=o,c=function(h,f){return f===void 0&&(f=null),h.length>=3?Array.prototype.slice.call(h):l(h[0])=="object"&&f?f.split("").filter(function(g){return h[0][g]!==void 0}).map(function(g){return h[0][g]}):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},m=Math.PI,p={clip_rgb:e,limit:n,type:o,unpack:c,last:d,PI:m,TWOPI:m*2,PITHIRD:m/3,DEG2RAD:m/180,RAD2DEG:180/m},b={format:{},autodetect:[]},k=p.last,M=p.clip_rgb,T=p.type,R=b,$=function(){for(var f=[],g=arguments.length;g--;)f[g]=arguments[g];var _=this;if(T(f[0])==="object"&&f[0].constructor&&f[0].constructor===this.constructor)return f[0];var S=k(f),C=!1;if(!S){C=!0,R.sorted||(R.autodetect=R.autodetect.sort(function(B,W){return W.p-B.p}),R.sorted=!0);for(var x=0,E=R.autodetect;x<E.length;x+=1){var A=E[x];if(S=A.test.apply(A,f),S)break}}if(R.format[S]){var I=R.format[S].apply(null,C?f:f.slice(0,-1));_._rgb=M(I)}else throw new Error("unknown format: "+f);_._rgb.length===3&&_._rgb.push(1)};$.prototype.toString=function(){return T(this.hex)=="function"?this.hex():"["+this._rgb.join(",")+"]"};var L=$,F=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(F.Color,[null].concat(h)))};F.Color=L,F.version="2.4.2";var z=F,H=p.unpack,G=Math.max,q=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=H(h,"rgb"),_=g[0],S=g[1],C=g[2];_=_/255,S=S/255,C=C/255;var x=1-G(_,G(S,C)),E=x<1?1/(1-x):0,A=(1-_-x)*E,I=(1-S-x)*E,B=(1-C-x)*E;return[A,I,B,x]},et=q,ot=p.unpack,st=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=ot(h,"cmyk");var g=h[0],_=h[1],S=h[2],C=h[3],x=h.length>4?h[4]:1;return C===1?[0,0,0,x]:[g>=1?0:255*(1-g)*(1-C),_>=1?0:255*(1-_)*(1-C),S>=1?0:255*(1-S)*(1-C),x]},wt=st,rt=z,U=L,_t=b,Ct=p.unpack,se=p.type,we=et;U.prototype.cmyk=function(){return we(this._rgb)},rt.cmyk=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(U,[null].concat(h,["cmyk"])))},_t.format.cmyk=wt,_t.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=Ct(h,"cmyk"),se(h)==="array"&&h.length===4)return"cmyk"}});var It=p.unpack,Wt=p.last,jt=function(h){return Math.round(h*100)/100},Nt=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=It(h,"hsla"),_=Wt(h)||"lsa";return g[0]=jt(g[0]||0),g[1]=jt(g[1]*100)+"%",g[2]=jt(g[2]*100)+"%",_==="hsla"||g.length>3&&g[3]<1?(g[3]=g.length>3?g[3]:1,_="hsla"):g.length=3,_+"("+g.join(",")+")"},qt=Nt,w=p.unpack,v=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=w(h,"rgba");var g=h[0],_=h[1],S=h[2];g/=255,_/=255,S/=255;var C=Math.min(g,_,S),x=Math.max(g,_,S),E=(x+C)/2,A,I;return x===C?(A=0,I=Number.NaN):A=E<.5?(x-C)/(x+C):(x-C)/(2-x-C),g==x?I=(_-S)/(x-C):_==x?I=2+(S-g)/(x-C):S==x&&(I=4+(g-_)/(x-C)),I*=60,I<0&&(I+=360),h.length>3&&h[3]!==void 0?[I,A,E,h[3]]:[I,A,E]},y=v,D=p.unpack,P=p.last,O=qt,K=y,V=Math.round,Z=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=D(h,"rgba"),_=P(h)||"rgb";return _.substr(0,3)=="hsl"?O(K(g),_):(g[0]=V(g[0]),g[1]=V(g[1]),g[2]=V(g[2]),(_==="rgba"||g.length>3&&g[3]<1)&&(g[3]=g.length>3?g[3]:1,_="rgba"),_+"("+g.slice(0,_==="rgb"?3:4).join(",")+")")},Q=Z,vt=p.unpack,Rt=Math.round,Tt=function(){for(var h,f=[],g=arguments.length;g--;)f[g]=arguments[g];f=vt(f,"hsl");var _=f[0],S=f[1],C=f[2],x,E,A;if(S===0)x=E=A=C*255;else{var I=[0,0,0],B=[0,0,0],W=C<.5?C*(1+S):C+S-C*S,j=2*C-W,J=_/360;I[0]=J+1/3,I[1]=J,I[2]=J-1/3;for(var X=0;X<3;X++)I[X]<0&&(I[X]+=1),I[X]>1&&(I[X]-=1),6*I[X]<1?B[X]=j+(W-j)*6*I[X]:2*I[X]<1?B[X]=W:3*I[X]<2?B[X]=j+(W-j)*(2/3-I[X])*6:B[X]=j;h=[Rt(B[0]*255),Rt(B[1]*255),Rt(B[2]*255)],x=h[0],E=h[1],A=h[2]}return f.length>3?[x,E,A,f[3]]:[x,E,A,1]},zt=Tt,Bt=zt,re=b,be=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,fe=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,mn=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Ee=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Be=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,ni=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,ii=Math.round,Tn=function(h){h=h.toLowerCase().trim();var f;if(re.format.named)try{return re.format.named(h)}catch(X){}if(f=h.match(be)){for(var g=f.slice(1,4),_=0;_<3;_++)g[_]=+g[_];return g[3]=1,g}if(f=h.match(fe)){for(var S=f.slice(1,5),C=0;C<4;C++)S[C]=+S[C];return S}if(f=h.match(mn)){for(var x=f.slice(1,4),E=0;E<3;E++)x[E]=ii(x[E]*2.55);return x[3]=1,x}if(f=h.match(Ee)){for(var A=f.slice(1,5),I=0;I<3;I++)A[I]=ii(A[I]*2.55);return A[3]=+A[3],A}if(f=h.match(Be)){var B=f.slice(1,4);B[1]*=.01,B[2]*=.01;var W=Bt(B);return W[3]=1,W}if(f=h.match(ni)){var j=f.slice(1,4);j[1]*=.01,j[2]*=.01;var J=Bt(j);return J[3]=+f[4],J}};Tn.test=function(h){return be.test(h)||fe.test(h)||mn.test(h)||Ee.test(h)||Be.test(h)||ni.test(h)};var je=Tn,bn=z,Pn=L,si=b,Je=p.type,ee=Q,yt=je;Pn.prototype.css=function(h){return ee(this._rgb,h)},bn.css=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(Pn,[null].concat(h,["css"])))},si.format.css=yt,si.autodetect.push({p:5,test:function(h){for(var f=[],g=arguments.length-1;g-- >0;)f[g]=arguments[g+1];if(!f.length&&Je(h)==="string"&&yt.test(h))return"css"}});var ne=L,Ut=z,Gi=b,tu=p.unpack;Gi.format.gl=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=tu(h,"rgba");return g[0]*=255,g[1]*=255,g[2]*=255,g},Ut.gl=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(ne,[null].concat(h,["gl"])))},ne.prototype.gl=function(){var h=this._rgb;return[h[0]/255,h[1]/255,h[2]/255,h[3]]};var eu=p.unpack,nu=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=eu(h,"rgb"),_=g[0],S=g[1],C=g[2],x=Math.min(_,S,C),E=Math.max(_,S,C),A=E-x,I=A*100/255,B=x/(255-A)*100,W;return A===0?W=Number.NaN:(_===E&&(W=(S-C)/A),S===E&&(W=2+(C-_)/A),C===E&&(W=4+(_-S)/A),W*=60,W<0&&(W+=360)),[W,I,B]},iu=nu,su=p.unpack,ru=Math.floor,au=function(){for(var h,f,g,_,S,C,x=[],E=arguments.length;E--;)x[E]=arguments[E];x=su(x,"hcg");var A=x[0],I=x[1],B=x[2],W,j,J;B=B*255;var X=I*255;if(I===0)W=j=J=B;else{A===360&&(A=0),A>360&&(A-=360),A<0&&(A+=360),A/=60;var lt=ru(A),ut=A-lt,gt=B*(1-I),xt=gt+X*(1-ut),Zt=gt+X*ut,Kt=gt+X;switch(lt){case 0:h=[Kt,Zt,gt],W=h[0],j=h[1],J=h[2];break;case 1:f=[xt,Kt,gt],W=f[0],j=f[1],J=f[2];break;case 2:g=[gt,Kt,Zt],W=g[0],j=g[1],J=g[2];break;case 3:_=[gt,xt,Kt],W=_[0],j=_[1],J=_[2];break;case 4:S=[Zt,gt,Kt],W=S[0],j=S[1],J=S[2];break;case 5:C=[Kt,gt,xt],W=C[0],j=C[1],J=C[2];break}}return[W,j,J,x.length>3?x[3]:1]},ou=au,lu=p.unpack,cu=p.type,hu=z,qa=L,Ua=b,uu=iu;qa.prototype.hcg=function(){return uu(this._rgb)},hu.hcg=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(qa,[null].concat(h,["hcg"])))},Ua.format.hcg=ou,Ua.autodetect.push({p:1,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=lu(h,"hcg"),cu(h)==="array"&&h.length===3)return"hcg"}});var fu=p.unpack,du=p.last,qi=Math.round,pu=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=fu(h,"rgba"),_=g[0],S=g[1],C=g[2],x=g[3],E=du(h)||"auto";x===void 0&&(x=1),E==="auto"&&(E=x<1?"rgba":"rgb"),_=qi(_),S=qi(S),C=qi(C);var A=_<<16|S<<8|C,I="000000"+A.toString(16);I=I.substr(I.length-6);var B="0"+qi(x*255).toString(16);switch(B=B.substr(B.length-2),E.toLowerCase()){case"rgba":return"#"+I+B;case"argb":return"#"+B+I;default:return"#"+I}},Xa=pu,gu=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,mu=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,bu=function(h){if(h.match(gu)){(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),g=f>>16,_=f>>8&255,S=f&255;return[g,_,S,1]}if(h.match(mu)){(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 C=parseInt(h,16),x=C>>24&255,E=C>>16&255,A=C>>8&255,I=Math.round((C&255)/255*100)/100;return[x,E,A,I]}throw new Error("unknown hex color: "+h)},Ka=bu,vu=z,Za=L,_u=p.type,Ja=b,yu=Xa;Za.prototype.hex=function(h){return yu(this._rgb,h)},vu.hex=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(Za,[null].concat(h,["hex"])))},Ja.format.hex=Ka,Ja.autodetect.push({p:4,test:function(h){for(var f=[],g=arguments.length-1;g-- >0;)f[g]=arguments[g+1];if(!f.length&&_u(h)==="string"&&[3,4,5,6,7,8,9].indexOf(h.length)>=0)return"hex"}});var xu=p.unpack,Qa=p.TWOPI,wu=Math.min,ku=Math.sqrt,Su=Math.acos,Mu=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=xu(h,"rgb"),_=g[0],S=g[1],C=g[2];_/=255,S/=255,C/=255;var x,E=wu(_,S,C),A=(_+S+C)/3,I=A>0?1-E/A:0;return I===0?x=NaN:(x=(_-S+(_-C))/2,x/=ku((_-S)*(_-S)+(_-C)*(S-C)),x=Su(x),C>S&&(x=Qa-x),x/=Qa),[x*360,I,A]},Cu=Mu,Tu=p.unpack,Zs=p.limit,On=p.TWOPI,Js=p.PITHIRD,En=Math.cos,Pu=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=Tu(h,"hsi");var g=h[0],_=h[1],S=h[2],C,x,E;return isNaN(g)&&(g=0),isNaN(_)&&(_=0),g>360&&(g-=360),g<0&&(g+=360),g/=360,g<1/3?(E=(1-_)/3,C=(1+_*En(On*g)/En(Js-On*g))/3,x=1-(E+C)):g<2/3?(g-=1/3,C=(1-_)/3,x=(1+_*En(On*g)/En(Js-On*g))/3,E=1-(C+x)):(g-=2/3,x=(1-_)/3,E=(1+_*En(On*g)/En(Js-On*g))/3,C=1-(x+E)),C=Zs(S*C*3),x=Zs(S*x*3),E=Zs(S*E*3),[C*255,x*255,E*255,h.length>3?h[3]:1]},Ou=Pu,Eu=p.unpack,Du=p.type,Au=z,to=L,eo=b,Lu=Cu;to.prototype.hsi=function(){return Lu(this._rgb)},Au.hsi=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(to,[null].concat(h,["hsi"])))},eo.format.hsi=Ou,eo.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=Eu(h,"hsi"),Du(h)==="array"&&h.length===3)return"hsi"}});var Ru=p.unpack,Fu=p.type,Iu=z,no=L,io=b,$u=y;no.prototype.hsl=function(){return $u(this._rgb)},Iu.hsl=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(no,[null].concat(h,["hsl"])))},io.format.hsl=zt,io.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=Ru(h,"hsl"),Fu(h)==="array"&&h.length===3)return"hsl"}});var zu=p.unpack,Bu=Math.min,ju=Math.max,Nu=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=zu(h,"rgb");var g=h[0],_=h[1],S=h[2],C=Bu(g,_,S),x=ju(g,_,S),E=x-C,A,I,B;return B=x/255,x===0?(A=Number.NaN,I=0):(I=E/x,g===x&&(A=(_-S)/E),_===x&&(A=2+(S-g)/E),S===x&&(A=4+(g-_)/E),A*=60,A<0&&(A+=360)),[A,I,B]},Hu=Nu,Vu=p.unpack,Wu=Math.floor,Yu=function(){for(var h,f,g,_,S,C,x=[],E=arguments.length;E--;)x[E]=arguments[E];x=Vu(x,"hsv");var A=x[0],I=x[1],B=x[2],W,j,J;if(B*=255,I===0)W=j=J=B;else{A===360&&(A=0),A>360&&(A-=360),A<0&&(A+=360),A/=60;var X=Wu(A),lt=A-X,ut=B*(1-I),gt=B*(1-I*lt),xt=B*(1-I*(1-lt));switch(X){case 0:h=[B,xt,ut],W=h[0],j=h[1],J=h[2];break;case 1:f=[gt,B,ut],W=f[0],j=f[1],J=f[2];break;case 2:g=[ut,B,xt],W=g[0],j=g[1],J=g[2];break;case 3:_=[ut,gt,B],W=_[0],j=_[1],J=_[2];break;case 4:S=[xt,ut,B],W=S[0],j=S[1],J=S[2];break;case 5:C=[B,ut,gt],W=C[0],j=C[1],J=C[2];break}}return[W,j,J,x.length>3?x[3]:1]},Gu=Yu,qu=p.unpack,Uu=p.type,Xu=z,so=L,ro=b,Ku=Hu;so.prototype.hsv=function(){return Ku(this._rgb)},Xu.hsv=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(so,[null].concat(h,["hsv"])))},ro.format.hsv=Gu,ro.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=qu(h,"hsv"),Uu(h)==="array"&&h.length===3)return"hsv"}});var Ui={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},Dn=Ui,Zu=p.unpack,ao=Math.pow,Ju=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=Zu(h,"rgb"),_=g[0],S=g[1],C=g[2],x=Qu(_,S,C),E=x[0],A=x[1],I=x[2],B=116*A-16;return[B<0?0:B,500*(E-A),200*(A-I)]},Qs=function(h){return(h/=255)<=.04045?h/12.92:ao((h+.055)/1.055,2.4)},tr=function(h){return h>Dn.t3?ao(h,1/3):h/Dn.t2+Dn.t0},Qu=function(h,f,g){h=Qs(h),f=Qs(f),g=Qs(g);var _=tr((.4124564*h+.3575761*f+.1804375*g)/Dn.Xn),S=tr((.2126729*h+.7151522*f+.072175*g)/Dn.Yn),C=tr((.0193339*h+.119192*f+.9503041*g)/Dn.Zn);return[_,S,C]},oo=Ju,An=Ui,tf=p.unpack,ef=Math.pow,nf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=tf(h,"lab");var g=h[0],_=h[1],S=h[2],C,x,E,A,I,B;return x=(g+16)/116,C=isNaN(_)?x:x+_/500,E=isNaN(S)?x:x-S/200,x=An.Yn*nr(x),C=An.Xn*nr(C),E=An.Zn*nr(E),A=er(3.2404542*C-1.5371385*x-.4985314*E),I=er(-.969266*C+1.8760108*x+.041556*E),B=er(.0556434*C-.2040259*x+1.0572252*E),[A,I,B,h.length>3?h[3]:1]},er=function(h){return 255*(h<=.00304?12.92*h:1.055*ef(h,1/2.4)-.055)},nr=function(h){return h>An.t1?h*h*h:An.t2*(h-An.t0)},lo=nf,sf=p.unpack,rf=p.type,af=z,co=L,ho=b,of=oo;co.prototype.lab=function(){return of(this._rgb)},af.lab=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(co,[null].concat(h,["lab"])))},ho.format.lab=lo,ho.autodetect.push({p:2,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=sf(h,"lab"),rf(h)==="array"&&h.length===3)return"lab"}});var lf=p.unpack,cf=p.RAD2DEG,hf=Math.sqrt,uf=Math.atan2,ff=Math.round,df=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=lf(h,"lab"),_=g[0],S=g[1],C=g[2],x=hf(S*S+C*C),E=(uf(C,S)*cf+360)%360;return ff(x*1e4)===0&&(E=Number.NaN),[_,x,E]},uo=df,pf=p.unpack,gf=oo,mf=uo,bf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=pf(h,"rgb"),_=g[0],S=g[1],C=g[2],x=gf(_,S,C),E=x[0],A=x[1],I=x[2];return mf(E,A,I)},vf=bf,_f=p.unpack,yf=p.DEG2RAD,xf=Math.sin,wf=Math.cos,kf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=_f(h,"lch"),_=g[0],S=g[1],C=g[2];return isNaN(C)&&(C=0),C=C*yf,[_,wf(C)*S,xf(C)*S]},fo=kf,Sf=p.unpack,Mf=fo,Cf=lo,Tf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=Sf(h,"lch");var g=h[0],_=h[1],S=h[2],C=Mf(g,_,S),x=C[0],E=C[1],A=C[2],I=Cf(x,E,A),B=I[0],W=I[1],j=I[2];return[B,W,j,h.length>3?h[3]:1]},po=Tf,Pf=p.unpack,Of=po,Ef=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=Pf(h,"hcl").reverse();return Of.apply(void 0,g)},Df=Ef,Af=p.unpack,Lf=p.type,go=z,Xi=L,ir=b,mo=vf;Xi.prototype.lch=function(){return mo(this._rgb)},Xi.prototype.hcl=function(){return mo(this._rgb).reverse()},go.lch=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(Xi,[null].concat(h,["lch"])))},go.hcl=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(Xi,[null].concat(h,["hcl"])))},ir.format.lch=po,ir.format.hcl=Df,["lch","hcl"].forEach(function(h){return ir.autodetect.push({p:2,test:function(){for(var f=[],g=arguments.length;g--;)f[g]=arguments[g];if(f=Af(f,h),Lf(f)==="array"&&f.length===3)return h}})});var Rf={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"},bo=Rf,Ff=L,vo=b,If=p.type,ri=bo,$f=Ka,zf=Xa;Ff.prototype.name=function(){for(var h=zf(this._rgb,"rgb"),f=0,g=Object.keys(ri);f<g.length;f+=1){var _=g[f];if(ri[_]===h)return _.toLowerCase()}return h},vo.format.named=function(h){if(h=h.toLowerCase(),ri[h])return $f(ri[h]);throw new Error("unknown color name: "+h)},vo.autodetect.push({p:5,test:function(h){for(var f=[],g=arguments.length-1;g-- >0;)f[g]=arguments[g+1];if(!f.length&&If(h)==="string"&&ri[h.toLowerCase()])return"named"}});var Bf=p.unpack,jf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=Bf(h,"rgb"),_=g[0],S=g[1],C=g[2];return(_<<16)+(S<<8)+C},Nf=jf,Hf=p.type,Vf=function(h){if(Hf(h)=="number"&&h>=0&&h<=16777215){var f=h>>16,g=h>>8&255,_=h&255;return[f,g,_,1]}throw new Error("unknown num color: "+h)},Wf=Vf,Yf=z,_o=L,yo=b,Gf=p.type,qf=Nf;_o.prototype.num=function(){return qf(this._rgb)},Yf.num=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(_o,[null].concat(h,["num"])))},yo.format.num=Wf,yo.autodetect.push({p:5,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h.length===1&&Gf(h[0])==="number"&&h[0]>=0&&h[0]<=16777215)return"num"}});var Uf=z,sr=L,xo=b,wo=p.unpack,ko=p.type,So=Math.round;sr.prototype.rgb=function(h){return h===void 0&&(h=!0),h===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(So)},sr.prototype.rgba=function(h){return h===void 0&&(h=!0),this._rgb.slice(0,4).map(function(f,g){return g<3?h===!1?f:So(f):f})},Uf.rgb=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(sr,[null].concat(h,["rgb"])))},xo.format.rgb=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=wo(h,"rgba");return g[3]===void 0&&(g[3]=1),g},xo.autodetect.push({p:3,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=wo(h,"rgba"),ko(h)==="array"&&(h.length===3||h.length===4&&ko(h[3])=="number"&&h[3]>=0&&h[3]<=1))return"rgb"}});var Ki=Math.log,Xf=function(h){var f=h/100,g,_,S;return f<66?(g=255,_=f<6?0:-155.25485562709179-.44596950469579133*(_=f-2)+104.49216199393888*Ki(_),S=f<20?0:-254.76935184120902+.8274096064007395*(S=f-10)+115.67994401066147*Ki(S)):(g=351.97690566805693+.114206453784165*(g=f-55)-40.25366309332127*Ki(g),_=325.4494125711974+.07943456536662342*(_=f-50)-28.0852963507957*Ki(_),S=255),[g,_,S,1]},Mo=Xf,Kf=Mo,Zf=p.unpack,Jf=Math.round,Qf=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];for(var g=Zf(h,"rgb"),_=g[0],S=g[2],C=1e3,x=4e4,E=.4,A;x-C>E;){A=(x+C)*.5;var I=Kf(A);I[2]/I[0]>=S/_?x=A:C=A}return Jf(A)},td=Qf,rr=z,Zi=L,ar=b,ed=td;Zi.prototype.temp=Zi.prototype.kelvin=Zi.prototype.temperature=function(){return ed(this._rgb)},rr.temp=rr.kelvin=rr.temperature=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(Zi,[null].concat(h,["temp"])))},ar.format.temp=ar.format.kelvin=ar.format.temperature=Mo;var nd=p.unpack,or=Math.cbrt,id=Math.pow,sd=Math.sign,rd=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=nd(h,"rgb"),_=g[0],S=g[1],C=g[2],x=[lr(_/255),lr(S/255),lr(C/255)],E=x[0],A=x[1],I=x[2],B=or(.4122214708*E+.5363325363*A+.0514459929*I),W=or(.2119034982*E+.6806995451*A+.1073969566*I),j=or(.0883024619*E+.2817188376*A+.6299787005*I);return[.2104542553*B+.793617785*W-.0040720468*j,1.9779984951*B-2.428592205*W+.4505937099*j,.0259040371*B+.7827717662*W-.808675766*j]},Co=rd;function lr(h){var f=Math.abs(h);return f<.04045?h/12.92:(sd(h)||1)*id((f+.055)/1.055,2.4)}var ad=p.unpack,Ji=Math.pow,od=Math.sign,ld=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=ad(h,"lab");var g=h[0],_=h[1],S=h[2],C=Ji(g+.3963377774*_+.2158037573*S,3),x=Ji(g-.1055613458*_-.0638541728*S,3),E=Ji(g-.0894841775*_-1.291485548*S,3);return[255*cr(4.0767416621*C-3.3077115913*x+.2309699292*E),255*cr(-1.2684380046*C+2.6097574011*x-.3413193965*E),255*cr(-.0041960863*C-.7034186147*x+1.707614701*E),h.length>3?h[3]:1]},To=ld;function cr(h){var f=Math.abs(h);return f>.0031308?(od(h)||1)*(1.055*Ji(f,1/2.4)-.055):h*12.92}var cd=p.unpack,hd=p.type,ud=z,Po=L,Oo=b,fd=Co;Po.prototype.oklab=function(){return fd(this._rgb)},ud.oklab=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(Po,[null].concat(h,["oklab"])))},Oo.format.oklab=To,Oo.autodetect.push({p:3,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=cd(h,"oklab"),hd(h)==="array"&&h.length===3)return"oklab"}});var dd=p.unpack,pd=Co,gd=uo,md=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];var g=dd(h,"rgb"),_=g[0],S=g[1],C=g[2],x=pd(_,S,C),E=x[0],A=x[1],I=x[2];return gd(E,A,I)},bd=md,vd=p.unpack,_d=fo,yd=To,xd=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];h=vd(h,"lch");var g=h[0],_=h[1],S=h[2],C=_d(g,_,S),x=C[0],E=C[1],A=C[2],I=yd(x,E,A),B=I[0],W=I[1],j=I[2];return[B,W,j,h.length>3?h[3]:1]},wd=xd,kd=p.unpack,Sd=p.type,Md=z,Eo=L,Do=b,Cd=bd;Eo.prototype.oklch=function(){return Cd(this._rgb)},Md.oklch=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];return new(Function.prototype.bind.apply(Eo,[null].concat(h,["oklch"])))},Do.format.oklch=wd,Do.autodetect.push({p:3,test:function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];if(h=kd(h,"oklch"),Sd(h)==="array"&&h.length===3)return"oklch"}});var Ao=L,Td=p.type;Ao.prototype.alpha=function(h,f){return f===void 0&&(f=!1),h!==void 0&&Td(h)==="number"?f?(this._rgb[3]=h,this):new Ao([this._rgb[0],this._rgb[1],this._rgb[2],h],"rgb"):this._rgb[3]};var Pd=L;Pd.prototype.clipped=function(){return this._rgb._clipped||!1};var vn=L,Od=Ui;vn.prototype.darken=function(h){h===void 0&&(h=1);var f=this,g=f.lab();return g[0]-=Od.Kn*h,new vn(g,"lab").alpha(f.alpha(),!0)},vn.prototype.brighten=function(h){return h===void 0&&(h=1),this.darken(-h)},vn.prototype.darker=vn.prototype.darken,vn.prototype.brighter=vn.prototype.brighten;var Ed=L;Ed.prototype.get=function(h){var f=h.split("."),g=f[0],_=f[1],S=this[g]();if(_){var C=g.indexOf(_)-(g.substr(0,2)==="ok"?2:0);if(C>-1)return S[C];throw new Error("unknown channel "+_+" in mode "+g)}else return S};var Ln=L,Dd=p.type,Ad=Math.pow,Ld=1e-7,Rd=20;Ln.prototype.luminance=function(h){if(h!==void 0&&Dd(h)==="number"){if(h===0)return new Ln([0,0,0,this._rgb[3]],"rgb");if(h===1)return new Ln([255,255,255,this._rgb[3]],"rgb");var f=this.luminance(),g="rgb",_=Rd,S=function(x,E){var A=x.interpolate(E,.5,g),I=A.luminance();return Math.abs(h-I)<Ld||!_--?A:I>h?S(x,A):S(A,E)},C=(f>h?S(new Ln([0,0,0]),this):S(this,new Ln([255,255,255]))).rgb();return new Ln(C.concat([this._rgb[3]]))}return Fd.apply(void 0,this._rgb.slice(0,3))};var Fd=function(h,f,g){return h=hr(h),f=hr(f),g=hr(g),.2126*h+.7152*f+.0722*g},hr=function(h){return h/=255,h<=.03928?h/12.92:Ad((h+.055)/1.055,2.4)},de={},Lo=L,Ro=p.type,Qi=de,Fo=function(h,f,g){g===void 0&&(g=.5);for(var _=[],S=arguments.length-3;S-- >0;)_[S]=arguments[S+3];var C=_[0]||"lrgb";if(!Qi[C]&&!_.length&&(C=Object.keys(Qi)[0]),!Qi[C])throw new Error("interpolation mode "+C+" is not defined");return Ro(h)!=="object"&&(h=new Lo(h)),Ro(f)!=="object"&&(f=new Lo(f)),Qi[C](h,f,g).alpha(h.alpha()+g*(f.alpha()-h.alpha()))},Io=L,Id=Fo;Io.prototype.mix=Io.prototype.interpolate=function(h,f){f===void 0&&(f=.5);for(var g=[],_=arguments.length-2;_-- >0;)g[_]=arguments[_+2];return Id.apply(void 0,[this,h,f].concat(g))};var $o=L;$o.prototype.premultiply=function(h){h===void 0&&(h=!1);var f=this._rgb,g=f[3];return h?(this._rgb=[f[0]*g,f[1]*g,f[2]*g,g],this):new $o([f[0]*g,f[1]*g,f[2]*g,g],"rgb")};var ur=L,$d=Ui;ur.prototype.saturate=function(h){h===void 0&&(h=1);var f=this,g=f.lch();return g[1]+=$d.Kn*h,g[1]<0&&(g[1]=0),new ur(g,"lch").alpha(f.alpha(),!0)},ur.prototype.desaturate=function(h){return h===void 0&&(h=1),this.saturate(-h)};var zo=L,Bo=p.type;zo.prototype.set=function(h,f,g){g===void 0&&(g=!1);var _=h.split("."),S=_[0],C=_[1],x=this[S]();if(C){var E=S.indexOf(C)-(S.substr(0,2)==="ok"?2:0);if(E>-1){if(Bo(f)=="string")switch(f.charAt(0)){case"+":x[E]+=+f;break;case"-":x[E]+=+f;break;case"*":x[E]*=+f.substr(1);break;case"/":x[E]/=+f.substr(1);break;default:x[E]=+f}else if(Bo(f)==="number")x[E]=f;else throw new Error("unsupported value for Color.set");var A=new zo(x,S);return g?(this._rgb=A._rgb,this):A}throw new Error("unknown channel "+C+" in mode "+S)}else return x};var zd=L,Bd=function(h,f,g){var _=h._rgb,S=f._rgb;return new zd(_[0]+g*(S[0]-_[0]),_[1]+g*(S[1]-_[1]),_[2]+g*(S[2]-_[2]),"rgb")};de.rgb=Bd;var jd=L,fr=Math.sqrt,Rn=Math.pow,Nd=function(h,f,g){var _=h._rgb,S=_[0],C=_[1],x=_[2],E=f._rgb,A=E[0],I=E[1],B=E[2];return new jd(fr(Rn(S,2)*(1-g)+Rn(A,2)*g),fr(Rn(C,2)*(1-g)+Rn(I,2)*g),fr(Rn(x,2)*(1-g)+Rn(B,2)*g),"rgb")};de.lrgb=Nd;var Hd=L,Vd=function(h,f,g){var _=h.lab(),S=f.lab();return new Hd(_[0]+g*(S[0]-_[0]),_[1]+g*(S[1]-_[1]),_[2]+g*(S[2]-_[2]),"lab")};de.lab=Vd;var jo=L,Fn=function(h,f,g,_){var S,C,x,E;_==="hsl"?(x=h.hsl(),E=f.hsl()):_==="hsv"?(x=h.hsv(),E=f.hsv()):_==="hcg"?(x=h.hcg(),E=f.hcg()):_==="hsi"?(x=h.hsi(),E=f.hsi()):_==="lch"||_==="hcl"?(_="hcl",x=h.hcl(),E=f.hcl()):_==="oklch"&&(x=h.oklch().reverse(),E=f.oklch().reverse());var A,I,B,W,j,J;(_.substr(0,1)==="h"||_==="oklch")&&(S=x,A=S[0],B=S[1],j=S[2],C=E,I=C[0],W=C[1],J=C[2]);var X,lt,ut,gt;return!isNaN(A)&&!isNaN(I)?(I>A&&I-A>180?gt=I-(A+360):I<A&&A-I>180?gt=I+360-A:gt=I-A,lt=A+g*gt):isNaN(A)?isNaN(I)?lt=Number.NaN:(lt=I,(j==1||j==0)&&_!="hsv"&&(X=W)):(lt=A,(J==1||J==0)&&_!="hsv"&&(X=B)),X===void 0&&(X=B+g*(W-B)),ut=j+g*(J-j),_==="oklch"?new jo([ut,X,lt],_):new jo([lt,X,ut],_)},Wd=Fn,No=function(h,f,g){return Wd(h,f,g,"lch")};de.lch=No,de.hcl=No;var Yd=L,Gd=function(h,f,g){var _=h.num(),S=f.num();return new Yd(_+g*(S-_),"num")};de.num=Gd;var qd=Fn,Ud=function(h,f,g){return qd(h,f,g,"hcg")};de.hcg=Ud;var Xd=Fn,Kd=function(h,f,g){return Xd(h,f,g,"hsi")};de.hsi=Kd;var Zd=Fn,Jd=function(h,f,g){return Zd(h,f,g,"hsl")};de.hsl=Jd;var Qd=Fn,tp=function(h,f,g){return Qd(h,f,g,"hsv")};de.hsv=tp;var ep=L,np=function(h,f,g){var _=h.oklab(),S=f.oklab();return new ep(_[0]+g*(S[0]-_[0]),_[1]+g*(S[1]-_[1]),_[2]+g*(S[2]-_[2]),"oklab")};de.oklab=np;var ip=Fn,sp=function(h,f,g){return ip(h,f,g,"oklch")};de.oklch=sp;var dr=L,rp=p.clip_rgb,pr=Math.pow,gr=Math.sqrt,mr=Math.PI,Ho=Math.cos,Vo=Math.sin,ap=Math.atan2,op=function(h,f,g){f===void 0&&(f="lrgb"),g===void 0&&(g=null);var _=h.length;g||(g=Array.from(new Array(_)).map(function(){return 1}));var S=_/g.reduce(function(lt,ut){return lt+ut});if(g.forEach(function(lt,ut){g[ut]*=S}),h=h.map(function(lt){return new dr(lt)}),f==="lrgb")return lp(h,g);for(var C=h.shift(),x=C.get(f),E=[],A=0,I=0,B=0;B<x.length;B++)if(x[B]=(x[B]||0)*g[0],E.push(isNaN(x[B])?0:g[0]),f.charAt(B)==="h"&&!isNaN(x[B])){var W=x[B]/180*mr;A+=Ho(W)*g[0],I+=Vo(W)*g[0]}var j=C.alpha()*g[0];h.forEach(function(lt,ut){var gt=lt.get(f);j+=lt.alpha()*g[ut+1];for(var xt=0;xt<x.length;xt++)if(!isNaN(gt[xt]))if(E[xt]+=g[ut+1],f.charAt(xt)==="h"){var Zt=gt[xt]/180*mr;A+=Ho(Zt)*g[ut+1],I+=Vo(Zt)*g[ut+1]}else x[xt]+=gt[xt]*g[ut+1]});for(var J=0;J<x.length;J++)if(f.charAt(J)==="h"){for(var X=ap(I/E[J],A/E[J])/mr*180;X<0;)X+=360;for(;X>=360;)X-=360;x[J]=X}else x[J]=x[J]/E[J];return j/=_,new dr(x,f).alpha(j>.99999?1:j,!0)},lp=function(h,f){for(var g=h.length,_=[0,0,0,0],S=0;S<h.length;S++){var C=h[S],x=f[S]/g,E=C._rgb;_[0]+=pr(E[0],2)*x,_[1]+=pr(E[1],2)*x,_[2]+=pr(E[2],2)*x,_[3]+=E[3]*x}return _[0]=gr(_[0]),_[1]=gr(_[1]),_[2]=gr(_[2]),_[3]>.9999999&&(_[3]=1),new dr(rp(_))},ke=z,In=p.type,cp=Math.pow,br=function(h){var f="rgb",g=ke("#ccc"),_=0,S=[0,1],C=[],x=[0,0],E=!1,A=[],I=!1,B=0,W=1,j=!1,J={},X=!0,lt=1,ut=function(N){if(N=N||["#fff","#000"],N&&In(N)==="string"&&ke.brewer&&ke.brewer[N.toLowerCase()]&&(N=ke.brewer[N.toLowerCase()]),In(N)==="array"){N.length===1&&(N=[N[0],N[0]]),N=N.slice(0);for(var nt=0;nt<N.length;nt++)N[nt]=ke(N[nt]);C.length=0;for(var ht=0;ht<N.length;ht++)C.push(ht/(N.length-1))}return ae(),A=N},gt=function(N){if(E!=null){for(var nt=E.length-1,ht=0;ht<nt&&N>=E[ht];)ht++;return ht-1}return 0},xt=function(N){return N},Zt=function(N){return N},Kt=function(N,nt){var ht,ct;if(nt==null&&(nt=!1),isNaN(N)||N===null)return g;if(nt)ct=N;else if(E&&E.length>2){var Jt=gt(N);ct=Jt/(E.length-2)}else W!==B?ct=(N-B)/(W-B):ct=1;ct=Zt(ct),nt||(ct=xt(ct)),lt!==1&&(ct=cp(ct,lt)),ct=x[0]+ct*(1-x[0]-x[1]),ct=Math.min(1,Math.max(0,ct));var At=Math.floor(ct*1e4);if(X&&J[At])ht=J[At];else{if(In(A)==="array")for(var mt=0;mt<C.length;mt++){var kt=C[mt];if(ct<=kt){ht=A[mt];break}if(ct>=kt&&mt===C.length-1){ht=A[mt];break}if(ct>kt&&ct<C[mt+1]){ct=(ct-kt)/(C[mt+1]-kt),ht=ke.interpolate(A[mt],A[mt+1],ct,f);break}}else In(A)==="function"&&(ht=A(ct));X&&(J[At]=ht)}return ht},ae=function(){return J={}};ut(h);var pt=function(N){var nt=ke(Kt(N));return I&&nt[I]?nt[I]():nt};return pt.classes=function(N){if(N!=null){if(In(N)==="array")E=N,S=[N[0],N[N.length-1]];else{var nt=ke.analyze(S);N===0?E=[nt.min,nt.max]:E=ke.limits(nt,"e",N)}return pt}return E},pt.domain=function(N){if(!arguments.length)return S;B=N[0],W=N[N.length-1],C=[];var nt=A.length;if(N.length===nt&&B!==W)for(var ht=0,ct=Array.from(N);ht<ct.length;ht+=1){var Jt=ct[ht];C.push((Jt-B)/(W-B))}else{for(var At=0;At<nt;At++)C.push(At/(nt-1));if(N.length>2){var mt=N.map(function(St,Pt){return Pt/(N.length-1)}),kt=N.map(function(St){return(St-B)/(W-B)});kt.every(function(St,Pt){return mt[Pt]===St})||(Zt=function(St){if(St<=0||St>=1)return St;for(var Pt=0;St>=kt[Pt+1];)Pt++;var Me=(St-kt[Pt])/(kt[Pt+1]-kt[Pt]),en=mt[Pt]+Me*(mt[Pt+1]-mt[Pt]);return en})}}return S=[B,W],pt},pt.mode=function(N){return arguments.length?(f=N,ae(),pt):f},pt.range=function(N,nt){return ut(N),pt},pt.out=function(N){return I=N,pt},pt.spread=function(N){return arguments.length?(_=N,pt):_},pt.correctLightness=function(N){return N==null&&(N=!0),j=N,ae(),j?xt=function(nt){for(var ht=Kt(0,!0).lab()[0],ct=Kt(1,!0).lab()[0],Jt=ht>ct,At=Kt(nt,!0).lab()[0],mt=ht+(ct-ht)*nt,kt=At-mt,St=0,Pt=1,Me=20;Math.abs(kt)>.01&&Me-- >0;)(function(){return Jt&&(kt*=-1),kt<0?(St=nt,nt+=(Pt-nt)*.5):(Pt=nt,nt+=(St-nt)*.5),At=Kt(nt,!0).lab()[0],kt=At-mt})();return nt}:xt=function(nt){return nt},pt},pt.padding=function(N){return N!=null?(In(N)==="number"&&(N=[N,N]),x=N,pt):x},pt.colors=function(N,nt){arguments.length<2&&(nt="hex");var ht=[];if(arguments.length===0)ht=A.slice(0);else if(N===1)ht=[pt(.5)];else if(N>1){var ct=S[0],Jt=S[1]-ct;ht=hp(0,N,!1).map(function(Pt){return pt(ct+Pt/(N-1)*Jt)})}else{h=[];var At=[];if(E&&E.length>2)for(var mt=1,kt=E.length,St=1<=kt;St?mt<kt:mt>kt;St?mt++:mt--)At.push((E[mt-1]+E[mt])*.5);else At=S;ht=At.map(function(Pt){return pt(Pt)})}return ke[nt]&&(ht=ht.map(function(Pt){return Pt[nt]()})),ht},pt.cache=function(N){return N!=null?(X=N,pt):X},pt.gamma=function(N){return N!=null?(lt=N,pt):lt},pt.nodata=function(N){return N!=null?(g=ke(N),pt):g},pt};function hp(h,f,g){for(var _=[],S=h<f,C=g?S?f+1:f-1:f,x=h;S?x<C:x>C;S?x++:x--)_.push(x);return _}var ai=L,up=br,fp=function(h){for(var f=[1,1],g=1;g<h;g++){for(var _=[1],S=1;S<=f.length;S++)_[S]=(f[S]||0)+f[S-1];f=_}return f},dp=function(h){var f,g,_,S,C,x,E;if(h=h.map(function(j){return new ai(j)}),h.length===2)f=h.map(function(j){return j.lab()}),C=f[0],x=f[1],S=function(j){var J=[0,1,2].map(function(X){return C[X]+j*(x[X]-C[X])});return new ai(J,"lab")};else if(h.length===3)g=h.map(function(j){return j.lab()}),C=g[0],x=g[1],E=g[2],S=function(j){var J=[0,1,2].map(function(X){return(1-j)*(1-j)*C[X]+2*(1-j)*j*x[X]+j*j*E[X]});return new ai(J,"lab")};else if(h.length===4){var A;_=h.map(function(j){return j.lab()}),C=_[0],x=_[1],E=_[2],A=_[3],S=function(j){var J=[0,1,2].map(function(X){return(1-j)*(1-j)*(1-j)*C[X]+3*(1-j)*(1-j)*j*x[X]+3*(1-j)*j*j*E[X]+j*j*j*A[X]});return new ai(J,"lab")}}else if(h.length>=5){var I,B,W;I=h.map(function(j){return j.lab()}),W=h.length-1,B=fp(W),S=function(j){var J=1-j,X=[0,1,2].map(function(lt){return I.reduce(function(ut,gt,xt){return ut+B[xt]*Math.pow(J,W-xt)*Math.pow(j,xt)*gt[lt]},0)});return new ai(X,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return S},pp=function(h){var f=dp(h);return f.scale=function(){return up(f)},f},vr=z,Se=function(h,f,g){if(!Se[g])throw new Error("unknown blend mode "+g);return Se[g](h,f)},Qe=function(h){return function(f,g){var _=vr(g).rgb(),S=vr(f).rgb();return vr.rgb(h(_,S))}},tn=function(h){return function(f,g){var _=[];return _[0]=h(f[0],g[0]),_[1]=h(f[1],g[1]),_[2]=h(f[2],g[2]),_}},gp=function(h){return h},mp=function(h,f){return h*f/255},bp=function(h,f){return h>f?f:h},vp=function(h,f){return h>f?h:f},_p=function(h,f){return 255*(1-(1-h/255)*(1-f/255))},yp=function(h,f){return f<128?2*h*f/255:255*(1-2*(1-h/255)*(1-f/255))},xp=function(h,f){return 255*(1-(1-f/255)/(h/255))},wp=function(h,f){return h===255?255:(h=255*(f/255)/(1-h/255),h>255?255:h)};Se.normal=Qe(tn(gp)),Se.multiply=Qe(tn(mp)),Se.screen=Qe(tn(_p)),Se.overlay=Qe(tn(yp)),Se.darken=Qe(tn(bp)),Se.lighten=Qe(tn(vp)),Se.dodge=Qe(tn(wp)),Se.burn=Qe(tn(xp));for(var kp=Se,_r=p.type,Sp=p.clip_rgb,Mp=p.TWOPI,Cp=Math.pow,Tp=Math.sin,Pp=Math.cos,Wo=z,Op=function(h,f,g,_,S){h===void 0&&(h=300),f===void 0&&(f=-1.5),g===void 0&&(g=1),_===void 0&&(_=1),S===void 0&&(S=[0,1]);var C=0,x;_r(S)==="array"?x=S[1]-S[0]:(x=0,S=[S,S]);var E=function(A){var I=Mp*((h+120)/360+f*A),B=Cp(S[0]+x*A,_),W=C!==0?g[0]+A*C:g,j=W*B*(1-B)/2,J=Pp(I),X=Tp(I),lt=B+j*(-.14861*J+1.78277*X),ut=B+j*(-.29227*J-.90649*X),gt=B+j*(1.97294*J);return Wo(Sp([lt*255,ut*255,gt*255,1]))};return E.start=function(A){return A==null?h:(h=A,E)},E.rotations=function(A){return A==null?f:(f=A,E)},E.gamma=function(A){return A==null?_:(_=A,E)},E.hue=function(A){return A==null?g:(g=A,_r(g)==="array"?(C=g[1]-g[0],C===0&&(g=g[1])):C=0,E)},E.lightness=function(A){return A==null?S:(_r(A)==="array"?(S=A,x=A[1]-A[0]):(S=[A,A],x=0),E)},E.scale=function(){return Wo.scale(E)},E.hue(g),E},Ep=L,Dp="0123456789abcdef",Ap=Math.floor,Lp=Math.random,Rp=function(){for(var h="#",f=0;f<6;f++)h+=Dp.charAt(Ap(Lp()*16));return new Ep(h,"hex")},yr=o,Yo=Math.log,Fp=Math.pow,Ip=Math.floor,$p=Math.abs,Go=function(h,f){f===void 0&&(f=null);var g={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return yr(h)==="object"&&(h=Object.values(h)),h.forEach(function(_){f&&yr(_)==="object"&&(_=_[f]),_!=null&&!isNaN(_)&&(g.values.push(_),g.sum+=_,_<g.min&&(g.min=_),_>g.max&&(g.max=_),g.count+=1)}),g.domain=[g.min,g.max],g.limits=function(_,S){return qo(g,_,S)},g},qo=function(h,f,g){f===void 0&&(f="equal"),g===void 0&&(g=7),yr(h)=="array"&&(h=Go(h));var _=h.min,S=h.max,C=h.values.sort(function(wr,kr){return wr-kr});if(g===1)return[_,S];var x=[];if(f.substr(0,1)==="c"&&(x.push(_),x.push(S)),f.substr(0,1)==="e"){x.push(_);for(var E=1;E<g;E++)x.push(_+E/g*(S-_));x.push(S)}else if(f.substr(0,1)==="l"){if(_<=0)throw new Error("Logarithmic scales are only possible for values > 0");var A=Math.LOG10E*Yo(_),I=Math.LOG10E*Yo(S);x.push(_);for(var B=1;B<g;B++)x.push(Fp(10,A+B/g*(I-A)));x.push(S)}else if(f.substr(0,1)==="q"){x.push(_);for(var W=1;W<g;W++){var j=(C.length-1)*W/g,J=Ip(j);if(J===j)x.push(C[J]);else{var X=j-J;x.push(C[J]*(1-X)+C[J+1]*X)}}x.push(S)}else if(f.substr(0,1)==="k"){var lt,ut=C.length,gt=new Array(ut),xt=new Array(g),Zt=!0,Kt=0,ae=null;ae=[],ae.push(_);for(var pt=1;pt<g;pt++)ae.push(_+pt/g*(S-_));for(ae.push(S);Zt;){for(var N=0;N<g;N++)xt[N]=0;for(var nt=0;nt<ut;nt++)for(var ht=C[nt],ct=Number.MAX_VALUE,Jt=void 0,At=0;At<g;At++){var mt=$p(ae[At]-ht);mt<ct&&(ct=mt,Jt=At),xt[Jt]++,gt[nt]=Jt}for(var kt=new Array(g),St=0;St<g;St++)kt[St]=null;for(var Pt=0;Pt<ut;Pt++)lt=gt[Pt],kt[lt]===null?kt[lt]=C[Pt]:kt[lt]+=C[Pt];for(var Me=0;Me<g;Me++)kt[Me]*=1/xt[Me];Zt=!1;for(var en=0;en<g;en++)if(kt[en]!==ae[en]){Zt=!0;break}ae=kt,Kt++,Kt>200&&(Zt=!1)}for(var nn={},$n=0;$n<g;$n++)nn[$n]=[];for(var zn=0;zn<ut;zn++)lt=gt[zn],nn[lt].push(C[zn]);for(var He=[],_n=0;_n<g;_n++)He.push(nn[_n][0]),He.push(nn[_n][nn[_n].length-1]);He=He.sort(function(wr,kr){return wr-kr}),x.push(He[0]);for(var oi=1;oi<He.length;oi+=2){var yn=He[oi];!isNaN(yn)&&x.indexOf(yn)===-1&&x.push(yn)}}return x},Uo={analyze:Go,limits:qo},Xo=L,zp=function(h,f){h=new Xo(h),f=new Xo(f);var g=h.luminance(),_=f.luminance();return g>_?(g+.05)/(_+.05):(_+.05)/(g+.05)},Ko=L,Ne=Math.sqrt,Ht=Math.pow,Bp=Math.min,jp=Math.max,Zo=Math.atan2,Jo=Math.abs,ts=Math.cos,Qo=Math.sin,Np=Math.exp,tl=Math.PI,Hp=function(h,f,g,_,S){g===void 0&&(g=1),_===void 0&&(_=1),S===void 0&&(S=1);var C=function(yn){return 360*yn/(2*tl)},x=function(yn){return 2*tl*yn/360};h=new Ko(h),f=new Ko(f);var E=Array.from(h.lab()),A=E[0],I=E[1],B=E[2],W=Array.from(f.lab()),j=W[0],J=W[1],X=W[2],lt=(A+j)/2,ut=Ne(Ht(I,2)+Ht(B,2)),gt=Ne(Ht(J,2)+Ht(X,2)),xt=(ut+gt)/2,Zt=.5*(1-Ne(Ht(xt,7)/(Ht(xt,7)+Ht(25,7)))),Kt=I*(1+Zt),ae=J*(1+Zt),pt=Ne(Ht(Kt,2)+Ht(B,2)),N=Ne(Ht(ae,2)+Ht(X,2)),nt=(pt+N)/2,ht=C(Zo(B,Kt)),ct=C(Zo(X,ae)),Jt=ht>=0?ht:ht+360,At=ct>=0?ct:ct+360,mt=Jo(Jt-At)>180?(Jt+At+360)/2:(Jt+At)/2,kt=1-.17*ts(x(mt-30))+.24*ts(x(2*mt))+.32*ts(x(3*mt+6))-.2*ts(x(4*mt-63)),St=At-Jt;St=Jo(St)<=180?St:At<=Jt?St+360:St-360,St=2*Ne(pt*N)*Qo(x(St)/2);var Pt=j-A,Me=N-pt,en=1+.015*Ht(lt-50,2)/Ne(20+Ht(lt-50,2)),nn=1+.045*nt,$n=1+.015*nt*kt,zn=30*Np(-Ht((mt-275)/25,2)),He=2*Ne(Ht(nt,7)/(Ht(nt,7)+Ht(25,7))),_n=-He*Qo(2*x(zn)),oi=Ne(Ht(Pt/(g*en),2)+Ht(Me/(_*nn),2)+Ht(St/(S*$n),2)+_n*(Me/(_*nn))*(St/(S*$n)));return jp(0,Bp(100,oi))},el=L,Vp=function(h,f,g){g===void 0&&(g="lab"),h=new el(h),f=new el(f);var _=h.get(g),S=f.get(g),C=0;for(var x in _){var E=(_[x]||0)-(S[x]||0);C+=E*E}return Math.sqrt(C)},Wp=L,Yp=function(){for(var h=[],f=arguments.length;f--;)h[f]=arguments[f];try{return new(Function.prototype.bind.apply(Wp,[null].concat(h))),!0}catch(g){return!1}},nl=z,il=br,Gp={cool:function(){return il([nl.hsl(180,1,.9),nl.hsl(250,.7,.4)])},hot:function(){return il(["#000","#f00","#ff0","#fff"]).mode("rgb")}},es={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"]},xr=0,sl=Object.keys(es);xr<sl.length;xr+=1){var rl=sl[xr];es[rl.toLowerCase()]=es[rl]}var qp=es,Xt=z;Xt.average=op,Xt.bezier=pp,Xt.blend=kp,Xt.cubehelix=Op,Xt.mix=Xt.interpolate=Fo,Xt.random=Rp,Xt.scale=br,Xt.analyze=Uo.analyze,Xt.contrast=zp,Xt.deltaE=Hp,Xt.distance=Vp,Xt.limits=Uo.limits,Xt.valid=Yp,Xt.scales=Gp,Xt.colors=bo,Xt.brewer=qp;var Up=Xt;return Up})});var Ch=Sr((Bs,Mh)=>{(function(n,t){typeof Bs=="object"&&typeof Mh!="undefined"?t(Bs):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={})))})(Bs,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 D=typeof y=="string"?y:y.source;return D=D.replace(/(^|[^\[])\^/g,"$1"),this.source=this.source.replace(v,D),this},w.prototype.getRegexp=function(){return new RegExp(this.source,this.flags)},w}();var e=/[&<>"']/,i=/[&<>"']/g,s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},r=/[<>"']|&(?!#?\w+;)/,a=/[<>"']|&(?!#?\w+;)/g;function o(w,v){if(v){if(e.test(w))return w.replace(i,function(y){return s[y]})}else if(r.test(w))return w.replace(a,function(y){return s[y]});return w}function l(w){return w.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(v,y){return y=y.toLowerCase(),y==="colon"?":":y.charAt(0)==="#"?y.charAt(1)==="x"?String.fromCharCode(parseInt(y.substring(2),16)):String.fromCharCode(+y.substring(1)):""})}n.TokenType=void 0,function(w){w[w.space=1]="space",w[w.text=2]="text",w[w.paragraph=3]="paragraph",w[w.heading=4]="heading",w[w.listStart=5]="listStart",w[w.listEnd=6]="listEnd",w[w.looseItemStart=7]="looseItemStart",w[w.looseItemEnd=8]="looseItemEnd",w[w.listItemStart=9]="listItemStart",w[w.listItemEnd=10]="listItemEnd",w[w.blockquoteStart=11]="blockquoteStart",w[w.blockquoteEnd=12]="blockquoteEnd",w[w.code=13]="code",w[w.table=14]="table",w[w.html=15]="html",w[w.hr=16]="hr"}(n.TokenType||(n.TokenType={}));var c=function(){function w(){this.gfm=!0,this.tables=!0,this.breaks=!1,this.pedantic=!1,this.sanitize=!1,this.mangle=!0,this.smartLists=!1,this.silent=!1,this.langPrefix="lang-",this.smartypants=!1,this.headerPrefix="",this.xhtml=!1,this.escape=o,this.unescape=l}return w}();var u=function(w,v){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,D){y.__proto__=D}||function(y,D){for(var P in D)Object.prototype.hasOwnProperty.call(D,P)&&(y[P]=D[P])},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 m=function(){return m=Object.assign||function(v){for(var y,D=1,P=arguments.length;D<P;D++){y=arguments[D];for(var O in y)Object.prototype.hasOwnProperty.call(y,O)&&(v[O]=y[O])}return v},m.apply(this,arguments)};function p(w,v){var y={};for(var D in w)Object.prototype.hasOwnProperty.call(w,D)&&v.indexOf(D)<0&&(y[D]=w[D]);if(w!=null&&typeof Object.getOwnPropertySymbols=="function")for(var P=0,D=Object.getOwnPropertySymbols(w);P<D.length;P++)v.indexOf(D[P])<0&&Object.prototype.propertyIsEnumerable.call(w,D[P])&&(y[D[P]]=w[D[P]]);return y}function b(w,v,y,D){var P=arguments.length,O=P<3?v:D===null?D=Object.getOwnPropertyDescriptor(v,y):D,K;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(w,v,y,D);else for(var V=w.length-1;V>=0;V--)(K=w[V])&&(O=(P<3?K(O):P>3?K(v,y,O):K(v,y))||O);return P>3&&O&&Object.defineProperty(v,y,O),O}function k(w,v){return function(y,D){v(y,D,w)}}function M(w,v){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(w,v)}function T(w,v,y,D){function P(O){return O instanceof y?O:new y(function(K){K(O)})}return new(y||(y=Promise))(function(O,K){function V(vt){try{Q(D.next(vt))}catch(Rt){K(Rt)}}function Z(vt){try{Q(D.throw(vt))}catch(Rt){K(Rt)}}function Q(vt){vt.done?O(vt.value):P(vt.value).then(V,Z)}Q((D=D.apply(w,v||[])).next())})}function R(w,v){var y={label:0,sent:function(){if(O[0]&1)throw O[1];return O[1]},trys:[],ops:[]},D,P,O,K;return K={next:V(0),throw:V(1),return:V(2)},typeof Symbol=="function"&&(K[Symbol.iterator]=function(){return this}),K;function V(Q){return function(vt){return Z([Q,vt])}}function Z(Q){if(D)throw new TypeError("Generator is already executing.");for(;y;)try{if(D=1,P&&(O=Q[0]&2?P.return:Q[0]?P.throw||((O=P.return)&&O.call(P),0):P.next)&&!(O=O.call(P,Q[1])).done)return O;switch(P=0,O&&(Q=[Q[0]&2,O.value]),Q[0]){case 0:case 1:O=Q;break;case 4:return y.label++,{value:Q[1],done:!1};case 5:y.label++,P=Q[1],Q=[0];continue;case 7:Q=y.ops.pop(),y.trys.pop();continue;default:if(O=y.trys,!(O=O.length>0&&O[O.length-1])&&(Q[0]===6||Q[0]===2)){y=0;continue}if(Q[0]===3&&(!O||Q[1]>O[0]&&Q[1]<O[3])){y.label=Q[1];break}if(Q[0]===6&&y.label<O[1]){y.label=O[1],O=Q;break}if(O&&y.label<O[2]){y.label=O[2],y.ops.push(Q);break}O[2]&&y.ops.pop(),y.trys.pop();continue}Q=v.call(w,y)}catch(vt){Q=[6,vt],P=0}finally{D=O=0}if(Q[0]&5)throw Q[1];return{value:Q[0]?Q[1]:void 0,done:!0}}}var $=Object.create?function(w,v,y,D){D===void 0&&(D=y),Object.defineProperty(w,D,{enumerable:!0,get:function(){return v[y]}})}:function(w,v,y,D){D===void 0&&(D=y),w[D]=v[y]};function L(w,v){for(var y in w)y!=="default"&&!Object.prototype.hasOwnProperty.call(v,y)&&$(v,w,y)}function F(w){var v=typeof Symbol=="function"&&Symbol.iterator,y=v&&w[v],D=0;if(y)return y.call(w);if(w&&typeof w.length=="number")return{next:function(){return w&&D>=w.length&&(w=void 0),{value:w&&w[D++],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 D=y.call(w),P,O=[],K;try{for(;(v===void 0||v-- >0)&&!(P=D.next()).done;)O.push(P.value)}catch(V){K={error:V}}finally{try{P&&!P.done&&(y=D.return)&&y.call(D)}finally{if(K)throw K.error}}return O}function H(){for(var w=[],v=0;v<arguments.length;v++)w=w.concat(z(arguments[v]));return w}function G(){for(var w=0,v=0,y=arguments.length;v<y;v++)w+=arguments[v].length;for(var D=Array(w),P=0,v=0;v<y;v++)for(var O=arguments[v],K=0,V=O.length;K<V;K++,P++)D[P]=O[K];return D}function q(w,v){for(var y=0,D=v.length,P=w.length;y<D;y++,P++)w[P]=v[y];return w}function et(w){return this instanceof et?(this.v=w,this):new et(w)}function ot(w,v,y){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var D=y.apply(w,v||[]),P,O=[];return P={},K("next"),K("throw"),K("return"),P[Symbol.asyncIterator]=function(){return this},P;function K(Tt){D[Tt]&&(P[Tt]=function(zt){return new Promise(function(Bt,re){O.push([Tt,zt,Bt,re])>1||V(Tt,zt)})})}function V(Tt,zt){try{Z(D[Tt](zt))}catch(Bt){Rt(O[0][3],Bt)}}function Z(Tt){Tt.value instanceof et?Promise.resolve(Tt.value.v).then(Q,vt):Rt(O[0][2],Tt)}function Q(Tt){V("next",Tt)}function vt(Tt){V("throw",Tt)}function Rt(Tt,zt){Tt(zt),O.shift(),O.length&&V(O[0][0],O[0][1])}}function st(w){var v,y;return v={},D("next"),D("throw",function(P){throw P}),D("return"),v[Symbol.iterator]=function(){return this},v;function D(P,O){v[P]=w[P]?function(K){return(y=!y)?{value:et(w[P](K)),done:P==="return"}:O?O(K):K}:O}}function wt(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={},D("next"),D("throw"),D("return"),y[Symbol.asyncIterator]=function(){return this},y);function D(O){y[O]=w[O]&&function(K){return new Promise(function(V,Z){K=w[O](K),P(V,Z,K.done,K.value)})}}function P(O,K,V,Z){Promise.resolve(Z).then(function(Q){O({value:Q,done:V})},K)}}function rt(w,v){return Object.defineProperty?Object.defineProperty(w,"raw",{value:v}):w.raw=v,w}var U=Object.create?function(w,v){Object.defineProperty(w,"default",{enumerable:!0,value:v})}:function(w,v){w.default=v};function _t(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 U(v,w),v}function Ct(w){return w&&w.__esModule?w:{default:w}}function se(w,v){if(!v.has(w))throw new TypeError("attempted to get private field on non-instance");return v.get(w)}function we(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 It=function(){function w(v){this.options=v||Nt.options}return w.prototype.code=function(v,y,D,P){if(this.options.highlight){var O=this.options.highlight(v,y);O!=null&&O!==v&&(D=!0,v=O)}var K=D?v:this.options.escape(v,!0);if(!y)return`
<pre><code>`+K+`
</code></pre>
`;var V=this.options.langPrefix+this.options.escape(y,!0);return`
<pre><code class="`+V+'">'+K+`
</code></pre>
`},w.prototype.blockquote=function(v){return`<blockquote>
`+v+`</blockquote>
`},w.prototype.html=function(v){return v},w.prototype.heading=function(v,y,D){var P=this.options.headerPrefix+D.toLowerCase().replace(/[^\w]+/g,"-");return"<h"+y+' id="'+P+'">'+v+"</h"+y+`>
`},w.prototype.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},w.prototype.list=function(v,y){var D=y?"ol":"ul";return`
<`+D+`>
`+v+"</"+D+`>
`},w.prototype.listitem=function(v){return"<li>"+v+`</li>
`},w.prototype.paragraph=function(v){return"<p>"+v+`</p>
`},w.prototype.table=function(v,y){return`
<table>
<thead>
`+v+`</thead>
<tbody>
`+y+`</tbody>
</table>
`},w.prototype.tablerow=function(v){return`<tr>
`+v+`</tr>
`},w.prototype.tablecell=function(v,y){var D=y.header?"th":"td",P=y.align?"<"+D+' style="text-align:'+y.align+'">':"<"+D+">";return P+v+"</"+D+`>
`},w.prototype.strong=function(v){return"<strong>"+v+"</strong>"},w.prototype.em=function(v){return"<em>"+v+"</em>"},w.prototype.codespan=function(v){return"<code>"+v+"</code>"},w.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},w.prototype.del=function(v){return"<del>"+v+"</del>"},w.prototype.link=function(v,y,D){if(this.options.sanitize){var P=void 0;try{P=decodeURIComponent(this.options.unescape(v)).replace(/[^\w:]/g,"").toLowerCase()}catch(K){return D}if(P.indexOf("javascript:")===0||P.indexOf("vbscript:")===0||P.indexOf("data:")===0)return D}var O='<a href="'+v+'"';return y&&(O+=' title="'+y+'"'),O+=">"+D+"</a>",O},w.prototype.image=function(v,y,D){var P='<img src="'+v+'" alt="'+D+'"';return y&&(P+=' title="'+y+'"'),P+=this.options.xhtml?"/>":">",P},w.prototype.text=function(v){return v},w}();var Wt=function(){function w(v,y,D,P){if(D===void 0&&(D=Nt.options),this.staticThis=v,this.links=y,this.options=D,this.renderer=P||this.options.renderer||new It(this.options),!this.links)throw new Error("InlineLexer requires 'links' parameter.");this.setRules()}return w.output=function(v,y,D){var P=new this(this,y,D);return P.output(v)},w.getRulesBase=function(){if(this.rulesBase)return this.rulesBase;var v={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ <>]+(@|:\/)[^ <>]+)>/,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^<'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)([\s\S]*?[^`])\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,_inside:/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,_href:/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/};return v.link=new t(v.link).setGroup("inside",v._inside).setGroup("href",v._href).getRegexp(),v.reflink=new t(v.reflink).setGroup("inside",v._inside).getRegexp(),this.rulesBase=v},w.getRulesPedantic=function(){return this.rulesPedantic?this.rulesPedantic:this.rulesPedantic=Object.assign(Object.assign({},this.getRulesBase()),{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/})},w.getRulesGfm=function(){if(this.rulesGfm)return this.rulesGfm;var v=this.getRulesBase(),y=new t(v.escape).setGroup("])","~|])").getRegexp(),D=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:D})},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,D="";v;){if(y=this.rules.escape.exec(v)){v=v.substring(y[0].length),D+=y[1];continue}if(y=this.rules.autolink.exec(v)){var P=void 0,O=void 0;v=v.substring(y[0].length),y[2]==="@"?(P=this.options.escape(y[1].charAt(6)===":"?this.mangle(y[1].substring(7)):this.mangle(y[1])),O=this.mangle("mailto:")+P):(P=this.options.escape(y[1]),O=P),D+=this.renderer.link(O,null,P);continue}if(!this.inLink&&this.hasRulesGfm&&(y=this.rules.url.exec(v))){var P=void 0,O=void 0;v=v.substring(y[0].length),P=this.options.escape(y[1]),O=P,D+=this.renderer.link(O,null,P);continue}if(y=this.rules.tag.exec(v)){!this.inLink&&/^<a /i.test(y[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(y[0])&&(this.inLink=!1),v=v.substring(y[0].length),D+=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,D+=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 K=(y[2]||y[1]).replace(/\s+/g," "),V=this.links[K.toLowerCase()];if(!V||!V.href){D+=y[0].charAt(0),v=y[0].substring(1)+v;continue}this.inLink=!0,D+=this.outputLink(y,V),this.inLink=!1;continue}if(y=this.rules.strong.exec(v)){v=v.substring(y[0].length),D+=this.renderer.strong(this.output(y[2]||y[1]));continue}if(y=this.rules.em.exec(v)){v=v.substring(y[0].length),D+=this.renderer.em(this.output(y[2]||y[1]));continue}if(y=this.rules.code.exec(v)){v=v.substring(y[0].length),D+=this.renderer.codespan(this.options.escape(y[2].trim(),!0));continue}if(y=this.rules.br.exec(v)){v=v.substring(y[0].length),D+=this.renderer.br();continue}if(this.hasRulesGfm&&(y=this.rules.del.exec(v))){v=v.substring(y[0].length),D+=this.renderer.del(this.output(y[1]));continue}if(y=this.rules.text.exec(v)){v=v.substring(y[0].length),D+=this.renderer.text(this.options.escape(this.smartypants(y[0])));continue}if(v)throw new Error("Infinite loop on byte: "+v.charCodeAt(0))}return D},w.prototype.outputLink=function(v,y){var D=this.options.escape(y.href),P=y.title?this.options.escape(y.title):null;return v[0].charAt(0)!=="!"?this.renderer.link(D,P,this.output(v[1])):this.renderer.image(D,P,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="",D=v.length,P=0;P<D;P++){var O=void 0;Math.random()>.5&&(O="x"+v.charCodeAt(P).toString(16)),y+="&#"+O+";"}return y},w}();Wt.rulesBase=null,Wt.rulesPedantic=null,Wt.rulesGfm=null,Wt.rulesBreaks=null;var jt=function(){function w(v){this.simpleRenderers=[],this.line=0,this.tokens=[],this.token=null,this.options=v||Nt.options,this.renderer=this.options.renderer||new It(this.options)}return w.parse=function(v,y,D){var P=new this(D);return P.parse(y,v)},w.prototype.parse=function(v,y){this.inlineLexer=new Wt(Wt,v,this.options,this.renderer),this.tokens=y.reverse();for(var D="";this.next();)D+=this.tok();return D},w.prototype.debug=function(v,y){this.inlineLexer=new Wt(Wt,v,this.options,this.renderer),this.tokens=y.reverse();for(var D="";this.next();){var P=this.tok();this.token.line=this.line+=P.split(`
`).length-1,D+=P}return D},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 D="",P=this.token.ordered;this.next().type!=n.TokenType.listEnd;)D+=this.tok();return this.renderer.list(D,P)}case n.TokenType.listItemStart:{for(var D="";this.next().type!=n.TokenType.listItemEnd;)D+=this.token.type==n.TokenType.text?this.parseText():this.tok();return this.renderer.listitem(D)}case n.TokenType.looseItemStart:{for(var D="";this.next().type!=n.TokenType.listItemEnd;)D+=this.tok();return this.renderer.listitem(D)}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="",D="",K=void 0;K="";for(var V=0;V<this.token.header.length;V++){var Z={header:!0,align:this.token.align[V]},Q=this.inlineLexer.output(this.token.header[V]);K+=this.renderer.tablecell(Q,Z)}O+=this.renderer.tablerow(K);try{for(var vt=F(this.token.cells),Rt=vt.next();!Rt.done;Rt=vt.next()){var Tt=Rt.value;K="";for(var zt=0;zt<Tt.length;zt++)K+=this.renderer.tablecell(this.inlineLexer.output(Tt[zt]),{header:!1,align:this.token.align[zt]});D+=this.renderer.tablerow(K)}}catch(fe){v={error:fe}}finally{try{Rt&&!Rt.done&&(y=vt.return)&&y.call(vt)}finally{if(v)throw v.error}}return this.renderer.table(O,D)}case n.TokenType.blockquoteStart:{for(var D="";this.next().type!=n.TokenType.blockquoteEnd;)D+=this.tok();return this.renderer.blockquote(D)}case n.TokenType.hr:return this.renderer.hr();case n.TokenType.html:{var Bt=!this.token.pre&&!this.options.pedantic?this.inlineLexer.output(this.token.text):this.token.text;return this.renderer.html(Bt)}default:{if(this.simpleRenderers.length){for(var V=0;V<this.simpleRenderers.length;V++)if(this.token.type=="simpleRule"+(V+1))return this.simpleRenderers[V].call(this.renderer,this.token.execArr)}var re='Token with "'+this.token.type+'" type was not found.';if(this.options.silent)console.log(re);else throw new Error(re)}}},w}();var Nt=function(){function w(){}return w.setOptions=function(v){return Object.assign(this.options,v),this},w.setBlockRule=function(v,y){return y===void 0&&(y=function(){return""}),qt.simpleRules.push(v),this.simpleRenderers.push(y),this},w.parse=function(v,y){y===void 0&&(y=this.options);try{var D=this.callBlockLexer(v,y),P=D.tokens,O=D.links;return this.callParser(P,O,y)}catch(K){return this.callMe(K)}},w.debug=function(v,y){y===void 0&&(y=this.options);var D=this.callBlockLexer(v,y),P=D.tokens,O=D.links,K=P.slice(),V=new jt(y);V.simpleRenderers=this.simpleRenderers;var Z=V.debug(O,P);return K=K.map(function(Q){Q.type=n.TokenType[Q.type]||Q.type;var vt=Q.line;return delete Q.line,vt?Object.assign({line:vt},Q):Q}),{tokens:K,links:O,result:Z}},w.callBlockLexer=function(v,y){if(v===void 0&&(v=""),typeof v!="string")throw new Error("Expected that the 'src' parameter would have a 'string' type, got '"+typeof v+"'");return v=v.replace(/\r\n|\r/g,`
`).replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,`
`).replace(/^ +$/gm,""),qt.lex(v,y,!0)},w.callParser=function(v,y,D){if(this.simpleRenderers.length){var P=new jt(D);return P.simpleRenderers=this.simpleRenderers,P.parse(y,v)}else return jt.parse(v,y,D)},w.callMe=function(v){if(v.message+=`
Please report this to https://github.com/ts-stack/markdown`,this.options.silent)return"<p>An error occured:</p><pre>"+this.options.escape(v.message+"",!0)+"</pre>";throw v},w}();Nt.options=new c,Nt.simpleRenderers=[];var qt=function(){function w(v,y){this.staticThis=v,this.links={},this.tokens=[],this.options=y||Nt.options,this.setRules()}return w.lex=function(v,y,D,P){var O=new this(this,y);return O.getTokens(v,D,P)},w.getRulesBase=function(){if(this.rulesBase)return this.rulesBase;var v={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/,bullet:/(?:[*+-]|\d+\.)/,item:/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/};v.item=new t(v.item,"gm").setGroup(/bull/g,v.bullet).getRegexp(),v.list=new t(v.list).setGroup(/bull/g,v.bullet).setGroup("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))").setGroup("def","\\n+(?="+v.def.source+")").getRegexp();var y="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";return v.html=new t(v.html).setGroup("comment",/<!--[\s\S]*?-->/).setGroup("closed",/<(tag)[\s\S]+?<\/\1>/).setGroup("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/).setGroup(/tag/g,y).getRegexp(),v.paragraph=new t(v.paragraph).setGroup("hr",v.hr).setGroup("heading",v.heading).setGroup("lheading",v.lheading).setGroup("blockquote",v.blockquote).setGroup("tag","<"+y).setGroup("def",v.def).getRegexp(),this.rulesBase=v},w.getRulesGfm=function(){if(this.rulesGfm)return this.rulesGfm;var v=this.getRulesBase(),y=Object.assign(Object.assign({},v),{fences:/^ *(`{3,}|~{3,})[ \.]*((\S+)? *[^\n]*)\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),D=y.fences.source.replace("\\1","\\2"),P=v.list.source.replace("\\1","\\3");return y.paragraph=new t(v.paragraph).setGroup("(?!","(?!"+D+"|"+P+"|").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,D){var P=v,O;t:for(;P;){if((O=this.rules.newline.exec(P))&&(P=P.substring(O[0].length),O[0].length>1&&this.tokens.push({type:n.TokenType.space})),O=this.rules.code.exec(P)){P=P.substring(O[0].length);var K=O[0].replace(/^ {4}/gm,"");this.tokens.push({type:n.TokenType.code,text:this.options.pedantic?K:K.replace(/\n+$/,"")});continue}if(this.hasRulesGfm&&(O=this.rules.fences.exec(P))){P=P.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(P)){P=P.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(P))){P=P.substring(O[0].length);for(var V={type:n.TokenType.table,header:O[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]},Z=0;Z<V.align.length;Z++)/^ *-+: *$/.test(V.align[Z])?V.align[Z]="right":/^ *:-+: *$/.test(V.align[Z])?V.align[Z]="center":/^ *:-+ *$/.test(V.align[Z])?V.align[Z]="left":V.align[Z]=null;for(var Q=O[3].replace(/\n$/,"").split(`
`),Z=0;Z<Q.length;Z++)V.cells[Z]=Q[Z].split(/ *\| */);this.tokens.push(V);continue}if(O=this.rules.lheading.exec(P)){P=P.substring(O[0].length),this.tokens.push({type:n.TokenType.heading,depth:O[2]==="="?1:2,text:O[1]});continue}if(O=this.rules.hr.exec(P)){P=P.substring(O[0].length),this.tokens.push({type:n.TokenType.hr});continue}if(O=this.rules.blockquote.exec(P)){P=P.substring(O[0].length),this.tokens.push({type:n.TokenType.blockquoteStart});var vt=O[0].replace(/^ *> ?/gm,"");this.getTokens(vt),this.tokens.push({type:n.TokenType.blockquoteEnd});continue}if(O=this.rules.list.exec(P)){P=P.substring(O[0].length);var Rt=O[2];this.tokens.push({type:n.TokenType.listStart,ordered:Rt.length>1});for(var vt=O[0].match(this.rules.item),Tt=vt.length,zt=!1,Bt=void 0,re=void 0,be=void 0,Z=0;Z<Tt;Z++){var V=vt[Z];Bt=V.length,V=V.replace(/^ *([*+-]|\d+\.) +/,""),V.indexOf(`
`)!==-1&&(Bt-=V.length,V=this.options.pedantic?V.replace(/^ {1,4}/gm,""):V.replace(new RegExp("^ {1,"+Bt+"}","gm"),"")),this.options.smartLists&&Z!==Tt-1&&(re=this.staticThis.getRulesBase().bullet.exec(vt[Z+1])[0],Rt!==re&&!(Rt.length>1&&re.length>1)&&(P=vt.slice(Z+1).join(`
`)+P,Z=Tt-1)),be=zt||/\n\n(?!\s*$)/.test(V),Z!==Tt-1&&(zt=V.charAt(V.length-1)===`
`,be||(be=zt)),this.tokens.push({type:be?n.TokenType.looseItemStart:n.TokenType.listItemStart}),this.getTokens(V,!1,D),this.tokens.push({type:n.TokenType.listItemEnd})}this.tokens.push({type:n.TokenType.listEnd});continue}if(O=this.rules.html.exec(P)){P=P.substring(O[0].length);var fe=O[1],mn=fe==="pre"||fe==="script"||fe==="style";this.tokens.push({type:this.options.sanitize?n.TokenType.paragraph:n.TokenType.html,pre:!this.options.sanitizer&&mn,text:O[0]});continue}if(y&&(O=this.rules.def.exec(P))){P=P.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(P))){P=P.substring(O[0].length);for(var V={type:n.TokenType.table,header:O[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:O[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:[]},Z=0;Z<V.align.length;Z++)/^ *-+: *$/.test(V.align[Z])?V.align[Z]="right":/^ *:-+: *$/.test(V.align[Z])?V.align[Z]="center":/^ *:-+ *$/.test(V.align[Z])?V.align[Z]="left":V.align[Z]=null;for(var Q=O[3].replace(/(?: *\| *)?\n$/,"").split(`
`),Z=0;Z<Q.length;Z++)V.cells[Z]=Q[Z].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(V);continue}if(this.staticThis.simpleRules.length){for(var Ee=this.staticThis.simpleRules,Z=0;Z<Ee.length;Z++)if(O=Ee[Z].exec(P)){P=P.substring(O[0].length);var Be="simpleRule"+(Z+1);this.tokens.push({type:Be,execArr:O});continue t}}if(y&&(O=this.rules.paragraph.exec(P))){P=P.substring(O[0].length),O[1].slice(-1)===`
`?this.tokens.push({type:n.TokenType.paragraph,text:O[1].slice(0,-1)}):this.tokens.push({type:this.tokens.length>0?n.TokenType.paragraph:n.TokenType.text,text:O[1]});continue}if(O=this.rules.text.exec(P)){P=P.substring(O[0].length),this.tokens.push({type:n.TokenType.text,text:O[0]});continue}if(P)throw new Error("Infinite loop on byte: "+P.charCodeAt(0)+(", near text '"+P.slice(0,30)+"...'"))}return{tokens:this.tokens,links:this.links}},w}();qt.simpleRules=[],qt.rulesBase=null,qt.rulesGfm=null,qt.rulesTables=null,n.BlockLexer=qt,n.ExtendRegexp=t,n.InlineLexer=Wt,n.Marked=Nt,n.MarkedOptions=c,n.Parser=jt,n.Renderer=It,n.escape=o,n.unescape=l,Object.defineProperty(n,"__esModule",{value:!0})})});var Th=Sr(Qn=>{"use strict";var bv=Qn&&Qn.__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(Qn,"__esModule",{value:!0});Qn.Extractor=void 0;var Oa=Ch(),vv=function(n){bv(t,n);function t(e,i){var s=n.call(this)||this;return s.lowercaseKeys=i??!1,s.reset(e),s}return Object.defineProperty(t.prototype,"tables",{get:function(){return this.extractedTables},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"objects",{get:function(){var e=this;return this.extractedTables.map(function(i){return t.tableToObject(i,e.lowercaseKeys)})},enumerable:!1,configurable:!0}),t.prototype.reset=function(e){e===void 0&&(e="rows"),this.mode=e,this.currentRow=[],this.currentTable=[],this.extractedTables=[]},t.prototype.table=function(e,i){return this.extractedTables.push(this.mode==="rows"?this.currentTable:t.transposeTable(this.currentTable)),this.currentTable=[],n.prototype.table.call(this,e,i)},t.prototype.tablerow=function(e){return this.currentTable.push(this.currentRow),this.currentRow=[],n.prototype.tablerow.call(this,e)},t.prototype.tablecell=function(e,i){return this.currentRow.push(e),n.prototype.tablecell.call(this,e,i)},t.transposeTable=function(e){for(var i=[],s=e.length,r=e[0].length,a=0;a<r;a++){i.push([]);for(var o=0;o<s;o++)i[a].push(e[o][a])}return i},t.tableToObject=function(e,i){var s=e.shift().slice(1),r={};return e.forEach(function(a){var o=a.shift(),l={};a.forEach(function(c,u){l[i?s[u].toLowerCase():s[u]]=c}),r[i?o.toLowerCase():o]=l}),r},t.createExtractor=function(e,i,s){var r=new t(i,s);return Oa.Marked.setOptions({renderer:r}),Oa.Marked.parse(e),r},t.extractObject=function(e,i,s){var r=t.extractAllObjects(e,i,s);return r.length>0?r[0]:null},t.extractAllObjects=function(e,i,s){var r=t.createExtractor(e,i,s);return r.objects},t.extractTable=function(e,i,s){var r=t.extractAllTables(e,i,s);return r.length>0?r[0]:null},t.extractAllTables=function(e,i,s){var r=t.createExtractor(e,i,s);return r.tables},t.extract=function(e,i,s){var r=t.createExtractor(e,i,s);return r.objects.length>0?JSON.stringify(r.objects[0]):null},t.extractAll=function(e,i,s){var r=t.createExtractor(e,i,s);return r.objects.map(function(a){return JSON.stringify(a)})},t}(Oa.Renderer);Qn.Extractor=vv});ng(exports,{default:()=>Ga});var Oe=De(require("obsidian"));function Ae(){}var hl=function(){let n=0;return function(){return n++}}();function bt(n){return n===null||typeof n=="undefined"}function Et(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 $t=n=>(typeof n=="number"||n instanceof Number)&&isFinite(+n);function pe(n,t){return $t(n)?n:t}function at(n,t){return typeof n=="undefined"?t:n}var ul=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100:n/t,Mr=(n,t)=>typeof n=="string"&&n.endsWith("%")?parseFloat(n)/100*t:+n;function Dt(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(Et(n))if(r=n.length,i)for(s=r-1;s>=0;s--)t.call(e,n[s],s);else for(s=0;s<r;s++)t.call(e,n[s],s);else if(ft(n))for(a=Object.keys(n),r=a.length,s=0;s<r;s++)t.call(e,n[a[s]],a[s])}function ui(n,t){let e,i,s,r;if(!n||!t||n.length!==t.length)return!1;for(e=0,i=n.length;e<i;++e)if(s=n[e],r=t[e],s.datasetIndex!==r.datasetIndex||s.index!==r.index)return!1;return!0}function ns(n){if(Et(n))return n.map(ns);if(ft(n)){let t=Object.create(null),e=Object.keys(n),i=e.length,s=0;for(;s<i;++s)t[e[s]]=ns(n[e[s]]);return t}return n}function fl(n){return["__proto__","prototype","constructor"].indexOf(n)===-1}function sg(n,t,e,i){if(!fl(n))return;let s=t[n],r=e[n];ft(s)&&ft(r)?Bn(s,r,i):t[n]=ns(r)}function Bn(n,t,e){let i=Et(t)?t:[t],s=i.length;if(!ft(n))return n;e=e||{};let r=e.merger||sg;for(let a=0;a<s;++a){if(t=i[a],!ft(t))continue;let o=Object.keys(t);for(let l=0,c=o.length;l<c;++l)r(o[l],n,t,e)}return n}function jn(n,t){return Bn(n,t,{merger:rg})}function rg(n,t,e){if(!fl(n))return;let i=t[n],s=e[n];ft(i)&&ft(s)?jn(i,s):Object.prototype.hasOwnProperty.call(t,n)||(t[n]=ns(s))}var dl={"":n=>n,x:n=>n.x,y:n=>n.y};function Ve(n,t){return(dl[t]||(dl[t]=ag(t)))(n)}function ag(n){let t=og(n);return e=>{for(let i of t){if(i==="")break;e=e&&e[i]}return e}}function og(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 is(n){return n.charAt(0).toUpperCase()+n.slice(1)}var ge=n=>typeof n!="undefined",We=n=>typeof n=="function",Cr=(n,t)=>{if(n.size!==t.size)return!1;for(let e of n)if(!t.has(e))return!1;return!0};function pl(n){return n.type==="mouseup"||n.type==="click"||n.type==="contextmenu"}var Lt=Math.PI,Ot=2*Lt,lg=Ot+Lt,ss=Number.POSITIVE_INFINITY,cg=Lt/180,Ft=Lt/2,fi=Lt/4,gl=Lt*2/3,me=Math.log10,Ce=Math.sign;function Tr(n){let t=Math.round(n);n=Nn(n,t,n/1e3)?t:n;let e=Math.pow(10,Math.floor(me(n))),i=n/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function ml(n){let t=[],e=Math.sqrt(n),i;for(i=1;i<e;i++)n%i==0&&(t.push(i),t.push(n/i));return e===(e|0)&&t.push(e),t.sort((s,r)=>s-r).pop(),t}function xn(n){return!isNaN(parseFloat(n))&&isFinite(n)}function Nn(n,t,e){return Math.abs(n-t)<e}function bl(n,t){let e=Math.round(n);return e-t<=n&&e+t>=n}function Pr(n,t,e){let i,s,r;for(i=0,s=n.length;i<s;i++)r=n[i][e],isNaN(r)||(t.min=Math.min(t.min,r),t.max=Math.max(t.max,r))}function ve(n){return n*(Lt/180)}function rs(n){return n*(180/Lt)}function Or(n){if(!$t(n))return;let t=1,e=0;for(;Math.round(n*t)/t!==n;)t*=10,e++;return e}function Er(n,t){let e=t.x-n.x,i=t.y-n.y,s=Math.sqrt(e*e+i*i),r=Math.atan2(i,e);return r<-.5*Lt&&(r+=Ot),{angle:r,distance:s}}function as(n,t){return Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}function hg(n,t){return(n-t+lg)%Ot-Lt}function oe(n){return(n%Ot+Ot)%Ot}function Hn(n,t,e,i){let s=oe(n),r=oe(t),a=oe(e),o=oe(r-s),l=oe(a-s),c=oe(s-r),u=oe(s-a);return s===r||s===a||i&&r===a||o>l&&c<u}function Yt(n,t,e){return Math.max(t,Math.min(e,n))}function vl(n){return Yt(n,-32768,32767)}function Le(n,t,e,i=1e-6){return n>=Math.min(t,e)-i&&n<=Math.max(t,e)+i}function os(n,t,e){e=e||(a=>n[a]<t);let i=n.length-1,s=0,r;for(;i-s>1;)r=s+i>>1,e(r)?s=r:i=r;return{lo:s,hi:i}}var Re=(n,t,e,i)=>os(n,e,i?s=>n[s][t]<=e:s=>n[s][t]<e),_l=(n,t,e)=>os(n,e,i=>n[i][t]>=e);function yl(n,t,e){let i=0,s=n.length;for(;i<s&&n[i]<t;)i++;for(;s>i&&n[s-1]>e;)s--;return i>0||s<n.length?n.slice(i,s):n}var xl=["push","pop","shift","splice","unshift"];function wl(n,t){if(n._chartjs){n._chartjs.listeners.push(t);return}Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),xl.forEach(e=>{let i="_onData"+is(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 Dr(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)&&(xl.forEach(r=>{delete n[r]}),delete n._chartjs)}function Ar(n){let t=new Set,e,i;for(e=0,i=n.length;e<i;++e)t.add(n[e]);return t.size===i?n:Array.from(t)}var Lr=function(){return typeof window=="undefined"?function(n){return n()}:window.requestAnimationFrame}();function Rr(n,t,e){let i=e||(a=>Array.prototype.slice.call(a)),s=!1,r=[];return function(...a){r=i(a),s||(s=!0,Lr.call(window,()=>{s=!1,n.apply(t,r)}))}}function kl(n,t){let e;return function(...i){return t?(clearTimeout(e),e=setTimeout(n,t,i)):n.apply(this,i),t}}var ls=n=>n==="start"?"left":n==="end"?"right":"center",Qt=(n,t,e)=>n==="start"?t:n==="end"?e:(t+e)/2,Sl=(n,t,e,i)=>n===(i?"left":"right")?e:n==="center"?(t+e)/2:t;function Fr(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:m}=a.getUserBounds();d&&(s=Yt(Math.min(Re(o,a.axis,c).lo,e?i:Re(t,l,a.getPixelForValue(c)).lo),0,i-1)),m?r=Yt(Math.max(Re(o,a.axis,u,!0).hi+1,e?0:Re(t,l,a.getPixelForValue(u),!0).hi+1),s,i)-s:r=i-s}return{start:s,count:r}}function Ir(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 cs=n=>n===0||n===1,Ml=(n,t,e)=>-(Math.pow(2,10*(n-=1))*Math.sin((n-t)*Ot/e)),Cl=(n,t,e)=>Math.pow(2,-10*n)*Math.sin((n-t)*Ot/e)+1,Vn={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*Ft)+1,easeOutSine:n=>Math.sin(n*Ft),easeInOutSine:n=>-.5*(Math.cos(Lt*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=>cs(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=>cs(n)?n:Ml(n,.075,.3),easeOutElastic:n=>cs(n)?n:Cl(n,.075,.3),easeInOutElastic(n){let t=.1125,e=.45;return cs(n)?n:n<.5?.5*Ml(n*2,t,e):.5+.5*Cl(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-Vn.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?Vn.easeInBounce(n*2)*.5:Vn.easeOutBounce(n*2-1)*.5+.5};function di(n){return n+.5|0}var sn=(n,t,e)=>Math.max(Math.min(n,e),t);function pi(n){return sn(di(n*2.55),0,255)}function rn(n){return sn(di(n*255),0,255)}function Ye(n){return sn(di(n/2.55)/100,0,1)}function Tl(n){return sn(di(n*100),0,100)}var _e={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},$r=[..."0123456789ABCDEF"],ug=n=>$r[n&15],fg=n=>$r[(n&240)>>4]+$r[n&15],hs=n=>(n&240)>>4==(n&15),dg=n=>hs(n.r)&&hs(n.g)&&hs(n.b)&&hs(n.a);function pg(n){var t=n.length,e;return n[0]==="#"&&(t===4||t===5?e={r:255&_e[n[1]]*17,g:255&_e[n[2]]*17,b:255&_e[n[3]]*17,a:t===5?_e[n[4]]*17:255}:(t===7||t===9)&&(e={r:_e[n[1]]<<4|_e[n[2]],g:_e[n[3]]<<4|_e[n[4]],b:_e[n[5]]<<4|_e[n[6]],a:t===9?_e[n[7]]<<4|_e[n[8]]:255})),e}var gg=(n,t)=>n<255?t(n):"";function mg(n){var t=dg(n)?ug:fg;return n?"#"+t(n.r)+t(n.g)+t(n.b)+gg(n.a,t):void 0}var bg=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Pl(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 vg(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 _g(n,t,e){let i=Pl(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 yg(n,t,e,i,s){return n===s?(t-e)/i+(t<e?6:0):t===s?(e-n)/i+2:(n-t)/i+4}function zr(n){let t=255,e=n.r/t,i=n.g/t,s=n.b/t,r=Math.max(e,i,s),a=Math.min(e,i,s),o=(r+a)/2,l,c,u;return r!==a&&(u=r-a,c=o>.5?u/(2-r-a):u/(r+a),l=yg(e,i,s,u,r),l=l*60+.5),[l|0,c||0,o]}function Br(n,t,e,i){return(Array.isArray(t)?n(t[0],t[1],t[2]):n(t,e,i)).map(rn)}function jr(n,t,e){return Br(Pl,n,t,e)}function xg(n,t,e){return Br(_g,n,t,e)}function wg(n,t,e){return Br(vg,n,t,e)}function Ol(n){return(n%360+360)%360}function kg(n){let t=bg.exec(n),e=255,i;if(!t)return;t[5]!==i&&(e=t[6]?pi(+t[5]):rn(+t[5]));let s=Ol(+t[2]),r=+t[3]/100,a=+t[4]/100;return t[1]==="hwb"?i=xg(s,r,a):t[1]==="hsv"?i=wg(s,r,a):i=jr(s,r,a),{r:i[0],g:i[1],b:i[2],a:e}}function Sg(n,t){var e=zr(n);e[0]=Ol(e[0]+t),e=jr(e),n.r=e[0],n.g=e[1],n.b=e[2]}function Mg(n){if(!n)return;let t=zr(n),e=t[0],i=Tl(t[1]),s=Tl(t[2]);return n.a<255?`hsla(${e}, ${i}%, ${s}%, ${Ye(n.a)})`:`hsl(${e}, ${i}%, ${s}%)`}var El={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"},Dl={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 Cg(){let n={},t=Object.keys(Dl),e=Object.keys(El),i,s,r,a,o;for(i=0;i<t.length;i++){for(a=o=t[i],s=0;s<e.length;s++)r=e[s],o=o.replace(r,El[r]);r=parseInt(Dl[a],16),n[o]=[r>>16&255,r>>8&255,r&255]}return n}var us;function Tg(n){us||(us=Cg(),us.transparent=[0,0,0,0]);let t=us[n.toLowerCase()];return t&&{r:t[0],g:t[1],b:t[2],a:t.length===4?t[3]:255}}var Pg=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function Og(n){let t=Pg.exec(n),e=255,i,s,r;if(!!t){if(t[7]!==i){let a=+t[7];e=t[8]?pi(a):sn(a*255,0,255)}return i=+t[1],s=+t[3],r=+t[5],i=255&(t[2]?pi(i):sn(i,0,255)),s=255&(t[4]?pi(s):sn(s,0,255)),r=255&(t[6]?pi(r):sn(r,0,255)),{r:i,g:s,b:r,a:e}}}function Eg(n){return n&&(n.a<255?`rgba(${n.r}, ${n.g}, ${n.b}, ${Ye(n.a)})`:`rgb(${n.r}, ${n.g}, ${n.b})`)}var Nr=n=>n<=.0031308?n*12.92:Math.pow(n,1/2.4)*1.055-.055,Wn=n=>n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);function Dg(n,t,e){let i=Wn(Ye(n.r)),s=Wn(Ye(n.g)),r=Wn(Ye(n.b));return{r:rn(Nr(i+e*(Wn(Ye(t.r))-i))),g:rn(Nr(s+e*(Wn(Ye(t.g))-s))),b:rn(Nr(r+e*(Wn(Ye(t.b))-r))),a:n.a+e*(t.a-n.a)}}function fs(n,t,e){if(n){let i=zr(n);i[t]=Math.max(0,Math.min(i[t]+i[t]*e,t===0?360:1)),i=jr(i),n.r=i[0],n.g=i[1],n.b=i[2]}}function Al(n,t){return n&&Object.assign(t||{},n)}function Ll(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=rn(n[3]))):(t=Al(n,{r:0,g:0,b:0,a:1}),t.a=rn(t.a)),t}function Ag(n){return n.charAt(0)==="r"?Og(n):kg(n)}var gi=class{constructor(t){if(t instanceof gi)return t;let e=typeof t,i;e==="object"?i=Ll(t):e==="string"&&(i=pg(t)||Tg(t)||Ag(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Al(this._rgb);return t&&(t.a=Ye(t.a)),t}set rgb(t){this._rgb=Ll(t)}rgbString(){return this._valid?Eg(this._rgb):void 0}hexString(){return this._valid?mg(this._rgb):void 0}hslString(){return this._valid?Mg(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=Dg(this._rgb,t._rgb,e)),this}clone(){return new gi(this.rgb)}alpha(t){return this._rgb.a=rn(t),this}clearer(t){let e=this._rgb;return e.a*=1-t,this}greyscale(){let t=this._rgb,e=di(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 fs(this._rgb,2,t),this}darken(t){return fs(this._rgb,2,-t),this}saturate(t){return fs(this._rgb,1,t),this}desaturate(t){return fs(this._rgb,1,-t),this}rotate(t){return Sg(this._rgb,t),this}};function Rl(n){return new gi(n)}function Fl(n){if(n&&typeof n=="object"){let t=n.toString();return t==="[object CanvasPattern]"||t==="[object CanvasGradient]"}return!1}function Hr(n){return Fl(n)?n:Rl(n)}function Vr(n){return Fl(n)?n:Rl(n).saturate(.5).darken(.1).hexString()}var an=Object.create(null),ds=Object.create(null);function mi(n,t){if(!t)return n;let e=t.split(".");for(let i=0,s=e.length;i<s;++i){let r=e[i];n=n[r]||(n[r]=Object.create(null))}return n}function Wr(n,t,e){return typeof t=="string"?Bn(mi(n,t),e):Bn(mi(n,""),t)}var Il=class{constructor(t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=e=>e.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(e,i)=>Vr(i.backgroundColor),this.hoverBorderColor=(e,i)=>Vr(i.borderColor),this.hoverColor=(e,i)=>Vr(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 Wr(this,t,e)}get(t){return mi(this,t)}describe(t,e){return Wr(ds,t,e)}override(t,e){return Wr(an,t,e)}route(t,e,i,s){let r=mi(this,t),a=mi(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 Il({_scriptable:n=>!n.startsWith("on"),_indexable:n=>n!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});function Lg(n){return!n||bt(n.size)||bt(n.family)?null:(n.style?n.style+" ":"")+(n.weight?n.weight+" ":"")+n.size+"px "+n.family}function bi(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 $l(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,m;for(l=0;l<o;l++)if(d=e[l],d!=null&&Et(d)!==!0)a=bi(n,s,r,a,d);else if(Et(d))for(c=0,u=d.length;c<u;c++)m=d[c],m!=null&&!Et(m)&&(a=bi(n,s,r,a,m));n.restore();let p=r.length/2;if(p>e.length){for(l=0;l<p;l++)delete s[r[l]];r.splice(0,p)}return a}function on(n,t,e){let i=n.currentDevicePixelRatio,s=e!==0?Math.max(e/2,.5):0;return Math.round((t-s)*i)/i+s}function Yr(n,t){t=t||n.getContext("2d"),t.save(),t.resetTransform(),t.clearRect(0,0,n.width,n.height),t.restore()}function ps(n,t,e,i){Gr(n,t,e,i,null)}function Gr(n,t,e,i,s){let r,a,o,l,c,u,d=t.pointStyle,m=t.rotation,p=t.radius,b=(m||0)*cg;if(d&&typeof d=="object"&&(r=d.toString(),r==="[object HTMLImageElement]"||r==="[object HTMLCanvasElement]")){n.save(),n.translate(e,i),n.rotate(b),n.drawImage(d,-d.width/2,-d.height/2,d.width,d.height),n.restore();return}if(!(isNaN(p)||p<=0)){switch(n.beginPath(),d){default:s?n.ellipse(e,i,s/2,p,0,0,Ot):n.arc(e,i,p,0,Ot),n.closePath();break;case"triangle":n.moveTo(e+Math.sin(b)*p,i-Math.cos(b)*p),b+=gl,n.lineTo(e+Math.sin(b)*p,i-Math.cos(b)*p),b+=gl,n.lineTo(e+Math.sin(b)*p,i-Math.cos(b)*p),n.closePath();break;case"rectRounded":c=p*.516,l=p-c,a=Math.cos(b+fi)*l,o=Math.sin(b+fi)*l,n.arc(e-a,i-o,c,b-Lt,b-Ft),n.arc(e+o,i-a,c,b-Ft,b),n.arc(e+a,i+o,c,b,b+Ft),n.arc(e-o,i+a,c,b+Ft,b+Lt),n.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*p,u=s?s/2:l,n.rect(e-u,i-l,2*u,2*l);break}b+=fi;case"rectRot":a=Math.cos(b)*p,o=Math.sin(b)*p,n.moveTo(e-a,i-o),n.lineTo(e+o,i-a),n.lineTo(e+a,i+o),n.lineTo(e-o,i+a),n.closePath();break;case"crossRot":b+=fi;case"cross":a=Math.cos(b)*p,o=Math.sin(b)*p,n.moveTo(e-a,i-o),n.lineTo(e+a,i+o),n.moveTo(e+o,i-a),n.lineTo(e-o,i+a);break;case"star":a=Math.cos(b)*p,o=Math.sin(b)*p,n.moveTo(e-a,i-o),n.lineTo(e+a,i+o),n.moveTo(e+o,i-a),n.lineTo(e-o,i+a),b+=fi,a=Math.cos(b)*p,o=Math.sin(b)*p,n.moveTo(e-a,i-o),n.lineTo(e+a,i+o),n.moveTo(e+o,i-a),n.lineTo(e-o,i+a);break;case"line":a=s?s/2:Math.cos(b)*p,o=Math.sin(b)*p,n.moveTo(e-a,i-o),n.lineTo(e+a,i+o);break;case"dash":n.moveTo(e,i),n.lineTo(e+Math.cos(b)*p,i+Math.sin(b)*p);break}n.fill(),t.borderWidth>0&&n.stroke()}}function Yn(n,t,e){return e=e||.5,!t||n&&n.x>t.left-e&&n.x<t.right+e&&n.y>t.top-e&&n.y<t.bottom+e}function vi(n,t){n.save(),n.beginPath(),n.rect(t.left,t.top,t.right-t.left,t.bottom-t.top),n.clip()}function _i(n){n.restore()}function zl(n,t,e,i,s){if(!t)return n.lineTo(e.x,e.y);if(s==="middle"){let r=(t.x+e.x)/2;n.lineTo(r,t.y),n.lineTo(r,e.y)}else s==="after"!=!!i?n.lineTo(t.x,e.y):n.lineTo(e.x,t.y);n.lineTo(e.x,e.y)}function Bl(n,t,e,i){if(!t)return n.lineTo(e.x,e.y);n.bezierCurveTo(i?t.cp1x:t.cp2x,i?t.cp1y:t.cp2y,i?e.cp2x:e.cp1x,i?e.cp2y:e.cp1y,e.x,e.y)}function ln(n,t,e,i,s,r={}){let a=Et(t)?t:[t],o=r.strokeWidth>0&&r.strokeColor!=="",l,c;for(n.save(),n.font=s.string,Rg(n,r),l=0;l<a.length;++l)c=a[l],o&&(r.strokeColor&&(n.strokeStyle=r.strokeColor),bt(r.strokeWidth)||(n.lineWidth=r.strokeWidth),n.strokeText(c,e,i,r.maxWidth)),n.fillText(c,e,i,r.maxWidth),Fg(n,e,i,c,r),i+=s.lineHeight;n.restore()}function Rg(n,t){t.translation&&n.translate(t.translation[0],t.translation[1]),bt(t.rotation)||n.rotate(t.rotation),t.color&&(n.fillStyle=t.color),t.textAlign&&(n.textAlign=t.textAlign),t.textBaseline&&(n.textBaseline=t.textBaseline)}function Fg(n,t,e,i,s){if(s.strikethrough||s.underline){let r=n.measureText(i),a=t-r.actualBoundingBoxLeft,o=t+r.actualBoundingBoxRight,l=e-r.actualBoundingBoxAscent,c=e+r.actualBoundingBoxDescent,u=s.strikethrough?(l+c)/2:c;n.strokeStyle=n.fillStyle,n.beginPath(),n.lineWidth=s.decorationWidth||2,n.moveTo(a,u),n.lineTo(o,u),n.stroke()}}function Gn(n,t){let{x:e,y:i,w:s,h:r,radius:a}=t;n.arc(e+a.topLeft,i+a.topLeft,a.topLeft,-Ft,Lt,!0),n.lineTo(e,i+r-a.bottomLeft),n.arc(e+a.bottomLeft,i+r-a.bottomLeft,a.bottomLeft,Lt,Ft,!0),n.lineTo(e+s-a.bottomRight,i+r),n.arc(e+s-a.bottomRight,i+r-a.bottomRight,a.bottomRight,Ft,0,!0),n.lineTo(e+s,i+a.topRight),n.arc(e+s-a.topRight,i+a.topRight,a.topRight,0,-Ft,!0),n.lineTo(e+a.topLeft,i)}var Ig=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),$g=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function zg(n,t){let e=(""+n).match(Ig);if(!e||e[1]==="normal")return t*1.2;switch(n=+e[2],e[3]){case"px":return n;case"%":n/=100;break}return t*n}var Bg=n=>+n||0;function gs(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]=Bg(r(a));return e}function qr(n){return gs(n,{top:"y",right:"x",bottom:"y",left:"x"})}function cn(n){return gs(n,["topLeft","topRight","bottomLeft","bottomRight"])}function te(n){let t=qr(n);return t.width=t.left+t.right,t.height=t.top+t.bottom,t}function Vt(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($g)&&(console.warn('Invalid font style specified: "'+i+'"'),i="");let s={family:at(n.family,t.family),lineHeight:zg(at(n.lineHeight,t.lineHeight),e),size:e,style:i,weight:at(n.weight,t.weight),string:""};return s.string=Lg(s),s}function qn(n,t,e,i){let s=!0,r,a,o;for(r=0,a=n.length;r<a;++r)if(o=n[r],o!==void 0&&(t!==void 0&&typeof o=="function"&&(o=o(t),s=!1),e!==void 0&&Et(o)&&(o=o[e%o.length],s=!1),o!==void 0))return i&&!s&&(i.cacheable=!1),o}function jl(n,t,e){let{min:i,max:s}=n,r=Mr(t,(s-i)/2),a=(o,l)=>e&&o===0?0:o+l;return{min:a(i,-Math.abs(r)),max:a(s,r)}}function Ge(n,t){return Object.assign(Object.create(n),t)}function ms(n,t=[""],e=n,i,s=()=>n[0]){ge(i)||(i=Wl("_fallback",n));let r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:n,_rootScopes:e,_fallback:i,_getTarget:s,override:a=>ms([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 Nl(a,o,()=>qg(o,t,n,a))},getOwnPropertyDescriptor(a,o){return Reflect.getOwnPropertyDescriptor(a._scopes[0],o)},getPrototypeOf(){return Reflect.getPrototypeOf(n[0])},has(a,o){return Yl(a).includes(o)},ownKeys(a){return Yl(a)},set(a,o,l){let c=a._storage||(a._storage=s());return a[o]=c[o]=l,delete a._keys,!0}})}function wn(n,t,e,i){let s={_cacheable:!1,_proxy:n,_context:t,_subProxy:e,_stack:new Set,_descriptors:Ur(n,i),setContext:r=>wn(n,r,e,i),override:r=>wn(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 Nl(r,a,()=>Ng(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 Ur(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:We(e)?e:()=>e,isIndexable:We(i)?i:()=>i}}var jg=(n,t)=>n?n+is(t):t,Xr=(n,t)=>ft(t)&&n!=="adapters"&&(Object.getPrototypeOf(t)===null||t.constructor===Object);function Nl(n,t,e){if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let i=e();return n[t]=i,i}function Ng(n,t,e){let{_proxy:i,_context:s,_subProxy:r,_descriptors:a}=n,o=i[t];return We(o)&&a.isScriptable(t)&&(o=Hg(t,o,n,e)),Et(o)&&o.length&&(o=Vg(t,o,n,a.isIndexable)),Xr(t,o)&&(o=wn(o,s,r&&r[t],a)),o}function Hg(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),Xr(n,t)&&(t=Kr(s._scopes,s,n,t)),t}function Vg(n,t,e,i){let{_proxy:s,_context:r,_subProxy:a,_descriptors:o}=e;if(ge(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=Kr(c,s,n,u);t.push(wn(d,r,a&&a[n],o))}}return t}function Hl(n,t,e){return We(n)?n(t,e):n}var Wg=(n,t)=>n===!0?t:typeof n=="string"?Ve(t,n):void 0;function Yg(n,t,e,i,s){for(let r of t){let a=Wg(e,r);if(a){n.add(a);let o=Hl(a._fallback,e,s);if(ge(o)&&o!==e&&o!==i)return o}else if(a===!1&&ge(i)&&e!==i)return null}return!1}function Kr(n,t,e,i){let s=t._rootScopes,r=Hl(t._fallback,e,i),a=[...n,...s],o=new Set;o.add(i);let l=Vl(o,a,e,r||e,i);return l===null||ge(r)&&r!==e&&(l=Vl(o,a,r,l,i),l===null)?!1:ms(Array.from(o),[""],s,r,()=>Gg(t,e,i))}function Vl(n,t,e,i,s){for(;e;)e=Yg(n,t,e,i,s);return e}function Gg(n,t,e){let i=n._getTarget();t in i||(i[t]={});let s=i[t];return Et(s)&&ft(e)?e:s}function qg(n,t,e,i){let s;for(let r of t)if(s=Wl(jg(r,n),e),ge(s))return Xr(n,s)?Kr(e,i,n,s):s}function Wl(n,t){for(let e of t){if(!e)continue;let i=e[n];if(ge(i))return i}}function Yl(n){let t=n._keys;return t||(t=n._keys=Ug(n._scopes)),t}function Ug(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 Zr(n,t,e,i){let{iScale:s}=n,{key:r="r"}=this._parsing,a=new Array(i),o,l,c,u;for(o=0,l=i;o<l;++o)c=o+e,u=t[c],a[o]={r:s.parse(Ve(u,r),c)};return a}var Xg=Number.EPSILON||1e-14,Un=(n,t)=>t<n.length&&!n[t].skip&&n[t],Gl=n=>n==="x"?"y":"x";function Kg(n,t,e,i){let s=n.skip?t:n,r=t,a=e.skip?t:e,o=as(r,s),l=as(a,r),c=o/(o+l),u=l/(o+l);c=isNaN(c)?0:c,u=isNaN(u)?0:u;let d=i*c,m=i*u;return{previous:{x:r.x-d*(a.x-s.x),y:r.y-d*(a.y-s.y)},next:{x:r.x+m*(a.x-s.x),y:r.y+m*(a.y-s.y)}}}function Zg(n,t,e){let i=n.length,s,r,a,o,l,c=Un(n,0);for(let u=0;u<i-1;++u)if(l=c,c=Un(n,u+1),!(!l||!c)){if(Nn(t[u],0,Xg)){e[u]=e[u+1]=0;continue}s=e[u]/t[u],r=e[u+1]/t[u],o=Math.pow(s,2)+Math.pow(r,2),!(o<=9)&&(a=3/Math.sqrt(o),e[u]=s*a*t[u],e[u+1]=r*a*t[u])}}function Jg(n,t,e="x"){let i=Gl(e),s=n.length,r,a,o,l=Un(n,0);for(let c=0;c<s;++c){if(a=o,o=l,l=Un(n,c+1),!o)continue;let u=o[e],d=o[i];a&&(r=(u-a[e])/3,o[`cp1${e}`]=u-r,o[`cp1${i}`]=d-r*t[c]),l&&(r=(l[e]-u)/3,o[`cp2${e}`]=u+r,o[`cp2${i}`]=d+r*t[c])}}function Qg(n,t="x"){let e=Gl(t),i=n.length,s=Array(i).fill(0),r=Array(i),a,o,l,c=Un(n,0);for(a=0;a<i;++a)if(o=l,l=c,c=Un(n,a+1),!!l){if(c){let u=c[t]-l[t];s[a]=u!==0?(c[e]-l[e])/u:0}r[a]=o?c?Ce(s[a-1])!==Ce(s[a])?0:(s[a-1]+s[a])/2:s[a-1]:s[a]}Zg(n,s,r),Jg(n,r,t)}function bs(n,t,e){return Math.max(Math.min(n,e),t)}function tm(n,t){let e,i,s,r,a,o=Yn(n[0],t);for(e=0,i=n.length;e<i;++e)a=r,r=o,o=e<i-1&&Yn(n[e+1],t),!!r&&(s=n[e],a&&(s.cp1x=bs(s.cp1x,t.left,t.right),s.cp1y=bs(s.cp1y,t.top,t.bottom)),o&&(s.cp2x=bs(s.cp2x,t.left,t.right),s.cp2y=bs(s.cp2y,t.top,t.bottom)))}function ql(n,t,e,i,s){let r,a,o,l;if(t.spanGaps&&(n=n.filter(c=>!c.skip)),t.cubicInterpolationMode==="monotone")Qg(n,s);else{let c=i?n[n.length-1]:n[0];for(r=0,a=n.length;r<a;++r)o=n[r],l=Kg(c,o,n[Math.min(r+1,a-(i?0:1))%a],t.tension),o.cp1x=l.previous.x,o.cp1y=l.previous.y,o.cp2x=l.next.x,o.cp2y=l.next.y,c=o}t.capBezierPoints&&tm(n,e)}function Jr(){return typeof window!="undefined"&&typeof document!="undefined"}function vs(n){let t=n.parentNode;return t&&t.toString()==="[object ShadowRoot]"&&(t=t.host),t}function _s(n,t,e){let i;return typeof n=="string"?(i=parseInt(n,10),n.indexOf("%")!==-1&&(i=i/100*t.parentNode[e])):i=n,i}var ys=n=>window.getComputedStyle(n,null);function em(n,t){return ys(n).getPropertyValue(t)}var nm=["top","right","bottom","left"];function kn(n,t,e){let i={};e=e?"-"+e:"";for(let s=0;s<4;s++){let r=nm[s];i[r]=parseFloat(n[t+"-"+r+e])||0}return i.width=i.left+i.right,i.height=i.top+i.bottom,i}var im=(n,t,e)=>(n>0||t>0)&&(!e||!e.shadowRoot);function sm(n,t){let e=n.touches,i=e&&e.length?e[0]:n,{offsetX:s,offsetY:r}=i,a=!1,o,l;if(im(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 hn(n,t){if("native"in n)return n;let{canvas:e,currentDevicePixelRatio:i}=t,s=ys(e),r=s.boxSizing==="border-box",a=kn(s,"padding"),o=kn(s,"border","width"),{x:l,y:c,box:u}=sm(n,e),d=a.left+(u&&o.left),m=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-m)/b*e.height/i)}}function rm(n,t,e){let i,s;if(t===void 0||e===void 0){let r=vs(n);if(!r)t=n.clientWidth,e=n.clientHeight;else{let a=r.getBoundingClientRect(),o=ys(r),l=kn(o,"border","width"),c=kn(o,"padding");t=a.width-c.width-l.width,e=a.height-c.height-l.height,i=_s(o.maxWidth,r,"clientWidth"),s=_s(o.maxHeight,r,"clientHeight")}}return{width:t,height:e,maxWidth:i||ss,maxHeight:s||ss}}var Qr=n=>Math.round(n*10)/10;function Ul(n,t,e,i){let s=ys(n),r=kn(s,"margin"),a=_s(s.maxWidth,n,"clientWidth")||ss,o=_s(s.maxHeight,n,"clientHeight")||ss,l=rm(n,t,e),{width:c,height:u}=l;if(s.boxSizing==="content-box"){let d=kn(s,"border","width"),m=kn(s,"padding");c-=m.width+d.width,u-=m.height+d.height}return c=Math.max(0,c-r.width),u=Math.max(0,i?Math.floor(c/i):u-r.height),c=Qr(Math.min(c,a,l.maxWidth)),u=Qr(Math.min(u,o,l.maxHeight)),c&&!u&&(u=Qr(c/2)),{width:c,height:u}}function ta(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 Xl=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 ea(n,t){let e=em(n,t),i=e&&e.match(/^(\d+)(\.\d+)?px$/);return i?+i[1]:void 0}function un(n,t,e,i){return{x:n.x+e*(t.x-n.x),y:n.y+e*(t.y-n.y)}}function Kl(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 Zl(n,t,e,i){let s={x:n.cp2x,y:n.cp2y},r={x:t.cp1x,y:t.cp1y},a=un(n,s,e),o=un(s,r,e),l=un(r,t,e),c=un(a,o,e),u=un(o,l,e);return un(c,u,e)}var Jl=new Map;function am(n,t){t=t||{};let e=n+JSON.stringify(t),i=Jl.get(e);return i||(i=new Intl.NumberFormat(n,t),Jl.set(e,i)),i}function Xn(n,t,e){return am(t,e).format(n)}var om=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}}},lm=function(){return{x(n){return n},setWidth(n){},textAlign(n){return n},xPlus(n,t){return n+t},leftForLtr(n,t){return n}}};function Sn(n,t,e){return n?om(t,e):lm()}function na(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 ia(n,t){t!==void 0&&(delete n.prevTextDirection,n.canvas.style.setProperty("direction",t[0],t[1]))}function Ql(n){return n==="angle"?{between:Hn,compare:hg,normalize:oe}:{between:Le,compare:(t,e)=>t-e,normalize:t=>t}}function tc({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 cm(n,t,e){let{property:i,start:s,end:r}=e,{between:a,normalize:o}=Ql(i),l=t.length,{start:c,end:u,loop:d}=n,m,p;if(d){for(c+=l,u+=l,m=0,p=l;m<p&&a(o(t[c%l][i]),s,r);++m)c--,u--;c%=l,u%=l}return u<c&&(u+=l),{start:c,end:u,loop:d,style:n.style}}function sa(n,t,e){if(!e)return[n];let{property:i,start:s,end:r}=e,a=t.length,{compare:o,between:l,normalize:c}=Ql(i),{start:u,end:d,loop:m,style:p}=cm(n,t,e),b=[],k=!1,M=null,T,R,$,L=()=>l(s,$,T)&&o(s,$)!==0,F=()=>o(r,T)===0||l(r,$,T),z=()=>k||L(),H=()=>!k||F();for(let G=u,q=u;G<=d;++G)R=t[G%a],!R.skip&&(T=c(R[i]),T!==$&&(k=l(T,s,r),M===null&&z()&&(M=o(T,s)===0?G:q),M!==null&&H()&&(b.push(tc({start:M,end:G,loop:m,count:a,style:p})),M=null),q=G,$=T));return M!==null&&b.push(tc({start:M,end:d,loop:m,count:a,style:p})),b}function ra(n,t){let e=[],i=n.segments;for(let s=0;s<i.length;s++){let r=sa(i[s],n.points,t);r.length&&e.push(...r)}return e}function hm(n,t,e,i){let s=0,r=t-1;if(e&&!i)for(;s<t&&!n[s].skip;)s++;for(;s<t&&n[s].skip;)s++;for(s%=t,e&&(r+=s);r>s&&n[r%t].skip;)r--;return r%=t,{start:s,end:r}}function um(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 ec(n,t){let e=n.points,i=n.options.spanGaps,s=e.length;if(!s)return[];let r=!!n._loop,{start:a,end:o}=hm(e,s,r,i);if(i===!0)return nc(n,[{start:a,end:o,loop:r}],e,t);let l=o<a?o+s:o,c=!!n._fullLoop&&a===0&&o===s-1;return nc(n,um(e,a,l,c),e,t)}function nc(n,t,e,i){return!i||!i.setContext||!e?t:fm(n,t,e,i)}function fm(n,t,e,i){let s=n._chart.getContext(),r=ic(n.options),{_datasetIndex:a,options:{spanGaps:o}}=n,l=e.length,c=[],u=r,d=t[0].start,m=d;function p(b,k,M,T){let R=o?-1:1;if(b!==k){for(b+=l;e[b%l].skip;)b-=R;for(;e[k%l].skip;)k+=R;b%l!=k%l&&(c.push({start:b%l,end:k%l,loop:M,style:T}),u=T,d=k%l)}}for(let b of t){d=o?d:b.start;let k=e[d%l],M;for(m=d+1;m<=b.end;m++){let T=e[m%l];M=ic(i.setContext(Ge(s,{type:"segment",p0:k,p1:T,p0DataIndex:(m-1)%l,p1DataIndex:m%l,datasetIndex:a}))),dm(M,u)&&p(d,m-1,b.loop,u),k=T,u=M}d<m-1&&p(d,m-1,b.loop,u)}return c}function ic(n){return{backgroundColor:n.backgroundColor,borderCapStyle:n.borderCapStyle,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderJoinStyle:n.borderJoinStyle,borderWidth:n.borderWidth,borderColor:n.borderColor}}function dm(n,t){return t&&JSON.stringify(n)!==JSON.stringify(t)}var sc=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){let r=e.listeners[s],a=e.duration;r.forEach(o=>o({chart:t,initial:e.initial,numSteps:a,currentStep:Math.min(i-e.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=Lr.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)}},qe=new sc,rc="transparent",pm={boolean(n,t,e){return e>.5?t:n},color(n,t,e){let i=Hr(n||rc),s=i.valid&&Hr(t||rc);return s&&s.valid?s.mix(i,e).hexString():t},number(n,t,e){return n+(t-n)*e}},ac=class{constructor(t,e,i,s){let r=e[i];s=qn([t.to,s,r,t.from]);let a=qn([t.from,r,s]);this._active=!0,this._fn=t.fn||pm[t.type||typeof a],this._easing=Vn[t.easing]||Vn.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=qn([t.to,e,s,t.from]),this._from=qn([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){let e=t-this._start,i=this._duration,s=this._prop,r=this._from,a=this._loop,o=this._to,l;if(this._active=r!==o&&(a||e<i),!this._active){this._target[s]=o,this._notify(!0);return}if(e<0){this._target[s]=r;return}l=e/i%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(r,o,l)}wait(){let t=this._promises||(this._promises=[]);return new Promise((e,i)=>{t.push({res:e,rej:i})})}_notify(t){let e=t?"res":"rej",i=this._promises||[];for(let s=0;s<i.length;s++)i[s][e]()}},gm=["x","y","borderWidth","radius","tension"],mm=["color","borderColor","backgroundColor"];dt.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});var bm=Object.keys(dt.animation);dt.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:n=>n!=="onProgress"&&n!=="onComplete"&&n!=="fn"});dt.set("animations",{colors:{type:"color",properties:mm},numbers:{type:"number",properties:gm}});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 aa=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 bm)r[a]=s[a];(Et(s.properties)&&s.properties||[i]).forEach(a=>{(a===i||!e.has(a))&&e.set(a,r)})})}_animateOptions(t,e){let i=e.options,s=_m(t,i);if(!s)return[];let r=this._createAnimations(s,i);return i.$shared&&vm(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],m=i.get(c);if(d)if(m&&d.active()){d.update(m,u,o);continue}else d.cancel();if(!m||!m.duration){t[c]=u;continue}r[c]=d=new ac(m,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 qe.add(this._chart,i),!0}};function vm(n,t){let e=[],i=Object.keys(t);for(let s=0;s<i.length;s++){let r=n[i[s]];r&&r.active()&&e.push(r.wait())}return Promise.all(e)}function _m(n,t){if(!t)return;let e=n.options;if(!e){n.options=t;return}return e.$shared&&(n.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e}function oc(n,t){let e=n&&n.options||{},i=e.reverse,s=e.min===void 0?t:0,r=e.max===void 0?t:0;return{start:i?r:s,end:i?s:r}}function ym(n,t,e){if(e===!1)return!1;let i=oc(n,e),s=oc(t,e);return{top:s.end,right:i.end,bottom:s.start,left:i.start}}function xm(n){let t,e,i,s;return ft(n)?(t=n.top,e=n.right,i=n.bottom,s=n.left):t=e=i=s=n,{top:t,right:e,bottom:i,left:s,disabled:n===!1}}function lc(n,t){let e=[],i=n._getSortedDatasetMetas(t),s,r;for(s=0,r=i.length;s<r;++s)e.push(i[s].index);return e}function cc(n,t,e,i={}){let s=n.keys,r=i.mode==="single",a,o,l,c;if(t!==null){for(a=0,o=s.length;a<o;++a){if(l=+s[a],l===e){if(i.all)continue;break}c=n.values[l],$t(c)&&(r||t===0||Ce(t)===Ce(c))&&(t+=c)}return t}}function wm(n){let t=Object.keys(n),e=new Array(t.length),i,s,r;for(i=0,s=t.length;i<s;++i)r=t[i],e[i]={x:r,y:n[r]};return e}function hc(n,t){let e=n&&n.options.stacked;return e||e===void 0&&t.stack!==void 0}function km(n,t,e){return`${n.id}.${t.id}.${e.stack||e.type}`}function Sm(n){let{min:t,max:e,minDefined:i,maxDefined:s}=n.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:s?e:Number.POSITIVE_INFINITY}}function Mm(n,t,e){let i=n[t]||(n[t]={});return i[e]||(i[e]={})}function uc(n,t,e,i){for(let s of t.getMatchingVisibleMetas(i).reverse()){let r=n[s.index];if(e&&r>0||!e&&r<0)return s.index}return null}function fc(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=km(r,a,i),d=t.length,m;for(let p=0;p<d;++p){let b=t[p],{[l]:k,[c]:M}=b,T=b._stacks||(b._stacks={});m=T[c]=Mm(s,u,k),m[o]=M,m._top=uc(m,a,!0,i.type),m._bottom=uc(m,a,!1,i.type)}}function oa(n,t){let e=n.scales;return Object.keys(e).filter(i=>e[i].axis===t).shift()}function Cm(n,t){return Ge(n,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function Tm(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 yi(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 la=n=>n==="reset"||n==="none",dc=(n,t)=>t?n:Object.assign({},n),Pm=(n,t,e)=>n&&!t.hidden&&t._stacked&&{keys:lc(e,!0),values:null},ye=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=hc(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&yi(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(d,m,p,b)=>d==="x"?m:d==="r"?b:p,r=e.xAxisID=at(i.xAxisID,oa(t,"x")),a=e.yAxisID=at(i.yAxisID,oa(t,"y")),o=e.rAxisID=at(i.rAxisID,oa(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&&Dr(this._data,this),t._stacked&&yi(t)}_dataCheck(){let t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(ft(e))this._data=wm(e);else if(i!==e){if(i){Dr(i,this);let s=this._cachedMeta;yi(s),s._parsed=[]}e&&Object.isExtensible(e)&&wl(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=hc(e.vScale,e),e.stack!==i.stack&&(s=!0,yi(e),e.stack=i.stack),this._resyncElements(t),(s||r!==e._stacked)&&fc(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,m;if(this._parsing===!1)i._parsed=s,i._sorted=!0,m=s;else{Et(s[t])?m=this.parseArrayData(i,s,t,e):ft(s[t])?m=this.parseObjectData(i,s,t,e):m=this.parsePrimitiveData(i,s,t,e);let p=()=>d[o]===null||c&&d[o]<c[o];for(u=0;u<e;++u)i._parsed[u+t]=d=m[u],l&&(p()&&(l=!1),c=d);i._sorted=l}a&&fc(this,m)}parsePrimitiveData(t,e,i,s){let{iScale:r,vScale:a}=t,o=r.axis,l=a.axis,c=r.getLabels(),u=r===a,d=new Array(s),m,p,b;for(m=0,p=s;m<p;++m)b=m+i,d[m]={[o]:u||r.parse(c[b],b),[l]:a.parse(e[b],b)};return d}parseArrayData(t,e,i,s){let{xScale:r,yScale:a}=t,o=new Array(s),l,c,u,d;for(l=0,c=s;l<c;++l)u=l+i,d=e[u],o[l]={x:r.parse(d[0],u),y:a.parse(d[1],u)};return o}parseObjectData(t,e,i,s){let{xScale:r,yScale:a}=t,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,c=new Array(s),u,d,m,p;for(u=0,d=s;u<d;++u)m=u+i,p=e[m],c[u]={x:r.parse(Ve(p,o),m),y:a.parse(Ve(p,l),m)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){let s=this.chart,r=this._cachedMeta,a=e[t.axis],o={keys:lc(s,!0),values:e._stacks[t.axis]};return cc(o,a,r.index,{mode:i})}updateRangeFromParsed(t,e,i,s){let r=i[e.axis],a=r===null?NaN:r,o=s&&i._stacks[e.axis];s&&o&&(s.values=o,a=cc(s,r,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,e){let i=this._cachedMeta,s=i._parsed,r=i._sorted&&t===i.iScale,a=s.length,o=this._getOtherScale(t),l=Pm(e,i,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=Sm(o),m,p;function b(){p=s[m];let k=p[o.axis];return!$t(p[t.axis])||u>k||d<k}for(m=0;m<a&&!(!b()&&(this.updateRangeFromParsed(c,t,p,l),r));++m);if(r){for(m=a-1;m>=0;--m)if(!b()){this.updateRangeFromParsed(c,t,p,l);break}}return c}getAllParsedValues(t){let e=this._cachedMeta._parsed,i=[],s,r,a;for(s=0,r=e.length;s<r;++s)a=e[s][t.axis],$t(a)&&i.push(a);return i}getMaxOverflow(){return!1}getLabelAndValue(t){let e=this._cachedMeta,i=e.iScale,s=e.vScale,r=this.getParsed(t);return{label:i?""+i.getLabelForValue(r[i.axis]):"",value:s?""+s.getLabelForValue(r[s.axis]):""}}_update(t){let e=this._cachedMeta;this.update(t||"default"),e._clip=xm(at(this.options.clip,ym(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],r=e.chartArea,a=[],o=this._drawStart||0,l=this._drawCount||s.length-o,c=this.options.drawActiveElementsOnTop,u;for(i.dataset&&i.dataset.draw(t,r,o,l),u=o;u<o+l;++u){let d=s[u];d.hidden||(d.active&&c?a.push(d):d.draw(t,r))}for(u=0;u<a.length;++u)a[u].draw(t,r)}getStyle(t,e){let i=e?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){let s=this.getDataset(),r;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];r=a.$context||(a.$context=Tm(this.getContext(),t,a)),r.parsed=this.getParsed(t),r.raw=s.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=Cm(this.chart.getContext(),this.index)),r.dataset=s,r.index=r.datasetIndex=this.index;return r.active=!!e,r.mode=i,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){let s=e==="active",r=this._cachedDataOpts,a=t+"-"+e,o=r[a],l=this.enableOptionSharing&&ge(i);if(o)return dc(o,l);let c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),d=s?[`${t}Hover`,"hover",t,""]:[t,""],m=c.getOptionScopes(this.getDataset(),u),p=Object.keys(dt.elements[t]),b=()=>this.getContext(i,s),k=c.resolveNamedOptions(m,p,b,d);return k.$shared&&(k.$shared=l,r[a]=Object.freeze(dc(k,l))),k}_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),m=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(m,this.getContext(t,i,e))}let c=new aa(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||la(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){la(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!la(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;let r=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(r)||r})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let e=this._data,i=this._cachedMeta.data;for(let[o,l,c]of this._syncList)this[o](l,c);this._syncList=[];let s=i.length,r=e.length,a=Math.min(r,s);a&&this.parse(0,a),r>s?this._insertElements(s,r-s,t):r<s&&this._removeElements(r,s-r)}_insertElements(t,e,i=!0){let s=this._cachedMeta,r=s.data,a=t+e,o,l=c=>{for(c.length+=e,o=c.length-1;o>=a;o--)c[o]=c[o-e]};for(l(r),o=t;o<a;++o)r[o]=new this.dataElementType;this._parsing&&l(s._parsed),this.parse(t,e),i&&this.updateElements(r,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){let i=this._cachedMeta;if(this._parsing){let s=i._parsed.splice(t,e);i._stacked&&yi(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);let i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}};ye.defaults={};ye.prototype.datasetElementType=null;ye.prototype.dataElementType=null;function Om(n,t){if(!n._cache.$bar){let e=n.getMatchingVisibleMetas(t),i=[];for(let s=0,r=e.length;s<r;s++)i=i.concat(e[s].controller.getAllParsedValues(n));n._cache.$bar=Ar(i.sort((s,r)=>s-r))}return n._cache.$bar}function Em(n){let t=n.iScale,e=Om(t,n.type),i=t._length,s,r,a,o,l=()=>{a===32767||a===-32768||(ge(o)&&(i=Math.min(i,Math.abs(a-o)||i)),o=a)};for(s=0,r=e.length;s<r;++s)a=t.getPixelForValue(e[s]),l();for(o=void 0,s=0,r=t.ticks.length;s<r;++s)a=t.getPixelForTick(s),l();return i}function Dm(n,t,e,i){let s=e.barThickness,r,a;return bt(s)?(r=t.min*e.categoryPercentage,a=e.barPercentage):(r=s*i,a=1),{chunk:r/i,ratio:a,start:t.pixels[n]-r/2}}function Am(n,t,e,i){let s=t.pixels,r=s[n],a=n>0?s[n-1]:null,o=n<s.length-1?s[n+1]:null,l=e.categoryPercentage;a===null&&(a=r-(o===null?t.end-t.start:o-r)),o===null&&(o=r+r-a);let c=r-(r-Math.min(a,o))/2*l;return{chunk:Math.abs(o-a)/2*l/i,ratio:e.barPercentage,start:c}}function Lm(n,t,e,i){let s=e.parse(n[0],i),r=e.parse(n[1],i),a=Math.min(s,r),o=Math.max(s,r),l=a,c=o;Math.abs(a)>Math.abs(o)&&(l=o,c=a),t[e.axis]=c,t._custom={barStart:l,barEnd:c,start:s,end:r,min:a,max:o}}function pc(n,t,e,i){return Et(n)?Lm(n,t,e,i):t[e.axis]=e.parse(n,i),t}function gc(n,t,e,i){let s=n.iScale,r=n.vScale,a=s.getLabels(),o=s===r,l=[],c,u,d,m;for(c=e,u=e+i;c<u;++c)m=t[c],d={},d[s.axis]=o||s.parse(a[c],c),l.push(pc(m,d,r,c));return l}function ca(n){return n&&n.barStart!==void 0&&n.barEnd!==void 0}function Rm(n,t,e){return n!==0?Ce(n):(t.isHorizontal()?1:-1)*(t.min>=e?1:-1)}function Fm(n){let t,e,i,s,r;return n.horizontal?(t=n.base>n.x,e="left",i="right"):(t=n.base<n.y,e="bottom",i="top"),t?(s="end",r="start"):(s="start",r="end"),{start:e,end:i,reverse:t,top:s,bottom:r}}function Im(n,t,e,i){let s=t.borderSkipped,r={};if(!s){n.borderSkipped=r;return}if(s===!0){n.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:a,end:o,reverse:l,top:c,bottom:u}=Fm(n);s==="middle"&&e&&(n.enableBorderRadius=!0,(e._top||0)===i?s=c:(e._bottom||0)===i?s=u:(r[mc(u,a,o,l)]=!0,s=c)),r[mc(s,a,o,l)]=!0,n.borderSkipped=r}function mc(n,t,e,i){return i?(n=$m(n,t,e),n=bc(n,e,t)):n=bc(n,t,e),n}function $m(n,t,e){return n===t?e:n===e?t:n}function bc(n,t,e){return n==="start"?t:n==="end"?e:n}function zm(n,{inflateAmount:t},e){n.inflateAmount=t==="auto"?e===1?.33:0:t}var xi=class extends ye{parsePrimitiveData(t,e,i,s){return gc(t,e,i,s)}parseArrayData(t,e,i,s){return gc(t,e,i,s)}parseObjectData(t,e,i,s){let{iScale:r,vScale:a}=t,{xAxisKey:o="x",yAxisKey:l="y"}=this._parsing,c=r.axis==="x"?o:l,u=a.axis==="x"?o:l,d=[],m,p,b,k;for(m=i,p=i+s;m<p;++m)k=e[m],b={},b[r.axis]=r.parse(Ve(k,c),m),d.push(pc(Ve(k,u),b,a,m));return d}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);let r=i._custom;r&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let e=this._cachedMeta,{iScale:i,vScale:s}=e,r=this.getParsed(t),a=r._custom,o=ca(a)?"["+a.start+", "+a.end+"]":""+s.getLabelForValue(r[s.axis]);return{label:""+i.getLabelForValue(r[i.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){let r=s==="reset",{index:a,_cachedMeta:{vScale:o}}=this,l=o.getBasePixel(),c=o.isHorizontal(),u=this._getRuler(),{sharedOptions:d,includeOptions:m}=this._getSharedOptions(e,s);for(let p=e;p<e+i;p++){let b=this.getParsed(p),k=r||bt(b[o.axis])?{base:l,head:l}:this._calculateBarValuePixels(p),M=this._calculateBarIndexPixels(p,u),T=(b._stacks||{})[o.axis],R={horizontal:c,base:k.base,enableBorderRadius:!T||ca(b._custom)||a===T._top||a===T._bottom,x:c?k.head:M.center,y:c?M.center:k.head,height:c?M.size:Math.abs(k.size),width:c?Math.abs(k.size):M.size};m&&(R.options=d||this.resolveDataElementOptions(p,t[p].active?"active":s));let $=R.options||t[p].options;Im(R,$,T,a),zm(R,$,u.ratio),this.updateElement(t[p],p,R,s)}}_getStacks(t,e){let{iScale:i}=this._cachedMeta,s=i.getMatchingVisibleMetas(this._type).filter(l=>l.controller.options.grouped),r=i.options.stacked,a=[],o=l=>{let c=l.controller.getParsed(e),u=c&&c[l.vScale.axis];if(bt(u)||isNaN(u))return!0};for(let l of s)if(!(e!==void 0&&o(l))&&((r===!1||a.indexOf(l.stack)===-1||r===void 0&&l.stack===void 0)&&a.push(l.stack),l.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){let s=this._getStacks(t,i),r=e!==void 0?s.indexOf(e):-1;return r===-1?s.length-1:r}_getRuler(){let t=this.options,e=this._cachedMeta,i=e.iScale,s=[],r,a;for(r=0,a=e.data.length;r<a;++r)s.push(i.getPixelForValue(this.getParsed(r)[i.axis],r));let o=t.barThickness;return{min:o||Em(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:o?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:e,_stacked:i},options:{base:s,minBarLength:r}}=this,a=s||0,o=this.getParsed(t),l=o._custom,c=ca(l),u=o[e.axis],d=0,m=i?this.applyStack(e,o,i):u,p,b;m!==u&&(d=m-u,m=u),c&&(u=l.barStart,m=l.barEnd-l.barStart,u!==0&&Ce(u)!==Ce(l.barEnd)&&(d=0),d+=u);let k=!bt(s)&&!c?s:d,M=e.getPixelForValue(k);if(this.chart.getDataVisibility(t)?p=e.getPixelForValue(d+m):p=M,b=p-M,Math.abs(b)<r){b=Rm(b,e,a)*r,u===a&&(M-=b/2);let T=e.getPixelForDecimal(0),R=e.getPixelForDecimal(1),$=Math.min(T,R),L=Math.max(T,R);M=Math.max(Math.min(M,L),$),p=M+b}if(M===e.getPixelForValue(a)){let T=Ce(b)*e.getLineWidthForValue(a)/2;M+=T,b-=T}return{size:b,base:M,head:p,center:p+b/2}}_calculateBarIndexPixels(t,e){let i=e.scale,s=this.options,r=s.skipNull,a=at(s.maxBarThickness,1/0),o,l;if(e.grouped){let c=r?this._getStackCount(t):e.stackCount,u=s.barThickness==="flex"?Am(t,e,s,c):Dm(t,e,s,c),d=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0);o=u.start+u.chunk*d+u.chunk/2,l=Math.min(a,u.chunk*u.ratio)}else o=i.getPixelForValue(this.getParsed(t)[i.axis],t),l=Math.min(a,e.min*e.ratio);return{base:o-l/2,head:o+l/2,center:o,size:l}}draw(){let t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length,r=0;for(;r<s;++r)this.getParsed(r)[e.axis]!==null&&i[r].draw(this._ctx)}};xi.id="bar";xi.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};xi.overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};var wi=class extends ye{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){let r=super.parsePrimitiveData(t,e,i,s);for(let a=0;a<r.length;a++)r[a]._custom=this.resolveDataElementOptions(a+i).radius;return r}parseArrayData(t,e,i,s){let r=super.parseArrayData(t,e,i,s);for(let a=0;a<r.length;a++){let o=e[i+a];r[a]._custom=at(o[2],this.resolveDataElementOptions(a+i).radius)}return r}parseObjectData(t,e,i,s){let r=super.parseObjectData(t,e,i,s);for(let a=0;a<r.length;a++){let o=e[i+a];r[a]._custom=at(o&&o.r&&+o.r,this.resolveDataElementOptions(a+i).radius)}return r}getMaxOverflow(){let t=this._cachedMeta.data,e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){let e=this._cachedMeta,{xScale:i,yScale:s}=e,r=this.getParsed(t),a=i.getLabelForValue(r.x),o=s.getLabelForValue(r.y),l=r._custom;return{label:e.label,value:"("+a+", "+o+(l?", "+l:"")+")"}}update(t){let e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){let r=s==="reset",{iScale:a,vScale:o}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(e,s),u=a.axis,d=o.axis;for(let m=e;m<e+i;m++){let p=t[m],b=!r&&this.getParsed(m),k={},M=k[u]=r?a.getPixelForDecimal(.5):a.getPixelForValue(b[u]),T=k[d]=r?o.getBasePixel():o.getPixelForValue(b[d]);k.skip=isNaN(M)||isNaN(T),c&&(k.options=l||this.resolveDataElementOptions(m,p.active?"active":s),r&&(k.options.radius=0)),this.updateElement(p,m,k,s)}}resolveDataElementOptions(t,e){let i=this.getParsed(t),s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));let r=s.radius;return e!=="active"&&(s.radius=0),s.radius+=at(i&&i._custom,r),s}};wi.id="bubble";wi.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};wi.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title(){return""}}}}};function Bm(n,t,e){let i=1,s=1,r=0,a=0;if(t<Ot){let o=n,l=o+t,c=Math.cos(o),u=Math.sin(o),d=Math.cos(l),m=Math.sin(l),p=($,L,F)=>Hn($,o,l,!0)?1:Math.max(L,L*e,F,F*e),b=($,L,F)=>Hn($,o,l,!0)?-1:Math.min(L,L*e,F,F*e),k=p(0,c,d),M=p(Ft,u,m),T=b(Lt,c,d),R=b(Lt+Ft,u,m);i=(k-T)/2,s=(M-R)/2,r=-(k+T)/2,a=-(M+R)/2}return{ratioX:i,ratioY:s,offsetX:r,offsetY:a}}var Mn=class extends ye{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=>+Ve(i[c],l)}let a,o;for(a=t,o=t+e;a<o;++a)s._parsed[a]=r(a)}}_getRotation(){return ve(this.options.rotation-90)}_getCircumference(){return ve(this.options.circumference)}_getRotationExtents(){let t=Ot,e=-Ot;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)){let s=this.chart.getDatasetMeta(i).controller,r=s._getRotation(),a=s._getCircumference();t=Math.min(t,r),e=Math.max(e,r+a)}return{rotation:t,circumference:e-t}}update(t){let e=this.chart,{chartArea:i}=e,s=this._cachedMeta,r=s.data,a=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,o=Math.max((Math.min(i.width,i.height)-a)/2,0),l=Math.min(ul(this.options.cutout,o),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:m,ratioY:p,offsetX:b,offsetY:k}=Bm(d,u,l),M=(i.width-a)/m,T=(i.height-a)/p,R=Math.max(Math.min(M,T)/2,0),$=Mr(this.options.radius,R),L=Math.max($*l,0),F=($-L)/this._getVisibleDatasetWeightTotal();this.offsetX=b*$,this.offsetY=k*$,s.total=this.calculateTotal(),this.outerRadius=$-F*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-F*c,0),this.updateElements(r,0,r.length,t)}_circumference(t,e){let i=this.options,s=this._cachedMeta,r=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||s._parsed[t]===null||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*r/Ot)}updateElements(t,e,i,s){let r=s==="reset",a=this.chart,o=a.chartArea,c=a.options.animation,u=(o.left+o.right)/2,d=(o.top+o.bottom)/2,m=r&&c.animateScale,p=m?0:this.innerRadius,b=m?0:this.outerRadius,{sharedOptions:k,includeOptions:M}=this._getSharedOptions(e,s),T=this._getRotation(),R;for(R=0;R<e;++R)T+=this._circumference(R,r);for(R=e;R<e+i;++R){let $=this._circumference(R,r),L=t[R],F={x:u+this.offsetX,y:d+this.offsetY,startAngle:T,endAngle:T+$,circumference:$,outerRadius:b,innerRadius:p};M&&(F.options=k||this.resolveDataElementOptions(R,L.active?"active":s)),T+=$,this.updateElement(L,R,F,s)}}calculateTotal(){let t=this._cachedMeta,e=t.data,i=0,s;for(s=0;s<e.length;s++){let r=t._parsed[s];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(s)&&!e[s].hidden&&(i+=Math.abs(r))}return i}calculateCircumference(t){let e=this._cachedMeta.total;return e>0&&!isNaN(t)?Ot*(Math.abs(t)/e):0}getLabelAndValue(t){let e=this._cachedMeta,i=this.chart,s=i.data.labels||[],r=Xn(e._parsed[t],i.options.locale);return{label:s[t]||"",value:r}}getMaxBorderWidth(t){let e=0,i=this.chart,s,r,a,o,l;if(!t){for(s=0,r=i.data.datasets.length;s<r;++s)if(i.isDatasetVisible(s)){a=i.getDatasetMeta(s),t=a.data,o=a.controller;break}}if(!t)return 0;for(s=0,r=t.length;s<r;++s)l=o.resolveDataElementOptions(s),l.borderAlign!=="inner"&&(e=Math.max(e,l.borderWidth||0,l.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){let r=this.resolveDataElementOptions(i);e=Math.max(e,r.offset||0,r.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(at(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}};Mn.id="doughnut";Mn.defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};Mn.descriptors={_scriptable:n=>n!=="spacing",_indexable:n=>n!=="spacing"};Mn.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 Et(t)?(t=t.slice(),t[0]+=e):t+=e,t}}}}};var ki=class extends ye{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}=Fr(e,s,a);this._drawStart=o,this._drawCount=l,Ir(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),m=a.axis,p=o.axis,{spanGaps:b,segment:k}=this.options,M=xn(b)?b:Number.POSITIVE_INFINITY,T=this.chart._animationsDisabled||r||s==="none",R=e>0&&this.getParsed(e-1);for(let $=e;$<e+i;++$){let L=t[$],F=this.getParsed($),z=T?L:{},H=bt(F[p]),G=z[m]=a.getPixelForValue(F[m],$),q=z[p]=r||H?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,F,l):F[p],$);z.skip=isNaN(G)||isNaN(q)||H,z.stop=$>0&&Math.abs(F[m]-R[m])>M,k&&(z.parsed=F,z.raw=c.data[$]),d&&(z.options=u||this.resolveDataElementOptions($,L.active?"active":s)),T||this.updateElement(L,$,z,s),R=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()}};ki.id="line";ki.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};ki.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};var Si=class extends ye{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=Xn(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:r}}parseObjectData(t,e,i,s){return Zr.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){let t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((i,s)=>{let r=this.getParsed(s).r;!isNaN(r)&&this.chart.getDataVisibility(s)&&(r<e.min&&(e.min=r),r>e.max&&(e.max=r))}),e}_updateRadius(){let t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),r=Math.max(s/2,0),a=Math.max(i.cutoutPercentage?r/100*i.cutoutPercentage:1,0),o=(r-a)/t.getVisibleDatasetCount();this.outerRadius=r-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){let r=s==="reset",a=this.chart,l=a.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,d=c.yCenter,m=c.getIndexAngle(0)-.5*Lt,p=m,b,k=360/this.countVisibleElements();for(b=0;b<e;++b)p+=this._computeAngle(b,s,k);for(b=e;b<e+i;b++){let M=t[b],T=p,R=p+this._computeAngle(b,s,k),$=a.getDataVisibility(b)?c.getDistanceFromCenterForValue(this.getParsed(b).r):0;p=R,r&&(l.animateScale&&($=0),l.animateRotate&&(T=R=m));let L={x:u,y:d,innerRadius:0,outerRadius:$,startAngle:T,endAngle:R,options:this.resolveDataElementOptions(b,M.active?"active":s)};this.updateElement(M,b,L,s)}}countVisibleElements(){let t=this._cachedMeta,e=0;return t.data.forEach((i,s)=>{!isNaN(this.getParsed(s).r)&&this.chart.getDataVisibility(s)&&e++}),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?ve(this.resolveDataElementOptions(t,e).angle||i):0}};Si.id="polarArea";Si.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};Si.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 xs=class extends Mn{};xs.id="pie";xs.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};var Mi=class extends ye{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 Zr.bind(this)(t,e,i,s)}update(t){let e=this._cachedMeta,i=e.dataset,s=e.data||[],r=e.iScale.getLabels();if(i.points=s,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let o={_loop:!0,_fullLoop:r.length===s.length,options:a};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){let r=this._cachedMeta.rScale,a=s==="reset";for(let o=e;o<e+i;o++){let l=t[o],c=this.resolveDataElementOptions(o,l.active?"active":s),u=r.getPointPositionForValue(o,this.getParsed(o).r),d=a?r.xCenter:u.x,m=a?r.yCenter:u.y,p={x:d,y:m,angle:u.angle,skip:isNaN(d)||isNaN(m),options:c};this.updateElement(l,o,p,s)}}};Mi.id="radar";Mi.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};Mi.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};var xe=class{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return xn(this.x)&&xn(this.y)}getProps(t,e){let i=this.$animations;if(!e||!i)return this;let s={};return t.forEach(r=>{s[r]=i[r]&&i[r].active()?i[r]._to:this[r]}),s}};xe.defaults={};xe.defaultRoutes=void 0;var vc={values(n){return Et(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=jm(n,e)}let a=me(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),Xn(n,i,l)},logarithmic(n,t,e){if(n===0)return"0";let i=n/Math.pow(10,Math.floor(me(n)));return i===1||i===2||i===5?vc.numeric.call(this,n,t,e):""}};function jm(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 ws={formatters:vc};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:ws.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 Nm(n,t){let e=n.options.ticks,i=e.maxTicksLimit||Hm(n),s=e.major.enabled?Wm(t):[],r=s.length,a=s[0],o=s[r-1],l=[];if(r>i)return Ym(t,l,s,r/i),l;let c=Vm(s,t,i);if(r>0){let u,d,m=r>1?Math.round((o-a)/(r-1)):null;for(ks(t,l,c,bt(m)?0:a-m,a),u=0,d=r-1;u<d;u++)ks(t,l,c,s[u],s[u+1]);return ks(t,l,c,o,bt(m)?t.length:o+m),l}return ks(t,l,c),l}function Hm(n){let t=n.options.offset,e=n._tickSize(),i=n._length/e+(t?0:1),s=n._maxLength/e;return Math.floor(Math.min(i,s))}function Vm(n,t,e){let i=Gm(n),s=t.length/e;if(!i)return Math.max(s,1);let r=ml(i);for(let a=0,o=r.length-1;a<o;a++){let l=r[a];if(l>s)return l}return Math.max(s,1)}function Wm(n){let t=[],e,i;for(e=0,i=n.length;e<i;e++)n[e].major&&t.push(e);return t}function Ym(n,t,e,i){let s=0,r=e[0],a;for(i=Math.ceil(i),a=0;a<n.length;a++)a===r&&(t.push(n[a]),s++,r=e[s*i])}function ks(n,t,e,i,s){let r=at(i,0),a=Math.min(at(s,n.length),n.length),o=0,l,c,u;for(e=Math.ceil(e),s&&(l=s-i,e=l/Math.floor(l/e)),u=r;u<0;)o++,u=Math.round(r+o*e);for(c=Math.max(r,0);c<a;c++)c===u&&(t.push(n[c]),o++,u=Math.round(r+o*e))}function Gm(n){let t=n.length,e,i;if(t<2)return!1;for(i=n[0],e=1;e<t;++e)if(n[e]-n[e-1]!==i)return!1;return i}var qm=n=>n==="left"?"right":n==="right"?"left":n,_c=(n,t,e)=>t==="top"||t==="left"?n[t]+e:n[t]-e;function yc(n,t){let e=[],i=n.length/t,s=n.length,r=0;for(;r<s;r+=i)e.push(n[Math.floor(r)]);return e}function Um(n,t,e){let i=n.ticks.length,s=Math.min(t,i-1),r=n._startPixel,a=n._endPixel,o=1e-6,l=n.getPixelForTick(s),c;if(!(e&&(i===1?c=Math.max(l-r,a-l):t===0?c=(n.getPixelForTick(1)-l)/2:c=(l-n.getPixelForTick(s-1))/2,l+=s<t?c:-c,l<r-o||l>a+o)))return l}function Xm(n,t){Mt(n,e=>{let i=e.gc,s=i.length/2,r;if(s>t){for(r=0;r<s;++r)delete e.data[i[r]];i.splice(0,s)}})}function Ci(n){return n.drawTicks?n.tickLength:0}function xc(n,t){if(!n.display)return 0;let e=Vt(n.font,t),i=te(n.padding);return(Et(n.text)?n.text.length:1)*e.lineHeight+i.height}function Km(n,t){return Ge(n,{scale:t,type:"scale"})}function Zm(n,t,e){return Ge(n,{tick:e,index:t,type:"tick"})}function Jm(n,t,e){let i=ls(n);return(e&&t!=="right"||!e&&t==="right")&&(i=qm(i)),i}function Qm(n,t,e,i){let{top:s,left:r,bottom:a,right:o,chart:l}=n,{chartArea:c,scales:u}=l,d=0,m,p,b,k=a-s,M=o-r;if(n.isHorizontal()){if(p=Qt(i,r,o),ft(e)){let T=Object.keys(e)[0],R=e[T];b=u[T].getPixelForValue(R)+k-t}else e==="center"?b=(c.bottom+c.top)/2+k-t:b=_c(n,e,t);m=o-r}else{if(ft(e)){let T=Object.keys(e)[0],R=e[T];p=u[T].getPixelForValue(R)-M+t}else e==="center"?p=(c.left+c.right)/2-M+t:p=_c(n,e,t);b=Qt(i,a,s),d=e==="left"?-Ft:Ft}return{titleX:p,titleY:b,maxWidth:m,rotation:d}}var fn=class extends xe{constructor(t){super();this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=pe(t,Number.POSITIVE_INFINITY),e=pe(e,Number.NEGATIVE_INFINITY),i=pe(i,Number.POSITIVE_INFINITY),s=pe(s,Number.NEGATIVE_INFINITY),{min:pe(t,i),max:pe(e,s),minDefined:$t(t),maxDefined:$t(e)}}getMinMax(t){let{min:e,max:i,minDefined:s,maxDefined:r}=this.getUserBounds(),a;if(s&&r)return{min:e,max:i};let o=this.getMatchingVisibleMetas();for(let l=0,c=o.length;l<c;++l)a=o[l].controller.getMinMax(this,t),s||(e=Math.min(e,a.min)),r||(i=Math.max(i,a.max));return e=r&&e>i?i:e,i=s&&e>i?e:i,{min:pe(e,pe(i,e)),max:pe(i,pe(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(){Dt(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=jl(this,r,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=o<this.ticks.length;this._convertTicksToLabels(l?yc(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Nm(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,e,i;this.isHorizontal()?(e=this.left,i=this.right):(e=this.top,i=this.bottom,t=!t),this._startPixel=e,this._endPixel=i,this._reversePixels=t,this._length=i-e,this._alignToPixels=this.options.alignToPixels}afterUpdate(){Dt(this.options.afterUpdate,[this])}beforeSetDimensions(){Dt(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){Dt(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),Dt(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){Dt(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){let e=this.options.ticks,i,s,r;for(i=0,s=t.length;i<s;i++)r=t[i],r.label=Dt(e.callback,[r.value,i,t],this)}afterTickToLabelConversion(){Dt(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Dt(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let t=this.options,e=t.ticks,i=this.ticks.length,s=e.minRotation||0,r=e.maxRotation,a=s,o,l,c;if(!this._isVisible()||!e.display||s>=r||i<=1||!this.isHorizontal()){this.labelRotation=s;return}let u=this._getLabelSizes(),d=u.widest.width,m=u.highest.height,p=Yt(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-Ci(t.grid)-e.padding-xc(t.title,this.chart.options.font),c=Math.sqrt(d*d+m*m),a=rs(Math.min(Math.asin(Yt((u.highest.height+6)/o,-1,1)),Math.asin(Yt(l/c,-1,1))-Math.asin(Yt(m/c,-1,1)))),a=Math.max(s,Math.min(r,a))),this.labelRotation=a}afterCalculateLabelRotation(){Dt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Dt(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=xc(s,e.options.font);if(o?(t.width=this.maxWidth,t.height=Ci(r)+l):(t.height=this.maxHeight,t.width=Ci(r)+l),i.display&&this.ticks.length){let{first:c,last:u,widest:d,highest:m}=this._getLabelSizes(),p=i.padding*2,b=ve(this.labelRotation),k=Math.cos(b),M=Math.sin(b);if(o){let T=i.mirror?0:M*d.width+k*m.height;t.height=Math.min(this.maxHeight,t.height+T+p)}else{let T=i.mirror?0:k*d.width+M*m.height;t.width=Math.min(this.maxWidth,t.width+T+p)}this._calculatePadding(c,u,M,k)}}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),m=0,p=0;l?c?(m=s*t.width,p=i*e.height):(m=i*t.height,p=s*e.width):r==="start"?p=e.width:r==="end"?m=t.width:r!=="inner"&&(m=t.width/2,p=e.width/2),this.paddingLeft=Math.max((m-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(){Dt(this.options.afterFit,[this])}isHorizontal(){let{axis:t,position:e}=this.options;return e==="top"||e==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let e,i;for(e=0,i=t.length;e<i;e++)bt(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){let e=this.options.ticks.sampleSize,i=this.ticks;e<i.length&&(i=yc(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length)}return t}_computeLabelSizes(t,e){let{ctx:i,_longestTextCache:s}=this,r=[],a=[],o=0,l=0,c,u,d,m,p,b,k,M,T,R,$;for(c=0;c<e;++c){if(m=t[c].label,p=this._resolveTickFontOptions(c),i.font=b=p.string,k=s[b]=s[b]||{data:{},gc:[]},M=p.lineHeight,T=R=0,!bt(m)&&!Et(m))T=bi(i,k.data,k.gc,T,m),R=M;else if(Et(m))for(u=0,d=m.length;u<d;++u)$=m[u],!bt($)&&!Et($)&&(T=bi(i,k.data,k.gc,T,$),R+=M);r.push(T),a.push(R),o=Math.max(T,o),l=Math.max(R,l)}Xm(s,e);let L=r.indexOf(o),F=a.indexOf(l),z=H=>({width:r[H]||0,height:a[H]||0});return{first:z(0),last:z(e-1),widest:z(L),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 vl(this._alignToPixels?on(this.chart,e,0):e)}getDecimalForPixel(t){let e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){let e=this.ticks||[];if(t>=0&&t<e.length){let i=e[t];return i.$context||(i.$context=Zm(this.getContext(),t,i))}return this.$context||(this.$context=Km(this.chart.getContext(),this))}_tickSize(){let t=this.options.ticks,e=ve(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),r=this._getLabelSizes(),a=t.autoSkipPadding||0,o=r?r.widest.width+a:0,l=r?r.highest.height+a:0;return this.isHorizontal()?l*i>o*s?o/i:l/s:l*s<o*i?l/i:o/s}_isVisible(){let t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){let e=this.axis,i=this.chart,s=this.options,{grid:r,position:a}=s,o=r.offset,l=this.isHorizontal(),u=this.ticks.length+(o?1:0),d=Ci(r),m=[],p=r.setContext(this.getContext()),b=p.drawBorder?p.borderWidth:0,k=b/2,M=function(U){return on(i,U,b)},T,R,$,L,F,z,H,G,q,et,ot,st;if(a==="top")T=M(this.bottom),z=this.bottom-d,G=T-k,et=M(t.top)+k,st=t.bottom;else if(a==="bottom")T=M(this.top),et=t.top,st=M(t.bottom)-k,z=T+k,G=this.top+d;else if(a==="left")T=M(this.right),F=this.right-d,H=T-k,q=M(t.left)+k,ot=t.right;else if(a==="right")T=M(this.left),q=t.left,ot=M(t.right)-k,F=T+k,H=this.left+d;else if(e==="x"){if(a==="center")T=M((t.top+t.bottom)/2+.5);else if(ft(a)){let U=Object.keys(a)[0],_t=a[U];T=M(this.chart.scales[U].getPixelForValue(_t))}et=t.top,st=t.bottom,z=T+k,G=z+d}else if(e==="y"){if(a==="center")T=M((t.left+t.right)/2);else if(ft(a)){let U=Object.keys(a)[0],_t=a[U];T=M(this.chart.scales[U].getPixelForValue(_t))}F=T-k,H=F-d,q=t.left,ot=t.right}let wt=at(s.ticks.maxTicksLimit,u),rt=Math.max(1,Math.ceil(u/wt));for(R=0;R<u;R+=rt){let U=r.setContext(this.getContext(R)),_t=U.lineWidth,Ct=U.color,se=U.borderDash||[],we=U.borderDashOffset,It=U.tickWidth,Wt=U.tickColor,jt=U.tickBorderDash||[],Nt=U.tickBorderDashOffset;$=Um(this,R,o),$!==void 0&&(L=on(i,$,_t),l?F=H=q=ot=L:z=G=et=st=L,m.push({tx1:F,ty1:z,tx2:H,ty2:G,x1:q,y1:et,x2:ot,y2:st,width:_t,color:Ct,borderDash:se,borderDashOffset:we,tickWidth:It,tickColor:Wt,tickBorderDash:jt,tickBorderDashOffset:Nt}))}return this._ticksLength=u,this._borderValue=T,m}_computeLabelItems(t){let e=this.axis,i=this.options,{position:s,ticks:r}=i,a=this.isHorizontal(),o=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=r,m=Ci(i.grid),p=m+u,b=d?-u:p,k=-ve(this.labelRotation),M=[],T,R,$,L,F,z,H,G,q,et,ot,st,wt="middle";if(s==="top")z=this.bottom-b,H=this._getXAxisLabelAlignment();else if(s==="bottom")z=this.top+b,H=this._getXAxisLabelAlignment();else if(s==="left"){let U=this._getYAxisLabelAlignment(m);H=U.textAlign,F=U.x}else if(s==="right"){let U=this._getYAxisLabelAlignment(m);H=U.textAlign,F=U.x}else if(e==="x"){if(s==="center")z=(t.top+t.bottom)/2+p;else if(ft(s)){let U=Object.keys(s)[0],_t=s[U];z=this.chart.scales[U].getPixelForValue(_t)+p}H=this._getXAxisLabelAlignment()}else if(e==="y"){if(s==="center")F=(t.left+t.right)/2-p;else if(ft(s)){let U=Object.keys(s)[0],_t=s[U];F=this.chart.scales[U].getPixelForValue(_t)}H=this._getYAxisLabelAlignment(m).textAlign}e==="y"&&(l==="start"?wt="top":l==="end"&&(wt="bottom"));let rt=this._getLabelSizes();for(T=0,R=o.length;T<R;++T){$=o[T],L=$.label;let U=r.setContext(this.getContext(T));G=this.getPixelForTick(T)+r.labelOffset,q=this._resolveTickFontOptions(T),et=q.lineHeight,ot=Et(L)?L.length:1;let _t=ot/2,Ct=U.color,se=U.textStrokeColor,we=U.textStrokeWidth,It=H;a?(F=G,H==="inner"&&(T===R-1?It=this.options.reverse?"left":"right":T===0?It=this.options.reverse?"right":"left":It="center"),s==="top"?c==="near"||k!==0?st=-ot*et+et/2:c==="center"?st=-rt.highest.height/2-_t*et+et:st=-rt.highest.height+et/2:c==="near"||k!==0?st=et/2:c==="center"?st=rt.highest.height/2-_t*et:st=rt.highest.height-ot*et,d&&(st*=-1)):(z=G,st=(1-ot)*et/2);let Wt;if(U.showLabelBackdrop){let jt=te(U.backdropPadding),Nt=rt.heights[T],qt=rt.widths[T],w=z+st-jt.top,v=F-jt.left;switch(wt){case"middle":w-=Nt/2;break;case"bottom":w-=Nt;break}switch(H){case"center":v-=qt/2;break;case"right":v-=qt;break}Wt={left:v,top:w,width:qt+jt.width,height:Nt+jt.height,color:U.backdropColor}}M.push({rotation:k,label:L,font:q,color:Ct,strokeColor:se,strokeWidth:we,textOffset:st,textAlign:It,textBaseline:wt,translation:[F,z],backdrop:Wt})}return M}_getXAxisLabelAlignment(){let{position:t,ticks:e}=this.options;if(-ve(this.labelRotation))return t==="top"?"left":"right";let s="center";return e.align==="start"?s="left":e.align==="end"?s="right":e.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(t){let{position:e,ticks:{crossAlign:i,mirror:s,padding:r}}=this.options,a=this._getLabelSizes(),o=t+r,l=a.widest.width,c,u;return e==="left"?s?(u=this.right+r,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-o,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u=this.left)):e==="right"?s?(u=this.left+r,i==="near"?c="right":i==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+o,i==="near"?c="left":i==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;let t=this.chart,e=this.options.position;if(e==="left"||e==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(e==="top"||e==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){let{ctx:t,options:{backgroundColor:e},left:i,top:s,width:r,height:a}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,r,a),t.restore())}getLineWidthForValue(t){let e=this.options.grid;if(!this._isVisible()||!e.display)return 0;let s=this.ticks.findIndex(r=>r.value===t);return s>=0?e.setContext(this.getContext(s)).lineWidth:0}drawGrid(t){let e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t)),r,a,o=(l,c,u)=>{!u.width||!u.color||(i.save(),i.lineWidth=u.width,i.strokeStyle=u.color,i.setLineDash(u.borderDash||[]),i.lineDashOffset=u.borderDashOffset,i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(c.x,c.y),i.stroke(),i.restore())};if(e.display)for(r=0,a=s.length;r<a;++r){let l=s[r];e.drawOnChartArea&&o({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),e.drawTicks&&o({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:t,ctx:e,options:{grid:i}}=this,s=i.setContext(this.getContext()),r=i.drawBorder?s.borderWidth:0;if(!r)return;let a=i.setContext(this.getContext(0)).lineWidth,o=this._borderValue,l,c,u,d;this.isHorizontal()?(l=on(t,this.left,r)-r/2,c=on(t,this.right,a)+a/2,u=d=o):(u=on(t,this.top,r)-r/2,d=on(t,this.bottom,a)+a/2,l=c=o),e.save(),e.lineWidth=s.borderWidth,e.strokeStyle=s.borderColor,e.beginPath(),e.moveTo(l,u),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;let i=this.ctx,s=this._computeLabelArea();s&&vi(i,s);let r=this._labelItems||(this._labelItems=this._computeLabelItems(t)),a,o;for(a=0,o=r.length;a<o;++a){let l=r[a],c=l.font,u=l.label;l.backdrop&&(i.fillStyle=l.backdrop.color,i.fillRect(l.backdrop.left,l.backdrop.top,l.backdrop.width,l.backdrop.height));let d=l.textOffset;ln(i,u,0,d,c,l)}s&&_i(i)}drawTitle(){let{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;let r=Vt(i.font),a=te(i.padding),o=i.align,l=r.lineHeight/2;e==="bottom"||e==="center"||ft(e)?(l+=a.bottom,Et(i.text)&&(l+=r.lineHeight*(i.text.length-1))):l+=a.top;let{titleX:c,titleY:u,maxWidth:d,rotation:m}=Qm(this,l,e,o);ln(t,i.text,0,0,r,{color:i.color,maxWidth:d,rotation:m,textAlign:Jm(o,e,s),textBaseline:"middle",translation:[c,u]})}draw(t){!this._isVisible()||(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){let t=this.options,e=t.ticks&&t.ticks.z||0,i=at(t.grid&&t.grid.z,-1);return!this._isVisible()||this.draw!==fn.prototype.draw?[{z:e,draw:s=>{this.draw(s)}}]:[{z:i,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(t){let e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[],r,a;for(r=0,a=e.length;r<a;++r){let o=e[r];o[i]===this.id&&(!t||o.type===t)&&s.push(o)}return s}_resolveTickFontOptions(t){let e=this.options.ticks.setContext(this.getContext(t));return Vt(e.font)}_maxDigits(){let t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}},Ti=class{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){let e=Object.getPrototypeOf(t),i;nb(e)&&(i=this.register(e));let s=this.items,r=t.id,a=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+t);return r in s||(s[r]=t,tb(t,a,i),this.override&&dt.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){let e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in dt[s]&&(delete dt[s][i],this.override&&delete an[i])}};function tb(n,t,e){let i=Bn(Object.create(null),[e?dt.get(e):{},dt.get(t),n.defaults]);dt.set(t,i),n.defaultRoutes&&eb(t,n.defaultRoutes),n.descriptors&&dt.describe(t,n.descriptors)}function eb(n,t){Object.keys(t).forEach(e=>{let i=e.split("."),s=i.pop(),r=[n].concat(i).join("."),a=t[e].split("."),o=a.pop(),l=a.join(".");dt.route(r,s,l,o)})}function nb(n){return"id"in n&&"defaults"in n}var wc=class{constructor(){this.controllers=new Ti(ye,"datasets",!0),this.elements=new Ti(xe,"elements"),this.plugins=new Ti(Object,"plugins"),this.scales=new Ti(fn,"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=is(t);Dt(i["before"+s],[],i),e[t](i),Dt(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){let i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){let s=e.get(t);if(s===void 0)throw new Error('"'+t+'" is not a registered '+i+".");return s}},Fe=new wc,Pi=class extends ye{update(t){let e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled,{start:r,count:a}=Fr(e,i,s);if(this._drawStart=r,this._drawCount=a,Ir(e)&&(r=0,a=i.length),this.options.showLine){let{dataset:o,_dataset:l}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!l._decimated,o.points=i;let c=this.resolveDatasetElementOptions(t);c.segment=this.options.segment,this.updateElement(o,void 0,{animated:!s,options:c},t)}this.updateElements(i,r,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=Fe.getElement("line")),super.addElements()}updateElements(t,e,i,s){let r=s==="reset",{iScale:a,vScale:o,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(e,s),d=this.getSharedOptions(u),m=this.includeOptions(s,d),p=a.axis,b=o.axis,{spanGaps:k,segment:M}=this.options,T=xn(k)?k:Number.POSITIVE_INFINITY,R=this.chart._animationsDisabled||r||s==="none",$=e>0&&this.getParsed(e-1);for(let L=e;L<e+i;++L){let F=t[L],z=this.getParsed(L),H=R?F:{},G=bt(z[b]),q=H[p]=a.getPixelForValue(z[p],L),et=H[b]=r||G?o.getBasePixel():o.getPixelForValue(l?this.applyStack(o,z,l):z[b],L);H.skip=isNaN(q)||isNaN(et)||G,H.stop=L>0&&Math.abs(z[p]-$[p])>T,M&&(H.parsed=z,H.raw=c.data[L]),m&&(H.options=d||this.resolveDataElementOptions(L,F.active?"active":s)),R||this.updateElement(F,L,H,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}};Pi.id="scatter";Pi.defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};Pi.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title(){return""},label(n){return"("+n.label+", "+n.formattedValue+")"}}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var ib=Object.freeze({__proto__:null,BarController:xi,BubbleController:wi,DoughnutController:Mn,LineController:ki,PolarAreaController:Si,PieController:xs,RadarController:Mi,ScatterController:Pi});function Cn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var Ss=class{constructor(t){this.options=t||{}}init(t){}formats(){return Cn()}parse(t,e){return Cn()}format(t,e){return Cn()}add(t,e,i){return Cn()}diff(t,e,i){return Cn()}startOf(t,e,i){return Cn()}endOf(t,e){return Cn()}};Ss.override=function(n){Object.assign(Ss.prototype,n)};var ha={_date:Ss};function sb(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:Re;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),m=l(r,t,e+u);return{lo:d.lo,hi:m.hi}}}}else return l(r,t,e)}return{lo:0,hi:r.length-1}}function Oi(n,t,e,i,s){let r=n.getSortedVisibleDatasetMetas(),a=e[t];for(let o=0,l=r.length;o<l;++o){let{index:c,data:u}=r[o],{lo:d,hi:m}=sb(r[o],t,a,s);for(let p=d;p<=m;++p){let b=u[p];b.skip||i(b,c,p)}}}function rb(n){let t=n.indexOf("x")!==-1,e=n.indexOf("y")!==-1;return function(i,s){let r=t?Math.abs(i.x-s.x):0,a=e?Math.abs(i.y-s.y):0;return Math.sqrt(Math.pow(r,2)+Math.pow(a,2))}}function ua(n,t,e,i,s){let r=[];return!s&&!n.isPointInArea(t)||Oi(n,e,t,function(o,l,c){!s&&!Yn(o,n.chartArea,0)||o.inRange(t.x,t.y,i)&&r.push({element:o,datasetIndex:l,index:c})},!0),r}function ab(n,t,e,i){let s=[];function r(a,o,l){let{startAngle:c,endAngle:u}=a.getProps(["startAngle","endAngle"],i),{angle:d}=Er(a,{x:t.x,y:t.y});Hn(d,c,u)&&s.push({element:a,datasetIndex:o,index:l})}return Oi(n,e,t,r),s}function ob(n,t,e,i,s,r){let a=[],o=rb(e),l=Number.POSITIVE_INFINITY;function c(u,d,m){let p=u.inRange(t.x,t.y,s);if(i&&!p)return;let b=u.getCenterPoint(s);if(!(!!r||n.isPointInArea(b))&&!p)return;let M=o(t,b);M<l?(a=[{element:u,datasetIndex:d,index:m}],l=M):M===l&&a.push({element:u,datasetIndex:d,index:m})}return Oi(n,e,t,c),a}function fa(n,t,e,i,s,r){return!r&&!n.isPointInArea(t)?[]:e==="r"&&!i?ab(n,t,e,s):ob(n,t,e,i,s,r)}function kc(n,t,e,i,s){let r=[],a=e==="x"?"inXRange":"inYRange",o=!1;return Oi(n,e,t,(l,c,u)=>{l[a](t[e],s)&&(r.push({element:l,datasetIndex:c,index:u}),o=o||l.inRange(t.x,t.y,s))}),i&&!o?[]:r}var lb={evaluateInteractionItems:Oi,modes:{index(n,t,e,i){let s=hn(t,n),r=e.axis||"x",a=e.includeInvisible||!1,o=e.intersect?ua(n,s,r,i,a):fa(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=hn(t,n),r=e.axis||"xy",a=e.includeInvisible||!1,o=e.intersect?ua(n,s,r,i,a):fa(n,s,r,!1,i,a);if(o.length>0){let l=o[0].datasetIndex,c=n.getDatasetMeta(l).data;o=[];for(let u=0;u<c.length;++u)o.push({element:c[u],datasetIndex:l,index:u})}return o},point(n,t,e,i){let s=hn(t,n),r=e.axis||"xy",a=e.includeInvisible||!1;return ua(n,s,r,i,a)},nearest(n,t,e,i){let s=hn(t,n),r=e.axis||"xy",a=e.includeInvisible||!1;return fa(n,s,r,e.intersect,i,a)},x(n,t,e,i){let s=hn(t,n);return kc(n,s,"x",e.intersect,i)},y(n,t,e,i){let s=hn(t,n);return kc(n,s,"y",e.intersect,i)}}},Sc=["left","top","right","bottom"];function Ei(n,t){return n.filter(e=>e.pos===t)}function Mc(n,t){return n.filter(e=>Sc.indexOf(e.pos)===-1&&e.box.axis===t)}function Di(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 cb(n){let t=[],e,i,s,r,a,o;for(e=0,i=(n||[]).length;e<i;++e)s=n[e],{position:r,options:{stack:a,stackWeight:o=1}}=s,t.push({index:e,box:s,pos:r,horizontal:s.isHorizontal(),weight:s.weight,stack:a&&r+a,stackWeight:o});return t}function hb(n){let t={};for(let e of n){let{stack:i,pos:s,stackWeight:r}=e;if(!i||!Sc.includes(s))continue;let a=t[i]||(t[i]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=r}return t}function ub(n,t){let e=hb(n),{vBoxMaxWidth:i,hBoxMaxHeight:s}=t,r,a,o;for(r=0,a=n.length;r<a;++r){o=n[r];let{fullSize:l}=o.box,c=e[o.stack],u=c&&o.stackWeight/c.weight;o.horizontal?(o.width=u?u*i:l&&t.availableWidth,o.height=s):(o.width=i,o.height=u?u*s:l&&t.availableHeight)}return e}function fb(n){let t=cb(n),e=Di(t.filter(c=>c.box.fullSize),!0),i=Di(Ei(t,"left"),!0),s=Di(Ei(t,"right")),r=Di(Ei(t,"top"),!0),a=Di(Ei(t,"bottom")),o=Mc(t,"x"),l=Mc(t,"y");return{fullSize:e,leftAndTop:i.concat(r),rightAndBottom:s.concat(l).concat(a).concat(o),chartArea:Ei(t,"chartArea"),vertical:i.concat(s).concat(l),horizontal:r.concat(a).concat(o)}}function Cc(n,t,e,i){return Math.max(n[e],t[e])+Math.max(n[i],t[i])}function Tc(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 db(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&&Tc(a,r.getPadding());let o=Math.max(0,t.outerWidth-Cc(a,n,"left","right")),l=Math.max(0,t.outerHeight-Cc(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 pb(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 gb(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 Ai(n,t,e,i){let s=[],r,a,o,l,c,u;for(r=0,a=n.length,c=0;r<a;++r){o=n[r],l=o.box,l.update(o.width||t.w,o.height||t.h,gb(o.horizontal,t));let{same:d,other:m}=db(t,e,o,i);c|=d&&s.length,u=u||m,l.fullSize||s.push(o)}return c&&Ai(s,t,e,i)||u}function Ms(n,t,e,i,s){n.top=e,n.left=t,n.right=t+i,n.bottom=e+s,n.width=i,n.height=s}function Pc(n,t,e,i){let s=e.padding,{x:r,y:a}=t;for(let o of n){let l=o.box,c=i[o.stack]||{count:1,placed:0,weight:1},u=o.stackWeight/c.weight||1;if(o.horizontal){let d=t.w*u,m=c.size||l.height;ge(c.start)&&(a=c.start),l.fullSize?Ms(l,s.left,a,e.outerWidth-s.right-s.left,m):Ms(l,t.left+c.placed,a,d,m),c.start=a,c.placed+=d,a=l.bottom}else{let d=t.h*u,m=c.size||l.width;ge(c.start)&&(r=c.start),l.fullSize?Ms(l,r,s.top,m,e.outerHeight-s.bottom-s.top):Ms(l,r,t.top+c.placed,m,d),c.start=r,c.placed+=d,r=l.right}}t.x=r,t.y=a}dt.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}});var ie={addBox(n,t){n.boxes||(n.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(e){t.draw(e)}}]},n.boxes.push(t)},removeBox(n,t){let e=n.boxes?n.boxes.indexOf(t):-1;e!==-1&&n.boxes.splice(e,1)},configure(n,t,e){t.fullSize=e.fullSize,t.position=e.position,t.weight=e.weight},update(n,t,e,i){if(!n)return;let s=te(n.options.layout.padding),r=Math.max(t-s.width,0),a=Math.max(e-s.height,0),o=fb(n.boxes),l=o.vertical,c=o.horizontal;Mt(n.boxes,k=>{typeof k.beforeLayout=="function"&&k.beforeLayout()});let u=l.reduce((k,M)=>M.box.options&&M.box.options.display===!1?k:k+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:e,padding:s,availableWidth:r,availableHeight:a,vBoxMaxWidth:r/2/u,hBoxMaxHeight:a/2}),m=Object.assign({},s);Tc(m,te(i));let p=Object.assign({maxPadding:m,w:r,h:a,x:s.left,y:s.top},s),b=ub(l.concat(c),d);Ai(o.fullSize,p,d,b),Ai(l,p,d,b),Ai(c,p,d,b)&&Ai(l,p,d,b),pb(p),Pc(o.leftAndTop,p,d,b),p.x+=p.w,p.y+=p.h,Pc(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,k=>{let M=k.box;Object.assign(M,n.chartArea),M.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},da=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){}},Oc=class extends da{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}},Cs="$chartjs",mb={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ec=n=>n===null||n==="";function bb(n,t){let e=n.style,i=n.getAttribute("height"),s=n.getAttribute("width");if(n[Cs]={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",Ec(s)){let r=ea(n,"width");r!==void 0&&(n.width=r)}if(Ec(i))if(n.style.height==="")n.height=n.width/(t||2);else{let r=ea(n,"height");r!==void 0&&(n.height=r)}return n}var Dc=Xl?{passive:!0}:!1;function vb(n,t,e){n.addEventListener(t,e,Dc)}function _b(n,t,e){n.canvas.removeEventListener(t,e,Dc)}function yb(n,t){let e=mb[n.type]||n.type,{x:i,y:s}=hn(n,t);return{type:e,chart:t,native:n,x:i!==void 0?i:null,y:s!==void 0?s:null}}function Ts(n,t){for(let e of n)if(e===t||e.contains(t))return!0}function xb(n,t,e){let i=n.canvas,s=new MutationObserver(r=>{let a=!1;for(let o of r)a=a||Ts(o.addedNodes,i),a=a&&!Ts(o.removedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}function wb(n,t,e){let i=n.canvas,s=new MutationObserver(r=>{let a=!1;for(let o of r)a=a||Ts(o.removedNodes,i),a=a&&!Ts(o.addedNodes,i);a&&e()});return s.observe(document,{childList:!0,subtree:!0}),s}var Li=new Map,Ac=0;function Lc(){let n=window.devicePixelRatio;n!==Ac&&(Ac=n,Li.forEach((t,e)=>{e.currentDevicePixelRatio!==n&&t()}))}function kb(n,t){Li.size||window.addEventListener("resize",Lc),Li.set(n,t)}function Sb(n){Li.delete(n),Li.size||window.removeEventListener("resize",Lc)}function Mb(n,t,e){let i=n.canvas,s=i&&vs(i);if(!s)return;let r=Rr((o,l)=>{let c=s.clientWidth;e(o,l),c<s.clientWidth&&e()},window),a=new ResizeObserver(o=>{let l=o[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||r(c,u)});return a.observe(s),kb(n,r),a}function pa(n,t,e){e&&e.disconnect(),t==="resize"&&Sb(n)}function Cb(n,t,e){let i=n.canvas,s=Rr(r=>{n.ctx!==null&&e(yb(r,n))},n,r=>{let a=r[0];return[a,a.offsetX,a.offsetY]});return vb(i,t,s),s}var Rc=class extends da{acquireContext(t,e){let i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(bb(t,e),i):null}releaseContext(t){let e=t.canvas;if(!e[Cs])return!1;let i=e[Cs].initial;["height","width"].forEach(r=>{let a=i[r];bt(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[Cs],!0}addEventListener(t,e,i){this.removeEventListener(t,e);let s=t.$proxies||(t.$proxies={}),a={attach:xb,detach:wb,resize:Mb}[e]||Cb;s[e]=a(t,e,i)}removeEventListener(t,e){let i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:pa,detach:pa,resize:pa}[e]||_b)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Ul(t,e,i,s)}isAttached(t){let e=vs(t);return!!(e&&e.isConnected)}};function Tb(n){return!Jr()||typeof OffscreenCanvas!="undefined"&&n instanceof OffscreenCanvas?Oc:Rc}var Fc=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(Dt(o,l,a)===!1&&s.cancelable)return!1}return!0}invalidate(){bt(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=Pb(i);return s===!1&&!e?[]:Eb(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 Pb(n){let t={},e=[],i=Object.keys(Fe.plugins.items);for(let r=0;r<i.length;r++)e.push(Fe.getPlugin(i[r]));let s=n.plugins||[];for(let r=0;r<s.length;r++){let a=s[r];e.indexOf(a)===-1&&(e.push(a),t[a.id]=!0)}return{plugins:e,localIds:t}}function Ob(n,t){return!t&&n===!1?null:n===!0?{}:n}function Eb(n,{plugins:t,localIds:e},i,s){let r=[],a=n.getContext();for(let o of t){let l=o.id,c=Ob(i[l],s);c!==null&&r.push({plugin:o,options:Db(n.config,{plugin:o,local:e[l]},c,a)})}return r}function Db(n,{plugin:t,local:e},i,s){let r=n.pluginScopeKeys(t),a=n.getOptionScopes(i,r);return e&&t.defaults&&a.push(t.defaults),n.createResolver(a,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ga(n,t){let e=dt.datasets[n]||{};return((t.datasets||{})[n]||{}).indexAxis||t.indexAxis||e.indexAxis||"x"}function Ab(n,t){let e=n;return n==="_index_"?e=t:n==="_value_"&&(e=t==="x"?"y":"x"),e}function Lb(n,t){return n===t?"_index_":"_value_"}function Rb(n){if(n==="top"||n==="bottom")return"x";if(n==="left"||n==="right")return"y"}function ma(n,t){return n==="x"||n==="y"?n:t.axis||Rb(t.position)||n.charAt(0).toLowerCase()}function Fb(n,t){let e=an[n.type]||{scales:{}},i=t.scales||{},s=ga(n.type,t),r=Object.create(null),a=Object.create(null);return Object.keys(i).forEach(o=>{let l=i[o];if(!ft(l))return console.error(`Invalid scale configuration for scale: ${o}`);if(l._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);let c=ma(o,l),u=Lb(c,s),d=e.scales||{};r[c]=r[c]||o,a[o]=jn(Object.create(null),[{axis:c},l,d[c],d[u]])}),n.data.datasets.forEach(o=>{let l=o.type||n.type,c=o.indexAxis||ga(l,t),d=(an[l]||{}).scales||{};Object.keys(d).forEach(m=>{let p=Ab(m,c),b=o[p+"AxisID"]||r[p]||p;a[b]=a[b]||Object.create(null),jn(a[b],[{axis:p},i[b],d[m]])})}),Object.keys(a).forEach(o=>{let l=a[o];jn(l,[dt.scales[l.type],dt.scale])}),a}function Ic(n){let t=n.options||(n.options={});t.plugins=at(t.plugins,{}),t.scales=Fb(n,t)}function $c(n){return n=n||{},n.datasets=n.datasets||[],n.labels=n.labels||[],n}function Ib(n){return n=n||{},n.data=$c(n.data),Ic(n),n}var zc=new Map,Bc=new Set;function Ps(n,t){let e=zc.get(n);return e||(e=t(),zc.set(n,e),Bc.add(e)),e}var Ri=(n,t,e)=>{let i=Ve(t,e);i!==void 0&&n.add(i)},jc=class{constructor(t){this._config=Ib(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=$c(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(),Ic(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ps(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,e){return Ps(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,e){return Ps(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]])}pluginScopeKeys(t){let e=t.id,i=this.type;return Ps(`${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=>Ri(l,t,d))),u.forEach(d=>Ri(l,s,d)),u.forEach(d=>Ri(l,an[r]||{},d)),u.forEach(d=>Ri(l,dt,d)),u.forEach(d=>Ri(l,ds,d))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Bc.has(e)&&a.set(e,c),c}chartOptionScopes(){let{options:t,type:e}=this;return[t,an[e]||{},dt.datasets[e]||{},{type:e},dt,ds]}resolveNamedOptions(t,e,i,s=[""]){let r={$shared:!0},{resolver:a,subPrefixes:o}=Nc(this._resolverCache,t,s),l=a;if(zb(a,e)){r.$shared=!1,i=We(i)?i():i;let c=this.createResolver(t,i,o);l=wn(a,i,c)}for(let c of e)r[c]=l[c];return r}createResolver(t,e,i=[""],s){let{resolver:r}=Nc(this._resolverCache,t,i);return ft(e)?wn(r,e,void 0,s):r}};function Nc(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:ms(t,e),subPrefixes:e.filter(o=>!o.toLowerCase().includes("hover"))},i.set(s,r)),r}var $b=n=>ft(n)&&Object.getOwnPropertyNames(n).reduce((t,e)=>t||We(n[e]),!1);function zb(n,t){let{isScriptable:e,isIndexable:i}=Ur(n);for(let s of t){let r=e(s),a=i(s),o=(a||r)&&n[s];if(r&&(We(o)||$b(o))||a&&Et(o))return!0}return!1}var Bb="3.9.1",jb=["top","bottom","left","right","chartArea"];function Hc(n,t){return n==="top"||n==="bottom"||jb.indexOf(n)===-1&&t==="x"}function Vc(n,t){return function(e,i){return e[n]===i[n]?e[t]-i[t]:e[n]-i[n]}}function Wc(n){let t=n.chart,e=t.options.animation;t.notifyPlugins("afterRender"),Dt(e&&e.onComplete,[n],t)}function Nb(n){let t=n.chart,e=t.options.animation;Dt(e&&e.onProgress,[n],t)}function Yc(n){return Jr()&&typeof n=="string"?n=document.getElementById(n):n&&n.length&&(n=n[0]),n&&n.canvas&&(n=n.canvas),n}var Os={},Gc=n=>{let t=Yc(n);return Object.values(Os).filter(e=>e.canvas===t).pop()};function Hb(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 Vb(n,t,e,i){return!e||n.type==="mouseout"?null:i?t:n}var le=class{constructor(t,e){let i=this.config=new jc(e),s=Yc(t),r=Gc(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||Tb(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=hl(),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 Fc,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=kl(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],Os[this.id]=this,!o||!l){console.error("Failed to create chart: can't acquire context from the given item");return}qe.listen(this,"complete",Wc),qe.listen(this,"progress",Nb),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:r}=this;return bt(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():ta(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Yr(this.canvas,this.ctx),this}stop(){return qe.stop(this),this}resize(t,e){qe.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,!!ta(this,o,!0)&&(this.notifyPlugins("resize",{size:a}),Dt(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=ma(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=ma(l,o),u=at(o.type,a.dtype);(o.position===void 0||Hc(o.position,c)!==Hc(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 m=Fe.getScale(u);d=new m({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=>{ie.configure(this,a,a.options),ie.addBox(this,a)})}_updateMetasets(){let t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort((s,r)=>s.index-r.index),i>e){for(let s=e;s<i;++s)this._destroyDatasetMeta(s);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Vc("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach((i,s)=>{e.filter(r=>r===i._dataset).length===0&&this._destroyDatasetMeta(s)})}buildOrUpdateControllers(){let t=[],e=this.data.datasets,i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){let r=e[i],a=this.getDatasetMeta(i),o=r.type||this.config.type;if(a.type&&a.type!==o&&(this._destroyDatasetMeta(i),a=this.getDatasetMeta(i)),a.type=o,a.indexAxis=r.indexAxis||ga(o,this.options),a.order=r.order||0,a.index=i,a.label=""+r.label,a.visible=this.isDatasetVisible(i),a.controller)a.controller.updateIndex(i),a.controller.linkScales();else{let l=Fe.getController(o),{datasetElementType:c,dataElementType:u}=dt.datasets[o];Object.assign(l.prototype,{dataElementType:Fe.getElement(u),datasetElementType:c&&Fe.getElement(c)}),a.controller=new l(this,i),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){Mt(this.data.datasets,(t,e)=>{this.getDatasetMeta(e).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let e=this.config;e.update();let i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,u=this.data.datasets.length;c<u;c++){let{controller:d}=this.getDatasetMeta(c),m=!s&&r.indexOf(d)===-1;d.buildOrUpdateElements(m),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=i.layout.autoPadding?a:0,this._updateLayout(a),s||Mt(r,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Vc("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=>{ie.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);(!Cr(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;Hb(t,s,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let e=this.data.datasets.length,i=r=>new Set(t.filter(a=>a[0]===r).map((a,o)=>o+","+a.splice(1).join(","))),s=i(0);for(let r=1;r<e;r++)if(!Cr(s,i(r)))return;return Array.from(s).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;ie.update(this,this.width,this.height,t);let e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],Mt(this.boxes,s=>{i&&s.position==="chartArea"||(s.configure&&s.configure(),this._layers.push(...s._layers()))},this),this._layers.forEach((s,r)=>{s._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let e=0,i=this.data.datasets.length;e<i;++e)this.getDatasetMeta(e).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,We(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){let i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",s)!==!1&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(qe.has(this)?this.attached&&!qe.running(this)&&qe.start(this):(this.draw(),Wc({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:i,height:s}=this._resizeBeforeDraw;this._resize(i,s),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let e=this._sortedMetasets,i=[],s,r;for(s=0,r=e.length;s<r;++s){let a=e[s];(!t||a.visible)&&i.push(a)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let e=this.ctx,i=t._clip,s=!i.disabled,r=this.chartArea,a={meta:t,index:t.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",a)!==!1&&(s&&vi(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&&_i(e),a.cancelable=!1,this.notifyPlugins("afterDatasetDraw",a))}isPointInArea(t){return Yn(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){let r=lb.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);ge(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(),qe.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Yr(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),this.notifyPlugins("destroy"),delete Os[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,e=this.platform,i=(r,a)=>{e.addEventListener(this,r,a),t[r]=a},s=(r,a,o)=>{r.offsetX=a,r.offsetY=o,this._eventHandler(r)};Mt(this.options.events,r=>i(r,s))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,e=this.platform,i=(l,c)=>{e.addEventListener(this,l,c),t[l]=c},s=(l,c)=>{t[l]&&(e.removeEventListener(this,l,c),delete t[l])},r=(l,c)=>{this.canvas&&this.resize(l,c)},a,o=()=>{s("attach",o),this.attached=!0,this.resize(),i("resize",r),i("detach",a)};a=()=>{this.attached=!1,s("resize",r),this._stop(),this._resize(0,0),i("attach",o)},e.isAttached(this.canvas)?o():a()}unbindEvents(){Mt(this._listeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._listeners={},Mt(this._responsiveListeners,(t,e)=>{this.platform.removeEventListener(this,e,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){let s=i?"set":"remove",r,a,o,l;for(e==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+s+"DatasetHoverStyle"]()),o=0,l=t.length;o<l;++o){a=t[o];let c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[s+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let e=this._active||[],i=t.map(({datasetIndex:r,index:a})=>{let o=this.getDatasetMeta(r);if(!o)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:o.data[a],index:a}});!ui(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=pl(t),c=Vb(t,this._lastEvent,i,l);i&&(this._lastEvent=null,Dt(r.onHover,[t,o,this],this),l&&Dt(r.onClick,[t,o,this],this));let u=!ui(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)}},qc=()=>Mt(le.instances,n=>n._plugins.invalidate()),dn=!0;Object.defineProperties(le,{defaults:{enumerable:dn,value:dt},instances:{enumerable:dn,value:Os},overrides:{enumerable:dn,value:an},registry:{enumerable:dn,value:Fe},version:{enumerable:dn,value:Bb},getChart:{enumerable:dn,value:Gc},register:{enumerable:dn,value:(...n)=>{Fe.add(...n),qc()}},unregister:{enumerable:dn,value:(...n)=>{Fe.remove(...n),qc()}}});function Uc(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+Ft,i-Ft),n.closePath(),n.clip()}function Wb(n){return gs(n,["outerStart","outerEnd","innerStart","innerEnd"])}function Yb(n,t,e,i){let s=Wb(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 Yt(l,0,Math.min(r,c))};return{outerStart:o(s.outerStart),outerEnd:o(s.outerEnd),innerStart:Yt(s.innerStart,0,a),innerEnd:Yt(s.innerEnd,0,a)}}function Kn(n,t,e,i){return{x:e+n*Math.cos(t),y:i+n*Math.sin(t)}}function ba(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),m=u>0?u+i+e+c:0,p=0,b=s-l;if(i){let U=u>0?u-i:0,_t=d>0?d-i:0,Ct=(U+_t)/2,se=Ct!==0?b*Ct/(Ct+i):b;p=(b-se)/2}let k=Math.max(.001,b*d-e/Lt)/d,M=(b-k)/2,T=l+M+p,R=s-M-p,{outerStart:$,outerEnd:L,innerStart:F,innerEnd:z}=Yb(t,m,d,R-T),H=d-$,G=d-L,q=T+$/H,et=R-L/G,ot=m+F,st=m+z,wt=T+F/ot,rt=R-z/st;if(n.beginPath(),r){if(n.arc(a,o,d,q,et),L>0){let Ct=Kn(G,et,a,o);n.arc(Ct.x,Ct.y,L,et,R+Ft)}let U=Kn(st,R,a,o);if(n.lineTo(U.x,U.y),z>0){let Ct=Kn(st,rt,a,o);n.arc(Ct.x,Ct.y,z,R+Ft,rt+Math.PI)}if(n.arc(a,o,m,R-z/m,T+F/m,!0),F>0){let Ct=Kn(ot,wt,a,o);n.arc(Ct.x,Ct.y,F,wt+Math.PI,T-Ft)}let _t=Kn(H,T,a,o);if(n.lineTo(_t.x,_t.y),$>0){let Ct=Kn(H,q,a,o);n.arc(Ct.x,Ct.y,$,T-Ft,q)}}else{n.moveTo(a,o);let U=Math.cos(q)*d+a,_t=Math.sin(q)*d+o;n.lineTo(U,_t);let Ct=Math.cos(et)*d+a,se=Math.sin(et)*d+o;n.lineTo(Ct,se)}n.closePath()}function Gb(n,t,e,i,s){let{fullCircles:r,startAngle:a,circumference:o}=t,l=t.endAngle;if(r){ba(n,t,e,i,a+Ot,s);for(let c=0;c<r;++c)n.fill();isNaN(o)||(l=a+o%Ot,o%Ot==0&&(l+=Ot))}return ba(n,t,e,i,l,s),n.fill(),l}function qb(n,t,e){let{x:i,y:s,startAngle:r,pixelMargin:a,fullCircles:o}=t,l=Math.max(t.outerRadius-a,0),c=t.innerRadius+a,u;for(e&&Uc(n,t,r+Ot),n.beginPath(),n.arc(i,s,c,r+Ot,r,!0),u=0;u<o;++u)n.stroke();for(n.beginPath(),n.arc(i,s,l,r,r+Ot),u=0;u<o;++u)n.stroke()}function Ub(n,t,e,i,s,r){let{options:a}=t,{borderWidth:o,borderJoinStyle:l}=a,c=a.borderAlign==="inner";!o||(c?(n.lineWidth=o*2,n.lineJoin=l||"round"):(n.lineWidth=o,n.lineJoin=l||"bevel"),t.fullCircles&&qb(n,t,c),c&&Uc(n,t,s),ba(n,t,e,i,s,r),n.stroke())}var Fi=class extends xe{constructor(t){super();this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){let s=this.getProps(["x","y"],i),{angle:r,distance:a}=Er(s,{x:t,y:e}),{startAngle:o,endAngle:l,innerRadius:c,outerRadius:u,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),m=this.options.spacing/2,b=at(d,l-o)>=Ot||Hn(r,o,l),k=Le(a,c+m,u+m);return b&&k}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>Ot?Math.floor(i/Ot):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>=Lt&&(o=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;let l=Gb(t,this,o,r,a);Ub(t,this,o,r,l,a),t.restore()}};Fi.id="arc";Fi.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};Fi.defaultRoutes={backgroundColor:"backgroundColor"};function Xc(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 Xb(n,t,e){n.lineTo(e.x,e.y)}function Kb(n){return n.stepped?zl:n.tension||n.cubicInterpolationMode==="monotone"?Bl:Xb}function Kc(n,t,e={}){let i=n.length,{start:s=0,end:r=i-1}=e,{start:a,end:o}=t,l=Math.max(s,a),c=Math.min(r,o),u=s<a&&r<a||s>o&&r>o;return{count:i,start:l,loop:t.loop,ilen:c<l&&!u?i+c-l:c-l}}function Zb(n,t,e,i){let{points:s,options:r}=t,{count:a,start:o,loop:l,ilen:c}=Kc(s,e,i),u=Kb(r),{move:d=!0,reverse:m}=i||{},p,b,k;for(p=0;p<=c;++p)b=s[(o+(m?c-p:p))%a],!b.skip&&(d?(n.moveTo(b.x,b.y),d=!1):u(n,k,b,m,r.stepped),k=b);return l&&(b=s[(o+(m?c:0))%a],u(n,k,b,m,r.stepped)),!!l}function Jb(n,t,e,i){let s=t.points,{count:r,start:a,ilen:o}=Kc(s,e,i),{move:l=!0,reverse:c}=i||{},u=0,d=0,m,p,b,k,M,T,R=L=>(a+(c?o-L:L))%r,$=()=>{k!==M&&(n.lineTo(u,M),n.lineTo(u,k),n.lineTo(u,T))};for(l&&(p=s[R(0)],n.moveTo(p.x,p.y)),m=0;m<=o;++m){if(p=s[R(m)],p.skip)continue;let L=p.x,F=p.y,z=L|0;z===b?(F<k?k=F:F>M&&(M=F),u=(d*u+L)/++d):($(),n.lineTo(L,F),b=z,d=0,k=M=F),T=F}$()}function va(n){let t=n.options,e=t.borderDash&&t.borderDash.length;return!n._decimated&&!n._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!e?Jb:Zb}function Qb(n){return n.stepped?Kl:n.tension||n.cubicInterpolationMode==="monotone"?Zl:un}function t0(n,t,e,i){let s=t._path;s||(s=t._path=new Path2D,t.path(s,e,i)&&s.closePath()),Xc(n,t.options),n.stroke(s)}function e0(n,t,e,i){let{segments:s,options:r}=t,a=va(t);for(let o of s)Xc(n,r,o.style),n.beginPath(),a(n,t,o,{start:e,end:e+i-1})&&n.closePath(),n.stroke()}var n0=typeof Path2D=="function";function i0(n,t,e,i){n0&&!t.options.segment?t0(n,t,e,i):e0(n,t,e,i)}var Ue=class extends xe{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;ql(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=ec(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=ra(this,{property:e,start:s,end:s});if(!a.length)return;let o=[],l=Qb(i),c,u;for(c=0,u=a.length;c<u;++c){let{start:d,end:m}=a[c],p=r[d],b=r[m];if(p===b){o.push(p);continue}let k=Math.abs((s-p[e])/(b[e]-p[e])),M=l(p,b,k,i.stepped);M[e]=t[e],o.push(M)}return o.length===1?o[0]:o}pathSegment(t,e,i){return va(this)(t,this,e,i)}path(t,e,i){let s=this.segments,r=va(this),a=this._loop;e=e||0,i=i||this.points.length-e;for(let o of s)a&=r(t,this,o,{start:e,end:e+i-1});return!!a}draw(t,e,i,s){let r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),i0(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}};Ue.id="line";Ue.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};Ue.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};Ue.descriptors={_scriptable:!0,_indexable:n=>n!=="borderDash"&&n!=="fill"};function Zc(n,t,e,i){let s=n.options,{[e]:r}=n.getProps([e],i);return Math.abs(t-r)<s.radius+s.hitRadius}var Ii=class extends xe{constructor(t){super();this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){let s=this.options,{x:r,y:a}=this.getProps(["x","y"],i);return Math.pow(t-r,2)+Math.pow(e-a,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return Zc(this,t,"x",e)}inYRange(t,e){return Zc(this,t,"y",e)}getCenterPoint(t){let{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){t=t||this.options||{};let e=t.radius||0;e=Math.max(e,e&&t.hoverRadius||0);let i=e&&t.borderWidth||0;return(e+i)*2}draw(t,e){let i=this.options;this.skip||i.radius<.1||!Yn(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,ps(t,i,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}};Ii.id="point";Ii.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};Ii.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};function Jc(n,t){let{x:e,y:i,base:s,width:r,height:a}=n.getProps(["x","y","base","width","height"],t),o,l,c,u,d;return n.horizontal?(d=a/2,o=Math.min(e,s),l=Math.max(e,s),c=i-d,u=i+d):(d=r/2,o=e-d,l=e+d,c=Math.min(i,s),u=Math.max(i,s)),{left:o,top:c,right:l,bottom:u}}function pn(n,t,e,i){return n?0:Yt(t,e,i)}function s0(n,t,e){let i=n.options.borderWidth,s=n.borderSkipped,r=qr(i);return{t:pn(s.top,r.top,0,e),r:pn(s.right,r.right,0,t),b:pn(s.bottom,r.bottom,0,e),l:pn(s.left,r.left,0,t)}}function r0(n,t,e){let{enableBorderRadius:i}=n.getProps(["enableBorderRadius"]),s=n.options.borderRadius,r=cn(s),a=Math.min(t,e),o=n.borderSkipped,l=i||ft(s);return{topLeft:pn(!l||o.top||o.left,r.topLeft,0,a),topRight:pn(!l||o.top||o.right,r.topRight,0,a),bottomLeft:pn(!l||o.bottom||o.left,r.bottomLeft,0,a),bottomRight:pn(!l||o.bottom||o.right,r.bottomRight,0,a)}}function a0(n){let t=Jc(n),e=t.right-t.left,i=t.bottom-t.top,s=s0(n,e/2,i/2),r=r0(n,e/2,i/2);return{outer:{x:t.left,y:t.top,w:e,h:i,radius:r},inner:{x:t.left+s.l,y:t.top+s.t,w:e-s.l-s.r,h:i-s.t-s.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,r.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(s.b,s.r))}}}}function _a(n,t,e,i){let s=t===null,r=e===null,o=n&&!(s&&r)&&Jc(n,i);return o&&(s||Le(t,o.left,o.right))&&(r||Le(e,o.top,o.bottom))}function o0(n){return n.topLeft||n.topRight||n.bottomLeft||n.bottomRight}function l0(n,t){n.rect(t.x,t.y,t.w,t.h)}function ya(n,t,e={}){let i=n.x!==e.x?-t:0,s=n.y!==e.y?-t:0,r=(n.x+n.w!==e.x+e.w?t:0)-i,a=(n.y+n.h!==e.y+e.h?t:0)-s;return{x:n.x+i,y:n.y+s,w:n.w+r,h:n.h+a,radius:n.radius}}var $i=class extends xe{constructor(t){super();this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){let{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:r,outer:a}=a0(this),o=o0(a.radius)?Gn:l0;t.save(),(a.w!==r.w||a.h!==r.h)&&(t.beginPath(),o(t,ya(a,e,r)),t.clip(),o(t,ya(r,-e,a)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),o(t,ya(r,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return _a(this,t,e,i)}inXRange(t,e){return _a(this,t,null,e)}inYRange(t,e){return _a(this,null,t,e)}getCenterPoint(t){let{x:e,y:i,base:s,horizontal:r}=this.getProps(["x","y","base","horizontal"],t);return{x:r?(e+s)/2:e,y:r?i:(i+s)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}};$i.id="bar";$i.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};$i.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var c0=Object.freeze({__proto__:null,ArcElement:Fi,LineElement:Ue,PointElement:Ii,BarElement:$i});function h0(n,t,e,i,s){let r=s.samples||i;if(r>=e)return n.slice(t,t+e);let a=[],o=(e-2)/(r-2),l=0,c=t+e-1,u=t,d,m,p,b,k;for(a[l++]=n[u],d=0;d<r-2;d++){let M=0,T=0,R,$=Math.floor((d+1)*o)+1+t,L=Math.min(Math.floor((d+2)*o)+1,e)+t,F=L-$;for(R=$;R<L;R++)M+=n[R].x,T+=n[R].y;M/=F,T/=F;let z=Math.floor(d*o)+1+t,H=Math.min(Math.floor((d+1)*o)+1,e)+t,{x:G,y:q}=n[u];for(p=b=-1,R=z;R<H;R++)b=.5*Math.abs((G-M)*(n[R].y-q)-(G-n[R].x)*(T-q)),b>p&&(p=b,m=n[R],k=R);a[l++]=m,u=k}return a[l++]=n[c],a}function u0(n,t,e,i){let s=0,r=0,a,o,l,c,u,d,m,p,b,k,M=[],T=t+e-1,R=n[t].x,L=n[T].x-R;for(a=t;a<t+e;++a){o=n[a],l=(o.x-R)/L*i,c=o.y;let F=l|0;if(F===u)c<b?(b=c,d=a):c>k&&(k=c,m=a),s=(r*s+o.x)/++r;else{let z=a-1;if(!bt(d)&&!bt(m)){let H=Math.min(d,m),G=Math.max(d,m);H!==p&&H!==z&&M.push({...n[H],x:s}),G!==p&&G!==z&&M.push({...n[G],x:s})}a>0&&z!==p&&M.push(n[z]),M.push(o),u=F,r=0,b=k=c,d=m=p=a}}return M}function Qc(n){if(n._decimated){let t=n._data;delete n._decimated,delete n._data,Object.defineProperty(n,"data",{value:t})}}function th(n){n.data.datasets.forEach(t=>{Qc(t)})}function f0(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=Yt(Re(t,r.axis,a).lo,0,e-1)),c?s=Yt(Re(t,r.axis,o).hi+1,i,e)-i:s=e-i,{start:i,count:s}}var d0={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(n,t,e)=>{if(!e.enabled){th(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(qn([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:m}=f0(l,c),p=e.threshold||4*i;if(m<=p){Qc(s);return}bt(a)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(k){this._data=k}}));let b;switch(e.algorithm){case"lttb":b=h0(c,d,m,i,e);break;case"min-max":b=u0(c,d,m,i);break;default:throw new Error(`Unsupported decimation algorithm '${e.algorithm}'`)}s._decimated=b})},destroy(n){th(n)}};function p0(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=wa(l,c,s);let u=xa(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=ra(t,u);for(let m of d){let p=xa(e,r[m.start],r[m.end],m.loop),b=sa(o,s,p);for(let k of b)a.push({source:k,target:m,start:{[e]:eh(u,p,"start",Math.max)},end:{[e]:eh(u,p,"end",Math.min)}})}}return a}function xa(n,t,e,i){if(i)return;let s=t[n],r=e[n];return n==="angle"&&(s=oe(s),r=oe(r)),{property:n,start:s,end:r}}function g0(n,t){let{x:e=null,y:i=null}=n||{},s=t.points,r=[];return t.segments.forEach(({start:a,end:o})=>{o=wa(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 wa(n,t,e){for(;t>n;t--){let i=e[t];if(!isNaN(i.x)&&!isNaN(i.y))break}return t}function eh(n,t,e,i){return n&&t?i(n[e],t[e]):n?n[e]:t?t[e]:0}function nh(n,t){let e=[],i=!1;return Et(n)?(i=!0,e=n):e=g0(n,t),e.length?new Ue({points:e,options:{tension:0},_loop:i,_fullLoop:i}):null}function ih(n){return n&&n.fill!==!1}function m0(n,t,e){let s=n[t].fill,r=[t],a;if(!e)return s;for(;s!==!1&&r.indexOf(s)===-1;){if(!$t(s))return s;if(a=n[s],!a)return!1;if(a.visible)return s;r.push(s),s=a.fill}return!1}function b0(n,t,e){let i=x0(n);if(ft(i))return isNaN(i.value)?!1:i;let s=parseFloat(i);return $t(s)&&Math.floor(s)===s?v0(i[0],t,s,e):["origin","start","end","stack","shape"].indexOf(i)>=0&&i}function v0(n,t,e,i){return(n==="-"||n==="+")&&(e=t+e),e===t||e<0||e>=i?!1:e}function _0(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 y0(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 x0(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 w0(n){let{scale:t,index:e,line:i}=n,s=[],r=i.segments,a=i.points,o=k0(t,e);o.push(nh({x:null,y:t.bottom},i));for(let l=0;l<r.length;l++){let c=r[l];for(let u=c.start;u<=c.end;u++)S0(s,a[u],o)}return new Ue({points:s,options:{}})}function k0(n,t){let e=[],i=n.getMatchingVisibleMetas("line");for(let s=0;s<i.length;s++){let r=i[s];if(r.index===t)break;r.hidden||e.unshift(r.dataset)}return e}function S0(n,t,e){let i=[];for(let s=0;s<e.length;s++){let r=e[s],{first:a,last:o,point:l}=M0(r,t,"x");if(!(!l||a&&o)){if(a)i.unshift(l);else if(n.push(l),!o)break}}n.push(...i)}function M0(n,t,e){let i=n.interpolate(t,e);if(!i)return{};let s=i[e],r=n.segments,a=n.points,o=!1,l=!1;for(let c=0;c<r.length;c++){let u=r[c],d=a[u.start][e],m=a[u.end][e];if(Le(s,d,m)){o=s===d,l=s===m;break}}return{first:o,last:l,point:i}}var ka=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){let{x:s,y:r,radius:a}=this;return e=e||{start:0,end:Ot},t.arc(s,r,a,e.end,e.start,!0),!i.bounds}interpolate(t){let{x:e,y:i,radius:s}=this,r=t.angle;return{x:e+Math.cos(r)*s,y:i+Math.sin(r)*s,angle:r}}};function C0(n){let{chart:t,fill:e,line:i}=n;if($t(e))return T0(t,e);if(e==="stack")return w0(n);if(e==="shape")return!0;let s=P0(n);return s instanceof ka?s:nh(s,i)}function T0(n,t){let e=n.getDatasetMeta(t);return e&&n.isDatasetVisible(t)?e.dataset:null}function P0(n){return(n.scale||{}).getPointPositionForValue?E0(n):O0(n)}function O0(n){let{scale:t={},fill:e}=n,i=_0(e,t);if($t(i)){let s=t.isHorizontal();return{x:s?i:null,y:s?null:i}}return null}function E0(n){let{scale:t,fill:e}=n,i=t.options,s=t.getLabels().length,r=i.reverse?t.max:t.min,a=y0(e,t,r),o=[];if(i.grid.circular){let l=t.getPointPositionForValue(0,r);return new ka({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(a)})}for(let l=0;l<s;++l)o.push(t.getPointPositionForValue(l,a));return o}function Sa(n,t,e){let i=C0(t),{line:s,scale:r,axis:a}=t,o=s.options,l=o.fill,c=o.backgroundColor,{above:u=c,below:d=c}=l||{};i&&s.points.length&&(vi(n,e),D0(n,{line:s,target:i,above:u,below:d,area:e,scale:r,axis:a}),_i(n))}function D0(n,t){let{line:e,target:i,above:s,below:r,area:a,scale:o}=t,l=e._loop?"angle":t.axis;n.save(),l==="x"&&r!==s&&(sh(n,i,a.top),rh(n,{line:e,target:i,color:s,scale:o,property:l}),n.restore(),n.save(),sh(n,i,a.bottom)),rh(n,{line:e,target:i,color:r,scale:o,property:l}),n.restore()}function sh(n,t,e){let{segments:i,points:s}=t,r=!0,a=!1;n.beginPath();for(let o of i){let{start:l,end:c}=o,u=s[l],d=s[wa(l,c,s)];r?(n.moveTo(u.x,u.y),r=!1):(n.lineTo(u.x,e),n.lineTo(u.x,u.y)),a=!!t.pathSegment(n,o,{move:a}),a?n.closePath():n.lineTo(d.x,e)}n.lineTo(t.first().x,e),n.closePath(),n.clip()}function rh(n,t){let{line:e,target:i,property:s,color:r,scale:a}=t,o=p0(e,i,s);for(let{source:l,target:c,start:u,end:d}of o){let{style:{backgroundColor:m=r}={}}=l,p=i!==!0;n.save(),n.fillStyle=m,A0(n,a,p&&xa(s,u,d)),n.beginPath();let b=!!e.pathSegment(n,l),k;if(p){b?n.closePath():ah(n,i,d,s);let M=!!i.pathSegment(n,c,{move:b,reverse:!0});k=b&&M,k||ah(n,i,u,s)}n.closePath(),n.fill(k?"evenodd":"nonzero"),n.restore()}}function A0(n,t,e){let{top:i,bottom:s}=t.chart.chartArea,{property:r,start:a,end:o}=e||{};r==="x"&&(n.beginPath(),n.rect(a,i,o-a,s-i),n.clip())}function ah(n,t,e,i){let s=t.interpolate(e,i);s&&n.lineTo(s.x,s.y)}var L0={id:"filler",afterDatasetsUpdate(n,t,e){let i=(n.data.datasets||[]).length,s=[],r,a,o,l;for(a=0;a<i;++a)r=n.getDatasetMeta(a),o=r.dataset,l=null,o&&o.options&&o instanceof Ue&&(l={visible:n.isDatasetVisible(a),index:a,fill:b0(o,a,i),chart:n,axis:r.controller.options.indexAxis,scale:r.vScale,line:o}),r.$filler=l,s.push(l);for(a=0;a<i;++a)l=s[a],!(!l||l.fill===!1)&&(l.fill=m0(s,a,e.propagate))},beforeDraw(n,t,e){let i=e.drawTime==="beforeDraw",s=n.getSortedVisibleDatasetMetas(),r=n.chartArea;for(let a=s.length-1;a>=0;--a){let o=s[a].$filler;!o||(o.line.updateControlPoints(r,o.axis),i&&o.fill&&Sa(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;ih(r)&&Sa(n.ctx,r,n.chartArea)}},beforeDatasetDraw(n,t,e){let i=t.meta.$filler;!ih(i)||e.drawTime!=="beforeDatasetDraw"||Sa(n.ctx,i,n.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},oh=(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)}},R0=(n,t)=>n!==null&&t!==null&&n.datasetIndex===t.datasetIndex&&n.index===t.index,Ma=class extends xe{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=Dt(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=Vt(i.font),r=s.size,a=this._computeTitleHeight(),{boxWidth:o,itemHeight:l}=oh(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 m=-1,p=-u;return this.legendItems.forEach((b,k)=>{let M=i+e/2+r.measureText(b.text).width;(k===0||c[c.length-1]+M+2*o>a)&&(d+=u,c[c.length-(k>0?0:1)]=0,p+=u,m++),l[k]={left:0,top:p,row:m,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,m=0,p=0,b=0,k=0;return this.legendItems.forEach((M,T)=>{let R=i+e/2+r.measureText(M.text).width;T>0&&p+s+2*o>u&&(d+=m+o,c.push({width:m,height:p}),b+=m+o,k++,m=p=0),l[T]={left:b,top:p,col:k,width:R,height:s},m=Math.max(m,R),p+=s+o}),d+=m,c.push({width:m,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=Sn(r,this.left,this.width);if(this.isHorizontal()){let o=0,l=Qt(i,this.left+s,this.right-this.lineWidths[o]);for(let c of e)o!==c.row&&(o=c.row,l=Qt(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=Qt(i,this.top+t+s,this.bottom-this.columnSizes[o].height);for(let c of e)c.col!==o&&(o=c.col,l=Qt(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;vi(t,this),this._draw(),_i(t)}}_draw(){let{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:r,labels:a}=t,o=dt.color,l=Sn(t.rtl,this.left,this.width),c=Vt(a.font),{color:u,padding:d}=a,m=c.size,p=m/2,b;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;let{boxWidth:k,boxHeight:M,itemHeight:T}=oh(a,m),R=function(H,G,q){if(isNaN(k)||k<=0||isNaN(M)||M<0)return;s.save();let et=at(q.lineWidth,1);if(s.fillStyle=at(q.fillStyle,o),s.lineCap=at(q.lineCap,"butt"),s.lineDashOffset=at(q.lineDashOffset,0),s.lineJoin=at(q.lineJoin,"miter"),s.lineWidth=et,s.strokeStyle=at(q.strokeStyle,o),s.setLineDash(at(q.lineDash,[])),a.usePointStyle){let ot={radius:M*Math.SQRT2/2,pointStyle:q.pointStyle,rotation:q.rotation,borderWidth:et},st=l.xPlus(H,k/2),wt=G+p;Gr(s,ot,st,wt,a.pointStyleWidth&&k)}else{let ot=G+Math.max((m-M)/2,0),st=l.leftForLtr(H,k),wt=cn(q.borderRadius);s.beginPath(),Object.values(wt).some(rt=>rt!==0)?Gn(s,{x:st,y:ot,w:k,h:M,radius:wt}):s.rect(st,ot,k,M),s.fill(),et!==0&&s.stroke()}s.restore()},$=function(H,G,q){ln(s,q.text,H,G+T/2,c,{strikethrough:q.hidden,textAlign:l.textAlign(q.textAlign)})},L=this.isHorizontal(),F=this._computeTitleHeight();L?b={x:Qt(r,this.left+d,this.right-i[0]),y:this.top+d+F,line:0}:b={x:this.left+d,y:Qt(r,this.top+F+d,this.bottom-e[0].height),line:0},na(this.ctx,t.textDirection);let z=T+d;this.legendItems.forEach((H,G)=>{s.strokeStyle=H.fontColor||u,s.fillStyle=H.fontColor||u;let q=s.measureText(H.text).width,et=l.textAlign(H.textAlign||(H.textAlign=a.textAlign)),ot=k+p+q,st=b.x,wt=b.y;l.setWidth(this.width),L?G>0&&st+ot+d>this.right&&(wt=b.y+=z,b.line++,st=b.x=Qt(r,this.left+d,this.right-i[b.line])):G>0&&wt+z>this.bottom&&(st=b.x=st+e[b.line].width+d,b.line++,wt=b.y=Qt(r,this.top+F+d,this.bottom-e[b.line].height));let rt=l.x(st);R(rt,wt,H),st=Sl(et,st+k+p,L?st+ot:this.right,t.rtl),$(l.x(st),wt,H),L?b.x+=ot+d:b.y+=z}),ia(this.ctx,t.textDirection)}drawTitle(){let t=this.options,e=t.title,i=Vt(e.font),s=te(e.padding);if(!e.display)return;let r=Sn(t.rtl,this.left,this.width),a=this.ctx,o=e.position,l=i.size/2,c=s.top+l,u,d=this.left,m=this.width;if(this.isHorizontal())m=Math.max(...this.lineWidths),u=this.top+c,d=Qt(t.align,d,this.right-m);else{let b=this.columnSizes.reduce((k,M)=>Math.max(k,M.height),0);u=c+Qt(t.align,this.top,this.bottom-b-t.labels.padding-this._computeTitleHeight())}let p=Qt(o,d,d+m);a.textAlign=r.textAlign(ls(o)),a.textBaseline="middle",a.strokeStyle=e.color,a.fillStyle=e.color,a.font=i.string,ln(a,e.text,p,u,i)}_computeTitleHeight(){let t=this.options.title,e=Vt(t.font),i=te(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,r;if(Le(t,this.left,this.right)&&Le(e,this.top,this.bottom)){for(r=this.legendHitBoxes,i=0;i<r.length;++i)if(s=r[i],Le(t,s.left,s.left+s.width)&&Le(e,s.top,s.top+s.height))return this.legendItems[i]}return null}handleEvent(t){let e=this.options;if(!F0(t.type,e))return;let i=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){let s=this._hoveredItem,r=R0(s,i);s&&!r&&Dt(e.onLeave,[t,s,this],this),this._hoveredItem=i,i&&!r&&Dt(e.onHover,[t,i,this],this)}else i&&Dt(e.onClick,[t,i,this],this)}};function F0(n,t){return!!((n==="mousemove"||n==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(n==="click"||n==="mouseup"))}var I0={id:"legend",_element:Ma,start(n,t,e){let i=n.legend=new Ma({ctx:n.ctx,options:e,chart:n});ie.configure(n,i,e),ie.addBox(n,i)},stop(n){ie.removeBox(n,n.legend),delete n.legend},beforeUpdate(n,t,e){let i=n.legend;ie.configure(n,i,e),i.options=e},afterUpdate(n){let t=n.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(n,t){t.replay||n.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(n,t,e){let i=t.datasetIndex,s=e.chart;s.isDatasetVisible(i)?(s.hide(i),t.hidden=!0):(s.show(i),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:n=>n.chart.options.color,boxWidth:40,padding:10,generateLabels(n){let t=n.data.datasets,{labels:{usePointStyle:e,pointStyle:i,textAlign:s,color:r}}=n.legend.options;return n._getSortedDatasetMetas().map(a=>{let o=a.controller.getStyle(e?0:void 0),l=te(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)}}},Es=class extends xe{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=Et(i.text)?i.text.length:1;this._padding=te(i.padding);let r=s*Vt(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=Qt(o,i,r),d=e+t,c=r-i):(a.position==="left"?(u=i+t,d=Qt(o,s,e),l=Lt*-.5):(u=r-t,d=Qt(o,e,s),l=Lt*.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=Vt(e.font),r=i.lineHeight/2+this._padding.top,{titleX:a,titleY:o,maxWidth:l,rotation:c}=this._drawArgs(r);ln(t,e.text,0,0,i,{color:e.color,maxWidth:l,rotation:c,textAlign:ls(e.align),textBaseline:"middle",translation:[a,o]})}};function $0(n,t){let e=new Es({ctx:n.ctx,options:t,chart:n});ie.configure(n,e,t),ie.addBox(n,e),n.titleBlock=e}var z0={id:"title",_element:Es,start(n,t,e){$0(n,e)},stop(n){let t=n.titleBlock;ie.removeBox(n,t),delete n.titleBlock},beforeUpdate(n,t,e){let i=n.titleBlock;ie.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}},Ds=new WeakMap,B0={id:"subtitle",start(n,t,e){let i=new Es({ctx:n.ctx,options:e,chart:n});ie.configure(n,i,e),ie.addBox(n,i),Ds.set(n,i)},stop(n){ie.removeBox(n,Ds.get(n)),Ds.delete(n)},beforeUpdate(n,t,e){let i=Ds.get(n);ie.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}},zi={average(n){if(!n.length)return!1;let t,e,i=0,s=0,r=0;for(t=0,e=n.length;t<e;++t){let a=n[t].element;if(a&&a.hasValue()){let o=a.tooltipPosition();i+=o.x,s+=o.y,++r}}return{x:i/r,y:s/r}},nearest(n,t){if(!n.length)return!1;let e=t.x,i=t.y,s=Number.POSITIVE_INFINITY,r,a,o;for(r=0,a=n.length;r<a;++r){let l=n[r].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),u=as(t,c);u<s&&(s=u,o=l)}}if(o){let l=o.tooltipPosition();e=l.x,i=l.y}return{x:e,y:i}}};function Ie(n,t){return t&&(Et(t)?Array.prototype.push.apply(n,t):n.push(t)),n}function Xe(n){return(typeof n=="string"||n instanceof String)&&n.indexOf(`
`)>-1?n.split(`
`):n}function j0(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 lh(n,t){let e=n.chart.ctx,{body:i,footer:s,title:r}=n,{boxWidth:a,boxHeight:o}=t,l=Vt(t.bodyFont),c=Vt(t.titleFont),u=Vt(t.footerFont),d=r.length,m=s.length,p=i.length,b=te(t.padding),k=b.height,M=0,T=i.reduce((L,F)=>L+F.before.length+F.lines.length+F.after.length,0);if(T+=n.beforeBody.length+n.afterBody.length,d&&(k+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),T){let L=t.displayColors?Math.max(o,l.lineHeight):l.lineHeight;k+=p*L+(T-p)*l.lineHeight+(T-1)*t.bodySpacing}m&&(k+=t.footerMarginTop+m*u.lineHeight+(m-1)*t.footerSpacing);let R=0,$=function(L){M=Math.max(M,e.measureText(L).width+R)};return e.save(),e.font=c.string,Mt(n.title,$),e.font=l.string,Mt(n.beforeBody.concat(n.afterBody),$),R=t.displayColors?a+2+t.boxPadding:0,Mt(i,L=>{Mt(L.before,$),Mt(L.lines,$),Mt(L.after,$)}),R=0,e.font=u.string,Mt(n.footer,$),e.restore(),M+=b.width,{width:M,height:k}}function N0(n,t){let{y:e,height:i}=t;return e<i/2?"top":e>n.height-i/2?"bottom":"center"}function H0(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 V0(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"),H0(c,n,t,e)&&(c="center"),c}function ch(n,t,e){let i=e.yAlign||t.yAlign||N0(n,e);return{xAlign:e.xAlign||t.xAlign||V0(n,t,e,i),yAlign:i}}function W0(n,t){let{x:e,width:i}=n;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function Y0(n,t,e){let{y:i,height:s}=n;return t==="top"?i+=e:t==="bottom"?i-=s+e:i-=s/2,i}function hh(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:m,bottomRight:p}=cn(a),b=W0(t,o),k=Y0(t,l,c);return l==="center"?o==="left"?b+=c:o==="right"&&(b-=c):o==="left"?b-=Math.max(u,m)+s:o==="right"&&(b+=Math.max(d,p)+s),{x:Yt(b,0,i.width-t.width),y:Yt(k,0,i.height-t.height)}}function As(n,t,e){let i=te(e.padding);return t==="center"?n.x+n.width/2:t==="right"?n.x+n.width-i.right:n.x+i.left}function uh(n){return Ie([],Xe(n))}function G0(n,t,e){return Ge(n,{tooltip:t,tooltipItems:e,type:"tooltip"})}function fh(n,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?n.override(e):n}var Ls=class extends xe{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 aa(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=G0(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,Xe(s)),o=Ie(o,Xe(r)),o=Ie(o,Xe(a)),o}getBeforeBody(t,e){return uh(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){let{callbacks:i}=e,s=[];return Mt(t,r=>{let a={before:[],lines:[],after:[]},o=fh(i,r);Ie(a.before,Xe(o.beforeLabel.call(this,r))),Ie(a.lines,o.label.call(this,r)),Ie(a.after,Xe(o.afterLabel.call(this,r))),s.push(a)}),s}getAfterBody(t,e){return uh(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,Xe(s)),o=Ie(o,Xe(r)),o=Ie(o,Xe(a)),o}_createItems(t){let e=this._active,i=this.chart.data,s=[],r=[],a=[],o=[],l,c;for(l=0,c=e.length;l<c;++l)o.push(j0(this.chart,e[l]));return t.filter&&(o=o.filter((u,d,m)=>t.filter(u,d,m,i))),t.itemSort&&(o=o.sort((u,d)=>t.itemSort(u,d,i))),Mt(o,u=>{let d=fh(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=zi[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=lh(this,i),c=Object.assign({},o,l),u=ch(this.chart,i,c),d=hh(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}=cn(o),{x:m,y:p}=t,{width:b,height:k}=e,M,T,R,$,L,F;return r==="center"?(L=p+k/2,s==="left"?(M=m,T=M-a,$=L+a,F=L-a):(M=m+b,T=M+a,$=L-a,F=L+a),R=M):(s==="left"?T=m+Math.max(l,u)+a:s==="right"?T=m+b-Math.max(c,d)-a:T=this.caretX,r==="top"?($=p,L=$-a,M=T-a,R=T+a):($=p+k,L=$+a,M=T+a,R=T-a),F=$),{x1:M,x2:T,x3:R,y1:$,y2:L,y3:F}}drawTitle(t,e,i){let s=this.title,r=s.length,a,o,l;if(r){let c=Sn(i.rtl,this.x,this.width);for(t.x=As(this,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=Vt(i.titleFont),o=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;l<r;++l)e.fillText(s[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+o,l+1===r&&(t.y+=i.titleMarginBottom-o)}}_drawColorBox(t,e,i,s,r){let a=this.labelColors[i],o=this.labelPointStyles[i],{boxHeight:l,boxWidth:c,boxPadding:u}=r,d=Vt(r.bodyFont),m=As(this,"left",r),p=s.x(m),b=l<d.lineHeight?(d.lineHeight-l)/2:0,k=e.y+b;if(r.usePointStyle){let M={radius:Math.min(c,l)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},T=s.leftForLtr(p,c)+c/2,R=k+l/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,ps(t,M,T,R),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,ps(t,M,T,R)}else{t.lineWidth=ft(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;let M=s.leftForLtr(p,c-u),T=s.leftForLtr(s.xPlus(p,1),c-u-2),R=cn(a.borderRadius);Object.values(R).some($=>$!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,Gn(t,{x:M,y:k,w:c,h:l,radius:R}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Gn(t,{x:T,y:k+1,w:c-2,h:l-2,radius:R}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(M,k,c,l),t.strokeRect(M,k,c,l),t.fillStyle=a.backgroundColor,t.fillRect(T,k+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=Vt(i.bodyFont),m=d.lineHeight,p=0,b=Sn(i.rtl,this.x,this.width),k=function(G){e.fillText(G,b.x(t.x+p),t.y+m/2),t.y+=m+r},M=b.textAlign(a),T,R,$,L,F,z,H;for(e.textAlign=a,e.textBaseline="middle",e.font=d.string,t.x=As(this,M,i),e.fillStyle=i.bodyColor,Mt(this.beforeBody,k),p=o&&M!=="right"?a==="center"?c/2+u:c+2+u:0,L=0,z=s.length;L<z;++L){for(T=s[L],R=this.labelTextColors[L],e.fillStyle=R,Mt(T.before,k),$=T.lines,o&&$.length&&(this._drawColorBox(e,t,L,b,i),m=Math.max(d.lineHeight,l)),F=0,H=$.length;F<H;++F)k($[F]),m=d.lineHeight;Mt(T.after,k)}p=0,m=d.lineHeight,Mt(this.afterBody,k),t.y-=r}drawFooter(t,e,i){let s=this.footer,r=s.length,a,o;if(r){let l=Sn(i.rtl,this.x,this.width);for(t.x=As(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=Vt(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,o=0;o<r;++o)e.fillText(s[o],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){let{xAlign:r,yAlign:a}=this,{x:o,y:l}=t,{width:c,height:u}=i,{topLeft:d,topRight:m,bottomLeft:p,bottomRight:b}=cn(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(o+d,l),a==="top"&&this.drawCaret(t,e,i,s),e.lineTo(o+c-m,l),e.quadraticCurveTo(o+c,l,o+c,l+m),a==="center"&&r==="right"&&this.drawCaret(t,e,i,s),e.lineTo(o+c,l+u-b),e.quadraticCurveTo(o+c,l+u,o+c-b,l+u),a==="bottom"&&this.drawCaret(t,e,i,s),e.lineTo(o+p,l+u),e.quadraticCurveTo(o,l+u,o,l+u-p),a==="center"&&r==="left"&&this.drawCaret(t,e,i,s),e.lineTo(o,l+d),e.quadraticCurveTo(o,l,o+d,l),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){let e=this.chart,i=this.$animations,s=i&&i.x,r=i&&i.y;if(s||r){let a=zi[t.position].call(this,this._active,this._eventPosition);if(!a)return;let o=this._size=lh(this,t),l=Object.assign({},a,this._size),c=ch(e,t,l),u=hh(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=te(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),na(t,e.textDirection),r.y+=a.top,this.drawTitle(r,t,e),this.drawBody(r,t,e),this.drawFooter(r,t,e),ia(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=!ui(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||!ui(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=zi[r.position].call(this,t,e);return a!==!1&&(i!==a.x||s!==a.y)}};Ls.positioners=zi;var q0={id:"tooltip",_element:Ls,positioners:zi,afterInit(n,t,e){e&&(n.tooltip=new Ls({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:Ae,title(n){if(n.length>0){let t=n[0],e=t.chart.data.labels,i=e?e.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(i>0&&t.dataIndex<i)return e[t.dataIndex]}return""},afterTitle:Ae,beforeBody:Ae,beforeLabel:Ae,label(n){if(this&&this.options&&this.options.mode==="dataset")return n.label+": "+n.formattedValue||n.formattedValue;let t=n.dataset.label||"";t&&(t+=": ");let e=n.formattedValue;return bt(e)||(t+=e),t},labelColor(n){let e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(n){let e=n.chart.getDatasetMeta(n.datasetIndex).controller.getStyle(n.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Ae,afterBody:Ae,beforeFooter:Ae,footer:Ae,afterFooter:Ae}},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:n=>n!=="filter"&&n!=="itemSort"&&n!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},U0=Object.freeze({__proto__:null,Decimation:d0,Filler:L0,Legend:I0,SubTitle:B0,Title:z0,Tooltip:q0}),X0=(n,t,e,i)=>(typeof t=="string"?(e=n.push(t)-1,i.unshift({index:e,label:t})):isNaN(t)&&(e=null),e);function K0(n,t,e,i){let s=n.indexOf(t);if(s===-1)return X0(n,t,e,i);let r=n.lastIndexOf(t);return s!==r?e:s}var Z0=(n,t)=>n===null?null:Yt(Math.round(n),0,t),Bi=class extends fn{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(bt(t))return null;let i=this.getLabels();return e=isFinite(e)&&i[e]===t?e:K0(i,t,at(e,t),this._addedLabels),Z0(e,i.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:e}=this.getUserBounds(),{min:i,max:s}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){let t=this.min,e=this.max,i=this.options.offset,s=[],r=this.getLabels();r=t===0&&e===r.length-1?r:r.slice(t,e+1),this._valueRange=Math.max(r.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let a=t;a<=e;a++)s.push({value:a});return s}getLabelForValue(t){let e=this.getLabels();return t>=0&&t<e.length?e[t]:t}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}};Bi.id="category";Bi.defaults={ticks:{callback:Bi.prototype.getLabelForValue}};function J0(n,t){let e=[],i=1e-14,{bounds:s,step:r,min:a,max:o,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:m}=n,p=r||1,b=u-1,{min:k,max:M}=t,T=!bt(a),R=!bt(o),$=!bt(c),L=(M-k)/(d+1),F=Tr((M-k)/b/p)*p,z,H,G,q;if(F<i&&!T&&!R)return[{value:k},{value:M}];q=Math.ceil(M/F)-Math.floor(k/F),q>b&&(F=Tr(q*F/b/p)*p),bt(l)||(z=Math.pow(10,l),F=Math.ceil(F*z)/z),s==="ticks"?(H=Math.floor(k/F)*F,G=Math.ceil(M/F)*F):(H=k,G=M),T&&R&&r&&bl((o-a)/r,F/1e3)?(q=Math.round(Math.min((o-a)/F,u)),F=(o-a)/q,H=a,G=o):$?(H=T?a:H,G=R?o:G,q=c-1,F=(G-H)/q):(q=(G-H)/F,Nn(q,Math.round(q),F/1e3)?q=Math.round(q):q=Math.ceil(q));let et=Math.max(Or(F),Or(H));z=Math.pow(10,bt(l)?et:l),H=Math.round(H*z)/z,G=Math.round(G*z)/z;let ot=0;for(T&&(m&&H!==a?(e.push({value:a}),H<a&&ot++,Nn(Math.round((H+ot*F)*z)/z,a,dh(a,L,n))&&ot++):H<a&&ot++);ot<q;++ot)e.push({value:Math.round((H+ot*F)*z)/z});return R&&m&&G!==o?e.length&&Nn(e[e.length-1].value,o,dh(o,L,n))?e[e.length-1].value=o:e.push({value:o}):(!R||G===o)&&e.push({value:G}),e}function dh(n,t,{horizontal:e,minRotation:i}){let s=ve(i),r=(e?Math.sin(s):Math.cos(s))||.001,a=.75*t*(""+n).length;return Math.min(t/r,a)}var ji=class extends fn{constructor(t){super(t);this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return bt(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){let{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds(),{min:s,max:r}=this,a=l=>s=e?s:l,o=l=>r=i?r:l;if(t){let l=Ce(s),c=Ce(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=J0(s,r);return t.bounds==="ticks"&&Pr(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 Xn(t,this.chart.options.locale,this.options.ticks.format)}},Rs=class extends ji{determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=$t(t)?t:0,this.max=$t(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){let t=this.isHorizontal(),e=t?this.width:this.height,i=ve(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}};Rs.id="linear";Rs.defaults={ticks:{callback:ws.formatters.numeric}};function ph(n){return n/Math.pow(10,Math.floor(me(n)))===1}function Q0(n,t){let e=Math.floor(me(t.max)),i=Math.ceil(t.max/Math.pow(10,e)),s=[],r=pe(n.min,Math.pow(10,Math.floor(me(t.min)))),a=Math.floor(me(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:ph(r)}),++o,o===10&&(o=1,++a,l=a>=0?1:l),r=Math.round(o*Math.pow(10,a)*l)/l;while(a<e||a===e&&o<i);let c=pe(n.max,r);return s.push({value:c,major:ph(r)}),s}var Fs=class extends fn{constructor(t){super(t);this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){let i=ji.prototype.parse.apply(this,[t,e]);if(i===0){this._zero=!0;return}return $t(i)&&i>0?i:null}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!0);this.min=$t(t)?Math.max(0,t):null,this.max=$t(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(me(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=Q0(e,this);return t.bounds==="ticks"&&Pr(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":Xn(t,this.chart.options.locale,this.options.ticks.format)}configure(){let t=this.min;super.configure(),this._startValue=me(t),this._valueRange=me(this.max)-me(t)}getPixelForValue(t){return(t===void 0||t===0)&&(t=this.min),t===null||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(me(t)-this._startValue)/this._valueRange)}getValueForPixel(t){let e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}};Fs.id="logarithmic";Fs.defaults={ticks:{callback:ws.formatters.logarithmic,major:{enabled:!0}}};function Ca(n){let t=n.ticks;if(t.display&&n.display){let e=te(t.backdropPadding);return at(t.font&&t.font.size,dt.font.size)+e.height}return 0}function tv(n,t,e){return e=Et(e)?e:[e],{w:$l(n,t.string,e),h:e.length*t.lineHeight}}function gh(n,t,e,i,s){return n===i||n===s?{start:t-e/2,end:t+e/2}:n<i||n>s?{start:t-e,end:t}:{start:t,end:t+e}}function ev(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?Lt/r:0;for(let l=0;l<r;l++){let c=a.setContext(n.getPointLabelContext(l));s[l]=c.padding;let u=n.getPointPosition(l,n.drawingArea+s[l],o),d=Vt(c.font),m=tv(n.ctx,d,n._pointLabels[l]);i[l]=m;let p=oe(n.getIndexAngle(l)+o),b=Math.round(rs(p)),k=gh(b,u.x,m.w,0,180),M=gh(b,u.y,m.h,90,270);nv(e,t,p,k,M)}n.setCenterPoint(t.l-e.l,e.r-t.r,t.t-e.t,e.b-t.b),n._pointLabelItems=iv(n,i,s)}function nv(n,t,e,i,s){let r=Math.abs(Math.sin(e)),a=Math.abs(Math.cos(e)),o=0,l=0;i.start<t.l?(o=(t.l-i.start)/r,n.l=Math.min(n.l,t.l-o)):i.end>t.r&&(o=(i.end-t.r)/r,n.r=Math.max(n.r,t.r+o)),s.start<t.t?(l=(t.t-s.start)/a,n.t=Math.min(n.t,t.t-l)):s.end>t.b&&(l=(s.end-t.b)/a,n.b=Math.max(n.b,t.b+l))}function iv(n,t,e){let i=[],s=n._pointLabels.length,r=n.options,a=Ca(r)/2,o=n.drawingArea,l=r.pointLabels.centerPointLabels?Lt/s:0;for(let c=0;c<s;c++){let u=n.getPointPosition(c,o+a+e[c],l),d=Math.round(rs(oe(u.angle+Ft))),m=t[c],p=av(u.y,m.h,d),b=sv(d),k=rv(u.x,m.w,b);i.push({x:u.x,y:p,textAlign:b,left:k,top:p,right:k+m.w,bottom:p+m.h})}return i}function sv(n){return n===0||n===180?"center":n<180?"left":"right"}function rv(n,t,e){return e==="right"?n-=t:e==="center"&&(n-=t/2),n}function av(n,t,e){return e===90||e===270?n-=t/2:(e>270||e<90)&&(n-=t),n}function ov(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=Vt(r.font),{x:o,y:l,textAlign:c,left:u,top:d,right:m,bottom:p}=n._pointLabelItems[s],{backdropColor:b}=r;if(!bt(b)){let k=cn(r.borderRadius),M=te(r.backdropPadding);e.fillStyle=b;let T=u-M.left,R=d-M.top,$=m-u+M.width,L=p-d+M.height;Object.values(k).some(F=>F!==0)?(e.beginPath(),Gn(e,{x:T,y:R,w:$,h:L,radius:k}),e.fill()):e.fillRect(T,R,$,L)}ln(e,n._pointLabels[s],o,l+a.lineHeight/2,a,{color:r.color,textAlign:c,textBaseline:"middle"})}}function mh(n,t,e,i){let{ctx:s}=n;if(e)s.arc(n.xCenter,n.yCenter,t,0,Ot);else{let r=n.getPointPosition(0,t);s.moveTo(r.x,r.y);for(let a=1;a<i;a++)r=n.getPointPosition(a,t),s.lineTo(r.x,r.y)}}function lv(n,t,e,i){let s=n.ctx,r=t.circular,{color:a,lineWidth:o}=t;!r&&!i||!a||!o||e<0||(s.save(),s.strokeStyle=a,s.lineWidth=o,s.setLineDash(t.borderDash),s.lineDashOffset=t.borderDashOffset,s.beginPath(),mh(n,e,r,i),s.closePath(),s.stroke(),s.restore())}function cv(n,t,e){return Ge(n,{label:e,index:t,type:"pointLabel"})}var Zn=class extends ji{constructor(t){super(t);this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let t=this._padding=te(Ca(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){let{min:t,max:e}=this.getMinMax(!1);this.min=$t(t)&&!isNaN(t)?t:0,this.max=$t(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Ca(this.options))}generateTickLabels(t){ji.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map((e,i)=>{let s=Dt(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?ev(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=Ot/(this._pointLabels.length||1),i=this.options.startAngle||0;return oe(t*e+ve(i))}getDistanceFromCenterForValue(t){if(bt(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(bt(t))return NaN;let e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){let e=this._pointLabels||[];if(t>=0&&t<e.length){let i=e[t];return cv(this.getContext(),t,i)}}getPointPosition(t,e,i=0){let s=this.getIndexAngle(t)-Ft+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){let{left:e,top:i,right:s,bottom:r}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:r}}drawBackground(){let{backgroundColor:t,grid:{circular:e}}=this.options;if(t){let i=this.ctx;i.save(),i.beginPath(),mh(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){let t=this.ctx,e=this.options,{angleLines:i,grid:s}=e,r=this._pointLabels.length,a,o,l;if(e.pointLabels.display&&ov(this,r),s.display&&this.ticks.forEach((c,u)=>{if(u!==0){o=this.getDistanceFromCenterForValue(c.value);let d=s.setContext(this.getContext(u-1));lv(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=Vt(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=te(c.backdropPadding);t.fillRect(-a/2-d.left,-r-u.size/2-d.top,a+d.width,u.size+d.height)}ln(t,o.label,0,-r,u,{color:c.color})}),t.restore()}drawTitle(){}};Zn.id="radialLinear";Zn.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ws.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(n){return n},padding:5,centerPointLabels:!1}};Zn.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};Zn.descriptors={angleLines:{_fallback:"grid"}};var Is={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ce=Object.keys(Is);function hv(n,t){return n-t}function bh(n,t){if(bt(t))return null;let e=n._adapter,{parser:i,round:s,isoWeekday:r}=n._parseOpts,a=t;return typeof i=="function"&&(a=i(a)),$t(a)||(a=typeof i=="string"?e.parse(a,i):e.parse(a)),a===null?null:(s&&(a=s==="week"&&(xn(r)||r===!0)?e.startOf(a,"isoWeek",r):e.startOf(a,s)),+a)}function vh(n,t,e,i){let s=ce.length;for(let r=ce.indexOf(n);r<s-1;++r){let a=Is[ce[r]],o=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((e-t)/(o*a.size))<=i)return ce[r]}return ce[s-1]}function uv(n,t,e,i,s){for(let r=ce.length-1;r>=ce.indexOf(e);r--){let a=ce[r];if(Is[a].common&&n._adapter.diff(s,i,a)>=t-1)return a}return ce[e?ce.indexOf(e):0]}function fv(n){for(let t=ce.indexOf(n)+1,e=ce.length;t<e;++t)if(Is[ce[t]].common)return ce[t]}function _h(n,t,e){if(!e)n[t]=!0;else if(e.length){let{lo:i,hi:s}=os(e,t),r=e[i]>=t?e[i]:e[s];n[r]=!0}}function dv(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 yh(n,t,e){let i=[],s={},r=t.length,a,o;for(a=0;a<r;++a)o=t[a],s[o]=a,i.push({value:o,major:!1});return r===0||!e?i:dv(n,i,s,e)}var Jn=class extends fn{constructor(t){super(t);this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e){let i=t.time||(t.time={}),s=this._adapter=new ha._date(t.adapters.date);s.init(e),jn(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return t===void 0?null:bh(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,e=this._adapter,i=t.time.unit||"day",{min:s,max:r,minDefined:a,maxDefined:o}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(s=Math.min(s,c.min)),!o&&!isNaN(c.max)&&(r=Math.max(r,c.max))}(!a||!o)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),s=$t(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),r=$t(r)&&!isNaN(r)?r:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,r-1),this.max=Math.max(s+1,r)}_getLabelBounds(){let t=this.getLabelTimestamps(),e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){let t=this.options,e=t.time,i=t.ticks,s=i.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);let r=this.min,a=this.max,o=yl(s,r,a);return this._unit=e.unit||(i.autoSkip?vh(e.minUnit,this.min,this.max,this._getLabelCapacity(r)):uv(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=!i.major.enabled||this._unit==="year"?void 0:fv(this._unit),this.initOffsets(s),t.reverse&&o.reverse(),yh(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t){let e=0,i=0,s,r;this.options.offset&&t.length&&(s=this.getDecimalForValue(t[0]),t.length===1?e=1-s:e=(this.getDecimalForValue(t[1])-s)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?i=r:i=(r-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;e=Yt(e,0,a),i=Yt(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||vh(r.minUnit,e,i,this._getLabelCapacity(e)),o=at(r.stepSize,1),l=a==="week"?r.isoWeekday:!1,c=xn(l)||l===!0,u={},d=e,m,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(m=d,p=0;m<i;m=+t.add(m,o,a),p++)_h(u,m,b);return(m===i||s.bounds==="ticks"||p===1)&&_h(u,m,b),Object.keys(u).sort((k,M)=>k-M).map(k=>+k)}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],m=l&&u&&d&&d.major,p=this._adapter.format(t,s||(m?u:c)),b=r.ticks.callback;return b?Dt(b,[p,e,i],this):p}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){let e=this.options.ticks,i=this.ctx.measureText(t).width,s=ve(this.isHorizontal()?e.maxRotation:e.minRotation),r=Math.cos(s),a=Math.sin(s),o=this._resolveTickFontOptions(0).size;return{w:i*r+o*a,h:i*a+o*r}}_getLabelCapacity(t){let e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,r=this._tickFormatFunction(t,0,yh(this,[t],this._majorUnit),s),a=this._getLabelSize(r),o=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return o>0?o:1}getDataTimestamps(){let t=this._cache.data||[],e,i;if(t.length)return t;let s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(e=0,i=s.length;e<i;++e)t=t.concat(s[e].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],e,i;if(t.length)return t;let s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(bh(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return Ar(t.sort(hv))}};Jn.id="time";Jn.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};function $s(n,t,e){let i=0,s=n.length-1,r,a,o,l;e?(t>=n[i].pos&&t<=n[s].pos&&({lo:i,hi:s}=Re(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}=Re(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 zs=class extends Jn{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=$s(e,this.min),this._tableRange=$s(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){let{min:e,max:i}=this,s=[],r=[],a,o,l,c,u;for(a=0,o=t.length;a<o;++a)c=t[a],c>=e&&c<=i&&s.push(c);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(a=0,o=s.length;a<o;++a)u=s[a+1],l=s[a-1],c=s[a],Math.round((u+l)/2)!==c&&r.push({time:c,pos:a/(o-1)});return r}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;let e=this.getDataTimestamps(),i=this.getLabelTimestamps();return e.length&&i.length?t=this.normalize(e.concat(i)):t=e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return($s(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){let e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return $s(this._table,i*this._tableRange+this._minPos,!0)}};zs.id="timeseries";zs.defaults=Jn.defaults;var pv=Object.freeze({__proto__:null,CategoryScale:Bi,LinearScale:Rs,LogarithmicScale:Fs,RadialLinearScale:Zn,TimeScale:Jn,TimeSeriesScale:zs}),xh=[ib,c0,U0,pv];var Te=De(require("obsidian"));var gv={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};ha._date.override(typeof Te.moment=="function"?{_id:"moment",formats:function(){return gv},parse:function(n,t){return typeof n=="string"&&typeof t=="string"?n=(0,Te.moment)(n,t):n instanceof Te.moment||(n=(0,Te.moment)(n)),n.isValid()?n.valueOf():null},format:function(n,t){return(0,Te.moment)(n).format(t)},add:function(n,t,e){return(0,Te.moment)(n).add(t,e).valueOf()},diff:function(n,t,e){return(0,Te.moment)(n).diff((0,Te.moment)(t),e)},startOf:function(n,t,e){return n=(0,Te.moment)(n),t==="isoWeek"?(e=Math.trunc(Math.min(Math.max(0,e),6)),n.isoWeekday(e).startOf("day").valueOf()):n.startOf(t).valueOf()},endOf:function(n,t){return(0,Te.moment)(n).endOf(t).valueOf()}}:{});var js=De(require("obsidian"));var kh=De(wh());function Ke(n,t=.25){if(typeof t!="number")throw"Provided alpha value is not a number";return n.map(e=>(0,kh.default)(e.trim()).alpha(t).hex())}function Ze(n,t){var i,s;let e=t.createDiv({cls:"chart-error"});e.createEl("b",{text:"Couldn't render Chart:"}),e.createEl("pre").createEl("code",{text:(s=(i=n.toString)==null?void 0:i.call(n))!=null?s:n}),e.createEl("hr"),e.createEl("span").innerHTML="You might also want to look for further Errors in the Console: Press <kbd>CTRL</kbd> + <kbd>SHIFT</kbd> + <kbd>I</kbd> to open it."}function mv(n){for(var t=window.atob(n),e=t.length,i=new Uint8Array(e),s=0;s<e;s++)i[s]=t.charCodeAt(s);return i.buffer}async function Sh(n,t,e,i,s){let r=await e.imageRenderer(n.getSelection(),s.imageSettings);console.log("image converted");let a=await t.vault.createBinary(await t.vault.getAvailablePathForAttachments(`Chart ${new Date().toDateString()}`,s.imageSettings.format.split("/").last(),i),mv(r));console.log("Image saved"),n.replaceSelection(t.fileManager.generateMarkdownLink(a,i.path))}var Ph=De(require("obsidian")),Oh=De(Th());async function Ea(n,t){let{labels:e,dataFields:i}=Da(n.getSelection(),t),s=`\`\`\`chart
type: bar
labels: [${e}]
series:
${i.map(r=>` - title: ${r.dataTitle}
data: [${r.data}]`).join(`
`)}
width: 80%
beginAtZero: true
\`\`\``;n.replaceSelection(s)}function Da(n,t,e){let i;try{i=Oh.Extractor.extractObject(n,t,!1)}catch(a){throw new Ph.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}}le.register(...xh);var Ns=class{constructor(t){this.plugin=t}async datasetPrep(t,e,i=!1){var c,u,d,m;let s=[];if(!t.id){let p=[];if(this.plugin.settings.themeable||i){let b=1;for(;;){let k=getComputedStyle(e).getPropertyValue(`--chart-color-${b}`);if(k)p.push(k),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?Ke(p,t.transparency):Ke(this.plugin.settings.colors,t.transparency):p.length?Ke(p,t.transparency)[b]:Ke(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 le.defaults.color=getComputedStyle(e).getPropertyValue("--text-muted"),le.defaults.font.family=getComputedStyle(e).getPropertyValue("--mermaid-font"),le.defaults.plugins=hi(ci({},le.defaults.plugins),{legend:hi(ci({},le.defaults.plugins.legend),{display:(d=t.legend)!=null?d:!0,position:(m=t.legendPosition)!=null?m:"top"})}),le.defaults.layout.padding=t.padding,t.type=="radar"||t.type=="polarArea"?l={type:t.type,data:{labels:a,datasets:s},options:{scales:{r:hi(ci({},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:{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:hi(ci({},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:{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,js.parseYaml)(t.replace("```chart","").replace("```","").replace(/\t/g," ")),document.body);new le(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 le(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 Ze(r,e),null}else try{return new le(i.getContext("2d"),t)}catch(r){return Ze(r,e),null}}async renderFromYaml(t,e,i){this.plugin.app.workspace.onLayoutReady(()=>i.addChild(new Eh(t,e,this,i.sourcePath)))}},Eh=class extends js.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 m=1;for(;;){let p=getComputedStyle(this.el).getPropertyValue(`--chart-color-${m}`);if(p)o.push(p),m++;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(m=>m.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=Da(u,(e=this.data.layout)!=null?e:"columns",this.data.select)}catch(m){throw"There is no table at that id and/or file"}a.labels=d.labels;for(let m=0;d.dataFields.length>m;m++)a.datasets.push({label:(i=d.dataFields[m].dataTitle)!=null?i:"",data:d.dataFields[m].data,backgroundColor:this.data.labelColors?o.length?Ke(o,this.data.transparency):Ke(this.renderer.plugin.settings.colors,this.data.transparency):o.length?Ke(o,this.data.transparency)[m]:Ke(this.renderer.plugin.settings.colors,this.data.transparency)[m],borderColor:this.data.labelColors?o.length?o:this.renderer.plugin.settings.colors:o.length?o[m]:this.renderer.plugin.settings.colors[m],borderWidth:1,fill:this.data.fill?this.data.stacked?m==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){Ze(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 Hs={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 ze=De(require("obsidian"));var Aa=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")},La=function(){function n(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}}(),Vs=function(){function n(t,e){var i=[],s=!0,r=!1,a=void 0;try{for(var o=t[Symbol.iterator](),l;!(s=(l=o.next()).done)&&(i.push(l.value),!(e&&i.length===e));s=!0);}catch(c){r=!0,a=c}finally{try{!s&&o.return&&o.return()}finally{if(r)throw a}}return i}return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return n(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();String.prototype.startsWith=String.prototype.startsWith||function(n){return this.indexOf(n)===0};String.prototype.padStart=String.prototype.padStart||function(n,t){for(var e=this;e.length<n;)e=t+e;return e};var _v={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function Dh(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,e=t>0?n.toFixed(t).replace(/0+$/,"").replace(/\.$/,""):n.toString();return e||"0"}var yv=function(){function n(t,e,i,s){Aa(this,n);var r=this;function a(l){if(l.startsWith("hsl")){var c=l.match(/([\-\d\.e]+)/g).map(Number),u=Vs(c,4),d=u[0],m=u[1],p=u[2],b=u[3];b===void 0&&(b=1),d/=360,m/=100,p/=100,r.hsla=[d,m,p,b]}else if(l.startsWith("rgb")){var k=l.match(/([\-\d\.e]+)/g).map(Number),M=Vs(k,4),T=M[0],R=M[1],$=M[2],L=M[3];L===void 0&&(L=1),r.rgba=[T,R,$,L]}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 La(n,[{key:"printRGB",value:function(e){var i=e?this.rgba:this.rgba.slice(0,3),s=i.map(function(r,a){return Dh(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 Dh(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=_v[i];return s===void 0?s:n.hexToRgb(s.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(e){var i=Vs(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,m=(l+c)/2;if(l===c)u=d=0;else{var p=l-c;switch(d=m>.5?p/(2-l-c):p/(l+c),l){case s:u=(r-a)/p+(r<a?6:0);break;case r:u=(a-s)/p+2;break;case a:u=(s-r)/p+4;break}u/=6}return[u,d,m,o]}},{key:"hslToRgb",value:function(e){var i=Vs(e,4),s=i[0],r=i[1],a=i[2],o=i[3],l=void 0,c=void 0,u=void 0;if(r===0)l=c=u=a;else{var d=function(M,T,R){return R<0&&(R+=1),R>1&&(R-=1),R<1/6?M+(T-M)*6*R:R<1/2?T:R<2/3?M+(T-M)*(2/3-R)*6:M},m=a<.5?a*(1+r):a+r-a*r,p=2*a-m;l=d(p,m,s+1/3),c=d(p,m,s),u=d(p,m,s-1/3)}var b=[l*255,c*255,u*255].map(Math.round);return b[3]=o,b}}]),n}(),xv=function(){function n(){Aa(this,n),this._events=[]}return La(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 wv(n){var t=document.createElement("div");return t.innerHTML=n,t.firstElementChild}function Ra(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(),m=d.width,p=d.height,b=c.clientX,k=c.clientY,M=s(b-d.left,0,m),T=s(k-d.top,0,p);e(M/m,T/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 kv=`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`,Sv=360,Ah="keydown",Ws="mousedown",Fa="focusin";function $e(n,t){return(t||document).querySelector(n)}function Lh(n){n.preventDefault(),n.stopPropagation()}function Ia(n,t,e,i,s){n.add(t,Ah,function(r){e.indexOf(r.key)>=0&&(s&&Lh(r),i(r))})}var $a=function(){function n(t){Aa(this,n),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new xv,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(t)}return La(n,[{key:"setOptions",value:function(e){var i=this;if(!e)return;var s=this.settings;function r(c,u,d){for(var m in c)d&&d.indexOf(m)>=0||(u[m]=c[m])}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),Ia(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===Ah?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===Ws||i===Fa){var r=(this.__containedEvent||0)+100;e.timeStamp>r&&(s=!0)}else Lh(e),s=!0;s&&this.hide()&&(this.settings.parent.style.pointerEvents="",i!==Ws&&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 yv(e)}catch(a){if(i.failSilently)return;throw a}if(!this.settings.alpha){var r=s.hsla;r[3]=1,s.hsla=r}this.colour=this.color=s,this._setHSLA(null,null,null,null,i)}}},{key:"setColour",value:function(e,i){this.setColor(e,i)}},{key:"show",value:function(){var e=this.settings.parent;if(!e)return!1;if(this.domElement){var i=this._toggleDOM(!0);return this._setPosition(),i}var s=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',r=wv(s);return this.domElement=r,this._domH=$e(".picker_hue",r),this._domSL=$e(".picker_sl",r),this._domA=$e(".picker_alpha",r),this._domEdit=$e(".picker_editor input",r),this._domSample=$e(".picker_sample",r),this._domOkay=$e(".picker_done button",r),this._domCancel=$e(".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()}),Ra(r,this._domH,function(c,u){return i._setHSLA(c)}),Ra(r,this._domSL,function(c,u){return i._setHSLA(null,c,1-u)}),this.settings.alpha&&Ra(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(m){return e.closeHandler(m)};a(window,Ws,c),a(window,Fa,c),Ia(r,s,["Esc","Escape"],c);var u=function(m){e.__containedEvent=m.timeStamp};a(s,Ws,u),a(s,Fa,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),Ia(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]*Sv+", 100%, 50%)",a=i.hslString,o=i.hslaString,l=this._domH,c=this._domSL,u=this._domA,d=$e(".picker_selector",l),m=$e(".picker_selector",c),p=$e(".picker_selector",u);function b(z,H,G){H.style.left=G*100+"%"}function k(z,H,G){H.style.top=G*100+"%"}b(l,d,s[0]),this._domSL.style.backgroundColor=this._domH.style.color=r,b(c,m,s[1]),k(c,m,1-s[2]),c.style.color=a,k(u,p,1-s[3]);var M=a,T=M.replace("hsl","hsla").replace(")",", 0)"),R="linear-gradient("+[M,T]+")";if(this._domA.style.background=R+", "+kv,!e.fromEditor){var $=this.settings.editorFormat,L=this.settings.alpha,F=void 0;switch($){case"rgb":F=i.printRGB(L);break;case"hsl":F=i.printHSL(L);break;default:F=i.printHex(L)}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}();Ys=document.createElement("style"),Ys.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(Ys),$a.StyleElement=Ys;var Ys;var za=class extends ze.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 ze.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 ze.Setting(t).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development:").addButton(r=>{r.buttonEl.outerHTML='<a href="https://ko-fi.com/phibr0"><img src="https://uploads-ssl.webflow.com/5c14e387dab576fe667689cf/61e11e22d8ff4a5b4a1b3346_Supportbutton-1.png"></a>'}),t.createEl("h3",{text:"Colors",attr:{style:"margin-bottom: 0"}});let i=t.createEl("p",{cls:"setting-item-description"});i.append("Set the Colors for your Charts. This will set the border Color and the inner Color will be the same, but with less opacity. This ensures better compatibility with Dark and Light Mode. ","You can use any ",i.createEl("a",{href:"https://www.w3schools.com/cssref/css_colors.asp",text:"valid CSS Color."})),new ze.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 ze.Setting(t).setName(o).setDesc("This will be the border Color used in the Charts you create.").addButton(l=>{l.setButtonText("Change Color"),new $a({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=Hs.colors[a])!=null?c:"#ffffff",await this.plugin.saveSettings(),this.display()})})}),new ze.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 ze.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 ze.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 Kh=De(require("obsidian"));function ti(){}function Ba(n){return n()}function Rh(){return Object.create(null)}function gn(n){n.forEach(Ba)}function Fh(n){return typeof n=="function"}function Ih(n,t){return n!=n?t==t:n!==t||n&&typeof n=="object"||typeof n=="function"}function $h(n){return Object.keys(n).length===0}var x_=new Set;var zh=!1;function Mv(){zh=!0}function Cv(){zh=!1}function Y(n,t){n.appendChild(t)}function Bh(n,t,e){let i=Tv(n);if(!i.getElementById(t)){let s=tt("style");s.id=t,s.textContent=e,Pv(i,s)}}function Tv(n){if(!n)return document;let t=n.getRootNode?n.getRootNode():n.ownerDocument;return t&&t.host?t:n.ownerDocument}function Pv(n,t){Y(n.head||n,t)}function Ni(n,t,e){n.insertBefore(t,e||null)}function ei(n){n.parentNode.removeChild(n)}function jh(n,t){for(let e=0;e<n.length;e+=1)n[e]&&n[e].d(t)}function tt(n){return document.createElement(n)}function Ov(n){return document.createTextNode(n)}function Gt(){return Ov(" ")}function he(n,t,e,i){return n.addEventListener(t,e,i),()=>n.removeEventListener(t,e,i)}function it(n,t,e){e==null?n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}function ja(n){return n===""?null:+n}function Ev(n){return Array.from(n.childNodes)}function Pe(n,t){n.value=t??""}function ue(n,t,e,i){e===null?n.style.removeProperty(t):n.style.setProperty(t,e,i?"important":"")}function Na(n,t){for(let e=0;e<n.options.length;e+=1){let i=n.options[e];if(i.__value===t){i.selected=!0;return}}n.selectedIndex=-1}function Nh(n){let t=n.querySelector(":checked")||n.options[0];return t&&t.__value}function Dv(n,t,{bubbles:e=!1,cancelable:i=!1}={}){let s=document.createEvent("CustomEvent");return s.initCustomEvent(n,e,i,t),s}var w_=new Map;var Hi;function Vi(n){Hi=n}function Av(){if(!Hi)throw new Error("Function called outside component initialization");return Hi}function Ha(){let n=Av();return(t,e,{cancelable:i=!1}={})=>{let s=n.$$.callbacks[t];if(s){let r=Dv(t,e,{cancelable:i});return s.slice().forEach(a=>{a.call(n,r)}),!r.defaultPrevented}return!0}}var Wi=[];var Gs=[],qs=[],Hh=[],Lv=Promise.resolve(),Va=!1;function Rv(){Va||(Va=!0,Lv.then(Vh))}function Yi(n){qs.push(n)}var Wa=new Set,Us=0;function Vh(){let n=Hi;do{for(;Us<Wi.length;){let t=Wi[Us];Us++,Vi(t),Fv(t.$$)}for(Vi(null),Wi.length=0,Us=0;Gs.length;)Gs.pop()();for(let t=0;t<qs.length;t+=1){let e=qs[t];Wa.has(e)||(Wa.add(e),e())}qs.length=0}while(Wi.length);for(;Hh.length;)Hh.pop()();Va=!1,Wa.clear(),Vi(n)}function Fv(n){if(n.fragment!==null){n.update(),gn(n.before_update);let t=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,t),n.after_update.forEach(Yi)}}var Iv=new Set;function $v(n,t){n&&n.i&&(Iv.delete(n),n.i(t))}var k_=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var S_=new Set(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]);function zv(n,t,e,i){let{fragment:s,on_mount:r,on_destroy:a,after_update:o}=n.$$;s&&s.m(t,e),i||Yi(()=>{let l=r.map(Ba).filter(Fh);a?a.push(...l):gn(l),n.$$.on_mount=[]}),o.forEach(Yi)}function Wh(n,t){let e=n.$$;e.fragment!==null&&(gn(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Bv(n,t){n.$$.dirty[0]===-1&&(Wi.push(n),Rv(),n.$$.dirty.fill(0)),n.$$.dirty[t/31|0]|=1<<t%31}function Yh(n,t,e,i,s,r,a,o=[-1]){let l=Hi;Vi(n);let c=n.$$={fragment:null,ctx:null,props:r,update:ti,not_equal:s,bound:Rh(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:Rh(),dirty:o,skip_bound:!1,root:t.target||l.$$.root};a&&a(c.root);let u=!1;if(c.ctx=e?e(n,t.props||{},(d,m,...p)=>{let b=p.length?p[0]:m;return c.ctx&&s(c.ctx[d],c.ctx[d]=b)&&(!c.skip_bound&&c.bound[d]&&c.bound[d](b),u&&Bv(n,d)),m}):[],c.update(),u=!0,gn(c.before_update),c.fragment=i?i(c.ctx):!1,t.target){if(t.hydrate){Mv();let d=Ev(t.target);c.fragment&&c.fragment.l(d),d.forEach(ei)}else c.fragment&&c.fragment.c();t.intro&&$v(n.$$.fragment),zv(n,t.target,t.anchor,t.customElement),Cv(),Vh()}Vi(l)}var jv;typeof HTMLElement=="function"&&(jv=class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"})}connectedCallback(){let{on_mount:n}=this.$$;this.$$.on_disconnect=n.map(Ba).filter(Fh);for(let t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(n,t,e){this[n]=e}disconnectedCallback(){gn(this.$$.on_disconnect)}$destroy(){Wh(this,1),this.$destroy=ti}$on(n,t){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&&!$h(n)&&(this.$$.skip_bound=!0,this.$$set(n),this.$$.skip_bound=!1)}});var Ya=class{$destroy(){Wh(this,1),this.$destroy=ti}$on(t,e){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&&!$h(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}};var Xs=De(require("obsidian"));function Nv(n){Bh(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 Gh(n,t,e){let i=n.slice();return i[27]=t[e],i[28]=t,i[29]=e,i}function qh(n){let t,e,i,s,r,a,o,l,c,u,d;function m(){n[20].call(r,n[28],n[29])}function p(){n[21].call(c,n[28],n[29])}return{c(){t=tt("tr"),e=tt("td"),e.innerHTML=`<p class="mainDesc svelte-1tlkntj">Y Axis</p>
<p class="subDesc svelte-1tlkntj">Set Data Fields (Comma seperated)</p>`,i=Gt(),s=tt("td"),r=tt("input"),a=Gt(),o=tt("br"),l=Gt(),c=tt("input"),it(e,"class","desc svelte-1tlkntj"),it(r,"type","text"),it(r,"placeholder","Name"),it(c,"type","text"),it(c,"placeholder","1, -2, 11, 5"),ue(c,"margin-top","3px"),it(s,"class","controlElement svelte-1tlkntj")},m(b,k){Ni(b,t,k),Y(t,e),Y(t,i),Y(t,s),Y(s,r),Pe(r,n[27].dataTitle),Y(s,a),Y(s,o),Y(s,l),Y(s,c),Pe(c,n[27].data),u||(d=[he(r,"input",m),he(c,"input",p)],u=!0)},p(b,k){n=b,k&128&&r.value!==n[27].dataTitle&&Pe(r,n[27].dataTitle),k&128&&c.value!==n[27].data&&Pe(c,n[27].data)},d(b){b&&ei(t),u=!1,gn(d)}}}function Hv(n){let t,e,i,s,r,a,o,l,c,u,d,m,p,b,k,M,T,R,$,L,F,z,H,G,q,et,ot,st,wt,rt,U,_t,Ct,se,we,It,Wt,jt,Nt,qt,w,v,y,D,P,O,K,V,Z,Q,vt,Rt,Tt,zt,Bt,re,be,fe,mn,Ee,Be,ni,ii,Tn,je,bn,Pn,si,Je=n[7],ee=[];for(let yt=0;yt<Je.length;yt+=1)ee[yt]=qh(Gh(n,Je,yt));return{c(){t=tt("div"),e=tt("h3"),e.textContent="Create a new Chart",i=Gt(),s=tt("div"),r=tt("div"),a=tt("table"),o=tt("tr"),l=tt("td"),l.innerHTML=`<p class="mainDesc svelte-1tlkntj">Chart Type</p>
<p class="subDesc svelte-1tlkntj">Choose a Chart Type</p>`,c=tt("td"),u=tt("select"),d=tt("option"),d.textContent="Bar",m=tt("option"),m.textContent="Line",p=tt("option"),p.textContent="Pie",b=tt("option"),b.textContent="Doughnut",k=tt("option"),k.textContent="Radar",M=tt("option"),M.textContent="Polar Area",T=Gt(),R=tt("tr"),$=tt("td"),$.innerHTML=`<p class="mainDesc svelte-1tlkntj">Smoothness</p>
<p class="subDesc svelte-1tlkntj">Changes the smoothness of the Chart</p>`,L=tt("td"),F=tt("input"),z=Gt(),H=tt("tr"),G=tt("td"),G.innerHTML=`<p class="mainDesc svelte-1tlkntj">Width</p>
<p class="subDesc svelte-1tlkntj">Changes the horizontal width</p>`,q=tt("td"),et=tt("input"),ot=Gt(),st=tt("tr"),wt=tt("td"),wt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Fill</p>
<p class="subDesc svelte-1tlkntj">Fill the underside of the Chart</p>`,rt=tt("td"),U=tt("input"),_t=Gt(),Ct=tt("tr"),se=tt("td"),se.innerHTML=`<p class="mainDesc svelte-1tlkntj">Distinct Colors</p>
<p class="subDesc svelte-1tlkntj">Use distinct Colors for each Label</p>`,we=tt("td"),It=tt("input"),Wt=Gt(),jt=tt("tr"),Nt=tt("td"),Nt.innerHTML=`<p class="mainDesc svelte-1tlkntj">Start at Zero</p>
<p class="subDesc svelte-1tlkntj">Don&#39;t cut the graph at the bottom</p>`,qt=tt("td"),w=tt("input"),v=Gt(),y=tt("hr"),D=Gt(),P=tt("table"),O=tt("tr"),K=tt("td"),K.innerHTML=`<p class="mainDesc svelte-1tlkntj">X Axis</p>
<p class="subDesc svelte-1tlkntj">Set Labels (Comma seperated)</p>`,V=Gt(),Z=tt("td"),Q=tt("input"),vt=tt("br"),Rt=Gt(),Tt=tt("hr"),zt=Gt(),Bt=tt("table");for(let yt=0;yt<ee.length;yt+=1)ee[yt].c();re=Gt(),be=tt("div"),fe=tt("button"),fe.textContent="Add more",mn=Gt(),Ee=tt("div"),Be=tt("div"),ni=Gt(),ii=tt("hr"),Tn=Gt(),je=tt("div"),bn=tt("button"),bn.textContent="Insert Chart",it(l,"class","desc svelte-1tlkntj"),d.__value="bar",d.value=d.__value,m.__value="line",m.value=m.__value,p.__value="pie",p.value=p.__value,b.__value="doughnut",b.value=b.__value,k.__value="radar",k.value=k.__value,M.__value="polarArea",M.value=M.__value,it(u,"name","Chart Types"),it(u,"id","chart-types"),it(u,"class","dropdown"),n[0]===void 0&&Yi(()=>n[13].call(u)),it(c,"class","controlElement svelte-1tlkntj"),it($,"class","desc svelte-1tlkntj"),it(F,"type","range"),it(F,"min","0"),it(F,"max","100"),it(F,"class","slider"),it(L,"class","controlElement svelte-1tlkntj"),it(G,"class","desc svelte-1tlkntj"),it(et,"type","range"),it(et,"min","20"),it(et,"max","100"),it(et,"class","slider"),it(q,"class","controlElement svelte-1tlkntj"),it(wt,"class","desc svelte-1tlkntj"),it(U,"type","checkbox"),it(U,"class","task-list-item-checkbox"),ue(U,"width","16px"),ue(U,"height","16px"),it(rt,"class","controlElement svelte-1tlkntj"),it(se,"class","desc svelte-1tlkntj"),it(It,"type","checkbox"),it(It,"class","task-list-item-checkbox"),ue(It,"width","16px"),ue(It,"height","16px"),it(we,"class","controlElement svelte-1tlkntj"),it(Nt,"class","desc svelte-1tlkntj"),it(w,"type","checkbox"),it(w,"class","task-list-item-checkbox"),ue(w,"width","16px"),ue(w,"height","16px"),it(qt,"class","controlElement svelte-1tlkntj"),ue(a,"width","100%"),it(a,"class","svelte-1tlkntj"),it(K,"class","desc svelte-1tlkntj"),it(Q,"type","text"),it(Q,"placeholder","Monday, Tuesday, ..."),it(Z,"class","controlElement svelte-1tlkntj"),ue(P,"width","100%"),it(P,"class","svelte-1tlkntj"),it(be,"class","addMoreButtonContainer svelte-1tlkntj"),ue(Bt,"width","100%"),it(Bt,"class","svelte-1tlkntj"),it(Be,"id","preview"),it(Ee,"class","chartPreview svelte-1tlkntj"),it(s,"class","modalColumn svelte-1tlkntj"),it(t,"class","chart-modal svelte-1tlkntj"),it(bn,"class","mod-cta"),ue(je,"display","flex"),ue(je,"justify-content","center"),ue(je,"align-items","center")},m(yt,ne){Ni(yt,t,ne),Y(t,e),Y(t,i),Y(t,s),Y(s,r),Y(r,a),Y(a,o),Y(o,l),Y(o,c),Y(c,u),Y(u,d),Y(u,m),Y(u,p),Y(u,b),Y(u,k),Y(u,M),Na(u,n[0]),Y(a,T),Y(a,R),Y(R,$),Y(R,L),Y(L,F),Pe(F,n[1]),Y(a,z),Y(a,H),Y(H,G),Y(H,q),Y(q,et),Pe(et,n[2]),Y(a,ot),Y(a,st),Y(st,wt),Y(st,rt),Y(rt,U),U.checked=n[3],Y(a,_t),Y(a,Ct),Y(Ct,se),Y(Ct,we),Y(we,It),It.checked=n[4],Y(a,Wt),Y(a,jt),Y(jt,Nt),Y(jt,qt),Y(qt,w),w.checked=n[5],Y(r,v),Y(r,y),Y(r,D),Y(r,P),Y(P,O),Y(O,K),Y(O,V),Y(O,Z),Y(Z,Q),Pe(Q,n[6]),Y(Z,vt),Y(r,Rt),Y(r,Tt),Y(r,zt),Y(r,Bt);for(let Ut=0;Ut<ee.length;Ut+=1)ee[Ut].m(Bt,null);Y(Bt,re),Y(Bt,be),Y(be,fe),Y(s,mn),Y(s,Ee),Y(Ee,Be),n[23](Be),Y(t,ni),Y(t,ii),Ni(yt,Tn,ne),Ni(yt,je,ne),Y(je,bn),Pn||(si=[he(u,"change",n[13]),he(F,"change",n[14]),he(F,"input",n[14]),he(et,"change",n[15]),he(et,"input",n[15]),he(U,"change",n[16]),he(It,"change",n[17]),he(w,"change",n[18]),he(Q,"input",n[19]),he(fe,"click",n[22]),he(bn,"click",n[9])],Pn=!0)},p(yt,[ne]){if(ne&1&&Na(u,yt[0]),ne&2&&Pe(F,yt[1]),ne&4&&Pe(et,yt[2]),ne&8&&(U.checked=yt[3]),ne&16&&(It.checked=yt[4]),ne&32&&(w.checked=yt[5]),ne&64&&Q.value!==yt[6]&&Pe(Q,yt[6]),ne&128){Je=yt[7];let Ut;for(Ut=0;Ut<Je.length;Ut+=1){let Gi=Gh(yt,Je,Ut);ee[Ut]?ee[Ut].p(Gi,ne):(ee[Ut]=qh(Gi),ee[Ut].c(),ee[Ut].m(Bt,re))}for(;Ut<ee.length;Ut+=1)ee[Ut].d(1);ee.length=Je.length}},i:ti,o:ti,d(yt){yt&&ei(t),jh(ee,yt),n[23](null),yt&&ei(Tn),yt&&ei(je),Pn=!1,gn(si)}}}function Vv(n,t,e){let{editor:i}=t,{renderer:s}=t,r=Ha(),a="bar",o=null,l=20,c=80,u=!1,d=!1,m=!1,p="",b=[{dataTitle:"",data:""}],k,M=null,T=(0,Xs.debounce)(async(rt,U)=>{var _t;o&&o.destroy(),(_t=M.lastElementChild)===null||_t===void 0||_t.remove(),o=s.renderRaw(await s.datasetPrep((0,Xs.parseYaml)(rt),U),U)},500,!0);function R(){let rt=i.getDoc(),U=rt.getCursor();o.destroy(),rt.replaceRange("```chart\n"+k+"\n```",U),r("close")}function $(){a=Nh(this),e(0,a)}function L(){l=ja(this.value),e(1,l)}function F(){c=ja(this.value),e(2,c)}function z(){u=this.checked,e(3,u)}function H(){d=this.checked,e(4,d)}function G(){m=this.checked,e(5,m)}function q(){p=this.value,e(6,p)}function et(rt,U){rt[U].dataTitle=this.value,e(7,b)}function ot(rt,U){rt[U].data=this.value,e(7,b)}let st=()=>e(7,b=[...b,{data:"",dataTitle:""}]);function wt(rt){Gs[rt?"unshift":"push"](()=>{M=rt,e(8,M)})}return n.$$set=rt=>{"editor"in rt&&e(10,i=rt.editor),"renderer"in rt&&e(11,s=rt.renderer)},n.$$.update=()=>{if(n.$$.dirty&255){t:e(12,k=`type: ${a}
labels: [${p}]
series:
${b.map(rt=>` - title: ${rt.dataTitle}
data: [${rt.data}]`).join(`
`)}
tension: ${l/100}
width: ${c}%
labelColors: ${d}
fill: ${u}
beginAtZero: ${m}`)}if(n.$$.dirty&4352){t:if(M)try{T(k,M)}catch(rt){Ze(rt,M)}}},[a,l,c,u,d,m,p,b,M,R,i,s,k,$,L,F,z,H,G,q,et,ot,st,wt]}var Uh=class extends Ya{constructor(t){super();Yh(this,t,Vv,Hv,Ih,{editor:10,renderer:11},Nv)}},Xh=Uh;var Ks=class extends Kh.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 Xh({target:t,props:{editor:e.editor,renderer:s}}).$on("close",()=>this.close())}onClose(){let{contentEl:t}=this;t.empty()}};var Zh=De(require("obsidian")),Jh={chart:'<svg xmlns="http://www.w3.org/2000/svg" fill-opacity="0.0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-pie-chart"><path d="M21.21 15.89A10 10 0 1 1 8 2.83"></path><path d="M22 12A10 10 0 0 0 12 2v10z"></path></svg>'},Qh=()=>{Object.keys(Jh).forEach(n=>{(0,Zh.addIcon)(n,Jh[n])})};var Ga=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(r){Ze(r,e);return}if(!s.id&&(!s||!s.type||!s.labels||!s.series)){Ze("Missing type, labels or series",e);return}await this.renderer.renderFromYaml(s,e,i)}}async loadSettings(){this.settings=Object.assign({},Hs,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}async onload(){console.log("loading plugin: Obsidian Charts"),await this.loadSettings(),Qh(),this.renderer=new Ns(this),window.renderChart=this.renderer.renderRaw,this.addSettingTab(new za(this.app,this)),this.addCommand({id:"creation-helper",name:"Insert new Chart",checkCallback:t=>{let e=this.app.workspace.activeLeaf;return e.view instanceof Oe.MarkdownView?(t||new Ks(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||Ea(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||Ea(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..."),Sh(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 Ks(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
*/