@kecan0406/ttheme 1.0.47 → 1.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ttheme.js +2 -2
- package/bin/ttheme.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/package.json +1 -1
- package/shell/adapters/_bg.zsh +28 -8
- package/shell/ttheme.zsh +3 -2
package/bin/ttheme.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as zg}from"node:module";var _g=Object.create;var{getPrototypeOf:qg,defineProperty:Fc,getOwnPropertyNames:Qg}=Object;var Yg=Object.prototype.hasOwnProperty;function Zg(e){return this[e]}var Xg,Vg,Ci=(e,n,t)=>{var r=e!=null&&typeof e==="object";if(r){var i=n?Xg??=new WeakMap:Vg??=new WeakMap,o=i.get(e);if(o)return o}t=e!=null?_g(qg(e)):{};let s=n||!e||!e.__esModule?Fc(t,"default",{value:e,enumerable:!0}):t;for(let u of Qg(e))if(!Yg.call(s,u))Fc(s,u,{get:Zg.bind(e,u),enumerable:!0});if(r)i.set(e,s);return s};var Me=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var Ke=zg(import.meta.url);var Yc=Me((kE,xi)=>{var Qc=Qc||function(e){return Buffer.from(e).toString("base64")};function um(e){var n=this,t=Math.round,r=Math.floor,i=Array(64),o=Array(64),s=Array(64),u=Array(64),c,a,h,f,l=Array(65535),d=Array(65535),g=Array(64),p=Array(64),k=[],y=0,M=7,b=Array(64),S=Array(64),m=Array(64),P=Array(256),E=Array(2048),R,N=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],H=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],A=[0,1,2,3,4,5,6,7,8,9,10,11],X=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],j=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],Le=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],C=[0,1,2,3,4,5,6,7,8,9,10,11],D=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],Oe=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function Ee(w){var T=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99];for(var W=0;W<64;W++){var U=r((T[W]*w+50)/100);if(U<1)U=1;else if(U>255)U=255;i[N[W]]=U}var Q=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99];for(var Y=0;Y<64;Y++){var se=r((Q[Y]*w+50)/100);if(se<1)se=1;else if(se>255)se=255;o[N[Y]]=se}var ue=[1,1.387039845,1.306562965,1.175875602,1,0.785694958,0.5411961,0.275899379],Fe=0;for(var ve=0;ve<8;ve++)for(var I=0;I<8;I++)s[Fe]=1/(i[N[Fe]]*ue[ve]*ue[I]*8),u[Fe]=1/(o[N[Fe]]*ue[ve]*ue[I]*8),Fe++}function ee(w,T){var W=0,U=0,Q=[];for(var Y=1;Y<=16;Y++){for(var se=1;se<=w[Y];se++)Q[T[U]]=[],Q[T[U]][0]=W,Q[T[U]][1]=Y,U++,W++;W*=2}return Q}function Ae(){c=ee(H,A),a=ee(Le,C),h=ee(X,j),f=ee(D,Oe)}function ce(){var w=1,T=2;for(var W=1;W<=15;W++){for(var U=w;U<T;U++)d[32767+U]=W,l[32767+U]=[],l[32767+U][1]=W,l[32767+U][0]=U;for(var Q=-(T-1);Q<=-w;Q++)d[32767+Q]=W,l[32767+Q]=[],l[32767+Q][1]=W,l[32767+Q][0]=T-1+Q;w<<=1,T<<=1}}function te(){for(var w=0;w<256;w++)E[w]=19595*w,E[w+256>>0]=38470*w,E[w+512>>0]=7471*w+32768,E[w+768>>0]=-11059*w,E[w+1024>>0]=-21709*w,E[w+1280>>0]=32768*w+8421375,E[w+1536>>0]=-27439*w,E[w+1792>>0]=-5329*w}function V(w){var T=w[0],W=w[1]-1;while(W>=0){if(T&1<<W)y|=1<<M;if(W--,M--,M<0){if(y==255)$(255),$(0);else $(y);M=7,y=0}}}function $(w){k.push(w)}function G(w){$(w>>8&255),$(w&255)}function me(w,T){var W,U,Q,Y,se,ue,Fe,ve,I=0,L,q=8,Re=64;for(L=0;L<q;++L){W=w[I],U=w[I+1],Q=w[I+2],Y=w[I+3],se=w[I+4],ue=w[I+5],Fe=w[I+6],ve=w[I+7];var Z=W+ve,ne=W-ve,we=U+Fe,K=U-Fe,he=Q+ue,Ce=Q-ue,Ne=Y+se,sn=Y-se,yn=Z+Ne,lt=Z-Ne,Jt=we+he,Ct=we-he;w[I]=yn+Jt,w[I+4]=yn-Jt;var kr=(Ct+lt)*0.707106781;w[I+2]=lt+kr,w[I+6]=lt-kr,yn=sn+Ce,Jt=Ce+K,Ct=K+ne;var Er=(yn-Ct)*0.382683433,Gi=0.5411961*yn+Er,yr=1.306562965*Ct+Er,Sr=Jt*0.707106781,vr=ne+Sr,Mr=ne-Sr;w[I+5]=Mr+Gi,w[I+3]=Mr-Gi,w[I+1]=vr+yr,w[I+7]=vr-yr,I+=8}I=0;for(L=0;L<q;++L){W=w[I],U=w[I+8],Q=w[I+16],Y=w[I+24],se=w[I+32],ue=w[I+40],Fe=w[I+48],ve=w[I+56];var wc=W+ve,ls=W-ve,$c=U+Fe,bc=U-Fe,kc=Q+ue,Ec=Q-ue,yc=Y+se,Kg=Y-se,Ir=wc+yc,ds=wc-yc,Ui=$c+kc,ji=$c-kc;w[I]=Ir+Ui,w[I+32]=Ir-Ui;var Sc=(ji+ds)*0.707106781;w[I+16]=ds+Sc,w[I+48]=ds-Sc,Ir=Kg+Ec,Ui=Ec+bc,ji=bc+ls;var vc=(Ir-ji)*0.382683433,Mc=0.5411961*Ir+vc,Ic=1.306562965*ji+vc,Nc=Ui*0.707106781,Oc=ls+Nc,Rc=ls-Nc;w[I+40]=Rc+Mc,w[I+24]=Rc-Mc,w[I+8]=Oc+Ic,w[I+56]=Oc-Ic,I++}var Ji;for(L=0;L<Re;++L)Ji=w[L]*T[L],g[L]=Ji>0?Ji+0.5|0:Ji-0.5|0;return g}function pe(){G(65504),G(16),$(74),$(70),$(73),$(70),$(0),$(1),$(1),$(0),G(1),G(1),$(0),$(0)}function re(w){if(!w)return;if(G(65505),w[0]===69&&w[1]===120&&w[2]===105&&w[3]===102)G(w.length+2);else G(w.length+5+2),$(69),$(120),$(105),$(102),$(0);for(var T=0;T<w.length;T++)$(w[T])}function ie(w,T){G(65472),G(17),$(8),G(T),G(w),$(3),$(1),$(17),$(0),$(2),$(17),$(1),$(3),$(17),$(1)}function z(){G(65499),G(132),$(0);for(var w=0;w<64;w++)$(i[w]);$(1);for(var T=0;T<64;T++)$(o[T])}function F(){G(65476),G(418),$(0);for(var w=0;w<16;w++)$(H[w+1]);for(var T=0;T<=11;T++)$(A[T]);$(16);for(var W=0;W<16;W++)$(X[W+1]);for(var U=0;U<=161;U++)$(j[U]);$(1);for(var Q=0;Q<16;Q++)$(Le[Q+1]);for(var Y=0;Y<=11;Y++)$(C[Y]);$(17);for(var se=0;se<16;se++)$(D[se+1]);for(var ue=0;ue<=161;ue++)$(Oe[ue])}function O(w){if(typeof w>"u"||w.constructor!==Array)return;w.forEach((T)=>{if(typeof T!=="string")return;G(65534);var W=T.length;G(W+2);var U;for(U=0;U<W;U++)$(T.charCodeAt(U))})}function Se(){G(65498),G(12),$(3),$(1),$(0),$(2),$(17),$(3),$(17),$(0),$(63),$(0)}function _(w,T,W,U,Q){var Y=Q[0],se=Q[240],ue,Fe=16,ve=63,I=64,L=me(w,T);for(var q=0;q<I;++q)p[N[q]]=L[q];var Re=p[0]-W;if(W=p[0],Re==0)V(U[0]);else ue=32767+Re,V(U[d[ue]]),V(l[ue]);var Z=63;for(;Z>0&&p[Z]==0;Z--);if(Z==0)return V(Y),W;var ne=1,we;while(ne<=Z){var K=ne;for(;p[ne]==0&&ne<=Z;++ne);var he=ne-K;if(he>=Fe){we=he>>4;for(var Ce=1;Ce<=we;++Ce)V(se);he=he&15}ue=32767+p[ne],V(Q[(he<<4)+d[ue]]),V(l[ue]),ne++}if(Z!=ve)V(Y);return W}function B(){var w=String.fromCharCode;for(var T=0;T<256;T++)P[T]=w(T)}this.encode=function(w,T){var W=new Date().getTime();if(T)on(T);k=[],y=0,M=7,G(65496),pe(),O(w.comments),re(w.exifBuffer),z(),ie(w.width,w.height),F(),Se();var U=0,Q=0,Y=0;y=0,M=7,this.encode.displayName="_encode_";var{data:se,width:ue,height:Fe}=w,ve=ue*4,I=ue*3,L,q=0,Re,Z,ne,we,K,he,Ce,Ne;while(q<Fe){L=0;while(L<ve){we=ve*q+L,K=we,he=-1,Ce=0;for(Ne=0;Ne<64;Ne++){if(Ce=Ne>>3,he=(Ne&7)*4,K=we+Ce*ve+he,q+Ce>=Fe)K-=ve*(q+1+Ce-Fe);if(L+he>=ve)K-=L+he-ve+4;Re=se[K++],Z=se[K++],ne=se[K++],b[Ne]=(E[Re]+E[Z+256>>0]+E[ne+512>>0]>>16)-128,S[Ne]=(E[Re+768>>0]+E[Z+1024>>0]+E[ne+1280>>0]>>16)-128,m[Ne]=(E[Re+1280>>0]+E[Z+1536>>0]+E[ne+1792>>0]>>16)-128}U=_(b,s,U,c,h),Q=_(S,u,Q,a,f),Y=_(m,u,Y,a,f),L+=32}q+=8}if(M>=0){var sn=[];sn[1]=M+1,sn[0]=(1<<M+1)-1,V(sn)}if(G(65497),typeof xi>"u")return new Uint8Array(k);return Buffer.from(k);var yn,lt};function on(w){if(w<=0)w=1;if(w>100)w=100;if(R==w)return;var T=0;if(w<50)T=Math.floor(5000/w);else T=Math.floor(200-w*2);Ee(T),R=w}function ln(){var w=new Date().getTime();if(!e)e=50;B(),Ae(),ce(),te(),on(e);var T=new Date().getTime()-w}ln()}if(typeof xi<"u")xi.exports=qc;else if(typeof window<"u")window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].encode=qc;function qc(e,n){if(typeof n>"u")n=50;var t=new um(n),r=t.encode(e,n);return{data:r,width:e.width,height:e.height}}});var Xc=Me((EE,Ss)=>{var ys=function(){var n=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,r=799,i=3406,o=2276,s=1567,u=3784,c=5793,a=2896;function h(){}function f(M,b){var S=0,m=[],P,E,R=16;while(R>0&&!M[R-1])R--;m.push({children:[],index:0});var N=m[0],H;for(P=0;P<R;P++){for(E=0;E<M[P];E++){N=m.pop(),N.children[N.index]=b[S];while(N.index>0){if(m.length===0)throw Error("Could not recreate Huffman Table");N=m.pop()}N.index++,m.push(N);while(m.length<=P)m.push(H={children:[],index:0}),N.children[N.index]=H.children,N=H;S++}if(P+1<R)m.push(H={children:[],index:0}),N.children[N.index]=H.children,N=H}return m[0].children}function l(M,b,S,m,P,E,R,N,H,A){var{precision:X,samplesPerLine:j,scanLines:Le,mcusPerLine:C,progressive:D,maxH:Oe,maxV:Ee}=S,ee=b,Ae=0,ce=0;function te(){if(ce>0)return ce--,Ae>>ce&1;if(Ae=M[b++],Ae==255){var I=M[b++];if(I)throw Error("unexpected marker: "+(Ae<<8|I).toString(16))}return ce=7,Ae>>>7}function V(I){var L=I,q;while((q=te())!==null){if(L=L[q],typeof L==="number")return L;if(typeof L!=="object")throw Error("invalid huffman sequence")}return null}function $(I){var L=0;while(I>0){var q=te();if(q===null)return;L=L<<1|q,I--}return L}function G(I){var L=$(I);if(L>=1<<I-1)return L;return L+(-1<<I)+1}function me(I,L){var q=V(I.huffmanTableDC),Re=q===0?0:G(q);L[0]=I.pred+=Re;var Z=1;while(Z<64){var ne=V(I.huffmanTableAC),we=ne&15,K=ne>>4;if(we===0){if(K<15)break;Z+=16;continue}Z+=K;var he=n[Z];L[he]=G(we),Z++}}function pe(I,L){var q=V(I.huffmanTableDC),Re=q===0?0:G(q)<<H;L[0]=I.pred+=Re}function re(I,L){L[0]|=te()<<H}var ie=0;function z(I,L){if(ie>0){ie--;return}var q=E,Re=R;while(q<=Re){var Z=V(I.huffmanTableAC),ne=Z&15,we=Z>>4;if(ne===0){if(we<15){ie=$(we)+(1<<we)-1;break}q+=16;continue}q+=we;var K=n[q];L[K]=G(ne)*(1<<H),q++}}var F=0,O;function Se(I,L){var q=E,Re=R,Z=0;while(q<=Re){var ne=n[q],we=L[ne]<0?-1:1;switch(F){case 0:var K=V(I.huffmanTableAC),he=K&15,Z=K>>4;if(he===0)if(Z<15)ie=$(Z)+(1<<Z),F=4;else Z=16,F=1;else{if(he!==1)throw Error("invalid ACn encoding");O=G(he),F=Z?2:3}continue;case 1:case 2:if(L[ne])L[ne]+=(te()<<H)*we;else if(Z--,Z===0)F=F==2?3:0;break;case 3:if(L[ne])L[ne]+=(te()<<H)*we;else L[ne]=O<<H,F=0;break;case 4:if(L[ne])L[ne]+=(te()<<H)*we;break}q++}if(F===4){if(ie--,ie===0)F=0}}function _(I,L,q,Re,Z){var ne=q/C|0,we=q%C,K=ne*I.v+Re,he=we*I.h+Z;if(I.blocks[K]===void 0&&A.tolerantDecoding)return;L(I,I.blocks[K][he])}function B(I,L,q){var Re=q/I.blocksPerLine|0,Z=q%I.blocksPerLine;if(I.blocks[Re]===void 0&&A.tolerantDecoding)return;L(I,I.blocks[Re][Z])}var on=m.length,ln,w,T,W,U,Q;if(D)if(E===0)Q=N===0?pe:re;else Q=N===0?z:Se;else Q=me;var Y=0,se,ue;if(on==1)ue=m[0].blocksPerLine*m[0].blocksPerColumn;else ue=C*S.mcusPerColumn;if(!P)P=ue;var Fe,ve;while(Y<ue){for(w=0;w<on;w++)m[w].pred=0;if(ie=0,on==1){ln=m[0];for(U=0;U<P;U++)B(ln,Q,Y),Y++}else for(U=0;U<P;U++){for(w=0;w<on;w++){ln=m[w],Fe=ln.h,ve=ln.v;for(T=0;T<ve;T++)for(W=0;W<Fe;W++)_(ln,Q,Y,T,W)}if(Y++,Y===ue)break}if(Y===ue)do{if(M[b]===255){if(M[b+1]!==0)break}b+=1}while(b<M.length-2);if(ce=0,se=M[b]<<8|M[b+1],se<65280)throw Error("marker was not found");if(se>=65488&&se<=65495)b+=2;else break}return b-ee}function d(M,b){var S=[],m=b.blocksPerLine,P=b.blocksPerColumn,E=m<<3,R=new Int32Array(64),N=new Uint8Array(64);function H(ee,Ae,ce){var te=b.quantizationTable,V,$,G,me,pe,re,ie,z,F,O=ce,Se;for(Se=0;Se<64;Se++)O[Se]=ee[Se]*te[Se];for(Se=0;Se<8;++Se){var _=8*Se;if(O[1+_]==0&&O[2+_]==0&&O[3+_]==0&&O[4+_]==0&&O[5+_]==0&&O[6+_]==0&&O[7+_]==0){F=c*O[0+_]+512>>10,O[0+_]=F,O[1+_]=F,O[2+_]=F,O[3+_]=F,O[4+_]=F,O[5+_]=F,O[6+_]=F,O[7+_]=F;continue}V=c*O[0+_]+128>>8,$=c*O[4+_]+128>>8,G=O[2+_],me=O[6+_],pe=a*(O[1+_]-O[7+_])+128>>8,z=a*(O[1+_]+O[7+_])+128>>8,re=O[3+_]<<4,ie=O[5+_]<<4,F=V-$+1>>1,V=V+$+1>>1,$=F,F=G*u+me*s+128>>8,G=G*s-me*u+128>>8,me=F,F=pe-ie+1>>1,pe=pe+ie+1>>1,ie=F,F=z+re+1>>1,re=z-re+1>>1,z=F,F=V-me+1>>1,V=V+me+1>>1,me=F,F=$-G+1>>1,$=$+G+1>>1,G=F,F=pe*o+z*i+2048>>12,pe=pe*i-z*o+2048>>12,z=F,F=re*r+ie*t+2048>>12,re=re*t-ie*r+2048>>12,ie=F,O[0+_]=V+z,O[7+_]=V-z,O[1+_]=$+ie,O[6+_]=$-ie,O[2+_]=G+re,O[5+_]=G-re,O[3+_]=me+pe,O[4+_]=me-pe}for(Se=0;Se<8;++Se){var B=Se;if(O[8+B]==0&&O[16+B]==0&&O[24+B]==0&&O[32+B]==0&&O[40+B]==0&&O[48+B]==0&&O[56+B]==0){F=c*ce[Se+0]+8192>>14,O[0+B]=F,O[8+B]=F,O[16+B]=F,O[24+B]=F,O[32+B]=F,O[40+B]=F,O[48+B]=F,O[56+B]=F;continue}V=c*O[0+B]+2048>>12,$=c*O[32+B]+2048>>12,G=O[16+B],me=O[48+B],pe=a*(O[8+B]-O[56+B])+2048>>12,z=a*(O[8+B]+O[56+B])+2048>>12,re=O[24+B],ie=O[40+B],F=V-$+1>>1,V=V+$+1>>1,$=F,F=G*u+me*s+2048>>12,G=G*s-me*u+2048>>12,me=F,F=pe-ie+1>>1,pe=pe+ie+1>>1,ie=F,F=z+re+1>>1,re=z-re+1>>1,z=F,F=V-me+1>>1,V=V+me+1>>1,me=F,F=$-G+1>>1,$=$+G+1>>1,G=F,F=pe*o+z*i+2048>>12,pe=pe*i-z*o+2048>>12,z=F,F=re*r+ie*t+2048>>12,re=re*t-ie*r+2048>>12,ie=F,O[0+B]=V+z,O[56+B]=V-z,O[8+B]=$+ie,O[48+B]=$-ie,O[16+B]=G+re,O[40+B]=G-re,O[24+B]=me+pe,O[32+B]=me-pe}for(Se=0;Se<64;++Se){var on=128+(O[Se]+8>>4);Ae[Se]=on<0?0:on>255?255:on}}y(E*P*8);var A,X;for(var j=0;j<P;j++){var Le=j<<3;for(A=0;A<8;A++)S.push(new Uint8Array(E));for(var C=0;C<m;C++){H(b.blocks[j][C],N,R);var D=0,Oe=C<<3;for(X=0;X<8;X++){var Ee=S[Le+X];for(A=0;A<8;A++)Ee[Oe+A]=N[D++]}}}return S}function g(M){return M<0?0:M>255?255:M}h.prototype={load:function(b){var S=new XMLHttpRequest;S.open("GET",b,!0),S.responseType="arraybuffer",S.onload=function(){var m=new Uint8Array(S.response||S.mozResponseArrayBuffer);if(this.parse(m),this.onload)this.onload()}.bind(this),S.send(null)},parse:function(b){var S=this.opts.maxResolutionInMP*1000*1000,m=0,P=b.length;function E(){var K=b[m]<<8|b[m+1];return m+=2,K}function R(){var K=E(),he=b.subarray(m,m+K-2);return m+=he.length,he}function N(K){var he=1,Ce=1,Ne,sn;for(sn in K.components)if(K.components.hasOwnProperty(sn)){if(Ne=K.components[sn],he<Ne.h)he=Ne.h;if(Ce<Ne.v)Ce=Ne.v}var yn=Math.ceil(K.samplesPerLine/8/he),lt=Math.ceil(K.scanLines/8/Ce);for(sn in K.components)if(K.components.hasOwnProperty(sn)){Ne=K.components[sn];var Jt=Math.ceil(Math.ceil(K.samplesPerLine/8)*Ne.h/he),Ct=Math.ceil(Math.ceil(K.scanLines/8)*Ne.v/Ce),kr=yn*Ne.h,Er=lt*Ne.v,Gi=Er*kr,yr=[];y(Gi*256);for(var Sr=0;Sr<Er;Sr++){var vr=[];for(var Mr=0;Mr<kr;Mr++)vr.push(new Int32Array(64));yr.push(vr)}Ne.blocksPerLine=Jt,Ne.blocksPerColumn=Ct,Ne.blocks=yr}K.maxH=he,K.maxV=Ce,K.mcusPerLine=yn,K.mcusPerColumn=lt}var H=null,A=null,X=null,j,Le,C=[],D=[],Oe=[],Ee=[],ee=E(),Ae=-1;if(this.comments=[],ee!=65496)throw Error("SOI not found");ee=E();while(ee!=65497){var ce,te,V;switch(ee){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var $=R();if(ee===65534){var G=String.fromCharCode.apply(null,$);this.comments.push(G)}if(ee===65504){if($[0]===74&&$[1]===70&&$[2]===73&&$[3]===70&&$[4]===0)H={version:{major:$[5],minor:$[6]},densityUnits:$[7],xDensity:$[8]<<8|$[9],yDensity:$[10]<<8|$[11],thumbWidth:$[12],thumbHeight:$[13],thumbData:$.subarray(14,14+3*$[12]*$[13])}}if(ee===65505){if($[0]===69&&$[1]===120&&$[2]===105&&$[3]===102&&$[4]===0)this.exifBuffer=$.subarray(5,$.length)}if(ee===65518){if($[0]===65&&$[1]===100&&$[2]===111&&$[3]===98&&$[4]===101&&$[5]===0)A={version:$[6],flags0:$[7]<<8|$[8],flags1:$[9]<<8|$[10],transformCode:$[11]}}break;case 65499:var me=E(),pe=me+m-2;while(m<pe){var re=b[m++];y(256);var ie=new Int32Array(64);if(re>>4===0)for(te=0;te<64;te++){var z=n[te];ie[z]=b[m++]}else if(re>>4===1)for(te=0;te<64;te++){var z=n[te];ie[z]=E()}else throw Error("DQT: invalid table spec");C[re&15]=ie}break;case 65472:case 65473:case 65474:E(),j={},j.extended=ee===65473,j.progressive=ee===65474,j.precision=b[m++],j.scanLines=E(),j.samplesPerLine=E(),j.components={},j.componentsOrder=[];var F=j.scanLines*j.samplesPerLine;if(F>S){var O=Math.ceil((F-S)/1e6);throw Error(`maxResolutionInMP limit exceeded by ${O}MP`)}var Se=b[m++],_,B=0,on=0;for(ce=0;ce<Se;ce++){_=b[m];var ln=b[m+1]>>4,w=b[m+1]&15,T=b[m+2];if(ln<=0||w<=0)throw Error("Invalid sampling factor, expected values above 0");j.componentsOrder.push(_),j.components[_]={h:ln,v:w,quantizationIdx:T},m+=3}N(j),D.push(j);break;case 65476:var W=E();for(ce=2;ce<W;){var U=b[m++],Q=new Uint8Array(16),Y=0;for(te=0;te<16;te++,m++)Y+=Q[te]=b[m];y(16+Y);var se=new Uint8Array(Y);for(te=0;te<Y;te++,m++)se[te]=b[m];ce+=17+Y,(U>>4===0?Ee:Oe)[U&15]=f(Q,se)}break;case 65501:E(),Le=E();break;case 65500:E(),E();break;case 65498:var ue=E(),Fe=b[m++],ve=[],I;for(ce=0;ce<Fe;ce++){I=j.components[b[m++]];var L=b[m++];I.huffmanTableDC=Ee[L>>4],I.huffmanTableAC=Oe[L&15],ve.push(I)}var q=b[m++],Re=b[m++],Z=b[m++],ne=l(b,m,j,ve,Le,q,Re,Z>>4,Z&15,this.opts);m+=ne;break;case 65535:if(b[m]!==255)m--;break;default:if(b[m-3]==255&&b[m-2]>=192&&b[m-2]<=254){m-=3;break}else if(ee===224||ee==225){if(Ae!==-1)throw Error(`first unknown JPEG marker at offset ${Ae.toString(16)}, second unknown JPEG marker ${ee.toString(16)} at offset ${(m-1).toString(16)}`);Ae=m-1;let K=E();if(b[m+K-2]===255){m+=K-2;break}}throw Error("unknown JPEG marker "+ee.toString(16))}ee=E()}if(D.length!=1)throw Error("only single frame JPEGs supported");for(var ce=0;ce<D.length;ce++){var we=D[ce].components;for(var te in we)we[te].quantizationTable=C[we[te].quantizationIdx],delete we[te].quantizationIdx}this.width=j.samplesPerLine,this.height=j.scanLines,this.jfif=H,this.adobe=A,this.components=[];for(var ce=0;ce<j.componentsOrder.length;ce++){var I=j.components[j.componentsOrder[ce]];this.components.push({lines:d(j,I),scaleX:I.h/j.maxH,scaleY:I.v/j.maxV})}},getData:function(b,S){var m=this.width/b,P=this.height/S,E,R,N,H,A,X,j,Le,C,D,Oe=0,Ee,ee,Ae,ce,te,V,$,G,me,pe,re,ie=b*S*this.components.length;y(ie);var z=new Uint8Array(ie);switch(this.components.length){case 1:E=this.components[0];for(D=0;D<S;D++){A=E.lines[0|D*E.scaleY*P];for(C=0;C<b;C++)Ee=A[0|C*E.scaleX*m],z[Oe++]=Ee}break;case 2:E=this.components[0],R=this.components[1];for(D=0;D<S;D++){A=E.lines[0|D*E.scaleY*P],X=R.lines[0|D*R.scaleY*P];for(C=0;C<b;C++)Ee=A[0|C*E.scaleX*m],z[Oe++]=Ee,Ee=X[0|C*R.scaleX*m],z[Oe++]=Ee}break;case 3:if(re=!0,this.adobe&&this.adobe.transformCode)re=!0;else if(typeof this.opts.colorTransform<"u")re=!!this.opts.colorTransform;E=this.components[0],R=this.components[1],N=this.components[2];for(D=0;D<S;D++){A=E.lines[0|D*E.scaleY*P],X=R.lines[0|D*R.scaleY*P],j=N.lines[0|D*N.scaleY*P];for(C=0;C<b;C++){if(!re)G=A[0|C*E.scaleX*m],me=X[0|C*R.scaleX*m],pe=j[0|C*N.scaleX*m];else Ee=A[0|C*E.scaleX*m],ee=X[0|C*R.scaleX*m],Ae=j[0|C*N.scaleX*m],G=g(Ee+1.402*(Ae-128)),me=g(Ee-0.3441363*(ee-128)-0.71413636*(Ae-128)),pe=g(Ee+1.772*(ee-128));z[Oe++]=G,z[Oe++]=me,z[Oe++]=pe}}break;case 4:if(!this.adobe)throw Error("Unsupported color mode (4 components)");if(re=!1,this.adobe&&this.adobe.transformCode)re=!0;else if(typeof this.opts.colorTransform<"u")re=!!this.opts.colorTransform;E=this.components[0],R=this.components[1],N=this.components[2],H=this.components[3];for(D=0;D<S;D++){A=E.lines[0|D*E.scaleY*P],X=R.lines[0|D*R.scaleY*P],j=N.lines[0|D*N.scaleY*P],Le=H.lines[0|D*H.scaleY*P];for(C=0;C<b;C++){if(!re)te=A[0|C*E.scaleX*m],V=X[0|C*R.scaleX*m],$=j[0|C*N.scaleX*m],ce=Le[0|C*H.scaleX*m];else Ee=A[0|C*E.scaleX*m],ee=X[0|C*R.scaleX*m],Ae=j[0|C*N.scaleX*m],ce=Le[0|C*H.scaleX*m],te=255-g(Ee+1.402*(Ae-128)),V=255-g(Ee-0.3441363*(ee-128)-0.71413636*(Ae-128)),$=255-g(Ee+1.772*(ee-128));z[Oe++]=255-te,z[Oe++]=255-V,z[Oe++]=255-$,z[Oe++]=255-ce}}break;default:throw Error("Unsupported color mode")}return z},copyToImageData:function(b,S){var{width:m,height:P,data:E}=b,R=this.getData(m,P),N=0,H=0,A,X,j,Le,C,D,Oe,Ee,ee;switch(this.components.length){case 1:for(X=0;X<P;X++)for(A=0;A<m;A++)if(j=R[N++],E[H++]=j,E[H++]=j,E[H++]=j,S)E[H++]=255;break;case 3:for(X=0;X<P;X++)for(A=0;A<m;A++)if(Oe=R[N++],Ee=R[N++],ee=R[N++],E[H++]=Oe,E[H++]=Ee,E[H++]=ee,S)E[H++]=255;break;case 4:for(X=0;X<P;X++)for(A=0;A<m;A++)if(C=R[N++],D=R[N++],j=R[N++],Le=R[N++],Oe=255-g(C*(1-Le/255)+Le),Ee=255-g(D*(1-Le/255)+Le),ee=255-g(j*(1-Le/255)+Le),E[H++]=Oe,E[H++]=Ee,E[H++]=ee,S)E[H++]=255;break;default:throw Error("Unsupported color mode")}}};var p=0,k=0;function y(M=0){var b=p+M;if(b>k){var S=Math.ceil((b-k)/1024/1024);throw Error(`maxMemoryUsageInMB limit exceeded by at least ${S}MB`)}p=b}return h.resetMaxMemoryUsage=function(M){p=0,k=M},h.getBytesAllocated=function(){return p},h.requestMemoryAllocation=y,h}();if(typeof Ss<"u")Ss.exports=Zc;else if(typeof window<"u")window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].decode=Zc;function Zc(e,n={}){var t={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512},r={...t,...n},i=new Uint8Array(e),o=new ys;o.opts=r,ys.resetMaxMemoryUsage(r.maxMemoryUsageInMB*1024*1024),o.parse(i);var s=r.formatAsRGBA?4:3,u=o.width*o.height*s;try{ys.requestMemoryAllocation(u);var c={width:o.width,height:o.height,exifBuffer:o.exifBuffer,data:r.useTArray?new Uint8Array(u):Buffer.alloc(u)};if(o.comments.length>0)c.comments=o.comments}catch(a){if(a instanceof RangeError)throw Error("Could not allocate enough memory for the image. Required: "+u);if(a instanceof ReferenceError){if(a.message==="Buffer is not defined")throw Error("Buffer is not globally defined in this environment. Consider setting useTArray to true")}throw a}return o.copyToImageData(c,r.formatAsRGBA),c}});var zc=Me((yE,Vc)=>{var cm=Yc(),am=Xc();Vc.exports={encode:cm,decode:am}});var vs=Me((SE,Dc)=>{var hm=Ke("util"),Bc=Ke("stream"),mn=Dc.exports=function(){Bc.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};hm.inherits(mn,Bc);mn.prototype.read=function(e,n){this._reads.push({length:Math.abs(e),allowLess:e<0,func:n}),process.nextTick(function(){if(this._process(),this._paused&&this._reads&&this._reads.length>0)this._paused=!1,this.emit("drain")}.bind(this))};mn.prototype.write=function(e,n){if(!this.writable)return this.emit("error",Error("Stream not writable")),!1;let t;if(Buffer.isBuffer(e))t=e;else t=Buffer.from(e,n||this._encoding);if(this._buffers.push(t),this._buffered+=t.length,this._process(),this._reads&&this._reads.length===0)this._paused=!0;return this.writable&&!this._paused};mn.prototype.end=function(e,n){if(e)this.write(e,n);if(this.writable=!1,!this._buffers)return;if(this._buffers.length===0)this._end();else this._buffers.push(null),this._process()};mn.prototype.destroySoon=mn.prototype.end;mn.prototype._end=function(){if(this._reads.length>0)this.emit("error",Error("Unexpected end of input"));this.destroy()};mn.prototype.destroy=function(){if(!this._buffers)return;this.writable=!1,this._reads=null,this._buffers=null,this.emit("close")};mn.prototype._processReadAllowingLess=function(e){this._reads.shift();let n=this._buffers[0];if(n.length>e.length)this._buffered-=e.length,this._buffers[0]=n.slice(e.length),e.func.call(this,n.slice(0,e.length));else this._buffered-=n.length,this._buffers.shift(),e.func.call(this,n)};mn.prototype._processRead=function(e){this._reads.shift();let n=0,t=0,r=Buffer.alloc(e.length);while(n<e.length){let i=this._buffers[t++],o=Math.min(i.length,e.length-n);if(i.copy(r,n,0,o),n+=o,o!==i.length)this._buffers[--t]=i.slice(o)}if(t>0)this._buffers.splice(0,t);this._buffered-=e.length,e.func.call(this,r)};mn.prototype._process=function(){try{while(this._buffered>0&&this._reads&&this._reads.length>0){let e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else if(this._buffered>=e.length)this._processRead(e);else break}if(this._buffers&&!this.writable)this._end()}catch(e){this.emit("error",e)}}});var Ms=Me((fm)=>{var zn=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];fm.getImagePasses=function(e,n){let t=[],r=e%8,i=n%8,o=(e-r)/8,s=(n-i)/8;for(let u=0;u<zn.length;u++){let c=zn[u],a=o*c.x.length,h=s*c.y.length;for(let f=0;f<c.x.length;f++)if(c.x[f]<r)a++;else break;for(let f=0;f<c.y.length;f++)if(c.y[f]<i)h++;else break;if(a>0&&h>0)t.push({width:a,height:h,index:u})}return t};fm.getInterlaceIterator=function(e){return function(n,t,r){let i=n%zn[r].x.length,o=(n-i)/zn[r].x.length*8+zn[r].x[i],s=t%zn[r].y.length,u=(t-s)/zn[r].y.length*8+zn[r].y[s];return o*4+u*e*4}}});var Is=Me((ME,xc)=>{xc.exports=function(n,t,r){let i=n+t-r,o=Math.abs(i-n),s=Math.abs(i-t),u=Math.abs(i-r);if(o<=s&&o<=u)return n;if(s<=u)return t;return r}});var Ns=Me((IE,na)=>{var gm=Ms(),mm=Is();function ea(e,n,t){let r=e*n;if(t!==8)r=Math.ceil(r/(8/t));return r}var Qt=na.exports=function(e,n){let{width:t,height:r,interlace:i,bpp:o,depth:s}=e;if(this.read=n.read,this.write=n.write,this.complete=n.complete,this._imageIndex=0,this._images=[],i){let u=gm.getImagePasses(t,r);for(let c=0;c<u.length;c++)this._images.push({byteWidth:ea(u[c].width,o,s),height:u[c].height,lineIndex:0})}else this._images.push({byteWidth:ea(t,o,s),height:r,lineIndex:0});if(s===8)this._xComparison=o;else if(s===16)this._xComparison=o*2;else this._xComparison=1};Qt.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))};Qt.prototype._unFilterType1=function(e,n,t){let r=this._xComparison,i=r-1;for(let o=0;o<t;o++){let s=e[1+o],u=o>i?n[o-r]:0;n[o]=s+u}};Qt.prototype._unFilterType2=function(e,n,t){let r=this._lastLine;for(let i=0;i<t;i++){let o=e[1+i],s=r?r[i]:0;n[i]=o+s}};Qt.prototype._unFilterType3=function(e,n,t){let r=this._xComparison,i=r-1,o=this._lastLine;for(let s=0;s<t;s++){let u=e[1+s],c=o?o[s]:0,a=s>i?n[s-r]:0,h=Math.floor((a+c)/2);n[s]=u+h}};Qt.prototype._unFilterType4=function(e,n,t){let r=this._xComparison,i=r-1,o=this._lastLine;for(let s=0;s<t;s++){let u=e[1+s],c=o?o[s]:0,a=s>i?n[s-r]:0,h=s>i&&o?o[s-r]:0,f=mm(a,c,h);n[s]=u+f}};Qt.prototype._reverseFilterLine=function(e){let n=e[0],t,r=this._images[this._imageIndex],i=r.byteWidth;if(n===0)t=e.slice(1,i+1);else switch(t=Buffer.alloc(i),n){case 1:this._unFilterType1(e,t,i);break;case 2:this._unFilterType2(e,t,i);break;case 3:this._unFilterType3(e,t,i);break;case 4:this._unFilterType4(e,t,i);break;default:throw Error("Unrecognised filter type - "+n)}if(this.write(t),r.lineIndex++,r.lineIndex>=r.height)this._lastLine=null,this._imageIndex++,r=this._images[this._imageIndex];else this._lastLine=t;if(r)this.read(r.byteWidth+1,this._reverseFilterLine.bind(this));else this._lastLine=null,this.complete()}});var ia=Me((NE,ra)=>{var pm=Ke("util"),ta=vs(),wm=Ns(),$m=ra.exports=function(e){ta.call(this);let n=[],t=this;this._filter=new wm(e,{read:this.read.bind(this),write:function(r){n.push(r)},complete:function(){t.emit("complete",Buffer.concat(n))}}),this._filter.start()};pm.inherits($m,ta)});var Yt=Me((OE,oa)=>{oa.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}});var Fs=Me((RE,sa)=>{var Os=[];(function(){for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)if(n&1)n=3988292384^n>>>1;else n=n>>>1;Os[e]=n}})();var Rs=sa.exports=function(){this._crc=-1};Rs.prototype.write=function(e){for(let n=0;n<e.length;n++)this._crc=Os[(this._crc^e[n])&255]^this._crc>>>8;return!0};Rs.prototype.crc32=function(){return this._crc^-1};Rs.crc32=function(e){let n=-1;for(let t=0;t<e.length;t++)n=Os[(n^e[t])&255]^n>>>8;return n^-1}});var Ps=Me((FE,ua)=>{var je=Yt(),bm=Fs(),Je=ua.exports=function(e,n){this._options=e,e.checkCRC=e.checkCRC!==!1,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[je.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[je.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[je.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[je.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[je.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[je.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=n.read,this.error=n.error,this.metadata=n.metadata,this.gamma=n.gamma,this.transColor=n.transColor,this.palette=n.palette,this.parsed=n.parsed,this.inflateData=n.inflateData,this.finished=n.finished,this.simpleTransparency=n.simpleTransparency,this.headersFinished=n.headersFinished||function(){}};Je.prototype.start=function(){this.read(je.PNG_SIGNATURE.length,this._parseSignature.bind(this))};Je.prototype._parseSignature=function(e){let n=je.PNG_SIGNATURE;for(let t=0;t<n.length;t++)if(e[t]!==n[t]){this.error(Error("Invalid file signature"));return}this.read(8,this._parseChunkBegin.bind(this))};Je.prototype._parseChunkBegin=function(e){let n=e.readUInt32BE(0),t=e.readUInt32BE(4),r="";for(let o=4;o<8;o++)r+=String.fromCharCode(e[o]);let i=Boolean(e[4]&32);if(!this._hasIHDR&&t!==je.TYPE_IHDR){this.error(Error("Expected IHDR on beggining"));return}if(this._crc=new bm,this._crc.write(Buffer.from(r)),this._chunks[t])return this._chunks[t](n);if(!i){this.error(Error("Unsupported critical chunk type "+r));return}this.read(n+4,this._skipChunk.bind(this))};Je.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))};Je.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))};Je.prototype._parseChunkEnd=function(e){let n=e.readInt32BE(0),t=this._crc.crc32();if(this._options.checkCRC&&t!==n){this.error(Error("Crc error - "+n+" - "+t));return}if(!this._hasIEND)this.read(8,this._parseChunkBegin.bind(this))};Je.prototype._handleIHDR=function(e){this.read(e,this._parseIHDR.bind(this))};Je.prototype._parseIHDR=function(e){this._crc.write(e);let n=e.readUInt32BE(0),t=e.readUInt32BE(4),r=e[8],i=e[9],o=e[10],s=e[11],u=e[12];if(r!==8&&r!==4&&r!==2&&r!==1&&r!==16){this.error(Error("Unsupported bit depth "+r));return}if(!(i in je.COLORTYPE_TO_BPP_MAP)){this.error(Error("Unsupported color type"));return}if(o!==0){this.error(Error("Unsupported compression method"));return}if(s!==0){this.error(Error("Unsupported filter method"));return}if(u!==0&&u!==1){this.error(Error("Unsupported interlace method"));return}this._colorType=i;let c=je.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:n,height:t,depth:r,interlace:Boolean(u),palette:Boolean(i&je.COLORTYPE_PALETTE),color:Boolean(i&je.COLORTYPE_COLOR),alpha:Boolean(i&je.COLORTYPE_ALPHA),bpp:c,colorType:i}),this._handleChunkEnd()};Je.prototype._handlePLTE=function(e){this.read(e,this._parsePLTE.bind(this))};Je.prototype._parsePLTE=function(e){this._crc.write(e);let n=Math.floor(e.length/3);for(let t=0;t<n;t++)this._palette.push([e[t*3],e[t*3+1],e[t*3+2],255]);this.palette(this._palette),this._handleChunkEnd()};Je.prototype._handleTRNS=function(e){this.simpleTransparency(),this.read(e,this._parseTRNS.bind(this))};Je.prototype._parseTRNS=function(e){if(this._crc.write(e),this._colorType===je.COLORTYPE_PALETTE_COLOR){if(this._palette.length===0){this.error(Error("Transparency chunk must be after palette"));return}if(e.length>this._palette.length){this.error(Error("More transparent colors than palette size"));return}for(let n=0;n<e.length;n++)this._palette[n][3]=e[n];this.palette(this._palette)}if(this._colorType===je.COLORTYPE_GRAYSCALE)this.transColor([e.readUInt16BE(0)]);if(this._colorType===je.COLORTYPE_COLOR)this.transColor([e.readUInt16BE(0),e.readUInt16BE(2),e.readUInt16BE(4)]);this._handleChunkEnd()};Je.prototype._handleGAMA=function(e){this.read(e,this._parseGAMA.bind(this))};Je.prototype._parseGAMA=function(e){this._crc.write(e),this.gamma(e.readUInt32BE(0)/je.GAMMA_DIVISION),this._handleChunkEnd()};Je.prototype._handleIDAT=function(e){if(!this._emittedHeadersFinished)this._emittedHeadersFinished=!0,this.headersFinished();this.read(-e,this._parseIDAT.bind(this,e))};Je.prototype._parseIDAT=function(e,n){if(this._crc.write(n),this._colorType===je.COLORTYPE_PALETTE_COLOR&&this._palette.length===0)throw Error("Expected palette not found");this.inflateData(n);let t=e-n.length;if(t>0)this._handleIDAT(t);else this._handleChunkEnd()};Je.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))};Je.prototype._parseIEND=function(e){if(this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished)this.finished()}});var Hs=Me((Mm)=>{var ca=Ms(),km=[function(){},function(e,n,t,r){if(r===n.length)throw Error("Ran out of data");let i=n[r];e[t]=i,e[t+1]=i,e[t+2]=i,e[t+3]=255},function(e,n,t,r){if(r+1>=n.length)throw Error("Ran out of data");let i=n[r];e[t]=i,e[t+1]=i,e[t+2]=i,e[t+3]=n[r+1]},function(e,n,t,r){if(r+2>=n.length)throw Error("Ran out of data");e[t]=n[r],e[t+1]=n[r+1],e[t+2]=n[r+2],e[t+3]=255},function(e,n,t,r){if(r+3>=n.length)throw Error("Ran out of data");e[t]=n[r],e[t+1]=n[r+1],e[t+2]=n[r+2],e[t+3]=n[r+3]}],Em=[function(){},function(e,n,t,r){let i=n[0];e[t]=i,e[t+1]=i,e[t+2]=i,e[t+3]=r},function(e,n,t){let r=n[0];e[t]=r,e[t+1]=r,e[t+2]=r,e[t+3]=n[1]},function(e,n,t,r){e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=r},function(e,n,t){e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3]}];function ym(e,n){let t=[],r=0;function i(){if(r===e.length)throw Error("Ran out of data");let o=e[r];r++;let s,u,c,a,h,f,l,d;switch(n){default:throw Error("unrecognised depth");case 16:l=e[r],r++,t.push((o<<8)+l);break;case 4:l=o&15,d=o>>4,t.push(d,l);break;case 2:h=o&3,f=o>>2&3,l=o>>4&3,d=o>>6&3,t.push(d,l,f,h);break;case 1:s=o&1,u=o>>1&1,c=o>>2&1,a=o>>3&1,h=o>>4&1,f=o>>5&1,l=o>>6&1,d=o>>7&1,t.push(d,l,f,h,a,c,u,s);break}}return{get:function(o){while(t.length<o)i();let s=t.slice(0,o);return t=t.slice(o),s},resetAfterLine:function(){t.length=0},end:function(){if(r!==e.length)throw Error("extra data found")}}}function Sm(e,n,t,r,i,o){let{width:s,height:u,index:c}=e;for(let a=0;a<u;a++)for(let h=0;h<s;h++){let f=t(h,a,c);km[r](n,i,f,o),o+=r}return o}function vm(e,n,t,r,i,o){let{width:s,height:u,index:c}=e;for(let a=0;a<u;a++){for(let h=0;h<s;h++){let f=i.get(r),l=t(h,a,c);Em[r](n,f,l,o)}i.resetAfterLine()}}Mm.dataToBitMap=function(e,n){let{width:t,height:r,depth:i,bpp:o,interlace:s}=n,u;if(i!==8)u=ym(e,i);let c;if(i<=8)c=Buffer.alloc(t*r*4);else c=new Uint16Array(t*r*4);let a=Math.pow(2,i)-1,h=0,f,l;if(s)f=ca.getImagePasses(t,r),l=ca.getInterlaceIterator(t,r);else{let d=0;l=function(){let g=d;return d+=4,g},f=[{width:t,height:r}]}for(let d=0;d<f.length;d++)if(i===8)h=Sm(f[d],c,l,o,e,h);else vm(f[d],c,l,o,u,a);if(i===8){if(h!==e.length)throw Error("extra data found")}else u.end();return c}});var Ls=Me((HE,aa)=>{function Nm(e,n,t,r,i){let o=0;for(let s=0;s<r;s++)for(let u=0;u<t;u++){let c=i[e[o]];if(!c)throw Error("index "+e[o]+" not in palette");for(let a=0;a<4;a++)n[o+a]=c[a];o+=4}}function Om(e,n,t,r,i){let o=0;for(let s=0;s<r;s++)for(let u=0;u<t;u++){let c=!1;if(i.length===1){if(i[0]===e[o])c=!0}else if(i[0]===e[o]&&i[1]===e[o+1]&&i[2]===e[o+2])c=!0;if(c)for(let a=0;a<4;a++)n[o+a]=0;o+=4}}function Rm(e,n,t,r,i){let o=255,s=Math.pow(2,i)-1,u=0;for(let c=0;c<r;c++)for(let a=0;a<t;a++){for(let h=0;h<4;h++)n[u+h]=Math.floor(e[u+h]*o/s+0.5);u+=4}}aa.exports=function(e,n,t=!1){let{depth:r,width:i,height:o,colorType:s,transColor:u,palette:c}=n,a=e;if(s===3)Nm(e,a,i,o,c);else{if(u)Om(e,a,i,o,u);if(r!==8&&!t){if(r===16)a=Buffer.alloc(i*o*4);Rm(e,a,i,o,r)}}return a}});var la=Me((LE,fa)=>{var Fm=Ke("util"),As=Ke("zlib"),ha=vs(),Pm=ia(),Hm=Ps(),Lm=Hs(),Am=Ls(),Sn=fa.exports=function(e){ha.call(this),this._parser=new Hm(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};Fm.inherits(Sn,ha);Sn.prototype._handleError=function(e){if(this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy)this._inflate.destroy();if(this._filter)this._filter.destroy(),this._filter.on("error",function(){});this.errord=!0};Sn.prototype._inflateData=function(e){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=As.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let t=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,r=Math.max(t,As.Z_MIN_CHUNK);this._inflate=As.createInflate({chunkSize:r});let i=t,o=this.emit.bind(this,"error");this._inflate.on("error",function(u){if(!i)return;o(u)}),this._filter.on("complete",this._complete.bind(this));let s=this._filter.write.bind(this._filter);this._inflate.on("data",function(u){if(!i)return;if(u.length>i)u=u.slice(0,i);i-=u.length,s(u)}),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(e)};Sn.prototype._handleMetaData=function(e){this._metaData=e,this._bitmapInfo=Object.create(e),this._filter=new Pm(this._bitmapInfo)};Sn.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e};Sn.prototype._handlePalette=function(e){this._bitmapInfo.palette=e};Sn.prototype._simpleTransparency=function(){this._metaData.alpha=!0};Sn.prototype._headersFinished=function(){this.emit("metadata",this._metaData)};Sn.prototype._finished=function(){if(this.errord)return;if(!this._inflate)this.emit("error","No Inflate block");else this._inflate.end()};Sn.prototype._complete=function(e){if(this.errord)return;let n;try{let t=Lm.dataToBitMap(e,this._bitmapInfo);n=Am(t,this._bitmapInfo,this._options.skipRescale),t=null}catch(t){this._handleError(t);return}this.emit("parsed",n)}});var ga=Me((AE,da)=>{var un=Yt();da.exports=function(e,n,t,r){let i=[un.COLORTYPE_COLOR_ALPHA,un.COLORTYPE_ALPHA].indexOf(r.colorType)!==-1;if(r.colorType===r.inputColorType){let g=function(){let p=new ArrayBuffer(2);return new DataView(p).setInt16(0,256,!0),new Int16Array(p)[0]!==256}();if(r.bitDepth===8||r.bitDepth===16&&g)return e}let o=r.bitDepth!==16?e:new Uint16Array(e.buffer),s=255,u=un.COLORTYPE_TO_BPP_MAP[r.inputColorType];if(u===4&&!r.inputHasAlpha)u=3;let c=un.COLORTYPE_TO_BPP_MAP[r.colorType];if(r.bitDepth===16)s=65535,c*=2;let a=Buffer.alloc(n*t*c),h=0,f=0,l=r.bgColor||{};if(l.red===void 0)l.red=s;if(l.green===void 0)l.green=s;if(l.blue===void 0)l.blue=s;function d(){let g,p,k,y=s;switch(r.inputColorType){case un.COLORTYPE_COLOR_ALPHA:y=o[h+3],g=o[h],p=o[h+1],k=o[h+2];break;case un.COLORTYPE_COLOR:g=o[h],p=o[h+1],k=o[h+2];break;case un.COLORTYPE_ALPHA:y=o[h+1],g=o[h],p=g,k=g;break;case un.COLORTYPE_GRAYSCALE:g=o[h],p=g,k=g;break;default:throw Error("input color type:"+r.inputColorType+" is not supported at present")}if(r.inputHasAlpha){if(!i)y/=s,g=Math.min(Math.max(Math.round((1-y)*l.red+y*g),0),s),p=Math.min(Math.max(Math.round((1-y)*l.green+y*p),0),s),k=Math.min(Math.max(Math.round((1-y)*l.blue+y*k),0),s)}return{red:g,green:p,blue:k,alpha:y}}for(let g=0;g<t;g++)for(let p=0;p<n;p++){let k=d(o,h);switch(r.colorType){case un.COLORTYPE_COLOR_ALPHA:case un.COLORTYPE_COLOR:if(r.bitDepth===8){if(a[f]=k.red,a[f+1]=k.green,a[f+2]=k.blue,i)a[f+3]=k.alpha}else if(a.writeUInt16BE(k.red,f),a.writeUInt16BE(k.green,f+2),a.writeUInt16BE(k.blue,f+4),i)a.writeUInt16BE(k.alpha,f+6);break;case un.COLORTYPE_ALPHA:case un.COLORTYPE_GRAYSCALE:{let y=(k.red+k.green+k.blue)/3;if(r.bitDepth===8){if(a[f]=y,i)a[f+1]=k.alpha}else if(a.writeUInt16BE(y,f),i)a.writeUInt16BE(k.alpha,f+2);break}default:throw Error("unrecognised color Type "+r.colorType)}h+=u,f+=c}return a}});var wa=Me((TE,pa)=>{var ma=Is();function Tm(e,n,t,r,i){for(let o=0;o<t;o++)r[i+o]=e[n+o]}function Gm(e,n,t){let r=0,i=n+t;for(let o=n;o<i;o++)r+=Math.abs(e[o]);return r}function Um(e,n,t,r,i,o){for(let s=0;s<t;s++){let u=s>=o?e[n+s-o]:0,c=e[n+s]-u;r[i+s]=c}}function jm(e,n,t,r){let i=0;for(let o=0;o<t;o++){let s=o>=r?e[n+o-r]:0,u=e[n+o]-s;i+=Math.abs(u)}return i}function Jm(e,n,t,r,i){for(let o=0;o<t;o++){let s=n>0?e[n+o-t]:0,u=e[n+o]-s;r[i+o]=u}}function Cm(e,n,t){let r=0,i=n+t;for(let o=n;o<i;o++){let s=n>0?e[o-t]:0,u=e[o]-s;r+=Math.abs(u)}return r}function Wm(e,n,t,r,i,o){for(let s=0;s<t;s++){let u=s>=o?e[n+s-o]:0,c=n>0?e[n+s-t]:0,a=e[n+s]-(u+c>>1);r[i+s]=a}}function Km(e,n,t,r){let i=0;for(let o=0;o<t;o++){let s=o>=r?e[n+o-r]:0,u=n>0?e[n+o-t]:0,c=e[n+o]-(s+u>>1);i+=Math.abs(c)}return i}function _m(e,n,t,r,i,o){for(let s=0;s<t;s++){let u=s>=o?e[n+s-o]:0,c=n>0?e[n+s-t]:0,a=n>0&&s>=o?e[n+s-(t+o)]:0,h=e[n+s]-ma(u,c,a);r[i+s]=h}}function qm(e,n,t,r){let i=0;for(let o=0;o<t;o++){let s=o>=r?e[n+o-r]:0,u=n>0?e[n+o-t]:0,c=n>0&&o>=r?e[n+o-(t+r)]:0,a=e[n+o]-ma(s,u,c);i+=Math.abs(a)}return i}var Qm={0:Tm,1:Um,2:Jm,3:Wm,4:_m},Ym={0:Gm,1:jm,2:Cm,3:Km,4:qm};pa.exports=function(e,n,t,r,i){let o;if(!("filterType"in r)||r.filterType===-1)o=[0,1,2,3,4];else if(typeof r.filterType==="number")o=[r.filterType];else throw Error("unrecognised filter types");if(r.bitDepth===16)i*=2;let s=n*i,u=0,c=0,a=Buffer.alloc((s+1)*t),h=o[0];for(let f=0;f<t;f++){if(o.length>1){let l=1/0;for(let d=0;d<o.length;d++){let g=Ym[o[d]](e,c,s,i);if(g<l)h=o[d],l=g}}a[u]=h,u++,Qm[h](e,c,s,a,u,i),u+=s,c+=s}return a}});var Ts=Me((GE,$a)=>{var qe=Yt(),Zm=Fs(),Xm=ga(),Vm=wa(),zm=Ke("zlib"),Bn=$a.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=e.deflateLevel!=null?e.deflateLevel:9,e.deflateStrategy=e.deflateStrategy!=null?e.deflateStrategy:3,e.inputHasAlpha=e.inputHasAlpha!=null?e.inputHasAlpha:!0,e.deflateFactory=e.deflateFactory||zm.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType=typeof e.colorType==="number"?e.colorType:qe.COLORTYPE_COLOR_ALPHA,e.inputColorType=typeof e.inputColorType==="number"?e.inputColorType:qe.COLORTYPE_COLOR_ALPHA,[qe.COLORTYPE_GRAYSCALE,qe.COLORTYPE_COLOR,qe.COLORTYPE_COLOR_ALPHA,qe.COLORTYPE_ALPHA].indexOf(e.colorType)===-1)throw Error("option color type:"+e.colorType+" is not supported at present");if([qe.COLORTYPE_GRAYSCALE,qe.COLORTYPE_COLOR,qe.COLORTYPE_COLOR_ALPHA,qe.COLORTYPE_ALPHA].indexOf(e.inputColorType)===-1)throw Error("option input color type:"+e.inputColorType+" is not supported at present");if(e.bitDepth!==8&&e.bitDepth!==16)throw Error("option bit depth:"+e.bitDepth+" is not supported at present")};Bn.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}};Bn.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())};Bn.prototype.filterData=function(e,n,t){let r=Xm(e,n,t,this._options),i=qe.COLORTYPE_TO_BPP_MAP[this._options.colorType];return Vm(r,n,t,this._options,i)};Bn.prototype._packChunk=function(e,n){let t=n?n.length:0,r=Buffer.alloc(t+12);if(r.writeUInt32BE(t,0),r.writeUInt32BE(e,4),n)n.copy(r,8);return r.writeInt32BE(Zm.crc32(r.slice(4,r.length-4)),r.length-4),r};Bn.prototype.packGAMA=function(e){let n=Buffer.alloc(4);return n.writeUInt32BE(Math.floor(e*qe.GAMMA_DIVISION),0),this._packChunk(qe.TYPE_gAMA,n)};Bn.prototype.packIHDR=function(e,n){let t=Buffer.alloc(13);return t.writeUInt32BE(e,0),t.writeUInt32BE(n,4),t[8]=this._options.bitDepth,t[9]=this._options.colorType,t[10]=0,t[11]=0,t[12]=0,this._packChunk(qe.TYPE_IHDR,t)};Bn.prototype.packIDAT=function(e){return this._packChunk(qe.TYPE_IDAT,e)};Bn.prototype.packIEND=function(){return this._packChunk(qe.TYPE_IEND,null)}});var ya=Me((UE,Ea)=>{var Bm=Ke("util"),ba=Ke("stream"),Dm=Yt(),xm=Ts(),ka=Ea.exports=function(e){ba.call(this);let n=e||{};this._packer=new xm(n),this._deflate=this._packer.createDeflate(),this.readable=!0};Bm.inherits(ka,ba);ka.prototype.pack=function(e,n,t,r){if(this.emit("data",Buffer.from(Dm.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(n,t)),r)this.emit("data",this._packer.packGAMA(r));let i=this._packer.filterData(e,n,t);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(o){this.emit("data",this._packer.packIDAT(o))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(i)}});var Oa=Me((Pr,Na)=>{var Sa=Ke("assert").ok,Zt=Ke("zlib"),ep=Ke("util"),va=Ke("buffer").kMaxLength;function mt(e){if(!(this instanceof mt))return new mt(e);if(e&&e.chunkSize<Zt.Z_MIN_CHUNK)e.chunkSize=Zt.Z_MIN_CHUNK;if(Zt.Inflate.call(this,e),this._offset=this._offset===void 0?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,e&&e.maxLength!=null)this._maxLength=e.maxLength}function np(e){return new mt(e)}function Ma(e,n){if(n)process.nextTick(n);if(!e._handle)return;e._handle.close(),e._handle=null}mt.prototype._processChunk=function(e,n,t){if(typeof t==="function")return Zt.Inflate._processChunk.call(this,e,n,t);let r=this,i=e&&e.length,o=this._chunkSize-this._offset,s=this._maxLength,u=0,c=[],a=0,h;this.on("error",function(g){h=g});function f(g,p){if(r._hadError)return;let k=o-p;if(Sa(k>=0,"have should not go down"),k>0){let y=r._buffer.slice(r._offset,r._offset+k);if(r._offset+=k,y.length>s)y=y.slice(0,s);if(c.push(y),a+=y.length,s-=y.length,s===0)return!1}if(p===0||r._offset>=r._chunkSize)o=r._chunkSize,r._offset=0,r._buffer=Buffer.allocUnsafe(r._chunkSize);if(p===0)return u+=i-g,i=g,!0;return!1}Sa(this._handle,"zlib binding closed");let l;do l=this._handle.writeSync(n,e,u,i,this._buffer,this._offset,o),l=l||this._writeState;while(!this._hadError&&f(l[0],l[1]));if(this._hadError)throw h;if(a>=va)throw Ma(this),RangeError("Cannot create final Buffer. It would be larger than 0x"+va.toString(16)+" bytes");let d=Buffer.concat(c,a);return Ma(this),d};ep.inherits(mt,Zt.Inflate);function tp(e,n){if(typeof n==="string")n=Buffer.from(n);if(!(n instanceof Buffer))throw TypeError("Not a string or buffer");let t=e._finishFlushFlag;if(t==null)t=Zt.Z_FINISH;return e._processChunk(n,t)}function Ia(e,n){return tp(new mt(n),e)}Na.exports=Pr=Ia;Pr.Inflate=mt;Pr.createInflate=np;Pr.inflateSync=Ia});var Gs=Me((jE,Fa)=>{var Ra=Fa.exports=function(e){this._buffer=e,this._reads=[]};Ra.prototype.read=function(e,n){this._reads.push({length:Math.abs(e),allowLess:e<0,func:n})};Ra.prototype.process=function(){while(this._reads.length>0&&this._buffer.length){let e=this._reads[0];if(this._buffer.length&&(this._buffer.length>=e.length||e.allowLess)){this._reads.shift();let n=this._buffer;this._buffer=n.slice(e.length),e.func.call(this,n.slice(0,e.length))}else break}if(this._reads.length>0)throw Error("There are some read requests waitng on finished stream");if(this._buffer.length>0)throw Error("unrecognised content at end of stream")}});var Pa=Me((op)=>{var rp=Gs(),ip=Ns();op.process=function(e,n){let t=[],r=new rp(e);return new ip(n,{read:r.read.bind(r),write:function(o){t.push(o)},complete:function(){}}).start(),r.process(),Buffer.concat(t)}});var Ta=Me((CE,Aa)=>{var Ha=!0,La=Ke("zlib"),up=Oa();if(!La.deflateSync)Ha=!1;var cp=Gs(),ap=Pa(),hp=Ps(),fp=Hs(),lp=Ls();Aa.exports=function(e,n){if(!Ha)throw Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let t;function r(S){t=S}let i;function o(S){i=S}function s(S){i.transColor=S}function u(S){i.palette=S}function c(){i.alpha=!0}let a;function h(S){a=S}let f=[];function l(S){f.push(S)}let d=new cp(e);if(new hp(n,{read:d.read.bind(d),error:r,metadata:o,gamma:h,palette:u,transColor:s,inflateData:l,simpleTransparency:c}).start(),d.process(),t)throw t;let p=Buffer.concat(f);f.length=0;let k;if(i.interlace)k=La.inflateSync(p);else{let m=((i.width*i.bpp*i.depth+7>>3)+1)*i.height;k=up(p,{chunkSize:m,maxLength:m})}if(p=null,!k||!k.length)throw Error("bad png - invalid inflate data response");let y=ap.process(k,i);p=null;let M=fp.dataToBitMap(y,i);y=null;let b=lp(M,i,n.skipRescale);return i.data=b,i.gamma=a||0,i}});var Ja=Me((WE,ja)=>{var Ga=!0,Ua=Ke("zlib");if(!Ua.deflateSync)Ga=!1;var dp=Yt(),gp=Ts();ja.exports=function(e,n){if(!Ga)throw Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let r=new gp(n||{}),i=[];if(i.push(Buffer.from(dp.PNG_SIGNATURE)),i.push(r.packIHDR(e.width,e.height)),e.gamma)i.push(r.packGAMA(e.gamma));let o=r.filterData(e.data,e.width,e.height),s=Ua.deflateSync(o,r.getDeflateOptions());if(o=null,!s||!s.length)throw Error("bad png - invalid compressed data response");return i.push(r.packIDAT(s)),i.push(r.packIEND()),Buffer.concat(i)}});var Ca=Me((wp)=>{var mp=Ta(),pp=Ja();wp.read=function(e,n){return mp(e,n||{})};wp.write=function(e,n){return pp(e,n)}});var Ka=Me((vp)=>{var kp=Ke("util"),Wa=Ke("stream"),Ep=la(),yp=ya(),Sp=Ca(),Ye=vp.PNG=function(e){if(Wa.call(this),e=e||{},this.width=e.width|0,this.height=e.height|0,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,e.fill&&this.data)this.data.fill(0);this.gamma=0,this.readable=this.writable=!0,this._parser=new Ep(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(n){this.data=n,this.emit("parsed",n)}.bind(this)),this._packer=new yp(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};kp.inherits(Ye,Wa);Ye.sync=Sp;Ye.prototype.pack=function(){if(!this.data||!this.data.length)return this.emit("error","No data provided"),this;return process.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this};Ye.prototype.parse=function(e,n){if(n){let t,r;t=function(i){this.removeListener("error",r),this.data=i,n(null,this)}.bind(this),r=function(i){this.removeListener("parsed",t),n(i,null)}.bind(this),this.once("parsed",t),this.once("error",r)}return this.end(e),this};Ye.prototype.write=function(e){return this._parser.write(e),!0};Ye.prototype.end=function(e){this._parser.end(e)};Ye.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)};Ye.prototype._gamma=function(e){this.gamma=e};Ye.prototype._handleClose=function(){if(!this._parser.writable&&!this._packer.readable)this.emit("close")};Ye.bitblt=function(e,n,t,r,i,o,s,u){if(t|=0,r|=0,i|=0,o|=0,s|=0,u|=0,t>e.width||r>e.height||t+i>e.width||r+o>e.height)throw Error("bitblt reading outside image");if(s>n.width||u>n.height||s+i>n.width||u+o>n.height)throw Error("bitblt writing outside image");for(let c=0;c<o;c++)e.data.copy(n.data,(u+c)*n.width+s<<2,(r+c)*e.width+t<<2,(r+c)*e.width+t+i<<2)};Ye.prototype.bitblt=function(e,n,t,r,i,o,s){return Ye.bitblt(this,e,n,t,r,i,o,s),this};Ye.adjustGamma=function(e){if(e.gamma){for(let n=0;n<e.height;n++)for(let t=0;t<e.width;t++){let r=e.width*n+t<<2;for(let i=0;i<3;i++){let o=e.data[r+i]/255;o=Math.pow(o,0.45454545454545453/e.gamma),e.data[r+i]=Math.round(o*255)}}e.gamma=0}};Ye.prototype.adjustGamma=function(){Ye.adjustGamma(this)}});var lu=Me((bS,Jf)=>{var fu={to(e,n){if(!n)return`\x1B[${e+1}G`;return`\x1B[${n+1};${e+1}H`},move(e,n){let t="";if(e<0)t+=`\x1B[${-e}D`;else if(e>0)t+=`\x1B[${e}C`;if(n<0)t+=`\x1B[${-n}A`;else if(n>0)t+=`\x1B[${n}B`;return t},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},w0={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},$0={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let n="";for(let t=0;t<e;t++)n+=this.line+(t<e-1?fu.up():"");if(e)n+=fu.left;return n}};Jf.exports={cursor:fu,scroll:w0,erase:$0,beep:"\x07"}});import{spawnSync as U1}from"node:child_process";import{isMainThread as j1}from"node:worker_threads";import{parseArgs as H1}from"node:util";var _e={name:"@kecan0406/ttheme",version:"1.0.47",type:"module",bin:{ttheme:"bin/ttheme.js"},files:["bin","dist/manifest.json","shell","!shell/check.zsh"],description:"Character terminal palettes for Ghostty, kitty, Alacritty, WezTerm, iTerm2, Windows Terminal and Warp",license:"MIT",author:"kecan0406",repository:{type:"git",url:"git+https://github.com/kecan0406/ttheme.git"},homepage:"https://github.com/kecan0406/ttheme#readme",bugs:"https://github.com/kecan0406/ttheme/issues",keywords:["terminal","theme","ghostty","kitty","alacritty","wezterm","iterm2"],devDependencies:{"@biomejs/biome":"^2.3.0","@clack/core":"^1.4.3","@clack/prompts":"^1.7.0","@material/material-color-utilities":"^0.4.0","@types/bun":"^1.3.0","@types/pngjs":"6.0.5","jpeg-js":"^0.4.4",pngjs:"7.0.0","smol-toml":"^1.9.0",typescript:"^5.8.2"},engines:{bun:">=1.3",node:">=20.11"}};import{rmSync as Sf}from"node:fs";import{basename as n0,join as fi}from"node:path";var Dg=/^#[0-9a-f]{6}$/;function Wt(e){return Dg.test(e)}function We(e){let n=Number.parseInt(e.slice(1),16);return[n>>16&255,n>>8&255,n&255]}function Qe(e){let[n,t,r]=We(e).map((i)=>{let o=i/255;return o<=0.03928?o/12.92:((o+0.055)/1.055)**2.4});return 0.2126*n+0.7152*t+0.0722*r}function Be(e,n){let t=Qe(e),r=Qe(n);return(Math.max(t,r)+0.05)/(Math.min(t,r)+0.05)}function Wi(e,n){return Math.round(Be(e,n)*100)/100}function xg(e){let n=e/255;return n<=0.04045?n/12.92:((n+0.055)/1.055)**2.4}function dn(e){let[n,t,r]=We(e).map(xg),i=Math.cbrt(0.4122214708*n+0.5363325363*t+0.0514459929*r),o=Math.cbrt(0.2119034982*n+0.6806995451*t+0.1073969566*r),s=Math.cbrt(0.0883024619*n+0.2817188376*t+0.6299787005*r),u=1.9779984951*i-2.428592205*o+0.4505937099*s,c=0.0259040371*i+0.7827717662*o-0.808675766*s;return{l:0.2104542553*i+0.793617785*o-0.0040720468*s,c:Math.hypot(u,c),h:(Math.atan2(c,u)*180/Math.PI+360)%360}}var Zn=7,Pc=3,gs=0.15,Hc=1.6,ps=[1,2,3,4,5,6,9,10,11,12,13,14],Lc=[7,15],Kt=[1,2,3,4,5,6],Or={1:{name:"red",center:19,width:25},2:{name:"green",center:132,width:35},3:{name:"yellow",center:88,width:35},4:{name:"blue",center:250,width:60},5:{name:"magenta",center:329,width:40},6:{name:"cyan",center:197,width:60}},ws=0.03,dt=25,Qi=15,Yi=0.08;function Gn(e,n){let t=e.ansi[n];if(t===void 0)throw Error(`${e.name}: missing ANSI ${n}`);return t}function ms(e,n,t){let r=e.background;return n.flatMap((i)=>{let o=Gn(e,i);return Be(o,r)<t?[`ANSI ${i} ${o} on ${r} is ${Wi(o,r)}:1, needs ${t}:1`]:[]})}function Ac(e,n){return Math.min(...n.map((t)=>Be(Gn(e,t),e.background)))}var Tc=[{rule:"foreground",label:"foreground on background",unit:"ratio",min:Zn,measure:({foreground:e,background:n})=>Be(e,n),check:({foreground:e,background:n})=>Be(e,n)<Zn?[`foreground ${e} on ${n} is ${Wi(e,n)}:1, needs ${Zn}:1`]:[]},{rule:"accents",label:"weakest accent on background",unit:"ratio",min:Pc,measure:(e)=>Ac(e,ps),check:(e)=>ms(e,ps,Pc)},{rule:"ansi0-dark",label:"ansi0 luminance",unit:"luminance",max:gs,measure:(e)=>Qe(Gn(e,0)),check:(e)=>{let n=Gn(e,0);return Qe(n)>gs?[`ANSI 0 ${n} has luminance ${Qe(n).toFixed(3)}, needs <= ${gs}`]:[]}},{rule:"light-ansi",label:"ansi7 and ansi15 on background",unit:"ratio",min:Zn,measure:(e)=>Ac(e,Lc),check:(e)=>ms(e,Lc,Zn)},{rule:"ansi8-visible",label:"ansi8 on background",unit:"ratio",min:Hc,measure:(e)=>Be(Gn(e,8),e.background),check:(e)=>ms(e,[8],Hc)},{rule:"selection",label:"foreground on selection",unit:"ratio",min:Zn,measure:({foreground:e,selectionBackground:n})=>n===void 0?Number.NaN:Be(e,n),check:({foreground:e,selectionBackground:n})=>n!==void 0&&Be(e,n)<Zn?[`foreground ${e} on selection ${n} is ${Wi(e,n)}:1, needs ${Zn}:1`]:[]}];function Xn(e,n){let t=Math.abs(e-n)%360;return Math.min(t,360-t)}var _t=(e)=>e>8?e-8:e;function Zi(e){let n=e.signatureSlots.filter((t)=>t.startsWith("ansi")).map((t)=>Number(t.slice(4)));return new Set(n.flatMap((t)=>Kt.includes(_t(t))?[t,t>8?t-8:t+8]:[t]))}function Nr(e,n){let t=dn(Gn(e,n));return t.c<ws?void 0:t}function Ki(e){let n=Zi(e);return ps.flatMap((t)=>{let r=Nr(e,t),i=Or[_t(t)];if(r===void 0||i===void 0||n.has(t))return[];let o=Xn(r.h,i.center)-i.width;return o>0?[{slot:t,hue:r.h,over:o}]:[]})}function _i(e){let n=new Set(e.signatureSlots);return Kt.flatMap((t)=>{let r=Nr(e,t),i=Nr(e,t+8);if(r===void 0||i===void 0||n.has(`ansi${t}`)&&n.has(`ansi${t+8}`))return[];return[{normal:t,gap:Xn(r.h,i.h)}]})}function qi(e){let n=Zi(e);return[0,8].flatMap((t)=>Kt.flatMap((r)=>Kt.filter((i)=>i>r).flatMap((i)=>{let[o,s]=[t+r,t+i],u=Nr(e,o),c=Nr(e,s);if(u===void 0||c===void 0||n.has(o)&&n.has(s))return[];return Xn(u.h,c.h)<Qi&&Math.abs(u.l-c.l)<Yi?[[o,s]]:[]})))}var em=[{rule:"ansi-role",label:"accent hue outside its ANSI role",unit:"degrees",max:0,measure:(e)=>Math.max(0,...Ki(e).map((n)=>n.over)),check:(e)=>Ki(e).map(({slot:n,hue:t,over:r})=>{let i=Or[_t(n)];return`ANSI ${n} ${Gn(e,n)} has hue ${t.toFixed(0)}°, ${r.toFixed(0)}° outside ${i.name} (${i.center}±${i.width}°)`})},{rule:"bright-follows",label:"widest normal to bright hue gap",unit:"degrees",max:dt,measure:(e)=>Math.max(0,..._i(e).map((n)=>n.gap)),check:(e)=>_i(e).filter((n)=>n.gap>dt).map(({normal:n,gap:t})=>`ANSI ${n+8} is ${t.toFixed(0)}° from ANSI ${n}, needs <= ${dt}°`)},{rule:"distinct",label:"accent pairs that read as one color",unit:"pairs",max:0,measure:(e)=>qi(e).length,check:(e)=>qi(e).map(([n,t])=>`ANSI ${n} ${Gn(e,n)} and ANSI ${t} ${Gn(e,t)} are within ${Qi}° hue and ${Yi} lightness`)}],Xi=[...Tc,...em],$s=Xi.map((e)=>e.rule),gt=Xi.map(({rule:e,label:n,unit:t,min:r,max:i})=>({rule:e,label:n,unit:t,...r===void 0?{}:{min:r},...i===void 0?{}:{max:i}}));function qt(e){return Xi.map((n)=>Math.round(n.measure(e)*1000)/1000)}function Gc(e,n){return e.filter((t)=>!n.waive.includes(t.rule)).flatMap((t)=>t.check(n).map((r)=>({theme:n.name,rule:t.rule,detail:r})))}function Vi(e){return Gc(Xi,e)}function Uc(e){return Gc(Tc,e)}function jc(e){return e.flatMap(Vi)}import{readdirSync as rw,readFileSync as bh}from"node:fs";import{basename as iw,join as kh}from"node:path";/*!
|
|
2
|
+
import{createRequire as zg}from"node:module";var _g=Object.create;var{getPrototypeOf:qg,defineProperty:Fc,getOwnPropertyNames:Qg}=Object;var Yg=Object.prototype.hasOwnProperty;function Zg(e){return this[e]}var Xg,Vg,Ci=(e,n,t)=>{var r=e!=null&&typeof e==="object";if(r){var i=n?Xg??=new WeakMap:Vg??=new WeakMap,o=i.get(e);if(o)return o}t=e!=null?_g(qg(e)):{};let s=n||!e||!e.__esModule?Fc(t,"default",{value:e,enumerable:!0}):t;for(let u of Qg(e))if(!Yg.call(s,u))Fc(s,u,{get:Zg.bind(e,u),enumerable:!0});if(r)i.set(e,s);return s};var Me=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var Ke=zg(import.meta.url);var Yc=Me((kE,xi)=>{var Qc=Qc||function(e){return Buffer.from(e).toString("base64")};function um(e){var n=this,t=Math.round,r=Math.floor,i=Array(64),o=Array(64),s=Array(64),u=Array(64),c,a,h,f,l=Array(65535),d=Array(65535),g=Array(64),p=Array(64),k=[],y=0,M=7,b=Array(64),S=Array(64),m=Array(64),P=Array(256),E=Array(2048),R,N=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],H=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],A=[0,1,2,3,4,5,6,7,8,9,10,11],X=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],j=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],Le=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],C=[0,1,2,3,4,5,6,7,8,9,10,11],D=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],Oe=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function Ee(w){var T=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99];for(var W=0;W<64;W++){var U=r((T[W]*w+50)/100);if(U<1)U=1;else if(U>255)U=255;i[N[W]]=U}var Q=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99];for(var Y=0;Y<64;Y++){var se=r((Q[Y]*w+50)/100);if(se<1)se=1;else if(se>255)se=255;o[N[Y]]=se}var ue=[1,1.387039845,1.306562965,1.175875602,1,0.785694958,0.5411961,0.275899379],Fe=0;for(var ve=0;ve<8;ve++)for(var I=0;I<8;I++)s[Fe]=1/(i[N[Fe]]*ue[ve]*ue[I]*8),u[Fe]=1/(o[N[Fe]]*ue[ve]*ue[I]*8),Fe++}function ee(w,T){var W=0,U=0,Q=[];for(var Y=1;Y<=16;Y++){for(var se=1;se<=w[Y];se++)Q[T[U]]=[],Q[T[U]][0]=W,Q[T[U]][1]=Y,U++,W++;W*=2}return Q}function Ae(){c=ee(H,A),a=ee(Le,C),h=ee(X,j),f=ee(D,Oe)}function ce(){var w=1,T=2;for(var W=1;W<=15;W++){for(var U=w;U<T;U++)d[32767+U]=W,l[32767+U]=[],l[32767+U][1]=W,l[32767+U][0]=U;for(var Q=-(T-1);Q<=-w;Q++)d[32767+Q]=W,l[32767+Q]=[],l[32767+Q][1]=W,l[32767+Q][0]=T-1+Q;w<<=1,T<<=1}}function te(){for(var w=0;w<256;w++)E[w]=19595*w,E[w+256>>0]=38470*w,E[w+512>>0]=7471*w+32768,E[w+768>>0]=-11059*w,E[w+1024>>0]=-21709*w,E[w+1280>>0]=32768*w+8421375,E[w+1536>>0]=-27439*w,E[w+1792>>0]=-5329*w}function V(w){var T=w[0],W=w[1]-1;while(W>=0){if(T&1<<W)y|=1<<M;if(W--,M--,M<0){if(y==255)$(255),$(0);else $(y);M=7,y=0}}}function $(w){k.push(w)}function G(w){$(w>>8&255),$(w&255)}function me(w,T){var W,U,Q,Y,se,ue,Fe,ve,I=0,L,q=8,Re=64;for(L=0;L<q;++L){W=w[I],U=w[I+1],Q=w[I+2],Y=w[I+3],se=w[I+4],ue=w[I+5],Fe=w[I+6],ve=w[I+7];var Z=W+ve,ne=W-ve,we=U+Fe,K=U-Fe,he=Q+ue,Ce=Q-ue,Ne=Y+se,sn=Y-se,yn=Z+Ne,lt=Z-Ne,Jt=we+he,Ct=we-he;w[I]=yn+Jt,w[I+4]=yn-Jt;var kr=(Ct+lt)*0.707106781;w[I+2]=lt+kr,w[I+6]=lt-kr,yn=sn+Ce,Jt=Ce+K,Ct=K+ne;var Er=(yn-Ct)*0.382683433,Gi=0.5411961*yn+Er,yr=1.306562965*Ct+Er,Sr=Jt*0.707106781,vr=ne+Sr,Mr=ne-Sr;w[I+5]=Mr+Gi,w[I+3]=Mr-Gi,w[I+1]=vr+yr,w[I+7]=vr-yr,I+=8}I=0;for(L=0;L<q;++L){W=w[I],U=w[I+8],Q=w[I+16],Y=w[I+24],se=w[I+32],ue=w[I+40],Fe=w[I+48],ve=w[I+56];var wc=W+ve,ls=W-ve,$c=U+Fe,bc=U-Fe,kc=Q+ue,Ec=Q-ue,yc=Y+se,Kg=Y-se,Ir=wc+yc,ds=wc-yc,Ui=$c+kc,ji=$c-kc;w[I]=Ir+Ui,w[I+32]=Ir-Ui;var Sc=(ji+ds)*0.707106781;w[I+16]=ds+Sc,w[I+48]=ds-Sc,Ir=Kg+Ec,Ui=Ec+bc,ji=bc+ls;var vc=(Ir-ji)*0.382683433,Mc=0.5411961*Ir+vc,Ic=1.306562965*ji+vc,Nc=Ui*0.707106781,Oc=ls+Nc,Rc=ls-Nc;w[I+40]=Rc+Mc,w[I+24]=Rc-Mc,w[I+8]=Oc+Ic,w[I+56]=Oc-Ic,I++}var Ji;for(L=0;L<Re;++L)Ji=w[L]*T[L],g[L]=Ji>0?Ji+0.5|0:Ji-0.5|0;return g}function pe(){G(65504),G(16),$(74),$(70),$(73),$(70),$(0),$(1),$(1),$(0),G(1),G(1),$(0),$(0)}function re(w){if(!w)return;if(G(65505),w[0]===69&&w[1]===120&&w[2]===105&&w[3]===102)G(w.length+2);else G(w.length+5+2),$(69),$(120),$(105),$(102),$(0);for(var T=0;T<w.length;T++)$(w[T])}function ie(w,T){G(65472),G(17),$(8),G(T),G(w),$(3),$(1),$(17),$(0),$(2),$(17),$(1),$(3),$(17),$(1)}function z(){G(65499),G(132),$(0);for(var w=0;w<64;w++)$(i[w]);$(1);for(var T=0;T<64;T++)$(o[T])}function F(){G(65476),G(418),$(0);for(var w=0;w<16;w++)$(H[w+1]);for(var T=0;T<=11;T++)$(A[T]);$(16);for(var W=0;W<16;W++)$(X[W+1]);for(var U=0;U<=161;U++)$(j[U]);$(1);for(var Q=0;Q<16;Q++)$(Le[Q+1]);for(var Y=0;Y<=11;Y++)$(C[Y]);$(17);for(var se=0;se<16;se++)$(D[se+1]);for(var ue=0;ue<=161;ue++)$(Oe[ue])}function O(w){if(typeof w>"u"||w.constructor!==Array)return;w.forEach((T)=>{if(typeof T!=="string")return;G(65534);var W=T.length;G(W+2);var U;for(U=0;U<W;U++)$(T.charCodeAt(U))})}function Se(){G(65498),G(12),$(3),$(1),$(0),$(2),$(17),$(3),$(17),$(0),$(63),$(0)}function _(w,T,W,U,Q){var Y=Q[0],se=Q[240],ue,Fe=16,ve=63,I=64,L=me(w,T);for(var q=0;q<I;++q)p[N[q]]=L[q];var Re=p[0]-W;if(W=p[0],Re==0)V(U[0]);else ue=32767+Re,V(U[d[ue]]),V(l[ue]);var Z=63;for(;Z>0&&p[Z]==0;Z--);if(Z==0)return V(Y),W;var ne=1,we;while(ne<=Z){var K=ne;for(;p[ne]==0&&ne<=Z;++ne);var he=ne-K;if(he>=Fe){we=he>>4;for(var Ce=1;Ce<=we;++Ce)V(se);he=he&15}ue=32767+p[ne],V(Q[(he<<4)+d[ue]]),V(l[ue]),ne++}if(Z!=ve)V(Y);return W}function B(){var w=String.fromCharCode;for(var T=0;T<256;T++)P[T]=w(T)}this.encode=function(w,T){var W=new Date().getTime();if(T)on(T);k=[],y=0,M=7,G(65496),pe(),O(w.comments),re(w.exifBuffer),z(),ie(w.width,w.height),F(),Se();var U=0,Q=0,Y=0;y=0,M=7,this.encode.displayName="_encode_";var{data:se,width:ue,height:Fe}=w,ve=ue*4,I=ue*3,L,q=0,Re,Z,ne,we,K,he,Ce,Ne;while(q<Fe){L=0;while(L<ve){we=ve*q+L,K=we,he=-1,Ce=0;for(Ne=0;Ne<64;Ne++){if(Ce=Ne>>3,he=(Ne&7)*4,K=we+Ce*ve+he,q+Ce>=Fe)K-=ve*(q+1+Ce-Fe);if(L+he>=ve)K-=L+he-ve+4;Re=se[K++],Z=se[K++],ne=se[K++],b[Ne]=(E[Re]+E[Z+256>>0]+E[ne+512>>0]>>16)-128,S[Ne]=(E[Re+768>>0]+E[Z+1024>>0]+E[ne+1280>>0]>>16)-128,m[Ne]=(E[Re+1280>>0]+E[Z+1536>>0]+E[ne+1792>>0]>>16)-128}U=_(b,s,U,c,h),Q=_(S,u,Q,a,f),Y=_(m,u,Y,a,f),L+=32}q+=8}if(M>=0){var sn=[];sn[1]=M+1,sn[0]=(1<<M+1)-1,V(sn)}if(G(65497),typeof xi>"u")return new Uint8Array(k);return Buffer.from(k);var yn,lt};function on(w){if(w<=0)w=1;if(w>100)w=100;if(R==w)return;var T=0;if(w<50)T=Math.floor(5000/w);else T=Math.floor(200-w*2);Ee(T),R=w}function ln(){var w=new Date().getTime();if(!e)e=50;B(),Ae(),ce(),te(),on(e);var T=new Date().getTime()-w}ln()}if(typeof xi<"u")xi.exports=qc;else if(typeof window<"u")window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].encode=qc;function qc(e,n){if(typeof n>"u")n=50;var t=new um(n),r=t.encode(e,n);return{data:r,width:e.width,height:e.height}}});var Xc=Me((EE,Ss)=>{var ys=function(){var n=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,r=799,i=3406,o=2276,s=1567,u=3784,c=5793,a=2896;function h(){}function f(M,b){var S=0,m=[],P,E,R=16;while(R>0&&!M[R-1])R--;m.push({children:[],index:0});var N=m[0],H;for(P=0;P<R;P++){for(E=0;E<M[P];E++){N=m.pop(),N.children[N.index]=b[S];while(N.index>0){if(m.length===0)throw Error("Could not recreate Huffman Table");N=m.pop()}N.index++,m.push(N);while(m.length<=P)m.push(H={children:[],index:0}),N.children[N.index]=H.children,N=H;S++}if(P+1<R)m.push(H={children:[],index:0}),N.children[N.index]=H.children,N=H}return m[0].children}function l(M,b,S,m,P,E,R,N,H,A){var{precision:X,samplesPerLine:j,scanLines:Le,mcusPerLine:C,progressive:D,maxH:Oe,maxV:Ee}=S,ee=b,Ae=0,ce=0;function te(){if(ce>0)return ce--,Ae>>ce&1;if(Ae=M[b++],Ae==255){var I=M[b++];if(I)throw Error("unexpected marker: "+(Ae<<8|I).toString(16))}return ce=7,Ae>>>7}function V(I){var L=I,q;while((q=te())!==null){if(L=L[q],typeof L==="number")return L;if(typeof L!=="object")throw Error("invalid huffman sequence")}return null}function $(I){var L=0;while(I>0){var q=te();if(q===null)return;L=L<<1|q,I--}return L}function G(I){var L=$(I);if(L>=1<<I-1)return L;return L+(-1<<I)+1}function me(I,L){var q=V(I.huffmanTableDC),Re=q===0?0:G(q);L[0]=I.pred+=Re;var Z=1;while(Z<64){var ne=V(I.huffmanTableAC),we=ne&15,K=ne>>4;if(we===0){if(K<15)break;Z+=16;continue}Z+=K;var he=n[Z];L[he]=G(we),Z++}}function pe(I,L){var q=V(I.huffmanTableDC),Re=q===0?0:G(q)<<H;L[0]=I.pred+=Re}function re(I,L){L[0]|=te()<<H}var ie=0;function z(I,L){if(ie>0){ie--;return}var q=E,Re=R;while(q<=Re){var Z=V(I.huffmanTableAC),ne=Z&15,we=Z>>4;if(ne===0){if(we<15){ie=$(we)+(1<<we)-1;break}q+=16;continue}q+=we;var K=n[q];L[K]=G(ne)*(1<<H),q++}}var F=0,O;function Se(I,L){var q=E,Re=R,Z=0;while(q<=Re){var ne=n[q],we=L[ne]<0?-1:1;switch(F){case 0:var K=V(I.huffmanTableAC),he=K&15,Z=K>>4;if(he===0)if(Z<15)ie=$(Z)+(1<<Z),F=4;else Z=16,F=1;else{if(he!==1)throw Error("invalid ACn encoding");O=G(he),F=Z?2:3}continue;case 1:case 2:if(L[ne])L[ne]+=(te()<<H)*we;else if(Z--,Z===0)F=F==2?3:0;break;case 3:if(L[ne])L[ne]+=(te()<<H)*we;else L[ne]=O<<H,F=0;break;case 4:if(L[ne])L[ne]+=(te()<<H)*we;break}q++}if(F===4){if(ie--,ie===0)F=0}}function _(I,L,q,Re,Z){var ne=q/C|0,we=q%C,K=ne*I.v+Re,he=we*I.h+Z;if(I.blocks[K]===void 0&&A.tolerantDecoding)return;L(I,I.blocks[K][he])}function B(I,L,q){var Re=q/I.blocksPerLine|0,Z=q%I.blocksPerLine;if(I.blocks[Re]===void 0&&A.tolerantDecoding)return;L(I,I.blocks[Re][Z])}var on=m.length,ln,w,T,W,U,Q;if(D)if(E===0)Q=N===0?pe:re;else Q=N===0?z:Se;else Q=me;var Y=0,se,ue;if(on==1)ue=m[0].blocksPerLine*m[0].blocksPerColumn;else ue=C*S.mcusPerColumn;if(!P)P=ue;var Fe,ve;while(Y<ue){for(w=0;w<on;w++)m[w].pred=0;if(ie=0,on==1){ln=m[0];for(U=0;U<P;U++)B(ln,Q,Y),Y++}else for(U=0;U<P;U++){for(w=0;w<on;w++){ln=m[w],Fe=ln.h,ve=ln.v;for(T=0;T<ve;T++)for(W=0;W<Fe;W++)_(ln,Q,Y,T,W)}if(Y++,Y===ue)break}if(Y===ue)do{if(M[b]===255){if(M[b+1]!==0)break}b+=1}while(b<M.length-2);if(ce=0,se=M[b]<<8|M[b+1],se<65280)throw Error("marker was not found");if(se>=65488&&se<=65495)b+=2;else break}return b-ee}function d(M,b){var S=[],m=b.blocksPerLine,P=b.blocksPerColumn,E=m<<3,R=new Int32Array(64),N=new Uint8Array(64);function H(ee,Ae,ce){var te=b.quantizationTable,V,$,G,me,pe,re,ie,z,F,O=ce,Se;for(Se=0;Se<64;Se++)O[Se]=ee[Se]*te[Se];for(Se=0;Se<8;++Se){var _=8*Se;if(O[1+_]==0&&O[2+_]==0&&O[3+_]==0&&O[4+_]==0&&O[5+_]==0&&O[6+_]==0&&O[7+_]==0){F=c*O[0+_]+512>>10,O[0+_]=F,O[1+_]=F,O[2+_]=F,O[3+_]=F,O[4+_]=F,O[5+_]=F,O[6+_]=F,O[7+_]=F;continue}V=c*O[0+_]+128>>8,$=c*O[4+_]+128>>8,G=O[2+_],me=O[6+_],pe=a*(O[1+_]-O[7+_])+128>>8,z=a*(O[1+_]+O[7+_])+128>>8,re=O[3+_]<<4,ie=O[5+_]<<4,F=V-$+1>>1,V=V+$+1>>1,$=F,F=G*u+me*s+128>>8,G=G*s-me*u+128>>8,me=F,F=pe-ie+1>>1,pe=pe+ie+1>>1,ie=F,F=z+re+1>>1,re=z-re+1>>1,z=F,F=V-me+1>>1,V=V+me+1>>1,me=F,F=$-G+1>>1,$=$+G+1>>1,G=F,F=pe*o+z*i+2048>>12,pe=pe*i-z*o+2048>>12,z=F,F=re*r+ie*t+2048>>12,re=re*t-ie*r+2048>>12,ie=F,O[0+_]=V+z,O[7+_]=V-z,O[1+_]=$+ie,O[6+_]=$-ie,O[2+_]=G+re,O[5+_]=G-re,O[3+_]=me+pe,O[4+_]=me-pe}for(Se=0;Se<8;++Se){var B=Se;if(O[8+B]==0&&O[16+B]==0&&O[24+B]==0&&O[32+B]==0&&O[40+B]==0&&O[48+B]==0&&O[56+B]==0){F=c*ce[Se+0]+8192>>14,O[0+B]=F,O[8+B]=F,O[16+B]=F,O[24+B]=F,O[32+B]=F,O[40+B]=F,O[48+B]=F,O[56+B]=F;continue}V=c*O[0+B]+2048>>12,$=c*O[32+B]+2048>>12,G=O[16+B],me=O[48+B],pe=a*(O[8+B]-O[56+B])+2048>>12,z=a*(O[8+B]+O[56+B])+2048>>12,re=O[24+B],ie=O[40+B],F=V-$+1>>1,V=V+$+1>>1,$=F,F=G*u+me*s+2048>>12,G=G*s-me*u+2048>>12,me=F,F=pe-ie+1>>1,pe=pe+ie+1>>1,ie=F,F=z+re+1>>1,re=z-re+1>>1,z=F,F=V-me+1>>1,V=V+me+1>>1,me=F,F=$-G+1>>1,$=$+G+1>>1,G=F,F=pe*o+z*i+2048>>12,pe=pe*i-z*o+2048>>12,z=F,F=re*r+ie*t+2048>>12,re=re*t-ie*r+2048>>12,ie=F,O[0+B]=V+z,O[56+B]=V-z,O[8+B]=$+ie,O[48+B]=$-ie,O[16+B]=G+re,O[40+B]=G-re,O[24+B]=me+pe,O[32+B]=me-pe}for(Se=0;Se<64;++Se){var on=128+(O[Se]+8>>4);Ae[Se]=on<0?0:on>255?255:on}}y(E*P*8);var A,X;for(var j=0;j<P;j++){var Le=j<<3;for(A=0;A<8;A++)S.push(new Uint8Array(E));for(var C=0;C<m;C++){H(b.blocks[j][C],N,R);var D=0,Oe=C<<3;for(X=0;X<8;X++){var Ee=S[Le+X];for(A=0;A<8;A++)Ee[Oe+A]=N[D++]}}}return S}function g(M){return M<0?0:M>255?255:M}h.prototype={load:function(b){var S=new XMLHttpRequest;S.open("GET",b,!0),S.responseType="arraybuffer",S.onload=function(){var m=new Uint8Array(S.response||S.mozResponseArrayBuffer);if(this.parse(m),this.onload)this.onload()}.bind(this),S.send(null)},parse:function(b){var S=this.opts.maxResolutionInMP*1000*1000,m=0,P=b.length;function E(){var K=b[m]<<8|b[m+1];return m+=2,K}function R(){var K=E(),he=b.subarray(m,m+K-2);return m+=he.length,he}function N(K){var he=1,Ce=1,Ne,sn;for(sn in K.components)if(K.components.hasOwnProperty(sn)){if(Ne=K.components[sn],he<Ne.h)he=Ne.h;if(Ce<Ne.v)Ce=Ne.v}var yn=Math.ceil(K.samplesPerLine/8/he),lt=Math.ceil(K.scanLines/8/Ce);for(sn in K.components)if(K.components.hasOwnProperty(sn)){Ne=K.components[sn];var Jt=Math.ceil(Math.ceil(K.samplesPerLine/8)*Ne.h/he),Ct=Math.ceil(Math.ceil(K.scanLines/8)*Ne.v/Ce),kr=yn*Ne.h,Er=lt*Ne.v,Gi=Er*kr,yr=[];y(Gi*256);for(var Sr=0;Sr<Er;Sr++){var vr=[];for(var Mr=0;Mr<kr;Mr++)vr.push(new Int32Array(64));yr.push(vr)}Ne.blocksPerLine=Jt,Ne.blocksPerColumn=Ct,Ne.blocks=yr}K.maxH=he,K.maxV=Ce,K.mcusPerLine=yn,K.mcusPerColumn=lt}var H=null,A=null,X=null,j,Le,C=[],D=[],Oe=[],Ee=[],ee=E(),Ae=-1;if(this.comments=[],ee!=65496)throw Error("SOI not found");ee=E();while(ee!=65497){var ce,te,V;switch(ee){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var $=R();if(ee===65534){var G=String.fromCharCode.apply(null,$);this.comments.push(G)}if(ee===65504){if($[0]===74&&$[1]===70&&$[2]===73&&$[3]===70&&$[4]===0)H={version:{major:$[5],minor:$[6]},densityUnits:$[7],xDensity:$[8]<<8|$[9],yDensity:$[10]<<8|$[11],thumbWidth:$[12],thumbHeight:$[13],thumbData:$.subarray(14,14+3*$[12]*$[13])}}if(ee===65505){if($[0]===69&&$[1]===120&&$[2]===105&&$[3]===102&&$[4]===0)this.exifBuffer=$.subarray(5,$.length)}if(ee===65518){if($[0]===65&&$[1]===100&&$[2]===111&&$[3]===98&&$[4]===101&&$[5]===0)A={version:$[6],flags0:$[7]<<8|$[8],flags1:$[9]<<8|$[10],transformCode:$[11]}}break;case 65499:var me=E(),pe=me+m-2;while(m<pe){var re=b[m++];y(256);var ie=new Int32Array(64);if(re>>4===0)for(te=0;te<64;te++){var z=n[te];ie[z]=b[m++]}else if(re>>4===1)for(te=0;te<64;te++){var z=n[te];ie[z]=E()}else throw Error("DQT: invalid table spec");C[re&15]=ie}break;case 65472:case 65473:case 65474:E(),j={},j.extended=ee===65473,j.progressive=ee===65474,j.precision=b[m++],j.scanLines=E(),j.samplesPerLine=E(),j.components={},j.componentsOrder=[];var F=j.scanLines*j.samplesPerLine;if(F>S){var O=Math.ceil((F-S)/1e6);throw Error(`maxResolutionInMP limit exceeded by ${O}MP`)}var Se=b[m++],_,B=0,on=0;for(ce=0;ce<Se;ce++){_=b[m];var ln=b[m+1]>>4,w=b[m+1]&15,T=b[m+2];if(ln<=0||w<=0)throw Error("Invalid sampling factor, expected values above 0");j.componentsOrder.push(_),j.components[_]={h:ln,v:w,quantizationIdx:T},m+=3}N(j),D.push(j);break;case 65476:var W=E();for(ce=2;ce<W;){var U=b[m++],Q=new Uint8Array(16),Y=0;for(te=0;te<16;te++,m++)Y+=Q[te]=b[m];y(16+Y);var se=new Uint8Array(Y);for(te=0;te<Y;te++,m++)se[te]=b[m];ce+=17+Y,(U>>4===0?Ee:Oe)[U&15]=f(Q,se)}break;case 65501:E(),Le=E();break;case 65500:E(),E();break;case 65498:var ue=E(),Fe=b[m++],ve=[],I;for(ce=0;ce<Fe;ce++){I=j.components[b[m++]];var L=b[m++];I.huffmanTableDC=Ee[L>>4],I.huffmanTableAC=Oe[L&15],ve.push(I)}var q=b[m++],Re=b[m++],Z=b[m++],ne=l(b,m,j,ve,Le,q,Re,Z>>4,Z&15,this.opts);m+=ne;break;case 65535:if(b[m]!==255)m--;break;default:if(b[m-3]==255&&b[m-2]>=192&&b[m-2]<=254){m-=3;break}else if(ee===224||ee==225){if(Ae!==-1)throw Error(`first unknown JPEG marker at offset ${Ae.toString(16)}, second unknown JPEG marker ${ee.toString(16)} at offset ${(m-1).toString(16)}`);Ae=m-1;let K=E();if(b[m+K-2]===255){m+=K-2;break}}throw Error("unknown JPEG marker "+ee.toString(16))}ee=E()}if(D.length!=1)throw Error("only single frame JPEGs supported");for(var ce=0;ce<D.length;ce++){var we=D[ce].components;for(var te in we)we[te].quantizationTable=C[we[te].quantizationIdx],delete we[te].quantizationIdx}this.width=j.samplesPerLine,this.height=j.scanLines,this.jfif=H,this.adobe=A,this.components=[];for(var ce=0;ce<j.componentsOrder.length;ce++){var I=j.components[j.componentsOrder[ce]];this.components.push({lines:d(j,I),scaleX:I.h/j.maxH,scaleY:I.v/j.maxV})}},getData:function(b,S){var m=this.width/b,P=this.height/S,E,R,N,H,A,X,j,Le,C,D,Oe=0,Ee,ee,Ae,ce,te,V,$,G,me,pe,re,ie=b*S*this.components.length;y(ie);var z=new Uint8Array(ie);switch(this.components.length){case 1:E=this.components[0];for(D=0;D<S;D++){A=E.lines[0|D*E.scaleY*P];for(C=0;C<b;C++)Ee=A[0|C*E.scaleX*m],z[Oe++]=Ee}break;case 2:E=this.components[0],R=this.components[1];for(D=0;D<S;D++){A=E.lines[0|D*E.scaleY*P],X=R.lines[0|D*R.scaleY*P];for(C=0;C<b;C++)Ee=A[0|C*E.scaleX*m],z[Oe++]=Ee,Ee=X[0|C*R.scaleX*m],z[Oe++]=Ee}break;case 3:if(re=!0,this.adobe&&this.adobe.transformCode)re=!0;else if(typeof this.opts.colorTransform<"u")re=!!this.opts.colorTransform;E=this.components[0],R=this.components[1],N=this.components[2];for(D=0;D<S;D++){A=E.lines[0|D*E.scaleY*P],X=R.lines[0|D*R.scaleY*P],j=N.lines[0|D*N.scaleY*P];for(C=0;C<b;C++){if(!re)G=A[0|C*E.scaleX*m],me=X[0|C*R.scaleX*m],pe=j[0|C*N.scaleX*m];else Ee=A[0|C*E.scaleX*m],ee=X[0|C*R.scaleX*m],Ae=j[0|C*N.scaleX*m],G=g(Ee+1.402*(Ae-128)),me=g(Ee-0.3441363*(ee-128)-0.71413636*(Ae-128)),pe=g(Ee+1.772*(ee-128));z[Oe++]=G,z[Oe++]=me,z[Oe++]=pe}}break;case 4:if(!this.adobe)throw Error("Unsupported color mode (4 components)");if(re=!1,this.adobe&&this.adobe.transformCode)re=!0;else if(typeof this.opts.colorTransform<"u")re=!!this.opts.colorTransform;E=this.components[0],R=this.components[1],N=this.components[2],H=this.components[3];for(D=0;D<S;D++){A=E.lines[0|D*E.scaleY*P],X=R.lines[0|D*R.scaleY*P],j=N.lines[0|D*N.scaleY*P],Le=H.lines[0|D*H.scaleY*P];for(C=0;C<b;C++){if(!re)te=A[0|C*E.scaleX*m],V=X[0|C*R.scaleX*m],$=j[0|C*N.scaleX*m],ce=Le[0|C*H.scaleX*m];else Ee=A[0|C*E.scaleX*m],ee=X[0|C*R.scaleX*m],Ae=j[0|C*N.scaleX*m],ce=Le[0|C*H.scaleX*m],te=255-g(Ee+1.402*(Ae-128)),V=255-g(Ee-0.3441363*(ee-128)-0.71413636*(Ae-128)),$=255-g(Ee+1.772*(ee-128));z[Oe++]=255-te,z[Oe++]=255-V,z[Oe++]=255-$,z[Oe++]=255-ce}}break;default:throw Error("Unsupported color mode")}return z},copyToImageData:function(b,S){var{width:m,height:P,data:E}=b,R=this.getData(m,P),N=0,H=0,A,X,j,Le,C,D,Oe,Ee,ee;switch(this.components.length){case 1:for(X=0;X<P;X++)for(A=0;A<m;A++)if(j=R[N++],E[H++]=j,E[H++]=j,E[H++]=j,S)E[H++]=255;break;case 3:for(X=0;X<P;X++)for(A=0;A<m;A++)if(Oe=R[N++],Ee=R[N++],ee=R[N++],E[H++]=Oe,E[H++]=Ee,E[H++]=ee,S)E[H++]=255;break;case 4:for(X=0;X<P;X++)for(A=0;A<m;A++)if(C=R[N++],D=R[N++],j=R[N++],Le=R[N++],Oe=255-g(C*(1-Le/255)+Le),Ee=255-g(D*(1-Le/255)+Le),ee=255-g(j*(1-Le/255)+Le),E[H++]=Oe,E[H++]=Ee,E[H++]=ee,S)E[H++]=255;break;default:throw Error("Unsupported color mode")}}};var p=0,k=0;function y(M=0){var b=p+M;if(b>k){var S=Math.ceil((b-k)/1024/1024);throw Error(`maxMemoryUsageInMB limit exceeded by at least ${S}MB`)}p=b}return h.resetMaxMemoryUsage=function(M){p=0,k=M},h.getBytesAllocated=function(){return p},h.requestMemoryAllocation=y,h}();if(typeof Ss<"u")Ss.exports=Zc;else if(typeof window<"u")window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].decode=Zc;function Zc(e,n={}){var t={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512},r={...t,...n},i=new Uint8Array(e),o=new ys;o.opts=r,ys.resetMaxMemoryUsage(r.maxMemoryUsageInMB*1024*1024),o.parse(i);var s=r.formatAsRGBA?4:3,u=o.width*o.height*s;try{ys.requestMemoryAllocation(u);var c={width:o.width,height:o.height,exifBuffer:o.exifBuffer,data:r.useTArray?new Uint8Array(u):Buffer.alloc(u)};if(o.comments.length>0)c.comments=o.comments}catch(a){if(a instanceof RangeError)throw Error("Could not allocate enough memory for the image. Required: "+u);if(a instanceof ReferenceError){if(a.message==="Buffer is not defined")throw Error("Buffer is not globally defined in this environment. Consider setting useTArray to true")}throw a}return o.copyToImageData(c,r.formatAsRGBA),c}});var zc=Me((yE,Vc)=>{var cm=Yc(),am=Xc();Vc.exports={encode:cm,decode:am}});var vs=Me((SE,Dc)=>{var hm=Ke("util"),Bc=Ke("stream"),mn=Dc.exports=function(){Bc.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};hm.inherits(mn,Bc);mn.prototype.read=function(e,n){this._reads.push({length:Math.abs(e),allowLess:e<0,func:n}),process.nextTick(function(){if(this._process(),this._paused&&this._reads&&this._reads.length>0)this._paused=!1,this.emit("drain")}.bind(this))};mn.prototype.write=function(e,n){if(!this.writable)return this.emit("error",Error("Stream not writable")),!1;let t;if(Buffer.isBuffer(e))t=e;else t=Buffer.from(e,n||this._encoding);if(this._buffers.push(t),this._buffered+=t.length,this._process(),this._reads&&this._reads.length===0)this._paused=!0;return this.writable&&!this._paused};mn.prototype.end=function(e,n){if(e)this.write(e,n);if(this.writable=!1,!this._buffers)return;if(this._buffers.length===0)this._end();else this._buffers.push(null),this._process()};mn.prototype.destroySoon=mn.prototype.end;mn.prototype._end=function(){if(this._reads.length>0)this.emit("error",Error("Unexpected end of input"));this.destroy()};mn.prototype.destroy=function(){if(!this._buffers)return;this.writable=!1,this._reads=null,this._buffers=null,this.emit("close")};mn.prototype._processReadAllowingLess=function(e){this._reads.shift();let n=this._buffers[0];if(n.length>e.length)this._buffered-=e.length,this._buffers[0]=n.slice(e.length),e.func.call(this,n.slice(0,e.length));else this._buffered-=n.length,this._buffers.shift(),e.func.call(this,n)};mn.prototype._processRead=function(e){this._reads.shift();let n=0,t=0,r=Buffer.alloc(e.length);while(n<e.length){let i=this._buffers[t++],o=Math.min(i.length,e.length-n);if(i.copy(r,n,0,o),n+=o,o!==i.length)this._buffers[--t]=i.slice(o)}if(t>0)this._buffers.splice(0,t);this._buffered-=e.length,e.func.call(this,r)};mn.prototype._process=function(){try{while(this._buffered>0&&this._reads&&this._reads.length>0){let e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else if(this._buffered>=e.length)this._processRead(e);else break}if(this._buffers&&!this.writable)this._end()}catch(e){this.emit("error",e)}}});var Ms=Me((fm)=>{var zn=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];fm.getImagePasses=function(e,n){let t=[],r=e%8,i=n%8,o=(e-r)/8,s=(n-i)/8;for(let u=0;u<zn.length;u++){let c=zn[u],a=o*c.x.length,h=s*c.y.length;for(let f=0;f<c.x.length;f++)if(c.x[f]<r)a++;else break;for(let f=0;f<c.y.length;f++)if(c.y[f]<i)h++;else break;if(a>0&&h>0)t.push({width:a,height:h,index:u})}return t};fm.getInterlaceIterator=function(e){return function(n,t,r){let i=n%zn[r].x.length,o=(n-i)/zn[r].x.length*8+zn[r].x[i],s=t%zn[r].y.length,u=(t-s)/zn[r].y.length*8+zn[r].y[s];return o*4+u*e*4}}});var Is=Me((ME,xc)=>{xc.exports=function(n,t,r){let i=n+t-r,o=Math.abs(i-n),s=Math.abs(i-t),u=Math.abs(i-r);if(o<=s&&o<=u)return n;if(s<=u)return t;return r}});var Ns=Me((IE,na)=>{var gm=Ms(),mm=Is();function ea(e,n,t){let r=e*n;if(t!==8)r=Math.ceil(r/(8/t));return r}var Qt=na.exports=function(e,n){let{width:t,height:r,interlace:i,bpp:o,depth:s}=e;if(this.read=n.read,this.write=n.write,this.complete=n.complete,this._imageIndex=0,this._images=[],i){let u=gm.getImagePasses(t,r);for(let c=0;c<u.length;c++)this._images.push({byteWidth:ea(u[c].width,o,s),height:u[c].height,lineIndex:0})}else this._images.push({byteWidth:ea(t,o,s),height:r,lineIndex:0});if(s===8)this._xComparison=o;else if(s===16)this._xComparison=o*2;else this._xComparison=1};Qt.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))};Qt.prototype._unFilterType1=function(e,n,t){let r=this._xComparison,i=r-1;for(let o=0;o<t;o++){let s=e[1+o],u=o>i?n[o-r]:0;n[o]=s+u}};Qt.prototype._unFilterType2=function(e,n,t){let r=this._lastLine;for(let i=0;i<t;i++){let o=e[1+i],s=r?r[i]:0;n[i]=o+s}};Qt.prototype._unFilterType3=function(e,n,t){let r=this._xComparison,i=r-1,o=this._lastLine;for(let s=0;s<t;s++){let u=e[1+s],c=o?o[s]:0,a=s>i?n[s-r]:0,h=Math.floor((a+c)/2);n[s]=u+h}};Qt.prototype._unFilterType4=function(e,n,t){let r=this._xComparison,i=r-1,o=this._lastLine;for(let s=0;s<t;s++){let u=e[1+s],c=o?o[s]:0,a=s>i?n[s-r]:0,h=s>i&&o?o[s-r]:0,f=mm(a,c,h);n[s]=u+f}};Qt.prototype._reverseFilterLine=function(e){let n=e[0],t,r=this._images[this._imageIndex],i=r.byteWidth;if(n===0)t=e.slice(1,i+1);else switch(t=Buffer.alloc(i),n){case 1:this._unFilterType1(e,t,i);break;case 2:this._unFilterType2(e,t,i);break;case 3:this._unFilterType3(e,t,i);break;case 4:this._unFilterType4(e,t,i);break;default:throw Error("Unrecognised filter type - "+n)}if(this.write(t),r.lineIndex++,r.lineIndex>=r.height)this._lastLine=null,this._imageIndex++,r=this._images[this._imageIndex];else this._lastLine=t;if(r)this.read(r.byteWidth+1,this._reverseFilterLine.bind(this));else this._lastLine=null,this.complete()}});var ia=Me((NE,ra)=>{var pm=Ke("util"),ta=vs(),wm=Ns(),$m=ra.exports=function(e){ta.call(this);let n=[],t=this;this._filter=new wm(e,{read:this.read.bind(this),write:function(r){n.push(r)},complete:function(){t.emit("complete",Buffer.concat(n))}}),this._filter.start()};pm.inherits($m,ta)});var Yt=Me((OE,oa)=>{oa.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}});var Fs=Me((RE,sa)=>{var Os=[];(function(){for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)if(n&1)n=3988292384^n>>>1;else n=n>>>1;Os[e]=n}})();var Rs=sa.exports=function(){this._crc=-1};Rs.prototype.write=function(e){for(let n=0;n<e.length;n++)this._crc=Os[(this._crc^e[n])&255]^this._crc>>>8;return!0};Rs.prototype.crc32=function(){return this._crc^-1};Rs.crc32=function(e){let n=-1;for(let t=0;t<e.length;t++)n=Os[(n^e[t])&255]^n>>>8;return n^-1}});var Ps=Me((FE,ua)=>{var je=Yt(),bm=Fs(),Je=ua.exports=function(e,n){this._options=e,e.checkCRC=e.checkCRC!==!1,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[je.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[je.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[je.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[je.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[je.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[je.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=n.read,this.error=n.error,this.metadata=n.metadata,this.gamma=n.gamma,this.transColor=n.transColor,this.palette=n.palette,this.parsed=n.parsed,this.inflateData=n.inflateData,this.finished=n.finished,this.simpleTransparency=n.simpleTransparency,this.headersFinished=n.headersFinished||function(){}};Je.prototype.start=function(){this.read(je.PNG_SIGNATURE.length,this._parseSignature.bind(this))};Je.prototype._parseSignature=function(e){let n=je.PNG_SIGNATURE;for(let t=0;t<n.length;t++)if(e[t]!==n[t]){this.error(Error("Invalid file signature"));return}this.read(8,this._parseChunkBegin.bind(this))};Je.prototype._parseChunkBegin=function(e){let n=e.readUInt32BE(0),t=e.readUInt32BE(4),r="";for(let o=4;o<8;o++)r+=String.fromCharCode(e[o]);let i=Boolean(e[4]&32);if(!this._hasIHDR&&t!==je.TYPE_IHDR){this.error(Error("Expected IHDR on beggining"));return}if(this._crc=new bm,this._crc.write(Buffer.from(r)),this._chunks[t])return this._chunks[t](n);if(!i){this.error(Error("Unsupported critical chunk type "+r));return}this.read(n+4,this._skipChunk.bind(this))};Je.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))};Je.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))};Je.prototype._parseChunkEnd=function(e){let n=e.readInt32BE(0),t=this._crc.crc32();if(this._options.checkCRC&&t!==n){this.error(Error("Crc error - "+n+" - "+t));return}if(!this._hasIEND)this.read(8,this._parseChunkBegin.bind(this))};Je.prototype._handleIHDR=function(e){this.read(e,this._parseIHDR.bind(this))};Je.prototype._parseIHDR=function(e){this._crc.write(e);let n=e.readUInt32BE(0),t=e.readUInt32BE(4),r=e[8],i=e[9],o=e[10],s=e[11],u=e[12];if(r!==8&&r!==4&&r!==2&&r!==1&&r!==16){this.error(Error("Unsupported bit depth "+r));return}if(!(i in je.COLORTYPE_TO_BPP_MAP)){this.error(Error("Unsupported color type"));return}if(o!==0){this.error(Error("Unsupported compression method"));return}if(s!==0){this.error(Error("Unsupported filter method"));return}if(u!==0&&u!==1){this.error(Error("Unsupported interlace method"));return}this._colorType=i;let c=je.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:n,height:t,depth:r,interlace:Boolean(u),palette:Boolean(i&je.COLORTYPE_PALETTE),color:Boolean(i&je.COLORTYPE_COLOR),alpha:Boolean(i&je.COLORTYPE_ALPHA),bpp:c,colorType:i}),this._handleChunkEnd()};Je.prototype._handlePLTE=function(e){this.read(e,this._parsePLTE.bind(this))};Je.prototype._parsePLTE=function(e){this._crc.write(e);let n=Math.floor(e.length/3);for(let t=0;t<n;t++)this._palette.push([e[t*3],e[t*3+1],e[t*3+2],255]);this.palette(this._palette),this._handleChunkEnd()};Je.prototype._handleTRNS=function(e){this.simpleTransparency(),this.read(e,this._parseTRNS.bind(this))};Je.prototype._parseTRNS=function(e){if(this._crc.write(e),this._colorType===je.COLORTYPE_PALETTE_COLOR){if(this._palette.length===0){this.error(Error("Transparency chunk must be after palette"));return}if(e.length>this._palette.length){this.error(Error("More transparent colors than palette size"));return}for(let n=0;n<e.length;n++)this._palette[n][3]=e[n];this.palette(this._palette)}if(this._colorType===je.COLORTYPE_GRAYSCALE)this.transColor([e.readUInt16BE(0)]);if(this._colorType===je.COLORTYPE_COLOR)this.transColor([e.readUInt16BE(0),e.readUInt16BE(2),e.readUInt16BE(4)]);this._handleChunkEnd()};Je.prototype._handleGAMA=function(e){this.read(e,this._parseGAMA.bind(this))};Je.prototype._parseGAMA=function(e){this._crc.write(e),this.gamma(e.readUInt32BE(0)/je.GAMMA_DIVISION),this._handleChunkEnd()};Je.prototype._handleIDAT=function(e){if(!this._emittedHeadersFinished)this._emittedHeadersFinished=!0,this.headersFinished();this.read(-e,this._parseIDAT.bind(this,e))};Je.prototype._parseIDAT=function(e,n){if(this._crc.write(n),this._colorType===je.COLORTYPE_PALETTE_COLOR&&this._palette.length===0)throw Error("Expected palette not found");this.inflateData(n);let t=e-n.length;if(t>0)this._handleIDAT(t);else this._handleChunkEnd()};Je.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))};Je.prototype._parseIEND=function(e){if(this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished)this.finished()}});var Hs=Me((Mm)=>{var ca=Ms(),km=[function(){},function(e,n,t,r){if(r===n.length)throw Error("Ran out of data");let i=n[r];e[t]=i,e[t+1]=i,e[t+2]=i,e[t+3]=255},function(e,n,t,r){if(r+1>=n.length)throw Error("Ran out of data");let i=n[r];e[t]=i,e[t+1]=i,e[t+2]=i,e[t+3]=n[r+1]},function(e,n,t,r){if(r+2>=n.length)throw Error("Ran out of data");e[t]=n[r],e[t+1]=n[r+1],e[t+2]=n[r+2],e[t+3]=255},function(e,n,t,r){if(r+3>=n.length)throw Error("Ran out of data");e[t]=n[r],e[t+1]=n[r+1],e[t+2]=n[r+2],e[t+3]=n[r+3]}],Em=[function(){},function(e,n,t,r){let i=n[0];e[t]=i,e[t+1]=i,e[t+2]=i,e[t+3]=r},function(e,n,t){let r=n[0];e[t]=r,e[t+1]=r,e[t+2]=r,e[t+3]=n[1]},function(e,n,t,r){e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=r},function(e,n,t){e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3]}];function ym(e,n){let t=[],r=0;function i(){if(r===e.length)throw Error("Ran out of data");let o=e[r];r++;let s,u,c,a,h,f,l,d;switch(n){default:throw Error("unrecognised depth");case 16:l=e[r],r++,t.push((o<<8)+l);break;case 4:l=o&15,d=o>>4,t.push(d,l);break;case 2:h=o&3,f=o>>2&3,l=o>>4&3,d=o>>6&3,t.push(d,l,f,h);break;case 1:s=o&1,u=o>>1&1,c=o>>2&1,a=o>>3&1,h=o>>4&1,f=o>>5&1,l=o>>6&1,d=o>>7&1,t.push(d,l,f,h,a,c,u,s);break}}return{get:function(o){while(t.length<o)i();let s=t.slice(0,o);return t=t.slice(o),s},resetAfterLine:function(){t.length=0},end:function(){if(r!==e.length)throw Error("extra data found")}}}function Sm(e,n,t,r,i,o){let{width:s,height:u,index:c}=e;for(let a=0;a<u;a++)for(let h=0;h<s;h++){let f=t(h,a,c);km[r](n,i,f,o),o+=r}return o}function vm(e,n,t,r,i,o){let{width:s,height:u,index:c}=e;for(let a=0;a<u;a++){for(let h=0;h<s;h++){let f=i.get(r),l=t(h,a,c);Em[r](n,f,l,o)}i.resetAfterLine()}}Mm.dataToBitMap=function(e,n){let{width:t,height:r,depth:i,bpp:o,interlace:s}=n,u;if(i!==8)u=ym(e,i);let c;if(i<=8)c=Buffer.alloc(t*r*4);else c=new Uint16Array(t*r*4);let a=Math.pow(2,i)-1,h=0,f,l;if(s)f=ca.getImagePasses(t,r),l=ca.getInterlaceIterator(t,r);else{let d=0;l=function(){let g=d;return d+=4,g},f=[{width:t,height:r}]}for(let d=0;d<f.length;d++)if(i===8)h=Sm(f[d],c,l,o,e,h);else vm(f[d],c,l,o,u,a);if(i===8){if(h!==e.length)throw Error("extra data found")}else u.end();return c}});var Ls=Me((HE,aa)=>{function Nm(e,n,t,r,i){let o=0;for(let s=0;s<r;s++)for(let u=0;u<t;u++){let c=i[e[o]];if(!c)throw Error("index "+e[o]+" not in palette");for(let a=0;a<4;a++)n[o+a]=c[a];o+=4}}function Om(e,n,t,r,i){let o=0;for(let s=0;s<r;s++)for(let u=0;u<t;u++){let c=!1;if(i.length===1){if(i[0]===e[o])c=!0}else if(i[0]===e[o]&&i[1]===e[o+1]&&i[2]===e[o+2])c=!0;if(c)for(let a=0;a<4;a++)n[o+a]=0;o+=4}}function Rm(e,n,t,r,i){let o=255,s=Math.pow(2,i)-1,u=0;for(let c=0;c<r;c++)for(let a=0;a<t;a++){for(let h=0;h<4;h++)n[u+h]=Math.floor(e[u+h]*o/s+0.5);u+=4}}aa.exports=function(e,n,t=!1){let{depth:r,width:i,height:o,colorType:s,transColor:u,palette:c}=n,a=e;if(s===3)Nm(e,a,i,o,c);else{if(u)Om(e,a,i,o,u);if(r!==8&&!t){if(r===16)a=Buffer.alloc(i*o*4);Rm(e,a,i,o,r)}}return a}});var la=Me((LE,fa)=>{var Fm=Ke("util"),As=Ke("zlib"),ha=vs(),Pm=ia(),Hm=Ps(),Lm=Hs(),Am=Ls(),Sn=fa.exports=function(e){ha.call(this),this._parser=new Hm(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};Fm.inherits(Sn,ha);Sn.prototype._handleError=function(e){if(this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy)this._inflate.destroy();if(this._filter)this._filter.destroy(),this._filter.on("error",function(){});this.errord=!0};Sn.prototype._inflateData=function(e){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=As.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let t=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,r=Math.max(t,As.Z_MIN_CHUNK);this._inflate=As.createInflate({chunkSize:r});let i=t,o=this.emit.bind(this,"error");this._inflate.on("error",function(u){if(!i)return;o(u)}),this._filter.on("complete",this._complete.bind(this));let s=this._filter.write.bind(this._filter);this._inflate.on("data",function(u){if(!i)return;if(u.length>i)u=u.slice(0,i);i-=u.length,s(u)}),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(e)};Sn.prototype._handleMetaData=function(e){this._metaData=e,this._bitmapInfo=Object.create(e),this._filter=new Pm(this._bitmapInfo)};Sn.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e};Sn.prototype._handlePalette=function(e){this._bitmapInfo.palette=e};Sn.prototype._simpleTransparency=function(){this._metaData.alpha=!0};Sn.prototype._headersFinished=function(){this.emit("metadata",this._metaData)};Sn.prototype._finished=function(){if(this.errord)return;if(!this._inflate)this.emit("error","No Inflate block");else this._inflate.end()};Sn.prototype._complete=function(e){if(this.errord)return;let n;try{let t=Lm.dataToBitMap(e,this._bitmapInfo);n=Am(t,this._bitmapInfo,this._options.skipRescale),t=null}catch(t){this._handleError(t);return}this.emit("parsed",n)}});var ga=Me((AE,da)=>{var un=Yt();da.exports=function(e,n,t,r){let i=[un.COLORTYPE_COLOR_ALPHA,un.COLORTYPE_ALPHA].indexOf(r.colorType)!==-1;if(r.colorType===r.inputColorType){let g=function(){let p=new ArrayBuffer(2);return new DataView(p).setInt16(0,256,!0),new Int16Array(p)[0]!==256}();if(r.bitDepth===8||r.bitDepth===16&&g)return e}let o=r.bitDepth!==16?e:new Uint16Array(e.buffer),s=255,u=un.COLORTYPE_TO_BPP_MAP[r.inputColorType];if(u===4&&!r.inputHasAlpha)u=3;let c=un.COLORTYPE_TO_BPP_MAP[r.colorType];if(r.bitDepth===16)s=65535,c*=2;let a=Buffer.alloc(n*t*c),h=0,f=0,l=r.bgColor||{};if(l.red===void 0)l.red=s;if(l.green===void 0)l.green=s;if(l.blue===void 0)l.blue=s;function d(){let g,p,k,y=s;switch(r.inputColorType){case un.COLORTYPE_COLOR_ALPHA:y=o[h+3],g=o[h],p=o[h+1],k=o[h+2];break;case un.COLORTYPE_COLOR:g=o[h],p=o[h+1],k=o[h+2];break;case un.COLORTYPE_ALPHA:y=o[h+1],g=o[h],p=g,k=g;break;case un.COLORTYPE_GRAYSCALE:g=o[h],p=g,k=g;break;default:throw Error("input color type:"+r.inputColorType+" is not supported at present")}if(r.inputHasAlpha){if(!i)y/=s,g=Math.min(Math.max(Math.round((1-y)*l.red+y*g),0),s),p=Math.min(Math.max(Math.round((1-y)*l.green+y*p),0),s),k=Math.min(Math.max(Math.round((1-y)*l.blue+y*k),0),s)}return{red:g,green:p,blue:k,alpha:y}}for(let g=0;g<t;g++)for(let p=0;p<n;p++){let k=d(o,h);switch(r.colorType){case un.COLORTYPE_COLOR_ALPHA:case un.COLORTYPE_COLOR:if(r.bitDepth===8){if(a[f]=k.red,a[f+1]=k.green,a[f+2]=k.blue,i)a[f+3]=k.alpha}else if(a.writeUInt16BE(k.red,f),a.writeUInt16BE(k.green,f+2),a.writeUInt16BE(k.blue,f+4),i)a.writeUInt16BE(k.alpha,f+6);break;case un.COLORTYPE_ALPHA:case un.COLORTYPE_GRAYSCALE:{let y=(k.red+k.green+k.blue)/3;if(r.bitDepth===8){if(a[f]=y,i)a[f+1]=k.alpha}else if(a.writeUInt16BE(y,f),i)a.writeUInt16BE(k.alpha,f+2);break}default:throw Error("unrecognised color Type "+r.colorType)}h+=u,f+=c}return a}});var wa=Me((TE,pa)=>{var ma=Is();function Tm(e,n,t,r,i){for(let o=0;o<t;o++)r[i+o]=e[n+o]}function Gm(e,n,t){let r=0,i=n+t;for(let o=n;o<i;o++)r+=Math.abs(e[o]);return r}function Um(e,n,t,r,i,o){for(let s=0;s<t;s++){let u=s>=o?e[n+s-o]:0,c=e[n+s]-u;r[i+s]=c}}function jm(e,n,t,r){let i=0;for(let o=0;o<t;o++){let s=o>=r?e[n+o-r]:0,u=e[n+o]-s;i+=Math.abs(u)}return i}function Jm(e,n,t,r,i){for(let o=0;o<t;o++){let s=n>0?e[n+o-t]:0,u=e[n+o]-s;r[i+o]=u}}function Cm(e,n,t){let r=0,i=n+t;for(let o=n;o<i;o++){let s=n>0?e[o-t]:0,u=e[o]-s;r+=Math.abs(u)}return r}function Wm(e,n,t,r,i,o){for(let s=0;s<t;s++){let u=s>=o?e[n+s-o]:0,c=n>0?e[n+s-t]:0,a=e[n+s]-(u+c>>1);r[i+s]=a}}function Km(e,n,t,r){let i=0;for(let o=0;o<t;o++){let s=o>=r?e[n+o-r]:0,u=n>0?e[n+o-t]:0,c=e[n+o]-(s+u>>1);i+=Math.abs(c)}return i}function _m(e,n,t,r,i,o){for(let s=0;s<t;s++){let u=s>=o?e[n+s-o]:0,c=n>0?e[n+s-t]:0,a=n>0&&s>=o?e[n+s-(t+o)]:0,h=e[n+s]-ma(u,c,a);r[i+s]=h}}function qm(e,n,t,r){let i=0;for(let o=0;o<t;o++){let s=o>=r?e[n+o-r]:0,u=n>0?e[n+o-t]:0,c=n>0&&o>=r?e[n+o-(t+r)]:0,a=e[n+o]-ma(s,u,c);i+=Math.abs(a)}return i}var Qm={0:Tm,1:Um,2:Jm,3:Wm,4:_m},Ym={0:Gm,1:jm,2:Cm,3:Km,4:qm};pa.exports=function(e,n,t,r,i){let o;if(!("filterType"in r)||r.filterType===-1)o=[0,1,2,3,4];else if(typeof r.filterType==="number")o=[r.filterType];else throw Error("unrecognised filter types");if(r.bitDepth===16)i*=2;let s=n*i,u=0,c=0,a=Buffer.alloc((s+1)*t),h=o[0];for(let f=0;f<t;f++){if(o.length>1){let l=1/0;for(let d=0;d<o.length;d++){let g=Ym[o[d]](e,c,s,i);if(g<l)h=o[d],l=g}}a[u]=h,u++,Qm[h](e,c,s,a,u,i),u+=s,c+=s}return a}});var Ts=Me((GE,$a)=>{var qe=Yt(),Zm=Fs(),Xm=ga(),Vm=wa(),zm=Ke("zlib"),Bn=$a.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32768,e.deflateLevel=e.deflateLevel!=null?e.deflateLevel:9,e.deflateStrategy=e.deflateStrategy!=null?e.deflateStrategy:3,e.inputHasAlpha=e.inputHasAlpha!=null?e.inputHasAlpha:!0,e.deflateFactory=e.deflateFactory||zm.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType=typeof e.colorType==="number"?e.colorType:qe.COLORTYPE_COLOR_ALPHA,e.inputColorType=typeof e.inputColorType==="number"?e.inputColorType:qe.COLORTYPE_COLOR_ALPHA,[qe.COLORTYPE_GRAYSCALE,qe.COLORTYPE_COLOR,qe.COLORTYPE_COLOR_ALPHA,qe.COLORTYPE_ALPHA].indexOf(e.colorType)===-1)throw Error("option color type:"+e.colorType+" is not supported at present");if([qe.COLORTYPE_GRAYSCALE,qe.COLORTYPE_COLOR,qe.COLORTYPE_COLOR_ALPHA,qe.COLORTYPE_ALPHA].indexOf(e.inputColorType)===-1)throw Error("option input color type:"+e.inputColorType+" is not supported at present");if(e.bitDepth!==8&&e.bitDepth!==16)throw Error("option bit depth:"+e.bitDepth+" is not supported at present")};Bn.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}};Bn.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())};Bn.prototype.filterData=function(e,n,t){let r=Xm(e,n,t,this._options),i=qe.COLORTYPE_TO_BPP_MAP[this._options.colorType];return Vm(r,n,t,this._options,i)};Bn.prototype._packChunk=function(e,n){let t=n?n.length:0,r=Buffer.alloc(t+12);if(r.writeUInt32BE(t,0),r.writeUInt32BE(e,4),n)n.copy(r,8);return r.writeInt32BE(Zm.crc32(r.slice(4,r.length-4)),r.length-4),r};Bn.prototype.packGAMA=function(e){let n=Buffer.alloc(4);return n.writeUInt32BE(Math.floor(e*qe.GAMMA_DIVISION),0),this._packChunk(qe.TYPE_gAMA,n)};Bn.prototype.packIHDR=function(e,n){let t=Buffer.alloc(13);return t.writeUInt32BE(e,0),t.writeUInt32BE(n,4),t[8]=this._options.bitDepth,t[9]=this._options.colorType,t[10]=0,t[11]=0,t[12]=0,this._packChunk(qe.TYPE_IHDR,t)};Bn.prototype.packIDAT=function(e){return this._packChunk(qe.TYPE_IDAT,e)};Bn.prototype.packIEND=function(){return this._packChunk(qe.TYPE_IEND,null)}});var ya=Me((UE,Ea)=>{var Bm=Ke("util"),ba=Ke("stream"),Dm=Yt(),xm=Ts(),ka=Ea.exports=function(e){ba.call(this);let n=e||{};this._packer=new xm(n),this._deflate=this._packer.createDeflate(),this.readable=!0};Bm.inherits(ka,ba);ka.prototype.pack=function(e,n,t,r){if(this.emit("data",Buffer.from(Dm.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(n,t)),r)this.emit("data",this._packer.packGAMA(r));let i=this._packer.filterData(e,n,t);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(o){this.emit("data",this._packer.packIDAT(o))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(i)}});var Oa=Me((Pr,Na)=>{var Sa=Ke("assert").ok,Zt=Ke("zlib"),ep=Ke("util"),va=Ke("buffer").kMaxLength;function mt(e){if(!(this instanceof mt))return new mt(e);if(e&&e.chunkSize<Zt.Z_MIN_CHUNK)e.chunkSize=Zt.Z_MIN_CHUNK;if(Zt.Inflate.call(this,e),this._offset=this._offset===void 0?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,e&&e.maxLength!=null)this._maxLength=e.maxLength}function np(e){return new mt(e)}function Ma(e,n){if(n)process.nextTick(n);if(!e._handle)return;e._handle.close(),e._handle=null}mt.prototype._processChunk=function(e,n,t){if(typeof t==="function")return Zt.Inflate._processChunk.call(this,e,n,t);let r=this,i=e&&e.length,o=this._chunkSize-this._offset,s=this._maxLength,u=0,c=[],a=0,h;this.on("error",function(g){h=g});function f(g,p){if(r._hadError)return;let k=o-p;if(Sa(k>=0,"have should not go down"),k>0){let y=r._buffer.slice(r._offset,r._offset+k);if(r._offset+=k,y.length>s)y=y.slice(0,s);if(c.push(y),a+=y.length,s-=y.length,s===0)return!1}if(p===0||r._offset>=r._chunkSize)o=r._chunkSize,r._offset=0,r._buffer=Buffer.allocUnsafe(r._chunkSize);if(p===0)return u+=i-g,i=g,!0;return!1}Sa(this._handle,"zlib binding closed");let l;do l=this._handle.writeSync(n,e,u,i,this._buffer,this._offset,o),l=l||this._writeState;while(!this._hadError&&f(l[0],l[1]));if(this._hadError)throw h;if(a>=va)throw Ma(this),RangeError("Cannot create final Buffer. It would be larger than 0x"+va.toString(16)+" bytes");let d=Buffer.concat(c,a);return Ma(this),d};ep.inherits(mt,Zt.Inflate);function tp(e,n){if(typeof n==="string")n=Buffer.from(n);if(!(n instanceof Buffer))throw TypeError("Not a string or buffer");let t=e._finishFlushFlag;if(t==null)t=Zt.Z_FINISH;return e._processChunk(n,t)}function Ia(e,n){return tp(new mt(n),e)}Na.exports=Pr=Ia;Pr.Inflate=mt;Pr.createInflate=np;Pr.inflateSync=Ia});var Gs=Me((jE,Fa)=>{var Ra=Fa.exports=function(e){this._buffer=e,this._reads=[]};Ra.prototype.read=function(e,n){this._reads.push({length:Math.abs(e),allowLess:e<0,func:n})};Ra.prototype.process=function(){while(this._reads.length>0&&this._buffer.length){let e=this._reads[0];if(this._buffer.length&&(this._buffer.length>=e.length||e.allowLess)){this._reads.shift();let n=this._buffer;this._buffer=n.slice(e.length),e.func.call(this,n.slice(0,e.length))}else break}if(this._reads.length>0)throw Error("There are some read requests waitng on finished stream");if(this._buffer.length>0)throw Error("unrecognised content at end of stream")}});var Pa=Me((op)=>{var rp=Gs(),ip=Ns();op.process=function(e,n){let t=[],r=new rp(e);return new ip(n,{read:r.read.bind(r),write:function(o){t.push(o)},complete:function(){}}).start(),r.process(),Buffer.concat(t)}});var Ta=Me((CE,Aa)=>{var Ha=!0,La=Ke("zlib"),up=Oa();if(!La.deflateSync)Ha=!1;var cp=Gs(),ap=Pa(),hp=Ps(),fp=Hs(),lp=Ls();Aa.exports=function(e,n){if(!Ha)throw Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let t;function r(S){t=S}let i;function o(S){i=S}function s(S){i.transColor=S}function u(S){i.palette=S}function c(){i.alpha=!0}let a;function h(S){a=S}let f=[];function l(S){f.push(S)}let d=new cp(e);if(new hp(n,{read:d.read.bind(d),error:r,metadata:o,gamma:h,palette:u,transColor:s,inflateData:l,simpleTransparency:c}).start(),d.process(),t)throw t;let p=Buffer.concat(f);f.length=0;let k;if(i.interlace)k=La.inflateSync(p);else{let m=((i.width*i.bpp*i.depth+7>>3)+1)*i.height;k=up(p,{chunkSize:m,maxLength:m})}if(p=null,!k||!k.length)throw Error("bad png - invalid inflate data response");let y=ap.process(k,i);p=null;let M=fp.dataToBitMap(y,i);y=null;let b=lp(M,i,n.skipRescale);return i.data=b,i.gamma=a||0,i}});var Ja=Me((WE,ja)=>{var Ga=!0,Ua=Ke("zlib");if(!Ua.deflateSync)Ga=!1;var dp=Yt(),gp=Ts();ja.exports=function(e,n){if(!Ga)throw Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let r=new gp(n||{}),i=[];if(i.push(Buffer.from(dp.PNG_SIGNATURE)),i.push(r.packIHDR(e.width,e.height)),e.gamma)i.push(r.packGAMA(e.gamma));let o=r.filterData(e.data,e.width,e.height),s=Ua.deflateSync(o,r.getDeflateOptions());if(o=null,!s||!s.length)throw Error("bad png - invalid compressed data response");return i.push(r.packIDAT(s)),i.push(r.packIEND()),Buffer.concat(i)}});var Ca=Me((wp)=>{var mp=Ta(),pp=Ja();wp.read=function(e,n){return mp(e,n||{})};wp.write=function(e,n){return pp(e,n)}});var Ka=Me((vp)=>{var kp=Ke("util"),Wa=Ke("stream"),Ep=la(),yp=ya(),Sp=Ca(),Ye=vp.PNG=function(e){if(Wa.call(this),e=e||{},this.width=e.width|0,this.height=e.height|0,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,e.fill&&this.data)this.data.fill(0);this.gamma=0,this.readable=this.writable=!0,this._parser=new Ep(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(n){this.data=n,this.emit("parsed",n)}.bind(this)),this._packer=new yp(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};kp.inherits(Ye,Wa);Ye.sync=Sp;Ye.prototype.pack=function(){if(!this.data||!this.data.length)return this.emit("error","No data provided"),this;return process.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this};Ye.prototype.parse=function(e,n){if(n){let t,r;t=function(i){this.removeListener("error",r),this.data=i,n(null,this)}.bind(this),r=function(i){this.removeListener("parsed",t),n(i,null)}.bind(this),this.once("parsed",t),this.once("error",r)}return this.end(e),this};Ye.prototype.write=function(e){return this._parser.write(e),!0};Ye.prototype.end=function(e){this._parser.end(e)};Ye.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)};Ye.prototype._gamma=function(e){this.gamma=e};Ye.prototype._handleClose=function(){if(!this._parser.writable&&!this._packer.readable)this.emit("close")};Ye.bitblt=function(e,n,t,r,i,o,s,u){if(t|=0,r|=0,i|=0,o|=0,s|=0,u|=0,t>e.width||r>e.height||t+i>e.width||r+o>e.height)throw Error("bitblt reading outside image");if(s>n.width||u>n.height||s+i>n.width||u+o>n.height)throw Error("bitblt writing outside image");for(let c=0;c<o;c++)e.data.copy(n.data,(u+c)*n.width+s<<2,(r+c)*e.width+t<<2,(r+c)*e.width+t+i<<2)};Ye.prototype.bitblt=function(e,n,t,r,i,o,s){return Ye.bitblt(this,e,n,t,r,i,o,s),this};Ye.adjustGamma=function(e){if(e.gamma){for(let n=0;n<e.height;n++)for(let t=0;t<e.width;t++){let r=e.width*n+t<<2;for(let i=0;i<3;i++){let o=e.data[r+i]/255;o=Math.pow(o,0.45454545454545453/e.gamma),e.data[r+i]=Math.round(o*255)}}e.gamma=0}};Ye.prototype.adjustGamma=function(){Ye.adjustGamma(this)}});var lu=Me((bS,Jf)=>{var fu={to(e,n){if(!n)return`\x1B[${e+1}G`;return`\x1B[${n+1};${e+1}H`},move(e,n){let t="";if(e<0)t+=`\x1B[${-e}D`;else if(e>0)t+=`\x1B[${e}C`;if(n<0)t+=`\x1B[${-n}A`;else if(n>0)t+=`\x1B[${n}B`;return t},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},w0={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},$0={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let n="";for(let t=0;t<e;t++)n+=this.line+(t<e-1?fu.up():"");if(e)n+=fu.left;return n}};Jf.exports={cursor:fu,scroll:w0,erase:$0,beep:"\x07"}});import{spawnSync as U1}from"node:child_process";import{isMainThread as j1}from"node:worker_threads";import{parseArgs as H1}from"node:util";var _e={name:"@kecan0406/ttheme",version:"1.0.48",type:"module",bin:{ttheme:"bin/ttheme.js"},files:["bin","dist/manifest.json","shell","!shell/check.zsh"],description:"Character terminal palettes for Ghostty, kitty, Alacritty, WezTerm, iTerm2, Windows Terminal and Warp",license:"MIT",author:"kecan0406",repository:{type:"git",url:"git+https://github.com/kecan0406/ttheme.git"},homepage:"https://github.com/kecan0406/ttheme#readme",bugs:"https://github.com/kecan0406/ttheme/issues",keywords:["terminal","theme","ghostty","kitty","alacritty","wezterm","iterm2"],devDependencies:{"@biomejs/biome":"^2.3.0","@clack/core":"^1.4.3","@clack/prompts":"^1.7.0","@material/material-color-utilities":"^0.4.0","@types/bun":"^1.3.0","@types/pngjs":"6.0.5","jpeg-js":"^0.4.4",pngjs:"7.0.0","smol-toml":"^1.9.0",typescript:"^5.8.2"},engines:{bun:">=1.3",node:">=20.11"}};import{rmSync as Sf}from"node:fs";import{basename as n0,join as fi}from"node:path";var Dg=/^#[0-9a-f]{6}$/;function Wt(e){return Dg.test(e)}function We(e){let n=Number.parseInt(e.slice(1),16);return[n>>16&255,n>>8&255,n&255]}function Qe(e){let[n,t,r]=We(e).map((i)=>{let o=i/255;return o<=0.03928?o/12.92:((o+0.055)/1.055)**2.4});return 0.2126*n+0.7152*t+0.0722*r}function Be(e,n){let t=Qe(e),r=Qe(n);return(Math.max(t,r)+0.05)/(Math.min(t,r)+0.05)}function Wi(e,n){return Math.round(Be(e,n)*100)/100}function xg(e){let n=e/255;return n<=0.04045?n/12.92:((n+0.055)/1.055)**2.4}function dn(e){let[n,t,r]=We(e).map(xg),i=Math.cbrt(0.4122214708*n+0.5363325363*t+0.0514459929*r),o=Math.cbrt(0.2119034982*n+0.6806995451*t+0.1073969566*r),s=Math.cbrt(0.0883024619*n+0.2817188376*t+0.6299787005*r),u=1.9779984951*i-2.428592205*o+0.4505937099*s,c=0.0259040371*i+0.7827717662*o-0.808675766*s;return{l:0.2104542553*i+0.793617785*o-0.0040720468*s,c:Math.hypot(u,c),h:(Math.atan2(c,u)*180/Math.PI+360)%360}}var Zn=7,Pc=3,gs=0.15,Hc=1.6,ps=[1,2,3,4,5,6,9,10,11,12,13,14],Lc=[7,15],Kt=[1,2,3,4,5,6],Or={1:{name:"red",center:19,width:25},2:{name:"green",center:132,width:35},3:{name:"yellow",center:88,width:35},4:{name:"blue",center:250,width:60},5:{name:"magenta",center:329,width:40},6:{name:"cyan",center:197,width:60}},ws=0.03,dt=25,Qi=15,Yi=0.08;function Gn(e,n){let t=e.ansi[n];if(t===void 0)throw Error(`${e.name}: missing ANSI ${n}`);return t}function ms(e,n,t){let r=e.background;return n.flatMap((i)=>{let o=Gn(e,i);return Be(o,r)<t?[`ANSI ${i} ${o} on ${r} is ${Wi(o,r)}:1, needs ${t}:1`]:[]})}function Ac(e,n){return Math.min(...n.map((t)=>Be(Gn(e,t),e.background)))}var Tc=[{rule:"foreground",label:"foreground on background",unit:"ratio",min:Zn,measure:({foreground:e,background:n})=>Be(e,n),check:({foreground:e,background:n})=>Be(e,n)<Zn?[`foreground ${e} on ${n} is ${Wi(e,n)}:1, needs ${Zn}:1`]:[]},{rule:"accents",label:"weakest accent on background",unit:"ratio",min:Pc,measure:(e)=>Ac(e,ps),check:(e)=>ms(e,ps,Pc)},{rule:"ansi0-dark",label:"ansi0 luminance",unit:"luminance",max:gs,measure:(e)=>Qe(Gn(e,0)),check:(e)=>{let n=Gn(e,0);return Qe(n)>gs?[`ANSI 0 ${n} has luminance ${Qe(n).toFixed(3)}, needs <= ${gs}`]:[]}},{rule:"light-ansi",label:"ansi7 and ansi15 on background",unit:"ratio",min:Zn,measure:(e)=>Ac(e,Lc),check:(e)=>ms(e,Lc,Zn)},{rule:"ansi8-visible",label:"ansi8 on background",unit:"ratio",min:Hc,measure:(e)=>Be(Gn(e,8),e.background),check:(e)=>ms(e,[8],Hc)},{rule:"selection",label:"foreground on selection",unit:"ratio",min:Zn,measure:({foreground:e,selectionBackground:n})=>n===void 0?Number.NaN:Be(e,n),check:({foreground:e,selectionBackground:n})=>n!==void 0&&Be(e,n)<Zn?[`foreground ${e} on selection ${n} is ${Wi(e,n)}:1, needs ${Zn}:1`]:[]}];function Xn(e,n){let t=Math.abs(e-n)%360;return Math.min(t,360-t)}var _t=(e)=>e>8?e-8:e;function Zi(e){let n=e.signatureSlots.filter((t)=>t.startsWith("ansi")).map((t)=>Number(t.slice(4)));return new Set(n.flatMap((t)=>Kt.includes(_t(t))?[t,t>8?t-8:t+8]:[t]))}function Nr(e,n){let t=dn(Gn(e,n));return t.c<ws?void 0:t}function Ki(e){let n=Zi(e);return ps.flatMap((t)=>{let r=Nr(e,t),i=Or[_t(t)];if(r===void 0||i===void 0||n.has(t))return[];let o=Xn(r.h,i.center)-i.width;return o>0?[{slot:t,hue:r.h,over:o}]:[]})}function _i(e){let n=new Set(e.signatureSlots);return Kt.flatMap((t)=>{let r=Nr(e,t),i=Nr(e,t+8);if(r===void 0||i===void 0||n.has(`ansi${t}`)&&n.has(`ansi${t+8}`))return[];return[{normal:t,gap:Xn(r.h,i.h)}]})}function qi(e){let n=Zi(e);return[0,8].flatMap((t)=>Kt.flatMap((r)=>Kt.filter((i)=>i>r).flatMap((i)=>{let[o,s]=[t+r,t+i],u=Nr(e,o),c=Nr(e,s);if(u===void 0||c===void 0||n.has(o)&&n.has(s))return[];return Xn(u.h,c.h)<Qi&&Math.abs(u.l-c.l)<Yi?[[o,s]]:[]})))}var em=[{rule:"ansi-role",label:"accent hue outside its ANSI role",unit:"degrees",max:0,measure:(e)=>Math.max(0,...Ki(e).map((n)=>n.over)),check:(e)=>Ki(e).map(({slot:n,hue:t,over:r})=>{let i=Or[_t(n)];return`ANSI ${n} ${Gn(e,n)} has hue ${t.toFixed(0)}°, ${r.toFixed(0)}° outside ${i.name} (${i.center}±${i.width}°)`})},{rule:"bright-follows",label:"widest normal to bright hue gap",unit:"degrees",max:dt,measure:(e)=>Math.max(0,..._i(e).map((n)=>n.gap)),check:(e)=>_i(e).filter((n)=>n.gap>dt).map(({normal:n,gap:t})=>`ANSI ${n+8} is ${t.toFixed(0)}° from ANSI ${n}, needs <= ${dt}°`)},{rule:"distinct",label:"accent pairs that read as one color",unit:"pairs",max:0,measure:(e)=>qi(e).length,check:(e)=>qi(e).map(([n,t])=>`ANSI ${n} ${Gn(e,n)} and ANSI ${t} ${Gn(e,t)} are within ${Qi}° hue and ${Yi} lightness`)}],Xi=[...Tc,...em],$s=Xi.map((e)=>e.rule),gt=Xi.map(({rule:e,label:n,unit:t,min:r,max:i})=>({rule:e,label:n,unit:t,...r===void 0?{}:{min:r},...i===void 0?{}:{max:i}}));function qt(e){return Xi.map((n)=>Math.round(n.measure(e)*1000)/1000)}function Gc(e,n){return e.filter((t)=>!n.waive.includes(t.rule)).flatMap((t)=>t.check(n).map((r)=>({theme:n.name,rule:t.rule,detail:r})))}function Vi(e){return Gc(Xi,e)}function Uc(e){return Gc(Tc,e)}function jc(e){return e.flatMap(Vi)}import{readdirSync as rw,readFileSync as bh}from"node:fs";import{basename as iw,join as kh}from"node:path";/*!
|
|
3
3
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*
|
|
@@ -536,5 +536,5 @@ ${N===_e.version?"reinstall":"update to"} ${_e.version} and keep all of it?`,act
|
|
|
536
536
|
${pc(t.verb)}`:`ttheme: ${t.message} — see \`ttheme help\``),1;if(t instanceof ft)return 1;let r=process.env.TTHEME_DEBUG&&t instanceof Error?t.stack:void 0;return console.error(`
|
|
537
537
|
ttheme${n?` ${n.name}`:""}: ${r??(t instanceof Error?t.message:String(t))}`),1}}if(j1)if(process.env.TTHEME_DEBUG&&typeof Bun>"u"&&!process.sourceMapsEnabled){let e=U1(process.execPath,["--enable-source-maps",...process.argv.slice(1)],{stdio:"inherit"});process.exitCode=e.status??1}else process.exitCode=await Wg(process.argv.slice(2));
|
|
538
538
|
|
|
539
|
-
//# debugId=
|
|
539
|
+
//# debugId=9ACB4198213FBE7264756E2164756E21
|
|
540
540
|
//# sourceMappingURL=ttheme.js.map
|