@zip.js/zip.js
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).zip={})}(this,(function(t){"use strict";const e="HTTP error ",n="text/plain";class s{constructor(){this.size=0}init(){this.initialized=!0}}class i extends s{}class r extends s{writeUint8Array(t){this.size+=t.length}}class a extends i{constructor(t){super(),this.blobReader=new p(new Blob([t],{type:n}))}init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}readUint8Array(t,e){return this.blobReader.readUint8Array(t,e)}}class o extends r{constructor(t){super(),this.encoding=t,this.blob=new Blob([],{type:n})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:n})}getData(){const t=new FileReader;return new Promise(((e,n)=>{t.onload=t=>e(t.target.result),t.onerror=n,t.readAsText(this.blob,this.encoding)}))}}class d extends i{constructor(t){super(),this.dataURI=t;let e=t.length;for(;"="==t.charAt(e-1);)e--;this.dataStart=t.indexOf(",")+1,this.size=Math.floor(.75*(e-this.dataStart))}readUint8Array(t,e){const n=new Uint8Array(e),s=4*Math.floor(t/3),i=atob(this.dataURI.substring(s+this.dataStart,4*Math.ceil((t+e)/3)+this.dataStart)),r=t-3*Math.floor(s/4);for(let t=r;t<r+e;t++)n[t-r]=i.charCodeAt(t);return n}}class c extends r{constructor(t){super(),this.data="data:"+(t||"")+";base64,",this.pending=[]}writeUint8Array(t){super.writeUint8Array(t);let e=0,n=this.pending;const s=this.pending.length;for(this.pending="",e=0;e<3*Math.floor((s+t.length)/3)-s;e++)n+=String.fromCharCode(t[e]);for(;e<t.length;e++)this.pending+=String.fromCharCode(t[e]);n.length>2?this.data+=btoa(n):this.pending=n}getData(){return this.data+btoa(this.pending)}}class p extends i{constructor(t){super(),this.blob=t,this.size=t.size}readUint8Array(t,e){const n=new FileReader;return new Promise(((s,i)=>{n.onload=t=>s(new Uint8Array(t.target.result)),n.onerror=i,n.readAsArrayBuffer(this.blob.slice(t,t+e))}))}}class l extends r{constructor(t){super(),this.offset=0,this.contentType=t,this.blob=new Blob([],{type:t})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:this.contentType}),this.offset=this.blob.size}getData(){return this.blob}}class m extends i{constructor(t){super(),this.url=t}async init(){if(super.init(),function(t){if("undefined"!=typeof document){const e=document.createElement("a");return e.href=t,"http:"==e.protocol||"https:"==e.protocol}return/^https?:\/\//i.test(t)}(this.url))return new Promise(((t,n)=>{const s=new XMLHttpRequest;s.addEventListener("load",(()=>{s.status<400?(this.size=Number(s.getResponseHeader("Content-Length")),this.size?t():x().then((()=>t())).catch(n)):n(e+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",n,!1),s.open("HEAD",this.url),s.send()}));await x()}async readUint8Array(t,e){return this.data||await x(this,this.url),new Uint8Array(this.data.subarray(t,t+e))}}class h extends i{constructor(t){super(),this.url=t}init(){return super.init(),new Promise(((t,n)=>{const s=new XMLHttpRequest;s.addEventListener("load",(()=>{s.status<400?(this.size=Number(s.getResponseHeader("Content-Length")),"bytes"==s.getResponseHeader("Accept-Ranges")?t():n(new Error("HTTP Range not supported"))):n(e+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",n,!1),s.open("HEAD",this.url),s.send()}))}readUint8Array(t,n){return new Promise(((s,i)=>{const r=new XMLHttpRequest;r.open("GET",this.url),r.responseType="arraybuffer",r.setRequestHeader("Range","bytes="+t+"-"+(t+n-1)),r.addEventListener("load",(()=>{r.status<400?s(new Uint8Array(r.response)):i(e+(r.statusText||r.status)+".")}),!1),r.addEventListener("error",i,!1),r.send()}))}}class f extends r{constructor(){super(),this.array=new Uint8Array(0)}writeUint8Array(t){super.writeUint8Array(t);const e=this.array;this.array=new Uint8Array(e.length+t.length),this.array.set(e),this.array.set(t,e.length)}getData(){return this.array}}function x(t,n){return new Promise(((s,i)=>{const r=new XMLHttpRequest;r.addEventListener("load",(()=>{r.status<400?(t.size||(t.size=Number(r.getResponseHeader("Content-Length"))||Number(r.response.byteLength)),t.data=new Uint8Array(r.response),s()):i(e+(r.statusText||r.status)+".")}),!1),r.addEventListener("error",i,!1),r.open("GET",n),r.responseType="arraybuffer",r.send()}))}class u{constructor(){this.crc=-1,this.table=(()=>{const t=[];for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)1&n?n=n>>>1^3988292384:n>>>=1;t[e]=n}return t})()}append(t){const e=this.table;let n=0|this.crc;for(let s=0,i=0|t.length;s<i;s++)n=n>>>8^e[255&(n^t[s])];this.crc=n}get(){return~this.crc}}const v="Invalid pasword",g=16,w="raw",y={name:"PBKDF2"},b={name:"HMAC"},k="SHA-1",z={name:"AES-CTR"},U=Object.assign({hash:b},y),A=Object.assign({iterations:1e3,hash:{name:k}},y),j=Object.assign({hash:k},b),E=Object.assign({length:g},z),D=["deriveBits"],F=["sign"],R=528,B=10,S=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],q=crypto.subtle;class L{constructor(t,e){this.password=t,this.signed=e,this.input=e&&new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(t){const e=async(i=0)=>{if(i+g<=s.length-B){const t=s.subarray(i,i+g),r=await q.decrypt(Object.assign({counter:this.counter},E),this.keys.decrypt,t);return M(this.counter),n.set(new Uint8Array(r),i),e(i+g)}return this.pendingInput=s.subarray(i),this.signed&&(this.input=C(this.input,t)),n};if(this.password){const e=t.subarray(0,18);await async function(t,e,n){t.counter=new Uint8Array(S);const s=e.subarray(0,16),i=e.subarray(16),r=(new TextEncoder).encode(n),a=await q.importKey(w,r,U,!1,D),o=await q.deriveBits(Object.assign({salt:s},A),a,528),d=new Uint8Array(o),c=d.subarray(64);if(t.keys={decrypt:await q.importKey(w,d.subarray(0,32),z,!0,["decrypt"]),authentication:await q.importKey(w,d.subarray(32,64),j,!1,F),passwordVerification:c},c[0]!=i[0]||c[1]!=i[1])throw new Error(v)}(this,e,this.password),this.password=null,t=t.subarray(18)}let n=new Uint8Array(t.length-B-(t.length-B)%g),s=t;return this.pendingInput.length&&(s=C(this.pendingInput,t),n=T(n,s.length-B-(s.length-B)%g)),e()}async flush(){const t=this.pendingInput,e=this.keys,n=t.subarray(0,t.length-B),s=t.subarray(t.length-B);let i=new Uint8Array(0);if(n.length){const t=await q.decrypt(Object.assign({counter:this.counter},E),e.decrypt,n);i=new Uint8Array(t)}let r=!0;if(this.signed){const t=await q.sign(b,e.authentication,this.input.subarray(0,this.input.length-B)),n=new Uint8Array(t);this.input=null;for(let t=0;t<B;t++)n[t]!=s[t]&&(r=!1)}return{valid:r,data:i}}}class I{constructor(t){this.password=t,this.output=new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(t){const e=async(i=0)=>{if(i+g<=t.length){const r=t.subarray(i,i+g),a=await q.encrypt(Object.assign({counter:this.counter},E),this.keys.encrypt,r);return M(this.counter),s.set(new Uint8Array(a),i+n.length),e(i+g)}return this.pendingInput=t.subarray(i),this.output=C(this.output,s),s};let n=new Uint8Array(0);this.password&&(n=await async function(t,e){t.counter=new Uint8Array(S);const n=crypto.getRandomValues(new Uint8Array(16)),s=(new TextEncoder).encode(e),i=await q.importKey(w,s,U,!1,D),r=await q.deriveBits(Object.assign({salt:n},A),i,R),a=new Uint8Array(r);return t.keys={encrypt:await q.importKey(w,a.subarray(0,32),z,!0,["encrypt"]),authentication:await q.importKey(w,a.subarray(32,64),j,!1,F),passwordVerification:a.subarray(64)},C(n,t.keys.passwordVerification)}(this,this.password),this.password=null);let s=new Uint8Array(n.length+t.length-t.length%g);return s.set(n,0),this.pendingInput.length&&(t=C(this.pendingInput,t),s=T(s,t.length-t.length%g)),e()}async flush(){let t=new Uint8Array(0);if(this.pendingInput.length){const e=await q.encrypt(Object.assign({counter:this.counter},E),this.keys.encrypt,this.pendingInput);t=new Uint8Array(e),this.output=C(this.output,t)}const e=await q.sign(b,this.keys.authentication,this.output.subarray(18));this.output=null;const n=new Uint8Array(e).subarray(0,B);return{data:C(t,n),signature:n}}}function M(t){for(let e=0;e<16;e++){if(255!=t[e]){t[e]++;break}t[e]=0}}function C(t,e){let n=t;return t.length+e.length&&(n=new Uint8Array(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function T(t,e){if(e&&e>t.length){const n=t;(t=new Uint8Array(e)).set(n,0)}return t}const P="deflate",W="inflate",Z="Invalid signature";class V{constructor(t){this.signature=t.inputSignature,this.encrypted=Boolean(t.inputPassword),this.signed=t.inputSigned,this.compressed=t.inputCompressed,this.inflate=this.compressed&&new ZipInflate,this.crc32=this.signed&&this.signed&&new u,this.decrypt=this.encrypted&&new L(t.inputPassword)}async append(t){return this.encrypted&&(t=await this.decrypt.append(t)),this.compressed&&t.length&&(t=await this.inflate.append(t)),!this.encrypted&&this.signed&&this.crc32.append(t),t}async flush(){let t,e=new Uint8Array(0);if(this.encrypted){const t=await this.decrypt.flush();if(!t.valid)throw new Error(Z);e=t.data}else if(this.signed){const e=new DataView(new Uint8Array(4).buffer);if(t=this.crc32.get(),e.setUint32(0,t),this.signature!=e.getUint32(0,!1))throw new Error(Z)}return this.compressed&&(e=await this.inflate.append(e)||new Uint8Array(0),await this.inflate.flush()),{data:e,signature:t}}}class H{constructor(t){this.encrypted=t.outputEncrypted,this.signed=t.outputSigned,this.compressed=t.outputCompressed,this.deflate=this.compressed&&new ZipDeflate({level:t.level||5}),this.crc32=this.signed&&new u,this.encrypt=this.encrypted&&new I(t.outputPassword)}async append(t){let e=t;return this.compressed&&t.length&&(e=await this.deflate.append(t)),this.encrypted?e=await this.encrypt.append(e):this.signed&&this.crc32.append(t),e}async flush(){let t,e=new Uint8Array(0);if(this.compressed&&(e=await this.deflate.flush()||new Uint8Array(0)),this.encrypted){e=await this.encrypt.append(e);const n=await this.encrypt.flush();t=n.signature;const s=new Uint8Array(e.length+n.data.length);s.set(e,0),s.set(n.data,e.length),e=s}else this.signed&&(t=this.crc32.get());return{data:e,signature:t}}}const O="init",N="append",K="flush",X="message",_="z-worker.js",G={deflate:[_,"deflate.js"],inflate:[_,"inflate.js"]},Y={pool:[],pendingRequests:[]};function J(t,e){const n=Y.pool;let s;if(t.useWebWorkers){const n=e.codecType;if(null!=t.workerScripts&&null!=t.workerScriptsPath)throw new Error("Either workerScripts or workerScriptsPath may be set, not both");if(t.workerScripts){if(s=t.workerScripts[n],!Array.isArray(s))throw new Error("workerScripts."+n+" must be an array");i=s,s="undefined"!=typeof document?i.map((t=>new URL(t,document.baseURI).href)):i}else s=G[n].slice(0),s[0]=(t.workerScriptsPath||"")+s[0]}var i;if(n.length<t.maxWorkers){const t={worker:s&&new Worker(s[0]),busy:!0,options:e,scripts:s};return n.push(t),s?function(t){const e=t.worker;let n;return e.addEventListener(X,r,!1),t.interface={append:async t=>s({type:N,data:t}),flush:async()=>s({type:K})},t.interface;async function s(e){if(!n){const e=t.scripts.slice(1);await i(Object.assign({type:O,options:t.options,scripts:e}))}return i(e)}function i(t){try{if(t.data)try{e.postMessage(t,[t.data.buffer])}catch(n){e.postMessage(t)}else e.postMessage(t)}catch(t){n.reject(t),e.removeEventListener(X,r,!1)}return new Promise(((t,e)=>n={resolve:t,reject:e}))}function r(s){const i=s.data;if(n){const s=i.error;if(s){const t=new Error(s.message);t.stack=s.stack,n.reject(t),e.removeEventListener(X,r,!1)}else i.type!=O&&i.type!=K&&i.type!=N||(i.type==K?(n.resolve({data:new Uint8Array(i.data),signature:i.signature}),n=null,function(t){if(t.busy=!1,Y.pendingRequests.length){const[{resolve:e,options:n,scripts:s}]=Y.pendingRequests.splice(0,1);t.busy=!0,t.options=n,t.scripts=s,e(t.interface)}else t.worker.terminate(),Y.pool=Y.pool.filter((e=>e!=t))}(t)):n.resolve(i.data&&new Uint8Array(i.data)))}}}(t):Q(t)}{const t=n.find((t=>!t.busy));return t?(t.busy=!0,t.options=e,t.scripts=s,s?t.interface:Q(t)):new Promise((t=>Y.pendingRequests.push({resolve:t,options:e,scripts:s})))}}async function Q(t){const e=(n=t.options).codecType.startsWith(P)?new H(n):n.codecType.startsWith(W)?new V(n):void 0;var n;const s=e.flush.bind(e);return e.flush=async()=>{const e=await s();if(t.busy=!1,Y.pendingRequests.length){const[{resolve:e,options:n}]=Y.pendingRequests.splice(0,1);t.busy=!0,t.options=n,e(await Q(t))}else Y.pool=Y.pool.filter((e=>e!=t));return e},e}async function $(t,e,n,s,i,r,a){const o=Math.max(r.chunkSize,64);return async function r(d=0,c=0){const p=d*o;if(p<i){const l=await e.readUint8Array(p+s,Math.min(o,i-p)),m=await t.append(l);return c+=await tt(n,m),a.onprogress&&a.onprogress(p+l.length,i),r(d+1,c)}{const e=await t.flush();return c+=await tt(n,e.data),{signature:e.signature,length:c}}}()}async function tt(t,e){return e.length&&await t.writeUint8Array(e),e.length}const et="File format is not recognized",nt="End of central directory not found",st="Zip64 extra field not found",it="Compression method not supported",rt="utf-8",at="windows-1252";class ot{constructor(t,e,n){this.reader=t,this.config=e,this.options=n}async getData(t,e={}){const n=this.reader;n.initialized||await n.init();const s=await n.readUint8Array(this.offset,30),i=new DataView(s.buffer),r=void 0===e.password?this.options.password:e.password;let a=r&&r.length&&r;if(this.extraFieldAES){if(99!=this.extraFieldAES.originalCompressionMethod)throw new Error(it);if(3!=this.extraFieldAES.strength)throw new Error("Encryption not supported")}if(0!=this.compressionMethod&&8!=this.compressionMethod)throw new Error(it);if(1347093252!=i.getUint32(0,!1))throw"Local file header not found";const o=this.localDirectory={};dt(o,i,4),o.rawExtraField=s.subarray(this.offset+30+o.filenameLength,this.offset+30+o.filenameLength+o.extraFieldLength),ct(this,o,i,4);let d=this.offset+30+o.filenameLength+o.extraFieldLength;const c=this.bitFlag.encrypted&&o.bitFlag.encrypted;if(c&&!a)throw new Error("File contains encrypted entry");const p=await J(this.config,{codecType:W,inputPassword:a,inputSigned:void 0===e.checkSignature?this.options.checkSignature:e.checkSignature,inputSignature:this.signature,inputCompressed:0!=this.compressionMethod,inputEncrypted:c});return t.initialized||await t.init(),await $(p,n,t,d,this.compressedSize,this.config,{onprogress:e.onprogress}),t.getData()}}function dt(t,e,n){t.version=e.getUint16(n,!0);const s=t.rawBitFlag=e.getUint16(n+2,!0);t.bitFlag={encrypted:1==(1&s),level:(6&s)>>1,dataDescriptor:8==(8&s),languageEncodingFlag:2048==(2048&s)},t.encrypted=t.bitFlag.encrypted,t.rawLastModDate=e.getUint32(n+6,!0),t.lastModDate=function(t){const e=(4294901760&t)>>16,n=65535&t;try{return new Date(1980+((65024&e)>>9),((480&e)>>5)-1,31&e,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch(t){}}(t.rawLastModDate),t.filenameLength=e.getUint16(n+22,!0),t.extraFieldLength=e.getUint16(n+24,!0)}function ct(t,e,n,s){let i,r,a;const o=e.rawExtraField,d=e.extraField=new Map,c=new DataView(new Uint8Array(o).buffer);let p=0;try{for(;p<o.length;){const t=c.getUint16(p,!0),e=c.getUint16(p+2,!0);d.set(t,{type:t,data:o.slice(p+4,p+4+e)}),p+=4+e}}catch(t){}const l=n.getUint16(s+4,!0);e.signature=n.getUint32(s+10,!0),e.uncompressedSize=n.getUint32(s+18,!0),e.compressedSize=n.getUint32(s+14,!0),i=e.extraFieldZip64=d.get(1),i&&function(t,e){e.zip64=!0;const n=new DataView(t.data.buffer);t.values=[];for(let e=0;e<Math.floor(t.data.length/8);e++)t.values.push(Number(n.getBigUint64(0+8*e,!0)));const s=["uncompressedSize","compressedSize","offset"],i=s.filter((t=>4294967295==e[t]));for(let e=0;e<i.length;e++)t[i[e]]=t.values[e];s.forEach((n=>{if(4294967295==e[n]){if(!t||void 0===t[n])throw new Error(st);e[n]=t&&t[n]}}))}(i,e),a=e.extraFieldUnicodePath=d.get(28789),a&&function(t,e,n){const s=new DataView(t.data.buffer);t.version=s.getUint8(0),t.signature=s.getUint32(1,!0);const i=new u;i.append(n.rawFilename);const r=new DataView(new Uint8Array(4).buffer);r.setUint32(0,i.get()),t.filename=(new TextDecoder).decode(t.data.subarray(5)),t.signature==r.getUint32(0,!1)&&(e.filename=t.filename)}(a,e,t),r=e.extraFieldAES=d.get(39169),r?function(t,e,n){if(t){const s=new DataView(t.data.buffer);t.vendorVersion=s.getUint8(0),t.vendorId=s.getUint8(2);const i=s.getUint8(4);t.strength=i,t.originalCompressionMethod=n,e.compressionMethod=t.compressionMethod=s.getUint16(5,!0)}else e.compressionMethod=n}(r,e,l):e.compressionMethod=l,8==e.compressionMethod&&(e.bitFlag.enhancedDeflating=16!=(16&e.rawBitFlag))}function pt(t,e){return new TextDecoder(e).decode(t)}function lt(t){return unescape(encodeURIComponent(t))}function mt(t){const e=[];for(let n=0;n<t.length;n++)e.push(t.charCodeAt(n));return e}const ht="function";function ft(t,e){return class{constructor(n){const s=t=>{if(this.pendingData){const e=this.pendingData;this.pendingData=new Uint8Array(e.length+t.length),this.pendingData.set(e,0),this.pendingData.set(t,e.length)}else this.pendingData=new Uint8Array(t)};if(this.codec=new t(Object.assign({},e,n)),typeof this.codec.onData==ht)this.codec.onData=s;else{if(typeof this.codec.on!=ht)throw new Error("Cannot register the callback function");this.codec.on("data",s)}}async append(t){return this.codec.push(t),n(this)}async flush(){return this.codec.push(new Uint8Array(0),!0),n(this)}};function n(t){if(t.pendingData){const e=t.pendingData;return t.pendingData=null,e}return new Uint8Array(0)}}const xt={chunkSize:524288,maxWorkers:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,workerScriptsPath:void 0,useWebWorkers:!0};let ut=Object.assign({},xt);class vt extends class{constructor(t,e={},n={}){this.reader=t,this.options=e,this.config=n}async getEntries(){const t=this.reader;t.initialized||await t.init();const e=await async function(t,e,n,s){if(t.size<n)throw new Error(et);const i=n+s;let r=n,a=await o(r);a||(a=await o(Math.min(i,t.size)));if(!a)throw new Error(nt);return a;async function o(s){const i=t.size-s,r=await t.readUint8Array(i,s);for(let t=r.length-n;t>=0;t--)if(r[t]==e[0]&&r[t+1]==e[1]&&r[t+2]==e[2]&&r[t+3]==e[3])return{offset:i,buffer:r.slice(t,t+n).buffer}}}(t,[80,75,5,6],22,65536);let n,s=new DataView(e.buffer),i=s.getUint32(16,!0),r=s.getUint16(8,!0);if(4294967295==i||65535==r){n=!0;const s=await t.readUint8Array(e.offset-20,20),a=new DataView(s.buffer);if(1347094023!=Number(a.getUint32(0,!1)))throw new Error("End of Zip64 central directory not found");i=Number(a.getBigUint64(8,!0));const o=await t.readUint8Array(i,56),d=new DataView(o.buffer);if(1347094022!=Number(d.getUint32(0,!1)))throw new Error("End of Zip64 central directory locator not found");r=Number(d.getBigUint64(24,!0)),i-=Number(d.getBigUint64(40,!0))}if(i<0||!n&&(i>=t.size||r>=65535))throw new Error(et);const a=await t.readUint8Array(i,t.size-i);s=new DataView(a.buffer);const o=[];let d=0;for(let t=0;t<r;t++){const t=new ot(this.reader,this.config,this.options);if(1347092738!=s.getUint32(d,!1))throw new Error("Central directory header not found");t.compressedSize=0,t.uncompressedSize=0,dt(t,s,d+6),t.commentLength=s.getUint16(d+32,!0),t.directory=16==(16&s.getUint8(d+38)),t.offset=s.getUint32(d+42,!0),t.rawFilename=a.subarray(d+46,d+46+t.filenameLength),t.filename=pt(t.rawFilename,t.bitFlag.languageEncodingFlag?rt:this.options.filenameEncoding||at),t.directory||"/"!=t.filename.charAt(t.filename.length-1)||(t.directory=!0),t.rawExtraField=a.subarray(d+46+t.filenameLength,d+46+t.filenameLength+t.extraFieldLength),ct(t,t,s,d+6),t.rawComment=a.subarray(d+46+t.filenameLength+t.extraFieldLength,d+46+t.filenameLength+t.extraFieldLength+t.commentLength),t.comment=pt(t.rawComment,t.bitFlag.languageEncodingFlag?rt:this.options.commentEncoding||at),o.push(t),d+=46+t.filenameLength+t.extraFieldLength+t.commentLength}return o}async close(){}}{constructor(t,e){super(t,e,ut)}}class gt extends class{constructor(t,e={},n={}){this.writer=t,this.options=e,this.config=n,this.files=new Map,this.offset=t.size,this.zip64=e.zip64}async add(t,e,n={}){if(t=t.trim(),n.directory&&"/"!=t.charAt(t.length-1)&&(t+="/"),this.files.has(t))throw new Error("File already exists");if(n.comment=mt(lt(n.comment||"")),n.comment>65536)throw new Error("File entry comment exceeds 64KB");n.zip64=n.zip64||this.zip64,await async function(t,e,n,s){const i=t.files,r=t.writer;let a;i.set(e,null);try{let o,d;try{s.bufferedWrite||t.options.bufferedWrite||t.lockWrite?(o=new f,o.init()):(t.lockWrite=new Promise((t=>a=t)),r.initialized||await r.init(),o=r),(t.offset>=4294967295||n&&(n.size>=4294967295||t.offset+n.size>=4294967295))&&(s.zip64=!0),d=await async function(t,e,n,s,i,r){const a=mt(lt(t)),o=r.lastModDate||new Date,d=new Uint8Array(26),c=new DataView(d.buffer),p=void 0===r.password?i.password:r.password,l=p&&p.length&&p,m=void 0===r.level?i.level:r.level,h=0!==m&&!r.directory,f=void 0===p||!p.length,x=r.zip64,u={zip64:x,headerArray:d,directory:r.directory,filename:a,comment:r.comment,extraFieldZip64:x?new Uint8Array(28):new Uint8Array(0),extraFieldAES:l?new Uint8Array([1,153,7,0,2,0,65,69,3,0,0]):new Uint8Array(0),rawExtraField:new Uint8Array(0)},v=r.extraField;if(v){let t=4,e=0;v.forEach((e=>t+=e.length));const n=u.rawExtraField=new Uint8Array(t);v.forEach(((t,s)=>{n.set(new Uint16Array([s]),e),n.set(new Uint16Array([t.length]),e+2),n.set(t,e+4),e+=4+t.length}))}r.bitFlag=8,r.version=(void 0===r.version?i.version:r.version)||20,r.compressionMethod=0,h&&(r.compressionMethod=8);x&&(r.version=r.version>45?r.version:45);l&&(r.version=r.version>51?r.version:51,r.bitFlag=9,r.compressionMethod=99,h&&(u.extraFieldAES[9]=8));c.setUint16(0,r.version,!0),c.setUint16(2,r.bitFlag,!0),c.setUint16(4,r.compressionMethod,!0),c.setUint16(6,(o.getHours()<<6|o.getMinutes())<<5|o.getSeconds()/2,!0),c.setUint16(8,(o.getFullYear()-1980<<4|o.getMonth()+1)<<5|o.getDate(),!0),c.setUint16(22,a.length,!0),c.setUint16(24,0,!0);const g=new Uint8Array(30+a.length);let w;if(new DataView(g.buffer).setUint32(0,1347093252),g.set(d,4),g.set(a,30),e){e.initialized||await e.init();const t=await J(s,{codecType:P,level:m,outputPassword:p,outputSigned:f,outputCompressed:h,outputEncrypted:Boolean(p)});await n.writeUint8Array(g),w=await $(t,e,n,0,e.size,s,{onprogress:r.onprogress}),u.compressedSize=w.length}else await n.writeUint8Array(g);const y=new Uint8Array(x?24:16),b=new DataView(y.buffer);if(b.setUint32(0,1347094280),e)if(l||void 0===w.signature||(c.setUint32(10,w.signature,!0),b.setUint32(4,w.signature,!0)),x){c.setUint32(14,4294967295,!0),b.setBigUint64(8,BigInt(u.compressedSize),!0),c.setUint32(18,4294967295,!0),b.setBigUint64(16,BigInt(e.size),!0);const t=new DataView(u.extraFieldZip64.buffer);t.setUint16(0,1,!0),t.setUint16(2,24,!0),t.setBigUint64(4,BigInt(e.size),!0),t.setBigUint64(12,BigInt(u.compressedSize),!0)}else c.setUint32(14,u.compressedSize,!0),b.setUint32(8,u.compressedSize,!0),c.setUint32(18,e.size,!0),b.setUint32(12,e.size,!0);return await n.writeUint8Array(y),u.length=g.length+(w?w.length:0)+y.length,u}(e,n,o,t.config,t.options,s)}catch(t){throw i.delete(e),t}if(i.set(e,d),o!=r&&(t.lockWrite&&await t.lockWrite,await r.writeUint8Array(o.getData())),d.offset=t.offset,d.zip64){new DataView(d.extraFieldZip64.buffer).setBigUint64(20,BigInt(d.offset),!0)}t.offset+=d.length}finally{a&&(t.lockWrite=null,a())}}(this,t,e,n)}async close(t){const e=this.writer,n=this.files;let s=0,i=0,r=this.offset,a=n.size;for(const[,t]of n)i+=46+t.filename.length+t.comment.length+t.extraFieldZip64.length+t.extraFieldAES.length+t.rawExtraField.length;(r+i>=4294967295||a>=65535)&&(this.zip64=!0);const o=new Uint8Array(i+(this.zip64?98:22)),d=new DataView(o.buffer);for(const[,t]of n){const e=t.filename,n=t.extraFieldZip64,i=t.extraFieldAES,r=n.length+i.length+t.rawExtraField.length;d.setUint32(s,1347092738),t.zip64?d.setUint16(s+4,11520):d.setUint16(s+4,5120),o.set(t.headerArray,s+6),d.setUint16(s+30,r,!0),d.setUint16(s+32,t.comment.length,!0),t.directory&&d.setUint8(s+38,16),t.zip64?d.setUint32(s+42,4294967295,!0):d.setUint32(s+42,t.offset,!0),o.set(e,s+46),o.set(n,s+46+e.length),o.set(i,s+46+e.length+n.length),o.set(t.rawExtraField,46+e.length+n.length+i.length),o.set(t.comment,s+46+e.length+r),s+=46+e.length+r+t.comment.length}if(this.zip64&&(d.setUint32(s,1347094022),d.setBigUint64(s+4,BigInt(44),!0),d.setUint16(s+12,45,!0),d.setUint16(s+14,45,!0),d.setBigUint64(s+24,BigInt(a),!0),d.setBigUint64(s+32,BigInt(a),!0),d.setBigUint64(s+40,BigInt(i),!0),d.setBigUint64(s+48,BigInt(r),!0),d.setUint32(s+56,1347094023),d.setBigUint64(s+64,BigInt(r+i),!0),d.setUint32(s+72,1,!0),a=65535,r=4294967295,s+=76),d.setUint32(s,1347093766),d.setUint16(s+8,a,!0),d.setUint16(s+10,a,!0),d.setUint32(s+12,i,!0),d.setUint32(s+16,r,!0),t&&t.length){if(!(t.length<=65536))throw new Error("Zip file comment exceeds 64KB");d.setUint16(s+20,t.length,!0)}return await e.writeUint8Array(o),t&&t.length&&await e.writeUint8Array(t),e.getData()}}{constructor(t,e){super(t,e,ut)}}const wt=524288;class yt{constructor(t,e,n,s){if(t.root&&s&&s.getChildByName(e))throw new Error("Entry filename already exists");n||(n={}),this.fs=t,this.name=e,this.id=t.entries.length,this.parent=s,this.children=[],this.zipVersion=n.zipVersion||20,this.uncompressedSize=0,t.entries.push(this),s&&this.parent.children.push(this)}moveTo(t){if(!t.directory)throw"Target entry is not a directory";if(t.isDescendantOf(this))throw"Entry is a ancestor of target entry";if(this!=t){if(t.getChildByName(this.name))throw"Entry filename already exists";Et(this),this.parent=t,t.children.push(this)}}getFullname(){let t=this.name,e=this.parent;for(;e;)t=(e.name?e.name+"/":"")+t,e=e.parent;return t}isDescendantOf(t){let e=this.parent;for(;e&&e.id!=t.id;)e=e.parent;return Boolean(e)}}class bt extends yt{constructor(t,e,n,s){super(t,e,n,s),this.Reader=n.Reader,this.Writer=n.Writer,this.data=n.data,n.getData&&(this.getData=n.getData)}async getData(t,e={}){return!t||t.constructor==this.Writer&&this.data?this.data:(this.reader||(this.reader=new this.Reader(this.data)),await this.reader.init(),await t.init(),this.uncompressedSize=this.reader.size,async function(t,e,n){return s();async function s(i=0){const r=i*wt;if(n.onprogress&&n.onprogress(r,t.size),r<t.size){const n=await t.readUint8Array(r,Math.min(wt,t.size-r));return await e.writeUint8Array(n),s(i+1)}return e.getData()}}(this.reader,t,e))}getText(t,e){return this.getData(new o(t),e)}getBlob(t,e){return this.getData(new l(t),e)}getData64URI(t,e){return this.getData(new c(t),e)}}class kt extends yt{constructor(t,e,n,s){super(t,e,n,s),this.directory=!0}addDirectory(t){return Ft(this,t,null,!0)}addText(t,e){return Ft(this,t,{data:e,Reader:a,Writer:o})}addBlob(t,e){return Ft(this,t,{data:e,Reader:p,Writer:l})}addData64URI(t,e){return Ft(this,t,{data:e,Reader:d,Writer:c})}addHttpContent(t,e,n={}){return Ft(this,t,{data:e,Reader:n.useRangeHeader?h:m})}addFileEntry(t){!async function(t,e){e.isDirectory?await s(t,e):await new Promise(((n,s)=>{e.file((s=>{t.addBlob(e.name,s),n()}),s)}));function n(t){return new Promise(((e,n)=>{let s=[];function i(t){t.readEntries((n=>{n.length?(s=s.concat(n),i(t)):e(s)}),n)}t.isDirectory&&i(t.createReader()),t.isFile&&e(s)}))}async function s(t,e){const i=await n(e);for(const e of i)e.isDirectory&&await s(t.addDirectory(e.name)),await new Promise(((n,s)=>{e.isFile&&e.file((s=>{const i=t.addBlob(e.name,s);i.uncompressedSize=s.size,n(i)}),s)}))}}(this,t)}async addData(t,e){return Ft(this,t,e)}async importBlob(t,e={}){await this.importZip(new p(t),e)}async importData64URI(t,e={}){await this.importZip(new d(t),e)}async importHttpContent(t,e={}){await this.importZip(e.useRangeHeader?new h(t):new m(t),e)}async exportBlob(t={}){return this.exportZip(new l("application/zip"),t)}async exportData64URI(t={}){return this.exportZip(new c("application/zip"),t)}async importZip(t,e){await t.init();const n=new vt(t),s=await n.getEntries();let i=0;const r=Ut(s,"compressedSize");s.forEach((t=>{let n=this,s=t.filename.split("/"),a=s.pop();if(s.forEach((t=>n=n.getChildByName(t)||new kt(this.fs,t,null,n))),!t.directory){let s=i;Ft(n,a,{data:t,Reader:At(Object.assign({},e,{onprogress:t=>{e.onprogress&&e.onprogress(s+t,r)}}))}),i+=t.compressedSize}}))}async exportZip(t,e){await jt(this);const n=new gt(t);return await async function(t,e,n,s){let i=0;async function r(t,e){async function a(){let a=0;for(const o of e.children){let e=i;await t.add(o.getFullname(),o.reader,Object.assign({directory:o.directory,version:o.zipVersion},s,{onprogress:t=>{s.onprogress&&s.onprogress(e+a+t,n)}})),i+=o.uncompressedSize,await r(t,o),a++}}await a()}await r(t,e)}(n,this,Ut([this],"uncompressedSize"),e),await n.close(),t.getData()}getChildByName(t){for(let e=0;e<this.children.length;e++){const n=this.children[e];if(n.name==t)return n}}}const zt={FS:class{constructor(){Dt(this)}remove(t){Et(t),this.entries[t.id]=null}find(t){const e=t.split("/");let n=this.root;for(let t=0;n&&t<e.length;t++)n=n.getChildByName(e[t]);return n}getById(t){return this.entries[t]}async importBlob(t){Dt(this),await this.root.importBlob(t)}async importData64URI(t){Dt(this),await this.root.importData64URI(t)}async importHttpContent(t,e){this.entries=[],this.root=new kt(this),await this.root.importHttpContent(t,e)}async exportBlob(t){return this.root.exportBlob(t)}async exportData64URI(t){return this.root.exportData64URI(t)}},ZipDirectoryEntry:kt,ZipFileEntry:bt};function Ut(t,e){let n=0;return t.forEach((function t(s){n+=s[e],s.children&&s.children.forEach(t)})),n}function At(t){return class{constructor(t){this.entry=t,this.size=0}async readUint8Array(e,n){if(!this.blobReader){const e=await this.entry.getData(new l,t);this.data=e,this.blobReader=new p(e)}return this.blobReader.readUint8Array(e,n)}async init(){this.size=this.entry.uncompressedSize}}}async function jt(t){if(t.children.length)for(const e of t.children)e.directory?await jt(e):(e.reader=new e.Reader(e.data),await e.reader.init(),e.uncompressedSize=e.reader.size)}function Et(t){const e=t.parent.children;e.forEach(((n,s)=>{n.id==t.id&&e.splice(s,1)}))}function Dt(t){t.entries=[],t.root=new kt(t)}function Ft(t,e,n,s){if(t.directory)return s?new kt(t.fs,e,n,t):new bt(t.fs,e,n,t);throw"Parent entry is not a directory"}const Rt={application:{"andrew-inset":"ez",annodex:"anx","atom+xml":"atom","atomcat+xml":"atomcat","atomserv+xml":"atomsrv",bbolin:"lin",cap:["cap","pcap"],"cu-seeme":"cu","davmount+xml":"davmount",dsptype:"tsp",ecmascript:["es","ecma"],futuresplash:"spl",hta:"hta","java-archive":"jar","java-serialized-object":"ser","java-vm":"class",javascript:"js",m3g:"m3g","mac-binhex40":"hqx",mathematica:["nb","ma","mb"],msaccess:"mdb",msword:["doc","dot"],mxf:"mxf",oda:"oda",ogg:"ogx",pdf:"pdf","pgp-keys":"key","pgp-signature":["asc","sig"],"pics-rules":"prf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],rar:"rar","rdf+xml":"rdf","rss+xml":"rss",rtf:"rtf",smil:["smi","smil"],"xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd"],"xspf+xml":"xspf",zip:"zip","vnd.android.package-archive":"apk","vnd.cinderella":"cdy","vnd.google-earth.kml+xml":"kml","vnd.google-earth.kmz":"kmz","vnd.mozilla.xul+xml":"xul","vnd.ms-excel":["xls","xlb","xlt","xlm","xla","xlc","xlw"],"vnd.ms-pki.seccat":"cat","vnd.ms-pki.stl":"stl","vnd.ms-powerpoint":["ppt","pps","pot"],"vnd.oasis.opendocument.chart":"odc","vnd.oasis.opendocument.database":"odb","vnd.oasis.opendocument.formula":"odf","vnd.oasis.opendocument.graphics":"odg","vnd.oasis.opendocument.graphics-template":"otg","vnd.oasis.opendocument.image":"odi","vnd.oasis.opendocument.presentation":"odp","vnd.oasis.opendocument.presentation-template":"otp","vnd.oasis.opendocument.spreadsheet":"ods","vnd.oasis.opendocument.spreadsheet-template":"ots","vnd.oasis.opendocument.text":"odt","vnd.oasis.opendocument.text-master":"odm","vnd.oasis.opendocument.text-template":"ott","vnd.oasis.opendocument.text-web":"oth","vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","vnd.openxmlformats-officedocument.spreadsheetml.template":"xltx","vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","vnd.openxmlformats-officedocument.presentationml.slideshow":"ppsx","vnd.openxmlformats-officedocument.presentationml.template":"potx","vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","vnd.openxmlformats-officedocument.wordprocessingml.template":"dotx","vnd.smaf":"mmf","vnd.stardivision.calc":"sdc","vnd.stardivision.chart":"sds","vnd.stardivision.draw":"sda","vnd.stardivision.impress":"sdd","vnd.stardivision.math":["sdf","smf"],"vnd.stardivision.writer":["sdw","vor"],"vnd.stardivision.writer-global":"sgl","vnd.sun.xml.calc":"sxc","vnd.sun.xml.calc.template":"stc","vnd.sun.xml.draw":"sxd","vnd.sun.xml.draw.template":"std","vnd.sun.xml.impress":"sxi","vnd.sun.xml.impress.template":"sti","vnd.sun.xml.math":"sxm","vnd.sun.xml.writer":"sxw","vnd.sun.xml.writer.global":"sxg","vnd.sun.xml.writer.template":"stw","vnd.symbian.install":["sis","sisx"],"vnd.visio":["vsd","vst","vss","vsw"],"vnd.wap.wbxml":"wbxml","vnd.wap.wmlc":"wmlc","vnd.wap.wmlscriptc":"wmlsc","vnd.wordperfect":"wpd","vnd.wordperfect5.1":"wp5","x-123":"wk","x-7z-compressed":"7z","x-abiword":"abw","x-apple-diskimage":"dmg","x-bcpio":"bcpio","x-bittorrent":"torrent","x-cbr":["cbr","cba","cbt","cb7"],"x-cbz":"cbz","x-cdf":["cdf","cda"],"x-cdlink":"vcd","x-chess-pgn":"pgn","x-cpio":"cpio","x-csh":"csh","x-debian-package":["deb","udeb"],"x-director":["dcr","dir","dxr","cst","cct","cxt","w3d","fgd","swa"],"x-dms":"dms","x-doom":"wad","x-dvi":"dvi","x-httpd-eruby":"rhtml","x-font":"pcf.Z","x-freemind":"mm","x-gnumeric":"gnumeric","x-go-sgf":"sgf","x-graphing-calculator":"gcf","x-gtar":["gtar","taz"],"x-hdf":"hdf","x-httpd-php":["phtml","pht","php"],"x-httpd-php-source":"phps","x-httpd-php3":"php3","x-httpd-php3-preprocessed":"php3p","x-httpd-php4":"php4","x-httpd-php5":"php5","x-ica":"ica","x-info":"info","x-internet-signup":["ins","isp"],"x-iphone":"iii","x-iso9660-image":"iso","x-java-jnlp-file":"jnlp","x-jmol":"jmz","x-killustrator":"kil","x-koan":["skp","skd","skt","skm"],"x-kpresenter":["kpr","kpt"],"x-kword":["kwd","kwt"],"x-latex":"latex","x-lha":"lha","x-lyx":"lyx","x-lzh":"lzh","x-lzx":"lzx","x-maker":["frm","maker","frame","fm","fb","book","fbdoc"],"x-ms-wmd":"wmd","x-ms-wmz":"wmz","x-msdos-program":["com","exe","bat","dll"],"x-msi":"msi","x-netcdf":["nc","cdf"],"x-ns-proxy-autoconfig":["pac","dat"],"x-nwc":"nwc","x-object":"o","x-oz-application":"oza","x-pkcs7-certreqresp":"p7r","x-python-code":["pyc","pyo"],"x-qgis":["qgs","shp","shx"],"x-quicktimeplayer":"qtl","x-redhat-package-manager":"rpm","x-ruby":"rb","x-sh":"sh","x-shar":"shar","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","x-stuffit":"sit","x-sv4cpio":"sv4cpio","x-sv4crc":"sv4crc","x-tar":"tar","x-tcl":"tcl","x-tex-gf":"gf","x-tex-pk":"pk","x-texinfo":["texinfo","texi"],"x-trash":["~","%","bak","old","sik"],"x-troff":["t","tr","roff"],"x-troff-man":"man","x-troff-me":"me","x-troff-ms":"ms","x-ustar":"ustar","x-wais-source":"src","x-wingz":"wz","x-x509-ca-cert":["crt","der","cer"],"x-xcf":"xcf","x-xfig":"fig","x-xpinstall":"xpi",applixware:"aw","atomsvc+xml":"atomsvc","ccxml+xml":"ccxml","cdmi-capability":"cdmia","cdmi-container":"cdmic","cdmi-domain":"cdmid","cdmi-object":"cdmio","cdmi-queue":"cdmiq","docbook+xml":"dbk","dssc+der":"dssc","dssc+xml":"xdssc","emma+xml":"emma","epub+zip":"epub",exi:"exi","font-tdpfr":"pfr","gml+xml":"gml","gpx+xml":"gpx",gxf:"gxf",hyperstudio:"stk","inkml+xml":["ink","inkml"],ipfix:"ipfix",json:"json","jsonml+json":"jsonml","lost+xml":"lostxml","mads+xml":"mads",marc:"mrc","marcxml+xml":"mrcx","mathml+xml":"mathml",mbox:"mbox","mediaservercontrol+xml":"mscml","metalink+xml":"metalink","metalink4+xml":"meta4","mets+xml":"mets","mods+xml":"mods",mp21:["m21","mp21"],mp4:"mp4s","oebps-package+xml":"opf","omdoc+xml":"omdoc",onenote:["onetoc","onetoc2","onetmp","onepkg"],oxps:"oxps","patch-ops-error+xml":"xer","pgp-encrypted":"pgp",pkcs10:"p10","pkcs7-mime":["p7m","p7c"],"pkcs7-signature":"p7s",pkcs8:"p8","pkix-attr-cert":"ac","pkix-crl":"crl","pkix-pkipath":"pkipath",pkixcmp:"pki","pls+xml":"pls","prs.cww":"cww","pskc+xml":"pskcxml","reginfo+xml":"rif","relax-ng-compact-syntax":"rnc","resource-lists+xml":"rl","resource-lists-diff+xml":"rld","rls-services+xml":"rs","rpki-ghostbusters":"gbr","rpki-manifest":"mft","rpki-roa":"roa","rsd+xml":"rsd","sbml+xml":"sbml","scvp-cv-request":"scq","scvp-cv-response":"scs","scvp-vp-request":"spq","scvp-vp-response":"spp",sdp:"sdp","set-payment-initiation":"setpay","set-registration-initiation":"setreg","shf+xml":"shf","sparql-query":"rq","sparql-results+xml":"srx",srgs:"gram","srgs+xml":"grxml","sru+xml":"sru","ssdl+xml":"ssdl","ssml+xml":"ssml","tei+xml":["tei","teicorpus"],"thraud+xml":"tfi","timestamped-data":"tsd","vnd.3gpp.pic-bw-large":"plb","vnd.3gpp.pic-bw-small":"psb","vnd.3gpp.pic-bw-var":"pvb","vnd.3gpp2.tcap":"tcap","vnd.3m.post-it-notes":"pwn","vnd.accpac.simply.aso":"aso","vnd.accpac.simply.imp":"imp","vnd.acucobol":"acu","vnd.acucorp":["atc","acutc"],"vnd.adobe.air-application-installer-package+zip":"air","vnd.adobe.formscentral.fcdt":"fcdt","vnd.adobe.fxp":["fxp","fxpl"],"vnd.adobe.xdp+xml":"xdp","vnd.adobe.xfdf":"xfdf","vnd.ahead.space":"ahead","vnd.airzip.filesecure.azf":"azf","vnd.airzip.filesecure.azs":"azs","vnd.amazon.ebook":"azw","vnd.americandynamics.acc":"acc","vnd.amiga.ami":"ami","vnd.anser-web-certificate-issue-initiation":"cii","vnd.anser-web-funds-transfer-initiation":"fti","vnd.antix.game-component":"atx","vnd.apple.installer+xml":"mpkg","vnd.apple.mpegurl":"m3u8","vnd.aristanetworks.swi":"swi","vnd.astraea-software.iota":"iota","vnd.audiograph":"aep","vnd.blueice.multipass":"mpm","vnd.bmi":"bmi","vnd.businessobjects":"rep","vnd.chemdraw+xml":"cdxml","vnd.chipnuts.karaoke-mmd":"mmd","vnd.claymore":"cla","vnd.cloanto.rp9":"rp9","vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"vnd.cluetrust.cartomobile-config":"c11amc","vnd.cluetrust.cartomobile-config-pkg":"c11amz","vnd.commonspace":"csp","vnd.contact.cmsg":"cdbcmsg","vnd.cosmocaller":"cmc","vnd.crick.clicker":"clkx","vnd.crick.clicker.keyboard":"clkk","vnd.crick.clicker.palette":"clkp","vnd.crick.clicker.template":"clkt","vnd.crick.clicker.wordbank":"clkw","vnd.criticaltools.wbs+xml":"wbs","vnd.ctc-posml":"pml","vnd.cups-ppd":"ppd","vnd.curl.car":"car","vnd.curl.pcurl":"pcurl","vnd.dart":"dart","vnd.data-vision.rdz":"rdz","vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"vnd.dece.ttml+xml":["uvt","uvvt"],"vnd.dece.unspecified":["uvx","uvvx"],"vnd.dece.zip":["uvz","uvvz"],"vnd.denovo.fcselayout-link":"fe_launch","vnd.dna":"dna","vnd.dolby.mlp":"mlp","vnd.dpgraph":"dpg","vnd.dreamfactory":"dfac","vnd.ds-keypoint":"kpxx","vnd.dvb.ait":"ait","vnd.dvb.service":"svc","vnd.dynageo":"geo","vnd.ecowin.chart":"mag","vnd.enliven":"nml","vnd.epson.esf":"esf","vnd.epson.msf":"msf","vnd.epson.quickanime":"qam","vnd.epson.salt":"slt","vnd.epson.ssf":"ssf","vnd.eszigno3+xml":["es3","et3"],"vnd.ezpix-album":"ez2","vnd.ezpix-package":"ez3","vnd.fdf":"fdf","vnd.fdsn.mseed":"mseed","vnd.fdsn.seed":["seed","dataless"],"vnd.flographit":"gph","vnd.fluxtime.clip":"ftc","vnd.framemaker":["fm","frame","maker","book"],"vnd.frogans.fnc":"fnc","vnd.frogans.ltf":"ltf","vnd.fsc.weblaunch":"fsc","vnd.fujitsu.oasys":"oas","vnd.fujitsu.oasys2":"oa2","vnd.fujitsu.oasys3":"oa3","vnd.fujitsu.oasysgp":"fg5","vnd.fujitsu.oasysprs":"bh2","vnd.fujixerox.ddd":"ddd","vnd.fujixerox.docuworks":"xdw","vnd.fujixerox.docuworks.binder":"xbd","vnd.fuzzysheet":"fzs","vnd.genomatix.tuxedo":"txd","vnd.geogebra.file":"ggb","vnd.geogebra.tool":"ggt","vnd.geometry-explorer":["gex","gre"],"vnd.geonext":"gxt","vnd.geoplan":"g2w","vnd.geospace":"g3w","vnd.gmx":"gmx","vnd.grafeq":["gqf","gqs"],"vnd.groove-account":"gac","vnd.groove-help":"ghf","vnd.groove-identity-message":"gim","vnd.groove-injector":"grv","vnd.groove-tool-message":"gtm","vnd.groove-tool-template":"tpl","vnd.groove-vcard":"vcg","vnd.hal+xml":"hal","vnd.handheld-entertainment+xml":"zmm","vnd.hbci":"hbci","vnd.hhe.lesson-player":"les","vnd.hp-hpgl":"hpgl","vnd.hp-hpid":"hpid","vnd.hp-hps":"hps","vnd.hp-jlyt":"jlt","vnd.hp-pcl":"pcl","vnd.hp-pclxl":"pclxl","vnd.hydrostatix.sof-data":"sfd-hdstx","vnd.ibm.minipay":"mpy","vnd.ibm.modcap":["afp","listafp","list3820"],"vnd.ibm.rights-management":"irm","vnd.ibm.secure-container":"sc","vnd.iccprofile":["icc","icm"],"vnd.igloader":"igl","vnd.immervision-ivp":"ivp","vnd.immervision-ivu":"ivu","vnd.insors.igm":"igm","vnd.intercon.formnet":["xpw","xpx"],"vnd.intergeo":"i2g","vnd.intu.qbo":"qbo","vnd.intu.qfx":"qfx","vnd.ipunplugged.rcprofile":"rcprofile","vnd.irepository.package+xml":"irp","vnd.is-xpr":"xpr","vnd.isac.fcs":"fcs","vnd.jam":"jam","vnd.jcp.javame.midlet-rms":"rms","vnd.jisp":"jisp","vnd.joost.joda-archive":"joda","vnd.kahootz":["ktz","ktr"],"vnd.kde.karbon":"karbon","vnd.kde.kchart":"chrt","vnd.kde.kformula":"kfo","vnd.kde.kivio":"flw","vnd.kde.kontour":"kon","vnd.kde.kpresenter":["kpr","kpt"],"vnd.kde.kspread":"ksp","vnd.kde.kword":["kwd","kwt"],"vnd.kenameaapp":"htke","vnd.kidspiration":"kia","vnd.kinar":["kne","knp"],"vnd.koan":["skp","skd","skt","skm"],"vnd.kodak-descriptor":"sse","vnd.las.las+xml":"lasxml","vnd.llamagraphics.life-balance.desktop":"lbd","vnd.llamagraphics.life-balance.exchange+xml":"lbe","vnd.lotus-1-2-3":"123","vnd.lotus-approach":"apr","vnd.lotus-freelance":"pre","vnd.lotus-notes":"nsf","vnd.lotus-organizer":"org","vnd.lotus-screencam":"scm","vnd.lotus-wordpro":"lwp","vnd.macports.portpkg":"portpkg","vnd.mcd":"mcd","vnd.medcalcdata":"mc1","vnd.mediastation.cdkey":"cdkey","vnd.mfer":"mwf","vnd.mfmp":"mfm","vnd.micrografx.flo":"flo","vnd.micrografx.igx":"igx","vnd.mif":"mif","vnd.mobius.daf":"daf","vnd.mobius.dis":"dis","vnd.mobius.mbk":"mbk","vnd.mobius.mqy":"mqy","vnd.mobius.msl":"msl","vnd.mobius.plc":"plc","vnd.mobius.txf":"txf","vnd.mophun.application":"mpn","vnd.mophun.certificate":"mpc","vnd.ms-artgalry":"cil","vnd.ms-cab-compressed":"cab","vnd.ms-excel.addin.macroenabled.12":"xlam","vnd.ms-excel.sheet.binary.macroenabled.12":"xlsb","vnd.ms-excel.sheet.macroenabled.12":"xlsm","vnd.ms-excel.template.macroenabled.12":"xltm","vnd.ms-fontobject":"eot","vnd.ms-htmlhelp":"chm","vnd.ms-ims":"ims","vnd.ms-lrm":"lrm","vnd.ms-officetheme":"thmx","vnd.ms-powerpoint.addin.macroenabled.12":"ppam","vnd.ms-powerpoint.presentation.macroenabled.12":"pptm","vnd.ms-powerpoint.slide.macroenabled.12":"sldm","vnd.ms-powerpoint.slideshow.macroenabled.12":"ppsm","vnd.ms-powerpoint.template.macroenabled.12":"potm","vnd.ms-project":["mpp","mpt"],"vnd.ms-word.document.macroenabled.12":"docm","vnd.ms-word.template.macroenabled.12":"dotm","vnd.ms-works":["wps","wks","wcm","wdb"],"vnd.ms-wpl":"wpl","vnd.ms-xpsdocument":"xps","vnd.mseq":"mseq","vnd.musician":"mus","vnd.muvee.style":"msty","vnd.mynfc":"taglet","vnd.neurolanguage.nlu":"nlu","vnd.nitf":["ntf","nitf"],"vnd.noblenet-directory":"nnd","vnd.noblenet-sealer":"nns","vnd.noblenet-web":"nnw","vnd.nokia.n-gage.data":"ngdat","vnd.nokia.n-gage.symbian.install":"n-gage","vnd.nokia.radio-preset":"rpst","vnd.nokia.radio-presets":"rpss","vnd.novadigm.edm":"edm","vnd.novadigm.edx":"edx","vnd.novadigm.ext":"ext","vnd.oasis.opendocument.chart-template":"otc","vnd.oasis.opendocument.formula-template":"odft","vnd.oasis.opendocument.image-template":"oti","vnd.olpc-sugar":"xo","vnd.oma.dd2+xml":"dd2","vnd.openofficeorg.extension":"oxt","vnd.openxmlformats-officedocument.presentationml.slide":"sldx","vnd.osgeo.mapguide.package":"mgp","vnd.osgi.dp":"dp","vnd.osgi.subsystem":"esa","vnd.palm":["pdb","pqa","oprc"],"vnd.pawaafile":"paw","vnd.pg.format":"str","vnd.pg.osasli":"ei6","vnd.picsel":"efif","vnd.pmi.widget":"wg","vnd.pocketlearn":"plf","vnd.powerbuilder6":"pbd","vnd.previewsystems.box":"box","vnd.proteus.magazine":"mgz","vnd.publishare-delta-tree":"qps","vnd.pvi.ptid1":"ptid","vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"vnd.realvnc.bed":"bed","vnd.recordare.musicxml":"mxl","vnd.recordare.musicxml+xml":"musicxml","vnd.rig.cryptonote":"cryptonote","vnd.rn-realmedia":"rm","vnd.rn-realmedia-vbr":"rmvb","vnd.route66.link66+xml":"link66","vnd.sailingtracker.track":"st","vnd.seemail":"see","vnd.sema":"sema","vnd.semd":"semd","vnd.semf":"semf","vnd.shana.informed.formdata":"ifm","vnd.shana.informed.formtemplate":"itp","vnd.shana.informed.interchange":"iif","vnd.shana.informed.package":"ipk","vnd.simtech-mindmapper":["twd","twds"],"vnd.smart.teacher":"teacher","vnd.solent.sdkm+xml":["sdkm","sdkd"],"vnd.spotfire.dxp":"dxp","vnd.spotfire.sfs":"sfs","vnd.stepmania.package":"smzip","vnd.stepmania.stepchart":"sm","vnd.sus-calendar":["sus","susp"],"vnd.svd":"svd","vnd.syncml+xml":"xsm","vnd.syncml.dm+wbxml":"bdm","vnd.syncml.dm+xml":"xdm","vnd.tao.intent-module-archive":"tao","vnd.tcpdump.pcap":["pcap","cap","dmp"],"vnd.tmobile-livetv":"tmo","vnd.trid.tpt":"tpt","vnd.triscape.mxs":"mxs","vnd.trueapp":"tra","vnd.ufdl":["ufd","ufdl"],"vnd.uiq.theme":"utz","vnd.umajin":"umj","vnd.unity":"unityweb","vnd.uoml+xml":"uoml","vnd.vcx":"vcx","vnd.visionary":"vis","vnd.vsf":"vsf","vnd.webturbo":"wtb","vnd.wolfram.player":"nbp","vnd.wqd":"wqd","vnd.wt.stf":"stf","vnd.xara":"xar","vnd.xfdl":"xfdl","vnd.yamaha.hv-dic":"hvd","vnd.yamaha.hv-script":"hvs","vnd.yamaha.hv-voice":"hvp","vnd.yamaha.openscoreformat":"osf","vnd.yamaha.openscoreformat.osfpvg+xml":"osfpvg","vnd.yamaha.smaf-audio":"saf","vnd.yamaha.smaf-phrase":"spf","vnd.yellowriver-custom-menu":"cmp","vnd.zul":["zir","zirz"],"vnd.zzazz.deck+xml":"zaz","voicexml+xml":"vxml",widget:"wgt",winhlp:"hlp","wsdl+xml":"wsdl","wspolicy+xml":"wspolicy","x-ace-compressed":"ace","x-authorware-bin":["aab","x32","u32","vox"],"x-authorware-map":"aam","x-authorware-seg":"aas","x-blorb":["blb","blorb"],"x-bzip":"bz","x-bzip2":["bz2","boz"],"x-cfs-compressed":"cfs","x-chat":"chat","x-conference":"nsc","x-dgc-compressed":"dgc","x-dtbncx+xml":"ncx","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-eva":"eva","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-otf":"otf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-font-woff":"woff","x-freearc":"arc","x-gca-compressed":"gca","x-glulx":"ulx","x-gramps-xml":"gramps","x-install-instructions":"install","x-lzh-compressed":["lzh","lha"],"x-mie":"mie","x-mobipocket-ebook":["prc","mobi"],"x-ms-application":"application","x-ms-shortcut":"lnk","x-ms-xbap":"xbap","x-msbinder":"obd","x-mscardfile":"crd","x-msclip":"clp","x-msdownload":["exe","dll","com","bat","msi"],"x-msmediaview":["mvb","m13","m14"],"x-msmetafile":["wmf","wmz","emf","emz"],"x-msmoney":"mny","x-mspublisher":"pub","x-msschedule":"scd","x-msterminal":"trm","x-mswrite":"wri","x-nzb":"nzb","x-pkcs12":["p12","pfx"],"x-pkcs7-certificates":["p7b","spc"],"x-research-info-systems":"ris","x-silverlight-app":"xap","x-sql":"sql","x-stuffitx":"sitx","x-subrip":"srt","x-t3vm-image":"t3","x-tads":"gam","x-tex":"tex","x-tex-tfm":"tfm","x-tgif":"obj","x-xliff+xml":"xlf","x-xz":"xz","x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"xaml+xml":"xaml","xcap-diff+xml":"xdf","xenc+xml":"xenc","xml-dtd":"dtd","xop+xml":"xop","xproc+xml":"xpl","xslt+xml":"xslt","xv+xml":["mxml","xhvml","xvml","xvm"],yang:"yang","yin+xml":"yin",envoy:"evy",fractals:"fif","internet-property-stream":"acx",olescript:"axs","vnd.ms-outlook":"msg","vnd.ms-pkicertstore":"sst","x-compress":"z","x-compressed":"tgz","x-gzip":"gz","x-perfmon":["pma","pmc","pml","pmr","pmw"],"x-pkcs7-mime":["p7c","p7m"],"ynd.ms-pkipko":"pko"},audio:{amr:"amr","amr-wb":"awb",annodex:"axa",basic:["au","snd"],flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp2","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"prs.sid":"sid","x-aiff":["aif","aiff","aifc"],"x-gsm":"gsm","x-ms-wma":"wma","x-ms-wax":"wax","x-pn-realaudio":"ram","x-realaudio":"ra","x-sd2":"sd2","x-wav":"wav",adpcm:"adp",mp4:"mp4a",s3m:"s3m",silk:"sil","vnd.dece.audio":["uva","uvva"],"vnd.digital-winds":"eol","vnd.dra":"dra","vnd.dts":"dts","vnd.dts.hd":"dtshd","vnd.lucent.voice":"lvp","vnd.ms-playready.media.pya":"pya","vnd.nuera.ecelp4800":"ecelp4800","vnd.nuera.ecelp7470":"ecelp7470","vnd.nuera.ecelp9600":"ecelp9600","vnd.rip":"rip",webm:"weba","x-aac":"aac","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",mid:["mid","rmi"]},chemical:{"x-alchemy":"alc","x-cache":["cac","cache"],"x-cache-csf":"csf","x-cactvs-binary":["cbin","cascii","ctab"],"x-cdx":"cdx","x-chem3d":"c3d","x-cif":"cif","x-cmdf":"cmdf","x-cml":"cml","x-compass":"cpa","x-crossfire":"bsd","x-csml":["csml","csm"],"x-ctx":"ctx","x-cxf":["cxf","cef"],"x-embl-dl-nucleotide":["emb","embl"],"x-gamess-input":["inp","gam","gamin"],"x-gaussian-checkpoint":["fch","fchk"],"x-gaussian-cube":"cub","x-gaussian-input":["gau","gjc","gjf"],"x-gaussian-log":"gal","x-gcg8-sequence":"gcg","x-genbank":"gen","x-hin":"hin","x-isostar":["istr","ist"],"x-jcamp-dx":["jdx","dx"],"x-kinemage":"kin","x-macmolecule":"mcm","x-macromodel-input":["mmd","mmod"],"x-mdl-molfile":"mol","x-mdl-rdfile":"rd","x-mdl-rxnfile":"rxn","x-mdl-sdfile":["sd","sdf"],"x-mdl-tgf":"tgf","x-mmcif":"mcif","x-mol2":"mol2","x-molconn-Z":"b","x-mopac-graph":"gpt","x-mopac-input":["mop","mopcrt","mpc","zmt"],"x-mopac-out":"moo","x-ncbi-asn1":"asn","x-ncbi-asn1-ascii":["prt","ent"],"x-ncbi-asn1-binary":["val","aso"],"x-pdb":["pdb","ent"],"x-rosdal":"ros","x-swissprot":"sw","x-vamas-iso14976":"vms","x-vmd":"vmd","x-xtel":"xtel","x-xyz":"xyz"},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"vnd.djvu":["djvu","djv"],"vnd.wap.wbmp":"wbmp","x-canon-cr2":"cr2","x-canon-crw":"crw","x-cmu-raster":"ras","x-coreldraw":"cdr","x-coreldrawpattern":"pat","x-coreldrawtemplate":"cdt","x-corelphotopaint":"cpt","x-epson-erf":"erf","x-icon":"ico","x-jg":"art","x-jng":"jng","x-nikon-nef":"nef","x-olympus-orf":"orf","x-photoshop":"psd","x-portable-anymap":"pnm","x-portable-bitmap":"pbm","x-portable-graymap":"pgm","x-portable-pixmap":"ppm","x-rgb":"rgb","x-xbitmap":"xbm","x-xpixmap":"xpm","x-xwindowdump":"xwd",bmp:"bmp",cgm:"cgm",g3fax:"g3",ktx:"ktx","prs.btif":"btif",sgi:"sgi","vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"vnd.dwg":"dwg","vnd.dxf":"dxf","vnd.fastbidsheet":"fbs","vnd.fpx":"fpx","vnd.fst":"fst","vnd.fujixerox.edmics-mmr":"mmr","vnd.fujixerox.edmics-rlc":"rlc","vnd.ms-modi":"mdi","vnd.ms-photo":"wdp","vnd.net-fpx":"npx","vnd.xiff":"xif",webp:"webp","x-3ds":"3ds","x-cmx":"cmx","x-freehand":["fh","fhc","fh4","fh5","fh7"],"x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod",pipeg:"jfif"},message:{rfc822:["eml","mime","mht","mhtml","nws"]},model:{iges:["igs","iges"],mesh:["msh","mesh","silo"],vrml:["wrl","vrml"],"x3d+vrml":["x3dv","x3dvz"],"x3d+xml":["x3d","x3dz"],"x3d+binary":["x3db","x3dbz"],"vnd.collada+xml":"dae","vnd.dwf":"dwf","vnd.gdl":"gdl","vnd.gtw":"gtw","vnd.mts":"mts","vnd.vtu":"vtu"},text:{"cache-manifest":["manifest","appcache"],calendar:["ics","icz","ifb"],css:"css",csv:"csv",h323:"323",html:["html","htm","shtml","stm"],iuls:"uls",mathml:"mml",plain:["txt","text","brf","conf","def","list","log","in","bas"],richtext:"rtx",scriptlet:["sct","wsc"],texmacs:["tm","ts"],"tab-separated-values":"tsv","vnd.sun.j2me.app-descriptor":"jad","vnd.wap.wml":"wml","vnd.wap.wmlscript":"wmls","x-bibtex":"bib","x-boo":"boo","x-c++hdr":["h++","hpp","hxx","hh"],"x-c++src":["c++","cpp","cxx","cc"],"x-component":"htc","x-dsrc":"d","x-diff":["diff","patch"],"x-haskell":"hs","x-java":"java","x-literate-haskell":"lhs","x-moc":"moc","x-pascal":["p","pas"],"x-pcs-gcd":"gcd","x-perl":["pl","pm"],"x-python":"py","x-scala":"scala","x-setext":"etx","x-tcl":["tcl","tk"],"x-tex":["tex","ltx","sty","cls"],"x-vcalendar":"vcs","x-vcard":"vcf",n3:"n3","prs.lines.tag":"dsc",sgml:["sgml","sgm"],troff:["t","tr","roff","man","me","ms"],turtle:"ttl","uri-list":["uri","uris","urls"],vcard:"vcard","vnd.curl":"curl","vnd.curl.dcurl":"dcurl","vnd.curl.scurl":"scurl","vnd.curl.mcurl":"mcurl","vnd.dvb.subtitle":"sub","vnd.fly":"fly","vnd.fmi.flexstor":"flx","vnd.graphviz":"gv","vnd.in3d.3dml":"3dml","vnd.in3d.spot":"spot","x-asm":["s","asm"],"x-c":["c","cc","cxx","cpp","h","hh","dic"],"x-fortran":["f","for","f77","f90"],"x-opml":"opml","x-nfo":"nfo","x-sfv":"sfv","x-uuencode":"uu",webviewhtml:"htt"},video:{avif:".avif","3gpp":"3gp",annodex:"axv",dl:"dl",dv:["dif","dv"],fli:"fli",gl:"gl",mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.dece.hd":["uvh","uvvh"],"vnd.dece.mobile":["uvm","uvvm"],"vnd.dece.pd":["uvp","uvvp"],"vnd.dece.sd":["uvs","uvvs"],"vnd.dece.video":["uvv","uvvv"],"vnd.dvb.file":"dvb","vnd.fvt":"fvt","vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv"},"x-conference":{"x-cooltalk":"ice"},"x-world":{"x-vrml":["vrm","vrml","wrl","flr","wrz","xaf","xof"]}},Bt=(()=>{const t={};for(let e in Rt)if(Rt.hasOwnProperty(e))for(let n in Rt[e])if(Rt[e].hasOwnProperty(n)){const s=Rt[e][n];if("string"==typeof s)t[s]=e+"/"+n;else for(let i=0;i<s.length;i++)t[s[i]]=e+"/"+n}return t})();t.BlobReader=p,t.BlobWriter=l,t.Data64URIReader=d,t.Data64URIWriter=c,t.HttpRangeReader=h,t.HttpReader=m,t.Reader=i,t.TextReader=a,t.TextWriter=o,t.Uint8ArrayReader=class extends i{constructor(t){super(),this.array=t,this.size=t.length}readUint8Array(t,e){return this.array.slice(t,t+e)}},t.Uint8ArrayWriter=f,t.Writer=r,t.ZipReader=vt,t.ZipWriter=gt,t.configure=function(t){ut=Object.assign({},ut,t)},t.fs=zt,t.getMimeType=function(t){return t&&Bt[t.split(".").pop().toLowerCase()]||"application/octet-stream"},t.initShimAsyncCodec=(t,e={})=>({ZipDeflate:ft(t.Deflate,e.deflate),ZipInflate:ft(t.Inflate,e.inflate)}),Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).zip={})}(this,(function(e){"use strict";const t="HTTP error ",n="text/plain";class s{constructor(){this.size=0}init(){this.initialized=!0}}class i extends s{}class r extends s{writeUint8Array(e){this.size+=e.length}}class a extends i{constructor(e){super(),this.blobReader=new p(new Blob([e],{type:n}))}init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}readUint8Array(e,t){return this.blobReader.readUint8Array(e,t)}}class o extends r{constructor(e){super(),this.encoding=e,this.blob=new Blob([],{type:n})}writeUint8Array(e){super.writeUint8Array(e),this.blob=new Blob([this.blob,e.buffer],{type:n})}getData(){const e=new FileReader;return new Promise(((t,n)=>{e.onload=e=>t(e.target.result),e.onerror=n,e.readAsText(this.blob,this.encoding)}))}}class d extends i{constructor(e){super(),this.dataURI=e;let t=e.length;for(;"="==e.charAt(t-1);)t--;this.dataStart=e.indexOf(",")+1,this.size=Math.floor(.75*(t-this.dataStart))}readUint8Array(e,t){const n=new Uint8Array(t),s=4*Math.floor(e/3),i=atob(this.dataURI.substring(s+this.dataStart,4*Math.ceil((e+t)/3)+this.dataStart)),r=e-3*Math.floor(s/4);for(let e=r;e<r+t;e++)n[e-r]=i.charCodeAt(e);return n}}class c extends r{constructor(e){super(),this.data="data:"+(e||"")+";base64,",this.pending=[]}writeUint8Array(e){super.writeUint8Array(e);let t=0,n=this.pending;const s=this.pending.length;for(this.pending="",t=0;t<3*Math.floor((s+e.length)/3)-s;t++)n+=String.fromCharCode(e[t]);for(;t<e.length;t++)this.pending+=String.fromCharCode(e[t]);n.length>2?this.data+=btoa(n):this.pending=n}getData(){return this.data+btoa(this.pending)}}class p extends i{constructor(e){super(),this.blob=e,this.size=e.size}readUint8Array(e,t){const n=new FileReader;return new Promise(((s,i)=>{n.onload=e=>s(new Uint8Array(e.target.result)),n.onerror=i,n.readAsArrayBuffer(this.blob.slice(e,e+t))}))}}class l extends r{constructor(e){super(),this.offset=0,this.contentType=e,this.blob=new Blob([],{type:e})}writeUint8Array(e){super.writeUint8Array(e),this.blob=new Blob([this.blob,e.buffer],{type:this.contentType}),this.offset=this.blob.size}getData(){return this.blob}}class m extends i{constructor(e){super(),this.url=e}async init(){if(super.init(),function(e){if("undefined"!=typeof document){const t=document.createElement("a");return t.href=e,"http:"==t.protocol||"https:"==t.protocol}return/^https?:\/\//i.test(e)}(this.url))return new Promise(((e,n)=>{const s=new XMLHttpRequest;s.addEventListener("load",(()=>{s.status<400?(this.size=Number(s.getResponseHeader("Content-Length")),this.size?e():x().then((()=>e())).catch(n)):n(t+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",n,!1),s.open("HEAD",this.url),s.send()}));await x()}async readUint8Array(e,t){return this.data||await x(this,this.url),new Uint8Array(this.data.subarray(e,e+t))}}class h extends i{constructor(e){super(),this.url=e}init(){return super.init(),new Promise(((e,n)=>{const s=new XMLHttpRequest;s.addEventListener("load",(()=>{s.status<400?(this.size=Number(s.getResponseHeader("Content-Length")),"bytes"==s.getResponseHeader("Accept-Ranges")?e():n(new Error("HTTP Range not supported"))):n(t+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",n,!1),s.open("HEAD",this.url),s.send()}))}readUint8Array(e,n){return new Promise(((s,i)=>{const r=new XMLHttpRequest;r.open("GET",this.url),r.responseType="arraybuffer",r.setRequestHeader("Range","bytes="+e+"-"+(e+n-1)),r.addEventListener("load",(()=>{r.status<400?s(new Uint8Array(r.response)):i(t+(r.statusText||r.status)+".")}),!1),r.addEventListener("error",i,!1),r.send()}))}}class f extends r{constructor(){super(),this.array=new Uint8Array(0)}writeUint8Array(e){super.writeUint8Array(e);const t=this.array;this.array=new Uint8Array(t.length+e.length),this.array.set(t),this.array.set(e,t.length)}getData(){return this.array}}function x(e,n){return new Promise(((s,i)=>{const r=new XMLHttpRequest;r.addEventListener("load",(()=>{r.status<400?(e.size||(e.size=Number(r.getResponseHeader("Content-Length"))||Number(r.response.byteLength)),e.data=new Uint8Array(r.response),s()):i(t+(r.statusText||r.status)+".")}),!1),r.addEventListener("error",i,!1),r.open("GET",n),r.responseType="arraybuffer",r.send()}))}const u=4294967295,g=65535,v=1347093252,w=1347094280,y=1347092738,b=1347093766,k=1347094022,U=1347094023;class z{constructor(){this.crc=-1,this.table=(()=>{const e=[];for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)1&n?n=n>>>1^3988292384:n>>>=1;e[t]=n}return e})()}append(e){const t=this.table;let n=0|this.crc;for(let s=0,i=0|e.length;s<i;s++)n=n>>>8^t[255&(n^e[s])];this.crc=n}get(){return~this.crc}}const A="Invalid pasword",j=16,E="raw",D={name:"PBKDF2"},F={name:"HMAC"},R="SHA-1",B={name:"AES-CTR"},S=Object.assign({hash:F},D),q=Object.assign({iterations:1e3,hash:{name:R}},D),I=Object.assign({hash:R},F),L=Object.assign({length:j},B),M=["deriveBits"],C=["sign"],T=528,P=10,W=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],V=crypto.subtle;class Z{constructor(e,t){this.password=e,this.signed=t,this.input=t&&new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(e){const t=async(i=0)=>{if(i+j<=s.length-P){const e=s.subarray(i,i+j),r=await V.decrypt(Object.assign({counter:this.counter},L),this.keys.decrypt,e);return O(this.counter),n.set(new Uint8Array(r),i),t(i+j)}return this.pendingInput=s.subarray(i),this.signed&&(this.input=N(this.input,e)),n};if(this.password){const t=e.subarray(0,18);await async function(e,t,n){e.counter=new Uint8Array(W);const s=t.subarray(0,16),i=t.subarray(16),r=(new TextEncoder).encode(n),a=await V.importKey(E,r,S,!1,M),o=await V.deriveBits(Object.assign({salt:s},q),a,528),d=new Uint8Array(o),c=d.subarray(64);if(e.keys={decrypt:await V.importKey(E,d.subarray(0,32),B,!0,["decrypt"]),authentication:await V.importKey(E,d.subarray(32,64),I,!1,C),passwordVerification:c},c[0]!=i[0]||c[1]!=i[1])throw new Error(A)}(this,t,this.password),this.password=null,e=e.subarray(18)}let n=new Uint8Array(e.length-P-(e.length-P)%j),s=e;return this.pendingInput.length&&(s=N(this.pendingInput,e),n=K(n,s.length-P-(s.length-P)%j)),t()}async flush(){const e=this.pendingInput,t=this.keys,n=e.subarray(0,e.length-P),s=e.subarray(e.length-P);let i=new Uint8Array(0);if(n.length){const e=await V.decrypt(Object.assign({counter:this.counter},L),t.decrypt,n);i=new Uint8Array(e)}let r=!0;if(this.signed){const e=await V.sign(F,t.authentication,this.input.subarray(0,this.input.length-P)),n=new Uint8Array(e);this.input=null;for(let e=0;e<P;e++)n[e]!=s[e]&&(r=!1)}return{valid:r,data:i}}}class H{constructor(e){this.password=e,this.output=new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(e){const t=async(i=0)=>{if(i+j<=e.length){const r=e.subarray(i,i+j),a=await V.encrypt(Object.assign({counter:this.counter},L),this.keys.encrypt,r);return O(this.counter),s.set(new Uint8Array(a),i+n.length),t(i+j)}return this.pendingInput=e.subarray(i),this.output=N(this.output,s),s};let n=new Uint8Array(0);this.password&&(n=await async function(e,t){e.counter=new Uint8Array(W);const n=crypto.getRandomValues(new Uint8Array(16)),s=(new TextEncoder).encode(t),i=await V.importKey(E,s,S,!1,M),r=await V.deriveBits(Object.assign({salt:n},q),i,T),a=new Uint8Array(r);return e.keys={encrypt:await V.importKey(E,a.subarray(0,32),B,!0,["encrypt"]),authentication:await V.importKey(E,a.subarray(32,64),I,!1,C),passwordVerification:a.subarray(64)},N(n,e.keys.passwordVerification)}(this,this.password),this.password=null);let s=new Uint8Array(n.length+e.length-e.length%j);return s.set(n,0),this.pendingInput.length&&(e=N(this.pendingInput,e),s=K(s,e.length-e.length%j)),t()}async flush(){let e=new Uint8Array(0);if(this.pendingInput.length){const t=await V.encrypt(Object.assign({counter:this.counter},L),this.keys.encrypt,this.pendingInput);e=new Uint8Array(t),this.output=N(this.output,e)}const t=await V.sign(F,this.keys.authentication,this.output.subarray(18));this.output=null;const n=new Uint8Array(t).subarray(0,P);return{data:N(e,n),signature:n}}}function O(e){for(let t=0;t<16;t++){if(255!=e[t]){e[t]++;break}e[t]=0}}function N(e,t){let n=e;return e.length+t.length&&(n=new Uint8Array(e.length+t.length),n.set(e,0),n.set(t,e.length)),n}function K(e,t){if(t&&t>e.length){const n=e;(e=new Uint8Array(t)).set(n,0)}return e}const X="deflate",_="inflate",G="Invalid signature";class Y{constructor(e){this.signature=e.inputSignature,this.encrypted=Boolean(e.inputPassword),this.signed=e.inputSigned,this.compressed=e.inputCompressed,this.inflate=this.compressed&&new ZipInflate,this.crc32=this.signed&&this.signed&&new z,this.decrypt=this.encrypted&&new Z(e.inputPassword)}async append(e){return this.encrypted&&(e=await this.decrypt.append(e)),this.compressed&&e.length&&(e=await this.inflate.append(e)),!this.encrypted&&this.signed&&this.crc32.append(e),e}async flush(){let e,t=new Uint8Array(0);if(this.encrypted){const e=await this.decrypt.flush();if(!e.valid)throw new Error(G);t=e.data}else if(this.signed){const t=new DataView(new Uint8Array(4).buffer);if(e=this.crc32.get(),t.setUint32(0,e),this.signature!=t.getUint32(0,!1))throw new Error(G)}return this.compressed&&(t=await this.inflate.append(t)||new Uint8Array(0),await this.inflate.flush()),{data:t,signature:e}}}class J{constructor(e){this.encrypted=e.outputEncrypted,this.signed=e.outputSigned,this.compressed=e.outputCompressed,this.deflate=this.compressed&&new ZipDeflate({level:e.level||5}),this.crc32=this.signed&&new z,this.encrypt=this.encrypted&&new H(e.outputPassword)}async append(e){let t=e;return this.compressed&&e.length&&(t=await this.deflate.append(e)),this.encrypted?t=await this.encrypt.append(t):this.signed&&this.crc32.append(e),t}async flush(){let e,t=new Uint8Array(0);if(this.compressed&&(t=await this.deflate.flush()||new Uint8Array(0)),this.encrypted){t=await this.encrypt.append(t);const n=await this.encrypt.flush();e=n.signature;const s=new Uint8Array(t.length+n.data.length);s.set(t,0),s.set(n.data,t.length),t=s}else this.signed&&(e=this.crc32.get());return{data:t,signature:e}}}const Q="init",$="append",ee="flush",te="message",ne="z-worker.js",se={deflate:[ne,"deflate.js"],inflate:[ne,"inflate.js"]},ie={pool:[],pendingRequests:[]};function re(e,t){const n=ie.pool;let s;if(e.useWebWorkers){const n=t.codecType;if(null!=e.workerScripts&&null!=e.workerScriptsPath)throw new Error("Either workerScripts or workerScriptsPath may be set, not both");if(e.workerScripts){if(s=e.workerScripts[n],!Array.isArray(s))throw new Error("workerScripts."+n+" must be an array");i=s,s="undefined"!=typeof document?i.map((e=>new URL(e,document.baseURI).href)):i}else s=se[n].slice(0),s[0]=(e.workerScriptsPath||"")+s[0]}var i;if(n.length<e.maxWorkers){const e={worker:s&&new Worker(s[0]),busy:!0,options:t,scripts:s};return n.push(e),s?function(e){const t=e.worker;let n;return t.addEventListener(te,r,!1),e.interface={append:async e=>s({type:$,data:e}),flush:async()=>s({type:ee})},e.interface;async function s(t){if(!n){const t=e.scripts.slice(1);await i(Object.assign({type:Q,options:e.options,scripts:t}))}return i(t)}function i(s){try{if(s.data)try{t.postMessage(s,[s.data.buffer])}catch(e){t.postMessage(s)}else t.postMessage(s)}catch(t){n.reject(t),n=null,de(e)}return new Promise(((e,t)=>n={resolve:e,reject:t}))}function r(t){const s=t.data;if(n){const t=s.error;if(t){const s=new Error(t.message);s.stack=t.stack,n.reject(s),n=null,de(e)}else s.type!=Q&&s.type!=ee&&s.type!=$||(s.type==ee?(n.resolve({data:new Uint8Array(s.data),signature:s.signature}),n=null,de(e)):n.resolve(s.data&&new Uint8Array(s.data)))}}}(e):ae(e)}{const e=n.find((e=>!e.busy));return e?(e.busy=!0,e.options=t,e.scripts=s,s?e.interface:ae(e)):new Promise((e=>ie.pendingRequests.push({resolve:e,options:t,scripts:s})))}}function ae(e){const t=(n=e.options).codecType.startsWith(X)?new J(n):n.codecType.startsWith(_)?new Y(n):void 0;var n;const s=t.append.bind(t),i=t.flush.bind(t);return t.append=async t=>{try{return await s(t)}catch(t){throw await oe(e),t}},t.flush=async()=>{try{return await i()}finally{await oe(e)}},t}async function oe(e){if(e.busy=!1,ie.pendingRequests.length){const[{resolve:t,options:n}]=ie.pendingRequests.splice(0,1);e.busy=!0,e.options=n,t(ae(e))}else ie.pool=ie.pool.filter((t=>t!=e))}function de(e){if(e.busy=!1,ie.pendingRequests.length){const[{resolve:t,options:n,scripts:s}]=ie.pendingRequests.splice(0,1);e.busy=!0,e.options=n,e.scripts=s,t(e.interface)}else e.worker.terminate(),ie.pool=ie.pool.filter((t=>t!=e))}async function ce(e,t,n,s,i,r,a){const o=Math.max(r.chunkSize,64);return async function r(d=0,c=0){const p=d*o;if(p<i){const l=await t.readUint8Array(p+s,Math.min(o,i-p)),m=await e.append(l);return c+=await pe(n,m),a.onprogress&&a.onprogress(p+l.length,i),r(d+1,c)}{const t=await e.flush();return c+=await pe(n,t.data),{signature:t.signature,length:c}}}()}async function pe(e,t){return t.length&&await e.writeUint8Array(t),t.length}const le="File format is not recognized",me="End of central directory not found",he="Zip64 extra field not found",fe="Compression method not supported",xe="utf-8",ue="windows-1252";class ge{constructor(e,t,n){this.reader=e,this.config=t,this.options=n}async getData(e,t={}){const n=this.reader;n.initialized||await n.init();const s=await n.readUint8Array(this.offset,30),i=new DataView(s.buffer),r=void 0===t.password?this.options.password:t.password;let a=r&&r.length&&r;if(this.extraFieldAES){if(99!=this.extraFieldAES.originalCompressionMethod)throw new Error(fe);if(3!=this.extraFieldAES.strength)throw new Error("Encryption not supported")}if(0!=this.compressionMethod&&8!=this.compressionMethod)throw new Error(fe);if(i.getUint32(0,!1)!=v)throw new Error("Local file header not found");const o=this.localDirectory={};ve(o,i,4),o.rawExtraField=s.subarray(this.offset+30+o.filenameLength,this.offset+30+o.filenameLength+o.extraFieldLength),we(this,o,i,4);let d=this.offset+30+o.filenameLength+o.extraFieldLength;const c=this.bitFlag.encrypted&&o.bitFlag.encrypted;if(c&&!a)throw new Error("File contains encrypted entry");const p=await re(this.config,{codecType:_,inputPassword:a,inputSigned:void 0===t.checkSignature?this.options.checkSignature:t.checkSignature,inputSignature:this.signature,inputCompressed:0!=this.compressionMethod,inputEncrypted:c});return e.initialized||await e.init(),await ce(p,n,e,d,this.compressedSize,this.config,{onprogress:t.onprogress}),e.getData()}}function ve(e,t,n){e.version=t.getUint16(n,!0);const s=e.rawBitFlag=t.getUint16(n+2,!0);e.bitFlag={encrypted:1==(1&s),level:(6&s)>>1,dataDescriptor:8==(8&s),languageEncodingFlag:2048==(2048&s)},e.encrypted=e.bitFlag.encrypted,e.rawLastModDate=t.getUint32(n+6,!0),e.lastModDate=function(e){const t=(4294901760&e)>>16,n=65535&e;try{return new Date(1980+((65024&t)>>9),((480&t)>>5)-1,31&t,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch(e){}}(e.rawLastModDate),e.filenameLength=t.getUint16(n+22,!0),e.extraFieldLength=t.getUint16(n+24,!0)}function we(e,t,n,s){let i,r,a;const o=t.rawExtraField,d=t.extraField=new Map,c=new DataView(new Uint8Array(o).buffer);let p=0;try{for(;p<o.length;){const e=c.getUint16(p,!0),t=c.getUint16(p+2,!0);d.set(e,{type:e,data:o.slice(p+4,p+4+t)}),p+=4+t}}catch(e){}const l=n.getUint16(s+4,!0);t.signature=n.getUint32(s+10,!0),t.uncompressedSize=n.getUint32(s+18,!0),t.compressedSize=n.getUint32(s+14,!0),i=t.extraFieldZip64=d.get(1),i&&function(e,t){t.zip64=!0;const n=new DataView(e.data.buffer);e.values=[];for(let t=0;t<Math.floor(e.data.length/8);t++)e.values.push(Number(n.getBigUint64(0+8*t,!0)));const s=["uncompressedSize","compressedSize","offset"],i=s.filter((e=>t[e]==u));for(let t=0;t<i.length;t++)e[i[t]]=e.values[t];s.forEach((n=>{if(t[n]==u){if(!e||void 0===e[n])throw new Error(he);t[n]=e&&e[n]}}))}(i,t),a=t.extraFieldUnicodePath=d.get(28789),a&&function(e,t,n){const s=new DataView(e.data.buffer);e.version=s.getUint8(0),e.signature=s.getUint32(1,!0);const i=new z;i.append(n.rawFilename);const r=new DataView(new Uint8Array(4).buffer);r.setUint32(0,i.get()),e.filename=(new TextDecoder).decode(e.data.subarray(5)),e.signature==r.getUint32(0,!1)&&(t.filename=e.filename)}(a,t,e),r=t.extraFieldAES=d.get(39169),r?function(e,t,n){if(e){const s=new DataView(e.data.buffer);e.vendorVersion=s.getUint8(0),e.vendorId=s.getUint8(2);const i=s.getUint8(4);e.strength=i,e.originalCompressionMethod=n,t.compressionMethod=e.compressionMethod=s.getUint16(5,!0)}else t.compressionMethod=n}(r,t,l):t.compressionMethod=l,8==t.compressionMethod&&(t.bitFlag.enhancedDeflating=16!=(16&t.rawBitFlag))}function ye(e,t){return new TextDecoder(t).decode(e)}const be="File entry name exceeds 64KB",ke="Version exceeds 65535",Ue="Extra field type exceeds 65535",ze="Extra field data exceeds 64KB";function Ae(e){return unescape(encodeURIComponent(e))}function je(e){const t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t}const Ee="function";function De(e,t){return class{constructor(n){const s=e=>{if(this.pendingData){const t=this.pendingData;this.pendingData=new Uint8Array(t.length+e.length),this.pendingData.set(t,0),this.pendingData.set(e,t.length)}else this.pendingData=new Uint8Array(e)};if(this.codec=new e(Object.assign({},t,n)),typeof this.codec.onData==Ee)this.codec.onData=s;else{if(typeof this.codec.on!=Ee)throw new Error("Cannot register the callback function");this.codec.on("data",s)}}async append(e){return this.codec.push(e),n(this)}async flush(){return this.codec.push(new Uint8Array(0),!0),n(this)}};function n(e){if(e.pendingData){const t=e.pendingData;return e.pendingData=null,t}return new Uint8Array(0)}}const Fe={chunkSize:524288,maxWorkers:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,workerScriptsPath:void 0,useWebWorkers:!0};let Re=Object.assign({},Fe);class Be extends class{constructor(e,t={},n={}){this.reader=e,this.options=t,this.config=n}async getEntries(){const e=this.reader;e.initialized||await e.init();const t=await async function(e,t,n,s){const i=new Uint8Array(4);if(new DataView(i.buffer).setUint32(0,t),e.size<n)throw new Error(le);const r=n+s;let a=n,o=await d(a);o||(o=await d(Math.min(r,e.size)));if(!o)throw new Error(me);return o;async function d(t){const s=e.size-t,r=await e.readUint8Array(s,t);for(let e=r.length-n;e>=0;e--)if(r[e]==i[0]&&r[e+1]==i[1]&&r[e+2]==i[2]&&r[e+3]==i[3])return{offset:s,buffer:r.slice(e,e+n).buffer}}}(e,b,22,g);let n,s=new DataView(t.buffer),i=s.getUint32(16,!0),r=s.getUint16(8,!0);if(i==u||r==g){n=!0;const s=await e.readUint8Array(t.offset-20,20),a=new DataView(s.buffer);if(Number(a.getUint32(0,!1))!=U)throw new Error("End of Zip64 central directory not found");i=Number(a.getBigUint64(8,!0));const o=await e.readUint8Array(i,56),d=new DataView(o.buffer);if(Number(d.getUint32(0,!1))!=k)throw new Error("End of Zip64 central directory locator not found");r=Number(d.getBigUint64(24,!0)),i-=Number(d.getBigUint64(40,!0))}if(i<0||!n&&(i>=e.size||r>=g))throw new Error(le);const a=await e.readUint8Array(i,e.size-i);s=new DataView(a.buffer);const o=[];let d=0;for(let e=0;e<r;e++){const e=new ge(this.reader,this.config,this.options);if(s.getUint32(d,!1)!=y)throw new Error("Central directory header not found");e.compressedSize=0,e.uncompressedSize=0,ve(e,s,d+6),e.commentLength=s.getUint16(d+32,!0),e.directory=16==(16&s.getUint8(d+38)),e.offset=s.getUint32(d+42,!0),e.rawFilename=a.subarray(d+46,d+46+e.filenameLength),e.filename=ye(e.rawFilename,e.bitFlag.languageEncodingFlag?xe:this.options.filenameEncoding||ue),e.directory||"/"!=e.filename.charAt(e.filename.length-1)||(e.directory=!0),e.rawExtraField=a.subarray(d+46+e.filenameLength,d+46+e.filenameLength+e.extraFieldLength),we(e,e,s,d+6),e.rawComment=a.subarray(d+46+e.filenameLength+e.extraFieldLength,d+46+e.filenameLength+e.extraFieldLength+e.commentLength),e.comment=ye(e.rawComment,e.bitFlag.languageEncodingFlag?xe:this.options.commentEncoding||ue),o.push(e),d+=46+e.filenameLength+e.extraFieldLength+e.commentLength}return o}async close(){}}{constructor(e,t){super(e,t,Re)}}class Se extends class{constructor(e,t={},n={}){this.writer=e,this.options=t,this.config=n,this.files=new Map,this.offset=e.size,this.zip64=t.zip64}async add(e,t,n={}){if(e=e.trim(),n.directory&&e.length&&"/"!=e.charAt(e.length-1)&&(e+="/"),this.files.has(e))throw new Error("File already exists");if(n.comment=je(Ae(n.comment||"")),n.comment.length>g)throw new Error("File entry comment exceeds 64KB");n.zip64=n.zip64||this.zip64,await async function(e,t,n,s){const i=e.files,r=e.writer;let a;i.set(t,null);try{let o,d;try{s.bufferedWrite||e.options.bufferedWrite||e.lockWrite?(o=new f,o.init()):(e.lockWrite=new Promise((e=>a=e)),r.initialized||await r.init(),o=r),(e.offset>=u||n&&(n.size>=u||e.offset+n.size>=u))&&(s.zip64=!0),d=await async function(e,t,n,s,i,r){const a=je(Ae(e)),o=r.lastModDate||new Date,d=new Uint8Array(26),c=new DataView(d.buffer),p=void 0===r.password?i.password:r.password,l=p&&p.length&&p,m=void 0===r.level?i.level:r.level,h=0!==m&&!r.directory,f=void 0===p||!p.length,x=r.zip64,y={zip64:x,headerArray:d,directory:r.directory,filename:a,comment:r.comment,extraFieldZip64:x?new Uint8Array(28):new Uint8Array(0),extraFieldAES:l?new Uint8Array([1,153,7,0,2,0,65,69,3,0,0]):new Uint8Array(0),rawExtraField:new Uint8Array(0)},b=r.extraField;if(a.length>g)throw new Error(be);if(b){let e=4,t=0;b.forEach((t=>e+=t.length));const n=y.rawExtraField=new Uint8Array(e);b.forEach(((e,s)=>{if(s>g)throw new Error(Ue);if(e.length>g)throw new Error(ze);n.set(new Uint16Array([s]),t),n.set(new Uint16Array([e.length]),t+2),n.set(e,t+4),t+=4+e.length}))}if(r.bitFlag=8,r.version=(void 0===r.version?i.version:r.version)||20,r.version>g)throw new Error(ke);r.compressionMethod=0,h&&(r.compressionMethod=8);x&&(r.version=r.version>45?r.version:45);l&&(r.version=r.version>51?r.version:51,r.bitFlag=9,r.compressionMethod=99,h&&(y.extraFieldAES[9]=8));c.setUint16(0,r.version,!0),c.setUint16(2,r.bitFlag,!0),c.setUint16(4,r.compressionMethod,!0),c.setUint16(6,(o.getHours()<<6|o.getMinutes())<<5|o.getSeconds()/2,!0),c.setUint16(8,(o.getFullYear()-1980<<4|o.getMonth()+1)<<5|o.getDate(),!0),c.setUint16(22,a.length,!0),c.setUint16(24,0,!0);const k=new Uint8Array(30+a.length);let U;if(new DataView(k.buffer).setUint32(0,v),k.set(d,4),k.set(a,30),t){t.initialized||await t.init();const e=await re(s,{codecType:X,level:m,outputPassword:p,outputSigned:f,outputCompressed:h,outputEncrypted:Boolean(p)});await n.writeUint8Array(k),U=await ce(e,t,n,0,t.size,s,{onprogress:r.onprogress}),y.compressedSize=U.length}else await n.writeUint8Array(k);const z=new Uint8Array(x?24:16),A=new DataView(z.buffer);if(A.setUint32(0,w),t)if(l||void 0===U.signature||(c.setUint32(10,U.signature,!0),A.setUint32(4,U.signature,!0)),x){c.setUint32(14,u,!0),A.setBigUint64(8,BigInt(y.compressedSize),!0),c.setUint32(18,u,!0),A.setBigUint64(16,BigInt(t.size),!0);const e=new DataView(y.extraFieldZip64.buffer);e.setUint16(0,1,!0),e.setUint16(2,24,!0),e.setBigUint64(4,BigInt(t.size),!0),e.setBigUint64(12,BigInt(y.compressedSize),!0)}else c.setUint32(14,y.compressedSize,!0),A.setUint32(8,y.compressedSize,!0),c.setUint32(18,t.size,!0),A.setUint32(12,t.size,!0);return await n.writeUint8Array(z),y.length=k.length+(U?U.length:0)+z.length,y}(t,n,o,e.config,e.options,s)}catch(e){throw i.delete(t),e}if(i.set(t,d),o!=r&&(e.lockWrite&&await e.lockWrite,await r.writeUint8Array(o.getData())),d.offset=e.offset,d.zip64){new DataView(d.extraFieldZip64.buffer).setBigUint64(20,BigInt(d.offset),!0)}e.offset+=d.length}finally{a&&(e.lockWrite=null,a())}}(this,e,t,n)}async close(e){const t=this.writer,n=this.files;let s=0,i=0,r=this.offset,a=n.size;if(e&&e.length){if(!(e.length<=g))throw new Error("Zip file comment exceeds 64KB");d.setUint16(s+20,e.length,!0)}for(const[,e]of n)i+=46+e.filename.length+e.comment.length+e.extraFieldZip64.length+e.extraFieldAES.length+e.rawExtraField.length;(r+i>=u||a>=g)&&(this.zip64=!0);const o=new Uint8Array(i+(this.zip64?98:22)),d=new DataView(o.buffer);for(const[,e]of n){const t=e.filename,n=e.extraFieldZip64,i=e.extraFieldAES,r=n.length+i.length+e.rawExtraField.length;d.setUint32(s,y),e.zip64?d.setUint16(s+4,11520):d.setUint16(s+4,5120),o.set(e.headerArray,s+6),d.setUint16(s+30,r,!0),d.setUint16(s+32,e.comment.length,!0),e.directory&&d.setUint8(s+38,16),e.zip64?d.setUint32(s+42,u,!0):d.setUint32(s+42,e.offset,!0),o.set(t,s+46),o.set(n,s+46+t.length),o.set(i,s+46+t.length+n.length),o.set(e.rawExtraField,46+t.length+n.length+i.length),o.set(e.comment,s+46+t.length+r),s+=46+t.length+r+e.comment.length}return this.zip64&&(d.setUint32(s,k),d.setBigUint64(s+4,BigInt(44),!0),d.setUint16(s+12,45,!0),d.setUint16(s+14,45,!0),d.setBigUint64(s+24,BigInt(a),!0),d.setBigUint64(s+32,BigInt(a),!0),d.setBigUint64(s+40,BigInt(i),!0),d.setBigUint64(s+48,BigInt(r),!0),d.setUint32(s+56,U),d.setBigUint64(s+64,BigInt(r+i),!0),d.setUint32(s+72,1,!0),a=g,r=u,s+=76),d.setUint32(s,b),d.setUint16(s+8,a,!0),d.setUint16(s+10,a,!0),d.setUint32(s+12,i,!0),d.setUint32(s+16,r,!0),await t.writeUint8Array(o),e&&e.length&&await t.writeUint8Array(e),t.getData()}}{constructor(e,t){super(e,t,Re)}}const qe=524288;class Ie{constructor(e,t,n,s){if(e.root&&s&&s.getChildByName(t))throw new Error("Entry filename already exists");n||(n={}),this.fs=e,this.name=t,this.id=e.entries.length,this.parent=s,this.children=[],this.zipVersion=n.zipVersion||20,this.uncompressedSize=0,e.entries.push(this),s&&this.parent.children.push(this)}moveTo(e){if(!e.directory)throw"Target entry is not a directory";if(e.isDescendantOf(this))throw"Entry is a ancestor of target entry";if(this!=e){if(e.getChildByName(this.name))throw"Entry filename already exists";Ve(this),this.parent=e,e.children.push(this)}}getFullname(){let e=this.name,t=this.parent;for(;t;)e=(t.name?t.name+"/":"")+e,t=t.parent;return e}isDescendantOf(e){let t=this.parent;for(;t&&t.id!=e.id;)t=t.parent;return Boolean(t)}}class Le extends Ie{constructor(e,t,n,s){super(e,t,n,s),this.Reader=n.Reader,this.Writer=n.Writer,this.data=n.data,n.getData&&(this.getData=n.getData)}async getData(e,t={}){return!e||e.constructor==this.Writer&&this.data?this.data:(this.reader||(this.reader=new this.Reader(this.data)),await this.reader.init(),await e.init(),this.uncompressedSize=this.reader.size,async function(e,t,n){return s();async function s(i=0){const r=i*qe;if(n.onprogress&&n.onprogress(r,e.size),r<e.size){const n=await e.readUint8Array(r,Math.min(qe,e.size-r));return await t.writeUint8Array(n),s(i+1)}return t.getData()}}(this.reader,e,t))}getText(e,t){return this.getData(new o(e),t)}getBlob(e,t){return this.getData(new l(e),t)}getData64URI(e,t){return this.getData(new c(e),t)}}class Me extends Ie{constructor(e,t,n,s){super(e,t,n,s),this.directory=!0}addDirectory(e){return He(this,e,null,!0)}addText(e,t){return He(this,e,{data:t,Reader:a,Writer:o})}addBlob(e,t){return He(this,e,{data:t,Reader:p,Writer:l})}addData64URI(e,t){return He(this,e,{data:t,Reader:d,Writer:c})}addHttpContent(e,t,n={}){return He(this,e,{data:t,Reader:n.useRangeHeader?h:m})}addFileEntry(e){!async function(e,t){t.isDirectory?await s(e,t):await new Promise(((n,s)=>{t.file((s=>{e.addBlob(t.name,s),n()}),s)}));function n(e){return new Promise(((t,n)=>{let s=[];function i(e){e.readEntries((n=>{n.length?(s=s.concat(n),i(e)):t(s)}),n)}e.isDirectory&&i(e.createReader()),e.isFile&&t(s)}))}async function s(e,t){const i=await n(t);for(const t of i)t.isDirectory&&await s(e.addDirectory(t.name)),await new Promise(((n,s)=>{t.isFile&&t.file((s=>{const i=e.addBlob(t.name,s);i.uncompressedSize=s.size,n(i)}),s)}))}}(this,e)}async addData(e,t){return He(this,e,t)}async importBlob(e,t={}){await this.importZip(new p(e),t)}async importData64URI(e,t={}){await this.importZip(new d(e),t)}async importHttpContent(e,t={}){await this.importZip(t.useRangeHeader?new h(e):new m(e),t)}async exportBlob(e={}){return this.exportZip(new l("application/zip"),e)}async exportData64URI(e={}){return this.exportZip(new c("application/zip"),e)}async importZip(e,t){await e.init();const n=new Be(e),s=await n.getEntries();let i=0;const r=Te(s,"compressedSize");s.forEach((e=>{let n=this,s=e.filename.split("/"),a=s.pop();if(s.forEach((e=>n=n.getChildByName(e)||new Me(this.fs,e,null,n))),!e.directory){let s=i;He(n,a,{data:e,Reader:Pe(Object.assign({},t,{onprogress:e=>{t.onprogress&&t.onprogress(s+e,r)}}))}),i+=e.compressedSize}}))}async exportZip(e,t){await We(this);const n=new Se(e);return await async function(e,t,n,s){let i=0;async function r(e,t){async function a(){let a=0;for(const o of t.children){let t=i;await e.add(o.getFullname(),o.reader,Object.assign({directory:o.directory,version:o.zipVersion},s,{onprogress:e=>{s.onprogress&&s.onprogress(t+a+e,n)}})),i+=o.uncompressedSize,await r(e,o),a++}}await a()}await r(e,t)}(n,this,Te([this],"uncompressedSize"),t),await n.close(),e.getData()}getChildByName(e){for(let t=0;t<this.children.length;t++){const n=this.children[t];if(n.name==e)return n}}}const Ce={FS:class{constructor(){Ze(this)}remove(e){Ve(e),this.entries[e.id]=null}find(e){const t=e.split("/");let n=this.root;for(let e=0;n&&e<t.length;e++)n=n.getChildByName(t[e]);return n}getById(e){return this.entries[e]}async importBlob(e){Ze(this),await this.root.importBlob(e)}async importData64URI(e){Ze(this),await this.root.importData64URI(e)}async importHttpContent(e,t){this.entries=[],this.root=new Me(this),await this.root.importHttpContent(e,t)}async exportBlob(e){return this.root.exportBlob(e)}async exportData64URI(e){return this.root.exportData64URI(e)}},ZipDirectoryEntry:Me,ZipFileEntry:Le};function Te(e,t){let n=0;return e.forEach((function e(s){n+=s[t],s.children&&s.children.forEach(e)})),n}function Pe(e){return class{constructor(e){this.entry=e,this.size=0}async readUint8Array(t,n){if(!this.blobReader){const t=await this.entry.getData(new l,e);this.data=t,this.blobReader=new p(t)}return this.blobReader.readUint8Array(t,n)}async init(){this.size=this.entry.uncompressedSize}}}async function We(e){if(e.children.length)for(const t of e.children)t.directory?await We(t):(t.reader=new t.Reader(t.data),await t.reader.init(),t.uncompressedSize=t.reader.size)}function Ve(e){const t=e.parent.children;t.forEach(((n,s)=>{n.id==e.id&&t.splice(s,1)}))}function Ze(e){e.entries=[],e.root=new Me(e)}function He(e,t,n,s){if(e.directory)return s?new Me(e.fs,t,n,e):new Le(e.fs,t,n,e);throw"Parent entry is not a directory"}const Oe={application:{"andrew-inset":"ez",annodex:"anx","atom+xml":"atom","atomcat+xml":"atomcat","atomserv+xml":"atomsrv",bbolin:"lin",cap:["cap","pcap"],"cu-seeme":"cu","davmount+xml":"davmount",dsptype:"tsp",ecmascript:["es","ecma"],futuresplash:"spl",hta:"hta","java-archive":"jar","java-serialized-object":"ser","java-vm":"class",javascript:"js",m3g:"m3g","mac-binhex40":"hqx",mathematica:["nb","ma","mb"],msaccess:"mdb",msword:["doc","dot"],mxf:"mxf",oda:"oda",ogg:"ogx",pdf:"pdf","pgp-keys":"key","pgp-signature":["asc","sig"],"pics-rules":"prf",postscript:["ps","ai","eps","epsi","epsf","eps2","eps3"],rar:"rar","rdf+xml":"rdf","rss+xml":"rss",rtf:"rtf",smil:["smi","smil"],"xhtml+xml":["xhtml","xht"],xml:["xml","xsl","xsd"],"xspf+xml":"xspf",zip:"zip","vnd.android.package-archive":"apk","vnd.cinderella":"cdy","vnd.google-earth.kml+xml":"kml","vnd.google-earth.kmz":"kmz","vnd.mozilla.xul+xml":"xul","vnd.ms-excel":["xls","xlb","xlt","xlm","xla","xlc","xlw"],"vnd.ms-pki.seccat":"cat","vnd.ms-pki.stl":"stl","vnd.ms-powerpoint":["ppt","pps","pot"],"vnd.oasis.opendocument.chart":"odc","vnd.oasis.opendocument.database":"odb","vnd.oasis.opendocument.formula":"odf","vnd.oasis.opendocument.graphics":"odg","vnd.oasis.opendocument.graphics-template":"otg","vnd.oasis.opendocument.image":"odi","vnd.oasis.opendocument.presentation":"odp","vnd.oasis.opendocument.presentation-template":"otp","vnd.oasis.opendocument.spreadsheet":"ods","vnd.oasis.opendocument.spreadsheet-template":"ots","vnd.oasis.opendocument.text":"odt","vnd.oasis.opendocument.text-master":"odm","vnd.oasis.opendocument.text-template":"ott","vnd.oasis.opendocument.text-web":"oth","vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","vnd.openxmlformats-officedocument.spreadsheetml.template":"xltx","vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","vnd.openxmlformats-officedocument.presentationml.slideshow":"ppsx","vnd.openxmlformats-officedocument.presentationml.template":"potx","vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","vnd.openxmlformats-officedocument.wordprocessingml.template":"dotx","vnd.smaf":"mmf","vnd.stardivision.calc":"sdc","vnd.stardivision.chart":"sds","vnd.stardivision.draw":"sda","vnd.stardivision.impress":"sdd","vnd.stardivision.math":["sdf","smf"],"vnd.stardivision.writer":["sdw","vor"],"vnd.stardivision.writer-global":"sgl","vnd.sun.xml.calc":"sxc","vnd.sun.xml.calc.template":"stc","vnd.sun.xml.draw":"sxd","vnd.sun.xml.draw.template":"std","vnd.sun.xml.impress":"sxi","vnd.sun.xml.impress.template":"sti","vnd.sun.xml.math":"sxm","vnd.sun.xml.writer":"sxw","vnd.sun.xml.writer.global":"sxg","vnd.sun.xml.writer.template":"stw","vnd.symbian.install":["sis","sisx"],"vnd.visio":["vsd","vst","vss","vsw"],"vnd.wap.wbxml":"wbxml","vnd.wap.wmlc":"wmlc","vnd.wap.wmlscriptc":"wmlsc","vnd.wordperfect":"wpd","vnd.wordperfect5.1":"wp5","x-123":"wk","x-7z-compressed":"7z","x-abiword":"abw","x-apple-diskimage":"dmg","x-bcpio":"bcpio","x-bittorrent":"torrent","x-cbr":["cbr","cba","cbt","cb7"],"x-cbz":"cbz","x-cdf":["cdf","cda"],"x-cdlink":"vcd","x-chess-pgn":"pgn","x-cpio":"cpio","x-csh":"csh","x-debian-package":["deb","udeb"],"x-director":["dcr","dir","dxr","cst","cct","cxt","w3d","fgd","swa"],"x-dms":"dms","x-doom":"wad","x-dvi":"dvi","x-httpd-eruby":"rhtml","x-font":"pcf.Z","x-freemind":"mm","x-gnumeric":"gnumeric","x-go-sgf":"sgf","x-graphing-calculator":"gcf","x-gtar":["gtar","taz"],"x-hdf":"hdf","x-httpd-php":["phtml","pht","php"],"x-httpd-php-source":"phps","x-httpd-php3":"php3","x-httpd-php3-preprocessed":"php3p","x-httpd-php4":"php4","x-httpd-php5":"php5","x-ica":"ica","x-info":"info","x-internet-signup":["ins","isp"],"x-iphone":"iii","x-iso9660-image":"iso","x-java-jnlp-file":"jnlp","x-jmol":"jmz","x-killustrator":"kil","x-koan":["skp","skd","skt","skm"],"x-kpresenter":["kpr","kpt"],"x-kword":["kwd","kwt"],"x-latex":"latex","x-lha":"lha","x-lyx":"lyx","x-lzh":"lzh","x-lzx":"lzx","x-maker":["frm","maker","frame","fm","fb","book","fbdoc"],"x-ms-wmd":"wmd","x-ms-wmz":"wmz","x-msdos-program":["com","exe","bat","dll"],"x-msi":"msi","x-netcdf":["nc","cdf"],"x-ns-proxy-autoconfig":["pac","dat"],"x-nwc":"nwc","x-object":"o","x-oz-application":"oza","x-pkcs7-certreqresp":"p7r","x-python-code":["pyc","pyo"],"x-qgis":["qgs","shp","shx"],"x-quicktimeplayer":"qtl","x-redhat-package-manager":"rpm","x-ruby":"rb","x-sh":"sh","x-shar":"shar","x-shockwave-flash":["swf","swfl"],"x-silverlight":"scr","x-stuffit":"sit","x-sv4cpio":"sv4cpio","x-sv4crc":"sv4crc","x-tar":"tar","x-tcl":"tcl","x-tex-gf":"gf","x-tex-pk":"pk","x-texinfo":["texinfo","texi"],"x-trash":["~","%","bak","old","sik"],"x-troff":["t","tr","roff"],"x-troff-man":"man","x-troff-me":"me","x-troff-ms":"ms","x-ustar":"ustar","x-wais-source":"src","x-wingz":"wz","x-x509-ca-cert":["crt","der","cer"],"x-xcf":"xcf","x-xfig":"fig","x-xpinstall":"xpi",applixware:"aw","atomsvc+xml":"atomsvc","ccxml+xml":"ccxml","cdmi-capability":"cdmia","cdmi-container":"cdmic","cdmi-domain":"cdmid","cdmi-object":"cdmio","cdmi-queue":"cdmiq","docbook+xml":"dbk","dssc+der":"dssc","dssc+xml":"xdssc","emma+xml":"emma","epub+zip":"epub",exi:"exi","font-tdpfr":"pfr","gml+xml":"gml","gpx+xml":"gpx",gxf:"gxf",hyperstudio:"stk","inkml+xml":["ink","inkml"],ipfix:"ipfix",json:"json","jsonml+json":"jsonml","lost+xml":"lostxml","mads+xml":"mads",marc:"mrc","marcxml+xml":"mrcx","mathml+xml":"mathml",mbox:"mbox","mediaservercontrol+xml":"mscml","metalink+xml":"metalink","metalink4+xml":"meta4","mets+xml":"mets","mods+xml":"mods",mp21:["m21","mp21"],mp4:"mp4s","oebps-package+xml":"opf","omdoc+xml":"omdoc",onenote:["onetoc","onetoc2","onetmp","onepkg"],oxps:"oxps","patch-ops-error+xml":"xer","pgp-encrypted":"pgp",pkcs10:"p10","pkcs7-mime":["p7m","p7c"],"pkcs7-signature":"p7s",pkcs8:"p8","pkix-attr-cert":"ac","pkix-crl":"crl","pkix-pkipath":"pkipath",pkixcmp:"pki","pls+xml":"pls","prs.cww":"cww","pskc+xml":"pskcxml","reginfo+xml":"rif","relax-ng-compact-syntax":"rnc","resource-lists+xml":"rl","resource-lists-diff+xml":"rld","rls-services+xml":"rs","rpki-ghostbusters":"gbr","rpki-manifest":"mft","rpki-roa":"roa","rsd+xml":"rsd","sbml+xml":"sbml","scvp-cv-request":"scq","scvp-cv-response":"scs","scvp-vp-request":"spq","scvp-vp-response":"spp",sdp:"sdp","set-payment-initiation":"setpay","set-registration-initiation":"setreg","shf+xml":"shf","sparql-query":"rq","sparql-results+xml":"srx",srgs:"gram","srgs+xml":"grxml","sru+xml":"sru","ssdl+xml":"ssdl","ssml+xml":"ssml","tei+xml":["tei","teicorpus"],"thraud+xml":"tfi","timestamped-data":"tsd","vnd.3gpp.pic-bw-large":"plb","vnd.3gpp.pic-bw-small":"psb","vnd.3gpp.pic-bw-var":"pvb","vnd.3gpp2.tcap":"tcap","vnd.3m.post-it-notes":"pwn","vnd.accpac.simply.aso":"aso","vnd.accpac.simply.imp":"imp","vnd.acucobol":"acu","vnd.acucorp":["atc","acutc"],"vnd.adobe.air-application-installer-package+zip":"air","vnd.adobe.formscentral.fcdt":"fcdt","vnd.adobe.fxp":["fxp","fxpl"],"vnd.adobe.xdp+xml":"xdp","vnd.adobe.xfdf":"xfdf","vnd.ahead.space":"ahead","vnd.airzip.filesecure.azf":"azf","vnd.airzip.filesecure.azs":"azs","vnd.amazon.ebook":"azw","vnd.americandynamics.acc":"acc","vnd.amiga.ami":"ami","vnd.anser-web-certificate-issue-initiation":"cii","vnd.anser-web-funds-transfer-initiation":"fti","vnd.antix.game-component":"atx","vnd.apple.installer+xml":"mpkg","vnd.apple.mpegurl":"m3u8","vnd.aristanetworks.swi":"swi","vnd.astraea-software.iota":"iota","vnd.audiograph":"aep","vnd.blueice.multipass":"mpm","vnd.bmi":"bmi","vnd.businessobjects":"rep","vnd.chemdraw+xml":"cdxml","vnd.chipnuts.karaoke-mmd":"mmd","vnd.claymore":"cla","vnd.cloanto.rp9":"rp9","vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"vnd.cluetrust.cartomobile-config":"c11amc","vnd.cluetrust.cartomobile-config-pkg":"c11amz","vnd.commonspace":"csp","vnd.contact.cmsg":"cdbcmsg","vnd.cosmocaller":"cmc","vnd.crick.clicker":"clkx","vnd.crick.clicker.keyboard":"clkk","vnd.crick.clicker.palette":"clkp","vnd.crick.clicker.template":"clkt","vnd.crick.clicker.wordbank":"clkw","vnd.criticaltools.wbs+xml":"wbs","vnd.ctc-posml":"pml","vnd.cups-ppd":"ppd","vnd.curl.car":"car","vnd.curl.pcurl":"pcurl","vnd.dart":"dart","vnd.data-vision.rdz":"rdz","vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"vnd.dece.ttml+xml":["uvt","uvvt"],"vnd.dece.unspecified":["uvx","uvvx"],"vnd.dece.zip":["uvz","uvvz"],"vnd.denovo.fcselayout-link":"fe_launch","vnd.dna":"dna","vnd.dolby.mlp":"mlp","vnd.dpgraph":"dpg","vnd.dreamfactory":"dfac","vnd.ds-keypoint":"kpxx","vnd.dvb.ait":"ait","vnd.dvb.service":"svc","vnd.dynageo":"geo","vnd.ecowin.chart":"mag","vnd.enliven":"nml","vnd.epson.esf":"esf","vnd.epson.msf":"msf","vnd.epson.quickanime":"qam","vnd.epson.salt":"slt","vnd.epson.ssf":"ssf","vnd.eszigno3+xml":["es3","et3"],"vnd.ezpix-album":"ez2","vnd.ezpix-package":"ez3","vnd.fdf":"fdf","vnd.fdsn.mseed":"mseed","vnd.fdsn.seed":["seed","dataless"],"vnd.flographit":"gph","vnd.fluxtime.clip":"ftc","vnd.framemaker":["fm","frame","maker","book"],"vnd.frogans.fnc":"fnc","vnd.frogans.ltf":"ltf","vnd.fsc.weblaunch":"fsc","vnd.fujitsu.oasys":"oas","vnd.fujitsu.oasys2":"oa2","vnd.fujitsu.oasys3":"oa3","vnd.fujitsu.oasysgp":"fg5","vnd.fujitsu.oasysprs":"bh2","vnd.fujixerox.ddd":"ddd","vnd.fujixerox.docuworks":"xdw","vnd.fujixerox.docuworks.binder":"xbd","vnd.fuzzysheet":"fzs","vnd.genomatix.tuxedo":"txd","vnd.geogebra.file":"ggb","vnd.geogebra.tool":"ggt","vnd.geometry-explorer":["gex","gre"],"vnd.geonext":"gxt","vnd.geoplan":"g2w","vnd.geospace":"g3w","vnd.gmx":"gmx","vnd.grafeq":["gqf","gqs"],"vnd.groove-account":"gac","vnd.groove-help":"ghf","vnd.groove-identity-message":"gim","vnd.groove-injector":"grv","vnd.groove-tool-message":"gtm","vnd.groove-tool-template":"tpl","vnd.groove-vcard":"vcg","vnd.hal+xml":"hal","vnd.handheld-entertainment+xml":"zmm","vnd.hbci":"hbci","vnd.hhe.lesson-player":"les","vnd.hp-hpgl":"hpgl","vnd.hp-hpid":"hpid","vnd.hp-hps":"hps","vnd.hp-jlyt":"jlt","vnd.hp-pcl":"pcl","vnd.hp-pclxl":"pclxl","vnd.hydrostatix.sof-data":"sfd-hdstx","vnd.ibm.minipay":"mpy","vnd.ibm.modcap":["afp","listafp","list3820"],"vnd.ibm.rights-management":"irm","vnd.ibm.secure-container":"sc","vnd.iccprofile":["icc","icm"],"vnd.igloader":"igl","vnd.immervision-ivp":"ivp","vnd.immervision-ivu":"ivu","vnd.insors.igm":"igm","vnd.intercon.formnet":["xpw","xpx"],"vnd.intergeo":"i2g","vnd.intu.qbo":"qbo","vnd.intu.qfx":"qfx","vnd.ipunplugged.rcprofile":"rcprofile","vnd.irepository.package+xml":"irp","vnd.is-xpr":"xpr","vnd.isac.fcs":"fcs","vnd.jam":"jam","vnd.jcp.javame.midlet-rms":"rms","vnd.jisp":"jisp","vnd.joost.joda-archive":"joda","vnd.kahootz":["ktz","ktr"],"vnd.kde.karbon":"karbon","vnd.kde.kchart":"chrt","vnd.kde.kformula":"kfo","vnd.kde.kivio":"flw","vnd.kde.kontour":"kon","vnd.kde.kpresenter":["kpr","kpt"],"vnd.kde.kspread":"ksp","vnd.kde.kword":["kwd","kwt"],"vnd.kenameaapp":"htke","vnd.kidspiration":"kia","vnd.kinar":["kne","knp"],"vnd.koan":["skp","skd","skt","skm"],"vnd.kodak-descriptor":"sse","vnd.las.las+xml":"lasxml","vnd.llamagraphics.life-balance.desktop":"lbd","vnd.llamagraphics.life-balance.exchange+xml":"lbe","vnd.lotus-1-2-3":"123","vnd.lotus-approach":"apr","vnd.lotus-freelance":"pre","vnd.lotus-notes":"nsf","vnd.lotus-organizer":"org","vnd.lotus-screencam":"scm","vnd.lotus-wordpro":"lwp","vnd.macports.portpkg":"portpkg","vnd.mcd":"mcd","vnd.medcalcdata":"mc1","vnd.mediastation.cdkey":"cdkey","vnd.mfer":"mwf","vnd.mfmp":"mfm","vnd.micrografx.flo":"flo","vnd.micrografx.igx":"igx","vnd.mif":"mif","vnd.mobius.daf":"daf","vnd.mobius.dis":"dis","vnd.mobius.mbk":"mbk","vnd.mobius.mqy":"mqy","vnd.mobius.msl":"msl","vnd.mobius.plc":"plc","vnd.mobius.txf":"txf","vnd.mophun.application":"mpn","vnd.mophun.certificate":"mpc","vnd.ms-artgalry":"cil","vnd.ms-cab-compressed":"cab","vnd.ms-excel.addin.macroenabled.12":"xlam","vnd.ms-excel.sheet.binary.macroenabled.12":"xlsb","vnd.ms-excel.sheet.macroenabled.12":"xlsm","vnd.ms-excel.template.macroenabled.12":"xltm","vnd.ms-fontobject":"eot","vnd.ms-htmlhelp":"chm","vnd.ms-ims":"ims","vnd.ms-lrm":"lrm","vnd.ms-officetheme":"thmx","vnd.ms-powerpoint.addin.macroenabled.12":"ppam","vnd.ms-powerpoint.presentation.macroenabled.12":"pptm","vnd.ms-powerpoint.slide.macroenabled.12":"sldm","vnd.ms-powerpoint.slideshow.macroenabled.12":"ppsm","vnd.ms-powerpoint.template.macroenabled.12":"potm","vnd.ms-project":["mpp","mpt"],"vnd.ms-word.document.macroenabled.12":"docm","vnd.ms-word.template.macroenabled.12":"dotm","vnd.ms-works":["wps","wks","wcm","wdb"],"vnd.ms-wpl":"wpl","vnd.ms-xpsdocument":"xps","vnd.mseq":"mseq","vnd.musician":"mus","vnd.muvee.style":"msty","vnd.mynfc":"taglet","vnd.neurolanguage.nlu":"nlu","vnd.nitf":["ntf","nitf"],"vnd.noblenet-directory":"nnd","vnd.noblenet-sealer":"nns","vnd.noblenet-web":"nnw","vnd.nokia.n-gage.data":"ngdat","vnd.nokia.n-gage.symbian.install":"n-gage","vnd.nokia.radio-preset":"rpst","vnd.nokia.radio-presets":"rpss","vnd.novadigm.edm":"edm","vnd.novadigm.edx":"edx","vnd.novadigm.ext":"ext","vnd.oasis.opendocument.chart-template":"otc","vnd.oasis.opendocument.formula-template":"odft","vnd.oasis.opendocument.image-template":"oti","vnd.olpc-sugar":"xo","vnd.oma.dd2+xml":"dd2","vnd.openofficeorg.extension":"oxt","vnd.openxmlformats-officedocument.presentationml.slide":"sldx","vnd.osgeo.mapguide.package":"mgp","vnd.osgi.dp":"dp","vnd.osgi.subsystem":"esa","vnd.palm":["pdb","pqa","oprc"],"vnd.pawaafile":"paw","vnd.pg.format":"str","vnd.pg.osasli":"ei6","vnd.picsel":"efif","vnd.pmi.widget":"wg","vnd.pocketlearn":"plf","vnd.powerbuilder6":"pbd","vnd.previewsystems.box":"box","vnd.proteus.magazine":"mgz","vnd.publishare-delta-tree":"qps","vnd.pvi.ptid1":"ptid","vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"vnd.realvnc.bed":"bed","vnd.recordare.musicxml":"mxl","vnd.recordare.musicxml+xml":"musicxml","vnd.rig.cryptonote":"cryptonote","vnd.rn-realmedia":"rm","vnd.rn-realmedia-vbr":"rmvb","vnd.route66.link66+xml":"link66","vnd.sailingtracker.track":"st","vnd.seemail":"see","vnd.sema":"sema","vnd.semd":"semd","vnd.semf":"semf","vnd.shana.informed.formdata":"ifm","vnd.shana.informed.formtemplate":"itp","vnd.shana.informed.interchange":"iif","vnd.shana.informed.package":"ipk","vnd.simtech-mindmapper":["twd","twds"],"vnd.smart.teacher":"teacher","vnd.solent.sdkm+xml":["sdkm","sdkd"],"vnd.spotfire.dxp":"dxp","vnd.spotfire.sfs":"sfs","vnd.stepmania.package":"smzip","vnd.stepmania.stepchart":"sm","vnd.sus-calendar":["sus","susp"],"vnd.svd":"svd","vnd.syncml+xml":"xsm","vnd.syncml.dm+wbxml":"bdm","vnd.syncml.dm+xml":"xdm","vnd.tao.intent-module-archive":"tao","vnd.tcpdump.pcap":["pcap","cap","dmp"],"vnd.tmobile-livetv":"tmo","vnd.trid.tpt":"tpt","vnd.triscape.mxs":"mxs","vnd.trueapp":"tra","vnd.ufdl":["ufd","ufdl"],"vnd.uiq.theme":"utz","vnd.umajin":"umj","vnd.unity":"unityweb","vnd.uoml+xml":"uoml","vnd.vcx":"vcx","vnd.visionary":"vis","vnd.vsf":"vsf","vnd.webturbo":"wtb","vnd.wolfram.player":"nbp","vnd.wqd":"wqd","vnd.wt.stf":"stf","vnd.xara":"xar","vnd.xfdl":"xfdl","vnd.yamaha.hv-dic":"hvd","vnd.yamaha.hv-script":"hvs","vnd.yamaha.hv-voice":"hvp","vnd.yamaha.openscoreformat":"osf","vnd.yamaha.openscoreformat.osfpvg+xml":"osfpvg","vnd.yamaha.smaf-audio":"saf","vnd.yamaha.smaf-phrase":"spf","vnd.yellowriver-custom-menu":"cmp","vnd.zul":["zir","zirz"],"vnd.zzazz.deck+xml":"zaz","voicexml+xml":"vxml",widget:"wgt",winhlp:"hlp","wsdl+xml":"wsdl","wspolicy+xml":"wspolicy","x-ace-compressed":"ace","x-authorware-bin":["aab","x32","u32","vox"],"x-authorware-map":"aam","x-authorware-seg":"aas","x-blorb":["blb","blorb"],"x-bzip":"bz","x-bzip2":["bz2","boz"],"x-cfs-compressed":"cfs","x-chat":"chat","x-conference":"nsc","x-dgc-compressed":"dgc","x-dtbncx+xml":"ncx","x-dtbook+xml":"dtb","x-dtbresource+xml":"res","x-eva":"eva","x-font-bdf":"bdf","x-font-ghostscript":"gsf","x-font-linux-psf":"psf","x-font-otf":"otf","x-font-pcf":"pcf","x-font-snf":"snf","x-font-ttf":["ttf","ttc"],"x-font-type1":["pfa","pfb","pfm","afm"],"x-font-woff":"woff","x-freearc":"arc","x-gca-compressed":"gca","x-glulx":"ulx","x-gramps-xml":"gramps","x-install-instructions":"install","x-lzh-compressed":["lzh","lha"],"x-mie":"mie","x-mobipocket-ebook":["prc","mobi"],"x-ms-application":"application","x-ms-shortcut":"lnk","x-ms-xbap":"xbap","x-msbinder":"obd","x-mscardfile":"crd","x-msclip":"clp","x-msdownload":["exe","dll","com","bat","msi"],"x-msmediaview":["mvb","m13","m14"],"x-msmetafile":["wmf","wmz","emf","emz"],"x-msmoney":"mny","x-mspublisher":"pub","x-msschedule":"scd","x-msterminal":"trm","x-mswrite":"wri","x-nzb":"nzb","x-pkcs12":["p12","pfx"],"x-pkcs7-certificates":["p7b","spc"],"x-research-info-systems":"ris","x-silverlight-app":"xap","x-sql":"sql","x-stuffitx":"sitx","x-subrip":"srt","x-t3vm-image":"t3","x-tads":"gam","x-tex":"tex","x-tex-tfm":"tfm","x-tgif":"obj","x-xliff+xml":"xlf","x-xz":"xz","x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"xaml+xml":"xaml","xcap-diff+xml":"xdf","xenc+xml":"xenc","xml-dtd":"dtd","xop+xml":"xop","xproc+xml":"xpl","xslt+xml":"xslt","xv+xml":["mxml","xhvml","xvml","xvm"],yang:"yang","yin+xml":"yin",envoy:"evy",fractals:"fif","internet-property-stream":"acx",olescript:"axs","vnd.ms-outlook":"msg","vnd.ms-pkicertstore":"sst","x-compress":"z","x-compressed":"tgz","x-gzip":"gz","x-perfmon":["pma","pmc","pml","pmr","pmw"],"x-pkcs7-mime":["p7c","p7m"],"ynd.ms-pkipko":"pko"},audio:{amr:"amr","amr-wb":"awb",annodex:"axa",basic:["au","snd"],flac:"flac",midi:["mid","midi","kar","rmi"],mpeg:["mpga","mpega","mp2","mp3","m4a","mp2a","m2a","m3a"],mpegurl:"m3u",ogg:["oga","ogg","spx"],"prs.sid":"sid","x-aiff":["aif","aiff","aifc"],"x-gsm":"gsm","x-ms-wma":"wma","x-ms-wax":"wax","x-pn-realaudio":"ram","x-realaudio":"ra","x-sd2":"sd2","x-wav":"wav",adpcm:"adp",mp4:"mp4a",s3m:"s3m",silk:"sil","vnd.dece.audio":["uva","uvva"],"vnd.digital-winds":"eol","vnd.dra":"dra","vnd.dts":"dts","vnd.dts.hd":"dtshd","vnd.lucent.voice":"lvp","vnd.ms-playready.media.pya":"pya","vnd.nuera.ecelp4800":"ecelp4800","vnd.nuera.ecelp7470":"ecelp7470","vnd.nuera.ecelp9600":"ecelp9600","vnd.rip":"rip",webm:"weba","x-aac":"aac","x-caf":"caf","x-matroska":"mka","x-pn-realaudio-plugin":"rmp",xm:"xm",mid:["mid","rmi"]},chemical:{"x-alchemy":"alc","x-cache":["cac","cache"],"x-cache-csf":"csf","x-cactvs-binary":["cbin","cascii","ctab"],"x-cdx":"cdx","x-chem3d":"c3d","x-cif":"cif","x-cmdf":"cmdf","x-cml":"cml","x-compass":"cpa","x-crossfire":"bsd","x-csml":["csml","csm"],"x-ctx":"ctx","x-cxf":["cxf","cef"],"x-embl-dl-nucleotide":["emb","embl"],"x-gamess-input":["inp","gam","gamin"],"x-gaussian-checkpoint":["fch","fchk"],"x-gaussian-cube":"cub","x-gaussian-input":["gau","gjc","gjf"],"x-gaussian-log":"gal","x-gcg8-sequence":"gcg","x-genbank":"gen","x-hin":"hin","x-isostar":["istr","ist"],"x-jcamp-dx":["jdx","dx"],"x-kinemage":"kin","x-macmolecule":"mcm","x-macromodel-input":["mmd","mmod"],"x-mdl-molfile":"mol","x-mdl-rdfile":"rd","x-mdl-rxnfile":"rxn","x-mdl-sdfile":["sd","sdf"],"x-mdl-tgf":"tgf","x-mmcif":"mcif","x-mol2":"mol2","x-molconn-Z":"b","x-mopac-graph":"gpt","x-mopac-input":["mop","mopcrt","mpc","zmt"],"x-mopac-out":"moo","x-ncbi-asn1":"asn","x-ncbi-asn1-ascii":["prt","ent"],"x-ncbi-asn1-binary":["val","aso"],"x-pdb":["pdb","ent"],"x-rosdal":"ros","x-swissprot":"sw","x-vamas-iso14976":"vms","x-vmd":"vmd","x-xtel":"xtel","x-xyz":"xyz"},image:{gif:"gif",ief:"ief",jpeg:["jpeg","jpg","jpe"],pcx:"pcx",png:"png","svg+xml":["svg","svgz"],tiff:["tiff","tif"],"vnd.djvu":["djvu","djv"],"vnd.wap.wbmp":"wbmp","x-canon-cr2":"cr2","x-canon-crw":"crw","x-cmu-raster":"ras","x-coreldraw":"cdr","x-coreldrawpattern":"pat","x-coreldrawtemplate":"cdt","x-corelphotopaint":"cpt","x-epson-erf":"erf","x-icon":"ico","x-jg":"art","x-jng":"jng","x-nikon-nef":"nef","x-olympus-orf":"orf","x-photoshop":"psd","x-portable-anymap":"pnm","x-portable-bitmap":"pbm","x-portable-graymap":"pgm","x-portable-pixmap":"ppm","x-rgb":"rgb","x-xbitmap":"xbm","x-xpixmap":"xpm","x-xwindowdump":"xwd",bmp:"bmp",cgm:"cgm",g3fax:"g3",ktx:"ktx","prs.btif":"btif",sgi:"sgi","vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"vnd.dwg":"dwg","vnd.dxf":"dxf","vnd.fastbidsheet":"fbs","vnd.fpx":"fpx","vnd.fst":"fst","vnd.fujixerox.edmics-mmr":"mmr","vnd.fujixerox.edmics-rlc":"rlc","vnd.ms-modi":"mdi","vnd.ms-photo":"wdp","vnd.net-fpx":"npx","vnd.xiff":"xif",webp:"webp","x-3ds":"3ds","x-cmx":"cmx","x-freehand":["fh","fhc","fh4","fh5","fh7"],"x-pict":["pic","pct"],"x-tga":"tga","cis-cod":"cod",pipeg:"jfif"},message:{rfc822:["eml","mime","mht","mhtml","nws"]},model:{iges:["igs","iges"],mesh:["msh","mesh","silo"],vrml:["wrl","vrml"],"x3d+vrml":["x3dv","x3dvz"],"x3d+xml":["x3d","x3dz"],"x3d+binary":["x3db","x3dbz"],"vnd.collada+xml":"dae","vnd.dwf":"dwf","vnd.gdl":"gdl","vnd.gtw":"gtw","vnd.mts":"mts","vnd.vtu":"vtu"},text:{"cache-manifest":["manifest","appcache"],calendar:["ics","icz","ifb"],css:"css",csv:"csv",h323:"323",html:["html","htm","shtml","stm"],iuls:"uls",mathml:"mml",plain:["txt","text","brf","conf","def","list","log","in","bas"],richtext:"rtx",scriptlet:["sct","wsc"],texmacs:["tm","ts"],"tab-separated-values":"tsv","vnd.sun.j2me.app-descriptor":"jad","vnd.wap.wml":"wml","vnd.wap.wmlscript":"wmls","x-bibtex":"bib","x-boo":"boo","x-c++hdr":["h++","hpp","hxx","hh"],"x-c++src":["c++","cpp","cxx","cc"],"x-component":"htc","x-dsrc":"d","x-diff":["diff","patch"],"x-haskell":"hs","x-java":"java","x-literate-haskell":"lhs","x-moc":"moc","x-pascal":["p","pas"],"x-pcs-gcd":"gcd","x-perl":["pl","pm"],"x-python":"py","x-scala":"scala","x-setext":"etx","x-tcl":["tcl","tk"],"x-tex":["tex","ltx","sty","cls"],"x-vcalendar":"vcs","x-vcard":"vcf",n3:"n3","prs.lines.tag":"dsc",sgml:["sgml","sgm"],troff:["t","tr","roff","man","me","ms"],turtle:"ttl","uri-list":["uri","uris","urls"],vcard:"vcard","vnd.curl":"curl","vnd.curl.dcurl":"dcurl","vnd.curl.scurl":"scurl","vnd.curl.mcurl":"mcurl","vnd.dvb.subtitle":"sub","vnd.fly":"fly","vnd.fmi.flexstor":"flx","vnd.graphviz":"gv","vnd.in3d.3dml":"3dml","vnd.in3d.spot":"spot","x-asm":["s","asm"],"x-c":["c","cc","cxx","cpp","h","hh","dic"],"x-fortran":["f","for","f77","f90"],"x-opml":"opml","x-nfo":"nfo","x-sfv":"sfv","x-uuencode":"uu",webviewhtml:"htt"},video:{avif:".avif","3gpp":"3gp",annodex:"axv",dl:"dl",dv:["dif","dv"],fli:"fli",gl:"gl",mpeg:["mpeg","mpg","mpe","m1v","m2v","mp2","mpa","mpv2"],mp4:["mp4","mp4v","mpg4"],quicktime:["qt","mov"],ogg:"ogv","vnd.mpegurl":["mxu","m4u"],"x-flv":"flv","x-la-asf":["lsf","lsx"],"x-mng":"mng","x-ms-asf":["asf","asx","asr"],"x-ms-wm":"wm","x-ms-wmv":"wmv","x-ms-wmx":"wmx","x-ms-wvx":"wvx","x-msvideo":"avi","x-sgi-movie":"movie","x-matroska":["mpv","mkv","mk3d","mks"],"3gpp2":"3g2",h261:"h261",h263:"h263",h264:"h264",jpeg:"jpgv",jpm:["jpm","jpgm"],mj2:["mj2","mjp2"],"vnd.dece.hd":["uvh","uvvh"],"vnd.dece.mobile":["uvm","uvvm"],"vnd.dece.pd":["uvp","uvvp"],"vnd.dece.sd":["uvs","uvvs"],"vnd.dece.video":["uvv","uvvv"],"vnd.dvb.file":"dvb","vnd.fvt":"fvt","vnd.ms-playready.media.pyv":"pyv","vnd.uvvu.mp4":["uvu","uvvu"],"vnd.vivo":"viv",webm:"webm","x-f4v":"f4v","x-m4v":"m4v","x-ms-vob":"vob","x-smv":"smv"},"x-conference":{"x-cooltalk":"ice"},"x-world":{"x-vrml":["vrm","vrml","wrl","flr","wrz","xaf","xof"]}},Ne=(()=>{const e={};for(let t in Oe)if(Oe.hasOwnProperty(t))for(let n in Oe[t])if(Oe[t].hasOwnProperty(n)){const s=Oe[t][n];if("string"==typeof s)e[s]=t+"/"+n;else for(let i=0;i<s.length;i++)e[s[i]]=t+"/"+n}return e})();e.BlobReader=p,e.BlobWriter=l,e.Data64URIReader=d,e.Data64URIWriter=c,e.HttpRangeReader=h,e.HttpReader=m,e.Reader=i,e.TextReader=a,e.TextWriter=o,e.Uint8ArrayReader=class extends i{constructor(e){super(),this.array=e,this.size=e.length}readUint8Array(e,t){return this.array.slice(e,e+t)}},e.Uint8ArrayWriter=f,e.Writer=r,e.ZipReader=Be,e.ZipWriter=Se,e.configure=function(e){Re=Object.assign({},Re,e)},e.fs=Ce,e.getMimeType=function(e){return e&&Ne[e.split(".").pop().toLowerCase()]||"application/octet-stream"},e.initShimAsyncCodec=(e,t={})=>({ZipDeflate:De(e.Deflate,t.deflate),ZipInflate:De(e.Inflate,t.inflate)}),Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).zip={})}(this,(function(t){"use strict";const e="HTTP error ",n="text/plain";class i{constructor(){this.size=0}init(){this.initialized=!0}}class r extends i{}class s extends i{writeUint8Array(t){this.size+=t.length}}class a extends r{constructor(t){super(),this.blobReader=new d(new Blob([t],{type:n}))}init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}readUint8Array(t,e){return this.blobReader.readUint8Array(t,e)}}class o extends s{constructor(t){super(),this.encoding=t,this.blob=new Blob([],{type:n})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:n})}getData(){const t=new FileReader;return new Promise(((e,n)=>{t.onload=t=>e(t.target.result),t.onerror=n,t.readAsText(this.blob,this.encoding)}))}}class c extends r{constructor(t){super(),this.dataURI=t;let e=t.length;for(;"="==t.charAt(e-1);)e--;this.dataStart=t.indexOf(",")+1,this.size=Math.floor(.75*(e-this.dataStart))}readUint8Array(t,e){const n=new Uint8Array(e),i=4*Math.floor(t/3),r=atob(this.dataURI.substring(i+this.dataStart,4*Math.ceil((t+e)/3)+this.dataStart)),s=t-3*Math.floor(i/4);for(let t=s;t<s+e;t++)n[t-s]=r.charCodeAt(t);return n}}class h extends s{constructor(t){super(),this.data="data:"+(t||"")+";base64,",this.pending=[]}writeUint8Array(t){super.writeUint8Array(t);let e=0,n=this.pending;const i=this.pending.length;for(this.pending="",e=0;e<3*Math.floor((i+t.length)/3)-i;e++)n+=String.fromCharCode(t[e]);for(;e<t.length;e++)this.pending+=String.fromCharCode(t[e]);n.length>2?this.data+=btoa(n):this.pending=n}getData(){return this.data+btoa(this.pending)}}class d extends r{constructor(t){super(),this.blob=t,this.size=t.size}readUint8Array(t,e){const n=new FileReader;return new Promise(((i,r)=>{n.onload=t=>i(new Uint8Array(t.target.result)),n.onerror=r,n.readAsArrayBuffer(this.blob.slice(t,t+e))}))}}class l extends s{constructor(t){super(),this.offset=0,this.contentType=t,this.blob=new Blob([],{type:t})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:this.contentType}),this.offset=this.blob.size}getData(){return this.blob}}class u extends r{constructor(t){super(),this.url=t}async init(){if(super.init(),function(t){if("undefined"!=typeof document){const e=document.createElement("a");return e.href=t,"http:"==e.protocol||"https:"==e.protocol}return/^https?:\/\//i.test(t)}(this.url))return new Promise(((t,n)=>{const i=new XMLHttpRequest;i.addEventListener("load",(()=>{i.status<400?(this.size=Number(i.getResponseHeader("Content-Length")),this.size?t():f().then((()=>t())).catch(n)):n(e+(i.statusText||i.status)+".")}),!1),i.addEventListener("error",n,!1),i.open("HEAD",this.url),i.send()}));await f()}async readUint8Array(t,e){return this.data||await f(this,this.url),new Uint8Array(this.data.subarray(t,t+e))}}class p extends r{constructor(t){super(),this.url=t}init(){return super.init(),new Promise(((t,n)=>{const i=new XMLHttpRequest;i.addEventListener("load",(()=>{i.status<400?(this.size=Number(i.getResponseHeader("Content-Length")),"bytes"==i.getResponseHeader("Accept-Ranges")?t():n(new Error("HTTP Range not supported"))):n(e+(i.statusText||i.status)+".")}),!1),i.addEventListener("error",n,!1),i.open("HEAD",this.url),i.send()}))}readUint8Array(t,n){return new Promise(((i,r)=>{const s=new XMLHttpRequest;s.open("GET",this.url),s.responseType="arraybuffer",s.setRequestHeader("Range","bytes="+t+"-"+(t+n-1)),s.addEventListener("load",(()=>{s.status<400?i(new Uint8Array(s.response)):r(e+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",r,!1),s.send()}))}}class g extends s{constructor(){super(),this.array=new Uint8Array(0)}writeUint8Array(t){super.writeUint8Array(t);const e=this.array;this.array=new Uint8Array(e.length+t.length),this.array.set(e),this.array.set(t,e.length)}getData(){return this.array}}function f(t,n){return new Promise(((i,r)=>{const s=new XMLHttpRequest;s.addEventListener("load",(()=>{s.status<400?(t.size||(t.size=Number(s.getResponseHeader("Content-Length"))||Number(s.response.byteLength)),t.data=new Uint8Array(s.response),i()):r(e+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",r,!1),s.open("GET",n),s.responseType="arraybuffer",s.send()}))}class w{constructor(){this.crc=-1,this.table=(()=>{const t=[];for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)1&n?n=n>>>1^3988292384:n>>>=1;t[e]=n}return t})()}append(t){const e=this.table;let n=0|this.crc;for(let i=0,r=0|t.length;i<r;i++)n=n>>>8^e[255&(n^t[i])];this.crc=n}get(){return~this.crc}}const y="Invalid pasword",m=16,U="raw",b={name:"PBKDF2"},A={name:"HMAC"},z="SHA-1",E={name:"AES-CTR"},x=Object.assign({hash:A},b),D=Object.assign({iterations:1e3,hash:{name:z}},b),v=Object.assign({hash:z},A),F=Object.assign({length:m},E),R=["deriveBits"],B=["sign"],S=528,I=10,L=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M=crypto.subtle;class k{constructor(t,e){this.password=t,this.signed=e,this.input=e&&new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(t){const e=async(r=0)=>{if(r+m<=i.length-I){const t=i.subarray(r,r+m),s=await M.decrypt(Object.assign({counter:this.counter},F),this.keys.decrypt,t);return T(this.counter),n.set(new Uint8Array(s),r),e(r+m)}return this.pendingInput=i.subarray(r),this.signed&&(this.input=W(this.input,t)),n};if(this.password){const e=t.subarray(0,18);await async function(t,e,n){t.counter=new Uint8Array(L);const i=e.subarray(0,16),r=e.subarray(16),s=(new TextEncoder).encode(n),a=await M.importKey(U,s,x,!1,R),o=await M.deriveBits(Object.assign({salt:i},D),a,528),c=new Uint8Array(o),h=c.subarray(64);if(t.keys={decrypt:await M.importKey(U,c.subarray(0,32),E,!0,["decrypt"]),authentication:await M.importKey(U,c.subarray(32,64),v,!1,B),passwordVerification:h},h[0]!=r[0]||h[1]!=r[1])throw new Error(y)}(this,e,this.password),this.password=null,t=t.subarray(18)}let n=new Uint8Array(t.length-I-(t.length-I)%m),i=t;return this.pendingInput.length&&(i=W(this.pendingInput,t),n=P(n,i.length-I-(i.length-I)%m)),e()}async flush(){const t=this.pendingInput,e=this.keys,n=t.subarray(0,t.length-I),i=t.subarray(t.length-I);let r=new Uint8Array(0);if(n.length){const t=await M.decrypt(Object.assign({counter:this.counter},F),e.decrypt,n);r=new Uint8Array(t)}let s=!0;if(this.signed){const t=await M.sign(A,e.authentication,this.input.subarray(0,this.input.length-I)),n=new Uint8Array(t);this.input=null;for(let t=0;t<I;t++)n[t]!=i[t]&&(s=!1)}return{valid:s,data:r}}}class C{constructor(t){this.password=t,this.output=new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(t){const e=async(r=0)=>{if(r+m<=t.length){const s=t.subarray(r,r+m),a=await M.encrypt(Object.assign({counter:this.counter},F),this.keys.encrypt,s);return T(this.counter),i.set(new Uint8Array(a),r+n.length),e(r+m)}return this.pendingInput=t.subarray(r),this.output=W(this.output,i),i};let n=new Uint8Array(0);this.password&&(n=await async function(t,e){t.counter=new Uint8Array(L);const n=crypto.getRandomValues(new Uint8Array(16)),i=(new TextEncoder).encode(e),r=await M.importKey(U,i,x,!1,R),s=await M.deriveBits(Object.assign({salt:n},D),r,S),a=new Uint8Array(s);return t.keys={encrypt:await M.importKey(U,a.subarray(0,32),E,!0,["encrypt"]),authentication:await M.importKey(U,a.subarray(32,64),v,!1,B),passwordVerification:a.subarray(64)},W(n,t.keys.passwordVerification)}(this,this.password),this.password=null);let i=new Uint8Array(n.length+t.length-t.length%m);return i.set(n,0),this.pendingInput.length&&(t=W(this.pendingInput,t),i=P(i,t.length-t.length%m)),e()}async flush(){let t=new Uint8Array(0);if(this.pendingInput.length){const e=await M.encrypt(Object.assign({counter:this.counter},F),this.keys.encrypt,this.pendingInput);t=new Uint8Array(e),this.output=W(this.output,t)}const e=await M.sign(A,this.keys.authentication,this.output.subarray(18));this.output=null;const n=new Uint8Array(e).subarray(0,I);return{data:W(t,n),signature:n}}}function T(t){for(let e=0;e<16;e++){if(255!=t[e]){t[e]++;break}t[e]=0}}function W(t,e){let n=t;return t.length+e.length&&(n=new Uint8Array(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function P(t,e){if(e&&e>t.length){const n=t;(t=new Uint8Array(e)).set(n,0)}return t}const V="deflate",Z="inflate",j="Invalid signature";class H{constructor(t){this.signature=t.inputSignature,this.encrypted=Boolean(t.inputPassword),this.signed=t.inputSigned,this.compressed=t.inputCompressed,this.inflate=this.compressed&&new ZipInflate,this.crc32=this.signed&&this.signed&&new w,this.decrypt=this.encrypted&&new k(t.inputPassword)}async append(t){return this.encrypted&&(t=await this.decrypt.append(t)),this.compressed&&t.length&&(t=await this.inflate.append(t)),!this.encrypted&&this.signed&&this.crc32.append(t),t}async flush(){let t,e=new Uint8Array(0);if(this.encrypted){const t=await this.decrypt.flush();if(!t.valid)throw new Error(j);e=t.data}else if(this.signed){const e=new DataView(new Uint8Array(4).buffer);if(t=this.crc32.get(),e.setUint32(0,t),this.signature!=e.getUint32(0,!1))throw new Error(j)}return this.compressed&&(e=await this.inflate.append(e)||new Uint8Array(0),await this.inflate.flush()),{data:e,signature:t}}}class O{constructor(t){this.encrypted=t.outputEncrypted,this.signed=t.outputSigned,this.compressed=t.outputCompressed,this.deflate=this.compressed&&new ZipDeflate({level:t.level||5}),this.crc32=this.signed&&new w,this.encrypt=this.encrypted&&new C(t.outputPassword)}async append(t){let e=t;return this.compressed&&t.length&&(e=await this.deflate.append(t)),this.encrypted?e=await this.encrypt.append(e):this.signed&&this.crc32.append(t),e}async flush(){let t,e=new Uint8Array(0);if(this.compressed&&(e=await this.deflate.flush()||new Uint8Array(0)),this.encrypted){e=await this.encrypt.append(e);const n=await this.encrypt.flush();t=n.signature;const i=new Uint8Array(e.length+n.data.length);i.set(e,0),i.set(n.data,e.length),e=i}else this.signed&&(t=this.crc32.get());return{data:e,signature:t}}}const N="init",q="append",K="flush",X="message",G="z-worker.js",_={deflate:[G,"deflate.js"],inflate:[G,"inflate.js"]},Y={pool:[],pendingRequests:[]};function J(t,e){const n=Y.pool;let i;if(t.useWebWorkers){const n=e.codecType;if(null!=t.workerScripts&&null!=t.workerScriptsPath)throw new Error("Either workerScripts or workerScriptsPath may be set, not both");if(t.workerScripts){if(i=t.workerScripts[n],!Array.isArray(i))throw new Error("workerScripts."+n+" must be an array");r=i,i="undefined"!=typeof document?r.map((t=>new URL(t,document.baseURI).href)):r}else i=_[n].slice(0),i[0]=(t.workerScriptsPath||"")+i[0]}var r;if(n.length<t.maxWorkers){const t={worker:i&&new Worker(i[0]),busy:!0,options:e,scripts:i};return n.push(t),i?function(t){const e=t.worker;let n;return e.addEventListener(X,s,!1),t.interface={append:async t=>i({type:q,data:t}),flush:async()=>i({type:K})},t.interface;async function i(e){if(!n){const e=t.scripts.slice(1);await r(Object.assign({type:N,options:t.options,scripts:e}))}return r(e)}function r(t){try{if(t.data)try{e.postMessage(t,[t.data.buffer])}catch(n){e.postMessage(t)}else e.postMessage(t)}catch(t){n.reject(t),e.removeEventListener(X,s,!1)}return new Promise(((t,e)=>n={resolve:t,reject:e}))}function s(i){const r=i.data;if(n){const i=r.error;if(i){const t=new Error(i.message);t.stack=i.stack,n.reject(t),e.removeEventListener(X,s,!1)}else r.type!=N&&r.type!=K&&r.type!=q||(r.type==K?(n.resolve({data:new Uint8Array(r.data),signature:r.signature}),n=null,function(t){if(t.busy=!1,Y.pendingRequests.length){const[{resolve:e,options:n,scripts:i}]=Y.pendingRequests.splice(0,1);t.busy=!0,t.options=n,t.scripts=i,e(t.interface)}else t.worker.terminate(),Y.pool=Y.pool.filter((e=>e!=t))}(t)):n.resolve(r.data&&new Uint8Array(r.data)))}}}(t):Q(t)}{const t=n.find((t=>!t.busy));return t?(t.busy=!0,t.options=e,t.scripts=i,i?t.interface:Q(t)):new Promise((t=>Y.pendingRequests.push({resolve:t,options:e,scripts:i})))}}async function Q(t){const e=(n=t.options).codecType.startsWith(V)?new O(n):n.codecType.startsWith(Z)?new H(n):void 0;var n;const i=e.flush.bind(e);return e.flush=async()=>{const e=await i();if(t.busy=!1,Y.pendingRequests.length){const[{resolve:e,options:n}]=Y.pendingRequests.splice(0,1);t.busy=!0,t.options=n,e(await Q(t))}else Y.pool=Y.pool.filter((e=>e!=t));return e},e}async function $(t,e,n,i,r,s,a){const o=Math.max(s.chunkSize,64);return async function s(c=0,h=0){const d=c*o;if(d<r){const l=await e.readUint8Array(d+i,Math.min(o,r-d)),u=await t.append(l);return h+=await tt(n,u),a.onprogress&&a.onprogress(d+l.length,r),s(c+1,h)}{const e=await t.flush();return h+=await tt(n,e.data),{signature:e.signature,length:h}}}()}async function tt(t,e){return e.length&&await t.writeUint8Array(e),e.length}const et="File format is not recognized",nt="End of central directory not found",it="Zip64 extra field not found",rt="Compression method not supported",st="utf-8",at="windows-1252";class ot{constructor(t,e,n){this.reader=t,this.config=e,this.options=n}async getData(t,e={}){const n=this.reader;n.initialized||await n.init();const i=await n.readUint8Array(this.offset,30),r=new DataView(i.buffer),s=void 0===e.password?this.options.password:e.password;let a=s&&s.length&&s;if(this.extraFieldAES){if(99!=this.extraFieldAES.originalCompressionMethod)throw new Error(rt);if(3!=this.extraFieldAES.strength)throw new Error("Encryption not supported")}if(0!=this.compressionMethod&&8!=this.compressionMethod)throw new Error(rt);if(1347093252!=r.getUint32(0,!1))throw"Local file header not found";const o=this.localDirectory={};ct(o,r,4),o.rawExtraField=i.subarray(this.offset+30+o.filenameLength,this.offset+30+o.filenameLength+o.extraFieldLength),ht(this,o,r,4);let c=this.offset+30+o.filenameLength+o.extraFieldLength;const h=this.bitFlag.encrypted&&o.bitFlag.encrypted;if(h&&!a)throw new Error("File contains encrypted entry");const d=await J(this.config,{codecType:Z,inputPassword:a,inputSigned:void 0===e.checkSignature?this.options.checkSignature:e.checkSignature,inputSignature:this.signature,inputCompressed:0!=this.compressionMethod,inputEncrypted:h});return t.initialized||await t.init(),await $(d,n,t,c,this.compressedSize,this.config,{onprogress:e.onprogress}),t.getData()}}function ct(t,e,n){t.version=e.getUint16(n,!0);const i=t.rawBitFlag=e.getUint16(n+2,!0);t.bitFlag={encrypted:1==(1&i),level:(6&i)>>1,dataDescriptor:8==(8&i),languageEncodingFlag:2048==(2048&i)},t.encrypted=t.bitFlag.encrypted,t.rawLastModDate=e.getUint32(n+6,!0),t.lastModDate=function(t){const e=(4294901760&t)>>16,n=65535&t;try{return new Date(1980+((65024&e)>>9),((480&e)>>5)-1,31&e,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch(t){}}(t.rawLastModDate),t.filenameLength=e.getUint16(n+22,!0),t.extraFieldLength=e.getUint16(n+24,!0)}function ht(t,e,n,i){let r,s,a;const o=e.rawExtraField,c=e.extraField=new Map,h=new DataView(new Uint8Array(o).buffer);let d=0;try{for(;d<o.length;){const t=h.getUint16(d,!0),e=h.getUint16(d+2,!0);c.set(t,{type:t,data:o.slice(d+4,d+4+e)}),d+=4+e}}catch(t){}const l=n.getUint16(i+4,!0);e.signature=n.getUint32(i+10,!0),e.uncompressedSize=n.getUint32(i+18,!0),e.compressedSize=n.getUint32(i+14,!0),r=e.extraFieldZip64=c.get(1),r&&function(t,e){e.zip64=!0;const n=new DataView(t.data.buffer);t.values=[];for(let e=0;e<Math.floor(t.data.length/8);e++)t.values.push(Number(n.getBigUint64(0+8*e,!0)));const i=["uncompressedSize","compressedSize","offset"],r=i.filter((t=>4294967295==e[t]));for(let e=0;e<r.length;e++)t[r[e]]=t.values[e];i.forEach((n=>{if(4294967295==e[n]){if(!t||void 0===t[n])throw new Error(it);e[n]=t&&t[n]}}))}(r,e),a=e.extraFieldUnicodePath=c.get(28789),a&&function(t,e,n){const i=new DataView(t.data.buffer);t.version=i.getUint8(0),t.signature=i.getUint32(1,!0);const r=new w;r.append(n.rawFilename);const s=new DataView(new Uint8Array(4).buffer);s.setUint32(0,r.get()),t.filename=(new TextDecoder).decode(t.data.subarray(5)),t.signature==s.getUint32(0,!1)&&(e.filename=t.filename)}(a,e,t),s=e.extraFieldAES=c.get(39169),s?function(t,e,n){if(t){const i=new DataView(t.data.buffer);t.vendorVersion=i.getUint8(0),t.vendorId=i.getUint8(2);const r=i.getUint8(4);t.strength=r,t.originalCompressionMethod=n,e.compressionMethod=t.compressionMethod=i.getUint16(5,!0)}else e.compressionMethod=n}(s,e,l):e.compressionMethod=l,8==e.compressionMethod&&(e.bitFlag.enhancedDeflating=16!=(16&e.rawBitFlag))}function dt(t,e){return new TextDecoder(e).decode(t)}function lt(t){return unescape(encodeURIComponent(t))}function ut(t){const e=[];for(let n=0;n<t.length;n++)e.push(t.charCodeAt(n));return e}const pt="function";function gt(t,e){return class{constructor(n){const i=t=>{if(this.pendingData){const e=this.pendingData;this.pendingData=new Uint8Array(e.length+t.length),this.pendingData.set(e,0),this.pendingData.set(t,e.length)}else this.pendingData=new Uint8Array(t)};if(this.codec=new t(Object.assign({},e,n)),typeof this.codec.onData==pt)this.codec.onData=i;else{if(typeof this.codec.on!=pt)throw new Error("Cannot register the callback function");this.codec.on("data",i)}}async append(t){return this.codec.push(t),n(this)}async flush(){return this.codec.push(new Uint8Array(0),!0),n(this)}};function n(t){if(t.pendingData){const e=t.pendingData;return t.pendingData=null,e}return new Uint8Array(0)}}const ft={chunkSize:524288,maxWorkers:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,workerScriptsPath:void 0,useWebWorkers:!0};let wt=Object.assign({},ft);class yt extends class{constructor(t,e={},n={}){this.reader=t,this.options=e,this.config=n}async getEntries(){const t=this.reader;t.initialized||await t.init();const e=await async function(t,e,n,i){if(t.size<n)throw new Error(et);const r=n+i;let s=n,a=await o(s);a||(a=await o(Math.min(r,t.size)));if(!a)throw new Error(nt);return a;async function o(i){const r=t.size-i,s=await t.readUint8Array(r,i);for(let t=s.length-n;t>=0;t--)if(s[t]==e[0]&&s[t+1]==e[1]&&s[t+2]==e[2]&&s[t+3]==e[3])return{offset:r,buffer:s.slice(t,t+n).buffer}}}(t,[80,75,5,6],22,65536);let n,i=new DataView(e.buffer),r=i.getUint32(16,!0),s=i.getUint16(8,!0);if(4294967295==r||65535==s){n=!0;const i=await t.readUint8Array(e.offset-20,20),a=new DataView(i.buffer);if(1347094023!=Number(a.getUint32(0,!1)))throw new Error("End of Zip64 central directory not found");r=Number(a.getBigUint64(8,!0));const o=await t.readUint8Array(r,56),c=new DataView(o.buffer);if(1347094022!=Number(c.getUint32(0,!1)))throw new Error("End of Zip64 central directory locator not found");s=Number(c.getBigUint64(24,!0)),r-=Number(c.getBigUint64(40,!0))}if(r<0||!n&&(r>=t.size||s>=65535))throw new Error(et);const a=await t.readUint8Array(r,t.size-r);i=new DataView(a.buffer);const o=[];let c=0;for(let t=0;t<s;t++){const t=new ot(this.reader,this.config,this.options);if(1347092738!=i.getUint32(c,!1))throw new Error("Central directory header not found");t.compressedSize=0,t.uncompressedSize=0,ct(t,i,c+6),t.commentLength=i.getUint16(c+32,!0),t.directory=16==(16&i.getUint8(c+38)),t.offset=i.getUint32(c+42,!0),t.rawFilename=a.subarray(c+46,c+46+t.filenameLength),t.filename=dt(t.rawFilename,t.bitFlag.languageEncodingFlag?st:this.options.filenameEncoding||at),t.directory||"/"!=t.filename.charAt(t.filename.length-1)||(t.directory=!0),t.rawExtraField=a.subarray(c+46+t.filenameLength,c+46+t.filenameLength+t.extraFieldLength),ht(t,t,i,c+6),t.rawComment=a.subarray(c+46+t.filenameLength+t.extraFieldLength,c+46+t.filenameLength+t.extraFieldLength+t.commentLength),t.comment=dt(t.rawComment,t.bitFlag.languageEncodingFlag?st:this.options.commentEncoding||at),o.push(t),c+=46+t.filenameLength+t.extraFieldLength+t.commentLength}return o}async close(){}}{constructor(t,e){super(t,e,wt)}}class mt extends class{constructor(t,e={},n={}){this.writer=t,this.options=e,this.config=n,this.files=new Map,this.offset=t.size,this.zip64=e.zip64}async add(t,e,n={}){if(t=t.trim(),n.directory&&"/"!=t.charAt(t.length-1)&&(t+="/"),this.files.has(t))throw new Error("File already exists");if(n.comment=ut(lt(n.comment||"")),n.comment>65536)throw new Error("File entry comment exceeds 64KB");n.zip64=n.zip64||this.zip64,await async function(t,e,n,i){const r=t.files,s=t.writer;let a;r.set(e,null);try{let o,c;try{i.bufferedWrite||t.options.bufferedWrite||t.lockWrite?(o=new g,o.init()):(t.lockWrite=new Promise((t=>a=t)),s.initialized||await s.init(),o=s),(t.offset>=4294967295||n&&(n.size>=4294967295||t.offset+n.size>=4294967295))&&(i.zip64=!0),c=await async function(t,e,n,i,r,s){const a=ut(lt(t)),o=s.lastModDate||new Date,c=new Uint8Array(26),h=new DataView(c.buffer),d=void 0===s.password?r.password:s.password,l=d&&d.length&&d,u=void 0===s.level?r.level:s.level,p=0!==u&&!s.directory,g=void 0===d||!d.length,f=s.zip64,w={zip64:f,headerArray:c,directory:s.directory,filename:a,comment:s.comment,extraFieldZip64:f?new Uint8Array(28):new Uint8Array(0),extraFieldAES:l?new Uint8Array([1,153,7,0,2,0,65,69,3,0,0]):new Uint8Array(0),rawExtraField:new Uint8Array(0)},y=s.extraField;if(y){let t=4,e=0;y.forEach((e=>t+=e.length));const n=w.rawExtraField=new Uint8Array(t);y.forEach(((t,i)=>{n.set(new Uint16Array([i]),e),n.set(new Uint16Array([t.length]),e+2),n.set(t,e+4),e+=4+t.length}))}s.bitFlag=8,s.version=(void 0===s.version?r.version:s.version)||20,s.compressionMethod=0,p&&(s.compressionMethod=8);f&&(s.version=s.version>45?s.version:45);l&&(s.version=s.version>51?s.version:51,s.bitFlag=9,s.compressionMethod=99,p&&(w.extraFieldAES[9]=8));h.setUint16(0,s.version,!0),h.setUint16(2,s.bitFlag,!0),h.setUint16(4,s.compressionMethod,!0),h.setUint16(6,(o.getHours()<<6|o.getMinutes())<<5|o.getSeconds()/2,!0),h.setUint16(8,(o.getFullYear()-1980<<4|o.getMonth()+1)<<5|o.getDate(),!0),h.setUint16(22,a.length,!0),h.setUint16(24,0,!0);const m=new Uint8Array(30+a.length);let U;if(new DataView(m.buffer).setUint32(0,1347093252),m.set(c,4),m.set(a,30),e){e.initialized||await e.init();const t=await J(i,{codecType:V,level:u,outputPassword:d,outputSigned:g,outputCompressed:p,outputEncrypted:Boolean(d)});await n.writeUint8Array(m),U=await $(t,e,n,0,e.size,i,{onprogress:s.onprogress}),w.compressedSize=U.length}else await n.writeUint8Array(m);const b=new Uint8Array(f?24:16),A=new DataView(b.buffer);if(A.setUint32(0,1347094280),e)if(l||void 0===U.signature||(h.setUint32(10,U.signature,!0),A.setUint32(4,U.signature,!0)),f){h.setUint32(14,4294967295,!0),A.setBigUint64(8,BigInt(w.compressedSize),!0),h.setUint32(18,4294967295,!0),A.setBigUint64(16,BigInt(e.size),!0);const t=new DataView(w.extraFieldZip64.buffer);t.setUint16(0,1,!0),t.setUint16(2,24,!0),t.setBigUint64(4,BigInt(e.size),!0),t.setBigUint64(12,BigInt(w.compressedSize),!0)}else h.setUint32(14,w.compressedSize,!0),A.setUint32(8,w.compressedSize,!0),h.setUint32(18,e.size,!0),A.setUint32(12,e.size,!0);return await n.writeUint8Array(b),w.length=m.length+(U?U.length:0)+b.length,w}(e,n,o,t.config,t.options,i)}catch(t){throw r.delete(e),t}if(r.set(e,c),o!=s&&(t.lockWrite&&await t.lockWrite,await s.writeUint8Array(o.getData())),c.offset=t.offset,c.zip64){new DataView(c.extraFieldZip64.buffer).setBigUint64(20,BigInt(c.offset),!0)}t.offset+=c.length}finally{a&&(t.lockWrite=null,a())}}(this,t,e,n)}async close(t){const e=this.writer,n=this.files;let i=0,r=0,s=this.offset,a=n.size;for(const[,t]of n)r+=46+t.filename.length+t.comment.length+t.extraFieldZip64.length+t.extraFieldAES.length+t.rawExtraField.length;(s+r>=4294967295||a>=65535)&&(this.zip64=!0);const o=new Uint8Array(r+(this.zip64?98:22)),c=new DataView(o.buffer);for(const[,t]of n){const e=t.filename,n=t.extraFieldZip64,r=t.extraFieldAES,s=n.length+r.length+t.rawExtraField.length;c.setUint32(i,1347092738),t.zip64?c.setUint16(i+4,11520):c.setUint16(i+4,5120),o.set(t.headerArray,i+6),c.setUint16(i+30,s,!0),c.setUint16(i+32,t.comment.length,!0),t.directory&&c.setUint8(i+38,16),t.zip64?c.setUint32(i+42,4294967295,!0):c.setUint32(i+42,t.offset,!0),o.set(e,i+46),o.set(n,i+46+e.length),o.set(r,i+46+e.length+n.length),o.set(t.rawExtraField,46+e.length+n.length+r.length),o.set(t.comment,i+46+e.length+s),i+=46+e.length+s+t.comment.length}if(this.zip64&&(c.setUint32(i,1347094022),c.setBigUint64(i+4,BigInt(44),!0),c.setUint16(i+12,45,!0),c.setUint16(i+14,45,!0),c.setBigUint64(i+24,BigInt(a),!0),c.setBigUint64(i+32,BigInt(a),!0),c.setBigUint64(i+40,BigInt(r),!0),c.setBigUint64(i+48,BigInt(s),!0),c.setUint32(i+56,1347094023),c.setBigUint64(i+64,BigInt(s+r),!0),c.setUint32(i+72,1,!0),a=65535,s=4294967295,i+=76),c.setUint32(i,1347093766),c.setUint16(i+8,a,!0),c.setUint16(i+10,a,!0),c.setUint32(i+12,r,!0),c.setUint32(i+16,s,!0),t&&t.length){if(!(t.length<=65536))throw new Error("Zip file comment exceeds 64KB");c.setUint16(i+20,t.length,!0)}return await e.writeUint8Array(o),t&&t.length&&await e.writeUint8Array(t),e.getData()}}{constructor(t,e){super(t,e,wt)}}const Ut=524288;class bt{constructor(t,e,n,i){if(t.root&&i&&i.getChildByName(e))throw new Error("Entry filename already exists");n||(n={}),this.fs=t,this.name=e,this.id=t.entries.length,this.parent=i,this.children=[],this.zipVersion=n.zipVersion||20,this.uncompressedSize=0,t.entries.push(this),i&&this.parent.children.push(this)}moveTo(t){if(!t.directory)throw"Target entry is not a directory";if(t.isDescendantOf(this))throw"Entry is a ancestor of target entry";if(this!=t){if(t.getChildByName(this.name))throw"Entry filename already exists";Ft(this),this.parent=t,t.children.push(this)}}getFullname(){let t=this.name,e=this.parent;for(;e;)t=(e.name?e.name+"/":"")+t,e=e.parent;return t}isDescendantOf(t){let e=this.parent;for(;e&&e.id!=t.id;)e=e.parent;return Boolean(e)}}class At extends bt{constructor(t,e,n,i){super(t,e,n,i),this.Reader=n.Reader,this.Writer=n.Writer,this.data=n.data,n.getData&&(this.getData=n.getData)}async getData(t,e={}){return!t||t.constructor==this.Writer&&this.data?this.data:(this.reader||(this.reader=new this.Reader(this.data)),await this.reader.init(),await t.init(),this.uncompressedSize=this.reader.size,async function(t,e,n){return i();async function i(r=0){const s=r*Ut;if(n.onprogress&&n.onprogress(s,t.size),s<t.size){const n=await t.readUint8Array(s,Math.min(Ut,t.size-s));return await e.writeUint8Array(n),i(r+1)}return e.getData()}}(this.reader,t,e))}getText(t,e){return this.getData(new o(t),e)}getBlob(t,e){return this.getData(new l(t),e)}getData64URI(t,e){return this.getData(new h(t),e)}}class zt extends bt{constructor(t,e,n,i){super(t,e,n,i),this.directory=!0}addDirectory(t){return Bt(this,t,null,!0)}addText(t,e){return Bt(this,t,{data:e,Reader:a,Writer:o})}addBlob(t,e){return Bt(this,t,{data:e,Reader:d,Writer:l})}addData64URI(t,e){return Bt(this,t,{data:e,Reader:c,Writer:h})}addHttpContent(t,e,n={}){return Bt(this,t,{data:e,Reader:n.useRangeHeader?p:u})}addFileEntry(t){!async function(t,e){e.isDirectory?await i(t,e):await new Promise(((n,i)=>{e.file((i=>{t.addBlob(e.name,i),n()}),i)}));function n(t){return new Promise(((e,n)=>{let i=[];function r(t){t.readEntries((n=>{n.length?(i=i.concat(n),r(t)):e(i)}),n)}t.isDirectory&&r(t.createReader()),t.isFile&&e(i)}))}async function i(t,e){const r=await n(e);for(const e of r)e.isDirectory&&await i(t.addDirectory(e.name)),await new Promise(((n,i)=>{e.isFile&&e.file((i=>{const r=t.addBlob(e.name,i);r.uncompressedSize=i.size,n(r)}),i)}))}}(this,t)}async addData(t,e){return Bt(this,t,e)}async importBlob(t,e={}){await this.importZip(new d(t),e)}async importData64URI(t,e={}){await this.importZip(new c(t),e)}async importHttpContent(t,e={}){await this.importZip(e.useRangeHeader?new p(t):new u(t),e)}async exportBlob(t={}){return this.exportZip(new l("application/zip"),t)}async exportData64URI(t={}){return this.exportZip(new h("application/zip"),t)}async importZip(t,e){await t.init();const n=new yt(t),i=await n.getEntries();let r=0;const s=xt(i,"compressedSize");i.forEach((t=>{let n=this,i=t.filename.split("/"),a=i.pop();if(i.forEach((t=>n=n.getChildByName(t)||new zt(this.fs,t,null,n))),!t.directory){let i=r;Bt(n,a,{data:t,Reader:Dt(Object.assign({},e,{onprogress:t=>{e.onprogress&&e.onprogress(i+t,s)}}))}),r+=t.compressedSize}}))}async exportZip(t,e){await vt(this);const n=new mt(t);return await async function(t,e,n,i){let r=0;async function s(t,e){async function a(){let a=0;for(const o of e.children){let e=r;await t.add(o.getFullname(),o.reader,Object.assign({directory:o.directory,version:o.zipVersion},i,{onprogress:t=>{i.onprogress&&i.onprogress(e+a+t,n)}})),r+=o.uncompressedSize,await s(t,o),a++}}await a()}await s(t,e)}(n,this,xt([this],"uncompressedSize"),e),await n.close(),t.getData()}getChildByName(t){for(let e=0;e<this.children.length;e++){const n=this.children[e];if(n.name==t)return n}}}const Et={FS:class{constructor(){Rt(this)}remove(t){Ft(t),this.entries[t.id]=null}find(t){const e=t.split("/");let n=this.root;for(let t=0;n&&t<e.length;t++)n=n.getChildByName(e[t]);return n}getById(t){return this.entries[t]}async importBlob(t){Rt(this),await this.root.importBlob(t)}async importData64URI(t){Rt(this),await this.root.importData64URI(t)}async importHttpContent(t,e){this.entries=[],this.root=new zt(this),await this.root.importHttpContent(t,e)}async exportBlob(t){return this.root.exportBlob(t)}async exportData64URI(t){return this.root.exportData64URI(t)}},ZipDirectoryEntry:zt,ZipFileEntry:At};function xt(t,e){let n=0;return t.forEach((function t(i){n+=i[e],i.children&&i.children.forEach(t)})),n}function Dt(t){return class{constructor(t){this.entry=t,this.size=0}async readUint8Array(e,n){if(!this.blobReader){const e=await this.entry.getData(new l,t);this.data=e,this.blobReader=new d(e)}return this.blobReader.readUint8Array(e,n)}async init(){this.size=this.entry.uncompressedSize}}}async function vt(t){if(t.children.length)for(const e of t.children)e.directory?await vt(e):(e.reader=new e.Reader(e.data),await e.reader.init(),e.uncompressedSize=e.reader.size)}function Ft(t){const e=t.parent.children;e.forEach(((n,i)=>{n.id==t.id&&e.splice(i,1)}))}function Rt(t){t.entries=[],t.root=new zt(t)}function Bt(t,e,n,i){if(t.directory)return i?new zt(t.fs,e,n,t):new At(t.fs,e,n,t);throw"Parent entry is not a directory"}t.BlobReader=d,t.BlobWriter=l,t.Data64URIReader=c,t.Data64URIWriter=h,t.HttpRangeReader=p,t.HttpReader=u,t.Reader=r,t.TextReader=a,t.TextWriter=o,t.Uint8ArrayReader=class extends r{constructor(t){super(),this.array=t,this.size=t.length}readUint8Array(t,e){return this.array.slice(t,t+e)}},t.Uint8ArrayWriter=g,t.Writer=s,t.ZipReader=yt,t.ZipWriter=mt,t.configure=function(t){wt=Object.assign({},wt,t)},t.fs=Et,t.getMimeType=function(){return"application/octet-stream"},t.initShimAsyncCodec=(t,e={})=>({ZipDeflate:gt(t.Deflate,e.deflate),ZipInflate:gt(t.Inflate,e.inflate)}),Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).zip={})}(this,(function(t){"use strict";const e="HTTP error ",n="text/plain";class i{constructor(){this.size=0}init(){this.initialized=!0}}class r extends i{}class s extends i{writeUint8Array(t){this.size+=t.length}}class a extends r{constructor(t){super(),this.blobReader=new d(new Blob([t],{type:n}))}init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}readUint8Array(t,e){return this.blobReader.readUint8Array(t,e)}}class o extends s{constructor(t){super(),this.encoding=t,this.blob=new Blob([],{type:n})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:n})}getData(){const t=new FileReader;return new Promise(((e,n)=>{t.onload=t=>e(t.target.result),t.onerror=n,t.readAsText(this.blob,this.encoding)}))}}class c extends r{constructor(t){super(),this.dataURI=t;let e=t.length;for(;"="==t.charAt(e-1);)e--;this.dataStart=t.indexOf(",")+1,this.size=Math.floor(.75*(e-this.dataStart))}readUint8Array(t,e){const n=new Uint8Array(e),i=4*Math.floor(t/3),r=atob(this.dataURI.substring(i+this.dataStart,4*Math.ceil((t+e)/3)+this.dataStart)),s=t-3*Math.floor(i/4);for(let t=s;t<s+e;t++)n[t-s]=r.charCodeAt(t);return n}}class h extends s{constructor(t){super(),this.data="data:"+(t||"")+";base64,",this.pending=[]}writeUint8Array(t){super.writeUint8Array(t);let e=0,n=this.pending;const i=this.pending.length;for(this.pending="",e=0;e<3*Math.floor((i+t.length)/3)-i;e++)n+=String.fromCharCode(t[e]);for(;e<t.length;e++)this.pending+=String.fromCharCode(t[e]);n.length>2?this.data+=btoa(n):this.pending=n}getData(){return this.data+btoa(this.pending)}}class d extends r{constructor(t){super(),this.blob=t,this.size=t.size}readUint8Array(t,e){const n=new FileReader;return new Promise(((i,r)=>{n.onload=t=>i(new Uint8Array(t.target.result)),n.onerror=r,n.readAsArrayBuffer(this.blob.slice(t,t+e))}))}}class l extends s{constructor(t){super(),this.offset=0,this.contentType=t,this.blob=new Blob([],{type:t})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:this.contentType}),this.offset=this.blob.size}getData(){return this.blob}}class u extends r{constructor(t){super(),this.url=t}async init(){if(super.init(),function(t){if("undefined"!=typeof document){const e=document.createElement("a");return e.href=t,"http:"==e.protocol||"https:"==e.protocol}return/^https?:\/\//i.test(t)}(this.url))return new Promise(((t,n)=>{const i=new XMLHttpRequest;i.addEventListener("load",(()=>{i.status<400?(this.size=Number(i.getResponseHeader("Content-Length")),this.size?t():f().then((()=>t())).catch(n)):n(e+(i.statusText||i.status)+".")}),!1),i.addEventListener("error",n,!1),i.open("HEAD",this.url),i.send()}));await f()}async readUint8Array(t,e){return this.data||await f(this,this.url),new Uint8Array(this.data.subarray(t,t+e))}}class p extends r{constructor(t){super(),this.url=t}init(){return super.init(),new Promise(((t,n)=>{const i=new XMLHttpRequest;i.addEventListener("load",(()=>{i.status<400?(this.size=Number(i.getResponseHeader("Content-Length")),"bytes"==i.getResponseHeader("Accept-Ranges")?t():n(new Error("HTTP Range not supported"))):n(e+(i.statusText||i.status)+".")}),!1),i.addEventListener("error",n,!1),i.open("HEAD",this.url),i.send()}))}readUint8Array(t,n){return new Promise(((i,r)=>{const s=new XMLHttpRequest;s.open("GET",this.url),s.responseType="arraybuffer",s.setRequestHeader("Range","bytes="+t+"-"+(t+n-1)),s.addEventListener("load",(()=>{s.status<400?i(new Uint8Array(s.response)):r(e+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",r,!1),s.send()}))}}class g extends s{constructor(){super(),this.array=new Uint8Array(0)}writeUint8Array(t){super.writeUint8Array(t);const e=this.array;this.array=new Uint8Array(e.length+t.length),this.array.set(e),this.array.set(t,e.length)}getData(){return this.array}}function f(t,n){return new Promise(((i,r)=>{const s=new XMLHttpRequest;s.addEventListener("load",(()=>{s.status<400?(t.size||(t.size=Number(s.getResponseHeader("Content-Length"))||Number(s.response.byteLength)),t.data=new Uint8Array(s.response),i()):r(e+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",r,!1),s.open("GET",n),s.responseType="arraybuffer",s.send()}))}const w=4294967295,y=65535,m=1347093252,U=1347094280,b=1347092738,A=1347093766,E=1347094022,x=1347094023;class z{constructor(){this.crc=-1,this.table=(()=>{const t=[];for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)1&n?n=n>>>1^3988292384:n>>>=1;t[e]=n}return t})()}append(t){const e=this.table;let n=0|this.crc;for(let i=0,r=0|t.length;i<r;i++)n=n>>>8^e[255&(n^t[i])];this.crc=n}get(){return~this.crc}}const D="Invalid pasword",v=16,F="raw",R={name:"PBKDF2"},B={name:"HMAC"},S="SHA-1",I={name:"AES-CTR"},M=Object.assign({hash:B},R),L=Object.assign({iterations:1e3,hash:{name:S}},R),k=Object.assign({hash:S},B),C=Object.assign({length:v},I),T=["deriveBits"],W=["sign"],P=528,V=10,Z=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],j=crypto.subtle;class H{constructor(t,e){this.password=t,this.signed=e,this.input=e&&new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(t){const e=async(r=0)=>{if(r+v<=i.length-V){const t=i.subarray(r,r+v),s=await j.decrypt(Object.assign({counter:this.counter},C),this.keys.decrypt,t);return N(this.counter),n.set(new Uint8Array(s),r),e(r+v)}return this.pendingInput=i.subarray(r),this.signed&&(this.input=q(this.input,t)),n};if(this.password){const e=t.subarray(0,18);await async function(t,e,n){t.counter=new Uint8Array(Z);const i=e.subarray(0,16),r=e.subarray(16),s=(new TextEncoder).encode(n),a=await j.importKey(F,s,M,!1,T),o=await j.deriveBits(Object.assign({salt:i},L),a,528),c=new Uint8Array(o),h=c.subarray(64);if(t.keys={decrypt:await j.importKey(F,c.subarray(0,32),I,!0,["decrypt"]),authentication:await j.importKey(F,c.subarray(32,64),k,!1,W),passwordVerification:h},h[0]!=r[0]||h[1]!=r[1])throw new Error(D)}(this,e,this.password),this.password=null,t=t.subarray(18)}let n=new Uint8Array(t.length-V-(t.length-V)%v),i=t;return this.pendingInput.length&&(i=q(this.pendingInput,t),n=K(n,i.length-V-(i.length-V)%v)),e()}async flush(){const t=this.pendingInput,e=this.keys,n=t.subarray(0,t.length-V),i=t.subarray(t.length-V);let r=new Uint8Array(0);if(n.length){const t=await j.decrypt(Object.assign({counter:this.counter},C),e.decrypt,n);r=new Uint8Array(t)}let s=!0;if(this.signed){const t=await j.sign(B,e.authentication,this.input.subarray(0,this.input.length-V)),n=new Uint8Array(t);this.input=null;for(let t=0;t<V;t++)n[t]!=i[t]&&(s=!1)}return{valid:s,data:r}}}class O{constructor(t){this.password=t,this.output=new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(t){const e=async(r=0)=>{if(r+v<=t.length){const s=t.subarray(r,r+v),a=await j.encrypt(Object.assign({counter:this.counter},C),this.keys.encrypt,s);return N(this.counter),i.set(new Uint8Array(a),r+n.length),e(r+v)}return this.pendingInput=t.subarray(r),this.output=q(this.output,i),i};let n=new Uint8Array(0);this.password&&(n=await async function(t,e){t.counter=new Uint8Array(Z);const n=crypto.getRandomValues(new Uint8Array(16)),i=(new TextEncoder).encode(e),r=await j.importKey(F,i,M,!1,T),s=await j.deriveBits(Object.assign({salt:n},L),r,P),a=new Uint8Array(s);return t.keys={encrypt:await j.importKey(F,a.subarray(0,32),I,!0,["encrypt"]),authentication:await j.importKey(F,a.subarray(32,64),k,!1,W),passwordVerification:a.subarray(64)},q(n,t.keys.passwordVerification)}(this,this.password),this.password=null);let i=new Uint8Array(n.length+t.length-t.length%v);return i.set(n,0),this.pendingInput.length&&(t=q(this.pendingInput,t),i=K(i,t.length-t.length%v)),e()}async flush(){let t=new Uint8Array(0);if(this.pendingInput.length){const e=await j.encrypt(Object.assign({counter:this.counter},C),this.keys.encrypt,this.pendingInput);t=new Uint8Array(e),this.output=q(this.output,t)}const e=await j.sign(B,this.keys.authentication,this.output.subarray(18));this.output=null;const n=new Uint8Array(e).subarray(0,V);return{data:q(t,n),signature:n}}}function N(t){for(let e=0;e<16;e++){if(255!=t[e]){t[e]++;break}t[e]=0}}function q(t,e){let n=t;return t.length+e.length&&(n=new Uint8Array(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function K(t,e){if(e&&e>t.length){const n=t;(t=new Uint8Array(e)).set(n,0)}return t}const X="deflate",G="inflate",_="Invalid signature";class Y{constructor(t){this.signature=t.inputSignature,this.encrypted=Boolean(t.inputPassword),this.signed=t.inputSigned,this.compressed=t.inputCompressed,this.inflate=this.compressed&&new ZipInflate,this.crc32=this.signed&&this.signed&&new z,this.decrypt=this.encrypted&&new H(t.inputPassword)}async append(t){return this.encrypted&&(t=await this.decrypt.append(t)),this.compressed&&t.length&&(t=await this.inflate.append(t)),!this.encrypted&&this.signed&&this.crc32.append(t),t}async flush(){let t,e=new Uint8Array(0);if(this.encrypted){const t=await this.decrypt.flush();if(!t.valid)throw new Error(_);e=t.data}else if(this.signed){const e=new DataView(new Uint8Array(4).buffer);if(t=this.crc32.get(),e.setUint32(0,t),this.signature!=e.getUint32(0,!1))throw new Error(_)}return this.compressed&&(e=await this.inflate.append(e)||new Uint8Array(0),await this.inflate.flush()),{data:e,signature:t}}}class J{constructor(t){this.encrypted=t.outputEncrypted,this.signed=t.outputSigned,this.compressed=t.outputCompressed,this.deflate=this.compressed&&new ZipDeflate({level:t.level||5}),this.crc32=this.signed&&new z,this.encrypt=this.encrypted&&new O(t.outputPassword)}async append(t){let e=t;return this.compressed&&t.length&&(e=await this.deflate.append(t)),this.encrypted?e=await this.encrypt.append(e):this.signed&&this.crc32.append(t),e}async flush(){let t,e=new Uint8Array(0);if(this.compressed&&(e=await this.deflate.flush()||new Uint8Array(0)),this.encrypted){e=await this.encrypt.append(e);const n=await this.encrypt.flush();t=n.signature;const i=new Uint8Array(e.length+n.data.length);i.set(e,0),i.set(n.data,e.length),e=i}else this.signed&&(t=this.crc32.get());return{data:e,signature:t}}}const Q="init",$="append",tt="flush",et="message",nt="z-worker.js",it={deflate:[nt,"deflate.js"],inflate:[nt,"inflate.js"]},rt={pool:[],pendingRequests:[]};function st(t,e){const n=rt.pool;let i;if(t.useWebWorkers){const n=e.codecType;if(null!=t.workerScripts&&null!=t.workerScriptsPath)throw new Error("Either workerScripts or workerScriptsPath may be set, not both");if(t.workerScripts){if(i=t.workerScripts[n],!Array.isArray(i))throw new Error("workerScripts."+n+" must be an array");r=i,i="undefined"!=typeof document?r.map((t=>new URL(t,document.baseURI).href)):r}else i=it[n].slice(0),i[0]=(t.workerScriptsPath||"")+i[0]}var r;if(n.length<t.maxWorkers){const t={worker:i&&new Worker(i[0]),busy:!0,options:e,scripts:i};return n.push(t),i?function(t){const e=t.worker;let n;return e.addEventListener(et,s,!1),t.interface={append:async t=>i({type:$,data:t}),flush:async()=>i({type:tt})},t.interface;async function i(e){if(!n){const e=t.scripts.slice(1);await r(Object.assign({type:Q,options:t.options,scripts:e}))}return r(e)}function r(i){try{if(i.data)try{e.postMessage(i,[i.data.buffer])}catch(t){e.postMessage(i)}else e.postMessage(i)}catch(e){n.reject(e),n=null,ct(t)}return new Promise(((t,e)=>n={resolve:t,reject:e}))}function s(e){const i=e.data;if(n){const e=i.error;if(e){const i=new Error(e.message);i.stack=e.stack,n.reject(i),n=null,ct(t)}else i.type!=Q&&i.type!=tt&&i.type!=$||(i.type==tt?(n.resolve({data:new Uint8Array(i.data),signature:i.signature}),n=null,ct(t)):n.resolve(i.data&&new Uint8Array(i.data)))}}}(t):at(t)}{const t=n.find((t=>!t.busy));return t?(t.busy=!0,t.options=e,t.scripts=i,i?t.interface:at(t)):new Promise((t=>rt.pendingRequests.push({resolve:t,options:e,scripts:i})))}}function at(t){const e=(n=t.options).codecType.startsWith(X)?new J(n):n.codecType.startsWith(G)?new Y(n):void 0;var n;const i=e.append.bind(e),r=e.flush.bind(e);return e.append=async e=>{try{return await i(e)}catch(e){throw await ot(t),e}},e.flush=async()=>{try{return await r()}finally{await ot(t)}},e}async function ot(t){if(t.busy=!1,rt.pendingRequests.length){const[{resolve:e,options:n}]=rt.pendingRequests.splice(0,1);t.busy=!0,t.options=n,e(at(t))}else rt.pool=rt.pool.filter((e=>e!=t))}function ct(t){if(t.busy=!1,rt.pendingRequests.length){const[{resolve:e,options:n,scripts:i}]=rt.pendingRequests.splice(0,1);t.busy=!0,t.options=n,t.scripts=i,e(t.interface)}else t.worker.terminate(),rt.pool=rt.pool.filter((e=>e!=t))}async function ht(t,e,n,i,r,s,a){const o=Math.max(s.chunkSize,64);return async function s(c=0,h=0){const d=c*o;if(d<r){const l=await e.readUint8Array(d+i,Math.min(o,r-d)),u=await t.append(l);return h+=await dt(n,u),a.onprogress&&a.onprogress(d+l.length,r),s(c+1,h)}{const e=await t.flush();return h+=await dt(n,e.data),{signature:e.signature,length:h}}}()}async function dt(t,e){return e.length&&await t.writeUint8Array(e),e.length}const lt="File format is not recognized",ut="End of central directory not found",pt="Zip64 extra field not found",gt="Compression method not supported",ft="utf-8",wt="windows-1252";class yt{constructor(t,e,n){this.reader=t,this.config=e,this.options=n}async getData(t,e={}){const n=this.reader;n.initialized||await n.init();const i=await n.readUint8Array(this.offset,30),r=new DataView(i.buffer),s=void 0===e.password?this.options.password:e.password;let a=s&&s.length&&s;if(this.extraFieldAES){if(99!=this.extraFieldAES.originalCompressionMethod)throw new Error(gt);if(3!=this.extraFieldAES.strength)throw new Error("Encryption not supported")}if(0!=this.compressionMethod&&8!=this.compressionMethod)throw new Error(gt);if(r.getUint32(0,!1)!=m)throw new Error("Local file header not found");const o=this.localDirectory={};mt(o,r,4),o.rawExtraField=i.subarray(this.offset+30+o.filenameLength,this.offset+30+o.filenameLength+o.extraFieldLength),Ut(this,o,r,4);let c=this.offset+30+o.filenameLength+o.extraFieldLength;const h=this.bitFlag.encrypted&&o.bitFlag.encrypted;if(h&&!a)throw new Error("File contains encrypted entry");const d=await st(this.config,{codecType:G,inputPassword:a,inputSigned:void 0===e.checkSignature?this.options.checkSignature:e.checkSignature,inputSignature:this.signature,inputCompressed:0!=this.compressionMethod,inputEncrypted:h});return t.initialized||await t.init(),await ht(d,n,t,c,this.compressedSize,this.config,{onprogress:e.onprogress}),t.getData()}}function mt(t,e,n){t.version=e.getUint16(n,!0);const i=t.rawBitFlag=e.getUint16(n+2,!0);t.bitFlag={encrypted:1==(1&i),level:(6&i)>>1,dataDescriptor:8==(8&i),languageEncodingFlag:2048==(2048&i)},t.encrypted=t.bitFlag.encrypted,t.rawLastModDate=e.getUint32(n+6,!0),t.lastModDate=function(t){const e=(4294901760&t)>>16,n=65535&t;try{return new Date(1980+((65024&e)>>9),((480&e)>>5)-1,31&e,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch(t){}}(t.rawLastModDate),t.filenameLength=e.getUint16(n+22,!0),t.extraFieldLength=e.getUint16(n+24,!0)}function Ut(t,e,n,i){let r,s,a;const o=e.rawExtraField,c=e.extraField=new Map,h=new DataView(new Uint8Array(o).buffer);let d=0;try{for(;d<o.length;){const t=h.getUint16(d,!0),e=h.getUint16(d+2,!0);c.set(t,{type:t,data:o.slice(d+4,d+4+e)}),d+=4+e}}catch(t){}const l=n.getUint16(i+4,!0);e.signature=n.getUint32(i+10,!0),e.uncompressedSize=n.getUint32(i+18,!0),e.compressedSize=n.getUint32(i+14,!0),r=e.extraFieldZip64=c.get(1),r&&function(t,e){e.zip64=!0;const n=new DataView(t.data.buffer);t.values=[];for(let e=0;e<Math.floor(t.data.length/8);e++)t.values.push(Number(n.getBigUint64(0+8*e,!0)));const i=["uncompressedSize","compressedSize","offset"],r=i.filter((t=>e[t]==w));for(let e=0;e<r.length;e++)t[r[e]]=t.values[e];i.forEach((n=>{if(e[n]==w){if(!t||void 0===t[n])throw new Error(pt);e[n]=t&&t[n]}}))}(r,e),a=e.extraFieldUnicodePath=c.get(28789),a&&function(t,e,n){const i=new DataView(t.data.buffer);t.version=i.getUint8(0),t.signature=i.getUint32(1,!0);const r=new z;r.append(n.rawFilename);const s=new DataView(new Uint8Array(4).buffer);s.setUint32(0,r.get()),t.filename=(new TextDecoder).decode(t.data.subarray(5)),t.signature==s.getUint32(0,!1)&&(e.filename=t.filename)}(a,e,t),s=e.extraFieldAES=c.get(39169),s?function(t,e,n){if(t){const i=new DataView(t.data.buffer);t.vendorVersion=i.getUint8(0),t.vendorId=i.getUint8(2);const r=i.getUint8(4);t.strength=r,t.originalCompressionMethod=n,e.compressionMethod=t.compressionMethod=i.getUint16(5,!0)}else e.compressionMethod=n}(s,e,l):e.compressionMethod=l,8==e.compressionMethod&&(e.bitFlag.enhancedDeflating=16!=(16&e.rawBitFlag))}function bt(t,e){return new TextDecoder(e).decode(t)}const At="File entry name exceeds 64KB",Et="Version exceeds 65535",xt="Extra field type exceeds 65535",zt="Extra field data exceeds 64KB";function Dt(t){return unescape(encodeURIComponent(t))}function vt(t){const e=[];for(let n=0;n<t.length;n++)e.push(t.charCodeAt(n));return e}const Ft="function";function Rt(t,e){return class{constructor(n){const i=t=>{if(this.pendingData){const e=this.pendingData;this.pendingData=new Uint8Array(e.length+t.length),this.pendingData.set(e,0),this.pendingData.set(t,e.length)}else this.pendingData=new Uint8Array(t)};if(this.codec=new t(Object.assign({},e,n)),typeof this.codec.onData==Ft)this.codec.onData=i;else{if(typeof this.codec.on!=Ft)throw new Error("Cannot register the callback function");this.codec.on("data",i)}}async append(t){return this.codec.push(t),n(this)}async flush(){return this.codec.push(new Uint8Array(0),!0),n(this)}};function n(t){if(t.pendingData){const e=t.pendingData;return t.pendingData=null,e}return new Uint8Array(0)}}const Bt={chunkSize:524288,maxWorkers:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,workerScriptsPath:void 0,useWebWorkers:!0};let St=Object.assign({},Bt);class It extends class{constructor(t,e={},n={}){this.reader=t,this.options=e,this.config=n}async getEntries(){const t=this.reader;t.initialized||await t.init();const e=await async function(t,e,n,i){const r=new Uint8Array(4);if(new DataView(r.buffer).setUint32(0,e),t.size<n)throw new Error(lt);const s=n+i;let a=n,o=await c(a);o||(o=await c(Math.min(s,t.size)));if(!o)throw new Error(ut);return o;async function c(e){const i=t.size-e,s=await t.readUint8Array(i,e);for(let t=s.length-n;t>=0;t--)if(s[t]==r[0]&&s[t+1]==r[1]&&s[t+2]==r[2]&&s[t+3]==r[3])return{offset:i,buffer:s.slice(t,t+n).buffer}}}(t,A,22,y);let n,i=new DataView(e.buffer),r=i.getUint32(16,!0),s=i.getUint16(8,!0);if(r==w||s==y){n=!0;const i=await t.readUint8Array(e.offset-20,20),a=new DataView(i.buffer);if(Number(a.getUint32(0,!1))!=x)throw new Error("End of Zip64 central directory not found");r=Number(a.getBigUint64(8,!0));const o=await t.readUint8Array(r,56),c=new DataView(o.buffer);if(Number(c.getUint32(0,!1))!=E)throw new Error("End of Zip64 central directory locator not found");s=Number(c.getBigUint64(24,!0)),r-=Number(c.getBigUint64(40,!0))}if(r<0||!n&&(r>=t.size||s>=y))throw new Error(lt);const a=await t.readUint8Array(r,t.size-r);i=new DataView(a.buffer);const o=[];let c=0;for(let t=0;t<s;t++){const t=new yt(this.reader,this.config,this.options);if(i.getUint32(c,!1)!=b)throw new Error("Central directory header not found");t.compressedSize=0,t.uncompressedSize=0,mt(t,i,c+6),t.commentLength=i.getUint16(c+32,!0),t.directory=16==(16&i.getUint8(c+38)),t.offset=i.getUint32(c+42,!0),t.rawFilename=a.subarray(c+46,c+46+t.filenameLength),t.filename=bt(t.rawFilename,t.bitFlag.languageEncodingFlag?ft:this.options.filenameEncoding||wt),t.directory||"/"!=t.filename.charAt(t.filename.length-1)||(t.directory=!0),t.rawExtraField=a.subarray(c+46+t.filenameLength,c+46+t.filenameLength+t.extraFieldLength),Ut(t,t,i,c+6),t.rawComment=a.subarray(c+46+t.filenameLength+t.extraFieldLength,c+46+t.filenameLength+t.extraFieldLength+t.commentLength),t.comment=bt(t.rawComment,t.bitFlag.languageEncodingFlag?ft:this.options.commentEncoding||wt),o.push(t),c+=46+t.filenameLength+t.extraFieldLength+t.commentLength}return o}async close(){}}{constructor(t,e){super(t,e,St)}}class Mt extends class{constructor(t,e={},n={}){this.writer=t,this.options=e,this.config=n,this.files=new Map,this.offset=t.size,this.zip64=e.zip64}async add(t,e,n={}){if(t=t.trim(),n.directory&&t.length&&"/"!=t.charAt(t.length-1)&&(t+="/"),this.files.has(t))throw new Error("File already exists");if(n.comment=vt(Dt(n.comment||"")),n.comment.length>y)throw new Error("File entry comment exceeds 64KB");n.zip64=n.zip64||this.zip64,await async function(t,e,n,i){const r=t.files,s=t.writer;let a;r.set(e,null);try{let o,c;try{i.bufferedWrite||t.options.bufferedWrite||t.lockWrite?(o=new g,o.init()):(t.lockWrite=new Promise((t=>a=t)),s.initialized||await s.init(),o=s),(t.offset>=w||n&&(n.size>=w||t.offset+n.size>=w))&&(i.zip64=!0),c=await async function(t,e,n,i,r,s){const a=vt(Dt(t)),o=s.lastModDate||new Date,c=new Uint8Array(26),h=new DataView(c.buffer),d=void 0===s.password?r.password:s.password,l=d&&d.length&&d,u=void 0===s.level?r.level:s.level,p=0!==u&&!s.directory,g=void 0===d||!d.length,f=s.zip64,b={zip64:f,headerArray:c,directory:s.directory,filename:a,comment:s.comment,extraFieldZip64:f?new Uint8Array(28):new Uint8Array(0),extraFieldAES:l?new Uint8Array([1,153,7,0,2,0,65,69,3,0,0]):new Uint8Array(0),rawExtraField:new Uint8Array(0)},A=s.extraField;if(a.length>y)throw new Error(At);if(A){let t=4,e=0;A.forEach((e=>t+=e.length));const n=b.rawExtraField=new Uint8Array(t);A.forEach(((t,i)=>{if(i>y)throw new Error(xt);if(t.length>y)throw new Error(zt);n.set(new Uint16Array([i]),e),n.set(new Uint16Array([t.length]),e+2),n.set(t,e+4),e+=4+t.length}))}if(s.bitFlag=8,s.version=(void 0===s.version?r.version:s.version)||20,s.version>y)throw new Error(Et);s.compressionMethod=0,p&&(s.compressionMethod=8);f&&(s.version=s.version>45?s.version:45);l&&(s.version=s.version>51?s.version:51,s.bitFlag=9,s.compressionMethod=99,p&&(b.extraFieldAES[9]=8));h.setUint16(0,s.version,!0),h.setUint16(2,s.bitFlag,!0),h.setUint16(4,s.compressionMethod,!0),h.setUint16(6,(o.getHours()<<6|o.getMinutes())<<5|o.getSeconds()/2,!0),h.setUint16(8,(o.getFullYear()-1980<<4|o.getMonth()+1)<<5|o.getDate(),!0),h.setUint16(22,a.length,!0),h.setUint16(24,0,!0);const E=new Uint8Array(30+a.length);let x;if(new DataView(E.buffer).setUint32(0,m),E.set(c,4),E.set(a,30),e){e.initialized||await e.init();const t=await st(i,{codecType:X,level:u,outputPassword:d,outputSigned:g,outputCompressed:p,outputEncrypted:Boolean(d)});await n.writeUint8Array(E),x=await ht(t,e,n,0,e.size,i,{onprogress:s.onprogress}),b.compressedSize=x.length}else await n.writeUint8Array(E);const z=new Uint8Array(f?24:16),D=new DataView(z.buffer);if(D.setUint32(0,U),e)if(l||void 0===x.signature||(h.setUint32(10,x.signature,!0),D.setUint32(4,x.signature,!0)),f){h.setUint32(14,w,!0),D.setBigUint64(8,BigInt(b.compressedSize),!0),h.setUint32(18,w,!0),D.setBigUint64(16,BigInt(e.size),!0);const t=new DataView(b.extraFieldZip64.buffer);t.setUint16(0,1,!0),t.setUint16(2,24,!0),t.setBigUint64(4,BigInt(e.size),!0),t.setBigUint64(12,BigInt(b.compressedSize),!0)}else h.setUint32(14,b.compressedSize,!0),D.setUint32(8,b.compressedSize,!0),h.setUint32(18,e.size,!0),D.setUint32(12,e.size,!0);return await n.writeUint8Array(z),b.length=E.length+(x?x.length:0)+z.length,b}(e,n,o,t.config,t.options,i)}catch(t){throw r.delete(e),t}if(r.set(e,c),o!=s&&(t.lockWrite&&await t.lockWrite,await s.writeUint8Array(o.getData())),c.offset=t.offset,c.zip64){new DataView(c.extraFieldZip64.buffer).setBigUint64(20,BigInt(c.offset),!0)}t.offset+=c.length}finally{a&&(t.lockWrite=null,a())}}(this,t,e,n)}async close(t){const e=this.writer,n=this.files;let i=0,r=0,s=this.offset,a=n.size;if(t&&t.length){if(!(t.length<=y))throw new Error("Zip file comment exceeds 64KB");c.setUint16(i+20,t.length,!0)}for(const[,t]of n)r+=46+t.filename.length+t.comment.length+t.extraFieldZip64.length+t.extraFieldAES.length+t.rawExtraField.length;(s+r>=w||a>=y)&&(this.zip64=!0);const o=new Uint8Array(r+(this.zip64?98:22)),c=new DataView(o.buffer);for(const[,t]of n){const e=t.filename,n=t.extraFieldZip64,r=t.extraFieldAES,s=n.length+r.length+t.rawExtraField.length;c.setUint32(i,b),t.zip64?c.setUint16(i+4,11520):c.setUint16(i+4,5120),o.set(t.headerArray,i+6),c.setUint16(i+30,s,!0),c.setUint16(i+32,t.comment.length,!0),t.directory&&c.setUint8(i+38,16),t.zip64?c.setUint32(i+42,w,!0):c.setUint32(i+42,t.offset,!0),o.set(e,i+46),o.set(n,i+46+e.length),o.set(r,i+46+e.length+n.length),o.set(t.rawExtraField,46+e.length+n.length+r.length),o.set(t.comment,i+46+e.length+s),i+=46+e.length+s+t.comment.length}return this.zip64&&(c.setUint32(i,E),c.setBigUint64(i+4,BigInt(44),!0),c.setUint16(i+12,45,!0),c.setUint16(i+14,45,!0),c.setBigUint64(i+24,BigInt(a),!0),c.setBigUint64(i+32,BigInt(a),!0),c.setBigUint64(i+40,BigInt(r),!0),c.setBigUint64(i+48,BigInt(s),!0),c.setUint32(i+56,x),c.setBigUint64(i+64,BigInt(s+r),!0),c.setUint32(i+72,1,!0),a=y,s=w,i+=76),c.setUint32(i,A),c.setUint16(i+8,a,!0),c.setUint16(i+10,a,!0),c.setUint32(i+12,r,!0),c.setUint32(i+16,s,!0),await e.writeUint8Array(o),t&&t.length&&await e.writeUint8Array(t),e.getData()}}{constructor(t,e){super(t,e,St)}}const Lt=524288;class kt{constructor(t,e,n,i){if(t.root&&i&&i.getChildByName(e))throw new Error("Entry filename already exists");n||(n={}),this.fs=t,this.name=e,this.id=t.entries.length,this.parent=i,this.children=[],this.zipVersion=n.zipVersion||20,this.uncompressedSize=0,t.entries.push(this),i&&this.parent.children.push(this)}moveTo(t){if(!t.directory)throw"Target entry is not a directory";if(t.isDescendantOf(this))throw"Entry is a ancestor of target entry";if(this!=t){if(t.getChildByName(this.name))throw"Entry filename already exists";jt(this),this.parent=t,t.children.push(this)}}getFullname(){let t=this.name,e=this.parent;for(;e;)t=(e.name?e.name+"/":"")+t,e=e.parent;return t}isDescendantOf(t){let e=this.parent;for(;e&&e.id!=t.id;)e=e.parent;return Boolean(e)}}class Ct extends kt{constructor(t,e,n,i){super(t,e,n,i),this.Reader=n.Reader,this.Writer=n.Writer,this.data=n.data,n.getData&&(this.getData=n.getData)}async getData(t,e={}){return!t||t.constructor==this.Writer&&this.data?this.data:(this.reader||(this.reader=new this.Reader(this.data)),await this.reader.init(),await t.init(),this.uncompressedSize=this.reader.size,async function(t,e,n){return i();async function i(r=0){const s=r*Lt;if(n.onprogress&&n.onprogress(s,t.size),s<t.size){const n=await t.readUint8Array(s,Math.min(Lt,t.size-s));return await e.writeUint8Array(n),i(r+1)}return e.getData()}}(this.reader,t,e))}getText(t,e){return this.getData(new o(t),e)}getBlob(t,e){return this.getData(new l(t),e)}getData64URI(t,e){return this.getData(new h(t),e)}}class Tt extends kt{constructor(t,e,n,i){super(t,e,n,i),this.directory=!0}addDirectory(t){return Ot(this,t,null,!0)}addText(t,e){return Ot(this,t,{data:e,Reader:a,Writer:o})}addBlob(t,e){return Ot(this,t,{data:e,Reader:d,Writer:l})}addData64URI(t,e){return Ot(this,t,{data:e,Reader:c,Writer:h})}addHttpContent(t,e,n={}){return Ot(this,t,{data:e,Reader:n.useRangeHeader?p:u})}addFileEntry(t){!async function(t,e){e.isDirectory?await i(t,e):await new Promise(((n,i)=>{e.file((i=>{t.addBlob(e.name,i),n()}),i)}));function n(t){return new Promise(((e,n)=>{let i=[];function r(t){t.readEntries((n=>{n.length?(i=i.concat(n),r(t)):e(i)}),n)}t.isDirectory&&r(t.createReader()),t.isFile&&e(i)}))}async function i(t,e){const r=await n(e);for(const e of r)e.isDirectory&&await i(t.addDirectory(e.name)),await new Promise(((n,i)=>{e.isFile&&e.file((i=>{const r=t.addBlob(e.name,i);r.uncompressedSize=i.size,n(r)}),i)}))}}(this,t)}async addData(t,e){return Ot(this,t,e)}async importBlob(t,e={}){await this.importZip(new d(t),e)}async importData64URI(t,e={}){await this.importZip(new c(t),e)}async importHttpContent(t,e={}){await this.importZip(e.useRangeHeader?new p(t):new u(t),e)}async exportBlob(t={}){return this.exportZip(new l("application/zip"),t)}async exportData64URI(t={}){return this.exportZip(new h("application/zip"),t)}async importZip(t,e){await t.init();const n=new It(t),i=await n.getEntries();let r=0;const s=Pt(i,"compressedSize");i.forEach((t=>{let n=this,i=t.filename.split("/"),a=i.pop();if(i.forEach((t=>n=n.getChildByName(t)||new Tt(this.fs,t,null,n))),!t.directory){let i=r;Ot(n,a,{data:t,Reader:Vt(Object.assign({},e,{onprogress:t=>{e.onprogress&&e.onprogress(i+t,s)}}))}),r+=t.compressedSize}}))}async exportZip(t,e){await Zt(this);const n=new Mt(t);return await async function(t,e,n,i){let r=0;async function s(t,e){async function a(){let a=0;for(const o of e.children){let e=r;await t.add(o.getFullname(),o.reader,Object.assign({directory:o.directory,version:o.zipVersion},i,{onprogress:t=>{i.onprogress&&i.onprogress(e+a+t,n)}})),r+=o.uncompressedSize,await s(t,o),a++}}await a()}await s(t,e)}(n,this,Pt([this],"uncompressedSize"),e),await n.close(),t.getData()}getChildByName(t){for(let e=0;e<this.children.length;e++){const n=this.children[e];if(n.name==t)return n}}}const Wt={FS:class{constructor(){Ht(this)}remove(t){jt(t),this.entries[t.id]=null}find(t){const e=t.split("/");let n=this.root;for(let t=0;n&&t<e.length;t++)n=n.getChildByName(e[t]);return n}getById(t){return this.entries[t]}async importBlob(t){Ht(this),await this.root.importBlob(t)}async importData64URI(t){Ht(this),await this.root.importData64URI(t)}async importHttpContent(t,e){this.entries=[],this.root=new Tt(this),await this.root.importHttpContent(t,e)}async exportBlob(t){return this.root.exportBlob(t)}async exportData64URI(t){return this.root.exportData64URI(t)}},ZipDirectoryEntry:Tt,ZipFileEntry:Ct};function Pt(t,e){let n=0;return t.forEach((function t(i){n+=i[e],i.children&&i.children.forEach(t)})),n}function Vt(t){return class{constructor(t){this.entry=t,this.size=0}async readUint8Array(e,n){if(!this.blobReader){const e=await this.entry.getData(new l,t);this.data=e,this.blobReader=new d(e)}return this.blobReader.readUint8Array(e,n)}async init(){this.size=this.entry.uncompressedSize}}}async function Zt(t){if(t.children.length)for(const e of t.children)e.directory?await Zt(e):(e.reader=new e.Reader(e.data),await e.reader.init(),e.uncompressedSize=e.reader.size)}function jt(t){const e=t.parent.children;e.forEach(((n,i)=>{n.id==t.id&&e.splice(i,1)}))}function Ht(t){t.entries=[],t.root=new Tt(t)}function Ot(t,e,n,i){if(t.directory)return i?new Tt(t.fs,e,n,t):new Ct(t.fs,e,n,t);throw"Parent entry is not a directory"}t.BlobReader=d,t.BlobWriter=l,t.Data64URIReader=c,t.Data64URIWriter=h,t.HttpRangeReader=p,t.HttpReader=u,t.Reader=r,t.TextReader=a,t.TextWriter=o,t.Uint8ArrayReader=class extends r{constructor(t){super(),this.array=t,this.size=t.length}readUint8Array(t,e){return this.array.slice(t,t+e)}},t.Uint8ArrayWriter=g,t.Writer=s,t.ZipReader=It,t.ZipWriter=Mt,t.configure=function(t){St=Object.assign({},St,t)},t.fs=Wt,t.getMimeType=function(){return"application/octet-stream"},t.initShimAsyncCodec=(t,e={})=>({ZipDeflate:Rt(t.Deflate,e.deflate),ZipInflate:Rt(t.Inflate,e.inflate)}),Object.defineProperty(t,"__esModule",{value:!0})})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).zip={})}(this,(function(t){"use strict";const e="HTTP error ",n="text/plain";class i{constructor(){this.size=0}init(){this.initialized=!0}}class r extends i{}class s extends i{writeUint8Array(t){this.size+=t.length}}class a extends r{constructor(t){super(),this.blob=t,this.size=t.size}readUint8Array(t,e){const n=new FileReader;return new Promise(((i,r)=>{n.onload=t=>i(new Uint8Array(t.target.result)),n.onerror=r,n.readAsArrayBuffer(this.blob.slice(t,t+e))}))}}class o extends s{constructor(){super(),this.array=new Uint8Array(0)}writeUint8Array(t){super.writeUint8Array(t);const e=this.array;this.array=new Uint8Array(e.length+t.length),this.array.set(e),this.array.set(t,e.length)}getData(){return this.array}}function c(t,n){return new Promise(((i,r)=>{const s=new XMLHttpRequest;s.addEventListener("load",(()=>{s.status<400?(t.size||(t.size=Number(s.getResponseHeader("Content-Length"))||Number(s.response.byteLength)),t.data=new Uint8Array(s.response),i()):r(e+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",r,!1),s.open("GET",n),s.responseType="arraybuffer",s.send()}))}class h{constructor(){this.crc=-1,this.table=(()=>{const t=[];for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)1&n?n=n>>>1^3988292384:n>>>=1;t[e]=n}return t})()}append(t){const e=this.table;let n=0|this.crc;for(let i=0,r=0|t.length;i<r;i++)n=n>>>8^e[255&(n^t[i])];this.crc=n}get(){return~this.crc}}const l="Invalid pasword",d=16,u="raw",p={name:"PBKDF2"},g={name:"HMAC"},f="SHA-1",w={name:"AES-CTR"},y=Object.assign({hash:g},p),U=Object.assign({iterations:1e3,hash:{name:f}},p),m=Object.assign({hash:f},g),b=Object.assign({length:d},w),A=["deriveBits"],E=["sign"],R=528,D=10,x=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],F=crypto.subtle;class v{constructor(t,e){this.password=t,this.signed=e,this.input=e&&new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(t){const e=async(r=0)=>{if(r+d<=i.length-D){const t=i.subarray(r,r+d),s=await F.decrypt(Object.assign({counter:this.counter},b),this.keys.decrypt,t);return S(this.counter),n.set(new Uint8Array(s),r),e(r+d)}return this.pendingInput=i.subarray(r),this.signed&&(this.input=L(this.input,t)),n};if(this.password){const e=t.subarray(0,18);await async function(t,e,n){t.counter=new Uint8Array(x);const i=e.subarray(0,16),r=e.subarray(16),s=(new TextEncoder).encode(n),a=await F.importKey(u,s,y,!1,A),o=await F.deriveBits(Object.assign({salt:i},U),a,528),c=new Uint8Array(o),h=c.subarray(64);if(t.keys={decrypt:await F.importKey(u,c.subarray(0,32),w,!0,["decrypt"]),authentication:await F.importKey(u,c.subarray(32,64),m,!1,E),passwordVerification:h},h[0]!=r[0]||h[1]!=r[1])throw new Error(l)}(this,e,this.password),this.password=null,t=t.subarray(18)}let n=new Uint8Array(t.length-D-(t.length-D)%d),i=t;return this.pendingInput.length&&(i=L(this.pendingInput,t),n=I(n,i.length-D-(i.length-D)%d)),e()}async flush(){const t=this.pendingInput,e=this.keys,n=t.subarray(0,t.length-D),i=t.subarray(t.length-D);let r=new Uint8Array(0);if(n.length){const t=await F.decrypt(Object.assign({counter:this.counter},b),e.decrypt,n);r=new Uint8Array(t)}let s=!0;if(this.signed){const t=await F.sign(g,e.authentication,this.input.subarray(0,this.input.length-D)),n=new Uint8Array(t);this.input=null;for(let t=0;t<D;t++)n[t]!=i[t]&&(s=!1)}return{valid:s,data:r}}}class z{constructor(t){this.password=t,this.output=new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(t){const e=async(r=0)=>{if(r+d<=t.length){const s=t.subarray(r,r+d),a=await F.encrypt(Object.assign({counter:this.counter},b),this.keys.encrypt,s);return S(this.counter),i.set(new Uint8Array(a),r+n.length),e(r+d)}return this.pendingInput=t.subarray(r),this.output=L(this.output,i),i};let n=new Uint8Array(0);this.password&&(n=await async function(t,e){t.counter=new Uint8Array(x);const n=crypto.getRandomValues(new Uint8Array(16)),i=(new TextEncoder).encode(e),r=await F.importKey(u,i,y,!1,A),s=await F.deriveBits(Object.assign({salt:n},U),r,R),a=new Uint8Array(s);return t.keys={encrypt:await F.importKey(u,a.subarray(0,32),w,!0,["encrypt"]),authentication:await F.importKey(u,a.subarray(32,64),m,!1,E),passwordVerification:a.subarray(64)},L(n,t.keys.passwordVerification)}(this,this.password),this.password=null);let i=new Uint8Array(n.length+t.length-t.length%d);return i.set(n,0),this.pendingInput.length&&(t=L(this.pendingInput,t),i=I(i,t.length-t.length%d)),e()}async flush(){let t=new Uint8Array(0);if(this.pendingInput.length){const e=await F.encrypt(Object.assign({counter:this.counter},b),this.keys.encrypt,this.pendingInput);t=new Uint8Array(e),this.output=L(this.output,t)}const e=await F.sign(g,this.keys.authentication,this.output.subarray(18));this.output=null;const n=new Uint8Array(e).subarray(0,D);return{data:L(t,n),signature:n}}}function S(t){for(let e=0;e<16;e++){if(255!=t[e]){t[e]++;break}t[e]=0}}function L(t,e){let n=t;return t.length+e.length&&(n=new Uint8Array(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function I(t,e){if(e&&e>t.length){const n=t;(t=new Uint8Array(e)).set(n,0)}return t}const T="deflate",M="inflate",_="Invalid signature";class B{constructor(t){this.signature=t.inputSignature,this.encrypted=Boolean(t.inputPassword),this.signed=t.inputSigned,this.compressed=t.inputCompressed,this.inflate=this.compressed&&new ZipInflate,this.crc32=this.signed&&this.signed&&new h,this.decrypt=this.encrypted&&new v(t.inputPassword)}async append(t){return this.encrypted&&(t=await this.decrypt.append(t)),this.compressed&&t.length&&(t=await this.inflate.append(t)),!this.encrypted&&this.signed&&this.crc32.append(t),t}async flush(){let t,e=new Uint8Array(0);if(this.encrypted){const t=await this.decrypt.flush();if(!t.valid)throw new Error(_);e=t.data}else if(this.signed){const e=new DataView(new Uint8Array(4).buffer);if(t=this.crc32.get(),e.setUint32(0,t),this.signature!=e.getUint32(0,!1))throw new Error(_)}return this.compressed&&(e=await this.inflate.append(e)||new Uint8Array(0),await this.inflate.flush()),{data:e,signature:t}}}class O{constructor(t){this.encrypted=t.outputEncrypted,this.signed=t.outputSigned,this.compressed=t.outputCompressed,this.deflate=this.compressed&&new ZipDeflate({level:t.level||5}),this.crc32=this.signed&&new h,this.encrypt=this.encrypted&&new z(t.outputPassword)}async append(t){let e=t;return this.compressed&&t.length&&(e=await this.deflate.append(t)),this.encrypted?e=await this.encrypt.append(e):this.signed&&this.crc32.append(t),e}async flush(){let t,e=new Uint8Array(0);if(this.compressed&&(e=await this.deflate.flush()||new Uint8Array(0)),this.encrypted){e=await this.encrypt.append(e);const n=await this.encrypt.flush();t=n.signature;const i=new Uint8Array(e.length+n.data.length);i.set(e,0),i.set(n.data,e.length),e=i}else this.signed&&(t=this.crc32.get());return{data:e,signature:t}}}const k="init",C="append",N="flush",P="message",V="z-worker.js",j={deflate:[V,"deflate.js"],inflate:[V,"inflate.js"]},W={pool:[],pendingRequests:[]};function H(t,e){const n=W.pool;let i;if(t.useWebWorkers){const n=e.codecType;if(null!=t.workerScripts&&null!=t.workerScriptsPath)throw new Error("Either workerScripts or workerScriptsPath may be set, not both");if(t.workerScripts){if(i=t.workerScripts[n],!Array.isArray(i))throw new Error("workerScripts."+n+" must be an array");r=i,i="undefined"!=typeof document?r.map((t=>new URL(t,document.baseURI).href)):r}else i=j[n].slice(0),i[0]=(t.workerScriptsPath||"")+i[0]}var r;if(n.length<t.maxWorkers){const t={worker:i&&new Worker(i[0]),busy:!0,options:e,scripts:i};return n.push(t),i?function(t){const e=t.worker;let n;return e.addEventListener(P,s,!1),t.interface={append:async t=>i({type:C,data:t}),flush:async()=>i({type:N})},t.interface;async function i(e){if(!n){const e=t.scripts.slice(1);await r(Object.assign({type:k,options:t.options,scripts:e}))}return r(e)}function r(t){try{if(t.data)try{e.postMessage(t,[t.data.buffer])}catch(n){e.postMessage(t)}else e.postMessage(t)}catch(t){n.reject(t),e.removeEventListener(P,s,!1)}return new Promise(((t,e)=>n={resolve:t,reject:e}))}function s(i){const r=i.data;if(n){const i=r.error;if(i){const t=new Error(i.message);t.stack=i.stack,n.reject(t),e.removeEventListener(P,s,!1)}else r.type!=k&&r.type!=N&&r.type!=C||(r.type==N?(n.resolve({data:new Uint8Array(r.data),signature:r.signature}),n=null,function(t){if(t.busy=!1,W.pendingRequests.length){const[{resolve:e,options:n,scripts:i}]=W.pendingRequests.splice(0,1);t.busy=!0,t.options=n,t.scripts=i,e(t.interface)}else t.worker.terminate(),W.pool=W.pool.filter((e=>e!=t))}(t)):n.resolve(r.data&&new Uint8Array(r.data)))}}}(t):Z(t)}{const t=n.find((t=>!t.busy));return t?(t.busy=!0,t.options=e,t.scripts=i,i?t.interface:Z(t)):new Promise((t=>W.pendingRequests.push({resolve:t,options:e,scripts:i})))}}async function Z(t){const e=(n=t.options).codecType.startsWith(T)?new O(n):n.codecType.startsWith(M)?new B(n):void 0;var n;const i=e.flush.bind(e);return e.flush=async()=>{const e=await i();if(t.busy=!1,W.pendingRequests.length){const[{resolve:e,options:n}]=W.pendingRequests.splice(0,1);t.busy=!0,t.options=n,e(await Z(t))}else W.pool=W.pool.filter((e=>e!=t));return e},e}async function q(t,e,n,i,r,s,a){const o=Math.max(s.chunkSize,64);return async function s(c=0,h=0){const l=c*o;if(l<r){const d=await e.readUint8Array(l+i,Math.min(o,r-l)),u=await t.append(d);return h+=await K(n,u),a.onprogress&&a.onprogress(l+d.length,r),s(c+1,h)}{const e=await t.flush();return h+=await K(n,e.data),{signature:e.signature,length:h}}}()}async function K(t,e){return e.length&&await t.writeUint8Array(e),e.length}const X="File format is not recognized",Y="End of central directory not found",G="End of Zip64 central directory not found",J="End of Zip64 central directory locator not found",Q="Central directory header not found",$="Local file header not found",tt="Zip64 extra field not found",et="File contains encrypted entry",nt="Encryption not supported",it="Compression method not supported",rt="utf-8",st="windows-1252";class at{constructor(t,e,n){this.reader=t,this.config=e,this.options=n}async getData(t,e={}){const n=this.reader;n.initialized||await n.init();const i=await n.readUint8Array(this.offset,30),r=new DataView(i.buffer),s=void 0===e.password?this.options.password:e.password;let a=s&&s.length&&s;if(this.extraFieldAES){if(99!=this.extraFieldAES.originalCompressionMethod)throw new Error(it);if(3!=this.extraFieldAES.strength)throw new Error(nt)}if(0!=this.compressionMethod&&8!=this.compressionMethod)throw new Error(it);if(1347093252!=r.getUint32(0,!1))throw $;const o=this.localDirectory={};ot(o,r,4),o.rawExtraField=i.subarray(this.offset+30+o.filenameLength,this.offset+30+o.filenameLength+o.extraFieldLength),ct(this,o,r,4);let c=this.offset+30+o.filenameLength+o.extraFieldLength;const h=this.bitFlag.encrypted&&o.bitFlag.encrypted;if(h&&!a)throw new Error(et);const l=await H(this.config,{codecType:M,inputPassword:a,inputSigned:void 0===e.checkSignature?this.options.checkSignature:e.checkSignature,inputSignature:this.signature,inputCompressed:0!=this.compressionMethod,inputEncrypted:h});return t.initialized||await t.init(),await q(l,n,t,c,this.compressedSize,this.config,{onprogress:e.onprogress}),t.getData()}}function ot(t,e,n){t.version=e.getUint16(n,!0);const i=t.rawBitFlag=e.getUint16(n+2,!0);t.bitFlag={encrypted:1==(1&i),level:(6&i)>>1,dataDescriptor:8==(8&i),languageEncodingFlag:2048==(2048&i)},t.encrypted=t.bitFlag.encrypted,t.rawLastModDate=e.getUint32(n+6,!0),t.lastModDate=function(t){const e=(4294901760&t)>>16,n=65535&t;try{return new Date(1980+((65024&e)>>9),((480&e)>>5)-1,31&e,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch(t){}}(t.rawLastModDate),t.filenameLength=e.getUint16(n+22,!0),t.extraFieldLength=e.getUint16(n+24,!0)}function ct(t,e,n,i){let r,s,a;const o=e.rawExtraField,c=e.extraField=new Map,l=new DataView(new Uint8Array(o).buffer);let d=0;try{for(;d<o.length;){const t=l.getUint16(d,!0),e=l.getUint16(d+2,!0);c.set(t,{type:t,data:o.slice(d+4,d+4+e)}),d+=4+e}}catch(t){}const u=n.getUint16(i+4,!0);e.signature=n.getUint32(i+10,!0),e.uncompressedSize=n.getUint32(i+18,!0),e.compressedSize=n.getUint32(i+14,!0),r=e.extraFieldZip64=c.get(1),r&&function(t,e){e.zip64=!0;const n=new DataView(t.data.buffer);t.values=[];for(let e=0;e<Math.floor(t.data.length/8);e++)t.values.push(Number(n.getBigUint64(0+8*e,!0)));const i=["uncompressedSize","compressedSize","offset"],r=i.filter((t=>4294967295==e[t]));for(let e=0;e<r.length;e++)t[r[e]]=t.values[e];i.forEach((n=>{if(4294967295==e[n]){if(!t||void 0===t[n])throw new Error(tt);e[n]=t&&t[n]}}))}(r,e),a=e.extraFieldUnicodePath=c.get(28789),a&&function(t,e,n){const i=new DataView(t.data.buffer);t.version=i.getUint8(0),t.signature=i.getUint32(1,!0);const r=new h;r.append(n.rawFilename);const s=new DataView(new Uint8Array(4).buffer);s.setUint32(0,r.get()),t.filename=(new TextDecoder).decode(t.data.subarray(5)),t.signature==s.getUint32(0,!1)&&(e.filename=t.filename)}(a,e,t),s=e.extraFieldAES=c.get(39169),s?function(t,e,n){if(t){const i=new DataView(t.data.buffer);t.vendorVersion=i.getUint8(0),t.vendorId=i.getUint8(2);const r=i.getUint8(4);t.strength=r,t.originalCompressionMethod=n,e.compressionMethod=t.compressionMethod=i.getUint16(5,!0)}else e.compressionMethod=n}(s,e,u):e.compressionMethod=u,8==e.compressionMethod&&(e.bitFlag.enhancedDeflating=16!=(16&e.rawBitFlag))}function ht(t,e){return new TextDecoder(e).decode(t)}const lt="File already exists",dt="Zip file comment exceeds 64KB",ut="File entry comment exceeds 64KB";function pt(t){return unescape(encodeURIComponent(t))}function gt(t){const e=[];for(let n=0;n<t.length;n++)e.push(t.charCodeAt(n));return e}const ft="function";function wt(t,e){return class{constructor(n){const i=t=>{if(this.pendingData){const e=this.pendingData;this.pendingData=new Uint8Array(e.length+t.length),this.pendingData.set(e,0),this.pendingData.set(t,e.length)}else this.pendingData=new Uint8Array(t)};if(this.codec=new t(Object.assign({},e,n)),typeof this.codec.onData==ft)this.codec.onData=i;else{if(typeof this.codec.on!=ft)throw new Error("Cannot register the callback function");this.codec.on("data",i)}}async append(t){return this.codec.push(t),n(this)}async flush(){return this.codec.push(new Uint8Array(0),!0),n(this)}};function n(t){if(t.pendingData){const e=t.pendingData;return t.pendingData=null,e}return new Uint8Array(0)}}const yt={chunkSize:524288,maxWorkers:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,workerScriptsPath:void 0,useWebWorkers:!0};let Ut=Object.assign({},yt);t.BlobReader=a,t.BlobWriter=class extends s{constructor(t){super(),this.offset=0,this.contentType=t,this.blob=new Blob([],{type:t})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:this.contentType}),this.offset=this.blob.size}getData(){return this.blob}},t.Data64URIReader=class extends r{constructor(t){super(),this.dataURI=t;let e=t.length;for(;"="==t.charAt(e-1);)e--;this.dataStart=t.indexOf(",")+1,this.size=Math.floor(.75*(e-this.dataStart))}readUint8Array(t,e){const n=new Uint8Array(e),i=4*Math.floor(t/3),r=atob(this.dataURI.substring(i+this.dataStart,4*Math.ceil((t+e)/3)+this.dataStart)),s=t-3*Math.floor(i/4);for(let t=s;t<s+e;t++)n[t-s]=r.charCodeAt(t);return n}},t.Data64URIWriter=class extends s{constructor(t){super(),this.data="data:"+(t||"")+";base64,",this.pending=[]}writeUint8Array(t){super.writeUint8Array(t);let e=0,n=this.pending;const i=this.pending.length;for(this.pending="",e=0;e<3*Math.floor((i+t.length)/3)-i;e++)n+=String.fromCharCode(t[e]);for(;e<t.length;e++)this.pending+=String.fromCharCode(t[e]);n.length>2?this.data+=btoa(n):this.pending=n}getData(){return this.data+btoa(this.pending)}},t.ERR_BAD_FORMAT=X,t.ERR_CENTRAL_DIRECTORY_NOT_FOUND=Q,t.ERR_DUPLICATED_NAME=lt,t.ERR_ENCRYPTED=et,t.ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND=J,t.ERR_EOCDR_NOT_FOUND=Y,t.ERR_EOCDR_ZIP64_NOT_FOUND=G,t.ERR_EXTRA_FIELD_ZIP64_NOT_FOUND=tt,t.ERR_INVALID_COMMENT=dt,t.ERR_INVALID_ENTRY_COMMENT=ut,t.ERR_INVALID_PASSORD=l,t.ERR_INVALID_SIGNATURE=_,t.ERR_LOCAL_FILE_HEADER_NOT_FOUND=$,t.ERR_UNSUPPORTED_COMPRESSION=it,t.ERR_UNSUPPORTED_ENCRYPTION=nt,t.HttpRangeReader=class extends r{constructor(t){super(),this.url=t}init(){return super.init(),new Promise(((t,n)=>{const i=new XMLHttpRequest;i.addEventListener("load",(()=>{i.status<400?(this.size=Number(i.getResponseHeader("Content-Length")),"bytes"==i.getResponseHeader("Accept-Ranges")?t():n(new Error("HTTP Range not supported"))):n(e+(i.statusText||i.status)+".")}),!1),i.addEventListener("error",n,!1),i.open("HEAD",this.url),i.send()}))}readUint8Array(t,n){return new Promise(((i,r)=>{const s=new XMLHttpRequest;s.open("GET",this.url),s.responseType="arraybuffer",s.setRequestHeader("Range","bytes="+t+"-"+(t+n-1)),s.addEventListener("load",(()=>{s.status<400?i(new Uint8Array(s.response)):r(e+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",r,!1),s.send()}))}},t.HttpReader=class extends r{constructor(t){super(),this.url=t}async init(){if(super.init(),function(t){if("undefined"!=typeof document){const e=document.createElement("a");return e.href=t,"http:"==e.protocol||"https:"==e.protocol}return/^https?:\/\//i.test(t)}(this.url))return new Promise(((t,n)=>{const i=new XMLHttpRequest;i.addEventListener("load",(()=>{i.status<400?(this.size=Number(i.getResponseHeader("Content-Length")),this.size?t():c().then((()=>t())).catch(n)):n(e+(i.statusText||i.status)+".")}),!1),i.addEventListener("error",n,!1),i.open("HEAD",this.url),i.send()}));await c()}async readUint8Array(t,e){return this.data||await c(this,this.url),new Uint8Array(this.data.subarray(t,t+e))}},t.Reader=r,t.TextReader=class extends r{constructor(t){super(),this.blobReader=new a(new Blob([t],{type:n}))}init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}readUint8Array(t,e){return this.blobReader.readUint8Array(t,e)}},t.TextWriter=class extends s{constructor(t){super(),this.encoding=t,this.blob=new Blob([],{type:n})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:n})}getData(){const t=new FileReader;return new Promise(((e,n)=>{t.onload=t=>e(t.target.result),t.onerror=n,t.readAsText(this.blob,this.encoding)}))}},t.Uint8ArrayReader=class extends r{constructor(t){super(),this.array=t,this.size=t.length}readUint8Array(t,e){return this.array.slice(t,t+e)}},t.Uint8ArrayWriter=o,t.Writer=s,t.ZipReader=class extends class{constructor(t,e={},n={}){this.reader=t,this.options=e,this.config=n}async getEntries(){const t=this.reader;t.initialized||await t.init();const e=await async function(t,e,n,i){if(t.size<n)throw new Error(X);const r=n+i;let s=n,a=await o(s);a||(a=await o(Math.min(r,t.size)));if(!a)throw new Error(Y);return a;async function o(i){const r=t.size-i,s=await t.readUint8Array(r,i);for(let t=s.length-n;t>=0;t--)if(s[t]==e[0]&&s[t+1]==e[1]&&s[t+2]==e[2]&&s[t+3]==e[3])return{offset:r,buffer:s.slice(t,t+n).buffer}}}(t,[80,75,5,6],22,65536);let n,i=new DataView(e.buffer),r=i.getUint32(16,!0),s=i.getUint16(8,!0);if(4294967295==r||65535==s){n=!0;const i=await t.readUint8Array(e.offset-20,20),a=new DataView(i.buffer);if(1347094023!=Number(a.getUint32(0,!1)))throw new Error(G);r=Number(a.getBigUint64(8,!0));const o=await t.readUint8Array(r,56),c=new DataView(o.buffer);if(1347094022!=Number(c.getUint32(0,!1)))throw new Error(J);s=Number(c.getBigUint64(24,!0)),r-=Number(c.getBigUint64(40,!0))}if(r<0||!n&&(r>=t.size||s>=65535))throw new Error(X);const a=await t.readUint8Array(r,t.size-r);i=new DataView(a.buffer);const o=[];let c=0;for(let t=0;t<s;t++){const t=new at(this.reader,this.config,this.options);if(1347092738!=i.getUint32(c,!1))throw new Error(Q);t.compressedSize=0,t.uncompressedSize=0,ot(t,i,c+6),t.commentLength=i.getUint16(c+32,!0),t.directory=16==(16&i.getUint8(c+38)),t.offset=i.getUint32(c+42,!0),t.rawFilename=a.subarray(c+46,c+46+t.filenameLength),t.filename=ht(t.rawFilename,t.bitFlag.languageEncodingFlag?rt:this.options.filenameEncoding||st),t.directory||"/"!=t.filename.charAt(t.filename.length-1)||(t.directory=!0),t.rawExtraField=a.subarray(c+46+t.filenameLength,c+46+t.filenameLength+t.extraFieldLength),ct(t,t,i,c+6),t.rawComment=a.subarray(c+46+t.filenameLength+t.extraFieldLength,c+46+t.filenameLength+t.extraFieldLength+t.commentLength),t.comment=ht(t.rawComment,t.bitFlag.languageEncodingFlag?rt:this.options.commentEncoding||st),o.push(t),c+=46+t.filenameLength+t.extraFieldLength+t.commentLength}return o}async close(){}}{constructor(t,e){super(t,e,Ut)}},t.ZipWriter=class extends class{constructor(t,e={},n={}){this.writer=t,this.options=e,this.config=n,this.files=new Map,this.offset=t.size,this.zip64=e.zip64}async add(t,e,n={}){if(t=t.trim(),n.directory&&"/"!=t.charAt(t.length-1)&&(t+="/"),this.files.has(t))throw new Error(lt);if(n.comment=gt(pt(n.comment||"")),n.comment>65536)throw new Error(ut);n.zip64=n.zip64||this.zip64,await async function(t,e,n,i){const r=t.files,s=t.writer;let a;r.set(e,null);try{let c,h;try{i.bufferedWrite||t.options.bufferedWrite||t.lockWrite?(c=new o,c.init()):(t.lockWrite=new Promise((t=>a=t)),s.initialized||await s.init(),c=s),(t.offset>=4294967295||n&&(n.size>=4294967295||t.offset+n.size>=4294967295))&&(i.zip64=!0),h=await async function(t,e,n,i,r,s){const a=gt(pt(t)),o=s.lastModDate||new Date,c=new Uint8Array(26),h=new DataView(c.buffer),l=void 0===s.password?r.password:s.password,d=l&&l.length&&l,u=void 0===s.level?r.level:s.level,p=0!==u&&!s.directory,g=void 0===l||!l.length,f=s.zip64,w={zip64:f,headerArray:c,directory:s.directory,filename:a,comment:s.comment,extraFieldZip64:f?new Uint8Array(28):new Uint8Array(0),extraFieldAES:d?new Uint8Array([1,153,7,0,2,0,65,69,3,0,0]):new Uint8Array(0),rawExtraField:new Uint8Array(0)},y=s.extraField;if(y){let t=4,e=0;y.forEach((e=>t+=e.length));const n=w.rawExtraField=new Uint8Array(t);y.forEach(((t,i)=>{n.set(new Uint16Array([i]),e),n.set(new Uint16Array([t.length]),e+2),n.set(t,e+4),e+=4+t.length}))}s.bitFlag=8,s.version=(void 0===s.version?r.version:s.version)||20,s.compressionMethod=0,p&&(s.compressionMethod=8);f&&(s.version=s.version>45?s.version:45);d&&(s.version=s.version>51?s.version:51,s.bitFlag=9,s.compressionMethod=99,p&&(w.extraFieldAES[9]=8));h.setUint16(0,s.version,!0),h.setUint16(2,s.bitFlag,!0),h.setUint16(4,s.compressionMethod,!0),h.setUint16(6,(o.getHours()<<6|o.getMinutes())<<5|o.getSeconds()/2,!0),h.setUint16(8,(o.getFullYear()-1980<<4|o.getMonth()+1)<<5|o.getDate(),!0),h.setUint16(22,a.length,!0),h.setUint16(24,0,!0);const U=new Uint8Array(30+a.length);let m;if(new DataView(U.buffer).setUint32(0,1347093252),U.set(c,4),U.set(a,30),e){e.initialized||await e.init();const t=await H(i,{codecType:T,level:u,outputPassword:l,outputSigned:g,outputCompressed:p,outputEncrypted:Boolean(l)});await n.writeUint8Array(U),m=await q(t,e,n,0,e.size,i,{onprogress:s.onprogress}),w.compressedSize=m.length}else await n.writeUint8Array(U);const b=new Uint8Array(f?24:16),A=new DataView(b.buffer);if(A.setUint32(0,1347094280),e)if(d||void 0===m.signature||(h.setUint32(10,m.signature,!0),A.setUint32(4,m.signature,!0)),f){h.setUint32(14,4294967295,!0),A.setBigUint64(8,BigInt(w.compressedSize),!0),h.setUint32(18,4294967295,!0),A.setBigUint64(16,BigInt(e.size),!0);const t=new DataView(w.extraFieldZip64.buffer);t.setUint16(0,1,!0),t.setUint16(2,24,!0),t.setBigUint64(4,BigInt(e.size),!0),t.setBigUint64(12,BigInt(w.compressedSize),!0)}else h.setUint32(14,w.compressedSize,!0),A.setUint32(8,w.compressedSize,!0),h.setUint32(18,e.size,!0),A.setUint32(12,e.size,!0);return await n.writeUint8Array(b),w.length=U.length+(m?m.length:0)+b.length,w}(e,n,c,t.config,t.options,i)}catch(t){throw r.delete(e),t}if(r.set(e,h),c!=s&&(t.lockWrite&&await t.lockWrite,await s.writeUint8Array(c.getData())),h.offset=t.offset,h.zip64){new DataView(h.extraFieldZip64.buffer).setBigUint64(20,BigInt(h.offset),!0)}t.offset+=h.length}finally{a&&(t.lockWrite=null,a())}}(this,t,e,n)}async close(t){const e=this.writer,n=this.files;let i=0,r=0,s=this.offset,a=n.size;for(const[,t]of n)r+=46+t.filename.length+t.comment.length+t.extraFieldZip64.length+t.extraFieldAES.length+t.rawExtraField.length;(s+r>=4294967295||a>=65535)&&(this.zip64=!0);const o=new Uint8Array(r+(this.zip64?98:22)),c=new DataView(o.buffer);for(const[,t]of n){const e=t.filename,n=t.extraFieldZip64,r=t.extraFieldAES,s=n.length+r.length+t.rawExtraField.length;c.setUint32(i,1347092738),t.zip64?c.setUint16(i+4,11520):c.setUint16(i+4,5120),o.set(t.headerArray,i+6),c.setUint16(i+30,s,!0),c.setUint16(i+32,t.comment.length,!0),t.directory&&c.setUint8(i+38,16),t.zip64?c.setUint32(i+42,4294967295,!0):c.setUint32(i+42,t.offset,!0),o.set(e,i+46),o.set(n,i+46+e.length),o.set(r,i+46+e.length+n.length),o.set(t.rawExtraField,46+e.length+n.length+r.length),o.set(t.comment,i+46+e.length+s),i+=46+e.length+s+t.comment.length}if(this.zip64&&(c.setUint32(i,1347094022),c.setBigUint64(i+4,BigInt(44),!0),c.setUint16(i+12,45,!0),c.setUint16(i+14,45,!0),c.setBigUint64(i+24,BigInt(a),!0),c.setBigUint64(i+32,BigInt(a),!0),c.setBigUint64(i+40,BigInt(r),!0),c.setBigUint64(i+48,BigInt(s),!0),c.setUint32(i+56,1347094023),c.setBigUint64(i+64,BigInt(s+r),!0),c.setUint32(i+72,1,!0),a=65535,s=4294967295,i+=76),c.setUint32(i,1347093766),c.setUint16(i+8,a,!0),c.setUint16(i+10,a,!0),c.setUint32(i+12,r,!0),c.setUint32(i+16,s,!0),t&&t.length){if(!(t.length<=65536))throw new Error(dt);c.setUint16(i+20,t.length,!0)}return await e.writeUint8Array(o),t&&t.length&&await e.writeUint8Array(t),e.getData()}}{constructor(t,e){super(t,e,Ut)}},t.configure=function(t){Ut=Object.assign({},Ut,t)},t.getMimeType=function(){return"application/octet-stream"},t.initShimAsyncCodec=(t,e={})=>({ZipDeflate:wt(t.Deflate,e.deflate),ZipInflate:wt(t.Inflate,e.inflate)}),Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).zip={})}(this,(function(t){"use strict";const e="HTTP error ",n="text/plain";class i{constructor(){this.size=0}init(){this.initialized=!0}}class r extends i{}class s extends i{writeUint8Array(t){this.size+=t.length}}class a extends r{constructor(t){super(),this.blob=t,this.size=t.size}readUint8Array(t,e){const n=new FileReader;return new Promise(((i,r)=>{n.onload=t=>i(new Uint8Array(t.target.result)),n.onerror=r,n.readAsArrayBuffer(this.blob.slice(t,t+e))}))}}class o extends s{constructor(){super(),this.array=new Uint8Array(0)}writeUint8Array(t){super.writeUint8Array(t);const e=this.array;this.array=new Uint8Array(e.length+t.length),this.array.set(e),this.array.set(t,e.length)}getData(){return this.array}}function c(t,n){return new Promise(((i,r)=>{const s=new XMLHttpRequest;s.addEventListener("load",(()=>{s.status<400?(t.size||(t.size=Number(s.getResponseHeader("Content-Length"))||Number(s.response.byteLength)),t.data=new Uint8Array(s.response),i()):r(e+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",r,!1),s.open("GET",n),s.responseType="arraybuffer",s.send()}))}const h=4294967295,l=65535,d=1347093252,u=1347094280,p=1347092738,g=1347093766,f=1347094022,w=1347094023;class y{constructor(){this.crc=-1,this.table=(()=>{const t=[];for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)1&n?n=n>>>1^3988292384:n>>>=1;t[e]=n}return t})()}append(t){const e=this.table;let n=0|this.crc;for(let i=0,r=0|t.length;i<r;i++)n=n>>>8^e[255&(n^t[i])];this.crc=n}get(){return~this.crc}}const U="Invalid pasword",m=16,b="raw",A={name:"PBKDF2"},E={name:"HMAC"},R="SHA-1",D={name:"AES-CTR"},x=Object.assign({hash:E},A),F=Object.assign({iterations:1e3,hash:{name:R}},A),z=Object.assign({hash:R},E),v=Object.assign({length:m},D),I=["deriveBits"],L=["sign"],S=528,_=10,T=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M=crypto.subtle;class B{constructor(t,e){this.password=t,this.signed=e,this.input=e&&new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(t){const e=async(r=0)=>{if(r+m<=i.length-_){const t=i.subarray(r,r+m),s=await M.decrypt(Object.assign({counter:this.counter},v),this.keys.decrypt,t);return O(this.counter),n.set(new Uint8Array(s),r),e(r+m)}return this.pendingInput=i.subarray(r),this.signed&&(this.input=k(this.input,t)),n};if(this.password){const e=t.subarray(0,18);await async function(t,e,n){t.counter=new Uint8Array(T);const i=e.subarray(0,16),r=e.subarray(16),s=(new TextEncoder).encode(n),a=await M.importKey(b,s,x,!1,I),o=await M.deriveBits(Object.assign({salt:i},F),a,528),c=new Uint8Array(o),h=c.subarray(64);if(t.keys={decrypt:await M.importKey(b,c.subarray(0,32),D,!0,["decrypt"]),authentication:await M.importKey(b,c.subarray(32,64),z,!1,L),passwordVerification:h},h[0]!=r[0]||h[1]!=r[1])throw new Error(U)}(this,e,this.password),this.password=null,t=t.subarray(18)}let n=new Uint8Array(t.length-_-(t.length-_)%m),i=t;return this.pendingInput.length&&(i=k(this.pendingInput,t),n=C(n,i.length-_-(i.length-_)%m)),e()}async flush(){const t=this.pendingInput,e=this.keys,n=t.subarray(0,t.length-_),i=t.subarray(t.length-_);let r=new Uint8Array(0);if(n.length){const t=await M.decrypt(Object.assign({counter:this.counter},v),e.decrypt,n);r=new Uint8Array(t)}let s=!0;if(this.signed){const t=await M.sign(E,e.authentication,this.input.subarray(0,this.input.length-_)),n=new Uint8Array(t);this.input=null;for(let t=0;t<_;t++)n[t]!=i[t]&&(s=!1)}return{valid:s,data:r}}}class N{constructor(t){this.password=t,this.output=new Uint8Array(0),this.pendingInput=new Uint8Array(0)}async append(t){const e=async(r=0)=>{if(r+m<=t.length){const s=t.subarray(r,r+m),a=await M.encrypt(Object.assign({counter:this.counter},v),this.keys.encrypt,s);return O(this.counter),i.set(new Uint8Array(a),r+n.length),e(r+m)}return this.pendingInput=t.subarray(r),this.output=k(this.output,i),i};let n=new Uint8Array(0);this.password&&(n=await async function(t,e){t.counter=new Uint8Array(T);const n=crypto.getRandomValues(new Uint8Array(16)),i=(new TextEncoder).encode(e),r=await M.importKey(b,i,x,!1,I),s=await M.deriveBits(Object.assign({salt:n},F),r,S),a=new Uint8Array(s);return t.keys={encrypt:await M.importKey(b,a.subarray(0,32),D,!0,["encrypt"]),authentication:await M.importKey(b,a.subarray(32,64),z,!1,L),passwordVerification:a.subarray(64)},k(n,t.keys.passwordVerification)}(this,this.password),this.password=null);let i=new Uint8Array(n.length+t.length-t.length%m);return i.set(n,0),this.pendingInput.length&&(t=k(this.pendingInput,t),i=C(i,t.length-t.length%m)),e()}async flush(){let t=new Uint8Array(0);if(this.pendingInput.length){const e=await M.encrypt(Object.assign({counter:this.counter},v),this.keys.encrypt,this.pendingInput);t=new Uint8Array(e),this.output=k(this.output,t)}const e=await M.sign(E,this.keys.authentication,this.output.subarray(18));this.output=null;const n=new Uint8Array(e).subarray(0,_);return{data:k(t,n),signature:n}}}function O(t){for(let e=0;e<16;e++){if(255!=t[e]){t[e]++;break}t[e]=0}}function k(t,e){let n=t;return t.length+e.length&&(n=new Uint8Array(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function C(t,e){if(e&&e>t.length){const n=t;(t=new Uint8Array(e)).set(n,0)}return t}const P="deflate",V="inflate",j="Invalid signature";class W{constructor(t){this.signature=t.inputSignature,this.encrypted=Boolean(t.inputPassword),this.signed=t.inputSigned,this.compressed=t.inputCompressed,this.inflate=this.compressed&&new ZipInflate,this.crc32=this.signed&&this.signed&&new y,this.decrypt=this.encrypted&&new B(t.inputPassword)}async append(t){return this.encrypted&&(t=await this.decrypt.append(t)),this.compressed&&t.length&&(t=await this.inflate.append(t)),!this.encrypted&&this.signed&&this.crc32.append(t),t}async flush(){let t,e=new Uint8Array(0);if(this.encrypted){const t=await this.decrypt.flush();if(!t.valid)throw new Error(j);e=t.data}else if(this.signed){const e=new DataView(new Uint8Array(4).buffer);if(t=this.crc32.get(),e.setUint32(0,t),this.signature!=e.getUint32(0,!1))throw new Error(j)}return this.compressed&&(e=await this.inflate.append(e)||new Uint8Array(0),await this.inflate.flush()),{data:e,signature:t}}}class H{constructor(t){this.encrypted=t.outputEncrypted,this.signed=t.outputSigned,this.compressed=t.outputCompressed,this.deflate=this.compressed&&new ZipDeflate({level:t.level||5}),this.crc32=this.signed&&new y,this.encrypt=this.encrypted&&new N(t.outputPassword)}async append(t){let e=t;return this.compressed&&t.length&&(e=await this.deflate.append(t)),this.encrypted?e=await this.encrypt.append(e):this.signed&&this.crc32.append(t),e}async flush(){let t,e=new Uint8Array(0);if(this.compressed&&(e=await this.deflate.flush()||new Uint8Array(0)),this.encrypted){e=await this.encrypt.append(e);const n=await this.encrypt.flush();t=n.signature;const i=new Uint8Array(e.length+n.data.length);i.set(e,0),i.set(n.data,e.length),e=i}else this.signed&&(t=this.crc32.get());return{data:e,signature:t}}}const Z="init",q="append",K="flush",X="message",Y="z-worker.js",G={deflate:[Y,"deflate.js"],inflate:[Y,"inflate.js"]},J={pool:[],pendingRequests:[]};function Q(t,e){const n=J.pool;let i;if(t.useWebWorkers){const n=e.codecType;if(null!=t.workerScripts&&null!=t.workerScriptsPath)throw new Error("Either workerScripts or workerScriptsPath may be set, not both");if(t.workerScripts){if(i=t.workerScripts[n],!Array.isArray(i))throw new Error("workerScripts."+n+" must be an array");r=i,i="undefined"!=typeof document?r.map((t=>new URL(t,document.baseURI).href)):r}else i=G[n].slice(0),i[0]=(t.workerScriptsPath||"")+i[0]}var r;if(n.length<t.maxWorkers){const t={worker:i&&new Worker(i[0]),busy:!0,options:e,scripts:i};return n.push(t),i?function(t){const e=t.worker;let n;return e.addEventListener(X,s,!1),t.interface={append:async t=>i({type:q,data:t}),flush:async()=>i({type:K})},t.interface;async function i(e){if(!n){const e=t.scripts.slice(1);await r(Object.assign({type:Z,options:t.options,scripts:e}))}return r(e)}function r(i){try{if(i.data)try{e.postMessage(i,[i.data.buffer])}catch(t){e.postMessage(i)}else e.postMessage(i)}catch(e){n.reject(e),n=null,et(t)}return new Promise(((t,e)=>n={resolve:t,reject:e}))}function s(e){const i=e.data;if(n){const e=i.error;if(e){const i=new Error(e.message);i.stack=e.stack,n.reject(i),n=null,et(t)}else i.type!=Z&&i.type!=K&&i.type!=q||(i.type==K?(n.resolve({data:new Uint8Array(i.data),signature:i.signature}),n=null,et(t)):n.resolve(i.data&&new Uint8Array(i.data)))}}}(t):$(t)}{const t=n.find((t=>!t.busy));return t?(t.busy=!0,t.options=e,t.scripts=i,i?t.interface:$(t)):new Promise((t=>J.pendingRequests.push({resolve:t,options:e,scripts:i})))}}function $(t){const e=(n=t.options).codecType.startsWith(P)?new H(n):n.codecType.startsWith(V)?new W(n):void 0;var n;const i=e.append.bind(e),r=e.flush.bind(e);return e.append=async e=>{try{return await i(e)}catch(e){throw await tt(t),e}},e.flush=async()=>{try{return await r()}finally{await tt(t)}},e}async function tt(t){if(t.busy=!1,J.pendingRequests.length){const[{resolve:e,options:n}]=J.pendingRequests.splice(0,1);t.busy=!0,t.options=n,e($(t))}else J.pool=J.pool.filter((e=>e!=t))}function et(t){if(t.busy=!1,J.pendingRequests.length){const[{resolve:e,options:n,scripts:i}]=J.pendingRequests.splice(0,1);t.busy=!0,t.options=n,t.scripts=i,e(t.interface)}else t.worker.terminate(),J.pool=J.pool.filter((e=>e!=t))}async function nt(t,e,n,i,r,s,a){const o=Math.max(s.chunkSize,64);return async function s(c=0,h=0){const l=c*o;if(l<r){const d=await e.readUint8Array(l+i,Math.min(o,r-l)),u=await t.append(d);return h+=await it(n,u),a.onprogress&&a.onprogress(l+d.length,r),s(c+1,h)}{const e=await t.flush();return h+=await it(n,e.data),{signature:e.signature,length:h}}}()}async function it(t,e){return e.length&&await t.writeUint8Array(e),e.length}const rt="File format is not recognized",st="End of central directory not found",at="End of Zip64 central directory not found",ot="End of Zip64 central directory locator not found",ct="Central directory header not found",ht="Local file header not found",lt="Zip64 extra field not found",dt="File contains encrypted entry",ut="Encryption not supported",pt="Compression method not supported",gt="utf-8",ft="windows-1252";class wt{constructor(t,e,n){this.reader=t,this.config=e,this.options=n}async getData(t,e={}){const n=this.reader;n.initialized||await n.init();const i=await n.readUint8Array(this.offset,30),r=new DataView(i.buffer),s=void 0===e.password?this.options.password:e.password;let a=s&&s.length&&s;if(this.extraFieldAES){if(99!=this.extraFieldAES.originalCompressionMethod)throw new Error(pt);if(3!=this.extraFieldAES.strength)throw new Error(ut)}if(0!=this.compressionMethod&&8!=this.compressionMethod)throw new Error(pt);if(r.getUint32(0,!1)!=d)throw new Error(ht);const o=this.localDirectory={};yt(o,r,4),o.rawExtraField=i.subarray(this.offset+30+o.filenameLength,this.offset+30+o.filenameLength+o.extraFieldLength),Ut(this,o,r,4);let c=this.offset+30+o.filenameLength+o.extraFieldLength;const h=this.bitFlag.encrypted&&o.bitFlag.encrypted;if(h&&!a)throw new Error(dt);const l=await Q(this.config,{codecType:V,inputPassword:a,inputSigned:void 0===e.checkSignature?this.options.checkSignature:e.checkSignature,inputSignature:this.signature,inputCompressed:0!=this.compressionMethod,inputEncrypted:h});return t.initialized||await t.init(),await nt(l,n,t,c,this.compressedSize,this.config,{onprogress:e.onprogress}),t.getData()}}function yt(t,e,n){t.version=e.getUint16(n,!0);const i=t.rawBitFlag=e.getUint16(n+2,!0);t.bitFlag={encrypted:1==(1&i),level:(6&i)>>1,dataDescriptor:8==(8&i),languageEncodingFlag:2048==(2048&i)},t.encrypted=t.bitFlag.encrypted,t.rawLastModDate=e.getUint32(n+6,!0),t.lastModDate=function(t){const e=(4294901760&t)>>16,n=65535&t;try{return new Date(1980+((65024&e)>>9),((480&e)>>5)-1,31&e,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch(t){}}(t.rawLastModDate),t.filenameLength=e.getUint16(n+22,!0),t.extraFieldLength=e.getUint16(n+24,!0)}function Ut(t,e,n,i){let r,s,a;const o=e.rawExtraField,c=e.extraField=new Map,l=new DataView(new Uint8Array(o).buffer);let d=0;try{for(;d<o.length;){const t=l.getUint16(d,!0),e=l.getUint16(d+2,!0);c.set(t,{type:t,data:o.slice(d+4,d+4+e)}),d+=4+e}}catch(t){}const u=n.getUint16(i+4,!0);e.signature=n.getUint32(i+10,!0),e.uncompressedSize=n.getUint32(i+18,!0),e.compressedSize=n.getUint32(i+14,!0),r=e.extraFieldZip64=c.get(1),r&&function(t,e){e.zip64=!0;const n=new DataView(t.data.buffer);t.values=[];for(let e=0;e<Math.floor(t.data.length/8);e++)t.values.push(Number(n.getBigUint64(0+8*e,!0)));const i=["uncompressedSize","compressedSize","offset"],r=i.filter((t=>e[t]==h));for(let e=0;e<r.length;e++)t[r[e]]=t.values[e];i.forEach((n=>{if(e[n]==h){if(!t||void 0===t[n])throw new Error(lt);e[n]=t&&t[n]}}))}(r,e),a=e.extraFieldUnicodePath=c.get(28789),a&&function(t,e,n){const i=new DataView(t.data.buffer);t.version=i.getUint8(0),t.signature=i.getUint32(1,!0);const r=new y;r.append(n.rawFilename);const s=new DataView(new Uint8Array(4).buffer);s.setUint32(0,r.get()),t.filename=(new TextDecoder).decode(t.data.subarray(5)),t.signature==s.getUint32(0,!1)&&(e.filename=t.filename)}(a,e,t),s=e.extraFieldAES=c.get(39169),s?function(t,e,n){if(t){const i=new DataView(t.data.buffer);t.vendorVersion=i.getUint8(0),t.vendorId=i.getUint8(2);const r=i.getUint8(4);t.strength=r,t.originalCompressionMethod=n,e.compressionMethod=t.compressionMethod=i.getUint16(5,!0)}else e.compressionMethod=n}(s,e,u):e.compressionMethod=u,8==e.compressionMethod&&(e.bitFlag.enhancedDeflating=16!=(16&e.rawBitFlag))}function mt(t,e){return new TextDecoder(e).decode(t)}const bt="File already exists",At="Zip file comment exceeds 64KB",Et="File entry comment exceeds 64KB",Rt="File entry name exceeds 64KB",Dt="Version exceeds 65535",xt="Extra field type exceeds 65535",Ft="Extra field data exceeds 64KB";function zt(t){return unescape(encodeURIComponent(t))}function vt(t){const e=[];for(let n=0;n<t.length;n++)e.push(t.charCodeAt(n));return e}const It="function";function Lt(t,e){return class{constructor(n){const i=t=>{if(this.pendingData){const e=this.pendingData;this.pendingData=new Uint8Array(e.length+t.length),this.pendingData.set(e,0),this.pendingData.set(t,e.length)}else this.pendingData=new Uint8Array(t)};if(this.codec=new t(Object.assign({},e,n)),typeof this.codec.onData==It)this.codec.onData=i;else{if(typeof this.codec.on!=It)throw new Error("Cannot register the callback function");this.codec.on("data",i)}}async append(t){return this.codec.push(t),n(this)}async flush(){return this.codec.push(new Uint8Array(0),!0),n(this)}};function n(t){if(t.pendingData){const e=t.pendingData;return t.pendingData=null,e}return new Uint8Array(0)}}const St={chunkSize:524288,maxWorkers:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,workerScriptsPath:void 0,useWebWorkers:!0};let _t=Object.assign({},St);t.BlobReader=a,t.BlobWriter=class extends s{constructor(t){super(),this.offset=0,this.contentType=t,this.blob=new Blob([],{type:t})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:this.contentType}),this.offset=this.blob.size}getData(){return this.blob}},t.Data64URIReader=class extends r{constructor(t){super(),this.dataURI=t;let e=t.length;for(;"="==t.charAt(e-1);)e--;this.dataStart=t.indexOf(",")+1,this.size=Math.floor(.75*(e-this.dataStart))}readUint8Array(t,e){const n=new Uint8Array(e),i=4*Math.floor(t/3),r=atob(this.dataURI.substring(i+this.dataStart,4*Math.ceil((t+e)/3)+this.dataStart)),s=t-3*Math.floor(i/4);for(let t=s;t<s+e;t++)n[t-s]=r.charCodeAt(t);return n}},t.Data64URIWriter=class extends s{constructor(t){super(),this.data="data:"+(t||"")+";base64,",this.pending=[]}writeUint8Array(t){super.writeUint8Array(t);let e=0,n=this.pending;const i=this.pending.length;for(this.pending="",e=0;e<3*Math.floor((i+t.length)/3)-i;e++)n+=String.fromCharCode(t[e]);for(;e<t.length;e++)this.pending+=String.fromCharCode(t[e]);n.length>2?this.data+=btoa(n):this.pending=n}getData(){return this.data+btoa(this.pending)}},t.ERR_BAD_FORMAT=rt,t.ERR_CENTRAL_DIRECTORY_NOT_FOUND=ct,t.ERR_DUPLICATED_NAME=bt,t.ERR_ENCRYPTED=dt,t.ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND=ot,t.ERR_EOCDR_NOT_FOUND=st,t.ERR_EOCDR_ZIP64_NOT_FOUND=at,t.ERR_EXTRA_FIELD_ZIP64_NOT_FOUND=lt,t.ERR_INVALID_COMMENT=At,t.ERR_INVALID_ENTRY_COMMENT=Et,t.ERR_INVALID_ENTRY_NAME=Rt,t.ERR_INVALID_EXTRAFIELD_DATA=Ft,t.ERR_INVALID_EXTRAFIELD_TYPE=xt,t.ERR_INVALID_PASSORD=U,t.ERR_INVALID_SIGNATURE=j,t.ERR_INVALID_VERSION=Dt,t.ERR_LOCAL_FILE_HEADER_NOT_FOUND=ht,t.ERR_UNSUPPORTED_COMPRESSION=pt,t.ERR_UNSUPPORTED_ENCRYPTION=ut,t.HttpRangeReader=class extends r{constructor(t){super(),this.url=t}init(){return super.init(),new Promise(((t,n)=>{const i=new XMLHttpRequest;i.addEventListener("load",(()=>{i.status<400?(this.size=Number(i.getResponseHeader("Content-Length")),"bytes"==i.getResponseHeader("Accept-Ranges")?t():n(new Error("HTTP Range not supported"))):n(e+(i.statusText||i.status)+".")}),!1),i.addEventListener("error",n,!1),i.open("HEAD",this.url),i.send()}))}readUint8Array(t,n){return new Promise(((i,r)=>{const s=new XMLHttpRequest;s.open("GET",this.url),s.responseType="arraybuffer",s.setRequestHeader("Range","bytes="+t+"-"+(t+n-1)),s.addEventListener("load",(()=>{s.status<400?i(new Uint8Array(s.response)):r(e+(s.statusText||s.status)+".")}),!1),s.addEventListener("error",r,!1),s.send()}))}},t.HttpReader=class extends r{constructor(t){super(),this.url=t}async init(){if(super.init(),function(t){if("undefined"!=typeof document){const e=document.createElement("a");return e.href=t,"http:"==e.protocol||"https:"==e.protocol}return/^https?:\/\//i.test(t)}(this.url))return new Promise(((t,n)=>{const i=new XMLHttpRequest;i.addEventListener("load",(()=>{i.status<400?(this.size=Number(i.getResponseHeader("Content-Length")),this.size?t():c().then((()=>t())).catch(n)):n(e+(i.statusText||i.status)+".")}),!1),i.addEventListener("error",n,!1),i.open("HEAD",this.url),i.send()}));await c()}async readUint8Array(t,e){return this.data||await c(this,this.url),new Uint8Array(this.data.subarray(t,t+e))}},t.Reader=r,t.TextReader=class extends r{constructor(t){super(),this.blobReader=new a(new Blob([t],{type:n}))}init(){super.init(),this.blobReader.init(),this.size=this.blobReader.size}readUint8Array(t,e){return this.blobReader.readUint8Array(t,e)}},t.TextWriter=class extends s{constructor(t){super(),this.encoding=t,this.blob=new Blob([],{type:n})}writeUint8Array(t){super.writeUint8Array(t),this.blob=new Blob([this.blob,t.buffer],{type:n})}getData(){const t=new FileReader;return new Promise(((e,n)=>{t.onload=t=>e(t.target.result),t.onerror=n,t.readAsText(this.blob,this.encoding)}))}},t.Uint8ArrayReader=class extends r{constructor(t){super(),this.array=t,this.size=t.length}readUint8Array(t,e){return this.array.slice(t,t+e)}},t.Uint8ArrayWriter=o,t.Writer=s,t.ZipReader=class extends class{constructor(t,e={},n={}){this.reader=t,this.options=e,this.config=n}async getEntries(){const t=this.reader;t.initialized||await t.init();const e=await async function(t,e,n,i){const r=new Uint8Array(4);if(new DataView(r.buffer).setUint32(0,e),t.size<n)throw new Error(rt);const s=n+i;let a=n,o=await c(a);o||(o=await c(Math.min(s,t.size)));if(!o)throw new Error(st);return o;async function c(e){const i=t.size-e,s=await t.readUint8Array(i,e);for(let t=s.length-n;t>=0;t--)if(s[t]==r[0]&&s[t+1]==r[1]&&s[t+2]==r[2]&&s[t+3]==r[3])return{offset:i,buffer:s.slice(t,t+n).buffer}}}(t,g,22,l);let n,i=new DataView(e.buffer),r=i.getUint32(16,!0),s=i.getUint16(8,!0);if(r==h||s==l){n=!0;const i=await t.readUint8Array(e.offset-20,20),a=new DataView(i.buffer);if(Number(a.getUint32(0,!1))!=w)throw new Error(at);r=Number(a.getBigUint64(8,!0));const o=await t.readUint8Array(r,56),c=new DataView(o.buffer);if(Number(c.getUint32(0,!1))!=f)throw new Error(ot);s=Number(c.getBigUint64(24,!0)),r-=Number(c.getBigUint64(40,!0))}if(r<0||!n&&(r>=t.size||s>=l))throw new Error(rt);const a=await t.readUint8Array(r,t.size-r);i=new DataView(a.buffer);const o=[];let c=0;for(let t=0;t<s;t++){const t=new wt(this.reader,this.config,this.options);if(i.getUint32(c,!1)!=p)throw new Error(ct);t.compressedSize=0,t.uncompressedSize=0,yt(t,i,c+6),t.commentLength=i.getUint16(c+32,!0),t.directory=16==(16&i.getUint8(c+38)),t.offset=i.getUint32(c+42,!0),t.rawFilename=a.subarray(c+46,c+46+t.filenameLength),t.filename=mt(t.rawFilename,t.bitFlag.languageEncodingFlag?gt:this.options.filenameEncoding||ft),t.directory||"/"!=t.filename.charAt(t.filename.length-1)||(t.directory=!0),t.rawExtraField=a.subarray(c+46+t.filenameLength,c+46+t.filenameLength+t.extraFieldLength),Ut(t,t,i,c+6),t.rawComment=a.subarray(c+46+t.filenameLength+t.extraFieldLength,c+46+t.filenameLength+t.extraFieldLength+t.commentLength),t.comment=mt(t.rawComment,t.bitFlag.languageEncodingFlag?gt:this.options.commentEncoding||ft),o.push(t),c+=46+t.filenameLength+t.extraFieldLength+t.commentLength}return o}async close(){}}{constructor(t,e){super(t,e,_t)}},t.ZipWriter=class extends class{constructor(t,e={},n={}){this.writer=t,this.options=e,this.config=n,this.files=new Map,this.offset=t.size,this.zip64=e.zip64}async add(t,e,n={}){if(t=t.trim(),n.directory&&t.length&&"/"!=t.charAt(t.length-1)&&(t+="/"),this.files.has(t))throw new Error(bt);if(n.comment=vt(zt(n.comment||"")),n.comment.length>l)throw new Error(Et);n.zip64=n.zip64||this.zip64,await async function(t,e,n,i){const r=t.files,s=t.writer;let a;r.set(e,null);try{let c,p;try{i.bufferedWrite||t.options.bufferedWrite||t.lockWrite?(c=new o,c.init()):(t.lockWrite=new Promise((t=>a=t)),s.initialized||await s.init(),c=s),(t.offset>=h||n&&(n.size>=h||t.offset+n.size>=h))&&(i.zip64=!0),p=await async function(t,e,n,i,r,s){const a=vt(zt(t)),o=s.lastModDate||new Date,c=new Uint8Array(26),p=new DataView(c.buffer),g=void 0===s.password?r.password:s.password,f=g&&g.length&&g,w=void 0===s.level?r.level:s.level,y=0!==w&&!s.directory,U=void 0===g||!g.length,m=s.zip64,b={zip64:m,headerArray:c,directory:s.directory,filename:a,comment:s.comment,extraFieldZip64:m?new Uint8Array(28):new Uint8Array(0),extraFieldAES:f?new Uint8Array([1,153,7,0,2,0,65,69,3,0,0]):new Uint8Array(0),rawExtraField:new Uint8Array(0)},A=s.extraField;if(a.length>l)throw new Error(Rt);if(A){let t=4,e=0;A.forEach((e=>t+=e.length));const n=b.rawExtraField=new Uint8Array(t);A.forEach(((t,i)=>{if(i>l)throw new Error(xt);if(t.length>l)throw new Error(Ft);n.set(new Uint16Array([i]),e),n.set(new Uint16Array([t.length]),e+2),n.set(t,e+4),e+=4+t.length}))}if(s.bitFlag=8,s.version=(void 0===s.version?r.version:s.version)||20,s.version>l)throw new Error(Dt);s.compressionMethod=0,y&&(s.compressionMethod=8);m&&(s.version=s.version>45?s.version:45);f&&(s.version=s.version>51?s.version:51,s.bitFlag=9,s.compressionMethod=99,y&&(b.extraFieldAES[9]=8));p.setUint16(0,s.version,!0),p.setUint16(2,s.bitFlag,!0),p.setUint16(4,s.compressionMethod,!0),p.setUint16(6,(o.getHours()<<6|o.getMinutes())<<5|o.getSeconds()/2,!0),p.setUint16(8,(o.getFullYear()-1980<<4|o.getMonth()+1)<<5|o.getDate(),!0),p.setUint16(22,a.length,!0),p.setUint16(24,0,!0);const E=new Uint8Array(30+a.length);let R;if(new DataView(E.buffer).setUint32(0,d),E.set(c,4),E.set(a,30),e){e.initialized||await e.init();const t=await Q(i,{codecType:P,level:w,outputPassword:g,outputSigned:U,outputCompressed:y,outputEncrypted:Boolean(g)});await n.writeUint8Array(E),R=await nt(t,e,n,0,e.size,i,{onprogress:s.onprogress}),b.compressedSize=R.length}else await n.writeUint8Array(E);const D=new Uint8Array(m?24:16),x=new DataView(D.buffer);if(x.setUint32(0,u),e)if(f||void 0===R.signature||(p.setUint32(10,R.signature,!0),x.setUint32(4,R.signature,!0)),m){p.setUint32(14,h,!0),x.setBigUint64(8,BigInt(b.compressedSize),!0),p.setUint32(18,h,!0),x.setBigUint64(16,BigInt(e.size),!0);const t=new DataView(b.extraFieldZip64.buffer);t.setUint16(0,1,!0),t.setUint16(2,24,!0),t.setBigUint64(4,BigInt(e.size),!0),t.setBigUint64(12,BigInt(b.compressedSize),!0)}else p.setUint32(14,b.compressedSize,!0),x.setUint32(8,b.compressedSize,!0),p.setUint32(18,e.size,!0),x.setUint32(12,e.size,!0);return await n.writeUint8Array(D),b.length=E.length+(R?R.length:0)+D.length,b}(e,n,c,t.config,t.options,i)}catch(t){throw r.delete(e),t}if(r.set(e,p),c!=s&&(t.lockWrite&&await t.lockWrite,await s.writeUint8Array(c.getData())),p.offset=t.offset,p.zip64){new DataView(p.extraFieldZip64.buffer).setBigUint64(20,BigInt(p.offset),!0)}t.offset+=p.length}finally{a&&(t.lockWrite=null,a())}}(this,t,e,n)}async close(t){const e=this.writer,n=this.files;let i=0,r=0,s=this.offset,a=n.size;if(t&&t.length){if(!(t.length<=l))throw new Error(At);c.setUint16(i+20,t.length,!0)}for(const[,t]of n)r+=46+t.filename.length+t.comment.length+t.extraFieldZip64.length+t.extraFieldAES.length+t.rawExtraField.length;(s+r>=h||a>=l)&&(this.zip64=!0);const o=new Uint8Array(r+(this.zip64?98:22)),c=new DataView(o.buffer);for(const[,t]of n){const e=t.filename,n=t.extraFieldZip64,r=t.extraFieldAES,s=n.length+r.length+t.rawExtraField.length;c.setUint32(i,p),t.zip64?c.setUint16(i+4,11520):c.setUint16(i+4,5120),o.set(t.headerArray,i+6),c.setUint16(i+30,s,!0),c.setUint16(i+32,t.comment.length,!0),t.directory&&c.setUint8(i+38,16),t.zip64?c.setUint32(i+42,h,!0):c.setUint32(i+42,t.offset,!0),o.set(e,i+46),o.set(n,i+46+e.length),o.set(r,i+46+e.length+n.length),o.set(t.rawExtraField,46+e.length+n.length+r.length),o.set(t.comment,i+46+e.length+s),i+=46+e.length+s+t.comment.length}return this.zip64&&(c.setUint32(i,f),c.setBigUint64(i+4,BigInt(44),!0),c.setUint16(i+12,45,!0),c.setUint16(i+14,45,!0),c.setBigUint64(i+24,BigInt(a),!0),c.setBigUint64(i+32,BigInt(a),!0),c.setBigUint64(i+40,BigInt(r),!0),c.setBigUint64(i+48,BigInt(s),!0),c.setUint32(i+56,w),c.setBigUint64(i+64,BigInt(s+r),!0),c.setUint32(i+72,1,!0),a=l,s=h,i+=76),c.setUint32(i,g),c.setUint16(i+8,a,!0),c.setUint16(i+10,a,!0),c.setUint32(i+12,r,!0),c.setUint32(i+16,s,!0),await e.writeUint8Array(o),t&&t.length&&await e.writeUint8Array(t),e.getData()}}{constructor(t,e){super(t,e,_t)}},t.configure=function(t){_t=Object.assign({},_t,t)},t.getMimeType=function(){return"application/octet-stream"},t.initShimAsyncCodec=(t,e={})=>({ZipDeflate:Lt(t.Deflate,e.deflate),ZipInflate:Lt(t.Inflate,e.inflate)}),Object.defineProperty(t,"__esModule",{value:!0})})); |
@@ -94,17 +94,20 @@ /* | ||
async function createWorkerInterface(workerData) { | ||
function createWorkerInterface(workerData) { | ||
const interfaceCodec = createCodec(workerData.options); | ||
const append = interfaceCodec.append.bind(interfaceCodec); | ||
const flush = interfaceCodec.flush.bind(interfaceCodec); | ||
interfaceCodec.append = async data => { | ||
try { | ||
return await append(data); | ||
} catch (error) { | ||
await onWorkerTaskFinished(workerData); | ||
throw error; | ||
} | ||
}; | ||
interfaceCodec.flush = async () => { | ||
const result = await flush(); | ||
workerData.busy = false; | ||
if (workers.pendingRequests.length) { | ||
const [{ resolve, options }] = workers.pendingRequests.splice(0, 1); | ||
workerData.busy = true; | ||
workerData.options = options; | ||
resolve(await createWorkerInterface(workerData)); | ||
} else { | ||
workers.pool = workers.pool.filter(data => data != workerData); | ||
try { | ||
return await flush(); | ||
} finally { | ||
await onWorkerTaskFinished(workerData); | ||
} | ||
return result; | ||
}; | ||
@@ -114,2 +117,14 @@ return interfaceCodec; | ||
async function onWorkerTaskFinished(workerData) { | ||
workerData.busy = false; | ||
if (workers.pendingRequests.length) { | ||
const [{ resolve, options }] = workers.pendingRequests.splice(0, 1); | ||
workerData.busy = true; | ||
workerData.options = options; | ||
resolve(createWorkerInterface(workerData)); | ||
} else { | ||
workers.pool = workers.pool.filter(data => data != workerData); | ||
} | ||
} | ||
function createWebWorkerInterface(workerData) { | ||
@@ -150,3 +165,4 @@ const worker = workerData.worker; | ||
task.reject(error); | ||
worker.removeEventListener(MESSAGE_EVENT_TYPE, onMessage, false); | ||
task = null; | ||
onWebWorkerTaskFinished(workerData); | ||
} | ||
@@ -164,3 +180,4 @@ return new Promise((resolve, reject) => task = { resolve, reject }); | ||
task.reject(error); | ||
worker.removeEventListener(MESSAGE_EVENT_TYPE, onMessage, false); | ||
task = null; | ||
onWebWorkerTaskFinished(workerData); | ||
} else if (message.type == MESSAGE_INIT || message.type == MESSAGE_FLUSH || message.type == MESSAGE_APPEND) { | ||
@@ -170,3 +187,3 @@ if (message.type == MESSAGE_FLUSH) { | ||
task = null; | ||
terminateWebWorker(workerData); | ||
onWebWorkerTaskFinished(workerData); | ||
} else { | ||
@@ -180,3 +197,3 @@ task.resolve(message.data && new Uint8Array(message.data)); | ||
function terminateWebWorker(workerData) { | ||
function onWebWorkerTaskFinished(workerData) { | ||
workerData.busy = false; | ||
@@ -183,0 +200,0 @@ if (workers.pendingRequests.length) { |
@@ -30,3 +30,3 @@ | ||
/* globals self, pako */ | ||
/* global self, pako */ | ||
@@ -33,0 +33,0 @@ import { default as initShimAsyncCodec } from "./util/stream-codec-shim.js"; |
@@ -29,6 +29,18 @@ /* | ||
/* globals TextDecoder*/ | ||
/* global TextDecoder */ | ||
"use strict"; | ||
import { | ||
MAX_32_BITS, | ||
MAX_16_BITS, | ||
COMPRESSION_METHOD_DEFLATE, | ||
COMPRESSION_METHOD_STORE, | ||
COMPRESSION_METHOD_AES, | ||
LOCAL_FILE_HEADER_SIGNATURE, | ||
CENTRAL_FILE_HEADER_SIGNATURE, | ||
END_OF_CENTRAL_DIR_SIGNATURE, | ||
ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE, | ||
ZIP64_END_OF_CENTRAL_DIR_SIGNATURE, | ||
} from "./constants.js"; | ||
import { createCodec, CODEC_INFLATE, ERR_INVALID_SIGNATURE, ERR_INVALID_PASSORD } from "./workers.js"; | ||
@@ -48,3 +60,2 @@ import Crc32 from "./codecs/crc32.js"; | ||
const ERR_UNSUPPORTED_COMPRESSION = "Compression method not supported"; | ||
const MAX_ZIP_COMMENT_SIZE = 65536; | ||
const CHARSET_UTF8 = "utf-8"; | ||
@@ -66,11 +77,11 @@ const CHARSET_WIN_1252 = "windows-1252"; | ||
} | ||
const directoryInfo = await seekSignature(reader, [0x50, 0x4b, 0x05, 0x06], 22, MAX_ZIP_COMMENT_SIZE); | ||
const directoryInfo = await seekSignature(reader, END_OF_CENTRAL_DIR_SIGNATURE, 22, MAX_16_BITS); | ||
let zip64, directoryDataView = new DataView(directoryInfo.buffer); | ||
let dataLength = directoryDataView.getUint32(16, true); | ||
let filesLength = directoryDataView.getUint16(8, true); | ||
if (dataLength == 0xffffffff || filesLength == 0xffff) { | ||
if (dataLength == MAX_32_BITS || filesLength == MAX_16_BITS) { | ||
zip64 = true; | ||
const directoryLocatorArray = await reader.readUint8Array(directoryInfo.offset - 20, 20); | ||
const directoryLocatorView = new DataView(directoryLocatorArray.buffer); | ||
if (Number(directoryLocatorView.getUint32(0, false)) != 0x504b0607) { | ||
if (Number(directoryLocatorView.getUint32(0, false)) != ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE) { | ||
throw new Error(ERR_EOCDR_ZIP64_NOT_FOUND); | ||
@@ -81,3 +92,3 @@ } | ||
const directoryDataView = new DataView(directoryDataArray.buffer); | ||
if (Number(directoryDataView.getUint32(0, false)) != 0x504b0606) { | ||
if (Number(directoryDataView.getUint32(0, false)) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE) { | ||
throw new Error(ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND); | ||
@@ -88,32 +99,32 @@ } | ||
} | ||
if (dataLength < 0 || (!zip64 && (dataLength >= reader.size || filesLength >= 0xffff))) { | ||
if (dataLength < 0 || (!zip64 && (dataLength >= reader.size || filesLength >= MAX_16_BITS))) { | ||
throw new Error(ERR_BAD_FORMAT); | ||
} | ||
const dataArray = await reader.readUint8Array(dataLength, reader.size - dataLength); | ||
directoryDataView = new DataView(dataArray.buffer); | ||
const directoryDataArray = await reader.readUint8Array(dataLength, reader.size - dataLength); | ||
directoryDataView = new DataView(directoryDataArray.buffer); | ||
const entries = []; | ||
let offset = 0; | ||
for (let indexFile = 0; indexFile < filesLength; indexFile++) { | ||
const entry = new Entry(this.reader, this.config, this.options); | ||
if (directoryDataView.getUint32(offset, false) != 0x504b0102) { | ||
const fileEntry = new Entry(this.reader, this.config, this.options); | ||
if (directoryDataView.getUint32(offset, false) != CENTRAL_FILE_HEADER_SIGNATURE) { | ||
throw new Error(ERR_CENTRAL_DIRECTORY_NOT_FOUND); | ||
} | ||
entry.compressedSize = 0; | ||
entry.uncompressedSize = 0; | ||
readCommonHeader(entry, directoryDataView, offset + 6); | ||
entry.commentLength = directoryDataView.getUint16(offset + 32, true); | ||
entry.directory = ((directoryDataView.getUint8(offset + 38) & 0x10) == 0x10); | ||
entry.offset = directoryDataView.getUint32(offset + 42, true); | ||
entry.rawFilename = dataArray.subarray(offset + 46, offset + 46 + entry.filenameLength); | ||
entry.filename = decodeString(entry.rawFilename, entry.bitFlag.languageEncodingFlag ? CHARSET_UTF8 : this.options.filenameEncoding || CHARSET_WIN_1252); | ||
if (!entry.directory && entry.filename.charAt(entry.filename.length - 1) == "/") { | ||
entry.directory = true; | ||
fileEntry.compressedSize = 0; | ||
fileEntry.uncompressedSize = 0; | ||
readCommonHeader(fileEntry, directoryDataView, offset + 6); | ||
fileEntry.commentLength = directoryDataView.getUint16(offset + 32, true); | ||
fileEntry.directory = ((directoryDataView.getUint8(offset + 38) & 0x10) == 0x10); | ||
fileEntry.offset = directoryDataView.getUint32(offset + 42, true); | ||
fileEntry.rawFilename = directoryDataArray.subarray(offset + 46, offset + 46 + fileEntry.filenameLength); | ||
fileEntry.filename = decodeString(fileEntry.rawFilename, fileEntry.bitFlag.languageEncodingFlag ? CHARSET_UTF8 : this.options.filenameEncoding || CHARSET_WIN_1252); | ||
if (!fileEntry.directory && fileEntry.filename.charAt(fileEntry.filename.length - 1) == "/") { | ||
fileEntry.directory = true; | ||
} | ||
entry.rawExtraField = dataArray.subarray(offset + 46 + entry.filenameLength, offset + 46 + entry.filenameLength + entry.extraFieldLength); | ||
readCommonFooter(entry, entry, directoryDataView, offset + 6); | ||
entry.rawComment = dataArray.subarray(offset + 46 + entry.filenameLength + entry.extraFieldLength, offset + 46 | ||
+ entry.filenameLength + entry.extraFieldLength + entry.commentLength); | ||
entry.comment = decodeString(entry.rawComment, entry.bitFlag.languageEncodingFlag ? CHARSET_UTF8 : this.options.commentEncoding || CHARSET_WIN_1252); | ||
entries.push(entry); | ||
offset += 46 + entry.filenameLength + entry.extraFieldLength + entry.commentLength; | ||
fileEntry.rawExtraField = directoryDataArray.subarray(offset + 46 + fileEntry.filenameLength, offset + 46 + fileEntry.filenameLength + fileEntry.extraFieldLength); | ||
readCommonFooter(fileEntry, fileEntry, directoryDataView, offset + 6); | ||
fileEntry.rawComment = directoryDataArray.subarray(offset + 46 + fileEntry.filenameLength + fileEntry.extraFieldLength, offset + 46 | ||
+ fileEntry.filenameLength + fileEntry.extraFieldLength + fileEntry.commentLength); | ||
fileEntry.comment = decodeString(fileEntry.rawComment, fileEntry.bitFlag.languageEncodingFlag ? CHARSET_UTF8 : this.options.commentEncoding || CHARSET_WIN_1252); | ||
entries.push(fileEntry); | ||
offset += 46 + fileEntry.filenameLength + fileEntry.extraFieldLength + fileEntry.commentLength; | ||
} | ||
@@ -161,3 +172,3 @@ return entries; | ||
if (this.extraFieldAES) { | ||
if (this.extraFieldAES.originalCompressionMethod != 0x63) { | ||
if (this.extraFieldAES.originalCompressionMethod != COMPRESSION_METHOD_AES) { | ||
throw new Error(ERR_UNSUPPORTED_COMPRESSION); | ||
@@ -169,7 +180,7 @@ } | ||
} | ||
if (this.compressionMethod != 0x0 && this.compressionMethod != 0x08) { | ||
if (this.compressionMethod != COMPRESSION_METHOD_STORE && this.compressionMethod != COMPRESSION_METHOD_DEFLATE) { | ||
throw new Error(ERR_UNSUPPORTED_COMPRESSION); | ||
} | ||
if (dataView.getUint32(0, false) != 0x504b0304) { | ||
throw ERR_LOCAL_FILE_HEADER_NOT_FOUND; | ||
if (dataView.getUint32(0, false) != LOCAL_FILE_HEADER_SIGNATURE) { | ||
throw new Error(ERR_LOCAL_FILE_HEADER_NOT_FOUND); | ||
} | ||
@@ -217,3 +228,3 @@ const localDirectory = this.localDirectory = {}; | ||
function readCommonFooter(entry, directory, dataView, offset) { | ||
function readCommonFooter(fileEntry, directory, dataView, offset) { | ||
let extraFieldZip64, extraFieldAES, extraFieldUnicodePath; | ||
@@ -247,3 +258,3 @@ const rawExtraField = directory.rawExtraField; | ||
if (extraFieldUnicodePath) { | ||
readExtraFieldUnicodePath(extraFieldUnicodePath, directory, entry); | ||
readExtraFieldUnicodePath(extraFieldUnicodePath, directory, fileEntry); | ||
} | ||
@@ -269,3 +280,3 @@ extraFieldAES = directory.extraFieldAES = extraField.get(0x9901); | ||
const properties = ["uncompressedSize", "compressedSize", "offset"]; | ||
const missingProperties = properties.filter(propertyName => directory[propertyName] == 0xffffffff); | ||
const missingProperties = properties.filter(propertyName => directory[propertyName] == MAX_32_BITS); | ||
for (let indexMissingProperty = 0; indexMissingProperty < missingProperties.length; indexMissingProperty++) { | ||
@@ -275,3 +286,3 @@ extraFieldZip64[missingProperties[indexMissingProperty]] = extraFieldZip64.values[indexMissingProperty]; | ||
properties.forEach(propertyName => { | ||
if (directory[propertyName] == 0xffffffff) { | ||
if (directory[propertyName] == MAX_32_BITS) { | ||
if (extraFieldZip64 && extraFieldZip64[propertyName] !== undefined) { | ||
@@ -286,3 +297,3 @@ directory[propertyName] = extraFieldZip64 && extraFieldZip64[propertyName]; | ||
function readExtraFieldUnicodePath(extraFieldUnicodePath, directory, entry) { | ||
function readExtraFieldUnicodePath(extraFieldUnicodePath, directory, fileEntry) { | ||
const extraFieldView = new DataView(extraFieldUnicodePath.data.buffer); | ||
@@ -292,3 +303,3 @@ extraFieldUnicodePath.version = extraFieldView.getUint8(0); | ||
const crc32 = new Crc32(); | ||
crc32.append(entry.rawFilename); | ||
crc32.append(fileEntry.rawFilename); | ||
const dataViewSignature = new DataView(new Uint8Array(4).buffer); | ||
@@ -317,2 +328,5 @@ dataViewSignature.setUint32(0, crc32.get()); | ||
async function seekSignature(reader, signature, minimumBytes, maximumLength) { | ||
const signatureArray = new Uint8Array(4); | ||
const signatureView = new DataView(signatureArray.buffer); | ||
signatureView.setUint32(0, signature); | ||
if (reader.size < minimumBytes) { | ||
@@ -336,3 +350,4 @@ throw new Error(ERR_BAD_FORMAT); | ||
for (let indexByte = bytes.length - minimumBytes; indexByte >= 0; indexByte--) { | ||
if (bytes[indexByte] == signature[0] && bytes[indexByte + 1] == signature[1] && bytes[indexByte + 2] == signature[2] && bytes[indexByte + 3] == signature[3]) { | ||
if (bytes[indexByte] == signatureArray[0] && bytes[indexByte + 1] == signatureArray[1] && | ||
bytes[indexByte + 2] == signatureArray[2] && bytes[indexByte + 3] == signatureArray[3]) { | ||
return { | ||
@@ -339,0 +354,0 @@ offset, |
@@ -29,6 +29,19 @@ /* | ||
/* globals BigInt */ | ||
/* global BigInt */ | ||
"use strict"; | ||
import { | ||
MAX_32_BITS, | ||
MAX_16_BITS, | ||
COMPRESSION_METHOD_DEFLATE, | ||
COMPRESSION_METHOD_STORE, | ||
COMPRESSION_METHOD_AES, | ||
LOCAL_FILE_HEADER_SIGNATURE, | ||
DATA_DESCRIPTOR_RECORD_SIGNATURE, | ||
CENTRAL_FILE_HEADER_SIGNATURE, | ||
END_OF_CENTRAL_DIR_SIGNATURE, | ||
ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE, | ||
ZIP64_END_OF_CENTRAL_DIR_SIGNATURE | ||
} from "./constants.js"; | ||
import { CODEC_DEFLATE, createCodec } from "./workers.js"; | ||
@@ -38,7 +51,9 @@ import { Uint8ArrayWriter } from "./stream.js"; | ||
const COMPRESSION_METHOD_DEFLATE = 0x08; | ||
const MAX_COMMENT_LENGTH = 65536; | ||
const ERR_DUPLICATED_NAME = "File already exists"; | ||
const ERR_INVALID_COMMENT = "Zip file comment exceeds 64KB"; | ||
const ERR_INVALID_ENTRY_COMMENT = "File entry comment exceeds 64KB"; | ||
const ERR_INVALID_ENTRY_NAME = "File entry name exceeds 64KB"; | ||
const ERR_INVALID_VERSION = "Version exceeds 65535"; | ||
const ERR_INVALID_EXTRAFIELD_TYPE = "Extra field type exceeds 65535"; | ||
const ERR_INVALID_EXTRAFIELD_DATA = "Extra field data exceeds 64KB"; | ||
@@ -58,3 +73,3 @@ class ZipWriter { | ||
name = name.trim(); | ||
if (options.directory && name.charAt(name.length - 1) != "/") { | ||
if (options.directory && name.length && name.charAt(name.length - 1) != "/") { | ||
name += "/"; | ||
@@ -66,3 +81,3 @@ } | ||
options.comment = getBytes(encodeUTF8(options.comment || "")); | ||
if (options.comment > MAX_COMMENT_LENGTH) { | ||
if (options.comment.length > MAX_16_BITS) { | ||
throw new Error(ERR_INVALID_ENTRY_COMMENT); | ||
@@ -78,6 +93,13 @@ } | ||
let offset = 0, directoryDataLength = 0, directoryOffset = this.offset, filesLength = files.size; | ||
if (comment && comment.length) { | ||
if (comment.length <= MAX_16_BITS) { | ||
directoryDataView.setUint16(offset + 20, comment.length, true); | ||
} else { | ||
throw new Error(ERR_INVALID_COMMENT); | ||
} | ||
} | ||
for (const [, fileEntry] of files) { | ||
directoryDataLength += 46 + fileEntry.filename.length + fileEntry.comment.length + fileEntry.extraFieldZip64.length + fileEntry.extraFieldAES.length + fileEntry.rawExtraField.length; | ||
} | ||
if (directoryOffset + directoryDataLength >= 0xffffffff || filesLength >= 0xffff) { | ||
if (directoryOffset + directoryDataLength >= MAX_32_BITS || filesLength >= MAX_16_BITS) { | ||
this.zip64 = true; | ||
@@ -92,3 +114,3 @@ } | ||
const extraFieldLength = extraFieldZip64.length + extraFieldAES.length + fileEntry.rawExtraField.length; | ||
directoryDataView.setUint32(offset, 0x504b0102); | ||
directoryDataView.setUint32(offset, CENTRAL_FILE_HEADER_SIGNATURE); | ||
if (fileEntry.zip64) { | ||
@@ -106,3 +128,3 @@ directoryDataView.setUint16(offset + 4, 0x2d00); | ||
if (fileEntry.zip64) { | ||
directoryDataView.setUint32(offset + 42, 0xffffffff, true); | ||
directoryDataView.setUint32(offset + 42, MAX_32_BITS, true); | ||
} else { | ||
@@ -119,3 +141,3 @@ directoryDataView.setUint32(offset + 42, fileEntry.offset, true); | ||
if (this.zip64) { | ||
directoryDataView.setUint32(offset, 0x504b0606); | ||
directoryDataView.setUint32(offset, ZIP64_END_OF_CENTRAL_DIR_SIGNATURE); | ||
directoryDataView.setBigUint64(offset + 4, BigInt(44), true); | ||
@@ -128,10 +150,10 @@ directoryDataView.setUint16(offset + 12, 45, true); | ||
directoryDataView.setBigUint64(offset + 48, BigInt(directoryOffset), true); | ||
directoryDataView.setUint32(offset + 56, 0x504b0607); | ||
directoryDataView.setUint32(offset + 56, ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE); | ||
directoryDataView.setBigUint64(offset + 64, BigInt(directoryOffset + directoryDataLength), true); | ||
directoryDataView.setUint32(offset + 72, 1, true); | ||
filesLength = 0xffff; | ||
directoryOffset = 0xffffffff; | ||
filesLength = MAX_16_BITS; | ||
directoryOffset = MAX_32_BITS; | ||
offset += 76; | ||
} | ||
directoryDataView.setUint32(offset, 0x504b0506); | ||
directoryDataView.setUint32(offset, END_OF_CENTRAL_DIR_SIGNATURE); | ||
directoryDataView.setUint16(offset + 8, filesLength, true); | ||
@@ -141,9 +163,2 @@ directoryDataView.setUint16(offset + 10, filesLength, true); | ||
directoryDataView.setUint32(offset + 16, directoryOffset, true); | ||
if (comment && comment.length) { | ||
if (comment.length <= MAX_COMMENT_LENGTH) { | ||
directoryDataView.setUint16(offset + 20, comment.length, true); | ||
} else { | ||
throw new Error(ERR_INVALID_COMMENT); | ||
} | ||
} | ||
await writer.writeUint8Array(directoryDataArray); | ||
@@ -161,3 +176,7 @@ if (comment && comment.length) { | ||
ERR_INVALID_COMMENT, | ||
ERR_INVALID_ENTRY_COMMENT | ||
ERR_INVALID_ENTRY_NAME, | ||
ERR_INVALID_ENTRY_COMMENT, | ||
ERR_INVALID_VERSION, | ||
ERR_INVALID_EXTRAFIELD_TYPE, | ||
ERR_INVALID_EXTRAFIELD_DATA | ||
}; | ||
@@ -182,3 +201,3 @@ | ||
} | ||
if (zipWriter.offset >= 0xffffffff || (reader && (reader.size >= 0xffffffff || zipWriter.offset + reader.size >= 0xffffffff))) { | ||
if (zipWriter.offset >= MAX_32_BITS || (reader && (reader.size >= MAX_32_BITS || zipWriter.offset + reader.size >= MAX_32_BITS))) { | ||
options.zip64 = true; | ||
@@ -234,2 +253,5 @@ } | ||
const extraField = options.extraField; | ||
if (filename.length > MAX_16_BITS) { | ||
throw new Error(ERR_INVALID_ENTRY_NAME); | ||
} | ||
if (extraField) { | ||
@@ -240,2 +262,8 @@ let extraFieldSize = 4, offset = 0; | ||
extraField.forEach((data, type) => { | ||
if (type > MAX_16_BITS) { | ||
throw new Error(ERR_INVALID_EXTRAFIELD_TYPE); | ||
} | ||
if (data.length > MAX_16_BITS) { | ||
throw new Error(ERR_INVALID_EXTRAFIELD_DATA); | ||
} | ||
rawExtraField.set(new Uint16Array([type]), offset); | ||
@@ -249,3 +277,6 @@ rawExtraField.set(new Uint16Array([data.length]), offset + 2); | ||
options.version = (options.version === undefined ? zipWriterOptions.version : options.version) || 0x14; | ||
options.compressionMethod = 0; | ||
if (options.version > MAX_16_BITS) { | ||
throw new Error(ERR_INVALID_VERSION); | ||
} | ||
options.compressionMethod = COMPRESSION_METHOD_STORE; | ||
if (compressed) { | ||
@@ -260,3 +291,3 @@ options.compressionMethod = COMPRESSION_METHOD_DEFLATE; | ||
options.bitFlag = 0x09; | ||
options.compressionMethod = 0x63; | ||
options.compressionMethod = COMPRESSION_METHOD_AES; | ||
if (compressed) { | ||
@@ -275,3 +306,3 @@ fileEntry.extraFieldAES[9] = COMPRESSION_METHOD_DEFLATE; | ||
const fileDataView = new DataView(fileDataArray.buffer); | ||
fileDataView.setUint32(0, 0x504b0304); | ||
fileDataView.setUint32(0, LOCAL_FILE_HEADER_SIGNATURE); | ||
fileDataArray.set(headerArray, 4); | ||
@@ -300,3 +331,3 @@ fileDataArray.set(filename, 30); | ||
const footerView = new DataView(footerArray.buffer); | ||
footerView.setUint32(0, 0x504b0708); | ||
footerView.setUint32(0, DATA_DESCRIPTOR_RECORD_SIGNATURE); | ||
if (reader) { | ||
@@ -308,5 +339,5 @@ if (!outputPassword && result.signature !== undefined) { | ||
if (zip64) { | ||
headerView.setUint32(14, 0xffffffff, true); | ||
headerView.setUint32(14, MAX_32_BITS, true); | ||
footerView.setBigUint64(8, BigInt(fileEntry.compressedSize), true); | ||
headerView.setUint32(18, 0xffffffff, true); | ||
headerView.setUint32(18, MAX_32_BITS, true); | ||
footerView.setBigUint64(16, BigInt(reader.size), true); | ||
@@ -313,0 +344,0 @@ const extraFieldZip64View = new DataView(fileEntry.extraFieldZip64.buffer); |
@@ -29,3 +29,3 @@ /* | ||
/* globals navigator */ | ||
/* global navigator */ | ||
@@ -69,3 +69,7 @@ "use strict"; | ||
ERR_INVALID_COMMENT, | ||
ERR_INVALID_ENTRY_COMMENT | ||
ERR_INVALID_ENTRY_NAME, | ||
ERR_INVALID_ENTRY_COMMENT, | ||
ERR_INVALID_VERSION, | ||
ERR_INVALID_EXTRAFIELD_TYPE, | ||
ERR_INVALID_EXTRAFIELD_DATA | ||
} from "./zip-writer.js"; | ||
@@ -132,3 +136,7 @@ | ||
ERR_INVALID_COMMENT, | ||
ERR_INVALID_ENTRY_COMMENT | ||
ERR_INVALID_ENTRY_NAME, | ||
ERR_INVALID_ENTRY_COMMENT, | ||
ERR_INVALID_VERSION, | ||
ERR_INVALID_EXTRAFIELD_TYPE, | ||
ERR_INVALID_EXTRAFIELD_DATA | ||
}; | ||
@@ -135,0 +143,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"license": "BSD-3-Clause", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"keywords": [ | ||
@@ -9,0 +9,0 @@ "zip", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
761073
95
12910