UNPKG

pxt-core

Version:

Microsoft MakeCode provides Blocks / JavaScript / Python tools and editors

28 lines (23 loc) 88.1 kB
/* Copyright (c) 2022 Gildas Lormeau. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ ((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).zip={})})(this,(function(t){"use strict";const{Array:e,Object:n,String:r,BigInt:i,Math:s,Date:o,Map:a,URL:c,Error:l,Uint8Array:f,Uint16Array:d,Uint32Array:u,DataView:h,Blob:p,Promise:w,TextEncoder:g,TextDecoder:y,FileReader:m,document:b,crypto:k,btoa:v}=globalThis,S={chunkSize:524288,maxWorkers:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||2,terminateWorkerTimeout:5e3,useWebWorkers:!0,workerScripts:void 0},_=n.assign({},S);function A(){return _}function z(t){if(void 0!==t.baseURL&&(_.baseURL=t.baseURL),void 0!==t.chunkSize&&(_.chunkSize=t.chunkSize),void 0!==t.maxWorkers&&(_.maxWorkers=t.maxWorkers),void 0!==t.terminateWorkerTimeout&&(_.terminateWorkerTimeout=t.terminateWorkerTimeout),void 0!==t.useWebWorkers&&(_.useWebWorkers=t.useWebWorkers),void 0!==t.Deflate&&(_.Deflate=t.Deflate),void 0!==t.Inflate&&(_.Inflate=t.Inflate),void 0!==t.workerScripts){if(t.workerScripts.deflate){if(!e.isArray(t.workerScripts.deflate))throw new l("workerScripts.deflate must be an array");_.workerScripts||(_.workerScripts={}),_.workerScripts.deflate=t.workerScripts.deflate}if(t.workerScripts.inflate){if(!e.isArray(t.workerScripts.inflate))throw new l("workerScripts.inflate must be an array");_.workerScripts||(_.workerScripts={}),_.workerScripts.inflate=t.workerScripts.inflate}}}function R(t,e,r){return class{constructor(i){const s=this;s.codec=new t(n.assign({},e,i)),r(s.codec,(t=>{if(s.pendingData){const e=s.pendingData;s.pendingData=new f(e.length+t.length),s.pendingData.set(e,0),s.pendingData.set(t,e.length)}else s.pendingData=new f(t)}))}append(t){return this.codec.push(t),i(this)}flush(){return this.codec.push(new f(0),!0),i(this)}};function i(t){if(t.pendingData){const e=t.pendingData;return t.pendingData=null,e}return new f(0)}}const C=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)1&e?e=e>>>1^3988292384:e>>>=1;C[t]=e}class E{constructor(t){this.crc=t||-1}append(t){let e=0|this.crc;for(let n=0,r=0|t.length;r>n;n++)e=e>>>8^C[255&(e^t[n])];this.crc=e}get(){return~this.crc}}function D(t){if(void 0===g){const e=new f((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new g).encode(t)}const F={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],r=F.getPartial(n);return 32===r?t.concat(e):F._shiftRight(e,r,0|n,t.slice(0,t.length-1))},bitLength(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+F.getPartial(n)},clamp(t,e){if(32*t.length<e)return t;const n=(t=t.slice(0,s.ceil(e/32))).length;return e&=31,n>0&&e&&(t[n-1]=F.partial(e,t[n-1]&2147483648>>e-1,1)),t},partial:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,getPartial:t=>s.round(t/1099511627776)||32,_shiftRight(t,e,n,r){for(void 0===r&&(r=[]);e>=32;e-=32)r.push(n),n=0;if(0===e)return r.concat(t);for(let i=0;i<t.length;i++)r.push(n|t[i]>>>e),n=t[i]<<32-e;const i=t.length?t[t.length-1]:0,s=F.getPartial(i);return r.push(F.partial(e+s&31,e+s>32?n:r.pop(),1)),r}},x={bytes:{fromBits(t){const e=F.bitLength(t)/8,n=new f(e);let r;for(let i=0;e>i;i++)0==(3&i)&&(r=t[i/4]),n[i]=r>>>24,r<<=8;return n},toBits(t){const e=[];let n,r=0;for(n=0;n<t.length;n++)r=r<<8|t[n],3==(3&n)&&(e.push(r),r=0);return 3&n&&e.push(F.partial(8*(3&n),r)),e}}},T={sha1:function(t){t?(this._h=t._h.slice(0),this._buffer=t._buffer.slice(0),this._length=t._length):this.reset()}};T.sha1.prototype={blockSize:512,reset:function(){const t=this;return t._h=this._init.slice(0),t._buffer=[],t._length=0,t},update:function(t){const e=this;"string"==typeof t&&(t=x.utf8String.toBits(t));const n=e._buffer=F.concat(e._buffer,t),r=e._length,i=e._length=r+F.bitLength(t);if(i>9007199254740991)throw new l("Cannot hash more than 2^53 - 1 bits");const s=new u(n);let o=0;for(let t=e.blockSize+r-(e.blockSize+r&e.blockSize-1);i>=t;t+=e.blockSize)e._block(s.subarray(16*o,16*(o+1))),o+=1;return n.splice(0,16*o),e},finalize:function(){const t=this;let e=t._buffer;const n=t._h;e=F.concat(e,[F.partial(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(s.floor(t._length/4294967296)),e.push(0|t._length);e.length;)t._block(e.splice(0,16));return t.reset(),n},_init:[1732584193,4023233417,2562383102,271733878,3285377520],_key:[1518500249,1859775393,2400959708,3395469782],_f:(t,e,n,r)=>t>19?t>39?t>59?t>79?void 0:e^n^r:e&n|e&r|n&r:e^n^r:e&n|~e&r,_S:(t,e)=>e<<t|e>>>32-t,_block:function(t){const n=this,r=n._h,i=e(80);for(let e=0;16>e;e++)i[e]=t[e];let o=r[0],a=r[1],c=r[2],l=r[3],f=r[4];for(let t=0;79>=t;t++){16>t||(i[t]=n._S(1,i[t-3]^i[t-8]^i[t-14]^i[t-16]));const e=n._S(5,o)+n._f(t,a,c,l)+f+i[t]+n._key[s.floor(t/20)]|0;f=l,l=c,c=n._S(30,a),a=o,o=e}r[0]=r[0]+o|0,r[1]=r[1]+a|0,r[2]=r[2]+c|0,r[3]=r[3]+l|0,r[4]=r[4]+f|0}};const I={getRandomValues(t){const e=new u(t.buffer),n=t=>{let e=987654321;const n=4294967295;return()=>(e=36969*(65535&e)+(e>>16)&n,(((e<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n)/4294967296+.5)*(s.random()>.5?1:-1))};for(let r,i=0;i<t.length;i+=4){const t=n(4294967296*(r||s.random()));r=987654071*t(),e[i/4]=4294967296*t()|0}return t}},U={importKey:t=>new U.hmacSha1(x.bytes.toBits(t)),pbkdf2(t,e,n,r){if(n=n||1e4,0>r||0>n)throw new l("invalid params to pbkdf2");const i=1+(r>>5)<<2;let s,o,a,c,f;const d=new ArrayBuffer(i),u=new h(d);let p=0;const w=F;for(e=x.bytes.toBits(e),f=1;(i||1)>p;f++){for(s=o=t.encrypt(w.concat(e,[f])),a=1;n>a;a++)for(o=t.encrypt(o),c=0;c<o.length;c++)s[c]^=o[c];for(a=0;(i||1)>p&&a<s.length;a++)u.setInt32(p,s[a]),p+=4}return d.slice(0,r/8)},hmacSha1:class{constructor(t){const e=this,n=e._hash=T.sha1,r=[[],[]],i=n.prototype.blockSize/32;e._baseHash=[new n,new n],t.length>i&&(t=n.hash(t));for(let e=0;i>e;e++)r[0][e]=909522486^t[e],r[1][e]=1549556828^t[e];e._baseHash[0].update(r[0]),e._baseHash[1].update(r[1]),e._resultHash=new n(e._baseHash[0])}reset(){const t=this;t._resultHash=new t._hash(t._baseHash[0]),t._updated=!1}update(t){this._updated=!0,this._resultHash.update(t)}digest(){const t=this,e=t._resultHash.finalize(),n=new t._hash(t._baseHash[1]).update(e).finalize();return t.reset(),n}encrypt(t){if(this._updated)throw new l("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},B="Invalid pasword",W=16,Q={name:"PBKDF2"},V=n.assign({hash:{name:"HMAC"}},Q),L=n.assign({iterations:1e3,hash:{name:"SHA-1"}},Q),M=["deriveBits"],H=[8,12,16],N=[16,24,32],Z=10,O=[0,0,0,0],K=void 0!==k,P=K&&void 0!==k.subtle,q=x.bytes,X=class{constructor(t){const e=this;e._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],e._tables[0][0][0]||e._precompute();const n=e._tables[0][4],r=e._tables[1],i=t.length;let s,o,a,c=1;if(4!==i&&6!==i&&8!==i)throw new l("invalid aes key size");for(e._key=[o=t.slice(0),a=[]],s=i;4*i+28>s;s++){let t=o[s-1];(s%i==0||8===i&&s%i==4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],s%i==0&&(t=t<<8^t>>>24^c<<24,c=c<<1^283*(c>>7))),o[s]=o[s-i]^t}for(let t=0;s;t++,s--){const e=o[3&t?s:s-4];a[t]=4>=s||4>t?e:r[0][n[e>>>24]]^r[1][n[e>>16&255]]^r[2][n[e>>8&255]]^r[3][n[255&e]]}}encrypt(t){return this._crypt(t,0)}decrypt(t){return this._crypt(t,1)}_precompute(){const t=this._tables[0],e=this._tables[1],n=t[4],r=e[4],i=[],s=[];let o,a,c,l;for(let t=0;256>t;t++)s[(i[t]=t<<1^283*(t>>7))^t]=t;for(let f=o=0;!n[f];f^=a||1,o=s[o]||1){let s=o^o<<1^o<<2^o<<3^o<<4;s=s>>8^255&s^99,n[f]=s,r[s]=f,l=i[c=i[a=i[f]]];let d=16843009*l^65537*c^257*a^16843008*f,u=257*i[s]^16843008*s;for(let n=0;4>n;n++)t[n][f]=u=u<<24^u>>>8,e[n][s]=d=d<<24^d>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}_crypt(t,e){if(4!==t.length)throw new l("invalid aes block size");const n=this._key[e],r=n.length/4-2,i=[0,0,0,0],s=this._tables[e],o=s[0],a=s[1],c=s[2],f=s[3],d=s[4];let u,h,p,w=t[0]^n[0],g=t[e?3:1]^n[1],y=t[2]^n[2],m=t[e?1:3]^n[3],b=4;for(let t=0;r>t;t++)u=o[w>>>24]^a[g>>16&255]^c[y>>8&255]^f[255&m]^n[b],h=o[g>>>24]^a[y>>16&255]^c[m>>8&255]^f[255&w]^n[b+1],p=o[y>>>24]^a[m>>16&255]^c[w>>8&255]^f[255&g]^n[b+2],m=o[m>>>24]^a[w>>16&255]^c[g>>8&255]^f[255&y]^n[b+3],b+=4,w=u,g=h,y=p;for(let t=0;4>t;t++)i[e?3&-t:t]=d[w>>>24]<<24^d[g>>16&255]<<16^d[y>>8&255]<<8^d[255&m]^n[b++],u=w,w=g,g=y,y=m,m=u;return i}},Y=class{constructor(t,e){this._prf=t,this._initIv=e,this._iv=e}reset(){this._iv=this._initIv}update(t){return this.calculate(this._prf,t,this._iv)}incWord(t){if(255==(t>>24&255)){let e=t>>16&255,n=t>>8&255,r=255&t;255===e?(e=0,255===n?(n=0,255===r?r=0:++r):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=r}else t+=1<<24;return t}incCounter(t){0===(t[0]=this.incWord(t[0]))&&(t[1]=this.incWord(t[1]))}calculate(t,e,n){let r;if(!(r=e.length))return[];const i=F.bitLength(e);for(let i=0;r>i;i+=4){this.incCounter(n);const r=t.encrypt(n);e[i]^=r[0],e[i+1]^=r[1],e[i+2]^=r[2],e[i+3]^=r[3]}return F.clamp(e,i)}},$=U.hmacSha1;class j{constructor(t,e,r){n.assign(this,{password:t,signed:e,strength:r-1,pendingInput:new f(0)})}async append(t){const n=this;if(n.password){const r=nt(t,0,H[n.strength]+2);await(async(t,e,n)=>{await tt(t,n,nt(e,0,H[t.strength]));const r=nt(e,H[t.strength]),i=t.keys.passwordVerification;if(i[0]!=r[0]||i[1]!=r[1])throw new l(B)})(n,r,n.password),n.password=null,n.aesCtrGladman=new Y(new X(n.keys.key),e.from(O)),n.hmac=new $(n.keys.authentication),t=nt(t,H[n.strength]+2)}return J(n,t,new f(t.length-Z-(t.length-Z)%W),0,Z,!0)}flush(){const t=this,e=t.pendingInput,n=nt(e,0,e.length-Z),r=nt(e,e.length-Z);let i=new f(0);if(n.length){const e=q.toBits(n);t.hmac.update(e);const r=t.aesCtrGladman.update(e);i=q.fromBits(r)}let s=!0;if(t.signed){const e=nt(q.fromBits(t.hmac.digest()),0,Z);for(let t=0;Z>t;t++)e[t]!=r[t]&&(s=!1)}return{valid:s,data:i}}}class G{constructor(t,e){n.assign(this,{password:t,strength:e-1,pendingInput:new f(0)})}async append(t){const n=this;let r=new f(0);n.password&&(r=await(async(t,e)=>{const n=(r=new f(H[t.strength]),K&&"function"==typeof k.getRandomValues?k.getRandomValues(r):I.getRandomValues(r));var r;return await tt(t,e,n),et(n,t.keys.passwordVerification)})(n,n.password),n.password=null,n.aesCtrGladman=new Y(new X(n.keys.key),e.from(O)),n.hmac=new $(n.keys.authentication));const i=new f(r.length+t.length-t.length%W);return i.set(r,0),J(n,t,i,r.length,0)}flush(){const t=this;let e=new f(0);if(t.pendingInput.length){const n=t.aesCtrGladman.update(q.toBits(t.pendingInput));t.hmac.update(n),e=q.fromBits(n)}const n=nt(q.fromBits(t.hmac.digest()),0,Z);return{data:et(e,n),signature:n}}}function J(t,e,n,r,i,s){const o=e.length-i;let a;for(t.pendingInput.length&&(e=et(t.pendingInput,e),n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new f(e)).set(n,0)}return t})(n,o-o%W)),a=0;o-W>=a;a+=W){const i=q.toBits(nt(e,a,a+W));s&&t.hmac.update(i);const o=t.aesCtrGladman.update(i);s||t.hmac.update(o),n.set(q.fromBits(o),a+r)}return t.pendingInput=nt(e,a),n}async function tt(t,e,r){const i=D(e),s=await((t,e,n,r,i)=>K&&P&&"function"==typeof k.subtle.importKey?k.subtle.importKey("raw",e,n,!1,i):U.importKey(e))(0,i,V,0,M),o=await(async(t,e,n)=>K&&P&&"function"==typeof k.subtle.deriveBits?await k.subtle.deriveBits(t,e,n):U.pbkdf2(e,t.salt,L.iterations,n))(n.assign({salt:r},L),s,8*(2*N[t.strength]+2)),a=new f(o);t.keys={key:q.toBits(nt(a,0,N[t.strength])),authentication:q.toBits(nt(a,N[t.strength],2*N[t.strength])),passwordVerification:nt(a,2*N[t.strength])}}function et(t,e){let n=t;return t.length+e.length&&(n=new f(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function nt(t,e,n){return t.subarray(e,n)}class rt{constructor(t,e){n.assign(this,{password:t,passwordVerification:e}),at(this,t)}append(t){const e=this;if(e.password){const n=st(e,t.subarray(0,12));if(e.password=null,n[11]!=e.passwordVerification)throw new l(B);t=t.subarray(12)}return st(e,t)}flush(){return{valid:!0,data:new f(0)}}}class it{constructor(t,e){n.assign(this,{password:t,passwordVerification:e}),at(this,t)}append(t){const e=this;let n,r;if(e.password){e.password=null;const i=k.getRandomValues(new f(12));i[11]=e.passwordVerification,n=new f(t.length+i.length),n.set(ot(e,i),0),r=12}else n=new f(t.length),r=0;return n.set(ot(e,t),r),n}flush(){return{data:new f(0)}}}function st(t,e){const n=new f(e.length);for(let r=0;r<e.length;r++)n[r]=lt(t)^e[r],ct(t,n[r]);return n}function ot(t,e){const n=new f(e.length);for(let r=0;r<e.length;r++)n[r]=lt(t)^e[r],ct(t,e[r]);return n}function at(t,e){t.keys=[305419896,591751049,878082192],t.crcKey0=new E(t.keys[0]),t.crcKey2=new E(t.keys[2]);for(let n=0;n<e.length;n++)ct(t,e.charCodeAt(n))}function ct(t,e){t.crcKey0.append([e]),t.keys[0]=~t.crcKey0.get(),t.keys[1]=dt(t.keys[1]+ft(t.keys[0])),t.keys[1]=dt(s.imul(t.keys[1],134775813)+1),t.crcKey2.append([t.keys[1]>>>24]),t.keys[2]=~t.crcKey2.get()}function lt(t){const e=2|t.keys[2];return ft(s.imul(e,1^e)>>>8)}function ft(t){return 255&t}function dt(t){return 4294967295&t}const ut="deflate",ht="inflate",pt="Invalid signature";class wt{constructor(t,{signature:e,password:r,signed:i,compressed:s,zipCrypto:o,passwordVerification:a,encryptionStrength:c},{chunkSize:l}){const f=!!r;n.assign(this,{signature:e,encrypted:f,signed:i,compressed:s,inflate:s&&new t({chunkSize:l}),crc32:i&&new E,zipCrypto:o,decrypt:f&&o?new rt(r,a):new j(r,i,c)})}async append(t){const e=this;return e.encrypted&&t.length&&(t=await e.decrypt.append(t)),e.compressed&&t.length&&(t=await e.inflate.append(t)),(!e.encrypted||e.zipCrypto)&&e.signed&&t.length&&e.crc32.append(t),t}async flush(){const t=this;let e,n=new f(0);if(t.encrypted){const e=t.decrypt.flush();if(!e.valid)throw new l(pt);n=e.data}if((!t.encrypted||t.zipCrypto)&&t.signed){const n=new h(new f(4).buffer);if(e=t.crc32.get(),n.setUint32(0,e),t.signature!=n.getUint32(0,!1))throw new l(pt)}return t.compressed&&(n=await t.inflate.append(n)||new f(0),await t.inflate.flush()),{data:n,signature:e}}}class gt{constructor(t,{encrypted:e,signed:r,compressed:i,level:s,zipCrypto:o,password:a,passwordVerification:c,encryptionStrength:l},{chunkSize:f}){n.assign(this,{encrypted:e,signed:r,compressed:i,deflate:i&&new t({level:s||5,chunkSize:f}),crc32:r&&new E,zipCrypto:o,encrypt:e&&o?new it(a,c):new G(a,l)})}async append(t){const e=this;let n=t;return e.compressed&&t.length&&(n=await e.deflate.append(t)),e.encrypted&&n.length&&(n=await e.encrypt.append(n)),(!e.encrypted||e.zipCrypto)&&e.signed&&t.length&&e.crc32.append(t),n}async flush(){const t=this;let e,n=new f(0);if(t.compressed&&(n=await t.deflate.flush()||new f(0)),t.encrypted){n=await t.encrypt.append(n);const r=t.encrypt.flush();e=r.signature;const i=new f(n.length+r.data.length);i.set(n,0),i.set(r.data,n.length),n=i}return t.encrypted&&!t.zipCrypto||!t.signed||(e=t.crc32.get()),{data:n,signature:e}}}const yt="init",mt="append",bt="flush";let kt=!0;var vt=(t,e,r,i,s,o,a)=>(n.assign(t,{busy:!0,codecConstructor:e,options:n.assign({},r),scripts:a,terminate(){t.worker&&!t.busy&&(t.worker.terminate(),t.interface=null)},onTaskFinished(){t.busy=!1,s(t)}}),o?((t,e)=>{let n;const r={type:"module"};if(!t.interface){if(kt)try{t.worker=i({},e.baseURL)}catch(n){kt=!1,t.worker=i(r,e.baseURL)}else t.worker=i(r,e.baseURL);t.worker.addEventListener("message",(e=>{const r=e.data;if(n){const e=r.error,i=r.type;if(e){const r=new l(e.message);r.stack=e.stack,n.reject(r),n=null,t.onTaskFinished()}else if(i==yt||i==bt||i==mt){const e=r.data;i==bt?(n.resolve({data:new f(e),signature:r.signature}),n=null,t.onTaskFinished()):n.resolve(e&&new f(e))}}}),!1),t.interface={append:t=>s({type:mt,data:t}),flush:()=>s({type:bt}),abort(){t.onTaskFinished()}}}return t.interface;function i(e,n){let r,i;r=t.scripts[0],"function"==typeof r&&(r=r());try{i=new c(r,n)}catch(t){i=r}return new Worker(i,e)}async function s(r){if(!n){const n=t.options,r=t.scripts.slice(1);await o({scripts:r,type:yt,options:n,config:{chunkSize:e.chunkSize}})}return o(r)}function o(e){const r=t.worker,i=new w(((t,e)=>n={resolve:t,reject:e}));try{if(e.data)try{e.data=e.data.buffer,r.postMessage(e,[e.data])}catch(t){r.postMessage(e)}else r.postMessage(e)}catch(e){n.reject(e),n=null,t.onTaskFinished()}return i}})(t,i):((t,e)=>{const n=((t,e,n)=>e.codecType.startsWith(ut)?new gt(t,e,n):e.codecType.startsWith(ht)?new wt(t,e,n):void 0)(t.codecConstructor,t.options,e);return{async append(e){try{return await n.append(e)}catch(e){throw t.onTaskFinished(),e}},async flush(){try{return await n.flush()}finally{t.onTaskFinished()}},abort(){t.onTaskFinished()}}})(t,i));let St=[];const _t=[];function At(t,e,n){const r=!(!e.compressed&&!e.signed&&!e.encrypted)&&(e.useWebWorkers||void 0===e.useWebWorkers&&n.useWebWorkers),i=r&&n.workerScripts?n.workerScripts[e.codecType]:[];if(St.length<n.maxWorkers){const o={};return St.push(o),vt(o,t,e,n,s,r,i)}{const o=St.find((t=>!t.busy));return o?(zt(o),vt(o,t,e,n,s,r,i)):new w((n=>_t.push({resolve:n,codecConstructor:t,options:e,webWorker:r,scripts:i})))}function s(t){if(_t.length){const[{resolve:e,codecConstructor:r,options:i,webWorker:o,scripts:a}]=_t.splice(0,1);e(vt(t,r,i,n,s,o,a))}else t.worker?(zt(t),Number.isFinite(n.terminateWorkerTimeout)&&n.terminateWorkerTimeout>=0&&(t.terminateTimeout=setTimeout((()=>{St=St.filter((e=>e!=t)),t.terminate()}),n.terminateWorkerTimeout))):St=St.filter((e=>e!=t))}}function zt(t){t.terminateTimeout&&(clearTimeout(t.terminateTimeout),t.terminateTimeout=null)}const Rt="Abort error";async function Ct(t,e,n,r,i,o,a){const c=s.max(o.chunkSize,64);return async function o(l=0,f=0){const d=a.signal;if(i>l){Et(d,t);const u=await e.readUint8Array(l+r,s.min(c,i-l)),h=u.length;Et(d,t);const p=await t.append(u);if(Et(d,t),f+=await Dt(n,p),a.onprogress)try{a.onprogress(l+h,i)}catch(t){}return o(l+c,f)}{const e=await t.flush();return f+=await Dt(n,e.data),{signature:e.signature,length:f}}}()}function Et(t,e){if(t&&t.aborted)throw e.abort(),new l(Rt)}async function Dt(t,e){return e.length&&await t.writeUint8Array(e),e.length}const Ft="HTTP error ",xt="HTTP Range not supported",Tt="text/plain",It="GET";class Ut{constructor(){this.size=0}init(){this.initialized=!0}}class Bt extends Ut{}class Wt extends Ut{writeUint8Array(t){this.size+=t.length}}class Qt extends Bt{constructor(t){super(),this.blob=t,this.size=t.size}async readUint8Array(t,e){if(this.blob.arrayBuffer)return new f(await this.blob.slice(t,t+e).arrayBuffer());{const n=new m;return new w(((r,i)=>{n.onload=t=>r(new f(t.target.result)),n.onerror=()=>i(n.error),n.readAsArrayBuffer(this.blob.slice(t,t+e))}))}}}class Vt extends Wt{constructor(t){super(),this.contentType=t,this.arrayBuffersMaxlength=8,Lt(this)}writeUint8Array(t){super.writeUint8Array(t),this.arrayBuffers.length==this.arrayBuffersMaxlength&&Mt(this),this.arrayBuffers.push(t.buffer)}getData(){return this.blob||(this.arrayBuffers.length&&Mt(this),this.blob=this.pendingBlob,Lt(this)),this.blob}}function Lt(t){t.pendingBlob=new p([],{type:t.contentType}),t.arrayBuffers=[]}function Mt(t){t.pendingBlob=new p([t.pendingBlob,...t.arrayBuffers],{type:t.contentType}),t.arrayBuffers=[]}class Ht extends Bt{constructor(t,e){super(),this.url=t,this.preventHeadRequest=e.preventHeadRequest,this.useRangeHeader=e.useRangeHeader,this.forceRangeRequests=e.forceRangeRequests,this.options=n.assign({},e),delete this.options.preventHeadRequest,delete this.options.useRangeHeader,delete this.options.forceRangeRequests,delete this.options.useXHR}async init(){super.init(),await Zt(this,jt,qt)}readUint8Array(t,e){return Ot(this,t,e,jt,qt)}}class Nt extends Bt{constructor(t,e){super(),this.url=t,this.preventHeadRequest=e.preventHeadRequest,this.useRangeHeader=e.useRangeHeader,this.forceRangeRequests=e.forceRangeRequests,this.options=e}async init(){super.init(),await Zt(this,Gt,Xt)}readUint8Array(t,e){return Ot(this,t,e,Gt,Xt)}}async function Zt(t,e,n){if((t=>{if(void 0!==b){const e=b.createElement("a");return e.href=t,"http:"==e.protocol||"https:"==e.protocol}return/^https?:\/\//i.test(t)})(t.url)&&(t.useRangeHeader||t.forceRangeRequests)){const r=await e(It,t,Kt(t));if(!t.forceRangeRequests&&"bytes"!=r.headers.get("Accept-Ranges"))throw new l(xt);{let i;const s=r.headers.get("Content-Range");if(s){const t=s.trim().split(/\s*\/\s*/);if(t.length){const e=t[1];e&&"*"!=e&&(i=Number(e))}}void 0===i?await $t(t,e,n):t.size=i}}else await $t(t,e,n)}async function Ot(t,e,n,r,i){if(t.useRangeHeader||t.forceRangeRequests){const i=await r(It,t,Kt(t,e,n));if(206!=i.status)throw new l(xt);return new f(await i.arrayBuffer())}return t.data||await i(t,t.options),new f(t.data.subarray(e,e+n))}function Kt(t,e=0,r=1){return n.assign({},Pt(t),{Range:"bytes="+e+"-"+(e+r-1)})}function Pt(t){const e=t.options.headers;if(e)return Symbol.iterator in e?n.fromEntries(e):e}async function qt(t){await Yt(t,jt)}async function Xt(t){await Yt(t,Gt)}async function Yt(t,e){const n=await e(It,t,Pt(t));t.data=new f(await n.arrayBuffer()),t.size||(t.size=t.data.length)}async function $t(t,e,n){if(t.preventHeadRequest)await n(t,t.options);else{const r=(await e("HEAD",t,Pt(t))).headers.get("Content-Length");r?t.size=Number(r):await n(t,t.options)}}async function jt(t,{options:e,url:r},i){const s=await fetch(r,n.assign({},e,{method:t,headers:i}));if(400>s.status)return s;throw new l(Ft+(s.statusText||s.status))}function Gt(t,{url:e},r){return new w(((i,s)=>{const o=new XMLHttpRequest;if(o.addEventListener("load",(()=>{if(400>o.status){const t=[];o.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((e=>{const n=e.trim().split(/\s*:\s*/);n[0]=n[0].trim().replace(/^[a-z]|-[a-z]/g,(t=>t.toUpperCase())),t.push(n)})),i({status:o.status,arrayBuffer:()=>o.response,headers:new a(t)})}else s(new l(Ft+(o.statusText||o.status)))}),!1),o.addEventListener("error",(t=>s(t.detail.error)),!1),o.open(t,e),r)for(const t of n.entries(r))o.setRequestHeader(t[0],t[1]);o.responseType="arraybuffer",o.send()}))}class Jt extends Bt{constructor(t,e={}){super(),this.url=t,e.useXHR?this.reader=new Nt(t,e):this.reader=new Ht(t,e)}set size(t){}get size(){return this.reader.size}async init(){super.init(),await this.reader.init()}readUint8Array(t,e){return this.reader.readUint8Array(t,e)}}const te=4294967295,ee=65535,ne=67324752,re=33639248,ie=101075792,se=117853008,oe=21589,ae=2048,ce="/",le=new o(2107,11,31),fe=new o(1980,0,1),de="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");function ue(t,e){if(e&&"cp437"==e.trim().toLowerCase())return(t=>{let e="";for(let n=0;n<t.length;n++)e+=de[t[n]];return e})(t);if(void 0===y){const e=new m;return new w(((n,r)=>{e.onload=t=>n(t.target.result),e.onerror=()=>r(e.error),e.readAsText(new p([t]))}))}return new y(e).decode(t)}const he=["filename","rawFilename","directory","encrypted","compressedSize","uncompressedSize","lastModDate","rawLastModDate","comment","rawComment","signature","extraField","rawExtraField","bitFlag","extraFieldZip64","extraFieldUnicodePath","extraFieldUnicodeComment","extraFieldAES","filenameUTF8","commentUTF8","offset","zip64","compressionMethod","extraFieldNTFS","lastAccessDate","creationDate","extraFieldExtendedTimestamp","version","versionMadeBy","msDosCompatible","internalFileAttribute","externalFileAttribute"];class pe{constructor(t){he.forEach((e=>this[e]=t[e]))}}const we="File format is not recognized",ge="End of central directory not found",ye="End of Zip64 central directory not found",me="End of Zip64 central directory locator not found",be="Central directory header not found",ke="Local file header not found",ve="Zip64 extra field not found",Se="File contains encrypted entry",_e="Encryption method not supported",Ae="Compression method not supported",ze="utf-8",Re="cp437",Ce=["uncompressedSize","compressedSize","offset"];class Ee{constructor(t,e,r){n.assign(this,{reader:t,config:e,options:r})}async getData(t,e,n={}){const r=this,{reader:i,offset:s,extraFieldAES:o,compressionMethod:a,config:c,bitFlag:f,signature:d,rawLastModDate:u,compressedSize:h}=r,p=r.localDirectory={};i.initialized||await i.init();let w=await Me(i,s,30);const g=Le(w);let y=Te(r,n,"password");if(y=y&&y.length&&y,o&&99!=o.originalCompressionMethod)throw new l(Ae);if(0!=a&&8!=a)throw new l(Ae);if(Qe(g,0)!=ne)throw new l(ke);De(p,g,4),w=await Me(i,s,30+p.filenameLength+p.extraFieldLength),p.rawExtraField=w.subarray(30+p.filenameLength),await Fe(r,p,g,4),e.lastAccessDate=p.lastAccessDate,e.creationDate=p.creationDate;const m=r.encrypted&&p.encrypted,b=m&&!o;if(m){if(!b&&void 0===o.strength)throw new l(_e);if(!y)throw new l(Se)}const k=await At(c.Inflate,{codecType:ht,password:y,zipCrypto:b,encryptionStrength:o&&o.strength,signed:Te(r,n,"checkSignature"),passwordVerification:b&&(f.dataDescriptor?u>>>8&255:d>>>24&255),signature:d,compressed:0!=a,encrypted:m,useWebWorkers:Te(r,n,"useWebWorkers")},c);t.initialized||await t.init();const v=Te(r,n,"signal"),S=s+30+p.filenameLength+p.extraFieldLength;return await Ct(k,i,t,S,h,c,{onprogress:n.onprogress,signal:v}),t.getData()}}function De(t,e,r){const i=t.rawBitFlag=We(e,r+2),s=1==(1&i),o=Qe(e,r+6);n.assign(t,{encrypted:s,version:We(e,r),bitFlag:{level:(6&i)>>1,dataDescriptor:8==(8&i),languageEncodingFlag:(i&ae)==ae},rawLastModDate:o,lastModDate:Ie(o),filenameLength:We(e,r+22),extraFieldLength:We(e,r+24)})}async function Fe(t,e,r,i){const c=e.rawExtraField,d=e.extraField=new a,u=Le(new f(c));let h=0;try{for(;h<c.length;){const t=We(u,h),e=We(u,h+2);d.set(t,{type:t,data:c.slice(h+4,h+4+e)}),h+=4+e}}catch(t){}const p=We(r,i+4);e.signature=Qe(r,i+10),e.uncompressedSize=Qe(r,i+18),e.compressedSize=Qe(r,i+14);const w=d.get(1);w&&(((t,e)=>{e.zip64=!0;const n=Le(t.data);t.values=[];for(let e=0;e<s.floor(t.data.length/8);e++)t.values.push(Ve(n,0+8*e));const r=Ce.filter((t=>e[t]==te));for(let e=0;e<r.length;e++)t[r[e]]=t.values[e];Ce.forEach((n=>{if(e[n]==te){if(void 0===t[n])throw new l(ve);e[n]=t[n]}}))})(w,e),e.extraFieldZip64=w);const g=d.get(28789);g&&(await xe(g,"filename","rawFilename",e,t),e.extraFieldUnicodePath=g);const y=d.get(25461);y&&(await xe(y,"comment","rawComment",e,t),e.extraFieldUnicodeComment=y);const m=d.get(39169);m?(((t,e,n)=>{const r=Le(t.data);t.vendorVersion=Be(r,0),t.vendorId=Be(r,2);const i=Be(r,4);t.strength=i,t.originalCompressionMethod=n,e.compressionMethod=t.compressionMethod=We(r,5)})(m,e,p),e.extraFieldAES=m):e.compressionMethod=p;const b=d.get(10);b&&(((t,e)=>{const r=Le(t.data);let i,s=4;try{for(;s<t.data.length&&!i;){const e=We(r,s),n=We(r,s+2);1==e&&(i=t.data.slice(s+4,s+4+n)),s+=4+n}}catch(t){}try{if(i&&24==i.length){const r=Le(i),s=r.getBigUint64(0,!0),o=r.getBigUint64(8,!0),a=r.getBigUint64(16,!0);n.assign(t,{rawLastModDate:s,rawLastAccessDate:o,rawCreationDate:a});const c={lastModDate:Ue(s),lastAccessDate:Ue(o),creationDate:Ue(a)};n.assign(t,c),n.assign(e,c)}}catch(t){}})(b,e),e.extraFieldNTFS=b);const k=d.get(oe);k&&(((t,e)=>{const n=Le(t.data),r=Be(n,0),i=[],s=[];1==(1&r)&&(i.push("lastModDate"),s.push("rawLastModDate")),2==(2&r)&&(i.push("lastAccessDate"),s.push("rawLastAccessDate")),4==(4&r)&&(i.push("creationDate"),s.push("rawCreationDate"));let a=1;i.forEach(((r,i)=>{if(t.data.length>=a+4){const c=Qe(n,a);e[r]=t[r]=new o(1e3*c);const l=s[i];t[l]=c}a+=4}))})(k,e),e.extraFieldExtendedTimestamp=k)}async function xe(t,e,n,r,i){const s=Le(t.data);t.version=Be(s,0),t.signature=Qe(s,1);const o=new E;o.append(i[n]);const a=Le(new f(4));a.setUint32(0,o.get(),!0),t[e]=await ue(t.data.subarray(5)),t.valid=!i.bitFlag.languageEncodingFlag&&t.signature==Qe(a,0),t.valid&&(r[e]=t[e],r[e+"UTF8"]=!0)}function Te(t,e,n){return void 0===e[n]?t.options[n]:e[n]}function Ie(t){const e=(4294901760&t)>>16,n=65535&t;try{return new o(1980+((65024&e)>>9),((480&e)>>5)-1,31&e,(63488&n)>>11,(2016&n)>>5,2*(31&n),0)}catch(t){}}function Ue(t){return new o(Number(t/i(1e4)-i(116444736e5)))}function Be(t,e){return t.getUint8(e)}function We(t,e){return t.getUint16(e,!0)}function Qe(t,e){return t.getUint32(e,!0)}function Ve(t,e){return Number(t.getBigUint64(e,!0))}function Le(t){return new h(t.buffer)}function Me(t,e,n){return t.readUint8Array(e,n)}const He="File already exists",Ne="Zip file comment exceeds 64KB",Ze="File entry comment exceeds 64KB",Oe="File entry name exceeds 64KB",Ke="Version exceeds 65535",Pe="The strength must equal 1, 2, or 3",qe="Extra field type exceeds 65535",Xe="Extra field data exceeds 64KB",Ye="Zip64 is not supported",$e=new f([7,0,2,0,65,69,3,0,0]);let je,Ge=0;function Je(t,e,n){if(t.arrayBuffer)return e||n?t.slice(e,n).arrayBuffer():t.arrayBuffer();{const r=new m;return new w(((i,s)=>{r.onload=t=>i(t.target.result),r.onerror=()=>s(r.error),r.readAsArrayBuffer(e||n?t.slice(e,n):t)}))}}function tn(t){if(t)return(i(t.getTime())+i(116444736e5))*i(1e4)}function en(t,e,n){return void 0===e[n]?t.options[n]:e[n]}function nn(t,e,n){t.setUint8(e,n)}function rn(t,e,n){t.setUint16(e,n,!0)}function sn(t,e,n){t.setUint32(e,n,!0)}function on(t,e,n){t.setBigUint64(e,n,!0)}function an(t,e,n){t.set(e,n)}function cn(t){return new h(t.buffer)}try{je=void 0===b&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:void 0===b?location.href:b.currentScript&&b.currentScript.src||new c("zip.min.js",b.baseURI).href}catch(t){}z({baseURL:je}),(t=>{if("function"==typeof c.createObjectURL){const e=()=>c.createObjectURL(new p(['const{Array:t,Object:e,Math:n,Error:r,Uint8Array:i,Uint16Array:o,Uint32Array:s,Int32Array:f,DataView:c,TextEncoder:l,crypto:u,postMessage:a}=globalThis,w=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)1&e?e=e>>>1^3988292384:e>>>=1;w[t]=e}class h{constructor(t){this.t=t||-1}append(t){let e=0|this.t;for(let n=0,r=0|t.length;r>n;n++)e=e>>>8^w[255&(e^t[n])];this.t=e}get(){return~this.t}}const d={concat(t,e){if(0===t.length||0===e.length)return t.concat(e);const n=t[t.length-1],r=d.i(n);return 32===r?t.concat(e):d.o(e,r,0|n,t.slice(0,t.length-1))},l(t){const e=t.length;if(0===e)return 0;const n=t[e-1];return 32*(e-1)+d.i(n)},u(t,e){if(32*t.length<e)return t;const r=(t=t.slice(0,n.ceil(e/32))).length;return e&=31,r>0&&e&&(t[r-1]=d.h(e,t[r-1]&2147483648>>e-1,1)),t},h:(t,e,n)=>32===t?e:(n?0|e:e<<32-t)+1099511627776*t,i:t=>n.round(t/1099511627776)||32,o(t,e,n,r){for(void 0===r&&(r=[]);e>=32;e-=32)r.push(n),n=0;if(0===e)return r.concat(t);for(let i=0;i<t.length;i++)r.push(n|t[i]>>>e),n=t[i]<<32-e;const i=t.length?t[t.length-1]:0,o=d.i(i);return r.push(d.h(e+o&31,e+o>32?n:r.pop(),1)),r}},p={p:{k(t){const e=d.l(t)/8,n=new i(e);let r;for(let i=0;e>i;i++)0==(3&i)&&(r=t[i/4]),n[i]=r>>>24,r<<=8;return n},g(t){const e=[];let n,r=0;for(n=0;n<t.length;n++)r=r<<8|t[n],3==(3&n)&&(e.push(r),r=0);return 3&n&&e.push(d.h(8*(3&n),r)),e}}},y={v:function(t){t?(this.m=t.m.slice(0),this.S=t.S.slice(0),this._=t._):this.reset()}};y.v.prototype={blockSize:512,reset:function(){const t=this;return t.m=this.I.slice(0),t.S=[],t._=0,t},update:function(t){const e=this;"string"==typeof t&&(t=p.A.g(t));const n=e.S=d.concat(e.S,t),i=e._,o=e._=i+d.l(t);if(o>9007199254740991)throw new r("Cannot hash more than 2^53 - 1 bits");const f=new s(n);let c=0;for(let t=e.blockSize+i-(e.blockSize+i&e.blockSize-1);o>=t;t+=e.blockSize)e.C(f.subarray(16*c,16*(c+1))),c+=1;return n.splice(0,16*c),e},V:function(){const t=this;let e=t.S;const r=t.m;e=d.concat(e,[d.h(1,1)]);for(let t=e.length+2;15&t;t++)e.push(0);for(e.push(n.floor(t._/4294967296)),e.push(0|t._);e.length;)t.C(e.splice(0,16));return t.reset(),r},I:[1732584193,4023233417,2562383102,271733878,3285377520],B:[1518500249,1859775393,2400959708,3395469782],D:(t,e,n,r)=>t>19?t>39?t>59?t>79?void 0:e^n^r:e&n|e&r|n&r:e^n^r:e&n|~e&r,U:(t,e)=>e<<t|e>>>32-t,C:function(e){const r=this,i=r.m,o=t(80);for(let t=0;16>t;t++)o[t]=e[t];let s=i[0],f=i[1],c=i[2],l=i[3],u=i[4];for(let t=0;79>=t;t++){16>t||(o[t]=r.U(1,o[t-3]^o[t-8]^o[t-14]^o[t-16]));const e=r.U(5,s)+r.D(t,f,c,l)+u+o[t]+r.B[n.floor(t/20)]|0;u=l,l=c,c=r.U(30,f),f=s,s=e}i[0]=i[0]+s|0,i[1]=i[1]+f|0,i[2]=i[2]+c|0,i[3]=i[3]+l|0,i[4]=i[4]+u|0}};const b={getRandomValues(t){const e=new s(t.buffer),r=t=>{let e=987654321;const r=4294967295;return()=>(e=36969*(65535&e)+(e>>16)&r,(((e<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r)/4294967296+.5)*(n.random()>.5?1:-1))};for(let i,o=0;o<t.length;o+=4){const t=r(4294967296*(i||n.random()));i=987654071*t(),e[o/4]=4294967296*t()|0}return t}},k={importKey:t=>new k.M(p.p.g(t)),P(t,e,n,i){if(n=n||1e4,0>i||0>n)throw new r("invalid params to pbkdf2");const o=1+(i>>5)<<2;let s,f,l,u,a;const w=new ArrayBuffer(o),h=new c(w);let y=0;const b=d;for(e=p.p.g(e),a=1;(o||1)>y;a++){for(s=f=t.encrypt(b.concat(e,[a])),l=1;n>l;l++)for(f=t.encrypt(f),u=0;u<f.length;u++)s[u]^=f[u];for(l=0;(o||1)>y&&l<s.length;l++)h.setInt32(y,s[l]),y+=4}return w.slice(0,i/8)},M:class{constructor(t){const e=this,n=e.R=y.v,r=[[],[]],i=n.prototype.blockSize/32;e.H=[new n,new n],t.length>i&&(t=n.hash(t));for(let e=0;i>e;e++)r[0][e]=909522486^t[e],r[1][e]=1549556828^t[e];e.H[0].update(r[0]),e.H[1].update(r[1]),e.K=new n(e.H[0])}reset(){const t=this;t.K=new t.R(t.H[0]),t.L=!1}update(t){this.L=!0,this.K.update(t)}digest(){const t=this,e=t.K.V(),n=new t.R(t.H[1]).update(e).V();return t.reset(),n}encrypt(t){if(this.L)throw new r("encrypt on already updated hmac called!");return this.update(t),this.digest(t)}}},g={name:"PBKDF2"},v=e.assign({hash:{name:"HMAC"}},g),m=e.assign({iterations:1e3,hash:{name:"SHA-1"}},g),S=["deriveBits"],z=[8,12,16],_=[16,24,32],I=[0,0,0,0],A=void 0!==u,C=A&&void 0!==u.subtle,V=p.p,B=class{constructor(t){const e=this;e.T=[[[],[],[],[],[]],[[],[],[],[],[]]],e.T[0][0][0]||e.j();const n=e.T[0][4],i=e.T[1],o=t.length;let s,f,c,l=1;if(4!==o&&6!==o&&8!==o)throw new r("invalid aes key size");for(e.B=[f=t.slice(0),c=[]],s=o;4*o+28>s;s++){let t=f[s-1];(s%o==0||8===o&&s%o==4)&&(t=n[t>>>24]<<24^n[t>>16&255]<<16^n[t>>8&255]<<8^n[255&t],s%o==0&&(t=t<<8^t>>>24^l<<24,l=l<<1^283*(l>>7))),f[s]=f[s-o]^t}for(let t=0;s;t++,s--){const e=f[3&t?s:s-4];c[t]=4>=s||4>t?e:i[0][n[e>>>24]]^i[1][n[e>>16&255]]^i[2][n[e>>8&255]]^i[3][n[255&e]]}}encrypt(t){return this.F(t,0)}decrypt(t){return this.F(t,1)}j(){const t=this.T[0],e=this.T[1],n=t[4],r=e[4],i=[],o=[];let s,f,c,l;for(let t=0;256>t;t++)o[(i[t]=t<<1^283*(t>>7))^t]=t;for(let u=s=0;!n[u];u^=f||1,s=o[s]||1){let o=s^s<<1^s<<2^s<<3^s<<4;o=o>>8^255&o^99,n[u]=o,r[o]=u,l=i[c=i[f=i[u]]];let a=16843009*l^65537*c^257*f^16843008*u,w=257*i[o]^16843008*o;for(let n=0;4>n;n++)t[n][u]=w=w<<24^w>>>8,e[n][o]=a=a<<24^a>>>8}for(let n=0;5>n;n++)t[n]=t[n].slice(0),e[n]=e[n].slice(0)}F(t,e){if(4!==t.length)throw new r("invalid aes block size");const n=this.B[e],i=n.length/4-2,o=[0,0,0,0],s=this.T[e],f=s[0],c=s[1],l=s[2],u=s[3],a=s[4];let w,h,d,p=t[0]^n[0],y=t[e?3:1]^n[1],b=t[2]^n[2],k=t[e?1:3]^n[3],g=4;for(let t=0;i>t;t++)w=f[p>>>24]^c[y>>16&255]^l[b>>8&255]^u[255&k]^n[g],h=f[y>>>24]^c[b>>16&255]^l[k>>8&255]^u[255&p]^n[g+1],d=f[b>>>24]^c[k>>16&255]^l[p>>8&255]^u[255&y]^n[g+2],k=f[k>>>24]^c[p>>16&255]^l[y>>8&255]^u[255&b]^n[g+3],g+=4,p=w,y=h,b=d;for(let t=0;4>t;t++)o[e?3&-t:t]=a[p>>>24]<<24^a[y>>16&255]<<16^a[b>>8&255]<<8^a[255&k]^n[g++],w=p,p=y,y=b,b=k,k=w;return o}},E=class{constructor(t,e){this.O=t,this.W=e,this.q=e}reset(){this.q=this.W}update(t){return this.G(this.O,t,this.q)}J(t){if(255==(t>>24&255)){let e=t>>16&255,n=t>>8&255,r=255&t;255===e?(e=0,255===n?(n=0,255===r?r=0:++r):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=r}else t+=1<<24;return t}N(t){0===(t[0]=this.J(t[0]))&&(t[1]=this.J(t[1]))}G(t,e,n){let r;if(!(r=e.length))return[];const i=d.l(e);for(let i=0;r>i;i+=4){this.N(n);const r=t.encrypt(n);e[i]^=r[0],e[i+1]^=r[1],e[i+2]^=r[2],e[i+3]^=r[3]}return d.u(e,i)}},D=k.M;class U{constructor(t,n,r){e.assign(this,{password:t,signed:n,X:r-1,Y:new i(0)})}async append(e){const n=this;if(n.password){const i=K(e,0,z[n.X]+2);await(async(t,e,n)=>{await R(t,n,K(e,0,z[t.X]));const i=K(e,z[t.X]),o=t.keys.passwordVerification;if(o[0]!=i[0]||o[1]!=i[1])throw new r("Invalid pasword")})(n,i,n.password),n.password=null,n.Z=new E(new B(n.keys.key),t.from(I)),n.$=new D(n.keys.tt),e=K(e,z[n.X]+2)}return P(n,e,new i(e.length-10-(e.length-10)%16),0,10,!0)}flush(){const t=this,e=t.Y,n=K(e,0,e.length-10),r=K(e,e.length-10);let o=new i(0);if(n.length){const e=V.g(n);t.$.update(e);const r=t.Z.update(e);o=V.k(r)}let s=!0;if(t.signed){const e=K(V.k(t.$.digest()),0,10);for(let t=0;10>t;t++)e[t]!=r[t]&&(s=!1)}return{valid:s,data:o}}}class M{constructor(t,n){e.assign(this,{password:t,X:n-1,Y:new i(0)})}async append(e){const n=this;let r=new i(0);n.password&&(r=await(async(t,e)=>{const n=(r=new i(z[t.X]),A&&"function"==typeof u.getRandomValues?u.getRandomValues(r):b.getRandomValues(r));var r;return await R(t,e,n),H(n,t.keys.passwordVerification)})(n,n.password),n.password=null,n.Z=new E(new B(n.keys.key),t.from(I)),n.$=new D(n.keys.tt));const o=new i(r.length+e.length-e.length%16);return o.set(r,0),P(n,e,o,r.length,0)}flush(){const t=this;let e=new i(0);if(t.Y.length){const n=t.Z.update(V.g(t.Y));t.$.update(n),e=V.k(n)}const n=K(V.k(t.$.digest()),0,10);return{data:H(e,n),signature:n}}}function P(t,e,n,r,o,s){const f=e.length-o;let c;for(t.Y.length&&(e=H(t.Y,e),n=((t,e)=>{if(e&&e>t.length){const n=t;(t=new i(e)).set(n,0)}return t})(n,f-f%16)),c=0;f-16>=c;c+=16){const i=V.g(K(e,c,c+16));s&&t.$.update(i);const o=t.Z.update(i);s||t.$.update(o),n.set(V.k(o),c+r)}return t.Y=K(e,c),n}async function R(t,n,r){const o=(t=>{if(void 0===l){const e=new i((t=unescape(encodeURIComponent(t))).length);for(let n=0;n<e.length;n++)e[n]=t.charCodeAt(n);return e}return(new l).encode(t)})(n),s=await((t,e,n,r,i)=>A&&C&&"function"==typeof u.subtle.importKey?u.subtle.importKey("raw",e,n,!1,i):k.importKey(e))(0,o,v,0,S),f=await(async(t,e,n)=>A&&C&&"function"==typeof u.subtle.deriveBits?await u.subtle.deriveBits(t,e,n):k.P(e,t.salt,m.iterations,n))(e.assign({salt:r},m),s,8*(2*_[t.X]+2)),c=new i(f);t.keys={key:V.g(K(c,0,_[t.X])),tt:V.g(K(c,_[t.X],2*_[t.X])),passwordVerification:K(c,2*_[t.X])}}function H(t,e){let n=t;return t.length+e.length&&(n=new i(t.length+e.length),n.set(t,0),n.set(e,t.length)),n}function K(t,e,n){return t.subarray(e,n)}class L{constructor(t,n){e.assign(this,{password:t,passwordVerification:n}),F(this,t)}append(t){const e=this;if(e.password){const n=j(e,t.subarray(0,12));if(e.password=null,n[11]!=e.passwordVerification)throw new r("Invalid pasword");t=t.subarray(12)}return j(e,t)}flush(){return{valid:!0,data:new i(0)}}}class T{constructor(t,n){e.assign(this,{password:t,passwordVerification:n}),F(this,t)}append(t){const e=this;let n,r;if(e.password){e.password=null;const o=u.getRandomValues(new i(12));o[11]=e.passwordVerification,n=new i(t.length+o.length),n.set(x(e,o),0),r=12}else n=new i(t.length),r=0;return n.set(x(e,t),r),n}flush(){return{data:new i(0)}}}function j(t,e){const n=new i(e.length);for(let r=0;r<e.length;r++)n[r]=W(t)^e[r],O(t,n[r]);return n}function x(t,e){const n=new i(e.length);for(let r=0;r<e.length;r++)n[r]=W(t)^e[r],O(t,e[r]);return n}function F(t,e){t.keys=[305419896,591751049,878082192],t.et=new h(t.keys[0]),t.nt=new h(t.keys[2]);for(let n=0;n<e.length;n++)O(t,e.charCodeAt(n))}function O(t,e){t.et.append([e]),t.keys[0]=~t.et.get(),t.keys[1]=G(t.keys[1]+q(t.keys[0])),t.keys[1]=G(n.imul(t.keys[1],134775813)+1),t.nt.append([t.keys[1]>>>24]),t.keys[2]=~t.nt.get()}function W(t){const e=2|t.keys[2];return q(n.imul(e,1^e)>>>8)}function q(t){return 255&t}function G(t){return 4294967295&t}class J{constructor(t,{signature:n,password:r,signed:i,compressed:o,zipCrypto:s,passwordVerification:f,encryptionStrength:c},{rt:l}){const u=!!r;e.assign(this,{signature:n,encrypted:u,signed:i,compressed:o,it:o&&new t({rt:l}),ot:i&&new h,zipCrypto:s,decrypt:u&&s?new L(r,f):new U(r,i,c)})}async append(t){const e=this;return e.encrypted&&t.length&&(t=await e.decrypt.append(t)),e.compressed&&t.length&&(t=await e.it.append(t)),(!e.encrypted||e.zipCrypto)&&e.signed&&t.length&&e.ot.append(t),t}async flush(){const t=this;let e,n=new i(0);if(t.encrypted){const e=t.decrypt.flush();if(!e.valid)throw new r("Invalid signature");n=e.data}if((!t.encrypted||t.zipCrypto)&&t.signed){const n=new c(new i(4).buffer);if(e=t.ot.get(),n.setUint32(0,e),t.signature!=n.getUint32(0,!1))throw new r("Invalid signature")}return t.compressed&&(n=await t.it.append(n)||new i(0),await t.it.flush()),{data:n,signature:e}}}class N{constructor(t,{encrypted:n,signed:r,compressed:i,level:o,zipCrypto:s,password:f,passwordVerification:c,encryptionStrength:l},{rt:u}){e.assign(this,{encrypted:n,signed:r,compressed:i,st:i&&new t({level:o||5,rt:u}),ot:r&&new h,zipCrypto:s,encrypt:n&&s?new T(f,c):new M(f,l)})}async append(t){const e=this;let n=t;return e.compressed&&t.length&&(n=await e.st.append(t)),e.encrypted&&n.length&&(n=await e.encrypt.append(n)),(!e.encrypted||e.zipCrypto)&&e.signed&&t.length&&e.ot.append(t),n}async flush(){const t=this;let e,n=new i(0);if(t.compressed&&(n=await t.st.flush()||new i(0)),t.encrypted){n=await t.encrypt.append(n);const r=t.encrypt.flush();e=r.signature;const o=new i(n.length+r.data.length);o.set(n,0),o.set(r.data,n.length),n=o}return t.encrypted&&!t.zipCrypto||!t.signed||(e=t.ot.get()),{data:n,signature:e}}}const Q={init(t){t.scripts&&t.scripts.length&&importScripts.apply(void 0,t.scripts);const e=t.options;let n;self.initCodec&&self.initCodec(),e.codecType.startsWith("deflate")?n=self.Deflate:e.codecType.startsWith("inflate")&&(n=self.Inflate),X=((t,e,n)=>e.codecType.startsWith("deflate")?new N(t,e,n):e.codecType.startsWith("inflate")?new J(t,e,n):void 0)(n,e,t.config)},append:async t=>({data:await X.append(t.data)}),flush:()=>X.flush()};let X;function Y(e){return Z(e.map((([e,n])=>new t(e).fill(n,0,e))))}function Z(e){return e.reduce(((e,n)=>e.concat(t.isArray(n)?Z(n):n)),[])}addEventListener("message",(async t=>{const e=t.data,n=e.type,r=Q[n];if(r)try{e.data&&(e.data=new i(e.data));const t=await r(e)||{};if(t.type=n,t.data)try{t.data=t.data.buffer,a(t,[t.data])}catch(e){a(t)}else a(t)}catch(t){a({type:n,error:{message:t.message,stack:t.stack}})}}));const $=[0,1,2,3].concat(...Y([[2,4],[2,5],[4,6],[4,7],[8,8],[8,9],[16,10],[16,11],[32,12],[32,13],[64,14],[64,15],[2,0],[1,16],[1,17],[2,18],[2,19],[4,20],[4,21],[8,22],[8,23],[16,24],[16,25],[32,26],[32,27],[64,28],[64,29]]));function tt(){const t=this;function e(t,e){let n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1}t.ft=r=>{const i=t.ct,o=t.ut.lt,s=t.ut.wt;let f,c,l,u=-1;for(r.ht=0,r.dt=573,f=0;s>f;f++)0!==i[2*f]?(r.yt[++r.ht]=u=f,r.bt[f]=0):i[2*f+1]=0;for(;2>r.ht;)l=r.yt[++r.ht]=2>u?++u:0,i[2*l]=1,r.bt[l]=0,r.kt--,o&&(r.gt-=o[2*l+1]);for(t.vt=u,f=n.floor(r.ht/2);f>=1;f--)r.St(i,f);l=s;do{f=r.yt[1],r.yt[1]=r.yt[r.ht--],r.St(i,1),c=r.yt[1],r.yt[--r.dt]=f,r.yt[--r.dt]=c,i[2*l]=i[2*f]+i[2*c],r.bt[l]=n.max(r.bt[f],r.bt[c])+1,i[2*f+1]=i[2*c+1]=l,r.yt[1]=l++,r.St(i,1)}while(r.ht>=2);r.yt[--r.dt]=r.yt[1],(e=>{const n=t.ct,r=t.ut.lt,i=t.ut.zt,o=t.ut._t,s=t.ut.It;let f,c,l,u,a,w,h=0;for(u=0;15>=u;u++)e.At[u]=0;for(n[2*e.yt[e.dt]+1]=0,f=e.dt+1;573>f;f++)c=e.yt[f],u=n[2*n[2*c+1]+1]+1,u>s&&(u=s,h++),n[2*c+1]=u,c>t.vt||(e.At[u]++,a=0,o>c||(a=i[c-o]),w=n[2*c],e.kt+=w*(u+a),r&&(e.gt+=w*(r[2*c+1]+a)));if(0!==h){do{for(u=s-1;0===e.At[u];)u--;e.At[u]--,e.At[u+1]+=2,e.At[s]--,h-=2}while(h>0);for(u=s;0!==u;u--)for(c=e.At[u];0!==c;)l=e.yt[--f],l>t.vt||(n[2*l+1]!=u&&(e.kt+=(u-n[2*l+1])*n[2*l],n[2*l+1]=u),c--)}})(r),((t,n,r)=>{const i=[];let o,s,f,c=0;for(o=1;15>=o;o++)i[o]=c=c+r[o-1]<<1;for(s=0;n>=s;s++)f=t[2*s+1],0!==f&&(t[2*s]=e(i[f]++,f))})(i,t.vt,r.At)}}function et(t,e,n,r,i){const o=this;o.lt=t,o.zt=e,o._t=n,o.wt=r,o.It=i}tt.Ct=[0,1,2,3,4,5,6,7].concat(...Y([[2,8],[2,9],[2,10],[2,11],[4,12],[4,13],[4,14],[4,15],[8,16],[8,17],[8,18],[8,19],[16,20],[16,21],[16,22],[16,23],[32,24],[32,25],[32,26],[31,27],[1,28]])),tt.Vt=[0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0],tt.Bt=[0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576],tt.Et=t=>256>t?$[t]:$[256+(t>>>7)],tt.Dt=[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],tt.Ut=[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],tt.Mt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],tt.Pt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];const nt=Y([[144,8],[112,9],[24,7],[8,8]]);et.Rt=Z([12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,19,275,147,403,83,339,211,467,51,307,179,435,115,371,243,499,11,267,139,395,75,331,203,459,43,299,171,427,107,363,235,491,27,283,155,411,91,347,219,475,59,315,187,443,123,379,251,507,7,263,135,391,71,327,199,455,39,295,167,423,103,359,231,487,23,279,151,407,87,343,215,471,55,311,183,439,119,375,247,503,15,271,143,399,79,335,207,463,47,303,175,431,111,367,239,495,31,287,159,415,95,351,223,479,63,319,191,447,127,383,255,511,0,64,32,96,16,80,48,112,8,72,40,104,24,88,56,120,4,68,36,100,20,84,52,116,3,131,67,195,35,163,99,227].map(((t,e)=>[t,nt[e]])));const rt=Y([[30,5]]);function it(t,e,n,r,i){const o=this;o.Ht=t,o.Kt=e,o.Lt=n,o.Tt=r,o.jt=i}et.xt=Z([0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23].map(((t,e)=>[t,rt[e]]))),et.Ft=new et(et.Rt,tt.Dt,257,286,15),et.Ot=new et(et.xt,tt.Ut,0,30,15),et.Wt=new et(null,tt.Mt,0,19,7);const ot=[new it(0,0,0,0,0),new it(4,4,8,4,1),new it(4,5,16,8,1),new it(4,6,32,32,1),new it(4,4,16,16,2),new it(8,16,32,32,2),new it(8,16,128,128,2),new it(8,32,128,256,2),new it(32,128,258,1024,2),new it(32,258,258,4096,2)],st=["need dictionary","stream end","","","stream error","data error","","buffer error","",""];function ft(t,e,n,r){const i=t[2*e],o=t[2*n];return o>i||i==o&&r[e]<=r[n]}function ct(){const t=this;let e,r,s,f,c,l,u,a,w,h,d,p,y,b,k,g,v,m,S,z,_,I,A,C,V,B,E,D,U,M,P,R,H;const K=new tt,L=new tt,T=new tt;let j,x,F,O,W,q;function G(){let e;for(e=0;286>e;e++)P[2*e]=0;for(e=0;30>e;e++)R[2*e]=0;for(e=0;19>e;e++)H[2*e]=0;P[512]=1,t.kt=t.gt=0,x=F=0}function J(t,e){let n,r=-1,i=t[1],o=0,s=7,f=4;0===i&&(s=138,f=3),t[2*(e+1)+1]=65535;for(let c=0;e>=c;c++)n=i,i=t[2*(c+1)+1],++o<s&&n==i||(f>o?H[2*n]+=o:0!==n?(n!=r&&H[2*n]++,H[32]++):o>10?H[36]++:H[34]++,o=0,r=n,0===i?(s=138,f=3):n==i?(s=6,f=3):(s=7,f=4))}function N(e){t.qt[t.pending++]=e}function Q(t){N(255&t),N(t>>>8&255)}function X(t,e){let n;const r=e;q>16-r?(n=t,W|=n<<q&65535,Q(W),W=n>>>16-q,q+=r-16):(W|=t<<q&65535,q+=r)}function Y(t,e){const n=2*t;X(65535&e[n],65535&e[n+1])}function Z(t,e){let n,r,i=-1,o=t[1],s=0,f=7,c=4;for(0===o&&(f=138,c=3),n=0;e>=n;n++)if(r=o,o=t[2*(n+1)+1],++s>=f||r!=o){if(c>s)do{Y(r,H)}while(0!=--s);else 0!==r?(r!=i&&(Y(r,H),s--),Y(16,H),X(s-3,2)):s>10?(Y(18,H),X(s-11,7)):(Y(17,H),X(s-3,3));s=0,i=r,0===o?(f=138,c=3):r==o?(f=6,c=3):(f=7,c=4)}}function $(){16==q?(Q(W),W=0,q=0):8>q||(N(255&W),W>>>=8,q-=8)}function nt(e,r){let i,o,s;if(t.Gt[x]=e,t.Jt[x]=255&r,x++,0===e?P[2*r]++:(F++,e--,P[2*(tt.Ct[r]+256+1)]++,R[2*tt.Et(e)]++),0==(8191&x)&&E>2){for(i=8*x,o=_-v,s=0;30>s;s++)i+=R[2*s]*(5+tt.Ut[s]);if(i>>>=3,F<n.floor(x/2)&&i<n.floor(o/2))return!0}return x==j-1}function rt(e,n){let r,i,o,s,f=0;if(0!==x)do{r=t.Gt[f],i=t.Jt[f],f++,0===r?Y(i,e):(o=tt.Ct[i],Y(o+256+1,e),s=tt.Dt[o],0!==s&&(i-=tt.Vt[o],X(i,s)),r--,o=tt.Et(r),Y(o,n),s=tt.Ut[o],0!==s&&(r-=tt.Bt[o],X(r,s)))}while(x>f);Y(256,e),O=e[513]}function it(){q>8?Q(W):q>0&&N(255&W),W=0,q=0}function ct(e,n,r){X(0+(r?1:0),3),((e,n)=>{it(),O=8,Q(n),Q(~n),t.qt.set(a.subarray(e,e+n),t.pending),t.pending+=n})(e,n)}function lt(n){((e,n,r)=>{let i,o,s=0;E>0?(K.ft(t),L.ft(t),s=(()=>{let e;for(J(P,K.vt),J(R,L.vt),T.ft(t),e=18;e>=3&&0===H[2*tt.Pt[e]+1];e--);return t.kt+=14+3*(e+1),e})(),i=t.kt+3+7>>>3,o=t.gt+3+7>>>3,o>i||(i=o)):i=o=n+5,n+4>i||-1==e?o==i?(X(2+(r?1:0),3),rt(et.Rt,et.xt)):(X(4+(r?1:0),3),((t,e,n)=>{let r;for(X(t-257,5),X(e-1,5),X(n-4,4),r=0;n>r;r++)X(H[2*tt.Pt[r]+1],3);Z(P,t-1),Z(R,e-1)})(K.vt+1,L.vt+1,s+1),rt(P,R)):ct(e,n,r),G(),r&&it()})(0>v?-1:v,_-v,n),v=_,e.Nt()}function ut(){let t,n,r,i;do{if(i=w-A-_,0===i&&0===_&&0===A)i=c;else if(-1==i)i--;else if(_>=c+c-262){a.set(a.subarray(c,c+c),0),I-=c,_-=c,v-=c,t=y,r=t;do{n=65535&d[--r],d[r]=c>n?0:n-c}while(0!=--t);t=c,r=t;do{n=65535&h[--r],h[r]=c>n?0:n-c}while(0!=--t);i+=c}if(0===e.Qt)return;t=e.Xt(a,_+A,i),A+=t,3>A||(p=255&a[