mqtt 5.10.4 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/build/lib/client.d.ts +2 -0
- package/build/lib/client.js.map +1 -1
- package/build/lib/connect/index.js +7 -0
- package/build/lib/connect/index.js.map +1 -1
- package/build/lib/connect/socks.d.ts +8 -0
- package/build/lib/connect/socks.js +183 -0
- package/build/lib/connect/socks.js.map +1 -0
- package/build/lib/connect/tcp.js +6 -0
- package/build/lib/connect/tcp.js.map +1 -1
- package/build/lib/connect/tls.js +20 -1
- package/build/lib/connect/tls.js.map +1 -1
- package/build/lib/validations.d.ts +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +5 -5
- package/dist/mqtt.js +45 -4
- package/dist/mqtt.min.js +5 -5
- package/package.json +4 -3
- package/src/lib/client.ts +4 -0
- package/src/lib/connect/index.ts +9 -0
- package/src/lib/connect/socks.ts +236 -0
- package/src/lib/connect/tcp.ts +7 -0
- package/src/lib/connect/tls.ts +19 -2
- package/src/lib/validations.ts +1 -1
package/dist/mqtt.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var fs=Object.defineProperty;var Dg=Object.getOwnPropertyDescriptor;var jg=Object.getOwnPropertyNames;var Fg=Object.prototype.hasOwnProperty;var Ae=(t,e)=>()=>(t&&(e=t(t=0)),e);var O=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ar=(t,e)=>{for(var r in e)fs(t,r,{get:e[r],enumerable:!0})},Wg=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of jg(e))!Fg.call(t,n)&&n!==r&&fs(t,n,{get:()=>e[n],enumerable:!(i=Dg(e,n))||i.enumerable});return t};var Q=t=>Wg(fs({},"__esModule",{value:!0}),t);var _=Ae(()=>{});var R={};Ar(R,{_debugEnd:()=>lu,_debugProcess:()=>au,_events:()=>Au,_eventsCount:()=>Iu,_exiting:()=>Wl,_fatalExceptions:()=>iu,_getActiveHandles:()=>zl,_getActiveRequests:()=>Vl,_kill:()=>Gl,_linkedBinding:()=>jl,_maxListeners:()=>Su,_preload_modules:()=>mu,_rawDebug:()=>Nl,_startProfilerIdleNotifier:()=>uu,_stopProfilerIdleNotifier:()=>cu,_tickCallback:()=>ou,abort:()=>pu,addListener:()=>Tu,allowedNodeEnvironmentFlags:()=>eu,arch:()=>Il,argv:()=>Cl,argv0:()=>_u,assert:()=>tu,binding:()=>Ol,chdir:()=>ql,config:()=>$l,cpuUsage:()=>Di,cwd:()=>Ll,debugPort:()=>wu,default:()=>Lu,dlopen:()=>Hl,domain:()=>Fl,emit:()=>Bu,emitWarning:()=>xl,env:()=>Rl,execArgv:()=>Pl,execPath:()=>yu,exit:()=>Xl,features:()=>ru,hasUncaughtExceptionCaptureCallback:()=>su,hrtime:()=>Ni,kill:()=>Jl,listeners:()=>Mu,memoryUsage:()=>Yl,moduleLoadList:()=>Dl,nextTick:()=>El,off:()=>Cu,on:()=>gt,once:()=>Ru,openStdin:()=>Zl,pid:()=>gu,platform:()=>Tl,ppid:()=>bu,prependListener:()=>xu,prependOnceListener:()=>Ou,reallyExit:()=>Kl,release:()=>Ul,removeAllListeners:()=>ku,removeListener:()=>Pu,resourceUsage:()=>Ql,setSourceMapsEnabled:()=>vu,setUncaughtExceptionCaptureCallback:()=>nu,stderr:()=>hu,stdin:()=>du,stdout:()=>fu,title:()=>Al,umask:()=>Ml,uptime:()=>Eu,version:()=>kl,versions:()=>Bl});function ps(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function $g(){!Ir||!Gt||(Ir=!1,Gt.length?pt=Gt.concat(pt):Ui=-1,pt.length&&vl())}function vl(){if(!Ir){var t=setTimeout($g,0);Ir=!0;for(var e=pt.length;e;){for(Gt=pt,pt=[];++Ui<e;)Gt&&Gt[Ui].run();Ui=-1,e=pt.length}Gt=null,Ir=!1,clearTimeout(t)}}function El(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];pt.push(new Sl(t,e)),pt.length===1&&!Ir&&setTimeout(vl,0)}function Sl(t,e){this.fun=t,this.array=e}function _e(){}function jl(t){ps("_linkedBinding")}function Hl(t){ps("dlopen")}function Vl(){return[]}function zl(){return[]}function tu(t,e){if(!t)throw new Error(e||"assertion error")}function su(){return!1}function Eu(){return kt.now()/1e3}function Ni(t){var e=Math.floor((Date.now()-kt.now())*.001),r=kt.now()*.001,i=Math.floor(r)+e,n=Math.floor(r%1*1e9);return t&&(i=i-t[0],n=n-t[1],n<0&&(i--,n+=ds)),[i,n]}function gt(){return Lu}function Mu(t){return[]}var pt,Ir,Gt,Ui,Al,Il,Tl,Rl,Cl,Pl,kl,Bl,xl,Ol,Ml,Ll,ql,Ul,Nl,Dl,Fl,Wl,$l,Kl,Gl,Di,Ql,Yl,Jl,Xl,Zl,eu,ru,iu,nu,ou,au,lu,uu,cu,fu,hu,du,pu,gu,bu,yu,wu,_u,mu,vu,kt,hs,ds,Su,Au,Iu,Tu,Ru,Cu,Pu,ku,Bu,xu,Ou,Lu,qu=Ae(()=>{_();v();m();pt=[],Ir=!1,Ui=-1;Sl.prototype.run=function(){this.fun.apply(null,this.array)};Al="browser",Il="x64",Tl="browser",Rl={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Cl=["/usr/bin/node"],Pl=[],kl="v16.8.0",Bl={},xl=function(t,e){console.warn((e?e+": ":"")+t)},Ol=function(t){ps("binding")},Ml=function(t){return 0},Ll=function(){return"/"},ql=function(t){},Ul={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Nl=_e,Dl=[];Fl={},Wl=!1,$l={};Kl=_e,Gl=_e,Di=function(){return{}},Ql=Di,Yl=Di,Jl=_e,Xl=_e,Zl=_e,eu={};ru={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},iu=_e,nu=_e;ou=_e,au=_e,lu=_e,uu=_e,cu=_e,fu=void 0,hu=void 0,du=void 0,pu=_e,gu=2,bu=1,yu="/bin/usr/node",wu=9229,_u="node",mu=[],vu=_e,kt={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};kt.now===void 0&&(hs=Date.now(),kt.timing&&kt.timing.navigationStart&&(hs=kt.timing.navigationStart),kt.now=()=>Date.now()-hs);ds=1e9;Ni.bigint=function(t){var e=Ni(t);return typeof BigInt>"u"?e[0]*ds+e[1]:BigInt(e[0]*ds)+BigInt(e[1])};Su=10,Au={},Iu=0;Tu=gt,Ru=gt,Cu=gt,Pu=gt,ku=gt,Bu=_e,xu=gt,Ou=gt;Lu={version:kl,versions:Bl,arch:Il,platform:Tl,release:Ul,_rawDebug:Nl,moduleLoadList:Dl,binding:Ol,_linkedBinding:jl,_events:Au,_eventsCount:Iu,_maxListeners:Su,on:gt,addListener:Tu,once:Ru,off:Cu,removeListener:Pu,removeAllListeners:ku,emit:Bu,prependListener:xu,prependOnceListener:Ou,listeners:Mu,domain:Fl,_exiting:Wl,config:$l,dlopen:Hl,uptime:Eu,_getActiveRequests:Vl,_getActiveHandles:zl,reallyExit:Kl,_kill:Gl,cpuUsage:Di,resourceUsage:Ql,memoryUsage:Yl,kill:Jl,exit:Xl,openStdin:Zl,allowedNodeEnvironmentFlags:eu,assert:tu,features:ru,_fatalExceptions:iu,setUncaughtExceptionCaptureCallback:nu,hasUncaughtExceptionCaptureCallback:su,emitWarning:xl,nextTick:El,_tickCallback:ou,_debugProcess:au,_debugEnd:lu,_startProfilerIdleNotifier:uu,_stopProfilerIdleNotifier:cu,stdout:fu,stdin:du,stderr:hu,abort:pu,umask:Ml,chdir:ql,cwd:Ll,env:Rl,title:Al,argv:Cl,execArgv:Pl,pid:gu,ppid:bu,execPath:yu,debugPort:wu,hrtime:Ni,argv0:_u,_preload_modules:mu,setSourceMapsEnabled:vu}});var m=Ae(()=>{qu()});var ye={};Ar(ye,{Buffer:()=>x,INSPECT_MAX_BYTES:()=>Kg,default:()=>Bt,kMaxLength:()=>Gg});function Hg(){if(Uu)return si;Uu=!0,si.byteLength=a,si.toByteArray=f,si.fromByteArray=g;for(var t=[],e=[],r=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=i.length;n<o;++n)t[n]=i[n],e[i.charCodeAt(n)]=n;e[45]=62,e[95]=63;function s(b){var E=b.length;if(E%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var w=b.indexOf("=");w===-1&&(w=E);var S=w===E?0:4-w%4;return[w,S]}function a(b){var E=s(b),w=E[0],S=E[1];return(w+S)*3/4-S}function u(b,E,w){return(E+w)*3/4-w}function f(b){var E,w=s(b),S=w[0],I=w[1],C=new r(u(b,S,I)),k=0,M=I>0?S-4:S,q;for(q=0;q<M;q+=4)E=e[b.charCodeAt(q)]<<18|e[b.charCodeAt(q+1)]<<12|e[b.charCodeAt(q+2)]<<6|e[b.charCodeAt(q+3)],C[k++]=E>>16&255,C[k++]=E>>8&255,C[k++]=E&255;return I===2&&(E=e[b.charCodeAt(q)]<<2|e[b.charCodeAt(q+1)]>>4,C[k++]=E&255),I===1&&(E=e[b.charCodeAt(q)]<<10|e[b.charCodeAt(q+1)]<<4|e[b.charCodeAt(q+2)]>>2,C[k++]=E>>8&255,C[k++]=E&255),C}function d(b){return t[b>>18&63]+t[b>>12&63]+t[b>>6&63]+t[b&63]}function h(b,E,w){for(var S,I=[],C=E;C<w;C+=3)S=(b[C]<<16&16711680)+(b[C+1]<<8&65280)+(b[C+2]&255),I.push(d(S));return I.join("")}function g(b){for(var E,w=b.length,S=w%3,I=[],C=16383,k=0,M=w-S;k<M;k+=C)I.push(h(b,k,k+C>M?M:k+C));return S===1?(E=b[w-1],I.push(t[E>>2]+t[E<<4&63]+"==")):S===2&&(E=(b[w-2]<<8)+b[w-1],I.push(t[E>>10]+t[E>>4&63]+t[E<<2&63]+"=")),I.join("")}return si}function Vg(){if(Nu)return ji;Nu=!0;return ji.read=function(t,e,r,i,n){var o,s,a=n*8-i-1,u=(1<<a)-1,f=u>>1,d=-7,h=r?n-1:0,g=r?-1:1,b=t[e+h];for(h+=g,o=b&(1<<-d)-1,b>>=-d,d+=a;d>0;o=o*256+t[e+h],h+=g,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=i;d>0;s=s*256+t[e+h],h+=g,d-=8);if(o===0)o=1-f;else{if(o===u)return s?NaN:(b?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-f}return(b?-1:1)*s*Math.pow(2,o-i)},ji.write=function(t,e,r,i,n,o){var s,a,u,f=o*8-n-1,d=(1<<f)-1,h=d>>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=i?0:o-1,E=i?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+h>=1?e+=g/u:e+=g*Math.pow(2,1-h),e*u>=2&&(s++,u/=2),s+h>=d?(a=0,s=d):s+h>=1?(a=(e*u-1)*Math.pow(2,n),s=s+h):(a=e*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;t[r+b]=a&255,b+=E,a/=256,n-=8);for(s=s<<n|a,f+=n;f>0;t[r+b]=s&255,b+=E,s/=256,f-=8);t[r+b-E]|=w*128},ji}function zg(){if(Du)return Qt;Du=!0;let t=Hg(),e=Vg(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Qt.Buffer=s,Qt.SlowBuffer=I,Qt.INSPECT_MAX_BYTES=50;let i=2147483647;Qt.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=n(),!s.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 n(){try{let p=new Uint8Array(1),l={foo:function(){return 42}};return Object.setPrototypeOf(l,Uint8Array.prototype),Object.setPrototypeOf(p,l),p.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(p){if(p>i)throw new RangeError('The value "'+p+'" is invalid for option "size"');let l=new Uint8Array(p);return Object.setPrototypeOf(l,s.prototype),l}function s(p,l,c){if(typeof p=="number"){if(typeof l=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(p)}return a(p,l,c)}s.poolSize=8192;function a(p,l,c){if(typeof p=="string")return h(p,l);if(ArrayBuffer.isView(p))return b(p);if(p==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p);if(Ge(p,ArrayBuffer)||p&&Ge(p.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ge(p,SharedArrayBuffer)||p&&Ge(p.buffer,SharedArrayBuffer)))return E(p,l,c);if(typeof p=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let y=p.valueOf&&p.valueOf();if(y!=null&&y!==p)return s.from(y,l,c);let A=w(p);if(A)return A;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]=="function")return s.from(p[Symbol.toPrimitive]("string"),l,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p)}s.from=function(p,l,c){return a(p,l,c)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function u(p){if(typeof p!="number")throw new TypeError('"size" argument must be of type number');if(p<0)throw new RangeError('The value "'+p+'" is invalid for option "size"')}function f(p,l,c){return u(p),p<=0?o(p):l!==void 0?typeof c=="string"?o(p).fill(l,c):o(p).fill(l):o(p)}s.alloc=function(p,l,c){return f(p,l,c)};function d(p){return u(p),o(p<0?0:S(p)|0)}s.allocUnsafe=function(p){return d(p)},s.allocUnsafeSlow=function(p){return d(p)};function h(p,l){if((typeof l!="string"||l==="")&&(l="utf8"),!s.isEncoding(l))throw new TypeError("Unknown encoding: "+l);let c=C(p,l)|0,y=o(c),A=y.write(p,l);return A!==c&&(y=y.slice(0,A)),y}function g(p){let l=p.length<0?0:S(p.length)|0,c=o(l);for(let y=0;y<l;y+=1)c[y]=p[y]&255;return c}function b(p){if(Ge(p,Uint8Array)){let l=new Uint8Array(p);return E(l.buffer,l.byteOffset,l.byteLength)}return g(p)}function E(p,l,c){if(l<0||p.byteLength<l)throw new RangeError('"offset" is outside of buffer bounds');if(p.byteLength<l+(c||0))throw new RangeError('"length" is outside of buffer bounds');let y;return l===void 0&&c===void 0?y=new Uint8Array(p):c===void 0?y=new Uint8Array(p,l):y=new Uint8Array(p,l,c),Object.setPrototypeOf(y,s.prototype),y}function w(p){if(s.isBuffer(p)){let l=S(p.length)|0,c=o(l);return c.length===0||p.copy(c,0,0,l),c}if(p.length!==void 0)return typeof p.length!="number"||cs(p.length)?o(0):g(p);if(p.type==="Buffer"&&Array.isArray(p.data))return g(p.data)}function S(p){if(p>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return p|0}function I(p){return+p!=p&&(p=0),s.alloc(+p)}s.isBuffer=function(l){return l!=null&&l._isBuffer===!0&&l!==s.prototype},s.compare=function(l,c){if(Ge(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),Ge(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),!s.isBuffer(l)||!s.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(l===c)return 0;let y=l.length,A=c.length;for(let T=0,P=Math.min(y,A);T<P;++T)if(l[T]!==c[T]){y=l[T],A=c[T];break}return y<A?-1:A<y?1:0},s.isEncoding=function(l){switch(String(l).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(l,c){if(!Array.isArray(l))throw new TypeError('"list" argument must be an Array of Buffers');if(l.length===0)return s.alloc(0);let y;if(c===void 0)for(c=0,y=0;y<l.length;++y)c+=l[y].length;let A=s.allocUnsafe(c),T=0;for(y=0;y<l.length;++y){let P=l[y];if(Ge(P,Uint8Array))T+P.length>A.length?(s.isBuffer(P)||(P=s.from(P)),P.copy(A,T)):Uint8Array.prototype.set.call(A,P,T);else if(s.isBuffer(P))P.copy(A,T);else throw new TypeError('"list" argument must be an Array of Buffers');T+=P.length}return A};function C(p,l){if(s.isBuffer(p))return p.length;if(ArrayBuffer.isView(p)||Ge(p,ArrayBuffer))return p.byteLength;if(typeof p!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof p);let c=p.length,y=arguments.length>2&&arguments[2]===!0;if(!y&&c===0)return 0;let A=!1;for(;;)switch(l){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return us(p).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return ml(p).length;default:if(A)return y?-1:us(p).length;l=(""+l).toLowerCase(),A=!0}}s.byteLength=C;function k(p,l,c){let y=!1;if((l===void 0||l<0)&&(l=0),l>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,l>>>=0,c<=l))return"";for(p||(p="utf8");;)switch(p){case"hex":return kg(this,l,c);case"utf8":case"utf-8":return Se(this,l,c);case"ascii":return as(this,l,c);case"latin1":case"binary":return Pg(this,l,c);case"base64":return Fe(this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bg(this,l,c);default:if(y)throw new TypeError("Unknown encoding: "+p);p=(p+"").toLowerCase(),y=!0}}s.prototype._isBuffer=!0;function M(p,l,c){let y=p[l];p[l]=p[c],p[c]=y}s.prototype.swap16=function(){let l=this.length;if(l%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let c=0;c<l;c+=2)M(this,c,c+1);return this},s.prototype.swap32=function(){let l=this.length;if(l%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let c=0;c<l;c+=4)M(this,c,c+3),M(this,c+1,c+2);return this},s.prototype.swap64=function(){let l=this.length;if(l%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let c=0;c<l;c+=8)M(this,c,c+7),M(this,c+1,c+6),M(this,c+2,c+5),M(this,c+3,c+4);return this},s.prototype.toString=function(){let l=this.length;return l===0?"":arguments.length===0?Se(this,0,l):k.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(l){if(!s.isBuffer(l))throw new TypeError("Argument must be a Buffer");return this===l?!0:s.compare(this,l)===0},s.prototype.inspect=function(){let l="",c=Qt.INSPECT_MAX_BYTES;return l=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(l+=" ... "),"<Buffer "+l+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(l,c,y,A,T){if(Ge(l,Uint8Array)&&(l=s.from(l,l.offset,l.byteLength)),!s.isBuffer(l))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof l);if(c===void 0&&(c=0),y===void 0&&(y=l?l.length:0),A===void 0&&(A=0),T===void 0&&(T=this.length),c<0||y>l.length||A<0||T>this.length)throw new RangeError("out of range index");if(A>=T&&c>=y)return 0;if(A>=T)return-1;if(c>=y)return 1;if(c>>>=0,y>>>=0,A>>>=0,T>>>=0,this===l)return 0;let P=T-A,W=y-c,ae=Math.min(P,W),re=this.slice(A,T),le=l.slice(c,y);for(let J=0;J<ae;++J)if(re[J]!==le[J]){P=re[J],W=le[J];break}return P<W?-1:W<P?1:0};function q(p,l,c,y,A){if(p.length===0)return-1;if(typeof c=="string"?(y=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,cs(c)&&(c=A?0:p.length-1),c<0&&(c=p.length+c),c>=p.length){if(A)return-1;c=p.length-1}else if(c<0)if(A)c=0;else return-1;if(typeof l=="string"&&(l=s.from(l,y)),s.isBuffer(l))return l.length===0?-1:G(p,l,c,y,A);if(typeof l=="number")return l=l&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call(p,l,c):Uint8Array.prototype.lastIndexOf.call(p,l,c):G(p,[l],c,y,A);throw new TypeError("val must be string, number or Buffer")}function G(p,l,c,y,A){let T=1,P=p.length,W=l.length;if(y!==void 0&&(y=String(y).toLowerCase(),y==="ucs2"||y==="ucs-2"||y==="utf16le"||y==="utf-16le")){if(p.length<2||l.length<2)return-1;T=2,P/=2,W/=2,c/=2}function ae(le,J){return T===1?le[J]:le.readUInt16BE(J*T)}let re;if(A){let le=-1;for(re=c;re<P;re++)if(ae(p,re)===ae(l,le===-1?0:re-le)){if(le===-1&&(le=re),re-le+1===W)return le*T}else le!==-1&&(re-=re-le),le=-1}else for(c+W>P&&(c=P-W),re=c;re>=0;re--){let le=!0;for(let J=0;J<W;J++)if(ae(p,re+J)!==ae(l,J)){le=!1;break}if(le)return re}return-1}s.prototype.includes=function(l,c,y){return this.indexOf(l,c,y)!==-1},s.prototype.indexOf=function(l,c,y){return q(this,l,c,y,!0)},s.prototype.lastIndexOf=function(l,c,y){return q(this,l,c,y,!1)};function F(p,l,c,y){c=Number(c)||0;let A=p.length-c;y?(y=Number(y),y>A&&(y=A)):y=A;let T=l.length;y>T/2&&(y=T/2);let P;for(P=0;P<y;++P){let W=parseInt(l.substr(P*2,2),16);if(cs(W))return P;p[c+P]=W}return P}function K(p,l,c,y){return qi(us(l,p.length-c),p,c,y)}function $(p,l,c,y){return qi(Lg(l),p,c,y)}function te(p,l,c,y){return qi(ml(l),p,c,y)}function dt(p,l,c,y){return qi(qg(l,p.length-c),p,c,y)}s.prototype.write=function(l,c,y,A){if(c===void 0)A="utf8",y=this.length,c=0;else if(y===void 0&&typeof c=="string")A=c,y=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(y)?(y=y>>>0,A===void 0&&(A="utf8")):(A=y,y=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let T=this.length-c;if((y===void 0||y>T)&&(y=T),l.length>0&&(y<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");A||(A="utf8");let P=!1;for(;;)switch(A){case"hex":return F(this,l,c,y);case"utf8":case"utf-8":return K(this,l,c,y);case"ascii":case"latin1":case"binary":return $(this,l,c,y);case"base64":return te(this,l,c,y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dt(this,l,c,y);default:if(P)throw new TypeError("Unknown encoding: "+A);A=(""+A).toLowerCase(),P=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Fe(p,l,c){return l===0&&c===p.length?t.fromByteArray(p):t.fromByteArray(p.slice(l,c))}function Se(p,l,c){c=Math.min(p.length,c);let y=[],A=l;for(;A<c;){let T=p[A],P=null,W=T>239?4:T>223?3:T>191?2:1;if(A+W<=c){let ae,re,le,J;switch(W){case 1:T<128&&(P=T);break;case 2:ae=p[A+1],(ae&192)===128&&(J=(T&31)<<6|ae&63,J>127&&(P=J));break;case 3:ae=p[A+1],re=p[A+2],(ae&192)===128&&(re&192)===128&&(J=(T&15)<<12|(ae&63)<<6|re&63,J>2047&&(J<55296||J>57343)&&(P=J));break;case 4:ae=p[A+1],re=p[A+2],le=p[A+3],(ae&192)===128&&(re&192)===128&&(le&192)===128&&(J=(T&15)<<18|(ae&63)<<12|(re&63)<<6|le&63,J>65535&&J<1114112&&(P=J))}}P===null?(P=65533,W=1):P>65535&&(P-=65536,y.push(P>>>10&1023|55296),P=56320|P&1023),y.push(P),A+=W}return vr(y)}let mr=4096;function vr(p){let l=p.length;if(l<=mr)return String.fromCharCode.apply(String,p);let c="",y=0;for(;y<l;)c+=String.fromCharCode.apply(String,p.slice(y,y+=mr));return c}function as(p,l,c){let y="";c=Math.min(p.length,c);for(let A=l;A<c;++A)y+=String.fromCharCode(p[A]&127);return y}function Pg(p,l,c){let y="";c=Math.min(p.length,c);for(let A=l;A<c;++A)y+=String.fromCharCode(p[A]);return y}function kg(p,l,c){let y=p.length;(!l||l<0)&&(l=0),(!c||c<0||c>y)&&(c=y);let A="";for(let T=l;T<c;++T)A+=Ug[p[T]];return A}function Bg(p,l,c){let y=p.slice(l,c),A="";for(let T=0;T<y.length-1;T+=2)A+=String.fromCharCode(y[T]+y[T+1]*256);return A}s.prototype.slice=function(l,c){let y=this.length;l=~~l,c=c===void 0?y:~~c,l<0?(l+=y,l<0&&(l=0)):l>y&&(l=y),c<0?(c+=y,c<0&&(c=0)):c>y&&(c=y),c<l&&(c=l);let A=this.subarray(l,c);return Object.setPrototypeOf(A,s.prototype),A};function be(p,l,c){if(p%1!==0||p<0)throw new RangeError("offset is not uint");if(p+l>c)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(l,c,y){l=l>>>0,c=c>>>0,y||be(l,c,this.length);let A=this[l],T=1,P=0;for(;++P<c&&(T*=256);)A+=this[l+P]*T;return A},s.prototype.readUintBE=s.prototype.readUIntBE=function(l,c,y){l=l>>>0,c=c>>>0,y||be(l,c,this.length);let A=this[l+--c],T=1;for(;c>0&&(T*=256);)A+=this[l+--c]*T;return A},s.prototype.readUint8=s.prototype.readUInt8=function(l,c){return l=l>>>0,c||be(l,1,this.length),this[l]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(l,c){return l=l>>>0,c||be(l,2,this.length),this[l]|this[l+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(l,c){return l=l>>>0,c||be(l,2,this.length),this[l]<<8|this[l+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(l,c){return l=l>>>0,c||be(l,4,this.length),(this[l]|this[l+1]<<8|this[l+2]<<16)+this[l+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(l,c){return l=l>>>0,c||be(l,4,this.length),this[l]*16777216+(this[l+1]<<16|this[l+2]<<8|this[l+3])},s.prototype.readBigUInt64LE=Pt(function(l){l=l>>>0,Sr(l,"offset");let c=this[l],y=this[l+7];(c===void 0||y===void 0)&&ni(l,this.length-8);let A=c+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24,T=this[++l]+this[++l]*2**8+this[++l]*2**16+y*2**24;return BigInt(A)+(BigInt(T)<<BigInt(32))}),s.prototype.readBigUInt64BE=Pt(function(l){l=l>>>0,Sr(l,"offset");let c=this[l],y=this[l+7];(c===void 0||y===void 0)&&ni(l,this.length-8);let A=c*2**24+this[++l]*2**16+this[++l]*2**8+this[++l],T=this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+y;return(BigInt(A)<<BigInt(32))+BigInt(T)}),s.prototype.readIntLE=function(l,c,y){l=l>>>0,c=c>>>0,y||be(l,c,this.length);let A=this[l],T=1,P=0;for(;++P<c&&(T*=256);)A+=this[l+P]*T;return T*=128,A>=T&&(A-=Math.pow(2,8*c)),A},s.prototype.readIntBE=function(l,c,y){l=l>>>0,c=c>>>0,y||be(l,c,this.length);let A=c,T=1,P=this[l+--A];for(;A>0&&(T*=256);)P+=this[l+--A]*T;return T*=128,P>=T&&(P-=Math.pow(2,8*c)),P},s.prototype.readInt8=function(l,c){return l=l>>>0,c||be(l,1,this.length),this[l]&128?(255-this[l]+1)*-1:this[l]},s.prototype.readInt16LE=function(l,c){l=l>>>0,c||be(l,2,this.length);let y=this[l]|this[l+1]<<8;return y&32768?y|4294901760:y},s.prototype.readInt16BE=function(l,c){l=l>>>0,c||be(l,2,this.length);let y=this[l+1]|this[l]<<8;return y&32768?y|4294901760:y},s.prototype.readInt32LE=function(l,c){return l=l>>>0,c||be(l,4,this.length),this[l]|this[l+1]<<8|this[l+2]<<16|this[l+3]<<24},s.prototype.readInt32BE=function(l,c){return l=l>>>0,c||be(l,4,this.length),this[l]<<24|this[l+1]<<16|this[l+2]<<8|this[l+3]},s.prototype.readBigInt64LE=Pt(function(l){l=l>>>0,Sr(l,"offset");let c=this[l],y=this[l+7];(c===void 0||y===void 0)&&ni(l,this.length-8);let A=this[l+4]+this[l+5]*2**8+this[l+6]*2**16+(y<<24);return(BigInt(A)<<BigInt(32))+BigInt(c+this[++l]*2**8+this[++l]*2**16+this[++l]*2**24)}),s.prototype.readBigInt64BE=Pt(function(l){l=l>>>0,Sr(l,"offset");let c=this[l],y=this[l+7];(c===void 0||y===void 0)&&ni(l,this.length-8);let A=(c<<24)+this[++l]*2**16+this[++l]*2**8+this[++l];return(BigInt(A)<<BigInt(32))+BigInt(this[++l]*2**24+this[++l]*2**16+this[++l]*2**8+y)}),s.prototype.readFloatLE=function(l,c){return l=l>>>0,c||be(l,4,this.length),e.read(this,l,!0,23,4)},s.prototype.readFloatBE=function(l,c){return l=l>>>0,c||be(l,4,this.length),e.read(this,l,!1,23,4)},s.prototype.readDoubleLE=function(l,c){return l=l>>>0,c||be(l,8,this.length),e.read(this,l,!0,52,8)},s.prototype.readDoubleBE=function(l,c){return l=l>>>0,c||be(l,8,this.length),e.read(this,l,!1,52,8)};function Ce(p,l,c,y,A,T){if(!s.isBuffer(p))throw new TypeError('"buffer" argument must be a Buffer instance');if(l>A||l<T)throw new RangeError('"value" argument is out of bounds');if(c+y>p.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(l,c,y,A){if(l=+l,c=c>>>0,y=y>>>0,!A){let W=Math.pow(2,8*y)-1;Ce(this,l,c,y,W,0)}let T=1,P=0;for(this[c]=l&255;++P<y&&(T*=256);)this[c+P]=l/T&255;return c+y},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(l,c,y,A){if(l=+l,c=c>>>0,y=y>>>0,!A){let W=Math.pow(2,8*y)-1;Ce(this,l,c,y,W,0)}let T=y-1,P=1;for(this[c+T]=l&255;--T>=0&&(P*=256);)this[c+T]=l/P&255;return c+y},s.prototype.writeUint8=s.prototype.writeUInt8=function(l,c,y){return l=+l,c=c>>>0,y||Ce(this,l,c,1,255,0),this[c]=l&255,c+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(l,c,y){return l=+l,c=c>>>0,y||Ce(this,l,c,2,65535,0),this[c]=l&255,this[c+1]=l>>>8,c+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(l,c,y){return l=+l,c=c>>>0,y||Ce(this,l,c,2,65535,0),this[c]=l>>>8,this[c+1]=l&255,c+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(l,c,y){return l=+l,c=c>>>0,y||Ce(this,l,c,4,4294967295,0),this[c+3]=l>>>24,this[c+2]=l>>>16,this[c+1]=l>>>8,this[c]=l&255,c+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(l,c,y){return l=+l,c=c>>>0,y||Ce(this,l,c,4,4294967295,0),this[c]=l>>>24,this[c+1]=l>>>16,this[c+2]=l>>>8,this[c+3]=l&255,c+4};function dl(p,l,c,y,A){_l(l,y,A,p,c,7);let T=Number(l&BigInt(4294967295));p[c++]=T,T=T>>8,p[c++]=T,T=T>>8,p[c++]=T,T=T>>8,p[c++]=T;let P=Number(l>>BigInt(32)&BigInt(4294967295));return p[c++]=P,P=P>>8,p[c++]=P,P=P>>8,p[c++]=P,P=P>>8,p[c++]=P,c}function pl(p,l,c,y,A){_l(l,y,A,p,c,7);let T=Number(l&BigInt(4294967295));p[c+7]=T,T=T>>8,p[c+6]=T,T=T>>8,p[c+5]=T,T=T>>8,p[c+4]=T;let P=Number(l>>BigInt(32)&BigInt(4294967295));return p[c+3]=P,P=P>>8,p[c+2]=P,P=P>>8,p[c+1]=P,P=P>>8,p[c]=P,c+8}s.prototype.writeBigUInt64LE=Pt(function(l,c=0){return dl(this,l,c,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Pt(function(l,c=0){return pl(this,l,c,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(l,c,y,A){if(l=+l,c=c>>>0,!A){let ae=Math.pow(2,8*y-1);Ce(this,l,c,y,ae-1,-ae)}let T=0,P=1,W=0;for(this[c]=l&255;++T<y&&(P*=256);)l<0&&W===0&&this[c+T-1]!==0&&(W=1),this[c+T]=(l/P>>0)-W&255;return c+y},s.prototype.writeIntBE=function(l,c,y,A){if(l=+l,c=c>>>0,!A){let ae=Math.pow(2,8*y-1);Ce(this,l,c,y,ae-1,-ae)}let T=y-1,P=1,W=0;for(this[c+T]=l&255;--T>=0&&(P*=256);)l<0&&W===0&&this[c+T+1]!==0&&(W=1),this[c+T]=(l/P>>0)-W&255;return c+y},s.prototype.writeInt8=function(l,c,y){return l=+l,c=c>>>0,y||Ce(this,l,c,1,127,-128),l<0&&(l=255+l+1),this[c]=l&255,c+1},s.prototype.writeInt16LE=function(l,c,y){return l=+l,c=c>>>0,y||Ce(this,l,c,2,32767,-32768),this[c]=l&255,this[c+1]=l>>>8,c+2},s.prototype.writeInt16BE=function(l,c,y){return l=+l,c=c>>>0,y||Ce(this,l,c,2,32767,-32768),this[c]=l>>>8,this[c+1]=l&255,c+2},s.prototype.writeInt32LE=function(l,c,y){return l=+l,c=c>>>0,y||Ce(this,l,c,4,2147483647,-2147483648),this[c]=l&255,this[c+1]=l>>>8,this[c+2]=l>>>16,this[c+3]=l>>>24,c+4},s.prototype.writeInt32BE=function(l,c,y){return l=+l,c=c>>>0,y||Ce(this,l,c,4,2147483647,-2147483648),l<0&&(l=4294967295+l+1),this[c]=l>>>24,this[c+1]=l>>>16,this[c+2]=l>>>8,this[c+3]=l&255,c+4},s.prototype.writeBigInt64LE=Pt(function(l,c=0){return dl(this,l,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Pt(function(l,c=0){return pl(this,l,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function gl(p,l,c,y,A,T){if(c+y>p.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function bl(p,l,c,y,A){return l=+l,c=c>>>0,A||gl(p,l,c,4),e.write(p,l,c,y,23,4),c+4}s.prototype.writeFloatLE=function(l,c,y){return bl(this,l,c,!0,y)},s.prototype.writeFloatBE=function(l,c,y){return bl(this,l,c,!1,y)};function yl(p,l,c,y,A){return l=+l,c=c>>>0,A||gl(p,l,c,8),e.write(p,l,c,y,52,8),c+8}s.prototype.writeDoubleLE=function(l,c,y){return yl(this,l,c,!0,y)},s.prototype.writeDoubleBE=function(l,c,y){return yl(this,l,c,!1,y)},s.prototype.copy=function(l,c,y,A){if(!s.isBuffer(l))throw new TypeError("argument should be a Buffer");if(y||(y=0),!A&&A!==0&&(A=this.length),c>=l.length&&(c=l.length),c||(c=0),A>0&&A<y&&(A=y),A===y||l.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(y<0||y>=this.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("sourceEnd out of bounds");A>this.length&&(A=this.length),l.length-c<A-y&&(A=l.length-c+y);let T=A-y;return this===l&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,y,A):Uint8Array.prototype.set.call(l,this.subarray(y,A),c),T},s.prototype.fill=function(l,c,y,A){if(typeof l=="string"){if(typeof c=="string"?(A=c,c=0,y=this.length):typeof y=="string"&&(A=y,y=this.length),A!==void 0&&typeof A!="string")throw new TypeError("encoding must be a string");if(typeof A=="string"&&!s.isEncoding(A))throw new TypeError("Unknown encoding: "+A);if(l.length===1){let P=l.charCodeAt(0);(A==="utf8"&&P<128||A==="latin1")&&(l=P)}}else typeof l=="number"?l=l&255:typeof l=="boolean"&&(l=Number(l));if(c<0||this.length<c||this.length<y)throw new RangeError("Out of range index");if(y<=c)return this;c=c>>>0,y=y===void 0?this.length:y>>>0,l||(l=0);let T;if(typeof l=="number")for(T=c;T<y;++T)this[T]=l;else{let P=s.isBuffer(l)?l:s.from(l,A),W=P.length;if(W===0)throw new TypeError('The value "'+l+'" is invalid for argument "value"');for(T=0;T<y-c;++T)this[T+c]=P[T%W]}return this};let Er={};function ls(p,l,c){Er[p]=class extends c{constructor(){super(),Object.defineProperty(this,"message",{value:l.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${p}]`,this.stack,delete this.name}get code(){return p}set code(A){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:A,writable:!0})}toString(){return`${this.name} [${p}]: ${this.message}`}}}ls("ERR_BUFFER_OUT_OF_BOUNDS",function(p){return p?`${p} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ls("ERR_INVALID_ARG_TYPE",function(p,l){return`The "${p}" argument must be of type number. Received type ${typeof l}`},TypeError),ls("ERR_OUT_OF_RANGE",function(p,l,c){let y=`The value of "${p}" is out of range.`,A=c;return Number.isInteger(c)&&Math.abs(c)>2**32?A=wl(String(c)):typeof c=="bigint"&&(A=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(A=wl(A)),A+="n"),y+=` It must be ${l}. Received ${A}`,y},RangeError);function wl(p){let l="",c=p.length,y=p[0]==="-"?1:0;for(;c>=y+4;c-=3)l=`_${p.slice(c-3,c)}${l}`;return`${p.slice(0,c)}${l}`}function xg(p,l,c){Sr(l,"offset"),(p[l]===void 0||p[l+c]===void 0)&&ni(l,p.length-(c+1))}function _l(p,l,c,y,A,T){if(p>c||p<l){let P=typeof l=="bigint"?"n":"",W;throw T>3?l===0||l===BigInt(0)?W=`>= 0${P} and < 2${P} ** ${(T+1)*8}${P}`:W=`>= -(2${P} ** ${(T+1)*8-1}${P}) and < 2 ** ${(T+1)*8-1}${P}`:W=`>= ${l}${P} and <= ${c}${P}`,new Er.ERR_OUT_OF_RANGE("value",W,p)}xg(y,A,T)}function Sr(p,l){if(typeof p!="number")throw new Er.ERR_INVALID_ARG_TYPE(l,"number",p)}function ni(p,l,c){throw Math.floor(p)!==p?(Sr(p,c),new Er.ERR_OUT_OF_RANGE(c||"offset","an integer",p)):l<0?new Er.ERR_BUFFER_OUT_OF_BOUNDS:new Er.ERR_OUT_OF_RANGE(c||"offset",`>= ${c?1:0} and <= ${l}`,p)}let Og=/[^+/0-9A-Za-z-_]/g;function Mg(p){if(p=p.split("=")[0],p=p.trim().replace(Og,""),p.length<2)return"";for(;p.length%4!==0;)p=p+"=";return p}function us(p,l){l=l||1/0;let c,y=p.length,A=null,T=[];for(let P=0;P<y;++P){if(c=p.charCodeAt(P),c>55295&&c<57344){if(!A){if(c>56319){(l-=3)>-1&&T.push(239,191,189);continue}else if(P+1===y){(l-=3)>-1&&T.push(239,191,189);continue}A=c;continue}if(c<56320){(l-=3)>-1&&T.push(239,191,189),A=c;continue}c=(A-55296<<10|c-56320)+65536}else A&&(l-=3)>-1&&T.push(239,191,189);if(A=null,c<128){if((l-=1)<0)break;T.push(c)}else if(c<2048){if((l-=2)<0)break;T.push(c>>6|192,c&63|128)}else if(c<65536){if((l-=3)<0)break;T.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((l-=4)<0)break;T.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return T}function Lg(p){let l=[];for(let c=0;c<p.length;++c)l.push(p.charCodeAt(c)&255);return l}function qg(p,l){let c,y,A,T=[];for(let P=0;P<p.length&&!((l-=2)<0);++P)c=p.charCodeAt(P),y=c>>8,A=c%256,T.push(A),T.push(y);return T}function ml(p){return t.toByteArray(Mg(p))}function qi(p,l,c,y){let A;for(A=0;A<y&&!(A+c>=l.length||A>=p.length);++A)l[A+c]=p[A];return A}function Ge(p,l){return p instanceof l||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===l.name}function cs(p){return p!==p}let Ug=function(){let p="0123456789abcdef",l=new Array(256);for(let c=0;c<16;++c){let y=c*16;for(let A=0;A<16;++A)l[y+A]=p[c]+p[A]}return l}();function Pt(p){return typeof BigInt>"u"?Ng:p}function Ng(){throw new Error("BigInt not supported")}return Qt}var si,Uu,ji,Nu,Qt,Du,Bt,x,Kg,Gg,he=Ae(()=>{_();v();m();si={},Uu=!1;ji={},Nu=!1;Qt={},Du=!1;Bt=zg();Bt.Buffer;Bt.SlowBuffer;Bt.INSPECT_MAX_BYTES;Bt.kMaxLength;x=Bt.Buffer,Kg=Bt.INSPECT_MAX_BYTES,Gg=Bt.kMaxLength});var v=Ae(()=>{he()});var ju=O(bs=>{"use strict";_();v();m();Object.defineProperty(bs,"__esModule",{value:!0});var gs=class{constructor(e){this.aliasToTopic={},this.max=e}put(e,r){return r===0||r>this.max?!1:(this.aliasToTopic[r]=e,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(e){return this.aliasToTopic[e]}clear(){this.aliasToTopic={}}};bs.default=gs});var ie=O((DA,Fu)=>{"use strict";_();v();m();var ys=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
|
|
2
|
-
`;super(r),this.name="AggregateError",this.errors=e}};Fu.exports={AggregateError:ys,ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},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,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},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,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var ws=O((QA,Wu)=>{"use strict";_();v();m();Wu.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}});var me=O((sI,Vu)=>{"use strict";_();v();m();var{format:Qg,inspect:Fi}=ws(),{AggregateError:Yg}=ie(),Jg=globalThis.AggregateError||Yg,Xg=Symbol("kIsNodeError"),Zg=["string","function","number","object","Function","Object","boolean","bigint","symbol"],eb=/^([A-Z][a-z0-9]*)+$/,tb="__node_internal_",Wi={};function Yt(t,e){if(!t)throw new Wi.ERR_INTERNAL_ASSERTION(e)}function $u(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function rb(t,e,r){if(typeof e=="function")return Yt(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return Yt(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:Qg(e,...r)}function we(t,e,r){r||(r=Error);class i extends r{constructor(...o){super(rb(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[Xg]=!0,Wi[t]=i}function Hu(t){let e=tb+t.name;return Object.defineProperty(t,"name",{value:e}),t}function ib(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Jg([e,t],e.message);return r.code=e.code,r}return t||e}var _s=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Wi.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};we("ERR_ASSERTION","%s",Error);we("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Yt(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],o=[],s=[];for(let u of e)Yt(typeof u=="string","All expected entries have to be of type string"),Zg.includes(u)?n.push(u.toLowerCase()):eb.test(u)?o.push(u):(Yt(u!=="object",'The value "object" should be written as "Object"'),s.push(u));if(o.length>0){let u=n.indexOf("object");u!==-1&&(n.splice(n,u,1),o.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let u=n.pop();i+=`one of type ${n.join(", ")}, or ${u}`}}(o.length>0||s.length>0)&&(i+=" or ")}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let u=o.pop();i+=`an instance of ${o.join(", ")}, or ${u}`}}s.length>0&&(i+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(i+="an "),i+=`${s[0]}`;break;case 2:i+=`one of ${s[0]} or ${s[1]}`;break;default:{let u=s.pop();i+=`one of ${s.join(", ")}, or ${u}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)i+=`. Received an instance of ${r.constructor.name}`;else{let u=Fi(r,{depth:-1});i+=`. Received ${u}`}}else{let u=Fi(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),i+=`. Received type ${typeof r} (${u})`}return i},TypeError);we("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=Fi(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);we("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);we("ERR_MISSING_ARGS",(...t)=>{Yt(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);we("ERR_OUT_OF_RANGE",(t,e,r)=>{Yt(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=$u(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=$u(i)),i+="n"}else i=Fi(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);we("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);we("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);we("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);we("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);we("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);we("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);we("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);we("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);we("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);we("ERR_STREAM_WRITE_AFTER_END","write after end",Error);we("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Vu.exports={AbortError:_s,aggregateTwoErrors:Hu(ib),hideStackFrames:Hu,codes:Wi}});var Tr=O((gI,$i)=>{"use strict";_();v();m();var{AbortController:zu,AbortSignal:nb}=typeof self<"u"?self:typeof window<"u"?window:void 0;$i.exports=zu;$i.exports.AbortSignal=nb;$i.exports.default=zu});function Y(){Y.init.call(this)}function Hi(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function rc(t){return t._maxListeners===void 0?Y.defaultMaxListeners:t._maxListeners}function Yu(t,e,r,i){var n,o,s,a;if(Hi(r),(o=t._events)===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s=="function"?s=o[e]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=rc(t))>0&&s.length>n&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function sb(){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 Ju(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=sb.bind(i);return n.listener=r,i.wrapFn=n,n}function Xu(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?function(o){for(var s=new Array(o.length),a=0;a<s.length;++a)s[a]=o[a].listener||o[a];return s}(n):ic(n,n.length)}function Zu(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}function ic(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}var ec,tc,Rr,Ku,Gu,Qu,Pe,ms=Ae(()=>{_();v();m();Rr=typeof Reflect=="object"?Reflect:null,Ku=Rr&&typeof Rr.apply=="function"?Rr.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};tc=Rr&&typeof Rr.ownKeys=="function"?Rr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Gu=Number.isNaN||function(t){return t!=t};ec=Y,Y.EventEmitter=Y,Y.prototype._events=void 0,Y.prototype._eventsCount=0,Y.prototype._maxListeners=void 0;Qu=10;Object.defineProperty(Y,"defaultMaxListeners",{enumerable:!0,get:function(){return Qu},set:function(t){if(typeof t!="number"||t<0||Gu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Qu=t}}),Y.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},Y.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Gu(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},Y.prototype.getMaxListeners=function(){return rc(this)},Y.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var i=t==="error",n=this._events;if(n!==void 0)i=i&&n.error===void 0;else if(!i)return!1;if(i){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=n[t];if(a===void 0)return!1;if(typeof a=="function")Ku(a,this,e);else{var u=a.length,f=ic(a,u);for(r=0;r<u;++r)Ku(f[r],this,e)}return!0},Y.prototype.addListener=function(t,e){return Yu(this,t,e,!1)},Y.prototype.on=Y.prototype.addListener,Y.prototype.prependListener=function(t,e){return Yu(this,t,e,!0)},Y.prototype.once=function(t,e){return Hi(e),this.on(t,Ju(this,t,e)),this},Y.prototype.prependOnceListener=function(t,e){return Hi(e),this.prependListener(t,Ju(this,t,e)),this},Y.prototype.removeListener=function(t,e){var r,i,n,o,s;if(Hi(e),(i=this._events)===void 0)return this;if((r=i[t])===void 0)return this;if(r===e||r.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||e));else if(typeof r!="function"){for(n=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,n=o;break}if(n<0)return this;n===0?r.shift():function(a,u){for(;u+1<a.length;u++)a[u]=a[u+1];a.pop()}(r,n),r.length===1&&(i[t]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",t,s||e)}return this},Y.prototype.off=Y.prototype.removeListener,Y.prototype.removeAllListeners=function(t){var e,r,i;if((r=this._events)===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var n,o=Object.keys(r);for(i=0;i<o.length;++i)(n=o[i])!=="removeListener"&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=r[t])=="function")this.removeListener(t,e);else if(e!==void 0)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},Y.prototype.listeners=function(t){return Xu(this,t,!0)},Y.prototype.rawListeners=function(t){return Xu(this,t,!1)},Y.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Zu.call(t,e)},Y.prototype.listenerCount=Zu,Y.prototype.eventNames=function(){return this._eventsCount>0?tc(this._events):[]};Pe=ec;Pe.EventEmitter;Pe.defaultMaxListeners;Pe.init;Pe.listenerCount;Pe.EventEmitter;Pe.defaultMaxListeners;Pe.init;Pe.listenerCount});var xt={};Ar(xt,{EventEmitter:()=>ob,default:()=>Pe,defaultMaxListeners:()=>ab,init:()=>lb,listenerCount:()=>ub,on:()=>cb,once:()=>fb});var ob,ab,lb,ub,cb,fb,Ot=Ae(()=>{_();v();m();ms();ms();Pe.once=function(t,e){return new Promise((r,i)=>{function n(...s){o!==void 0&&t.removeListener("error",o),r(s)}let o;e!=="error"&&(o=s=>{t.removeListener(name,n),i(s)},t.once("error",o)),t.once(e,n)})};Pe.on=function(t,e){let r=[],i=[],n=null,o=!1,s={async next(){let f=r.shift();if(f)return createIterResult(f,!1);if(n){let d=Promise.reject(n);return n=null,d}return o?createIterResult(void 0,!0):new Promise((d,h)=>i.push({resolve:d,reject:h}))},async return(){t.removeListener(e,a),t.removeListener("error",u),o=!0;for(let f of i)f.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(f){n=f,t.removeListener(e,a),t.removeListener("error",u)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",u),s;function a(...f){let d=i.shift();d?d.resolve(createIterResult(f,!1)):r.push(f)}function u(f){o=!0;let d=i.shift();d?d.reject(f):n=f,s.return()}};({EventEmitter:ob,defaultMaxListeners:ab,init:lb,listenerCount:ub,on:cb,once:fb}=Pe)});var Ie=O((zI,Es)=>{"use strict";_();v();m();var hb=(he(),Q(ye)),{format:db,inspect:pb}=ws(),{codes:{ERR_INVALID_ARG_TYPE:vs}}=me(),{kResistStopPropagation:gb,AggregateError:bb,SymbolDispose:yb}=ie(),wb=globalThis.AbortSignal||Tr().AbortSignal,_b=globalThis.AbortController||Tr().AbortController,mb=Object.getPrototypeOf(async function(){}).constructor,nc=globalThis.Blob||hb.Blob,vb=typeof nc<"u"?function(e){return e instanceof nc}:function(e){return!1},sc=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new vs(e,"AbortSignal",t)},Eb=(t,e)=>{if(typeof t!="function")throw new vs(e,"Function",t)};Es.exports={AggregateError:bb,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format:db,inspect:pb,types:{isAsyncFunction(t){return t instanceof mb},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:vb,deprecate(t,e){return t},addAbortListener:(Ot(),Q(xt)).addAbortListener||function(e,r){if(e===void 0)throw new vs("signal","AbortSignal",e);sc(e,"signal"),Eb(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[gb]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[yb](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:wb.any||function(e){if(e.length===1)return e[0];let r=new _b,i=()=>r.abort();return e.forEach(n=>{sc(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal}};Es.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Pr=O((rT,gc)=>{"use strict";_();v();m();var{ArrayIsArray:As,ArrayPrototypeIncludes:uc,ArrayPrototypeJoin:cc,ArrayPrototypeMap:Sb,NumberIsInteger:Is,NumberIsNaN:Ab,NumberMAX_SAFE_INTEGER:Ib,NumberMIN_SAFE_INTEGER:Tb,NumberParseInt:Rb,ObjectPrototypeHasOwnProperty:Cb,RegExpPrototypeExec:fc,String:Pb,StringPrototypeToUpperCase:kb,StringPrototypeTrim:Bb}=ie(),{hideStackFrames:Me,codes:{ERR_SOCKET_BAD_PORT:xb,ERR_INVALID_ARG_TYPE:ve,ERR_INVALID_ARG_VALUE:Cr,ERR_OUT_OF_RANGE:Jt,ERR_UNKNOWN_SIGNAL:oc}}=me(),{normalizeEncoding:Ob}=Ie(),{isAsyncFunction:Mb,isArrayBufferView:Lb}=Ie().types,ac={};function qb(t){return t===(t|0)}function Ub(t){return t===t>>>0}var Nb=/^[0-7]+$/,Db="must be a 32-bit unsigned integer or an octal string";function jb(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(fc(Nb,t)===null)throw new Cr(e,t,Db);t=Rb(t,8)}return hc(t,e),t}var Fb=Me((t,e,r=Tb,i=Ib)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!Is(t))throw new Jt(e,"an integer",t);if(t<r||t>i)throw new Jt(e,`>= ${r} && <= ${i}`,t)}),Wb=Me((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!Is(t))throw new Jt(e,"an integer",t);if(t<r||t>i)throw new Jt(e,`>= ${r} && <= ${i}`,t)}),hc=Me((t,e,r=!1)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!Is(t))throw new Jt(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new Jt(e,`>= ${i} && <= ${n}`,t)});function Ts(t,e){if(typeof t!="string")throw new ve(e,"string",t)}function $b(t,e,r=void 0,i){if(typeof t!="number")throw new ve(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Ab(t))throw new Jt(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var Hb=Me((t,e,r)=>{if(!uc(r,t)){let n="must be one of: "+cc(Sb(r,o=>typeof o=="string"?`'${o}'`:Pb(o)),", ");throw new Cr(e,t,n)}});function dc(t,e){if(typeof t!="boolean")throw new ve(e,"boolean",t)}function Ss(t,e,r){return t==null||!Cb(t,e)?r:t[e]}var Vb=Me((t,e,r=null)=>{let i=Ss(r,"allowArray",!1),n=Ss(r,"allowFunction",!1);if(!Ss(r,"nullable",!1)&&t===null||!i&&As(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new ve(e,"Object",t)}),zb=Me((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new ve(e,"a dictionary",t)}),Vi=Me((t,e,r=0)=>{if(!As(t))throw new ve(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new Cr(e,t,i)}});function Kb(t,e){Vi(t,e);for(let r=0;r<t.length;r++)Ts(t[r],`${e}[${r}]`)}function Gb(t,e){Vi(t,e);for(let r=0;r<t.length;r++)dc(t[r],`${e}[${r}]`)}function Qb(t,e){Vi(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new ve(n,"AbortSignal",i);pc(i,n)}}function Yb(t,e="signal"){if(Ts(t,e),ac[t]===void 0)throw ac[kb(t)]!==void 0?new oc(t+" (signals must use all capital letters)"):new oc(t)}var Jb=Me((t,e="buffer")=>{if(!Lb(t))throw new ve(e,["Buffer","TypedArray","DataView"],t)});function Xb(t,e){let r=Ob(e),i=t.length;if(r==="hex"&&i%2!==0)throw new Cr("encoding",e,`is invalid for data of length ${i}`)}function Zb(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Bb(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new xb(e,t,r);return t|0}var pc=Me((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ve(e,"AbortSignal",t)}),ey=Me((t,e)=>{if(typeof t!="function")throw new ve(e,"Function",t)}),ty=Me((t,e)=>{if(typeof t!="function"||Mb(t))throw new ve(e,"Function",t)}),ry=Me((t,e)=>{if(t!==void 0)throw new ve(e,"undefined",t)});function iy(t,e,r){if(!uc(r,t))throw new ve(e,`('${cc(r,"|")}')`,t)}var ny=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function lc(t,e){if(typeof t>"u"||!fc(ny,t))throw new Cr(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function sy(t){if(typeof t=="string")return lc(t,"hints"),t;if(As(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];lc(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new Cr("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}gc.exports={isInt32:qb,isUint32:Ub,parseFileMode:jb,validateArray:Vi,validateStringArray:Kb,validateBooleanArray:Gb,validateAbortSignalArray:Qb,validateBoolean:dc,validateBuffer:Jb,validateDictionary:zb,validateEncoding:Xb,validateFunction:ey,validateInt32:Wb,validateInteger:Fb,validateNumber:$b,validateObject:Vb,validateOneOf:Hb,validatePlainFunction:ty,validatePort:Zb,validateSignalName:Yb,validateString:Ts,validateUint32:hc,validateUndefined:ry,validateUnion:iy,validateAbortSignal:pc,validateLinkHeaderValue:sy}});var Mt=O((hT,_c)=>{_();v();m();var ue=_c.exports={},Qe,Ye;function Rs(){throw new Error("setTimeout has not been defined")}function Cs(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Qe=setTimeout:Qe=Rs}catch{Qe=Rs}try{typeof clearTimeout=="function"?Ye=clearTimeout:Ye=Cs}catch{Ye=Cs}})();function bc(t){if(Qe===setTimeout)return setTimeout(t,0);if((Qe===Rs||!Qe)&&setTimeout)return Qe=setTimeout,setTimeout(t,0);try{return Qe(t,0)}catch{try{return Qe.call(null,t,0)}catch{return Qe.call(this,t,0)}}}function oy(t){if(Ye===clearTimeout)return clearTimeout(t);if((Ye===Cs||!Ye)&&clearTimeout)return Ye=clearTimeout,clearTimeout(t);try{return Ye(t)}catch{try{return Ye.call(null,t)}catch{return Ye.call(this,t)}}}var bt=[],kr=!1,Xt,zi=-1;function ay(){!kr||!Xt||(kr=!1,Xt.length?bt=Xt.concat(bt):zi=-1,bt.length&&yc())}function yc(){if(!kr){var t=bc(ay);kr=!0;for(var e=bt.length;e;){for(Xt=bt,bt=[];++zi<e;)Xt&&Xt[zi].run();zi=-1,e=bt.length}Xt=null,kr=!1,oy(t)}}ue.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];bt.push(new wc(t,e)),bt.length===1&&!kr&&bc(yc)};function wc(t,e){this.fun=t,this.array=e}wc.prototype.run=function(){this.fun.apply(null,this.array)};ue.title="browser";ue.browser=!0;ue.env={};ue.argv=[];ue.version="";ue.versions={};function yt(){}ue.on=yt;ue.addListener=yt;ue.once=yt;ue.off=yt;ue.removeListener=yt;ue.removeAllListeners=yt;ue.emit=yt;ue.prependListener=yt;ue.prependOnceListener=yt;ue.listeners=function(t){return[]};ue.binding=function(t){throw new Error("process.binding is not supported")};ue.cwd=function(){return"/"};ue.chdir=function(t){throw new Error("process.chdir is not supported")};ue.umask=function(){return 0}});var Xe=O((ET,Mc)=>{"use strict";_();v();m();var{SymbolAsyncIterator:mc,SymbolIterator:vc,SymbolFor:Zt}=ie(),Ec=Zt("nodejs.stream.destroyed"),Sc=Zt("nodejs.stream.errored"),Ps=Zt("nodejs.stream.readable"),ks=Zt("nodejs.stream.writable"),Ac=Zt("nodejs.stream.disturbed"),ly=Zt("nodejs.webstream.isClosedPromise"),uy=Zt("nodejs.webstream.controllerErrorFunction");function Ki(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function Gi(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function cy(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function Je(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Ic(t){return!!(t&&!Je(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Tc(t){return!!(t&&!Je(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Rc(t){return!!(t&&!Je(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function fy(t){return Ic(t)||Tc(t)||Rc(t)}function hy(t,e){return t==null?!1:e===!0?typeof t[mc]=="function":e===!1?typeof t[vc]=="function":typeof t[mc]=="function"||typeof t[vc]=="function"}function Qi(t){if(!Je(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[Ec]||i!=null&&i.destroyed)}function Cc(t){if(!Gi(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function dy(t,e){if(!Gi(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function py(t){if(!Ki(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Pc(t,e){if(!Ki(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function kc(t){return t&&t[Ps]!=null?t[Ps]:typeof t?.readable!="boolean"?null:Qi(t)?!1:Ki(t)&&t.readable&&!Pc(t)}function Bc(t){return t&&t[ks]!=null?t[ks]:typeof t?.writable!="boolean"?null:Qi(t)?!1:Gi(t)&&t.writable&&!Cc(t)}function gy(t,e){return Je(t)?Qi(t)?!0:!(e?.readable!==!1&&kc(t)||e?.writable!==!1&&Bc(t)):null}function by(t){var e,r;return Je(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function yy(t){var e,r;return Je(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function wy(t){if(!Je(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&xc(t)?t._closed:null}function xc(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Oc(t){return typeof t._sent100=="boolean"&&xc(t)}function _y(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function my(t){if(!Je(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&Oc(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function vy(t){var e;return!!(t&&((e=t[Ac])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Ey(t){var e,r,i,n,o,s,a,u,f,d;return!!(t&&((e=(r=(i=(n=(o=(s=t[Sc])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&n!==void 0?n:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&i!==void 0?i:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&r!==void 0?r:(f=t._readableState)===null||f===void 0?void 0:f.errored)!==null&&e!==void 0?e:!((d=t._writableState)===null||d===void 0)&&d.errored))}Mc.exports={isDestroyed:Qi,kIsDestroyed:Ec,isDisturbed:vy,kIsDisturbed:Ac,isErrored:Ey,kIsErrored:Sc,isReadable:kc,kIsReadable:Ps,kIsClosedPromise:ly,kControllerErrorFunction:uy,kIsWritable:ks,isClosed:wy,isDuplexNodeStream:cy,isFinished:gy,isIterable:hy,isReadableNodeStream:Ki,isReadableStream:Ic,isReadableEnded:py,isReadableFinished:Pc,isReadableErrored:yy,isNodeStream:Je,isWebStream:fy,isWritable:Bc,isWritableNodeStream:Gi,isWritableStream:Tc,isWritableEnded:Cc,isWritableFinished:dy,isWritableErrored:by,isServerRequest:_y,isServerResponse:Oc,willEmitClose:my,isTransformStream:Rc}});var wt=O((xT,Ls)=>{"use strict";_();v();m();var Lt=Mt(),{AbortError:$c,codes:Sy}=me(),{ERR_INVALID_ARG_TYPE:Ay,ERR_STREAM_PREMATURE_CLOSE:Lc}=Sy,{kEmptyObject:xs,once:Os}=Ie(),{validateAbortSignal:Iy,validateFunction:Ty,validateObject:Ry,validateBoolean:Cy}=Pr(),{Promise:Py,PromisePrototypeThen:ky,SymbolDispose:Hc}=ie(),{isClosed:By,isReadable:qc,isReadableNodeStream:Bs,isReadableStream:xy,isReadableFinished:Uc,isReadableErrored:Nc,isWritable:Dc,isWritableNodeStream:jc,isWritableStream:Oy,isWritableFinished:Fc,isWritableErrored:Wc,isNodeStream:My,willEmitClose:Ly,kIsClosedPromise:qy}=Xe(),Br;function Uy(t){return t.setHeader&&typeof t.abort=="function"}var Ms=()=>{};function Vc(t,e,r){var i,n;if(arguments.length===2?(r=e,e=xs):e==null?e=xs:Ry(e,"options"),Ty(r,"callback"),Iy(e.signal,"options.signal"),r=Os(r),xy(t)||Oy(t))return Ny(t,e,r);if(!My(t))throw new Ay("stream",["ReadableStream","WritableStream","Stream"],t);let o=(i=e.readable)!==null&&i!==void 0?i:Bs(t),s=(n=e.writable)!==null&&n!==void 0?n:jc(t),a=t._writableState,u=t._readableState,f=()=>{t.writable||g()},d=Ly(t)&&Bs(t)===o&&jc(t)===s,h=Fc(t,!1),g=()=>{h=!0,t.destroyed&&(d=!1),!(d&&(!t.readable||o))&&(!o||b)&&r.call(t)},b=Uc(t,!1),E=()=>{b=!0,t.destroyed&&(d=!1),!(d&&(!t.writable||s))&&(!s||h)&&r.call(t)},w=q=>{r.call(t,q)},S=By(t),I=()=>{S=!0;let q=Wc(t)||Nc(t);if(q&&typeof q!="boolean")return r.call(t,q);if(o&&!b&&Bs(t,!0)&&!Uc(t,!1))return r.call(t,new Lc);if(s&&!h&&!Fc(t,!1))return r.call(t,new Lc);r.call(t)},C=()=>{S=!0;let q=Wc(t)||Nc(t);if(q&&typeof q!="boolean")return r.call(t,q);r.call(t)},k=()=>{t.req.on("finish",g)};Uy(t)?(t.on("complete",g),d||t.on("abort",I),t.req?k():t.on("request",k)):s&&!a&&(t.on("end",f),t.on("close",f)),!d&&typeof t.aborted=="boolean"&&t.on("aborted",I),t.on("end",E),t.on("finish",g),e.error!==!1&&t.on("error",w),t.on("close",I),S?Lt.nextTick(I):a!=null&&a.errorEmitted||u!=null&&u.errorEmitted?d||Lt.nextTick(C):(!o&&(!d||qc(t))&&(h||Dc(t)===!1)||!s&&(!d||Dc(t))&&(b||qc(t)===!1)||u&&t.req&&t.aborted)&&Lt.nextTick(C);let M=()=>{r=Ms,t.removeListener("aborted",I),t.removeListener("complete",g),t.removeListener("abort",I),t.removeListener("request",k),t.req&&t.req.removeListener("finish",g),t.removeListener("end",f),t.removeListener("close",f),t.removeListener("finish",g),t.removeListener("end",E),t.removeListener("error",w),t.removeListener("close",I)};if(e.signal&&!S){let q=()=>{let G=r;M(),G.call(t,new $c(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Lt.nextTick(q);else{Br=Br||Ie().addAbortListener;let G=Br(e.signal,q),F=r;r=Os((...K)=>{G[Hc](),F.apply(t,K)})}}return M}function Ny(t,e,r){let i=!1,n=Ms;if(e.signal)if(n=()=>{i=!0,r.call(t,new $c(void 0,{cause:e.signal.reason}))},e.signal.aborted)Lt.nextTick(n);else{Br=Br||Ie().addAbortListener;let s=Br(e.signal,n),a=r;r=Os((...u)=>{s[Hc](),a.apply(t,u)})}let o=(...s)=>{i||Lt.nextTick(()=>r.apply(t,s))};return ky(t[qy].promise,o,o),Ms}function Dy(t,e){var r;let i=!1;return e===null&&(e=xs),(r=e)!==null&&r!==void 0&&r.cleanup&&(Cy(e.cleanup,"cleanup"),i=e.cleanup),new Py((n,o)=>{let s=Vc(t,e,a=>{i&&s(),a?o(a):n()})})}Ls.exports=Vc;Ls.exports.finished=Dy});var er=O((WT,Zc)=>{"use strict";_();v();m();var Ze=Mt(),{aggregateTwoErrors:jy,codes:{ERR_MULTIPLE_CALLBACK:Fy},AbortError:Wy}=me(),{Symbol:Gc}=ie(),{kIsDestroyed:$y,isDestroyed:Hy,isFinished:Vy,isServerRequest:zy}=Xe(),Qc=Gc("kDestroy"),qs=Gc("kConstruct");function Yc(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Ky(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(Yc(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?zc(this,t,e):this.once(Qc,function(o){zc(this,jy(o,t),e)}),this)}function zc(t,e,r){let i=!1;function n(o){if(i)return;i=!0;let s=t._readableState,a=t._writableState;Yc(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?Ze.nextTick(Gy,t,o):Ze.nextTick(Jc,t)}try{t._destroy(e||null,n)}catch(o){n(o)}}function Gy(t,e){Us(t,e),Jc(t)}function Jc(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function Us(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Qy(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function Ns(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?Ze.nextTick(Us,t,e):Us(t,e))}function Yy(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(qs,e),!(t.listenerCount(qs)>1)&&Ze.nextTick(Jy,t)}function Jy(t){let e=!1;function r(i){if(e){Ns(t,i??new Fy);return}e=!0;let n=t._readableState,o=t._writableState,s=o||n;n&&(n.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(Qc,i):i?Ns(t,i,!0):Ze.nextTick(Xy,t)}try{t._construct(i=>{Ze.nextTick(r,i)})}catch(i){Ze.nextTick(r,i)}}function Xy(t){t.emit(qs)}function Kc(t){return t?.setHeader&&typeof t.abort=="function"}function Xc(t){t.emit("close")}function Zy(t,e){t.emit("error",e),Ze.nextTick(Xc,t)}function ew(t,e){!t||Hy(t)||(!e&&!Vy(t)&&(e=new Wy),zy(t)?(t.socket=null,t.destroy(e)):Kc(t)?t.abort():Kc(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Ze.nextTick(Zy,t,e):Ze.nextTick(Xc,t),t.destroyed||(t[$y]=!0))}Zc.exports={construct:Yy,destroyer:ew,destroy:Ky,undestroy:Qy,errorOrDestroy:Ns}});var Xi=O((XT,tf)=>{"use strict";_();v();m();var{ArrayIsArray:tw,ObjectSetPrototypeOf:ef}=ie(),{EventEmitter:Yi}=(Ot(),Q(xt));function Ji(t){Yi.call(this,t)}ef(Ji.prototype,Yi.prototype);ef(Ji,Yi);Ji.prototype.pipe=function(t,e){let r=this;function i(d){t.writable&&t.write(d)===!1&&r.pause&&r.pause()}r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function u(d){f(),Yi.listenerCount(this,"error")===0&&this.emit("error",d)}Ds(r,"error",u),Ds(t,"error",u);function f(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t};function Ds(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):tw(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}tf.exports={Stream:Ji,prependListener:Ds}});var oi=O((lR,Zi)=>{"use strict";_();v();m();var{SymbolDispose:rw}=ie(),{AbortError:rf,codes:iw}=me(),{isNodeStream:nf,isWebStream:nw,kControllerErrorFunction:sw}=Xe(),ow=wt(),{ERR_INVALID_ARG_TYPE:sf}=iw,js,aw=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new sf(e,"AbortSignal",t)};Zi.exports.addAbortSignal=function(e,r){if(aw(e,"signal"),!nf(r)&&!nw(r))throw new sf("stream",["ReadableStream","WritableStream","Stream"],r);return Zi.exports.addAbortSignalNoValidate(e,r)};Zi.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=nf(e)?()=>{e.destroy(new rf(void 0,{cause:t.reason}))}:()=>{e[sw](new rf(void 0,{cause:t.reason}))};if(t.aborted)r();else{js=js||Ie().addAbortListener;let i=js(t,r);ow(e,i[rw])}return e}});var lf=O((_R,af)=>{"use strict";_();v();m();var{StringPrototypeSlice:of,SymbolIterator:lw,TypedArrayPrototypeSet:en,Uint8Array:uw}=ie(),{Buffer:Fs}=(he(),Q(ye)),{inspect:cw}=Ie();af.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return Fs.alloc(0);let r=Fs.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)en(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[lw](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",i=this.head,n=0;do{let o=i.data;if(e>o.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=of(o,0,e),this.head=i,i.data=of(o,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=Fs.allocUnsafe(e),i=e,n=this.head,o=0;do{let s=n.data;if(e>s.length)en(r,s,i-e),e-=s.length;else{e===s.length?(en(r,s,i-e),++o,n.next?this.head=n.next:this.head=this.tail=null):(en(r,new uw(s.buffer,s.byteOffset,e),i-e),this.head=n,n.data=s.slice(e));break}++o}while((n=n.next)!==null);return this.length-=o,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return cw(this,{...r,depth:0,customInspect:!1})}}});var ai=O((PR,hf)=>{"use strict";_();v();m();var{MathFloor:fw,NumberIsInteger:hw}=ie(),{validateInteger:dw}=Pr(),{ERR_INVALID_ARG_VALUE:pw}=me().codes,uf=16*1024,cf=16;function gw(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function ff(t){return t?cf:uf}function bw(t,e){dw(e,"value",0),t?cf=e:uf=e}function yw(t,e,r,i){let n=gw(e,i,r);if(n!=null){if(!hw(n)||n<0){let o=i?`options.${r}`:"options.highWaterMark";throw new pw(o,n)}return fw(n)}return ff(t.objectMode)}hf.exports={getHighWaterMark:yw,getDefaultHighWaterMark:ff,setDefaultHighWaterMark:bw}});var gf=O((Ws,pf)=>{_();v();m();var tn=(he(),Q(ye)),et=tn.Buffer;function df(t,e){for(var r in t)e[r]=t[r]}et.from&&et.alloc&&et.allocUnsafe&&et.allocUnsafeSlow?pf.exports=tn:(df(tn,Ws),Ws.Buffer=tr);function tr(t,e,r){return et(t,e,r)}tr.prototype=Object.create(et.prototype);df(et,tr);tr.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return et(t,e,r)};tr.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=et(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};tr.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return et(t)};tr.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return tn.SlowBuffer(t)}});var wf=O(yf=>{"use strict";_();v();m();var Hs=gf().Buffer,bf=Hs.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function ww(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function _w(t){var e=ww(t);if(typeof e!="string"&&(Hs.isEncoding===bf||!bf(t)))throw new Error("Unknown encoding: "+t);return e||t}yf.StringDecoder=li;function li(t){this.encoding=_w(t);var e;switch(this.encoding){case"utf16le":this.text=Iw,this.end=Tw,e=4;break;case"utf8":this.fillLast=Ew,e=4;break;case"base64":this.text=Rw,this.end=Cw,e=3;break;default:this.write=Pw,this.end=kw;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Hs.allocUnsafe(e)}li.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};li.prototype.end=Aw;li.prototype.text=Sw;li.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function $s(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function mw(t,e,r){var i=e.length-1;if(i<r)return 0;var n=$s(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=$s(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=$s(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function vw(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Ew(t){var e=this.lastTotal-this.lastNeed,r=vw(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Sw(t,e){var r=mw(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function Aw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Iw(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Tw(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Rw(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Cw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Pw(t){return t.toString(this.encoding)}function kw(t){return t&&t.length?this.write(t):""}});var Vs=O((nC,Ef)=>{"use strict";_();v();m();var _f=Mt(),{PromisePrototypeThen:Bw,SymbolAsyncIterator:mf,SymbolIterator:vf}=ie(),{Buffer:xw}=(he(),Q(ye)),{ERR_INVALID_ARG_TYPE:Ow,ERR_STREAM_NULL_VALUES:Mw}=me().codes;function Lw(t,e,r){let i;if(typeof e=="string"||e instanceof xw)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[mf])n=!0,i=e[mf]();else if(e&&e[vf])n=!1,i=e[vf]();else throw new Ow("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,u())},o._destroy=function(f,d){Bw(a(f),()=>_f.nextTick(d,f),h=>_f.nextTick(d,h||f))};async function a(f){let d=f!=null,h=typeof i.throw=="function";if(d&&h){let{value:g,done:b}=await i.throw(f);if(await g,b)return}if(typeof i.return=="function"){let{value:g}=await i.return();await g}}async function u(){for(;;){try{let{value:f,done:d}=n?await i.next():i.next();if(d)o.push(null);else{let h=f&&typeof f.then=="function"?await f:f;if(h===null)throw s=!1,new Mw;if(o.push(h))continue;s=!1}}catch(f){o.destroy(f)}break}}return o}Ef.exports=Lw});var ci=O((pC,jf)=>{"use strict";_();v();m();var We=Mt(),{ArrayPrototypeIndexOf:qw,NumberIsInteger:Uw,NumberIsNaN:Nw,NumberParseInt:Dw,ObjectDefineProperties:Zs,ObjectKeys:jw,ObjectSetPrototypeOf:If,Promise:Tf,SafeSet:Fw,SymbolAsyncDispose:Ww,SymbolAsyncIterator:$w,Symbol:Hw}=ie();jf.exports=j;j.ReadableState=on;var{EventEmitter:Vw}=(Ot(),Q(xt)),{Stream:qt,prependListener:zw}=Xi(),{Buffer:zs}=(he(),Q(ye)),{addAbortSignal:Kw}=oi(),Rf=wt(),H=Ie().debuglog("stream",t=>{H=t}),Gw=lf(),Mr=er(),{getHighWaterMark:Qw,getDefaultHighWaterMark:Yw}=ai(),{aggregateTwoErrors:Sf,codes:{ERR_INVALID_ARG_TYPE:Jw,ERR_METHOD_NOT_IMPLEMENTED:Xw,ERR_OUT_OF_RANGE:Zw,ERR_STREAM_PUSH_AFTER_EOF:e_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:t_},AbortError:r_}=me(),{validateObject:i_}=Pr(),rr=Hw("kPaused"),{StringDecoder:Cf}=wf(),n_=Vs();If(j.prototype,qt.prototype);If(j,qt);var Ks=()=>{},{errorOrDestroy:xr}=Mr,Or=1,s_=2,Pf=4,ui=8,kf=16,rn=32,nn=64,Bf=128,o_=256,a_=512,l_=1024,Js=2048,Xs=4096,u_=8192,c_=16384,f_=32768,xf=65536,h_=1<<17,d_=1<<18;function de(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Zs(on.prototype,{objectMode:de(Or),ended:de(s_),endEmitted:de(Pf),reading:de(ui),constructed:de(kf),sync:de(rn),needReadable:de(nn),emittedReadable:de(Bf),readableListening:de(o_),resumeScheduled:de(a_),errorEmitted:de(l_),emitClose:de(Js),autoDestroy:de(Xs),destroyed:de(u_),closed:de(c_),closeEmitted:de(f_),multiAwaitDrain:de(xf),readingMore:de(h_),dataEmitted:de(d_)});function on(t,e,r){typeof r!="boolean"&&(r=e instanceof tt()),this.state=Js|Xs|kf|rn,t&&t.objectMode&&(this.state|=Or),r&&t&&t.readableObjectMode&&(this.state|=Or),this.highWaterMark=t?Qw(this,t,"readableHighWaterMark",r):Yw(!1),this.buffer=new Gw,this.length=0,this.pipes=[],this.flowing=null,this[rr]=null,t&&t.emitClose===!1&&(this.state&=~Js),t&&t.autoDestroy===!1&&(this.state&=~Xs),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Cf(t.encoding),this.encoding=t.encoding)}function j(t){if(!(this instanceof j))return new j(t);let e=this instanceof tt();this._readableState=new on(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&Kw(t.signal,this)),qt.call(this,t),Mr.construct(this,()=>{this._readableState.needReadable&&sn(this,this._readableState)})}j.prototype.destroy=Mr.destroy;j.prototype._undestroy=Mr.undestroy;j.prototype._destroy=function(t,e){e(t)};j.prototype[Vw.captureRejectionSymbol]=function(t){this.destroy(t)};j.prototype[Ww]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new r_,this.destroy(t)),new Tf((e,r)=>Rf(this,i=>i&&i!==t?r(i):e(null)))};j.prototype.push=function(t,e){return Of(this,t,e,!1)};j.prototype.unshift=function(t,e){return Of(this,t,e,!0)};function Of(t,e,r,i){H("readableAddChunk",e);let n=t._readableState,o;if(n.state&Or||(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=zs.from(e,r).toString(n.encoding):(e=zs.from(e,r),r=""))):e instanceof zs?r="":qt._isUint8Array(e)?(e=qt._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new Jw("chunk",["string","Buffer","Uint8Array"],e))),o)xr(t,o);else if(e===null)n.state&=~ui,b_(t,n);else if(n.state&Or||e&&e.length>0)if(i)if(n.state&Pf)xr(t,new t_);else{if(n.destroyed||n.errored)return!1;Gs(t,n,e,!0)}else if(n.ended)xr(t,new e_);else{if(n.destroyed||n.errored)return!1;n.state&=~ui,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Gs(t,n,e,!1):sn(t,n)):Gs(t,n,e,!1)}else i||(n.state&=~ui,sn(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}function Gs(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&xf?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.state&nn&&an(t)),sn(t,e)}j.prototype.isPaused=function(){let t=this._readableState;return t[rr]===!0||t.flowing===!1};j.prototype.setEncoding=function(t){let e=new Cf(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var p_=1073741824;function g_(t){if(t>p_)throw new Zw("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Af(t,e){return t<=0||e.length===0&&e.ended?0:e.state&Or?1:Nw(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}j.prototype.read=function(t){H("read",t),t===void 0?t=NaN:Uw(t)||(t=Dw(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=g_(t)),t!==0&&(e.state&=~Bf),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return H("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Qs(this):an(this),null;if(t=Af(t,e),t===0&&e.ended)return e.length===0&&Qs(this),null;let i=(e.state&nn)!==0;if(H("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,H("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,H("reading, ended or constructing",i);else if(i){H("do read"),e.state|=ui|rn,e.length===0&&(e.state|=nn);try{this._read(e.highWaterMark)}catch(o){xr(this,o)}e.state&=~rn,e.reading||(t=Af(r,e))}let n;return t>0?n=Nf(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Qs(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function b_(t,e){if(H("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?an(t):(e.needReadable=!1,e.emittedReadable=!0,Mf(t))}}function an(t){let e=t._readableState;H("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(H("emitReadable",e.flowing),e.emittedReadable=!0,We.nextTick(Mf,t))}function Mf(t){let e=t._readableState;H("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,qf(t)}function sn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,We.nextTick(y_,t,e))}function y_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(H("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}j.prototype._read=function(t){throw new Xw("_read()")};j.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new Fw(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),H("pipe count=%d opts=%j",i.pipes.length,e);let o=(!e||e.end!==!1)&&t!==We.stdout&&t!==We.stderr?a:S;i.endEmitted?We.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(I,C){H("onunpipe"),I===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,d())}function a(){H("onend"),t.end()}let u,f=!1;function d(){H("cleanup"),t.removeListener("close",E),t.removeListener("finish",w),u&&t.removeListener("drain",u),t.removeListener("error",b),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",S),r.removeListener("data",g),f=!0,u&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}function h(){f||(i.pipes.length===1&&i.pipes[0]===t?(H("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(H("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),u||(u=w_(r,t),t.on("drain",u))}r.on("data",g);function g(I){H("ondata");let C=t.write(I);H("dest.write",C),C===!1&&h()}function b(I){if(H("onerror",I),S(),t.removeListener("error",b),t.listenerCount("error")===0){let C=t._writableState||t._readableState;C&&!C.errorEmitted?xr(t,I):t.emit("error",I)}}zw(t,"error",b);function E(){t.removeListener("finish",w),S()}t.once("close",E);function w(){H("onfinish"),t.removeListener("close",E),S()}t.once("finish",w);function S(){H("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?h():i.flowing||(H("pipe resume"),r.resume()),t};function w_(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(H("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(H("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}j.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let o=0;o<n.length;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}let i=qw(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};j.prototype.on=function(t,e){let r=qt.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,H("on readable",i.length,i.reading),i.length?an(this):i.reading||We.nextTick(__,this)),r};j.prototype.addListener=j.prototype.on;j.prototype.removeListener=function(t,e){let r=qt.prototype.removeListener.call(this,t,e);return t==="readable"&&We.nextTick(Lf,this),r};j.prototype.off=j.prototype.removeListener;j.prototype.removeAllListeners=function(t){let e=qt.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&We.nextTick(Lf,this),e};function Lf(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[rr]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function __(t){H("readable nexttick read 0"),t.read(0)}j.prototype.resume=function(){let t=this._readableState;return t.flowing||(H("resume"),t.flowing=!t.readableListening,m_(this,t)),t[rr]=!1,this};function m_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,We.nextTick(v_,t,e))}function v_(t,e){H("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),qf(t),e.flowing&&!e.reading&&t.read(0)}j.prototype.pause=function(){return H("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(H("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[rr]=!0,this};function qf(t){let e=t._readableState;for(H("flow",e.flowing);e.flowing&&t.read()!==null;);}j.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{xr(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=jw(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};j.prototype[$w]=function(){return Uf(this)};j.prototype.iterator=function(t){return t!==void 0&&i_(t,"options"),Uf(this,t)};function Uf(t,e){typeof t.read!="function"&&(t=j.wrap(t,{objectMode:!0}));let r=E_(t,e);return r.stream=t,r}async function*E_(t,e){let r=Ks;function i(s){this===t?(r(),r=Ks):r=s}t.on("readable",i);let n,o=Rf(t,{writable:!1},s=>{n=s?Sf(n,s):null,r(),r=Ks});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(n)throw n;if(n===null)return;await new Tf(i)}}}catch(s){throw n=Sf(n,s),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?Mr.destroyer(t,null):(t.off("readable",i),o())}}Zs(j.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},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(t){this._readableState&&(this._readableState.flowing=t)}},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(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});Zs(on.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[rr]!==!1},set(t){this[rr]=!!t}}});j._fromList=Nf;function Nf(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Qs(t){let e=t._readableState;H("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,We.nextTick(S_,e,t))}function S_(t,e){if(H("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)We.nextTick(A_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function A_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}j.from=function(t,e){return n_(j,t,e)};var Ys;function Df(){return Ys===void 0&&(Ys={}),Ys}j.fromWeb=function(t,e){return Df().newStreamReadableFromReadableStream(t,e)};j.toWeb=function(t,e){return Df().newReadableStreamFromStreamReadable(t,e)};j.wrap=function(t,e){var r,i;return new j({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,o){Mr.destroyer(t,n),o(n)}}).wrap(t)}});var hn=O((AC,Xf)=>{"use strict";_();v();m();var ir=Mt(),{ArrayPrototypeSlice:$f,Error:I_,FunctionPrototypeSymbolHasInstance:Hf,ObjectDefineProperty:Vf,ObjectDefineProperties:T_,ObjectSetPrototypeOf:zf,StringPrototypeToLowerCase:R_,Symbol:C_,SymbolHasInstance:P_}=ie();Xf.exports=se;se.WritableState=di;var{EventEmitter:k_}=(Ot(),Q(xt)),fi=Xi().Stream,{Buffer:ln}=(he(),Q(ye)),fn=er(),{addAbortSignal:B_}=oi(),{getHighWaterMark:x_,getDefaultHighWaterMark:O_}=ai(),{ERR_INVALID_ARG_TYPE:M_,ERR_METHOD_NOT_IMPLEMENTED:L_,ERR_MULTIPLE_CALLBACK:Kf,ERR_STREAM_CANNOT_PIPE:q_,ERR_STREAM_DESTROYED:hi,ERR_STREAM_ALREADY_FINISHED:U_,ERR_STREAM_NULL_VALUES:N_,ERR_STREAM_WRITE_AFTER_END:D_,ERR_UNKNOWN_ENCODING:Gf}=me().codes,{errorOrDestroy:Lr}=fn;zf(se.prototype,fi.prototype);zf(se,fi);function ro(){}var qr=C_("kOnFinished");function di(t,e,r){typeof r!="boolean"&&(r=e instanceof tt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?x_(this,t,"writableHighWaterMark",r):O_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=F_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,cn(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[qr]=[]}function cn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}di.prototype.getBuffer=function(){return $f(this.buffered,this.bufferedIndex)};Vf(di.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function se(t){let e=this instanceof tt();if(!e&&!Hf(se,this))return new se(t);this._writableState=new di(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&B_(t.signal,this)),fi.call(this,t),fn.construct(this,()=>{let r=this._writableState;r.writing||no(this,r),so(this,r)})}Vf(se,P_,{__proto__:null,value:function(t){return Hf(this,t)?!0:this!==se?!1:t&&t._writableState instanceof di}});se.prototype.pipe=function(){Lr(this,new q_)};function Qf(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!ln.isEncoding(r))throw new Gf(r);typeof i!="function"&&(i=ro)}if(e===null)throw new N_;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=ln.from(e,r),r="buffer");else if(e instanceof ln)r="buffer";else if(fi._isUint8Array(e))e=fi._uint8ArrayToBuffer(e),r="buffer";else throw new M_("chunk",["string","Buffer","Uint8Array"],e);let o;return n.ending?o=new D_:n.destroyed&&(o=new hi("write")),o?(ir.nextTick(i,o),Lr(t,o,!0),o):(n.pendingcb++,j_(t,n,e,r,i))}se.prototype.write=function(t,e,r){return Qf(this,t,e,r)===!0};se.prototype.cork=function(){this._writableState.corked++};se.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||no(this,t))};se.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=R_(e)),!ln.isEncoding(e))throw new Gf(e);return this._writableState.defaultEncoding=e,this};function j_(t,e,r,i,n){let o=e.objectMode?1:r.length;e.length+=o;let s=e.length<e.highWaterMark;return s||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==ro&&(e.allNoop=!1)):(e.writelen=o,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),s&&!e.errored&&!e.destroyed}function Ff(t,e,r,i,n,o,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new hi("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function Wf(t,e,r,i){--e.pendingcb,i(r),io(e),Lr(t,r)}function F_(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){Lr(t,new Kf);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?ir.nextTick(Wf,t,r,e,n):Wf(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&no(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},ir.nextTick(W_,r.afterWriteTickInfo)):Yf(t,r,1,n))}function W_({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,Yf(t,e,r,i)}function Yf(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&io(e),so(t,e)}function io(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:o,callback:s}=t.buffered[n],a=t.objectMode?1:o.length;t.length-=a,s((e=t.errored)!==null&&e!==void 0?e:new hi("write"))}let r=t[qr].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new hi("end"))}cn(t)}function no(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,o=r.length-i;if(!o)return;let s=i;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?ro:f=>{for(let d=s;d<r.length;++d)r[d].callback(f)},u=e.allNoop&&s===0?r:$f(r,s);u.allBuffers=e.allBuffers,Ff(t,e,!0,e.length,u,"",a),cn(e)}else{do{let{chunk:a,encoding:u,callback:f}=r[s];r[s++]=null;let d=n?1:a.length;Ff(t,e,!1,d,a,u,f)}while(s<r.length&&!e.writing);s===r.length?cn(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}se.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new L_("_write()")};se.prototype._writev=null;se.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let o=Qf(this,t,e);o instanceof I_&&(n=o)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,so(this,i,!0),i.ended=!0):i.finished?n=new U_("end"):i.destroyed&&(n=new hi("end"))),typeof r=="function"&&(n||i.finished?ir.nextTick(r,n):i[qr].push(r)),this};function un(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function $_(t,e){let r=!1;function i(n){if(r){Lr(t,n??Kf());return}if(r=!0,e.pendingcb--,n){let o=e[qr].splice(0);for(let s=0;s<o.length;s++)o[s](n);Lr(t,n,e.sync)}else un(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,ir.nextTick(to,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function H_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,$_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function so(t,e,r){un(e)&&(H_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,ir.nextTick((i,n)=>{un(n)?to(i,n):n.pendingcb--},t,e)):un(e)&&(e.pendingcb++,to(t,e))))}function to(t,e){e.pendingcb--,e.finished=!0;let r=e[qr].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy()}}T_(se.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var V_=fn.destroy;se.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[qr].length)&&ir.nextTick(io,r),V_.call(this,t,e),this};se.prototype._undestroy=fn.undestroy;se.prototype._destroy=function(t,e){e(t)};se.prototype[k_.captureRejectionSymbol]=function(t){this.destroy(t)};var eo;function Jf(){return eo===void 0&&(eo={}),eo}se.fromWeb=function(t,e){return Jf().newStreamWritableFromWritableStream(t,e)};se.toWeb=function(t){return Jf().newWritableStreamFromStreamWritable(t)}});var dh=O((MC,hh)=>{_();v();m();var oo=Mt(),z_=(he(),Q(ye)),{isReadable:K_,isWritable:G_,isIterable:Zf,isNodeStream:Q_,isReadableNodeStream:eh,isWritableNodeStream:th,isDuplexNodeStream:Y_,isReadableStream:rh,isWritableStream:ih}=Xe(),nh=wt(),{AbortError:ch,codes:{ERR_INVALID_ARG_TYPE:J_,ERR_INVALID_RETURN_VALUE:sh}}=me(),{destroyer:Nr}=er(),X_=tt(),fh=ci(),Z_=hn(),{createDeferredPromise:oh}=Ie(),ah=Vs(),lh=globalThis.Blob||z_.Blob,em=typeof lh<"u"?function(e){return e instanceof lh}:function(e){return!1},tm=globalThis.AbortController||Tr().AbortController,{FunctionPrototypeCall:uh}=ie(),Ut=class extends X_{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};hh.exports=function t(e,r){if(Y_(e))return e;if(eh(e))return Ur({readable:e});if(th(e))return Ur({writable:e});if(Q_(e))return Ur({writable:!1,readable:!1});if(rh(e))return Ur({readable:fh.fromWeb(e)});if(ih(e))return Ur({writable:Z_.fromWeb(e)});if(typeof e=="function"){let{value:n,write:o,final:s,destroy:a}=rm(e);if(Zf(n))return ah(Ut,n,{objectMode:!0,write:o,final:s,destroy:a});let u=n?.then;if(typeof u=="function"){let f,d=uh(u,n,h=>{if(h!=null)throw new sh("nully","body",h)},h=>{Nr(f,h)});return f=new Ut({objectMode:!0,readable:!1,write:o,final(h){s(async()=>{try{await d,oo.nextTick(h,null)}catch(g){oo.nextTick(h,g)}})},destroy:a})}throw new sh("Iterable, AsyncIterable or AsyncFunction",r,n)}if(em(e))return t(e.arrayBuffer());if(Zf(e))return ah(Ut,e,{objectMode:!0,writable:!1});if(rh(e?.readable)&&ih(e?.writable))return Ut.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?eh(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?th(e?.writable)?e?.writable:t(e.writable):void 0;return Ur({readable:n,writable:o})}let i=e?.then;if(typeof i=="function"){let n;return uh(i,e,o=>{o!=null&&n.push(o),n.push(null)},o=>{Nr(n,o)}),n=new Ut({objectMode:!0,writable:!1,read(){}})}throw new J_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function rm(t){let{promise:e,resolve:r}=oh(),i=new tm,n=i.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:u,cb:f}=await s;if(oo.nextTick(f),u)return;if(n.aborted)throw new ch(void 0,{cause:n.reason});({promise:e,resolve:r}=oh()),yield a}}(),{signal:n}),write(s,a,u){let f=r;r=null,f({chunk:s,done:!1,cb:u})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){i.abort(),a(s)}}}function Ur(t){let e=t.readable&&typeof t.readable.read!="function"?fh.wrap(t.readable):t.readable,r=t.writable,i=!!K_(e),n=!!G_(r),o,s,a,u,f;function d(h){let g=u;u=null,g?g(h):h&&f.destroy(h)}return f=new Ut({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(nh(r,h=>{n=!1,h&&Nr(e,h),d(h)}),f._write=function(h,g,b){r.write(h,g)?b():o=b},f._final=function(h){r.end(),s=h},r.on("drain",function(){if(o){let h=o;o=null,h()}}),r.on("finish",function(){if(s){let h=s;s=null,h()}})),i&&(nh(e,h=>{i=!1,h&&Nr(e,h),d(h)}),e.on("readable",function(){if(a){let h=a;a=null,h()}}),e.on("end",function(){f.push(null)}),f._read=function(){for(;;){let h=e.read();if(h===null){a=f._read;return}if(!f.push(h))return}}),f._destroy=function(h,g){!h&&u!==null&&(h=new ch),a=null,o=null,s=null,u===null?g(h):(u=g,Nr(r,h),Nr(e,h))},f}});var tt=O((HC,bh)=>{"use strict";_();v();m();var{ObjectDefineProperties:im,ObjectGetOwnPropertyDescriptor:_t,ObjectKeys:nm,ObjectSetPrototypeOf:ph}=ie();bh.exports=$e;var uo=ci(),Le=hn();ph($e.prototype,uo.prototype);ph($e,uo);{let t=nm(Le.prototype);for(let e=0;e<t.length;e++){let r=t[e];$e.prototype[r]||($e.prototype[r]=Le.prototype[r])}}function $e(t){if(!(this instanceof $e))return new $e(t);uo.call(this,t),Le.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}im($e.prototype,{writable:{__proto__:null,..._t(Le.prototype,"writable")},writableHighWaterMark:{__proto__:null,..._t(Le.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,..._t(Le.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,..._t(Le.prototype,"writableBuffer")},writableLength:{__proto__:null,..._t(Le.prototype,"writableLength")},writableFinished:{__proto__:null,..._t(Le.prototype,"writableFinished")},writableCorked:{__proto__:null,..._t(Le.prototype,"writableCorked")},writableEnded:{__proto__:null,..._t(Le.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,..._t(Le.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var ao;function gh(){return ao===void 0&&(ao={}),ao}$e.fromWeb=function(t,e){return gh().newStreamDuplexFromReadableWritablePair(t,e)};$e.toWeb=function(t){return gh().newReadableWritablePairFromDuplex(t)};var lo;$e.from=function(t){return lo||(lo=dh()),lo(t,"body")}});var ho=O((eP,wh)=>{"use strict";_();v();m();var{ObjectSetPrototypeOf:yh,Symbol:sm}=ie();wh.exports=mt;var{ERR_METHOD_NOT_IMPLEMENTED:om}=me().codes,fo=tt(),{getHighWaterMark:am}=ai();yh(mt.prototype,fo.prototype);yh(mt,fo);var pi=sm("kCallback");function mt(t){if(!(this instanceof mt))return new mt(t);let e=t?am(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),fo.call(this,t),this._readableState.sync=!1,this[pi]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",lm)}function co(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function lm(){this._final!==co&&co.call(this)}mt.prototype._final=co;mt.prototype._transform=function(t,e,r){throw new om("_transform()")};mt.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,o=i.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),n.ended||o===i.length||i.length<i.highWaterMark?r():this[pi]=r})};mt.prototype._read=function(){if(this[pi]){let t=this[pi];this[pi]=null,t()}}});var go=O((cP,mh)=>{"use strict";_();v();m();var{ObjectSetPrototypeOf:_h}=ie();mh.exports=Dr;var po=ho();_h(Dr.prototype,po.prototype);_h(Dr,po);function Dr(t){if(!(this instanceof Dr))return new Dr(t);po.call(this,t)}Dr.prototype._transform=function(t,e,r){r(null,t)}});var bn=O((mP,Ih)=>{_();v();m();var gi=Mt(),{ArrayIsArray:um,Promise:cm,SymbolAsyncIterator:fm,SymbolDispose:hm}=ie(),gn=wt(),{once:dm}=Ie(),pm=er(),vh=tt(),{aggregateTwoErrors:gm,codes:{ERR_INVALID_ARG_TYPE:Ao,ERR_INVALID_RETURN_VALUE:bo,ERR_MISSING_ARGS:bm,ERR_STREAM_DESTROYED:ym,ERR_STREAM_PREMATURE_CLOSE:wm},AbortError:_m}=me(),{validateFunction:mm,validateAbortSignal:vm}=Pr(),{isIterable:nr,isReadable:yo,isReadableNodeStream:pn,isNodeStream:Eh,isTransformStream:jr,isWebStream:Em,isReadableStream:wo,isReadableFinished:Sm}=Xe(),Am=globalThis.AbortController||Tr().AbortController,_o,mo,vo;function Sh(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=gn(t,{readable:e,writable:r},o=>{i=!o});return{destroy:o=>{i||(i=!0,pm.destroyer(t,o||new ym("pipe")))},cleanup:n}}function Im(t){return mm(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function Eo(t){if(nr(t))return t;if(pn(t))return Tm(t);throw new Ao("val",["Readable","Iterable","AsyncIterable"],t)}async function*Tm(t){mo||(mo=ci()),yield*mo.prototype[fm].call(t)}async function dn(t,e,r,{end:i}){let n,o=null,s=f=>{if(f&&(n=f),o){let d=o;o=null,d()}},a=()=>new cm((f,d)=>{n?d(n):o=()=>{n?d(n):f()}});e.on("drain",s);let u=gn(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let f of t)e.write(f)||await a();i&&(e.end(),await a()),r()}catch(f){r(n!==f?gm(n,f):f)}finally{u(),e.off("drain",s)}}async function So(t,e,r,{end:i}){jr(e)&&(e=e.writable);let n=e.getWriter();try{for await(let o of t)await n.ready,n.write(o).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(o){try{await n.abort(o),r(o)}catch(s){r(s)}}}function Rm(...t){return Ah(t,dm(Im(t)))}function Ah(t,e,r){if(t.length===1&&um(t[0])&&(t=t[0]),t.length<2)throw new bm("streams");let i=new Am,n=i.signal,o=r?.signal,s=[];vm(o,"options.signal");function a(){E(new _m)}vo=vo||Ie().addAbortListener;let u;o&&(u=vo(o,a));let f,d,h=[],g=0;function b(k){E(k,--g===0)}function E(k,M){var q;if(k&&(!f||f.code==="ERR_STREAM_PREMATURE_CLOSE")&&(f=k),!(!f&&!M)){for(;h.length;)h.shift()(f);(q=u)===null||q===void 0||q[hm](),i.abort(),M&&(f||s.forEach(G=>G()),gi.nextTick(e,f,d))}}let w;for(let k=0;k<t.length;k++){let M=t[k],q=k<t.length-1,G=k>0,F=q||r?.end!==!1,K=k===t.length-1;if(Eh(M)){let $=function(te){te&&te.name!=="AbortError"&&te.code!=="ERR_STREAM_PREMATURE_CLOSE"&&b(te)};var C=$;if(F){let{destroy:te,cleanup:dt}=Sh(M,q,G);h.push(te),yo(M)&&K&&s.push(dt)}M.on("error",$),yo(M)&&K&&s.push(()=>{M.removeListener("error",$)})}if(k===0)if(typeof M=="function"){if(w=M({signal:n}),!nr(w))throw new bo("Iterable, AsyncIterable or Stream","source",w)}else nr(M)||pn(M)||jr(M)?w=M:w=vh.from(M);else if(typeof M=="function"){if(jr(w)){var S;w=Eo((S=w)===null||S===void 0?void 0:S.readable)}else w=Eo(w);if(w=M(w,{signal:n}),q){if(!nr(w,!0))throw new bo("AsyncIterable",`transform[${k-1}]`,w)}else{var I;_o||(_o=go());let $=new _o({objectMode:!0}),te=(I=w)===null||I===void 0?void 0:I.then;if(typeof te=="function")g++,te.call(w,Se=>{d=Se,Se!=null&&$.write(Se),F&&$.end(),gi.nextTick(b)},Se=>{$.destroy(Se),gi.nextTick(b,Se)});else if(nr(w,!0))g++,dn(w,$,b,{end:F});else if(wo(w)||jr(w)){let Se=w.readable||w;g++,dn(Se,$,b,{end:F})}else throw new bo("AsyncIterable or Promise","destination",w);w=$;let{destroy:dt,cleanup:Fe}=Sh(w,!1,!0);h.push(dt),K&&s.push(Fe)}}else if(Eh(M)){if(pn(w)){g+=2;let $=Cm(w,M,b,{end:F});yo(M)&&K&&s.push($)}else if(jr(w)||wo(w)){let $=w.readable||w;g++,dn($,M,b,{end:F})}else if(nr(w))g++,dn(w,M,b,{end:F});else throw new Ao("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=M}else if(Em(M)){if(pn(w))g++,So(Eo(w),M,b,{end:F});else if(wo(w)||nr(w))g++,So(w,M,b,{end:F});else if(jr(w))g++,So(w.readable,M,b,{end:F});else throw new Ao("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=M}else w=vh.from(M)}return(n!=null&&n.aborted||o!=null&&o.aborted)&&gi.nextTick(a),w}function Cm(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new wm)}),t.pipe(e,{end:!1}),i){let s=function(){n=!0,e.end()};var o=s;Sm(t)?gi.nextTick(s):t.once("end",s)}else r();return gn(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(s)}),gn(e,{readable:!1,writable:!0},r)}Ih.exports={pipelineImpl:Ah,pipeline:Rm}});var To=O((kP,Bh)=>{"use strict";_();v();m();var{pipeline:Pm}=bn(),yn=tt(),{destroyer:km}=er(),{isNodeStream:wn,isReadable:Th,isWritable:Rh,isWebStream:Io,isTransformStream:sr,isWritableStream:Ch,isReadableStream:Ph}=Xe(),{AbortError:Bm,codes:{ERR_INVALID_ARG_VALUE:kh,ERR_MISSING_ARGS:xm}}=me(),Om=wt();Bh.exports=function(...e){if(e.length===0)throw new xm("streams");if(e.length===1)return yn.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=yn.from(e[0])),typeof e[e.length-1]=="function"){let b=e.length-1;e[b]=yn.from(e[b])}for(let b=0;b<e.length;++b)if(!(!wn(e[b])&&!Io(e[b]))){if(b<e.length-1&&!(Th(e[b])||Ph(e[b])||sr(e[b])))throw new kh(`streams[${b}]`,r[b],"must be readable");if(b>0&&!(Rh(e[b])||Ch(e[b])||sr(e[b])))throw new kh(`streams[${b}]`,r[b],"must be writable")}let i,n,o,s,a;function u(b){let E=s;s=null,E?E(b):b?a.destroy(b):!g&&!h&&a.destroy()}let f=e[0],d=Pm(e,u),h=!!(Rh(f)||Ch(f)||sr(f)),g=!!(Th(d)||Ph(d)||sr(d));if(a=new yn({writableObjectMode:!!(f!=null&&f.writableObjectMode),readableObjectMode:!!(d!=null&&d.readableObjectMode),writable:h,readable:g}),h){if(wn(f))a._write=function(E,w,S){f.write(E,w)?S():i=S},a._final=function(E){f.end(),n=E},f.on("drain",function(){if(i){let E=i;i=null,E()}});else if(Io(f)){let w=(sr(f)?f.writable:f).getWriter();a._write=async function(S,I,C){try{await w.ready,w.write(S).catch(()=>{}),C()}catch(k){C(k)}},a._final=async function(S){try{await w.ready,w.close().catch(()=>{}),n=S}catch(I){S(I)}}}let b=sr(d)?d.readable:d;Om(b,()=>{if(n){let E=n;n=null,E()}})}if(g){if(wn(d))d.on("readable",function(){if(o){let b=o;o=null,b()}}),d.on("end",function(){a.push(null)}),a._read=function(){for(;;){let b=d.read();if(b===null){o=a._read;return}if(!a.push(b))return}};else if(Io(d)){let E=(sr(d)?d.readable:d).getReader();a._read=async function(){for(;;)try{let{value:w,done:S}=await E.read();if(!a.push(w))return;if(S){a.push(null);return}}catch{return}}}}return a._destroy=function(b,E){!b&&s!==null&&(b=new Bm),o=null,i=null,n=null,s===null?E(b):(s=E,wn(d)&&km(d,b))},a}});var Fh=O((jP,Po)=>{"use strict";_();v();m();var Mm=globalThis.AbortController||Tr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Lm,ERR_INVALID_ARG_TYPE:bi,ERR_MISSING_ARGS:qm,ERR_OUT_OF_RANGE:Um},AbortError:rt}=me(),{validateAbortSignal:or,validateInteger:xh,validateObject:ar}=Pr(),Nm=ie().Symbol("kWeak"),Dm=ie().Symbol("kResistStopPropagation"),{finished:jm}=wt(),Fm=To(),{addAbortSignalNoValidate:Wm}=oi(),{isWritable:$m,isNodeStream:Hm}=Xe(),{deprecate:Vm}=Ie(),{ArrayPrototypePush:zm,Boolean:Km,MathFloor:Oh,Number:Gm,NumberIsNaN:Qm,Promise:Mh,PromiseReject:Lh,PromiseResolve:Ym,PromisePrototypeThen:qh,Symbol:Nh}=ie(),_n=Nh("kEmpty"),Uh=Nh("kEof");function Jm(t,e){if(e!=null&&ar(e,"options"),e?.signal!=null&&or(e.signal,"options.signal"),Hm(t)&&!$m(t))throw new Lm("stream",t,"must be writable");let r=Fm(this,t);return e!=null&&e.signal&&Wm(e.signal,r),r}function mn(t,e){if(typeof t!="function")throw new bi("fn",["Function","AsyncFunction"],t);e!=null&&ar(e,"options"),e?.signal!=null&&or(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Oh(e.concurrency));let i=r-1;return e?.highWaterMark!=null&&(i=Oh(e.highWaterMark)),xh(r,"options.concurrency",1),xh(i,"options.highWaterMark",0),i+=r,async function*(){let o=Ie().AbortSignalAny([e?.signal].filter(Km)),s=this,a=[],u={signal:o},f,d,h=!1,g=0;function b(){h=!0,E()}function E(){g-=1,w()}function w(){d&&!h&&g<r&&a.length<i&&(d(),d=null)}async function S(){try{for await(let I of s){if(h)return;if(o.aborted)throw new rt;try{if(I=t(I,u),I===_n)continue;I=Ym(I)}catch(C){I=Lh(C)}g+=1,qh(I,E,b),a.push(I),f&&(f(),f=null),!h&&(a.length>=i||g>=r)&&await new Mh(C=>{d=C})}a.push(Uh)}catch(I){let C=Lh(I);qh(C,E,b),a.push(C)}finally{h=!0,f&&(f(),f=null)}}S();try{for(;;){for(;a.length>0;){let I=await a[0];if(I===Uh)return;if(o.aborted)throw new rt;I!==_n&&(yield I),a.shift(),w()}await new Mh(I=>{f=I})}}finally{h=!0,d&&(d(),d=null)}}.call(this)}function Xm(t=void 0){return t!=null&&ar(t,"options"),t?.signal!=null&&or(t.signal,"options.signal"),async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new rt({cause:t.signal.reason});yield[r++,n]}}.call(this)}async function Dh(t,e=void 0){for await(let r of Co.call(this,t,e))return!0;return!1}async function Zm(t,e=void 0){if(typeof t!="function")throw new bi("fn",["Function","AsyncFunction"],t);return!await Dh.call(this,async(...r)=>!await t(...r),e)}async function e0(t,e){for await(let r of Co.call(this,t,e))return r}async function t0(t,e){if(typeof t!="function")throw new bi("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),_n}for await(let i of mn.call(this,r,e));}function Co(t,e){if(typeof t!="function")throw new bi("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:_n}return mn.call(this,r,e)}var Ro=class extends qm{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function r0(t,e,r){var i;if(typeof t!="function")throw new bi("reducer",["Function","AsyncFunction"],t);r!=null&&ar(r,"options"),r?.signal!=null&&or(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let f=new rt(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await jm(this.destroy(f)),f}let o=new Mm,s=o.signal;if(r!=null&&r.signal){let f={once:!0,[Nm]:this,[Dm]:!0};r.signal.addEventListener("abort",()=>o.abort(),f)}let a=!1;try{for await(let f of this){var u;if(a=!0,r!=null&&(u=r.signal)!==null&&u!==void 0&&u.aborted)throw new rt;n?e=await t(e,f,{signal:s}):(e=f,n=!0)}if(!a&&!n)throw new Ro}finally{o.abort()}return e}async function i0(t){t!=null&&ar(t,"options"),t?.signal!=null&&or(t.signal,"options.signal");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new rt(void 0,{cause:t.signal.reason});zm(e,i)}return e}function n0(t,e){let r=mn.call(this,t,e);return async function*(){for await(let n of r)yield*n}.call(this)}function jh(t){if(t=Gm(t),Qm(t))return 0;if(t<0)throw new Um("number",">= 0",t);return t}function s0(t,e=void 0){return e!=null&&ar(e,"options"),e?.signal!=null&&or(e.signal,"options.signal"),t=jh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new rt;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new rt;t--<=0&&(yield o)}}.call(this)}function o0(t,e=void 0){return e!=null&&ar(e,"options"),e?.signal!=null&&or(e.signal,"options.signal"),t=jh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new rt;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new rt;if(t-- >0&&(yield o),t<=0)return}}.call(this)}Po.exports.streamReturningOperators={asIndexedPairs:Vm(Xm,"readable.asIndexedPairs will be removed in a future version."),drop:s0,filter:Co,flatMap:n0,map:mn,take:o0,compose:Jm};Po.exports.promiseReturningOperators={every:Zm,forEach:t0,reduce:r0,toArray:i0,some:Dh,find:e0}});var ko=O((YP,Wh)=>{"use strict";_();v();m();var{ArrayPrototypePop:a0,Promise:l0}=ie(),{isIterable:u0,isNodeStream:c0,isWebStream:f0}=Xe(),{pipelineImpl:h0}=bn(),{finished:d0}=wt();Bo();function p0(...t){return new l0((e,r)=>{let i,n,o=t[t.length-1];if(o&&typeof o=="object"&&!c0(o)&&!u0(o)&&!f0(o)){let s=a0(t);i=s.signal,n=s.end}h0(t,(s,a)=>{s?r(s):e(a)},{signal:i,end:n})})}Wh.exports={finished:d0,pipeline:p0}});var Bo=O((ok,Jh)=>{"use strict";_();v();m();var{Buffer:g0}=(he(),Q(ye)),{ObjectDefineProperty:vt,ObjectKeys:Vh,ReflectApply:zh}=ie(),{promisify:{custom:Kh}}=Ie(),{streamReturningOperators:$h,promiseReturningOperators:Hh}=Fh(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Gh}}=me(),b0=To(),{setDefaultHighWaterMark:y0,getDefaultHighWaterMark:w0}=ai(),{pipeline:Qh}=bn(),{destroyer:_0}=er(),Yh=wt(),xo=ko(),yi=Xe(),ee=Jh.exports=Xi().Stream;ee.isDestroyed=yi.isDestroyed;ee.isDisturbed=yi.isDisturbed;ee.isErrored=yi.isErrored;ee.isReadable=yi.isReadable;ee.isWritable=yi.isWritable;ee.Readable=ci();for(let t of Vh($h)){let r=function(...i){if(new.target)throw Gh();return ee.Readable.from(zh(e,this,i))},e=$h[t];vt(r,"name",{__proto__:null,value:e.name}),vt(r,"length",{__proto__:null,value:e.length}),vt(ee.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Vh(Hh)){let r=function(...i){if(new.target)throw Gh();return zh(e,this,i)},e=Hh[t];vt(r,"name",{__proto__:null,value:e.name}),vt(r,"length",{__proto__:null,value:e.length}),vt(ee.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}ee.Writable=hn();ee.Duplex=tt();ee.Transform=ho();ee.PassThrough=go();ee.pipeline=Qh;var{addAbortSignal:m0}=oi();ee.addAbortSignal=m0;ee.finished=Yh;ee.destroy=_0;ee.compose=b0;ee.setDefaultHighWaterMark=y0;ee.getDefaultHighWaterMark=w0;vt(ee,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return xo}});vt(Qh,Kh,{__proto__:null,enumerable:!0,get(){return xo.pipeline}});vt(Yh,Kh,{__proto__:null,enumerable:!0,get(){return xo.finished}});ee.Stream=ee;ee._isUint8Array=function(e){return e instanceof Uint8Array};ee._uint8ArrayToBuffer=function(e){return g0.from(e.buffer,e.byteOffset,e.byteLength)}});var Nt=O((bk,ce)=>{"use strict";_();v();m();var pe=Bo(),v0=ko(),E0=pe.Readable.destroy;ce.exports=pe.Readable;ce.exports._uint8ArrayToBuffer=pe._uint8ArrayToBuffer;ce.exports._isUint8Array=pe._isUint8Array;ce.exports.isDisturbed=pe.isDisturbed;ce.exports.isErrored=pe.isErrored;ce.exports.isReadable=pe.isReadable;ce.exports.Readable=pe.Readable;ce.exports.Writable=pe.Writable;ce.exports.Duplex=pe.Duplex;ce.exports.Transform=pe.Transform;ce.exports.PassThrough=pe.PassThrough;ce.exports.addAbortSignal=pe.addAbortSignal;ce.exports.finished=pe.finished;ce.exports.destroy=pe.destroy;ce.exports.destroy=E0;ce.exports.pipeline=pe.pipeline;ce.exports.compose=pe.compose;Object.defineProperty(pe,"promises",{configurable:!0,enumerable:!0,get(){return v0}});ce.exports.Stream=pe.Stream;ce.exports.default=ce.exports});var Xh=O((Tk,Oo)=>{_();v();m();typeof Object.create=="function"?Oo.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Oo.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var td=O((qk,ed)=>{"use strict";_();v();m();var{Buffer:He}=(he(),Q(ye)),Zh=Symbol.for("BufferList");function Z(t){if(!(this instanceof Z))return new Z(t);Z._init.call(this,t)}Z._init=function(e){Object.defineProperty(this,Zh,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};Z.prototype._new=function(e){return new Z(e)};Z.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let i=0;i<this._bufs.length;i++){let n=r+this._bufs[i].length;if(e<n||i===this._bufs.length-1)return[i,e-r];r=n}};Z.prototype._reverseOffset=function(t){let e=t[0],r=t[1];for(let i=0;i<e;i++)r+=this._bufs[i].length;return r};Z.prototype.get=function(e){if(e>this.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};Z.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};Z.prototype.copy=function(e,r,i,n){if((typeof i!="number"||i<0)&&(i=0),(typeof n!="number"||n>this.length)&&(n=this.length),i>=this.length||n<=0)return e||He.alloc(0);let o=!!e,s=this._offset(i),a=n-i,u=a,f=o&&r||0,d=s[1];if(i===0&&n===this.length){if(!o)return this._bufs.length===1?this._bufs[0]:He.concat(this._bufs,this.length);for(let h=0;h<this._bufs.length;h++)this._bufs[h].copy(e,f),f+=this._bufs[h].length;return e}if(u<=this._bufs[s[0]].length-d)return o?this._bufs[s[0]].copy(e,r,d,d+u):this._bufs[s[0]].slice(d,d+u);o||(e=He.allocUnsafe(a));for(let h=s[0];h<this._bufs.length;h++){let g=this._bufs[h].length-d;if(u>g)this._bufs[h].copy(e,f,d),f+=g;else{this._bufs[h].copy(e,f,d,d+u),f+=g;break}u-=g,d&&(d=0)}return e.length>f?e.slice(0,f):e};Z.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let i=this._offset(e),n=this._offset(r),o=this._bufs.slice(i[0],n[0]+1);return n[1]===0?o.pop():o[o.length-1]=o[o.length-1].slice(0,n[1]),i[1]!==0&&(o[0]=o[0].slice(i[1])),this._new(o)};Z.prototype.toString=function(e,r,i){return this.slice(r,i).toString(e)};Z.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};Z.prototype.duplicate=function(){let e=this._new();for(let r=0;r<this._bufs.length;r++)e.append(this._bufs[r]);return e};Z.prototype.append=function(e){if(e==null)return this;if(e.buffer)this._appendBuffer(He.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let r=0;r<e.length;r++)this.append(e[r]);else if(this._isBufferList(e))for(let r=0;r<e._bufs.length;r++)this.append(e._bufs[r]);else typeof e=="number"&&(e=e.toString()),this._appendBuffer(He.from(e));return this};Z.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length};Z.prototype.indexOf=function(t,e,r){if(r===void 0&&typeof e=="string"&&(r=e,e=void 0),typeof t=="function"||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof t=="number"?t=He.from([t]):typeof t=="string"?t=He.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=He.from(t.buffer,t.byteOffset,t.byteLength):He.isBuffer(t)||(t=He.from(t)),e=Number(e||0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let i=this._offset(e),n=i[0],o=i[1];for(;n<this._bufs.length;n++){let s=this._bufs[n];for(;o<s.length;)if(s.length-o>=t.length){let u=s.indexOf(t,o);if(u!==-1)return this._reverseOffset([n,u]);o=s.length-t.length+1}else{let u=this._reverseOffset([n,o]);if(this._match(u,t))return u;o++}o=0}return-1};Z.prototype._match=function(t,e){if(this.length-t<e.length)return!1;for(let r=0;r<e.length;r++)if(this.get(t+r)!==e[r])return!1;return!0};(function(){let t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readBigInt64BE:8,readBigInt64LE:8,readBigUInt64BE:8,readBigUInt64LE:8,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let e in t)(function(r){t[r]===null?Z.prototype[r]=function(i,n){return this.slice(i,i+n)[r](0,n)}:Z.prototype[r]=function(i=0){return this.slice(i,i+t[r])[r](0)}})(e)})();Z.prototype._isBufferList=function(e){return e instanceof Z||Z.isBufferList(e)};Z.isBufferList=function(e){return e!=null&&e[Zh]};ed.exports=Z});var rd=O((zk,vn)=>{"use strict";_();v();m();var Mo=Nt().Duplex,S0=Xh(),wi=td();function Ee(t){if(!(this instanceof Ee))return new Ee(t);if(typeof t=="function"){this._callback=t;let e=function(i){this._callback&&(this._callback(i),this._callback=null)}.bind(this);this.on("pipe",function(i){i.on("error",e)}),this.on("unpipe",function(i){i.removeListener("error",e)}),t=null}wi._init.call(this,t),Mo.call(this)}S0(Ee,Mo);Object.assign(Ee.prototype,wi.prototype);Ee.prototype._new=function(e){return new Ee(e)};Ee.prototype._write=function(e,r,i){this._appendBuffer(e),typeof i=="function"&&i()};Ee.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)};Ee.prototype.end=function(e){Mo.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)};Ee.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e)};Ee.prototype._isBufferList=function(e){return e instanceof Ee||e instanceof wi||Ee.isBufferList(e)};Ee.isBufferList=wi.isBufferList;vn.exports=Ee;vn.exports.BufferListStream=Ee;vn.exports.BufferList=wi});var nd=O((rB,id)=>{_();v();m();var Lo=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};id.exports=Lo});var qo=O((hB,sd)=>{_();v();m();var L=sd.exports,{Buffer:ke}=(he(),Q(ye));L.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"};L.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};L.requiredHeaderFlagsErrors={};for(let t in L.requiredHeaderFlags){let e=L.requiredHeaderFlags[t];L.requiredHeaderFlagsErrors[t]="Invalid header flag bits, must be 0x"+e.toString(16)+" for "+L.types[t]+" packet"}L.codes={};for(let t in L.types){let e=L.types[t];L.codes[e]=t}L.CMD_SHIFT=4;L.CMD_MASK=240;L.DUP_MASK=8;L.QOS_MASK=3;L.QOS_SHIFT=1;L.RETAIN_MASK=1;L.VARBYTEINT_MASK=127;L.VARBYTEINT_FIN_MASK=128;L.VARBYTEINT_MAX=268435455;L.SESSIONPRESENT_MASK=1;L.SESSIONPRESENT_HEADER=ke.from([L.SESSIONPRESENT_MASK]);L.CONNACK_HEADER=ke.from([L.codes.connack<<L.CMD_SHIFT]);L.USERNAME_MASK=128;L.PASSWORD_MASK=64;L.WILL_RETAIN_MASK=32;L.WILL_QOS_MASK=24;L.WILL_QOS_SHIFT=3;L.WILL_FLAG_MASK=4;L.CLEAN_SESSION_MASK=2;L.CONNECT_HEADER=ke.from([L.codes.connect<<L.CMD_SHIFT]);L.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11};L.propertiesCodes={};for(let t in L.properties){let e=L.properties[t];L.propertiesCodes[e]=t}L.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"};function Dt(t){return[0,1,2].map(e=>[0,1].map(r=>[0,1].map(i=>{let n=ke.alloc(1);return n.writeUInt8(L.codes[t]<<L.CMD_SHIFT|(r?L.DUP_MASK:0)|e<<L.QOS_SHIFT|i,0,!0),n})))}L.PUBLISH_HEADER=Dt("publish");L.SUBSCRIBE_HEADER=Dt("subscribe");L.SUBSCRIBE_OPTIONS_QOS_MASK=3;L.SUBSCRIBE_OPTIONS_NL_MASK=1;L.SUBSCRIBE_OPTIONS_NL_SHIFT=2;L.SUBSCRIBE_OPTIONS_RAP_MASK=1;L.SUBSCRIBE_OPTIONS_RAP_SHIFT=3;L.SUBSCRIBE_OPTIONS_RH_MASK=3;L.SUBSCRIBE_OPTIONS_RH_SHIFT=4;L.SUBSCRIBE_OPTIONS_RH=[0,16,32];L.SUBSCRIBE_OPTIONS_NL=4;L.SUBSCRIBE_OPTIONS_RAP=8;L.SUBSCRIBE_OPTIONS_QOS=[0,1,2];L.UNSUBSCRIBE_HEADER=Dt("unsubscribe");L.ACKS={unsuback:Dt("unsuback"),puback:Dt("puback"),pubcomp:Dt("pubcomp"),pubrel:Dt("pubrel"),pubrec:Dt("pubrec")};L.SUBACK_HEADER=ke.from([L.codes.suback<<L.CMD_SHIFT]);L.VERSION3=ke.from([3]);L.VERSION4=ke.from([4]);L.VERSION5=ke.from([5]);L.VERSION131=ke.from([131]);L.VERSION132=ke.from([132]);L.QOS=[0,1,2].map(t=>ke.from([t]));L.EMPTY={pingreq:ke.from([L.codes.pingreq<<4,0]),pingresp:ke.from([L.codes.pingresp<<4,0]),disconnect:ke.from([L.codes.disconnect<<4,0])};L.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"};L.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"};L.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"};L.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"};L.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"};L.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}});var ad=O((EB,od)=>{_();v();m();var Fr=1e3,Wr=Fr*60,$r=Wr*60,lr=$r*24,A0=lr*7,I0=lr*365.25;od.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return T0(t);if(r==="number"&&isFinite(t))return e.long?C0(t):R0(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function T0(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*I0;case"weeks":case"week":case"w":return r*A0;case"days":case"day":case"d":return r*lr;case"hours":case"hour":case"hrs":case"hr":case"h":return r*$r;case"minutes":case"minute":case"mins":case"min":case"m":return r*Wr;case"seconds":case"second":case"secs":case"sec":case"s":return r*Fr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function R0(t){var e=Math.abs(t);return e>=lr?Math.round(t/lr)+"d":e>=$r?Math.round(t/$r)+"h":e>=Wr?Math.round(t/Wr)+"m":e>=Fr?Math.round(t/Fr)+"s":t+"ms"}function C0(t){var e=Math.abs(t);return e>=lr?En(t,e,lr,"day"):e>=$r?En(t,e,$r,"hour"):e>=Wr?En(t,e,Wr,"minute"):e>=Fr?En(t,e,Fr,"second"):t+" ms"}function En(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var ud=O((xB,ld)=>{_();v();m();function P0(t){r.debug=r,r.default=r,r.coerce=u,r.disable=s,r.enable=n,r.enabled=a,r.humanize=ad(),r.destroy=f,Object.keys(t).forEach(d=>{r[d]=t[d]}),r.names=[],r.skips=[],r.formatters={};function e(d){let h=0;for(let g=0;g<d.length;g++)h=(h<<5)-h+d.charCodeAt(g),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(d){let h,g=null,b,E;function w(...S){if(!w.enabled)return;let I=w,C=Number(new Date),k=C-(h||C);I.diff=k,I.prev=h,I.curr=C,h=C,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let M=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(G,F)=>{if(G==="%%")return"%";M++;let K=r.formatters[F];if(typeof K=="function"){let $=S[M];G=K.call(I,$),S.splice(M,1),M--}return G}),r.formatArgs.call(I,S),(I.log||r.log).apply(I,S)}return w.namespace=d,w.useColors=r.useColors(),w.color=r.selectColor(d),w.extend=i,w.destroy=r.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(b!==r.namespaces&&(b=r.namespaces,E=r.enabled(d)),E),set:S=>{g=S}}),typeof r.init=="function"&&r.init(w),w}function i(d,h){let g=r(this.namespace+(typeof h>"u"?":":h)+d);return g.log=this.log,g}function n(d){r.save(d),r.namespaces=d,r.names=[],r.skips=[];let h=(typeof d=="string"?d:"").trim().replace(" ",",").split(",").filter(Boolean);for(let g of h)g[0]==="-"?r.skips.push(g.slice(1)):r.names.push(g)}function o(d,h){let g=0,b=0,E=-1,w=0;for(;g<d.length;)if(b<h.length&&(h[b]===d[g]||h[b]==="*"))h[b]==="*"?(E=b,w=g,b++):(g++,b++);else if(E!==-1)b=E+1,w++,g=w;else return!1;for(;b<h.length&&h[b]==="*";)b++;return b===h.length}function s(){let d=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),d}function a(d){for(let h of r.skips)if(o(d,h))return!1;for(let h of r.names)if(o(d,h))return!0;return!1}function u(d){return d instanceof Error?d.stack||d.message:d}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}ld.exports=P0});var it=O((Be,Sn)=>{_();v();m();Be.formatArgs=B0;Be.save=x0;Be.load=O0;Be.useColors=k0;Be.storage=M0();Be.destroy=(()=>{let t=!1;return()=>{t||(t=!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`."))}})();Be.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 k0(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return 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 navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function B0(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Sn.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}Be.log=console.debug||console.log||(()=>{});function x0(t){try{t?Be.storage.setItem("debug",t):Be.storage.removeItem("debug")}catch{}}function O0(){let t;try{t=Be.storage.getItem("debug")}catch{}return!t&&typeof R<"u"&&"env"in R&&(t=R.env.DEBUG),t}function M0(){try{return localStorage}catch{}}Sn.exports=ud()(Be);var{formatters:L0}=Sn.exports;L0.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var hd=O((JB,fd)=>{_();v();m();var q0=rd(),{EventEmitter:U0}=(Ot(),Q(xt)),cd=nd(),V=qo(),N=it()("mqtt-packet:parser"),Uo=class t extends U0{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof t?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new t().parser(e)}_resetState(){N("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new cd,this.error=null,this._list=q0(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),N("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++,N("parse: state complete. _stateCounter is now: %d",this._stateCounter),N("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return N("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0),r=e>>V.CMD_SHIFT;this.packet.cmd=V.types[r];let i=e&15,n=V.requiredHeaderFlags[r];return n!=null&&i!==n?this._emitError(new Error(V.requiredHeaderFlagsErrors[r])):(this.packet.retain=(e&V.RETAIN_MASK)!==0,this.packet.qos=e>>V.QOS_SHIFT&V.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(e&V.DUP_MASK)!==0,N("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),N("_parseLength %d",e.value),!!e}_parsePayload(){N("_parsePayload: payload %O",this._list);let e=!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"))}e=!0}return N("_parsePayload complete result: %s",e),e}_parseConnect(){N("_parseConnect");let e,r,i,n,o={},s=this.packet,a=this._parseString();if(a===null)return this._emitError(new Error("Cannot parse protocolId"));if(a!=="MQTT"&&a!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(s.protocolId=a,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.protocolVersion=this._list.readUInt8(this._pos),s.protocolVersion>=128&&(s.bridgeMode=!0,s.protocolVersion=s.protocolVersion-128),s.protocolVersion!==3&&s.protocolVersion!==4&&s.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"));o.username=this._list.readUInt8(this._pos)&V.USERNAME_MASK,o.password=this._list.readUInt8(this._pos)&V.PASSWORD_MASK,o.will=this._list.readUInt8(this._pos)&V.WILL_FLAG_MASK;let u=!!(this._list.readUInt8(this._pos)&V.WILL_RETAIN_MASK),f=(this._list.readUInt8(this._pos)&V.WILL_QOS_MASK)>>V.WILL_QOS_SHIFT;if(o.will)s.will={},s.will.retain=u,s.will.qos=f;else{if(u)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(f)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(s.clean=(this._list.readUInt8(this._pos)&V.CLEAN_SESSION_MASK)!==0,this._pos++,s.keepalive=this._parseNum(),s.keepalive===-1)return this._emitError(new Error("Packet too short"));if(s.protocolVersion===5){let h=this._parseProperties();Object.getOwnPropertyNames(h).length&&(s.properties=h)}let d=this._parseString();if(d===null)return this._emitError(new Error("Packet too short"));if(s.clientId=d,N("_parseConnect: packet.clientId: %s",s.clientId),o.will){if(s.protocolVersion===5){let h=this._parseProperties();Object.getOwnPropertyNames(h).length&&(s.will.properties=h)}if(e=this._parseString(),e===null)return this._emitError(new Error("Cannot parse will topic"));if(s.will.topic=e,N("_parseConnect: packet.will.topic: %s",s.will.topic),r=this._parseBuffer(),r===null)return this._emitError(new Error("Cannot parse will payload"));s.will.payload=r,N("_parseConnect: packet.will.paylaod: %s",s.will.payload)}if(o.username){if(n=this._parseString(),n===null)return this._emitError(new Error("Cannot parse username"));s.username=n,N("_parseConnect: packet.username: %s",s.username)}if(o.password){if(i=this._parseBuffer(),i===null)return this._emitError(new Error("Cannot parse password"));s.password=i}return this.settings=s,N("_parseConnect: complete"),s}_parseConnack(){N("_parseConnack");let e=this.packet;if(this._list.length<1)return null;let r=this._list.readUInt8(this._pos++);if(r>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(e.sessionPresent=!!(r&V.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(e.returnCode===-1||e.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(e.properties=i)}N("_parseConnack: complete")}_parsePublish(){N("_parsePublish");let e=this.packet;if(e.topic=this._parseString(),e.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}e.payload=this._list.slice(this._pos,e.length),N("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){N("_parseSubscribe");let e=this.packet,r,i,n,o,s,a,u;if(e.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let f=this._parseProperties();Object.getOwnPropertyNames(f).length&&(e.properties=f)}if(e.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos<e.length;){if(r=this._parseString(),r===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(i=this._parseByte(),this.settings.protocolVersion===5){if(i&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(i&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(n=i&V.SUBSCRIBE_OPTIONS_QOS_MASK,n>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(a=(i>>V.SUBSCRIBE_OPTIONS_NL_SHIFT&V.SUBSCRIBE_OPTIONS_NL_MASK)!==0,s=(i>>V.SUBSCRIBE_OPTIONS_RAP_SHIFT&V.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,o=i>>V.SUBSCRIBE_OPTIONS_RH_SHIFT&V.SUBSCRIBE_OPTIONS_RH_MASK,o>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));u={topic:r,qos:n},this.settings.protocolVersion===5?(u.nl=a,u.rap=s,u.rh=o):this.settings.bridgeMode&&(u.rh=0,u.rap=!0,u.nl=!0),N("_parseSubscribe: push subscription `%s` to subscription",u),e.subscriptions.push(u)}}}_parseSuback(){N("_parseSuback");let e=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos<this.packet.length;){let r=this._list.readUInt8(this._pos++);if(this.settings.protocolVersion===5){if(!V.MQTT5_SUBACK_CODES[r])return this._emitError(new Error("Invalid suback code"))}else if(r>2&&r!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(r)}}}_parseUnsubscribe(){N("_parseUnsubscribe");let e=this.packet;if(e.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos<e.length;){let r=this._parseString();if(r===null)return this._emitError(new Error("Cannot parse topic"));N("_parseUnsubscribe: push topic `%s` to unsubscriptions",r),e.unsubscriptions.push(r)}}}_parseUnsuback(){N("_parseUnsuback");let e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if((this.settings.protocolVersion===3||this.settings.protocolVersion===4)&&e.length!==2)return this._emitError(new Error("Malformed unsuback, payload length must be 2"));if(e.length<=0)return this._emitError(new Error("Malformed unsuback, no payload specified"));if(this.settings.protocolVersion===5){let r=this._parseProperties();for(Object.getOwnPropertyNames(r).length&&(e.properties=r),e.granted=[];this._pos<this.packet.length;){let i=this._list.readUInt8(this._pos++);if(!V.MQTT5_UNSUBACK_CODES[i])return this._emitError(new Error("Invalid unsuback code"));this.packet.granted.push(i)}}}_parseConfirmation(){N("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let e=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5){if(e.length>2){switch(e.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!V.MQTT5_PUBACK_PUBREC_CODES[e.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!V.MQTT5_PUBREL_PUBCOMP_CODES[e.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}N("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)}else e.reasonCode=0;if(e.length>3){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}}return!0}_parseDisconnect(){let e=this.packet;if(N("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(e.reasonCode=this._parseByte(),V.MQTT5_DISCONNECT_CODES[e.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):e.reasonCode=0;let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}return N("_parseDisconnect result: true"),!0}_parseAuth(){N("_parseAuth");let e=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(e.reasonCode=this._parseByte(),!V.MQTT5_AUTH_CODES[e.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let r=this._parseProperties();return Object.getOwnPropertyNames(r).length&&(e.properties=r),N("_parseAuth: result: true"),!0}_parseMessageId(){let e=this.packet;return e.messageId=this._parseNum(),e.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(N("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){let r=this._parseNum(),i=r+this._pos;if(r===-1||i>this._list.length||i>this.packet.length)return null;let n=this._list.toString("utf8",this._pos,i);return this._pos+=r,N("_parseString: result: %s",n),n}_parseStringPair(){return N("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let e=this._parseNum(),r=e+this._pos;if(e===-1||r>this._list.length||r>this.packet.length)return null;let i=this._list.slice(this._pos,r);return this._pos+=e,N("_parseBuffer: result: %o",i),i}_parseNum(){if(this._list.length-this._pos<2)return-1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,N("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let e=this._list.readUInt32BE(this._pos);return this._pos+=4,N("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){N("_parseVarByteNum");let r=4,i=0,n=1,o=0,s=!1,a,u=this._pos?this._pos:0;for(;i<r&&u+i<this._list.length;){if(a=this._list.readUInt8(u+i++),o+=n*(a&V.VARBYTEINT_MASK),n*=128,!(a&V.VARBYTEINT_FIN_MASK)){s=!0;break}if(this._list.length<=i)break}return!s&&i===r&&this._list.length>=i&&this._emitError(new Error("Invalid variable byte integer")),u&&(this._pos+=i),s?e?s={bytes:i,value:o}:s=o:s=!1,N("_parseVarByteNum: result: %o",s),s}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),N("_parseByte: result: %o",e),e}_parseByType(e){switch(N("_parseByType: type: %s",e),e){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){N("_parseProperties");let e=this._parseVarByteNum(),i=this._pos+e,n={};for(;this._pos<i;){let o=this._parseByte();if(!o)return this._emitError(new Error("Cannot parse property code type")),!1;let s=V.propertiesCodes[o];if(!s)return this._emitError(new Error("Unknown property")),!1;if(s==="userProperties"){n[s]||(n[s]=Object.create(null));let a=this._parseByType(V.propertiesTypes[s]);if(n[s][a.name])if(Array.isArray(n[s][a.name]))n[s][a.name].push(a.value);else{let u=n[s][a.name];n[s][a.name]=[u],n[s][a.name].push(a.value)}else n[s][a.name]=a.value;continue}n[s]?Array.isArray(n[s])?n[s].push(this._parseByType(V.propertiesTypes[s])):(n[s]=[n[s]],n[s].push(this._parseByType(V.propertiesTypes[s]))):n[s]=this._parseByType(V.propertiesTypes[s])}return n}_newPacket(){return N("_newPacket"),this.packet&&(this._list.consume(this.packet.length),N("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),N("_newPacket: new packet"),this.packet=new cd,this._pos=0,!0}_emitError(e){N("_emitError",e),this.error=e,this.emit("error",e)}};fd.exports=Uo});var bd=O((ax,gd)=>{_();v();m();var{Buffer:_i}=(he(),Q(ye)),N0=65536,dd={},D0=_i.isBuffer(_i.from([1,2]).subarray(0,1));function pd(t){let e=_i.allocUnsafe(2);return e.writeUInt8(t>>8,0),e.writeUInt8(t&255,1),e}function j0(){for(let t=0;t<N0;t++)dd[t]=pd(t)}function F0(t){let r=0,i=0,n=_i.allocUnsafe(4);do r=t%128|0,t=t/128|0,t>0&&(r=r|128),n.writeUInt8(r,i++);while(t>0&&i<4);return t>0&&(i=0),D0?n.subarray(0,i):n.slice(0,i)}function W0(t){let e=_i.allocUnsafe(4);return e.writeUInt32BE(t,0),e}gd.exports={cache:dd,generateCache:j0,generateNumber:pd,genBufVariableByteInt:F0,generate4ByteBuffer:W0}});var yd=O((yx,No)=>{"use strict";_();v();m();typeof R>"u"||!R.version||R.version.indexOf("v0.")===0||R.version.indexOf("v1.")===0&&R.version.indexOf("v1.8.")!==0?No.exports={nextTick:$0}:No.exports=R;function $0(t,e,r,i){if(typeof t!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,o,s;switch(n){case 0:case 1:return R.nextTick(t);case 2:return R.nextTick(function(){t.call(null,e)});case 3:return R.nextTick(function(){t.call(null,e,r)});case 4:return R.nextTick(function(){t.call(null,e,r,i)});default:for(o=new Array(n-1),s=0;s<o.length;)o[s++]=arguments[s];return R.nextTick(function(){t.apply(null,o)})}}});var Fo=O((Cx,Id)=>{_();v();m();var D=qo(),{Buffer:U}=(he(),Q(ye)),H0=U.allocUnsafe(0),V0=U.from([0]),mi=bd(),z0=yd().nextTick,qe=it()("mqtt-packet:writeToStream"),An=mi.cache,K0=mi.generateNumber,G0=mi.generateCache,Do=mi.genBufVariableByteInt,Q0=mi.generate4ByteBuffer,Te=jo,In=!0;function Sd(t,e,r){switch(qe("generate called"),e.cork&&(e.cork(),z0(Y0,e)),In&&(In=!1,G0()),qe("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return J0(t,e,r);case"connack":return X0(t,e,r);case"publish":return Z0(t,e,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return ev(t,e,r);case"subscribe":return tv(t,e,r);case"suback":return rv(t,e,r);case"unsubscribe":return iv(t,e,r);case"unsuback":return nv(t,e,r);case"pingreq":case"pingresp":return sv(t,e,r);case"disconnect":return ov(t,e,r);case"auth":return av(t,e,r);default:return e.destroy(new Error("Unknown command")),!1}}Object.defineProperty(Sd,"cacheNumbers",{get(){return Te===jo},set(t){t?((!An||Object.keys(An).length===0)&&(In=!0),Te=jo):(In=!1,Te=lv)}});function Y0(t){t.uncork()}function J0(t,e,r){let i=t||{},n=i.protocolId||"MQTT",o=i.protocolVersion||4,s=i.will,a=i.clean,u=i.keepalive||0,f=i.clientId||"",d=i.username,h=i.password,g=i.properties;a===void 0&&(a=!0);let b=0;if(!n||typeof n!="string"&&!U.isBuffer(n))return e.destroy(new Error("Invalid protocolId")),!1;if(b+=n.length+2,o!==3&&o!==4&&o!==5)return e.destroy(new Error("Invalid protocol version")),!1;if(b+=1,(typeof f=="string"||U.isBuffer(f))&&(f||o>=4)&&(f||a))b+=U.byteLength(f)+2;else{if(o<4)return e.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(a*1===0)return e.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof u!="number"||u<0||u>65535||u%1!==0)return e.destroy(new Error("Invalid keepalive")),!1;b+=2,b+=1;let E,w;if(o===5){if(E=jt(e,g),!E)return!1;b+=E.length}if(s){if(typeof s!="object")return e.destroy(new Error("Invalid will")),!1;if(!s.topic||typeof s.topic!="string")return e.destroy(new Error("Invalid will topic")),!1;if(b+=U.byteLength(s.topic)+2,b+=2,s.payload)if(s.payload.length>=0)typeof s.payload=="string"?b+=U.byteLength(s.payload):b+=s.payload.length;else return e.destroy(new Error("Invalid will payload")),!1;if(w={},o===5){if(w=jt(e,s.properties),!w)return!1;b+=w.length}}let S=!1;if(d!=null)if(Ed(d))S=!0,b+=U.byteLength(d)+2;else return e.destroy(new Error("Invalid username")),!1;if(h!=null){if(!S)return e.destroy(new Error("Username is required to use password")),!1;if(Ed(h))b+=Ad(h)+2;else return e.destroy(new Error("Invalid password")),!1}e.write(D.CONNECT_HEADER),Ue(e,b),Hr(e,n),i.bridgeMode&&(o+=128),e.write(o===131?D.VERSION131:o===132?D.VERSION132:o===4?D.VERSION4:o===5?D.VERSION5:D.VERSION3);let I=0;return I|=d!=null?D.USERNAME_MASK:0,I|=h!=null?D.PASSWORD_MASK:0,I|=s&&s.retain?D.WILL_RETAIN_MASK:0,I|=s&&s.qos?s.qos<<D.WILL_QOS_SHIFT:0,I|=s?D.WILL_FLAG_MASK:0,I|=a?D.CLEAN_SESSION_MASK:0,e.write(U.from([I])),Te(e,u),o===5&&E.write(),Hr(e,f),s&&(o===5&&w.write(),ur(e,s.topic),Hr(e,s.payload)),d!=null&&Hr(e,d),h!=null&&Hr(e,h),!0}function X0(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=i===5?n.reasonCode:n.returnCode,s=n.properties,a=2;if(typeof o!="number")return e.destroy(new Error("Invalid return code")),!1;let u=null;if(i===5){if(u=jt(e,s),!u)return!1;a+=u.length}return e.write(D.CONNACK_HEADER),Ue(e,a),e.write(n.sessionPresent?D.SESSIONPRESENT_HEADER:V0),e.write(U.from([o])),u?.write(),!0}function Z0(t,e,r){qe("publish: packet: %o",t);let i=r?r.protocolVersion:4,n=t||{},o=n.qos||0,s=n.retain?D.RETAIN_MASK:0,a=n.topic,u=n.payload||H0,f=n.messageId,d=n.properties,h=0;if(typeof a=="string")h+=U.byteLength(a)+2;else if(U.isBuffer(a))h+=a.length+2;else return e.destroy(new Error("Invalid topic")),!1;if(U.isBuffer(u)?h+=u.length:h+=U.byteLength(u),o&&typeof f!="number")return e.destroy(new Error("Invalid messageId")),!1;o&&(h+=2);let g=null;if(i===5){if(g=jt(e,d),!g)return!1;h+=g.length}return e.write(D.PUBLISH_HEADER[o][n.dup?1:0][s?1:0]),Ue(e,h),Te(e,Ad(a)),e.write(a),o>0&&Te(e,f),g?.write(),qe("publish: payload: %o",u),e.write(u)}function ev(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.cmd||"puback",s=n.messageId,a=n.dup&&o==="pubrel"?D.DUP_MASK:0,u=0,f=n.reasonCode,d=n.properties,h=i===5?3:2;if(o==="pubrel"&&(u=1),typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;let g=null;if(i===5&&typeof d=="object"){if(g=vi(e,d,r,h),!g)return!1;h+=g.length}return e.write(D.ACKS[o][u][a][0]),h===3&&(h+=f!==0?1:-1),Ue(e,h),Te(e,s),i===5&&h!==2&&e.write(U.from([f])),g!==null?g.write():h===4&&e.write(U.from([0])),!0}function tv(t,e,r){qe("subscribe: packet: ");let i=r?r.protocolVersion:4,n=t||{},o=n.dup?D.DUP_MASK:0,s=n.messageId,a=n.subscriptions,u=n.properties,f=0;if(typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;f+=2;let d=null;if(i===5){if(d=jt(e,u),!d)return!1;f+=d.length}if(typeof a=="object"&&a.length)for(let g=0;g<a.length;g+=1){let b=a[g].topic,E=a[g].qos;if(typeof b!="string")return e.destroy(new Error("Invalid subscriptions - invalid topic")),!1;if(typeof E!="number")return e.destroy(new Error("Invalid subscriptions - invalid qos")),!1;if(i===5){if(typeof(a[g].nl||!1)!="boolean")return e.destroy(new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(a[g].rap||!1)!="boolean")return e.destroy(new Error("Invalid subscriptions - invalid Retain as Published")),!1;let I=a[g].rh||0;if(typeof I!="number"||I>2)return e.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}f+=U.byteLength(b)+2+1}else return e.destroy(new Error("Invalid subscriptions")),!1;qe("subscribe: writing to stream: %o",D.SUBSCRIBE_HEADER),e.write(D.SUBSCRIBE_HEADER[1][o?1:0][0]),Ue(e,f),Te(e,s),d!==null&&d.write();let h=!0;for(let g of a){let b=g.topic,E=g.qos,w=+g.nl,S=+g.rap,I=g.rh,C;ur(e,b),C=D.SUBSCRIBE_OPTIONS_QOS[E],i===5&&(C|=w?D.SUBSCRIBE_OPTIONS_NL:0,C|=S?D.SUBSCRIBE_OPTIONS_RAP:0,C|=I?D.SUBSCRIBE_OPTIONS_RH[I]:0),h=e.write(U.from([C]))}return h}function rv(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.granted,a=n.properties,u=0;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;if(u+=2,typeof s=="object"&&s.length)for(let d=0;d<s.length;d+=1){if(typeof s[d]!="number")return e.destroy(new Error("Invalid qos vector")),!1;u+=1}else return e.destroy(new Error("Invalid qos vector")),!1;let f=null;if(i===5){if(f=vi(e,a,r,u),!f)return!1;u+=f.length}return e.write(D.SUBACK_HEADER),Ue(e,u),Te(e,o),f!==null&&f.write(),e.write(U.from(s))}function iv(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.dup?D.DUP_MASK:0,a=n.unsubscriptions,u=n.properties,f=0;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;if(f+=2,typeof a=="object"&&a.length)for(let g=0;g<a.length;g+=1){if(typeof a[g]!="string")return e.destroy(new Error("Invalid unsubscriptions")),!1;f+=U.byteLength(a[g])+2}else return e.destroy(new Error("Invalid unsubscriptions")),!1;let d=null;if(i===5){if(d=jt(e,u),!d)return!1;f+=d.length}e.write(D.UNSUBSCRIBE_HEADER[1][s?1:0][0]),Ue(e,f),Te(e,o),d!==null&&d.write();let h=!0;for(let g=0;g<a.length;g++)h=ur(e,a[g]);return h}function nv(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.dup?D.DUP_MASK:0,a=n.granted,u=n.properties,f=n.cmd,d=0,h=2;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;if(i===5)if(typeof a=="object"&&a.length)for(let b=0;b<a.length;b+=1){if(typeof a[b]!="number")return e.destroy(new Error("Invalid qos vector")),!1;h+=1}else return e.destroy(new Error("Invalid qos vector")),!1;let g=null;if(i===5){if(g=vi(e,u,r,h),!g)return!1;h+=g.length}return e.write(D.ACKS[f][d][s][0]),Ue(e,h),Te(e,o),g!==null&&g.write(),i===5&&e.write(U.from(a)),!0}function sv(t,e,r){return e.write(D.EMPTY[t.cmd])}function ov(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.reasonCode,s=n.properties,a=i===5?1:0,u=null;if(i===5){if(u=vi(e,s,r,a),!u)return!1;a+=u.length}return e.write(U.from([D.codes.disconnect<<4])),Ue(e,a),i===5&&e.write(U.from([o])),u!==null&&u.write(),!0}function av(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.reasonCode,s=n.properties,a=i===5?1:0;i!==5&&e.destroy(new Error("Invalid mqtt version for auth packet"));let u=vi(e,s,r,a);return u?(a+=u.length,e.write(U.from([D.codes.auth<<4])),Ue(e,a),e.write(U.from([o])),u!==null&&u.write(),!0):!1}var wd={};function Ue(t,e){if(e>D.VARBYTEINT_MAX)return t.destroy(new Error(`Invalid variable byte integer: ${e}`)),!1;let r=wd[e];return r||(r=Do(e),e<16384&&(wd[e]=r)),qe("writeVarByteInt: writing to stream: %o",r),t.write(r)}function ur(t,e){let r=U.byteLength(e);return Te(t,r),qe("writeString: %s",e),t.write(e,"utf8")}function _d(t,e,r){ur(t,e),ur(t,r)}function jo(t,e){return qe("writeNumberCached: number: %d",e),qe("writeNumberCached: %o",An[e]),t.write(An[e])}function lv(t,e){let r=K0(e);return qe("writeNumberGenerated: %o",r),t.write(r)}function uv(t,e){let r=Q0(e);return qe("write4ByteNumber: %o",r),t.write(r)}function Hr(t,e){typeof e=="string"?ur(t,e):e?(Te(t,e.length),t.write(e)):Te(t,0)}function jt(t,e){if(typeof e!="object"||e.length!=null)return{length:1,write(){vd(t,{},0)}};let r=0;function i(o,s){let a=D.propertiesTypes[o],u=0;switch(a){case"byte":{if(typeof s!="boolean")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=2;break}case"int8":{if(typeof s!="number"||s<0||s>255)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=2;break}case"binary":{if(s&&s===null)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+U.byteLength(s)+2;break}case"int16":{if(typeof s!="number"||s<0||s>65535)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=3;break}case"int32":{if(typeof s!="number"||s<0||s>4294967295)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=5;break}case"var":{if(typeof s!="number"||s<0||s>268435455)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+U.byteLength(Do(s));break}case"string":{if(typeof s!="string")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=3+U.byteLength(s.toString());break}case"pair":{if(typeof s!="object")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=Object.getOwnPropertyNames(s).reduce((f,d)=>{let h=s[d];return Array.isArray(h)?f+=h.reduce((g,b)=>(g+=3+U.byteLength(d.toString())+2+U.byteLength(b.toString()),g),0):f+=3+U.byteLength(d.toString())+2+U.byteLength(s[d].toString()),f},0);break}default:return t.destroy(new Error(`Invalid property ${o}: ${s}`)),!1}return u}if(e)for(let o in e){let s=0,a=0,u=e[o];if(Array.isArray(u))for(let f=0;f<u.length;f++){if(a=i(o,u[f]),!a)return!1;s+=a}else{if(a=i(o,u),!a)return!1;s=a}if(!s)return!1;r+=s}return{length:U.byteLength(Do(r))+r,write(){vd(t,e,r)}}}function vi(t,e,r,i){let n=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0,s=jt(t,e);if(o)for(;i+s.length>o;){let a=n.shift();if(a&&e[a])delete e[a],s=jt(t,e);else return!1}return s}function md(t,e,r){switch(D.propertiesTypes[e]){case"byte":{t.write(U.from([D.properties[e]])),t.write(U.from([+r]));break}case"int8":{t.write(U.from([D.properties[e]])),t.write(U.from([r]));break}case"binary":{t.write(U.from([D.properties[e]])),Hr(t,r);break}case"int16":{t.write(U.from([D.properties[e]])),Te(t,r);break}case"int32":{t.write(U.from([D.properties[e]])),uv(t,r);break}case"var":{t.write(U.from([D.properties[e]])),Ue(t,r);break}case"string":{t.write(U.from([D.properties[e]])),ur(t,r);break}case"pair":{Object.getOwnPropertyNames(r).forEach(n=>{let o=r[n];Array.isArray(o)?o.forEach(s=>{t.write(U.from([D.properties[e]])),_d(t,n.toString(),s.toString())}):(t.write(U.from([D.properties[e]])),_d(t,n.toString(),o.toString()))});break}default:return t.destroy(new Error(`Invalid property ${e} value: ${r}`)),!1}}function vd(t,e,r){Ue(t,r);for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==null){let n=e[i];if(Array.isArray(n))for(let o=0;o<n.length;o++)md(t,i,n[o]);else md(t,i,n)}}function Ad(t){return t?t instanceof U?t.length:U.byteLength(t):0}function Ed(t){return typeof t=="string"||t instanceof U}Id.exports=Sd});var Cd=O((Nx,Rd)=>{_();v();m();var cv=Fo(),{EventEmitter:fv}=(Ot(),Q(xt)),{Buffer:Td}=(he(),Q(ye));function hv(t,e){let r=new Wo;return cv(t,r,e),r.concat()}var Wo=class extends fv{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0,r=new Array(this._array.length),i=this._array,n=0,o;for(o=0;o<i.length&&i[o]!==void 0;o++)typeof i[o]!="string"?r[o]=i[o].length:r[o]=Td.byteLength(i[o]),e+=r[o];let s=Td.allocUnsafe(e);for(o=0;o<i.length&&i[o]!==void 0;o++)typeof i[o]!="string"?(i[o].copy(s,n),n+=r[o]):(s.write(i[o],n),n+=r[o]);return s}destroy(e){e&&this.emit("error",e)}};Rd.exports=hv});var Pd=O(Tn=>{_();v();m();Tn.parser=hd().parser;Tn.generate=Cd();Tn.writeToStream=Fo()});var Vo=O(Ho=>{"use strict";_();v();m();Object.defineProperty(Ho,"__esModule",{value:!0});var $o=class{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let e=this.nextId++;return this.nextId===65536&&(this.nextId=1),e}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(e){return!0}deallocate(e){}clear(){}};Ho.default=$o});var Bd=O((pO,kd)=>{"use strict";_();v();m();kd.exports=dv;function Vr(t){return t instanceof x?x.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function dv(t){if(t=t||{},t.circles)return pv(t);let e=new Map;if(e.set(Date,s=>new Date(s)),e.set(Map,(s,a)=>new Map(i(Array.from(s),a))),e.set(Set,(s,a)=>new Set(i(Array.from(s),a))),t.constructorHandlers)for(let s of t.constructorHandlers)e.set(s[0],s[1]);let r=null;return t.proto?o:n;function i(s,a){let u=Object.keys(s),f=new Array(u.length);for(let d=0;d<u.length;d++){let h=u[d],g=s[h];typeof g!="object"||g===null?f[h]=g:g.constructor!==Object&&(r=e.get(g.constructor))?f[h]=r(g,a):ArrayBuffer.isView(g)?f[h]=Vr(g):f[h]=a(g)}return f}function n(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return i(s,n);if(s.constructor!==Object&&(r=e.get(s.constructor)))return r(s,n);let a={};for(let u in s){if(Object.hasOwnProperty.call(s,u)===!1)continue;let f=s[u];typeof f!="object"||f===null?a[u]=f:f.constructor!==Object&&(r=e.get(f.constructor))?a[u]=r(f,n):ArrayBuffer.isView(f)?a[u]=Vr(f):a[u]=n(f)}return a}function o(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return i(s,o);if(s.constructor!==Object&&(r=e.get(s.constructor)))return r(s,o);let a={};for(let u in s){let f=s[u];typeof f!="object"||f===null?a[u]=f:f.constructor!==Object&&(r=e.get(f.constructor))?a[u]=r(f,o):ArrayBuffer.isView(f)?a[u]=Vr(f):a[u]=o(f)}return a}}function pv(t){let e=[],r=[],i=new Map;if(i.set(Date,u=>new Date(u)),i.set(Map,(u,f)=>new Map(o(Array.from(u),f))),i.set(Set,(u,f)=>new Set(o(Array.from(u),f))),t.constructorHandlers)for(let u of t.constructorHandlers)i.set(u[0],u[1]);let n=null;return t.proto?a:s;function o(u,f){let d=Object.keys(u),h=new Array(d.length);for(let g=0;g<d.length;g++){let b=d[g],E=u[b];if(typeof E!="object"||E===null)h[b]=E;else if(E.constructor!==Object&&(n=i.get(E.constructor)))h[b]=n(E,f);else if(ArrayBuffer.isView(E))h[b]=Vr(E);else{let w=e.indexOf(E);w!==-1?h[b]=r[w]:h[b]=f(E)}}return h}function s(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return o(u,s);if(u.constructor!==Object&&(n=i.get(u.constructor)))return n(u,s);let f={};e.push(u),r.push(f);for(let d in u){if(Object.hasOwnProperty.call(u,d)===!1)continue;let h=u[d];if(typeof h!="object"||h===null)f[d]=h;else if(h.constructor!==Object&&(n=i.get(h.constructor)))f[d]=n(h,s);else if(ArrayBuffer.isView(h))f[d]=Vr(h);else{let g=e.indexOf(h);g!==-1?f[d]=r[g]:f[d]=s(h)}}return e.pop(),r.pop(),f}function a(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return o(u,a);if(u.constructor!==Object&&(n=i.get(u.constructor)))return n(u,a);let f={};e.push(u),r.push(f);for(let d in u){let h=u[d];if(typeof h!="object"||h===null)f[d]=h;else if(h.constructor!==Object&&(n=i.get(h.constructor)))f[d]=n(h,a);else if(ArrayBuffer.isView(h))f[d]=Vr(h);else{let g=e.indexOf(h);g!==-1?f[d]=r[g]:f[d]=a(h)}}return e.pop(),r.pop(),f}}});var Od=O((AO,xd)=>{"use strict";_();v();m();xd.exports=Bd()()});var Ld=O(Rn=>{"use strict";_();v();m();Object.defineProperty(Rn,"__esModule",{value:!0});Rn.validateTopic=Md;Rn.validateTopics=gv;function Md(t){let e=t.split("/");for(let r=0;r<e.length;r++)if(e[r]!=="+"){if(e[r]==="#")return r===e.length-1;if(e[r].indexOf("+")!==-1||e[r].indexOf("#")!==-1)return!1}return!0}function gv(t){if(t.length===0)return"empty_topic_list";for(let e=0;e<t.length;e++)if(!Md(t[e]))return t[e];return null}});var Go=O(Ko=>{"use strict";_();v();m();Object.defineProperty(Ko,"__esModule",{value:!0});var bv=Nt(),yv={objectMode:!0},wv={clean:!0},zo=class{constructor(e){this.options=e||{},this.options=Object.assign(Object.assign({},wv),e),this._inflights=new Map}put(e,r){return this._inflights.set(e.messageId,e),r&&r(),this}createStream(){let e=new bv.Readable(yv),r=[],i=!1,n=0;return this._inflights.forEach((o,s)=>{r.push(o)}),e._read=()=>{!i&&n<r.length?e.push(r[n++]):e.push(null)},e.destroy=o=>{if(!i)return i=!0,setTimeout(()=>{e.emit("close")},0),e},e}del(e,r){let i=this._inflights.get(e.messageId);return i?(this._inflights.delete(e.messageId),r(null,i)):r&&r(new Error("missing packet")),this}get(e,r){let i=this._inflights.get(e.messageId);return i?r(null,i):r&&r(new Error("missing packet")),this}close(e){this.options.clean&&(this._inflights=null),e&&e()}};Ko.default=zo});var Ud=O(Qo=>{"use strict";_();v();m();Object.defineProperty(Qo,"__esModule",{value:!0});var qd=[0,16,128,131,135,144,145,151,153],_v=(t,e,r)=>{t.log("handlePublish: packet %o",e),r=typeof r<"u"?r:t.noop;let i=e.topic.toString(),n=e.payload,{qos:o}=e,{messageId:s}=e,{options:a}=t;if(t.options.protocolVersion===5){let u;if(e.properties&&(u=e.properties.topicAlias),typeof u<"u")if(i.length===0)if(u>0&&u<=65535){let f=t.topicAliasRecv.getTopicByAlias(u);if(f)i=f,t.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",i,u);else{t.log("handlePublish :: unregistered topic alias. alias: %d",u),t.emit("error",new Error("Received unregistered Topic Alias"));return}}else{t.log("handlePublish :: topic alias out of range. alias: %d",u),t.emit("error",new Error("Received Topic Alias is out of range"));return}else if(t.topicAliasRecv.put(i,u))t.log("handlePublish :: registered topic: %s - alias: %d",i,u);else{t.log("handlePublish :: topic alias out of range. alias: %d",u),t.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(t.log("handlePublish: qos %d",o),o){case 2:{a.customHandleAcks(i,n,e,(u,f)=>{if(typeof u=="number"&&(f=u,u=null),u)return t.emit("error",u);if(qd.indexOf(f)===-1)return t.emit("error",new Error("Wrong reason code for pubrec"));f?t._sendPacket({cmd:"pubrec",messageId:s,reasonCode:f},r):t.incomingStore.put(e,()=>{t._sendPacket({cmd:"pubrec",messageId:s},r)})});break}case 1:{a.customHandleAcks(i,n,e,(u,f)=>{if(typeof u=="number"&&(f=u,u=null),u)return t.emit("error",u);if(qd.indexOf(f)===-1)return t.emit("error",new Error("Wrong reason code for puback"));f||t.emit("message",i,n,e),t.handleMessage(e,d=>{if(d)return r&&r(d);t._sendPacket({cmd:"puback",messageId:s,reasonCode:f},r)})});break}case 0:t.emit("message",i,n,e),t.handleMessage(e,r);break;default:t.log("handlePublish: unknown QoS. Doing nothing.");break}};Qo.default=_v});var Nd=O((cM,mv)=>{mv.exports={version:"5.10.4"}});var cr=O(Et=>{"use strict";_();v();m();Object.defineProperty(Et,"__esModule",{value:!0});Et.MQTTJS_VERSION=Et.nextTick=Et.ErrorWithReasonCode=void 0;Et.applyMixin=vv;var Yo=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}};Et.ErrorWithReasonCode=Yo;function vv(t,e,r=!1){var i;let n=[e];for(;;){let o=n[0],s=Object.getPrototypeOf(o);if(s?.prototype)n.unshift(s);else break}for(let o of n)for(let s of Object.getOwnPropertyNames(o.prototype))(r||s!=="constructor")&&Object.defineProperty(t.prototype,s,(i=Object.getOwnPropertyDescriptor(o.prototype,s))!==null&&i!==void 0?i:Object.create(null))}Et.nextTick=typeof(R===null||R===void 0?void 0:R.nextTick)=="function"?R.nextTick:t=>{setTimeout(t,0)};Et.MQTTJS_VERSION=Nd().version});var Ei=O(Ft=>{"use strict";_();v();m();Object.defineProperty(Ft,"__esModule",{value:!0});Ft.ReasonCodes=void 0;var Dd=cr();Ft.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 Ev=(t,e)=>{let{messageId:r}=e,i=e.cmd,n=null,o=t.outgoing[r]?t.outgoing[r].cb:null,s=null;if(!o){t.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(t.log("_handleAck :: packet type",i),i){case"pubcomp":case"puback":{let a=e.reasonCode;a&&a>0&&a!==16?(s=new Dd.ErrorWithReasonCode(`Publish error: ${Ft.ReasonCodes[a]}`,a),t._removeOutgoingAndStoreMessage(r,()=>{o(s,e)})):t._removeOutgoingAndStoreMessage(r,o);break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:r};let a=e.reasonCode;a&&a>0&&a!==16?(s=new Dd.ErrorWithReasonCode(`Publish error: ${Ft.ReasonCodes[a]}`,a),t._removeOutgoingAndStoreMessage(r,()=>{o(s,e)})):t._sendPacket(n);break}case"suback":{delete t.outgoing[r],t.messageIdProvider.deallocate(r);let a=e.granted;for(let u=0;u<a.length;u++){let f=a[u];if(f&128){s=new Error(`Subscribe error: ${Ft.ReasonCodes[f]}`),s.code=f;let d=t.messageIdToTopic[r];d&&d.forEach(h=>{delete t._resubscribeTopics[h]})}}delete t.messageIdToTopic[r],t._invokeStoreProcessingQueue(),o(s,e);break}case"unsuback":{delete t.outgoing[r],t.messageIdProvider.deallocate(r),t._invokeStoreProcessingQueue(),o(null,e);break}default:t.emit("error",new Error("unrecognized packet type"))}t.disconnecting&&Object.keys(t.outgoing).length===0&&t.emit("outgoingEmpty")};Ft.default=Ev});var Fd=O(Jo=>{"use strict";_();v();m();Object.defineProperty(Jo,"__esModule",{value:!0});var jd=cr(),Sv=Ei(),Av=(t,e)=>{let{options:r}=t,i=r.protocolVersion,n=i===5?e.reasonCode:e.returnCode;if(i!==5){let o=new jd.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${i}`,n);t.emit("error",o);return}t.handleAuth(e,(o,s)=>{if(o){t.emit("error",o);return}if(n===24)t.reconnecting=!1,t._sendPacket(s);else{let a=new jd.ErrorWithReasonCode(`Connection refused: ${Sv.ReasonCodes[n]}`,n);t.emit("error",a)}})};Jo.default=Av});var zd=O(Pn=>{"use strict";_();v();m();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.LRUCache=void 0;var zr=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,$d=new Set,Xo=typeof R=="object"&&R?R:{},Hd=(t,e,r,i)=>{typeof Xo.emitWarning=="function"?Xo.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`)},Cn=globalThis.AbortController,Wd=globalThis.AbortSignal;if(typeof Cn>"u"){Wd=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,n){this._onabort.push(n)}},Cn=class{constructor(){e()}signal=new Wd;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let n of this.signal._onabort)n(i);this.signal.onabort?.(i)}}};let t=Xo.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,Hd("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",e))}}var Iv=t=>!$d.has(t),$M=Symbol("type"),Wt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Vd=t=>Wt(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Kr:null:null,Kr=class extends Array{constructor(e){super(e),this.fill(0)}},Zo=class t{heap;length;static#l=!1;static create(e){let r=Vd(e);if(!r)return[];t.#l=!0;let i=new t(e,r);return t.#l=!1,i}constructor(e,r){if(!t.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},ea=class t{#l;#f;#g;#b;#k;#B;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#y;#i;#r;#e;#u;#h;#a;#s;#w;#o;#_;#m;#d;#v;#T;#c;static unsafeExposeInternals(e){return{starts:e.#m,ttls:e.#d,sizes:e.#_,keyMap:e.#i,keyList:e.#r,valList:e.#e,next:e.#u,prev:e.#h,get head(){return e.#a},get tail(){return e.#s},free:e.#w,isBackgroundFetch:r=>e.#t(r),backgroundFetch:(r,i,n,o)=>e.#M(r,i,n,o),moveToTail:r=>e.#P(r),indexes:r=>e.#E(r),rindexes:r=>e.#S(r),isStale:r=>e.#p(r)}}get max(){return this.#l}get maxSize(){return this.#f}get calculatedSize(){return this.#y}get size(){return this.#n}get fetchMethod(){return this.#k}get memoMethod(){return this.#B}get dispose(){return this.#g}get disposeAfter(){return this.#b}constructor(e){let{max:r=0,ttl:i,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:a,allowStale:u,dispose:f,disposeAfter:d,noDisposeOnSet:h,noUpdateTTL:g,maxSize:b=0,maxEntrySize:E=0,sizeCalculation:w,fetchMethod:S,memoMethod:I,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:k,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:q,ignoreFetchAbort:G}=e;if(r!==0&&!Wt(r))throw new TypeError("max option must be a nonnegative integer");let F=r?Vd(r):Array;if(!F)throw new Error("invalid max value: "+r);if(this.#l=r,this.#f=b,this.maxEntrySize=E||this.#f,this.sizeCalculation=w,this.sizeCalculation){if(!this.#f&&!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(I!==void 0&&typeof I!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#B=I,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#k=S,this.#T=!!S,this.#i=new Map,this.#r=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#u=new F(r),this.#h=new F(r),this.#a=0,this.#s=0,this.#w=Zo.create(r),this.#n=0,this.#y=0,typeof f=="function"&&(this.#g=f),typeof d=="function"?(this.#b=d,this.#o=[]):(this.#b=void 0,this.#o=void 0),this.#v=!!this.#g,this.#c=!!this.#b,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!M,this.allowStaleOnFetchAbort=!!q,this.ignoreFetchAbort=!!G,this.maxEntrySize!==0){if(this.#f!==0&&!Wt(this.#f))throw new TypeError("maxSize must be a positive integer if specified");if(!Wt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!k,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.ttlResolution=Wt(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!Wt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#L()}if(this.#l===0&&this.ttl===0&&this.#f===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#l&&!this.#f){let K="LRU_CACHE_UNBOUNDED";Iv(K)&&($d.add(K),Hd("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",K,t))}}getRemainingTTL(e){return this.#i.has(e)?1/0:0}#L(){let e=new Kr(this.#l),r=new Kr(this.#l);this.#d=e,this.#m=r,this.#q=(o,s,a=zr.now())=>{if(r[o]=s!==0?a:0,e[o]=s,s!==0&&this.ttlAutopurge){let u=setTimeout(()=>{this.#p(o)&&this.#A(this.#r[o],"expire")},s+1);u.unref&&u.unref()}},this.#R=o=>{r[o]=e[o]!==0?zr.now():0},this.#I=(o,s)=>{if(e[s]){let a=e[s],u=r[s];if(!a||!u)return;o.ttl=a,o.start=u,o.now=i||n();let f=o.now-u;o.remainingTTL=a-f}};let i=0,n=()=>{let o=zr.now();if(this.ttlResolution>0){i=o;let s=setTimeout(()=>i=0,this.ttlResolution);s.unref&&s.unref()}return o};this.getRemainingTTL=o=>{let s=this.#i.get(o);if(s===void 0)return 0;let a=e[s],u=r[s];if(!a||!u)return 1/0;let f=(i||n())-u;return a-f},this.#p=o=>{let s=r[o],a=e[o];return!!a&&!!s&&(i||n())-s>a}}#R=()=>{};#I=()=>{};#q=()=>{};#p=()=>!1;#F(){let e=new Kr(this.#l);this.#y=0,this.#_=e,this.#C=r=>{this.#y-=e[r],e[r]=0},this.#U=(r,i,n,o)=>{if(this.#t(i))return 0;if(!Wt(n))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(n=o(i,r),!Wt(n))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 n},this.#x=(r,i,n)=>{if(e[r]=i,this.#f){let o=this.#f-e[r];for(;this.#y>o;)this.#O(!0)}this.#y+=e[r],n&&(n.entrySize=i,n.totalCalculatedSize=this.#y)}}#C=e=>{};#x=(e,r,i)=>{};#U=(e,r,i,n)=>{if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#E({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#s;!(!this.#N(r)||((e||!this.#p(r))&&(yield r),r===this.#a));)r=this.#h[r]}*#S({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#a;!(!this.#N(r)||((e||!this.#p(r))&&(yield r),r===this.#s));)r=this.#u[r]}#N(e){return e!==void 0&&this.#i.get(this.#r[e])===e}*entries(){for(let e of this.#E())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#S())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#E()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*rkeys(){for(let e of this.#S()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*values(){for(let e of this.#E())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#S())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let i of this.#E()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;if(o!==void 0&&e(o,this.#r[i],this))return this.get(this.#r[i],r)}}forEach(e,r=this){for(let i of this.#E()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this)}}rforEach(e,r=this){for(let i of this.#S()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this)}}purgeStale(){let e=!1;for(let r of this.#S({allowStale:!0}))this.#p(r)&&(this.#A(this.#r[r],"expire"),e=!0);return e}info(e){let r=this.#i.get(e);if(r===void 0)return;let i=this.#e[r],n=this.#t(i)?i.__staleWhileFetching:i;if(n===void 0)return;let o={value:n};if(this.#d&&this.#m){let s=this.#d[r],a=this.#m[r];if(s&&a){let u=s-(zr.now()-a);o.ttl=u,o.start=Date.now()}}return this.#_&&(o.size=this.#_[r]),o}dump(){let e=[];for(let r of this.#E({allowStale:!0})){let i=this.#r[r],n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0||i===void 0)continue;let s={value:o};if(this.#d&&this.#m){s.ttl=this.#d[r];let a=zr.now()-this.#m[r];s.start=Math.floor(Date.now()-a)}this.#_&&(s.size=this.#_[r]),e.unshift([i,s])}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let n=Date.now()-i.start;i.start=zr.now()-n}this.set(r,i.value,i)}}set(e,r,i={}){if(r===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:u}=i,{noUpdateTTL:f=this.noUpdateTTL}=i,d=this.#U(e,r,i.size||0,a);if(this.maxEntrySize&&d>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.#A(e,"set"),this;let h=this.#n===0?void 0:this.#i.get(e);if(h===void 0)h=this.#n===0?this.#s:this.#w.length!==0?this.#w.pop():this.#n===this.#l?this.#O(!1):this.#n,this.#r[h]=e,this.#e[h]=r,this.#i.set(e,h),this.#u[this.#s]=h,this.#h[h]=this.#s,this.#s=h,this.#n++,this.#x(h,d,u),u&&(u.set="add"),f=!1;else{this.#P(h);let g=this.#e[h];if(r!==g){if(this.#T&&this.#t(g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:b}=g;b!==void 0&&!s&&(this.#v&&this.#g?.(b,e,"set"),this.#c&&this.#o?.push([b,e,"set"]))}else s||(this.#v&&this.#g?.(g,e,"set"),this.#c&&this.#o?.push([g,e,"set"]));if(this.#C(h),this.#x(h,d,u),this.#e[h]=r,u){u.set="replace";let b=g&&this.#t(g)?g.__staleWhileFetching:g;b!==void 0&&(u.oldValue=b)}}else u&&(u.set="update")}if(n!==0&&!this.#d&&this.#L(),this.#d&&(f||this.#q(h,n,o),u&&this.#I(u,h)),!s&&this.#c&&this.#o){let g=this.#o,b;for(;b=g?.shift();)this.#b?.(...b)}return this}pop(){try{for(;this.#n;){let e=this.#e[this.#a];if(this.#O(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#c&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#b?.(...r)}}}#O(e){let r=this.#a,i=this.#r[r],n=this.#e[r];return this.#T&&this.#t(n)?n.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#g?.(n,i,"evict"),this.#c&&this.#o?.push([n,i,"evict"])),this.#C(r),e&&(this.#r[r]=void 0,this.#e[r]=void 0,this.#w.push(r)),this.#n===1?(this.#a=this.#s=0,this.#w.length=0):this.#a=this.#u[r],this.#i.delete(i),this.#n--,r}has(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=r,o=this.#i.get(e);if(o!==void 0){let s=this.#e[o];if(this.#t(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#p(o))n&&(n.has="stale",this.#I(n,o));else return i&&this.#R(o),n&&(n.has="hit",this.#I(n,o)),!0}else n&&(n.has="miss");return!1}peek(e,r={}){let{allowStale:i=this.allowStale}=r,n=this.#i.get(e);if(n===void 0||!i&&this.#p(n))return;let o=this.#e[n];return this.#t(o)?o.__staleWhileFetching:o}#M(e,r,i,n){let o=r===void 0?void 0:this.#e[r];if(this.#t(o))return o;let s=new Cn,{signal:a}=i;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});let u={signal:s.signal,options:i,context:n},f=(w,S=!1)=>{let{aborted:I}=s.signal,C=i.ignoreFetchAbort&&w!==void 0;if(i.status&&(I&&!S?(i.status.fetchAborted=!0,i.status.fetchError=s.signal.reason,C&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),I&&!C&&!S)return h(s.signal.reason);let k=b;return this.#e[r]===b&&(w===void 0?k.__staleWhileFetching?this.#e[r]=k.__staleWhileFetching:this.#A(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(e,w,u.options))),w},d=w=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=w),h(w)),h=w=>{let{aborted:S}=s.signal,I=S&&i.allowStaleOnFetchAbort,C=I||i.allowStaleOnFetchRejection,k=C||i.noDeleteOnFetchRejection,M=b;if(this.#e[r]===b&&(!k||M.__staleWhileFetching===void 0?this.#A(e,"fetch"):I||(this.#e[r]=M.__staleWhileFetching)),C)return i.status&&M.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),M.__staleWhileFetching;if(M.__returned===M)throw w},g=(w,S)=>{let I=this.#k?.(e,o,u);I&&I instanceof Promise&&I.then(C=>w(C===void 0?void 0:C),S),s.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(w(void 0),i.allowStaleOnFetchAbort&&(w=C=>f(C,!0)))})};i.status&&(i.status.fetchDispatched=!0);let b=new Promise(g).then(f,d),E=Object.assign(b,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,E,{...u.options,status:void 0}),r=this.#i.get(e)):this.#e[r]=E,E}#t(e){if(!this.#T)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Cn}async fetch(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:u=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:w,forceRefresh:S=!1,status:I,signal:C}=r;if(!this.#T)return I&&(I.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:I});let k={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:a,size:u,sizeCalculation:f,noUpdateTTL:d,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:E,ignoreFetchAbort:b,status:I,signal:C},M=this.#i.get(e);if(M===void 0){I&&(I.fetch="miss");let q=this.#M(e,M,k,w);return q.__returned=q}else{let q=this.#e[M];if(this.#t(q)){let te=i&&q.__staleWhileFetching!==void 0;return I&&(I.fetch="inflight",te&&(I.returnedStale=!0)),te?q.__staleWhileFetching:q.__returned=q}let G=this.#p(M);if(!S&&!G)return I&&(I.fetch="hit"),this.#P(M),n&&this.#R(M),I&&this.#I(I,M),q;let F=this.#M(e,M,k,w),$=F.__staleWhileFetching!==void 0&&i;return I&&(I.fetch=G?"stale":"refresh",$&&G&&(I.returnedStale=!0)),$?F.__staleWhileFetching:F.__returned=F}}async forceFetch(e,r={}){let i=await this.fetch(e,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,r={}){let i=this.#B;if(!i)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:o,...s}=r,a=this.get(e,s);if(!o&&a!==void 0)return a;let u=i(e,a,{options:s,context:n});return this.set(e,u,s),u}get(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,a=this.#i.get(e);if(a!==void 0){let u=this.#e[a],f=this.#t(u);return s&&this.#I(s,a),this.#p(a)?(s&&(s.get="stale"),f?(s&&i&&u.__staleWhileFetching!==void 0&&(s.returnedStale=!0),i?u.__staleWhileFetching:void 0):(o||this.#A(e,"expire"),s&&i&&(s.returnedStale=!0),i?u:void 0)):(s&&(s.get="hit"),f?u.__staleWhileFetching:(this.#P(a),n&&this.#R(a),u))}else s&&(s.get="miss")}#D(e,r){this.#h[r]=e,this.#u[e]=r}#P(e){e!==this.#s&&(e===this.#a?this.#a=this.#u[e]:this.#D(this.#h[e],this.#u[e]),this.#D(this.#s,e),this.#s=e)}delete(e){return this.#A(e,"delete")}#A(e,r){let i=!1;if(this.#n!==0){let n=this.#i.get(e);if(n!==void 0)if(i=!0,this.#n===1)this.#j(r);else{this.#C(n);let o=this.#e[n];if(this.#t(o)?o.__abortController.abort(new Error("deleted")):(this.#v||this.#c)&&(this.#v&&this.#g?.(o,e,r),this.#c&&this.#o?.push([o,e,r])),this.#i.delete(e),this.#r[n]=void 0,this.#e[n]=void 0,n===this.#s)this.#s=this.#h[n];else if(n===this.#a)this.#a=this.#u[n];else{let s=this.#h[n];this.#u[s]=this.#u[n];let a=this.#u[n];this.#h[a]=this.#h[n]}this.#n--,this.#w.push(n)}}if(this.#c&&this.#o?.length){let n=this.#o,o;for(;o=n?.shift();)this.#b?.(...o)}return i}clear(){return this.#j("delete")}#j(e){for(let r of this.#S({allowStale:!0})){let i=this.#e[r];if(this.#t(i))i.__abortController.abort(new Error("deleted"));else{let n=this.#r[r];this.#v&&this.#g?.(i,n,e),this.#c&&this.#o?.push([i,n,e])}}if(this.#i.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#d&&this.#m&&(this.#d.fill(0),this.#m.fill(0)),this.#_&&this.#_.fill(0),this.#a=0,this.#s=0,this.#w.length=0,this.#y=0,this.#n=0,this.#c&&this.#o){let r=this.#o,i;for(;i=r?.shift();)this.#b?.(...i)}}};Pn.LRUCache=ea});var nt=O($t=>{"use strict";_();v();m();Object.defineProperty($t,"t",{value:!0});$t.ContainerIterator=$t.Container=$t.Base=void 0;var ta=class{constructor(e=0){this.iteratorType=e}equals(e){return this.o===e.o}};$t.ContainerIterator=ta;var kn=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};$t.Base=kn;var ra=class extends kn{};$t.Container=ra});var Kd=O(Bn=>{"use strict";_();v();m();Object.defineProperty(Bn,"t",{value:!0});Bn.default=void 0;var Tv=nt(),ia=class extends Tv.Base{constructor(e=[]){super(),this.S=[];let r=this;e.forEach(function(i){r.push(i)})}clear(){this.i=0,this.S=[]}push(e){return this.S.push(e),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},Rv=ia;Bn.default=Rv});var Gd=O(xn=>{"use strict";_();v();m();Object.defineProperty(xn,"t",{value:!0});xn.default=void 0;var Cv=nt(),na=class extends Cv.Base{constructor(e=[]){super(),this.j=0,this.q=[];let r=this;e.forEach(function(i){r.push(i)})}clear(){this.q=[],this.i=this.j=0}push(e){let r=this.q.length;if(this.j/r>.5&&this.j+this.i>=r&&r>4096){let i=this.i;for(let n=0;n<i;++n)this.q[n]=this.q[this.j+n];this.j=0,this.q[this.i]=e}else this.q[this.j+this.i]=e;return++this.i}pop(){if(this.i===0)return;let e=this.q[this.j++];return this.i-=1,e}front(){if(this.i!==0)return this.q[this.j]}},Pv=na;xn.default=Pv});var Qd=O(On=>{"use strict";_();v();m();Object.defineProperty(On,"t",{value:!0});On.default=void 0;var kv=nt(),sa=class extends kv.Base{constructor(e=[],r=function(n,o){return n>o?-1:n<o?1:0},i=!0){if(super(),this.v=r,Array.isArray(e))this.C=i?[...e]:e;else{this.C=[];let o=this;e.forEach(function(s){o.C.push(s)})}this.i=this.C.length;let n=this.i>>1;for(let o=this.i-1>>1;o>=0;--o)this.k(o,n)}m(e){let r=this.C[e];for(;e>0;){let i=e-1>>1,n=this.C[i];if(this.v(n,r)<=0)break;this.C[e]=n,e=i}this.C[e]=r}k(e,r){let i=this.C[e];for(;e<r;){let n=e<<1|1,o=n+1,s=this.C[n];if(o<this.i&&this.v(s,this.C[o])>0&&(n=o,s=this.C[o]),this.v(s,i)>=0)break;this.C[e]=s,e=n}this.C[e]=i}clear(){this.i=0,this.C.length=0}push(e){this.C.push(e),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let e=this.C[0],r=this.C.pop();return this.i-=1,this.i&&(this.C[0]=r,this.k(0,this.i>>1)),e}top(){return this.C[0]}find(e){return this.C.indexOf(e)>=0}remove(e){let r=this.C.indexOf(e);return r<0?!1:(r===0?this.pop():r===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(r,1,this.C.pop()),this.i-=1,this.m(r),this.k(r,this.i>>1)),!0)}updateItem(e){let r=this.C.indexOf(e);return r<0?!1:(this.m(r),this.k(r,this.i>>1),!0)}toArray(){return[...this.C]}},Bv=sa;On.default=Bv});var Ln=O(Mn=>{"use strict";_();v();m();Object.defineProperty(Mn,"t",{value:!0});Mn.default=void 0;var xv=nt(),oa=class extends xv.Container{},Ov=oa;Mn.default=Ov});var st=O(aa=>{"use strict";_();v();m();Object.defineProperty(aa,"t",{value:!0});aa.throwIteratorAccessError=Mv;function Mv(){throw new RangeError("Iterator access denied!")}});var ua=O(Un=>{"use strict";_();v();m();Object.defineProperty(Un,"t",{value:!0});Un.RandomIterator=void 0;var Lv=nt(),qn=st(),la=class extends Lv.ContainerIterator{constructor(e,r){super(r),this.o=e,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,qn.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,qn.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,qn.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,qn.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(e){this.container.setElementByPos(this.o,e)}};Un.RandomIterator=la});var Yd=O(Nn=>{"use strict";_();v();m();Object.defineProperty(Nn,"t",{value:!0});Nn.default=void 0;var qv=Nv(Ln()),Uv=ua();function Nv(t){return t&&t.t?t:{default:t}}var fr=class t extends Uv.RandomIterator{constructor(e,r,i){super(e,i),this.container=r}copy(){return new t(this.o,this.container,this.iteratorType)}},ca=class extends qv.default{constructor(e=[],r=!0){if(super(),Array.isArray(e))this.J=r?[...e]:e,this.i=e.length;else{this.J=[];let i=this;e.forEach(function(n){i.pushBack(n)})}}clear(){this.i=0,this.J.length=0}begin(){return new fr(0,this)}end(){return new fr(this.i,this)}rBegin(){return new fr(this.i-1,this,1)}rEnd(){return new fr(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J[e]}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J.splice(e,1),this.i-=1,this.i}eraseElementByValue(e){let r=0;for(let i=0;i<this.i;++i)this.J[i]!==e&&(this.J[r++]=this.J[i]);return this.i=this.J.length=r,this.i}eraseElementByIterator(e){let r=e.o;return e=e.next(),this.eraseElementByPos(r),e}pushBack(e){return this.J.push(e),this.i+=1,this.i}popBack(){if(this.i!==0)return this.i-=1,this.J.pop()}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;this.J[e]=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;return this.J.splice(e,0,...new Array(i).fill(r)),this.i+=i,this.i}find(e){for(let r=0;r<this.i;++r)if(this.J[r]===e)return new fr(r,this);return this.end()}reverse(){this.J.reverse()}unique(){let e=1;for(let r=1;r<this.i;++r)this.J[r]!==this.J[r-1]&&(this.J[e++]=this.J[r]);return this.i=this.J.length=e,this.i}sort(e){this.J.sort(e)}forEach(e){for(let r=0;r<this.i;++r)e(this.J[r],r,this)}[Symbol.iterator](){return function*(){yield*this.J}.bind(this)()}},Dv=ca;Nn.default=Dv});var Jd=O(Dn=>{"use strict";_();v();m();Object.defineProperty(Dn,"t",{value:!0});Dn.default=void 0;var jv=Wv(Ln()),Fv=nt(),hr=st();function Wv(t){return t&&t.t?t:{default:t}}var dr=class t extends Fv.ContainerIterator{constructor(e,r,i,n){super(n),this.o=e,this.h=r,this.container=i,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,hr.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,hr.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,hr.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,hr.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,hr.throwIteratorAccessError)(),this.o.l}set pointer(e){this.o===this.h&&(0,hr.throwIteratorAccessError)(),this.o.l=e}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},fa=class extends jv.default{constructor(e=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let r=this;e.forEach(function(i){r.pushBack(i)})}V(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1}G(e,r){let i=r.B,n={l:e,L:r,B:i};r.B=n,i.L=n,r===this.h&&(this.p=n),i===this.h&&(this._=n),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new dr(this.p,this.h,this)}end(){return new dr(this.h,this.h,this)}rBegin(){return new dr(this._,this.h,this,1)}rEnd(){return new dr(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.l}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}eraseElementByValue(e){let r=this.p;for(;r!==this.h;)r.l===e&&this.V(r),r=r.B;return this.i}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0,hr.throwIteratorAccessError)(),e=e.next(),this.V(r),e}pushBack(e){return this.G(e,this._),this.i}popBack(){if(this.i===0)return;let e=this._.l;return this.V(this._),e}pushFront(e){return this.G(e,this.h),this.i}popFront(){if(this.i===0)return;let e=this.p.l;return this.V(this.p),e}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;i.l=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(i<=0)return this.i;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else{let n=this.p;for(let s=1;s<e;++s)n=n.B;let o=n.B;for(this.i+=i;i--;)n.B={l:r,L:n},n.B.L=n,n=n.B;n.B=o,o.L=n}return this.i}find(e){let r=this.p;for(;r!==this.h;){if(r.l===e)return new dr(r,this.h,this);r=r.B}return this.end()}reverse(){if(this.i<=1)return;let e=this.p,r=this._,i=0;for(;i<<1<this.i;){let n=e.l;e.l=r.l,r.l=n,e=e.B,r=r.L,i+=1}}unique(){if(this.i<=1)return this.i;let e=this.p;for(;e!==this.h;){let r=e;for(;r.B!==this.h&&r.l===r.B.l;)r=r.B,this.i-=1;e.B=r.B,e.B.L=e,e=e.B}return this.i}sort(e){if(this.i<=1)return;let r=[];this.forEach(function(n){r.push(n)}),r.sort(e);let i=this.p;r.forEach(function(n){i.l=n,i=i.B})}merge(e){let r=this;if(this.i===0)e.forEach(function(i){r.pushBack(i)});else{let i=this.p;e.forEach(function(n){for(;i!==r.h&&i.l<=n;)i=i.B;r.G(n,i.L)})}return this.i}forEach(e){let r=this.p,i=0;for(;r!==this.h;)e(r.l,i++,this),r=r.B}[Symbol.iterator](){return function*(){if(this.i===0)return;let e=this.p;for(;e!==this.h;)yield e.l,e=e.B}.bind(this)()}},$v=fa;Dn.default=$v});var Xd=O(jn=>{"use strict";_();v();m();Object.defineProperty(jn,"t",{value:!0});jn.default=void 0;var Hv=zv(Ln()),Vv=ua();function zv(t){return t&&t.t?t:{default:t}}var pr=class t extends Vv.RandomIterator{constructor(e,r,i){super(e,i),this.container=r}copy(){return new t(this.o,this.container,this.iteratorType)}},ha=class extends Hv.default{constructor(e=[],r=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let i=(()=>{if(typeof e.length=="number")return e.length;if(typeof e.size=="number")return e.size;if(typeof e.size=="function")return e.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=r,this.P=Math.max(Math.ceil(i/this.F),1);for(let s=0;s<this.P;++s)this.A.push(new Array(this.F));let n=Math.ceil(i/this.F);this.j=this.R=(this.P>>1)-(n>>1),this.D=this.N=this.F-i%this.F>>1;let o=this;e.forEach(function(s){o.pushBack(s)})}T(){let e=[],r=Math.max(this.P>>1,1);for(let i=0;i<r;++i)e[i]=new Array(this.F);for(let i=this.j;i<this.P;++i)e[e.length]=this.A[i];for(let i=0;i<this.R;++i)e[e.length]=this.A[i];e[e.length]=[...this.A[this.R]],this.j=r,this.R=e.length-1;for(let i=0;i<r;++i)e[e.length]=new Array(this.F);this.A=e,this.P=e.length}O(e){let r=this.D+e+1,i=r%this.F,n=i-1,o=this.j+(r-i)/this.F;return i===0&&(o-=1),o%=this.P,n<0&&(n+=this.F),{curNodeBucketIndex:o,curNodePointerIndex:n}}clear(){this.A=[new Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}begin(){return new pr(0,this)}end(){return new pr(this.i,this)}rBegin(){return new pr(this.i-1,this,1)}rEnd(){return new pr(-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(e){return this.i&&(this.N<this.F-1?this.N+=1:this.R<this.P-1?(this.R+=1,this.N=0):(this.R=0,this.N=0),this.R===this.j&&this.N===this.D&&this.T()),this.i+=1,this.A[this.R][this.N]=e,this.i}popBack(){if(this.i===0)return;let e=this.A[this.R][this.N];return this.i!==1&&(this.N>0?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,e}pushFront(e){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]=e,this.i}popFront(){if(this.i===0)return;let e=this.A[this.j][this.D];return this.i!==1&&(this.D<this.F-1?this.D+=1:this.j<this.P-1?(this.j+=1,this.D=0):(this.j=0,this.D=0)),this.i-=1,e}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:r,curNodePointerIndex:i}=this.O(e);return this.A[r][i]}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:i,curNodePointerIndex:n}=this.O(e);this.A[i][n]=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else{let n=[];for(let o=e;o<this.i;++o)n.push(this.getElementByPos(o));this.cut(e-1);for(let o=0;o<i;++o)this.pushBack(r);for(let o=0;o<n.length;++o)this.pushBack(n[o])}return this.i}cut(e){if(e<0)return this.clear(),0;let{curNodeBucketIndex:r,curNodePointerIndex:i}=this.O(e);return this.R=r,this.N=i,this.i=e+1,this.i}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;if(e===0)this.popFront();else if(e===this.i-1)this.popBack();else{let r=[];for(let n=e+1;n<this.i;++n)r.push(this.getElementByPos(n));this.cut(e),this.popBack();let i=this;r.forEach(function(n){i.pushBack(n)})}return this.i}eraseElementByValue(e){if(this.i===0)return 0;let r=[];for(let n=0;n<this.i;++n){let o=this.getElementByPos(n);o!==e&&r.push(o)}let i=r.length;for(let n=0;n<i;++n)this.setElementByPos(n,r[n]);return this.cut(i-1)}eraseElementByIterator(e){let r=e.o;return this.eraseElementByPos(r),e=e.next(),e}find(e){for(let r=0;r<this.i;++r)if(this.getElementByPos(r)===e)return new pr(r,this);return this.end()}reverse(){let e=0,r=this.i-1;for(;e<r;){let i=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(r)),this.setElementByPos(r,i),e+=1,r-=1}}unique(){if(this.i<=1)return this.i;let e=1,r=this.getElementByPos(0);for(let i=1;i<this.i;++i){let n=this.getElementByPos(i);n!==r&&(r=n,this.setElementByPos(e++,n))}for(;this.i>e;)this.popBack();return this.i}sort(e){let r=[];for(let i=0;i<this.i;++i)r.push(this.getElementByPos(i));r.sort(e);for(let i=0;i<this.i;++i)this.setElementByPos(i,r[i])}shrinkToFit(){if(this.i===0)return;let e=[];this.forEach(function(r){e.push(r)}),this.P=Math.max(Math.ceil(this.i/this.F),1),this.i=this.j=this.R=this.D=this.N=0,this.A=[];for(let r=0;r<this.P;++r)this.A.push(new Array(this.F));for(let r=0;r<e.length;++r)this.pushBack(e[r])}forEach(e){for(let r=0;r<this.i;++r)e(this.getElementByPos(r),r,this)}[Symbol.iterator](){return function*(){for(let e=0;e<this.i;++e)yield this.getElementByPos(e)}.bind(this)()}},Kv=ha;jn.default=Kv});var Zd=O(Gr=>{"use strict";_();v();m();Object.defineProperty(Gr,"t",{value:!0});Gr.TreeNodeEnableIndex=Gr.TreeNode=void 0;var Fn=class{constructor(e,r){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=e,this.l=r}L(){let e=this;if(e.ee===1&&e.tt.tt===e)e=e.W;else if(e.U)for(e=e.U;e.W;)e=e.W;else{let r=e.tt;for(;r.U===e;)e=r,r=e.tt;e=r}return e}B(){let e=this;if(e.W){for(e=e.W;e.U;)e=e.U;return e}else{let r=e.tt;for(;r.W===e;)e=r,r=e.tt;return e.W!==r?r:e}}te(){let e=this.tt,r=this.W,i=r.U;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.U=this,this.tt=r,this.W=i,i&&(i.tt=this),r}se(){let e=this.tt,r=this.U,i=r.W;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.W=this,this.tt=r,this.U=i,i&&(i.tt=this),r}};Gr.TreeNode=Fn;var da=class extends Fn{constructor(){super(...arguments),this.rt=1}te(){let e=super.te();return this.ie(),e.ie(),e}se(){let e=super.se();return this.ie(),e.ie(),e}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};Gr.TreeNodeEnableIndex=da});var ga=O(Wn=>{"use strict";_();v();m();Object.defineProperty(Wn,"t",{value:!0});Wn.default=void 0;var ep=Zd(),Gv=nt(),tp=st(),pa=class extends Gv.Container{constructor(e=function(i,n){return i<n?-1:i>n?1:0},r=!1){super(),this.Y=void 0,this.v=e,r?(this.re=ep.TreeNodeEnableIndex,this.M=function(i,n,o){let s=this.ne(i,n,o);if(s){let a=s.tt;for(;a!==this.h;)a.rt+=1,a=a.tt;let u=this.he(s);if(u){let{parentNode:f,grandParent:d,curNode:h}=u;f.ie(),d.ie(),h.ie()}}return this.i},this.V=function(i){let n=this.fe(i);for(;n!==this.h;)n.rt-=1,n=n.tt}):(this.re=ep.TreeNode,this.M=function(i,n,o){let s=this.ne(i,n,o);return s&&this.he(s),this.i},this.V=this.fe),this.h=new this.re}X(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)e=e.W;else if(n>0)i=e,e=e.U;else return e}return i}Z(e,r){let i=this.h;for(;e;)this.v(e.u,r)<=0?e=e.W:(i=e,e=e.U);return i}$(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)i=e,e=e.W;else if(n>0)e=e.U;else return e}return i}rr(e,r){let i=this.h;for(;e;)this.v(e.u,r)<0?(i=e,e=e.W):e=e.U;return i}ue(e){for(;;){let r=e.tt;if(r===this.h)return;if(e.ee===1){e.ee=0;return}if(e===r.U){let i=r.W;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.te():r.te();else if(i.W&&i.W.ee===1){i.ee=r.ee,r.ee=0,i.W.ee=0,r===this.Y?this.Y=r.te():r.te();return}else i.U&&i.U.ee===1?(i.ee=1,i.U.ee=0,i.se()):(i.ee=1,e=r)}else{let i=r.U;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.se():r.se();else if(i.U&&i.U.ee===1){i.ee=r.ee,r.ee=0,i.U.ee=0,r===this.Y?this.Y=r.se():r.se();return}else i.W&&i.W.ee===1?(i.ee=1,i.W.ee=0,i.te()):(i.ee=1,e=r)}}}fe(e){if(this.i===1)return this.clear(),this.h;let r=e;for(;r.U||r.W;){if(r.W)for(r=r.W;r.U;)r=r.U;else r=r.U;[e.u,r.u]=[r.u,e.u],[e.l,r.l]=[r.l,e.l],e=r}this.h.U===r?this.h.U=r.tt:this.h.W===r&&(this.h.W=r.tt),this.ue(r);let i=r.tt;return r===i.U?i.U=void 0:i.W=void 0,this.i-=1,this.Y.ee=0,i}oe(e,r){return e===void 0?!1:this.oe(e.U,r)||r(e)?!0:this.oe(e.W,r)}he(e){for(;;){let r=e.tt;if(r.ee===0)return;let i=r.tt;if(r===i.U){let n=i.W;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.W){if(e.ee=0,e.U&&(e.U.tt=r),e.W&&(e.W.tt=i),r.W=e.U,i.U=e.W,e.U=r,e.W=i,i===this.Y)this.Y=e,this.h.tt=e;else{let o=i.tt;o.U===i?o.U=e:o.W=e}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.se():i.se(),i.ee=1}else{let n=i.U;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.U){if(e.ee=0,e.U&&(e.U.tt=i),e.W&&(e.W.tt=r),i.W=e.U,r.U=e.W,e.U=i,e.W=r,i===this.Y)this.Y=e,this.h.tt=e;else{let o=i.tt;o.U===i?o.U=e:o.W=e}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.te():i.te(),i.ee=1}return}}ne(e,r,i){if(this.Y===void 0){this.i+=1,this.Y=new this.re(e,r),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 n,o=this.h.U,s=this.v(o.u,e);if(s===0){o.l=r;return}else if(s>0)o.U=new this.re(e,r),o.U.tt=o,n=o.U,this.h.U=n;else{let a=this.h.W,u=this.v(a.u,e);if(u===0){a.l=r;return}else if(u<0)a.W=new this.re(e,r),a.W.tt=a,n=a.W,this.h.W=n;else{if(i!==void 0){let f=i.o;if(f!==this.h){let d=this.v(f.u,e);if(d===0){f.l=r;return}else if(d>0){let h=f.L(),g=this.v(h.u,e);if(g===0){h.l=r;return}else g<0&&(n=new this.re(e,r),h.W===void 0?(h.W=n,n.tt=h):(f.U=n,n.tt=f))}}}if(n===void 0)for(n=this.Y;;){let f=this.v(n.u,e);if(f>0){if(n.U===void 0){n.U=new this.re(e,r),n.U.tt=n,n=n.U;break}n=n.U}else if(f<0){if(n.W===void 0){n.W=new this.re(e,r),n.W.tt=n,n=n.W;break}n=n.W}else{n.l=r;return}}}}return this.i+=1,n}I(e,r){for(;e;){let i=this.v(e.u,r);if(i<0)e=e.W;else if(i>0)e=e.U;else return e}return e||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(e,r){let i=e.o;if(i===this.h&&(0,tp.throwIteratorAccessError)(),this.i===1)return i.u=r,!0;if(i===this.h.U)return this.v(i.B().u,r)>0?(i.u=r,!0):!1;if(i===this.h.W)return this.v(i.L().u,r)<0?(i.u=r,!0):!1;let n=i.L().u;if(this.v(n,r)>=0)return!1;let o=i.B().u;return this.v(o,r)<=0?!1:(i.u=r,!0)}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=0,i=this;return this.oe(this.Y,function(n){return e===r?(i.V(n),!0):(r+=1,!1)}),this.i}eraseElementByKey(e){if(this.i===0)return!1;let r=this.I(this.Y,e);return r===this.h?!1:(this.V(r),!0)}eraseElementByIterator(e){let r=e.o;r===this.h&&(0,tp.throwIteratorAccessError)();let i=r.W===void 0;return e.iteratorType===0?i&&e.next():(!i||r.U===void 0)&&e.next(),this.V(r),e}forEach(e){let r=0;for(let i of this)e(i,r++,this)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r,i=0;for(let n of this){if(i===e){r=n;break}i+=1}return r}getHeight(){if(this.i===0)return 0;let e=function(r){return r?Math.max(e(r.U),e(r.W))+1:0};return e(this.Y)}},Qv=pa;Wn.default=Qv});var ya=O(Hn=>{"use strict";_();v();m();Object.defineProperty(Hn,"t",{value:!0});Hn.default=void 0;var Yv=nt(),$n=st(),ba=class extends Yv.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,$n.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,$n.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,$n.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,$n.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let e=this.o,r=this.h.tt;if(e===this.h)return r?r.rt-1:0;let i=0;for(e.U&&(i+=e.U.rt);e!==r;){let n=e.tt;e===n.W&&(i+=1,n.U&&(i+=n.U.rt)),e=n}return i}},Jv=ba;Hn.default=Jv});var ip=O(Vn=>{"use strict";_();v();m();Object.defineProperty(Vn,"t",{value:!0});Vn.default=void 0;var Xv=rp(ga()),Zv=rp(ya()),e1=st();function rp(t){return t&&t.t?t:{default:t}}var Ve=class t extends Zv.default{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){return this.o===this.h&&(0,e1.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},wa=class extends Xv.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.insert(o)})}*K(e){e!==void 0&&(yield*this.K(e.U),yield e.u,yield*this.K(e.W))}begin(){return new Ve(this.h.U||this.h,this.h,this)}end(){return new Ve(this.h,this.h,this)}rBegin(){return new Ve(this.h.W||this.h,this.h,this,1)}rEnd(){return new Ve(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(e,r){return this.M(e,void 0,r)}find(e){let r=this.I(this.Y,e);return new Ve(r,this.h,this)}lowerBound(e){let r=this.X(this.Y,e);return new Ve(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new Ve(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new Ve(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new Ve(r,this.h,this)}union(e){let r=this;return e.forEach(function(i){r.insert(i)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},t1=wa;Vn.default=t1});var sp=O(zn=>{"use strict";_();v();m();Object.defineProperty(zn,"t",{value:!0});zn.default=void 0;var r1=np(ga()),i1=np(ya()),n1=st();function np(t){return t&&t.t?t:{default:t}}var ze=class t extends i1.default{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){this.o===this.h&&(0,n1.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i==="0")return e.o.u;if(i==="1")return e.o.l},set(r,i,n){if(i!=="1")throw new TypeError("props must be 1");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},_a=class extends r1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.setElement(o[0],o[1])})}*K(e){e!==void 0&&(yield*this.K(e.U),yield[e.u,e.l],yield*this.K(e.W))}begin(){return new ze(this.h.U||this.h,this.h,this)}end(){return new ze(this.h,this.h,this)}rBegin(){return new ze(this.h.W||this.h,this.h,this,1)}rEnd(){return new ze(this.h,this.h,this,1)}front(){if(this.i===0)return;let e=this.h.U;return[e.u,e.l]}back(){if(this.i===0)return;let e=this.h.W;return[e.u,e.l]}lowerBound(e){let r=this.X(this.Y,e);return new ze(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new ze(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new ze(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new ze(r,this.h,this)}setElement(e,r,i){return this.M(e,r,i)}find(e){let r=this.I(this.Y,e);return new ze(r,this.h,this)}getElementByKey(e){return this.I(this.Y,e).l}union(e){let r=this;return e.forEach(function(i){r.setElement(i[0],i[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},s1=_a;zn.default=s1});var va=O(ma=>{"use strict";_();v();m();Object.defineProperty(ma,"t",{value:!0});ma.default=o1;function o1(t){let e=typeof t;return e==="object"&&t!==null||e==="function"}});var Ia=O(Qr=>{"use strict";_();v();m();Object.defineProperty(Qr,"t",{value:!0});Qr.HashContainerIterator=Qr.HashContainer=void 0;var op=nt(),Ea=a1(va()),Si=st();function a1(t){return t&&t.t?t:{default:t}}var Sa=class extends op.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,Si.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,Si.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,Si.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,Si.throwIteratorAccessError)(),this.o=this.o.L,this})}};Qr.HashContainerIterator=Sa;var Aa=class extends op.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(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1}M(e,r,i){i===void 0&&(i=(0,Ea.default)(e));let n;if(i){let o=e[this.HASH_TAG];if(o!==void 0)return this.H[o].l=r,this.i;Object.defineProperty(e,this.HASH_TAG,{value:this.H.length,configurable:!0}),n={u:e,l:r,L:this._,B:this.h},this.H.push(n)}else{let o=this.g[e];if(o)return o.l=r,this.i;n={u:e,l:r,L:this._,B:this.h},this.g[e]=n}return this.i===0?(this.p=n,this.h.B=n):this._.B=n,this._=n,this.h.L=n,++this.i}I(e,r){if(r===void 0&&(r=(0,Ea.default)(e)),r){let i=e[this.HASH_TAG];return i===void 0?this.h:this.H[i]}else return this.g[e]||this.h}clear(){let e=this.HASH_TAG;this.H.forEach(function(r){delete r.u[e]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(e,r){let i;if(r===void 0&&(r=(0,Ea.default)(e)),r){let n=e[this.HASH_TAG];if(n===void 0)return!1;delete e[this.HASH_TAG],i=this.H[n],delete this.H[n]}else{if(i=this.g[e],i===void 0)return!1;delete this.g[e]}return this.V(i),!0}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0,Si.throwIteratorAccessError)(),this.V(r),e.next()}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}};Qr.HashContainer=Aa});var lp=O(Kn=>{"use strict";_();v();m();Object.defineProperty(Kn,"t",{value:!0});Kn.default=void 0;var ap=Ia(),l1=st(),gr=class t extends ap.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){return this.o===this.h&&(0,l1.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ta=class extends ap.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.insert(i)})}begin(){return new gr(this.p,this.h,this)}end(){return new gr(this.h,this.h,this)}rBegin(){return new gr(this._,this.h,this,1)}rEnd(){return new gr(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(e,r){return this.M(e,void 0,r)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.u}find(e,r){let i=this.I(e,r);return new gr(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e(i.u,r++,this),i=i.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield e.u,e=e.B}.bind(this)()}},u1=Ta;Kn.default=u1});var cp=O(Gn=>{"use strict";_();v();m();Object.defineProperty(Gn,"t",{value:!0});Gn.default=void 0;var up=Ia(),c1=h1(va()),f1=st();function h1(t){return t&&t.t?t:{default:t}}var br=class t extends up.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){this.o===this.h&&(0,f1.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i==="0")return e.o.u;if(i==="1")return e.o.l},set(r,i,n){if(i!=="1")throw new TypeError("props must be 1");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ra=class extends up.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.setElement(i[0],i[1])})}begin(){return new br(this.p,this.h,this)}end(){return new br(this.h,this.h,this)}rBegin(){return new br(this._,this.h,this,1)}rEnd(){return new br(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(e,r,i){return this.M(e,r,i)}getElementByKey(e,r){if(r===void 0&&(r=(0,c1.default)(e)),r){let n=e[this.HASH_TAG];return n!==void 0?this.H[n].l:void 0}let i=this.g[e];return i?i.l:void 0}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return[r.u,r.l]}find(e,r){let i=this.I(e,r);return new br(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e([i.u,i.l],r++,this),i=i.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield[e.u,e.l],e=e.B}.bind(this)()}},d1=Ra;Gn.default=d1});var fp=O(Ne=>{"use strict";_();v();m();Object.defineProperty(Ne,"t",{value:!0});Object.defineProperty(Ne,"Deque",{enumerable:!0,get:function(){return _1.default}});Object.defineProperty(Ne,"HashMap",{enumerable:!0,get:function(){return S1.default}});Object.defineProperty(Ne,"HashSet",{enumerable:!0,get:function(){return E1.default}});Object.defineProperty(Ne,"LinkList",{enumerable:!0,get:function(){return w1.default}});Object.defineProperty(Ne,"OrderedMap",{enumerable:!0,get:function(){return v1.default}});Object.defineProperty(Ne,"OrderedSet",{enumerable:!0,get:function(){return m1.default}});Object.defineProperty(Ne,"PriorityQueue",{enumerable:!0,get:function(){return b1.default}});Object.defineProperty(Ne,"Queue",{enumerable:!0,get:function(){return g1.default}});Object.defineProperty(Ne,"Stack",{enumerable:!0,get:function(){return p1.default}});Object.defineProperty(Ne,"Vector",{enumerable:!0,get:function(){return y1.default}});var p1=ot(Kd()),g1=ot(Gd()),b1=ot(Qd()),y1=ot(Yd()),w1=ot(Jd()),_1=ot(Xd()),m1=ot(ip()),v1=ot(sp()),E1=ot(lp()),S1=ot(cp());function ot(t){return t&&t.t?t:{default:t}}});var dp=O((NU,hp)=>{"use strict";_();v();m();var A1=fp().OrderedSet,at=it()("number-allocator:trace"),I1=it()("number-allocator:error");function Re(t,e){this.low=t,this.high=e}Re.prototype.equals=function(t){return this.low===t.low&&this.high===t.high};Re.prototype.compare=function(t){return this.low<t.low&&this.high<t.low?-1:t.low<this.low&&t.high<this.low?1:0};function lt(t,e){if(!(this instanceof lt))return new lt(t,e);this.min=t,this.max=e,this.ss=new A1([],(r,i)=>r.compare(i)),at("Create"),this.clear()}lt.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low};lt.prototype.alloc=function(){if(this.ss.size()===0)return at("alloc():empty"),null;let t=this.ss.begin(),e=t.pointer.low,r=t.pointer.high,i=e;return i+1<=r?this.ss.updateKeyByIterator(t,new Re(e+1,r)):this.ss.eraseElementByPos(0),at("alloc():"+i),i};lt.prototype.use=function(t){let e=new Re(t,t),r=this.ss.lowerBound(e);if(!r.equals(this.ss.end())){let i=r.pointer.low,n=r.pointer.high;return r.pointer.equals(e)?(this.ss.eraseElementByIterator(r),at("use():"+t),!0):i>t?!1:i===t?(this.ss.updateKeyByIterator(r,new Re(i+1,n)),at("use():"+t),!0):n===t?(this.ss.updateKeyByIterator(r,new Re(i,n-1)),at("use():"+t),!0):(this.ss.updateKeyByIterator(r,new Re(t+1,n)),this.ss.insert(new Re(i,t-1)),at("use():"+t),!0)}return at("use():failed"),!1};lt.prototype.free=function(t){if(t<this.min||t>this.max){I1("free():"+t+" is out of range");return}let e=new Re(t,t),r=this.ss.upperBound(e);if(r.equals(this.ss.end())){if(r.equals(this.ss.begin())){this.ss.insert(e);return}r.pre();let i=r.pointer.high;r.pointer.high+1===t?this.ss.updateKeyByIterator(r,new Re(i,t)):this.ss.insert(e)}else if(r.equals(this.ss.begin()))if(t+1===r.pointer.low){let i=r.pointer.high;this.ss.updateKeyByIterator(r,new Re(t,i))}else this.ss.insert(e);else{let i=r.pointer.low,n=r.pointer.high;r.pre();let o=r.pointer.low;r.pointer.high+1===t?t+1===i?(this.ss.eraseElementByIterator(r),this.ss.updateKeyByIterator(r,new Re(o,n))):this.ss.updateKeyByIterator(r,new Re(o,t)):t+1===i?(this.ss.eraseElementByIterator(r.next()),this.ss.insert(new Re(t,n))):this.ss.insert(e)}at("free():"+t)};lt.prototype.clear=function(){at("clear()"),this.ss.clear(),this.ss.insert(new Re(this.min,this.max))};lt.prototype.intervalCount=function(){return this.ss.size()};lt.prototype.dump=function(){console.log("length:"+this.ss.size());for(let t of this.ss)console.log(t)};hp.exports=lt});var Ca=O((GU,pp)=>{_();v();m();var T1=dp();pp.exports.NumberAllocator=T1});var gp=O(ka=>{"use strict";_();v();m();Object.defineProperty(ka,"__esModule",{value:!0});var R1=zd(),C1=Ca(),Pa=class{constructor(e){e>0&&(this.aliasToTopic=new R1.LRUCache({max:e}),this.topicToAlias={},this.numberAllocator=new C1.NumberAllocator(1,e),this.max=e,this.length=0)}put(e,r){if(r===0||r>this.max)return!1;let i=this.aliasToTopic.get(r);return i&&delete this.topicToAlias[i],this.aliasToTopic.set(r,e),this.topicToAlias[e]=r,this.numberAllocator.use(r),this.length=this.aliasToTopic.size,!0}getTopicByAlias(e){return this.aliasToTopic.get(e)}getAliasByTopic(e){let r=this.topicToAlias[e];return typeof r<"u"&&this.aliasToTopic.get(r),r}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){let e=this.numberAllocator.firstVacant();return e||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};ka.default=Pa});var bp=O(Ai=>{"use strict";_();v();m();var P1=Ai&&Ai.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ai,"__esModule",{value:!0});var k1=Ei(),B1=P1(gp()),x1=cr(),O1=(t,e)=>{t.log("_handleConnack");let{options:r}=t,n=r.protocolVersion===5?e.reasonCode:e.returnCode;if(clearTimeout(t.connackTimer),delete t.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535){t.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}e.properties.topicAliasMaximum>0&&(t.topicAliasSend=new B1.default(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&r.keepalive&&(r.keepalive=e.properties.serverKeepAlive),e.properties.maximumPacketSize&&(r.properties||(r.properties={}),r.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(n===0)t.reconnecting=!1,t._onConnect(e);else if(n>0){let o=new x1.ErrorWithReasonCode(`Connection refused: ${k1.ReasonCodes[n]}`,n);t.emit("error",o),t.options.reconnectOnConnackError&&t._cleanUp(!0)}};Ai.default=O1});var yp=O(Ba=>{"use strict";_();v();m();Object.defineProperty(Ba,"__esModule",{value:!0});var M1=(t,e,r)=>{t.log("handling pubrel packet");let i=typeof r<"u"?r:t.noop,{messageId:n}=e,o={cmd:"pubcomp",messageId:n};t.incomingStore.get(e,(s,a)=>{s?t._sendPacket(o,i):(t.emit("message",a.topic,a.payload,a),t.handleMessage(a,u=>{if(u)return i(u);t.incomingStore.del(a,t.noop),t._sendPacket(o,i)}))})};Ba.default=M1});var wp=O(Ii=>{"use strict";_();v();m();var Ti=Ii&&Ii.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ii,"__esModule",{value:!0});var L1=Ti(Ud()),q1=Ti(Fd()),U1=Ti(bp()),N1=Ti(Ei()),D1=Ti(yp()),j1=(t,e,r)=>{let{options:i}=t;if(i.protocolVersion===5&&i.properties&&i.properties.maximumPacketSize&&i.properties.maximumPacketSize<e.length)return t.emit("error",new Error(`exceeding packets size ${e.cmd}`)),t.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),t;switch(t.log("_handlePacket :: emitting packetreceive"),t.emit("packetreceive",e),e.cmd){case"publish":(0,L1.default)(t,e,r);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":t.reschedulePing(),(0,N1.default)(t,e),r();break;case"pubrel":t.reschedulePing(),(0,D1.default)(t,e,r);break;case"connack":(0,U1.default)(t,e),r();break;case"auth":t.reschedulePing(),(0,q1.default)(t,e),r();break;case"pingresp":t.log("_handlePacket :: received pingresp"),t.reschedulePing(!0),r();break;case"disconnect":t.emit("disconnect",e),r();break;default:t.log("_handlePacket :: unknown command"),r();break}};Ii.default=j1});var _p=O(Yr=>{"use strict";_();v();m();var F1=Yr&&Yr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.TypedEventEmitter=void 0;var W1=F1((Ot(),Q(xt))),$1=cr(),Qn=class{};Yr.TypedEventEmitter=Qn;(0,$1.applyMixin)(Qn,W1.default)});var Ri=O(yr=>{"use strict";_();v();m();Object.defineProperty(yr,"__esModule",{value:!0});yr.isReactNativeBrowser=yr.isWebWorker=void 0;var H1=()=>{var t;return typeof window<"u"?typeof navigator<"u"&&((t=navigator.userAgent)===null||t===void 0?void 0:t.toLowerCase().indexOf(" electron/"))>-1&&(!(R===null||R===void 0)&&R.versions)?!Object.prototype.hasOwnProperty.call(R.versions,"electron"):typeof window.document<"u":!1},mp=()=>{var t,e;return!!(typeof self=="object"&&(!((e=(t=self?.constructor)===null||t===void 0?void 0:t.name)===null||e===void 0)&&e.includes("WorkerGlobalScope")))},vp=()=>typeof navigator<"u"&&navigator.product==="ReactNative",V1=H1()||mp()||vp();yr.isWebWorker=mp();yr.isReactNativeBrowser=vp();yr.default=V1});var Sp=O((Yn,Ep)=>{_();v();m();(function(t,e){typeof Yn=="object"&&typeof Ep<"u"?e(Yn):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.fastUniqueNumbers={}))})(Yn,function(t){"use strict";var e=function(g){return function(b){var E=g(b);return b.add(E),E}},r=function(g){return function(b,E){return g.set(b,E),E}},i=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,n=536870912,o=n*2,s=function(g,b){return function(E){var w=b.get(E),S=w===void 0?E.size:w<o?w+1:0;if(!E.has(S))return g(E,S);if(E.size<n){for(;E.has(S);)S=Math.floor(Math.random()*o);return g(E,S)}if(E.size>i)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;E.has(S);)S=Math.floor(Math.random()*i);return g(E,S)}},a=new WeakMap,u=r(a),f=s(u,a),d=e(f);t.addUniqueNumber=d,t.generateUniqueNumber=f})});var Ip=O((Jn,Ap)=>{_();v();m();(function(t,e){typeof Jn=="object"&&typeof Ap<"u"?e(Jn,Sp()):typeof define=="function"&&define.amd?define(["exports","fast-unique-numbers"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.workerTimersBroker={},t.fastUniqueNumbers))})(Jn,function(t,e){"use strict";var r=function(s){return s.method!==void 0&&s.method==="call"},i=function(s){return s.error===null&&typeof s.id=="number"},n=function(s){var a=new Map([[0,function(){}]]),u=new Map([[0,function(){}]]),f=new Map,d=new Worker(s);d.addEventListener("message",function(w){var S=w.data;if(r(S)){var I=S.params,C=I.timerId,k=I.timerType;if(k==="interval"){var M=a.get(C);if(typeof M=="number"){var q=f.get(M);if(q===void 0||q.timerId!==C||q.timerType!==k)throw new Error("The timer is in an undefined state.")}else if(typeof M<"u")M();else throw new Error("The timer is in an undefined state.")}else if(k==="timeout"){var G=u.get(C);if(typeof G=="number"){var F=f.get(G);if(F===void 0||F.timerId!==C||F.timerType!==k)throw new Error("The timer is in an undefined state.")}else if(typeof G<"u")G(),u.delete(C);else throw new Error("The timer is in an undefined state.")}}else if(i(S)){var K=S.id,$=f.get(K);if($===void 0)throw new Error("The timer is in an undefined state.");var te=$.timerId,dt=$.timerType;f.delete(K),dt==="interval"?a.delete(te):u.delete(te)}else{var Fe=S.error.message;throw new Error(Fe)}});var h=function(S){var I=e.generateUniqueNumber(f);f.set(I,{timerId:S,timerType:"interval"}),a.set(S,I),d.postMessage({id:I,method:"clear",params:{timerId:S,timerType:"interval"}})},g=function(S){var I=e.generateUniqueNumber(f);f.set(I,{timerId:S,timerType:"timeout"}),u.set(S,I),d.postMessage({id:I,method:"clear",params:{timerId:S,timerType:"timeout"}})},b=function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=e.generateUniqueNumber(a);return a.set(C,function(){S(),typeof a.get(C)=="function"&&d.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"interval"}})}),d.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"interval"}}),C},E=function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=e.generateUniqueNumber(u);return u.set(C,S),d.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"timeout"}}),C};return{clearInterval:h,clearTimeout:g,setInterval:b,setTimeout:E}};t.load=n})});var Rp=O((Xn,Tp)=>{_();v();m();(function(t,e){typeof Xn=="object"&&typeof Tp<"u"?e(Xn,Ip()):typeof define=="function"&&define.amd?define(["exports","worker-timers-broker"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.workerTimers={},t.workerTimersBroker))})(Xn,function(t,e){"use strict";var r=function(d,h){var g=null;return function(){if(g!==null)return g;var b=new Blob([h],{type:"application/javascript; charset=utf-8"}),E=URL.createObjectURL(b);return g=d(E),setTimeout(function(){return URL.revokeObjectURL(E)}),g}},i=`(()=>{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)})()})();`,n=r(e.load,i),o=function(d){return n().clearInterval(d)},s=function(d){return n().clearTimeout(d)},a=function(){var d;return(d=n()).setInterval.apply(d,arguments)},u=function(){var d;return(d=n()).setTimeout.apply(d,arguments)};t.clearInterval=o,t.clearTimeout=s,t.setInterval=a,t.setTimeout=u})});var Bp=O(St=>{"use strict";_();v();m();var z1=St&&St.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),K1=St&&St.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),G1=St&&St.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[i.length]=n);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i=t(e),n=0;n<i.length;n++)i[n]!=="default"&&z1(r,e,i[n]);return K1(r,e),r}}();Object.defineProperty(St,"__esModule",{value:!0});var xa=G1(Ri()),Cp=Rp(),Pp={set:Cp.setInterval,clear:Cp.clearInterval},kp={set:(t,e)=>setInterval(t,e),clear:t=>clearInterval(t)},Q1=t=>{switch(t){case"native":return kp;case"worker":return Pp;case"auto":default:return xa.default&&!xa.isWebWorker&&!xa.isReactNativeBrowser?Pp:kp}};St.default=Q1});var Ma=O(Ci=>{"use strict";_();v();m();var Y1=Ci&&Ci.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ci,"__esModule",{value:!0});var J1=Y1(Bp()),Oa=class{get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}constructor(e,r){this.destroyed=!1,this.client=e,this.timer=typeof r=="object"&&"set"in r&&"clear"in r?r:(0,J1.default)(r),this.setKeepalive(e.options.keepalive)}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(e){if(e*=1e3,isNaN(e)||e<=0||e>2147483647)throw new Error(`Keepalive value must be an integer between 0 and 2147483647. Provided value is ${e}`);this._keepalive=e,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${e}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let e=Math.ceil(this._keepalive*1.5);this._keepaliveTimeoutTimestamp=Date.now()+e,this._intervalEvery=Math.ceil(this._keepalive/2),this.timerId=this.timer.set(()=>{this.destroyed||(this.counter+=1,this.counter===2?this.client.sendPing():this.counter>2&&this.client.onKeepaliveTimeout())},this._intervalEvery)}};Ci.default=Oa});var ts=O(Ke=>{"use strict";_();v();m();var X1=Ke&&Ke.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Z1=Ke&&Ke.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),qp=Ke&&Ke.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[i.length]=n);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i=t(e),n=0;n<i.length;n++)i[n]!=="default"&&X1(r,e,i[n]);return Z1(r,e),r}}(),Ht=Ke&&Ke.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ke,"__esModule",{value:!0});var eE=Ht(ju()),La=Ht(Pd()),tE=Ht(Vo()),rE=Nt(),xp=Ht(Od()),Op=qp(Ld()),iE=Ht(it()),Jr=Ht(Go()),nE=Ht(wp()),Zn=cr(),sE=_p(),oE=Ht(Ma()),Mp=qp(Ri()),qa=globalThis.setImmediate||((...t)=>{let e=t.shift();(0,Zn.nextTick)(()=>{e(...t)})}),Lp={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0,timerVariant:"auto"},es=class t extends sE.TypedEventEmitter{static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(e,r){super(),this.options=r||{};for(let i in Lp)typeof this.options[i]>"u"?this.options[i]=Lp[i]:this.options[i]=r[i];this.log=this.options.log||(0,iE.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: version:",t.VERSION),Mp.isWebWorker?this.log("MqttClient :: environment","webworker"):this.log("MqttClient :: environment",Mp.default?"browser":"node"),this.log("MqttClient :: options.protocol",r.protocol),this.log("MqttClient :: options.protocolVersion",r.protocolVersion),this.log("MqttClient :: options.username",r.username),this.log("MqttClient :: options.keepalive",r.keepalive),this.log("MqttClient :: options.reconnectPeriod",r.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",r.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",r.properties?r.properties.topicAliasMaximum:void 0),this.options.clientId=typeof r.clientId=="string"?r.clientId:t.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=r.protocolVersion===5&&r.customHandleAcks?r.customHandleAcks:(...i)=>{i[3](null,0)},this.options.writeCache||(La.default.writeToStream.cacheNumbers=!1),this.streamBuilder=e,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new tE.default:this.options.messageIdProvider,this.outgoingStore=r.outgoingStore||new Jr.default,this.incomingStore=r.incomingStore||new Jr.default,this.queueQoSZero=r.queueQoSZero===void 0?!0:r.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.keepaliveManager=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,r.properties&&r.properties.topicAliasMaximum>0&&(r.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new eE.default(r.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:i}=this,n=()=>{let o=i.shift();this.log("deliver :: entry %o",o);let s=null;if(!o){this._resubscribe();return}s=o.packet,this.log("deliver :: call _sendPacket for %o",s);let a=!0;s.messageId&&s.messageId!==0&&(this.messageIdProvider.register(s.messageId)||(a=!1)),a?this._sendPacket(s,u=>{o.cb&&o.cb(u),n()}):(this.log("messageId: %d has already used. The message is skipped and removed.",s.messageId),n())};this.log("connect :: sending queued packets"),n()}),this.on("close",()=>{this.log("close :: connected set to `false`"),this.connected=!1,this.log("close :: clearing connackTimer"),clearTimeout(this.connackTimer),this._destroyKeepaliveManager(),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log("close :: calling _setupReconnect"),this._setupReconnect()}),this.options.manualConnect||(this.log("MqttClient :: setting up stream"),this.connect())}handleAuth(e,r){r()}handleMessage(e,r){r()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var e;let r=new rE.Writable,i=La.default.parser(this.options),n=null,o=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new Jr.default,this.outgoingStore=this.options.outgoingStore||new Jr.default,this.disconnecting=!1,this.disconnected=!1),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),i.on("packet",d=>{this.log("parser :: on packet push to packets array."),o.push(d)});let s=()=>{this.log("work :: getting next packet in queue");let d=o.shift();if(d)this.log("work :: packet pulled from queue"),(0,nE.default)(this,d,a);else{this.log("work :: no packets in queue");let h=n;n=null,this.log("work :: done flag is %s",!!h),h&&h()}},a=()=>{if(o.length)(0,Zn.nextTick)(s);else{let d=n;n=null,d()}};r._write=(d,h,g)=>{n=g,this.log("writable stream :: parsing buffer"),i.parse(d),s()};let u=d=>{this.log("streamErrorHandler :: error",d.message),d.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",d)):this.noop(d)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(r),this.stream.on("error",u),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 f={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&&(f.will=Object.assign(Object.assign({},this.options.will),{payload:(e=this.options.will)===null||e===void 0?void 0:e.payload})),this.topicAliasRecv&&(f.properties||(f.properties={}),this.topicAliasRecv&&(f.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(f),i.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 d=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(d)}}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(e,r,i,n){this.log("publish :: message `%s` to topic `%s`",r,e);let{options:o}=this;typeof i=="function"&&(n=i,i=null),i=i||{},i=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),i);let{qos:a,retain:u,dup:f,properties:d,cbStorePut:h}=i;if(this._checkDisconnecting(n))return this;let g=()=>{let b=0;if((a===1||a===2)&&(b=this._nextId(),b===null))return this.log("No messageId left"),!1;let E={cmd:"publish",topic:e,payload:r,qos:a,retain:u,messageId:b,dup:f};switch(o.protocolVersion===5&&(E.properties=d),this.log("publish :: qos",a),a){case 1:case 2:this.outgoing[E.messageId]={volatile:!1,cb:n||this.noop},this.log("MqttClient:publish: packet cmd: %s",E.cmd),this._sendPacket(E,void 0,h);break;default:this.log("MqttClient:publish: packet cmd: %s",E.cmd),this._sendPacket(E,n,h);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!g())&&this._storeProcessingQueue.push({invoke:g,cbStorePut:i.cbStorePut,callback:n}),this}publishAsync(e,r,i){return new Promise((n,o)=>{this.publish(e,r,i,(s,a)=>{s?o(s):n(a)})})}subscribe(e,r,i){let n=this.options.protocolVersion;typeof r=="function"&&(i=r),i=i||this.noop;let o=!1,s=[];typeof e=="string"?(e=[e],s=e):Array.isArray(e)?s=e:typeof e=="object"&&(o=e.resubscribe,delete e.resubscribe,s=Object.keys(e));let a=Op.validateTopics(s);if(a!==null)return qa(i,new Error(`Invalid topic ${a}`)),this;if(this._checkDisconnecting(i))return this.log("subscribe: discconecting true"),this;let u={qos:0};n===5&&(u.nl=!1,u.rap=!1,u.rh=0),r=Object.assign(Object.assign({},u),r);let f=r.properties,d=[],h=(b,E)=>{if(E=E||r,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,b)||this._resubscribeTopics[b].qos<E.qos||o){let w={topic:b,qos:E.qos};n===5&&(w.nl=E.nl,w.rap=E.rap,w.rh=E.rh,w.properties=f),this.log("subscribe: pushing topic `%s` and qos `%s` to subs list",w.topic,w.qos),d.push(w)}};if(Array.isArray(e)?e.forEach(b=>{this.log("subscribe: array topic %s",b),h(b)}):Object.keys(e).forEach(b=>{this.log("subscribe: object topic %s, %o",b,e[b]),h(b,e[b])}),!d.length)return i(null,[]),this;let g=()=>{let b=this._nextId();if(b===null)return this.log("No messageId left"),!1;let E={cmd:"subscribe",subscriptions:d,messageId:b};if(f&&(E.properties=f),this.options.resubscribe){this.log("subscribe :: resubscribe true");let w=[];d.forEach(S=>{if(this.options.reconnectPeriod>0){let I={qos:S.qos};n===5&&(I.nl=S.nl||!1,I.rap=S.rap||!1,I.rh=S.rh||0,I.properties=S.properties),this._resubscribeTopics[S.topic]=I,w.push(S.topic)}}),this.messageIdToTopic[E.messageId]=w}return this.outgoing[E.messageId]={volatile:!0,cb(w,S){if(!w){let{granted:I}=S;for(let C=0;C<I.length;C+=1)d[C].qos=I[C]}i(w,d,S)}},this.log("subscribe :: call _sendPacket"),this._sendPacket(E),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!g())&&this._storeProcessingQueue.push({invoke:g,callback:i}),this}subscribeAsync(e,r){return new Promise((i,n)=>{this.subscribe(e,r,(o,s)=>{o?n(o):i(s)})})}unsubscribe(e,r,i){typeof e=="string"&&(e=[e]),typeof r=="function"&&(i=r),i=i||this.noop;let n=Op.validateTopics(e);if(n!==null)return qa(i,new Error(`Invalid topic ${n}`)),this;if(this._checkDisconnecting(i))return this;let o=()=>{let s=this._nextId();if(s===null)return this.log("No messageId left"),!1;let a={cmd:"unsubscribe",messageId:s,unsubscriptions:[]};return typeof e=="string"?a.unsubscriptions=[e]:Array.isArray(e)&&(a.unsubscriptions=e),this.options.resubscribe&&a.unsubscriptions.forEach(u=>{delete this._resubscribeTopics[u]}),typeof r=="object"&&r.properties&&(a.properties=r.properties),this.outgoing[a.messageId]={volatile:!0,cb:i},this.log("unsubscribe: call _sendPacket"),this._sendPacket(a),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,callback:i}),this}unsubscribeAsync(e,r){return new Promise((i,n)=>{this.unsubscribe(e,r,(o,s)=>{o?n(o):i(s)})})}end(e,r,i){this.log("end :: (%s)",this.options.clientId),(e==null||typeof e!="boolean")&&(i=i||r,r=e,e=!1),typeof r!="object"&&(i=i||r,r=null),this.log("end :: cb? %s",!!i),(!i||typeof i!="function")&&(i=this.noop);let n=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(s=>{this.outgoingStore.close(a=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),i){let u=s||a;this.log("end :: closeStores: invoking callback with args"),i(u)}})}),this._deferredReconnect?this._deferredReconnect():(this.options.reconnectPeriod===0||this.options.manualConnect)&&(this.disconnecting=!1)},o=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,e),this._cleanUp(e,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,Zn.nextTick)(n)},r)};return this.disconnecting?(i(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&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,o,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),o()),this)}endAsync(e,r){return new Promise((i,n)=>{this.end(e,r,o=>{o?n(o):i()})})}removeOutgoingMessage(e){if(this.outgoing[e]){let{cb:r}=this.outgoing[e];this._removeOutgoingAndStoreMessage(e,()=>{r(new Error("Message removed"))})}return this}reconnect(e){this.log("client reconnect");let r=()=>{e?(this.options.incomingStore=e.incomingStore,this.options.outgoingStore=e.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new Jr.default,this.outgoingStore=this.options.outgoingStore||new Jr.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),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(e=>{this.outgoing[e].volatile&&typeof this.outgoing[e].cb=="function"&&(this.outgoing[e].cb(new Error("Connection closed")),delete this.outgoing[e])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(e=>{typeof this.outgoing[e].cb=="function"&&(this.outgoing[e].cb(new Error("Connection closed")),delete this.outgoing[e])}))}_removeTopicAliasAndRecoverTopicName(e){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",r,i),i.length===0){if(typeof r>"u")return new Error("Unregistered Topic Alias");if(i=this.topicAliasSend.getTopicByAlias(r),typeof i>"u")return new Error("Unregistered Topic Alias");e.topic=i}r&&delete e.properties.topicAlias}_checkDisconnecting(e){return this.disconnecting&&(e&&e!==this.noop?e(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(e,r,i={}){if(r&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",r)),this.log("_cleanUp :: forced? %s",e),e)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let n=Object.assign({cmd:"disconnect"},i);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(n,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),qa(()=>{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._destroyKeepaliveManager(),r&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",r),r())}_storeAndSend(e,r,i){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",e.cmd);let n=e,o;if(n.cmd==="publish"&&(n=(0,xp.default)(e),o=this._removeTopicAliasAndRecoverTopicName(n),o))return r&&r(o);this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i(),this._writePacket(e,r)})}_applyTopicAlias(e){if(this.options.protocolVersion===5&&e.cmd==="publish"){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.topicAliasSend)if(r){if(i.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",i,r),!this.topicAliasSend.put(i,r)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}else i.length!==0&&(this.options.autoAssignTopicAlias?(r=this.topicAliasSend.getAliasByTopic(i),r?(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",i,r)):(r=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(i,r),e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",i,r))):this.options.autoUseTopicAlias&&(r=this.topicAliasSend.getAliasByTopic(i),r&&(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto use topic: %s - alias: %d",i,r))));else if(r)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}}_noop(e){this.log("noop ::",e)}_writePacket(e,r){this.log("_writePacket :: packet: %O",e),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",e),this.log("_writePacket :: writing to stream");let i=La.default.writeToStream(e,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",i),!i&&r&&r!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",r)):r&&(this.log("_writePacket :: invoking cb"),r())}_sendPacket(e,r,i,n){this.log("_sendPacket :: (%s) :: start",this.options.clientId),i=i||this.noop,r=r||this.noop;let o=this._applyTopicAlias(e);if(o){r(o);return}if(!this.connected){if(e.cmd==="auth"){this._writePacket(e,r);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(e,r,i);return}if(n){this._writePacket(e,r);return}switch(e.cmd){case"publish":break;case"pubrel":this._storeAndSend(e,r,i);return;default:this._writePacket(e,r);return}switch(e.qos){case 2:case 1:this._storeAndSend(e,r,i);break;case 0:default:this._writePacket(e,r);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(e,r,i){this.log("_storePacket :: packet: %o",e),this.log("_storePacket :: cb? %s",!!r),i=i||this.noop;let n=e;if(n.cmd==="publish"){n=(0,xp.default)(e);let s=this._removeTopicAliasAndRecoverTopicName(n);if(s)return r&&r(s)}let o=n.qos||0;o===0&&this.queueQoSZero||n.cmd!=="publish"?this.queue.push({packet:n,cb:r}):o>0?(r=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i()})):r&&r(new Error("No connection to broker"))}_setupKeepaliveManager(){this.log("_setupKeepaliveManager :: keepalive %d (seconds)",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new oE.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log("_destroyKeepaliveManager :: destroying keepalive manager"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(e=!1){this.keepaliveManager&&this.options.keepalive&&(e||this.options.reschedulePings)&&this._reschedulePing()}_reschedulePing(){this.log("_reschedulePing :: rescheduling ping"),this.keepaliveManager.reschedule()}sendPing(){this.log("_sendPing :: sending pingreq"),this._sendPacket({cmd:"pingreq"})}onKeepaliveTimeout(){this.emit("error",new Error("Keepalive timeout")),this.log("onKeepaliveTimeout :: calling _cleanUp with force true"),this._cleanUp(!0)}_resubscribe(){this.log("_resubscribe");let e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let r=0;r<e.length;r++){let i={};i[e[r]]=this._resubscribeTopics[e[r]],i.resubscribe=!0,this.subscribe(i,{properties:i[e[r]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1}_onConnect(e){if(this.disconnected){this.emit("connect",e);return}this.connackPacket=e,this.messageIdProvider.clear(),this._setupKeepaliveManager(),this.connected=!0;let r=()=>{let i=this.outgoingStore.createStream(),n=()=>{i.destroy(),i=null,this._flushStoreProcessingQueue(),o()},o=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",n),i.on("error",a=>{o(),this._flushStoreProcessingQueue(),this.removeListener("close",n),this.emit("error",a)});let s=()=>{if(!i)return;let a=i.read(1),u;if(!a){i.once("readable",s);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[a.messageId]){s();return}!this.disconnecting&&!this.reconnectTimer?(u=this.outgoing[a.messageId]?this.outgoing[a.messageId].cb:null,this.outgoing[a.messageId]={volatile:!1,cb(f,d){u&&u(f,d),s()}},this._packetIdsDuringStoreProcessing[a.messageId]=!0,this.messageIdProvider.register(a.messageId)?this._sendPacket(a,void 0,void 0,!0):this.log("messageId: %d has already used.",a.messageId)):i.destroy&&i.destroy()};i.on("end",()=>{let a=!0;for(let u in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[u]){a=!1;break}this.removeListener("close",n),a?(o(),this._invokeAllStoreProcessingQueue(),this.emit("connect",e)):r()}),s()};r()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error("Connection closed")),e.callback&&e.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(e,r){delete this.outgoing[e],this.outgoingStore.del({messageId:e},(i,n)=>{r(i,n),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue()})}};es.VERSION=Zn.MQTTJS_VERSION;Ke.default=es});var Up=O(Na=>{"use strict";_();v();m();Object.defineProperty(Na,"__esModule",{value:!0});var aE=Ca(),Ua=class{constructor(){this.numberAllocator=new aE.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(e){return this.numberAllocator.use(e)}deallocate(e){this.numberAllocator.free(e)}clear(){this.numberAllocator.clear()}};Na.default=Ua});function wr(t){throw new RangeError(fE[t])}function Np(t,e){let r=t.split("@"),i="";r.length>1&&(i=r[0]+"@",t=r[1]);let n=function(o,s){let a=[],u=o.length;for(;u--;)a[u]=s(o[u]);return a}((t=t.replace(cE,".")).split("."),e).join(".");return i+n}function Wp(t){let e=[],r=0,i=t.length;for(;r<i;){let n=t.charCodeAt(r++);if(n>=55296&&n<=56319&&r<i){let o=t.charCodeAt(r++);(64512&o)==56320?e.push(((1023&n)<<10)+(1023&o)+65536):(e.push(n),r--)}else e.push(n)}return e}var lE,uE,cE,fE,ut,Da,Dp,$p,jp,Fp,Vt,Hp=Ae(()=>{_();v();m();lE=/^xn--/,uE=/[^\0-\x7E]/,cE=/[\x2E\u3002\uFF0E\uFF61]/g,fE={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ut=Math.floor,Da=String.fromCharCode;Dp=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},$p=function(t,e,r){let i=0;for(t=r?ut(t/700):t>>1,t+=ut(t/e);t>455;i+=36)t=ut(t/35);return ut(i+36*t/(t+38))},jp=function(t){let e=[],r=t.length,i=0,n=128,o=72,s=t.lastIndexOf("-");s<0&&(s=0);for(let u=0;u<s;++u)t.charCodeAt(u)>=128&&wr("not-basic"),e.push(t.charCodeAt(u));for(let u=s>0?s+1:0;u<r;){let f=i;for(let h=1,g=36;;g+=36){u>=r&&wr("invalid-input");let b=(a=t.charCodeAt(u++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(b>=36||b>ut((2147483647-i)/h))&&wr("overflow"),i+=b*h;let E=g<=o?1:g>=o+26?26:g-o;if(b<E)break;let w=36-E;h>ut(2147483647/w)&&wr("overflow"),h*=w}let d=e.length+1;o=$p(i-f,d,f==0),ut(i/d)>2147483647-n&&wr("overflow"),n+=ut(i/d),i%=d,e.splice(i++,0,n)}var a;return String.fromCodePoint(...e)},Fp=function(t){let e=[],r=(t=Wp(t)).length,i=128,n=0,o=72;for(let u of t)u<128&&e.push(Da(u));let s=e.length,a=s;for(s&&e.push("-");a<r;){let u=2147483647;for(let d of t)d>=i&&d<u&&(u=d);let f=a+1;u-i>ut((2147483647-n)/f)&&wr("overflow"),n+=(u-i)*f,i=u;for(let d of t)if(d<i&&++n>2147483647&&wr("overflow"),d==i){let h=n;for(let g=36;;g+=36){let b=g<=o?1:g>=o+26?26:g-o;if(h<b)break;let E=h-b,w=36-b;e.push(Da(Dp(b+E%w,0))),h=ut(E/w)}e.push(Da(Dp(h,0))),o=$p(n,f,a==s),n=0,++a}++n,++i}return e.join("")},Vt={version:"2.1.0",ucs2:{decode:Wp,encode:t=>String.fromCodePoint(...t)},decode:jp,encode:Fp,toASCII:function(t){return Np(t,function(e){return uE.test(e)?"xn--"+Fp(e):e})},toUnicode:function(t){return Np(t,function(e){return lE.test(e)?jp(e.slice(4).toLowerCase()):e})}};Vt.decode;Vt.encode;Vt.toASCII;Vt.toUnicode;Vt.ucs2;Vt.version});function hE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var dE,Pi,pE,ct,Vp=Ae(()=>{_();v();m();dE=function(t,e,r,i){e=e||"&",r=r||"=";var n={};if(typeof t!="string"||t.length===0)return n;var o=/\+/g;t=t.split(e);var s=1e3;i&&typeof i.maxKeys=="number"&&(s=i.maxKeys);var a=t.length;s>0&&a>s&&(a=s);for(var u=0;u<a;++u){var f,d,h,g,b=t[u].replace(o,"%20"),E=b.indexOf(r);E>=0?(f=b.substr(0,E),d=b.substr(E+1)):(f=b,d=""),h=decodeURIComponent(f),g=decodeURIComponent(d),hE(n,h)?Array.isArray(n[h])?n[h].push(g):n[h]=[n[h],g]:n[h]=g}return n},Pi=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},pE=function(t,e,r,i){return e=e||"&",r=r||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map(function(n){var o=encodeURIComponent(Pi(n))+r;return Array.isArray(t[n])?t[n].map(function(s){return o+encodeURIComponent(Pi(s))}).join(e):o+encodeURIComponent(Pi(t[n]))}).join(e):i?encodeURIComponent(Pi(i))+r+encodeURIComponent(Pi(t)):""},ct={};ct.decode=ct.parse=dE,ct.encode=ct.stringify=pE;ct.decode;ct.encode;ct.parse;ct.stringify});function ja(){throw new Error("setTimeout has not been defined")}function Fa(){throw new Error("clearTimeout has not been defined")}function Gp(t){if(It===setTimeout)return setTimeout(t,0);if((It===ja||!It)&&setTimeout)return It=setTimeout,setTimeout(t,0);try{return It(t,0)}catch{try{return It.call(null,t,0)}catch{return It.call(this||Zr,t,0)}}}function gE(){Xr&&_r&&(Xr=!1,_r.length?Rt=_r.concat(Rt):rs=-1,Rt.length&&Qp())}function Qp(){if(!Xr){var t=Gp(gE);Xr=!0;for(var e=Rt.length;e;){for(_r=Rt,Rt=[];++rs<e;)_r&&_r[rs].run();rs=-1,e=Rt.length}_r=null,Xr=!1,function(r){if(Tt===clearTimeout)return clearTimeout(r);if((Tt===Fa||!Tt)&&clearTimeout)return Tt=clearTimeout,clearTimeout(r);try{Tt(r)}catch{try{return Tt.call(null,r)}catch{return Tt.call(this||Zr,r)}}}(t)}}function zp(t,e){(this||Zr).fun=t,(this||Zr).array=e}function At(){}var Kp,It,Tt,Zr,fe,_r,Rt,Xr,rs,oe,Yp=Ae(()=>{_();v();m();Zr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,fe=Kp={};(function(){try{It=typeof setTimeout=="function"?setTimeout:ja}catch{It=ja}try{Tt=typeof clearTimeout=="function"?clearTimeout:Fa}catch{Tt=Fa}})();Rt=[],Xr=!1,rs=-1;fe.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Rt.push(new zp(t,e)),Rt.length!==1||Xr||Gp(Qp)},zp.prototype.run=function(){(this||Zr).fun.apply(null,(this||Zr).array)},fe.title="browser",fe.browser=!0,fe.env={},fe.argv=[],fe.version="",fe.versions={},fe.on=At,fe.addListener=At,fe.once=At,fe.off=At,fe.removeListener=At,fe.removeAllListeners=At,fe.emit=At,fe.prependListener=At,fe.prependOnceListener=At,fe.listeners=function(t){return[]},fe.binding=function(t){throw new Error("process.binding is not supported")},fe.cwd=function(){return"/"},fe.chdir=function(t){throw new Error("process.chdir is not supported")},fe.umask=function(){return 0};oe=Kp;oe.addListener;oe.argv;oe.binding;oe.browser;oe.chdir;oe.cwd;oe.emit;oe.env;oe.listeners;oe.nextTick;oe.off;oe.on;oe.once;oe.prependListener;oe.prependOnceListener;oe.removeAllListeners;oe.removeListener;oe.title;oe.umask;oe.version;oe.versions});function bE(){if(Jp)return Wa;Jp=!0;var t=Wa={},e,r;function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=i}catch{e=i}try{typeof clearTimeout=="function"?r=clearTimeout:r=n}catch{r=n}})();function o(w){if(e===setTimeout)return setTimeout(w,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(w,0);try{return e(w,0)}catch{try{return e.call(null,w,0)}catch{return e.call(this||ei,w,0)}}}function s(w){if(r===clearTimeout)return clearTimeout(w);if((r===n||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(w);try{return r(w)}catch{try{return r.call(null,w)}catch{return r.call(this||ei,w)}}}var a=[],u=!1,f,d=-1;function h(){!u||!f||(u=!1,f.length?a=f.concat(a):d=-1,a.length&&g())}function g(){if(!u){var w=o(h);u=!0;for(var S=a.length;S;){for(f=a,a=[];++d<S;)f&&f[d].run();d=-1,S=a.length}f=null,u=!1,s(w)}}t.nextTick=function(w){var S=new Array(arguments.length-1);if(arguments.length>1)for(var I=1;I<arguments.length;I++)S[I-1]=arguments[I];a.push(new b(w,S)),a.length===1&&!u&&o(g)};function b(w,S){(this||ei).fun=w,(this||ei).array=S}b.prototype.run=function(){(this||ei).fun.apply(null,(this||ei).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function E(){}return t.on=E,t.addListener=E,t.once=E,t.off=E,t.removeListener=E,t.removeAllListeners=E,t.emit=E,t.prependListener=E,t.prependOnceListener=E,t.listeners=function(w){return[]},t.binding=function(w){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(w){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},Wa}var Wa,Jp,ei,ne,$a=Ae(()=>{_();v();m();Wa={},Jp=!1,ei=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ne=bE();ne.platform="browser";ne.addListener;ne.argv;ne.binding;ne.browser;ne.chdir;ne.cwd;ne.emit;ne.env;ne.listeners;ne.nextTick;ne.off;ne.on;ne.once;ne.prependListener;ne.prependOnceListener;ne.removeAllListeners;ne.removeListener;ne.title;ne.umask;ne.version;ne.versions});function yE(){if(Xp)return Ha;Xp=!0;var t=ne;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function r(o,s){for(var a="",u=0,f=-1,d=0,h,g=0;g<=o.length;++g){if(g<o.length)h=o.charCodeAt(g);else{if(h===47)break;h=47}if(h===47){if(!(f===g-1||d===1))if(f!==g-1&&d===2){if(a.length<2||u!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var b=a.lastIndexOf("/");if(b!==a.length-1){b===-1?(a="",u=0):(a=a.slice(0,b),u=a.length-1-a.lastIndexOf("/")),f=g,d=0;continue}}else if(a.length===2||a.length===1){a="",u=0,f=g,d=0;continue}}s&&(a.length>0?a+="/..":a="..",u=2)}else a.length>0?a+="/"+o.slice(f+1,g):a=o.slice(f+1,g),u=g-f-1;f=g,d=0}else h===46&&d!==-1?++d:d=-1}return a}function i(o,s){var a=s.dir||s.root,u=s.base||(s.name||"")+(s.ext||"");return a?a===s.root?a+u:a+o+u:u}var n={resolve:function(){for(var s="",a=!1,u,f=arguments.length-1;f>=-1&&!a;f--){var d;f>=0?d=arguments[f]:(u===void 0&&(u=t.cwd()),d=u),e(d),d.length!==0&&(s=d+"/"+s,a=d.charCodeAt(0)===47)}return s=r(s,!a),a?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(e(s),s.length===0)return".";var a=s.charCodeAt(0)===47,u=s.charCodeAt(s.length-1)===47;return s=r(s,!a),s.length===0&&!a&&(s="."),s.length>0&&u&&(s+="/"),a?"/"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var s,a=0;a<arguments.length;++a){var u=arguments[a];e(u),u.length>0&&(s===void 0?s=u:s+="/"+u)}return s===void 0?".":n.normalize(s)},relative:function(s,a){if(e(s),e(a),s===a||(s=n.resolve(s),a=n.resolve(a),s===a))return"";for(var u=1;u<s.length&&s.charCodeAt(u)===47;++u);for(var f=s.length,d=f-u,h=1;h<a.length&&a.charCodeAt(h)===47;++h);for(var g=a.length,b=g-h,E=d<b?d:b,w=-1,S=0;S<=E;++S){if(S===E){if(b>E){if(a.charCodeAt(h+S)===47)return a.slice(h+S+1);if(S===0)return a.slice(h+S)}else d>E&&(s.charCodeAt(u+S)===47?w=S:S===0&&(w=0));break}var I=s.charCodeAt(u+S),C=a.charCodeAt(h+S);if(I!==C)break;I===47&&(w=S)}var k="";for(S=u+w+1;S<=f;++S)(S===f||s.charCodeAt(S)===47)&&(k.length===0?k+="..":k+="/..");return k.length>0?k+a.slice(h+w):(h+=w,a.charCodeAt(h)===47&&++h,a.slice(h))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return".";for(var a=s.charCodeAt(0),u=a===47,f=-1,d=!0,h=s.length-1;h>=1;--h)if(a=s.charCodeAt(h),a===47){if(!d){f=h;break}}else d=!1;return f===-1?u?"/":".":u&&f===1?"//":s.slice(0,f)},basename:function(s,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(s);var u=0,f=-1,d=!0,h;if(a!==void 0&&a.length>0&&a.length<=s.length){if(a.length===s.length&&a===s)return"";var g=a.length-1,b=-1;for(h=s.length-1;h>=0;--h){var E=s.charCodeAt(h);if(E===47){if(!d){u=h+1;break}}else b===-1&&(d=!1,b=h+1),g>=0&&(E===a.charCodeAt(g)?--g===-1&&(f=h):(g=-1,f=b))}return u===f?f=b:f===-1&&(f=s.length),s.slice(u,f)}else{for(h=s.length-1;h>=0;--h)if(s.charCodeAt(h)===47){if(!d){u=h+1;break}}else f===-1&&(d=!1,f=h+1);return f===-1?"":s.slice(u,f)}},extname:function(s){e(s);for(var a=-1,u=0,f=-1,d=!0,h=0,g=s.length-1;g>=0;--g){var b=s.charCodeAt(g);if(b===47){if(!d){u=g+1;break}continue}f===-1&&(d=!1,f=g+1),b===46?a===-1?a=g:h!==1&&(h=1):a!==-1&&(h=-1)}return a===-1||f===-1||h===0||h===1&&a===f-1&&a===u+1?"":s.slice(a,f)},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 i("/",s)},parse:function(s){e(s);var a={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return a;var u=s.charCodeAt(0),f=u===47,d;f?(a.root="/",d=1):d=0;for(var h=-1,g=0,b=-1,E=!0,w=s.length-1,S=0;w>=d;--w){if(u=s.charCodeAt(w),u===47){if(!E){g=w+1;break}continue}b===-1&&(E=!1,b=w+1),u===46?h===-1?h=w:S!==1&&(S=1):h!==-1&&(S=-1)}return h===-1||b===-1||S===0||S===1&&h===b-1&&h===g+1?b!==-1&&(g===0&&f?a.base=a.name=s.slice(1,b):a.base=a.name=s.slice(g,b)):(g===0&&f?(a.name=s.slice(1,h),a.base=s.slice(1,b)):(a.name=s.slice(g,h),a.base=s.slice(g,b)),a.ext=s.slice(h,b)),g>0?a.dir=s.slice(0,g-1):f&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return n.posix=n,Ha=n,Ha}var Ha,Xp,Va,Zp=Ae(()=>{_();v();m();$a();Ha={},Xp=!1;Va=yE()});var ag={};Ar(ag,{URL:()=>KE,Url:()=>WE,default:()=>X,fileURLToPath:()=>sg,format:()=>$E,parse:()=>zE,pathToFileURL:()=>og,resolve:()=>HE,resolveObject:()=>VE});function De(){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 ki(t,e,r){if(t&&ft.isObject(t)&&t instanceof De)return t;var i=new De;return i.parse(t,e,r),i}function IE(){if(ig)return Ga;ig=!0;var t=oe;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function r(o,s){for(var a="",u=0,f=-1,d=0,h,g=0;g<=o.length;++g){if(g<o.length)h=o.charCodeAt(g);else{if(h===47)break;h=47}if(h===47){if(!(f===g-1||d===1))if(f!==g-1&&d===2){if(a.length<2||u!==2||a.charCodeAt(a.length-1)!==46||a.charCodeAt(a.length-2)!==46){if(a.length>2){var b=a.lastIndexOf("/");if(b!==a.length-1){b===-1?(a="",u=0):(a=a.slice(0,b),u=a.length-1-a.lastIndexOf("/")),f=g,d=0;continue}}else if(a.length===2||a.length===1){a="",u=0,f=g,d=0;continue}}s&&(a.length>0?a+="/..":a="..",u=2)}else a.length>0?a+="/"+o.slice(f+1,g):a=o.slice(f+1,g),u=g-f-1;f=g,d=0}else h===46&&d!==-1?++d:d=-1}return a}function i(o,s){var a=s.dir||s.root,u=s.base||(s.name||"")+(s.ext||"");return a?a===s.root?a+u:a+o+u:u}var n={resolve:function(){for(var s="",a=!1,u,f=arguments.length-1;f>=-1&&!a;f--){var d;f>=0?d=arguments[f]:(u===void 0&&(u=t.cwd()),d=u),e(d),d.length!==0&&(s=d+"/"+s,a=d.charCodeAt(0)===47)}return s=r(s,!a),a?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(e(s),s.length===0)return".";var a=s.charCodeAt(0)===47,u=s.charCodeAt(s.length-1)===47;return s=r(s,!a),s.length===0&&!a&&(s="."),s.length>0&&u&&(s+="/"),a?"/"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var s,a=0;a<arguments.length;++a){var u=arguments[a];e(u),u.length>0&&(s===void 0?s=u:s+="/"+u)}return s===void 0?".":n.normalize(s)},relative:function(s,a){if(e(s),e(a),s===a||(s=n.resolve(s),a=n.resolve(a),s===a))return"";for(var u=1;u<s.length&&s.charCodeAt(u)===47;++u);for(var f=s.length,d=f-u,h=1;h<a.length&&a.charCodeAt(h)===47;++h);for(var g=a.length,b=g-h,E=d<b?d:b,w=-1,S=0;S<=E;++S){if(S===E){if(b>E){if(a.charCodeAt(h+S)===47)return a.slice(h+S+1);if(S===0)return a.slice(h+S)}else d>E&&(s.charCodeAt(u+S)===47?w=S:S===0&&(w=0));break}var I=s.charCodeAt(u+S),C=a.charCodeAt(h+S);if(I!==C)break;I===47&&(w=S)}var k="";for(S=u+w+1;S<=f;++S)(S===f||s.charCodeAt(S)===47)&&(k.length===0?k+="..":k+="/..");return k.length>0?k+a.slice(h+w):(h+=w,a.charCodeAt(h)===47&&++h,a.slice(h))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return".";for(var a=s.charCodeAt(0),u=a===47,f=-1,d=!0,h=s.length-1;h>=1;--h)if(a=s.charCodeAt(h),a===47){if(!d){f=h;break}}else d=!1;return f===-1?u?"/":".":u&&f===1?"//":s.slice(0,f)},basename:function(s,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(s);var u=0,f=-1,d=!0,h;if(a!==void 0&&a.length>0&&a.length<=s.length){if(a.length===s.length&&a===s)return"";var g=a.length-1,b=-1;for(h=s.length-1;h>=0;--h){var E=s.charCodeAt(h);if(E===47){if(!d){u=h+1;break}}else b===-1&&(d=!1,b=h+1),g>=0&&(E===a.charCodeAt(g)?--g===-1&&(f=h):(g=-1,f=b))}return u===f?f=b:f===-1&&(f=s.length),s.slice(u,f)}else{for(h=s.length-1;h>=0;--h)if(s.charCodeAt(h)===47){if(!d){u=h+1;break}}else f===-1&&(d=!1,f=h+1);return f===-1?"":s.slice(u,f)}},extname:function(s){e(s);for(var a=-1,u=0,f=-1,d=!0,h=0,g=s.length-1;g>=0;--g){var b=s.charCodeAt(g);if(b===47){if(!d){u=g+1;break}continue}f===-1&&(d=!1,f=g+1),b===46?a===-1?a=g:h!==1&&(h=1):a!==-1&&(h=-1)}return a===-1||f===-1||h===0||h===1&&a===f-1&&a===u+1?"":s.slice(a,f)},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 i("/",s)},parse:function(s){e(s);var a={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return a;var u=s.charCodeAt(0),f=u===47,d;f?(a.root="/",d=1):d=0;for(var h=-1,g=0,b=-1,E=!0,w=s.length-1,S=0;w>=d;--w){if(u=s.charCodeAt(w),u===47){if(!E){g=w+1;break}continue}b===-1&&(E=!1,b=w+1),u===46?h===-1?h=w:S!==1&&(S=1):h!==-1&&(S=-1)}return h===-1||b===-1||S===0||S===1&&h===b-1&&h===g+1?b!==-1&&(g===0&&f?a.base=a.name=s.slice(1,b):a.base=a.name=s.slice(g,b)):(g===0&&f?(a.name=s.slice(1,h),a.base=s.slice(1,b)):(a.name=s.slice(g,h),a.base=s.slice(g,b)),a.ext=s.slice(h,b)),g>0?a.dir=s.slice(0,g-1):f&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return n.posix=n,Ga=n,Ga}function UE(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Ya?NE(t):DE(t)}function NE(t){let e=t.hostname,r=t.pathname;for(let i=0;i<r.length;i++)if(r[i]==="%"){let n=r.codePointAt(i+2)||32;if(r[i+1]==="2"&&n===102||r[i+1]==="5"&&n===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(r=r.replace(BE,"\\"),r=decodeURIComponent(r),e!=="")return`\\\\${e}${r}`;{let i=r.codePointAt(1)|32,n=r[2];if(i<PE||i>kE||n!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}function DE(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)||32;if(e[r+1]==="2"&&i===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function jE(t){let e=ng.resolve(t),r=t.charCodeAt(t.length-1);(r===CE||Ya&&r===RE)&&e[e.length-1]!==ng.sep&&(e+="/");let i=new URL("file://");return e.includes("%")&&(e=e.replace(xE,"%25")),!Ya&&e.includes("\\")&&(e=e.replace(OE,"%5C")),e.includes(`
|
|
3
|
-
`)&&(e=e.replace(
|
|
4
|
-
`)&&(e=e.replace(
|
|
5
|
-
`," "]),Qa=["'"].concat(EE),eg=["%","/","?",";","#"].concat(Qa),tg=["/","?","#"],rg=/^[+a-z0-9A-Z_-]{0,63}$/,SE=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,AE={javascript:!0,"javascript:":!0},za={javascript:!0,"javascript:":!0},ti={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Ka=ct;De.prototype.parse=function(t,e,r){if(!ft.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),n=i!==-1&&i<t.indexOf("#")?"?":"#",o=t.split(n);o[0]=o[0].replace(/\\/g,"/");var s=t=o.join(n);if(s=s.trim(),!r&&t.split("#").length===1){var a=vE.exec(s);if(a)return this.path=s,this.href=s,this.pathname=a[1],a[2]?(this.search=a[2],this.query=e?Ka.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var u=_E.exec(s);if(u){var f=(u=u[0]).toLowerCase();this.protocol=f,s=s.substr(u.length)}if(r||u||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var d=s.substr(0,2)==="//";!d||u&&za[u]||(s=s.substr(2),this.slashes=!0)}if(!za[u]&&(d||u&&!ti[u])){for(var h,g,b=-1,E=0;E<tg.length;E++)(w=s.indexOf(tg[E]))!==-1&&(b===-1||w<b)&&(b=w);for((g=b===-1?s.lastIndexOf("@"):s.lastIndexOf("@",b))!==-1&&(h=s.slice(0,g),s=s.slice(g+1),this.auth=decodeURIComponent(h)),b=-1,E=0;E<eg.length;E++){var w;(w=s.indexOf(eg[E]))!==-1&&(b===-1||w<b)&&(b=w)}b===-1&&(b=s.length),this.host=s.slice(0,b),s=s.slice(b),this.parseHost(),this.hostname=this.hostname||"";var S=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!S)for(var I=this.hostname.split(/\./),C=(E=0,I.length);E<C;E++){var k=I[E];if(k&&!k.match(rg)){for(var M="",q=0,G=k.length;q<G;q++)k.charCodeAt(q)>127?M+="x":M+=k[q];if(!M.match(rg)){var F=I.slice(0,E),K=I.slice(E+1),$=k.match(SE);$&&(F.push($[1]),K.unshift($[2])),K.length&&(s="/"+K.join(".")+s),this.hostname=F.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),S||(this.hostname=wE.toASCII(this.hostname));var te=this.port?":"+this.port:"",dt=this.hostname||"";this.host=dt+te,this.href+=this.host,S&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),s[0]!=="/"&&(s="/"+s))}if(!AE[f])for(E=0,C=Qa.length;E<C;E++){var Fe=Qa[E];if(s.indexOf(Fe)!==-1){var Se=encodeURIComponent(Fe);Se===Fe&&(Se=escape(Fe)),s=s.split(Fe).join(Se)}}var mr=s.indexOf("#");mr!==-1&&(this.hash=s.substr(mr),s=s.slice(0,mr));var vr=s.indexOf("?");if(vr!==-1?(this.search=s.substr(vr),this.query=s.substr(vr+1),e&&(this.query=Ka.parse(this.query)),s=s.slice(0,vr)):e&&(this.search="",this.query={}),s&&(this.pathname=s),ti[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){te=this.pathname||"";var as=this.search||"";this.path=te+as}return this.href=this.format(),this},De.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",i=this.hash||"",n=!1,o="";this.host?n=t+this.host:this.hostname&&(n=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&ft.isObject(this.query)&&Object.keys(this.query).length&&(o=Ka.stringify(this.query));var s=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||ti[e])&&n!==!1?(n="//"+(n||""),r&&r.charAt(0)!=="/"&&(r="/"+r)):n||(n=""),i&&i.charAt(0)!=="#"&&(i="#"+i),s&&s.charAt(0)!=="?"&&(s="?"+s),e+n+(r=r.replace(/[?#]/g,function(a){return encodeURIComponent(a)}))+(s=s.replace("#","%23"))+i},De.prototype.resolve=function(t){return this.resolveObject(ki(t,!1,!0)).format()},De.prototype.resolveObject=function(t){if(ft.isString(t)){var e=new De;e.parse(t,!1,!0),t=e}for(var r=new De,i=Object.keys(this),n=0;n<i.length;n++){var o=i[n];r[o]=this[o]}if(r.hash=t.hash,t.href==="")return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var s=Object.keys(t),a=0;a<s.length;a++){var u=s[a];u!=="protocol"&&(r[u]=t[u])}return ti[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!ti[t.protocol]){for(var f=Object.keys(t),d=0;d<f.length;d++){var h=f[d];r[h]=t[h]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||za[t.protocol])r.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),r.pathname=g.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var b=r.pathname||"",E=r.search||"";r.path=b+E}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var w=r.pathname&&r.pathname.charAt(0)==="/",S=t.host||t.pathname&&t.pathname.charAt(0)==="/",I=S||w||r.host&&t.pathname,C=I,k=r.pathname&&r.pathname.split("/")||[],M=(g=t.pathname&&t.pathname.split("/")||[],r.protocol&&!ti[r.protocol]);if(M&&(r.hostname="",r.port=null,r.host&&(k[0]===""?k[0]=r.host:k.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),I=I&&(g[0]===""||k[0]==="")),S)r.host=t.host||t.host===""?t.host:r.host,r.hostname=t.hostname||t.hostname===""?t.hostname:r.hostname,r.search=t.search,r.query=t.query,k=g;else if(g.length)k||(k=[]),k.pop(),k=k.concat(g),r.search=t.search,r.query=t.query;else if(!ft.isNullOrUndefined(t.search))return M&&(r.hostname=r.host=k.shift(),($=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=$.shift(),r.host=r.hostname=$.shift())),r.search=t.search,r.query=t.query,ft.isNull(r.pathname)&&ft.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!k.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var q=k.slice(-1)[0],G=(r.host||t.host||k.length>1)&&(q==="."||q==="..")||q==="",F=0,K=k.length;K>=0;K--)(q=k[K])==="."?k.splice(K,1):q===".."?(k.splice(K,1),F++):F&&(k.splice(K,1),F--);if(!I&&!C)for(;F--;F)k.unshift("..");!I||k[0]===""||k[0]&&k[0].charAt(0)==="/"||k.unshift(""),G&&k.join("/").substr(-1)!=="/"&&k.push("");var $,te=k[0]===""||k[0]&&k[0].charAt(0)==="/";return M&&(r.hostname=r.host=te?"":k.length?k.shift():"",($=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=$.shift(),r.host=r.hostname=$.shift())),(I=I||r.host&&k.length)&&!te&&k.unshift(""),k.length?r.pathname=k.join("/"):(r.pathname=null,r.path=null),ft.isNull(r.pathname)&&ft.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},De.prototype.parseHost=function(){var t=this.host,e=mE.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};X.Url;X.format;X.resolve;X.resolveObject;Ga={},ig=!1;ng=IE(),TE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;X.URL=typeof URL<"u"?URL:null;X.pathToFileURL=jE;X.fileURLToPath=UE;X.Url;X.format;X.resolve;X.resolveObject;X.URL;RE=92,CE=47,PE=97,kE=122,Ya=TE==="win32",BE=/\//g,xE=/%/g,OE=/\\/g,ME=/\n/g,LE=/\r/g,qE=/\t/g;FE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;X.URL=typeof URL<"u"?URL:null;X.pathToFileURL=og;X.fileURLToPath=sg;WE=X.Url,$E=X.format,HE=X.resolve,VE=X.resolveObject,zE=X.parse,KE=X.URL,GE=92,QE=47,YE=97,JE=122,Ja=FE==="win32",XE=/\//g,ZE=/%/g,eS=/\\/g,tS=/\n/g,rS=/\r/g,iS=/\t/g});var cg=O((M3,ug)=>{"use strict";_();v();m();ug.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var is=O(Bi=>{"use strict";_();v();m();Object.defineProperty(Bi,"__esModule",{value:!0});Bi.BufferedDuplex=void 0;Bi.writev=hg;var oS=Nt(),fg=(he(),Q(ye));function hg(t,e){let r=new Array(t.length);for(let i=0;i<t.length;i++)typeof t[i].chunk=="string"?r[i]=fg.Buffer.from(t[i].chunk,"utf8"):r[i]=t[i].chunk;this._write(fg.Buffer.concat(r),"binary",e)}var Xa=class extends oS.Duplex{constructor(e,r,i){super({objectMode:!0}),this.proxy=r,this.socket=i,this.writeQueue=[],e.objectMode||(this._writev=hg.bind(this)),this.isSocketOpen=!1,this.proxy.on("data",n=>{!this.destroyed&&this.readable&&this.push(n)})}_read(e){this.proxy.read(e)}_write(e,r,i){this.isSocketOpen?this.writeToProxy(e,r,i):this.writeQueue.push({chunk:e,encoding:r,cb:i})}_final(e){this.writeQueue=[],this.proxy.end(e)}_destroy(e,r){this.writeQueue=[],this.proxy.destroy(),r(e)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(e,r,i){this.proxy.write(e,r)===!1?this.proxy.once("drain",i):i()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:e,encoding:r,cb:i}=this.writeQueue.shift();this.writeToProxy(e,r,i)}}};Bi.BufferedDuplex=Xa});var xi=O(Kt=>{"use strict";_();v();m();var el=Kt&&Kt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.streamBuilder=Kt.browserStreamBuilder=void 0;var ns=(he(),Q(ye)),dg=el(cg()),aS=el(it()),lS=Nt(),uS=el(Ri()),Za=is(),zt=(0,aS.default)("mqttjs:ws"),cS=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function pg(t,e){let r=`${t.protocol}://${t.hostname}:${t.port}${t.path}`;return typeof t.transformWsUrl=="function"&&(r=t.transformWsUrl(r,t,e)),r}function gg(t){let e=t;return t.port||(t.protocol==="wss"?e.port=443:e.port=80),t.path||(e.path="/"),t.wsOptions||(e.wsOptions={}),!uS.default&&!t.forceNativeWebSocket&&t.protocol==="wss"&&cS.forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r])}),e}function fS(t){let e=gg(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let r=new URL(document.URL);e.hostname=r.hostname,e.port||(e.port=Number(r.port))}return e.objectMode===void 0&&(e.objectMode=!(e.binary===!0||e.binary===void 0)),e}function hS(t,e,r){zt("createWebSocket"),zt(`protocol: ${r.protocolId} ${r.protocolVersion}`);let i=r.protocolId==="MQIsdp"&&r.protocolVersion===3?"mqttv3.1":"mqtt";zt(`creating new Websocket for url: ${e} and protocol: ${i}`);let n;return r.createWebsocket?n=r.createWebsocket(e,[i],r):n=new dg.default(e,[i],r.wsOptions),n}function dS(t,e){let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt",i=pg(e,t),n;return e.createWebsocket?n=e.createWebsocket(i,[r],e):n=new WebSocket(i,[r]),n.binaryType="arraybuffer",n}var pS=(t,e)=>{zt("streamBuilder");let r=gg(e);r.hostname=r.hostname||r.host||"localhost";let i=pg(r,t),n=hS(t,i,r),o=dg.default.createWebSocketStream(n,r.wsOptions);return o.url=i,n.on("close",()=>{o.destroy()}),o};Kt.streamBuilder=pS;var gS=(t,e)=>{zt("browserStreamBuilder");let r,n=fS(e).browserBufferSize||1024*512,o=e.browserBufferTimeout||1e3,s=!e.objectMode,a=dS(t,e),u=d(e,w,S);e.objectMode||(u._writev=Za.writev.bind(u)),u.on("close",()=>{a.close()});let f=typeof a.addEventListener<"u";a.readyState===a.OPEN?(r=u,r.socket=a):(r=new Za.BufferedDuplex(e,u,a),f?a.addEventListener("open",h):a.onopen=h),f?(a.addEventListener("close",g),a.addEventListener("error",b),a.addEventListener("message",E)):(a.onclose=g,a.onerror=b,a.onmessage=E);function d(I,C,k){let M=new lS.Transform({objectMode:I.objectMode});return M._write=C,M._flush=k,M}function h(){zt("WebSocket onOpen"),r instanceof Za.BufferedDuplex&&r.socketReady()}function g(I){zt("WebSocket onClose",I),r.end(),r.destroy()}function b(I){zt("WebSocket onError",I);let C=new Error("WebSocket error");C.event=I,r.destroy(C)}async function E(I){if(!u||u.destroyed||!u.readable)return;let{data:C}=I;C instanceof ArrayBuffer?C=ns.Buffer.from(C):C instanceof Blob?C=ns.Buffer.from(await new Response(C).arrayBuffer()):C=ns.Buffer.from(C,"utf8"),u.push(C)}function w(I,C,k){if(a.bufferedAmount>n){setTimeout(w,o,I,C,k);return}s&&typeof I=="string"&&(I=ns.Buffer.from(I,"utf8"));try{a.send(I)}catch(M){return k(M)}k()}function S(I){a.close(),I()}return r};Kt.browserStreamBuilder=gS});var tl={};Ar(tl,{Server:()=>xe,Socket:()=>xe,Stream:()=>xe,_createServerHandle:()=>xe,_normalizeArgs:()=>xe,_setSimultaneousAccepts:()=>xe,connect:()=>xe,createConnection:()=>xe,createServer:()=>xe,default:()=>bS,isIP:()=>xe,isIPv4:()=>xe,isIPv6:()=>xe});function xe(){throw new Error("Node.js net module is not supported by JSPM core outside of Node.js")}var bS,rl=Ae(()=>{_();v();m();bS={_createServerHandle:xe,_normalizeArgs:xe,_setSimultaneousAccepts:xe,connect:xe,createConnection:xe,createServer:xe,isIP:xe,isIPv4:xe,isIPv6:xe,Server:xe,Socket:xe,Stream:xe}});var il=O(Oi=>{"use strict";_();v();m();var bg=Oi&&Oi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Oi,"__esModule",{value:!0});var yS=bg((rl(),Q(tl))),wS=bg(it()),_S=(0,wS.default)("mqttjs:tcp"),mS=(t,e)=>{e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost";let{port:r,path:i}=e,n=e.hostname;return _S("port %d and host %s",r,n),yS.default.createConnection({port:r,host:n,path:i})};Oi.default=mS});var yg={};Ar(yg,{default:()=>vS});var vS,wg=Ae(()=>{_();v();m();vS={}});var sl=O(Mi=>{"use strict";_();v();m();var nl=Mi&&Mi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mi,"__esModule",{value:!0});var ES=nl((wg(),Q(yg))),SS=nl((rl(),Q(tl))),AS=nl(it()),IS=(0,AS.default)("mqttjs:tls"),TS=(t,e)=>{e.port=e.port||8883,e.host=e.hostname||e.host||"localhost",SS.default.isIP(e.host)===0&&(e.servername=e.host),e.rejectUnauthorized=e.rejectUnauthorized!==!1,delete e.path,IS("port %d host %s rejectUnauthorized %b",e.port,e.host,e.rejectUnauthorized);let r=ES.default.connect(e);r.on("secureConnect",()=>{e.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",i)});function i(n){e.rejectUnauthorized&&t.emit("error",n),r.end()}return r.on("error",i),r};Mi.default=TS});var ll=O(al=>{"use strict";_();v();m();Object.defineProperty(al,"__esModule",{value:!0});var _g=(he(),Q(ye)),RS=Nt(),CS=is(),ht,ol,Oe;function PS(){let t=new RS.Transform;return t._write=(e,r,i)=>{ht.send({data:e.buffer,success(){i()},fail(n){i(new Error(n))}})},t._flush=e=>{ht.close({success(){e()}})},t}function kS(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function BS(t,e){let r=t.protocol==="wxs"?"wss":"ws",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl=="function"&&(i=t.transformWsUrl(i,t,e)),i}function xS(){ht.onOpen(()=>{Oe.socketReady()}),ht.onMessage(t=>{let{data:e}=t;e instanceof ArrayBuffer?e=_g.Buffer.from(e):e=_g.Buffer.from(e,"utf8"),ol.push(e)}),ht.onClose(()=>{Oe.emit("close"),Oe.end(),Oe.destroy()}),ht.onError(t=>{let e=new Error(t.errMsg);Oe.destroy(e)})}var OS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt";kS(e);let i=BS(e,t);ht=wx.connectSocket({url:i,protocols:[r]}),ol=PS(),Oe=new CS.BufferedDuplex(e,ol,ht),Oe._destroy=(o,s)=>{ht.close({success(){s&&s(o)}})};let n=Oe.destroy;return Oe.destroy=(o,s)=>(Oe.destroy=n,setTimeout(()=>{ht.close({fail(){Oe._destroy(o,s)}})},0),Oe),xS(),Oe};al.default=OS});var fl=O(cl=>{"use strict";_();v();m();Object.defineProperty(cl,"__esModule",{value:!0});var ul=(he(),Q(ye)),MS=Nt(),LS=is(),Ct,ss,ri,mg=!1;function qS(){let t=new MS.Transform;return t._write=(e,r,i)=>{Ct.sendSocketMessage({data:e.buffer,success(){i()},fail(){i(new Error)}})},t._flush=e=>{Ct.closeSocket({success(){e()}})},t}function US(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function NS(t,e){let r=t.protocol==="alis"?"wss":"ws",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl=="function"&&(i=t.transformWsUrl(i,t,e)),i}function DS(){mg||(mg=!0,Ct.onSocketOpen(()=>{ri.socketReady()}),Ct.onSocketMessage(t=>{if(typeof t.data=="string"){let e=ul.Buffer.from(t.data,"base64");ss.push(e)}else{let e=new FileReader;e.addEventListener("load",()=>{let r=e.result;r instanceof ArrayBuffer?r=ul.Buffer.from(r):r=ul.Buffer.from(r,"utf8"),ss.push(r)}),e.readAsArrayBuffer(t.data)}}),Ct.onSocketClose(()=>{ri.end(),ri.destroy()}),Ct.onSocketError(t=>{ri.destroy(t)}))}var jS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt";US(e);let i=NS(e,t);return Ct=e.my,Ct.connectSocket({url:i,protocols:r}),ss=qS(),ri=new LS.BufferedDuplex(e,ss,Ct),DS(),ri};cl.default=jS});var Sg=O(ii=>{"use strict";_();v();m();var os=ii&&ii.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ii,"__esModule",{value:!0});ii.connectAsync=zS;var FS=os(it()),WS=os((lg(),Q(ag))),$S=os(ts()),HS=os(Ri());typeof(R===null||R===void 0?void 0:R.nextTick)!="function"&&(R.nextTick=setImmediate);var vg=(0,FS.default)("mqttjs"),ge=null;function VS(t){let e;t.auth&&(e=t.auth.match(/^(.+):(.+)$/),e?(t.username=e[1],t.password=e[2]):t.username=t.auth)}function Eg(t,e){var r,i,n;if(vg("connecting to an MQTT broker..."),typeof t=="object"&&!e&&(e=t,t=""),e=e||{},t&&typeof t=="string"){let a=WS.default.parse(t,!0),u={};if(a.port!=null&&(u.port=Number(a.port)),u.host=a.hostname,u.query=a.query,u.auth=a.auth,u.protocol=a.protocol,u.path=a.path,e=Object.assign(Object.assign({},u),e),!e.protocol)throw new Error("Missing protocol");e.protocol=e.protocol.replace(/:$/,"")}if(e.unixSocket=e.unixSocket||((r=e.protocol)===null||r===void 0?void 0:r.includes("+unix")),e.unixSocket?e.protocol=e.protocol.replace("+unix",""):!(!((i=e.protocol)===null||i===void 0)&&i.startsWith("ws"))&&!(!((n=e.protocol)===null||n===void 0)&&n.startsWith("wx"))&&delete e.path,VS(e),e.query&&typeof e.query.clientId=="string"&&(e.clientId=e.query.clientId),e.cert&&e.key)if(e.protocol){if(["mqtts","wss","wxs","alis"].indexOf(e.protocol)===-1)switch(e.protocol){case"mqtt":e.protocol="mqtts";break;case"ws":e.protocol="wss";break;case"wx":e.protocol="wxs";break;case"ali":e.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${e.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(ge||(ge={},!HS.default&&!e.forceNativeWebSocket?(ge.ws=xi().streamBuilder,ge.wss=xi().streamBuilder,ge.mqtt=il().default,ge.tcp=il().default,ge.ssl=sl().default,ge.tls=ge.ssl,ge.mqtts=sl().default):(ge.ws=xi().browserStreamBuilder,ge.wss=xi().browserStreamBuilder,ge.wx=ll().default,ge.wxs=ll().default,ge.ali=fl().default,ge.alis=fl().default)),!ge[e.protocol]){let a=["mqtts","wss"].indexOf(e.protocol)!==-1;e.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((u,f)=>a&&f%2===0?!1:typeof ge[u]=="function")[0]}if(e.clean===!1&&!e.clientId)throw new Error("Missing clientId for unclean clients");e.protocol&&(e.defaultProtocol=e.protocol);function o(a){return e.servers&&((!a._reconnectCount||a._reconnectCount===e.servers.length)&&(a._reconnectCount=0),e.host=e.servers[a._reconnectCount].host,e.port=e.servers[a._reconnectCount].port,e.protocol=e.servers[a._reconnectCount].protocol?e.servers[a._reconnectCount].protocol:e.defaultProtocol,e.hostname=e.host,a._reconnectCount++),vg("calling streambuilder for",e.protocol),ge[e.protocol](a,e)}let s=new $S.default(o,e);return s.on("error",()=>{}),s}function zS(t,e,r=!0){return new Promise((i,n)=>{let o=Eg(t,e),s={connect:u=>{a(),i(o)},end:()=>{a(),i(o)},error:u=>{a(),o.end(),n(u)}};r===!1&&(s.close=()=>{s.error(new Error("Couldn't connect to server"))});function a(){Object.keys(s).forEach(u=>{o.off(u,s[u])})}Object.keys(s).forEach(u=>{o.on(u,s[u])})})}ii.default=Eg});var hl=O(z=>{"use strict";_();v();m();var Ag=z&&z.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),KS=z&&z.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),GS=z&&z.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[i.length]=n);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i=t(e),n=0;n<i.length;n++)i[n]!=="default"&&Ag(r,e,i[n]);return KS(r,e),r}}(),Ig=z&&z.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ag(e,t,r)},Li=z&&z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(z,"__esModule",{value:!0});z.ReasonCodes=z.KeepaliveManager=z.UniqueMessageIdProvider=z.DefaultMessageIdProvider=z.Store=z.MqttClient=z.connectAsync=z.connect=z.Client=void 0;var Tg=Li(ts());z.MqttClient=Tg.default;var QS=Li(Vo());z.DefaultMessageIdProvider=QS.default;var YS=Li(Up());z.UniqueMessageIdProvider=YS.default;var JS=Li(Go());z.Store=JS.default;var Rg=GS(Sg());z.connect=Rg.default;Object.defineProperty(z,"connectAsync",{enumerable:!0,get:function(){return Rg.connectAsync}});var XS=Li(Ma());z.KeepaliveManager=XS.default;z.Client=Tg.default;Ig(ts(),z);Ig(cr(),z);var ZS=Ei();Object.defineProperty(z,"ReasonCodes",{enumerable:!0,get:function(){return ZS.ReasonCodes}})});var nA=O(je=>{_();v();m();var Cg=je&&je.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),eA=je&&je.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tA=je&&je.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[i.length]=n);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i=t(e),n=0;n<i.length;n++)i[n]!=="default"&&Cg(r,e,i[n]);return eA(r,e),r}}(),rA=je&&je.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Cg(e,t,r)};Object.defineProperty(je,"__esModule",{value:!0});var iA=tA(hl());je.default=iA;rA(hl(),je)});export default nA();
|
|
1
|
+
var hs=Object.defineProperty;var Wg=Object.getOwnPropertyDescriptor;var $g=Object.getOwnPropertyNames;var Hg=Object.prototype.hasOwnProperty;var Ae=(t,e)=>()=>(t&&(e=t(t=0)),e);var O=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ir=(t,e)=>{for(var r in e)hs(t,r,{get:e[r],enumerable:!0})},Vg=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of $g(e))!Hg.call(t,n)&&n!==r&&hs(t,n,{get:()=>e[n],enumerable:!(i=Wg(e,n))||i.enumerable});return t};var Q=t=>Vg(hs({},"__esModule",{value:!0}),t);var _=Ae(()=>{});var R={};Ir(R,{_debugEnd:()=>cu,_debugProcess:()=>uu,_events:()=>Tu,_eventsCount:()=>Ru,_exiting:()=>Ha,_fatalExceptions:()=>su,_getActiveHandles:()=>Ga,_getActiveRequests:()=>Ka,_kill:()=>Ya,_linkedBinding:()=>Wa,_maxListeners:()=>Iu,_preload_modules:()=>Eu,_rawDebug:()=>ja,_startProfilerIdleNotifier:()=>fu,_stopProfilerIdleNotifier:()=>hu,_tickCallback:()=>au,abort:()=>bu,addListener:()=>Cu,allowedNodeEnvironmentFlags:()=>ru,arch:()=>Ra,argv:()=>ka,argv0:()=>vu,assert:()=>iu,binding:()=>La,chdir:()=>Na,config:()=>Va,cpuUsage:()=>Di,cwd:()=>Ua,debugPort:()=>mu,default:()=>Uu,dlopen:()=>za,domain:()=>$a,emit:()=>Ou,emitWarning:()=>Ma,env:()=>Pa,execArgv:()=>Ba,execPath:()=>_u,exit:()=>eu,features:()=>nu,hasUncaughtExceptionCaptureCallback:()=>lu,hrtime:()=>Ni,kill:()=>Za,listeners:()=>qu,memoryUsage:()=>Xa,moduleLoadList:()=>Fa,nextTick:()=>Aa,off:()=>ku,on:()=>gt,once:()=>Pu,openStdin:()=>tu,pid:()=>yu,platform:()=>Ca,ppid:()=>wu,prependListener:()=>Mu,prependOnceListener:()=>Lu,reallyExit:()=>Qa,release:()=>Da,removeAllListeners:()=>xu,removeListener:()=>Bu,resourceUsage:()=>Ja,setSourceMapsEnabled:()=>Su,setUncaughtExceptionCaptureCallback:()=>ou,stderr:()=>pu,stdin:()=>gu,stdout:()=>du,title:()=>Ta,umask:()=>qa,uptime:()=>Au,version:()=>xa,versions:()=>Oa});function gs(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function zg(){!Tr||!Gt||(Tr=!1,Gt.length?pt=Gt.concat(pt):Ui=-1,pt.length&&Sa())}function Sa(){if(!Tr){var t=setTimeout(zg,0);Tr=!0;for(var e=pt.length;e;){for(Gt=pt,pt=[];++Ui<e;)Gt&&Gt[Ui].run();Ui=-1,e=pt.length}Gt=null,Tr=!1,clearTimeout(t)}}function Aa(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];pt.push(new Ia(t,e)),pt.length===1&&!Tr&&setTimeout(Sa,0)}function Ia(t,e){this.fun=t,this.array=e}function _e(){}function Wa(t){gs("_linkedBinding")}function za(t){gs("dlopen")}function Ka(){return[]}function Ga(){return[]}function iu(t,e){if(!t)throw new Error(e||"assertion error")}function lu(){return!1}function Au(){return kt.now()/1e3}function Ni(t){var e=Math.floor((Date.now()-kt.now())*.001),r=kt.now()*.001,i=Math.floor(r)+e,n=Math.floor(r%1*1e9);return t&&(i=i-t[0],n=n-t[1],n<0&&(i--,n+=ps)),[i,n]}function gt(){return Uu}function qu(t){return[]}var pt,Tr,Gt,Ui,Ta,Ra,Ca,Pa,ka,Ba,xa,Oa,Ma,La,qa,Ua,Na,Da,ja,Fa,$a,Ha,Va,Qa,Ya,Di,Ja,Xa,Za,eu,tu,ru,nu,su,ou,au,uu,cu,fu,hu,du,pu,gu,bu,yu,wu,_u,mu,vu,Eu,Su,kt,ds,ps,Iu,Tu,Ru,Cu,Pu,ku,Bu,xu,Ou,Mu,Lu,Uu,Nu=Ae(()=>{_();v();m();pt=[],Tr=!1,Ui=-1;Ia.prototype.run=function(){this.fun.apply(null,this.array)};Ta="browser",Ra="x64",Ca="browser",Pa={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},ka=["/usr/bin/node"],Ba=[],xa="v16.8.0",Oa={},Ma=function(t,e){console.warn((e?e+": ":"")+t)},La=function(t){gs("binding")},qa=function(t){return 0},Ua=function(){return"/"},Na=function(t){},Da={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};ja=_e,Fa=[];$a={},Ha=!1,Va={};Qa=_e,Ya=_e,Di=function(){return{}},Ja=Di,Xa=Di,Za=_e,eu=_e,tu=_e,ru={};nu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},su=_e,ou=_e;au=_e,uu=_e,cu=_e,fu=_e,hu=_e,du=void 0,pu=void 0,gu=void 0,bu=_e,yu=2,wu=1,_u="/bin/usr/node",mu=9229,vu="node",Eu=[],Su=_e,kt={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};kt.now===void 0&&(ds=Date.now(),kt.timing&&kt.timing.navigationStart&&(ds=kt.timing.navigationStart),kt.now=()=>Date.now()-ds);ps=1e9;Ni.bigint=function(t){var e=Ni(t);return typeof BigInt>"u"?e[0]*ps+e[1]:BigInt(e[0]*ps)+BigInt(e[1])};Iu=10,Tu={},Ru=0;Cu=gt,Pu=gt,ku=gt,Bu=gt,xu=gt,Ou=_e,Mu=gt,Lu=gt;Uu={version:xa,versions:Oa,arch:Ra,platform:Ca,release:Da,_rawDebug:ja,moduleLoadList:Fa,binding:La,_linkedBinding:Wa,_events:Tu,_eventsCount:Ru,_maxListeners:Iu,on:gt,addListener:Cu,once:Pu,off:ku,removeListener:Bu,removeAllListeners:xu,emit:Ou,prependListener:Mu,prependOnceListener:Lu,listeners:qu,domain:$a,_exiting:Ha,config:Va,dlopen:za,uptime:Au,_getActiveRequests:Ka,_getActiveHandles:Ga,reallyExit:Qa,_kill:Ya,cpuUsage:Di,resourceUsage:Ja,memoryUsage:Xa,kill:Za,exit:eu,openStdin:tu,allowedNodeEnvironmentFlags:ru,assert:iu,features:nu,_fatalExceptions:su,setUncaughtExceptionCaptureCallback:ou,hasUncaughtExceptionCaptureCallback:lu,emitWarning:Ma,nextTick:Aa,_tickCallback:au,_debugProcess:uu,_debugEnd:cu,_startProfilerIdleNotifier:fu,_stopProfilerIdleNotifier:hu,stdout:du,stdin:gu,stderr:pu,abort:bu,umask:qa,chdir:Na,cwd:Ua,env:Pa,title:Ta,argv:ka,execArgv:Ba,pid:yu,ppid:wu,execPath:_u,debugPort:mu,hrtime:Ni,argv0:vu,_preload_modules:Eu,setSourceMapsEnabled:Su}});var m=Ae(()=>{Nu()});var ye={};Ir(ye,{Buffer:()=>x,INSPECT_MAX_BYTES:()=>Yg,default:()=>Bt,kMaxLength:()=>Jg});function Kg(){if(Du)return oi;Du=!0,oi.byteLength=l,oi.toByteArray=f,oi.fromByteArray=g;for(var t=[],e=[],r=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=i.length;n<o;++n)t[n]=i[n],e[i.charCodeAt(n)]=n;e[45]=62,e[95]=63;function s(b){var E=b.length;if(E%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var w=b.indexOf("=");w===-1&&(w=E);var S=w===E?0:4-w%4;return[w,S]}function l(b){var E=s(b),w=E[0],S=E[1];return(w+S)*3/4-S}function u(b,E,w){return(E+w)*3/4-w}function f(b){var E,w=s(b),S=w[0],I=w[1],C=new r(u(b,S,I)),k=0,M=I>0?S-4:S,q;for(q=0;q<M;q+=4)E=e[b.charCodeAt(q)]<<18|e[b.charCodeAt(q+1)]<<12|e[b.charCodeAt(q+2)]<<6|e[b.charCodeAt(q+3)],C[k++]=E>>16&255,C[k++]=E>>8&255,C[k++]=E&255;return I===2&&(E=e[b.charCodeAt(q)]<<2|e[b.charCodeAt(q+1)]>>4,C[k++]=E&255),I===1&&(E=e[b.charCodeAt(q)]<<10|e[b.charCodeAt(q+1)]<<4|e[b.charCodeAt(q+2)]>>2,C[k++]=E>>8&255,C[k++]=E&255),C}function d(b){return t[b>>18&63]+t[b>>12&63]+t[b>>6&63]+t[b&63]}function h(b,E,w){for(var S,I=[],C=E;C<w;C+=3)S=(b[C]<<16&16711680)+(b[C+1]<<8&65280)+(b[C+2]&255),I.push(d(S));return I.join("")}function g(b){for(var E,w=b.length,S=w%3,I=[],C=16383,k=0,M=w-S;k<M;k+=C)I.push(h(b,k,k+C>M?M:k+C));return S===1?(E=b[w-1],I.push(t[E>>2]+t[E<<4&63]+"==")):S===2&&(E=(b[w-2]<<8)+b[w-1],I.push(t[E>>10]+t[E>>4&63]+t[E<<2&63]+"=")),I.join("")}return oi}function Gg(){if(ju)return ji;ju=!0;return ji.read=function(t,e,r,i,n){var o,s,l=n*8-i-1,u=(1<<l)-1,f=u>>1,d=-7,h=r?n-1:0,g=r?-1:1,b=t[e+h];for(h+=g,o=b&(1<<-d)-1,b>>=-d,d+=l;d>0;o=o*256+t[e+h],h+=g,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=i;d>0;s=s*256+t[e+h],h+=g,d-=8);if(o===0)o=1-f;else{if(o===u)return s?NaN:(b?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-f}return(b?-1:1)*s*Math.pow(2,o-i)},ji.write=function(t,e,r,i,n,o){var s,l,u,f=o*8-n-1,d=(1<<f)-1,h=d>>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=i?0:o-1,E=i?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+h>=1?e+=g/u:e+=g*Math.pow(2,1-h),e*u>=2&&(s++,u/=2),s+h>=d?(l=0,s=d):s+h>=1?(l=(e*u-1)*Math.pow(2,n),s=s+h):(l=e*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;t[r+b]=l&255,b+=E,l/=256,n-=8);for(s=s<<n|l,f+=n;f>0;t[r+b]=s&255,b+=E,s/=256,f-=8);t[r+b-E]|=w*128},ji}function Qg(){if(Fu)return Qt;Fu=!0;let t=Kg(),e=Gg(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Qt.Buffer=s,Qt.SlowBuffer=I,Qt.INSPECT_MAX_BYTES=50;let i=2147483647;Qt.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=n(),!s.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 n(){try{let p=new Uint8Array(1),a={foo:function(){return 42}};return Object.setPrototypeOf(a,Uint8Array.prototype),Object.setPrototypeOf(p,a),p.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(p){if(p>i)throw new RangeError('The value "'+p+'" is invalid for option "size"');let a=new Uint8Array(p);return Object.setPrototypeOf(a,s.prototype),a}function s(p,a,c){if(typeof p=="number"){if(typeof a=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(p)}return l(p,a,c)}s.poolSize=8192;function l(p,a,c){if(typeof p=="string")return h(p,a);if(ArrayBuffer.isView(p))return b(p);if(p==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p);if(Ge(p,ArrayBuffer)||p&&Ge(p.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ge(p,SharedArrayBuffer)||p&&Ge(p.buffer,SharedArrayBuffer)))return E(p,a,c);if(typeof p=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let y=p.valueOf&&p.valueOf();if(y!=null&&y!==p)return s.from(y,a,c);let A=w(p);if(A)return A;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]=="function")return s.from(p[Symbol.toPrimitive]("string"),a,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p)}s.from=function(p,a,c){return l(p,a,c)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function u(p){if(typeof p!="number")throw new TypeError('"size" argument must be of type number');if(p<0)throw new RangeError('The value "'+p+'" is invalid for option "size"')}function f(p,a,c){return u(p),p<=0?o(p):a!==void 0?typeof c=="string"?o(p).fill(a,c):o(p).fill(a):o(p)}s.alloc=function(p,a,c){return f(p,a,c)};function d(p){return u(p),o(p<0?0:S(p)|0)}s.allocUnsafe=function(p){return d(p)},s.allocUnsafeSlow=function(p){return d(p)};function h(p,a){if((typeof a!="string"||a==="")&&(a="utf8"),!s.isEncoding(a))throw new TypeError("Unknown encoding: "+a);let c=C(p,a)|0,y=o(c),A=y.write(p,a);return A!==c&&(y=y.slice(0,A)),y}function g(p){let a=p.length<0?0:S(p.length)|0,c=o(a);for(let y=0;y<a;y+=1)c[y]=p[y]&255;return c}function b(p){if(Ge(p,Uint8Array)){let a=new Uint8Array(p);return E(a.buffer,a.byteOffset,a.byteLength)}return g(p)}function E(p,a,c){if(a<0||p.byteLength<a)throw new RangeError('"offset" is outside of buffer bounds');if(p.byteLength<a+(c||0))throw new RangeError('"length" is outside of buffer bounds');let y;return a===void 0&&c===void 0?y=new Uint8Array(p):c===void 0?y=new Uint8Array(p,a):y=new Uint8Array(p,a,c),Object.setPrototypeOf(y,s.prototype),y}function w(p){if(s.isBuffer(p)){let a=S(p.length)|0,c=o(a);return c.length===0||p.copy(c,0,0,a),c}if(p.length!==void 0)return typeof p.length!="number"||fs(p.length)?o(0):g(p);if(p.type==="Buffer"&&Array.isArray(p.data))return g(p.data)}function S(p){if(p>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return p|0}function I(p){return+p!=p&&(p=0),s.alloc(+p)}s.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==s.prototype},s.compare=function(a,c){if(Ge(a,Uint8Array)&&(a=s.from(a,a.offset,a.byteLength)),Ge(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),!s.isBuffer(a)||!s.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===c)return 0;let y=a.length,A=c.length;for(let T=0,P=Math.min(y,A);T<P;++T)if(a[T]!==c[T]){y=a[T],A=c[T];break}return y<A?-1:A<y?1:0},s.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(a,c){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return s.alloc(0);let y;if(c===void 0)for(c=0,y=0;y<a.length;++y)c+=a[y].length;let A=s.allocUnsafe(c),T=0;for(y=0;y<a.length;++y){let P=a[y];if(Ge(P,Uint8Array))T+P.length>A.length?(s.isBuffer(P)||(P=s.from(P)),P.copy(A,T)):Uint8Array.prototype.set.call(A,P,T);else if(s.isBuffer(P))P.copy(A,T);else throw new TypeError('"list" argument must be an Array of Buffers');T+=P.length}return A};function C(p,a){if(s.isBuffer(p))return p.length;if(ArrayBuffer.isView(p)||Ge(p,ArrayBuffer))return p.byteLength;if(typeof p!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof p);let c=p.length,y=arguments.length>2&&arguments[2]===!0;if(!y&&c===0)return 0;let A=!1;for(;;)switch(a){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return cs(p).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return Ea(p).length;default:if(A)return y?-1:cs(p).length;a=(""+a).toLowerCase(),A=!0}}s.byteLength=C;function k(p,a,c){let y=!1;if((a===void 0||a<0)&&(a=0),a>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,a>>>=0,c<=a))return"";for(p||(p="utf8");;)switch(p){case"hex":return Og(this,a,c);case"utf8":case"utf-8":return Se(this,a,c);case"ascii":return as(this,a,c);case"latin1":case"binary":return xg(this,a,c);case"base64":return Fe(this,a,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mg(this,a,c);default:if(y)throw new TypeError("Unknown encoding: "+p);p=(p+"").toLowerCase(),y=!0}}s.prototype._isBuffer=!0;function M(p,a,c){let y=p[a];p[a]=p[c],p[c]=y}s.prototype.swap16=function(){let a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let c=0;c<a;c+=2)M(this,c,c+1);return this},s.prototype.swap32=function(){let a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let c=0;c<a;c+=4)M(this,c,c+3),M(this,c+1,c+2);return this},s.prototype.swap64=function(){let a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let c=0;c<a;c+=8)M(this,c,c+7),M(this,c+1,c+6),M(this,c+2,c+5),M(this,c+3,c+4);return this},s.prototype.toString=function(){let a=this.length;return a===0?"":arguments.length===0?Se(this,0,a):k.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(a){if(!s.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:s.compare(this,a)===0},s.prototype.inspect=function(){let a="",c=Qt.INSPECT_MAX_BYTES;return a=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(a+=" ... "),"<Buffer "+a+">"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(a,c,y,A,T){if(Ge(a,Uint8Array)&&(a=s.from(a,a.offset,a.byteLength)),!s.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof a);if(c===void 0&&(c=0),y===void 0&&(y=a?a.length:0),A===void 0&&(A=0),T===void 0&&(T=this.length),c<0||y>a.length||A<0||T>this.length)throw new RangeError("out of range index");if(A>=T&&c>=y)return 0;if(A>=T)return-1;if(c>=y)return 1;if(c>>>=0,y>>>=0,A>>>=0,T>>>=0,this===a)return 0;let P=T-A,W=y-c,le=Math.min(P,W),re=this.slice(A,T),ae=a.slice(c,y);for(let J=0;J<le;++J)if(re[J]!==ae[J]){P=re[J],W=ae[J];break}return P<W?-1:W<P?1:0};function q(p,a,c,y,A){if(p.length===0)return-1;if(typeof c=="string"?(y=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,fs(c)&&(c=A?0:p.length-1),c<0&&(c=p.length+c),c>=p.length){if(A)return-1;c=p.length-1}else if(c<0)if(A)c=0;else return-1;if(typeof a=="string"&&(a=s.from(a,y)),s.isBuffer(a))return a.length===0?-1:G(p,a,c,y,A);if(typeof a=="number")return a=a&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call(p,a,c):Uint8Array.prototype.lastIndexOf.call(p,a,c):G(p,[a],c,y,A);throw new TypeError("val must be string, number or Buffer")}function G(p,a,c,y,A){let T=1,P=p.length,W=a.length;if(y!==void 0&&(y=String(y).toLowerCase(),y==="ucs2"||y==="ucs-2"||y==="utf16le"||y==="utf-16le")){if(p.length<2||a.length<2)return-1;T=2,P/=2,W/=2,c/=2}function le(ae,J){return T===1?ae[J]:ae.readUInt16BE(J*T)}let re;if(A){let ae=-1;for(re=c;re<P;re++)if(le(p,re)===le(a,ae===-1?0:re-ae)){if(ae===-1&&(ae=re),re-ae+1===W)return ae*T}else ae!==-1&&(re-=re-ae),ae=-1}else for(c+W>P&&(c=P-W),re=c;re>=0;re--){let ae=!0;for(let J=0;J<W;J++)if(le(p,re+J)!==le(a,J)){ae=!1;break}if(ae)return re}return-1}s.prototype.includes=function(a,c,y){return this.indexOf(a,c,y)!==-1},s.prototype.indexOf=function(a,c,y){return q(this,a,c,y,!0)},s.prototype.lastIndexOf=function(a,c,y){return q(this,a,c,y,!1)};function F(p,a,c,y){c=Number(c)||0;let A=p.length-c;y?(y=Number(y),y>A&&(y=A)):y=A;let T=a.length;y>T/2&&(y=T/2);let P;for(P=0;P<y;++P){let W=parseInt(a.substr(P*2,2),16);if(fs(W))return P;p[c+P]=W}return P}function K(p,a,c,y){return qi(cs(a,p.length-c),p,c,y)}function $(p,a,c,y){return qi(Ng(a),p,c,y)}function te(p,a,c,y){return qi(Ea(a),p,c,y)}function dt(p,a,c,y){return qi(Dg(a,p.length-c),p,c,y)}s.prototype.write=function(a,c,y,A){if(c===void 0)A="utf8",y=this.length,c=0;else if(y===void 0&&typeof c=="string")A=c,y=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(y)?(y=y>>>0,A===void 0&&(A="utf8")):(A=y,y=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let T=this.length-c;if((y===void 0||y>T)&&(y=T),a.length>0&&(y<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");A||(A="utf8");let P=!1;for(;;)switch(A){case"hex":return F(this,a,c,y);case"utf8":case"utf-8":return K(this,a,c,y);case"ascii":case"latin1":case"binary":return $(this,a,c,y);case"base64":return te(this,a,c,y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dt(this,a,c,y);default:if(P)throw new TypeError("Unknown encoding: "+A);A=(""+A).toLowerCase(),P=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Fe(p,a,c){return a===0&&c===p.length?t.fromByteArray(p):t.fromByteArray(p.slice(a,c))}function Se(p,a,c){c=Math.min(p.length,c);let y=[],A=a;for(;A<c;){let T=p[A],P=null,W=T>239?4:T>223?3:T>191?2:1;if(A+W<=c){let le,re,ae,J;switch(W){case 1:T<128&&(P=T);break;case 2:le=p[A+1],(le&192)===128&&(J=(T&31)<<6|le&63,J>127&&(P=J));break;case 3:le=p[A+1],re=p[A+2],(le&192)===128&&(re&192)===128&&(J=(T&15)<<12|(le&63)<<6|re&63,J>2047&&(J<55296||J>57343)&&(P=J));break;case 4:le=p[A+1],re=p[A+2],ae=p[A+3],(le&192)===128&&(re&192)===128&&(ae&192)===128&&(J=(T&15)<<18|(le&63)<<12|(re&63)<<6|ae&63,J>65535&&J<1114112&&(P=J))}}P===null?(P=65533,W=1):P>65535&&(P-=65536,y.push(P>>>10&1023|55296),P=56320|P&1023),y.push(P),A+=W}return Er(y)}let vr=4096;function Er(p){let a=p.length;if(a<=vr)return String.fromCharCode.apply(String,p);let c="",y=0;for(;y<a;)c+=String.fromCharCode.apply(String,p.slice(y,y+=vr));return c}function as(p,a,c){let y="";c=Math.min(p.length,c);for(let A=a;A<c;++A)y+=String.fromCharCode(p[A]&127);return y}function xg(p,a,c){let y="";c=Math.min(p.length,c);for(let A=a;A<c;++A)y+=String.fromCharCode(p[A]);return y}function Og(p,a,c){let y=p.length;(!a||a<0)&&(a=0),(!c||c<0||c>y)&&(c=y);let A="";for(let T=a;T<c;++T)A+=jg[p[T]];return A}function Mg(p,a,c){let y=p.slice(a,c),A="";for(let T=0;T<y.length-1;T+=2)A+=String.fromCharCode(y[T]+y[T+1]*256);return A}s.prototype.slice=function(a,c){let y=this.length;a=~~a,c=c===void 0?y:~~c,a<0?(a+=y,a<0&&(a=0)):a>y&&(a=y),c<0?(c+=y,c<0&&(c=0)):c>y&&(c=y),c<a&&(c=a);let A=this.subarray(a,c);return Object.setPrototypeOf(A,s.prototype),A};function be(p,a,c){if(p%1!==0||p<0)throw new RangeError("offset is not uint");if(p+a>c)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(a,c,y){a=a>>>0,c=c>>>0,y||be(a,c,this.length);let A=this[a],T=1,P=0;for(;++P<c&&(T*=256);)A+=this[a+P]*T;return A},s.prototype.readUintBE=s.prototype.readUIntBE=function(a,c,y){a=a>>>0,c=c>>>0,y||be(a,c,this.length);let A=this[a+--c],T=1;for(;c>0&&(T*=256);)A+=this[a+--c]*T;return A},s.prototype.readUint8=s.prototype.readUInt8=function(a,c){return a=a>>>0,c||be(a,1,this.length),this[a]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(a,c){return a=a>>>0,c||be(a,2,this.length),this[a]|this[a+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(a,c){return a=a>>>0,c||be(a,2,this.length),this[a]<<8|this[a+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(a,c){return a=a>>>0,c||be(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(a,c){return a=a>>>0,c||be(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},s.prototype.readBigUInt64LE=Pt(function(a){a=a>>>0,Ar(a,"offset");let c=this[a],y=this[a+7];(c===void 0||y===void 0)&&si(a,this.length-8);let A=c+this[++a]*2**8+this[++a]*2**16+this[++a]*2**24,T=this[++a]+this[++a]*2**8+this[++a]*2**16+y*2**24;return BigInt(A)+(BigInt(T)<<BigInt(32))}),s.prototype.readBigUInt64BE=Pt(function(a){a=a>>>0,Ar(a,"offset");let c=this[a],y=this[a+7];(c===void 0||y===void 0)&&si(a,this.length-8);let A=c*2**24+this[++a]*2**16+this[++a]*2**8+this[++a],T=this[++a]*2**24+this[++a]*2**16+this[++a]*2**8+y;return(BigInt(A)<<BigInt(32))+BigInt(T)}),s.prototype.readIntLE=function(a,c,y){a=a>>>0,c=c>>>0,y||be(a,c,this.length);let A=this[a],T=1,P=0;for(;++P<c&&(T*=256);)A+=this[a+P]*T;return T*=128,A>=T&&(A-=Math.pow(2,8*c)),A},s.prototype.readIntBE=function(a,c,y){a=a>>>0,c=c>>>0,y||be(a,c,this.length);let A=c,T=1,P=this[a+--A];for(;A>0&&(T*=256);)P+=this[a+--A]*T;return T*=128,P>=T&&(P-=Math.pow(2,8*c)),P},s.prototype.readInt8=function(a,c){return a=a>>>0,c||be(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},s.prototype.readInt16LE=function(a,c){a=a>>>0,c||be(a,2,this.length);let y=this[a]|this[a+1]<<8;return y&32768?y|4294901760:y},s.prototype.readInt16BE=function(a,c){a=a>>>0,c||be(a,2,this.length);let y=this[a+1]|this[a]<<8;return y&32768?y|4294901760:y},s.prototype.readInt32LE=function(a,c){return a=a>>>0,c||be(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},s.prototype.readInt32BE=function(a,c){return a=a>>>0,c||be(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},s.prototype.readBigInt64LE=Pt(function(a){a=a>>>0,Ar(a,"offset");let c=this[a],y=this[a+7];(c===void 0||y===void 0)&&si(a,this.length-8);let A=this[a+4]+this[a+5]*2**8+this[a+6]*2**16+(y<<24);return(BigInt(A)<<BigInt(32))+BigInt(c+this[++a]*2**8+this[++a]*2**16+this[++a]*2**24)}),s.prototype.readBigInt64BE=Pt(function(a){a=a>>>0,Ar(a,"offset");let c=this[a],y=this[a+7];(c===void 0||y===void 0)&&si(a,this.length-8);let A=(c<<24)+this[++a]*2**16+this[++a]*2**8+this[++a];return(BigInt(A)<<BigInt(32))+BigInt(this[++a]*2**24+this[++a]*2**16+this[++a]*2**8+y)}),s.prototype.readFloatLE=function(a,c){return a=a>>>0,c||be(a,4,this.length),e.read(this,a,!0,23,4)},s.prototype.readFloatBE=function(a,c){return a=a>>>0,c||be(a,4,this.length),e.read(this,a,!1,23,4)},s.prototype.readDoubleLE=function(a,c){return a=a>>>0,c||be(a,8,this.length),e.read(this,a,!0,52,8)},s.prototype.readDoubleBE=function(a,c){return a=a>>>0,c||be(a,8,this.length),e.read(this,a,!1,52,8)};function Ce(p,a,c,y,A,T){if(!s.isBuffer(p))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>A||a<T)throw new RangeError('"value" argument is out of bounds');if(c+y>p.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(a,c,y,A){if(a=+a,c=c>>>0,y=y>>>0,!A){let W=Math.pow(2,8*y)-1;Ce(this,a,c,y,W,0)}let T=1,P=0;for(this[c]=a&255;++P<y&&(T*=256);)this[c+P]=a/T&255;return c+y},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(a,c,y,A){if(a=+a,c=c>>>0,y=y>>>0,!A){let W=Math.pow(2,8*y)-1;Ce(this,a,c,y,W,0)}let T=y-1,P=1;for(this[c+T]=a&255;--T>=0&&(P*=256);)this[c+T]=a/P&255;return c+y},s.prototype.writeUint8=s.prototype.writeUInt8=function(a,c,y){return a=+a,c=c>>>0,y||Ce(this,a,c,1,255,0),this[c]=a&255,c+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(a,c,y){return a=+a,c=c>>>0,y||Ce(this,a,c,2,65535,0),this[c]=a&255,this[c+1]=a>>>8,c+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(a,c,y){return a=+a,c=c>>>0,y||Ce(this,a,c,2,65535,0),this[c]=a>>>8,this[c+1]=a&255,c+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(a,c,y){return a=+a,c=c>>>0,y||Ce(this,a,c,4,4294967295,0),this[c+3]=a>>>24,this[c+2]=a>>>16,this[c+1]=a>>>8,this[c]=a&255,c+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(a,c,y){return a=+a,c=c>>>0,y||Ce(this,a,c,4,4294967295,0),this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255,c+4};function ga(p,a,c,y,A){va(a,y,A,p,c,7);let T=Number(a&BigInt(4294967295));p[c++]=T,T=T>>8,p[c++]=T,T=T>>8,p[c++]=T,T=T>>8,p[c++]=T;let P=Number(a>>BigInt(32)&BigInt(4294967295));return p[c++]=P,P=P>>8,p[c++]=P,P=P>>8,p[c++]=P,P=P>>8,p[c++]=P,c}function ba(p,a,c,y,A){va(a,y,A,p,c,7);let T=Number(a&BigInt(4294967295));p[c+7]=T,T=T>>8,p[c+6]=T,T=T>>8,p[c+5]=T,T=T>>8,p[c+4]=T;let P=Number(a>>BigInt(32)&BigInt(4294967295));return p[c+3]=P,P=P>>8,p[c+2]=P,P=P>>8,p[c+1]=P,P=P>>8,p[c]=P,c+8}s.prototype.writeBigUInt64LE=Pt(function(a,c=0){return ga(this,a,c,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Pt(function(a,c=0){return ba(this,a,c,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(a,c,y,A){if(a=+a,c=c>>>0,!A){let le=Math.pow(2,8*y-1);Ce(this,a,c,y,le-1,-le)}let T=0,P=1,W=0;for(this[c]=a&255;++T<y&&(P*=256);)a<0&&W===0&&this[c+T-1]!==0&&(W=1),this[c+T]=(a/P>>0)-W&255;return c+y},s.prototype.writeIntBE=function(a,c,y,A){if(a=+a,c=c>>>0,!A){let le=Math.pow(2,8*y-1);Ce(this,a,c,y,le-1,-le)}let T=y-1,P=1,W=0;for(this[c+T]=a&255;--T>=0&&(P*=256);)a<0&&W===0&&this[c+T+1]!==0&&(W=1),this[c+T]=(a/P>>0)-W&255;return c+y},s.prototype.writeInt8=function(a,c,y){return a=+a,c=c>>>0,y||Ce(this,a,c,1,127,-128),a<0&&(a=255+a+1),this[c]=a&255,c+1},s.prototype.writeInt16LE=function(a,c,y){return a=+a,c=c>>>0,y||Ce(this,a,c,2,32767,-32768),this[c]=a&255,this[c+1]=a>>>8,c+2},s.prototype.writeInt16BE=function(a,c,y){return a=+a,c=c>>>0,y||Ce(this,a,c,2,32767,-32768),this[c]=a>>>8,this[c+1]=a&255,c+2},s.prototype.writeInt32LE=function(a,c,y){return a=+a,c=c>>>0,y||Ce(this,a,c,4,2147483647,-2147483648),this[c]=a&255,this[c+1]=a>>>8,this[c+2]=a>>>16,this[c+3]=a>>>24,c+4},s.prototype.writeInt32BE=function(a,c,y){return a=+a,c=c>>>0,y||Ce(this,a,c,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[c]=a>>>24,this[c+1]=a>>>16,this[c+2]=a>>>8,this[c+3]=a&255,c+4},s.prototype.writeBigInt64LE=Pt(function(a,c=0){return ga(this,a,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Pt(function(a,c=0){return ba(this,a,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ya(p,a,c,y,A,T){if(c+y>p.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function wa(p,a,c,y,A){return a=+a,c=c>>>0,A||ya(p,a,c,4),e.write(p,a,c,y,23,4),c+4}s.prototype.writeFloatLE=function(a,c,y){return wa(this,a,c,!0,y)},s.prototype.writeFloatBE=function(a,c,y){return wa(this,a,c,!1,y)};function _a(p,a,c,y,A){return a=+a,c=c>>>0,A||ya(p,a,c,8),e.write(p,a,c,y,52,8),c+8}s.prototype.writeDoubleLE=function(a,c,y){return _a(this,a,c,!0,y)},s.prototype.writeDoubleBE=function(a,c,y){return _a(this,a,c,!1,y)},s.prototype.copy=function(a,c,y,A){if(!s.isBuffer(a))throw new TypeError("argument should be a Buffer");if(y||(y=0),!A&&A!==0&&(A=this.length),c>=a.length&&(c=a.length),c||(c=0),A>0&&A<y&&(A=y),A===y||a.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(y<0||y>=this.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("sourceEnd out of bounds");A>this.length&&(A=this.length),a.length-c<A-y&&(A=a.length-c+y);let T=A-y;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,y,A):Uint8Array.prototype.set.call(a,this.subarray(y,A),c),T},s.prototype.fill=function(a,c,y,A){if(typeof a=="string"){if(typeof c=="string"?(A=c,c=0,y=this.length):typeof y=="string"&&(A=y,y=this.length),A!==void 0&&typeof A!="string")throw new TypeError("encoding must be a string");if(typeof A=="string"&&!s.isEncoding(A))throw new TypeError("Unknown encoding: "+A);if(a.length===1){let P=a.charCodeAt(0);(A==="utf8"&&P<128||A==="latin1")&&(a=P)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(c<0||this.length<c||this.length<y)throw new RangeError("Out of range index");if(y<=c)return this;c=c>>>0,y=y===void 0?this.length:y>>>0,a||(a=0);let T;if(typeof a=="number")for(T=c;T<y;++T)this[T]=a;else{let P=s.isBuffer(a)?a:s.from(a,A),W=P.length;if(W===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(T=0;T<y-c;++T)this[T+c]=P[T%W]}return this};let Sr={};function us(p,a,c){Sr[p]=class extends c{constructor(){super(),Object.defineProperty(this,"message",{value:a.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${p}]`,this.stack,delete this.name}get code(){return p}set code(A){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:A,writable:!0})}toString(){return`${this.name} [${p}]: ${this.message}`}}}us("ERR_BUFFER_OUT_OF_BOUNDS",function(p){return p?`${p} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),us("ERR_INVALID_ARG_TYPE",function(p,a){return`The "${p}" argument must be of type number. Received type ${typeof a}`},TypeError),us("ERR_OUT_OF_RANGE",function(p,a,c){let y=`The value of "${p}" is out of range.`,A=c;return Number.isInteger(c)&&Math.abs(c)>2**32?A=ma(String(c)):typeof c=="bigint"&&(A=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(A=ma(A)),A+="n"),y+=` It must be ${a}. Received ${A}`,y},RangeError);function ma(p){let a="",c=p.length,y=p[0]==="-"?1:0;for(;c>=y+4;c-=3)a=`_${p.slice(c-3,c)}${a}`;return`${p.slice(0,c)}${a}`}function Lg(p,a,c){Ar(a,"offset"),(p[a]===void 0||p[a+c]===void 0)&&si(a,p.length-(c+1))}function va(p,a,c,y,A,T){if(p>c||p<a){let P=typeof a=="bigint"?"n":"",W;throw T>3?a===0||a===BigInt(0)?W=`>= 0${P} and < 2${P} ** ${(T+1)*8}${P}`:W=`>= -(2${P} ** ${(T+1)*8-1}${P}) and < 2 ** ${(T+1)*8-1}${P}`:W=`>= ${a}${P} and <= ${c}${P}`,new Sr.ERR_OUT_OF_RANGE("value",W,p)}Lg(y,A,T)}function Ar(p,a){if(typeof p!="number")throw new Sr.ERR_INVALID_ARG_TYPE(a,"number",p)}function si(p,a,c){throw Math.floor(p)!==p?(Ar(p,c),new Sr.ERR_OUT_OF_RANGE(c||"offset","an integer",p)):a<0?new Sr.ERR_BUFFER_OUT_OF_BOUNDS:new Sr.ERR_OUT_OF_RANGE(c||"offset",`>= ${c?1:0} and <= ${a}`,p)}let qg=/[^+/0-9A-Za-z-_]/g;function Ug(p){if(p=p.split("=")[0],p=p.trim().replace(qg,""),p.length<2)return"";for(;p.length%4!==0;)p=p+"=";return p}function cs(p,a){a=a||1/0;let c,y=p.length,A=null,T=[];for(let P=0;P<y;++P){if(c=p.charCodeAt(P),c>55295&&c<57344){if(!A){if(c>56319){(a-=3)>-1&&T.push(239,191,189);continue}else if(P+1===y){(a-=3)>-1&&T.push(239,191,189);continue}A=c;continue}if(c<56320){(a-=3)>-1&&T.push(239,191,189),A=c;continue}c=(A-55296<<10|c-56320)+65536}else A&&(a-=3)>-1&&T.push(239,191,189);if(A=null,c<128){if((a-=1)<0)break;T.push(c)}else if(c<2048){if((a-=2)<0)break;T.push(c>>6|192,c&63|128)}else if(c<65536){if((a-=3)<0)break;T.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((a-=4)<0)break;T.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return T}function Ng(p){let a=[];for(let c=0;c<p.length;++c)a.push(p.charCodeAt(c)&255);return a}function Dg(p,a){let c,y,A,T=[];for(let P=0;P<p.length&&!((a-=2)<0);++P)c=p.charCodeAt(P),y=c>>8,A=c%256,T.push(A),T.push(y);return T}function Ea(p){return t.toByteArray(Ug(p))}function qi(p,a,c,y){let A;for(A=0;A<y&&!(A+c>=a.length||A>=p.length);++A)a[A+c]=p[A];return A}function Ge(p,a){return p instanceof a||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===a.name}function fs(p){return p!==p}let jg=function(){let p="0123456789abcdef",a=new Array(256);for(let c=0;c<16;++c){let y=c*16;for(let A=0;A<16;++A)a[y+A]=p[c]+p[A]}return a}();function Pt(p){return typeof BigInt>"u"?Fg:p}function Fg(){throw new Error("BigInt not supported")}return Qt}var oi,Du,ji,ju,Qt,Fu,Bt,x,Yg,Jg,he=Ae(()=>{_();v();m();oi={},Du=!1;ji={},ju=!1;Qt={},Fu=!1;Bt=Qg();Bt.Buffer;Bt.SlowBuffer;Bt.INSPECT_MAX_BYTES;Bt.kMaxLength;x=Bt.Buffer,Yg=Bt.INSPECT_MAX_BYTES,Jg=Bt.kMaxLength});var v=Ae(()=>{he()});var Wu=O(ys=>{"use strict";_();v();m();Object.defineProperty(ys,"__esModule",{value:!0});var bs=class{constructor(e){this.aliasToTopic={},this.max=e}put(e,r){return r===0||r>this.max?!1:(this.aliasToTopic[r]=e,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(e){return this.aliasToTopic[e]}clear(){this.aliasToTopic={}}};ys.default=bs});var ie=O((VA,$u)=>{"use strict";_();v();m();var ws=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
|
|
2
|
+
`;super(r),this.name="AggregateError",this.errors=e}};$u.exports={AggregateError:ws,ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},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,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},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,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var _s=O((tI,Hu)=>{"use strict";_();v();m();Hu.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}});var me=O((fI,Ku)=>{"use strict";_();v();m();var{format:Xg,inspect:Fi}=_s(),{AggregateError:Zg}=ie(),eb=globalThis.AggregateError||Zg,tb=Symbol("kIsNodeError"),rb=["string","function","number","object","Function","Object","boolean","bigint","symbol"],ib=/^([A-Z][a-z0-9]*)+$/,nb="__node_internal_",Wi={};function Yt(t,e){if(!t)throw new Wi.ERR_INTERNAL_ASSERTION(e)}function Vu(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function sb(t,e,r){if(typeof e=="function")return Yt(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return Yt(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:Xg(e,...r)}function we(t,e,r){r||(r=Error);class i extends r{constructor(...o){super(sb(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[tb]=!0,Wi[t]=i}function zu(t){let e=nb+t.name;return Object.defineProperty(t,"name",{value:e}),t}function ob(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new eb([e,t],e.message);return r.code=e.code,r}return t||e}var ms=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Wi.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};we("ERR_ASSERTION","%s",Error);we("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Yt(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],o=[],s=[];for(let u of e)Yt(typeof u=="string","All expected entries have to be of type string"),rb.includes(u)?n.push(u.toLowerCase()):ib.test(u)?o.push(u):(Yt(u!=="object",'The value "object" should be written as "Object"'),s.push(u));if(o.length>0){let u=n.indexOf("object");u!==-1&&(n.splice(n,u,1),o.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let u=n.pop();i+=`one of type ${n.join(", ")}, or ${u}`}}(o.length>0||s.length>0)&&(i+=" or ")}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let u=o.pop();i+=`an instance of ${o.join(", ")}, or ${u}`}}s.length>0&&(i+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(i+="an "),i+=`${s[0]}`;break;case 2:i+=`one of ${s[0]} or ${s[1]}`;break;default:{let u=s.pop();i+=`one of ${s.join(", ")}, or ${u}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var l;if((l=r.constructor)!==null&&l!==void 0&&l.name)i+=`. Received an instance of ${r.constructor.name}`;else{let u=Fi(r,{depth:-1});i+=`. Received ${u}`}}else{let u=Fi(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),i+=`. Received type ${typeof r} (${u})`}return i},TypeError);we("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=Fi(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);we("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);we("ERR_MISSING_ARGS",(...t)=>{Yt(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);we("ERR_OUT_OF_RANGE",(t,e,r)=>{Yt(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=Vu(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=Vu(i)),i+="n"}else i=Fi(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);we("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);we("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);we("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);we("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);we("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);we("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);we("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);we("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);we("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);we("ERR_STREAM_WRITE_AFTER_END","write after end",Error);we("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Ku.exports={AbortError:ms,aggregateTwoErrors:zu(ob),hideStackFrames:zu,codes:Wi}});var Rr=O((vI,$i)=>{"use strict";_();v();m();var{AbortController:Gu,AbortSignal:lb}=typeof self<"u"?self:typeof window<"u"?window:void 0;$i.exports=Gu;$i.exports.AbortSignal=lb;$i.exports.default=Gu});function Y(){Y.init.call(this)}function Hi(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function nc(t){return t._maxListeners===void 0?Y.defaultMaxListeners:t._maxListeners}function Xu(t,e,r,i){var n,o,s,l;if(Hi(r),(o=t._events)===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s=="function"?s=o[e]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=nc(t))>0&&s.length>n&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,l=u,console&&console.warn&&console.warn(l)}return t}function ab(){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 Zu(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=ab.bind(i);return n.listener=r,i.wrapFn=n,n}function ec(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?function(o){for(var s=new Array(o.length),l=0;l<s.length;++l)s[l]=o[l].listener||o[l];return s}(n):sc(n,n.length)}function tc(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}function sc(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}var rc,ic,Cr,Qu,Yu,Ju,Pe,vs=Ae(()=>{_();v();m();Cr=typeof Reflect=="object"?Reflect:null,Qu=Cr&&typeof Cr.apply=="function"?Cr.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};ic=Cr&&typeof Cr.ownKeys=="function"?Cr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Yu=Number.isNaN||function(t){return t!=t};rc=Y,Y.EventEmitter=Y,Y.prototype._events=void 0,Y.prototype._eventsCount=0,Y.prototype._maxListeners=void 0;Ju=10;Object.defineProperty(Y,"defaultMaxListeners",{enumerable:!0,get:function(){return Ju},set:function(t){if(typeof t!="number"||t<0||Yu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ju=t}}),Y.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},Y.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Yu(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},Y.prototype.getMaxListeners=function(){return nc(this)},Y.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var i=t==="error",n=this._events;if(n!==void 0)i=i&&n.error===void 0;else if(!i)return!1;if(i){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var l=n[t];if(l===void 0)return!1;if(typeof l=="function")Qu(l,this,e);else{var u=l.length,f=sc(l,u);for(r=0;r<u;++r)Qu(f[r],this,e)}return!0},Y.prototype.addListener=function(t,e){return Xu(this,t,e,!1)},Y.prototype.on=Y.prototype.addListener,Y.prototype.prependListener=function(t,e){return Xu(this,t,e,!0)},Y.prototype.once=function(t,e){return Hi(e),this.on(t,Zu(this,t,e)),this},Y.prototype.prependOnceListener=function(t,e){return Hi(e),this.prependListener(t,Zu(this,t,e)),this},Y.prototype.removeListener=function(t,e){var r,i,n,o,s;if(Hi(e),(i=this._events)===void 0)return this;if((r=i[t])===void 0)return this;if(r===e||r.listener===e)--this._eventsCount==0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||e));else if(typeof r!="function"){for(n=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,n=o;break}if(n<0)return this;n===0?r.shift():function(l,u){for(;u+1<l.length;u++)l[u]=l[u+1];l.pop()}(r,n),r.length===1&&(i[t]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",t,s||e)}return this},Y.prototype.off=Y.prototype.removeListener,Y.prototype.removeAllListeners=function(t){var e,r,i;if((r=this._events)===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var n,o=Object.keys(r);for(i=0;i<o.length;++i)(n=o[i])!=="removeListener"&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(e=r[t])=="function")this.removeListener(t,e);else if(e!==void 0)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},Y.prototype.listeners=function(t){return ec(this,t,!0)},Y.prototype.rawListeners=function(t){return ec(this,t,!1)},Y.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):tc.call(t,e)},Y.prototype.listenerCount=tc,Y.prototype.eventNames=function(){return this._eventsCount>0?ic(this._events):[]};Pe=rc;Pe.EventEmitter;Pe.defaultMaxListeners;Pe.init;Pe.listenerCount;Pe.EventEmitter;Pe.defaultMaxListeners;Pe.init;Pe.listenerCount});var xt={};Ir(xt,{EventEmitter:()=>ub,default:()=>Pe,defaultMaxListeners:()=>cb,init:()=>fb,listenerCount:()=>hb,on:()=>db,once:()=>pb});var ub,cb,fb,hb,db,pb,Ot=Ae(()=>{_();v();m();vs();vs();Pe.once=function(t,e){return new Promise((r,i)=>{function n(...s){o!==void 0&&t.removeListener("error",o),r(s)}let o;e!=="error"&&(o=s=>{t.removeListener(name,n),i(s)},t.once("error",o)),t.once(e,n)})};Pe.on=function(t,e){let r=[],i=[],n=null,o=!1,s={async next(){let f=r.shift();if(f)return createIterResult(f,!1);if(n){let d=Promise.reject(n);return n=null,d}return o?createIterResult(void 0,!0):new Promise((d,h)=>i.push({resolve:d,reject:h}))},async return(){t.removeListener(e,l),t.removeListener("error",u),o=!0;for(let f of i)f.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(f){n=f,t.removeListener(e,l),t.removeListener("error",u)},[Symbol.asyncIterator](){return this}};return t.on(e,l),t.on("error",u),s;function l(...f){let d=i.shift();d?d.resolve(createIterResult(f,!1)):r.push(f)}function u(f){o=!0;let d=i.shift();d?d.reject(f):n=f,s.return()}};({EventEmitter:ub,defaultMaxListeners:cb,init:fb,listenerCount:hb,on:db,once:pb}=Pe)});var Ie=O((XI,Ss)=>{"use strict";_();v();m();var gb=(he(),Q(ye)),{format:bb,inspect:yb}=_s(),{codes:{ERR_INVALID_ARG_TYPE:Es}}=me(),{kResistStopPropagation:wb,AggregateError:_b,SymbolDispose:mb}=ie(),vb=globalThis.AbortSignal||Rr().AbortSignal,Eb=globalThis.AbortController||Rr().AbortController,Sb=Object.getPrototypeOf(async function(){}).constructor,oc=globalThis.Blob||gb.Blob,Ab=typeof oc<"u"?function(e){return e instanceof oc}:function(e){return!1},lc=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Es(e,"AbortSignal",t)},Ib=(t,e)=>{if(typeof t!="function")throw new Es(e,"Function",t)};Ss.exports={AggregateError:_b,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format:bb,inspect:yb,types:{isAsyncFunction(t){return t instanceof Sb},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Ab,deprecate(t,e){return t},addAbortListener:(Ot(),Q(xt)).addAbortListener||function(e,r){if(e===void 0)throw new Es("signal","AbortSignal",e);lc(e,"signal"),Ib(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[wb]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[mb](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:vb.any||function(e){if(e.length===1)return e[0];let r=new Eb,i=()=>r.abort();return e.forEach(n=>{lc(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal}};Ss.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var kr=O((aT,yc)=>{"use strict";_();v();m();var{ArrayIsArray:Is,ArrayPrototypeIncludes:fc,ArrayPrototypeJoin:hc,ArrayPrototypeMap:Tb,NumberIsInteger:Ts,NumberIsNaN:Rb,NumberMAX_SAFE_INTEGER:Cb,NumberMIN_SAFE_INTEGER:Pb,NumberParseInt:kb,ObjectPrototypeHasOwnProperty:Bb,RegExpPrototypeExec:dc,String:xb,StringPrototypeToUpperCase:Ob,StringPrototypeTrim:Mb}=ie(),{hideStackFrames:Me,codes:{ERR_SOCKET_BAD_PORT:Lb,ERR_INVALID_ARG_TYPE:ve,ERR_INVALID_ARG_VALUE:Pr,ERR_OUT_OF_RANGE:Jt,ERR_UNKNOWN_SIGNAL:ac}}=me(),{normalizeEncoding:qb}=Ie(),{isAsyncFunction:Ub,isArrayBufferView:Nb}=Ie().types,uc={};function Db(t){return t===(t|0)}function jb(t){return t===t>>>0}var Fb=/^[0-7]+$/,Wb="must be a 32-bit unsigned integer or an octal string";function $b(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(dc(Fb,t)===null)throw new Pr(e,t,Wb);t=kb(t,8)}return pc(t,e),t}var Hb=Me((t,e,r=Pb,i=Cb)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!Ts(t))throw new Jt(e,"an integer",t);if(t<r||t>i)throw new Jt(e,`>= ${r} && <= ${i}`,t)}),Vb=Me((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!Ts(t))throw new Jt(e,"an integer",t);if(t<r||t>i)throw new Jt(e,`>= ${r} && <= ${i}`,t)}),pc=Me((t,e,r=!1)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!Ts(t))throw new Jt(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new Jt(e,`>= ${i} && <= ${n}`,t)});function Rs(t,e){if(typeof t!="string")throw new ve(e,"string",t)}function zb(t,e,r=void 0,i){if(typeof t!="number")throw new ve(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Rb(t))throw new Jt(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var Kb=Me((t,e,r)=>{if(!fc(r,t)){let n="must be one of: "+hc(Tb(r,o=>typeof o=="string"?`'${o}'`:xb(o)),", ");throw new Pr(e,t,n)}});function gc(t,e){if(typeof t!="boolean")throw new ve(e,"boolean",t)}function As(t,e,r){return t==null||!Bb(t,e)?r:t[e]}var Gb=Me((t,e,r=null)=>{let i=As(r,"allowArray",!1),n=As(r,"allowFunction",!1);if(!As(r,"nullable",!1)&&t===null||!i&&Is(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new ve(e,"Object",t)}),Qb=Me((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new ve(e,"a dictionary",t)}),Vi=Me((t,e,r=0)=>{if(!Is(t))throw new ve(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new Pr(e,t,i)}});function Yb(t,e){Vi(t,e);for(let r=0;r<t.length;r++)Rs(t[r],`${e}[${r}]`)}function Jb(t,e){Vi(t,e);for(let r=0;r<t.length;r++)gc(t[r],`${e}[${r}]`)}function Xb(t,e){Vi(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new ve(n,"AbortSignal",i);bc(i,n)}}function Zb(t,e="signal"){if(Rs(t,e),uc[t]===void 0)throw uc[Ob(t)]!==void 0?new ac(t+" (signals must use all capital letters)"):new ac(t)}var ey=Me((t,e="buffer")=>{if(!Nb(t))throw new ve(e,["Buffer","TypedArray","DataView"],t)});function ty(t,e){let r=qb(e),i=t.length;if(r==="hex"&&i%2!==0)throw new Pr("encoding",e,`is invalid for data of length ${i}`)}function ry(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Mb(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Lb(e,t,r);return t|0}var bc=Me((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ve(e,"AbortSignal",t)}),iy=Me((t,e)=>{if(typeof t!="function")throw new ve(e,"Function",t)}),ny=Me((t,e)=>{if(typeof t!="function"||Ub(t))throw new ve(e,"Function",t)}),sy=Me((t,e)=>{if(t!==void 0)throw new ve(e,"undefined",t)});function oy(t,e,r){if(!fc(r,t))throw new ve(e,`('${hc(r,"|")}')`,t)}var ly=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function cc(t,e){if(typeof t>"u"||!dc(ly,t))throw new Pr(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function ay(t){if(typeof t=="string")return cc(t,"hints"),t;if(Is(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];cc(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new Pr("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}yc.exports={isInt32:Db,isUint32:jb,parseFileMode:$b,validateArray:Vi,validateStringArray:Yb,validateBooleanArray:Jb,validateAbortSignalArray:Xb,validateBoolean:gc,validateBuffer:ey,validateDictionary:Qb,validateEncoding:ty,validateFunction:iy,validateInt32:Vb,validateInteger:Hb,validateNumber:zb,validateObject:Gb,validateOneOf:Kb,validatePlainFunction:ny,validatePort:ry,validateSignalName:Zb,validateString:Rs,validateUint32:pc,validateUndefined:sy,validateUnion:oy,validateAbortSignal:bc,validateLinkHeaderValue:ay}});var Mt=O((wT,vc)=>{_();v();m();var ue=vc.exports={},Qe,Ye;function Cs(){throw new Error("setTimeout has not been defined")}function Ps(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Qe=setTimeout:Qe=Cs}catch{Qe=Cs}try{typeof clearTimeout=="function"?Ye=clearTimeout:Ye=Ps}catch{Ye=Ps}})();function wc(t){if(Qe===setTimeout)return setTimeout(t,0);if((Qe===Cs||!Qe)&&setTimeout)return Qe=setTimeout,setTimeout(t,0);try{return Qe(t,0)}catch{try{return Qe.call(null,t,0)}catch{return Qe.call(this,t,0)}}}function uy(t){if(Ye===clearTimeout)return clearTimeout(t);if((Ye===Ps||!Ye)&&clearTimeout)return Ye=clearTimeout,clearTimeout(t);try{return Ye(t)}catch{try{return Ye.call(null,t)}catch{return Ye.call(this,t)}}}var bt=[],Br=!1,Xt,zi=-1;function cy(){!Br||!Xt||(Br=!1,Xt.length?bt=Xt.concat(bt):zi=-1,bt.length&&_c())}function _c(){if(!Br){var t=wc(cy);Br=!0;for(var e=bt.length;e;){for(Xt=bt,bt=[];++zi<e;)Xt&&Xt[zi].run();zi=-1,e=bt.length}Xt=null,Br=!1,uy(t)}}ue.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];bt.push(new mc(t,e)),bt.length===1&&!Br&&wc(_c)};function mc(t,e){this.fun=t,this.array=e}mc.prototype.run=function(){this.fun.apply(null,this.array)};ue.title="browser";ue.browser=!0;ue.env={};ue.argv=[];ue.version="";ue.versions={};function yt(){}ue.on=yt;ue.addListener=yt;ue.once=yt;ue.off=yt;ue.removeListener=yt;ue.removeAllListeners=yt;ue.emit=yt;ue.prependListener=yt;ue.prependOnceListener=yt;ue.listeners=function(t){return[]};ue.binding=function(t){throw new Error("process.binding is not supported")};ue.cwd=function(){return"/"};ue.chdir=function(t){throw new Error("process.chdir is not supported")};ue.umask=function(){return 0}});var Xe=O((CT,qc)=>{"use strict";_();v();m();var{SymbolAsyncIterator:Ec,SymbolIterator:Sc,SymbolFor:Zt}=ie(),Ac=Zt("nodejs.stream.destroyed"),Ic=Zt("nodejs.stream.errored"),ks=Zt("nodejs.stream.readable"),Bs=Zt("nodejs.stream.writable"),Tc=Zt("nodejs.stream.disturbed"),fy=Zt("nodejs.webstream.isClosedPromise"),hy=Zt("nodejs.webstream.controllerErrorFunction");function Ki(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function Gi(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function dy(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function Je(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Rc(t){return!!(t&&!Je(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Cc(t){return!!(t&&!Je(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Pc(t){return!!(t&&!Je(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function py(t){return Rc(t)||Cc(t)||Pc(t)}function gy(t,e){return t==null?!1:e===!0?typeof t[Ec]=="function":e===!1?typeof t[Sc]=="function":typeof t[Ec]=="function"||typeof t[Sc]=="function"}function Qi(t){if(!Je(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[Ac]||i!=null&&i.destroyed)}function kc(t){if(!Gi(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function by(t,e){if(!Gi(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function yy(t){if(!Ki(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Bc(t,e){if(!Ki(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function xc(t){return t&&t[ks]!=null?t[ks]:typeof t?.readable!="boolean"?null:Qi(t)?!1:Ki(t)&&t.readable&&!Bc(t)}function Oc(t){return t&&t[Bs]!=null?t[Bs]:typeof t?.writable!="boolean"?null:Qi(t)?!1:Gi(t)&&t.writable&&!kc(t)}function wy(t,e){return Je(t)?Qi(t)?!0:!(e?.readable!==!1&&xc(t)||e?.writable!==!1&&Oc(t)):null}function _y(t){var e,r;return Je(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function my(t){var e,r;return Je(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function vy(t){if(!Je(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Mc(t)?t._closed:null}function Mc(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Lc(t){return typeof t._sent100=="boolean"&&Mc(t)}function Ey(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function Sy(t){if(!Je(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&Lc(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function Ay(t){var e;return!!(t&&((e=t[Tc])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Iy(t){var e,r,i,n,o,s,l,u,f,d;return!!(t&&((e=(r=(i=(n=(o=(s=t[Ic])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&n!==void 0?n:(l=t._readableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&i!==void 0?i:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&r!==void 0?r:(f=t._readableState)===null||f===void 0?void 0:f.errored)!==null&&e!==void 0?e:!((d=t._writableState)===null||d===void 0)&&d.errored))}qc.exports={isDestroyed:Qi,kIsDestroyed:Ac,isDisturbed:Ay,kIsDisturbed:Tc,isErrored:Iy,kIsErrored:Ic,isReadable:xc,kIsReadable:ks,kIsClosedPromise:fy,kControllerErrorFunction:hy,kIsWritable:Bs,isClosed:vy,isDuplexNodeStream:dy,isFinished:wy,isIterable:gy,isReadableNodeStream:Ki,isReadableStream:Rc,isReadableEnded:yy,isReadableFinished:Bc,isReadableErrored:my,isNodeStream:Je,isWebStream:py,isWritable:Oc,isWritableNodeStream:Gi,isWritableStream:Cc,isWritableEnded:kc,isWritableFinished:by,isWritableErrored:_y,isServerRequest:Ey,isServerResponse:Lc,willEmitClose:Sy,isTransformStream:Pc}});var wt=O((NT,qs)=>{"use strict";_();v();m();var Lt=Mt(),{AbortError:Vc,codes:Ty}=me(),{ERR_INVALID_ARG_TYPE:Ry,ERR_STREAM_PREMATURE_CLOSE:Uc}=Ty,{kEmptyObject:Os,once:Ms}=Ie(),{validateAbortSignal:Cy,validateFunction:Py,validateObject:ky,validateBoolean:By}=kr(),{Promise:xy,PromisePrototypeThen:Oy,SymbolDispose:zc}=ie(),{isClosed:My,isReadable:Nc,isReadableNodeStream:xs,isReadableStream:Ly,isReadableFinished:Dc,isReadableErrored:jc,isWritable:Fc,isWritableNodeStream:Wc,isWritableStream:qy,isWritableFinished:$c,isWritableErrored:Hc,isNodeStream:Uy,willEmitClose:Ny,kIsClosedPromise:Dy}=Xe(),xr;function jy(t){return t.setHeader&&typeof t.abort=="function"}var Ls=()=>{};function Kc(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Os):e==null?e=Os:ky(e,"options"),Py(r,"callback"),Cy(e.signal,"options.signal"),r=Ms(r),Ly(t)||qy(t))return Fy(t,e,r);if(!Uy(t))throw new Ry("stream",["ReadableStream","WritableStream","Stream"],t);let o=(i=e.readable)!==null&&i!==void 0?i:xs(t),s=(n=e.writable)!==null&&n!==void 0?n:Wc(t),l=t._writableState,u=t._readableState,f=()=>{t.writable||g()},d=Ny(t)&&xs(t)===o&&Wc(t)===s,h=$c(t,!1),g=()=>{h=!0,t.destroyed&&(d=!1),!(d&&(!t.readable||o))&&(!o||b)&&r.call(t)},b=Dc(t,!1),E=()=>{b=!0,t.destroyed&&(d=!1),!(d&&(!t.writable||s))&&(!s||h)&&r.call(t)},w=q=>{r.call(t,q)},S=My(t),I=()=>{S=!0;let q=Hc(t)||jc(t);if(q&&typeof q!="boolean")return r.call(t,q);if(o&&!b&&xs(t,!0)&&!Dc(t,!1))return r.call(t,new Uc);if(s&&!h&&!$c(t,!1))return r.call(t,new Uc);r.call(t)},C=()=>{S=!0;let q=Hc(t)||jc(t);if(q&&typeof q!="boolean")return r.call(t,q);r.call(t)},k=()=>{t.req.on("finish",g)};jy(t)?(t.on("complete",g),d||t.on("abort",I),t.req?k():t.on("request",k)):s&&!l&&(t.on("end",f),t.on("close",f)),!d&&typeof t.aborted=="boolean"&&t.on("aborted",I),t.on("end",E),t.on("finish",g),e.error!==!1&&t.on("error",w),t.on("close",I),S?Lt.nextTick(I):l!=null&&l.errorEmitted||u!=null&&u.errorEmitted?d||Lt.nextTick(C):(!o&&(!d||Nc(t))&&(h||Fc(t)===!1)||!s&&(!d||Fc(t))&&(b||Nc(t)===!1)||u&&t.req&&t.aborted)&&Lt.nextTick(C);let M=()=>{r=Ls,t.removeListener("aborted",I),t.removeListener("complete",g),t.removeListener("abort",I),t.removeListener("request",k),t.req&&t.req.removeListener("finish",g),t.removeListener("end",f),t.removeListener("close",f),t.removeListener("finish",g),t.removeListener("end",E),t.removeListener("error",w),t.removeListener("close",I)};if(e.signal&&!S){let q=()=>{let G=r;M(),G.call(t,new Vc(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Lt.nextTick(q);else{xr=xr||Ie().addAbortListener;let G=xr(e.signal,q),F=r;r=Ms((...K)=>{G[zc](),F.apply(t,K)})}}return M}function Fy(t,e,r){let i=!1,n=Ls;if(e.signal)if(n=()=>{i=!0,r.call(t,new Vc(void 0,{cause:e.signal.reason}))},e.signal.aborted)Lt.nextTick(n);else{xr=xr||Ie().addAbortListener;let s=xr(e.signal,n),l=r;r=Ms((...u)=>{s[zc](),l.apply(t,u)})}let o=(...s)=>{i||Lt.nextTick(()=>r.apply(t,s))};return Oy(t[Dy].promise,o,o),Ls}function Wy(t,e){var r;let i=!1;return e===null&&(e=Os),(r=e)!==null&&r!==void 0&&r.cleanup&&(By(e.cleanup,"cleanup"),i=e.cleanup),new xy((n,o)=>{let s=Kc(t,e,l=>{i&&s(),l?o(l):n()})})}qs.exports=Kc;qs.exports.finished=Wy});var er=O((GT,tf)=>{"use strict";_();v();m();var Ze=Mt(),{aggregateTwoErrors:$y,codes:{ERR_MULTIPLE_CALLBACK:Hy},AbortError:Vy}=me(),{Symbol:Yc}=ie(),{kIsDestroyed:zy,isDestroyed:Ky,isFinished:Gy,isServerRequest:Qy}=Xe(),Jc=Yc("kDestroy"),Us=Yc("kConstruct");function Xc(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Yy(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(Xc(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?Gc(this,t,e):this.once(Jc,function(o){Gc(this,$y(o,t),e)}),this)}function Gc(t,e,r){let i=!1;function n(o){if(i)return;i=!0;let s=t._readableState,l=t._writableState;Xc(o,l,s),l&&(l.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?Ze.nextTick(Jy,t,o):Ze.nextTick(Zc,t)}try{t._destroy(e||null,n)}catch(o){n(o)}}function Jy(t,e){Ns(t,e),Zc(t)}function Zc(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function Ns(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Xy(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function Ds(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?Ze.nextTick(Ns,t,e):Ns(t,e))}function Zy(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(Us,e),!(t.listenerCount(Us)>1)&&Ze.nextTick(ew,t)}function ew(t){let e=!1;function r(i){if(e){Ds(t,i??new Hy);return}e=!0;let n=t._readableState,o=t._writableState,s=o||n;n&&(n.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(Jc,i):i?Ds(t,i,!0):Ze.nextTick(tw,t)}try{t._construct(i=>{Ze.nextTick(r,i)})}catch(i){Ze.nextTick(r,i)}}function tw(t){t.emit(Us)}function Qc(t){return t?.setHeader&&typeof t.abort=="function"}function ef(t){t.emit("close")}function rw(t,e){t.emit("error",e),Ze.nextTick(ef,t)}function iw(t,e){!t||Ky(t)||(!e&&!Gy(t)&&(e=new Vy),Qy(t)?(t.socket=null,t.destroy(e)):Qc(t)?t.abort():Qc(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Ze.nextTick(rw,t,e):Ze.nextTick(ef,t),t.destroyed||(t[zy]=!0))}tf.exports={construct:Zy,destroyer:iw,destroy:Yy,undestroy:Xy,errorOrDestroy:Ds}});var Xi=O((nR,nf)=>{"use strict";_();v();m();var{ArrayIsArray:nw,ObjectSetPrototypeOf:rf}=ie(),{EventEmitter:Yi}=(Ot(),Q(xt));function Ji(t){Yi.call(this,t)}rf(Ji.prototype,Yi.prototype);rf(Ji,Yi);Ji.prototype.pipe=function(t,e){let r=this;function i(d){t.writable&&t.write(d)===!1&&r.pause&&r.pause()}r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",l));let o=!1;function s(){o||(o=!0,t.end())}function l(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function u(d){f(),Yi.listenerCount(this,"error")===0&&this.emit("error",d)}js(r,"error",u),js(t,"error",u);function f(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",s),r.removeListener("close",l),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t};function js(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):nw(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}nf.exports={Stream:Ji,prependListener:js}});var li=O((pR,Zi)=>{"use strict";_();v();m();var{SymbolDispose:sw}=ie(),{AbortError:sf,codes:ow}=me(),{isNodeStream:of,isWebStream:lw,kControllerErrorFunction:aw}=Xe(),uw=wt(),{ERR_INVALID_ARG_TYPE:lf}=ow,Fs,cw=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new lf(e,"AbortSignal",t)};Zi.exports.addAbortSignal=function(e,r){if(cw(e,"signal"),!of(r)&&!lw(r))throw new lf("stream",["ReadableStream","WritableStream","Stream"],r);return Zi.exports.addAbortSignalNoValidate(e,r)};Zi.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=of(e)?()=>{e.destroy(new sf(void 0,{cause:t.reason}))}:()=>{e[aw](new sf(void 0,{cause:t.reason}))};if(t.aborted)r();else{Fs=Fs||Ie().addAbortListener;let i=Fs(t,r);uw(e,i[sw])}return e}});var cf=O((IR,uf)=>{"use strict";_();v();m();var{StringPrototypeSlice:af,SymbolIterator:fw,TypedArrayPrototypeSet:en,Uint8Array:hw}=ie(),{Buffer:Ws}=(he(),Q(ye)),{inspect:dw}=Ie();uf.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return Ws.alloc(0);let r=Ws.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)en(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[fw](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",i=this.head,n=0;do{let o=i.data;if(e>o.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=af(o,0,e),this.head=i,i.data=af(o,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=Ws.allocUnsafe(e),i=e,n=this.head,o=0;do{let s=n.data;if(e>s.length)en(r,s,i-e),e-=s.length;else{e===s.length?(en(r,s,i-e),++o,n.next?this.head=n.next:this.head=this.tail=null):(en(r,new hw(s.buffer,s.byteOffset,e),i-e),this.head=n,n.data=s.slice(e));break}++o}while((n=n.next)!==null);return this.length-=o,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return dw(this,{...r,depth:0,customInspect:!1})}}});var ai=O((LR,pf)=>{"use strict";_();v();m();var{MathFloor:pw,NumberIsInteger:gw}=ie(),{validateInteger:bw}=kr(),{ERR_INVALID_ARG_VALUE:yw}=me().codes,ff=16*1024,hf=16;function ww(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function df(t){return t?hf:ff}function _w(t,e){bw(e,"value",0),t?hf=e:ff=e}function mw(t,e,r,i){let n=ww(e,i,r);if(n!=null){if(!gw(n)||n<0){let o=i?`options.${r}`:"options.highWaterMark";throw new yw(o,n)}return pw(n)}return df(t.objectMode)}pf.exports={getHighWaterMark:mw,getDefaultHighWaterMark:df,setDefaultHighWaterMark:_w}});var yf=O(($s,bf)=>{_();v();m();var tn=(he(),Q(ye)),et=tn.Buffer;function gf(t,e){for(var r in t)e[r]=t[r]}et.from&&et.alloc&&et.allocUnsafe&&et.allocUnsafeSlow?bf.exports=tn:(gf(tn,$s),$s.Buffer=tr);function tr(t,e,r){return et(t,e,r)}tr.prototype=Object.create(et.prototype);gf(et,tr);tr.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return et(t,e,r)};tr.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=et(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};tr.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return et(t)};tr.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return tn.SlowBuffer(t)}});var mf=O(_f=>{"use strict";_();v();m();var Vs=yf().Buffer,wf=Vs.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function vw(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function Ew(t){var e=vw(t);if(typeof e!="string"&&(Vs.isEncoding===wf||!wf(t)))throw new Error("Unknown encoding: "+t);return e||t}_f.StringDecoder=ui;function ui(t){this.encoding=Ew(t);var e;switch(this.encoding){case"utf16le":this.text=Cw,this.end=Pw,e=4;break;case"utf8":this.fillLast=Iw,e=4;break;case"base64":this.text=kw,this.end=Bw,e=3;break;default:this.write=xw,this.end=Ow;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Vs.allocUnsafe(e)}ui.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};ui.prototype.end=Rw;ui.prototype.text=Tw;ui.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function Hs(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Sw(t,e,r){var i=e.length-1;if(i<r)return 0;var n=Hs(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=Hs(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=Hs(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Aw(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Iw(t){var e=this.lastTotal-this.lastNeed,r=Aw(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function Tw(t,e){var r=Sw(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function Rw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Cw(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Pw(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function kw(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Bw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function xw(t){return t.toString(this.encoding)}function Ow(t){return t&&t.length?this.write(t):""}});var zs=O((cC,Af)=>{"use strict";_();v();m();var vf=Mt(),{PromisePrototypeThen:Mw,SymbolAsyncIterator:Ef,SymbolIterator:Sf}=ie(),{Buffer:Lw}=(he(),Q(ye)),{ERR_INVALID_ARG_TYPE:qw,ERR_STREAM_NULL_VALUES:Uw}=me().codes;function Nw(t,e,r){let i;if(typeof e=="string"||e instanceof Lw)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[Ef])n=!0,i=e[Ef]();else if(e&&e[Sf])n=!1,i=e[Sf]();else throw new qw("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,u())},o._destroy=function(f,d){Mw(l(f),()=>vf.nextTick(d,f),h=>vf.nextTick(d,h||f))};async function l(f){let d=f!=null,h=typeof i.throw=="function";if(d&&h){let{value:g,done:b}=await i.throw(f);if(await g,b)return}if(typeof i.return=="function"){let{value:g}=await i.return();await g}}async function u(){for(;;){try{let{value:f,done:d}=n?await i.next():i.next();if(d)o.push(null);else{let h=f&&typeof f.then=="function"?await f:f;if(h===null)throw s=!1,new Uw;if(o.push(h))continue;s=!1}}catch(f){o.destroy(f)}break}}return o}Af.exports=Nw});var fi=O((mC,Wf)=>{"use strict";_();v();m();var We=Mt(),{ArrayPrototypeIndexOf:Dw,NumberIsInteger:jw,NumberIsNaN:Fw,NumberParseInt:Ww,ObjectDefineProperties:eo,ObjectKeys:$w,ObjectSetPrototypeOf:Rf,Promise:Cf,SafeSet:Hw,SymbolAsyncDispose:Vw,SymbolAsyncIterator:zw,Symbol:Kw}=ie();Wf.exports=j;j.ReadableState=on;var{EventEmitter:Gw}=(Ot(),Q(xt)),{Stream:qt,prependListener:Qw}=Xi(),{Buffer:Ks}=(he(),Q(ye)),{addAbortSignal:Yw}=li(),Pf=wt(),H=Ie().debuglog("stream",t=>{H=t}),Jw=cf(),Lr=er(),{getHighWaterMark:Xw,getDefaultHighWaterMark:Zw}=ai(),{aggregateTwoErrors:If,codes:{ERR_INVALID_ARG_TYPE:e_,ERR_METHOD_NOT_IMPLEMENTED:t_,ERR_OUT_OF_RANGE:r_,ERR_STREAM_PUSH_AFTER_EOF:i_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:n_},AbortError:s_}=me(),{validateObject:o_}=kr(),rr=Kw("kPaused"),{StringDecoder:kf}=mf(),l_=zs();Rf(j.prototype,qt.prototype);Rf(j,qt);var Gs=()=>{},{errorOrDestroy:Or}=Lr,Mr=1,a_=2,Bf=4,ci=8,xf=16,rn=32,nn=64,Of=128,u_=256,c_=512,f_=1024,Xs=2048,Zs=4096,h_=8192,d_=16384,p_=32768,Mf=65536,g_=1<<17,b_=1<<18;function de(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}eo(on.prototype,{objectMode:de(Mr),ended:de(a_),endEmitted:de(Bf),reading:de(ci),constructed:de(xf),sync:de(rn),needReadable:de(nn),emittedReadable:de(Of),readableListening:de(u_),resumeScheduled:de(c_),errorEmitted:de(f_),emitClose:de(Xs),autoDestroy:de(Zs),destroyed:de(h_),closed:de(d_),closeEmitted:de(p_),multiAwaitDrain:de(Mf),readingMore:de(g_),dataEmitted:de(b_)});function on(t,e,r){typeof r!="boolean"&&(r=e instanceof tt()),this.state=Xs|Zs|xf|rn,t&&t.objectMode&&(this.state|=Mr),r&&t&&t.readableObjectMode&&(this.state|=Mr),this.highWaterMark=t?Xw(this,t,"readableHighWaterMark",r):Zw(!1),this.buffer=new Jw,this.length=0,this.pipes=[],this.flowing=null,this[rr]=null,t&&t.emitClose===!1&&(this.state&=~Xs),t&&t.autoDestroy===!1&&(this.state&=~Zs),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new kf(t.encoding),this.encoding=t.encoding)}function j(t){if(!(this instanceof j))return new j(t);let e=this instanceof tt();this._readableState=new on(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&Yw(t.signal,this)),qt.call(this,t),Lr.construct(this,()=>{this._readableState.needReadable&&sn(this,this._readableState)})}j.prototype.destroy=Lr.destroy;j.prototype._undestroy=Lr.undestroy;j.prototype._destroy=function(t,e){e(t)};j.prototype[Gw.captureRejectionSymbol]=function(t){this.destroy(t)};j.prototype[Vw]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new s_,this.destroy(t)),new Cf((e,r)=>Pf(this,i=>i&&i!==t?r(i):e(null)))};j.prototype.push=function(t,e){return Lf(this,t,e,!1)};j.prototype.unshift=function(t,e){return Lf(this,t,e,!0)};function Lf(t,e,r,i){H("readableAddChunk",e);let n=t._readableState,o;if((n.state&Mr)===0&&(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=Ks.from(e,r).toString(n.encoding):(e=Ks.from(e,r),r=""))):e instanceof Ks?r="":qt._isUint8Array(e)?(e=qt._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new e_("chunk",["string","Buffer","Uint8Array"],e))),o)Or(t,o);else if(e===null)n.state&=~ci,__(t,n);else if((n.state&Mr)!==0||e&&e.length>0)if(i)if((n.state&Bf)!==0)Or(t,new n_);else{if(n.destroyed||n.errored)return!1;Qs(t,n,e,!0)}else if(n.ended)Or(t,new i_);else{if(n.destroyed||n.errored)return!1;n.state&=~ci,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Qs(t,n,e,!1):sn(t,n)):Qs(t,n,e,!1)}else i||(n.state&=~ci,sn(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}function Qs(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&Mf)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),(e.state&nn)!==0&&ln(t)),sn(t,e)}j.prototype.isPaused=function(){let t=this._readableState;return t[rr]===!0||t.flowing===!1};j.prototype.setEncoding=function(t){let e=new kf(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var y_=1073741824;function w_(t){if(t>y_)throw new r_("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Tf(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Mr)!==0?1:Fw(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}j.prototype.read=function(t){H("read",t),t===void 0?t=NaN:jw(t)||(t=Ww(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=w_(t)),t!==0&&(e.state&=~Of),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return H("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Ys(this):ln(this),null;if(t=Tf(t,e),t===0&&e.ended)return e.length===0&&Ys(this),null;let i=(e.state&nn)!==0;if(H("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,H("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,H("reading, ended or constructing",i);else if(i){H("do read"),e.state|=ci|rn,e.length===0&&(e.state|=nn);try{this._read(e.highWaterMark)}catch(o){Or(this,o)}e.state&=~rn,e.reading||(t=Tf(r,e))}let n;return t>0?n=jf(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Ys(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function __(t,e){if(H("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?ln(t):(e.needReadable=!1,e.emittedReadable=!0,qf(t))}}function ln(t){let e=t._readableState;H("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(H("emitReadable",e.flowing),e.emittedReadable=!0,We.nextTick(qf,t))}function qf(t){let e=t._readableState;H("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Nf(t)}function sn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,We.nextTick(m_,t,e))}function m_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(H("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}j.prototype._read=function(t){throw new t_("_read()")};j.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new Hw(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),H("pipe count=%d opts=%j",i.pipes.length,e);let o=(!e||e.end!==!1)&&t!==We.stdout&&t!==We.stderr?l:S;i.endEmitted?We.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(I,C){H("onunpipe"),I===r&&C&&C.hasUnpiped===!1&&(C.hasUnpiped=!0,d())}function l(){H("onend"),t.end()}let u,f=!1;function d(){H("cleanup"),t.removeListener("close",E),t.removeListener("finish",w),u&&t.removeListener("drain",u),t.removeListener("error",b),t.removeListener("unpipe",s),r.removeListener("end",l),r.removeListener("end",S),r.removeListener("data",g),f=!0,u&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}function h(){f||(i.pipes.length===1&&i.pipes[0]===t?(H("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(H("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),u||(u=v_(r,t),t.on("drain",u))}r.on("data",g);function g(I){H("ondata");let C=t.write(I);H("dest.write",C),C===!1&&h()}function b(I){if(H("onerror",I),S(),t.removeListener("error",b),t.listenerCount("error")===0){let C=t._writableState||t._readableState;C&&!C.errorEmitted?Or(t,I):t.emit("error",I)}}Qw(t,"error",b);function E(){t.removeListener("finish",w),S()}t.once("close",E);function w(){H("onfinish"),t.removeListener("close",E),S()}t.once("finish",w);function S(){H("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?h():i.flowing||(H("pipe resume"),r.resume()),t};function v_(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(H("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(H("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}j.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let o=0;o<n.length;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}let i=Dw(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};j.prototype.on=function(t,e){let r=qt.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,H("on readable",i.length,i.reading),i.length?ln(this):i.reading||We.nextTick(E_,this)),r};j.prototype.addListener=j.prototype.on;j.prototype.removeListener=function(t,e){let r=qt.prototype.removeListener.call(this,t,e);return t==="readable"&&We.nextTick(Uf,this),r};j.prototype.off=j.prototype.removeListener;j.prototype.removeAllListeners=function(t){let e=qt.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&We.nextTick(Uf,this),e};function Uf(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[rr]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function E_(t){H("readable nexttick read 0"),t.read(0)}j.prototype.resume=function(){let t=this._readableState;return t.flowing||(H("resume"),t.flowing=!t.readableListening,S_(this,t)),t[rr]=!1,this};function S_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,We.nextTick(A_,t,e))}function A_(t,e){H("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Nf(t),e.flowing&&!e.reading&&t.read(0)}j.prototype.pause=function(){return H("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(H("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[rr]=!0,this};function Nf(t){let e=t._readableState;for(H("flow",e.flowing);e.flowing&&t.read()!==null;);}j.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{Or(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=$w(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};j.prototype[zw]=function(){return Df(this)};j.prototype.iterator=function(t){return t!==void 0&&o_(t,"options"),Df(this,t)};function Df(t,e){typeof t.read!="function"&&(t=j.wrap(t,{objectMode:!0}));let r=I_(t,e);return r.stream=t,r}async function*I_(t,e){let r=Gs;function i(s){this===t?(r(),r=Gs):r=s}t.on("readable",i);let n,o=Pf(t,{writable:!1},s=>{n=s?If(n,s):null,r(),r=Gs});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(n)throw n;if(n===null)return;await new Cf(i)}}}catch(s){throw n=If(n,s),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?Lr.destroyer(t,null):(t.off("readable",i),o())}}eo(j.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},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(t){this._readableState&&(this._readableState.flowing=t)}},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(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});eo(on.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[rr]!==!1},set(t){this[rr]=!!t}}});j._fromList=jf;function jf(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Ys(t){let e=t._readableState;H("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,We.nextTick(T_,e,t))}function T_(t,e){if(H("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)We.nextTick(R_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function R_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}j.from=function(t,e){return l_(j,t,e)};var Js;function Ff(){return Js===void 0&&(Js={}),Js}j.fromWeb=function(t,e){return Ff().newStreamReadableFromReadableStream(t,e)};j.toWeb=function(t,e){return Ff().newReadableStreamFromStreamReadable(t,e)};j.wrap=function(t,e){var r,i;return new j({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,o){Lr.destroyer(t,n),o(n)}}).wrap(t)}});var hn=O((kC,eh)=>{"use strict";_();v();m();var ir=Mt(),{ArrayPrototypeSlice:Vf,Error:C_,FunctionPrototypeSymbolHasInstance:zf,ObjectDefineProperty:Kf,ObjectDefineProperties:P_,ObjectSetPrototypeOf:Gf,StringPrototypeToLowerCase:k_,Symbol:B_,SymbolHasInstance:x_}=ie();eh.exports=se;se.WritableState=pi;var{EventEmitter:O_}=(Ot(),Q(xt)),hi=Xi().Stream,{Buffer:an}=(he(),Q(ye)),fn=er(),{addAbortSignal:M_}=li(),{getHighWaterMark:L_,getDefaultHighWaterMark:q_}=ai(),{ERR_INVALID_ARG_TYPE:U_,ERR_METHOD_NOT_IMPLEMENTED:N_,ERR_MULTIPLE_CALLBACK:Qf,ERR_STREAM_CANNOT_PIPE:D_,ERR_STREAM_DESTROYED:di,ERR_STREAM_ALREADY_FINISHED:j_,ERR_STREAM_NULL_VALUES:F_,ERR_STREAM_WRITE_AFTER_END:W_,ERR_UNKNOWN_ENCODING:Yf}=me().codes,{errorOrDestroy:qr}=fn;Gf(se.prototype,hi.prototype);Gf(se,hi);function io(){}var Ur=B_("kOnFinished");function pi(t,e,r){typeof r!="boolean"&&(r=e instanceof tt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?L_(this,t,"writableHighWaterMark",r):q_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=H_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,cn(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Ur]=[]}function cn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}pi.prototype.getBuffer=function(){return Vf(this.buffered,this.bufferedIndex)};Kf(pi.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function se(t){let e=this instanceof tt();if(!e&&!zf(se,this))return new se(t);this._writableState=new pi(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&M_(t.signal,this)),hi.call(this,t),fn.construct(this,()=>{let r=this._writableState;r.writing||so(this,r),oo(this,r)})}Kf(se,x_,{__proto__:null,value:function(t){return zf(this,t)?!0:this!==se?!1:t&&t._writableState instanceof pi}});se.prototype.pipe=function(){qr(this,new D_)};function Jf(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!an.isEncoding(r))throw new Yf(r);typeof i!="function"&&(i=io)}if(e===null)throw new F_;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=an.from(e,r),r="buffer");else if(e instanceof an)r="buffer";else if(hi._isUint8Array(e))e=hi._uint8ArrayToBuffer(e),r="buffer";else throw new U_("chunk",["string","Buffer","Uint8Array"],e);let o;return n.ending?o=new W_:n.destroyed&&(o=new di("write")),o?(ir.nextTick(i,o),qr(t,o,!0),o):(n.pendingcb++,$_(t,n,e,r,i))}se.prototype.write=function(t,e,r){return Jf(this,t,e,r)===!0};se.prototype.cork=function(){this._writableState.corked++};se.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||so(this,t))};se.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=k_(e)),!an.isEncoding(e))throw new Yf(e);return this._writableState.defaultEncoding=e,this};function $_(t,e,r,i,n){let o=e.objectMode?1:r.length;e.length+=o;let s=e.length<e.highWaterMark;return s||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==io&&(e.allNoop=!1)):(e.writelen=o,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),s&&!e.errored&&!e.destroyed}function $f(t,e,r,i,n,o,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new di("write")):r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function Hf(t,e,r,i){--e.pendingcb,i(r),no(e),qr(t,r)}function H_(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){qr(t,new Qf);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?ir.nextTick(Hf,t,r,e,n):Hf(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&so(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},ir.nextTick(V_,r.afterWriteTickInfo)):Xf(t,r,1,n))}function V_({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,Xf(t,e,r,i)}function Xf(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&no(e),oo(t,e)}function no(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:o,callback:s}=t.buffered[n],l=t.objectMode?1:o.length;t.length-=l,s((e=t.errored)!==null&&e!==void 0?e:new di("write"))}let r=t[Ur].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new di("end"))}cn(t)}function so(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,o=r.length-i;if(!o)return;let s=i;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let l=e.allNoop?io:f=>{for(let d=s;d<r.length;++d)r[d].callback(f)},u=e.allNoop&&s===0?r:Vf(r,s);u.allBuffers=e.allBuffers,$f(t,e,!0,e.length,u,"",l),cn(e)}else{do{let{chunk:l,encoding:u,callback:f}=r[s];r[s++]=null;let d=n?1:l.length;$f(t,e,!1,d,l,u,f)}while(s<r.length&&!e.writing);s===r.length?cn(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}se.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new N_("_write()")};se.prototype._writev=null;se.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let o=Jf(this,t,e);o instanceof C_&&(n=o)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,oo(this,i,!0),i.ended=!0):i.finished?n=new j_("end"):i.destroyed&&(n=new di("end"))),typeof r=="function"&&(n||i.finished?ir.nextTick(r,n):i[Ur].push(r)),this};function un(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function z_(t,e){let r=!1;function i(n){if(r){qr(t,n??Qf());return}if(r=!0,e.pendingcb--,n){let o=e[Ur].splice(0);for(let s=0;s<o.length;s++)o[s](n);qr(t,n,e.sync)}else un(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,ir.nextTick(ro,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function K_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,z_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function oo(t,e,r){un(e)&&(K_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,ir.nextTick((i,n)=>{un(n)?ro(i,n):n.pendingcb--},t,e)):un(e)&&(e.pendingcb++,ro(t,e))))}function ro(t,e){e.pendingcb--,e.finished=!0;let r=e[Ur].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy()}}P_(se.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var G_=fn.destroy;se.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Ur].length)&&ir.nextTick(no,r),G_.call(this,t,e),this};se.prototype._undestroy=fn.undestroy;se.prototype._destroy=function(t,e){e(t)};se.prototype[O_.captureRejectionSymbol]=function(t){this.destroy(t)};var to;function Zf(){return to===void 0&&(to={}),to}se.fromWeb=function(t,e){return Zf().newStreamWritableFromWritableStream(t,e)};se.toWeb=function(t){return Zf().newWritableStreamFromStreamWritable(t)}});var gh=O((jC,ph)=>{_();v();m();var lo=Mt(),Q_=(he(),Q(ye)),{isReadable:Y_,isWritable:J_,isIterable:th,isNodeStream:X_,isReadableNodeStream:rh,isWritableNodeStream:ih,isDuplexNodeStream:Z_,isReadableStream:nh,isWritableStream:sh}=Xe(),oh=wt(),{AbortError:hh,codes:{ERR_INVALID_ARG_TYPE:em,ERR_INVALID_RETURN_VALUE:lh}}=me(),{destroyer:Dr}=er(),tm=tt(),dh=fi(),rm=hn(),{createDeferredPromise:ah}=Ie(),uh=zs(),ch=globalThis.Blob||Q_.Blob,im=typeof ch<"u"?function(e){return e instanceof ch}:function(e){return!1},nm=globalThis.AbortController||Rr().AbortController,{FunctionPrototypeCall:fh}=ie(),Ut=class extends tm{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};ph.exports=function t(e,r){if(Z_(e))return e;if(rh(e))return Nr({readable:e});if(ih(e))return Nr({writable:e});if(X_(e))return Nr({writable:!1,readable:!1});if(nh(e))return Nr({readable:dh.fromWeb(e)});if(sh(e))return Nr({writable:rm.fromWeb(e)});if(typeof e=="function"){let{value:n,write:o,final:s,destroy:l}=sm(e);if(th(n))return uh(Ut,n,{objectMode:!0,write:o,final:s,destroy:l});let u=n?.then;if(typeof u=="function"){let f,d=fh(u,n,h=>{if(h!=null)throw new lh("nully","body",h)},h=>{Dr(f,h)});return f=new Ut({objectMode:!0,readable:!1,write:o,final(h){s(async()=>{try{await d,lo.nextTick(h,null)}catch(g){lo.nextTick(h,g)}})},destroy:l})}throw new lh("Iterable, AsyncIterable or AsyncFunction",r,n)}if(im(e))return t(e.arrayBuffer());if(th(e))return uh(Ut,e,{objectMode:!0,writable:!1});if(nh(e?.readable)&&sh(e?.writable))return Ut.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?rh(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?ih(e?.writable)?e?.writable:t(e.writable):void 0;return Nr({readable:n,writable:o})}let i=e?.then;if(typeof i=="function"){let n;return fh(i,e,o=>{o!=null&&n.push(o),n.push(null)},o=>{Dr(n,o)}),n=new Ut({objectMode:!0,writable:!1,read(){}})}throw new em(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function sm(t){let{promise:e,resolve:r}=ah(),i=new nm,n=i.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:l,done:u,cb:f}=await s;if(lo.nextTick(f),u)return;if(n.aborted)throw new hh(void 0,{cause:n.reason});({promise:e,resolve:r}=ah()),yield l}}(),{signal:n}),write(s,l,u){let f=r;r=null,f({chunk:s,done:!1,cb:u})},final(s){let l=r;r=null,l({done:!0,cb:s})},destroy(s,l){i.abort(),l(s)}}}function Nr(t){let e=t.readable&&typeof t.readable.read!="function"?dh.wrap(t.readable):t.readable,r=t.writable,i=!!Y_(e),n=!!J_(r),o,s,l,u,f;function d(h){let g=u;u=null,g?g(h):h&&f.destroy(h)}return f=new Ut({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(oh(r,h=>{n=!1,h&&Dr(e,h),d(h)}),f._write=function(h,g,b){r.write(h,g)?b():o=b},f._final=function(h){r.end(),s=h},r.on("drain",function(){if(o){let h=o;o=null,h()}}),r.on("finish",function(){if(s){let h=s;s=null,h()}})),i&&(oh(e,h=>{i=!1,h&&Dr(e,h),d(h)}),e.on("readable",function(){if(l){let h=l;l=null,h()}}),e.on("end",function(){f.push(null)}),f._read=function(){for(;;){let h=e.read();if(h===null){l=f._read;return}if(!f.push(h))return}}),f._destroy=function(h,g){!h&&u!==null&&(h=new hh),l=null,o=null,s=null,u===null?g(h):(u=g,Dr(r,h),Dr(e,h))},f}});var tt=O((YC,wh)=>{"use strict";_();v();m();var{ObjectDefineProperties:om,ObjectGetOwnPropertyDescriptor:_t,ObjectKeys:lm,ObjectSetPrototypeOf:bh}=ie();wh.exports=$e;var co=fi(),Le=hn();bh($e.prototype,co.prototype);bh($e,co);{let t=lm(Le.prototype);for(let e=0;e<t.length;e++){let r=t[e];$e.prototype[r]||($e.prototype[r]=Le.prototype[r])}}function $e(t){if(!(this instanceof $e))return new $e(t);co.call(this,t),Le.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}om($e.prototype,{writable:{__proto__:null,..._t(Le.prototype,"writable")},writableHighWaterMark:{__proto__:null,..._t(Le.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,..._t(Le.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,..._t(Le.prototype,"writableBuffer")},writableLength:{__proto__:null,..._t(Le.prototype,"writableLength")},writableFinished:{__proto__:null,..._t(Le.prototype,"writableFinished")},writableCorked:{__proto__:null,..._t(Le.prototype,"writableCorked")},writableEnded:{__proto__:null,..._t(Le.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,..._t(Le.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var ao;function yh(){return ao===void 0&&(ao={}),ao}$e.fromWeb=function(t,e){return yh().newStreamDuplexFromReadableWritablePair(t,e)};$e.toWeb=function(t){return yh().newReadableWritablePairFromDuplex(t)};var uo;$e.from=function(t){return uo||(uo=gh()),uo(t,"body")}});var po=O((oP,mh)=>{"use strict";_();v();m();var{ObjectSetPrototypeOf:_h,Symbol:am}=ie();mh.exports=mt;var{ERR_METHOD_NOT_IMPLEMENTED:um}=me().codes,ho=tt(),{getHighWaterMark:cm}=ai();_h(mt.prototype,ho.prototype);_h(mt,ho);var gi=am("kCallback");function mt(t){if(!(this instanceof mt))return new mt(t);let e=t?cm(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),ho.call(this,t),this._readableState.sync=!1,this[gi]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",fm)}function fo(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function fm(){this._final!==fo&&fo.call(this)}mt.prototype._final=fo;mt.prototype._transform=function(t,e,r){throw new um("_transform()")};mt.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,o=i.length;this._transform(t,e,(s,l)=>{if(s){r(s);return}l!=null&&this.push(l),n.ended||o===i.length||i.length<i.highWaterMark?r():this[gi]=r})};mt.prototype._read=function(){if(this[gi]){let t=this[gi];this[gi]=null,t()}}});var bo=O((bP,Eh)=>{"use strict";_();v();m();var{ObjectSetPrototypeOf:vh}=ie();Eh.exports=jr;var go=po();vh(jr.prototype,go.prototype);vh(jr,go);function jr(t){if(!(this instanceof jr))return new jr(t);go.call(this,t)}jr.prototype._transform=function(t,e,r){r(null,t)}});var bn=O((TP,Rh)=>{_();v();m();var bi=Mt(),{ArrayIsArray:hm,Promise:dm,SymbolAsyncIterator:pm,SymbolDispose:gm}=ie(),gn=wt(),{once:bm}=Ie(),ym=er(),Sh=tt(),{aggregateTwoErrors:wm,codes:{ERR_INVALID_ARG_TYPE:Io,ERR_INVALID_RETURN_VALUE:yo,ERR_MISSING_ARGS:_m,ERR_STREAM_DESTROYED:mm,ERR_STREAM_PREMATURE_CLOSE:vm},AbortError:Em}=me(),{validateFunction:Sm,validateAbortSignal:Am}=kr(),{isIterable:nr,isReadable:wo,isReadableNodeStream:pn,isNodeStream:Ah,isTransformStream:Fr,isWebStream:Im,isReadableStream:_o,isReadableFinished:Tm}=Xe(),Rm=globalThis.AbortController||Rr().AbortController,mo,vo,Eo;function Ih(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=gn(t,{readable:e,writable:r},o=>{i=!o});return{destroy:o=>{i||(i=!0,ym.destroyer(t,o||new mm("pipe")))},cleanup:n}}function Cm(t){return Sm(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function So(t){if(nr(t))return t;if(pn(t))return Pm(t);throw new Io("val",["Readable","Iterable","AsyncIterable"],t)}async function*Pm(t){vo||(vo=fi()),yield*vo.prototype[pm].call(t)}async function dn(t,e,r,{end:i}){let n,o=null,s=f=>{if(f&&(n=f),o){let d=o;o=null,d()}},l=()=>new dm((f,d)=>{n?d(n):o=()=>{n?d(n):f()}});e.on("drain",s);let u=gn(e,{readable:!1},s);try{e.writableNeedDrain&&await l();for await(let f of t)e.write(f)||await l();i&&(e.end(),await l()),r()}catch(f){r(n!==f?wm(n,f):f)}finally{u(),e.off("drain",s)}}async function Ao(t,e,r,{end:i}){Fr(e)&&(e=e.writable);let n=e.getWriter();try{for await(let o of t)await n.ready,n.write(o).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(o){try{await n.abort(o),r(o)}catch(s){r(s)}}}function km(...t){return Th(t,bm(Cm(t)))}function Th(t,e,r){if(t.length===1&&hm(t[0])&&(t=t[0]),t.length<2)throw new _m("streams");let i=new Rm,n=i.signal,o=r?.signal,s=[];Am(o,"options.signal");function l(){E(new Em)}Eo=Eo||Ie().addAbortListener;let u;o&&(u=Eo(o,l));let f,d,h=[],g=0;function b(k){E(k,--g===0)}function E(k,M){var q;if(k&&(!f||f.code==="ERR_STREAM_PREMATURE_CLOSE")&&(f=k),!(!f&&!M)){for(;h.length;)h.shift()(f);(q=u)===null||q===void 0||q[gm](),i.abort(),M&&(f||s.forEach(G=>G()),bi.nextTick(e,f,d))}}let w;for(let k=0;k<t.length;k++){let M=t[k],q=k<t.length-1,G=k>0,F=q||r?.end!==!1,K=k===t.length-1;if(Ah(M)){let $=function(te){te&&te.name!=="AbortError"&&te.code!=="ERR_STREAM_PREMATURE_CLOSE"&&b(te)};var C=$;if(F){let{destroy:te,cleanup:dt}=Ih(M,q,G);h.push(te),wo(M)&&K&&s.push(dt)}M.on("error",$),wo(M)&&K&&s.push(()=>{M.removeListener("error",$)})}if(k===0)if(typeof M=="function"){if(w=M({signal:n}),!nr(w))throw new yo("Iterable, AsyncIterable or Stream","source",w)}else nr(M)||pn(M)||Fr(M)?w=M:w=Sh.from(M);else if(typeof M=="function"){if(Fr(w)){var S;w=So((S=w)===null||S===void 0?void 0:S.readable)}else w=So(w);if(w=M(w,{signal:n}),q){if(!nr(w,!0))throw new yo("AsyncIterable",`transform[${k-1}]`,w)}else{var I;mo||(mo=bo());let $=new mo({objectMode:!0}),te=(I=w)===null||I===void 0?void 0:I.then;if(typeof te=="function")g++,te.call(w,Se=>{d=Se,Se!=null&&$.write(Se),F&&$.end(),bi.nextTick(b)},Se=>{$.destroy(Se),bi.nextTick(b,Se)});else if(nr(w,!0))g++,dn(w,$,b,{end:F});else if(_o(w)||Fr(w)){let Se=w.readable||w;g++,dn(Se,$,b,{end:F})}else throw new yo("AsyncIterable or Promise","destination",w);w=$;let{destroy:dt,cleanup:Fe}=Ih(w,!1,!0);h.push(dt),K&&s.push(Fe)}}else if(Ah(M)){if(pn(w)){g+=2;let $=Bm(w,M,b,{end:F});wo(M)&&K&&s.push($)}else if(Fr(w)||_o(w)){let $=w.readable||w;g++,dn($,M,b,{end:F})}else if(nr(w))g++,dn(w,M,b,{end:F});else throw new Io("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=M}else if(Im(M)){if(pn(w))g++,Ao(So(w),M,b,{end:F});else if(_o(w)||nr(w))g++,Ao(w,M,b,{end:F});else if(Fr(w))g++,Ao(w.readable,M,b,{end:F});else throw new Io("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=M}else w=Sh.from(M)}return(n!=null&&n.aborted||o!=null&&o.aborted)&&bi.nextTick(l),w}function Bm(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new vm)}),t.pipe(e,{end:!1}),i){let s=function(){n=!0,e.end()};var o=s;Tm(t)?bi.nextTick(s):t.once("end",s)}else r();return gn(t,{readable:!0,writable:!1},s=>{let l=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&l&&l.ended&&!l.errored&&!l.errorEmitted?t.once("end",r).once("error",r):r(s)}),gn(e,{readable:!1,writable:!0},r)}Rh.exports={pipelineImpl:Th,pipeline:km}});var Ro=O((qP,Oh)=>{"use strict";_();v();m();var{pipeline:xm}=bn(),yn=tt(),{destroyer:Om}=er(),{isNodeStream:wn,isReadable:Ch,isWritable:Ph,isWebStream:To,isTransformStream:sr,isWritableStream:kh,isReadableStream:Bh}=Xe(),{AbortError:Mm,codes:{ERR_INVALID_ARG_VALUE:xh,ERR_MISSING_ARGS:Lm}}=me(),qm=wt();Oh.exports=function(...e){if(e.length===0)throw new Lm("streams");if(e.length===1)return yn.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=yn.from(e[0])),typeof e[e.length-1]=="function"){let b=e.length-1;e[b]=yn.from(e[b])}for(let b=0;b<e.length;++b)if(!(!wn(e[b])&&!To(e[b]))){if(b<e.length-1&&!(Ch(e[b])||Bh(e[b])||sr(e[b])))throw new xh(`streams[${b}]`,r[b],"must be readable");if(b>0&&!(Ph(e[b])||kh(e[b])||sr(e[b])))throw new xh(`streams[${b}]`,r[b],"must be writable")}let i,n,o,s,l;function u(b){let E=s;s=null,E?E(b):b?l.destroy(b):!g&&!h&&l.destroy()}let f=e[0],d=xm(e,u),h=!!(Ph(f)||kh(f)||sr(f)),g=!!(Ch(d)||Bh(d)||sr(d));if(l=new yn({writableObjectMode:!!(f!=null&&f.writableObjectMode),readableObjectMode:!!(d!=null&&d.readableObjectMode),writable:h,readable:g}),h){if(wn(f))l._write=function(E,w,S){f.write(E,w)?S():i=S},l._final=function(E){f.end(),n=E},f.on("drain",function(){if(i){let E=i;i=null,E()}});else if(To(f)){let w=(sr(f)?f.writable:f).getWriter();l._write=async function(S,I,C){try{await w.ready,w.write(S).catch(()=>{}),C()}catch(k){C(k)}},l._final=async function(S){try{await w.ready,w.close().catch(()=>{}),n=S}catch(I){S(I)}}}let b=sr(d)?d.readable:d;qm(b,()=>{if(n){let E=n;n=null,E()}})}if(g){if(wn(d))d.on("readable",function(){if(o){let b=o;o=null,b()}}),d.on("end",function(){l.push(null)}),l._read=function(){for(;;){let b=d.read();if(b===null){o=l._read;return}if(!l.push(b))return}};else if(To(d)){let E=(sr(d)?d.readable:d).getReader();l._read=async function(){for(;;)try{let{value:w,done:S}=await E.read();if(!l.push(w))return;if(S){l.push(null);return}}catch{return}}}}return l._destroy=function(b,E){!b&&s!==null&&(b=new Mm),o=null,i=null,n=null,s===null?E(b):(s=E,wn(d)&&Om(d,b))},l}});var $h=O((zP,ko)=>{"use strict";_();v();m();var Um=globalThis.AbortController||Rr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Nm,ERR_INVALID_ARG_TYPE:yi,ERR_MISSING_ARGS:Dm,ERR_OUT_OF_RANGE:jm},AbortError:rt}=me(),{validateAbortSignal:or,validateInteger:Mh,validateObject:lr}=kr(),Fm=ie().Symbol("kWeak"),Wm=ie().Symbol("kResistStopPropagation"),{finished:$m}=wt(),Hm=Ro(),{addAbortSignalNoValidate:Vm}=li(),{isWritable:zm,isNodeStream:Km}=Xe(),{deprecate:Gm}=Ie(),{ArrayPrototypePush:Qm,Boolean:Ym,MathFloor:Lh,Number:Jm,NumberIsNaN:Xm,Promise:qh,PromiseReject:Uh,PromiseResolve:Zm,PromisePrototypeThen:Nh,Symbol:jh}=ie(),_n=jh("kEmpty"),Dh=jh("kEof");function e0(t,e){if(e!=null&&lr(e,"options"),e?.signal!=null&&or(e.signal,"options.signal"),Km(t)&&!zm(t))throw new Nm("stream",t,"must be writable");let r=Hm(this,t);return e!=null&&e.signal&&Vm(e.signal,r),r}function mn(t,e){if(typeof t!="function")throw new yi("fn",["Function","AsyncFunction"],t);e!=null&&lr(e,"options"),e?.signal!=null&&or(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Lh(e.concurrency));let i=r-1;return e?.highWaterMark!=null&&(i=Lh(e.highWaterMark)),Mh(r,"options.concurrency",1),Mh(i,"options.highWaterMark",0),i+=r,async function*(){let o=Ie().AbortSignalAny([e?.signal].filter(Ym)),s=this,l=[],u={signal:o},f,d,h=!1,g=0;function b(){h=!0,E()}function E(){g-=1,w()}function w(){d&&!h&&g<r&&l.length<i&&(d(),d=null)}async function S(){try{for await(let I of s){if(h)return;if(o.aborted)throw new rt;try{if(I=t(I,u),I===_n)continue;I=Zm(I)}catch(C){I=Uh(C)}g+=1,Nh(I,E,b),l.push(I),f&&(f(),f=null),!h&&(l.length>=i||g>=r)&&await new qh(C=>{d=C})}l.push(Dh)}catch(I){let C=Uh(I);Nh(C,E,b),l.push(C)}finally{h=!0,f&&(f(),f=null)}}S();try{for(;;){for(;l.length>0;){let I=await l[0];if(I===Dh)return;if(o.aborted)throw new rt;I!==_n&&(yield I),l.shift(),w()}await new qh(I=>{f=I})}}finally{h=!0,d&&(d(),d=null)}}.call(this)}function t0(t=void 0){return t!=null&&lr(t,"options"),t?.signal!=null&&or(t.signal,"options.signal"),async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new rt({cause:t.signal.reason});yield[r++,n]}}.call(this)}async function Fh(t,e=void 0){for await(let r of Po.call(this,t,e))return!0;return!1}async function r0(t,e=void 0){if(typeof t!="function")throw new yi("fn",["Function","AsyncFunction"],t);return!await Fh.call(this,async(...r)=>!await t(...r),e)}async function i0(t,e){for await(let r of Po.call(this,t,e))return r}async function n0(t,e){if(typeof t!="function")throw new yi("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),_n}for await(let i of mn.call(this,r,e));}function Po(t,e){if(typeof t!="function")throw new yi("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:_n}return mn.call(this,r,e)}var Co=class extends Dm{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function s0(t,e,r){var i;if(typeof t!="function")throw new yi("reducer",["Function","AsyncFunction"],t);r!=null&&lr(r,"options"),r?.signal!=null&&or(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let f=new rt(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await $m(this.destroy(f)),f}let o=new Um,s=o.signal;if(r!=null&&r.signal){let f={once:!0,[Fm]:this,[Wm]:!0};r.signal.addEventListener("abort",()=>o.abort(),f)}let l=!1;try{for await(let f of this){var u;if(l=!0,r!=null&&(u=r.signal)!==null&&u!==void 0&&u.aborted)throw new rt;n?e=await t(e,f,{signal:s}):(e=f,n=!0)}if(!l&&!n)throw new Co}finally{o.abort()}return e}async function o0(t){t!=null&&lr(t,"options"),t?.signal!=null&&or(t.signal,"options.signal");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new rt(void 0,{cause:t.signal.reason});Qm(e,i)}return e}function l0(t,e){let r=mn.call(this,t,e);return async function*(){for await(let n of r)yield*n}.call(this)}function Wh(t){if(t=Jm(t),Xm(t))return 0;if(t<0)throw new jm("number",">= 0",t);return t}function a0(t,e=void 0){return e!=null&&lr(e,"options"),e?.signal!=null&&or(e.signal,"options.signal"),t=Wh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new rt;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new rt;t--<=0&&(yield o)}}.call(this)}function u0(t,e=void 0){return e!=null&&lr(e,"options"),e?.signal!=null&&or(e.signal,"options.signal"),t=Wh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new rt;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new rt;if(t-- >0&&(yield o),t<=0)return}}.call(this)}ko.exports.streamReturningOperators={asIndexedPairs:Gm(t0,"readable.asIndexedPairs will be removed in a future version."),drop:a0,filter:Po,flatMap:l0,map:mn,take:u0,compose:e0};ko.exports.promiseReturningOperators={every:r0,forEach:n0,reduce:s0,toArray:o0,some:Fh,find:i0}});var Bo=O((rk,Hh)=>{"use strict";_();v();m();var{ArrayPrototypePop:c0,Promise:f0}=ie(),{isIterable:h0,isNodeStream:d0,isWebStream:p0}=Xe(),{pipelineImpl:g0}=bn(),{finished:b0}=wt();xo();function y0(...t){return new f0((e,r)=>{let i,n,o=t[t.length-1];if(o&&typeof o=="object"&&!d0(o)&&!h0(o)&&!p0(o)){let s=c0(t);i=s.signal,n=s.end}g0(t,(s,l)=>{s?r(s):e(l)},{signal:i,end:n})})}Hh.exports={finished:b0,pipeline:y0}});var xo=O((hk,Zh)=>{"use strict";_();v();m();var{Buffer:w0}=(he(),Q(ye)),{ObjectDefineProperty:vt,ObjectKeys:Kh,ReflectApply:Gh}=ie(),{promisify:{custom:Qh}}=Ie(),{streamReturningOperators:Vh,promiseReturningOperators:zh}=$h(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Yh}}=me(),_0=Ro(),{setDefaultHighWaterMark:m0,getDefaultHighWaterMark:v0}=ai(),{pipeline:Jh}=bn(),{destroyer:E0}=er(),Xh=wt(),Oo=Bo(),wi=Xe(),ee=Zh.exports=Xi().Stream;ee.isDestroyed=wi.isDestroyed;ee.isDisturbed=wi.isDisturbed;ee.isErrored=wi.isErrored;ee.isReadable=wi.isReadable;ee.isWritable=wi.isWritable;ee.Readable=fi();for(let t of Kh(Vh)){let r=function(...i){if(new.target)throw Yh();return ee.Readable.from(Gh(e,this,i))},e=Vh[t];vt(r,"name",{__proto__:null,value:e.name}),vt(r,"length",{__proto__:null,value:e.length}),vt(ee.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Kh(zh)){let r=function(...i){if(new.target)throw Yh();return Gh(e,this,i)},e=zh[t];vt(r,"name",{__proto__:null,value:e.name}),vt(r,"length",{__proto__:null,value:e.length}),vt(ee.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}ee.Writable=hn();ee.Duplex=tt();ee.Transform=po();ee.PassThrough=bo();ee.pipeline=Jh;var{addAbortSignal:S0}=li();ee.addAbortSignal=S0;ee.finished=Xh;ee.destroy=E0;ee.compose=_0;ee.setDefaultHighWaterMark=m0;ee.getDefaultHighWaterMark=v0;vt(ee,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Oo}});vt(Jh,Qh,{__proto__:null,enumerable:!0,get(){return Oo.pipeline}});vt(Xh,Qh,{__proto__:null,enumerable:!0,get(){return Oo.finished}});ee.Stream=ee;ee._isUint8Array=function(e){return e instanceof Uint8Array};ee._uint8ArrayToBuffer=function(e){return w0.from(e.buffer,e.byteOffset,e.byteLength)}});var Nt=O((Ek,ce)=>{"use strict";_();v();m();var pe=xo(),A0=Bo(),I0=pe.Readable.destroy;ce.exports=pe.Readable;ce.exports._uint8ArrayToBuffer=pe._uint8ArrayToBuffer;ce.exports._isUint8Array=pe._isUint8Array;ce.exports.isDisturbed=pe.isDisturbed;ce.exports.isErrored=pe.isErrored;ce.exports.isReadable=pe.isReadable;ce.exports.Readable=pe.Readable;ce.exports.Writable=pe.Writable;ce.exports.Duplex=pe.Duplex;ce.exports.Transform=pe.Transform;ce.exports.PassThrough=pe.PassThrough;ce.exports.addAbortSignal=pe.addAbortSignal;ce.exports.finished=pe.finished;ce.exports.destroy=pe.destroy;ce.exports.destroy=I0;ce.exports.pipeline=pe.pipeline;ce.exports.compose=pe.compose;Object.defineProperty(pe,"promises",{configurable:!0,enumerable:!0,get(){return A0}});ce.exports.Stream=pe.Stream;ce.exports.default=ce.exports});var ed=O((xk,Mo)=>{_();v();m();typeof Object.create=="function"?Mo.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Mo.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var id=O((Wk,rd)=>{"use strict";_();v();m();var{Buffer:He}=(he(),Q(ye)),td=Symbol.for("BufferList");function Z(t){if(!(this instanceof Z))return new Z(t);Z._init.call(this,t)}Z._init=function(e){Object.defineProperty(this,td,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};Z.prototype._new=function(e){return new Z(e)};Z.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let i=0;i<this._bufs.length;i++){let n=r+this._bufs[i].length;if(e<n||i===this._bufs.length-1)return[i,e-r];r=n}};Z.prototype._reverseOffset=function(t){let e=t[0],r=t[1];for(let i=0;i<e;i++)r+=this._bufs[i].length;return r};Z.prototype.get=function(e){if(e>this.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};Z.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};Z.prototype.copy=function(e,r,i,n){if((typeof i!="number"||i<0)&&(i=0),(typeof n!="number"||n>this.length)&&(n=this.length),i>=this.length||n<=0)return e||He.alloc(0);let o=!!e,s=this._offset(i),l=n-i,u=l,f=o&&r||0,d=s[1];if(i===0&&n===this.length){if(!o)return this._bufs.length===1?this._bufs[0]:He.concat(this._bufs,this.length);for(let h=0;h<this._bufs.length;h++)this._bufs[h].copy(e,f),f+=this._bufs[h].length;return e}if(u<=this._bufs[s[0]].length-d)return o?this._bufs[s[0]].copy(e,r,d,d+u):this._bufs[s[0]].slice(d,d+u);o||(e=He.allocUnsafe(l));for(let h=s[0];h<this._bufs.length;h++){let g=this._bufs[h].length-d;if(u>g)this._bufs[h].copy(e,f,d),f+=g;else{this._bufs[h].copy(e,f,d,d+u),f+=g;break}u-=g,d&&(d=0)}return e.length>f?e.slice(0,f):e};Z.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let i=this._offset(e),n=this._offset(r),o=this._bufs.slice(i[0],n[0]+1);return n[1]===0?o.pop():o[o.length-1]=o[o.length-1].slice(0,n[1]),i[1]!==0&&(o[0]=o[0].slice(i[1])),this._new(o)};Z.prototype.toString=function(e,r,i){return this.slice(r,i).toString(e)};Z.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};Z.prototype.duplicate=function(){let e=this._new();for(let r=0;r<this._bufs.length;r++)e.append(this._bufs[r]);return e};Z.prototype.append=function(e){if(e==null)return this;if(e.buffer)this._appendBuffer(He.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let r=0;r<e.length;r++)this.append(e[r]);else if(this._isBufferList(e))for(let r=0;r<e._bufs.length;r++)this.append(e._bufs[r]);else typeof e=="number"&&(e=e.toString()),this._appendBuffer(He.from(e));return this};Z.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length};Z.prototype.indexOf=function(t,e,r){if(r===void 0&&typeof e=="string"&&(r=e,e=void 0),typeof t=="function"||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof t=="number"?t=He.from([t]):typeof t=="string"?t=He.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=He.from(t.buffer,t.byteOffset,t.byteLength):He.isBuffer(t)||(t=He.from(t)),e=Number(e||0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let i=this._offset(e),n=i[0],o=i[1];for(;n<this._bufs.length;n++){let s=this._bufs[n];for(;o<s.length;)if(s.length-o>=t.length){let u=s.indexOf(t,o);if(u!==-1)return this._reverseOffset([n,u]);o=s.length-t.length+1}else{let u=this._reverseOffset([n,o]);if(this._match(u,t))return u;o++}o=0}return-1};Z.prototype._match=function(t,e){if(this.length-t<e.length)return!1;for(let r=0;r<e.length;r++)if(this.get(t+r)!==e[r])return!1;return!0};(function(){let t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readBigInt64BE:8,readBigInt64LE:8,readBigUInt64BE:8,readBigUInt64LE:8,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let e in t)(function(r){t[r]===null?Z.prototype[r]=function(i,n){return this.slice(i,i+n)[r](0,n)}:Z.prototype[r]=function(i=0){return this.slice(i,i+t[r])[r](0)}})(e)})();Z.prototype._isBufferList=function(e){return e instanceof Z||Z.isBufferList(e)};Z.isBufferList=function(e){return e!=null&&e[td]};rd.exports=Z});var nd=O((Xk,vn)=>{"use strict";_();v();m();var Lo=Nt().Duplex,T0=ed(),_i=id();function Ee(t){if(!(this instanceof Ee))return new Ee(t);if(typeof t=="function"){this._callback=t;let e=function(i){this._callback&&(this._callback(i),this._callback=null)}.bind(this);this.on("pipe",function(i){i.on("error",e)}),this.on("unpipe",function(i){i.removeListener("error",e)}),t=null}_i._init.call(this,t),Lo.call(this)}T0(Ee,Lo);Object.assign(Ee.prototype,_i.prototype);Ee.prototype._new=function(e){return new Ee(e)};Ee.prototype._write=function(e,r,i){this._appendBuffer(e),typeof i=="function"&&i()};Ee.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)};Ee.prototype.end=function(e){Lo.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)};Ee.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e)};Ee.prototype._isBufferList=function(e){return e instanceof Ee||e instanceof _i||Ee.isBufferList(e)};Ee.isBufferList=_i.isBufferList;vn.exports=Ee;vn.exports.BufferListStream=Ee;vn.exports.BufferList=_i});var od=O((aB,sd)=>{_();v();m();var qo=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};sd.exports=qo});var Uo=O((wB,ld)=>{_();v();m();var L=ld.exports,{Buffer:ke}=(he(),Q(ye));L.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"};L.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};L.requiredHeaderFlagsErrors={};for(let t in L.requiredHeaderFlags){let e=L.requiredHeaderFlags[t];L.requiredHeaderFlagsErrors[t]="Invalid header flag bits, must be 0x"+e.toString(16)+" for "+L.types[t]+" packet"}L.codes={};for(let t in L.types){let e=L.types[t];L.codes[e]=t}L.CMD_SHIFT=4;L.CMD_MASK=240;L.DUP_MASK=8;L.QOS_MASK=3;L.QOS_SHIFT=1;L.RETAIN_MASK=1;L.VARBYTEINT_MASK=127;L.VARBYTEINT_FIN_MASK=128;L.VARBYTEINT_MAX=268435455;L.SESSIONPRESENT_MASK=1;L.SESSIONPRESENT_HEADER=ke.from([L.SESSIONPRESENT_MASK]);L.CONNACK_HEADER=ke.from([L.codes.connack<<L.CMD_SHIFT]);L.USERNAME_MASK=128;L.PASSWORD_MASK=64;L.WILL_RETAIN_MASK=32;L.WILL_QOS_MASK=24;L.WILL_QOS_SHIFT=3;L.WILL_FLAG_MASK=4;L.CLEAN_SESSION_MASK=2;L.CONNECT_HEADER=ke.from([L.codes.connect<<L.CMD_SHIFT]);L.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11};L.propertiesCodes={};for(let t in L.properties){let e=L.properties[t];L.propertiesCodes[e]=t}L.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"};function Dt(t){return[0,1,2].map(e=>[0,1].map(r=>[0,1].map(i=>{let n=ke.alloc(1);return n.writeUInt8(L.codes[t]<<L.CMD_SHIFT|(r?L.DUP_MASK:0)|e<<L.QOS_SHIFT|i,0,!0),n})))}L.PUBLISH_HEADER=Dt("publish");L.SUBSCRIBE_HEADER=Dt("subscribe");L.SUBSCRIBE_OPTIONS_QOS_MASK=3;L.SUBSCRIBE_OPTIONS_NL_MASK=1;L.SUBSCRIBE_OPTIONS_NL_SHIFT=2;L.SUBSCRIBE_OPTIONS_RAP_MASK=1;L.SUBSCRIBE_OPTIONS_RAP_SHIFT=3;L.SUBSCRIBE_OPTIONS_RH_MASK=3;L.SUBSCRIBE_OPTIONS_RH_SHIFT=4;L.SUBSCRIBE_OPTIONS_RH=[0,16,32];L.SUBSCRIBE_OPTIONS_NL=4;L.SUBSCRIBE_OPTIONS_RAP=8;L.SUBSCRIBE_OPTIONS_QOS=[0,1,2];L.UNSUBSCRIBE_HEADER=Dt("unsubscribe");L.ACKS={unsuback:Dt("unsuback"),puback:Dt("puback"),pubcomp:Dt("pubcomp"),pubrel:Dt("pubrel"),pubrec:Dt("pubrec")};L.SUBACK_HEADER=ke.from([L.codes.suback<<L.CMD_SHIFT]);L.VERSION3=ke.from([3]);L.VERSION4=ke.from([4]);L.VERSION5=ke.from([5]);L.VERSION131=ke.from([131]);L.VERSION132=ke.from([132]);L.QOS=[0,1,2].map(t=>ke.from([t]));L.EMPTY={pingreq:ke.from([L.codes.pingreq<<4,0]),pingresp:ke.from([L.codes.pingresp<<4,0]),disconnect:ke.from([L.codes.disconnect<<4,0])};L.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"};L.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"};L.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"};L.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"};L.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"};L.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}});var ud=O((CB,ad)=>{_();v();m();var Wr=1e3,$r=Wr*60,Hr=$r*60,ar=Hr*24,R0=ar*7,C0=ar*365.25;ad.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return P0(t);if(r==="number"&&isFinite(t))return e.long?B0(t):k0(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function P0(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*C0;case"weeks":case"week":case"w":return r*R0;case"days":case"day":case"d":return r*ar;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Hr;case"minutes":case"minute":case"mins":case"min":case"m":return r*$r;case"seconds":case"second":case"secs":case"sec":case"s":return r*Wr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function k0(t){var e=Math.abs(t);return e>=ar?Math.round(t/ar)+"d":e>=Hr?Math.round(t/Hr)+"h":e>=$r?Math.round(t/$r)+"m":e>=Wr?Math.round(t/Wr)+"s":t+"ms"}function B0(t){var e=Math.abs(t);return e>=ar?En(t,e,ar,"day"):e>=Hr?En(t,e,Hr,"hour"):e>=$r?En(t,e,$r,"minute"):e>=Wr?En(t,e,Wr,"second"):t+" ms"}function En(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var fd=O((NB,cd)=>{_();v();m();function x0(t){r.debug=r,r.default=r,r.coerce=u,r.disable=s,r.enable=n,r.enabled=l,r.humanize=ud(),r.destroy=f,Object.keys(t).forEach(d=>{r[d]=t[d]}),r.names=[],r.skips=[],r.formatters={};function e(d){let h=0;for(let g=0;g<d.length;g++)h=(h<<5)-h+d.charCodeAt(g),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(d){let h,g=null,b,E;function w(...S){if(!w.enabled)return;let I=w,C=Number(new Date),k=C-(h||C);I.diff=k,I.prev=h,I.curr=C,h=C,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let M=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(G,F)=>{if(G==="%%")return"%";M++;let K=r.formatters[F];if(typeof K=="function"){let $=S[M];G=K.call(I,$),S.splice(M,1),M--}return G}),r.formatArgs.call(I,S),(I.log||r.log).apply(I,S)}return w.namespace=d,w.useColors=r.useColors(),w.color=r.selectColor(d),w.extend=i,w.destroy=r.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(b!==r.namespaces&&(b=r.namespaces,E=r.enabled(d)),E),set:S=>{g=S}}),typeof r.init=="function"&&r.init(w),w}function i(d,h){let g=r(this.namespace+(typeof h>"u"?":":h)+d);return g.log=this.log,g}function n(d){r.save(d),r.namespaces=d,r.names=[],r.skips=[];let h=(typeof d=="string"?d:"").trim().replace(" ",",").split(",").filter(Boolean);for(let g of h)g[0]==="-"?r.skips.push(g.slice(1)):r.names.push(g)}function o(d,h){let g=0,b=0,E=-1,w=0;for(;g<d.length;)if(b<h.length&&(h[b]===d[g]||h[b]==="*"))h[b]==="*"?(E=b,w=g,b++):(g++,b++);else if(E!==-1)b=E+1,w++,g=w;else return!1;for(;b<h.length&&h[b]==="*";)b++;return b===h.length}function s(){let d=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),d}function l(d){for(let h of r.skips)if(o(d,h))return!1;for(let h of r.names)if(o(d,h))return!0;return!1}function u(d){return d instanceof Error?d.stack||d.message:d}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}cd.exports=x0});var it=O((Be,Sn)=>{_();v();m();Be.formatArgs=M0;Be.save=L0;Be.load=q0;Be.useColors=O0;Be.storage=U0();Be.destroy=(()=>{let t=!1;return()=>{t||(t=!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`."))}})();Be.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 O0(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return 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 navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function M0(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Sn.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}Be.log=console.debug||console.log||(()=>{});function L0(t){try{t?Be.storage.setItem("debug",t):Be.storage.removeItem("debug")}catch{}}function q0(){let t;try{t=Be.storage.getItem("debug")}catch{}return!t&&typeof R<"u"&&"env"in R&&(t=R.env.DEBUG),t}function U0(){try{return localStorage}catch{}}Sn.exports=fd()(Be);var{formatters:N0}=Sn.exports;N0.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var pd=O((ix,dd)=>{_();v();m();var D0=nd(),{EventEmitter:j0}=(Ot(),Q(xt)),hd=od(),V=Uo(),N=it()("mqtt-packet:parser"),No=class t extends j0{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof t?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new t().parser(e)}_resetState(){N("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new hd,this.error=null,this._list=D0(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),N("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++,N("parse: state complete. _stateCounter is now: %d",this._stateCounter),N("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return N("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0),r=e>>V.CMD_SHIFT;this.packet.cmd=V.types[r];let i=e&15,n=V.requiredHeaderFlags[r];return n!=null&&i!==n?this._emitError(new Error(V.requiredHeaderFlagsErrors[r])):(this.packet.retain=(e&V.RETAIN_MASK)!==0,this.packet.qos=e>>V.QOS_SHIFT&V.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(e&V.DUP_MASK)!==0,N("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),N("_parseLength %d",e.value),!!e}_parsePayload(){N("_parsePayload: payload %O",this._list);let e=!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"))}e=!0}return N("_parsePayload complete result: %s",e),e}_parseConnect(){N("_parseConnect");let e,r,i,n,o={},s=this.packet,l=this._parseString();if(l===null)return this._emitError(new Error("Cannot parse protocolId"));if(l!=="MQTT"&&l!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(s.protocolId=l,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.protocolVersion=this._list.readUInt8(this._pos),s.protocolVersion>=128&&(s.bridgeMode=!0,s.protocolVersion=s.protocolVersion-128),s.protocolVersion!==3&&s.protocolVersion!==4&&s.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"));o.username=this._list.readUInt8(this._pos)&V.USERNAME_MASK,o.password=this._list.readUInt8(this._pos)&V.PASSWORD_MASK,o.will=this._list.readUInt8(this._pos)&V.WILL_FLAG_MASK;let u=!!(this._list.readUInt8(this._pos)&V.WILL_RETAIN_MASK),f=(this._list.readUInt8(this._pos)&V.WILL_QOS_MASK)>>V.WILL_QOS_SHIFT;if(o.will)s.will={},s.will.retain=u,s.will.qos=f;else{if(u)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(f)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(s.clean=(this._list.readUInt8(this._pos)&V.CLEAN_SESSION_MASK)!==0,this._pos++,s.keepalive=this._parseNum(),s.keepalive===-1)return this._emitError(new Error("Packet too short"));if(s.protocolVersion===5){let h=this._parseProperties();Object.getOwnPropertyNames(h).length&&(s.properties=h)}let d=this._parseString();if(d===null)return this._emitError(new Error("Packet too short"));if(s.clientId=d,N("_parseConnect: packet.clientId: %s",s.clientId),o.will){if(s.protocolVersion===5){let h=this._parseProperties();Object.getOwnPropertyNames(h).length&&(s.will.properties=h)}if(e=this._parseString(),e===null)return this._emitError(new Error("Cannot parse will topic"));if(s.will.topic=e,N("_parseConnect: packet.will.topic: %s",s.will.topic),r=this._parseBuffer(),r===null)return this._emitError(new Error("Cannot parse will payload"));s.will.payload=r,N("_parseConnect: packet.will.paylaod: %s",s.will.payload)}if(o.username){if(n=this._parseString(),n===null)return this._emitError(new Error("Cannot parse username"));s.username=n,N("_parseConnect: packet.username: %s",s.username)}if(o.password){if(i=this._parseBuffer(),i===null)return this._emitError(new Error("Cannot parse password"));s.password=i}return this.settings=s,N("_parseConnect: complete"),s}_parseConnack(){N("_parseConnack");let e=this.packet;if(this._list.length<1)return null;let r=this._list.readUInt8(this._pos++);if(r>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(e.sessionPresent=!!(r&V.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(e.returnCode===-1||e.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(e.properties=i)}N("_parseConnack: complete")}_parsePublish(){N("_parsePublish");let e=this.packet;if(e.topic=this._parseString(),e.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}e.payload=this._list.slice(this._pos,e.length),N("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){N("_parseSubscribe");let e=this.packet,r,i,n,o,s,l,u;if(e.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let f=this._parseProperties();Object.getOwnPropertyNames(f).length&&(e.properties=f)}if(e.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos<e.length;){if(r=this._parseString(),r===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(i=this._parseByte(),this.settings.protocolVersion===5){if(i&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(i&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(n=i&V.SUBSCRIBE_OPTIONS_QOS_MASK,n>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(l=(i>>V.SUBSCRIBE_OPTIONS_NL_SHIFT&V.SUBSCRIBE_OPTIONS_NL_MASK)!==0,s=(i>>V.SUBSCRIBE_OPTIONS_RAP_SHIFT&V.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,o=i>>V.SUBSCRIBE_OPTIONS_RH_SHIFT&V.SUBSCRIBE_OPTIONS_RH_MASK,o>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));u={topic:r,qos:n},this.settings.protocolVersion===5?(u.nl=l,u.rap=s,u.rh=o):this.settings.bridgeMode&&(u.rh=0,u.rap=!0,u.nl=!0),N("_parseSubscribe: push subscription `%s` to subscription",u),e.subscriptions.push(u)}}}_parseSuback(){N("_parseSuback");let e=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos<this.packet.length;){let r=this._list.readUInt8(this._pos++);if(this.settings.protocolVersion===5){if(!V.MQTT5_SUBACK_CODES[r])return this._emitError(new Error("Invalid suback code"))}else if(r>2&&r!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(r)}}}_parseUnsubscribe(){N("_parseUnsubscribe");let e=this.packet;if(e.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos<e.length;){let r=this._parseString();if(r===null)return this._emitError(new Error("Cannot parse topic"));N("_parseUnsubscribe: push topic `%s` to unsubscriptions",r),e.unsubscriptions.push(r)}}}_parseUnsuback(){N("_parseUnsuback");let e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if((this.settings.protocolVersion===3||this.settings.protocolVersion===4)&&e.length!==2)return this._emitError(new Error("Malformed unsuback, payload length must be 2"));if(e.length<=0)return this._emitError(new Error("Malformed unsuback, no payload specified"));if(this.settings.protocolVersion===5){let r=this._parseProperties();for(Object.getOwnPropertyNames(r).length&&(e.properties=r),e.granted=[];this._pos<this.packet.length;){let i=this._list.readUInt8(this._pos++);if(!V.MQTT5_UNSUBACK_CODES[i])return this._emitError(new Error("Invalid unsuback code"));this.packet.granted.push(i)}}}_parseConfirmation(){N("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let e=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5){if(e.length>2){switch(e.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!V.MQTT5_PUBACK_PUBREC_CODES[e.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!V.MQTT5_PUBREL_PUBCOMP_CODES[e.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}N("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)}else e.reasonCode=0;if(e.length>3){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}}return!0}_parseDisconnect(){let e=this.packet;if(N("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(e.reasonCode=this._parseByte(),V.MQTT5_DISCONNECT_CODES[e.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):e.reasonCode=0;let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}return N("_parseDisconnect result: true"),!0}_parseAuth(){N("_parseAuth");let e=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(e.reasonCode=this._parseByte(),!V.MQTT5_AUTH_CODES[e.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let r=this._parseProperties();return Object.getOwnPropertyNames(r).length&&(e.properties=r),N("_parseAuth: result: true"),!0}_parseMessageId(){let e=this.packet;return e.messageId=this._parseNum(),e.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(N("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){let r=this._parseNum(),i=r+this._pos;if(r===-1||i>this._list.length||i>this.packet.length)return null;let n=this._list.toString("utf8",this._pos,i);return this._pos+=r,N("_parseString: result: %s",n),n}_parseStringPair(){return N("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let e=this._parseNum(),r=e+this._pos;if(e===-1||r>this._list.length||r>this.packet.length)return null;let i=this._list.slice(this._pos,r);return this._pos+=e,N("_parseBuffer: result: %o",i),i}_parseNum(){if(this._list.length-this._pos<2)return-1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,N("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let e=this._list.readUInt32BE(this._pos);return this._pos+=4,N("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){N("_parseVarByteNum");let r=4,i=0,n=1,o=0,s=!1,l,u=this._pos?this._pos:0;for(;i<r&&u+i<this._list.length;){if(l=this._list.readUInt8(u+i++),o+=n*(l&V.VARBYTEINT_MASK),n*=128,(l&V.VARBYTEINT_FIN_MASK)===0){s=!0;break}if(this._list.length<=i)break}return!s&&i===r&&this._list.length>=i&&this._emitError(new Error("Invalid variable byte integer")),u&&(this._pos+=i),s?e?s={bytes:i,value:o}:s=o:s=!1,N("_parseVarByteNum: result: %o",s),s}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),N("_parseByte: result: %o",e),e}_parseByType(e){switch(N("_parseByType: type: %s",e),e){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){N("_parseProperties");let e=this._parseVarByteNum(),i=this._pos+e,n={};for(;this._pos<i;){let o=this._parseByte();if(!o)return this._emitError(new Error("Cannot parse property code type")),!1;let s=V.propertiesCodes[o];if(!s)return this._emitError(new Error("Unknown property")),!1;if(s==="userProperties"){n[s]||(n[s]=Object.create(null));let l=this._parseByType(V.propertiesTypes[s]);if(n[s][l.name])if(Array.isArray(n[s][l.name]))n[s][l.name].push(l.value);else{let u=n[s][l.name];n[s][l.name]=[u],n[s][l.name].push(l.value)}else n[s][l.name]=l.value;continue}n[s]?Array.isArray(n[s])?n[s].push(this._parseByType(V.propertiesTypes[s])):(n[s]=[n[s]],n[s].push(this._parseByType(V.propertiesTypes[s]))):n[s]=this._parseByType(V.propertiesTypes[s])}return n}_newPacket(){return N("_newPacket"),this.packet&&(this._list.consume(this.packet.length),N("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),N("_newPacket: new packet"),this.packet=new hd,this._pos=0,!0}_emitError(e){N("_emitError",e),this.error=e,this.emit("error",e)}};dd.exports=No});var wd=O((dx,yd)=>{_();v();m();var{Buffer:mi}=(he(),Q(ye)),F0=65536,gd={},W0=mi.isBuffer(mi.from([1,2]).subarray(0,1));function bd(t){let e=mi.allocUnsafe(2);return e.writeUInt8(t>>8,0),e.writeUInt8(t&255,1),e}function $0(){for(let t=0;t<F0;t++)gd[t]=bd(t)}function H0(t){let r=0,i=0,n=mi.allocUnsafe(4);do r=t%128|0,t=t/128|0,t>0&&(r=r|128),n.writeUInt8(r,i++);while(t>0&&i<4);return t>0&&(i=0),W0?n.subarray(0,i):n.slice(0,i)}function V0(t){let e=mi.allocUnsafe(4);return e.writeUInt32BE(t,0),e}yd.exports={cache:gd,generateCache:$0,generateNumber:bd,genBufVariableByteInt:H0,generate4ByteBuffer:V0}});var _d=O((Ax,Do)=>{"use strict";_();v();m();typeof R>"u"||!R.version||R.version.indexOf("v0.")===0||R.version.indexOf("v1.")===0&&R.version.indexOf("v1.8.")!==0?Do.exports={nextTick:z0}:Do.exports=R;function z0(t,e,r,i){if(typeof t!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,o,s;switch(n){case 0:case 1:return R.nextTick(t);case 2:return R.nextTick(function(){t.call(null,e)});case 3:return R.nextTick(function(){t.call(null,e,r)});case 4:return R.nextTick(function(){t.call(null,e,r,i)});default:for(o=new Array(n-1),s=0;s<o.length;)o[s++]=arguments[s];return R.nextTick(function(){t.apply(null,o)})}}});var Wo=O((Mx,Rd)=>{_();v();m();var D=Uo(),{Buffer:U}=(he(),Q(ye)),K0=U.allocUnsafe(0),G0=U.from([0]),vi=wd(),Q0=_d().nextTick,qe=it()("mqtt-packet:writeToStream"),An=vi.cache,Y0=vi.generateNumber,J0=vi.generateCache,jo=vi.genBufVariableByteInt,X0=vi.generate4ByteBuffer,Te=Fo,In=!0;function Id(t,e,r){switch(qe("generate called"),e.cork&&(e.cork(),Q0(Z0,e)),In&&(In=!1,J0()),qe("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return ev(t,e,r);case"connack":return tv(t,e,r);case"publish":return rv(t,e,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return iv(t,e,r);case"subscribe":return nv(t,e,r);case"suback":return sv(t,e,r);case"unsubscribe":return ov(t,e,r);case"unsuback":return lv(t,e,r);case"pingreq":case"pingresp":return av(t,e,r);case"disconnect":return uv(t,e,r);case"auth":return cv(t,e,r);default:return e.destroy(new Error("Unknown command")),!1}}Object.defineProperty(Id,"cacheNumbers",{get(){return Te===Fo},set(t){t?((!An||Object.keys(An).length===0)&&(In=!0),Te=Fo):(In=!1,Te=fv)}});function Z0(t){t.uncork()}function ev(t,e,r){let i=t||{},n=i.protocolId||"MQTT",o=i.protocolVersion||4,s=i.will,l=i.clean,u=i.keepalive||0,f=i.clientId||"",d=i.username,h=i.password,g=i.properties;l===void 0&&(l=!0);let b=0;if(!n||typeof n!="string"&&!U.isBuffer(n))return e.destroy(new Error("Invalid protocolId")),!1;if(b+=n.length+2,o!==3&&o!==4&&o!==5)return e.destroy(new Error("Invalid protocol version")),!1;if(b+=1,(typeof f=="string"||U.isBuffer(f))&&(f||o>=4)&&(f||l))b+=U.byteLength(f)+2;else{if(o<4)return e.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(l*1===0)return e.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof u!="number"||u<0||u>65535||u%1!==0)return e.destroy(new Error("Invalid keepalive")),!1;b+=2,b+=1;let E,w;if(o===5){if(E=jt(e,g),!E)return!1;b+=E.length}if(s){if(typeof s!="object")return e.destroy(new Error("Invalid will")),!1;if(!s.topic||typeof s.topic!="string")return e.destroy(new Error("Invalid will topic")),!1;if(b+=U.byteLength(s.topic)+2,b+=2,s.payload)if(s.payload.length>=0)typeof s.payload=="string"?b+=U.byteLength(s.payload):b+=s.payload.length;else return e.destroy(new Error("Invalid will payload")),!1;if(w={},o===5){if(w=jt(e,s.properties),!w)return!1;b+=w.length}}let S=!1;if(d!=null)if(Ad(d))S=!0,b+=U.byteLength(d)+2;else return e.destroy(new Error("Invalid username")),!1;if(h!=null){if(!S)return e.destroy(new Error("Username is required to use password")),!1;if(Ad(h))b+=Td(h)+2;else return e.destroy(new Error("Invalid password")),!1}e.write(D.CONNECT_HEADER),Ue(e,b),Vr(e,n),i.bridgeMode&&(o+=128),e.write(o===131?D.VERSION131:o===132?D.VERSION132:o===4?D.VERSION4:o===5?D.VERSION5:D.VERSION3);let I=0;return I|=d!=null?D.USERNAME_MASK:0,I|=h!=null?D.PASSWORD_MASK:0,I|=s&&s.retain?D.WILL_RETAIN_MASK:0,I|=s&&s.qos?s.qos<<D.WILL_QOS_SHIFT:0,I|=s?D.WILL_FLAG_MASK:0,I|=l?D.CLEAN_SESSION_MASK:0,e.write(U.from([I])),Te(e,u),o===5&&E.write(),Vr(e,f),s&&(o===5&&w.write(),ur(e,s.topic),Vr(e,s.payload)),d!=null&&Vr(e,d),h!=null&&Vr(e,h),!0}function tv(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=i===5?n.reasonCode:n.returnCode,s=n.properties,l=2;if(typeof o!="number")return e.destroy(new Error("Invalid return code")),!1;let u=null;if(i===5){if(u=jt(e,s),!u)return!1;l+=u.length}return e.write(D.CONNACK_HEADER),Ue(e,l),e.write(n.sessionPresent?D.SESSIONPRESENT_HEADER:G0),e.write(U.from([o])),u?.write(),!0}function rv(t,e,r){qe("publish: packet: %o",t);let i=r?r.protocolVersion:4,n=t||{},o=n.qos||0,s=n.retain?D.RETAIN_MASK:0,l=n.topic,u=n.payload||K0,f=n.messageId,d=n.properties,h=0;if(typeof l=="string")h+=U.byteLength(l)+2;else if(U.isBuffer(l))h+=l.length+2;else return e.destroy(new Error("Invalid topic")),!1;if(U.isBuffer(u)?h+=u.length:h+=U.byteLength(u),o&&typeof f!="number")return e.destroy(new Error("Invalid messageId")),!1;o&&(h+=2);let g=null;if(i===5){if(g=jt(e,d),!g)return!1;h+=g.length}return e.write(D.PUBLISH_HEADER[o][n.dup?1:0][s?1:0]),Ue(e,h),Te(e,Td(l)),e.write(l),o>0&&Te(e,f),g?.write(),qe("publish: payload: %o",u),e.write(u)}function iv(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.cmd||"puback",s=n.messageId,l=n.dup&&o==="pubrel"?D.DUP_MASK:0,u=0,f=n.reasonCode,d=n.properties,h=i===5?3:2;if(o==="pubrel"&&(u=1),typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;let g=null;if(i===5&&typeof d=="object"){if(g=Ei(e,d,r,h),!g)return!1;h+=g.length}return e.write(D.ACKS[o][u][l][0]),h===3&&(h+=f!==0?1:-1),Ue(e,h),Te(e,s),i===5&&h!==2&&e.write(U.from([f])),g!==null?g.write():h===4&&e.write(U.from([0])),!0}function nv(t,e,r){qe("subscribe: packet: ");let i=r?r.protocolVersion:4,n=t||{},o=n.dup?D.DUP_MASK:0,s=n.messageId,l=n.subscriptions,u=n.properties,f=0;if(typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;f+=2;let d=null;if(i===5){if(d=jt(e,u),!d)return!1;f+=d.length}if(typeof l=="object"&&l.length)for(let g=0;g<l.length;g+=1){let b=l[g].topic,E=l[g].qos;if(typeof b!="string")return e.destroy(new Error("Invalid subscriptions - invalid topic")),!1;if(typeof E!="number")return e.destroy(new Error("Invalid subscriptions - invalid qos")),!1;if(i===5){if(typeof(l[g].nl||!1)!="boolean")return e.destroy(new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(l[g].rap||!1)!="boolean")return e.destroy(new Error("Invalid subscriptions - invalid Retain as Published")),!1;let I=l[g].rh||0;if(typeof I!="number"||I>2)return e.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}f+=U.byteLength(b)+2+1}else return e.destroy(new Error("Invalid subscriptions")),!1;qe("subscribe: writing to stream: %o",D.SUBSCRIBE_HEADER),e.write(D.SUBSCRIBE_HEADER[1][o?1:0][0]),Ue(e,f),Te(e,s),d!==null&&d.write();let h=!0;for(let g of l){let b=g.topic,E=g.qos,w=+g.nl,S=+g.rap,I=g.rh,C;ur(e,b),C=D.SUBSCRIBE_OPTIONS_QOS[E],i===5&&(C|=w?D.SUBSCRIBE_OPTIONS_NL:0,C|=S?D.SUBSCRIBE_OPTIONS_RAP:0,C|=I?D.SUBSCRIBE_OPTIONS_RH[I]:0),h=e.write(U.from([C]))}return h}function sv(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.granted,l=n.properties,u=0;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;if(u+=2,typeof s=="object"&&s.length)for(let d=0;d<s.length;d+=1){if(typeof s[d]!="number")return e.destroy(new Error("Invalid qos vector")),!1;u+=1}else return e.destroy(new Error("Invalid qos vector")),!1;let f=null;if(i===5){if(f=Ei(e,l,r,u),!f)return!1;u+=f.length}return e.write(D.SUBACK_HEADER),Ue(e,u),Te(e,o),f!==null&&f.write(),e.write(U.from(s))}function ov(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.dup?D.DUP_MASK:0,l=n.unsubscriptions,u=n.properties,f=0;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;if(f+=2,typeof l=="object"&&l.length)for(let g=0;g<l.length;g+=1){if(typeof l[g]!="string")return e.destroy(new Error("Invalid unsubscriptions")),!1;f+=U.byteLength(l[g])+2}else return e.destroy(new Error("Invalid unsubscriptions")),!1;let d=null;if(i===5){if(d=jt(e,u),!d)return!1;f+=d.length}e.write(D.UNSUBSCRIBE_HEADER[1][s?1:0][0]),Ue(e,f),Te(e,o),d!==null&&d.write();let h=!0;for(let g=0;g<l.length;g++)h=ur(e,l[g]);return h}function lv(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.dup?D.DUP_MASK:0,l=n.granted,u=n.properties,f=n.cmd,d=0,h=2;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;if(i===5)if(typeof l=="object"&&l.length)for(let b=0;b<l.length;b+=1){if(typeof l[b]!="number")return e.destroy(new Error("Invalid qos vector")),!1;h+=1}else return e.destroy(new Error("Invalid qos vector")),!1;let g=null;if(i===5){if(g=Ei(e,u,r,h),!g)return!1;h+=g.length}return e.write(D.ACKS[f][d][s][0]),Ue(e,h),Te(e,o),g!==null&&g.write(),i===5&&e.write(U.from(l)),!0}function av(t,e,r){return e.write(D.EMPTY[t.cmd])}function uv(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.reasonCode,s=n.properties,l=i===5?1:0,u=null;if(i===5){if(u=Ei(e,s,r,l),!u)return!1;l+=u.length}return e.write(U.from([D.codes.disconnect<<4])),Ue(e,l),i===5&&e.write(U.from([o])),u!==null&&u.write(),!0}function cv(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.reasonCode,s=n.properties,l=i===5?1:0;i!==5&&e.destroy(new Error("Invalid mqtt version for auth packet"));let u=Ei(e,s,r,l);return u?(l+=u.length,e.write(U.from([D.codes.auth<<4])),Ue(e,l),e.write(U.from([o])),u!==null&&u.write(),!0):!1}var md={};function Ue(t,e){if(e>D.VARBYTEINT_MAX)return t.destroy(new Error(`Invalid variable byte integer: ${e}`)),!1;let r=md[e];return r||(r=jo(e),e<16384&&(md[e]=r)),qe("writeVarByteInt: writing to stream: %o",r),t.write(r)}function ur(t,e){let r=U.byteLength(e);return Te(t,r),qe("writeString: %s",e),t.write(e,"utf8")}function vd(t,e,r){ur(t,e),ur(t,r)}function Fo(t,e){return qe("writeNumberCached: number: %d",e),qe("writeNumberCached: %o",An[e]),t.write(An[e])}function fv(t,e){let r=Y0(e);return qe("writeNumberGenerated: %o",r),t.write(r)}function hv(t,e){let r=X0(e);return qe("write4ByteNumber: %o",r),t.write(r)}function Vr(t,e){typeof e=="string"?ur(t,e):e?(Te(t,e.length),t.write(e)):Te(t,0)}function jt(t,e){if(typeof e!="object"||e.length!=null)return{length:1,write(){Sd(t,{},0)}};let r=0;function i(o,s){let l=D.propertiesTypes[o],u=0;switch(l){case"byte":{if(typeof s!="boolean")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=2;break}case"int8":{if(typeof s!="number"||s<0||s>255)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=2;break}case"binary":{if(s&&s===null)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+U.byteLength(s)+2;break}case"int16":{if(typeof s!="number"||s<0||s>65535)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=3;break}case"int32":{if(typeof s!="number"||s<0||s>4294967295)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=5;break}case"var":{if(typeof s!="number"||s<0||s>268435455)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=1+U.byteLength(jo(s));break}case"string":{if(typeof s!="string")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=3+U.byteLength(s.toString());break}case"pair":{if(typeof s!="object")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;u+=Object.getOwnPropertyNames(s).reduce((f,d)=>{let h=s[d];return Array.isArray(h)?f+=h.reduce((g,b)=>(g+=3+U.byteLength(d.toString())+2+U.byteLength(b.toString()),g),0):f+=3+U.byteLength(d.toString())+2+U.byteLength(s[d].toString()),f},0);break}default:return t.destroy(new Error(`Invalid property ${o}: ${s}`)),!1}return u}if(e)for(let o in e){let s=0,l=0,u=e[o];if(u!==void 0){if(Array.isArray(u))for(let f=0;f<u.length;f++){if(l=i(o,u[f]),!l)return!1;s+=l}else{if(l=i(o,u),!l)return!1;s=l}if(!s)return!1;r+=s}}return{length:U.byteLength(jo(r))+r,write(){Sd(t,e,r)}}}function Ei(t,e,r,i){let n=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0,s=jt(t,e);if(o)for(;i+s.length>o;){let l=n.shift();if(l&&e[l])delete e[l],s=jt(t,e);else return!1}return s}function Ed(t,e,r){switch(D.propertiesTypes[e]){case"byte":{t.write(U.from([D.properties[e]])),t.write(U.from([+r]));break}case"int8":{t.write(U.from([D.properties[e]])),t.write(U.from([r]));break}case"binary":{t.write(U.from([D.properties[e]])),Vr(t,r);break}case"int16":{t.write(U.from([D.properties[e]])),Te(t,r);break}case"int32":{t.write(U.from([D.properties[e]])),hv(t,r);break}case"var":{t.write(U.from([D.properties[e]])),Ue(t,r);break}case"string":{t.write(U.from([D.properties[e]])),ur(t,r);break}case"pair":{Object.getOwnPropertyNames(r).forEach(n=>{let o=r[n];Array.isArray(o)?o.forEach(s=>{t.write(U.from([D.properties[e]])),vd(t,n.toString(),s.toString())}):(t.write(U.from([D.properties[e]])),vd(t,n.toString(),o.toString()))});break}default:return t.destroy(new Error(`Invalid property ${e} value: ${r}`)),!1}}function Sd(t,e,r){Ue(t,r);for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!=null){let n=e[i];if(Array.isArray(n))for(let o=0;o<n.length;o++)Ed(t,i,n[o]);else Ed(t,i,n)}}function Td(t){return t?t instanceof U?t.length:U.byteLength(t):0}function Ad(t){return typeof t=="string"||t instanceof U}Rd.exports=Id});var kd=O((Hx,Pd)=>{_();v();m();var dv=Wo(),{EventEmitter:pv}=(Ot(),Q(xt)),{Buffer:Cd}=(he(),Q(ye));function gv(t,e){let r=new $o;return dv(t,r,e),r.concat()}var $o=class extends pv{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0,r=new Array(this._array.length),i=this._array,n=0,o;for(o=0;o<i.length&&i[o]!==void 0;o++)typeof i[o]!="string"?r[o]=i[o].length:r[o]=Cd.byteLength(i[o]),e+=r[o];let s=Cd.allocUnsafe(e);for(o=0;o<i.length&&i[o]!==void 0;o++)typeof i[o]!="string"?(i[o].copy(s,n),n+=r[o]):(s.write(i[o],n),n+=r[o]);return s}destroy(e){e&&this.emit("error",e)}};Pd.exports=gv});var Bd=O(Tn=>{_();v();m();Tn.parser=pd().parser;Tn.generate=kd();Tn.writeToStream=Wo()});var zo=O(Vo=>{"use strict";_();v();m();Object.defineProperty(Vo,"__esModule",{value:!0});var Ho=class{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let e=this.nextId++;return this.nextId===65536&&(this.nextId=1),e}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(e){return!0}deallocate(e){}clear(){}};Vo.default=Ho});var Od=O((mO,xd)=>{"use strict";_();v();m();xd.exports=bv;function zr(t){return t instanceof x?x.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function bv(t){if(t=t||{},t.circles)return yv(t);let e=new Map;if(e.set(Date,s=>new Date(s)),e.set(Map,(s,l)=>new Map(i(Array.from(s),l))),e.set(Set,(s,l)=>new Set(i(Array.from(s),l))),t.constructorHandlers)for(let s of t.constructorHandlers)e.set(s[0],s[1]);let r=null;return t.proto?o:n;function i(s,l){let u=Object.keys(s),f=new Array(u.length);for(let d=0;d<u.length;d++){let h=u[d],g=s[h];typeof g!="object"||g===null?f[h]=g:g.constructor!==Object&&(r=e.get(g.constructor))?f[h]=r(g,l):ArrayBuffer.isView(g)?f[h]=zr(g):f[h]=l(g)}return f}function n(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return i(s,n);if(s.constructor!==Object&&(r=e.get(s.constructor)))return r(s,n);let l={};for(let u in s){if(Object.hasOwnProperty.call(s,u)===!1)continue;let f=s[u];typeof f!="object"||f===null?l[u]=f:f.constructor!==Object&&(r=e.get(f.constructor))?l[u]=r(f,n):ArrayBuffer.isView(f)?l[u]=zr(f):l[u]=n(f)}return l}function o(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return i(s,o);if(s.constructor!==Object&&(r=e.get(s.constructor)))return r(s,o);let l={};for(let u in s){let f=s[u];typeof f!="object"||f===null?l[u]=f:f.constructor!==Object&&(r=e.get(f.constructor))?l[u]=r(f,o):ArrayBuffer.isView(f)?l[u]=zr(f):l[u]=o(f)}return l}}function yv(t){let e=[],r=[],i=new Map;if(i.set(Date,u=>new Date(u)),i.set(Map,(u,f)=>new Map(o(Array.from(u),f))),i.set(Set,(u,f)=>new Set(o(Array.from(u),f))),t.constructorHandlers)for(let u of t.constructorHandlers)i.set(u[0],u[1]);let n=null;return t.proto?l:s;function o(u,f){let d=Object.keys(u),h=new Array(d.length);for(let g=0;g<d.length;g++){let b=d[g],E=u[b];if(typeof E!="object"||E===null)h[b]=E;else if(E.constructor!==Object&&(n=i.get(E.constructor)))h[b]=n(E,f);else if(ArrayBuffer.isView(E))h[b]=zr(E);else{let w=e.indexOf(E);w!==-1?h[b]=r[w]:h[b]=f(E)}}return h}function s(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return o(u,s);if(u.constructor!==Object&&(n=i.get(u.constructor)))return n(u,s);let f={};e.push(u),r.push(f);for(let d in u){if(Object.hasOwnProperty.call(u,d)===!1)continue;let h=u[d];if(typeof h!="object"||h===null)f[d]=h;else if(h.constructor!==Object&&(n=i.get(h.constructor)))f[d]=n(h,s);else if(ArrayBuffer.isView(h))f[d]=zr(h);else{let g=e.indexOf(h);g!==-1?f[d]=r[g]:f[d]=s(h)}}return e.pop(),r.pop(),f}function l(u){if(typeof u!="object"||u===null)return u;if(Array.isArray(u))return o(u,l);if(u.constructor!==Object&&(n=i.get(u.constructor)))return n(u,l);let f={};e.push(u),r.push(f);for(let d in u){let h=u[d];if(typeof h!="object"||h===null)f[d]=h;else if(h.constructor!==Object&&(n=i.get(h.constructor)))f[d]=n(h,l);else if(ArrayBuffer.isView(h))f[d]=zr(h);else{let g=e.indexOf(h);g!==-1?f[d]=r[g]:f[d]=l(h)}}return e.pop(),r.pop(),f}}});var Ld=O((kO,Md)=>{"use strict";_();v();m();Md.exports=Od()()});var Ud=O(Rn=>{"use strict";_();v();m();Object.defineProperty(Rn,"__esModule",{value:!0});Rn.validateTopic=qd;Rn.validateTopics=wv;function qd(t){let e=t.split("/");for(let r=0;r<e.length;r++)if(e[r]!=="+"){if(e[r]==="#")return r===e.length-1;if(e[r].indexOf("+")!==-1||e[r].indexOf("#")!==-1)return!1}return!0}function wv(t){if(t.length===0)return"empty_topic_list";for(let e=0;e<t.length;e++)if(!qd(t[e]))return t[e];return null}});var Qo=O(Go=>{"use strict";_();v();m();Object.defineProperty(Go,"__esModule",{value:!0});var _v=Nt(),mv={objectMode:!0},vv={clean:!0},Ko=class{constructor(e){this.options=e||{},this.options=Object.assign(Object.assign({},vv),e),this._inflights=new Map}put(e,r){return this._inflights.set(e.messageId,e),r&&r(),this}createStream(){let e=new _v.Readable(mv),r=[],i=!1,n=0;return this._inflights.forEach((o,s)=>{r.push(o)}),e._read=()=>{!i&&n<r.length?e.push(r[n++]):e.push(null)},e.destroy=o=>{if(!i)return i=!0,setTimeout(()=>{e.emit("close")},0),e},e}del(e,r){let i=this._inflights.get(e.messageId);return i?(this._inflights.delete(e.messageId),r(null,i)):r&&r(new Error("missing packet")),this}get(e,r){let i=this._inflights.get(e.messageId);return i?r(null,i):r&&r(new Error("missing packet")),this}close(e){this.options.clean&&(this._inflights=null),e&&e()}};Go.default=Ko});var Dd=O(Yo=>{"use strict";_();v();m();Object.defineProperty(Yo,"__esModule",{value:!0});var Nd=[0,16,128,131,135,144,145,151,153],Ev=(t,e,r)=>{t.log("handlePublish: packet %o",e),r=typeof r<"u"?r:t.noop;let i=e.topic.toString(),n=e.payload,{qos:o}=e,{messageId:s}=e,{options:l}=t;if(t.options.protocolVersion===5){let u;if(e.properties&&(u=e.properties.topicAlias),typeof u<"u")if(i.length===0)if(u>0&&u<=65535){let f=t.topicAliasRecv.getTopicByAlias(u);if(f)i=f,t.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",i,u);else{t.log("handlePublish :: unregistered topic alias. alias: %d",u),t.emit("error",new Error("Received unregistered Topic Alias"));return}}else{t.log("handlePublish :: topic alias out of range. alias: %d",u),t.emit("error",new Error("Received Topic Alias is out of range"));return}else if(t.topicAliasRecv.put(i,u))t.log("handlePublish :: registered topic: %s - alias: %d",i,u);else{t.log("handlePublish :: topic alias out of range. alias: %d",u),t.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(t.log("handlePublish: qos %d",o),o){case 2:{l.customHandleAcks(i,n,e,(u,f)=>{if(typeof u=="number"&&(f=u,u=null),u)return t.emit("error",u);if(Nd.indexOf(f)===-1)return t.emit("error",new Error("Wrong reason code for pubrec"));f?t._sendPacket({cmd:"pubrec",messageId:s,reasonCode:f},r):t.incomingStore.put(e,()=>{t._sendPacket({cmd:"pubrec",messageId:s},r)})});break}case 1:{l.customHandleAcks(i,n,e,(u,f)=>{if(typeof u=="number"&&(f=u,u=null),u)return t.emit("error",u);if(Nd.indexOf(f)===-1)return t.emit("error",new Error("Wrong reason code for puback"));f||t.emit("message",i,n,e),t.handleMessage(e,d=>{if(d)return r&&r(d);t._sendPacket({cmd:"puback",messageId:s,reasonCode:f},r)})});break}case 0:t.emit("message",i,n,e),t.handleMessage(e,r);break;default:t.log("handlePublish: unknown QoS. Doing nothing.");break}};Yo.default=Ev});var jd=O((bM,Sv)=>{Sv.exports={version:"5.11.0"}});var cr=O(Et=>{"use strict";_();v();m();Object.defineProperty(Et,"__esModule",{value:!0});Et.MQTTJS_VERSION=Et.nextTick=Et.ErrorWithReasonCode=void 0;Et.applyMixin=Av;var Jo=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}};Et.ErrorWithReasonCode=Jo;function Av(t,e,r=!1){var i;let n=[e];for(;;){let o=n[0],s=Object.getPrototypeOf(o);if(s?.prototype)n.unshift(s);else break}for(let o of n)for(let s of Object.getOwnPropertyNames(o.prototype))(r||s!=="constructor")&&Object.defineProperty(t.prototype,s,(i=Object.getOwnPropertyDescriptor(o.prototype,s))!==null&&i!==void 0?i:Object.create(null))}Et.nextTick=typeof(R===null||R===void 0?void 0:R.nextTick)=="function"?R.nextTick:t=>{setTimeout(t,0)};Et.MQTTJS_VERSION=jd().version});var Si=O(Ft=>{"use strict";_();v();m();Object.defineProperty(Ft,"__esModule",{value:!0});Ft.ReasonCodes=void 0;var Fd=cr();Ft.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 Iv=(t,e)=>{let{messageId:r}=e,i=e.cmd,n=null,o=t.outgoing[r]?t.outgoing[r].cb:null,s=null;if(!o){t.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(t.log("_handleAck :: packet type",i),i){case"pubcomp":case"puback":{let l=e.reasonCode;l&&l>0&&l!==16?(s=new Fd.ErrorWithReasonCode(`Publish error: ${Ft.ReasonCodes[l]}`,l),t._removeOutgoingAndStoreMessage(r,()=>{o(s,e)})):t._removeOutgoingAndStoreMessage(r,o);break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:r};let l=e.reasonCode;l&&l>0&&l!==16?(s=new Fd.ErrorWithReasonCode(`Publish error: ${Ft.ReasonCodes[l]}`,l),t._removeOutgoingAndStoreMessage(r,()=>{o(s,e)})):t._sendPacket(n);break}case"suback":{delete t.outgoing[r],t.messageIdProvider.deallocate(r);let l=e.granted;for(let u=0;u<l.length;u++){let f=l[u];if((f&128)!==0){s=new Error(`Subscribe error: ${Ft.ReasonCodes[f]}`),s.code=f;let d=t.messageIdToTopic[r];d&&d.forEach(h=>{delete t._resubscribeTopics[h]})}}delete t.messageIdToTopic[r],t._invokeStoreProcessingQueue(),o(s,e);break}case"unsuback":{delete t.outgoing[r],t.messageIdProvider.deallocate(r),t._invokeStoreProcessingQueue(),o(null,e);break}default:t.emit("error",new Error("unrecognized packet type"))}t.disconnecting&&Object.keys(t.outgoing).length===0&&t.emit("outgoingEmpty")};Ft.default=Iv});var $d=O(Xo=>{"use strict";_();v();m();Object.defineProperty(Xo,"__esModule",{value:!0});var Wd=cr(),Tv=Si(),Rv=(t,e)=>{let{options:r}=t,i=r.protocolVersion,n=i===5?e.reasonCode:e.returnCode;if(i!==5){let o=new Wd.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${i}`,n);t.emit("error",o);return}t.handleAuth(e,(o,s)=>{if(o){t.emit("error",o);return}if(n===24)t.reconnecting=!1,t._sendPacket(s);else{let l=new Wd.ErrorWithReasonCode(`Connection refused: ${Tv.ReasonCodes[n]}`,n);t.emit("error",l)}})};Xo.default=Rv});var Gd=O(Pn=>{"use strict";_();v();m();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.LRUCache=void 0;var Kr=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Vd=new Set,Zo=typeof R=="object"&&R?R:{},zd=(t,e,r,i)=>{typeof Zo.emitWarning=="function"?Zo.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`)},Cn=globalThis.AbortController,Hd=globalThis.AbortSignal;if(typeof Cn>"u"){Hd=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,n){this._onabort.push(n)}},Cn=class{constructor(){e()}signal=new Hd;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let n of this.signal._onabort)n(i);this.signal.onabort?.(i)}}};let t=Zo.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,zd("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",e))}}var Cv=t=>!Vd.has(t),QM=Symbol("type"),Wt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Kd=t=>Wt(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Gr:null:null,Gr=class extends Array{constructor(e){super(e),this.fill(0)}},el=class t{heap;length;static#a=!1;static create(e){let r=Kd(e);if(!r)return[];t.#a=!0;let i=new t(e,r);return t.#a=!1,i}constructor(e,r){if(!t.#a)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},tl=class t{#a;#f;#g;#b;#k;#B;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#y;#i;#r;#e;#u;#h;#l;#s;#w;#o;#_;#m;#d;#v;#T;#c;static unsafeExposeInternals(e){return{starts:e.#m,ttls:e.#d,sizes:e.#_,keyMap:e.#i,keyList:e.#r,valList:e.#e,next:e.#u,prev:e.#h,get head(){return e.#l},get tail(){return e.#s},free:e.#w,isBackgroundFetch:r=>e.#t(r),backgroundFetch:(r,i,n,o)=>e.#M(r,i,n,o),moveToTail:r=>e.#P(r),indexes:r=>e.#E(r),rindexes:r=>e.#S(r),isStale:r=>e.#p(r)}}get max(){return this.#a}get maxSize(){return this.#f}get calculatedSize(){return this.#y}get size(){return this.#n}get fetchMethod(){return this.#k}get memoMethod(){return this.#B}get dispose(){return this.#g}get disposeAfter(){return this.#b}constructor(e){let{max:r=0,ttl:i,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:l,allowStale:u,dispose:f,disposeAfter:d,noDisposeOnSet:h,noUpdateTTL:g,maxSize:b=0,maxEntrySize:E=0,sizeCalculation:w,fetchMethod:S,memoMethod:I,noDeleteOnFetchRejection:C,noDeleteOnStaleGet:k,allowStaleOnFetchRejection:M,allowStaleOnFetchAbort:q,ignoreFetchAbort:G}=e;if(r!==0&&!Wt(r))throw new TypeError("max option must be a nonnegative integer");let F=r?Kd(r):Array;if(!F)throw new Error("invalid max value: "+r);if(this.#a=r,this.#f=b,this.maxEntrySize=E||this.#f,this.sizeCalculation=w,this.sizeCalculation){if(!this.#f&&!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(I!==void 0&&typeof I!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#B=I,S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#k=S,this.#T=!!S,this.#i=new Map,this.#r=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#u=new F(r),this.#h=new F(r),this.#l=0,this.#s=0,this.#w=el.create(r),this.#n=0,this.#y=0,typeof f=="function"&&(this.#g=f),typeof d=="function"?(this.#b=d,this.#o=[]):(this.#b=void 0,this.#o=void 0),this.#v=!!this.#g,this.#c=!!this.#b,this.noDisposeOnSet=!!h,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!C,this.allowStaleOnFetchRejection=!!M,this.allowStaleOnFetchAbort=!!q,this.ignoreFetchAbort=!!G,this.maxEntrySize!==0){if(this.#f!==0&&!Wt(this.#f))throw new TypeError("maxSize must be a positive integer if specified");if(!Wt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!k,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!l,this.ttlResolution=Wt(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!Wt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#L()}if(this.#a===0&&this.ttl===0&&this.#f===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#a&&!this.#f){let K="LRU_CACHE_UNBOUNDED";Cv(K)&&(Vd.add(K),zd("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",K,t))}}getRemainingTTL(e){return this.#i.has(e)?1/0:0}#L(){let e=new Gr(this.#a),r=new Gr(this.#a);this.#d=e,this.#m=r,this.#q=(o,s,l=Kr.now())=>{if(r[o]=s!==0?l:0,e[o]=s,s!==0&&this.ttlAutopurge){let u=setTimeout(()=>{this.#p(o)&&this.#A(this.#r[o],"expire")},s+1);u.unref&&u.unref()}},this.#R=o=>{r[o]=e[o]!==0?Kr.now():0},this.#I=(o,s)=>{if(e[s]){let l=e[s],u=r[s];if(!l||!u)return;o.ttl=l,o.start=u,o.now=i||n();let f=o.now-u;o.remainingTTL=l-f}};let i=0,n=()=>{let o=Kr.now();if(this.ttlResolution>0){i=o;let s=setTimeout(()=>i=0,this.ttlResolution);s.unref&&s.unref()}return o};this.getRemainingTTL=o=>{let s=this.#i.get(o);if(s===void 0)return 0;let l=e[s],u=r[s];if(!l||!u)return 1/0;let f=(i||n())-u;return l-f},this.#p=o=>{let s=r[o],l=e[o];return!!l&&!!s&&(i||n())-s>l}}#R=()=>{};#I=()=>{};#q=()=>{};#p=()=>!1;#F(){let e=new Gr(this.#a);this.#y=0,this.#_=e,this.#C=r=>{this.#y-=e[r],e[r]=0},this.#U=(r,i,n,o)=>{if(this.#t(i))return 0;if(!Wt(n))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(n=o(i,r),!Wt(n))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 n},this.#x=(r,i,n)=>{if(e[r]=i,this.#f){let o=this.#f-e[r];for(;this.#y>o;)this.#O(!0)}this.#y+=e[r],n&&(n.entrySize=i,n.totalCalculatedSize=this.#y)}}#C=e=>{};#x=(e,r,i)=>{};#U=(e,r,i,n)=>{if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#E({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#s;!(!this.#N(r)||((e||!this.#p(r))&&(yield r),r===this.#l));)r=this.#h[r]}*#S({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#l;!(!this.#N(r)||((e||!this.#p(r))&&(yield r),r===this.#s));)r=this.#u[r]}#N(e){return e!==void 0&&this.#i.get(this.#r[e])===e}*entries(){for(let e of this.#E())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#S())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#E()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*rkeys(){for(let e of this.#S()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*values(){for(let e of this.#E())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#S())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let i of this.#E()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;if(o!==void 0&&e(o,this.#r[i],this))return this.get(this.#r[i],r)}}forEach(e,r=this){for(let i of this.#E()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this)}}rforEach(e,r=this){for(let i of this.#S()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this)}}purgeStale(){let e=!1;for(let r of this.#S({allowStale:!0}))this.#p(r)&&(this.#A(this.#r[r],"expire"),e=!0);return e}info(e){let r=this.#i.get(e);if(r===void 0)return;let i=this.#e[r],n=this.#t(i)?i.__staleWhileFetching:i;if(n===void 0)return;let o={value:n};if(this.#d&&this.#m){let s=this.#d[r],l=this.#m[r];if(s&&l){let u=s-(Kr.now()-l);o.ttl=u,o.start=Date.now()}}return this.#_&&(o.size=this.#_[r]),o}dump(){let e=[];for(let r of this.#E({allowStale:!0})){let i=this.#r[r],n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0||i===void 0)continue;let s={value:o};if(this.#d&&this.#m){s.ttl=this.#d[r];let l=Kr.now()-this.#m[r];s.start=Math.floor(Date.now()-l)}this.#_&&(s.size=this.#_[r]),e.unshift([i,s])}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let n=Date.now()-i.start;i.start=Kr.now()-n}this.set(r,i.value,i)}}set(e,r,i={}){if(r===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:u}=i,{noUpdateTTL:f=this.noUpdateTTL}=i,d=this.#U(e,r,i.size||0,l);if(this.maxEntrySize&&d>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.#A(e,"set"),this;let h=this.#n===0?void 0:this.#i.get(e);if(h===void 0)h=this.#n===0?this.#s:this.#w.length!==0?this.#w.pop():this.#n===this.#a?this.#O(!1):this.#n,this.#r[h]=e,this.#e[h]=r,this.#i.set(e,h),this.#u[this.#s]=h,this.#h[h]=this.#s,this.#s=h,this.#n++,this.#x(h,d,u),u&&(u.set="add"),f=!1;else{this.#P(h);let g=this.#e[h];if(r!==g){if(this.#T&&this.#t(g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:b}=g;b!==void 0&&!s&&(this.#v&&this.#g?.(b,e,"set"),this.#c&&this.#o?.push([b,e,"set"]))}else s||(this.#v&&this.#g?.(g,e,"set"),this.#c&&this.#o?.push([g,e,"set"]));if(this.#C(h),this.#x(h,d,u),this.#e[h]=r,u){u.set="replace";let b=g&&this.#t(g)?g.__staleWhileFetching:g;b!==void 0&&(u.oldValue=b)}}else u&&(u.set="update")}if(n!==0&&!this.#d&&this.#L(),this.#d&&(f||this.#q(h,n,o),u&&this.#I(u,h)),!s&&this.#c&&this.#o){let g=this.#o,b;for(;b=g?.shift();)this.#b?.(...b)}return this}pop(){try{for(;this.#n;){let e=this.#e[this.#l];if(this.#O(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#c&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#b?.(...r)}}}#O(e){let r=this.#l,i=this.#r[r],n=this.#e[r];return this.#T&&this.#t(n)?n.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#g?.(n,i,"evict"),this.#c&&this.#o?.push([n,i,"evict"])),this.#C(r),e&&(this.#r[r]=void 0,this.#e[r]=void 0,this.#w.push(r)),this.#n===1?(this.#l=this.#s=0,this.#w.length=0):this.#l=this.#u[r],this.#i.delete(i),this.#n--,r}has(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=r,o=this.#i.get(e);if(o!==void 0){let s=this.#e[o];if(this.#t(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#p(o))n&&(n.has="stale",this.#I(n,o));else return i&&this.#R(o),n&&(n.has="hit",this.#I(n,o)),!0}else n&&(n.has="miss");return!1}peek(e,r={}){let{allowStale:i=this.allowStale}=r,n=this.#i.get(e);if(n===void 0||!i&&this.#p(n))return;let o=this.#e[n];return this.#t(o)?o.__staleWhileFetching:o}#M(e,r,i,n){let o=r===void 0?void 0:this.#e[r];if(this.#t(o))return o;let s=new Cn,{signal:l}=i;l?.addEventListener("abort",()=>s.abort(l.reason),{signal:s.signal});let u={signal:s.signal,options:i,context:n},f=(w,S=!1)=>{let{aborted:I}=s.signal,C=i.ignoreFetchAbort&&w!==void 0;if(i.status&&(I&&!S?(i.status.fetchAborted=!0,i.status.fetchError=s.signal.reason,C&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),I&&!C&&!S)return h(s.signal.reason);let k=b;return this.#e[r]===b&&(w===void 0?k.__staleWhileFetching?this.#e[r]=k.__staleWhileFetching:this.#A(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(e,w,u.options))),w},d=w=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=w),h(w)),h=w=>{let{aborted:S}=s.signal,I=S&&i.allowStaleOnFetchAbort,C=I||i.allowStaleOnFetchRejection,k=C||i.noDeleteOnFetchRejection,M=b;if(this.#e[r]===b&&(!k||M.__staleWhileFetching===void 0?this.#A(e,"fetch"):I||(this.#e[r]=M.__staleWhileFetching)),C)return i.status&&M.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),M.__staleWhileFetching;if(M.__returned===M)throw w},g=(w,S)=>{let I=this.#k?.(e,o,u);I&&I instanceof Promise&&I.then(C=>w(C===void 0?void 0:C),S),s.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(w(void 0),i.allowStaleOnFetchAbort&&(w=C=>f(C,!0)))})};i.status&&(i.status.fetchDispatched=!0);let b=new Promise(g).then(f,d),E=Object.assign(b,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,E,{...u.options,status:void 0}),r=this.#i.get(e)):this.#e[r]=E,E}#t(e){if(!this.#T)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Cn}async fetch(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:u=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:w,forceRefresh:S=!1,status:I,signal:C}=r;if(!this.#T)return I&&(I.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:I});let k={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:l,size:u,sizeCalculation:f,noUpdateTTL:d,noDeleteOnFetchRejection:h,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:E,ignoreFetchAbort:b,status:I,signal:C},M=this.#i.get(e);if(M===void 0){I&&(I.fetch="miss");let q=this.#M(e,M,k,w);return q.__returned=q}else{let q=this.#e[M];if(this.#t(q)){let te=i&&q.__staleWhileFetching!==void 0;return I&&(I.fetch="inflight",te&&(I.returnedStale=!0)),te?q.__staleWhileFetching:q.__returned=q}let G=this.#p(M);if(!S&&!G)return I&&(I.fetch="hit"),this.#P(M),n&&this.#R(M),I&&this.#I(I,M),q;let F=this.#M(e,M,k,w),$=F.__staleWhileFetching!==void 0&&i;return I&&(I.fetch=G?"stale":"refresh",$&&G&&(I.returnedStale=!0)),$?F.__staleWhileFetching:F.__returned=F}}async forceFetch(e,r={}){let i=await this.fetch(e,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,r={}){let i=this.#B;if(!i)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:o,...s}=r,l=this.get(e,s);if(!o&&l!==void 0)return l;let u=i(e,l,{options:s,context:n});return this.set(e,u,s),u}get(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,l=this.#i.get(e);if(l!==void 0){let u=this.#e[l],f=this.#t(u);return s&&this.#I(s,l),this.#p(l)?(s&&(s.get="stale"),f?(s&&i&&u.__staleWhileFetching!==void 0&&(s.returnedStale=!0),i?u.__staleWhileFetching:void 0):(o||this.#A(e,"expire"),s&&i&&(s.returnedStale=!0),i?u:void 0)):(s&&(s.get="hit"),f?u.__staleWhileFetching:(this.#P(l),n&&this.#R(l),u))}else s&&(s.get="miss")}#D(e,r){this.#h[r]=e,this.#u[e]=r}#P(e){e!==this.#s&&(e===this.#l?this.#l=this.#u[e]:this.#D(this.#h[e],this.#u[e]),this.#D(this.#s,e),this.#s=e)}delete(e){return this.#A(e,"delete")}#A(e,r){let i=!1;if(this.#n!==0){let n=this.#i.get(e);if(n!==void 0)if(i=!0,this.#n===1)this.#j(r);else{this.#C(n);let o=this.#e[n];if(this.#t(o)?o.__abortController.abort(new Error("deleted")):(this.#v||this.#c)&&(this.#v&&this.#g?.(o,e,r),this.#c&&this.#o?.push([o,e,r])),this.#i.delete(e),this.#r[n]=void 0,this.#e[n]=void 0,n===this.#s)this.#s=this.#h[n];else if(n===this.#l)this.#l=this.#u[n];else{let s=this.#h[n];this.#u[s]=this.#u[n];let l=this.#u[n];this.#h[l]=this.#h[n]}this.#n--,this.#w.push(n)}}if(this.#c&&this.#o?.length){let n=this.#o,o;for(;o=n?.shift();)this.#b?.(...o)}return i}clear(){return this.#j("delete")}#j(e){for(let r of this.#S({allowStale:!0})){let i=this.#e[r];if(this.#t(i))i.__abortController.abort(new Error("deleted"));else{let n=this.#r[r];this.#v&&this.#g?.(i,n,e),this.#c&&this.#o?.push([i,n,e])}}if(this.#i.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#d&&this.#m&&(this.#d.fill(0),this.#m.fill(0)),this.#_&&this.#_.fill(0),this.#l=0,this.#s=0,this.#w.length=0,this.#y=0,this.#n=0,this.#c&&this.#o){let r=this.#o,i;for(;i=r?.shift();)this.#b?.(...i)}}};Pn.LRUCache=tl});var nt=O($t=>{"use strict";_();v();m();Object.defineProperty($t,"t",{value:!0});$t.ContainerIterator=$t.Container=$t.Base=void 0;var rl=class{constructor(e=0){this.iteratorType=e}equals(e){return this.o===e.o}};$t.ContainerIterator=rl;var kn=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};$t.Base=kn;var il=class extends kn{};$t.Container=il});var Qd=O(Bn=>{"use strict";_();v();m();Object.defineProperty(Bn,"t",{value:!0});Bn.default=void 0;var Pv=nt(),nl=class extends Pv.Base{constructor(e=[]){super(),this.S=[];let r=this;e.forEach(function(i){r.push(i)})}clear(){this.i=0,this.S=[]}push(e){return this.S.push(e),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},kv=nl;Bn.default=kv});var Yd=O(xn=>{"use strict";_();v();m();Object.defineProperty(xn,"t",{value:!0});xn.default=void 0;var Bv=nt(),sl=class extends Bv.Base{constructor(e=[]){super(),this.j=0,this.q=[];let r=this;e.forEach(function(i){r.push(i)})}clear(){this.q=[],this.i=this.j=0}push(e){let r=this.q.length;if(this.j/r>.5&&this.j+this.i>=r&&r>4096){let i=this.i;for(let n=0;n<i;++n)this.q[n]=this.q[this.j+n];this.j=0,this.q[this.i]=e}else this.q[this.j+this.i]=e;return++this.i}pop(){if(this.i===0)return;let e=this.q[this.j++];return this.i-=1,e}front(){if(this.i!==0)return this.q[this.j]}},xv=sl;xn.default=xv});var Jd=O(On=>{"use strict";_();v();m();Object.defineProperty(On,"t",{value:!0});On.default=void 0;var Ov=nt(),ol=class extends Ov.Base{constructor(e=[],r=function(n,o){return n>o?-1:n<o?1:0},i=!0){if(super(),this.v=r,Array.isArray(e))this.C=i?[...e]:e;else{this.C=[];let o=this;e.forEach(function(s){o.C.push(s)})}this.i=this.C.length;let n=this.i>>1;for(let o=this.i-1>>1;o>=0;--o)this.k(o,n)}m(e){let r=this.C[e];for(;e>0;){let i=e-1>>1,n=this.C[i];if(this.v(n,r)<=0)break;this.C[e]=n,e=i}this.C[e]=r}k(e,r){let i=this.C[e];for(;e<r;){let n=e<<1|1,o=n+1,s=this.C[n];if(o<this.i&&this.v(s,this.C[o])>0&&(n=o,s=this.C[o]),this.v(s,i)>=0)break;this.C[e]=s,e=n}this.C[e]=i}clear(){this.i=0,this.C.length=0}push(e){this.C.push(e),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let e=this.C[0],r=this.C.pop();return this.i-=1,this.i&&(this.C[0]=r,this.k(0,this.i>>1)),e}top(){return this.C[0]}find(e){return this.C.indexOf(e)>=0}remove(e){let r=this.C.indexOf(e);return r<0?!1:(r===0?this.pop():r===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(r,1,this.C.pop()),this.i-=1,this.m(r),this.k(r,this.i>>1)),!0)}updateItem(e){let r=this.C.indexOf(e);return r<0?!1:(this.m(r),this.k(r,this.i>>1),!0)}toArray(){return[...this.C]}},Mv=ol;On.default=Mv});var Ln=O(Mn=>{"use strict";_();v();m();Object.defineProperty(Mn,"t",{value:!0});Mn.default=void 0;var Lv=nt(),ll=class extends Lv.Container{},qv=ll;Mn.default=qv});var st=O(al=>{"use strict";_();v();m();Object.defineProperty(al,"t",{value:!0});al.throwIteratorAccessError=Uv;function Uv(){throw new RangeError("Iterator access denied!")}});var cl=O(Un=>{"use strict";_();v();m();Object.defineProperty(Un,"t",{value:!0});Un.RandomIterator=void 0;var Nv=nt(),qn=st(),ul=class extends Nv.ContainerIterator{constructor(e,r){super(r),this.o=e,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,qn.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,qn.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,qn.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,qn.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(e){this.container.setElementByPos(this.o,e)}};Un.RandomIterator=ul});var Xd=O(Nn=>{"use strict";_();v();m();Object.defineProperty(Nn,"t",{value:!0});Nn.default=void 0;var Dv=Fv(Ln()),jv=cl();function Fv(t){return t&&t.t?t:{default:t}}var fr=class t extends jv.RandomIterator{constructor(e,r,i){super(e,i),this.container=r}copy(){return new t(this.o,this.container,this.iteratorType)}},fl=class extends Dv.default{constructor(e=[],r=!0){if(super(),Array.isArray(e))this.J=r?[...e]:e,this.i=e.length;else{this.J=[];let i=this;e.forEach(function(n){i.pushBack(n)})}}clear(){this.i=0,this.J.length=0}begin(){return new fr(0,this)}end(){return new fr(this.i,this)}rBegin(){return new fr(this.i-1,this,1)}rEnd(){return new fr(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J[e]}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J.splice(e,1),this.i-=1,this.i}eraseElementByValue(e){let r=0;for(let i=0;i<this.i;++i)this.J[i]!==e&&(this.J[r++]=this.J[i]);return this.i=this.J.length=r,this.i}eraseElementByIterator(e){let r=e.o;return e=e.next(),this.eraseElementByPos(r),e}pushBack(e){return this.J.push(e),this.i+=1,this.i}popBack(){if(this.i!==0)return this.i-=1,this.J.pop()}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;this.J[e]=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;return this.J.splice(e,0,...new Array(i).fill(r)),this.i+=i,this.i}find(e){for(let r=0;r<this.i;++r)if(this.J[r]===e)return new fr(r,this);return this.end()}reverse(){this.J.reverse()}unique(){let e=1;for(let r=1;r<this.i;++r)this.J[r]!==this.J[r-1]&&(this.J[e++]=this.J[r]);return this.i=this.J.length=e,this.i}sort(e){this.J.sort(e)}forEach(e){for(let r=0;r<this.i;++r)e(this.J[r],r,this)}[Symbol.iterator](){return function*(){yield*this.J}.bind(this)()}},Wv=fl;Nn.default=Wv});var Zd=O(Dn=>{"use strict";_();v();m();Object.defineProperty(Dn,"t",{value:!0});Dn.default=void 0;var $v=Vv(Ln()),Hv=nt(),hr=st();function Vv(t){return t&&t.t?t:{default:t}}var dr=class t extends Hv.ContainerIterator{constructor(e,r,i,n){super(n),this.o=e,this.h=r,this.container=i,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,hr.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,hr.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,hr.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,hr.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,hr.throwIteratorAccessError)(),this.o.l}set pointer(e){this.o===this.h&&(0,hr.throwIteratorAccessError)(),this.o.l=e}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},hl=class extends $v.default{constructor(e=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let r=this;e.forEach(function(i){r.pushBack(i)})}V(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1}G(e,r){let i=r.B,n={l:e,L:r,B:i};r.B=n,i.L=n,r===this.h&&(this.p=n),i===this.h&&(this._=n),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new dr(this.p,this.h,this)}end(){return new dr(this.h,this.h,this)}rBegin(){return new dr(this._,this.h,this,1)}rEnd(){return new dr(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.l}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}eraseElementByValue(e){let r=this.p;for(;r!==this.h;)r.l===e&&this.V(r),r=r.B;return this.i}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0,hr.throwIteratorAccessError)(),e=e.next(),this.V(r),e}pushBack(e){return this.G(e,this._),this.i}popBack(){if(this.i===0)return;let e=this._.l;return this.V(this._),e}pushFront(e){return this.G(e,this.h),this.i}popFront(){if(this.i===0)return;let e=this.p.l;return this.V(this.p),e}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;i.l=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(i<=0)return this.i;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else{let n=this.p;for(let s=1;s<e;++s)n=n.B;let o=n.B;for(this.i+=i;i--;)n.B={l:r,L:n},n.B.L=n,n=n.B;n.B=o,o.L=n}return this.i}find(e){let r=this.p;for(;r!==this.h;){if(r.l===e)return new dr(r,this.h,this);r=r.B}return this.end()}reverse(){if(this.i<=1)return;let e=this.p,r=this._,i=0;for(;i<<1<this.i;){let n=e.l;e.l=r.l,r.l=n,e=e.B,r=r.L,i+=1}}unique(){if(this.i<=1)return this.i;let e=this.p;for(;e!==this.h;){let r=e;for(;r.B!==this.h&&r.l===r.B.l;)r=r.B,this.i-=1;e.B=r.B,e.B.L=e,e=e.B}return this.i}sort(e){if(this.i<=1)return;let r=[];this.forEach(function(n){r.push(n)}),r.sort(e);let i=this.p;r.forEach(function(n){i.l=n,i=i.B})}merge(e){let r=this;if(this.i===0)e.forEach(function(i){r.pushBack(i)});else{let i=this.p;e.forEach(function(n){for(;i!==r.h&&i.l<=n;)i=i.B;r.G(n,i.L)})}return this.i}forEach(e){let r=this.p,i=0;for(;r!==this.h;)e(r.l,i++,this),r=r.B}[Symbol.iterator](){return function*(){if(this.i===0)return;let e=this.p;for(;e!==this.h;)yield e.l,e=e.B}.bind(this)()}},zv=hl;Dn.default=zv});var ep=O(jn=>{"use strict";_();v();m();Object.defineProperty(jn,"t",{value:!0});jn.default=void 0;var Kv=Qv(Ln()),Gv=cl();function Qv(t){return t&&t.t?t:{default:t}}var pr=class t extends Gv.RandomIterator{constructor(e,r,i){super(e,i),this.container=r}copy(){return new t(this.o,this.container,this.iteratorType)}},dl=class extends Kv.default{constructor(e=[],r=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let i=(()=>{if(typeof e.length=="number")return e.length;if(typeof e.size=="number")return e.size;if(typeof e.size=="function")return e.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=r,this.P=Math.max(Math.ceil(i/this.F),1);for(let s=0;s<this.P;++s)this.A.push(new Array(this.F));let n=Math.ceil(i/this.F);this.j=this.R=(this.P>>1)-(n>>1),this.D=this.N=this.F-i%this.F>>1;let o=this;e.forEach(function(s){o.pushBack(s)})}T(){let e=[],r=Math.max(this.P>>1,1);for(let i=0;i<r;++i)e[i]=new Array(this.F);for(let i=this.j;i<this.P;++i)e[e.length]=this.A[i];for(let i=0;i<this.R;++i)e[e.length]=this.A[i];e[e.length]=[...this.A[this.R]],this.j=r,this.R=e.length-1;for(let i=0;i<r;++i)e[e.length]=new Array(this.F);this.A=e,this.P=e.length}O(e){let r=this.D+e+1,i=r%this.F,n=i-1,o=this.j+(r-i)/this.F;return i===0&&(o-=1),o%=this.P,n<0&&(n+=this.F),{curNodeBucketIndex:o,curNodePointerIndex:n}}clear(){this.A=[new Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}begin(){return new pr(0,this)}end(){return new pr(this.i,this)}rBegin(){return new pr(this.i-1,this,1)}rEnd(){return new pr(-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(e){return this.i&&(this.N<this.F-1?this.N+=1:this.R<this.P-1?(this.R+=1,this.N=0):(this.R=0,this.N=0),this.R===this.j&&this.N===this.D&&this.T()),this.i+=1,this.A[this.R][this.N]=e,this.i}popBack(){if(this.i===0)return;let e=this.A[this.R][this.N];return this.i!==1&&(this.N>0?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,e}pushFront(e){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]=e,this.i}popFront(){if(this.i===0)return;let e=this.A[this.j][this.D];return this.i!==1&&(this.D<this.F-1?this.D+=1:this.j<this.P-1?(this.j+=1,this.D=0):(this.j=0,this.D=0)),this.i-=1,e}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:r,curNodePointerIndex:i}=this.O(e);return this.A[r][i]}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:i,curNodePointerIndex:n}=this.O(e);this.A[i][n]=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else{let n=[];for(let o=e;o<this.i;++o)n.push(this.getElementByPos(o));this.cut(e-1);for(let o=0;o<i;++o)this.pushBack(r);for(let o=0;o<n.length;++o)this.pushBack(n[o])}return this.i}cut(e){if(e<0)return this.clear(),0;let{curNodeBucketIndex:r,curNodePointerIndex:i}=this.O(e);return this.R=r,this.N=i,this.i=e+1,this.i}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;if(e===0)this.popFront();else if(e===this.i-1)this.popBack();else{let r=[];for(let n=e+1;n<this.i;++n)r.push(this.getElementByPos(n));this.cut(e),this.popBack();let i=this;r.forEach(function(n){i.pushBack(n)})}return this.i}eraseElementByValue(e){if(this.i===0)return 0;let r=[];for(let n=0;n<this.i;++n){let o=this.getElementByPos(n);o!==e&&r.push(o)}let i=r.length;for(let n=0;n<i;++n)this.setElementByPos(n,r[n]);return this.cut(i-1)}eraseElementByIterator(e){let r=e.o;return this.eraseElementByPos(r),e=e.next(),e}find(e){for(let r=0;r<this.i;++r)if(this.getElementByPos(r)===e)return new pr(r,this);return this.end()}reverse(){let e=0,r=this.i-1;for(;e<r;){let i=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(r)),this.setElementByPos(r,i),e+=1,r-=1}}unique(){if(this.i<=1)return this.i;let e=1,r=this.getElementByPos(0);for(let i=1;i<this.i;++i){let n=this.getElementByPos(i);n!==r&&(r=n,this.setElementByPos(e++,n))}for(;this.i>e;)this.popBack();return this.i}sort(e){let r=[];for(let i=0;i<this.i;++i)r.push(this.getElementByPos(i));r.sort(e);for(let i=0;i<this.i;++i)this.setElementByPos(i,r[i])}shrinkToFit(){if(this.i===0)return;let e=[];this.forEach(function(r){e.push(r)}),this.P=Math.max(Math.ceil(this.i/this.F),1),this.i=this.j=this.R=this.D=this.N=0,this.A=[];for(let r=0;r<this.P;++r)this.A.push(new Array(this.F));for(let r=0;r<e.length;++r)this.pushBack(e[r])}forEach(e){for(let r=0;r<this.i;++r)e(this.getElementByPos(r),r,this)}[Symbol.iterator](){return function*(){for(let e=0;e<this.i;++e)yield this.getElementByPos(e)}.bind(this)()}},Yv=dl;jn.default=Yv});var tp=O(Qr=>{"use strict";_();v();m();Object.defineProperty(Qr,"t",{value:!0});Qr.TreeNodeEnableIndex=Qr.TreeNode=void 0;var Fn=class{constructor(e,r){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=e,this.l=r}L(){let e=this;if(e.ee===1&&e.tt.tt===e)e=e.W;else if(e.U)for(e=e.U;e.W;)e=e.W;else{let r=e.tt;for(;r.U===e;)e=r,r=e.tt;e=r}return e}B(){let e=this;if(e.W){for(e=e.W;e.U;)e=e.U;return e}else{let r=e.tt;for(;r.W===e;)e=r,r=e.tt;return e.W!==r?r:e}}te(){let e=this.tt,r=this.W,i=r.U;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.U=this,this.tt=r,this.W=i,i&&(i.tt=this),r}se(){let e=this.tt,r=this.U,i=r.W;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.W=this,this.tt=r,this.U=i,i&&(i.tt=this),r}};Qr.TreeNode=Fn;var pl=class extends Fn{constructor(){super(...arguments),this.rt=1}te(){let e=super.te();return this.ie(),e.ie(),e}se(){let e=super.se();return this.ie(),e.ie(),e}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};Qr.TreeNodeEnableIndex=pl});var bl=O(Wn=>{"use strict";_();v();m();Object.defineProperty(Wn,"t",{value:!0});Wn.default=void 0;var rp=tp(),Jv=nt(),ip=st(),gl=class extends Jv.Container{constructor(e=function(i,n){return i<n?-1:i>n?1:0},r=!1){super(),this.Y=void 0,this.v=e,r?(this.re=rp.TreeNodeEnableIndex,this.M=function(i,n,o){let s=this.ne(i,n,o);if(s){let l=s.tt;for(;l!==this.h;)l.rt+=1,l=l.tt;let u=this.he(s);if(u){let{parentNode:f,grandParent:d,curNode:h}=u;f.ie(),d.ie(),h.ie()}}return this.i},this.V=function(i){let n=this.fe(i);for(;n!==this.h;)n.rt-=1,n=n.tt}):(this.re=rp.TreeNode,this.M=function(i,n,o){let s=this.ne(i,n,o);return s&&this.he(s),this.i},this.V=this.fe),this.h=new this.re}X(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)e=e.W;else if(n>0)i=e,e=e.U;else return e}return i}Z(e,r){let i=this.h;for(;e;)this.v(e.u,r)<=0?e=e.W:(i=e,e=e.U);return i}$(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)i=e,e=e.W;else if(n>0)e=e.U;else return e}return i}rr(e,r){let i=this.h;for(;e;)this.v(e.u,r)<0?(i=e,e=e.W):e=e.U;return i}ue(e){for(;;){let r=e.tt;if(r===this.h)return;if(e.ee===1){e.ee=0;return}if(e===r.U){let i=r.W;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.te():r.te();else if(i.W&&i.W.ee===1){i.ee=r.ee,r.ee=0,i.W.ee=0,r===this.Y?this.Y=r.te():r.te();return}else i.U&&i.U.ee===1?(i.ee=1,i.U.ee=0,i.se()):(i.ee=1,e=r)}else{let i=r.U;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.se():r.se();else if(i.U&&i.U.ee===1){i.ee=r.ee,r.ee=0,i.U.ee=0,r===this.Y?this.Y=r.se():r.se();return}else i.W&&i.W.ee===1?(i.ee=1,i.W.ee=0,i.te()):(i.ee=1,e=r)}}}fe(e){if(this.i===1)return this.clear(),this.h;let r=e;for(;r.U||r.W;){if(r.W)for(r=r.W;r.U;)r=r.U;else r=r.U;[e.u,r.u]=[r.u,e.u],[e.l,r.l]=[r.l,e.l],e=r}this.h.U===r?this.h.U=r.tt:this.h.W===r&&(this.h.W=r.tt),this.ue(r);let i=r.tt;return r===i.U?i.U=void 0:i.W=void 0,this.i-=1,this.Y.ee=0,i}oe(e,r){return e===void 0?!1:this.oe(e.U,r)||r(e)?!0:this.oe(e.W,r)}he(e){for(;;){let r=e.tt;if(r.ee===0)return;let i=r.tt;if(r===i.U){let n=i.W;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.W){if(e.ee=0,e.U&&(e.U.tt=r),e.W&&(e.W.tt=i),r.W=e.U,i.U=e.W,e.U=r,e.W=i,i===this.Y)this.Y=e,this.h.tt=e;else{let o=i.tt;o.U===i?o.U=e:o.W=e}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.se():i.se(),i.ee=1}else{let n=i.U;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.U){if(e.ee=0,e.U&&(e.U.tt=i),e.W&&(e.W.tt=r),i.W=e.U,r.U=e.W,e.U=i,e.W=r,i===this.Y)this.Y=e,this.h.tt=e;else{let o=i.tt;o.U===i?o.U=e:o.W=e}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.te():i.te(),i.ee=1}return}}ne(e,r,i){if(this.Y===void 0){this.i+=1,this.Y=new this.re(e,r),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 n,o=this.h.U,s=this.v(o.u,e);if(s===0){o.l=r;return}else if(s>0)o.U=new this.re(e,r),o.U.tt=o,n=o.U,this.h.U=n;else{let l=this.h.W,u=this.v(l.u,e);if(u===0){l.l=r;return}else if(u<0)l.W=new this.re(e,r),l.W.tt=l,n=l.W,this.h.W=n;else{if(i!==void 0){let f=i.o;if(f!==this.h){let d=this.v(f.u,e);if(d===0){f.l=r;return}else if(d>0){let h=f.L(),g=this.v(h.u,e);if(g===0){h.l=r;return}else g<0&&(n=new this.re(e,r),h.W===void 0?(h.W=n,n.tt=h):(f.U=n,n.tt=f))}}}if(n===void 0)for(n=this.Y;;){let f=this.v(n.u,e);if(f>0){if(n.U===void 0){n.U=new this.re(e,r),n.U.tt=n,n=n.U;break}n=n.U}else if(f<0){if(n.W===void 0){n.W=new this.re(e,r),n.W.tt=n,n=n.W;break}n=n.W}else{n.l=r;return}}}}return this.i+=1,n}I(e,r){for(;e;){let i=this.v(e.u,r);if(i<0)e=e.W;else if(i>0)e=e.U;else return e}return e||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(e,r){let i=e.o;if(i===this.h&&(0,ip.throwIteratorAccessError)(),this.i===1)return i.u=r,!0;if(i===this.h.U)return this.v(i.B().u,r)>0?(i.u=r,!0):!1;if(i===this.h.W)return this.v(i.L().u,r)<0?(i.u=r,!0):!1;let n=i.L().u;if(this.v(n,r)>=0)return!1;let o=i.B().u;return this.v(o,r)<=0?!1:(i.u=r,!0)}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=0,i=this;return this.oe(this.Y,function(n){return e===r?(i.V(n),!0):(r+=1,!1)}),this.i}eraseElementByKey(e){if(this.i===0)return!1;let r=this.I(this.Y,e);return r===this.h?!1:(this.V(r),!0)}eraseElementByIterator(e){let r=e.o;r===this.h&&(0,ip.throwIteratorAccessError)();let i=r.W===void 0;return e.iteratorType===0?i&&e.next():(!i||r.U===void 0)&&e.next(),this.V(r),e}forEach(e){let r=0;for(let i of this)e(i,r++,this)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r,i=0;for(let n of this){if(i===e){r=n;break}i+=1}return r}getHeight(){if(this.i===0)return 0;let e=function(r){return r?Math.max(e(r.U),e(r.W))+1:0};return e(this.Y)}},Xv=gl;Wn.default=Xv});var wl=O(Hn=>{"use strict";_();v();m();Object.defineProperty(Hn,"t",{value:!0});Hn.default=void 0;var Zv=nt(),$n=st(),yl=class extends Zv.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,$n.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,$n.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,$n.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,$n.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let e=this.o,r=this.h.tt;if(e===this.h)return r?r.rt-1:0;let i=0;for(e.U&&(i+=e.U.rt);e!==r;){let n=e.tt;e===n.W&&(i+=1,n.U&&(i+=n.U.rt)),e=n}return i}},e1=yl;Hn.default=e1});var sp=O(Vn=>{"use strict";_();v();m();Object.defineProperty(Vn,"t",{value:!0});Vn.default=void 0;var t1=np(bl()),r1=np(wl()),i1=st();function np(t){return t&&t.t?t:{default:t}}var Ve=class t extends r1.default{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){return this.o===this.h&&(0,i1.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},_l=class extends t1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.insert(o)})}*K(e){e!==void 0&&(yield*this.K(e.U),yield e.u,yield*this.K(e.W))}begin(){return new Ve(this.h.U||this.h,this.h,this)}end(){return new Ve(this.h,this.h,this)}rBegin(){return new Ve(this.h.W||this.h,this.h,this,1)}rEnd(){return new Ve(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(e,r){return this.M(e,void 0,r)}find(e){let r=this.I(this.Y,e);return new Ve(r,this.h,this)}lowerBound(e){let r=this.X(this.Y,e);return new Ve(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new Ve(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new Ve(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new Ve(r,this.h,this)}union(e){let r=this;return e.forEach(function(i){r.insert(i)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},n1=_l;Vn.default=n1});var lp=O(zn=>{"use strict";_();v();m();Object.defineProperty(zn,"t",{value:!0});zn.default=void 0;var s1=op(bl()),o1=op(wl()),l1=st();function op(t){return t&&t.t?t:{default:t}}var ze=class t extends o1.default{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){this.o===this.h&&(0,l1.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i==="0")return e.o.u;if(i==="1")return e.o.l},set(r,i,n){if(i!=="1")throw new TypeError("props must be 1");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},ml=class extends s1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.setElement(o[0],o[1])})}*K(e){e!==void 0&&(yield*this.K(e.U),yield[e.u,e.l],yield*this.K(e.W))}begin(){return new ze(this.h.U||this.h,this.h,this)}end(){return new ze(this.h,this.h,this)}rBegin(){return new ze(this.h.W||this.h,this.h,this,1)}rEnd(){return new ze(this.h,this.h,this,1)}front(){if(this.i===0)return;let e=this.h.U;return[e.u,e.l]}back(){if(this.i===0)return;let e=this.h.W;return[e.u,e.l]}lowerBound(e){let r=this.X(this.Y,e);return new ze(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new ze(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new ze(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new ze(r,this.h,this)}setElement(e,r,i){return this.M(e,r,i)}find(e){let r=this.I(this.Y,e);return new ze(r,this.h,this)}getElementByKey(e){return this.I(this.Y,e).l}union(e){let r=this;return e.forEach(function(i){r.setElement(i[0],i[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},a1=ml;zn.default=a1});var El=O(vl=>{"use strict";_();v();m();Object.defineProperty(vl,"t",{value:!0});vl.default=u1;function u1(t){let e=typeof t;return e==="object"&&t!==null||e==="function"}});var Tl=O(Yr=>{"use strict";_();v();m();Object.defineProperty(Yr,"t",{value:!0});Yr.HashContainerIterator=Yr.HashContainer=void 0;var ap=nt(),Sl=c1(El()),Ai=st();function c1(t){return t&&t.t?t:{default:t}}var Al=class extends ap.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,Ai.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,Ai.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,Ai.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,Ai.throwIteratorAccessError)(),this.o=this.o.L,this})}};Yr.HashContainerIterator=Al;var Il=class extends ap.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(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1}M(e,r,i){i===void 0&&(i=(0,Sl.default)(e));let n;if(i){let o=e[this.HASH_TAG];if(o!==void 0)return this.H[o].l=r,this.i;Object.defineProperty(e,this.HASH_TAG,{value:this.H.length,configurable:!0}),n={u:e,l:r,L:this._,B:this.h},this.H.push(n)}else{let o=this.g[e];if(o)return o.l=r,this.i;n={u:e,l:r,L:this._,B:this.h},this.g[e]=n}return this.i===0?(this.p=n,this.h.B=n):this._.B=n,this._=n,this.h.L=n,++this.i}I(e,r){if(r===void 0&&(r=(0,Sl.default)(e)),r){let i=e[this.HASH_TAG];return i===void 0?this.h:this.H[i]}else return this.g[e]||this.h}clear(){let e=this.HASH_TAG;this.H.forEach(function(r){delete r.u[e]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(e,r){let i;if(r===void 0&&(r=(0,Sl.default)(e)),r){let n=e[this.HASH_TAG];if(n===void 0)return!1;delete e[this.HASH_TAG],i=this.H[n],delete this.H[n]}else{if(i=this.g[e],i===void 0)return!1;delete this.g[e]}return this.V(i),!0}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0,Ai.throwIteratorAccessError)(),this.V(r),e.next()}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}};Yr.HashContainer=Il});var cp=O(Kn=>{"use strict";_();v();m();Object.defineProperty(Kn,"t",{value:!0});Kn.default=void 0;var up=Tl(),f1=st(),gr=class t extends up.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){return this.o===this.h&&(0,f1.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Rl=class extends up.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.insert(i)})}begin(){return new gr(this.p,this.h,this)}end(){return new gr(this.h,this.h,this)}rBegin(){return new gr(this._,this.h,this,1)}rEnd(){return new gr(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(e,r){return this.M(e,void 0,r)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.u}find(e,r){let i=this.I(e,r);return new gr(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e(i.u,r++,this),i=i.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield e.u,e=e.B}.bind(this)()}},h1=Rl;Kn.default=h1});var hp=O(Gn=>{"use strict";_();v();m();Object.defineProperty(Gn,"t",{value:!0});Gn.default=void 0;var fp=Tl(),d1=g1(El()),p1=st();function g1(t){return t&&t.t?t:{default:t}}var br=class t extends fp.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){this.o===this.h&&(0,p1.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i==="0")return e.o.u;if(i==="1")return e.o.l},set(r,i,n){if(i!=="1")throw new TypeError("props must be 1");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Cl=class extends fp.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.setElement(i[0],i[1])})}begin(){return new br(this.p,this.h,this)}end(){return new br(this.h,this.h,this)}rBegin(){return new br(this._,this.h,this,1)}rEnd(){return new br(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(e,r,i){return this.M(e,r,i)}getElementByKey(e,r){if(r===void 0&&(r=(0,d1.default)(e)),r){let n=e[this.HASH_TAG];return n!==void 0?this.H[n].l:void 0}let i=this.g[e];return i?i.l:void 0}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return[r.u,r.l]}find(e,r){let i=this.I(e,r);return new br(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e([i.u,i.l],r++,this),i=i.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield[e.u,e.l],e=e.B}.bind(this)()}},b1=Cl;Gn.default=b1});var dp=O(Ne=>{"use strict";_();v();m();Object.defineProperty(Ne,"t",{value:!0});Object.defineProperty(Ne,"Deque",{enumerable:!0,get:function(){return E1.default}});Object.defineProperty(Ne,"HashMap",{enumerable:!0,get:function(){return T1.default}});Object.defineProperty(Ne,"HashSet",{enumerable:!0,get:function(){return I1.default}});Object.defineProperty(Ne,"LinkList",{enumerable:!0,get:function(){return v1.default}});Object.defineProperty(Ne,"OrderedMap",{enumerable:!0,get:function(){return A1.default}});Object.defineProperty(Ne,"OrderedSet",{enumerable:!0,get:function(){return S1.default}});Object.defineProperty(Ne,"PriorityQueue",{enumerable:!0,get:function(){return _1.default}});Object.defineProperty(Ne,"Queue",{enumerable:!0,get:function(){return w1.default}});Object.defineProperty(Ne,"Stack",{enumerable:!0,get:function(){return y1.default}});Object.defineProperty(Ne,"Vector",{enumerable:!0,get:function(){return m1.default}});var y1=ot(Qd()),w1=ot(Yd()),_1=ot(Jd()),m1=ot(Xd()),v1=ot(Zd()),E1=ot(ep()),S1=ot(sp()),A1=ot(lp()),I1=ot(cp()),T1=ot(hp());function ot(t){return t&&t.t?t:{default:t}}});var gp=O((HU,pp)=>{"use strict";_();v();m();var R1=dp().OrderedSet,lt=it()("number-allocator:trace"),C1=it()("number-allocator:error");function Re(t,e){this.low=t,this.high=e}Re.prototype.equals=function(t){return this.low===t.low&&this.high===t.high};Re.prototype.compare=function(t){return this.low<t.low&&this.high<t.low?-1:t.low<this.low&&t.high<this.low?1:0};function at(t,e){if(!(this instanceof at))return new at(t,e);this.min=t,this.max=e,this.ss=new R1([],(r,i)=>r.compare(i)),lt("Create"),this.clear()}at.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low};at.prototype.alloc=function(){if(this.ss.size()===0)return lt("alloc():empty"),null;let t=this.ss.begin(),e=t.pointer.low,r=t.pointer.high,i=e;return i+1<=r?this.ss.updateKeyByIterator(t,new Re(e+1,r)):this.ss.eraseElementByPos(0),lt("alloc():"+i),i};at.prototype.use=function(t){let e=new Re(t,t),r=this.ss.lowerBound(e);if(!r.equals(this.ss.end())){let i=r.pointer.low,n=r.pointer.high;return r.pointer.equals(e)?(this.ss.eraseElementByIterator(r),lt("use():"+t),!0):i>t?!1:i===t?(this.ss.updateKeyByIterator(r,new Re(i+1,n)),lt("use():"+t),!0):n===t?(this.ss.updateKeyByIterator(r,new Re(i,n-1)),lt("use():"+t),!0):(this.ss.updateKeyByIterator(r,new Re(t+1,n)),this.ss.insert(new Re(i,t-1)),lt("use():"+t),!0)}return lt("use():failed"),!1};at.prototype.free=function(t){if(t<this.min||t>this.max){C1("free():"+t+" is out of range");return}let e=new Re(t,t),r=this.ss.upperBound(e);if(r.equals(this.ss.end())){if(r.equals(this.ss.begin())){this.ss.insert(e);return}r.pre();let i=r.pointer.high;r.pointer.high+1===t?this.ss.updateKeyByIterator(r,new Re(i,t)):this.ss.insert(e)}else if(r.equals(this.ss.begin()))if(t+1===r.pointer.low){let i=r.pointer.high;this.ss.updateKeyByIterator(r,new Re(t,i))}else this.ss.insert(e);else{let i=r.pointer.low,n=r.pointer.high;r.pre();let o=r.pointer.low;r.pointer.high+1===t?t+1===i?(this.ss.eraseElementByIterator(r),this.ss.updateKeyByIterator(r,new Re(o,n))):this.ss.updateKeyByIterator(r,new Re(o,t)):t+1===i?(this.ss.eraseElementByIterator(r.next()),this.ss.insert(new Re(t,n))):this.ss.insert(e)}lt("free():"+t)};at.prototype.clear=function(){lt("clear()"),this.ss.clear(),this.ss.insert(new Re(this.min,this.max))};at.prototype.intervalCount=function(){return this.ss.size()};at.prototype.dump=function(){console.log("length:"+this.ss.size());for(let t of this.ss)console.log(t)};pp.exports=at});var Pl=O((eN,bp)=>{_();v();m();var P1=gp();bp.exports.NumberAllocator=P1});var yp=O(Bl=>{"use strict";_();v();m();Object.defineProperty(Bl,"__esModule",{value:!0});var k1=Gd(),B1=Pl(),kl=class{constructor(e){e>0&&(this.aliasToTopic=new k1.LRUCache({max:e}),this.topicToAlias={},this.numberAllocator=new B1.NumberAllocator(1,e),this.max=e,this.length=0)}put(e,r){if(r===0||r>this.max)return!1;let i=this.aliasToTopic.get(r);return i&&delete this.topicToAlias[i],this.aliasToTopic.set(r,e),this.topicToAlias[e]=r,this.numberAllocator.use(r),this.length=this.aliasToTopic.size,!0}getTopicByAlias(e){return this.aliasToTopic.get(e)}getAliasByTopic(e){let r=this.topicToAlias[e];return typeof r<"u"&&this.aliasToTopic.get(r),r}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){let e=this.numberAllocator.firstVacant();return e||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};Bl.default=kl});var wp=O(Ii=>{"use strict";_();v();m();var x1=Ii&&Ii.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ii,"__esModule",{value:!0});var O1=Si(),M1=x1(yp()),L1=cr(),q1=(t,e)=>{t.log("_handleConnack");let{options:r}=t,n=r.protocolVersion===5?e.reasonCode:e.returnCode;if(clearTimeout(t.connackTimer),delete t.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535){t.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}e.properties.topicAliasMaximum>0&&(t.topicAliasSend=new M1.default(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&r.keepalive&&(r.keepalive=e.properties.serverKeepAlive),e.properties.maximumPacketSize&&(r.properties||(r.properties={}),r.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(n===0)t.reconnecting=!1,t._onConnect(e);else if(n>0){let o=new L1.ErrorWithReasonCode(`Connection refused: ${O1.ReasonCodes[n]}`,n);t.emit("error",o),t.options.reconnectOnConnackError&&t._cleanUp(!0)}};Ii.default=q1});var _p=O(xl=>{"use strict";_();v();m();Object.defineProperty(xl,"__esModule",{value:!0});var U1=(t,e,r)=>{t.log("handling pubrel packet");let i=typeof r<"u"?r:t.noop,{messageId:n}=e,o={cmd:"pubcomp",messageId:n};t.incomingStore.get(e,(s,l)=>{s?t._sendPacket(o,i):(t.emit("message",l.topic,l.payload,l),t.handleMessage(l,u=>{if(u)return i(u);t.incomingStore.del(l,t.noop),t._sendPacket(o,i)}))})};xl.default=U1});var mp=O(Ti=>{"use strict";_();v();m();var Ri=Ti&&Ti.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ti,"__esModule",{value:!0});var N1=Ri(Dd()),D1=Ri($d()),j1=Ri(wp()),F1=Ri(Si()),W1=Ri(_p()),$1=(t,e,r)=>{let{options:i}=t;if(i.protocolVersion===5&&i.properties&&i.properties.maximumPacketSize&&i.properties.maximumPacketSize<e.length)return t.emit("error",new Error(`exceeding packets size ${e.cmd}`)),t.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),t;switch(t.log("_handlePacket :: emitting packetreceive"),t.emit("packetreceive",e),e.cmd){case"publish":(0,N1.default)(t,e,r);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":t.reschedulePing(),(0,F1.default)(t,e),r();break;case"pubrel":t.reschedulePing(),(0,W1.default)(t,e,r);break;case"connack":(0,j1.default)(t,e),r();break;case"auth":t.reschedulePing(),(0,D1.default)(t,e),r();break;case"pingresp":t.log("_handlePacket :: received pingresp"),t.reschedulePing(!0),r();break;case"disconnect":t.emit("disconnect",e),r();break;default:t.log("_handlePacket :: unknown command"),r();break}};Ti.default=$1});var vp=O(Jr=>{"use strict";_();v();m();var H1=Jr&&Jr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Jr,"__esModule",{value:!0});Jr.TypedEventEmitter=void 0;var V1=H1((Ot(),Q(xt))),z1=cr(),Qn=class{};Jr.TypedEventEmitter=Qn;(0,z1.applyMixin)(Qn,V1.default)});var Ci=O(yr=>{"use strict";_();v();m();Object.defineProperty(yr,"__esModule",{value:!0});yr.isReactNativeBrowser=yr.isWebWorker=void 0;var K1=()=>{var t;return typeof window<"u"?typeof navigator<"u"&&((t=navigator.userAgent)===null||t===void 0?void 0:t.toLowerCase().indexOf(" electron/"))>-1&&(!(R===null||R===void 0)&&R.versions)?!Object.prototype.hasOwnProperty.call(R.versions,"electron"):typeof window.document<"u":!1},Ep=()=>{var t,e;return!!(typeof self=="object"&&(!((e=(t=self?.constructor)===null||t===void 0?void 0:t.name)===null||e===void 0)&&e.includes("WorkerGlobalScope")))},Sp=()=>typeof navigator<"u"&&navigator.product==="ReactNative",G1=K1()||Ep()||Sp();yr.isWebWorker=Ep();yr.isReactNativeBrowser=Sp();yr.default=G1});var Ip=O((Yn,Ap)=>{_();v();m();(function(t,e){typeof Yn=="object"&&typeof Ap<"u"?e(Yn):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.fastUniqueNumbers={}))})(Yn,function(t){"use strict";var e=function(g){return function(b){var E=g(b);return b.add(E),E}},r=function(g){return function(b,E){return g.set(b,E),E}},i=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,n=536870912,o=n*2,s=function(g,b){return function(E){var w=b.get(E),S=w===void 0?E.size:w<o?w+1:0;if(!E.has(S))return g(E,S);if(E.size<n){for(;E.has(S);)S=Math.floor(Math.random()*o);return g(E,S)}if(E.size>i)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;E.has(S);)S=Math.floor(Math.random()*i);return g(E,S)}},l=new WeakMap,u=r(l),f=s(u,l),d=e(f);t.addUniqueNumber=d,t.generateUniqueNumber=f})});var Rp=O((Jn,Tp)=>{_();v();m();(function(t,e){typeof Jn=="object"&&typeof Tp<"u"?e(Jn,Ip()):typeof define=="function"&&define.amd?define(["exports","fast-unique-numbers"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.workerTimersBroker={},t.fastUniqueNumbers))})(Jn,function(t,e){"use strict";var r=function(s){return s.method!==void 0&&s.method==="call"},i=function(s){return s.error===null&&typeof s.id=="number"},n=function(s){var l=new Map([[0,function(){}]]),u=new Map([[0,function(){}]]),f=new Map,d=new Worker(s);d.addEventListener("message",function(w){var S=w.data;if(r(S)){var I=S.params,C=I.timerId,k=I.timerType;if(k==="interval"){var M=l.get(C);if(typeof M=="number"){var q=f.get(M);if(q===void 0||q.timerId!==C||q.timerType!==k)throw new Error("The timer is in an undefined state.")}else if(typeof M<"u")M();else throw new Error("The timer is in an undefined state.")}else if(k==="timeout"){var G=u.get(C);if(typeof G=="number"){var F=f.get(G);if(F===void 0||F.timerId!==C||F.timerType!==k)throw new Error("The timer is in an undefined state.")}else if(typeof G<"u")G(),u.delete(C);else throw new Error("The timer is in an undefined state.")}}else if(i(S)){var K=S.id,$=f.get(K);if($===void 0)throw new Error("The timer is in an undefined state.");var te=$.timerId,dt=$.timerType;f.delete(K),dt==="interval"?l.delete(te):u.delete(te)}else{var Fe=S.error.message;throw new Error(Fe)}});var h=function(S){var I=e.generateUniqueNumber(f);f.set(I,{timerId:S,timerType:"interval"}),l.set(S,I),d.postMessage({id:I,method:"clear",params:{timerId:S,timerType:"interval"}})},g=function(S){var I=e.generateUniqueNumber(f);f.set(I,{timerId:S,timerType:"timeout"}),u.set(S,I),d.postMessage({id:I,method:"clear",params:{timerId:S,timerType:"timeout"}})},b=function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=e.generateUniqueNumber(l);return l.set(C,function(){S(),typeof l.get(C)=="function"&&d.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"interval"}})}),d.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"interval"}}),C},E=function(S){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=e.generateUniqueNumber(u);return u.set(C,S),d.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"timeout"}}),C};return{clearInterval:h,clearTimeout:g,setInterval:b,setTimeout:E}};t.load=n})});var Pp=O((Xn,Cp)=>{_();v();m();(function(t,e){typeof Xn=="object"&&typeof Cp<"u"?e(Xn,Rp()):typeof define=="function"&&define.amd?define(["exports","worker-timers-broker"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.workerTimers={},t.workerTimersBroker))})(Xn,function(t,e){"use strict";var r=function(d,h){var g=null;return function(){if(g!==null)return g;var b=new Blob([h],{type:"application/javascript; charset=utf-8"}),E=URL.createObjectURL(b);return g=d(E),setTimeout(function(){return URL.revokeObjectURL(E)}),g}},i=`(()=>{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)})()})();`,n=r(e.load,i),o=function(d){return n().clearInterval(d)},s=function(d){return n().clearTimeout(d)},l=function(){var d;return(d=n()).setInterval.apply(d,arguments)},u=function(){var d;return(d=n()).setTimeout.apply(d,arguments)};t.clearInterval=o,t.clearTimeout=s,t.setInterval=l,t.setTimeout=u})});var Op=O(St=>{"use strict";_();v();m();var Q1=St&&St.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Y1=St&&St.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J1=St&&St.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[i.length]=n);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i=t(e),n=0;n<i.length;n++)i[n]!=="default"&&Q1(r,e,i[n]);return Y1(r,e),r}}();Object.defineProperty(St,"__esModule",{value:!0});var Ol=J1(Ci()),kp=Pp(),Bp={set:kp.setInterval,clear:kp.clearInterval},xp={set:(t,e)=>setInterval(t,e),clear:t=>clearInterval(t)},X1=t=>{switch(t){case"native":return xp;case"worker":return Bp;case"auto":default:return Ol.default&&!Ol.isWebWorker&&!Ol.isReactNativeBrowser?Bp:xp}};St.default=X1});var Ll=O(Pi=>{"use strict";_();v();m();var Z1=Pi&&Pi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pi,"__esModule",{value:!0});var eE=Z1(Op()),Ml=class{get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}constructor(e,r){this.destroyed=!1,this.client=e,this.timer=typeof r=="object"&&"set"in r&&"clear"in r?r:(0,eE.default)(r),this.setKeepalive(e.options.keepalive)}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(e){if(e*=1e3,isNaN(e)||e<=0||e>2147483647)throw new Error(`Keepalive value must be an integer between 0 and 2147483647. Provided value is ${e}`);this._keepalive=e,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${e}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let e=Math.ceil(this._keepalive*1.5);this._keepaliveTimeoutTimestamp=Date.now()+e,this._intervalEvery=Math.ceil(this._keepalive/2),this.timerId=this.timer.set(()=>{this.destroyed||(this.counter+=1,this.counter===2?this.client.sendPing():this.counter>2&&this.client.onKeepaliveTimeout())},this._intervalEvery)}};Pi.default=Ml});var ts=O(Ke=>{"use strict";_();v();m();var tE=Ke&&Ke.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),rE=Ke&&Ke.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Np=Ke&&Ke.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[i.length]=n);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i=t(e),n=0;n<i.length;n++)i[n]!=="default"&&tE(r,e,i[n]);return rE(r,e),r}}(),Ht=Ke&&Ke.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ke,"__esModule",{value:!0});var iE=Ht(Wu()),ql=Ht(Bd()),nE=Ht(zo()),sE=Nt(),Mp=Ht(Ld()),Lp=Np(Ud()),oE=Ht(it()),Xr=Ht(Qo()),lE=Ht(mp()),Zn=cr(),aE=vp(),uE=Ht(Ll()),qp=Np(Ci()),Ul=globalThis.setImmediate||((...t)=>{let e=t.shift();(0,Zn.nextTick)(()=>{e(...t)})}),Up={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0,timerVariant:"auto"},es=class t extends aE.TypedEventEmitter{static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(e,r){super(),this.options=r||{};for(let i in Up)typeof this.options[i]>"u"?this.options[i]=Up[i]:this.options[i]=r[i];this.log=this.options.log||(0,oE.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: version:",t.VERSION),qp.isWebWorker?this.log("MqttClient :: environment","webworker"):this.log("MqttClient :: environment",qp.default?"browser":"node"),this.log("MqttClient :: options.protocol",r.protocol),this.log("MqttClient :: options.protocolVersion",r.protocolVersion),this.log("MqttClient :: options.username",r.username),this.log("MqttClient :: options.keepalive",r.keepalive),this.log("MqttClient :: options.reconnectPeriod",r.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",r.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",r.properties?r.properties.topicAliasMaximum:void 0),this.options.clientId=typeof r.clientId=="string"?r.clientId:t.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=r.protocolVersion===5&&r.customHandleAcks?r.customHandleAcks:(...i)=>{i[3](null,0)},this.options.writeCache||(ql.default.writeToStream.cacheNumbers=!1),this.streamBuilder=e,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new nE.default:this.options.messageIdProvider,this.outgoingStore=r.outgoingStore||new Xr.default,this.incomingStore=r.incomingStore||new Xr.default,this.queueQoSZero=r.queueQoSZero===void 0?!0:r.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.keepaliveManager=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,r.properties&&r.properties.topicAliasMaximum>0&&(r.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new iE.default(r.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:i}=this,n=()=>{let o=i.shift();this.log("deliver :: entry %o",o);let s=null;if(!o){this._resubscribe();return}s=o.packet,this.log("deliver :: call _sendPacket for %o",s);let l=!0;s.messageId&&s.messageId!==0&&(this.messageIdProvider.register(s.messageId)||(l=!1)),l?this._sendPacket(s,u=>{o.cb&&o.cb(u),n()}):(this.log("messageId: %d has already used. The message is skipped and removed.",s.messageId),n())};this.log("connect :: sending queued packets"),n()}),this.on("close",()=>{this.log("close :: connected set to `false`"),this.connected=!1,this.log("close :: clearing connackTimer"),clearTimeout(this.connackTimer),this._destroyKeepaliveManager(),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log("close :: calling _setupReconnect"),this._setupReconnect()}),this.options.manualConnect||(this.log("MqttClient :: setting up stream"),this.connect())}handleAuth(e,r){r()}handleMessage(e,r){r()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var e;let r=new sE.Writable,i=ql.default.parser(this.options),n=null,o=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new Xr.default,this.outgoingStore=this.options.outgoingStore||new Xr.default,this.disconnecting=!1,this.disconnected=!1),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),i.on("packet",d=>{this.log("parser :: on packet push to packets array."),o.push(d)});let s=()=>{this.log("work :: getting next packet in queue");let d=o.shift();if(d)this.log("work :: packet pulled from queue"),(0,lE.default)(this,d,l);else{this.log("work :: no packets in queue");let h=n;n=null,this.log("work :: done flag is %s",!!h),h&&h()}},l=()=>{if(o.length)(0,Zn.nextTick)(s);else{let d=n;n=null,d()}};r._write=(d,h,g)=>{n=g,this.log("writable stream :: parsing buffer"),i.parse(d),s()};let u=d=>{this.log("streamErrorHandler :: error",d.message),d.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",d)):this.noop(d)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(r),this.stream.on("error",u),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 f={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&&(f.will=Object.assign(Object.assign({},this.options.will),{payload:(e=this.options.will)===null||e===void 0?void 0:e.payload})),this.topicAliasRecv&&(f.properties||(f.properties={}),this.topicAliasRecv&&(f.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(f),i.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 d=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(d)}}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(e,r,i,n){this.log("publish :: message `%s` to topic `%s`",r,e);let{options:o}=this;typeof i=="function"&&(n=i,i=null),i=i||{},i=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),i);let{qos:l,retain:u,dup:f,properties:d,cbStorePut:h}=i;if(this._checkDisconnecting(n))return this;let g=()=>{let b=0;if((l===1||l===2)&&(b=this._nextId(),b===null))return this.log("No messageId left"),!1;let E={cmd:"publish",topic:e,payload:r,qos:l,retain:u,messageId:b,dup:f};switch(o.protocolVersion===5&&(E.properties=d),this.log("publish :: qos",l),l){case 1:case 2:this.outgoing[E.messageId]={volatile:!1,cb:n||this.noop},this.log("MqttClient:publish: packet cmd: %s",E.cmd),this._sendPacket(E,void 0,h);break;default:this.log("MqttClient:publish: packet cmd: %s",E.cmd),this._sendPacket(E,n,h);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!g())&&this._storeProcessingQueue.push({invoke:g,cbStorePut:i.cbStorePut,callback:n}),this}publishAsync(e,r,i){return new Promise((n,o)=>{this.publish(e,r,i,(s,l)=>{s?o(s):n(l)})})}subscribe(e,r,i){let n=this.options.protocolVersion;typeof r=="function"&&(i=r),i=i||this.noop;let o=!1,s=[];typeof e=="string"?(e=[e],s=e):Array.isArray(e)?s=e:typeof e=="object"&&(o=e.resubscribe,delete e.resubscribe,s=Object.keys(e));let l=Lp.validateTopics(s);if(l!==null)return Ul(i,new Error(`Invalid topic ${l}`)),this;if(this._checkDisconnecting(i))return this.log("subscribe: discconecting true"),this;let u={qos:0};n===5&&(u.nl=!1,u.rap=!1,u.rh=0),r=Object.assign(Object.assign({},u),r);let f=r.properties,d=[],h=(b,E)=>{if(E=E||r,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,b)||this._resubscribeTopics[b].qos<E.qos||o){let w={topic:b,qos:E.qos};n===5&&(w.nl=E.nl,w.rap=E.rap,w.rh=E.rh,w.properties=f),this.log("subscribe: pushing topic `%s` and qos `%s` to subs list",w.topic,w.qos),d.push(w)}};if(Array.isArray(e)?e.forEach(b=>{this.log("subscribe: array topic %s",b),h(b)}):Object.keys(e).forEach(b=>{this.log("subscribe: object topic %s, %o",b,e[b]),h(b,e[b])}),!d.length)return i(null,[]),this;let g=()=>{let b=this._nextId();if(b===null)return this.log("No messageId left"),!1;let E={cmd:"subscribe",subscriptions:d,messageId:b};if(f&&(E.properties=f),this.options.resubscribe){this.log("subscribe :: resubscribe true");let w=[];d.forEach(S=>{if(this.options.reconnectPeriod>0){let I={qos:S.qos};n===5&&(I.nl=S.nl||!1,I.rap=S.rap||!1,I.rh=S.rh||0,I.properties=S.properties),this._resubscribeTopics[S.topic]=I,w.push(S.topic)}}),this.messageIdToTopic[E.messageId]=w}return this.outgoing[E.messageId]={volatile:!0,cb(w,S){if(!w){let{granted:I}=S;for(let C=0;C<I.length;C+=1)d[C].qos=I[C]}i(w,d,S)}},this.log("subscribe :: call _sendPacket"),this._sendPacket(E),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!g())&&this._storeProcessingQueue.push({invoke:g,callback:i}),this}subscribeAsync(e,r){return new Promise((i,n)=>{this.subscribe(e,r,(o,s)=>{o?n(o):i(s)})})}unsubscribe(e,r,i){typeof e=="string"&&(e=[e]),typeof r=="function"&&(i=r),i=i||this.noop;let n=Lp.validateTopics(e);if(n!==null)return Ul(i,new Error(`Invalid topic ${n}`)),this;if(this._checkDisconnecting(i))return this;let o=()=>{let s=this._nextId();if(s===null)return this.log("No messageId left"),!1;let l={cmd:"unsubscribe",messageId:s,unsubscriptions:[]};return typeof e=="string"?l.unsubscriptions=[e]:Array.isArray(e)&&(l.unsubscriptions=e),this.options.resubscribe&&l.unsubscriptions.forEach(u=>{delete this._resubscribeTopics[u]}),typeof r=="object"&&r.properties&&(l.properties=r.properties),this.outgoing[l.messageId]={volatile:!0,cb:i},this.log("unsubscribe: call _sendPacket"),this._sendPacket(l),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,callback:i}),this}unsubscribeAsync(e,r){return new Promise((i,n)=>{this.unsubscribe(e,r,(o,s)=>{o?n(o):i(s)})})}end(e,r,i){this.log("end :: (%s)",this.options.clientId),(e==null||typeof e!="boolean")&&(i=i||r,r=e,e=!1),typeof r!="object"&&(i=i||r,r=null),this.log("end :: cb? %s",!!i),(!i||typeof i!="function")&&(i=this.noop);let n=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(s=>{this.outgoingStore.close(l=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),i){let u=s||l;this.log("end :: closeStores: invoking callback with args"),i(u)}})}),this._deferredReconnect?this._deferredReconnect():(this.options.reconnectPeriod===0||this.options.manualConnect)&&(this.disconnecting=!1)},o=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,e),this._cleanUp(e,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,Zn.nextTick)(n)},r)};return this.disconnecting?(i(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&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,o,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),o()),this)}endAsync(e,r){return new Promise((i,n)=>{this.end(e,r,o=>{o?n(o):i()})})}removeOutgoingMessage(e){if(this.outgoing[e]){let{cb:r}=this.outgoing[e];this._removeOutgoingAndStoreMessage(e,()=>{r(new Error("Message removed"))})}return this}reconnect(e){this.log("client reconnect");let r=()=>{e?(this.options.incomingStore=e.incomingStore,this.options.outgoingStore=e.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new Xr.default,this.outgoingStore=this.options.outgoingStore||new Xr.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),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(e=>{this.outgoing[e].volatile&&typeof this.outgoing[e].cb=="function"&&(this.outgoing[e].cb(new Error("Connection closed")),delete this.outgoing[e])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(e=>{typeof this.outgoing[e].cb=="function"&&(this.outgoing[e].cb(new Error("Connection closed")),delete this.outgoing[e])}))}_removeTopicAliasAndRecoverTopicName(e){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",r,i),i.length===0){if(typeof r>"u")return new Error("Unregistered Topic Alias");if(i=this.topicAliasSend.getTopicByAlias(r),typeof i>"u")return new Error("Unregistered Topic Alias");e.topic=i}r&&delete e.properties.topicAlias}_checkDisconnecting(e){return this.disconnecting&&(e&&e!==this.noop?e(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(e,r,i={}){if(r&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",r)),this.log("_cleanUp :: forced? %s",e),e)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let n=Object.assign({cmd:"disconnect"},i);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(n,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),Ul(()=>{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._destroyKeepaliveManager(),r&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",r),r())}_storeAndSend(e,r,i){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",e.cmd);let n=e,o;if(n.cmd==="publish"&&(n=(0,Mp.default)(e),o=this._removeTopicAliasAndRecoverTopicName(n),o))return r&&r(o);this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i(),this._writePacket(e,r)})}_applyTopicAlias(e){if(this.options.protocolVersion===5&&e.cmd==="publish"){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.topicAliasSend)if(r){if(i.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",i,r),!this.topicAliasSend.put(i,r)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}else i.length!==0&&(this.options.autoAssignTopicAlias?(r=this.topicAliasSend.getAliasByTopic(i),r?(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",i,r)):(r=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(i,r),e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",i,r))):this.options.autoUseTopicAlias&&(r=this.topicAliasSend.getAliasByTopic(i),r&&(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto use topic: %s - alias: %d",i,r))));else if(r)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}}_noop(e){this.log("noop ::",e)}_writePacket(e,r){this.log("_writePacket :: packet: %O",e),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",e),this.log("_writePacket :: writing to stream");let i=ql.default.writeToStream(e,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",i),!i&&r&&r!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",r)):r&&(this.log("_writePacket :: invoking cb"),r())}_sendPacket(e,r,i,n){this.log("_sendPacket :: (%s) :: start",this.options.clientId),i=i||this.noop,r=r||this.noop;let o=this._applyTopicAlias(e);if(o){r(o);return}if(!this.connected){if(e.cmd==="auth"){this._writePacket(e,r);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(e,r,i);return}if(n){this._writePacket(e,r);return}switch(e.cmd){case"publish":break;case"pubrel":this._storeAndSend(e,r,i);return;default:this._writePacket(e,r);return}switch(e.qos){case 2:case 1:this._storeAndSend(e,r,i);break;case 0:default:this._writePacket(e,r);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(e,r,i){this.log("_storePacket :: packet: %o",e),this.log("_storePacket :: cb? %s",!!r),i=i||this.noop;let n=e;if(n.cmd==="publish"){n=(0,Mp.default)(e);let s=this._removeTopicAliasAndRecoverTopicName(n);if(s)return r&&r(s)}let o=n.qos||0;o===0&&this.queueQoSZero||n.cmd!=="publish"?this.queue.push({packet:n,cb:r}):o>0?(r=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i()})):r&&r(new Error("No connection to broker"))}_setupKeepaliveManager(){this.log("_setupKeepaliveManager :: keepalive %d (seconds)",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new uE.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log("_destroyKeepaliveManager :: destroying keepalive manager"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(e=!1){this.keepaliveManager&&this.options.keepalive&&(e||this.options.reschedulePings)&&this._reschedulePing()}_reschedulePing(){this.log("_reschedulePing :: rescheduling ping"),this.keepaliveManager.reschedule()}sendPing(){this.log("_sendPing :: sending pingreq"),this._sendPacket({cmd:"pingreq"})}onKeepaliveTimeout(){this.emit("error",new Error("Keepalive timeout")),this.log("onKeepaliveTimeout :: calling _cleanUp with force true"),this._cleanUp(!0)}_resubscribe(){this.log("_resubscribe");let e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let r=0;r<e.length;r++){let i={};i[e[r]]=this._resubscribeTopics[e[r]],i.resubscribe=!0,this.subscribe(i,{properties:i[e[r]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1}_onConnect(e){if(this.disconnected){this.emit("connect",e);return}this.connackPacket=e,this.messageIdProvider.clear(),this._setupKeepaliveManager(),this.connected=!0;let r=()=>{let i=this.outgoingStore.createStream(),n=()=>{i.destroy(),i=null,this._flushStoreProcessingQueue(),o()},o=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",n),i.on("error",l=>{o(),this._flushStoreProcessingQueue(),this.removeListener("close",n),this.emit("error",l)});let s=()=>{if(!i)return;let l=i.read(1),u;if(!l){i.once("readable",s);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[l.messageId]){s();return}!this.disconnecting&&!this.reconnectTimer?(u=this.outgoing[l.messageId]?this.outgoing[l.messageId].cb:null,this.outgoing[l.messageId]={volatile:!1,cb(f,d){u&&u(f,d),s()}},this._packetIdsDuringStoreProcessing[l.messageId]=!0,this.messageIdProvider.register(l.messageId)?this._sendPacket(l,void 0,void 0,!0):this.log("messageId: %d has already used.",l.messageId)):i.destroy&&i.destroy()};i.on("end",()=>{let l=!0;for(let u in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[u]){l=!1;break}this.removeListener("close",n),l?(o(),this._invokeAllStoreProcessingQueue(),this.emit("connect",e)):r()}),s()};r()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error("Connection closed")),e.callback&&e.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(e,r){delete this.outgoing[e],this.outgoingStore.del({messageId:e},(i,n)=>{r(i,n),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue()})}};es.VERSION=Zn.MQTTJS_VERSION;Ke.default=es});var Dp=O(Dl=>{"use strict";_();v();m();Object.defineProperty(Dl,"__esModule",{value:!0});var cE=Pl(),Nl=class{constructor(){this.numberAllocator=new cE.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(e){return this.numberAllocator.use(e)}deallocate(e){this.numberAllocator.free(e)}clear(){this.numberAllocator.clear()}};Dl.default=Nl});function wr(t){throw new RangeError(pE[t])}function jp(t,e){let r=t.split("@"),i="";r.length>1&&(i=r[0]+"@",t=r[1]);let n=function(o,s){let l=[],u=o.length;for(;u--;)l[u]=s(o[u]);return l}((t=t.replace(dE,".")).split("."),e).join(".");return i+n}function Hp(t){let e=[],r=0,i=t.length;for(;r<i;){let n=t.charCodeAt(r++);if(n>=55296&&n<=56319&&r<i){let o=t.charCodeAt(r++);(64512&o)==56320?e.push(((1023&n)<<10)+(1023&o)+65536):(e.push(n),r--)}else e.push(n)}return e}var fE,hE,dE,pE,ut,jl,Fp,Vp,Wp,$p,Vt,zp=Ae(()=>{_();v();m();fE=/^xn--/,hE=/[^\0-\x7E]/,dE=/[\x2E\u3002\uFF0E\uFF61]/g,pE={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ut=Math.floor,jl=String.fromCharCode;Fp=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Vp=function(t,e,r){let i=0;for(t=r?ut(t/700):t>>1,t+=ut(t/e);t>455;i+=36)t=ut(t/35);return ut(i+36*t/(t+38))},Wp=function(t){let e=[],r=t.length,i=0,n=128,o=72,s=t.lastIndexOf("-");s<0&&(s=0);for(let u=0;u<s;++u)t.charCodeAt(u)>=128&&wr("not-basic"),e.push(t.charCodeAt(u));for(let u=s>0?s+1:0;u<r;){let f=i;for(let h=1,g=36;;g+=36){u>=r&&wr("invalid-input");let b=(l=t.charCodeAt(u++))-48<10?l-22:l-65<26?l-65:l-97<26?l-97:36;(b>=36||b>ut((2147483647-i)/h))&&wr("overflow"),i+=b*h;let E=g<=o?1:g>=o+26?26:g-o;if(b<E)break;let w=36-E;h>ut(2147483647/w)&&wr("overflow"),h*=w}let d=e.length+1;o=Vp(i-f,d,f==0),ut(i/d)>2147483647-n&&wr("overflow"),n+=ut(i/d),i%=d,e.splice(i++,0,n)}var l;return String.fromCodePoint(...e)},$p=function(t){let e=[],r=(t=Hp(t)).length,i=128,n=0,o=72;for(let u of t)u<128&&e.push(jl(u));let s=e.length,l=s;for(s&&e.push("-");l<r;){let u=2147483647;for(let d of t)d>=i&&d<u&&(u=d);let f=l+1;u-i>ut((2147483647-n)/f)&&wr("overflow"),n+=(u-i)*f,i=u;for(let d of t)if(d<i&&++n>2147483647&&wr("overflow"),d==i){let h=n;for(let g=36;;g+=36){let b=g<=o?1:g>=o+26?26:g-o;if(h<b)break;let E=h-b,w=36-b;e.push(jl(Fp(b+E%w,0))),h=ut(E/w)}e.push(jl(Fp(h,0))),o=Vp(n,f,l==s),n=0,++l}++n,++i}return e.join("")},Vt={version:"2.1.0",ucs2:{decode:Hp,encode:t=>String.fromCodePoint(...t)},decode:Wp,encode:$p,toASCII:function(t){return jp(t,function(e){return hE.test(e)?"xn--"+$p(e):e})},toUnicode:function(t){return jp(t,function(e){return fE.test(e)?Wp(e.slice(4).toLowerCase()):e})}};Vt.decode;Vt.encode;Vt.toASCII;Vt.toUnicode;Vt.ucs2;Vt.version});function gE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var bE,ki,yE,ct,Kp=Ae(()=>{_();v();m();bE=function(t,e,r,i){e=e||"&",r=r||"=";var n={};if(typeof t!="string"||t.length===0)return n;var o=/\+/g;t=t.split(e);var s=1e3;i&&typeof i.maxKeys=="number"&&(s=i.maxKeys);var l=t.length;s>0&&l>s&&(l=s);for(var u=0;u<l;++u){var f,d,h,g,b=t[u].replace(o,"%20"),E=b.indexOf(r);E>=0?(f=b.substr(0,E),d=b.substr(E+1)):(f=b,d=""),h=decodeURIComponent(f),g=decodeURIComponent(d),gE(n,h)?Array.isArray(n[h])?n[h].push(g):n[h]=[n[h],g]:n[h]=g}return n},ki=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},yE=function(t,e,r,i){return e=e||"&",r=r||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map(function(n){var o=encodeURIComponent(ki(n))+r;return Array.isArray(t[n])?t[n].map(function(s){return o+encodeURIComponent(ki(s))}).join(e):o+encodeURIComponent(ki(t[n]))}).join(e):i?encodeURIComponent(ki(i))+r+encodeURIComponent(ki(t)):""},ct={};ct.decode=ct.parse=bE,ct.encode=ct.stringify=yE;ct.decode;ct.encode;ct.parse;ct.stringify});function Fl(){throw new Error("setTimeout has not been defined")}function Wl(){throw new Error("clearTimeout has not been defined")}function Yp(t){if(It===setTimeout)return setTimeout(t,0);if((It===Fl||!It)&&setTimeout)return It=setTimeout,setTimeout(t,0);try{return It(t,0)}catch{try{return It.call(null,t,0)}catch{return It.call(this||ei,t,0)}}}function wE(){Zr&&_r&&(Zr=!1,_r.length?Rt=_r.concat(Rt):rs=-1,Rt.length&&Jp())}function Jp(){if(!Zr){var t=Yp(wE);Zr=!0;for(var e=Rt.length;e;){for(_r=Rt,Rt=[];++rs<e;)_r&&_r[rs].run();rs=-1,e=Rt.length}_r=null,Zr=!1,function(r){if(Tt===clearTimeout)return clearTimeout(r);if((Tt===Wl||!Tt)&&clearTimeout)return Tt=clearTimeout,clearTimeout(r);try{Tt(r)}catch{try{return Tt.call(null,r)}catch{return Tt.call(this||ei,r)}}}(t)}}function Gp(t,e){(this||ei).fun=t,(this||ei).array=e}function At(){}var Qp,It,Tt,ei,fe,_r,Rt,Zr,rs,oe,Xp=Ae(()=>{_();v();m();ei=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,fe=Qp={};(function(){try{It=typeof setTimeout=="function"?setTimeout:Fl}catch{It=Fl}try{Tt=typeof clearTimeout=="function"?clearTimeout:Wl}catch{Tt=Wl}})();Rt=[],Zr=!1,rs=-1;fe.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Rt.push(new Gp(t,e)),Rt.length!==1||Zr||Yp(Jp)},Gp.prototype.run=function(){(this||ei).fun.apply(null,(this||ei).array)},fe.title="browser",fe.browser=!0,fe.env={},fe.argv=[],fe.version="",fe.versions={},fe.on=At,fe.addListener=At,fe.once=At,fe.off=At,fe.removeListener=At,fe.removeAllListeners=At,fe.emit=At,fe.prependListener=At,fe.prependOnceListener=At,fe.listeners=function(t){return[]},fe.binding=function(t){throw new Error("process.binding is not supported")},fe.cwd=function(){return"/"},fe.chdir=function(t){throw new Error("process.chdir is not supported")},fe.umask=function(){return 0};oe=Qp;oe.addListener;oe.argv;oe.binding;oe.browser;oe.chdir;oe.cwd;oe.emit;oe.env;oe.listeners;oe.nextTick;oe.off;oe.on;oe.once;oe.prependListener;oe.prependOnceListener;oe.removeAllListeners;oe.removeListener;oe.title;oe.umask;oe.version;oe.versions});function _E(){if(Zp)return $l;Zp=!0;var t=$l={},e,r;function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=i}catch{e=i}try{typeof clearTimeout=="function"?r=clearTimeout:r=n}catch{r=n}})();function o(w){if(e===setTimeout)return setTimeout(w,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(w,0);try{return e(w,0)}catch{try{return e.call(null,w,0)}catch{return e.call(this||ti,w,0)}}}function s(w){if(r===clearTimeout)return clearTimeout(w);if((r===n||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(w);try{return r(w)}catch{try{return r.call(null,w)}catch{return r.call(this||ti,w)}}}var l=[],u=!1,f,d=-1;function h(){!u||!f||(u=!1,f.length?l=f.concat(l):d=-1,l.length&&g())}function g(){if(!u){var w=o(h);u=!0;for(var S=l.length;S;){for(f=l,l=[];++d<S;)f&&f[d].run();d=-1,S=l.length}f=null,u=!1,s(w)}}t.nextTick=function(w){var S=new Array(arguments.length-1);if(arguments.length>1)for(var I=1;I<arguments.length;I++)S[I-1]=arguments[I];l.push(new b(w,S)),l.length===1&&!u&&o(g)};function b(w,S){(this||ti).fun=w,(this||ti).array=S}b.prototype.run=function(){(this||ti).fun.apply(null,(this||ti).array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function E(){}return t.on=E,t.addListener=E,t.once=E,t.off=E,t.removeListener=E,t.removeAllListeners=E,t.emit=E,t.prependListener=E,t.prependOnceListener=E,t.listeners=function(w){return[]},t.binding=function(w){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(w){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},$l}var $l,Zp,ti,ne,Hl=Ae(()=>{_();v();m();$l={},Zp=!1,ti=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;ne=_E();ne.platform="browser";ne.addListener;ne.argv;ne.binding;ne.browser;ne.chdir;ne.cwd;ne.emit;ne.env;ne.listeners;ne.nextTick;ne.off;ne.on;ne.once;ne.prependListener;ne.prependOnceListener;ne.removeAllListeners;ne.removeListener;ne.title;ne.umask;ne.version;ne.versions});function mE(){if(eg)return Vl;eg=!0;var t=ne;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function r(o,s){for(var l="",u=0,f=-1,d=0,h,g=0;g<=o.length;++g){if(g<o.length)h=o.charCodeAt(g);else{if(h===47)break;h=47}if(h===47){if(!(f===g-1||d===1))if(f!==g-1&&d===2){if(l.length<2||u!==2||l.charCodeAt(l.length-1)!==46||l.charCodeAt(l.length-2)!==46){if(l.length>2){var b=l.lastIndexOf("/");if(b!==l.length-1){b===-1?(l="",u=0):(l=l.slice(0,b),u=l.length-1-l.lastIndexOf("/")),f=g,d=0;continue}}else if(l.length===2||l.length===1){l="",u=0,f=g,d=0;continue}}s&&(l.length>0?l+="/..":l="..",u=2)}else l.length>0?l+="/"+o.slice(f+1,g):l=o.slice(f+1,g),u=g-f-1;f=g,d=0}else h===46&&d!==-1?++d:d=-1}return l}function i(o,s){var l=s.dir||s.root,u=s.base||(s.name||"")+(s.ext||"");return l?l===s.root?l+u:l+o+u:u}var n={resolve:function(){for(var s="",l=!1,u,f=arguments.length-1;f>=-1&&!l;f--){var d;f>=0?d=arguments[f]:(u===void 0&&(u=t.cwd()),d=u),e(d),d.length!==0&&(s=d+"/"+s,l=d.charCodeAt(0)===47)}return s=r(s,!l),l?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(e(s),s.length===0)return".";var l=s.charCodeAt(0)===47,u=s.charCodeAt(s.length-1)===47;return s=r(s,!l),s.length===0&&!l&&(s="."),s.length>0&&u&&(s+="/"),l?"/"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var s,l=0;l<arguments.length;++l){var u=arguments[l];e(u),u.length>0&&(s===void 0?s=u:s+="/"+u)}return s===void 0?".":n.normalize(s)},relative:function(s,l){if(e(s),e(l),s===l||(s=n.resolve(s),l=n.resolve(l),s===l))return"";for(var u=1;u<s.length&&s.charCodeAt(u)===47;++u);for(var f=s.length,d=f-u,h=1;h<l.length&&l.charCodeAt(h)===47;++h);for(var g=l.length,b=g-h,E=d<b?d:b,w=-1,S=0;S<=E;++S){if(S===E){if(b>E){if(l.charCodeAt(h+S)===47)return l.slice(h+S+1);if(S===0)return l.slice(h+S)}else d>E&&(s.charCodeAt(u+S)===47?w=S:S===0&&(w=0));break}var I=s.charCodeAt(u+S),C=l.charCodeAt(h+S);if(I!==C)break;I===47&&(w=S)}var k="";for(S=u+w+1;S<=f;++S)(S===f||s.charCodeAt(S)===47)&&(k.length===0?k+="..":k+="/..");return k.length>0?k+l.slice(h+w):(h+=w,l.charCodeAt(h)===47&&++h,l.slice(h))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return".";for(var l=s.charCodeAt(0),u=l===47,f=-1,d=!0,h=s.length-1;h>=1;--h)if(l=s.charCodeAt(h),l===47){if(!d){f=h;break}}else d=!1;return f===-1?u?"/":".":u&&f===1?"//":s.slice(0,f)},basename:function(s,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');e(s);var u=0,f=-1,d=!0,h;if(l!==void 0&&l.length>0&&l.length<=s.length){if(l.length===s.length&&l===s)return"";var g=l.length-1,b=-1;for(h=s.length-1;h>=0;--h){var E=s.charCodeAt(h);if(E===47){if(!d){u=h+1;break}}else b===-1&&(d=!1,b=h+1),g>=0&&(E===l.charCodeAt(g)?--g===-1&&(f=h):(g=-1,f=b))}return u===f?f=b:f===-1&&(f=s.length),s.slice(u,f)}else{for(h=s.length-1;h>=0;--h)if(s.charCodeAt(h)===47){if(!d){u=h+1;break}}else f===-1&&(d=!1,f=h+1);return f===-1?"":s.slice(u,f)}},extname:function(s){e(s);for(var l=-1,u=0,f=-1,d=!0,h=0,g=s.length-1;g>=0;--g){var b=s.charCodeAt(g);if(b===47){if(!d){u=g+1;break}continue}f===-1&&(d=!1,f=g+1),b===46?l===-1?l=g:h!==1&&(h=1):l!==-1&&(h=-1)}return l===-1||f===-1||h===0||h===1&&l===f-1&&l===u+1?"":s.slice(l,f)},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 i("/",s)},parse:function(s){e(s);var l={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return l;var u=s.charCodeAt(0),f=u===47,d;f?(l.root="/",d=1):d=0;for(var h=-1,g=0,b=-1,E=!0,w=s.length-1,S=0;w>=d;--w){if(u=s.charCodeAt(w),u===47){if(!E){g=w+1;break}continue}b===-1&&(E=!1,b=w+1),u===46?h===-1?h=w:S!==1&&(S=1):h!==-1&&(S=-1)}return h===-1||b===-1||S===0||S===1&&h===b-1&&h===g+1?b!==-1&&(g===0&&f?l.base=l.name=s.slice(1,b):l.base=l.name=s.slice(g,b)):(g===0&&f?(l.name=s.slice(1,h),l.base=s.slice(1,b)):(l.name=s.slice(g,h),l.base=s.slice(g,b)),l.ext=s.slice(h,b)),g>0?l.dir=s.slice(0,g-1):f&&(l.dir="/"),l},sep:"/",delimiter:":",win32:null,posix:null};return n.posix=n,Vl=n,Vl}var Vl,eg,zl,tg=Ae(()=>{_();v();m();Hl();Vl={},eg=!1;zl=mE()});var ug={};Ir(ug,{URL:()=>YE,Url:()=>VE,default:()=>X,fileURLToPath:()=>lg,format:()=>zE,parse:()=>QE,pathToFileURL:()=>ag,resolve:()=>KE,resolveObject:()=>GE});function De(){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 Bi(t,e,r){if(t&&ft.isObject(t)&&t instanceof De)return t;var i=new De;return i.parse(t,e,r),i}function CE(){if(sg)return Ql;sg=!0;var t=oe;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function r(o,s){for(var l="",u=0,f=-1,d=0,h,g=0;g<=o.length;++g){if(g<o.length)h=o.charCodeAt(g);else{if(h===47)break;h=47}if(h===47){if(!(f===g-1||d===1))if(f!==g-1&&d===2){if(l.length<2||u!==2||l.charCodeAt(l.length-1)!==46||l.charCodeAt(l.length-2)!==46){if(l.length>2){var b=l.lastIndexOf("/");if(b!==l.length-1){b===-1?(l="",u=0):(l=l.slice(0,b),u=l.length-1-l.lastIndexOf("/")),f=g,d=0;continue}}else if(l.length===2||l.length===1){l="",u=0,f=g,d=0;continue}}s&&(l.length>0?l+="/..":l="..",u=2)}else l.length>0?l+="/"+o.slice(f+1,g):l=o.slice(f+1,g),u=g-f-1;f=g,d=0}else h===46&&d!==-1?++d:d=-1}return l}function i(o,s){var l=s.dir||s.root,u=s.base||(s.name||"")+(s.ext||"");return l?l===s.root?l+u:l+o+u:u}var n={resolve:function(){for(var s="",l=!1,u,f=arguments.length-1;f>=-1&&!l;f--){var d;f>=0?d=arguments[f]:(u===void 0&&(u=t.cwd()),d=u),e(d),d.length!==0&&(s=d+"/"+s,l=d.charCodeAt(0)===47)}return s=r(s,!l),l?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(e(s),s.length===0)return".";var l=s.charCodeAt(0)===47,u=s.charCodeAt(s.length-1)===47;return s=r(s,!l),s.length===0&&!l&&(s="."),s.length>0&&u&&(s+="/"),l?"/"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var s,l=0;l<arguments.length;++l){var u=arguments[l];e(u),u.length>0&&(s===void 0?s=u:s+="/"+u)}return s===void 0?".":n.normalize(s)},relative:function(s,l){if(e(s),e(l),s===l||(s=n.resolve(s),l=n.resolve(l),s===l))return"";for(var u=1;u<s.length&&s.charCodeAt(u)===47;++u);for(var f=s.length,d=f-u,h=1;h<l.length&&l.charCodeAt(h)===47;++h);for(var g=l.length,b=g-h,E=d<b?d:b,w=-1,S=0;S<=E;++S){if(S===E){if(b>E){if(l.charCodeAt(h+S)===47)return l.slice(h+S+1);if(S===0)return l.slice(h+S)}else d>E&&(s.charCodeAt(u+S)===47?w=S:S===0&&(w=0));break}var I=s.charCodeAt(u+S),C=l.charCodeAt(h+S);if(I!==C)break;I===47&&(w=S)}var k="";for(S=u+w+1;S<=f;++S)(S===f||s.charCodeAt(S)===47)&&(k.length===0?k+="..":k+="/..");return k.length>0?k+l.slice(h+w):(h+=w,l.charCodeAt(h)===47&&++h,l.slice(h))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return".";for(var l=s.charCodeAt(0),u=l===47,f=-1,d=!0,h=s.length-1;h>=1;--h)if(l=s.charCodeAt(h),l===47){if(!d){f=h;break}}else d=!1;return f===-1?u?"/":".":u&&f===1?"//":s.slice(0,f)},basename:function(s,l){if(l!==void 0&&typeof l!="string")throw new TypeError('"ext" argument must be a string');e(s);var u=0,f=-1,d=!0,h;if(l!==void 0&&l.length>0&&l.length<=s.length){if(l.length===s.length&&l===s)return"";var g=l.length-1,b=-1;for(h=s.length-1;h>=0;--h){var E=s.charCodeAt(h);if(E===47){if(!d){u=h+1;break}}else b===-1&&(d=!1,b=h+1),g>=0&&(E===l.charCodeAt(g)?--g===-1&&(f=h):(g=-1,f=b))}return u===f?f=b:f===-1&&(f=s.length),s.slice(u,f)}else{for(h=s.length-1;h>=0;--h)if(s.charCodeAt(h)===47){if(!d){u=h+1;break}}else f===-1&&(d=!1,f=h+1);return f===-1?"":s.slice(u,f)}},extname:function(s){e(s);for(var l=-1,u=0,f=-1,d=!0,h=0,g=s.length-1;g>=0;--g){var b=s.charCodeAt(g);if(b===47){if(!d){u=g+1;break}continue}f===-1&&(d=!1,f=g+1),b===46?l===-1?l=g:h!==1&&(h=1):l!==-1&&(h=-1)}return l===-1||f===-1||h===0||h===1&&l===f-1&&l===u+1?"":s.slice(l,f)},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 i("/",s)},parse:function(s){e(s);var l={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return l;var u=s.charCodeAt(0),f=u===47,d;f?(l.root="/",d=1):d=0;for(var h=-1,g=0,b=-1,E=!0,w=s.length-1,S=0;w>=d;--w){if(u=s.charCodeAt(w),u===47){if(!E){g=w+1;break}continue}b===-1&&(E=!1,b=w+1),u===46?h===-1?h=w:S!==1&&(S=1):h!==-1&&(S=-1)}return h===-1||b===-1||S===0||S===1&&h===b-1&&h===g+1?b!==-1&&(g===0&&f?l.base=l.name=s.slice(1,b):l.base=l.name=s.slice(g,b)):(g===0&&f?(l.name=s.slice(1,h),l.base=s.slice(1,b)):(l.name=s.slice(g,h),l.base=s.slice(g,b)),l.ext=s.slice(h,b)),g>0?l.dir=s.slice(0,g-1):f&&(l.dir="/"),l},sep:"/",delimiter:":",win32:null,posix:null};return n.posix=n,Ql=n,Ql}function jE(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Jl?FE(t):WE(t)}function FE(t){let e=t.hostname,r=t.pathname;for(let i=0;i<r.length;i++)if(r[i]==="%"){let n=r.codePointAt(i+2)||32;if(r[i+1]==="2"&&n===102||r[i+1]==="5"&&n===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(r=r.replace(ME,"\\"),r=decodeURIComponent(r),e!=="")return`\\\\${e}${r}`;{let i=r.codePointAt(1)|32,n=r[2];if(i<xE||i>OE||n!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}function WE(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)||32;if(e[r+1]==="2"&&i===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function $E(t){let e=og.resolve(t),r=t.charCodeAt(t.length-1);(r===BE||Jl&&r===kE)&&e[e.length-1]!==og.sep&&(e+="/");let i=new URL("file://");return e.includes("%")&&(e=e.replace(LE,"%25")),!Jl&&e.includes("\\")&&(e=e.replace(qE,"%5C")),e.includes(`
|
|
3
|
+
`)&&(e=e.replace(UE,"%0A")),e.includes("\r")&&(e=e.replace(NE,"%0D")),e.includes(" ")&&(e=e.replace(DE,"%09")),i.pathname=e,i}function lg(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Xl?lS(t):aS(t)}function lS(t){let e=t.hostname,r=t.pathname;for(let i=0;i<r.length;i++)if(r[i]==="%"){let n=r.codePointAt(i+2)||32;if(r[i+1]==="2"&&n===102||r[i+1]==="5"&&n===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(r=r.replace(tS,"\\"),r=decodeURIComponent(r),e!=="")return`\\\\${e}${r}`;{let i=r.codePointAt(1)|32,n=r[2];if(i<ZE||i>eS||n!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}function aS(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let r=0;r<e.length;r++)if(e[r]==="%"){let i=e.codePointAt(r+2)||32;if(e[r+1]==="2"&&i===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(e)}function ag(t){let e=zl.resolve(t),r=t.charCodeAt(t.length-1);(r===XE||Xl&&r===JE)&&e[e.length-1]!==zl.sep&&(e+="/");let i=new URL("file://");return e.includes("%")&&(e=e.replace(rS,"%25")),!Xl&&e.includes("\\")&&(e=e.replace(iS,"%5C")),e.includes(`
|
|
4
|
+
`)&&(e=e.replace(nS,"%0A")),e.includes("\r")&&(e=e.replace(sS,"%0D")),e.includes(" ")&&(e=e.replace(oS,"%09")),i.pathname=e,i}var X,vE,ft,EE,SE,AE,IE,Yl,rg,ig,ng,TE,RE,Kl,ri,Gl,Ql,sg,og,PE,kE,BE,xE,OE,Jl,ME,LE,qE,UE,NE,DE,HE,VE,zE,KE,GE,QE,YE,JE,XE,ZE,eS,Xl,tS,rS,iS,nS,sS,oS,cg=Ae(()=>{_();v();m();zp();Kp();Xp();tg();Hl();X={},vE=Vt,ft={isString:function(t){return typeof t=="string"},isObject:function(t){return typeof t=="object"&&t!==null},isNull:function(t){return t===null},isNullOrUndefined:function(t){return t==null}};X.parse=Bi,X.resolve=function(t,e){return Bi(t,!1,!0).resolve(e)},X.resolveObject=function(t,e){return t?Bi(t,!1,!0).resolveObject(e):e},X.format=function(t){return ft.isString(t)&&(t=Bi(t)),t instanceof De?t.format():De.prototype.format.call(t)},X.Url=De;EE=/^([a-z0-9.+-]+:)/i,SE=/:[0-9]*$/,AE=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,IE=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
|
|
5
|
+
`," "]),Yl=["'"].concat(IE),rg=["%","/","?",";","#"].concat(Yl),ig=["/","?","#"],ng=/^[+a-z0-9A-Z_-]{0,63}$/,TE=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,RE={javascript:!0,"javascript:":!0},Kl={javascript:!0,"javascript:":!0},ri={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Gl=ct;De.prototype.parse=function(t,e,r){if(!ft.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),n=i!==-1&&i<t.indexOf("#")?"?":"#",o=t.split(n);o[0]=o[0].replace(/\\/g,"/");var s=t=o.join(n);if(s=s.trim(),!r&&t.split("#").length===1){var l=AE.exec(s);if(l)return this.path=s,this.href=s,this.pathname=l[1],l[2]?(this.search=l[2],this.query=e?Gl.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var u=EE.exec(s);if(u){var f=(u=u[0]).toLowerCase();this.protocol=f,s=s.substr(u.length)}if(r||u||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var d=s.substr(0,2)==="//";!d||u&&Kl[u]||(s=s.substr(2),this.slashes=!0)}if(!Kl[u]&&(d||u&&!ri[u])){for(var h,g,b=-1,E=0;E<ig.length;E++)(w=s.indexOf(ig[E]))!==-1&&(b===-1||w<b)&&(b=w);for((g=b===-1?s.lastIndexOf("@"):s.lastIndexOf("@",b))!==-1&&(h=s.slice(0,g),s=s.slice(g+1),this.auth=decodeURIComponent(h)),b=-1,E=0;E<rg.length;E++){var w;(w=s.indexOf(rg[E]))!==-1&&(b===-1||w<b)&&(b=w)}b===-1&&(b=s.length),this.host=s.slice(0,b),s=s.slice(b),this.parseHost(),this.hostname=this.hostname||"";var S=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!S)for(var I=this.hostname.split(/\./),C=(E=0,I.length);E<C;E++){var k=I[E];if(k&&!k.match(ng)){for(var M="",q=0,G=k.length;q<G;q++)k.charCodeAt(q)>127?M+="x":M+=k[q];if(!M.match(ng)){var F=I.slice(0,E),K=I.slice(E+1),$=k.match(TE);$&&(F.push($[1]),K.unshift($[2])),K.length&&(s="/"+K.join(".")+s),this.hostname=F.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),S||(this.hostname=vE.toASCII(this.hostname));var te=this.port?":"+this.port:"",dt=this.hostname||"";this.host=dt+te,this.href+=this.host,S&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),s[0]!=="/"&&(s="/"+s))}if(!RE[f])for(E=0,C=Yl.length;E<C;E++){var Fe=Yl[E];if(s.indexOf(Fe)!==-1){var Se=encodeURIComponent(Fe);Se===Fe&&(Se=escape(Fe)),s=s.split(Fe).join(Se)}}var vr=s.indexOf("#");vr!==-1&&(this.hash=s.substr(vr),s=s.slice(0,vr));var Er=s.indexOf("?");if(Er!==-1?(this.search=s.substr(Er),this.query=s.substr(Er+1),e&&(this.query=Gl.parse(this.query)),s=s.slice(0,Er)):e&&(this.search="",this.query={}),s&&(this.pathname=s),ri[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){te=this.pathname||"";var as=this.search||"";this.path=te+as}return this.href=this.format(),this},De.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",i=this.hash||"",n=!1,o="";this.host?n=t+this.host:this.hostname&&(n=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(n+=":"+this.port)),this.query&&ft.isObject(this.query)&&Object.keys(this.query).length&&(o=Gl.stringify(this.query));var s=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||ri[e])&&n!==!1?(n="//"+(n||""),r&&r.charAt(0)!=="/"&&(r="/"+r)):n||(n=""),i&&i.charAt(0)!=="#"&&(i="#"+i),s&&s.charAt(0)!=="?"&&(s="?"+s),e+n+(r=r.replace(/[?#]/g,function(l){return encodeURIComponent(l)}))+(s=s.replace("#","%23"))+i},De.prototype.resolve=function(t){return this.resolveObject(Bi(t,!1,!0)).format()},De.prototype.resolveObject=function(t){if(ft.isString(t)){var e=new De;e.parse(t,!1,!0),t=e}for(var r=new De,i=Object.keys(this),n=0;n<i.length;n++){var o=i[n];r[o]=this[o]}if(r.hash=t.hash,t.href==="")return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var s=Object.keys(t),l=0;l<s.length;l++){var u=s[l];u!=="protocol"&&(r[u]=t[u])}return ri[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!ri[t.protocol]){for(var f=Object.keys(t),d=0;d<f.length;d++){var h=f[d];r[h]=t[h]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||Kl[t.protocol])r.pathname=t.pathname;else{for(var g=(t.pathname||"").split("/");g.length&&!(t.host=g.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),r.pathname=g.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var b=r.pathname||"",E=r.search||"";r.path=b+E}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var w=r.pathname&&r.pathname.charAt(0)==="/",S=t.host||t.pathname&&t.pathname.charAt(0)==="/",I=S||w||r.host&&t.pathname,C=I,k=r.pathname&&r.pathname.split("/")||[],M=(g=t.pathname&&t.pathname.split("/")||[],r.protocol&&!ri[r.protocol]);if(M&&(r.hostname="",r.port=null,r.host&&(k[0]===""?k[0]=r.host:k.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(g[0]===""?g[0]=t.host:g.unshift(t.host)),t.host=null),I=I&&(g[0]===""||k[0]==="")),S)r.host=t.host||t.host===""?t.host:r.host,r.hostname=t.hostname||t.hostname===""?t.hostname:r.hostname,r.search=t.search,r.query=t.query,k=g;else if(g.length)k||(k=[]),k.pop(),k=k.concat(g),r.search=t.search,r.query=t.query;else if(!ft.isNullOrUndefined(t.search))return M&&(r.hostname=r.host=k.shift(),($=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=$.shift(),r.host=r.hostname=$.shift())),r.search=t.search,r.query=t.query,ft.isNull(r.pathname)&&ft.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!k.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var q=k.slice(-1)[0],G=(r.host||t.host||k.length>1)&&(q==="."||q==="..")||q==="",F=0,K=k.length;K>=0;K--)(q=k[K])==="."?k.splice(K,1):q===".."?(k.splice(K,1),F++):F&&(k.splice(K,1),F--);if(!I&&!C)for(;F--;F)k.unshift("..");!I||k[0]===""||k[0]&&k[0].charAt(0)==="/"||k.unshift(""),G&&k.join("/").substr(-1)!=="/"&&k.push("");var $,te=k[0]===""||k[0]&&k[0].charAt(0)==="/";return M&&(r.hostname=r.host=te?"":k.length?k.shift():"",($=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=$.shift(),r.host=r.hostname=$.shift())),(I=I||r.host&&k.length)&&!te&&k.unshift(""),k.length?r.pathname=k.join("/"):(r.pathname=null,r.path=null),ft.isNull(r.pathname)&&ft.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},De.prototype.parseHost=function(){var t=this.host,e=SE.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};X.Url;X.format;X.resolve;X.resolveObject;Ql={},sg=!1;og=CE(),PE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;X.URL=typeof URL<"u"?URL:null;X.pathToFileURL=$E;X.fileURLToPath=jE;X.Url;X.format;X.resolve;X.resolveObject;X.URL;kE=92,BE=47,xE=97,OE=122,Jl=PE==="win32",ME=/\//g,LE=/%/g,qE=/\\/g,UE=/\n/g,NE=/\r/g,DE=/\t/g;HE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;X.URL=typeof URL<"u"?URL:null;X.pathToFileURL=ag;X.fileURLToPath=lg;VE=X.Url,zE=X.format,KE=X.resolve,GE=X.resolveObject,QE=X.parse,YE=X.URL,JE=92,XE=47,ZE=97,eS=122,Xl=HE==="win32",tS=/\//g,rS=/%/g,iS=/\\/g,nS=/\n/g,sS=/\r/g,oS=/\t/g});var hg=O((j3,fg)=>{"use strict";_();v();m();fg.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var is=O(xi=>{"use strict";_();v();m();Object.defineProperty(xi,"__esModule",{value:!0});xi.BufferedDuplex=void 0;xi.writev=pg;var uS=Nt(),dg=(he(),Q(ye));function pg(t,e){let r=new Array(t.length);for(let i=0;i<t.length;i++)typeof t[i].chunk=="string"?r[i]=dg.Buffer.from(t[i].chunk,"utf8"):r[i]=t[i].chunk;this._write(dg.Buffer.concat(r),"binary",e)}var Zl=class extends uS.Duplex{constructor(e,r,i){super({objectMode:!0}),this.proxy=r,this.socket=i,this.writeQueue=[],e.objectMode||(this._writev=pg.bind(this)),this.isSocketOpen=!1,this.proxy.on("data",n=>{!this.destroyed&&this.readable&&this.push(n)})}_read(e){this.proxy.read(e)}_write(e,r,i){this.isSocketOpen?this.writeToProxy(e,r,i):this.writeQueue.push({chunk:e,encoding:r,cb:i})}_final(e){this.writeQueue=[],this.proxy.end(e)}_destroy(e,r){this.writeQueue=[],this.proxy.destroy(),r(e)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(e,r,i){this.proxy.write(e,r)===!1?this.proxy.once("drain",i):i()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:e,encoding:r,cb:i}=this.writeQueue.shift();this.writeToProxy(e,r,i)}}};xi.BufferedDuplex=Zl});var Oi=O(Kt=>{"use strict";_();v();m();var ta=Kt&&Kt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.streamBuilder=Kt.browserStreamBuilder=void 0;var ns=(he(),Q(ye)),gg=ta(hg()),cS=ta(it()),fS=Nt(),hS=ta(Ci()),ea=is(),zt=(0,cS.default)("mqttjs:ws"),dS=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function bg(t,e){let r=`${t.protocol}://${t.hostname}:${t.port}${t.path}`;return typeof t.transformWsUrl=="function"&&(r=t.transformWsUrl(r,t,e)),r}function yg(t){let e=t;return t.port||(t.protocol==="wss"?e.port=443:e.port=80),t.path||(e.path="/"),t.wsOptions||(e.wsOptions={}),!hS.default&&!t.forceNativeWebSocket&&t.protocol==="wss"&&dS.forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r])}),e}function pS(t){let e=yg(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let r=new URL(document.URL);e.hostname=r.hostname,e.port||(e.port=Number(r.port))}return e.objectMode===void 0&&(e.objectMode=!(e.binary===!0||e.binary===void 0)),e}function gS(t,e,r){zt("createWebSocket"),zt(`protocol: ${r.protocolId} ${r.protocolVersion}`);let i=r.protocolId==="MQIsdp"&&r.protocolVersion===3?"mqttv3.1":"mqtt";zt(`creating new Websocket for url: ${e} and protocol: ${i}`);let n;return r.createWebsocket?n=r.createWebsocket(e,[i],r):n=new gg.default(e,[i],r.wsOptions),n}function bS(t,e){let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt",i=bg(e,t),n;return e.createWebsocket?n=e.createWebsocket(i,[r],e):n=new WebSocket(i,[r]),n.binaryType="arraybuffer",n}var yS=(t,e)=>{zt("streamBuilder");let r=yg(e);r.hostname=r.hostname||r.host||"localhost";let i=bg(r,t),n=gS(t,i,r),o=gg.default.createWebSocketStream(n,r.wsOptions);return o.url=i,n.on("close",()=>{o.destroy()}),o};Kt.streamBuilder=yS;var wS=(t,e)=>{zt("browserStreamBuilder");let r,n=pS(e).browserBufferSize||1024*512,o=e.browserBufferTimeout||1e3,s=!e.objectMode,l=bS(t,e),u=d(e,w,S);e.objectMode||(u._writev=ea.writev.bind(u)),u.on("close",()=>{l.close()});let f=typeof l.addEventListener<"u";l.readyState===l.OPEN?(r=u,r.socket=l):(r=new ea.BufferedDuplex(e,u,l),f?l.addEventListener("open",h):l.onopen=h),f?(l.addEventListener("close",g),l.addEventListener("error",b),l.addEventListener("message",E)):(l.onclose=g,l.onerror=b,l.onmessage=E);function d(I,C,k){let M=new fS.Transform({objectMode:I.objectMode});return M._write=C,M._flush=k,M}function h(){zt("WebSocket onOpen"),r instanceof ea.BufferedDuplex&&r.socketReady()}function g(I){zt("WebSocket onClose",I),r.end(),r.destroy()}function b(I){zt("WebSocket onError",I);let C=new Error("WebSocket error");C.event=I,r.destroy(C)}async function E(I){if(!u||u.destroyed||!u.readable)return;let{data:C}=I;C instanceof ArrayBuffer?C=ns.Buffer.from(C):C instanceof Blob?C=ns.Buffer.from(await new Response(C).arrayBuffer()):C=ns.Buffer.from(C,"utf8"),u.push(C)}function w(I,C,k){if(l.bufferedAmount>n){setTimeout(w,o,I,C,k);return}s&&typeof I=="string"&&(I=ns.Buffer.from(I,"utf8"));try{l.send(I)}catch(M){return k(M)}k()}function S(I){l.close(),I()}return r};Kt.browserStreamBuilder=wS});var ra={};Ir(ra,{Server:()=>xe,Socket:()=>xe,Stream:()=>xe,_createServerHandle:()=>xe,_normalizeArgs:()=>xe,_setSimultaneousAccepts:()=>xe,connect:()=>xe,createConnection:()=>xe,createServer:()=>xe,default:()=>_S,isIP:()=>xe,isIPv4:()=>xe,isIPv6:()=>xe});function xe(){throw new Error("Node.js net module is not supported by JSPM core outside of Node.js")}var _S,ia=Ae(()=>{_();v();m();_S={_createServerHandle:xe,_normalizeArgs:xe,_setSimultaneousAccepts:xe,connect:xe,createConnection:xe,createServer:xe,isIP:xe,isIPv4:xe,isIPv6:xe,Server:xe,Socket:xe,Stream:xe}});var na=O((IF,wg)=>{_();v();m();wg.exports={}});var oa=O(Mi=>{"use strict";_();v();m();var sa=Mi&&Mi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mi,"__esModule",{value:!0});var mS=sa((ia(),Q(ra))),vS=sa(it()),ES=sa(na()),SS=(0,vS.default)("mqttjs:tcp"),AS=(t,e)=>{if(e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost",e.socksProxy)return(0,ES.default)(e.hostname,e.port,e.socksProxy,{timeout:e.socksTimeout});let{port:r,path:i}=e,n=e.hostname;return SS("port %d and host %s",r,n),mS.default.createConnection({port:r,host:n,path:i})};Mi.default=AS});var _g={};Ir(_g,{default:()=>IS});var IS,mg=Ae(()=>{_();v();m();IS={}});var la=O(mr=>{"use strict";_();v();m();var TS=mr&&mr.__rest||function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r},ss=mr&&mr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mr,"__esModule",{value:!0});var RS=ss((mg(),Q(_g))),CS=ss((ia(),Q(ra))),PS=ss(it()),kS=ss(na()),BS=(0,PS.default)("mqttjs:tls");function xS(t){let{host:e,port:r,socksProxy:i}=t,n=TS(t,["host","port","socksProxy"]);return RS.default.connect(i?Object.assign(Object.assign({},n),{socket:(0,kS.default)(e,r,i,{timeout:t.socksTimeout})}):t)}var OS=(t,e)=>{e.port=e.port||8883,e.host=e.hostname||e.host||"localhost",CS.default.isIP(e.host)===0&&(e.servername=e.host),e.rejectUnauthorized=e.rejectUnauthorized!==!1,delete e.path,BS("port %d host %s rejectUnauthorized %b",e.port,e.host,e.rejectUnauthorized);let r=xS(e);r.on("secureConnect",()=>{e.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",i)});function i(n){e.rejectUnauthorized&&t.emit("error",n),r.end()}return r.on("error",i),r};mr.default=OS});var ca=O(ua=>{"use strict";_();v();m();Object.defineProperty(ua,"__esModule",{value:!0});var vg=(he(),Q(ye)),MS=Nt(),LS=is(),ht,aa,Oe;function qS(){let t=new MS.Transform;return t._write=(e,r,i)=>{ht.send({data:e.buffer,success(){i()},fail(n){i(new Error(n))}})},t._flush=e=>{ht.close({success(){e()}})},t}function US(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function NS(t,e){let r=t.protocol==="wxs"?"wss":"ws",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl=="function"&&(i=t.transformWsUrl(i,t,e)),i}function DS(){ht.onOpen(()=>{Oe.socketReady()}),ht.onMessage(t=>{let{data:e}=t;e instanceof ArrayBuffer?e=vg.Buffer.from(e):e=vg.Buffer.from(e,"utf8"),aa.push(e)}),ht.onClose(()=>{Oe.emit("close"),Oe.end(),Oe.destroy()}),ht.onError(t=>{let e=new Error(t.errMsg);Oe.destroy(e)})}var jS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt";US(e);let i=NS(e,t);ht=wx.connectSocket({url:i,protocols:[r]}),aa=qS(),Oe=new LS.BufferedDuplex(e,aa,ht),Oe._destroy=(o,s)=>{ht.close({success(){s&&s(o)}})};let n=Oe.destroy;return Oe.destroy=(o,s)=>(Oe.destroy=n,setTimeout(()=>{ht.close({fail(){Oe._destroy(o,s)}})},0),Oe),DS(),Oe};ua.default=jS});var da=O(ha=>{"use strict";_();v();m();Object.defineProperty(ha,"__esModule",{value:!0});var fa=(he(),Q(ye)),FS=Nt(),WS=is(),Ct,os,ii,Eg=!1;function $S(){let t=new FS.Transform;return t._write=(e,r,i)=>{Ct.sendSocketMessage({data:e.buffer,success(){i()},fail(){i(new Error)}})},t._flush=e=>{Ct.closeSocket({success(){e()}})},t}function HS(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function VS(t,e){let r=t.protocol==="alis"?"wss":"ws",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl=="function"&&(i=t.transformWsUrl(i,t,e)),i}function zS(){Eg||(Eg=!0,Ct.onSocketOpen(()=>{ii.socketReady()}),Ct.onSocketMessage(t=>{if(typeof t.data=="string"){let e=fa.Buffer.from(t.data,"base64");os.push(e)}else{let e=new FileReader;e.addEventListener("load",()=>{let r=e.result;r instanceof ArrayBuffer?r=fa.Buffer.from(r):r=fa.Buffer.from(r,"utf8"),os.push(r)}),e.readAsArrayBuffer(t.data)}}),Ct.onSocketClose(()=>{ii.end(),ii.destroy()}),Ct.onSocketError(t=>{ii.destroy(t)}))}var KS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt";HS(e);let i=VS(e,t);return Ct=e.my,Ct.connectSocket({url:i,protocols:r}),os=$S(),ii=new WS.BufferedDuplex(e,os,Ct),zS(),ii};ha.default=KS});var Tg=O(ni=>{"use strict";_();v();m();var ls=ni&&ni.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ni,"__esModule",{value:!0});ni.connectAsync=XS;var GS=ls(it()),QS=ls((cg(),Q(ug))),YS=ls(ts()),Sg=ls(Ci());typeof(R===null||R===void 0?void 0:R.nextTick)!="function"&&(R.nextTick=setImmediate);var Ag=(0,GS.default)("mqttjs"),ge=null;function JS(t){let e;t.auth&&(e=t.auth.match(/^(.+):(.+)$/),e?(t.username=e[1],t.password=e[2]):t.username=t.auth)}function Ig(t,e){var r,i,n;if(Ag("connecting to an MQTT broker..."),typeof t=="object"&&!e&&(e=t,t=""),e=e||{},t&&typeof t=="string"){let l=QS.default.parse(t,!0),u={};if(l.port!=null&&(u.port=Number(l.port)),u.host=l.hostname,u.query=l.query,u.auth=l.auth,u.protocol=l.protocol,u.path=l.path,e=Object.assign(Object.assign({},u),e),!e.protocol)throw new Error("Missing protocol");e.protocol=e.protocol.replace(/:$/,"")}if(e.unixSocket=e.unixSocket||((r=e.protocol)===null||r===void 0?void 0:r.includes("+unix")),e.unixSocket?e.protocol=e.protocol.replace("+unix",""):!(!((i=e.protocol)===null||i===void 0)&&i.startsWith("ws"))&&!(!((n=e.protocol)===null||n===void 0)&&n.startsWith("wx"))&&delete e.path,JS(e),e.query&&typeof e.query.clientId=="string"&&(e.clientId=e.query.clientId),Sg.default||e.unixSocket?e.socksProxy=void 0:e.socksProxy===void 0&&typeof R<"u"&&(e.socksProxy=R.env.MQTTJS_SOCKS_PROXY),e.cert&&e.key)if(e.protocol){if(["mqtts","wss","wxs","alis"].indexOf(e.protocol)===-1)switch(e.protocol){case"mqtt":e.protocol="mqtts";break;case"ws":e.protocol="wss";break;case"wx":e.protocol="wxs";break;case"ali":e.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${e.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(ge||(ge={},!Sg.default&&!e.forceNativeWebSocket?(ge.ws=Oi().streamBuilder,ge.wss=Oi().streamBuilder,ge.mqtt=oa().default,ge.tcp=oa().default,ge.ssl=la().default,ge.tls=ge.ssl,ge.mqtts=la().default):(ge.ws=Oi().browserStreamBuilder,ge.wss=Oi().browserStreamBuilder,ge.wx=ca().default,ge.wxs=ca().default,ge.ali=da().default,ge.alis=da().default)),!ge[e.protocol]){let l=["mqtts","wss"].indexOf(e.protocol)!==-1;e.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((u,f)=>l&&f%2===0?!1:typeof ge[u]=="function")[0]}if(e.clean===!1&&!e.clientId)throw new Error("Missing clientId for unclean clients");e.protocol&&(e.defaultProtocol=e.protocol);function o(l){return e.servers&&((!l._reconnectCount||l._reconnectCount===e.servers.length)&&(l._reconnectCount=0),e.host=e.servers[l._reconnectCount].host,e.port=e.servers[l._reconnectCount].port,e.protocol=e.servers[l._reconnectCount].protocol?e.servers[l._reconnectCount].protocol:e.defaultProtocol,e.hostname=e.host,l._reconnectCount++),Ag("calling streambuilder for",e.protocol),ge[e.protocol](l,e)}let s=new YS.default(o,e);return s.on("error",()=>{}),s}function XS(t,e,r=!0){return new Promise((i,n)=>{let o=Ig(t,e),s={connect:u=>{l(),i(o)},end:()=>{l(),i(o)},error:u=>{l(),o.end(),n(u)}};r===!1&&(s.close=()=>{s.error(new Error("Couldn't connect to server"))});function l(){Object.keys(s).forEach(u=>{o.off(u,s[u])})}Object.keys(s).forEach(u=>{o.on(u,s[u])})})}ni.default=Ig});var pa=O(z=>{"use strict";_();v();m();var Rg=z&&z.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),ZS=z&&z.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eA=z&&z.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[i.length]=n);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i=t(e),n=0;n<i.length;n++)i[n]!=="default"&&Rg(r,e,i[n]);return ZS(r,e),r}}(),Cg=z&&z.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Rg(e,t,r)},Li=z&&z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(z,"__esModule",{value:!0});z.ReasonCodes=z.KeepaliveManager=z.UniqueMessageIdProvider=z.DefaultMessageIdProvider=z.Store=z.MqttClient=z.connectAsync=z.connect=z.Client=void 0;var Pg=Li(ts());z.MqttClient=Pg.default;var tA=Li(zo());z.DefaultMessageIdProvider=tA.default;var rA=Li(Dp());z.UniqueMessageIdProvider=rA.default;var iA=Li(Qo());z.Store=iA.default;var kg=eA(Tg());z.connect=kg.default;Object.defineProperty(z,"connectAsync",{enumerable:!0,get:function(){return kg.connectAsync}});var nA=Li(Ll());z.KeepaliveManager=nA.default;z.Client=Pg.default;Cg(ts(),z);Cg(cr(),z);var sA=Si();Object.defineProperty(z,"ReasonCodes",{enumerable:!0,get:function(){return sA.ReasonCodes}})});var cA=O(je=>{_();v();m();var Bg=je&&je.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),oA=je&&je.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),lA=je&&je.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(r){var i=[];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(i[i.length]=n);return i},t(e)};return function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i=t(e),n=0;n<i.length;n++)i[n]!=="default"&&Bg(r,e,i[n]);return oA(r,e),r}}(),aA=je&&je.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Bg(e,t,r)};Object.defineProperty(je,"__esModule",{value:!0});var uA=lA(pa());je.default=uA;aA(pa(),je)});export default cA();
|
|
6
6
|
/*! Bundled license information:
|
|
7
7
|
|
|
8
8
|
@jspm/core/nodelibs/browser/buffer.js:
|