@node-projects/jszip 4.1.5 → 4.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index-min.js CHANGED
@@ -1,2 +1,2 @@
1
- var ze=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Le=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Ue=typeof Buffer<"u",Ne=typeof Uint8Array<"u",M=!1;if(typeof ArrayBuffer>"u")M=!1;else{de=new ArrayBuffer(0);try{M=new Blob([de],{type:"application/zip"}).size===0}catch{try{we=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,pe=new we,pe.append(de),M=pe.getBlob("application/zip").size===0}catch{M=!1}}}var de,we,pe,me=!1;try{me=!!ze("readable-stream").Readable}catch{me=!1}var c={base64:!0,array:!0,string:!0,arraybuffer:Le,nodebuffer:Ue,uint8array:Ne,blob:M,nodestream:me};var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function We(t){for(var e=[],r,i,s,n,o,u,h,l=0,p=t.length,m=p,v=a.getTypeOf(t)!=="string";l<t.length;)m=p-l,v?(r=t[l++],i=l<p?t[l++]:0,s=l<p?t[l++]:0):(r=t.charCodeAt(l++),i=l<p?t.charCodeAt(l++):0,s=l<p?t.charCodeAt(l++):0),n=r>>2,o=(r&3)<<4|i>>4,u=m>1?(i&15)<<2|s>>6:64,h=m>2?s&63:64,e.push(b.charAt(n)+b.charAt(o)+b.charAt(u)+b.charAt(h));return e.join("")}function Me(t){var e,r,i,s,n,o,u,h=0,l=0,p="data:";if(t.substr(0,p.length)===p)throw new Error("Invalid base64 input, it looks like a data url.");t=t.replace(/[^A-Za-z0-9+/=]/g,"");var m=t.length*3/4;if(t.charAt(t.length-1)===b.charAt(64)&&m--,t.charAt(t.length-2)===b.charAt(64)&&m--,m%1!==0)throw new Error("Invalid base64 input, bad content length.");var v;for(c.uint8array?v=new Uint8Array(m|0):v=new Array(m|0);h<t.length;)s=b.indexOf(t.charAt(h++)),n=b.indexOf(t.charAt(h++)),o=b.indexOf(t.charAt(h++)),u=b.indexOf(t.charAt(h++)),e=s<<2|n>>4,r=(n&15)<<4|o>>2,i=(o&3)<<6|u,v[l++]=e,o!==64&&(v[l++]=r),u!==64&&(v[l++]=i);return v}var K={encode:We,decode:Me};var y={isNode:typeof Buffer<"u",newBufferFrom:function(t,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(t,e);if(typeof t=="number")throw new Error('The "data" argument must not be a number');return new Buffer(t,e)},allocBuffer:function(t){if(Buffer.alloc)return Buffer.alloc(t);var e=new Buffer(t);return e.fill(0),e},isBuffer:function(t){return Buffer.isBuffer(t)},isStream:function(t){return t&&typeof t.on=="function"&&typeof t.pause=="function"&&typeof t.resume=="function"}};function je(t){var e=null;return c.uint8array?e=new Uint8Array(t.length):e=new Array(t.length),J(t,e)}function Ze(t,e){Y("blob");try{return new Blob([t],{type:e})}catch{try{var r=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,i=new r;return i.append(t),i.getBlob(e)}catch{throw new Error("Bug : can't construct the Blob.")}}}function j(t){return t}function J(t,e){for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)&255;return e}var q={stringifyByChunk:function(t,e,r){var i=[],s=0,n=t.length;if(n<=r)return String.fromCharCode.apply(null,t);for(;s<n;)e==="array"||e==="nodebuffer"?i.push(String.fromCharCode.apply(null,t.slice(s,Math.min(s+r,n)))):i.push(String.fromCharCode.apply(null,t.subarray(s,Math.min(s+r,n)))),s+=r;return i.join("")},stringifyByChar:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},applyCanBeUsed:{uint8array:(function(){try{return c.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return c.nodebuffer&&String.fromCharCode.apply(null,y.allocBuffer(1)).length===1}catch{return!1}})()}};function Z(t){var e=65536,r=B(t),i=!0;if(r==="uint8array"?i=q.applyCanBeUsed.uint8array:r==="nodebuffer"&&(i=q.applyCanBeUsed.nodebuffer),i)for(;e>1;)try{return q.stringifyByChunk(t,r,e)}catch{e=Math.floor(e/2)}return q.stringifyByChar(t)}var Ye=Z;function Q(t,e){for(var r=0;r<t.length;r++)e[r]=t[r];return e}var k={};k.string={string:j,array:function(t){return J(t,new Array(t.length))},arraybuffer:function(t){return k.string.uint8array(t).buffer},uint8array:function(t){return J(t,new Uint8Array(t.length))},nodebuffer:function(t){return J(t,y.allocBuffer(t.length))}};k.array={string:Z,array:j,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return y.newBufferFrom(t)}};k.arraybuffer={string:function(t){return Z(new Uint8Array(t))},array:function(t){return Q(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:j,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return y.newBufferFrom(new Uint8Array(t))}};k.uint8array={string:Z,array:function(t){return Q(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:j,nodebuffer:function(t){return y.newBufferFrom(t)}};k.nodebuffer={string:Z,array:function(t){return Q(t,new Array(t.length))},arraybuffer:function(t){return k.nodebuffer.uint8array(t).buffer},uint8array:function(t){return Q(t,new Uint8Array(t.length))},nodebuffer:j};function I(t,e){if(e||(e=""),!t)return e;Y(t);var r=B(e),i=k[r][t](e);return i}function He(t){for(var e=t.split("/"),r=[],i=0;i<e.length;i++){var s=e[i];s==="."||s===""&&i!==0&&i!==e.length-1||(s===".."?r.pop():r.push(s))}return r.join("/")}function B(t){if(typeof t=="string")return"string";if(Object.prototype.toString.call(t)==="[object Array]")return"array";if(c.nodebuffer&&y.isBuffer(t))return"nodebuffer";if(c.uint8array&&t instanceof Uint8Array)return"uint8array";if(c.arraybuffer&&t instanceof ArrayBuffer)return"arraybuffer"}function Y(t){var e=c[t.toLowerCase()];if(!e)throw new Error(t+" is not supported by this platform")}var Xe=65535,Ve=-1;function Ge(t){var e="",r,i;for(i=0;i<(t||"").length;i++)r=t.charCodeAt(i),e+="\\x"+(r<16?"0":"")+r.toString(16).toUpperCase();return e}function Ke(t,e,r){queueMicrotask(function(){t.apply(r||null,e||[])})}function qe(){var t={},e,r;for(e=0;e<arguments.length;e++)for(r in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],r)&&typeof t[r]>"u"&&(t[r]=arguments[e][r]);return t}function Je(t,e,r,i,s){var n=Promise.resolve(e).then(function(o){var u=c.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return u&&typeof FileReader<"u"?new Promise(function(h,l){var p=new FileReader;p.onload=function(m){h(m.target.result)},p.onerror=function(m){l(m.target.error)},p.readAsArrayBuffer(o)}):o});return n.then(function(o){var u=B(o);return u?(u==="arraybuffer"?o=I("uint8array",o):u==="string"&&(s?o=K.decode(o):r&&i!==!0&&(o=je(o))),o):Promise.reject(new Error("Can't read the data of '"+t+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}var a={newBlob:Ze,applyFromCharCode:Ye,transformTo:I,resolve:He,getTypeOf:B,checkSupport:Y,pretty:Ge,delay:Ke,extend:qe,prepareContent:Je,MAX_VALUE_16BITS:Xe,MAX_VALUE_32BITS:Ve};var f=class{constructor(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}push(e){this.emit("data",e)}end(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0}error(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)}on(e,r){return this._listeners[e].push(r),this}cleanUp(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]}emit(e,r){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,r)}pipe(e){return e.registerPrevious(this)}registerPrevious(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var r=this;return e.on("data",function(i){r.processChunk(i)}),e.on("end",function(){r.end()}),e.on("error",function(i){r.error(i)}),this}pause(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)}resume(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e}flush(){}processChunk(e){this.push(e)}withStreamInfo(e,r){return this.extraStreamInfo[e]=r,this.mergeStreamInfo(),this}mergeStreamInfo(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])}lock(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()}toString(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};var H=new Array(256);for(A=0;A<256;A++)H[A]=A>=252?6:A>=248?5:A>=240?4:A>=224?3:A>=192?2:1;var A;H[254]=H[254]=1;var Qe=function(t){var e,r,i,s,n,o=t.length,u=0;for(s=0;s<o;s++)r=t.charCodeAt(s),(r&64512)===55296&&s+1<o&&(i=t.charCodeAt(s+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),s++)),u+=r<128?1:r<2048?2:r<65536?3:4;for(c.uint8array?e=new Uint8Array(u):e=new Array(u),n=0,s=0;n<u;s++)r=t.charCodeAt(s),(r&64512)===55296&&s+1<o&&(i=t.charCodeAt(s+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),s++)),r<128?e[n++]=r:r<2048?(e[n++]=192|r>>>6,e[n++]=128|r&63):r<65536?(e[n++]=224|r>>>12,e[n++]=128|r>>>6&63,e[n++]=128|r&63):(e[n++]=240|r>>>18,e[n++]=128|r>>>12&63,e[n++]=128|r>>>6&63,e[n++]=128|r&63);return e},$e=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+H[t[r]]>e?r:e},er=function(t){var e,r,i,s,n=t.length,o=new Array(n*2);for(r=0,e=0;e<n;){if(i=t[e++],i<128){o[r++]=i;continue}if(s=H[i],s>4){o[r++]=65533,e+=s-1;continue}for(i&=s===2?31:s===3?15:7;s>1&&e<n;)i=i<<6|t[e++]&63,s--;if(s>1){o[r++]=65533;continue}i<65536?o[r++]=i:(i-=65536,o[r++]=55296|i>>10&1023,o[r++]=56320|i&1023)}return o.length!==r&&(o.subarray?o=o.subarray(0,r):o.length=r),a.applyFromCharCode(o)};function Ee(t){return c.nodebuffer?y.newBufferFrom(t,"utf-8"):Qe(t)}function xe(t){return c.nodebuffer?a.transformTo("nodebuffer",t).toString("utf-8"):(t=a.transformTo(c.uint8array?"uint8array":"array",t),er(t))}var ge=class extends f{constructor(){super("utf-8 decode"),this.leftOver=null}processChunk(e){var r=a.transformTo(c.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(c.uint8array){var i=r;r=new Uint8Array(i.length+this.leftOver.length),r.set(this.leftOver,0),r.set(i,this.leftOver.length)}else r=this.leftOver.concat(r);this.leftOver=null}var s=$e(r),n=r;s!==r.length&&(c.uint8array?(n=r.subarray(0,s),this.leftOver=r.subarray(s,r.length)):(n=r.slice(0,s),this.leftOver=r.slice(s,r.length))),this.push({data:xe(n),meta:e.meta})}flush(){this.leftOver&&this.leftOver.length&&(this.push({data:xe(this.leftOver),meta:{}}),this.leftOver=null)}},ye=class extends f{constructor(){super("utf-8 encode")}processChunk(e){this.push({data:Ee(e.data),meta:e.meta})}},x={utf8encode:Ee,utf8decode:xe,Utf8DecodeWorker:ge,Utf8EncodeWorker:ye};import tr from"pako";var rr=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",ir=rr?"uint8array":"array",sr="\b\0",$=class extends f{constructor(e,r){super("FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=r,this.meta={}}processChunk(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(ir,e.data),!1)}flush(){f.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)}cleanUp(){f.prototype.cleanUp.call(this),this._pako=null}_createPako(){this._pako=new tr[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(r){e.push({data:r,meta:e.meta})}}};function nr(t){return new $("Deflate",t)}function or(){return new $("Inflate",{})}var be={magic:sr,compressWorker:nr,uncompressWorker:or};var ar={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},fr=be,O={STORE:ar,DEFLATE:fr};function hr(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}var Ae=hr();function ur(t,e,r,i){var s=Ae,n=i+r;t=t^-1;for(var o=i;o<n;o++)t=t>>>8^s[(t^e[o])&255];return t^-1}function lr(t,e,r,i){var s=Ae,n=i+r;t=t^-1;for(var o=i;o<n;o++)t=t>>>8^s[(t^e.charCodeAt(o))&255];return t^-1}function _(t,e){if(typeof t>"u"||!t.length)return 0;var r=a.getTypeOf(t)!=="string";return r?ur(e|0,t,t.length,0):lr(e|0,t,t.length,0)}var cr="PK",dr="PK",pr="PK",mr="PK\x07",xr="PK",gr="PK\x07\b",g={LOCAL_FILE_HEADER:cr,CENTRAL_FILE_HEADER:dr,CENTRAL_DIRECTORY_END:pr,ZIP64_CENTRAL_DIRECTORY_LOCATOR:mr,ZIP64_CENTRAL_DIRECTORY_END:xr,DATA_DESCRIPTOR:gr};var d=function(t,e){var r="",i;for(i=0;i<e;i++)r+=String.fromCharCode(t&255),t=t>>>8;return r},yr=function(t,e){var r=t;return t||(r=e?16893:33204),(r&65535)<<16},vr=function(t){return(t||0)&63},_e=function(t,e,r,i,s,n){var o=t.file,u=t.compression,h=n!==x.utf8encode,l=a.transformTo("string",n(o.name)),p=a.transformTo("string",x.utf8encode(o.name)),m=o.comment,v=a.transformTo("string",n(m)),ve=a.transformTo("string",x.utf8encode(m)),Ce=p.length!==o.name.length,Se=ve.length!==m.length,w,E,W="",fe="",he="",ue=o.dir,T=o.date,D={crc32:0,compressedSize:0,uncompressedSize:0};(!e||r)&&(D.crc32=t.crc32,D.compressedSize=t.compressedSize,D.uncompressedSize=t.uncompressedSize);var le=0;e&&(le|=8),!h&&(Ce||Se)&&(le|=2048);var G=0,ce=0;ue&&(G|=16),s==="UNIX"?(ce=798,G|=yr(o.unixPermissions,ue)):(ce=20,G|=vr(o.dosPermissions,ue)),w=T.getUTCHours(),w=w<<6,w=w|T.getUTCMinutes(),w=w<<5,w=w|T.getUTCSeconds()/2,E=T.getUTCFullYear()-1980,E=E<<4,E=E|T.getUTCMonth()+1,E=E<<5,E=E|T.getUTCDate(),Ce&&(fe=d(1,1)+d(_(l),4)+p,W+="up"+d(fe.length,2)+fe),Se&&(he=d(1,1)+d(_(v),4)+ve,W+="uc"+d(he.length,2)+he);var C="";C+=`
2
- \0`,C+=d(le,2),C+=u.magic,C+=d(w,2),C+=d(E,2),C+=d(D.crc32,4),C+=d(D.compressedSize,4),C+=d(D.uncompressedSize,4),C+=d(l.length,2),C+=d(W.length,2);var Re=g.LOCAL_FILE_HEADER+C+l+W,Pe=g.CENTRAL_FILE_HEADER+d(ce,2)+C+d(v.length,2)+"\0\0\0\0"+d(G,4)+d(i,4)+l+W+v;return{fileRecord:Re,dirRecord:Pe}},Cr=function(t,e,r,i,s){var n="",o=a.transformTo("string",s(i));return n=g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+d(t,2)+d(t,2)+d(e,4)+d(r,4)+d(o.length,2)+o,n},Sr=function(t){var e="";return e=g.DATA_DESCRIPTOR+d(t.crc32,4)+d(t.compressedSize,4)+d(t.uncompressedSize,4),e},ee=class extends f{constructor(e,r,i,s){super("ZipFileWorker"),this.bytesWritten=0,this.zipComment=r,this.zipPlatform=i,this.encodeFileName=s,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}push(e){var r=e.meta.percent||0,i=this.entriesCount,s=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,f.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(r+100*(i-s-1))/i:100}}))}openedSource(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var r=this.streamFiles&&!e.file.dir;if(r){var i=_e(e,r,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0}closedSource(e){this.accumulate=!1;var r=this.streamFiles&&!e.file.dir,i=_e(e,r,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),r)this.push({data:Sr(e),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null}flush(){for(var e=this.bytesWritten,r=0;r<this.dirRecords.length;r++)this.push({data:this.dirRecords[r],meta:{percent:100}});var i=this.bytesWritten-e,s=Cr(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:s,meta:{percent:100}})}prepareNextSource(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()}registerPrevious(e){this._sources.push(e);var r=this;return e.on("data",function(i){r.processChunk(i)}),e.on("end",function(){r.closedSource(r.previous.streamInfo),r._sources.length?r.prepareNextSource():r.end()}),e.on("error",function(i){r.error(i)}),this}resume(){if(!f.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0}error(e){var r=this._sources;if(!f.prototype.error.call(this,e))return!1;for(var i=0;i<r.length;i++)try{r[i].error(e)}catch{}return!0}lock(){f.prototype.lock.call(this);for(var e=this._sources,r=0;r<e.length;r++)e[r].lock()}};var wr=function(t,e){var r=t||e,i=O[r];if(!i)throw new Error(r+" is not a valid compression method !");return i};function Er(t,e,r){var i=new ee(e.streamFiles,r,e.platform,e.encodeFileName),s=0;try{t.forEach(function(n,o){s++;var u=wr(o.options.compression,e.compression),h=o.options.compressionOptions||e.compressionOptions||{},l=o.dir,p=o.date;o._compressWorker(u,h).withStreamInfo("file",{name:n,dir:l,date:p,comment:o.comment||"",unixPermissions:o.unixPermissions,dosPermissions:o.dosPermissions}).pipe(i)}),i.entriesCount=s}catch(n){i.error(n)}return i}var ke={generateWorker:Er};var re=class extends f{constructor(e){super("ConvertWorker to "+e),this.destType=e}processChunk(e){this.push({data:a.transformTo(this.destType,e.data),meta:e.meta})}};function br(t,e,r){switch(t){case"blob":return a.newBlob(a.transformTo("arraybuffer",e),r);case"base64":return K.encode(e);default:return a.transformTo(t,e)}}function Ar(t,e){var r,i=0,s=null,n=0;for(r=0;r<e.length;r++)n+=e[r].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(s=new Uint8Array(n),r=0;r<e.length;r++)s.set(e[r],i),i+=e[r].length;return s;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}function _r(t,e){return new Promise(function(r,i){var s=[],n=t._internalType,o=t._outputType,u=t._mimeType;t.on("data",function(h,l){s.push(h),e&&e(l)}).on("error",function(h){s=[],i(h)}).on("end",function(){try{var h=br(o,Ar(n,s),u);r(h)}catch(l){i(l)}s=[]}).resume()})}var R=class{constructor(e,r,i){var s=r;switch(r){case"blob":case"arraybuffer":s="uint8array";break;case"base64":s="string";break}try{this._internalType=s,this._outputType=r,this._mimeType=i,a.checkSupport(s),this._worker=e.pipe(new re(s)),e.lock()}catch(n){this._worker=new f("error"),this._worker.error(n)}}accumulate(e){return _r(this,e)}on(e,r){var i=this;return e==="data"?this._worker.on(e,function(s){r.call(i,s.data,s.meta)}):this._worker.on(e,function(){a.delay(r,arguments,i)}),this}resume(){return a.delay(this._worker.resume,[],this._worker),this}pause(){return this._worker.pause(),this}toNodejsStream(e){if(a.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new NodejsStreamOutputAdapter(this,{objectMode:this._outputType!=="nodebuffer"},e)}};var X={base64:!1,binary:!1,dir:!1,createFolders:!0,date:null,compression:null,compressionOptions:null,comment:null,unixPermissions:null,dosPermissions:null};var kr=16*1024,F=class extends f{constructor(e){super("DataWorker");var r=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(i){r.dataIsReady=!0,r.data=i,r.max=i&&i.length||0,r.type=a.getTypeOf(i),r.isPaused||r._tickAndRepeat()},function(i){r.error(i)})}cleanUp(){f.prototype.cleanUp.call(this),this.data=null}resume(){return f.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,a.delay(this._tickAndRepeat,[],this)),!0):!1}_tickAndRepeat(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(a.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))}_tick(){if(this.isPaused||this.isFinished)return!1;var e=kr,r=null,i=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":r=this.data.substring(this.index,i);break;case"uint8array":r=this.data.subarray(this.index,i);break;case"array":case"nodebuffer":r=this.data.slice(this.index,i);break}return this.index=i,this.push({data:r,meta:{percent:this.max?this.index/this.max*100:0}})}};var P=class extends f{constructor(){super("Crc32Probe"),this.withStreamInfo("crc32",0)}processChunk(e){this.streamInfo.crc32=_(e.data,this.streamInfo.crc32||0),this.push(e)}};var z=class extends f{constructor(e){super("DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}processChunk(e){if(e){var r=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=r+e.data.length}f.prototype.processChunk.call(this,e)}};var S=class{constructor(e,r,i,s,n){this.compressedSize=e,this.uncompressedSize=r,this.crc32=i,this.compression=s,this.compressedContent=n}getContentWorker(){var e=new F(Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new z("data_length")),r=this;return e.on("end",function(){if(this.streamInfo.data_length!==r.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e}getCompressedWorker(){return new F(Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}static createWorkerFrom(e,r,i){return e.pipe(new P).pipe(new z("uncompressedSize")).pipe(r.compressWorker(i)).pipe(new z("compressedSize")).withStreamInfo("compression",r)}};var te=class{constructor(e,r,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=r,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}internalStream(e){var r=null,i="string";try{if(!e)throw new Error("No output type specified.");i=e.toLowerCase();var s=i==="string"||i==="text";(i==="binarystring"||i==="text")&&(i="string"),r=this._decompressWorker();var n=!this._dataBinary;n&&!s&&(r=r.pipe(new x.Utf8EncodeWorker)),!n&&s&&(r=r.pipe(new x.Utf8DecodeWorker))}catch(o){r=new f("error"),r.error(o)}return new R(r,i,"")}async(e,r){return this.internalStream(e).accumulate(r)}nodeStream(e,r){return this.internalStream(e||"nodebuffer").toNodejsStream(r)}_compressWorker(e,r){if(this._data instanceof S&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new x.Utf8EncodeWorker)),S.createWorkerFrom(i,e,r)}_decompressWorker(){return this._data instanceof S?this._data.getContentWorker():this._data instanceof f?this._data:new F(this._data)}};var ie=class extends f{constructor(e,r){super("Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(r)}_bindStream(e){var r=this;this._stream=e,e.pause(),e.on("data",function(i){r.push({data:i,meta:{percent:0}})}).on("error",function(i){r.isPaused?this.generatedError=i:r.error(i)}).on("end",function(){r.isPaused?r._upstreamEnded=!0:r.end()})}pause(){return f.prototype.pause.call(this)?(this._stream.pause(),!0):!1}resume(){return f.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1}};var Oe=function(t,e,r){var i=a.getTypeOf(e),s,n=a.extend(r||{},X);n.date=n.date||new Date,n.compression!==null&&(n.compression=n.compression.toUpperCase()),typeof n.unixPermissions=="string"&&(n.unixPermissions=parseInt(n.unixPermissions,8)),n.unixPermissions&&n.unixPermissions&16384&&(n.dir=!0),n.dosPermissions&&n.dosPermissions&16&&(n.dir=!0),n.dir&&(t=Fe(t)),n.createFolders&&(s=Ir(t))&&Te.call(this,s,!0);var o=i==="string"&&n.binary===!1&&n.base64===!1;(!r||typeof r.binary>"u")&&(n.binary=!o);var u=e instanceof S&&e.uncompressedSize===0;(u||n.dir||!e||e.length===0)&&(n.base64=!1,n.binary=!0,e="",n.compression="STORE",i="string");var h=null;e instanceof S||e instanceof f?h=e:y.isNode&&y.isStream(e)?h=new ie(t,e):h=a.prepareContent(t,e,n.binary,n.optimizedBinaryString,n.base64);var l=new te(t,h,n);this.files[t]=l},Ir=function(t){t.slice(-1)==="/"&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return e>0?t.substring(0,e):""},Fe=function(t){return t.slice(-1)!=="/"&&(t+="/"),t},Te=function(t,e){return e=typeof e<"u"?e:X.createFolders,t=Fe(t),this.files[t]||Oe.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function Ie(t){return Object.prototype.toString.call(t)==="[object RegExp]"}var V=class{forEach(e){var r,i,s;for(r in this.files)s=this.files[r],i=r.slice(this.root.length,r.length),i&&r.slice(0,this.root.length)===this.root&&e(i,s)}filter(e){var r=[];return this.forEach(function(i,s){e(i,s)&&r.push(s)}),r}file(e,r,i){if(arguments.length===1)if(Ie(e)){var s=e;return this.filter(function(o,u){return!u.dir&&s.test(o)})}else{var n=this.files[this.root+e];return n&&!n.dir?n:null}else e=this.root+e,Oe.call(this,e,r,i);return this}folder(e){if(!e)return this;if(Ie(e))return this.filter(function(n,o){return o.dir&&e.test(n)});var r=this.root+e,i=Te.call(this,r),s=this.clone();return s.root=i.name,s}remove(e){e=this.root+e;var r=this.files[e];if(r||(e.slice(-1)!=="/"&&(e+="/"),r=this.files[e]),r&&!r.dir)delete this.files[e];else for(var i=this.filter(function(n,o){return o.name.slice(0,e.length)===e}),s=0;s<i.length;s++)delete this.files[i[s].name];return this}generate(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")}generateInternalStream(e){var r,i={};try{if(i=a.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:x.utf8encode}),i.type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),i.type==="binarystring"&&(i.type="string"),!i.type)throw new Error("No output type specified.");a.checkSupport(i.type),(i.platform==="darwin"||i.platform==="freebsd"||i.platform==="linux"||i.platform==="sunos")&&(i.platform="UNIX"),i.platform==="win32"&&(i.platform="DOS");var s=i.comment||this.comment||"";r=ke.generateWorker(this,i,s)}catch(n){r=new f("error"),r.error(n)}return new R(r,i.type||"string",i.mimeType)}generateAsync(e,r){return this.generateInternalStream(e).accumulate(r)}generateNodeStream(e,r){return e=e||{},e.type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(r)}};var L=class{constructor(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}checkOffset(e){this.checkIndex(this.index+e)}checkIndex(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")}setIndex(e){this.checkIndex(e),this.index=e}skip(e){this.setIndex(this.index+e)}byteAt(){}readInt(e){var r=0,i;for(this.checkOffset(e),i=this.index+e-1;i>=this.index;i--)r=r*256+this.byteAt(i);return this.index+=e,r}readIntUnsafe(e){var r=0,i;for(this.checkOffset(e),i=this.index+e-1;i>=this.index;i--)r=(r<<8)+this.byteAt(i);return this.index+=e,r}readString(e){return I("string",this.readData(e))}readData(){}lastIndexOfSignature(){}readAndCheckSignature(){}readDate(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1))}};var U=class extends L{constructor(e){super(e);for(var r=0;r<this.data.length;r++)e[r]=e[r]&255}byteAt(e){return this.data[this.zero+e]}lastIndexOfSignature(e){for(var r=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),o=this.length-4;o>=0;--o)if(this.data[o]===r&&this.data[o+1]===i&&this.data[o+2]===s&&this.data[o+3]===n)return o-this.zero;return-1}readAndCheckSignature(e){var r=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),o=this.readData(4);return r===o[0]&&i===o[1]&&s===o[2]&&n===o[3]}readData(e){if(this.checkOffset(e),e===0)return[];var r=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,r}};var se=class extends L{constructor(e){super(e)}byteAt(e){return this.data.charCodeAt(this.zero+e)}lastIndexOfSignature(e){return this.data.lastIndexOf(e)-this.zero}readAndCheckSignature(e){var r=this.readData(4);return e===r}readData(e){this.checkOffset(e);var r=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,r}};var ne=class extends U{constructor(e){super(e)}readData(e){if(this.checkOffset(e),e===0)return new Uint8Array(0);var r=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,r}};function N(t){var e=B(t);return Y(e),e==="string"&&!c.uint8array?new se(t):c.uint8array?new ne(I("uint8array",t)):new U(I("array",t))}var Or=0,Fr=3,Tr=function(t){for(var e in O)if(Object.prototype.hasOwnProperty.call(O,e)&&O[e].magic===t)return O[e];return null},oe=class{constructor(e,r){this.options=e,this.loadOptions=r}isEncrypted(){return(this.bitFlag&1)===1}useUTF8(){return(this.bitFlag&2048)===2048}readLocalPart(e){var r,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(r=Tr(this.compressionMethod),r===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new S(this.compressedSize,this.uncompressedSize,this.crc32,r,e.readData(this.compressedSize))}readCentralPart(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readIntUnsafe(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var r=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(r),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)}processAttributes(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),e===Or&&(this.dosPermissions=this.externalFileAttributes&63),e===Fr&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)}parseZIP64ExtraField(){if(this.extraFields[1]){var e=N(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}}readExtraFields(e){var r=e.index+this.extraFieldsLength,i,s,n;for(this.extraFields||(this.extraFields={});e.index+4<r;)i=e.readInt(2),s=e.readInt(2),n=e.readData(s),this.extraFields[i]={id:i,length:s,value:n};e.setIndex(r)}handleUTF8(){var e=c.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=x.utf8decode(this.fileName),this.fileCommentStr=x.utf8decode(this.fileComment);else{var r=this.findExtraFieldUnicodePath();if(r!==null)this.fileNameStr=r;else{var i=a.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var s=this.findExtraFieldUnicodeComment();if(s!==null)this.fileCommentStr=s;else{var n=a.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n)}}}findExtraFieldUnicodePath(){var e=this.extraFields[28789];if(e){var r=N(e.value);return r.readInt(1)!==1||_(this.fileName)!==r.readInt(4)?null:x.utf8decode(r.readData(e.length-5))}return null}findExtraFieldUnicodeComment(){var e=this.extraFields[25461];if(e){var r=N(e.value);return r.readInt(1)!==1||_(this.fileComment)!==r.readInt(4)?null:x.utf8decode(r.readData(e.length-5))}return null}};var ae=class{constructor(e){this.files=[],this.loadOptions=e}checkSignature(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var r=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(r)+", expected "+a.pretty(e)+")")}}isSignature(e,r){var i=this.reader.index;this.reader.setIndex(e);var s=this.reader.readString(4),n=s===r;return this.reader.setIndex(i),n}readBlockEndOfCentral(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),r=c.uint8array?"uint8array":"array",i=a.transformTo(r,e);this.zipComment=this.loadOptions.decodeFileName(i)}readBlockZip64EndOfCentral(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,r=0,i,s,n;r<e;)i=this.reader.readInt(2),s=this.reader.readInt(4),n=this.reader.readData(s),this.zip64ExtensibleData[i]={id:i,length:s,value:n}}readBlockZip64EndOfCentralLocator(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")}readLocalFiles(){var e,r;for(e=0;e<this.files.length;e++)r=this.files[e],this.reader.setIndex(r.localHeaderOffset),this.checkSignature(g.LOCAL_FILE_HEADER),r.readLocalPart(this.reader),r.handleUTF8(),r.processAttributes()}readCentralDir(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(g.CENTRAL_FILE_HEADER);)e=new oe({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)}readEndOfCentral(){var e=this.reader.lastIndexOfSignature(g.CENTRAL_DIRECTORY_END);if(e<0){var r=!this.isSignature(0,g.LOCAL_FILE_HEADER);throw r?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(e);var i=e;if(this.checkSignature(g.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(g.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(g.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,g.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(g.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(g.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var s=this.centralDirOffset+this.centralDirSize;this.zip64&&(s+=20,s+=12+this.zip64EndOfCentralSize);var n=i-s;if(n>0)this.isSignature(i,g.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")}prepareReader(e){this.reader=N(e)}load(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};function Dr(t){return new Promise(function(e,r){var i=t.decompressed.getContentWorker().pipe(new P);i.on("error",function(s){r(s)}).on("end",function(){i.streamInfo.crc32!==t.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}function De(t,e,r){return r=a.extend(r||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:x.utf8decode}),y.isNode&&y.isStream(e)?Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):a.prepareContent("the loaded zip file",e,!0,r.optimizedBinaryString,r.base64).then(function(i){var s=new ae(r);return s.load(i),s}).then(function(s){var n=[Promise.resolve(s)],o=s.files;if(r.checkCRC32)for(var u=0;u<o.length;u++)n.push(Dr(o[u]));return Promise.all(n)}).then(function(s){for(var n=s.shift(),o=n.files,u=0;u<o.length;u++){var h=o[u],l=h.fileNameStr,p=a.resolve(h.fileNameStr);t.file(p,h.decompressed,{binary:!0,optimizedBinaryString:!0,date:h.date,dir:h.dir,comment:h.fileCommentStr.length?h.fileCommentStr:null,unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions,createFolders:r.createFolders}),h.dir||(t.file(p).unsafeOriginalName=l)}return n.zipComment.length&&(t.comment=n.zipComment),t})}var Be=class t extends V{constructor(){if(super(),!(this instanceof t))return new t;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new t;for(var r in this)typeof this[r]!="function"&&(e[r]=this[r]);return e}}static support=c;static defaults=X;static version="4.1.1";loadAsync(e,r){return De(this,e,r)}static loadAsync(e,r){return new t().loadAsync(e,r)}};export{Be as JSZip};
1
+ var Le=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var ze=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",Ue=typeof Buffer<"u",Ne=typeof Uint8Array<"u",M=!1;if(typeof ArrayBuffer>"u")M=!1;else{de=new ArrayBuffer(0);try{M=new Blob([de],{type:"application/zip"}).size===0}catch{try{Ee=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,pe=new Ee,pe.append(de),M=pe.getBlob("application/zip").size===0}catch{M=!1}}}var de,Ee,pe,me=!1;try{me=!!Le("readable-stream").Readable}catch{me=!1}var c={base64:!0,array:!0,string:!0,arraybuffer:ze,nodebuffer:Ue,uint8array:Ne,blob:M,nodestream:me};var _="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function We(t){for(var e=[],r,i,s,n,o,u,h,l=0,p=t.length,m=p,v=a.getTypeOf(t)!=="string";l<t.length;)m=p-l,v?(r=t[l++],i=l<p?t[l++]:0,s=l<p?t[l++]:0):(r=t.charCodeAt(l++),i=l<p?t.charCodeAt(l++):0,s=l<p?t.charCodeAt(l++):0),n=r>>2,o=(r&3)<<4|i>>4,u=m>1?(i&15)<<2|s>>6:64,h=m>2?s&63:64,e.push(_.charAt(n)+_.charAt(o)+_.charAt(u)+_.charAt(h));return e.join("")}function Me(t){var e,r,i,s,n,o,u,h=0,l=0,p="data:";if(t.substr(0,p.length)===p)throw new Error("Invalid base64 input, it looks like a data url.");t=t.replace(/[^A-Za-z0-9+/=]/g,"");var m=t.length*3/4;if(t.charAt(t.length-1)===_.charAt(64)&&m--,t.charAt(t.length-2)===_.charAt(64)&&m--,m%1!==0)throw new Error("Invalid base64 input, bad content length.");var v;for(c.uint8array?v=new Uint8Array(m|0):v=new Array(m|0);h<t.length;)s=_.indexOf(t.charAt(h++)),n=_.indexOf(t.charAt(h++)),o=_.indexOf(t.charAt(h++)),u=_.indexOf(t.charAt(h++)),e=s<<2|n>>4,r=(n&15)<<4|o>>2,i=(o&3)<<6|u,v[l++]=e,o!==64&&(v[l++]=r),u!==64&&(v[l++]=i);return v}var K={encode:We,decode:Me};var y={isNode:typeof Buffer<"u",newBufferFrom:function(t,e){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(t,e);if(typeof t=="number")throw new Error('The "data" argument must not be a number');return new Buffer(t,e)},allocBuffer:function(t){if(Buffer.alloc)return Buffer.alloc(t);var e=new Buffer(t);return e.fill(0),e},isBuffer:function(t){return Buffer.isBuffer(t)},isStream:function(t){return t&&typeof t.on=="function"&&typeof t.pause=="function"&&typeof t.resume=="function"}};function je(t){var e=null;return c.uint8array?e=new Uint8Array(t.length):e=new Array(t.length),J(t,e)}function Ze(t,e){X("blob");try{return new Blob([t],{type:e})}catch{try{var r=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,i=new r;return i.append(t),i.getBlob(e)}catch{throw new Error("Bug : can't construct the Blob.")}}}function j(t){return t}function J(t,e){for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)&255;return e}var q={stringifyByChunk:function(t,e,r){var i=[],s=0,n=t.length;if(n<=r)return String.fromCharCode.apply(null,t);for(;s<n;)e==="array"||e==="nodebuffer"?i.push(String.fromCharCode.apply(null,t.slice(s,Math.min(s+r,n)))):i.push(String.fromCharCode.apply(null,t.subarray(s,Math.min(s+r,n)))),s+=r;return i.join("")},stringifyByChar:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},applyCanBeUsed:{uint8array:(function(){try{return c.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return c.nodebuffer&&String.fromCharCode.apply(null,y.allocBuffer(1)).length===1}catch{return!1}})()}};function Z(t){var e=65536,r=B(t),i=!0;if(r==="uint8array"?i=q.applyCanBeUsed.uint8array:r==="nodebuffer"&&(i=q.applyCanBeUsed.nodebuffer),i)for(;e>1;)try{return q.stringifyByChunk(t,r,e)}catch{e=Math.floor(e/2)}return q.stringifyByChar(t)}var Xe=Z;function Q(t,e){for(var r=0;r<t.length;r++)e[r]=t[r];return e}var I={};I.string={string:j,array:function(t){return J(t,new Array(t.length))},arraybuffer:function(t){return I.string.uint8array(t).buffer},uint8array:function(t){return J(t,new Uint8Array(t.length))},nodebuffer:function(t){return J(t,y.allocBuffer(t.length))}};I.array={string:Z,array:j,arraybuffer:function(t){return new Uint8Array(t).buffer},uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return y.newBufferFrom(t)}};I.arraybuffer={string:function(t){return Z(new Uint8Array(t))},array:function(t){return Q(new Uint8Array(t),new Array(t.byteLength))},arraybuffer:j,uint8array:function(t){return new Uint8Array(t)},nodebuffer:function(t){return y.newBufferFrom(new Uint8Array(t))}};I.uint8array={string:Z,array:function(t){return Q(t,new Array(t.length))},arraybuffer:function(t){return t.buffer},uint8array:j,nodebuffer:function(t){return y.newBufferFrom(t)}};I.nodebuffer={string:Z,array:function(t){return Q(t,new Array(t.length))},arraybuffer:function(t){return I.nodebuffer.uint8array(t).buffer},uint8array:function(t){return Q(t,new Uint8Array(t.length))},nodebuffer:j};function k(t,e){if(e||(e=""),!t)return e;X(t);var r=B(e),i=I[r][t](e);return i}function Ve(t){for(var e=t.split("/"),r=[],i=0;i<e.length;i++){var s=e[i];s==="."||s===""&&i!==0&&i!==e.length-1||(s===".."?r.pop():r.push(s))}return r.join("/")}function B(t){if(typeof t=="string")return"string";if(Object.prototype.toString.call(t)==="[object Array]")return"array";if(c.nodebuffer&&y.isBuffer(t))return"nodebuffer";if(c.uint8array&&t instanceof Uint8Array)return"uint8array";if(c.arraybuffer&&t instanceof ArrayBuffer)return"arraybuffer"}function X(t){var e=c[t.toLowerCase()];if(!e)throw new Error(t+" is not supported by this platform")}var Ye=65535,He=-1,Ge=4294967295;function Ke(t){var e="",r,i;for(i=0;i<(t||"").length;i++)r=t.charCodeAt(i),e+="\\x"+(r<16?"0":"")+r.toString(16).toUpperCase();return e}function qe(t,e,r){queueMicrotask(function(){t.apply(r||null,e||[])})}function Je(){var t={},e,r;for(e=0;e<arguments.length;e++)for(r in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],r)&&typeof t[r]>"u"&&(t[r]=arguments[e][r]);return t}function Qe(t,e,r,i,s){var n=Promise.resolve(e).then(function(o){var u=c.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return u&&typeof FileReader<"u"?new Promise(function(h,l){var p=new FileReader;p.onload=function(m){h(m.target.result)},p.onerror=function(m){l(m.target.error)},p.readAsArrayBuffer(o)}):o});return n.then(function(o){var u=B(o);return u?(u==="arraybuffer"?o=k("uint8array",o):u==="string"&&(s?o=K.decode(o):r&&i!==!0&&(o=je(o))),o):Promise.reject(new Error("Can't read the data of '"+t+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}var a={newBlob:Ze,applyFromCharCode:Xe,transformTo:k,resolve:Ve,getTypeOf:B,checkSupport:X,pretty:Ke,delay:qe,extend:Je,prepareContent:Qe,MAX_VALUE_16BITS:Ye,MAX_VALUE_32BITS:He,REAL_MAX_VALUE_32BITS:Ge};var f=class{constructor(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}push(e){this.emit("data",e)}end(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0}error(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)}on(e,r){return this._listeners[e].push(r),this}cleanUp(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]}emit(e,r){if(this._listeners[e])for(var i=0;i<this._listeners[e].length;i++)this._listeners[e][i].call(this,r)}pipe(e){return e.registerPrevious(this)}registerPrevious(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var r=this;return e.on("data",function(i){r.processChunk(i)}),e.on("end",function(){r.end()}),e.on("error",function(i){r.error(i)}),this}pause(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)}resume(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e}flush(){}processChunk(e){this.push(e)}withStreamInfo(e,r){return this.extraStreamInfo[e]=r,this.mergeStreamInfo(),this}mergeStreamInfo(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])}lock(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()}toString(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};var V=new Array(256);for(w=0;w<256;w++)V[w]=w>=252?6:w>=248?5:w>=240?4:w>=224?3:w>=192?2:1;var w;V[254]=V[254]=1;var $e=function(t){var e,r,i,s,n,o=t.length,u=0;for(s=0;s<o;s++)r=t.charCodeAt(s),(r&64512)===55296&&s+1<o&&(i=t.charCodeAt(s+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),s++)),u+=r<128?1:r<2048?2:r<65536?3:4;for(c.uint8array?e=new Uint8Array(u):e=new Array(u),n=0,s=0;n<u;s++)r=t.charCodeAt(s),(r&64512)===55296&&s+1<o&&(i=t.charCodeAt(s+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),s++)),r<128?e[n++]=r:r<2048?(e[n++]=192|r>>>6,e[n++]=128|r&63):r<65536?(e[n++]=224|r>>>12,e[n++]=128|r>>>6&63,e[n++]=128|r&63):(e[n++]=240|r>>>18,e[n++]=128|r>>>12&63,e[n++]=128|r>>>6&63,e[n++]=128|r&63);return e},er=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+V[t[r]]>e?r:e},rr=function(t){var e,r,i,s,n=t.length,o=new Array(n*2);for(r=0,e=0;e<n;){if(i=t[e++],i<128){o[r++]=i;continue}if(s=V[i],s>4){o[r++]=65533,e+=s-1;continue}for(i&=s===2?31:s===3?15:7;s>1&&e<n;)i=i<<6|t[e++]&63,s--;if(s>1){o[r++]=65533;continue}i<65536?o[r++]=i:(i-=65536,o[r++]=55296|i>>10&1023,o[r++]=56320|i&1023)}return o.length!==r&&(o.subarray?o=o.subarray(0,r):o.length=r),a.applyFromCharCode(o)};function Ae(t){return c.nodebuffer?y.newBufferFrom(t,"utf-8"):$e(t)}function xe(t){return c.nodebuffer?a.transformTo("nodebuffer",t).toString("utf-8"):(t=a.transformTo(c.uint8array?"uint8array":"array",t),rr(t))}var ge=class extends f{constructor(){super("utf-8 decode"),this.leftOver=null}processChunk(e){var r=a.transformTo(c.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(c.uint8array){var i=r;r=new Uint8Array(i.length+this.leftOver.length),r.set(this.leftOver,0),r.set(i,this.leftOver.length)}else r=this.leftOver.concat(r);this.leftOver=null}var s=er(r),n=r;s!==r.length&&(c.uint8array?(n=r.subarray(0,s),this.leftOver=r.subarray(s,r.length)):(n=r.slice(0,s),this.leftOver=r.slice(s,r.length))),this.push({data:xe(n),meta:e.meta})}flush(){this.leftOver&&this.leftOver.length&&(this.push({data:xe(this.leftOver),meta:{}}),this.leftOver=null)}},ye=class extends f{constructor(){super("utf-8 encode")}processChunk(e){this.push({data:Ae(e.data),meta:e.meta})}},x={utf8encode:Ae,utf8decode:xe,Utf8DecodeWorker:ge,Utf8EncodeWorker:ye};import ir from"pako";var tr=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",sr=tr?"uint8array":"array",nr="\b\0",$=class extends f{constructor(e,r){super("FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=r,this.meta={}}processChunk(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(sr,e.data),!1)}flush(){f.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)}cleanUp(){f.prototype.cleanUp.call(this),this._pako=null}_createPako(){this._pako=new ir[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(r){e.push({data:r,meta:e.meta})}}};function or(t){return new $("Deflate",t)}function ar(){return new $("Inflate",{})}var _e={magic:nr,compressWorker:or,uncompressWorker:ar};var fr={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},hr=_e,O={STORE:fr,DEFLATE:hr};function ur(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}var we=ur();function lr(t,e,r,i){var s=we,n=i+r;t=t^-1;for(var o=i;o<n;o++)t=t>>>8^s[(t^e[o])&255];return t^-1}function cr(t,e,r,i){var s=we,n=i+r;t=t^-1;for(var o=i;o<n;o++)t=t>>>8^s[(t^e.charCodeAt(o))&255];return t^-1}function b(t,e){if(typeof t>"u"||!t.length)return 0;var r=a.getTypeOf(t)!=="string";return r?lr(e|0,t,t.length,0):cr(e|0,t,t.length,0)}var dr="PK",pr="PK",mr="PK",xr="PK\x07",gr="PK",yr="PK\x07\b",g={LOCAL_FILE_HEADER:dr,CENTRAL_FILE_HEADER:pr,CENTRAL_DIRECTORY_END:mr,ZIP64_CENTRAL_DIRECTORY_LOCATOR:xr,ZIP64_CENTRAL_DIRECTORY_END:gr,DATA_DESCRIPTOR:yr};var d=function(t,e){var r="",i;for(i=0;i<e;i++)r+=String.fromCharCode(t&255),t=t>>>8;return r},vr=function(t,e){var r=t;return t||(r=e?16893:33204),(r&65535)<<16},Cr=function(t){return(t||0)&63},be=function(t,e,r,i,s,n){var o=t.file,u=t.compression,h=n!==x.utf8encode,l=a.transformTo("string",n(o.name)),p=a.transformTo("string",x.utf8encode(o.name)),m=o.comment,v=a.transformTo("string",n(m)),ve=a.transformTo("string",x.utf8encode(m)),Ce=p.length!==o.name.length,Se=ve.length!==m.length,E,A,W="",fe="",he="",ue=o.dir,T=o.date,D={crc32:0,compressedSize:0,uncompressedSize:0};(!e||r)&&(D.crc32=t.crc32,D.compressedSize=t.compressedSize,D.uncompressedSize=t.uncompressedSize);var le=0;e&&(le|=8),!h&&(Ce||Se)&&(le|=2048);var G=0,ce=0;ue&&(G|=16),s==="UNIX"?(ce=798,G|=vr(o.unixPermissions,ue)):(ce=20,G|=Cr(o.dosPermissions,ue)),E=T.getUTCHours(),E=E<<6,E=E|T.getUTCMinutes(),E=E<<5,E=E|T.getUTCSeconds()/2,A=T.getUTCFullYear()-1980,A=A<<4,A=A|T.getUTCMonth()+1,A=A<<5,A=A|T.getUTCDate(),Ce&&(fe=d(1,1)+d(b(l),4)+p,W+="up"+d(fe.length,2)+fe),Se&&(he=d(1,1)+d(b(v),4)+ve,W+="uc"+d(he.length,2)+he);var C="";C+=`
2
+ \0`,C+=d(le,2),C+=u.magic,C+=d(E,2),C+=d(A,2),C+=d(D.crc32,4),C+=d(D.compressedSize,4),C+=d(D.uncompressedSize,4),C+=d(l.length,2),C+=d(W.length,2);var Re=g.LOCAL_FILE_HEADER+C+l+W,Pe=g.CENTRAL_FILE_HEADER+d(ce,2)+C+d(v.length,2)+"\0\0\0\0"+d(G,4)+d(i,4)+l+W+v;return{fileRecord:Re,dirRecord:Pe}},Sr=function(t,e,r,i,s){var n="",o=a.transformTo("string",s(i));return n=g.CENTRAL_DIRECTORY_END+"\0\0\0\0"+d(t,2)+d(t,2)+d(e,4)+d(r,4)+d(o.length,2)+o,n},Er=function(t){var e="";return e=g.DATA_DESCRIPTOR+d(t.crc32,4)+d(t.compressedSize,4)+d(t.uncompressedSize,4),e},ee=class extends f{constructor(e,r,i,s){super("ZipFileWorker"),this.bytesWritten=0,this.zipComment=r,this.zipPlatform=i,this.encodeFileName=s,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}push(e){var r=e.meta.percent||0,i=this.entriesCount,s=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,f.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(r+100*(i-s-1))/i:100}}))}openedSource(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var r=this.streamFiles&&!e.file.dir;if(r){var i=be(e,r,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0}closedSource(e){this.accumulate=!1;var r=this.streamFiles&&!e.file.dir,i=be(e,r,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),r)this.push({data:Er(e),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null}flush(){for(var e=this.bytesWritten,r=0;r<this.dirRecords.length;r++)this.push({data:this.dirRecords[r],meta:{percent:100}});var i=this.bytesWritten-e,s=Sr(this.dirRecords.length,i,e,this.zipComment,this.encodeFileName);this.push({data:s,meta:{percent:100}})}prepareNextSource(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()}registerPrevious(e){this._sources.push(e);var r=this;return e.on("data",function(i){r.processChunk(i)}),e.on("end",function(){r.closedSource(r.previous.streamInfo),r._sources.length?r.prepareNextSource():r.end()}),e.on("error",function(i){r.error(i)}),this}resume(){if(!f.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0}error(e){var r=this._sources;if(!f.prototype.error.call(this,e))return!1;for(var i=0;i<r.length;i++)try{r[i].error(e)}catch{}return!0}lock(){f.prototype.lock.call(this);for(var e=this._sources,r=0;r<e.length;r++)e[r].lock()}};var Ar=function(t,e){var r=t||e,i=O[r];if(!i)throw new Error(r+" is not a valid compression method !");return i};function _r(t,e,r){var i=new ee(e.streamFiles,r,e.platform,e.encodeFileName),s=0;try{t.forEach(function(n,o){s++;var u=Ar(o.options.compression,e.compression),h=o.options.compressionOptions||e.compressionOptions||{},l=o.dir,p=o.date;o._compressWorker(u,h).withStreamInfo("file",{name:n,dir:l,date:p,comment:o.comment||"",unixPermissions:o.unixPermissions,dosPermissions:o.dosPermissions}).pipe(i)}),i.entriesCount=s}catch(n){i.error(n)}return i}var Ie={generateWorker:_r};var re=class extends f{constructor(e){super("ConvertWorker to "+e),this.destType=e}processChunk(e){this.push({data:a.transformTo(this.destType,e.data),meta:e.meta})}};function wr(t,e,r){switch(t){case"blob":return a.newBlob(a.transformTo("arraybuffer",e),r);case"base64":return K.encode(e);default:return a.transformTo(t,e)}}function br(t,e){var r,i=0,s=null,n=0;for(r=0;r<e.length;r++)n+=e[r].length;switch(t){case"string":return e.join("");case"array":return Array.prototype.concat.apply([],e);case"uint8array":for(s=new Uint8Array(n),r=0;r<e.length;r++)s.set(e[r],i),i+=e[r].length;return s;case"nodebuffer":return Buffer.concat(e);default:throw new Error("concat : unsupported type '"+t+"'")}}function Ir(t,e){return new Promise(function(r,i){var s=[],n=t._internalType,o=t._outputType,u=t._mimeType;t.on("data",function(h,l){s.push(h),e&&e(l)}).on("error",function(h){s=[],i(h)}).on("end",function(){try{var h=wr(o,br(n,s),u);r(h)}catch(l){i(l)}s=[]}).resume()})}var R=class{constructor(e,r,i){var s=r;switch(r){case"blob":case"arraybuffer":s="uint8array";break;case"base64":s="string";break}try{this._internalType=s,this._outputType=r,this._mimeType=i,a.checkSupport(s),this._worker=e.pipe(new re(s)),e.lock()}catch(n){this._worker=new f("error"),this._worker.error(n)}}accumulate(e){return Ir(this,e)}on(e,r){var i=this;return e==="data"?this._worker.on(e,function(s){r.call(i,s.data,s.meta)}):this._worker.on(e,function(){a.delay(r,arguments,i)}),this}resume(){return a.delay(this._worker.resume,[],this._worker),this}pause(){return this._worker.pause(),this}toNodejsStream(e){if(a.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new NodejsStreamOutputAdapter(this,{objectMode:this._outputType!=="nodebuffer"},e)}};var Y={base64:!1,binary:!1,dir:!1,createFolders:!0,date:null,compression:null,compressionOptions:null,comment:null,unixPermissions:null,dosPermissions:null};var kr=16*1024,F=class extends f{constructor(e){super("DataWorker");var r=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(i){r.dataIsReady=!0,r.data=i,r.max=i&&i.length||0,r.type=a.getTypeOf(i),r.isPaused||r._tickAndRepeat()},function(i){r.error(i)})}cleanUp(){f.prototype.cleanUp.call(this),this.data=null}resume(){return f.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,a.delay(this._tickAndRepeat,[],this)),!0):!1}_tickAndRepeat(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(a.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))}_tick(){if(this.isPaused||this.isFinished)return!1;var e=kr,r=null,i=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":r=this.data.substring(this.index,i);break;case"uint8array":r=this.data.subarray(this.index,i);break;case"array":case"nodebuffer":r=this.data.slice(this.index,i);break}return this.index=i,this.push({data:r,meta:{percent:this.max?this.index/this.max*100:0}})}};var P=class extends f{constructor(){super("Crc32Probe"),this.withStreamInfo("crc32",0)}processChunk(e){this.streamInfo.crc32=b(e.data,this.streamInfo.crc32||0),this.push(e)}};var L=class extends f{constructor(e){super("DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}processChunk(e){if(e){var r=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=r+e.data.length}f.prototype.processChunk.call(this,e)}};var S=class{constructor(e,r,i,s,n){this.compressedSize=e,this.uncompressedSize=r,this.crc32=i,this.compression=s,this.compressedContent=n}getContentWorker(){var e=new F(Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new L("data_length")),r=this;return e.on("end",function(){if(this.streamInfo.data_length!==r.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e}getCompressedWorker(){return new F(Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}static createWorkerFrom(e,r,i){return e.pipe(new P).pipe(new L("uncompressedSize")).pipe(r.compressWorker(i)).pipe(new L("compressedSize")).withStreamInfo("compression",r)}};var te=class{constructor(e,r,i){this.name=e,this.dir=i.dir,this.date=i.date,this.comment=i.comment,this.unixPermissions=i.unixPermissions,this.dosPermissions=i.dosPermissions,this._data=r,this._dataBinary=i.binary,this.options={compression:i.compression,compressionOptions:i.compressionOptions}}internalStream(e){var r=null,i="string";try{if(!e)throw new Error("No output type specified.");i=e.toLowerCase();var s=i==="string"||i==="text";(i==="binarystring"||i==="text")&&(i="string"),r=this._decompressWorker();var n=!this._dataBinary;n&&!s&&(r=r.pipe(new x.Utf8EncodeWorker)),!n&&s&&(r=r.pipe(new x.Utf8DecodeWorker))}catch(o){r=new f("error"),r.error(o)}return new R(r,i,"")}async(e,r){return this.internalStream(e).accumulate(r)}nodeStream(e,r){return this.internalStream(e||"nodebuffer").toNodejsStream(r)}_compressWorker(e,r){if(this._data instanceof S&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var i=this._decompressWorker();return this._dataBinary||(i=i.pipe(new x.Utf8EncodeWorker)),S.createWorkerFrom(i,e,r)}_decompressWorker(){return this._data instanceof S?this._data.getContentWorker():this._data instanceof f?this._data:new F(this._data)}};var ie=class extends f{constructor(e,r){super("Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(r)}_bindStream(e){var r=this;this._stream=e,e.pause(),e.on("data",function(i){r.push({data:i,meta:{percent:0}})}).on("error",function(i){r.isPaused?this.generatedError=i:r.error(i)}).on("end",function(){r.isPaused?r._upstreamEnded=!0:r.end()})}pause(){return f.prototype.pause.call(this)?(this._stream.pause(),!0):!1}resume(){return f.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1}};var Oe=function(t,e,r){var i=a.getTypeOf(e),s,n=a.extend(r||{},Y);n.date=n.date||new Date,n.compression!==null&&(n.compression=n.compression.toUpperCase()),typeof n.unixPermissions=="string"&&(n.unixPermissions=parseInt(n.unixPermissions,8)),n.unixPermissions&&n.unixPermissions&16384&&(n.dir=!0),n.dosPermissions&&n.dosPermissions&16&&(n.dir=!0),n.dir&&(t=Fe(t)),n.createFolders&&(s=Or(t))&&Te.call(this,s,!0);var o=i==="string"&&n.binary===!1&&n.base64===!1;(!r||typeof r.binary>"u")&&(n.binary=!o);var u=e instanceof S&&e.uncompressedSize===0;(u||n.dir||!e||e.length===0)&&(n.base64=!1,n.binary=!0,e="",n.compression="STORE",i="string");var h=null;e instanceof S||e instanceof f?h=e:y.isNode&&y.isStream(e)?h=new ie(t,e):h=a.prepareContent(t,e,n.binary,n.optimizedBinaryString,n.base64);var l=new te(t,h,n);this.files[t]=l},Or=function(t){t.slice(-1)==="/"&&(t=t.substring(0,t.length-1));var e=t.lastIndexOf("/");return e>0?t.substring(0,e):""},Fe=function(t){return t.slice(-1)!=="/"&&(t+="/"),t},Te=function(t,e){return e=typeof e<"u"?e:Y.createFolders,t=Fe(t),this.files[t]||Oe.call(this,t,null,{dir:!0,createFolders:e}),this.files[t]};function ke(t){return Object.prototype.toString.call(t)==="[object RegExp]"}var H=class{forEach(e){var r,i,s;for(r in this.files)s=this.files[r],i=r.slice(this.root.length,r.length),i&&r.slice(0,this.root.length)===this.root&&e(i,s)}filter(e){var r=[];return this.forEach(function(i,s){e(i,s)&&r.push(s)}),r}file(e,r,i){if(arguments.length===1)if(ke(e)){var s=e;return this.filter(function(o,u){return!u.dir&&s.test(o)})}else{var n=this.files[this.root+e];return n&&!n.dir?n:null}else e=this.root+e,Oe.call(this,e,r,i);return this}folder(e){if(!e)return this;if(ke(e))return this.filter(function(n,o){return o.dir&&e.test(n)});var r=this.root+e,i=Te.call(this,r),s=this.clone();return s.root=i.name,s}remove(e){e=this.root+e;var r=this.files[e];if(r||(e.slice(-1)!=="/"&&(e+="/"),r=this.files[e]),r&&!r.dir)delete this.files[e];else for(var i=this.filter(function(n,o){return o.name.slice(0,e.length)===e}),s=0;s<i.length;s++)delete this.files[i[s].name];return this}generate(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")}generateInternalStream(e){var r,i={};try{if(i=a.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:x.utf8encode}),i.type=i.type.toLowerCase(),i.compression=i.compression.toUpperCase(),i.type==="binarystring"&&(i.type="string"),!i.type)throw new Error("No output type specified.");a.checkSupport(i.type),(i.platform==="darwin"||i.platform==="freebsd"||i.platform==="linux"||i.platform==="sunos")&&(i.platform="UNIX"),i.platform==="win32"&&(i.platform="DOS");var s=i.comment||this.comment||"";r=Ie.generateWorker(this,i,s)}catch(n){r=new f("error"),r.error(n)}return new R(r,i.type||"string",i.mimeType)}generateAsync(e,r){return this.generateInternalStream(e).accumulate(r)}generateNodeStream(e,r){return e=e||{},e.type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(r)}};var z=class{constructor(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}checkOffset(e){this.checkIndex(this.index+e)}checkIndex(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")}setIndex(e){this.checkIndex(e),this.index=e}skip(e){this.setIndex(this.index+e)}byteAt(){}readInt(e){var r=0,i;for(this.checkOffset(e),i=this.index+e-1;i>=this.index;i--)r=r*256+this.byteAt(i);return this.index+=e,r}readIntUnsafe(e){var r=0,i;for(this.checkOffset(e),i=this.index+e-1;i>=this.index;i--)r=(r<<8)+this.byteAt(i);return this.index+=e,r}readString(e){return k("string",this.readData(e))}readData(){}lastIndexOfSignature(){}readAndCheckSignature(){}readDate(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1))}};var U=class extends z{constructor(e){super(e);for(var r=0;r<this.data.length;r++)e[r]=e[r]&255}byteAt(e){return this.data[this.zero+e]}lastIndexOfSignature(e){for(var r=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),o=this.length-4;o>=0;--o)if(this.data[o]===r&&this.data[o+1]===i&&this.data[o+2]===s&&this.data[o+3]===n)return o-this.zero;return-1}readAndCheckSignature(e){var r=e.charCodeAt(0),i=e.charCodeAt(1),s=e.charCodeAt(2),n=e.charCodeAt(3),o=this.readData(4);return r===o[0]&&i===o[1]&&s===o[2]&&n===o[3]}readData(e){if(this.checkOffset(e),e===0)return[];var r=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,r}};var se=class extends z{constructor(e){super(e)}byteAt(e){return this.data.charCodeAt(this.zero+e)}lastIndexOfSignature(e){return this.data.lastIndexOf(e)-this.zero}readAndCheckSignature(e){var r=this.readData(4);return e===r}readData(e){this.checkOffset(e);var r=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,r}};var ne=class extends U{constructor(e){super(e)}readData(e){if(this.checkOffset(e),e===0)return new Uint8Array(0);var r=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,r}};function N(t){var e=B(t);return X(e),e==="string"&&!c.uint8array?new se(t):c.uint8array?new ne(k("uint8array",t)):new U(k("array",t))}var Fr=0,Tr=3,Dr=function(t){for(var e in O)if(Object.prototype.hasOwnProperty.call(O,e)&&O[e].magic===t)return O[e];return null},oe=class{constructor(e,r){this.options=e,this.loadOptions=r}isEncrypted(){return(this.bitFlag&1)===1}useUTF8(){return(this.bitFlag&2048)===2048}readLocalPart(e){var r,i;if(e.skip(22),this.fileNameLength=e.readInt(2),i=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(i),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(r=Dr(this.compressionMethod),r===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new S(this.compressedSize,this.uncompressedSize,this.crc32,r,e.readData(this.compressedSize))}readCentralPart(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readIntUnsafe(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var r=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(r),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)}processAttributes(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),e===Fr&&(this.dosPermissions=this.externalFileAttributes&63),e===Tr&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)}parseZIP64ExtraField(){if(this.extraFields[1]){var e=N(this.extraFields[1].value);(this.uncompressedSize===a.MAX_VALUE_32BITS||this.uncompressedSize===a.REAL_MAX_VALUE_32BITS)&&(this.uncompressedSize=e.readInt(8)),(this.compressedSize===a.MAX_VALUE_32BITS||this.compressedSize===a.REAL_MAX_VALUE_32BITS)&&(this.compressedSize=e.readInt(8)),(this.localHeaderOffset===a.MAX_VALUE_32BITS||this.localHeaderOffset===a.REAL_MAX_VALUE_32BITS)&&(this.localHeaderOffset=e.readInt(8)),(this.diskNumberStart===a.MAX_VALUE_32BITS||this.diskNumberStart===a.REAL_MAX_VALUE_32BITS)&&(this.diskNumberStart=e.readInt(4))}}readExtraFields(e){var r=e.index+this.extraFieldsLength,i,s,n;for(this.extraFields||(this.extraFields={});e.index+4<r;)i=e.readInt(2),s=e.readInt(2),n=e.readData(s),this.extraFields[i]={id:i,length:s,value:n};e.setIndex(r)}handleUTF8(){var e=c.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=x.utf8decode(this.fileName),this.fileCommentStr=x.utf8decode(this.fileComment);else{var r=this.findExtraFieldUnicodePath();if(r!==null)this.fileNameStr=r;else{var i=a.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(i)}var s=this.findExtraFieldUnicodeComment();if(s!==null)this.fileCommentStr=s;else{var n=a.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n)}}}findExtraFieldUnicodePath(){var e=this.extraFields[28789];if(e){var r=N(e.value);return r.readInt(1)!==1||b(this.fileName)!==r.readInt(4)?null:x.utf8decode(r.readData(e.length-5))}return null}findExtraFieldUnicodeComment(){var e=this.extraFields[25461];if(e){var r=N(e.value);return r.readInt(1)!==1||b(this.fileComment)!==r.readInt(4)?null:x.utf8decode(r.readData(e.length-5))}return null}};var ae=class{constructor(e){this.files=[],this.loadOptions=e}checkSignature(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var r=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(r)+", expected "+a.pretty(e)+")")}}isSignature(e,r){var i=this.reader.index;this.reader.setIndex(e);var s=this.reader.readString(4),n=s===r;return this.reader.setIndex(i),n}readBlockEndOfCentral(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),r=c.uint8array?"uint8array":"array",i=a.transformTo(r,e);this.zipComment=this.loadOptions.decodeFileName(i)}readBlockZip64EndOfCentral(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,r=0,i,s,n;r<e;)i=this.reader.readInt(2),s=this.reader.readInt(4),n=this.reader.readData(s),this.zip64ExtensibleData[i]={id:i,length:s,value:n}}readBlockZip64EndOfCentralLocator(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")}readLocalFiles(){var e,r;for(e=0;e<this.files.length;e++)r=this.files[e],this.reader.setIndex(r.localHeaderOffset),this.checkSignature(g.LOCAL_FILE_HEADER),r.readLocalPart(this.reader),r.handleUTF8(),r.processAttributes()}readCentralDir(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(g.CENTRAL_FILE_HEADER);)e=new oe({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)}readEndOfCentral(){var e=this.reader.lastIndexOfSignature(g.CENTRAL_DIRECTORY_END);if(e<0){var r=!this.isSignature(0,g.LOCAL_FILE_HEADER);throw r?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(e);var i=e;if(this.checkSignature(g.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS||this.centralDirSize===a.REAL_MAX_VALUE_32BITS||this.centralDirOffset===a.REAL_MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(g.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(g.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,g.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(g.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(g.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var s=this.centralDirOffset+this.centralDirSize;this.zip64&&(s+=20,s+=12+this.zip64EndOfCentralSize);var n=i-s;if(n>0)this.isSignature(i,g.CENTRAL_FILE_HEADER)||(this.reader.zero=n);else if(n<0)throw new Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")}prepareReader(e){this.reader=N(e)}load(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};function Br(t){return new Promise(function(e,r){var i=t.decompressed.getContentWorker().pipe(new P);i.on("error",function(s){r(s)}).on("end",function(){i.streamInfo.crc32!==t.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):e()}).resume()})}function De(t,e,r){return r=a.extend(r||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:x.utf8decode}),y.isNode&&y.isStream(e)?Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):a.prepareContent("the loaded zip file",e,!0,r.optimizedBinaryString,r.base64).then(function(i){var s=new ae(r);return s.load(i),s}).then(function(s){var n=[Promise.resolve(s)],o=s.files;if(r.checkCRC32)for(var u=0;u<o.length;u++)n.push(Br(o[u]));return Promise.all(n)}).then(function(s){for(var n=s.shift(),o=n.files,u=0;u<o.length;u++){var h=o[u],l=h.fileNameStr,p=a.resolve(h.fileNameStr);t.file(p,h.decompressed,{binary:!0,optimizedBinaryString:!0,date:h.date,dir:h.dir,comment:h.fileCommentStr.length?h.fileCommentStr:null,unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions,createFolders:r.createFolders}),h.dir||(t.file(p).unsafeOriginalName=l)}return n.zipComment.length&&(t.comment=n.zipComment),t})}var Be=class t extends H{constructor(){if(super(),!(this instanceof t))return new t;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new t;for(var r in this)typeof this[r]!="function"&&(e[r]=this[r]);return e}}static support=c;static defaults=Y;static version="4.1.1";loadAsync(e,r){return De(this,e,r)}static loadAsync(e,r){return new t().loadAsync(e,r)}};export{Be as JSZip};
package/lib/utils.js CHANGED
@@ -376,6 +376,7 @@ export function checkSupport(type) {
376
376
 
377
377
  export const MAX_VALUE_16BITS = 65535;
378
378
  export const MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1
379
+ export const REAL_MAX_VALUE_32BITS = 4294967295;
379
380
 
380
381
  /**
381
382
  * Prettify a string read as binary.
@@ -485,5 +486,5 @@ export function prepareContent(name, inputData, isBinary, isOptimizedBinaryStrin
485
486
  };
486
487
 
487
488
  export default {
488
- newBlob, applyFromCharCode, transformTo, resolve, getTypeOf, checkSupport, pretty, delay, extend, prepareContent, MAX_VALUE_16BITS, MAX_VALUE_32BITS
489
+ newBlob, applyFromCharCode, transformTo, resolve, getTypeOf, checkSupport, pretty, delay, extend, prepareContent, MAX_VALUE_16BITS, MAX_VALUE_32BITS, REAL_MAX_VALUE_32BITS
489
490
  }
package/lib/zipEntries.js CHANGED
@@ -195,7 +195,7 @@ export class ZipEntries {
195
195
  reside on the same disk when splitting or spanning
196
196
  an archive.
197
197
  */
198
- if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {
198
+ if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS || this.centralDirSize === utils.REAL_MAX_VALUE_32BITS || this.centralDirOffset === utils.REAL_MAX_VALUE_32BITS) {
199
199
  this.zip64 = true;
200
200
 
201
201
  /*
package/lib/zipEntry.js CHANGED
@@ -174,16 +174,16 @@ export class ZipEntry {
174
174
 
175
175
  // I really hope that these 64bits integer can fit in 32 bits integer, because js
176
176
  // won't let us have more.
177
- if (this.uncompressedSize === utils.MAX_VALUE_32BITS) {
177
+ if (this.uncompressedSize === utils.MAX_VALUE_32BITS || this.uncompressedSize === utils.REAL_MAX_VALUE_32BITS) {
178
178
  this.uncompressedSize = extraReader.readInt(8);
179
179
  }
180
- if (this.compressedSize === utils.MAX_VALUE_32BITS) {
180
+ if (this.compressedSize === utils.MAX_VALUE_32BITS || this.compressedSize === utils.REAL_MAX_VALUE_32BITS) {
181
181
  this.compressedSize = extraReader.readInt(8);
182
182
  }
183
- if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) {
183
+ if (this.localHeaderOffset === utils.MAX_VALUE_32BITS || this.localHeaderOffset === utils.REAL_MAX_VALUE_32BITS) {
184
184
  this.localHeaderOffset = extraReader.readInt(8);
185
185
  }
186
- if (this.diskNumberStart === utils.MAX_VALUE_32BITS) {
186
+ if (this.diskNumberStart === utils.MAX_VALUE_32BITS || this.diskNumberStart === utils.REAL_MAX_VALUE_32BITS) {
187
187
  this.diskNumberStart = extraReader.readInt(4);
188
188
  }
189
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-projects/jszip",
3
- "version": "4.1.5",
3
+ "version": "4.1.6",
4
4
  "author": "Stuart Knightley <stuart@stuartk.com>",
5
5
  "description": "Create, read and edit .zip files with JavaScript http://stuartk.com/jszip",
6
6
  "scripts": {