12 |
- /*! third party licenses: dist/vendor.LICENSE.txt */
- import{c6 as A,bV as ee,ca as De,b_ as Y,I as re,bR as q,bZ as pt,c1 as Pe,bW as Me,d7 as oe,bG as Ue,G as ne,a_ as ae,F as ie,a7 as Re,ai as se,bu as Rt,aX as Et,bS as ft,b$ as it,a4 as Ee,aV as Tt}from"./core-common.mjs";import{A as Fe,w as Ft,r as ue}from"./chunks/index-CG7xFxrZ.mjs";import{R as Ne}from"./chunks/index-D0hy_tCT.mjs";import{J as Ve,f as qe,l as Be}from"./chunks/_overRest-DjFtaWRq.mjs";import{_ as ze}from"./chunks/_baseEach-BuCj9lAy.mjs";import{a as He,h as Ge}from"./chunks/_baseIteratee-CdKuEoft.mjs";import{d as $e,a as Ke}from"./chunks/index-DCgLaXhm.mjs";import{a as We,b as Qe}from"./chunks/_isIterateeCall-CX-rKv74.mjs";import{e as Xe}from"./chunks/_setToArray-V03nfpyh.mjs";import{ac as Ye,b1 as le,bv as Ze,n as gt,bw as Je,b0 as tr}from"./chunks/icons-TElqpmA8.mjs";import{z as wt}from"./chunks/_plugin-vue2_normalizer-VrK6B12S-BQkexw0P.mjs";import"./chunks/index-PaKKd09k.mjs";import"./chunks/sortable.esm-D5slCXxa.mjs";import"./chunks/preload-helper-BG02UnR2.mjs";import"./chunks/isSymbol-CFNg2trq.mjs";var ht={},mt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getColorIndex=e.getColorDiffStatus=e.hexDiff=e.rgbDiff=e.deltaE94=e.rgbToCIELab=e.xyzToCIELab=e.rgbToXyz=e.hslToRgb=e.rgbToHsl=e.rgbToHex=e.hexToRgb=e.defer=e.RSHIFT=e.SIGBITS=e.DELTAE94_DIFF_STATUS=void 0,e.DELTAE94_DIFF_STATUS={NA:0,PERFECT:1,CLOSE:2,GOOD:10,SIMILAR:50},e.SIGBITS=5,e.RSHIFT=8-e.SIGBITS;function o(){var u,h,d=new Promise(function(v,g){u=v,h=g});return{resolve:u,reject:h,promise:d}}e.defer=o;function r(u){var h=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(u);return h===null?null:[h[1],h[2],h[3]].map(function(d){return parseInt(d,16)})}e.hexToRgb=r;function n(u,h,d){return"#"+((1<<24)+(u<<16)+(h<<8)+d).toString(16).slice(1,7)}e.rgbToHex=n;function a(u,h,d){u/=255,h/=255,d/=255;var v=Math.max(u,h,d),g=Math.min(u,h,d),_,C,T=(v+g)/2;if(v===g)_=C=0;else{var I=v-g;switch(C=T>.5?I/(2-v-g):I/(v+g),v){case u:_=(h-d)/I+(h<d?6:0);break;case h:_=(d-u)/I+2;break;case d:_=(u-h)/I+4;break}_/=6}return[_,C,T]}e.rgbToHsl=a;function i(u,h,d){var v,g,_;function C(D,x,O){return O<0&&(O+=1),O>1&&(O-=1),O<1/6?D+(x-D)*6*O:O<1/2?x:O<2/3?D+(x-D)*(2/3-O)*6:D}if(h===0)v=g=_=d;else{var T=d<.5?d*(1+h):d+h-d*h,I=2*d-T;v=C(I,T,u+1/3),g=C(I,T,u),_=C(I,T,u-1/3)}return[v*255,g*255,_*255]}e.hslToRgb=i;function s(u,h,d){u/=255,h/=255,d/=255,u=u>.04045?Math.pow((u+.005)/1.055,2.4):u/12.92,h=h>.04045?Math.pow((h+.005)/1.055,2.4):h/12.92,d=d>.04045?Math.pow((d+.005)/1.055,2.4):d/12.92,u*=100,h*=100,d*=100;var v=u*.4124+h*.3576+d*.1805,g=u*.2126+h*.7152+d*.0722,_=u*.0193+h*.1192+d*.9505;return[v,g,_]}e.rgbToXyz=s;function l(u,h,d){var v=95.047,g=100,_=108.883;u/=v,h/=g,d/=_,u=u>.008856?Math.pow(u,1/3):7.787*u+16/116,h=h>.008856?Math.pow(h,1/3):7.787*h+16/116,d=d>.008856?Math.pow(d,1/3):7.787*d+16/116;var C=116*h-16,T=500*(u-h),I=200*(h-d);return[C,T,I]}e.xyzToCIELab=l;function f(u,h,d){var v=s(u,h,d),g=v[0],_=v[1],C=v[2];return l(g,_,C)}e.rgbToCIELab=f;function m(u,h){var d=1,v=1,g=1,_=u[0],C=u[1],T=u[2],I=h[0],D=h[1],x=h[2],O=_-I,M=C-D,$=T-x,K=Math.sqrt(C*C+T*T),z=Math.sqrt(D*D+x*x),U=I-_,E=z-K,L=Math.sqrt(O*O+M*M+$*$),W=Math.sqrt(L)>Math.sqrt(Math.abs(U))+Math.sqrt(Math.abs(E))?Math.sqrt(L*L-U*U-E*E):0,st=1+.045*K,ut=1+.015*K;return U/=d,E/=v*st,W/=g*ut,Math.sqrt(U*U+E*E+W*W)}e.deltaE94=m;function b(u,h){var d=f.apply(void 0,u),v=f.apply(void 0,h);return m(d,v)}e.rgbDiff=b;function w(u,h){var d=r(u),v=r(h);return b(d,v)}e.hexDiff=w;function c(u){return u<e.DELTAE94_DIFF_STATUS.NA?"N/A":u<=e.DELTAE94_DIFF_STATUS.PERFECT?"Perfect":u<=e.DELTAE94_DIFF_STATUS.CLOSE?"Close":u<=e.DELTAE94_DIFF_STATUS.GOOD?"Good":u<e.DELTAE94_DIFF_STATUS.SIMILAR?"Similar":"Wrong"}e.getColorDiffStatus=c;function p(u,h,d){return(u<<2*e.SIGBITS)+(h<<e.SIGBITS)+d}e.getColorIndex=p})(mt);var er=ze;function rr(e,o){var r=[];return er(e,function(n,a,i){o(n,a,i)&&r.push(n)}),r}var or=rr,nr=Ve,ar=or,ir=He,sr=qe;function ur(e,o){var r=sr(e)?nr:ar;return r(e,ir(o))}var lr=ur;Object.defineProperty(ht,"__esModule",{value:!0}),ht.Swatch=void 0;var Nt=mt,cr=lr,hr=function(){function e(o,r){this._rgb=o,this._population=r}return e.applyFilter=function(o,r){return typeof r=="function"?cr(o,function(n){var a=n.r,i=n.g,s=n.b;return r(a,i,s,255)}):o},Object.defineProperty(e.prototype,"r",{get:function(){return this._rgb[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"g",{get:function(){return this._rgb[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"b",{get:function(){return this._rgb[2]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rgb",{get:function(){return this._rgb},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hsl",{get:function(){if(!this._hsl){var o=this._rgb,r=o[0],n=o[1],a=o[2];this._hsl=Nt.rgbToHsl(r,n,a)}return this._hsl},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hex",{get:function(){if(!this._hex){var o=this._rgb,r=o[0],n=o[1],a=o[2];this._hex=Nt.rgbToHex(r,n,a)}return this._hex},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"population",{get:function(){return this._population},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){return{rgb:this.rgb,population:this.population}},e.prototype.getRgb=function(){return this._rgb},e.prototype.getHsl=function(){return this.hsl},e.prototype.getPopulation=function(){return this._population},e.prototype.getHex=function(){return this.hex},e.prototype.getYiq=function(){if(!this._yiq){var o=this._rgb;this._yiq=(o[0]*299+o[1]*587+o[2]*114)/1e3}return this._yiq},Object.defineProperty(e.prototype,"titleTextColor",{get:function(){return this._titleTextColor||(this._titleTextColor=this.getYiq()<200?"#fff":"#000"),this._titleTextColor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bodyTextColor",{get:function(){return this._bodyTextColor||(this._bodyTextColor=this.getYiq()<150?"#fff":"#000"),this._bodyTextColor},enumerable:!1,configurable:!0}),e.prototype.getTitleTextColor=function(){return this.titleTextColor},e.prototype.getBodyTextColor=function(){return this.bodyTextColor},e}();ht.Swatch=hr;var vt={},yt={},Vt;function pr(){if(Vt)return yt;Vt=1;var e=A&&A.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(yt,"__esModule",{value:!0});var o=e(me()),r=Ge,n=function(){function a(i,s){s===void 0&&(s={}),this._src=i,this._opts=s,this._opts.filters=r(o.default.DefaultOpts.filters)}return a.prototype.maxColorCount=function(i){return this._opts.colorCount=i,this},a.prototype.maxDimension=function(i){return this._opts.maxDimension=i,this},a.prototype.addFilter=function(i){return this._opts.filters.push(i),this},a.prototype.removeFilter=function(i){var s=this._opts.filters.indexOf(i);return s>0&&this._opts.filters.splice(s),this},a.prototype.clearFilters=function(){return this._opts.filters=[],this},a.prototype.quality=function(i){return this._opts.quality=i,this},a.prototype.useImageClass=function(i){return this._opts.ImageClass=i,this},a.prototype.useGenerator=function(i){return this._opts.generator=i,this},a.prototype.useQuantizer=function(i){return this._opts.quantizer=i,this},a.prototype.build=function(){return new o.default(this._src,this._opts)},a.prototype.getPalette=function(i){return this.build().getPalette(i)},a.prototype.getSwatches=function(i){return this.build().getPalette(i)},a}();return yt.default=n,yt}var ce={},It={},Dt={};Object.defineProperty(Dt,"__esModule",{value:!0});var V=mt,dr=function(){function e(o,r,n,a,i,s,l){this._volume=-1,this._count=-1,this.dimension={r1:o,r2:r,g1:n,g2:a,b1:i,b2:s},this.hist=l}return e.build=function(o,r){var n=1<<3*V.SIGBITS,a=new Uint32Array(n),i,s,l,f,m,b,w,c,p,u;i=l=m=0,s=f=b=Number.MAX_VALUE;for(var h=o.length/4,d=0;d<h;){var v=d*4;if(d++,w=o[v+0],c=o[v+1],p=o[v+2],u=o[v+3],u!==0){w=w>>V.RSHIFT,c=c>>V.RSHIFT,p=p>>V.RSHIFT;var g=V.getColorIndex(w,c,p);a[g]+=1,w>i&&(i=w),w<s&&(s=w),c>l&&(l=c),c<f&&(f=c),p>m&&(m=p),p<b&&(b=p)}}return new e(s,i,f,l,b,m,a)},e.prototype.invalidate=function(){this._volume=this._count=-1,this._avg=null},e.prototype.volume=function(){if(this._volume<0){var o=this.dimension,r=o.r1,n=o.r2,a=o.g1,i=o.g2,s=o.b1,l=o.b2;this._volume=(n-r+1)*(i-a+1)*(l-s+1)}return this._volume},e.prototype.count=function(){if(this._count<0){for(var o=this.hist,r=this.dimension,n=r.r1,a=r.r2,i=r.g1,s=r.g2,l=r.b1,f=r.b2,m=0,b=n;b<=a;b++)for(var w=i;w<=s;w++)for(var c=l;c<=f;c++){var p=V.getColorIndex(b,w,c);m+=o[p]}this._count=m}return this._count},e.prototype.clone=function(){var o=this.hist,r=this.dimension,n=r.r1,a=r.r2,i=r.g1,s=r.g2,l=r.b1,f=r.b2;return new e(n,a,i,s,l,f,o)},e.prototype.avg=function(){if(!this._avg){var o=this.hist,r=this.dimension,n=r.r1,a=r.r2,i=r.g1,s=r.g2,l=r.b1,f=r.b2,m=0,b=1<<8-V.SIGBITS,w=void 0,c=void 0,p=void 0;w=c=p=0;for(var u=n;u<=a;u++)for(var h=i;h<=s;h++)for(var d=l;d<=f;d++){var v=V.getColorIndex(u,h,d),g=o[v];m+=g,w+=g*(u+.5)*b,c+=g*(h+.5)*b,p+=g*(d+.5)*b}m?this._avg=[~~(w/m),~~(c/m),~~(p/m)]:this._avg=[~~(b*(n+a+1)/2),~~(b*(i+s+1)/2),~~(b*(l+f+1)/2)]}return this._avg},e.prototype.contains=function(o){var r=o[0],n=o[1],a=o[2],i=this.dimension,s=i.r1,l=i.r2,f=i.g1,m=i.g2,b=i.b1,w=i.b2;return r>>=V.RSHIFT,n>>=V.RSHIFT,a>>=V.RSHIFT,r>=s&&r<=l&&n>=f&&n<=m&&a>=b&&a<=w},e.prototype.split=function(){var o=this.hist,r=this.dimension,n=r.r1,a=r.r2,i=r.g1,s=r.g2,l=r.b1,f=r.b2,m=this.count();if(!m)return[];if(m===1)return[this.clone()];var b=a-n+1,w=s-i+1,c=f-l+1,p=Math.max(b,w,c),u=null,h,d;h=d=0;var v=null;if(p===b){v="r",u=new Uint32Array(a+1);for(var g=n;g<=a;g++){h=0;for(var _=i;_<=s;_++)for(var C=l;C<=f;C++){var T=V.getColorIndex(g,_,C);h+=o[T]}d+=h,u[g]=d}}else if(p===w){v="g",u=new Uint32Array(s+1);for(var _=i;_<=s;_++){h=0;for(var g=n;g<=a;g++)for(var C=l;C<=f;C++){var T=V.getColorIndex(g,_,C);h+=o[T]}d+=h,u[_]=d}}else{v="b",u=new Uint32Array(f+1);for(var C=l;C<=f;C++){h=0;for(var g=n;g<=a;g++)for(var _=i;_<=s;_++){var T=V.getColorIndex(g,_,C);h+=o[T]}d+=h,u[C]=d}}for(var I=-1,D=new Uint32Array(u.length),x=0;x<u.length;x++){var O=u[x];I<0&&O>d/2&&(I=x),D[x]=d-O}var M=this;function $(K){var z=K+"1",U=K+"2",E=M.dimension[z],L=M.dimension[U],W=M.clone(),st=M.clone(),ut=I-E,y=L-I;for(ut<=y?(L=Math.min(L-1,~~(I+y/2)),L=Math.max(0,L)):(L=Math.max(E,~~(I-1-ut/2)),L=Math.min(M.dimension[U],L));!u[L];)L++;for(var k=D[L];!k&&u[L-1];)k=D[--L];return W.dimension[U]=L,st.dimension[z]=L+1,[W,st]}return $(v)},e}();Dt.default=dr;var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0});var fr=function(){function e(o){this._comparator=o,this.contents=[],this._sorted=!1}return e.prototype._sort=function(){this._sorted||(this.contents.sort(this._comparator),this._sorted=!0)},e.prototype.push=function(o){this.contents.push(o),this._sorted=!1},e.prototype.peek=function(o){return this._sort(),o=typeof o=="number"?o:this.contents.length-1,this.contents[o]},e.prototype.pop=function(){return this._sort(),this.contents.pop()},e.prototype.size=function(){return this.contents.length},e.prototype.map=function(o){return this._sort(),this.contents.map(o)},e}();Pt.default=fr;var he=A&&A.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(It,"__esModule",{value:!0});var gr=ht,mr=he(Dt),qt=he(Pt),br=.75;function Bt(e,o){for(var r=e.size();e.size()<o;){var n=e.pop();if(n&&n.count()>0){var a=n.split(),i=a[0],s=a[1];if(e.push(i),s&&s.count()>0&&e.push(s),e.size()===r)break;r=e.size()}else break}}var vr=function(e,o){if(e.length===0||o.colorCount<2||o.colorCount>256)throw new Error("Wrong MMCQ parameters");var r=mr.default.build(e),n=r.hist;Object.keys(n).length;var a=new qt.default(function(s,l){return s.count()-l.count()});a.push(r),Bt(a,br*o.colorCount);var i=new qt.default(function(s,l){return s.count()*s.volume()-l.count()*l.volume()});return i.contents=a.contents,Bt(i,o.colorCount-i.size()),yr(i)};function yr(e){for(var o=[];e.size();){var r=e.pop(),n=r.avg();n[0],n[1],n[2],o.push(new gr.Swatch(n,r.count()))}return o}It.default=vr,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.WebWorker=void 0;var o=It;Object.defineProperty(e,"MMCQ",{enumerable:!0,get:function(){return o.default}}),e.WebWorker=null}(ce);var pe={},St={},_r=We,wr=Xe,kr=Qe,Cr=Be,de=Object.prototype,Tr=de.hasOwnProperty,Ir=_r(function(e,o){e=Object(e);var r=-1,n=o.length,a=n>2?o[2]:void 0;for(a&&kr(o[0],o[1],a)&&(n=1);++r<n;)for(var i=o[r],s=Cr(i),l=-1,f=s.length;++l<f;){var m=s[l],b=e[m];(b===void 0||wr(b,de[m])&&!Tr.call(e,m))&&(e[m]=i[m])}return e}),fe=Ir;Object.defineProperty(St,"__esModule",{value:!0});var et=ht,rt=mt,Sr=fe,xr={targetDarkLuma:.26,maxDarkLuma:.45,minLightLuma:.55,targetLightLuma:.74,minNormalLuma:.3,targetNormalLuma:.5,maxNormalLuma:.7,targetMutesSaturation:.3,maxMutesSaturation:.4,targetVibrantSaturation:1,minVibrantSaturation:.35,weightSaturation:3,weightLuma:6.5,weightPopulation:.5};function Or(e){var o=0;return e.forEach(function(r){o=Math.max(o,r.getPopulation())}),o}function Lr(e,o){return e.Vibrant===o||e.DarkVibrant===o||e.LightVibrant===o||e.Muted===o||e.DarkMuted===o||e.LightMuted===o}function Ar(e,o,r,n,a,i,s){function l(){for(var m=[],b=0;b<arguments.length;b++)m[b]=arguments[b];for(var w=0,c=0,p=0;p<m.length;p+=2){var u=m[p],h=m[p+1];w+=u*h,c+=h}return w/c}function f(m,b){return 1-Math.abs(m-b)}return l(f(e,o),s.weightSaturation,f(r,n),s.weightLuma,a/i,s.weightPopulation)}function lt(e,o,r,n,a,i,s,l,f,m){var b=null,w=0;return o.forEach(function(c){var p=c.getHsl(),u=p[1],h=p[2];if(u>=l&&u<=f&&h>=a&&h<=i&&!Lr(e,c)){var d=Ar(u,s,h,n,c.getPopulation(),r,m);(b===null||d>w)&&(b=c,w=d)}}),b}function jr(e,o,r){var n={};return n.Vibrant=lt(n,e,o,r.targetNormalLuma,r.minNormalLuma,r.maxNormalLuma,r.targetVibrantSaturation,r.minVibrantSaturation,1,r),n.LightVibrant=lt(n,e,o,r.targetLightLuma,r.minLightLuma,1,r.targetVibrantSaturation,r.minVibrantSaturation,1,r),n.DarkVibrant=lt(n,e,o,r.targetDarkLuma,0,r.maxDarkLuma,r.targetVibrantSaturation,r.minVibrantSaturation,1,r),n.Muted=lt(n,e,o,r.targetNormalLuma,r.minNormalLuma,r.maxNormalLuma,r.targetMutesSaturation,0,r.maxMutesSaturation,r),n.LightMuted=lt(n,e,o,r.targetLightLuma,r.minLightLuma,1,r.targetMutesSaturation,0,r.maxMutesSaturation,r),n.DarkMuted=lt(n,e,o,r.targetDarkLuma,0,r.maxDarkLuma,r.targetMutesSaturation,0,r.maxMutesSaturation,r),n}function Dr(e,o,r){if(e.Vibrant===null&&e.DarkVibrant===null&&e.LightVibrant===null){if(e.DarkVibrant===null&&e.DarkMuted!==null){var n=e.DarkMuted.getHsl(),a=n[0],i=n[1],s=n[2];s=r.targetDarkLuma,e.DarkVibrant=new et.Swatch(rt.hslToRgb(a,i,s),0)}if(e.LightVibrant===null&&e.LightMuted!==null){var l=e.LightMuted.getHsl(),a=l[0],i=l[1],s=l[2];s=r.targetDarkLuma,e.DarkVibrant=new et.Swatch(rt.hslToRgb(a,i,s),0)}}if(e.Vibrant===null&&e.DarkVibrant!==null){var f=e.DarkVibrant.getHsl(),a=f[0],i=f[1],s=f[2];s=r.targetNormalLuma,e.Vibrant=new et.Swatch(rt.hslToRgb(a,i,s),0)}else if(e.Vibrant===null&&e.LightVibrant!==null){var m=e.LightVibrant.getHsl(),a=m[0],i=m[1],s=m[2];s=r.targetNormalLuma,e.Vibrant=new et.Swatch(rt.hslToRgb(a,i,s),0)}if(e.DarkVibrant===null&&e.Vibrant!==null){var b=e.Vibrant.getHsl(),a=b[0],i=b[1],s=b[2];s=r.targetDarkLuma,e.DarkVibrant=new et.Swatch(rt.hslToRgb(a,i,s),0)}if(e.LightVibrant===null&&e.Vibrant!==null){var w=e.Vibrant.getHsl(),a=w[0],i=w[1],s=w[2];s=r.targetLightLuma,e.LightVibrant=new et.Swatch(rt.hslToRgb(a,i,s),0)}if(e.Muted===null&&e.Vibrant!==null){var c=e.Vibrant.getHsl(),a=c[0],i=c[1],s=c[2];s=r.targetMutesSaturation,e.Muted=new et.Swatch(rt.hslToRgb(a,i,s),0)}if(e.DarkMuted===null&&e.DarkVibrant!==null){var p=e.DarkVibrant.getHsl(),a=p[0],i=p[1],s=p[2];s=r.targetMutesSaturation,e.DarkMuted=new et.Swatch(rt.hslToRgb(a,i,s),0)}if(e.LightMuted===null&&e.LightVibrant!==null){var u=e.LightVibrant.getHsl(),a=u[0],i=u[1],s=u[2];s=r.targetMutesSaturation,e.LightMuted=new et.Swatch(rt.hslToRgb(a,i,s),0)}}var Pr=function(e,o){o=Sr({},o,xr);var r=Or(e),n=jr(e,r,o);return Dr(n,r,o),n};St.default=Pr,function(e){Object.defineProperty(e,"__esModule",{value:!0});var o=St;Object.defineProperty(e,"Default",{enumerable:!0,get:function(){return o.default}})}(pe);var ge={},xt={};Object.defineProperty(xt,"__esModule",{value:!0});function Mr(e,o,r,n){return n>=125&&!(e>250&&o>250&&r>250)}xt.default=Mr,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.combineFilters=void 0;var o=xt;Object.defineProperty(e,"Default",{enumerable:!0,get:function(){return o.default}});function r(n){return!Array.isArray(n)||n.length===0?null:function(a,i,s,l){if(l===0)return!1;for(var f=0;f<n.length;f++)if(!n[f](a,i,s,l))return!1;return!0}}e.combineFilters=r}(ge);var zt;function me(){if(zt)return vt;zt=1;var e=A&&A.__createBinding||(Object.create?function(c,p,u,h){h===void 0&&(h=u),Object.defineProperty(c,h,{enumerable:!0,get:function(){return p[u]}})}:function(c,p,u,h){h===void 0&&(h=u),c[h]=p[u]}),o=A&&A.__setModuleDefault||(Object.create?function(c,p){Object.defineProperty(c,"default",{enumerable:!0,value:p})}:function(c,p){c.default=p}),r=A&&A.__importStar||function(c){if(c&&c.__esModule)return c;var p={};if(c!=null)for(var u in c)u!=="default"&&Object.hasOwnProperty.call(c,u)&&e(p,c,u);return o(p,c),p},n=A&&A.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(vt,"__esModule",{value:!0});var a=ht,i=n(pr()),s=r(mt),l=r(ce),f=r(pe),m=r(ge),b=fe,w=function(){function c(p,u){this._src=p,this.opts=b({},u,c.DefaultOpts),this.opts.combinedFilter=m.combineFilters(this.opts.filters)}return c.from=function(p){return new i.default(p)},c.prototype._process=function(p,u){var h=u.quantizer,d=u.generator;return p.scaleDown(u),p.applyFilter(u.combinedFilter).then(function(v){return h(v.data,u)}).then(function(v){return a.Swatch.applyFilter(v,u.combinedFilter)}).then(function(v){return Promise.resolve(d(v))})},c.prototype.palette=function(){return this.swatches()},c.prototype.swatches=function(){return this._palette},c.prototype.getPalette=function(p){var u=this,h=new this.opts.ImageClass,d=h.load(this._src).then(function(v){return u._process(v,u.opts)}).then(function(v){return u._palette=v,h.remove(),v},function(v){throw h.remove(),v});return p&&d.then(function(v){return p(null,v)},function(v){return p(v)}),d},c.Builder=i.default,c.Quantizer=l,c.Generator=f,c.Filter=m,c.Util=s,c.Swatch=a.Swatch,c.DefaultOpts={colorCount:64,quality:5,generator:f.Default,ImageClass:null,quantizer:l.MMCQ,filters:[m.Default]},c}();return vt.default=w,vt}var Mt={},kt={};Object.defineProperty(kt,"__esModule",{value:!0}),kt.ImageBase=void 0;var Ur=function(){function e(){}return e.prototype.scaleDown=function(o){var r=this.getWidth(),n=this.getHeight(),a=1;if(o.maxDimension>0){var i=Math.max(r,n);i>o.maxDimension&&(a=o.maxDimension/i)}else a=1/o.quality;a<1&&this.resize(r*a,n*a,a)},e.prototype.applyFilter=function(o){var r=this.getImageData();if(typeof o=="function")for(var n=r.data,a=n.length/4,i=void 0,s=void 0,l=void 0,f=void 0,m=void 0,b=0;b<a;b++)i=b*4,s=n[i+0],l=n[i+1],f=n[i+2],m=n[i+3],o(s,l,f,m)||(n[i+3]=0);return Promise.resolve(r)},e}();kt.ImageBase=Ur;var _t={exports:{}};_t.exports,function(e,o){(function(r){var n=o&&!o.nodeType&&o,a=e&&!e.nodeType&&e,i=typeof A=="object"&&A;(i.global===i||i.window===i||i.self===i)&&(r=i);var s,l=2147483647,f=36,m=1,b=26,w=38,c=700,p=72,u=128,h="-",d=/^xn--/,v=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=f-m,T=Math.floor,I=String.fromCharCode,D;function x(y){throw new RangeError(_[y])}function O(y,k){for(var S=y.length,j=[];S--;)j[S]=k(y[S]);return j}function M(y,k){var S=y.split("@"),j="";S.length>1&&(j=S[0]+"@",y=S[1]),y=y.replace(g,".");var P=y.split("."),N=O(P,k).join(".");return j+N}function $(y){for(var k=[],S=0,j=y.length,P,N;S<j;)P=y.charCodeAt(S++),P>=55296&&P<=56319&&S<j?(N=y.charCodeAt(S++),(N&64512)==56320?k.push(((P&1023)<<10)+(N&1023)+65536):(k.push(P),S--)):k.push(P);return k}function K(y){return O(y,function(k){var S="";return k>65535&&(k-=65536,S+=I(k>>>10&1023|55296),k=56320|k&1023),S+=I(k),S}).join("")}function z(y){return y-48<10?y-22:y-65<26?y-65:y-97<26?y-97:f}function U(y,k){return y+22+75*(y<26)-((k!=0)<<5)}function E(y,k,S){var j=0;for(y=S?T(y/c):y>>1,y+=T(y/k);y>C*b>>1;j+=f)y=T(y/C);return T(j+(C+1)*y/(y+w))}function L(y){var k=[],S=y.length,j,P=0,N=u,R=p,B,Q,Z,tt,F,H,X,ot,at;for(B=y.lastIndexOf(h),B<0&&(B=0),Q=0;Q<B;++Q)y.charCodeAt(Q)>=128&&x("not-basic"),k.push(y.charCodeAt(Q));for(Z=B>0?B+1:0;Z<S;){for(tt=P,F=1,H=f;Z>=S&&x("invalid-input"),X=z(y.charCodeAt(Z++)),(X>=f||X>T((l-P)/F))&&x("overflow"),P+=X*F,ot=H<=R?m:H>=R+b?b:H-R,!(X<ot);H+=f)at=f-ot,F>T(l/at)&&x("overflow"),F*=at;j=k.length+1,R=E(P-tt,j,tt==0),T(P/j)>l-N&&x("overflow"),N+=T(P/j),P%=j,k.splice(P++,0,N)}return K(k)}function W(y){var k,S,j,P,N,R,B,Q,Z,tt,F,H=[],X,ot,at,Ct;for(y=$(y),X=y.length,k=u,S=0,N=p,R=0;R<X;++R)F=y[R],F<128&&H.push(I(F));for(j=P=H.length,P&&H.push(h);j<X;){for(B=l,R=0;R<X;++R)F=y[R],F>=k&&F<B&&(B=F);for(ot=j+1,B-k>T((l-S)/ot)&&x("overflow"),S+=(B-k)*ot,k=B,R=0;R<X;++R)if(F=y[R],F<k&&++S>l&&x("overflow"),F==k){for(Q=S,Z=f;tt=Z<=N?m:Z>=N+b?b:Z-N,!(Q<tt);Z+=f)Ct=Q-tt,at=f-tt,H.push(I(U(tt+Ct%at,0))),Q=T(Ct/at);H.push(I(U(Q,0))),N=E(S,ot,j==P),S=0,++j}++S,++k}return H.join("")}function st(y){return M(y,function(k){return d.test(k)?L(k.slice(4).toLowerCase()):k})}function ut(y){return M(y,function(k){return v.test(k)?"xn--"+W(k):k})}if(s={version:"1.4.1",ucs2:{decode:$,encode:K},decode:L,encode:W,toASCII:ut,toUnicode:st},n&&a)if(e.exports==n)a.exports=s;else for(D in s)s.hasOwnProperty(D)&&(n[D]=s[D]);else r.punycode=s})(A)}(_t,_t.exports);var Rr=_t.exports;const Er=ee(Rr);function Fr(e,o){return Object.prototype.hasOwnProperty.call(e,o)}var Nr=function(e,o,r,n){o=o||"&",r=r||"=";var a={};if(typeof e!="string"||e.length===0)return a;var i=/\+/g;e=e.split(o);var s=1e3;n&&typeof n.maxKeys=="number"&&(s=n.maxKeys);var l=e.length;s>0&&l>s&&(l=s);for(var f=0;f<l;++f){var m=e[f].replace(i,"%20"),b=m.indexOf(r),w,c,p,u;b>=0?(w=m.substr(0,b),c=m.substr(b+1)):(w=m,c=""),p=decodeURIComponent(w),u=decodeURIComponent(c),Fr(a,p)?Vr(a[p])?a[p].push(u):a[p]=[a[p],u]:a[p]=u}return a},Vr=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},dt=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},qr=function(e,o,r,n){return o=o||"&",r=r||"=",e===null&&(e=void 0),typeof e=="object"?Ht(zr(e),function(a){var i=encodeURIComponent(dt(a))+r;return Br(e[a])?Ht(e[a],function(s){return i+encodeURIComponent(dt(s))}).join(o):i+encodeURIComponent(dt(e[a]))}).join(o):n?encodeURIComponent(dt(n))+r+encodeURIComponent(dt(e)):""},Br=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};function Ht(e,o){if(e.map)return e.map(o);for(var r=[],n=0;n<e.length;n++)r.push(o(e[n],n));return r}var zr=Object.keys||function(e){var o=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.push(r);return o},be,ve,Hr=ve=Nr,Gr=be=qr;function $r(e){return encodeURIComponent(e)}function Kr(e){return decodeURIComponent(e)}var Wr={decode:Hr,encode:Gr,parse:ve,stringify:be,escape:$r,unescape:Kr},Qr={isString:function(e){return typeof e=="string"},isObject:function(e){return typeof e=="object"&&e!==null},isNull:function(e){return e===null},isNullOrUndefined:function(e){return e==null}},Xr=Er,J=Qr,Yr=bt,Zr=co,ye=ho,Jr=lo,to=G;function G(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var eo=/^([a-z0-9.+-]+:)/i,ro=/:[0-9]*$/,oo=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,no=["<",">",'"',"`"," ","\r","\n"," "],ao=["{","}","|","\\","^","`"].concat(no),Ot=["'"].concat(ao),Gt=["%","/","?",";","#"].concat(Ot),$t=["/","?","#"],io=255,Kt=/^[+a-z0-9A-Z_-]{0,63}$/,so=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,uo={javascript:!0,"javascript:":!0},Lt={javascript:!0,"javascript:":!0},ct={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},At=Wr;function bt(e,o,r){if(e&&J.isObject(e)&&e instanceof G)return e;var n=new G;return n.parse(e,o,r),n}G.prototype.parse=function(e,o,r){if(!J.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),a=n!==-1&&n<e.indexOf("#")?"?":"#",i=e.split(a),s=/\\/g;i[0]=i[0].replace(s,"/"),e=i.join(a);var l=e;if(l=l.trim(),!r&&e.split("#").length===1){var f=oo.exec(l);if(f)return this.path=l,this.href=l,this.pathname=f[1],f[2]?(this.search=f[2],o?this.query=At.parse(this.search.substr(1)):this.query=this.search.substr(1)):o&&(this.search="",this.query={}),this}var m=eo.exec(l);if(m){m=m[0];var b=m.toLowerCase();this.protocol=b,l=l.substr(m.length)}if(r||m||l.match(/^\/\/[^@\/]+@[^@\/]+/)){var w=l.substr(0,2)==="//";w&&!(m&&Lt[m])&&(l=l.substr(2),this.slashes=!0)}if(!Lt[m]&&(w||m&&!ct[m])){for(var c=-1,p=0;p<$t.length;p++){var u=l.indexOf($t[p]);u!==-1&&(c===-1||u<c)&&(c=u)}var h,d;c===-1?d=l.lastIndexOf("@"):d=l.lastIndexOf("@",c),d!==-1&&(h=l.slice(0,d),l=l.slice(d+1),this.auth=decodeURIComponent(h)),c=-1;for(var p=0;p<Gt.length;p++){var u=l.indexOf(Gt[p]);u!==-1&&(c===-1||u<c)&&(c=u)}c===-1&&(c=l.length),this.host=l.slice(0,c),l=l.slice(c),this.parseHost(),this.hostname=this.hostname||"";var v=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!v)for(var g=this.hostname.split(/\./),p=0,_=g.length;p<_;p++){var C=g[p];if(C&&!C.match(Kt)){for(var T="",I=0,D=C.length;I<D;I++)C.charCodeAt(I)>127?T+="x":T+=C[I];if(!T.match(Kt)){var x=g.slice(0,p),O=g.slice(p+1),M=C.match(so);M&&(x.push(M[1]),O.unshift(M[2])),O.length&&(l="/"+O.join(".")+l),this.hostname=x.join(".");break}}}this.hostname.length>io?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=Xr.toASCII(this.hostname));var $=this.port?":"+this.port:"",K=this.hostname||"";this.host=K+$,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),l[0]!=="/"&&(l="/"+l))}if(!uo[b])for(var p=0,_=Ot.length;p<_;p++){var z=Ot[p];if(l.indexOf(z)!==-1){var U=encodeURIComponent(z);U===z&&(U=escape(z)),l=l.split(z).join(U)}}var E=l.indexOf("#");E!==-1&&(this.hash=l.substr(E),l=l.slice(0,E));var L=l.indexOf("?");if(L!==-1?(this.search=l.substr(L),this.query=l.substr(L+1),o&&(this.query=At.parse(this.query)),l=l.slice(0,L)):o&&(this.search="",this.query={}),l&&(this.pathname=l),ct[b]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var $=this.pathname||"",W=this.search||"";this.path=$+W}return this.href=this.format(),this};function lo(e){return J.isString(e)&&(e=bt(e)),e instanceof G?e.format():G.prototype.format.call(e)}G.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var o=this.protocol||"",r=this.pathname||"",n=this.hash||"",a=!1,i="";this.host?a=e+this.host:this.hostname&&(a=e+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(a+=":"+this.port)),this.query&&J.isObject(this.query)&&Object.keys(this.query).length&&(i=At.stringify(this.query));var s=this.search||i&&"?"+i||"";return o&&o.substr(-1)!==":"&&(o+=":"),this.slashes||(!o||ct[o])&&a!==!1?(a="//"+(a||""),r&&r.charAt(0)!=="/"&&(r="/"+r)):a||(a=""),n&&n.charAt(0)!=="#"&&(n="#"+n),s&&s.charAt(0)!=="?"&&(s="?"+s),r=r.replace(/[?#]/g,function(l){return encodeURIComponent(l)}),s=s.replace("#","%23"),o+a+r+s+n};function co(e,o){return bt(e,!1,!0).resolve(o)}G.prototype.resolve=function(e){return this.resolveObject(bt(e,!1,!0)).format()};function ho(e,o){return e?bt(e,!1,!0).resolveObject(o):o}G.prototype.resolveObject=function(e){if(J.isString(e)){var o=new G;o.parse(e,!1,!0),e=o}for(var r=new G,n=Object.keys(this),a=0;a<n.length;a++){var i=n[a];r[i]=this[i]}if(r.hash=e.hash,e.href==="")return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),l=0;l<s.length;l++){var f=s[l];f!=="protocol"&&(r[f]=e[f])}return ct[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!ct[e.protocol]){for(var m=Object.keys(e),b=0;b<m.length;b++){var w=m[b];r[w]=e[w]}return r.href=r.format(),r}if(r.protocol=e.protocol,!e.host&&!Lt[e.protocol]){for(var _=(e.pathname||"").split("/");_.length&&!(e.host=_.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),_[0]!==""&&_.unshift(""),_.length<2&&_.unshift(""),r.pathname=_.join("/")}else r.pathname=e.pathname;if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var c=r.pathname||"",p=r.search||"";r.path=c+p}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var u=r.pathname&&r.pathname.charAt(0)==="/",h=e.host||e.pathname&&e.pathname.charAt(0)==="/",d=h||u||r.host&&e.pathname,v=d,g=r.pathname&&r.pathname.split("/")||[],_=e.pathname&&e.pathname.split("/")||[],C=r.protocol&&!ct[r.protocol];if(C&&(r.hostname="",r.port=null,r.host&&(g[0]===""?g[0]=r.host:g.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host=null),d=d&&(_[0]===""||g[0]==="")),h)r.host=e.host||e.host===""?e.host:r.host,r.hostname=e.hostname||e.hostname===""?e.hostname:r.hostname,r.search=e.search,r.query=e.query,g=_;else if(_.length)g||(g=[]),g.pop(),g=g.concat(_),r.search=e.search,r.query=e.query;else if(!J.isNullOrUndefined(e.search)){if(C){r.hostname=r.host=g.shift();var T=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;T&&(r.auth=T.shift(),r.host=r.hostname=T.shift())}return r.search=e.search,r.query=e.query,(!J.isNull(r.pathname)||!J.isNull(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!g.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var I=g.slice(-1)[0],D=(r.host||e.host||g.length>1)&&(I==="."||I==="..")||I==="",x=0,O=g.length;O>=0;O--)I=g[O],I==="."?g.splice(O,1):I===".."?(g.splice(O,1),x++):x&&(g.splice(O,1),x--);if(!d&&!v)for(;x--;x)g.unshift("..");d&&g[0]!==""&&(!g[0]||g[0].charAt(0)!=="/")&&g.unshift(""),D&&g.join("/").substr(-1)!=="/"&&g.push("");var M=g[0]===""||g[0]&&g[0].charAt(0)==="/";if(C){r.hostname=r.host=M?"":g.length?g.shift():"";var T=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;T&&(r.auth=T.shift(),r.host=r.hostname=T.shift())}return d=d||r.host&&g.length,d&&!M&&g.unshift(""),g.length?r.pathname=g.join("/"):(r.pathname=null,r.path=null),(!J.isNull(r.pathname)||!J.isNull(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},G.prototype.parseHost=function(){var e=this.host,o=ro.exec(e);o&&(o=o[0],o!==":"&&(this.port=o.substr(1)),e=e.substr(0,e.length-o.length)),e&&(this.hostname=e)};function po(e,o){for(var r=0,n=e.length-1;n>=0;n--){var a=e[n];a==="."?e.splice(n,1):a===".."?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(o)for(;r--;r)e.unshift("..");return e}function fo(){for(var e="",o=!1,r=arguments.length-1;r>=-1&&!o;r--){var n=r>=0?arguments[r]:"/";if(typeof n!="string")throw new TypeError("Arguments to path.resolve must be strings");n&&(e=n+"/"+e,o=n.charAt(0)==="/")}return e=po(go(e.split("/"),function(a){return!!a}),!o).join("/"),(o?"/":"")+e||"."}function go(e,o){if(e.filter)return e.filter(o);for(var r=[],n=0;n<e.length;n++)o(e[n],n,e)&&r.push(e[n]);return r}var _e=function(e){function o(){var n=this||self;return delete e.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return o();e.defineProperty(e.prototype,"__magic__",{configurable:!0,get:o});var r=__magic__;return r}(Object),mo=Jr,we=Yr,ke=Zr,Ce=to,nt=_e.URL,Te=_e.URLSearchParams,bo=/%/g,vo=/\\/g,yo=/\n/g,_o=/\r/g,wo=/\t/g,ko=47;function Co(e){var o=e!=null?e:null;return!!(o!==null&&(o!=null&&o.href)&&(o!=null&&o.origin))}function To(e){if(e.hostname!=="")throw new TypeError('File URL host must be "localhost" or empty on browser');for(var o=e.pathname,r=0;r<o.length;r++)if(o[r]==="%"){var n=o.codePointAt(r+2)|32;if(o[r+1]==="2"&&n===102)throw new TypeError("File URL path must not include encoded / characters")}return decodeURIComponent(o)}function Io(e){return e.includes("%")&&(e=e.replace(bo,"%25")),e.includes("\\")&&(e=e.replace(vo,"%5C")),e.includes("\n")&&(e=e.replace(yo,"%0A")),e.includes("\r")&&(e=e.replace(_o,"%0D")),e.includes(" ")&&(e=e.replace(wo,"%09")),e}var Ie=function(e){if(typeof e>"u")throw new TypeError('The "domain" argument must be specified');return new nt("http://"+e).hostname},Se=function(e){if(typeof e>"u")throw new TypeError('The "domain" argument must be specified');return new nt("http://"+e).hostname},xe=function(e){var o=new nt("file://"),r=fo(e),n=e.charCodeAt(e.length-1);return n===ko&&r[r.length-1]!=="/"&&(r+="/"),o.pathname=Io(r),o},Oe=function(e){if(!Co(e)&&typeof e!="string")throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof e+" ("+e+")");var o=new nt(e);if(o.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return To(o)},Le=function(e,o){var r,n,a;if(o===void 0&&(o={}),!(e instanceof nt))return mo(e);if(typeof o!="object"||o===null)throw new TypeError('The "options" argument must be of type object.');var i=(r=o.auth)!=null?r:!0,s=(n=o.fragment)!=null?n:!0,l=(a=o.search)!=null?a:!0,f=new nt(e.toString());return i||(f.username="",f.password=""),s||(f.hash=""),l||(f.search=""),f.toString()},So={format:Le,parse:we,resolve:ke,resolveObject:ye,Url:Ce,URL:nt,URLSearchParams:Te,domainToASCII:Ie,domainToUnicode:Se,pathToFileURL:xe,fileURLToPath:Oe};const xo=Object.freeze(Object.defineProperty({__proto__:null,URL:nt,URLSearchParams:Te,Url:Ce,default:So,domainToASCII:Ie,domainToUnicode:Se,fileURLToPath:Oe,format:Le,parse:we,pathToFileURL:xe,resolve:ke,resolveObject:ye},Symbol.toStringTag,{value:"Module"})),Oo=De(xo);var Lo=A&&A.__extends||function(){var e=function(o,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)a.hasOwnProperty(i)&&(n[i]=a[i])},e(o,r)};return function(o,r){e(o,r);function n(){this.constructor=o}o.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ao=A&&A.__createBinding||(Object.create?function(e,o,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return o[r]}})}:function(e,o,r,n){n===void 0&&(n=r),e[n]=o[r]}),jo=A&&A.__setModuleDefault||(Object.create?function(e,o){Object.defineProperty(e,"default",{enumerable:!0,value:o})}:function(e,o){e.default=o}),Do=A&&A.__importStar||function(e){if(e&&e.__esModule)return e;var o={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&Ao(o,e,r);return jo(o,e),o};Object.defineProperty(Mt,"__esModule",{value:!0});var Po=kt,jt=Do(Oo);function Mo(e){var o=jt.parse(e);return o.protocol===null&&o.host===null&&o.port===null}function Uo(e,o){var r=jt.parse(e),n=jt.parse(o);return r.protocol===n.protocol&&r.hostname===n.hostname&&r.port===n.port}var Ro=function(e){Lo(o,e);function o(){return e!==null&&e.apply(this,arguments)||this}return o.prototype._initCanvas=function(){var r=this.image,n=this._canvas=document.createElement("canvas"),a=this._context=n.getContext("2d");n.className="vibrant-canvas",n.style.display="none",this._width=n.width=r.width,this._height=n.height=r.height,a.drawImage(r,0,0),document.body.appendChild(n)},o.prototype.load=function(r){var n=this,a=null,i=null;if(typeof r=="string")a=document.createElement("img"),!Mo(r)&&!Uo(window.location.href,r)&&(a.crossOrigin="anonymous"),i=a.src=r;else if(r instanceof HTMLImageElement)a=r,i=r.src;else return Promise.reject(new Error("Cannot load buffer as an image in browser"));return this.image=a,new Promise(function(s,l){var f=function(){n._initCanvas(),s(n)};a.complete?f():(a.onload=f,a.onerror=function(m){return l(new Error("Fail to load image: "+i))})})},o.prototype.clear=function(){this._context.clearRect(0,0,this._width,this._height)},o.prototype.update=function(r){this._context.putImageData(r,0,0)},o.prototype.getWidth=function(){return this._width},o.prototype.getHeight=function(){return this._height},o.prototype.resize=function(r,n,a){var i=this,s=i._canvas,l=i._context,f=i.image;this._width=s.width=r,this._height=s.height=n,l.scale(a,a),l.drawImage(f,0,0)},o.prototype.getPixelCount=function(){return this._width*this._height},o.prototype.getImageData=function(){return this._context.getImageData(0,0,this._width,this._height)},o.prototype.remove=function(){this._canvas&&this._canvas.parentNode&&this._canvas.parentNode.removeChild(this._canvas)},o}(Po.ImageBase);Mt.default=Ro;var Ae=A&&A.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},je=Ae(me()),Eo=Ae(Mt);je.default.DefaultOpts.ImageClass=Eo.default;var Fo=je.default;const No=ee(Fo),Wt=Y("theming","shippedBackgrounds"),Vo=Y("theming","userBackgroundImage"),{backgroundImage:qo,backgroundColor:Rn,backgroundMime:Qt,defaultShippedBackground:Bo}=Y("theming","themingDefaults"),Xt=e=>oe("theming","","img/background/")+e,Ut={name:"BackgroundSettings",components:{Check:Ye,ColorPalette:le,ImageEdit:Ze,NcColorPicker:re},data(){return{loading:!1,Theming:Y("theming","data",{}),backgroundImage:Vo}},computed:{shippedBackgrounds(){return Object.keys(Wt).filter(e=>e!==Bo||!this.isGlobalBackgroundDefault).map(e=>({name:e,url:Xt(e),preview:Xt("preview/"+e),details:Wt[e]}))},isGlobalBackgroundDefault(){return Qt===""},isGlobalBackgroundDeleted(){return Qt==="backgroundColor"},cssDefaultBackgroundImage(){return"url('".concat(qo,"')")}},methods:{invertTextColor(e){return this.calculateLuma(e)>.6},calculateLuma(e){const[o,r,n]=this.hexToRGB(e);return(.2126*o+.7152*r+.0722*n)/255},hexToRGB(e){const o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return o?[parseInt(o[1],16),parseInt(o[2],16),parseInt(o[3],16)]:null},async update(e){this.backgroundImage=e.backgroundImage,this.Theming.backgroundColor=e.backgroundColor,this.$emit("update:background"),this.loading=!1},async setDefault(){this.loading="default";const e=await q.post(pt("/apps/theming/background/default"));this.update(e.data)},async setShipped(e){this.loading=e;const o=await q.post(pt("/apps/theming/background/shipped"),{value:e});this.update(o.data)},async setFile(e,o=null){this.loading="custom";const r=await q.post(pt("/apps/theming/background/custom"),{value:e,color:o});this.update(r.data)},async removeBackground(){this.loading="remove";const e=await q.delete(pt("/apps/theming/background/custom"));this.update(e.data)},async pickColor(e){this.loading="color";const{data:o}=await q.post(pt("/apps/theming/background/color"),{color:e||"#0082c9"});this.update(o)},debouncePickColor:$e(function(...e){this.pickColor(...e)},200),pickFile(){Ne(t("theming","Select a background from your files")).allowDirectories(!1).setMimeTypeFilter(["image/png","image/gif","image/jpeg","image/svg+xml","image/svg"]).setMultiSelect(!1).addButton({id:"select",label:t("theming","Select background"),callback:e=>{var o;this.applyFile((o=e[0])==null?void 0:o.path)},type:"primary"}).build().pick()},async applyFile(e){var n;if(!e||typeof e!="string"||e.trim().length===0||e==="/"){console.error("No valid background have been selected",{path:e}),wt(t("theming","No background has been selected"));return}this.loading="custom";let o=null,r=null;try{const a=Pe("dav/files/"+Me().uid+e);o=await q.get(a,{responseType:"blob"});const i=URL.createObjectURL(o.data),s=await this.getColorPaletteFromBlob(i);r=(n=s==null?void 0:s.DarkVibrant)==null?void 0:n.hex,this.setFile(e,r),console.debug("Extracted colour",r,"from custom image",e,s)}catch(a){this.setFile(e),console.error("Unable to extract colour from custom image",{error:a,path:e,response:o,color:r})}},getColorPaletteFromBlob(e){return new Promise((o,r)=>{new No(e).getPalette((n,a)=>{n&&r(n),o(a)})})}}},Yt=()=>{Ue((e,o)=>({"0f638dec":e.cssDefaultBackgroundImage}))},Zt=Ut.setup;Ut.setup=Zt?(e,o)=>(Yt(),Zt(e,o)):Yt;const zo=Ut;var Ho=function(){var e=this,o=e._self._c;return o("div",{staticClass:"background-selector",attrs:{"data-user-theming-background-settings":""}},[o("button",{class:{"icon-loading":e.loading==="custom","background background__filepicker":!0,"background--active":e.backgroundImage==="custom"},attrs:{"aria-pressed":e.backgroundImage==="custom","data-user-theming-background-custom":"",tabindex:"0"},on:{click:e.pickFile}},[e._v(" "+e._s(e.t("theming","Custom background"))+" "),e.backgroundImage!=="custom"?o("ImageEdit",{attrs:{size:20}}):e._e(),o("Check",{attrs:{size:44}})],1),o("NcColorPicker",{on:{"update:value":e.debouncePickColor},model:{value:e.Theming.backgroundColor,callback:function(r){e.$set(e.Theming,"backgroundColor",r)},expression:"Theming.backgroundColor"}},[o("button",{class:{"icon-loading":e.loading==="color","background background__color":!0,"background--active":e.backgroundImage==="color"},style:{backgroundColor:e.Theming.backgroundColor,"--border-color":e.Theming.backgroundColor},attrs:{"aria-pressed":e.backgroundImage==="color","data-color":e.Theming.backgroundColor,"data-color-bright":e.invertTextColor(e.Theming.backgroundColor),"data-user-theming-background-color":"",tabindex:"0"},on:{click:function(r){e.backgroundImage!=="color"&&e.debouncePickColor(e.Theming.backgroundColor)}}},[e._v(" "+e._s(e.t("theming","Plain background"))+" "),e.backgroundImage!=="color"?o("ColorPalette",{attrs:{size:20}}):e._e(),o("Check",{attrs:{size:44}})],1)]),o("button",{class:{"icon-loading":e.loading==="default","background background__default":!0,"background--active":e.backgroundImage==="default"},style:{"--border-color":e.Theming.defaultBackgroundColor},attrs:{"aria-pressed":e.backgroundImage==="default","data-color-bright":e.invertTextColor(e.Theming.defaultBackgroundColor),"data-user-theming-background-default":"",tabindex:"0"},on:{click:e.setDefault}},[e._v(" "+e._s(e.t("theming","Default background"))+" "),o("Check",{attrs:{size:44}})],1),e._l(e.shippedBackgrounds,function(r){return o("button",{key:r.name,class:{"background background__shipped":!0,"icon-loading":e.loading===r.name,"background--active":e.backgroundImage===r.name},style:{backgroundImage:"url("+r.preview+")","--border-color":r.details.primary_color},attrs:{title:r.details.attribution,"aria-label":r.details.description,"aria-pressed":e.backgroundImage===r.name,"data-color-bright":e.invertTextColor(r.details.background_color),"data-user-theming-background-shipped":r.name,tabindex:"0"},on:{click:function(n){return e.setShipped(r.name)}}},[o("Check",{attrs:{size:44}})],1)})],2)},Go=[],$o=gt(zo,Ho,Go,!1,null,"32679e01");const Ko=$o.exports,Wo={name:"ItemPreview",components:{NcCheckboxRadioSwitch:ne},props:{enforced:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},theme:{type:Object,required:!0},type:{type:String,default:""},unique:{type:Boolean,default:!1}},computed:{switchType(){return this.unique?"switch":"radio"},name(){return this.unique?null:this.type},img(){return oe("theming","img",this.theme.id+".jpg")},checked:{get(){return this.selected},set(e){if(console.debug("Changed theme",this.theme.id,e),!this.unique){this.$emit("change",{enabled:!0,id:this.theme.id});return}this.$emit("change",{enabled:e===!0,id:this.theme.id})}}},methods:{onToggle(){if(this.switchType==="radio"){this.checked=!0;return}this.checked=!this.checked}}};var Qo=function(){var e=this,o=e._self._c;return o("div",{staticClass:"theming__preview",class:"theming__preview--"+e.theme.id},[o("div",{staticClass:"theming__preview-image",style:{backgroundImage:"url("+e.img+")"},on:{click:e.onToggle}}),o("div",{staticClass:"theming__preview-description"},[o("h3",[e._v(e._s(e.theme.title))]),o("p",{staticClass:"theming__preview-explanation"},[e._v(e._s(e.theme.description))]),e.enforced?o("span",{staticClass:"theming__preview-warning",attrs:{role:"note"}},[e._v(" "+e._s(e.t("theming","Theme selection is enforced"))+" ")]):e._e(),o("NcCheckboxRadioSwitch",{staticClass:"theming__preview-toggle",attrs:{checked:e.checked,disabled:e.enforced,name:e.name,type:e.switchType},on:{"update:checked":function(r){e.checked=r}}},[e._v(" "+e._s(e.theme.enableLabel)+" ")])],1)])},Xo=[],Yo=gt(Wo,Qo,Xo,!1,null,"131fb3f7");const Zo=Yo.exports,Jo=ae({name:"UserAppMenuSection",components:{AppOrderSelector:Fe,IconUndo:Je,NcButton:ie,NcNoteCard:Re,NcSettingsSection:se},setup(){const{userAppOrder:e,enforcedDefaultApp:o}=Y("theming","navigationBar"),r=Object.values(Y("core","apps")).filter(({type:c})=>c==="link").map(c=>({...c,label:c.name,default:c.default&&c.app===o})),n=Rt(!Array.isArray(e)||Object.values(e).length>0),a=Et(()=>r.some(({id:c},p)=>c!==f.value[p].id)),i="theming-apporder-changed-infocard",s="theming-apporder-changed-infocard",l=Et(()=>(a.value?"".concat(i," "):"")+(o?s:"")),f=Rt([...r]),m=c=>{const p={};c.forEach(({app:u,id:h},d)=>{p[h]={order:d,app:u}}),w("apporder",p).then(()=>{f.value=c,n.value=!0}).catch(u=>{console.warn("Could not set the app order",u),wt(ft("theming","Could not set the app order"))})},b=async()=>{try{await w("apporder",[]),n.value=!1;const{data:c}=await q.get(it("/core/navigation/apps"),{headers:{"OCS-APIRequest":"true"}});f.value=c.ocs.data.map(p=>({...p,label:p.name,default:p.default&&p.app===o}))}catch(c){console.warn(c),wt(ft("theming","Could not reset the app order"))}},w=async(c,p)=>{const u=it("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"core",configKey:c});return await q.post(u,{configValue:JSON.stringify(p)})};return{appOrder:f,updateAppOrder:m,resetAppOrder:b,enforcedDefaultApp:o,hasAppOrderChanged:a,hasCustomAppOrder:n,ariaDetailsAppOrder:l,elementIdAppOrderChanged:i,elementIdEnforcedDefaultApp:s,t:ft}}});var tn=function(){var e=this,o=e._self._c;return e._self._setupProxy,o("NcSettingsSection",{attrs:{name:e.t("theming","Navigation bar settings")}},[o("p",[e._v(" "+e._s(e.t("theming","You can configure the app order used for the navigation bar. The first entry will be the default app, opened after login or when clicking on the logo."))+" ")]),e.enforcedDefaultApp?o("NcNoteCard",{attrs:{id:e.elementIdEnforcedDefaultApp,type:"info"}},[e._v(" "+e._s(e.t("theming","The default app can not be changed because it was configured by the administrator."))+" ")]):e._e(),e.hasAppOrderChanged?o("NcNoteCard",{attrs:{id:e.elementIdAppOrderChanged,type:"info"}},[e._v(" "+e._s(e.t("theming","The app order was changed, to see it in action you have to reload the page."))+" ")]):e._e(),o("AppOrderSelector",{staticClass:"user-app-menu-order",attrs:{"aria-details":e.ariaDetailsAppOrder,value:e.appOrder},on:{"update:value":e.updateAppOrder}}),o("NcButton",{attrs:{"data-test-id":"btn-apporder-reset",disabled:!e.hasCustomAppOrder,type:"tertiary"},on:{click:e.resetAppOrder},scopedSlots:e._u([{key:"icon",fn:function(){return[o("IconUndo",{attrs:{size:20}})]},proxy:!0}])},[e._v(" "+e._s(e.t("theming","Reset default app order"))+" ")])],1)},en=[],rn=gt(Jo,tn,en,!1,null,"2995579c");const on=rn.exports,{primaryColor:nn,defaultPrimaryColor:Jt}=Y("theming","data",{primaryColor:"#0082c9",defaultPrimaryColor:"#0082c9"}),an=ae({name:"UserPrimaryColor",components:{IconColorPalette:le,IconUndo:tr,NcButton:ie,NcColorPicker:re,NcLoadingIcon:Ee},emits:["refresh-styles"],data(){return{primaryColor:nn,loading:!1}},computed:{isdefaultPrimaryColor(){return Ft(this.primaryColor).isEqual(Ft(Jt))},debouncedOnUpdate(){return Ke.debounce(this.onUpdate,500)}},methods:{t:ft,reload(){const e=this.$refs.trigger,o=window.getComputedStyle(e).backgroundColor;o.toLowerCase()!==this.primaryColor&&(this.primaryColor=o)},onReset(){this.primaryColor=Jt,this.onUpdate(null)},async onUpdate(e){this.loading=!0;const o=it("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"theming",configKey:"primary_color"});try{e?await q.post(o,{configValue:e}):await q.delete(o),this.$emit("refresh-styles")}catch(r){console.error("Could not update primary color",r),wt(ft("theming","Could not set primary color"))}this.loading=!1}}});var sn=function(){var e=this,o=e._self._c;return e._self._setupProxy,o("div",{staticClass:"primary-color__wrapper"},[o("NcColorPicker",{attrs:{"data-user-theming-primary-color":""},on:{"update:value":e.debouncedOnUpdate},model:{value:e.primaryColor,callback:function(r){e.primaryColor=r},expression:"primaryColor"}},[o("button",{ref:"trigger",staticClass:"color-container primary-color__trigger",style:{"background-color":e.primaryColor},attrs:{"data-user-theming-primary-color-trigger":""}},[e._v(" "+e._s(e.t("theming","Primary color"))+" "),e.loading?o("NcLoadingIcon"):o("IconColorPalette",{attrs:{size:20}})],1)]),o("NcButton",{attrs:{type:"tertiary",disabled:e.isdefaultPrimaryColor},on:{click:e.onReset},scopedSlots:e._u([{key:"icon",fn:function(){return[o("IconUndo",{attrs:{size:20}})]},proxy:!0}])},[e._v(" "+e._s(e.t("theming","Reset primary color"))+" ")])],1)},un=[],ln=gt(an,sn,un,!1,null,"7037bb4e");const cn=ln.exports,hn=Y("theming","themes",[]),pn=Y("theming","enforceTheme",""),dn=Y("theming","shortcutsDisabled",!1),fn=Y("theming","isUserThemingDisabled"),gn={name:"UserTheming",components:{ItemPreview:Zo,NcCheckboxRadioSwitch:ne,NcSettingsSection:se,BackgroundSettings:Ko,UserAppMenuSection:on,UserPrimaryColor:cn},data(){return{availableThemes:hn,enforceTheme:pn,shortcutsDisabled:dn,isUserThemingDisabled:fn}},computed:{themes(){return this.availableThemes.filter(e=>e.type===1)},fonts(){return this.availableThemes.filter(e=>e.type===2)},selectedTheme(){return this.themes.find(e=>e.enabled===!0)||this.themes[0]},description(){return t("theming","Universal access is very important to us. We follow web standards and check to make everything usable also without mouse, and assistive software such as screenreaders. We aim to be compliant with the {guidelines}Web Content Accessibility Guidelines{linkend} 2.1 on AA level, with the high contrast theme even on AAA level.").replace("{guidelines}",this.guidelinesLink).replace("{linkend}","</a>")},guidelinesLink(){return'<a target="_blank" href="https://www.w3.org/WAI/standards-guidelines/wcag/" rel="noreferrer nofollow">'},descriptionDetail(){return t("theming","If you find any issues, do not hesitate to report them on {issuetracker}our issue tracker{linkend}. And if you want to get involved, come join {designteam}our design team{linkend}!").replace("{issuetracker}",this.issuetrackerLink).replace("{designteam}",this.designteamLink).replace(/\{linkend\}/g,"</a>")},issuetrackerLink(){return'<a target="_blank" href="https://github.com/nextcloud/server/issues/" rel="noreferrer nofollow">'},designteamLink(){return'<a target="_blank" href="https://nextcloud.com/design" rel="noreferrer nofollow">'}},watch:{shortcutsDisabled(e){this.changeShortcutsDisabled(e)}},methods:{async refreshGlobalStyles(){await ue(),this.$nextTick(()=>this.$refs.primaryColor.reload())},changeTheme({enabled:e,id:o}){this.themes.forEach(r=>{if(r.id===o&&e){r.enabled=!0;return}r.enabled=!1}),this.updateBodyAttributes(),this.selectItem(e,o)},changeFont({enabled:e,id:o}){this.fonts.forEach(r=>{if(r.id===o&&e){r.enabled=!0;return}r.enabled=!1}),this.updateBodyAttributes(),this.selectItem(e,o)},async changeShortcutsDisabled(e){e?await q({url:it("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"theming",configKey:"shortcuts_disabled"}),data:{configValue:"yes"},method:"POST"}):await q({url:it("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"theming",configKey:"shortcuts_disabled"}),method:"DELETE"})},updateBodyAttributes(){const e=this.themes.filter(r=>r.enabled===!0).map(r=>r.id),o=this.fonts.filter(r=>r.enabled===!0).map(r=>r.id);this.themes.forEach(r=>{document.body.toggleAttribute("data-theme-".concat(r.id),r.enabled)}),this.fonts.forEach(r=>{document.body.toggleAttribute("data-theme-".concat(r.id),r.enabled)}),document.body.setAttribute("data-themes",[...e,...o].join(","))},async selectItem(e,o){try{e?await q({url:it("apps/theming/api/v1/theme/{themeId}/enable",{themeId:o}),method:"PUT"}):await q({url:it("apps/theming/api/v1/theme/{themeId}",{themeId:o}),method:"DELETE"})}catch(r){console.error(r,r.response),OC.Notification.showTemporary(t("theming",r.response.data.ocs.meta.message+". Unable to apply the setting."))}}}};var mn=function(){var e=this,o=e._self._c;return o("section",[o("NcSettingsSection",{staticClass:"theming",attrs:{name:e.t("theming","Appearance and accessibility settings"),"limit-width":!1}},[o("p",{domProps:{innerHTML:e._s(e.description)}}),o("p",{domProps:{innerHTML:e._s(e.descriptionDetail)}}),o("div",{staticClass:"theming__preview-list"},e._l(e.themes,function(r){return o("ItemPreview",{key:r.id,attrs:{enforced:r.id===e.enforceTheme,selected:e.selectedTheme.id===r.id,theme:r,unique:e.themes.length===1,type:"theme"},on:{change:e.changeTheme}})}),1),o("div",{staticClass:"theming__preview-list"},e._l(e.fonts,function(r){return o("ItemPreview",{key:r.id,attrs:{selected:r.enabled,theme:r,unique:e.fonts.length===1,type:"font"},on:{change:e.changeFont}})}),1)]),o("NcSettingsSection",{attrs:{name:e.t("theming","Primary color"),description:e.isUserThemingDisabled?e.t("theming","Customization has been disabled by your administrator"):e.t("theming","Set a primary color to highlight important elements. The color used for elements such as primary buttons might differ a bit as it gets adjusted to fulfill accessibility requirements.")}},[e.isUserThemingDisabled?e._e():o("UserPrimaryColor",{ref:"primaryColor",on:{"refresh-styles":e.refreshGlobalStyles}})],1),o("NcSettingsSection",{staticClass:"background",attrs:{name:e.t("theming","Background and color"),description:e.isUserThemingDisabled?e.t("theming","Customization has been disabled by your administrator"):e.t("theming","The background can be set to an image from the default set, a custom uploaded image, or a plain color.")}},[e.isUserThemingDisabled?e._e():o("BackgroundSettings",{staticClass:"background__grid",on:{"update:background":e.refreshGlobalStyles}})],1),o("NcSettingsSection",{attrs:{name:e.t("theming","Keyboard shortcuts"),description:e.t("theming","In some cases keyboard shortcuts can interfere with accessibility tools. In order to allow focusing on your tool correctly you can disable all keyboard shortcuts here. This will also disable all available shortcuts in apps.")}},[o("NcCheckboxRadioSwitch",{staticClass:"theming__preview-toggle",attrs:{checked:e.shortcutsDisabled,type:"switch"},on:{"update:checked":function(r){e.shortcutsDisabled=r},change:e.changeShortcutsDisabled}},[e._v(" "+e._s(e.t("theming","Disable all keyboard shortcuts"))+" ")])],1),o("UserAppMenuSection")],1)},bn=[],vn=gt(gn,mn,bn,!1,null,"71b62553");const yn=vn.exports;Tt.prototype.OC=OC,Tt.prototype.t=t;const _n=Tt.extend(yn),te=new _n;te.$mount("#theming"),te.$on("update:background",ue);
|