var wa=Object.defineProperty;var va=(e,n,t)=>n in e?wa(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var je=(e,n,t)=>(va(e,typeof n!="symbol"?n+"":n,t),t),qr=(e,n,t)=>{if(!n.has(e))throw TypeError("Cannot "+t)};var B=(e,n,t)=>(qr(e,n,"read from private field"),t?t.call(e):n.get(e)),Ce=(e,n,t)=>{if(n.has(e))throw TypeError("Cannot add the same private member more than once");n instanceof WeakSet?n.add(e):n.set(e,t)},Te=(e,n,t,l)=>(qr(e,n,"write to private field"),l?l.call(e,t):n.set(e,t),t);var wr=(e,n,t,l)=>({set _(h){Te(e,n,h,t)},get _(){return B(e,n,l)}}),Ie=(e,n,t)=>(qr(e,n,"access private method"),t);var Tn=Object.defineProperty,_a=Object.getOwnPropertyDescriptor,Ea=Object.getOwnPropertyNames,Sa=Object.prototype.hasOwnProperty,Ge=(e,n)=>()=>(e&&(n=e(e=0)),n),me=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),Zt=(e,n)=>{for(var t in n)Tn(e,t,{get:n[t],enumerable:!0})},Aa=(e,n,t,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let h of Ea(n))!Sa.call(e,h)&&h!==t&&Tn(e,h,{get:()=>n[h],enumerable:!(l=_a(n,h))||l.enumerable});return e},Me=e=>Aa(Tn({},"__esModule",{value:!0}),e),at,oe=Ge(()=>{at={deviceMemory:8,hardwareConcurrency:8,language:"en-US"}}),ze={};Zt(ze,{_debugEnd:()=>Li,_debugProcess:()=>Ui,_events:()=>Ji,_eventsCount:()=>Xi,_exiting:()=>_i,_fatalExceptions:()=>Bi,_getActiveHandles:()=>Uo,_getActiveRequests:()=>Mo,_kill:()=>Ai,_linkedBinding:()=>Bo,_maxListeners:()=>Gi,_preload_modules:()=>Yi,_rawDebug:()=>yi,_startProfilerIdleNotifier:()=>Ni,_stopProfilerIdleNotifier:()=>ji,_tickCallback:()=>Mi,abort:()=>$i,addListener:()=>Zi,allowedNodeEnvironmentFlags:()=>Ri,arch:()=>oi,argv:()=>li,argv0:()=>Ki,assert:()=>Lo,binding:()=>di,chdir:()=>bi,config:()=>Ei,cpuUsage:()=>dr,cwd:()=>gi,debugPort:()=>zi,default:()=>On,dlopen:()=>xo,domain:()=>vi,emit:()=>on,emitWarning:()=>fi,env:()=>ai,execArgv:()=>ui,execPath:()=>Hi,exit:()=>Oi,features:()=>Pi,hasUncaughtExceptionCaptureCallback:()=>No,hrtime:()=>Ir,kill:()=>ki,listeners:()=>Do,memoryUsage:()=>Ti,moduleLoadList:()=>wi,nextTick:()=>Ro,off:()=>tn,on:()=>vt,once:()=>en,openStdin:()=>Ci,pid:()=>qi,platform:()=>si,ppid:()=>Vi,prependListener:()=>sn,prependOnceListener:()=>an,reallyExit:()=>Si,release:()=>mi,removeAllListeners:()=>nn,removeListener:()=>rn,resourceUsage:()=>Ii,setSourceMapsEnabled:()=>Qi,setUncaughtExceptionCaptureCallback:()=>xi,stderr:()=>Fi,stdin:()=>Wi,stdout:()=>Di,title:()=>ni,umask:()=>pi,uptime:()=>jo,version:()=>hi,versions:()=>ci});function kn(e){throw new Error("Node.js process "+e+" is not supported by JSPM core outside of Node.js")}function Ia(){!Gt||!Yt||(Gt=!1,Yt.length?mt=Yt.concat(mt):br=-1,mt.length&&Co())}function Co(){if(!Gt){var e=setTimeout(Ia,0);Gt=!0;for(var n=mt.length;n;){for(Yt=mt,mt=[];++br1)for(var t=1;t{ae(),se(),oe(),mt=[],Gt=!1,br=-1,Po.prototype.run=function(){this.fun.apply(null,this.array)},ni="browser",oi="x64",si="browser",ai={PATH:"/usr/bin",LANG:at.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},li=["/usr/bin/node"],ui=[],hi="v16.8.0",ci={},fi=function(e,n){console.warn((n?n+": ":"")+e)},di=function(e){kn("binding")},pi=function(e){return 0},gi=function(){return"/"},bi=function(e){},mi={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},yi=Xe,wi=[],vi={},_i=!1,Ei={},Si=Xe,Ai=Xe,dr=function(){return{}},Ii=dr,Ti=dr,ki=Xe,Oi=Xe,Ci=Xe,Ri={},Pi={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Bi=Xe,xi=Xe,Mi=Xe,Ui=Xe,Li=Xe,Ni=Xe,ji=Xe,Di=void 0,Fi=void 0,Wi=void 0,$i=Xe,qi=2,Vi=1,Hi="/bin/usr/node",zi=9229,Ki="node",Yi=[],Qi=Xe,At={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},At.now===void 0&&(Vr=Date.now(),At.timing&&At.timing.navigationStart&&(Vr=At.timing.navigationStart),At.now=()=>Date.now()-Vr),Tr=1e9,Ir.bigint=function(e){var n=Ir(e);return typeof BigInt>"u"?n[0]*Tr+n[1]:BigInt(n[0]*Tr)+BigInt(n[1])},Gi=10,Ji={},Xi=0,Zi=vt,en=vt,tn=vt,rn=vt,nn=vt,on=Xe,sn=vt,an=vt,On={version:hi,versions:ci,arch:oi,platform:si,release:mi,_rawDebug:yi,moduleLoadList:wi,binding:di,_linkedBinding:Bo,_events:Ji,_eventsCount:Xi,_maxListeners:Gi,on:vt,addListener:Zi,once:en,off:tn,removeListener:rn,removeAllListeners:nn,emit:on,prependListener:sn,prependOnceListener:an,listeners:Do,domain:vi,_exiting:_i,config:Ei,dlopen:xo,uptime:jo,_getActiveRequests:Mo,_getActiveHandles:Uo,reallyExit:Si,_kill:Ai,cpuUsage:dr,resourceUsage:Ii,memoryUsage:Ti,kill:ki,exit:Oi,openStdin:Ci,allowedNodeEnvironmentFlags:Ri,assert:Lo,features:Pi,_fatalExceptions:Bi,setUncaughtExceptionCaptureCallback:xi,hasUncaughtExceptionCaptureCallback:No,emitWarning:fi,nextTick:Ro,_tickCallback:Mi,_debugProcess:Ui,_debugEnd:Li,_startProfilerIdleNotifier:Ni,_stopProfilerIdleNotifier:ji,stdout:Di,stdin:Wi,stderr:Fi,abort:$i,umask:pi,chdir:bi,cwd:gi,env:ai,title:ni,argv:li,execArgv:ui,pid:qi,ppid:Vi,execPath:Hi,debugPort:zi,hrtime:Ir,argv0:Ki,_preload_modules:Yi,setSourceMapsEnabled:Qi}}),se=Ge(()=>{Ta()}),Ze={};Zt(Ze,{Buffer:()=>sr,INSPECT_MAX_BYTES:()=>Fo,default:()=>_t,kMaxLength:()=>Wo});function ka(){if(ln)return nr;ln=!0,nr.byteLength=o,nr.toByteArray=a,nr.fromByteArray=g;for(var e=[],n=[],t=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,s=l.length;h0)throw new Error("Invalid string. Length must be a multiple of 4");var y=b.indexOf("=");y===-1&&(y=m);var I=y===m?0:4-y%4;return[y,I]}function o(b){var m=r(b),y=m[0],I=m[1];return(y+I)*3/4-I}function i(b,m,y){return(m+y)*3/4-y}function a(b){var m,y=r(b),I=y[0],U=y[1],k=new t(i(b,I,U)),T=0,D=U>0?I-4:I,F;for(F=0;F>16&255,k[T++]=m>>8&255,k[T++]=m&255;return U===2&&(m=n[b.charCodeAt(F)]<<2|n[b.charCodeAt(F+1)]>>4,k[T++]=m&255),U===1&&(m=n[b.charCodeAt(F)]<<10|n[b.charCodeAt(F+1)]<<4|n[b.charCodeAt(F+2)]>>2,k[T++]=m>>8&255,k[T++]=m&255),k}function c(b){return e[b>>18&63]+e[b>>12&63]+e[b>>6&63]+e[b&63]}function p(b,m,y){for(var I,U=[],k=m;kD?D:T+k));return I===1?(m=b[y-1],U.push(e[m>>2]+e[m<<4&63]+"==")):I===2&&(m=(b[y-2]<<8)+b[y-1],U.push(e[m>>10]+e[m>>4&63]+e[m<<2&63]+"=")),U.join("")}return nr}function Oa(){return un?pr:(un=!0,pr.read=function(e,n,t,l,h){var s,r,o=h*8-l-1,i=(1<>1,c=-7,p=t?h-1:0,g=t?-1:1,b=e[n+p];for(p+=g,s=b&(1<<-c)-1,b>>=-c,c+=o;c>0;s=s*256+e[n+p],p+=g,c-=8);for(r=s&(1<<-c)-1,s>>=-c,c+=l;c>0;r=r*256+e[n+p],p+=g,c-=8);if(s===0)s=1-a;else{if(s===i)return r?NaN:(b?-1:1)*(1/0);r=r+Math.pow(2,l),s=s-a}return(b?-1:1)*r*Math.pow(2,s-l)},pr.write=function(e,n,t,l,h,s){var r,o,i,a=s*8-h-1,c=(1<>1,g=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=l?0:s-1,m=l?1:-1,y=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(o=isNaN(n)?1:0,r=c):(r=Math.floor(Math.log(n)/Math.LN2),n*(i=Math.pow(2,-r))<1&&(r--,i*=2),r+p>=1?n+=g/i:n+=g*Math.pow(2,1-p),n*i>=2&&(r++,i/=2),r+p>=c?(o=0,r=c):r+p>=1?(o=(n*i-1)*Math.pow(2,h),r=r+p):(o=n*Math.pow(2,p-1)*Math.pow(2,h),r=0));h>=8;e[t+b]=o&255,b+=m,o/=256,h-=8);for(r=r<0;e[t+b]=r&255,b+=m,r/=256,a-=8);e[t+b-m]|=y*128},pr)}function Ca(){if(hn)return Mt;hn=!0;let e=ka(),n=Oa(),t=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Mt.Buffer=r,Mt.SlowBuffer=U,Mt.INSPECT_MAX_BYTES=50;let l=2147483647;Mt.kMaxLength=l,r.TYPED_ARRAY_SUPPORT=h(),!r.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function h(){try{let f=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(f,u),f.foo()===42}catch{return!1}}Object.defineProperty(r.prototype,"parent",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.buffer}}),Object.defineProperty(r.prototype,"offset",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.byteOffset}});function s(f){if(f>l)throw new RangeError('The value "'+f+'" is invalid for option "size"');let u=new Uint8Array(f);return Object.setPrototypeOf(u,r.prototype),u}function r(f,u,d){if(typeof f=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return c(f)}return o(f,u,d)}r.poolSize=8192;function o(f,u,d){if(typeof f=="string")return p(f,u);if(ArrayBuffer.isView(f))return b(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(H(f,ArrayBuffer)||f&&H(f.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(H(f,SharedArrayBuffer)||f&&H(f.buffer,SharedArrayBuffer)))return m(f,u,d);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let v=f.valueOf&&f.valueOf();if(v!=null&&v!==f)return r.from(v,u,d);let A=y(f);if(A)return A;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return r.from(f[Symbol.toPrimitive]("string"),u,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}r.from=function(f,u,d){return o(f,u,d)},Object.setPrototypeOf(r.prototype,Uint8Array.prototype),Object.setPrototypeOf(r,Uint8Array);function i(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function a(f,u,d){return i(f),f<=0?s(f):u!==void 0?typeof d=="string"?s(f).fill(u,d):s(f).fill(u):s(f)}r.alloc=function(f,u,d){return a(f,u,d)};function c(f){return i(f),s(f<0?0:I(f)|0)}r.allocUnsafe=function(f){return c(f)},r.allocUnsafeSlow=function(f){return c(f)};function p(f,u){if((typeof u!="string"||u==="")&&(u="utf8"),!r.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let d=k(f,u)|0,v=s(d),A=v.write(f,u);return A!==d&&(v=v.slice(0,A)),v}function g(f){let u=f.length<0?0:I(f.length)|0,d=s(u);for(let v=0;v=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return f|0}function U(f){return+f!=f&&(f=0),r.alloc(+f)}r.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==r.prototype},r.compare=function(f,u){if(H(f,Uint8Array)&&(f=r.from(f,f.offset,f.byteLength)),H(u,Uint8Array)&&(u=r.from(u,u.offset,u.byteLength)),!r.isBuffer(f)||!r.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===u)return 0;let d=f.length,v=u.length;for(let A=0,w=Math.min(d,v);Av.length?(r.isBuffer(w)||(w=r.from(w)),w.copy(v,A)):Uint8Array.prototype.set.call(v,w,A);else if(r.isBuffer(w))w.copy(v,A);else throw new TypeError('"list" argument must be an Array of Buffers');A+=w.length}return v};function k(f,u){if(r.isBuffer(f))return f.length;if(ArrayBuffer.isView(f)||H(f,ArrayBuffer))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);let d=f.length,v=arguments.length>2&&arguments[2]===!0;if(!v&&d===0)return 0;let A=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return j(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return Q(f).length;default:if(A)return v?-1:j(f).length;u=(""+u).toLowerCase(),A=!0}}r.byteLength=k;function T(f,u,d){let v=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,u>>>=0,d<=u))return"";for(f||(f="utf8");;)switch(f){case"hex":return $(this,u,d);case"utf8":case"utf-8":return q(this,u,d);case"ascii":return ge(this,u,d);case"latin1":case"binary":return ne(this,u,d);case"base64":return E(this,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return be(this,u,d);default:if(v)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),v=!0}}r.prototype._isBuffer=!0;function D(f,u,d){let v=f[u];f[u]=f[d],f[d]=v}r.prototype.swap16=function(){let f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;uu&&(f+=" ... "),""},t&&(r.prototype[t]=r.prototype.inspect),r.prototype.compare=function(f,u,d,v,A){if(H(f,Uint8Array)&&(f=r.from(f,f.offset,f.byteLength)),!r.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(u===void 0&&(u=0),d===void 0&&(d=f?f.length:0),v===void 0&&(v=0),A===void 0&&(A=this.length),u<0||d>f.length||v<0||A>this.length)throw new RangeError("out of range index");if(v>=A&&u>=d)return 0;if(v>=A)return-1;if(u>=d)return 1;if(u>>>=0,d>>>=0,v>>>=0,A>>>=0,this===f)return 0;let w=A-v,P=d-u,V=Math.min(w,P),fe=this.slice(v,A),ie=f.slice(u,d);for(let ye=0;ye2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,we(d)&&(d=A?0:f.length-1),d<0&&(d=f.length+d),d>=f.length){if(A)return-1;d=f.length-1}else if(d<0)if(A)d=0;else return-1;if(typeof u=="string"&&(u=r.from(u,v)),r.isBuffer(u))return u.length===0?-1:R(f,u,d,v,A);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call(f,u,d):Uint8Array.prototype.lastIndexOf.call(f,u,d):R(f,[u],d,v,A);throw new TypeError("val must be string, number or Buffer")}function R(f,u,d,v,A){let w=1,P=f.length,V=u.length;if(v!==void 0&&(v=String(v).toLowerCase(),v==="ucs2"||v==="ucs-2"||v==="utf16le"||v==="utf-16le")){if(f.length<2||u.length<2)return-1;w=2,P/=2,V/=2,d/=2}function fe(ye,Se){return w===1?ye[Se]:ye.readUInt16BE(Se*w)}let ie;if(A){let ye=-1;for(ie=d;ieP&&(d=P-V),ie=d;ie>=0;ie--){let ye=!0;for(let Se=0;SeA&&(v=A)):v=A;let w=u.length;v>w/2&&(v=w/2);let P;for(P=0;P>>0,isFinite(d)?(d=d>>>0,v===void 0&&(v="utf8")):(v=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let A=this.length-u;if((d===void 0||d>A)&&(d=A),f.length>0&&(d<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");v||(v="utf8");let w=!1;for(;;)switch(v){case"hex":return O(this,f,u,d);case"utf8":case"utf-8":return M(this,f,u,d);case"ascii":case"latin1":case"binary":return W(this,f,u,d);case"base64":return G(this,f,u,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ee(this,f,u,d);default:if(w)throw new TypeError("Unknown encoding: "+v);v=(""+v).toLowerCase(),w=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function E(f,u,d){return u===0&&d===f.length?e.fromByteArray(f):e.fromByteArray(f.slice(u,d))}function q(f,u,d){d=Math.min(f.length,d);let v=[],A=u;for(;A239?4:w>223?3:w>191?2:1;if(A+V<=d){let fe,ie,ye,Se;switch(V){case 1:w<128&&(P=w);break;case 2:fe=f[A+1],(fe&192)===128&&(Se=(w&31)<<6|fe&63,Se>127&&(P=Se));break;case 3:fe=f[A+1],ie=f[A+2],(fe&192)===128&&(ie&192)===128&&(Se=(w&15)<<12|(fe&63)<<6|ie&63,Se>2047&&(Se<55296||Se>57343)&&(P=Se));break;case 4:fe=f[A+1],ie=f[A+2],ye=f[A+3],(fe&192)===128&&(ie&192)===128&&(ye&192)===128&&(Se=(w&15)<<18|(fe&63)<<12|(ie&63)<<6|ye&63,Se>65535&&Se<1114112&&(P=Se))}}P===null?(P=65533,V=1):P>65535&&(P-=65536,v.push(P>>>10&1023|55296),P=56320|P&1023),v.push(P),A+=V}return K(v)}let Z=4096;function K(f){let u=f.length;if(u<=Z)return String.fromCharCode.apply(String,f);let d="",v=0;for(;vv)&&(d=v);let A="";for(let w=u;wd&&(f=d),u<0?(u+=d,u<0&&(u=0)):u>d&&(u=d),ud)throw new RangeError("Trying to access beyond buffer length")}r.prototype.readUintLE=r.prototype.readUIntLE=function(f,u,d){f=f>>>0,u=u>>>0,d||re(f,u,this.length);let v=this[f],A=1,w=0;for(;++w>>0,u=u>>>0,d||re(f,u,this.length);let v=this[f+--u],A=1;for(;u>0&&(A*=256);)v+=this[f+--u]*A;return v},r.prototype.readUint8=r.prototype.readUInt8=function(f,u){return f=f>>>0,u||re(f,1,this.length),this[f]},r.prototype.readUint16LE=r.prototype.readUInt16LE=function(f,u){return f=f>>>0,u||re(f,2,this.length),this[f]|this[f+1]<<8},r.prototype.readUint16BE=r.prototype.readUInt16BE=function(f,u){return f=f>>>0,u||re(f,2,this.length),this[f]<<8|this[f+1]},r.prototype.readUint32LE=r.prototype.readUInt32LE=function(f,u){return f=f>>>0,u||re(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},r.prototype.readUint32BE=r.prototype.readUInt32BE=function(f,u){return f=f>>>0,u||re(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},r.prototype.readBigUInt64LE=Ae(function(f){f=f>>>0,J(f,"offset");let u=this[f],d=this[f+7];(u===void 0||d===void 0)&&he(f,this.length-8);let v=u+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,A=this[++f]+this[++f]*2**8+this[++f]*2**16+d*2**24;return BigInt(v)+(BigInt(A)<>>0,J(f,"offset");let u=this[f],d=this[f+7];(u===void 0||d===void 0)&&he(f,this.length-8);let v=u*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],A=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+d;return(BigInt(v)<>>0,u=u>>>0,d||re(f,u,this.length);let v=this[f],A=1,w=0;for(;++w=A&&(v-=Math.pow(2,8*u)),v},r.prototype.readIntBE=function(f,u,d){f=f>>>0,u=u>>>0,d||re(f,u,this.length);let v=u,A=1,w=this[f+--v];for(;v>0&&(A*=256);)w+=this[f+--v]*A;return A*=128,w>=A&&(w-=Math.pow(2,8*u)),w},r.prototype.readInt8=function(f,u){return f=f>>>0,u||re(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},r.prototype.readInt16LE=function(f,u){f=f>>>0,u||re(f,2,this.length);let d=this[f]|this[f+1]<<8;return d&32768?d|4294901760:d},r.prototype.readInt16BE=function(f,u){f=f>>>0,u||re(f,2,this.length);let d=this[f+1]|this[f]<<8;return d&32768?d|4294901760:d},r.prototype.readInt32LE=function(f,u){return f=f>>>0,u||re(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},r.prototype.readInt32BE=function(f,u){return f=f>>>0,u||re(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},r.prototype.readBigInt64LE=Ae(function(f){f=f>>>0,J(f,"offset");let u=this[f],d=this[f+7];(u===void 0||d===void 0)&&he(f,this.length-8);let v=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+(d<<24);return(BigInt(v)<>>0,J(f,"offset");let u=this[f],d=this[f+7];(u===void 0||d===void 0)&&he(f,this.length-8);let v=(u<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(v)<>>0,u||re(f,4,this.length),n.read(this,f,!0,23,4)},r.prototype.readFloatBE=function(f,u){return f=f>>>0,u||re(f,4,this.length),n.read(this,f,!1,23,4)},r.prototype.readDoubleLE=function(f,u){return f=f>>>0,u||re(f,8,this.length),n.read(this,f,!0,52,8)},r.prototype.readDoubleBE=function(f,u){return f=f>>>0,u||re(f,8,this.length),n.read(this,f,!1,52,8)};function ve(f,u,d,v,A,w){if(!r.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>A||uf.length)throw new RangeError("Index out of range")}r.prototype.writeUintLE=r.prototype.writeUIntLE=function(f,u,d,v){if(f=+f,u=u>>>0,d=d>>>0,!v){let P=Math.pow(2,8*d)-1;ve(this,f,u,d,P,0)}let A=1,w=0;for(this[u]=f&255;++w>>0,d=d>>>0,!v){let P=Math.pow(2,8*d)-1;ve(this,f,u,d,P,0)}let A=d-1,w=1;for(this[u+A]=f&255;--A>=0&&(w*=256);)this[u+A]=f/w&255;return u+d},r.prototype.writeUint8=r.prototype.writeUInt8=function(f,u,d){return f=+f,u=u>>>0,d||ve(this,f,u,1,255,0),this[u]=f&255,u+1},r.prototype.writeUint16LE=r.prototype.writeUInt16LE=function(f,u,d){return f=+f,u=u>>>0,d||ve(this,f,u,2,65535,0),this[u]=f&255,this[u+1]=f>>>8,u+2},r.prototype.writeUint16BE=r.prototype.writeUInt16BE=function(f,u,d){return f=+f,u=u>>>0,d||ve(this,f,u,2,65535,0),this[u]=f>>>8,this[u+1]=f&255,u+2},r.prototype.writeUint32LE=r.prototype.writeUInt32LE=function(f,u,d){return f=+f,u=u>>>0,d||ve(this,f,u,4,4294967295,0),this[u+3]=f>>>24,this[u+2]=f>>>16,this[u+1]=f>>>8,this[u]=f&255,u+4},r.prototype.writeUint32BE=r.prototype.writeUInt32BE=function(f,u,d){return f=+f,u=u>>>0,d||ve(this,f,u,4,4294967295,0),this[u]=f>>>24,this[u+1]=f>>>16,this[u+2]=f>>>8,this[u+3]=f&255,u+4};function S(f,u,d,v,A){X(u,v,A,f,d,7);let w=Number(u&BigInt(4294967295));f[d++]=w,w=w>>8,f[d++]=w,w=w>>8,f[d++]=w,w=w>>8,f[d++]=w;let P=Number(u>>BigInt(32)&BigInt(4294967295));return f[d++]=P,P=P>>8,f[d++]=P,P=P>>8,f[d++]=P,P=P>>8,f[d++]=P,d}function Y(f,u,d,v,A){X(u,v,A,f,d,7);let w=Number(u&BigInt(4294967295));f[d+7]=w,w=w>>8,f[d+6]=w,w=w>>8,f[d+5]=w,w=w>>8,f[d+4]=w;let P=Number(u>>BigInt(32)&BigInt(4294967295));return f[d+3]=P,P=P>>8,f[d+2]=P,P=P>>8,f[d+1]=P,P=P>>8,f[d]=P,d+8}r.prototype.writeBigUInt64LE=Ae(function(f,u=0){return S(this,f,u,BigInt(0),BigInt("0xffffffffffffffff"))}),r.prototype.writeBigUInt64BE=Ae(function(f,u=0){return Y(this,f,u,BigInt(0),BigInt("0xffffffffffffffff"))}),r.prototype.writeIntLE=function(f,u,d,v){if(f=+f,u=u>>>0,!v){let V=Math.pow(2,8*d-1);ve(this,f,u,d,V-1,-V)}let A=0,w=1,P=0;for(this[u]=f&255;++A>0)-P&255;return u+d},r.prototype.writeIntBE=function(f,u,d,v){if(f=+f,u=u>>>0,!v){let V=Math.pow(2,8*d-1);ve(this,f,u,d,V-1,-V)}let A=d-1,w=1,P=0;for(this[u+A]=f&255;--A>=0&&(w*=256);)f<0&&P===0&&this[u+A+1]!==0&&(P=1),this[u+A]=(f/w>>0)-P&255;return u+d},r.prototype.writeInt8=function(f,u,d){return f=+f,u=u>>>0,d||ve(this,f,u,1,127,-128),f<0&&(f=255+f+1),this[u]=f&255,u+1},r.prototype.writeInt16LE=function(f,u,d){return f=+f,u=u>>>0,d||ve(this,f,u,2,32767,-32768),this[u]=f&255,this[u+1]=f>>>8,u+2},r.prototype.writeInt16BE=function(f,u,d){return f=+f,u=u>>>0,d||ve(this,f,u,2,32767,-32768),this[u]=f>>>8,this[u+1]=f&255,u+2},r.prototype.writeInt32LE=function(f,u,d){return f=+f,u=u>>>0,d||ve(this,f,u,4,2147483647,-2147483648),this[u]=f&255,this[u+1]=f>>>8,this[u+2]=f>>>16,this[u+3]=f>>>24,u+4},r.prototype.writeInt32BE=function(f,u,d){return f=+f,u=u>>>0,d||ve(this,f,u,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[u]=f>>>24,this[u+1]=f>>>16,this[u+2]=f>>>8,this[u+3]=f&255,u+4},r.prototype.writeBigInt64LE=Ae(function(f,u=0){return S(this,f,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),r.prototype.writeBigInt64BE=Ae(function(f,u=0){return Y(this,f,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ce(f,u,d,v,A,w){if(d+v>f.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function Ee(f,u,d,v,A){return u=+u,d=d>>>0,A||ce(f,u,d,4),n.write(f,u,d,v,23,4),d+4}r.prototype.writeFloatLE=function(f,u,d){return Ee(this,f,u,!0,d)},r.prototype.writeFloatBE=function(f,u,d){return Ee(this,f,u,!1,d)};function ue(f,u,d,v,A){return u=+u,d=d>>>0,A||ce(f,u,d,8),n.write(f,u,d,v,52,8),d+8}r.prototype.writeDoubleLE=function(f,u,d){return ue(this,f,u,!0,d)},r.prototype.writeDoubleBE=function(f,u,d){return ue(this,f,u,!1,d)},r.prototype.copy=function(f,u,d,v){if(!r.isBuffer(f))throw new TypeError("argument should be a Buffer");if(d||(d=0),!v&&v!==0&&(v=this.length),u>=f.length&&(u=f.length),u||(u=0),v>0&&v=this.length)throw new RangeError("Index out of range");if(v<0)throw new RangeError("sourceEnd out of bounds");v>this.length&&(v=this.length),f.length-u>>0,d=d===void 0?this.length:d>>>0,f||(f=0);let A;if(typeof f=="number")for(A=u;A2**32?A=z(String(d)):typeof d=="bigint"&&(A=String(d),(d>BigInt(2)**BigInt(32)||d<-(BigInt(2)**BigInt(32)))&&(A=z(A)),A+="n"),v+=` It must be ${u}. Received ${A}`,v},RangeError);function z(f){let u="",d=f.length,v=f[0]==="-"?1:0;for(;d>=v+4;d-=3)u=`_${f.slice(d-3,d)}${u}`;return`${f.slice(0,d)}${u}`}function le(f,u,d){J(u,"offset"),(f[u]===void 0||f[u+d]===void 0)&&he(u,f.length-(d+1))}function X(f,u,d,v,A,w){if(f>d||f3?u===0||u===BigInt(0)?V=`>= 0${P} and < 2${P} ** ${(w+1)*8}${P}`:V=`>= -(2${P} ** ${(w+1)*8-1}${P}) and < 2 ** ${(w+1)*8-1}${P}`:V=`>= ${u}${P} and <= ${d}${P}`,new x.ERR_OUT_OF_RANGE("value",V,f)}le(v,A,w)}function J(f,u){if(typeof f!="number")throw new x.ERR_INVALID_ARG_TYPE(u,"number",f)}function he(f,u,d){throw Math.floor(f)!==f?(J(f,d),new x.ERR_OUT_OF_RANGE(d||"offset","an integer",f)):u<0?new x.ERR_BUFFER_OUT_OF_BOUNDS:new x.ERR_OUT_OF_RANGE(d||"offset",`>= ${d?1:0} and <= ${u}`,f)}let de=/[^+/0-9A-Za-z-_]/g;function C(f){if(f=f.split("=")[0],f=f.trim().replace(de,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function j(f,u){u=u||1/0;let d,v=f.length,A=null,w=[];for(let P=0;P55295&&d<57344){if(!A){if(d>56319){(u-=3)>-1&&w.push(239,191,189);continue}else if(P+1===v){(u-=3)>-1&&w.push(239,191,189);continue}A=d;continue}if(d<56320){(u-=3)>-1&&w.push(239,191,189),A=d;continue}d=(A-55296<<10|d-56320)+65536}else A&&(u-=3)>-1&&w.push(239,191,189);if(A=null,d<128){if((u-=1)<0)break;w.push(d)}else if(d<2048){if((u-=2)<0)break;w.push(d>>6|192,d&63|128)}else if(d<65536){if((u-=3)<0)break;w.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((u-=4)<0)break;w.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return w}function N(f){let u=[];for(let d=0;d>8,A=d%256,w.push(A),w.push(v);return w}function Q(f){return e.toByteArray(C(f))}function L(f,u,d,v){let A;for(A=0;A=u.length||A>=f.length);++A)u[A+d]=f[A];return A}function H(f,u){return f instanceof u||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===u.name}function we(f){return f!==f}let _e=function(){let f="0123456789abcdef",u=new Array(256);for(let d=0;d<16;++d){let v=d*16;for(let A=0;A<16;++A)u[v+A]=f[d]+f[A]}return u}();function Ae(f){return typeof BigInt>"u"?Re:f}function Re(){throw new Error("BigInt not supported")}return Mt}var nr,ln,pr,un,Mt,hn,_t,sr,Fo,Wo,et=Ge(()=>{ae(),se(),oe(),nr={},ln=!1,pr={},un=!1,Mt={},hn=!1,_t=Ca(),_t.Buffer,_t.SlowBuffer,_t.INSPECT_MAX_BYTES,_t.kMaxLength,sr=_t.Buffer,Fo=_t.INSPECT_MAX_BYTES,Wo=_t.kMaxLength}),ae=Ge(()=>{et()}),Ra=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0});var n=class{constructor(t){this.aliasToTopic={},this.max=t}put(t,l){return l===0||l>this.max?!1:(this.aliasToTopic[l]=t,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(t){return this.aliasToTopic[t]}clear(){this.aliasToTopic={}}};e.default=n}),Ke=me((e,n)=>{ae(),se(),oe(),n.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,l){return t.includes(l)},ArrayPrototypeIndexOf(t,l){return t.indexOf(l)},ArrayPrototypeJoin(t,l){return t.join(l)},ArrayPrototypeMap(t,l){return t.map(l)},ArrayPrototypePop(t,l){return t.pop(l)},ArrayPrototypePush(t,l){return t.push(l)},ArrayPrototypeSlice(t,l,h){return t.slice(l,h)},Error,FunctionPrototypeCall(t,l,...h){return t.call(l,...h)},FunctionPrototypeSymbolHasInstance(t,l){return Function.prototype[Symbol.hasInstance].call(t,l)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,l){return Object.defineProperties(t,l)},ObjectDefineProperty(t,l,h){return Object.defineProperty(t,l,h)},ObjectGetOwnPropertyDescriptor(t,l){return Object.getOwnPropertyDescriptor(t,l)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,l){return Object.setPrototypeOf(t,l)},Promise,PromisePrototypeCatch(t,l){return t.catch(l)},PromisePrototypeThen(t,l,h){return t.then(l,h)},PromiseReject(t){return Promise.reject(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,l){return t.test(l)},SafeSet:Set,String,StringPrototypeSlice(t,l,h){return t.slice(l,h)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(t,l,h){return t.set(l,h)},Uint8Array}}),kt=me((e,n)=>{ae(),se(),oe();var t=(et(),Me(Ze)),l=Object.getPrototypeOf(async function(){}).constructor,h=globalThis.Blob||t.Blob,s=typeof h<"u"?function(o){return o instanceof h}:function(o){return!1},r=class extends Error{constructor(o){if(!Array.isArray(o))throw new TypeError(`Expected input to be an Array, got ${typeof o}`);let i="";for(let a=0;a{o=a,i=c}),resolve:o,reject:i}},promisify(o){return new Promise((i,a)=>{o((c,...p)=>c?a(c):i(...p))})},debuglog(){return function(){}},format(o,...i){return o.replace(/%([sdifj])/g,function(...[a,c]){let p=i.shift();return c==="f"?p.toFixed(6):c==="j"?JSON.stringify(p):c==="s"&&typeof p=="object"?`${p.constructor!==Object?p.constructor.name:""} {}`.trim():p.toString()})},inspect(o){switch(typeof o){case"string":if(o.includes("'"))if(o.includes('"')){if(!o.includes("`")&&!o.includes("${"))return`\`${o}\``}else return`"${o}"`;return`'${o}'`;case"number":return isNaN(o)?"NaN":Object.is(o,-0)?String(o):o;case"bigint":return`${String(o)}n`;case"boolean":case"undefined":return String(o);case"object":return"{}"}},types:{isAsyncFunction(o){return o instanceof l},isArrayBufferView(o){return ArrayBuffer.isView(o)}},isBlob:s},n.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),Cn=me((e,n)=>{ae(),se(),oe();var{AbortController:t,AbortSignal:l}=typeof self<"u"?self:typeof window<"u"?window:void 0;n.exports=t,n.exports.AbortSignal=l,n.exports.default=t}),ot=me((e,n)=>{ae(),se(),oe();var{format:t,inspect:l,AggregateError:h}=kt(),s=globalThis.AggregateError||h,r=Symbol("kIsNodeError"),o=["string","function","number","object","Function","Object","boolean","bigint","symbol"],i=/^([A-Z][a-z0-9]*)+$/,a="__node_internal_",c={};function p(k,T){if(!k)throw new c.ERR_INTERNAL_ASSERTION(T)}function g(k){let T="",D=k.length,F=k[0]==="-"?1:0;for(;D>=F+4;D-=3)T=`_${k.slice(D-3,D)}${T}`;return`${k.slice(0,D)}${T}`}function b(k,T,D){if(typeof T=="function")return p(T.length<=D.length,`Code: ${k}; The provided arguments length (${D.length}) does not match the required ones (${T.length}).`),T(...D);let F=(T.match(/%[dfijoOs]/g)||[]).length;return p(F===D.length,`Code: ${k}; The provided arguments length (${D.length}) does not match the required ones (${F}).`),D.length===0?T:t(T,...D)}function m(k,T,D){D||(D=Error);class F extends D{constructor(...O){super(b(k,T,O))}toString(){return`${this.name} [${k}]: ${this.message}`}}Object.defineProperties(F.prototype,{name:{value:D.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${k}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),F.prototype.code=k,F.prototype[r]=!0,c[k]=F}function y(k){let T=a+k.name;return Object.defineProperty(k,"name",{value:T}),k}function I(k,T){if(k&&T&&k!==T){if(Array.isArray(T.errors))return T.errors.push(k),T;let D=new s([T,k],T.message);return D.code=T.code,D}return k||T}var U=class extends Error{constructor(k="The operation was aborted",T=void 0){if(T!==void 0&&typeof T!="object")throw new c.ERR_INVALID_ARG_TYPE("options","Object",T);super(k,T),this.code="ABORT_ERR",this.name="AbortError"}};m("ERR_ASSERTION","%s",Error),m("ERR_INVALID_ARG_TYPE",(k,T,D)=>{p(typeof k=="string","'name' must be a string"),Array.isArray(T)||(T=[T]);let F="The ";k.endsWith(" argument")?F+=`${k} `:F+=`"${k}" ${k.includes(".")?"property":"argument"} `,F+="must be ";let R=[],O=[],M=[];for(let G of T)p(typeof G=="string","All expected entries have to be of type string"),o.includes(G)?R.push(G.toLowerCase()):i.test(G)?O.push(G):(p(G!=="object",'The value "object" should be written as "Object"'),M.push(G));if(O.length>0){let G=R.indexOf("object");G!==-1&&(R.splice(R,G,1),O.push("Object"))}if(R.length>0){switch(R.length){case 1:F+=`of type ${R[0]}`;break;case 2:F+=`one of type ${R[0]} or ${R[1]}`;break;default:{let G=R.pop();F+=`one of type ${R.join(", ")}, or ${G}`}}(O.length>0||M.length>0)&&(F+=" or ")}if(O.length>0){switch(O.length){case 1:F+=`an instance of ${O[0]}`;break;case 2:F+=`an instance of ${O[0]} or ${O[1]}`;break;default:{let G=O.pop();F+=`an instance of ${O.join(", ")}, or ${G}`}}M.length>0&&(F+=" or ")}switch(M.length){case 0:break;case 1:M[0].toLowerCase()!==M[0]&&(F+="an "),F+=`${M[0]}`;break;case 2:F+=`one of ${M[0]} or ${M[1]}`;break;default:{let G=M.pop();F+=`one of ${M.join(", ")}, or ${G}`}}if(D==null)F+=`. Received ${D}`;else if(typeof D=="function"&&D.name)F+=`. Received function ${D.name}`;else if(typeof D=="object"){var W;if((W=D.constructor)!==null&&W!==void 0&&W.name)F+=`. Received an instance of ${D.constructor.name}`;else{let G=l(D,{depth:-1});F+=`. Received ${G}`}}else{let G=l(D,{colors:!1});G.length>25&&(G=`${G.slice(0,25)}...`),F+=`. Received type ${typeof D} (${G})`}return F},TypeError),m("ERR_INVALID_ARG_VALUE",(k,T,D="is invalid")=>{let F=l(T);return F.length>128&&(F=F.slice(0,128)+"..."),`The ${k.includes(".")?"property":"argument"} '${k}' ${D}. Received ${F}`},TypeError),m("ERR_INVALID_RETURN_VALUE",(k,T,D)=>{var F;let R=D!=null&&(F=D.constructor)!==null&&F!==void 0&&F.name?`instance of ${D.constructor.name}`:`type ${typeof D}`;return`Expected ${k} to be returned from the "${T}" function but got ${R}.`},TypeError),m("ERR_MISSING_ARGS",(...k)=>{p(k.length>0,"At least one arg needs to be specified");let T,D=k.length;switch(k=(Array.isArray(k)?k:[k]).map(F=>`"${F}"`).join(" or "),D){case 1:T+=`The ${k[0]} argument`;break;case 2:T+=`The ${k[0]} and ${k[1]} arguments`;break;default:{let F=k.pop();T+=`The ${k.join(", ")}, and ${F} arguments`}break}return`${T} must be specified`},TypeError),m("ERR_OUT_OF_RANGE",(k,T,D)=>{p(T,'Missing "range" argument');let F;return Number.isInteger(D)&&Math.abs(D)>2**32?F=g(String(D)):typeof D=="bigint"?(F=String(D),(D>2n**32n||D<-(2n**32n))&&(F=g(F)),F+="n"):F=l(D),`The value of "${k}" is out of range. It must be ${T}. Received ${F}`},RangeError),m("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),m("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),m("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),m("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),m("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),m("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),m("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),m("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),m("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),m("ERR_STREAM_WRITE_AFTER_END","write after end",Error),m("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),n.exports={AbortError:U,aggregateTwoErrors:y(I),hideStackFrames:y,codes:c}}),Nr=me((e,n)=>{ae(),se(),oe();var{ArrayIsArray:t,ArrayPrototypeIncludes:l,ArrayPrototypeJoin:h,ArrayPrototypeMap:s,NumberIsInteger:r,NumberIsNaN:o,NumberMAX_SAFE_INTEGER:i,NumberMIN_SAFE_INTEGER:a,NumberParseInt:c,ObjectPrototypeHasOwnProperty:p,RegExpPrototypeExec:g,String:b,StringPrototypeToUpperCase:m,StringPrototypeTrim:y}=Ke(),{hideStackFrames:I,codes:{ERR_SOCKET_BAD_PORT:U,ERR_INVALID_ARG_TYPE:k,ERR_INVALID_ARG_VALUE:T,ERR_OUT_OF_RANGE:D,ERR_UNKNOWN_SIGNAL:F}}=ot(),{normalizeEncoding:R}=kt(),{isAsyncFunction:O,isArrayBufferView:M}=kt().types,W={};function G(L){return L===(L|0)}function ee(L){return L===L>>>0}var E=/^[0-7]+$/,q="must be a 32-bit unsigned integer or an octal string";function Z(L,H,we){if(typeof L>"u"&&(L=we),typeof L=="string"){if(g(E,L)===null)throw new T(H,L,q);L=c(L,8)}return ne(L,H),L}var K=I((L,H,we=a,_e=i)=>{if(typeof L!="number")throw new k(H,"number",L);if(!r(L))throw new D(H,"an integer",L);if(L_e)throw new D(H,`>= ${we} && <= ${_e}`,L)}),ge=I((L,H,we=-2147483648,_e=2147483647)=>{if(typeof L!="number")throw new k(H,"number",L);if(!r(L))throw new D(H,"an integer",L);if(L_e)throw new D(H,`>= ${we} && <= ${_e}`,L)}),ne=I((L,H,we=!1)=>{if(typeof L!="number")throw new k(H,"number",L);if(!r(L))throw new D(H,"an integer",L);let _e=we?1:0,Ae=4294967295;if(L<_e||L>Ae)throw new D(H,`>= ${_e} && <= ${Ae}`,L)});function $(L,H){if(typeof L!="string")throw new k(H,"string",L)}function be(L,H,we=void 0,_e){if(typeof L!="number")throw new k(H,"number",L);if(we!=null&&L_e||(we!=null||_e!=null)&&o(L))throw new D(H,`${we!=null?`>= ${we}`:""}${we!=null&&_e!=null?" && ":""}${_e!=null?`<= ${_e}`:""}`,L)}var re=I((L,H,we)=>{if(!l(we,L)){let _e="must be one of: "+h(s(we,Ae=>typeof Ae=="string"?`'${Ae}'`:b(Ae)),", ");throw new T(H,L,_e)}});function ve(L,H){if(typeof L!="boolean")throw new k(H,"boolean",L)}function S(L,H,we){return L==null||!p(L,H)?we:L[H]}var Y=I((L,H,we=null)=>{let _e=S(we,"allowArray",!1),Ae=S(we,"allowFunction",!1);if(!S(we,"nullable",!1)&&L===null||!_e&&t(L)||typeof L!="object"&&(!Ae||typeof L!="function"))throw new k(H,"Object",L)}),ce=I((L,H)=>{if(L!=null&&typeof L!="object"&&typeof L!="function")throw new k(H,"a dictionary",L)}),Ee=I((L,H,we=0)=>{if(!t(L))throw new k(H,"Array",L);if(L.length{if(!M(L))throw new k(H,["Buffer","TypedArray","DataView"],L)});function le(L,H){let we=R(H),_e=L.length;if(we==="hex"&&_e%2!==0)throw new T("encoding",H,`is invalid for data of length ${_e}`)}function X(L,H="Port",we=!0){if(typeof L!="number"&&typeof L!="string"||typeof L=="string"&&y(L).length===0||+L!==+L>>>0||L>65535||L===0&&!we)throw new U(H,L,we);return L|0}var J=I((L,H)=>{if(L!==void 0&&(L===null||typeof L!="object"||!("aborted"in L)))throw new k(H,"AbortSignal",L)}),he=I((L,H)=>{if(typeof L!="function")throw new k(H,"Function",L)}),de=I((L,H)=>{if(typeof L!="function"||O(L))throw new k(H,"Function",L)}),C=I((L,H)=>{if(L!==void 0)throw new k(H,"undefined",L)});function j(L,H,we){if(!l(we,L))throw new k(H,`('${h(we,"|")}')`,L)}var N=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function te(L,H){if(typeof L>"u"||!g(N,L))throw new T(H,L,'must be an array or string of format "; rel=preload; as=style"')}function Q(L){if(typeof L=="string")return te(L,"hints"),L;if(t(L)){let H=L.length,we="";if(H===0)return we;for(let _e=0;_e; rel=preload; as=style"')}n.exports={isInt32:G,isUint32:ee,parseFileMode:Z,validateArray:Ee,validateStringArray:ue,validateBooleanArray:x,validateBoolean:ve,validateBuffer:z,validateDictionary:ce,validateEncoding:le,validateFunction:he,validateInt32:ge,validateInteger:K,validateNumber:be,validateObject:Y,validateOneOf:re,validatePlainFunction:de,validatePort:X,validateSignalName:_,validateString:$,validateUint32:ne,validateUndefined:C,validateUnion:j,validateAbortSignal:J,validateLinkHeaderValue:Q}}),er=me((e,n)=>{ae(),se(),oe();var t=n.exports={},l,h;function s(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?l=setTimeout:l=s}catch{l=s}try{typeof clearTimeout=="function"?h=clearTimeout:h=r}catch{h=r}})();function o(U){if(l===setTimeout)return setTimeout(U,0);if((l===s||!l)&&setTimeout)return l=setTimeout,setTimeout(U,0);try{return l(U,0)}catch{try{return l.call(null,U,0)}catch{return l.call(this,U,0)}}}function i(U){if(h===clearTimeout)return clearTimeout(U);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(U);try{return h(U)}catch{try{return h.call(null,U)}catch{return h.call(this,U)}}}var a=[],c=!1,p,g=-1;function b(){!c||!p||(c=!1,p.length?a=p.concat(a):g=-1,a.length&&m())}function m(){if(!c){var U=o(b);c=!0;for(var k=a.length;k;){for(p=a,a=[];++g1)for(var T=1;T{ae(),se(),oe();var{Symbol:t,SymbolAsyncIterator:l,SymbolIterator:h,SymbolFor:s}=Ke(),r=t("kDestroyed"),o=t("kIsErrored"),i=t("kIsReadable"),a=t("kIsDisturbed"),c=s("nodejs.webstream.isClosedPromise"),p=s("nodejs.webstream.controllerErrorFunction");function g(S,Y=!1){var ce;return!!(S&&typeof S.pipe=="function"&&typeof S.on=="function"&&(!Y||typeof S.pause=="function"&&typeof S.resume=="function")&&(!S._writableState||((ce=S._readableState)===null||ce===void 0?void 0:ce.readable)!==!1)&&(!S._writableState||S._readableState))}function b(S){var Y;return!!(S&&typeof S.write=="function"&&typeof S.on=="function"&&(!S._readableState||((Y=S._writableState)===null||Y===void 0?void 0:Y.writable)!==!1))}function m(S){return!!(S&&typeof S.pipe=="function"&&S._readableState&&typeof S.on=="function"&&typeof S.write=="function")}function y(S){return S&&(S._readableState||S._writableState||typeof S.write=="function"&&typeof S.on=="function"||typeof S.pipe=="function"&&typeof S.on=="function")}function I(S){return!!(S&&!y(S)&&typeof S.pipeThrough=="function"&&typeof S.getReader=="function"&&typeof S.cancel=="function")}function U(S){return!!(S&&!y(S)&&typeof S.getWriter=="function"&&typeof S.abort=="function")}function k(S){return!!(S&&!y(S)&&typeof S.readable=="object"&&typeof S.writable=="object")}function T(S){return I(S)||U(S)||k(S)}function D(S,Y){return S==null?!1:Y===!0?typeof S[l]=="function":Y===!1?typeof S[h]=="function":typeof S[l]=="function"||typeof S[h]=="function"}function F(S){if(!y(S))return null;let Y=S._writableState,ce=S._readableState,Ee=Y||ce;return!!(S.destroyed||S[r]||Ee!=null&&Ee.destroyed)}function R(S){if(!b(S))return null;if(S.writableEnded===!0)return!0;let Y=S._writableState;return Y!=null&&Y.errored?!1:typeof(Y==null?void 0:Y.ended)!="boolean"?null:Y.ended}function O(S,Y){if(!b(S))return null;if(S.writableFinished===!0)return!0;let ce=S._writableState;return ce!=null&&ce.errored?!1:typeof(ce==null?void 0:ce.finished)!="boolean"?null:!!(ce.finished||Y===!1&&ce.ended===!0&&ce.length===0)}function M(S){if(!g(S))return null;if(S.readableEnded===!0)return!0;let Y=S._readableState;return!Y||Y.errored?!1:typeof(Y==null?void 0:Y.ended)!="boolean"?null:Y.ended}function W(S,Y){if(!g(S))return null;let ce=S._readableState;return ce!=null&&ce.errored?!1:typeof(ce==null?void 0:ce.endEmitted)!="boolean"?null:!!(ce.endEmitted||Y===!1&&ce.ended===!0&&ce.length===0)}function G(S){return S&&S[i]!=null?S[i]:typeof(S==null?void 0:S.readable)!="boolean"?null:F(S)?!1:g(S)&&S.readable&&!W(S)}function ee(S){return typeof(S==null?void 0:S.writable)!="boolean"?null:F(S)?!1:b(S)&&S.writable&&!R(S)}function E(S,Y){return y(S)?F(S)?!0:!((Y==null?void 0:Y.readable)!==!1&&G(S)||(Y==null?void 0:Y.writable)!==!1&&ee(S)):null}function q(S){var Y,ce;return y(S)?S.writableErrored?S.writableErrored:(Y=(ce=S._writableState)===null||ce===void 0?void 0:ce.errored)!==null&&Y!==void 0?Y:null:null}function Z(S){var Y,ce;return y(S)?S.readableErrored?S.readableErrored:(Y=(ce=S._readableState)===null||ce===void 0?void 0:ce.errored)!==null&&Y!==void 0?Y:null:null}function K(S){if(!y(S))return null;if(typeof S.closed=="boolean")return S.closed;let Y=S._writableState,ce=S._readableState;return typeof(Y==null?void 0:Y.closed)=="boolean"||typeof(ce==null?void 0:ce.closed)=="boolean"?(Y==null?void 0:Y.closed)||(ce==null?void 0:ce.closed):typeof S._closed=="boolean"&&ge(S)?S._closed:null}function ge(S){return typeof S._closed=="boolean"&&typeof S._defaultKeepAlive=="boolean"&&typeof S._removedConnection=="boolean"&&typeof S._removedContLen=="boolean"}function ne(S){return typeof S._sent100=="boolean"&&ge(S)}function $(S){var Y;return typeof S._consuming=="boolean"&&typeof S._dumped=="boolean"&&((Y=S.req)===null||Y===void 0?void 0:Y.upgradeOrConnect)===void 0}function be(S){if(!y(S))return null;let Y=S._writableState,ce=S._readableState,Ee=Y||ce;return!Ee&&ne(S)||!!(Ee&&Ee.autoDestroy&&Ee.emitClose&&Ee.closed===!1)}function re(S){var Y;return!!(S&&((Y=S[a])!==null&&Y!==void 0?Y:S.readableDidRead||S.readableAborted))}function ve(S){var Y,ce,Ee,ue,x,_,z,le,X,J;return!!(S&&((Y=(ce=(Ee=(ue=(x=(_=S[o])!==null&&_!==void 0?_:S.readableErrored)!==null&&x!==void 0?x:S.writableErrored)!==null&&ue!==void 0?ue:(z=S._readableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&Ee!==void 0?Ee:(le=S._writableState)===null||le===void 0?void 0:le.errorEmitted)!==null&&ce!==void 0?ce:(X=S._readableState)===null||X===void 0?void 0:X.errored)!==null&&Y!==void 0?Y:!((J=S._writableState)===null||J===void 0)&&J.errored))}n.exports={kDestroyed:r,isDisturbed:re,kIsDisturbed:a,isErrored:ve,kIsErrored:o,isReadable:G,kIsReadable:i,kIsClosedPromise:c,kControllerErrorFunction:p,isClosed:K,isDestroyed:F,isDuplexNodeStream:m,isFinished:E,isIterable:D,isReadableNodeStream:g,isReadableStream:I,isReadableEnded:M,isReadableFinished:W,isReadableErrored:Z,isNodeStream:y,isWebStream:T,isWritable:ee,isWritableNodeStream:b,isWritableStream:U,isWritableEnded:R,isWritableFinished:O,isWritableErrored:q,isServerRequest:$,isServerResponse:ne,willEmitClose:be,isTransformStream:k}}),jt=me((e,n)=>{ae(),se(),oe();var t=er(),{AbortError:l,codes:h}=ot(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_PREMATURE_CLOSE:r}=h,{kEmptyObject:o,once:i}=kt(),{validateAbortSignal:a,validateFunction:c,validateObject:p,validateBoolean:g}=Nr(),{Promise:b,PromisePrototypeThen:m}=Ke(),{isClosed:y,isReadable:I,isReadableNodeStream:U,isReadableStream:k,isReadableFinished:T,isReadableErrored:D,isWritable:F,isWritableNodeStream:R,isWritableStream:O,isWritableFinished:M,isWritableErrored:W,isNodeStream:G,willEmitClose:ee,kIsClosedPromise:E}=Rt();function q($){return $.setHeader&&typeof $.abort=="function"}var Z=()=>{};function K($,be,re){var ve,S;if(arguments.length===2?(re=be,be=o):be==null?be=o:p(be,"options"),c(re,"callback"),a(be.signal,"options.signal"),re=i(re),k($)||O($))return ge($,be,re);if(!G($))throw new s("stream",["ReadableStream","WritableStream","Stream"],$);let Y=(ve=be.readable)!==null&&ve!==void 0?ve:U($),ce=(S=be.writable)!==null&&S!==void 0?S:R($),Ee=$._writableState,ue=$._readableState,x=()=>{$.writable||le()},_=ee($)&&U($)===Y&&R($)===ce,z=M($,!1),le=()=>{z=!0,$.destroyed&&(_=!1),!(_&&(!$.readable||Y))&&(!Y||X)&&re.call($)},X=T($,!1),J=()=>{X=!0,$.destroyed&&(_=!1),!(_&&(!$.writable||ce))&&(!ce||z)&&re.call($)},he=Q=>{re.call($,Q)},de=y($),C=()=>{de=!0;let Q=W($)||D($);if(Q&&typeof Q!="boolean")return re.call($,Q);if(Y&&!X&&U($,!0)&&!T($,!1))return re.call($,new r);if(ce&&!z&&!M($,!1))return re.call($,new r);re.call($)},j=()=>{de=!0;let Q=W($)||D($);if(Q&&typeof Q!="boolean")return re.call($,Q);re.call($)},N=()=>{$.req.on("finish",le)};q($)?($.on("complete",le),_||$.on("abort",C),$.req?N():$.on("request",N)):ce&&!Ee&&($.on("end",x),$.on("close",x)),!_&&typeof $.aborted=="boolean"&&$.on("aborted",C),$.on("end",J),$.on("finish",le),be.error!==!1&&$.on("error",he),$.on("close",C),de?t.nextTick(C):Ee!=null&&Ee.errorEmitted||ue!=null&&ue.errorEmitted?_||t.nextTick(j):(!Y&&(!_||I($))&&(z||F($)===!1)||!ce&&(!_||F($))&&(X||I($)===!1)||ue&&$.req&&$.aborted)&&t.nextTick(j);let te=()=>{re=Z,$.removeListener("aborted",C),$.removeListener("complete",le),$.removeListener("abort",C),$.removeListener("request",N),$.req&&$.req.removeListener("finish",le),$.removeListener("end",x),$.removeListener("close",x),$.removeListener("finish",le),$.removeListener("end",J),$.removeListener("error",he),$.removeListener("close",C)};if(be.signal&&!de){let Q=()=>{let L=re;te(),L.call($,new l(void 0,{cause:be.signal.reason}))};if(be.signal.aborted)t.nextTick(Q);else{let L=re;re=i((...H)=>{be.signal.removeEventListener("abort",Q),L.apply($,H)}),be.signal.addEventListener("abort",Q)}}return te}function ge($,be,re){let ve=!1,S=Z;if(be.signal)if(S=()=>{ve=!0,re.call($,new l(void 0,{cause:be.signal.reason}))},be.signal.aborted)t.nextTick(S);else{let ce=re;re=i((...Ee)=>{be.signal.removeEventListener("abort",S),ce.apply($,Ee)}),be.signal.addEventListener("abort",S)}let Y=(...ce)=>{ve||t.nextTick(()=>re.apply($,ce))};return m($[E].promise,Y,Y),Z}function ne($,be){var re;let ve=!1;return be===null&&(be=o),(re=be)!==null&&re!==void 0&&re.cleanup&&(g(be.cleanup,"cleanup"),ve=be.cleanup),new b((S,Y)=>{let ce=K($,be,Ee=>{ve&&ce(),Ee?Y(Ee):S()})})}n.exports=K,n.exports.finished=ne}),ar=me((e,n)=>{ae(),se(),oe();var t=er(),{aggregateTwoErrors:l,codes:{ERR_MULTIPLE_CALLBACK:h},AbortError:s}=ot(),{Symbol:r}=Ke(),{kDestroyed:o,isDestroyed:i,isFinished:a,isServerRequest:c}=Rt(),p=r("kDestroy"),g=r("kConstruct");function b(E,q,Z){E&&(E.stack,q&&!q.errored&&(q.errored=E),Z&&!Z.errored&&(Z.errored=E))}function m(E,q){let Z=this._readableState,K=this._writableState,ge=K||Z;return K!=null&&K.destroyed||Z!=null&&Z.destroyed?(typeof q=="function"&&q(),this):(b(E,K,Z),K&&(K.destroyed=!0),Z&&(Z.destroyed=!0),ge.constructed?y(this,E,q):this.once(p,function(ne){y(this,l(ne,E),q)}),this)}function y(E,q,Z){let K=!1;function ge(ne){if(K)return;K=!0;let $=E._readableState,be=E._writableState;b(ne,be,$),be&&(be.closed=!0),$&&($.closed=!0),typeof Z=="function"&&Z(ne),ne?t.nextTick(I,E,ne):t.nextTick(U,E)}try{E._destroy(q||null,ge)}catch(ne){ge(ne)}}function I(E,q){k(E,q),U(E)}function U(E){let q=E._readableState,Z=E._writableState;Z&&(Z.closeEmitted=!0),q&&(q.closeEmitted=!0),(Z!=null&&Z.emitClose||q!=null&&q.emitClose)&&E.emit("close")}function k(E,q){let Z=E._readableState,K=E._writableState;K!=null&&K.errorEmitted||Z!=null&&Z.errorEmitted||(K&&(K.errorEmitted=!0),Z&&(Z.errorEmitted=!0),E.emit("error",q))}function T(){let E=this._readableState,q=this._writableState;E&&(E.constructed=!0,E.closed=!1,E.closeEmitted=!1,E.destroyed=!1,E.errored=null,E.errorEmitted=!1,E.reading=!1,E.ended=E.readable===!1,E.endEmitted=E.readable===!1),q&&(q.constructed=!0,q.destroyed=!1,q.closed=!1,q.closeEmitted=!1,q.errored=null,q.errorEmitted=!1,q.finalCalled=!1,q.prefinished=!1,q.ended=q.writable===!1,q.ending=q.writable===!1,q.finished=q.writable===!1)}function D(E,q,Z){let K=E._readableState,ge=E._writableState;if(ge!=null&&ge.destroyed||K!=null&&K.destroyed)return this;K!=null&&K.autoDestroy||ge!=null&&ge.autoDestroy?E.destroy(q):q&&(q.stack,ge&&!ge.errored&&(ge.errored=q),K&&!K.errored&&(K.errored=q),Z?t.nextTick(k,E,q):k(E,q))}function F(E,q){if(typeof E._construct!="function")return;let Z=E._readableState,K=E._writableState;Z&&(Z.constructed=!1),K&&(K.constructed=!1),E.once(g,q),!(E.listenerCount(g)>1)&&t.nextTick(R,E)}function R(E){let q=!1;function Z(K){if(q){D(E,K??new h);return}q=!0;let ge=E._readableState,ne=E._writableState,$=ne||ge;ge&&(ge.constructed=!0),ne&&(ne.constructed=!0),$.destroyed?E.emit(p,K):K?D(E,K,!0):t.nextTick(O,E)}try{E._construct(K=>{t.nextTick(Z,K)})}catch(K){t.nextTick(Z,K)}}function O(E){E.emit(g)}function M(E){return(E==null?void 0:E.setHeader)&&typeof E.abort=="function"}function W(E){E.emit("close")}function G(E,q){E.emit("error",q),t.nextTick(W,E)}function ee(E,q){!E||i(E)||(!q&&!a(E)&&(q=new s),c(E)?(E.socket=null,E.destroy(q)):M(E)?E.abort():M(E.req)?E.req.abort():typeof E.destroy=="function"?E.destroy(q):typeof E.close=="function"?E.close():q?t.nextTick(G,E,q):t.nextTick(W,E),E.destroyed||(E[o]=!0))}n.exports={construct:F,destroyer:ee,destroy:m,undestroy:T,errorOrDestroy:D}});function Be(){Be.init.call(this)}function kr(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function $o(e){return e._maxListeners===void 0?Be.defaultMaxListeners:e._maxListeners}function Fn(e,n,t,l){var h,s,r,o;if(kr(t),(s=e._events)===void 0?(s=e._events=Object.create(null),e._eventsCount=0):(s.newListener!==void 0&&(e.emit("newListener",n,t.listener?t.listener:t),s=e._events),r=s[n]),r===void 0)r=s[n]=t,++e._eventsCount;else if(typeof r=="function"?r=s[n]=l?[t,r]:[r,t]:l?r.unshift(t):r.push(t),(h=$o(e))>0&&r.length>h&&!r.warned){r.warned=!0;var i=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");i.name="MaxListenersExceededWarning",i.emitter=e,i.type=n,i.count=r.length,o=i,console&&console.warn&&console.warn(o)}return e}function Pa(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Wn(e,n,t){var l={fired:!1,wrapFn:void 0,target:e,type:n,listener:t},h=Pa.bind(l);return h.listener=t,l.wrapFn=h,h}function $n(e,n,t){var l=e._events;if(l===void 0)return[];var h=l[n];return h===void 0?[]:typeof h=="function"?t?[h.listener||h]:[h]:t?function(s){for(var r=new Array(s.length),o=0;o{ae(),se(),oe(),Ft=typeof Reflect=="object"?Reflect:null,Hr=Ft&&typeof Ft.apply=="function"?Ft.apply:function(e,n,t){return Function.prototype.apply.call(e,n,t)},Hn=Ft&&typeof Ft.ownKeys=="function"?Ft.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)},zr=Number.isNaN||function(e){return e!=e},Vn=Be,Be.EventEmitter=Be,Be.prototype._events=void 0,Be.prototype._eventsCount=0,Be.prototype._maxListeners=void 0,Kr=10,Object.defineProperty(Be,"defaultMaxListeners",{enumerable:!0,get:function(){return Kr},set:function(e){if(typeof e!="number"||e<0||zr(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Kr=e}}),Be.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Be.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||zr(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},Be.prototype.getMaxListeners=function(){return $o(this)},Be.prototype.emit=function(e){for(var n=[],t=1;t0&&(s=n[0]),s instanceof Error)throw s;var r=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw r.context=s,r}var o=h[e];if(o===void 0)return!1;if(typeof o=="function")Hr(o,this,n);else{var i=o.length,a=qo(o,i);for(t=0;t=0;s--)if(t[s]===n||t[s].listener===n){r=t[s].listener,h=s;break}if(h<0)return this;h===0?t.shift():function(o,i){for(;i+1=0;l--)this.removeListener(e,n[l]);return this},Be.prototype.listeners=function(e){return $n(this,e,!0)},Be.prototype.rawListeners=function(e){return $n(this,e,!1)},Be.listenerCount=function(e,n){return typeof e.listenerCount=="function"?e.listenerCount(n):qn.call(e,n)},Be.prototype.listenerCount=qn,Be.prototype.eventNames=function(){return this._eventsCount>0?Hn(this._events):[]},lt=Vn,lt.EventEmitter,lt.defaultMaxListeners,lt.init,lt.listenerCount,lt.EventEmitter,lt.defaultMaxListeners,lt.init,lt.listenerCount}),tr={};Zt(tr,{EventEmitter:()=>Vo,default:()=>lt,defaultMaxListeners:()=>Ho,init:()=>zo,listenerCount:()=>Ko,on:()=>Yo,once:()=>Qo});var Vo,Ho,zo,Ko,Yo,Qo,lr=Ge(()=>{ae(),se(),oe(),zn(),zn(),lt.once=function(e,n){return new Promise((t,l)=>{function h(...r){s!==void 0&&e.removeListener("error",s),t(r)}let s;n!=="error"&&(s=r=>{e.removeListener(name,h),l(r)},e.once("error",s)),e.once(n,h)})},lt.on=function(e,n){let t=[],l=[],h=null,s=!1,r={async next(){let a=t.shift();if(a)return createIterResult(a,!1);if(h){let c=Promise.reject(h);return h=null,c}return s?createIterResult(void 0,!0):new Promise((c,p)=>l.push({resolve:c,reject:p}))},async return(){e.removeListener(n,o),e.removeListener("error",i),s=!0;for(let a of l)a.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(a){h=a,e.removeListener(n,o),e.removeListener("error",i)},[Symbol.asyncIterator](){return this}};return e.on(n,o),e.on("error",i),r;function o(...a){let c=l.shift();c?c.resolve(createIterResult(a,!1)):t.push(a)}function i(a){s=!0;let c=l.shift();c?c.reject(a):h=a,r.return()}},{EventEmitter:Vo,defaultMaxListeners:Ho,init:zo,listenerCount:Ko,on:Yo,once:Qo}=lt}),Rn=me((e,n)=>{ae(),se(),oe();var{ArrayIsArray:t,ObjectSetPrototypeOf:l}=Ke(),{EventEmitter:h}=(lr(),Me(tr));function s(o){h.call(this,o)}l(s.prototype,h.prototype),l(s,h),s.prototype.pipe=function(o,i){let a=this;function c(U){o.writable&&o.write(U)===!1&&a.pause&&a.pause()}a.on("data",c);function p(){a.readable&&a.resume&&a.resume()}o.on("drain",p),!o._isStdio&&(!i||i.end!==!1)&&(a.on("end",b),a.on("close",m));let g=!1;function b(){g||(g=!0,o.end())}function m(){g||(g=!0,typeof o.destroy=="function"&&o.destroy())}function y(U){I(),h.listenerCount(this,"error")===0&&this.emit("error",U)}r(a,"error",y),r(o,"error",y);function I(){a.removeListener("data",c),o.removeListener("drain",p),a.removeListener("end",b),a.removeListener("close",m),a.removeListener("error",y),o.removeListener("error",y),a.removeListener("end",I),a.removeListener("close",I),o.removeListener("close",I)}return a.on("end",I),a.on("close",I),o.on("close",I),o.emit("pipe",a),o};function r(o,i,a){if(typeof o.prependListener=="function")return o.prependListener(i,a);!o._events||!o._events[i]?o.on(i,a):t(o._events[i])?o._events[i].unshift(a):o._events[i]=[a,o._events[i]]}n.exports={Stream:s,prependListener:r}}),jr=me((e,n)=>{ae(),se(),oe();var{AbortError:t,codes:l}=ot(),{isNodeStream:h,isWebStream:s,kControllerErrorFunction:r}=Rt(),o=jt(),{ERR_INVALID_ARG_TYPE:i}=l,a=(c,p)=>{if(typeof c!="object"||!("aborted"in c))throw new i(p,"AbortSignal",c)};n.exports.addAbortSignal=function(c,p){if(a(c,"signal"),!h(p)&&!s(p))throw new i("stream",["ReadableStream","WritableStream","Stream"],p);return n.exports.addAbortSignalNoValidate(c,p)},n.exports.addAbortSignalNoValidate=function(c,p){if(typeof c!="object"||!("aborted"in c))return p;let g=h(p)?()=>{p.destroy(new t(void 0,{cause:c.reason}))}:()=>{p[r](new t(void 0,{cause:c.reason}))};return c.aborted?g():(c.addEventListener("abort",g),o(p,()=>c.removeEventListener("abort",g))),p}}),Ba=me((e,n)=>{ae(),se(),oe();var{StringPrototypeSlice:t,SymbolIterator:l,TypedArrayPrototypeSet:h,Uint8Array:s}=Ke(),{Buffer:r}=(et(),Me(Ze)),{inspect:o}=kt();n.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(i){let a={data:i,next:null};this.length>0?this.tail.next=a:this.head=a,this.tail=a,++this.length}unshift(i){let a={data:i,next:this.head};this.length===0&&(this.tail=a),this.head=a,++this.length}shift(){if(this.length===0)return;let i=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,i}clear(){this.head=this.tail=null,this.length=0}join(i){if(this.length===0)return"";let a=this.head,c=""+a.data;for(;(a=a.next)!==null;)c+=i+a.data;return c}concat(i){if(this.length===0)return r.alloc(0);let a=r.allocUnsafe(i>>>0),c=this.head,p=0;for(;c;)h(a,c.data,p),p+=c.data.length,c=c.next;return a}consume(i,a){let c=this.head.data;if(ig.length)a+=g,i-=g.length;else{i===g.length?(a+=g,++p,c.next?this.head=c.next:this.head=this.tail=null):(a+=t(g,0,i),this.head=c,c.data=t(g,i));break}++p}while((c=c.next)!==null);return this.length-=p,a}_getBuffer(i){let a=r.allocUnsafe(i),c=i,p=this.head,g=0;do{let b=p.data;if(i>b.length)h(a,b,c-i),i-=b.length;else{i===b.length?(h(a,b,c-i),++g,p.next?this.head=p.next:this.head=this.tail=null):(h(a,new s(b.buffer,b.byteOffset,i),c-i),this.head=p,p.data=b.slice(i));break}++g}while((p=p.next)!==null);return this.length-=g,a}[Symbol.for("nodejs.util.inspect.custom")](i,a){return o(this,{...a,depth:0,customInspect:!1})}}}),Pn=me((e,n)=>{ae(),se(),oe();var{MathFloor:t,NumberIsInteger:l}=Ke(),{ERR_INVALID_ARG_VALUE:h}=ot().codes;function s(i,a,c){return i.highWaterMark!=null?i.highWaterMark:a?i[c]:null}function r(i){return i?16:16*1024}function o(i,a,c,p){let g=s(a,p,c);if(g!=null){if(!l(g)||g<0){let b=p?`options.${c}`:"options.highWaterMark";throw new h(b,g)}return t(g)}return r(i.objectMode)}n.exports={getHighWaterMark:o,getDefaultHighWaterMark:r}});function Kn(e){var n=e.length;if(n%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");return t===-1&&(t=n),[t,t===n?0:4-t%4]}function xa(e,n,t){for(var l,h,s=[],r=n;r>18&63]+pt[h>>12&63]+pt[h>>6&63]+pt[63&h]);return s.join("")}function It(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');var n=new Uint8Array(e);return Object.setPrototypeOf(n,pe.prototype),n}function pe(e,n,t){if(typeof e=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return cn(e)}return Go(e,n,t)}function Go(e,n,t){if(typeof e=="string")return function(s,r){if(typeof r=="string"&&r!==""||(r="utf8"),!pe.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var o=0|Xo(s,r),i=It(o),a=i.write(s,r);return a!==o&&(i=i.slice(0,a)),i}(e,n);if(ArrayBuffer.isView(e))return Yr(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Tt(e,ArrayBuffer)||e&&Tt(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Tt(e,SharedArrayBuffer)||e&&Tt(e.buffer,SharedArrayBuffer)))return Ma(e,n,t);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var l=e.valueOf&&e.valueOf();if(l!=null&&l!==e)return pe.from(l,n,t);var h=function(s){if(pe.isBuffer(s)){var r=0|Bn(s.length),o=It(r);return o.length===0||s.copy(o,0,0,r),o}if(s.length!==void 0)return typeof s.length!="number"||xn(s.length)?It(0):Yr(s);if(s.type==="Buffer"&&Array.isArray(s.data))return Yr(s.data)}(e);if(h)return h;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return pe.from(e[Symbol.toPrimitive]("string"),n,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function Jo(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function cn(e){return Jo(e),It(e<0?0:0|Bn(e))}function Yr(e){for(var n=e.length<0?0:0|Bn(e.length),t=It(n),l=0;l=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function Xo(e,n){if(pe.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Tt(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var t=e.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&t===0)return 0;for(var h=!1;;)switch(n){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return fn(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*t;case"hex":return t>>>1;case"base64":return rs(e).length;default:if(h)return l?-1:fn(e).length;n=(""+n).toLowerCase(),h=!0}}function Ua(e,n,t){var l=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0)<=(n>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Va(this,n,t);case"utf8":case"utf-8":return es(this,n,t);case"ascii":return $a(this,n,t);case"latin1":case"binary":return qa(this,n,t);case"base64":return Wa(this,n,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ha(this,n,t);default:if(l)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),l=!0}}function Wt(e,n,t){var l=e[n];e[n]=e[t],e[t]=l}function Yn(e,n,t,l,h){if(e.length===0)return-1;if(typeof t=="string"?(l=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),xn(t=+t)&&(t=h?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(h)return-1;t=e.length-1}else if(t<0){if(!h)return-1;t=0}if(typeof n=="string"&&(n=pe.from(n,l)),pe.isBuffer(n))return n.length===0?-1:Qn(e,n,t,l,h);if(typeof n=="number")return n&=255,typeof Uint8Array.prototype.indexOf=="function"?h?Uint8Array.prototype.indexOf.call(e,n,t):Uint8Array.prototype.lastIndexOf.call(e,n,t):Qn(e,[n],t,l,h);throw new TypeError("val must be string, number or Buffer")}function Qn(e,n,t,l,h){var s,r=1,o=e.length,i=n.length;if(l!==void 0&&((l=String(l).toLowerCase())==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(e.length<2||n.length<2)return-1;r=2,o/=2,i/=2,t/=2}function a(b,m){return r===1?b[m]:b.readUInt16BE(m*r)}if(h){var c=-1;for(s=t;so&&(t=o-i),s=t;s>=0;s--){for(var p=!0,g=0;gh&&(l=h):l=h;var s=n.length;l>s/2&&(l=s/2);for(var r=0;r>8,i=r%256,a.push(i),a.push(o);return a}(n,e.length-t),e,t,l)}function Wa(e,n,t){return n===0&&t===e.length?xr.fromByteArray(e):xr.fromByteArray(e.slice(n,t))}function es(e,n,t){t=Math.min(e.length,t);for(var l=[],h=n;h239?4:a>223?3:a>191?2:1;if(h+p<=t)switch(p){case 1:a<128&&(c=a);break;case 2:(192&(s=e[h+1]))==128&&(i=(31&a)<<6|63&s)>127&&(c=i);break;case 3:s=e[h+1],r=e[h+2],(192&s)==128&&(192&r)==128&&(i=(15&a)<<12|(63&s)<<6|63&r)>2047&&(i<55296||i>57343)&&(c=i);break;case 4:s=e[h+1],r=e[h+2],o=e[h+3],(192&s)==128&&(192&r)==128&&(192&o)==128&&(i=(15&a)<<18|(63&s)<<12|(63&r)<<6|63&o)>65535&&i<1114112&&(c=i)}c===null?(c=65533,p=1):c>65535&&(c-=65536,l.push(c>>>10&1023|55296),c=56320|1023&c),l.push(c),h+=p}return function(g){var b=g.length;if(b<=4096)return String.fromCharCode.apply(String,g);for(var m="",y=0;yl)&&(t=l);for(var h="",s=n;st)throw new RangeError("Trying to access beyond buffer length")}function nt(e,n,t,l,h,s){if(!pe.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>h||ne.length)throw new RangeError("Index out of range")}function ts(e,n,t,l,h,s){if(t+l>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Gn(e,n,t,l,h){return n=+n,t>>>=0,h||ts(e,0,t,4),Kt.write(e,n,t,l,23,4),t+4}function Jn(e,n,t,l,h){return n=+n,t>>>=0,h||ts(e,0,t,8),Kt.write(e,n,t,l,52,8),t+8}function fn(e,n){var t;n=n||1/0;for(var l=e.length,h=null,s=[],r=0;r55295&&t<57344){if(!h){if(t>56319){(n-=3)>-1&&s.push(239,191,189);continue}if(r+1===l){(n-=3)>-1&&s.push(239,191,189);continue}h=t;continue}if(t<56320){(n-=3)>-1&&s.push(239,191,189),h=t;continue}t=65536+(h-55296<<10|t-56320)}else h&&(n-=3)>-1&&s.push(239,191,189);if(h=null,t<128){if((n-=1)<0)break;s.push(t)}else if(t<2048){if((n-=2)<0)break;s.push(t>>6|192,63&t|128)}else if(t<65536){if((n-=3)<0)break;s.push(t>>12|224,t>>6&63|128,63&t|128)}else{if(!(t<1114112))throw new Error("Invalid code point");if((n-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}}return s}function rs(e){return xr.toByteArray(function(n){if((n=(n=n.split("=")[0]).trim().replace(is,"")).length<2)return"";for(;n.length%4!=0;)n+="=";return n}(e))}function Dr(e,n,t,l){for(var h=0;h=n.length||h>=e.length);++h)n[h+t]=e[h];return h}function Tt(e,n){return e instanceof n||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===n.name}function xn(e){return e!=e}function Xn(e,n){for(var t in e)n[t]=e[t]}function $t(e,n,t){return ft(e,n,t)}function ur(e){var n;switch(this.encoding=function(t){var l=function(h){if(!h)return"utf8";for(var s;;)switch(h){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return h;default:if(s)return;h=(""+h).toLowerCase(),s=!0}}(t);if(typeof l!="string"&&(Mr.isEncoding===dn||!dn(t)))throw new Error("Unknown encoding: "+t);return l||t}(e),this.encoding){case"utf16le":this.text=Ka,this.end=Ya,n=4;break;case"utf8":this.fillLast=za,n=4;break;case"base64":this.text=Qa,this.end=Ga,n=3;break;default:return this.write=Ja,this.end=Xa,void 0}this.lastNeed=0,this.lastTotal=0,this.lastChar=Mr.allocUnsafe(n)}function Qr(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function za(e){var n=this.lastTotal-this.lastNeed,t=function(l,h,s){if((192&h[0])!=128)return l.lastNeed=0,"�";if(l.lastNeed>1&&h.length>1){if((192&h[1])!=128)return l.lastNeed=1,"�";if(l.lastNeed>2&&h.length>2&&(192&h[2])!=128)return l.lastNeed=2,"�"}}(this,e);return t!==void 0?t:this.lastNeed<=e.length?(e.copy(this.lastChar,n,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,n,0,e.length),this.lastNeed-=e.length,void 0)}function Ka(e,n){if((e.length-n)%2==0){var t=e.toString("utf16le",n);if(t){var l=t.charCodeAt(t.length-1);if(l>=55296&&l<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],t.slice(0,-1)}return t}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",n,e.length-1)}function Ya(e){var n=e&&e.length?this.write(e):"";if(this.lastNeed){var t=this.lastTotal-this.lastNeed;return n+this.lastChar.toString("utf16le",0,t)}return n}function Qa(e,n){var t=(e.length-n)%3;return t===0?e.toString("base64",n):(this.lastNeed=3-t,this.lastTotal=3,t===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",n,e.length-t))}function Ga(e){var n=e&&e.length?this.write(e):"";return this.lastNeed?n+this.lastChar.toString("base64",0,3-this.lastNeed):n}function Ja(e){return e.toString(this.encoding)}function Xa(e){return e&&e.length?this.write(e):""}var Zn,pt,st,eo,vr,qt,to,ro,gt,xr,Kt,Gr,is,ns,hr,cr,ft,io,or,Mr,dn,no=Ge(()=>{for(ae(),se(),oe(),Zn={byteLength:function(e){var n=Kn(e),t=n[0],l=n[1];return 3*(t+l)/4-l},toByteArray:function(e){var n,t,l=Kn(e),h=l[0],s=l[1],r=new eo(function(a,c,p){return 3*(c+p)/4-p}(0,h,s)),o=0,i=s>0?h-4:h;for(t=0;t>16&255,r[o++]=n>>8&255,r[o++]=255&n;return s===2&&(n=st[e.charCodeAt(t)]<<2|st[e.charCodeAt(t+1)]>>4,r[o++]=255&n),s===1&&(n=st[e.charCodeAt(t)]<<10|st[e.charCodeAt(t+1)]<<4|st[e.charCodeAt(t+2)]>>2,r[o++]=n>>8&255,r[o++]=255&n),r},fromByteArray:function(e){for(var n,t=e.length,l=t%3,h=[],s=0,r=t-l;sr?r:s+16383));return l===1?(n=e[t-1],h.push(pt[n>>2]+pt[n<<4&63]+"==")):l===2&&(n=(e[t-2]<<8)+e[t-1],h.push(pt[n>>10]+pt[n>>4&63]+pt[n<<2&63]+"=")),h.join("")}},pt=[],st=[],eo=typeof Uint8Array<"u"?Uint8Array:Array,vr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qt=0,to=vr.length;qt>1,c=-7,p=t?h-1:0,g=t?-1:1,b=e[n+p];for(p+=g,s=b&(1<<-c)-1,b>>=-c,c+=o;c>0;s=256*s+e[n+p],p+=g,c-=8);for(r=s&(1<<-c)-1,s>>=-c,c+=l;c>0;r=256*r+e[n+p],p+=g,c-=8);if(s===0)s=1-a;else{if(s===i)return r?NaN:1/0*(b?-1:1);r+=Math.pow(2,l),s-=a}return(b?-1:1)*r*Math.pow(2,s-l)},write:function(e,n,t,l,h,s){var r,o,i,a=8*s-h-1,c=(1<>1,g=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=l?0:s-1,m=l?1:-1,y=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(o=isNaN(n)?1:0,r=c):(r=Math.floor(Math.log(n)/Math.LN2),n*(i=Math.pow(2,-r))<1&&(r--,i*=2),(n+=r+p>=1?g/i:g*Math.pow(2,1-p))*i>=2&&(r++,i/=2),r+p>=c?(o=0,r=c):r+p>=1?(o=(n*i-1)*Math.pow(2,h),r+=p):(o=n*Math.pow(2,p-1)*Math.pow(2,h),r=0));h>=8;e[t+b]=255&o,b+=m,o/=256,h-=8);for(r=r<0;e[t+b]=255&r,b+=m,r/=256,a-=8);e[t+b-m]|=128*y}},gt={},xr=Zn,Kt=ro,Gr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null,gt.Buffer=pe,gt.SlowBuffer=function(e){return+e!=e&&(e=0),pe.alloc(+e)},gt.INSPECT_MAX_BYTES=50,gt.kMaxLength=2147483647,pe.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(e,n),e.foo()===42}catch{return!1}}(),pe.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(pe.prototype,"parent",{enumerable:!0,get:function(){if(pe.isBuffer(this))return this.buffer}}),Object.defineProperty(pe.prototype,"offset",{enumerable:!0,get:function(){if(pe.isBuffer(this))return this.byteOffset}}),pe.poolSize=8192,pe.from=function(e,n,t){return Go(e,n,t)},Object.setPrototypeOf(pe.prototype,Uint8Array.prototype),Object.setPrototypeOf(pe,Uint8Array),pe.alloc=function(e,n,t){return function(l,h,s){return Jo(l),l<=0?It(l):h!==void 0?typeof s=="string"?It(l).fill(h,s):It(l).fill(h):It(l)}(e,n,t)},pe.allocUnsafe=function(e){return cn(e)},pe.allocUnsafeSlow=function(e){return cn(e)},pe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==pe.prototype},pe.compare=function(e,n){if(Tt(e,Uint8Array)&&(e=pe.from(e,e.offset,e.byteLength)),Tt(n,Uint8Array)&&(n=pe.from(n,n.offset,n.byteLength)),!pe.isBuffer(e)||!pe.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===n)return 0;for(var t=e.length,l=n.length,h=0,s=Math.min(t,l);hn&&(e+=" ... "),""},Gr&&(pe.prototype[Gr]=pe.prototype.inspect),pe.prototype.compare=function(e,n,t,l,h){if(Tt(e,Uint8Array)&&(e=pe.from(e,e.offset,e.byteLength)),!pe.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(n===void 0&&(n=0),t===void 0&&(t=e?e.length:0),l===void 0&&(l=0),h===void 0&&(h=this.length),n<0||t>e.length||l<0||h>this.length)throw new RangeError("out of range index");if(l>=h&&n>=t)return 0;if(l>=h)return-1;if(n>=t)return 1;if(this===e)return 0;for(var s=(h>>>=0)-(l>>>=0),r=(t>>>=0)-(n>>>=0),o=Math.min(s,r),i=this.slice(l,h),a=e.slice(n,t),c=0;c>>=0,isFinite(t)?(t>>>=0,l===void 0&&(l="utf8")):(l=t,t=void 0)}var h=this.length-n;if((t===void 0||t>h)&&(t=h),e.length>0&&(t<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");l||(l="utf8");for(var s=!1;;)switch(l){case"hex":return La(this,e,n,t);case"utf8":case"utf-8":return Na(this,e,n,t);case"ascii":return Zo(this,e,n,t);case"latin1":case"binary":return ja(this,e,n,t);case"base64":return Da(this,e,n,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fa(this,e,n,t);default:if(s)throw new TypeError("Unknown encoding: "+l);l=(""+l).toLowerCase(),s=!0}},pe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},pe.prototype.slice=function(e,n){var t=this.length;(e=~~e)<0?(e+=t)<0&&(e=0):e>t&&(e=t),(n=n===void 0?t:~~n)<0?(n+=t)<0&&(n=0):n>t&&(n=t),n>>=0,n>>>=0,t||Ye(e,n,this.length);for(var l=this[e],h=1,s=0;++s>>=0,n>>>=0,t||Ye(e,n,this.length);for(var l=this[e+--n],h=1;n>0&&(h*=256);)l+=this[e+--n]*h;return l},pe.prototype.readUInt8=function(e,n){return e>>>=0,n||Ye(e,1,this.length),this[e]},pe.prototype.readUInt16LE=function(e,n){return e>>>=0,n||Ye(e,2,this.length),this[e]|this[e+1]<<8},pe.prototype.readUInt16BE=function(e,n){return e>>>=0,n||Ye(e,2,this.length),this[e]<<8|this[e+1]},pe.prototype.readUInt32LE=function(e,n){return e>>>=0,n||Ye(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},pe.prototype.readUInt32BE=function(e,n){return e>>>=0,n||Ye(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},pe.prototype.readIntLE=function(e,n,t){e>>>=0,n>>>=0,t||Ye(e,n,this.length);for(var l=this[e],h=1,s=0;++s=(h*=128)&&(l-=Math.pow(2,8*n)),l},pe.prototype.readIntBE=function(e,n,t){e>>>=0,n>>>=0,t||Ye(e,n,this.length);for(var l=n,h=1,s=this[e+--l];l>0&&(h*=256);)s+=this[e+--l]*h;return s>=(h*=128)&&(s-=Math.pow(2,8*n)),s},pe.prototype.readInt8=function(e,n){return e>>>=0,n||Ye(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},pe.prototype.readInt16LE=function(e,n){e>>>=0,n||Ye(e,2,this.length);var t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},pe.prototype.readInt16BE=function(e,n){e>>>=0,n||Ye(e,2,this.length);var t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},pe.prototype.readInt32LE=function(e,n){return e>>>=0,n||Ye(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},pe.prototype.readInt32BE=function(e,n){return e>>>=0,n||Ye(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},pe.prototype.readFloatLE=function(e,n){return e>>>=0,n||Ye(e,4,this.length),Kt.read(this,e,!0,23,4)},pe.prototype.readFloatBE=function(e,n){return e>>>=0,n||Ye(e,4,this.length),Kt.read(this,e,!1,23,4)},pe.prototype.readDoubleLE=function(e,n){return e>>>=0,n||Ye(e,8,this.length),Kt.read(this,e,!0,52,8)},pe.prototype.readDoubleBE=function(e,n){return e>>>=0,n||Ye(e,8,this.length),Kt.read(this,e,!1,52,8)},pe.prototype.writeUIntLE=function(e,n,t,l){e=+e,n>>>=0,t>>>=0,l||nt(this,e,n,t,Math.pow(2,8*t)-1,0);var h=1,s=0;for(this[n]=255&e;++s>>=0,t>>>=0,l||nt(this,e,n,t,Math.pow(2,8*t)-1,0);var h=t-1,s=1;for(this[n+h]=255&e;--h>=0&&(s*=256);)this[n+h]=e/s&255;return n+t},pe.prototype.writeUInt8=function(e,n,t){return e=+e,n>>>=0,t||nt(this,e,n,1,255,0),this[n]=255&e,n+1},pe.prototype.writeUInt16LE=function(e,n,t){return e=+e,n>>>=0,t||nt(this,e,n,2,65535,0),this[n]=255&e,this[n+1]=e>>>8,n+2},pe.prototype.writeUInt16BE=function(e,n,t){return e=+e,n>>>=0,t||nt(this,e,n,2,65535,0),this[n]=e>>>8,this[n+1]=255&e,n+2},pe.prototype.writeUInt32LE=function(e,n,t){return e=+e,n>>>=0,t||nt(this,e,n,4,4294967295,0),this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=255&e,n+4},pe.prototype.writeUInt32BE=function(e,n,t){return e=+e,n>>>=0,t||nt(this,e,n,4,4294967295,0),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e,n+4},pe.prototype.writeIntLE=function(e,n,t,l){if(e=+e,n>>>=0,!l){var h=Math.pow(2,8*t-1);nt(this,e,n,t,h-1,-h)}var s=0,r=1,o=0;for(this[n]=255&e;++s>0)-o&255;return n+t},pe.prototype.writeIntBE=function(e,n,t,l){if(e=+e,n>>>=0,!l){var h=Math.pow(2,8*t-1);nt(this,e,n,t,h-1,-h)}var s=t-1,r=1,o=0;for(this[n+s]=255&e;--s>=0&&(r*=256);)e<0&&o===0&&this[n+s+1]!==0&&(o=1),this[n+s]=(e/r>>0)-o&255;return n+t},pe.prototype.writeInt8=function(e,n,t){return e=+e,n>>>=0,t||nt(this,e,n,1,127,-128),e<0&&(e=255+e+1),this[n]=255&e,n+1},pe.prototype.writeInt16LE=function(e,n,t){return e=+e,n>>>=0,t||nt(this,e,n,2,32767,-32768),this[n]=255&e,this[n+1]=e>>>8,n+2},pe.prototype.writeInt16BE=function(e,n,t){return e=+e,n>>>=0,t||nt(this,e,n,2,32767,-32768),this[n]=e>>>8,this[n+1]=255&e,n+2},pe.prototype.writeInt32LE=function(e,n,t){return e=+e,n>>>=0,t||nt(this,e,n,4,2147483647,-2147483648),this[n]=255&e,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24,n+4},pe.prototype.writeInt32BE=function(e,n,t){return e=+e,n>>>=0,t||nt(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=255&e,n+4},pe.prototype.writeFloatLE=function(e,n,t){return Gn(this,e,n,!0,t)},pe.prototype.writeFloatBE=function(e,n,t){return Gn(this,e,n,!1,t)},pe.prototype.writeDoubleLE=function(e,n,t){return Jn(this,e,n,!0,t)},pe.prototype.writeDoubleBE=function(e,n,t){return Jn(this,e,n,!1,t)},pe.prototype.copy=function(e,n,t,l){if(!pe.isBuffer(e))throw new TypeError("argument should be a Buffer");if(t||(t=0),l||l===0||(l=this.length),n>=e.length&&(n=e.length),n||(n=0),l>0&&l=this.length)throw new RangeError("Index out of range");if(l<0)throw new RangeError("sourceEnd out of bounds");l>this.length&&(l=this.length),e.length-n=0;--s)e[s+n]=this[s+t];else Uint8Array.prototype.set.call(e,this.subarray(t,l),n);return h},pe.prototype.fill=function(e,n,t,l){if(typeof e=="string"){if(typeof n=="string"?(l=n,n=0,t=this.length):typeof t=="string"&&(l=t,t=this.length),l!==void 0&&typeof l!="string")throw new TypeError("encoding must be a string");if(typeof l=="string"&&!pe.isEncoding(l))throw new TypeError("Unknown encoding: "+l);if(e.length===1){var h=e.charCodeAt(0);(l==="utf8"&&h<128||l==="latin1")&&(e=h)}}else typeof e=="number"?e&=255:typeof e=="boolean"&&(e=Number(e));if(n<0||this.length>>=0,t=t===void 0?this.length:t>>>0,e||(e=0),typeof e=="number")for(s=n;s=0?(i>0&&(h.lastNeed=i-1),i):--o=0?(i>0&&(h.lastNeed=i-2),i):--o=0?(i>0&&(i===2?i=0:h.lastNeed=i-3),i):0}(this,e,n);if(!this.lastNeed)return e.toString("utf8",n);this.lastTotal=t;var l=e.length-(t-this.lastNeed);return e.copy(this.lastChar,0,l),e.toString("utf8",n,l)},ur.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},or.StringDecoder,or.StringDecoder}),os={};Zt(os,{StringDecoder:()=>ss,default:()=>or});var ss,Za=Ge(()=>{ae(),se(),oe(),no(),no(),ss=or.StringDecoder}),as=me((e,n)=>{ae(),se(),oe();var t=er(),{PromisePrototypeThen:l,SymbolAsyncIterator:h,SymbolIterator:s}=Ke(),{Buffer:r}=(et(),Me(Ze)),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_NULL_VALUES:i}=ot().codes;function a(c,p,g){let b;if(typeof p=="string"||p instanceof r)return new c({objectMode:!0,...g,read(){this.push(p),this.push(null)}});let m;if(p&&p[h])m=!0,b=p[h]();else if(p&&p[s])m=!1,b=p[s]();else throw new o("iterable",["Iterable"],p);let y=new c({objectMode:!0,highWaterMark:1,...g}),I=!1;y._read=function(){I||(I=!0,k())},y._destroy=function(T,D){l(U(T),()=>t.nextTick(D,T),F=>t.nextTick(D,F||T))};async function U(T){let D=T!=null,F=typeof b.throw=="function";if(D&&F){let{value:R,done:O}=await b.throw(T);if(await R,O)return}if(typeof b.return=="function"){let{value:R}=await b.return();await R}}async function k(){for(;;){try{let{value:T,done:D}=m?await b.next():b.next();if(D)y.push(null);else{let F=T&&typeof T.then=="function"?await T:T;if(F===null)throw I=!1,new i;if(y.push(F))continue;I=!1}}catch(T){y.destroy(T)}break}}return y}n.exports=a}),Fr=me((e,n)=>{ae(),se(),oe();var t=er(),{ArrayPrototypeIndexOf:l,NumberIsInteger:h,NumberIsNaN:s,NumberParseInt:r,ObjectDefineProperties:o,ObjectKeys:i,ObjectSetPrototypeOf:a,Promise:c,SafeSet:p,SymbolAsyncIterator:g,Symbol:b}=Ke();n.exports=S,S.ReadableState=ve;var{EventEmitter:m}=(lr(),Me(tr)),{Stream:y,prependListener:I}=Rn(),{Buffer:U}=(et(),Me(Ze)),{addAbortSignal:k}=jr(),T=jt(),D=kt().debuglog("stream",u=>{D=u}),F=Ba(),R=ar(),{getHighWaterMark:O,getDefaultHighWaterMark:M}=Pn(),{aggregateTwoErrors:W,codes:{ERR_INVALID_ARG_TYPE:G,ERR_METHOD_NOT_IMPLEMENTED:ee,ERR_OUT_OF_RANGE:E,ERR_STREAM_PUSH_AFTER_EOF:q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Z}}=ot(),{validateObject:K}=Nr(),ge=b("kPaused"),{StringDecoder:ne}=(Za(),Me(os)),$=as();a(S.prototype,y.prototype),a(S,y);var be=()=>{},{errorOrDestroy:re}=R;function ve(u,d,v){typeof v!="boolean"&&(v=d instanceof Ot()),this.objectMode=!!(u&&u.objectMode),v&&(this.objectMode=this.objectMode||!!(u&&u.readableObjectMode)),this.highWaterMark=u?O(this,u,"readableHighWaterMark",v):M(!1),this.buffer=new F,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[ge]=null,this.errorEmitted=!1,this.emitClose=!u||u.emitClose!==!1,this.autoDestroy=!u||u.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=u&&u.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,u&&u.encoding&&(this.decoder=new ne(u.encoding),this.encoding=u.encoding)}function S(u){if(!(this instanceof S))return new S(u);let d=this instanceof Ot();this._readableState=new ve(u,this,d),u&&(typeof u.read=="function"&&(this._read=u.read),typeof u.destroy=="function"&&(this._destroy=u.destroy),typeof u.construct=="function"&&(this._construct=u.construct),u.signal&&!d&&k(u.signal,this)),y.call(this,u),R.construct(this,()=>{this._readableState.needReadable&&X(this,this._readableState)})}S.prototype.destroy=R.destroy,S.prototype._undestroy=R.undestroy,S.prototype._destroy=function(u,d){d(u)},S.prototype[m.captureRejectionSymbol]=function(u){this.destroy(u)},S.prototype.push=function(u,d){return Y(this,u,d,!1)},S.prototype.unshift=function(u,d){return Y(this,u,d,!0)};function Y(u,d,v,A){D("readableAddChunk",d);let w=u._readableState,P;if(w.objectMode||(typeof d=="string"?(v=v||w.defaultEncoding,w.encoding!==v&&(A&&w.encoding?d=U.from(d,v).toString(w.encoding):(d=U.from(d,v),v=""))):d instanceof U?v="":y._isUint8Array(d)?(d=y._uint8ArrayToBuffer(d),v=""):d!=null&&(P=new G("chunk",["string","Buffer","Uint8Array"],d))),P)re(u,P);else if(d===null)w.reading=!1,_(u,w);else if(w.objectMode||d&&d.length>0)if(A)if(w.endEmitted)re(u,new Z);else{if(w.destroyed||w.errored)return!1;ce(u,w,d,!0)}else if(w.ended)re(u,new q);else{if(w.destroyed||w.errored)return!1;w.reading=!1,w.decoder&&!v?(d=w.decoder.write(d),w.objectMode||d.length!==0?ce(u,w,d,!1):X(u,w)):ce(u,w,d,!1)}else A||(w.reading=!1,X(u,w));return!w.ended&&(w.length0?(d.multiAwaitDrain?d.awaitDrainWriters.clear():d.awaitDrainWriters=null,d.dataEmitted=!0,u.emit("data",v)):(d.length+=d.objectMode?1:v.length,A?d.buffer.unshift(v):d.buffer.push(v),d.needReadable&&z(u)),X(u,d)}S.prototype.isPaused=function(){let u=this._readableState;return u[ge]===!0||u.flowing===!1},S.prototype.setEncoding=function(u){let d=new ne(u);this._readableState.decoder=d,this._readableState.encoding=this._readableState.decoder.encoding;let v=this._readableState.buffer,A="";for(let w of v)A+=d.write(w);return v.clear(),A!==""&&v.push(A),this._readableState.length=A.length,this};var Ee=1073741824;function ue(u){if(u>Ee)throw new E("size","<= 1GiB",u);return u--,u|=u>>>1,u|=u>>>2,u|=u>>>4,u|=u>>>8,u|=u>>>16,u++,u}function x(u,d){return u<=0||d.length===0&&d.ended?0:d.objectMode?1:s(u)?d.flowing&&d.length?d.buffer.first().length:d.length:u<=d.length?u:d.ended?d.length:0}S.prototype.read=function(u){D("read",u),u===void 0?u=NaN:h(u)||(u=r(u,10));let d=this._readableState,v=u;if(u>d.highWaterMark&&(d.highWaterMark=ue(u)),u!==0&&(d.emittedReadable=!1),u===0&&d.needReadable&&((d.highWaterMark!==0?d.length>=d.highWaterMark:d.length>0)||d.ended))return D("read: emitReadable",d.length,d.ended),d.length===0&&d.ended?we(this):z(this),null;if(u=x(u,d),u===0&&d.ended)return d.length===0&&we(this),null;let A=d.needReadable;if(D("need readable",A),(d.length===0||d.length-u0?w=H(u,d):w=null,w===null?(d.needReadable=d.length<=d.highWaterMark,u=0):(d.length-=u,d.multiAwaitDrain?d.awaitDrainWriters.clear():d.awaitDrainWriters=null),d.length===0&&(d.ended||(d.needReadable=!0),v!==u&&d.ended&&we(this)),w!==null&&!d.errorEmitted&&!d.closeEmitted&&(d.dataEmitted=!0,this.emit("data",w)),w};function _(u,d){if(D("onEofChunk"),!d.ended){if(d.decoder){let v=d.decoder.end();v&&v.length&&(d.buffer.push(v),d.length+=d.objectMode?1:v.length)}d.ended=!0,d.sync?z(u):(d.needReadable=!1,d.emittedReadable=!0,le(u))}}function z(u){let d=u._readableState;D("emitReadable",d.needReadable,d.emittedReadable),d.needReadable=!1,d.emittedReadable||(D("emitReadable",d.flowing),d.emittedReadable=!0,t.nextTick(le,u))}function le(u){let d=u._readableState;D("emitReadable_",d.destroyed,d.length,d.ended),!d.destroyed&&!d.errored&&(d.length||d.ended)&&(u.emit("readable"),d.emittedReadable=!1),d.needReadable=!d.flowing&&!d.ended&&d.length<=d.highWaterMark,te(u)}function X(u,d){!d.readingMore&&d.constructed&&(d.readingMore=!0,t.nextTick(J,u,d))}function J(u,d){for(;!d.reading&&!d.ended&&(d.length1&&A.pipes.includes(u)&&(D("false write response, pause",A.awaitDrainWriters.size),A.awaitDrainWriters.add(u)),v.pause()),fe||(fe=he(v,u),u.on("drain",fe))}v.on("data",ke);function ke(Ve){D("ondata");let He=u.write(Ve);D("dest.write",He),He===!1&&Se()}function $e(Ve){if(D("onerror",Ve),rt(),u.removeListener("error",$e),u.listenerCount("error")===0){let He=u._writableState||u._readableState;He&&!He.errorEmitted?re(u,Ve):u.emit("error",Ve)}}I(u,"error",$e);function tt(){u.removeListener("finish",xe),rt()}u.once("close",tt);function xe(){D("onfinish"),u.removeListener("close",tt),rt()}u.once("finish",xe);function rt(){D("unpipe"),v.unpipe(u)}return u.emit("pipe",v),u.writableNeedDrain===!0?A.flowing&&Se():A.flowing||(D("pipe resume"),v.resume()),u};function he(u,d){return function(){let v=u._readableState;v.awaitDrainWriters===d?(D("pipeOnDrain",1),v.awaitDrainWriters=null):v.multiAwaitDrain&&(D("pipeOnDrain",v.awaitDrainWriters.size),v.awaitDrainWriters.delete(d)),(!v.awaitDrainWriters||v.awaitDrainWriters.size===0)&&u.listenerCount("data")&&u.resume()}}S.prototype.unpipe=function(u){let d=this._readableState,v={hasUnpiped:!1};if(d.pipes.length===0)return this;if(!u){let w=d.pipes;d.pipes=[],this.pause();for(let P=0;P0,A.flowing!==!1&&this.resume()):u==="readable"&&!A.endEmitted&&!A.readableListening&&(A.readableListening=A.needReadable=!0,A.flowing=!1,A.emittedReadable=!1,D("on readable",A.length,A.reading),A.length?z(this):A.reading||t.nextTick(C,this)),v},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(u,d){let v=y.prototype.removeListener.call(this,u,d);return u==="readable"&&t.nextTick(de,this),v},S.prototype.off=S.prototype.removeListener,S.prototype.removeAllListeners=function(u){let d=y.prototype.removeAllListeners.apply(this,arguments);return(u==="readable"||u===void 0)&&t.nextTick(de,this),d};function de(u){let d=u._readableState;d.readableListening=u.listenerCount("readable")>0,d.resumeScheduled&&d[ge]===!1?d.flowing=!0:u.listenerCount("data")>0?u.resume():d.readableListening||(d.flowing=null)}function C(u){D("readable nexttick read 0"),u.read(0)}S.prototype.resume=function(){let u=this._readableState;return u.flowing||(D("resume"),u.flowing=!u.readableListening,j(this,u)),u[ge]=!1,this};function j(u,d){d.resumeScheduled||(d.resumeScheduled=!0,t.nextTick(N,u,d))}function N(u,d){D("resume",d.reading),d.reading||u.read(0),d.resumeScheduled=!1,u.emit("resume"),te(u),d.flowing&&!d.reading&&u.read(0)}S.prototype.pause=function(){return D("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(D("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[ge]=!0,this};function te(u){let d=u._readableState;for(D("flow",d.flowing);d.flowing&&u.read()!==null;);}S.prototype.wrap=function(u){let d=!1;u.on("data",A=>{!this.push(A)&&u.pause&&(d=!0,u.pause())}),u.on("end",()=>{this.push(null)}),u.on("error",A=>{re(this,A)}),u.on("close",()=>{this.destroy()}),u.on("destroy",()=>{this.destroy()}),this._read=()=>{d&&u.resume&&(d=!1,u.resume())};let v=i(u);for(let A=1;A{w=V?W(w,V):null,v(),v=be});try{for(;;){let V=u.destroyed?null:u.read();if(V!==null)yield V;else{if(w)throw w;if(w===null)return;await new c(A)}}}catch(V){throw w=W(w,V),w}finally{(w||(d==null?void 0:d.destroyOnReturn)!==!1)&&(w===void 0||u._readableState.autoDestroy)?R.destroyer(u,null):(u.off("readable",A),P())}}o(S.prototype,{readable:{__proto__:null,get(){let u=this._readableState;return!!u&&u.readable!==!1&&!u.destroyed&&!u.errorEmitted&&!u.endEmitted},set(u){this._readableState&&(this._readableState.readable=!!u)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(u){this._readableState&&(this._readableState.flowing=u)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(u){this._readableState&&(this._readableState.destroyed=u)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),o(ve.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[ge]!==!1},set(u){this[ge]=!!u}}}),S._fromList=H;function H(u,d){if(d.length===0)return null;let v;return d.objectMode?v=d.buffer.shift():!u||u>=d.length?(d.decoder?v=d.buffer.join(""):d.buffer.length===1?v=d.buffer.first():v=d.buffer.concat(d.length),d.buffer.clear()):v=d.buffer.consume(u,d.decoder),v}function we(u){let d=u._readableState;D("endReadable",d.endEmitted),d.endEmitted||(d.ended=!0,t.nextTick(_e,d,u))}function _e(u,d){if(D("endReadableNT",u.endEmitted,u.length),!u.errored&&!u.closeEmitted&&!u.endEmitted&&u.length===0){if(u.endEmitted=!0,d.emit("end"),d.writable&&d.allowHalfOpen===!1)t.nextTick(Ae,d);else if(u.autoDestroy){let v=d._writableState;(!v||v.autoDestroy&&(v.finished||v.writable===!1))&&d.destroy()}}}function Ae(u){u.writable&&!u.writableEnded&&!u.destroyed&&u.end()}S.from=function(u,d){return $(S,u,d)};var Re;function f(){return Re===void 0&&(Re={}),Re}S.fromWeb=function(u,d){return f().newStreamReadableFromReadableStream(u,d)},S.toWeb=function(u,d){return f().newReadableStreamFromStreamReadable(u,d)},S.wrap=function(u,d){var v,A;return new S({objectMode:(v=(A=u.readableObjectMode)!==null&&A!==void 0?A:u.objectMode)!==null&&v!==void 0?v:!0,...d,destroy(w,P){R.destroyer(u,w),P(w)}}).wrap(u)}}),ls=me((e,n)=>{ae(),se(),oe();var t=er(),{ArrayPrototypeSlice:l,Error:h,FunctionPrototypeSymbolHasInstance:s,ObjectDefineProperty:r,ObjectDefineProperties:o,ObjectSetPrototypeOf:i,StringPrototypeToLowerCase:a,Symbol:c,SymbolHasInstance:p}=Ke();n.exports=ne,ne.WritableState=K;var{EventEmitter:g}=(lr(),Me(tr)),b=Rn().Stream,{Buffer:m}=(et(),Me(Ze)),y=ar(),{addAbortSignal:I}=jr(),{getHighWaterMark:U,getDefaultHighWaterMark:k}=Pn(),{ERR_INVALID_ARG_TYPE:T,ERR_METHOD_NOT_IMPLEMENTED:D,ERR_MULTIPLE_CALLBACK:F,ERR_STREAM_CANNOT_PIPE:R,ERR_STREAM_DESTROYED:O,ERR_STREAM_ALREADY_FINISHED:M,ERR_STREAM_NULL_VALUES:W,ERR_STREAM_WRITE_AFTER_END:G,ERR_UNKNOWN_ENCODING:ee}=ot().codes,{errorOrDestroy:E}=y;i(ne.prototype,b.prototype),i(ne,b);function q(){}var Z=c("kOnFinished");function K(C,j,N){typeof N!="boolean"&&(N=j instanceof Ot()),this.objectMode=!!(C&&C.objectMode),N&&(this.objectMode=this.objectMode||!!(C&&C.writableObjectMode)),this.highWaterMark=C?U(this,C,"writableHighWaterMark",N):k(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let te=!!(C&&C.decodeStrings===!1);this.decodeStrings=!te,this.defaultEncoding=C&&C.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=S.bind(void 0,j),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,ge(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!C||C.emitClose!==!1,this.autoDestroy=!C||C.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Z]=[]}function ge(C){C.buffered=[],C.bufferedIndex=0,C.allBuffers=!0,C.allNoop=!0}K.prototype.getBuffer=function(){return l(this.buffered,this.bufferedIndex)},r(K.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ne(C){let j=this instanceof Ot();if(!j&&!s(ne,this))return new ne(C);this._writableState=new K(C,this,j),C&&(typeof C.write=="function"&&(this._write=C.write),typeof C.writev=="function"&&(this._writev=C.writev),typeof C.destroy=="function"&&(this._destroy=C.destroy),typeof C.final=="function"&&(this._final=C.final),typeof C.construct=="function"&&(this._construct=C.construct),C.signal&&I(C.signal,this)),b.call(this,C),y.construct(this,()=>{let N=this._writableState;N.writing||ue(this,N),le(this,N)})}r(ne,p,{__proto__:null,value:function(C){return s(this,C)?!0:this!==ne?!1:C&&C._writableState instanceof K}}),ne.prototype.pipe=function(){E(this,new R)};function $(C,j,N,te){let Q=C._writableState;if(typeof N=="function")te=N,N=Q.defaultEncoding;else{if(!N)N=Q.defaultEncoding;else if(N!=="buffer"&&!m.isEncoding(N))throw new ee(N);typeof te!="function"&&(te=q)}if(j===null)throw new W;if(!Q.objectMode)if(typeof j=="string")Q.decodeStrings!==!1&&(j=m.from(j,N),N="buffer");else if(j instanceof m)N="buffer";else if(b._isUint8Array(j))j=b._uint8ArrayToBuffer(j),N="buffer";else throw new T("chunk",["string","Buffer","Uint8Array"],j);let L;return Q.ending?L=new G:Q.destroyed&&(L=new O("write")),L?(t.nextTick(te,L),E(C,L,!0),L):(Q.pendingcb++,be(C,Q,j,N,te))}ne.prototype.write=function(C,j,N){return $(this,C,j,N)===!0},ne.prototype.cork=function(){this._writableState.corked++},ne.prototype.uncork=function(){let C=this._writableState;C.corked&&(C.corked--,C.writing||ue(this,C))},ne.prototype.setDefaultEncoding=function(C){if(typeof C=="string"&&(C=a(C)),!m.isEncoding(C))throw new ee(C);return this._writableState.defaultEncoding=C,this};function be(C,j,N,te,Q){let L=j.objectMode?1:N.length;j.length+=L;let H=j.lengthN.bufferedIndex&&ue(C,N),te?N.afterWriteTickInfo!==null&&N.afterWriteTickInfo.cb===Q?N.afterWriteTickInfo.count++:(N.afterWriteTickInfo={count:1,cb:Q,stream:C,state:N},t.nextTick(Y,N.afterWriteTickInfo)):ce(C,N,1,Q))}function Y({stream:C,state:j,count:N,cb:te}){return j.afterWriteTickInfo=null,ce(C,j,N,te)}function ce(C,j,N,te){for(!j.ending&&!C.destroyed&&j.length===0&&j.needDrain&&(j.needDrain=!1,C.emit("drain"));N-- >0;)j.pendingcb--,te();j.destroyed&&Ee(j),le(C,j)}function Ee(C){if(C.writing)return;for(let Q=C.bufferedIndex;Q1&&C._writev){j.pendingcb-=L-1;let we=j.allNoop?q:Ae=>{for(let Re=H;Re256?(N.splice(0,H),j.bufferedIndex=0):j.bufferedIndex=H}j.bufferProcessing=!1}ne.prototype._write=function(C,j,N){if(this._writev)this._writev([{chunk:C,encoding:j}],N);else throw new D("_write()")},ne.prototype._writev=null,ne.prototype.end=function(C,j,N){let te=this._writableState;typeof C=="function"?(N=C,C=null,j=null):typeof j=="function"&&(N=j,j=null);let Q;if(C!=null){let L=$(this,C,j);L instanceof h&&(Q=L)}return te.corked&&(te.corked=1,this.uncork()),Q||(!te.errored&&!te.ending?(te.ending=!0,le(this,te,!0),te.ended=!0):te.finished?Q=new M("end"):te.destroyed&&(Q=new O("end"))),typeof N=="function"&&(Q||te.finished?t.nextTick(N,Q):te[Z].push(N)),this};function x(C){return C.ending&&!C.destroyed&&C.constructed&&C.length===0&&!C.errored&&C.buffered.length===0&&!C.finished&&!C.writing&&!C.errorEmitted&&!C.closeEmitted}function _(C,j){let N=!1;function te(Q){if(N){E(C,Q??F());return}if(N=!0,j.pendingcb--,Q){let L=j[Z].splice(0);for(let H=0;H{x(Q)?X(te,Q):Q.pendingcb--},C,j)):x(j)&&(j.pendingcb++,X(C,j))))}function X(C,j){j.pendingcb--,j.finished=!0;let N=j[Z].splice(0);for(let te=0;te{ae(),se(),oe();var t=er(),l=(et(),Me(Ze)),{isReadable:h,isWritable:s,isIterable:r,isNodeStream:o,isReadableNodeStream:i,isWritableNodeStream:a,isDuplexNodeStream:c}=Rt(),p=jt(),{AbortError:g,codes:{ERR_INVALID_ARG_TYPE:b,ERR_INVALID_RETURN_VALUE:m}}=ot(),{destroyer:y}=ar(),I=Ot(),U=Fr(),{createDeferredPromise:k}=kt(),T=as(),D=globalThis.Blob||l.Blob,F=typeof D<"u"?function(ee){return ee instanceof D}:function(ee){return!1},R=globalThis.AbortController||Cn().AbortController,{FunctionPrototypeCall:O}=Ke(),M=class extends I{constructor(ee){super(ee),(ee==null?void 0:ee.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(ee==null?void 0:ee.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};n.exports=function ee(E,q){if(c(E))return E;if(i(E))return G({readable:E});if(a(E))return G({writable:E});if(o(E))return G({writable:!1,readable:!1});if(typeof E=="function"){let{value:K,write:ge,final:ne,destroy:$}=W(E);if(r(K))return T(M,K,{objectMode:!0,write:ge,final:ne,destroy:$});let be=K==null?void 0:K.then;if(typeof be=="function"){let re,ve=O(be,K,S=>{if(S!=null)throw new m("nully","body",S)},S=>{y(re,S)});return re=new M({objectMode:!0,readable:!1,write:ge,final(S){ne(async()=>{try{await ve,t.nextTick(S,null)}catch(Y){t.nextTick(S,Y)}})},destroy:$})}throw new m("Iterable, AsyncIterable or AsyncFunction",q,K)}if(F(E))return ee(E.arrayBuffer());if(r(E))return T(M,E,{objectMode:!0,writable:!1});if(typeof(E==null?void 0:E.writable)=="object"||typeof(E==null?void 0:E.readable)=="object"){let K=E!=null&&E.readable?i(E==null?void 0:E.readable)?E==null?void 0:E.readable:ee(E.readable):void 0,ge=E!=null&&E.writable?a(E==null?void 0:E.writable)?E==null?void 0:E.writable:ee(E.writable):void 0;return G({readable:K,writable:ge})}let Z=E==null?void 0:E.then;if(typeof Z=="function"){let K;return O(Z,E,ge=>{ge!=null&&K.push(ge),K.push(null)},ge=>{y(K,ge)}),K=new M({objectMode:!0,writable:!1,read(){}})}throw new b(q,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],E)};function W(ee){let{promise:E,resolve:q}=k(),Z=new R,K=Z.signal;return{value:ee(async function*(){for(;;){let ge=E;E=null;let{chunk:ne,done:$,cb:be}=await ge;if(t.nextTick(be),$)return;if(K.aborted)throw new g(void 0,{cause:K.reason});({promise:E,resolve:q}=k()),yield ne}}(),{signal:K}),write(ge,ne,$){let be=q;q=null,be({chunk:ge,done:!1,cb:$})},final(ge){let ne=q;q=null,ne({done:!0,cb:ge})},destroy(ge,ne){Z.abort(),ne(ge)}}}function G(ee){let E=ee.readable&&typeof ee.readable.read!="function"?U.wrap(ee.readable):ee.readable,q=ee.writable,Z=!!h(E),K=!!s(q),ge,ne,$,be,re;function ve(S){let Y=be;be=null,Y?Y(S):S&&re.destroy(S)}return re=new M({readableObjectMode:!!(E!=null&&E.readableObjectMode),writableObjectMode:!!(q!=null&&q.writableObjectMode),readable:Z,writable:K}),K&&(p(q,S=>{K=!1,S&&y(E,S),ve(S)}),re._write=function(S,Y,ce){q.write(S,Y)?ce():ge=ce},re._final=function(S){q.end(),ne=S},q.on("drain",function(){if(ge){let S=ge;ge=null,S()}}),q.on("finish",function(){if(ne){let S=ne;ne=null,S()}})),Z&&(p(E,S=>{Z=!1,S&&y(E,S),ve(S)}),E.on("readable",function(){if($){let S=$;$=null,S()}}),E.on("end",function(){re.push(null)}),re._read=function(){for(;;){let S=E.read();if(S===null){$=re._read;return}if(!re.push(S))return}}),re._destroy=function(S,Y){!S&&be!==null&&(S=new g),$=null,ge=null,ne=null,be===null?Y(S):(be=Y,y(q,S),y(E,S))},re}}),Ot=me((e,n)=>{ae(),se(),oe();var{ObjectDefineProperties:t,ObjectGetOwnPropertyDescriptor:l,ObjectKeys:h,ObjectSetPrototypeOf:s}=Ke();n.exports=i;var r=Fr(),o=ls();s(i.prototype,r.prototype),s(i,r);{let g=h(o.prototype);for(let b=0;b{ae(),se(),oe();var{ObjectSetPrototypeOf:t,Symbol:l}=Ke();n.exports=i;var{ERR_METHOD_NOT_IMPLEMENTED:h}=ot().codes,s=Ot(),{getHighWaterMark:r}=Pn();t(i.prototype,s.prototype),t(i,s);var o=l("kCallback");function i(p){if(!(this instanceof i))return new i(p);let g=p?r(this,p,"readableHighWaterMark",!0):null;g===0&&(p={...p,highWaterMark:null,readableHighWaterMark:g,writableHighWaterMark:p.writableHighWaterMark||0}),s.call(this,p),this._readableState.sync=!1,this[o]=null,p&&(typeof p.transform=="function"&&(this._transform=p.transform),typeof p.flush=="function"&&(this._flush=p.flush)),this.on("prefinish",c)}function a(p){typeof this._flush=="function"&&!this.destroyed?this._flush((g,b)=>{if(g){p?p(g):this.destroy(g);return}b!=null&&this.push(b),this.push(null),p&&p()}):(this.push(null),p&&p())}function c(){this._final!==a&&a.call(this)}i.prototype._final=a,i.prototype._transform=function(p,g,b){throw new h("_transform()")},i.prototype._write=function(p,g,b){let m=this._readableState,y=this._writableState,I=m.length;this._transform(p,g,(U,k)=>{if(U){b(U);return}k!=null&&this.push(k),y.ended||I===m.length||m.length{ae(),se(),oe();var{ObjectSetPrototypeOf:t}=Ke();n.exports=h;var l=us();t(h.prototype,l.prototype),t(h,l);function h(s){if(!(this instanceof h))return new h(s);l.call(this,s)}h.prototype._transform=function(s,r,o){o(null,s)}}),Mn=me((e,n)=>{ae(),se(),oe();var t=er(),{ArrayIsArray:l,Promise:h,SymbolAsyncIterator:s}=Ke(),r=jt(),{once:o}=kt(),i=ar(),a=Ot(),{aggregateTwoErrors:c,codes:{ERR_INVALID_ARG_TYPE:p,ERR_INVALID_RETURN_VALUE:g,ERR_MISSING_ARGS:b,ERR_STREAM_DESTROYED:m,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:I}=ot(),{validateFunction:U,validateAbortSignal:k}=Nr(),{isIterable:T,isReadable:D,isReadableNodeStream:F,isNodeStream:R,isTransformStream:O,isWebStream:M,isReadableStream:W,isReadableEnded:G}=Rt(),ee=globalThis.AbortController||Cn().AbortController,E,q;function Z(Y,ce,Ee){let ue=!1;Y.on("close",()=>{ue=!0});let x=r(Y,{readable:ce,writable:Ee},_=>{ue=!_});return{destroy:_=>{ue||(ue=!0,i.destroyer(Y,_||new m("pipe")))},cleanup:x}}function K(Y){return U(Y[Y.length-1],"streams[stream.length - 1]"),Y.pop()}function ge(Y){if(T(Y))return Y;if(F(Y))return ne(Y);throw new p("val",["Readable","Iterable","AsyncIterable"],Y)}async function*ne(Y){q||(q=Fr()),yield*q.prototype[s].call(Y)}async function $(Y,ce,Ee,{end:ue}){let x,_=null,z=J=>{if(J&&(x=J),_){let he=_;_=null,he()}},le=()=>new h((J,he)=>{x?he(x):_=()=>{x?he(x):J()}});ce.on("drain",z);let X=r(ce,{readable:!1},z);try{ce.writableNeedDrain&&await le();for await(let J of Y)ce.write(J)||await le();ue&&ce.end(),await le(),Ee()}catch(J){Ee(x!==J?c(x,J):J)}finally{X(),ce.off("drain",z)}}async function be(Y,ce,Ee,{end:ue}){O(ce)&&(ce=ce.writable);let x=ce.getWriter();try{for await(let _ of Y)await x.ready,x.write(_).catch(()=>{});await x.ready,ue&&await x.close(),Ee()}catch(_){try{await x.abort(_),Ee(_)}catch(z){Ee(z)}}}function re(...Y){return ve(Y,o(K(Y)))}function ve(Y,ce,Ee){if(Y.length===1&&l(Y[0])&&(Y=Y[0]),Y.length<2)throw new b("streams");let ue=new ee,x=ue.signal,_=Ee==null?void 0:Ee.signal,z=[];k(_,"options.signal");function le(){j(new I)}_==null||_.addEventListener("abort",le);let X,J,he=[],de=0;function C(L){j(L,--de===0)}function j(L,H){if(L&&(!X||X.code==="ERR_STREAM_PREMATURE_CLOSE")&&(X=L),!(!X&&!H)){for(;he.length;)he.shift()(X);_==null||_.removeEventListener("abort",le),ue.abort(),H&&(X||z.forEach(we=>we()),t.nextTick(ce,X,J))}}let N;for(let L=0;L0,Ae=we||(Ee==null?void 0:Ee.end)!==!1,Re=L===Y.length-1;if(R(H)){let f=function(u){u&&u.name!=="AbortError"&&u.code!=="ERR_STREAM_PREMATURE_CLOSE"&&C(u)};if(Ae){let{destroy:u,cleanup:d}=Z(H,we,_e);he.push(u),D(H)&&Re&&z.push(d)}H.on("error",f),D(H)&&Re&&z.push(()=>{H.removeListener("error",f)})}if(L===0)if(typeof H=="function"){if(N=H({signal:x}),!T(N))throw new g("Iterable, AsyncIterable or Stream","source",N)}else T(H)||F(H)||O(H)?N=H:N=a.from(H);else if(typeof H=="function"){if(O(N)){var te;N=ge((te=N)===null||te===void 0?void 0:te.readable)}else N=ge(N);if(N=H(N,{signal:x}),we){if(!T(N,!0))throw new g("AsyncIterable",`transform[${L-1}]`,N)}else{var Q;E||(E=hs());let f=new E({objectMode:!0}),u=(Q=N)===null||Q===void 0?void 0:Q.then;if(typeof u=="function")de++,u.call(N,A=>{J=A,A!=null&&f.write(A),Ae&&f.end(),t.nextTick(C)},A=>{f.destroy(A),t.nextTick(C,A)});else if(T(N,!0))de++,$(N,f,C,{end:Ae});else if(W(N)||O(N)){let A=N.readable||N;de++,$(A,f,C,{end:Ae})}else throw new g("AsyncIterable or Promise","destination",N);N=f;let{destroy:d,cleanup:v}=Z(N,!1,!0);he.push(d),Re&&z.push(v)}}else if(R(H)){if(F(N)){de+=2;let f=S(N,H,C,{end:Ae});D(H)&&Re&&z.push(f)}else if(O(N)||W(N)){let f=N.readable||N;de++,$(f,H,C,{end:Ae})}else if(T(N))de++,$(N,H,C,{end:Ae});else throw new p("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],N);N=H}else if(M(H)){if(F(N))de++,be(ge(N),H,C,{end:Ae});else if(W(N)||T(N))de++,be(N,H,C,{end:Ae});else if(O(N))de++,be(N.readable,H,C,{end:Ae});else throw new p("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],N);N=H}else N=a.from(H)}return(x!=null&&x.aborted||_!=null&&_.aborted)&&t.nextTick(le),N}function S(Y,ce,Ee,{end:ue}){let x=!1;if(ce.on("close",()=>{x||Ee(new y)}),Y.pipe(ce,{end:!1}),ue){let _=function(){x=!0,ce.end()};G(Y)?t.nextTick(_):Y.once("end",_)}else Ee();return r(Y,{readable:!0,writable:!1},_=>{let z=Y._readableState;_&&_.code==="ERR_STREAM_PREMATURE_CLOSE"&&z&&z.ended&&!z.errored&&!z.errorEmitted?Y.once("end",Ee).once("error",Ee):Ee(_)}),r(ce,{readable:!1,writable:!0},Ee)}n.exports={pipelineImpl:ve,pipeline:re}}),cs=me((e,n)=>{ae(),se(),oe();var{pipeline:t}=Mn(),l=Ot(),{destroyer:h}=ar(),{isNodeStream:s,isReadable:r,isWritable:o,isWebStream:i,isTransformStream:a,isWritableStream:c,isReadableStream:p}=Rt(),{AbortError:g,codes:{ERR_INVALID_ARG_VALUE:b,ERR_MISSING_ARGS:m}}=ot(),y=jt();n.exports=function(...I){if(I.length===0)throw new m("streams");if(I.length===1)return l.from(I[0]);let U=[...I];if(typeof I[0]=="function"&&(I[0]=l.from(I[0])),typeof I[I.length-1]=="function"){let E=I.length-1;I[E]=l.from(I[E])}for(let E=0;E0&&!(o(I[E])||c(I[E])||a(I[E])))throw new b(`streams[${E}]`,U[E],"must be writable")}let k,T,D,F,R;function O(E){let q=F;F=null,q?q(E):E?R.destroy(E):!ee&&!G&&R.destroy()}let M=I[0],W=t(I,O),G=!!(o(M)||c(M)||a(M)),ee=!!(r(W)||p(W)||a(W));if(R=new l({writableObjectMode:!!(M!=null&&M.writableObjectMode),readableObjectMode:!!(W!=null&&W.writableObjectMode),writable:G,readable:ee}),G){if(s(M))R._write=function(q,Z,K){M.write(q,Z)?K():k=K},R._final=function(q){M.end(),T=q},M.on("drain",function(){if(k){let q=k;k=null,q()}});else if(i(M)){let q=(a(M)?M.writable:M).getWriter();R._write=async function(Z,K,ge){try{await q.ready,q.write(Z).catch(()=>{}),ge()}catch(ne){ge(ne)}},R._final=async function(Z){try{await q.ready,q.close().catch(()=>{}),T=Z}catch(K){Z(K)}}}let E=a(W)?W.readable:W;y(E,()=>{if(T){let q=T;T=null,q()}})}if(ee){if(s(W))W.on("readable",function(){if(D){let E=D;D=null,E()}}),W.on("end",function(){R.push(null)}),R._read=function(){for(;;){let E=W.read();if(E===null){D=R._read;return}if(!R.push(E))return}};else if(i(W)){let E=(a(W)?W.readable:W).getReader();R._read=async function(){for(;;)try{let{value:q,done:Z}=await E.read();if(!R.push(q))return;if(Z){R.push(null);return}}catch{return}}}}return R._destroy=function(E,q){!E&&F!==null&&(E=new g),D=null,k=null,T=null,F===null?q(E):(F=q,s(W)&&h(W,E))},R}}),tl=me((e,n)=>{ae(),se(),oe();var t=globalThis.AbortController||Cn().AbortController,{codes:{ERR_INVALID_ARG_VALUE:l,ERR_INVALID_ARG_TYPE:h,ERR_MISSING_ARGS:s,ERR_OUT_OF_RANGE:r},AbortError:o}=ot(),{validateAbortSignal:i,validateInteger:a,validateObject:c}=Nr(),p=Ke().Symbol("kWeak"),{finished:g}=jt(),b=cs(),{addAbortSignalNoValidate:m}=jr(),{isWritable:y,isNodeStream:I}=Rt(),{ArrayPrototypePush:U,MathFloor:k,Number:T,NumberIsNaN:D,Promise:F,PromiseReject:R,PromisePrototypeThen:O,Symbol:M}=Ke(),W=M("kEmpty"),G=M("kEof");function ee(ue,x){if(x!=null&&c(x,"options"),(x==null?void 0:x.signal)!=null&&i(x.signal,"options.signal"),I(ue)&&!y(ue))throw new l("stream",ue,"must be writable");let _=b(this,ue);return x!=null&&x.signal&&m(x.signal,_),_}function E(ue,x){if(typeof ue!="function")throw new h("fn",["Function","AsyncFunction"],ue);x!=null&&c(x,"options"),(x==null?void 0:x.signal)!=null&&i(x.signal,"options.signal");let _=1;return(x==null?void 0:x.concurrency)!=null&&(_=k(x.concurrency)),a(_,"concurrency",1),(async function*(){var z,le;let X=new t,J=this,he=[],de=X.signal,C={signal:de},j=()=>X.abort();x!=null&&(z=x.signal)!==null&&z!==void 0&&z.aborted&&j(),x==null||(le=x.signal)===null||le===void 0||le.addEventListener("abort",j);let N,te,Q=!1;function L(){Q=!0}async function H(){try{for await(let Ae of J){var we;if(Q)return;if(de.aborted)throw new o;try{Ae=ue(Ae,C)}catch(Re){Ae=R(Re)}Ae!==W&&(typeof((we=Ae)===null||we===void 0?void 0:we.catch)=="function"&&Ae.catch(L),he.push(Ae),N&&(N(),N=null),!Q&&he.length&&he.length>=_&&await new F(Re=>{te=Re}))}he.push(G)}catch(Ae){let Re=R(Ae);O(Re,void 0,L),he.push(Re)}finally{var _e;Q=!0,N&&(N(),N=null),x==null||(_e=x.signal)===null||_e===void 0||_e.removeEventListener("abort",j)}}H();try{for(;;){for(;he.length>0;){let we=await he[0];if(we===G)return;if(de.aborted)throw new o;we!==W&&(yield we),he.shift(),te&&(te(),te=null)}await new F(we=>{N=we})}}finally{X.abort(),Q=!0,te&&(te(),te=null)}}).call(this)}function q(ue=void 0){return ue!=null&&c(ue,"options"),(ue==null?void 0:ue.signal)!=null&&i(ue.signal,"options.signal"),(async function*(){let x=0;for await(let z of this){var _;if(ue!=null&&(_=ue.signal)!==null&&_!==void 0&&_.aborted)throw new o({cause:ue.signal.reason});yield[x++,z]}}).call(this)}async function Z(ue,x=void 0){for await(let _ of $.call(this,ue,x))return!0;return!1}async function K(ue,x=void 0){if(typeof ue!="function")throw new h("fn",["Function","AsyncFunction"],ue);return!await Z.call(this,async(..._)=>!await ue(..._),x)}async function ge(ue,x){for await(let _ of $.call(this,ue,x))return _}async function ne(ue,x){if(typeof ue!="function")throw new h("fn",["Function","AsyncFunction"],ue);async function _(z,le){return await ue(z,le),W}for await(let z of E.call(this,_,x));}function $(ue,x){if(typeof ue!="function")throw new h("fn",["Function","AsyncFunction"],ue);async function _(z,le){return await ue(z,le)?z:W}return E.call(this,_,x)}var be=class extends s{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function re(ue,x,_){var z;if(typeof ue!="function")throw new h("reducer",["Function","AsyncFunction"],ue);_!=null&&c(_,"options"),(_==null?void 0:_.signal)!=null&&i(_.signal,"options.signal");let le=arguments.length>1;if(_!=null&&(z=_.signal)!==null&&z!==void 0&&z.aborted){let C=new o(void 0,{cause:_.signal.reason});throw this.once("error",()=>{}),await g(this.destroy(C)),C}let X=new t,J=X.signal;if(_!=null&&_.signal){let C={once:!0,[p]:this};_.signal.addEventListener("abort",()=>X.abort(),C)}let he=!1;try{for await(let C of this){var de;if(he=!0,_!=null&&(de=_.signal)!==null&&de!==void 0&&de.aborted)throw new o;le?x=await ue(x,C,{signal:J}):(x=C,le=!0)}if(!he&&!le)throw new be}finally{X.abort()}return x}async function ve(ue){ue!=null&&c(ue,"options"),(ue==null?void 0:ue.signal)!=null&&i(ue.signal,"options.signal");let x=[];for await(let z of this){var _;if(ue!=null&&(_=ue.signal)!==null&&_!==void 0&&_.aborted)throw new o(void 0,{cause:ue.signal.reason});U(x,z)}return x}function S(ue,x){let _=E.call(this,ue,x);return(async function*(){for await(let z of _)yield*z}).call(this)}function Y(ue){if(ue=T(ue),D(ue))return 0;if(ue<0)throw new r("number",">= 0",ue);return ue}function ce(ue,x=void 0){return x!=null&&c(x,"options"),(x==null?void 0:x.signal)!=null&&i(x.signal,"options.signal"),ue=Y(ue),(async function*(){var _;if(x!=null&&(_=x.signal)!==null&&_!==void 0&&_.aborted)throw new o;for await(let le of this){var z;if(x!=null&&(z=x.signal)!==null&&z!==void 0&&z.aborted)throw new o;ue--<=0&&(yield le)}}).call(this)}function Ee(ue,x=void 0){return x!=null&&c(x,"options"),(x==null?void 0:x.signal)!=null&&i(x.signal,"options.signal"),ue=Y(ue),(async function*(){var _;if(x!=null&&(_=x.signal)!==null&&_!==void 0&&_.aborted)throw new o;for await(let le of this){var z;if(x!=null&&(z=x.signal)!==null&&z!==void 0&&z.aborted)throw new o;if(ue-- >0)yield le;else return}}).call(this)}n.exports.streamReturningOperators={asIndexedPairs:q,drop:ce,filter:$,flatMap:S,map:E,take:Ee,compose:ee},n.exports.promiseReturningOperators={every:K,forEach:ne,reduce:re,toArray:ve,some:Z,find:ge}}),fs=me((e,n)=>{ae(),se(),oe();var{ArrayPrototypePop:t,Promise:l}=Ke(),{isIterable:h,isNodeStream:s,isWebStream:r}=Rt(),{pipelineImpl:o}=Mn(),{finished:i}=jt();ds();function a(...c){return new l((p,g)=>{let b,m,y=c[c.length-1];if(y&&typeof y=="object"&&!s(y)&&!h(y)&&!r(y)){let I=t(c);b=I.signal,m=I.end}o(c,(I,U)=>{I?g(I):p(U)},{signal:b,end:m})})}n.exports={finished:i,pipeline:a}}),ds=me((e,n)=>{ae(),se(),oe();var{Buffer:t}=(et(),Me(Ze)),{ObjectDefineProperty:l,ObjectKeys:h,ReflectApply:s}=Ke(),{promisify:{custom:r}}=kt(),{streamReturningOperators:o,promiseReturningOperators:i}=tl(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:a}}=ot(),c=cs(),{pipeline:p}=Mn(),{destroyer:g}=ar(),b=jt(),m=fs(),y=Rt(),I=n.exports=Rn().Stream;I.isDisturbed=y.isDisturbed,I.isErrored=y.isErrored,I.isReadable=y.isReadable,I.Readable=Fr();for(let k of h(o)){let T=function(...F){if(new.target)throw a();return I.Readable.from(s(D,this,F))},D=o[k];l(T,"name",{__proto__:null,value:D.name}),l(T,"length",{__proto__:null,value:D.length}),l(I.Readable.prototype,k,{__proto__:null,value:T,enumerable:!1,configurable:!0,writable:!0})}for(let k of h(i)){let T=function(...F){if(new.target)throw a();return s(D,this,F)},D=i[k];l(T,"name",{__proto__:null,value:D.name}),l(T,"length",{__proto__:null,value:D.length}),l(I.Readable.prototype,k,{__proto__:null,value:T,enumerable:!1,configurable:!0,writable:!0})}I.Writable=ls(),I.Duplex=Ot(),I.Transform=us(),I.PassThrough=hs(),I.pipeline=p;var{addAbortSignal:U}=jr();I.addAbortSignal=U,I.finished=b,I.destroy=g,I.compose=c,l(I,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return m}}),l(p,r,{__proto__:null,enumerable:!0,get(){return m.pipeline}}),l(b,r,{__proto__:null,enumerable:!0,get(){return m.finished}}),I.Stream=I,I._isUint8Array=function(k){return k instanceof Uint8Array},I._uint8ArrayToBuffer=function(k){return t.from(k.buffer,k.byteOffset,k.byteLength)}}),rr=me((e,n)=>{ae(),se(),oe();var t=ds(),l=fs(),h=t.Readable.destroy;n.exports=t.Readable,n.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,n.exports._isUint8Array=t._isUint8Array,n.exports.isDisturbed=t.isDisturbed,n.exports.isErrored=t.isErrored,n.exports.isReadable=t.isReadable,n.exports.Readable=t.Readable,n.exports.Writable=t.Writable,n.exports.Duplex=t.Duplex,n.exports.Transform=t.Transform,n.exports.PassThrough=t.PassThrough,n.exports.addAbortSignal=t.addAbortSignal,n.exports.finished=t.finished,n.exports.destroy=t.destroy,n.exports.destroy=h,n.exports.pipeline=t.pipeline,n.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get(){return l}}),n.exports.Stream=t.Stream,n.exports.default=n.exports}),rl=me((e,n)=>{ae(),se(),oe(),typeof Object.create=="function"?n.exports=function(t,l){l&&(t.super_=l,t.prototype=Object.create(l.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:n.exports=function(t,l){if(l){t.super_=l;var h=function(){};h.prototype=l.prototype,t.prototype=new h,t.prototype.constructor=t}}}),il=me((e,n)=>{ae(),se(),oe();var{Buffer:t}=(et(),Me(Ze)),l=Symbol.for("BufferList");function h(s){if(!(this instanceof h))return new h(s);h._init.call(this,s)}h._init=function(s){Object.defineProperty(this,l,{value:!0}),this._bufs=[],this.length=0,s&&this.append(s)},h.prototype._new=function(s){return new h(s)},h.prototype._offset=function(s){if(s===0)return[0,0];let r=0;for(let o=0;othis.length||s<0)return;let r=this._offset(s);return this._bufs[r[0]][r[1]]},h.prototype.slice=function(s,r){return typeof s=="number"&&s<0&&(s+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,s,r)},h.prototype.copy=function(s,r,o,i){if((typeof o!="number"||o<0)&&(o=0),(typeof i!="number"||i>this.length)&&(i=this.length),o>=this.length||i<=0)return s||t.alloc(0);let a=!!s,c=this._offset(o),p=i-o,g=p,b=a&&r||0,m=c[1];if(o===0&&i===this.length){if(!a)return this._bufs.length===1?this._bufs[0]:t.concat(this._bufs,this.length);for(let y=0;yI)this._bufs[y].copy(s,b,m),b+=I;else{this._bufs[y].copy(s,b,m,m+g),b+=I;break}g-=I,m&&(m=0)}return s.length>b?s.slice(0,b):s},h.prototype.shallowSlice=function(s,r){if(s=s||0,r=typeof r!="number"?this.length:r,s<0&&(s+=this.length),r<0&&(r+=this.length),s===r)return this._new();let o=this._offset(s),i=this._offset(r),a=this._bufs.slice(o[0],i[0]+1);return i[1]===0?a.pop():a[a.length-1]=a[a.length-1].slice(0,i[1]),o[1]!==0&&(a[0]=a[0].slice(o[1])),this._new(a)},h.prototype.toString=function(s,r,o){return this.slice(r,o).toString(s)},h.prototype.consume=function(s){if(s=Math.trunc(s),Number.isNaN(s)||s<=0)return this;for(;this._bufs.length;)if(s>=this._bufs[0].length)s-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(s),this.length-=s;break}return this},h.prototype.duplicate=function(){let s=this._new();for(let r=0;rthis.length?this.length:r;let i=this._offset(r),a=i[0],c=i[1];for(;a=s.length){let g=p.indexOf(s,c);if(g!==-1)return this._reverseOffset([a,g]);c=p.length-s.length+1}else{let g=this._reverseOffset([a,c]);if(this._match(g,s))return g;c++}c=0}return-1},h.prototype._match=function(s,r){if(this.length-s{ae(),se(),oe();var t=rr().Duplex,l=rl(),h=il();function s(r){if(!(this instanceof s))return new s(r);if(typeof r=="function"){this._callback=r;let o=(function(i){this._callback&&(this._callback(i),this._callback=null)}).bind(this);this.on("pipe",function(i){i.on("error",o)}),this.on("unpipe",function(i){i.removeListener("error",o)}),r=null}h._init.call(this,r),t.call(this)}l(s,t),Object.assign(s.prototype,h.prototype),s.prototype._new=function(r){return new s(r)},s.prototype._write=function(r,o,i){this._appendBuffer(r),typeof i=="function"&&i()},s.prototype._read=function(r){if(!this.length)return this.push(null);r=Math.min(r,this.length),this.push(this.slice(0,r)),this.consume(r)},s.prototype.end=function(r){t.prototype.end.call(this,r),this._callback&&(this._callback(null,this.slice()),this._callback=null)},s.prototype._destroy=function(r,o){this._bufs.length=0,this.length=0,o(r)},s.prototype._isBufferList=function(r){return r instanceof s||r instanceof h||s.isBufferList(r)},s.isBufferList=h.isBufferList,n.exports=s,n.exports.BufferListStream=s,n.exports.BufferList=h}),ol=me((e,n)=>{ae(),se(),oe();var t=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};n.exports=t}),ps=me((e,n)=>{ae(),se(),oe();var t=n.exports,{Buffer:l}=(et(),Me(Ze));t.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},t.requiredHeaderFlags={1:0,2:0,4:0,5:0,6:2,7:0,8:2,9:0,10:2,11:0,12:0,13:0,14:0,15:0},t.requiredHeaderFlagsErrors={};for(let s in t.requiredHeaderFlags){let r=t.requiredHeaderFlags[s];t.requiredHeaderFlagsErrors[s]="Invalid header flag bits, must be 0x"+r.toString(16)+" for "+t.types[s]+" packet"}t.codes={};for(let s in t.types){let r=t.types[s];t.codes[r]=s}t.CMD_SHIFT=4,t.CMD_MASK=240,t.DUP_MASK=8,t.QOS_MASK=3,t.QOS_SHIFT=1,t.RETAIN_MASK=1,t.VARBYTEINT_MASK=127,t.VARBYTEINT_FIN_MASK=128,t.VARBYTEINT_MAX=268435455,t.SESSIONPRESENT_MASK=1,t.SESSIONPRESENT_HEADER=l.from([t.SESSIONPRESENT_MASK]),t.CONNACK_HEADER=l.from([t.codes.connack<[0,1].map(o=>[0,1].map(i=>{let a=l.alloc(1);return a.writeUInt8(t.codes[s]<l.from([s])),t.EMPTY={pingreq:l.from([t.codes.pingreq<<4,0]),pingresp:l.from([t.codes.pingresp<<4,0]),disconnect:l.from([t.codes.disconnect<<4,0])},t.MQTT5_PUBACK_PUBREC_CODES={0:"Success",16:"No matching subscribers",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",144:"Topic Name invalid",145:"Packet identifier in use",151:"Quota exceeded",153:"Payload format invalid"},t.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"},t.MQTT5_SUBACK_CODES={0:"Granted QoS 0",1:"Granted QoS 1",2:"Granted QoS 2",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use",151:"Quota exceeded",158:"Shared Subscriptions not supported",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},t.MQTT5_UNSUBACK_CODES={0:"Success",17:"No subscription existed",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use"},t.MQTT5_DISCONNECT_CODES={0:"Normal disconnection",4:"Disconnect with Will Message",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",135:"Not authorized",137:"Server busy",139:"Server shutting down",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"},t.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}}),sl=me((e,n)=>{ae(),se(),oe();var t=1e3,l=t*60,h=l*60,s=h*24,r=s*7,o=s*365.25;n.exports=function(g,b){b=b||{};var m=typeof g;if(m==="string"&&g.length>0)return i(g);if(m==="number"&&isFinite(g))return b.long?c(g):a(g);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(g))};function i(g){if(g=String(g),!(g.length>100)){var b=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(g);if(b){var m=parseFloat(b[1]),y=(b[2]||"ms").toLowerCase();switch(y){case"years":case"year":case"yrs":case"yr":case"y":return m*o;case"weeks":case"week":case"w":return m*r;case"days":case"day":case"d":return m*s;case"hours":case"hour":case"hrs":case"hr":case"h":return m*h;case"minutes":case"minute":case"mins":case"min":case"m":return m*l;case"seconds":case"second":case"secs":case"sec":case"s":return m*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function a(g){var b=Math.abs(g);return b>=s?Math.round(g/s)+"d":b>=h?Math.round(g/h)+"h":b>=l?Math.round(g/l)+"m":b>=t?Math.round(g/t)+"s":g+"ms"}function c(g){var b=Math.abs(g);return b>=s?p(g,b,s,"day"):b>=h?p(g,b,h,"hour"):b>=l?p(g,b,l,"minute"):b>=t?p(g,b,t,"second"):g+" ms"}function p(g,b,m,y){var I=b>=m*1.5;return Math.round(g/m)+" "+y+(I?"s":"")}}),al=me((e,n)=>{ae(),se(),oe();function t(l){s.debug=s,s.default=s,s.coerce=p,s.disable=i,s.enable=o,s.enabled=a,s.humanize=sl(),s.destroy=g,Object.keys(l).forEach(b=>{s[b]=l[b]}),s.names=[],s.skips=[],s.formatters={};function h(b){let m=0;for(let y=0;y{if(M==="%%")return"%";O++;let G=s.formatters[W];if(typeof G=="function"){let ee=T[O];M=G.call(D,ee),T.splice(O,1),O--}return M}),s.formatArgs.call(D,T),(D.log||s.log).apply(D,T)}return k.namespace=b,k.useColors=s.useColors(),k.color=s.selectColor(b),k.extend=r,k.destroy=s.destroy,Object.defineProperty(k,"enabled",{enumerable:!0,configurable:!1,get:()=>y!==null?y:(I!==s.namespaces&&(I=s.namespaces,U=s.enabled(b)),U),set:T=>{y=T}}),typeof s.init=="function"&&s.init(k),k}function r(b,m){let y=s(this.namespace+(typeof m>"u"?":":m)+b);return y.log=this.log,y}function o(b){s.save(b),s.namespaces=b,s.names=[],s.skips=[];let m,y=(typeof b=="string"?b:"").split(/[\s,]+/),I=y.length;for(m=0;m"-"+m)].join(",");return s.enable(""),b}function a(b){if(b[b.length-1]==="*")return!0;let m,y;for(m=0,y=s.skips.length;m{ae(),se(),oe(),e.formatArgs=l,e.save=h,e.load=s,e.useColors=t,e.storage=r(),e.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof at<"u"&&at.userAgent&&at.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof at<"u"&&at.userAgent&&at.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof at<"u"&&at.userAgent&&at.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function l(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;let a="color: "+this.color;i.splice(1,0,a,"color: inherit");let c=0,p=0;i[0].replace(/%[a-zA-Z%]/g,g=>{g!=="%%"&&(c++,g==="%c"&&(p=c))}),i.splice(p,0,a)}e.log=console.debug||console.log||(()=>{});function h(i){try{i?e.storage.setItem("debug",i):e.storage.removeItem("debug")}catch{}}function s(){let i;try{i=e.storage.getItem("debug")}catch{}return!i&&typeof ze<"u"&&"env"in ze&&(i=ze.env.DEBUG),i}function r(){try{return localStorage}catch{}}n.exports=al()(e);var{formatters:o}=n.exports;o.j=function(i){try{return JSON.stringify(i)}catch(a){return"[UnexpectedJSONParseError]: "+a.message}}}),ll=me((e,n)=>{ae(),se(),oe();var t=nl(),{EventEmitter:l}=(lr(),Me(tr)),h=ol(),s=ps(),r=Ct()("mqtt-packet:parser"),o=class pn extends l{constructor(){super(),this.parser=this.constructor.parser}static parser(a){return this instanceof pn?(this.settings=a||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new pn().parser(a)}_resetState(){r("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new h,this.error=null,this._list=t(),this._stateCounter=0}parse(a){for(this.error&&this._resetState(),this._list.append(a),r("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,r("parse: state complete. _stateCounter is now: %d",this._stateCounter),r("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return r("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let a=this._list.readUInt8(0),c=a>>s.CMD_SHIFT;this.packet.cmd=s.types[c];let p=a&15,g=s.requiredHeaderFlags[c];return g!=null&&p!==g?this._emitError(new Error(s.requiredHeaderFlagsErrors[c])):(this.packet.retain=(a&s.RETAIN_MASK)!==0,this.packet.qos=a>>s.QOS_SHIFT&s.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(a&s.DUP_MASK)!==0,r("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let a=this._parseVarByteNum(!0);return a&&(this.packet.length=a.value,this._list.consume(a.bytes)),r("_parseLength %d",a.value),!!a}_parsePayload(){r("_parsePayload: payload %O",this._list);let a=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}a=!0}return r("_parsePayload complete result: %s",a),a}_parseConnect(){r("_parseConnect");let a,c,p,g,b={},m=this.packet,y=this._parseString();if(y===null)return this._emitError(new Error("Cannot parse protocolId"));if(y!=="MQTT"&&y!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(m.protocolId=y,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(m.protocolVersion=this._list.readUInt8(this._pos),m.protocolVersion>=128&&(m.bridgeMode=!0,m.protocolVersion=m.protocolVersion-128),m.protocolVersion!==3&&m.protocolVersion!==4&&m.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(this._list.readUInt8(this._pos)&1)return this._emitError(new Error("Connect flag bit 0 must be 0, but got 1"));b.username=this._list.readUInt8(this._pos)&s.USERNAME_MASK,b.password=this._list.readUInt8(this._pos)&s.PASSWORD_MASK,b.will=this._list.readUInt8(this._pos)&s.WILL_FLAG_MASK;let I=!!(this._list.readUInt8(this._pos)&s.WILL_RETAIN_MASK),U=(this._list.readUInt8(this._pos)&s.WILL_QOS_MASK)>>s.WILL_QOS_SHIFT;if(b.will)m.will={},m.will.retain=I,m.will.qos=U;else{if(I)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(U)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(m.clean=(this._list.readUInt8(this._pos)&s.CLEAN_SESSION_MASK)!==0,this._pos++,m.keepalive=this._parseNum(),m.keepalive===-1)return this._emitError(new Error("Packet too short"));if(m.protocolVersion===5){let T=this._parseProperties();Object.getOwnPropertyNames(T).length&&(m.properties=T)}let k=this._parseString();if(k===null)return this._emitError(new Error("Packet too short"));if(m.clientId=k,r("_parseConnect: packet.clientId: %s",m.clientId),b.will){if(m.protocolVersion===5){let T=this._parseProperties();Object.getOwnPropertyNames(T).length&&(m.will.properties=T)}if(a=this._parseString(),a===null)return this._emitError(new Error("Cannot parse will topic"));if(m.will.topic=a,r("_parseConnect: packet.will.topic: %s",m.will.topic),c=this._parseBuffer(),c===null)return this._emitError(new Error("Cannot parse will payload"));m.will.payload=c,r("_parseConnect: packet.will.paylaod: %s",m.will.payload)}if(b.username){if(g=this._parseString(),g===null)return this._emitError(new Error("Cannot parse username"));m.username=g,r("_parseConnect: packet.username: %s",m.username)}if(b.password){if(p=this._parseBuffer(),p===null)return this._emitError(new Error("Cannot parse password"));m.password=p}return this.settings=m,r("_parseConnect: complete"),m}_parseConnack(){r("_parseConnack");let a=this.packet;if(this._list.length<1)return null;let c=this._list.readUInt8(this._pos++);if(c>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(a.sessionPresent=!!(c&s.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?a.reasonCode=this._list.readUInt8(this._pos++):a.reasonCode=0;else{if(this._list.length<2)return null;a.returnCode=this._list.readUInt8(this._pos++)}if(a.returnCode===-1||a.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let p=this._parseProperties();Object.getOwnPropertyNames(p).length&&(a.properties=p)}r("_parseConnack: complete")}_parsePublish(){r("_parsePublish");let a=this.packet;if(a.topic=this._parseString(),a.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(a.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(a.properties=c)}a.payload=this._list.slice(this._pos,a.length),r("_parsePublish: payload from buffer list: %o",a.payload)}}_parseSubscribe(){r("_parseSubscribe");let a=this.packet,c,p,g,b,m,y,I;if(a.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let U=this._parseProperties();Object.getOwnPropertyNames(U).length&&(a.properties=U)}if(a.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos=a.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(p=this._parseByte(),this.settings.protocolVersion===5){if(p&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(p&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(g=p&s.SUBSCRIBE_OPTIONS_QOS_MASK,g>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(y=(p>>s.SUBSCRIBE_OPTIONS_NL_SHIFT&s.SUBSCRIBE_OPTIONS_NL_MASK)!==0,m=(p>>s.SUBSCRIBE_OPTIONS_RAP_SHIFT&s.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,b=p>>s.SUBSCRIBE_OPTIONS_RH_SHIFT&s.SUBSCRIBE_OPTIONS_RH_MASK,b>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));I={topic:c,qos:g},this.settings.protocolVersion===5?(I.nl=y,I.rap=m,I.rh=b):this.settings.bridgeMode&&(I.rh=0,I.rap=!0,I.nl=!0),r("_parseSubscribe: push subscription `%s` to subscription",I),a.subscriptions.push(I)}}}_parseSuback(){r("_parseSuback");let a=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(a.properties=c)}if(a.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos2&&c!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(c)}}}_parseUnsubscribe(){r("_parseUnsubscribe");let a=this.packet;if(a.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(a.properties=c)}if(a.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos2){switch(a.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!s.MQTT5_PUBACK_PUBREC_CODES[a.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!s.MQTT5_PUBREL_PUBCOMP_CODES[a.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}r("_parseConfirmation: packet.reasonCode `%d`",a.reasonCode)}else a.reasonCode=0;if(a.length>3){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(a.properties=c)}}return!0}_parseDisconnect(){let a=this.packet;if(r("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(a.reasonCode=this._parseByte(),s.MQTT5_DISCONNECT_CODES[a.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):a.reasonCode=0;let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(a.properties=c)}return r("_parseDisconnect result: true"),!0}_parseAuth(){r("_parseAuth");let a=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(a.reasonCode=this._parseByte(),!s.MQTT5_AUTH_CODES[a.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let c=this._parseProperties();return Object.getOwnPropertyNames(c).length&&(a.properties=c),r("_parseAuth: result: true"),!0}_parseMessageId(){let a=this.packet;return a.messageId=this._parseNum(),a.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(r("_parseMessageId: packet.messageId %d",a.messageId),!0)}_parseString(a){let c=this._parseNum(),p=c+this._pos;if(c===-1||p>this._list.length||p>this.packet.length)return null;let g=this._list.toString("utf8",this._pos,p);return this._pos+=c,r("_parseString: result: %s",g),g}_parseStringPair(){return r("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let a=this._parseNum(),c=a+this._pos;if(a===-1||c>this._list.length||c>this.packet.length)return null;let p=this._list.slice(this._pos,c);return this._pos+=a,r("_parseBuffer: result: %o",p),p}_parseNum(){if(this._list.length-this._pos<2)return-1;let a=this._list.readUInt16BE(this._pos);return this._pos+=2,r("_parseNum: result: %s",a),a}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let a=this._list.readUInt32BE(this._pos);return this._pos+=4,r("_parse4ByteNum: result: %s",a),a}_parseVarByteNum(a){r("_parseVarByteNum");let c=4,p=0,g=1,b=0,m=!1,y,I=this._pos?this._pos:0;for(;p=p&&this._emitError(new Error("Invalid variable byte integer")),I&&(this._pos+=p),m?a?m={bytes:p,value:b}:m=b:m=!1,r("_parseVarByteNum: result: %o",m),m}_parseByte(){let a;return this._pos{ae(),se(),oe();var{Buffer:t}=(et(),Me(Ze)),l=65536,h={},s=t.isBuffer(t.from([1,2]).subarray(0,1));function r(c){let p=t.allocUnsafe(2);return p.writeUInt8(c>>8,0),p.writeUInt8(c&255,1),p}function o(){for(let c=0;c0&&(p=p|128),b.writeUInt8(p,g++);while(c>0&&g<4);return c>0&&(g=0),s?b.subarray(0,g):b.slice(0,g)}function a(c){let p=t.allocUnsafe(4);return p.writeUInt32BE(c,0),p}n.exports={cache:h,generateCache:o,generateNumber:r,genBufVariableByteInt:i,generate4ByteBuffer:a}}),hl=me((e,n)=>{ae(),se(),oe(),typeof ze>"u"||!ze.version||ze.version.indexOf("v0.")===0||ze.version.indexOf("v1.")===0&&ze.version.indexOf("v1.8.")!==0?n.exports={nextTick:t}:n.exports=ze;function t(l,h,s,r){if(typeof l!="function")throw new TypeError('"callback" argument must be a function');var o=arguments.length,i,a;switch(o){case 0:case 1:return ze.nextTick(l);case 2:return ze.nextTick(function(){l.call(null,h)});case 3:return ze.nextTick(function(){l.call(null,h,s)});case 4:return ze.nextTick(function(){l.call(null,h,s,r)});default:for(i=new Array(o-1),a=0;a{ae(),se(),oe();var t=ps(),{Buffer:l}=(et(),Me(Ze)),h=l.allocUnsafe(0),s=l.from([0]),r=ul(),o=hl().nextTick,i=Ct()("mqtt-packet:writeToStream"),a=r.cache,c=r.generateNumber,p=r.generateCache,g=r.genBufVariableByteInt,b=r.generate4ByteBuffer,m=ne,y=!0;function I(x,_,z){switch(i("generate called"),_.cork&&(_.cork(),o(U,_)),y&&(y=!1,p()),i("generate: packet.cmd: %s",x.cmd),x.cmd){case"connect":return k(x,_);case"connack":return T(x,_,z);case"publish":return D(x,_,z);case"puback":case"pubrec":case"pubrel":case"pubcomp":return F(x,_,z);case"subscribe":return R(x,_,z);case"suback":return O(x,_,z);case"unsubscribe":return M(x,_,z);case"unsuback":return W(x,_,z);case"pingreq":case"pingresp":return G(x,_);case"disconnect":return ee(x,_,z);case"auth":return E(x,_,z);default:return _.destroy(new Error("Unknown command")),!1}}Object.defineProperty(I,"cacheNumbers",{get(){return m===ne},set(x){x?((!a||Object.keys(a).length===0)&&(y=!0),m=ne):(y=!1,m=$)}});function U(x){x.uncork()}function k(x,_,z){let le=x||{},X=le.protocolId||"MQTT",J=le.protocolVersion||4,he=le.will,de=le.clean,C=le.keepalive||0,j=le.clientId||"",N=le.username,te=le.password,Q=le.properties;de===void 0&&(de=!0);let L=0;if(!X||typeof X!="string"&&!l.isBuffer(X))return _.destroy(new Error("Invalid protocolId")),!1;if(L+=X.length+2,J!==3&&J!==4&&J!==5)return _.destroy(new Error("Invalid protocol version")),!1;if(L+=1,(typeof j=="string"||l.isBuffer(j))&&(j||J>=4)&&(j||de))L+=l.byteLength(j)+2;else{if(J<4)return _.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(de*1===0)return _.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof C!="number"||C<0||C>65535||C%1!==0)return _.destroy(new Error("Invalid keepalive")),!1;L+=2,L+=1;let H,we;if(J===5){if(H=ve(_,Q),!H)return!1;L+=H.length}if(he){if(typeof he!="object")return _.destroy(new Error("Invalid will")),!1;if(!he.topic||typeof he.topic!="string")return _.destroy(new Error("Invalid will topic")),!1;if(L+=l.byteLength(he.topic)+2,L+=2,he.payload)if(he.payload.length>=0)typeof he.payload=="string"?L+=l.byteLength(he.payload):L+=he.payload.length;else return _.destroy(new Error("Invalid will payload")),!1;if(we={},J===5){if(we=ve(_,he.properties),!we)return!1;L+=we.length}}let _e=!1;if(N!=null)if(ue(N))_e=!0,L+=l.byteLength(N)+2;else return _.destroy(new Error("Invalid username")),!1;if(te!=null){if(!_e)return _.destroy(new Error("Username is required to use password")),!1;if(ue(te))L+=Ee(te)+2;else return _.destroy(new Error("Invalid password")),!1}_.write(t.CONNECT_HEADER),Z(_,L),re(_,X),le.bridgeMode&&(J+=128),_.write(J===131?t.VERSION131:J===132?t.VERSION132:J===4?t.VERSION4:J===5?t.VERSION5:t.VERSION3);let Ae=0;return Ae|=N!=null?t.USERNAME_MASK:0,Ae|=te!=null?t.PASSWORD_MASK:0,Ae|=he&&he.retain?t.WILL_RETAIN_MASK:0,Ae|=he&&he.qos?he.qos<0&&m(_,j),Q==null||Q.write(),i("publish: payload: %o",C),_.write(C)}function F(x,_,z){let le=z?z.protocolVersion:4,X=x||{},J=X.cmd||"puback",he=X.messageId,de=X.dup&&J==="pubrel"?t.DUP_MASK:0,C=0,j=X.reasonCode,N=X.properties,te=le===5?3:2;if(J==="pubrel"&&(C=1),typeof he!="number")return _.destroy(new Error("Invalid messageId")),!1;let Q=null;if(le===5&&typeof N=="object"){if(Q=S(_,N,z,te),!Q)return!1;te+=Q.length}return _.write(t.ACKS[J][C][de][0]),te===3&&(te+=j!==0?1:-1),Z(_,te),m(_,he),le===5&&te!==2&&_.write(l.from([j])),Q!==null?Q.write():te===4&&_.write(l.from([0])),!0}function R(x,_,z){i("subscribe: packet: ");let le=z?z.protocolVersion:4,X=x||{},J=X.dup?t.DUP_MASK:0,he=X.messageId,de=X.subscriptions,C=X.properties,j=0;if(typeof he!="number")return _.destroy(new Error("Invalid messageId")),!1;j+=2;let N=null;if(le===5){if(N=ve(_,C),!N)return!1;j+=N.length}if(typeof de=="object"&&de.length)for(let Q=0;Q2)return _.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}j+=l.byteLength(L)+2+1}else return _.destroy(new Error("Invalid subscriptions")),!1;i("subscribe: writing to stream: %o",t.SUBSCRIBE_HEADER),_.write(t.SUBSCRIBE_HEADER[1][J?1:0][0]),Z(_,j),m(_,he),N!==null&&N.write();let te=!0;for(let Q of de){let L=Q.topic,H=Q.qos,we=+Q.nl,_e=+Q.rap,Ae=Q.rh,Re;K(_,L),Re=t.SUBSCRIBE_OPTIONS_QOS[H],le===5&&(Re|=we?t.SUBSCRIBE_OPTIONS_NL:0,Re|=_e?t.SUBSCRIBE_OPTIONS_RAP:0,Re|=Ae?t.SUBSCRIBE_OPTIONS_RH[Ae]:0),te=_.write(l.from([Re]))}return te}function O(x,_,z){let le=z?z.protocolVersion:4,X=x||{},J=X.messageId,he=X.granted,de=X.properties,C=0;if(typeof J!="number")return _.destroy(new Error("Invalid messageId")),!1;if(C+=2,typeof he=="object"&&he.length)for(let N=0;Nt.VARBYTEINT_MAX)return x.destroy(new Error(`Invalid variable byte integer: ${_}`)),!1;let z=q[_];return z||(z=g(_),_<16384&&(q[_]=z)),i("writeVarByteInt: writing to stream: %o",z),x.write(z)}function K(x,_){let z=l.byteLength(_);return m(x,z),i("writeString: %s",_),x.write(_,"utf8")}function ge(x,_,z){K(x,_),K(x,z)}function ne(x,_){return i("writeNumberCached: number: %d",_),i("writeNumberCached: %o",a[_]),x.write(a[_])}function $(x,_){let z=c(_);return i("writeNumberGenerated: %o",z),x.write(z)}function be(x,_){let z=b(_);return i("write4ByteNumber: %o",z),x.write(z)}function re(x,_){typeof _=="string"?K(x,_):_?(m(x,_.length),x.write(_)):m(x,0)}function ve(x,_){if(typeof _!="object"||_.length!=null)return{length:1,write(){ce(x,{},0)}};let z=0;function le(X,J){let he=t.propertiesTypes[X],de=0;switch(he){case"byte":{if(typeof J!="boolean")return x.destroy(new Error(`Invalid ${X}: ${J}`)),!1;de+=2;break}case"int8":{if(typeof J!="number"||J<0||J>255)return x.destroy(new Error(`Invalid ${X}: ${J}`)),!1;de+=2;break}case"binary":{if(J&&J===null)return x.destroy(new Error(`Invalid ${X}: ${J}`)),!1;de+=1+l.byteLength(J)+2;break}case"int16":{if(typeof J!="number"||J<0||J>65535)return x.destroy(new Error(`Invalid ${X}: ${J}`)),!1;de+=3;break}case"int32":{if(typeof J!="number"||J<0||J>4294967295)return x.destroy(new Error(`Invalid ${X}: ${J}`)),!1;de+=5;break}case"var":{if(typeof J!="number"||J<0||J>268435455)return x.destroy(new Error(`Invalid ${X}: ${J}`)),!1;de+=1+l.byteLength(g(J));break}case"string":{if(typeof J!="string")return x.destroy(new Error(`Invalid ${X}: ${J}`)),!1;de+=3+l.byteLength(J.toString());break}case"pair":{if(typeof J!="object")return x.destroy(new Error(`Invalid ${X}: ${J}`)),!1;de+=Object.getOwnPropertyNames(J).reduce((C,j)=>{let N=J[j];return Array.isArray(N)?C+=N.reduce((te,Q)=>(te+=3+l.byteLength(j.toString())+2+l.byteLength(Q.toString()),te),0):C+=3+l.byteLength(j.toString())+2+l.byteLength(J[j].toString()),C},0);break}default:return x.destroy(new Error(`Invalid property ${X}: ${J}`)),!1}return de}if(_)for(let X in _){let J=0,he=0,de=_[X];if(Array.isArray(de))for(let C=0;CJ;){let de=X.shift();if(de&&_[de])delete _[de],he=ve(x,_);else return!1}return he}function Y(x,_,z){switch(t.propertiesTypes[_]){case"byte":{x.write(l.from([t.properties[_]])),x.write(l.from([+z]));break}case"int8":{x.write(l.from([t.properties[_]])),x.write(l.from([z]));break}case"binary":{x.write(l.from([t.properties[_]])),re(x,z);break}case"int16":{x.write(l.from([t.properties[_]])),m(x,z);break}case"int32":{x.write(l.from([t.properties[_]])),be(x,z);break}case"var":{x.write(l.from([t.properties[_]])),Z(x,z);break}case"string":{x.write(l.from([t.properties[_]])),K(x,z);break}case"pair":{Object.getOwnPropertyNames(z).forEach(le=>{let X=z[le];Array.isArray(X)?X.forEach(J=>{x.write(l.from([t.properties[_]])),ge(x,le.toString(),J.toString())}):(x.write(l.from([t.properties[_]])),ge(x,le.toString(),X.toString()))});break}default:return x.destroy(new Error(`Invalid property ${_} value: ${z}`)),!1}}function ce(x,_,z){Z(x,z);for(let le in _)if(Object.prototype.hasOwnProperty.call(_,le)&&_[le]!==null){let X=_[le];if(Array.isArray(X))for(let J=0;J{ae(),se(),oe();var t=gs(),{EventEmitter:l}=(lr(),Me(tr)),{Buffer:h}=(et(),Me(Ze));function s(o,i){let a=new r;return t(o,a,i),a.concat()}var r=class extends l{constructor(){super(),this._array=new Array(20),this._i=0}write(o){return this._array[this._i++]=o,!0}concat(){let o=0,i=new Array(this._array.length),a=this._array,c=0,p;for(p=0;p{ae(),se(),oe(),e.parser=ll().parser,e.generate=cl(),e.writeToStream=gs()}),bs=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0});var n=class{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let t=this.nextId++;return this.nextId===65536&&(this.nextId=1),t}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(t){return!0}deallocate(t){}clear(){}};e.default=n}),dl=me((e,n)=>{ae(),se(),oe(),n.exports=l;function t(s){return s instanceof sr?sr.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function l(s){if(s=s||{},s.circles)return h(s);return s.proto?i:o;function r(a,c){for(var p=Object.keys(a),g=new Array(p.length),b=0;b{ae(),se(),oe(),n.exports=dl()()}),gl=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0}),e.validateTopics=e.validateTopic=void 0;function n(l){let h=l.split("/");for(let s=0;s{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0});var n=rr(),t={objectMode:!0},l={clean:!0},h=class{constructor(s){this.options=s||{},this.options=Object.assign(Object.assign({},l),s),this._inflights=new Map}put(s,r){return this._inflights.set(s.messageId,s),r&&r(),this}createStream(){let s=new n.Readable(t),r=[],o=!1,i=0;return this._inflights.forEach((a,c)=>{r.push(a)}),s._read=()=>{!o&&i{if(!o)return o=!0,setTimeout(()=>{s.emit("close")},0),s},s}del(s,r){let o=this._inflights.get(s.messageId);return o?(this._inflights.delete(s.messageId),r(null,o)):r&&r(new Error("missing packet")),this}get(s,r){let o=this._inflights.get(s.messageId);return o?r(null,o):r&&r(new Error("missing packet")),this}close(s){this.options.clean&&(this._inflights=null),s&&s()}};e.default=h}),bl=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0});var n=[0,16,128,131,135,144,145,151,153],t=(l,h,s)=>{l.log("handlePublish: packet %o",h),s=typeof s<"u"?s:l.noop;let r=h.topic.toString(),o=h.payload,{qos:i}=h,{messageId:a}=h,{options:c}=l;if(l.options.protocolVersion===5){let p;if(h.properties&&(p=h.properties.topicAlias),typeof p<"u")if(r.length===0)if(p>0&&p<=65535){let g=l.topicAliasRecv.getTopicByAlias(p);if(g)r=g,l.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",r,p);else{l.log("handlePublish :: unregistered topic alias. alias: %d",p),l.emit("error",new Error("Received unregistered Topic Alias"));return}}else{l.log("handlePublish :: topic alias out of range. alias: %d",p),l.emit("error",new Error("Received Topic Alias is out of range"));return}else if(l.topicAliasRecv.put(r,p))l.log("handlePublish :: registered topic: %s - alias: %d",r,p);else{l.log("handlePublish :: topic alias out of range. alias: %d",p),l.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(l.log("handlePublish: qos %d",i),i){case 2:{c.customHandleAcks(r,o,h,(p,g)=>{if(typeof p=="number"&&(g=p,p=null),p)return l.emit("error",p);if(n.indexOf(g)===-1)return l.emit("error",new Error("Wrong reason code for pubrec"));g?l._sendPacket({cmd:"pubrec",messageId:a,reasonCode:g},s):l.incomingStore.put(h,()=>{l._sendPacket({cmd:"pubrec",messageId:a},s)})});break}case 1:{c.customHandleAcks(r,o,h,(p,g)=>{if(typeof p=="number"&&(g=p,p=null),p)return l.emit("error",p);if(n.indexOf(g)===-1)return l.emit("error",new Error("Wrong reason code for puback"));g||l.emit("message",r,o,h),l.handleMessage(h,b=>{if(b)return s&&s(b);l._sendPacket({cmd:"puback",messageId:a,reasonCode:g},s)})});break}case 0:l.emit("message",r,o,h),l.handleMessage(h,s);break;default:l.log("handlePublish: unknown QoS. Doing nothing.");break}};e.default=t}),yr=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0}),e.nextTick=e.applyMixin=e.ErrorWithReasonCode=void 0;var n=class ys extends Error{constructor(h,s){super(h),this.code=s,Object.setPrototypeOf(this,ys.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}};e.ErrorWithReasonCode=n;function t(l,h,s=!1){var r;let o=[h];for(;;){let i=o[0],a=Object.getPrototypeOf(i);if(a!=null&&a.prototype)o.unshift(a);else break}for(let i of o)for(let a of Object.getOwnPropertyNames(i.prototype))(s||a!=="constructor")&&Object.defineProperty(l.prototype,a,(r=Object.getOwnPropertyDescriptor(i.prototype,a))!==null&&r!==void 0?r:Object.create(null))}e.applyMixin=t,e.nextTick=ze?ze.nextTick:l=>{setTimeout(l,0)}}),Wr=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0}),e.ReasonCodes=void 0,e.ReasonCodes={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};var n=(t,l)=>{let{messageId:h}=l,s=l.cmd,r=null,o=t.outgoing[h]?t.outgoing[h].cb:null,i;if(!o){t.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(t.log("_handleAck :: packet type",s),s){case"pubcomp":case"puback":{let a=l.reasonCode;a&&a>0&&a!==16?(i=new Error(`Publish error: ${e.ReasonCodes[a]}`),i.code=a,t._removeOutgoingAndStoreMessage(h,()=>{o(i,l)})):t._removeOutgoingAndStoreMessage(h,o);break}case"pubrec":{r={cmd:"pubrel",qos:2,messageId:h};let a=l.reasonCode;a&&a>0&&a!==16?(i=new Error(`Publish error: ${e.ReasonCodes[a]}`),i.code=a,t._removeOutgoingAndStoreMessage(h,()=>{o(i,l)})):t._sendPacket(r);break}case"suback":{delete t.outgoing[h],t.messageIdProvider.deallocate(h);let a=l.granted;for(let c=0;c{delete t._resubscribeTopics[g]})}delete t.messageIdToTopic[h],t._invokeStoreProcessingQueue(),o(null,l);break}case"unsuback":{delete t.outgoing[h],t.messageIdProvider.deallocate(h),t._invokeStoreProcessingQueue(),o(null);break}default:t.emit("error",new Error("unrecognized packet type"))}t.disconnecting&&Object.keys(t.outgoing).length===0&&t.emit("outgoingEmpty")};e.default=n}),ml=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0});var n=yr(),t=Wr(),l=(h,s)=>{let{options:r}=h,o=r.protocolVersion,i=o===5?s.reasonCode:s.returnCode;if(o!==5){let a=new n.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${o}`,i);h.emit("error",a);return}h.handleAuth(s,(a,c)=>{if(a){h.emit("error",a);return}if(i===24)h.reconnecting=!1,h._sendPacket(c);else{let p=new n.ErrorWithReasonCode(`Connection refused: ${t.ReasonCodes[i]}`,i);h.emit("error",p)}})};e.default=l}),yl=me(e=>{var b,m,y,I,U,k,T,D,F,R,O,M,W,G,ee,E,q,Z,K,ge,ne,$,be,re,ve,S,gn,ce,Ee,ue,x,_,ws,le,X,J,he,Ut,C,Lt,N,bn,Q,Or,H,Cr,_e,Ue,Re,mn,u,gr,v;ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=void 0;var n=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,t=new Set,l=typeof ze=="object"&&ze?ze:{},h=(A,w,P,V)=>{typeof l.emitWarning=="function"?l.emitWarning(A,w,P,V):console.error(`[${P}] ${w}: ${A}`)},s=globalThis.AbortController,r=globalThis.AbortSignal;if(typeof s>"u"){r=class{constructor(){je(this,"onabort");je(this,"_onabort",[]);je(this,"reason");je(this,"aborted",!1)}addEventListener(P,V){this._onabort.push(V)}},s=class{constructor(){je(this,"signal",new r);w()}abort(P){var V,fe;if(!this.signal.aborted){this.signal.reason=P,this.signal.aborted=!0;for(let ie of this.signal._onabort)ie(P);(fe=(V=this.signal).onabort)==null||fe.call(V,P)}}};let A=((b=l.env)==null?void 0:b.LRU_CACHE_IGNORE_AC_WARNING)!=="1",w=()=>{A&&(A=!1,h("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",w))}}var o=A=>!t.has(A),i=A=>A&&A===Math.floor(A)&&A>0&&isFinite(A),a=A=>i(A)?A<=Math.pow(2,8)?Uint8Array:A<=Math.pow(2,16)?Uint16Array:A<=Math.pow(2,32)?Uint32Array:A<=Number.MAX_SAFE_INTEGER?c:null:null,c=class extends Array{constructor(A){super(A),this.fill(0)}},p=(m=class{constructor(w,P){je(this,"heap");je(this,"length");if(!B(m,y))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new P(w),this.length=0}static create(w){let P=a(w);if(!P)return[];Te(m,y,!0);let V=new m(w,P);return Te(m,y,!1),V}push(w){this.heap[this.length++]=w}pop(){return this.heap[--this.length]}},y=new WeakMap,Ce(m,y,!1),m),g=(v=class{constructor(w){Ce(this,S);Ce(this,_);Ce(this,he);Ce(this,C);Ce(this,N);Ce(this,Q);Ce(this,H);Ce(this,_e);Ce(this,Re);Ce(this,u);Ce(this,I,void 0);Ce(this,U,void 0);Ce(this,k,void 0);Ce(this,T,void 0);Ce(this,D,void 0);je(this,"ttl");je(this,"ttlResolution");je(this,"ttlAutopurge");je(this,"updateAgeOnGet");je(this,"updateAgeOnHas");je(this,"allowStale");je(this,"noDisposeOnSet");je(this,"noUpdateTTL");je(this,"maxEntrySize");je(this,"sizeCalculation");je(this,"noDeleteOnFetchRejection");je(this,"noDeleteOnStaleGet");je(this,"allowStaleOnFetchAbort");je(this,"allowStaleOnFetchRejection");je(this,"ignoreFetchAbort");Ce(this,F,void 0);Ce(this,R,void 0);Ce(this,O,void 0);Ce(this,M,void 0);Ce(this,W,void 0);Ce(this,G,void 0);Ce(this,ee,void 0);Ce(this,E,void 0);Ce(this,q,void 0);Ce(this,Z,void 0);Ce(this,K,void 0);Ce(this,ge,void 0);Ce(this,ne,void 0);Ce(this,$,void 0);Ce(this,be,void 0);Ce(this,re,void 0);Ce(this,ve,void 0);Ce(this,ce,()=>{});Ce(this,Ee,()=>{});Ce(this,ue,()=>{});Ce(this,x,()=>!1);Ce(this,le,w=>{});Ce(this,X,(w,P,V)=>{});Ce(this,J,(w,P,V,fe)=>{if(V||fe)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});let{max:P=0,ttl:V,ttlResolution:fe=1,ttlAutopurge:ie,updateAgeOnGet:ye,updateAgeOnHas:Se,allowStale:ke,dispose:$e,disposeAfter:tt,noDisposeOnSet:xe,noUpdateTTL:rt,maxSize:Ve=0,maxEntrySize:He=0,sizeCalculation:qe,fetchMethod:Je,noDeleteOnFetchRejection:Oe,noDeleteOnStaleGet:Fe,allowStaleOnFetchRejection:it,allowStaleOnFetchAbort:Qe,ignoreFetchAbort:ht}=w;if(P!==0&&!i(P))throw new TypeError("max option must be a nonnegative integer");let Dt=P?a(P):Array;if(!Dt)throw new Error("invalid max value: "+P);if(Te(this,I,P),Te(this,U,Ve),this.maxEntrySize=He||B(this,U),this.sizeCalculation=qe,this.sizeCalculation){if(!B(this,U)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(Je!==void 0&&typeof Je!="function")throw new TypeError("fetchMethod must be a function if specified");if(Te(this,D,Je),Te(this,re,!!Je),Te(this,O,new Map),Te(this,M,new Array(P).fill(void 0)),Te(this,W,new Array(P).fill(void 0)),Te(this,G,new Dt(P)),Te(this,ee,new Dt(P)),Te(this,E,0),Te(this,q,0),Te(this,Z,p.create(P)),Te(this,F,0),Te(this,R,0),typeof $e=="function"&&Te(this,k,$e),typeof tt=="function"?(Te(this,T,tt),Te(this,K,[])):(Te(this,T,void 0),Te(this,K,void 0)),Te(this,be,!!B(this,k)),Te(this,ve,!!B(this,T)),this.noDisposeOnSet=!!xe,this.noUpdateTTL=!!rt,this.noDeleteOnFetchRejection=!!Oe,this.allowStaleOnFetchRejection=!!it,this.allowStaleOnFetchAbort=!!Qe,this.ignoreFetchAbort=!!ht,this.maxEntrySize!==0){if(B(this,U)!==0&&!i(B(this,U)))throw new TypeError("maxSize must be a positive integer if specified");if(!i(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Ie(this,_,ws).call(this)}if(this.allowStale=!!ke,this.noDeleteOnStaleGet=!!Fe,this.updateAgeOnGet=!!ye,this.updateAgeOnHas=!!Se,this.ttlResolution=i(fe)||fe===0?fe:1,this.ttlAutopurge=!!ie,this.ttl=V||0,this.ttl){if(!i(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Ie(this,S,gn).call(this)}if(B(this,I)===0&&this.ttl===0&&B(this,U)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!B(this,I)&&!B(this,U)){let xt="LRU_CACHE_UNBOUNDED";o(xt)&&(t.add(xt),h("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",xt,v))}}static unsafeExposeInternals(w){return{starts:B(w,ne),ttls:B(w,$),sizes:B(w,ge),keyMap:B(w,O),keyList:B(w,M),valList:B(w,W),next:B(w,G),prev:B(w,ee),get head(){return B(w,E)},get tail(){return B(w,q)},free:B(w,Z),isBackgroundFetch:P=>{var V;return Ie(V=w,_e,Ue).call(V,P)},backgroundFetch:(P,V,fe,ie)=>{var ye;return Ie(ye=w,H,Cr).call(ye,P,V,fe,ie)},moveToTail:P=>{var V;return Ie(V=w,u,gr).call(V,P)},indexes:P=>{var V;return Ie(V=w,he,Ut).call(V,P)},rindexes:P=>{var V;return Ie(V=w,C,Lt).call(V,P)},isStale:P=>{var V;return B(V=w,x).call(V,P)}}}get max(){return B(this,I)}get maxSize(){return B(this,U)}get calculatedSize(){return B(this,R)}get size(){return B(this,F)}get fetchMethod(){return B(this,D)}get dispose(){return B(this,k)}get disposeAfter(){return B(this,T)}getRemainingTTL(w){return B(this,O).has(w)?1/0:0}*entries(){for(let w of Ie(this,he,Ut).call(this))B(this,W)[w]!==void 0&&B(this,M)[w]!==void 0&&!Ie(this,_e,Ue).call(this,B(this,W)[w])&&(yield[B(this,M)[w],B(this,W)[w]])}*rentries(){for(let w of Ie(this,C,Lt).call(this))B(this,W)[w]!==void 0&&B(this,M)[w]!==void 0&&!Ie(this,_e,Ue).call(this,B(this,W)[w])&&(yield[B(this,M)[w],B(this,W)[w]])}*keys(){for(let w of Ie(this,he,Ut).call(this)){let P=B(this,M)[w];P!==void 0&&!Ie(this,_e,Ue).call(this,B(this,W)[w])&&(yield P)}}*rkeys(){for(let w of Ie(this,C,Lt).call(this)){let P=B(this,M)[w];P!==void 0&&!Ie(this,_e,Ue).call(this,B(this,W)[w])&&(yield P)}}*values(){for(let w of Ie(this,he,Ut).call(this))B(this,W)[w]!==void 0&&!Ie(this,_e,Ue).call(this,B(this,W)[w])&&(yield B(this,W)[w])}*rvalues(){for(let w of Ie(this,C,Lt).call(this))B(this,W)[w]!==void 0&&!Ie(this,_e,Ue).call(this,B(this,W)[w])&&(yield B(this,W)[w])}[Symbol.iterator](){return this.entries()}find(w,P={}){for(let V of Ie(this,he,Ut).call(this)){let fe=B(this,W)[V],ie=Ie(this,_e,Ue).call(this,fe)?fe.__staleWhileFetching:fe;if(ie!==void 0&&w(ie,B(this,M)[V],this))return this.get(B(this,M)[V],P)}}forEach(w,P=this){for(let V of Ie(this,he,Ut).call(this)){let fe=B(this,W)[V],ie=Ie(this,_e,Ue).call(this,fe)?fe.__staleWhileFetching:fe;ie!==void 0&&w.call(P,ie,B(this,M)[V],this)}}rforEach(w,P=this){for(let V of Ie(this,C,Lt).call(this)){let fe=B(this,W)[V],ie=Ie(this,_e,Ue).call(this,fe)?fe.__staleWhileFetching:fe;ie!==void 0&&w.call(P,ie,B(this,M)[V],this)}}purgeStale(){let w=!1;for(let P of Ie(this,C,Lt).call(this,{allowStale:!0}))B(this,x).call(this,P)&&(this.delete(B(this,M)[P]),w=!0);return w}dump(){let w=[];for(let P of Ie(this,he,Ut).call(this,{allowStale:!0})){let V=B(this,M)[P],fe=B(this,W)[P],ie=Ie(this,_e,Ue).call(this,fe)?fe.__staleWhileFetching:fe;if(ie===void 0||V===void 0)continue;let ye={value:ie};if(B(this,$)&&B(this,ne)){ye.ttl=B(this,$)[P];let Se=n.now()-B(this,ne)[P];ye.start=Math.floor(Date.now()-Se)}B(this,ge)&&(ye.size=B(this,ge)[P]),w.unshift([V,ye])}return w}load(w){this.clear();for(let[P,V]of w){if(V.start){let fe=Date.now()-V.start;V.start=n.now()-fe}this.set(P,V.value,V)}}set(w,P,V={}){var rt,Ve,He,qe,Je;if(P===void 0)return this.delete(w),this;let{ttl:fe=this.ttl,start:ie,noDisposeOnSet:ye=this.noDisposeOnSet,sizeCalculation:Se=this.sizeCalculation,status:ke}=V,{noUpdateTTL:$e=this.noUpdateTTL}=V,tt=B(this,J).call(this,w,P,V.size||0,Se);if(this.maxEntrySize&&tt>this.maxEntrySize)return ke&&(ke.set="miss",ke.maxEntrySizeExceeded=!0),this.delete(w),this;let xe=B(this,F)===0?void 0:B(this,O).get(w);if(xe===void 0)xe=B(this,F)===0?B(this,q):B(this,Z).length!==0?B(this,Z).pop():B(this,F)===B(this,I)?Ie(this,Q,Or).call(this,!1):B(this,F),B(this,M)[xe]=w,B(this,W)[xe]=P,B(this,O).set(w,xe),B(this,G)[B(this,q)]=xe,B(this,ee)[xe]=B(this,q),Te(this,q,xe),wr(this,F)._++,B(this,X).call(this,xe,tt,ke),ke&&(ke.set="add"),$e=!1;else{Ie(this,u,gr).call(this,xe);let Oe=B(this,W)[xe];if(P!==Oe){if(B(this,re)&&Ie(this,_e,Ue).call(this,Oe)){Oe.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Fe}=Oe;Fe!==void 0&&!ye&&(B(this,be)&&((rt=B(this,k))==null||rt.call(this,Fe,w,"set")),B(this,ve)&&((Ve=B(this,K))==null||Ve.push([Fe,w,"set"])))}else ye||(B(this,be)&&((He=B(this,k))==null||He.call(this,Oe,w,"set")),B(this,ve)&&((qe=B(this,K))==null||qe.push([Oe,w,"set"])));if(B(this,le).call(this,xe),B(this,X).call(this,xe,tt,ke),B(this,W)[xe]=P,ke){ke.set="replace";let Fe=Oe&&Ie(this,_e,Ue).call(this,Oe)?Oe.__staleWhileFetching:Oe;Fe!==void 0&&(ke.oldValue=Fe)}}else ke&&(ke.set="update")}if(fe!==0&&!B(this,$)&&Ie(this,S,gn).call(this),B(this,$)&&($e||B(this,ue).call(this,xe,fe,ie),ke&&B(this,Ee).call(this,ke,xe)),!ye&&B(this,ve)&&B(this,K)){let Oe=B(this,K),Fe;for(;Fe=Oe==null?void 0:Oe.shift();)(Je=B(this,T))==null||Je.call(this,...Fe)}return this}pop(){var w;try{for(;B(this,F);){let P=B(this,W)[B(this,E)];if(Ie(this,Q,Or).call(this,!0),Ie(this,_e,Ue).call(this,P)){if(P.__staleWhileFetching)return P.__staleWhileFetching}else if(P!==void 0)return P}}finally{if(B(this,ve)&&B(this,K)){let P=B(this,K),V;for(;V=P==null?void 0:P.shift();)(w=B(this,T))==null||w.call(this,...V)}}}has(w,P={}){let{updateAgeOnHas:V=this.updateAgeOnHas,status:fe}=P,ie=B(this,O).get(w);if(ie!==void 0){let ye=B(this,W)[ie];if(Ie(this,_e,Ue).call(this,ye)&&ye.__staleWhileFetching===void 0)return!1;if(B(this,x).call(this,ie))fe&&(fe.has="stale",B(this,Ee).call(this,fe,ie));else return V&&B(this,ce).call(this,ie),fe&&(fe.has="hit",B(this,Ee).call(this,fe,ie)),!0}else fe&&(fe.has="miss");return!1}peek(w,P={}){let{allowStale:V=this.allowStale}=P,fe=B(this,O).get(w);if(fe!==void 0&&(V||!B(this,x).call(this,fe))){let ie=B(this,W)[fe];return Ie(this,_e,Ue).call(this,ie)?ie.__staleWhileFetching:ie}}async fetch(w,P={}){let{allowStale:V=this.allowStale,updateAgeOnGet:fe=this.updateAgeOnGet,noDeleteOnStaleGet:ie=this.noDeleteOnStaleGet,ttl:ye=this.ttl,noDisposeOnSet:Se=this.noDisposeOnSet,size:ke=0,sizeCalculation:$e=this.sizeCalculation,noUpdateTTL:tt=this.noUpdateTTL,noDeleteOnFetchRejection:xe=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:Ve=this.ignoreFetchAbort,allowStaleOnFetchAbort:He=this.allowStaleOnFetchAbort,context:qe,forceRefresh:Je=!1,status:Oe,signal:Fe}=P;if(!B(this,re))return Oe&&(Oe.fetch="get"),this.get(w,{allowStale:V,updateAgeOnGet:fe,noDeleteOnStaleGet:ie,status:Oe});let it={allowStale:V,updateAgeOnGet:fe,noDeleteOnStaleGet:ie,ttl:ye,noDisposeOnSet:Se,size:ke,sizeCalculation:$e,noUpdateTTL:tt,noDeleteOnFetchRejection:xe,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:He,ignoreFetchAbort:Ve,status:Oe,signal:Fe},Qe=B(this,O).get(w);if(Qe===void 0){Oe&&(Oe.fetch="miss");let ht=Ie(this,H,Cr).call(this,w,Qe,it,qe);return ht.__returned=ht}else{let ht=B(this,W)[Qe];if(Ie(this,_e,Ue).call(this,ht)){let Dn=V&&ht.__staleWhileFetching!==void 0;return Oe&&(Oe.fetch="inflight",Dn&&(Oe.returnedStale=!0)),Dn?ht.__staleWhileFetching:ht.__returned=ht}let Dt=B(this,x).call(this,Qe);if(!Je&&!Dt)return Oe&&(Oe.fetch="hit"),Ie(this,u,gr).call(this,Qe),fe&&B(this,ce).call(this,Qe),Oe&&B(this,Ee).call(this,Oe,Qe),ht;let xt=Ie(this,H,Cr).call(this,w,Qe,it,qe),jn=xt.__staleWhileFetching!==void 0&&V;return Oe&&(Oe.fetch=Dt?"stale":"refresh",jn&&Dt&&(Oe.returnedStale=!0)),jn?xt.__staleWhileFetching:xt.__returned=xt}}get(w,P={}){let{allowStale:V=this.allowStale,updateAgeOnGet:fe=this.updateAgeOnGet,noDeleteOnStaleGet:ie=this.noDeleteOnStaleGet,status:ye}=P,Se=B(this,O).get(w);if(Se!==void 0){let ke=B(this,W)[Se],$e=Ie(this,_e,Ue).call(this,ke);return ye&&B(this,Ee).call(this,ye,Se),B(this,x).call(this,Se)?(ye&&(ye.get="stale"),$e?(ye&&V&&ke.__staleWhileFetching!==void 0&&(ye.returnedStale=!0),V?ke.__staleWhileFetching:void 0):(ie||this.delete(w),ye&&V&&(ye.returnedStale=!0),V?ke:void 0)):(ye&&(ye.get="hit"),$e?ke.__staleWhileFetching:(Ie(this,u,gr).call(this,Se),fe&&B(this,ce).call(this,Se),ke))}else ye&&(ye.get="miss")}delete(w){var V,fe,ie,ye;let P=!1;if(B(this,F)!==0){let Se=B(this,O).get(w);if(Se!==void 0)if(P=!0,B(this,F)===1)this.clear();else{B(this,le).call(this,Se);let ke=B(this,W)[Se];Ie(this,_e,Ue).call(this,ke)?ke.__abortController.abort(new Error("deleted")):(B(this,be)||B(this,ve))&&(B(this,be)&&((V=B(this,k))==null||V.call(this,ke,w,"delete")),B(this,ve)&&((fe=B(this,K))==null||fe.push([ke,w,"delete"]))),B(this,O).delete(w),B(this,M)[Se]=void 0,B(this,W)[Se]=void 0,Se===B(this,q)?Te(this,q,B(this,ee)[Se]):Se===B(this,E)?Te(this,E,B(this,G)[Se]):(B(this,G)[B(this,ee)[Se]]=B(this,G)[Se],B(this,ee)[B(this,G)[Se]]=B(this,ee)[Se]),wr(this,F)._--,B(this,Z).push(Se)}}if(B(this,ve)&&((ie=B(this,K))!=null&&ie.length)){let Se=B(this,K),ke;for(;ke=Se==null?void 0:Se.shift();)(ye=B(this,T))==null||ye.call(this,...ke)}return P}clear(){var w,P,V;for(let fe of Ie(this,C,Lt).call(this,{allowStale:!0})){let ie=B(this,W)[fe];if(Ie(this,_e,Ue).call(this,ie))ie.__abortController.abort(new Error("deleted"));else{let ye=B(this,M)[fe];B(this,be)&&((w=B(this,k))==null||w.call(this,ie,ye,"delete")),B(this,ve)&&((P=B(this,K))==null||P.push([ie,ye,"delete"]))}}if(B(this,O).clear(),B(this,W).fill(void 0),B(this,M).fill(void 0),B(this,$)&&B(this,ne)&&(B(this,$).fill(0),B(this,ne).fill(0)),B(this,ge)&&B(this,ge).fill(0),Te(this,E,0),Te(this,q,0),B(this,Z).length=0,Te(this,R,0),Te(this,F,0),B(this,ve)&&B(this,K)){let fe=B(this,K),ie;for(;ie=fe==null?void 0:fe.shift();)(V=B(this,T))==null||V.call(this,...ie)}}},I=new WeakMap,U=new WeakMap,k=new WeakMap,T=new WeakMap,D=new WeakMap,F=new WeakMap,R=new WeakMap,O=new WeakMap,M=new WeakMap,W=new WeakMap,G=new WeakMap,ee=new WeakMap,E=new WeakMap,q=new WeakMap,Z=new WeakMap,K=new WeakMap,ge=new WeakMap,ne=new WeakMap,$=new WeakMap,be=new WeakMap,re=new WeakMap,ve=new WeakMap,S=new WeakSet,gn=function(){let w=new c(B(this,I)),P=new c(B(this,I));Te(this,$,w),Te(this,ne,P),Te(this,ue,(ie,ye,Se=n.now())=>{if(P[ie]=ye!==0?Se:0,w[ie]=ye,ye!==0&&this.ttlAutopurge){let ke=setTimeout(()=>{B(this,x).call(this,ie)&&this.delete(B(this,M)[ie])},ye+1);ke.unref&&ke.unref()}}),Te(this,ce,ie=>{P[ie]=w[ie]!==0?n.now():0}),Te(this,Ee,(ie,ye)=>{if(w[ye]){let Se=w[ye],ke=P[ye];ie.ttl=Se,ie.start=ke,ie.now=V||fe();let $e=ie.now-ke;ie.remainingTTL=Se-$e}});let V=0,fe=()=>{let ie=n.now();if(this.ttlResolution>0){V=ie;let ye=setTimeout(()=>V=0,this.ttlResolution);ye.unref&&ye.unref()}return ie};this.getRemainingTTL=ie=>{let ye=B(this,O).get(ie);if(ye===void 0)return 0;let Se=w[ye],ke=P[ye];if(Se===0||ke===0)return 1/0;let $e=(V||fe())-ke;return Se-$e},Te(this,x,ie=>w[ie]!==0&&P[ie]!==0&&(V||fe())-P[ie]>w[ie])},ce=new WeakMap,Ee=new WeakMap,ue=new WeakMap,x=new WeakMap,_=new WeakSet,ws=function(){let w=new c(B(this,I));Te(this,R,0),Te(this,ge,w),Te(this,le,P=>{Te(this,R,B(this,R)-w[P]),w[P]=0}),Te(this,J,(P,V,fe,ie)=>{if(Ie(this,_e,Ue).call(this,V))return 0;if(!i(fe))if(ie){if(typeof ie!="function")throw new TypeError("sizeCalculation must be a function");if(fe=ie(V,P),!i(fe))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return fe}),Te(this,X,(P,V,fe)=>{if(w[P]=V,B(this,U)){let ie=B(this,U)-w[P];for(;B(this,R)>ie;)Ie(this,Q,Or).call(this,!0)}Te(this,R,B(this,R)+w[P]),fe&&(fe.entrySize=V,fe.totalCalculatedSize=B(this,R))})},le=new WeakMap,X=new WeakMap,J=new WeakMap,he=new WeakSet,Ut=function*({allowStale:w=this.allowStale}={}){if(B(this,F))for(let P=B(this,q);!(!Ie(this,N,bn).call(this,P)||((w||!B(this,x).call(this,P))&&(yield P),P===B(this,E)));)P=B(this,ee)[P]},C=new WeakSet,Lt=function*({allowStale:w=this.allowStale}={}){if(B(this,F))for(let P=B(this,E);!(!Ie(this,N,bn).call(this,P)||((w||!B(this,x).call(this,P))&&(yield P),P===B(this,q)));)P=B(this,G)[P]},N=new WeakSet,bn=function(w){return w!==void 0&&B(this,O).get(B(this,M)[w])===w},Q=new WeakSet,Or=function(w){var ie,ye;let P=B(this,E),V=B(this,M)[P],fe=B(this,W)[P];return B(this,re)&&Ie(this,_e,Ue).call(this,fe)?fe.__abortController.abort(new Error("evicted")):(B(this,be)||B(this,ve))&&(B(this,be)&&((ie=B(this,k))==null||ie.call(this,fe,V,"evict")),B(this,ve)&&((ye=B(this,K))==null||ye.push([fe,V,"evict"]))),B(this,le).call(this,P),w&&(B(this,M)[P]=void 0,B(this,W)[P]=void 0,B(this,Z).push(P)),B(this,F)===1?(Te(this,E,Te(this,q,0)),B(this,Z).length=0):Te(this,E,B(this,G)[P]),B(this,O).delete(V),wr(this,F)._--,P},H=new WeakSet,Cr=function(w,P,V,fe){let ie=P===void 0?void 0:B(this,W)[P];if(Ie(this,_e,Ue).call(this,ie))return ie;let ye=new s,{signal:Se}=V;Se==null||Se.addEventListener("abort",()=>ye.abort(Se.reason),{signal:ye.signal});let ke={signal:ye.signal,options:V,context:fe},$e=(qe,Je=!1)=>{let{aborted:Oe}=ye.signal,Fe=V.ignoreFetchAbort&&qe!==void 0;if(V.status&&(Oe&&!Je?(V.status.fetchAborted=!0,V.status.fetchError=ye.signal.reason,Fe&&(V.status.fetchAbortIgnored=!0)):V.status.fetchResolved=!0),Oe&&!Fe&&!Je)return xe(ye.signal.reason);let it=Ve;return B(this,W)[P]===Ve&&(qe===void 0?it.__staleWhileFetching?B(this,W)[P]=it.__staleWhileFetching:this.delete(w):(V.status&&(V.status.fetchUpdated=!0),this.set(w,qe,ke.options))),qe},tt=qe=>(V.status&&(V.status.fetchRejected=!0,V.status.fetchError=qe),xe(qe)),xe=qe=>{let{aborted:Je}=ye.signal,Oe=Je&&V.allowStaleOnFetchAbort,Fe=Oe||V.allowStaleOnFetchRejection,it=Fe||V.noDeleteOnFetchRejection,Qe=Ve;if(B(this,W)[P]===Ve&&(!it||Qe.__staleWhileFetching===void 0?this.delete(w):Oe||(B(this,W)[P]=Qe.__staleWhileFetching)),Fe)return V.status&&Qe.__staleWhileFetching!==void 0&&(V.status.returnedStale=!0),Qe.__staleWhileFetching;if(Qe.__returned===Qe)throw qe},rt=(qe,Je)=>{var Fe;let Oe=(Fe=B(this,D))==null?void 0:Fe.call(this,w,ie,ke);Oe&&Oe instanceof Promise&&Oe.then(it=>qe(it===void 0?void 0:it),Je),ye.signal.addEventListener("abort",()=>{(!V.ignoreFetchAbort||V.allowStaleOnFetchAbort)&&(qe(void 0),V.allowStaleOnFetchAbort&&(qe=it=>$e(it,!0)))})};V.status&&(V.status.fetchDispatched=!0);let Ve=new Promise(rt).then($e,tt),He=Object.assign(Ve,{__abortController:ye,__staleWhileFetching:ie,__returned:void 0});return P===void 0?(this.set(w,He,{...ke.options,status:void 0}),P=B(this,O).get(w)):B(this,W)[P]=He,He},_e=new WeakSet,Ue=function(w){if(!B(this,re))return!1;let P=w;return!!P&&P instanceof Promise&&P.hasOwnProperty("__staleWhileFetching")&&P.__abortController instanceof s},Re=new WeakSet,mn=function(w,P){B(this,ee)[P]=w,B(this,G)[w]=P},u=new WeakSet,gr=function(w){w!==B(this,q)&&(w===B(this,E)?Te(this,E,B(this,G)[w]):Ie(this,Re,mn).call(this,B(this,ee)[w],B(this,G)[w]),Ie(this,Re,mn).call(this,B(this,q),w),Te(this,q,w))},v);e.LRUCache=g}),Pt=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.ContainerIterator=e.Container=e.Base=void 0;var n=class{constructor(h=0){this.iteratorType=h}equals(h){return this.o===h.o}};e.ContainerIterator=n;var t=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};e.Base=t;var l=class extends t{};e.Container=l}),wl=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=Pt(),t=class extends n.Base{constructor(h=[]){super(),this.S=[];let s=this;h.forEach(function(r){s.push(r)})}clear(){this.i=0,this.S=[]}push(h){return this.S.push(h),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},l=t;e.default=l}),vl=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=Pt(),t=class extends n.Base{constructor(h=[]){super(),this.j=0,this.q=[];let s=this;h.forEach(function(r){s.push(r)})}clear(){this.q=[],this.i=this.j=0}push(h){let s=this.q.length;if(this.j/s>.5&&this.j+this.i>=s&&s>4096){let r=this.i;for(let o=0;o{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=Pt(),t=class extends n.Base{constructor(h=[],s=function(o,i){return o>i?-1:o>1;for(let i=this.i-1>>1;i>=0;--i)this.k(i,o)}m(h){let s=this.C[h];for(;h>0;){let r=h-1>>1,o=this.C[r];if(this.v(o,s)<=0)break;this.C[h]=o,h=r}this.C[h]=s}k(h,s){let r=this.C[h];for(;h0&&(o=i,a=this.C[i]),this.v(a,r)>=0)break;this.C[h]=a,h=o}this.C[h]=r}clear(){this.i=0,this.C.length=0}push(h){this.C.push(h),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let h=this.C[0],s=this.C.pop();return this.i-=1,this.i&&(this.C[0]=s,this.k(0,this.i>>1)),h}top(){return this.C[0]}find(h){return this.C.indexOf(h)>=0}remove(h){let s=this.C.indexOf(h);return s<0?!1:(s===0?this.pop():s===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(s,1,this.C.pop()),this.i-=1,this.m(s),this.k(s,this.i>>1)),!0)}updateItem(h){let s=this.C.indexOf(h);return s<0?!1:(this.m(s),this.k(s,this.i>>1),!0)}toArray(){return[...this.C]}},l=t;e.default=l}),Un=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=Pt(),t=class extends n.Container{},l=t;e.default=l}),Bt=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.throwIteratorAccessError=n;function n(){throw new RangeError("Iterator access denied!")}}),vs=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.RandomIterator=void 0;var n=Pt(),t=Bt(),l=class extends n.ContainerIterator{constructor(h,s){super(s),this.o=h,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,t.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,t.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,t.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,t.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(h){this.container.setElementByPos(this.o,h)}};e.RandomIterator=l}),El=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=l(Un()),t=vs();function l(o){return o&&o.t?o:{default:o}}var h=class _s extends t.RandomIterator{constructor(i,a,c){super(i,c),this.container=a}copy(){return new _s(this.o,this.container,this.iteratorType)}},s=class extends n.default{constructor(o=[],i=!0){if(super(),Array.isArray(o))this.J=i?[...o]:o,this.i=o.length;else{this.J=[];let a=this;o.forEach(function(c){a.pushBack(c)})}}clear(){this.i=0,this.J.length=0}begin(){return new h(0,this)}end(){return new h(this.i,this)}rBegin(){return new h(this.i-1,this,1)}rEnd(){return new h(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(o){if(o<0||o>this.i-1)throw new RangeError;return this.J[o]}eraseElementByPos(o){if(o<0||o>this.i-1)throw new RangeError;return this.J.splice(o,1),this.i-=1,this.i}eraseElementByValue(o){let i=0;for(let a=0;athis.i-1)throw new RangeError;this.J[o]=i}insert(o,i,a=1){if(o<0||o>this.i)throw new RangeError;return this.J.splice(o,0,...new Array(a).fill(i)),this.i+=a,this.i}find(o){for(let i=0;i{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=h(Un()),t=Pt(),l=Bt();function h(i){return i&&i.t?i:{default:i}}var s=class Es extends t.ContainerIterator{constructor(a,c,p,g){super(g),this.o=a,this.h=c,this.container=p,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o.l}set pointer(a){this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o.l=a}copy(){return new Es(this.o,this.h,this.container,this.iteratorType)}},r=class extends n.default{constructor(i=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let a=this;i.forEach(function(c){a.pushBack(c)})}V(i){let{L:a,B:c}=i;a.B=c,c.L=a,i===this.p&&(this.p=c),i===this._&&(this._=a),this.i-=1}G(i,a){let c=a.B,p={l:i,L:a,B:c};a.B=p,c.L=p,a===this.h&&(this.p=p),c===this.h&&(this._=p),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new s(this.p,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this._,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(i){if(i<0||i>this.i-1)throw new RangeError;let a=this.p;for(;i--;)a=a.B;return a.l}eraseElementByPos(i){if(i<0||i>this.i-1)throw new RangeError;let a=this.p;for(;i--;)a=a.B;return this.V(a),this.i}eraseElementByValue(i){let a=this.p;for(;a!==this.h;)a.l===i&&this.V(a),a=a.B;return this.i}eraseElementByIterator(i){let a=i.o;return a===this.h&&(0,l.throwIteratorAccessError)(),i=i.next(),this.V(a),i}pushBack(i){return this.G(i,this._),this.i}popBack(){if(this.i===0)return;let i=this._.l;return this.V(this._),i}pushFront(i){return this.G(i,this.h),this.i}popFront(){if(this.i===0)return;let i=this.p.l;return this.V(this.p),i}setElementByPos(i,a){if(i<0||i>this.i-1)throw new RangeError;let c=this.p;for(;i--;)c=c.B;c.l=a}insert(i,a,c=1){if(i<0||i>this.i)throw new RangeError;if(c<=0)return this.i;if(i===0)for(;c--;)this.pushFront(a);else if(i===this.i)for(;c--;)this.pushBack(a);else{let p=this.p;for(let b=1;b{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=l(Un()),t=vs();function l(o){return o&&o.t?o:{default:o}}var h=class Ss extends t.RandomIterator{constructor(i,a,c){super(i,c),this.container=a}copy(){return new Ss(this.o,this.container,this.iteratorType)}},s=class extends n.default{constructor(o=[],i=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let a=(()=>{if(typeof o.length=="number")return o.length;if(typeof o.size=="number")return o.size;if(typeof o.size=="function")return o.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=i,this.P=Math.max(Math.ceil(a/this.F),1);for(let g=0;g>1)-(c>>1),this.D=this.N=this.F-a%this.F>>1;let p=this;o.forEach(function(g){p.pushBack(g)})}T(){let o=[],i=Math.max(this.P>>1,1);for(let a=0;a>1}begin(){return new h(0,this)}end(){return new h(this.i,this)}rBegin(){return new h(this.i-1,this,1)}rEnd(){return new h(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(o){return this.i&&(this.N0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,o}pushFront(o){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=o,this.i}popFront(){if(this.i===0)return;let o=this.A[this.j][this.D];return this.i!==1&&(this.Dthis.i-1)throw new RangeError;let{curNodeBucketIndex:i,curNodePointerIndex:a}=this.O(o);return this.A[i][a]}setElementByPos(o,i){if(o<0||o>this.i-1)throw new RangeError;let{curNodeBucketIndex:a,curNodePointerIndex:c}=this.O(o);this.A[a][c]=i}insert(o,i,a=1){if(o<0||o>this.i)throw new RangeError;if(o===0)for(;a--;)this.pushFront(i);else if(o===this.i)for(;a--;)this.pushBack(i);else{let c=[];for(let p=o;pthis.i-1)throw new RangeError;if(o===0)this.popFront();else if(o===this.i-1)this.popBack();else{let i=[];for(let c=o+1;co;)this.popBack();return this.i}sort(o){let i=[];for(let a=0;a{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.TreeNodeEnableIndex=e.TreeNode=void 0;var n=class{constructor(l,h){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=l,this.l=h}L(){let l=this;if(l.ee===1&&l.tt.tt===l)l=l.W;else if(l.U)for(l=l.U;l.W;)l=l.W;else{let h=l.tt;for(;h.U===l;)l=h,h=l.tt;l=h}return l}B(){let l=this;if(l.W){for(l=l.W;l.U;)l=l.U;return l}else{let h=l.tt;for(;h.W===l;)l=h,h=l.tt;return l.W!==h?h:l}}te(){let l=this.tt,h=this.W,s=h.U;return l.tt===this?l.tt=h:l.U===this?l.U=h:l.W=h,h.tt=l,h.U=this,this.tt=h,this.W=s,s&&(s.tt=this),h}se(){let l=this.tt,h=this.U,s=h.W;return l.tt===this?l.tt=h:l.U===this?l.U=h:l.W=h,h.tt=l,h.W=this,this.tt=h,this.U=s,s&&(s.tt=this),h}};e.TreeNode=n;var t=class extends n{constructor(){super(...arguments),this.rt=1}te(){let l=super.te();return this.ie(),l.ie(),l}se(){let l=super.se();return this.ie(),l.ie(),l}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};e.TreeNodeEnableIndex=t}),As=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=Il(),t=Pt(),l=Bt(),h=class extends t.Container{constructor(r=function(i,a){return ia?1:0},o=!1){super(),this.Y=void 0,this.v=r,o?(this.re=n.TreeNodeEnableIndex,this.M=function(i,a,c){let p=this.ne(i,a,c);if(p){let g=p.tt;for(;g!==this.h;)g.rt+=1,g=g.tt;let b=this.he(p);if(b){let{parentNode:m,grandParent:y,curNode:I}=b;m.ie(),y.ie(),I.ie()}}return this.i},this.V=function(i){let a=this.fe(i);for(;a!==this.h;)a.rt-=1,a=a.tt}):(this.re=n.TreeNode,this.M=function(i,a,c){let p=this.ne(i,a,c);return p&&this.he(p),this.i},this.V=this.fe),this.h=new this.re}X(r,o){let i=this.h;for(;r;){let a=this.v(r.u,o);if(a<0)r=r.W;else if(a>0)i=r,r=r.U;else return r}return i}Z(r,o){let i=this.h;for(;r;)this.v(r.u,o)<=0?r=r.W:(i=r,r=r.U);return i}$(r,o){let i=this.h;for(;r;){let a=this.v(r.u,o);if(a<0)i=r,r=r.W;else if(a>0)r=r.U;else return r}return i}rr(r,o){let i=this.h;for(;r;)this.v(r.u,o)<0?(i=r,r=r.W):r=r.U;return i}ue(r){for(;;){let o=r.tt;if(o===this.h)return;if(r.ee===1){r.ee=0;return}if(r===o.U){let i=o.W;if(i.ee===1)i.ee=0,o.ee=1,o===this.Y?this.Y=o.te():o.te();else if(i.W&&i.W.ee===1){i.ee=o.ee,o.ee=0,i.W.ee=0,o===this.Y?this.Y=o.te():o.te();return}else i.U&&i.U.ee===1?(i.ee=1,i.U.ee=0,i.se()):(i.ee=1,r=o)}else{let i=o.U;if(i.ee===1)i.ee=0,o.ee=1,o===this.Y?this.Y=o.se():o.se();else if(i.U&&i.U.ee===1){i.ee=o.ee,o.ee=0,i.U.ee=0,o===this.Y?this.Y=o.se():o.se();return}else i.W&&i.W.ee===1?(i.ee=1,i.W.ee=0,i.te()):(i.ee=1,r=o)}}}fe(r){if(this.i===1)return this.clear(),this.h;let o=r;for(;o.U||o.W;){if(o.W)for(o=o.W;o.U;)o=o.U;else o=o.U;[r.u,o.u]=[o.u,r.u],[r.l,o.l]=[o.l,r.l],r=o}this.h.U===o?this.h.U=o.tt:this.h.W===o&&(this.h.W=o.tt),this.ue(o);let i=o.tt;return o===i.U?i.U=void 0:i.W=void 0,this.i-=1,this.Y.ee=0,i}oe(r,o){return r===void 0?!1:this.oe(r.U,o)||o(r)?!0:this.oe(r.W,o)}he(r){for(;;){let o=r.tt;if(o.ee===0)return;let i=o.tt;if(o===i.U){let a=i.W;if(a&&a.ee===1){if(a.ee=o.ee=0,i===this.Y)return;i.ee=1,r=i;continue}else if(r===o.W){if(r.ee=0,r.U&&(r.U.tt=o),r.W&&(r.W.tt=i),o.W=r.U,i.U=r.W,r.U=o,r.W=i,i===this.Y)this.Y=r,this.h.tt=r;else{let c=i.tt;c.U===i?c.U=r:c.W=r}return r.tt=i.tt,o.tt=r,i.tt=r,i.ee=1,{parentNode:o,grandParent:i,curNode:r}}else o.ee=0,i===this.Y?this.Y=i.se():i.se(),i.ee=1}else{let a=i.U;if(a&&a.ee===1){if(a.ee=o.ee=0,i===this.Y)return;i.ee=1,r=i;continue}else if(r===o.U){if(r.ee=0,r.U&&(r.U.tt=i),r.W&&(r.W.tt=o),i.W=r.U,o.U=r.W,r.U=i,r.W=o,i===this.Y)this.Y=r,this.h.tt=r;else{let c=i.tt;c.U===i?c.U=r:c.W=r}return r.tt=i.tt,o.tt=r,i.tt=r,i.ee=1,{parentNode:o,grandParent:i,curNode:r}}else o.ee=0,i===this.Y?this.Y=i.te():i.te(),i.ee=1}return}}ne(r,o,i){if(this.Y===void 0){this.i+=1,this.Y=new this.re(r,o),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let a,c=this.h.U,p=this.v(c.u,r);if(p===0){c.l=o;return}else if(p>0)c.U=new this.re(r,o),c.U.tt=c,a=c.U,this.h.U=a;else{let g=this.h.W,b=this.v(g.u,r);if(b===0){g.l=o;return}else if(b<0)g.W=new this.re(r,o),g.W.tt=g,a=g.W,this.h.W=a;else{if(i!==void 0){let m=i.o;if(m!==this.h){let y=this.v(m.u,r);if(y===0){m.l=o;return}else if(y>0){let I=m.L(),U=this.v(I.u,r);if(U===0){I.l=o;return}else U<0&&(a=new this.re(r,o),I.W===void 0?(I.W=a,a.tt=I):(m.U=a,a.tt=m))}}}if(a===void 0)for(a=this.Y;;){let m=this.v(a.u,r);if(m>0){if(a.U===void 0){a.U=new this.re(r,o),a.U.tt=a,a=a.U;break}a=a.U}else if(m<0){if(a.W===void 0){a.W=new this.re(r,o),a.W.tt=a,a=a.W;break}a=a.W}else{a.l=o;return}}}}return this.i+=1,a}I(r,o){for(;r;){let i=this.v(r.u,o);if(i<0)r=r.W;else if(i>0)r=r.U;else return r}return r||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(r,o){let i=r.o;if(i===this.h&&(0,l.throwIteratorAccessError)(),this.i===1)return i.u=o,!0;if(i===this.h.U)return this.v(i.B().u,o)>0?(i.u=o,!0):!1;if(i===this.h.W)return this.v(i.L().u,o)<0?(i.u=o,!0):!1;let a=i.L().u;if(this.v(a,o)>=0)return!1;let c=i.B().u;return this.v(c,o)<=0?!1:(i.u=o,!0)}eraseElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let o=0,i=this;return this.oe(this.Y,function(a){return r===o?(i.V(a),!0):(o+=1,!1)}),this.i}eraseElementByKey(r){if(this.i===0)return!1;let o=this.I(this.Y,r);return o===this.h?!1:(this.V(o),!0)}eraseElementByIterator(r){let o=r.o;o===this.h&&(0,l.throwIteratorAccessError)();let i=o.W===void 0;return r.iteratorType===0?i&&r.next():(!i||o.U===void 0)&&r.next(),this.V(o),r}forEach(r){let o=0;for(let i of this)r(i,o++,this)}getElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let o,i=0;for(let a of this){if(i===r){o=a;break}i+=1}return o}getHeight(){if(this.i===0)return 0;let r=function(o){return o?Math.max(r(o.U),r(o.W))+1:0};return r(this.Y)}},s=h;e.default=s}),Is=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=Pt(),t=Bt(),l=class extends n.ContainerIterator{constructor(s,r,o){super(o),this.o=s,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,t.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,t.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,t.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,t.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let s=this.o,r=this.h.tt;if(s===this.h)return r?r.rt-1:0;let o=0;for(s.U&&(o+=s.U.rt);s!==r;){let i=s.tt;s===i.W&&(o+=1,i.U&&(o+=i.U.rt)),s=i}return o}},h=l;e.default=h}),Tl=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=h(As()),t=h(Is()),l=Bt();function h(i){return i&&i.t?i:{default:i}}var s=class Ts extends t.default{constructor(a,c,p,g){super(a,c,g),this.container=p}get pointer(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o.u}copy(){return new Ts(this.o,this.h,this.container,this.iteratorType)}},r=class extends n.default{constructor(i=[],a,c){super(a,c);let p=this;i.forEach(function(g){p.insert(g)})}*K(i){i!==void 0&&(yield*this.K(i.U),yield i.u,yield*this.K(i.W))}begin(){return new s(this.h.U||this.h,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this.h.W||this.h,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(i,a){return this.M(i,void 0,a)}find(i){let a=this.I(this.Y,i);return new s(a,this.h,this)}lowerBound(i){let a=this.X(this.Y,i);return new s(a,this.h,this)}upperBound(i){let a=this.Z(this.Y,i);return new s(a,this.h,this)}reverseLowerBound(i){let a=this.$(this.Y,i);return new s(a,this.h,this)}reverseUpperBound(i){let a=this.rr(this.Y,i);return new s(a,this.h,this)}union(i){let a=this;return i.forEach(function(c){a.insert(c)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},o=r;e.default=o}),kl=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=h(As()),t=h(Is()),l=Bt();function h(i){return i&&i.t?i:{default:i}}var s=class ks extends t.default{constructor(a,c,p,g){super(a,c,g),this.container=p}get pointer(){this.o===this.h&&(0,l.throwIteratorAccessError)();let a=this;return new Proxy([],{get(c,p){if(p==="0")return a.o.u;if(p==="1")return a.o.l},set(c,p,g){if(p!=="1")throw new TypeError("props must be 1");return a.o.l=g,!0}})}copy(){return new ks(this.o,this.h,this.container,this.iteratorType)}},r=class extends n.default{constructor(i=[],a,c){super(a,c);let p=this;i.forEach(function(g){p.setElement(g[0],g[1])})}*K(i){i!==void 0&&(yield*this.K(i.U),yield[i.u,i.l],yield*this.K(i.W))}begin(){return new s(this.h.U||this.h,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this.h.W||this.h,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){if(this.i===0)return;let i=this.h.U;return[i.u,i.l]}back(){if(this.i===0)return;let i=this.h.W;return[i.u,i.l]}lowerBound(i){let a=this.X(this.Y,i);return new s(a,this.h,this)}upperBound(i){let a=this.Z(this.Y,i);return new s(a,this.h,this)}reverseLowerBound(i){let a=this.$(this.Y,i);return new s(a,this.h,this)}reverseUpperBound(i){let a=this.rr(this.Y,i);return new s(a,this.h,this)}setElement(i,a,c){return this.M(i,a,c)}find(i){let a=this.I(this.Y,i);return new s(a,this.h,this)}getElementByKey(i){return this.I(this.Y,i).l}union(i){let a=this;return i.forEach(function(c){a.setElement(c[0],c[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},o=r;e.default=o}),Os=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=n;function n(t){let l=typeof t;return l==="object"&&t!==null||l==="function"}}),Cs=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.HashContainerIterator=e.HashContainer=void 0;var n=Pt(),t=h(Os()),l=Bt();function h(o){return o&&o.t?o:{default:o}}var s=class extends n.ContainerIterator{constructor(o,i,a){super(a),this.o=o,this.h=i,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.L,this})}};e.HashContainerIterator=s;var r=class extends n.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(o){let{L:i,B:a}=o;i.B=a,a.L=i,o===this.p&&(this.p=a),o===this._&&(this._=i),this.i-=1}M(o,i,a){a===void 0&&(a=(0,t.default)(o));let c;if(a){let p=o[this.HASH_TAG];if(p!==void 0)return this.H[p].l=i,this.i;Object.defineProperty(o,this.HASH_TAG,{value:this.H.length,configurable:!0}),c={u:o,l:i,L:this._,B:this.h},this.H.push(c)}else{let p=this.g[o];if(p)return p.l=i,this.i;c={u:o,l:i,L:this._,B:this.h},this.g[o]=c}return this.i===0?(this.p=c,this.h.B=c):this._.B=c,this._=c,this.h.L=c,++this.i}I(o,i){if(i===void 0&&(i=(0,t.default)(o)),i){let a=o[this.HASH_TAG];return a===void 0?this.h:this.H[a]}else return this.g[o]||this.h}clear(){let o=this.HASH_TAG;this.H.forEach(function(i){delete i.u[o]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(o,i){let a;if(i===void 0&&(i=(0,t.default)(o)),i){let c=o[this.HASH_TAG];if(c===void 0)return!1;delete o[this.HASH_TAG],a=this.H[c],delete this.H[c]}else{if(a=this.g[o],a===void 0)return!1;delete this.g[o]}return this.V(a),!0}eraseElementByIterator(o){let i=o.o;return i===this.h&&(0,l.throwIteratorAccessError)(),this.V(i),o.next()}eraseElementByPos(o){if(o<0||o>this.i-1)throw new RangeError;let i=this.p;for(;o--;)i=i.B;return this.V(i),this.i}};e.HashContainer=r}),Ol=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=Cs(),t=Bt(),l=class Rs extends n.HashContainerIterator{constructor(o,i,a,c){super(o,i,c),this.container=a}get pointer(){return this.o===this.h&&(0,t.throwIteratorAccessError)(),this.o.u}copy(){return new Rs(this.o,this.h,this.container,this.iteratorType)}},h=class extends n.HashContainer{constructor(r=[]){super();let o=this;r.forEach(function(i){o.insert(i)})}begin(){return new l(this.p,this.h,this)}end(){return new l(this.h,this.h,this)}rBegin(){return new l(this._,this.h,this,1)}rEnd(){return new l(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(r,o){return this.M(r,void 0,o)}getElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let o=this.p;for(;r--;)o=o.B;return o.u}find(r,o){let i=this.I(r,o);return new l(i,this.h,this)}forEach(r){let o=0,i=this.p;for(;i!==this.h;)r(i.u,o++,this),i=i.B}[Symbol.iterator](){return(function*(){let r=this.p;for(;r!==this.h;)yield r.u,r=r.B}).bind(this)()}},s=h;e.default=s}),Cl=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),e.default=void 0;var n=Cs(),t=h(Os()),l=Bt();function h(i){return i&&i.t?i:{default:i}}var s=class Ps extends n.HashContainerIterator{constructor(a,c,p,g){super(a,c,g),this.container=p}get pointer(){this.o===this.h&&(0,l.throwIteratorAccessError)();let a=this;return new Proxy([],{get(c,p){if(p==="0")return a.o.u;if(p==="1")return a.o.l},set(c,p,g){if(p!=="1")throw new TypeError("props must be 1");return a.o.l=g,!0}})}copy(){return new Ps(this.o,this.h,this.container,this.iteratorType)}},r=class extends n.HashContainer{constructor(i=[]){super();let a=this;i.forEach(function(c){a.setElement(c[0],c[1])})}begin(){return new s(this.p,this.h,this)}end(){return new s(this.h,this.h,this)}rBegin(){return new s(this._,this.h,this,1)}rEnd(){return new s(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(i,a,c){return this.M(i,a,c)}getElementByKey(i,a){if(a===void 0&&(a=(0,t.default)(i)),a){let p=i[this.HASH_TAG];return p!==void 0?this.H[p].l:void 0}let c=this.g[i];return c?c.l:void 0}getElementByPos(i){if(i<0||i>this.i-1)throw new RangeError;let a=this.p;for(;i--;)a=a.B;return[a.u,a.l]}find(i,a){let c=this.I(i,a);return new s(c,this.h,this)}forEach(i){let a=0,c=this.p;for(;c!==this.h;)i([c.u,c.l],a++,this),c=c.B}[Symbol.iterator](){return(function*(){let i=this.p;for(;i!==this.h;)yield[i.u,i.l],i=i.B}).bind(this)()}},o=r;e.default=o}),Rl=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"t",{value:!0}),Object.defineProperty(e,"Deque",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"HashMap",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"HashSet",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"LinkList",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"OrderedMap",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"OrderedSet",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"PriorityQueue",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(e,"Queue",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(e,"Stack",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(e,"Vector",{enumerable:!0,get:function(){return h.default}});var n=p(wl()),t=p(vl()),l=p(_l()),h=p(El()),s=p(Sl()),r=p(Al()),o=p(Tl()),i=p(kl()),a=p(Ol()),c=p(Cl());function p(g){return g&&g.t?g:{default:g}}}),Pl=me((e,n)=>{ae(),se(),oe();var t=Rl().OrderedSet,l=Ct()("number-allocator:trace"),h=Ct()("number-allocator:error");function s(o,i){this.low=o,this.high=i}s.prototype.equals=function(o){return this.low===o.low&&this.high===o.high},s.prototype.compare=function(o){return this.lowa.compare(c)),l("Create"),this.clear()}r.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},r.prototype.alloc=function(){if(this.ss.size()===0)return l("alloc():empty"),null;let o=this.ss.begin(),i=o.pointer.low,a=o.pointer.high,c=i;return c+1<=a?this.ss.updateKeyByIterator(o,new s(i+1,a)):this.ss.eraseElementByPos(0),l("alloc():"+c),c},r.prototype.use=function(o){let i=new s(o,o),a=this.ss.lowerBound(i);if(!a.equals(this.ss.end())){let c=a.pointer.low,p=a.pointer.high;return a.pointer.equals(i)?(this.ss.eraseElementByIterator(a),l("use():"+o),!0):c>o?!1:c===o?(this.ss.updateKeyByIterator(a,new s(c+1,p)),l("use():"+o),!0):p===o?(this.ss.updateKeyByIterator(a,new s(c,p-1)),l("use():"+o),!0):(this.ss.updateKeyByIterator(a,new s(o+1,p)),this.ss.insert(new s(c,o-1)),l("use():"+o),!0)}return l("use():failed"),!1},r.prototype.free=function(o){if(othis.max){h("free():"+o+" is out of range");return}let i=new s(o,o),a=this.ss.upperBound(i);if(a.equals(this.ss.end())){if(a.equals(this.ss.begin())){this.ss.insert(i);return}a.pre();let c=a.pointer.high;a.pointer.high+1===o?this.ss.updateKeyByIterator(a,new s(c,o)):this.ss.insert(i)}else if(a.equals(this.ss.begin()))if(o+1===a.pointer.low){let c=a.pointer.high;this.ss.updateKeyByIterator(a,new s(o,c))}else this.ss.insert(i);else{let c=a.pointer.low,p=a.pointer.high;a.pre();let g=a.pointer.low;a.pointer.high+1===o?o+1===c?(this.ss.eraseElementByIterator(a),this.ss.updateKeyByIterator(a,new s(g,p))):this.ss.updateKeyByIterator(a,new s(g,o)):o+1===c?(this.ss.eraseElementByIterator(a.next()),this.ss.insert(new s(o,p))):this.ss.insert(i)}l("free():"+o)},r.prototype.clear=function(){l("clear()"),this.ss.clear(),this.ss.insert(new s(this.min,this.max))},r.prototype.intervalCount=function(){return this.ss.size()},r.prototype.dump=function(){console.log("length:"+this.ss.size());for(let o of this.ss)console.log(o)},n.exports=r}),Bs=me((e,n)=>{ae(),se(),oe();var t=Pl();n.exports.NumberAllocator=t}),Bl=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0});var n=yl(),t=Bs(),l=class{constructor(h){h>0&&(this.aliasToTopic=new n.LRUCache({max:h}),this.topicToAlias={},this.numberAllocator=new t.NumberAllocator(1,h),this.max=h,this.length=0)}put(h,s){if(s===0||s>this.max)return!1;let r=this.aliasToTopic.get(s);return r&&delete this.topicToAlias[r],this.aliasToTopic.set(s,h),this.topicToAlias[h]=s,this.numberAllocator.use(s),this.length=this.aliasToTopic.size,!0}getTopicByAlias(h){return this.aliasToTopic.get(h)}getAliasByTopic(h){let s=this.topicToAlias[h];return typeof s<"u"&&this.aliasToTopic.get(s),s}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){return this.numberAllocator.firstVacant()||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};e.default=l}),xl=me(e=>{ae(),se(),oe();var n=e&&e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(e,"__esModule",{value:!0});var t=Wr(),l=n(Bl()),h=yr(),s=(r,o)=>{r.log("_handleConnack");let{options:i}=r,a=i.protocolVersion===5?o.reasonCode:o.returnCode;if(clearTimeout(r.connackTimer),delete r.topicAliasSend,o.properties){if(o.properties.topicAliasMaximum){if(o.properties.topicAliasMaximum>65535){r.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}o.properties.topicAliasMaximum>0&&(r.topicAliasSend=new l.default(o.properties.topicAliasMaximum))}o.properties.serverKeepAlive&&i.keepalive&&(i.keepalive=o.properties.serverKeepAlive,r._shiftPingInterval()),o.properties.maximumPacketSize&&(i.properties||(i.properties={}),i.properties.maximumPacketSize=o.properties.maximumPacketSize)}if(a===0)r.reconnecting=!1,r._onConnect(o);else if(a>0){let c=new h.ErrorWithReasonCode(`Connection refused: ${t.ReasonCodes[a]}`,a);r.emit("error",c)}};e.default=s}),Ml=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0});var n=(t,l,h)=>{t.log("handling pubrel packet");let s=typeof h<"u"?h:t.noop,{messageId:r}=l,o={cmd:"pubcomp",messageId:r};t.incomingStore.get(l,(i,a)=>{i?t._sendPacket(o,s):(t.emit("message",a.topic,a.payload,a),t.handleMessage(a,c=>{if(c)return s(c);t.incomingStore.del(a,t.noop),t._sendPacket(o,s)}))})};e.default=n}),Ul=me(e=>{ae(),se(),oe();var n=e&&e.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(e,"__esModule",{value:!0});var t=n(bl()),l=n(ml()),h=n(xl()),s=n(Wr()),r=n(Ml()),o=(i,a,c)=>{let{options:p}=i;if(p.protocolVersion===5&&p.properties&&p.properties.maximumPacketSize&&p.properties.maximumPacketSize{ae(),se(),oe();var n=e&&e.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(e,"__esModule",{value:!0}),e.TypedEventEmitter=void 0;var t=n((lr(),Me(tr))),l=yr(),h=class{};e.TypedEventEmitter=h,(0,l.applyMixin)(h,t.default)}),$r=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0}),e.isWebWorker=void 0;var n=()=>typeof window<"u"&&typeof window.document<"u",t=()=>{var s,r;return!!(typeof self=="object"&&!((r=(s=self==null?void 0:self.constructor)===null||s===void 0?void 0:s.name)===null||r===void 0)&&r.includes("WorkerGlobalScope"))},l=()=>typeof at<"u"&&at.product==="ReactNative",h=n()||t()||l();e.isWebWorker=t(),e.default=h}),Nl=me((e,n)=>{ae(),se(),oe(),function(t,l){typeof e=="object"&&typeof n<"u"?l(e):typeof define=="function"&&define.amd?define(["exports"],l):(t=typeof globalThis<"u"?globalThis:t||self,l(t.fastUniqueNumbers={}))}(e,function(t){var l=function(b){return function(m){var y=b(m);return m.add(y),y}},h=function(b){return function(m,y){return b.set(m,y),y}},s=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,r=536870912,o=r*2,i=function(b,m){return function(y){var I=m.get(y),U=I===void 0?y.size:Is)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;y.has(U);)U=Math.floor(Math.random()*s);return b(y,U)}},a=new WeakMap,c=h(a),p=i(c,a),g=l(p);t.addUniqueNumber=g,t.generateUniqueNumber=p})}),jl=me((e,n)=>{ae(),se(),oe(),function(t,l){typeof e=="object"&&typeof n<"u"?l(e,Nl()):typeof define=="function"&&define.amd?define(["exports","fast-unique-numbers"],l):(t=typeof globalThis<"u"?globalThis:t||self,l(t.workerTimersBroker={},t.fastUniqueNumbers))}(e,function(t,l){var h=function(o){return o.method!==void 0&&o.method==="call"},s=function(o){return o.error===null&&typeof o.id=="number"},r=function(o){var i=new Map([[0,function(){}]]),a=new Map([[0,function(){}]]),c=new Map,p=new Worker(o);p.addEventListener("message",function(I){var U=I.data;if(h(U)){var k=U.params,T=k.timerId,D=k.timerType;if(D==="interval"){var F=i.get(T);if(typeof F=="number"){var R=c.get(F);if(R===void 0||R.timerId!==T||R.timerType!==D)throw new Error("The timer is in an undefined state.")}else if(typeof F<"u")F();else throw new Error("The timer is in an undefined state.")}else if(D==="timeout"){var O=a.get(T);if(typeof O=="number"){var M=c.get(O);if(M===void 0||M.timerId!==T||M.timerType!==D)throw new Error("The timer is in an undefined state.")}else if(typeof O<"u")O(),a.delete(T);else throw new Error("The timer is in an undefined state.")}}else if(s(U)){var W=U.id,G=c.get(W);if(G===void 0)throw new Error("The timer is in an undefined state.");var ee=G.timerId,E=G.timerType;c.delete(W),E==="interval"?i.delete(ee):a.delete(ee)}else{var q=U.error.message;throw new Error(q)}});var g=function(I){var U=l.generateUniqueNumber(c);c.set(U,{timerId:I,timerType:"interval"}),i.set(I,U),p.postMessage({id:U,method:"clear",params:{timerId:I,timerType:"interval"}})},b=function(I){var U=l.generateUniqueNumber(c);c.set(U,{timerId:I,timerType:"timeout"}),a.set(I,U),p.postMessage({id:U,method:"clear",params:{timerId:I,timerType:"timeout"}})},m=function(I){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,k=l.generateUniqueNumber(i);return i.set(k,function(){I(),typeof i.get(k)=="function"&&p.postMessage({id:null,method:"set",params:{delay:U,now:performance.now(),timerId:k,timerType:"interval"}})}),p.postMessage({id:null,method:"set",params:{delay:U,now:performance.now(),timerId:k,timerType:"interval"}}),k},y=function(I){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,k=l.generateUniqueNumber(a);return a.set(k,I),p.postMessage({id:null,method:"set",params:{delay:U,now:performance.now(),timerId:k,timerType:"timeout"}}),k};return{clearInterval:g,clearTimeout:b,setInterval:m,setTimeout:y}};t.load=r})}),Dl=me((e,n)=>{ae(),se(),oe(),function(t,l){typeof e=="object"&&typeof n<"u"?l(e,jl()):typeof define=="function"&&define.amd?define(["exports","worker-timers-broker"],l):(t=typeof globalThis<"u"?globalThis:t||self,l(t.workerTimers={},t.workerTimersBroker))}(e,function(t,l){var h=function(p,g){var b=null;return function(){if(b!==null)return b;var m=new Blob([g],{type:"application/javascript; charset=utf-8"}),y=URL.createObjectURL(m);return b=p(y),setTimeout(function(){return URL.revokeObjectURL(y)}),b}},s=`(()=>{var e={472:(e,t,r)=>{var o,i;void 0===(i="function"==typeof(o=function(){"use strict";var e=new Map,t=new Map,r=function(t){var r=e.get(t);if(void 0===r)throw new Error('There is no interval scheduled with the given id "'.concat(t,'".'));clearTimeout(r),e.delete(t)},o=function(e){var r=t.get(e);if(void 0===r)throw new Error('There is no timeout scheduled with the given id "'.concat(e,'".'));clearTimeout(r),t.delete(e)},i=function(e,t){var r,o=performance.now();return{expected:o+(r=e-Math.max(0,o-t)),remainingDelay:r}},n=function e(t,r,o,i){var n=performance.now();n>o?postMessage({id:null,method:"call",params:{timerId:r,timerType:i}}):t.set(r,setTimeout(e,o-n,t,r,o,i))},a=function(t,r,o){var a=i(t,o),s=a.expected,d=a.remainingDelay;e.set(r,setTimeout(n,d,e,r,s,"interval"))},s=function(e,r,o){var a=i(e,o),s=a.expected,d=a.remainingDelay;t.set(r,setTimeout(n,d,t,r,s,"timeout"))};addEventListener("message",(function(e){var t=e.data;try{if("clear"===t.method){var i=t.id,n=t.params,d=n.timerId,c=n.timerType;if("interval"===c)r(d),postMessage({error:null,id:i});else{if("timeout"!==c)throw new Error('The given type "'.concat(c,'" is not supported'));o(d),postMessage({error:null,id:i})}}else{if("set"!==t.method)throw new Error('The given method "'.concat(t.method,'" is not supported'));var u=t.params,l=u.delay,p=u.now,m=u.timerId,v=u.timerType;if("interval"===v)a(l,m,p);else{if("timeout"!==v)throw new Error('The given type "'.concat(v,'" is not supported'));s(l,m,p)}}}catch(e){postMessage({error:{message:e.message},id:t.id,result:null})}}))})?o.call(t,r,t,e):o)||(e.exports=i)}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(472)})()})();`,r=h(l.load,s),o=function(p){return r().clearInterval(p)},i=function(p){return r().clearTimeout(p)},a=function(){var p;return(p=r()).setInterval.apply(p,arguments)},c=function(){var p;return(p=r()).setTimeout.apply(p,arguments)};t.clearInterval=o,t.clearTimeout=i,t.setInterval=a,t.setTimeout=c})}),Fl=me(e=>{ae(),se(),oe();var n=e&&e.__createBinding||(Object.create?function(o,i,a,c){c===void 0&&(c=a);var p=Object.getOwnPropertyDescriptor(i,a);(!p||("get"in p?!i.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(o,c,p)}:function(o,i,a,c){c===void 0&&(c=a),o[c]=i[a]}),t=e&&e.__setModuleDefault||(Object.create?function(o,i){Object.defineProperty(o,"default",{enumerable:!0,value:i})}:function(o,i){o.default=i}),l=e&&e.__importStar||function(o){if(o&&o.__esModule)return o;var i={};if(o!=null)for(var a in o)a!=="default"&&Object.prototype.hasOwnProperty.call(o,a)&&n(i,o,a);return t(i,o),i};Object.defineProperty(e,"__esModule",{value:!0});var h=l($r()),s=Dl(),r={set:h.default&&!h.isWebWorker?s.setTimeout:(o,i)=>setTimeout(o,i),clear:h.default&&!h.isWebWorker?s.clearTimeout:o=>clearTimeout(o)};e.default=r}),xs=me(e=>{ae(),se(),oe();var n=e&&e.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(e,"__esModule",{value:!0});var t=n(Fl()),l=class{constructor(h,s){this.keepalive=h*1e3,this.checkPing=s,this.reschedule()}clear(){this.timer&&(t.default.clear(this.timer),this.timer=null)}reschedule(){this.clear(),this.timer=t.default.set(()=>{this.checkPing(),this.timer&&this.reschedule()},this.keepalive)}};e.default=l}),yn=me(e=>{ae(),se(),oe();var n=e&&e.__createBinding||(Object.create?function(F,R,O,M){M===void 0&&(M=O);var W=Object.getOwnPropertyDescriptor(R,O);(!W||("get"in W?!R.__esModule:W.writable||W.configurable))&&(W={enumerable:!0,get:function(){return R[O]}}),Object.defineProperty(F,M,W)}:function(F,R,O,M){M===void 0&&(M=O),F[M]=R[O]}),t=e&&e.__setModuleDefault||(Object.create?function(F,R){Object.defineProperty(F,"default",{enumerable:!0,value:R})}:function(F,R){F.default=R}),l=e&&e.__importStar||function(F){if(F&&F.__esModule)return F;var R={};if(F!=null)for(var O in F)O!=="default"&&Object.prototype.hasOwnProperty.call(F,O)&&n(R,F,O);return t(R,F),R},h=e&&e.__importDefault||function(F){return F&&F.__esModule?F:{default:F}};Object.defineProperty(e,"__esModule",{value:!0});var s=h(Ra()),r=h(fl()),o=h(bs()),i=rr(),a=h(pl()),c=l(gl()),p=h(Ct()),g=h(ms()),b=h(Ul()),m=yr(),y=Ll(),I=h(xs()),U=l($r()),k=globalThis.setImmediate||((...F)=>{let R=F.shift();(0,m.nextTick)(()=>{R(...F)})}),T={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0},D=class Ms extends y.TypedEventEmitter{static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(R,O){super(),this.options=O||{};for(let M in T)typeof this.options[M]>"u"?this.options[M]=T[M]:this.options[M]=O[M];this.log=this.options.log||(0,p.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: version:","5.4.0"),U.isWebWorker?this.log("MqttClient :: environment","webworker"):this.log("MqttClient :: environment",U.default?"browser":"node"),this.log("MqttClient :: options.protocol",O.protocol),this.log("MqttClient :: options.protocolVersion",O.protocolVersion),this.log("MqttClient :: options.username",O.username),this.log("MqttClient :: options.keepalive",O.keepalive),this.log("MqttClient :: options.reconnectPeriod",O.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",O.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",O.properties?O.properties.topicAliasMaximum:void 0),this.options.clientId=typeof O.clientId=="string"?O.clientId:Ms.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=O.protocolVersion===5&&O.customHandleAcks?O.customHandleAcks:(...M)=>{M[3](null,0)},this.options.writeCache||(r.default.writeToStream.cacheNumbers=!1),this.streamBuilder=R,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new o.default:this.options.messageIdProvider,this.outgoingStore=O.outgoingStore||new g.default,this.incomingStore=O.incomingStore||new g.default,this.queueQoSZero=O.queueQoSZero===void 0?!0:O.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.reconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,O.properties&&O.properties.topicAliasMaximum>0&&(O.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new s.default(O.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:M}=this,W=()=>{let G=M.shift();this.log("deliver :: entry %o",G);let ee=null;if(!G){this._resubscribe();return}ee=G.packet,this.log("deliver :: call _sendPacket for %o",ee);let E=!0;ee.messageId&&ee.messageId!==0&&(this.messageIdProvider.register(ee.messageId)||(E=!1)),E?this._sendPacket(ee,q=>{G.cb&&G.cb(q),W()}):(this.log("messageId: %d has already used. The message is skipped and removed.",ee.messageId),W())};this.log("connect :: sending queued packets"),W()}),this.on("close",()=>{this.log("close :: connected set to `false`"),this.connected=!1,this.log("close :: clearing connackTimer"),clearTimeout(this.connackTimer),this.log("close :: clearing ping timer"),this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log("close :: calling _setupReconnect"),this._setupReconnect()}),this.options.manualConnect||(this.log("MqttClient :: setting up stream"),this.connect())}handleAuth(R,O){O()}handleMessage(R,O){O()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var R;let O=new i.Writable,M=r.default.parser(this.options),W=null,G=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),M.on("packet",K=>{this.log("parser :: on packet push to packets array."),G.push(K)});let ee=()=>{this.log("work :: getting next packet in queue");let K=G.shift();if(K)this.log("work :: packet pulled from queue"),(0,b.default)(this,K,E);else{this.log("work :: no packets in queue");let ge=W;W=null,this.log("work :: done flag is %s",!!ge),ge&&ge()}},E=()=>{if(G.length)(0,m.nextTick)(ee);else{let K=W;W=null,K()}};O._write=(K,ge,ne)=>{W=ne,this.log("writable stream :: parsing buffer"),M.parse(K),ee()};let q=K=>{this.log("streamErrorHandler :: error",K.message),K.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",K)):this.noop(K)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(O),this.stream.on("error",q),this.stream.on("close",()=>{this.log("(%s)stream :: on close",this.options.clientId),this._flushVolatile(),this.log("stream: emit close to MqttClient"),this.emit("close")}),this.log("connect: sending packet `connect`");let Z={cmd:"connect",protocolId:this.options.protocolId,protocolVersion:this.options.protocolVersion,clean:this.options.clean,clientId:this.options.clientId,keepalive:this.options.keepalive,username:this.options.username,password:this.options.password,properties:this.options.properties};if(this.options.will&&(Z.will=Object.assign(Object.assign({},this.options.will),{payload:(R=this.options.will)===null||R===void 0?void 0:R.payload})),this.topicAliasRecv&&(Z.properties||(Z.properties={}),this.topicAliasRecv&&(Z.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(Z),M.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){let K=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(K)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(()=>{this.log("!!connectTimeout hit!! Calling _cleanUp with force `true`"),this.emit("error",new Error("connack timeout")),this._cleanUp(!0)},this.options.connectTimeout),this}publish(R,O,M,W){this.log("publish :: message `%s` to topic `%s`",O,R);let{options:G}=this;typeof M=="function"&&(W=M,M=null),M=M||{},M=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),M);let{qos:ee,retain:E,dup:q,properties:Z,cbStorePut:K}=M;if(this._checkDisconnecting(W))return this;let ge=()=>{let ne=0;if((ee===1||ee===2)&&(ne=this._nextId(),ne===null))return this.log("No messageId left"),!1;let $={cmd:"publish",topic:R,payload:O,qos:ee,retain:E,messageId:ne,dup:q};switch(G.protocolVersion===5&&($.properties=Z),this.log("publish :: qos",ee),ee){case 1:case 2:this.outgoing[$.messageId]={volatile:!1,cb:W||this.noop},this.log("MqttClient:publish: packet cmd: %s",$.cmd),this._sendPacket($,void 0,K);break;default:this.log("MqttClient:publish: packet cmd: %s",$.cmd),this._sendPacket($,W,K);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!ge())&&this._storeProcessingQueue.push({invoke:ge,cbStorePut:M.cbStorePut,callback:W}),this}publishAsync(R,O,M){return new Promise((W,G)=>{this.publish(R,O,M,(ee,E)=>{ee?G(ee):W(E)})})}subscribe(R,O,M){let W=this.options.protocolVersion;typeof O=="function"&&(M=O),M=M||this.noop;let G=!1,ee=[];typeof R=="string"?(R=[R],ee=R):Array.isArray(R)?ee=R:typeof R=="object"&&(G=R.resubscribe,delete R.resubscribe,ee=Object.keys(R));let E=c.validateTopics(ee);if(E!==null)return k(M,new Error(`Invalid topic ${E}`)),this;if(this._checkDisconnecting(M))return this.log("subscribe: discconecting true"),this;let q={qos:0};W===5&&(q.nl=!1,q.rap=!1,q.rh=0),O=Object.assign(Object.assign({},q),O);let Z=O.properties,K=[],ge=($,be)=>{if(be=be||O,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,$)||this._resubscribeTopics[$].qos{this.log("subscribe: array topic %s",$),ge($)}):Object.keys(R).forEach($=>{this.log("subscribe: object topic %s, %o",$,R[$]),ge($,R[$])}),!K.length)return M(null,[]),this;let ne=()=>{let $=this._nextId();if($===null)return this.log("No messageId left"),!1;let be={cmd:"subscribe",subscriptions:K,messageId:$};if(Z&&(be.properties=Z),this.options.resubscribe){this.log("subscribe :: resubscribe true");let re=[];K.forEach(ve=>{if(this.options.reconnectPeriod>0){let S={qos:ve.qos};W===5&&(S.nl=ve.nl||!1,S.rap=ve.rap||!1,S.rh=ve.rh||0,S.properties=ve.properties),this._resubscribeTopics[ve.topic]=S,re.push(ve.topic)}}),this.messageIdToTopic[be.messageId]=re}return this.outgoing[be.messageId]={volatile:!0,cb(re,ve){if(!re){let{granted:S}=ve;for(let Y=0;Y0||!ne())&&this._storeProcessingQueue.push({invoke:ne,callback:M}),this}subscribeAsync(R,O){return new Promise((M,W)=>{this.subscribe(R,O,(G,ee)=>{G?W(G):M(ee)})})}unsubscribe(R,O,M){typeof R=="string"&&(R=[R]),typeof O=="function"&&(M=O),M=M||this.noop;let W=c.validateTopics(R);if(W!==null)return k(M,new Error(`Invalid topic ${W}`)),this;if(this._checkDisconnecting(M))return this;let G=()=>{let ee=this._nextId();if(ee===null)return this.log("No messageId left"),!1;let E={cmd:"unsubscribe",messageId:ee,unsubscriptions:[]};return typeof R=="string"?E.unsubscriptions=[R]:Array.isArray(R)&&(E.unsubscriptions=R),this.options.resubscribe&&E.unsubscriptions.forEach(q=>{delete this._resubscribeTopics[q]}),typeof O=="object"&&O.properties&&(E.properties=O.properties),this.outgoing[E.messageId]={volatile:!0,cb:M},this.log("unsubscribe: call _sendPacket"),this._sendPacket(E),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!G())&&this._storeProcessingQueue.push({invoke:G,callback:M}),this}unsubscribeAsync(R,O){return new Promise((M,W)=>{this.unsubscribe(R,O,(G,ee)=>{G?W(G):M(ee)})})}end(R,O,M){this.log("end :: (%s)",this.options.clientId),(R==null||typeof R!="boolean")&&(M=M||O,O=R,R=!1),typeof O!="object"&&(M=M||O,O=null),this.log("end :: cb? %s",!!M),(!M||typeof M!="function")&&(M=this.noop);let W=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(ee=>{this.outgoingStore.close(E=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),M){let q=ee||E;this.log("end :: closeStores: invoking callback with args"),M(q)}})}),this._deferredReconnect&&this._deferredReconnect()},G=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,R),this._cleanUp(R,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,m.nextTick)(W)},O)};return this.disconnecting?(M(),this):(this._clearReconnect(),this.disconnecting=!0,!R&&Object.keys(this.outgoing).length>0?(this.log("end :: (%s) :: calling finish in 10ms once outgoing is empty",this.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,G,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),G()),this)}endAsync(R,O){return new Promise((M,W)=>{this.end(R,O,G=>{G?W(G):M()})})}removeOutgoingMessage(R){if(this.outgoing[R]){let{cb:O}=this.outgoing[R];this._removeOutgoingAndStoreMessage(R,()=>{O(new Error("Message removed"))})}return this}reconnect(R){this.log("client reconnect");let O=()=>{R?(this.options.incomingStore=R.incomingStore,this.options.outgoingStore=R.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new g.default,this.outgoingStore=this.options.outgoingStore||new g.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=O:O(),this}_flushVolatile(){this.outgoing&&(this.log("_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(this.outgoing).forEach(R=>{this.outgoing[R].volatile&&typeof this.outgoing[R].cb=="function"&&(this.outgoing[R].cb(new Error("Connection closed")),delete this.outgoing[R])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(R=>{typeof this.outgoing[R].cb=="function"&&(this.outgoing[R].cb(new Error("Connection closed")),delete this.outgoing[R])}))}_removeTopicAliasAndRecoverTopicName(R){let O;R.properties&&(O=R.properties.topicAlias);let M=R.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",O,M),M.length===0){if(typeof O>"u")return new Error("Unregistered Topic Alias");if(M=this.topicAliasSend.getTopicByAlias(O),typeof M>"u")return new Error("Unregistered Topic Alias");R.topic=M}O&&delete R.properties.topicAlias}_checkDisconnecting(R){return this.disconnecting&&(R&&R!==this.noop?R(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting}_reconnect(){this.log("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this.connect()}),this.log("client already connected. disconnecting first.")):(this.log("_reconnect: calling connect"),this.connect())}_setupReconnect(){!this.disconnecting&&!this.reconnectTimer&&this.options.reconnectPeriod>0?(this.reconnecting||(this.log("_setupReconnect :: emit `offline` state"),this.emit("offline"),this.log("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),this.log("_setupReconnect :: setting reconnectTimer for %d ms",this.options.reconnectPeriod),this.reconnectTimer=setInterval(()=>{this.log("reconnectTimer :: reconnect triggered!"),this._reconnect()},this.options.reconnectPeriod)):this.log("_setupReconnect :: doing nothing...")}_clearReconnect(){this.log("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)}_cleanUp(R,O,M={}){if(O&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",O)),this.log("_cleanUp :: forced? %s",R),R)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let W=Object.assign({cmd:"disconnect"},M);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(W,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),k(()=>{this.stream.end(()=>{this.log("_cleanUp :: (%s) :: stream destroyed",this.options.clientId)})})})}!this.disconnecting&&!this.reconnecting&&(this.log("_cleanUp :: client not disconnecting/reconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer&&(this.log("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),O&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",O),O())}_storeAndSend(R,O,M){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",R.cmd);let W=R,G;if(W.cmd==="publish"&&(W=(0,a.default)(R),G=this._removeTopicAliasAndRecoverTopicName(W),G))return O&&O(G);this.outgoingStore.put(W,ee=>{if(ee)return O&&O(ee);M(),this._writePacket(R,O)})}_applyTopicAlias(R){if(this.options.protocolVersion===5&&R.cmd==="publish"){let O;R.properties&&(O=R.properties.topicAlias);let M=R.topic.toString();if(this.topicAliasSend)if(O){if(M.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",M,O),!this.topicAliasSend.put(M,O)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",M,O),new Error("Sending Topic Alias out of range")}else M.length!==0&&(this.options.autoAssignTopicAlias?(O=this.topicAliasSend.getAliasByTopic(M),O?(R.topic="",R.properties=Object.assign(Object.assign({},R.properties),{topicAlias:O}),this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",M,O)):(O=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(M,O),R.properties=Object.assign(Object.assign({},R.properties),{topicAlias:O}),this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",M,O))):this.options.autoUseTopicAlias&&(O=this.topicAliasSend.getAliasByTopic(M),O&&(R.topic="",R.properties=Object.assign(Object.assign({},R.properties),{topicAlias:O}),this.log("applyTopicAlias :: auto use topic: %s - alias: %d",M,O))));else if(O)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",M,O),new Error("Sending Topic Alias out of range")}}_noop(R){this.log("noop ::",R)}_writePacket(R,O){this.log("_writePacket :: packet: %O",R),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",R),this._shiftPingInterval(),this.log("_writePacket :: writing to stream");let M=r.default.writeToStream(R,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",M),!M&&O&&O!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",O)):O&&(this.log("_writePacket :: invoking cb"),O())}_sendPacket(R,O,M,W){this.log("_sendPacket :: (%s) :: start",this.options.clientId),M=M||this.noop,O=O||this.noop;let G=this._applyTopicAlias(R);if(G){O(G);return}if(!this.connected){if(R.cmd==="auth"){this._writePacket(R,O);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(R,O,M);return}if(W){this._writePacket(R,O);return}switch(R.cmd){case"publish":break;case"pubrel":this._storeAndSend(R,O,M);return;default:this._writePacket(R,O);return}switch(R.qos){case 2:case 1:this._storeAndSend(R,O,M);break;case 0:default:this._writePacket(R,O);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(R,O,M){this.log("_storePacket :: packet: %o",R),this.log("_storePacket :: cb? %s",!!O),M=M||this.noop;let W=R;if(W.cmd==="publish"){W=(0,a.default)(R);let ee=this._removeTopicAliasAndRecoverTopicName(W);if(ee)return O&&O(ee)}let G=W.qos||0;G===0&&this.queueQoSZero||W.cmd!=="publish"?this.queue.push({packet:W,cb:O}):G>0?(O=this.outgoing[W.messageId]?this.outgoing[W.messageId].cb:null,this.outgoingStore.put(W,ee=>{if(ee)return O&&O(ee);M()})):O&&O(new Error("No connection to broker"))}_setupPingTimer(){this.log("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive),!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=new I.default(this.options.keepalive,()=>{this._checkPing()}))}_shiftPingInterval(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule()}_checkPing(){this.log("_checkPing :: checking ping..."),this.pingResp?(this.log("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(this.emit("error",new Error("Keepalive timeout")),this.log("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))}_resubscribe(){this.log("_resubscribe");let R=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&R.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let O=0;O{let M=this.outgoingStore.createStream(),W=()=>{M.destroy(),M=null,this._flushStoreProcessingQueue(),G()},G=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",W),M.on("error",E=>{G(),this._flushStoreProcessingQueue(),this.removeListener("close",W),this.emit("error",E)});let ee=()=>{if(!M)return;let E=M.read(1),q;if(!E){M.once("readable",ee);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[E.messageId]){ee();return}!this.disconnecting&&!this.reconnectTimer?(q=this.outgoing[E.messageId]?this.outgoing[E.messageId].cb:null,this.outgoing[E.messageId]={volatile:!1,cb(Z,K){q&&q(Z,K),ee()}},this._packetIdsDuringStoreProcessing[E.messageId]=!0,this.messageIdProvider.register(E.messageId)?this._sendPacket(E,void 0,void 0,!0):this.log("messageId: %d has already used.",E.messageId)):M.destroy&&M.destroy()};M.on("end",()=>{let E=!0;for(let q in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[q]){E=!1;break}this.removeListener("close",W),E?(G(),this._invokeAllStoreProcessingQueue(),this.emit("connect",R)):O()}),ee()};O()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let R=this._storeProcessingQueue[0];if(R&&R.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let R of this._storeProcessingQueue)R.cbStorePut&&R.cbStorePut(new Error("Connection closed")),R.callback&&R.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(R,O){delete this.outgoing[R],this.outgoingStore.del({messageId:R},(M,W)=>{O(M,W),this.messageIdProvider.deallocate(R),this._invokeStoreProcessingQueue()})}};e.default=D}),Wl=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0});var n=Bs(),t=class{constructor(){this.numberAllocator=new n.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(l){return this.numberAllocator.use(l)}deallocate(l){this.numberAllocator.free(l)}clear(){this.numberAllocator.clear()}};e.default=t});function Vt(e){throw new RangeError(Ls[e])}function oo(e,n){let t=e.split("@"),l="";t.length>1&&(l=t[0]+"@",e=t[1]);let h=function(s,r){let o=[],i=s.length;for(;i--;)o[i]=r(s[i]);return o}((e=e.replace(Us,".")).split("."),n).join(".");return l+h}function so(e){let n=[],t=0,l=e.length;for(;t=55296&&h<=56319&&t{ae(),se(),oe(),ao=/^xn--/,lo=/[^\0-\x7E]/,Us=/[\x2E\u3002\uFF0E\uFF61]/g,Ls={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ct=Math.floor,_r=String.fromCharCode,Jr=function(e,n){return e+22+75*(e<26)-((n!=0)<<5)},Xr=function(e,n,t){let l=0;for(e=t?ct(e/700):e>>1,e+=ct(e/n);e>455;l+=36)e=ct(e/35);return ct(l+36*e/(e+38))},Zr=function(e){let n=[],t=e.length,l=0,h=128,s=72,r=e.lastIndexOf("-");r<0&&(r=0);for(let i=0;i=128&&Vt("not-basic"),n.push(e.charCodeAt(i));for(let i=r>0?r+1:0;i=t&&Vt("invalid-input");let b=(o=e.charCodeAt(i++))-48<10?o-22:o-65<26?o-65:o-97<26?o-97:36;(b>=36||b>ct((2147483647-l)/p))&&Vt("overflow"),l+=b*p;let m=g<=s?1:g>=s+26?26:g-s;if(bct(2147483647/y)&&Vt("overflow"),p*=y}let c=n.length+1;s=Xr(l-a,c,a==0),ct(l/c)>2147483647-h&&Vt("overflow"),h+=ct(l/c),l%=c,n.splice(l++,0,h)}var o;return String.fromCodePoint(...n)},ei=function(e){let n=[],t=(e=so(e)).length,l=128,h=0,s=72;for(let i of e)i<128&&n.push(_r(i));let r=n.length,o=r;for(r&&n.push("-");o=l&&cct((2147483647-h)/a)&&Vt("overflow"),h+=(i-l)*a,l=i;for(let c of e)if(c2147483647&&Vt("overflow"),c==l){let p=h;for(let g=36;;g+=36){let b=g<=s?1:g>=s+26?26:g-s;if(pString.fromCodePoint(...e)},decode:Zr,encode:ei,toASCII:function(e){return oo(e,function(n){return lo.test(n)?"xn--"+ei(n):n})},toUnicode:function(e){return oo(e,function(n){return ao.test(n)?Zr(n.slice(4).toLowerCase()):n})}},Nt.decode,Nt.encode,Nt.toASCII,Nt.toUnicode,Nt.ucs2,Nt.version});function ql(e,n){return Object.prototype.hasOwnProperty.call(e,n)}var uo,ir,ho,bt,Vl=Ge(()=>{ae(),se(),oe(),uo=function(e,n,t,l){n=n||"&",t=t||"=";var h={};if(typeof e!="string"||e.length===0)return h;var s=/\+/g;e=e.split(n);var r=1e3;l&&typeof l.maxKeys=="number"&&(r=l.maxKeys);var o=e.length;r>0&&o>r&&(o=r);for(var i=0;i=0?(a=b.substr(0,m),c=b.substr(m+1)):(a=b,c=""),p=decodeURIComponent(a),g=decodeURIComponent(c),ql(h,p)?Array.isArray(h[p])?h[p].push(g):h[p]=[h[p],g]:h[p]=g}return h},ir=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},ho=function(e,n,t,l){return n=n||"&",t=t||"=",e===null&&(e=void 0),typeof e=="object"?Object.keys(e).map(function(h){var s=encodeURIComponent(ir(h))+t;return Array.isArray(e[h])?e[h].map(function(r){return s+encodeURIComponent(ir(r))}).join(n):s+encodeURIComponent(ir(e[h]))}).join(n):l?encodeURIComponent(ir(l))+t+encodeURIComponent(ir(e)):""},bt={},bt.decode=bt.parse=uo,bt.encode=bt.stringify=ho,bt.decode,bt.encode,bt.parse,bt.stringify});function wn(){throw new Error("setTimeout has not been defined")}function vn(){throw new Error("clearTimeout has not been defined")}function Ns(e){if(Et===setTimeout)return setTimeout(e,0);if((Et===wn||!Et)&&setTimeout)return Et=setTimeout,setTimeout(e,0);try{return Et(e,0)}catch{try{return Et.call(null,e,0)}catch{return Et.call(this||Jt,e,0)}}}function Hl(){Xt&&Qt&&(Xt=!1,Qt.length?yt=Qt.concat(yt):mr=-1,yt.length&&js())}function js(){if(!Xt){var e=Ns(Hl);Xt=!0;for(var n=yt.length;n;){for(Qt=yt,yt=[];++mr{ae(),se(),oe(),Jt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,We=fo={},function(){try{Et=typeof setTimeout=="function"?setTimeout:wn}catch{Et=wn}try{St=typeof clearTimeout=="function"?clearTimeout:vn}catch{St=vn}}(),yt=[],Xt=!1,mr=-1,We.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t1)for(var U=1;U{ae(),se(),oe(),Rr={},_n=!1,zt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Le=Kl(),Le.platform="browser",Le.addListener,Le.argv,Le.binding,Le.browser,Le.chdir,Le.cwd,Le.emit,Le.env,Le.listeners,Le.nextTick,Le.off,Le.on,Le.once,Le.prependListener,Le.prependOnceListener,Le.removeAllListeners,Le.removeListener,Le.title,Le.umask,Le.version,Le.versions});function Yl(){if(En)return Pr;En=!0;var e=Le;function n(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function t(s,r){for(var o="",i=0,a=-1,c=0,p,g=0;g<=s.length;++g){if(g2){var b=o.lastIndexOf("/");if(b!==o.length-1){b===-1?(o="",i=0):(o=o.slice(0,b),i=o.length-1-o.lastIndexOf("/")),a=g,c=0;continue}}else if(o.length===2||o.length===1){o="",i=0,a=g,c=0;continue}}r&&(o.length>0?o+="/..":o="..",i=2)}else o.length>0?o+="/"+s.slice(a+1,g):o=s.slice(a+1,g),i=g-a-1;a=g,c=0}else p===46&&c!==-1?++c:c=-1}return o}function l(s,r){var o=r.dir||r.root,i=r.base||(r.name||"")+(r.ext||"");return o?o===r.root?o+i:o+s+i:i}var h={resolve:function(){for(var s="",r=!1,o,i=arguments.length-1;i>=-1&&!r;i--){var a;i>=0?a=arguments[i]:(o===void 0&&(o=e.cwd()),a=o),n(a),a.length!==0&&(s=a+"/"+s,r=a.charCodeAt(0)===47)}return s=t(s,!r),r?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(n(s),s.length===0)return".";var r=s.charCodeAt(0)===47,o=s.charCodeAt(s.length-1)===47;return s=t(s,!r),s.length===0&&!r&&(s="."),s.length>0&&o&&(s+="/"),r?"/"+s:s},isAbsolute:function(s){return n(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var s,r=0;r0&&(s===void 0?s=o:s+="/"+o)}return s===void 0?".":h.normalize(s)},relative:function(s,r){if(n(s),n(r),s===r||(s=h.resolve(s),r=h.resolve(r),s===r))return"";for(var o=1;ob){if(r.charCodeAt(c+y)===47)return r.slice(c+y+1);if(y===0)return r.slice(c+y)}else a>b&&(s.charCodeAt(o+y)===47?m=y:y===0&&(m=0));break}var I=s.charCodeAt(o+y),U=r.charCodeAt(c+y);if(I!==U)break;I===47&&(m=y)}var k="";for(y=o+m+1;y<=i;++y)(y===i||s.charCodeAt(y)===47)&&(k.length===0?k+="..":k+="/..");return k.length>0?k+r.slice(c+m):(c+=m,r.charCodeAt(c)===47&&++c,r.slice(c))},_makeLong:function(s){return s},dirname:function(s){if(n(s),s.length===0)return".";for(var r=s.charCodeAt(0),o=r===47,i=-1,a=!0,c=s.length-1;c>=1;--c)if(r=s.charCodeAt(c),r===47){if(!a){i=c;break}}else a=!1;return i===-1?o?"/":".":o&&i===1?"//":s.slice(0,i)},basename:function(s,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');n(s);var o=0,i=-1,a=!0,c;if(r!==void 0&&r.length>0&&r.length<=s.length){if(r.length===s.length&&r===s)return"";var p=r.length-1,g=-1;for(c=s.length-1;c>=0;--c){var b=s.charCodeAt(c);if(b===47){if(!a){o=c+1;break}}else g===-1&&(a=!1,g=c+1),p>=0&&(b===r.charCodeAt(p)?--p===-1&&(i=c):(p=-1,i=g))}return o===i?i=g:i===-1&&(i=s.length),s.slice(o,i)}else{for(c=s.length-1;c>=0;--c)if(s.charCodeAt(c)===47){if(!a){o=c+1;break}}else i===-1&&(a=!1,i=c+1);return i===-1?"":s.slice(o,i)}},extname:function(s){n(s);for(var r=-1,o=0,i=-1,a=!0,c=0,p=s.length-1;p>=0;--p){var g=s.charCodeAt(p);if(g===47){if(!a){o=p+1;break}continue}i===-1&&(a=!1,i=p+1),g===46?r===-1?r=p:c!==1&&(c=1):r!==-1&&(c=-1)}return r===-1||i===-1||c===0||c===1&&r===i-1&&r===o+1?"":s.slice(r,i)},format:function(s){if(s===null||typeof s!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof s);return l("/",s)},parse:function(s){n(s);var r={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return r;var o=s.charCodeAt(0),i=o===47,a;i?(r.root="/",a=1):a=0;for(var c=-1,p=0,g=-1,b=!0,m=s.length-1,y=0;m>=a;--m){if(o=s.charCodeAt(m),o===47){if(!b){p=m+1;break}continue}g===-1&&(b=!1,g=m+1),o===46?c===-1?c=m:y!==1&&(y=1):c!==-1&&(y=-1)}return c===-1||g===-1||y===0||y===1&&c===g-1&&c===p+1?g!==-1&&(p===0&&i?r.base=r.name=s.slice(1,g):r.base=r.name=s.slice(p,g)):(p===0&&i?(r.name=s.slice(1,c),r.base=s.slice(1,g)):(r.name=s.slice(p,c),r.base=s.slice(p,g)),r.ext=s.slice(c,g)),p>0?r.dir=s.slice(0,p-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return h.posix=h,Pr=h,Pr}var Pr,En,Sn,Ql=Ge(()=>{ae(),se(),oe(),Ds(),Pr={},En=!1,Sn=Yl()}),Fs={};Zt(Fs,{URL:()=>na,Url:()=>Zs,default:()=>Pe,fileURLToPath:()=>Ws,format:()=>ea,parse:()=>ia,pathToFileURL:()=>$s,resolve:()=>ta,resolveObject:()=>ra});function ut(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function fr(e,n,t){if(e&&dt.isObject(e)&&e instanceof ut)return e;var l=new ut;return l.parse(e,n,t),l}function Gl(){if(An)return Br;An=!0;var e=De;function n(s){if(typeof s!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(s))}function t(s,r){for(var o="",i=0,a=-1,c=0,p,g=0;g<=s.length;++g){if(g2){var b=o.lastIndexOf("/");if(b!==o.length-1){b===-1?(o="",i=0):(o=o.slice(0,b),i=o.length-1-o.lastIndexOf("/")),a=g,c=0;continue}}else if(o.length===2||o.length===1){o="",i=0,a=g,c=0;continue}}r&&(o.length>0?o+="/..":o="..",i=2)}else o.length>0?o+="/"+s.slice(a+1,g):o=s.slice(a+1,g),i=g-a-1;a=g,c=0}else p===46&&c!==-1?++c:c=-1}return o}function l(s,r){var o=r.dir||r.root,i=r.base||(r.name||"")+(r.ext||"");return o?o===r.root?o+i:o+s+i:i}var h={resolve:function(){for(var s="",r=!1,o,i=arguments.length-1;i>=-1&&!r;i--){var a;i>=0?a=arguments[i]:(o===void 0&&(o=e.cwd()),a=o),n(a),a.length!==0&&(s=a+"/"+s,r=a.charCodeAt(0)===47)}return s=t(s,!r),r?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(n(s),s.length===0)return".";var r=s.charCodeAt(0)===47,o=s.charCodeAt(s.length-1)===47;return s=t(s,!r),s.length===0&&!r&&(s="."),s.length>0&&o&&(s+="/"),r?"/"+s:s},isAbsolute:function(s){return n(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var s,r=0;r0&&(s===void 0?s=o:s+="/"+o)}return s===void 0?".":h.normalize(s)},relative:function(s,r){if(n(s),n(r),s===r||(s=h.resolve(s),r=h.resolve(r),s===r))return"";for(var o=1;ob){if(r.charCodeAt(c+y)===47)return r.slice(c+y+1);if(y===0)return r.slice(c+y)}else a>b&&(s.charCodeAt(o+y)===47?m=y:y===0&&(m=0));break}var I=s.charCodeAt(o+y),U=r.charCodeAt(c+y);if(I!==U)break;I===47&&(m=y)}var k="";for(y=o+m+1;y<=i;++y)(y===i||s.charCodeAt(y)===47)&&(k.length===0?k+="..":k+="/..");return k.length>0?k+r.slice(c+m):(c+=m,r.charCodeAt(c)===47&&++c,r.slice(c))},_makeLong:function(s){return s},dirname:function(s){if(n(s),s.length===0)return".";for(var r=s.charCodeAt(0),o=r===47,i=-1,a=!0,c=s.length-1;c>=1;--c)if(r=s.charCodeAt(c),r===47){if(!a){i=c;break}}else a=!1;return i===-1?o?"/":".":o&&i===1?"//":s.slice(0,i)},basename:function(s,r){if(r!==void 0&&typeof r!="string")throw new TypeError('"ext" argument must be a string');n(s);var o=0,i=-1,a=!0,c;if(r!==void 0&&r.length>0&&r.length<=s.length){if(r.length===s.length&&r===s)return"";var p=r.length-1,g=-1;for(c=s.length-1;c>=0;--c){var b=s.charCodeAt(c);if(b===47){if(!a){o=c+1;break}}else g===-1&&(a=!1,g=c+1),p>=0&&(b===r.charCodeAt(p)?--p===-1&&(i=c):(p=-1,i=g))}return o===i?i=g:i===-1&&(i=s.length),s.slice(o,i)}else{for(c=s.length-1;c>=0;--c)if(s.charCodeAt(c)===47){if(!a){o=c+1;break}}else i===-1&&(a=!1,i=c+1);return i===-1?"":s.slice(o,i)}},extname:function(s){n(s);for(var r=-1,o=0,i=-1,a=!0,c=0,p=s.length-1;p>=0;--p){var g=s.charCodeAt(p);if(g===47){if(!a){o=p+1;break}continue}i===-1&&(a=!1,i=p+1),g===46?r===-1?r=p:c!==1&&(c=1):r!==-1&&(c=-1)}return r===-1||i===-1||c===0||c===1&&r===i-1&&r===o+1?"":s.slice(r,i)},format:function(s){if(s===null||typeof s!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof s);return l("/",s)},parse:function(s){n(s);var r={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return r;var o=s.charCodeAt(0),i=o===47,a;i?(r.root="/",a=1):a=0;for(var c=-1,p=0,g=-1,b=!0,m=s.length-1,y=0;m>=a;--m){if(o=s.charCodeAt(m),o===47){if(!b){p=m+1;break}continue}g===-1&&(b=!1,g=m+1),o===46?c===-1?c=m:y!==1&&(y=1):c!==-1&&(y=-1)}return c===-1||g===-1||y===0||y===1&&c===g-1&&c===p+1?g!==-1&&(p===0&&i?r.base=r.name=s.slice(1,g):r.base=r.name=s.slice(p,g)):(p===0&&i?(r.name=s.slice(1,c),r.base=s.slice(1,g)):(r.name=s.slice(p,c),r.base=s.slice(p,g)),r.ext=s.slice(c,g)),p>0?r.dir=s.slice(0,p-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};return h.posix=h,Br=h,Br}function Jl(e){if(typeof e=="string")e=new URL(e);else if(!(e instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(e.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Ur?Xl(e):Zl(e)}function Xl(e){let n=e.hostname,t=e.pathname;for(let l=0;lzs||h!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return t.slice(1)}}function Zl(e){if(e.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let n=e.pathname;for(let t=0;tla||h!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return t.slice(1)}}function ru(e){if(e.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let n=e.pathname;for(let t=0;t{ae(),se(),oe(),$l(),Vl(),zl(),Ql(),Ds(),Pe={},po=Nt,dt={isString:function(e){return typeof e=="string"},isObject:function(e){return typeof e=="object"&&e!==null},isNull:function(e){return e===null},isNullOrUndefined:function(e){return e==null}},Pe.parse=fr,Pe.resolve=function(e,n){return fr(e,!1,!0).resolve(n)},Pe.resolveObject=function(e,n){return e?fr(e,!1,!0).resolveObject(n):n},Pe.format=function(e){return dt.isString(e)&&(e=fr(e)),e instanceof ut?e.format():ut.prototype.format.call(e)},Pe.Url=ut,go=/^([a-z0-9.+-]+:)/i,bo=/:[0-9]*$/,mo=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,yo=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",` `," "]),Er=["'"].concat(yo),ti=["%","/","?",";","#"].concat(Er),ri=["/","?","#"],ii=/^[+a-z0-9A-Z_-]{0,63}$/,wo=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,vo={javascript:!0,"javascript:":!0},Sr={javascript:!0,"javascript:":!0},Ht={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Ar=bt,ut.prototype.parse=function(e,n,t){if(!dt.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var l=e.indexOf("?"),h=l!==-1&&l127?D+="x":D+=T[F];if(!D.match(ii)){var O=U.slice(0,m),M=U.slice(m+1),W=T.match(wo);W&&(O.push(W[1]),M.unshift(W[2])),M.length&&(r="/"+M.join(".")+r),this.hostname=O.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=po.toASCII(this.hostname));var G=this.port?":"+this.port:"",ee=this.hostname||"";this.host=ee+G,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),r[0]!=="/"&&(r="/"+r))}if(!vo[a])for(m=0,k=Er.length;m0)&&t.host.split("@"))&&(t.auth=W.shift(),t.host=t.hostname=W.shift())),t.search=e.search,t.query=e.query,dt.isNull(t.pathname)&&dt.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t;if(!T.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var F=T.slice(-1)[0],R=(t.host||e.host||T.length>1)&&(F==="."||F==="..")||F==="",O=0,M=T.length;M>=0;M--)(F=T[M])==="."?T.splice(M,1):F===".."?(T.splice(M,1),O++):O&&(T.splice(M,1),O--);if(!U&&!k)for(;O--;O)T.unshift("..");!U||T[0]===""||T[0]&&T[0].charAt(0)==="/"||T.unshift(""),R&&T.join("/").substr(-1)!=="/"&&T.push("");var W,G=T[0]===""||T[0]&&T[0].charAt(0)==="/";return D&&(t.hostname=t.host=G?"":T.length?T.shift():"",(W=!!(t.host&&t.host.indexOf("@")>0)&&t.host.split("@"))&&(t.auth=W.shift(),t.host=t.hostname=W.shift())),(U=U||t.host&&T.length)&&!G&&T.unshift(""),T.length?t.pathname=T.join("/"):(t.pathname=null,t.path=null),dt.isNull(t.pathname)&&dt.isNull(t.search)||(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=e.auth||t.auth,t.slashes=t.slashes||e.slashes,t.href=t.format(),t},ut.prototype.parseHost=function(){var e=this.host,n=bo.exec(e);n&&((n=n[0])!==":"&&(this.port=n.substr(1)),e=e.substr(0,e.length-n.length)),e&&(this.hostname=e)},Pe.Url,Pe.format,Pe.resolve,Pe.resolveObject,Br={},An=!1,In=Gl(),_o=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0,Pe.URL=typeof URL<"u"?URL:null,Pe.pathToFileURL=eu,Pe.fileURLToPath=Jl,Pe.Url,Pe.format,Pe.resolve,Pe.resolveObject,Pe.URL,qs=92,Vs=47,Hs=97,zs=122,Ur=_o==="win32",Ks=/\//g,Ys=/%/g,Qs=/\\/g,Gs=/\n/g,Js=/\r/g,Xs=/\t/g,Eo=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0,Pe.URL=typeof URL<"u"?URL:null,Pe.pathToFileURL=$s,Pe.fileURLToPath=Ws,Zs=Pe.Url,ea=Pe.format,ta=Pe.resolve,ra=Pe.resolveObject,ia=Pe.parse,na=Pe.URL,oa=92,sa=47,aa=97,la=122,Lr=Eo==="win32",ua=/\//g,ha=/%/g,ca=/\\/g,fa=/\n/g,da=/\r/g,pa=/\t/g}),Ln={};Zt(Ln,{Server:()=>Ne,Socket:()=>Ne,Stream:()=>Ne,_createServerHandle:()=>Ne,_normalizeArgs:()=>Ne,_setSimultaneousAccepts:()=>Ne,connect:()=>Ne,createConnection:()=>Ne,createServer:()=>Ne,default:()=>ga,isIP:()=>Ne,isIPv4:()=>Ne,isIPv6:()=>Ne});function Ne(){throw new Error("Node.js net module is not supported by JSPM core outside of Node.js")}var ga,ba=Ge(()=>{ae(),se(),oe(),ga={_createServerHandle:Ne,_normalizeArgs:Ne,_setSimultaneousAccepts:Ne,connect:Ne,createConnection:Ne,createServer:Ne,isIP:Ne,isIPv4:Ne,isIPv6:Ne,Server:Ne,Socket:Ne,Stream:Ne}}),So=me(e=>{ae(),se(),oe();var n=e&&e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(e,"__esModule",{value:!0});var t=n((ba(),Me(Ln))),l=n(Ct()),h=(0,l.default)("mqttjs:tcp"),s=(r,o)=>{o.port=o.port||1883,o.hostname=o.hostname||o.host||"localhost";let{port:i}=o,a=o.hostname;return h("port %d and host %s",i,a),t.default.createConnection(i,a)};e.default=s}),ma={};Zt(ma,{default:()=>ya});var ya,nu=Ge(()=>{ae(),se(),oe(),ya={}}),Ao=me(e=>{ae(),se(),oe();var n=e&&e.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(e,"__esModule",{value:!0});var t=n((nu(),Me(ma))),l=n((ba(),Me(Ln))),h=n(Ct()),s=(0,h.default)("mqttjs:tls"),r=(o,i)=>{i.port=i.port||8883,i.host=i.hostname||i.host||"localhost",l.default.isIP(i.host)===0&&(i.servername=i.host),i.rejectUnauthorized=i.rejectUnauthorized!==!1,delete i.path,s("port %d host %s rejectUnauthorized %b",i.port,i.host,i.rejectUnauthorized);let a=t.default.connect(i);a.on("secureConnect",()=>{i.rejectUnauthorized&&!a.authorized?a.emit("error",new Error("TLS not authorized")):a.removeListener("error",c)});function c(p){i.rejectUnauthorized&&o.emit("error",p),a.end()}return a.on("error",c),a};e.default=r}),Nn=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0}),e.BufferedDuplex=e.writev=void 0;var n=rr();function t(h,s){let r=new Array(h.length);for(let o=0;o{this.push(o)})}_read(h){this.proxy.read(h)}_write(h,s,r){this.isSocketOpen?this.writeToProxy(h,s,r):this.writeQueue.push({chunk:h,encoding:s,cb:r})}_final(h){this.writeQueue=[],this.proxy.end(h)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(h,s,r){this.proxy.write(h,s)===!1?this.proxy.once("drain",r):r()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:h,encoding:s,cb:r}=this.writeQueue.shift();this.writeToProxy(h,s,r)}}};e.BufferedDuplex=l}),Io=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0});var n=(et(),Me(Ze)),t=rr(),l=Nn(),h,s,r;function o(){let g=new t.Transform;return g._write=(b,m,y)=>{h.send({data:b.buffer,success(){y()},fail(I){y(new Error(I))}})},g._flush=b=>{h.close({success(){b()}})},g}function i(g){g.hostname||(g.hostname="localhost"),g.path||(g.path="/"),g.wsOptions||(g.wsOptions={})}function a(g,b){let m=g.protocol==="wxs"?"wss":"ws",y=`${m}://${g.hostname}${g.path}`;return g.port&&g.port!==80&&g.port!==443&&(y=`${m}://${g.hostname}:${g.port}${g.path}`),typeof g.transformWsUrl=="function"&&(y=g.transformWsUrl(y,g,b)),y}function c(){h.onOpen(()=>{r.socketReady()}),h.onMessage(g=>{let{data:b}=g;b instanceof ArrayBuffer?b=n.Buffer.from(b):b=n.Buffer.from(b,"utf8"),s.push(b)}),h.onClose(()=>{r.emit("close"),r.end(),r.destroy()}),h.onError(g=>{let b=new Error(g.errMsg);r.destroy(b)})}var p=(g,b)=>{if(b.hostname=b.hostname||b.host,!b.hostname)throw new Error("Could not determine host. Specify host manually.");let m=b.protocolId==="MQIsdp"&&b.protocolVersion===3?"mqttv3.1":"mqtt";i(b);let y=a(b,g);h=wx.connectSocket({url:y,protocols:[m]}),s=o(),r=new l.BufferedDuplex(b,s,h),r._destroy=(U,k)=>{h.close({success(){k&&k(U)}})};let I=r.destroy;return r.destroy=(U,k)=>(r.destroy=I,setTimeout(()=>{h.close({fail(){r._destroy(U,k)}})},0),r),c(),r};e.default=p}),To=me(e=>{ae(),se(),oe(),Object.defineProperty(e,"__esModule",{value:!0});var n=(et(),Me(Ze)),t=rr(),l=Nn(),h,s,r,o=!1;function i(){let b=new t.Transform;return b._write=(m,y,I)=>{h.sendSocketMessage({data:m.buffer,success(){I()},fail(){I(new Error)}})},b._flush=m=>{h.closeSocket({success(){m()}})},b}function a(b){b.hostname||(b.hostname="localhost"),b.path||(b.path="/"),b.wsOptions||(b.wsOptions={})}function c(b,m){let y=b.protocol==="alis"?"wss":"ws",I=`${y}://${b.hostname}${b.path}`;return b.port&&b.port!==80&&b.port!==443&&(I=`${y}://${b.hostname}:${b.port}${b.path}`),typeof b.transformWsUrl=="function"&&(I=b.transformWsUrl(I,b,m)),I}function p(){o||(o=!0,h.onSocketOpen(()=>{r.socketReady()}),h.onSocketMessage(b=>{if(typeof b.data=="string"){let m=n.Buffer.from(b.data,"base64");s.push(m)}else{let m=new FileReader;m.addEventListener("load",()=>{let y=m.result;y instanceof ArrayBuffer?y=n.Buffer.from(y):y=n.Buffer.from(y,"utf8"),s.push(y)}),m.readAsArrayBuffer(b.data)}}),h.onSocketClose(()=>{r.end(),r.destroy()}),h.onSocketError(b=>{r.destroy(b)}))}var g=(b,m)=>{if(m.hostname=m.hostname||m.host,!m.hostname)throw new Error("Could not determine host. Specify host manually.");let y=m.protocolId==="MQIsdp"&&m.protocolVersion===3?"mqttv3.1":"mqtt";a(m);let I=c(m,b);return h=m.my,h.connectSocket({url:I,protocols:y}),s=i(),r=new l.BufferedDuplex(m,s,h),p(),r};e.default=g}),ou=me((e,n)=>{ae(),se(),oe(),n.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}}),ko=me(e=>{ae(),se(),oe();var n=e&&e.__importDefault||function(U){return U&&U.__esModule?U:{default:U}};Object.defineProperty(e,"__esModule",{value:!0});var t=(et(),Me(Ze)),l=n(ou()),h=n(Ct()),s=rr(),r=n($r()),o=Nn(),i=(0,h.default)("mqttjs:ws"),a=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function c(U,k){let T=`${U.protocol}://${U.hostname}:${U.port}${U.path}`;return typeof U.transformWsUrl=="function"&&(T=U.transformWsUrl(T,U,k)),T}function p(U){let k=U;return U.hostname||(k.hostname="localhost"),U.port||(U.protocol==="wss"?k.port=443:k.port=80),U.path||(k.path="/"),U.wsOptions||(k.wsOptions={}),!r.default&&U.protocol==="wss"&&a.forEach(T=>{Object.prototype.hasOwnProperty.call(U,T)&&!Object.prototype.hasOwnProperty.call(U.wsOptions,T)&&(k.wsOptions[T]=U[T])}),k}function g(U){let k=p(U);if(k.hostname||(k.hostname=k.host),!k.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let T=new URL(document.URL);k.hostname=T.hostname,k.port||(k.port=Number(T.port))}return k.objectMode===void 0&&(k.objectMode=!(k.binary===!0||k.binary===void 0)),k}function b(U,k,T){i("createWebSocket"),i(`protocol: ${T.protocolId} ${T.protocolVersion}`);let D=T.protocolId==="MQIsdp"&&T.protocolVersion===3?"mqttv3.1":"mqtt";i(`creating new Websocket for url: ${k} and protocol: ${D}`);let F;return T.createWebsocket?F=T.createWebsocket(k,[D],T):F=new l.default(k,[D],T.wsOptions),F}function m(U,k){let T=k.protocolId==="MQIsdp"&&k.protocolVersion===3?"mqttv3.1":"mqtt",D=c(k,U),F;return k.createWebsocket?F=k.createWebsocket(D,[T],k):F=new WebSocket(D,[T]),F.binaryType="arraybuffer",F}var y=(U,k)=>{i("streamBuilder");let T=p(k),D=c(T,U),F=b(U,D,T),R=l.default.createWebSocketStream(F,T.wsOptions);return R.url=D,F.on("close",()=>{R.destroy()}),R},I=(U,k)=>{i("browserStreamBuilder");let T,D=g(k).browserBufferSize||1024*512,F=k.browserBufferTimeout||1e3,R=!k.objectMode,O=m(U,k),M=G(k,K,ge);k.objectMode||(M._writev=o.writev.bind(M)),M.on("close",()=>{O.close()});let W=typeof O.addEventListener<"u";O.readyState===O.OPEN?(T=M,T.socket=O):(T=new o.BufferedDuplex(k,M,O),W?O.addEventListener("open",ee):O.onopen=ee),W?(O.addEventListener("close",E),O.addEventListener("error",q),O.addEventListener("message",Z)):(O.onclose=E,O.onerror=q,O.onmessage=Z);function G(ne,$,be){let re=new s.Transform({objectMode:ne.objectMode});return re._write=$,re._flush=be,re}function ee(){i("WebSocket onOpen"),T instanceof o.BufferedDuplex&&T.socketReady()}function E(ne){i("WebSocket onClose",ne),T.end(),T.destroy()}function q(ne){i("WebSocket onError",ne);let $=new Error("WebSocket error");$.event=ne,T.destroy($)}function Z(ne){let{data:$}=ne;$ instanceof ArrayBuffer?$=t.Buffer.from($):$=t.Buffer.from($,"utf8"),M.push($)}function K(ne,$,be){if(O.bufferedAmount>D){setTimeout(K,F,ne,$,be);return}R&&typeof ne=="string"&&(ne=t.Buffer.from(ne,"utf8"));try{O.send(ne)}catch(re){return be(re)}be()}function ge(ne){O.close(),ne()}return T};e.default=r.default?I:y}),su=me(e=>{ae(),se(),oe();var n=e&&e.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(e,"__esModule",{value:!0}),e.connectAsync=void 0;var t=n(Ct()),l=n((iu(),Me(Fs))),h=n(yn()),s=n($r()),r=(0,t.default)("mqttjs"),o={};s.default?(o.wx=Io().default,o.wxs=Io().default,o.ali=To().default,o.alis=To().default):(o.mqtt=So().default,o.tcp=So().default,o.ssl=Ao().default,o.tls=o.ssl,o.mqtts=Ao().default),o.ws=ko().default,o.wss=ko().default;function i(p){let g;p.auth&&(g=p.auth.match(/^(.+):(.+)$/),g?(p.username=g[1],p.password=g[2]):p.username=p.auth)}function a(p,g){if(r("connecting to an MQTT broker..."),typeof p=="object"&&!g&&(g=p,p=""),g=g||{},p&&typeof p=="string"){let y=l.default.parse(p,!0);if(y.port!=null&&(y.port=Number(y.port)),g=Object.assign(Object.assign({},y),g),g.protocol===null)throw new Error("Missing protocol");g.protocol=g.protocol.replace(/:$/,"")}if(i(g),g.query&&typeof g.query.clientId=="string"&&(g.clientId=g.query.clientId),g.cert&&g.key)if(g.protocol){if(["mqtts","wss","wxs","alis"].indexOf(g.protocol)===-1)switch(g.protocol){case"mqtt":g.protocol="mqtts";break;case"ws":g.protocol="wss";break;case"wx":g.protocol="wxs";break;case"ali":g.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${g.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(!o[g.protocol]){let y=["mqtts","wss"].indexOf(g.protocol)!==-1;g.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((I,U)=>y&&U%2===0?!1:typeof o[I]=="function")[0]}if(g.clean===!1&&!g.clientId)throw new Error("Missing clientId for unclean clients");g.protocol&&(g.defaultProtocol=g.protocol);function b(y){return g.servers&&((!y._reconnectCount||y._reconnectCount===g.servers.length)&&(y._reconnectCount=0),g.host=g.servers[y._reconnectCount].host,g.port=g.servers[y._reconnectCount].port,g.protocol=g.servers[y._reconnectCount].protocol?g.servers[y._reconnectCount].protocol:g.defaultProtocol,g.hostname=g.host,y._reconnectCount++),r("calling streambuilder for",g.protocol),o[g.protocol](y,g)}let m=new h.default(b,g);return m.on("error",()=>{}),m}function c(p,g,b=!0){return new Promise((m,y)=>{let I=a(p,g),U={connect:T=>{k(),m(I)},end:()=>{k(),m(I)},error:T=>{k(),I.end(),y(T)}};b===!1&&(U.close=()=>{U.error(new Error("Couldn't connect to server"))});function k(){Object.keys(U).forEach(T=>{I.off(T,U[T])})}Object.keys(U).forEach(T=>{I.on(T,U[T])})})}e.connectAsync=c,e.default=a}),Oo=me(e=>{ae(),se(),oe();var n=e&&e.__createBinding||(Object.create?function(b,m,y,I){I===void 0&&(I=y);var U=Object.getOwnPropertyDescriptor(m,y);(!U||("get"in U?!m.__esModule:U.writable||U.configurable))&&(U={enumerable:!0,get:function(){return m[y]}}),Object.defineProperty(b,I,U)}:function(b,m,y,I){I===void 0&&(I=y),b[I]=m[y]}),t=e&&e.__setModuleDefault||(Object.create?function(b,m){Object.defineProperty(b,"default",{enumerable:!0,value:m})}:function(b,m){b.default=m}),l=e&&e.__importStar||function(b){if(b&&b.__esModule)return b;var m={};if(b!=null)for(var y in b)y!=="default"&&Object.prototype.hasOwnProperty.call(b,y)&&n(m,b,y);return t(m,b),m},h=e&&e.__exportStar||function(b,m){for(var y in b)y!=="default"&&!Object.prototype.hasOwnProperty.call(m,y)&&n(m,b,y)},s=e&&e.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(e,"__esModule",{value:!0}),e.ReasonCodes=e.PingTimer=e.UniqueMessageIdProvider=e.DefaultMessageIdProvider=e.Store=e.MqttClient=e.connectAsync=e.connect=e.Client=void 0;var r=s(yn());e.MqttClient=r.default;var o=s(bs());e.DefaultMessageIdProvider=o.default;var i=s(Wl());e.UniqueMessageIdProvider=i.default;var a=s(ms());e.Store=a.default;var c=l(su());e.connect=c.default,Object.defineProperty(e,"connectAsync",{enumerable:!0,get:function(){return c.connectAsync}});var p=s(xs());e.PingTimer=p.default,e.Client=r.default,h(yn(),e),h(yr(),e);var g=Wr();Object.defineProperty(e,"ReasonCodes",{enumerable:!0,get:function(){return g.ReasonCodes}})}),au=me(e=>{ae(),se(),oe();var n=e&&e.__createBinding||(Object.create?function(r,o,i,a){a===void 0&&(a=i);var c=Object.getOwnPropertyDescriptor(o,i);(!c||("get"in c?!o.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return o[i]}}),Object.defineProperty(r,a,c)}:function(r,o,i,a){a===void 0&&(a=i),r[a]=o[i]}),t=e&&e.__setModuleDefault||(Object.create?function(r,o){Object.defineProperty(r,"default",{enumerable:!0,value:o})}:function(r,o){r.default=o}),l=e&&e.__importStar||function(r){if(r&&r.__esModule)return r;var o={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&n(o,r,i);return t(o,r),o},h=e&&e.__exportStar||function(r,o){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(o,i)&&n(o,r,i)};Object.defineProperty(e,"__esModule",{value:!0});var s=l(Oo());e.default=s,h(Oo(),e)});const uu=au();/*! Bundled license information: @jspm/core/nodelibs/browser/buffer.js: (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) */export{uu as m};