@zip.js/zip.js 2.11.4 → 2.13.0
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/deno.json +1 -1
- package/dist/zip-core-external.js +549 -139
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +559 -136
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +615 -260
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +628 -257
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +615 -260
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +630 -259
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +631 -260
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +561 -138
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +561 -138
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +562 -139
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +630 -259
- package/index-native.min.js +1 -1
- package/index.cjs +631 -260
- package/index.d.cts +474 -59
- package/index.d.ts +474 -59
- package/index.min.js +1 -1
- package/lib/core/codec-worker-web.js +72 -22
- package/lib/core/codec-worker.js +18 -5
- package/lib/core/configuration.js +20 -5
- package/lib/core/constants.js +2 -0
- package/lib/core/io.js +13 -5
- package/lib/core/options.js +16 -0
- package/lib/core/streams/codec-stream.js +6 -0
- package/lib/core/util/error.js +35 -0
- package/lib/core/util/warnings.js +42 -0
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-base.js +46 -9
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-entry.js +49 -1
- package/lib/core/zip-fs.js +45 -133
- package/lib/core/zip-reader.js +115 -52
- package/lib/core/zip-writer.js +244 -57
- package/lib/zip-core-base.js +9 -3
- package/lib/zip-core-reader.js +2 -0
- package/lib/zip-core-writer.js +6 -1
- package/lib/zip-module-wasm-base.js +2 -2
- package/package.json +5 -3
- package/worker-message-property-names.js +1 -1
package/dist/zip-fs.js
CHANGED
|
@@ -134,6 +134,7 @@
|
|
|
134
134
|
const BOOLEAN_TYPE = "boolean";
|
|
135
135
|
|
|
136
136
|
const EMPTY_UINT8_ARRAY = new Uint8Array();
|
|
137
|
+
const SYMBOL_ASYNC_DISPOSE = Symbol.asyncDispose || Symbol();
|
|
137
138
|
|
|
138
139
|
/*
|
|
139
140
|
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
@@ -178,6 +179,7 @@
|
|
|
178
179
|
const OPTION_CHECK_OVERLAPPING_ENTRY = "checkOverlappingEntry";
|
|
179
180
|
const OPTION_CHECK_AMBIGUITY = "checkAmbiguity";
|
|
180
181
|
const OPTION_CHECK_LOCAL_DIRECTORY = "checkLocalDirectory";
|
|
182
|
+
const OPTION_CHECK_LOCAL_FILENAME = "checkLocalFilename";
|
|
181
183
|
const OPTION_CHECK_SIGNATURE = "checkSignature";
|
|
182
184
|
const OPTION_CHECK_CRC32 = "checkCrc32";
|
|
183
185
|
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
@@ -208,15 +210,18 @@
|
|
|
208
210
|
const OPTION_MAX_APPENDED_DATA_SIZE = "maxAppendedDataSize";
|
|
209
211
|
const OPTION_DECRYPT_CENTRAL_DIRECTORY = "decryptCentralDirectory";
|
|
210
212
|
const OPTION_SIGN_CENTRAL_DIRECTORY = "signCentralDirectory";
|
|
213
|
+
const OPTION_ENTRY = "entry";
|
|
211
214
|
const TEXT_TYPE_FILENAME = "filename";
|
|
212
215
|
const TEXT_TYPE_COMMENT = "comment";
|
|
213
216
|
const STRICTNESS_STRICT = "strict";
|
|
214
217
|
const STRICTNESS_BALANCED = "balanced";
|
|
215
218
|
const STRICTNESS_TOLERANT = "tolerant";
|
|
219
|
+
const PASS_THROUGH_COMPRESSED = "compressed";
|
|
216
220
|
|
|
217
221
|
const ERR_INVALID_FUNCTION_OPTION = "Invalid option (must be a function)";
|
|
218
222
|
const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
219
223
|
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
224
|
+
const ERR_INVALID_PASS_THROUGH_VALUE = "Invalid passThrough option (must be a boolean or 'compressed')";
|
|
220
225
|
const ERR_ABORTED = "The operation was aborted";
|
|
221
226
|
const ABORT_ERROR_NAME = "AbortError";
|
|
222
227
|
|
|
@@ -246,6 +251,13 @@
|
|
|
246
251
|
}
|
|
247
252
|
}
|
|
248
253
|
|
|
254
|
+
function checkPassThroughOption(passThrough) {
|
|
255
|
+
if (passThrough !== UNDEFINED_VALUE && typeof passThrough != BOOLEAN_TYPE && passThrough !== PASS_THROUGH_COMPRESSED) {
|
|
256
|
+
throw new Error(ERR_INVALID_PASS_THROUGH_VALUE);
|
|
257
|
+
}
|
|
258
|
+
return passThrough;
|
|
259
|
+
}
|
|
260
|
+
|
|
249
261
|
function checkInteger(value, maxValue, errorMessage) {
|
|
250
262
|
if (!Number.isInteger(value) || value < 0 || value > maxValue) {
|
|
251
263
|
throw new Error(errorMessage);
|
|
@@ -295,6 +307,8 @@
|
|
|
295
307
|
const MINIMUM_CHUNK_SIZE = 64;
|
|
296
308
|
const MINIMUM_PROPERTY_VALUE = 1;
|
|
297
309
|
const ERR_INVALID_MAX_WORKERS = "Invalid maxWorkers (must be an integer greater than 0)";
|
|
310
|
+
const ERR_INVALID_BASE_URI = "Invalid baseURI (must be a string)";
|
|
311
|
+
const ERR_INVALID_URI = "Invalid URI (must be a string or a function returning a string)";
|
|
298
312
|
let maxWorkers = 2;
|
|
299
313
|
try {
|
|
300
314
|
if (typeof navigator != UNDEFINED_TYPE && navigator.hardwareConcurrency) {
|
|
@@ -319,9 +333,9 @@
|
|
|
319
333
|
};
|
|
320
334
|
|
|
321
335
|
const PROPERTY_NAME_MAX_WORKERS = "maxWorkers";
|
|
336
|
+
const PROPERTY_NAME_BASE_URI = "baseURI";
|
|
322
337
|
|
|
323
|
-
const
|
|
324
|
-
"baseURI",
|
|
338
|
+
const URI_PROPERTY_NAMES = [
|
|
325
339
|
"wasmURI",
|
|
326
340
|
"workerURI"
|
|
327
341
|
];
|
|
@@ -345,7 +359,8 @@
|
|
|
345
359
|
"DecompressionStreamFallback"
|
|
346
360
|
];
|
|
347
361
|
const CONFIGURABLE_PROPERTY_NAMES = [
|
|
348
|
-
|
|
362
|
+
PROPERTY_NAME_BASE_URI,
|
|
363
|
+
...URI_PROPERTY_NAMES,
|
|
349
364
|
...BOOLEAN_PROPERTY_NAMES,
|
|
350
365
|
...NUMBER_PROPERTY_NAMES,
|
|
351
366
|
...FUNCTION_PROPERTY_NAMES
|
|
@@ -389,6 +404,14 @@
|
|
|
389
404
|
}
|
|
390
405
|
} else if (FUNCTION_PROPERTY_NAMES.includes(propertyName)) {
|
|
391
406
|
checkFunctionOption(propertyValue);
|
|
407
|
+
} else if (propertyName == PROPERTY_NAME_BASE_URI) {
|
|
408
|
+
if (propertyValue && typeof propertyValue != STRING_TYPE) {
|
|
409
|
+
throw new Error(ERR_INVALID_BASE_URI);
|
|
410
|
+
}
|
|
411
|
+
} else if (URI_PROPERTY_NAMES.includes(propertyName)) {
|
|
412
|
+
if (propertyValue && typeof propertyValue != STRING_TYPE && typeof propertyValue != FUNCTION_TYPE) {
|
|
413
|
+
throw new Error(ERR_INVALID_URI);
|
|
414
|
+
}
|
|
392
415
|
}
|
|
393
416
|
return propertyValue;
|
|
394
417
|
}
|
|
@@ -422,7 +445,7 @@
|
|
|
422
445
|
Object.assign(config, DEFAULT_CONFIGURATION);
|
|
423
446
|
}
|
|
424
447
|
|
|
425
|
-
const t$1=new Uint8Array(288);t$1.fill(8,0,144),t$1.fill(9,144,256),t$1.fill(7,256,280),t$1.fill(8,280,288),new Uint8Array(30).fill(5);const e$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n$1=t=>t({workerURI:t=>{const n="text/javascript";let s='!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:s,Error:r,Uint8Array:o,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:u,Promise:l,TextEncoder:w,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new o,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,A,x,M,P,B,D,F]=C;class R{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let s=0;if(e>=8&&t.buffer){const r=new u(t.buffer,t.byteOffset,e),o=e-8;for(;s<=o;s+=8){const t=n^r.getInt32(s,!0),e=r.getInt32(s+4,!0);n=F[255&t]^D[t>>>8&255]^B[t>>>16&255]^P[t>>>24&255]^M[255&e]^x[e>>>8&255]^A[e>>>16&255]^I[e>>>24&255]}}for(;s<e;s++)n=n>>>8^I[255&(n^t[s])];this.o=n}get(){return~this.o}}class U extends d{constructor(){let t;const n=new R;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new o(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function W(t,n){const e=new o(t.length+n.length);return e.set(t),e.set(n,t.length),e}function _(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const T={concat(t,n){if(0===t.length||0===n.length)return t.concat(n);const e=t[t.length-1],s=T.l(e);return 32===s?t.concat(n):T.h(n,s,0|e,t.slice(0,t.length-1))},bitLength(t){const n=t.length;if(0===n)return 0;const e=t[n-1];return 32*(n-1)+T.l(e)},m(t,n){if(32*t.length<n)return t;const e=(t=t.slice(0,s.ceil(n/32))).length;return n&=31,e>0&&n&&(t[e-1]=T.S(n,t[e-1]&2147483648>>n-1,1)),t},S:(t,n,e)=>32===t?n:(e?0|n:n<<32-t)+1099511627776*t,l:t=>s.round(t/1099511627776)||32,h(t,n,e,s){for(void 0===s&&(s=[]);n>=32;n-=32)s.push(e),e=0;if(0===n)return s.concat(t);for(let r=0;r<t.length;r++)s.push(e|t[r]>>>n),e=t[r]<<32-n;const r=t.length?t[t.length-1]:0,o=T.l(r);return s.push(T.S(n+o&31,n+o>32?e:s.pop(),1)),s}},V={bytes:{v(t){const n=T.bitLength(t)/8,e=new o(n);let s;for(let r=0;r<n;r++)3&r||(s=t[r/4]),e[r]=s>>>24,s<<=8;return e},C(t){const n=[];let e,s=0;for(e=0;e<t.length;e++)s=s<<8|t[e],3&~e||(n.push(s),s=0);return 3&e&&n.push(T.S(8*(3&e),s)),n}}},K=class{constructor(t){const n=this;n.blockSize=512,n.I=[1732584193,4023233417,2562383102,271733878,3285377520],n.A=[1518500249,1859775393,2400959708,3395469782],t?(n.M=t.M.slice(0),n.P=t.P.slice(0),n.B=t.B):n.reset()}reset(){const t=this;return t.M=t.I.slice(0),t.P=[],t.B=0,t}update(t){const n=this;"string"==typeof t&&(t=V.D.C(t));const e=n.P=T.concat(n.P,t),s=n.B,o=n.B=s+T.bitLength(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const c=new i(e);let a=0;for(let t=n.blockSize+s-(n.blockSize+s&n.blockSize-1);t<=o;t+=n.blockSize)n.F(c.subarray(16*a,16*(a+1))),a+=1;return e.splice(0,16*a),n}R(){const t=this;let n=t.P;const e=t.M;n=T.concat(n,[T.S(1,1)]);for(let t=n.length+2;15&t;t++)n.push(0);for(n.push(s.floor(t.B/4294967296)),n.push(0|t.B);n.length;)t.F(n.splice(0,16));return t.reset(),e}U(t,n,e,s){return t<=19?n&e|~n&s:t<=39?n^e^s:t<=59?n&e|n&s|e&s:t<=79?n^e^s:void 0}W(t,n){return n<<t|n>>>32-t}F(n){const e=this,r=e.M,o=t(80);for(let t=0;t<16;t++)o[t]=n[t];let c=r[0],i=r[1],a=r[2],f=r[3],u=r[4];for(let t=0;t<=79;t++){t>=16&&(o[t]=e.W(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const n=e.W(5,c)+e.U(t,i,a,f)+u+o[t]+e.A[s.floor(t/20)]|0;u=f,f=a,a=e.W(30,i),i=c,c=n}r[0]=r[0]+c|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+f|0,r[4]=r[4]+u|0}},E={importKey:t=>new E._(V.bytes.C(t)),T(t,n,e,s){if(e=e||1e4,s<0||e<0)throw new r("invalid params to pbkdf2");const o=1+(s>>5)<<2;let c,i,a,f,l;const w=new ArrayBuffer(o),h=new u(w);let p=0;const d=T;for(n=V.bytes.C(n),l=1;p<(o||1);l++){for(c=i=t.encrypt(d.concat(n,[l])),a=1;a<e;a++)for(i=t.encrypt(i),f=0;f<i.length;f++)c[f]^=i[f];for(a=0;p<(o||1)&&a<c.length;a++)h.setInt32(p,c[a]),p+=4}return w.slice(0,s/8)},_:class{constructor(t){const n=this,e=n.V=K,s=[[],[]];n.K=[new e,new e];const r=n.K[0].blockSize/32;t.length>r&&(t=(new e).update(t).R());for(let n=0;n<r;n++)s[0][n]=909522486^t[n],s[1][n]=1549556828^t[n];n.K[0].update(s[0]),n.K[1].update(s[1]),n.L=new e(n.K[0])}reset(){const t=this;t.L=new t.V(t.K[0]),t.O=!1}update(t){this.O=!0,this.L.update(t)}digest(){const t=this,n=t.L.R(),e=new t.V(t.K[1]).update(n).R();return t.reset(),e}encrypt(t){if(this.O)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},L=typeof h!=b&&typeof h.getRandomValues==k,O="Invalid password",j="zipjs-abort-check-password";function H(t){if(L)return h.getRandomValues(t);throw new r("Crypto API not supported")}const N=16,q={name:"PBKDF2"},G=n.assign({hash:{name:"HMAC"}},q),J=n.assign({iterations:1e3,hash:{name:"SHA-1"}},q),Q=["deriveBits"],X=[8,12,16],Y=[16,24,32],Z=10,$=[0,0,0,0],tt=typeof h!=b,nt=tt&&h.subtle,et=tt&&typeof nt!=b,st=V.bytes,rt=class{constructor(t){const n=this;n.j=[[[],[],[],[],[]],[[],[],[],[],[]]],n.j[0][0][0]||n.H();const e=n.j[0][4],s=n.j[1],o=t.length;let c,i,a,f=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(n.A=[i=t.slice(0),a=[]],c=o;c<4*o+28;c++){let t=i[c-1];(c%o===0||8===o&&c%o===4)&&(t=e[t>>>24]<<24^e[t>>16&255]<<16^e[t>>8&255]<<8^e[255&t],c%o===0&&(t=t<<8^t>>>24^f<<24,f=f<<1^283*(f>>7))),i[c]=i[c-o]^t}for(let t=0;c;t++,c--){const n=i[3&t?c:c-4];a[t]=c<=4||t<4?n:s[0][e[n>>>24]]^s[1][e[n>>16&255]]^s[2][e[n>>8&255]]^s[3][e[255&n]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}H(){const t=this.j[0],n=this.j[1],e=t[4],s=n[4],r=[],o=[];let c,i,a,f;for(let t=0;t<256;t++)o[(r[t]=t<<1^283*(t>>7))^t]=t;for(let u=c=0;!e[u];u^=i||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,e[u]=o,s[o]=u,f=r[a=r[i=r[u]]];let l=16843009*f^65537*a^257*i^16843008*u,w=257*r[o]^16843008*o;for(let e=0;e<4;e++)t[e][u]=w=w<<24^w>>>8,n[e][o]=l=l<<24^l>>>8}for(let e=0;e<5;e++)t[e]=t[e].slice(0),n[e]=n[e].slice(0)}N(t,n){if(4!==t.length)throw new r("invalid aes block size");const e=this.A[n],s=e.length/4-2,o=[0,0,0,0],c=this.j[n],i=c[0],a=c[1],f=c[2],u=c[3],l=c[4];let w,h,p,d=t[0]^e[0],y=t[n?3:1]^e[1],m=t[2]^e[2],S=t[n?1:3]^e[3],g=4;for(let t=0;t<s;t++)w=i[d>>>24]^a[y>>16&255]^f[m>>8&255]^u[255&S]^e[g],h=i[y>>>24]^a[m>>16&255]^f[S>>8&255]^u[255&d]^e[g+1],p=i[m>>>24]^a[S>>16&255]^f[d>>8&255]^u[255&y]^e[g+2],S=i[S>>>24]^a[d>>16&255]^f[y>>8&255]^u[255&m]^e[g+3],g+=4,d=w,y=h,m=p;for(let t=0;t<4;t++)o[n?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&S]^e[g++],w=d,d=y,y=m,m=S,S=w;return o}},ot=class{constructor(t,n){this.G=t,this.J=n,this.X=n}reset(){this.X=this.J}update(t){return this.Y(this.G,t,this.X)}Z(t){if(255&~(t>>24))t+=1<<24;else{let n=t>>16&255,e=t>>8&255,s=255&t;255===n?(n=0,255===e?(e=0,255===s?s=0:++s):++e):++n,t=0,t+=n<<16,t+=e<<8,t+=s}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,n,e){let s;if(!(s=n.length))return[];const r=T.bitLength(n);for(let r=0;r<s;r+=4){this.$(e);const s=t.encrypt(e);n[r]^=s[0],n[r+1]^=s[1],n[r+2]^=s[2],n[r+3]^=s[3]}return T.m(n,r)}},ct=E._;let it=tt&&et&&typeof nt.importKey==k,at=tt&&et&&typeof nt.deriveBits==k;class ft extends d{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:s,checkAuthenticationCode:c=!0}){super({start(){lt(this,t,n,e)},async transform(t,n){const e=this,{password:c,strength:i,nt:a,ready:f}=e;c?(await async function(t,n,e,s){const o=await ht(t,n,e,dt(s,0,X[n])),c=dt(s,X[n]);if(o[0]!=c[0]||o[1]!=c[1])throw new r(O)}(e,i,c,dt(t,0,X[i]+2)),t=dt(t,X[i]+2),s?n.error(new r(j)):a()):await f;const u=new o(t.length-Z-(t.length-Z)%N);n.enqueue(wt(e,t,u,0,Z,!0))},async flush(t){const{et:n,st:e,ot:s,ready:o}=this;if(e&&n){await o;const i=dt(s,0,s.length-Z),a=dt(s,s.length-Z);let f=z;if(i.length){const t=mt(st,i);e.update(t);const s=n.update(t);f=yt(st,s)}const u=dt(yt(st,e.digest()),0,Z);let l=s.length<Z?1:0;for(let t=0;t<Z;t++)l|=u[t]^a[t];if(l&&c)throw new r("Invalid authentication code");t.enqueue(f)}}})}}class ut extends d{constructor({password:t,rawPassword:n,encryptionStrength:e}){super({start(){lt(this,t,n,e)},async transform(t,n){const e=this,{password:s,strength:r,nt:c,ready:i}=e;let a=z;s?(a=await async function(t,n,e){const s=H(new o(X[n]));return W(s,await ht(t,n,e,s))}(e,r,s),c()):await i;const f=new o(a.length+t.length-t.length%N);f.set(a,0),n.enqueue(wt(e,t,f,a.length,0))},async flush(t){const{et:n,st:e,ot:s,ready:r}=this;if(e&&n){await r;let o=z;if(s.length){const t=n.update(mt(st,s));e.update(t),o=yt(st,t)}const c=yt(st,e.digest()).slice(0,Z);t.enqueue(W(o,c))}}})}}function lt(t,e,s,r){n.assign(t,{ready:new l(n=>t.nt=n),password:pt(e,s),strength:r-1,ot:z})}function wt(t,n,e,s,r,c){const{et:i,st:a,ot:f}=t;f.length&&(n=W(f,n));const u=n.length-r;let l;for(e=function(t,n){if(n&&n>t.length){const e=t;(t=new o(n)).set(e,0)}return t}(e,s+(u-u%N)),l=0;l<=u-N;l+=N){const t=mt(st,dt(n,l,l+N));c&&a.update(t);const r=i.update(t);c||a.update(r),e.set(yt(st,r),l+s)}return t.ot=dt(n,l),e}async function ht(e,s,r,c){e.password=null;const i=await async function(t,n,e,s,r){if(!it)return E.importKey(n);try{return await nt.importKey("raw",n,e,!1,r)}catch{return it=!1,E.importKey(n)}}(0,r,G,0,Q),a=await async function(t,n,e){if(!at)return E.T(n,t.salt,J.iterations,e);try{return await nt.deriveBits(t,n,e)}catch{return at=!1,E.T(n,t.salt,J.iterations,e)}}(n.assign({salt:c},J),i,8*(2*Y[s]+2)),f=new o(a),u=mt(st,dt(f,0,Y[s])),l=mt(st,dt(f,Y[s],2*Y[s])),w=dt(f,2*Y[s]);return n.assign(e,{keys:{key:u,ct:l,passwordVerification:w},et:new ot(new rt(u),t.from($)),st:new ct(l)}),w}function pt(t,n){return n===v?function(t){if(typeof w==b){t=unescape(encodeURIComponent(t));const n=new o(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new w).encode(t)}(t):n}function dt(t,n,e){return t.subarray(n,e)}function yt(t,n){return t.v(n)}function mt(t,n){return t.C(n)}class St extends d{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:s}){super({start(){vt(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=bt(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new r(O);t=t.subarray(12)}s?n.error(new r(j)):n.enqueue(bt(e,t))}})}}class gt extends d{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){vt(this,t,n,e)},transform(t,n){const e=this;let s,r;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=H(new o(12));n[11]=e.passwordVerification,s=new o(t.length+n.length),s.set(kt(e,n),0),r=12}else s=new o(t.length),r=0;s.set(kt(e,t),r),n.enqueue(s)}})}}function vt(t,e,s,r){n.assign(t,{password:e,rawPassword:s,passwordVerification:r}),function(t,e,s){const r=[305419896,591751049,878082192];if(n.assign(t,{keys:r,it:new R(r[0]),ft:new R(r[2])}),s)for(let n=0;n<s.length;n++)zt(t,s[n]);else for(let n=0;n<e.length;n++)zt(t,e.charCodeAt(n))}(t,e,s)}function bt(t,n){const e=new o(n.length);for(let s=0;s<n.length;s++)e[s]=Ct(t)^n[s],zt(t,e[s]);return e}function kt(t,n){const e=new o(n.length);for(let s=0;s<n.length;s++)e[s]=Ct(t)^n[s],zt(t,n[s]);return e}function zt(t,n){let[,e]=t.keys;t.it.append([n]);const r=~t.it.get();e=At(s.imul(At(e+It(r)),134775813)+1),t.ft.append([e>>>24]);const o=~t.ft.get();t.keys=[r,e,o]}function Ct(t){const n=2|t.keys[2];return It(s.imul(n,1^n)>>>8)}function It(t){return 255&t}function At(t){return 4294967295&t}function xt(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){const{value:e,done:s}=await n.read();s?t.close():t.enqueue(e)},cancel:t=>n.cancel(t)})}const Mt=new f;function Pt(t){return Mt.get(t)}const Bt="Invalid uncompressed size",Dt="deflate-raw",Ft="gzip",Rt=[31,139,8];class Ut extends d{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:s}){super({});const{compressed:r,encrypted:o,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:l,format:w,compressionMethod:h,inputSize:p}=t,d=this;let y,m,S,g=super.readable;const v=w&&Pt(w),b=a&&r&&!l&&!v&&(!o||i)&&Boolean(c&&s);if(o&&!i||!a||b||(y=new U,g=Lt(g,y)),r)if(v)g=Ot(g,Kt(v.CompressionStream,w,{level:f,chunkSize:n,compressionMethod:h,uncompressedSize:p}));else if(b)S=new Wt,g=Ot(g,new s(Ft)),g=Lt(g,S);else try{g=Et(g,c,{level:f,chunkSize:n},s,e)}catch(t){let n;try{n=new s(Ft)}catch{throw t}g=Ot(g,n),g=Lt(g,new Wt)}o&&(i?g=Lt(g,new gt(t)):(m=new ut(t),g=Lt(g,m))),Vt(d,g,()=>{o&&!i||!a||(d.crc32=b?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Wt extends d{constructor(){let t,n=10,e=new o(0);super({transform(t,r){if(n){const e=s.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const o=e.length+t.length;if(o<=8)return void(e=W(e,t));const c=o-8,i=s.min(c,e.length);r.enqueue(W(e.subarray(0,i),t.subarray(0,c-i))),e=W(e.subarray(i),t.subarray(c-i))},flush(){const n=_(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class _t extends d{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:s}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:w,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:b}=t;let k,z,C=super.readable;if(i&&(c?C=Lt(C,new St(t)):(z=new ft(t),C=Lt(C,z))),w){const t=m&&Pt(m);if(t)C=Ot(C,Kt(t.DecompressionStream,m,{chunkSize:n,compressionMethod:S,rawBitFlag:g,uncompressedSize:b}));else try{C=Et(C,h,{chunkSize:n,deflate64:p},s,e)}catch(t){if(p||b===v)throw t;let n;try{n=new s(Ft)}catch{throw t}C=function(t,n,e){const s=new R;let c,i,a,f=0,u=!1;const w=new l((t,n)=>{i=t,a=n});w.catch(()=>{}),e||i();const h=new d({start(t){const n=new o(10);n.set(Rt),t.enqueue(n)},transform(t,n){n.enqueue(t)},async flush(t){u=!0,y();try{await w}finally{m()}const n=new o(8),r=_(n);r.setUint32(0,s.get(),!0),r.setUint32(4,e,!0),t.enqueue(n)},cancel(t){a(t)}}),p=new d({transform(t,n){s.append(t),f+=t.length,f>=e?i():u&&y(),n.enqueue(t)},cancel(t){a(t)}});return t=Lt(t,h),Lt(t=Ot(t,n),p);function y(){m(),c=setTimeout(()=>a(new r(Bt)),5e3)}function m(){clearTimeout(c)}}(C,n,b)}C=function(t){const n=t.getReader();return new y({async pull(t){let e;try{e=await n.read()}catch(t){if(t&&t.message)throw t;const n=new r("Invalid compressed data");throw n.cause=t,n}const{value:s,done:o}=e;o?t.close():t.enqueue(s)},cancel:t=>n.cancel(t)})}(C)}a&&(k=new U,C=Lt(C,k)),Vt(this,C,()=>{if(a){const t=new u(k.value.buffer);if(f!=t.getUint32(0,!1))throw new r("Invalid CRC32")}})}}const Tt=new f;function Vt(t,e,s){e=Lt(e,new d({flush:s})),n.defineProperty(t,"readable",{get:()=>e})}function Kt(t,n,e){if(!t)throw new r("Compression method not supported");return new t(n,e)}function Et(t,n,e,s,r){const o=n&&s?s:r||s,c=e.deflate64?"deflate64-raw":Dt;let i;try{i=new o(c,e)}catch(t){if(!n||!r||o==r)throw t;i=new r(c,e)}return Ot(t,i)}function Lt(t,n){return xt(t).pipeThrough(n)}function Ot(t,n){const e=n.writable.getWriter(),s=t.getReader();return async function(){try{for(;;){await e.ready;const t=await s.read();if(t.done){await e.close();break}await e.write(t.value)}}catch(t){await async function(t,n){try{await t.abort(n)}catch{}}(e,t),await async function(t,n){try{await t.cancel(n)}catch{}}(s,t)}}(),n.readable}const jt="data",Ht="close",Nt="deflate";class qt extends d{constructor(t,e){super({});const s=this,{codecType:o}=t;let c;o.startsWith(Nt)?c=Ut:o.startsWith("inflate")&&(c=_t),s.outputSize=0;let i=0;const a=new c(t,e),f=super.readable,u=new d({transform(t,n){t&&t.length&&(i+=t.length,n.enqueue(t))},flush(){n.assign(s,{inputSize:i})}}),l=new d({transform(n,e){if(n&&n.length&&(e.enqueue(n),s.outputSize+=n.length,t.outputSize!==v&&s.outputSize>t.outputSize))throw new r(Bt)},flush(){const{crc32:t}=a;n.assign(s,{crc32:t,inputSize:i})}});n.defineProperty(s,"readable",{get:()=>f.pipeThrough(u).pipeThrough(a).pipeThrough(l)})}}class Gt extends d{constructor(t){const n=[];let s=0;function r(){const e=new o(t);let r=0;for(;r<t;){const s=n[0],o=t-r;s.length<=o?(e.set(s,r),r+=s.length,n.shift()):(e.set(s.subarray(0,o),r),n[0]=s.subarray(o),r+=o)}return s-=t,e}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(e,o){for(n.push(e),s+=e.length;s>t;)o.enqueue(r())},flush(t){s&&t.enqueue(function(t,n){const e=new o(n);let s=0;for(const n of t)e.set(n,s),s+=n.length;return e}(n,s))}})}}let Jt=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(Jt=navigator.hardwareConcurrency)}catch{}const Qt=new f,Xt=new f;let Yt,Zt=0;async function $t(t){let n,o;try{const{options:c,config:i}=t;if(c.format)try{await async function(t,n){!Mt.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:s}=n;if(typeof e!=k&&typeof s!=k)throw new r("Invalid codec module");Mt.set(t,{CompressionStream:e,DecompressionStream:s})}(t,await(import(n)))}(c.format,c.codecURI)}catch(t){throw t.codecImportFailed=!0,t}if(i.CompressionStream=self.CompressionStream,i.DecompressionStream=self.DecompressionStream,c.compressed&&!c.format)if(c.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=Tt.get(t);e||(e=new f,Tt.set(t,e));let s=e.get(n);if(s===v){try{new t(n),s=!0}catch{s=!1}e.set(n,s)}return s}(c.codecType.startsWith(Nt)?i.CompressionStream:i.DecompressionStream,Dt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{c.useCompressionStream=!0}!i.CompressionStreamFallback&&i.CompressionStreamZlib&&(i.CompressionStreamFallback=i.CompressionStreamZlib),!i.DecompressionStreamFallback&&i.DecompressionStreamZlib&&(i.DecompressionStreamFallback=i.DecompressionStreamZlib);const a={highWaterMark:1},u=t.readable?xt(t.readable):new y({async pull(t){const n=new l(t=>Qt.set(Zt,t));tn({type:"pull",messageId:Zt}),Zt=(Zt+1)%e.MAX_SAFE_INTEGER;const{value:s,done:r}=await n;t.enqueue(s),r&&t.close()}},a);o=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const s=new l(t=>n=t);Xt.set(Zt,n),tn({type:jt,value:t,messageId:Zt}),Zt=(Zt+1)%e.MAX_SAFE_INTEGER,await s}},a),n=new qt(c,i),Yt=new AbortController;const{signal:w}=Yt;await u.pipeThrough(n).pipeThrough(new Gt(function(t){return r="string"==typeof(n=r=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(r)&&r>=1?s.max(r,64):65536;var n,r}(i))).pipeTo(o,{signal:w,preventClose:!0,preventAbort:!0}),await o.getWriter().close();const{crc32:h,inputSize:p,outputSize:d}=n;tn({type:Ht,result:{crc32:h,inputSize:p,outputSize:d}})}catch(t){if(t.outputSize=n?n.outputSize:0,o&&!o.locked)try{await o.getWriter().close()}catch{}nn(t)}}function tn(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new o(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function nn(t=new r("Unknown error")){const{message:n,stack:e,code:s,name:o,outputSize:c,cause:i,codecImportFailed:a}=t,f={message:n,stack:e,code:s,name:o,outputSize:c};i&&(f.cause={name:i.name,message:i.message}),a&&(f.codecImportFailed=!0),p({error:f})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:s,done:r}=t;try{if("start"==n&&$t(t),n==jt){const t=Qt.get(e);Qt.delete(e),t({value:s||new o,done:r})}if("ack"==n){const t=Xt.get(e);Xt.delete(e),t()}n==Ht&&Yt.abort()}catch(t){nn(t)}}),p({type:"ready"});const en="deflate",sn="deflate-raw",rn="deflate64-raw",on="gzip";let cn,an,fn,un,ln;function wn(t,n,e={}){if(!cn){const t=new r("WASM module not loaded");throw t.cause=ln,t}const c="number"==typeof e.level?e.level:-1,i="number"==typeof e.outBuffer?e.outBuffer:65536,a="number"==typeof e.inBufferSize?e.inBufferSize:65536;return new d({start(){try{let e;if(this.ut=an(i),this.in=an(a),this.inBufferSize=a,!this.ut||!this.in)throw new r("allocation failed");if(this.lt=new o(i),t?(this.wt=cn.deflate_process,this.ht=cn.deflate_last_consumed,this.yt=cn.deflate_end,this.St=cn.deflate_new(),e=n===on?cn.deflate_init_gzip(this.St,c):n===sn?cn.deflate_init_raw(this.St,c):cn.deflate_init(this.St,c)):n===rn?(this.wt=cn.inflate9_process,this.ht=cn.inflate9_last_consumed,this.yt=cn.inflate9_end,this.St=cn.inflate9_new(),e=cn.inflate9_init_raw(this.St)):(this.wt=cn.inflate_process,this.ht=cn.inflate_last_consumed,this.yt=cn.inflate_end,this.St=cn.inflate_new(),e=n===sn?cn.inflate_init_raw(this.St):n===on?cn.inflate_init_gzip(this.St):cn.inflate_init(this.St)),0!==e)throw new r("init failed:"+e)}catch(t){throw f(this),t}},transform(t,n){try{const e=t,c=new o(un.buffer),a=this.wt,f=this.ht,u=this.ut,l=this.lt;let w=0;for(;w<e.length;){const t=s.min(e.length-w,32768);if((!this.in||this.inBufferSize<t)&&(this.in&&fn&&(fn(this.in),this.in=0),this.in=an(t),this.inBufferSize=t,!this.in))throw new r("allocation failed");c.set(e.subarray(w,w+t),this.in);const o=a(this.St,this.in,t,u,i,0),h=o>>24&255,p=128&h?h-256:h;if(p<0)throw new r("process error:"+p);const d=16777215&o;d&&(l.set(c.subarray(u,u+d),0),n.enqueue(l.slice(0,d)));const y=f(this.St);if(0===y&&0===d)break;w+=y}}catch(t){f(this),n.error(t)}},flush(t){try{const n=new o(un.buffer),e=this.wt,s=this.ut,c=this.lt;for(;;){const o=e(this.St,0,0,s,i,4),a=o>>24&255,f=128&a?a-256:a;if(f<0)throw new r("process error:"+f);const u=16777215&o;if(u&&(c.set(n.subarray(s,s+u),0),t.enqueue(c.slice(0,u))),1===a||0===u)break}}catch(n){t.error(n)}finally{const n=f(this);0!==n&&t.error(new r("end error:"+n))}},cancel(){f(this)}});function f(t){let n=0;return t.St&&t.yt&&(n=t.yt(t.St)),t.St=0,t.in&&fn&&fn(t.in),t.in=0,t.ut&&fn&&fn(t.ut),t.ut=0,n}}class hn{constructor(t=en,n){return wn(!0,t,n)}}class pn{constructor(t=en,n){return wn(!1,t,n)}}hn.gt=!0,pn.gt=!0,hn.vt=[en,sn,on],pn.vt=[en,sn,on,rn];let dn=!1;!function(t={}){const{init:n}=t,e=t.CompressionStreamFallback||t.CompressionStreamZlib,s=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{n&&await n(t),e&&(t.CompressionStreamFallback=e),s&&(t.DecompressionStreamFallback=s)}}({CompressionStreamFallback:hn,DecompressionStreamFallback:pn,init:t=>async function(t,{baseURI:n}){if(!dn)try{await async function(t,n){let e,s;try{try{s=new URL(t,n)}catch{}const r=await fetch(s);e=await r.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),s=e.length,r=new o(s);for(let t=0;t<s;++t)r[t]=e.charCodeAt(t);return r.buffer}(t)}!function(t){if(cn=t,({malloc:an,free:fn,memory:un}=cn),"function"!=typeof an||"function"!=typeof fn||!un)throw cn=an=fn=un=null,new r("Invalid WASM module")}((await WebAssembly.instantiate(e)).instance.exports)}(t,n),dn=!0}catch(t){throw function(t){ln=t}(t),t}}(t.wasmURI,t)})});\n';if("string"==typeof s&&(s=(new TextEncoder).encode(s)),t){const t=new Blob([s],{type:n});return URL.createObjectURL(t)}return "data:"+n+";base64,"+function(t){let n="";const s=t.length;let r=0;for(;r+2<s;r+=3){const s=t[r]<<16|t[r+1]<<8|t[r+2];n+=e$1[s>>18&63]+e$1[s>>12&63]+e$1[s>>6&63]+e$1[63&s];}const o=s-r;if(1===o){const s=t[r]<<16;n+=e$1[s>>18&63]+e$1[s>>12&63]+"==";}else if(2===o){const s=t[r]<<16|t[r+1]<<8;n+=e$1[s>>18&63]+e$1[s>>12&63]+e$1[s>>6&63]+"=";}return n}(s)}});
|
|
448
|
+
const t$1=new Uint8Array(288);t$1.fill(8,0,144),t$1.fill(9,144,256),t$1.fill(7,256,280),t$1.fill(8,280,288),new Uint8Array(30).fill(5);const e$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n$1=t=>t({workerURI:t=>{const n="text/javascript";let r='!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";const{Array:t,Object:n,Number:e,Math:r,Error:s,Uint8Array:o,Uint16Array:c,Uint32Array:i,Int32Array:a,Map:f,DataView:u,Promise:l,TextEncoder:w,crypto:h,postMessage:p,TransformStream:d,ReadableStream:y,WritableStream:m,CompressionStream:S,DecompressionStream:g}=self,v=void 0,b="undefined",k="function",z=new o,C=[[],[],[],[],[],[],[],[]];for(let t=0;t<256;t++){let n=t;for(let t=0;t<8;t++)n=1&n?n>>>1^3988292384:n>>>1;C[0][t]=n}for(let t=0;t<256;t++)for(let n=1;n<8;n++){const e=C[n-1][t];C[n][t]=e>>>8^C[0][255&e]}const[I,A,x,M,P,B,D,F]=C;class R{constructor(t){this.o=t||-1}append(t){let n=0|this.o;const e=0|t.length;let r=0;if(e>=8&&t.buffer){const s=new u(t.buffer,t.byteOffset,e),o=e-8;for(;r<=o;r+=8){const t=n^s.getInt32(r,!0),e=s.getInt32(r+4,!0);n=F[255&t]^D[t>>>8&255]^B[t>>>16&255]^P[t>>>24&255]^M[255&e]^x[e>>>8&255]^A[e>>>16&255]^I[e>>>24&255]}}for(;r<e;r++)n=n>>>8^I[255&(n^t[r])];this.o=n}get(){return~this.o}}class U extends d{constructor(){let t;const n=new R;super({transform(t,e){n.append(t),e.enqueue(t)},flush(){const e=new o(4);new u(e.buffer).setUint32(0,n.get()),t.value=e}}),t=this}}function V(t,n){const e=new o(t.length+n.length);return e.set(t),e.set(n,t.length),e}function W(t){return new u(t.buffer,t.byteOffset,t.byteLength)}const _={concat(t,n){if(0===t.length||0===n.length)return t.concat(n);const e=t[t.length-1],r=_.l(e);return 32===r?t.concat(n):_.h(n,r,0|e,t.slice(0,t.length-1))},bitLength(t){const n=t.length;if(0===n)return 0;const e=t[n-1];return 32*(n-1)+_.l(e)},m(t,n){if(32*t.length<n)return t;const e=(t=t.slice(0,r.ceil(n/32))).length;return n&=31,e>0&&n&&(t[e-1]=_.S(n,t[e-1]&2147483648>>n-1,1)),t},S:(t,n,e)=>32===t?n:(e?0|n:n<<32-t)+1099511627776*t,l:t=>r.round(t/1099511627776)||32,h(t,n,e,r){for(void 0===r&&(r=[]);n>=32;n-=32)r.push(e),e=0;if(0===n)return r.concat(t);for(let s=0;s<t.length;s++)r.push(e|t[s]>>>n),e=t[s]<<32-n;const s=t.length?t[t.length-1]:0,o=_.l(s);return r.push(_.S(n+o&31,n+o>32?e:r.pop(),1)),r}},T={bytes:{v(t){const n=_.bitLength(t)/8,e=new o(n);let r;for(let s=0;s<n;s++)3&s||(r=t[s/4]),e[s]=r>>>24,r<<=8;return e},C(t){const n=[];let e,r=0;for(e=0;e<t.length;e++)r=r<<8|t[e],3&~e||(n.push(r),r=0);return 3&e&&n.push(_.S(8*(3&e),r)),n}}},K=class{constructor(t){const n=this;n.blockSize=512,n.I=[1732584193,4023233417,2562383102,271733878,3285377520],n.A=[1518500249,1859775393,2400959708,3395469782],t?(n.M=t.M.slice(0),n.P=t.P.slice(0),n.B=t.B):n.reset()}reset(){const t=this;return t.M=t.I.slice(0),t.P=[],t.B=0,t}update(t){const n=this;"string"==typeof t&&(t=T.D.C(t));const e=n.P=_.concat(n.P,t),r=n.B,o=n.B=r+_.bitLength(t);if(o>9007199254740991)throw new s("Cannot hash more than 2^53 - 1 bits");const c=new i(e);let a=0;for(let t=n.blockSize+r-(n.blockSize+r&n.blockSize-1);t<=o;t+=n.blockSize)n.F(c.subarray(16*a,16*(a+1))),a+=1;return e.splice(0,16*a),n}R(){const t=this;let n=t.P;const e=t.M;n=_.concat(n,[_.S(1,1)]);for(let t=n.length+2;15&t;t++)n.push(0);for(n.push(r.floor(t.B/4294967296)),n.push(0|t.B);n.length;)t.F(n.splice(0,16));return t.reset(),e}U(t,n,e,r){return t<=19?n&e|~n&r:t<=39?n^e^r:t<=59?n&e|n&r|e&r:t<=79?n^e^r:void 0}V(t,n){return n<<t|n>>>32-t}F(n){const e=this,s=e.M,o=t(80);for(let t=0;t<16;t++)o[t]=n[t];let c=s[0],i=s[1],a=s[2],f=s[3],u=s[4];for(let t=0;t<=79;t++){t>=16&&(o[t]=e.V(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const n=e.V(5,c)+e.U(t,i,a,f)+u+o[t]+e.A[r.floor(t/20)]|0;u=f,f=a,a=e.V(30,i),i=c,c=n}s[0]=s[0]+c|0,s[1]=s[1]+i|0,s[2]=s[2]+a|0,s[3]=s[3]+f|0,s[4]=s[4]+u|0}},j={importKey:t=>new j.W(T.bytes.C(t)),_(t,n,e,r){if(e=e||1e4,r<0||e<0)throw new s("invalid params to pbkdf2");const o=1+(r>>5)<<2;let c,i,a,f,l;const w=new ArrayBuffer(o),h=new u(w);let p=0;const d=_;for(n=T.bytes.C(n),l=1;p<(o||1);l++){for(c=i=t.encrypt(d.concat(n,[l])),a=1;a<e;a++)for(i=t.encrypt(i),f=0;f<i.length;f++)c[f]^=i[f];for(a=0;p<(o||1)&&a<c.length;a++)h.setInt32(p,c[a]),p+=4}return w.slice(0,r/8)},W:class{constructor(t){const n=this,e=n.T=K,r=[[],[]];n.K=[new e,new e];const s=n.K[0].blockSize/32;t.length>s&&(t=(new e).update(t).R());for(let n=0;n<s;n++)r[0][n]=909522486^t[n],r[1][n]=1549556828^t[n];n.K[0].update(r[0]),n.K[1].update(r[1]),n.j=new e(n.K[0])}reset(){const t=this;t.j=new t.T(t.K[0]),t.L=!1}update(t){this.L=!0,this.j.update(t)}digest(){const t=this,n=t.j.R(),e=new t.T(t.K[1]).update(n).R();return t.reset(),e}encrypt(t){if(this.L)throw new s("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},E=typeof h!=b&&typeof h.getRandomValues==k,L="Invalid password",O="zipjs-abort-check-password";function H(t){if(E)return h.getRandomValues(t);throw new s("Crypto API not supported")}const N=16,q={name:"PBKDF2"},G=n.assign({hash:{name:"HMAC"}},q),J=n.assign({iterations:1e3,hash:{name:"SHA-1"}},q),Q=["deriveBits"],X=[8,12,16],Y=[16,24,32],Z=10,$=[0,0,0,0],tt=typeof h!=b,nt=tt&&h.subtle,et=tt&&typeof nt!=b,rt=T.bytes,st=class{constructor(t){const n=this;n.O=[[[],[],[],[],[]],[[],[],[],[],[]]],n.O[0][0][0]||n.H();const e=n.O[0][4],r=n.O[1],o=t.length;let c,i,a,f=1;if(4!==o&&6!==o&&8!==o)throw new s("invalid aes key size");for(n.A=[i=t.slice(0),a=[]],c=o;c<4*o+28;c++){let t=i[c-1];(c%o===0||8===o&&c%o===4)&&(t=e[t>>>24]<<24^e[t>>16&255]<<16^e[t>>8&255]<<8^e[255&t],c%o===0&&(t=t<<8^t>>>24^f<<24,f=f<<1^283*(f>>7))),i[c]=i[c-o]^t}for(let t=0;c;t++,c--){const n=i[3&t?c:c-4];a[t]=c<=4||t<4?n:r[0][e[n>>>24]]^r[1][e[n>>16&255]]^r[2][e[n>>8&255]]^r[3][e[255&n]]}}encrypt(t){return this.N(t,0)}decrypt(t){return this.N(t,1)}H(){const t=this.O[0],n=this.O[1],e=t[4],r=n[4],s=[],o=[];let c,i,a,f;for(let t=0;t<256;t++)o[(s[t]=t<<1^283*(t>>7))^t]=t;for(let u=c=0;!e[u];u^=i||1,c=o[c]||1){let o=c^c<<1^c<<2^c<<3^c<<4;o=o>>8^255&o^99,e[u]=o,r[o]=u,f=s[a=s[i=s[u]]];let l=16843009*f^65537*a^257*i^16843008*u,w=257*s[o]^16843008*o;for(let e=0;e<4;e++)t[e][u]=w=w<<24^w>>>8,n[e][o]=l=l<<24^l>>>8}for(let e=0;e<5;e++)t[e]=t[e].slice(0),n[e]=n[e].slice(0)}N(t,n){if(4!==t.length)throw new s("invalid aes block size");const e=this.A[n],r=e.length/4-2,o=[0,0,0,0],c=this.O[n],i=c[0],a=c[1],f=c[2],u=c[3],l=c[4];let w,h,p,d=t[0]^e[0],y=t[n?3:1]^e[1],m=t[2]^e[2],S=t[n?1:3]^e[3],g=4;for(let t=0;t<r;t++)w=i[d>>>24]^a[y>>16&255]^f[m>>8&255]^u[255&S]^e[g],h=i[y>>>24]^a[m>>16&255]^f[S>>8&255]^u[255&d]^e[g+1],p=i[m>>>24]^a[S>>16&255]^f[d>>8&255]^u[255&y]^e[g+2],S=i[S>>>24]^a[d>>16&255]^f[y>>8&255]^u[255&m]^e[g+3],g+=4,d=w,y=h,m=p;for(let t=0;t<4;t++)o[n?3&-t:t]=l[d>>>24]<<24^l[y>>16&255]<<16^l[m>>8&255]<<8^l[255&S]^e[g++],w=d,d=y,y=m,m=S,S=w;return o}},ot=class{constructor(t,n){this.G=t,this.J=n,this.X=n}reset(){this.X=this.J}update(t){return this.Y(this.G,t,this.X)}Z(t){if(255&~(t>>24))t+=1<<24;else{let n=t>>16&255,e=t>>8&255,r=255&t;255===n?(n=0,255===e?(e=0,255===r?r=0:++r):++e):++n,t=0,t+=n<<16,t+=e<<8,t+=r}return t}$(t){0===(t[0]=this.Z(t[0]))&&(t[1]=this.Z(t[1]))}Y(t,n,e){let r;if(!(r=n.length))return[];const s=_.bitLength(n);for(let s=0;s<r;s+=4){this.$(e);const r=t.encrypt(e);n[s]^=r[0],n[s+1]^=r[1],n[s+2]^=r[2],n[s+3]^=r[3]}return _.m(n,s)}},ct=j.W;let it=tt&&et&&typeof nt.importKey==k,at=tt&&et&&typeof nt.deriveBits==k;class ft extends d{constructor({password:t,rawPassword:n,encryptionStrength:e,checkPasswordOnly:r,checkAuthenticationCode:c=!0}){super({start(){lt(this,t,n,e)},async transform(t,n){const e=this,{password:c,strength:i,nt:a,ready:f}=e;c?(await async function(t,n,e,r){const o=await ht(t,n,e,dt(r,0,X[n])),c=dt(r,X[n]);if(o[0]!=c[0]||o[1]!=c[1])throw new s(L)}(e,i,c,dt(t,0,X[i]+2)),t=dt(t,X[i]+2),r?n.error(new s(O)):a()):await f;const u=new o(t.length-Z-(t.length-Z)%N);n.enqueue(wt(e,t,u,0,Z,!0))},async flush(t){const{et:n,st:e,ot:r,ready:o}=this;if(e&&n){await o;const i=dt(r,0,r.length-Z),a=dt(r,r.length-Z);let f=z;if(i.length){const t=mt(rt,i);e.update(t);const r=n.update(t);f=yt(rt,r)}const u=dt(yt(rt,e.digest()),0,Z);let l=r.length<Z?1:0;for(let t=0;t<Z;t++)l|=u[t]^a[t];if(l&&c)throw new s("Invalid authentication code");t.enqueue(f)}}})}}class ut extends d{constructor({password:t,rawPassword:n,encryptionStrength:e}){super({start(){lt(this,t,n,e)},async transform(t,n){const e=this,{password:r,strength:s,nt:c,ready:i}=e;let a=z;r?(a=await async function(t,n,e){const r=H(new o(X[n]));return V(r,await ht(t,n,e,r))}(e,s,r),c()):await i;const f=new o(a.length+t.length-t.length%N);f.set(a,0),n.enqueue(wt(e,t,f,a.length,0))},async flush(t){const{et:n,st:e,ot:r,ready:s}=this;if(e&&n){await s;let o=z;if(r.length){const t=n.update(mt(rt,r));e.update(t),o=yt(rt,t)}const c=yt(rt,e.digest()).slice(0,Z);t.enqueue(V(o,c))}}})}}function lt(t,e,r,s){n.assign(t,{ready:new l(n=>t.nt=n),password:pt(e,r),strength:s-1,ot:z})}function wt(t,n,e,r,s,c){const{et:i,st:a,ot:f}=t;f.length&&(n=V(f,n));const u=n.length-s;let l;for(e=function(t,n){if(n&&n>t.length){const e=t;(t=new o(n)).set(e,0)}return t}(e,r+(u-u%N)),l=0;l<=u-N;l+=N){const t=mt(rt,dt(n,l,l+N));c&&a.update(t);const s=i.update(t);c||a.update(s),e.set(yt(rt,s),l+r)}return t.ot=dt(n,l),e}async function ht(e,r,s,c){e.password=null;const i=await async function(t,n,e,r,s){if(!it)return j.importKey(n);try{return await nt.importKey("raw",n,e,!1,s)}catch{return it=!1,j.importKey(n)}}(0,s,G,0,Q),a=await async function(t,n,e){if(!at)return j._(n,t.salt,J.iterations,e);try{return await nt.deriveBits(t,n,e)}catch{return at=!1,j._(n,t.salt,J.iterations,e)}}(n.assign({salt:c},J),i,8*(2*Y[r]+2)),f=new o(a),u=mt(rt,dt(f,0,Y[r])),l=mt(rt,dt(f,Y[r],2*Y[r])),w=dt(f,2*Y[r]);return n.assign(e,{keys:{key:u,ct:l,passwordVerification:w},et:new ot(new st(u),t.from($)),st:new ct(l)}),w}function pt(t,n){return n===v?function(t){if(typeof w==b){t=unescape(encodeURIComponent(t));const n=new o(t.length);for(let e=0;e<n.length;e++)n[e]=t.charCodeAt(e);return n}return(new w).encode(t)}(t):n}function dt(t,n,e){return t.subarray(n,e)}function yt(t,n){return t.v(n)}function mt(t,n){return t.C(n)}class St extends d{constructor({password:t,rawPassword:n,passwordVerification:e,checkPasswordOnly:r}){super({start(){vt(this,t,n,e)},transform(t,n){const e=this;if(e.password||e.rawPassword){const n=bt(e,t.subarray(0,12));if(e.password=e.rawPassword=null,0!=(n[11]^e.passwordVerification))throw new s(L);t=t.subarray(12)}r?n.error(new s(O)):n.enqueue(bt(e,t))}})}}class gt extends d{constructor({password:t,rawPassword:n,passwordVerification:e}){super({start(){vt(this,t,n,e)},transform(t,n){const e=this;let r,s;if(e.password||e.rawPassword){e.password=e.rawPassword=null;const n=H(new o(12));n[11]=e.passwordVerification,r=new o(t.length+n.length),r.set(kt(e,n),0),s=12}else r=new o(t.length),s=0;r.set(kt(e,t),s),n.enqueue(r)}})}}function vt(t,e,r,s){n.assign(t,{password:e,rawPassword:r,passwordVerification:s}),function(t,e,r){const s=[305419896,591751049,878082192];if(n.assign(t,{keys:s,it:new R(s[0]),ft:new R(s[2])}),r)for(let n=0;n<r.length;n++)zt(t,r[n]);else for(let n=0;n<e.length;n++)zt(t,e.charCodeAt(n))}(t,e,r)}function bt(t,n){const e=new o(n.length);for(let r=0;r<n.length;r++)e[r]=Ct(t)^n[r],zt(t,e[r]);return e}function kt(t,n){const e=new o(n.length);for(let r=0;r<n.length;r++)e[r]=Ct(t)^n[r],zt(t,n[r]);return e}function zt(t,n){let[,e]=t.keys;t.it.append([n]);const s=~t.it.get();e=At(r.imul(At(e+It(s)),134775813)+1),t.ft.append([e>>>24]);const o=~t.ft.get();t.keys=[s,e,o]}function Ct(t){const n=2|t.keys[2];return It(r.imul(n,1^n)>>>8)}function It(t){return 255&t}function At(t){return 4294967295&t}function xt(t){if(t instanceof y)return t;const n=t.getReader();return new y({async pull(t){const{value:e,done:r}=await n.read();r?t.close():t.enqueue(e)},cancel:t=>n.cancel(t)})}const Mt=new f;function Pt(t){return Mt.get(t)}const Bt="Invalid uncompressed size",Dt="deflate-raw",Ft="gzip",Rt=[31,139,8];class Ut extends d{constructor(t,{chunkSize:n,CompressionStreamFallback:e,CompressionStream:r}){super({});const{compressed:s,encrypted:o,useCompressionStream:c,zipCrypto:i,computeCrc32:a,level:f,deflate64:l,format:w,compressionMethod:h,inputSize:p}=t,d=this;let y,m,S,g=super.readable;const v=w&&Pt(w),b=a&&s&&!l&&!v&&(!o||i)&&Boolean(c&&r);if(o&&!i||!a||b||(y=new U,g=Et(g,y)),s)if(v)g=Lt(g,Kt(v.CompressionStream,w,{level:f,chunkSize:n,compressionMethod:h,uncompressedSize:p}));else if(b)S=new Vt,g=Lt(g,new r(Ft)),g=Et(g,S);else try{g=jt(g,c,{level:f,chunkSize:n},r,e)}catch(t){let n;try{n=new r(Ft)}catch{throw t}g=Lt(g,n),g=Et(g,new Vt)}o&&(i?g=Et(g,new gt(t)):(m=new ut(t),g=Et(g,m))),Tt(d,g,()=>{o&&!i||!a||(d.crc32=b?S.crc32:new u(y.value.buffer).getUint32(0))})}}class Vt extends d{constructor(){let t,n=10,e=new o(0);super({transform(t,s){if(n){const e=r.min(n,t.length);if(n-=e,!(t=t.subarray(e)).length)return}const o=e.length+t.length;if(o<=8)return void(e=V(e,t));const c=o-8,i=r.min(c,e.length);s.enqueue(V(e.subarray(0,i),t.subarray(0,c-i))),e=V(e.subarray(i),t.subarray(c-i))},flush(){const n=W(e);t.crc32=n.getUint32(0,!0),t.uncompressedSize=n.getUint32(4,!0)}}),t=this}}class Wt extends d{constructor(t,{chunkSize:n,DecompressionStreamFallback:e,DecompressionStream:r}){super({});const{zipCrypto:c,encrypted:i,checkCrc32:a,crc32:f,compressed:w,useCompressionStream:h,deflate64:p,format:m,compressionMethod:S,rawBitFlag:g,outputSize:b}=t;let k,z,C=super.readable;if(i&&(c?C=Et(C,new St(t)):(z=new ft(t),C=Et(C,z))),w){const t=m&&Pt(m);if(t)C=Lt(C,Kt(t.DecompressionStream,m,{chunkSize:n,compressionMethod:S,rawBitFlag:g,uncompressedSize:b}));else try{C=jt(C,h,{chunkSize:n,deflate64:p},r,e)}catch(t){if(p||b===v)throw t;let n;try{n=new r(Ft)}catch{throw t}C=function(t,n,e){const r=new R;let c,i,a,f=0,u=!1;const w=new l((t,n)=>{i=t,a=n});w.catch(()=>{}),e||i();const h=new d({start(t){const n=new o(10);n.set(Rt),t.enqueue(n)},transform(t,n){n.enqueue(t)},async flush(t){u=!0,y();try{await w}finally{m()}const n=new o(8),s=W(n);s.setUint32(0,r.get(),!0),s.setUint32(4,e,!0),t.enqueue(n)},cancel(t){a(t)}}),p=new d({transform(t,n){r.append(t),f+=t.length,f>=e?i():u&&y(),n.enqueue(t)},cancel(t){a(t)}});return t=Et(t,h),Et(t=Lt(t,n),p);function y(){m(),c=setTimeout(()=>a(new s(Bt)),5e3)}function m(){clearTimeout(c)}}(C,n,b)}C=function(t){const n=t.getReader();return new y({async pull(t){let e;try{e=await n.read()}catch(t){if(t&&t.message)throw t;const n=new s("Invalid compressed data");throw n.cause=t,n}const{value:r,done:o}=e;o?t.close():t.enqueue(r)},cancel:t=>n.cancel(t)})}(C)}a&&(k=new U,C=Et(C,k)),Tt(this,C,()=>{if(a){const t=new u(k.value.buffer);if(f!=t.getUint32(0,!1))throw new s("Invalid CRC32")}})}}const _t=new f;function Tt(t,e,r){e=Et(e,new d({flush:r})),n.defineProperty(t,"readable",{get:()=>e})}function Kt(t,n,e){if(!t)throw new s("Compression method not supported");return new t(n,e)}function jt(t,n,e,r,s){const o=n&&r?r:s||r,c=e.deflate64?"deflate64-raw":Dt;let i;try{i=new o(c,e)}catch(t){if(!n||!s||o==s)throw t;i=new s(c,e)}return Lt(t,i)}function Et(t,n){return xt(t).pipeThrough(n)}function Lt(t,n){const e=n.writable.getWriter(),r=t.getReader();return async function(){try{for(;;){await e.ready;const t=await r.read();if(t.done){await e.close();break}await e.write(t.value)}}catch(t){await async function(t,n){try{await t.abort(n)}catch{}}(e,t),await async function(t,n){try{await t.cancel(n)}catch{}}(r,t)}}(),n.readable}const Ot="data",Ht="close",Nt="deflate";class qt extends d{constructor(t,e){super({});const r=this,{codecType:o}=t;let c;o.startsWith(Nt)?c=Ut:o.startsWith("inflate")&&(c=Wt),r.outputSize=0;let i=0;const a=new c(t,e),f=super.readable,u=new d({transform(t,n){t&&t.length&&(i+=t.length,n.enqueue(t))},flush(){n.assign(r,{inputSize:i})}}),l=new d({transform(n,e){if(n&&n.length&&(e.enqueue(n),r.outputSize+=n.length,t.outputSize!==v&&r.outputSize>t.outputSize))throw new s(Bt)},flush(){const{crc32:t}=a;n.assign(r,{crc32:t,inputSize:i})}});n.defineProperty(r,"readable",{get:()=>f.pipeThrough(u).pipeThrough(a).pipeThrough(l)})}}class Gt extends d{constructor(t){const r=[];let s=0,c=0;function i(){const n=new o(t);let e=0;for(;e<t;){const s=r[0],o=t-e;s.length<=o?(n.set(s,e),e+=s.length,r.shift()):(n.set(s.subarray(0,o),e),r[0]=s.subarray(o),e+=o)}return s-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(r.push(n),s+=n.length;s>t;)c+=t,e.enqueue(i())},flush(t){s&&(c+=s,t.enqueue(function(t,n){const e=new o(n);let r=0;for(const n of t)e.set(n,r),r+=n.length;return e}(r,s)))}}),n.defineProperty(this,"outputSize",{get:()=>c})}}let Jt=2;try{typeof navigator!=b&&navigator.hardwareConcurrency&&(Jt=navigator.hardwareConcurrency)}catch{}function Qt(t){return Boolean(t)&&"object"==typeof t}const Xt=new f,Yt=new f,Zt=function(){try{return structuredClone(new s)instanceof s}catch{return!1}}();let $t,tn=0;async function nn(t){let n,o,c;try{const{options:i,config:a}=t;if(i.format)try{await async function(t,n){!Mt.has(t)&&n&&function(t,n){const{CompressionStream:e,DecompressionStream:r}=n;if(typeof e!=k&&typeof r!=k)throw new s("Invalid codec module");Mt.set(t,{CompressionStream:e,DecompressionStream:r})}(t,await(import(n)))}(i.format,i.codecURI)}catch(t){if(Qt(t))try{t.codecImportFailed=!0}catch{}throw t}if(a.CompressionStream=self.CompressionStream,a.DecompressionStream=self.DecompressionStream,i.compressed&&!i.format)if(i.useCompressionStream){if(!function(t,n){if(!t)return!1;let e=_t.get(t);e||(e=new f,_t.set(t,e));let r=e.get(n);if(r===v){try{new t(n),r=!0}catch{r=!1}e.set(n,r)}return r}(i.codecType.startsWith(Nt)?a.CompressionStream:a.DecompressionStream,Dt))try{await self.initModule(t.config)}catch{}}else try{await self.initModule(t.config)}catch{i.useCompressionStream=!0}!a.CompressionStreamFallback&&a.CompressionStreamZlib&&(a.CompressionStreamFallback=a.CompressionStreamZlib),!a.DecompressionStreamFallback&&a.DecompressionStreamZlib&&(a.DecompressionStreamFallback=a.DecompressionStreamZlib);const u={highWaterMark:1},w=t.readable?xt(t.readable):new y({async pull(t){const n=new l(t=>Xt.set(tn,t));en({type:"pull",messageId:tn}),tn=(tn+1)%e.MAX_SAFE_INTEGER;const{value:r,done:s}=await n;t.enqueue(r),s&&t.close()}},u);c=t.writable?function(t){if(t instanceof m)return t;const n=t.getWriter();return new m({write:t=>n.write(t),close:()=>n.close(),abort:t=>n.abort(t)})}(t.writable):new m({async write(t){let n;const r=new l(t=>n=t);Yt.set(tn,n),en({type:Ot,value:t,messageId:tn}),tn=(tn+1)%e.MAX_SAFE_INTEGER,await r}},u),n=new qt(i,a),o=new Gt(function(t){return s="string"==typeof(n=s=t.chunkSize)&&n.trim()?e(n):n,e.isInteger(s)&&s>=1?r.max(s,64):65536;var n,s}(a)),$t=new AbortController;const{signal:h}=$t;await w.pipeThrough(n).pipeThrough(o).pipeTo(c,{signal:h,preventClose:!0,preventAbort:!0}),await c.getWriter().close();const{crc32:p,inputSize:d,outputSize:S}=n;en({type:Ht,result:{crc32:p,inputSize:d,outputSize:S}})}catch(t){const n=o?o.outputSize:0;if(Qt(t))try{t.outputSize=n}catch{}if(c&&!c.locked)try{await c.getWriter().close()}catch{}rn(t,n)}}function en(t){const{value:n}=t;if(n)if(n.length)try{t.value=(e=n,e.byteOffset||e.byteLength!=e.buffer.byteLength?new o(e):e).buffer,p(t,[t.value])}catch{p(t)}else p(t);else p(t);var e}function rn(t,n){const{message:e,stack:r,code:o,name:c,outputSize:i,cause:a,codecImportFailed:f}=function(t=new s("Unknown error")){return Qt(t)?t:new s(String(t))}(t),u={message:e,stack:r,code:o,name:c,outputSize:i===v?n:i};if(a&&(u.cause={name:a.name,message:a.message}),f&&(u.codecImportFailed=!0),Zt)try{return void p({error:u,errorValue:{value:t}})}catch{}p({error:u})}addEventListener("message",({data:t})=>{const{type:n,messageId:e,value:r,done:s}=t;try{if("start"==n&&nn(t),n==Ot){const t=Xt.get(e);Xt.delete(e),t({value:r||new o,done:s})}if("ack"==n){const t=Yt.get(e);Yt.delete(e),t()}n==Ht&&$t.abort()}catch(t){rn(t)}}),p({type:"ready"});const sn="deflate",on="deflate-raw",cn="deflate64-raw",an="gzip";let fn,un,ln,wn,hn;function pn(t,n,e={}){if(!fn){const t=new s("WASM module not loaded");throw t.cause=hn,t}const c="number"==typeof e.level?e.level:-1,i="number"==typeof e.outBuffer?e.outBuffer:65536,a="number"==typeof e.inBufferSize?e.inBufferSize:65536;return new d({start(){try{let e;if(this.ut=un(i),this.in=un(a),this.inBufferSize=a,!this.ut||!this.in)throw new s("allocation failed");if(this.lt=new o(i),t?(this.wt=fn.deflate_process,this.ht=fn.deflate_last_consumed,this.yt=fn.deflate_end,this.St=fn.deflate_new(),e=n===an?fn.deflate_init_gzip(this.St,c):n===on?fn.deflate_init_raw(this.St,c):fn.deflate_init(this.St,c)):n===cn?(this.wt=fn.inflate9_process,this.ht=fn.inflate9_last_consumed,this.yt=fn.inflate9_end,this.St=fn.inflate9_new(),e=fn.inflate9_init_raw(this.St)):(this.wt=fn.inflate_process,this.ht=fn.inflate_last_consumed,this.yt=fn.inflate_end,this.St=fn.inflate_new(),e=n===on?fn.inflate_init_raw(this.St):n===an?fn.inflate_init_gzip(this.St):fn.inflate_init(this.St)),0!==e)throw new s("init failed:"+e)}catch(t){throw f(this),t}},transform(t,n){try{const e=t,c=new o(wn.buffer),a=this.wt,f=this.ht,u=this.ut,l=this.lt;let w=0;for(;w<e.length;){const t=r.min(e.length-w,32768);if((!this.in||this.inBufferSize<t)&&(this.in&&ln&&(ln(this.in),this.in=0),this.in=un(t),this.inBufferSize=t,!this.in))throw new s("allocation failed");c.set(e.subarray(w,w+t),this.in);const o=a(this.St,this.in,t,u,i,0),h=o>>24&255,p=128&h?h-256:h;if(p<0)throw new s("process error:"+p);const d=16777215&o;d&&(l.set(c.subarray(u,u+d),0),n.enqueue(l.slice(0,d)));const y=f(this.St);if(0===y&&0===d)break;w+=y}}catch(t){f(this),n.error(t)}},flush(t){try{const n=new o(wn.buffer),e=this.wt,r=this.ut,c=this.lt;for(;;){const o=e(this.St,0,0,r,i,4),a=o>>24&255,f=128&a?a-256:a;if(f<0)throw new s("process error:"+f);const u=16777215&o;if(u&&(c.set(n.subarray(r,r+u),0),t.enqueue(c.slice(0,u))),1===a||0===u)break}}catch(n){t.error(n)}finally{const n=f(this);0!==n&&t.error(new s("end error:"+n))}},cancel(){f(this)}});function f(t){let n=0;return t.St&&t.yt&&(n=t.yt(t.St)),t.St=0,t.in&&ln&&ln(t.in),t.in=0,t.ut&&ln&&ln(t.ut),t.ut=0,n}}class dn{constructor(t=sn,n){return pn(!0,t,n)}}class yn{constructor(t=sn,n){return pn(!1,t,n)}}dn.gt=!0,yn.gt=!0,dn.vt=[sn,on,an],yn.vt=[sn,on,an,cn];let mn=!1;!function(t={}){const{init:n}=t,e=t.CompressionStreamFallback||t.CompressionStreamZlib,r=t.DecompressionStreamFallback||t.DecompressionStreamZlib;self.initModule=async t=>{n&&await n(t),e&&(t.CompressionStreamFallback=e),r&&(t.DecompressionStreamFallback=r)}}({CompressionStreamFallback:dn,DecompressionStreamFallback:yn,init:t=>async function(t,{baseURI:n}){if(!mn)try{await async function(t,n){let e,r;try{try{r=new URL(t,n)}catch{}const s=await fetch(r);e=await s.arrayBuffer()}catch(n){if(!t.startsWith("data:application/wasm;base64,"))throw n;e=function(t){const n=t.split(",")[1],e=atob(n),r=e.length,s=new o(r);for(let t=0;t<r;++t)s[t]=e.charCodeAt(t);return s.buffer}(t)}!function(t){if(fn=t,({malloc:un,free:ln,memory:wn}=fn),"function"!=typeof un||"function"!=typeof ln||!wn)throw fn=un=ln=wn=null,new s("Invalid WASM module")}((await WebAssembly.instantiate(e)).instance.exports)}(t,n),mn=!0}catch(t){throw function(t){hn=t}(t),t}}(t.wasmURI,t)})});\n';if("string"==typeof r&&(r=(new TextEncoder).encode(r)),t){const t=new Blob([r],{type:n});return URL.createObjectURL(t)}return "data:"+n+";base64,"+function(t){let n="";const r=t.length;let s=0;for(;s+2<r;s+=3){const r=t[s]<<16|t[s+1]<<8|t[s+2];n+=e$1[r>>18&63]+e$1[r>>12&63]+e$1[r>>6&63]+e$1[63&r];}const o=r-s;if(1===o){const r=t[s]<<16;n+=e$1[r>>18&63]+e$1[r>>12&63]+"==";}else if(2===o){const r=t[s]<<16|t[s+1]<<8;n+=e$1[r>>18&63]+e$1[r>>12&63]+e$1[r>>6&63]+"=";}return n}(r)}});
|
|
426
449
|
|
|
427
450
|
/*
|
|
428
451
|
Copyright (c) 2026 Gildas Lormeau. All rights reserved.
|
|
@@ -468,6 +491,39 @@
|
|
|
468
491
|
return new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
469
492
|
}
|
|
470
493
|
|
|
494
|
+
/*
|
|
495
|
+
Copyright (c) 2026 Gildas Lormeau. All rights reserved.
|
|
496
|
+
|
|
497
|
+
Redistribution and use in source and binary forms, with or without
|
|
498
|
+
modification, are permitted provided that the following conditions are met:
|
|
499
|
+
|
|
500
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
501
|
+
this list of conditions and the following disclaimer.
|
|
502
|
+
|
|
503
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
504
|
+
notice, this list of conditions and the following disclaimer in
|
|
505
|
+
the documentation and/or other materials provided with the distribution.
|
|
506
|
+
|
|
507
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
508
|
+
derived from this software without specific prior written permission.
|
|
509
|
+
|
|
510
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
511
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
512
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
513
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
514
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
515
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
516
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
517
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
518
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
519
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
520
|
+
*/
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
function isErrorObject(error) {
|
|
524
|
+
return Boolean(error) && typeof error == "object";
|
|
525
|
+
}
|
|
526
|
+
|
|
471
527
|
/*
|
|
472
528
|
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
473
529
|
|
|
@@ -2607,6 +2663,7 @@
|
|
|
2607
2663
|
constructor(chunkSize) {
|
|
2608
2664
|
const pendingChunks = [];
|
|
2609
2665
|
let pendingLength = 0;
|
|
2666
|
+
let outputSize = 0;
|
|
2610
2667
|
if (!Number.isFinite(chunkSize) || chunkSize < 1) {
|
|
2611
2668
|
chunkSize = DEFAULT_CHUNK_SIZE;
|
|
2612
2669
|
}
|
|
@@ -2615,15 +2672,20 @@
|
|
|
2615
2672
|
pendingChunks.push(chunk);
|
|
2616
2673
|
pendingLength += chunk.length;
|
|
2617
2674
|
while (pendingLength > chunkSize) {
|
|
2675
|
+
outputSize += chunkSize;
|
|
2618
2676
|
controller.enqueue(shiftChunk());
|
|
2619
2677
|
}
|
|
2620
2678
|
},
|
|
2621
2679
|
flush(controller) {
|
|
2622
2680
|
if (pendingLength) {
|
|
2681
|
+
outputSize += pendingLength;
|
|
2623
2682
|
controller.enqueue(concatChunks(pendingChunks, pendingLength));
|
|
2624
2683
|
}
|
|
2625
2684
|
}
|
|
2626
2685
|
});
|
|
2686
|
+
Object.defineProperty(this, "outputSize", {
|
|
2687
|
+
get: () => outputSize
|
|
2688
|
+
});
|
|
2627
2689
|
|
|
2628
2690
|
function shiftChunk() {
|
|
2629
2691
|
const result = new Uint8Array(chunkSize);
|
|
@@ -2733,7 +2795,9 @@
|
|
|
2733
2795
|
|
|
2734
2796
|
class CodecWorker {
|
|
2735
2797
|
|
|
2736
|
-
constructor(workerData, { readable, writable },
|
|
2798
|
+
constructor(workerData, { readable, writable }, workerOptions, onTaskFinished) {
|
|
2799
|
+
const { options, config, streamOptions, useWebWorkers, transferStreams, workerURI } = workerOptions;
|
|
2800
|
+
let { createWorker } = workerOptions;
|
|
2737
2801
|
const { signal } = streamOptions;
|
|
2738
2802
|
if (createWorkerFailed) {
|
|
2739
2803
|
createWorker = UNDEFINED_VALUE;
|
|
@@ -2746,6 +2810,7 @@
|
|
|
2746
2810
|
.pipeThrough(new ProgressWatcherStream(streamOptions), { signal }),
|
|
2747
2811
|
writable,
|
|
2748
2812
|
options: Object.assign({}, options),
|
|
2813
|
+
workerOptions,
|
|
2749
2814
|
workerURI,
|
|
2750
2815
|
createWorker,
|
|
2751
2816
|
transferStreams,
|
|
@@ -2827,8 +2892,8 @@
|
|
|
2827
2892
|
};
|
|
2828
2893
|
}
|
|
2829
2894
|
|
|
2830
|
-
async function runWorker$1({ options, readable, writable, onTaskFinished }, config) {
|
|
2831
|
-
let codecStream;
|
|
2895
|
+
async function runWorker$1({ options, readable, writable, onTaskFinished, workerOptions }, config) {
|
|
2896
|
+
let codecStream, chunkStream;
|
|
2832
2897
|
try {
|
|
2833
2898
|
if (options.compressed && !options.format) {
|
|
2834
2899
|
const deflate = options.codecType.startsWith(CODEC_DEFLATE);
|
|
@@ -2851,9 +2916,10 @@
|
|
|
2851
2916
|
}
|
|
2852
2917
|
}
|
|
2853
2918
|
codecStream = new CodecStream(options, config);
|
|
2919
|
+
chunkStream = new ChunkStream(getChunkSize(config));
|
|
2854
2920
|
await readable
|
|
2855
2921
|
.pipeThrough(codecStream)
|
|
2856
|
-
.pipeThrough(
|
|
2922
|
+
.pipeThrough(chunkStream)
|
|
2857
2923
|
.pipeTo(writable, { preventClose: true, preventAbort: true });
|
|
2858
2924
|
const {
|
|
2859
2925
|
crc32,
|
|
@@ -2867,7 +2933,15 @@
|
|
|
2867
2933
|
};
|
|
2868
2934
|
} catch (error) {
|
|
2869
2935
|
if (codecStream) {
|
|
2870
|
-
|
|
2936
|
+
const outputSize = chunkStream ? chunkStream.outputSize : 0;
|
|
2937
|
+
workerOptions.outputSize = outputSize;
|
|
2938
|
+
if (isErrorObject(error)) {
|
|
2939
|
+
try {
|
|
2940
|
+
error.outputSize = outputSize;
|
|
2941
|
+
} catch {
|
|
2942
|
+
// ignored
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2871
2945
|
}
|
|
2872
2946
|
throw error;
|
|
2873
2947
|
} finally {
|
|
@@ -2976,11 +3050,23 @@
|
|
|
2976
3050
|
let resolveResult, rejectResult;
|
|
2977
3051
|
const result = new Promise((resolve, reject) => {
|
|
2978
3052
|
resolveResult = resolve;
|
|
2979
|
-
rejectResult =
|
|
3053
|
+
rejectResult = error => {
|
|
3054
|
+
const { outputSize, workerOptions } = workerData;
|
|
3055
|
+
workerOptions.outputSize = outputSize;
|
|
3056
|
+
if (isErrorObject(error) && error.outputSize === UNDEFINED_VALUE) {
|
|
3057
|
+
try {
|
|
3058
|
+
error.outputSize = outputSize;
|
|
3059
|
+
} catch {
|
|
3060
|
+
// ignored
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
reject(error);
|
|
3064
|
+
};
|
|
2980
3065
|
});
|
|
2981
3066
|
Object.assign(workerData, {
|
|
2982
3067
|
reader: null,
|
|
2983
3068
|
writer: null,
|
|
3069
|
+
outputSize: 0,
|
|
2984
3070
|
resolveResult,
|
|
2985
3071
|
rejectResult,
|
|
2986
3072
|
result
|
|
@@ -3241,21 +3327,15 @@
|
|
|
3241
3327
|
}
|
|
3242
3328
|
|
|
3243
3329
|
async function onMessage({ data }, workerData) {
|
|
3244
|
-
const { type, value, messageId, result, error } = data;
|
|
3330
|
+
const { type, value, messageId, result, error, errorValue } = data;
|
|
3245
3331
|
const { reader, writer, resolveResult, rejectResult, onTaskFinished, generation } = workerData;
|
|
3246
3332
|
const stale = () => workerData.generation != generation;
|
|
3247
3333
|
try {
|
|
3248
3334
|
if (error) {
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
Object.assign(responseError, { stack, code, name, outputSize });
|
|
3252
|
-
if (cause) {
|
|
3253
|
-
responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
|
|
3254
|
-
}
|
|
3255
|
-
if (codecImportFailed) {
|
|
3256
|
-
responseError.codecImportFailed = true;
|
|
3335
|
+
if (error.outputSize !== UNDEFINED_VALUE) {
|
|
3336
|
+
workerData.outputSize = error.outputSize;
|
|
3257
3337
|
}
|
|
3258
|
-
|
|
3338
|
+
fail(getResponseError(error, errorValue));
|
|
3259
3339
|
} else {
|
|
3260
3340
|
if (type == MESSAGE_PULL) {
|
|
3261
3341
|
const { value, done } = await reader.read();
|
|
@@ -3264,39 +3344,82 @@
|
|
|
3264
3344
|
}
|
|
3265
3345
|
}
|
|
3266
3346
|
if (type == MESSAGE_DATA) {
|
|
3347
|
+
const chunk = new Uint8Array(value);
|
|
3267
3348
|
await writer.ready;
|
|
3268
|
-
await writer.write(
|
|
3349
|
+
await writer.write(chunk);
|
|
3350
|
+
workerData.outputSize += chunk.length;
|
|
3269
3351
|
if (!stale()) {
|
|
3270
3352
|
sendMessage({ type: MESSAGE_ACK_DATA, messageId }, workerData);
|
|
3271
3353
|
}
|
|
3272
3354
|
}
|
|
3273
3355
|
if (type == MESSAGE_CLOSE) {
|
|
3274
|
-
|
|
3356
|
+
succeed(result);
|
|
3275
3357
|
}
|
|
3276
3358
|
}
|
|
3277
3359
|
} catch (error) {
|
|
3278
3360
|
if (!stale()) {
|
|
3279
3361
|
terminateWorker$1(workerData);
|
|
3280
|
-
|
|
3362
|
+
fail(error);
|
|
3281
3363
|
}
|
|
3282
3364
|
}
|
|
3283
3365
|
|
|
3284
|
-
function
|
|
3285
|
-
if (stale()) {
|
|
3286
|
-
return;
|
|
3287
|
-
}
|
|
3288
|
-
if (error) {
|
|
3366
|
+
function fail(error) {
|
|
3367
|
+
if (!stale()) {
|
|
3289
3368
|
rejectResult(error);
|
|
3290
|
-
|
|
3369
|
+
releaseWriter();
|
|
3370
|
+
if (!(isErrorObject(error) && error.codecImportFailed)) {
|
|
3371
|
+
onTaskFinished();
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
function succeed(result) {
|
|
3377
|
+
if (!stale()) {
|
|
3291
3378
|
resolveResult(result);
|
|
3379
|
+
releaseWriter();
|
|
3380
|
+
onTaskFinished();
|
|
3292
3381
|
}
|
|
3382
|
+
}
|
|
3383
|
+
|
|
3384
|
+
function releaseWriter() {
|
|
3293
3385
|
if (writer) {
|
|
3294
3386
|
writer.releaseLock();
|
|
3295
3387
|
}
|
|
3296
|
-
|
|
3297
|
-
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
function getResponseError(errorData, errorValue) {
|
|
3392
|
+
const { message, stack, code, name, outputSize, cause, codecImportFailed } = errorData;
|
|
3393
|
+
let responseError;
|
|
3394
|
+
if (errorValue) {
|
|
3395
|
+
responseError = errorValue.value;
|
|
3396
|
+
} else {
|
|
3397
|
+
responseError = Object.assign(new Error(message), { stack, code, name });
|
|
3398
|
+
if (cause) {
|
|
3399
|
+
responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
|
|
3298
3400
|
}
|
|
3299
3401
|
}
|
|
3402
|
+
if (isErrorObject(responseError)) {
|
|
3403
|
+
try {
|
|
3404
|
+
if (outputSize !== UNDEFINED_VALUE) {
|
|
3405
|
+
responseError.outputSize = outputSize;
|
|
3406
|
+
}
|
|
3407
|
+
if (codecImportFailed) {
|
|
3408
|
+
responseError.codecImportFailed = true;
|
|
3409
|
+
}
|
|
3410
|
+
if (errorValue) {
|
|
3411
|
+
if (responseError.name !== name) {
|
|
3412
|
+
responseError.name = name;
|
|
3413
|
+
}
|
|
3414
|
+
if (responseError.code !== code) {
|
|
3415
|
+
responseError.code = code;
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
} catch {
|
|
3419
|
+
// ignored
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
return responseError;
|
|
3300
3423
|
}
|
|
3301
3424
|
|
|
3302
3425
|
/*
|
|
@@ -3573,10 +3696,13 @@
|
|
|
3573
3696
|
|
|
3574
3697
|
|
|
3575
3698
|
const ERR_HTTP_STATUS = "HTTP error ";
|
|
3699
|
+
const MIN_SUCCESS_HTTP_STATUS = 200;
|
|
3700
|
+
const MAX_SUCCESS_HTTP_STATUS = 299;
|
|
3576
3701
|
const ERR_HTTP_RANGE = "HTTP Range not supported";
|
|
3577
3702
|
const ERR_HTTP_RESOURCE_CHANGED = "HTTP resource changed";
|
|
3578
3703
|
const ERR_ITERATOR_COMPLETED_TOO_SOON = "Writer iterator completed too soon";
|
|
3579
3704
|
const ERR_WRITER_NOT_INITIALIZED = "Writer not initialized";
|
|
3705
|
+
const ERR_WRITER_SIZE_NOT_WRITABLE = "Invalid writer (size must be writable)";
|
|
3580
3706
|
|
|
3581
3707
|
const CONTENT_TYPE_TEXT_PLAIN = "text/plain";
|
|
3582
3708
|
const HTTP_HEADER_CONTENT_LENGTH = "Content-Length";
|
|
@@ -3768,6 +3894,7 @@
|
|
|
3768
3894
|
const reader = this;
|
|
3769
3895
|
const { sourceBlob, size } = reader;
|
|
3770
3896
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3897
|
+
// deno-lint-ignore valid-typeof
|
|
3771
3898
|
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3772
3899
|
if (!offset && readSize >= size) {
|
|
3773
3900
|
return toCompatibleReadable(sourceBlob.stream());
|
|
@@ -4174,7 +4301,7 @@
|
|
|
4174
4301
|
|
|
4175
4302
|
async function sendFetchRequest(method, { fetch: fetchFunction = fetch, options, url }, headers) {
|
|
4176
4303
|
const response = await fetchFunction(url, Object.assign({}, options, { method, headers }));
|
|
4177
|
-
if (response.status
|
|
4304
|
+
if (response.status >= MIN_SUCCESS_HTTP_STATUS && response.status <= MAX_SUCCESS_HTTP_STATUS) {
|
|
4178
4305
|
return response;
|
|
4179
4306
|
} else {
|
|
4180
4307
|
throw response.status == 416 ? new Error(ERR_HTTP_RANGE) : new Error(ERR_HTTP_STATUS + (response.statusText || response.status));
|
|
@@ -4185,7 +4312,7 @@
|
|
|
4185
4312
|
return new Promise((resolve, reject) => {
|
|
4186
4313
|
const request = new XMLHttpRequest();
|
|
4187
4314
|
request.addEventListener("load", () => {
|
|
4188
|
-
if (request.status
|
|
4315
|
+
if (request.status >= MIN_SUCCESS_HTTP_STATUS && request.status <= MAX_SUCCESS_HTTP_STATUS) {
|
|
4189
4316
|
const headers = [];
|
|
4190
4317
|
request.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(header => {
|
|
4191
4318
|
const splitHeader = header.trim().split(/\s*:\s*/);
|
|
@@ -4489,8 +4616,10 @@
|
|
|
4489
4616
|
writable: toCompatibleWritable(writer)
|
|
4490
4617
|
};
|
|
4491
4618
|
}
|
|
4492
|
-
|
|
4493
|
-
writer.size = 0;
|
|
4619
|
+
try {
|
|
4620
|
+
writer.size = writer.size === UNDEFINED_VALUE ? 0 : writer.size;
|
|
4621
|
+
} catch {
|
|
4622
|
+
throw new Error(ERR_WRITER_SIZE_NOT_WRITABLE);
|
|
4494
4623
|
}
|
|
4495
4624
|
return writer;
|
|
4496
4625
|
}
|
|
@@ -4538,6 +4667,45 @@
|
|
|
4538
4667
|
}
|
|
4539
4668
|
}
|
|
4540
4669
|
|
|
4670
|
+
/*
|
|
4671
|
+
Copyright (c) 2026 Gildas Lormeau. All rights reserved.
|
|
4672
|
+
|
|
4673
|
+
Redistribution and use in source and binary forms, with or without
|
|
4674
|
+
modification, are permitted provided that the following conditions are met:
|
|
4675
|
+
|
|
4676
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
4677
|
+
this list of conditions and the following disclaimer.
|
|
4678
|
+
|
|
4679
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
4680
|
+
notice, this list of conditions and the following disclaimer in
|
|
4681
|
+
the documentation and/or other materials provided with the distribution.
|
|
4682
|
+
|
|
4683
|
+
3. The names of the authors may not be used to endorse or promote products
|
|
4684
|
+
derived from this software without specific prior written permission.
|
|
4685
|
+
|
|
4686
|
+
THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
|
4687
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
4688
|
+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
|
4689
|
+
INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
4690
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
4691
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
4692
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
4693
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
4694
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
4695
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4696
|
+
*/
|
|
4697
|
+
|
|
4698
|
+
|
|
4699
|
+
function addWarning(warnings, reason, filename) {
|
|
4700
|
+
if (!warnings.some(warning => warning.reason == reason)) {
|
|
4701
|
+
const warning = { reason };
|
|
4702
|
+
if (filename !== UNDEFINED_VALUE) {
|
|
4703
|
+
warning.filename = filename;
|
|
4704
|
+
}
|
|
4705
|
+
warnings.push(warning);
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4541
4709
|
/*
|
|
4542
4710
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
4543
4711
|
|
|
@@ -4566,6 +4734,7 @@
|
|
|
4566
4734
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
4567
4735
|
*/
|
|
4568
4736
|
|
|
4737
|
+
|
|
4569
4738
|
const PROPERTY_NAME_FILENAME = "filename";
|
|
4570
4739
|
const PROPERTY_NAME_RAW_FILENAME = "rawFilename";
|
|
4571
4740
|
const PROPERTY_NAME_COMMENT = "comment";
|
|
@@ -4690,6 +4859,38 @@
|
|
|
4690
4859
|
|
|
4691
4860
|
}
|
|
4692
4861
|
|
|
4862
|
+
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
4863
|
+
EXTRAFIELD_TYPE_ZIP64,
|
|
4864
|
+
EXTRAFIELD_TYPE_AES,
|
|
4865
|
+
EXTRAFIELD_TYPE_NTFS,
|
|
4866
|
+
EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP,
|
|
4867
|
+
EXTRAFIELD_TYPE_UNICODE_PATH,
|
|
4868
|
+
EXTRAFIELD_TYPE_UNICODE_COMMENT,
|
|
4869
|
+
EXTRAFIELD_TYPE_USDZ,
|
|
4870
|
+
EXTRAFIELD_TYPE_INFOZIP,
|
|
4871
|
+
EXTRAFIELD_TYPE_UNIX,
|
|
4872
|
+
EXTRAFIELD_TYPE_UNIX_TYPE1,
|
|
4873
|
+
EXTRAFIELD_TYPE_PKWARE_UNIX
|
|
4874
|
+
]);
|
|
4875
|
+
|
|
4876
|
+
function getUserExtraField(extraField) {
|
|
4877
|
+
if (extraField) {
|
|
4878
|
+
const userExtraField = new Map();
|
|
4879
|
+
extraField.forEach((field, type) => {
|
|
4880
|
+
if (!INTERPRETED_EXTRA_FIELD_TYPES.has(type)) {
|
|
4881
|
+
userExtraField.set(type, field.data);
|
|
4882
|
+
}
|
|
4883
|
+
});
|
|
4884
|
+
if (userExtraField.size) {
|
|
4885
|
+
return userExtraField;
|
|
4886
|
+
}
|
|
4887
|
+
}
|
|
4888
|
+
}
|
|
4889
|
+
|
|
4890
|
+
function getEncryptionOverhead(encrypted, zipCrypto, encryptionStrength) {
|
|
4891
|
+
return encrypted ? (zipCrypto ? 12 : 16 + encryptionStrength * 4) : 0;
|
|
4892
|
+
}
|
|
4893
|
+
|
|
4693
4894
|
/*
|
|
4694
4895
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
4695
4896
|
|
|
@@ -4749,6 +4950,8 @@
|
|
|
4749
4950
|
const WARNING_TRAILING_CENTRAL_DIRECTORY_DATA = "trailing central directory data";
|
|
4750
4951
|
const WARNING_DUPLICATE_FILENAME = "duplicate filename";
|
|
4751
4952
|
const WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY = "mismatched zip64 end of central directory record";
|
|
4953
|
+
const WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY = "multiple end of central directory records";
|
|
4954
|
+
const WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME = "mismatched local file header (filename)";
|
|
4752
4955
|
const WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG = "mismatched local file header (general purpose bit flag)";
|
|
4753
4956
|
const WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD = "mismatched local file header (compression method)";
|
|
4754
4957
|
const WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES = "mismatched local file header (crc32 or sizes)";
|
|
@@ -4819,7 +5022,7 @@
|
|
|
4819
5022
|
}
|
|
4820
5023
|
}
|
|
4821
5024
|
if (rejectAmbiguousEndOfDirectory && endOfDirectoryReachingEndCount > 1) {
|
|
4822
|
-
throwAmbiguousArchive(
|
|
5025
|
+
throwAmbiguousArchive(WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY);
|
|
4823
5026
|
}
|
|
4824
5027
|
const endOfDirectoryView = getDataView(endOfDirectoryInfo);
|
|
4825
5028
|
let directoryDataLength = getUint32$1(endOfDirectoryView, 12);
|
|
@@ -5117,7 +5320,8 @@
|
|
|
5117
5320
|
const writer = new TransformStream();
|
|
5118
5321
|
const arrayBufferPromise = streamToBlob(writer.readable).then(blob => blob.arrayBuffer());
|
|
5119
5322
|
arrayBufferPromise.catch(() => { });
|
|
5120
|
-
await fileEntry.getData(writer, entry, zipReader.readRanges,
|
|
5323
|
+
await fileEntry.getData(writer, entry, zipReader.readRanges,
|
|
5324
|
+
Object.assign({}, options, { preventClose: false }));
|
|
5121
5325
|
return arrayBufferPromise;
|
|
5122
5326
|
};
|
|
5123
5327
|
offset = endOffset;
|
|
@@ -5198,49 +5402,101 @@
|
|
|
5198
5402
|
await reader.readable.cancel();
|
|
5199
5403
|
}
|
|
5200
5404
|
}
|
|
5405
|
+
|
|
5406
|
+
[SYMBOL_ASYNC_DISPOSE]() {
|
|
5407
|
+
return this.close();
|
|
5408
|
+
}
|
|
5201
5409
|
}
|
|
5202
5410
|
|
|
5203
5411
|
class ZipReaderStream {
|
|
5204
5412
|
|
|
5205
5413
|
constructor(options = {}) {
|
|
5206
|
-
|
|
5207
|
-
const
|
|
5414
|
+
let sourceController;
|
|
5415
|
+
const { readable, writable } = new TransformStream({
|
|
5416
|
+
start(controller) {
|
|
5417
|
+
sourceController = controller;
|
|
5418
|
+
}
|
|
5419
|
+
});
|
|
5420
|
+
const zipReader = new ZipReader(readable, options);
|
|
5421
|
+
const gen = zipReader.getEntriesGenerator();
|
|
5422
|
+
const pendingEntries = new Set();
|
|
5208
5423
|
this.readable = new ReadableStream({
|
|
5209
5424
|
async pull(controller) {
|
|
5210
5425
|
const { done, value } = await gen.next();
|
|
5211
5426
|
if (done)
|
|
5212
5427
|
return controller.close();
|
|
5213
|
-
const
|
|
5214
|
-
const { readable, writable } = new TransformStream();
|
|
5215
|
-
if (value.getData) {
|
|
5216
|
-
getData();
|
|
5217
|
-
return readable;
|
|
5218
|
-
}
|
|
5219
|
-
|
|
5220
|
-
async function getData() {
|
|
5221
|
-
try {
|
|
5222
|
-
await value.getData(writable);
|
|
5223
|
-
} catch (error) {
|
|
5224
|
-
try {
|
|
5225
|
-
await writable.abort(error);
|
|
5226
|
-
} catch {
|
|
5227
|
-
// ignored
|
|
5228
|
-
}
|
|
5229
|
-
}
|
|
5230
|
-
}
|
|
5231
|
-
})();
|
|
5428
|
+
const entryStream = createEntryStream(value, pendingEntries);
|
|
5232
5429
|
const chunk = {
|
|
5233
5430
|
...value,
|
|
5234
|
-
readable:
|
|
5431
|
+
readable: entryStream.readable
|
|
5235
5432
|
};
|
|
5236
5433
|
delete chunk.getData;
|
|
5434
|
+
Object.defineProperties(chunk, {
|
|
5435
|
+
localDirectory: {
|
|
5436
|
+
get: () => value.localDirectory,
|
|
5437
|
+
enumerable: true
|
|
5438
|
+
},
|
|
5439
|
+
warnings: {
|
|
5440
|
+
get: () => value.warnings,
|
|
5441
|
+
enumerable: true
|
|
5442
|
+
}
|
|
5443
|
+
});
|
|
5237
5444
|
controller.enqueue(chunk);
|
|
5445
|
+
},
|
|
5446
|
+
async cancel(reason) {
|
|
5447
|
+
const entryStreams = Array.from(pendingEntries);
|
|
5448
|
+
pendingEntries.clear();
|
|
5449
|
+
sourceController.error(reason);
|
|
5450
|
+
await Promise.allSettled(entryStreams.map(entryStream => entryStream.cancel(reason)));
|
|
5451
|
+
await Promise.allSettled([gen.return(), zipReader.close()]);
|
|
5238
5452
|
}
|
|
5239
5453
|
});
|
|
5240
5454
|
this.writable = writable;
|
|
5241
5455
|
}
|
|
5242
5456
|
}
|
|
5243
5457
|
|
|
5458
|
+
function createEntryStream(entry, pendingEntries) {
|
|
5459
|
+
const { readable, writable } = new TransformStream();
|
|
5460
|
+
let dataReader;
|
|
5461
|
+
const entryStream = {
|
|
5462
|
+
cancel: async reason => {
|
|
5463
|
+
pendingEntries.delete(entryStream);
|
|
5464
|
+
await (dataReader ? dataReader.cancel(reason) : readable.cancel(reason));
|
|
5465
|
+
}
|
|
5466
|
+
};
|
|
5467
|
+
entryStream.readable = new ReadableStream({
|
|
5468
|
+
async pull(controller) {
|
|
5469
|
+
if (!dataReader) {
|
|
5470
|
+
dataReader = readable.getReader();
|
|
5471
|
+
pendingEntries.add(entryStream);
|
|
5472
|
+
getData();
|
|
5473
|
+
}
|
|
5474
|
+
const { done, value } = await dataReader.read();
|
|
5475
|
+
if (done) {
|
|
5476
|
+
controller.close();
|
|
5477
|
+
} else {
|
|
5478
|
+
controller.enqueue(value);
|
|
5479
|
+
}
|
|
5480
|
+
},
|
|
5481
|
+
cancel: reason => entryStream.cancel(reason)
|
|
5482
|
+
}, { highWaterMark: 0 });
|
|
5483
|
+
return entryStream;
|
|
5484
|
+
|
|
5485
|
+
async function getData() {
|
|
5486
|
+
try {
|
|
5487
|
+
await entry.getData(writable, { preventClose: false });
|
|
5488
|
+
} catch (error) {
|
|
5489
|
+
try {
|
|
5490
|
+
await writable.abort(error);
|
|
5491
|
+
} catch {
|
|
5492
|
+
// ignored
|
|
5493
|
+
}
|
|
5494
|
+
} finally {
|
|
5495
|
+
pendingEntries.delete(entryStream);
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5498
|
+
}
|
|
5499
|
+
|
|
5244
5500
|
async function isZipFile(reader, options = {}) {
|
|
5245
5501
|
reader = new GenericReader(reader);
|
|
5246
5502
|
await initStream(reader);
|
|
@@ -5300,7 +5556,9 @@
|
|
|
5300
5556
|
const dataView = getDataView(dataArray);
|
|
5301
5557
|
let password = getOptionValue$1(zipEntry, options, OPTION_PASSWORD);
|
|
5302
5558
|
let rawPassword = getOptionValue$1(zipEntry, options, OPTION_RAW_PASSWORD);
|
|
5303
|
-
const passThrough = getOptionValue$1(zipEntry, options, OPTION_PASS_THROUGH);
|
|
5559
|
+
const passThrough = checkPassThroughOption(getOptionValue$1(zipEntry, options, OPTION_PASS_THROUGH));
|
|
5560
|
+
const passThroughCompression = Boolean(passThrough);
|
|
5561
|
+
const passThroughEncryption = passThrough === true;
|
|
5304
5562
|
checkPasswordOption(password, rawPassword);
|
|
5305
5563
|
password = password && password.length && password;
|
|
5306
5564
|
rawPassword = rawPassword && rawPassword.length && rawPassword;
|
|
@@ -5321,7 +5579,9 @@
|
|
|
5321
5579
|
const checkLocalDirectoryOption = getOptionValue$1(zipEntry, options, OPTION_CHECK_LOCAL_DIRECTORY);
|
|
5322
5580
|
const entryStrictness = getStrictness(options, zipEntry.options);
|
|
5323
5581
|
const checkLocalDirectory = getCheckLocalDirectory(checkLocalDirectoryOption, entryStrictness);
|
|
5324
|
-
const
|
|
5582
|
+
const checkLocalFilenameOption = getOptionValue$1(zipEntry, options, OPTION_CHECK_LOCAL_FILENAME);
|
|
5583
|
+
const checkLocalFilename = getCheckLocalFilename(
|
|
5584
|
+
checkLocalFilenameOption === UNDEFINED_VALUE ? checkLocalDirectoryOption : checkLocalFilenameOption, entryStrictness);
|
|
5325
5585
|
let rawLocalFilename = EMPTY_UINT8_ARRAY;
|
|
5326
5586
|
if (checkLocalFilename && (filenameLength || extraFieldLength)) {
|
|
5327
5587
|
const trailingDataArray = await readUint8Array(reader, localHeaderOffset + HEADER_SIZE, filenameLength + extraFieldLength);
|
|
@@ -5352,16 +5612,17 @@
|
|
|
5352
5612
|
if (gid !== UNDEFINED_VALUE && fileEntry.gid === UNDEFINED_VALUE) {
|
|
5353
5613
|
fileEntry.gid = gid;
|
|
5354
5614
|
}
|
|
5355
|
-
const
|
|
5615
|
+
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5616
|
+
const encrypted = zipEntry.encrypted && localDirectory.encrypted && (!passThroughEncryption || checkPasswordOnly);
|
|
5356
5617
|
const zipCrypto = encrypted && !extraFieldAES;
|
|
5357
|
-
if (!
|
|
5618
|
+
if (!passThroughEncryption) {
|
|
5358
5619
|
fileEntry.zipCrypto = zipCrypto;
|
|
5359
5620
|
}
|
|
5360
5621
|
if (encrypted && (localDirectory.rawBitFlag & BITFLAG_STRONG_ENCRYPTION) == BITFLAG_STRONG_ENCRYPTION) {
|
|
5361
5622
|
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
|
|
5362
5623
|
}
|
|
5363
|
-
const registeredCodec =
|
|
5364
|
-
if (compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE && compressionMethod != COMPRESSION_METHOD_DEFLATE_64 && !registeredCodec && !
|
|
5624
|
+
const registeredCodec = passThroughCompression ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
5625
|
+
if (compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE && compressionMethod != COMPRESSION_METHOD_DEFLATE_64 && !registeredCodec && !passThroughCompression) {
|
|
5365
5626
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
5366
5627
|
}
|
|
5367
5628
|
if (encrypted) {
|
|
@@ -5378,15 +5639,16 @@
|
|
|
5378
5639
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5379
5640
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5380
5641
|
throwIfAborted(signal);
|
|
5381
|
-
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5382
5642
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5383
5643
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
5384
5644
|
if (checkOverlappingEntryOnly) {
|
|
5385
5645
|
checkOverlappingEntry = true;
|
|
5386
5646
|
}
|
|
5387
5647
|
const { onstart, onprogress, onend } = options;
|
|
5388
|
-
const compressed = compressionMethod != COMPRESSION_METHOD_STORE && !
|
|
5389
|
-
const outputSize =
|
|
5648
|
+
const compressed = compressionMethod != COMPRESSION_METHOD_STORE && !passThroughCompression;
|
|
5649
|
+
const outputSize = passThroughCompression ?
|
|
5650
|
+
compressedSize - getEncryptionOverhead(encrypted, zipCrypto, extraFieldAES && extraFieldAES.strength) :
|
|
5651
|
+
uncompressedSize;
|
|
5390
5652
|
const deflate64 = compressionMethod == COMPRESSION_METHOD_DEFLATE_64;
|
|
5391
5653
|
let useCompressionStream = getOptionValue$1(zipEntry, options, OPTION_USE_COMPRESSION_STREAM);
|
|
5392
5654
|
if (deflate64) {
|
|
@@ -5395,7 +5657,7 @@
|
|
|
5395
5657
|
const checkCrc32Option = getOptionValue$1(zipEntry, options, OPTION_CHECK_CRC32);
|
|
5396
5658
|
const checkCrc32 = (checkCrc32Option === UNDEFINED_VALUE ?
|
|
5397
5659
|
getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) :
|
|
5398
|
-
checkCrc32Option) && !
|
|
5660
|
+
checkCrc32Option) && !passThroughCompression &&
|
|
5399
5661
|
(!encrypted || zipCrypto || (extraFieldAES && extraFieldAES.vendorVersion == VENDOR_VERSION_AE_1$1));
|
|
5400
5662
|
const workerOptions = {
|
|
5401
5663
|
options: {
|
|
@@ -5439,7 +5701,7 @@
|
|
|
5439
5701
|
readRanges
|
|
5440
5702
|
});
|
|
5441
5703
|
}
|
|
5442
|
-
let writable, abortError;
|
|
5704
|
+
let writable, abortError, aborted;
|
|
5443
5705
|
try {
|
|
5444
5706
|
if (!checkOverlappingEntryOnly) {
|
|
5445
5707
|
if (checkPasswordOnly) {
|
|
@@ -5449,24 +5711,28 @@
|
|
|
5449
5711
|
await initStream(writer, getDecodableOutputSize(outputSize, compressedSize, compressed));
|
|
5450
5712
|
({ writable } = writer);
|
|
5451
5713
|
const { outputSize: writtenSize } = await runWorker({ readable, writable }, workerOptions);
|
|
5452
|
-
writer.size += writtenSize;
|
|
5453
5714
|
if (writtenSize != outputSize) {
|
|
5454
|
-
throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
|
|
5715
|
+
throw Object.assign(new Error(ERR_INVALID_UNCOMPRESSED_SIZE), { outputSize: writtenSize });
|
|
5455
5716
|
}
|
|
5717
|
+
writer.size += writtenSize;
|
|
5456
5718
|
}
|
|
5457
5719
|
} catch (error) {
|
|
5458
|
-
|
|
5720
|
+
const { outputSize: failedOutputSize } = workerOptions;
|
|
5721
|
+
if (failedOutputSize !== UNDEFINED_VALUE) {
|
|
5722
|
+
writer.size += failedOutputSize;
|
|
5723
|
+
} else if (isErrorObject(error) && error.outputSize !== UNDEFINED_VALUE) {
|
|
5459
5724
|
writer.size += error.outputSize;
|
|
5460
5725
|
}
|
|
5461
|
-
if (!checkPasswordOnly || error.message != ERR_ABORT_CHECK_PASSWORD) {
|
|
5726
|
+
if (!checkPasswordOnly || !isErrorObject(error) || error.message != ERR_ABORT_CHECK_PASSWORD) {
|
|
5462
5727
|
abortError = error;
|
|
5728
|
+
aborted = true;
|
|
5463
5729
|
throw error;
|
|
5464
5730
|
}
|
|
5465
5731
|
} finally {
|
|
5466
5732
|
const preventClose = !ownsWritable(writer) && getOptionValue$1(zipEntry, options, OPTION_PREVENT_CLOSE);
|
|
5467
5733
|
if (!preventClose && writable && !writable.locked) {
|
|
5468
5734
|
const writableWriter = writable.getWriter();
|
|
5469
|
-
if (
|
|
5735
|
+
if (aborted) {
|
|
5470
5736
|
try {
|
|
5471
5737
|
await writableWriter.abort(abortError);
|
|
5472
5738
|
} catch {
|
|
@@ -6118,7 +6384,7 @@
|
|
|
6118
6384
|
if (checkLocalFilename && !maskedLocalDirectory &&
|
|
6119
6385
|
(rawLocalFilename.length != rawFilename.length ||
|
|
6120
6386
|
rawLocalFilename.some((byteValue, indexByte) => byteValue != rawFilename[indexByte]))) {
|
|
6121
|
-
reportAmbiguity(reject, warnings,
|
|
6387
|
+
reportAmbiguity(reject, warnings, WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME);
|
|
6122
6388
|
}
|
|
6123
6389
|
if ((localDirectory.rawBitFlag & BITFLAG_AMBIGUITY_MASK) != (zipEntry.rawBitFlag & BITFLAG_AMBIGUITY_MASK)) {
|
|
6124
6390
|
reportAmbiguity(reject, warnings, WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG);
|
|
@@ -6143,16 +6409,6 @@
|
|
|
6143
6409
|
}
|
|
6144
6410
|
}
|
|
6145
6411
|
|
|
6146
|
-
function addWarning(warnings, reason, filename) {
|
|
6147
|
-
if (!warnings.some(warning => warning.reason == reason)) {
|
|
6148
|
-
const warning = { reason };
|
|
6149
|
-
if (filename !== UNDEFINED_VALUE) {
|
|
6150
|
-
warning.filename = filename;
|
|
6151
|
-
}
|
|
6152
|
-
warnings.push(warning);
|
|
6153
|
-
}
|
|
6154
|
-
}
|
|
6155
|
-
|
|
6156
6412
|
function throwAmbiguousArchive(reason) {
|
|
6157
6413
|
const error = new Error(ERR_AMBIGUOUS_ARCHIVE);
|
|
6158
6414
|
error.reason = reason;
|
|
@@ -6232,7 +6488,9 @@
|
|
|
6232
6488
|
WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG: WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG,
|
|
6233
6489
|
WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD: WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD,
|
|
6234
6490
|
WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES: WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES,
|
|
6491
|
+
WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME: WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME,
|
|
6235
6492
|
WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY: WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY,
|
|
6493
|
+
WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY: WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY,
|
|
6236
6494
|
WARNING_PREPENDED_CENTRAL_DIRECTORY: WARNING_PREPENDED_CENTRAL_DIRECTORY,
|
|
6237
6495
|
WARNING_PREPENDED_DATA: WARNING_PREPENDED_DATA,
|
|
6238
6496
|
WARNING_TRAILING_CENTRAL_DIRECTORY_DATA: WARNING_TRAILING_CENTRAL_DIRECTORY_DATA,
|
|
@@ -6285,7 +6543,7 @@
|
|
|
6285
6543
|
const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
|
|
6286
6544
|
const ERR_UNSUPPORTED_ENCRYPTION_USDZ = "Encryption is not supported in USDZ files";
|
|
6287
6545
|
const ERR_UNSUPPORTED_SPLIT_USDZ = "Split zip files are not supported in USDZ files";
|
|
6288
|
-
const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set";
|
|
6546
|
+
const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set to true (use 'compressed' instead)";
|
|
6289
6547
|
const ERR_INVALID_EXTRAFIELD = "Invalid extra field (must be a Map)";
|
|
6290
6548
|
const ERR_INVALID_EXTRAFIELD_TYPE = "Invalid extra field type (must be integer 0..65535)";
|
|
6291
6549
|
const ERR_INVALID_EXTRAFIELD_DATA_TYPE = "Invalid extra field data (must be a Uint8Array)";
|
|
@@ -6297,6 +6555,7 @@
|
|
|
6297
6555
|
const ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported (set the 'zip64' option to 'true')";
|
|
6298
6556
|
const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
|
|
6299
6557
|
const ERR_UNDEFINED_COMPRESSION_METHOD = "Undefined compression method";
|
|
6558
|
+
const ERR_UNDEFINED_CRC32 = "Undefined CRC32";
|
|
6300
6559
|
const ERR_UNDETERMINED_SIZE = "Undetermined size";
|
|
6301
6560
|
const ERR_UNDEFINED_READER = "Undefined reader";
|
|
6302
6561
|
const ERR_INVALID_READER = "Invalid reader (must be a Reader instance, a ReadableStream instance, or an object with a 'readable' property)";
|
|
@@ -6310,14 +6569,21 @@
|
|
|
6310
6569
|
const ERR_INVALID_MSDOS_DATA = "Invalid msdosAttributes (must be an object with boolean flags)";
|
|
6311
6570
|
const ERR_INVALID_LEVEL = "Invalid level (must be integer 0..9)";
|
|
6312
6571
|
const ERR_INVALID_SIGNATURE_DATA = "Signature data exceeds 64KB";
|
|
6572
|
+
const ERR_INVALID_ENTRY = "Invalid entry option (must be an entry returned by ZipReader#getEntries())";
|
|
6573
|
+
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
6574
|
+
const WARNING_COMPRESSION_UNAVAILABLE = "compression unavailable";
|
|
6575
|
+
const WARNING_CLAMPED_LAST_MODIFICATION_DATE = "clamped last modification date";
|
|
6313
6576
|
|
|
6314
6577
|
const EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);
|
|
6315
6578
|
const EXTRAFIELD_OFFSET_AES_VENDOR_VERSION = 4;
|
|
6316
6579
|
const EXTRAFIELD_OFFSET_AES_COMPRESSION_METHOD = 9;
|
|
6317
6580
|
const EXTRAFIELD_USDZ_MAX_LENGTH = 67;
|
|
6581
|
+
const MIN_PRINTABLE_ASCII_CHARACTER_CODE = 0x20;
|
|
6582
|
+
const MAX_PRINTABLE_ASCII_CHARACTER_CODE = 0x7e;
|
|
6318
6583
|
const VENDOR_VERSION_AE_1 = 1;
|
|
6319
|
-
const INFOZIP_EXTRA_FIELD_TYPE
|
|
6584
|
+
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
6320
6585
|
const UNIX_EXTRA_FIELD_TYPE = "unix";
|
|
6586
|
+
const LEVEL_BY_BITFLAG_LEVEL = [8, 9, 5, 3];
|
|
6321
6587
|
const MAX_LEVEL = 9;
|
|
6322
6588
|
|
|
6323
6589
|
let workers = 0;
|
|
@@ -6344,9 +6610,11 @@
|
|
|
6344
6610
|
initialOffset: options[OPTION_OFFSET] === UNDEFINED_VALUE ? 0 : options[OPTION_OFFSET] - (writer.size || writer.writable.size || 0),
|
|
6345
6611
|
pendingAddFileCalls: new Set(),
|
|
6346
6612
|
pendingErrors: [],
|
|
6613
|
+
warnings: [],
|
|
6347
6614
|
bufferedWrites: 0,
|
|
6348
6615
|
directWrites: 0,
|
|
6349
|
-
lastFileEntry: UNDEFINED_VALUE
|
|
6616
|
+
lastFileEntry: UNDEFINED_VALUE,
|
|
6617
|
+
archiveClosed: false
|
|
6350
6618
|
});
|
|
6351
6619
|
}
|
|
6352
6620
|
|
|
@@ -6511,6 +6779,9 @@
|
|
|
6511
6779
|
const zipWriter = this;
|
|
6512
6780
|
const { pendingAddFileCalls, writer } = this;
|
|
6513
6781
|
const { writable } = writer;
|
|
6782
|
+
if (zipWriter.archiveClosed) {
|
|
6783
|
+
return getWriterData(writer);
|
|
6784
|
+
}
|
|
6514
6785
|
if (!(comment instanceof Uint8Array)) {
|
|
6515
6786
|
throw new Error(ERR_INVALID_COMMENT_TYPE);
|
|
6516
6787
|
}
|
|
@@ -6521,7 +6792,7 @@
|
|
|
6521
6792
|
await Promise.allSettled(Array.from(pendingAddFileCalls));
|
|
6522
6793
|
}
|
|
6523
6794
|
await Promise.allSettled(zipWriter.pendingErrors.map(watcher => watcher.recorded));
|
|
6524
|
-
const unobservedWatchers = zipWriter.pendingErrors.filter(watcher => watcher.
|
|
6795
|
+
const unobservedWatchers = zipWriter.pendingErrors.filter(watcher => watcher.failed && !watcher.observed);
|
|
6525
6796
|
if (unobservedWatchers.length) {
|
|
6526
6797
|
const unobservedErrors = unobservedWatchers.map(watcher => watcher.error);
|
|
6527
6798
|
unobservedWatchers.forEach(watcher => watcher.observed = true);
|
|
@@ -6534,11 +6805,16 @@
|
|
|
6534
6805
|
throw error;
|
|
6535
6806
|
}
|
|
6536
6807
|
await closeFile(zipWriter, comment, options);
|
|
6808
|
+
zipWriter.archiveClosed = true;
|
|
6537
6809
|
const preventClose = !ownsWritable(writer) && getOptionValue(zipWriter, options, OPTION_PREVENT_CLOSE);
|
|
6538
6810
|
if (!preventClose) {
|
|
6539
6811
|
await writable.getWriter().close();
|
|
6540
6812
|
}
|
|
6541
|
-
return writer
|
|
6813
|
+
return getWriterData(writer);
|
|
6814
|
+
}
|
|
6815
|
+
|
|
6816
|
+
[SYMBOL_ASYNC_DISPOSE]() {
|
|
6817
|
+
return this.close();
|
|
6542
6818
|
}
|
|
6543
6819
|
}
|
|
6544
6820
|
|
|
@@ -6617,11 +6893,16 @@
|
|
|
6617
6893
|
}
|
|
6618
6894
|
}
|
|
6619
6895
|
|
|
6896
|
+
function getWriterData(writer) {
|
|
6897
|
+
return writer.getData ? writer.getData() : writer.writable;
|
|
6898
|
+
}
|
|
6899
|
+
|
|
6620
6900
|
function watchPromiseError(zipWriter, promise) {
|
|
6621
6901
|
const watchedPromise = new WatchedPromise((resolve, reject) => Promise.prototype.then.call(promise, resolve, reject));
|
|
6622
6902
|
const watcher = {};
|
|
6623
6903
|
watchedPromise.watcher = watcher;
|
|
6624
|
-
watcher.recorded = Promise.prototype.then.call(watchedPromise, UNDEFINED_VALUE,
|
|
6904
|
+
watcher.recorded = Promise.prototype.then.call(watchedPromise, UNDEFINED_VALUE,
|
|
6905
|
+
error => Object.assign(watcher, { failed: true, error }));
|
|
6625
6906
|
zipWriter.pendingErrors.push(watcher);
|
|
6626
6907
|
return watchedPromise;
|
|
6627
6908
|
}
|
|
@@ -6635,6 +6916,14 @@
|
|
|
6635
6916
|
|
|
6636
6917
|
async function addFileEntry(zipWriter, name, reader, options) {
|
|
6637
6918
|
options = Object.assign({}, options);
|
|
6919
|
+
const entry = options[OPTION_ENTRY];
|
|
6920
|
+
if (entry !== UNDEFINED_VALUE) {
|
|
6921
|
+
const { entryOptions, passThroughOptions } = getSourceEntryOptions(entry,
|
|
6922
|
+
checkPassThroughOption(getOptionValue(zipWriter, options, OPTION_PASS_THROUGH)),
|
|
6923
|
+
getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_MODIFICATION_DATE));
|
|
6924
|
+
delete options[OPTION_ENTRY];
|
|
6925
|
+
options = Object.assign(entryOptions, passThroughOptions, options);
|
|
6926
|
+
}
|
|
6638
6927
|
if (getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY) && !name.endsWith(DIRECTORY_SIGNATURE)) {
|
|
6639
6928
|
name += DIRECTORY_SIGNATURE;
|
|
6640
6929
|
}
|
|
@@ -6699,21 +6988,33 @@
|
|
|
6699
6988
|
try {
|
|
6700
6989
|
const { resolvedOptions } = metadataInfo;
|
|
6701
6990
|
if (resolvedOptions.level != 0 && resolvedOptions.compressionMethod === UNDEFINED_VALUE &&
|
|
6702
|
-
!resolvedOptions.
|
|
6991
|
+
!resolvedOptions.passThroughCompression && !(await supportsDeflate(getConfiguration()))) {
|
|
6703
6992
|
resolvedOptions.level = 0;
|
|
6993
|
+
addWarning(zipWriter.warnings, WARNING_COMPRESSION_UNAVAILABLE, name);
|
|
6704
6994
|
}
|
|
6705
6995
|
const sizesInfo = await resolveSizes(zipWriter, reader, metadataInfo, options);
|
|
6706
6996
|
({ reader } = sizesInfo);
|
|
6707
6997
|
const diskOffset = getDiskOffset(zipWriter.writer);
|
|
6708
6998
|
const diskNumber = getDiskNumber(zipWriter.writer);
|
|
6999
|
+
let crc32 = options.crc32 === UNDEFINED_VALUE ? options[PROPERTY_NAME_SIGNATURE] : options.crc32;
|
|
7000
|
+
const storesAE2 = sizesInfo.resolvedOptions.encrypted && !resolvedOptions.zipCrypto;
|
|
7001
|
+
if (resolvedOptions.passThroughCompression && !resolvedOptions.passThroughEncryption && storesAE2) {
|
|
7002
|
+
crc32 = UNDEFINED_VALUE;
|
|
7003
|
+
}
|
|
7004
|
+
if (resolvedOptions.passThroughCompression && reader && !storesAE2 && crc32 === UNDEFINED_VALUE) {
|
|
7005
|
+
throw new Error(ERR_UNDEFINED_CRC32);
|
|
7006
|
+
}
|
|
6709
7007
|
options = Object.assign({}, options, attributesInfo.resolvedOptions, metadataInfo.resolvedOptions, sizesInfo.resolvedOptions, {
|
|
6710
7008
|
signature: options[PROPERTY_NAME_SIGNATURE],
|
|
6711
|
-
crc32
|
|
7009
|
+
crc32,
|
|
6712
7010
|
offset: zipWriter.offset - diskOffset,
|
|
6713
7011
|
diskNumberStart: diskNumber,
|
|
6714
7012
|
[OPTION_USDZ]: zipWriter.options[OPTION_USDZ]
|
|
6715
7013
|
});
|
|
6716
7014
|
const headerInfo = getHeaderInfo(options);
|
|
7015
|
+
if (headerInfo.lastModDateClamped) {
|
|
7016
|
+
addWarning(zipWriter.warnings, WARNING_CLAMPED_LAST_MODIFICATION_DATE, name);
|
|
7017
|
+
}
|
|
6717
7018
|
const dataDescriptorInfo = getDataDescriptorInfo(options);
|
|
6718
7019
|
const metadataSize = getLength(headerInfo.localHeaderArray, dataDescriptorInfo.dataDescriptorArray);
|
|
6719
7020
|
fileEntry = await getFileEntry(zipWriter, name, reader, {
|
|
@@ -6740,6 +7041,95 @@
|
|
|
6740
7041
|
return new Entry(fileEntry);
|
|
6741
7042
|
}
|
|
6742
7043
|
|
|
7044
|
+
function getSourceEntryOptions(entry, passThrough, lastModDateOverride) {
|
|
7045
|
+
if (entry === null || typeof entry != OBJECT_TYPE || Array.isArray(entry)) {
|
|
7046
|
+
throw new Error(ERR_INVALID_ENTRY);
|
|
7047
|
+
}
|
|
7048
|
+
const {
|
|
7049
|
+
externalFileAttributes,
|
|
7050
|
+
versionMadeBy,
|
|
7051
|
+
comment,
|
|
7052
|
+
lastModDate,
|
|
7053
|
+
rawLastModDate,
|
|
7054
|
+
creationDate,
|
|
7055
|
+
lastAccessDate,
|
|
7056
|
+
uncompressedSize,
|
|
7057
|
+
encrypted,
|
|
7058
|
+
zipCrypto,
|
|
7059
|
+
crc32,
|
|
7060
|
+
compressionMethod,
|
|
7061
|
+
extraFieldAES,
|
|
7062
|
+
extraFieldUnix,
|
|
7063
|
+
internalFileAttributes,
|
|
7064
|
+
extraField,
|
|
7065
|
+
bitFlag,
|
|
7066
|
+
directory,
|
|
7067
|
+
uid,
|
|
7068
|
+
gid
|
|
7069
|
+
} = entry;
|
|
7070
|
+
const entryOptions = {
|
|
7071
|
+
externalFileAttributes,
|
|
7072
|
+
versionMadeBy,
|
|
7073
|
+
comment,
|
|
7074
|
+
lastModDate,
|
|
7075
|
+
creationDate,
|
|
7076
|
+
lastAccessDate,
|
|
7077
|
+
internalFileAttributes,
|
|
7078
|
+
directory
|
|
7079
|
+
};
|
|
7080
|
+
if (bitFlag && bitFlag.languageEncodingFlag) {
|
|
7081
|
+
entryOptions[OPTION_USE_UNICODE_FILE_NAMES] = true;
|
|
7082
|
+
}
|
|
7083
|
+
const userExtraField = getUserExtraField(extraField);
|
|
7084
|
+
if (userExtraField) {
|
|
7085
|
+
entryOptions[PROPERTY_NAME_EXTRA_FIELD] = userExtraField;
|
|
7086
|
+
}
|
|
7087
|
+
if (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE) {
|
|
7088
|
+
Object.assign(entryOptions, {
|
|
7089
|
+
uid,
|
|
7090
|
+
gid,
|
|
7091
|
+
unixExtraFieldType: extraFieldUnix ? UNIX_EXTRA_FIELD_TYPE : INFOZIP_EXTRA_FIELD_TYPE
|
|
7092
|
+
});
|
|
7093
|
+
}
|
|
7094
|
+
const passThroughOptions = {};
|
|
7095
|
+
if (passThrough && !directory) {
|
|
7096
|
+
Object.assign(passThroughOptions, {
|
|
7097
|
+
uncompressedSize,
|
|
7098
|
+
crc32,
|
|
7099
|
+
compressionMethod
|
|
7100
|
+
});
|
|
7101
|
+
if (passThrough !== PASS_THROUGH_COMPRESSED) {
|
|
7102
|
+
Object.assign(passThroughOptions, {
|
|
7103
|
+
encrypted,
|
|
7104
|
+
zipCrypto,
|
|
7105
|
+
encryptionStrength: extraFieldAES ? extraFieldAES.strength : UNDEFINED_VALUE
|
|
7106
|
+
});
|
|
7107
|
+
}
|
|
7108
|
+
if (bitFlag) {
|
|
7109
|
+
passThroughOptions.dataDescriptor = bitFlag.dataDescriptor;
|
|
7110
|
+
passThroughOptions[OPTION_LEVEL] = LEVEL_BY_BITFLAG_LEVEL[bitFlag.level];
|
|
7111
|
+
}
|
|
7112
|
+
if (lastModDateOverride === UNDEFINED_VALUE) {
|
|
7113
|
+
passThroughOptions.rawLastModDate = rawLastModDate;
|
|
7114
|
+
} else if (passThrough !== PASS_THROUGH_COMPRESSED && zipCrypto && (!bitFlag || bitFlag.dataDescriptor) &&
|
|
7115
|
+
lastModDateOverride instanceof Date &&
|
|
7116
|
+
getDosTimeHighByte(lastModDateOverride) != ((rawLastModDate >>> 8) & MAX_8_BITS)) {
|
|
7117
|
+
throw new Error(ERR_ZIP_CRYPTO_LAST_MOD_DATE);
|
|
7118
|
+
}
|
|
7119
|
+
}
|
|
7120
|
+
return { entryOptions, passThroughOptions };
|
|
7121
|
+
}
|
|
7122
|
+
|
|
7123
|
+
function getDosTimeHighByte(lastModDate) {
|
|
7124
|
+
let dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
7125
|
+
if (dosLastModDate < MIN_DATE) {
|
|
7126
|
+
dosLastModDate = MIN_DATE;
|
|
7127
|
+
} else if (dosLastModDate > MAX_DATE) {
|
|
7128
|
+
dosLastModDate = MAX_DATE;
|
|
7129
|
+
}
|
|
7130
|
+
return ((dosLastModDate.getHours() << 3) | (dosLastModDate.getMinutes() >> 3)) & MAX_8_BITS;
|
|
7131
|
+
}
|
|
7132
|
+
|
|
6743
7133
|
function resolveAttributes(zipWriter, name, options) {
|
|
6744
7134
|
let msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE);
|
|
6745
7135
|
let versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, msDosCompatible ? VERSION_MADE_BY_MSDOS : VERSION_MADE_BY_UNIX);
|
|
@@ -6754,7 +7144,7 @@
|
|
|
6754
7144
|
checkIntegerOption(uid, MAX_32_BITS, ERR_INVALID_UID);
|
|
6755
7145
|
checkIntegerOption(gid, MAX_32_BITS, ERR_INVALID_GID);
|
|
6756
7146
|
checkIntegerOption(unixMode, MAX_16_BITS, ERR_INVALID_UNIX_MODE);
|
|
6757
|
-
if (unixExtraFieldType !== UNDEFINED_VALUE && unixExtraFieldType !== INFOZIP_EXTRA_FIELD_TYPE
|
|
7147
|
+
if (unixExtraFieldType !== UNDEFINED_VALUE && unixExtraFieldType !== INFOZIP_EXTRA_FIELD_TYPE && unixExtraFieldType !== UNIX_EXTRA_FIELD_TYPE) {
|
|
6758
7148
|
throw new Error(ERR_INVALID_UNIX_EXTRA_FIELD_TYPE);
|
|
6759
7149
|
}
|
|
6760
7150
|
if (unixExtraFieldType === UNIX_EXTRA_FIELD_TYPE &&
|
|
@@ -6762,7 +7152,7 @@
|
|
|
6762
7152
|
throw new Error(ERR_INVALID_UNIX_ID_SIZE);
|
|
6763
7153
|
}
|
|
6764
7154
|
if (unixExtraFieldType === UNDEFINED_VALUE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
6765
|
-
unixExtraFieldType = INFOZIP_EXTRA_FIELD_TYPE
|
|
7155
|
+
unixExtraFieldType = INFOZIP_EXTRA_FIELD_TYPE;
|
|
6766
7156
|
}
|
|
6767
7157
|
let msdosAttributesRaw = getNumberOptionValue(zipWriter, options, PROPERTY_NAME_MSDOS_ATTRIBUTES_RAW);
|
|
6768
7158
|
let msdosAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_MSDOS_ATTRIBUTES);
|
|
@@ -6893,7 +7283,9 @@
|
|
|
6893
7283
|
const lastAccessDate = getDateOptionValue(zipWriter, options, PROPERTY_NAME_LAST_ACCESS_DATE);
|
|
6894
7284
|
const creationDate = getDateOptionValue(zipWriter, options, PROPERTY_NAME_CREATION_DATE);
|
|
6895
7285
|
const internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, 0);
|
|
6896
|
-
const passThrough = getOptionValue(zipWriter, options, OPTION_PASS_THROUGH);
|
|
7286
|
+
const passThrough = checkPassThroughOption(getOptionValue(zipWriter, options, OPTION_PASS_THROUGH));
|
|
7287
|
+
const passThroughCompression = Boolean(passThrough);
|
|
7288
|
+
const passThroughEncryption = passThrough === true;
|
|
6897
7289
|
const password = getOptionValue(zipWriter, options, OPTION_PASSWORD);
|
|
6898
7290
|
const rawPassword = getOptionValue(zipWriter, options, OPTION_RAW_PASSWORD);
|
|
6899
7291
|
checkPasswordOption(password, rawPassword);
|
|
@@ -6909,10 +7301,11 @@
|
|
|
6909
7301
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6910
7302
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6911
7303
|
throwIfAborted(signal);
|
|
6912
|
-
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES,
|
|
7304
|
+
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES,
|
|
7305
|
+
!isPrintableASCIIText(rawFilename) || !isPrintableASCIIText(rawComment));
|
|
6913
7306
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6914
|
-
const registeredCodec =
|
|
6915
|
-
if (!
|
|
7307
|
+
const registeredCodec = passThroughCompression || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
7308
|
+
if (!passThroughCompression && compressionMethod !== UNDEFINED_VALUE &&
|
|
6916
7309
|
compressionMethod !== COMPRESSION_METHOD_STORE && compressionMethod !== COMPRESSION_METHOD_DEFLATE && !registeredCodec) {
|
|
6917
7310
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
6918
7311
|
}
|
|
@@ -6926,15 +7319,15 @@
|
|
|
6926
7319
|
level = 0;
|
|
6927
7320
|
}
|
|
6928
7321
|
}
|
|
6929
|
-
if (
|
|
6930
|
-
level =
|
|
7322
|
+
if (passThroughCompression) {
|
|
7323
|
+
level = toNumber(options[OPTION_LEVEL]);
|
|
6931
7324
|
}
|
|
6932
7325
|
let useCompressionStream = getOptionValue(zipWriter, options, OPTION_USE_COMPRESSION_STREAM);
|
|
6933
7326
|
let dataDescriptor = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR);
|
|
6934
7327
|
if (bufferedWrite && dataDescriptor === UNDEFINED_VALUE) {
|
|
6935
7328
|
dataDescriptor = false;
|
|
6936
7329
|
}
|
|
6937
|
-
if (dataDescriptor === UNDEFINED_VALUE || (zipCrypto && !
|
|
7330
|
+
if (dataDescriptor === UNDEFINED_VALUE || (zipCrypto && !passThroughEncryption)) {
|
|
6938
7331
|
dataDescriptor = true;
|
|
6939
7332
|
}
|
|
6940
7333
|
if (level !== UNDEFINED_VALUE && level != 6) {
|
|
@@ -6958,7 +7351,8 @@
|
|
|
6958
7351
|
lastAccessDate,
|
|
6959
7352
|
creationDate,
|
|
6960
7353
|
internalFileAttributes,
|
|
6961
|
-
|
|
7354
|
+
passThroughCompression,
|
|
7355
|
+
passThroughEncryption,
|
|
6962
7356
|
password,
|
|
6963
7357
|
rawPassword,
|
|
6964
7358
|
encryptionStrength,
|
|
@@ -7019,7 +7413,7 @@
|
|
|
7019
7413
|
}
|
|
7020
7414
|
|
|
7021
7415
|
async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, options) {
|
|
7022
|
-
if (metadata.
|
|
7416
|
+
if (metadata.passThroughCompression && !reader && !getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY)) {
|
|
7023
7417
|
throw new Error(ERR_UNDEFINED_READER);
|
|
7024
7418
|
}
|
|
7025
7419
|
let contentSize;
|
|
@@ -7035,12 +7429,12 @@
|
|
|
7035
7429
|
}
|
|
7036
7430
|
|
|
7037
7431
|
function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options) {
|
|
7038
|
-
const {
|
|
7432
|
+
const { passThroughCompression, passThroughEncryption, zipCrypto, password, rawPassword, encryptionStrength } = metadata;
|
|
7039
7433
|
let { dataDescriptor, zip64, level, compressionMethod } = metadata;
|
|
7040
7434
|
let maximumCompressedSize = 0;
|
|
7041
7435
|
let uncompressedSize = 0;
|
|
7042
7436
|
let unknownSize = false;
|
|
7043
|
-
if (
|
|
7437
|
+
if (passThroughCompression && hasContent) {
|
|
7044
7438
|
uncompressedSize = options[PROPERTY_NAME_UNCOMPRESSED_SIZE];
|
|
7045
7439
|
if (uncompressedSize === UNDEFINED_VALUE) {
|
|
7046
7440
|
throw new Error(ERR_UNDEFINED_UNCOMPRESSED_SIZE);
|
|
@@ -7051,17 +7445,17 @@
|
|
|
7051
7445
|
}
|
|
7052
7446
|
const zip64Enabled = zip64 === true;
|
|
7053
7447
|
const encrypted = getOptionValue(zipWriter, options, PROPERTY_NAME_ENCRYPTED);
|
|
7054
|
-
if (hasContent &&
|
|
7448
|
+
if (hasContent && passThroughEncryption && !encrypted && getLength(password, rawPassword)) {
|
|
7055
7449
|
throw new Error(ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH);
|
|
7056
7450
|
}
|
|
7057
|
-
const encryptedEntry = hasContent && (Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (
|
|
7451
|
+
const encryptedEntry = hasContent && (Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThroughEncryption && encrypted));
|
|
7058
7452
|
if (!hasContent) {
|
|
7059
7453
|
level = 0;
|
|
7060
7454
|
compressionMethod = COMPRESSION_METHOD_STORE;
|
|
7061
7455
|
}
|
|
7062
|
-
const encryptionOverhead = encryptedEntry
|
|
7456
|
+
const encryptionOverhead = getEncryptionOverhead(encryptedEntry, zipCrypto, encryptionStrength);
|
|
7063
7457
|
if (hasContent) {
|
|
7064
|
-
if (!
|
|
7458
|
+
if (!passThroughCompression) {
|
|
7065
7459
|
if (contentSize === UNDEFINED_VALUE) {
|
|
7066
7460
|
dataDescriptor = true;
|
|
7067
7461
|
if (zip64 || zip64 === UNDEFINED_VALUE) {
|
|
@@ -7074,10 +7468,12 @@
|
|
|
7074
7468
|
}
|
|
7075
7469
|
} else {
|
|
7076
7470
|
options.uncompressedSize = uncompressedSize;
|
|
7077
|
-
maximumCompressedSize = contentSize === UNDEFINED_VALUE ?
|
|
7471
|
+
maximumCompressedSize = contentSize === UNDEFINED_VALUE ?
|
|
7472
|
+
getMaximumCompressedSize(uncompressedSize) + encryptionOverhead :
|
|
7473
|
+
contentSize + (passThroughEncryption ? 0 : encryptionOverhead);
|
|
7078
7474
|
}
|
|
7079
7475
|
}
|
|
7080
|
-
const emptyEntry = !encryptedEntry && (!hasContent || (contentSize === 0 && !
|
|
7476
|
+
const emptyEntry = !encryptedEntry && (!hasContent || (contentSize === 0 && !passThroughCompression)) && !isCompressed(compressionMethod, level);
|
|
7081
7477
|
if (emptyEntry && !zipCrypto && getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR) === UNDEFINED_VALUE) {
|
|
7082
7478
|
dataDescriptor = false;
|
|
7083
7479
|
}
|
|
@@ -7126,6 +7522,8 @@
|
|
|
7126
7522
|
const initialOffset = writerOptions[OPTION_OFFSET] === UNDEFINED_VALUE ? 0 : writerOptions[OPTION_OFFSET];
|
|
7127
7523
|
let offset = initialOffset;
|
|
7128
7524
|
let minimumEntrySize = INFINITY_VALUE;
|
|
7525
|
+
const entrySizes = [];
|
|
7526
|
+
const entriesAlreadyZip64 = new Set();
|
|
7129
7527
|
for (const entry of entries) {
|
|
7130
7528
|
let { name } = entry;
|
|
7131
7529
|
const { size } = entry;
|
|
@@ -7137,7 +7535,7 @@
|
|
|
7137
7535
|
({ name } = attributesInfo);
|
|
7138
7536
|
const { resolvedOptions: metadata } = resolveMetadata(zipWriter, name, options);
|
|
7139
7537
|
if (metadata.level != 0 && metadata.compressionMethod === UNDEFINED_VALUE &&
|
|
7140
|
-
!metadata.
|
|
7538
|
+
!metadata.passThroughCompression && !(await supportsDeflate(getConfiguration()))) {
|
|
7141
7539
|
metadata.level = 0;
|
|
7142
7540
|
}
|
|
7143
7541
|
const hasContent = !getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY);
|
|
@@ -7145,7 +7543,7 @@
|
|
|
7145
7543
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7146
7544
|
}
|
|
7147
7545
|
const { maximumCompressedSize, resolvedOptions: sizes } = resolveEntrySizes(zipWriter, hasContent, size, metadata, options);
|
|
7148
|
-
if (hasContent && !metadata.
|
|
7546
|
+
if (hasContent && !metadata.passThroughCompression && isCompressed(sizes.compressionMethod, sizes.level)) {
|
|
7149
7547
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7150
7548
|
}
|
|
7151
7549
|
const entryOptions = Object.assign({}, options, attributesInfo.resolvedOptions, metadata, sizes, { [OPTION_USDZ]: usdz });
|
|
@@ -7165,10 +7563,15 @@
|
|
|
7165
7563
|
compressedSize
|
|
7166
7564
|
}));
|
|
7167
7565
|
const entrySize = entryInfo.metadataSize + compressedSize;
|
|
7566
|
+
entrySizes.push(entrySize);
|
|
7567
|
+
entriesAlreadyZip64.add(Boolean(entryOptions.zip64Enabled ||
|
|
7568
|
+
entryOptions.uncompressedSize >= MAX_32_BITS || compressedSize >= MAX_32_BITS));
|
|
7168
7569
|
minimumEntrySize = Math.min(minimumEntrySize, entrySize);
|
|
7169
7570
|
offset += entrySize;
|
|
7170
7571
|
}
|
|
7171
|
-
const layoutDependsOnWriteOrder = files.size > 1 && (usdz ||
|
|
7572
|
+
const layoutDependsOnWriteOrder = files.size > 1 && (usdz ||
|
|
7573
|
+
(offset - minimumEntrySize >= MAX_32_BITS &&
|
|
7574
|
+
(entriesAlreadyZip64.size > 1 || countEntriesBefore4GB(entrySizes, initialOffset, true) != countEntriesBefore4GB(entrySizes, initialOffset, false))));
|
|
7172
7575
|
if (layoutDependsOnWriteOrder && !writeOrderGuaranteed) {
|
|
7173
7576
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7174
7577
|
}
|
|
@@ -7186,6 +7589,20 @@
|
|
|
7186
7589
|
return offset - initialOffset + directoryDataLength + commentLength + (zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
7187
7590
|
}
|
|
7188
7591
|
|
|
7592
|
+
function countEntriesBefore4GB(entrySizes, initialOffset, largestFirst) {
|
|
7593
|
+
const ordered = entrySizes.slice().sort((first, second) => largestFirst ? second - first : first - second);
|
|
7594
|
+
let position = initialOffset;
|
|
7595
|
+
let count = 0;
|
|
7596
|
+
for (const entrySize of ordered) {
|
|
7597
|
+
if (position >= MAX_32_BITS) {
|
|
7598
|
+
break;
|
|
7599
|
+
}
|
|
7600
|
+
position += entrySize;
|
|
7601
|
+
count++;
|
|
7602
|
+
}
|
|
7603
|
+
return count;
|
|
7604
|
+
}
|
|
7605
|
+
|
|
7189
7606
|
async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
|
|
7190
7607
|
const {
|
|
7191
7608
|
fileEntries,
|
|
@@ -7361,6 +7778,7 @@
|
|
|
7361
7778
|
localExtraFieldZip64Length,
|
|
7362
7779
|
rawExtraFieldExtendedTimestamp,
|
|
7363
7780
|
extraFieldExtendedTimestampFlag,
|
|
7781
|
+
extraFieldExtendedTimestampTime,
|
|
7364
7782
|
rawExtraFieldNTFS,
|
|
7365
7783
|
rawExtraFieldUnix,
|
|
7366
7784
|
rawExtraFieldAES,
|
|
@@ -7373,6 +7791,7 @@
|
|
|
7373
7791
|
password,
|
|
7374
7792
|
rawPassword,
|
|
7375
7793
|
level,
|
|
7794
|
+
useUnicodeFileNames,
|
|
7376
7795
|
zip64,
|
|
7377
7796
|
zip64Enabled,
|
|
7378
7797
|
zip64UncompressedSize,
|
|
@@ -7407,7 +7826,8 @@
|
|
|
7407
7826
|
msdosAttributesRaw,
|
|
7408
7827
|
msdosAttributes,
|
|
7409
7828
|
useCompressionStream,
|
|
7410
|
-
|
|
7829
|
+
passThroughCompression,
|
|
7830
|
+
passThroughEncryption,
|
|
7411
7831
|
format,
|
|
7412
7832
|
codecURI
|
|
7413
7833
|
} = options;
|
|
@@ -7418,9 +7838,9 @@
|
|
|
7418
7838
|
zip64Enabled,
|
|
7419
7839
|
directory: Boolean(directory),
|
|
7420
7840
|
executable: Boolean(executable),
|
|
7421
|
-
filenameUTF8:
|
|
7841
|
+
filenameUTF8: Boolean(useUnicodeFileNames),
|
|
7422
7842
|
rawFilename,
|
|
7423
|
-
commentUTF8:
|
|
7843
|
+
commentUTF8: Boolean(useUnicodeFileNames),
|
|
7424
7844
|
rawComment,
|
|
7425
7845
|
rawExtraFieldZip64,
|
|
7426
7846
|
localExtraFieldZip64Length,
|
|
@@ -7451,7 +7871,7 @@
|
|
|
7451
7871
|
uncompressedSize
|
|
7452
7872
|
} = options;
|
|
7453
7873
|
let compressedSize = 0;
|
|
7454
|
-
if (!
|
|
7874
|
+
if (!passThroughCompression) {
|
|
7455
7875
|
uncompressedSize = 0;
|
|
7456
7876
|
}
|
|
7457
7877
|
const { writable } = writer;
|
|
@@ -7468,9 +7888,9 @@
|
|
|
7468
7888
|
encryptionStrength,
|
|
7469
7889
|
zipCrypto: encrypted && zipCrypto,
|
|
7470
7890
|
passwordVerification: encrypted && zipCrypto && (rawLastModDate >> 8) & MAX_8_BITS,
|
|
7471
|
-
computeCrc32: !
|
|
7472
|
-
compressed: compressed && !
|
|
7473
|
-
encrypted: encrypted && !
|
|
7891
|
+
computeCrc32: !passThroughCompression,
|
|
7892
|
+
compressed: compressed && !passThroughCompression,
|
|
7893
|
+
encrypted: encrypted && !passThroughEncryption,
|
|
7474
7894
|
useWebWorkers,
|
|
7475
7895
|
useCompressionStream,
|
|
7476
7896
|
transferStreams,
|
|
@@ -7485,7 +7905,7 @@
|
|
|
7485
7905
|
const result = await runWorker({ readable, writable }, workerOptions);
|
|
7486
7906
|
compressedSize = result.outputSize;
|
|
7487
7907
|
writer.size += compressedSize;
|
|
7488
|
-
if (!
|
|
7908
|
+
if (!passThroughCompression) {
|
|
7489
7909
|
uncompressedSize = result.inputSize;
|
|
7490
7910
|
if (!encrypted || zipCrypto) {
|
|
7491
7911
|
crc32 = result.crc32;
|
|
@@ -7496,7 +7916,10 @@
|
|
|
7496
7916
|
throw new Error(ERR_UNSUPPORTED_FORMAT);
|
|
7497
7917
|
}
|
|
7498
7918
|
} catch (error) {
|
|
7499
|
-
|
|
7919
|
+
const { outputSize: failedOutputSize } = workerOptions;
|
|
7920
|
+
if (failedOutputSize !== UNDEFINED_VALUE) {
|
|
7921
|
+
writer.size += failedOutputSize;
|
|
7922
|
+
} else if (isErrorObject(error) && error.outputSize !== UNDEFINED_VALUE) {
|
|
7500
7923
|
writer.size += error.outputSize;
|
|
7501
7924
|
}
|
|
7502
7925
|
throw error;
|
|
@@ -7528,8 +7951,9 @@
|
|
|
7528
7951
|
headerArray,
|
|
7529
7952
|
headerView,
|
|
7530
7953
|
signature: crc32,
|
|
7531
|
-
crc32: encrypted && !zipCrypto && !
|
|
7954
|
+
crc32: encrypted && !zipCrypto && !passThroughCompression ? UNDEFINED_VALUE : crc32,
|
|
7532
7955
|
extraFieldExtendedTimestampFlag,
|
|
7956
|
+
extraFieldExtendedTimestampTime,
|
|
7533
7957
|
zip64UncompressedSize,
|
|
7534
7958
|
zip64CompressedSize
|
|
7535
7959
|
});
|
|
@@ -7554,7 +7978,7 @@
|
|
|
7554
7978
|
encryptionStrength,
|
|
7555
7979
|
extendedTimestamp,
|
|
7556
7980
|
ntfsTimestamp,
|
|
7557
|
-
|
|
7981
|
+
passThroughCompression,
|
|
7558
7982
|
encrypted,
|
|
7559
7983
|
zip64UncompressedSize,
|
|
7560
7984
|
zip64CompressedSize,
|
|
@@ -7565,7 +7989,7 @@
|
|
|
7565
7989
|
let { version, compressionMethod } = options;
|
|
7566
7990
|
const compressed = !directory && isCompressed(compressionMethod, level);
|
|
7567
7991
|
let rawLocalExtraFieldZip64;
|
|
7568
|
-
const uncompressedFile =
|
|
7992
|
+
const uncompressedFile = passThroughCompression || !compressed;
|
|
7569
7993
|
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || (uncompressedFile && !unknownSize)));
|
|
7570
7994
|
const writeLocalExtraFieldZip64 = zip64ExtraFieldComplete || (zip64 && dataDescriptor && (zip64UncompressedSize || zip64CompressedSize));
|
|
7571
7995
|
if (zip64 && (zip64UncompressedSize || zip64CompressedSize)) {
|
|
@@ -7577,8 +8001,8 @@
|
|
|
7577
8001
|
if (zip64ExtraFieldComplete) {
|
|
7578
8002
|
extraFieldZip64.writeUint64(uncompressedSize);
|
|
7579
8003
|
if (uncompressedFile) {
|
|
7580
|
-
const encryptionOverhead = encrypted
|
|
7581
|
-
extraFieldZip64.writeUint64(
|
|
8004
|
+
const encryptionOverhead = getEncryptionOverhead(encrypted, zipCrypto, encryptionStrength);
|
|
8005
|
+
extraFieldZip64.writeUint64(passThroughCompression ? 0 : uncompressedSize + encryptionOverhead);
|
|
7582
8006
|
}
|
|
7583
8007
|
}
|
|
7584
8008
|
} else {
|
|
@@ -7597,6 +8021,7 @@
|
|
|
7597
8021
|
let rawExtraFieldNTFS;
|
|
7598
8022
|
let rawExtraFieldExtendedTimestamp;
|
|
7599
8023
|
let extraFieldExtendedTimestampFlag;
|
|
8024
|
+
let extraFieldExtendedTimestampTime;
|
|
7600
8025
|
if (extendedTimestamp) {
|
|
7601
8026
|
const lastModTimeUnix = getTimeUnix(lastModDate);
|
|
7602
8027
|
const lastModTimeUnixInRange = inUnixTimeRange(lastModTimeUnix);
|
|
@@ -7604,6 +8029,7 @@
|
|
|
7604
8029
|
const extraFieldTimestampLength = 9 + (lastAccessDate ? 4 : 0) + (creationDate ? 4 : 0);
|
|
7605
8030
|
const extraFieldTimestamp = createRecordWriter(extraFieldTimestampLength);
|
|
7606
8031
|
extraFieldExtendedTimestampFlag = 0x1 + (lastAccessDate ? 0x2 : 0) + (creationDate ? 0x4 : 0);
|
|
8032
|
+
extraFieldExtendedTimestampTime = lastModTimeUnix;
|
|
7607
8033
|
extraFieldTimestamp.writeUint16(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
7608
8034
|
extraFieldTimestamp.writeUint16(extraFieldTimestampLength - 4);
|
|
7609
8035
|
extraFieldTimestamp.writeUint8(extraFieldExtendedTimestampFlag);
|
|
@@ -7646,7 +8072,7 @@
|
|
|
7646
8072
|
let rawExtraFieldUnix;
|
|
7647
8073
|
try {
|
|
7648
8074
|
const { uid, gid, unixExtraFieldType } = options;
|
|
7649
|
-
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE
|
|
8075
|
+
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
7650
8076
|
const uidBytes = packUnixId(uid === UNDEFINED_VALUE ? 0 : uid);
|
|
7651
8077
|
const gidBytes = packUnixId(gid === UNDEFINED_VALUE ? 0 : gid);
|
|
7652
8078
|
const payloadLength = 3 + uidBytes.length + gidBytes.length;
|
|
@@ -7687,7 +8113,7 @@
|
|
|
7687
8113
|
}
|
|
7688
8114
|
if (encrypted && !zipCrypto) {
|
|
7689
8115
|
version = version > VERSION_AES ? version : VERSION_AES;
|
|
7690
|
-
if (
|
|
8116
|
+
if (passThroughCompression && crc32 !== UNDEFINED_VALUE) {
|
|
7691
8117
|
rawExtraFieldAES[EXTRAFIELD_OFFSET_AES_VENDOR_VERSION] = VENDOR_VERSION_AE_1;
|
|
7692
8118
|
}
|
|
7693
8119
|
setUint16(getDataView(rawExtraFieldAES), EXTRAFIELD_OFFSET_AES_COMPRESSION_METHOD, compressionMethod);
|
|
@@ -7749,12 +8175,14 @@
|
|
|
7749
8175
|
headerArray,
|
|
7750
8176
|
headerView,
|
|
7751
8177
|
lastModDate: storedLastModDate,
|
|
8178
|
+
lastModDateClamped: storedLastModDate === clampedLastModDate && dosLastModDate.getTime() != clampedLastModDate.getTime(),
|
|
7752
8179
|
rawLastModDate,
|
|
7753
8180
|
encrypted,
|
|
7754
8181
|
compressed,
|
|
7755
8182
|
version,
|
|
7756
8183
|
compressionMethod,
|
|
7757
8184
|
extraFieldExtendedTimestampFlag,
|
|
8185
|
+
extraFieldExtendedTimestampTime,
|
|
7758
8186
|
rawExtraFieldZip64: EMPTY_UINT8_ARRAY,
|
|
7759
8187
|
localExtraFieldZip64Length,
|
|
7760
8188
|
rawExtraFieldExtendedTimestamp,
|
|
@@ -7857,7 +8285,7 @@
|
|
|
7857
8285
|
}, {
|
|
7858
8286
|
zip64,
|
|
7859
8287
|
zipCrypto,
|
|
7860
|
-
|
|
8288
|
+
passThroughCompression,
|
|
7861
8289
|
dataDescriptor
|
|
7862
8290
|
}) {
|
|
7863
8291
|
const {
|
|
@@ -7868,7 +8296,7 @@
|
|
|
7868
8296
|
dataDescriptorView,
|
|
7869
8297
|
dataDescriptorOffset
|
|
7870
8298
|
} = dataDescriptorInfo;
|
|
7871
|
-
if ((!encrypted || zipCrypto ||
|
|
8299
|
+
if ((!encrypted || zipCrypto || passThroughCompression) && crc32 !== UNDEFINED_VALUE) {
|
|
7872
8300
|
setUint32(headerView, HEADER_OFFSET_SIGNATURE, crc32);
|
|
7873
8301
|
if (dataDescriptor) {
|
|
7874
8302
|
setUint32(dataDescriptorView, dataDescriptorOffset, crc32);
|
|
@@ -7899,9 +8327,9 @@
|
|
|
7899
8327
|
uncompressedSize,
|
|
7900
8328
|
zip64UncompressedSize,
|
|
7901
8329
|
zip64CompressedSize
|
|
7902
|
-
}, localHeaderView, { dataDescriptor,
|
|
8330
|
+
}, localHeaderView, { dataDescriptor, passThroughCompression }) {
|
|
7903
8331
|
if (!dataDescriptor) {
|
|
7904
|
-
if (!encrypted || (
|
|
8332
|
+
if (!encrypted || (passThroughCompression && crc32 !== UNDEFINED_VALUE)) {
|
|
7905
8333
|
setUint32(localHeaderView, HEADER_OFFSET_SIGNATURE + LOCAL_HEADER_COMMON_OFFSET, crc32);
|
|
7906
8334
|
}
|
|
7907
8335
|
if (!zip64CompressedSize) {
|
|
@@ -7938,9 +8366,8 @@
|
|
|
7938
8366
|
rawExtraFieldUnix,
|
|
7939
8367
|
rawExtraField,
|
|
7940
8368
|
rawCentralExtraField,
|
|
7941
|
-
extendedTimestamp,
|
|
7942
8369
|
extraFieldExtendedTimestampFlag,
|
|
7943
|
-
|
|
8370
|
+
extraFieldExtendedTimestampTime,
|
|
7944
8371
|
zip64Enabled,
|
|
7945
8372
|
uncompressedSize,
|
|
7946
8373
|
compressedSize
|
|
@@ -7983,16 +8410,15 @@
|
|
|
7983
8410
|
fileEntry.zip64Offset = zip64Offset;
|
|
7984
8411
|
fileEntry.zip64DiskNumberStart = zip64DiskNumberStart;
|
|
7985
8412
|
let rawExtraFieldTimestamp;
|
|
7986
|
-
|
|
7987
|
-
|
|
8413
|
+
if (extraFieldExtendedTimestampTime === UNDEFINED_VALUE) {
|
|
8414
|
+
rawExtraFieldTimestamp = EMPTY_UINT8_ARRAY;
|
|
8415
|
+
} else {
|
|
7988
8416
|
const extraFieldTimestamp = createRecordWriter(9);
|
|
7989
8417
|
extraFieldTimestamp.writeUint16(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
7990
8418
|
extraFieldTimestamp.writeUint16(5);
|
|
7991
8419
|
extraFieldTimestamp.writeUint8(extraFieldExtendedTimestampFlag);
|
|
7992
|
-
extraFieldTimestamp.writeUint32(
|
|
8420
|
+
extraFieldTimestamp.writeUint32(extraFieldExtendedTimestampTime);
|
|
7993
8421
|
rawExtraFieldTimestamp = extraFieldTimestamp.array;
|
|
7994
|
-
} else {
|
|
7995
|
-
rawExtraFieldTimestamp = EMPTY_UINT8_ARRAY;
|
|
7996
8422
|
}
|
|
7997
8423
|
fileEntry.rawExtraFieldExtendedTimestamp = rawExtraFieldTimestamp;
|
|
7998
8424
|
const extraFieldLength = getLength(
|
|
@@ -8492,6 +8918,11 @@
|
|
|
8492
8918
|
};
|
|
8493
8919
|
}
|
|
8494
8920
|
|
|
8921
|
+
function isPrintableASCIIText(rawText) {
|
|
8922
|
+
return rawText.every(characterCode =>
|
|
8923
|
+
characterCode >= MIN_PRINTABLE_ASCII_CHARACTER_CODE && characterCode <= MAX_PRINTABLE_ASCII_CHARACTER_CODE);
|
|
8924
|
+
}
|
|
8925
|
+
|
|
8495
8926
|
function getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod) {
|
|
8496
8927
|
let bitFlag = 0;
|
|
8497
8928
|
if (useUnicodeFileNames) {
|
|
@@ -8653,7 +9084,7 @@
|
|
|
8653
9084
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8654
9085
|
*/
|
|
8655
9086
|
|
|
8656
|
-
const VERSION = "2.
|
|
9087
|
+
const VERSION = "2.13.0";
|
|
8657
9088
|
|
|
8658
9089
|
/*
|
|
8659
9090
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9475,9 +9906,9 @@
|
|
|
9475
9906
|
DecompressionStreamFallback: DecompressionStreamZlib
|
|
9476
9907
|
});
|
|
9477
9908
|
|
|
9478
|
-
function terminateWorkersAndModule() {
|
|
9909
|
+
async function terminateWorkersAndModule() {
|
|
9910
|
+
await terminateWorkers();
|
|
9479
9911
|
modulePromise = null;
|
|
9480
|
-
terminateWorkers();
|
|
9481
9912
|
resetWasmModule();
|
|
9482
9913
|
}
|
|
9483
9914
|
|
|
@@ -9544,7 +9975,10 @@
|
|
|
9544
9975
|
const ERR_ENTRY_EXISTS = "Entry filename already exists";
|
|
9545
9976
|
const ERR_DUPLICATE_IMPORTED_ENTRY = "Duplicate entry filename in the imported zip file";
|
|
9546
9977
|
const ERR_INVALID_DUPLICATES = "Invalid duplicates option (must be \"throw\", \"keep-first\" or \"keep-last\")";
|
|
9547
|
-
const ERR_ANCESTOR_ENTRY = "Entry is
|
|
9978
|
+
const ERR_ANCESTOR_ENTRY = "Entry is an ancestor of target entry";
|
|
9979
|
+
const ERR_ROOT_DIRECTORY_NOT_MOVABLE = "Root directory cannot be moved";
|
|
9980
|
+
const ERR_TARGET_NOT_DIRECTORY = "Target entry is not a directory";
|
|
9981
|
+
const ERR_PARENT_NOT_DIRECTORY = "Parent entry is not a directory";
|
|
9548
9982
|
const ERR_READABLE_CONSUMED = "Readable stream already consumed";
|
|
9549
9983
|
const DUPLICATES_THROW = "throw";
|
|
9550
9984
|
const DUPLICATES_KEEP_FIRST = "keep-first";
|
|
@@ -9552,22 +9986,8 @@
|
|
|
9552
9986
|
const DUPLICATES_VALUES = new Set([DUPLICATES_THROW, DUPLICATES_KEEP_FIRST, DUPLICATES_KEEP_LAST]);
|
|
9553
9987
|
const ERR_INVALID_PASS_THROUGH = "Invalid passThrough option (use readerOptions.passThrough or set uncompressedSize for each entry)";
|
|
9554
9988
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9555
|
-
const
|
|
9989
|
+
const ERR_UNSUPPORTED_PASS_THROUGH_VALUE = "The 'compressed' passThrough option is only supported by Entry#getData() and ZipWriter#add()";
|
|
9556
9990
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9557
|
-
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9558
|
-
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9559
|
-
EXTRAFIELD_TYPE_ZIP64,
|
|
9560
|
-
EXTRAFIELD_TYPE_AES,
|
|
9561
|
-
EXTRAFIELD_TYPE_NTFS,
|
|
9562
|
-
EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP,
|
|
9563
|
-
EXTRAFIELD_TYPE_UNICODE_PATH,
|
|
9564
|
-
EXTRAFIELD_TYPE_UNICODE_COMMENT,
|
|
9565
|
-
EXTRAFIELD_TYPE_USDZ,
|
|
9566
|
-
EXTRAFIELD_TYPE_INFOZIP,
|
|
9567
|
-
EXTRAFIELD_TYPE_UNIX,
|
|
9568
|
-
EXTRAFIELD_TYPE_UNIX_TYPE1,
|
|
9569
|
-
EXTRAFIELD_TYPE_PKWARE_UNIX
|
|
9570
|
-
]);
|
|
9571
9991
|
|
|
9572
9992
|
class ZipEntry {
|
|
9573
9993
|
|
|
@@ -9699,7 +10119,7 @@
|
|
|
9699
10119
|
}));
|
|
9700
10120
|
return true;
|
|
9701
10121
|
} catch (error) {
|
|
9702
|
-
if (error.message == ERR_INVALID_PASSWORD) {
|
|
10122
|
+
if (isErrorObject(error) && error.message == ERR_INVALID_PASSWORD) {
|
|
9703
10123
|
return false;
|
|
9704
10124
|
} else {
|
|
9705
10125
|
throw error;
|
|
@@ -9939,6 +10359,7 @@
|
|
|
9939
10359
|
await initStream(reader);
|
|
9940
10360
|
zipReader = new ZipReader(reader, options);
|
|
9941
10361
|
}
|
|
10362
|
+
checkPassThroughValue(options.passThrough);
|
|
9942
10363
|
const duplicates = checkDuplicatesOption(options.duplicates);
|
|
9943
10364
|
const importedEntries = [];
|
|
9944
10365
|
const entries = await zipReader.getEntries(options);
|
|
@@ -10029,18 +10450,25 @@
|
|
|
10029
10450
|
|
|
10030
10451
|
async exportZip(writer, options = {}) {
|
|
10031
10452
|
const zipEntry = this;
|
|
10453
|
+
const zipWriterProvided = Boolean(writer) && typeof writer.add == FUNCTION_TYPE;
|
|
10032
10454
|
options = Object.assign({}, options);
|
|
10033
|
-
if (options.bufferedWrite === UNDEFINED_VALUE) {
|
|
10455
|
+
if (!zipWriterProvided && options.bufferedWrite === UNDEFINED_VALUE) {
|
|
10034
10456
|
options.bufferedWrite = true;
|
|
10035
10457
|
}
|
|
10036
|
-
const [readers] = await Promise.all([
|
|
10037
|
-
|
|
10458
|
+
const [readers] = await Promise.all([
|
|
10459
|
+
initReaders(zipEntry, checkReaderOptions(options.readerOptions)),
|
|
10460
|
+
zipWriterProvided ? UNDEFINED_VALUE : initStream(writer)
|
|
10461
|
+
]);
|
|
10462
|
+
const zipWriter = zipWriterProvided ? writer : new ZipWriter(writer, options);
|
|
10038
10463
|
await exportZip(zipWriter, zipEntry, getTotalSize([zipEntry], getUncompressedSize), options, readers);
|
|
10464
|
+
if (zipWriterProvided) {
|
|
10465
|
+
return zipWriter;
|
|
10466
|
+
}
|
|
10039
10467
|
await zipWriter.close(options.globalComment);
|
|
10040
10468
|
return writer.getData ? writer.getData() : writer.writable;
|
|
10041
10469
|
}
|
|
10042
10470
|
|
|
10043
|
-
getExportedSize(options = {}) {
|
|
10471
|
+
async getExportedSize(options = {}) {
|
|
10044
10472
|
const zipEntry = this;
|
|
10045
10473
|
options = Object.assign({}, options);
|
|
10046
10474
|
checkReaderOptions(options.readerOptions);
|
|
@@ -10055,7 +10483,7 @@
|
|
|
10055
10483
|
const writeOrderGuaranteed = !options.bufferedWrite ||
|
|
10056
10484
|
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
10057
10485
|
children.every(child => isImplicitDirectory(child) || !child.children.length));
|
|
10058
|
-
return getEntriesSize(options, entries, writeOrderGuaranteed, options.globalComment);
|
|
10486
|
+
return await getEntriesSize(options, entries, writeOrderGuaranteed, options.globalComment);
|
|
10059
10487
|
}
|
|
10060
10488
|
|
|
10061
10489
|
getChildByName(name) {
|
|
@@ -10116,7 +10544,7 @@
|
|
|
10116
10544
|
|
|
10117
10545
|
move(entry, destination) {
|
|
10118
10546
|
if (entry == this.root) {
|
|
10119
|
-
throw new Error(
|
|
10547
|
+
throw new Error(ERR_ROOT_DIRECTORY_NOT_MOVABLE);
|
|
10120
10548
|
} else {
|
|
10121
10549
|
if (destination.directory) {
|
|
10122
10550
|
if (!destination.isDescendantOf(entry)) {
|
|
@@ -10137,7 +10565,7 @@
|
|
|
10137
10565
|
throw new Error(ERR_ANCESTOR_ENTRY);
|
|
10138
10566
|
}
|
|
10139
10567
|
} else {
|
|
10140
|
-
throw new Error(
|
|
10568
|
+
throw new Error(ERR_TARGET_NOT_DIRECTORY);
|
|
10141
10569
|
}
|
|
10142
10570
|
}
|
|
10143
10571
|
}
|
|
@@ -10450,70 +10878,11 @@
|
|
|
10450
10878
|
let zipEntryMetadata = {};
|
|
10451
10879
|
let passThroughOptions = {};
|
|
10452
10880
|
if (child.data instanceof Entry) {
|
|
10453
|
-
const
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
rawLastModDate,
|
|
10459
|
-
creationDate,
|
|
10460
|
-
lastAccessDate,
|
|
10461
|
-
uncompressedSize,
|
|
10462
|
-
encrypted,
|
|
10463
|
-
zipCrypto,
|
|
10464
|
-
crc32,
|
|
10465
|
-
compressionMethod,
|
|
10466
|
-
extraFieldAES,
|
|
10467
|
-
internalFileAttributes,
|
|
10468
|
-
extraField,
|
|
10469
|
-
bitFlag,
|
|
10470
|
-
uid,
|
|
10471
|
-
gid
|
|
10472
|
-
} = child.data;
|
|
10473
|
-
zipEntryMetadata = {
|
|
10474
|
-
externalFileAttributes,
|
|
10475
|
-
versionMadeBy,
|
|
10476
|
-
comment,
|
|
10477
|
-
lastModDate,
|
|
10478
|
-
creationDate,
|
|
10479
|
-
lastAccessDate,
|
|
10480
|
-
internalFileAttributes
|
|
10481
|
-
};
|
|
10482
|
-
const userExtraField = getUserExtraField(extraField);
|
|
10483
|
-
if (userExtraField) {
|
|
10484
|
-
zipEntryMetadata.extraField = userExtraField;
|
|
10485
|
-
}
|
|
10486
|
-
if (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE) {
|
|
10487
|
-
Object.assign(zipEntryMetadata, {
|
|
10488
|
-
uid,
|
|
10489
|
-
gid,
|
|
10490
|
-
unixExtraFieldType: INFOZIP_EXTRA_FIELD_TYPE
|
|
10491
|
-
});
|
|
10492
|
-
}
|
|
10493
|
-
if (isPassThrough(child, options)) {
|
|
10494
|
-
let encryptionStrength;
|
|
10495
|
-
if (extraFieldAES) {
|
|
10496
|
-
encryptionStrength = extraFieldAES.strength;
|
|
10497
|
-
}
|
|
10498
|
-
passThroughOptions = {
|
|
10499
|
-
passThrough: true,
|
|
10500
|
-
encrypted,
|
|
10501
|
-
zipCrypto,
|
|
10502
|
-
crc32,
|
|
10503
|
-
uncompressedSize,
|
|
10504
|
-
encryptionStrength,
|
|
10505
|
-
compressionMethod
|
|
10506
|
-
};
|
|
10507
|
-
if (bitFlag) {
|
|
10508
|
-
passThroughOptions.dataDescriptor = bitFlag.dataDescriptor;
|
|
10509
|
-
}
|
|
10510
|
-
const lastModDateOverride = childOptions.lastModDate === UNDEFINED_VALUE ? options.lastModDate : childOptions.lastModDate;
|
|
10511
|
-
if (lastModDateOverride === UNDEFINED_VALUE) {
|
|
10512
|
-
passThroughOptions.rawLastModDate = rawLastModDate;
|
|
10513
|
-
} else if (zipCrypto && (!bitFlag || bitFlag.dataDescriptor) && lastModDateOverride instanceof Date &&
|
|
10514
|
-
getDosTimeHighByte(lastModDateOverride) != ((rawLastModDate >>> 8) & MAX_8_BITS)) {
|
|
10515
|
-
throw new Error(ERR_ZIP_CRYPTO_LAST_MOD_DATE);
|
|
10516
|
-
}
|
|
10881
|
+
const passThrough = isPassThrough(child, options);
|
|
10882
|
+
const lastModDateOverride = childOptions.lastModDate === UNDEFINED_VALUE ? options.lastModDate : childOptions.lastModDate;
|
|
10883
|
+
({ entryOptions: zipEntryMetadata, passThroughOptions } = getSourceEntryOptions(child.data, passThrough, lastModDateOverride));
|
|
10884
|
+
if (passThrough) {
|
|
10885
|
+
passThroughOptions.passThrough = true;
|
|
10517
10886
|
}
|
|
10518
10887
|
}
|
|
10519
10888
|
const entryOptions = Object.assign({ lastModDate: child.defaultLastModDate }, zipEntryMetadata, options, childOptions, passThroughOptions, { directory: child.directory });
|
|
@@ -10523,16 +10892,6 @@
|
|
|
10523
10892
|
return { name, entryOptions };
|
|
10524
10893
|
}
|
|
10525
10894
|
|
|
10526
|
-
function getDosTimeHighByte(lastModDate) {
|
|
10527
|
-
let dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
10528
|
-
if (dosLastModDate < MIN_DATE) {
|
|
10529
|
-
dosLastModDate = MIN_DATE;
|
|
10530
|
-
} else if (dosLastModDate > MAX_DATE) {
|
|
10531
|
-
dosLastModDate = MAX_DATE;
|
|
10532
|
-
}
|
|
10533
|
-
return ((dosLastModDate.getHours() << 3) | (dosLastModDate.getMinutes() >> 3)) & MAX_8_BITS;
|
|
10534
|
-
}
|
|
10535
|
-
|
|
10536
10895
|
function getDeterminedSize(child, passThrough) {
|
|
10537
10896
|
const { reader } = child;
|
|
10538
10897
|
if (reader && reader.size !== UNDEFINED_VALUE) {
|
|
@@ -10545,9 +10904,18 @@
|
|
|
10545
10904
|
if (readerOptions && (typeof readerOptions != OBJECT_TYPE || Array.isArray(readerOptions))) {
|
|
10546
10905
|
throw new Error(ERR_INVALID_READER_OPTIONS);
|
|
10547
10906
|
}
|
|
10907
|
+
if (readerOptions) {
|
|
10908
|
+
checkPassThroughValue(readerOptions.passThrough);
|
|
10909
|
+
}
|
|
10548
10910
|
return readerOptions;
|
|
10549
10911
|
}
|
|
10550
10912
|
|
|
10913
|
+
function checkPassThroughValue(passThrough) {
|
|
10914
|
+
if (checkPassThroughOption(passThrough) === PASS_THROUGH_COMPRESSED) {
|
|
10915
|
+
throw new Error(ERR_UNSUPPORTED_PASS_THROUGH_VALUE);
|
|
10916
|
+
}
|
|
10917
|
+
}
|
|
10918
|
+
|
|
10551
10919
|
function replaceContent(zipEntry, params) {
|
|
10552
10920
|
const { uncompressedSize } = params;
|
|
10553
10921
|
Object.assign(zipEntry, params, {
|
|
@@ -10576,20 +10944,6 @@
|
|
|
10576
10944
|
return child.directory && child.data === null;
|
|
10577
10945
|
}
|
|
10578
10946
|
|
|
10579
|
-
function getUserExtraField(extraField) {
|
|
10580
|
-
if (extraField) {
|
|
10581
|
-
const userExtraField = new Map();
|
|
10582
|
-
extraField.forEach((field, type) => {
|
|
10583
|
-
if (!INTERPRETED_EXTRA_FIELD_TYPES.has(type)) {
|
|
10584
|
-
userExtraField.set(type, field.data);
|
|
10585
|
-
}
|
|
10586
|
-
});
|
|
10587
|
-
if (userExtraField.size) {
|
|
10588
|
-
return userExtraField;
|
|
10589
|
-
}
|
|
10590
|
-
}
|
|
10591
|
-
}
|
|
10592
|
-
|
|
10593
10947
|
async function exportZip(zipWriter, entry, totalSize, options, readers) {
|
|
10594
10948
|
const { onstart, onprogress, onend, onentryprogress } = options;
|
|
10595
10949
|
const selectedEntry = entry;
|
|
@@ -10692,6 +11046,7 @@
|
|
|
10692
11046
|
|
|
10693
11047
|
async function exportFileSystemHandle(zipEntry, directoryHandle, options) {
|
|
10694
11048
|
const { onstart, onprogress, onend } = options;
|
|
11049
|
+
checkPassThroughValue(options.passThrough);
|
|
10695
11050
|
const readerOptions = checkReaderOptions(options.readerOptions);
|
|
10696
11051
|
const abortController = new AbortController();
|
|
10697
11052
|
const { signal } = abortController;
|
|
@@ -10767,7 +11122,7 @@
|
|
|
10767
11122
|
if (exportAborted || isExportAborted(signal.reason)) {
|
|
10768
11123
|
return;
|
|
10769
11124
|
}
|
|
10770
|
-
|
|
11125
|
+
throwIfAborted(signal);
|
|
10771
11126
|
}
|
|
10772
11127
|
try {
|
|
10773
11128
|
if (child.directory) {
|
|
@@ -10900,7 +11255,7 @@
|
|
|
10900
11255
|
}
|
|
10901
11256
|
return directory ? new ZipDirectoryEntry(parent.fs, name, params, parent) : new ZipFileEntry(parent.fs, name, params, parent);
|
|
10902
11257
|
} else {
|
|
10903
|
-
throw new Error(
|
|
11258
|
+
throw new Error(ERR_PARENT_NOT_DIRECTORY);
|
|
10904
11259
|
}
|
|
10905
11260
|
}
|
|
10906
11261
|
|
|
@@ -11042,6 +11397,7 @@
|
|
|
11042
11397
|
exports.Data64URIWriter = Data64URIWriter;
|
|
11043
11398
|
exports.ERR_ABORTED = ERR_ABORTED;
|
|
11044
11399
|
exports.ERR_AMBIGUOUS_ARCHIVE = ERR_AMBIGUOUS_ARCHIVE;
|
|
11400
|
+
exports.ERR_ANCESTOR_ENTRY = ERR_ANCESTOR_ENTRY;
|
|
11045
11401
|
exports.ERR_BAD_FORMAT = ERR_BAD_FORMAT;
|
|
11046
11402
|
exports.ERR_CENTRAL_DIRECTORY_NOT_FOUND = ERR_CENTRAL_DIRECTORY_NOT_FOUND;
|
|
11047
11403
|
exports.ERR_DUPLICATED_NAME = ERR_DUPLICATED_NAME;
|
|
@@ -11055,7 +11411,9 @@
|
|
|
11055
11411
|
exports.ERR_EXTRAFIELD_ZIP64_NOT_FOUND = ERR_EXTRAFIELD_ZIP64_NOT_FOUND;
|
|
11056
11412
|
exports.ERR_HTTP_RANGE = ERR_HTTP_RANGE;
|
|
11057
11413
|
exports.ERR_HTTP_RESOURCE_CHANGED = ERR_HTTP_RESOURCE_CHANGED;
|
|
11414
|
+
exports.ERR_HTTP_STATUS = ERR_HTTP_STATUS;
|
|
11058
11415
|
exports.ERR_INVALID_AUTHENTICATION_CODE = ERR_INVALID_AUTHENTICATION_CODE;
|
|
11416
|
+
exports.ERR_INVALID_BASE_URI = ERR_INVALID_BASE_URI;
|
|
11059
11417
|
exports.ERR_INVALID_CODEC_DEFINITION = ERR_INVALID_CODEC_DEFINITION;
|
|
11060
11418
|
exports.ERR_INVALID_CODEC_MODULE = ERR_INVALID_CODEC_MODULE;
|
|
11061
11419
|
exports.ERR_INVALID_COMMENT = ERR_INVALID_COMMENT;
|
|
@@ -11065,6 +11423,7 @@
|
|
|
11065
11423
|
exports.ERR_INVALID_DATE = ERR_INVALID_DATE;
|
|
11066
11424
|
exports.ERR_INVALID_DUPLICATES = ERR_INVALID_DUPLICATES;
|
|
11067
11425
|
exports.ERR_INVALID_ENCRYPTION_STRENGTH = ERR_INVALID_ENCRYPTION_STRENGTH;
|
|
11426
|
+
exports.ERR_INVALID_ENTRY = ERR_INVALID_ENTRY;
|
|
11068
11427
|
exports.ERR_INVALID_ENTRY_COMMENT = ERR_INVALID_ENTRY_COMMENT;
|
|
11069
11428
|
exports.ERR_INVALID_ENTRY_COMMENT_TYPE = ERR_INVALID_ENTRY_COMMENT_TYPE;
|
|
11070
11429
|
exports.ERR_INVALID_ENTRY_NAME = ERR_INVALID_ENTRY_NAME;
|
|
@@ -11083,6 +11442,7 @@
|
|
|
11083
11442
|
exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
|
|
11084
11443
|
exports.ERR_INVALID_PASSWORD_TYPE = ERR_INVALID_PASSWORD_TYPE;
|
|
11085
11444
|
exports.ERR_INVALID_PASS_THROUGH = ERR_INVALID_PASS_THROUGH;
|
|
11445
|
+
exports.ERR_INVALID_PASS_THROUGH_VALUE = ERR_INVALID_PASS_THROUGH_VALUE;
|
|
11086
11446
|
exports.ERR_INVALID_READER = ERR_INVALID_READER;
|
|
11087
11447
|
exports.ERR_INVALID_READER_OPTIONS = ERR_INVALID_READER_OPTIONS;
|
|
11088
11448
|
exports.ERR_INVALID_SIGNAL = ERR_INVALID_SIGNAL;
|
|
@@ -11093,14 +11453,19 @@
|
|
|
11093
11453
|
exports.ERR_INVALID_UNIX_EXTRA_FIELD_TYPE = ERR_INVALID_UNIX_EXTRA_FIELD_TYPE;
|
|
11094
11454
|
exports.ERR_INVALID_UNIX_ID_SIZE = ERR_INVALID_UNIX_ID_SIZE;
|
|
11095
11455
|
exports.ERR_INVALID_UNIX_MODE = ERR_INVALID_UNIX_MODE;
|
|
11456
|
+
exports.ERR_INVALID_URI = ERR_INVALID_URI;
|
|
11096
11457
|
exports.ERR_INVALID_VERSION = ERR_INVALID_VERSION;
|
|
11097
11458
|
exports.ERR_ITERATOR_COMPLETED_TOO_SOON = ERR_ITERATOR_COMPLETED_TOO_SOON;
|
|
11098
11459
|
exports.ERR_LOCAL_FILE_HEADER_NOT_FOUND = ERR_LOCAL_FILE_HEADER_NOT_FOUND;
|
|
11099
11460
|
exports.ERR_OVERLAPPING_ENTRY = ERR_OVERLAPPING_ENTRY;
|
|
11461
|
+
exports.ERR_PARENT_NOT_DIRECTORY = ERR_PARENT_NOT_DIRECTORY;
|
|
11100
11462
|
exports.ERR_READABLE_CONSUMED = ERR_READABLE_CONSUMED;
|
|
11101
11463
|
exports.ERR_RESERVED_COMPRESSION_METHOD = ERR_RESERVED_COMPRESSION_METHOD;
|
|
11464
|
+
exports.ERR_ROOT_DIRECTORY_NOT_MOVABLE = ERR_ROOT_DIRECTORY_NOT_MOVABLE;
|
|
11102
11465
|
exports.ERR_SPLIT_ZIP_FILE = ERR_SPLIT_ZIP_FILE;
|
|
11466
|
+
exports.ERR_TARGET_NOT_DIRECTORY = ERR_TARGET_NOT_DIRECTORY;
|
|
11103
11467
|
exports.ERR_UNDEFINED_COMPRESSION_METHOD = ERR_UNDEFINED_COMPRESSION_METHOD;
|
|
11468
|
+
exports.ERR_UNDEFINED_CRC32 = ERR_UNDEFINED_CRC32;
|
|
11104
11469
|
exports.ERR_UNDEFINED_READER = ERR_UNDEFINED_READER;
|
|
11105
11470
|
exports.ERR_UNDEFINED_UNCOMPRESSED_SIZE = ERR_UNDEFINED_UNCOMPRESSED_SIZE;
|
|
11106
11471
|
exports.ERR_UNDETERMINED_SIZE = ERR_UNDETERMINED_SIZE;
|
|
@@ -11112,10 +11477,12 @@
|
|
|
11112
11477
|
exports.ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH;
|
|
11113
11478
|
exports.ERR_UNSUPPORTED_ENCRYPTION_USDZ = ERR_UNSUPPORTED_ENCRYPTION_USDZ;
|
|
11114
11479
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
|
11480
|
+
exports.ERR_UNSUPPORTED_PASS_THROUGH_VALUE = ERR_UNSUPPORTED_PASS_THROUGH_VALUE;
|
|
11115
11481
|
exports.ERR_UNSUPPORTED_SPLIT_USDZ = ERR_UNSUPPORTED_SPLIT_USDZ;
|
|
11116
11482
|
exports.ERR_UNSUPPORTED_UINT64 = ERR_UNSUPPORTED_UINT64;
|
|
11117
11483
|
exports.ERR_WORKER_STARTUP_TIMEOUT = ERR_WORKER_STARTUP_TIMEOUT;
|
|
11118
11484
|
exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
|
|
11485
|
+
exports.ERR_WRITER_SIZE_NOT_WRITABLE = ERR_WRITER_SIZE_NOT_WRITABLE;
|
|
11119
11486
|
exports.ERR_ZIP_CRYPTO_LAST_MOD_DATE = ERR_ZIP_CRYPTO_LAST_MOD_DATE;
|
|
11120
11487
|
exports.ERR_ZIP_NOT_EMPTY = ERR_ZIP_NOT_EMPTY;
|
|
11121
11488
|
exports.HttpRangeReader = HttpRangeReader;
|
|
@@ -11129,13 +11496,17 @@
|
|
|
11129
11496
|
exports.Uint8ArrayWriter = Uint8ArrayWriter;
|
|
11130
11497
|
exports.VERSION = VERSION;
|
|
11131
11498
|
exports.WARNING_APPENDED_DATA = WARNING_APPENDED_DATA;
|
|
11499
|
+
exports.WARNING_CLAMPED_LAST_MODIFICATION_DATE = WARNING_CLAMPED_LAST_MODIFICATION_DATE;
|
|
11132
11500
|
exports.WARNING_COMPRESSED_PATCHED_DATA = WARNING_COMPRESSED_PATCHED_DATA;
|
|
11501
|
+
exports.WARNING_COMPRESSION_UNAVAILABLE = WARNING_COMPRESSION_UNAVAILABLE;
|
|
11133
11502
|
exports.WARNING_DUPLICATE_FILENAME = WARNING_DUPLICATE_FILENAME;
|
|
11134
11503
|
exports.WARNING_MALFORMED_EXTRA_FIELD = WARNING_MALFORMED_EXTRA_FIELD;
|
|
11135
11504
|
exports.WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG = WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG;
|
|
11136
11505
|
exports.WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD = WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD;
|
|
11137
11506
|
exports.WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES = WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES;
|
|
11507
|
+
exports.WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME = WARNING_MISMATCHED_LOCAL_FILE_HEADER_FILENAME;
|
|
11138
11508
|
exports.WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY = WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY;
|
|
11509
|
+
exports.WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY = WARNING_MULTIPLE_END_OF_CENTRAL_DIRECTORY;
|
|
11139
11510
|
exports.WARNING_PREPENDED_CENTRAL_DIRECTORY = WARNING_PREPENDED_CENTRAL_DIRECTORY;
|
|
11140
11511
|
exports.WARNING_PREPENDED_DATA = WARNING_PREPENDED_DATA;
|
|
11141
11512
|
exports.WARNING_TRAILING_CENTRAL_DIRECTORY_DATA = WARNING_TRAILING_CENTRAL_DIRECTORY_DATA;
|