@zip.js/zip.js 2.8.41 → 2.8.42
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/README.md +37 -0
- package/deno.json +6 -2
- package/dist/README.md +10 -1
- package/dist/zip-core-external.js +8180 -0
- package/dist/zip-core-external.min.js +1 -0
- package/dist/zip-core.js +55 -3
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +9196 -0
- package/dist/zip-fs-core-external.min.js +1 -0
- package/dist/zip-fs-core.js +55 -3
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +10833 -0
- package/dist/zip-fs-external.min.js +1 -0
- package/dist/zip-fs-native.js +57 -5
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +131 -24
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +57 -5
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +57 -5
- 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 +131 -24
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +57 -5
- package/index-native.min.js +1 -1
- package/index.cjs +131 -24
- package/index.min.js +1 -1
- package/lib/core/codec-worker.js +4 -1
- package/lib/core/external-assets.js +42 -0
- package/lib/core/streams/zip-entry-stream.js +51 -2
- package/lib/core/streams/zlib-wasm/zlib-streams-loader.js +27 -17
- package/lib/core/streams/zlib-wasm/zlib-streams.js +14 -1
- package/lib/core/web-worker-base.js +6 -2
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/zip-core-external.js +34 -0
- package/lib/zip-fs-core-external.js +30 -0
- package/lib/zip-fs-external.js +30 -0
- package/lib/zip-mime-types.js +29 -0
- package/lib/zip-module-wasm-base.js +64 -0
- package/lib/zip-module-wasm.js +1 -31
- package/package.json +63 -2
- package/worker-message-property-names.js +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=4294967295,e=65535,r=255,n=67324752,a=134695760,s=a,i=33639248,o=101010256,c=101075792,l=117853008,d=22,u=20,f=21589,w=2048,h=16384,p=2048,m=1024,y="/",b=30,S=new Date(2107,11,31,23,59,58),g=new Date(1980,0,1),E=void 0,x=1/0,z="undefined",R="function",A=new Uint8Array;let F=2;try{typeof navigator!=z&&navigator.hardwareConcurrency&&(F=navigator.hardwareConcurrency)}catch{}const D={workerURI:"./core/web-worker-wasm.js",wasmURI:"./core/streams/zlib-wasm/zlib-streams.wasm",chunkSize:65536,maxWorkers:F,terminateWorkerTimeout:5e3,workerStarvationTimeout:5e3,workerStartupTimeout:5e3,useWebWorkers:!0,useCompressionStream:!0,transferStreams:!0,CompressionStream:typeof CompressionStream!=z&&CompressionStream,DecompressionStream:typeof DecompressionStream!=z&&DecompressionStream},U=["baseURI","wasmURI","workerURI","chunkSize","maxWorkers","terminateWorkerTimeout","workerStarvationTimeout","workerStartupTimeout","useCompressionStream","useWebWorkers","transferStreams","CompressionStream","DecompressionStream","CompressionStreamZlib","DecompressionStreamZlib"],O={...D};function T(){return O}function k(t){return Math.max(t.chunkSize,64)}function v(t){for(const e of U){const r=t[e];r!==E&&(O[e]=r)}}function M(t){for(const e of U){const r=t[e];r!==E&&(D[e]=r)}v(t)}function C(){for(const t of U)delete O[t];Object.assign(O,D)}const I="Invalid codec definition",j="Reserved compression method",P="Invalid codec module",N="string",W=[0,8,9,99],_=new Map,B=new Map;function L(t={}){const{compressionMethod:r,format:n,codecURI:a,CompressionStream:s,DecompressionStream:i,versionNeeded:o}=t;if(!Number.isInteger(r)||0>r||r>e||typeof n!=N||!n.length)throw Error(I);if(W.includes(r))throw Error(j);const c=typeof s==R||typeof i==R;if(!(c||typeof a==N&&a.length))throw Error(I);_.set(r,{compressionMethod:r,format:n,codecURI:a,versionNeeded:o}),c&&q(n,{CompressionStream:s,DecompressionStream:i})}function Z(t){const e=_.get(t);if(e){let r;_.delete(t),_.forEach(t=>r=r||t.format==e.format),r||B.delete(e.format)}}function V(t){return _.get(t)}function H(t){return B.get(t)}function q(t,e){const{CompressionStream:r,DecompressionStream:n}=e;if(typeof r!=R&&typeof n!=R)throw Error(P);B.set(t,{CompressionStream:r,DecompressionStream:n})}const K=[[],[],[],[],[],[],[],[]];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?e>>>1^3988292384:e>>>1;K[0][t]=e}for(let t=0;256>t;t++)for(let e=1;8>e;e++){const r=K[e-1][t];K[e][t]=r>>>8^K[0][255&r]}const[Y,G,X,J,Q,$,tt,et]=K;class rt{constructor(t){this.o=t||-1}append(t){let e=0|this.o;const r=0|t.length;let n=0;if(r>=8&&t.buffer){const a=new DataView(t.buffer,t.byteOffset,r),s=r-8;for(;s>=n;n+=8){const t=e^a.getInt32(n,!0),r=a.getInt32(n+4,!0);e=et[255&t]^tt[t>>>8&255]^$[t>>>16&255]^Q[t>>>24&255]^J[255&r]^X[r>>>8&255]^G[r>>>16&255]^Y[r>>>24&255]}}for(;r>n;n++)e=e>>>8^Y[255&(e^t[n])];this.o=e}get(){return~this.o}}class nt extends TransformStream{constructor(){let t;const e=new rt;super({transform(t,r){e.append(t),r.enqueue(t)},flush(){const r=new Uint8Array(4);new DataView(r.buffer).setUint32(0,e.get()),t.value=r}}),t=this}}function at(t){if(typeof TextEncoder==z){t=unescape(encodeURIComponent(t));const e=new Uint8Array(t.length);for(let r=0;r<e.length;r++)e[r]=t.charCodeAt(r);return e}return(new TextEncoder).encode(t)}function st(t,e){const r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}function it(t){return t.byteOffset||t.byteLength!=t.buffer.byteLength?new Uint8Array(t):t}function ot(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const ct={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const r=t[t.length-1],n=ct.l(r);return 32===n?t.concat(e):ct.h(e,n,0|r,t.slice(0,t.length-1))},m(t){const e=t.length;if(0===e)return 0;const r=t[e-1];return 32*(e-1)+ct.l(r)},S(t,e){if(32*t.length<e)return t;const r=(t=t.slice(0,Math.ceil(e/32))).length;return e&=31,r>0&&e&&(t[r-1]=ct.R(e,t[r-1]&2147483648>>e-1,1)),t},R:(t,e,r)=>32===t?e:(r?0|e:e<<32-t)+1099511627776*t,l:t=>Math.round(t/1099511627776)||32,h(t,e,r,n){for(void 0===n&&(n=[]);e>=32;e-=32)n.push(r),r=0;if(0===e)return n.concat(t);for(let a=0;a<t.length;a++)n.push(r|t[a]>>>e),r=t[a]<<32-e;const a=t.length?t[t.length-1]:0,s=ct.l(a);return n.push(ct.R(e+s&31,e+s>32?r:n.pop(),1)),n}},lt={bytes:{A(t){const e=ct.m(t)/8,r=new Uint8Array(e);let n;for(let a=0;e>a;a++)3&a||(n=t[a/4]),r[a]=n>>>24,n<<=8;return r},F(t){const e=[];let r,n=0;for(r=0;r<t.length;r++)n=n<<8|t[r],3&~r||(e.push(n),n=0);return 3&r&&e.push(ct.R(8*(3&r),n)),e}}},dt=class{constructor(t){const e=this;e.blockSize=512,e.D=[1732584193,4023233417,2562383102,271733878,3285377520],e.U=[1518500249,1859775393,2400959708,3395469782],t?(e.O=t.O.slice(0),e.T=t.T.slice(0),e.v=t.v):e.reset()}reset(){const t=this;return t.O=t.D.slice(0),t.T=[],t.v=0,t}update(t){const e=this;"string"==typeof t&&(t=lt.M.F(t));const r=e.T=ct.concat(e.T,t),n=e.v,a=e.v=n+ct.m(t);if(a>9007199254740991)throw Error("Cannot hash more than 2^53 - 1 bits");const s=new Uint32Array(r);let i=0;for(let t=e.blockSize+n-(e.blockSize+n&e.blockSize-1);a>=t;t+=e.blockSize)e.C(s.subarray(16*i,16*(i+1))),i+=1;return r.splice(0,16*i),e}I(){const t=this;let e=t.T;const r=t.O;e=ct.concat(e,[ct.R(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(Math.floor(t.v/4294967296)),e.push(0|t.v);e.length;)t.C(e.splice(0,16));return t.reset(),r}j(t,e,r,n){return t>19?t>39?t>59?t>79?void 0:e^r^n:e&r|e&n|r&n:e^r^n:e&r|~e&n}P(t,e){return e<<t|e>>>32-t}C(t){const e=this,r=e.O,n=Array(80);for(let e=0;16>e;e++)n[e]=t[e];let a=r[0],s=r[1],i=r[2],o=r[3],c=r[4];for(let t=0;79>=t;t++){16>t||(n[t]=e.P(1,n[t-3]^n[t-8]^n[t-14]^n[t-16]));const r=e.P(5,a)+e.j(t,s,i,o)+c+n[t]+e.U[Math.floor(t/20)]|0;c=o,o=i,i=e.P(30,s),s=a,a=r}r[0]=r[0]+a|0,r[1]=r[1]+s|0,r[2]=r[2]+i|0,r[3]=r[3]+o|0,r[4]=r[4]+c|0}},ut={importKey:t=>new ut.N(lt.bytes.F(t)),W(t,e,r,n){if(r=r||1e4,0>n||0>r)throw Error("invalid params to pbkdf2");const a=1+(n>>5)<<2;let s,i,o,c,l;const d=new ArrayBuffer(a),u=new DataView(d);let f=0;const w=ct;for(e=lt.bytes.F(e),l=1;(a||1)>f;l++){for(s=i=t.encrypt(w.concat(e,[l])),o=1;r>o;o++)for(i=t.encrypt(i),c=0;c<i.length;c++)s[c]^=i[c];for(o=0;(a||1)>f&&o<s.length;o++)u.setInt32(f,s[o]),f+=4}return d.slice(0,n/8)},N:class{constructor(t){const e=this,r=e._=dt,n=[[],[]];e.B=[new r,new r];const a=e.B[0].blockSize/32;t.length>a&&(t=(new r).update(t).I());for(let e=0;a>e;e++)n[0][e]=909522486^t[e],n[1][e]=1549556828^t[e];e.B[0].update(n[0]),e.B[1].update(n[1]),e.L=new r(e.B[0])}reset(){const t=this;t.L=new t._(t.B[0]),t.Z=!1}update(t){this.Z=!0,this.L.update(t)}digest(){const t=this,e=t.L.I(),r=new t._(t.B[1]).update(e).I();return t.reset(),r}encrypt(t){if(this.Z)throw Error("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},ft=typeof crypto!=z&&typeof crypto.getRandomValues==R,wt="Invalid password",ht="Invalid signature",pt="zipjs-abort-check-password";function mt(t){if(ft)return crypto.getRandomValues(t);throw Error("Crypto API not supported")}const yt=16,bt={name:"PBKDF2"},St=Object.assign({hash:{name:"HMAC"}},bt),gt=Object.assign({iterations:1e3,hash:{name:"SHA-1"}},bt),Et=["deriveBits"],xt=[8,12,16],zt=[16,24,32],Rt=10,At=[0,0,0,0],Ft=typeof crypto!=z,Dt=Ft&&crypto.subtle,Ut=Ft&&typeof Dt!=z,Ot=lt.bytes,Tt=class{constructor(t){const e=this;e.V=[[[],[],[],[],[]],[[],[],[],[],[]]],e.V[0][0][0]||e.H();const r=e.V[0][4],n=e.V[1],a=t.length;let s,i,o,c=1;if(4!==a&&6!==a&&8!==a)throw Error("invalid aes key size");for(e.U=[i=t.slice(0),o=[]],s=a;4*a+28>s;s++){let t=i[s-1];(s%a===0||8===a&&s%a===4)&&(t=r[t>>>24]<<24^r[t>>16&255]<<16^r[t>>8&255]<<8^r[255&t],s%a===0&&(t=t<<8^t>>>24^c<<24,c=c<<1^283*(c>>7))),i[s]=i[s-a]^t}for(let t=0;s;t++,s--){const e=i[3&t?s:s-4];o[t]=4>=s||4>t?e:n[0][r[e>>>24]]^n[1][r[e>>16&255]]^n[2][r[e>>8&255]]^n[3][r[255&e]]}}encrypt(t){return this.K(t,0)}decrypt(t){return this.K(t,1)}H(){const t=this.V[0],e=this.V[1],r=t[4],n=e[4],a=[],s=[];let i,o,c,l;for(let t=0;256>t;t++)s[(a[t]=t<<1^283*(t>>7))^t]=t;for(let d=i=0;!r[d];d^=o||1,i=s[i]||1){let s=i^i<<1^i<<2^i<<3^i<<4;s=s>>8^255&s^99,r[d]=s,n[s]=d,l=a[c=a[o=a[d]]];let u=16843009*l^65537*c^257*o^16843008*d,f=257*a[s]^16843008*s;for(let r=0;4>r;r++)t[r][d]=f=f<<24^f>>>8,e[r][s]=u=u<<24^u>>>8}for(let r=0;5>r;r++)t[r]=t[r].slice(0),e[r]=e[r].slice(0)}K(t,e){if(4!==t.length)throw Error("invalid aes block size");const r=this.U[e],n=r.length/4-2,a=[0,0,0,0],s=this.V[e],i=s[0],o=s[1],c=s[2],l=s[3],d=s[4];let u,f,w,h=t[0]^r[0],p=t[e?3:1]^r[1],m=t[2]^r[2],y=t[e?1:3]^r[3],b=4;for(let t=0;n>t;t++)u=i[h>>>24]^o[p>>16&255]^c[m>>8&255]^l[255&y]^r[b],f=i[p>>>24]^o[m>>16&255]^c[y>>8&255]^l[255&h]^r[b+1],w=i[m>>>24]^o[y>>16&255]^c[h>>8&255]^l[255&p]^r[b+2],y=i[y>>>24]^o[h>>16&255]^c[p>>8&255]^l[255&m]^r[b+3],b+=4,h=u,p=f,m=w;for(let t=0;4>t;t++)a[e?3&-t:t]=d[h>>>24]<<24^d[p>>16&255]<<16^d[m>>8&255]<<8^d[255&y]^r[b++],u=h,h=p,p=m,m=y,y=u;return a}},kt=class{constructor(t,e){this.Y=t,this.G=e,this.X=e}reset(){this.X=this.G}update(t){return this.J(this.Y,t,this.X)}$(t){if(255&~(t>>24))t+=1<<24;else{let e=t>>16&255,r=t>>8&255,n=255&t;255===e?(e=0,255===r?(r=0,255===n?n=0:++n):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=n}return t}et(t){0===(t[0]=this.$(t[0]))&&(t[1]=this.$(t[1]))}J(t,e,r){let n;if(!(n=e.length))return[];const a=ct.m(e);for(let a=0;n>a;a+=4){this.et(r);const n=t.encrypt(r);e[a]^=n[0],e[a+1]^=n[1],e[a+2]^=n[2],e[a+3]^=n[3]}return ct.S(e,a)}},vt=ut.N;let Mt=Ft&&Ut&&typeof Dt.importKey==R,Ct=Ft&&Ut&&typeof Dt.deriveBits==R;class It extends TransformStream{constructor({password:t,rawPassword:e,encryptionStrength:r,checkPasswordOnly:n}){super({start(){Pt(this,t,e,r)},async transform(t,e){const r=this,{password:a,strength:s,nt:i,ready:o}=r;a?(await(async(t,e,r,n)=>{const a=await Wt(t,e,r,Bt(n,0,xt[e])),s=Bt(n,xt[e]);if(a[0]!=s[0]||a[1]!=s[1])throw Error(wt)})(r,s,a,Bt(t,0,xt[s]+2)),t=Bt(t,xt[s]+2),n?e.error(Error(pt)):i()):await o;const c=new Uint8Array(t.length-Rt-(t.length-Rt)%yt);e.enqueue(Nt(r,t,c,0,Rt,!0))},async flush(t){const{st:e,it:r,pending:n,ready:a}=this;if(r&&e){await a;const s=Bt(n,0,n.length-Rt),i=Bt(n,n.length-Rt);let o=A;if(s.length){const t=Zt(Ot,s);r.update(t);const n=e.update(t);o=Lt(Ot,n)}const c=Bt(Lt(Ot,r.digest()),0,Rt);let l=n.length<Rt?1:0;for(let t=0;Rt>t;t++)l|=c[t]^i[t];if(l)throw Error(ht);t.enqueue(o)}}})}}class jt extends TransformStream{constructor({password:t,rawPassword:e,encryptionStrength:r}){let n;super({start(){Pt(this,t,e,r)},async transform(t,e){const r=this,{password:n,strength:a,nt:s,ready:i}=r;let o=A;n?(o=await(async(t,e,r)=>{const n=mt(new Uint8Array(xt[e]));return st(n,await Wt(t,e,r,n))})(r,a,n),s()):await i;const c=new Uint8Array(o.length+t.length-t.length%yt);c.set(o,0),e.enqueue(Nt(r,t,c,o.length,0))},async flush(t){const{st:e,it:r,pending:a,ready:s}=this;if(r&&e){await s;let i=A;if(a.length){const t=e.update(Zt(Ot,a));r.update(t),i=Lt(Ot,t)}n.signature=Lt(Ot,r.digest()).slice(0,Rt),t.enqueue(st(i,n.signature))}}}),n=this}}function Pt(t,e,r,n){Object.assign(t,{ready:new Promise(e=>t.nt=e),password:_t(e,r),strength:n-1,pending:A})}function Nt(t,e,r,n,a,s){const{st:i,it:o,pending:c}=t;c.length&&(e=st(c,e));const l=e.length-a;let d;for(r=((t,e)=>{if(e&&e>t.length){const r=t;(t=new Uint8Array(e)).set(r,0)}return t})(r,n+(l-l%yt)),d=0;l-yt>=d;d+=yt){const t=Zt(Ot,Bt(e,d,d+yt));s&&o.update(t);const a=i.update(t);s||o.update(a),r.set(Lt(Ot,a),d+n)}return t.pending=Bt(e,d),r}async function Wt(t,e,r,n){t.password=null;const a=await(async(t,e,r,n,a)=>{if(!Mt)return ut.importKey(e);try{return await Dt.importKey("raw",e,r,!1,a)}catch{return Mt=!1,ut.importKey(e)}})(0,r,St,0,Et),s=await(async(t,e,r)=>{if(!Ct)return ut.W(e,t.salt,gt.iterations,r);try{return await Dt.deriveBits(t,e,r)}catch{return Ct=!1,ut.W(e,t.salt,gt.iterations,r)}})(Object.assign({salt:n},gt),a,8*(2*zt[e]+2)),i=new Uint8Array(s),o=Zt(Ot,Bt(i,0,zt[e])),c=Zt(Ot,Bt(i,zt[e],2*zt[e])),l=Bt(i,2*zt[e]);return Object.assign(t,{keys:{key:o,ot:c,passwordVerification:l},st:new kt(new Tt(o),Array.from(At)),it:new vt(c)}),l}function _t(t,e){return e===E?at(t):e}function Bt(t,e,r){return t.subarray(e,r)}function Lt(t,e){return t.A(e)}function Zt(t,e){return t.F(e)}class Vt extends TransformStream{constructor({password:t,rawPassword:e,passwordVerification:r,checkPasswordOnly:n}){super({start(){qt(this,t,e,r)},transform(t,e){const r=this;if(r.password||r.rawPassword){const e=Kt(r,t.subarray(0,12));if(r.password=r.rawPassword=null,0!=(e[11]^r.passwordVerification))throw Error(wt);t=t.subarray(12)}n?e.error(Error(pt)):e.enqueue(Kt(r,t))}})}}class Ht extends TransformStream{constructor({password:t,rawPassword:e,passwordVerification:r}){super({start(){qt(this,t,e,r)},transform(t,e){const r=this;let n,a;if(r.password||r.rawPassword){r.password=r.rawPassword=null;const e=mt(new Uint8Array(12));e[11]=r.passwordVerification,n=new Uint8Array(t.length+e.length),n.set(Yt(r,e),0),a=12}else n=new Uint8Array(t.length),a=0;n.set(Yt(r,t),a),e.enqueue(n)}})}}function qt(t,e,r,n){Object.assign(t,{password:e,rawPassword:r,passwordVerification:n}),((t,e,r)=>{const n=[305419896,591751049,878082192];if(Object.assign(t,{keys:n,ct:new rt(n[0]),lt:new rt(n[2])}),r)for(let e=0;e<r.length;e++)Gt(t,r[e]);else for(let r=0;r<e.length;r++)Gt(t,e.charCodeAt(r))})(t,e,r)}function Kt(t,e){const r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=Xt(t)^e[n],Gt(t,r[n]);return r}function Yt(t,e){const r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=Xt(t)^e[n],Gt(t,e[n]);return r}function Gt(t,e){let[,r]=t.keys;t.ct.append([e]);const n=~t.ct.get();r=Qt(Math.imul(Qt(r+Jt(n)),134775813)+1),t.lt.append([r>>>24]);const a=~t.lt.get();t.keys=[n,r,a]}function Xt(t){const e=2|t.keys[2];return Jt(Math.imul(e,1^e)>>>8)}function Jt(t){return 255&t}function Qt(t){return 4294967295&t}function $t(t){if(t instanceof ReadableStream)return t;const e=t.getReader();return new ReadableStream({async pull(t){const{value:r,done:n}=await e.read();n?t.close():t.enqueue(r)},cancel:t=>e.cancel(t)})}function te(t){if(t instanceof WritableStream)return t;const e=t.getWriter();return new WritableStream({write:t=>e.write(t),close:()=>e.close(),abort:t=>e.abort(t)})}const ee="Invalid uncompressed size",re="Invalid compressed data",ne="deflate-raw",ae="gzip",se=[31,139,8];class ie extends TransformStream{constructor(t,{chunkSize:e,CompressionStreamZlib:r,CompressionStream:n}){super({});const{compressed:a,encrypted:s,useCompressionStream:i,zipCrypto:o,signed:c,level:l,deflate64:d,format:u,compressionMethod:f}=t,w=this;let h,p,m,y=super.readable;const b=u&&H(u),S=c&&a&&!d&&!b&&(!s||o)&&!(!i||!n);if(s&&!o||!c||S||(h=new nt,y=he(y,h)),a)if(b)y=pe(y,fe(b.CompressionStream,u,{level:l,chunkSize:e,compressionMethod:f}));else if(S)m=new oe,y=pe(y,new n(ae)),y=he(y,m);else try{y=we(y,i,{level:l,chunkSize:e},n,r)}catch(t){let e;try{e=new n(ae)}catch{throw t}y=pe(y,e),y=he(y,new oe)}s&&(o?y=he(y,new Ht(t)):(p=new jt(t),y=he(y,p))),ue(w,y,()=>{let t;s&&!o&&(t=p.signature),s&&!o||!c||(t=S?m.signature:new DataView(h.value.buffer).getUint32(0)),w.signature=t})}}class oe extends TransformStream{constructor(){let t,e=10,r=new Uint8Array(0);super({transform(t,n){if(e){const r=Math.min(e,t.length);if(e-=r,!(t=t.subarray(r)).length)return}const a=r.length+t.length;if(8>=a)return void(r=st(r,t));const s=a-8,i=Math.min(s,r.length);n.enqueue(st(r.subarray(0,i),t.subarray(0,s-i))),r=st(r.subarray(i),t.subarray(s-i))},flush(){const e=ot(r);t.signature=e.getUint32(0,!0),t.uncompressedSize=e.getUint32(4,!0)}}),t=this}}class ce extends TransformStream{constructor(t,e){super({start(t){const e=new Uint8Array(10);e.set(se),t.enqueue(e)},transform(t,e){e.enqueue(t)},flush(r){const n=new Uint8Array(8),a=ot(n);a.setUint32(0,t,!0),a.setUint32(4,e,!0),r.enqueue(n)}})}}class le extends TransformStream{constructor(t,{chunkSize:e,DecompressionStreamZlib:r,DecompressionStream:n}){super({});const{zipCrypto:a,encrypted:s,signed:i,signature:o,compressed:c,useCompressionStream:l,deflate64:d,format:u,compressionMethod:f,rawBitFlag:w,outputSize:h}=t;let p,m,y=super.readable;if(s&&(a?y=he(y,new Vt(t)):(m=new It(t),y=he(y,m))),c){const t=u&&H(u);if(t)y=pe(y,fe(t.DecompressionStream,u,{chunkSize:e,compressionMethod:f,rawBitFlag:w,uncompressedSize:h}));else try{y=we(y,l,{chunkSize:e,deflate64:d},n,r)}catch(t){if(d||s&&!a||o===E||h===E)throw t;let e;try{e=new n(ae)}catch{throw t}y=he(y,new ce(o,h)),y=pe(y,e)}y=(t=>{const e=t.getReader();return new ReadableStream({async pull(t){let r;try{r=await e.read()}catch(t){if(t&&t.message)throw t;const e=Error(re);throw e.cause=t,e}const{value:n,done:a}=r;a?t.close():t.enqueue(n)},cancel:t=>e.cancel(t)})})(y)}s&&!a||!i||(p=new nt,y=he(y,p)),ue(this,y,()=>{if((!s||a)&&i){const t=new DataView(p.value.buffer);if(o!=t.getUint32(0,!1))throw Error(ht)}})}}const de=new Map;function ue(t,e,r){e=he(e,new TransformStream({flush:r})),Object.defineProperty(t,"readable",{get:()=>e})}function fe(t,e,r){if(!t)throw Error("Compression method not supported");return new t(e,r)}function we(t,e,r,n,a){const s=e&&n?n:a||n,i=r.deflate64?"deflate64-raw":ne;let o;try{o=new s(i,r)}catch(t){if(!e||!a||s==a)throw t;o=new a(i,r)}return pe(t,o)}function he(t,e){return $t(t).pipeThrough(e)}function pe(t,e){const r=e.writable.getWriter(),n=t.getReader();return(async()=>{try{for(;;){await r.ready;const t=await n.read();if(t.done){await r.close();break}await r.write(t.value)}}catch(t){await(async(t,e)=>{try{await t.abort(e)}catch{}})(r,t),await(async(t,e)=>{try{await t.cancel(e)}catch{}})(n,t)}})(),e.readable}const me="data",ye="deflate",be="inflate";class Se extends TransformStream{constructor(t,e){super({});const r=this,{codecType:n}=t;let a;n.startsWith(ye)?a=ie:n.startsWith(be)&&(a=le),r.outputSize=0;let s=0;const i=new a(t,e),o=super.readable,c=new TransformStream({transform(t,e){t&&t.length&&(s+=t.length,e.enqueue(t))},flush(){Object.assign(r,{inputSize:s})}}),l=new TransformStream({transform(e,n){if(e&&e.length&&(n.enqueue(e),r.outputSize+=e.length,t.outputSize!==E&&r.outputSize>t.outputSize))throw Error(ee)},flush(){const{signature:t}=i;Object.assign(r,{signature:t,inputSize:s})}});Object.defineProperty(r,"readable",{get:()=>o.pipeThrough(c).pipeThrough(i).pipeThrough(l)})}}class ge extends TransformStream{constructor(t){const e=[];let r=0;function n(){const n=new Uint8Array(t);let a=0;for(;t>a;){const r=e[0],s=t-a;r.length>s?(n.set(r.subarray(0,s),a),e[0]=r.subarray(s),a+=s):(n.set(r,a),a+=r.length,e.shift())}return r-=t,n}Number.isFinite(t)&&t>=1||(t=65536),super({transform(a,s){for(e.push(a),r+=a.length;r>t;)s.enqueue(n())},flush(t){r&&t.enqueue(((t,e)=>{const r=new Uint8Array(e);let n=0;for(const e of t)r.set(e,n),n+=e.length;return r})(e,r))}})}}const Ee={type:"module"},xe="error";let ze,Re,Ae,Fe,De=!0;try{De=typeof structuredClone==R&&structuredClone(new DOMException("","AbortError")).code!==E}catch{}let Ue=()=>{};class Oe{constructor(t,{readable:e,writable:r},{options:n,config:a,ut:s,useWebWorkers:i,transferStreams:o,workerURI:c},l){const{signal:d}=s;return Object.assign(t,{ft:!0,wt:(t.wt||0)+1,readable:e.pipeThrough(new ge(k(a))).pipeThrough(new Te(s),{signal:d}),writable:r,options:Object.assign({},n),workerURI:c,transferStreams:o,terminate:()=>new Promise(e=>{const{ht:r,ft:n}=t;r?(n?t.yt=e:(r.terminate(),e()),t.bt=null):e()}),St(){if(t.ft){const{yt:e}=t;e&&(t.yt=null,t.gt=!0,t.ht.terminate(),e()),t.ft=!1,l(t)}}}),ze===E&&(ze=typeof Worker!=z),(i&&ze?Me:ve)(t,a)}}class Te extends TransformStream{constructor({onstart:t,onprogress:e,size:r,onend:n}){let a=0;super({async start(){t&&await ke(t,r)},async transform(t,n){a+=t.length,e&&await ke(e,a,r),n.enqueue(t)},async flush(){n&&await ke(n,a)}})}}async function ke(t,...e){try{await t(...e)}catch{}}function ve(t,e){return{run:()=>Ce(t,e)}}function Me(t,e){const{baseURI:r,chunkSize:n,workerStartupTimeout:a}=e;let{wasmURI:s}=e;if(!t.bt){let i;typeof s==R&&(s=s());try{i=je(t.workerURI,r,t)}catch{return ze=!1,ve(t,e)}Object.assign(t,{ht:i,Et:!1,gt:!1,bt:{run:async()=>{try{return await(async(t,e)=>{let r,n;const a=new Promise((t,e)=>{r=t,n=e});Object.assign(t,{reader:null,writer:null,xt:r,zt:n,result:a});const{readable:s,options:i}=t,{writable:o,closed:c,Rt:l}=(t=>{const e=new AbortController,{writable:r,readable:n}=new TransformStream,a=n.pipeTo(t,{preventClose:!0,preventAbort:!0,signal:e.signal});return a.catch(()=>{}),{writable:r,closed:a,Rt:()=>e.abort()}})(t.writable);let d;try{d=We({type:"start",options:i,config:e,readable:s,writable:o},t)}catch(e){l();try{await c}catch{}throw t.St(),e}d||Object.assign(t,{reader:s.getReader(),writer:o.getWriter()});const{workerStartupTimeout:u}=e;t.Et||!Number.isFinite(u)||0>u||(t.At=setTimeout(()=>(t=>{if(t.At=null,t.Et)return;const{zt:e,writer:r}=t;if(Ie(t),t.ht=null,e){const t=Error("Worker startup timeout");t.Ft=!0,e(t),r&&r.releaseLock()}})(t),u));try{const t=await a;return await f(),await c,t}catch(t){await f(),l();try{await c}catch{}throw t}async function f(){if(!d&&!o.locked)try{await o.getWriter().close()}catch{}}})(t,{chunkSize:n,wasmURI:s,baseURI:r,workerStartupTimeout:a})}catch(r){if(r&&r.Ft){ze=!1;const{reader:r}=t;return r&&r.releaseLock(),t.reader=null,t.writer=null,Ce(t,e)}throw r}}}})}return t.bt}async function Ce({options:t,readable:e,writable:r,St:n},a){let s;try{if(t.compressed&&!t.format){const e=t.codecType.startsWith(ye),r=e?a.CompressionStreamZlib:a.DecompressionStreamZlib,n=e?a.CompressionStream:a.DecompressionStream;if(t.useCompressionStream){if(r&&r.Dt&&!(t=>{if(!t)return!1;let e=de.get(t);if(e===E){try{new t(ne),e=!0}catch{e=!1}de.set(t,e)}return e})(n))try{await Ue(a)}catch{}}else try{await Ue(a)}catch{r&&!r.Dt||(t.useCompressionStream=!0)}}s=new Se(t,a),await e.pipeThrough(s).pipeThrough(new ge(k(a))).pipeTo(r,{preventClose:!0,preventAbort:!0});const{signature:n,inputSize:i,outputSize:o}=s;return{signature:n,inputSize:i,outputSize:o}}catch(t){throw s&&(t.outputSize=s.outputSize),t}finally{n()}}function Ie(t){const{ht:e}=t;if(e)try{e.terminate()}catch{}t.bt=null}function je(t,e,r,n,a=!0){let s,i,o;if(Ae===E||Re!==t){const c=typeof t==R;i=c?t(a):t;const l=i.startsWith("data:"),d=i.startsWith("blob:");if(l||d){n===E&&(n=!1),n&&(o=Ee);try{s=new Worker(i,o)}catch(a){if(d)try{URL.revokeObjectURL(i)}catch{}if(c&&d)return je(t,e,r,n,!1);if(n)throw a;return je(t,e,r,!0,!1)}}else{n===E&&(n=!0),n&&(o=Ee);try{i=new URL(i,e)}catch{}try{s=new Worker(i,o)}catch(s){if(n)throw s;return je(t,e,r,!1,a)}}Re=t,Ae=i,Fe=o}else s=new Worker(Ae,Fe);return s.addEventListener("message",t=>{r.Et=!0,Pe(r),(async({data:t},e)=>{const{type:r,value:n,messageId:a,result:s,error:i}=t,{reader:o,writer:c,xt:l,zt:d,St:u,wt:f}=e,w=()=>e.wt!=f;try{if(i){const{message:t,stack:e,code:r,name:n,outputSize:a,cause:s}=i,o=Error(t);Object.assign(o,{stack:e,code:r,name:n,outputSize:a}),s&&(o.cause=Object.assign(Error(s.message),{name:s.name})),h(o)}else{if("pull"==r){const{value:t,done:r}=await o.read();w()||We({type:me,value:t,done:r,messageId:a},e)}r==me&&(await c.ready,await c.write(new Uint8Array(n)),w()||We({type:"ack",messageId:a},e)),"close"==r&&h(null,s)}}catch(i){w()||(Ie(e),h(i))}function h(t,e){w()||(t?d(t):l(e),c&&c.releaseLock(),u())}})(t,r)}),s.addEventListener(xe,t=>Ne(t,r)),s.addEventListener("messageerror",t=>Ne(t,r)),s}function Pe(t){const{At:e}=t;e&&(clearTimeout(e),t.At=null)}function Ne(t,e){t.preventDefault&&t.preventDefault(),Pe(e);const{Et:r,zt:n,writer:a,St:s}=e;if(Ie(e),r||(e.ht=null),n){let e=t.error||Error(t.message||xe);r||(e=Object.assign(Error(e.message||xe),{Ft:!0})),n(e),a&&a.releaseLock(),r&&s()}}function We(t,{ht:e,writer:r,transferStreams:n,Et:a}){try{const{value:r,readable:s,writable:i}=t,o=[];if(r&&(t.value=it(r),o.push(t.value.buffer)),n&&De&&a?(s&&o.push(s),i&&o.push(i)):t.readable=t.writable=null,o.length)try{return e.postMessage(t,o),!0}catch{De=!1,t.readable=t.writable=null,e.postMessage(t)}else e.postMessage(t)}catch(t){throw r&&r.releaseLock(),t}}let _e=[];const Be=[];let Le,Ze,Ve=0;async function He(t,e){const{options:r,config:n}=e,{transferStreams:a,useWebWorkers:s,useCompressionStream:i,compressed:o,signed:c,encrypted:l,format:d,codecURI:u}=r,{workerURI:f,maxWorkers:w}=n;d&&(u&&(r.codecURI=((t,e)=>{try{return new URL(t,e).toString()}catch{return t}})(u,n.baseURI)),await(async(t,e)=>{!B.has(t)&&e&&q(t,await(import(/* webpackIgnore: true */ /* @vite-ignore */e)))})(d,r.codecURI)),e.transferStreams=a||a===E&&n.transferStreams;const h=!o&&!c&&!l,p=d===E||!!r.codecURI;return e.useWebWorkers=!h&&p&&(s||s===E&&n.useWebWorkers),e.workerURI=e.useWebWorkers&&f?f:E,r.useCompressionStream=i||i===E&&n.useCompressionStream,(await(async()=>{const r=_e.find(t=>!t.ft);if(r)return Xe(r),new Oe(r,t,e,m);if(_e.length<w){const r={Ut:Ve};return Ve++,_e.push(r),new Oe(r,t,e,m)}return new Promise(r=>{Be.push({resolve:r,stream:t,Ot:e}),Ze=n.workerStarvationTimeout,qe()})})()).run();function m(t){if(Ke(),Be.length){const[{resolve:e,stream:r,Ot:n}]=Be.splice(0,1);e(new Oe(t,r,n,m)),qe()}else t.ht?(Xe(t),((t,e)=>{const{config:r}=e,{terminateWorkerTimeout:n}=r;Number.isFinite(n)&&n>=0&&(t.gt?t.gt=!1:t.Tt=setTimeout(async()=>{_e=_e.filter(e=>e!=t);try{await t.terminate()}catch{}},n))})(t,e)):_e=_e.filter(e=>e!=t)}}function qe(){!Le&&Be.length&&Number.isFinite(Ze)&&Ze>=0&&(Le=setTimeout(Ye,Ze))}function Ke(){Le&&(clearTimeout(Le),Le=null)}function Ye(){if(Le=null,Be.length){const[{resolve:t,stream:e,Ot:r}]=Be.splice(0,1),n=Object.assign({},r,{useWebWorkers:!1,workerURI:E});t(new Oe({},e,n,Ge)),qe()}}function Ge(){Ke(),qe()}function Xe(t){const{Tt:e}=t;e&&(clearTimeout(e),t.Tt=null)}const Je="HTTP error ",Qe="HTTP Range not supported",$e="HTTP resource changed",tr="Writer iterator completed too soon",er="Writer not initialized",rr="Content-Range",nr="Range",ar="GET",sr="bytes",ir=16777216,or="writable",cr=Symbol();class lr{constructor(){this.size=0}init(){this.initialized=!0}}class dr extends lr{get readable(){return this.createReadable()}createReadable({offset:t=0,size:e,chunkSize:r=k(T())}={}){const n=this;let a=0;return new ReadableStream({async pull(s){const i=e===E?r:Math.min(r,e-a),o=await qr(n,t+a,i);s.enqueue(o),a+r>e||e===E&&!o.length&&i?s.close():a+=r}})}}class ur extends lr{constructor(){super();const t=this,e=new WritableStream({write(e){if(!t.initialized)throw Error(er);return t.writeUint8Array(it(e))}});Object.defineProperty(t,or,{get:()=>e})}writeUint8Array(){}}class fr extends dr{constructor(t){super();let e=t.length;for(;"="==t.charAt(e-1);)e--;const r=t.indexOf(",")+1;Object.assign(this,{dataURI:t,kt:r,size:Math.floor(.75*(e-r))})}readUint8Array(t,e){const{kt:r,dataURI:n}=this,a=new Uint8Array(e),s=4*Math.floor(t/3),i=atob(n.substring(s+r,4*Math.ceil((t+e)/3)+r)),o=t-3*Math.floor(s/4);let c=0;for(let t=o;o+e>t&&t<i.length;t++)a[t-o]=i.charCodeAt(t),c++;return c<a.length?a.subarray(0,c):a}}class wr extends ur{constructor(t){super(),Object.assign(this,{data:"data:"+(t||"")+";base64,",pending:[]})}writeUint8Array(t){const e=this;let r,n=e.pending;const a=e.pending.length;for(e.pending="",r=0;r<3*Math.floor((a+t.length)/3)-a;r++)n+=String.fromCharCode(t[r]);for(;r<t.length;r++)e.pending+=String.fromCharCode(t[r]);n.length>2?e.data+=btoa(n):e.pending=n+e.pending}getData(){return this.data+btoa(this.pending)}}let hr,pr;class mr extends dr{constructor(t){super(),Object.assign(this,{blob:t,size:t.size}),pr||(pr=(async()=>{try{const t=new Blob([new Uint8Array(3)]).slice(1,2).stream().getReader();let e=0,r=await t.read();for(;!r.done;)e+=r.value.length,r=await t.read();hr=1==e}catch{hr=!1}})())}createReadable(t){const{blob:e,size:r}=this,{offset:n=0,size:a=r-n}=t||{};return n||r>a?hr?$t(e.slice(n,n+a).stream()):super.createReadable(t):$t(e.stream())}async readUint8Array(t,e){const r=this,n=t+e,a=t||n<r.size?r.blob.slice(t,n):r.blob;let s=await a.arrayBuffer();return s.byteLength>e&&(s=s.slice(t,n)),new Uint8Array(s)}}class yr extends lr{constructor(t){super();const e=this,r=new TransformStream;if(Object.defineProperty(e,or,{get:()=>r.writable}),typeof Blob.prototype.stream!=R||new Blob([]).stream()instanceof ReadableStream){const n=[];t&&n.push(["Content-Type",t]),e.blob=new Response(r.readable,{headers:n}).blob()}else{const n=[];e.blob=r.readable.pipeTo(new WritableStream({write(t){n.push(t)}})).then(()=>new Blob(n,{type:t}))}e.blob.catch(()=>{})}getData(){return this.blob}}class br extends mr{constructor(t){super(new Blob([t],{type:"text/plain"}))}}class Sr extends yr{constructor(t){super(t),Object.assign(this,{encoding:t,vt:!t||"utf-8"==t.toLowerCase()})}async getData(){const{encoding:t,vt:e}=this,r=await super.getData();if(r.text&&e)return r.text();{const e=new FileReader;return new Promise((n,a)=>{Object.assign(e,{onload:({target:t})=>n(t.result),onerror:()=>a(e.error)}),e.readAsText(r,t)})}}}class gr extends dr{constructor(t,e){super(),xr(this,t,e)}async init(){await zr(this,Ir,kr),super.init()}createReadable(t){const e=this,{useRangeHeader:r,forceRangeRequests:n,size:a}=e;if((r||n)&&a!==E){const{offset:r=0,size:n=a-r}=t||{};if(n>0&&a>r)return((t,e,r)=>{let n,a=e,s=0,i=r;return new ReadableStream({start:()=>o(),async pull(t){n||await o();const{value:e,done:r}=await n.read();if(r)throw Error(Qe);const a=e.length>s?e.subarray(0,s):e;s-=a.length,i-=a.length,a.length&&t.enqueue(a),s||(await(async()=>{const t=n;n=E,await t.cancel()})(),i||t.close())},cancel:t=>n&&n.cancel(t)});async function o(){const e=Math.min(t.maximumRangeSize,i),r=await Ir(ar,t,Or(t,a,e));if(206!=r.status)throw Error(Qe);const o=r.headers.get(rr);if(o){const t=Number(o.trim().split(/[\s-]+/)[1]);if(!Number.isNaN(t)&&t!=a)throw Error(Qe)}Ur(t,r),Dr(t,r),a+=e,s=e,n=r.body.getReader()}})(e,r,Math.min(n,a-r))}return super.createReadable(t)}readUint8Array(t,e){return Rr(this,t,e,Ir,kr)}}class Er extends dr{constructor(t,e){super(),xr(this,t,e)}async init(){await zr(this,jr,vr),super.init()}readUint8Array(t,e){return Rr(this,t,e,jr,vr)}}function xr(t,e,r){const{preventHeadRequest:n,useRangeHeader:a,forceRangeRequests:s,combineSizeEocd:i,checkResourceChanges:o=!0,maximumRangeSize:c=ir,fetch:l}=r;delete(r=Object.assign({},r)).preventHeadRequest,delete r.useRangeHeader,delete r.forceRangeRequests,delete r.combineSizeEocd,delete r.checkResourceChanges,delete r.maximumRangeSize,delete r.useXHR,delete r.fetch,Object.assign(t,{url:e,options:r,preventHeadRequest:n,useRangeHeader:a,forceRangeRequests:s,combineSizeEocd:i,checkResourceChanges:o,maximumRangeSize:c,fetch:l})}async function zr(t,e,r){const{url:n,preventHeadRequest:a,useRangeHeader:s,forceRangeRequests:i,combineSizeEocd:o}=t;if((t=>{const{baseURI:e}=T(),{protocol:r}=new URL(t,e);return"http:"==r||"https:"==r})(n)&&(s||i)&&(void 0===a||a)){const n=await e(ar,t,Or(t,o?-22:void 0)),a=n.headers.get("Accept-Ranges");if(!(i||a&&a.toLowerCase()==sr))throw Error(Qe);{if(o){const e=new Uint8Array(await n.arrayBuffer());206==n.status&&e.length==d&&(t.Mt=e)}Dr(t,n);const a=Ar(n);a===E?await Cr(t,e,r):t.size=a}}else await Cr(t,e,r)}async function Rr(t,e,r,n,a){const{useRangeHeader:s,forceRangeRequests:i,Mt:o,size:c,options:l}=t;if(s||i){if(o&&e==c-d&&r==d)return o;if(c>e&&0!==r){e+r>c&&(r=c-e);const a=await n(ar,t,Or(t,e,r));if(206!=a.status)throw Error(Qe);const s=a.headers.get(rr);if(s){const t=Number(s.trim().split(/[\s-]+/)[1]);if(!Number.isNaN(t)&&t!=e)throw Error(Qe)}Ur(t,a),Dr(t,a);const i=new Uint8Array(await a.arrayBuffer());if(i.length!=r)throw Error(Qe);return i}return A}{const{data:n}=t;return n||await a(t,l),t.data.subarray(e,e+r)}}function Ar(t){const e=t.headers.get(rr);if(e){const t=e.trim().split(/\s*\/\s*/)[1];if(t&&"*"!=t){const e=Number(t);if(!Number.isNaN(e))return e}}}function Fr({headers:t}){return{Ct:t.get("Etag")||E,lastModified:t.get("Last-Modified")||E}}function Dr(t,e){const{checkResourceChanges:r,It:n}=t;r&&!n&&206==e.status&&(t.It=Fr(e))}function Ur(t,e){const{checkResourceChanges:r,It:n,size:a}=t;if(r){const t=Ar(e);if(t!==E&&a!==E&&t!=a)throw Error($e);if(n){const t=Fr(e);if(Object.entries(n).some(([e,r])=>r!==E&&t[e]!==E&&r!=t[e]))throw Error($e)}}}function Or(t,e=0,r=1){return Object.assign({},Tr(t),{[nr]:sr+"="+(0>e?e:e+"-"+(e+r-1))})}function Tr({options:t}){const{headers:e}=t;if(e)return Symbol.iterator in e?Object.fromEntries(e):e}async function kr(t){await Mr(t,Ir)}async function vr(t){await Mr(t,jr)}async function Mr(t,e){const r=await e(ar,t,Tr(t));t.data=new Uint8Array(await r.arrayBuffer()),t.size=t.data.length}async function Cr(t,e,r){if(t.preventHeadRequest)await r(t,t.options);else{const n=await e("HEAD",t,Tr(t)),a=n.headers.get("Content-Length");a&&!n.headers.get("Content-Encoding")?t.size=Number(a):await r(t,t.options)}}async function Ir(t,{fetch:e=fetch,options:r,url:n},a){const s=await e(n,Object.assign({},r,{method:t,headers:a}));if(400>s.status)return s;throw 416==s.status?Error(Qe):Error(Je+(s.statusText||s.status))}function jr(t,{url:e},r){return new Promise((n,a)=>{const s=new XMLHttpRequest;if(s.addEventListener("load",()=>{if(400>s.status){const t=[];s.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const r=e.trim().split(/\s*:\s*/);r[0]=r[0].trim().replace(/^[a-z]|-[a-z]/g,t=>t.toUpperCase()),t.push(r)}),n({status:s.status,arrayBuffer:()=>s.response,headers:new Map(t)})}else a(416==s.status?Error(Qe):Error(Je+(s.statusText||s.status)))},!1),s.addEventListener("error",t=>a(t.detail?t.detail.error:Error("Network error")),!1),s.open(t,e),r)for(const t of Object.entries(r))s.setRequestHeader(t[0],t[1]);s.responseType="arraybuffer",s.send()})}class Pr extends dr{constructor(t,e={}){super(),Object.assign(this,{url:t,reader:e.useXHR&&!e.fetch?new Er(t,e):new gr(t,e)})}set size(t){}get size(){return this.reader.size}async init(){await this.reader.init(),super.init()}createReadable(t){return this.reader.createReadable(t)}readUint8Array(t,e){return this.reader.readUint8Array(t,e)}}class Nr extends Pr{constructor(t,e={}){super(t,Object.assign({},e,{useRangeHeader:!0}))}}class Wr extends dr{constructor(t){super(),t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Object.assign(this,{array:t,size:t.length})}readUint8Array(t,e){return this.array.slice(t,t+e)}}class _r extends ur{constructor(t){super(),this.defaultBufferSize=t||262144}init(t=0){Object.assign(this,{offset:0,array:new Uint8Array(t>0?t:this.defaultBufferSize)}),super.init()}writeUint8Array(t){const e=this,r=e.offset+t.length;if(r>e.array.length){let t=e.array.length?2*e.array.length:e.defaultBufferSize;for(;r>t;)t*=2;const n=e.array;e.array=new Uint8Array(t),e.array.set(n)}e.array.set(t,e.offset),e.offset+=t.length}getData(){return this.offset===this.array.length?this.array:this.array.slice(0,this.offset)}}class Br extends dr{constructor(t){super(),this.jt=t}async init(){const t=this,{jt:e}=t;t.Pt=0,await Promise.all(e.map(t=>Hr(t))),t.Nt=e.map(e=>{const r=t.size;return t.size+=e.size,r}),super.init()}Wt(t){const{Nt:e,size:r}=this,n=e[t];return n===E?r:n}async readUint8Array(t,e){const r=this,{jt:n}=this;let a,s=0,i=t;for(;n[s]&&i>=n[s].size;)i-=n[s].size,s++;const o=n[s];if(o){const n=o.size;if(i+e>n){const s=n-i;a=st(await qr(o,i,s),await r.readUint8Array(t+s,e-s))}else a=await qr(o,i,e)}else a=A;return r.Pt=Math.max(s,r.Pt),a}}class Lr extends lr{constructor(t,e=4294967295){super();const r=this;let n,a,s;Object.assign(r,{diskNumber:0,diskOffset:0,size:0,maxSize:e,availableSize:e});const i=new WritableStream({async write(e){if(e===cr)return void(s&&await c());const{availableSize:i}=r;if(s)e.length<i?await o(e):(await o(e.subarray(0,i)),await c(),e.length>i&&await this.write(e.subarray(i)));else{const{value:i,done:o}=await t.next();if(o&&!i)throw Error(tr);n=i,n.size=0,n.maxSize&&(r.maxSize=n.maxSize),r.availableSize=r.maxSize,await Hr(n),a=i.writable,s=a.getWriter(),await this.write(e)}},async close(){s&&(await s.ready,await l())},async abort(t){s&&await s.abort(t)}});async function o(t){const e=t.length;e&&(await s.ready,await s.write(t),n.size+=e,r.availableSize-=e)}async function c(){await l(),r.diskOffset+=n.size,r.diskNumber++,s=null,r.availableSize=r.maxSize}async function l(){await s.close()}Object.defineProperty(r,or,{get:()=>i})}async closeDisk(){const t=this.writable.getWriter();try{await t.ready,await t.write(cr)}finally{t.releaseLock()}}}class Zr{constructor(t){return Array.isArray(t)&&(t=new Br(t)),(t instanceof ReadableStream||typeof t.getReader==R)&&(t={readable:$t(t)}),t}}class Vr{constructor(t){return t.writable===E&&typeof t.next==R&&(t=new Lr(t)),(t instanceof WritableStream||typeof t.getWriter==R)&&(t={writable:te(t)}),t.size===E&&(t.size=0),t}}async function Hr(t,e){if(!t.init||t.initialized)return Promise.resolve();await t.init(e)}function qr(t,e,r){return t.readUint8Array(e,r)}const Kr="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");function Yr(t,e){return e&&"cp437"==e.trim().toLowerCase()?(t=>{{let e="";for(let r=0;r<t.length;r++)e+=Kr[t[r]];return e}})(t):new TextDecoder(e,{ignoreBOM:!0}).decode(t)}const Gr="filename",Xr="rawFilename",Jr="comment",Qr="rawComment",$r="uncompressedSize",tn="compressedSize",en="offset",rn="diskNumberStart",nn="lastModDate",an="rawLastModDate",sn="lastAccessDate",on="creationDate",cn="rawCreationDate",ln="internalFileAttributes",dn="externalFileAttributes",un="msdosAttributesRaw",fn="msdosAttributes",wn="msDosCompatible",hn="zip64",pn="encrypted",mn="version",yn="versionMadeBy",bn="zipCrypto",Sn="directory",gn="executable",En="compressionMethod",xn="signature",zn="extraField",Rn="unixMode",An="setuid",Fn="setgid",Dn="sticky",Un=[Gr,Xr,$r,tn,nn,an,Jr,Qr,sn,on,cn,en,rn,ln,dn,un,fn,wn,hn,pn,mn,yn,bn,Sn,gn,En,xn,zn,"extraFieldUnix","extraFieldInfoZip","uid","gid",Rn,An,Fn,Dn,"bitFlag","filenameUTF8","commentUTF8","rawExtraField","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","extraFieldNTFS","extraFieldExtendedTimestamp"];class On{constructor(t){Un.forEach(e=>this[e]=t[e])}}const Tn="password",kn="rawPassword",vn="passThrough",Mn="signal",Cn="checkAmbiguity",In="useWebWorkers",jn="useCompressionStream",Pn="transferStreams",Nn="preventClose",Wn="offset",_n="usdz",Bn="strictness",Ln="strict",Zn="tolerant",Vn="File format is not recognized",Hn="End of central directory not found",qn="End of Zip64 central directory locator not found",Kn="Central directory header not found",Yn="Local file header not found",Gn="Zip64 extra field not found",Xn="File contains encrypted entry",Jn="Encryption method not supported",Qn="Compression method not supported",$n="Split zip file",ta="Overlapping entry found",ea="Ambiguous archive",ra="Encrypted central directory is not supported",na="utf-8",aa="cp437",sa=[[$r,t],[tn,t],[en,t],[rn,e]],ia={[e]:{_t:va,bytes:4},[t]:{_t:Ma,bytes:8}};class oa{constructor(t,e={}){Object.assign(this,{reader:new Zr(t),options:e,config:T(),Bt:new Map})}async*getEntriesGenerator(n={}){const s=this;let{reader:o}=s;const{config:f}=s;if(await Hr(o),o.size!==E&&o.readUint8Array||(o=new mr(await new Response(o.readable).blob()),await Hr(o)),o.size<d)throw Error(Vn);const w=ya(Da(s,n,Bn),Da(s,n,Cn)),b=w==Ln,S=w!=Zn,g=((t,r)=>t!==E?t:r==Ln?0:r==Zn?1/0:e)(Da(s,n,"maxAppendedDataSize"),w),{Lt:x,Zt:z}=await(async(t,e,r)=>{const{size:n}=t,a=Math.min(n,65557),s={count:ba};let i,o,c=0;for await(const[r,l,u,f,w]of xa(t,a)){const a=ka(r,f+20);if(w+d+a==n){const a=await Ra(t,r,l,f,w,n,s);if(a==Ea){if(i||(i=za(u,f,w)),c++,!e||c>1)break}else a!=ga||o||(o=za(u,f,w))}}return i||(i=o),i||(i=await(async(t,e,r)=>{const{size:n}=t,a=Math.min(n,e==1/0?n:65557+e);let s,i;for await(const[e,o,c,l,d]of xa(t,a)){const a=za(c,l,d);s||(s=a);const u=await Ra(t,e,o,l,d,n,r);if(u==Ea)return a;u!=ga||i||(i=a)}return i||s})(t,r,s)),{Lt:i,Zt:c}})(o,S,g);if(!x)throw va(ot(await qr(o,0,4)))==a?Error($n):Error(Hn);S&&z>1&&Fa("multiple end of central directory records");const R=ot(x);let F=va(R,12),D=va(R,16);const U=x.offset,O=ka(R,20),T=U+d+O;o.size-T>g&&Fa("appended data");let k=ka(R,4);const v=o.Pt||0;let M,C,I,j=ka(R,6),P=ka(R,10),N=0;const W=D==t||F==t||P==e||j==e;if(D!=t&&j!=e&&(D+=ma(o,j)),W){const r=x.offset<u?A:await qr(o,x.offset-u,u),n=ot(r);if(r.length==u&&va(n,0)==l){D=ma(o,va(n,4))+Ma(n,8);let r=await qr(o,D,56),a=ot(r);const s=x.offset-u-56;if((56>r.length||va(a,0)!=c)&&D!=s&&s>=0){const t=D;D=s,D>t&&(N=D-t),r=await qr(o,D,56),a=ot(r)}if(56>r.length||va(a,0)!=c)throw Error(qn);C=!0,I=Ma(a,4)>44,k==e?k=va(a,16):b&&k!=va(a,16)&&Fa("mismatched zip64 end of central directory record"),j==e?j=va(a,20):b&&j!=va(a,20)&&Fa("mismatched zip64 end of central directory record"),P==e?P=Ma(a,32):b&&P!=Ma(a,32)&&Fa("mismatched zip64 end of central directory record"),F==t?F=Ma(a,40):b&&F!=Ma(a,40)&&Fa("mismatched zip64 end of central directory record"),D=ma(o,j)+Ma(a,48)+N}}const _=F,B=x.offset-(C?76:0);if(D<o.size||(N=o.size-D-F-d,D=o.size-F-d),v!=k)throw Error($n);if(0>D)throw Error(Vn);let L=0,Z=await qr(o,D,F),V=ot(Z);if(F){if(4>Z.length)throw Error(Vn);const t=B-F;if(D!=t&&j==k){let e=!(va(V,L)==i);if(e||0>t||t+4>o.size||(e=va(ot(await qr(o,t,4)),0)==i),e){const e=D;D=t,D>e&&(N+=D-e),Z=await qr(o,D,F),V=ot(Z)}}}const H=B-D;if(F==H||0>H||j!=k||(F=H,Z=await qr(o,D,F),V=ot(Z)),0>D||D>=o.size)throw Error(Vn);M=D;const q=Da(s,n,"filenameEncoding"),K=Da(s,n,"commentEncoding"),Y=b?new Set:E;let G;for(let t=0;P>t;t++){const a=new la(o,f,s.options);if(L+46>Z.length||va(V,L)!=i){if(0==t&&(I||da(V)))throw Error(ra);throw Error(Kn)}ua(a,V,L+6);const c=!!a.bitFlag.languageEncodingFlag,l=L+46,d=l+a.filenameLength,u=d+a.extraFieldLength,w=ka(V,L+4),S=!(w>>8),g=w>>8==3,x=Z.subarray(l,d),z=ka(V,L+32),R=u+z,A=Z.subarray(u,R),F=c,D=c,U=va(V,L+38),O=U&r,T={readOnly:!!(1&O),hidden:!!(2&O),system:!!(4&O),directory:!!(16&O),archive:!!(32&O)},k=va(V,L+42),v=Da(s,n,"decodeText")||Yr,C=F?na:q||aa,j=D?na:K||aa;let W=v(x,C);W===E&&(W=Yr(x,C));let _=v(A,j);_===E&&(_=Yr(A,j)),Object.assign(a,{index:t,versionMadeBy:w,msDosCompatible:S,compressedSize:0,uncompressedSize:0,Vt:z,offset:k,diskNumberStart:ka(V,L+34),internalFileAttributes:ka(V,L+36),externalFileAttributes:U,msdosAttributesRaw:O,msdosAttributes:T,rawFilename:x,filenameUTF8:F,commentUTF8:D,rawExtraField:Z.subarray(d,u),rawComment:A,filename:W,comment:_}),fa(a,a,V,L+6),a.offset+=N,M=Math.min(ma(o,a.diskNumberStart)+a.offset,M),b&&(Y.has(a.filename)&&(G=!0),Y.add(a.filename));const B=a.externalFileAttributes>>16&e;a.unixMode===E&&16877&B&&(a.unixMode=B);const H=!!(a.unixMode&p),X=!!(a.unixMode&m),J=!!(512&a.unixMode),Q=a.unixMode!==E?!!(73&a.unixMode):g&&!!(73&B),$=a.unixMode!==E&&(61440&a.unixMode)==h,tt=(61440&B)==h;Object.assign(a,{setuid:H,setgid:X,sticky:J,unixExternalUpper:B,internalFileAttribute:a.internalFileAttributes,externalFileAttribute:a.externalFileAttributes,executable:Q,directory:$||tt||S&&T.directory||a.filename.endsWith(y)&&!a.uncompressedSize,zipCrypto:a.encrypted&&!a.extraFieldAES});const et=new On(a);et.getData=(t,e)=>a.getData(t,et,s.Bt,e),et.arrayBuffer=async t=>{const e=new TransformStream,[r]=await Promise.all([new Response(e.readable).arrayBuffer(),a.getData(e,et,s.Bt,t)]);return r},L=R;const{onprogress:rt}=n;if(rt)try{await rt(t+1,P,new On(a))}catch{}yield et}b&&L!=_&&Fa("trailing central directory data"),G&&Fa("duplicate filename"),b&&(N||P&&M>0)&&Fa("prepended data");const X=Da(s,n,"extractPrependedData"),J=Da(s,n,"extractAppendedData");return X&&(s.prependedData=M>0?await qr(o,0,M):A),s.comment=O?await qr(o,U+d,O):A,J&&(s.appendedData=T<o.size?await qr(o,T,o.size-T):A),!0}async getEntries(t={}){const e=[];for await(const r of this.getEntriesGenerator(t))e.push(r);return e}async close(){}}class ca{constructor(t={}){const{readable:e,writable:r}=new TransformStream,n=new oa(e,t).getEntriesGenerator();this.readable=new ReadableStream({async pull(t){const{done:e,value:r}=await n.next();if(e)return t.close();const a={...r,readable:(()=>{const{readable:t,writable:e}=new TransformStream;if(r.getData)return(async()=>{try{await r.getData(e)}catch(t){try{await e.abort(t)}catch{}}})(),t})()};delete a.getData,t.enqueue(a)}}),this.writable=r}}let la=class{constructor(t,e,r){Object.assign(this,{reader:t,config:e,options:r})}async getData(t,e,a,i={}){const o=this,{reader:c,index:l,offset:d,diskNumberStart:u,extraFieldAES:f,extraFieldZip64:w,compressionMethod:h,config:p,bitFlag:m,rawBitFlag:y,signature:S,rawLastModDate:g,uncompressedSize:x,compressedSize:z}=o,{dataDescriptor:R}=m,F=e.localDirectory={},D=ma(c,u)+d,U=await qr(c,D,b),O=ot(U);let T=Da(o,i,Tn),k=Da(o,i,kn);const v=Da(o,i,vn);if(T=T&&T.length&&T,k=k&&k.length&&k,f&&99!=f.originalCompressionMethod)throw Error(Qn);if(U.length<b||va(O,0)!=n)throw Error(Yn);ua(F,O,4);const{extraFieldLength:M,filenameLength:C}=F,I=ya(Da(o,i,Bn),Da(o,i,Cn))==Ln;let j=A;if(I&&(C||M)){const t=await qr(c,D+b,C+M);j=t.subarray(0,C),F.rawExtraField=t.subarray(C)}else F.rawExtraField=M?await qr(c,D+b+C,M):A;fa(o,F,O,4,!0),I&&((t,e,r)=>{const{rawFilename:n}=t;(r.length!=n.length||r.some((t,e)=>t!=n[e]))&&Fa("mismatched local file header (filename)"),(2057&e.rawBitFlag)!=(2057&t.rawBitFlag)&&Fa("mismatched local file header (general purpose bit flag)"),e.compressionMethod!=t.compressionMethod&&Fa("mismatched local file header (compression method)"),e.bitFlag.dataDescriptor||!(e.signature||e.compressedSize||e.uncompressedSize)||e.signature==t.signature&&e.compressedSize==t.compressedSize&&e.uncompressedSize==t.uncompressedSize||Fa("mismatched local file header (signature or sizes)")})(o,F,j);const{lastAccessDate:P,creationDate:N}=F;P&&(e.lastAccessDate=P),N&&(e.creationDate=N);const W=o.encrypted&&F.encrypted&&!v,_=W&&!f;if(v||(e.zipCrypto=_),W&&!(64&~F.rawBitFlag))throw Error(Jn);const B=v?E:V(h);if(0!=h&&8!=h&&9!=h&&!B&&!v)throw Error(Qn);if(W){if(!_&&(1>f.strength||f.strength>3))throw Error(Jn);if(!T&&!k)throw Error(Xn)}const L=D+b+C+M,Z=z,H=$t(c.createReadable({offset:L,size:Z})),q=Da(o,i,Mn),K=Da(o,i,"checkPasswordOnly");let Y=Da(o,i,"checkOverlappingEntry");const G=Da(o,i,"checkOverlappingEntryOnly");G&&(Y=!0);const{onstart:X,onprogress:J,onend:Q}=i,$=9==h;let tt=Da(o,i,jn);$&&(tt=!1);const et={options:{codecType:be,password:T,rawPassword:k,zipCrypto:_,encryptionStrength:f&&f.strength,signed:Da(o,i,"checkSignature")&&!v,passwordVerification:_&&(R?g>>>8&r:S>>>24&r),outputSize:v?z:x,signature:S,compressed:0!=h&&!v,encrypted:W,useWebWorkers:Da(o,i,In),useCompressionStream:tt,transferStreams:Da(o,i,Pn),deflate64:$,format:B?B.format:E,codecURI:B?B.codecURI:E,compressionMethod:h,rawBitFlag:y,checkPasswordOnly:K},config:p,ut:{signal:q,size:Z,onstart:X,onprogress:J,onend:Q}};let rt;Y&&await(async({reader:t,Ht:e,index:r,offset:n,signature:a,compressedSize:i,uncompressedSize:o,qt:c,dataDescriptor:l,extraFieldZip64:d,Bt:u})=>{let f=0;if(l&&(f=d?20:12),f){const r=await qr(t,c+i,f+4);if(r.length==f+4&&va(ot(r),0)==s){const t=va(ot(r),4);let n,s;d?(n=Ma(ot(r),8),s=Ma(ot(r),16)):(n=va(ot(r),8),s=va(ot(r),12)),(e.encrypted&&!e.zipCrypto||t==a)&&n==i&&s==o&&(f+=4)}}const w={start:n,end:c+i+f,Ht:e};for(const[t,e]of u)if(t!=r&&w.start<e.end&&e.start<w.end){const t=Error(ta);throw t.Kt=e.Ht,t}u.set(r,w)})({reader:c,Ht:e,index:l,offset:D,signature:S,compressedSize:z,uncompressedSize:x,qt:L,dataDescriptor:R||F.bitFlag.dataDescriptor,extraFieldZip64:w||F.extraFieldZip64,Bt:a});try{if(!G){K&&(t=new WritableStream),t=new Vr(t),await Hr(t,v?z:x),({writable:rt}=t);const{outputSize:e}=await He({readable:H,writable:rt},et);if(t.size+=e,e!=(v?z:x))throw Error(ee)}}catch(e){if(e.outputSize!==E&&(t.size+=e.outputSize),!K||e.message!=pt)throw e}finally{Da(o,i,Nn)||!rt||rt.locked||await rt.getWriter().close()}return K||G?E:t.getData?t.getData():rt}};function da(t){const e=Math.min(t.byteLength,1024)-3;for(let r=0;e>r;r++)if(134630224==va(t,r))return!0;return!1}function ua(t,e,r){const n=t.rawBitFlag=ka(e,r+2),a=!(1&~n),s=va(e,r+6);Object.assign(t,{encrypted:a,version:ka(e,r),bitFlag:{level:(6&n)>>1,dataDescriptor:!(8&~n),languageEncodingFlag:(n&w)==w},rawLastModDate:s,lastModDate:Ua(s),filenameLength:ka(e,r+22),extraFieldLength:ka(e,r+24)})}function fa(t,e,r,n,a){const{rawExtraField:s}=e,i=e.extraField=new Map,o=ot(s);let c=0;try{for(;c<s.length;){const t=ka(o,c),e=ka(o,c+2);i.set(t,{type:t,data:s.slice(c+4,c+4+e)}),c+=4+e}}catch{}const l=ka(r,n+4);Object.assign(e,{signature:va(r,n+10),compressedSize:va(r,n+14),uncompressedSize:va(r,n+18)});const d=i.get(1);d&&(((t,e)=>{e.zip64=!0;const r=ot(t.data),n=sa.filter(([t,r])=>e[t]==r),a=n.reduce((t,[,e])=>t+ia[e].bytes,0);if(t.data.length<a)throw Error(Gn);for(let a=0,s=0;a<n.length;a++){const[i,o]=n[a],c=ia[o];e[i]=t[i]=c._t(r,s),s+=c.bytes}})(d,e),e.extraFieldZip64=d);const u=i.get(28789);u&&(wa(u,Gr,Xr,e,t),e.extraFieldUnicodePath=u);const w=i.get(25461);w&&(wa(w,Jr,Qr,e,t),e.extraFieldUnicodeComment=w);const h=i.get(39169);h&&h.data.length>=7?(((t,e,r)=>{const n=ot(t.data),a=Ta(n,4);Object.assign(t,{Yt:Ta(n,0),vendorId:Ta(n,2),strength:a,originalCompressionMethod:r,compressionMethod:ka(n,5)}),e.compressionMethod=t.compressionMethod})(h,e,l),e.extraFieldAES=h):e.compressionMethod=l;const p=i.get(10);p&&(((t,e)=>{const r=ot(t.data);let n,a=4;try{for(;a<t.data.length&&!n;){const e=ka(r,a),s=ka(r,a+2);1==e&&(n=t.data.slice(a+4,a+4+s)),a+=4+s}}catch{}try{if(n&&24==n.length){const r=ot(n),a=r.getBigUint64(0,!0),s=r.getBigUint64(8,!0),i=r.getBigUint64(16,!0);Object.assign(t,{rawLastModDate:a,rawLastAccessDate:s,rawCreationDate:i});const o={lastModDate:Oa(a),lastAccessDate:Oa(s),creationDate:Oa(i)};Object.assign(t,o),Object.assign(e,o)}}catch{}})(p,e),e.extraFieldNTFS=p);const m=i.get(30805);if(m)ha(m,e,!1),e.extraFieldUnix=m;else{const t=i.get(30837);t&&(ha(t,e,!0),e.extraFieldInfoZip=t)}const y=i.get(f);y&&(((t,e,r)=>{if(!t.data.length)return;const n=ot(t.data),a=Ta(n,0),s=[],i=[];r?(1&~a||(s.push(nn),i.push(an)),2&~a||(s.push(sn),i.push("rawLastAccessDate")),4&~a||(s.push(on),i.push(cn))):5>t.data.length||(s.push(nn),i.push(an));let o=1;s.forEach((r,a)=>{if(t.data.length>=o+4){const s=va(n,o);e[r]=t[r]=new Date(1e3*(0|s));const c=i[a];t[c]=s}o+=4})})(y,e,a),e.extraFieldExtendedTimestamp=y);const b=i.get(6534);b&&(e.extraFieldUSDZ=b)}function wa(t,e,r,n,a){if(5>t.data.length)return void(t.valid=!1);const s=ot(t.data),i=new rt;i.append(a[r]);const o=ot(new Uint8Array(4));o.setUint32(0,i.get(),!0);const c=va(s,1);Object.assign(t,{version:Ta(s,0),[e]:Yr(t.data.subarray(5)),valid:!a.bitFlag.languageEncodingFlag&&c==va(o,0)}),t.valid&&(n[e]=t[e],n[e+"UTF8"]=!0)}function ha(t,e,r){try{const n=ot(t.data);let a,s;if(r){let e=0;const r=Ta(n,e++),i=Ta(n,e++);a=pa(t.data.subarray(e,e+i)),e+=i;const o=Ta(n,e++);s=pa(t.data.subarray(e,e+o)),Object.assign(t,{version:r,uid:a,gid:s})}else 4>t.data.length||(a=ka(n,0),s=ka(n,2),Object.assign(t,{uid:a,gid:s}));a!==E&&(e.uid=a),s!==E&&(e.gid=s)}catch{}}function pa(t){const e=new Uint8Array(4);return e.set(t,0),new DataView(e.buffer,e.byteOffset,4).getUint32(0,!0)}function ma(t,e){return t.Wt?t.Wt(e):0}function ya(t,e){return t===E?e?Ln:"balanced":t}const ba=64,Sa=0,ga=1,Ea=2;async function*xa(t,e){const r=t.size-e,n=await qr(t,r,e),a=ot(n);for(let t=n.length-d;t>=0;t--)va(a,t)==o&&(yield[a,r,n,t,r+t])}function za(t,e,r){return{offset:r,buffer:t.slice(e,e+d).buffer}}async function Ra(r,n,a,s,o,c,d){const f=ka(n,s+10),w=va(n,s+12),h=va(n,s+16);if(f==e||w==t||h==t)return await Aa(r,n,a,o-u,c,d)==l?Ea:Sa;if(!f&&!w)return ga;const p=ka(n,s+6);for(const t of[o-w,ma(r,p)+h])if(await Aa(r,n,a,t,c,d)==i)return Ea;return Sa}async function Aa(t,e,r,n,a,s){return 0>n||n+4>a?E:r>n?s.count>0?(s.count--,va(ot(await qr(t,n,4)),0)):E:va(e,n-r)}function Fa(t){const e=Error(ea);throw e.reason=t,e}function Da(t,e,r){return e[r]===E?t.options[r]:e[r]}function Ua(t){const r=(4294901760&t)>>16,n=t&e;try{return new Date(1980+((65024&r)>>9),((480&r)>>5)-1,31&r,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch{}}function Oa(t){return new Date(Number(t/BigInt(1e4)-BigInt(116444736e5)))}function Ta(t,e){return t.getUint8(e)}function ka(t,e){return t.getUint16(e,!0)}function va(t,e){return t.getUint32(e,!0)}function Ma(t,e){return Number(t.getBigUint64(e,!0))}var Ca=Object.freeze({__proto__:null,ERR_AMBIGUOUS_ARCHIVE:ea,ERR_BAD_FORMAT:Vn,ERR_CENTRAL_DIRECTORY_NOT_FOUND:Kn,ERR_ENCRYPTED:Xn,ERR_ENCRYPTED_CENTRAL_DIRECTORY:ra,ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND:qn,ERR_EOCDR_NOT_FOUND:Hn,ERR_EXTRAFIELD_ZIP64_NOT_FOUND:Gn,ERR_INVALID_COMPRESSED_DATA:re,ERR_INVALID_PASSWORD:wt,ERR_INVALID_SIGNATURE:ht,ERR_INVALID_UNCOMPRESSED_SIZE:ee,ERR_LOCAL_FILE_HEADER_NOT_FOUND:Yn,ERR_OVERLAPPING_ENTRY:ta,ERR_SPLIT_ZIP_FILE:$n,ERR_UNSUPPORTED_COMPRESSION:Qn,ERR_UNSUPPORTED_ENCRYPTION:Jn,ZipReader:oa,ZipReaderStream:ca});const Ia="File already exists",ja="Zip file comment exceeds 64KB",Pa="File entry comment exceeds 64KB",Na="File entry name exceeds 64KB",Wa="Version exceeds 65535",_a="The strength must equal 1, 2, or 3",Ba="Encryption is not supported in USDZ files",La="Extra field type exceeds 65535",Za="Extra field data exceeds 64KB",Va=-2147483648,Ha=2147483647,qa="Zip64 is not supported (set the 'zip64' option to 'true')",Ka="Undefined uncompressed size",Ya="Undefined reader",Ga="Zip file not empty",Xa=new Uint8Array([7,0,2,0,65,69,3,0,0]),Ja="infozip",Qa="unix";let $a=0;const ts=[];class es{constructor(t,e={}){t=new Vr(t);const{availableSize:r=x,maxSize:n=x}=t;Object.assign(this,{writer:t,Gt:r>0&&r!==x&&n>0&&n!==x,options:e,config:T(),files:new Map,Xt:new Set,offset:e[Wn]===E?t.size||t.writable.size||0:e[Wn],Jt:e[Wn]===E?0:e[Wn]-(t.size||t.writable.size||0),Qt:new Set,$t:0,te:E})}async prependZip(e){if(this.Xt.size)throw Error(Ga);e=new Zr(e),await Hr(e);const{ZipReader:r}=await Promise.resolve().then(()=>Ca),n=new r(e.readable),a=await n.getEntries();await n.close(),await Hr(this.writer),await e.readable.pipeTo(this.writer.writable,{preventClose:!0,preventAbort:!0}),this.writer.size=this.offset=e.size,this.Xt=new Set(a.map(t=>t.filename)),this.files=new Map(a.map(e=>{const{version:r,rawLastModDate:n,lastAccessDate:a,creationDate:s,rawFilename:i,bitFlag:o,encrypted:c,uncompressedSize:l,compressedSize:d,zip64:u}=e;let{compressionMethod:f,ee:w,re:h,ne:p,ae:m,se:y,rawExtraField:b}=e;const{level:S,languageEncodingFlag:g,dataDescriptor:x}=o;w=w||A,h=h||A,p=p||A,m=m||A,y=y||A,b=b||A,e.extraFieldAES&&(f=99);const z=xs(w,h,p,m,y,b),R=u&&l>=t,F=u&&d>=t,D=-7&Rs(S,g,x,c,f)|S<<1,{ie:U,oe:O}=zs({version:r,bitFlag:D,compressionMethod:f,uncompressedSize:l,compressedSize:d,rawLastModDate:n,rawFilename:i,ce:F,le:R,extraFieldLength:z}),{signature:T}=e;return T!==E&&Ss(O,10,T),Object.assign(e,{le:R,ce:F,de:u&&e.offset>=t,diskNumberStart:0,ue:!1,ee:w,re:h,ne:p,ae:m,se:y,rawExtraField:b,extendedTimestamp:p.length>0||m.length>0,fe:1+(a?2:0)+(s?4:0),ie:U,oe:O}),[e.filename,e]}))}async add(i="",o,c={}){const l=this;c=Object.assign({},c);const{Qt:d,config:u}=l;let w,z;$a<u.maxWorkers?$a++:await new Promise(t=>ts.push(t));try{if(i=i.trim(),ms(l,c,Sn)&&!i.endsWith(y)&&(i+=y),l.Xt.has(i))throw Error(Ia);return l.Xt.add(i),z=!0,w=(async(i,o,c,l)=>{const d=((n,a,s)=>{a=a.trim();let i=ms(n,s,wn),o=ms(n,s,yn,i?20:768);const c=ms(n,s,gn),l=ms(n,s,"uid"),d=ms(n,s,"gid");let u=ms(n,s,Rn),f=ms(n,s,"unixExtraFieldType"),w=ms(n,s,An),b=ms(n,s,Fn),S=ms(n,s,Dn);if(l!==E&&(0>l||l>t))throw Error("Invalid uid (must be integer 0..2^32-1)");if(d!==E&&(0>d||d>t))throw Error("Invalid gid (must be integer 0..2^32-1)");if(u!==E&&(0>u||u>e))throw Error("Invalid UNIX mode (must be integer 0..65535)");if(f!==E&&f!==Ja&&f!==Qa)throw Error("Invalid unixExtraFieldType (must be 'infozip' or 'unix')");if(f===Qa&&(l!==E&&l>e||d!==E&&d>e))throw Error("uid/gid must be 0..65535 for unixExtraFieldType 'unix' (use 'infozip' for larger ids)");f!==E||l===E&&d===E||(f=Ja);let g=ms(n,s,un),x=ms(n,s,fn);const z=g!==E||x!==E;if(l!==E||d!==E||u!==E||f?(i=!1,o=o&e|768):z&&(i=!0,o&=r),g!==E&&(0>g||g>r))throw Error("Invalid msdosAttributesRaw (must be integer 0..255)");if(x&&"object"!=typeof x)throw Error("Invalid msdosAttributes (must be an object with boolean flags)");if(o>e)throw Error(Wa);let R=ms(n,s,dn);const A=R!==E;A||(R=0),!s[Sn]&&a.endsWith(y)&&(s[Sn]=!0);const F=ms(n,s,Sn);let D;if(F?(a.endsWith(y)||(a+=y),A||(R=16,i||(R|=16877<<16))):i||A||(R=c?493<<16:27525120),!i){const t=u!==E||!!(w||b||S);D=R>>16&e,u=u===E?D:u&e,w?u|=p:w=!!(u&p),b?u|=m:b=!!(u&m),S?u|=512:S=!!(512&u),A&&!t||(F&&(u|=h),R=(u&e)<<16|R&e)}return({msdosAttributesRaw:g,msdosAttributes:x}=((t,e)=>{if(t!==E)t&=r;else if(e!==E){const{readOnly:n,hidden:a,system:s,directory:i,archive:o}=e;let c=0;n&&(c|=1),a&&(c|=2),s&&(c|=4),i&&(c|=16),o&&(c|=32),t=c&r}return e===E&&(e={readOnly:!!(1&t),hidden:!!(2&t),system:!!(4&t),directory:!!(16&t),archive:!!(32&t)}),{msdosAttributesRaw:t,msdosAttributes:e}})(g,x)),z&&(R=R&t|g&r),{name:a,we:{versionMadeBy:o,msDosCompatible:i,externalFileAttributes:R,unixExternalUpper:D,uid:l,gid:d,unixMode:u,unixExtraFieldType:f,setuid:w,setgid:b,sticky:S,msdosAttributesRaw:g,msdosAttributes:x}}})(i,o,l);({name:o}=d);const u=((t,r,n)=>{const a=ms(t,n,"encodeText",at);let s=a(r);if(s===E&&(s=at(r)),xs(s)>e)throw Error(Na);const i=n[Jr]||"";let o=a(i);if(o===E&&(o=at(i)),xs(o)>e)throw Error(Pa);const c=ms(t,n,mn,20);if(c>e)throw Error(Wa);const l=ms(t,n,nn,new Date),d=ms(t,n,sn),u=ms(t,n,on),f=ms(t,n,ln,0),w=ms(t,n,vn);let h,p;w||(h=ms(t,n,Tn),p=ms(t,n,kn));const m=ms(t,n,"encryptionStrength",3),y=ms(t,n,bn),b=ms(t,n,"extendedTimestamp",!0),S=ms(t,n,"ntfsTimestamp"),g=ms(t,n,"keepOrder",!0),x=ms(t,n,In),z=ms(t,n,Pn),R=ms(t,n,"bufferedWrite"),F=ms(t,n,"createTempStream"),D=ms(t,n,"dataDescriptorSignature",!0),U=ms(t,n,Mn),O=ms(t,n,"useUnicodeFileNames",!0),T=ms(t,n,En),k=w||T===E?E:V(T);if(!w&&T!==E&&0!==T&&8!==T&&!k)throw Error("Compression method not supported");let v=ms(t,n,"level");if(t.options[_n]){if(h!==E||p!==E)throw Error(Ba);v===E&&T===E&&(v=0)}let M=ms(t,n,jn),C=ms(t,n,"dataDescriptor");R&&C===E&&(C=!1),(C===E||y)&&(C=!0),v!==E&&6!=v&&(M=!1),M||k||t.config.CompressionStream!==E||t.config.CompressionStreamZlib!==E||(v=0);const I=ms(t,n,hn);if(!y&&(h!==E||p!==E)&&(1>m||m>3))throw Error(_a);let j=A;const P=n[zn];if(P){let t=0,r=0;P.forEach(e=>t+=4+xs(e)),j=new Uint8Array(t);const n=ot(j);P.forEach((t,a)=>{if(a>e)throw Error(La);if(xs(t)>e)throw Error(Za);bs(n,r,a),bs(n,r+2,xs(t)),Es(j,t,r+4),r+=4+xs(t)})}return{comment:i,we:{rawFilename:s,rawComment:o,version:c,lastModDate:l,lastAccessDate:d,creationDate:u,internalFileAttributes:f,passThrough:w,password:h,rawPassword:p,encryptionStrength:m,zipCrypto:y,extendedTimestamp:b,ntfsTimestamp:S,keepOrder:g,useWebWorkers:x,transferStreams:z,bufferedWrite:R,createTempStream:F,dataDescriptorSignature:D,signal:U,useUnicodeFileNames:O,compressionMethod:T,format:k?k.format:E,codecURI:k?k.codecURI:E,he:k?k.versionNeeded:E,level:v,useCompressionStream:M,dataDescriptor:C,zip64:I,rawExtraField:j}}})(i,o,l),{comment:w}=u,z=l[zn];let R;i.files.set(o,E);try{const w=await(async(e,r,{we:n},a)=>{const{passThrough:s,zipCrypto:i,password:o,rawPassword:c,encryptionStrength:l}=n;let{dataDescriptor:d,zip64:u,level:f,compressionMethod:w}=n,h=0,p=0;if(s){if(!r)throw Error(Ya);if(p=a[$r],p===E)throw Error(Ka)}const m=!0===u,y=ms(e,a,pn),b=!!r&&(!!(o&&xs(o)||c&&xs(c))||s&&y);r||(f=0,w=0);const S=b?i?12:16+4*l:0;r&&(r=new Zr(r),await Hr(r),s?(a.uncompressedSize=p,h=ys(p)+S):r.size===E?(d=!0,(u||u===E)&&(u=!0,p=h=4294967296)):(a.uncompressedSize=p=r.size,h=ys(p)+S));const g=m||p>=t,x=m||h>=t;if(g||x){if(!1===u)throw Error(qa);u=!0}return u=u||!1,{reader:r,we:{dataDescriptor:d,zip64:u,le:g,ce:x,uncompressedSize:p,level:f,compressionMethod:w,encrypted:b}}})(i,c,u,l);({reader:c}=w);const h=cs(i.writer),p=os(i.writer),m=(t=>{const{rawFilename:r,lastModDate:a,lastAccessDate:s,creationDate:i,level:o,zip64:c,zipCrypto:l,useUnicodeFileNames:d,dataDescriptor:u,directory:w,rawExtraField:h,encryptionStrength:p,extendedTimestamp:m,ntfsTimestamp:y,passThrough:x,encrypted:z,le:R,ce:F,uncompressedSize:D}=t;let{version:U,compressionMethod:O}=t;const T=!w&&(O===E?o===E||o>0:0!==O);let k;const v=x||!T,M=c&&(t.bufferedWrite||!u||!R&&!F||v),C=M||c&&u&&(R||F);if(c&&(R||F)){const t=20,e=is(t);if(e.uint16(1),e.uint16(t-4),k=e.array,M&&(e.pe(D),v)){const t=z?l?12:16+4*p:0;e.pe(x?0:D+t)}}else k=A;let I,j,P,N,W;if(z&&!l){const t=is(xs(Xa)+2);t.uint16(39169),t.bytes(Xa),I=t.array,I[8]=p}else I=A;if(m){const t=ws(a),e=hs(t);if(e){const e=9+(s?4:0)+(i?4:0),r=is(e);N=1+(s?2:0)+(i?4:0),r.uint16(f),r.uint16(e-4),r.uint8(N),r.uint32(t),s&&r.uint32(ps(ws(s))),i&&r.uint32(ps(ws(i))),P=r.array}else P=A;if(y===E?!e||s||i:y)try{const t=fs(a),e=is(36);e.uint16(10),e.uint16(32),e.me(4),e.uint16(1),e.uint16(24),e.pe(t),e.pe(fs(s)||t),e.pe(fs(i)||t),j=e.array}catch{j=A}else j=A}else j=P=A;try{const{uid:r,gid:n,unixExtraFieldType:a}=t;if(a!=Ja||r===E&&n===E)if(a!=Qa||r===E&&n===E)W=A;else{const t=is(8);t.uint16(30805),t.uint16(4),t.uint16((r===E?0:r)&e),t.uint16((n===E?0:n)&e),W=t.array}else{const t=ss(r),e=ss(n),a=3+t.length+e.length,s=is(4+a);s.uint16(30837),s.uint16(a),s.uint8(1),s.uint8(t.length),s.bytes(t),s.uint8(e.length),s.bytes(e),W=s.array}}catch{W=A}O===E&&(O=T?8:0);const{he:_}=t;T&&_!==E&&(U=U>_?U:_),c&&(U=U>45?U:45),z&&!l&&(U=U>51?U:51,I[9]=O,O=99);const B=C?xs(k):0,L=B+xs(I,P,j,W,h);if(L>e)throw Error(Za);const Z=new Date(2e3*Math.ceil(a.getTime()/2e3)),{ie:V,oe:H,rawLastModDate:q}=zs({version:U,bitFlag:Rs(o,d,u,z,O),compressionMethod:O,uncompressedSize:D,lastModDate:g>Z?g:Z>S?S:Z,rawFilename:r,ce:F,le:R,extraFieldLength:L}),K=is(b+xs(r)+L),Y=K.array,G=ot(Y);return K.uint32(n),K.bytes(V),K.bytes(r),C&&K.bytes(k),K.bytes(I),K.bytes(P),K.bytes(j),K.bytes(W),K.bytes(h),u&&(F||Ss(G,18,0),R||Ss(G,22,0)),{ye:Y,be:G,ie:V,oe:H,lastModDate:a,rawLastModDate:q,encrypted:z,compressed:T,version:U,compressionMethod:O,fe:N,ee:A,Se:B,ne:P,ae:j,se:W,re:I,extraFieldLength:L}})(l=Object.assign({},l,d.we,u.we,w.we,{internalFileAttribute:u.we.internalFileAttributes,externalFileAttribute:d.we.externalFileAttributes,signature:l[xn],offset:i.offset-h,diskNumberStart:p})),y=(({zip64:t,dataDescriptor:e,dataDescriptorSignature:r})=>{let n,a=A,i=0,o=t?20:12;return r&&(o+=4),e&&(a=new Uint8Array(o),n=ot(a),r&&(i=4,Ss(n,0,s))),{ge:a,Ee:n,xe:i}})(l),z=xs(m.ye,y.ge);R=await(async(e,n,s,i,o)=>{const{files:c,writer:l}=e,{keepOrder:d,dataDescriptor:u,signal:f}=o,{ze:w}=i,h=e.options[_n],p=e.te;let m,y,S,g,z,R,A,F={},D=0;c.set(n,F),e.te=F;try{let y;d&&(y=p&&p.lock,F.lock=new Promise(t=>S=t)),o.bufferedWrite||!d||e.Re||e.$t||!u?(m=!0,e.$t++,A=o.createTempStream?await o.createTempStream():new TransformStream(E,E,{highWaterMark:x}),A.size=0,await Hr(l)):(A=l,await U()),await Hr(A);const T=cs(l);if(e.Gt){delete e.Gt;const t=new Uint8Array(4);Ss(ot(t),0,a),await us(l,t),e.offset+=4}h&&!m&&as(i,e.offset-T);const{ye:k}=w;m||(await y,await O());const v=os(l),M=ds(e,l);if(F.diskNumberStart=v,m||(z=!0,R=l.size,await us(A,k)),F=await(async(e,n,{diskNumberStart:a,lock:s},i,o,c)=>{const{ze:l,Ae:d,Fe:u}=i,{ie:f,oe:w,lastModDate:h,rawLastModDate:p,encrypted:m,compressed:y,version:b,compressionMethod:S,ee:g,Se:x,ne:z,fe:R,ae:A,se:F,re:D}=l,{ge:U}=d,{rawFilename:O,lastAccessDate:T,creationDate:k,password:v,rawPassword:M,level:C,zip64:I,le:j,ce:P,zipCrypto:N,dataDescriptor:W,directory:_,executable:B,versionMadeBy:L,rawComment:Z,rawExtraField:V,useWebWorkers:H,transferStreams:q,onstart:K,onprogress:Y,onend:G,signal:X,encryptionStrength:J,extendedTimestamp:Q,msDosCompatible:$,internalFileAttributes:tt,externalFileAttributes:et,uid:rt,gid:nt,unixMode:at,setuid:st,setgid:it,sticky:ot,unixExternalUpper:ct,msdosAttributesRaw:lt,msdosAttributes:dt,useCompressionStream:ut,passThrough:ft,format:wt,codecURI:ht}=c,pt={lock:s,versionMadeBy:L,zip64:I,directory:!!_,executable:!!B,filenameUTF8:!0,rawFilename:O,commentUTF8:!0,rawComment:Z,ee:g,Se:x,ne:z,ae:A,se:F,re:D,rawExtraField:V,extendedTimestamp:Q,msDosCompatible:$,internalFileAttributes:tt,externalFileAttributes:et,diskNumberStart:a,uid:rt,gid:nt,unixMode:at,setuid:st,setgid:it,sticky:ot,unixExternalUpper:ct,msdosAttributesRaw:lt,msdosAttributes:dt};let{signature:mt,uncompressedSize:yt}=c,bt=0;ft||(yt=0);const{writable:St}=n;if(e){const a=$t(e.createReadable?e.createReadable():e.readable),s=e.size,i={options:{codecType:ye,level:C,rawPassword:M,password:v,encryptionStrength:J,zipCrypto:m&&N,passwordVerification:m&&N&&p>>8&r,signed:!ft,compressed:y&&!ft,encrypted:m&&!ft,useWebWorkers:H,useCompressionStream:ut,transferStreams:q,format:wt,codecURI:ht,compressionMethod:S},config:o,ut:{signal:X,size:s,onstart:K,onprogress:Y,onend:G}};try{const e=await He({readable:a,writable:St},i);if(bt=e.outputSize,n.size+=bt,ft||(yt=e.inputSize,mt=e.signature),!P&&bt>=t||!j&&yt>=t)throw Error(qa)}catch(t){throw t.outputSize!==E&&(n.size+=t.outputSize),t}}return(({signature:t,compressedSize:e,uncompressedSize:r,ze:n,Ae:a},{zip64:s,zipCrypto:i,dataDescriptor:o})=>{const{oe:c,encrypted:l}=n,{Ee:d,xe:u}=a;l&&!i||t===E||(Ss(c,10,t),o&&Ss(d,u,t)),s?o&&(gs(d,u+4,BigInt(e)),gs(d,u+12,BigInt(r))):(Ss(c,14,e),Ss(c,18,r),o&&(Ss(d,u+4,e),Ss(d,u+8,r)))})({signature:mt,compressedSize:bt,uncompressedSize:yt,ze:l,Ae:d},c),W&&await us(n,U),Object.assign(pt,{uncompressedSize:yt,compressedSize:bt,lastModDate:h,rawLastModDate:p,creationDate:k,lastAccessDate:T,encrypted:m,zipCrypto:N,size:u+bt,compressionMethod:S,version:b,ie:f,oe:w,signature:mt,fe:R,le:j,ce:P}),pt})(s,A,F,i,e.config,o),m||(z=!1),c.set(n,F),F.filename=n,m){if(await Promise.all([A.writable.getWriter().close(),y]),await U(),g=!0,R=l.size,await O(),F.diskNumberStart=os(l),F.offset=ds(e,l),h){const t=i.Fe;as(i,e.offset-cs(l)),F.size+=i.Fe-t}(({rawFilename:t,encrypted:e,zip64:r,Se:n,signature:a,compressedSize:s,uncompressedSize:i,le:o,ce:c},l,{dataDescriptor:d})=>{if(d||(e||Ss(l,14,a),c||Ss(l,18,s),o||Ss(l,22,i)),r&&n){const e=b+xs(t)+4;gs(l,e,BigInt(i)),gs(l,e+8,BigInt(s))}})(F,w.be,o),await us(l,w.ye),await(async(t,e,r)=>{const n=e.writable.getWriter();try{await t.pipeTo(new WritableStream({async write(t){var e;await n.ready,await n.write(t),e=xs(t),D+=e}}),{preventClose:!0,preventAbort:!0,signal:r})}finally{n.releaseLock()}})(A.readable,l,f),l.size+=A.size,g=!1}else F.diskNumberStart=v,F.offset=M;return e.offset+=F.size,F}catch(t){if(g||z){if(e.hasCorruptedEntries=!0,t)try{t.corruptedEntry=!0}catch{}e.offset+=l.size-R,m&&(e.offset+=D)}throw c.delete(n),t}finally{if(m&&e.$t--,S&&S(),y&&y(),m&&A&&A.dispose)try{await A.dispose()}catch{}}async function U(){e.Re=!0;const{De:t}=e;e.De=new Promise(t=>y=()=>{e.Re=!1,t()}),await t}async function O(){ls(l,xs(w.ye))&&await l.closeDisk()}})(i,o,c,{ze:m,Ae:y,Fe:z},l)}catch(t){throw i.files.delete(o),t}return Object.assign(R,{name:o,comment:w,extraField:z}),new On(R)})(l,i,o,c),d.add(w),await w}catch(t){throw z&&l.Xt.delete(i),t}finally{d.delete(w);const t=ts.shift();t?t():$a--}}remove(t){const{Xt:e,files:r}=this;if("string"==typeof t&&(t=r.get(t)),t&&t.filename!==E){const{filename:n}=t;if(e.has(n)&&r.has(n))return e.delete(n),r.delete(n),!0}return!1}async close(r=A,n={}){const{Qt:a,writer:s}=this,{writable:u}=s;if(xs(r)>e)throw Error(ja);for(;a.size;)await Promise.allSettled(Array.from(a));return await(async(r,n,a)=>{const s=(r=>{let n=0;for(const[,a]of r){const{rawFilename:r,re:s,rawComment:i,ae:o,se:c,rawExtraField:l,extendedTimestamp:d,fe:u,lastModDate:w,le:h,ce:p,uncompressedSize:m,compressedSize:y}=a,b=a.offset>=t,S=a.diskNumberStart>=e;let g,E;if(b||S||h||p){const t=4+(h?8:0)+(p?8:0)+(b?8:0)+(S?4:0),e=is(t);e.uint16(1),e.uint16(t-4),h&&e.pe(m),p&&e.pe(y),b&&e.pe(a.offset),S&&e.uint32(a.diskNumberStart),g=e.array}else g=A;a.ee=g,a.de=b,a.ue=S;const x=ws(w);if(d&&hs(x)){const t=is(9);t.uint16(f),t.uint16(5),t.uint8(u),t.uint32(x),E=t.array}else E=A;a.ne=E;const z=xs(g,s,o,c,E,l);if(z>e)throw Error(Za);n+=46+xs(r,i)+z}return n})(r.files),u=await(async(r,n,a)=>{const{files:s,writer:o}=r,c=new Uint8Array(n);await Hr(o);let l=0,d=0,u=os(o),f=cs(o);for(const[r,n]of Array.from(s.values()).entries()){const{offset:w,rawFilename:h,ee:p,re:m,ne:y,ae:b,se:S,rawExtraField:g,rawComment:E,versionMadeBy:x,ie:z,oe:R,le:A,ce:F,ue:D,de:U,internalFileAttributes:O,externalFileAttributes:T,diskNumberStart:k,uncompressedSize:v,compressedSize:M}=n,C=xs(p,m,y,b,S,g),I=46+xs(h,E)+C;ls(o,l+I-d)&&(await us(o,c.slice(d,l)),d=l,await o.closeDisk()),0==r&&(u=os(o),f=cs(o)),A||Ss(R,18,v),F||Ss(R,14,M),(U||D)&&45>n.version&&bs(R,0,45);const j=is(I);if(j.uint32(i),j.uint16(x),j.bytes(z.subarray(0,24)),j.uint16(C),j.uint16(xs(E)),j.uint16(D?e:k),j.uint16(O),j.uint32(T),j.uint32(U?t:w),j.bytes(h),j.bytes(p),j.bytes(m),j.bytes(y),j.bytes(b),j.bytes(S),j.bytes(g),j.bytes(E),Es(c,j.array,l),l+=I,a.onprogress)try{await a.onprogress(r+1,s.size,new On(n))}catch{}}return await us(o,d?c.slice(d):c),{diskNumber:u,diskOffset:f}})(r,s,a);await(async(r,n,a,s)=>{const{writer:i}=r,{Ue:u}=s;let{Oe:f}=s,w=r.files.size,h=u.diskNumber,p=ds(r,u),m=os(i);ls(i,d)&&m++;let y=ms(r,a,hn);if(!(t>p&&t>f&&e>w&&e>m)){if(!1===y)throw Error(qa);y=!0}const b=xs(n);if(b>e)throw Error(ja);const S=is(y?98:d);ls(i,xs(S.array)+b)&&await i.closeDisk(),m=os(i),y&&(S.uint32(c),S.pe(44),S.uint16(45),S.uint16(45),S.uint32(m),S.uint32(h),S.pe(w),S.pe(w),S.pe(f),S.pe(p),S.uint32(l),S.uint32(m),S.pe(BigInt(ds(r,i))+BigInt(f)),S.uint32(m+1),ms(r,a,"supportZip64SplitFile",!0)&&(m=e,h=e),w=e,p=t,f=t),S.uint32(o),S.uint16(m),S.uint16(h),S.uint16(w),S.uint16(w),S.uint32(f),S.uint32(p),S.uint16(b),await us(i,S.array),b&&await us(i,n)})(r,n,a,{Ue:u,Oe:s})})(this,r,n),ms(this,n,Nn)||await u.getWriter().close(),s.getData?s.getData():u}}class rs{constructor(t={}){const{readable:e,writable:r}=new TransformStream;this.readable=e,this.zipWriter=new es(r,t),this.Qt=new Set}transform(t){const e=this.zipWriter;let r;const{readable:n,writable:a}=new TransformStream({start(t){r=t},flush:()=>{(async()=>{try{await e.close()}catch(t){try{await e.writer.writable.abort(t)}catch{}}})()}});return ns(this,this.zipWriter.add(t,n),t=>r.error(t)),{readable:this.readable,writable:a}}writable(t){let e;const{readable:r,writable:n}=new TransformStream({start(t){e=t}});return ns(this,this.zipWriter.add(t,r),t=>e.error(t)),n}async close(t,e={}){return await Promise.all(Array.from(this.Qt)),this.zipWriter.close(t,e)}}function ns(t,e,r){t.Qt.add(e),e.catch(t=>{try{r(t)}catch{}})}function as(t,e){const{ze:r}=t;let{ye:n,extraFieldLength:a}=r,s=64-(e+xs(n))%64;4>s&&(s+=64);const i=new Uint8Array(s),o=ot(i);bs(o,0,6534),bs(o,2,s-4);const c=n;r.ye=n=new Uint8Array(xs(c)+s),Es(n,c),Es(n,i,xs(c));const l=ot(n);bs(l,28,a+s),r.be=l,t.Fe+=s}function ss(t){if(t===E)return A;{const e=new Uint8Array(4);ot(e).setUint32(0,t,!0);let r=4;for(;r>1&&0===e[r-1];)r--;return e.subarray(0,r)}}function is(t){const e=new Uint8Array(t),r=ot(e);let n=0;return{array:e,uint8:t=>{((t,e,r)=>{t.setUint8(e,r)})(r,n,t),n+=1},uint16:t=>{bs(r,n,t),n+=2},uint32:t=>{Ss(r,n,t),n+=4},pe:t=>{gs(r,n,BigInt(t)),n+=8},bytes:t=>{Es(e,t,n),n+=xs(t)},me:t=>n+=t}}function os(t){const{diskNumber:e=0}=t;return e}function cs(t){const{diskOffset:e=0}=t;return e}function ls(t,e){const{availableSize:r=x}=t;return e>r}function ds(t,{diskNumber:e=0,diskOffset:r=0}){return t.offset-r-(e?t.Jt:0)}async function us(t,e){const{writable:r}=t,n=r.getWriter();try{await n.ready,t.size+=xs(e),await n.write(e)}finally{n.releaseLock()}}function fs(t){if(t)return(BigInt(t.getTime())+BigInt(116444736e5))*BigInt(1e4)}function ws(t){return Math.floor(t.getTime()/1e3)}function hs(t){return t>=Va&&Ha>=t}function ps(t){return Math.min(Ha,Math.max(Va,t))}function ms(t,e,r,n){const a=e[r]===E?t.options[r]:e[r];return a===E?n:a}function ys(t){return t+5*(Math.floor(t/16383)+1)}function bs(t,e,r){t.setUint16(e,r,!0)}function Ss(t,e,r){t.setUint32(e,r,!0)}function gs(t,e,r){t.setBigUint64(e,r,!0)}function Es(t,e,r){t.set(e,r)}function xs(...t){let e=0;return t.forEach(t=>t&&(e+=t.length)),e}function zs({version:e,bitFlag:r,compressionMethod:n,uncompressedSize:a,compressedSize:s,lastModDate:i,rawLastModDate:o,rawFilename:c,ce:l,le:d,extraFieldLength:u}){const f=is(26),w=f.array,h=ot(w);if(f.uint16(e),f.uint16(r),f.uint16(n),o===E){const t=new Uint32Array(1),e=ot(t);bs(e,0,(i.getHours()<<6|i.getMinutes())<<5|i.getSeconds()/2),bs(e,2,(i.getFullYear()-1980<<4|i.getMonth()+1)<<5|i.getDate()),o=t[0]}return f.uint32(o),f.me(4),l||s!==E?f.uint32(l?t:s):f.me(4),d||a!==E?f.uint32(d?t:a):f.me(4),f.uint16(xs(c)),f.uint16(u),{ie:w,oe:h,rawLastModDate:o}}function Rs(t,e,r,n,a){let s=0;return e&&(s|=w),r&&(s|=8),8!=a&&9!=a||(0>t||t>3||(s|=6),t>3&&5>=t&&(s|=4),9==t&&(s|=2)),n&&(s|=1),s}function As(){return"application/octet-stream"}const Fs=1048576,Ds=".zip.js-temp";function Us(t={}){const{thresholdBytes:e=Fs,directoryName:r=Ds,getDirectory:n=()=>navigator.storage.getDirectory()}=t;let a;function s(){return a||(a=Promise.resolve(n()).then(t=>t.getDirectoryHandle(r,{create:!0}))),a}return()=>{const t=[];let r,n,a,i,o=0,c=!1;const l=new WritableStream({async write(i){c?await a.write(i):(t.push(i),o+=i.length,o>e&&await(async()=>{const e=await s();r=crypto.randomUUID(),n=await e.getFileHandle(r,{create:!0}),a=(await n.createWritable()).getWriter(),c=!0;for(const e of t)await a.write(e);t.length=0})())},async close(){a&&(await a.close(),a=null)}});let d=0;return{writable:l,readable:new ReadableStream({async pull(e){if(c){if(!i){const t=await n.getFile();i=t.stream().getReader()}const{value:t,done:r}=await i.read();r?e.close():e.enqueue(t)}else d<t.length?e.enqueue(t[d++]):e.close()},async cancel(t){i&&await i.cancel(t)}},{highWaterMark:0}),dispose:async()=>{if(a){try{await a.close()}catch{}a=null}if(r){try{const t=await s();await t.removeEntry(r)}catch{}n=r=null}t.length=0}}}}const Os=1048576;function Ts(t={}){const{thresholdBytes:e=Os}=t;return()=>{const t=[];let r,n,a,s=0,i=!1;const o=new WritableStream({async write(a){i?await r.write(a):(t.push(a),s+=a.length,s>e&&await(async()=>{const e=new TransformStream;n=new Response(e.readable).blob(),r=e.writable.getWriter(),i=!0;for(const e of t)await r.write(e);t.length=0})())},async close(){r&&(await r.close(),r=null)}});let c=0;return{writable:o,readable:new ReadableStream({async pull(e){if(i){if(!a){const t=await n;a=t.stream().getReader()}const{value:t,done:r}=await a.read();r?e.close():e.enqueue(t)}else c<t.length?e.enqueue(t[c++]):e.close()},async cancel(t){a&&await a.cancel(t)}},{highWaterMark:0}),dispose:async()=>{if(r){try{await r.abort()}catch{}r=null}n&&(n.catch(()=>{}),n=null),t.length=0}}}}const ks=1048576,vs=".zip.js-temp";function Ms(t={}){const{thresholdBytes:e=ks,directoryName:r=vs,getDirectory:n}=t;if(!(n||"undefined"!=typeof FileSystemFileHandle&&FileSystemFileHandle.prototype.createSyncAccessHandle))throw Error("createSyncAccessHandle is only available in dedicated workers");const a=n||(()=>navigator.storage.getDirectory());let s;function i(){return s||(s=Promise.resolve(a()).then(t=>t.getDirectoryHandle(r,{create:!0}))),s}return()=>{const t=[];let r,n,a=0,s=!1,o=0,c=0;const l=new WritableStream({async write(c){s?(n.write(c,{at:o}),o+=c.length):(t.push(c),a+=c.length,a>e&&await(async()=>{const e=await i();r=crypto.randomUUID();const a=await e.getFileHandle(r,{create:!0});n=await a.createSyncAccessHandle(),s=!0;for(const e of t)n.write(e,{at:o}),o+=e.length;t.length=0})())},close(){n&&n.flush()}});let d=0;return{writable:l,readable:new ReadableStream({pull(e){if(s){const t=o-c;if(0>=t)return void e.close();const r=new Uint8Array(Math.min(524288,t)),a=n.read(r,{at:c});a?(c+=a,e.enqueue(r.subarray(0,a))):e.close()}else d<t.length?e.enqueue(t[d++]):e.close()}},{highWaterMark:0}),dispose:async()=>{if(n){try{n.close()}catch{}n=null}if(r){try{const t=await i();await t.removeEntry(r)}catch{}r=null}t.length=0}}}}try{M({baseURI:import.meta.url})}catch{}let Cs,Is,js,Ps,Ns;function Ws(t,e,r={}){if(!Cs){const t=Error("WASM module not loaded");throw t.cause=Ns,t}const n="number"==typeof r.level?r.level:-1,a="number"==typeof r.outBuffer?r.outBuffer:65536,s="number"==typeof r.inBufferSize?r.inBufferSize:65536;return new TransformStream({start(){try{let r;if(this.Te=Is(a),this.in=Is(s),this.inBufferSize=s,!this.Te||!this.in)throw Error("allocation failed");if(this.ke=new Uint8Array(a),t?(this.ve=Cs.deflate_process,this.Me=Cs.deflate_last_consumed,this.Ce=Cs.deflate_end,this.Ie=Cs.deflate_new(),r="gzip"===e?Cs.deflate_init_gzip(this.Ie,n):"deflate-raw"===e?Cs.deflate_init_raw(this.Ie,n):Cs.deflate_init(this.Ie,n)):"deflate64-raw"===e?(this.ve=Cs.inflate9_process,this.Me=Cs.inflate9_last_consumed,this.Ce=Cs.inflate9_end,this.Ie=Cs.inflate9_new(),r=Cs.inflate9_init_raw(this.Ie)):(this.ve=Cs.inflate_process,this.Me=Cs.inflate_last_consumed,this.Ce=Cs.inflate_end,this.Ie=Cs.inflate_new(),r="deflate-raw"===e?Cs.inflate_init_raw(this.Ie):"gzip"===e?Cs.inflate_init_gzip(this.Ie):Cs.inflate_init(this.Ie)),0!==r)throw Error("init failed:"+r)}catch(t){throw i(this),t}},transform(e,r){try{const n=e,s=new Uint8Array(Ps.buffer),i=this.ve,o=this.Me,c=this.Te,l=this.ke;let d=0;for(;d<n.length;){const e=Math.min(n.length-d,32768);if((!this.in||this.inBufferSize<e)&&(this.in&&js&&(js(this.in),this.in=0),this.in=Is(e),this.inBufferSize=e,!this.in))throw Error("allocation failed");s.set(n.subarray(d,d+e),this.in);const u=i(this.Ie,this.in,e,c,a,0),f=16777215&u;if(f&&(l.set(s.subarray(c,c+f),0),r.enqueue(l.slice(0,f))),!t){const t=u>>24&255,e=128&t?t-256:t;if(0>e)throw Error("process error:"+e)}const w=o(this.Ie);if(0===w)break;d+=w}}catch(t){i(this),r.error(t)}},flush(e){try{const r=new Uint8Array(Ps.buffer),n=this.ve,s=this.Te,i=this.ke;for(;;){const o=n(this.Ie,0,0,s,a,4),c=16777215&o,l=o>>24&255;if(!t){const t=128&l?l-256:l;if(0>t)throw Error("process error:"+t)}if(c&&(i.set(r.subarray(s,s+c),0),e.enqueue(i.slice(0,c))),1===l||0===c)break}}catch(t){e.error(t)}finally{const t=i(this);0!==t&&e.error(Error("end error:"+t))}},cancel(){i(this)}});function i(t){let e=0;return t.Ie&&t.Ce&&(e=t.Ce(t.Ie)),t.Ie=0,t.in&&js&&js(t.in),t.in=0,t.Te&&js&&js(t.Te),t.Te=0,e}}class _s{constructor(t="deflate",e){return Ws(!0,t,e)}}class Bs{constructor(t="deflate",e){return Ws(!1,t,e)}}_s.Dt=!0,Bs.Dt=!0;let Ls,Zs=!1;function Vs(){Ls=null,(async()=>{await Promise.allSettled(_e.map(t=>(Xe(t),t.terminate()))),ze=E})(),Zs=!1,Cs=Is=js=Ps=Ns=null}(({je:t})=>{Ue=t})({je:t=>{if(!Ls){let{wasmURI:e}=t;typeof e==R&&(e=e()),Ls=(async(t,{baseURI:e})=>{if(!Zs)try{await(async(t,e)=>{let r,n;try{try{n=new URL(t,e)}catch{}const a=await fetch(n);r=await a.arrayBuffer()}catch(e){if(!t.startsWith("data:application/wasm;base64,"))throw e;r=(t=>{const e=t.split(",")[1],r=atob(e),n=r.length,a=new Uint8Array(n);for(let t=0;n>t;++t)a[t]=r.charCodeAt(t);return a.buffer})(t)}(t=>{if(Cs=t,({malloc:Is,free:js,memory:Ps}=Cs),"function"!=typeof Is||"function"!=typeof js||!Ps)throw Cs=Is=js=Ps=null,Error("Invalid WASM module")})((await WebAssembly.instantiate(r)).instance.exports)})(t,e),Zs=!0}catch(t){throw(t=>{Ns=t})(t),t}})(e,t).catch(t=>{throw Ls=null,t})}return Ls}}),M({CompressionStreamZlib:_s,DecompressionStreamZlib:Bs}),M({workerURI:new URL("./zip-web-worker.js",import.meta.url).href,wasmURI:new URL("./zip-module.wasm",import.meta.url).href});const Hs="Entry filename already exists";class qs{constructor(t,e,r,n){const a=this;if(t.root&&n&&n.getChildByName(e))throw Error(Hs);r||(r={}),Object.assign(a,{fs:t,name:e,data:r.data,options:r.options,id:t.Pe++,parent:n,children:[],uncompressedSize:r.uncompressedSize||0,passThrough:r.passThrough}),!n&&t.root||(t.entries[a.id]=a),n&&a.parent.children.push(a)}moveTo(t){this.fs.move(this,t)}getFullname(){return this.getRelativeName()}getRelativeName(t=this.fs.root){let e=this.name,r=this.parent;for(;r&&r!=t;)e=(r.name?r.name+"/":"")+e,r=r.parent;return e}isDescendantOf(t){let e=this.parent;for(;e&&e.id!=t.id;)e=e.parent;return!!e}rename(t){const e=this.parent;if(e&&e.getChildByName(t))throw Error(Hs);this.name=t}}class Ks extends qs{constructor(t,e,r,n){super(t,e,r,n);const a=this;a.Reader=r.Reader,a.Writer=r.Writer,r.getData&&(a.getData=r.getData)}clone(){return new Ks(this.fs,this.name,this)}async getData(t,e={}){const r=this;if(!t||t.constructor==r.Writer&&r.data)return r.data;{const n=r.reader=$s(r.Reader,r.data,e),a=r.data?r.data.uncompressedSize:n.size;await Promise.all([Hr(n),Hr(t,a)]);const{readable:s}=n;return r.uncompressedSize=n.size,await s.pipeTo(t.writable),t.getData?t.getData():t.writable}}isPasswordProtected(){return!(!this.data||!this.data.encrypted)}async checkPassword(t,e={}){const r=this;if(!r.isPasswordProtected())return!0;try{return await r.data.getData(null,Object.assign({},e,{password:t,checkPasswordOnly:!0})),!0}catch(t){if(t.message==wt)return!1;throw t}}getText(t,e){return this.getData(new Sr(t),e)}getBlob(t,e){return this.getData(new yr(t),e)}getData64URI(t,e){return this.getData(new wr(t),e)}getUint8Array(t){return this.getData(new _r,t)}getWritable(t=new WritableStream,e){return this.getData({writable:t},e)}async getArrayBuffer(t){return it(await this.getUint8Array(t)).buffer}replaceBlob(t){Object.assign(this,{data:t,Reader:mr,Writer:yr,reader:null})}replaceText(t){Object.assign(this,{data:t,Reader:br,Writer:Sr,reader:null})}replaceData64URI(t){Object.assign(this,{data:t,Reader:fr,Writer:wr,reader:null})}replaceUint8Array(t){Object.assign(this,{data:t,Reader:Wr,Writer:_r,reader:null})}replaceReadable(t){Object.assign(this,{data:null,Reader:Js(t),Writer:null,reader:null})}}class Ys extends qs{constructor(t,e,r,n){super(t,e,r,n),this.directory=!0}clone(t){const e=this,r=new Ys(e.fs,e.name,e);return t&&(r.children=e.children.map(e=>{const n=e.clone(t);return n.parent=r,n})),r}addDirectory(t,e){return si(this,t,{options:e},!0)}addText(t,e,r={}){return si(this,t,{data:e,Reader:br,Writer:Sr,options:r,uncompressedSize:e.length})}addBlob(t,e,r={}){return si(this,t,{data:e,Reader:mr,Writer:yr,options:r,uncompressedSize:e.size})}addData64URI(t,e,r={}){let n=e.length;for(;"="==e.charAt(n-1);)n--;const a=e.indexOf(",")+1;return si(this,t,{data:e,Reader:fr,Writer:wr,options:r,uncompressedSize:Math.floor(.75*(n-a))})}addUint8Array(t,e,r={}){return si(this,t,{data:e,Reader:Wr,Writer:_r,options:r,uncompressedSize:e.length})}addHttpContent(t,e,r={}){return si(this,t,{data:e,Reader:class extends Pr{constructor(t){super(t,r)}},options:r})}addReadable(t,e,r={}){return si(this,t,{Reader:Js(e),options:r})}addFileSystemEntry(t,e={}){return ri(this,t,e)}addFileSystemHandle(t,e={}){return ri(this,t,e)}addFile(t,e={}){return(e=Object.assign({},e)).lastModDate||(e.lastModDate=new Date(t.lastModified)),si(this,t.name,{data:t,Reader:()=>({readable:t.stream(),size:t.size}),options:e,uncompressedSize:t.size})}Ne(t,e){return si(this,t,e)}importBlob(t,e){return this.importZip(new mr(t),e)}importData64URI(t,e){return this.importZip(new fr(t),e)}importUint8Array(t,e){return this.importZip(new Wr(t),e)}importHttpContent(t,e){return this.importZip(new Pr(t,e),e)}importReadable(t,e){return this.importZip({readable:t},e)}exportBlob(t={}){return this.exportZip(new yr(t.mimeType||"application/zip"),t)}exportData64URI(t={}){return this.exportZip(new wr(t.mimeType||"application/zip"),t)}exportUint8Array(t={}){return this.exportZip(new _r,t)}async exportWritable(t=new WritableStream,e={}){return await this.exportZip({writable:t},e),t}exportFileSystemHandle(t,e={}){return(async(t,e,r)=>{const n=Xs([t],"uncompressedSize"),a=new Map;return await s(t,e),e;async function s(t,e){if(r.concurrent){const r=(await Promise.allSettled(t.children.map(t=>i(t,e)))).find(t=>"rejected"==t.status);if(r)throw r.reason}else for(const r of t.children)await i(r,e)}async function i(t,e){try{if(t.directory){const r=await e.getDirectoryHandle(t.name,{create:!0});await s(t,r)}else{const s=await e.getFileHandle(t.name,{create:!0}),i=await s.createWritable();await t.getData({writable:i},Object.assign({},r,{onprogress:async e=>{if(r.onprogress){a.set(t.id,e);try{await r.onprogress(Array.from(a.values()).reduce((t,e)=>t+e,0),n)}catch{}}}}))}}catch(e){throw Error(e.message+(t?" ("+t.name+")":""),{cause:e})}}})(this,t,e)}async importZip(t,e={}){await Hr(t);const r=new oa(t,e),n=[],a=await r.getEntries();for(const t of a){let r=this;try{const a=t.filename.split("/"),s=a.pop();if(a.forEach(t=>{const e=r;if(r=r.getChildByName(t),r){if(!r.directory)throw Error(Hs)}else r=new Ys(this.fs,t,{data:null},e),n.push(r)}),t.directory){let e=r;if(s)if(e=r.getChildByName(s),e){if(!e.directory)throw Error(Hs)}else e=new Ys(this.fs,s,{data:null},r),n.push(e);e==this||e.data||(e.data=t)}else n.push(si(r,s,{data:t,Reader:Qs(Object.assign({},e)),uncompressedSize:t.uncompressedSize,passThrough:e.passThrough}))}catch(e){try{e.cause={entry:t}}catch{}throw e}}return n}async exportZip(t,e={}){const r=this;(e=Object.assign({},e)).bufferedWrite===E&&(e.bufferedWrite=!0);const[n]=await Promise.all([ti(r,e.readerOptions),Hr(t)]),a=new es(t,e);return await(async(t,e,r,n,a)=>{const s=e,i=new Map;await async function t(e,o){async function c(o){const c=n.relativePath?o.getRelativeName(s):o.getFullname(),l=o.options||{};let d={};if(o.data instanceof On){const{externalFileAttributes:t,versionMadeBy:e,comment:r,lastModDate:n,creationDate:a,lastAccessDate:s,uncompressedSize:i,encrypted:c,zipCrypto:l,signature:u,compressionMethod:f,extraFieldAES:w}=o.data;if(d={externalFileAttributes:t,versionMadeBy:e,comment:r,lastModDate:n,creationDate:a,lastAccessDate:s},o.passThrough){let t,e;0===f&&(t=0),w&&(e=w.strength),d=Object.assign(d,{passThrough:!0,encrypted:c,zipCrypto:l,signature:u,uncompressedSize:i,level:t,encryptionStrength:e,compressionMethod:f})}}await e.add(c,a.get(o),Object.assign({},n,d,l,{directory:o.directory,onprogress:async t=>{if(n.onprogress){i.set(c,t);try{await n.onprogress(Array.from(i.values()).reduce((t,e)=>t+e),r)}catch{}}}})),await t(e,o)}await(async()=>{if(n.bufferedWrite){const t=(await Promise.allSettled(o.children.map(c))).find(t=>"rejected"==t.status);if(t)throw t.reason}else for(const t of o.children)await c(t)})()}(t,e)})(a,r,Xs([r],"uncompressedSize"),e,n),await a.close(),t.getData?t.getData():t.writable}getChildByName(t){const e=this.children;for(let r=0;r<e.length;r++){const n=e[r];if(n.name==t)return n}}isPasswordProtected(){const t=this.children;for(let e=0;e<t.length;e++)if(t[e].isPasswordProtected())return!0;return!1}async checkPassword(t,e={}){const r=this.children;return!(await Promise.all(r.map(r=>r.checkPassword(t,e)))).includes(!1)}}const Gs={FS:class{constructor(){ai(this)}get children(){return this.root.children}remove(t){ei(t);const e=[t];for(;e.length;){const t=e.pop();this.entries[t.id]=null;for(const r of t.children)e.push(r)}t.parent=E}move(t,e){if(t==this.root)throw Error("Root directory cannot be moved");if(!e.directory)throw Error("Target entry is not a directory");if(e.isDescendantOf(t))throw Error("Entry is a ancestor of target entry");if(t!=e){const r=e.getChildByName(t.name);if(r){if(r!=t)throw Error(Hs)}else ei(t),t.parent=e,e.children.push(t),((t,e)=>{const r=[e];for(;r.length;){const e=r.pop();t.entries[e.id]=e;for(const t of e.children)r.push(t)}})(this,t)}}find(t){const e=t.split("/");let r=this.root;for(let t=0;r&&t<e.length;t++)r=r.getChildByName(e[t]);return r||(r=this.entries.find(e=>e&&(e==this.root||e.isDescendantOf(this.root))&&e.getRelativeName()==t)),r}getById(t){return this.entries[t]}getChildByName(t){return this.root.getChildByName(t)}addDirectory(t,e){return this.root.addDirectory(t,e)}addText(t,e,r){return this.root.addText(t,e,r)}addBlob(t,e,r){return this.root.addBlob(t,e,r)}addData64URI(t,e,r){return this.root.addData64URI(t,e,r)}addUint8Array(t,e,r){return this.root.addUint8Array(t,e,r)}addHttpContent(t,e,r){return this.root.addHttpContent(t,e,r)}addReadable(t,e,r){return this.root.addReadable(t,e,r)}addFileSystemEntry(t,e){return this.root.addFileSystemEntry(t,e)}addFileSystemHandle(t,e){return this.root.addFileSystemHandle(t,e)}addFile(t,e){return this.root.addFile(t,e)}Ne(t,e){return this.root.Ne(t,e)}importBlob(t,e){return ai(this),this.root.importBlob(t,e)}importData64URI(t,e){return ai(this),this.root.importData64URI(t,e)}importUint8Array(t,e){return ai(this),this.root.importUint8Array(t,e)}importHttpContent(t,e){return ai(this),this.root.importHttpContent(t,e)}importReadable(t,e){return ai(this),this.root.importReadable(t,e)}importZip(t,e){return ai(this),this.root.importZip(t,e)}exportBlob(t){return this.root.exportBlob(t)}exportData64URI(t){return this.root.exportData64URI(t)}exportUint8Array(t){return this.root.exportUint8Array(t)}exportWritable(t,e){return this.root.exportWritable(t,e)}exportFileSystemHandle(t,e){return this.root.exportFileSystemHandle(t,e)}exportZip(t,e){return this.root.exportZip(t,e)}isPasswordProtected(){return this.root.isPasswordProtected()}checkPassword(t,e){return this.root.checkPassword(t,e)}},ZipDirectoryEntry:Ys,ZipFileEntry:Ks};function Xs(t,e){let r=0;const n=Array.from(t);for(;n.length;){const t=n.pop();r+=t[e]||0;for(const e of t.children)n.push(e)}return r}function Js(t){let e;return()=>{if(e)throw Error("Readable stream already consumed");return e=!0,{readable:t}}}function Qs(t){return class extends dr{constructor(t,e={}){super(),this.entry=t,this.options=e}async init(){const e=this;e.size=e.entry.uncompressedSize;const r=await e.entry.getData(new yr,Object.assign({},t,e.options));e.data=r,e.We=new mr(r),super.init()}readUint8Array(t,e){return this.We.readUint8Array(t,e)}}}function $s(t,e,r){return t.prototype?new t(e,r):t(e,r)}async function ti(t,e){const r=[],n=[t],a=new Map;for(;n.length;){const t=n.pop();for(const e of t.children)e.directory?n.push(e):r.push(e)}return await Promise.all(r.map(async t=>{const r=t.reader=$s(t.Reader,t.data,e);a.set(t,r);try{await Hr(r)}catch(e){try{e.entryId=t.id,e.cause={entry:t}}catch{}throw e}r.size!==E&&(t.uncompressedSize=r.size)})),a}function ei(t){if(t.parent){const e=t.parent.children;e.forEach((r,n)=>{r.id==t.id&&e.splice(n,1)})}}function ri(t,e,r){return async function t(e,n,a){if(n)try{if((n.isFile||n.isDirectory)&&(n=await ni(n)),"file"==n.kind){const t=await n.getFile();a.push(e.Ne(t.name,{Reader:()=>({readable:t.stream(),size:t.size}),options:Object.assign({},{lastModDate:new Date(t.lastModified)},r),uncompressedSize:t.size}))}else if("directory"==n.kind){const r=e.addDirectory(n.name);a.push(r);for await(const e of n.values())await t(r,e,a)}}catch(t){const e=t.message+(n?" ("+n.name+")":"");throw Error(e,{cause:t})}return a}(t,e,[])}async function ni(t){const e={name:t.name};if(t.isFile&&(e.kind="file",e.getFile=()=>new Promise((e,r)=>t.file(e,r))),t.isDirectory){e.kind="directory";const r=await(async t=>{const e=[];function r(t,n,a){t.readEntries(async s=>{if(s.length){for(const t of s)e.push(await ni(t));r(t,n,a)}else n(e)},a)}return await new Promise((e,n)=>r(t.createReader(),e,n)),{[Symbol.iterator](){let t=0;return{next(){const r={value:e[t],done:t==e.length};return t++,r}}}}})(t);e.values=()=>r}return e}function ai(t){t.entries=[],t.Pe=0,t.root=new Ys(t)}function si(t,e,r,n){if(t.directory)return n?new Ys(t.fs,e,r,t):new Ks(t.fs,e,r,t);throw Error("Parent entry is not a directory")}export{mr as BlobReader,yr as BlobWriter,fr as Data64URIReader,wr as Data64URIWriter,ea as ERR_AMBIGUOUS_ARCHIVE,Vn as ERR_BAD_FORMAT,Kn as ERR_CENTRAL_DIRECTORY_NOT_FOUND,Ia as ERR_DUPLICATED_NAME,Xn as ERR_ENCRYPTED,ra as ERR_ENCRYPTED_CENTRAL_DIRECTORY,qn as ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,Hn as ERR_EOCDR_NOT_FOUND,Gn as ERR_EXTRAFIELD_ZIP64_NOT_FOUND,Qe as ERR_HTTP_RANGE,$e as ERR_HTTP_RESOURCE_CHANGED,I as ERR_INVALID_CODEC_DEFINITION,P as ERR_INVALID_CODEC_MODULE,ja as ERR_INVALID_COMMENT,re as ERR_INVALID_COMPRESSED_DATA,_a as ERR_INVALID_ENCRYPTION_STRENGTH,Pa as ERR_INVALID_ENTRY_COMMENT,Na as ERR_INVALID_ENTRY_NAME,Za as ERR_INVALID_EXTRAFIELD_DATA,La as ERR_INVALID_EXTRAFIELD_TYPE,wt as ERR_INVALID_PASSWORD,ht as ERR_INVALID_SIGNATURE,ee as ERR_INVALID_UNCOMPRESSED_SIZE,Wa as ERR_INVALID_VERSION,tr as ERR_ITERATOR_COMPLETED_TOO_SOON,Yn as ERR_LOCAL_FILE_HEADER_NOT_FOUND,ta as ERR_OVERLAPPING_ENTRY,j as ERR_RESERVED_COMPRESSION_METHOD,$n as ERR_SPLIT_ZIP_FILE,Ya as ERR_UNDEFINED_READER,Ka as ERR_UNDEFINED_UNCOMPRESSED_SIZE,Qn as ERR_UNSUPPORTED_COMPRESSION,Jn as ERR_UNSUPPORTED_ENCRYPTION,Ba as ERR_UNSUPPORTED_ENCRYPTION_USDZ,qa as ERR_UNSUPPORTED_FORMAT,er as ERR_WRITER_NOT_INITIALIZED,Ga as ERR_ZIP_NOT_EMPTY,Nr as HttpRangeReader,Pr as HttpReader,dr as Reader,Br as SplitDataReader,Lr as SplitDataWriter,br as TextReader,Sr as TextWriter,Wr as Uint8ArrayReader,_r as Uint8ArrayWriter,ur as Writer,oa as ZipReader,ca as ZipReaderStream,es as ZipWriter,rs as ZipWriterStream,v as configure,Ts as createBlobTempStream,Us as createOPFSTempStream,Ms as createSyncAccessHandleTempStream,Gs as fs,As as getMimeType,L as registerCodec,C as resetConfiguration,Vs as terminateWorkers,Z as unregisterCodec};
|
package/dist/zip-fs-core.js
CHANGED
|
@@ -2809,6 +2809,7 @@
|
|
|
2809
2809
|
const FORMAT_GZIP = "gzip";
|
|
2810
2810
|
const GZIP_HEADER_LENGTH = 10;
|
|
2811
2811
|
const GZIP_TRAILER_LENGTH = 8;
|
|
2812
|
+
const GZIP_HEADER_BYTES = [0x1f, 0x8b, 0x08];
|
|
2812
2813
|
|
|
2813
2814
|
class DeflateStream extends TransformStream {
|
|
2814
2815
|
|
|
@@ -2833,7 +2834,18 @@
|
|
|
2833
2834
|
readable = pipeThroughBackpressured(readable, new CompressionStream(FORMAT_GZIP));
|
|
2834
2835
|
readable = pipeThrough(readable, gzipCrc32Stream);
|
|
2835
2836
|
} else {
|
|
2836
|
-
|
|
2837
|
+
try {
|
|
2838
|
+
readable = pipeThroughCompressionStream(readable, useCompressionStream, { level, chunkSize }, CompressionStream, CompressionStreamZlib);
|
|
2839
|
+
} catch (error) {
|
|
2840
|
+
let gzipStream;
|
|
2841
|
+
try {
|
|
2842
|
+
gzipStream = new CompressionStream(FORMAT_GZIP);
|
|
2843
|
+
} catch {
|
|
2844
|
+
throw error;
|
|
2845
|
+
}
|
|
2846
|
+
readable = pipeThroughBackpressured(readable, gzipStream);
|
|
2847
|
+
readable = pipeThrough(readable, new GzipToRawDeflateStream());
|
|
2848
|
+
}
|
|
2837
2849
|
}
|
|
2838
2850
|
}
|
|
2839
2851
|
if (encrypted) {
|
|
@@ -2898,6 +2910,29 @@
|
|
|
2898
2910
|
}
|
|
2899
2911
|
}
|
|
2900
2912
|
|
|
2913
|
+
class RawDeflateToGzipStream extends TransformStream {
|
|
2914
|
+
|
|
2915
|
+
constructor(signature, uncompressedSize) {
|
|
2916
|
+
super({
|
|
2917
|
+
start(controller) {
|
|
2918
|
+
const header = new Uint8Array(GZIP_HEADER_LENGTH);
|
|
2919
|
+
header.set(GZIP_HEADER_BYTES);
|
|
2920
|
+
controller.enqueue(header);
|
|
2921
|
+
},
|
|
2922
|
+
transform(chunk, controller) {
|
|
2923
|
+
controller.enqueue(chunk);
|
|
2924
|
+
},
|
|
2925
|
+
flush(controller) {
|
|
2926
|
+
const trailer = new Uint8Array(GZIP_TRAILER_LENGTH);
|
|
2927
|
+
const dataView = getDataView(trailer);
|
|
2928
|
+
dataView.setUint32(0, signature, true);
|
|
2929
|
+
dataView.setUint32(4, uncompressedSize, true);
|
|
2930
|
+
controller.enqueue(trailer);
|
|
2931
|
+
}
|
|
2932
|
+
});
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2901
2936
|
class InflateStream extends TransformStream {
|
|
2902
2937
|
|
|
2903
2938
|
constructor(options, { chunkSize, DecompressionStreamZlib, DecompressionStream }) {
|
|
@@ -2918,7 +2953,21 @@
|
|
|
2918
2953
|
if (codecStreams) {
|
|
2919
2954
|
readable = pipeThroughBackpressured(readable, createCodecStream(codecStreams.DecompressionStream, format, { chunkSize, compressionMethod, rawBitFlag, uncompressedSize: outputSize }));
|
|
2920
2955
|
} else {
|
|
2921
|
-
|
|
2956
|
+
try {
|
|
2957
|
+
readable = pipeThroughCompressionStream(readable, useCompressionStream, { chunkSize, deflate64 }, DecompressionStream, DecompressionStreamZlib);
|
|
2958
|
+
} catch (error) {
|
|
2959
|
+
if (deflate64 || (encrypted && !zipCrypto) || signature === UNDEFINED_VALUE || outputSize === UNDEFINED_VALUE) {
|
|
2960
|
+
throw error;
|
|
2961
|
+
}
|
|
2962
|
+
let gzipStream;
|
|
2963
|
+
try {
|
|
2964
|
+
gzipStream = new DecompressionStream(FORMAT_GZIP);
|
|
2965
|
+
} catch {
|
|
2966
|
+
throw error;
|
|
2967
|
+
}
|
|
2968
|
+
readable = pipeThrough(readable, new RawDeflateToGzipStream(signature, outputSize));
|
|
2969
|
+
readable = pipeThroughBackpressured(readable, gzipStream);
|
|
2970
|
+
}
|
|
2922
2971
|
}
|
|
2923
2972
|
readable = mapInflateStreamError(readable);
|
|
2924
2973
|
}
|
|
@@ -3699,9 +3748,12 @@
|
|
|
3699
3748
|
const stale = () => workerData.generation != generation;
|
|
3700
3749
|
try {
|
|
3701
3750
|
if (error) {
|
|
3702
|
-
const { message, stack, code, name, outputSize } = error;
|
|
3751
|
+
const { message, stack, code, name, outputSize, cause } = error;
|
|
3703
3752
|
const responseError = new Error(message);
|
|
3704
3753
|
Object.assign(responseError, { stack, code, name, outputSize });
|
|
3754
|
+
if (cause) {
|
|
3755
|
+
responseError.cause = Object.assign(new Error(cause.message), { name: cause.name });
|
|
3756
|
+
}
|
|
3705
3757
|
close(responseError);
|
|
3706
3758
|
} else {
|
|
3707
3759
|
if (type == MESSAGE_PULL) {
|