// 美团小程序 jsguard 里那套自带的 gzip/deflate —— 原样搬出的明码实现(不依赖混淆包) // 为什么必须搬它:它跟 zlib/pako 不是同一实现(自定义 3 字节哈希 + memLevel=ceil(1.5*max(8,min(13,ln(len))))), // 用 zlib 压出来的 a6 密文与真机不同;而 a6 的头还写 MTIME=当前秒、OS=3。 // 已实测:同一输入下本文件输出与 jsguard 的 gzipSync 逐字节一致(含头/尾)。 var wt=Uint8Array,zt=Uint16Array,xt=Uint32Array,Ct=new wt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),_t=new wt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Dt=new wt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),At=function(e,t){for(var n=new zt(31),c=0;31>c;++c)n[c]=t+=1<c;++c)for(t=n[c];tLt;++Lt){var Pt=(43690&Lt)>>>1|(21845&Lt)<<1;Pt=(61680&(Pt=(52428&Pt)>>>2|(13107&Pt)<<2))>>>4|(3855&Pt)<<4,jt[Lt]=((65280&Pt)>>>8|(255&Pt)<<8)>>>1}var Ot=function(e,t,n){for(var c=e.length,a=0,r=new zt(t);a>>r]=o}}else for(n=new zt(c),a=0;a>>15-e[a];return n},Nt=new wt(288);for(Lt=0;144>Lt;++Lt)Nt[Lt]=8;for(Lt=144;256>Lt;++Lt)Nt[Lt]=9;for(Lt=256;280>Lt;++Lt)Nt[Lt]=7;for(Lt=280;288>Lt;++Lt)Nt[Lt]=8;var qt=new wt(32);for(Lt=0;32>Lt;++Lt)qt[Lt]=5;var It,Ut,Jt,Tt=Ot(Nt,9,0),Wt=Ot(qt,5,0),kt=function(e,t,n){(null==t||0>t)&&(t=0),(null==n||n>e.length)&&(n=e.length);var c=new(e instanceof zt?zt:e instanceof xt?xt:wt)(n-t);return c.set(e.subarray(t,n)),c},Ht=function(e,t,n){n<<=7&t,e[t=t/8>>0]|=n,e[t+1]|=n>>>8},Yt=function(e,t,n){n<<=7&t,e[t=t/8>>0]|=n,e[t+1]|=n>>>8,e[t+2]|=n>>>16},Et=function(e,t){for(var n=[],c=0;cr&&(r=e[c].s);var s=new zt(r+1);if((o=Kt(n[o-1],s,0))>t){for(n=c=0,i=1<<(r=o-t),e.sort((function(e,t){return s[t.s]-s[e.s]||e.f-t.f}));ct);++c)n+=i-(1<>>=r;0>0)+(7&t&&1)]=255&c,e[t+1]=c>>>8,e[t+2]=255^e[t],e[t+3]=255^e[t+1];for(var a=0;ap;++p)for(v=l[p],w=0;w>>5&127),d+=v[w]>>>12)}else e=Tt,f=Nt,s=Wt,g=qt;for(w=0;w>>18&31,Yt(t,d,e[y+257]),d+=f[y+257],7>>23&31),d+=Ct[y]),n=31&c[w],Yt(t,d,s[n]),d+=g[n],3>>5&8191),d+=_t[n])):(Yt(t,d,e[c[w]]),d+=f[c[w]]);return Yt(t,d,e[256]),d+f[256]},Xt=new xt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gt=new wt(0),Qt=function(){for(var e=new xt(256),t=0;256>t;++t){for(var n=t,c=9;--c;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),$t=function(){var e=4294967295;return{p:function(t){for(var n=e,c=0;c>>8;e=n},d:function(){return 4294967295^e}}},en=function(e,t,n,c,a){return function(e,t,n,c,a,r){var i=e.length,o=new wt(c+i+5*(1+Math.floor(i/7e3))+a),f=o.subarray(c,o.length-a),s=0;if(!t||8>i)for(n=0;n<=i;n+=65535)(t=n+65535)>>13,d&=8191;for(var u=(1<B;++B)y[B]=0;for(B=0;30>B;++B)m[B]=0}var j=2,L=0,P=d,O=A-S&32767;if(2j){if(j=B,L=O,B>D)break;var q=Math.min(O,B-2),I=0;for(B=0;BI&&(I=J,S=U)}}}O+=(A=S)-(S=b[A])+32768&32767}}L?(v[x++]=268435456|Mt[j]<<18|Bt[L],C=31&Mt[j],L=31&Bt[L],z+=Ct[C]+_t[L],++y[257+C],++m[L],C=n+j,++w):(v[x++]=e[n],++y[e[n]])}}s=Ft(e,f,r,v,y,m,z,x,_,n-_,s),r||(s=Zt(f,s,Gt))}return kt(o,0,c+((s/8>>0)+(7&s&&1))+a)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,c,!a)},tn=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},nn={gzipSync:V,compressSync:V,strToU8:function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var c=new wt(e.length+(e.length>>>1)),a=0,r=function(e){c[a++]=e},i=0;ic.length){var o=new wt(a+8+(n-i<<1));o.set(c),c=o}128>(o=e.charCodeAt(i))||t?r(o):2048>o?(r(192|o>>>6),r(128|63&o)):55295o?(r(240|(o=65536+(1047552&o)|1023&e.charCodeAt(++i))>>>18),r(128|o>>>12&63),r(128|o>>>6&63),r(128|63&o)):(r(224|o>>>12),r(128|o>>>6&63),r(128|63&o))}return kt(c,0,a)}}; function V(e,t){void 0===t&&(t={});var n=$t(),c=e.length;n.p(e);var a=(e=en(e,t,10+(t.filename&&t.filename.length+1||0),8)).length,r=t;if(t=r.filename,e[0]=31,e[1]=139,e[2]=8,e[8]=2>r.level?4:9==r.level?2:0,e[9]=3,0!=r.mtime&&tn(e,4,Math.floor(new Date(r.mtime||Date.now())/1e3)),t)for(e[3]=8,r=0;r<=t.length;++r)e[r+10]=t.charCodeAt(r);return tn(e,a-8,n.d()),tn(e,a-4,c),e} export const gzipSync = V; export const strToU8 = nn.strToU8; export default nn;