diff --git a/assets/index-CHh154RQ.js b/assets/index-BdGFFqMJ.js similarity index 86% rename from assets/index-CHh154RQ.js rename to assets/index-BdGFFqMJ.js index 9ec5e9a..c9a6991 100644 --- a/assets/index-CHh154RQ.js +++ b/assets/index-BdGFFqMJ.js @@ -184,7 +184,7 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(e,t){(function(n){e.exports=n()})(function(){return function n(r,i,o){function a(u,d){if(!i[u]){if(!r[u]){var v=typeof _o=="function"&&_o;if(!d&&v)return v(u,!0);if(s)return s(u,!0);var g=new Error("Cannot find module '"+u+"'");throw g.code="MODULE_NOT_FOUND",g}var f=i[u]={exports:{}};r[u][0].call(f.exports,function(_){var p=r[u][1][_];return a(p||_)},f,f.exports,n,r,i,o)}return i[u].exports}for(var s=typeof _o=="function"&&_o,l=0;l>2,f=(3&u)<<4|d>>4,_=1>6:64,p=2>4,d=(15&g)<<4|(f=s.indexOf(l.charAt(p++)))>>2,v=(3&f)<<6|(_=s.indexOf(l.charAt(p++))),h[x++]=u,f!==64&&(h[x++]=d),_!==64&&(h[x++]=v);return h}},{"./support":30,"./utils":32}],2:[function(n,r,i){var o=n("./external"),a=n("./stream/DataWorker"),s=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(d,v,g,f,_){this.compressedSize=d,this.uncompressedSize=v,this.crc32=g,this.compression=f,this.compressedContent=_}u.prototype={getContentWorker:function(){var d=new a(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),v=this;return d.on("end",function(){if(this.streamInfo.data_length!==v.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new a(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,v,g){return d.pipe(new s).pipe(new l("uncompressedSize")).pipe(v.compressWorker(g)).pipe(new l("compressedSize")).withStreamInfo("compression",v)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,i){var o=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,i){var o=n("./utils"),a=function(){for(var s,l=[],u=0;u<256;u++){s=u;for(var d=0;d<8;d++)s=1&s?3988292384^s>>>1:s>>>1;l[u]=s}return l}();r.exports=function(s,l){return s!==void 0&&s.length?o.getTypeOf(s)!=="string"?function(u,d,v,g){var f=a,_=g+v;u^=-1;for(var p=g;p<_;p++)u=u>>>8^f[255&(u^d[p])];return-1^u}(0|l,s,s.length,0):function(u,d,v,g){var f=a,_=g+v;u^=-1;for(var p=g;p<_;p++)u=u>>>8^f[255&(u^d.charCodeAt(p))];return-1^u}(0|l,s,s.length,0):0}},{"./utils":32}],5:[function(n,r,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,r,i){var o=null;o=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:o}},{lie:37}],7:[function(n,r,i){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=n("pako"),s=n("./utils"),l=n("./stream/GenericWorker"),u=o?"uint8array":"array";function d(v,g){l.call(this,"FlateWorker/"+v),this._pako=null,this._pakoAction=v,this._pakoOptions=g,this.meta={}}i.magic="\b\0",s.inherits(d,l),d.prototype.processChunk=function(v){this.meta=v.meta,this._pako===null&&this._createPako(),this._pako.push(s.transformTo(u,v.data),!1)},d.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var v=this;this._pako.onData=function(g){v.push({data:g,meta:v.meta})}},i.compressWorker=function(v){return new d("Deflate",v)},i.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,i){function o(f,_){var p,x="";for(p=0;p<_;p++)x+=String.fromCharCode(255&f),f>>>=8;return x}function a(f,_,p,x,c,h){var y,k,S=f.file,T=f.compression,A=h!==u.utf8encode,z=s.transformTo("string",h(S.name)),R=s.transformTo("string",u.utf8encode(S.name)),N=S.comment,Z=s.transformTo("string",h(N)),E=s.transformTo("string",u.utf8encode(N)),B=R.length!==S.name.length,w=E.length!==N.length,U="",ne="",W="",$=S.dir,F=S.date,K={crc32:0,compressedSize:0,uncompressedSize:0};_&&!p||(K.crc32=f.crc32,K.compressedSize=f.compressedSize,K.uncompressedSize=f.uncompressedSize);var P=0;_&&(P|=8),A||!B&&!w||(P|=2048);var D=0,te=0;$&&(D|=16),c==="UNIX"?(te=798,D|=function(X,de){var Ce=X;return X||(Ce=de?16893:33204),(65535&Ce)<<16}(S.unixPermissions,$)):(te=20,D|=function(X){return 63&(X||0)}(S.dosPermissions)),y=F.getUTCHours(),y<<=6,y|=F.getUTCMinutes(),y<<=5,y|=F.getUTCSeconds()/2,k=F.getUTCFullYear()-1980,k<<=4,k|=F.getUTCMonth()+1,k<<=5,k|=F.getUTCDate(),B&&(ne=o(1,1)+o(d(z),4)+R,U+="up"+o(ne.length,2)+ne),w&&(W=o(1,1)+o(d(Z),4)+E,U+="uc"+o(W.length,2)+W);var q="";return q+=` -\0`,q+=o(P,2),q+=T.magic,q+=o(y,2),q+=o(k,2),q+=o(K.crc32,4),q+=o(K.compressedSize,4),q+=o(K.uncompressedSize,4),q+=o(z.length,2),q+=o(U.length,2),{fileRecord:v.LOCAL_FILE_HEADER+q+z+U,dirRecord:v.CENTRAL_FILE_HEADER+o(te,2)+q+o(Z.length,2)+"\0\0\0\0"+o(D,4)+o(x,4)+z+U+Z}}var s=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),v=n("../signature");function g(f,_,p,x){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=_,this.zipPlatform=p,this.encodeFileName=x,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(g,l),g.prototype.push=function(f){var _=f.meta.percent||0,p=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:p?(_+100*(p-x-1))/p:100}}))},g.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var _=this.streamFiles&&!f.file.dir;if(_){var p=a(f,_,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},g.prototype.closedSource=function(f){this.accumulate=!1;var _=this.streamFiles&&!f.file.dir,p=a(f,_,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),_)this.push({data:function(x){return v.DATA_DESCRIPTOR+o(x.crc32,4)+o(x.compressedSize,4)+o(x.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},g.prototype.flush=function(){for(var f=this.bytesWritten,_=0;_=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=s,u},readString:function(s){return o.transformTo("string",this.readData(s))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var s=this.readInt(4);return new Date(Date.UTC(1980+(s>>25&127),(s>>21&15)-1,s>>16&31,s>>11&31,s>>5&63,(31&s)<<1))}},r.exports=a},{"../utils":32}],19:[function(n,r,i){var o=n("./Uint8ArrayReader");function a(s){o.call(this,s)}n("../utils").inherits(a,o),a.prototype.readData=function(s){this.checkOffset(s);var l=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var o=n("./DataReader");function a(s){o.call(this,s)}n("../utils").inherits(a,o),a.prototype.byteAt=function(s){return this.data.charCodeAt(this.zero+s)},a.prototype.lastIndexOfSignature=function(s){return this.data.lastIndexOf(s)-this.zero},a.prototype.readAndCheckSignature=function(s){return s===this.readData(4)},a.prototype.readData=function(s){this.checkOffset(s);var l=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var o=n("./ArrayReader");function a(s){o.call(this,s)}n("../utils").inherits(a,o),a.prototype.readData=function(s){if(this.checkOffset(s),s===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var o=n("../utils"),a=n("../support"),s=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(v){var g=o.getTypeOf(v);return o.checkSupport(g),g!=="string"||a.uint8array?g==="nodebuffer"?new u(v):a.uint8array?new d(o.transformTo("uint8array",v)):new s(o.transformTo("array",v)):new l(v)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var o=n("./GenericWorker"),a=n("../utils");function s(l){o.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(s,o),s.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},r.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var o=n("./GenericWorker"),a=n("../crc32");function s(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(s,o),s.prototype.processChunk=function(l){this.streamInfo.crc32=a(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var o=n("../utils"),a=n("./GenericWorker");function s(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}o.inherits(s,a),s.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}a.prototype.processChunk.call(this,l)},r.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var o=n("../utils"),a=n("./GenericWorker");function s(l){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(s,a),s.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function o(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,s){return this._listeners[a].push(s),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,s){if(this._listeners[a])for(var l=0;l "+a:a}},r.exports=o},{}],29:[function(n,r,i){var o=n("../utils"),a=n("./ConvertWorker"),s=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),v=null;if(u.nodestream)try{v=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function g(_,p){return new d.Promise(function(x,c){var h=[],y=_._internalType,k=_._outputType,S=_._mimeType;_.on("data",function(T,A){h.push(T),p&&p(A)}).on("error",function(T){h=[],c(T)}).on("end",function(){try{var T=function(A,z,R){switch(A){case"blob":return o.newBlob(o.transformTo("arraybuffer",z),R);case"base64":return l.encode(z);default:return o.transformTo(A,z)}}(k,function(A,z){var R,N=0,Z=null,E=0;for(R=0;R"u")i.blob=!1;else{var o=new ArrayBuffer(0);try{i.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(o),i.blob=a.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var o=n("./utils"),a=n("./support"),s=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function v(){l.call(this,"utf-8 decode"),this.leftOver=null}function g(){l.call(this,"utf-8 encode")}i.utf8encode=function(f){return a.nodebuffer?s.newBufferFrom(f,"utf-8"):function(_){var p,x,c,h,y,k=_.length,S=0;for(h=0;h>>6:(x<65536?p[y++]=224|x>>>12:(p[y++]=240|x>>>18,p[y++]=128|x>>>12&63),p[y++]=128|x>>>6&63),p[y++]=128|63&x);return p}(f)},i.utf8decode=function(f){return a.nodebuffer?o.transformTo("nodebuffer",f).toString("utf-8"):function(_){var p,x,c,h,y=_.length,k=new Array(2*y);for(p=x=0;p>10&1023,k[x++]=56320|1023&c)}return k.length!==x&&(k.subarray?k=k.subarray(0,x):k.length=x),o.applyFromCharCode(k)}(f=o.transformTo(a.uint8array?"uint8array":"array",f))},o.inherits(v,l),v.prototype.processChunk=function(f){var _=o.transformTo(a.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var p=_;(_=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),_.set(p,this.leftOver.length)}else _=this.leftOver.concat(_);this.leftOver=null}var x=function(h,y){var k;for((y=y||h.length)>h.length&&(y=h.length),k=y-1;0<=k&&(192&h[k])==128;)k--;return k<0||k===0?y:k+u[h[k]]>y?k:y}(_),c=_;x!==_.length&&(a.uint8array?(c=_.subarray(0,x),this.leftOver=_.subarray(x,_.length)):(c=_.slice(0,x),this.leftOver=_.slice(x,_.length))),this.push({data:i.utf8decode(c),meta:f.meta})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=v,o.inherits(g,l),g.prototype.processChunk=function(f){this.push({data:i.utf8encode(f.data),meta:f.meta})},i.Utf8EncodeWorker=g},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var o=n("./support"),a=n("./base64"),s=n("./nodejsUtils"),l=n("./external");function u(p){return p}function d(p,x){for(var c=0;c>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=o(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var _,p,x,c=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4>>6:(f<65536?g[x++]=224|f>>>12:(g[x++]=240|f>>>18,g[x++]=128|f>>>12&63),g[x++]=128|f>>>6&63),g[x++]=128|63&f);return g},i.buf2binstring=function(v){return d(v,v.length)},i.binstring2buf=function(v){for(var g=new o.Buf8(v.length),f=0,_=g.length;f<_;f++)g[f]=v.charCodeAt(f);return g},i.buf2string=function(v,g){var f,_,p,x,c=g||v.length,h=new Array(2*c);for(f=_=0;f>10&1023,h[_++]=56320|1023&p)}return d(h,_)},i.utf8border=function(v,g){var f;for((g=g||v.length)>v.length&&(g=v.length),f=g-1;0<=f&&(192&v[f])==128;)f--;return f<0||f===0?g:f+l[v[f]]>g?f:g}},{"./common":41}],43:[function(n,r,i){r.exports=function(o,a,s,l){for(var u=65535&o|0,d=o>>>16&65535|0,v=0;s!==0;){for(s-=v=2e3>>1:a>>>1;s[l]=a}return s}();r.exports=function(a,s,l,u){var d=o,v=u+l;a^=-1;for(var g=u;g>>8^d[255&(a^s[g])];return-1^a}},{}],46:[function(n,r,i){var o,a=n("../utils/common"),s=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),v=0,g=4,f=0,_=-2,p=-1,x=4,c=2,h=8,y=9,k=286,S=30,T=19,A=2*k+1,z=15,R=3,N=258,Z=N+R+1,E=42,B=113,w=1,U=2,ne=3,W=4;function $(m,j){return m.msg=d[j],j}function F(m){return(m<<1)-(4m.avail_out&&(M=m.avail_out),M!==0&&(a.arraySet(m.output,j.pending_buf,j.pending_out,M,m.next_out),m.next_out+=M,j.pending_out+=M,m.total_out+=M,m.avail_out-=M,j.pending-=M,j.pending===0&&(j.pending_out=0))}function D(m,j){s._tr_flush_block(m,0<=m.block_start?m.block_start:-1,m.strstart-m.block_start,j),m.block_start=m.strstart,P(m.strm)}function te(m,j){m.pending_buf[m.pending++]=j}function q(m,j){m.pending_buf[m.pending++]=j>>>8&255,m.pending_buf[m.pending++]=255&j}function X(m,j){var M,C,b=m.max_chain_length,I=m.strstart,H=m.prev_length,V=m.nice_match,L=m.strstart>m.w_size-Z?m.strstart-(m.w_size-Z):0,Q=m.window,J=m.w_mask,Y=m.prev,re=m.strstart+N,pe=Q[I+H-1],le=Q[I+H];m.prev_length>=m.good_match&&(b>>=2),V>m.lookahead&&(V=m.lookahead);do if(Q[(M=j)+H]===le&&Q[M+H-1]===pe&&Q[M]===Q[I]&&Q[++M]===Q[I+1]){I+=2,M++;do;while(Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&IL&&--b!=0);return H<=m.lookahead?H:m.lookahead}function de(m){var j,M,C,b,I,H,V,L,Q,J,Y=m.w_size;do{if(b=m.window_size-m.lookahead-m.strstart,m.strstart>=Y+(Y-Z)){for(a.arraySet(m.window,m.window,Y,Y,0),m.match_start-=Y,m.strstart-=Y,m.block_start-=Y,j=M=m.hash_size;C=m.head[--j],m.head[j]=Y<=C?C-Y:0,--M;);for(j=M=Y;C=m.prev[--j],m.prev[j]=Y<=C?C-Y:0,--M;);b+=Y}if(m.strm.avail_in===0)break;if(H=m.strm,V=m.window,L=m.strstart+m.lookahead,Q=b,J=void 0,J=H.avail_in,Q=R)for(I=m.strstart-m.insert,m.ins_h=m.window[I],m.ins_h=(m.ins_h<=R&&(m.ins_h=(m.ins_h<=R)if(C=s._tr_tally(m,m.strstart-m.match_start,m.match_length-R),m.lookahead-=m.match_length,m.match_length<=m.max_lazy_match&&m.lookahead>=R){for(m.match_length--;m.strstart++,m.ins_h=(m.ins_h<=R&&(m.ins_h=(m.ins_h<=R&&m.match_length<=m.prev_length){for(b=m.strstart+m.lookahead-R,C=s._tr_tally(m,m.strstart-1-m.prev_match,m.prev_length-R),m.lookahead-=m.prev_length-1,m.prev_length-=2;++m.strstart<=b&&(m.ins_h=(m.ins_h<m.pending_buf_size-5&&(M=m.pending_buf_size-5);;){if(m.lookahead<=1){if(de(m),m.lookahead===0&&j===v)return w;if(m.lookahead===0)break}m.strstart+=m.lookahead,m.lookahead=0;var C=m.block_start+M;if((m.strstart===0||m.strstart>=C)&&(m.lookahead=m.strstart-C,m.strstart=C,D(m,!1),m.strm.avail_out===0)||m.strstart-m.block_start>=m.w_size-Z&&(D(m,!1),m.strm.avail_out===0))return w}return m.insert=0,j===g?(D(m,!0),m.strm.avail_out===0?ne:W):(m.strstart>m.block_start&&(D(m,!1),m.strm.avail_out),w)}),new fe(4,4,8,4,Ce),new fe(4,5,16,8,Ce),new fe(4,6,32,32,Ce),new fe(4,4,16,16,se),new fe(8,16,32,32,se),new fe(8,16,128,128,se),new fe(8,32,128,256,se),new fe(32,128,258,1024,se),new fe(32,258,258,4096,se)],i.deflateInit=function(m,j){return kt(m,j,h,15,8,0)},i.deflateInit2=kt,i.deflateReset=It,i.deflateResetKeep=Ae,i.deflateSetHeader=function(m,j){return m&&m.state?m.state.wrap!==2?_:(m.state.gzhead=j,f):_},i.deflate=function(m,j){var M,C,b,I;if(!m||!m.state||5>8&255),te(C,C.gzhead.time>>16&255),te(C,C.gzhead.time>>24&255),te(C,C.level===9?2:2<=C.strategy||C.level<2?4:0),te(C,255&C.gzhead.os),C.gzhead.extra&&C.gzhead.extra.length&&(te(C,255&C.gzhead.extra.length),te(C,C.gzhead.extra.length>>8&255)),C.gzhead.hcrc&&(m.adler=u(m.adler,C.pending_buf,C.pending,0)),C.gzindex=0,C.status=69):(te(C,0),te(C,0),te(C,0),te(C,0),te(C,0),te(C,C.level===9?2:2<=C.strategy||C.level<2?4:0),te(C,3),C.status=B);else{var H=h+(C.w_bits-8<<4)<<8;H|=(2<=C.strategy||C.level<2?0:C.level<6?1:C.level===6?2:3)<<6,C.strstart!==0&&(H|=32),H+=31-H%31,C.status=B,q(C,H),C.strstart!==0&&(q(C,m.adler>>>16),q(C,65535&m.adler)),m.adler=1}if(C.status===69)if(C.gzhead.extra){for(b=C.pending;C.gzindex<(65535&C.gzhead.extra.length)&&(C.pending!==C.pending_buf_size||(C.gzhead.hcrc&&C.pending>b&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),P(m),b=C.pending,C.pending!==C.pending_buf_size));)te(C,255&C.gzhead.extra[C.gzindex]),C.gzindex++;C.gzhead.hcrc&&C.pending>b&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),C.gzindex===C.gzhead.extra.length&&(C.gzindex=0,C.status=73)}else C.status=73;if(C.status===73)if(C.gzhead.name){b=C.pending;do{if(C.pending===C.pending_buf_size&&(C.gzhead.hcrc&&C.pending>b&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),P(m),b=C.pending,C.pending===C.pending_buf_size)){I=1;break}I=C.gzindexb&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),I===0&&(C.gzindex=0,C.status=91)}else C.status=91;if(C.status===91)if(C.gzhead.comment){b=C.pending;do{if(C.pending===C.pending_buf_size&&(C.gzhead.hcrc&&C.pending>b&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),P(m),b=C.pending,C.pending===C.pending_buf_size)){I=1;break}I=C.gzindexb&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),I===0&&(C.status=103)}else C.status=103;if(C.status===103&&(C.gzhead.hcrc?(C.pending+2>C.pending_buf_size&&P(m),C.pending+2<=C.pending_buf_size&&(te(C,255&m.adler),te(C,m.adler>>8&255),m.adler=0,C.status=B)):C.status=B),C.pending!==0){if(P(m),m.avail_out===0)return C.last_flush=-1,f}else if(m.avail_in===0&&F(j)<=F(M)&&j!==g)return $(m,-5);if(C.status===666&&m.avail_in!==0)return $(m,-5);if(m.avail_in!==0||C.lookahead!==0||j!==v&&C.status!==666){var V=C.strategy===2?function(L,Q){for(var J;;){if(L.lookahead===0&&(de(L),L.lookahead===0)){if(Q===v)return w;break}if(L.match_length=0,J=s._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++,J&&(D(L,!1),L.strm.avail_out===0))return w}return L.insert=0,Q===g?(D(L,!0),L.strm.avail_out===0?ne:W):L.last_lit&&(D(L,!1),L.strm.avail_out===0)?w:U}(C,j):C.strategy===3?function(L,Q){for(var J,Y,re,pe,le=L.window;;){if(L.lookahead<=N){if(de(L),L.lookahead<=N&&Q===v)return w;if(L.lookahead===0)break}if(L.match_length=0,L.lookahead>=R&&0L.lookahead&&(L.match_length=L.lookahead)}if(L.match_length>=R?(J=s._tr_tally(L,1,L.match_length-R),L.lookahead-=L.match_length,L.strstart+=L.match_length,L.match_length=0):(J=s._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++),J&&(D(L,!1),L.strm.avail_out===0))return w}return L.insert=0,Q===g?(D(L,!0),L.strm.avail_out===0?ne:W):L.last_lit&&(D(L,!1),L.strm.avail_out===0)?w:U}(C,j):o[C.level].func(C,j);if(V!==ne&&V!==W||(C.status=666),V===w||V===ne)return m.avail_out===0&&(C.last_flush=-1),f;if(V===U&&(j===1?s._tr_align(C):j!==5&&(s._tr_stored_block(C,0,0,!1),j===3&&(K(C.head),C.lookahead===0&&(C.strstart=0,C.block_start=0,C.insert=0))),P(m),m.avail_out===0))return C.last_flush=-1,f}return j!==g?f:C.wrap<=0?1:(C.wrap===2?(te(C,255&m.adler),te(C,m.adler>>8&255),te(C,m.adler>>16&255),te(C,m.adler>>24&255),te(C,255&m.total_in),te(C,m.total_in>>8&255),te(C,m.total_in>>16&255),te(C,m.total_in>>24&255)):(q(C,m.adler>>>16),q(C,65535&m.adler)),P(m),0=M.w_size&&(I===0&&(K(M.head),M.strstart=0,M.block_start=0,M.insert=0),Q=new a.Buf8(M.w_size),a.arraySet(Q,j,J-M.w_size,M.w_size,0),j=Q,J=M.w_size),H=m.avail_in,V=m.next_in,L=m.input,m.avail_in=J,m.next_in=0,m.input=j,de(M);M.lookahead>=R;){for(C=M.strstart,b=M.lookahead-(R-1);M.ins_h=(M.ins_h<>>=R=z>>>24,y-=R,(R=z>>>16&255)===0)U[d++]=65535&z;else{if(!(16&R)){if(!(64&R)){z=k[(65535&z)+(h&(1<>>=R,y-=R),y<15&&(h+=w[l++]<>>=R=z>>>24,y-=R,!(16&(R=z>>>16&255))){if(!(64&R)){z=S[(65535&z)+(h&(1<>>=R,y-=R,(R=d-v)>3,h&=(1<<(y-=N<<3))-1,o.next_in=l,o.next_out=d,o.avail_in=l>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(E){var B;return E&&E.state?(B=E.state,E.total_in=E.total_out=B.total=0,E.msg="",B.wrap&&(E.adler=1&B.wrap),B.mode=_,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new o.Buf32(p),B.distcode=B.distdyn=new o.Buf32(x),B.sane=1,B.back=-1,g):f}function k(E){var B;return E&&E.state?((B=E.state).wsize=0,B.whave=0,B.wnext=0,y(E)):f}function S(E,B){var w,U;return E&&E.state?(U=E.state,B<0?(w=0,B=-B):(w=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=W.wsize?(o.arraySet(W.window,B,w-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(U<(ne=W.wsize-W.wnext)&&(ne=U),o.arraySet(W.window,B,w-U,ne,W.wnext),(U-=ne)?(o.arraySet(W.window,B,w-U,U,0),W.wnext=U,W.whave=W.wsize):(W.wnext+=ne,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,w.check=s(w.check,I,2,0),D=P=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&P)<<8)+(P>>8))%31){E.msg="incorrect header check",w.mode=30;break}if((15&P)!=8){E.msg="unknown compression method",w.mode=30;break}if(D-=4,m=8+(15&(P>>>=4)),w.wbits===0)w.wbits=m;else if(m>w.wbits){E.msg="invalid window size",w.mode=30;break}w.dmax=1<>8&1),512&w.flags&&(I[0]=255&P,I[1]=P>>>8&255,w.check=s(w.check,I,2,0)),D=P=0,w.mode=3;case 3:for(;D<32;){if(F===0)break e;F--,P+=U[W++]<>>8&255,I[2]=P>>>16&255,I[3]=P>>>24&255,w.check=s(w.check,I,4,0)),D=P=0,w.mode=4;case 4:for(;D<16;){if(F===0)break e;F--,P+=U[W++]<>8),512&w.flags&&(I[0]=255&P,I[1]=P>>>8&255,w.check=s(w.check,I,2,0)),D=P=0,w.mode=5;case 5:if(1024&w.flags){for(;D<16;){if(F===0)break e;F--,P+=U[W++]<>>8&255,w.check=s(w.check,I,2,0)),D=P=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(F<(X=w.length)&&(X=F),X&&(w.head&&(m=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),o.arraySet(w.head.extra,U,W,X,m)),512&w.flags&&(w.check=s(w.check,U,X,W)),F-=X,W+=X,w.length-=X),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(F===0)break e;for(X=0;m=U[W+X++],w.head&&m&&w.length<65536&&(w.head.name+=String.fromCharCode(m)),m&&X>9&1,w.head.done=!0),E.adler=w.check=0,w.mode=12;break;case 10:for(;D<32;){if(F===0)break e;F--,P+=U[W++]<>>=7&D,D-=7&D,w.mode=27;break}for(;D<3;){if(F===0)break e;F--,P+=U[W++]<>>=1)){case 0:w.mode=14;break;case 1:if(N(w),w.mode=20,B!==6)break;P>>>=2,D-=2;break e;case 2:w.mode=17;break;case 3:E.msg="invalid block type",w.mode=30}P>>>=2,D-=2;break;case 14:for(P>>>=7&D,D-=7&D;D<32;){if(F===0)break e;F--,P+=U[W++]<>>16^65535)){E.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&P,D=P=0,w.mode=15,B===6)break e;case 15:w.mode=16;case 16:if(X=w.length){if(F>>=5,D-=5,w.ndist=1+(31&P),P>>>=5,D-=5,w.ncode=4+(15&P),P>>>=4,D-=4,286>>=3,D-=3}for(;w.have<19;)w.lens[H[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,M={bits:w.lenbits},j=u(0,w.lens,0,19,w.lencode,0,w.work,M),w.lenbits=M.bits,j){E.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have>>16&255,De=65535&b,!((se=b>>>24)<=D);){if(F===0)break e;F--,P+=U[W++]<>>=se,D-=se,w.lens[w.have++]=De;else{if(De===16){for(C=se+2;D>>=se,D-=se,w.have===0){E.msg="invalid bit length repeat",w.mode=30;break}m=w.lens[w.have-1],X=3+(3&P),P>>>=2,D-=2}else if(De===17){for(C=se+3;D>>=se)),P>>>=3,D-=3}else{for(C=se+7;D>>=se)),P>>>=7,D-=7}if(w.have+X>w.nlen+w.ndist){E.msg="invalid bit length repeat",w.mode=30;break}for(;X--;)w.lens[w.have++]=m}}if(w.mode===30)break;if(w.lens[256]===0){E.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,M={bits:w.lenbits},j=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,M),w.lenbits=M.bits,j){E.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,M={bits:w.distbits},j=u(v,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,M),w.distbits=M.bits,j){E.msg="invalid distances set",w.mode=30;break}if(w.mode=20,B===6)break e;case 20:w.mode=21;case 21:if(6<=F&&258<=K){E.next_out=$,E.avail_out=K,E.next_in=W,E.avail_in=F,w.hold=P,w.bits=D,l(E,q),$=E.next_out,ne=E.output,K=E.avail_out,W=E.next_in,U=E.input,F=E.avail_in,P=w.hold,D=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;fe=(b=w.lencode[P&(1<>>16&255,De=65535&b,!((se=b>>>24)<=D);){if(F===0)break e;F--,P+=U[W++]<>Ae)])>>>16&255,De=65535&b,!(Ae+(se=b>>>24)<=D);){if(F===0)break e;F--,P+=U[W++]<>>=Ae,D-=Ae,w.back+=Ae}if(P>>>=se,D-=se,w.back+=se,w.length=De,fe===0){w.mode=26;break}if(32&fe){w.back=-1,w.mode=12;break}if(64&fe){E.msg="invalid literal/length code",w.mode=30;break}w.extra=15&fe,w.mode=22;case 22:if(w.extra){for(C=w.extra;D>>=w.extra,D-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;fe=(b=w.distcode[P&(1<>>16&255,De=65535&b,!((se=b>>>24)<=D);){if(F===0)break e;F--,P+=U[W++]<>Ae)])>>>16&255,De=65535&b,!(Ae+(se=b>>>24)<=D);){if(F===0)break e;F--,P+=U[W++]<>>=Ae,D-=Ae,w.back+=Ae}if(P>>>=se,D-=se,w.back+=se,64&fe){E.msg="invalid distance code",w.mode=30;break}w.offset=De,w.extra=15&fe,w.mode=24;case 24:if(w.extra){for(C=w.extra;D>>=w.extra,D-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){E.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(K===0)break e;if(X=q-K,w.offset>X){if((X=w.offset-X)>w.whave&&w.sane){E.msg="invalid distance too far back",w.mode=30;break}de=X>w.wnext?(X-=w.wnext,w.wsize-X):w.wnext-X,X>w.length&&(X=w.length),Ce=w.window}else Ce=ne,de=$-w.offset,X=w.length;for(KA?(R=de[Ce+x[B]],D[te+x[B]]):(R=96,0),h=1<>$)+(y-=h)]=z<<24|R<<16|N|0,y!==0;);for(h=1<>=1;if(h!==0?(P&=h-1,P+=h):P=0,B++,--q[E]==0){if(E===U)break;E=v[g+x[B]]}if(ne>>7)]}function te(b,I){b.pending_buf[b.pending++]=255&I,b.pending_buf[b.pending++]=I>>>8&255}function q(b,I,H){b.bi_valid>c-H?(b.bi_buf|=I<>c-b.bi_valid,b.bi_valid+=H-c):(b.bi_buf|=I<>>=1,H<<=1,0<--I;);return H>>>1}function Ce(b,I,H){var V,L,Q=new Array(x+1),J=0;for(V=1;V<=x;V++)Q[V]=J=J+H[V-1]<<1;for(L=0;L<=I;L++){var Y=b[2*L+1];Y!==0&&(b[2*L]=de(Q[Y]++,Y))}}function se(b){var I;for(I=0;I>1;1<=H;H--)Ae(b,Q,H);for(L=re;H=b.heap[1],b.heap[1]=b.heap[b.heap_len--],Ae(b,Q,1),V=b.heap[1],b.heap[--b.heap_max]=H,b.heap[--b.heap_max]=V,Q[2*L]=Q[2*H]+Q[2*V],b.depth[L]=(b.depth[H]>=b.depth[V]?b.depth[H]:b.depth[V])+1,Q[2*H+1]=Q[2*V+1]=L,b.heap[1]=L++,Ae(b,Q,1),2<=b.heap_len;);b.heap[--b.heap_max]=b.heap[1],function(le,ht){var Mr,Nt,Br,Te,Yi,Ia,$t=ht.dyn_tree,Cu=ht.max_code,Lp=ht.stat_desc.static_tree,Op=ht.stat_desc.has_stree,Fp=ht.stat_desc.extra_bits,Au=ht.stat_desc.extra_base,Ur=ht.stat_desc.max_length,Xi=0;for(Te=0;Te<=x;Te++)le.bl_count[Te]=0;for($t[2*le.heap[le.heap_max]+1]=0,Mr=le.heap_max+1;Mr>=7;L>>=1)if(1&pe&&Y.dyn_ltree[2*re]!==0)return a;if(Y.dyn_ltree[18]!==0||Y.dyn_ltree[20]!==0||Y.dyn_ltree[26]!==0)return s;for(re=32;re>>3,(Q=b.static_len+3+7>>>3)<=L&&(L=Q)):L=Q=H+5,H+4<=L&&I!==-1?C(b,I,H,V):b.strategy===4||Q===L?(q(b,2+(V?1:0),3),It(b,Z,E)):(q(b,4+(V?1:0),3),function(Y,re,pe,le){var ht;for(q(Y,re-257,5),q(Y,pe-1,5),q(Y,le-4,4),ht=0;ht>>8&255,b.pending_buf[b.d_buf+2*b.last_lit+1]=255&I,b.pending_buf[b.l_buf+b.last_lit]=255&H,b.last_lit++,I===0?b.dyn_ltree[2*H]++:(b.matches++,I--,b.dyn_ltree[2*(w[H]+v+1)]++,b.dyn_dtree[2*D(I)]++),b.last_lit===b.lit_bufsize-1},i._tr_align=function(b){q(b,2,3),X(b,y,Z),function(I){I.bi_valid===16?(te(I,I.bi_buf),I.bi_buf=0,I.bi_valid=0):8<=I.bi_valid&&(I.pending_buf[I.pending++]=255&I.bi_buf,I.bi_buf>>=8,I.bi_valid-=8)}(b)}},{"../utils/common":41}],53:[function(n,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,i){(function(o){(function(a,s){if(!a.setImmediate){var l,u,d,v,g=1,f={},_=!1,p=a.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(a);x=x&&x.setTimeout?x:a,l={}.toString.call(a.process)==="[object process]"?function(k){process.nextTick(function(){h(k)})}:function(){if(a.postMessage&&!a.importScripts){var k=!0,S=a.onmessage;return a.onmessage=function(){k=!1},a.postMessage("","*"),a.onmessage=S,k}}()?(v="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",y,!1):a.attachEvent("onmessage",y),function(k){a.postMessage(v+k,"*")}):a.MessageChannel?((d=new MessageChannel).port1.onmessage=function(k){h(k.data)},function(k){d.port2.postMessage(k)}):p&&"onreadystatechange"in p.createElement("script")?(u=p.documentElement,function(k){var S=p.createElement("script");S.onreadystatechange=function(){h(k),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(k){setTimeout(h,0,k)},x.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var S=new Array(arguments.length-1),T=0;T"u"?o===void 0?this:o:self)}).call(this,typeof qi<"u"?qi:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Xh);var _g=Xh.exports;const yg=kl(_g);function yo({label:e,icon:t,file:n,onChange:r,accept:i=".bin"}){const o=lt.useRef(null),[a,s]=lt.useState(!1),[l,u]=lt.useState(!1),d=p=>{p.preventDefault(),p.stopPropagation(),s(!0)},v=p=>{p.preventDefault(),p.stopPropagation(),s(!1),u(!1)},g=p=>{p.preventDefault(),p.stopPropagation()},f=p=>{p.preventDefault(),p.stopPropagation(),s(!1);const x=p.dataTransfer.files[0];if(!x)return;const c=i.split(",")[0].replace("*","");if(!x.name.endsWith(c)){u(!0),setTimeout(()=>u(!1),2e3);return}r(x)},_=p=>{var c;const x=(c=p.target.files)==null?void 0:c[0];x&&r(x)};return O.jsxs("div",{onDragEnter:d,onDragLeave:v,onDragOver:g,onDrop:f,className:la("flex flex-col items-center gap-4 rounded-lg p-6 transition-colors duration-200",n?"bg-gray-800/50":"bg-gray-800/30",a&&!l&&"bg-blue-900/20 border-2 border-dashed border-blue-500",l&&"bg-red-900/20 border-2 border-dashed border-red-500","relative"),children:[O.jsx("input",{ref:o,type:"file",accept:i,onChange:_,className:"hidden"}),l?O.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-gray-900/95 rounded-lg",children:[O.jsx(z1,{className:"h-8 w-8 text-red-500 mb-2"}),O.jsx("p",{className:"text-sm text-red-400",children:"Invalid file type"})]}):n?O.jsx($h,{className:"h-8 w-8 text-blue-500"}):a?O.jsx(A1,{className:"h-8 w-8 text-blue-500"}):O.jsx("div",{className:"h-8 w-8 text-gray-600",children:t}),O.jsx("div",{className:"text-center",children:n?O.jsxs(O.Fragment,{children:[O.jsx("p",{className:"text-sm text-gray-200",children:n.name}),O.jsx("button",{onClick:()=>{var p;return(p=o.current)==null?void 0:p.click()},className:"text-blue-500 hover:text-blue-400",children:"Choose different file"})]}):O.jsxs(O.Fragment,{children:[O.jsx("p",{className:"text-sm text-gray-400",children:e}),O.jsx("button",{onClick:()=>{var p;return(p=o.current)==null?void 0:p.click()},className:"text-blue-500 hover:text-blue-400",children:"Select file"})]})})]})}function vg({onSelectFirmware:e}){const{versions:t,loading:n,error:r}=O1(),[i,o]=lt.useState({bootloader:null,partitionTable:null,application:null,zip:null}),[a,s]=lt.useState("package"),l=async f=>{try{const p=await new yg().loadAsync(f),x=p.file("bootloader.bin"),c=p.file("partitions.bin"),h=p.file("firmware.bin");if(!x||!c||!h)throw new Error("Invalid firmware package - missing required files");const[y,k,S]=await Promise.all([x.async("blob"),c.async("blob"),h.async("blob")]);return{bootloader:new File([y],"bootloader.bin",{type:"application/octet-stream"}),partitionTable:new File([k],"partitions.bin",{type:"application/octet-stream"}),application:new File([S],"firmware.bin",{type:"application/octet-stream"})}}catch(_){throw console.error("Failed to extract firmware files:",_),new Error("Invalid firmware package")}},u=f=>_=>{const p={...i,[f]:_};o(p),e(p)},d=async f=>{try{const _=await l(f);o({bootloader:null,partitionTable:null,application:null,zip:f}),e(_)}catch(_){throw o({bootloader:null,partitionTable:null,application:null,zip:null}),e(null),_}},v=t.flatMap(f=>f.variants.map(_=>({value:_.zipUrl,tooltip:`Version ${f.version} (${_.variant}) - ${new Date(f.date).toLocaleDateString()}`,label:O.jsxs("div",{className:"flex items-center justify-between w-full",children:[O.jsxs("div",{className:"flex-1 truncate",children:[O.jsx("span",{className:"mr-2",children:f.version}),O.jsx("span",{className:"text-gray-400",children:_.variant}),O.jsx("span",{className:"ml-2 text-gray-400 text-xs",children:new Date(f.date).toLocaleDateString()})]}),f.prerelease&&O.jsx(gg,{variant:"warning",className:"ml-2 flex-shrink-0",children:"Pre-release"})]})}))),g=f=>{window.open(f,"_blank")};return O.jsxs("div",{className:"space-y-6",children:[O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsx("h2",{className:"text-xl font-semibold",children:"Select Firmware Files"}),O.jsxs("div",{className:"flex rounded-lg bg-gray-800 p-1",children:[O.jsx("button",{onClick:()=>s("package"),className:la("px-3 py-1.5 text-sm font-medium rounded-md transition-colors",a==="package"?"bg-gray-700 text-white":"text-gray-400 hover:text-white"),children:"Package"}),O.jsx("button",{onClick:()=>s("individual"),className:la("px-3 py-1.5 text-sm font-medium rounded-md transition-colors",a==="individual"?"bg-gray-700 text-white":"text-gray-400 hover:text-white"),children:"Individual Files"})]}),O.jsx(Zh,{options:v,value:"",onChange:f=>g(f),label:n?"Loading...":t.length===0?"No releases available":"Download Release",icon:O.jsx(Hh,{className:"h-4 w-4"}),disabled:n||t.length===0,width:"fixed",dropdownWidth:400})]}),r&&O.jsx("div",{className:"p-3 rounded-lg bg-red-900/50 text-red-200",children:r}),a==="individual"?O.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[O.jsx(yo,{label:"Select Bootloader",icon:O.jsx(v1,{className:"h-full w-full"}),file:i.bootloader,onChange:u("bootloader")}),O.jsx(yo,{label:"Select Partition Table",icon:O.jsx(b1,{className:"h-full w-full"}),file:i.partitionTable,onChange:u("partitionTable")}),O.jsx(yo,{label:"Select Application",icon:O.jsx(_u,{className:"h-full w-full"}),file:i.application,onChange:u("application")})]}):O.jsx(yo,{label:"Select or drop firmware package",icon:O.jsx(h1,{className:"h-full w-full"}),file:i.zip,onChange:d,accept:".zip"})]})}function wg({progress:e,isDeviceConnected:t=!1,eraseFlash:n,onEraseFlashChange:r}){const i=()=>{switch(e.status){case"idle":return O.jsx(g1,{className:"h-6 w-6 text-gray-500"});case"complete":return O.jsx(m1,{className:"h-6 w-6 text-green-500"});case"error":return O.jsx(d1,{className:"h-6 w-6 text-red-500"});default:return O.jsx(k1,{className:"h-6 w-6 animate-spin text-blue-500"})}},o=()=>{if(e.status==="idle"&&!t)return"Connect a device to begin flashing";switch(e.status){case"idle":return"Device connected - Ready to flash";case"connecting":return"Connecting to device...";case"erasing":return"Erasing flash...";case"flashing":return"Writing firmware...";case"verifying":return"Verifying flash...";case"complete":return"Flash complete!";case"error":return e.error||"An error occurred";default:return"Ready to flash"}};return O.jsxs("div",{className:"space-y-4 rounded-lg bg-gray-800/50 p-4",children:[O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{className:"flex items-center gap-3",children:[i(),O.jsx("span",{className:"text-sm font-medium text-gray-200",children:o()})]}),O.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-300",children:[O.jsx("input",{type:"checkbox",checked:n,onChange:a=>r(a.target.checked),disabled:e.status!=="idle",className:"rounded border-gray-600 text-blue-500 focus:ring-blue-500 focus:ring-offset-gray-900"}),"Erase flash before writing"]})]}),e.status!=="idle"&&e.status!=="complete"&&e.status!=="error"&&O.jsxs("div",{className:"space-y-2",children:[O.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-gray-800",children:O.jsx("div",{className:"h-full bg-blue-500 transition-all duration-300",style:{width:`${e.progress}%`}})}),O.jsxs("div",{className:"text-right text-sm text-gray-500",children:[Math.round(e.progress),"%"]})]})]})}const xg="modulepreload",kg=function(e){return"/"+e},Bc={},bt=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),s=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=kg(l),l in Bc)return;Bc[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const v=document.createElement("link");if(v.rel=u?"stylesheet":xg,u||(v.as="script"),v.crossOrigin="",v.href=l,s&&v.setAttribute("nonce",s),document.head.appendChild(v),u)return new Promise((g,f)=>{v.addEventListener("load",g),v.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(a){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a}return i.then(a=>{for(const s of a||[])s.status==="rejected"&&o(s.reason);return t().catch(o)})};class Ve extends Error{}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Sg=4,Uc=0,jc=1,bg=2;function Dr(e){let t=e.length;for(;--t>=0;)e[t]=0}const Eg=0,qh=1,Cg=2,Ag=3,Tg=258,vu=29,Vi=256,Pi=Vi+1+vu,wr=30,wu=19,Jh=2*Pi+1,On=15,os=16,Rg=7,xu=256,ep=16,tp=17,np=18,hl=new Uint8Array([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]),Oo=new Uint8Array([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]),zg=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),rp=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ig=512,Gt=new Array((Pi+2)*2);Dr(Gt);const hi=new Array(wr*2);Dr(hi);const Di=new Array(Ig);Dr(Di);const Li=new Array(Tg-Ag+1);Dr(Li);const ku=new Array(vu);Dr(ku);const ua=new Array(wr);Dr(ua);function as(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let ip,op,ap;function ss(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const sp=e=>e<256?Di[e]:Di[256+(e>>>7)],Oi=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},et=(e,t,n)=>{e.bi_valid>os-n?(e.bi_buf|=t<>os-e.bi_valid,e.bi_valid+=n-os):(e.bi_buf|=t<{et(e,n[t*2],n[t*2+1])},lp=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},Ng=e=>{e.bi_valid===16?(Oi(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},Pg=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,d,v,g,f,_,p=0;for(g=0;g<=On;g++)e.bl_count[g]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ul&&(g=l,p++),n[d*2+1]=g,!(d>r)&&(e.bl_count[g]++,f=0,d>=s&&(f=a[d-s]),_=n[d*2],e.opt_len+=_*(g+f),o&&(e.static_len+=_*(i[d*2+1]+f)));if(p!==0){do{for(g=l-1;e.bl_count[g]===0;)g--;e.bl_count[g]--,e.bl_count[g+1]+=2,e.bl_count[l]--,p-=2}while(p>0);for(g=l;g!==0;g--)for(d=e.bl_count[g];d!==0;)v=e.heap[--u],!(v>r)&&(n[v*2+1]!==g&&(e.opt_len+=(g-n[v*2+1])*n[v*2],n[v*2+1]=g),d--)}},up=(e,t,n)=>{const r=new Array(On+1);let i=0,o,a;for(o=1;o<=On;o++)i=i+n[o-1]<<1,r[o]=i;for(a=0;a<=t;a++){let s=e[a*2+1];s!==0&&(e[a*2]=lp(r[s]++,s))}},Dg=()=>{let e,t,n,r,i;const o=new Array(On+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?Oi(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},$c=(e,t,n,r)=>{const i=t*2,o=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,o=0,a,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+o++]&255,r+=(e.pending_buf[e.sym_buf+o++]&255)<<8,i=e.pending_buf[e.sym_buf+o++],r===0?Ft(e,i,t):(a=Li[i],Ft(e,a+Vi+1,t),s=hl[a],s!==0&&(i-=ku[a],et(e,i,s)),r--,a=sp(r),Ft(e,a,n),s=Oo[a],s!==0&&(r-=ua[a],et(e,r,s)));while(o{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,l=-1,u;for(e.heap_len=0,e.heap_max=Jh,a=0;a>1;a>=1;a--)ls(e,n,a);u=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ls(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[u*2]=n[a*2]+n[s*2],e.depth[u]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=u,e.heap[1]=u++,ls(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Pg(e,t),up(n,l,e.bl_count)},Zc=(e,t,n)=>{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=a,a=t[(r+1)*2+1],!(++s{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),r=0;r<=n;r++)if(o=a,a=t[(r+1)*2+1],!(++s{let t;for(Zc(e,e.dyn_ltree,e.l_desc.max_code),Zc(e,e.dyn_dtree,e.d_desc.max_code),pl(e,e.bl_desc),t=wu-1;t>=3&&e.bl_tree[rp[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},Og=(e,t,n,r)=>{let i;for(et(e,t-257,5),et(e,n-1,5),et(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Uc;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return jc;for(n=32;n{Vc||(Dg(),Vc=!0),e.l_desc=new ss(e.dyn_ltree,ip),e.d_desc=new ss(e.dyn_dtree,op),e.bl_desc=new ss(e.bl_tree,ap),e.bi_buf=0,e.bi_valid=0,cp(e)},dp=(e,t,n,r)=>{et(e,(Eg<<1)+(r?1:0),3),fp(e),Oi(e,n),Oi(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},Bg=e=>{et(e,qh<<1,3),Ft(e,xu,Gt),Ng(e)},Ug=(e,t,n,r)=>{let i,o,a=0;e.level>0?(e.strm.data_type===bg&&(e.strm.data_type=Fg(e)),pl(e,e.l_desc),pl(e,e.d_desc),a=Lg(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&t!==-1?dp(e,t,n,r):e.strategy===Sg||o===i?(et(e,(qh<<1)+(r?1:0),3),Hc(e,Gt,hi)):(et(e,(Cg<<1)+(r?1:0),3),Og(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Hc(e,e.dyn_ltree,e.dyn_dtree)),cp(e),r&&fp(e)},jg=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Li[n]+Vi+1)*2]++,e.dyn_dtree[sp(t)*2]++),e.sym_next===e.sym_end);var $g=Mg,Hg=dp,Zg=Ug,Wg=jg,Vg=Bg,Gg={_tr_init:$g,_tr_stored_block:Hg,_tr_flush_block:Zg,_tr_tally:Wg,_tr_align:Vg};const Kg=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do i=i+t[r++]|0,o=o+i|0;while(--a);i%=65521,o%=65521}return i|o<<16|0};var Fi=Kg;const Qg=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},Yg=new Uint32Array(Qg()),Xg=(e,t,n,r)=>{const i=Yg,o=r+n;e^=-1;for(let a=r;a>>8^i[(e^t[a])&255];return e^-1};var Le=Xg,Vn={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Lr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:qg,_tr_stored_block:ml,_tr_flush_block:Jg,_tr_tally:Sn,_tr_align:e_}=Gg,{Z_NO_FLUSH:bn,Z_PARTIAL_FLUSH:t_,Z_FULL_FLUSH:n_,Z_FINISH:gt,Z_BLOCK:Gc,Z_OK:Be,Z_STREAM_END:Kc,Z_STREAM_ERROR:Ut,Z_DATA_ERROR:r_,Z_BUF_ERROR:us,Z_DEFAULT_COMPRESSION:i_,Z_FILTERED:o_,Z_HUFFMAN_ONLY:vo,Z_RLE:a_,Z_FIXED:s_,Z_DEFAULT_STRATEGY:l_,Z_UNKNOWN:u_,Z_DEFLATED:Ta}=Lr,c_=9,f_=15,d_=8,h_=29,p_=256,gl=p_+1+h_,m_=30,g_=19,__=2*gl+1,y_=15,ae=3,pn=258,jt=pn+ae+1,v_=32,Tr=42,Su=57,_l=69,yl=73,vl=91,wl=103,Fn=113,ni=666,Ke=1,Or=2,Gn=3,Fr=4,w_=3,Mn=(e,t)=>(e.msg=Vn[t],t),Qc=e=>e*2-(e>4?9:0),fn=e=>{let t=e.length;for(;--t>=0;)e[t]=0},x_=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let k_=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},st=(e,t)=>{Jg(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,it(e.strm)},ce=(e,t)=>{e.pending_buf[e.pending++]=t},Xr=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},xl=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Fi(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Le(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},hp=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,o,a=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-jt?e.strstart-(e.w_size-jt):0,u=e.window,d=e.w_mask,v=e.prev,g=e.strstart+pn;let f=u[r+a-1],_=u[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(u[i+a]!==_||u[i+a-1]!==f||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&ra){if(e.match_start=t,a=o,o>=s)break;f=u[r+a-1],_=u[r+a]}}while((t=v[t&d])>l&&--n!==0);return a<=e.lookahead?a:e.lookahead},Rr=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-jt)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),x_(e),r+=t),e.strm.avail_in===0)break;if(n=xl(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=ae)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=En(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=En(e,e.ins_h,e.window[i+ae-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,o,a=0,s=e.strm.avail_in;do{if(r=65535,o=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>o&&(r=o),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,it(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(xl(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watero&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(xl(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,n=o>e.w_size?e.w_size:o,i=e.strstart-e.block_start,(i>=n||(i||t===gt)&&t!==bn&&e.strm.avail_in===0&&i<=o)&&(r=i>o?o:i,a=t===gt&&e.strm.avail_in===0&&r===i?1:0,ml(e,e.block_start,r,a),e.block_start+=r,it(e.strm)),a?Gn:Ke)},cs=(e,t)=>{let n,r;for(;;){if(e.lookahead=ae&&(e.ins_h=En(e,e.ins_h,e.window[e.strstart+ae-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-jt&&(e.match_length=hp(e,n)),e.match_length>=ae)if(r=Sn(e,e.strstart-e.match_start,e.match_length-ae),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ae){e.match_length--;do e.strstart++,e.ins_h=En(e,e.ins_h,e.window[e.strstart+ae-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=En(e,e.ins_h,e.window[e.strstart+1]);else r=Sn(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(st(e,!1),e.strm.avail_out===0))return Ke}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=ae&&(e.ins_h=En(e,e.ins_h,e.window[e.strstart+ae-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=ae-1,n!==0&&e.prev_length4096)&&(e.match_length=ae-1)),e.prev_length>=ae&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-ae,r=Sn(e,e.strstart-1-e.prev_match,e.prev_length-ae),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=En(e,e.ins_h,e.window[e.strstart+ae-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=ae-1,e.strstart++,r&&(st(e,!1),e.strm.avail_out===0))return Ke}else if(e.match_available){if(r=Sn(e,0,e.window[e.strstart-1]),r&&st(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Ke}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Sn(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,o;const a=e.window;for(;;){if(e.lookahead<=pn){if(Rr(e),e.lookahead<=pn&&t===bn)return Ke;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=ae&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+pn;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=ae?(n=Sn(e,1,e.match_length-ae),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Sn(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(st(e,!1),e.strm.avail_out===0))return Ke}return e.insert=0,t===gt?(st(e,!0),e.strm.avail_out===0?Gn:Fr):e.sym_next&&(st(e,!1),e.strm.avail_out===0)?Ke:Or},b_=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Rr(e),e.lookahead===0)){if(t===bn)return Ke;break}if(e.match_length=0,n=Sn(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(st(e,!1),e.strm.avail_out===0))return Ke}return e.insert=0,t===gt?(st(e,!0),e.strm.avail_out===0?Gn:Fr):e.sym_next&&(st(e,!1),e.strm.avail_out===0)?Ke:Or};function Dt(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const ri=[new Dt(0,0,0,0,pp),new Dt(4,4,8,4,cs),new Dt(4,5,16,8,cs),new Dt(4,6,32,32,cs),new Dt(4,4,16,16,Jn),new Dt(8,16,32,32,Jn),new Dt(8,16,128,128,Jn),new Dt(8,32,128,256,Jn),new Dt(32,128,258,1024,Jn),new Dt(32,258,258,4096,Jn)],E_=e=>{e.window_size=2*e.w_size,fn(e.head),e.max_lazy_match=ri[e.level].max_lazy,e.good_match=ri[e.level].good_length,e.nice_match=ri[e.level].nice_length,e.max_chain_length=ri[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ae-1,e.match_available=0,e.ins_h=0};function C_(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ta,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(__*2),this.dyn_dtree=new Uint16Array((2*m_+1)*2),this.bl_tree=new Uint16Array((2*g_+1)*2),fn(this.dyn_ltree),fn(this.dyn_dtree),fn(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(y_+1),this.heap=new Uint16Array(2*gl+1),fn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*gl+1),fn(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Gi=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Tr&&t.status!==Su&&t.status!==_l&&t.status!==yl&&t.status!==vl&&t.status!==wl&&t.status!==Fn&&t.status!==ni?1:0},mp=e=>{if(Gi(e))return Mn(e,Ut);e.total_in=e.total_out=0,e.data_type=u_;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Su:t.wrap?Tr:Fn,e.adler=t.wrap===2?0:1,t.last_flush=-2,qg(t),Be},gp=e=>{const t=mp(e);return t===Be&&E_(e.state),t},A_=(e,t)=>Gi(e)||e.state.wrap!==2?Ut:(e.state.gzhead=t,Be),_p=(e,t,n,r,i,o)=>{if(!e)return Ut;let a=1;if(t===i_&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>c_||n!==Ta||r<8||r>15||t<0||t>9||o<0||o>s_||r===8&&a!==1)return Mn(e,Ut);r===8&&(r=9);const s=new C_;return e.state=s,s.strm=e,s.status=Tr,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<_p(e,t,Ta,f_,d_,l_),R_=(e,t)=>{if(Gi(e)||t>Gc||t<0)return e?Mn(e,Ut):Ut;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===ni&&t!==gt)return Mn(e,e.avail_out===0?us:Ut);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(it(e),e.avail_out===0)return n.last_flush=-1,Be}else if(e.avail_in===0&&Qc(t)<=Qc(r)&&t!==gt)return Mn(e,us);if(n.status===ni&&e.avail_in!==0)return Mn(e,us);if(n.status===Tr&&n.wrap===0&&(n.status=Fn),n.status===Tr){let i=Ta+(n.w_bits-8<<4)<<8,o=-1;if(n.strategy>=vo||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,i|=o<<6,n.strstart!==0&&(i|=v_),i+=31-i%31,Xr(n,i),n.strstart!==0&&(Xr(n,e.adler>>>16),Xr(n,e.adler&65535)),e.adler=1,n.status=Fn,it(e),n.pending!==0)return n.last_flush=-1,Be}if(n.status===Su){if(e.adler=0,ce(n,31),ce(n,139),ce(n,8),n.gzhead)ce(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),ce(n,n.gzhead.time&255),ce(n,n.gzhead.time>>8&255),ce(n,n.gzhead.time>>16&255),ce(n,n.gzhead.time>>24&255),ce(n,n.level===9?2:n.strategy>=vo||n.level<2?4:0),ce(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(ce(n,n.gzhead.extra.length&255),ce(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Le(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=_l;else if(ce(n,0),ce(n,0),ce(n,0),ce(n,0),ce(n,0),ce(n,n.level===9?2:n.strategy>=vo||n.level<2?4:0),ce(n,w_),n.status=Fn,it(e),n.pending!==0)return n.last_flush=-1,Be}if(n.status===_l){if(n.gzhead.extra){let i=n.pending,o=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+o>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,it(e),n.pending!==0)return n.last_flush=-1,Be;i=0,o-=s}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending+=o,n.gzhead.hcrc&&n.pending>i&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=yl}if(n.status===yl){if(n.gzhead.name){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i)),it(e),n.pending!==0)return n.last_flush=-1,Be;i=0}n.gzindexi&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=vl}if(n.status===vl){if(n.gzhead.comment){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i)),it(e),n.pending!==0)return n.last_flush=-1,Be;i=0}n.gzindexi&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i))}n.status=wl}if(n.status===wl){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(it(e),n.pending!==0))return n.last_flush=-1,Be;ce(n,e.adler&255),ce(n,e.adler>>8&255),e.adler=0}if(n.status=Fn,it(e),n.pending!==0)return n.last_flush=-1,Be}if(e.avail_in!==0||n.lookahead!==0||t!==bn&&n.status!==ni){let i=n.level===0?pp(n,t):n.strategy===vo?b_(n,t):n.strategy===a_?S_(n,t):ri[n.level].func(n,t);if((i===Gn||i===Fr)&&(n.status=ni),i===Ke||i===Gn)return e.avail_out===0&&(n.last_flush=-1),Be;if(i===Or&&(t===t_?e_(n):t!==Gc&&(ml(n,0,0,!1),t===n_&&(fn(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),it(e),e.avail_out===0))return n.last_flush=-1,Be}return t!==gt?Be:n.wrap<=0?Kc:(n.wrap===2?(ce(n,e.adler&255),ce(n,e.adler>>8&255),ce(n,e.adler>>16&255),ce(n,e.adler>>24&255),ce(n,e.total_in&255),ce(n,e.total_in>>8&255),ce(n,e.total_in>>16&255),ce(n,e.total_in>>24&255)):(Xr(n,e.adler>>>16),Xr(n,e.adler&65535)),it(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Be:Kc)},z_=e=>{if(Gi(e))return Ut;const t=e.state.status;return e.state=null,t===Fn?Mn(e,r_):Be},I_=(e,t)=>{let n=t.length;if(Gi(e))return Ut;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Tr||r.lookahead)return Ut;if(i===1&&(e.adler=Fi(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(fn(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(t.subarray(n-r.w_size,n),0),t=l,n=r.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Rr(r);r.lookahead>=ae;){let l=r.strstart,u=r.lookahead-(ae-1);do r.ins_h=En(r,r.ins_h,r.window[l+ae-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=ae-1,Rr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=ae-1,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,r.wrap=i,Be};var N_=T_,P_=_p,D_=gp,L_=mp,O_=A_,F_=R_,M_=z_,B_=I_,U_="pako deflate (from Nodeca project)",pi={deflateInit:N_,deflateInit2:P_,deflateReset:D_,deflateResetKeep:L_,deflateSetHeader:O_,deflate:F_,deflateEnd:M_,deflateSetDictionary:B_,deflateInfo:U_};const j_=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var $_=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)j_(n,r)&&(e[r]=n[r])}}return e},H_=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Mi[254]=Mi[254]=1;var Z_=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,a=e.length,s=0;for(i=0;i>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const W_=(e,t)=>{if(t<65534&&e.subarray&&yp)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r4){o[i++]=65533,r+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}a<65536?o[i++]=a:(a-=65536,o[i++]=55296|a>>10&1023,o[i++]=56320|a&1023)}return W_(o,i)},G_=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+Mi[e[n]]>t?n:t},Bi={string2buf:Z_,buf2string:V_,utf8border:G_};function K_(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var vp=K_;const wp=Object.prototype.toString,{Z_NO_FLUSH:Q_,Z_SYNC_FLUSH:Y_,Z_FULL_FLUSH:X_,Z_FINISH:q_,Z_OK:ca,Z_STREAM_END:J_,Z_DEFAULT_COMPRESSION:ey,Z_DEFAULT_STRATEGY:ty,Z_DEFLATED:ny}=Lr;function Ki(e){this.options=Ra.assign({level:ey,method:ny,chunkSize:16384,windowBits:15,memLevel:8,strategy:ty},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new vp,this.strm.avail_out=0;let n=pi.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==ca)throw new Error(Vn[n]);if(t.header&&pi.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=Bi.string2buf(t.dictionary):wp.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=pi.deflateSetDictionary(this.strm,r),n!==ca)throw new Error(Vn[n]);this._dict_set=!0}}Ki.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?q_:Q_,typeof e=="string"?n.input=Bi.string2buf(e):wp.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===Y_||o===X_)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=pi.deflate(n,o),i===J_)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=pi.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ca;if(n.avail_out===0){this.onData(n.output);continue}if(o>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Ki.prototype.onData=function(e){this.chunks.push(e)};Ki.prototype.onEnd=function(e){e===ca&&(this.result=Ra.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function bu(e,t){const n=new Ki(t);if(n.push(e,!0),n.err)throw n.msg||Vn[n.err];return n.result}function ry(e,t){return t=t||{},t.raw=!0,bu(e,t)}function iy(e,t){return t=t||{},t.gzip=!0,bu(e,t)}var oy=Ki,ay=bu,sy=ry,ly=iy,uy=Lr,cy={Deflate:oy,deflate:ay,deflateRaw:sy,gzip:ly,constants:uy};const wo=16209,fy=16191;var dy=function(t,n){let r,i,o,a,s,l,u,d,v,g,f,_,p,x,c,h,y,k,S,T,A,z,R,N;const Z=t.state;r=t.next_in,R=t.input,i=r+(t.avail_in-5),o=t.next_out,N=t.output,a=o-(n-t.avail_out),s=o+(t.avail_out-257),l=Z.dmax,u=Z.wsize,d=Z.whave,v=Z.wnext,g=Z.window,f=Z.hold,_=Z.bits,p=Z.lencode,x=Z.distcode,c=(1<>>24,f>>>=k,_-=k,k=y>>>16&255,k===0)N[o++]=y&65535;else if(k&16){S=y&65535,k&=15,k&&(_>>=k,_-=k),_<15&&(f+=R[r++]<<_,_+=8,f+=R[r++]<<_,_+=8),y=x[f&h];n:for(;;){if(k=y>>>24,f>>>=k,_-=k,k=y>>>16&255,k&16){if(T=y&65535,k&=15,_l){t.msg="invalid distance too far back",Z.mode=wo;break e}if(f>>>=k,_-=k,k=o-a,T>k){if(k=T-k,k>d&&Z.sane){t.msg="invalid distance too far back",Z.mode=wo;break e}if(A=0,z=g,v===0){if(A+=u-k,k2;)N[o++]=z[A++],N[o++]=z[A++],N[o++]=z[A++],S-=3;S&&(N[o++]=z[A++],S>1&&(N[o++]=z[A++]))}else{A=o-T;do N[o++]=N[A++],N[o++]=N[A++],N[o++]=N[A++],S-=3;while(S>2);S&&(N[o++]=N[A++],S>1&&(N[o++]=N[A++]))}}else if(k&64){t.msg="invalid distance code",Z.mode=wo;break e}else{y=x[(y&65535)+(f&(1<>3,r-=S,_-=S<<3,f&=(1<<_)-1,t.next_in=r,t.next_out=o,t.avail_in=r{const l=s.bits;let u=0,d=0,v=0,g=0,f=0,_=0,p=0,x=0,c=0,h=0,y,k,S,T,A,z=null,R;const N=new Uint16Array(er+1),Z=new Uint16Array(er+1);let E=null,B,w,U;for(u=0;u<=er;u++)N[u]=0;for(d=0;d=1&&N[g]===0;g--);if(f>g&&(f=g),g===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,s.bits=1,0;for(v=1;v0&&(e===qc||g!==1))return-1;for(Z[1]=0,u=1;uYc||e===Jc&&c>Xc)return 1;for(;;){B=u-p,a[d]+1=R?(w=E[a[d]-R],U=z[a[d]-R]):(w=96,U=0),y=1<>p)+k]=B<<24|w<<16|U|0;while(k!==0);for(y=1<>=1;if(y!==0?(h&=y-1,h+=y):h=0,d++,--N[u]===0){if(u===g)break;u=t[n+a[d]]}if(u>f&&(h&T)!==S){for(p===0&&(p=f),A+=v,_=u-p,x=1<<_;_+pYc||e===Jc&&c>Xc)return 1;S=h&T,i[S]=f<<24|_<<16|A-o|0}}return h!==0&&(i[A+h]=u-p<<24|64<<16|0),s.bits=f,0};var mi=_y;const yy=0,xp=1,kp=2,{Z_FINISH:ef,Z_BLOCK:vy,Z_TREES:xo,Z_OK:Kn,Z_STREAM_END:wy,Z_NEED_DICT:xy,Z_STREAM_ERROR:xt,Z_DATA_ERROR:Sp,Z_MEM_ERROR:bp,Z_BUF_ERROR:ky,Z_DEFLATED:tf}=Lr,za=16180,nf=16181,rf=16182,of=16183,af=16184,sf=16185,lf=16186,uf=16187,cf=16188,ff=16189,fa=16190,Zt=16191,ds=16192,df=16193,hs=16194,hf=16195,pf=16196,mf=16197,gf=16198,ko=16199,So=16200,_f=16201,yf=16202,vf=16203,wf=16204,xf=16205,ps=16206,kf=16207,Sf=16208,ve=16209,Ep=16210,Cp=16211,Sy=852,by=592,Ey=15,Cy=Ey,bf=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function Ay(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Xn=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeCp?1:0},Ap=e=>{if(Xn(e))return xt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=za,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Sy),t.distcode=t.distdyn=new Int32Array(by),t.sane=1,t.back=-1,Kn},Tp=e=>{if(Xn(e))return xt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ap(e)},Rp=(e,t)=>{let n;if(Xn(e))return xt;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?xt:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Tp(e))},zp=(e,t)=>{if(!e)return xt;const n=new Ay;e.state=n,n.strm=e,n.window=null,n.mode=za;const r=Rp(e,t);return r!==Kn&&(e.state=null),r},Ty=e=>zp(e,Cy);let Ef=!0,ms,gs;const Ry=e=>{if(Ef){ms=new Int32Array(512),gs=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(mi(xp,e.lens,0,288,ms,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;mi(kp,e.lens,0,32,gs,0,e.work,{bits:5}),Ef=!1}e.lencode=ms,e.lenbits=9,e.distcode=gs,e.distbits=5},Ip=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave{let n,r,i,o,a,s,l,u,d,v,g,f,_,p,x=0,c,h,y,k,S,T,A,z;const R=new Uint8Array(4);let N,Z;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Xn(e)||!e.output||!e.input&&e.avail_in!==0)return xt;n=e.state,n.mode===Zt&&(n.mode=ds),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,d=n.bits,v=s,g=l,z=Kn;e:for(;;)switch(n.mode){case za:if(n.wrap===0){n.mode=ds;break}for(;d<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=Le(n.check,R,2,0),u=0,d=0,n.mode=nf;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=ve;break}if((u&15)!==tf){e.msg="unknown compression method",n.mode=ve;break}if(u>>>=4,d-=4,A=(u&15)+8,n.wbits===0&&(n.wbits=A),A>15||A>n.wbits){e.msg="invalid window size",n.mode=ve;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,n.check=Le(n.check,R,2,0)),u=0,d=0,n.mode=rf;case rf:for(;d<32;){if(s===0)break e;s--,u+=r[o++]<>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,n.check=Le(n.check,R,4,0)),u=0,d=0,n.mode=of;case of:for(;d<16;){if(s===0)break e;s--,u+=r[o++]<>8),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,n.check=Le(n.check,R,2,0)),u=0,d=0,n.mode=af;case af:if(n.flags&1024){for(;d<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=Le(n.check,R,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=sf;case sf:if(n.flags&1024&&(f=n.length,f>s&&(f=s),f&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+f),A)),n.flags&512&&n.wrap&4&&(n.check=Le(n.check,r,f,o)),s-=f,o+=f,n.length-=f),n.length))break e;n.length=0,n.mode=lf;case lf:if(n.flags&2048){if(s===0)break e;f=0;do A=r[o+f++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&f>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Zt;break;case ff:for(;d<32;){if(s===0)break e;s--,u+=r[o++]<>>=d&7,d-=d&7,n.mode=ps;break}for(;d<3;){if(s===0)break e;s--,u+=r[o++]<>>=1,d-=1,u&3){case 0:n.mode=df;break;case 1:if(Ry(n),n.mode=ko,t===xo){u>>>=2,d-=2;break e}break;case 2:n.mode=pf;break;case 3:e.msg="invalid block type",n.mode=ve}u>>>=2,d-=2;break;case df:for(u>>>=d&7,d-=d&7;d<32;){if(s===0)break e;s--,u+=r[o++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=ve;break}if(n.length=u&65535,u=0,d=0,n.mode=hs,t===xo)break e;case hs:n.mode=hf;case hf:if(f=n.length,f){if(f>s&&(f=s),f>l&&(f=l),f===0)break e;i.set(r.subarray(o,o+f),a),s-=f,o+=f,l-=f,a+=f,n.length-=f;break}n.mode=Zt;break;case pf:for(;d<14;){if(s===0)break e;s--,u+=r[o++]<>>=5,d-=5,n.ndist=(u&31)+1,u>>>=5,d-=5,n.ncode=(u&15)+4,u>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=ve;break}n.have=0,n.mode=mf;case mf:for(;n.have>>=3,d-=3}for(;n.have<19;)n.lens[E[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,N={bits:n.lenbits},z=mi(yy,n.lens,0,19,n.lencode,0,n.work,N),n.lenbits=N.bits,z){e.msg="invalid code lengths set",n.mode=ve;break}n.have=0,n.mode=gf;case gf:for(;n.have>>24,h=x>>>16&255,y=x&65535,!(c<=d);){if(s===0)break e;s--,u+=r[o++]<>>=c,d-=c,n.lens[n.have++]=y;else{if(y===16){for(Z=c+2;d>>=c,d-=c,n.have===0){e.msg="invalid bit length repeat",n.mode=ve;break}A=n.lens[n.have-1],f=3+(u&3),u>>>=2,d-=2}else if(y===17){for(Z=c+3;d>>=c,d-=c,A=0,f=3+(u&7),u>>>=3,d-=3}else{for(Z=c+7;d>>=c,d-=c,A=0,f=11+(u&127),u>>>=7,d-=7}if(n.have+f>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=ve;break}for(;f--;)n.lens[n.have++]=A}}if(n.mode===ve)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=ve;break}if(n.lenbits=9,N={bits:n.lenbits},z=mi(xp,n.lens,0,n.nlen,n.lencode,0,n.work,N),n.lenbits=N.bits,z){e.msg="invalid literal/lengths set",n.mode=ve;break}if(n.distbits=6,n.distcode=n.distdyn,N={bits:n.distbits},z=mi(kp,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,N),n.distbits=N.bits,z){e.msg="invalid distances set",n.mode=ve;break}if(n.mode=ko,t===xo)break e;case ko:n.mode=So;case So:if(s>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=d,dy(e,g),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,d=n.bits,n.mode===Zt&&(n.back=-1);break}for(n.back=0;x=n.lencode[u&(1<>>24,h=x>>>16&255,y=x&65535,!(c<=d);){if(s===0)break e;s--,u+=r[o++]<>k)],c=x>>>24,h=x>>>16&255,y=x&65535,!(k+c<=d);){if(s===0)break e;s--,u+=r[o++]<>>=k,d-=k,n.back+=k}if(u>>>=c,d-=c,n.back+=c,n.length=y,h===0){n.mode=xf;break}if(h&32){n.back=-1,n.mode=Zt;break}if(h&64){e.msg="invalid literal/length code",n.mode=ve;break}n.extra=h&15,n.mode=_f;case _f:if(n.extra){for(Z=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=yf;case yf:for(;x=n.distcode[u&(1<>>24,h=x>>>16&255,y=x&65535,!(c<=d);){if(s===0)break e;s--,u+=r[o++]<>k)],c=x>>>24,h=x>>>16&255,y=x&65535,!(k+c<=d);){if(s===0)break e;s--,u+=r[o++]<>>=k,d-=k,n.back+=k}if(u>>>=c,d-=c,n.back+=c,h&64){e.msg="invalid distance code",n.mode=ve;break}n.offset=y,n.extra=h&15,n.mode=vf;case vf:if(n.extra){for(Z=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=ve;break}n.mode=wf;case wf:if(l===0)break e;if(f=g-l,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=ve;break}f>n.wnext?(f-=n.wnext,_=n.wsize-f):_=n.wnext-f,f>n.length&&(f=n.length),p=n.window}else p=i,_=a-n.offset,f=n.length;f>l&&(f=l),l-=f,n.length-=f;do i[a++]=p[_++];while(--f);n.length===0&&(n.mode=So);break;case xf:if(l===0)break e;i[a++]=n.length,l--,n.mode=So;break;case ps:if(n.wrap){for(;d<32;){if(s===0)break e;s--,u|=r[o++]<{if(Xn(e))return xt;let t=e.state;return t.window&&(t.window=null),e.state=null,Kn},Ny=(e,t)=>{if(Xn(e))return xt;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Kn):xt},Py=(e,t)=>{const n=t.length;let r,i,o;return Xn(e)||(r=e.state,r.wrap!==0&&r.mode!==fa)?xt:r.mode===fa&&(i=1,i=Fi(i,t,n,0),i!==r.check)?Sp:(o=Ip(e,t,n,n),o?(r.mode=Ep,bp):(r.havedict=1,Kn))};var Dy=Tp,Ly=Rp,Oy=Ap,Fy=Ty,My=zp,By=zy,Uy=Iy,jy=Ny,$y=Py,Hy="pako inflate (from Nodeca project)",Kt={inflateReset:Dy,inflateReset2:Ly,inflateResetKeep:Oy,inflateInit:Fy,inflateInit2:My,inflate:By,inflateEnd:Uy,inflateGetHeader:jy,inflateSetDictionary:$y,inflateInfo:Hy};function Zy(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Wy=Zy;const Np=Object.prototype.toString,{Z_NO_FLUSH:Vy,Z_FINISH:Gy,Z_OK:Ui,Z_STREAM_END:_s,Z_NEED_DICT:ys,Z_STREAM_ERROR:Ky,Z_DATA_ERROR:Cf,Z_MEM_ERROR:Qy}=Lr;function Qi(e){this.options=Ra.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new vp,this.strm.avail_out=0;let n=Kt.inflateInit2(this.strm,t.windowBits);if(n!==Ui)throw new Error(Vn[n]);if(this.header=new Wy,Kt.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Bi.string2buf(t.dictionary):Np.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Kt.inflateSetDictionary(this.strm,t.dictionary),n!==Ui)))throw new Error(Vn[n])}Qi.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?Gy:Vy,Np.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=Kt.inflate(n,a),o===ys&&i&&(o=Kt.inflateSetDictionary(n,i),o===Ui?o=Kt.inflate(n,a):o===Cf&&(o=ys));n.avail_in>0&&o===_s&&n.state.wrap>0&&e[n.next_in]!==0;)Kt.inflateReset(n),o=Kt.inflate(n,a);switch(o){case Ky:case Cf:case ys:case Qy:return this.onEnd(o),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||o===_s))if(this.options.to==="string"){let l=Bi.utf8border(n.output,n.next_out),u=n.next_out-l,d=Bi.buf2string(n.output,l);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(l,l+u),0),this.onData(d)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===Ui&&s===0)){if(o===_s)return o=Kt.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Qi.prototype.onData=function(e){this.chunks.push(e)};Qi.prototype.onEnd=function(e){e===Ui&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ra.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Eu(e,t){const n=new Qi(t);if(n.push(e),n.err)throw n.msg||Vn[n.err];return n.result}function Yy(e,t){return t=t||{},t.raw=!0,Eu(e,t)}var Xy=Qi,qy=Eu,Jy=Yy,ev=Eu,tv=Lr,nv={Inflate:Xy,inflate:qy,inflateRaw:Jy,ungzip:ev,constants:tv};const{Deflate:vv,deflate:rv,deflateRaw:wv,gzip:xv}=cy,{Inflate:iv,inflate:kv,inflateRaw:Sv,ungzip:bv}=nv;var ov=rv,av=iv;class Pp{constructor(t,n=!1,r=!0){this.device=t,this.tracing=n,this.slipReaderEnabled=!1,this.leftOver=new Uint8Array(0),this.baudrate=0,this.traceLog="",this.lastTraceTime=Date.now(),this._DTR_state=!1,this.slipReaderEnabled=r}getInfo(){const t=this.device.getInfo();return t.usbVendorId&&t.usbProductId?`WebSerial VendorID 0x${t.usbVendorId.toString(16)} ProductID 0x${t.usbProductId.toString(16)}`:""}getPid(){return this.device.getInfo().usbProductId}trace(t){const i=`${`TRACE ${(Date.now()-this.lastTraceTime).toFixed(3)}`} ${t}`;console.log(i),this.traceLog+=i+` +\0`,q+=o(P,2),q+=T.magic,q+=o(y,2),q+=o(k,2),q+=o(K.crc32,4),q+=o(K.compressedSize,4),q+=o(K.uncompressedSize,4),q+=o(z.length,2),q+=o(U.length,2),{fileRecord:v.LOCAL_FILE_HEADER+q+z+U,dirRecord:v.CENTRAL_FILE_HEADER+o(te,2)+q+o(Z.length,2)+"\0\0\0\0"+o(D,4)+o(x,4)+z+U+Z}}var s=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),v=n("../signature");function g(f,_,p,x){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=_,this.zipPlatform=p,this.encodeFileName=x,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(g,l),g.prototype.push=function(f){var _=f.meta.percent||0,p=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:p?(_+100*(p-x-1))/p:100}}))},g.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var _=this.streamFiles&&!f.file.dir;if(_){var p=a(f,_,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},g.prototype.closedSource=function(f){this.accumulate=!1;var _=this.streamFiles&&!f.file.dir,p=a(f,_,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),_)this.push({data:function(x){return v.DATA_DESCRIPTOR+o(x.crc32,4)+o(x.compressedSize,4)+o(x.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},g.prototype.flush=function(){for(var f=this.bytesWritten,_=0;_=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=s,u},readString:function(s){return o.transformTo("string",this.readData(s))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var s=this.readInt(4);return new Date(Date.UTC(1980+(s>>25&127),(s>>21&15)-1,s>>16&31,s>>11&31,s>>5&63,(31&s)<<1))}},r.exports=a},{"../utils":32}],19:[function(n,r,i){var o=n("./Uint8ArrayReader");function a(s){o.call(this,s)}n("../utils").inherits(a,o),a.prototype.readData=function(s){this.checkOffset(s);var l=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,i){var o=n("./DataReader");function a(s){o.call(this,s)}n("../utils").inherits(a,o),a.prototype.byteAt=function(s){return this.data.charCodeAt(this.zero+s)},a.prototype.lastIndexOfSignature=function(s){return this.data.lastIndexOf(s)-this.zero},a.prototype.readAndCheckSignature=function(s){return s===this.readData(4)},a.prototype.readData=function(s){this.checkOffset(s);var l=this.data.slice(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(n,r,i){var o=n("./ArrayReader");function a(s){o.call(this,s)}n("../utils").inherits(a,o),a.prototype.readData=function(s){if(this.checkOffset(s),s===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+s);return this.index+=s,l},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,i){var o=n("../utils"),a=n("../support"),s=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(v){var g=o.getTypeOf(v);return o.checkSupport(g),g!=="string"||a.uint8array?g==="nodebuffer"?new u(v):a.uint8array?new d(o.transformTo("uint8array",v)):new s(o.transformTo("array",v)):new l(v)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,i){var o=n("./GenericWorker"),a=n("../utils");function s(l){o.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(s,o),s.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},r.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,i){var o=n("./GenericWorker"),a=n("../crc32");function s(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(s,o),s.prototype.processChunk=function(l){this.streamInfo.crc32=a(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,i){var o=n("../utils"),a=n("./GenericWorker");function s(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}o.inherits(s,a),s.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}a.prototype.processChunk.call(this,l)},r.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,i){var o=n("../utils"),a=n("./GenericWorker");function s(l){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=o.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}o.inherits(s,a),s.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,i){function o(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,s){return this._listeners[a].push(s),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,s){if(this._listeners[a])for(var l=0;l "+a:a}},r.exports=o},{}],29:[function(n,r,i){var o=n("../utils"),a=n("./ConvertWorker"),s=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),v=null;if(u.nodestream)try{v=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function g(_,p){return new d.Promise(function(x,c){var h=[],y=_._internalType,k=_._outputType,S=_._mimeType;_.on("data",function(T,A){h.push(T),p&&p(A)}).on("error",function(T){h=[],c(T)}).on("end",function(){try{var T=function(A,z,R){switch(A){case"blob":return o.newBlob(o.transformTo("arraybuffer",z),R);case"base64":return l.encode(z);default:return o.transformTo(A,z)}}(k,function(A,z){var R,N=0,Z=null,E=0;for(R=0;R"u")i.blob=!1;else{var o=new ArrayBuffer(0);try{i.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(o),i.blob=a.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,i){for(var o=n("./utils"),a=n("./support"),s=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function v(){l.call(this,"utf-8 decode"),this.leftOver=null}function g(){l.call(this,"utf-8 encode")}i.utf8encode=function(f){return a.nodebuffer?s.newBufferFrom(f,"utf-8"):function(_){var p,x,c,h,y,k=_.length,S=0;for(h=0;h>>6:(x<65536?p[y++]=224|x>>>12:(p[y++]=240|x>>>18,p[y++]=128|x>>>12&63),p[y++]=128|x>>>6&63),p[y++]=128|63&x);return p}(f)},i.utf8decode=function(f){return a.nodebuffer?o.transformTo("nodebuffer",f).toString("utf-8"):function(_){var p,x,c,h,y=_.length,k=new Array(2*y);for(p=x=0;p>10&1023,k[x++]=56320|1023&c)}return k.length!==x&&(k.subarray?k=k.subarray(0,x):k.length=x),o.applyFromCharCode(k)}(f=o.transformTo(a.uint8array?"uint8array":"array",f))},o.inherits(v,l),v.prototype.processChunk=function(f){var _=o.transformTo(a.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var p=_;(_=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),_.set(p,this.leftOver.length)}else _=this.leftOver.concat(_);this.leftOver=null}var x=function(h,y){var k;for((y=y||h.length)>h.length&&(y=h.length),k=y-1;0<=k&&(192&h[k])==128;)k--;return k<0||k===0?y:k+u[h[k]]>y?k:y}(_),c=_;x!==_.length&&(a.uint8array?(c=_.subarray(0,x),this.leftOver=_.subarray(x,_.length)):(c=_.slice(0,x),this.leftOver=_.slice(x,_.length))),this.push({data:i.utf8decode(c),meta:f.meta})},v.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=v,o.inherits(g,l),g.prototype.processChunk=function(f){this.push({data:i.utf8encode(f.data),meta:f.meta})},i.Utf8EncodeWorker=g},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,i){var o=n("./support"),a=n("./base64"),s=n("./nodejsUtils"),l=n("./external");function u(p){return p}function d(p,x){for(var c=0;c>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=o(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var _,p,x,c=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4>>6:(f<65536?g[x++]=224|f>>>12:(g[x++]=240|f>>>18,g[x++]=128|f>>>12&63),g[x++]=128|f>>>6&63),g[x++]=128|63&f);return g},i.buf2binstring=function(v){return d(v,v.length)},i.binstring2buf=function(v){for(var g=new o.Buf8(v.length),f=0,_=g.length;f<_;f++)g[f]=v.charCodeAt(f);return g},i.buf2string=function(v,g){var f,_,p,x,c=g||v.length,h=new Array(2*c);for(f=_=0;f>10&1023,h[_++]=56320|1023&p)}return d(h,_)},i.utf8border=function(v,g){var f;for((g=g||v.length)>v.length&&(g=v.length),f=g-1;0<=f&&(192&v[f])==128;)f--;return f<0||f===0?g:f+l[v[f]]>g?f:g}},{"./common":41}],43:[function(n,r,i){r.exports=function(o,a,s,l){for(var u=65535&o|0,d=o>>>16&65535|0,v=0;s!==0;){for(s-=v=2e3>>1:a>>>1;s[l]=a}return s}();r.exports=function(a,s,l,u){var d=o,v=u+l;a^=-1;for(var g=u;g>>8^d[255&(a^s[g])];return-1^a}},{}],46:[function(n,r,i){var o,a=n("../utils/common"),s=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),v=0,g=4,f=0,_=-2,p=-1,x=4,c=2,h=8,y=9,k=286,S=30,T=19,A=2*k+1,z=15,R=3,N=258,Z=N+R+1,E=42,B=113,w=1,U=2,ne=3,W=4;function $(m,j){return m.msg=d[j],j}function F(m){return(m<<1)-(4m.avail_out&&(M=m.avail_out),M!==0&&(a.arraySet(m.output,j.pending_buf,j.pending_out,M,m.next_out),m.next_out+=M,j.pending_out+=M,m.total_out+=M,m.avail_out-=M,j.pending-=M,j.pending===0&&(j.pending_out=0))}function D(m,j){s._tr_flush_block(m,0<=m.block_start?m.block_start:-1,m.strstart-m.block_start,j),m.block_start=m.strstart,P(m.strm)}function te(m,j){m.pending_buf[m.pending++]=j}function q(m,j){m.pending_buf[m.pending++]=j>>>8&255,m.pending_buf[m.pending++]=255&j}function X(m,j){var M,C,b=m.max_chain_length,I=m.strstart,H=m.prev_length,V=m.nice_match,L=m.strstart>m.w_size-Z?m.strstart-(m.w_size-Z):0,Q=m.window,J=m.w_mask,Y=m.prev,re=m.strstart+N,pe=Q[I+H-1],le=Q[I+H];m.prev_length>=m.good_match&&(b>>=2),V>m.lookahead&&(V=m.lookahead);do if(Q[(M=j)+H]===le&&Q[M+H-1]===pe&&Q[M]===Q[I]&&Q[++M]===Q[I+1]){I+=2,M++;do;while(Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&Q[++I]===Q[++M]&&IL&&--b!=0);return H<=m.lookahead?H:m.lookahead}function de(m){var j,M,C,b,I,H,V,L,Q,J,Y=m.w_size;do{if(b=m.window_size-m.lookahead-m.strstart,m.strstart>=Y+(Y-Z)){for(a.arraySet(m.window,m.window,Y,Y,0),m.match_start-=Y,m.strstart-=Y,m.block_start-=Y,j=M=m.hash_size;C=m.head[--j],m.head[j]=Y<=C?C-Y:0,--M;);for(j=M=Y;C=m.prev[--j],m.prev[j]=Y<=C?C-Y:0,--M;);b+=Y}if(m.strm.avail_in===0)break;if(H=m.strm,V=m.window,L=m.strstart+m.lookahead,Q=b,J=void 0,J=H.avail_in,Q=R)for(I=m.strstart-m.insert,m.ins_h=m.window[I],m.ins_h=(m.ins_h<=R&&(m.ins_h=(m.ins_h<=R)if(C=s._tr_tally(m,m.strstart-m.match_start,m.match_length-R),m.lookahead-=m.match_length,m.match_length<=m.max_lazy_match&&m.lookahead>=R){for(m.match_length--;m.strstart++,m.ins_h=(m.ins_h<=R&&(m.ins_h=(m.ins_h<=R&&m.match_length<=m.prev_length){for(b=m.strstart+m.lookahead-R,C=s._tr_tally(m,m.strstart-1-m.prev_match,m.prev_length-R),m.lookahead-=m.prev_length-1,m.prev_length-=2;++m.strstart<=b&&(m.ins_h=(m.ins_h<m.pending_buf_size-5&&(M=m.pending_buf_size-5);;){if(m.lookahead<=1){if(de(m),m.lookahead===0&&j===v)return w;if(m.lookahead===0)break}m.strstart+=m.lookahead,m.lookahead=0;var C=m.block_start+M;if((m.strstart===0||m.strstart>=C)&&(m.lookahead=m.strstart-C,m.strstart=C,D(m,!1),m.strm.avail_out===0)||m.strstart-m.block_start>=m.w_size-Z&&(D(m,!1),m.strm.avail_out===0))return w}return m.insert=0,j===g?(D(m,!0),m.strm.avail_out===0?ne:W):(m.strstart>m.block_start&&(D(m,!1),m.strm.avail_out),w)}),new fe(4,4,8,4,Ce),new fe(4,5,16,8,Ce),new fe(4,6,32,32,Ce),new fe(4,4,16,16,se),new fe(8,16,32,32,se),new fe(8,16,128,128,se),new fe(8,32,128,256,se),new fe(32,128,258,1024,se),new fe(32,258,258,4096,se)],i.deflateInit=function(m,j){return kt(m,j,h,15,8,0)},i.deflateInit2=kt,i.deflateReset=It,i.deflateResetKeep=Ae,i.deflateSetHeader=function(m,j){return m&&m.state?m.state.wrap!==2?_:(m.state.gzhead=j,f):_},i.deflate=function(m,j){var M,C,b,I;if(!m||!m.state||5>8&255),te(C,C.gzhead.time>>16&255),te(C,C.gzhead.time>>24&255),te(C,C.level===9?2:2<=C.strategy||C.level<2?4:0),te(C,255&C.gzhead.os),C.gzhead.extra&&C.gzhead.extra.length&&(te(C,255&C.gzhead.extra.length),te(C,C.gzhead.extra.length>>8&255)),C.gzhead.hcrc&&(m.adler=u(m.adler,C.pending_buf,C.pending,0)),C.gzindex=0,C.status=69):(te(C,0),te(C,0),te(C,0),te(C,0),te(C,0),te(C,C.level===9?2:2<=C.strategy||C.level<2?4:0),te(C,3),C.status=B);else{var H=h+(C.w_bits-8<<4)<<8;H|=(2<=C.strategy||C.level<2?0:C.level<6?1:C.level===6?2:3)<<6,C.strstart!==0&&(H|=32),H+=31-H%31,C.status=B,q(C,H),C.strstart!==0&&(q(C,m.adler>>>16),q(C,65535&m.adler)),m.adler=1}if(C.status===69)if(C.gzhead.extra){for(b=C.pending;C.gzindex<(65535&C.gzhead.extra.length)&&(C.pending!==C.pending_buf_size||(C.gzhead.hcrc&&C.pending>b&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),P(m),b=C.pending,C.pending!==C.pending_buf_size));)te(C,255&C.gzhead.extra[C.gzindex]),C.gzindex++;C.gzhead.hcrc&&C.pending>b&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),C.gzindex===C.gzhead.extra.length&&(C.gzindex=0,C.status=73)}else C.status=73;if(C.status===73)if(C.gzhead.name){b=C.pending;do{if(C.pending===C.pending_buf_size&&(C.gzhead.hcrc&&C.pending>b&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),P(m),b=C.pending,C.pending===C.pending_buf_size)){I=1;break}I=C.gzindexb&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),I===0&&(C.gzindex=0,C.status=91)}else C.status=91;if(C.status===91)if(C.gzhead.comment){b=C.pending;do{if(C.pending===C.pending_buf_size&&(C.gzhead.hcrc&&C.pending>b&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),P(m),b=C.pending,C.pending===C.pending_buf_size)){I=1;break}I=C.gzindexb&&(m.adler=u(m.adler,C.pending_buf,C.pending-b,b)),I===0&&(C.status=103)}else C.status=103;if(C.status===103&&(C.gzhead.hcrc?(C.pending+2>C.pending_buf_size&&P(m),C.pending+2<=C.pending_buf_size&&(te(C,255&m.adler),te(C,m.adler>>8&255),m.adler=0,C.status=B)):C.status=B),C.pending!==0){if(P(m),m.avail_out===0)return C.last_flush=-1,f}else if(m.avail_in===0&&F(j)<=F(M)&&j!==g)return $(m,-5);if(C.status===666&&m.avail_in!==0)return $(m,-5);if(m.avail_in!==0||C.lookahead!==0||j!==v&&C.status!==666){var V=C.strategy===2?function(L,Q){for(var J;;){if(L.lookahead===0&&(de(L),L.lookahead===0)){if(Q===v)return w;break}if(L.match_length=0,J=s._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++,J&&(D(L,!1),L.strm.avail_out===0))return w}return L.insert=0,Q===g?(D(L,!0),L.strm.avail_out===0?ne:W):L.last_lit&&(D(L,!1),L.strm.avail_out===0)?w:U}(C,j):C.strategy===3?function(L,Q){for(var J,Y,re,pe,le=L.window;;){if(L.lookahead<=N){if(de(L),L.lookahead<=N&&Q===v)return w;if(L.lookahead===0)break}if(L.match_length=0,L.lookahead>=R&&0L.lookahead&&(L.match_length=L.lookahead)}if(L.match_length>=R?(J=s._tr_tally(L,1,L.match_length-R),L.lookahead-=L.match_length,L.strstart+=L.match_length,L.match_length=0):(J=s._tr_tally(L,0,L.window[L.strstart]),L.lookahead--,L.strstart++),J&&(D(L,!1),L.strm.avail_out===0))return w}return L.insert=0,Q===g?(D(L,!0),L.strm.avail_out===0?ne:W):L.last_lit&&(D(L,!1),L.strm.avail_out===0)?w:U}(C,j):o[C.level].func(C,j);if(V!==ne&&V!==W||(C.status=666),V===w||V===ne)return m.avail_out===0&&(C.last_flush=-1),f;if(V===U&&(j===1?s._tr_align(C):j!==5&&(s._tr_stored_block(C,0,0,!1),j===3&&(K(C.head),C.lookahead===0&&(C.strstart=0,C.block_start=0,C.insert=0))),P(m),m.avail_out===0))return C.last_flush=-1,f}return j!==g?f:C.wrap<=0?1:(C.wrap===2?(te(C,255&m.adler),te(C,m.adler>>8&255),te(C,m.adler>>16&255),te(C,m.adler>>24&255),te(C,255&m.total_in),te(C,m.total_in>>8&255),te(C,m.total_in>>16&255),te(C,m.total_in>>24&255)):(q(C,m.adler>>>16),q(C,65535&m.adler)),P(m),0=M.w_size&&(I===0&&(K(M.head),M.strstart=0,M.block_start=0,M.insert=0),Q=new a.Buf8(M.w_size),a.arraySet(Q,j,J-M.w_size,M.w_size,0),j=Q,J=M.w_size),H=m.avail_in,V=m.next_in,L=m.input,m.avail_in=J,m.next_in=0,m.input=j,de(M);M.lookahead>=R;){for(C=M.strstart,b=M.lookahead-(R-1);M.ins_h=(M.ins_h<>>=R=z>>>24,y-=R,(R=z>>>16&255)===0)U[d++]=65535&z;else{if(!(16&R)){if(!(64&R)){z=k[(65535&z)+(h&(1<>>=R,y-=R),y<15&&(h+=w[l++]<>>=R=z>>>24,y-=R,!(16&(R=z>>>16&255))){if(!(64&R)){z=S[(65535&z)+(h&(1<>>=R,y-=R,(R=d-v)>3,h&=(1<<(y-=N<<3))-1,o.next_in=l,o.next_out=d,o.avail_in=l>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function h(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(E){var B;return E&&E.state?(B=E.state,E.total_in=E.total_out=B.total=0,E.msg="",B.wrap&&(E.adler=1&B.wrap),B.mode=_,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new o.Buf32(p),B.distcode=B.distdyn=new o.Buf32(x),B.sane=1,B.back=-1,g):f}function k(E){var B;return E&&E.state?((B=E.state).wsize=0,B.whave=0,B.wnext=0,y(E)):f}function S(E,B){var w,U;return E&&E.state?(U=E.state,B<0?(w=0,B=-B):(w=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=W.wsize?(o.arraySet(W.window,B,w-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(U<(ne=W.wsize-W.wnext)&&(ne=U),o.arraySet(W.window,B,w-U,ne,W.wnext),(U-=ne)?(o.arraySet(W.window,B,w-U,U,0),W.wnext=U,W.whave=W.wsize):(W.wnext+=ne,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,w.check=s(w.check,I,2,0),D=P=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&P)<<8)+(P>>8))%31){E.msg="incorrect header check",w.mode=30;break}if((15&P)!=8){E.msg="unknown compression method",w.mode=30;break}if(D-=4,m=8+(15&(P>>>=4)),w.wbits===0)w.wbits=m;else if(m>w.wbits){E.msg="invalid window size",w.mode=30;break}w.dmax=1<>8&1),512&w.flags&&(I[0]=255&P,I[1]=P>>>8&255,w.check=s(w.check,I,2,0)),D=P=0,w.mode=3;case 3:for(;D<32;){if(F===0)break e;F--,P+=U[W++]<>>8&255,I[2]=P>>>16&255,I[3]=P>>>24&255,w.check=s(w.check,I,4,0)),D=P=0,w.mode=4;case 4:for(;D<16;){if(F===0)break e;F--,P+=U[W++]<>8),512&w.flags&&(I[0]=255&P,I[1]=P>>>8&255,w.check=s(w.check,I,2,0)),D=P=0,w.mode=5;case 5:if(1024&w.flags){for(;D<16;){if(F===0)break e;F--,P+=U[W++]<>>8&255,w.check=s(w.check,I,2,0)),D=P=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(F<(X=w.length)&&(X=F),X&&(w.head&&(m=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),o.arraySet(w.head.extra,U,W,X,m)),512&w.flags&&(w.check=s(w.check,U,X,W)),F-=X,W+=X,w.length-=X),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(F===0)break e;for(X=0;m=U[W+X++],w.head&&m&&w.length<65536&&(w.head.name+=String.fromCharCode(m)),m&&X>9&1,w.head.done=!0),E.adler=w.check=0,w.mode=12;break;case 10:for(;D<32;){if(F===0)break e;F--,P+=U[W++]<>>=7&D,D-=7&D,w.mode=27;break}for(;D<3;){if(F===0)break e;F--,P+=U[W++]<>>=1)){case 0:w.mode=14;break;case 1:if(N(w),w.mode=20,B!==6)break;P>>>=2,D-=2;break e;case 2:w.mode=17;break;case 3:E.msg="invalid block type",w.mode=30}P>>>=2,D-=2;break;case 14:for(P>>>=7&D,D-=7&D;D<32;){if(F===0)break e;F--,P+=U[W++]<>>16^65535)){E.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&P,D=P=0,w.mode=15,B===6)break e;case 15:w.mode=16;case 16:if(X=w.length){if(F>>=5,D-=5,w.ndist=1+(31&P),P>>>=5,D-=5,w.ncode=4+(15&P),P>>>=4,D-=4,286>>=3,D-=3}for(;w.have<19;)w.lens[H[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,M={bits:w.lenbits},j=u(0,w.lens,0,19,w.lencode,0,w.work,M),w.lenbits=M.bits,j){E.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have>>16&255,De=65535&b,!((se=b>>>24)<=D);){if(F===0)break e;F--,P+=U[W++]<>>=se,D-=se,w.lens[w.have++]=De;else{if(De===16){for(C=se+2;D>>=se,D-=se,w.have===0){E.msg="invalid bit length repeat",w.mode=30;break}m=w.lens[w.have-1],X=3+(3&P),P>>>=2,D-=2}else if(De===17){for(C=se+3;D>>=se)),P>>>=3,D-=3}else{for(C=se+7;D>>=se)),P>>>=7,D-=7}if(w.have+X>w.nlen+w.ndist){E.msg="invalid bit length repeat",w.mode=30;break}for(;X--;)w.lens[w.have++]=m}}if(w.mode===30)break;if(w.lens[256]===0){E.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,M={bits:w.lenbits},j=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,M),w.lenbits=M.bits,j){E.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,M={bits:w.distbits},j=u(v,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,M),w.distbits=M.bits,j){E.msg="invalid distances set",w.mode=30;break}if(w.mode=20,B===6)break e;case 20:w.mode=21;case 21:if(6<=F&&258<=K){E.next_out=$,E.avail_out=K,E.next_in=W,E.avail_in=F,w.hold=P,w.bits=D,l(E,q),$=E.next_out,ne=E.output,K=E.avail_out,W=E.next_in,U=E.input,F=E.avail_in,P=w.hold,D=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;fe=(b=w.lencode[P&(1<>>16&255,De=65535&b,!((se=b>>>24)<=D);){if(F===0)break e;F--,P+=U[W++]<>Ae)])>>>16&255,De=65535&b,!(Ae+(se=b>>>24)<=D);){if(F===0)break e;F--,P+=U[W++]<>>=Ae,D-=Ae,w.back+=Ae}if(P>>>=se,D-=se,w.back+=se,w.length=De,fe===0){w.mode=26;break}if(32&fe){w.back=-1,w.mode=12;break}if(64&fe){E.msg="invalid literal/length code",w.mode=30;break}w.extra=15&fe,w.mode=22;case 22:if(w.extra){for(C=w.extra;D>>=w.extra,D-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;fe=(b=w.distcode[P&(1<>>16&255,De=65535&b,!((se=b>>>24)<=D);){if(F===0)break e;F--,P+=U[W++]<>Ae)])>>>16&255,De=65535&b,!(Ae+(se=b>>>24)<=D);){if(F===0)break e;F--,P+=U[W++]<>>=Ae,D-=Ae,w.back+=Ae}if(P>>>=se,D-=se,w.back+=se,64&fe){E.msg="invalid distance code",w.mode=30;break}w.offset=De,w.extra=15&fe,w.mode=24;case 24:if(w.extra){for(C=w.extra;D>>=w.extra,D-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){E.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(K===0)break e;if(X=q-K,w.offset>X){if((X=w.offset-X)>w.whave&&w.sane){E.msg="invalid distance too far back",w.mode=30;break}de=X>w.wnext?(X-=w.wnext,w.wsize-X):w.wnext-X,X>w.length&&(X=w.length),Ce=w.window}else Ce=ne,de=$-w.offset,X=w.length;for(KA?(R=de[Ce+x[B]],D[te+x[B]]):(R=96,0),h=1<>$)+(y-=h)]=z<<24|R<<16|N|0,y!==0;);for(h=1<>=1;if(h!==0?(P&=h-1,P+=h):P=0,B++,--q[E]==0){if(E===U)break;E=v[g+x[B]]}if(ne>>7)]}function te(b,I){b.pending_buf[b.pending++]=255&I,b.pending_buf[b.pending++]=I>>>8&255}function q(b,I,H){b.bi_valid>c-H?(b.bi_buf|=I<>c-b.bi_valid,b.bi_valid+=H-c):(b.bi_buf|=I<>>=1,H<<=1,0<--I;);return H>>>1}function Ce(b,I,H){var V,L,Q=new Array(x+1),J=0;for(V=1;V<=x;V++)Q[V]=J=J+H[V-1]<<1;for(L=0;L<=I;L++){var Y=b[2*L+1];Y!==0&&(b[2*L]=de(Q[Y]++,Y))}}function se(b){var I;for(I=0;I>1;1<=H;H--)Ae(b,Q,H);for(L=re;H=b.heap[1],b.heap[1]=b.heap[b.heap_len--],Ae(b,Q,1),V=b.heap[1],b.heap[--b.heap_max]=H,b.heap[--b.heap_max]=V,Q[2*L]=Q[2*H]+Q[2*V],b.depth[L]=(b.depth[H]>=b.depth[V]?b.depth[H]:b.depth[V])+1,Q[2*H+1]=Q[2*V+1]=L,b.heap[1]=L++,Ae(b,Q,1),2<=b.heap_len;);b.heap[--b.heap_max]=b.heap[1],function(le,ht){var Mr,Nt,Br,Te,Yi,Ia,$t=ht.dyn_tree,Cu=ht.max_code,Lp=ht.stat_desc.static_tree,Op=ht.stat_desc.has_stree,Fp=ht.stat_desc.extra_bits,Au=ht.stat_desc.extra_base,Ur=ht.stat_desc.max_length,Xi=0;for(Te=0;Te<=x;Te++)le.bl_count[Te]=0;for($t[2*le.heap[le.heap_max]+1]=0,Mr=le.heap_max+1;Mr>=7;L>>=1)if(1&pe&&Y.dyn_ltree[2*re]!==0)return a;if(Y.dyn_ltree[18]!==0||Y.dyn_ltree[20]!==0||Y.dyn_ltree[26]!==0)return s;for(re=32;re>>3,(Q=b.static_len+3+7>>>3)<=L&&(L=Q)):L=Q=H+5,H+4<=L&&I!==-1?C(b,I,H,V):b.strategy===4||Q===L?(q(b,2+(V?1:0),3),It(b,Z,E)):(q(b,4+(V?1:0),3),function(Y,re,pe,le){var ht;for(q(Y,re-257,5),q(Y,pe-1,5),q(Y,le-4,4),ht=0;ht>>8&255,b.pending_buf[b.d_buf+2*b.last_lit+1]=255&I,b.pending_buf[b.l_buf+b.last_lit]=255&H,b.last_lit++,I===0?b.dyn_ltree[2*H]++:(b.matches++,I--,b.dyn_ltree[2*(w[H]+v+1)]++,b.dyn_dtree[2*D(I)]++),b.last_lit===b.lit_bufsize-1},i._tr_align=function(b){q(b,2,3),X(b,y,Z),function(I){I.bi_valid===16?(te(I,I.bi_buf),I.bi_buf=0,I.bi_valid=0):8<=I.bi_valid&&(I.pending_buf[I.pending++]=255&I.bi_buf,I.bi_buf>>=8,I.bi_valid-=8)}(b)}},{"../utils/common":41}],53:[function(n,r,i){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,i){(function(o){(function(a,s){if(!a.setImmediate){var l,u,d,v,g=1,f={},_=!1,p=a.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(a);x=x&&x.setTimeout?x:a,l={}.toString.call(a.process)==="[object process]"?function(k){process.nextTick(function(){h(k)})}:function(){if(a.postMessage&&!a.importScripts){var k=!0,S=a.onmessage;return a.onmessage=function(){k=!1},a.postMessage("","*"),a.onmessage=S,k}}()?(v="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",y,!1):a.attachEvent("onmessage",y),function(k){a.postMessage(v+k,"*")}):a.MessageChannel?((d=new MessageChannel).port1.onmessage=function(k){h(k.data)},function(k){d.port2.postMessage(k)}):p&&"onreadystatechange"in p.createElement("script")?(u=p.documentElement,function(k){var S=p.createElement("script");S.onreadystatechange=function(){h(k),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(k){setTimeout(h,0,k)},x.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var S=new Array(arguments.length-1),T=0;T"u"?o===void 0?this:o:self)}).call(this,typeof qi<"u"?qi:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Xh);var _g=Xh.exports;const yg=kl(_g);function yo({label:e,icon:t,file:n,onChange:r,accept:i=".bin"}){const o=lt.useRef(null),[a,s]=lt.useState(!1),[l,u]=lt.useState(!1),d=p=>{p.preventDefault(),p.stopPropagation(),s(!0)},v=p=>{p.preventDefault(),p.stopPropagation(),s(!1),u(!1)},g=p=>{p.preventDefault(),p.stopPropagation()},f=p=>{p.preventDefault(),p.stopPropagation(),s(!1);const x=p.dataTransfer.files[0];if(!x)return;const c=i.split(",")[0].replace("*","");if(!x.name.endsWith(c)){u(!0),setTimeout(()=>u(!1),2e3);return}r(x)},_=p=>{var c;const x=(c=p.target.files)==null?void 0:c[0];x&&r(x)};return O.jsxs("div",{onDragEnter:d,onDragLeave:v,onDragOver:g,onDrop:f,className:la("flex flex-col items-center gap-4 rounded-lg p-6 transition-colors duration-200",n?"bg-gray-800/50":"bg-gray-800/30",a&&!l&&"bg-blue-900/20 border-2 border-dashed border-blue-500",l&&"bg-red-900/20 border-2 border-dashed border-red-500","relative"),children:[O.jsx("input",{ref:o,type:"file",accept:i,onChange:_,className:"hidden"}),l?O.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-gray-900/95 rounded-lg",children:[O.jsx(z1,{className:"h-8 w-8 text-red-500 mb-2"}),O.jsx("p",{className:"text-sm text-red-400",children:"Invalid file type"})]}):n?O.jsx($h,{className:"h-8 w-8 text-blue-500"}):a?O.jsx(A1,{className:"h-8 w-8 text-blue-500"}):O.jsx("div",{className:"h-8 w-8 text-gray-600",children:t}),O.jsx("div",{className:"text-center",children:n?O.jsxs(O.Fragment,{children:[O.jsx("p",{className:"text-sm text-gray-200",children:n.name}),O.jsx("button",{onClick:()=>{var p;return(p=o.current)==null?void 0:p.click()},className:"text-blue-500 hover:text-blue-400",children:"Choose different file"})]}):O.jsxs(O.Fragment,{children:[O.jsx("p",{className:"text-sm text-gray-400",children:e}),O.jsx("button",{onClick:()=>{var p;return(p=o.current)==null?void 0:p.click()},className:"text-blue-500 hover:text-blue-400",children:"Select file"})]})})]})}function vg({onSelectFirmware:e}){const{versions:t,loading:n,error:r}=O1(),[i,o]=lt.useState({bootloader:null,partitionTable:null,application:null,zip:null}),[a,s]=lt.useState("package"),l=async f=>{try{const p=await new yg().loadAsync(f),x=p.file("bootloader.bin"),c=p.file("partitions.bin"),h=p.file("firmware.bin");if(!x||!c||!h)throw new Error("Invalid firmware package - missing required files");const[y,k,S]=await Promise.all([x.async("blob"),c.async("blob"),h.async("blob")]);return{bootloader:new File([y],"bootloader.bin",{type:"application/octet-stream"}),partitionTable:new File([k],"partitions.bin",{type:"application/octet-stream"}),application:new File([S],"firmware.bin",{type:"application/octet-stream"})}}catch(_){throw console.error("Failed to extract firmware files:",_),new Error("Invalid firmware package")}},u=f=>_=>{const p={...i,[f]:_};o(p),e(p)},d=async f=>{try{const _=await l(f);o({bootloader:null,partitionTable:null,application:null,zip:f}),e(_)}catch(_){throw o({bootloader:null,partitionTable:null,application:null,zip:null}),e(null),_}},v=t.flatMap(f=>f.variants.map(_=>({value:_.zipUrl,tooltip:`Version ${f.version} (${_.variant}) - ${new Date(f.date).toLocaleDateString()}`,label:O.jsxs("div",{className:"flex items-center justify-between w-full",children:[O.jsxs("div",{className:"flex-1 truncate",children:[O.jsx("span",{className:"mr-2",children:f.version}),O.jsx("span",{className:"text-gray-400",children:_.variant}),O.jsx("span",{className:"ml-2 text-gray-400 text-xs",children:new Date(f.date).toLocaleDateString()})]}),f.prerelease&&O.jsx(gg,{variant:"warning",className:"ml-2 flex-shrink-0",children:"Pre-release"})]})}))),g=f=>{window.open(f,"_blank")};return O.jsxs("div",{className:"space-y-6",children:[O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsx("h2",{className:"text-xl font-semibold",children:"Select Firmware Files"}),O.jsxs("div",{className:"flex rounded-lg bg-gray-800 p-1",children:[O.jsx("button",{onClick:()=>s("package"),className:la("px-3 py-1.5 text-sm font-medium rounded-md transition-colors",a==="package"?"bg-gray-700 text-white":"text-gray-400 hover:text-white"),children:"Package"}),O.jsx("button",{onClick:()=>s("individual"),className:la("px-3 py-1.5 text-sm font-medium rounded-md transition-colors",a==="individual"?"bg-gray-700 text-white":"text-gray-400 hover:text-white"),children:"Individual Files"})]}),O.jsx(Zh,{options:v,value:"",onChange:f=>g(f),label:n?"Loading...":t.length===0?"No releases available":"Download Release",icon:O.jsx(Hh,{className:"h-4 w-4"}),disabled:n||t.length===0,width:"fixed",dropdownWidth:400})]}),r&&O.jsx("div",{className:"p-3 rounded-lg bg-red-900/50 text-red-200",children:r}),a==="individual"?O.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[O.jsx(yo,{label:"Select Bootloader",icon:O.jsx(v1,{className:"h-full w-full"}),file:i.bootloader,onChange:u("bootloader")}),O.jsx(yo,{label:"Select Partition Table",icon:O.jsx(b1,{className:"h-full w-full"}),file:i.partitionTable,onChange:u("partitionTable")}),O.jsx(yo,{label:"Select Application",icon:O.jsx(_u,{className:"h-full w-full"}),file:i.application,onChange:u("application")})]}):O.jsx(yo,{label:"Select or drop firmware package",icon:O.jsx(h1,{className:"h-full w-full"}),file:i.zip,onChange:d,accept:".zip"})]})}function wg({progress:e,isDeviceConnected:t=!1,eraseFlash:n,onEraseFlashChange:r}){const i=()=>{switch(e.status){case"idle":return O.jsx(g1,{className:"h-6 w-6 text-gray-500"});case"complete":return O.jsx(m1,{className:"h-6 w-6 text-green-500"});case"error":return O.jsx(d1,{className:"h-6 w-6 text-red-500"});default:return O.jsx(k1,{className:"h-6 w-6 animate-spin text-blue-500"})}},o=()=>{if(e.status==="idle"&&!t)return"Connect a device to begin flashing";switch(e.status){case"idle":return"Device connected - Ready to flash";case"connecting":return"Connecting to device...";case"erasing":return"Erasing flash...";case"flashing":return"Writing firmware...";case"verifying":return"Verifying flash...";case"complete":return"Flash complete!";case"error":return e.error||"An error occurred";default:return"Ready to flash"}};return O.jsxs("div",{className:"space-y-4 rounded-lg bg-gray-800/50 p-4",children:[O.jsxs("div",{className:"flex items-center justify-between",children:[O.jsxs("div",{className:"flex items-center gap-3",children:[i(),O.jsx("span",{className:"text-sm font-medium text-gray-200",children:o()})]}),O.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-300",children:[O.jsx("input",{type:"checkbox",checked:n,onChange:a=>r(a.target.checked),disabled:e.status!=="idle",className:"rounded border-gray-600 text-blue-500 focus:ring-blue-500 focus:ring-offset-gray-900"}),"Erase flash"]})]}),e.status!=="idle"&&e.status!=="complete"&&e.status!=="error"&&O.jsxs("div",{className:"space-y-2",children:[O.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-gray-800",children:O.jsx("div",{className:"h-full bg-blue-500 transition-all duration-300",style:{width:`${e.progress}%`}})}),O.jsxs("div",{className:"text-right text-sm text-gray-500",children:[Math.round(e.progress),"%"]})]})]})}const xg="modulepreload",kg=function(e){return"/"+e},Bc={},bt=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),s=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=kg(l),l in Bc)return;Bc[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const v=document.createElement("link");if(v.rel=u?"stylesheet":xg,u||(v.as="script"),v.crossOrigin="",v.href=l,s&&v.setAttribute("nonce",s),document.head.appendChild(v),u)return new Promise((g,f)=>{v.addEventListener("load",g),v.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(a){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a}return i.then(a=>{for(const s of a||[])s.status==="rejected"&&o(s.reason);return t().catch(o)})};class Ve extends Error{}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Sg=4,Uc=0,jc=1,bg=2;function Dr(e){let t=e.length;for(;--t>=0;)e[t]=0}const Eg=0,qh=1,Cg=2,Ag=3,Tg=258,vu=29,Vi=256,Pi=Vi+1+vu,wr=30,wu=19,Jh=2*Pi+1,On=15,os=16,Rg=7,xu=256,ep=16,tp=17,np=18,hl=new Uint8Array([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]),Oo=new Uint8Array([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]),zg=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),rp=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ig=512,Gt=new Array((Pi+2)*2);Dr(Gt);const hi=new Array(wr*2);Dr(hi);const Di=new Array(Ig);Dr(Di);const Li=new Array(Tg-Ag+1);Dr(Li);const ku=new Array(vu);Dr(ku);const ua=new Array(wr);Dr(ua);function as(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}let ip,op,ap;function ss(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const sp=e=>e<256?Di[e]:Di[256+(e>>>7)],Oi=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},et=(e,t,n)=>{e.bi_valid>os-n?(e.bi_buf|=t<>os-e.bi_valid,e.bi_valid+=n-os):(e.bi_buf|=t<{et(e,n[t*2],n[t*2+1])},lp=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},Ng=e=>{e.bi_valid===16?(Oi(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},Pg=(e,t)=>{const n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let u,d,v,g,f,_,p=0;for(g=0;g<=On;g++)e.bl_count[g]=0;for(n[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;ul&&(g=l,p++),n[d*2+1]=g,!(d>r)&&(e.bl_count[g]++,f=0,d>=s&&(f=a[d-s]),_=n[d*2],e.opt_len+=_*(g+f),o&&(e.static_len+=_*(i[d*2+1]+f)));if(p!==0){do{for(g=l-1;e.bl_count[g]===0;)g--;e.bl_count[g]--,e.bl_count[g+1]+=2,e.bl_count[l]--,p-=2}while(p>0);for(g=l;g!==0;g--)for(d=e.bl_count[g];d!==0;)v=e.heap[--u],!(v>r)&&(n[v*2+1]!==g&&(e.opt_len+=(g-n[v*2+1])*n[v*2],n[v*2+1]=g),d--)}},up=(e,t,n)=>{const r=new Array(On+1);let i=0,o,a;for(o=1;o<=On;o++)i=i+n[o-1]<<1,r[o]=i;for(a=0;a<=t;a++){let s=e[a*2+1];s!==0&&(e[a*2]=lp(r[s]++,s))}},Dg=()=>{let e,t,n,r,i;const o=new Array(On+1);for(n=0,r=0;r>=7;r{let t;for(t=0;t{e.bi_valid>8?Oi(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},$c=(e,t,n,r)=>{const i=t*2,o=n*2;return e[i]{const r=e.heap[n];let i=n<<1;for(;i<=e.heap_len&&(i{let r,i,o=0,a,s;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+o++]&255,r+=(e.pending_buf[e.sym_buf+o++]&255)<<8,i=e.pending_buf[e.sym_buf+o++],r===0?Ft(e,i,t):(a=Li[i],Ft(e,a+Vi+1,t),s=hl[a],s!==0&&(i-=ku[a],et(e,i,s)),r--,a=sp(r),Ft(e,a,n),s=Oo[a],s!==0&&(r-=ua[a],et(e,r,s)));while(o{const n=t.dyn_tree,r=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,l=-1,u;for(e.heap_len=0,e.heap_max=Jh,a=0;a>1;a>=1;a--)ls(e,n,a);u=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ls(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,n[u*2]=n[a*2]+n[s*2],e.depth[u]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,n[a*2+1]=n[s*2+1]=u,e.heap[1]=u++,ls(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Pg(e,t),up(n,l,e.bl_count)},Zc=(e,t,n)=>{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)o=a,a=t[(r+1)*2+1],!(++s{let r,i=-1,o,a=t[0*2+1],s=0,l=7,u=4;for(a===0&&(l=138,u=3),r=0;r<=n;r++)if(o=a,a=t[(r+1)*2+1],!(++s{let t;for(Zc(e,e.dyn_ltree,e.l_desc.max_code),Zc(e,e.dyn_dtree,e.d_desc.max_code),pl(e,e.bl_desc),t=wu-1;t>=3&&e.bl_tree[rp[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},Og=(e,t,n,r)=>{let i;for(et(e,t-257,5),et(e,n-1,5),et(e,r-4,4),i=0;i{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Uc;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return jc;for(n=32;n{Vc||(Dg(),Vc=!0),e.l_desc=new ss(e.dyn_ltree,ip),e.d_desc=new ss(e.dyn_dtree,op),e.bl_desc=new ss(e.bl_tree,ap),e.bi_buf=0,e.bi_valid=0,cp(e)},dp=(e,t,n,r)=>{et(e,(Eg<<1)+(r?1:0),3),fp(e),Oi(e,n),Oi(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},Bg=e=>{et(e,qh<<1,3),Ft(e,xu,Gt),Ng(e)},Ug=(e,t,n,r)=>{let i,o,a=0;e.level>0?(e.strm.data_type===bg&&(e.strm.data_type=Fg(e)),pl(e,e.l_desc),pl(e,e.d_desc),a=Lg(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=n+5,n+4<=i&&t!==-1?dp(e,t,n,r):e.strategy===Sg||o===i?(et(e,(qh<<1)+(r?1:0),3),Hc(e,Gt,hi)):(et(e,(Cg<<1)+(r?1:0),3),Og(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Hc(e,e.dyn_ltree,e.dyn_dtree)),cp(e),r&&fp(e)},jg=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(Li[n]+Vi+1)*2]++,e.dyn_dtree[sp(t)*2]++),e.sym_next===e.sym_end);var $g=Mg,Hg=dp,Zg=Ug,Wg=jg,Vg=Bg,Gg={_tr_init:$g,_tr_stored_block:Hg,_tr_flush_block:Zg,_tr_tally:Wg,_tr_align:Vg};const Kg=(e,t,n,r)=>{let i=e&65535|0,o=e>>>16&65535|0,a=0;for(;n!==0;){a=n>2e3?2e3:n,n-=a;do i=i+t[r++]|0,o=o+i|0;while(--a);i%=65521,o%=65521}return i|o<<16|0};var Fi=Kg;const Qg=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},Yg=new Uint32Array(Qg()),Xg=(e,t,n,r)=>{const i=Yg,o=r+n;e^=-1;for(let a=r;a>>8^i[(e^t[a])&255];return e^-1};var Le=Xg,Vn={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Lr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:qg,_tr_stored_block:ml,_tr_flush_block:Jg,_tr_tally:Sn,_tr_align:e_}=Gg,{Z_NO_FLUSH:bn,Z_PARTIAL_FLUSH:t_,Z_FULL_FLUSH:n_,Z_FINISH:gt,Z_BLOCK:Gc,Z_OK:Be,Z_STREAM_END:Kc,Z_STREAM_ERROR:Ut,Z_DATA_ERROR:r_,Z_BUF_ERROR:us,Z_DEFAULT_COMPRESSION:i_,Z_FILTERED:o_,Z_HUFFMAN_ONLY:vo,Z_RLE:a_,Z_FIXED:s_,Z_DEFAULT_STRATEGY:l_,Z_UNKNOWN:u_,Z_DEFLATED:Ta}=Lr,c_=9,f_=15,d_=8,h_=29,p_=256,gl=p_+1+h_,m_=30,g_=19,__=2*gl+1,y_=15,ae=3,pn=258,jt=pn+ae+1,v_=32,Tr=42,Su=57,_l=69,yl=73,vl=91,wl=103,Fn=113,ni=666,Ke=1,Or=2,Gn=3,Fr=4,w_=3,Mn=(e,t)=>(e.msg=Vn[t],t),Qc=e=>e*2-(e>4?9:0),fn=e=>{let t=e.length;for(;--t>=0;)e[t]=0},x_=e=>{let t,n,r,i=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=i?n-i:0;while(--t);t=i,r=t;do n=e.prev[--r],e.prev[r]=n>=i?n-i:0;while(--t)};let k_=(e,t,n)=>(t<{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},st=(e,t)=>{Jg(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,it(e.strm)},ce=(e,t)=>{e.pending_buf[e.pending++]=t},Xr=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},xl=(e,t,n,r)=>{let i=e.avail_in;return i>r&&(i=r),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),n),e.state.wrap===1?e.adler=Fi(e.adler,t,i,n):e.state.wrap===2&&(e.adler=Le(e.adler,t,i,n)),e.next_in+=i,e.total_in+=i,i)},hp=(e,t)=>{let n=e.max_chain_length,r=e.strstart,i,o,a=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-jt?e.strstart-(e.w_size-jt):0,u=e.window,d=e.w_mask,v=e.prev,g=e.strstart+pn;let f=u[r+a-1],_=u[r+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(u[i+a]!==_||u[i+a-1]!==f||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&ra){if(e.match_start=t,a=o,o>=s)break;f=u[r+a-1],_=u[r+a]}}while((t=v[t&d])>l&&--n!==0);return a<=e.lookahead?a:e.lookahead},Rr=e=>{const t=e.w_size;let n,r,i;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-jt)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),x_(e),r+=t),e.strm.avail_in===0)break;if(n=xl(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=ae)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=En(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=En(e,e.ins_h,e.window[i+ae-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,i,o,a=0,s=e.strm.avail_in;do{if(r=65535,o=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(r=i+e.strm.avail_in),r>o&&(r=o),r>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,it(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(xl(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(a===0);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_watero&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(xl(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,n=o>e.w_size?e.w_size:o,i=e.strstart-e.block_start,(i>=n||(i||t===gt)&&t!==bn&&e.strm.avail_in===0&&i<=o)&&(r=i>o?o:i,a=t===gt&&e.strm.avail_in===0&&r===i?1:0,ml(e,e.block_start,r,a),e.block_start+=r,it(e.strm)),a?Gn:Ke)},cs=(e,t)=>{let n,r;for(;;){if(e.lookahead=ae&&(e.ins_h=En(e,e.ins_h,e.window[e.strstart+ae-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-jt&&(e.match_length=hp(e,n)),e.match_length>=ae)if(r=Sn(e,e.strstart-e.match_start,e.match_length-ae),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ae){e.match_length--;do e.strstart++,e.ins_h=En(e,e.ins_h,e.window[e.strstart+ae-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=En(e,e.ins_h,e.window[e.strstart+1]);else r=Sn(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(st(e,!1),e.strm.avail_out===0))return Ke}return e.insert=e.strstart{let n,r,i;for(;;){if(e.lookahead=ae&&(e.ins_h=En(e,e.ins_h,e.window[e.strstart+ae-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=ae-1,n!==0&&e.prev_length4096)&&(e.match_length=ae-1)),e.prev_length>=ae&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-ae,r=Sn(e,e.strstart-1-e.prev_match,e.prev_length-ae),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=En(e,e.ins_h,e.window[e.strstart+ae-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=ae-1,e.strstart++,r&&(st(e,!1),e.strm.avail_out===0))return Ke}else if(e.match_available){if(r=Sn(e,0,e.window[e.strstart-1]),r&&st(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Ke}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=Sn(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let n,r,i,o;const a=e.window;for(;;){if(e.lookahead<=pn){if(Rr(e),e.lookahead<=pn&&t===bn)return Ke;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=ae&&e.strstart>0&&(i=e.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=e.strstart+pn;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=ae?(n=Sn(e,1,e.match_length-ae),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=Sn(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(st(e,!1),e.strm.avail_out===0))return Ke}return e.insert=0,t===gt?(st(e,!0),e.strm.avail_out===0?Gn:Fr):e.sym_next&&(st(e,!1),e.strm.avail_out===0)?Ke:Or},b_=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Rr(e),e.lookahead===0)){if(t===bn)return Ke;break}if(e.match_length=0,n=Sn(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(st(e,!1),e.strm.avail_out===0))return Ke}return e.insert=0,t===gt?(st(e,!0),e.strm.avail_out===0?Gn:Fr):e.sym_next&&(st(e,!1),e.strm.avail_out===0)?Ke:Or};function Dt(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}const ri=[new Dt(0,0,0,0,pp),new Dt(4,4,8,4,cs),new Dt(4,5,16,8,cs),new Dt(4,6,32,32,cs),new Dt(4,4,16,16,Jn),new Dt(8,16,32,32,Jn),new Dt(8,16,128,128,Jn),new Dt(8,32,128,256,Jn),new Dt(32,128,258,1024,Jn),new Dt(32,258,258,4096,Jn)],E_=e=>{e.window_size=2*e.w_size,fn(e.head),e.max_lazy_match=ri[e.level].max_lazy,e.good_match=ri[e.level].good_length,e.nice_match=ri[e.level].nice_length,e.max_chain_length=ri[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ae-1,e.match_available=0,e.ins_h=0};function C_(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ta,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(__*2),this.dyn_dtree=new Uint16Array((2*m_+1)*2),this.bl_tree=new Uint16Array((2*g_+1)*2),fn(this.dyn_ltree),fn(this.dyn_dtree),fn(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(y_+1),this.heap=new Uint16Array(2*gl+1),fn(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*gl+1),fn(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Gi=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Tr&&t.status!==Su&&t.status!==_l&&t.status!==yl&&t.status!==vl&&t.status!==wl&&t.status!==Fn&&t.status!==ni?1:0},mp=e=>{if(Gi(e))return Mn(e,Ut);e.total_in=e.total_out=0,e.data_type=u_;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Su:t.wrap?Tr:Fn,e.adler=t.wrap===2?0:1,t.last_flush=-2,qg(t),Be},gp=e=>{const t=mp(e);return t===Be&&E_(e.state),t},A_=(e,t)=>Gi(e)||e.state.wrap!==2?Ut:(e.state.gzhead=t,Be),_p=(e,t,n,r,i,o)=>{if(!e)return Ut;let a=1;if(t===i_&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),i<1||i>c_||n!==Ta||r<8||r>15||t<0||t>9||o<0||o>s_||r===8&&a!==1)return Mn(e,Ut);r===8&&(r=9);const s=new C_;return e.state=s,s.strm=e,s.status=Tr,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<_p(e,t,Ta,f_,d_,l_),R_=(e,t)=>{if(Gi(e)||t>Gc||t<0)return e?Mn(e,Ut):Ut;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===ni&&t!==gt)return Mn(e,e.avail_out===0?us:Ut);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(it(e),e.avail_out===0)return n.last_flush=-1,Be}else if(e.avail_in===0&&Qc(t)<=Qc(r)&&t!==gt)return Mn(e,us);if(n.status===ni&&e.avail_in!==0)return Mn(e,us);if(n.status===Tr&&n.wrap===0&&(n.status=Fn),n.status===Tr){let i=Ta+(n.w_bits-8<<4)<<8,o=-1;if(n.strategy>=vo||n.level<2?o=0:n.level<6?o=1:n.level===6?o=2:o=3,i|=o<<6,n.strstart!==0&&(i|=v_),i+=31-i%31,Xr(n,i),n.strstart!==0&&(Xr(n,e.adler>>>16),Xr(n,e.adler&65535)),e.adler=1,n.status=Fn,it(e),n.pending!==0)return n.last_flush=-1,Be}if(n.status===Su){if(e.adler=0,ce(n,31),ce(n,139),ce(n,8),n.gzhead)ce(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),ce(n,n.gzhead.time&255),ce(n,n.gzhead.time>>8&255),ce(n,n.gzhead.time>>16&255),ce(n,n.gzhead.time>>24&255),ce(n,n.level===9?2:n.strategy>=vo||n.level<2?4:0),ce(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(ce(n,n.gzhead.extra.length&255),ce(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Le(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=_l;else if(ce(n,0),ce(n,0),ce(n,0),ce(n,0),ce(n,0),ce(n,n.level===9?2:n.strategy>=vo||n.level<2?4:0),ce(n,w_),n.status=Fn,it(e),n.pending!==0)return n.last_flush=-1,Be}if(n.status===_l){if(n.gzhead.extra){let i=n.pending,o=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+o>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,it(e),n.pending!==0)return n.last_flush=-1,Be;i=0,o-=s}let a=new Uint8Array(n.gzhead.extra);n.pending_buf.set(a.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending+=o,n.gzhead.hcrc&&n.pending>i&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=yl}if(n.status===yl){if(n.gzhead.name){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i)),it(e),n.pending!==0)return n.last_flush=-1,Be;i=0}n.gzindexi&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=vl}if(n.status===vl){if(n.gzhead.comment){let i=n.pending,o;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i)),it(e),n.pending!==0)return n.last_flush=-1,Be;i=0}n.gzindexi&&(e.adler=Le(e.adler,n.pending_buf,n.pending-i,i))}n.status=wl}if(n.status===wl){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(it(e),n.pending!==0))return n.last_flush=-1,Be;ce(n,e.adler&255),ce(n,e.adler>>8&255),e.adler=0}if(n.status=Fn,it(e),n.pending!==0)return n.last_flush=-1,Be}if(e.avail_in!==0||n.lookahead!==0||t!==bn&&n.status!==ni){let i=n.level===0?pp(n,t):n.strategy===vo?b_(n,t):n.strategy===a_?S_(n,t):ri[n.level].func(n,t);if((i===Gn||i===Fr)&&(n.status=ni),i===Ke||i===Gn)return e.avail_out===0&&(n.last_flush=-1),Be;if(i===Or&&(t===t_?e_(n):t!==Gc&&(ml(n,0,0,!1),t===n_&&(fn(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),it(e),e.avail_out===0))return n.last_flush=-1,Be}return t!==gt?Be:n.wrap<=0?Kc:(n.wrap===2?(ce(n,e.adler&255),ce(n,e.adler>>8&255),ce(n,e.adler>>16&255),ce(n,e.adler>>24&255),ce(n,e.total_in&255),ce(n,e.total_in>>8&255),ce(n,e.total_in>>16&255),ce(n,e.total_in>>24&255)):(Xr(n,e.adler>>>16),Xr(n,e.adler&65535)),it(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Be:Kc)},z_=e=>{if(Gi(e))return Ut;const t=e.state.status;return e.state=null,t===Fn?Mn(e,r_):Be},I_=(e,t)=>{let n=t.length;if(Gi(e))return Ut;const r=e.state,i=r.wrap;if(i===2||i===1&&r.status!==Tr||r.lookahead)return Ut;if(i===1&&(e.adler=Fi(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){i===0&&(fn(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(t.subarray(n-r.w_size,n),0),t=l,n=r.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Rr(r);r.lookahead>=ae;){let l=r.strstart,u=r.lookahead-(ae-1);do r.ins_h=En(r,r.ins_h,r.window[l+ae-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=ae-1,Rr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=ae-1,r.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,r.wrap=i,Be};var N_=T_,P_=_p,D_=gp,L_=mp,O_=A_,F_=R_,M_=z_,B_=I_,U_="pako deflate (from Nodeca project)",pi={deflateInit:N_,deflateInit2:P_,deflateReset:D_,deflateResetKeep:L_,deflateSetHeader:O_,deflate:F_,deflateEnd:M_,deflateSetDictionary:B_,deflateInfo:U_};const j_=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var $_=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)j_(n,r)&&(e[r]=n[r])}}return e},H_=e=>{let t=0;for(let r=0,i=e.length;r=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Mi[254]=Mi[254]=1;var Z_=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,i,o,a=e.length,s=0;for(i=0;i>>6,t[o++]=128|n&63):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|n&63):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|n&63);return t};const W_=(e,t)=>{if(t<65534&&e.subarray&&yp)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,i;const o=new Array(n*2);for(i=0,r=0;r4){o[i++]=65533,r+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}a<65536?o[i++]=a:(a-=65536,o[i++]=55296|a>>10&1023,o[i++]=56320|a&1023)}return W_(o,i)},G_=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+Mi[e[n]]>t?n:t},Bi={string2buf:Z_,buf2string:V_,utf8border:G_};function K_(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var vp=K_;const wp=Object.prototype.toString,{Z_NO_FLUSH:Q_,Z_SYNC_FLUSH:Y_,Z_FULL_FLUSH:X_,Z_FINISH:q_,Z_OK:ca,Z_STREAM_END:J_,Z_DEFAULT_COMPRESSION:ey,Z_DEFAULT_STRATEGY:ty,Z_DEFLATED:ny}=Lr;function Ki(e){this.options=Ra.assign({level:ey,method:ny,chunkSize:16384,windowBits:15,memLevel:8,strategy:ty},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new vp,this.strm.avail_out=0;let n=pi.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==ca)throw new Error(Vn[n]);if(t.header&&pi.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=Bi.string2buf(t.dictionary):wp.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=pi.deflateSetDictionary(this.strm,r),n!==ca)throw new Error(Vn[n]);this._dict_set=!0}}Ki.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let i,o;if(this.ended)return!1;for(t===~~t?o=t:o=t===!0?q_:Q_,typeof e=="string"?n.input=Bi.string2buf(e):wp.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(o===Y_||o===X_)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=pi.deflate(n,o),i===J_)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=pi.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ca;if(n.avail_out===0){this.onData(n.output);continue}if(o>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Ki.prototype.onData=function(e){this.chunks.push(e)};Ki.prototype.onEnd=function(e){e===ca&&(this.result=Ra.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function bu(e,t){const n=new Ki(t);if(n.push(e,!0),n.err)throw n.msg||Vn[n.err];return n.result}function ry(e,t){return t=t||{},t.raw=!0,bu(e,t)}function iy(e,t){return t=t||{},t.gzip=!0,bu(e,t)}var oy=Ki,ay=bu,sy=ry,ly=iy,uy=Lr,cy={Deflate:oy,deflate:ay,deflateRaw:sy,gzip:ly,constants:uy};const wo=16209,fy=16191;var dy=function(t,n){let r,i,o,a,s,l,u,d,v,g,f,_,p,x,c,h,y,k,S,T,A,z,R,N;const Z=t.state;r=t.next_in,R=t.input,i=r+(t.avail_in-5),o=t.next_out,N=t.output,a=o-(n-t.avail_out),s=o+(t.avail_out-257),l=Z.dmax,u=Z.wsize,d=Z.whave,v=Z.wnext,g=Z.window,f=Z.hold,_=Z.bits,p=Z.lencode,x=Z.distcode,c=(1<>>24,f>>>=k,_-=k,k=y>>>16&255,k===0)N[o++]=y&65535;else if(k&16){S=y&65535,k&=15,k&&(_>>=k,_-=k),_<15&&(f+=R[r++]<<_,_+=8,f+=R[r++]<<_,_+=8),y=x[f&h];n:for(;;){if(k=y>>>24,f>>>=k,_-=k,k=y>>>16&255,k&16){if(T=y&65535,k&=15,_l){t.msg="invalid distance too far back",Z.mode=wo;break e}if(f>>>=k,_-=k,k=o-a,T>k){if(k=T-k,k>d&&Z.sane){t.msg="invalid distance too far back",Z.mode=wo;break e}if(A=0,z=g,v===0){if(A+=u-k,k2;)N[o++]=z[A++],N[o++]=z[A++],N[o++]=z[A++],S-=3;S&&(N[o++]=z[A++],S>1&&(N[o++]=z[A++]))}else{A=o-T;do N[o++]=N[A++],N[o++]=N[A++],N[o++]=N[A++],S-=3;while(S>2);S&&(N[o++]=N[A++],S>1&&(N[o++]=N[A++]))}}else if(k&64){t.msg="invalid distance code",Z.mode=wo;break e}else{y=x[(y&65535)+(f&(1<>3,r-=S,_-=S<<3,f&=(1<<_)-1,t.next_in=r,t.next_out=o,t.avail_in=r{const l=s.bits;let u=0,d=0,v=0,g=0,f=0,_=0,p=0,x=0,c=0,h=0,y,k,S,T,A,z=null,R;const N=new Uint16Array(er+1),Z=new Uint16Array(er+1);let E=null,B,w,U;for(u=0;u<=er;u++)N[u]=0;for(d=0;d=1&&N[g]===0;g--);if(f>g&&(f=g),g===0)return i[o++]=1<<24|64<<16|0,i[o++]=1<<24|64<<16|0,s.bits=1,0;for(v=1;v0&&(e===qc||g!==1))return-1;for(Z[1]=0,u=1;uYc||e===Jc&&c>Xc)return 1;for(;;){B=u-p,a[d]+1=R?(w=E[a[d]-R],U=z[a[d]-R]):(w=96,U=0),y=1<>p)+k]=B<<24|w<<16|U|0;while(k!==0);for(y=1<>=1;if(y!==0?(h&=y-1,h+=y):h=0,d++,--N[u]===0){if(u===g)break;u=t[n+a[d]]}if(u>f&&(h&T)!==S){for(p===0&&(p=f),A+=v,_=u-p,x=1<<_;_+pYc||e===Jc&&c>Xc)return 1;S=h&T,i[S]=f<<24|_<<16|A-o|0}}return h!==0&&(i[A+h]=u-p<<24|64<<16|0),s.bits=f,0};var mi=_y;const yy=0,xp=1,kp=2,{Z_FINISH:ef,Z_BLOCK:vy,Z_TREES:xo,Z_OK:Kn,Z_STREAM_END:wy,Z_NEED_DICT:xy,Z_STREAM_ERROR:xt,Z_DATA_ERROR:Sp,Z_MEM_ERROR:bp,Z_BUF_ERROR:ky,Z_DEFLATED:tf}=Lr,za=16180,nf=16181,rf=16182,of=16183,af=16184,sf=16185,lf=16186,uf=16187,cf=16188,ff=16189,fa=16190,Zt=16191,ds=16192,df=16193,hs=16194,hf=16195,pf=16196,mf=16197,gf=16198,ko=16199,So=16200,_f=16201,yf=16202,vf=16203,wf=16204,xf=16205,ps=16206,kf=16207,Sf=16208,ve=16209,Ep=16210,Cp=16211,Sy=852,by=592,Ey=15,Cy=Ey,bf=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function Ay(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Xn=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.modeCp?1:0},Ap=e=>{if(Xn(e))return xt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=za,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(Sy),t.distcode=t.distdyn=new Int32Array(by),t.sane=1,t.back=-1,Kn},Tp=e=>{if(Xn(e))return xt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Ap(e)},Rp=(e,t)=>{let n;if(Xn(e))return xt;const r=e.state;return t<0?(n=0,t=-t):(n=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?xt:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Tp(e))},zp=(e,t)=>{if(!e)return xt;const n=new Ay;e.state=n,n.strm=e,n.window=null,n.mode=za;const r=Rp(e,t);return r!==Kn&&(e.state=null),r},Ty=e=>zp(e,Cy);let Ef=!0,ms,gs;const Ry=e=>{if(Ef){ms=new Int32Array(512),gs=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(mi(xp,e.lens,0,288,ms,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;mi(kp,e.lens,0,32,gs,0,e.work,{bits:5}),Ef=!1}e.lencode=ms,e.lenbits=9,e.distcode=gs,e.distbits=5},Ip=(e,t,n,r)=>{let i;const o=e.state;return o.window===null&&(o.wsize=1<=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>r&&(i=r),o.window.set(t.subarray(n-r,n-r+i),o.wnext),r-=i,r?(o.window.set(t.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave{let n,r,i,o,a,s,l,u,d,v,g,f,_,p,x=0,c,h,y,k,S,T,A,z;const R=new Uint8Array(4);let N,Z;const E=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Xn(e)||!e.output||!e.input&&e.avail_in!==0)return xt;n=e.state,n.mode===Zt&&(n.mode=ds),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,d=n.bits,v=s,g=l,z=Kn;e:for(;;)switch(n.mode){case za:if(n.wrap===0){n.mode=ds;break}for(;d<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=Le(n.check,R,2,0),u=0,d=0,n.mode=nf;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",n.mode=ve;break}if((u&15)!==tf){e.msg="unknown compression method",n.mode=ve;break}if(u>>>=4,d-=4,A=(u&15)+8,n.wbits===0&&(n.wbits=A),A>15||A>n.wbits){e.msg="invalid window size",n.mode=ve;break}n.dmax=1<>8&1),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,n.check=Le(n.check,R,2,0)),u=0,d=0,n.mode=rf;case rf:for(;d<32;){if(s===0)break e;s--,u+=r[o++]<>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,n.check=Le(n.check,R,4,0)),u=0,d=0,n.mode=of;case of:for(;d<16;){if(s===0)break e;s--,u+=r[o++]<>8),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,n.check=Le(n.check,R,2,0)),u=0,d=0,n.mode=af;case af:if(n.flags&1024){for(;d<16;){if(s===0)break e;s--,u+=r[o++]<>>8&255,n.check=Le(n.check,R,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=sf;case sf:if(n.flags&1024&&(f=n.length,f>s&&(f=s),f&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(o,o+f),A)),n.flags&512&&n.wrap&4&&(n.check=Le(n.check,r,f,o)),s-=f,o+=f,n.length-=f),n.length))break e;n.length=0,n.mode=lf;case lf:if(n.flags&2048){if(s===0)break e;f=0;do A=r[o+f++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&f>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Zt;break;case ff:for(;d<32;){if(s===0)break e;s--,u+=r[o++]<>>=d&7,d-=d&7,n.mode=ps;break}for(;d<3;){if(s===0)break e;s--,u+=r[o++]<>>=1,d-=1,u&3){case 0:n.mode=df;break;case 1:if(Ry(n),n.mode=ko,t===xo){u>>>=2,d-=2;break e}break;case 2:n.mode=pf;break;case 3:e.msg="invalid block type",n.mode=ve}u>>>=2,d-=2;break;case df:for(u>>>=d&7,d-=d&7;d<32;){if(s===0)break e;s--,u+=r[o++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=ve;break}if(n.length=u&65535,u=0,d=0,n.mode=hs,t===xo)break e;case hs:n.mode=hf;case hf:if(f=n.length,f){if(f>s&&(f=s),f>l&&(f=l),f===0)break e;i.set(r.subarray(o,o+f),a),s-=f,o+=f,l-=f,a+=f,n.length-=f;break}n.mode=Zt;break;case pf:for(;d<14;){if(s===0)break e;s--,u+=r[o++]<>>=5,d-=5,n.ndist=(u&31)+1,u>>>=5,d-=5,n.ncode=(u&15)+4,u>>>=4,d-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=ve;break}n.have=0,n.mode=mf;case mf:for(;n.have>>=3,d-=3}for(;n.have<19;)n.lens[E[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,N={bits:n.lenbits},z=mi(yy,n.lens,0,19,n.lencode,0,n.work,N),n.lenbits=N.bits,z){e.msg="invalid code lengths set",n.mode=ve;break}n.have=0,n.mode=gf;case gf:for(;n.have>>24,h=x>>>16&255,y=x&65535,!(c<=d);){if(s===0)break e;s--,u+=r[o++]<>>=c,d-=c,n.lens[n.have++]=y;else{if(y===16){for(Z=c+2;d>>=c,d-=c,n.have===0){e.msg="invalid bit length repeat",n.mode=ve;break}A=n.lens[n.have-1],f=3+(u&3),u>>>=2,d-=2}else if(y===17){for(Z=c+3;d>>=c,d-=c,A=0,f=3+(u&7),u>>>=3,d-=3}else{for(Z=c+7;d>>=c,d-=c,A=0,f=11+(u&127),u>>>=7,d-=7}if(n.have+f>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=ve;break}for(;f--;)n.lens[n.have++]=A}}if(n.mode===ve)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=ve;break}if(n.lenbits=9,N={bits:n.lenbits},z=mi(xp,n.lens,0,n.nlen,n.lencode,0,n.work,N),n.lenbits=N.bits,z){e.msg="invalid literal/lengths set",n.mode=ve;break}if(n.distbits=6,n.distcode=n.distdyn,N={bits:n.distbits},z=mi(kp,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,N),n.distbits=N.bits,z){e.msg="invalid distances set",n.mode=ve;break}if(n.mode=ko,t===xo)break e;case ko:n.mode=So;case So:if(s>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,n.hold=u,n.bits=d,dy(e,g),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=n.hold,d=n.bits,n.mode===Zt&&(n.back=-1);break}for(n.back=0;x=n.lencode[u&(1<>>24,h=x>>>16&255,y=x&65535,!(c<=d);){if(s===0)break e;s--,u+=r[o++]<>k)],c=x>>>24,h=x>>>16&255,y=x&65535,!(k+c<=d);){if(s===0)break e;s--,u+=r[o++]<>>=k,d-=k,n.back+=k}if(u>>>=c,d-=c,n.back+=c,n.length=y,h===0){n.mode=xf;break}if(h&32){n.back=-1,n.mode=Zt;break}if(h&64){e.msg="invalid literal/length code",n.mode=ve;break}n.extra=h&15,n.mode=_f;case _f:if(n.extra){for(Z=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=yf;case yf:for(;x=n.distcode[u&(1<>>24,h=x>>>16&255,y=x&65535,!(c<=d);){if(s===0)break e;s--,u+=r[o++]<>k)],c=x>>>24,h=x>>>16&255,y=x&65535,!(k+c<=d);){if(s===0)break e;s--,u+=r[o++]<>>=k,d-=k,n.back+=k}if(u>>>=c,d-=c,n.back+=c,h&64){e.msg="invalid distance code",n.mode=ve;break}n.offset=y,n.extra=h&15,n.mode=vf;case vf:if(n.extra){for(Z=n.extra;d>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=ve;break}n.mode=wf;case wf:if(l===0)break e;if(f=g-l,n.offset>f){if(f=n.offset-f,f>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=ve;break}f>n.wnext?(f-=n.wnext,_=n.wsize-f):_=n.wnext-f,f>n.length&&(f=n.length),p=n.window}else p=i,_=a-n.offset,f=n.length;f>l&&(f=l),l-=f,n.length-=f;do i[a++]=p[_++];while(--f);n.length===0&&(n.mode=So);break;case xf:if(l===0)break e;i[a++]=n.length,l--,n.mode=So;break;case ps:if(n.wrap){for(;d<32;){if(s===0)break e;s--,u|=r[o++]<{if(Xn(e))return xt;let t=e.state;return t.window&&(t.window=null),e.state=null,Kn},Ny=(e,t)=>{if(Xn(e))return xt;const n=e.state;return n.wrap&2?(n.head=t,t.done=!1,Kn):xt},Py=(e,t)=>{const n=t.length;let r,i,o;return Xn(e)||(r=e.state,r.wrap!==0&&r.mode!==fa)?xt:r.mode===fa&&(i=1,i=Fi(i,t,n,0),i!==r.check)?Sp:(o=Ip(e,t,n,n),o?(r.mode=Ep,bp):(r.havedict=1,Kn))};var Dy=Tp,Ly=Rp,Oy=Ap,Fy=Ty,My=zp,By=zy,Uy=Iy,jy=Ny,$y=Py,Hy="pako inflate (from Nodeca project)",Kt={inflateReset:Dy,inflateReset2:Ly,inflateResetKeep:Oy,inflateInit:Fy,inflateInit2:My,inflate:By,inflateEnd:Uy,inflateGetHeader:jy,inflateSetDictionary:$y,inflateInfo:Hy};function Zy(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Wy=Zy;const Np=Object.prototype.toString,{Z_NO_FLUSH:Vy,Z_FINISH:Gy,Z_OK:Ui,Z_STREAM_END:_s,Z_NEED_DICT:ys,Z_STREAM_ERROR:Ky,Z_DATA_ERROR:Cf,Z_MEM_ERROR:Qy}=Lr;function Qi(e){this.options=Ra.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new vp,this.strm.avail_out=0;let n=Kt.inflateInit2(this.strm,t.windowBits);if(n!==Ui)throw new Error(Vn[n]);if(this.header=new Wy,Kt.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Bi.string2buf(t.dictionary):Np.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=Kt.inflateSetDictionary(this.strm,t.dictionary),n!==Ui)))throw new Error(Vn[n])}Qi.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?Gy:Vy,Np.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),o=Kt.inflate(n,a),o===ys&&i&&(o=Kt.inflateSetDictionary(n,i),o===Ui?o=Kt.inflate(n,a):o===Cf&&(o=ys));n.avail_in>0&&o===_s&&n.state.wrap>0&&e[n.next_in]!==0;)Kt.inflateReset(n),o=Kt.inflate(n,a);switch(o){case Ky:case Cf:case ys:case Qy:return this.onEnd(o),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||o===_s))if(this.options.to==="string"){let l=Bi.utf8border(n.output,n.next_out),u=n.next_out-l,d=Bi.buf2string(n.output,l);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(l,l+u),0),this.onData(d)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(o===Ui&&s===0)){if(o===_s)return o=Kt.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};Qi.prototype.onData=function(e){this.chunks.push(e)};Qi.prototype.onEnd=function(e){e===Ui&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ra.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Eu(e,t){const n=new Qi(t);if(n.push(e),n.err)throw n.msg||Vn[n.err];return n.result}function Yy(e,t){return t=t||{},t.raw=!0,Eu(e,t)}var Xy=Qi,qy=Eu,Jy=Yy,ev=Eu,tv=Lr,nv={Inflate:Xy,inflate:qy,inflateRaw:Jy,ungzip:ev,constants:tv};const{Deflate:vv,deflate:rv,deflateRaw:wv,gzip:xv}=cy,{Inflate:iv,inflate:kv,inflateRaw:Sv,ungzip:bv}=nv;var ov=rv,av=iv;class Pp{constructor(t,n=!1,r=!0){this.device=t,this.tracing=n,this.slipReaderEnabled=!1,this.leftOver=new Uint8Array(0),this.baudrate=0,this.traceLog="",this.lastTraceTime=Date.now(),this._DTR_state=!1,this.slipReaderEnabled=r}getInfo(){const t=this.device.getInfo();return t.usbVendorId&&t.usbProductId?`WebSerial VendorID 0x${t.usbVendorId.toString(16)} ProductID 0x${t.usbProductId.toString(16)}`:""}getPid(){return this.device.getInfo().usbProductId}trace(t){const i=`${`TRACE ${(Date.now()-this.lastTraceTime).toFixed(3)}`} ${t}`;console.log(i),this.traceLog+=i+` `}async returnTrace(){try{await navigator.clipboard.writeText(this.traceLog),console.log("Text copied to clipboard!")}catch(t){console.error("Failed to copy text:",t)}}hexify(t){return Array.from(t).map(n=>n.toString(16).padStart(2,"0")).join("").padEnd(16," ")}hexConvert(t,n=!0){if(n&&t.length>16){let r="",i=t;for(;i.length>0;){const o=i.slice(0,16),a=String.fromCharCode(...o).split("").map(s=>s===" "||s>=" "&&s<="~"&&s!==" "?s:".").join("");i=i.slice(16),r+=` ${this.hexify(o.slice(0,8))} ${this.hexify(o.slice(8))} | ${a}`}return r}else return this.hexify(t)}slipWriter(t){const n=[];n.push(192);for(let r=0;r0)return o;i=this.leftOver,this.leftOver=new Uint8Array(0)}if(this.device.readable==null)return this.leftOver;this.reader=this.device.readable.getReader();try{t>0&&(r=setTimeout(()=>{this.reader&&this.reader.cancel()},t));do{const{value:o,done:a}=await this.reader.read();if(a)throw this.leftOver=i,new Error("Timeout");i=new Uint8Array(this._appendBuffer(i.buffer,o.buffer))}while(i.length0&&clearTimeout(r),this.reader.releaseLock()}if(this.tracing&&(console.log("Read bytes"),this.trace(`Read ${i.length} bytes: ${this.hexConvert(i)}`)),this.slipReaderEnabled){const o=this.slipReader(i);return this.tracing&&(console.log("Slip reader results"),this.trace(`Read ${o.length} bytes: ${this.hexConvert(o)}`)),o}return i}async rawRead(t=0){if(this.leftOver.length!=0){const r=this.leftOver;return this.leftOver=new Uint8Array(0),r}if(!this.device.readable)return this.leftOver;this.reader=this.device.readable.getReader();let n;try{t>0&&(n=setTimeout(()=>{this.reader&&this.reader.cancel()},t));const{value:r,done:i}=await this.reader.read();return i||this.tracing&&(console.log("Raw Read bytes"),this.trace(`Read ${r.length} bytes: ${this.hexConvert(r)}`)),r}finally{t>0&&clearTimeout(n),this.reader.releaseLock()}}async setRTS(t){await this.device.setSignals({requestToSend:t}),await this.setDTR(this._DTR_state)}async setDTR(t){this._DTR_state=t,await this.device.setSignals({dataTerminalReady:t})}async connect(t=115200,n={}){await this.device.open({baudRate:t,dataBits:n==null?void 0:n.dataBits,stopBits:n==null?void 0:n.stopBits,bufferSize:n==null?void 0:n.bufferSize,parity:n==null?void 0:n.parity,flowControl:n==null?void 0:n.flowControl}),this.baudrate=t,this.leftOver=new Uint8Array(0)}async sleep(t){return new Promise(n=>setTimeout(n,t))}async waitForUnlock(t){for(;this.device.readable&&this.device.readable.locked||this.device.writable&&this.device.writable.locked;)await this.sleep(t)}async disconnect(){var t,n;!((t=this.device.readable)===null||t===void 0)&&t.locked&&await((n=this.reader)===null||n===void 0?void 0:n.cancel()),await this.waitForUnlock(400),this.reader=void 0,await this.device.close()}}function Fo(e){return new Promise(t=>setTimeout(t,e))}async function sv(e){await e.setRTS(!1),await e.setDTR(!1),await Fo(100),await e.setDTR(!0),await e.setRTS(!1),await Fo(100),await e.setRTS(!0),await e.setDTR(!1),await e.setRTS(!0),await Fo(100),await e.setRTS(!1),await e.setDTR(!1)}function lv(e){const t=["D","R","W"],n=e.split("|");for(const r of n){const i=r[0],o=r.slice(1);if(!t.includes(i))return!1;if(i==="D"||i==="R"){if(o!=="0"&&o!=="1")return!1}else if(i==="W"){const a=parseInt(o);if(isNaN(a)||a<=0)return!1}}return!0}async function uv(e,t){const n={D:async r=>await e.setDTR(r),R:async r=>await e.setRTS(r),W:async r=>await Fo(r)};try{if(!lv(t))return;const i=t.split("|");for(const o of i){const a=o[0],s=o.slice(1);a==="W"?await n.W(Number(s)):(a==="D"||a==="R")&&await n[a](s==="1")}}catch{throw new Error("Invalid custom reset sequence")}}var cv=function(t){return atob(t)};const Af=kl(cv);async function fv(e){switch(e){case 15736195:{const{ESP32ROM:t}=await bt(async()=>{const{ESP32ROM:n}=await import("./esp32-BPYaDt9v.js");return{ESP32ROM:n}},__vite__mapDeps([0,1]));return new t}case 1867591791:case 2084675695:{const{ESP32C2ROM:t}=await bt(async()=>{const{ESP32C2ROM:n}=await import("./esp32c2-CVPL8n1g.js");return{ESP32C2ROM:n}},__vite__mapDeps([2,3,1]));return new t}case 1763790959:case 456216687:case 1216438383:case 1130455151:{const{ESP32C3ROM:t}=await bt(async()=>{const{ESP32C3ROM:n}=await import("./esp32c3-I3vXmsVg.js");return{ESP32C3ROM:n}},__vite__mapDeps([3,1]));return new t}case 752910447:{const{ESP32C6ROM:t}=await bt(async()=>{const{ESP32C6ROM:n}=await import("./esp32c6-C93uIFil.js");return{ESP32C6ROM:n}},__vite__mapDeps([4,1]));return new t}case 871374959:case 606167151:{const{ESP32C61ROM:t}=await bt(async()=>{const{ESP32C61ROM:n}=await import("./esp32c61-Qo5S0GG2.js");return{ESP32C61ROM:n}},__vite__mapDeps([5,4,1]));return new t}case 285294703:case 1675706479:{const{ESP32C5ROM:t}=await bt(async()=>{const{ESP32C5ROM:n}=await import("./esp32c5-CAGCiNY4.js");return{ESP32C5ROM:n}},__vite__mapDeps([6,4,1]));return new t}case 3619110528:{const{ESP32H2ROM:t}=await bt(async()=>{const{ESP32H2ROM:n}=await import("./esp32h2-Cf8JbGZQ.js");return{ESP32H2ROM:n}},__vite__mapDeps([7,1]));return new t}case 9:{const{ESP32S3ROM:t}=await bt(async()=>{const{ESP32S3ROM:n}=await import("./esp32s3-mu2zzjDN.js");return{ESP32S3ROM:n}},__vite__mapDeps([8,1]));return new t}case 1990:{const{ESP32S2ROM:t}=await bt(async()=>{const{ESP32S2ROM:n}=await import("./esp32s2-3nCAg6Ct.js");return{ESP32S2ROM:n}},__vite__mapDeps([9,1]));return new t}case 4293968129:{const{ESP8266ROM:t}=await bt(async()=>{const{ESP8266ROM:n}=await import("./esp8266-8VKmCx7J.js");return{ESP8266ROM:n}},__vite__mapDeps([10,1]));return new t}case 0:case 182303440:case 117676761:{const{ESP32P4ROM:t}=await bt(async()=>{const{ESP32P4ROM:n}=await import("./esp32p4-DfBdIAkh.js");return{ESP32P4ROM:n}},__vite__mapDeps([11,0,1]));return new t}default:return null}}class dv{constructor(t){this.ESP_RAM_BLOCK=6144,this.ESP_FLASH_BEGIN=2,this.ESP_FLASH_DATA=3,this.ESP_FLASH_END=4,this.ESP_MEM_BEGIN=5,this.ESP_MEM_END=6,this.ESP_MEM_DATA=7,this.ESP_WRITE_REG=9,this.ESP_READ_REG=10,this.ESP_SPI_ATTACH=13,this.ESP_CHANGE_BAUDRATE=15,this.ESP_FLASH_DEFL_BEGIN=16,this.ESP_FLASH_DEFL_DATA=17,this.ESP_FLASH_DEFL_END=18,this.ESP_SPI_FLASH_MD5=19,this.ESP_ERASE_FLASH=208,this.ESP_ERASE_REGION=209,this.ESP_READ_FLASH=210,this.ESP_RUN_USER_CODE=211,this.ESP_IMAGE_MAGIC=233,this.ESP_CHECKSUM_MAGIC=239,this.ROM_INVALID_RECV_MSG=5,this.ERASE_REGION_TIMEOUT_PER_MB=3e4,this.ERASE_WRITE_TIMEOUT_PER_MB=4e4,this.MD5_TIMEOUT_PER_MB=8e3,this.CHIP_ERASE_TIMEOUT=12e4,this.FLASH_READ_TIMEOUT=1e5,this.MAX_TIMEOUT=this.CHIP_ERASE_TIMEOUT*2,this.CHIP_DETECT_MAGIC_REG_ADDR=1073745920,this.DETECTED_FLASH_SIZES={18:"256KB",19:"512KB",20:"1MB",21:"2MB",22:"4MB",23:"8MB",24:"16MB"},this.DETECTED_FLASH_SIZES_NUM={18:256,19:512,20:1024,21:2048,22:4096,23:8192,24:16384},this.USB_JTAG_SERIAL_PID=4097,this.romBaudrate=115200,this.debugLogging=!1,this.syncStubDetected=!1,this.checksum=function(n){let r,i=239;for(r=0;rsetTimeout(n,t))}write(t,n=!0){this.terminal?n?this.terminal.writeLine(t):this.terminal.write(t):console.log(t)}error(t,n=!0){this.write(`Error: ${t}`,n)}info(t,n=!0){this.write(t,n)}debug(t,n=!0){this.debugLogging&&this.write(`Debug: ${t}`,n)}_shortToBytearray(t){return new Uint8Array([t&255,t>>8&255])}_intToByteArray(t){return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}_byteArrayToShort(t,n){return t|n>>8}_byteArrayToInt(t,n,r,i){return t|n<<8|r<<16|i<<24}_appendBuffer(t,n){const r=new Uint8Array(t.byteLength+n.byteLength);return r.set(new Uint8Array(t),0),r.set(new Uint8Array(n),t.byteLength),r.buffer}_appendArray(t,n){const r=new Uint8Array(t.length+n.length);return r.set(t,0),r.set(n,t.length),r}ui8ToBstr(t){let n="";for(let r=0;r0&&(a=this._appendArray(a,this._intToByteArray(this.chip.UART_DATE_REG_ADDR)),a=this._appendArray(a,this._intToByteArray(0)),a=this._appendArray(a,this._intToByteArray(0)),a=this._appendArray(a,this._intToByteArray(o))),await this.checkCommand("write target memory",this.ESP_WRITE_REG,a)}async sync(){this.debug("Sync");const t=new Uint8Array(36);let n;for(t[0]=7,t[1]=7,t[2]=18,t[3]=32,n=0;n<32;n++)t[4+n]=85;try{const r=await this.command(8,t,void 0,void 0,100);return this.syncStubDetected=this.syncStubDetected&&r[0]===0,r}catch(r){throw this.debug("Sync err "+r),r}}async _connectAttempt(t="default_reset",n=!1){if(this.debug("_connect_attempt "+t+" "+n),t!=="no_reset")if(this.transport.getPid()===this.USB_JTAG_SERIAL_PID)await sv(this.transport);else{const o=n?"D0|R1|W100|W2000|D1|R0|W50|D0":"D0|R1|W100|D1|R0|W50|D0";await uv(this.transport,o)}let r=0,i=!0;for(;i;){try{const o=await this.transport.read(1e3);r+=o.length}catch(o){if(this.debug(o.message),o instanceof Error){i=!1;break}}await this._sleep(50)}for(this.transport.slipReaderEnabled=!0,this.syncStubDetected=!0,r=7;r--;){try{const o=await this.sync();return this.debug(o[0].toString()),"success"}catch(o){o instanceof Error&&(n?this.info("_",!1):this.info(".",!1))}await this._sleep(50)}return"error"}async connect(t="default_reset",n=7,r=!1){let i,o;for(this.info("Connecting...",!1),await this.transport.connect(this.romBaudrate,this.serialOptions),i=0;i>>0;this.debug("Chip Magic "+a.toString(16));const s=await fv(a);if(this.chip===null)throw new Ve(`Unexpected CHIP magic value ${a}. Failed to autodetect chip type.`);this.chip=s}}async detectChip(t="default_reset"){await this.connect(t),this.info("Detecting chip type... ",!1),this.chip!=null?this.info(this.chip.CHIP_NAME):this.info("unknown!")}async checkCommand(t="",n=null,r=new Uint8Array(0),i=0,o=3e3){this.debug("check_command "+t);const a=await this.command(n,r,i,void 0,o);return a[1].length>4?a[1]:a[0]}async memBegin(t,n,r,i){this.debug("mem_begin "+t+" "+n+" "+r+" "+i.toString(16));let o=this._appendArray(this._intToByteArray(t),this._intToByteArray(n));o=this._appendArray(o,this._intToByteArray(r)),o=this._appendArray(o,this._intToByteArray(i)),await this.checkCommand("enter RAM download mode",this.ESP_MEM_BEGIN,o)}async memBlock(t,n){let r=this._appendArray(this._intToByteArray(t.length),this._intToByteArray(n));r=this._appendArray(r,this._intToByteArray(0)),r=this._appendArray(r,this._intToByteArray(0)),r=this._appendArray(r,t);const i=this.checksum(t);await this.checkCommand("write to target RAM",this.ESP_MEM_DATA,r,i)}async memFinish(t){const n=t===0?1:0,r=this._appendArray(this._intToByteArray(n),this._intToByteArray(t));await this.checkCommand("leave RAM download mode",this.ESP_MEM_END,r,void 0,50)}async flashSpiAttach(t){const n=this._intToByteArray(t);await this.checkCommand("configure SPI flash pins",this.ESP_SPI_ATTACH,n)}async flashBegin(t,n){const r=Math.floor((t+this.FLASH_WRITE_SIZE-1)/this.FLASH_WRITE_SIZE),i=this.chip.getEraseSize(n,t),o=new Date,a=o.getTime();let s=3e3;this.IS_STUB==!1&&(s=this.timeoutPerMb(this.ERASE_REGION_TIMEOUT_PER_MB,t)),this.debug("flash begin "+i+" "+r+" "+this.FLASH_WRITE_SIZE+" "+n+" "+t);let l=this._appendArray(this._intToByteArray(i),this._intToByteArray(r));l=this._appendArray(l,this._intToByteArray(this.FLASH_WRITE_SIZE)),l=this._appendArray(l,this._intToByteArray(n)),this.IS_STUB==!1&&(l=this._appendArray(l,this._intToByteArray(0))),await this.checkCommand("enter Flash download mode",this.ESP_FLASH_BEGIN,l,void 0,s);const u=o.getTime();return t!=0&&this.IS_STUB==!1&&this.info("Took "+(u-a)/1e3+"."+(u-a)%1e3+"s to erase flash block"),r}async flashDeflBegin(t,n,r){const i=Math.floor((n+this.FLASH_WRITE_SIZE-1)/this.FLASH_WRITE_SIZE),o=Math.floor((t+this.FLASH_WRITE_SIZE-1)/this.FLASH_WRITE_SIZE),a=new Date,s=a.getTime();let l,u;this.IS_STUB?(l=t,u=3e3):(l=o*this.FLASH_WRITE_SIZE,u=this.timeoutPerMb(this.ERASE_REGION_TIMEOUT_PER_MB,l)),this.info("Compressed "+t+" bytes to "+n+"...");let d=this._appendArray(this._intToByteArray(l),this._intToByteArray(i));d=this._appendArray(d,this._intToByteArray(this.FLASH_WRITE_SIZE)),d=this._appendArray(d,this._intToByteArray(r)),(this.chip.CHIP_NAME==="ESP32-S2"||this.chip.CHIP_NAME==="ESP32-S3"||this.chip.CHIP_NAME==="ESP32-C3"||this.chip.CHIP_NAME==="ESP32-C2")&&this.IS_STUB===!1&&(d=this._appendArray(d,this._intToByteArray(0))),await this.checkCommand("enter compressed flash mode",this.ESP_FLASH_DEFL_BEGIN,d,void 0,u);const v=a.getTime();return t!=0&&this.IS_STUB===!1&&this.info("Took "+(v-s)/1e3+"."+(v-s)%1e3+"s to erase flash block"),i}async flashBlock(t,n,r){let i=this._appendArray(this._intToByteArray(t.length),this._intToByteArray(n));i=this._appendArray(i,this._intToByteArray(0)),i=this._appendArray(i,this._intToByteArray(0)),i=this._appendArray(i,t);const o=this.checksum(t);await this.checkCommand("write to target Flash after seq "+n,this.ESP_FLASH_DATA,i,o,r)}async flashDeflBlock(t,n,r){let i=this._appendArray(this._intToByteArray(t.length),this._intToByteArray(n));i=this._appendArray(i,this._intToByteArray(0)),i=this._appendArray(i,this._intToByteArray(0)),i=this._appendArray(i,t);const o=this.checksum(t);this.debug("flash_defl_block "+t[0].toString(16)+" "+t[1].toString(16)),await this.checkCommand("write compressed data to flash after seq "+n,this.ESP_FLASH_DEFL_DATA,i,o,r)}async flashFinish(t=!1){const n=t?0:1,r=this._intToByteArray(n);await this.checkCommand("leave Flash mode",this.ESP_FLASH_END,r)}async flashDeflFinish(t=!1){const n=t?0:1,r=this._intToByteArray(n);await this.checkCommand("leave compressed flash mode",this.ESP_FLASH_DEFL_END,r)}async runSpiflashCommand(t,n,r){const s=this.chip.SPI_REG_BASE,l=s+0,u=s+this.chip.SPI_USR_OFFS,d=s+this.chip.SPI_USR1_OFFS,v=s+this.chip.SPI_USR2_OFFS,g=s+this.chip.SPI_W0_OFFS;let f;this.chip.SPI_MOSI_DLEN_OFFS!=null?f=async(A,z)=>{const R=s+this.chip.SPI_MOSI_DLEN_OFFS,N=s+this.chip.SPI_MISO_DLEN_OFFS;A>0&&await this.writeReg(R,A-1),z>0&&await this.writeReg(N,z-1)}:f=async(A,z)=>{const R=d,N=17,Z=8,E=A===0?0:A-1,w=(z===0?0:z-1)<32)throw new Ve("Reading more than 32 bits back from a SPI flash operation is unsupported");if(n.length>64)throw new Ve("Writing more than 64 bytes of data with one SPI command is unsupported");const x=n.length*8,c=await this.readReg(u),h=await this.readReg(v);let y=-2147483648,k;r>0&&(y|=268435456),x>0&&(y|=134217728),await f(x,r),await this.writeReg(u,y);let S=7<("00"+n.toString(16)).slice(-2)).join("")}async flashMd5sum(t,n){const r=this.timeoutPerMb(this.MD5_TIMEOUT_PER_MB,n);let i=this._appendArray(this._intToByteArray(t),this._intToByteArray(n));i=this._appendArray(i,this._intToByteArray(0)),i=this._appendArray(i,this._intToByteArray(0));let o=await this.checkCommand("calculate md5sum",this.ESP_SPI_FLASH_MD5,i,void 0,r);return o instanceof Uint8Array&&o.length>16&&(o=o.slice(0,16)),this.toHex(o)}async readFlash(t,n,r=null){let i=this._appendArray(this._intToByteArray(t),this._intToByteArray(n));i=this._appendArray(i,this._intToByteArray(4096)),i=this._appendArray(i,this._intToByteArray(1024));const o=await this.checkCommand("read flash",this.ESP_READ_FLASH,i);if(o!=0)throw new Ve("Failed to read memory: "+o);let a=new Uint8Array(0);for(;a.length0&&(a=this._appendArray(a,s),await this.transport.write(this._intToByteArray(a.length)),r&&r(s,a.length,n));else throw new Ve("Failed to read memory: "+s)}return a}async runStub(){if(this.syncStubDetected)return this.info("Stub is already running. No upload is necessary."),this.chip;this.info("Uploading stub...");let t=Af(this.chip.ROM_TEXT),n=t.split("").map(function(s){return s.charCodeAt(0)});const r=new Uint8Array(n);t=Af(this.chip.ROM_DATA),n=t.split("").map(function(s){return s.charCodeAt(0)});const i=new Uint8Array(n);let o=Math.floor((r.length+this.ESP_RAM_BLOCK-1)/this.ESP_RAM_BLOCK),a;for(await this.memBegin(r.length,o,this.ESP_RAM_BLOCK,this.chip.TEXT_START),a=0;a"u")throw new Ve("Flash size "+t+" is not supported by this chip type. Supported sizes: "+this.chip.FLASH_SIZES);return this.chip.FLASH_SIZES[t]}_updateImageFlashParams(t,n,r,i,o){if(this.debug("_update_image_flash_params "+r+" "+i+" "+o),t.length<8||n!=this.chip.BOOTLOADER_FLASH_OFFSET)return t;if(r==="keep"&&i==="keep"&&o==="keep")return this.info("Not changing the image"),t;const a=parseInt(t[0]);let s=parseInt(t[2]);const l=parseInt(t[3]);if(a!==this.ESP_IMAGE_MAGIC)return this.info("Warning: Image file at 0x"+n.toString(16)+" doesn't look like an image file, so not changing any flash settings."),t;i!=="keep"&&(s={qio:0,qout:1,dio:2,dout:3}[i]);let u=l&15;o!=="keep"&&(u={"40m":0,"26m":1,"20m":2,"80m":15}[o]);let d=l&240;r!=="keep"&&(d=this.parseFlashSizeArg(r));const v=s<<8|u+d;return this.info("Flash params set to "+v.toString(16)),parseInt(t[2])!==s<<8&&(t=t.substring(0,2)+(s<<8).toString()+t.substring(3)),parseInt(t[3])!==u+d&&(t=t.substring(0,3)+(u+d).toString()+t.substring(4)),t}async writeFlash(t){if(this.debug("EspLoader program"),t.flashSize!=="keep"){const i=this.flashSizeBytes(t.flashSize);for(let o=0;oi)throw new Ve(`File ${o+1} doesn't fit in the available flash`)}this.IS_STUB===!0&&t.eraseAll===!0&&await this.eraseFlash();let n,r;for(let i=0;i0&&(n+="ÿÿÿÿ".substring(4-o)),r=t.fileArray[i].address,this.debug("Image Length "+n.length),n.length===0){this.debug("Warning: File is empty");continue}n=this._updateImageFlashParams(n,r,t.flashSize,t.flashMode,t.flashFreq);let a=null;t.calculateMD5Hash&&(a=t.calculateMD5Hash(n),this.debug("Image MD5 "+a));const s=n.length;let l;if(t.compress){const h=this.bstrToUi8(n);n=this.ui8ToBstr(ov(h,{level:9})),l=await this.flashDeflBegin(s,n.length,r)}else l=await this.flashBegin(s,r);let u=0,d=0;const v=n.length;t.reportProgress&&t.reportProgress(i,0,v);let g=new Date;const f=g.getTime();let _=5e3;const p=new av({chunkSize:1});let x=0;for(p.onData=function(h){x+=h.byteLength};n.length>0;){this.debug("Write loop "+r+" "+u+" "+l),this.info("Writing at 0x"+(r+x).toString(16)+"... ("+Math.floor(100*(u+1)/l)+"%)");const h=this.bstrToUi8(n.slice(0,this.FLASH_WRITE_SIZE));if(t.compress){const y=x;p.push(h,!1);const k=x-y;let S=3e3;this.timeoutPerMb(this.ERASE_WRITE_TIMEOUT_PER_MB,k)>3e3&&(S=this.timeoutPerMb(this.ERASE_WRITE_TIMEOUT_PER_MB,k)),this.IS_STUB===!1&&(_=S),await this.flashDeflBlock(h,u,_),this.IS_STUB&&(_=S)}else throw new Ve("Yet to handle Non Compressed writes");d+=h.length,n=n.slice(this.FLASH_WRITE_SIZE,n.length),u++,t.reportProgress&&t.reportProgress(i,d,v)}this.IS_STUB&&await this.readReg(this.CHIP_DETECT_MAGIC_REG_ADDR,_),g=new Date;const c=g.getTime()-f;if(t.compress&&this.info("Wrote "+s+" bytes ("+d+" compressed) at 0x"+r.toString(16)+" in "+c/1e3+" seconds."),a){const h=await this.flashMd5sum(r,s);if(new String(h).valueOf()!=new String(a).valueOf())throw this.info("File md5: "+a),this.info("Flash md5: "+h),new Ve("MD5 of file does not match data in flash!");this.info("Hash of data verified.")}}this.info("Leaving..."),this.IS_STUB&&(await this.flashBegin(0,0),t.compress?await this.flashDeflFinish():await this.flashFinish())}async flashId(){this.debug("flash_id");const t=await this.readFlashId();this.info("Manufacturer: "+(t&255).toString(16));const n=t>>16&255;this.info("Device: "+(t>>8&255).toString(16)+n.toString(16)),this.info("Detected flash size: "+this.DETECTED_FLASH_SIZES[n])}async getFlashSize(){this.debug("flash_id");const n=await this.readFlashId()>>16&255;return this.DETECTED_FLASH_SIZES_NUM[n]}async hardReset(){await this.transport.setRTS(!0),await this._sleep(100),await this.transport.setRTS(!1)}async softReset(){if(!this.IS_STUB)await this.flashBegin(0,0),await this.flashFinish(!1);else{if(this.chip.CHIP_NAME!="ESP8266")throw new Ve("Soft resetting is currently only supported on ESP8266");await this.command(this.ESP_RUN_USER_CODE,void 0,void 0,!1)}}}const vs=e=>new Promise(t=>setTimeout(t,e)),Dp={info:["I "],error:["E "],success:["I ","W "]},hv=e=>{for(const[t,n]of Object.entries(Dp))if(n.some(r=>e.startsWith(r)))return t;return"info"},pv=e=>{for(const t of Object.values(Dp))for(const n of t)if(e.startsWith(n))return e.slice(n.length);return e},mv=e=>e.replace(/(?:\u001b|\x1b|\[)?(?:\[|\()(?:\d{1,3};)*\d{1,3}[A-Za-z]/g,""),Tf=e=>{const t=mv(e.trim()),n=hv(t);return{data:pv(t),type:n}};class gv{constructor(t){this.espLoader=null,this.isConnecting=!1,this.monitorSerial=!1,this.logBuffer="",this.terminal=t}log(t,n="info"){var r;(r=this.terminal)==null||r.writeLine(t,n)}processEspLog(t){var n,r;if(typeof t=="string"){const i=Tf(t);(n=this.terminal)==null||n.writeLine(i.data,i.type)}else{if(this.logBuffer+=new TextDecoder().decode(t),!this.logBuffer.includes(` diff --git a/index.html b/index.html index 7129c07..dd023ff 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Pubmote - +