functionYl(e){vart=e.toString(16);return1===t.length?"0"+t:t}functionJl(e){return"#"+e.map(Yl).join("")}functionXl(e){returne?(t=e,Array.isArray(t[0])?e:[e]):[];vart}functionei(e,t,n){for(varo=0;o<n.length;o++)if(ti(e,t,n[o]))return!0;return!1}functionti(e,t,n){switch(n.length){case3:if(function(e,t,n){if(255!==e[t+3])return!0;if(e[t]===n[0]&&e[t+1]===n[1]&&e[t+2]===n[2])return!0;return!1}(e,t,n))return!0;break;case4:if(function(e,t,n){if(e[t+3]&&n[3])returne[t]===n[0]&&e[t+1]===n[1]&&e[t+2]===n[2]&&e[t+3]===n[3];returne[t+3]===n[3]}(e,t,n))return!0;break;case5:if(function(e,t,n){varo=n[0],r=n[1],a=n[2],l=n[3],i=n[4],s=e[t+3],c=ni(s,l,i);if(!l)returnc;if(!s&&c)return!0;if(ni(e[t],o,i)&&ni(e[t+1],r,i)&&ni(e[t+2],a,i)&&c)return!0;return!1}(e,t,n))return!0;break;default:return!1}}functionni(e,t,n){returne>=t-n&&e<=t+n}functionoi(e,t,n){for(varo={},r=n.ignoredColor,a=n.step,l=[0,0,0,0,0],i=0;i<t;i+=a){vars=e[i],c=e[i+1],u=e[i+2],m=e[i+3];if(!r||!ei(e,i,r)){varp=Math.round(s/24)+","+Math.round(c/24)+","+Math.round(u/24);o[p]?o[p]=[o[p][0]+s*m,o[p][1]+c*m,o[p][2]+u*m,o[p][3]+m,o[p][4]+1]:o[p]=[s*m,c*m,u*m,m,1],l[4]<o[p][4]&&(l=o[p])}}vard=l[0],g=l[1],h=l[2],b=l[3],_=l[4];returnb?[Math.round(d/b),Math.round(g/b),Math.round(h/b),Math.round(b/_)]:n.defaultColor}functionri(e,t,n){for(varo=0,r=0,a=0,l=0,i=0,s=n.ignoredColor,c=n.step,u=0;u<t;u+=c){varm=e[u+3],p=e[u]*m,d=e[u+1]*m,g=e[u+2]*m;s&&ei(e,u,s)||(o+=p,r+=d,a+=g,l+=m,i++)}returnl?[Math.round(o/l),Math.round(r/l),Math.round(a/l),Math.round(l/i)]:n.defaultColor}functionai(e,t,n){for(varo=0,r=0,a=0,l=0,i=0,s=n.ignoredColor,c=n.step,u=0;u<t;u+=c){varm=e[u],p=e[u+1],d=e[u+2],g=e[u+3];s&&ei(e,u,s)||(o+=m*m*g,r+=p*p*g,a+=d*d*g,l+=g,i++)}returnl?[Math.round(Math.sqrt(o/l)),Math.round(Math.sqrt(r/l)),Math.round(Math.sqrt(a/l)),Math.round(l/i)]:n.defaultColor}functionli(e){returnii(e,"defaultColor",[0,0,0,0])}functionii(e,t,n){returnvoid0===e[t]?n:e[t]}functionsi(e){if(ui(e)){vart=e.naturalWidth,n=e.naturalHeight;returne.naturalWidth||-1===e.src.search(/\.svg(\?|$)/i)||(t=n=100),{width:t,height:n}}returnfunction(e){return"undefined"!=typeofHTMLVideoElement&&einstanceofHTMLVideoElement}(e)?{width:e.videoWidth,height:e.videoHeight}:{width:e.width,height:e.height}}functionci(e){returnfunction(e){return"undefined"!=typeofHTMLCanvasElement&&einstanceofHTMLCanvasElement}(e)?"canvas":function(e){returnmi&&einstanceofOffscreenCanvas}(e)?"offscreencanvas":function(e){return"undefined"!=typeofImageBitmap&&einstanceofImageBitmap}(e)?"imagebitmap":e.src}functionui(e){return"undefined"!=typeofHTMLImageElement&&einstanceofHTMLImageElement}varmi="undefined"!=typeofOffscreenCanvas;varpi="undefined"==typeofwindow;functiondi(e){returnError("FastAverageColor: "+e)}functiongi(e,t){t||console.error(e)}varhi=function(){functione(){this.canvas=null,this.ctx=null}returne.prototype.getColorAsync=function(e,t){if(!e)returnPromise.reject(di("call .getColorAsync() without resource."));if("string"==typeofe){if("undefined"==typeofImage)returnPromise.reject(di("resource as string is not supported in this environment"));varn=newImage;returnn.crossOrigin=t&&t.crossOrigin||"",n.src=e,this.bindImageEvents(n,t)}if(ui(e)&&!e.complete)returnthis.bindImageEvents(e,t);varo=this.getColor(e,t);returno.error?Promise.reject(o.error):Promise.resolve(o)},e.prototype.getColor=function(e,t){varn=li(t=t||{});if(!e)returngi(a=di("call .getColor(null) without resource"),t.silent),this.prepareResult(n,a);varo=function(e,t){varn,o=ii(t,"left",0),r=ii(t,"top",0),a=ii(t,"width",e.width),l=ii(t,"height",e.height),i=a,s=l;return"precision"===t.mode||(a>l?(n=a/l,i=100,s=Math.round(i/n)):(n=l/a,s=100,i=Math.round(s/n)),(i>a||s>l||i<10||s<10)&&(i=a,s=l)),{srcLeft:o,srcTop:r,srcWidth:a,srcHeight:l,destWidth:i,destHeight:s}}(si(e),t);if(!(o.srcWidth&&o.srcHeight&&o.destWidth&&o.destHeight))returngi(a=di('incorrect sizes for resource "'.concat(ci(e),'"')),t.silent),this.prepareResult(n,a);if(!this.canvas&&(this.canvas=pi?mi?newOffscreenCanvas(1,1):null:document.