ufs-client-js
Version:
品高统一文件服务(UFS) JSSDK
1 lines • 143 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.index=t():e.index=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=13)}([function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,f=[],l=!1,h=-1;function c(){l&&u&&(l=!1,u.length?f=u.concat(f):h=-1,f.length&&d())}function d(){if(!l){var e=s(c);l=!0;for(var t=f.length;t;){for(u=f,f=[];++h<t;)u&&u[h].run();h=-1,t=f.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];f.push(new p(e,t)),1!==f.length||l||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConvertClient=t.StorageClient=void 0;var n=r(3);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}"function"!=typeof String.prototype.startsWith&&(String.prototype.startsWith=function(e){return this.slice(0,e.length)===e}),"function"!=typeof String.prototype.endsWith&&(String.prototype.endsWith=function(e){return-1!==this.indexOf(e,this.length-e.length)});t.StorageClient=function(e){function t(e,r){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r))}return a(t,n.StorageBase),t}(),t.ConvertClient=function(e){function t(e,r,n){return i(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,n))}return a(t,n.ConvertBase),t}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConvertBase=t.StorageBase=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(4),o=s(r(5)),a=s(r(12));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.StorageBase=function(){function e(t,r){u(this,e),this.url=t,r&&(r.accessToken&&(this.accessToken=r.accessToken),r.appId&&(this.appId=r.appId))}return n(e,[{key:"fetch",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={"Content-Type":"application/json"};return r.Authorization="Bearer "+this.accessToken,this.appId&&(r["x-ufs-appId"]=this.appId),t.headers=Object.assign({},t.headers,r),(0,i.fetchAdapter)(e,t)}},{key:"status",value:function(e){var t=this.url+"/file/"+e;return this.fetch(t)}},{key:"getResponseHeaders",value:function(e){var t=this.url+"/file/"+e+"/responseHeaders";return this.fetch(t)}},{key:"getMetadata",value:function(e){var t=this.url+"/file/"+e+"/metadata";return this.fetch(t)}},{key:"generateUploadSign",value:function(e){var t=this.url+"/file/upload/sign",r=e.filename||e.file.name,n=e.filesize||e.file.size,i=JSON.stringify({requestHeaders:e.requestHeaders,requestParameters:e.requestParameters,storage:e.storage,filename:r,filesize:n});return this.fetch(t,{method:"POST",body:i})}},{key:"upload",value:function(e,t){var r=this;return e=e||{},(t=t||{}).headers=t.headers||{},this.generateUploadSign(e).then(function(r){if("string"==typeof r&&(r=JSON.parse(r)),r.url)return t.headers=Object.assign(t.headers,r.headers),!r.url.startsWith("http")&&t.baseUrl&&(r.url=(0,i.rebuildUrlIfNecessary)(r.url,t)),(0,i.uploadAdapter)(r.url,t,e.file).then(function(){return new Promise(function(e,t){e(r.uploadId)})})}).then(function(n){var i=r.url+"/file/upload/commit",o=e.filename||e.file.name,a=e.filesize||e.file.size,s=e.responseHeaders||{};s=Object.assign(s,{"Content-Disposition":"inline; filename="+o});var u={filename:o},f=JSON.stringify({storage:e.commitStorage||e.storage,uploadId:n,contentType:e.contentType,accessControl:e.accessControl,responseHeaders:s,metadata:Object.assign(u,e.metadata||{}),filename:o,filesize:t.omitFileSize?void 0:a});return r.fetch(i,{method:"POST",body:f,onProgress:t.onProgress})})}},{key:"urlFor",value:function(e){var t=this.url+"/file/download/sign",r=JSON.stringify(e);return this.fetch(t,{method:"POST",body:r})}},{key:"delete",value:function(e){var t=this.url+"/file",r=JSON.stringify({fileId:e});return this.fetch(t,{method:"DELETE",body:r})}},{key:"preview",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.url+"/preview/oweb365/file?x-ufs-s="+e.xUfsS,r=Object.assign({fileId:e.fileId},e.body);return this.fetch(t,{method:"POST",body:JSON.stringify(r),headers:Object.assign({"x-ufs-appId":e.appId||this.appId},e.headers)})}},{key:"previewImage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.url+"/preview/image/file?x-ufs-s="+e.xUfsS,r={fileId:e.fileId};return e.outputFormat&&(r.outputFormat=e.outputFormat),e.convertParams&&(r.convertParams=e.convertParams),this.fetch(t,{method:"POST",body:JSON.stringify(r),headers:{"x-ufs-appId":e.appId||this.appId}})}},{key:"previewImageFiles",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.url+"/preview/image/files?x-ufs-expired="+e.expired,r=e.fileObjArr||[];return this.fetch(t,{method:"POST",body:JSON.stringify(r),headers:{"x-ufs-appId":e.appId||this.appId}})}},{key:"multiFileDownload",value:function(e,t){var r=this,n=new o.default,s=(t.zipName||(new Date).getTime())+".zip",u=""+(t.zipFolder||"file"),f=n.folder(u),l=[],h=[],c=[];return e.forEach(function(e){var n=Object.assign({fileId:e},t);l.push(r.urlFor(n))}),Promise.all(l).then(function(e){return e.forEach(function(e){c.push(e.url);var t=(0,i.fetchAdapter)(e.url,{jsonParse:!1,responseType:"arraybuffer"});h.push(t)}),Promise.all(h).then(function(e){return e.forEach(function(e,r){var n=function(e){var r=(0,i.getQuery)("response-content-disposition",e);return r=r?r.substr(r.indexOf("=")+1):(new Date).getTime(),t.fileNameReplaceRegExp&&(r=r.replace(t.fileNameReplaceRegExp,"")),r}(c[r]);f.file(n,e,{binary:!0})}),n.generateAsync({type:"blob"}).then(function(e){return t.autoDownload&&(0,a.default)(e,s),Promise.resolve(e)})})})}},{key:"mergePdf",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.url+"/merge/pdf",r={ufsIds:e.fileIds||[]};return e.storage&&(r.storage=e.storage),this.fetch(t,{method:"POST",body:JSON.stringify(r),headers:{"x-ufs-appId":e.appId||this.appId}})}}]),e}(),t.ConvertBase=function(){function e(t,r){u(this,e),this.url=t,r&&(r.accessToken&&(this.accessToken=r.accessToken),r.appId&&(this.appId=r.appId))}return n(e,[{key:"fetch",value:function(e,t){var r={"Content-Type":"application/json",Authorization:"Bearer "+this.accessToken,"x-appId":this.appId};return t.headers=Object.assign({},t.headers,r),(0,i.fetchAdapter)(e,t)}},{key:"enqueue",value:function(e){var t=this.url+"/convert",r=JSON.stringify(e);return this.fetch(t,{method:"POST",body:r})}},{key:"status",value:function(e,t,r){var n=this.url+"/convert?fileId="+e+"&kind="+t+"&name="+r;return this.fetch(n)}},{key:"estimatedTime",value:function(e,t,r){var n=this.url+"/convert/estimateTime?fileId="+e+"&kind="+t;return r&&(n+="¶ms="+encodeURIComponent(r)),this.fetch(n)}}]),e}()},function(e,t,r){"use strict";function n(){return XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")}function i(e,t){e.upload&&t&&t.onProgress&&(e.upload.onprogress=function(e){e.total>0&&(e.percent=e.loaded/e.total*100),t.onProgress(e)})}function o(e,t,r,n,i){var o=e,a=new FileUploadOptions;a.fileKey="file",a.fileName=r.name;var s=t.headers||{"Content-Type":"application/octet-stream"};a.headers=s;var u=a.method||"PUT";a.httpMethod=u;var f=window.cordova.file.dataDirectory;function l(e){console.log("Code = "+e.responseCode),console.log("Response = "+e.response),console.log("Sent = "+e.bytesSent),n(e)}function h(e){console.log("An error has occurred: Code = "+e.code),console.log("upload error source "+e.source),console.log("upload error target "+e.target),console.log(e),i(e)}window.resolveLocalFileSystemURL(f,function(e){console.log("文件系统访问成功,目录:",e.fullPath),e.getFile(a.fileName,{create:!0,exclusive:!1},function(e){console.log("文件创建成功:",e.fullPath),e.createWriter(function(t){t.onwriteend=function(){console.log("文件保存成功");var t=e.toURL();console.log("文件保存路径:",t),(new FileTransfer).upload(t,o,l,h,a)},t.onerror=function(e){var t="文件写入失败: "+e.toString();console.error(t),i(new Error(t))};try{t.write(r)}catch(e){var n="写入文件时发生异常: "+e.message;console.error(n),i(new Error(n))}},function(e){var t="创建文件写入器失败: "+e.toString();console.error(t),i(new Error(t))})},function(e){var t="获取文件失败: "+e.toString();console.error(t),i(new Error(t))})},function(e){var t="解析本地文件系统URL失败: "+e.toString();console.error(t),i(new Error(t))})}function a(){var e=navigator.userAgent||navigator.vendor||window.opera;return/iPad|iPhone|iPod/.test(e)&&!window.MSStream}function s(){return!!(window.cordova||window.phonegap||window.PhoneGap)}Object.defineProperty(t,"__esModule",{value:!0}),t.fetchAdapter=function(e,t){t=Object.assign({jsonParse:!0,responseType:""},t);try{if(weex)return new Promise(function(r,n){var i=weex.requireModule("stream");t.url=e,i.fetch(t,function(e){e.ok?("string"==typeof e.data&&(e.data=JSON.parse(e.data)),r(e.data)):n(e)})})}catch(r){return new Promise(function(r,o){var a=n();i(a,t);var s=t.method||"GET";if(a.open(s,e),t.headers)for(var u in t.headers)a.setRequestHeader(u,t.headers[u]);a.responseType=t.responseType,a.onreadystatechange=function(){if(4==a.readyState)if(200==a.status){var e=t.jsonParse?JSON.parse(a.response):a.response;r(e)}else o(a)},t.body?a.send(t.body):a.send()})}return new Promise(function(r,o){var a=n();i(a,t);var s=t.method||"GET";if(a.open(s,e),t.headers)for(var u in t.headers)a.setRequestHeader(u,t.headers[u]);a.responseType=t.responseType,a.onreadystatechange=function(){if(4==a.readyState)if(200==a.status){var e=t.jsonParse?JSON.parse(a.response):a.response;r(e)}else o(a)},t.body?a.send(t.body):a.send()})},t.uploadAdapter=function(e,t,r){t=Object.assign({},t);try{if(weex)return new Promise(function(n,i){var o=weex.requireModule("FileTransferModule");o.upload(r,e,{headers:t.headers,method:"PUT"},null,function(e){n(e)},function(e){i(e)})})}catch(u){return new Promise(function(u,f){if(a()&&s())o(e,t,r,u,f);else{var l=n();i(l,t);var h=t.method||"PUT";if(l.open(h,e,!0),t.headers)for(var c in t.headers)l.setRequestHeader(c,t.headers[c]);l.onreadystatechange=function(){4==l.readyState&&(200==l.status?u(l.response):f(l))},l.send(r)}})}return new Promise(function(u,f){if(a()&&s())o(e,t,r,u,f);else{var l=n();i(l,t);var h=t.method||"PUT";if(l.open(h,e,!0),t.headers)for(var c in t.headers)l.setRequestHeader(c,t.headers[c]);l.onreadystatechange=function(){4==l.readyState&&(200==l.status?u(l.response):f(l))},l.send(r)}})},t.rebuildUrlIfNecessary=function(e,t){if(!e)return e;if(!e.startsWith("http")&&t.baseUrl)return e=function(){for(var e=[],t=!1,r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];n.length>0&&(t=n[0].startsWith("/"));var o=!0,a=!1,s=void 0;try{for(var u,f=n[Symbol.iterator]();!(o=(u=f.next()).done);o=!0){var l=u.value,h=l;l.endsWith("/")?h=l.substr(0,l.length-1):l.startsWith("/")&&(h=l.substr(1,l.length)),e.push(h)}}catch(e){a=!0,s=e}finally{try{!o&&f.return&&f.return()}finally{if(a)throw s}}var c=e.join("/");return t?"/"+c:c}(t.baseUrl,e);return e},t.getQuery=function(e,t){var r=void 0;r=t?t.split("?")[1]:window.location.search.substr(1);for(var n=r.split("&"),i=0;i<n.length;i++){var o=n[i].split("=");if(o[0]==e)return decodeURIComponent(o[1])}return null},t.isIOS=a,t.isCordova=s},function(e,t,r){(function(t,r,n,i){var o;e.exports=function e(t,r,n){function i(s,u){if(!r[s]){if(!t[s]){var f="function"==typeof o&&o;if(!u&&f)return o(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var h=r[s]={exports:{}};t[s][0].call(h.exports,function(e){var r=t[s][1][e];return i(r||e)},h,h.exports,e,t,r,n)}return r[s].exports}for(var a="function"==typeof o&&o,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,r){"use strict";var n=e("./utils"),i=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,i,a,s,u,f,l=[],h=0,c=e.length,d=c,p="string"!==n.getTypeOf(e);h<e.length;)d=c-h,i=p?(t=e[h++],r=h<c?e[h++]:0,h<c?e[h++]:0):(t=e.charCodeAt(h++),r=h<c?e.charCodeAt(h++):0,h<c?e.charCodeAt(h++):0),a=t>>2,s=(3&t)<<4|r>>4,u=1<d?(15&r)<<2|i>>6:64,f=2<d?63&i:64,l.push(o.charAt(a)+o.charAt(s)+o.charAt(u)+o.charAt(f));return l.join("")},r.decode=function(e){var t,r,n,a,s,u,f=0,l=0,h="data:";if(e.substr(0,h.length)===h)throw new Error("Invalid base64 input, it looks like a data url.");var c,d=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===o.charAt(64)&&d--,e.charAt(e.length-2)===o.charAt(64)&&d--,d%1!=0)throw new Error("Invalid base64 input, bad content length.");for(c=i.uint8array?new Uint8Array(0|d):new Array(0|d);f<e.length;)t=o.indexOf(e.charAt(f++))<<2|(a=o.indexOf(e.charAt(f++)))>>4,r=(15&a)<<4|(s=o.indexOf(e.charAt(f++)))>>2,n=(3&s)<<6|(u=o.indexOf(e.charAt(f++))),c[l++]=t,64!==s&&(c[l++]=r),64!==u&&(c[l++]=n);return c}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");function s(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}s.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(e,t,r){return e.pipe(new o).pipe(new a("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils"),i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,r,n){var o=i,a=0+r;e^=-1;for(var s=0;s<a;s++)e=e>>>8^o[255&(e^t[s])];return-1^e}(0|t,e,e.length):function(e,t,r,n){var o=i,a=0+r;e^=-1;for(var s=0;s<a;s++)e=e>>>8^o[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),o=e("./utils"),a=e("./stream/GenericWorker"),s=n?"uint8array":"array";function u(e,t){a.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",o.inherits(u,a),u.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(o.transformTo(s,e.data),!1)},u.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},r.compressWorker=function(e){return new u("Deflate",e)},r.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function n(e,t){var r,n="";for(r=0;r<t;r++)n+=String.fromCharCode(255&e),e>>>=8;return n}function i(e,t,r,i,a,l){var h,c,d=e.file,p=e.compression,m=l!==s.utf8encode,g=o.transformTo("string",l(d.name)),_=o.transformTo("string",s.utf8encode(d.name)),v=d.comment,y=o.transformTo("string",l(v)),w=o.transformTo("string",s.utf8encode(v)),b=_.length!==d.name.length,k=w.length!==v.length,S="",E="",x="",I=d.dir,A=d.date,C={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(C.crc32=e.crc32,C.compressedSize=e.compressedSize,C.uncompressedSize=e.uncompressedSize);var T=0;t&&(T|=8),m||!b&&!k||(T|=2048);var O=0,z=0;I&&(O|=16),"UNIX"===a?(z=798,O|=function(e,t){var r=e;return e||(r=33204),(65535&r)<<16}(d.unixPermissions)):(z=20,O|=(d.dosPermissions,0)),h=A.getUTCHours(),h<<=6,h|=A.getUTCMinutes(),h<<=5,h|=A.getUTCSeconds()/2,c=A.getUTCFullYear()-1980,c<<=4,c|=A.getUTCMonth()+1,c<<=5,c|=A.getUTCDate(),b&&(E=n(1,1)+n(u(g),4)+_,S+="up"+n(E.length,2)+E),k&&(x=n(1,1)+n(u(y),4)+w,S+="uc"+n(x.length,2)+x);var R="";return R+="\n\0",R+=n(T,2),R+=p.magic,R+=n(h,2),R+=n(c,2),R+=n(C.crc32,4),R+=n(C.compressedSize,4),R+=n(C.uncompressedSize,4),R+=n(g.length,2),R+=n(S.length,2),{fileRecord:f.LOCAL_FILE_HEADER+R+g+S,dirRecord:f.CENTRAL_FILE_HEADER+n(z,2)+R+n(y.length,2)+"\0\0\0\0"+n(O,4)+n(i,4)+g+S+y}}var o=e("../utils"),a=e("../stream/GenericWorker"),s=e("../utf8"),u=e("../crc32"),f=e("../signature");function l(e,t,r,n){a.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(l,a),l.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,a.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},l.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},l.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return f.DATA_DESCRIPTOR+n(e.crc32,4)+n(e.compressedSize,4)+n(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},l.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,i=function(e,t,r,i,a){var s=o.transformTo("string",a(i));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(e,2)+n(e,2)+n(t,4)+n(r,4)+n(s.length,2)+s}(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},l.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},l.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(e){t.error(e)}),this},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},l.prototype.error=function(e){var t=this._sources;if(!a.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch(e){}return!0},l.prototype.lock=function(){a.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=l},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){"use strict";var n=e("../compressions"),i=e("./ZipFileWorker");r.generateWorker=function(e,t,r){var o=new i(t.streamFiles,r,t.platform,t.encodeFileName),a=0;try{e.forEach(function(e,r){a++;var i=function(e,t){var r=e||t,i=n[r];if(!i)throw new Error(r+" is not a valid compression method !");return i}(r.options.compression,t.compression),s=r.options.compressionOptions||t.compressionOptions||{},u=r.dir,f=r.date;r._compressWorker(i,s).withStreamInfo("file",{name:e,dir:u,date:f,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(o)}),o.entriesCount=a}catch(e){o.error(e)}return o}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;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 n;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(e,t){return(new n).loadAsync(e,t)},n.external=e("./external"),t.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){"use strict";var n=e("./utils"),i=e("./external"),o=e("./utf8"),a=e("./zipEntries"),s=e("./stream/Crc32Probe"),u=e("./nodejsUtils");function f(e){return new i.Promise(function(t,r){var n=e.decompressed.getContentWorker().pipe(new s);n.on("error",function(e){r(e)}).on("end",function(){n.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}t.exports=function(e,t){var r=this;return t=n.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),u.isNode&&u.isStream(e)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var r=new a(t);return r.load(e),r}).then(function(e){var r=[i.Promise.resolve(e)],n=e.files;if(t.checkCRC32)for(var o=0;o<n.length;o++)r.push(f(n[o]));return i.Promise.all(r)}).then(function(e){for(var i=e.shift(),o=i.files,a=0;a<o.length;a++){var s=o[a],u=s.fileNameStr,f=n.resolve(s.fileNameStr);r.file(f,s.decompressed,{binary:!0,optimizedBinaryString:!0,date:s.date,dir:s.dir,comment:s.fileCommentStr.length?s.fileCommentStr:null,unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions,createFolders:t.createFolders}),s.dir||(r.file(f).unsafeOriginalName=u)}return i.zipComment.length&&(r.comment=i.zipComment),r})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../stream/GenericWorker");function o(e,t){i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}n.inherits(o,i),o.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},o.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){"use strict";var n=e("readable-stream").Readable;function i(e,t,r){n.call(this,t),this._helper=e;var i=this;e.on("data",function(e,t){i.push(e)||i._helper.pause(),r&&r(t)}).on("error",function(e){i.emit("error",e)}).on("end",function(){i.push(null)})}e("../utils").inherits(i,n),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(e,r,n){"use strict";r.exports={isNode:void 0!==t,newBufferFrom:function(e,r){if(t.from&&t.from!==Uint8Array.from)return t.from(e,r);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new t(e,r)},allocBuffer:function(e){if(t.alloc)return t.alloc(e);var r=new t(e);return r.fill(0),r},isBuffer:function(e){return t.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,r){"use strict";function n(e,t,r){var n,i=o.getTypeOf(t),s=o.extend(r||{},u);s.date=s.date||new Date,null!==s.compression&&(s.compression=s.compression.toUpperCase()),"string"==typeof s.unixPermissions&&(s.unixPermissions=parseInt(s.unixPermissions,8)),s.unixPermissions&&16384&s.unixPermissions&&(s.dir=!0),s.dosPermissions&&16&s.dosPermissions&&(s.dir=!0),s.dir&&(e=m(e)),s.createFolders&&(n=p(e))&&g.call(this,n,!0);var h="string"===i&&!1===s.binary&&!1===s.base64;r&&void 0!==r.binary||(s.binary=!h),(t instanceof f&&0===t.uncompressedSize||s.dir||!t||0===t.length)&&(s.base64=!1,s.binary=!0,t="",s.compression="STORE",i="string");var _=null;_=t instanceof f||t instanceof a?t:c.isNode&&c.isStream(t)?new d(e,t):o.prepareContent(e,t,s.binary,s.optimizedBinaryString,s.base64);var v=new l(e,_,s);this.files[e]=v}var i=e("./utf8"),o=e("./utils"),a=e("./stream/GenericWorker"),s=e("./stream/StreamHelper"),u=e("./defaults"),f=e("./compressedObject"),l=e("./zipObject"),h=e("./generate"),c=e("./nodejsUtils"),d=e("./nodejs/NodejsStreamInputAdapter"),p=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:u.createFolders,e=m(e),this.files[e]||n.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function _(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)n=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,n)},filter:function(e){var t=[];return this.forEach(function(r,n){e(r,n)&&t.push(n)}),t},file:function(e,t,r){if(1!==arguments.length)return e=this.root+e,n.call(this,e,t,r),this;if(_(e)){var i=e;return this.filter(function(e,t){return!t.dir&&i.test(e)})}var o=this.files[this.root+e];return o&&!o.dir?o:null},folder:function(e){if(!e)return this;if(_(e))return this.filter(function(t,r){return r.dir&&e.test(t)});var t=this.root+e,r=g.call(this,t),n=this.clone();return n.root=r.name,n},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(t,r){return r.name.slice(0,e.length)===e}),n=0;n<r.length;n++)delete this.files[r[n].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if((r=o.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");o.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var n=r.comment||this.comment||"";t=h.generateWorker(this,r,n)}catch(e){(t=new a("error")).error(e)}return new s(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=v},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){"use strict";var n=e("./DataReader");function i(e){n.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data[this.zero+e]},i.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),o=this.length-4;0<=o;--o)if(this.data[o]===t&&this.data[o+1]===r&&this.data[o+2]===n&&this.data[o+3]===i)return o-this.zero;return-1},i.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),o=this.readData(4);return t===o[0]&&r===o[1]&&n===o[2]&&i===o[3]},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){"use strict";var n=e("../utils");function i(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(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:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),o=e("./ArrayReader"),a=e("./StringReader"),s=e("./NodeBufferReader"),u=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new s(e):i.uint8array?new u(n.transformTo("uint8array",e)):new o(n.transformTo("array",e)):new a(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function o(e){n.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(o,n),o.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,n),o.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(o,i),o.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(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}n.prototype={push:function(e){this.emit("data",e)},end:function(){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:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=n},{}],29:[function(e,r,n){"use strict";var i=e("../utils"),o=e("./ConvertWorker"),a=e("./GenericWorker"),s=e("../base64"),u=e("../support"),f=e("../external"),l=null;if(u.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function h(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=t,this._mimeType=r,i.checkSupport(n),this._worker=e.pipe(new o(n)),e.lock()}catch(e){this._worker=new a("error"),this._worker.error(e)}}h.prototype={accumulate:function(e){return function(e,r){return new f.Promise(function(n,o){var a=[],u=e._internalType,f=e._outputType,l=e._mimeType;e.on("data",function(e,t){a.push(e),r&&r(t)}).on("error",function(e){a=[],o(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),r);case"base64":return s.encode(t);default:return i.transformTo(e,t)}}(f,function(e,r){var n,i=0,o=null,a=0;for(n=0;n<r.length;n++)a+=r[n].length;switch(e){case"string":return r.join("");case"array":return Array.prototype.concat.apply([],r);case"uint8array":for(o=new Uint8Array(a),n=0;n<r.length;n++)o.set(r[n],i),i+=r[n].length;return o;case"nodebuffer":return t.concat(r);default:throw new Error("concat : unsupported type '"+e+"'")}}(u,a),l);n(e)}catch(e){o(e)}a=[]}).resume()})}(this,e)},on:function(e,t){var r=this;return"data"===e?this._worker.on(e,function(e){t.call(r,e.data,e.meta)}):this._worker.on(e,function(){i.delay(t,arguments,r)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(i.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:"nodebuffer"!==this._outputType},e)}},r.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,r,n){"use strict";if(n.base64=!0,n.array=!0,n.string=!0,n.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,n.nodebuffer=void 0!==t,n.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)n.blob=!1;else{var i=new ArrayBuffer(0);try{n.blob=0===new Blob([i],{type:"application/zip"}).size}catch(e){try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(i),n.blob=0===o.getBlob("application/zip").size}catch(e){n.blob=!1}}}try{n.nodestream=!!e("readable-stream").Readable}catch(e){n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){"use strict";for(var n=e("./utils"),i=e("./support"),o=e("./nodejsUtils"),a=e("./stream/GenericWorker"),s=new Array(256),u=0;u<256;u++)s[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function f(){a.call(this,"utf-8 decode"),this.leftOver=null}function l(){a.call(this,"utf-8 encode")}s[254]=s[254]=1,r.utf8encode=function(e){return i.nodebuffer?o.newBufferFrom(e,"utf-8"):function(e){var t,r,n,o,a,s=e.length,u=0;for(o=0;o<s;o++)55296==(64512&(r=e.charCodeAt(o)))&&o+1<s&&56320==(64512&(n=e.charCodeAt(o+1)))&&(r=65536+(r-55296<<10)+(n-56320),o++),u+=r<128?1:r<2048?2:r<65536?3:4;for(t=i.uint8array?new Uint8Array(u):new Array(u),o=a=0;a<u;o++)55296==(64512&(r=e.charCodeAt(o)))&&o+1<s&&56320==(64512&(n=e.charCodeAt(o+1)))&&(r=65536+(r-55296<<10)+(n-56320),o++),r<128?t[a++]=r:(r<2048?t[a++]=192|r>>>6:(r<65536?t[a++]=224|r>>>12:(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63),t[a++]=128|r>>>6&63),t[a++]=128|63&r);return t}(e)},r.utf8decode=function(e){return i.nodebuffer?n.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,i,o,a=e.length,u=new Array(2*a);for(t=r=0;t<a;)if((i=e[t++])<128)u[r++]=i;else if(4<(o=s[i]))u[r++]=65533,t+=o-1;else{for(i&=2===o?31:3===o?15:7;1<o&&t<a;)i=i<<6|63&e[t++],o--;1<o?u[r++]=65533:i<65536?u[r++]=i:(i-=65536,u[r++]=55296|i>>10&1023,u[r++]=56320|1023&i)}return u.length!==r&&(u.subarray?u=u.subarray(0,r):u.length=r),n.applyFromCharCode(u)}(e=n.transformTo(i.uint8array?"uint8array":"array",e))},n.inherits(f,a),f.prototype.processChunk=function(e){var t=n.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var o=t;(t=new Uint8Array(o.length+this.leftOver.length)).set(this.leftOver,0),t.set(o,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var a=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+s[e[r]]>t?r:t}(t),u=t;a!==t.length&&(i.uint8array?(u=t.subarray(0,a),this.leftOver=t.subarray(a,t.length)):(u=t.slice(0,a),this.leftOver=t.slice(a,t.length))),this.push({data:r.utf8decode(u),meta:e.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=f,n.inherits(l,a),l.prototype.processChunk=function(e){this.push({data:r.utf8encode(e.data),meta:e.meta})},r.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){"use strict";var i=e("./support"),o=e("./base64"),a=e("./nodejsUtils"),s=e("./external");function u(e){return e}function f(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}e("setimmediate"),n.newBlob=function(e,t){n.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var r=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return r.append(e),r.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(e,t,r){var n=[],i=0,o=e.length;if(o<=r)return String.fromCharCode.apply(null,e);for(;i<o;)"array"===t||"nodebuffer"===t?n.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+r,o)))):n.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+r,o)))),i+=r;return n.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,a.allocBuffer(1)).length}catch(e){return!1}}()}};function h(e){var t=65536,r=n.getTypeOf(e),i=!0;if("uint8array"===r?i=l.applyCanBeUsed.uint8array:"nodebuffer"===r&&(i=l.applyCanBeUsed.nodebuffer),i)for(;1<t;)try{return l.stringifyByChunk(e,r,t)}catch(e){t=Math.floor(t/2)}return l.stringifyByChar(e)}function c(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}n.applyFromCharCode=h;var d={};d.string={string:u,array:function(e){return f(e,new Array(e.length))},arraybuffer:function(e){return d.string.uint8array(e).buffer},uint8array:function(e){return f(e,new Uint8Array(e.length))},nodebuffer:function(e){return f(e,a.allocBuffer(e.length))}},d.array={string:h,array:u,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a.newBufferFrom(e)}},d.arraybuffer={string:function(e){return h(new Uint8Array(e))},array:function(e){return c(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:u,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return a.newBufferFrom(new Uint8Array(e))}},d.uint8array={string:h,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:u,nodebuffer:function(e){return a.newBufferFrom(e)}},d.nodebuffer={string:h,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return d.nodebuffer.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:u},n.transformTo=function(e,t){if(t=t||"",!e)return t;n.checkSupport(e);var r=n.getTypeOf(t);return d[r][e](t)},n.resolve=function(e){for(var t=e.split("/"),r=[],n=0;n<t.length;n++){var i=t[n];"."===i||""===i&&0!==n&&n!==t.length-1||(".."===i?r.pop():r.push(i))}return r.join("/")},n.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":i.nodebuffer&&a.isBuffer(e)?"nodebuffer":i.uint8array&&e instanceof Uint8Array?"uint8array":i.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},n.checkSupport=function(e){if(!i[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},n.MAX_VALUE_16BITS=65535,n.MAX_VALUE_32BITS=-1,n.pretty=function(e){var t,r,n="";for(r=0;r<(e||"").length;r++)n+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return n},n.delay=function(e,t,n){r(function(){e.apply(n||null,t||[])})},n.inherits=function(e,t){function r(){}r.prototype=t.prototype,e.prototype=new r},n.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r},n.prepareContent=function(e,t,r,a,u){return s.Promise.resolve(t).then(function(e){return i.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new s.Promise(function(t,r){var n=new FileReader;n.onload=function(e){t(e.target.result)},n.onerror=function(e){r(e.target.error)},n.readAsArrayBuffer(e)}):e}).then(function(t){var l=n.getTypeOf(t);return l?("arraybuffer"===l?t=n.transformTo("uint8array",t):"string"===l&&(u?t=o.decode(t):r&&!0!==a&&(t=function(e){return f(e,i.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):s.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33: