@zip.js/zip.js 2.12.0 → 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 +126 -33
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +126 -33
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +127 -34
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +127 -34
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +127 -34
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +129 -36
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +128 -35
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +128 -35
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +128 -35
- 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 +127 -34
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +129 -36
- package/index-native.min.js +1 -1
- package/index.cjs +128 -35
- package/index.d.cts +13 -7
- package/index.d.ts +13 -7
- package/index.min.js +1 -1
- package/lib/core/codec-worker-web.js +64 -22
- package/lib/core/codec-worker.js +15 -3
- package/lib/core/util/error.js +35 -0
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-base.js +43 -7
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-fs.js +2 -1
- package/lib/core/zip-reader.js +9 -4
- package/lib/core/zip-writer.js +8 -3
- package/package.json +1 -1
- package/worker-message-property-names.js +1 -1
package/dist/zip-fs.js
CHANGED
|
@@ -445,7 +445,7 @@
|
|
|
445
445
|
Object.assign(config, DEFAULT_CONFIGURATION);
|
|
446
446
|
}
|
|
447
447
|
|
|
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 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 s=[];let r=0,c=0;function i(){const n=new o(t);let e=0;for(;e<t;){const r=s[0],o=t-e;r.length<=o?(n.set(r,e),e+=r.length,s.shift()):(n.set(r.subarray(0,o),e),s[0]=r.subarray(o),e+=o)}return r-=t,n}(!e.isFinite(t)||t<1)&&(t=65536),super({transform(n,e){for(s.push(n),r+=n.length;r>t;)c+=t,e.enqueue(i())},flush(t){r&&(c+=r,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}(s,r)))}}),n.defineProperty(this,"outputSize",{get:()=>c})}}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,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: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)))}(i.format,i.codecURI)}catch(t){throw t.codecImportFailed=!0,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=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}(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=>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()}},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 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}},u),n=new qt(i,a),o=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}(a)),Yt=new AbortController;const{signal:h}=Yt;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;tn({type:Ht,result:{crc32:p,inputSize:d,outputSize:S}})}catch(t){if(t.outputSize=o?o.outputSize:0,c&&!c.locked)try{await c.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)}});
|
|
449
449
|
|
|
450
450
|
/*
|
|
451
451
|
Copyright (c) 2026 Gildas Lormeau. All rights reserved.
|
|
@@ -491,6 +491,39 @@
|
|
|
491
491
|
return new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
492
492
|
}
|
|
493
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
|
+
|
|
494
527
|
/*
|
|
495
528
|
Copyright (c) 2022 Gildas Lormeau. All rights reserved.
|
|
496
529
|
|
|
@@ -2762,7 +2795,9 @@
|
|
|
2762
2795
|
|
|
2763
2796
|
class CodecWorker {
|
|
2764
2797
|
|
|
2765
|
-
constructor(workerData, { readable, writable },
|
|
2798
|
+
constructor(workerData, { readable, writable }, workerOptions, onTaskFinished) {
|
|
2799
|
+
const { options, config, streamOptions, useWebWorkers, transferStreams, workerURI } = workerOptions;
|
|
2800
|
+
let { createWorker } = workerOptions;
|
|
2766
2801
|
const { signal } = streamOptions;
|
|
2767
2802
|
if (createWorkerFailed) {
|
|
2768
2803
|
createWorker = UNDEFINED_VALUE;
|
|
@@ -2775,6 +2810,7 @@
|
|
|
2775
2810
|
.pipeThrough(new ProgressWatcherStream(streamOptions), { signal }),
|
|
2776
2811
|
writable,
|
|
2777
2812
|
options: Object.assign({}, options),
|
|
2813
|
+
workerOptions,
|
|
2778
2814
|
workerURI,
|
|
2779
2815
|
createWorker,
|
|
2780
2816
|
transferStreams,
|
|
@@ -2856,7 +2892,7 @@
|
|
|
2856
2892
|
};
|
|
2857
2893
|
}
|
|
2858
2894
|
|
|
2859
|
-
async function runWorker$1({ options, readable, writable, onTaskFinished }, config) {
|
|
2895
|
+
async function runWorker$1({ options, readable, writable, onTaskFinished, workerOptions }, config) {
|
|
2860
2896
|
let codecStream, chunkStream;
|
|
2861
2897
|
try {
|
|
2862
2898
|
if (options.compressed && !options.format) {
|
|
@@ -2897,7 +2933,15 @@
|
|
|
2897
2933
|
};
|
|
2898
2934
|
} catch (error) {
|
|
2899
2935
|
if (codecStream) {
|
|
2900
|
-
|
|
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
|
+
}
|
|
2901
2945
|
}
|
|
2902
2946
|
throw error;
|
|
2903
2947
|
} finally {
|
|
@@ -3007,8 +3051,14 @@
|
|
|
3007
3051
|
const result = new Promise((resolve, reject) => {
|
|
3008
3052
|
resolveResult = resolve;
|
|
3009
3053
|
rejectResult = error => {
|
|
3010
|
-
|
|
3011
|
-
|
|
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
|
+
}
|
|
3012
3062
|
}
|
|
3013
3063
|
reject(error);
|
|
3014
3064
|
};
|
|
@@ -3277,21 +3327,15 @@
|
|
|
3277
3327
|
}
|
|
3278
3328
|
|
|
3279
3329
|
async function onMessage({ data }, workerData) {
|
|
3280
|
-
const { type, value, messageId, result, error } = data;
|
|
3330
|
+
const { type, value, messageId, result, error, errorValue } = data;
|
|
3281
3331
|
const { reader, writer, resolveResult, rejectResult, onTaskFinished, generation } = workerData;
|
|
3282
3332
|
const stale = () => workerData.generation != generation;
|
|
3283
3333
|
try {
|
|
3284
3334
|
if (error) {
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
Object.assign(responseError, { stack, code, name, outputSize });
|
|
3288
|
-
if (cause) {
|
|
3289
|
-
responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
|
|
3290
|
-
}
|
|
3291
|
-
if (codecImportFailed) {
|
|
3292
|
-
responseError.codecImportFailed = true;
|
|
3335
|
+
if (error.outputSize !== UNDEFINED_VALUE) {
|
|
3336
|
+
workerData.outputSize = error.outputSize;
|
|
3293
3337
|
}
|
|
3294
|
-
|
|
3338
|
+
fail(getResponseError(error, errorValue));
|
|
3295
3339
|
} else {
|
|
3296
3340
|
if (type == MESSAGE_PULL) {
|
|
3297
3341
|
const { value, done } = await reader.read();
|
|
@@ -3309,32 +3353,73 @@
|
|
|
3309
3353
|
}
|
|
3310
3354
|
}
|
|
3311
3355
|
if (type == MESSAGE_CLOSE) {
|
|
3312
|
-
|
|
3356
|
+
succeed(result);
|
|
3313
3357
|
}
|
|
3314
3358
|
}
|
|
3315
3359
|
} catch (error) {
|
|
3316
3360
|
if (!stale()) {
|
|
3317
3361
|
terminateWorker$1(workerData);
|
|
3318
|
-
|
|
3362
|
+
fail(error);
|
|
3319
3363
|
}
|
|
3320
3364
|
}
|
|
3321
3365
|
|
|
3322
|
-
function
|
|
3323
|
-
if (stale()) {
|
|
3324
|
-
return;
|
|
3325
|
-
}
|
|
3326
|
-
if (error) {
|
|
3366
|
+
function fail(error) {
|
|
3367
|
+
if (!stale()) {
|
|
3327
3368
|
rejectResult(error);
|
|
3328
|
-
|
|
3369
|
+
releaseWriter();
|
|
3370
|
+
if (!(isErrorObject(error) && error.codecImportFailed)) {
|
|
3371
|
+
onTaskFinished();
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
function succeed(result) {
|
|
3377
|
+
if (!stale()) {
|
|
3329
3378
|
resolveResult(result);
|
|
3379
|
+
releaseWriter();
|
|
3380
|
+
onTaskFinished();
|
|
3330
3381
|
}
|
|
3382
|
+
}
|
|
3383
|
+
|
|
3384
|
+
function releaseWriter() {
|
|
3331
3385
|
if (writer) {
|
|
3332
3386
|
writer.releaseLock();
|
|
3333
3387
|
}
|
|
3334
|
-
|
|
3335
|
-
|
|
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 });
|
|
3336
3400
|
}
|
|
3337
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;
|
|
3338
3423
|
}
|
|
3339
3424
|
|
|
3340
3425
|
/*
|
|
@@ -5616,7 +5701,7 @@
|
|
|
5616
5701
|
readRanges
|
|
5617
5702
|
});
|
|
5618
5703
|
}
|
|
5619
|
-
let writable, abortError;
|
|
5704
|
+
let writable, abortError, aborted;
|
|
5620
5705
|
try {
|
|
5621
5706
|
if (!checkOverlappingEntryOnly) {
|
|
5622
5707
|
if (checkPasswordOnly) {
|
|
@@ -5632,18 +5717,22 @@
|
|
|
5632
5717
|
writer.size += writtenSize;
|
|
5633
5718
|
}
|
|
5634
5719
|
} catch (error) {
|
|
5635
|
-
|
|
5720
|
+
const { outputSize: failedOutputSize } = workerOptions;
|
|
5721
|
+
if (failedOutputSize !== UNDEFINED_VALUE) {
|
|
5722
|
+
writer.size += failedOutputSize;
|
|
5723
|
+
} else if (isErrorObject(error) && error.outputSize !== UNDEFINED_VALUE) {
|
|
5636
5724
|
writer.size += error.outputSize;
|
|
5637
5725
|
}
|
|
5638
|
-
if (!checkPasswordOnly || error.message != ERR_ABORT_CHECK_PASSWORD) {
|
|
5726
|
+
if (!checkPasswordOnly || !isErrorObject(error) || error.message != ERR_ABORT_CHECK_PASSWORD) {
|
|
5639
5727
|
abortError = error;
|
|
5728
|
+
aborted = true;
|
|
5640
5729
|
throw error;
|
|
5641
5730
|
}
|
|
5642
5731
|
} finally {
|
|
5643
5732
|
const preventClose = !ownsWritable(writer) && getOptionValue$1(zipEntry, options, OPTION_PREVENT_CLOSE);
|
|
5644
5733
|
if (!preventClose && writable && !writable.locked) {
|
|
5645
5734
|
const writableWriter = writable.getWriter();
|
|
5646
|
-
if (
|
|
5735
|
+
if (aborted) {
|
|
5647
5736
|
try {
|
|
5648
5737
|
await writableWriter.abort(abortError);
|
|
5649
5738
|
} catch {
|
|
@@ -6703,7 +6792,7 @@
|
|
|
6703
6792
|
await Promise.allSettled(Array.from(pendingAddFileCalls));
|
|
6704
6793
|
}
|
|
6705
6794
|
await Promise.allSettled(zipWriter.pendingErrors.map(watcher => watcher.recorded));
|
|
6706
|
-
const unobservedWatchers = zipWriter.pendingErrors.filter(watcher => watcher.
|
|
6795
|
+
const unobservedWatchers = zipWriter.pendingErrors.filter(watcher => watcher.failed && !watcher.observed);
|
|
6707
6796
|
if (unobservedWatchers.length) {
|
|
6708
6797
|
const unobservedErrors = unobservedWatchers.map(watcher => watcher.error);
|
|
6709
6798
|
unobservedWatchers.forEach(watcher => watcher.observed = true);
|
|
@@ -6812,7 +6901,8 @@
|
|
|
6812
6901
|
const watchedPromise = new WatchedPromise((resolve, reject) => Promise.prototype.then.call(promise, resolve, reject));
|
|
6813
6902
|
const watcher = {};
|
|
6814
6903
|
watchedPromise.watcher = watcher;
|
|
6815
|
-
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 }));
|
|
6816
6906
|
zipWriter.pendingErrors.push(watcher);
|
|
6817
6907
|
return watchedPromise;
|
|
6818
6908
|
}
|
|
@@ -7826,7 +7916,10 @@
|
|
|
7826
7916
|
throw new Error(ERR_UNSUPPORTED_FORMAT);
|
|
7827
7917
|
}
|
|
7828
7918
|
} catch (error) {
|
|
7829
|
-
|
|
7919
|
+
const { outputSize: failedOutputSize } = workerOptions;
|
|
7920
|
+
if (failedOutputSize !== UNDEFINED_VALUE) {
|
|
7921
|
+
writer.size += failedOutputSize;
|
|
7922
|
+
} else if (isErrorObject(error) && error.outputSize !== UNDEFINED_VALUE) {
|
|
7830
7923
|
writer.size += error.outputSize;
|
|
7831
7924
|
}
|
|
7832
7925
|
throw error;
|
|
@@ -8991,7 +9084,7 @@
|
|
|
8991
9084
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8992
9085
|
*/
|
|
8993
9086
|
|
|
8994
|
-
const VERSION = "2.
|
|
9087
|
+
const VERSION = "2.13.0";
|
|
8995
9088
|
|
|
8996
9089
|
/*
|
|
8997
9090
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -10026,7 +10119,7 @@
|
|
|
10026
10119
|
}));
|
|
10027
10120
|
return true;
|
|
10028
10121
|
} catch (error) {
|
|
10029
|
-
if (error.message == ERR_INVALID_PASSWORD) {
|
|
10122
|
+
if (isErrorObject(error) && error.message == ERR_INVALID_PASSWORD) {
|
|
10030
10123
|
return false;
|
|
10031
10124
|
} else {
|
|
10032
10125
|
throw error;
|