Socket
Socket
Sign inDemoInstall

@syncfusion/ej2-compression

Package Overview
Dependencies
1
Maintainers
3
Versions
97
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 20.4.48 to 21.1.35

src/checksum-calculator.d.ts

4

dist/ej2-compression.min.js
/*!
* filename: ej2-compression.min.js
* version : 20.4.48
* version : 21.1.35
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.

@@ -10,2 +10,2 @@ * Use of this code is subject to the terms of our license.

*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("SyncfusionFileUtils")):"function"==typeof define&&define.amd?define(["SyncfusionFileUtils"],e):"object"==typeof exports?exports.SyncfusionCompression=e(require("SyncfusionFileUtils")):t.SyncfusionCompression=e(t.SyncfusionFileUtils)}(this,function(t){return function(t){function e(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,r){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=3)}([function(t,e,i){"use strict";i.d(e,"a",function(){return a}),i.d(e,"b",function(){return f}),i.d(e,"c",function(){return u});var r=i(1),n=(i.n(r),new Int16Array(286)),s=new Uint8Array(286),o=new Int16Array(30),h=new Uint8Array(30),a=function(){function t(e){this.pendingBuffer=new Uint8Array(65536),this.pendingBufLength=0,this.pendingBufCache=0,this.pendingBufBitsInCache=0,this.bufferPosition=0,this.extraBits=0,this.currentHash=0,this.matchStart=0,this.matchLength=0,this.matchPrevAvail=!1,this.blockStart=0,this.stringStart=0,this.lookAhead=0,this.totalBytesIn=0,this.inputOffset=0,this.inputEnd=0,this.windowSize=32768,this.windowMask=this.windowSize-1,this.hashSize=32768,this.hashMask=this.hashSize-1,this.hashShift=Math.floor(17/3),this.maxDist=this.windowSize-262,this.checkSum=1,this.noWrap=!1,t.isHuffmanTreeInitiated||(t.initHuffmanTree(),t.isHuffmanTreeInitiated=!0),this.treeLiteral=new f(this,286,257,15),this.treeDistances=new f(this,30,1,15),this.treeCodeLengths=new f(this,19,4,7),this.arrDistances=new Uint16Array(16384),this.arrLiterals=new Uint8Array(16384),this.stream=[],this.dataWindow=new Uint8Array(2*this.windowSize),this.hashHead=new Int16Array(this.hashSize),this.hashPrevious=new Int16Array(this.windowSize),this.blockStart=this.stringStart=1,this.noWrap=e,e||this.writeZLibHeader()}return Object.defineProperty(t.prototype,"compressedData",{get:function(){return this.stream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"getCompressedString",{get:function(){var t="";if(void 0!==this.stream)for(var e=0;e<this.stream.length;e++)t+=String.fromCharCode.apply(null,this.stream[e]);return t},enumerable:!0,configurable:!0}),t.prototype.write=function(t,e,i){if(void 0===t||null===t)throw new Error("ArgumentException: data cannot null or undefined");var n=e+i;if(0>e||e>n||n>t.length)throw new Error("ArgumentOutOfRangeException: Offset or length is incorrect");if("string"==typeof t){var s=new r.Encoding(!1);s.type="Utf8",t=new Uint8Array(s.getBytes(t,0,t.length)),n=e+t.length}for(this.inputBuffer=t,this.inputOffset=e,this.inputEnd=n,this.noWrap||(this.checkSum=u.checksumUpdate(this.checkSum,this.inputBuffer,this.inputOffset,n));this.inputEnd!==this.inputOffset||0!==this.pendingBufLength;)this.pendingBufferFlush(),this.compressData(!1)},t.prototype.writeZLibHeader=function(){var t=30720;t|=64,t+=31-t%31,this.pendingBufferWriteShortBytes(t)},t.prototype.pendingBufferWriteShortBytes=function(t){this.pendingBuffer[this.pendingBufLength++]=t>>8,this.pendingBuffer[this.pendingBufLength++]=t},t.prototype.compressData=function(t){var e;do{this.fillWindow();var i=t&&this.inputEnd===this.inputOffset;e=this.compressSlow(i,t)}while(0===this.pendingBufLength&&e);return e},t.prototype.compressSlow=function(t,e){if(this.lookAhead<262&&!t)return!1;for(;this.lookAhead>=262||t;){if(0===this.lookAhead)return this.lookAheadCompleted(e);this.stringStart>=2*this.windowSize-262&&this.slideWindow();var i=this.matchStart,r=this.matchLength;if(this.lookAhead>=3&&this.discardMatch(),r>=3&&this.matchLength<=r?r=this.matchPreviousBest(i,r):this.matchPreviousAvailable(),this.bufferPosition>=16384)return this.huffmanIsFull(e)}return!0},t.prototype.discardMatch=function(){var t=this.insertString();0!==t&&this.stringStart-t<=this.maxDist&&this.findLongestMatch(t)&&this.matchLength<=5&&3===this.matchLength&&this.stringStart-this.matchStart>4096&&(this.matchLength=2)},t.prototype.matchPreviousAvailable=function(){this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!0,this.stringStart++,this.lookAhead--},t.prototype.matchPreviousBest=function(t,e){this.huffmanTallyDist(this.stringStart-1-t,e),e-=2;do{this.stringStart++,--this.lookAhead>=3&&this.insertString()}while(--e>0);return this.stringStart++,this.lookAhead--,this.matchPrevAvail=!1,this.matchLength=2,e},t.prototype.lookAheadCompleted=function(t){return this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!1,this.huffmanFlushBlock(this.dataWindow,this.blockStart,this.stringStart-this.blockStart,t),this.blockStart=this.stringStart,!1},t.prototype.huffmanIsFull=function(t){var e=this.stringStart-this.blockStart;this.matchPrevAvail&&e--;var i=t&&0===this.lookAhead&&!this.matchPrevAvail;return this.huffmanFlushBlock(this.dataWindow,this.blockStart,e,i),this.blockStart+=e,!i},t.prototype.fillWindow=function(){for(this.stringStart>=this.windowSize+this.maxDist&&this.slideWindow();this.lookAhead<262&&this.inputOffset<this.inputEnd;){var t=2*this.windowSize-this.lookAhead-this.stringStart;t>this.inputEnd-this.inputOffset&&(t=this.inputEnd-this.inputOffset),this.dataWindow.set(this.inputBuffer.subarray(this.inputOffset,this.inputOffset+t),this.stringStart+this.lookAhead),this.inputOffset+=t,this.totalBytesIn+=t,this.lookAhead+=t}this.lookAhead>=3&&this.updateHash()},t.prototype.slideWindow=function(){this.dataWindow.set(this.dataWindow.subarray(this.windowSize,this.windowSize+this.windowSize),0),this.matchStart-=this.windowSize,this.stringStart-=this.windowSize,this.blockStart-=this.windowSize;for(var t=0;t<this.hashSize;++t){var e=65535&this.hashHead[t];this.hashHead[t]=e>=this.windowSize?e-this.windowSize:0}for(var t=0;t<this.windowSize;t++){var e=65535&this.hashPrevious[t];this.hashPrevious[t]=e>=this.windowSize?e-this.windowSize:0}},t.prototype.insertString=function(){var t,e=(this.currentHash<<this.hashShift^this.dataWindow[this.stringStart+2])&this.hashMask;return this.hashPrevious[this.stringStart&this.windowMask]=t=this.hashHead[e],this.hashHead[e]=this.stringStart,this.currentHash=e,65535&t},t.prototype.findLongestMatch=function(t){var e,i=4096,r=258,n=this.stringStart,s=this.stringStart+this.matchLength,o=Math.max(this.matchLength,2),h=Math.max(this.stringStart-this.maxDist,0),a=this.stringStart+258-1,f=this.dataWindow[s-1],u=this.dataWindow[s],c=this.dataWindow;o>=32&&(i>>=2),r>this.lookAhead&&(r=this.lookAhead);do{if(c[t+o]===u&&c[t+o-1]===f&&c[t]===c[n]&&c[t+1]===c[n+1]){for(e=t+2,n+=2;c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&n<a;);if(n>s){if(this.matchStart=t,s=n,(o=n-this.stringStart)>=r)break;f=c[s-1],u=c[s]}n=this.stringStart}}while((t=65535&this.hashPrevious[t&this.windowMask])>h&&0!=--i);return this.matchLength=Math.min(o,this.lookAhead),this.matchLength>=3},t.prototype.updateHash=function(){this.currentHash=this.dataWindow[this.stringStart]<<this.hashShift^this.dataWindow[this.stringStart+1]},t.prototype.huffmanTallyLit=function(t){return this.arrDistances[this.bufferPosition]=0,this.arrLiterals[this.bufferPosition++]=t,this.treeLiteral.codeFrequencies[t]++,this.bufferPosition>=16384},t.prototype.huffmanTallyDist=function(t,e){this.arrDistances[this.bufferPosition]=t,this.arrLiterals[this.bufferPosition++]=e-3;var i=this.huffmanLengthCode(e-3);this.treeLiteral.codeFrequencies[i]++,i>=265&&i<285&&(this.extraBits+=Math.floor((i-261)/4));var r=this.huffmanDistanceCode(t-1);return this.treeDistances.codeFrequencies[r]++,r>=4&&(this.extraBits+=Math.floor(r/2-1)),this.bufferPosition>=16384},t.prototype.huffmanFlushBlock=function(t,e,i,r){this.treeLiteral.codeFrequencies[256]++,this.treeLiteral.buildTree(),this.treeDistances.buildTree(),this.treeLiteral.calculateBLFreq(this.treeCodeLengths),this.treeDistances.calculateBLFreq(this.treeCodeLengths),this.treeCodeLengths.buildTree();for(var a=4,u=18;u>a;u--)this.treeCodeLengths.codeLengths[f.huffCodeLengthOrders[u]]>0&&(a=u+1);for(var c=14+3*a+this.treeCodeLengths.getEncodedLength()+this.treeLiteral.getEncodedLength()+this.treeDistances.getEncodedLength()+this.extraBits,d=this.extraBits,u=0;u<286;u++)d+=this.treeLiteral.codeFrequencies[u]*s[u];for(var u=0;u<30;u++)d+=this.treeDistances.codeFrequencies[u]*h[u];c>=d&&(c=d),e>=0&&i+4<c>>3?this.huffmanFlushStoredBlock(t,e,i,r):c==d?(this.pendingBufferWriteBits(2+(r?1:0),3),this.treeLiteral.setStaticCodes(n,s),this.treeDistances.setStaticCodes(o,h),this.huffmanCompressBlock(),this.huffmanReset()):(this.pendingBufferWriteBits(4+(r?1:0),3),this.huffmanSendAllTrees(a),this.huffmanCompressBlock(),this.huffmanReset())},t.prototype.huffmanFlushStoredBlock=function(t,e,i,r){this.pendingBufferWriteBits(0+(r?1:0),3),this.pendingBufferAlignToByte(),this.pendingBufferWriteShort(i),this.pendingBufferWriteShort(~i),this.pendingBufferWriteByteBlock(t,e,i),this.huffmanReset()},t.prototype.huffmanLengthCode=function(t){if(255===t)return 285;for(var e=257;t>=8;)e+=4,t>>=1;return e+t},t.prototype.huffmanDistanceCode=function(t){for(var e=0;t>=4;)e+=2,t>>=1;return e+t},t.prototype.huffmanSendAllTrees=function(t){this.treeCodeLengths.buildCodes(),this.treeLiteral.buildCodes(),this.treeDistances.buildCodes(),this.pendingBufferWriteBits(this.treeLiteral.treeLength-257,5),this.pendingBufferWriteBits(this.treeDistances.treeLength-1,5),this.pendingBufferWriteBits(t-4,4);for(var e=0;e<t;e++)this.pendingBufferWriteBits(this.treeCodeLengths.codeLengths[f.huffCodeLengthOrders[e]],3);this.treeLiteral.writeTree(this.treeCodeLengths),this.treeDistances.writeTree(this.treeCodeLengths)},t.prototype.huffmanReset=function(){this.bufferPosition=0,this.extraBits=0,this.treeLiteral.reset(),this.treeDistances.reset(),this.treeCodeLengths.reset()},t.prototype.huffmanCompressBlock=function(){for(var t=0;t<this.bufferPosition;t++){var e=255&this.arrLiterals[t],i=this.arrDistances[t];if(0!=i--){var r=this.huffmanLengthCode(e);this.treeLiteral.writeCodeToStream(r);var n=Math.floor((r-261)/4);n>0&&n<=5&&this.pendingBufferWriteBits(e&(1<<n)-1,n);var s=this.huffmanDistanceCode(i);this.treeDistances.writeCodeToStream(s),n=Math.floor(s/2-1),n>0&&this.pendingBufferWriteBits(i&(1<<n)-1,n)}else this.treeLiteral.writeCodeToStream(e)}this.treeLiteral.writeCodeToStream(256)},t.prototype.pendingBufferWriteBits=function(t,e){var i=new Uint32Array(1);i[0]=this.pendingBufCache|t<<this.pendingBufBitsInCache,this.pendingBufCache=i[0],this.pendingBufBitsInCache+=e,this.pendingBufferFlushBits()},t.prototype.pendingBufferFlush=function(t){if(this.pendingBufferFlushBits(),this.pendingBufLength>0){var e=new Uint8Array(this.pendingBufLength);e.set(this.pendingBuffer.subarray(0,this.pendingBufLength),0),this.stream.push(e)}this.pendingBufLength=0},t.prototype.pendingBufferFlushBits=function(){for(var t=0;this.pendingBufBitsInCache>=8&&this.pendingBufLength<65536;)this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache,this.pendingBufCache>>=8,this.pendingBufBitsInCache-=8,t++;return t},t.prototype.pendingBufferWriteByteBlock=function(t,e,i){var r=t.subarray(e,e+i);this.pendingBuffer.set(r,this.pendingBufLength),this.pendingBufLength+=i},t.prototype.pendingBufferWriteShort=function(t){this.pendingBuffer[this.pendingBufLength++]=t,this.pendingBuffer[this.pendingBufLength++]=t>>8},t.prototype.pendingBufferAlignToByte=function(){this.pendingBufBitsInCache>0&&(this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache),this.pendingBufCache=0,this.pendingBufBitsInCache=0},t.initHuffmanTree=function(){for(var t=0;t<144;)n[t]=f.bitReverse(48+t<<8),s[t++]=8;for(;t<256;)n[t]=f.bitReverse(256+t<<7),s[t++]=9;for(;t<280;)n[t]=f.bitReverse(-256+t<<9),s[t++]=7;for(;t<286;)n[t]=f.bitReverse(-88+t<<8),s[t++]=8;for(t=0;t<30;t++)o[t]=f.bitReverse(t<<11),h[t]=5},t.prototype.close=function(){do{this.pendingBufferFlush(!0),this.compressData(!0)||(this.pendingBufferFlush(!0),this.pendingBufferAlignToByte(),this.noWrap||(this.pendingBufferWriteShortBytes(this.checkSum>>16),this.pendingBufferWriteShortBytes(65535&this.checkSum)),this.pendingBufferFlush(!0))}while(this.inputEnd!==this.inputOffset||0!==this.pendingBufLength)},t.prototype.destroy=function(){this.stream=[],this.stream=void 0,this.pendingBuffer=void 0,this.treeLiteral=void 0,this.treeDistances=void 0,this.treeCodeLengths=void 0,this.arrLiterals=void 0,this.arrDistances=void 0,this.hashHead=void 0,this.hashPrevious=void 0,this.dataWindow=void 0,this.inputBuffer=void 0,this.pendingBufLength=void 0,this.pendingBufCache=void 0,this.pendingBufBitsInCache=void 0,this.bufferPosition=void 0,this.extraBits=void 0,this.currentHash=void 0,this.matchStart=void 0,this.matchLength=void 0,this.matchPrevAvail=void 0,this.blockStart=void 0,this.stringStart=void 0,this.lookAhead=void 0,this.totalBytesIn=void 0,this.inputOffset=void 0,this.inputEnd=void 0,this.windowSize=void 0,this.windowMask=void 0,this.hashSize=void 0,this.hashMask=void 0,this.hashShift=void 0,this.maxDist=void 0,this.checkSum=void 0,this.noWrap=void 0},t.isHuffmanTreeInitiated=!1,t}(),f=function(){function t(t,e,i,r){this.writer=t,this.codeMinCount=i,this.maxLength=r,this.codeFrequency=new Uint16Array(e),this.lengthCount=new Int32Array(r)}return Object.defineProperty(t.prototype,"treeLength",{get:function(){return this.codeCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeLengths",{get:function(){return this.codeLength},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeFrequencies",{get:function(){return this.codeFrequency},enumerable:!0,configurable:!0}),t.prototype.setStaticCodes=function(t,e){var i=new Int16Array(t.length);i.set(t,0),this.codes=i;var r=new Uint8Array(e.length);r.set(e,0),this.codeLength=r},t.prototype.reset=function(){for(var t=0;t<this.codeFrequency.length;t++)this.codeFrequency[t]=0;this.codes=void 0,this.codeLength=void 0},t.prototype.writeCodeToStream=function(t){this.writer.pendingBufferWriteBits(65535&this.codes[t],this.codeLength[t])},t.prototype.buildCodes=function(){var e=new Int32Array(this.maxLength);this.codes=new Int16Array(this.codeCount);for(var i=0,r=0;r<this.maxLength;r++)e[r]=i,i+=this.lengthCount[r]<<15-r;for(var n=0;n<this.codeCount;n++){var s=this.codeLength[n];s>0&&(this.codes[n]=t.bitReverse(e[s-1]),e[s-1]+=1<<16-s)}},t.bitReverse=function(e){return t.reverseBits[15&e]<<12|t.reverseBits[e>>4&15]<<8|t.reverseBits[e>>8&15]<<4|t.reverseBits[e>>12]},t.prototype.getEncodedLength=function(){for(var t=0,e=0;e<this.codeFrequency.length;e++)t+=this.codeFrequency[e]*this.codeLength[e];return t},t.prototype.calculateBLFreq=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var o=this.codeLength[s];for(0===o?(e=138,i=3):(e=6,i=3,n!==o&&(t.codeFrequency[o]++,r=0)),n=o,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););r<i?t.codeFrequency[n]+=r:0!==n?t.codeFrequency[16]++:r<=10?t.codeFrequency[17]++:t.codeFrequency[18]++}},t.prototype.writeTree=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var o=this.codeLength[s];for(0===o?(e=138,i=3):(e=6,i=3,n!==o&&(t.writeCodeToStream(o),r=0)),n=o,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););if(r<i)for(;r-- >0;)t.writeCodeToStream(n);else 0!==n?(t.writeCodeToStream(16),this.writer.pendingBufferWriteBits(r-3,2)):r<=10?(t.writeCodeToStream(17),this.writer.pendingBufferWriteBits(r-3,3)):(t.writeCodeToStream(18),this.writer.pendingBufferWriteBits(r-11,7))}},t.prototype.buildTree=function(){for(var t=this.codeFrequency.length,e=new Int32Array(t),i=0,r=0,n=0;n<t;n++){var s=this.codeFrequency[n];if(0!==s){for(var o=i++,h=0;o>0&&this.codeFrequency[e[h=Math.floor((o-1)/2)]]>s;)e[o]=e[h],o=h;e[o]=n,r=n}}for(;i<2;)e[i++]=r<2?++r:0;this.codeCount=Math.max(r+1,this.codeMinCount);for(var a=i,f=a,u=new Int32Array(4*i-2),c=new Int32Array(2*i-1),d=0;d<i;d++){var p=e[d],l=2*d;u[l]=p,u[l+1]=-1,c[d]=this.codeFrequency[p]<<8,e[d]=d}this.constructHuffmanTree(e,i,c,f,u),this.buildLength(u)},t.prototype.constructHuffmanTree=function(t,e,i,r,n){do{for(var s=t[0],o=t[--e],h=i[o],a=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[a]=t[f],a=f,f=2*a+1;for(;(f=a)>0&&i[t[a=Math.floor((f-1)/2)]]>h;)t[f]=t[a];t[f]=o;var u=t[0];o=r++,n[2*o]=s,n[2*o+1]=u;var c=Math.min(255&i[s],255&i[u]);for(i[o]=h=i[s]+i[u]-c+1,a=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[a]=t[f],a=f,f=2*a+1;for(;(f=a)>0&&i[t[a=Math.floor((f-1)/2)]]>h;)t[f]=t[a];t[f]=o}while(e>1)},t.prototype.buildLength=function(t){this.codeLength=new Uint8Array(this.codeFrequency.length);for(var e=Math.floor(t.length/2),i=Math.floor((e+1)/2),r=0,n=0;n<this.maxLength;n++)this.lengthCount[n]=0;if(0!==(r=this.calculateOptimalCodeLength(t,r,e))){var s=this.maxLength-1;do{for(;0===this.lengthCount[--s];);do{this.lengthCount[s]--,this.lengthCount[++s]++,r-=1<<this.maxLength-1-s}while(r>0&&s<this.maxLength-1)}while(r>0);this.recreateTree(t,r,i)}},t.prototype.recreateTree=function(t,e,i){this.lengthCount[this.maxLength-1]+=e,this.lengthCount[this.maxLength-2]-=e;for(var r=2*i,n=this.maxLength;0!==n;n--)for(var s=this.lengthCount[n-1];s>0;){var o=2*t[r++];-1===t[o+1]&&(this.codeLength[t[o]]=n,s--)}},t.prototype.calculateOptimalCodeLength=function(t,e,i){var r=new Int32Array(i);r[i-1]=0;for(var n=i-1;n>=0;n--){var s=2*n+1;if(-1!==t[s]){var o=r[n]+1;o>this.maxLength&&(o=this.maxLength,e++),r[t[s-1]]=r[t[s]]=o}else{var o=r[n];this.lengthCount[o-1]++,this.codeLength[t[s-1]]=r[n]}}return e},t.reverseBits=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],t.huffCodeLengthOrders=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],t}(),u=function(){function t(){}return t.checksumUpdate=function(e,i,r,n){var s=new Uint32Array(1);s[0]=e;for(var o=s[0],h=s[0]=65535&o,a=s[0]=o>>t.checkSumBitOffset;n>0;){var f=Math.min(n,t.checksumIterationCount);for(n-=f;--f>=0;)h+=s[0]=255&i[r++],a+=h;h%=t.checksumBase,a%=t.checksumBase}return o=a<<t.checkSumBitOffset|h},t.checkSumBitOffset=16,t.checksumBase=65521,t.checksumIterationCount=3800,t}()},function(e,i){e.exports=t},function(t,e,i){"use strict";i.d(e,"a",function(){return o}),i.d(e,"b",function(){return h});var r=i(0),n=i(1),s=(i.n(n),[]),o=function(){function t(){0===s.length&&t.initCrc32Table(),this.files=[],this.level="Normal",n.Save.isMicrosoftBrowser=!!navigator.msSaveBlob}return Object.defineProperty(t.prototype,"compressionLevel",{get:function(){return this.level},set:function(t){this.level=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return void 0===this.files?0:this.files.length},enumerable:!0,configurable:!0}),t.prototype.addItem=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: item cannot be null or undefined");for(var e=0;e<this.files.length;e++){var i=this.files[e];if(i instanceof h&&i.name===t.name)throw new Error("item with same name already exist")}this.files.push(t)},t.prototype.addDirectory=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: string cannot be null or undefined");if(0===t.length)throw new Error("ArgumentException: string cannot be empty");if("/"!==t.slice(-1)&&(t+="/"),-1!==this.files.indexOf(t))throw new Error("item with same name already exist");this.files.push(t)},t.prototype.getItem=function(t){if(t>=0&&t<this.files.length)return this.files[t]},t.prototype.contains=function(t){return-1!==this.files.indexOf(t)},t.prototype.save=function(t){if(null===t||void 0===t||0===t.length)throw new Error("ArgumentException: fileName cannot be null or undefined");if(0===this.files.length)throw new Error("InvalidOperation");var e=this;return new Promise(function(i,r){e.saveInternal(t,!1).then(function(){i(e)})})},t.prototype.saveAsBlob=function(){var t=this;return new Promise(function(e,i){t.saveInternal("",!0).then(function(t){e(t)})})},t.prototype.saveInternal=function(t,e){var i=this,r=this;return new Promise(function(n,s){for(var o=[],h=0,a=0;a<r.files.length;a++){i.getCompressedData(i.files[a]).then(function(i){if(h=r.constructZippedObject(o,i,h,i.isDirectory),o.length===r.files.length){var s=r.writeZippedContent(t,o,h,e);n(s)}})}})},t.prototype.destroy=function(){if(void 0!==this.files&&this.files.length>0){for(var t=0;t<this.files.length;t++){var e=this.files[t];e instanceof h&&e.destroy(),e=void 0}this.files=[]}this.files=void 0,this.level=void 0},t.prototype.getCompressedData=function(t){var e=this;return new Promise(function(i,r){if(t instanceof h){var n=new FileReader;n.onload=function(){var r=new Uint8Array(n.result),o={fileName:t.name,crc32Value:0,compressedData:[],compressedSize:void 0,uncompressedDataSize:r.length,compressionType:void 0,isDirectory:!1};if("Normal"===e.level){e.compressData(r,o,s);for(var h=0,a=0;a<o.compressedData.length;a++)h+=o.compressedData[a].length;o.compressedSize=h,o.compressionType="\b\0"}else o.compressedSize=r.length,o.crc32Value=e.calculateCrc32Value(0,r,s),o.compressionType="\0\0",o.compressedData.push(r);i(o)},n.readAsArrayBuffer(t.data)}else{i({fileName:t,crc32Value:0,compressedData:"",compressedSize:0,uncompressedDataSize:0,compressionType:"\0\0",isDirectory:!0})}})},t.prototype.compressData=function(t,e,i){var n=new r.a(!0),s=0,o=0;do{if(s>=t.length){n.close();break}o=Math.min(t.length,s+16384);var h=t.subarray(s,o);e.crc32Value=this.calculateCrc32Value(e.crc32Value,h,i),n.write(h,0,o-s),s=o}while(s<=t.length);e.compressedData=n.compressedData,n.destroy()},t.prototype.constructZippedObject=function(t,e,i,r){var n=0,s=new Date;r&&(n|=16),n|=0;var o=this.writeHeader(e,s),h="PK"+o+e.fileName,a=this.writeCentralDirectory(e,o,i,n);return t.push({localHeader:h,centralDir:a,compressedData:e}),i+h.length+e.compressedSize},t.prototype.writeHeader=function(t,e){var i="";return i+="\n\0\0\0",i+=t.compressionType,i+=this.getBytes(this.getModifiedTime(e),2),i+=this.getBytes(this.getModifiedDate(e),2),i+=this.getBytes(t.crc32Value,4),i+=this.getBytes(t.compressedSize,4),i+=this.getBytes(t.uncompressedDataSize,4),i+=this.getBytes(t.fileName.length,2),i+=this.getBytes(0,2)},t.prototype.writeZippedContent=function(t,e,i,r){for(var s=0,o=[],h=0;h<e.length;h++){var a=e[h];for(s+=a.centralDir.length,o.push(this.getArrayBuffer(a.localHeader));a.compressedData.compressedData.length;)o.push(a.compressedData.compressedData.shift().buffer)}for(var h=0;h<e.length;h++)o.push(this.getArrayBuffer(e[h].centralDir));o.push(this.getArrayBuffer(this.writeFooter(e,s,i)));var f=new Blob(o,{type:"application/zip"});return r||n.Save.save(t,f),f},t.prototype.writeCentralDirectory=function(t,e,i,r){return"PK"+this.getBytes(20,2)+e+this.getBytes(0,2)+"\0\0\0\0"+this.getBytes(r,4)+this.getBytes(i,4)+t.fileName},t.prototype.writeFooter=function(t,e,i){return"PK\0\0\0\0"+this.getBytes(t.length,2)+this.getBytes(t.length,2)+this.getBytes(e,4)+this.getBytes(i,4)+this.getBytes(0,2)},t.prototype.getArrayBuffer=function(t){for(var e=new Uint8Array(t.length),i=0;i<t.length;++i)e[i]=255&t.charCodeAt(i);return e.buffer},t.prototype.getBytes=function(t,e){for(var i="",r=0;r<e;r++)i+=String.fromCharCode(255&t),t>>>=8;return i},t.prototype.getModifiedTime=function(t){var e=t.getHours();return e<<=6,e|=t.getMinutes(),e<<=5,e|=t.getSeconds()/2},t.prototype.getModifiedDate=function(t){var e=t.getFullYear()-1980;return e<<=4,e|=t.getMonth()+1,e<<=5,e|=t.getDate()},t.prototype.calculateCrc32Value=function(t,e,i){t^=-1;for(var r=0;r<e.length;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},t.initCrc32Table=function(){for(var t,e=0;e<256;e++){t=e;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;s[e]=t}},t}(),h=function(){function t(t,e){if(null===t||void 0===t)throw new Error("ArgumentException: data cannot be null or undefined");if(null===e||void 0===e)throw new Error("ArgumentException: string cannot be null or undefined");if(0===e.length)throw new Error("string cannot be empty");this.data=t,this.name=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this.fileName},set:function(t){this.fileName=t},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.fileName=void 0,this.data=void 0},t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(2);i.d(e,"ZipArchive",function(){return r.a}),i.d(e,"ZipArchiveItem",function(){return r.b});var n=i(0);i.d(e,"CompressedStreamWriter",function(){return n.a}),i.d(e,"CompressorHuffmanTree",function(){return n.b}),i.d(e,"ChecksumCalculator",function(){return n.c})}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("SyncfusionFileUtils")):"function"==typeof define&&define.amd?define(["SyncfusionFileUtils"],e):"object"==typeof exports?exports.SyncfusionCompression=e(require("SyncfusionFileUtils")):t.SyncfusionCompression=e(t.SyncfusionFileUtils)}(this,function(t){return function(t){function e(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,r){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(t,e,i){"use strict";i.d(e,"a",function(){return r});var r=function(){function t(){}return t.bitReverse=function(e){return t.reverseBits[15&e]<<12|t.reverseBits[e>>4&15]<<8|t.reverseBits[e>>8&15]<<4|t.reverseBits[e>>12]},t.bitConverterToInt32=function(t,e){return t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24},t.bitConverterToInt16=function(t,e){return t[e]|t[e+1]<<8},t.bitConverterToUInt32=function(t){var e=new Uint32Array(1);return e[0]=t,e[0]},t.bitConverterToUInt16=function(t,e){var i=new Uint16Array(1);return i[0]=t[e]|t[e+1]<<8,i[0]},t.bitConverterUintToInt32=function(t){var e=new Int32Array(1);return e[0]=t,e[0]},t.bitConverterInt32ToUint=function(t){var e=new Uint32Array(1);return e[0]=t,e[0]},t.bitConverterInt32ToInt16=function(t){var e=new Int16Array(1);return e[0]=t,e[0]},t.byteToString=function(t){for(var e="",i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e},t.byteIntToString=function(t){for(var e="",i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e},t.arrayCopy=function(t,e,i,r,n){var s=new Uint8Array(t.buffer,e),o=s.subarray(0,n);i.set(o,r)},t.mergeArray=function(t,e){var i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i},t.encodedString=function(t){var e,i,r,n,s,o,a,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=0,u=0;t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");var c=3*t.length/4;if(t.charAt(t.length-1)===h.charAt(64)&&c--,t.charAt(t.length-2)===h.charAt(64)&&c--,c%1!=0)throw new Error("Invalid base64 input, bad content length.");for(var d=new Uint8Array(0|c);f<t.length;)n=h.indexOf(t.charAt(f++)),s=h.indexOf(t.charAt(f++)),o=h.indexOf(t.charAt(f++)),a=h.indexOf(t.charAt(f++)),e=n<<2|s>>4,i=(15&s)<<4|o>>2,r=(3&o)<<6|a,d[u++]=e,64!==o&&(d[u++]=i),64!==a&&(d[u++]=r);return d},t.reverseBits=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],t.huffCodeLengthOrders=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(6);i.d(e,"ZipArchive",function(){return r.a}),i.d(e,"ZipArchiveItemHelper",function(){return r.b}),i.d(e,"ZipArchiveItem",function(){return r.c});var n=i(5);i.d(e,"CompressedStreamWriter",function(){return n.a}),i.d(e,"CompressorHuffmanTree",function(){return n.b}),i.d(e,"ChecksumCalculator",function(){return n.c});var s=i(0);i.d(e,"Utils",function(){return s.a});var o=i(2);i.d(e,"DecompressorHuffmanTree",function(){return o.a});var a=i(4);i.d(e,"CompressedStreamReader",function(){return a.a}),i.d(e,"Stream",function(){return a.b})},function(t,e,i){"use strict";i.d(e,"a",function(){return n});var r=i(1),n=function(){function t(t){this.buildTree(t)}return t.init=function(){var e,i;for(e=new Uint8Array(288),i=0;i<144;)e[i++]=8;for(;i<256;)e[i++]=9;for(;i<280;)e[i++]=7;for(;i<288;)e[i++]=8;for(t.m_LengthTree=new t(e),e=new Uint8Array(32),i=0;i<32;)e[i++]=5;t.m_DistanceTree=new t(e)},t.prototype.prepareData=function(e,i,r){for(var n=0,s=512,o=0;o<r.length;o++){var a=r[o];a>0&&e[a]++}for(var h=1;h<=t.MAX_BITLEN;h++)if(i[h]=n,n+=e[h]<<16-h,h>=10){var f=130944&i[h],u=130944&n;s+=u-f>>16-h}return{code:n,treeSize:s}},t.prototype.treeFromData=function(e,i,n,s,o){for(var a=new Int16Array(o),h=512,f=t.MAX_BITLEN;f>=10;f--){var u=130944&s;s-=e[f]<<16-f;for(var c=130944&s,d=c;d<u;d+=128)a[r.Utils.bitReverse(d)]=r.Utils.bitConverterInt32ToInt16(-h<<4|f),h+=1<<f-9}for(var d=0;d<n.length;d++){var f=n[d];if(0!=f){s=i[f];var p=r.Utils.bitReverse(s);if(f<=9)do{a[p]=r.Utils.bitConverterInt32ToInt16(d<<4|f),p+=1<<f}while(p<512);else{var l=a[511&p],m=1<<(15&l);l=-(l>>4);do{a[l|p>>9]=r.Utils.bitConverterInt32ToInt16(d<<4|f),p+=1<<f}while(p<m)}i[f]=s+(1<<16-f)}}return a},t.prototype.buildTree=function(t){var e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=this.prepareData(e,i,t);this.m_Tree=this.treeFromData(e,i,t,r.code,r.treeSize)},t.prototype.unpackSymbol=function(t){var e,i;if((e=t.peekBits(9))>=0){if((i=this.m_Tree[e])>=0)return t.skipBits(15&i),i>>4;var r=-(i>>4),n=15&i;if((e=t.peekBits(n))>=0)return i=this.m_Tree[r|e>>9],t.skipBits(15&i),i>>4;var s=t.availableBits;return e=t.peekBits(s),i=this.m_Tree[r|e>>9],(15&i)<=s?(t.skipBits(15&i),i>>4):-1}var s=t.availableBits;return e=t.peekBits(s),i=this.m_Tree[e],i>=0&&(15&i)<=s?(t.skipBits(15&i),i>>4):-1},Object.defineProperty(t,"lengthTree",{get:function(){return this.m_LengthTree},enumerable:!0,configurable:!0}),Object.defineProperty(t,"distanceTree",{get:function(){return this.m_DistanceTree},enumerable:!0,configurable:!0}),t.MAX_BITLEN=15,t}()},function(e,i){e.exports=t},function(t,e,i){"use strict";i.d(e,"a",function(){return o}),i.d(e,"b",function(){return a});var r=i(2),n=i(0),s=i(7),o=function(){function t(t,e){if(this.defaultHuffmanDynamicTree=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],this.DEF_HEADER_METHOD_MASK=3840,this.DEF_HEADER_INFO_MASK=61440,this.DEF_HEADER_FLAGS_FCHECK=31,this.DEF_HEADER_FLAGS_FDICT=32,this.DEF_HEADER_FLAGS_FLEVEL=192,this.DEF_MAX_WINDOW_SIZE=65535,this.DEF_HUFFMAN_REPEATE_MAX=258,this.DEF_HUFFMAN_END_BLOCK=256,this.DEF_HUFFMAN_LENGTH_MINIMUMCODE=257,this.DEF_HUFFMAN_LENGTH_MAXIMUMCODE=285,this.DEF_HUFFMAN_DISTANCE_MAXIMUMCODE=29,this.mCheckSum=1,this.tBuffer=0,this.mBufferedBits=0,this.mTempBuffer=new Uint8Array(4),this.mBlockBuffer=new Uint8Array(this.DEF_MAX_WINDOW_SIZE),this.mbNoWrap=!1,this.mWindowSize=0,this.mCurrentPosition=0,this.mDataLength=0,this.mbCanReadNextBlock=!0,this.mbCanReadMoreData=!0,this.mbCheckSumRead=!1,null==t)throw new DOMException("stream");if(0===t.length)throw new DOMException("stream - string can not be empty");r.a.init(),this.mInputStream=new a(t),this.mbNoWrap=e,this.mbNoWrap||this.readZLibHeader(),this.decodeBlockHeader()}return Object.defineProperty(t.prototype,"mBuffer",{get:function(){return this.tBuffer},set:function(t){this.tBuffer=t},enumerable:!0,configurable:!0}),t.prototype.peekBits=function(t){if(t<0)throw new DOMException("count","Bits count can not be less than zero.");if(t>32)throw new DOMException("count","Count of bits is too large.");if(this.mBufferedBits<t&&this.fillBuffer(),this.mBufferedBits<t)return-1;var e=~(4294967295<<t);return n.a.bitConverterUintToInt32(this.mBuffer&e)},t.prototype.fillBuffer=function(){var t=4-(this.mBufferedBits>>3)-(0!=(7&this.mBufferedBits)?1:0);if(0!==t)for(var e=this.mInputStream.read(this.mTempBuffer,0,t),i=0;i<e;i++)this.mBuffer=n.a.bitConverterInt32ToUint(this.mBuffer|n.a.bitConverterInt32ToUint(this.mTempBuffer[i]<<this.mBufferedBits)),this.mBufferedBits+=8},t.prototype.skipBits=function(t){if(t<0)throw new DOMException("count","Bits count can not be less than zero.");0!==t&&(t>=this.mBufferedBits?(t-=this.mBufferedBits,this.mBufferedBits=0,this.mBuffer=0,t>0&&(this.mInputStream.position+=t>>3,(t&=7)>0&&(this.fillBuffer(),this.mBufferedBits-=t,this.mBuffer=n.a.bitConverterInt32ToUint(this.mBuffer>>>t)))):(this.mBufferedBits-=t,this.mBuffer=n.a.bitConverterInt32ToUint(this.mBuffer>>>t)))},Object.defineProperty(t.prototype,"availableBits",{get:function(){return this.mBufferedBits},enumerable:!0,configurable:!0}),t.prototype.readZLibHeader=function(){var t=this.readInt16();if(-1===t)throw new DOMException("Header of the stream can not be read.");if(t%31!=0)throw new DOMException("Header checksum illegal");if(2048!=(t&this.DEF_HEADER_METHOD_MASK))throw new DOMException("Unsupported compression method.");if(this.mWindowSize=Math.pow(2,8+((t&this.DEF_HEADER_INFO_MASK)>>12)),this.mWindowSize>65535)throw new DOMException("Unsupported window size for deflate compression method.");if((t&this.DEF_HEADER_FLAGS_FDICT)>>5==1)throw new DOMException("Custom dictionary is not supported at the moment.")},t.prototype.readInt16=function(){var t=this.readBits(8)<<8;return t|=this.readBits(8)},t.prototype.readBits=function(t){var e=this.peekBits(t);return-1===e?-1:(this.mBufferedBits-=t,this.mBuffer=n.a.bitConverterInt32ToUint(this.mBuffer>>>t),e)},t.prototype.decodeBlockHeader=function(){if(!this.mbCanReadNextBlock)return!1;var t=this.readBits(1);if(-1===t)return!1;var e=this.readBits(2);if(-1===e)return!1;switch(this.mbCanReadNextBlock=0===t,e){case 0:this.mbReadingUncompressed=!0,this.skipToBoundary();var i=this.readInt16Inverted();if(i!==(65535^this.readInt16Inverted()))throw new DOMException("Wrong block length.");if(i>65535)throw new DOMException("Uncompressed block length can not be more than 65535.");this.mUncompressedDataLength=i,this.mCurrentLengthTree=null,this.mCurrentDistanceTree=null;break;case 1:this.mbReadingUncompressed=!1,this.mUncompressedDataLength=-1,this.mCurrentLengthTree=r.a.lengthTree,this.mCurrentDistanceTree=r.a.distanceTree;break;case 2:this.mbReadingUncompressed=!1,this.mUncompressedDataLength=-1;var n=this.decodeDynamicHeader(this.mCurrentLengthTree,this.mCurrentDistanceTree);this.mCurrentLengthTree=n.lengthTree,this.mCurrentDistanceTree=n.distanceTree;break;default:throw new DOMException("Wrong block type.")}return!0},t.prototype.skipToBoundary=function(){this.mBuffer=n.a.bitConverterInt32ToUint(this.mBuffer>>>(7&this.mBufferedBits)),this.mBufferedBits&=-8},t.prototype.readInt16Inverted=function(){var t=this.readBits(8);return t|=this.readBits(8)<<8},t.prototype.decodeDynamicHeader=function(e,i){var n=0,s=this.readBits(5),o=this.readBits(5),a=this.readBits(4);if(s<0||o<0||a<0)throw new DOMException("Wrong dynamic huffman codes.");s+=257,o+=1;var h=s+o,f=new Uint8Array(h),u=new Uint8Array(19);a+=4;for(var c=0;c<a;){var d=this.readBits(3);if(d<0)throw new DOMException("Wrong dynamic huffman codes.");u[this.defaultHuffmanDynamicTree[c++]]=d}var p=new r.a(u);for(c=0;;){var l=void 0,m=!1;for(l=p.unpackSymbol(this);0==(-16&l);){if(f[c++]=n=l,c===h){m=!0;break}l=p.unpackSymbol(this)}if(m)break;if(l<0)throw new DOMException("Wrong dynamic huffman codes.");if(l>=17)n=0;else if(0===c)throw new DOMException("Wrong dynamic huffman codes.");var g=l-16,v=t.DEF_HUFFMAN_DYNTREE_REPEAT_BITS[g],y=this.readBits(v);if(y<0)throw new DOMException("Wrong dynamic huffman codes.");if(y+=t.DEF_HUFFMAN_DYNTREE_REPEAT_MINIMUMS[g],c+y>h)throw new DOMException("Wrong dynamic huffman codes.");for(;y-- >0;)f[c++]=n;if(c===h)break}var B=new Uint8Array(s);return B.set(f.subarray(0,s),0),e=new r.a(B),B=f.slice(s,s+o),i=new r.a(B),{lengthTree:e,distanceTree:i}},t.prototype.readHuffman=function(){for(var e=this.DEF_MAX_WINDOW_SIZE-(this.mDataLength-this.mCurrentPosition),i=!1,r={};e>=this.DEF_HUFFMAN_REPEATE_MAX;){var n=void 0;for(n=this.mCurrentLengthTree.unpackSymbol(this);0==(-256&n);){if(r[(this.mDataLength+1)%this.DEF_MAX_WINDOW_SIZE]=n,this.mBlockBuffer[this.mDataLength++%this.DEF_MAX_WINDOW_SIZE]=n,i=!0,--e<this.DEF_HUFFMAN_REPEATE_MAX)return!0;n=this.mCurrentLengthTree.unpackSymbol(this)}if(n<this.DEF_HUFFMAN_LENGTH_MINIMUMCODE){if(n<this.DEF_HUFFMAN_END_BLOCK)throw new DOMException("Illegal code.");var s=i?1:0;this.mbCanReadMoreData=this.decodeBlockHeader();return!!(s|(this.mbCanReadMoreData?1:0))}if(n>this.DEF_HUFFMAN_LENGTH_MAXIMUMCODE)throw new DOMException("Illegal repeat code length.");var o=t.DEF_HUFFMAN_REPEAT_LENGTH_BASE[n-this.DEF_HUFFMAN_LENGTH_MINIMUMCODE],a=t.DEF_HUFFMAN_REPEAT_LENGTH_EXTENSION[n-this.DEF_HUFFMAN_LENGTH_MINIMUMCODE];if(a>0){var h=this.readBits(a);if(h<0)throw new DOMException("Wrong data.");o+=h}if((n=this.mCurrentDistanceTree.unpackSymbol(this))<0||n>t.DEF_HUFFMAN_REPEAT_DISTANCE_BASE.length)throw new DOMException("Wrong distance code.");var f=t.DEF_HUFFMAN_REPEAT_DISTANCE_BASE[n];if((a=t.DEF_HUFFMAN_REPEAT_DISTANCE_EXTENSION[n])>0){var h=this.readBits(a);if(h<0)throw new DOMException("Wrong data.");f+=h}for(var u=0;u<o;u++)this.mBlockBuffer[this.mDataLength%this.DEF_MAX_WINDOW_SIZE]=this.mBlockBuffer[(this.mDataLength-f)%this.DEF_MAX_WINDOW_SIZE],this.mDataLength++,e--;i=!0}return i},t.prototype.read=function(t,e,i){if(null==t)throw new DOMException("buffer");if(e<0||e>t.length-1)throw new DOMException("offset","Offset does not belong to specified buffer.");if(i<0||i>t.length-e)throw new DOMException("length","Length is illegal.");for(var r=i;i>0;)if(this.mCurrentPosition<this.mDataLength){var s=this.mCurrentPosition%this.DEF_MAX_WINDOW_SIZE,o=Math.min(this.DEF_MAX_WINDOW_SIZE-s,this.mDataLength-this.mCurrentPosition);o=Math.min(o,i),n.a.arrayCopy(this.mBlockBuffer,s,t,e,o),this.mCurrentPosition+=o,e+=o,i-=o}else{if(!this.mbCanReadMoreData)break;var a=this.mDataLength;if(this.mbReadingUncompressed)if(0===this.mUncompressedDataLength){if(this.mbCanReadMoreData=this.decodeBlockHeader(),!this.mbCanReadMoreData)break}else{var s=this.mDataLength%this.DEF_MAX_WINDOW_SIZE,h=Math.min(this.mUncompressedDataLength,this.DEF_MAX_WINDOW_SIZE-s),f=this.readPackedBytes(this.mBlockBuffer,s,h);if(h!==f)throw new DOMException("Not enough data in stream.");this.mUncompressedDataLength-=f,this.mDataLength+=f}else if(!this.readHuffman())break;if(a<this.mDataLength){var u=a%this.DEF_MAX_WINDOW_SIZE,c=this.mDataLength%this.DEF_MAX_WINDOW_SIZE;u<c?this.checksumUpdate(this.mBlockBuffer,u,c-u):(this.checksumUpdate(this.mBlockBuffer,u,this.DEF_MAX_WINDOW_SIZE-u),c>0&&this.checksumUpdate(this.mBlockBuffer,0,c))}}if(!this.mbCanReadMoreData&&!this.mbCheckSumRead&&!this.mbNoWrap){this.skipToBoundary();if(this.readInt32()!==this.mCheckSum)throw new DOMException("Checksum check failed.");this.mbCheckSumRead=!0}return r-i},t.prototype.readPackedBytes=function(t,e,i){if(null==t)throw new DOMException("buffer");if(e<0||e>t.length-1)throw new DOMException('offset", "Offset can not be less than zero or greater than buffer length - 1.');if(i<0)throw new DOMException('length", "Length can not be less than zero.');if(i>t.length-e)throw new DOMException('length", "Length is too large.');if(0!=(7&this.mBufferedBits))throw new DOMException("Reading of unalligned data is not supported.");if(0===i)return 0;for(var r=0;this.mBufferedBits>0&&i>0;)t[e++]=this.mBuffer,this.mBufferedBits-=8,this.mBuffer=n.a.bitConverterInt32ToUint(this.mBuffer>>>8),i--,r++;return i>0&&(r+=this.mInputStream.read(t,e,i)),r},t.prototype.readInt32=function(){var t=this.readBits(8)<<24;return t|=this.readBits(8)<<16,t|=this.readBits(8)<<8,t|=this.readBits(8)},t.prototype.checksumUpdate=function(t,e,i){s.a.ChecksumUpdate(this.mCheckSum,t,e,i)},t.DEF_REVERSE_BITS=new Uint8Array([0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15]),t.DEF_HUFFMAN_DYNTREE_REPEAT_MINIMUMS=[3,3,11],t.DEF_HUFFMAN_DYNTREE_REPEAT_BITS=[2,3,7],t.DEF_HUFFMAN_REPEAT_LENGTH_BASE=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],t.DEF_HUFFMAN_REPEAT_LENGTH_EXTENSION=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],t.DEF_HUFFMAN_REPEAT_DISTANCE_BASE=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],t.DEF_HUFFMAN_REPEAT_DISTANCE_EXTENSION=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],t}(),a=function(){function t(t){this.position=0,this.inputStream=new Uint8Array(t.buffer)}return Object.defineProperty(t.prototype,"length",{get:function(){return this.inputStream.buffer.byteLength},enumerable:!0,configurable:!0}),t.prototype.read=function(t,e,i){var r=new Uint8Array(this.inputStream.buffer,this.position+e),n=r.subarray(0,i);return t.set(n,0),this.position+=n.byteLength,n.byteLength},t.prototype.readByte=function(){return this.inputStream[this.position++]},t.prototype.write=function(t,e,i){n.a.arrayCopy(t,0,this.inputStream,this.position+e,i),this.position+=i},t.prototype.toByteArray=function(){return new Uint8Array(this.inputStream.buffer)},t}()},function(t,e,i){"use strict";i.d(e,"a",function(){return h}),i.d(e,"b",function(){return f}),i.d(e,"c",function(){return u});var r=i(3),n=(i.n(r),new Int16Array(286)),s=new Uint8Array(286),o=new Int16Array(30),a=new Uint8Array(30),h=function(){function t(e){this.pendingBuffer=new Uint8Array(65536),this.pendingBufLength=0,this.pendingBufCache=0,this.pendingBufBitsInCache=0,this.bufferPosition=0,this.extraBits=0,this.currentHash=0,this.matchStart=0,this.matchLength=0,this.matchPrevAvail=!1,this.blockStart=0,this.stringStart=0,this.lookAhead=0,this.totalBytesIn=0,this.inputOffset=0,this.inputEnd=0,this.windowSize=32768,this.windowMask=this.windowSize-1,this.hashSize=32768,this.hashMask=this.hashSize-1,this.hashShift=Math.floor(17/3),this.maxDist=this.windowSize-262,this.checkSum=1,this.noWrap=!1,t.isHuffmanTreeInitiated||(t.initHuffmanTree(),t.isHuffmanTreeInitiated=!0),this.treeLiteral=new f(this,286,257,15),this.treeDistances=new f(this,30,1,15),this.treeCodeLengths=new f(this,19,4,7),this.arrDistances=new Uint16Array(16384),this.arrLiterals=new Uint8Array(16384),this.stream=[],this.dataWindow=new Uint8Array(2*this.windowSize),this.hashHead=new Int16Array(this.hashSize),this.hashPrevious=new Int16Array(this.windowSize),this.blockStart=this.stringStart=1,this.noWrap=e,e||this.writeZLibHeader()}return Object.defineProperty(t.prototype,"compressedData",{get:function(){return this.stream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"getCompressedString",{get:function(){var t="";if(void 0!==this.stream)for(var e=0;e<this.stream.length;e++)t+=String.fromCharCode.apply(null,this.stream[e]);return t},enumerable:!0,configurable:!0}),t.prototype.write=function(t,e,i){if(void 0===t||null===t)throw new Error("ArgumentException: data cannot null or undefined");var n=e+i;if(0>e||e>n||n>t.length)throw new Error("ArgumentOutOfRangeException: Offset or length is incorrect");if("string"==typeof t){var s=new r.Encoding(!1);s.type="Utf8",t=new Uint8Array(s.getBytes(t,0,t.length)),n=e+t.length}for(this.inputBuffer=t,this.inputOffset=e,this.inputEnd=n,this.noWrap||(this.checkSum=u.checksumUpdate(this.checkSum,this.inputBuffer,this.inputOffset,n));this.inputEnd!==this.inputOffset||0!==this.pendingBufLength;)this.pendingBufferFlush(),this.compressData(!1)},t.prototype.writeZLibHeader=function(){var t=30720;t|=64,t+=31-t%31,this.pendingBufferWriteShortBytes(t)},t.prototype.pendingBufferWriteShortBytes=function(t){this.pendingBuffer[this.pendingBufLength++]=t>>8,this.pendingBuffer[this.pendingBufLength++]=t},t.prototype.compressData=function(t){var e;do{this.fillWindow();var i=t&&this.inputEnd===this.inputOffset;e=this.compressSlow(i,t)}while(0===this.pendingBufLength&&e);return e},t.prototype.compressSlow=function(t,e){if(this.lookAhead<262&&!t)return!1;for(;this.lookAhead>=262||t;){if(0===this.lookAhead)return this.lookAheadCompleted(e);this.stringStart>=2*this.windowSize-262&&this.slideWindow();var i=this.matchStart,r=this.matchLength;if(this.lookAhead>=3&&this.discardMatch(),r>=3&&this.matchLength<=r?r=this.matchPreviousBest(i,r):this.matchPreviousAvailable(),this.bufferPosition>=16384)return this.huffmanIsFull(e)}return!0},t.prototype.discardMatch=function(){var t=this.insertString();0!==t&&this.stringStart-t<=this.maxDist&&this.findLongestMatch(t)&&this.matchLength<=5&&3===this.matchLength&&this.stringStart-this.matchStart>4096&&(this.matchLength=2)},t.prototype.matchPreviousAvailable=function(){this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!0,this.stringStart++,this.lookAhead--},t.prototype.matchPreviousBest=function(t,e){this.huffmanTallyDist(this.stringStart-1-t,e),e-=2;do{this.stringStart++,--this.lookAhead>=3&&this.insertString()}while(--e>0);return this.stringStart++,this.lookAhead--,this.matchPrevAvail=!1,this.matchLength=2,e},t.prototype.lookAheadCompleted=function(t){return this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!1,this.huffmanFlushBlock(this.dataWindow,this.blockStart,this.stringStart-this.blockStart,t),this.blockStart=this.stringStart,!1},t.prototype.huffmanIsFull=function(t){var e=this.stringStart-this.blockStart;this.matchPrevAvail&&e--;var i=t&&0===this.lookAhead&&!this.matchPrevAvail;return this.huffmanFlushBlock(this.dataWindow,this.blockStart,e,i),this.blockStart+=e,!i},t.prototype.fillWindow=function(){for(this.stringStart>=this.windowSize+this.maxDist&&this.slideWindow();this.lookAhead<262&&this.inputOffset<this.inputEnd;){var t=2*this.windowSize-this.lookAhead-this.stringStart;t>this.inputEnd-this.inputOffset&&(t=this.inputEnd-this.inputOffset),this.dataWindow.set(this.inputBuffer.subarray(this.inputOffset,this.inputOffset+t),this.stringStart+this.lookAhead),this.inputOffset+=t,this.totalBytesIn+=t,this.lookAhead+=t}this.lookAhead>=3&&this.updateHash()},t.prototype.slideWindow=function(){this.dataWindow.set(this.dataWindow.subarray(this.windowSize,this.windowSize+this.windowSize),0),this.matchStart-=this.windowSize,this.stringStart-=this.windowSize,this.blockStart-=this.windowSize;for(var t=0;t<this.hashSize;++t){var e=65535&this.hashHead[t];this.hashHead[t]=e>=this.windowSize?e-this.windowSize:0}for(var t=0;t<this.windowSize;t++){var e=65535&this.hashPrevious[t];this.hashPrevious[t]=e>=this.windowSize?e-this.windowSize:0}},t.prototype.insertString=function(){var t,e=(this.currentHash<<this.hashShift^this.dataWindow[this.stringStart+2])&this.hashMask;return this.hashPrevious[this.stringStart&this.windowMask]=t=this.hashHead[e],this.hashHead[e]=this.stringStart,this.currentHash=e,65535&t},t.prototype.findLongestMatch=function(t){var e,i=4096,r=258,n=this.stringStart,s=this.stringStart+this.matchLength,o=Math.max(this.matchLength,2),a=Math.max(this.stringStart-this.maxDist,0),h=this.stringStart+258-1,f=this.dataWindow[s-1],u=this.dataWindow[s],c=this.dataWindow;o>=32&&(i>>=2),r>this.lookAhead&&(r=this.lookAhead);do{if(c[t+o]===u&&c[t+o-1]===f&&c[t]===c[n]&&c[t+1]===c[n+1]){for(e=t+2,n+=2;c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&n<h;);if(n>s){if(this.matchStart=t,s=n,(o=n-this.stringStart)>=r)break;f=c[s-1],u=c[s]}n=this.stringStart}}while((t=65535&this.hashPrevious[t&this.windowMask])>a&&0!=--i);return this.matchLength=Math.min(o,this.lookAhead),this.matchLength>=3},t.prototype.updateHash=function(){this.currentHash=this.dataWindow[this.stringStart]<<this.hashShift^this.dataWindow[this.stringStart+1]},t.prototype.huffmanTallyLit=function(t){return this.arrDistances[this.bufferPosition]=0,this.arrLiterals[this.bufferPosition++]=t,this.treeLiteral.codeFrequencies[t]++,this.bufferPosition>=16384},t.prototype.huffmanTallyDist=function(t,e){this.arrDistances[this.bufferPosition]=t,this.arrLiterals[this.bufferPosition++]=e-3;var i=this.huffmanLengthCode(e-3);this.treeLiteral.codeFrequencies[i]++,i>=265&&i<285&&(this.extraBits+=Math.floor((i-261)/4));var r=this.huffmanDistanceCode(t-1);return this.treeDistances.codeFrequencies[r]++,r>=4&&(this.extraBits+=Math.floor(r/2-1)),this.bufferPosition>=16384},t.prototype.huffmanFlushBlock=function(t,e,i,r){this.treeLiteral.codeFrequencies[256]++,this.treeLiteral.buildTree(),this.treeDistances.buildTree(),this.treeLiteral.calculateBLFreq(this.treeCodeLengths),this.treeDistances.calculateBLFreq(this.treeCodeLengths),this.treeCodeLengths.buildTree();for(var h=4,u=18;u>h;u--)this.treeCodeLengths.codeLengths[f.huffCodeLengthOrders[u]]>0&&(h=u+1);for(var c=14+3*h+this.treeCodeLengths.getEncodedLength()+this.treeLiteral.getEncodedLength()+this.treeDistances.getEncodedLength()+this.extraBits,d=this.extraBits,u=0;u<286;u++)d+=this.treeLiteral.codeFrequencies[u]*s[u];for(var u=0;u<30;u++)d+=this.treeDistances.codeFrequencies[u]*a[u];c>=d&&(c=d),e>=0&&i+4<c>>3?this.huffmanFlushStoredBlock(t,e,i,r):c==d?(this.pendingBufferWriteBits(2+(r?1:0),3),this.treeLiteral.setStaticCodes(n,s),this.treeDistances.setStaticCodes(o,a),this.huffmanCompressBlock(),this.huffmanReset()):(this.pendingBufferWriteBits(4+(r?1:0),3),this.huffmanSendAllTrees(h),this.huffmanCompressBlock(),this.huffmanReset())},t.prototype.huffmanFlushStoredBlock=function(t,e,i,r){this.pendingBufferWriteBits(0+(r?1:0),3),this.pendingBufferAlignToByte(),this.pendingBufferWriteShort(i),this.pendingBufferWriteShort(~i),this.pendingBufferWriteByteBlock(t,e,i),this.huffmanReset()},t.prototype.huffmanLengthCode=function(t){if(255===t)return 285;for(var e=257;t>=8;)e+=4,t>>=1;return e+t},t.prototype.huffmanDistanceCode=function(t){for(var e=0;t>=4;)e+=2,t>>=1;return e+t},t.prototype.huffmanSendAllTrees=function(t){this.treeCodeLengths.buildCodes(),this.treeLiteral.buildCodes(),this.treeDistances.buildCodes(),this.pendingBufferWriteBits(this.treeLiteral.treeLength-257,5),this.pendingBufferWriteBits(this.treeDistances.treeLength-1,5),this.pendingBufferWriteBits(t-4,4);for(var e=0;e<t;e++)this.pendingBufferWriteBits(this.treeCodeLengths.codeLengths[f.huffCodeLengthOrders[e]],3);this.treeLiteral.writeTree(this.treeCodeLengths),this.treeDistances.writeTree(this.treeCodeLengths)},t.prototype.huffmanReset=function(){this.bufferPosition=0,this.extraBits=0,this.treeLiteral.reset(),this.treeDistances.reset(),this.treeCodeLengths.reset()},t.prototype.huffmanCompressBlock=function(){for(var t=0;t<this.bufferPosition;t++){var e=255&this.arrLiterals[t],i=this.arrDistances[t];if(0!=i--){var r=this.huffmanLengthCode(e);this.treeLiteral.writeCodeToStream(r);var n=Math.floor((r-261)/4);n>0&&n<=5&&this.pendingBufferWriteBits(e&(1<<n)-1,n);var s=this.huffmanDistanceCode(i);this.treeDistances.writeCodeToStream(s),n=Math.floor(s/2-1),n>0&&this.pendingBufferWriteBits(i&(1<<n)-1,n)}else this.treeLiteral.writeCodeToStream(e)}this.treeLiteral.writeCodeToStream(256)},t.prototype.pendingBufferWriteBits=function(t,e){var i=new Uint32Array(1);i[0]=this.pendingBufCache|t<<this.pendingBufBitsInCache,this.pendingBufCache=i[0],this.pendingBufBitsInCache+=e,this.pendingBufferFlushBits()},t.prototype.pendingBufferFlush=function(t){if(this.pendingBufferFlushBits(),this.pendingBufLength>0){var e=new Uint8Array(this.pendingBufLength);e.set(this.pendingBuffer.subarray(0,this.pendingBufLength),0),this.stream.push(e)}this.pendingBufLength=0},t.prototype.pendingBufferFlushBits=function(){for(var t=0;this.pendingBufBitsInCache>=8&&this.pendingBufLength<65536;)this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache,this.pendingBufCache>>=8,this.pendingBufBitsInCache-=8,t++;return t},t.prototype.pendingBufferWriteByteBlock=function(t,e,i){var r=t.subarray(e,e+i);this.pendingBuffer.set(r,this.pendingBufLength),this.pendingBufLength+=i},t.prototype.pendingBufferWriteShort=function(t){this.pendingBuffer[this.pendingBufLength++]=t,this.pendingBuffer[this.pendingBufLength++]=t>>8},t.prototype.pendingBufferAlignToByte=function(){this.pendingBufBitsInCache>0&&(this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache),this.pendingBufCache=0,this.pendingBufBitsInCache=0},t.initHuffmanTree=function(){for(var t=0;t<144;)n[t]=f.bitReverse(48+t<<8),s[t++]=8;for(;t<256;)n[t]=f.bitReverse(256+t<<7),s[t++]=9;for(;t<280;)n[t]=f.bitReverse(-256+t<<9),s[t++]=7;for(;t<286;)n[t]=f.bitReverse(-88+t<<8),s[t++]=8;for(t=0;t<30;t++)o[t]=f.bitReverse(t<<11),a[t]=5},t.prototype.close=function(){do{this.pendingBufferFlush(!0),this.compressData(!0)||(this.pendingBufferFlush(!0),this.pendingBufferAlignToByte(),this.noWrap||(this.pendingBufferWriteShortBytes(this.checkSum>>16),this.pendingBufferWriteShortBytes(65535&this.checkSum)),this.pendingBufferFlush(!0))}while(this.inputEnd!==this.inputOffset||0!==this.pendingBufLength)},t.prototype.destroy=function(){this.stream=[],this.stream=void 0,this.pendingBuffer=void 0,this.treeLiteral=void 0,this.treeDistances=void 0,this.treeCodeLengths=void 0,this.arrLiterals=void 0,this.arrDistances=void 0,this.hashHead=void 0,this.hashPrevious=void 0,this.dataWindow=void 0,this.inputBuffer=void 0,this.pendingBufLength=void 0,this.pendingBufCache=void 0,this.pendingBufBitsInCache=void 0,this.bufferPosition=void 0,this.extraBits=void 0,this.currentHash=void 0,this.matchStart=void 0,this.matchLength=void 0,this.matchPrevAvail=void 0,this.blockStart=void 0,this.stringStart=void 0,this.lookAhead=void 0,this.totalBytesIn=void 0,this.inputOffset=void 0,this.inputEnd=void 0,this.windowSize=void 0,this.windowMask=void 0,this.hashSize=void 0,this.hashMask=void 0,this.hashShift=void 0,this.maxDist=void 0,this.checkSum=void 0,this.noWrap=void 0},t.isHuffmanTreeInitiated=!1,t}(),f=function(){function t(t,e,i,r){this.writer=t,this.codeMinCount=i,this.maxLength=r,this.codeFrequency=new Uint16Array(e),this.lengthCount=new Int32Array(r)}return Object.defineProperty(t.prototype,"treeLength",{get:function(){return this.codeCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeLengths",{get:function(){return this.codeLength},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeFrequencies",{get:function(){return this.codeFrequency},enumerable:!0,configurable:!0}),t.prototype.setStaticCodes=function(t,e){var i=new Int16Array(t.length);i.set(t,0),this.codes=i;var r=new Uint8Array(e.length);r.set(e,0),this.codeLength=r},t.prototype.reset=function(){for(var t=0;t<this.codeFrequency.length;t++)this.codeFrequency[t]=0;this.codes=void 0,this.codeLength=void 0},t.prototype.writeCodeToStream=function(t){this.writer.pendingBufferWriteBits(65535&this.codes[t],this.codeLength[t])},t.prototype.buildCodes=function(){var e=new Int32Array(this.maxLength);this.codes=new Int16Array(this.codeCount);for(var i=0,r=0;r<this.maxLength;r++)e[r]=i,i+=this.lengthCount[r]<<15-r;for(var n=0;n<this.codeCount;n++){var s=this.codeLength[n];s>0&&(this.codes[n]=t.bitReverse(e[s-1]),e[s-1]+=1<<16-s)}},t.bitReverse=function(e){return t.reverseBits[15&e]<<12|t.reverseBits[e>>4&15]<<8|t.reverseBits[e>>8&15]<<4|t.reverseBits[e>>12]},t.prototype.getEncodedLength=function(){for(var t=0,e=0;e<this.codeFrequency.length;e++)t+=this.codeFrequency[e]*this.codeLength[e];return t},t.prototype.calculateBLFreq=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var o=this.codeLength[s];for(0===o?(e=138,i=3):(e=6,i=3,n!==o&&(t.codeFrequency[o]++,r=0)),n=o,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););r<i?t.codeFrequency[n]+=r:0!==n?t.codeFrequency[16]++:r<=10?t.codeFrequency[17]++:t.codeFrequency[18]++}},t.prototype.writeTree=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var o=this.codeLength[s];for(0===o?(e=138,i=3):(e=6,i=3,n!==o&&(t.writeCodeToStream(o),r=0)),n=o,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););if(r<i)for(;r-- >0;)t.writeCodeToStream(n);else 0!==n?(t.writeCodeToStream(16),this.writer.pendingBufferWriteBits(r-3,2)):r<=10?(t.writeCodeToStream(17),this.writer.pendingBufferWriteBits(r-3,3)):(t.writeCodeToStream(18),this.writer.pendingBufferWriteBits(r-11,7))}},t.prototype.buildTree=function(){for(var t=this.codeFrequency.length,e=new Int32Array(t),i=0,r=0,n=0;n<t;n++){var s=this.codeFrequency[n];if(0!==s){for(var o=i++,a=0;o>0&&this.codeFrequency[e[a=Math.floor((o-1)/2)]]>s;)e[o]=e[a],o=a;e[o]=n,r=n}}for(;i<2;)e[i++]=r<2?++r:0;this.codeCount=Math.max(r+1,this.codeMinCount);for(var h=i,f=h,u=new Int32Array(4*i-2),c=new Int32Array(2*i-1),d=0;d<i;d++){var p=e[d],l=2*d;u[l]=p,u[l+1]=-1,c[d]=this.codeFrequency[p]<<8,e[d]=d}this.constructHuffmanTree(e,i,c,f,u),this.buildLength(u)},t.prototype.constructHuffmanTree=function(t,e,i,r,n){do{for(var s=t[0],o=t[--e],a=i[o],h=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[h]=t[f],h=f,f=2*h+1;for(;(f=h)>0&&i[t[h=Math.floor((f-1)/2)]]>a;)t[f]=t[h];t[f]=o;var u=t[0];o=r++,n[2*o]=s,n[2*o+1]=u;var c=Math.min(255&i[s],255&i[u]);for(i[o]=a=i[s]+i[u]-c+1,h=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[h]=t[f],h=f,f=2*h+1;for(;(f=h)>0&&i[t[h=Math.floor((f-1)/2)]]>a;)t[f]=t[h];t[f]=o}while(e>1)},t.prototype.buildLength=function(t){this.codeLength=new Uint8Array(this.codeFrequency.length);for(var e=Math.floor(t.length/2),i=Math.floor((e+1)/2),r=0,n=0;n<this.maxLength;n++)this.lengthCount[n]=0;if(0!==(r=this.calculateOptimalCodeLength(t,r,e))){var s=this.maxLength-1;do{for(;0===this.lengthCount[--s];);do{this.lengthCount[s]--,this.lengthCount[++s]++,r-=1<<this.maxLength-1-s}while(r>0&&s<this.maxLength-1)}while(r>0);this.recreateTree(t,r,i)}},t.prototype.recreateTree=function(t,e,i){this.lengthCount[this.maxLength-1]+=e,this.lengthCount[this.maxLength-2]-=e;for(var r=2*i,n=this.maxLength;0!==n;n--)for(var s=this.lengthCount[n-1];s>0;){var o=2*t[r++];-1===t[o+1]&&(this.codeLength[t[o]]=n,s--)}},t.prototype.calculateOptimalCodeLength=function(t,e,i){var r=new Int32Array(i);r[i-1]=0;for(var n=i-1;n>=0;n--){var s=2*n+1;if(-1!==t[s]){var o=r[n]+1;o>this.maxLength&&(o=this.maxLength,e++),r[t[s-1]]=r[t[s]]=o}else{var o=r[n];this.lengthCount[o-1]++,this.codeLength[t[s-1]]=r[n]}}return e},t.reverseBits=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],t.huffCodeLengthOrders=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],t}(),u=function(){function t(){}return t.checksumUpdate=function(e,i,r,n){var s=new Uint32Array(1);s[0]=e;for(var o=s[0],a=s[0]=65535&o,h=s[0]=o>>t.checkSumBitOffset;n>0;){var f=Math.min(n,t.checksumIterationCount);for(n-=f;--f>=0;)a+=s[0]=255&i[r++],h+=a;a%=t.checksumBase,h%=t.checksumBase}return o=h<<t.checkSumBitOffset|a},t.checkSumBitOffset=16,t.checksumBase=65521,t.checksumIterationCount=3800,t}()},function(t,e,i){"use strict";i.d(e,"a",function(){return a}),i.d(e,"b",function(){return h}),i.d(e,"c",function(){return f});var r=i(1),n=i(3),s=(i.n(n),i(0)),o=[],a=function(){function t(){0===o.length&&t.initCrc32Table(),this.files=[],this.level="Normal",n.Save.isMicrosoftBrowser=!!navigator.msSaveBlob}return Object.defineProperty(t.prototype,"items",{get:function(){return this.files},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compressionLevel",{get:function(){return this.level},set:function(t){this.level=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return void 0===this.files?0:this.files.length},enumerable:!0,configurable:!0}),t.prototype.addItem=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: item cannot be null or undefined");for(var e=0;e<this.files.length;e++){var i=this.files[e];if(i instanceof f&&i.name===t.name)throw new Error("item with same name already exist")}this.files.push(t)},t.prototype.addDirectory=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: string cannot be null or undefined");if(0===t.length)throw new Error("ArgumentException: string cannot be empty");if("/"!==t.slice(-1)&&(t+="/"),-1!==this.files.indexOf(t))throw new Error("item with same name already exist");this.files.push(t)},t.prototype.getItem=function(t){if(t>=0&&t<this.files.length)return this.files[t]},t.prototype.contains=function(t){return-1!==this.files.indexOf(t)},t.prototype.open=function(e){var i=s.a.encodedString(e);if(0==i.length)throw new DOMException("stream");var n=new r.Stream(i),o=t.findValueFromEnd(n,101010256,65557);if(o<0)throw new DOMException("Can't locate end of central directory record. Possible wrong file format or archive is corrupt.");n.position=o+12;var a=t.ReadInt32(n),h=o-a;n.position=h,this.readCentralDirectoryDataAndExtractItems(n)},t.prototype.readCentralDirectoryDataAndExtractItems=function(e){if(null==e)throw new DOMException("stream");for(var i;33639248==t.ReadInt32(e);)i=new h,i.readCentralDirectoryData(e);i.readData(e,i.checkCrc),i.decompressData(),this.files.push(new f(i.unCompressedStream.buffer,i.name))},t.prototype.save=function(t){if(null===t||void 0===t||0===t.length)throw new Error("ArgumentException: fileName cannot be null or undefined");if(0===this.files.length)throw new Error("InvalidOperation");var e=this;return new Promise(function(i,r){e.saveInternal(t,!1).then(function(){i(e)})})},t.prototype.saveAsBlob=function(){var t=this;return new Promise(function(e,i){t.saveInternal("",!0).then(function(t){e(t)})})},t.prototype.saveInternal=function(t,e){var i=this,r=this;return new Promise(function(n,s){for(var o=[],a=0,h=0;h<r.files.length;h++){i.getCompressedData(i.files[h]).then(function(i){if(a=r.constructZippedObject(o,i,a,i.isDirectory),o.length===r.files.length){var s=r.writeZippedContent(t,o,a,e);n(s)}})}})},t.prototype.destroy=function(){if(void 0!==this.files&&this.files.length>0){for(var t=0;t<this.files.length;t++){var e=this.files[t];e instanceof f&&e.destroy(),e=void 0}this.files=[]}this.files=void 0,this.level=void 0},t.prototype.getCompressedData=function(t){var e=this;return new Promise(function(i,r){if(t instanceof f){var n=new FileReader;n.onload=function(){var r=new Uint8Array(n.result),s={fileName:t.name,crc32Value:0,compressedData:[],compressedSize:void 0,uncompressedDataSize:r.length,compressionType:void 0,isDirectory:!1};if("Normal"===e.level){e.compressData(r,s,o);for(var a=0,h=0;h<s.compressedData.length;h++)a+=s.compressedData[h].length;s.compressedSize=a,s.compressionType="\b\0"}else s.compressedSize=r.length,s.crc32Value=e.calculateCrc32Value(0,r,o),s.compressionType="\0\0",s.compressedData.push(r);i(s)},n.readAsArrayBuffer(t.data)}else{i({fileName:t,crc32Value:0,compressedData:"",compressedSize:0,uncompressedDataSize:0,compressionType:"\0\0",isDirectory:!0})}})},t.prototype.compressData=function(t,e,i){var n=new r.CompressedStreamWriter(!0),s=0,o=0;do{if(s>=t.length){n.close();break}o=Math.min(t.length,s+16384);var a=t.subarray(s,o);e.crc32Value=this.calculateCrc32Value(e.crc32Value,a,i),n.write(a,0,o-s),s=o}while(s<=t.length);e.compressedData=n.compressedData,n.destroy()},t.prototype.constructZippedObject=function(t,e,i,r){var n=0,s=new Date;r&&(n|=16),n|=0;var o=this.writeHeader(e,s),a="PK"+o+e.fileName,h=this.writeCentralDirectory(e,o,i,n);return t.push({localHeader:a,centralDir:h,compressedData:e}),i+a.length+e.compressedSize},t.prototype.writeHeader=function(t,e){var i="";return i+="\n\0\0\0",i+=t.compressionType,i+=this.getBytes(this.getModifiedTime(e),2),i+=this.getBytes(this.getModifiedDate(e),2),i+=this.getBytes(t.crc32Value,4),i+=this.getBytes(t.compressedSize,4),i+=this.getBytes(t.uncompressedDataSize,4),i+=this.getBytes(t.fileName.length,2),i+=this.getBytes(0,2)},t.prototype.writeZippedContent=function(t,e,i,r){for(var s=0,o=[],a=0;a<e.length;a++){var h=e[a];for(s+=h.centralDir.length,o.push(this.getArrayBuffer(h.localHeader));h.compressedData.compressedData.length;)o.push(h.compressedData.compressedData.shift().buffer)}for(var a=0;a<e.length;a++)o.push(this.getArrayBuffer(e[a].centralDir));o.push(this.getArrayBuffer(this.writeFooter(e,s,i)));var f=new Blob(o,{type:"application/zip"});return r||n.Save.save(t,f),f},t.prototype.writeCentralDirectory=function(t,e,i,r){return"PK"+this.getBytes(20,2)+e+this.getBytes(0,2)+"\0\0\0\0"+this.getBytes(r,4)+this.getBytes(i,4)+t.fileName},t.prototype.writeFooter=function(t,e,i){return"PK\0\0\0\0"+this.getBytes(t.length,2)+this.getBytes(t.length,2)+this.getBytes(e,4)+this.getBytes(i,4)+this.getBytes(0,2)},t.prototype.getArrayBuffer=function(t){for(var e=new Uint8Array(t.length),i=0;i<t.length;++i)e[i]=255&t.charCodeAt(i);return e.buffer},t.prototype.getBytes=function(t,e){for(var i="",r=0;r<e;r++)i+=String.fromCharCode(255&t),t>>>=8;return i},t.prototype.getModifiedTime=function(t){var e=t.getHours();return e<<=6,e|=t.getMinutes(),e<<=5,e|=t.getSeconds()/2},t.prototype.getModifiedDate=function(t){var e=t.getFullYear()-1980;return e<<=4,e|=t.getMonth()+1,e<<=5,e|=t.getDate()},t.prototype.calculateCrc32Value=function(t,e,i){t^=-1;for(var r=0;r<e.length;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},t.initCrc32Table=function(){for(var t,e=0;e<256;e++){t=e;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;o[e]=t}},t.findValueFromEnd=function(t,e,i){if(null==t)throw new DOMException("stream");var r=t.inputStream.buffer.byteLength;if(r<4)return-1;var n=new Uint8Array(4),s=Math.max(0,r-i),o=r-1-4;t.position=o,t.read(n,0,4);var a=n[0],h=a==e;if(!h)for(;o>s;)if(a<<=8,o--,t.position=o,(a+=t.readByte())==e){h=!0;break}return h?o:-1},t.ReadInt32=function(t){var e=new Uint8Array(4);if(4!=t.read(e,0,4))throw new DOMException("Unable to read value at the specified position - end of stream was reached.");return s.a.bitConverterToInt32(e,0)},t.ReadInt16=function(t){var e=new Uint8Array(2);if(2!=t.read(e,0,2))throw new DOMException("Unable to read value at the specified position - end of stream was reached.");return s.a.bitConverterToInt16(e,0)},t.ReadUInt16=function(t){var e=new Uint8Array(2);if(2!=t.read(e,0,2))throw new DOMException("Unable to read value at the specified position - end of stream was reached.");return s.a.bitConverterToInt16(e,0)},t}(),h=function(){function t(){this.headerSignature=67324752,this.checkCrc=!0,this.crc32=0}return t.prototype.readCentralDirectoryData=function(t){t.position+=4,this.options=a.ReadInt16(t),this.compressionMethod=a.ReadInt16(t),this.checkCrc=99!=this.compressionMethod;a.ReadInt32(t);this.crc32=s.a.bitConverterToUInt32(a.ReadInt32(t)),this.compressedSize=a.ReadInt32(t),this.originalSize=a.ReadInt32(t);var e=a.ReadInt16(t),i=a.ReadInt16(t),r=a.ReadInt16(t);t.position+=4,this.externalAttributes=a.ReadInt32(t),this.localHeaderOffset=a.ReadInt32(t);var n=new Uint8Array(e);t.read(n,0,e);var o=s.a.byteToString(n);o=o.replace("\\","/"),this.name=o,t.position+=i+r,0!=this.options&&(this.options=0)},t.prototype.readData=function(t,e){if(0==t.length)throw new DOMException("stream");t.position=this.localHeaderOffset,this.checkCrc=e,this.readLocalHeader(t),this.readCompressedData(t)},t.prototype.decompressData=function(){8==this.compressionMethod&&this.originalSize>0&&this.decompressDataOld()},t.prototype.decompressDataOld=function(){var t,e=new r.CompressedStreamReader(this.compressedStream,!0);this.originalSize>0&&(t=new r.Stream(new Uint8Array(this.originalSize)));var i,n=new Uint8Array(4096);for(new Uint8Array(0);(i=e.read(n,0,4096))>0;)t.write(n.subarray(0,i),0,i);this.unCompressedStream=t.toByteArray(),this.checkCrc},t.prototype.readLocalHeader=function(t){if(0==t.length)throw new DOMException("stream");if(a.ReadInt32(t)!=this.headerSignature)throw new DOMException("Can't find local header signature - wrong file format or file is corrupt.");t.position+=22;var e=a.ReadInt16(t),i=a.ReadUInt16(t);if(99==this.compressionMethod);else if(i>2){t.position+=e;var r=a.ReadInt16(t);if(23==r)throw new DOMException("UnSupported");t.position+=i-2}else t.position+=e+i},t.prototype.readCompressedData=function(t){var e;if(this.compressedSize>0){var i=this.compressedSize;e=new r.Stream(new Uint8Array(i));for(var n=new Uint8Array(4096);i>0;){var s=Math.min(i,4096);if(t.read(n,0,s)!=s)throw new DOMException("End of file reached - wrong file format or file is corrupt.");e.write(n.subarray(0,s),0,s),i-=s}this.compressedStream=new Uint8Array(e.inputStream)}else this.compressedSize<0||this.compressedSize},t}(),f=function(){function t(t,e){if(null===t||void 0===t)throw new Error("ArgumentException: data cannot be null or undefined");if(null===e||void 0===e)throw new Error("ArgumentException: string cannot be null or undefined");if(0===e.length)throw new Error("string cannot be empty");this.data=t,this.name=e}return Object.defineProperty(t.prototype,"dataStream",{get:function(){return this.decompressedStream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.fileName},set:function(t){this.fileName=t},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.fileName=void 0,this.data=void 0},t}()},function(t,e,i){"use strict";i.d(e,"a",function(){return r});var r=function(){function t(){}return t.ChecksumUpdate=function(t,e,i,r){for(var n=t,s=65535&n,o=n>>this.DEF_CHECKSUM_BIT_OFFSET;r>0;){var a=Math.min(r,this.DEF_CHECKSUM_ITERATIONSCOUNT);for(r-=a;--a>=0;)s+=255&e[i++],o+=s;s%=this.DEF_CHECKSUM_BASE,o%=this.DEF_CHECKSUM_BASE}n=o<<this.DEF_CHECKSUM_BIT_OFFSET|s,t=n},t.ChecksumGenerate=function(e,i,r){return t.ChecksumUpdate(1,e,i,r),1},t.DEF_CHECKSUM_BIT_OFFSET=16,t.DEF_CHECKSUM_BASE=65521,t.DEF_CHECKSUM_ITERATIONSCOUNT=3800,t}()}])});
/*!
* filename: ej2-compression.umd.min.js
* version : 20.4.48
* version : 21.1.35
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.

@@ -10,3 +10,3 @@ * Use of this code is subject to the terms of our license.

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@syncfusion/ej2-file-utils")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-file-utils"],e):e(t.ej={},t.ej2FileUtils)}(this,function(t,e){"use strict";var i=new Int16Array(286),r=new Uint8Array(286),n=new Int16Array(30),s=new Uint8Array(30),h=function(){function t(e){this.pendingBuffer=new Uint8Array(65536),this.pendingBufLength=0,this.pendingBufCache=0,this.pendingBufBitsInCache=0,this.bufferPosition=0,this.extraBits=0,this.currentHash=0,this.matchStart=0,this.matchLength=0,this.matchPrevAvail=!1,this.blockStart=0,this.stringStart=0,this.lookAhead=0,this.totalBytesIn=0,this.inputOffset=0,this.inputEnd=0,this.windowSize=32768,this.windowMask=this.windowSize-1,this.hashSize=32768,this.hashMask=this.hashSize-1,this.hashShift=Math.floor(17/3),this.maxDist=this.windowSize-262,this.checkSum=1,this.noWrap=!1,t.isHuffmanTreeInitiated||(t.initHuffmanTree(),t.isHuffmanTreeInitiated=!0),this.treeLiteral=new o(this,286,257,15),this.treeDistances=new o(this,30,1,15),this.treeCodeLengths=new o(this,19,4,7),this.arrDistances=new Uint16Array(16384),this.arrLiterals=new Uint8Array(16384),this.stream=[],this.dataWindow=new Uint8Array(2*this.windowSize),this.hashHead=new Int16Array(this.hashSize),this.hashPrevious=new Int16Array(this.windowSize),this.blockStart=this.stringStart=1,this.noWrap=e,e||this.writeZLibHeader()}return Object.defineProperty(t.prototype,"compressedData",{get:function(){return this.stream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"getCompressedString",{get:function(){var t="";if(void 0!==this.stream)for(var e=0;e<this.stream.length;e++)t+=String.fromCharCode.apply(null,this.stream[e]);return t},enumerable:!0,configurable:!0}),t.prototype.write=function(t,i,r){if(void 0===t||null===t)throw new Error("ArgumentException: data cannot null or undefined");var n=i+r;if(0>i||i>n||n>t.length)throw new Error("ArgumentOutOfRangeException: Offset or length is incorrect");if("string"==typeof t){var s=new e.Encoding(!1);s.type="Utf8",n=i+(t=new Uint8Array(s.getBytes(t,0,t.length))).length}for(this.inputBuffer=t,this.inputOffset=i,this.inputEnd=n,this.noWrap||(this.checkSum=a.checksumUpdate(this.checkSum,this.inputBuffer,this.inputOffset,n));this.inputEnd!==this.inputOffset||0!==this.pendingBufLength;)this.pendingBufferFlush(),this.compressData(!1)},t.prototype.writeZLibHeader=function(){var t=30720;t|=64,t+=31-t%31,this.pendingBufferWriteShortBytes(t)},t.prototype.pendingBufferWriteShortBytes=function(t){this.pendingBuffer[this.pendingBufLength++]=t>>8,this.pendingBuffer[this.pendingBufLength++]=t},t.prototype.compressData=function(t){var e;do{this.fillWindow();var i=t&&this.inputEnd===this.inputOffset;e=this.compressSlow(i,t)}while(0===this.pendingBufLength&&e);return e},t.prototype.compressSlow=function(t,e){if(this.lookAhead<262&&!t)return!1;for(;this.lookAhead>=262||t;){if(0===this.lookAhead)return this.lookAheadCompleted(e);this.stringStart>=2*this.windowSize-262&&this.slideWindow();var i=this.matchStart,r=this.matchLength;if(this.lookAhead>=3&&this.discardMatch(),r>=3&&this.matchLength<=r?r=this.matchPreviousBest(i,r):this.matchPreviousAvailable(),this.bufferPosition>=16384)return this.huffmanIsFull(e)}return!0},t.prototype.discardMatch=function(){var t=this.insertString();0!==t&&this.stringStart-t<=this.maxDist&&this.findLongestMatch(t)&&this.matchLength<=5&&3===this.matchLength&&this.stringStart-this.matchStart>4096&&(this.matchLength=2)},t.prototype.matchPreviousAvailable=function(){this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!0,this.stringStart++,this.lookAhead--},t.prototype.matchPreviousBest=function(t,e){this.huffmanTallyDist(this.stringStart-1-t,e),e-=2;do{this.stringStart++,this.lookAhead--,this.lookAhead>=3&&this.insertString()}while(--e>0);return this.stringStart++,this.lookAhead--,this.matchPrevAvail=!1,this.matchLength=2,e},t.prototype.lookAheadCompleted=function(t){return this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!1,this.huffmanFlushBlock(this.dataWindow,this.blockStart,this.stringStart-this.blockStart,t),this.blockStart=this.stringStart,!1},t.prototype.huffmanIsFull=function(t){var e=this.stringStart-this.blockStart;this.matchPrevAvail&&e--;var i=t&&0===this.lookAhead&&!this.matchPrevAvail;return this.huffmanFlushBlock(this.dataWindow,this.blockStart,e,i),this.blockStart+=e,!i},t.prototype.fillWindow=function(){for(this.stringStart>=this.windowSize+this.maxDist&&this.slideWindow();this.lookAhead<262&&this.inputOffset<this.inputEnd;){var t=2*this.windowSize-this.lookAhead-this.stringStart;t>this.inputEnd-this.inputOffset&&(t=this.inputEnd-this.inputOffset),this.dataWindow.set(this.inputBuffer.subarray(this.inputOffset,this.inputOffset+t),this.stringStart+this.lookAhead),this.inputOffset+=t,this.totalBytesIn+=t,this.lookAhead+=t}this.lookAhead>=3&&this.updateHash()},t.prototype.slideWindow=function(){this.dataWindow.set(this.dataWindow.subarray(this.windowSize,this.windowSize+this.windowSize),0),this.matchStart-=this.windowSize,this.stringStart-=this.windowSize,this.blockStart-=this.windowSize;for(var t=0;t<this.hashSize;++t){var e=65535&this.hashHead[t];this.hashHead[t]=e>=this.windowSize?e-this.windowSize:0}for(t=0;t<this.windowSize;t++){e=65535&this.hashPrevious[t];this.hashPrevious[t]=e>=this.windowSize?e-this.windowSize:0}},t.prototype.insertString=function(){var t,e=(this.currentHash<<this.hashShift^this.dataWindow[this.stringStart+2])&this.hashMask;return this.hashPrevious[this.stringStart&this.windowMask]=t=this.hashHead[e],this.hashHead[e]=this.stringStart,this.currentHash=e,65535&t},t.prototype.findLongestMatch=function(t){var e,i=4096,r=258,n=this.stringStart,s=this.stringStart+this.matchLength,h=Math.max(this.matchLength,2),o=Math.max(this.stringStart-this.maxDist,0),a=this.stringStart+258-1,f=this.dataWindow[s-1],u=this.dataWindow[s],d=this.dataWindow;h>=32&&(i>>=2),r>this.lookAhead&&(r=this.lookAhead);do{if(d[t+h]===u&&d[t+h-1]===f&&d[t]===d[n]&&d[t+1]===d[n+1]){for(e=t+2,n+=2;d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&n<a;);if(n>s){if(this.matchStart=t,s=n,(h=n-this.stringStart)>=r)break;f=d[s-1],u=d[s]}n=this.stringStart}}while((t=65535&this.hashPrevious[t&this.windowMask])>o&&0!=--i);return this.matchLength=Math.min(h,this.lookAhead),this.matchLength>=3},t.prototype.updateHash=function(){this.currentHash=this.dataWindow[this.stringStart]<<this.hashShift^this.dataWindow[this.stringStart+1]},t.prototype.huffmanTallyLit=function(t){return this.arrDistances[this.bufferPosition]=0,this.arrLiterals[this.bufferPosition++]=t,this.treeLiteral.codeFrequencies[t]++,this.bufferPosition>=16384},t.prototype.huffmanTallyDist=function(t,e){this.arrDistances[this.bufferPosition]=t,this.arrLiterals[this.bufferPosition++]=e-3;var i=this.huffmanLengthCode(e-3);this.treeLiteral.codeFrequencies[i]++,i>=265&&i<285&&(this.extraBits+=Math.floor((i-261)/4));var r=this.huffmanDistanceCode(t-1);return this.treeDistances.codeFrequencies[r]++,r>=4&&(this.extraBits+=Math.floor(r/2-1)),this.bufferPosition>=16384},t.prototype.huffmanFlushBlock=function(t,e,h,a){this.treeLiteral.codeFrequencies[256]++,this.treeLiteral.buildTree(),this.treeDistances.buildTree(),this.treeLiteral.calculateBLFreq(this.treeCodeLengths),this.treeDistances.calculateBLFreq(this.treeCodeLengths),this.treeCodeLengths.buildTree();for(var f=4,u=18;u>f;u--)this.treeCodeLengths.codeLengths[o.huffCodeLengthOrders[u]]>0&&(f=u+1);var d=14+3*f+this.treeCodeLengths.getEncodedLength()+this.treeLiteral.getEncodedLength()+this.treeDistances.getEncodedLength()+this.extraBits,c=this.extraBits;for(u=0;u<286;u++)c+=this.treeLiteral.codeFrequencies[u]*r[u];for(u=0;u<30;u++)c+=this.treeDistances.codeFrequencies[u]*s[u];d>=c&&(d=c),e>=0&&h+4<d>>3?this.huffmanFlushStoredBlock(t,e,h,a):d==c?(this.pendingBufferWriteBits(2+(a?1:0),3),this.treeLiteral.setStaticCodes(i,r),this.treeDistances.setStaticCodes(n,s),this.huffmanCompressBlock(),this.huffmanReset()):(this.pendingBufferWriteBits(4+(a?1:0),3),this.huffmanSendAllTrees(f),this.huffmanCompressBlock(),this.huffmanReset())},t.prototype.huffmanFlushStoredBlock=function(t,e,i,r){this.pendingBufferWriteBits(0+(r?1:0),3),this.pendingBufferAlignToByte(),this.pendingBufferWriteShort(i),this.pendingBufferWriteShort(~i),this.pendingBufferWriteByteBlock(t,e,i),this.huffmanReset()},t.prototype.huffmanLengthCode=function(t){if(255===t)return 285;for(var e=257;t>=8;)e+=4,t>>=1;return e+t},t.prototype.huffmanDistanceCode=function(t){for(var e=0;t>=4;)e+=2,t>>=1;return e+t},t.prototype.huffmanSendAllTrees=function(t){this.treeCodeLengths.buildCodes(),this.treeLiteral.buildCodes(),this.treeDistances.buildCodes(),this.pendingBufferWriteBits(this.treeLiteral.treeLength-257,5),this.pendingBufferWriteBits(this.treeDistances.treeLength-1,5),this.pendingBufferWriteBits(t-4,4);for(var e=0;e<t;e++)this.pendingBufferWriteBits(this.treeCodeLengths.codeLengths[o.huffCodeLengthOrders[e]],3);this.treeLiteral.writeTree(this.treeCodeLengths),this.treeDistances.writeTree(this.treeCodeLengths)},t.prototype.huffmanReset=function(){this.bufferPosition=0,this.extraBits=0,this.treeLiteral.reset(),this.treeDistances.reset(),this.treeCodeLengths.reset()},t.prototype.huffmanCompressBlock=function(){for(var t=0;t<this.bufferPosition;t++){var e=255&this.arrLiterals[t],i=this.arrDistances[t];if(0!=i--){var r=this.huffmanLengthCode(e);this.treeLiteral.writeCodeToStream(r);var n=Math.floor((r-261)/4);n>0&&n<=5&&this.pendingBufferWriteBits(e&(1<<n)-1,n);var s=this.huffmanDistanceCode(i);this.treeDistances.writeCodeToStream(s),(n=Math.floor(s/2-1))>0&&this.pendingBufferWriteBits(i&(1<<n)-1,n)}else this.treeLiteral.writeCodeToStream(e)}this.treeLiteral.writeCodeToStream(256)},t.prototype.pendingBufferWriteBits=function(t,e){var i=new Uint32Array(1);i[0]=this.pendingBufCache|t<<this.pendingBufBitsInCache,this.pendingBufCache=i[0],this.pendingBufBitsInCache+=e,this.pendingBufferFlushBits()},t.prototype.pendingBufferFlush=function(t){if(this.pendingBufferFlushBits(),this.pendingBufLength>0){var e=new Uint8Array(this.pendingBufLength);e.set(this.pendingBuffer.subarray(0,this.pendingBufLength),0),this.stream.push(e)}this.pendingBufLength=0},t.prototype.pendingBufferFlushBits=function(){for(var t=0;this.pendingBufBitsInCache>=8&&this.pendingBufLength<65536;)this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache,this.pendingBufCache>>=8,this.pendingBufBitsInCache-=8,t++;return t},t.prototype.pendingBufferWriteByteBlock=function(t,e,i){var r=t.subarray(e,e+i);this.pendingBuffer.set(r,this.pendingBufLength),this.pendingBufLength+=i},t.prototype.pendingBufferWriteShort=function(t){this.pendingBuffer[this.pendingBufLength++]=t,this.pendingBuffer[this.pendingBufLength++]=t>>8},t.prototype.pendingBufferAlignToByte=function(){this.pendingBufBitsInCache>0&&(this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache),this.pendingBufCache=0,this.pendingBufBitsInCache=0},t.initHuffmanTree=function(){for(var t=0;t<144;)i[t]=o.bitReverse(48+t<<8),r[t++]=8;for(;t<256;)i[t]=o.bitReverse(256+t<<7),r[t++]=9;for(;t<280;)i[t]=o.bitReverse(-256+t<<9),r[t++]=7;for(;t<286;)i[t]=o.bitReverse(-88+t<<8),r[t++]=8;for(t=0;t<30;t++)n[t]=o.bitReverse(t<<11),s[t]=5},t.prototype.close=function(){do{this.pendingBufferFlush(!0),this.compressData(!0)||(this.pendingBufferFlush(!0),this.pendingBufferAlignToByte(),this.noWrap||(this.pendingBufferWriteShortBytes(this.checkSum>>16),this.pendingBufferWriteShortBytes(65535&this.checkSum)),this.pendingBufferFlush(!0))}while(this.inputEnd!==this.inputOffset||0!==this.pendingBufLength)},t.prototype.destroy=function(){this.stream=[],this.stream=void 0,this.pendingBuffer=void 0,this.treeLiteral=void 0,this.treeDistances=void 0,this.treeCodeLengths=void 0,this.arrLiterals=void 0,this.arrDistances=void 0,this.hashHead=void 0,this.hashPrevious=void 0,this.dataWindow=void 0,this.inputBuffer=void 0,this.pendingBufLength=void 0,this.pendingBufCache=void 0,this.pendingBufBitsInCache=void 0,this.bufferPosition=void 0,this.extraBits=void 0,this.currentHash=void 0,this.matchStart=void 0,this.matchLength=void 0,this.matchPrevAvail=void 0,this.blockStart=void 0,this.stringStart=void 0,this.lookAhead=void 0,this.totalBytesIn=void 0,this.inputOffset=void 0,this.inputEnd=void 0,this.windowSize=void 0,this.windowMask=void 0,this.hashSize=void 0,this.hashMask=void 0,this.hashShift=void 0,this.maxDist=void 0,this.checkSum=void 0,this.noWrap=void 0},t.isHuffmanTreeInitiated=!1,t}(),o=function(){function t(t,e,i,r){this.writer=t,this.codeMinCount=i,this.maxLength=r,this.codeFrequency=new Uint16Array(e),this.lengthCount=new Int32Array(r)}return Object.defineProperty(t.prototype,"treeLength",{get:function(){return this.codeCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeLengths",{get:function(){return this.codeLength},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeFrequencies",{get:function(){return this.codeFrequency},enumerable:!0,configurable:!0}),t.prototype.setStaticCodes=function(t,e){var i=new Int16Array(t.length);i.set(t,0),this.codes=i;var r=new Uint8Array(e.length);r.set(e,0),this.codeLength=r},t.prototype.reset=function(){for(var t=0;t<this.codeFrequency.length;t++)this.codeFrequency[t]=0;this.codes=void 0,this.codeLength=void 0},t.prototype.writeCodeToStream=function(t){this.writer.pendingBufferWriteBits(65535&this.codes[t],this.codeLength[t])},t.prototype.buildCodes=function(){var e=new Int32Array(this.maxLength);this.codes=new Int16Array(this.codeCount);for(var i=0,r=0;r<this.maxLength;r++)e[r]=i,i+=this.lengthCount[r]<<15-r;for(var n=0;n<this.codeCount;n++){var s=this.codeLength[n];s>0&&(this.codes[n]=t.bitReverse(e[s-1]),e[s-1]+=1<<16-s)}},t.bitReverse=function(e){return t.reverseBits[15&e]<<12|t.reverseBits[e>>4&15]<<8|t.reverseBits[e>>8&15]<<4|t.reverseBits[e>>12]},t.prototype.getEncodedLength=function(){for(var t=0,e=0;e<this.codeFrequency.length;e++)t+=this.codeFrequency[e]*this.codeLength[e];return t},t.prototype.calculateBLFreq=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var h=this.codeLength[s];for(0===h?(e=138,i=3):(e=6,i=3,n!==h&&(t.codeFrequency[h]++,r=0)),n=h,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););r<i?t.codeFrequency[n]+=r:0!==n?t.codeFrequency[16]++:r<=10?t.codeFrequency[17]++:t.codeFrequency[18]++}},t.prototype.writeTree=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var h=this.codeLength[s];for(0===h?(e=138,i=3):(e=6,i=3,n!==h&&(t.writeCodeToStream(h),r=0)),n=h,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););if(r<i)for(;r-- >0;)t.writeCodeToStream(n);else 0!==n?(t.writeCodeToStream(16),this.writer.pendingBufferWriteBits(r-3,2)):r<=10?(t.writeCodeToStream(17),this.writer.pendingBufferWriteBits(r-3,3)):(t.writeCodeToStream(18),this.writer.pendingBufferWriteBits(r-11,7))}},t.prototype.buildTree=function(){for(var t=this.codeFrequency.length,e=new Int32Array(t),i=0,r=0,n=0;n<t;n++){var s=this.codeFrequency[n];if(0!==s){for(var h=i++,o=0;h>0&&this.codeFrequency[e[o=Math.floor((h-1)/2)]]>s;)e[h]=e[o],h=o;e[h]=n,r=n}}for(;i<2;)e[i++]=r<2?++r:0;this.codeCount=Math.max(r+1,this.codeMinCount);for(var a=i,f=new Int32Array(4*i-2),u=new Int32Array(2*i-1),d=0;d<i;d++){var c=e[d],l=2*d;f[l]=c,f[l+1]=-1,u[d]=this.codeFrequency[c]<<8,e[d]=d}this.constructHuffmanTree(e,i,u,a,f),this.buildLength(f)},t.prototype.constructHuffmanTree=function(t,e,i,r,n){do{for(var s=t[0],h=t[--e],o=i[h],a=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[a]=t[f],f=2*(a=f)+1;for(;(f=a)>0&&i[t[a=Math.floor((f-1)/2)]]>o;)t[f]=t[a];t[f]=h;var u=t[0];n[2*(h=r++)]=s,n[2*h+1]=u;var d=Math.min(255&i[s],255&i[u]);for(i[h]=o=i[s]+i[u]-d+1,a=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[a]=t[f],f=2*(a=f)+1;for(;(f=a)>0&&i[t[a=Math.floor((f-1)/2)]]>o;)t[f]=t[a];t[f]=h}while(e>1)},t.prototype.buildLength=function(t){this.codeLength=new Uint8Array(this.codeFrequency.length);for(var e=Math.floor(t.length/2),i=Math.floor((e+1)/2),r=0,n=0;n<this.maxLength;n++)this.lengthCount[n]=0;if(0!==(r=this.calculateOptimalCodeLength(t,r,e))){var s=this.maxLength-1;do{for(;0===this.lengthCount[--s];);do{this.lengthCount[s]--,this.lengthCount[++s]++,r-=1<<this.maxLength-1-s}while(r>0&&s<this.maxLength-1)}while(r>0);this.recreateTree(t,r,i)}},t.prototype.recreateTree=function(t,e,i){this.lengthCount[this.maxLength-1]+=e,this.lengthCount[this.maxLength-2]-=e;for(var r=2*i,n=this.maxLength;0!==n;n--)for(var s=this.lengthCount[n-1];s>0;){var h=2*t[r++];-1===t[h+1]&&(this.codeLength[t[h]]=n,s--)}},t.prototype.calculateOptimalCodeLength=function(t,e,i){var r=new Int32Array(i);r[i-1]=0;for(var n=i-1;n>=0;n--){var s=2*n+1;if(-1!==t[s]){(h=r[n]+1)>this.maxLength&&(h=this.maxLength,e++),r[t[s-1]]=r[t[s]]=h}else{var h=r[n];this.lengthCount[h-1]++,this.codeLength[t[s-1]]=r[n]}}return e},t.reverseBits=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],t.huffCodeLengthOrders=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],t}(),a=function(){function t(){}return t.checksumUpdate=function(e,i,r,n){var s=new Uint32Array(1);s[0]=e;for(var h=s[0],o=s[0]=65535&h,a=s[0]=h>>t.checkSumBitOffset;n>0;){var f=Math.min(n,t.checksumIterationCount);for(n-=f;--f>=0;)a+=o+=s[0]=255&i[r++];o%=t.checksumBase,a%=t.checksumBase}return h=a<<t.checkSumBitOffset|o},t.checkSumBitOffset=16,t.checksumBase=65521,t.checksumIterationCount=3800,t}(),f=[],u=function(){function t(){0===f.length&&t.initCrc32Table(),this.files=[],this.level="Normal",e.Save.isMicrosoftBrowser=!!navigator.msSaveBlob}return Object.defineProperty(t.prototype,"compressionLevel",{get:function(){return this.level},set:function(t){this.level=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return void 0===this.files?0:this.files.length},enumerable:!0,configurable:!0}),t.prototype.addItem=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: item cannot be null or undefined");for(var e=0;e<this.files.length;e++){var i=this.files[e];if(i instanceof d&&i.name===t.name)throw new Error("item with same name already exist")}this.files.push(t)},t.prototype.addDirectory=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: string cannot be null or undefined");if(0===t.length)throw new Error("ArgumentException: string cannot be empty");if("/"!==t.slice(-1)&&(t+="/"),-1!==this.files.indexOf(t))throw new Error("item with same name already exist");this.files.push(t)},t.prototype.getItem=function(t){if(t>=0&&t<this.files.length)return this.files[t]},t.prototype.contains=function(t){return-1!==this.files.indexOf(t)},t.prototype.save=function(t){if(null===t||void 0===t||0===t.length)throw new Error("ArgumentException: fileName cannot be null or undefined");if(0===this.files.length)throw new Error("InvalidOperation");var e=this;return new Promise(function(i,r){e.saveInternal(t,!1).then(function(){i(e)})})},t.prototype.saveAsBlob=function(){var t=this;return new Promise(function(e,i){t.saveInternal("",!0).then(function(t){e(t)})})},t.prototype.saveInternal=function(t,e){var i=this,r=this;return new Promise(function(n,s){for(var h=[],o=0,a=0;a<r.files.length;a++){i.getCompressedData(i.files[a]).then(function(i){if(o=r.constructZippedObject(h,i,o,i.isDirectory),h.length===r.files.length){var s=r.writeZippedContent(t,h,o,e);n(s)}})}})},t.prototype.destroy=function(){if(void 0!==this.files&&this.files.length>0){for(var t=0;t<this.files.length;t++){var e=this.files[t];e instanceof d&&e.destroy(),e=void 0}this.files=[]}this.files=void 0,this.level=void 0},t.prototype.getCompressedData=function(t){var e=this;return new Promise(function(i,r){if(t instanceof d){var n=new FileReader;n.onload=function(){var r=new Uint8Array(n.result),s={fileName:t.name,crc32Value:0,compressedData:[],compressedSize:void 0,uncompressedDataSize:r.length,compressionType:void 0,isDirectory:!1};if("Normal"===e.level){e.compressData(r,s,f);for(var h=0,o=0;o<s.compressedData.length;o++)h+=s.compressedData[o].length;s.compressedSize=h,s.compressionType="\b\0"}else s.compressedSize=r.length,s.crc32Value=e.calculateCrc32Value(0,r,f),s.compressionType="\0\0",s.compressedData.push(r);i(s)},n.readAsArrayBuffer(t.data)}else{i({fileName:t,crc32Value:0,compressedData:"",compressedSize:0,uncompressedDataSize:0,compressionType:"\0\0",isDirectory:!0})}})},t.prototype.compressData=function(t,e,i){var r=new h(!0),n=0,s=0;do{if(n>=t.length){r.close();break}s=Math.min(t.length,n+16384);var o=t.subarray(n,s);e.crc32Value=this.calculateCrc32Value(e.crc32Value,o,i),r.write(o,0,s-n),n=s}while(n<=t.length);e.compressedData=r.compressedData,r.destroy()},t.prototype.constructZippedObject=function(t,e,i,r){var n=0,s=new Date;r&&(n|=16),n|=0;var h=this.writeHeader(e,s),o="PK"+h+e.fileName,a=this.writeCentralDirectory(e,h,i,n);return t.push({localHeader:o,centralDir:a,compressedData:e}),i+o.length+e.compressedSize},t.prototype.writeHeader=function(t,e){var i="";return i+="\n\0\0\0",i+=t.compressionType,i+=this.getBytes(this.getModifiedTime(e),2),i+=this.getBytes(this.getModifiedDate(e),2),i+=this.getBytes(t.crc32Value,4),i+=this.getBytes(t.compressedSize,4),i+=this.getBytes(t.uncompressedDataSize,4),i+=this.getBytes(t.fileName.length,2),i+=this.getBytes(0,2)},t.prototype.writeZippedContent=function(t,i,r,n){for(var s=0,h=[],o=0;o<i.length;o++){var a=i[o];for(s+=a.centralDir.length,h.push(this.getArrayBuffer(a.localHeader));a.compressedData.compressedData.length;)h.push(a.compressedData.compressedData.shift().buffer)}for(o=0;o<i.length;o++)h.push(this.getArrayBuffer(i[o].centralDir));h.push(this.getArrayBuffer(this.writeFooter(i,s,r)));var f=new Blob(h,{type:"application/zip"});return n||e.Save.save(t,f),f},t.prototype.writeCentralDirectory=function(t,e,i,r){return"PK"+this.getBytes(20,2)+e+this.getBytes(0,2)+"\0\0\0\0"+this.getBytes(r,4)+this.getBytes(i,4)+t.fileName},t.prototype.writeFooter=function(t,e,i){return"PK\0\0\0\0"+this.getBytes(t.length,2)+this.getBytes(t.length,2)+this.getBytes(e,4)+this.getBytes(i,4)+this.getBytes(0,2)},t.prototype.getArrayBuffer=function(t){for(var e=new Uint8Array(t.length),i=0;i<t.length;++i)e[i]=255&t.charCodeAt(i);return e.buffer},t.prototype.getBytes=function(t,e){for(var i="",r=0;r<e;r++)i+=String.fromCharCode(255&t),t>>>=8;return i},t.prototype.getModifiedTime=function(t){var e=t.getHours();return e<<=6,e|=t.getMinutes(),e<<=5,e|=t.getSeconds()/2},t.prototype.getModifiedDate=function(t){var e=t.getFullYear()-1980;return e<<=4,e|=t.getMonth()+1,e<<=5,e|=t.getDate()},t.prototype.calculateCrc32Value=function(t,e,i){t^=-1;for(var r=0;r<e.length;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},t.initCrc32Table=function(){for(var t,e=0;e<256;e++){t=e;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;f[e]=t}},t}(),d=function(){function t(t,e){if(null===t||void 0===t)throw new Error("ArgumentException: data cannot be null or undefined");if(null===e||void 0===e)throw new Error("ArgumentException: string cannot be null or undefined");if(0===e.length)throw new Error("string cannot be empty");this.data=t,this.name=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this.fileName},set:function(t){this.fileName=t},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.fileName=void 0,this.data=void 0},t}();t.ZipArchive=u,t.ZipArchiveItem=d,t.CompressedStreamWriter=h,t.CompressorHuffmanTree=o,t.ChecksumCalculator=a,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@syncfusion/ej2-file-utils")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-file-utils"],e):e(t.ej={},t.ej2FileUtils)}(this,function(t,e){"use strict";var i=function(){function t(){}return t.bitReverse=function(e){return t.reverseBits[15&e]<<12|t.reverseBits[e>>4&15]<<8|t.reverseBits[e>>8&15]<<4|t.reverseBits[e>>12]},t.bitConverterToInt32=function(t,e){return t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24},t.bitConverterToInt16=function(t,e){return t[e]|t[e+1]<<8},t.bitConverterToUInt32=function(t){var e=new Uint32Array(1);return e[0]=t,e[0]},t.bitConverterToUInt16=function(t,e){var i=new Uint16Array(1);return i[0]=t[e]|t[e+1]<<8,i[0]},t.bitConverterUintToInt32=function(t){var e=new Int32Array(1);return e[0]=t,e[0]},t.bitConverterInt32ToUint=function(t){var e=new Uint32Array(1);return e[0]=t,e[0]},t.bitConverterInt32ToInt16=function(t){var e=new Int16Array(1);return e[0]=t,e[0]},t.byteToString=function(t){for(var e="",i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e},t.byteIntToString=function(t){for(var e="",i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e},t.arrayCopy=function(t,e,i,r,n){var s=new Uint8Array(t.buffer,e).subarray(0,n);i.set(s,r)},t.mergeArray=function(t,e){var i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i},t.encodedString=function(t){var e,i,r,n,s,o,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,f=0,u=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(t.charAt(t.length-1)===h.charAt(64)&&u--,t.charAt(t.length-2)===h.charAt(64)&&u--,u%1!=0)throw new Error("Invalid base64 input, bad content length.");for(var c=new Uint8Array(0|u);a<t.length;)e=h.indexOf(t.charAt(a++))<<2|(n=h.indexOf(t.charAt(a++)))>>4,i=(15&n)<<4|(s=h.indexOf(t.charAt(a++)))>>2,r=(3&s)<<6|(o=h.indexOf(t.charAt(a++))),c[f++]=e,64!==s&&(c[f++]=i),64!==o&&(c[f++]=r);return c},t.reverseBits=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],t.huffCodeLengthOrders=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],t}(),r=[],n=function(){function t(){0===r.length&&t.initCrc32Table(),this.files=[],this.level="Normal",e.Save.isMicrosoftBrowser=!!navigator.msSaveBlob}return Object.defineProperty(t.prototype,"items",{get:function(){return this.files},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compressionLevel",{get:function(){return this.level},set:function(t){this.level=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return void 0===this.files?0:this.files.length},enumerable:!0,configurable:!0}),t.prototype.addItem=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: item cannot be null or undefined");for(var e=0;e<this.files.length;e++){var i=this.files[e];if(i instanceof o&&i.name===t.name)throw new Error("item with same name already exist")}this.files.push(t)},t.prototype.addDirectory=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: string cannot be null or undefined");if(0===t.length)throw new Error("ArgumentException: string cannot be empty");if("/"!==t.slice(-1)&&(t+="/"),-1!==this.files.indexOf(t))throw new Error("item with same name already exist");this.files.push(t)},t.prototype.getItem=function(t){if(t>=0&&t<this.files.length)return this.files[t]},t.prototype.contains=function(t){return-1!==this.files.indexOf(t)},t.prototype.open=function(e){var r=i.encodedString(e);if(0==r.length)throw new DOMException("stream");var n=new B(r),s=t.findValueFromEnd(n,101010256,65557);if(s<0)throw new DOMException("Can't locate end of central directory record. Possible wrong file format or archive is corrupt.");n.position=s+12;var o=s-t.ReadInt32(n);n.position=o,this.readCentralDirectoryDataAndExtractItems(n)},t.prototype.readCentralDirectoryDataAndExtractItems=function(e){if(null==e)throw new DOMException("stream");for(var i;33639248==t.ReadInt32(e);)(i=new s).readCentralDirectoryData(e);i.readData(e,i.checkCrc),i.decompressData(),this.files.push(new o(i.unCompressedStream.buffer,i.name))},t.prototype.save=function(t){if(null===t||void 0===t||0===t.length)throw new Error("ArgumentException: fileName cannot be null or undefined");if(0===this.files.length)throw new Error("InvalidOperation");var e=this;return new Promise(function(i,r){e.saveInternal(t,!1).then(function(){i(e)})})},t.prototype.saveAsBlob=function(){var t=this;return new Promise(function(e,i){t.saveInternal("",!0).then(function(t){e(t)})})},t.prototype.saveInternal=function(t,e){var i=this,r=this;return new Promise(function(n,s){for(var o=[],h=0,a=0;a<r.files.length;a++){i.getCompressedData(i.files[a]).then(function(i){if(h=r.constructZippedObject(o,i,h,i.isDirectory),o.length===r.files.length){var s=r.writeZippedContent(t,o,h,e);n(s)}})}})},t.prototype.destroy=function(){if(void 0!==this.files&&this.files.length>0){for(var t=0;t<this.files.length;t++){var e=this.files[t];e instanceof o&&e.destroy(),e=void 0}this.files=[]}this.files=void 0,this.level=void 0},t.prototype.getCompressedData=function(t){var e=this;return new Promise(function(i,n){if(t instanceof o){var s=new FileReader;s.onload=function(){var n=new Uint8Array(s.result),o={fileName:t.name,crc32Value:0,compressedData:[],compressedSize:void 0,uncompressedDataSize:n.length,compressionType:void 0,isDirectory:!1};if("Normal"===e.level){e.compressData(n,o,r);for(var h=0,a=0;a<o.compressedData.length;a++)h+=o.compressedData[a].length;o.compressedSize=h,o.compressionType="\b\0"}else o.compressedSize=n.length,o.crc32Value=e.calculateCrc32Value(0,n,r),o.compressionType="\0\0",o.compressedData.push(n);i(o)},s.readAsArrayBuffer(t.data)}else{i({fileName:t,crc32Value:0,compressedData:"",compressedSize:0,uncompressedDataSize:0,compressionType:"\0\0",isDirectory:!0})}})},t.prototype.compressData=function(t,e,i){var r=new c(!0),n=0,s=0;do{if(n>=t.length){r.close();break}s=Math.min(t.length,n+16384);var o=t.subarray(n,s);e.crc32Value=this.calculateCrc32Value(e.crc32Value,o,i),r.write(o,0,s-n),n=s}while(n<=t.length);e.compressedData=r.compressedData,r.destroy()},t.prototype.constructZippedObject=function(t,e,i,r){var n=0,s=new Date;r&&(n|=16),n|=0;var o=this.writeHeader(e,s),h="PK"+o+e.fileName,a=this.writeCentralDirectory(e,o,i,n);return t.push({localHeader:h,centralDir:a,compressedData:e}),i+h.length+e.compressedSize},t.prototype.writeHeader=function(t,e){var i="";return i+="\n\0\0\0",i+=t.compressionType,i+=this.getBytes(this.getModifiedTime(e),2),i+=this.getBytes(this.getModifiedDate(e),2),i+=this.getBytes(t.crc32Value,4),i+=this.getBytes(t.compressedSize,4),i+=this.getBytes(t.uncompressedDataSize,4),i+=this.getBytes(t.fileName.length,2),i+=this.getBytes(0,2)},t.prototype.writeZippedContent=function(t,i,r,n){for(var s=0,o=[],h=0;h<i.length;h++){var a=i[h];for(s+=a.centralDir.length,o.push(this.getArrayBuffer(a.localHeader));a.compressedData.compressedData.length;)o.push(a.compressedData.compressedData.shift().buffer)}for(h=0;h<i.length;h++)o.push(this.getArrayBuffer(i[h].centralDir));o.push(this.getArrayBuffer(this.writeFooter(i,s,r)));var f=new Blob(o,{type:"application/zip"});return n||e.Save.save(t,f),f},t.prototype.writeCentralDirectory=function(t,e,i,r){return"PK"+this.getBytes(20,2)+e+this.getBytes(0,2)+"\0\0\0\0"+this.getBytes(r,4)+this.getBytes(i,4)+t.fileName},t.prototype.writeFooter=function(t,e,i){return"PK\0\0\0\0"+this.getBytes(t.length,2)+this.getBytes(t.length,2)+this.getBytes(e,4)+this.getBytes(i,4)+this.getBytes(0,2)},t.prototype.getArrayBuffer=function(t){for(var e=new Uint8Array(t.length),i=0;i<t.length;++i)e[i]=255&t.charCodeAt(i);return e.buffer},t.prototype.getBytes=function(t,e){for(var i="",r=0;r<e;r++)i+=String.fromCharCode(255&t),t>>>=8;return i},t.prototype.getModifiedTime=function(t){var e=t.getHours();return e<<=6,e|=t.getMinutes(),e<<=5,e|=t.getSeconds()/2},t.prototype.getModifiedDate=function(t){var e=t.getFullYear()-1980;return e<<=4,e|=t.getMonth()+1,e<<=5,e|=t.getDate()},t.prototype.calculateCrc32Value=function(t,e,i){t^=-1;for(var r=0;r<e.length;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},t.initCrc32Table=function(){for(var t,e=0;e<256;e++){t=e;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;r[e]=t}},t.findValueFromEnd=function(t,e,i){if(null==t)throw new DOMException("stream");var r=t.inputStream.buffer.byteLength;if(r<4)return-1;var n=new Uint8Array(4),s=Math.max(0,r-i),o=r-1-4;t.position=o,t.read(n,0,4);var h=n[0],a=h==e;if(!a)for(;o>s;)if(h<<=8,o--,t.position=o,(h+=t.readByte())==e){a=!0;break}return a?o:-1},t.ReadInt32=function(t){var e=new Uint8Array(4);if(4!=t.read(e,0,4))throw new DOMException("Unable to read value at the specified position - end of stream was reached.");return i.bitConverterToInt32(e,0)},t.ReadInt16=function(t){var e=new Uint8Array(2);if(2!=t.read(e,0,2))throw new DOMException("Unable to read value at the specified position - end of stream was reached.");return i.bitConverterToInt16(e,0)},t.ReadUInt16=function(t){var e=new Uint8Array(2);if(2!=t.read(e,0,2))throw new DOMException("Unable to read value at the specified position - end of stream was reached.");return i.bitConverterToInt16(e,0)},t}(),s=function(){function t(){this.headerSignature=67324752,this.checkCrc=!0,this.crc32=0}return t.prototype.readCentralDirectoryData=function(t){t.position+=4,this.options=n.ReadInt16(t),this.compressionMethod=n.ReadInt16(t),this.checkCrc=99!=this.compressionMethod;n.ReadInt32(t);this.crc32=i.bitConverterToUInt32(n.ReadInt32(t)),this.compressedSize=n.ReadInt32(t),this.originalSize=n.ReadInt32(t);var e=n.ReadInt16(t),r=n.ReadInt16(t),s=n.ReadInt16(t);t.position+=4,this.externalAttributes=n.ReadInt32(t),this.localHeaderOffset=n.ReadInt32(t);var o=new Uint8Array(e);t.read(o,0,e);var h=i.byteToString(o);h=h.replace("\\","/"),this.name=h,t.position+=r+s,0!=this.options&&(this.options=0)},t.prototype.readData=function(t,e){if(0==t.length)throw new DOMException("stream");t.position=this.localHeaderOffset,this.checkCrc=e,this.readLocalHeader(t),this.readCompressedData(t)},t.prototype.decompressData=function(){8==this.compressionMethod&&this.originalSize>0&&this.decompressDataOld()},t.prototype.decompressDataOld=function(){var t,e=new g(this.compressedStream,!0);this.originalSize>0&&(t=new B(new Uint8Array(this.originalSize)));for(var i,r=new Uint8Array(4096);(i=e.read(r,0,4096))>0;)t.write(r.subarray(0,i),0,i);this.unCompressedStream=t.toByteArray(),this.checkCrc},t.prototype.readLocalHeader=function(t){if(0==t.length)throw new DOMException("stream");if(n.ReadInt32(t)!=this.headerSignature)throw new DOMException("Can't find local header signature - wrong file format or file is corrupt.");t.position+=22;var e=n.ReadInt16(t),i=n.ReadUInt16(t);if(99==this.compressionMethod);else if(i>2){t.position+=e;if(23==n.ReadInt16(t))throw new DOMException("UnSupported");t.position+=i-2}else t.position+=e+i},t.prototype.readCompressedData=function(t){var e;if(this.compressedSize>0){var i=this.compressedSize;e=new B(new Uint8Array(i));for(var r=new Uint8Array(4096);i>0;){var n=Math.min(i,4096);if(t.read(r,0,n)!=n)throw new DOMException("End of file reached - wrong file format or file is corrupt.");e.write(r.subarray(0,n),0,n),i-=n}this.compressedStream=new Uint8Array(e.inputStream)}else this.compressedSize<0||this.compressedSize},t}(),o=function(){function t(t,e){if(null===t||void 0===t)throw new Error("ArgumentException: data cannot be null or undefined");if(null===e||void 0===e)throw new Error("ArgumentException: string cannot be null or undefined");if(0===e.length)throw new Error("string cannot be empty");this.data=t,this.name=e}return Object.defineProperty(t.prototype,"dataStream",{get:function(){return this.decompressedStream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.fileName},set:function(t){this.fileName=t},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.fileName=void 0,this.data=void 0},t}(),h=new Int16Array(286),a=new Uint8Array(286),f=new Int16Array(30),u=new Uint8Array(30),c=function(){function t(e){this.pendingBuffer=new Uint8Array(65536),this.pendingBufLength=0,this.pendingBufCache=0,this.pendingBufBitsInCache=0,this.bufferPosition=0,this.extraBits=0,this.currentHash=0,this.matchStart=0,this.matchLength=0,this.matchPrevAvail=!1,this.blockStart=0,this.stringStart=0,this.lookAhead=0,this.totalBytesIn=0,this.inputOffset=0,this.inputEnd=0,this.windowSize=32768,this.windowMask=this.windowSize-1,this.hashSize=32768,this.hashMask=this.hashSize-1,this.hashShift=Math.floor(17/3),this.maxDist=this.windowSize-262,this.checkSum=1,this.noWrap=!1,t.isHuffmanTreeInitiated||(t.initHuffmanTree(),t.isHuffmanTreeInitiated=!0),this.treeLiteral=new d(this,286,257,15),this.treeDistances=new d(this,30,1,15),this.treeCodeLengths=new d(this,19,4,7),this.arrDistances=new Uint16Array(16384),this.arrLiterals=new Uint8Array(16384),this.stream=[],this.dataWindow=new Uint8Array(2*this.windowSize),this.hashHead=new Int16Array(this.hashSize),this.hashPrevious=new Int16Array(this.windowSize),this.blockStart=this.stringStart=1,this.noWrap=e,e||this.writeZLibHeader()}return Object.defineProperty(t.prototype,"compressedData",{get:function(){return this.stream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"getCompressedString",{get:function(){var t="";if(void 0!==this.stream)for(var e=0;e<this.stream.length;e++)t+=String.fromCharCode.apply(null,this.stream[e]);return t},enumerable:!0,configurable:!0}),t.prototype.write=function(t,i,r){if(void 0===t||null===t)throw new Error("ArgumentException: data cannot null or undefined");var n=i+r;if(0>i||i>n||n>t.length)throw new Error("ArgumentOutOfRangeException: Offset or length is incorrect");if("string"==typeof t){var s=new e.Encoding(!1);s.type="Utf8",n=i+(t=new Uint8Array(s.getBytes(t,0,t.length))).length}for(this.inputBuffer=t,this.inputOffset=i,this.inputEnd=n,this.noWrap||(this.checkSum=p.checksumUpdate(this.checkSum,this.inputBuffer,this.inputOffset,n));this.inputEnd!==this.inputOffset||0!==this.pendingBufLength;)this.pendingBufferFlush(),this.compressData(!1)},t.prototype.writeZLibHeader=function(){var t=30720;t|=64,t+=31-t%31,this.pendingBufferWriteShortBytes(t)},t.prototype.pendingBufferWriteShortBytes=function(t){this.pendingBuffer[this.pendingBufLength++]=t>>8,this.pendingBuffer[this.pendingBufLength++]=t},t.prototype.compressData=function(t){var e;do{this.fillWindow();var i=t&&this.inputEnd===this.inputOffset;e=this.compressSlow(i,t)}while(0===this.pendingBufLength&&e);return e},t.prototype.compressSlow=function(t,e){if(this.lookAhead<262&&!t)return!1;for(;this.lookAhead>=262||t;){if(0===this.lookAhead)return this.lookAheadCompleted(e);this.stringStart>=2*this.windowSize-262&&this.slideWindow();var i=this.matchStart,r=this.matchLength;if(this.lookAhead>=3&&this.discardMatch(),r>=3&&this.matchLength<=r?r=this.matchPreviousBest(i,r):this.matchPreviousAvailable(),this.bufferPosition>=16384)return this.huffmanIsFull(e)}return!0},t.prototype.discardMatch=function(){var t=this.insertString();0!==t&&this.stringStart-t<=this.maxDist&&this.findLongestMatch(t)&&this.matchLength<=5&&3===this.matchLength&&this.stringStart-this.matchStart>4096&&(this.matchLength=2)},t.prototype.matchPreviousAvailable=function(){this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!0,this.stringStart++,this.lookAhead--},t.prototype.matchPreviousBest=function(t,e){this.huffmanTallyDist(this.stringStart-1-t,e),e-=2;do{this.stringStart++,this.lookAhead--,this.lookAhead>=3&&this.insertString()}while(--e>0);return this.stringStart++,this.lookAhead--,this.matchPrevAvail=!1,this.matchLength=2,e},t.prototype.lookAheadCompleted=function(t){return this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!1,this.huffmanFlushBlock(this.dataWindow,this.blockStart,this.stringStart-this.blockStart,t),this.blockStart=this.stringStart,!1},t.prototype.huffmanIsFull=function(t){var e=this.stringStart-this.blockStart;this.matchPrevAvail&&e--;var i=t&&0===this.lookAhead&&!this.matchPrevAvail;return this.huffmanFlushBlock(this.dataWindow,this.blockStart,e,i),this.blockStart+=e,!i},t.prototype.fillWindow=function(){for(this.stringStart>=this.windowSize+this.maxDist&&this.slideWindow();this.lookAhead<262&&this.inputOffset<this.inputEnd;){var t=2*this.windowSize-this.lookAhead-this.stringStart;t>this.inputEnd-this.inputOffset&&(t=this.inputEnd-this.inputOffset),this.dataWindow.set(this.inputBuffer.subarray(this.inputOffset,this.inputOffset+t),this.stringStart+this.lookAhead),this.inputOffset+=t,this.totalBytesIn+=t,this.lookAhead+=t}this.lookAhead>=3&&this.updateHash()},t.prototype.slideWindow=function(){this.dataWindow.set(this.dataWindow.subarray(this.windowSize,this.windowSize+this.windowSize),0),this.matchStart-=this.windowSize,this.stringStart-=this.windowSize,this.blockStart-=this.windowSize;for(var t=0;t<this.hashSize;++t){var e=65535&this.hashHead[t];this.hashHead[t]=e>=this.windowSize?e-this.windowSize:0}for(t=0;t<this.windowSize;t++){e=65535&this.hashPrevious[t];this.hashPrevious[t]=e>=this.windowSize?e-this.windowSize:0}},t.prototype.insertString=function(){var t,e=(this.currentHash<<this.hashShift^this.dataWindow[this.stringStart+2])&this.hashMask;return this.hashPrevious[this.stringStart&this.windowMask]=t=this.hashHead[e],this.hashHead[e]=this.stringStart,this.currentHash=e,65535&t},t.prototype.findLongestMatch=function(t){var e,i=4096,r=258,n=this.stringStart,s=this.stringStart+this.matchLength,o=Math.max(this.matchLength,2),h=Math.max(this.stringStart-this.maxDist,0),a=this.stringStart+258-1,f=this.dataWindow[s-1],u=this.dataWindow[s],c=this.dataWindow;o>=32&&(i>>=2),r>this.lookAhead&&(r=this.lookAhead);do{if(c[t+o]===u&&c[t+o-1]===f&&c[t]===c[n]&&c[t+1]===c[n+1]){for(e=t+2,n+=2;c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&n<a;);if(n>s){if(this.matchStart=t,s=n,(o=n-this.stringStart)>=r)break;f=c[s-1],u=c[s]}n=this.stringStart}}while((t=65535&this.hashPrevious[t&this.windowMask])>h&&0!=--i);return this.matchLength=Math.min(o,this.lookAhead),this.matchLength>=3},t.prototype.updateHash=function(){this.currentHash=this.dataWindow[this.stringStart]<<this.hashShift^this.dataWindow[this.stringStart+1]},t.prototype.huffmanTallyLit=function(t){return this.arrDistances[this.bufferPosition]=0,this.arrLiterals[this.bufferPosition++]=t,this.treeLiteral.codeFrequencies[t]++,this.bufferPosition>=16384},t.prototype.huffmanTallyDist=function(t,e){this.arrDistances[this.bufferPosition]=t,this.arrLiterals[this.bufferPosition++]=e-3;var i=this.huffmanLengthCode(e-3);this.treeLiteral.codeFrequencies[i]++,i>=265&&i<285&&(this.extraBits+=Math.floor((i-261)/4));var r=this.huffmanDistanceCode(t-1);return this.treeDistances.codeFrequencies[r]++,r>=4&&(this.extraBits+=Math.floor(r/2-1)),this.bufferPosition>=16384},t.prototype.huffmanFlushBlock=function(t,e,i,r){this.treeLiteral.codeFrequencies[256]++,this.treeLiteral.buildTree(),this.treeDistances.buildTree(),this.treeLiteral.calculateBLFreq(this.treeCodeLengths),this.treeDistances.calculateBLFreq(this.treeCodeLengths),this.treeCodeLengths.buildTree();for(var n=4,s=18;s>n;s--)this.treeCodeLengths.codeLengths[d.huffCodeLengthOrders[s]]>0&&(n=s+1);var o=14+3*n+this.treeCodeLengths.getEncodedLength()+this.treeLiteral.getEncodedLength()+this.treeDistances.getEncodedLength()+this.extraBits,c=this.extraBits;for(s=0;s<286;s++)c+=this.treeLiteral.codeFrequencies[s]*a[s];for(s=0;s<30;s++)c+=this.treeDistances.codeFrequencies[s]*u[s];o>=c&&(o=c),e>=0&&i+4<o>>3?this.huffmanFlushStoredBlock(t,e,i,r):o==c?(this.pendingBufferWriteBits(2+(r?1:0),3),this.treeLiteral.setStaticCodes(h,a),this.treeDistances.setStaticCodes(f,u),this.huffmanCompressBlock(),this.huffmanReset()):(this.pendingBufferWriteBits(4+(r?1:0),3),this.huffmanSendAllTrees(n),this.huffmanCompressBlock(),this.huffmanReset())},t.prototype.huffmanFlushStoredBlock=function(t,e,i,r){this.pendingBufferWriteBits(0+(r?1:0),3),this.pendingBufferAlignToByte(),this.pendingBufferWriteShort(i),this.pendingBufferWriteShort(~i),this.pendingBufferWriteByteBlock(t,e,i),this.huffmanReset()},t.prototype.huffmanLengthCode=function(t){if(255===t)return 285;for(var e=257;t>=8;)e+=4,t>>=1;return e+t},t.prototype.huffmanDistanceCode=function(t){for(var e=0;t>=4;)e+=2,t>>=1;return e+t},t.prototype.huffmanSendAllTrees=function(t){this.treeCodeLengths.buildCodes(),this.treeLiteral.buildCodes(),this.treeDistances.buildCodes(),this.pendingBufferWriteBits(this.treeLiteral.treeLength-257,5),this.pendingBufferWriteBits(this.treeDistances.treeLength-1,5),this.pendingBufferWriteBits(t-4,4);for(var e=0;e<t;e++)this.pendingBufferWriteBits(this.treeCodeLengths.codeLengths[d.huffCodeLengthOrders[e]],3);this.treeLiteral.writeTree(this.treeCodeLengths),this.treeDistances.writeTree(this.treeCodeLengths)},t.prototype.huffmanReset=function(){this.bufferPosition=0,this.extraBits=0,this.treeLiteral.reset(),this.treeDistances.reset(),this.treeCodeLengths.reset()},t.prototype.huffmanCompressBlock=function(){for(var t=0;t<this.bufferPosition;t++){var e=255&this.arrLiterals[t],i=this.arrDistances[t];if(0!=i--){var r=this.huffmanLengthCode(e);this.treeLiteral.writeCodeToStream(r);var n=Math.floor((r-261)/4);n>0&&n<=5&&this.pendingBufferWriteBits(e&(1<<n)-1,n);var s=this.huffmanDistanceCode(i);this.treeDistances.writeCodeToStream(s),(n=Math.floor(s/2-1))>0&&this.pendingBufferWriteBits(i&(1<<n)-1,n)}else this.treeLiteral.writeCodeToStream(e)}this.treeLiteral.writeCodeToStream(256)},t.prototype.pendingBufferWriteBits=function(t,e){var i=new Uint32Array(1);i[0]=this.pendingBufCache|t<<this.pendingBufBitsInCache,this.pendingBufCache=i[0],this.pendingBufBitsInCache+=e,this.pendingBufferFlushBits()},t.prototype.pendingBufferFlush=function(t){if(this.pendingBufferFlushBits(),this.pendingBufLength>0){var e=new Uint8Array(this.pendingBufLength);e.set(this.pendingBuffer.subarray(0,this.pendingBufLength),0),this.stream.push(e)}this.pendingBufLength=0},t.prototype.pendingBufferFlushBits=function(){for(var t=0;this.pendingBufBitsInCache>=8&&this.pendingBufLength<65536;)this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache,this.pendingBufCache>>=8,this.pendingBufBitsInCache-=8,t++;return t},t.prototype.pendingBufferWriteByteBlock=function(t,e,i){var r=t.subarray(e,e+i);this.pendingBuffer.set(r,this.pendingBufLength),this.pendingBufLength+=i},t.prototype.pendingBufferWriteShort=function(t){this.pendingBuffer[this.pendingBufLength++]=t,this.pendingBuffer[this.pendingBufLength++]=t>>8},t.prototype.pendingBufferAlignToByte=function(){this.pendingBufBitsInCache>0&&(this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache),this.pendingBufCache=0,this.pendingBufBitsInCache=0},t.initHuffmanTree=function(){for(var t=0;t<144;)h[t]=d.bitReverse(48+t<<8),a[t++]=8;for(;t<256;)h[t]=d.bitReverse(256+t<<7),a[t++]=9;for(;t<280;)h[t]=d.bitReverse(-256+t<<9),a[t++]=7;for(;t<286;)h[t]=d.bitReverse(-88+t<<8),a[t++]=8;for(t=0;t<30;t++)f[t]=d.bitReverse(t<<11),u[t]=5},t.prototype.close=function(){do{this.pendingBufferFlush(!0),this.compressData(!0)||(this.pendingBufferFlush(!0),this.pendingBufferAlignToByte(),this.noWrap||(this.pendingBufferWriteShortBytes(this.checkSum>>16),this.pendingBufferWriteShortBytes(65535&this.checkSum)),this.pendingBufferFlush(!0))}while(this.inputEnd!==this.inputOffset||0!==this.pendingBufLength)},t.prototype.destroy=function(){this.stream=[],this.stream=void 0,this.pendingBuffer=void 0,this.treeLiteral=void 0,this.treeDistances=void 0,this.treeCodeLengths=void 0,this.arrLiterals=void 0,this.arrDistances=void 0,this.hashHead=void 0,this.hashPrevious=void 0,this.dataWindow=void 0,this.inputBuffer=void 0,this.pendingBufLength=void 0,this.pendingBufCache=void 0,this.pendingBufBitsInCache=void 0,this.bufferPosition=void 0,this.extraBits=void 0,this.currentHash=void 0,this.matchStart=void 0,this.matchLength=void 0,this.matchPrevAvail=void 0,this.blockStart=void 0,this.stringStart=void 0,this.lookAhead=void 0,this.totalBytesIn=void 0,this.inputOffset=void 0,this.inputEnd=void 0,this.windowSize=void 0,this.windowMask=void 0,this.hashSize=void 0,this.hashMask=void 0,this.hashShift=void 0,this.maxDist=void 0,this.checkSum=void 0,this.noWrap=void 0},t.isHuffmanTreeInitiated=!1,t}(),d=function(){function t(t,e,i,r){this.writer=t,this.codeMinCount=i,this.maxLength=r,this.codeFrequency=new Uint16Array(e),this.lengthCount=new Int32Array(r)}return Object.defineProperty(t.prototype,"treeLength",{get:function(){return this.codeCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeLengths",{get:function(){return this.codeLength},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeFrequencies",{get:function(){return this.codeFrequency},enumerable:!0,configurable:!0}),t.prototype.setStaticCodes=function(t,e){var i=new Int16Array(t.length);i.set(t,0),this.codes=i;var r=new Uint8Array(e.length);r.set(e,0),this.codeLength=r},t.prototype.reset=function(){for(var t=0;t<this.codeFrequency.length;t++)this.codeFrequency[t]=0;this.codes=void 0,this.codeLength=void 0},t.prototype.writeCodeToStream=function(t){this.writer.pendingBufferWriteBits(65535&this.codes[t],this.codeLength[t])},t.prototype.buildCodes=function(){var e=new Int32Array(this.maxLength);this.codes=new Int16Array(this.codeCount);for(var i=0,r=0;r<this.maxLength;r++)e[r]=i,i+=this.lengthCount[r]<<15-r;for(var n=0;n<this.codeCount;n++){var s=this.codeLength[n];s>0&&(this.codes[n]=t.bitReverse(e[s-1]),e[s-1]+=1<<16-s)}},t.bitReverse=function(e){return t.reverseBits[15&e]<<12|t.reverseBits[e>>4&15]<<8|t.reverseBits[e>>8&15]<<4|t.reverseBits[e>>12]},t.prototype.getEncodedLength=function(){for(var t=0,e=0;e<this.codeFrequency.length;e++)t+=this.codeFrequency[e]*this.codeLength[e];return t},t.prototype.calculateBLFreq=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var o=this.codeLength[s];for(0===o?(e=138,i=3):(e=6,i=3,n!==o&&(t.codeFrequency[o]++,r=0)),n=o,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););r<i?t.codeFrequency[n]+=r:0!==n?t.codeFrequency[16]++:r<=10?t.codeFrequency[17]++:t.codeFrequency[18]++}},t.prototype.writeTree=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var o=this.codeLength[s];for(0===o?(e=138,i=3):(e=6,i=3,n!==o&&(t.writeCodeToStream(o),r=0)),n=o,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););if(r<i)for(;r-- >0;)t.writeCodeToStream(n);else 0!==n?(t.writeCodeToStream(16),this.writer.pendingBufferWriteBits(r-3,2)):r<=10?(t.writeCodeToStream(17),this.writer.pendingBufferWriteBits(r-3,3)):(t.writeCodeToStream(18),this.writer.pendingBufferWriteBits(r-11,7))}},t.prototype.buildTree=function(){for(var t=this.codeFrequency.length,e=new Int32Array(t),i=0,r=0,n=0;n<t;n++){var s=this.codeFrequency[n];if(0!==s){for(var o=i++,h=0;o>0&&this.codeFrequency[e[h=Math.floor((o-1)/2)]]>s;)e[o]=e[h],o=h;e[o]=n,r=n}}for(;i<2;)e[i++]=r<2?++r:0;this.codeCount=Math.max(r+1,this.codeMinCount);for(var a=i,f=new Int32Array(4*i-2),u=new Int32Array(2*i-1),c=0;c<i;c++){var d=e[c],p=2*c;f[p]=d,f[p+1]=-1,u[c]=this.codeFrequency[d]<<8,e[c]=c}this.constructHuffmanTree(e,i,u,a,f),this.buildLength(f)},t.prototype.constructHuffmanTree=function(t,e,i,r,n){do{for(var s=t[0],o=t[--e],h=i[o],a=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[a]=t[f],f=2*(a=f)+1;for(;(f=a)>0&&i[t[a=Math.floor((f-1)/2)]]>h;)t[f]=t[a];t[f]=o;var u=t[0];n[2*(o=r++)]=s,n[2*o+1]=u;var c=Math.min(255&i[s],255&i[u]);for(i[o]=h=i[s]+i[u]-c+1,a=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[a]=t[f],f=2*(a=f)+1;for(;(f=a)>0&&i[t[a=Math.floor((f-1)/2)]]>h;)t[f]=t[a];t[f]=o}while(e>1)},t.prototype.buildLength=function(t){this.codeLength=new Uint8Array(this.codeFrequency.length);for(var e=Math.floor(t.length/2),i=Math.floor((e+1)/2),r=0,n=0;n<this.maxLength;n++)this.lengthCount[n]=0;if(0!==(r=this.calculateOptimalCodeLength(t,r,e))){var s=this.maxLength-1;do{for(;0===this.lengthCount[--s];);do{this.lengthCount[s]--,this.lengthCount[++s]++,r-=1<<this.maxLength-1-s}while(r>0&&s<this.maxLength-1)}while(r>0);this.recreateTree(t,r,i)}},t.prototype.recreateTree=function(t,e,i){this.lengthCount[this.maxLength-1]+=e,this.lengthCount[this.maxLength-2]-=e;for(var r=2*i,n=this.maxLength;0!==n;n--)for(var s=this.lengthCount[n-1];s>0;){var o=2*t[r++];-1===t[o+1]&&(this.codeLength[t[o]]=n,s--)}},t.prototype.calculateOptimalCodeLength=function(t,e,i){var r=new Int32Array(i);r[i-1]=0;for(var n=i-1;n>=0;n--){var s=2*n+1;if(-1!==t[s]){(o=r[n]+1)>this.maxLength&&(o=this.maxLength,e++),r[t[s-1]]=r[t[s]]=o}else{var o=r[n];this.lengthCount[o-1]++,this.codeLength[t[s-1]]=r[n]}}return e},t.reverseBits=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],t.huffCodeLengthOrders=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],t}(),p=function(){function t(){}return t.checksumUpdate=function(e,i,r,n){var s=new Uint32Array(1);s[0]=e;for(var o=s[0],h=s[0]=65535&o,a=s[0]=o>>t.checkSumBitOffset;n>0;){var f=Math.min(n,t.checksumIterationCount);for(n-=f;--f>=0;)a+=h+=s[0]=255&i[r++];h%=t.checksumBase,a%=t.checksumBase}return o=a<<t.checkSumBitOffset|h},t.checkSumBitOffset=16,t.checksumBase=65521,t.checksumIterationCount=3800,t}(),l=function(){function t(t){this.buildTree(t)}return t.init=function(){var e,i;for(e=new Uint8Array(288),i=0;i<144;)e[i++]=8;for(;i<256;)e[i++]=9;for(;i<280;)e[i++]=7;for(;i<288;)e[i++]=8;for(t.m_LengthTree=new t(e),e=new Uint8Array(32),i=0;i<32;)e[i++]=5;t.m_DistanceTree=new t(e)},t.prototype.prepareData=function(e,i,r){for(var n=0,s=512,o=0;o<r.length;o++){var h=r[o];h>0&&e[h]++}for(var a=1;a<=t.MAX_BITLEN;a++)if(i[a]=n,n+=e[a]<<16-a,a>=10){s+=(130944&n)-(130944&i[a])>>16-a}return{code:n,treeSize:s}},t.prototype.treeFromData=function(e,r,n,s,o){for(var h=new Int16Array(o),a=512,f=t.MAX_BITLEN;f>=10;f--)for(var u=130944&s,c=130944&(s-=e[f]<<16-f);c<u;c+=128)h[i.bitReverse(c)]=i.bitConverterInt32ToInt16(-a<<4|f),a+=1<<f-9;for(c=0;c<n.length;c++){if(0!=(f=n[c])){s=r[f];var d=i.bitReverse(s);if(f<=9)do{h[d]=i.bitConverterInt32ToInt16(c<<4|f),d+=1<<f}while(d<512);else{var p=h[511&d],l=1<<(15&p);p=-(p>>4);do{h[p|d>>9]=i.bitConverterInt32ToInt16(c<<4|f),d+=1<<f}while(d<l)}r[f]=s+(1<<16-f)}}return h},t.prototype.buildTree=function(t){var e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=this.prepareData(e,i,t);this.m_Tree=this.treeFromData(e,i,t,r.code,r.treeSize)},t.prototype.unpackSymbol=function(t){var e,i;if((e=t.peekBits(9))>=0){if((i=this.m_Tree[e])>=0)return t.skipBits(15&i),i>>4;var r=-(i>>4),n=15&i;if((e=t.peekBits(n))>=0)return i=this.m_Tree[r|e>>9],t.skipBits(15&i),i>>4;var s=t.availableBits;return e=t.peekBits(s),(15&(i=this.m_Tree[r|e>>9]))<=s?(t.skipBits(15&i),i>>4):-1}s=t.availableBits;return e=t.peekBits(s),(i=this.m_Tree[e])>=0&&(15&i)<=s?(t.skipBits(15&i),i>>4):-1},Object.defineProperty(t,"lengthTree",{get:function(){return this.m_LengthTree},enumerable:!0,configurable:!0}),Object.defineProperty(t,"distanceTree",{get:function(){return this.m_DistanceTree},enumerable:!0,configurable:!0}),t.MAX_BITLEN=15,t}(),m=function(){function t(){}return t.ChecksumUpdate=function(t,e,i,r){for(var n=t,s=65535&n,o=n>>this.DEF_CHECKSUM_BIT_OFFSET;r>0;){var h=Math.min(r,this.DEF_CHECKSUM_ITERATIONSCOUNT);for(r-=h;--h>=0;)o+=s+=255&e[i++];s%=this.DEF_CHECKSUM_BASE,o%=this.DEF_CHECKSUM_BASE}t=n=o<<this.DEF_CHECKSUM_BIT_OFFSET|s},t.ChecksumGenerate=function(e,i,r){return t.ChecksumUpdate(1,e,i,r),1},t.DEF_CHECKSUM_BIT_OFFSET=16,t.DEF_CHECKSUM_BASE=65521,t.DEF_CHECKSUM_ITERATIONSCOUNT=3800,t}(),g=function(){function t(t,e){if(this.defaultHuffmanDynamicTree=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],this.DEF_HEADER_METHOD_MASK=3840,this.DEF_HEADER_INFO_MASK=61440,this.DEF_HEADER_FLAGS_FCHECK=31,this.DEF_HEADER_FLAGS_FDICT=32,this.DEF_HEADER_FLAGS_FLEVEL=192,this.DEF_MAX_WINDOW_SIZE=65535,this.DEF_HUFFMAN_REPEATE_MAX=258,this.DEF_HUFFMAN_END_BLOCK=256,this.DEF_HUFFMAN_LENGTH_MINIMUMCODE=257,this.DEF_HUFFMAN_LENGTH_MAXIMUMCODE=285,this.DEF_HUFFMAN_DISTANCE_MAXIMUMCODE=29,this.mCheckSum=1,this.tBuffer=0,this.mBufferedBits=0,this.mTempBuffer=new Uint8Array(4),this.mBlockBuffer=new Uint8Array(this.DEF_MAX_WINDOW_SIZE),this.mbNoWrap=!1,this.mWindowSize=0,this.mCurrentPosition=0,this.mDataLength=0,this.mbCanReadNextBlock=!0,this.mbCanReadMoreData=!0,this.mbCheckSumRead=!1,null==t)throw new DOMException("stream");if(0===t.length)throw new DOMException("stream - string can not be empty");l.init(),this.mInputStream=new B(t),this.mbNoWrap=e,this.mbNoWrap||this.readZLibHeader(),this.decodeBlockHeader()}return Object.defineProperty(t.prototype,"mBuffer",{get:function(){return this.tBuffer},set:function(t){this.tBuffer=t},enumerable:!0,configurable:!0}),t.prototype.peekBits=function(t){if(t<0)throw new DOMException("count","Bits count can not be less than zero.");if(t>32)throw new DOMException("count","Count of bits is too large.");if(this.mBufferedBits<t&&this.fillBuffer(),this.mBufferedBits<t)return-1;var e=~(4294967295<<t);return i.bitConverterUintToInt32(this.mBuffer&e)},t.prototype.fillBuffer=function(){var t=4-(this.mBufferedBits>>3)-(0!=(7&this.mBufferedBits)?1:0);if(0!==t)for(var e=this.mInputStream.read(this.mTempBuffer,0,t),r=0;r<e;r++)this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer|i.bitConverterInt32ToUint(this.mTempBuffer[r]<<this.mBufferedBits)),this.mBufferedBits+=8},t.prototype.skipBits=function(t){if(t<0)throw new DOMException("count","Bits count can not be less than zero.");0!==t&&(t>=this.mBufferedBits?(t-=this.mBufferedBits,this.mBufferedBits=0,this.mBuffer=0,t>0&&(this.mInputStream.position+=t>>3,(t&=7)>0&&(this.fillBuffer(),this.mBufferedBits-=t,this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer>>>t)))):(this.mBufferedBits-=t,this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer>>>t)))},Object.defineProperty(t.prototype,"availableBits",{get:function(){return this.mBufferedBits},enumerable:!0,configurable:!0}),t.prototype.readZLibHeader=function(){var t=this.readInt16();if(-1===t)throw new DOMException("Header of the stream can not be read.");if(t%31!=0)throw new DOMException("Header checksum illegal");if(2048!=(t&this.DEF_HEADER_METHOD_MASK))throw new DOMException("Unsupported compression method.");if(this.mWindowSize=Math.pow(2,8+((t&this.DEF_HEADER_INFO_MASK)>>12)),this.mWindowSize>65535)throw new DOMException("Unsupported window size for deflate compression method.");if((t&this.DEF_HEADER_FLAGS_FDICT)>>5==1)throw new DOMException("Custom dictionary is not supported at the moment.")},t.prototype.readInt16=function(){var t=this.readBits(8)<<8;return t|=this.readBits(8)},t.prototype.readBits=function(t){var e=this.peekBits(t);return-1===e?-1:(this.mBufferedBits-=t,this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer>>>t),e)},t.prototype.decodeBlockHeader=function(){if(!this.mbCanReadNextBlock)return!1;var t=this.readBits(1);if(-1===t)return!1;var e=this.readBits(2);if(-1===e)return!1;switch(this.mbCanReadNextBlock=0===t,e){case 0:this.mbReadingUncompressed=!0,this.skipToBoundary();var i=this.readInt16Inverted();if(i!==(65535^this.readInt16Inverted()))throw new DOMException("Wrong block length.");if(i>65535)throw new DOMException("Uncompressed block length can not be more than 65535.");this.mUncompressedDataLength=i,this.mCurrentLengthTree=null,this.mCurrentDistanceTree=null;break;case 1:this.mbReadingUncompressed=!1,this.mUncompressedDataLength=-1,this.mCurrentLengthTree=l.lengthTree,this.mCurrentDistanceTree=l.distanceTree;break;case 2:this.mbReadingUncompressed=!1,this.mUncompressedDataLength=-1;var r=this.decodeDynamicHeader(this.mCurrentLengthTree,this.mCurrentDistanceTree);this.mCurrentLengthTree=r.lengthTree,this.mCurrentDistanceTree=r.distanceTree;break;default:throw new DOMException("Wrong block type.")}return!0},t.prototype.skipToBoundary=function(){this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer>>>(7&this.mBufferedBits)),this.mBufferedBits&=-8},t.prototype.readInt16Inverted=function(){var t=this.readBits(8);return t|=this.readBits(8)<<8},t.prototype.decodeDynamicHeader=function(e,i){var r=0,n=this.readBits(5),s=this.readBits(5),o=this.readBits(4);if(n<0||s<0||o<0)throw new DOMException("Wrong dynamic huffman codes.");var h=(n+=257)+(s+=1),a=new Uint8Array(h),f=new Uint8Array(19);o+=4;for(var u=0;u<o;){var c=this.readBits(3);if(c<0)throw new DOMException("Wrong dynamic huffman codes.");f[this.defaultHuffmanDynamicTree[u++]]=c}var d=new l(f);for(u=0;;){var p=void 0,m=!1;for(p=d.unpackSymbol(this);0==(-16&p);){if(a[u++]=r=p,u===h){m=!0;break}p=d.unpackSymbol(this)}if(m)break;if(p<0)throw new DOMException("Wrong dynamic huffman codes.");if(p>=17)r=0;else if(0===u)throw new DOMException("Wrong dynamic huffman codes.");var g=p-16,B=t.DEF_HUFFMAN_DYNTREE_REPEAT_BITS[g],v=this.readBits(B);if(v<0)throw new DOMException("Wrong dynamic huffman codes.");if(v+=t.DEF_HUFFMAN_DYNTREE_REPEAT_MINIMUMS[g],u+v>h)throw new DOMException("Wrong dynamic huffman codes.");for(;v-- >0;)a[u++]=r;if(u===h)break}var w=new Uint8Array(n);return w.set(a.subarray(0,n),0),e=new l(w),w=a.slice(n,n+s),i=new l(w),{lengthTree:e,distanceTree:i}},t.prototype.readHuffman=function(){for(var e=this.DEF_MAX_WINDOW_SIZE-(this.mDataLength-this.mCurrentPosition),i=!1,r={};e>=this.DEF_HUFFMAN_REPEATE_MAX;){var n=void 0;for(n=this.mCurrentLengthTree.unpackSymbol(this);0==(-256&n);){if(r[(this.mDataLength+1)%this.DEF_MAX_WINDOW_SIZE]=n,this.mBlockBuffer[this.mDataLength++%this.DEF_MAX_WINDOW_SIZE]=n,i=!0,--e<this.DEF_HUFFMAN_REPEATE_MAX)return!0;n=this.mCurrentLengthTree.unpackSymbol(this)}if(n<this.DEF_HUFFMAN_LENGTH_MINIMUMCODE){if(n<this.DEF_HUFFMAN_END_BLOCK)throw new DOMException("Illegal code.");var s=i?1:0;this.mbCanReadMoreData=this.decodeBlockHeader();return!!(s|(this.mbCanReadMoreData?1:0))}if(n>this.DEF_HUFFMAN_LENGTH_MAXIMUMCODE)throw new DOMException("Illegal repeat code length.");var o=t.DEF_HUFFMAN_REPEAT_LENGTH_BASE[n-this.DEF_HUFFMAN_LENGTH_MINIMUMCODE],h=t.DEF_HUFFMAN_REPEAT_LENGTH_EXTENSION[n-this.DEF_HUFFMAN_LENGTH_MINIMUMCODE];if(h>0){if((f=this.readBits(h))<0)throw new DOMException("Wrong data.");o+=f}if((n=this.mCurrentDistanceTree.unpackSymbol(this))<0||n>t.DEF_HUFFMAN_REPEAT_DISTANCE_BASE.length)throw new DOMException("Wrong distance code.");var a=t.DEF_HUFFMAN_REPEAT_DISTANCE_BASE[n];if((h=t.DEF_HUFFMAN_REPEAT_DISTANCE_EXTENSION[n])>0){var f;if((f=this.readBits(h))<0)throw new DOMException("Wrong data.");a+=f}for(var u=0;u<o;u++)this.mBlockBuffer[this.mDataLength%this.DEF_MAX_WINDOW_SIZE]=this.mBlockBuffer[(this.mDataLength-a)%this.DEF_MAX_WINDOW_SIZE],this.mDataLength++,e--;i=!0}return i},t.prototype.read=function(t,e,r){if(null==t)throw new DOMException("buffer");if(e<0||e>t.length-1)throw new DOMException("offset","Offset does not belong to specified buffer.");if(r<0||r>t.length-e)throw new DOMException("length","Length is illegal.");for(var n=r;r>0;)if(this.mCurrentPosition<this.mDataLength){var s=this.mCurrentPosition%this.DEF_MAX_WINDOW_SIZE,o=Math.min(this.DEF_MAX_WINDOW_SIZE-s,this.mDataLength-this.mCurrentPosition);o=Math.min(o,r),i.arrayCopy(this.mBlockBuffer,s,t,e,o),this.mCurrentPosition+=o,e+=o,r-=o}else{if(!this.mbCanReadMoreData)break;var h=this.mDataLength;if(this.mbReadingUncompressed)if(0===this.mUncompressedDataLength){if(this.mbCanReadMoreData=this.decodeBlockHeader(),!this.mbCanReadMoreData)break}else{s=this.mDataLength%this.DEF_MAX_WINDOW_SIZE;var a=Math.min(this.mUncompressedDataLength,this.DEF_MAX_WINDOW_SIZE-s),f=this.readPackedBytes(this.mBlockBuffer,s,a);if(a!==f)throw new DOMException("Not enough data in stream.");this.mUncompressedDataLength-=f,this.mDataLength+=f}else if(!this.readHuffman())break;if(h<this.mDataLength){var u=h%this.DEF_MAX_WINDOW_SIZE,c=this.mDataLength%this.DEF_MAX_WINDOW_SIZE;u<c?this.checksumUpdate(this.mBlockBuffer,u,c-u):(this.checksumUpdate(this.mBlockBuffer,u,this.DEF_MAX_WINDOW_SIZE-u),c>0&&this.checksumUpdate(this.mBlockBuffer,0,c))}}if(!this.mbCanReadMoreData&&!this.mbCheckSumRead&&!this.mbNoWrap){this.skipToBoundary();if(this.readInt32()!==this.mCheckSum)throw new DOMException("Checksum check failed.");this.mbCheckSumRead=!0}return n-r},t.prototype.readPackedBytes=function(t,e,r){if(null==t)throw new DOMException("buffer");if(e<0||e>t.length-1)throw new DOMException('offset", "Offset can not be less than zero or greater than buffer length - 1.');if(r<0)throw new DOMException('length", "Length can not be less than zero.');if(r>t.length-e)throw new DOMException('length", "Length is too large.');if(0!=(7&this.mBufferedBits))throw new DOMException("Reading of unalligned data is not supported.");if(0===r)return 0;for(var n=0;this.mBufferedBits>0&&r>0;)t[e++]=this.mBuffer,this.mBufferedBits-=8,this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer>>>8),r--,n++;return r>0&&(n+=this.mInputStream.read(t,e,r)),n},t.prototype.readInt32=function(){var t=this.readBits(8)<<24;return t|=this.readBits(8)<<16,t|=this.readBits(8)<<8,t|=this.readBits(8)},t.prototype.checksumUpdate=function(t,e,i){m.ChecksumUpdate(this.mCheckSum,t,e,i)},t.DEF_REVERSE_BITS=new Uint8Array([0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15]),t.DEF_HUFFMAN_DYNTREE_REPEAT_MINIMUMS=[3,3,11],t.DEF_HUFFMAN_DYNTREE_REPEAT_BITS=[2,3,7],t.DEF_HUFFMAN_REPEAT_LENGTH_BASE=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],t.DEF_HUFFMAN_REPEAT_LENGTH_EXTENSION=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],t.DEF_HUFFMAN_REPEAT_DISTANCE_BASE=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],t.DEF_HUFFMAN_REPEAT_DISTANCE_EXTENSION=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],t}(),B=function(){function t(t){this.position=0,this.inputStream=new Uint8Array(t.buffer)}return Object.defineProperty(t.prototype,"length",{get:function(){return this.inputStream.buffer.byteLength},enumerable:!0,configurable:!0}),t.prototype.read=function(t,e,i){var r=new Uint8Array(this.inputStream.buffer,this.position+e).subarray(0,i);return t.set(r,0),this.position+=r.byteLength,r.byteLength},t.prototype.readByte=function(){return this.inputStream[this.position++]},t.prototype.write=function(t,e,r){i.arrayCopy(t,0,this.inputStream,this.position+e,r),this.position+=r},t.prototype.toByteArray=function(){return new Uint8Array(this.inputStream.buffer)},t}();t.ZipArchive=n,t.ZipArchiveItemHelper=s,t.ZipArchiveItem=o,t.CompressedStreamWriter=c,t.CompressorHuffmanTree=d,t.ChecksumCalculator=p,t.Utils=i,t.DecompressorHuffmanTree=l,t.CompressedStreamReader=g,t.Stream=B,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=ej2-compression.umd.min.js.map
/*!
* filename: ej2-compression.min.js
* version : 20.4.48
* version : 21.1.35
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.

@@ -10,3 +10,3 @@ * Use of this code is subject to the terms of our license.

*/
this.ej=this.ej||{},this.ej.compression=function(t,e){"use strict";var i=new Int16Array(286),r=new Uint8Array(286),n=new Int16Array(30),s=new Uint8Array(30),h=function(){function t(e){this.pendingBuffer=new Uint8Array(65536),this.pendingBufLength=0,this.pendingBufCache=0,this.pendingBufBitsInCache=0,this.bufferPosition=0,this.extraBits=0,this.currentHash=0,this.matchStart=0,this.matchLength=0,this.matchPrevAvail=!1,this.blockStart=0,this.stringStart=0,this.lookAhead=0,this.totalBytesIn=0,this.inputOffset=0,this.inputEnd=0,this.windowSize=32768,this.windowMask=this.windowSize-1,this.hashSize=32768,this.hashMask=this.hashSize-1,this.hashShift=Math.floor(17/3),this.maxDist=this.windowSize-262,this.checkSum=1,this.noWrap=!1,t.isHuffmanTreeInitiated||(t.initHuffmanTree(),t.isHuffmanTreeInitiated=!0),this.treeLiteral=new o(this,286,257,15),this.treeDistances=new o(this,30,1,15),this.treeCodeLengths=new o(this,19,4,7),this.arrDistances=new Uint16Array(16384),this.arrLiterals=new Uint8Array(16384),this.stream=[],this.dataWindow=new Uint8Array(2*this.windowSize),this.hashHead=new Int16Array(this.hashSize),this.hashPrevious=new Int16Array(this.windowSize),this.blockStart=this.stringStart=1,this.noWrap=e,e||this.writeZLibHeader()}return Object.defineProperty(t.prototype,"compressedData",{get:function(){return this.stream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"getCompressedString",{get:function(){var t="";if(void 0!==this.stream)for(var e=0;e<this.stream.length;e++)t+=String.fromCharCode.apply(null,this.stream[e]);return t},enumerable:!0,configurable:!0}),t.prototype.write=function(t,i,r){if(void 0===t||null===t)throw new Error("ArgumentException: data cannot null or undefined");var n=i+r;if(0>i||i>n||n>t.length)throw new Error("ArgumentOutOfRangeException: Offset or length is incorrect");if("string"==typeof t){var s=new e.Encoding(!1);s.type="Utf8",n=i+(t=new Uint8Array(s.getBytes(t,0,t.length))).length}for(this.inputBuffer=t,this.inputOffset=i,this.inputEnd=n,this.noWrap||(this.checkSum=a.checksumUpdate(this.checkSum,this.inputBuffer,this.inputOffset,n));this.inputEnd!==this.inputOffset||0!==this.pendingBufLength;)this.pendingBufferFlush(),this.compressData(!1)},t.prototype.writeZLibHeader=function(){var t=30720;t|=64,t+=31-t%31,this.pendingBufferWriteShortBytes(t)},t.prototype.pendingBufferWriteShortBytes=function(t){this.pendingBuffer[this.pendingBufLength++]=t>>8,this.pendingBuffer[this.pendingBufLength++]=t},t.prototype.compressData=function(t){var e;do{this.fillWindow();var i=t&&this.inputEnd===this.inputOffset;e=this.compressSlow(i,t)}while(0===this.pendingBufLength&&e);return e},t.prototype.compressSlow=function(t,e){if(this.lookAhead<262&&!t)return!1;for(;this.lookAhead>=262||t;){if(0===this.lookAhead)return this.lookAheadCompleted(e);this.stringStart>=2*this.windowSize-262&&this.slideWindow();var i=this.matchStart,r=this.matchLength;if(this.lookAhead>=3&&this.discardMatch(),r>=3&&this.matchLength<=r?r=this.matchPreviousBest(i,r):this.matchPreviousAvailable(),this.bufferPosition>=16384)return this.huffmanIsFull(e)}return!0},t.prototype.discardMatch=function(){var t=this.insertString();0!==t&&this.stringStart-t<=this.maxDist&&this.findLongestMatch(t)&&this.matchLength<=5&&3===this.matchLength&&this.stringStart-this.matchStart>4096&&(this.matchLength=2)},t.prototype.matchPreviousAvailable=function(){this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!0,this.stringStart++,this.lookAhead--},t.prototype.matchPreviousBest=function(t,e){this.huffmanTallyDist(this.stringStart-1-t,e),e-=2;do{this.stringStart++,--this.lookAhead>=3&&this.insertString()}while(--e>0);return this.stringStart++,this.lookAhead--,this.matchPrevAvail=!1,this.matchLength=2,e},t.prototype.lookAheadCompleted=function(t){return this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!1,this.huffmanFlushBlock(this.dataWindow,this.blockStart,this.stringStart-this.blockStart,t),this.blockStart=this.stringStart,!1},t.prototype.huffmanIsFull=function(t){var e=this.stringStart-this.blockStart;this.matchPrevAvail&&e--;var i=t&&0===this.lookAhead&&!this.matchPrevAvail;return this.huffmanFlushBlock(this.dataWindow,this.blockStart,e,i),this.blockStart+=e,!i},t.prototype.fillWindow=function(){for(this.stringStart>=this.windowSize+this.maxDist&&this.slideWindow();this.lookAhead<262&&this.inputOffset<this.inputEnd;){var t=2*this.windowSize-this.lookAhead-this.stringStart;t>this.inputEnd-this.inputOffset&&(t=this.inputEnd-this.inputOffset),this.dataWindow.set(this.inputBuffer.subarray(this.inputOffset,this.inputOffset+t),this.stringStart+this.lookAhead),this.inputOffset+=t,this.totalBytesIn+=t,this.lookAhead+=t}this.lookAhead>=3&&this.updateHash()},t.prototype.slideWindow=function(){this.dataWindow.set(this.dataWindow.subarray(this.windowSize,this.windowSize+this.windowSize),0),this.matchStart-=this.windowSize,this.stringStart-=this.windowSize,this.blockStart-=this.windowSize;for(t=0;t<this.hashSize;++t){e=65535&this.hashHead[t];this.hashHead[t]=e>=this.windowSize?e-this.windowSize:0}for(var t=0;t<this.windowSize;t++){var e=65535&this.hashPrevious[t];this.hashPrevious[t]=e>=this.windowSize?e-this.windowSize:0}},t.prototype.insertString=function(){var t,e=(this.currentHash<<this.hashShift^this.dataWindow[this.stringStart+2])&this.hashMask;return this.hashPrevious[this.stringStart&this.windowMask]=t=this.hashHead[e],this.hashHead[e]=this.stringStart,this.currentHash=e,65535&t},t.prototype.findLongestMatch=function(t){var e,i=4096,r=258,n=this.stringStart,s=this.stringStart+this.matchLength,h=Math.max(this.matchLength,2),o=Math.max(this.stringStart-this.maxDist,0),a=this.stringStart+258-1,f=this.dataWindow[s-1],u=this.dataWindow[s],d=this.dataWindow;h>=32&&(i>>=2),r>this.lookAhead&&(r=this.lookAhead);do{if(d[t+h]===u&&d[t+h-1]===f&&d[t]===d[n]&&d[t+1]===d[n+1]){for(e=t+2,n+=2;d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&d[++n]===d[++e]&&n<a;);if(n>s){if(this.matchStart=t,s=n,(h=n-this.stringStart)>=r)break;f=d[s-1],u=d[s]}n=this.stringStart}}while((t=65535&this.hashPrevious[t&this.windowMask])>o&&0!=--i);return this.matchLength=Math.min(h,this.lookAhead),this.matchLength>=3},t.prototype.updateHash=function(){this.currentHash=this.dataWindow[this.stringStart]<<this.hashShift^this.dataWindow[this.stringStart+1]},t.prototype.huffmanTallyLit=function(t){return this.arrDistances[this.bufferPosition]=0,this.arrLiterals[this.bufferPosition++]=t,this.treeLiteral.codeFrequencies[t]++,this.bufferPosition>=16384},t.prototype.huffmanTallyDist=function(t,e){this.arrDistances[this.bufferPosition]=t,this.arrLiterals[this.bufferPosition++]=e-3;var i=this.huffmanLengthCode(e-3);this.treeLiteral.codeFrequencies[i]++,i>=265&&i<285&&(this.extraBits+=Math.floor((i-261)/4));var r=this.huffmanDistanceCode(t-1);return this.treeDistances.codeFrequencies[r]++,r>=4&&(this.extraBits+=Math.floor(r/2-1)),this.bufferPosition>=16384},t.prototype.huffmanFlushBlock=function(t,e,h,a){this.treeLiteral.codeFrequencies[256]++,this.treeLiteral.buildTree(),this.treeDistances.buildTree(),this.treeLiteral.calculateBLFreq(this.treeCodeLengths),this.treeDistances.calculateBLFreq(this.treeCodeLengths),this.treeCodeLengths.buildTree();for(var f=4,u=18;u>f;u--)this.treeCodeLengths.codeLengths[o.huffCodeLengthOrders[u]]>0&&(f=u+1);for(var d=14+3*f+this.treeCodeLengths.getEncodedLength()+this.treeLiteral.getEncodedLength()+this.treeDistances.getEncodedLength()+this.extraBits,c=this.extraBits,u=0;u<286;u++)c+=this.treeLiteral.codeFrequencies[u]*r[u];for(u=0;u<30;u++)c+=this.treeDistances.codeFrequencies[u]*s[u];d>=c&&(d=c),e>=0&&h+4<d>>3?this.huffmanFlushStoredBlock(t,e,h,a):d==c?(this.pendingBufferWriteBits(2+(a?1:0),3),this.treeLiteral.setStaticCodes(i,r),this.treeDistances.setStaticCodes(n,s),this.huffmanCompressBlock(),this.huffmanReset()):(this.pendingBufferWriteBits(4+(a?1:0),3),this.huffmanSendAllTrees(f),this.huffmanCompressBlock(),this.huffmanReset())},t.prototype.huffmanFlushStoredBlock=function(t,e,i,r){this.pendingBufferWriteBits(0+(r?1:0),3),this.pendingBufferAlignToByte(),this.pendingBufferWriteShort(i),this.pendingBufferWriteShort(~i),this.pendingBufferWriteByteBlock(t,e,i),this.huffmanReset()},t.prototype.huffmanLengthCode=function(t){if(255===t)return 285;for(var e=257;t>=8;)e+=4,t>>=1;return e+t},t.prototype.huffmanDistanceCode=function(t){for(var e=0;t>=4;)e+=2,t>>=1;return e+t},t.prototype.huffmanSendAllTrees=function(t){this.treeCodeLengths.buildCodes(),this.treeLiteral.buildCodes(),this.treeDistances.buildCodes(),this.pendingBufferWriteBits(this.treeLiteral.treeLength-257,5),this.pendingBufferWriteBits(this.treeDistances.treeLength-1,5),this.pendingBufferWriteBits(t-4,4);for(var e=0;e<t;e++)this.pendingBufferWriteBits(this.treeCodeLengths.codeLengths[o.huffCodeLengthOrders[e]],3);this.treeLiteral.writeTree(this.treeCodeLengths),this.treeDistances.writeTree(this.treeCodeLengths)},t.prototype.huffmanReset=function(){this.bufferPosition=0,this.extraBits=0,this.treeLiteral.reset(),this.treeDistances.reset(),this.treeCodeLengths.reset()},t.prototype.huffmanCompressBlock=function(){for(var t=0;t<this.bufferPosition;t++){var e=255&this.arrLiterals[t],i=this.arrDistances[t];if(0!=i--){var r=this.huffmanLengthCode(e);this.treeLiteral.writeCodeToStream(r);var n=Math.floor((r-261)/4);n>0&&n<=5&&this.pendingBufferWriteBits(e&(1<<n)-1,n);var s=this.huffmanDistanceCode(i);this.treeDistances.writeCodeToStream(s),(n=Math.floor(s/2-1))>0&&this.pendingBufferWriteBits(i&(1<<n)-1,n)}else this.treeLiteral.writeCodeToStream(e)}this.treeLiteral.writeCodeToStream(256)},t.prototype.pendingBufferWriteBits=function(t,e){var i=new Uint32Array(1);i[0]=this.pendingBufCache|t<<this.pendingBufBitsInCache,this.pendingBufCache=i[0],this.pendingBufBitsInCache+=e,this.pendingBufferFlushBits()},t.prototype.pendingBufferFlush=function(t){if(this.pendingBufferFlushBits(),this.pendingBufLength>0){var e=new Uint8Array(this.pendingBufLength);e.set(this.pendingBuffer.subarray(0,this.pendingBufLength),0),this.stream.push(e)}this.pendingBufLength=0},t.prototype.pendingBufferFlushBits=function(){for(var t=0;this.pendingBufBitsInCache>=8&&this.pendingBufLength<65536;)this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache,this.pendingBufCache>>=8,this.pendingBufBitsInCache-=8,t++;return t},t.prototype.pendingBufferWriteByteBlock=function(t,e,i){var r=t.subarray(e,e+i);this.pendingBuffer.set(r,this.pendingBufLength),this.pendingBufLength+=i},t.prototype.pendingBufferWriteShort=function(t){this.pendingBuffer[this.pendingBufLength++]=t,this.pendingBuffer[this.pendingBufLength++]=t>>8},t.prototype.pendingBufferAlignToByte=function(){this.pendingBufBitsInCache>0&&(this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache),this.pendingBufCache=0,this.pendingBufBitsInCache=0},t.initHuffmanTree=function(){for(var t=0;t<144;)i[t]=o.bitReverse(48+t<<8),r[t++]=8;for(;t<256;)i[t]=o.bitReverse(256+t<<7),r[t++]=9;for(;t<280;)i[t]=o.bitReverse(-256+t<<9),r[t++]=7;for(;t<286;)i[t]=o.bitReverse(-88+t<<8),r[t++]=8;for(t=0;t<30;t++)n[t]=o.bitReverse(t<<11),s[t]=5},t.prototype.close=function(){do{this.pendingBufferFlush(!0),this.compressData(!0)||(this.pendingBufferFlush(!0),this.pendingBufferAlignToByte(),this.noWrap||(this.pendingBufferWriteShortBytes(this.checkSum>>16),this.pendingBufferWriteShortBytes(65535&this.checkSum)),this.pendingBufferFlush(!0))}while(this.inputEnd!==this.inputOffset||0!==this.pendingBufLength)},t.prototype.destroy=function(){this.stream=[],this.stream=void 0,this.pendingBuffer=void 0,this.treeLiteral=void 0,this.treeDistances=void 0,this.treeCodeLengths=void 0,this.arrLiterals=void 0,this.arrDistances=void 0,this.hashHead=void 0,this.hashPrevious=void 0,this.dataWindow=void 0,this.inputBuffer=void 0,this.pendingBufLength=void 0,this.pendingBufCache=void 0,this.pendingBufBitsInCache=void 0,this.bufferPosition=void 0,this.extraBits=void 0,this.currentHash=void 0,this.matchStart=void 0,this.matchLength=void 0,this.matchPrevAvail=void 0,this.blockStart=void 0,this.stringStart=void 0,this.lookAhead=void 0,this.totalBytesIn=void 0,this.inputOffset=void 0,this.inputEnd=void 0,this.windowSize=void 0,this.windowMask=void 0,this.hashSize=void 0,this.hashMask=void 0,this.hashShift=void 0,this.maxDist=void 0,this.checkSum=void 0,this.noWrap=void 0},t.isHuffmanTreeInitiated=!1,t}(),o=function(){function t(t,e,i,r){this.writer=t,this.codeMinCount=i,this.maxLength=r,this.codeFrequency=new Uint16Array(e),this.lengthCount=new Int32Array(r)}return Object.defineProperty(t.prototype,"treeLength",{get:function(){return this.codeCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeLengths",{get:function(){return this.codeLength},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeFrequencies",{get:function(){return this.codeFrequency},enumerable:!0,configurable:!0}),t.prototype.setStaticCodes=function(t,e){var i=new Int16Array(t.length);i.set(t,0),this.codes=i;var r=new Uint8Array(e.length);r.set(e,0),this.codeLength=r},t.prototype.reset=function(){for(var t=0;t<this.codeFrequency.length;t++)this.codeFrequency[t]=0;this.codes=void 0,this.codeLength=void 0},t.prototype.writeCodeToStream=function(t){this.writer.pendingBufferWriteBits(65535&this.codes[t],this.codeLength[t])},t.prototype.buildCodes=function(){var e=new Int32Array(this.maxLength);this.codes=new Int16Array(this.codeCount);for(var i=0,r=0;r<this.maxLength;r++)e[r]=i,i+=this.lengthCount[r]<<15-r;for(var n=0;n<this.codeCount;n++){var s=this.codeLength[n];s>0&&(this.codes[n]=t.bitReverse(e[s-1]),e[s-1]+=1<<16-s)}},t.bitReverse=function(e){return t.reverseBits[15&e]<<12|t.reverseBits[e>>4&15]<<8|t.reverseBits[e>>8&15]<<4|t.reverseBits[e>>12]},t.prototype.getEncodedLength=function(){for(var t=0,e=0;e<this.codeFrequency.length;e++)t+=this.codeFrequency[e]*this.codeLength[e];return t},t.prototype.calculateBLFreq=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var h=this.codeLength[s];for(0===h?(e=138,i=3):(e=6,i=3,n!==h&&(t.codeFrequency[h]++,r=0)),n=h,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););r<i?t.codeFrequency[n]+=r:0!==n?t.codeFrequency[16]++:r<=10?t.codeFrequency[17]++:t.codeFrequency[18]++}},t.prototype.writeTree=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var h=this.codeLength[s];for(0===h?(e=138,i=3):(e=6,i=3,n!==h&&(t.writeCodeToStream(h),r=0)),n=h,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););if(r<i)for(;r-- >0;)t.writeCodeToStream(n);else 0!==n?(t.writeCodeToStream(16),this.writer.pendingBufferWriteBits(r-3,2)):r<=10?(t.writeCodeToStream(17),this.writer.pendingBufferWriteBits(r-3,3)):(t.writeCodeToStream(18),this.writer.pendingBufferWriteBits(r-11,7))}},t.prototype.buildTree=function(){for(var t=this.codeFrequency.length,e=new Int32Array(t),i=0,r=0,n=0;n<t;n++){var s=this.codeFrequency[n];if(0!==s){for(var h=i++,o=0;h>0&&this.codeFrequency[e[o=Math.floor((h-1)/2)]]>s;)e[h]=e[o],h=o;e[h]=n,r=n}}for(;i<2;)e[i++]=r<2?++r:0;this.codeCount=Math.max(r+1,this.codeMinCount);for(var a=i,f=new Int32Array(4*i-2),u=new Int32Array(2*i-1),d=0;d<i;d++){var c=e[d],p=2*d;f[p]=c,f[p+1]=-1,u[d]=this.codeFrequency[c]<<8,e[d]=d}this.constructHuffmanTree(e,i,u,a,f),this.buildLength(f)},t.prototype.constructHuffmanTree=function(t,e,i,r,n){do{for(var s=t[0],h=t[--e],o=i[h],a=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[a]=t[f],f=2*(a=f)+1;for(;(f=a)>0&&i[t[a=Math.floor((f-1)/2)]]>o;)t[f]=t[a];t[f]=h;var u=t[0];n[2*(h=r++)]=s,n[2*h+1]=u;var d=Math.min(255&i[s],255&i[u]);for(i[h]=o=i[s]+i[u]-d+1,a=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[a]=t[f],f=2*(a=f)+1;for(;(f=a)>0&&i[t[a=Math.floor((f-1)/2)]]>o;)t[f]=t[a];t[f]=h}while(e>1)},t.prototype.buildLength=function(t){this.codeLength=new Uint8Array(this.codeFrequency.length);for(var e=Math.floor(t.length/2),i=Math.floor((e+1)/2),r=0,n=0;n<this.maxLength;n++)this.lengthCount[n]=0;if(0!==(r=this.calculateOptimalCodeLength(t,r,e))){var s=this.maxLength-1;do{for(;0===this.lengthCount[--s];);do{this.lengthCount[s]--,this.lengthCount[++s]++,r-=1<<this.maxLength-1-s}while(r>0&&s<this.maxLength-1)}while(r>0);this.recreateTree(t,r,i)}},t.prototype.recreateTree=function(t,e,i){this.lengthCount[this.maxLength-1]+=e,this.lengthCount[this.maxLength-2]-=e;for(var r=2*i,n=this.maxLength;0!==n;n--)for(var s=this.lengthCount[n-1];s>0;){var h=2*t[r++];-1===t[h+1]&&(this.codeLength[t[h]]=n,s--)}},t.prototype.calculateOptimalCodeLength=function(t,e,i){var r=new Int32Array(i);r[i-1]=0;for(var n=i-1;n>=0;n--){var s=2*n+1;if(-1!==t[s])(h=r[n]+1)>this.maxLength&&(h=this.maxLength,e++),r[t[s-1]]=r[t[s]]=h;else{var h=r[n];this.lengthCount[h-1]++,this.codeLength[t[s-1]]=r[n]}}return e},t.reverseBits=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],t.huffCodeLengthOrders=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],t}(),a=function(){function t(){}return t.checksumUpdate=function(e,i,r,n){var s=new Uint32Array(1);s[0]=e;for(var h=s[0],o=s[0]=65535&h,a=s[0]=h>>t.checkSumBitOffset;n>0;){var f=Math.min(n,t.checksumIterationCount);for(n-=f;--f>=0;)a+=o+=s[0]=255&i[r++];o%=t.checksumBase,a%=t.checksumBase}return h=a<<t.checkSumBitOffset|o},t.checkSumBitOffset=16,t.checksumBase=65521,t.checksumIterationCount=3800,t}(),f=[],u=function(){function t(){0===f.length&&t.initCrc32Table(),this.files=[],this.level="Normal",e.Save.isMicrosoftBrowser=!!navigator.msSaveBlob}return Object.defineProperty(t.prototype,"compressionLevel",{get:function(){return this.level},set:function(t){this.level=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return void 0===this.files?0:this.files.length},enumerable:!0,configurable:!0}),t.prototype.addItem=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: item cannot be null or undefined");for(var e=0;e<this.files.length;e++){var i=this.files[e];if(i instanceof d&&i.name===t.name)throw new Error("item with same name already exist")}this.files.push(t)},t.prototype.addDirectory=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: string cannot be null or undefined");if(0===t.length)throw new Error("ArgumentException: string cannot be empty");if("/"!==t.slice(-1)&&(t+="/"),-1!==this.files.indexOf(t))throw new Error("item with same name already exist");this.files.push(t)},t.prototype.getItem=function(t){if(t>=0&&t<this.files.length)return this.files[t]},t.prototype.contains=function(t){return-1!==this.files.indexOf(t)},t.prototype.save=function(t){if(null===t||void 0===t||0===t.length)throw new Error("ArgumentException: fileName cannot be null or undefined");if(0===this.files.length)throw new Error("InvalidOperation");var e=this;return new Promise(function(i,r){e.saveInternal(t,!1).then(function(){i(e)})})},t.prototype.saveAsBlob=function(){var t=this;return new Promise(function(e,i){t.saveInternal("",!0).then(function(t){e(t)})})},t.prototype.saveInternal=function(t,e){var i=this,r=this;return new Promise(function(n,s){for(var h=[],o=0,a=0;a<r.files.length;a++)i.getCompressedData(i.files[a]).then(function(i){if(o=r.constructZippedObject(h,i,o,i.isDirectory),h.length===r.files.length){var s=r.writeZippedContent(t,h,o,e);n(s)}})})},t.prototype.destroy=function(){if(void 0!==this.files&&this.files.length>0){for(var t=0;t<this.files.length;t++){var e=this.files[t];e instanceof d&&e.destroy(),e=void 0}this.files=[]}this.files=void 0,this.level=void 0},t.prototype.getCompressedData=function(t){var e=this;return new Promise(function(i,r){if(t instanceof d){var n=new FileReader;n.onload=function(){var r=new Uint8Array(n.result),s={fileName:t.name,crc32Value:0,compressedData:[],compressedSize:void 0,uncompressedDataSize:r.length,compressionType:void 0,isDirectory:!1};if("Normal"===e.level){e.compressData(r,s,f);for(var h=0,o=0;o<s.compressedData.length;o++)h+=s.compressedData[o].length;s.compressedSize=h,s.compressionType="\b\0"}else s.compressedSize=r.length,s.crc32Value=e.calculateCrc32Value(0,r,f),s.compressionType="\0\0",s.compressedData.push(r);i(s)},n.readAsArrayBuffer(t.data)}else i({fileName:t,crc32Value:0,compressedData:"",compressedSize:0,uncompressedDataSize:0,compressionType:"\0\0",isDirectory:!0})})},t.prototype.compressData=function(t,e,i){var r=new h(!0),n=0,s=0;do{if(n>=t.length){r.close();break}s=Math.min(t.length,n+16384);var o=t.subarray(n,s);e.crc32Value=this.calculateCrc32Value(e.crc32Value,o,i),r.write(o,0,s-n),n=s}while(n<=t.length);e.compressedData=r.compressedData,r.destroy()},t.prototype.constructZippedObject=function(t,e,i,r){var n=0,s=new Date;r&&(n|=16),n|=0;var h=this.writeHeader(e,s),o="PK"+h+e.fileName,a=this.writeCentralDirectory(e,h,i,n);return t.push({localHeader:o,centralDir:a,compressedData:e}),i+o.length+e.compressedSize},t.prototype.writeHeader=function(t,e){var i="";return i+="\n\0\0\0",i+=t.compressionType,i+=this.getBytes(this.getModifiedTime(e),2),i+=this.getBytes(this.getModifiedDate(e),2),i+=this.getBytes(t.crc32Value,4),i+=this.getBytes(t.compressedSize,4),i+=this.getBytes(t.uncompressedDataSize,4),i+=this.getBytes(t.fileName.length,2),i+=this.getBytes(0,2)},t.prototype.writeZippedContent=function(t,i,r,n){for(var s=0,h=[],o=0;o<i.length;o++){var a=i[o];for(s+=a.centralDir.length,h.push(this.getArrayBuffer(a.localHeader));a.compressedData.compressedData.length;)h.push(a.compressedData.compressedData.shift().buffer)}for(o=0;o<i.length;o++)h.push(this.getArrayBuffer(i[o].centralDir));h.push(this.getArrayBuffer(this.writeFooter(i,s,r)));var f=new Blob(h,{type:"application/zip"});return n||e.Save.save(t,f),f},t.prototype.writeCentralDirectory=function(t,e,i,r){return"PK"+this.getBytes(20,2)+e+this.getBytes(0,2)+"\0\0\0\0"+this.getBytes(r,4)+this.getBytes(i,4)+t.fileName},t.prototype.writeFooter=function(t,e,i){return"PK\0\0\0\0"+this.getBytes(t.length,2)+this.getBytes(t.length,2)+this.getBytes(e,4)+this.getBytes(i,4)+this.getBytes(0,2)},t.prototype.getArrayBuffer=function(t){for(var e=new Uint8Array(t.length),i=0;i<t.length;++i)e[i]=255&t.charCodeAt(i);return e.buffer},t.prototype.getBytes=function(t,e){for(var i="",r=0;r<e;r++)i+=String.fromCharCode(255&t),t>>>=8;return i},t.prototype.getModifiedTime=function(t){var e=t.getHours();return e<<=6,e|=t.getMinutes(),e<<=5,e|=t.getSeconds()/2},t.prototype.getModifiedDate=function(t){var e=t.getFullYear()-1980;return e<<=4,e|=t.getMonth()+1,e<<=5,e|=t.getDate()},t.prototype.calculateCrc32Value=function(t,e,i){t^=-1;for(var r=0;r<e.length;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},t.initCrc32Table=function(){for(var t,e=0;e<256;e++){t=e;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;f[e]=t}},t}(),d=function(){function t(t,e){if(null===t||void 0===t)throw new Error("ArgumentException: data cannot be null or undefined");if(null===e||void 0===e)throw new Error("ArgumentException: string cannot be null or undefined");if(0===e.length)throw new Error("string cannot be empty");this.data=t,this.name=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this.fileName},set:function(t){this.fileName=t},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.fileName=void 0,this.data=void 0},t}();return t.ZipArchive=u,t.ZipArchiveItem=d,t.CompressedStreamWriter=h,t.CompressorHuffmanTree=o,t.ChecksumCalculator=a,t}({},ej.fileutils),this.ejs=ej;
this.ej=this.ej||{},this.ej.compression=function(t,e){"use strict";var i=function(){function t(){}return t.bitReverse=function(e){return t.reverseBits[15&e]<<12|t.reverseBits[e>>4&15]<<8|t.reverseBits[e>>8&15]<<4|t.reverseBits[e>>12]},t.bitConverterToInt32=function(t,e){return t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24},t.bitConverterToInt16=function(t,e){return t[e]|t[e+1]<<8},t.bitConverterToUInt32=function(t){var e=new Uint32Array(1);return e[0]=t,e[0]},t.bitConverterToUInt16=function(t,e){var i=new Uint16Array(1);return i[0]=t[e]|t[e+1]<<8,i[0]},t.bitConverterUintToInt32=function(t){var e=new Int32Array(1);return e[0]=t,e[0]},t.bitConverterInt32ToUint=function(t){var e=new Uint32Array(1);return e[0]=t,e[0]},t.bitConverterInt32ToInt16=function(t){var e=new Int16Array(1);return e[0]=t,e[0]},t.byteToString=function(t){for(var e="",i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e},t.byteIntToString=function(t){for(var e="",i=0;i<t.length;i++)e+=String.fromCharCode(t[i]);return e},t.arrayCopy=function(t,e,i,r,n){var s=new Uint8Array(t.buffer,e).subarray(0,n);i.set(s,r)},t.mergeArray=function(t,e){var i=new Uint8Array(t.length+e.length);return i.set(t),i.set(e,t.length),i},t.encodedString=function(t){var e,i,r,n,s,o,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,f=0,u=3*(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(t.charAt(t.length-1)===h.charAt(64)&&u--,t.charAt(t.length-2)===h.charAt(64)&&u--,u%1!=0)throw new Error("Invalid base64 input, bad content length.");for(var c=new Uint8Array(0|u);a<t.length;)e=h.indexOf(t.charAt(a++))<<2|(n=h.indexOf(t.charAt(a++)))>>4,i=(15&n)<<4|(s=h.indexOf(t.charAt(a++)))>>2,r=(3&s)<<6|(o=h.indexOf(t.charAt(a++))),c[f++]=e,64!==s&&(c[f++]=i),64!==o&&(c[f++]=r);return c},t.reverseBits=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],t.huffCodeLengthOrders=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],t}(),r=[],n=function(){function t(){0===r.length&&t.initCrc32Table(),this.files=[],this.level="Normal",e.Save.isMicrosoftBrowser=!!navigator.msSaveBlob}return Object.defineProperty(t.prototype,"items",{get:function(){return this.files},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"compressionLevel",{get:function(){return this.level},set:function(t){this.level=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return void 0===this.files?0:this.files.length},enumerable:!0,configurable:!0}),t.prototype.addItem=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: item cannot be null or undefined");for(var e=0;e<this.files.length;e++){var i=this.files[e];if(i instanceof o&&i.name===t.name)throw new Error("item with same name already exist")}this.files.push(t)},t.prototype.addDirectory=function(t){if(null===t||void 0===t)throw new Error("ArgumentException: string cannot be null or undefined");if(0===t.length)throw new Error("ArgumentException: string cannot be empty");if("/"!==t.slice(-1)&&(t+="/"),-1!==this.files.indexOf(t))throw new Error("item with same name already exist");this.files.push(t)},t.prototype.getItem=function(t){if(t>=0&&t<this.files.length)return this.files[t]},t.prototype.contains=function(t){return-1!==this.files.indexOf(t)},t.prototype.open=function(e){var r=i.encodedString(e);if(0==r.length)throw new DOMException("stream");var n=new B(r),s=t.findValueFromEnd(n,101010256,65557);if(s<0)throw new DOMException("Can't locate end of central directory record. Possible wrong file format or archive is corrupt.");n.position=s+12;var o=s-t.ReadInt32(n);n.position=o,this.readCentralDirectoryDataAndExtractItems(n)},t.prototype.readCentralDirectoryDataAndExtractItems=function(e){if(null==e)throw new DOMException("stream");for(var i;33639248==t.ReadInt32(e);)(i=new s).readCentralDirectoryData(e);i.readData(e,i.checkCrc),i.decompressData(),this.files.push(new o(i.unCompressedStream.buffer,i.name))},t.prototype.save=function(t){if(null===t||void 0===t||0===t.length)throw new Error("ArgumentException: fileName cannot be null or undefined");if(0===this.files.length)throw new Error("InvalidOperation");var e=this;return new Promise(function(i,r){e.saveInternal(t,!1).then(function(){i(e)})})},t.prototype.saveAsBlob=function(){var t=this;return new Promise(function(e,i){t.saveInternal("",!0).then(function(t){e(t)})})},t.prototype.saveInternal=function(t,e){var i=this,r=this;return new Promise(function(n,s){for(var o=[],h=0,a=0;a<r.files.length;a++)i.getCompressedData(i.files[a]).then(function(i){if(h=r.constructZippedObject(o,i,h,i.isDirectory),o.length===r.files.length){var s=r.writeZippedContent(t,o,h,e);n(s)}})})},t.prototype.destroy=function(){if(void 0!==this.files&&this.files.length>0){for(var t=0;t<this.files.length;t++){var e=this.files[t];e instanceof o&&e.destroy(),e=void 0}this.files=[]}this.files=void 0,this.level=void 0},t.prototype.getCompressedData=function(t){var e=this;return new Promise(function(i,n){if(t instanceof o){var s=new FileReader;s.onload=function(){var n=new Uint8Array(s.result),o={fileName:t.name,crc32Value:0,compressedData:[],compressedSize:void 0,uncompressedDataSize:n.length,compressionType:void 0,isDirectory:!1};if("Normal"===e.level){e.compressData(n,o,r);for(var h=0,a=0;a<o.compressedData.length;a++)h+=o.compressedData[a].length;o.compressedSize=h,o.compressionType="\b\0"}else o.compressedSize=n.length,o.crc32Value=e.calculateCrc32Value(0,n,r),o.compressionType="\0\0",o.compressedData.push(n);i(o)},s.readAsArrayBuffer(t.data)}else i({fileName:t,crc32Value:0,compressedData:"",compressedSize:0,uncompressedDataSize:0,compressionType:"\0\0",isDirectory:!0})})},t.prototype.compressData=function(t,e,i){var r=new c(!0),n=0,s=0;do{if(n>=t.length){r.close();break}s=Math.min(t.length,n+16384);var o=t.subarray(n,s);e.crc32Value=this.calculateCrc32Value(e.crc32Value,o,i),r.write(o,0,s-n),n=s}while(n<=t.length);e.compressedData=r.compressedData,r.destroy()},t.prototype.constructZippedObject=function(t,e,i,r){var n=0,s=new Date;r&&(n|=16),n|=0;var o=this.writeHeader(e,s),h="PK"+o+e.fileName,a=this.writeCentralDirectory(e,o,i,n);return t.push({localHeader:h,centralDir:a,compressedData:e}),i+h.length+e.compressedSize},t.prototype.writeHeader=function(t,e){var i="";return i+="\n\0\0\0",i+=t.compressionType,i+=this.getBytes(this.getModifiedTime(e),2),i+=this.getBytes(this.getModifiedDate(e),2),i+=this.getBytes(t.crc32Value,4),i+=this.getBytes(t.compressedSize,4),i+=this.getBytes(t.uncompressedDataSize,4),i+=this.getBytes(t.fileName.length,2),i+=this.getBytes(0,2)},t.prototype.writeZippedContent=function(t,i,r,n){for(var s=0,o=[],h=0;h<i.length;h++){var a=i[h];for(s+=a.centralDir.length,o.push(this.getArrayBuffer(a.localHeader));a.compressedData.compressedData.length;)o.push(a.compressedData.compressedData.shift().buffer)}for(h=0;h<i.length;h++)o.push(this.getArrayBuffer(i[h].centralDir));o.push(this.getArrayBuffer(this.writeFooter(i,s,r)));var f=new Blob(o,{type:"application/zip"});return n||e.Save.save(t,f),f},t.prototype.writeCentralDirectory=function(t,e,i,r){return"PK"+this.getBytes(20,2)+e+this.getBytes(0,2)+"\0\0\0\0"+this.getBytes(r,4)+this.getBytes(i,4)+t.fileName},t.prototype.writeFooter=function(t,e,i){return"PK\0\0\0\0"+this.getBytes(t.length,2)+this.getBytes(t.length,2)+this.getBytes(e,4)+this.getBytes(i,4)+this.getBytes(0,2)},t.prototype.getArrayBuffer=function(t){for(var e=new Uint8Array(t.length),i=0;i<t.length;++i)e[i]=255&t.charCodeAt(i);return e.buffer},t.prototype.getBytes=function(t,e){for(var i="",r=0;r<e;r++)i+=String.fromCharCode(255&t),t>>>=8;return i},t.prototype.getModifiedTime=function(t){var e=t.getHours();return e<<=6,e|=t.getMinutes(),e<<=5,e|=t.getSeconds()/2},t.prototype.getModifiedDate=function(t){var e=t.getFullYear()-1980;return e<<=4,e|=t.getMonth()+1,e<<=5,e|=t.getDate()},t.prototype.calculateCrc32Value=function(t,e,i){t^=-1;for(var r=0;r<e.length;r++)t=t>>>8^i[255&(t^e[r])];return-1^t},t.initCrc32Table=function(){for(var t,e=0;e<256;e++){t=e;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;r[e]=t}},t.findValueFromEnd=function(t,e,i){if(null==t)throw new DOMException("stream");var r=t.inputStream.buffer.byteLength;if(r<4)return-1;var n=new Uint8Array(4),s=Math.max(0,r-i),o=r-1-4;t.position=o,t.read(n,0,4);var h=n[0],a=h==e;if(!a)for(;o>s;)if(h<<=8,o--,t.position=o,(h+=t.readByte())==e){a=!0;break}return a?o:-1},t.ReadInt32=function(t){var e=new Uint8Array(4);if(4!=t.read(e,0,4))throw new DOMException("Unable to read value at the specified position - end of stream was reached.");return i.bitConverterToInt32(e,0)},t.ReadInt16=function(t){var e=new Uint8Array(2);if(2!=t.read(e,0,2))throw new DOMException("Unable to read value at the specified position - end of stream was reached.");return i.bitConverterToInt16(e,0)},t.ReadUInt16=function(t){var e=new Uint8Array(2);if(2!=t.read(e,0,2))throw new DOMException("Unable to read value at the specified position - end of stream was reached.");return i.bitConverterToInt16(e,0)},t}(),s=function(){function t(){this.headerSignature=67324752,this.checkCrc=!0,this.crc32=0}return t.prototype.readCentralDirectoryData=function(t){t.position+=4,this.options=n.ReadInt16(t),this.compressionMethod=n.ReadInt16(t),this.checkCrc=99!=this.compressionMethod;n.ReadInt32(t);this.crc32=i.bitConverterToUInt32(n.ReadInt32(t)),this.compressedSize=n.ReadInt32(t),this.originalSize=n.ReadInt32(t);var e=n.ReadInt16(t),r=n.ReadInt16(t),s=n.ReadInt16(t);t.position+=4,this.externalAttributes=n.ReadInt32(t),this.localHeaderOffset=n.ReadInt32(t);var o=new Uint8Array(e);t.read(o,0,e);var h=i.byteToString(o);h=h.replace("\\","/"),this.name=h,t.position+=r+s,0!=this.options&&(this.options=0)},t.prototype.readData=function(t,e){if(0==t.length)throw new DOMException("stream");t.position=this.localHeaderOffset,this.checkCrc=e,this.readLocalHeader(t),this.readCompressedData(t)},t.prototype.decompressData=function(){8==this.compressionMethod&&this.originalSize>0&&this.decompressDataOld()},t.prototype.decompressDataOld=function(){var t,e=new g(this.compressedStream,!0);this.originalSize>0&&(t=new B(new Uint8Array(this.originalSize)));for(var i,r=new Uint8Array(4096);(i=e.read(r,0,4096))>0;)t.write(r.subarray(0,i),0,i);this.unCompressedStream=t.toByteArray(),this.checkCrc},t.prototype.readLocalHeader=function(t){if(0==t.length)throw new DOMException("stream");if(n.ReadInt32(t)!=this.headerSignature)throw new DOMException("Can't find local header signature - wrong file format or file is corrupt.");t.position+=22;var e=n.ReadInt16(t),i=n.ReadUInt16(t);if(99==this.compressionMethod);else if(i>2){if(t.position+=e,23==n.ReadInt16(t))throw new DOMException("UnSupported");t.position+=i-2}else t.position+=e+i},t.prototype.readCompressedData=function(t){var e;if(this.compressedSize>0){var i=this.compressedSize;e=new B(new Uint8Array(i));for(var r=new Uint8Array(4096);i>0;){var n=Math.min(i,4096);if(t.read(r,0,n)!=n)throw new DOMException("End of file reached - wrong file format or file is corrupt.");e.write(r.subarray(0,n),0,n),i-=n}this.compressedStream=new Uint8Array(e.inputStream)}else this.compressedSize<0||this.compressedSize},t}(),o=function(){function t(t,e){if(null===t||void 0===t)throw new Error("ArgumentException: data cannot be null or undefined");if(null===e||void 0===e)throw new Error("ArgumentException: string cannot be null or undefined");if(0===e.length)throw new Error("string cannot be empty");this.data=t,this.name=e}return Object.defineProperty(t.prototype,"dataStream",{get:function(){return this.decompressedStream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.fileName},set:function(t){this.fileName=t},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.fileName=void 0,this.data=void 0},t}(),h=new Int16Array(286),a=new Uint8Array(286),f=new Int16Array(30),u=new Uint8Array(30),c=function(){function t(e){this.pendingBuffer=new Uint8Array(65536),this.pendingBufLength=0,this.pendingBufCache=0,this.pendingBufBitsInCache=0,this.bufferPosition=0,this.extraBits=0,this.currentHash=0,this.matchStart=0,this.matchLength=0,this.matchPrevAvail=!1,this.blockStart=0,this.stringStart=0,this.lookAhead=0,this.totalBytesIn=0,this.inputOffset=0,this.inputEnd=0,this.windowSize=32768,this.windowMask=this.windowSize-1,this.hashSize=32768,this.hashMask=this.hashSize-1,this.hashShift=Math.floor(17/3),this.maxDist=this.windowSize-262,this.checkSum=1,this.noWrap=!1,t.isHuffmanTreeInitiated||(t.initHuffmanTree(),t.isHuffmanTreeInitiated=!0),this.treeLiteral=new d(this,286,257,15),this.treeDistances=new d(this,30,1,15),this.treeCodeLengths=new d(this,19,4,7),this.arrDistances=new Uint16Array(16384),this.arrLiterals=new Uint8Array(16384),this.stream=[],this.dataWindow=new Uint8Array(2*this.windowSize),this.hashHead=new Int16Array(this.hashSize),this.hashPrevious=new Int16Array(this.windowSize),this.blockStart=this.stringStart=1,this.noWrap=e,e||this.writeZLibHeader()}return Object.defineProperty(t.prototype,"compressedData",{get:function(){return this.stream},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"getCompressedString",{get:function(){var t="";if(void 0!==this.stream)for(var e=0;e<this.stream.length;e++)t+=String.fromCharCode.apply(null,this.stream[e]);return t},enumerable:!0,configurable:!0}),t.prototype.write=function(t,i,r){if(void 0===t||null===t)throw new Error("ArgumentException: data cannot null or undefined");var n=i+r;if(0>i||i>n||n>t.length)throw new Error("ArgumentOutOfRangeException: Offset or length is incorrect");if("string"==typeof t){var s=new e.Encoding(!1);s.type="Utf8",n=i+(t=new Uint8Array(s.getBytes(t,0,t.length))).length}for(this.inputBuffer=t,this.inputOffset=i,this.inputEnd=n,this.noWrap||(this.checkSum=p.checksumUpdate(this.checkSum,this.inputBuffer,this.inputOffset,n));this.inputEnd!==this.inputOffset||0!==this.pendingBufLength;)this.pendingBufferFlush(),this.compressData(!1)},t.prototype.writeZLibHeader=function(){var t=30720;t|=64,t+=31-t%31,this.pendingBufferWriteShortBytes(t)},t.prototype.pendingBufferWriteShortBytes=function(t){this.pendingBuffer[this.pendingBufLength++]=t>>8,this.pendingBuffer[this.pendingBufLength++]=t},t.prototype.compressData=function(t){var e;do{this.fillWindow();var i=t&&this.inputEnd===this.inputOffset;e=this.compressSlow(i,t)}while(0===this.pendingBufLength&&e);return e},t.prototype.compressSlow=function(t,e){if(this.lookAhead<262&&!t)return!1;for(;this.lookAhead>=262||t;){if(0===this.lookAhead)return this.lookAheadCompleted(e);this.stringStart>=2*this.windowSize-262&&this.slideWindow();var i=this.matchStart,r=this.matchLength;if(this.lookAhead>=3&&this.discardMatch(),r>=3&&this.matchLength<=r?r=this.matchPreviousBest(i,r):this.matchPreviousAvailable(),this.bufferPosition>=16384)return this.huffmanIsFull(e)}return!0},t.prototype.discardMatch=function(){var t=this.insertString();0!==t&&this.stringStart-t<=this.maxDist&&this.findLongestMatch(t)&&this.matchLength<=5&&3===this.matchLength&&this.stringStart-this.matchStart>4096&&(this.matchLength=2)},t.prototype.matchPreviousAvailable=function(){this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!0,this.stringStart++,this.lookAhead--},t.prototype.matchPreviousBest=function(t,e){this.huffmanTallyDist(this.stringStart-1-t,e),e-=2;do{this.stringStart++,--this.lookAhead>=3&&this.insertString()}while(--e>0);return this.stringStart++,this.lookAhead--,this.matchPrevAvail=!1,this.matchLength=2,e},t.prototype.lookAheadCompleted=function(t){return this.matchPrevAvail&&this.huffmanTallyLit(255&this.dataWindow[this.stringStart-1]),this.matchPrevAvail=!1,this.huffmanFlushBlock(this.dataWindow,this.blockStart,this.stringStart-this.blockStart,t),this.blockStart=this.stringStart,!1},t.prototype.huffmanIsFull=function(t){var e=this.stringStart-this.blockStart;this.matchPrevAvail&&e--;var i=t&&0===this.lookAhead&&!this.matchPrevAvail;return this.huffmanFlushBlock(this.dataWindow,this.blockStart,e,i),this.blockStart+=e,!i},t.prototype.fillWindow=function(){for(this.stringStart>=this.windowSize+this.maxDist&&this.slideWindow();this.lookAhead<262&&this.inputOffset<this.inputEnd;){var t=2*this.windowSize-this.lookAhead-this.stringStart;t>this.inputEnd-this.inputOffset&&(t=this.inputEnd-this.inputOffset),this.dataWindow.set(this.inputBuffer.subarray(this.inputOffset,this.inputOffset+t),this.stringStart+this.lookAhead),this.inputOffset+=t,this.totalBytesIn+=t,this.lookAhead+=t}this.lookAhead>=3&&this.updateHash()},t.prototype.slideWindow=function(){this.dataWindow.set(this.dataWindow.subarray(this.windowSize,this.windowSize+this.windowSize),0),this.matchStart-=this.windowSize,this.stringStart-=this.windowSize,this.blockStart-=this.windowSize;for(t=0;t<this.hashSize;++t){e=65535&this.hashHead[t];this.hashHead[t]=e>=this.windowSize?e-this.windowSize:0}for(var t=0;t<this.windowSize;t++){var e=65535&this.hashPrevious[t];this.hashPrevious[t]=e>=this.windowSize?e-this.windowSize:0}},t.prototype.insertString=function(){var t,e=(this.currentHash<<this.hashShift^this.dataWindow[this.stringStart+2])&this.hashMask;return this.hashPrevious[this.stringStart&this.windowMask]=t=this.hashHead[e],this.hashHead[e]=this.stringStart,this.currentHash=e,65535&t},t.prototype.findLongestMatch=function(t){var e,i=4096,r=258,n=this.stringStart,s=this.stringStart+this.matchLength,o=Math.max(this.matchLength,2),h=Math.max(this.stringStart-this.maxDist,0),a=this.stringStart+258-1,f=this.dataWindow[s-1],u=this.dataWindow[s],c=this.dataWindow;o>=32&&(i>>=2),r>this.lookAhead&&(r=this.lookAhead);do{if(c[t+o]===u&&c[t+o-1]===f&&c[t]===c[n]&&c[t+1]===c[n+1]){for(e=t+2,n+=2;c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&c[++n]===c[++e]&&n<a;);if(n>s){if(this.matchStart=t,s=n,(o=n-this.stringStart)>=r)break;f=c[s-1],u=c[s]}n=this.stringStart}}while((t=65535&this.hashPrevious[t&this.windowMask])>h&&0!=--i);return this.matchLength=Math.min(o,this.lookAhead),this.matchLength>=3},t.prototype.updateHash=function(){this.currentHash=this.dataWindow[this.stringStart]<<this.hashShift^this.dataWindow[this.stringStart+1]},t.prototype.huffmanTallyLit=function(t){return this.arrDistances[this.bufferPosition]=0,this.arrLiterals[this.bufferPosition++]=t,this.treeLiteral.codeFrequencies[t]++,this.bufferPosition>=16384},t.prototype.huffmanTallyDist=function(t,e){this.arrDistances[this.bufferPosition]=t,this.arrLiterals[this.bufferPosition++]=e-3;var i=this.huffmanLengthCode(e-3);this.treeLiteral.codeFrequencies[i]++,i>=265&&i<285&&(this.extraBits+=Math.floor((i-261)/4));var r=this.huffmanDistanceCode(t-1);return this.treeDistances.codeFrequencies[r]++,r>=4&&(this.extraBits+=Math.floor(r/2-1)),this.bufferPosition>=16384},t.prototype.huffmanFlushBlock=function(t,e,i,r){this.treeLiteral.codeFrequencies[256]++,this.treeLiteral.buildTree(),this.treeDistances.buildTree(),this.treeLiteral.calculateBLFreq(this.treeCodeLengths),this.treeDistances.calculateBLFreq(this.treeCodeLengths),this.treeCodeLengths.buildTree();for(var n=4,s=18;s>n;s--)this.treeCodeLengths.codeLengths[d.huffCodeLengthOrders[s]]>0&&(n=s+1);for(var o=14+3*n+this.treeCodeLengths.getEncodedLength()+this.treeLiteral.getEncodedLength()+this.treeDistances.getEncodedLength()+this.extraBits,c=this.extraBits,s=0;s<286;s++)c+=this.treeLiteral.codeFrequencies[s]*a[s];for(s=0;s<30;s++)c+=this.treeDistances.codeFrequencies[s]*u[s];o>=c&&(o=c),e>=0&&i+4<o>>3?this.huffmanFlushStoredBlock(t,e,i,r):o==c?(this.pendingBufferWriteBits(2+(r?1:0),3),this.treeLiteral.setStaticCodes(h,a),this.treeDistances.setStaticCodes(f,u),this.huffmanCompressBlock(),this.huffmanReset()):(this.pendingBufferWriteBits(4+(r?1:0),3),this.huffmanSendAllTrees(n),this.huffmanCompressBlock(),this.huffmanReset())},t.prototype.huffmanFlushStoredBlock=function(t,e,i,r){this.pendingBufferWriteBits(0+(r?1:0),3),this.pendingBufferAlignToByte(),this.pendingBufferWriteShort(i),this.pendingBufferWriteShort(~i),this.pendingBufferWriteByteBlock(t,e,i),this.huffmanReset()},t.prototype.huffmanLengthCode=function(t){if(255===t)return 285;for(var e=257;t>=8;)e+=4,t>>=1;return e+t},t.prototype.huffmanDistanceCode=function(t){for(var e=0;t>=4;)e+=2,t>>=1;return e+t},t.prototype.huffmanSendAllTrees=function(t){this.treeCodeLengths.buildCodes(),this.treeLiteral.buildCodes(),this.treeDistances.buildCodes(),this.pendingBufferWriteBits(this.treeLiteral.treeLength-257,5),this.pendingBufferWriteBits(this.treeDistances.treeLength-1,5),this.pendingBufferWriteBits(t-4,4);for(var e=0;e<t;e++)this.pendingBufferWriteBits(this.treeCodeLengths.codeLengths[d.huffCodeLengthOrders[e]],3);this.treeLiteral.writeTree(this.treeCodeLengths),this.treeDistances.writeTree(this.treeCodeLengths)},t.prototype.huffmanReset=function(){this.bufferPosition=0,this.extraBits=0,this.treeLiteral.reset(),this.treeDistances.reset(),this.treeCodeLengths.reset()},t.prototype.huffmanCompressBlock=function(){for(var t=0;t<this.bufferPosition;t++){var e=255&this.arrLiterals[t],i=this.arrDistances[t];if(0!=i--){var r=this.huffmanLengthCode(e);this.treeLiteral.writeCodeToStream(r);var n=Math.floor((r-261)/4);n>0&&n<=5&&this.pendingBufferWriteBits(e&(1<<n)-1,n);var s=this.huffmanDistanceCode(i);this.treeDistances.writeCodeToStream(s),(n=Math.floor(s/2-1))>0&&this.pendingBufferWriteBits(i&(1<<n)-1,n)}else this.treeLiteral.writeCodeToStream(e)}this.treeLiteral.writeCodeToStream(256)},t.prototype.pendingBufferWriteBits=function(t,e){var i=new Uint32Array(1);i[0]=this.pendingBufCache|t<<this.pendingBufBitsInCache,this.pendingBufCache=i[0],this.pendingBufBitsInCache+=e,this.pendingBufferFlushBits()},t.prototype.pendingBufferFlush=function(t){if(this.pendingBufferFlushBits(),this.pendingBufLength>0){var e=new Uint8Array(this.pendingBufLength);e.set(this.pendingBuffer.subarray(0,this.pendingBufLength),0),this.stream.push(e)}this.pendingBufLength=0},t.prototype.pendingBufferFlushBits=function(){for(var t=0;this.pendingBufBitsInCache>=8&&this.pendingBufLength<65536;)this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache,this.pendingBufCache>>=8,this.pendingBufBitsInCache-=8,t++;return t},t.prototype.pendingBufferWriteByteBlock=function(t,e,i){var r=t.subarray(e,e+i);this.pendingBuffer.set(r,this.pendingBufLength),this.pendingBufLength+=i},t.prototype.pendingBufferWriteShort=function(t){this.pendingBuffer[this.pendingBufLength++]=t,this.pendingBuffer[this.pendingBufLength++]=t>>8},t.prototype.pendingBufferAlignToByte=function(){this.pendingBufBitsInCache>0&&(this.pendingBuffer[this.pendingBufLength++]=this.pendingBufCache),this.pendingBufCache=0,this.pendingBufBitsInCache=0},t.initHuffmanTree=function(){for(var t=0;t<144;)h[t]=d.bitReverse(48+t<<8),a[t++]=8;for(;t<256;)h[t]=d.bitReverse(256+t<<7),a[t++]=9;for(;t<280;)h[t]=d.bitReverse(-256+t<<9),a[t++]=7;for(;t<286;)h[t]=d.bitReverse(-88+t<<8),a[t++]=8;for(t=0;t<30;t++)f[t]=d.bitReverse(t<<11),u[t]=5},t.prototype.close=function(){do{this.pendingBufferFlush(!0),this.compressData(!0)||(this.pendingBufferFlush(!0),this.pendingBufferAlignToByte(),this.noWrap||(this.pendingBufferWriteShortBytes(this.checkSum>>16),this.pendingBufferWriteShortBytes(65535&this.checkSum)),this.pendingBufferFlush(!0))}while(this.inputEnd!==this.inputOffset||0!==this.pendingBufLength)},t.prototype.destroy=function(){this.stream=[],this.stream=void 0,this.pendingBuffer=void 0,this.treeLiteral=void 0,this.treeDistances=void 0,this.treeCodeLengths=void 0,this.arrLiterals=void 0,this.arrDistances=void 0,this.hashHead=void 0,this.hashPrevious=void 0,this.dataWindow=void 0,this.inputBuffer=void 0,this.pendingBufLength=void 0,this.pendingBufCache=void 0,this.pendingBufBitsInCache=void 0,this.bufferPosition=void 0,this.extraBits=void 0,this.currentHash=void 0,this.matchStart=void 0,this.matchLength=void 0,this.matchPrevAvail=void 0,this.blockStart=void 0,this.stringStart=void 0,this.lookAhead=void 0,this.totalBytesIn=void 0,this.inputOffset=void 0,this.inputEnd=void 0,this.windowSize=void 0,this.windowMask=void 0,this.hashSize=void 0,this.hashMask=void 0,this.hashShift=void 0,this.maxDist=void 0,this.checkSum=void 0,this.noWrap=void 0},t.isHuffmanTreeInitiated=!1,t}(),d=function(){function t(t,e,i,r){this.writer=t,this.codeMinCount=i,this.maxLength=r,this.codeFrequency=new Uint16Array(e),this.lengthCount=new Int32Array(r)}return Object.defineProperty(t.prototype,"treeLength",{get:function(){return this.codeCount},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeLengths",{get:function(){return this.codeLength},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codeFrequencies",{get:function(){return this.codeFrequency},enumerable:!0,configurable:!0}),t.prototype.setStaticCodes=function(t,e){var i=new Int16Array(t.length);i.set(t,0),this.codes=i;var r=new Uint8Array(e.length);r.set(e,0),this.codeLength=r},t.prototype.reset=function(){for(var t=0;t<this.codeFrequency.length;t++)this.codeFrequency[t]=0;this.codes=void 0,this.codeLength=void 0},t.prototype.writeCodeToStream=function(t){this.writer.pendingBufferWriteBits(65535&this.codes[t],this.codeLength[t])},t.prototype.buildCodes=function(){var e=new Int32Array(this.maxLength);this.codes=new Int16Array(this.codeCount);for(var i=0,r=0;r<this.maxLength;r++)e[r]=i,i+=this.lengthCount[r]<<15-r;for(var n=0;n<this.codeCount;n++){var s=this.codeLength[n];s>0&&(this.codes[n]=t.bitReverse(e[s-1]),e[s-1]+=1<<16-s)}},t.bitReverse=function(e){return t.reverseBits[15&e]<<12|t.reverseBits[e>>4&15]<<8|t.reverseBits[e>>8&15]<<4|t.reverseBits[e>>12]},t.prototype.getEncodedLength=function(){for(var t=0,e=0;e<this.codeFrequency.length;e++)t+=this.codeFrequency[e]*this.codeLength[e];return t},t.prototype.calculateBLFreq=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var o=this.codeLength[s];for(0===o?(e=138,i=3):(e=6,i=3,n!==o&&(t.codeFrequency[o]++,r=0)),n=o,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););r<i?t.codeFrequency[n]+=r:0!==n?t.codeFrequency[16]++:r<=10?t.codeFrequency[17]++:t.codeFrequency[18]++}},t.prototype.writeTree=function(t){for(var e,i,r,n=-1,s=0;s<this.codeCount;){r=1;var o=this.codeLength[s];for(0===o?(e=138,i=3):(e=6,i=3,n!==o&&(t.writeCodeToStream(o),r=0)),n=o,s++;s<this.codeCount&&n===this.codeLength[s]&&(s++,!(++r>=e)););if(r<i)for(;r-- >0;)t.writeCodeToStream(n);else 0!==n?(t.writeCodeToStream(16),this.writer.pendingBufferWriteBits(r-3,2)):r<=10?(t.writeCodeToStream(17),this.writer.pendingBufferWriteBits(r-3,3)):(t.writeCodeToStream(18),this.writer.pendingBufferWriteBits(r-11,7))}},t.prototype.buildTree=function(){for(var t=this.codeFrequency.length,e=new Int32Array(t),i=0,r=0,n=0;n<t;n++){var s=this.codeFrequency[n];if(0!==s){for(var o=i++,h=0;o>0&&this.codeFrequency[e[h=Math.floor((o-1)/2)]]>s;)e[o]=e[h],o=h;e[o]=n,r=n}}for(;i<2;)e[i++]=r<2?++r:0;this.codeCount=Math.max(r+1,this.codeMinCount);for(var a=i,f=new Int32Array(4*i-2),u=new Int32Array(2*i-1),c=0;c<i;c++){var d=e[c],p=2*c;f[p]=d,f[p+1]=-1,u[c]=this.codeFrequency[d]<<8,e[c]=c}this.constructHuffmanTree(e,i,u,a,f),this.buildLength(f)},t.prototype.constructHuffmanTree=function(t,e,i,r,n){do{for(var s=t[0],o=t[--e],h=i[o],a=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[a]=t[f],f=2*(a=f)+1;for(;(f=a)>0&&i[t[a=Math.floor((f-1)/2)]]>h;)t[f]=t[a];t[f]=o;var u=t[0];n[2*(o=r++)]=s,n[2*o+1]=u;var c=Math.min(255&i[s],255&i[u]);for(i[o]=h=i[s]+i[u]-c+1,a=0,f=1;f<e;)f+1<e&&i[t[f]]>i[t[f+1]]&&f++,t[a]=t[f],f=2*(a=f)+1;for(;(f=a)>0&&i[t[a=Math.floor((f-1)/2)]]>h;)t[f]=t[a];t[f]=o}while(e>1)},t.prototype.buildLength=function(t){this.codeLength=new Uint8Array(this.codeFrequency.length);for(var e=Math.floor(t.length/2),i=Math.floor((e+1)/2),r=0,n=0;n<this.maxLength;n++)this.lengthCount[n]=0;if(0!==(r=this.calculateOptimalCodeLength(t,r,e))){var s=this.maxLength-1;do{for(;0===this.lengthCount[--s];);do{this.lengthCount[s]--,this.lengthCount[++s]++,r-=1<<this.maxLength-1-s}while(r>0&&s<this.maxLength-1)}while(r>0);this.recreateTree(t,r,i)}},t.prototype.recreateTree=function(t,e,i){this.lengthCount[this.maxLength-1]+=e,this.lengthCount[this.maxLength-2]-=e;for(var r=2*i,n=this.maxLength;0!==n;n--)for(var s=this.lengthCount[n-1];s>0;){var o=2*t[r++];-1===t[o+1]&&(this.codeLength[t[o]]=n,s--)}},t.prototype.calculateOptimalCodeLength=function(t,e,i){var r=new Int32Array(i);r[i-1]=0;for(var n=i-1;n>=0;n--){var s=2*n+1;if(-1!==t[s])(o=r[n]+1)>this.maxLength&&(o=this.maxLength,e++),r[t[s-1]]=r[t[s]]=o;else{var o=r[n];this.lengthCount[o-1]++,this.codeLength[t[s-1]]=r[n]}}return e},t.reverseBits=[0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15],t.huffCodeLengthOrders=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],t}(),p=function(){function t(){}return t.checksumUpdate=function(e,i,r,n){var s=new Uint32Array(1);s[0]=e;for(var o=s[0],h=s[0]=65535&o,a=s[0]=o>>t.checkSumBitOffset;n>0;){var f=Math.min(n,t.checksumIterationCount);for(n-=f;--f>=0;)a+=h+=s[0]=255&i[r++];h%=t.checksumBase,a%=t.checksumBase}return o=a<<t.checkSumBitOffset|h},t.checkSumBitOffset=16,t.checksumBase=65521,t.checksumIterationCount=3800,t}(),l=function(){function t(t){this.buildTree(t)}return t.init=function(){var e,i;for(e=new Uint8Array(288),i=0;i<144;)e[i++]=8;for(;i<256;)e[i++]=9;for(;i<280;)e[i++]=7;for(;i<288;)e[i++]=8;for(t.m_LengthTree=new t(e),e=new Uint8Array(32),i=0;i<32;)e[i++]=5;t.m_DistanceTree=new t(e)},t.prototype.prepareData=function(e,i,r){for(var n=0,s=512,o=0;o<r.length;o++){var h=r[o];h>0&&e[h]++}for(var a=1;a<=t.MAX_BITLEN;a++)i[a]=n,n+=e[a]<<16-a,a>=10&&(s+=(130944&n)-(130944&i[a])>>16-a);return{code:n,treeSize:s}},t.prototype.treeFromData=function(e,r,n,s,o){for(var h=new Int16Array(o),a=512,f=t.MAX_BITLEN;f>=10;f--)for(var u=130944&s,c=130944&(s-=e[f]<<16-f);c<u;c+=128)h[i.bitReverse(c)]=i.bitConverterInt32ToInt16(-a<<4|f),a+=1<<f-9;for(c=0;c<n.length;c++)if(0!=(f=n[c])){s=r[f];var d=i.bitReverse(s);if(f<=9)do{h[d]=i.bitConverterInt32ToInt16(c<<4|f),d+=1<<f}while(d<512);else{var p=h[511&d],l=1<<(15&p);p=-(p>>4);do{h[p|d>>9]=i.bitConverterInt32ToInt16(c<<4|f),d+=1<<f}while(d<l)}r[f]=s+(1<<16-f)}return h},t.prototype.buildTree=function(t){var e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=this.prepareData(e,i,t);this.m_Tree=this.treeFromData(e,i,t,r.code,r.treeSize)},t.prototype.unpackSymbol=function(t){var e,i;if((e=t.peekBits(9))>=0){if((i=this.m_Tree[e])>=0)return t.skipBits(15&i),i>>4;var r=-(i>>4),n=15&i;if((e=t.peekBits(n))>=0)return i=this.m_Tree[r|e>>9],t.skipBits(15&i),i>>4;s=t.availableBits;return e=t.peekBits(s),i=this.m_Tree[r|e>>9],(15&i)<=s?(t.skipBits(15&i),i>>4):-1}var s=t.availableBits;return e=t.peekBits(s),i=this.m_Tree[e],i>=0&&(15&i)<=s?(t.skipBits(15&i),i>>4):-1},Object.defineProperty(t,"lengthTree",{get:function(){return this.m_LengthTree},enumerable:!0,configurable:!0}),Object.defineProperty(t,"distanceTree",{get:function(){return this.m_DistanceTree},enumerable:!0,configurable:!0}),t.MAX_BITLEN=15,t}(),m=function(){function t(){}return t.ChecksumUpdate=function(t,e,i,r){for(var n=t,s=65535&n,o=n>>this.DEF_CHECKSUM_BIT_OFFSET;r>0;){var h=Math.min(r,this.DEF_CHECKSUM_ITERATIONSCOUNT);for(r-=h;--h>=0;)o+=s+=255&e[i++];s%=this.DEF_CHECKSUM_BASE,o%=this.DEF_CHECKSUM_BASE}t=n=o<<this.DEF_CHECKSUM_BIT_OFFSET|s},t.ChecksumGenerate=function(e,i,r){return t.ChecksumUpdate(1,e,i,r),1},t.DEF_CHECKSUM_BIT_OFFSET=16,t.DEF_CHECKSUM_BASE=65521,t.DEF_CHECKSUM_ITERATIONSCOUNT=3800,t}(),g=function(){function t(t,e){if(this.defaultHuffmanDynamicTree=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],this.DEF_HEADER_METHOD_MASK=3840,this.DEF_HEADER_INFO_MASK=61440,this.DEF_HEADER_FLAGS_FCHECK=31,this.DEF_HEADER_FLAGS_FDICT=32,this.DEF_HEADER_FLAGS_FLEVEL=192,this.DEF_MAX_WINDOW_SIZE=65535,this.DEF_HUFFMAN_REPEATE_MAX=258,this.DEF_HUFFMAN_END_BLOCK=256,this.DEF_HUFFMAN_LENGTH_MINIMUMCODE=257,this.DEF_HUFFMAN_LENGTH_MAXIMUMCODE=285,this.DEF_HUFFMAN_DISTANCE_MAXIMUMCODE=29,this.mCheckSum=1,this.tBuffer=0,this.mBufferedBits=0,this.mTempBuffer=new Uint8Array(4),this.mBlockBuffer=new Uint8Array(this.DEF_MAX_WINDOW_SIZE),this.mbNoWrap=!1,this.mWindowSize=0,this.mCurrentPosition=0,this.mDataLength=0,this.mbCanReadNextBlock=!0,this.mbCanReadMoreData=!0,this.mbCheckSumRead=!1,null==t)throw new DOMException("stream");if(0===t.length)throw new DOMException("stream - string can not be empty");l.init(),this.mInputStream=new B(t),this.mbNoWrap=e,this.mbNoWrap||this.readZLibHeader(),this.decodeBlockHeader()}return Object.defineProperty(t.prototype,"mBuffer",{get:function(){return this.tBuffer},set:function(t){this.tBuffer=t},enumerable:!0,configurable:!0}),t.prototype.peekBits=function(t){if(t<0)throw new DOMException("count","Bits count can not be less than zero.");if(t>32)throw new DOMException("count","Count of bits is too large.");if(this.mBufferedBits<t&&this.fillBuffer(),this.mBufferedBits<t)return-1;var e=~(4294967295<<t);return i.bitConverterUintToInt32(this.mBuffer&e)},t.prototype.fillBuffer=function(){var t=4-(this.mBufferedBits>>3)-(0!=(7&this.mBufferedBits)?1:0);if(0!==t)for(var e=this.mInputStream.read(this.mTempBuffer,0,t),r=0;r<e;r++)this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer|i.bitConverterInt32ToUint(this.mTempBuffer[r]<<this.mBufferedBits)),this.mBufferedBits+=8},t.prototype.skipBits=function(t){if(t<0)throw new DOMException("count","Bits count can not be less than zero.");0!==t&&(t>=this.mBufferedBits?(t-=this.mBufferedBits,this.mBufferedBits=0,this.mBuffer=0,t>0&&(this.mInputStream.position+=t>>3,(t&=7)>0&&(this.fillBuffer(),this.mBufferedBits-=t,this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer>>>t)))):(this.mBufferedBits-=t,this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer>>>t)))},Object.defineProperty(t.prototype,"availableBits",{get:function(){return this.mBufferedBits},enumerable:!0,configurable:!0}),t.prototype.readZLibHeader=function(){var t=this.readInt16();if(-1===t)throw new DOMException("Header of the stream can not be read.");if(t%31!=0)throw new DOMException("Header checksum illegal");if(2048!=(t&this.DEF_HEADER_METHOD_MASK))throw new DOMException("Unsupported compression method.");if(this.mWindowSize=Math.pow(2,8+((t&this.DEF_HEADER_INFO_MASK)>>12)),this.mWindowSize>65535)throw new DOMException("Unsupported window size for deflate compression method.");if((t&this.DEF_HEADER_FLAGS_FDICT)>>5==1)throw new DOMException("Custom dictionary is not supported at the moment.")},t.prototype.readInt16=function(){var t=this.readBits(8)<<8;return t|=this.readBits(8)},t.prototype.readBits=function(t){var e=this.peekBits(t);return-1===e?-1:(this.mBufferedBits-=t,this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer>>>t),e)},t.prototype.decodeBlockHeader=function(){if(!this.mbCanReadNextBlock)return!1;var t=this.readBits(1);if(-1===t)return!1;var e=this.readBits(2);if(-1===e)return!1;switch(this.mbCanReadNextBlock=0===t,e){case 0:this.mbReadingUncompressed=!0,this.skipToBoundary();var i=this.readInt16Inverted();if(i!==(65535^this.readInt16Inverted()))throw new DOMException("Wrong block length.");if(i>65535)throw new DOMException("Uncompressed block length can not be more than 65535.");this.mUncompressedDataLength=i,this.mCurrentLengthTree=null,this.mCurrentDistanceTree=null;break;case 1:this.mbReadingUncompressed=!1,this.mUncompressedDataLength=-1,this.mCurrentLengthTree=l.lengthTree,this.mCurrentDistanceTree=l.distanceTree;break;case 2:this.mbReadingUncompressed=!1,this.mUncompressedDataLength=-1;var r=this.decodeDynamicHeader(this.mCurrentLengthTree,this.mCurrentDistanceTree);this.mCurrentLengthTree=r.lengthTree,this.mCurrentDistanceTree=r.distanceTree;break;default:throw new DOMException("Wrong block type.")}return!0},t.prototype.skipToBoundary=function(){this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer>>>(7&this.mBufferedBits)),this.mBufferedBits&=-8},t.prototype.readInt16Inverted=function(){var t=this.readBits(8);return t|=this.readBits(8)<<8},t.prototype.decodeDynamicHeader=function(e,i){var r=0,n=this.readBits(5),s=this.readBits(5),o=this.readBits(4);if(n<0||s<0||o<0)throw new DOMException("Wrong dynamic huffman codes.");var h=(n+=257)+(s+=1),a=new Uint8Array(h),f=new Uint8Array(19);o+=4;for(var u=0;u<o;){var c=this.readBits(3);if(c<0)throw new DOMException("Wrong dynamic huffman codes.");f[this.defaultHuffmanDynamicTree[u++]]=c}var d=new l(f);for(u=0;;){var p=void 0,m=!1;for(p=d.unpackSymbol(this);0==(-16&p);){if(a[u++]=r=p,u===h){m=!0;break}p=d.unpackSymbol(this)}if(m)break;if(p<0)throw new DOMException("Wrong dynamic huffman codes.");if(p>=17)r=0;else if(0===u)throw new DOMException("Wrong dynamic huffman codes.");var g=p-16,B=t.DEF_HUFFMAN_DYNTREE_REPEAT_BITS[g],v=this.readBits(B);if(v<0)throw new DOMException("Wrong dynamic huffman codes.");if(v+=t.DEF_HUFFMAN_DYNTREE_REPEAT_MINIMUMS[g],u+v>h)throw new DOMException("Wrong dynamic huffman codes.");for(;v-- >0;)a[u++]=r;if(u===h)break}var w=new Uint8Array(n);return w.set(a.subarray(0,n),0),e=new l(w),w=a.slice(n,n+s),i=new l(w),{lengthTree:e,distanceTree:i}},t.prototype.readHuffman=function(){for(var e=this.DEF_MAX_WINDOW_SIZE-(this.mDataLength-this.mCurrentPosition),i=!1,r={};e>=this.DEF_HUFFMAN_REPEATE_MAX;){var n=void 0;for(n=this.mCurrentLengthTree.unpackSymbol(this);0==(-256&n);){if(r[(this.mDataLength+1)%this.DEF_MAX_WINDOW_SIZE]=n,this.mBlockBuffer[this.mDataLength++%this.DEF_MAX_WINDOW_SIZE]=n,i=!0,--e<this.DEF_HUFFMAN_REPEATE_MAX)return!0;n=this.mCurrentLengthTree.unpackSymbol(this)}if(n<this.DEF_HUFFMAN_LENGTH_MINIMUMCODE){if(n<this.DEF_HUFFMAN_END_BLOCK)throw new DOMException("Illegal code.");var s=i?1:0;return this.mbCanReadMoreData=this.decodeBlockHeader(),!!(s|(this.mbCanReadMoreData?1:0))}if(n>this.DEF_HUFFMAN_LENGTH_MAXIMUMCODE)throw new DOMException("Illegal repeat code length.");var o=t.DEF_HUFFMAN_REPEAT_LENGTH_BASE[n-this.DEF_HUFFMAN_LENGTH_MINIMUMCODE],h=t.DEF_HUFFMAN_REPEAT_LENGTH_EXTENSION[n-this.DEF_HUFFMAN_LENGTH_MINIMUMCODE];if(h>0){if((f=this.readBits(h))<0)throw new DOMException("Wrong data.");o+=f}if((n=this.mCurrentDistanceTree.unpackSymbol(this))<0||n>t.DEF_HUFFMAN_REPEAT_DISTANCE_BASE.length)throw new DOMException("Wrong distance code.");var a=t.DEF_HUFFMAN_REPEAT_DISTANCE_BASE[n];if((h=t.DEF_HUFFMAN_REPEAT_DISTANCE_EXTENSION[n])>0){var f=this.readBits(h);if(f<0)throw new DOMException("Wrong data.");a+=f}for(var u=0;u<o;u++)this.mBlockBuffer[this.mDataLength%this.DEF_MAX_WINDOW_SIZE]=this.mBlockBuffer[(this.mDataLength-a)%this.DEF_MAX_WINDOW_SIZE],this.mDataLength++,e--;i=!0}return i},t.prototype.read=function(t,e,r){if(null==t)throw new DOMException("buffer");if(e<0||e>t.length-1)throw new DOMException("offset","Offset does not belong to specified buffer.");if(r<0||r>t.length-e)throw new DOMException("length","Length is illegal.");for(var n=r;r>0;)if(this.mCurrentPosition<this.mDataLength){var s=this.mCurrentPosition%this.DEF_MAX_WINDOW_SIZE,o=Math.min(this.DEF_MAX_WINDOW_SIZE-s,this.mDataLength-this.mCurrentPosition);o=Math.min(o,r),i.arrayCopy(this.mBlockBuffer,s,t,e,o),this.mCurrentPosition+=o,e+=o,r-=o}else{if(!this.mbCanReadMoreData)break;var h=this.mDataLength;if(this.mbReadingUncompressed)if(0===this.mUncompressedDataLength){if(this.mbCanReadMoreData=this.decodeBlockHeader(),!this.mbCanReadMoreData)break}else{var s=this.mDataLength%this.DEF_MAX_WINDOW_SIZE,a=Math.min(this.mUncompressedDataLength,this.DEF_MAX_WINDOW_SIZE-s),f=this.readPackedBytes(this.mBlockBuffer,s,a);if(a!==f)throw new DOMException("Not enough data in stream.");this.mUncompressedDataLength-=f,this.mDataLength+=f}else if(!this.readHuffman())break;if(h<this.mDataLength){var u=h%this.DEF_MAX_WINDOW_SIZE,c=this.mDataLength%this.DEF_MAX_WINDOW_SIZE;u<c?this.checksumUpdate(this.mBlockBuffer,u,c-u):(this.checksumUpdate(this.mBlockBuffer,u,this.DEF_MAX_WINDOW_SIZE-u),c>0&&this.checksumUpdate(this.mBlockBuffer,0,c))}}if(!this.mbCanReadMoreData&&!this.mbCheckSumRead&&!this.mbNoWrap){if(this.skipToBoundary(),this.readInt32()!==this.mCheckSum)throw new DOMException("Checksum check failed.");this.mbCheckSumRead=!0}return n-r},t.prototype.readPackedBytes=function(t,e,r){if(null==t)throw new DOMException("buffer");if(e<0||e>t.length-1)throw new DOMException('offset", "Offset can not be less than zero or greater than buffer length - 1.');if(r<0)throw new DOMException('length", "Length can not be less than zero.');if(r>t.length-e)throw new DOMException('length", "Length is too large.');if(0!=(7&this.mBufferedBits))throw new DOMException("Reading of unalligned data is not supported.");if(0===r)return 0;for(var n=0;this.mBufferedBits>0&&r>0;)t[e++]=this.mBuffer,this.mBufferedBits-=8,this.mBuffer=i.bitConverterInt32ToUint(this.mBuffer>>>8),r--,n++;return r>0&&(n+=this.mInputStream.read(t,e,r)),n},t.prototype.readInt32=function(){var t=this.readBits(8)<<24;return t|=this.readBits(8)<<16,t|=this.readBits(8)<<8,t|=this.readBits(8)},t.prototype.checksumUpdate=function(t,e,i){m.ChecksumUpdate(this.mCheckSum,t,e,i)},t.DEF_REVERSE_BITS=new Uint8Array([0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15]),t.DEF_HUFFMAN_DYNTREE_REPEAT_MINIMUMS=[3,3,11],t.DEF_HUFFMAN_DYNTREE_REPEAT_BITS=[2,3,7],t.DEF_HUFFMAN_REPEAT_LENGTH_BASE=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],t.DEF_HUFFMAN_REPEAT_LENGTH_EXTENSION=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],t.DEF_HUFFMAN_REPEAT_DISTANCE_BASE=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],t.DEF_HUFFMAN_REPEAT_DISTANCE_EXTENSION=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],t}(),B=function(){function t(t){this.position=0,this.inputStream=new Uint8Array(t.buffer)}return Object.defineProperty(t.prototype,"length",{get:function(){return this.inputStream.buffer.byteLength},enumerable:!0,configurable:!0}),t.prototype.read=function(t,e,i){var r=new Uint8Array(this.inputStream.buffer,this.position+e).subarray(0,i);return t.set(r,0),this.position+=r.byteLength,r.byteLength},t.prototype.readByte=function(){return this.inputStream[this.position++]},t.prototype.write=function(t,e,r){i.arrayCopy(t,0,this.inputStream,this.position+e,r),this.position+=r},t.prototype.toByteArray=function(){return new Uint8Array(this.inputStream.buffer)},t}();return t.ZipArchive=n,t.ZipArchiveItemHelper=s,t.ZipArchiveItem=o,t.CompressedStreamWriter=c,t.CompressorHuffmanTree=d,t.ChecksumCalculator=p,t.Utils=i,t.DecompressorHuffmanTree=l,t.CompressedStreamReader=g,t.Stream=B,t}({},ej.fileutils),this.ejs=ej;
//# sourceMappingURL=ej2-compression.min.js.map
/*!
* filename: index.d.ts
* version : 20.4.48
* version : 21.1.35
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.

@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license.

{
"_from": "@syncfusion/ej2-compression@*",
"_id": "@syncfusion/ej2-compression@0.13.2",
"_id": "@syncfusion/ej2-compression@0.17.0",
"_inBundle": false,
"_integrity": "sha512-l7+YbRbvODEOyc38Is2/s2N/7KeduycLQNlcOw/oYILxSGqhAtwA2N5dKki3QY03vxTzZ3KpqMLGdI6D+7kXjQ==",
"_integrity": "sha512-hb164u3NiML/E3/qtYlBU5PeUQuh0t8/PMnX8ebj+H35Ey9KXzvqhZvAJLJFIaYcObtxed66unRWr0sgHUh2kw==",
"_location": "/@syncfusion/ej2-compression",

@@ -34,6 +34,6 @@ "_phantomChildren": {},

],
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-compression/-/ej2-compression-0.13.2.tgz",
"_shasum": "6cd05a8ea5672a7a73a0c7a478e65113a99bbd42",
"_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-compression/-/ej2-compression-0.17.0.tgz",
"_shasum": "6cee41fbfc30c62e0e2d0096ce4da3778b6e2e7d",
"_spec": "@syncfusion/ej2-compression@*",
"_where": "/jenkins/workspace/ease-automation_release_19.1.0.1/packages/included",
"_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
"author": {

@@ -44,3 +44,3 @@ "name": "Syncfusion Inc."

"dependencies": {
"@syncfusion/ej2-file-utils": "~20.4.48"
"@syncfusion/ej2-file-utils": "~21.1.35"
},

@@ -56,5 +56,5 @@ "deprecated": false,

"typings": "index.d.ts",
"version": "20.4.48",
"version": "21.1.35",
"sideEffects": false,
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
}

@@ -0,1 +1,2 @@

/* eslint-disable */
import { Encoding } from '@syncfusion/ej2-file-utils';

@@ -991,1 +992,2 @@ /**

export { ChecksumCalculator };
/* eslint-enable */

@@ -6,1 +6,4 @@ /**

export * from './compression-writer';
export * from './utils';
export * from './decompressor-huffman-tree';
export * from './compression-reader';

@@ -6,1 +6,4 @@ /**

export * from './compression-writer';
export * from './utils';
export * from './decompressor-huffman-tree';
export * from './compression-reader';

@@ -0,1 +1,2 @@

import { Stream } from './index';
/**

@@ -14,2 +15,3 @@ * class provide compression library

private level;
readonly items: (ZipArchiveItem | string)[];
/**

@@ -54,2 +56,4 @@ * gets compression level

contains(item: string | ZipArchiveItem): boolean;
open(base64String: string): void;
readCentralDirectoryDataAndExtractItems(stream: Stream): void;
/**

@@ -89,3 +93,27 @@ * save archive with specified file name

static initCrc32Table(): void;
static findValueFromEnd(stream: Stream, value: number, maxCount: number): number;
static ReadInt32(stream: Stream): number;
static ReadInt16(stream: Stream): number;
static ReadUInt16(stream: Stream): number;
}
export declare class ZipArchiveItemHelper {
compressedStream: Uint8Array;
name: string;
unCompressedStream: Uint8Array;
headerSignature: number;
private options;
private compressionMethod;
checkCrc: boolean;
private crc32;
private compressedSize;
private originalSize;
private localHeaderOffset;
private externalAttributes;
readCentralDirectoryData(stream: Stream): void;
readData(stream: Stream, checkCrc: boolean): void;
decompressData(): void;
private decompressDataOld;
private readLocalHeader;
private readCompressedData;
}
/**

@@ -99,3 +127,5 @@ * Class represent unique ZipArchive item

data: Blob | ArrayBuffer;
private decompressedStream;
private fileName;
readonly dataStream: Blob | ArrayBuffer;
/**

@@ -102,0 +132,0 @@ * Get the name of archive item

@@ -1,4 +0,30 @@

import { CompressedStreamWriter } from './compression-writer';
/* eslint-disable */
import { CompressedStreamWriter, Stream, CompressedStreamReader } from './index';
import { Save } from '@syncfusion/ej2-file-utils';
import { Utils } from './utils';
var CRC32TABLE = [];
/// <summary>
/// Size of the int value in bytes.
/// </summary>
var INT_SIZE = 4;
/// <summary>
/// Size of the short value in bytes.
/// </summary>
var SHORT_SIZE = 2;
/// <summary>
/// End of central directory signature.
/// </summary>
var CentralDirectoryEndSignature = 0x06054b50;
/// <summary>
/// Offset to the size field in the End of central directory record.
/// </summary>
var CentralDirSizeOffset = 12;
/// <summary>
/// Central header signature.
/// </summary>
var CentralHeaderSignature = 0x02014b50;
/// <summary>
/// Buffer size.
/// </summary>
var BufferSize = 4096;
/**

@@ -26,2 +52,9 @@ * class provide compression library

}
Object.defineProperty(ZipArchive.prototype, "items", {
get: function () {
return this.files;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ZipArchive.prototype, "compressionLevel", {

@@ -114,2 +147,67 @@ /**

};
ZipArchive.prototype.open = function (base64String) {
//return promise = new Promise((resolve: Function, reject: Function) => {
var zipArchive = this;
var zipByteArray = Utils.encodedString(base64String);
if (zipByteArray.length == 0)
throw new DOMException("stream");
var stream = new Stream(zipByteArray);
//let lCentralDirEndPosition = this.findValueFromEnd( arrBuffer, Constants.CentralDirectoryEndSignature, 65557 );
var lCentralDirEndPosition = ZipArchive.findValueFromEnd(stream, CentralDirectoryEndSignature, 65557);
if (lCentralDirEndPosition < 0)
throw new DOMException("Can't locate end of central directory record. Possible wrong file format or archive is corrupt.");
// Step2. Locate central directory and iterate through all items
stream.position = lCentralDirEndPosition + CentralDirSizeOffset;
var iCentralDirSize = ZipArchive.ReadInt32(stream);
var lCentralDirPosition = lCentralDirEndPosition - iCentralDirSize;
// verify that this is really central directory
stream.position = lCentralDirPosition;
this.readCentralDirectoryDataAndExtractItems(stream);
//});
// let zipArchive: ZipArchive = this;
//let promise: Promise<ZipArchive>;
// return promise = new Promise((resolve: Function, reject: Function) => {
// let reader: FileReader = new FileReader();
// reader.onload = (e: Event) => {
// let data: Uint8Array = new Uint8Array((e.target as any).result);
// let zipReader: ZipReader = new ZipReader(data);
// zipReader.readEntries().then((entries: ZipEntry[]) => {
// for (let i: number = 0; i < entries.length; i++) {
// let entry: ZipEntry = entries[i];
// let item: ZipArchiveItem = new ZipArchiveItem(zipArchive, entry.fileName);
// item.data = entry.data;
// item.compressionMethod = entry.compressionMethod;
// item.crc = entry.crc;
// item.lastModified = entry.lastModified;
// item.lastModifiedDate = entry.lastModifiedDate;
// item.size = entry.size;
// item.uncompressedSize = entry.uncompressedSize;
// zipArchive.addItem(item);
// }
// resolve(zipArchive);
// });
// };
// reader.readAsArrayBuffer(fileName);
// });
};
/// <summary>
/// Read central directory record from the stream.
/// </summary>
/// <param name="stream">Stream to read from.</param>
ZipArchive.prototype.readCentralDirectoryDataAndExtractItems = function (stream) {
if (stream == null)
throw new DOMException("stream");
var itemHelper;
while (ZipArchive.ReadInt32(stream) == CentralHeaderSignature) {
itemHelper = new ZipArchiveItemHelper();
itemHelper.readCentralDirectoryData(stream);
itemHelper;
// let item: ZipArchiveItem = new ZipArchiveItem(this);
// item.ReadCentralDirectoryData(stream);
// m_arrItems.Add(item);
}
itemHelper.readData(stream, itemHelper.checkCrc);
itemHelper.decompressData();
this.files.push(new ZipArchiveItem(itemHelper.unCompressedStream.buffer, itemHelper.name));
};
/**

@@ -358,5 +456,258 @@ * save archive with specified file name

};
ZipArchive.findValueFromEnd = function (stream, value, maxCount) {
if (stream == null)
throw new DOMException("stream");
// if( !stream.CanSeek || !stream.CanRead )
// throw new ArgumentOutOfRangeException( "We need to have seekable and readable stream." );
// read last 4 bytes and compare with required value
var lStreamSize = stream.inputStream.buffer.byteLength;
if (lStreamSize < 4)
return -1;
var arrBuffer = new Uint8Array(4);
var lLastPos = Math.max(0, lStreamSize - maxCount);
var lCurrentPosition = lStreamSize - 1 - INT_SIZE;
stream.position = lCurrentPosition;
stream.read(arrBuffer, 0, INT_SIZE);
var uiCurValue = arrBuffer[0];
var bFound = (uiCurValue == value);
if (!bFound) {
while (lCurrentPosition > lLastPos) {
// remove unnecessary byte and replace it with new value.
uiCurValue <<= 8;
lCurrentPosition--;
stream.position = lCurrentPosition;
uiCurValue += stream.readByte();
if (uiCurValue == value) {
bFound = true;
break;
}
}
}
return bFound ? lCurrentPosition : -1;
};
/// <summary>
/// Extracts Int32 value from the stream.
/// </summary>
/// <param name="stream">Stream to read data from.</param>
/// <returns>Extracted value.</returns>
ZipArchive.ReadInt32 = function (stream) {
var buffer = new Uint8Array(INT_SIZE);
if (stream.read(buffer, 0, INT_SIZE) != INT_SIZE) {
throw new DOMException("Unable to read value at the specified position - end of stream was reached.");
}
return Utils.bitConverterToInt32(buffer, 0);
};
/// <summary>
/// Extracts Int16 value from the stream.
/// </summary>
/// <param name="stream">Stream to read data from.</param>
/// <returns>Extracted value.</returns>
ZipArchive.ReadInt16 = function (stream) {
var buffer = new Uint8Array(SHORT_SIZE);
if (stream.read(buffer, 0, SHORT_SIZE) != SHORT_SIZE) {
throw new DOMException("Unable to read value at the specified position - end of stream was reached.");
}
return Utils.bitConverterToInt16(buffer, 0);
};
/// <summary>
/// Extracts unsigned Int16 value from the stream.
/// </summary>
/// <param name="stream">Stream to read data from.</param>
/// <returns>Extracted value.</returns>
ZipArchive.ReadUInt16 = function (stream) {
{
var buffer = new Uint8Array(SHORT_SIZE);
if (stream.read(buffer, 0, SHORT_SIZE) != SHORT_SIZE) {
throw new DOMException("Unable to read value at the specified position - end of stream was reached.");
}
return Utils.bitConverterToInt16(buffer, 0);
}
};
return ZipArchive;
}());
export { ZipArchive };
var ZipArchiveItemHelper = /** @class */ (function () {
function ZipArchiveItemHelper() {
/// <summary>
/// Zip header signature.
/// </summary>
this.headerSignature = 0x04034b50;
/// <summary>
/// Indicates whether we should check Crc value when reading item's data. Check
/// is performed when user gets access to decompressed data for the first time.
/// </summary>
this.checkCrc = true;
/// <summary>
/// Crc.
/// </summary>
this.crc32 = 0;
}
/// <summary>
/// Read data from the stream based on the central directory.
/// </summary>
/// <param name="stream">Stream to read data from, stream.Position must point at just after correct file header.</param>
ZipArchiveItemHelper.prototype.readCentralDirectoryData = function (stream) {
// on the current moment we ignore "version made by" and "version needed to extract" fields.
stream.position += 4;
this.options = ZipArchive.ReadInt16(stream);
this.compressionMethod = ZipArchive.ReadInt16(stream);
this.checkCrc = (this.compressionMethod != 99); //COmpression.Defalte != SecurityConstants.AES
//m_bCompressed = true;
// on the current moment we ignore "last mod file time" and "last mod file date" fields.
var lastModified = ZipArchive.ReadInt32(stream);
//LastModified = ConvertToDateTime(lastModified);
this.crc32 = Utils.bitConverterToUInt32(ZipArchive.ReadInt32(stream));
this.compressedSize = ZipArchive.ReadInt32(stream);
this.originalSize = ZipArchive.ReadInt32(stream);
var iFileNameLength = ZipArchive.ReadInt16(stream);
var iExtraFieldLenth = ZipArchive.ReadInt16(stream);
var iCommentLength = ZipArchive.ReadInt16(stream);
// on the current moment we ignore and "disk number start" (2 bytes),
// "internal file attributes" (2 bytes).
stream.position += 4;
this.externalAttributes = ZipArchive.ReadInt32(stream);
this.localHeaderOffset = ZipArchive.ReadInt32(stream);
var arrBuffer = new Uint8Array(iFileNameLength);
stream.read(arrBuffer, 0, iFileNameLength);
var m_strItemName = Utils.byteToString(arrBuffer);
m_strItemName = m_strItemName.replace("\\", "/");
this.name = m_strItemName;
stream.position += iExtraFieldLenth + iCommentLength;
if (this.options != 0)
this.options = 0;
};
/// <summary>
/// Reads zipped data from the stream.
/// </summary>
/// <param name="stream">Stream to read data from.</param>
/// <param name="checkCrc">Indicates whether we should check crc value after data decompression.</param>
ZipArchiveItemHelper.prototype.readData = function (stream, checkCrc) {
if (stream.length == 0)
throw new DOMException("stream");
stream.position = this.localHeaderOffset;
this.checkCrc = checkCrc;
this.readLocalHeader(stream);
this.readCompressedData(stream);
};
ZipArchiveItemHelper.prototype.decompressData = function () {
if (this.compressionMethod == 8) {
if (this.originalSize > 0) {
this.decompressDataOld();
}
}
};
ZipArchiveItemHelper.prototype.decompressDataOld = function () {
var reader = new CompressedStreamReader(this.compressedStream, true);
var decompressedData;
if (this.originalSize > 0)
decompressedData = new Stream(new Uint8Array(this.originalSize));
var arrBuffer = new Uint8Array(BufferSize);
var iReadBytes;
var past = new Uint8Array(0);
while ((iReadBytes = reader.read(arrBuffer, 0, BufferSize)) > 0) {
// past = new Uint8Array(decompressedData.length);
// let currentBlock: Uint8Array = arrBuffer.subarray(0, iReadBytes);
decompressedData.write(arrBuffer.subarray(0, iReadBytes), 0, iReadBytes);
}
this.unCompressedStream = decompressedData.toByteArray();
// this.originalSize = decompressedData.Length;
// m_bControlStream = true;
// m_streamData = decompressedData;
// decompressedData.SetLength( m_lOriginalSize );
// decompressedData.Capacity = ( int )m_lOriginalSize;
if (this.checkCrc) {
//TODO: fix this
//CheckCrc(decompressedData.ToArray());
}
//m_streamData.Position = 0;
};
/// <summary>
/// Extracts local header from the stream.
/// </summary>
/// <param name="stream">Stream to read data from.</param>
ZipArchiveItemHelper.prototype.readLocalHeader = function (stream) {
if (stream.length == 0)
throw new DOMException("stream");
if (ZipArchive.ReadInt32(stream) != this.headerSignature)
throw new DOMException("Can't find local header signature - wrong file format or file is corrupt.");
// TODO: it is good to verify data read from the central directory record,
// but on the current moment we simply skip it.
stream.position += 22;
var iNameLength = ZipArchive.ReadInt16(stream);
var iExtraLength = ZipArchive.ReadUInt16(stream);
if (this.compressionMethod == 99) //SecurityConstants.AES
{
// stream.Position += iNameLength + 8;
// m_archive.EncryptionAlgorithm = (EncryptionAlgorithm)stream.ReadByte();
// m_actualCompression = new byte[2];
// stream.Read(m_actualCompression, 0, 2);
}
else if (iExtraLength > 2) {
stream.position += iNameLength;
var headerVal = ZipArchive.ReadInt16(stream);
if (headerVal == 0x0017) //PKZipEncryptionHeader
throw new DOMException("UnSupported");
else
stream.position += iExtraLength - 2;
}
else
stream.position += iNameLength + iExtraLength;
};
/// <summary>
/// Extracts compressed data from the stream.
/// </summary>
/// <param name="stream">Stream to read data from.</param>
ZipArchiveItemHelper.prototype.readCompressedData = function (stream) {
var dataStream;
if (this.compressedSize > 0) {
var iBytesLeft = this.compressedSize;
dataStream = new Stream(new Uint8Array(iBytesLeft));
var arrBuffer = new Uint8Array(BufferSize);
while (iBytesLeft > 0) {
var iBytesToRead = Math.min(iBytesLeft, BufferSize);
if (stream.read(arrBuffer, 0, iBytesToRead) != iBytesToRead)
throw new DOMException("End of file reached - wrong file format or file is corrupt.");
dataStream.write(arrBuffer.subarray(0, iBytesToRead), 0, iBytesToRead);
iBytesLeft -= iBytesToRead;
}
// if(m_archive.Password != null)
// {
// byte[] dataBuffer = new byte[dataStream.Length];
// dataBuffer = dataStream.ToArray();
// dataStream=new MemoryStream( Decrypt(dataBuffer));
// }
this.compressedStream = new Uint8Array(dataStream.inputStream);
// m_bControlStream = true;
}
else if (this.compressedSize < 0) //If compression size is negative, then read until the next header signature reached.
{
// MemoryStream dataStream = new MemoryStream();
// int bt = 0;
// bool proceed=true;
// while (proceed)
// {
// if ((bt = stream.ReadByte()) == Constants.HeaderSignatureStartByteValue)
// {
// stream.Position -= 1;
// int headerSignature = ZipArchive.ReadInt32(stream);
// if (headerSignature==Constants.CentralHeaderSignature || headerSignature==Constants.CentralHeaderSignature)
// {
// proceed = false;
// }
// stream.Position -= 3;
// }
// if (proceed)
// dataStream.WriteByte((byte)bt);
// }
// m_streamData = dataStream;
// m_lCompressedSize = m_streamData.Length;
// m_bControlStream = true;
}
else if (this.compressedSize == 0) {
// m_streamData = new MemoryStream();
}
};
return ZipArchiveItemHelper;
}());
export { ZipArchiveItemHelper };
/**

@@ -387,2 +738,9 @@ * Class represent unique ZipArchive item

}
Object.defineProperty(ZipArchiveItem.prototype, "dataStream", {
get: function () {
return this.decompressedStream;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ZipArchiveItem.prototype, "name", {

@@ -417,1 +775,2 @@ /**

export { ZipArchiveItem };
/* eslint-enable */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc