@zip.js/zip.js 2.5.3 → 2.5.7
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/dist/z-worker-fflate.js +1 -1
- package/dist/z-worker-pako.js +1 -1
- package/dist/z-worker.js +1 -1
- package/dist/zip-fs-full.js +470 -499
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +470 -499
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +470 -499
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker-inflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +470 -499
- package/dist/zip.min.js +1 -1
- package/index-fflate.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +3 -3
- package/lib/core/{engine.js → codec-interface.js} +52 -50
- package/lib/core/{codecs/codec-pool-worker.js → codec-pool-worker.js} +55 -29
- package/lib/core/{codecs/codec-pool.js → codec-pool.js} +28 -9
- package/lib/core/configuration.js +10 -1
- package/lib/core/io.js +102 -100
- package/lib/core/{codecs → streams}/aes-crypto-stream.js +68 -54
- package/lib/core/{codecs → streams}/codec-stream.js +6 -6
- package/lib/core/{codecs → streams/codecs}/crc32.js +0 -0
- package/lib/core/{codecs → streams/codecs}/deflate.js +0 -0
- package/lib/core/{codecs → streams/codecs}/inflate.js +0 -0
- package/lib/core/{codecs → streams/codecs}/sjcl.js +0 -0
- package/lib/core/{codecs → streams}/crc32-stream.js +3 -4
- package/lib/core/{codecs → streams}/zip-crypto-stream.js +28 -32
- package/lib/core/streams/zip-entry-stream.js +185 -0
- package/lib/core/z-worker-core.js +30 -15
- package/lib/core/zip-fs-core.js +1 -1
- package/lib/core/zip-reader.js +21 -12
- package/lib/core/zip-writer.js +33 -25
- package/lib/z-worker-fflate.js +4 -1
- package/lib/z-worker-inline.js +1 -1
- package/lib/z-worker.js +2 -2
- package/lib/zip-fflate-shim.js +4 -1
- package/lib/zip-fs.js +6 -2
- package/lib/zip-full-fflate.js +6 -3
- package/lib/zip-full.js +8 -5
- package/lib/zip-no-worker-deflate.js +7 -3
- package/lib/zip-no-worker-fflate-deflate.js +6 -2
- package/lib/zip-no-worker-fflate-inflate.js +6 -3
- package/lib/zip-no-worker-fflate.js +6 -3
- package/lib/zip-no-worker-inflate.js +7 -4
- package/lib/zip-no-worker.js +8 -5
- package/lib/zip.js +6 -3
- package/package.json +2 -8
- package/lib/core/codecs/codec.js +0 -246
package/dist/zip-full.js
CHANGED
|
@@ -4270,6 +4270,7 @@
|
|
|
4270
4270
|
|
|
4271
4271
|
/* global navigator */
|
|
4272
4272
|
|
|
4273
|
+
const MINIMUM_CHUNK_SIZE = 64;
|
|
4273
4274
|
const DEFAULT_CONFIGURATION = {
|
|
4274
4275
|
chunkSize: 512 * 1024,
|
|
4275
4276
|
maxWorkers: (typeof navigator != "undefined" && navigator.hardwareConcurrency) || 2,
|
|
@@ -4284,6 +4285,10 @@
|
|
|
4284
4285
|
return config;
|
|
4285
4286
|
}
|
|
4286
4287
|
|
|
4288
|
+
function getChunkSize(config) {
|
|
4289
|
+
return Math.max(config.chunkSize, MINIMUM_CHUNK_SIZE);
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4287
4292
|
function configure(configuration) {
|
|
4288
4293
|
if (configuration.baseURL !== undefined) {
|
|
4289
4294
|
config.baseURL = configuration.baseURL;
|
|
@@ -4297,6 +4302,9 @@
|
|
|
4297
4302
|
if (configuration.terminateWorkerTimeout !== undefined) {
|
|
4298
4303
|
config.terminateWorkerTimeout = configuration.terminateWorkerTimeout;
|
|
4299
4304
|
}
|
|
4305
|
+
if (configuration.useCompressionStream !== undefined) {
|
|
4306
|
+
config.useCompressionStream = configuration.useCompressionStream;
|
|
4307
|
+
}
|
|
4300
4308
|
if (configuration.useWebWorkers !== undefined) {
|
|
4301
4309
|
config.useWebWorkers = configuration.useWebWorkers;
|
|
4302
4310
|
}
|
|
@@ -4328,7 +4336,7 @@
|
|
|
4328
4336
|
}
|
|
4329
4337
|
}
|
|
4330
4338
|
|
|
4331
|
-
var e=e=>{if("function"==typeof URL.createObjectURL){const t=()=>URL.createObjectURL(new Blob(['const{Array:t,Object:e,Math:n,Error:r,Uint8Array:i,Uint16Array:s,Uint32Array:o,Int32Array:f,DataView:c,TextEncoder:a,crypto:l,postMessage:u,TransformStream:w,ReadableStream:h,WritableStream:d,CompressionStream:p,DecompressionStream:y}=globalThis,b=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)1&e?e=e>>>1^3988292384:e>>>=1;b[t]=e}class m{constructor(t){this.t=t||-1}append(t){let e=0|this.t;for(let n=0,r=0|t.length;r>n;n++)e=e>>>8^b[255&(e^t[n])];this.t=e}get(){return~this.t}}class k extends w{constructor(){super({start(){this.i=new m},transform(t){t&&this.i.append(t)},flush(t){const e=new i(4);new c(e.buffer).setUint32(0,this.i.get()),t.enqueue(e)}})}}const v={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],r=v.o(n);return 32===r?t.concat(e):v.l(e,r,0|n,t.slice(0,t.length-1))},u(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+v.o(n)},h(t,e){if(32*t.length<e)return t;const r=(t=t.slice(0,n.ceil(e/32))).length;return e&=31,r>0&&e&&(t[r-1]=v.p(e,t[r-1]&2147483648>>e-1,1)),t},p:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,o:t=>n.round(t/1099511627776)||32,l(t,e,n,r){for(void 0===r&&(r=[]);e>=32;e-=32)r.push(n),n=0;if(0===e)return r.concat(t);for(let i=0;i<t.length;i++)r.push(n|t[i]>>>e),n=t[i]<<32-e;const i=t.length?t[t.length-1]:0,s=v.o(i);return r.push(v.p(e+s&31,e+s>32?n:r.pop(),1)),r}},g={m:{k(t){const e=v.u(t)/8,n=new i(e);let r;for(let i=0;e>i;i++)0==(3&i)&&(r=t[i/4]),n[i]=r>>>24,r<<=8;return n},v(t){const e=[];let n,r=0;for(n=0;n<t.length;n++)r=r<<8|t[n],3==(3&n)&&(e.push(r),r=0);return 3&n&&e.push(v.p(8*(3&n),r)),e}}},S={g:function(t){t?(this.S=t.S.slice(0),this._=t._.slice(0),this.C=t.C):this.reset()}};S.g.prototype={blockSize:512,reset:function(){const t=this;return t.S=this.I.slice(0),t._=[],t.C=0,t},update:function(t){const e=this;"string"==typeof t&&(t=g.A.v(t));const n=e._=v.concat(e._,t),i=e.C,s=e.C=i+v.u(t);if(s>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const f=new o(n);let c=0;for(let t=e.blockSize+i-(e.blockSize+i&e.blockSize-1);s>=t;t+=e.blockSize)e.V(f.subarray(16*c,16*(c+1))),c+=1;return n.splice(0,16*c),e},P:function(){const t=this;let e=t._;const r=t.S;e=v.concat(e,[v.p(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(n.floor(t.C/4294967296)),e.push(0|t.C);e.length;)t.V(e.splice(0,16));return t.reset(),r},I:[1732584193,4023233417,2562383102,271733878,3285377520],B:[1518500249,1859775393,2400959708,3395469782],D:(t,e,n,r)=>t>19?t>39?t>59?t>79?void 0:e^n^r:e&n|e&r|n&r:e^n^r:e&n|~e&r,M:(t,e)=>e<<t|e>>>32-t,V:function(e){const r=this,i=r.S,s=t(80);for(let t=0;16>t;t++)s[t]=e[t];let o=i[0],f=i[1],c=i[2],a=i[3],l=i[4];for(let t=0;79>=t;t++){16>t||(s[t]=r.M(1,s[t-3]^s[t-8]^s[t-14]^s[t-16]));const e=r.M(5,o)+r.D(t,f,c,a)+l+s[t]+r.B[n.floor(t/20)]|0;l=a,a=c,c=r.M(30,f),f=o,o=e}i[0]=i[0]+o|0,i[1]=i[1]+f|0,i[2]=i[2]+c|0,i[3]=i[3]+a|0,i[4]=i[4]+l|0}};const z={getRandomValues(t){const e=new o(t.buffer),r=t=>{let e=987654321;const r=4294967295;return()=>(e=36969*(65535&e)+(e>>16)&r,(((e<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r)/4294967296+.5)*(n.random()>.5?1:-1))};for(let i,s=0;s<t.length;s+=4){const t=r(4294967296*(i||n.random()));i=987654071*t(),e[s/4]=4294967296*t()|0}return t}},_={importKey:t=>new _.R(g.m.v(t)),U(t,e,n,i){if(n=n||1e4,0>i||0>n)throw new r("invalid params to pbkdf2");const s=1+(i>>5)<<2;let o,f,a,l,u;const w=new ArrayBuffer(s),h=new c(w);let d=0;const p=v;for(e=g.m.v(e),u=1;(s||1)>d;u++){for(o=f=t.encrypt(p.concat(e,[u])),a=1;n>a;a++)for(f=t.encrypt(f),l=0;l<f.length;l++)o[l]^=f[l];for(a=0;(s||1)>d&&a<o.length;a++)h.setInt32(d,o[a]),d+=4}return w.slice(0,i/8)},R:class{constructor(t){const e=this,n=e.T=S.g,r=[[],[]],i=n.prototype.blockSize/32;e.j=[new n,new n],t.length>i&&(t=n.hash(t));for(let e=0;i>e;e++)r[0][e]=909522486^t[e],r[1][e]=1549556828^t[e];e.j[0].update(r[0]),e.j[1].update(r[1]),e.H=new n(e.j[0])}reset(){const t=this;t.H=new t.T(t.j[0]),t.K=!1}update(t){this.K=!0,this.H.update(t)}digest(){const t=this,e=t.H.P(),n=new t.T(t.j[1]).update(e).P();return t.reset(),n}encrypt(t){if(this.K)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},C={name:"PBKDF2"},I=e.assign({hash:{name:"HMAC"}},C),A=e.assign({iterations:1e3,hash:{name:"SHA-1"}},C),x=["deriveBits"],V=[8,12,16],P=[16,24,32],B=[0,0,0,0],D=void 0!==l,E=D&&void 0!==l.subtle,M=g.m,R=class{constructor(t){const e=this;e.L=[[[],[],[],[],[]],[[],[],[],[],[]]],e.L[0][0][0]||e.W();const n=e.L[0][4],i=e.L[1],s=t.length;let o,f,c,a=1;if(4!==s&&6!==s&&8!==s)throw new r("invalid aes key size");for(e.B=[f=t.slice(0),c=[]],o=s;4*s+28>o;o++){let t=f[o-1];(o%s==0||8===s&&o%s==4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],o%s==0&&(t=t<<8^t>>>24^a<<24,a=a<<1^283*(a>>7))),f[o]=f[o-s]^t}for(let t=0;o;t++,o--){const e=f[3&t?o:o-4];c[t]=4>=o||4>t?e:i[0][n[e>>>24]]^i[1][n[e>>16&255]]^i[2][n[e>>8&255]]^i[3][n[255&e]]}}encrypt(t){return this.F(t,0)}decrypt(t){return this.F(t,1)}W(){const t=this.L[0],e=this.L[1],n=t[4],r=e[4],i=[],s=[];let o,f,c,a;for(let t=0;256>t;t++)s[(i[t]=t<<1^283*(t>>7))^t]=t;for(let l=o=0;!n[l];l^=f||1,o=s[o]||1){let s=o^o<<1^o<<2^o<<3^o<<4;s=s>>8^255&s^99,n[l]=s,r[s]=l,a=i[c=i[f=i[l]]];let u=16843009*a^65537*c^257*f^16843008*l,w=257*i[s]^16843008*s;for(let n=0;4>n;n++)t[n][l]=w=w<<24^w>>>8,e[n][s]=u=u<<24^u>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}F(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.B[e],i=n.length/4-2,s=[0,0,0,0],o=this.L[e],f=o[0],c=o[1],a=o[2],l=o[3],u=o[4];let w,h,d,p=t[0]^n[0],y=t[e?3:1]^n[1],b=t[2]^n[2],m=t[e?1:3]^n[3],k=4;for(let t=0;i>t;t++)w=f[p>>>24]^c[y>>16&255]^a[b>>8&255]^l[255&m]^n[k],h=f[y>>>24]^c[b>>16&255]^a[m>>8&255]^l[255&p]^n[k+1],d=f[b>>>24]^c[m>>16&255]^a[p>>8&255]^l[255&y]^n[k+2],m=f[m>>>24]^c[p>>16&255]^a[y>>8&255]^l[255&b]^n[k+3],k+=4,p=w,y=h,b=d;for(let t=0;4>t;t++)s[e?3&-t:t]=u[p>>>24]<<24^u[y>>16&255]<<16^u[b>>8&255]<<8^u[255&m]^n[k++],w=p,p=y,y=b,b=m,m=w;return s}},U=class{constructor(t,e){this.O=t,this.q=e,this.G=e}reset(){this.G=this.q}update(t){return this.J(this.O,t,this.G)}N(t){if(255==(t>>24&255)){let e=t>>16&255,n=t>>8&255,r=255&t;255===e?(e=0,255===n?(n=0,255===r?r=0:++r):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=r}else t+=1<<24;return t}X(t){0===(t[0]=this.N(t[0]))&&(t[1]=this.N(t[1]))}J(t,e,n){let r;if(!(r=e.length))return[];const i=v.u(e);for(let i=0;r>i;i+=4){this.X(n);const r=t.encrypt(n);e[i]^=r[0],e[i+1]^=r[1],e[i+2]^=r[2],e[i+3]^=r[3]}return v.h(e,i)}},T=_.R;class j extends w{constructor(n,s,o){let f;super({start(){e.assign(this,{ready:new Promise((t=>this.Y=t)),password:n,signed:s,Z:o-1,pending:new i(0)})},async transform(e,n){if(e&&e.length){const s=this;if(s.password){const n=s.password;s.password=null;const i=F(e,0,V[s.Z]+2);await(async(t,e,n)=>{await L(t,n,F(e,0,V[t.Z]));const i=F(e,V[t.Z]),s=t.keys.passwordVerification;if(s[0]!=i[0]||s[1]!=i[1])throw new r("Invalid pasword")})(s,i,n),s.$=new U(new R(s.keys.key),t.from(B)),s.tt=new T(s.keys.et),e=F(e,V[s.Z]+2),s.Y()}else await s.ready;const o=new i(e.length-10-(e.length-10)%16);n.enqueue(K(s,e,o,0,10,!0))}},async flush(t){const e=this;await e.ready;const n=e.pending,r=F(n,0,n.length-10),s=F(n,n.length-10);let o=new i(0);if(r.length){const t=M.v(r);e.tt.update(t);const n=e.$.update(t);o=M.k(n)}if(f.valid=!0,e.signed){const t=F(M.k(e.tt.digest()),0,10);for(let e=0;10>e;e++)t[e]!=s[e]&&(f.valid=!1)}t.enqueue(o)}}),f=this}}class H extends w{constructor(n,r){let s;super({start(){e.assign(this,{ready:new Promise((t=>this.Y=t)),password:n,Z:r-1,pending:new i(0)})},async transform(e,n){if(e&&e.length){const r=this;let s=new i(0);if(r.password){const e=r.password;r.password=null,s=await(async(t,e)=>{const n=(r=new i(V[t.Z]),D&&"function"==typeof l.getRandomValues?l.getRandomValues(r):z.getRandomValues(r));var r;return await L(t,e,n),W(n,t.keys.passwordVerification)})(r,e),r.$=new U(new R(r.keys.key),t.from(B)),r.tt=new T(r.keys.et),r.Y()}else await r.ready;const o=new i(s.length+e.length-e.length%16);o.set(s,0),n.enqueue(K(r,e,o,s.length,0))}},async flush(t){const e=this;await e.ready;let n=new i(0);if(e.pending.length){const t=e.$.update(M.v(e.pending));e.tt.update(t),n=M.k(t)}s.signature=M.k(e.tt.digest()).slice(0,10),t.enqueue(W(n,s.signature))}}),s=this}}function K(t,e,n,r,s,o){const f=e.length-s;let c;for(t.pending.length&&(e=W(t.pending,e),n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new i(e)).set(n,0)}return t})(n,f-f%16)),c=0;f-16>=c;c+=16){const i=M.v(F(e,c,c+16));o&&t.tt.update(i);const s=t.$.update(i);o||t.tt.update(s),n.set(M.k(s),c+r)}return t.pending=F(e,c),n}async function L(t,n,r){const s=(t=>{if(void 0===a){const e=new i((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new a).encode(t)})(n),o=await((t,e,n,r,i)=>D&&E&&"function"==typeof l.subtle.importKey?l.subtle.importKey("raw",e,n,!1,i):_.importKey(e))(0,s,I,0,x),f=await(async(t,e,n)=>D&&E&&"function"==typeof l.subtle.deriveBits?await l.subtle.deriveBits(t,e,n):_.U(e,t.salt,A.iterations,n))(e.assign({salt:r},A),o,8*(2*P[t.Z]+2)),c=new i(f);t.keys={key:M.v(F(c,0,P[t.Z])),et:M.v(F(c,P[t.Z],2*P[t.Z])),passwordVerification:F(c,2*P[t.Z])}}function W(t,e){let n=t;return t.length+e.length&&(n=new i(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function F(t,e,n){return t.subarray(e,n)}class O extends w{constructor(t,n){let i;super({start(){e.assign(this,{password:t,passwordVerification:n}),N(this,t)},transform(t,e){if(t&&t.length){const n=this;if(n.password){const e=G(n,t.subarray(0,12));if(n.password=null,e[11]!=n.passwordVerification)throw new r("Invalid pasword");t=t.subarray(12)}e.enqueue(G(n,t))}},flush(){i.valid=!0}}),i=this}}class q extends w{constructor(t,n){super({start(){e.assign(this,{password:t,passwordVerification:n}),N(this,t)},transform(t,e){if(t&&t.length){const n=this;let r,s;if(n.password){n.password=null;const e=l.getRandomValues(new i(12));e[11]=n.passwordVerification,r=new i(t.length+e.length),r.set(J(n,e),0),s=12}else r=new i(t.length),s=0;r.set(J(n,t),s),e.enqueue(r)}},flush(){}})}}function G(t,e){const n=new i(e.length);for(let r=0;r<e.length;r++)n[r]=X(t)^e[r],Q(t,n[r]);return n}function J(t,e){const n=new i(e.length);for(let r=0;r<e.length;r++)n[r]=X(t)^e[r],Q(t,e[r]);return n}function N(t,e){t.keys=[305419896,591751049,878082192],t.nt=new m(t.keys[0]),t.rt=new m(t.keys[2]);for(let n=0;n<e.length;n++)Q(t,e.charCodeAt(n))}function Q(t,e){t.nt.append([e]),t.keys[0]=~t.nt.get(),t.keys[1]=Z(t.keys[1]+Y(t.keys[0])),t.keys[1]=Z(n.imul(t.keys[1],134775813)+1),t.rt.append([t.keys[1]>>>24]),t.keys[2]=~t.rt.get()}function X(t){const e=2|t.keys[2];return Y(n.imul(e,1^e)>>>8)}function Y(t){return 255&t}function Z(t){return 4294967295&t}class $ extends w{constructor(t,e){super({start(){this.it=new t(e)},transform(t,e){(t=this.it.append(t))&&e.enqueue(t)},flush(t){const e=this.it.flush();e&&t.enqueue(e)}})}}class tt{constructor(t,{signature:n,password:r,signed:i,compressed:s,zipCrypto:o,passwordVerification:f,encryptionStrength:c,st:a},{ot:l}){const u=this;function w(){u.stream=u.stream.pipeThrough(new $(t,{ot:l}))}u.start=async()=>{const t=!!r;if(e.assign(u,{signature:n,encrypted:t,signed:i,compressed:s,zipCrypto:o,stream:new h({async pull(t){const{value:e,done:n}=await u.pull();t.enqueue(e),(n||u.aborted)&&t.close()}})}),t&&(o?u.stream=u.stream.pipeThrough(new O(r,f)):(u.ft=new j(r,i,c),u.stream=u.stream.pipeThrough(u.ft))),s)if(void 0!==a&&!a||void 0===y)w();else try{u.stream=u.stream.pipeThrough(new y("deflate-raw"))}catch(t){w()}if((!t||o)&&i){const t=u.stream.tee();u.stream=t[0],u.ct=t[1].pipeThrough(new k)}u.lt=u.stream.getReader(),await u.read()},u.abort=()=>u.aborted=!0}async read(){const t=this,{value:e,done:n}=await t.lt.read();if(e&&e.length&&t.ut({value:{data:new i(e)}}),n){let e;if(t.encrypted&&!t.zipCrypto&&!t.ft.valid)throw new r("Invalid signature");if((!t.encrypted||t.zipCrypto)&&t.signed){e=await t.ct.getReader().read();const n=new c(e.value.buffer);if(t.signature!=n.getUint32(0,!1))throw new r("Invalid signature")}t.ut({value:{signature:e},done:n})}else await t.read()}}class et{constructor(t,{encrypted:n,signed:r,compressed:i,level:s,zipCrypto:o,password:f,passwordVerification:c,encryptionStrength:a,st:l},{ot:u}){const w=this;function d(){w.stream=w.stream.pipeThrough(new $(t,{ot:u,level:s}))}w.start=async()=>{if(e.assign(this,{encrypted:n,signed:r,compressed:i,zipCrypto:o,stream:new h({async pull(t){const{value:e,done:n}=await w.pull();t.enqueue(e),(n||w.aborted)&&t.close()}})}),(!n||o)&&r){const t=w.stream.tee();w.stream=t[0],w.ct=t[1].pipeThrough(new k({ot:u}))}if(i)if(void 0!==l&&!l||void 0===p)d();else try{w.stream=w.stream.pipeThrough(new p("deflate-raw"))}catch(t){d()}n&&(o?w.stream=w.stream.pipeThrough(new q(f,c)):(w.wt=new H(f,a),w.stream=w.stream.pipeThrough(w.wt))),w.lt=w.stream.getReader(),await w.read()},w.abort=()=>w.aborted=!0}async read(){const t=this,{value:e,done:n}=await t.lt.read();if(e&&e.length&&t.ut({value:{data:e}}),n){let e;t.encrypted&&!t.zipCrypto&&(e=t.wt.signature),t.encrypted&&!t.zipCrypto||!t.signed||(e=await t.ct.getReader().read(),e=new c(e.value.buffer).getUint32(0)),t.ut({value:{signature:e},done:n})}else await t.read()}}const nt=new Map;let rt,it=0;function st(t){if(t.data){const e=t.data.value.data;if(e&&e.length)try{t.data.value.data=e.buffer,u(t,[t.data.value.data])}catch(e){u(t)}else u(t)}else u(t)}addEventListener("message",(async t=>{const e=t.data,n=e.type;try{if("start"==n&&(async t=>{try{t.scripts&&t.scripts.length&&importScripts.apply(void 0,t.scripts);const e=t.options;let n;self.initCodec&&self.initCodec(),e.codecType.startsWith("deflate")?n=self.Deflate:e.codecType.startsWith("inflate")&&(n=self.Inflate),rt=((t,e,n)=>e.codecType.startsWith("deflate")?new et(t,e,n):e.codecType.startsWith("inflate")?new tt(t,e,n):void 0)(n,e,t.config),rt.ut=t=>st({type:"data",data:t}),rt.onerror=t=>u({error:{message:t.message,stack:t.stack}}),rt.pull=()=>{const t=new Promise(((t,e)=>nt.set(it,{resolve:t,reject:e})));return st({type:"pull",messageId:it}),it++,t},await rt.start()}catch(t){u({error:{message:t.message,stack:t.stack}})}})(e),"data"==n){const{resolve:t}=nt.get(e.messageId);nt.delete(e.messageId),t({value:new i(e.data),done:e.done})}"abort"==n&&rt.abort()}catch(t){u({error:{message:t.message,stack:t.stack}})}}));const ot=(()=>{const e=-2;function o(e){return f(e.map((([e,n])=>new t(e).fill(n,0,e))))}function f(e){return e.reduce(((e,n)=>e.concat(t.isArray(n)?f(n):n)),[])}const c=[0,1,2,3].concat(...o([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function a(){const t=this;function e(t,e){let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1}t.ht=r=>{const i=t.dt,s=t.bt.yt,o=t.bt.kt;let f,c,a,l=-1;for(r.vt=0,r.gt=573,f=0;o>f;f++)0!==i[2*f]?(r.St[++r.vt]=l=f,r.zt[f]=0):i[2*f+1]=0;for(;2>r.vt;)a=r.St[++r.vt]=2>l?++l:0,i[2*a]=1,r.zt[a]=0,r._t--,s&&(r.Ct-=s[2*a+1]);for(t.It=l,f=n.floor(r.vt/2);f>=1;f--)r.At(i,f);a=o;do{f=r.St[1],r.St[1]=r.St[r.vt--],r.At(i,1),c=r.St[1],r.St[--r.gt]=f,r.St[--r.gt]=c,i[2*a]=i[2*f]+i[2*c],r.zt[a]=n.max(r.zt[f],r.zt[c])+1,i[2*f+1]=i[2*c+1]=a,r.St[1]=a++,r.At(i,1)}while(r.vt>=2);r.St[--r.gt]=r.St[1],(e=>{const n=t.dt,r=t.bt.yt,i=t.bt.xt,s=t.bt.Vt,o=t.bt.Pt;let f,c,a,l,u,w,h=0;for(l=0;15>=l;l++)e.Bt[l]=0;for(n[2*e.St[e.gt]+1]=0,f=e.gt+1;573>f;f++)c=e.St[f],l=n[2*n[2*c+1]+1]+1,l>o&&(l=o,h++),n[2*c+1]=l,c>t.It||(e.Bt[l]++,u=0,s>c||(u=i[c-s]),w=n[2*c],e._t+=w*(l+u),r&&(e.Ct+=w*(r[2*c+1]+u)));if(0!==h){do{for(l=o-1;0===e.Bt[l];)l--;e.Bt[l]--,e.Bt[l+1]+=2,e.Bt[o]--,h-=2}while(h>0);for(l=o;0!==l;l--)for(c=e.Bt[l];0!==c;)a=e.St[--f],a>t.It||(n[2*a+1]!=l&&(e._t+=(l-n[2*a+1])*n[2*a],n[2*a+1]=l),c--)}})(r),((t,n,r)=>{const i=[];let s,o,f,c=0;for(s=1;15>=s;s++)i[s]=c=c+r[s-1]<<1;for(o=0;n>=o;o++)f=t[2*o+1],0!==f&&(t[2*o]=e(i[f]++,f))})(i,t.It,r.Bt)}}function l(t,e,n,r,i){const s=this;s.yt=t,s.xt=e,s.Vt=n,s.kt=r,s.Pt=i}a.Dt=[0,1,2,3,4,5,6,7].concat(...o([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]])),a.Et=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],a.Mt=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],a.Rt=t=>256>t?c[t]:c[256+(t>>>7)],a.Ut=[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],a.Tt=[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],a.jt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],a.Ht=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];const u=o([[144,8],[112,9],[24,7],[8,8]]);l.Kt=f([12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,19,275,147,403,83,339,211,467,51,307,179,435,115,371,243,499,11,267,139,395,75,331,203,459,43,299,171,427,107,363,235,491,27,283,155,411,91,347,219,475,59,315,187,443,123,379,251,507,7,263,135,391,71,327,199,455,39,295,167,423,103,359,231,487,23,279,151,407,87,343,215,471,55,311,183,439,119,375,247,503,15,271,143,399,79,335,207,463,47,303,175,431,111,367,239,495,31,287,159,415,95,351,223,479,63,319,191,447,127,383,255,511,0,64,32,96,16,80,48,112,8,72,40,104,24,88,56,120,4,68,36,100,20,84,52,116,3,131,67,195,35,163,99,227].map(((t,e)=>[t,u[e]])));const w=o([[30,5]]);function h(t,e,n,r,i){const s=this;s.Lt=t,s.Wt=e,s.Ft=n,s.Ot=r,s.qt=i}l.Gt=f([0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23].map(((t,e)=>[t,w[e]]))),l.Jt=new l(l.Kt,a.Ut,257,286,15),l.Nt=new l(l.Gt,a.Tt,0,30,15),l.Qt=new l(null,a.jt,0,19,7);const d=[new h(0,0,0,0,0),new h(4,4,8,4,1),new h(4,5,16,8,1),new h(4,6,32,32,1),new h(4,4,16,16,2),new h(8,16,32,32,2),new h(8,16,128,128,2),new h(8,32,128,256,2),new h(32,128,258,1024,2),new h(32,258,258,4096,2)],p=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],y=113,b=666,m=262;function k(t,e,n,r){const i=t[2*e],s=t[2*n];return s>i||i==s&&r[e]<=r[n]}function v(){const t=this;let r,o,f,c,u,w,h,v,g,S,z,_,C,I,A,x,V,P,B,D,E,M,R,U,T,j,H,K,L,W,F,O,q;const G=new a,J=new a,N=new a;let Q,X,Y,Z,$,tt;function et(){let e;for(e=0;286>e;e++)F[2*e]=0;for(e=0;30>e;e++)O[2*e]=0;for(e=0;19>e;e++)q[2*e]=0;F[512]=1,t._t=t.Ct=0,X=Y=0}function nt(t,e){let n,r=-1,i=t[1],s=0,o=7,f=4;0===i&&(o=138,f=3),t[2*(e+1)+1]=65535;for(let c=0;e>=c;c++)n=i,i=t[2*(c+1)+1],++s<o&&n==i||(f>s?q[2*n]+=s:0!==n?(n!=r&&q[2*n]++,q[32]++):s>10?q[36]++:q[34]++,s=0,r=n,0===i?(o=138,f=3):n==i?(o=6,f=3):(o=7,f=4))}function rt(e){t.Xt[t.pending++]=e}function it(t){rt(255&t),rt(t>>>8&255)}function st(t,e){let n;const r=e;tt>16-r?(n=t,$|=n<<tt&65535,it($),$=n>>>16-tt,tt+=r-16):($|=t<<tt&65535,tt+=r)}function ot(t,e){const n=2*t;st(65535&e[n],65535&e[n+1])}function ft(t,e){let n,r,i=-1,s=t[1],o=0,f=7,c=4;for(0===s&&(f=138,c=3),n=0;e>=n;n++)if(r=s,s=t[2*(n+1)+1],++o>=f||r!=s){if(c>o)do{ot(r,q)}while(0!=--o);else 0!==r?(r!=i&&(ot(r,q),o--),ot(16,q),st(o-3,2)):o>10?(ot(18,q),st(o-11,7)):(ot(17,q),st(o-3,3));o=0,i=r,0===s?(f=138,c=3):r==s?(f=6,c=3):(f=7,c=4)}}function ct(){16==tt?(it($),$=0,tt=0):8>tt||(rt(255&$),$>>>=8,tt-=8)}function at(e,r){let i,s,o;if(t.Yt[X]=e,t.Zt[X]=255&r,X++,0===e?F[2*r]++:(Y++,e--,F[2*(a.Dt[r]+256+1)]++,O[2*a.Rt(e)]++),0==(8191&X)&&H>2){for(i=8*X,s=E-V,o=0;30>o;o++)i+=O[2*o]*(5+a.Tt[o]);if(i>>>=3,Y<n.floor(X/2)&&i<n.floor(s/2))return!0}return X==Q-1}function lt(e,n){let r,i,s,o,f=0;if(0!==X)do{r=t.Yt[f],i=t.Zt[f],f++,0===r?ot(i,e):(s=a.Dt[i],ot(s+256+1,e),o=a.Ut[s],0!==o&&(i-=a.Et[s],st(i,o)),r--,s=a.Rt(r),ot(s,n),o=a.Tt[s],0!==o&&(r-=a.Mt[s],st(r,o)))}while(X>f);ot(256,e),Z=e[513]}function ut(){tt>8?it($):tt>0&&rt(255&$),$=0,tt=0}function wt(e,n,r){st(0+(r?1:0),3),((e,n)=>{ut(),Z=8,it(n),it(~n),t.Xt.set(v.subarray(e,e+n),t.pending),t.pending+=n})(e,n)}function ht(e){((e,n,r)=>{let i,s,o=0;H>0?(G.ht(t),J.ht(t),o=(()=>{let e;for(nt(F,G.It),nt(O,J.It),N.ht(t),e=18;e>=3&&0===q[2*a.Ht[e]+1];e--);return t._t+=14+3*(e+1),e})(),i=t._t+3+7>>>3,s=t.Ct+3+7>>>3,s>i||(i=s)):i=s=n+5,n+4>i||-1==e?s==i?(st(2+(r?1:0),3),lt(l.Kt,l.Gt)):(st(4+(r?1:0),3),((t,e,n)=>{let r;for(st(t-257,5),st(e-1,5),st(n-4,4),r=0;n>r;r++)st(q[2*a.Ht[r]+1],3);ft(F,t-1),ft(O,e-1)})(G.It+1,J.It+1,o+1),lt(F,O)):wt(e,n,r),et(),r&&ut()})(0>V?-1:V,E-V,e),V=E,r.$t()}function dt(){let t,e,n,i;do{if(i=g-R-E,0===i&&0===E&&0===R)i=u;else if(-1==i)i--;else if(E>=u+u-m){v.set(v.subarray(u,u+u),0),M-=u,E-=u,V-=u,t=C,n=t;do{e=65535&z[--n],z[n]=u>e?0:e-u}while(0!=--t);t=u,n=t;do{e=65535&S[--n],S[n]=u>e?0:e-u}while(0!=--t);i+=u}if(0===r.te)return;t=r.ee(v,E+R,i),R+=t,3>R||(_=255&v[E],_=(_<<x^255&v[E+1])&A)}while(m>R&&0!==r.te)}function pt(t){let e,n,r=T,i=E,s=U;const o=E>u-m?E-(u-m):0;let f=W;const c=h,a=E+258;let l=v[i+s-1],w=v[i+s];L>U||(r>>=2),f>R&&(f=R);do{if(e=t,v[e+s]==w&&v[e+s-1]==l&&v[e]==v[i]&&v[++e]==v[i+1]){i+=2,e++;do{}while(v[++i]==v[++e]&&v[++i]==v[++e]&&v[++i]==v[++e]&&v[++i]==v[++e]&&v[++i]==v[++e]&&v[++i]==v[++e]&&v[++i]==v[++e]&&v[++i]==v[++e]&&a>i);if(n=258-(a-i),i=a-258,n>s){if(M=t,s=n,n>=f)break;l=v[i+s-1],w=v[i+s]}}}while((t=65535&S[t&c])>o&&0!=--r);return s>R?R:s}t.zt=[],t.Bt=[],t.St=[],F=[],O=[],q=[],t.At=(e,n)=>{const r=t.St,i=r[n];let s=n<<1;for(;s<=t.vt&&(s<t.vt&&k(e,r[s+1],r[s],t.zt)&&s++,!k(e,i,r[s],t.zt));)r[n]=r[s],n=s,s<<=1;r[n]=i},t.ne=(r,a,p,b,m,k)=>(b||(b=8),m||(m=8),k||(k=0),r.re=null,-1==a&&(a=6),1>m||m>9||8!=b||9>p||p>15||0>a||a>9||0>k||k>2?e:(r.ie=t,w=p,u=1<<w,h=u-1,I=m+7,C=1<<I,A=C-1,x=n.floor((I+3-1)/3),v=new i(2*u),S=[],z=[],Q=1<<m+6,t.Xt=new i(4*Q),f=4*Q,t.Yt=new s(Q),t.Zt=new i(Q),H=a,K=k,(e=>(e.se=e.oe=0,e.re=null,t.pending=0,t.fe=0,o=y,c=0,G.dt=F,G.bt=l.Jt,J.dt=O,J.bt=l.Nt,N.dt=q,N.bt=l.Qt,$=0,tt=0,Z=8,et(),(()=>{g=2*u,z[C-1]=0;for(let t=0;C-1>t;t++)z[t]=0;j=d[H].Wt,L=d[H].Lt,W=d[H].Ft,T=d[H].Ot,E=0,V=0,R=0,P=U=2,D=0,_=0})(),0))(r))),t.ce=()=>42!=o&&o!=y&&o!=b?e:(t.Zt=null,t.Yt=null,t.Xt=null,z=null,S=null,v=null,t.ie=null,o==y?-3:0),t.ae=(t,n,r)=>{let i=0;return-1==n&&(n=6),0>n||n>9||0>r||r>2?e:(d[H].qt!=d[n].qt&&0!==t.se&&(i=t.le(1)),H!=n&&(H=n,j=d[H].Wt,L=d[H].Lt,W=d[H].Ft,T=d[H].Ot),K=r,i)},t.ue=(t,n,r)=>{let i,s=r,f=0;if(!n||42!=o)return e;if(3>s)return 0;for(s>u-m&&(s=u-m,f=r-s),v.set(n.subarray(f,f+s),0),E=s,V=s,_=255&v[0],_=(_<<x^255&v[1])&A,i=0;s-3>=i;i++)_=(_<<x^255&v[i+2])&A,S[i&h]=z[_],z[_]=i;return 0},t.le=(n,i)=>{let s,a,k,g,I;if(i>4||0>i)return e;if(!n.we||!n.he&&0!==n.te||o==b&&4!=i)return n.re=p[4],e;if(0===n.de)return n.re=p[7],-5;var T;if(r=n,g=c,c=i,42==o&&(a=8+(w-8<<4)<<8,k=(H-1&255)>>1,k>3&&(k=3),a|=k<<6,0!==E&&(a|=32),a+=31-a%31,o=y,rt((T=a)>>8&255),rt(255&T)),0!==t.pending){if(r.$t(),0===r.de)return c=-1,0}else if(0===r.te&&g>=i&&4!=i)return r.re=p[7],-5;if(o==b&&0!==r.te)return n.re=p[7],-5;if(0!==r.te||0!==R||0!=i&&o!=b){switch(I=-1,d[H].qt){case 0:I=(t=>{let e,n=65535;for(n>f-5&&(n=f-5);;){if(1>=R){if(dt(),0===R&&0==t)return 0;if(0===R)break}if(E+=R,R=0,e=V+n,(0===E||E>=e)&&(R=E-e,E=e,ht(!1),0===r.de))return 0;if(E-V>=u-m&&(ht(!1),0===r.de))return 0}return ht(4==t),0===r.de?4==t?2:0:4==t?3:1})(i);break;case 1:I=(t=>{let e,n=0;for(;;){if(m>R){if(dt(),m>R&&0==t)return 0;if(0===R)break}if(3>R||(_=(_<<x^255&v[E+2])&A,n=65535&z[_],S[E&h]=z[_],z[_]=E),0===n||(E-n&65535)>u-m||2!=K&&(P=pt(n)),3>P)e=at(0,255&v[E]),R--,E++;else if(e=at(E-M,P-3),R-=P,P>j||3>R)E+=P,P=0,_=255&v[E],_=(_<<x^255&v[E+1])&A;else{P--;do{E++,_=(_<<x^255&v[E+2])&A,n=65535&z[_],S[E&h]=z[_],z[_]=E}while(0!=--P);E++}if(e&&(ht(!1),0===r.de))return 0}return ht(4==t),0===r.de?4==t?2:0:4==t?3:1})(i);break;case 2:I=(t=>{let e,n,i=0;for(;;){if(m>R){if(dt(),m>R&&0==t)return 0;if(0===R)break}if(3>R||(_=(_<<x^255&v[E+2])&A,i=65535&z[_],S[E&h]=z[_],z[_]=E),U=P,B=M,P=2,0!==i&&j>U&&u-m>=(E-i&65535)&&(2!=K&&(P=pt(i)),5>=P&&(1==K||3==P&&E-M>4096)&&(P=2)),3>U||P>U)if(0!==D){if(e=at(0,255&v[E-1]),e&&ht(!1),E++,R--,0===r.de)return 0}else D=1,E++,R--;else{n=E+R-3,e=at(E-1-B,U-3),R-=U-1,U-=2;do{++E>n||(_=(_<<x^255&v[E+2])&A,i=65535&z[_],S[E&h]=z[_],z[_]=E)}while(0!=--U);if(D=0,P=2,E++,e&&(ht(!1),0===r.de))return 0}}return 0!==D&&(e=at(0,255&v[E-1]),D=0),ht(4==t),0===r.de?4==t?2:0:4==t?3:1})(i)}if(2!=I&&3!=I||(o=b),0==I||2==I)return 0===r.de&&(c=-1),0;if(1==I){if(1==i)st(2,3),ot(256,l.Kt),ct(),9>1+Z+10-tt&&(st(2,3),ot(256,l.Kt),ct()),Z=7;else if(wt(0,0,!1),3==i)for(s=0;C>s;s++)z[s]=0;if(r.$t(),0===r.de)return c=-1,0}}return 4!=i?0:1}}function g(){const t=this;t.pe=0,t.ye=0,t.te=0,t.se=0,t.de=0,t.oe=0}return g.prototype={ne:function(t,e){const n=this;return n.ie=new v,e||(e=15),n.ie.ne(n,t,e)},le:function(t){const n=this;return n.ie?n.ie.le(n,t):e},ce:function(){const t=this;if(!t.ie)return e;const n=t.ie.ce();return t.ie=null,n},ae:function(t,n){const r=this;return r.ie?r.ie.ae(r,t,n):e},ue:function(t,n){const r=this;return r.ie?r.ie.ue(r,t,n):e},ee:function(t,e,n){const r=this;let i=r.te;return i>n&&(i=n),0===i?0:(r.te-=i,t.set(r.he.subarray(r.pe,r.pe+i),e),r.pe+=i,r.se+=i,i)},$t:function(){const t=this;let e=t.ie.pending;e>t.de&&(e=t.de),0!==e&&(t.we.set(t.ie.Xt.subarray(t.ie.fe,t.ie.fe+e),t.ye),t.ye+=e,t.ie.fe+=e,t.oe+=e,t.de-=e,t.ie.pending-=e,0===t.ie.pending&&(t.ie.fe=0))}},function(t){const e=new g,s=(o=t&&t.ot?t.ot:65536)+5*(n.floor(o/16383)+1);var o;const f=new i(s);let c=t?t.level:-1;void 0===c&&(c=-1),e.ne(c),e.we=f,this.append=(t,n)=>{let o,c,a=0,l=0,u=0;const w=[];if(t.length){e.pe=0,e.he=t,e.te=t.length;do{if(e.ye=0,e.de=s,o=e.le(0),0!=o)throw new r("deflating: "+e.re);e.ye&&(e.ye==s?w.push(new i(f)):w.push(f.slice(0,e.ye))),u+=e.ye,n&&e.pe>0&&e.pe!=a&&(n(e.pe),a=e.pe)}while(e.te>0||0===e.de);return w.length>1?(c=new i(u),w.forEach((t=>{c.set(t,l),l+=t.length}))):c=w[0]||new i(0),c}},this.flush=()=>{let t,n,o=0,c=0;const a=[];do{if(e.ye=0,e.de=s,t=e.le(4),1!=t&&0!=t)throw new r("deflating: "+e.re);s-e.de>0&&a.push(f.slice(0,e.ye)),c+=e.ye}while(e.te>0||0===e.de);return e.ce(),n=new i(c),a.forEach((t=>{n.set(t,o),o+=t.length})),n}}})(),ft=(()=>{const t=-2,e=-3,s=-5,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],c=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],a=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],l=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],u=[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,112,112],w=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],h=[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];function d(){let t,n,r,i,o,c;function a(t,n,f,a,l,u,w,h,d,p,y){let b,m,k,v,g,S,z,_,C,I,A,x,V,P,B;I=0,g=f;do{r[t[n+I]]++,I++,g--}while(0!==g);if(r[0]==f)return w[0]=-1,h[0]=0,0;for(_=h[0],S=1;15>=S&&0===r[S];S++);for(z=S,S>_&&(_=S),g=15;0!==g&&0===r[g];g--);for(k=g,_>g&&(_=g),h[0]=_,P=1<<S;g>S;S++,P<<=1)if(0>(P-=r[S]))return e;if(0>(P-=r[g]))return e;for(r[g]+=P,c[1]=S=0,I=1,V=2;0!=--g;)c[V]=S+=r[I],V++,I++;g=0,I=0;do{0!==(S=t[n+I])&&(y[c[S]++]=g),I++}while(++g<f);for(f=c[k],c[0]=g=0,I=0,v=-1,x=-_,o[0]=0,A=0,B=0;k>=z;z++)for(b=r[z];0!=b--;){for(;z>x+_;){if(v++,x+=_,B=k-x,B=B>_?_:B,(m=1<<(S=z-x))>b+1&&(m-=b+1,V=z,B>S))for(;++S<B&&(m<<=1)>r[++V];)m-=r[V];if(B=1<<S,p[0]+B>1440)return e;o[v]=A=p[0],p[0]+=B,0!==v?(c[v]=g,i[0]=S,i[1]=_,S=g>>>x-_,i[2]=A-o[v-1]-S,d.set(i,3*(o[v-1]+S))):w[0]=A}for(i[1]=z-x,f>I?y[I]<a?(i[0]=256>y[I]?0:96,i[2]=y[I++]):(i[0]=u[y[I]-a]+16+64,i[2]=l[y[I++]-a]):i[0]=192,m=1<<z-x,S=g>>>x;B>S;S+=m)d.set(i,3*(A+S));for(S=1<<z-1;0!=(g&S);S>>>=1)g^=S;for(g^=S,C=(1<<x)-1;(g&C)!=c[v];)v--,x-=_,C=(1<<x)-1}return 0!==P&&1!=k?s:0}function d(e){let s;for(t||(t=[],n=[],r=new f(16),i=[],o=new f(15),c=new f(16)),n.length<e&&(n=[]),s=0;e>s;s++)n[s]=0;for(s=0;16>s;s++)r[s]=0;for(s=0;3>s;s++)i[s]=0;o.set(r.subarray(0,15),0),c.set(r.subarray(0,16),0)}this.be=(r,i,o,f,c)=>{let l;return d(19),t[0]=0,l=a(r,0,19,19,null,null,o,i,f,t,n),l==e?c.re="oversubscribed dynamic bit lengths tree":l!=s&&0!==i[0]||(c.re="incomplete dynamic bit lengths tree",l=e),l},this.me=(r,i,o,f,c,p,y,b,m)=>{let k;return d(288),t[0]=0,k=a(o,0,r,257,l,u,p,f,b,t,n),0!=k||0===f[0]?(k==e?m.re="oversubscribed literal/length tree":-4!=k&&(m.re="incomplete literal/length tree",k=e),k):(d(288),k=a(o,r,i,0,w,h,y,c,b,t,n),0!=k||0===c[0]&&r>257?(k==e?m.re="oversubscribed distance tree":k==s?(m.re="incomplete distance tree",k=e):-4!=k&&(m.re="empty distance tree with lengths",k=e),k):0)}}function p(){const n=this;let r,i,s,f,c=0,a=0,l=0,u=0,w=0,h=0,d=0,p=0,y=0,b=0;function m(t,n,r,i,s,f,c,a){let l,u,w,h,d,p,y,b,m,k,v,g,S,z,_,C;y=a.pe,b=a.te,d=c.ke,p=c.ve,m=c.write,k=m<c.read?c.read-m-1:c.end-m,v=o[t],g=o[n];do{for(;20>p;)b--,d|=(255&a.ge(y++))<<p,p+=8;if(l=d&v,u=r,w=i,C=3*(w+l),0!==(h=u[C]))for(;;){if(d>>=u[C+1],p-=u[C+1],0!=(16&h)){for(h&=15,S=u[C+2]+(d&o[h]),d>>=h,p-=h;15>p;)b--,d|=(255&a.ge(y++))<<p,p+=8;for(l=d&g,u=s,w=f,C=3*(w+l),h=u[C];;){if(d>>=u[C+1],p-=u[C+1],0!=(16&h)){for(h&=15;h>p;)b--,d|=(255&a.ge(y++))<<p,p+=8;if(z=u[C+2]+(d&o[h]),d>>=h,p-=h,k-=S,z>m){_=m-z;do{_+=c.end}while(0>_);if(h=c.end-_,S>h){if(S-=h,m-_>0&&h>m-_)do{c.Se[m++]=c.Se[_++]}while(0!=--h);else c.Se.set(c.Se.subarray(_,_+h),m),m+=h,_+=h,h=0;_=0}}else _=m-z,m-_>0&&2>m-_?(c.Se[m++]=c.Se[_++],c.Se[m++]=c.Se[_++],S-=2):(c.Se.set(c.Se.subarray(_,_+2),m),m+=2,_+=2,S-=2);if(m-_>0&&S>m-_)do{c.Se[m++]=c.Se[_++]}while(0!=--S);else c.Se.set(c.Se.subarray(_,_+S),m),m+=S,_+=S,S=0;break}if(0!=(64&h))return a.re="invalid distance code",S=a.te-b,S=S>p>>3?p>>3:S,b+=S,y-=S,p-=S<<3,c.ke=d,c.ve=p,a.te=b,a.se+=y-a.pe,a.pe=y,c.write=m,e;l+=u[C+2],l+=d&o[h],C=3*(w+l),h=u[C]}break}if(0!=(64&h))return 0!=(32&h)?(S=a.te-b,S=S>p>>3?p>>3:S,b+=S,y-=S,p-=S<<3,c.ke=d,c.ve=p,a.te=b,a.se+=y-a.pe,a.pe=y,c.write=m,1):(a.re="invalid literal/length code",S=a.te-b,S=S>p>>3?p>>3:S,b+=S,y-=S,p-=S<<3,c.ke=d,c.ve=p,a.te=b,a.se+=y-a.pe,a.pe=y,c.write=m,e);if(l+=u[C+2],l+=d&o[h],C=3*(w+l),0===(h=u[C])){d>>=u[C+1],p-=u[C+1],c.Se[m++]=u[C+2],k--;break}}else d>>=u[C+1],p-=u[C+1],c.Se[m++]=u[C+2],k--}while(k>=258&&b>=10);return S=a.te-b,S=S>p>>3?p>>3:S,b+=S,y-=S,p-=S<<3,c.ke=d,c.ve=p,a.te=b,a.se+=y-a.pe,a.pe=y,c.write=m,0}n.init=(t,e,n,o,c,a)=>{r=0,d=t,p=e,s=n,y=o,f=c,b=a,i=null},n.ze=(n,k,v)=>{let g,S,z,_,C,I,A,x=0,V=0,P=0;for(P=k.pe,_=k.te,x=n.ke,V=n.ve,C=n.write,I=C<n.read?n.read-C-1:n.end-C;;)switch(r){case 0:if(I>=258&&_>=10&&(n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,v=m(d,p,s,y,f,b,n,k),P=k.pe,_=k.te,x=n.ke,V=n.ve,C=n.write,I=C<n.read?n.read-C-1:n.end-C,0!=v)){r=1==v?7:9;break}l=d,i=s,a=y,r=1;case 1:for(g=l;g>V;){if(0===_)return n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);v=0,_--,x|=(255&k.ge(P++))<<V,V+=8}if(S=3*(a+(x&o[g])),x>>>=i[S+1],V-=i[S+1],z=i[S],0===z){u=i[S+2],r=6;break}if(0!=(16&z)){w=15&z,c=i[S+2],r=2;break}if(0==(64&z)){l=z,a=S/3+i[S+2];break}if(0!=(32&z)){r=7;break}return r=9,k.re="invalid literal/length code",v=e,n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);case 2:for(g=w;g>V;){if(0===_)return n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);v=0,_--,x|=(255&k.ge(P++))<<V,V+=8}c+=x&o[g],x>>=g,V-=g,l=p,i=f,a=b,r=3;case 3:for(g=l;g>V;){if(0===_)return n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);v=0,_--,x|=(255&k.ge(P++))<<V,V+=8}if(S=3*(a+(x&o[g])),x>>=i[S+1],V-=i[S+1],z=i[S],0!=(16&z)){w=15&z,h=i[S+2],r=4;break}if(0==(64&z)){l=z,a=S/3+i[S+2];break}return r=9,k.re="invalid distance code",v=e,n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);case 4:for(g=w;g>V;){if(0===_)return n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);v=0,_--,x|=(255&k.ge(P++))<<V,V+=8}h+=x&o[g],x>>=g,V-=g,r=5;case 5:for(A=C-h;0>A;)A+=n.end;for(;0!==c;){if(0===I&&(C==n.end&&0!==n.read&&(C=0,I=C<n.read?n.read-C-1:n.end-C),0===I&&(n.write=C,v=n._e(k,v),C=n.write,I=C<n.read?n.read-C-1:n.end-C,C==n.end&&0!==n.read&&(C=0,I=C<n.read?n.read-C-1:n.end-C),0===I)))return n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);n.Se[C++]=n.Se[A++],I--,A==n.end&&(A=0),c--}r=0;break;case 6:if(0===I&&(C==n.end&&0!==n.read&&(C=0,I=C<n.read?n.read-C-1:n.end-C),0===I&&(n.write=C,v=n._e(k,v),C=n.write,I=C<n.read?n.read-C-1:n.end-C,C==n.end&&0!==n.read&&(C=0,I=C<n.read?n.read-C-1:n.end-C),0===I)))return n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);v=0,n.Se[C++]=u,I--,r=0;break;case 7:if(V>7&&(V-=8,_++,P--),n.write=C,v=n._e(k,v),C=n.write,I=C<n.read?n.read-C-1:n.end-C,n.read!=n.write)return n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);r=8;case 8:return v=1,n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);case 9:return v=e,n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v);default:return v=t,n.ke=x,n.ve=V,k.te=_,k.se+=P-k.pe,k.pe=P,n.write=C,n._e(k,v)}},n.Ce=()=>{}}d.Ie=(t,e,n,r)=>(t[0]=9,e[0]=5,n[0]=c,r[0]=a,0);const y=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function b(n,r){const c=this;let a,l=0,u=0,w=0,h=0;const b=[0],m=[0],k=new p;let v=0,g=new f(4320);const S=new d;c.ve=0,c.ke=0,c.Se=new i(r),c.end=r,c.read=0,c.write=0,c.reset=(t,e)=>{e&&(e[0]=0),6==l&&k.Ce(t),l=0,c.ve=0,c.ke=0,c.read=c.write=0},c.reset(n,null),c._e=(t,e)=>{let n,r,i;return r=t.ye,i=c.read,n=(i>c.write?c.end:c.write)-i,n>t.de&&(n=t.de),0!==n&&e==s&&(e=0),t.de-=n,t.oe+=n,t.we.set(c.Se.subarray(i,i+n),r),r+=n,i+=n,i==c.end&&(i=0,c.write==c.end&&(c.write=0),n=c.write-i,n>t.de&&(n=t.de),0!==n&&e==s&&(e=0),t.de-=n,t.oe+=n,t.we.set(c.Se.subarray(i,i+n),r),r+=n,i+=n),t.ye=r,c.read=i,e},c.ze=(n,r)=>{let i,s,f,p,z,_,C,I;for(p=n.pe,z=n.te,s=c.ke,f=c.ve,_=c.write,C=_<c.read?c.read-_-1:c.end-_;;){let A,x,V,P,B,D,E,M;switch(l){case 0:for(;3>f;){if(0===z)return c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);r=0,z--,s|=(255&n.ge(p++))<<f,f+=8}switch(i=7&s,v=1&i,i>>>1){case 0:s>>>=3,f-=3,i=7&f,s>>>=i,f-=i,l=1;break;case 1:A=[],x=[],V=[[]],P=[[]],d.Ie(A,x,V,P),k.init(A[0],x[0],V[0],0,P[0],0),s>>>=3,f-=3,l=6;break;case 2:s>>>=3,f-=3,l=3;break;case 3:return s>>>=3,f-=3,l=9,n.re="invalid block type",r=e,c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r)}break;case 1:for(;32>f;){if(0===z)return c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);r=0,z--,s|=(255&n.ge(p++))<<f,f+=8}if((~s>>>16&65535)!=(65535&s))return l=9,n.re="invalid stored block lengths",r=e,c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);u=65535&s,s=f=0,l=0!==u?2:0!==v?7:0;break;case 2:if(0===z)return c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);if(0===C&&(_==c.end&&0!==c.read&&(_=0,C=_<c.read?c.read-_-1:c.end-_),0===C&&(c.write=_,r=c._e(n,r),_=c.write,C=_<c.read?c.read-_-1:c.end-_,_==c.end&&0!==c.read&&(_=0,C=_<c.read?c.read-_-1:c.end-_),0===C)))return c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);if(r=0,i=u,i>z&&(i=z),i>C&&(i=C),c.Se.set(n.ee(p,i),_),p+=i,z-=i,_+=i,C-=i,0!=(u-=i))break;l=0!==v?7:0;break;case 3:for(;14>f;){if(0===z)return c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);r=0,z--,s|=(255&n.ge(p++))<<f,f+=8}if(w=i=16383&s,(31&i)>29||(i>>5&31)>29)return l=9,n.re="too many length or distance symbols",r=e,c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);if(i=258+(31&i)+(i>>5&31),!a||a.length<i)a=[];else for(I=0;i>I;I++)a[I]=0;s>>>=14,f-=14,h=0,l=4;case 4:for(;4+(w>>>10)>h;){for(;3>f;){if(0===z)return c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);r=0,z--,s|=(255&n.ge(p++))<<f,f+=8}a[y[h++]]=7&s,s>>>=3,f-=3}for(;19>h;)a[y[h++]]=0;if(b[0]=7,i=S.be(a,b,m,g,n),0!=i)return(r=i)==e&&(a=null,l=9),c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);h=0,l=5;case 5:for(;i=w,258+(31&i)+(i>>5&31)>h;){let t,u;for(i=b[0];i>f;){if(0===z)return c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);r=0,z--,s|=(255&n.ge(p++))<<f,f+=8}if(i=g[3*(m[0]+(s&o[i]))+1],u=g[3*(m[0]+(s&o[i]))+2],16>u)s>>>=i,f-=i,a[h++]=u;else{for(I=18==u?7:u-14,t=18==u?11:3;i+I>f;){if(0===z)return c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);r=0,z--,s|=(255&n.ge(p++))<<f,f+=8}if(s>>>=i,f-=i,t+=s&o[I],s>>>=I,f-=I,I=h,i=w,I+t>258+(31&i)+(i>>5&31)||16==u&&1>I)return a=null,l=9,n.re="invalid bit length repeat",r=e,c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);u=16==u?a[I-1]:0;do{a[I++]=u}while(0!=--t);h=I}}if(m[0]=-1,B=[],D=[],E=[],M=[],B[0]=9,D[0]=6,i=w,i=S.me(257+(31&i),1+(i>>5&31),a,B,D,E,M,g,n),0!=i)return i==e&&(a=null,l=9),r=i,c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);k.init(B[0],D[0],g,E[0],g,M[0]),l=6;case 6:if(c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,1!=(r=k.ze(c,n,r)))return c._e(n,r);if(r=0,k.Ce(n),p=n.pe,z=n.te,s=c.ke,f=c.ve,_=c.write,C=_<c.read?c.read-_-1:c.end-_,0===v){l=0;break}l=7;case 7:if(c.write=_,r=c._e(n,r),_=c.write,C=_<c.read?c.read-_-1:c.end-_,c.read!=c.write)return c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);l=8;case 8:return r=1,c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);case 9:return r=e,c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r);default:return r=t,c.ke=s,c.ve=f,n.te=z,n.se+=p-n.pe,n.pe=p,c.write=_,c._e(n,r)}}},c.Ce=t=>{c.reset(t,null),c.Se=null,g=null},c.Ae=(t,e,n)=>{c.Se.set(t.subarray(e,e+n),0),c.read=c.write=n},c.xe=()=>1==l?1:0}const m=13,k=[0,0,255,255];function v(){const n=this;function r(e){return e&&e.Ve?(e.se=e.oe=0,e.re=null,e.Ve.mode=7,e.Ve.Pe.reset(e,null),0):t}n.mode=0,n.method=0,n.Be=[0],n.De=0,n.marker=0,n.Ee=0,n.Me=t=>(n.Pe&&n.Pe.Ce(t),n.Pe=null,0),n.Re=(e,i)=>(e.re=null,n.Pe=null,8>i||i>15?(n.Me(e),t):(n.Ee=i,e.Ve.Pe=new b(e,1<<i),r(e),0)),n.Ue=(n,r)=>{let i,o;if(!n||!n.Ve||!n.he)return t;const f=n.Ve;for(r=4==r?s:0,i=s;;)switch(f.mode){case 0:if(0===n.te)return i;if(i=r,n.te--,n.se++,8!=(15&(f.method=n.ge(n.pe++)))){f.mode=m,n.re="unknown compression method",f.marker=5;break}if(8+(f.method>>4)>f.Ee){f.mode=m,n.re="invalid win size",f.marker=5;break}f.mode=1;case 1:if(0===n.te)return i;if(i=r,n.te--,n.se++,o=255&n.ge(n.pe++),((f.method<<8)+o)%31!=0){f.mode=m,n.re="incorrect header check",f.marker=5;break}if(0==(32&o)){f.mode=7;break}f.mode=2;case 2:if(0===n.te)return i;i=r,n.te--,n.se++,f.De=(255&n.ge(n.pe++))<<24&4278190080,f.mode=3;case 3:if(0===n.te)return i;i=r,n.te--,n.se++,f.De+=(255&n.ge(n.pe++))<<16&16711680,f.mode=4;case 4:if(0===n.te)return i;i=r,n.te--,n.se++,f.De+=(255&n.ge(n.pe++))<<8&65280,f.mode=5;case 5:return 0===n.te?i:(i=r,n.te--,n.se++,f.De+=255&n.ge(n.pe++),f.mode=6,2);case 6:return f.mode=m,n.re="need dictionary",f.marker=0,t;case 7:if(i=f.Pe.ze(n,i),i==e){f.mode=m,f.marker=0;break}if(0==i&&(i=r),1!=i)return i;i=r,f.Pe.reset(n,f.Be),f.mode=12;case 12:return n.te=0,1;case m:return e;default:return t}},n.Te=(e,n,r)=>{let i=0,s=r;if(!e||!e.Ve||6!=e.Ve.mode)return t;const o=e.Ve;return s<1<<o.Ee||(s=(1<<o.Ee)-1,i=r-s),o.Pe.Ae(n,i,s),o.mode=7,0},n.je=n=>{let i,o,f,c,a;if(!n||!n.Ve)return t;const l=n.Ve;if(l.mode!=m&&(l.mode=m,l.marker=0),0===(i=n.te))return s;for(o=n.pe,f=l.marker;0!==i&&4>f;)n.ge(o)==k[f]?f++:f=0!==n.ge(o)?0:4-f,o++,i--;return n.se+=o-n.pe,n.pe=o,n.te=i,l.marker=f,4!=f?e:(c=n.se,a=n.oe,r(n),n.se=c,n.oe=a,l.mode=7,0)},n.He=e=>e&&e.Ve&&e.Ve.Pe?e.Ve.Pe.xe():t}function g(){}return g.prototype={Re:function(t){const e=this;return e.Ve=new v,t||(t=15),e.Ve.Re(e,t)},Ue:function(e){const n=this;return n.Ve?n.Ve.Ue(n,e):t},Me:function(){const e=this;if(!e.Ve)return t;const n=e.Ve.Me(e);return e.Ve=null,n},je:function(){const e=this;return e.Ve?e.Ve.je(e):t},Te:function(e,n){const r=this;return r.Ve?r.Ve.Te(r,e,n):t},ge:function(t){return this.he[t]},ee:function(t,e){return this.he.subarray(t,t+e)}},function(t){const e=new g,o=t&&t.ot?n.floor(2*t.ot):131072,f=new i(o);let c=!1;e.Re(),e.we=f,this.append=(t,n)=>{const a=[];let l,u,w=0,h=0,d=0;if(0!==t.length){e.pe=0,e.he=t,e.te=t.length;do{if(e.ye=0,e.de=o,0!==e.te||c||(e.pe=0,c=!0),l=e.Ue(0),c&&l===s){if(0!==e.te)throw new r("inflating: bad input")}else if(0!==l&&1!==l)throw new r("inflating: "+e.re);if((c||1===l)&&e.te===t.length)throw new r("inflating: bad input");e.ye&&(e.ye===o?a.push(new i(f)):a.push(f.slice(0,e.ye))),d+=e.ye,n&&e.pe>0&&e.pe!=w&&(n(e.pe),w=e.pe)}while(e.te>0||0===e.de);return a.length>1?(u=new i(d),a.forEach((t=>{u.set(t,h),h+=t.length}))):u=a[0]||new i(0),u}},this.flush=()=>{e.Me()}}})();self.initCodec=()=>{self.Deflate=ot,self.Inflate=ft};\n'],{type:"text/javascript"}));e({workerScripts:{inflate:[t],deflate:[t]}});}};
|
|
4339
|
+
var e=e=>{if("function"==typeof URL.createObjectURL){const t=()=>URL.createObjectURL(new Blob(['const{Array:t,Object:e,Math:n,Error:r,Uint8Array:i,Uint16Array:s,Uint32Array:o,Int32Array:f,DataView:c,TextEncoder:l,crypto:u,postMessage:a,TransformStream:w,ReadableStream:h,WritableStream:d,CompressionStream:p,DecompressionStream:b}=globalThis,y=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)1&e?e=e>>>1^3988292384:e>>>=1;y[t]=e}class m{constructor(t){this.t=t||-1}append(t){let e=0|this.t;for(let n=0,r=0|t.length;r>n;n++)e=e>>>8^y[255&(e^t[n])];this.t=e}get(){return~this.t}}class k extends w{constructor(){super({start(){this.i=new m},transform(t){this.i.append(t)},flush(t){const e=new i(4);new c(e.buffer).setUint32(0,this.i.get()),t.enqueue(e)}})}}const g={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],r=g.o(n);return 32===r?t.concat(e):g.l(e,r,0|n,t.slice(0,t.length-1))},u(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+g.o(n)},h(t,e){if(32*t.length<e)return t;const r=(t=t.slice(0,n.ceil(e/32))).length;return e&=31,r>0&&e&&(t[r-1]=g.p(e,t[r-1]&2147483648>>e-1,1)),t},p:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,o:t=>n.round(t/1099511627776)||32,l(t,e,n,r){for(void 0===r&&(r=[]);e>=32;e-=32)r.push(n),n=0;if(0===e)return r.concat(t);for(let i=0;i<t.length;i++)r.push(n|t[i]>>>e),n=t[i]<<32-e;const i=t.length?t[t.length-1]:0,s=g.o(i);return r.push(g.p(e+s&31,e+s>32?n:r.pop(),1)),r}},v={m:{k(t){const e=g.u(t)/8,n=new i(e);let r;for(let i=0;e>i;i++)0==(3&i)&&(r=t[i/4]),n[i]=r>>>24,r<<=8;return n},g(t){const e=[];let n,r=0;for(n=0;n<t.length;n++)r=r<<8|t[n],3==(3&n)&&(e.push(r),r=0);return 3&n&&e.push(g.p(8*(3&n),r)),e}}},S={v:function(t){t?(this.S=t.S.slice(0),this._=t._.slice(0),this.C=t.C):this.reset()}};S.v.prototype={blockSize:512,reset:function(){const t=this;return t.S=this.A.slice(0),t._=[],t.C=0,t},update:function(t){const e=this;"string"==typeof t&&(t=v.I.g(t));const n=e._=g.concat(e._,t),i=e.C,s=e.C=i+g.u(t);if(s>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const f=new o(n);let c=0;for(let t=e.blockSize+i-(e.blockSize+i&e.blockSize-1);s>=t;t+=e.blockSize)e.V(f.subarray(16*c,16*(c+1))),c+=1;return n.splice(0,16*c),e},P:function(){const t=this;let e=t._;const r=t.S;e=g.concat(e,[g.p(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(n.floor(t.C/4294967296)),e.push(0|t.C);e.length;)t.V(e.splice(0,16));return t.reset(),r},A:[1732584193,4023233417,2562383102,271733878,3285377520],B:[1518500249,1859775393,2400959708,3395469782],D:(t,e,n,r)=>t>19?t>39?t>59?t>79?void 0:e^n^r:e&n|e&r|n&r:e^n^r:e&n|~e&r,M:(t,e)=>e<<t|e>>>32-t,V:function(e){const r=this,i=r.S,s=t(80);for(let t=0;16>t;t++)s[t]=e[t];let o=i[0],f=i[1],c=i[2],l=i[3],u=i[4];for(let t=0;79>=t;t++){16>t||(s[t]=r.M(1,s[t-3]^s[t-8]^s[t-14]^s[t-16]));const e=r.M(5,o)+r.D(t,f,c,l)+u+s[t]+r.B[n.floor(t/20)]|0;u=l,l=c,c=r.M(30,f),f=o,o=e}i[0]=i[0]+o|0,i[1]=i[1]+f|0,i[2]=i[2]+c|0,i[3]=i[3]+l|0,i[4]=i[4]+u|0}};const _={getRandomValues(t){const e=new o(t.buffer),r=t=>{let e=987654321;const r=4294967295;return()=>(e=36969*(65535&e)+(e>>16)&r,(((e<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r)/4294967296+.5)*(n.random()>.5?1:-1))};for(let i,s=0;s<t.length;s+=4){const t=r(4294967296*(i||n.random()));i=987654071*t(),e[s/4]=4294967296*t()|0}return t}},z={importKey:t=>new z.R(v.m.g(t)),U(t,e,n,i){if(n=n||1e4,0>i||0>n)throw new r("invalid params to pbkdf2");const s=1+(i>>5)<<2;let o,f,l,u,a;const w=new ArrayBuffer(s),h=new c(w);let d=0;const p=g;for(e=v.m.g(e),a=1;(s||1)>d;a++){for(o=f=t.encrypt(p.concat(e,[a])),l=1;n>l;l++)for(f=t.encrypt(f),u=0;u<f.length;u++)o[u]^=f[u];for(l=0;(s||1)>d&&l<o.length;l++)h.setInt32(d,o[l]),d+=4}return w.slice(0,i/8)},R:class{constructor(t){const e=this,n=e.T=S.v,r=[[],[]],i=n.prototype.blockSize/32;e.W=[new n,new n],t.length>i&&(t=n.hash(t));for(let e=0;i>e;e++)r[0][e]=909522486^t[e],r[1][e]=1549556828^t[e];e.W[0].update(r[0]),e.W[1].update(r[1]),e.j=new n(e.W[0])}reset(){const t=this;t.j=new t.T(t.W[0]),t.H=!1}update(t){this.H=!0,this.j.update(t)}digest(){const t=this,e=t.j.P(),n=new t.T(t.W[1]).update(e).P();return t.reset(),n}encrypt(t){if(this.H)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},C={name:"PBKDF2"},x=e.assign({hash:{name:"HMAC"}},C),A=e.assign({iterations:1e3,hash:{name:"SHA-1"}},C),I=["deriveBits"],V=[8,12,16],P=[16,24,32],B=[0,0,0,0],D=void 0!==u,E=D&&void 0!==u.subtle,M=D&&"function"==typeof u.getRandomValues,R=D&&E&&"function"==typeof u.subtle.importKey,U=D&&E&&"function"==typeof u.subtle.deriveBits,T=v.m,W=class{constructor(t){const e=this;e.K=[[[],[],[],[],[]],[[],[],[],[],[]]],e.K[0][0][0]||e.L();const n=e.K[0][4],i=e.K[1],s=t.length;let o,f,c,l=1;if(4!==s&&6!==s&&8!==s)throw new r("invalid aes key size");for(e.B=[f=t.slice(0),c=[]],o=s;4*s+28>o;o++){let t=f[o-1];(o%s==0||8===s&&o%s==4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],o%s==0&&(t=t<<8^t>>>24^l<<24,l=l<<1^283*(l>>7))),f[o]=f[o-s]^t}for(let t=0;o;t++,o--){const e=f[3&t?o:o-4];c[t]=4>=o||4>t?e:i[0][n[e>>>24]]^i[1][n[e>>16&255]]^i[2][n[e>>8&255]]^i[3][n[255&e]]}}encrypt(t){return this.F(t,0)}decrypt(t){return this.F(t,1)}L(){const t=this.K[0],e=this.K[1],n=t[4],r=e[4],i=[],s=[];let o,f,c,l;for(let t=0;256>t;t++)s[(i[t]=t<<1^283*(t>>7))^t]=t;for(let u=o=0;!n[u];u^=f||1,o=s[o]||1){let s=o^o<<1^o<<2^o<<3^o<<4;s=s>>8^255&s^99,n[u]=s,r[s]=u,l=i[c=i[f=i[u]]];let a=16843009*l^65537*c^257*f^16843008*u,w=257*i[s]^16843008*s;for(let n=0;4>n;n++)t[n][u]=w=w<<24^w>>>8,e[n][s]=a=a<<24^a>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}F(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.B[e],i=n.length/4-2,s=[0,0,0,0],o=this.K[e],f=o[0],c=o[1],l=o[2],u=o[3],a=o[4];let w,h,d,p=t[0]^n[0],b=t[e?3:1]^n[1],y=t[2]^n[2],m=t[e?1:3]^n[3],k=4;for(let t=0;i>t;t++)w=f[p>>>24]^c[b>>16&255]^l[y>>8&255]^u[255&m]^n[k],h=f[b>>>24]^c[y>>16&255]^l[m>>8&255]^u[255&p]^n[k+1],d=f[y>>>24]^c[m>>16&255]^l[p>>8&255]^u[255&b]^n[k+2],m=f[m>>>24]^c[p>>16&255]^l[b>>8&255]^u[255&y]^n[k+3],k+=4,p=w,b=h,y=d;for(let t=0;4>t;t++)s[e?3&-t:t]=a[p>>>24]<<24^a[b>>16&255]<<16^a[y>>8&255]<<8^a[255&m]^n[k++],w=p,p=b,b=y,y=m,m=w;return s}},j=class{constructor(t,e){this.O=t,this.q=e,this.G=e}reset(){this.G=this.q}update(t){return this.J(this.O,t,this.G)}N(t){if(255==(t>>24&255)){let e=t>>16&255,n=t>>8&255,r=255&t;255===e?(e=0,255===n?(n=0,255===r?r=0:++r):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=r}else t+=1<<24;return t}X(t){0===(t[0]=this.N(t[0]))&&(t[1]=this.N(t[1]))}J(t,e,n){let r;if(!(r=e.length))return[];const i=g.u(e);for(let i=0;r>i;i+=4){this.X(n);const r=t.encrypt(n);e[i]^=r[0],e[i+1]^=r[1],e[i+2]^=r[2],e[i+3]^=r[3]}return g.h(e,i)}},H=z.R;class K extends w{constructor(n,s,o){let f;super({start(){e.assign(this,{ready:new Promise((t=>this.Y=t)),password:n,signed:s,Z:o-1,pending:new i(0)})},async transform(e,n){const s=this;if(s.password){const n=s.password;s.password=null;const i=G(e,0,V[s.Z]+2);await(async(t,e,n)=>{await O(t,n,G(e,0,V[t.Z]));const i=G(e,V[t.Z]),s=t.keys.passwordVerification;if(s[0]!=i[0]||s[1]!=i[1])throw new r("Invalid pasword")})(s,i,n),s.$=new j(new W(s.keys.key),t.from(B)),s.tt=new H(s.keys.et),e=G(e,V[s.Z]+2),s.Y()}else await s.ready;const o=new i(e.length-10-(e.length-10)%16);n.enqueue(F(s,e,o,0,10,!0))},async flush(t){const e=this;await e.ready;const n=e.pending,r=G(n,0,n.length-10),s=G(n,n.length-10);let o=new i(0);if(r.length){const t=N(T,r);e.tt.update(t);const n=e.$.update(t);o=J(T,n)}if(f.valid=!0,e.signed){const t=G(J(T,e.tt.digest()),0,10);for(let e=0;10>e;e++)t[e]!=s[e]&&(f.valid=!1)}t.enqueue(o)}}),f=this}}class L extends w{constructor(n,r){let s;super({start(){e.assign(this,{ready:new Promise((t=>this.Y=t)),password:n,Z:r-1,pending:new i(0)})},async transform(e,n){const r=this;let s=new i(0);if(r.password){const e=r.password;r.password=null,s=await(async(t,e)=>{const n=(r=new i(V[t.Z]),M?u.getRandomValues(r):_.getRandomValues(r));var r;return await O(t,e,n),q(n,t.keys.passwordVerification)})(r,e),r.$=new j(new W(r.keys.key),t.from(B)),r.tt=new H(r.keys.et),r.Y()}else await r.ready;const o=new i(s.length+e.length-e.length%16);o.set(s,0),n.enqueue(F(r,e,o,s.length,0))},async flush(t){const e=this;await e.ready;let n=new i(0);if(e.pending.length){const t=e.$.update(N(T,e.pending));e.tt.update(t),n=J(T,t)}s.signature=J(T,e.tt.digest()).slice(0,10),t.enqueue(q(n,s.signature))}}),s=this}}function F(t,e,n,r,s,o){const f=e.length-s;let c;for(t.pending.length&&(e=q(t.pending,e),n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new i(e)).set(n,0)}return t})(n,f-f%16)),c=0;f-16>=c;c+=16){const i=N(T,G(e,c,c+16));o&&t.tt.update(i);const s=t.$.update(i);o||t.tt.update(s),n.set(J(T,s),c+r)}return t.pending=G(e,c),n}async function O(t,n,r){const s=(t=>{if(void 0===l){const e=new i((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new l).encode(t)})(n),o=await((t,e,n,r,i)=>R?u.subtle.importKey("raw",e,n,!1,i):z.importKey(e))(0,s,x,0,I),f=await(async(t,e,n)=>U?await u.subtle.deriveBits(t,e,n):z.U(e,t.salt,A.iterations,n))(e.assign({salt:r},A),o,8*(2*P[t.Z]+2)),c=new i(f);t.keys={key:N(T,G(c,0,P[t.Z])),et:N(T,G(c,P[t.Z],2*P[t.Z])),passwordVerification:G(c,2*P[t.Z])}}function q(t,e){let n=t;return t.length+e.length&&(n=new i(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function G(t,e,n){return t.subarray(e,n)}function J(t,e){return t.k(e)}function N(t,e){return t.g(e)}class Q extends w{constructor(t,n){let i;super({start(){e.assign(this,{password:t,passwordVerification:n}),$(this,t)},transform(t,e){const n=this;if(n.password){const e=Y(n,t.subarray(0,12));if(n.password=null,e[11]!=n.passwordVerification)throw new r("Invalid pasword");t=t.subarray(12)}e.enqueue(Y(n,t))},flush(){i.valid=!0}}),i=this}}class X extends w{constructor(t,n){super({start(){e.assign(this,{password:t,passwordVerification:n}),$(this,t)},transform(t,e){const n=this;let r,s;if(n.password){n.password=null;const e=u.getRandomValues(new i(12));e[11]=n.passwordVerification,r=new i(t.length+e.length),r.set(Z(n,e),0),s=12}else r=new i(t.length),s=0;r.set(Z(n,t),s),e.enqueue(r)},flush(){}})}}function Y(t,e){const n=new i(e.length);for(let r=0;r<e.length;r++)n[r]=et(t)^e[r],tt(t,n[r]);return n}function Z(t,e){const n=new i(e.length);for(let r=0;r<e.length;r++)n[r]=et(t)^e[r],tt(t,e[r]);return n}function $(t,e){t.keys=[305419896,591751049,878082192],t.nt=new m(t.keys[0]),t.rt=new m(t.keys[2]);for(let n=0;n<e.length;n++)tt(t,e.charCodeAt(n))}function tt(t,e){t.nt.append([e]),t.keys[0]=~t.nt.get(),t.keys[1]=rt(t.keys[1]+nt(t.keys[0])),t.keys[1]=rt(n.imul(t.keys[1],134775813)+1),t.rt.append([t.keys[1]>>>24]),t.keys[2]=~t.rt.get()}function et(t){const e=2|t.keys[2];return nt(n.imul(e,1^e)>>>8)}function nt(t){return 255&t}function rt(t){return 4294967295&t}class it extends w{constructor(t,e){let n;super({start(){n=new t(e)},transform(t,e){t=n.append(t),e.enqueue(t)},flush(t){const e=n.flush();e&&t.enqueue(e)}})}}const st=void 0===p,ot=void 0===b;let ft=!0,ct=!0;class lt extends w{constructor(t,e,{it:n},...r){super({},...r);const{compressed:i,st:s,password:o,passwordVerification:f,encryptionStrength:l,zipCrypto:u,signed:a}=e,w=this;let h,d,b=wt(super.readable);const y=!!o;if(y&&!u||!a||([b,h]=b.tee(),h=h.pipeThrough(new k)),i)if(void 0!==s&&!s||st&&!ct)b=at(t,b,n);else try{const t=new p("deflate-raw");b=b.pipeThrough(t)}catch(e){ct=!1,b=at(t,b,n)}y&&(u?b=b.pipeThrough(new X(o,f)):(d=new L(o,l),b=b.pipeThrough(d))),ht(w,b,(async()=>{let t;y&&!u&&(t=d.signature),y&&!u||!a||(t=await h.getReader().read(),t=new c(t.value.buffer).getUint32(0)),w.signature=t}))}}class ut extends w{constructor(t,e,{it:n},...i){super({},...i);const{zipCrypto:s,password:o,passwordVerification:f,signed:l,encryptionStrength:u,compressed:a,st:w}=e;let h,d,p=wt(super.readable);const y=!!o;if(y&&(s?p=p.pipeThrough(new Q(o,f)):(d=new K(o,l,u),p=p.pipeThrough(d))),a)if(void 0!==w&&!w||ot&&!ft)p=at(t,p,n);else try{p=p.pipeThrough(new b("deflate-raw"))}catch(e){ft=!1,p=at(t,p,n)}y&&!s||!l||([p,h]=p.tee(),h=h.pipeThrough(new k)),ht(this,p,(async()=>{if(y&&!s&&!d.valid)throw new r("Invalid signature");if((!y||s)&&l){const t=await h.getReader().read();if(t!=new c(t.value.buffer).getUint32(0,!1))throw new r("Invalid signature")}}))}}function at(t,e,n){return e.pipeThrough(new it(t,{it:n}))}function wt(t){return t.pipeThrough(new w({transform(t,e){t&&t.length&&e.enqueue(t)}}))}function ht(t,n,r){t.length=0,n=n.pipeThrough(new w({transform(e,n){e&&e.length&&(t.length+=e.length,n.enqueue(e))},flush:r})),e.defineProperty(t,"readable",{get:()=>n})}const dt=new Map;let pt,bt=0;function yt(t){if(t.data){const e=t.data;if(e&&e.length)try{t.data=e.buffer,a(t,[t.data])}catch(e){a(t)}else a(t)}else a(t)}addEventListener("message",(async t=>{const e=t.data,n=e.type;try{if("start"==n&&(async t=>{try{t.scripts&&t.scripts.length&&importScripts.apply(void 0,t.scripts);const e=t.options;let n;self.initCodec&&self.initCodec(),e.codecType.startsWith("deflate")?n=self.Deflate:e.codecType.startsWith("inflate")&&(n=self.Inflate);const r=new h({async pull(t){let e=new Promise(((t,e)=>dt.set(bt,{resolve:t,reject:e})));yt({type:"pull",messageId:bt}),bt++;const{value:n,done:r}=await e;t.enqueue(n),r&&t.close()}},{highWaterMark:1}),i=new d({write(t){yt({type:"data",data:t})}});pt=((t,e,n,r,i)=>{const s=new AbortController,{signal:o}=s;if(r.codecType.startsWith("deflate"))return{ot:()=>f(lt),abort:c};if(r.codecType.startsWith("inflate"))return{ot:()=>f(ut),abort:c};async function f(s){const f=new s(t,r,i);await e.pipeThrough(f,{signal:o}).pipeTo(n);const{length:c,signature:l}=f;return{length:c,signature:l}}function c(){s.abort()}})(n,r,i,e,t.config),yt({type:"close",result:await pt.ot()})}catch(t){a({error:{message:t.message,stack:t.stack}})}})(e),"data"==n){const{resolve:t}=dt.get(e.messageId);dt.delete(e.messageId),t({value:new i(e.data),done:e.done})}"abort"==n&&pt.abort()}catch(t){a({error:{message:t.message,stack:t.stack}})}}));const mt=(()=>{const e=-2;function o(e){return f(e.map((([e,n])=>new t(e).fill(n,0,e))))}function f(e){return e.reduce(((e,n)=>e.concat(t.isArray(n)?f(n):n)),[])}const c=[0,1,2,3].concat(...o([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function l(){const t=this;function e(t,e){let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1}t.ft=r=>{const i=t.ct,s=t.ut.lt,o=t.ut.wt;let f,c,l,u=-1;for(r.ht=0,r.dt=573,f=0;o>f;f++)0!==i[2*f]?(r.bt[++r.ht]=u=f,r.yt[f]=0):i[2*f+1]=0;for(;2>r.ht;)l=r.bt[++r.ht]=2>u?++u:0,i[2*l]=1,r.yt[l]=0,r.kt--,s&&(r.gt-=s[2*l+1]);for(t.vt=u,f=n.floor(r.ht/2);f>=1;f--)r.St(i,f);l=o;do{f=r.bt[1],r.bt[1]=r.bt[r.ht--],r.St(i,1),c=r.bt[1],r.bt[--r.dt]=f,r.bt[--r.dt]=c,i[2*l]=i[2*f]+i[2*c],r.yt[l]=n.max(r.yt[f],r.yt[c])+1,i[2*f+1]=i[2*c+1]=l,r.bt[1]=l++,r.St(i,1)}while(r.ht>=2);r.bt[--r.dt]=r.bt[1],(e=>{const n=t.ct,r=t.ut.lt,i=t.ut._t,s=t.ut.zt,o=t.ut.Ct;let f,c,l,u,a,w,h=0;for(u=0;15>=u;u++)e.xt[u]=0;for(n[2*e.bt[e.dt]+1]=0,f=e.dt+1;573>f;f++)c=e.bt[f],u=n[2*n[2*c+1]+1]+1,u>o&&(u=o,h++),n[2*c+1]=u,c>t.vt||(e.xt[u]++,a=0,s>c||(a=i[c-s]),w=n[2*c],e.kt+=w*(u+a),r&&(e.gt+=w*(r[2*c+1]+a)));if(0!==h){do{for(u=o-1;0===e.xt[u];)u--;e.xt[u]--,e.xt[u+1]+=2,e.xt[o]--,h-=2}while(h>0);for(u=o;0!==u;u--)for(c=e.xt[u];0!==c;)l=e.bt[--f],l>t.vt||(n[2*l+1]!=u&&(e.kt+=(u-n[2*l+1])*n[2*l],n[2*l+1]=u),c--)}})(r),((t,n,r)=>{const i=[];let s,o,f,c=0;for(s=1;15>=s;s++)i[s]=c=c+r[s-1]<<1;for(o=0;n>=o;o++)f=t[2*o+1],0!==f&&(t[2*o]=e(i[f]++,f))})(i,t.vt,r.xt)}}function u(t,e,n,r,i){const s=this;s.lt=t,s._t=e,s.zt=n,s.wt=r,s.Ct=i}l.At=[0,1,2,3,4,5,6,7].concat(...o([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]])),l.It=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],l.Vt=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],l.Pt=t=>256>t?c[t]:c[256+(t>>>7)],l.Bt=[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],l.Dt=[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],l.Et=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],l.Mt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];const a=o([[144,8],[112,9],[24,7],[8,8]]);u.Rt=f([12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,19,275,147,403,83,339,211,467,51,307,179,435,115,371,243,499,11,267,139,395,75,331,203,459,43,299,171,427,107,363,235,491,27,283,155,411,91,347,219,475,59,315,187,443,123,379,251,507,7,263,135,391,71,327,199,455,39,295,167,423,103,359,231,487,23,279,151,407,87,343,215,471,55,311,183,439,119,375,247,503,15,271,143,399,79,335,207,463,47,303,175,431,111,367,239,495,31,287,159,415,95,351,223,479,63,319,191,447,127,383,255,511,0,64,32,96,16,80,48,112,8,72,40,104,24,88,56,120,4,68,36,100,20,84,52,116,3,131,67,195,35,163,99,227].map(((t,e)=>[t,a[e]])));const w=o([[30,5]]);function h(t,e,n,r,i){const s=this;s.Ut=t,s.Tt=e,s.Wt=n,s.jt=r,s.Ht=i}u.Kt=f([0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23].map(((t,e)=>[t,w[e]]))),u.Lt=new u(u.Rt,l.Bt,257,286,15),u.Ft=new u(u.Kt,l.Dt,0,30,15),u.Ot=new u(null,l.Et,0,19,7);const d=[new h(0,0,0,0,0),new h(4,4,8,4,1),new h(4,5,16,8,1),new h(4,6,32,32,1),new h(4,4,16,16,2),new h(8,16,32,32,2),new h(8,16,128,128,2),new h(8,32,128,256,2),new h(32,128,258,1024,2),new h(32,258,258,4096,2)],p=["need dictionary","stream end","","","stream error","data error","","buffer error","",""],b=113,y=666,m=262;function k(t,e,n,r){const i=t[2*e],s=t[2*n];return s>i||i==s&&r[e]<=r[n]}function g(){const t=this;let r,o,f,c,a,w,h,g,v,S,_,z,C,x,A,I,V,P,B,D,E,M,R,U,T,W,j,H,K,L,F,O,q;const G=new l,J=new l,N=new l;let Q,X,Y,Z,$,tt;function et(){let e;for(e=0;286>e;e++)F[2*e]=0;for(e=0;30>e;e++)O[2*e]=0;for(e=0;19>e;e++)q[2*e]=0;F[512]=1,t.kt=t.gt=0,X=Y=0}function nt(t,e){let n,r=-1,i=t[1],s=0,o=7,f=4;0===i&&(o=138,f=3),t[2*(e+1)+1]=65535;for(let c=0;e>=c;c++)n=i,i=t[2*(c+1)+1],++s<o&&n==i||(f>s?q[2*n]+=s:0!==n?(n!=r&&q[2*n]++,q[32]++):s>10?q[36]++:q[34]++,s=0,r=n,0===i?(o=138,f=3):n==i?(o=6,f=3):(o=7,f=4))}function rt(e){t.qt[t.pending++]=e}function it(t){rt(255&t),rt(t>>>8&255)}function st(t,e){let n;const r=e;tt>16-r?(n=t,$|=n<<tt&65535,it($),$=n>>>16-tt,tt+=r-16):($|=t<<tt&65535,tt+=r)}function ot(t,e){const n=2*t;st(65535&e[n],65535&e[n+1])}function ft(t,e){let n,r,i=-1,s=t[1],o=0,f=7,c=4;for(0===s&&(f=138,c=3),n=0;e>=n;n++)if(r=s,s=t[2*(n+1)+1],++o>=f||r!=s){if(c>o)do{ot(r,q)}while(0!=--o);else 0!==r?(r!=i&&(ot(r,q),o--),ot(16,q),st(o-3,2)):o>10?(ot(18,q),st(o-11,7)):(ot(17,q),st(o-3,3));o=0,i=r,0===s?(f=138,c=3):r==s?(f=6,c=3):(f=7,c=4)}}function ct(){16==tt?(it($),$=0,tt=0):8>tt||(rt(255&$),$>>>=8,tt-=8)}function lt(e,r){let i,s,o;if(t.Gt[X]=e,t.Jt[X]=255&r,X++,0===e?F[2*r]++:(Y++,e--,F[2*(l.At[r]+256+1)]++,O[2*l.Pt(e)]++),0==(8191&X)&&j>2){for(i=8*X,s=E-V,o=0;30>o;o++)i+=O[2*o]*(5+l.Dt[o]);if(i>>>=3,Y<n.floor(X/2)&&i<n.floor(s/2))return!0}return X==Q-1}function ut(e,n){let r,i,s,o,f=0;if(0!==X)do{r=t.Gt[f],i=t.Jt[f],f++,0===r?ot(i,e):(s=l.At[i],ot(s+256+1,e),o=l.Bt[s],0!==o&&(i-=l.It[s],st(i,o)),r--,s=l.Pt(r),ot(s,n),o=l.Dt[s],0!==o&&(r-=l.Vt[s],st(r,o)))}while(X>f);ot(256,e),Z=e[513]}function at(){tt>8?it($):tt>0&&rt(255&$),$=0,tt=0}function wt(e,n,r){st(0+(r?1:0),3),((e,n)=>{at(),Z=8,it(n),it(~n),t.qt.set(g.subarray(e,e+n),t.pending),t.pending+=n})(e,n)}function ht(e){((e,n,r)=>{let i,s,o=0;j>0?(G.ft(t),J.ft(t),o=(()=>{let e;for(nt(F,G.vt),nt(O,J.vt),N.ft(t),e=18;e>=3&&0===q[2*l.Mt[e]+1];e--);return t.kt+=14+3*(e+1),e})(),i=t.kt+3+7>>>3,s=t.gt+3+7>>>3,s>i||(i=s)):i=s=n+5,n+4>i||-1==e?s==i?(st(2+(r?1:0),3),ut(u.Rt,u.Kt)):(st(4+(r?1:0),3),((t,e,n)=>{let r;for(st(t-257,5),st(e-1,5),st(n-4,4),r=0;n>r;r++)st(q[2*l.Mt[r]+1],3);ft(F,t-1),ft(O,e-1)})(G.vt+1,J.vt+1,o+1),ut(F,O)):wt(e,n,r),et(),r&&at()})(0>V?-1:V,E-V,e),V=E,r.Nt()}function dt(){let t,e,n,i;do{if(i=v-R-E,0===i&&0===E&&0===R)i=a;else if(-1==i)i--;else if(E>=a+a-m){g.set(g.subarray(a,a+a),0),M-=a,E-=a,V-=a,t=C,n=t;do{e=65535&_[--n],_[n]=a>e?0:e-a}while(0!=--t);t=a,n=t;do{e=65535&S[--n],S[n]=a>e?0:e-a}while(0!=--t);i+=a}if(0===r.Qt)return;t=r.Xt(g,E+R,i),R+=t,3>R||(z=255&g[E],z=(z<<I^255&g[E+1])&A)}while(m>R&&0!==r.Qt)}function pt(t){let e,n,r=T,i=E,s=U;const o=E>a-m?E-(a-m):0;let f=L;const c=h,l=E+258;let u=g[i+s-1],w=g[i+s];K>U||(r>>=2),f>R&&(f=R);do{if(e=t,g[e+s]==w&&g[e+s-1]==u&&g[e]==g[i]&&g[++e]==g[i+1]){i+=2,e++;do{}while(g[++i]==g[++e]&&g[++i]==g[++e]&&g[++i]==g[++e]&&g[++i]==g[++e]&&g[++i]==g[++e]&&g[++i]==g[++e]&&g[++i]==g[++e]&&g[++i]==g[++e]&&l>i);if(n=258-(l-i),i=l-258,n>s){if(M=t,s=n,n>=f)break;u=g[i+s-1],w=g[i+s]}}}while((t=65535&S[t&c])>o&&0!=--r);return s>R?R:s}t.yt=[],t.xt=[],t.bt=[],F=[],O=[],q=[],t.St=(e,n)=>{const r=t.bt,i=r[n];let s=n<<1;for(;s<=t.ht&&(s<t.ht&&k(e,r[s+1],r[s],t.yt)&&s++,!k(e,i,r[s],t.yt));)r[n]=r[s],n=s,s<<=1;r[n]=i},t.Yt=(r,l,p,y,m,k)=>(y||(y=8),m||(m=8),k||(k=0),r.Zt=null,-1==l&&(l=6),1>m||m>9||8!=y||9>p||p>15||0>l||l>9||0>k||k>2?e:(r.$t=t,w=p,a=1<<w,h=a-1,x=m+7,C=1<<x,A=C-1,I=n.floor((x+3-1)/3),g=new i(2*a),S=[],_=[],Q=1<<m+6,t.qt=new i(4*Q),f=4*Q,t.Gt=new s(Q),t.Jt=new i(Q),j=l,H=k,(e=>(e.te=e.ee=0,e.Zt=null,t.pending=0,t.ne=0,o=b,c=0,G.ct=F,G.ut=u.Lt,J.ct=O,J.ut=u.Ft,N.ct=q,N.ut=u.Ot,$=0,tt=0,Z=8,et(),(()=>{v=2*a,_[C-1]=0;for(let t=0;C-1>t;t++)_[t]=0;W=d[j].Tt,K=d[j].Ut,L=d[j].Wt,T=d[j].jt,E=0,V=0,R=0,P=U=2,D=0,z=0})(),0))(r))),t.re=()=>42!=o&&o!=b&&o!=y?e:(t.Jt=null,t.Gt=null,t.qt=null,_=null,S=null,g=null,t.$t=null,o==b?-3:0),t.ie=(t,n,r)=>{let i=0;return-1==n&&(n=6),0>n||n>9||0>r||r>2?e:(d[j].Ht!=d[n].Ht&&0!==t.te&&(i=t.se(1)),j!=n&&(j=n,W=d[j].Tt,K=d[j].Ut,L=d[j].Wt,T=d[j].jt),H=r,i)},t.oe=(t,n,r)=>{let i,s=r,f=0;if(!n||42!=o)return e;if(3>s)return 0;for(s>a-m&&(s=a-m,f=r-s),g.set(n.subarray(f,f+s),0),E=s,V=s,z=255&g[0],z=(z<<I^255&g[1])&A,i=0;s-3>=i;i++)z=(z<<I^255&g[i+2])&A,S[i&h]=_[z],_[z]=i;return 0},t.se=(n,i)=>{let s,l,k,v,x;if(i>4||0>i)return e;if(!n.fe||!n.ce&&0!==n.Qt||o==y&&4!=i)return n.Zt=p[4],e;if(0===n.le)return n.Zt=p[7],-5;var T;if(r=n,v=c,c=i,42==o&&(l=8+(w-8<<4)<<8,k=(j-1&255)>>1,k>3&&(k=3),l|=k<<6,0!==E&&(l|=32),l+=31-l%31,o=b,rt((T=l)>>8&255),rt(255&T)),0!==t.pending){if(r.Nt(),0===r.le)return c=-1,0}else if(0===r.Qt&&v>=i&&4!=i)return r.Zt=p[7],-5;if(o==y&&0!==r.Qt)return n.Zt=p[7],-5;if(0!==r.Qt||0!==R||0!=i&&o!=y){switch(x=-1,d[j].Ht){case 0:x=(t=>{let e,n=65535;for(n>f-5&&(n=f-5);;){if(1>=R){if(dt(),0===R&&0==t)return 0;if(0===R)break}if(E+=R,R=0,e=V+n,(0===E||E>=e)&&(R=E-e,E=e,ht(!1),0===r.le))return 0;if(E-V>=a-m&&(ht(!1),0===r.le))return 0}return ht(4==t),0===r.le?4==t?2:0:4==t?3:1})(i);break;case 1:x=(t=>{let e,n=0;for(;;){if(m>R){if(dt(),m>R&&0==t)return 0;if(0===R)break}if(3>R||(z=(z<<I^255&g[E+2])&A,n=65535&_[z],S[E&h]=_[z],_[z]=E),0===n||(E-n&65535)>a-m||2!=H&&(P=pt(n)),3>P)e=lt(0,255&g[E]),R--,E++;else if(e=lt(E-M,P-3),R-=P,P>W||3>R)E+=P,P=0,z=255&g[E],z=(z<<I^255&g[E+1])&A;else{P--;do{E++,z=(z<<I^255&g[E+2])&A,n=65535&_[z],S[E&h]=_[z],_[z]=E}while(0!=--P);E++}if(e&&(ht(!1),0===r.le))return 0}return ht(4==t),0===r.le?4==t?2:0:4==t?3:1})(i);break;case 2:x=(t=>{let e,n,i=0;for(;;){if(m>R){if(dt(),m>R&&0==t)return 0;if(0===R)break}if(3>R||(z=(z<<I^255&g[E+2])&A,i=65535&_[z],S[E&h]=_[z],_[z]=E),U=P,B=M,P=2,0!==i&&W>U&&a-m>=(E-i&65535)&&(2!=H&&(P=pt(i)),5>=P&&(1==H||3==P&&E-M>4096)&&(P=2)),3>U||P>U)if(0!==D){if(e=lt(0,255&g[E-1]),e&&ht(!1),E++,R--,0===r.le)return 0}else D=1,E++,R--;else{n=E+R-3,e=lt(E-1-B,U-3),R-=U-1,U-=2;do{++E>n||(z=(z<<I^255&g[E+2])&A,i=65535&_[z],S[E&h]=_[z],_[z]=E)}while(0!=--U);if(D=0,P=2,E++,e&&(ht(!1),0===r.le))return 0}}return 0!==D&&(e=lt(0,255&g[E-1]),D=0),ht(4==t),0===r.le?4==t?2:0:4==t?3:1})(i)}if(2!=x&&3!=x||(o=y),0==x||2==x)return 0===r.le&&(c=-1),0;if(1==x){if(1==i)st(2,3),ot(256,u.Rt),ct(),9>1+Z+10-tt&&(st(2,3),ot(256,u.Rt),ct()),Z=7;else if(wt(0,0,!1),3==i)for(s=0;C>s;s++)_[s]=0;if(r.Nt(),0===r.le)return c=-1,0}}return 4!=i?0:1}}function v(){const t=this;t.ue=0,t.ae=0,t.Qt=0,t.te=0,t.le=0,t.ee=0}return v.prototype={Yt:function(t,e){const n=this;return n.$t=new g,e||(e=15),n.$t.Yt(n,t,e)},se:function(t){const n=this;return n.$t?n.$t.se(n,t):e},re:function(){const t=this;if(!t.$t)return e;const n=t.$t.re();return t.$t=null,n},ie:function(t,n){const r=this;return r.$t?r.$t.ie(r,t,n):e},oe:function(t,n){const r=this;return r.$t?r.$t.oe(r,t,n):e},Xt:function(t,e,n){const r=this;let i=r.Qt;return i>n&&(i=n),0===i?0:(r.Qt-=i,t.set(r.ce.subarray(r.ue,r.ue+i),e),r.ue+=i,r.te+=i,i)},Nt:function(){const t=this;let e=t.$t.pending;e>t.le&&(e=t.le),0!==e&&(t.fe.set(t.$t.qt.subarray(t.$t.ne,t.$t.ne+e),t.ae),t.ae+=e,t.$t.ne+=e,t.ee+=e,t.le-=e,t.$t.pending-=e,0===t.$t.pending&&(t.$t.ne=0))}},function(t){const e=new v,s=(o=t&&t.it?t.it:65536)+5*(n.floor(o/16383)+1);var o;const f=new i(s);let c=t?t.level:-1;void 0===c&&(c=-1),e.Yt(c),e.fe=f,this.append=(t,n)=>{let o,c,l=0,u=0,a=0;const w=[];if(t.length){e.ue=0,e.ce=t,e.Qt=t.length;do{if(e.ae=0,e.le=s,o=e.se(0),0!=o)throw new r("deflating: "+e.Zt);e.ae&&(e.ae==s?w.push(new i(f)):w.push(f.slice(0,e.ae))),a+=e.ae,n&&e.ue>0&&e.ue!=l&&(n(e.ue),l=e.ue)}while(e.Qt>0||0===e.le);return w.length>1?(c=new i(a),w.forEach((t=>{c.set(t,u),u+=t.length}))):c=w[0]||new i(0),c}},this.flush=()=>{let t,n,o=0,c=0;const l=[];do{if(e.ae=0,e.le=s,t=e.se(4),1!=t&&0!=t)throw new r("deflating: "+e.Zt);s-e.le>0&&l.push(f.slice(0,e.ae)),c+=e.ae}while(e.Qt>0||0===e.le);return e.re(),n=new i(c),l.forEach((t=>{n.set(t,o),o+=t.length})),n}}})(),kt=(()=>{const t=-2,e=-3,s=-5,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],c=[96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,192,80,7,10,0,8,96,0,8,32,0,9,160,0,8,0,0,8,128,0,8,64,0,9,224,80,7,6,0,8,88,0,8,24,0,9,144,83,7,59,0,8,120,0,8,56,0,9,208,81,7,17,0,8,104,0,8,40,0,9,176,0,8,8,0,8,136,0,8,72,0,9,240,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,200,81,7,13,0,8,100,0,8,36,0,9,168,0,8,4,0,8,132,0,8,68,0,9,232,80,7,8,0,8,92,0,8,28,0,9,152,84,7,83,0,8,124,0,8,60,0,9,216,82,7,23,0,8,108,0,8,44,0,9,184,0,8,12,0,8,140,0,8,76,0,9,248,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,196,81,7,11,0,8,98,0,8,34,0,9,164,0,8,2,0,8,130,0,8,66,0,9,228,80,7,7,0,8,90,0,8,26,0,9,148,84,7,67,0,8,122,0,8,58,0,9,212,82,7,19,0,8,106,0,8,42,0,9,180,0,8,10,0,8,138,0,8,74,0,9,244,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,204,81,7,15,0,8,102,0,8,38,0,9,172,0,8,6,0,8,134,0,8,70,0,9,236,80,7,9,0,8,94,0,8,30,0,9,156,84,7,99,0,8,126,0,8,62,0,9,220,82,7,27,0,8,110,0,8,46,0,9,188,0,8,14,0,8,142,0,8,78,0,9,252,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,194,80,7,10,0,8,97,0,8,33,0,9,162,0,8,1,0,8,129,0,8,65,0,9,226,80,7,6,0,8,89,0,8,25,0,9,146,83,7,59,0,8,121,0,8,57,0,9,210,81,7,17,0,8,105,0,8,41,0,9,178,0,8,9,0,8,137,0,8,73,0,9,242,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,202,81,7,13,0,8,101,0,8,37,0,9,170,0,8,5,0,8,133,0,8,69,0,9,234,80,7,8,0,8,93,0,8,29,0,9,154,84,7,83,0,8,125,0,8,61,0,9,218,82,7,23,0,8,109,0,8,45,0,9,186,0,8,13,0,8,141,0,8,77,0,9,250,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,198,81,7,11,0,8,99,0,8,35,0,9,166,0,8,3,0,8,131,0,8,67,0,9,230,80,7,7,0,8,91,0,8,27,0,9,150,84,7,67,0,8,123,0,8,59,0,9,214,82,7,19,0,8,107,0,8,43,0,9,182,0,8,11,0,8,139,0,8,75,0,9,246,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,206,81,7,15,0,8,103,0,8,39,0,9,174,0,8,7,0,8,135,0,8,71,0,9,238,80,7,9,0,8,95,0,8,31,0,9,158,84,7,99,0,8,127,0,8,63,0,9,222,82,7,27,0,8,111,0,8,47,0,9,190,0,8,15,0,8,143,0,8,79,0,9,254,96,7,256,0,8,80,0,8,16,84,8,115,82,7,31,0,8,112,0,8,48,0,9,193,80,7,10,0,8,96,0,8,32,0,9,161,0,8,0,0,8,128,0,8,64,0,9,225,80,7,6,0,8,88,0,8,24,0,9,145,83,7,59,0,8,120,0,8,56,0,9,209,81,7,17,0,8,104,0,8,40,0,9,177,0,8,8,0,8,136,0,8,72,0,9,241,80,7,4,0,8,84,0,8,20,85,8,227,83,7,43,0,8,116,0,8,52,0,9,201,81,7,13,0,8,100,0,8,36,0,9,169,0,8,4,0,8,132,0,8,68,0,9,233,80,7,8,0,8,92,0,8,28,0,9,153,84,7,83,0,8,124,0,8,60,0,9,217,82,7,23,0,8,108,0,8,44,0,9,185,0,8,12,0,8,140,0,8,76,0,9,249,80,7,3,0,8,82,0,8,18,85,8,163,83,7,35,0,8,114,0,8,50,0,9,197,81,7,11,0,8,98,0,8,34,0,9,165,0,8,2,0,8,130,0,8,66,0,9,229,80,7,7,0,8,90,0,8,26,0,9,149,84,7,67,0,8,122,0,8,58,0,9,213,82,7,19,0,8,106,0,8,42,0,9,181,0,8,10,0,8,138,0,8,74,0,9,245,80,7,5,0,8,86,0,8,22,192,8,0,83,7,51,0,8,118,0,8,54,0,9,205,81,7,15,0,8,102,0,8,38,0,9,173,0,8,6,0,8,134,0,8,70,0,9,237,80,7,9,0,8,94,0,8,30,0,9,157,84,7,99,0,8,126,0,8,62,0,9,221,82,7,27,0,8,110,0,8,46,0,9,189,0,8,14,0,8,142,0,8,78,0,9,253,96,7,256,0,8,81,0,8,17,85,8,131,82,7,31,0,8,113,0,8,49,0,9,195,80,7,10,0,8,97,0,8,33,0,9,163,0,8,1,0,8,129,0,8,65,0,9,227,80,7,6,0,8,89,0,8,25,0,9,147,83,7,59,0,8,121,0,8,57,0,9,211,81,7,17,0,8,105,0,8,41,0,9,179,0,8,9,0,8,137,0,8,73,0,9,243,80,7,4,0,8,85,0,8,21,80,8,258,83,7,43,0,8,117,0,8,53,0,9,203,81,7,13,0,8,101,0,8,37,0,9,171,0,8,5,0,8,133,0,8,69,0,9,235,80,7,8,0,8,93,0,8,29,0,9,155,84,7,83,0,8,125,0,8,61,0,9,219,82,7,23,0,8,109,0,8,45,0,9,187,0,8,13,0,8,141,0,8,77,0,9,251,80,7,3,0,8,83,0,8,19,85,8,195,83,7,35,0,8,115,0,8,51,0,9,199,81,7,11,0,8,99,0,8,35,0,9,167,0,8,3,0,8,131,0,8,67,0,9,231,80,7,7,0,8,91,0,8,27,0,9,151,84,7,67,0,8,123,0,8,59,0,9,215,82,7,19,0,8,107,0,8,43,0,9,183,0,8,11,0,8,139,0,8,75,0,9,247,80,7,5,0,8,87,0,8,23,192,8,0,83,7,51,0,8,119,0,8,55,0,9,207,81,7,15,0,8,103,0,8,39,0,9,175,0,8,7,0,8,135,0,8,71,0,9,239,80,7,9,0,8,95,0,8,31,0,9,159,84,7,99,0,8,127,0,8,63,0,9,223,82,7,27,0,8,111,0,8,47,0,9,191,0,8,15,0,8,143,0,8,79,0,9,255],l=[80,5,1,87,5,257,83,5,17,91,5,4097,81,5,5,89,5,1025,85,5,65,93,5,16385,80,5,3,88,5,513,84,5,33,92,5,8193,82,5,9,90,5,2049,86,5,129,192,5,24577,80,5,2,87,5,385,83,5,25,91,5,6145,81,5,7,89,5,1537,85,5,97,93,5,24577,80,5,4,88,5,769,84,5,49,92,5,12289,82,5,13,90,5,3073,86,5,193,192,5,24577],u=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[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,112,112],w=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],h=[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];function d(){let t,n,r,i,o,c;function l(t,n,f,l,u,a,w,h,d,p,b){let y,m,k,g,v,S,_,z,C,x,A,I,V,P,B;x=0,v=f;do{r[t[n+x]]++,x++,v--}while(0!==v);if(r[0]==f)return w[0]=-1,h[0]=0,0;for(z=h[0],S=1;15>=S&&0===r[S];S++);for(_=S,S>z&&(z=S),v=15;0!==v&&0===r[v];v--);for(k=v,z>v&&(z=v),h[0]=z,P=1<<S;v>S;S++,P<<=1)if(0>(P-=r[S]))return e;if(0>(P-=r[v]))return e;for(r[v]+=P,c[1]=S=0,x=1,V=2;0!=--v;)c[V]=S+=r[x],V++,x++;v=0,x=0;do{0!==(S=t[n+x])&&(b[c[S]++]=v),x++}while(++v<f);for(f=c[k],c[0]=v=0,x=0,g=-1,I=-z,o[0]=0,A=0,B=0;k>=_;_++)for(y=r[_];0!=y--;){for(;_>I+z;){if(g++,I+=z,B=k-I,B=B>z?z:B,(m=1<<(S=_-I))>y+1&&(m-=y+1,V=_,B>S))for(;++S<B&&(m<<=1)>r[++V];)m-=r[V];if(B=1<<S,p[0]+B>1440)return e;o[g]=A=p[0],p[0]+=B,0!==g?(c[g]=v,i[0]=S,i[1]=z,S=v>>>I-z,i[2]=A-o[g-1]-S,d.set(i,3*(o[g-1]+S))):w[0]=A}for(i[1]=_-I,f>x?b[x]<l?(i[0]=256>b[x]?0:96,i[2]=b[x++]):(i[0]=a[b[x]-l]+16+64,i[2]=u[b[x++]-l]):i[0]=192,m=1<<_-I,S=v>>>I;B>S;S+=m)d.set(i,3*(A+S));for(S=1<<_-1;0!=(v&S);S>>>=1)v^=S;for(v^=S,C=(1<<I)-1;(v&C)!=c[g];)g--,I-=z,C=(1<<I)-1}return 0!==P&&1!=k?s:0}function d(e){let s;for(t||(t=[],n=[],r=new f(16),i=[],o=new f(15),c=new f(16)),n.length<e&&(n=[]),s=0;e>s;s++)n[s]=0;for(s=0;16>s;s++)r[s]=0;for(s=0;3>s;s++)i[s]=0;o.set(r.subarray(0,15),0),c.set(r.subarray(0,16),0)}this.we=(r,i,o,f,c)=>{let u;return d(19),t[0]=0,u=l(r,0,19,19,null,null,o,i,f,t,n),u==e?c.Zt="oversubscribed dynamic bit lengths tree":u!=s&&0!==i[0]||(c.Zt="incomplete dynamic bit lengths tree",u=e),u},this.he=(r,i,o,f,c,p,b,y,m)=>{let k;return d(288),t[0]=0,k=l(o,0,r,257,u,a,p,f,y,t,n),0!=k||0===f[0]?(k==e?m.Zt="oversubscribed literal/length tree":-4!=k&&(m.Zt="incomplete literal/length tree",k=e),k):(d(288),k=l(o,r,i,0,w,h,b,c,y,t,n),0!=k||0===c[0]&&r>257?(k==e?m.Zt="oversubscribed distance tree":k==s?(m.Zt="incomplete distance tree",k=e):-4!=k&&(m.Zt="empty distance tree with lengths",k=e),k):0)}}function p(){const n=this;let r,i,s,f,c=0,l=0,u=0,a=0,w=0,h=0,d=0,p=0,b=0,y=0;function m(t,n,r,i,s,f,c,l){let u,a,w,h,d,p,b,y,m,k,g,v,S,_,z,C;b=l.ue,y=l.Qt,d=c.de,p=c.pe,m=c.write,k=m<c.read?c.read-m-1:c.end-m,g=o[t],v=o[n];do{for(;20>p;)y--,d|=(255&l.be(b++))<<p,p+=8;if(u=d&g,a=r,w=i,C=3*(w+u),0!==(h=a[C]))for(;;){if(d>>=a[C+1],p-=a[C+1],0!=(16&h)){for(h&=15,S=a[C+2]+(d&o[h]),d>>=h,p-=h;15>p;)y--,d|=(255&l.be(b++))<<p,p+=8;for(u=d&v,a=s,w=f,C=3*(w+u),h=a[C];;){if(d>>=a[C+1],p-=a[C+1],0!=(16&h)){for(h&=15;h>p;)y--,d|=(255&l.be(b++))<<p,p+=8;if(_=a[C+2]+(d&o[h]),d>>=h,p-=h,k-=S,_>m){z=m-_;do{z+=c.end}while(0>z);if(h=c.end-z,S>h){if(S-=h,m-z>0&&h>m-z)do{c.ye[m++]=c.ye[z++]}while(0!=--h);else c.ye.set(c.ye.subarray(z,z+h),m),m+=h,z+=h,h=0;z=0}}else z=m-_,m-z>0&&2>m-z?(c.ye[m++]=c.ye[z++],c.ye[m++]=c.ye[z++],S-=2):(c.ye.set(c.ye.subarray(z,z+2),m),m+=2,z+=2,S-=2);if(m-z>0&&S>m-z)do{c.ye[m++]=c.ye[z++]}while(0!=--S);else c.ye.set(c.ye.subarray(z,z+S),m),m+=S,z+=S,S=0;break}if(0!=(64&h))return l.Zt="invalid distance code",S=l.Qt-y,S=S>p>>3?p>>3:S,y+=S,b-=S,p-=S<<3,c.de=d,c.pe=p,l.Qt=y,l.te+=b-l.ue,l.ue=b,c.write=m,e;u+=a[C+2],u+=d&o[h],C=3*(w+u),h=a[C]}break}if(0!=(64&h))return 0!=(32&h)?(S=l.Qt-y,S=S>p>>3?p>>3:S,y+=S,b-=S,p-=S<<3,c.de=d,c.pe=p,l.Qt=y,l.te+=b-l.ue,l.ue=b,c.write=m,1):(l.Zt="invalid literal/length code",S=l.Qt-y,S=S>p>>3?p>>3:S,y+=S,b-=S,p-=S<<3,c.de=d,c.pe=p,l.Qt=y,l.te+=b-l.ue,l.ue=b,c.write=m,e);if(u+=a[C+2],u+=d&o[h],C=3*(w+u),0===(h=a[C])){d>>=a[C+1],p-=a[C+1],c.ye[m++]=a[C+2],k--;break}}else d>>=a[C+1],p-=a[C+1],c.ye[m++]=a[C+2],k--}while(k>=258&&y>=10);return S=l.Qt-y,S=S>p>>3?p>>3:S,y+=S,b-=S,p-=S<<3,c.de=d,c.pe=p,l.Qt=y,l.te+=b-l.ue,l.ue=b,c.write=m,0}n.init=(t,e,n,o,c,l)=>{r=0,d=t,p=e,s=n,b=o,f=c,y=l,i=null},n.me=(n,k,g)=>{let v,S,_,z,C,x,A,I=0,V=0,P=0;for(P=k.ue,z=k.Qt,I=n.de,V=n.pe,C=n.write,x=C<n.read?n.read-C-1:n.end-C;;)switch(r){case 0:if(x>=258&&z>=10&&(n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,g=m(d,p,s,b,f,y,n,k),P=k.ue,z=k.Qt,I=n.de,V=n.pe,C=n.write,x=C<n.read?n.read-C-1:n.end-C,0!=g)){r=1==g?7:9;break}u=d,i=s,l=b,r=1;case 1:for(v=u;v>V;){if(0===z)return n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);g=0,z--,I|=(255&k.be(P++))<<V,V+=8}if(S=3*(l+(I&o[v])),I>>>=i[S+1],V-=i[S+1],_=i[S],0===_){a=i[S+2],r=6;break}if(0!=(16&_)){w=15&_,c=i[S+2],r=2;break}if(0==(64&_)){u=_,l=S/3+i[S+2];break}if(0!=(32&_)){r=7;break}return r=9,k.Zt="invalid literal/length code",g=e,n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);case 2:for(v=w;v>V;){if(0===z)return n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);g=0,z--,I|=(255&k.be(P++))<<V,V+=8}c+=I&o[v],I>>=v,V-=v,u=p,i=f,l=y,r=3;case 3:for(v=u;v>V;){if(0===z)return n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);g=0,z--,I|=(255&k.be(P++))<<V,V+=8}if(S=3*(l+(I&o[v])),I>>=i[S+1],V-=i[S+1],_=i[S],0!=(16&_)){w=15&_,h=i[S+2],r=4;break}if(0==(64&_)){u=_,l=S/3+i[S+2];break}return r=9,k.Zt="invalid distance code",g=e,n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);case 4:for(v=w;v>V;){if(0===z)return n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);g=0,z--,I|=(255&k.be(P++))<<V,V+=8}h+=I&o[v],I>>=v,V-=v,r=5;case 5:for(A=C-h;0>A;)A+=n.end;for(;0!==c;){if(0===x&&(C==n.end&&0!==n.read&&(C=0,x=C<n.read?n.read-C-1:n.end-C),0===x&&(n.write=C,g=n.ke(k,g),C=n.write,x=C<n.read?n.read-C-1:n.end-C,C==n.end&&0!==n.read&&(C=0,x=C<n.read?n.read-C-1:n.end-C),0===x)))return n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);n.ye[C++]=n.ye[A++],x--,A==n.end&&(A=0),c--}r=0;break;case 6:if(0===x&&(C==n.end&&0!==n.read&&(C=0,x=C<n.read?n.read-C-1:n.end-C),0===x&&(n.write=C,g=n.ke(k,g),C=n.write,x=C<n.read?n.read-C-1:n.end-C,C==n.end&&0!==n.read&&(C=0,x=C<n.read?n.read-C-1:n.end-C),0===x)))return n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);g=0,n.ye[C++]=a,x--,r=0;break;case 7:if(V>7&&(V-=8,z++,P--),n.write=C,g=n.ke(k,g),C=n.write,x=C<n.read?n.read-C-1:n.end-C,n.read!=n.write)return n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);r=8;case 8:return g=1,n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);case 9:return g=e,n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g);default:return g=t,n.de=I,n.pe=V,k.Qt=z,k.te+=P-k.ue,k.ue=P,n.write=C,n.ke(k,g)}},n.ge=()=>{}}d.ve=(t,e,n,r)=>(t[0]=9,e[0]=5,n[0]=c,r[0]=l,0);const b=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function y(n,r){const c=this;let l,u=0,a=0,w=0,h=0;const y=[0],m=[0],k=new p;let g=0,v=new f(4320);const S=new d;c.pe=0,c.de=0,c.ye=new i(r),c.end=r,c.read=0,c.write=0,c.reset=(t,e)=>{e&&(e[0]=0),6==u&&k.ge(t),u=0,c.pe=0,c.de=0,c.read=c.write=0},c.reset(n,null),c.ke=(t,e)=>{let n,r,i;return r=t.ae,i=c.read,n=(i>c.write?c.end:c.write)-i,n>t.le&&(n=t.le),0!==n&&e==s&&(e=0),t.le-=n,t.ee+=n,t.fe.set(c.ye.subarray(i,i+n),r),r+=n,i+=n,i==c.end&&(i=0,c.write==c.end&&(c.write=0),n=c.write-i,n>t.le&&(n=t.le),0!==n&&e==s&&(e=0),t.le-=n,t.ee+=n,t.fe.set(c.ye.subarray(i,i+n),r),r+=n,i+=n),t.ae=r,c.read=i,e},c.me=(n,r)=>{let i,s,f,p,_,z,C,x;for(p=n.ue,_=n.Qt,s=c.de,f=c.pe,z=c.write,C=z<c.read?c.read-z-1:c.end-z;;){let A,I,V,P,B,D,E,M;switch(u){case 0:for(;3>f;){if(0===_)return c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);r=0,_--,s|=(255&n.be(p++))<<f,f+=8}switch(i=7&s,g=1&i,i>>>1){case 0:s>>>=3,f-=3,i=7&f,s>>>=i,f-=i,u=1;break;case 1:A=[],I=[],V=[[]],P=[[]],d.ve(A,I,V,P),k.init(A[0],I[0],V[0],0,P[0],0),s>>>=3,f-=3,u=6;break;case 2:s>>>=3,f-=3,u=3;break;case 3:return s>>>=3,f-=3,u=9,n.Zt="invalid block type",r=e,c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r)}break;case 1:for(;32>f;){if(0===_)return c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);r=0,_--,s|=(255&n.be(p++))<<f,f+=8}if((~s>>>16&65535)!=(65535&s))return u=9,n.Zt="invalid stored block lengths",r=e,c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);a=65535&s,s=f=0,u=0!==a?2:0!==g?7:0;break;case 2:if(0===_)return c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);if(0===C&&(z==c.end&&0!==c.read&&(z=0,C=z<c.read?c.read-z-1:c.end-z),0===C&&(c.write=z,r=c.ke(n,r),z=c.write,C=z<c.read?c.read-z-1:c.end-z,z==c.end&&0!==c.read&&(z=0,C=z<c.read?c.read-z-1:c.end-z),0===C)))return c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);if(r=0,i=a,i>_&&(i=_),i>C&&(i=C),c.ye.set(n.Xt(p,i),z),p+=i,_-=i,z+=i,C-=i,0!=(a-=i))break;u=0!==g?7:0;break;case 3:for(;14>f;){if(0===_)return c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);r=0,_--,s|=(255&n.be(p++))<<f,f+=8}if(w=i=16383&s,(31&i)>29||(i>>5&31)>29)return u=9,n.Zt="too many length or distance symbols",r=e,c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);if(i=258+(31&i)+(i>>5&31),!l||l.length<i)l=[];else for(x=0;i>x;x++)l[x]=0;s>>>=14,f-=14,h=0,u=4;case 4:for(;4+(w>>>10)>h;){for(;3>f;){if(0===_)return c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);r=0,_--,s|=(255&n.be(p++))<<f,f+=8}l[b[h++]]=7&s,s>>>=3,f-=3}for(;19>h;)l[b[h++]]=0;if(y[0]=7,i=S.we(l,y,m,v,n),0!=i)return(r=i)==e&&(l=null,u=9),c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);h=0,u=5;case 5:for(;i=w,258+(31&i)+(i>>5&31)>h;){let t,a;for(i=y[0];i>f;){if(0===_)return c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);r=0,_--,s|=(255&n.be(p++))<<f,f+=8}if(i=v[3*(m[0]+(s&o[i]))+1],a=v[3*(m[0]+(s&o[i]))+2],16>a)s>>>=i,f-=i,l[h++]=a;else{for(x=18==a?7:a-14,t=18==a?11:3;i+x>f;){if(0===_)return c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);r=0,_--,s|=(255&n.be(p++))<<f,f+=8}if(s>>>=i,f-=i,t+=s&o[x],s>>>=x,f-=x,x=h,i=w,x+t>258+(31&i)+(i>>5&31)||16==a&&1>x)return l=null,u=9,n.Zt="invalid bit length repeat",r=e,c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);a=16==a?l[x-1]:0;do{l[x++]=a}while(0!=--t);h=x}}if(m[0]=-1,B=[],D=[],E=[],M=[],B[0]=9,D[0]=6,i=w,i=S.he(257+(31&i),1+(i>>5&31),l,B,D,E,M,v,n),0!=i)return i==e&&(l=null,u=9),r=i,c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);k.init(B[0],D[0],v,E[0],v,M[0]),u=6;case 6:if(c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,1!=(r=k.me(c,n,r)))return c.ke(n,r);if(r=0,k.ge(n),p=n.ue,_=n.Qt,s=c.de,f=c.pe,z=c.write,C=z<c.read?c.read-z-1:c.end-z,0===g){u=0;break}u=7;case 7:if(c.write=z,r=c.ke(n,r),z=c.write,C=z<c.read?c.read-z-1:c.end-z,c.read!=c.write)return c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);u=8;case 8:return r=1,c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);case 9:return r=e,c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r);default:return r=t,c.de=s,c.pe=f,n.Qt=_,n.te+=p-n.ue,n.ue=p,c.write=z,c.ke(n,r)}}},c.ge=t=>{c.reset(t,null),c.ye=null,v=null},c.Se=(t,e,n)=>{c.ye.set(t.subarray(e,e+n),0),c.read=c.write=n},c._e=()=>1==u?1:0}const m=13,k=[0,0,255,255];function g(){const n=this;function r(e){return e&&e.ze?(e.te=e.ee=0,e.Zt=null,e.ze.mode=7,e.ze.Ce.reset(e,null),0):t}n.mode=0,n.method=0,n.xe=[0],n.Ae=0,n.marker=0,n.Ie=0,n.Ve=t=>(n.Ce&&n.Ce.ge(t),n.Ce=null,0),n.Pe=(e,i)=>(e.Zt=null,n.Ce=null,8>i||i>15?(n.Ve(e),t):(n.Ie=i,e.ze.Ce=new y(e,1<<i),r(e),0)),n.Be=(n,r)=>{let i,o;if(!n||!n.ze||!n.ce)return t;const f=n.ze;for(r=4==r?s:0,i=s;;)switch(f.mode){case 0:if(0===n.Qt)return i;if(i=r,n.Qt--,n.te++,8!=(15&(f.method=n.be(n.ue++)))){f.mode=m,n.Zt="unknown compression method",f.marker=5;break}if(8+(f.method>>4)>f.Ie){f.mode=m,n.Zt="invalid win size",f.marker=5;break}f.mode=1;case 1:if(0===n.Qt)return i;if(i=r,n.Qt--,n.te++,o=255&n.be(n.ue++),((f.method<<8)+o)%31!=0){f.mode=m,n.Zt="incorrect header check",f.marker=5;break}if(0==(32&o)){f.mode=7;break}f.mode=2;case 2:if(0===n.Qt)return i;i=r,n.Qt--,n.te++,f.Ae=(255&n.be(n.ue++))<<24&4278190080,f.mode=3;case 3:if(0===n.Qt)return i;i=r,n.Qt--,n.te++,f.Ae+=(255&n.be(n.ue++))<<16&16711680,f.mode=4;case 4:if(0===n.Qt)return i;i=r,n.Qt--,n.te++,f.Ae+=(255&n.be(n.ue++))<<8&65280,f.mode=5;case 5:return 0===n.Qt?i:(i=r,n.Qt--,n.te++,f.Ae+=255&n.be(n.ue++),f.mode=6,2);case 6:return f.mode=m,n.Zt="need dictionary",f.marker=0,t;case 7:if(i=f.Ce.me(n,i),i==e){f.mode=m,f.marker=0;break}if(0==i&&(i=r),1!=i)return i;i=r,f.Ce.reset(n,f.xe),f.mode=12;case 12:return n.Qt=0,1;case m:return e;default:return t}},n.De=(e,n,r)=>{let i=0,s=r;if(!e||!e.ze||6!=e.ze.mode)return t;const o=e.ze;return s<1<<o.Ie||(s=(1<<o.Ie)-1,i=r-s),o.Ce.Se(n,i,s),o.mode=7,0},n.Ee=n=>{let i,o,f,c,l;if(!n||!n.ze)return t;const u=n.ze;if(u.mode!=m&&(u.mode=m,u.marker=0),0===(i=n.Qt))return s;for(o=n.ue,f=u.marker;0!==i&&4>f;)n.be(o)==k[f]?f++:f=0!==n.be(o)?0:4-f,o++,i--;return n.te+=o-n.ue,n.ue=o,n.Qt=i,u.marker=f,4!=f?e:(c=n.te,l=n.ee,r(n),n.te=c,n.ee=l,u.mode=7,0)},n.Me=e=>e&&e.ze&&e.ze.Ce?e.ze.Ce._e():t}function v(){}return v.prototype={Pe:function(t){const e=this;return e.ze=new g,t||(t=15),e.ze.Pe(e,t)},Be:function(e){const n=this;return n.ze?n.ze.Be(n,e):t},Ve:function(){const e=this;if(!e.ze)return t;const n=e.ze.Ve(e);return e.ze=null,n},Ee:function(){const e=this;return e.ze?e.ze.Ee(e):t},De:function(e,n){const r=this;return r.ze?r.ze.De(r,e,n):t},be:function(t){return this.ce[t]},Xt:function(t,e){return this.ce.subarray(t,t+e)}},function(t){const e=new v,o=t&&t.it?n.floor(2*t.it):131072,f=new i(o);let c=!1;e.Pe(),e.fe=f,this.append=(t,n)=>{const l=[];let u,a,w=0,h=0,d=0;if(0!==t.length){e.ue=0,e.ce=t,e.Qt=t.length;do{if(e.ae=0,e.le=o,0!==e.Qt||c||(e.ue=0,c=!0),u=e.Be(0),c&&u===s){if(0!==e.Qt)throw new r("inflating: bad input")}else if(0!==u&&1!==u)throw new r("inflating: "+e.Zt);if((c||1===u)&&e.Qt===t.length)throw new r("inflating: bad input");e.ae&&(e.ae===o?l.push(new i(f)):l.push(f.slice(0,e.ae))),d+=e.ae,n&&e.ue>0&&e.ue!=w&&(n(e.ue),w=e.ue)}while(e.Qt>0||0===e.le);return l.length>1?(a=new i(d),l.forEach((t=>{a.set(t,h),h+=t.length}))):a=l[0]||new i(0),a}},this.flush=()=>{e.Ve()}}})();self.initCodec=()=>{self.Deflate=mt,self.Inflate=kt};\n'],{type:"text/javascript"}));e({workerScripts:{inflate:[t],deflate:[t]}});}};
|
|
4332
4340
|
|
|
4333
4341
|
/*
|
|
4334
4342
|
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
@@ -4529,15 +4537,14 @@
|
|
|
4529
4537
|
*/
|
|
4530
4538
|
|
|
4531
4539
|
class Crc32Stream extends TransformStream {
|
|
4540
|
+
|
|
4532
4541
|
constructor() {
|
|
4533
4542
|
super({
|
|
4534
4543
|
start() {
|
|
4535
4544
|
this.crc32 = new Crc32();
|
|
4536
4545
|
},
|
|
4537
4546
|
transform(chunk) {
|
|
4538
|
-
|
|
4539
|
-
this.crc32.append(chunk);
|
|
4540
|
-
}
|
|
4547
|
+
this.crc32.append(chunk);
|
|
4541
4548
|
},
|
|
4542
4549
|
flush(controller) {
|
|
4543
4550
|
const value = new Uint8Array(4);
|
|
@@ -5453,14 +5460,19 @@
|
|
|
5453
5460
|
const KEY_LENGTH = [16, 24, 32];
|
|
5454
5461
|
const SIGNATURE_LENGTH = 10;
|
|
5455
5462
|
const COUNTER_DEFAULT_VALUE = [0, 0, 0, 0];
|
|
5456
|
-
const
|
|
5457
|
-
const
|
|
5463
|
+
const UNDEFINED_TYPE$1 = "undefined";
|
|
5464
|
+
const FUNCTION_TYPE = "function";
|
|
5465
|
+
const CRYPTO_API_SUPPORTED = typeof crypto != UNDEFINED_TYPE$1;
|
|
5466
|
+
const SUBTLE_API_SUPPORTED = CRYPTO_API_SUPPORTED && typeof crypto.subtle != UNDEFINED_TYPE$1;
|
|
5467
|
+
const GET_RANDOM_VALUES_SUPPORTED = CRYPTO_API_SUPPORTED && typeof crypto.getRandomValues == FUNCTION_TYPE;
|
|
5468
|
+
const IMPORT_KEY_SUPPORTED = CRYPTO_API_SUPPORTED && SUBTLE_API_SUPPORTED && typeof crypto.subtle.importKey == FUNCTION_TYPE;
|
|
5469
|
+
const DERIVE_BITS_SUPPORTED = CRYPTO_API_SUPPORTED && SUBTLE_API_SUPPORTED && typeof crypto.subtle.deriveBits == FUNCTION_TYPE;
|
|
5458
5470
|
const codecBytes = codec.bytes;
|
|
5459
5471
|
const Aes = cipher.aes;
|
|
5460
5472
|
const CtrGladman = mode.ctrGladman;
|
|
5461
5473
|
const HmacSha1 = misc.hmacSha1;
|
|
5462
5474
|
|
|
5463
|
-
class
|
|
5475
|
+
class AESDecryptionStream extends TransformStream {
|
|
5464
5476
|
|
|
5465
5477
|
constructor(password, signed, strength) {
|
|
5466
5478
|
let stream;
|
|
@@ -5475,23 +5487,21 @@
|
|
|
5475
5487
|
});
|
|
5476
5488
|
},
|
|
5477
5489
|
async transform(chunk, controller) {
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
await aesCrypto.ready;
|
|
5491
|
-
}
|
|
5492
|
-
const output = new Uint8Array(chunk.length - SIGNATURE_LENGTH - ((chunk.length - SIGNATURE_LENGTH) % BLOCK_LENGTH));
|
|
5493
|
-
controller.enqueue(append(aesCrypto, chunk, output, 0, SIGNATURE_LENGTH, true));
|
|
5490
|
+
const aesCrypto = this;
|
|
5491
|
+
if (aesCrypto.password) {
|
|
5492
|
+
const password = aesCrypto.password;
|
|
5493
|
+
aesCrypto.password = null;
|
|
5494
|
+
const preamble = subarray(chunk, 0, SALT_LENGTH[aesCrypto.strength] + 2);
|
|
5495
|
+
await createDecryptionKeys(aesCrypto, preamble, password);
|
|
5496
|
+
aesCrypto.ctr = new CtrGladman(new Aes(aesCrypto.keys.key), Array.from(COUNTER_DEFAULT_VALUE));
|
|
5497
|
+
aesCrypto.hmac = new HmacSha1(aesCrypto.keys.authentication);
|
|
5498
|
+
chunk = subarray(chunk, SALT_LENGTH[aesCrypto.strength] + 2);
|
|
5499
|
+
aesCrypto.resolveReady();
|
|
5500
|
+
} else {
|
|
5501
|
+
await aesCrypto.ready;
|
|
5494
5502
|
}
|
|
5503
|
+
const output = new Uint8Array(chunk.length - SIGNATURE_LENGTH - ((chunk.length - SIGNATURE_LENGTH) % BLOCK_LENGTH));
|
|
5504
|
+
controller.enqueue(append(aesCrypto, chunk, output, 0, SIGNATURE_LENGTH, true));
|
|
5495
5505
|
},
|
|
5496
5506
|
async flush(controller) {
|
|
5497
5507
|
const aesCrypto = this;
|
|
@@ -5501,14 +5511,14 @@
|
|
|
5501
5511
|
const originalSignature = subarray(pending, pending.length - SIGNATURE_LENGTH);
|
|
5502
5512
|
let decryptedChunkArray = new Uint8Array(0);
|
|
5503
5513
|
if (chunkToDecrypt.length) {
|
|
5504
|
-
const encryptedChunk =
|
|
5514
|
+
const encryptedChunk = toBits(codecBytes, chunkToDecrypt);
|
|
5505
5515
|
aesCrypto.hmac.update(encryptedChunk);
|
|
5506
|
-
const decryptedChunk = aesCrypto.
|
|
5507
|
-
decryptedChunkArray =
|
|
5516
|
+
const decryptedChunk = aesCrypto.ctr.update(encryptedChunk);
|
|
5517
|
+
decryptedChunkArray = fromBits(codecBytes, decryptedChunk);
|
|
5508
5518
|
}
|
|
5509
5519
|
stream.valid = true;
|
|
5510
5520
|
if (aesCrypto.signed) {
|
|
5511
|
-
const signature = subarray(
|
|
5521
|
+
const signature = subarray(fromBits(codecBytes, aesCrypto.hmac.digest()), 0, SIGNATURE_LENGTH);
|
|
5512
5522
|
for (let indexSignature = 0; indexSignature < SIGNATURE_LENGTH; indexSignature++) {
|
|
5513
5523
|
if (signature[indexSignature] != originalSignature[indexSignature]) {
|
|
5514
5524
|
stream.valid = false;
|
|
@@ -5522,7 +5532,7 @@
|
|
|
5522
5532
|
}
|
|
5523
5533
|
}
|
|
5524
5534
|
|
|
5525
|
-
class
|
|
5535
|
+
class AESEncryptionStream extends TransformStream {
|
|
5526
5536
|
|
|
5527
5537
|
constructor(password, strength) {
|
|
5528
5538
|
let stream;
|
|
@@ -5536,34 +5546,32 @@
|
|
|
5536
5546
|
});
|
|
5537
5547
|
},
|
|
5538
5548
|
async transform(chunk, controller) {
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
await aesCrypto.ready;
|
|
5551
|
-
}
|
|
5552
|
-
const output = new Uint8Array(preamble.length + chunk.length - (chunk.length % BLOCK_LENGTH));
|
|
5553
|
-
output.set(preamble, 0);
|
|
5554
|
-
controller.enqueue(append(aesCrypto, chunk, output, preamble.length, 0));
|
|
5549
|
+
const aesCrypto = this;
|
|
5550
|
+
let preamble = new Uint8Array(0);
|
|
5551
|
+
if (aesCrypto.password) {
|
|
5552
|
+
const password = aesCrypto.password;
|
|
5553
|
+
aesCrypto.password = null;
|
|
5554
|
+
preamble = await createEncryptionKeys(aesCrypto, password);
|
|
5555
|
+
aesCrypto.ctr = new CtrGladman(new Aes(aesCrypto.keys.key), Array.from(COUNTER_DEFAULT_VALUE));
|
|
5556
|
+
aesCrypto.hmac = new HmacSha1(aesCrypto.keys.authentication);
|
|
5557
|
+
aesCrypto.resolveReady();
|
|
5558
|
+
} else {
|
|
5559
|
+
await aesCrypto.ready;
|
|
5555
5560
|
}
|
|
5561
|
+
const output = new Uint8Array(preamble.length + chunk.length - (chunk.length % BLOCK_LENGTH));
|
|
5562
|
+
output.set(preamble, 0);
|
|
5563
|
+
controller.enqueue(append(aesCrypto, chunk, output, preamble.length, 0));
|
|
5556
5564
|
},
|
|
5557
5565
|
async flush(controller) {
|
|
5558
5566
|
const aesCrypto = this;
|
|
5559
5567
|
await aesCrypto.ready;
|
|
5560
5568
|
let encryptedChunkArray = new Uint8Array(0);
|
|
5561
5569
|
if (aesCrypto.pending.length) {
|
|
5562
|
-
const encryptedChunk = aesCrypto.
|
|
5570
|
+
const encryptedChunk = aesCrypto.ctr.update(toBits(codecBytes, aesCrypto.pending));
|
|
5563
5571
|
aesCrypto.hmac.update(encryptedChunk);
|
|
5564
|
-
encryptedChunkArray =
|
|
5572
|
+
encryptedChunkArray = fromBits(codecBytes, encryptedChunk);
|
|
5565
5573
|
}
|
|
5566
|
-
stream.signature =
|
|
5574
|
+
stream.signature = fromBits(codecBytes, aesCrypto.hmac.digest()).slice(0, SIGNATURE_LENGTH);
|
|
5567
5575
|
controller.enqueue(concat(encryptedChunkArray, stream.signature));
|
|
5568
5576
|
}
|
|
5569
5577
|
});
|
|
@@ -5579,15 +5587,15 @@
|
|
|
5579
5587
|
}
|
|
5580
5588
|
let offset;
|
|
5581
5589
|
for (offset = 0; offset <= inputLength - BLOCK_LENGTH; offset += BLOCK_LENGTH) {
|
|
5582
|
-
const inputChunk =
|
|
5590
|
+
const inputChunk = toBits(codecBytes, subarray(input, offset, offset + BLOCK_LENGTH));
|
|
5583
5591
|
if (verifySignature) {
|
|
5584
5592
|
aesCrypto.hmac.update(inputChunk);
|
|
5585
5593
|
}
|
|
5586
|
-
const outputChunk = aesCrypto.
|
|
5594
|
+
const outputChunk = aesCrypto.ctr.update(inputChunk);
|
|
5587
5595
|
if (!verifySignature) {
|
|
5588
5596
|
aesCrypto.hmac.update(outputChunk);
|
|
5589
5597
|
}
|
|
5590
|
-
output.set(
|
|
5598
|
+
output.set(fromBits(codecBytes, outputChunk), offset + paddingStart);
|
|
5591
5599
|
}
|
|
5592
5600
|
aesCrypto.pending = subarray(input, offset);
|
|
5593
5601
|
return output;
|
|
@@ -5614,14 +5622,14 @@
|
|
|
5614
5622
|
const derivedBits = await deriveBits(Object.assign({ salt }, DERIVED_BITS_ALGORITHM), basekey, 8 * ((KEY_LENGTH[target.strength] * 2) + 2));
|
|
5615
5623
|
const compositeKey = new Uint8Array(derivedBits);
|
|
5616
5624
|
target.keys = {
|
|
5617
|
-
key:
|
|
5618
|
-
authentication:
|
|
5625
|
+
key: toBits(codecBytes, subarray(compositeKey, 0, KEY_LENGTH[target.strength])),
|
|
5626
|
+
authentication: toBits(codecBytes, subarray(compositeKey, KEY_LENGTH[target.strength], KEY_LENGTH[target.strength] * 2)),
|
|
5619
5627
|
passwordVerification: subarray(compositeKey, KEY_LENGTH[target.strength] * 2)
|
|
5620
5628
|
};
|
|
5621
5629
|
}
|
|
5622
5630
|
|
|
5623
5631
|
function getRandomValues(array) {
|
|
5624
|
-
if (
|
|
5632
|
+
if (GET_RANDOM_VALUES_SUPPORTED) {
|
|
5625
5633
|
return crypto.getRandomValues(array);
|
|
5626
5634
|
} else {
|
|
5627
5635
|
return random.getRandomValues(array);
|
|
@@ -5629,7 +5637,7 @@
|
|
|
5629
5637
|
}
|
|
5630
5638
|
|
|
5631
5639
|
function importKey(format, password, algorithm, extractable, keyUsages) {
|
|
5632
|
-
if (
|
|
5640
|
+
if (IMPORT_KEY_SUPPORTED) {
|
|
5633
5641
|
return crypto.subtle.importKey(format, password, algorithm, extractable, keyUsages);
|
|
5634
5642
|
} else {
|
|
5635
5643
|
return misc.importKey(password);
|
|
@@ -5637,7 +5645,7 @@
|
|
|
5637
5645
|
}
|
|
5638
5646
|
|
|
5639
5647
|
async function deriveBits(algorithm, baseKey, length) {
|
|
5640
|
-
if (
|
|
5648
|
+
if (DERIVE_BITS_SUPPORTED) {
|
|
5641
5649
|
return await crypto.subtle.deriveBits(algorithm, baseKey, length);
|
|
5642
5650
|
} else {
|
|
5643
5651
|
return misc.pbkdf2(baseKey, algorithm.salt, DERIVED_BITS_ALGORITHM.iterations, length);
|
|
@@ -5667,6 +5675,13 @@
|
|
|
5667
5675
|
return array.subarray(begin, end);
|
|
5668
5676
|
}
|
|
5669
5677
|
|
|
5678
|
+
function fromBits(codecBytes, chunk) {
|
|
5679
|
+
return codecBytes.fromBits(chunk);
|
|
5680
|
+
}
|
|
5681
|
+
function toBits(codecBytes, chunk) {
|
|
5682
|
+
return codecBytes.toBits(chunk);
|
|
5683
|
+
}
|
|
5684
|
+
|
|
5670
5685
|
/*
|
|
5671
5686
|
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
5672
5687
|
|
|
@@ -5697,7 +5712,7 @@
|
|
|
5697
5712
|
|
|
5698
5713
|
const HEADER_LENGTH = 12;
|
|
5699
5714
|
|
|
5700
|
-
class
|
|
5715
|
+
class ZipCryptoDecryptionStream extends TransformStream {
|
|
5701
5716
|
|
|
5702
5717
|
constructor(password, passwordVerification) {
|
|
5703
5718
|
let stream;
|
|
@@ -5710,18 +5725,16 @@
|
|
|
5710
5725
|
createKeys(this, password);
|
|
5711
5726
|
},
|
|
5712
5727
|
transform(chunk, controller) {
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
throw new Error(ERR_INVALID_PASSWORD);
|
|
5720
|
-
}
|
|
5721
|
-
chunk = chunk.subarray(HEADER_LENGTH);
|
|
5728
|
+
const zipCrypto = this;
|
|
5729
|
+
if (zipCrypto.password) {
|
|
5730
|
+
const decryptedHeader = decrypt(zipCrypto, chunk.subarray(0, HEADER_LENGTH));
|
|
5731
|
+
zipCrypto.password = null;
|
|
5732
|
+
if (decryptedHeader[HEADER_LENGTH - 1] != zipCrypto.passwordVerification) {
|
|
5733
|
+
throw new Error(ERR_INVALID_PASSWORD);
|
|
5722
5734
|
}
|
|
5723
|
-
|
|
5735
|
+
chunk = chunk.subarray(HEADER_LENGTH);
|
|
5724
5736
|
}
|
|
5737
|
+
controller.enqueue(decrypt(zipCrypto, chunk));
|
|
5725
5738
|
},
|
|
5726
5739
|
flush() {
|
|
5727
5740
|
stream.valid = true;
|
|
@@ -5731,7 +5744,7 @@
|
|
|
5731
5744
|
}
|
|
5732
5745
|
}
|
|
5733
5746
|
|
|
5734
|
-
class
|
|
5747
|
+
class ZipCryptoEncryptionStream extends TransformStream {
|
|
5735
5748
|
|
|
5736
5749
|
constructor(password, passwordVerification) {
|
|
5737
5750
|
super({
|
|
@@ -5743,24 +5756,22 @@
|
|
|
5743
5756
|
createKeys(this, password);
|
|
5744
5757
|
},
|
|
5745
5758
|
transform(chunk, controller) {
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
offset = 0;
|
|
5760
|
-
}
|
|
5761
|
-
output.set(encrypt(zipCrypto, chunk), offset);
|
|
5762
|
-
controller.enqueue(output);
|
|
5759
|
+
const zipCrypto = this;
|
|
5760
|
+
let output;
|
|
5761
|
+
let offset;
|
|
5762
|
+
if (zipCrypto.password) {
|
|
5763
|
+
zipCrypto.password = null;
|
|
5764
|
+
const header = crypto.getRandomValues(new Uint8Array(HEADER_LENGTH));
|
|
5765
|
+
header[HEADER_LENGTH - 1] = zipCrypto.passwordVerification;
|
|
5766
|
+
output = new Uint8Array(chunk.length + header.length);
|
|
5767
|
+
output.set(encrypt(zipCrypto, header), 0);
|
|
5768
|
+
offset = HEADER_LENGTH;
|
|
5769
|
+
} else {
|
|
5770
|
+
output = new Uint8Array(chunk.length);
|
|
5771
|
+
offset = 0;
|
|
5763
5772
|
}
|
|
5773
|
+
output.set(encrypt(zipCrypto, chunk), offset);
|
|
5774
|
+
controller.enqueue(output);
|
|
5764
5775
|
},
|
|
5765
5776
|
flush() {
|
|
5766
5777
|
}
|
|
@@ -5855,19 +5866,19 @@
|
|
|
5855
5866
|
/* global TransformStream */
|
|
5856
5867
|
|
|
5857
5868
|
class CodecStream extends TransformStream {
|
|
5869
|
+
|
|
5858
5870
|
constructor(Codec, options) {
|
|
5871
|
+
let codec;
|
|
5859
5872
|
super({
|
|
5860
5873
|
start() {
|
|
5861
|
-
|
|
5874
|
+
codec = new Codec(options);
|
|
5862
5875
|
},
|
|
5863
5876
|
transform(chunk, controller) {
|
|
5864
|
-
chunk =
|
|
5865
|
-
|
|
5866
|
-
controller.enqueue(chunk);
|
|
5867
|
-
}
|
|
5877
|
+
chunk = codec.append(chunk);
|
|
5878
|
+
controller.enqueue(chunk);
|
|
5868
5879
|
},
|
|
5869
5880
|
flush(controller) {
|
|
5870
|
-
const chunk =
|
|
5881
|
+
const chunk = codec.flush();
|
|
5871
5882
|
if (chunk) {
|
|
5872
5883
|
controller.enqueue(chunk);
|
|
5873
5884
|
}
|
|
@@ -5904,199 +5915,205 @@
|
|
|
5904
5915
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
5905
5916
|
*/
|
|
5906
5917
|
|
|
5907
|
-
const CODEC_DEFLATE = "deflate";
|
|
5908
|
-
const CODEC_INFLATE = "inflate";
|
|
5909
5918
|
const ERR_INVALID_SIGNATURE = "Invalid signature";
|
|
5910
|
-
const
|
|
5911
|
-
const
|
|
5912
|
-
const
|
|
5913
|
-
const
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
signed
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
controller.enqueue(value);
|
|
5941
|
-
if (done || codec.aborted) {
|
|
5942
|
-
controller.close();
|
|
5943
|
-
}
|
|
5944
|
-
}
|
|
5945
|
-
})
|
|
5946
|
-
});
|
|
5947
|
-
if (encrypted) {
|
|
5948
|
-
if (zipCrypto) {
|
|
5949
|
-
codec.stream = codec.stream.pipeThrough(new ZipCryptoDecryptStream(password, passwordVerification));
|
|
5950
|
-
} else {
|
|
5951
|
-
codec.decryptStream = new AESDecryptStream(password, signed, encryptionStrength);
|
|
5952
|
-
codec.stream = codec.stream.pipeThrough(codec.decryptStream);
|
|
5919
|
+
const COMPRESSION_FORMAT = "deflate-raw";
|
|
5920
|
+
const UNDEFINED_TYPE = "undefined";
|
|
5921
|
+
const COMPRESSION_STREAM_API_SUPPORTED = typeof CompressionStream == UNDEFINED_TYPE;
|
|
5922
|
+
const DECOMPRESSION_STREAM_API_SUPPORTED = typeof DecompressionStream == UNDEFINED_TYPE;
|
|
5923
|
+
let INFLATE_RAW_SUPPORTED = true;
|
|
5924
|
+
let DEFLATE_RAW_SUPPORTED = true;
|
|
5925
|
+
|
|
5926
|
+
class DeflateStream extends TransformStream {
|
|
5927
|
+
|
|
5928
|
+
constructor(codecConstructor, options, { chunkSize }, ...strategies) {
|
|
5929
|
+
super({}, ...strategies);
|
|
5930
|
+
const { compressed, useCompressionStream, password, passwordVerification, encryptionStrength, zipCrypto, signed } = options;
|
|
5931
|
+
const stream = this;
|
|
5932
|
+
let crc32Stream, encryptionStream;
|
|
5933
|
+
let readable = filterEmptyChunks(super.readable);
|
|
5934
|
+
const encrypted = Boolean(password);
|
|
5935
|
+
if ((!encrypted || zipCrypto) && signed) {
|
|
5936
|
+
[readable, crc32Stream] = readable.tee();
|
|
5937
|
+
crc32Stream = crc32Stream.pipeThrough(new Crc32Stream());
|
|
5938
|
+
}
|
|
5939
|
+
if (compressed) {
|
|
5940
|
+
if ((useCompressionStream !== undefined && !useCompressionStream) || (COMPRESSION_STREAM_API_SUPPORTED && !DEFLATE_RAW_SUPPORTED)) {
|
|
5941
|
+
readable = pipeCodecStream(codecConstructor, readable, chunkSize);
|
|
5942
|
+
} else {
|
|
5943
|
+
try {
|
|
5944
|
+
const compressionStream = new CompressionStream(COMPRESSION_FORMAT);
|
|
5945
|
+
readable = readable.pipeThrough(compressionStream);
|
|
5946
|
+
} catch (_error) {
|
|
5947
|
+
DEFLATE_RAW_SUPPORTED = false;
|
|
5948
|
+
readable = pipeCodecStream(codecConstructor, readable, chunkSize);
|
|
5953
5949
|
}
|
|
5954
5950
|
}
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5951
|
+
}
|
|
5952
|
+
if (encrypted) {
|
|
5953
|
+
if (zipCrypto) {
|
|
5954
|
+
readable = readable.pipeThrough(new ZipCryptoEncryptionStream(password, passwordVerification));
|
|
5955
|
+
} else {
|
|
5956
|
+
encryptionStream = new AESEncryptionStream(password, encryptionStrength);
|
|
5957
|
+
readable = readable.pipeThrough(encryptionStream);
|
|
5958
|
+
}
|
|
5959
|
+
}
|
|
5960
|
+
setReadable(stream, readable, async () => {
|
|
5961
|
+
let signature;
|
|
5962
|
+
if (encrypted && !zipCrypto) {
|
|
5963
|
+
signature = encryptionStream.signature;
|
|
5965
5964
|
}
|
|
5966
5965
|
if ((!encrypted || zipCrypto) && signed) {
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
codec.crc32Stream = tee[1].pipeThrough(new Crc32Stream());
|
|
5966
|
+
signature = await crc32Stream.getReader().read();
|
|
5967
|
+
signature = new DataView(signature.value.buffer).getUint32(0);
|
|
5970
5968
|
}
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
};
|
|
5974
|
-
codec.abort = () => codec.aborted = true;
|
|
5975
|
-
|
|
5976
|
-
function pipeCodecStream() {
|
|
5977
|
-
codec.stream = codec.stream.pipeThrough(new CodecStream(codecConstructor, { chunkSize }));
|
|
5978
|
-
}
|
|
5969
|
+
stream.signature = signature;
|
|
5970
|
+
});
|
|
5979
5971
|
}
|
|
5972
|
+
}
|
|
5973
|
+
|
|
5974
|
+
class InflateStream extends TransformStream {
|
|
5980
5975
|
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
const {
|
|
5984
|
-
|
|
5985
|
-
|
|
5976
|
+
constructor(codecConstructor, options, { chunkSize }, ...strategies) {
|
|
5977
|
+
super({}, ...strategies);
|
|
5978
|
+
const { zipCrypto, password, passwordVerification, signed, encryptionStrength, compressed, useCompressionStream } = options;
|
|
5979
|
+
const stream = this;
|
|
5980
|
+
let crc32Stream, decryptionStream;
|
|
5981
|
+
let readable = filterEmptyChunks(super.readable);
|
|
5982
|
+
const encrypted = Boolean(password);
|
|
5983
|
+
if (encrypted) {
|
|
5984
|
+
if (zipCrypto) {
|
|
5985
|
+
readable = readable.pipeThrough(new ZipCryptoDecryptionStream(password, passwordVerification));
|
|
5986
|
+
} else {
|
|
5987
|
+
decryptionStream = new AESDecryptionStream(password, signed, encryptionStrength);
|
|
5988
|
+
readable = readable.pipeThrough(decryptionStream);
|
|
5989
|
+
}
|
|
5986
5990
|
}
|
|
5987
|
-
if (
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
+
if (compressed) {
|
|
5992
|
+
if ((useCompressionStream !== undefined && !useCompressionStream) || (DECOMPRESSION_STREAM_API_SUPPORTED && !INFLATE_RAW_SUPPORTED)) {
|
|
5993
|
+
readable = pipeCodecStream(codecConstructor, readable, chunkSize);
|
|
5994
|
+
} else {
|
|
5995
|
+
try {
|
|
5996
|
+
readable = readable.pipeThrough(new DecompressionStream(COMPRESSION_FORMAT));
|
|
5997
|
+
} catch (_error) {
|
|
5998
|
+
INFLATE_RAW_SUPPORTED = false;
|
|
5999
|
+
readable = pipeCodecStream(codecConstructor, readable, chunkSize);
|
|
6000
|
+
}
|
|
6001
|
+
}
|
|
6002
|
+
}
|
|
6003
|
+
if ((!encrypted || zipCrypto) && signed) {
|
|
6004
|
+
[readable, crc32Stream] = readable.tee();
|
|
6005
|
+
crc32Stream = crc32Stream.pipeThrough(new Crc32Stream());
|
|
6006
|
+
}
|
|
6007
|
+
setReadable(stream, readable, async () => {
|
|
6008
|
+
if (encrypted && !zipCrypto) {
|
|
6009
|
+
if (!decryptionStream.valid) {
|
|
5991
6010
|
throw new Error(ERR_INVALID_SIGNATURE);
|
|
5992
6011
|
}
|
|
5993
6012
|
}
|
|
5994
|
-
if ((!
|
|
5995
|
-
signature = await
|
|
6013
|
+
if ((!encrypted || zipCrypto) && signed) {
|
|
6014
|
+
const signature = await crc32Stream.getReader().read();
|
|
5996
6015
|
const dataViewSignature = new DataView(signature.value.buffer);
|
|
5997
|
-
if (
|
|
6016
|
+
if (signature != dataViewSignature.getUint32(0, false)) {
|
|
5998
6017
|
throw new Error(ERR_INVALID_SIGNATURE);
|
|
5999
6018
|
}
|
|
6000
6019
|
}
|
|
6001
|
-
|
|
6002
|
-
} else {
|
|
6003
|
-
await codec.read();
|
|
6004
|
-
}
|
|
6020
|
+
});
|
|
6005
6021
|
}
|
|
6006
6022
|
}
|
|
6007
6023
|
|
|
6008
|
-
|
|
6024
|
+
function pipeCodecStream(codecConstructor, stream, chunkSize) {
|
|
6025
|
+
return stream.pipeThrough(new CodecStream(codecConstructor, { chunkSize }));
|
|
6026
|
+
}
|
|
6009
6027
|
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
zipCrypto,
|
|
6016
|
-
password,
|
|
6017
|
-
passwordVerification,
|
|
6018
|
-
encryptionStrength,
|
|
6019
|
-
useCompressionStream
|
|
6020
|
-
}, { chunkSize }) {
|
|
6021
|
-
const codec = this;
|
|
6022
|
-
codec.start = async () => {
|
|
6023
|
-
Object.assign(this, {
|
|
6024
|
-
encrypted,
|
|
6025
|
-
signed,
|
|
6026
|
-
compressed,
|
|
6027
|
-
zipCrypto,
|
|
6028
|
-
stream: new ReadableStream({
|
|
6029
|
-
async pull(controller) {
|
|
6030
|
-
const { value, done } = await codec.pull();
|
|
6031
|
-
controller.enqueue(value);
|
|
6032
|
-
if (done || codec.aborted) {
|
|
6033
|
-
controller.close();
|
|
6034
|
-
}
|
|
6035
|
-
}
|
|
6036
|
-
})
|
|
6037
|
-
});
|
|
6038
|
-
if ((!encrypted || zipCrypto) && signed) {
|
|
6039
|
-
const tee = codec.stream.tee();
|
|
6040
|
-
codec.stream = tee[0];
|
|
6041
|
-
codec.crc32Stream = tee[1].pipeThrough(new Crc32Stream({ chunkSize }));
|
|
6042
|
-
}
|
|
6043
|
-
if (compressed) {
|
|
6044
|
-
if ((useCompressionStream !== undefined && !useCompressionStream) || typeof CompressionStream == "undefined") {
|
|
6045
|
-
pipeCodecStream();
|
|
6046
|
-
} else {
|
|
6047
|
-
try {
|
|
6048
|
-
codec.stream = codec.stream.pipeThrough(new CompressionStream("deflate-raw"));
|
|
6049
|
-
} catch (_error) {
|
|
6050
|
-
pipeCodecStream();
|
|
6051
|
-
}
|
|
6052
|
-
}
|
|
6028
|
+
function filterEmptyChunks(readable) {
|
|
6029
|
+
return readable.pipeThrough(new TransformStream({
|
|
6030
|
+
transform(chunk, controller) {
|
|
6031
|
+
if (chunk && chunk.length) {
|
|
6032
|
+
controller.enqueue(chunk);
|
|
6053
6033
|
}
|
|
6054
|
-
if (encrypted) {
|
|
6055
|
-
if (zipCrypto) {
|
|
6056
|
-
codec.stream = codec.stream.pipeThrough(new ZipCryptoEncryptStream(password, passwordVerification));
|
|
6057
|
-
} else {
|
|
6058
|
-
codec.encryptStream = new AESEncryptStream(password, encryptionStrength);
|
|
6059
|
-
codec.stream = codec.stream.pipeThrough(codec.encryptStream);
|
|
6060
|
-
}
|
|
6061
|
-
}
|
|
6062
|
-
codec.reader = codec.stream.getReader();
|
|
6063
|
-
await codec.read();
|
|
6064
|
-
};
|
|
6065
|
-
codec.abort = () => codec.aborted = true;
|
|
6066
|
-
|
|
6067
|
-
function pipeCodecStream() {
|
|
6068
|
-
codec.stream = codec.stream.pipeThrough(new CodecStream(codecConstructor, { chunkSize, level }));
|
|
6069
6034
|
}
|
|
6070
|
-
}
|
|
6035
|
+
}));
|
|
6036
|
+
}
|
|
6071
6037
|
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
let signature;
|
|
6080
|
-
if (codec.encrypted && !codec.zipCrypto) {
|
|
6081
|
-
signature = codec.encryptStream.signature;
|
|
6082
|
-
}
|
|
6083
|
-
if ((!codec.encrypted || codec.zipCrypto) && codec.signed) {
|
|
6084
|
-
signature = await codec.crc32Stream.getReader().read();
|
|
6085
|
-
signature = new DataView(signature.value.buffer).getUint32(0);
|
|
6038
|
+
function setReadable(stream, readable, flush) {
|
|
6039
|
+
stream.length = 0;
|
|
6040
|
+
readable = readable.pipeThrough(new TransformStream({
|
|
6041
|
+
transform(chunk, controller) {
|
|
6042
|
+
if (chunk && chunk.length) {
|
|
6043
|
+
stream.length += chunk.length;
|
|
6044
|
+
controller.enqueue(chunk);
|
|
6086
6045
|
}
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6046
|
+
}, flush
|
|
6047
|
+
}));
|
|
6048
|
+
Object.defineProperty(stream, "readable", {
|
|
6049
|
+
get() {
|
|
6050
|
+
return readable;
|
|
6090
6051
|
}
|
|
6091
|
-
}
|
|
6092
|
-
|
|
6052
|
+
});
|
|
6093
6053
|
}
|
|
6094
6054
|
|
|
6095
|
-
|
|
6055
|
+
/*
|
|
6056
|
+
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
6057
|
+
|
|
6058
|
+
Redistribution and use in source and binary forms, with or without
|
|
6059
|
+
modification, are permitted provided that the following conditions are met:
|
|
6060
|
+
|
|
6061
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
6062
|
+
this list of conditions and the following disclaimer.
|
|
6063
|
+
|
|
6064
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
6065
|
+
notice, this list of conditions and the following disclaimer in
|
|
6066
|
+
the documentation and/or other materials provided with the distribution.
|
|
6067
|
+
|
|
6068
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
6069
|
+
derived from this software without specific prior written permission.
|
|
6070
|
+
|
|
6071
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
6072
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
6073
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
6074
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
6075
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
6076
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
6077
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
6078
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
6079
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
6080
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
6081
|
+
*/
|
|
6082
|
+
|
|
6083
|
+
const CODEC_DEFLATE = "deflate";
|
|
6084
|
+
const CODEC_INFLATE = "inflate";
|
|
6085
|
+
const MESSAGE_EVENT_TYPE = "message";
|
|
6086
|
+
const MESSAGE_START = "start";
|
|
6087
|
+
const MESSAGE_PULL = "pull";
|
|
6088
|
+
const MESSAGE_DATA = "data";
|
|
6089
|
+
const MESSAGE_ABORT = "abort";
|
|
6090
|
+
const MESSAGE_CLOSE = "close";
|
|
6091
|
+
const ERR_ABORT = "AbortError";
|
|
6092
|
+
|
|
6093
|
+
function createCodec(codecConstructor, readable, writable, options, config) {
|
|
6094
|
+
const controller = new AbortController();
|
|
6095
|
+
const { signal } = controller;
|
|
6096
6096
|
if (options.codecType.startsWith(CODEC_DEFLATE)) {
|
|
6097
|
-
return
|
|
6097
|
+
return {
|
|
6098
|
+
run: () => run(DeflateStream),
|
|
6099
|
+
abort
|
|
6100
|
+
};
|
|
6098
6101
|
} else if (options.codecType.startsWith(CODEC_INFLATE)) {
|
|
6099
|
-
return
|
|
6102
|
+
return {
|
|
6103
|
+
run: () => run(InflateStream),
|
|
6104
|
+
abort
|
|
6105
|
+
};
|
|
6106
|
+
}
|
|
6107
|
+
|
|
6108
|
+
async function run(StreamConstructor) {
|
|
6109
|
+
const stream = new StreamConstructor(codecConstructor, options, config);
|
|
6110
|
+
await readable.pipeThrough(stream, { signal }).pipeTo(writable);
|
|
6111
|
+
const { length, signature } = stream;
|
|
6112
|
+
return { length, signature };
|
|
6113
|
+
}
|
|
6114
|
+
|
|
6115
|
+
function abort() {
|
|
6116
|
+
controller.abort();
|
|
6100
6117
|
}
|
|
6101
6118
|
}
|
|
6102
6119
|
|
|
@@ -6130,10 +6147,12 @@
|
|
|
6130
6147
|
|
|
6131
6148
|
let classicWorkersSupported = true;
|
|
6132
6149
|
|
|
6133
|
-
function getWorker(workerData, codecConstructor, options, config, onTaskFinished, webWorker, scripts) {
|
|
6150
|
+
function getWorker(workerData, codecConstructor, readable, writable, options, config, streamOptions, onTaskFinished, webWorker, scripts) {
|
|
6134
6151
|
Object.assign(workerData, {
|
|
6135
6152
|
busy: true,
|
|
6136
6153
|
codecConstructor,
|
|
6154
|
+
readable,
|
|
6155
|
+
writable,
|
|
6137
6156
|
options: Object.assign({}, options),
|
|
6138
6157
|
scripts,
|
|
6139
6158
|
terminate() {
|
|
@@ -6147,27 +6166,50 @@
|
|
|
6147
6166
|
onTaskFinished(workerData);
|
|
6148
6167
|
}
|
|
6149
6168
|
});
|
|
6169
|
+
const { signal, onprogress, size } = streamOptions;
|
|
6170
|
+
if (signal || onprogress) {
|
|
6171
|
+
let chunkOffset = 0;
|
|
6172
|
+
const transformer = {};
|
|
6173
|
+
if (onprogress) {
|
|
6174
|
+
transformer.transform = (chunk, controller) => {
|
|
6175
|
+
chunkOffset += chunk.length;
|
|
6176
|
+
try {
|
|
6177
|
+
onprogress(chunkOffset, size());
|
|
6178
|
+
} catch (_error) {
|
|
6179
|
+
// ignored
|
|
6180
|
+
}
|
|
6181
|
+
controller.enqueue(chunk);
|
|
6182
|
+
};
|
|
6183
|
+
}
|
|
6184
|
+
workerData.readable = readable.pipeThrough(new TransformStream(transformer), { signal });
|
|
6185
|
+
}
|
|
6150
6186
|
return webWorker ? createWebWorkerInterface(workerData, config) : createWorkerInterface(workerData, config);
|
|
6151
6187
|
}
|
|
6152
6188
|
|
|
6153
6189
|
function createWorkerInterface(workerData, config) {
|
|
6154
|
-
const interfaceCodec = createCodec
|
|
6190
|
+
const interfaceCodec = createCodec(workerData.codecConstructor, workerData.readable, workerData.writable, workerData.options, config);
|
|
6155
6191
|
const codec = {
|
|
6156
6192
|
abort() {
|
|
6157
6193
|
interfaceCodec.abort();
|
|
6158
6194
|
workerData.onTaskFinished();
|
|
6159
6195
|
},
|
|
6160
|
-
|
|
6161
|
-
|
|
6196
|
+
run() {
|
|
6197
|
+
const result = interfaceCodec.run();
|
|
6198
|
+
workerData.onTaskFinished();
|
|
6199
|
+
return result;
|
|
6162
6200
|
}
|
|
6163
6201
|
};
|
|
6164
|
-
interfaceCodec.pull = () => codec.pull();
|
|
6165
|
-
interfaceCodec.ondata = data => ondata(workerData, codec, data);
|
|
6166
6202
|
return codec;
|
|
6167
6203
|
}
|
|
6168
6204
|
|
|
6169
6205
|
function createWebWorkerInterface(workerData, { baseURL, chunkSize }) {
|
|
6170
6206
|
const workerOptions = { type: "module" };
|
|
6207
|
+
workerData.reader = workerData.readable.getReader();
|
|
6208
|
+
workerData.writer = workerData.writable.getWriter();
|
|
6209
|
+
workerData.result = new Promise((resolve, reject) => {
|
|
6210
|
+
workerData.resolveResult = resolve;
|
|
6211
|
+
workerData.rejectResult = reject;
|
|
6212
|
+
});
|
|
6171
6213
|
if (!workerData.interface) {
|
|
6172
6214
|
if (!classicWorkersSupported) {
|
|
6173
6215
|
workerData.worker = getWorker(workerOptions);
|
|
@@ -6185,10 +6227,11 @@
|
|
|
6185
6227
|
sendMessage({ type: MESSAGE_ABORT });
|
|
6186
6228
|
workerData.onTaskFinished();
|
|
6187
6229
|
},
|
|
6188
|
-
|
|
6230
|
+
run() {
|
|
6189
6231
|
const options = workerData.options;
|
|
6190
6232
|
const scripts = workerData.scripts.slice(1);
|
|
6191
6233
|
sendMessage({ type: MESSAGE_START, scripts, options, config: { chunkSize } });
|
|
6234
|
+
return workerData.result;
|
|
6192
6235
|
}
|
|
6193
6236
|
};
|
|
6194
6237
|
}
|
|
@@ -6230,43 +6273,35 @@
|
|
|
6230
6273
|
async function onMessage(event) {
|
|
6231
6274
|
const message = event.data;
|
|
6232
6275
|
const reponseError = message.error;
|
|
6233
|
-
const codec = workerData.interface;
|
|
6234
6276
|
try {
|
|
6235
6277
|
if (reponseError) {
|
|
6236
6278
|
const error = new Error(reponseError.message);
|
|
6237
6279
|
error.stack = reponseError.stack;
|
|
6238
|
-
|
|
6280
|
+
workerData.rejectResult(error);
|
|
6239
6281
|
workerData.onTaskFinished();
|
|
6240
6282
|
} else {
|
|
6241
6283
|
if (message.type == MESSAGE_PULL) {
|
|
6242
|
-
const { value, done } = await
|
|
6284
|
+
const { value, done } = await workerData.reader.read();
|
|
6243
6285
|
sendMessage({ type: MESSAGE_DATA, data: value, done, messageId: message.messageId });
|
|
6244
6286
|
}
|
|
6245
6287
|
if (message.type == MESSAGE_DATA) {
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6288
|
+
let { data } = message;
|
|
6289
|
+
data = new Uint8Array(data);
|
|
6290
|
+
await workerData.writer.ready;
|
|
6291
|
+
workerData.writer.write(data);
|
|
6292
|
+
}
|
|
6293
|
+
if (message.type == MESSAGE_CLOSE) {
|
|
6294
|
+
workerData.resolveResult(message.result);
|
|
6295
|
+
workerData.onTaskFinished();
|
|
6251
6296
|
}
|
|
6252
6297
|
}
|
|
6253
6298
|
} catch (error) {
|
|
6254
|
-
|
|
6299
|
+
workerData.rejectResult(error);
|
|
6255
6300
|
workerData.onTaskFinished();
|
|
6256
6301
|
}
|
|
6257
6302
|
}
|
|
6258
6303
|
}
|
|
6259
6304
|
|
|
6260
|
-
async function ondata(workerData, codec, data) {
|
|
6261
|
-
let { value, done } = data;
|
|
6262
|
-
if (done) {
|
|
6263
|
-
await codec.ondata({ value: { data: value.data, signature: value.signature }, done });
|
|
6264
|
-
workerData.onTaskFinished();
|
|
6265
|
-
} else if (value.data) {
|
|
6266
|
-
await codec.ondata({ value: { data: value.data } });
|
|
6267
|
-
}
|
|
6268
|
-
}
|
|
6269
|
-
|
|
6270
6305
|
/*
|
|
6271
6306
|
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
6272
6307
|
|
|
@@ -6300,30 +6335,42 @@
|
|
|
6300
6335
|
|
|
6301
6336
|
let indexWorker = 0;
|
|
6302
6337
|
|
|
6303
|
-
function
|
|
6338
|
+
async function runCodec(codecConstructor, readable, writable, options, config, streamOptions) {
|
|
6304
6339
|
const streamCopy = !options.compressed && !options.signed && !options.encrypted;
|
|
6305
6340
|
const webWorker = !streamCopy && (options.useWebWorkers || (options.useWebWorkers === undefined && config.useWebWorkers));
|
|
6306
6341
|
const scripts = webWorker && config.workerScripts ? config.workerScripts[options.codecType] : [];
|
|
6307
6342
|
options.useCompressionStream = options.useCompressionStream === undefined ? config.useCompressionStream : options.useCompressionStream;
|
|
6343
|
+
let codec;
|
|
6308
6344
|
if (pool.length < config.maxWorkers) {
|
|
6309
6345
|
const workerData = { indexWorker };
|
|
6310
6346
|
indexWorker++;
|
|
6311
6347
|
pool.push(workerData);
|
|
6312
|
-
|
|
6348
|
+
codec = getWorker(workerData, codecConstructor, readable, writable, options, config, streamOptions, onTaskFinished, webWorker, scripts);
|
|
6313
6349
|
} else {
|
|
6314
6350
|
const workerData = pool.find(workerData => !workerData.busy);
|
|
6315
6351
|
if (workerData) {
|
|
6316
6352
|
clearTerminateTimeout(workerData);
|
|
6317
|
-
|
|
6353
|
+
codec = getWorker(workerData, codecConstructor, readable, writable, options, config, streamOptions, onTaskFinished, webWorker, scripts);
|
|
6354
|
+
} else {
|
|
6355
|
+
codec = await new Promise(resolve => pendingRequests.push({ resolve, codecConstructor, readable, writable, options, webWorker, scripts }));
|
|
6356
|
+
}
|
|
6357
|
+
}
|
|
6358
|
+
const { signal } = streamOptions;
|
|
6359
|
+
try {
|
|
6360
|
+
return await codec.run(signal);
|
|
6361
|
+
} catch (error) {
|
|
6362
|
+
if (signal && signal.aborted && (signal.reason == error || error.name == ERR_ABORT)) {
|
|
6363
|
+
codec.abort();
|
|
6364
|
+
throw new Error(ERR_ABORT);
|
|
6318
6365
|
} else {
|
|
6319
|
-
|
|
6366
|
+
throw error;
|
|
6320
6367
|
}
|
|
6321
6368
|
}
|
|
6322
6369
|
|
|
6323
6370
|
function onTaskFinished(workerData) {
|
|
6324
6371
|
if (pendingRequests.length) {
|
|
6325
|
-
const [{ resolve, codecConstructor, options, webWorker, scripts }] = pendingRequests.splice(0, 1);
|
|
6326
|
-
resolve(getWorker(workerData, codecConstructor, options, config, onTaskFinished, webWorker, scripts));
|
|
6372
|
+
const [{ resolve, codecConstructor, readable, writable, options, webWorker, scripts }] = pendingRequests.splice(0, 1);
|
|
6373
|
+
resolve(getWorker(workerData, codecConstructor, readable, writable, options, config, streamOptions, onTaskFinished, webWorker, scripts));
|
|
6327
6374
|
} else if (workerData.worker) {
|
|
6328
6375
|
clearTerminateTimeout(workerData);
|
|
6329
6376
|
if (Number.isFinite(config.terminateWorkerTimeout) && config.terminateWorkerTimeout >= 0) {
|
|
@@ -6380,90 +6427,7 @@
|
|
|
6380
6427
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
6381
6428
|
*/
|
|
6382
6429
|
|
|
6383
|
-
|
|
6384
|
-
const ERR_ABORT = "Abort error";
|
|
6385
|
-
|
|
6386
|
-
async function processData(codec, reader, writer, offset, inputLengthGetter, config, options) {
|
|
6387
|
-
const chunkSize = Math.max(config.chunkSize, MINIMUM_CHUNK_SIZE);
|
|
6388
|
-
const signal = options.signal;
|
|
6389
|
-
let length = 0;
|
|
6390
|
-
let chunkOffset = 0;
|
|
6391
|
-
|
|
6392
|
-
const result = new Promise((resolve, reject) => {
|
|
6393
|
-
codec.pull = async () => {
|
|
6394
|
-
testAborted(signal, codec);
|
|
6395
|
-
const inputLength = inputLengthGetter();
|
|
6396
|
-
let currentChunkOffset = chunkOffset;
|
|
6397
|
-
chunkOffset += chunkSize;
|
|
6398
|
-
const value = await reader.readUint8Array(currentChunkOffset + offset, Math.min(chunkSize, inputLength - currentChunkOffset));
|
|
6399
|
-
const done = chunkOffset > inputLength;
|
|
6400
|
-
return { value, done };
|
|
6401
|
-
};
|
|
6402
|
-
codec.ondata = async ({ value, done }) => {
|
|
6403
|
-
try {
|
|
6404
|
-
testAborted(signal, codec);
|
|
6405
|
-
const inputLength = inputLengthGetter();
|
|
6406
|
-
const { data, signature } = value;
|
|
6407
|
-
if (data && data.length) {
|
|
6408
|
-
length += data.length;
|
|
6409
|
-
await writer.writeUint8Array(data);
|
|
6410
|
-
}
|
|
6411
|
-
if (options.onprogress) {
|
|
6412
|
-
try {
|
|
6413
|
-
options.onprogress(chunkOffset, inputLength);
|
|
6414
|
-
} catch (error) {
|
|
6415
|
-
// ignored
|
|
6416
|
-
}
|
|
6417
|
-
}
|
|
6418
|
-
if (done) {
|
|
6419
|
-
resolve({ signature, length });
|
|
6420
|
-
}
|
|
6421
|
-
} catch (error) {
|
|
6422
|
-
reject(error);
|
|
6423
|
-
}
|
|
6424
|
-
};
|
|
6425
|
-
codec.onerror = reject;
|
|
6426
|
-
});
|
|
6427
|
-
await codec.start();
|
|
6428
|
-
return result;
|
|
6429
|
-
}
|
|
6430
|
-
|
|
6431
|
-
function testAborted(signal, codec) {
|
|
6432
|
-
if (signal && signal.aborted) {
|
|
6433
|
-
codec.abort();
|
|
6434
|
-
throw new Error(ERR_ABORT);
|
|
6435
|
-
}
|
|
6436
|
-
}
|
|
6437
|
-
|
|
6438
|
-
/*
|
|
6439
|
-
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
6440
|
-
|
|
6441
|
-
Redistribution and use in source and binary forms, with or without
|
|
6442
|
-
modification, are permitted provided that the following conditions are met:
|
|
6443
|
-
|
|
6444
|
-
1. Redistributions of source code must retain the above copyright notice,
|
|
6445
|
-
this list of conditions and the following disclaimer.
|
|
6446
|
-
|
|
6447
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
6448
|
-
notice, this list of conditions and the following disclaimer in
|
|
6449
|
-
the documentation and/or other materials provided with the distribution.
|
|
6450
|
-
|
|
6451
|
-
3. The names of the authors may not be used to endorse or promote products
|
|
6452
|
-
derived from this software without specific prior written permission.
|
|
6453
|
-
|
|
6454
|
-
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
6455
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
6456
|
-
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
6457
|
-
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
6458
|
-
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
6459
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
6460
|
-
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
6461
|
-
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
6462
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
6463
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
6464
|
-
*/
|
|
6465
|
-
|
|
6466
|
-
/* global Blob, FileReader, atob, btoa, XMLHttpRequest, document, fetch */
|
|
6430
|
+
/* global Blob, FileReader, atob, btoa, XMLHttpRequest, document, fetch, ReadableStream, WritableStream */
|
|
6467
6431
|
|
|
6468
6432
|
const ERR_HTTP_STATUS = "HTTP error ";
|
|
6469
6433
|
const ERR_HTTP_RANGE = "HTTP Range not supported";
|
|
@@ -6477,6 +6441,7 @@
|
|
|
6477
6441
|
const HTTP_METHOD_HEAD = "HEAD";
|
|
6478
6442
|
const HTTP_METHOD_GET = "GET";
|
|
6479
6443
|
const HTTP_RANGE_UNIT = "bytes";
|
|
6444
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
6480
6445
|
|
|
6481
6446
|
class Stream {
|
|
6482
6447
|
|
|
@@ -6490,9 +6455,39 @@
|
|
|
6490
6455
|
}
|
|
6491
6456
|
|
|
6492
6457
|
class Reader extends Stream {
|
|
6458
|
+
|
|
6459
|
+
getStream({ offset, size, chunkSize } = { offset: 0, chunkSize: DEFAULT_CHUNK_SIZE }) {
|
|
6460
|
+
const reader = this;
|
|
6461
|
+
return new ReadableStream({
|
|
6462
|
+
start() {
|
|
6463
|
+
this.chunkOffset = 0;
|
|
6464
|
+
},
|
|
6465
|
+
async pull(controller) {
|
|
6466
|
+
const { chunkOffset } = this;
|
|
6467
|
+
controller.enqueue(await reader.readUint8Array(offset + chunkOffset, Math.min(chunkSize, size() - chunkOffset)));
|
|
6468
|
+
if (chunkOffset + chunkSize > size()) {
|
|
6469
|
+
controller.close();
|
|
6470
|
+
} else {
|
|
6471
|
+
this.chunkOffset += chunkSize;
|
|
6472
|
+
}
|
|
6473
|
+
}
|
|
6474
|
+
});
|
|
6475
|
+
}
|
|
6493
6476
|
}
|
|
6494
6477
|
|
|
6495
|
-
class
|
|
6478
|
+
class WriterStream extends Stream {
|
|
6479
|
+
|
|
6480
|
+
getStream() {
|
|
6481
|
+
const writer = this;
|
|
6482
|
+
return new WritableStream({
|
|
6483
|
+
write(chunk) {
|
|
6484
|
+
return writer.writeUint8Array(chunk);
|
|
6485
|
+
}
|
|
6486
|
+
});
|
|
6487
|
+
}
|
|
6488
|
+
}
|
|
6489
|
+
|
|
6490
|
+
class Writer extends WriterStream {
|
|
6496
6491
|
|
|
6497
6492
|
writeUint8Array(array) {
|
|
6498
6493
|
this.size += array.length;
|
|
@@ -6507,9 +6502,10 @@
|
|
|
6507
6502
|
}
|
|
6508
6503
|
|
|
6509
6504
|
init() {
|
|
6505
|
+
const reader = this;
|
|
6510
6506
|
super.init();
|
|
6511
|
-
|
|
6512
|
-
|
|
6507
|
+
reader.blobReader.init();
|
|
6508
|
+
reader.size = reader.blobReader.size;
|
|
6513
6509
|
}
|
|
6514
6510
|
|
|
6515
6511
|
readUint8Array(offset, length) {
|
|
@@ -6531,14 +6527,15 @@
|
|
|
6531
6527
|
}
|
|
6532
6528
|
|
|
6533
6529
|
getData() {
|
|
6534
|
-
|
|
6535
|
-
|
|
6530
|
+
const writer = this;
|
|
6531
|
+
if (writer.blob.text) {
|
|
6532
|
+
return writer.blob.text();
|
|
6536
6533
|
} else {
|
|
6537
6534
|
const reader = new FileReader();
|
|
6538
6535
|
return new Promise((resolve, reject) => {
|
|
6539
6536
|
reader.onload = event => resolve(event.target.result);
|
|
6540
6537
|
reader.onerror = () => reject(reader.error);
|
|
6541
|
-
reader.readAsText(
|
|
6538
|
+
reader.readAsText(writer.blob, writer.encoding);
|
|
6542
6539
|
});
|
|
6543
6540
|
}
|
|
6544
6541
|
}
|
|
@@ -6548,19 +6545,21 @@
|
|
|
6548
6545
|
|
|
6549
6546
|
constructor(dataURI) {
|
|
6550
6547
|
super();
|
|
6551
|
-
|
|
6548
|
+
const reader = this;
|
|
6549
|
+
reader.dataURI = dataURI;
|
|
6552
6550
|
let dataEnd = dataURI.length;
|
|
6553
6551
|
while (dataURI.charAt(dataEnd - 1) == "=") {
|
|
6554
6552
|
dataEnd--;
|
|
6555
6553
|
}
|
|
6556
|
-
|
|
6557
|
-
|
|
6554
|
+
reader.dataStart = dataURI.indexOf(",") + 1;
|
|
6555
|
+
reader.size = Math.floor((dataEnd - reader.dataStart) * 0.75);
|
|
6558
6556
|
}
|
|
6559
6557
|
|
|
6560
6558
|
readUint8Array(offset, length) {
|
|
6561
6559
|
const dataArray = new Uint8Array(length);
|
|
6562
6560
|
const start = Math.floor(offset / 3) * 4;
|
|
6563
|
-
const
|
|
6561
|
+
const dataStart = this.dataStart;
|
|
6562
|
+
const bytes = atob(this.dataURI.substring(start + dataStart, Math.ceil((offset + length) / 3) * 4 + dataStart));
|
|
6564
6563
|
const delta = offset - Math.floor(start / 4) * 3;
|
|
6565
6564
|
for (let indexByte = delta; indexByte < delta + length; indexByte++) {
|
|
6566
6565
|
dataArray[indexByte - delta] = bytes.charCodeAt(indexByte);
|
|
@@ -6579,20 +6578,21 @@
|
|
|
6579
6578
|
|
|
6580
6579
|
writeUint8Array(array) {
|
|
6581
6580
|
super.writeUint8Array(array);
|
|
6581
|
+
const writer = this;
|
|
6582
6582
|
let indexArray = 0;
|
|
6583
|
-
let dataString =
|
|
6584
|
-
const delta =
|
|
6585
|
-
|
|
6583
|
+
let dataString = writer.pending;
|
|
6584
|
+
const delta = writer.pending.length;
|
|
6585
|
+
writer.pending = "";
|
|
6586
6586
|
for (indexArray = 0; indexArray < (Math.floor((delta + array.length) / 3) * 3) - delta; indexArray++) {
|
|
6587
6587
|
dataString += String.fromCharCode(array[indexArray]);
|
|
6588
6588
|
}
|
|
6589
6589
|
for (; indexArray < array.length; indexArray++) {
|
|
6590
|
-
|
|
6590
|
+
writer.pending += String.fromCharCode(array[indexArray]);
|
|
6591
6591
|
}
|
|
6592
6592
|
if (dataString.length > 2) {
|
|
6593
|
-
|
|
6593
|
+
writer.data += btoa(dataString);
|
|
6594
6594
|
} else {
|
|
6595
|
-
|
|
6595
|
+
writer.pending = dataString;
|
|
6596
6596
|
}
|
|
6597
6597
|
}
|
|
6598
6598
|
|
|
@@ -6610,14 +6610,15 @@
|
|
|
6610
6610
|
}
|
|
6611
6611
|
|
|
6612
6612
|
async readUint8Array(offset, length) {
|
|
6613
|
-
|
|
6614
|
-
|
|
6613
|
+
const reader = this;
|
|
6614
|
+
if (reader.blob.arrayBuffer) {
|
|
6615
|
+
return new Uint8Array(await reader.blob.slice(offset, offset + length).arrayBuffer());
|
|
6615
6616
|
} else {
|
|
6616
6617
|
const reader = new FileReader();
|
|
6617
6618
|
return new Promise((resolve, reject) => {
|
|
6618
6619
|
reader.onload = event => resolve(new Uint8Array(event.target.result));
|
|
6619
6620
|
reader.onerror = () => reject(reader.error);
|
|
6620
|
-
reader.readAsArrayBuffer(
|
|
6621
|
+
reader.readAsArrayBuffer(reader.blob.slice(offset, offset + length));
|
|
6621
6622
|
});
|
|
6622
6623
|
}
|
|
6623
6624
|
}
|
|
@@ -6634,21 +6635,23 @@
|
|
|
6634
6635
|
|
|
6635
6636
|
writeUint8Array(array) {
|
|
6636
6637
|
super.writeUint8Array(array);
|
|
6637
|
-
|
|
6638
|
-
|
|
6638
|
+
const writer = this;
|
|
6639
|
+
if (writer.arrayBuffers.length == writer.arrayBuffersMaxlength) {
|
|
6640
|
+
flushArrayBuffers(writer);
|
|
6639
6641
|
}
|
|
6640
|
-
|
|
6642
|
+
writer.arrayBuffers.push(array.buffer);
|
|
6641
6643
|
}
|
|
6642
6644
|
|
|
6643
6645
|
getData() {
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6646
|
+
const writer = this;
|
|
6647
|
+
if (!writer.blob) {
|
|
6648
|
+
if (writer.arrayBuffers.length) {
|
|
6649
|
+
flushArrayBuffers(writer);
|
|
6647
6650
|
}
|
|
6648
|
-
|
|
6649
|
-
initArrayBuffers(
|
|
6651
|
+
writer.blob = writer.pendingBlob;
|
|
6652
|
+
initArrayBuffers(writer);
|
|
6650
6653
|
}
|
|
6651
|
-
return
|
|
6654
|
+
return writer.blob;
|
|
6652
6655
|
}
|
|
6653
6656
|
}
|
|
6654
6657
|
|
|
@@ -6666,78 +6669,38 @@
|
|
|
6666
6669
|
|
|
6667
6670
|
constructor(readableStream) {
|
|
6668
6671
|
this.readableStream = readableStream;
|
|
6669
|
-
this.reader = readableStream.getReader();
|
|
6670
6672
|
this.size = Infinity;
|
|
6671
|
-
this.index = 0;
|
|
6672
|
-
this.currentSize = 0;
|
|
6673
|
-
this.pendingValue = new Uint8Array();
|
|
6674
6673
|
}
|
|
6675
6674
|
|
|
6676
|
-
init() {
|
|
6675
|
+
init(size) {
|
|
6676
|
+
this.size = size;
|
|
6677
6677
|
this.initialized = true;
|
|
6678
6678
|
}
|
|
6679
6679
|
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
throw new Error(ERR_NOT_SEEKABLE_READER);
|
|
6683
|
-
}
|
|
6684
|
-
let data = new Uint8Array(length);
|
|
6685
|
-
let size = 0, done;
|
|
6686
|
-
do {
|
|
6687
|
-
const result = await this.reader.read();
|
|
6688
|
-
let { value } = result;
|
|
6689
|
-
done = result.done;
|
|
6690
|
-
if (value) {
|
|
6691
|
-
this.currentSize += value.length;
|
|
6692
|
-
} else {
|
|
6693
|
-
value = this.pendingValue;
|
|
6694
|
-
this.pendingValue = new Uint8Array();
|
|
6695
|
-
}
|
|
6696
|
-
if (this.pendingValue.length) {
|
|
6697
|
-
const newValue = new Uint8Array(this.pendingValue.length + value.length);
|
|
6698
|
-
newValue.set(this.pendingValue);
|
|
6699
|
-
newValue.set(value, this.pendingValue.length);
|
|
6700
|
-
this.pendingValue = new Uint8Array();
|
|
6701
|
-
value = newValue;
|
|
6702
|
-
}
|
|
6703
|
-
if (size + value.length > length) {
|
|
6704
|
-
data.set(value.subarray(0, length), size);
|
|
6705
|
-
this.pendingValue = value.subarray(length);
|
|
6706
|
-
size += length;
|
|
6707
|
-
} else {
|
|
6708
|
-
data.set(value, size);
|
|
6709
|
-
size += value.length;
|
|
6710
|
-
}
|
|
6711
|
-
} while (size < length && !done);
|
|
6712
|
-
if (done && this.size == Infinity) {
|
|
6713
|
-
this.size = this.currentSize;
|
|
6714
|
-
}
|
|
6715
|
-
if (this.size < length) {
|
|
6716
|
-
data = data.slice(0, this.size);
|
|
6717
|
-
length = this.size;
|
|
6718
|
-
}
|
|
6719
|
-
this.index += length;
|
|
6720
|
-
return data;
|
|
6680
|
+
getStream() {
|
|
6681
|
+
return this.readableStream;
|
|
6721
6682
|
}
|
|
6722
6683
|
}
|
|
6723
6684
|
|
|
6724
6685
|
class WritableStreamWriter extends Writer {
|
|
6725
6686
|
|
|
6726
|
-
constructor(
|
|
6687
|
+
constructor(writable) {
|
|
6727
6688
|
super();
|
|
6728
|
-
|
|
6729
|
-
|
|
6689
|
+
const writer = this;
|
|
6690
|
+
writer.writable = writable;
|
|
6730
6691
|
}
|
|
6731
6692
|
|
|
6732
6693
|
async writeUint8Array(array) {
|
|
6733
6694
|
await this.writer.ready;
|
|
6734
|
-
return this.
|
|
6695
|
+
return this.writable.getWriter().write(array);
|
|
6696
|
+
}
|
|
6697
|
+
|
|
6698
|
+
getStream() {
|
|
6699
|
+
return this.writable;
|
|
6735
6700
|
}
|
|
6736
6701
|
|
|
6737
6702
|
async getData() {
|
|
6738
|
-
|
|
6739
|
-
await this.writer.close();
|
|
6740
|
-
return this.writableStream;
|
|
6703
|
+
return this.writable;
|
|
6741
6704
|
}
|
|
6742
6705
|
}
|
|
6743
6706
|
|
|
@@ -6745,15 +6708,16 @@
|
|
|
6745
6708
|
|
|
6746
6709
|
constructor(url, options) {
|
|
6747
6710
|
super();
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
delete
|
|
6755
|
-
delete
|
|
6756
|
-
delete
|
|
6711
|
+
const reader = this;
|
|
6712
|
+
reader.url = url;
|
|
6713
|
+
reader.preventHeadRequest = options.preventHeadRequest;
|
|
6714
|
+
reader.useRangeHeader = options.useRangeHeader;
|
|
6715
|
+
reader.forceRangeRequests = options.forceRangeRequests;
|
|
6716
|
+
reader.options = Object.assign({}, options);
|
|
6717
|
+
delete reader.options.preventHeadRequest;
|
|
6718
|
+
delete reader.options.useRangeHeader;
|
|
6719
|
+
delete reader.options.forceRangeRequests;
|
|
6720
|
+
delete reader.options.useXHR;
|
|
6757
6721
|
}
|
|
6758
6722
|
|
|
6759
6723
|
async init() {
|
|
@@ -6770,11 +6734,12 @@
|
|
|
6770
6734
|
|
|
6771
6735
|
constructor(url, options) {
|
|
6772
6736
|
super();
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6737
|
+
const reader = this;
|
|
6738
|
+
reader.url = url;
|
|
6739
|
+
reader.preventHeadRequest = options.preventHeadRequest;
|
|
6740
|
+
reader.useRangeHeader = options.useRangeHeader;
|
|
6741
|
+
reader.forceRangeRequests = options.forceRangeRequests;
|
|
6742
|
+
reader.options = options;
|
|
6778
6743
|
}
|
|
6779
6744
|
|
|
6780
6745
|
async init() {
|
|
@@ -6977,10 +6942,11 @@
|
|
|
6977
6942
|
|
|
6978
6943
|
writeUint8Array(array) {
|
|
6979
6944
|
super.writeUint8Array(array);
|
|
6980
|
-
const
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6945
|
+
const writer = this;
|
|
6946
|
+
const previousArray = writer.array;
|
|
6947
|
+
writer.array = new Uint8Array(previousArray.length + array.length);
|
|
6948
|
+
writer.array.set(previousArray);
|
|
6949
|
+
writer.array.set(array, previousArray.length);
|
|
6984
6950
|
}
|
|
6985
6951
|
|
|
6986
6952
|
getData() {
|
|
@@ -7434,7 +7400,15 @@
|
|
|
7434
7400
|
throw new Error(ERR_ENCRYPTED);
|
|
7435
7401
|
}
|
|
7436
7402
|
}
|
|
7437
|
-
const
|
|
7403
|
+
const dataOffset = offset + 30 + localDirectory.filenameLength + localDirectory.extraFieldLength;
|
|
7404
|
+
const size = () => compressedSize;
|
|
7405
|
+
const readable = reader.getStream({ offset: dataOffset, size, chunkSize: getChunkSize(config) });
|
|
7406
|
+
const writable = writer.getStream();
|
|
7407
|
+
const signal = getOptionValue$1(zipEntry, options, "signal");
|
|
7408
|
+
if (!writer.initialized) {
|
|
7409
|
+
await writer.init();
|
|
7410
|
+
}
|
|
7411
|
+
await runCodec(config.Inflate, readable, writable, {
|
|
7438
7412
|
codecType: CODEC_INFLATE,
|
|
7439
7413
|
password,
|
|
7440
7414
|
zipCrypto,
|
|
@@ -7446,13 +7420,7 @@
|
|
|
7446
7420
|
encrypted,
|
|
7447
7421
|
useWebWorkers: getOptionValue$1(zipEntry, options, "useWebWorkers"),
|
|
7448
7422
|
useCompressionStream: getOptionValue$1(zipEntry, options, "useCompressionStream")
|
|
7449
|
-
}, config);
|
|
7450
|
-
if (!writer.initialized) {
|
|
7451
|
-
await writer.init();
|
|
7452
|
-
}
|
|
7453
|
-
const signal = getOptionValue$1(zipEntry, options, "signal");
|
|
7454
|
-
const dataOffset = offset + 30 + localDirectory.filenameLength + localDirectory.extraFieldLength;
|
|
7455
|
-
await processData(codec, reader, writer, dataOffset, () => compressedSize, config, { onprogress: options.onprogress, signal });
|
|
7423
|
+
}, config, { signal, onprogress: options.onprogress, size });
|
|
7456
7424
|
return writer.getData();
|
|
7457
7425
|
}
|
|
7458
7426
|
}
|
|
@@ -7868,9 +7836,6 @@
|
|
|
7868
7836
|
}
|
|
7869
7837
|
let maximumCompressedSize = 0;
|
|
7870
7838
|
let keepOrder = getOptionValue(zipWriter, options, "keepOrder");
|
|
7871
|
-
if (keepOrder === undefined) {
|
|
7872
|
-
keepOrder = true;
|
|
7873
|
-
}
|
|
7874
7839
|
let uncompressedSize = 0;
|
|
7875
7840
|
let msDosCompatible = getOptionValue(zipWriter, options, "msDosCompatible");
|
|
7876
7841
|
if (msDosCompatible === undefined) {
|
|
@@ -7944,8 +7909,8 @@
|
|
|
7944
7909
|
}
|
|
7945
7910
|
|
|
7946
7911
|
async function getFileEntry(zipWriter, name, reader, options) {
|
|
7947
|
-
const files = zipWriter
|
|
7948
|
-
const
|
|
7912
|
+
const { files, writer } = zipWriter;
|
|
7913
|
+
const streamWriter = writer.getStream().getWriter();
|
|
7949
7914
|
const previousFileEntry = Array.from(files.values()).pop();
|
|
7950
7915
|
let fileEntry = {};
|
|
7951
7916
|
let bufferedWrite;
|
|
@@ -7971,7 +7936,7 @@
|
|
|
7971
7936
|
}
|
|
7972
7937
|
fileWriter = writer;
|
|
7973
7938
|
}
|
|
7974
|
-
fileEntry = await createFileEntry(reader, fileWriter, zipWriter.config, options);
|
|
7939
|
+
fileEntry = await createFileEntry(reader, fileWriter.getStream(), fileWriter.getStream().getWriter(), zipWriter.config, options);
|
|
7975
7940
|
fileEntry.lock = lockCurrentFileEntry;
|
|
7976
7941
|
files.set(name, fileEntry);
|
|
7977
7942
|
fileEntry.filename = name;
|
|
@@ -8001,10 +7966,10 @@
|
|
|
8001
7966
|
setUint32(arrayBufferView, 18, fileEntry.compressedSize);
|
|
8002
7967
|
setUint32(arrayBufferView, 22, fileEntry.uncompressedSize);
|
|
8003
7968
|
}
|
|
8004
|
-
await
|
|
7969
|
+
await writeUint8Array(streamWriter, new Uint8Array(arrayBuffer));
|
|
8005
7970
|
indexWrittenData = headerLength;
|
|
8006
7971
|
}
|
|
8007
|
-
await writeBlob(
|
|
7972
|
+
await writeBlob(streamWriter, blob, indexWrittenData);
|
|
8008
7973
|
delete fileEntry.writingBufferedData;
|
|
8009
7974
|
}
|
|
8010
7975
|
fileEntry.offset = zipWriter.offset;
|
|
@@ -8033,7 +7998,7 @@
|
|
|
8033
7998
|
}
|
|
8034
7999
|
}
|
|
8035
8000
|
|
|
8036
|
-
async function createFileEntry(reader,
|
|
8001
|
+
async function createFileEntry(reader, writable, streamWriter, config, options) {
|
|
8037
8002
|
const {
|
|
8038
8003
|
rawFilename,
|
|
8039
8004
|
lastAccessDate,
|
|
@@ -8180,7 +8145,11 @@
|
|
|
8180
8145
|
let result;
|
|
8181
8146
|
let compressedSize = 0;
|
|
8182
8147
|
if (reader) {
|
|
8183
|
-
|
|
8148
|
+
await writeUint8Array(streamWriter, localHeaderArray);
|
|
8149
|
+
fileEntry.dataWritten = true;
|
|
8150
|
+
const size = () => reader.size;
|
|
8151
|
+
const readable = reader.getStream({ offset: 0, size, chunkSize: getChunkSize(config) });
|
|
8152
|
+
result = await runCodec(config.Deflate, readable, writable, {
|
|
8184
8153
|
codecType: CODEC_DEFLATE,
|
|
8185
8154
|
level,
|
|
8186
8155
|
password,
|
|
@@ -8192,14 +8161,11 @@
|
|
|
8192
8161
|
encrypted,
|
|
8193
8162
|
useWebWorkers,
|
|
8194
8163
|
useCompressionStream
|
|
8195
|
-
}, config);
|
|
8196
|
-
await writer.writeUint8Array(localHeaderArray);
|
|
8197
|
-
fileEntry.dataWritten = true;
|
|
8198
|
-
result = await processData(codec, reader, writer, 0, () => reader.size, config, { onprogress, signal });
|
|
8164
|
+
}, config, { signal, onprogress, size });
|
|
8199
8165
|
uncompressedSize = fileEntry.uncompressedSize = reader.size;
|
|
8200
8166
|
compressedSize = result.length;
|
|
8201
8167
|
} else {
|
|
8202
|
-
await
|
|
8168
|
+
await writeUint8Array(streamWriter, localHeaderArray);
|
|
8203
8169
|
fileEntry.dataWritten = true;
|
|
8204
8170
|
}
|
|
8205
8171
|
let dataDescriptorArray = new Uint8Array(0);
|
|
@@ -8243,7 +8209,7 @@
|
|
|
8243
8209
|
}
|
|
8244
8210
|
}
|
|
8245
8211
|
if (dataDescriptor) {
|
|
8246
|
-
await
|
|
8212
|
+
await writeUint8Array(streamWriter, dataDescriptorArray);
|
|
8247
8213
|
}
|
|
8248
8214
|
const length = localHeaderArray.length + compressedSize + dataDescriptorArray.length;
|
|
8249
8215
|
Object.assign(fileEntry, { compressedSize, lastModDate, rawLastModDate, creationDate, lastAccessDate, encrypted, length });
|
|
@@ -8251,8 +8217,8 @@
|
|
|
8251
8217
|
}
|
|
8252
8218
|
|
|
8253
8219
|
async function closeFile(zipWriter, comment, options) {
|
|
8254
|
-
const
|
|
8255
|
-
const
|
|
8220
|
+
const { files } = zipWriter;
|
|
8221
|
+
const streamWriter = zipWriter.writer.getStream().getWriter();
|
|
8256
8222
|
let offset = 0;
|
|
8257
8223
|
let directoryDataLength = 0;
|
|
8258
8224
|
let directoryOffset = zipWriter.offset;
|
|
@@ -8367,9 +8333,9 @@
|
|
|
8367
8333
|
setUint16(directoryView, offset + 10, filesLength);
|
|
8368
8334
|
setUint32(directoryView, offset + 12, directoryDataLength);
|
|
8369
8335
|
setUint32(directoryView, offset + 16, directoryOffset);
|
|
8370
|
-
await
|
|
8336
|
+
await writeUint8Array(streamWriter, directoryArray);
|
|
8371
8337
|
if (comment && comment.length) {
|
|
8372
|
-
await
|
|
8338
|
+
await writeUint8Array(streamWriter, comment);
|
|
8373
8339
|
}
|
|
8374
8340
|
}
|
|
8375
8341
|
|
|
@@ -8390,20 +8356,25 @@
|
|
|
8390
8356
|
}
|
|
8391
8357
|
}
|
|
8392
8358
|
|
|
8393
|
-
async function writeBlob(
|
|
8359
|
+
async function writeBlob(streamWriter, blob, start = 0) {
|
|
8394
8360
|
const blockSize = 512 * 1024 * 1024;
|
|
8395
8361
|
await writeSlice();
|
|
8396
8362
|
|
|
8397
8363
|
async function writeSlice() {
|
|
8398
8364
|
if (start < blob.size) {
|
|
8399
8365
|
const arrayBuffer = await sliceAsArrayBuffer(blob, start, start + blockSize);
|
|
8400
|
-
await
|
|
8366
|
+
await writeUint8Array(streamWriter, new Uint8Array(arrayBuffer));
|
|
8401
8367
|
start += blockSize;
|
|
8402
8368
|
await writeSlice();
|
|
8403
8369
|
}
|
|
8404
8370
|
}
|
|
8405
8371
|
}
|
|
8406
8372
|
|
|
8373
|
+
async function writeUint8Array(streamWriter, array) {
|
|
8374
|
+
await streamWriter.ready;
|
|
8375
|
+
await streamWriter.write(array);
|
|
8376
|
+
}
|
|
8377
|
+
|
|
8407
8378
|
function getTimeNTFS(date) {
|
|
8408
8379
|
if (date) {
|
|
8409
8380
|
return ((BigInt(date.getTime()) + BigInt(11644473600000)) * BigInt(10000));
|