123456789101112 |
- var Zs=Object.defineProperty;var Fn=s=>{throw TypeError(s)};var ea=(s,f,o)=>f in s?Zs(s,f,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[f]=o;var Ne=(s,f,o)=>ea(s,typeof f!="symbol"?f+"":f,o),$r=(s,f,o)=>f.has(s)||Fn("Cannot "+o);var C=(s,f,o)=>($r(s,f,"read from private field"),o?o.call(s):f.get(s)),Be=(s,f,o)=>f.has(s)?Fn("Cannot add the same private member more than once"):f instanceof WeakSet?f.add(s):f.set(s,o),Ce=(s,f,o,l)=>($r(s,f,"write to private field"),l?l.call(s,o):f.set(s,o),o),Ae=(s,f,o)=>($r(s,f,"access private method"),o);var gr=(s,f,o,l)=>({set _(c){Ce(s,f,c,o)},get _(){return C(s,f,l)}});import{d as Wn,a as Vr,S as ta,b as er,g as Hr,e as ra,f as ia,_ as na,c as oa,T as sa,B as aa,j as la,h as ua,i as ha,k as ca,l as fa,M as da}from"./index-CFl91DGD.js";import{d as pa,u as ga,r as br,a as ba,o as ma,b as ya,e as mr,w as Ze,g as xt,h as Me,c as Ge,i as va,k as yr,F as zr,l as Gr,n as qn,t as ct,m as $n,p as Kr,_ as _a}from"./index-M7pGrfO0.js";var Cn=Object.defineProperty,wa=Object.getOwnPropertyDescriptor,Ea=Object.getOwnPropertyNames,Sa=Object.prototype.hasOwnProperty,nt=(s,f)=>()=>(s&&(f=s(s=0)),f),be=(s,f)=>()=>(f||s((f={exports:{}}).exports,f),f.exports),ir=(s,f)=>{for(var o in f)Cn(s,o,{get:f[o],enumerable:!0})},Aa=(s,f,o,l)=>{if(f&&typeof f=="object"||typeof f=="function")for(let c of Ea(f))!Sa.call(s,c)&&c!==o&&Cn(s,c,{get:()=>f[c],enumerable:!(l=wa(f,c))||l.enumerable});return s},De=s=>Aa(Cn({},"__esModule",{value:!0}),s),he=nt(()=>{}),Le={};ir(Le,{_debugEnd:()=>Ui,_debugProcess:()=>ji,_events:()=>Zi,_eventsCount:()=>en,_exiting:()=>Si,_fatalExceptions:()=>Mi,_getActiveHandles:()=>ko,_getActiveRequests:()=>Io,_kill:()=>ki,_linkedBinding:()=>So,_maxListeners:()=>Xi,_preload_modules:()=>Yi,_rawDebug:()=>_i,_startProfilerIdleNotifier:()=>Di,_stopProfilerIdleNotifier:()=>Fi,_tickCallback:()=>Li,abort:()=>Vi,addListener:()=>tn,allowedNodeEnvironmentFlags:()=>xi,arch:()=>ai,argv:()=>hi,argv0:()=>Qi,assert:()=>To,binding:()=>gi,chdir:()=>yi,config:()=>Ai,cpuUsage:()=>lr,cwd:()=>mi,debugPort:()=>Ki,default:()=>On,dlopen:()=>Ao,domain:()=>Ei,emit:()=>an,emitWarning:()=>pi,env:()=>ui,execArgv:()=>ci,execPath:()=>Gi,exit:()=>Oi,features:()=>Bi,hasUncaughtExceptionCaptureCallback:()=>Co,hrtime:()=>Ar,kill:()=>Pi,listeners:()=>Oo,memoryUsage:()=>Ci,moduleLoadList:()=>wi,nextTick:()=>wo,off:()=>nn,on:()=>wt,once:()=>rn,openStdin:()=>Ri,pid:()=>Hi,platform:()=>li,ppid:()=>zi,prependListener:()=>ln,prependOnceListener:()=>un,reallyExit:()=>Ii,release:()=>vi,removeAllListeners:()=>sn,removeListener:()=>on,resourceUsage:()=>Ti,setSourceMapsEnabled:()=>Ji,setUncaughtExceptionCaptureCallback:()=>Ni,stderr:()=>qi,stdin:()=>$i,stdout:()=>Wi,title:()=>si,umask:()=>bi,uptime:()=>Po,version:()=>fi,versions:()=>di});function Pn(s){throw new Error("Node.js process "+s+" is not supported by JSPM core outside of Node.js")}function Ia(){!Kt||!zt||(Kt=!1,zt.length?mt=zt.concat(mt):cr=-1,mt.length&&_o())}function _o(){if(!Kt){var s=setTimeout(Ia,0);Kt=!0;for(var f=mt.length;f;){for(zt=mt,mt=[];++cr<f;)zt&&zt[cr].run();cr=-1,f=mt.length}zt=null,Kt=!1,clearTimeout(s)}}function wo(s){var f=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)f[o-1]=arguments[o];mt.push(new Eo(s,f)),mt.length===1&&!Kt&&setTimeout(_o,0)}function Eo(s,f){this.fun=s,this.array=f}function rt(){}function So(s){Pn("_linkedBinding")}function Ao(s){Pn("dlopen")}function Io(){return[]}function ko(){return[]}function To(s,f){if(!s)throw new Error(f||"assertion error")}function Co(){return!1}function Po(){return It.now()/1e3}function Ar(s){var f=Math.floor((Date.now()-It.now())*.001),o=It.now()*.001,l=Math.floor(o)+f,c=Math.floor(o%1*1e9);return s&&(l=l-s[0],c=c-s[1],c<0&&(l--,c+=Ir)),[l,c]}function wt(){return On}function Oo(s){return[]}var mt,Kt,zt,cr,si,ai,li,ui,hi,ci,fi,di,pi,gi,bi,mi,yi,vi,_i,wi,Ei,Si,Ai,Ii,ki,lr,Ti,Ci,Pi,Oi,Ri,xi,Bi,Mi,Ni,Li,ji,Ui,Di,Fi,Wi,qi,$i,Vi,Hi,zi,Gi,Ki,Qi,Yi,Ji,It,Qr,Ir,Xi,Zi,en,tn,rn,nn,on,sn,an,ln,un,On,ka=nt(()=>{he(),fe(),ce(),mt=[],Kt=!1,cr=-1,Eo.prototype.run=function(){this.fun.apply(null,this.array)},si="browser",ai="x64",li="browser",ui={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},hi=["/usr/bin/node"],ci=[],fi="v16.8.0",di={},pi=function(s,f){console.warn((f?f+": ":"")+s)},gi=function(s){Pn("binding")},bi=function(s){return 0},mi=function(){return"/"},yi=function(s){},vi={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},_i=rt,wi=[],Ei={},Si=!1,Ai={},Ii=rt,ki=rt,lr=function(){return{}},Ti=lr,Ci=lr,Pi=rt,Oi=rt,Ri=rt,xi={},Bi={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Mi=rt,Ni=rt,Li=rt,ji=rt,Ui=rt,Di=rt,Fi=rt,Wi=void 0,qi=void 0,$i=void 0,Vi=rt,Hi=2,zi=1,Gi="/bin/usr/node",Ki=9229,Qi="node",Yi=[],Ji=rt,It={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},It.now===void 0&&(Qr=Date.now(),It.timing&&It.timing.navigationStart&&(Qr=It.timing.navigationStart),It.now=()=>Date.now()-Qr),Ir=1e9,Ar.bigint=function(s){var f=Ar(s);return typeof BigInt>"u"?f[0]*Ir+f[1]:BigInt(f[0]*Ir)+BigInt(f[1])},Xi=10,Zi={},en=0,tn=wt,rn=wt,nn=wt,on=wt,sn=wt,an=rt,ln=wt,un=wt,On={version:fi,versions:di,arch:ai,platform:li,release:vi,_rawDebug:_i,moduleLoadList:wi,binding:gi,_linkedBinding:So,_events:Zi,_eventsCount:en,_maxListeners:Xi,on:wt,addListener:tn,once:rn,off:nn,removeListener:on,removeAllListeners:sn,emit:an,prependListener:ln,prependOnceListener:un,listeners:Oo,domain:Ei,_exiting:Si,config:Ai,dlopen:Ao,uptime:Po,_getActiveRequests:Io,_getActiveHandles:ko,reallyExit:Ii,_kill:ki,cpuUsage:lr,resourceUsage:Ti,memoryUsage:Ci,kill:Pi,exit:Oi,openStdin:Ri,allowedNodeEnvironmentFlags:xi,assert:To,features:Bi,_fatalExceptions:Mi,setUncaughtExceptionCaptureCallback:Ni,hasUncaughtExceptionCaptureCallback:Co,emitWarning:pi,nextTick:wo,_tickCallback:Li,_debugProcess:ji,_debugEnd:Ui,_startProfilerIdleNotifier:Di,_stopProfilerIdleNotifier:Fi,stdout:Wi,stdin:$i,stderr:qi,abort:Vi,umask:bi,chdir:yi,cwd:mi,env:ui,title:si,argv:hi,execArgv:ci,pid:Hi,ppid:zi,execPath:Gi,debugPort:Ki,hrtime:Ar,argv0:Qi,_preload_modules:Yi,setSourceMapsEnabled:Ji}}),ce=nt(()=>{ka()}),Je={};ir(Je,{Buffer:()=>xr,INSPECT_MAX_BYTES:()=>Ro,default:()=>Et,kMaxLength:()=>xo});function Ta(){if(hn)return rr;hn=!0,rr.byteLength=r,rr.toByteArray=n,rr.fromByteArray=g;for(var s=[],f=[],o=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,i=l.length;c<i;++c)s[c]=l[c],f[l.charCodeAt(c)]=c;f[45]=62,f[95]=63;function e(b){var m=b.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var v=b.indexOf("=");v===-1&&(v=m);var _=v===m?0:4-v%4;return[v,_]}function r(b){var m=e(b),v=m[0],_=m[1];return(v+_)*3/4-_}function t(b,m,v){return(m+v)*3/4-v}function n(b){var m,v=e(b),_=v[0],I=v[1],y=new o(t(b,_,I)),E=0,N=I>0?_-4:_,B;for(B=0;B<N;B+=4)m=f[b.charCodeAt(B)]<<18|f[b.charCodeAt(B+1)]<<12|f[b.charCodeAt(B+2)]<<6|f[b.charCodeAt(B+3)],y[E++]=m>>16&255,y[E++]=m>>8&255,y[E++]=m&255;return I===2&&(m=f[b.charCodeAt(B)]<<2|f[b.charCodeAt(B+1)]>>4,y[E++]=m&255),I===1&&(m=f[b.charCodeAt(B)]<<10|f[b.charCodeAt(B+1)]<<4|f[b.charCodeAt(B+2)]>>2,y[E++]=m>>8&255,y[E++]=m&255),y}function h(b){return s[b>>18&63]+s[b>>12&63]+s[b>>6&63]+s[b&63]}function d(b,m,v){for(var _,I=[],y=m;y<v;y+=3)_=(b[y]<<16&16711680)+(b[y+1]<<8&65280)+(b[y+2]&255),I.push(h(_));return I.join("")}function g(b){for(var m,v=b.length,_=v%3,I=[],y=16383,E=0,N=v-_;E<N;E+=y)I.push(d(b,E,E+y>N?N:E+y));return _===1?(m=b[v-1],I.push(s[m>>2]+s[m<<4&63]+"==")):_===2&&(m=(b[v-2]<<8)+b[v-1],I.push(s[m>>10]+s[m>>4&63]+s[m<<2&63]+"=")),I.join("")}return rr}function Ca(){return cn?ur:(cn=!0,ur.read=function(s,f,o,l,c){var i,e,r=c*8-l-1,t=(1<<r)-1,n=t>>1,h=-7,d=o?c-1:0,g=o?-1:1,b=s[f+d];for(d+=g,i=b&(1<<-h)-1,b>>=-h,h+=r;h>0;i=i*256+s[f+d],d+=g,h-=8);for(e=i&(1<<-h)-1,i>>=-h,h+=l;h>0;e=e*256+s[f+d],d+=g,h-=8);if(i===0)i=1-n;else{if(i===t)return e?NaN:(b?-1:1)*(1/0);e=e+Math.pow(2,l),i=i-n}return(b?-1:1)*e*Math.pow(2,i-l)},ur.write=function(s,f,o,l,c,i){var e,r,t,n=i*8-c-1,h=(1<<n)-1,d=h>>1,g=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=l?0:i-1,m=l?1:-1,v=f<0||f===0&&1/f<0?1:0;for(f=Math.abs(f),isNaN(f)||f===1/0?(r=isNaN(f)?1:0,e=h):(e=Math.floor(Math.log(f)/Math.LN2),f*(t=Math.pow(2,-e))<1&&(e--,t*=2),e+d>=1?f+=g/t:f+=g*Math.pow(2,1-d),f*t>=2&&(e++,t/=2),e+d>=h?(r=0,e=h):e+d>=1?(r=(f*t-1)*Math.pow(2,c),e=e+d):(r=f*Math.pow(2,d-1)*Math.pow(2,c),e=0));c>=8;s[o+b]=r&255,b+=m,r/=256,c-=8);for(e=e<<c|r,n+=c;n>0;s[o+b]=e&255,b+=m,e/=256,n-=8);s[o+b-m]|=v*128},ur)}function Pa(){if(fn)return Bt;fn=!0;let s=Ta(),f=Ca(),o=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Bt.Buffer=e,Bt.SlowBuffer=I,Bt.INSPECT_MAX_BYTES=50;let l=2147483647;Bt.kMaxLength=l,e.TYPED_ARRAY_SUPPORT=c(),!e.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 c(){try{let a=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(a,u),a.foo()===42}catch{return!1}}Object.defineProperty(e.prototype,"parent",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.buffer}}),Object.defineProperty(e.prototype,"offset",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.byteOffset}});function i(a){if(a>l)throw new RangeError('The value "'+a+'" is invalid for option "size"');let u=new Uint8Array(a);return Object.setPrototypeOf(u,e.prototype),u}function e(a,u,p){if(typeof a=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(a)}return r(a,u,p)}e.poolSize=8192;function r(a,u,p){if(typeof a=="string")return d(a,u);if(ArrayBuffer.isView(a))return b(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof a);if(D(a,ArrayBuffer)||a&&D(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(D(a,SharedArrayBuffer)||a&&D(a.buffer,SharedArrayBuffer)))return m(a,u,p);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let w=a.valueOf&&a.valueOf();if(w!=null&&w!==a)return e.from(w,u,p);let T=v(a);if(T)return T;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return e.from(a[Symbol.toPrimitive]("string"),u,p);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof a)}e.from=function(a,u,p){return r(a,u,p)},Object.setPrototypeOf(e.prototype,Uint8Array.prototype),Object.setPrototypeOf(e,Uint8Array);function t(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function n(a,u,p){return t(a),a<=0?i(a):u!==void 0?typeof p=="string"?i(a).fill(u,p):i(a).fill(u):i(a)}e.alloc=function(a,u,p){return n(a,u,p)};function h(a){return t(a),i(a<0?0:_(a)|0)}e.allocUnsafe=function(a){return h(a)},e.allocUnsafeSlow=function(a){return h(a)};function d(a,u){if((typeof u!="string"||u==="")&&(u="utf8"),!e.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let p=y(a,u)|0,w=i(p),T=w.write(a,u);return T!==p&&(w=w.slice(0,T)),w}function g(a){let u=a.length<0?0:_(a.length)|0,p=i(u);for(let w=0;w<u;w+=1)p[w]=a[w]&255;return p}function b(a){if(D(a,Uint8Array)){let u=new Uint8Array(a);return m(u.buffer,u.byteOffset,u.byteLength)}return g(a)}function m(a,u,p){if(u<0||a.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<u+(p||0))throw new RangeError('"length" is outside of buffer bounds');let w;return u===void 0&&p===void 0?w=new Uint8Array(a):p===void 0?w=new Uint8Array(a,u):w=new Uint8Array(a,u,p),Object.setPrototypeOf(w,e.prototype),w}function v(a){if(e.isBuffer(a)){let u=_(a.length)|0,p=i(u);return p.length===0||a.copy(p,0,0,u),p}if(a.length!==void 0)return typeof a.length!="number"||oe(a.length)?i(0):g(a);if(a.type==="Buffer"&&Array.isArray(a.data))return g(a.data)}function _(a){if(a>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return a|0}function I(a){return+a!=a&&(a=0),e.alloc(+a)}e.isBuffer=function(a){return a!=null&&a._isBuffer===!0&&a!==e.prototype},e.compare=function(a,u){if(D(a,Uint8Array)&&(a=e.from(a,a.offset,a.byteLength)),D(u,Uint8Array)&&(u=e.from(u,u.offset,u.byteLength)),!e.isBuffer(a)||!e.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(a===u)return 0;let p=a.length,w=u.length;for(let T=0,j=Math.min(p,w);T<j;++T)if(a[T]!==u[T]){p=a[T],w=u[T];break}return p<w?-1:w<p?1:0},e.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}},e.concat=function(a,u){if(!Array.isArray(a))throw new TypeError('"list" argument must be an Array of Buffers');if(a.length===0)return e.alloc(0);let p;if(u===void 0)for(u=0,p=0;p<a.length;++p)u+=a[p].length;let w=e.allocUnsafe(u),T=0;for(p=0;p<a.length;++p){let j=a[p];if(D(j,Uint8Array))T+j.length>w.length?(e.isBuffer(j)||(j=e.from(j)),j.copy(w,T)):Uint8Array.prototype.set.call(w,j,T);else if(e.isBuffer(j))j.copy(w,T);else throw new TypeError('"list" argument must be an Array of Buffers');T+=j.length}return w};function y(a,u){if(e.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||D(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof a);let p=a.length,w=arguments.length>2&&arguments[2]===!0;if(!w&&p===0)return 0;let T=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return U(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return te(a).length;default:if(T)return w?-1:U(a).length;u=(""+u).toLowerCase(),T=!0}}e.byteLength=y;function E(a,u,p){let w=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((p===void 0||p>this.length)&&(p=this.length),p<=0)||(p>>>=0,u>>>=0,p<=u))return"";for(a||(a="utf8");;)switch(a){case"hex":return le(this,u,p);case"utf8":case"utf-8":return K(this,u,p);case"ascii":return ge(this,u,p);case"latin1":case"binary":return de(this,u,p);case"base64":return O(this,u,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ee(this,u,p);default:if(w)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),w=!0}}e.prototype._isBuffer=!0;function N(a,u,p){let w=a[u];a[u]=a[p],a[p]=w}e.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 u=0;u<a;u+=2)N(this,u,u+1);return this},e.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 u=0;u<a;u+=4)N(this,u,u+3),N(this,u+1,u+2);return this},e.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 u=0;u<a;u+=8)N(this,u,u+7),N(this,u+1,u+6),N(this,u+2,u+5),N(this,u+3,u+4);return this},e.prototype.toString=function(){let a=this.length;return a===0?"":arguments.length===0?K(this,0,a):E.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:e.compare(this,a)===0},e.prototype.inspect=function(){let a="",u=Bt.INSPECT_MAX_BYTES;return a=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(a+=" ... "),"<Buffer "+a+">"},o&&(e.prototype[o]=e.prototype.inspect),e.prototype.compare=function(a,u,p,w,T){if(D(a,Uint8Array)&&(a=e.from(a,a.offset,a.byteLength)),!e.isBuffer(a))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof a);if(u===void 0&&(u=0),p===void 0&&(p=a?a.length:0),w===void 0&&(w=0),T===void 0&&(T=this.length),u<0||p>a.length||w<0||T>this.length)throw new RangeError("out of range index");if(w>=T&&u>=p)return 0;if(w>=T)return-1;if(u>=p)return 1;if(u>>>=0,p>>>=0,w>>>=0,T>>>=0,this===a)return 0;let j=T-w,G=p-u,_e=Math.min(j,G),we=this.slice(w,T),Te=a.slice(u,p);for(let xe=0;xe<_e;++xe)if(we[xe]!==Te[xe]){j=we[xe],G=Te[xe];break}return j<G?-1:G<j?1:0};function B(a,u,p,w,T){if(a.length===0)return-1;if(typeof p=="string"?(w=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,oe(p)&&(p=T?0:a.length-1),p<0&&(p=a.length+p),p>=a.length){if(T)return-1;p=a.length-1}else if(p<0)if(T)p=0;else return-1;if(typeof u=="string"&&(u=e.from(u,w)),e.isBuffer(u))return u.length===0?-1:S(a,u,p,w,T);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?T?Uint8Array.prototype.indexOf.call(a,u,p):Uint8Array.prototype.lastIndexOf.call(a,u,p):S(a,[u],p,w,T);throw new TypeError("val must be string, number or Buffer")}function S(a,u,p,w,T){let j=1,G=a.length,_e=u.length;if(w!==void 0&&(w=String(w).toLowerCase(),w==="ucs2"||w==="ucs-2"||w==="utf16le"||w==="utf-16le")){if(a.length<2||u.length<2)return-1;j=2,G/=2,_e/=2,p/=2}function we(xe,Oe){return j===1?xe[Oe]:xe.readUInt16BE(Oe*j)}let Te;if(T){let xe=-1;for(Te=p;Te<G;Te++)if(we(a,Te)===we(u,xe===-1?0:Te-xe)){if(xe===-1&&(xe=Te),Te-xe+1===_e)return xe*j}else xe!==-1&&(Te-=Te-xe),xe=-1}else for(p+_e>G&&(p=G-_e),Te=p;Te>=0;Te--){let xe=!0;for(let Oe=0;Oe<_e;Oe++)if(we(a,Te+Oe)!==we(u,Oe)){xe=!1;break}if(xe)return Te}return-1}e.prototype.includes=function(a,u,p){return this.indexOf(a,u,p)!==-1},e.prototype.indexOf=function(a,u,p){return B(this,a,u,p,!0)},e.prototype.lastIndexOf=function(a,u,p){return B(this,a,u,p,!1)};function k(a,u,p,w){p=Number(p)||0;let T=a.length-p;w?(w=Number(w),w>T&&(w=T)):w=T;let j=u.length;w>j/2&&(w=j/2);let G;for(G=0;G<w;++G){let _e=parseInt(u.substr(G*2,2),16);if(oe(_e))return G;a[p+G]=_e}return G}function M(a,u,p,w){return ue(U(u,a.length-p),a,p,w)}function J(a,u,p,w){return ue(Q(u),a,p,w)}function Y(a,u,p,w){return ue(te(u),a,p,w)}function se(a,u,p,w){return ue(re(u,a.length-p),a,p,w)}e.prototype.write=function(a,u,p,w){if(u===void 0)w="utf8",p=this.length,u=0;else if(p===void 0&&typeof u=="string")w=u,p=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(p)?(p=p>>>0,w===void 0&&(w="utf8")):(w=p,p=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let T=this.length-u;if((p===void 0||p>T)&&(p=T),a.length>0&&(p<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");w||(w="utf8");let j=!1;for(;;)switch(w){case"hex":return k(this,a,u,p);case"utf8":case"utf-8":return M(this,a,u,p);case"ascii":case"latin1":case"binary":return J(this,a,u,p);case"base64":return Y(this,a,u,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return se(this,a,u,p);default:if(j)throw new TypeError("Unknown encoding: "+w);w=(""+w).toLowerCase(),j=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(a,u,p){return u===0&&p===a.length?s.fromByteArray(a):s.fromByteArray(a.slice(u,p))}function K(a,u,p){p=Math.min(a.length,p);let w=[],T=u;for(;T<p;){let j=a[T],G=null,_e=j>239?4:j>223?3:j>191?2:1;if(T+_e<=p){let we,Te,xe,Oe;switch(_e){case 1:j<128&&(G=j);break;case 2:we=a[T+1],(we&192)===128&&(Oe=(j&31)<<6|we&63,Oe>127&&(G=Oe));break;case 3:we=a[T+1],Te=a[T+2],(we&192)===128&&(Te&192)===128&&(Oe=(j&15)<<12|(we&63)<<6|Te&63,Oe>2047&&(Oe<55296||Oe>57343)&&(G=Oe));break;case 4:we=a[T+1],Te=a[T+2],xe=a[T+3],(we&192)===128&&(Te&192)===128&&(xe&192)===128&&(Oe=(j&15)<<18|(we&63)<<12|(Te&63)<<6|xe&63,Oe>65535&&Oe<1114112&&(G=Oe))}}G===null?(G=65533,_e=1):G>65535&&(G-=65536,w.push(G>>>10&1023|55296),G=56320|G&1023),w.push(G),T+=_e}return W(w)}let X=4096;function W(a){let u=a.length;if(u<=X)return String.fromCharCode.apply(String,a);let p="",w=0;for(;w<u;)p+=String.fromCharCode.apply(String,a.slice(w,w+=X));return p}function ge(a,u,p){let w="";p=Math.min(a.length,p);for(let T=u;T<p;++T)w+=String.fromCharCode(a[T]&127);return w}function de(a,u,p){let w="";p=Math.min(a.length,p);for(let T=u;T<p;++T)w+=String.fromCharCode(a[T]);return w}function le(a,u,p){let w=a.length;(!u||u<0)&&(u=0),(!p||p<0||p>w)&&(p=w);let T="";for(let j=u;j<p;++j)T+=me[a[j]];return T}function Ee(a,u,p){let w=a.slice(u,p),T="";for(let j=0;j<w.length-1;j+=2)T+=String.fromCharCode(w[j]+w[j+1]*256);return T}e.prototype.slice=function(a,u){let p=this.length;a=~~a,u=u===void 0?p:~~u,a<0?(a+=p,a<0&&(a=0)):a>p&&(a=p),u<0?(u+=p,u<0&&(u=0)):u>p&&(u=p),u<a&&(u=a);let w=this.subarray(a,u);return Object.setPrototypeOf(w,e.prototype),w};function z(a,u,p){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+u>p)throw new RangeError("Trying to access beyond buffer length")}e.prototype.readUintLE=e.prototype.readUIntLE=function(a,u,p){a=a>>>0,u=u>>>0,p||z(a,u,this.length);let w=this[a],T=1,j=0;for(;++j<u&&(T*=256);)w+=this[a+j]*T;return w},e.prototype.readUintBE=e.prototype.readUIntBE=function(a,u,p){a=a>>>0,u=u>>>0,p||z(a,u,this.length);let w=this[a+--u],T=1;for(;u>0&&(T*=256);)w+=this[a+--u]*T;return w},e.prototype.readUint8=e.prototype.readUInt8=function(a,u){return a=a>>>0,u||z(a,1,this.length),this[a]},e.prototype.readUint16LE=e.prototype.readUInt16LE=function(a,u){return a=a>>>0,u||z(a,2,this.length),this[a]|this[a+1]<<8},e.prototype.readUint16BE=e.prototype.readUInt16BE=function(a,u){return a=a>>>0,u||z(a,2,this.length),this[a]<<8|this[a+1]},e.prototype.readUint32LE=e.prototype.readUInt32LE=function(a,u){return a=a>>>0,u||z(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+this[a+3]*16777216},e.prototype.readUint32BE=e.prototype.readUInt32BE=function(a,u){return a=a>>>0,u||z(a,4,this.length),this[a]*16777216+(this[a+1]<<16|this[a+2]<<8|this[a+3])},e.prototype.readBigUInt64LE=ee(function(a){a=a>>>0,V(a,"offset");let u=this[a],p=this[a+7];(u===void 0||p===void 0)&&ae(a,this.length-8);let w=u+this[++a]*2**8+this[++a]*2**16+this[++a]*2**24,T=this[++a]+this[++a]*2**8+this[++a]*2**16+p*2**24;return BigInt(w)+(BigInt(T)<<BigInt(32))}),e.prototype.readBigUInt64BE=ee(function(a){a=a>>>0,V(a,"offset");let u=this[a],p=this[a+7];(u===void 0||p===void 0)&&ae(a,this.length-8);let w=u*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+p;return(BigInt(w)<<BigInt(32))+BigInt(T)}),e.prototype.readIntLE=function(a,u,p){a=a>>>0,u=u>>>0,p||z(a,u,this.length);let w=this[a],T=1,j=0;for(;++j<u&&(T*=256);)w+=this[a+j]*T;return T*=128,w>=T&&(w-=Math.pow(2,8*u)),w},e.prototype.readIntBE=function(a,u,p){a=a>>>0,u=u>>>0,p||z(a,u,this.length);let w=u,T=1,j=this[a+--w];for(;w>0&&(T*=256);)j+=this[a+--w]*T;return T*=128,j>=T&&(j-=Math.pow(2,8*u)),j},e.prototype.readInt8=function(a,u){return a=a>>>0,u||z(a,1,this.length),this[a]&128?(255-this[a]+1)*-1:this[a]},e.prototype.readInt16LE=function(a,u){a=a>>>0,u||z(a,2,this.length);let p=this[a]|this[a+1]<<8;return p&32768?p|4294901760:p},e.prototype.readInt16BE=function(a,u){a=a>>>0,u||z(a,2,this.length);let p=this[a+1]|this[a]<<8;return p&32768?p|4294901760:p},e.prototype.readInt32LE=function(a,u){return a=a>>>0,u||z(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},e.prototype.readInt32BE=function(a,u){return a=a>>>0,u||z(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},e.prototype.readBigInt64LE=ee(function(a){a=a>>>0,V(a,"offset");let u=this[a],p=this[a+7];(u===void 0||p===void 0)&&ae(a,this.length-8);let w=this[a+4]+this[a+5]*2**8+this[a+6]*2**16+(p<<24);return(BigInt(w)<<BigInt(32))+BigInt(u+this[++a]*2**8+this[++a]*2**16+this[++a]*2**24)}),e.prototype.readBigInt64BE=ee(function(a){a=a>>>0,V(a,"offset");let u=this[a],p=this[a+7];(u===void 0||p===void 0)&&ae(a,this.length-8);let w=(u<<24)+this[++a]*2**16+this[++a]*2**8+this[++a];return(BigInt(w)<<BigInt(32))+BigInt(this[++a]*2**24+this[++a]*2**16+this[++a]*2**8+p)}),e.prototype.readFloatLE=function(a,u){return a=a>>>0,u||z(a,4,this.length),f.read(this,a,!0,23,4)},e.prototype.readFloatBE=function(a,u){return a=a>>>0,u||z(a,4,this.length),f.read(this,a,!1,23,4)},e.prototype.readDoubleLE=function(a,u){return a=a>>>0,u||z(a,8,this.length),f.read(this,a,!0,52,8)},e.prototype.readDoubleBE=function(a,u){return a=a>>>0,u||z(a,8,this.length),f.read(this,a,!1,52,8)};function pe(a,u,p,w,T,j){if(!e.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>T||u<j)throw new RangeError('"value" argument is out of bounds');if(p+w>a.length)throw new RangeError("Index out of range")}e.prototype.writeUintLE=e.prototype.writeUIntLE=function(a,u,p,w){if(a=+a,u=u>>>0,p=p>>>0,!w){let G=Math.pow(2,8*p)-1;pe(this,a,u,p,G,0)}let T=1,j=0;for(this[u]=a&255;++j<p&&(T*=256);)this[u+j]=a/T&255;return u+p},e.prototype.writeUintBE=e.prototype.writeUIntBE=function(a,u,p,w){if(a=+a,u=u>>>0,p=p>>>0,!w){let G=Math.pow(2,8*p)-1;pe(this,a,u,p,G,0)}let T=p-1,j=1;for(this[u+T]=a&255;--T>=0&&(j*=256);)this[u+T]=a/j&255;return u+p},e.prototype.writeUint8=e.prototype.writeUInt8=function(a,u,p){return a=+a,u=u>>>0,p||pe(this,a,u,1,255,0),this[u]=a&255,u+1},e.prototype.writeUint16LE=e.prototype.writeUInt16LE=function(a,u,p){return a=+a,u=u>>>0,p||pe(this,a,u,2,65535,0),this[u]=a&255,this[u+1]=a>>>8,u+2},e.prototype.writeUint16BE=e.prototype.writeUInt16BE=function(a,u,p){return a=+a,u=u>>>0,p||pe(this,a,u,2,65535,0),this[u]=a>>>8,this[u+1]=a&255,u+2},e.prototype.writeUint32LE=e.prototype.writeUInt32LE=function(a,u,p){return a=+a,u=u>>>0,p||pe(this,a,u,4,4294967295,0),this[u+3]=a>>>24,this[u+2]=a>>>16,this[u+1]=a>>>8,this[u]=a&255,u+4},e.prototype.writeUint32BE=e.prototype.writeUInt32BE=function(a,u,p){return a=+a,u=u>>>0,p||pe(this,a,u,4,4294967295,0),this[u]=a>>>24,this[u+1]=a>>>16,this[u+2]=a>>>8,this[u+3]=a&255,u+4};function R(a,u,p,w,T){$(u,w,T,a,p,7);let j=Number(u&BigInt(4294967295));a[p++]=j,j=j>>8,a[p++]=j,j=j>>8,a[p++]=j,j=j>>8,a[p++]=j;let G=Number(u>>BigInt(32)&BigInt(4294967295));return a[p++]=G,G=G>>8,a[p++]=G,G=G>>8,a[p++]=G,G=G>>8,a[p++]=G,p}function ie(a,u,p,w,T){$(u,w,T,a,p,7);let j=Number(u&BigInt(4294967295));a[p+7]=j,j=j>>8,a[p+6]=j,j=j>>8,a[p+5]=j,j=j>>8,a[p+4]=j;let G=Number(u>>BigInt(32)&BigInt(4294967295));return a[p+3]=G,G=G>>8,a[p+2]=G,G=G>>8,a[p+1]=G,G=G>>8,a[p]=G,p+8}e.prototype.writeBigUInt64LE=ee(function(a,u=0){return R(this,a,u,BigInt(0),BigInt("0xffffffffffffffff"))}),e.prototype.writeBigUInt64BE=ee(function(a,u=0){return ie(this,a,u,BigInt(0),BigInt("0xffffffffffffffff"))}),e.prototype.writeIntLE=function(a,u,p,w){if(a=+a,u=u>>>0,!w){let _e=Math.pow(2,8*p-1);pe(this,a,u,p,_e-1,-_e)}let T=0,j=1,G=0;for(this[u]=a&255;++T<p&&(j*=256);)a<0&&G===0&&this[u+T-1]!==0&&(G=1),this[u+T]=(a/j>>0)-G&255;return u+p},e.prototype.writeIntBE=function(a,u,p,w){if(a=+a,u=u>>>0,!w){let _e=Math.pow(2,8*p-1);pe(this,a,u,p,_e-1,-_e)}let T=p-1,j=1,G=0;for(this[u+T]=a&255;--T>=0&&(j*=256);)a<0&&G===0&&this[u+T+1]!==0&&(G=1),this[u+T]=(a/j>>0)-G&255;return u+p},e.prototype.writeInt8=function(a,u,p){return a=+a,u=u>>>0,p||pe(this,a,u,1,127,-128),a<0&&(a=255+a+1),this[u]=a&255,u+1},e.prototype.writeInt16LE=function(a,u,p){return a=+a,u=u>>>0,p||pe(this,a,u,2,32767,-32768),this[u]=a&255,this[u+1]=a>>>8,u+2},e.prototype.writeInt16BE=function(a,u,p){return a=+a,u=u>>>0,p||pe(this,a,u,2,32767,-32768),this[u]=a>>>8,this[u+1]=a&255,u+2},e.prototype.writeInt32LE=function(a,u,p){return a=+a,u=u>>>0,p||pe(this,a,u,4,2147483647,-2147483648),this[u]=a&255,this[u+1]=a>>>8,this[u+2]=a>>>16,this[u+3]=a>>>24,u+4},e.prototype.writeInt32BE=function(a,u,p){return a=+a,u=u>>>0,p||pe(this,a,u,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[u]=a>>>24,this[u+1]=a>>>16,this[u+2]=a>>>8,this[u+3]=a&255,u+4},e.prototype.writeBigInt64LE=ee(function(a,u=0){return R(this,a,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),e.prototype.writeBigInt64BE=ee(function(a,u=0){return ie(this,a,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ye(a,u,p,w,T,j){if(p+w>a.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function F(a,u,p,w,T){return u=+u,p=p>>>0,T||ye(a,u,p,4),f.write(a,u,p,w,23,4),p+4}e.prototype.writeFloatLE=function(a,u,p){return F(this,a,u,!0,p)},e.prototype.writeFloatBE=function(a,u,p){return F(this,a,u,!1,p)};function Ie(a,u,p,w,T){return u=+u,p=p>>>0,T||ye(a,u,p,8),f.write(a,u,p,w,52,8),p+8}e.prototype.writeDoubleLE=function(a,u,p){return Ie(this,a,u,!0,p)},e.prototype.writeDoubleBE=function(a,u,p){return Ie(this,a,u,!1,p)},e.prototype.copy=function(a,u,p,w){if(!e.isBuffer(a))throw new TypeError("argument should be a Buffer");if(p||(p=0),!w&&w!==0&&(w=this.length),u>=a.length&&(u=a.length),u||(u=0),w>0&&w<p&&(w=p),w===p||a.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(p<0||p>=this.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("sourceEnd out of bounds");w>this.length&&(w=this.length),a.length-u<w-p&&(w=a.length-u+p);let T=w-p;return this===a&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,p,w):Uint8Array.prototype.set.call(a,this.subarray(p,w),u),T},e.prototype.fill=function(a,u,p,w){if(typeof a=="string"){if(typeof u=="string"?(w=u,u=0,p=this.length):typeof p=="string"&&(w=p,p=this.length),w!==void 0&&typeof w!="string")throw new TypeError("encoding must be a string");if(typeof w=="string"&&!e.isEncoding(w))throw new TypeError("Unknown encoding: "+w);if(a.length===1){let j=a.charCodeAt(0);(w==="utf8"&&j<128||w==="latin1")&&(a=j)}}else typeof a=="number"?a=a&255:typeof a=="boolean"&&(a=Number(a));if(u<0||this.length<u||this.length<p)throw new RangeError("Out of range index");if(p<=u)return this;u=u>>>0,p=p===void 0?this.length:p>>>0,a||(a=0);let T;if(typeof a=="number")for(T=u;T<p;++T)this[T]=a;else{let j=e.isBuffer(a)?a:e.from(a,w),G=j.length;if(G===0)throw new TypeError('The value "'+a+'" is invalid for argument "value"');for(T=0;T<p-u;++T)this[T+u]=j[T%G]}return this};let H={};function L(a,u,p){H[a]=class extends p{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${a}]`,this.stack,delete this.name}get code(){return a}set code(w){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:w,writable:!0})}toString(){return`${this.name} [${a}]: ${this.message}`}}}L("ERR_BUFFER_OUT_OF_BOUNDS",function(a){return a?`${a} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),L("ERR_INVALID_ARG_TYPE",function(a,u){return`The "${a}" argument must be of type number. Received type ${typeof u}`},TypeError),L("ERR_OUT_OF_RANGE",function(a,u,p){let w=`The value of "${a}" is out of range.`,T=p;return Number.isInteger(p)&&Math.abs(p)>2**32?T=Z(String(p)):typeof p=="bigint"&&(T=String(p),(p>BigInt(2)**BigInt(32)||p<-(BigInt(2)**BigInt(32)))&&(T=Z(T)),T+="n"),w+=` It must be ${u}. Received ${T}`,w},RangeError);function Z(a){let u="",p=a.length,w=a[0]==="-"?1:0;for(;p>=w+4;p-=3)u=`_${a.slice(p-3,p)}${u}`;return`${a.slice(0,p)}${u}`}function q(a,u,p){V(u,"offset"),(a[u]===void 0||a[u+p]===void 0)&&ae(u,a.length-(p+1))}function $(a,u,p,w,T,j){if(a>p||a<u){let G=typeof u=="bigint"?"n":"",_e;throw u===0||u===BigInt(0)?_e=`>= 0${G} and < 2${G} ** ${(j+1)*8}${G}`:_e=`>= -(2${G} ** ${(j+1)*8-1}${G}) and < 2 ** ${(j+1)*8-1}${G}`,new H.ERR_OUT_OF_RANGE("value",_e,a)}q(w,T,j)}function V(a,u){if(typeof a!="number")throw new H.ERR_INVALID_ARG_TYPE(u,"number",a)}function ae(a,u,p){throw Math.floor(a)!==a?(V(a,p),new H.ERR_OUT_OF_RANGE("offset","an integer",a)):u<0?new H.ERR_BUFFER_OUT_OF_BOUNDS:new H.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,a)}let ne=/[^+/0-9A-Za-z-_]/g;function x(a){if(a=a.split("=")[0],a=a.trim().replace(ne,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function U(a,u){u=u||1/0;let p,w=a.length,T=null,j=[];for(let G=0;G<w;++G){if(p=a.charCodeAt(G),p>55295&&p<57344){if(!T){if(p>56319){(u-=3)>-1&&j.push(239,191,189);continue}else if(G+1===w){(u-=3)>-1&&j.push(239,191,189);continue}T=p;continue}if(p<56320){(u-=3)>-1&&j.push(239,191,189),T=p;continue}p=(T-55296<<10|p-56320)+65536}else T&&(u-=3)>-1&&j.push(239,191,189);if(T=null,p<128){if((u-=1)<0)break;j.push(p)}else if(p<2048){if((u-=2)<0)break;j.push(p>>6|192,p&63|128)}else if(p<65536){if((u-=3)<0)break;j.push(p>>12|224,p>>6&63|128,p&63|128)}else if(p<1114112){if((u-=4)<0)break;j.push(p>>18|240,p>>12&63|128,p>>6&63|128,p&63|128)}else throw new Error("Invalid code point")}return j}function Q(a){let u=[];for(let p=0;p<a.length;++p)u.push(a.charCodeAt(p)&255);return u}function re(a,u){let p,w,T,j=[];for(let G=0;G<a.length&&!((u-=2)<0);++G)p=a.charCodeAt(G),w=p>>8,T=p%256,j.push(T),j.push(w);return j}function te(a){return s.toByteArray(x(a))}function ue(a,u,p,w){let T;for(T=0;T<w&&!(T+p>=u.length||T>=a.length);++T)u[T+p]=a[T];return T}function D(a,u){return a instanceof u||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===u.name}function oe(a){return a!==a}let me=function(){let a="0123456789abcdef",u=new Array(256);for(let p=0;p<16;++p){let w=p*16;for(let T=0;T<16;++T)u[w+T]=a[p]+a[T]}return u}();function ee(a){return typeof BigInt>"u"?Pe:a}function Pe(){throw new Error("BigInt not supported")}return Bt}var rr,hn,ur,cn,Bt,fn,Et,xr,Ro,xo,Xe=nt(()=>{he(),fe(),ce(),rr={},hn=!1,ur={},cn=!1,Bt={},fn=!1,Et=Pa(),Et.Buffer,Et.SlowBuffer,Et.INSPECT_MAX_BYTES,Et.kMaxLength,xr=Et.Buffer,Ro=Et.INSPECT_MAX_BYTES,xo=Et.kMaxLength}),fe=nt(()=>{Xe()}),Oa=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0});var f=class{constructor(o){this.aliasToTopic={},this.max=o}put(o,l){return l===0||l>this.max?!1:(this.aliasToTopic[l]=o,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(o){return this.aliasToTopic[o]}clear(){this.aliasToTopic={}}};s.default=f}),ze=be((s,f)=>{he(),fe(),ce();var o=class extends Error{constructor(l){if(!Array.isArray(l))throw new TypeError(`Expected input to be an Array, got ${typeof l}`);let c="";for(let i=0;i<l.length;i++)c+=` ${l[i].stack}
- `;super(c),this.name="AggregateError",this.errors=l}};f.exports={AggregateError:o,ArrayIsArray(l){return Array.isArray(l)},ArrayPrototypeIncludes(l,c){return l.includes(c)},ArrayPrototypeIndexOf(l,c){return l.indexOf(c)},ArrayPrototypeJoin(l,c){return l.join(c)},ArrayPrototypeMap(l,c){return l.map(c)},ArrayPrototypePop(l,c){return l.pop(c)},ArrayPrototypePush(l,c){return l.push(c)},ArrayPrototypeSlice(l,c,i){return l.slice(c,i)},Error,FunctionPrototypeCall(l,c,...i){return l.call(c,...i)},FunctionPrototypeSymbolHasInstance(l,c){return Function.prototype[Symbol.hasInstance].call(l,c)},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(l,c){return Object.defineProperties(l,c)},ObjectDefineProperty(l,c,i){return Object.defineProperty(l,c,i)},ObjectGetOwnPropertyDescriptor(l,c){return Object.getOwnPropertyDescriptor(l,c)},ObjectKeys(l){return Object.keys(l)},ObjectSetPrototypeOf(l,c){return Object.setPrototypeOf(l,c)},Promise,PromisePrototypeCatch(l,c){return l.catch(c)},PromisePrototypeThen(l,c,i){return l.then(c,i)},PromiseReject(l){return Promise.reject(l)},PromiseResolve(l){return Promise.resolve(l)},ReflectApply:Reflect.apply,RegExpPrototypeTest(l,c){return l.test(c)},SafeSet:Set,String,StringPrototypeSlice(l,c,i){return l.slice(c,i)},StringPrototypeToLowerCase(l){return l.toLowerCase()},StringPrototypeToUpperCase(l){return l.toUpperCase()},StringPrototypeTrim(l){return l.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(l,c,i){return l.set(c,i)},Boolean,Uint8Array}}),Bo=be((s,f)=>{he(),fe(),ce(),f.exports={format(o,...l){return o.replace(/%([sdifj])/g,function(...[c,i]){let e=l.shift();return i==="f"?e.toFixed(6):i==="j"?JSON.stringify(e):i==="s"&&typeof e=="object"?`${e.constructor!==Object?e.constructor.name:""} {}`.trim():e.toString()})},inspect(o){switch(typeof o){case"string":if(o.includes("'"))if(o.includes('"')){if(!o.includes("`")&&!o.includes("${"))return`\`${o}\``}else return`"${o}"`;return`'${o}'`;case"number":return isNaN(o)?"NaN":Object.is(o,-0)?String(o):o;case"bigint":return`${String(o)}n`;case"boolean":case"undefined":return String(o);case"object":return"{}"}}}}),ot=be((s,f)=>{he(),fe(),ce();var{format:o,inspect:l}=Bo(),{AggregateError:c}=ze(),i=globalThis.AggregateError||c,e=Symbol("kIsNodeError"),r=["string","function","number","object","Function","Object","boolean","bigint","symbol"],t=/^([A-Z][a-z0-9]*)+$/,n="__node_internal_",h={};function d(y,E){if(!y)throw new h.ERR_INTERNAL_ASSERTION(E)}function g(y){let E="",N=y.length,B=y[0]==="-"?1:0;for(;N>=B+4;N-=3)E=`_${y.slice(N-3,N)}${E}`;return`${y.slice(0,N)}${E}`}function b(y,E,N){if(typeof E=="function")return d(E.length<=N.length,`Code: ${y}; The provided arguments length (${N.length}) does not match the required ones (${E.length}).`),E(...N);let B=(E.match(/%[dfijoOs]/g)||[]).length;return d(B===N.length,`Code: ${y}; The provided arguments length (${N.length}) does not match the required ones (${B}).`),N.length===0?E:o(E,...N)}function m(y,E,N){N||(N=Error);class B extends N{constructor(...k){super(b(y,E,k))}toString(){return`${this.name} [${y}]: ${this.message}`}}Object.defineProperties(B.prototype,{name:{value:N.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${y}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),B.prototype.code=y,B.prototype[e]=!0,h[y]=B}function v(y){let E=n+y.name;return Object.defineProperty(y,"name",{value:E}),y}function _(y,E){if(y&&E&&y!==E){if(Array.isArray(E.errors))return E.errors.push(y),E;let N=new i([E,y],E.message);return N.code=E.code,N}return y||E}var I=class extends Error{constructor(y="The operation was aborted",E=void 0){if(E!==void 0&&typeof E!="object")throw new h.ERR_INVALID_ARG_TYPE("options","Object",E);super(y,E),this.code="ABORT_ERR",this.name="AbortError"}};m("ERR_ASSERTION","%s",Error),m("ERR_INVALID_ARG_TYPE",(y,E,N)=>{d(typeof y=="string","'name' must be a string"),Array.isArray(E)||(E=[E]);let B="The ";y.endsWith(" argument")?B+=`${y} `:B+=`"${y}" ${y.includes(".")?"property":"argument"} `,B+="must be ";let S=[],k=[],M=[];for(let Y of E)d(typeof Y=="string","All expected entries have to be of type string"),r.includes(Y)?S.push(Y.toLowerCase()):t.test(Y)?k.push(Y):(d(Y!=="object",'The value "object" should be written as "Object"'),M.push(Y));if(k.length>0){let Y=S.indexOf("object");Y!==-1&&(S.splice(S,Y,1),k.push("Object"))}if(S.length>0){switch(S.length){case 1:B+=`of type ${S[0]}`;break;case 2:B+=`one of type ${S[0]} or ${S[1]}`;break;default:{let Y=S.pop();B+=`one of type ${S.join(", ")}, or ${Y}`}}(k.length>0||M.length>0)&&(B+=" or ")}if(k.length>0){switch(k.length){case 1:B+=`an instance of ${k[0]}`;break;case 2:B+=`an instance of ${k[0]} or ${k[1]}`;break;default:{let Y=k.pop();B+=`an instance of ${k.join(", ")}, or ${Y}`}}M.length>0&&(B+=" or ")}switch(M.length){case 0:break;case 1:M[0].toLowerCase()!==M[0]&&(B+="an "),B+=`${M[0]}`;break;case 2:B+=`one of ${M[0]} or ${M[1]}`;break;default:{let Y=M.pop();B+=`one of ${M.join(", ")}, or ${Y}`}}if(N==null)B+=`. Received ${N}`;else if(typeof N=="function"&&N.name)B+=`. Received function ${N.name}`;else if(typeof N=="object"){var J;if((J=N.constructor)!==null&&J!==void 0&&J.name)B+=`. Received an instance of ${N.constructor.name}`;else{let Y=l(N,{depth:-1});B+=`. Received ${Y}`}}else{let Y=l(N,{colors:!1});Y.length>25&&(Y=`${Y.slice(0,25)}...`),B+=`. Received type ${typeof N} (${Y})`}return B},TypeError),m("ERR_INVALID_ARG_VALUE",(y,E,N="is invalid")=>{let B=l(E);return B.length>128&&(B=B.slice(0,128)+"..."),`The ${y.includes(".")?"property":"argument"} '${y}' ${N}. Received ${B}`},TypeError),m("ERR_INVALID_RETURN_VALUE",(y,E,N)=>{var B;let S=N!=null&&(B=N.constructor)!==null&&B!==void 0&&B.name?`instance of ${N.constructor.name}`:`type ${typeof N}`;return`Expected ${y} to be returned from the "${E}" function but got ${S}.`},TypeError),m("ERR_MISSING_ARGS",(...y)=>{d(y.length>0,"At least one arg needs to be specified");let E,N=y.length;switch(y=(Array.isArray(y)?y:[y]).map(B=>`"${B}"`).join(" or "),N){case 1:E+=`The ${y[0]} argument`;break;case 2:E+=`The ${y[0]} and ${y[1]} arguments`;break;default:{let B=y.pop();E+=`The ${y.join(", ")}, and ${B} arguments`}break}return`${E} must be specified`},TypeError),m("ERR_OUT_OF_RANGE",(y,E,N)=>{d(E,'Missing "range" argument');let B;if(Number.isInteger(N)&&Math.abs(N)>2**32)B=g(String(N));else if(typeof N=="bigint"){B=String(N);let S=BigInt(2)**BigInt(32);(N>S||N<-S)&&(B=g(B)),B+="n"}else B=l(N);return`The value of "${y}" is out of range. It must be ${E}. Received ${B}`},RangeError),m("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),m("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),m("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),m("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),m("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),m("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),m("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),m("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),m("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),m("ERR_STREAM_WRITE_AFTER_END","write after end",Error),m("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),f.exports={AbortError:I,aggregateTwoErrors:v(_),hideStackFrames:v,codes:h}}),dr=be((s,f)=>{he(),fe(),ce();var{AbortController:o,AbortSignal:l}=typeof self<"u"?self:typeof window<"u"?window:void 0;f.exports=o,f.exports.AbortSignal=l,f.exports.default=o});function Ue(){Ue.init.call(this)}function kr(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}function Mo(s){return s._maxListeners===void 0?Ue.defaultMaxListeners:s._maxListeners}function Vn(s,f,o,l){var c,i,e,r;if(kr(o),(i=s._events)===void 0?(i=s._events=Object.create(null),s._eventsCount=0):(i.newListener!==void 0&&(s.emit("newListener",f,o.listener?o.listener:o),i=s._events),e=i[f]),e===void 0)e=i[f]=o,++s._eventsCount;else if(typeof e=="function"?e=i[f]=l?[o,e]:[e,o]:l?e.unshift(o):e.push(o),(c=Mo(s))>0&&e.length>c&&!e.warned){e.warned=!0;var t=new Error("Possible EventEmitter memory leak detected. "+e.length+" "+String(f)+" listeners added. Use emitter.setMaxListeners() to increase limit");t.name="MaxListenersExceededWarning",t.emitter=s,t.type=f,t.count=e.length,r=t,console&&console.warn&&console.warn(r)}return s}function Ra(){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 Hn(s,f,o){var l={fired:!1,wrapFn:void 0,target:s,type:f,listener:o},c=Ra.bind(l);return c.listener=o,l.wrapFn=c,c}function zn(s,f,o){var l=s._events;if(l===void 0)return[];var c=l[f];return c===void 0?[]:typeof c=="function"?o?[c.listener||c]:[c]:o?function(i){for(var e=new Array(i.length),r=0;r<e.length;++r)e[r]=i[r].listener||i[r];return e}(c):No(c,c.length)}function Gn(s){var f=this._events;if(f!==void 0){var o=f[s];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}function No(s,f){for(var o=new Array(f),l=0;l<f;++l)o[l]=s[l];return o}var Kn,Qn,qt,Yr,Jr,Xr,ut,Yn=nt(()=>{he(),fe(),ce(),qt=typeof Reflect=="object"?Reflect:null,Yr=qt&&typeof qt.apply=="function"?qt.apply:function(s,f,o){return Function.prototype.apply.call(s,f,o)},Qn=qt&&typeof qt.ownKeys=="function"?qt.ownKeys:Object.getOwnPropertySymbols?function(s){return Object.getOwnPropertyNames(s).concat(Object.getOwnPropertySymbols(s))}:function(s){return Object.getOwnPropertyNames(s)},Jr=Number.isNaN||function(s){return s!=s},Kn=Ue,Ue.EventEmitter=Ue,Ue.prototype._events=void 0,Ue.prototype._eventsCount=0,Ue.prototype._maxListeners=void 0,Xr=10,Object.defineProperty(Ue,"defaultMaxListeners",{enumerable:!0,get:function(){return Xr},set:function(s){if(typeof s!="number"||s<0||Jr(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");Xr=s}}),Ue.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},Ue.prototype.setMaxListeners=function(s){if(typeof s!="number"||s<0||Jr(s))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+s+".");return this._maxListeners=s,this},Ue.prototype.getMaxListeners=function(){return Mo(this)},Ue.prototype.emit=function(s){for(var f=[],o=1;o<arguments.length;o++)f.push(arguments[o]);var l=s==="error",c=this._events;if(c!==void 0)l=l&&c.error===void 0;else if(!l)return!1;if(l){var i;if(f.length>0&&(i=f[0]),i instanceof Error)throw i;var e=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw e.context=i,e}var r=c[s];if(r===void 0)return!1;if(typeof r=="function")Yr(r,this,f);else{var t=r.length,n=No(r,t);for(o=0;o<t;++o)Yr(n[o],this,f)}return!0},Ue.prototype.addListener=function(s,f){return Vn(this,s,f,!1)},Ue.prototype.on=Ue.prototype.addListener,Ue.prototype.prependListener=function(s,f){return Vn(this,s,f,!0)},Ue.prototype.once=function(s,f){return kr(f),this.on(s,Hn(this,s,f)),this},Ue.prototype.prependOnceListener=function(s,f){return kr(f),this.prependListener(s,Hn(this,s,f)),this},Ue.prototype.removeListener=function(s,f){var o,l,c,i,e;if(kr(f),(l=this._events)===void 0)return this;if((o=l[s])===void 0)return this;if(o===f||o.listener===f)--this._eventsCount==0?this._events=Object.create(null):(delete l[s],l.removeListener&&this.emit("removeListener",s,o.listener||f));else if(typeof o!="function"){for(c=-1,i=o.length-1;i>=0;i--)if(o[i]===f||o[i].listener===f){e=o[i].listener,c=i;break}if(c<0)return this;c===0?o.shift():function(r,t){for(;t+1<r.length;t++)r[t]=r[t+1];r.pop()}(o,c),o.length===1&&(l[s]=o[0]),l.removeListener!==void 0&&this.emit("removeListener",s,e||f)}return this},Ue.prototype.off=Ue.prototype.removeListener,Ue.prototype.removeAllListeners=function(s){var f,o,l;if((o=this._events)===void 0)return this;if(o.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):o[s]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete o[s]),this;if(arguments.length===0){var c,i=Object.keys(o);for(l=0;l<i.length;++l)(c=i[l])!=="removeListener"&&this.removeAllListeners(c);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(typeof(f=o[s])=="function")this.removeListener(s,f);else if(f!==void 0)for(l=f.length-1;l>=0;l--)this.removeListener(s,f[l]);return this},Ue.prototype.listeners=function(s){return zn(this,s,!0)},Ue.prototype.rawListeners=function(s){return zn(this,s,!1)},Ue.listenerCount=function(s,f){return typeof s.listenerCount=="function"?s.listenerCount(f):Gn.call(s,f)},Ue.prototype.listenerCount=Gn,Ue.prototype.eventNames=function(){return this._eventsCount>0?Qn(this._events):[]},ut=Kn,ut.EventEmitter,ut.defaultMaxListeners,ut.init,ut.listenerCount,ut.EventEmitter,ut.defaultMaxListeners,ut.init,ut.listenerCount}),Ut={};ir(Ut,{EventEmitter:()=>Lo,default:()=>ut,defaultMaxListeners:()=>jo,init:()=>Uo,listenerCount:()=>Do,on:()=>Fo,once:()=>Wo});var Lo,jo,Uo,Do,Fo,Wo,Jt=nt(()=>{he(),fe(),ce(),Yn(),Yn(),ut.once=function(s,f){return new Promise((o,l)=>{function c(...e){i!==void 0&&s.removeListener("error",i),o(e)}let i;f!=="error"&&(i=e=>{s.removeListener(name,c),l(e)},s.once("error",i)),s.once(f,c)})},ut.on=function(s,f){let o=[],l=[],c=null,i=!1,e={async next(){let n=o.shift();if(n)return createIterResult(n,!1);if(c){let h=Promise.reject(c);return c=null,h}return i?createIterResult(void 0,!0):new Promise((h,d)=>l.push({resolve:h,reject:d}))},async return(){s.removeListener(f,r),s.removeListener("error",t),i=!0;for(let n of l)n.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(n){c=n,s.removeListener(f,r),s.removeListener("error",t)},[Symbol.asyncIterator](){return this}};return s.on(f,r),s.on("error",t),e;function r(...n){let h=l.shift();h?h.resolve(createIterResult(n,!1)):o.push(n)}function t(n){i=!0;let h=l.shift();h?h.reject(n):c=n,e.return()}},{EventEmitter:Lo,defaultMaxListeners:jo,init:Uo,listenerCount:Do,on:Fo,once:Wo}=ut}),at=be((s,f)=>{he(),fe(),ce();var o=(Xe(),De(Je)),{format:l,inspect:c}=Bo(),{codes:{ERR_INVALID_ARG_TYPE:i}}=ot(),{kResistStopPropagation:e,AggregateError:r,SymbolDispose:t}=ze(),n=globalThis.AbortSignal||dr().AbortSignal,h=globalThis.AbortController||dr().AbortController,d=Object.getPrototypeOf(async function(){}).constructor,g=globalThis.Blob||o.Blob,b=typeof g<"u"?function(_){return _ instanceof g}:function(_){return!1},m=(_,I)=>{if(_!==void 0&&(_===null||typeof _!="object"||!("aborted"in _)))throw new i(I,"AbortSignal",_)},v=(_,I)=>{if(typeof _!="function")throw new i(I,"Function",_)};f.exports={AggregateError:r,kEmptyObject:Object.freeze({}),once(_){let I=!1;return function(...y){I||(I=!0,_.apply(this,y))}},createDeferredPromise:function(){let _,I;return{promise:new Promise((y,E)=>{_=y,I=E}),resolve:_,reject:I}},promisify(_){return new Promise((I,y)=>{_((E,...N)=>E?y(E):I(...N))})},debuglog(){return function(){}},format:l,inspect:c,types:{isAsyncFunction(_){return _ instanceof d},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:b,deprecate(_,I){return _},addAbortListener:(Jt(),De(Ut)).addAbortListener||function(_,I){if(_===void 0)throw new i("signal","AbortSignal",_);m(_,"signal"),v(I,"listener");let y;return _.aborted?queueMicrotask(()=>I()):(_.addEventListener("abort",I,{__proto__:null,once:!0,[e]:!0}),y=()=>{_.removeEventListener("abort",I)}),{__proto__:null,[t](){var E;(E=y)===null||E===void 0||E()}}},AbortSignalAny:n.any||function(_){if(_.length===1)return _[0];let I=new h,y=()=>I.abort();return _.forEach(E=>{m(E,"signals"),E.addEventListener("abort",y,{once:!0})}),I.signal.addEventListener("abort",()=>{_.forEach(E=>E.removeEventListener("abort",y))},{once:!0}),I.signal}},f.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),pr=be((s,f)=>{he(),fe(),ce();var{ArrayIsArray:o,ArrayPrototypeIncludes:l,ArrayPrototypeJoin:c,ArrayPrototypeMap:i,NumberIsInteger:e,NumberIsNaN:r,NumberMAX_SAFE_INTEGER:t,NumberMIN_SAFE_INTEGER:n,NumberParseInt:h,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:g,String:b,StringPrototypeToUpperCase:m,StringPrototypeTrim:v}=ze(),{hideStackFrames:_,codes:{ERR_SOCKET_BAD_PORT:I,ERR_INVALID_ARG_TYPE:y,ERR_INVALID_ARG_VALUE:E,ERR_OUT_OF_RANGE:N,ERR_UNKNOWN_SIGNAL:B}}=ot(),{normalizeEncoding:S}=at(),{isAsyncFunction:k,isArrayBufferView:M}=at().types,J={};function Y(D){return D===(D|0)}function se(D){return D===D>>>0}var O=/^[0-7]+$/,K="must be a 32-bit unsigned integer or an octal string";function X(D,oe,me){if(typeof D>"u"&&(D=me),typeof D=="string"){if(g(O,D)===null)throw new E(oe,D,K);D=h(D,8)}return de(D,oe),D}var W=_((D,oe,me=n,ee=t)=>{if(typeof D!="number")throw new y(oe,"number",D);if(!e(D))throw new N(oe,"an integer",D);if(D<me||D>ee)throw new N(oe,`>= ${me} && <= ${ee}`,D)}),ge=_((D,oe,me=-2147483648,ee=2147483647)=>{if(typeof D!="number")throw new y(oe,"number",D);if(!e(D))throw new N(oe,"an integer",D);if(D<me||D>ee)throw new N(oe,`>= ${me} && <= ${ee}`,D)}),de=_((D,oe,me=!1)=>{if(typeof D!="number")throw new y(oe,"number",D);if(!e(D))throw new N(oe,"an integer",D);let ee=me?1:0,Pe=4294967295;if(D<ee||D>Pe)throw new N(oe,`>= ${ee} && <= ${Pe}`,D)});function le(D,oe){if(typeof D!="string")throw new y(oe,"string",D)}function Ee(D,oe,me=void 0,ee){if(typeof D!="number")throw new y(oe,"number",D);if(me!=null&&D<me||ee!=null&&D>ee||(me!=null||ee!=null)&&r(D))throw new N(oe,`${me!=null?`>= ${me}`:""}${me!=null&&ee!=null?" && ":""}${ee!=null?`<= ${ee}`:""}`,D)}var z=_((D,oe,me)=>{if(!l(me,D)){let ee="must be one of: "+c(i(me,Pe=>typeof Pe=="string"?`'${Pe}'`:b(Pe)),", ");throw new E(oe,D,ee)}});function pe(D,oe){if(typeof D!="boolean")throw new y(oe,"boolean",D)}function R(D,oe,me){return D==null||!d(D,oe)?me:D[oe]}var ie=_((D,oe,me=null)=>{let ee=R(me,"allowArray",!1),Pe=R(me,"allowFunction",!1);if(!R(me,"nullable",!1)&&D===null||!ee&&o(D)||typeof D!="object"&&(!Pe||typeof D!="function"))throw new y(oe,"Object",D)}),ye=_((D,oe)=>{if(D!=null&&typeof D!="object"&&typeof D!="function")throw new y(oe,"a dictionary",D)}),F=_((D,oe,me=0)=>{if(!o(D))throw new y(oe,"Array",D);if(D.length<me){let ee=`must be longer than ${me}`;throw new E(oe,D,ee)}});function Ie(D,oe){F(D,oe);for(let me=0;me<D.length;me++)le(D[me],`${oe}[${me}]`)}function H(D,oe){F(D,oe);for(let me=0;me<D.length;me++)pe(D[me],`${oe}[${me}]`)}function L(D,oe){F(D,oe);for(let me=0;me<D.length;me++){let ee=D[me],Pe=`${oe}[${me}]`;if(ee==null)throw new y(Pe,"AbortSignal",ee);ae(ee,Pe)}}function Z(D,oe="signal"){if(le(D,oe),J[D]===void 0)throw J[m(D)]!==void 0?new B(D+" (signals must use all capital letters)"):new B(D)}var q=_((D,oe="buffer")=>{if(!M(D))throw new y(oe,["Buffer","TypedArray","DataView"],D)});function $(D,oe){let me=S(oe),ee=D.length;if(me==="hex"&&ee%2!==0)throw new E("encoding",oe,`is invalid for data of length ${ee}`)}function V(D,oe="Port",me=!0){if(typeof D!="number"&&typeof D!="string"||typeof D=="string"&&v(D).length===0||+D!==+D>>>0||D>65535||D===0&&!me)throw new I(oe,D,me);return D|0}var ae=_((D,oe)=>{if(D!==void 0&&(D===null||typeof D!="object"||!("aborted"in D)))throw new y(oe,"AbortSignal",D)}),ne=_((D,oe)=>{if(typeof D!="function")throw new y(oe,"Function",D)}),x=_((D,oe)=>{if(typeof D!="function"||k(D))throw new y(oe,"Function",D)}),U=_((D,oe)=>{if(D!==void 0)throw new y(oe,"undefined",D)});function Q(D,oe,me){if(!l(me,D))throw new y(oe,`('${c(me,"|")}')`,D)}var re=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function te(D,oe){if(typeof D>"u"||!g(re,D))throw new E(oe,D,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function ue(D){if(typeof D=="string")return te(D,"hints"),D;if(o(D)){let oe=D.length,me="";if(oe===0)return me;for(let ee=0;ee<oe;ee++){let Pe=D[ee];te(Pe,"hints"),me+=Pe,ee!==oe-1&&(me+=", ")}return me}throw new E("hints",D,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}f.exports={isInt32:Y,isUint32:se,parseFileMode:X,validateArray:F,validateStringArray:Ie,validateBooleanArray:H,validateAbortSignalArray:L,validateBoolean:pe,validateBuffer:q,validateDictionary:ye,validateEncoding:$,validateFunction:ne,validateInt32:ge,validateInteger:W,validateNumber:Ee,validateObject:ie,validateOneOf:z,validatePlainFunction:x,validatePort:V,validateSignalName:Z,validateString:le,validateUint32:de,validateUndefined:U,validateUnion:Q,validateAbortSignal:ae,validateLinkHeaderValue:ue}}),Xt=be((s,f)=>{he(),fe(),ce();var o=f.exports={},l,c;function i(){throw new Error("setTimeout has not been defined")}function e(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?l=setTimeout:l=i}catch{l=i}try{typeof clearTimeout=="function"?c=clearTimeout:c=e}catch{c=e}})();function r(I){if(l===setTimeout)return setTimeout(I,0);if((l===i||!l)&&setTimeout)return l=setTimeout,setTimeout(I,0);try{return l(I,0)}catch{try{return l.call(null,I,0)}catch{return l.call(this,I,0)}}}function t(I){if(c===clearTimeout)return clearTimeout(I);if((c===e||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(I);try{return c(I)}catch{try{return c.call(null,I)}catch{return c.call(this,I)}}}var n=[],h=!1,d,g=-1;function b(){!h||!d||(h=!1,d.length?n=d.concat(n):g=-1,n.length&&m())}function m(){if(!h){var I=r(b);h=!0;for(var y=n.length;y;){for(d=n,n=[];++g<y;)d&&d[g].run();g=-1,y=n.length}d=null,h=!1,t(I)}}o.nextTick=function(I){var y=new Array(arguments.length-1);if(arguments.length>1)for(var E=1;E<arguments.length;E++)y[E-1]=arguments[E];n.push(new v(I,y)),n.length===1&&!h&&r(m)};function v(I,y){this.fun=I,this.array=y}v.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={};function _(){}o.on=_,o.addListener=_,o.once=_,o.off=_,o.removeListener=_,o.removeAllListeners=_,o.emit=_,o.prependListener=_,o.prependOnceListener=_,o.listeners=function(I){return[]},o.binding=function(I){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(I){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}),Ct=be((s,f)=>{he(),fe(),ce();var{SymbolAsyncIterator:o,SymbolIterator:l,SymbolFor:c}=ze(),i=c("nodejs.stream.destroyed"),e=c("nodejs.stream.errored"),r=c("nodejs.stream.readable"),t=c("nodejs.stream.writable"),n=c("nodejs.stream.disturbed"),h=c("nodejs.webstream.isClosedPromise"),d=c("nodejs.webstream.controllerErrorFunction");function g(R,ie=!1){var ye;return!!(R&&typeof R.pipe=="function"&&typeof R.on=="function"&&(!ie||typeof R.pause=="function"&&typeof R.resume=="function")&&(!R._writableState||((ye=R._readableState)===null||ye===void 0?void 0:ye.readable)!==!1)&&(!R._writableState||R._readableState))}function b(R){var ie;return!!(R&&typeof R.write=="function"&&typeof R.on=="function"&&(!R._readableState||((ie=R._writableState)===null||ie===void 0?void 0:ie.writable)!==!1))}function m(R){return!!(R&&typeof R.pipe=="function"&&R._readableState&&typeof R.on=="function"&&typeof R.write=="function")}function v(R){return R&&(R._readableState||R._writableState||typeof R.write=="function"&&typeof R.on=="function"||typeof R.pipe=="function"&&typeof R.on=="function")}function _(R){return!!(R&&!v(R)&&typeof R.pipeThrough=="function"&&typeof R.getReader=="function"&&typeof R.cancel=="function")}function I(R){return!!(R&&!v(R)&&typeof R.getWriter=="function"&&typeof R.abort=="function")}function y(R){return!!(R&&!v(R)&&typeof R.readable=="object"&&typeof R.writable=="object")}function E(R){return _(R)||I(R)||y(R)}function N(R,ie){return R==null?!1:ie===!0?typeof R[o]=="function":ie===!1?typeof R[l]=="function":typeof R[o]=="function"||typeof R[l]=="function"}function B(R){if(!v(R))return null;let ie=R._writableState,ye=R._readableState,F=ie||ye;return!!(R.destroyed||R[i]||F!=null&&F.destroyed)}function S(R){if(!b(R))return null;if(R.writableEnded===!0)return!0;let ie=R._writableState;return ie!=null&&ie.errored?!1:typeof(ie==null?void 0:ie.ended)!="boolean"?null:ie.ended}function k(R,ie){if(!b(R))return null;if(R.writableFinished===!0)return!0;let ye=R._writableState;return ye!=null&&ye.errored?!1:typeof(ye==null?void 0:ye.finished)!="boolean"?null:!!(ye.finished||ie===!1&&ye.ended===!0&&ye.length===0)}function M(R){if(!g(R))return null;if(R.readableEnded===!0)return!0;let ie=R._readableState;return!ie||ie.errored?!1:typeof(ie==null?void 0:ie.ended)!="boolean"?null:ie.ended}function J(R,ie){if(!g(R))return null;let ye=R._readableState;return ye!=null&&ye.errored?!1:typeof(ye==null?void 0:ye.endEmitted)!="boolean"?null:!!(ye.endEmitted||ie===!1&&ye.ended===!0&&ye.length===0)}function Y(R){return R&&R[r]!=null?R[r]:typeof(R==null?void 0:R.readable)!="boolean"?null:B(R)?!1:g(R)&&R.readable&&!J(R)}function se(R){return R&&R[t]!=null?R[t]:typeof(R==null?void 0:R.writable)!="boolean"?null:B(R)?!1:b(R)&&R.writable&&!S(R)}function O(R,ie){return v(R)?B(R)?!0:!((ie==null?void 0:ie.readable)!==!1&&Y(R)||(ie==null?void 0:ie.writable)!==!1&&se(R)):null}function K(R){var ie,ye;return v(R)?R.writableErrored?R.writableErrored:(ie=(ye=R._writableState)===null||ye===void 0?void 0:ye.errored)!==null&&ie!==void 0?ie:null:null}function X(R){var ie,ye;return v(R)?R.readableErrored?R.readableErrored:(ie=(ye=R._readableState)===null||ye===void 0?void 0:ye.errored)!==null&&ie!==void 0?ie:null:null}function W(R){if(!v(R))return null;if(typeof R.closed=="boolean")return R.closed;let ie=R._writableState,ye=R._readableState;return typeof(ie==null?void 0:ie.closed)=="boolean"||typeof(ye==null?void 0:ye.closed)=="boolean"?(ie==null?void 0:ie.closed)||(ye==null?void 0:ye.closed):typeof R._closed=="boolean"&&ge(R)?R._closed:null}function ge(R){return typeof R._closed=="boolean"&&typeof R._defaultKeepAlive=="boolean"&&typeof R._removedConnection=="boolean"&&typeof R._removedContLen=="boolean"}function de(R){return typeof R._sent100=="boolean"&&ge(R)}function le(R){var ie;return typeof R._consuming=="boolean"&&typeof R._dumped=="boolean"&&((ie=R.req)===null||ie===void 0?void 0:ie.upgradeOrConnect)===void 0}function Ee(R){if(!v(R))return null;let ie=R._writableState,ye=R._readableState,F=ie||ye;return!F&&de(R)||!!(F&&F.autoDestroy&&F.emitClose&&F.closed===!1)}function z(R){var ie;return!!(R&&((ie=R[n])!==null&&ie!==void 0?ie:R.readableDidRead||R.readableAborted))}function pe(R){var ie,ye,F,Ie,H,L,Z,q,$,V;return!!(R&&((ie=(ye=(F=(Ie=(H=(L=R[e])!==null&&L!==void 0?L:R.readableErrored)!==null&&H!==void 0?H:R.writableErrored)!==null&&Ie!==void 0?Ie:(Z=R._readableState)===null||Z===void 0?void 0:Z.errorEmitted)!==null&&F!==void 0?F:(q=R._writableState)===null||q===void 0?void 0:q.errorEmitted)!==null&&ye!==void 0?ye:($=R._readableState)===null||$===void 0?void 0:$.errored)!==null&&ie!==void 0?ie:!((V=R._writableState)===null||V===void 0)&&V.errored))}f.exports={isDestroyed:B,kIsDestroyed:i,isDisturbed:z,kIsDisturbed:n,isErrored:pe,kIsErrored:e,isReadable:Y,kIsReadable:r,kIsClosedPromise:h,kControllerErrorFunction:d,kIsWritable:t,isClosed:W,isDuplexNodeStream:m,isFinished:O,isIterable:N,isReadableNodeStream:g,isReadableStream:_,isReadableEnded:M,isReadableFinished:J,isReadableErrored:X,isNodeStream:v,isWebStream:E,isWritable:se,isWritableNodeStream:b,isWritableStream:I,isWritableEnded:S,isWritableFinished:k,isWritableErrored:K,isServerRequest:le,isServerResponse:de,willEmitClose:Ee,isTransformStream:y}}),Dt=be((s,f)=>{he(),fe(),ce();var o=Xt(),{AbortError:l,codes:c}=ot(),{ERR_INVALID_ARG_TYPE:i,ERR_STREAM_PREMATURE_CLOSE:e}=c,{kEmptyObject:r,once:t}=at(),{validateAbortSignal:n,validateFunction:h,validateObject:d,validateBoolean:g}=pr(),{Promise:b,PromisePrototypeThen:m,SymbolDispose:v}=ze(),{isClosed:_,isReadable:I,isReadableNodeStream:y,isReadableStream:E,isReadableFinished:N,isReadableErrored:B,isWritable:S,isWritableNodeStream:k,isWritableStream:M,isWritableFinished:J,isWritableErrored:Y,isNodeStream:se,willEmitClose:O,kIsClosedPromise:K}=Ct(),X;function W(z){return z.setHeader&&typeof z.abort=="function"}var ge=()=>{};function de(z,pe,R){var ie,ye;if(arguments.length===2?(R=pe,pe=r):pe==null?pe=r:d(pe,"options"),h(R,"callback"),n(pe.signal,"options.signal"),R=t(R),E(z)||M(z))return le(z,pe,R);if(!se(z))throw new i("stream",["ReadableStream","WritableStream","Stream"],z);let F=(ie=pe.readable)!==null&&ie!==void 0?ie:y(z),Ie=(ye=pe.writable)!==null&&ye!==void 0?ye:k(z),H=z._writableState,L=z._readableState,Z=()=>{z.writable||V()},q=O(z)&&y(z)===F&&k(z)===Ie,$=J(z,!1),V=()=>{$=!0,z.destroyed&&(q=!1),!(q&&(!z.readable||F))&&(!F||ae)&&R.call(z)},ae=N(z,!1),ne=()=>{ae=!0,z.destroyed&&(q=!1),!(q&&(!z.writable||Ie))&&(!Ie||$)&&R.call(z)},x=D=>{R.call(z,D)},U=_(z),Q=()=>{U=!0;let D=Y(z)||B(z);if(D&&typeof D!="boolean")return R.call(z,D);if(F&&!ae&&y(z,!0)&&!N(z,!1))return R.call(z,new e);if(Ie&&!$&&!J(z,!1))return R.call(z,new e);R.call(z)},re=()=>{U=!0;let D=Y(z)||B(z);if(D&&typeof D!="boolean")return R.call(z,D);R.call(z)},te=()=>{z.req.on("finish",V)};W(z)?(z.on("complete",V),q||z.on("abort",Q),z.req?te():z.on("request",te)):Ie&&!H&&(z.on("end",Z),z.on("close",Z)),!q&&typeof z.aborted=="boolean"&&z.on("aborted",Q),z.on("end",ne),z.on("finish",V),pe.error!==!1&&z.on("error",x),z.on("close",Q),U?o.nextTick(Q):H!=null&&H.errorEmitted||L!=null&&L.errorEmitted?q||o.nextTick(re):(!F&&(!q||I(z))&&($||S(z)===!1)||!Ie&&(!q||S(z))&&(ae||I(z)===!1)||L&&z.req&&z.aborted)&&o.nextTick(re);let ue=()=>{R=ge,z.removeListener("aborted",Q),z.removeListener("complete",V),z.removeListener("abort",Q),z.removeListener("request",te),z.req&&z.req.removeListener("finish",V),z.removeListener("end",Z),z.removeListener("close",Z),z.removeListener("finish",V),z.removeListener("end",ne),z.removeListener("error",x),z.removeListener("close",Q)};if(pe.signal&&!U){let D=()=>{let oe=R;ue(),oe.call(z,new l(void 0,{cause:pe.signal.reason}))};if(pe.signal.aborted)o.nextTick(D);else{X=X||at().addAbortListener;let oe=X(pe.signal,D),me=R;R=t((...ee)=>{oe[v](),me.apply(z,ee)})}}return ue}function le(z,pe,R){let ie=!1,ye=ge;if(pe.signal)if(ye=()=>{ie=!0,R.call(z,new l(void 0,{cause:pe.signal.reason}))},pe.signal.aborted)o.nextTick(ye);else{X=X||at().addAbortListener;let Ie=X(pe.signal,ye),H=R;R=t((...L)=>{Ie[v](),H.apply(z,L)})}let F=(...Ie)=>{ie||o.nextTick(()=>R.apply(z,Ie))};return m(z[K].promise,F,F),ge}function Ee(z,pe){var R;let ie=!1;return pe===null&&(pe=r),(R=pe)!==null&&R!==void 0&&R.cleanup&&(g(pe.cleanup,"cleanup"),ie=pe.cleanup),new b((ye,F)=>{let Ie=de(z,pe,H=>{ie&&Ie(),H?F(H):ye()})})}f.exports=de,f.exports.finished=Ee}),nr=be((s,f)=>{he(),fe(),ce();var o=Xt(),{aggregateTwoErrors:l,codes:{ERR_MULTIPLE_CALLBACK:c},AbortError:i}=ot(),{Symbol:e}=ze(),{kIsDestroyed:r,isDestroyed:t,isFinished:n,isServerRequest:h}=Ct(),d=e("kDestroy"),g=e("kConstruct");function b(O,K,X){O&&(O.stack,K&&!K.errored&&(K.errored=O),X&&!X.errored&&(X.errored=O))}function m(O,K){let X=this._readableState,W=this._writableState,ge=W||X;return W!=null&&W.destroyed||X!=null&&X.destroyed?(typeof K=="function"&&K(),this):(b(O,W,X),W&&(W.destroyed=!0),X&&(X.destroyed=!0),ge.constructed?v(this,O,K):this.once(d,function(de){v(this,l(de,O),K)}),this)}function v(O,K,X){let W=!1;function ge(de){if(W)return;W=!0;let le=O._readableState,Ee=O._writableState;b(de,Ee,le),Ee&&(Ee.closed=!0),le&&(le.closed=!0),typeof X=="function"&&X(de),de?o.nextTick(_,O,de):o.nextTick(I,O)}try{O._destroy(K||null,ge)}catch(de){ge(de)}}function _(O,K){y(O,K),I(O)}function I(O){let K=O._readableState,X=O._writableState;X&&(X.closeEmitted=!0),K&&(K.closeEmitted=!0),(X!=null&&X.emitClose||K!=null&&K.emitClose)&&O.emit("close")}function y(O,K){let X=O._readableState,W=O._writableState;W!=null&&W.errorEmitted||X!=null&&X.errorEmitted||(W&&(W.errorEmitted=!0),X&&(X.errorEmitted=!0),O.emit("error",K))}function E(){let O=this._readableState,K=this._writableState;O&&(O.constructed=!0,O.closed=!1,O.closeEmitted=!1,O.destroyed=!1,O.errored=null,O.errorEmitted=!1,O.reading=!1,O.ended=O.readable===!1,O.endEmitted=O.readable===!1),K&&(K.constructed=!0,K.destroyed=!1,K.closed=!1,K.closeEmitted=!1,K.errored=null,K.errorEmitted=!1,K.finalCalled=!1,K.prefinished=!1,K.ended=K.writable===!1,K.ending=K.writable===!1,K.finished=K.writable===!1)}function N(O,K,X){let W=O._readableState,ge=O._writableState;if(ge!=null&&ge.destroyed||W!=null&&W.destroyed)return this;W!=null&&W.autoDestroy||ge!=null&&ge.autoDestroy?O.destroy(K):K&&(K.stack,ge&&!ge.errored&&(ge.errored=K),W&&!W.errored&&(W.errored=K),X?o.nextTick(y,O,K):y(O,K))}function B(O,K){if(typeof O._construct!="function")return;let X=O._readableState,W=O._writableState;X&&(X.constructed=!1),W&&(W.constructed=!1),O.once(g,K),!(O.listenerCount(g)>1)&&o.nextTick(S,O)}function S(O){let K=!1;function X(W){if(K){N(O,W??new c);return}K=!0;let ge=O._readableState,de=O._writableState,le=de||ge;ge&&(ge.constructed=!0),de&&(de.constructed=!0),le.destroyed?O.emit(d,W):W?N(O,W,!0):o.nextTick(k,O)}try{O._construct(W=>{o.nextTick(X,W)})}catch(W){o.nextTick(X,W)}}function k(O){O.emit(g)}function M(O){return(O==null?void 0:O.setHeader)&&typeof O.abort=="function"}function J(O){O.emit("close")}function Y(O,K){O.emit("error",K),o.nextTick(J,O)}function se(O,K){!O||t(O)||(!K&&!n(O)&&(K=new i),h(O)?(O.socket=null,O.destroy(K)):M(O)?O.abort():M(O.req)?O.req.abort():typeof O.destroy=="function"?O.destroy(K):typeof O.close=="function"?O.close():K?o.nextTick(Y,O,K):o.nextTick(J,O),O.destroyed||(O[r]=!0))}f.exports={construct:B,destroyer:se,destroy:m,undestroy:E,errorOrDestroy:N}}),Rn=be((s,f)=>{he(),fe(),ce();var{ArrayIsArray:o,ObjectSetPrototypeOf:l}=ze(),{EventEmitter:c}=(Jt(),De(Ut));function i(r){c.call(this,r)}l(i.prototype,c.prototype),l(i,c),i.prototype.pipe=function(r,t){let n=this;function h(I){r.writable&&r.write(I)===!1&&n.pause&&n.pause()}n.on("data",h);function d(){n.readable&&n.resume&&n.resume()}r.on("drain",d),!r._isStdio&&(!t||t.end!==!1)&&(n.on("end",b),n.on("close",m));let g=!1;function b(){g||(g=!0,r.end())}function m(){g||(g=!0,typeof r.destroy=="function"&&r.destroy())}function v(I){_(),c.listenerCount(this,"error")===0&&this.emit("error",I)}e(n,"error",v),e(r,"error",v);function _(){n.removeListener("data",h),r.removeListener("drain",d),n.removeListener("end",b),n.removeListener("close",m),n.removeListener("error",v),r.removeListener("error",v),n.removeListener("end",_),n.removeListener("close",_),r.removeListener("close",_)}return n.on("end",_),n.on("close",_),r.on("close",_),r.emit("pipe",n),r};function e(r,t,n){if(typeof r.prependListener=="function")return r.prependListener(t,n);!r._events||!r._events[t]?r.on(t,n):o(r._events[t])?r._events[t].unshift(n):r._events[t]=[n,r._events[t]]}f.exports={Stream:i,prependListener:e}}),Nr=be((s,f)=>{he(),fe(),ce();var{SymbolDispose:o}=ze(),{AbortError:l,codes:c}=ot(),{isNodeStream:i,isWebStream:e,kControllerErrorFunction:r}=Ct(),t=Dt(),{ERR_INVALID_ARG_TYPE:n}=c,h,d=(g,b)=>{if(typeof g!="object"||!("aborted"in g))throw new n(b,"AbortSignal",g)};f.exports.addAbortSignal=function(g,b){if(d(g,"signal"),!i(b)&&!e(b))throw new n("stream",["ReadableStream","WritableStream","Stream"],b);return f.exports.addAbortSignalNoValidate(g,b)},f.exports.addAbortSignalNoValidate=function(g,b){if(typeof g!="object"||!("aborted"in g))return b;let m=i(b)?()=>{b.destroy(new l(void 0,{cause:g.reason}))}:()=>{b[r](new l(void 0,{cause:g.reason}))};if(g.aborted)m();else{h=h||at().addAbortListener;let v=h(g,m);t(b,v[o])}return b}}),xa=be((s,f)=>{he(),fe(),ce();var{StringPrototypeSlice:o,SymbolIterator:l,TypedArrayPrototypeSet:c,Uint8Array:i}=ze(),{Buffer:e}=(Xe(),De(Je)),{inspect:r}=at();f.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(t){let n={data:t,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length}unshift(t){let n={data:t,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}shift(){if(this.length===0)return;let t=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,t}clear(){this.head=this.tail=null,this.length=0}join(t){if(this.length===0)return"";let n=this.head,h=""+n.data;for(;(n=n.next)!==null;)h+=t+n.data;return h}concat(t){if(this.length===0)return e.alloc(0);let n=e.allocUnsafe(t>>>0),h=this.head,d=0;for(;h;)c(n,h.data,d),d+=h.data.length,h=h.next;return n}consume(t,n){let h=this.head.data;if(t<h.length){let d=h.slice(0,t);return this.head.data=h.slice(t),d}return t===h.length?this.shift():n?this._getString(t):this._getBuffer(t)}first(){return this.head.data}*[l](){for(let t=this.head;t;t=t.next)yield t.data}_getString(t){let n="",h=this.head,d=0;do{let g=h.data;if(t>g.length)n+=g,t-=g.length;else{t===g.length?(n+=g,++d,h.next?this.head=h.next:this.head=this.tail=null):(n+=o(g,0,t),this.head=h,h.data=o(g,t));break}++d}while((h=h.next)!==null);return this.length-=d,n}_getBuffer(t){let n=e.allocUnsafe(t),h=t,d=this.head,g=0;do{let b=d.data;if(t>b.length)c(n,b,h-t),t-=b.length;else{t===b.length?(c(n,b,h-t),++g,d.next?this.head=d.next:this.head=this.tail=null):(c(n,new i(b.buffer,b.byteOffset,t),h-t),this.head=d,d.data=b.slice(t));break}++g}while((d=d.next)!==null);return this.length-=g,n}[Symbol.for("nodejs.util.inspect.custom")](t,n){return r(this,{...n,depth:0,customInspect:!1})}}}),Lr=be((s,f)=>{he(),fe(),ce();var{MathFloor:o,NumberIsInteger:l}=ze(),{validateInteger:c}=pr(),{ERR_INVALID_ARG_VALUE:i}=ot().codes,e=16*1024,r=16;function t(g,b,m){return g.highWaterMark!=null?g.highWaterMark:b?g[m]:null}function n(g){return g?r:e}function h(g,b){c(b,"value",0),g?r=b:e=b}function d(g,b,m,v){let _=t(b,v,m);if(_!=null){if(!l(_)||_<0){let I=v?`options.${m}`:"options.highWaterMark";throw new i(I,_)}return o(_)}return n(g.objectMode)}f.exports={getHighWaterMark:d,getDefaultHighWaterMark:n,setDefaultHighWaterMark:h}}),Ba=be((s,f)=>{he(),fe(),ce();var o=(Xe(),De(Je)),l=o.Buffer;function c(e,r){for(var t in e)r[t]=e[t]}l.from&&l.alloc&&l.allocUnsafe&&l.allocUnsafeSlow?f.exports=o:(c(o,s),s.Buffer=i);function i(e,r,t){return l(e,r,t)}i.prototype=Object.create(l.prototype),c(l,i),i.from=function(e,r,t){if(typeof e=="number")throw new TypeError("Argument must not be a number");return l(e,r,t)},i.alloc=function(e,r,t){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=l(e);return r!==void 0?typeof t=="string"?n.fill(r,t):n.fill(r):n.fill(0),n},i.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return l(e)},i.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return o.SlowBuffer(e)}}),Ma=be(s=>{he(),fe(),ce();var f=Ba().Buffer,o=f.isEncoding||function(y){switch(y=""+y,y&&y.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 l(y){if(!y)return"utf8";for(var E;;)switch(y){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 y;default:if(E)return;y=(""+y).toLowerCase(),E=!0}}function c(y){var E=l(y);if(typeof E!="string"&&(f.isEncoding===o||!o(y)))throw new Error("Unknown encoding: "+y);return E||y}s.StringDecoder=i;function i(y){this.encoding=c(y);var E;switch(this.encoding){case"utf16le":this.text=g,this.end=b,E=4;break;case"utf8":this.fillLast=n,E=4;break;case"base64":this.text=m,this.end=v,E=3;break;default:this.write=_,this.end=I;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=f.allocUnsafe(E)}i.prototype.write=function(y){if(y.length===0)return"";var E,N;if(this.lastNeed){if(E=this.fillLast(y),E===void 0)return"";N=this.lastNeed,this.lastNeed=0}else N=0;return N<y.length?E?E+this.text(y,N):this.text(y,N):E||""},i.prototype.end=d,i.prototype.text=h,i.prototype.fillLast=function(y){if(this.lastNeed<=y.length)return y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,this.lastTotal-this.lastNeed,0,y.length),this.lastNeed-=y.length};function e(y){return y<=127?0:y>>5===6?2:y>>4===14?3:y>>3===30?4:y>>6===2?-1:-2}function r(y,E,N){var B=E.length-1;if(B<N)return 0;var S=e(E[B]);return S>=0?(S>0&&(y.lastNeed=S-1),S):--B<N||S===-2?0:(S=e(E[B]),S>=0?(S>0&&(y.lastNeed=S-2),S):--B<N||S===-2?0:(S=e(E[B]),S>=0?(S>0&&(S===2?S=0:y.lastNeed=S-3),S):0))}function t(y,E,N){if((E[0]&192)!==128)return y.lastNeed=0,"�";if(y.lastNeed>1&&E.length>1){if((E[1]&192)!==128)return y.lastNeed=1,"�";if(y.lastNeed>2&&E.length>2&&(E[2]&192)!==128)return y.lastNeed=2,"�"}}function n(y){var E=this.lastTotal-this.lastNeed,N=t(this,y);if(N!==void 0)return N;if(this.lastNeed<=y.length)return y.copy(this.lastChar,E,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);y.copy(this.lastChar,E,0,y.length),this.lastNeed-=y.length}function h(y,E){var N=r(this,y,E);if(!this.lastNeed)return y.toString("utf8",E);this.lastTotal=N;var B=y.length-(N-this.lastNeed);return y.copy(this.lastChar,0,B),y.toString("utf8",E,B)}function d(y){var E=y&&y.length?this.write(y):"";return this.lastNeed?E+"�":E}function g(y,E){if((y.length-E)%2===0){var N=y.toString("utf16le",E);if(N){var B=N.charCodeAt(N.length-1);if(B>=55296&&B<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1],N.slice(0,-1)}return N}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=y[y.length-1],y.toString("utf16le",E,y.length-1)}function b(y){var E=y&&y.length?this.write(y):"";if(this.lastNeed){var N=this.lastTotal-this.lastNeed;return E+this.lastChar.toString("utf16le",0,N)}return E}function m(y,E){var N=(y.length-E)%3;return N===0?y.toString("base64",E):(this.lastNeed=3-N,this.lastTotal=3,N===1?this.lastChar[0]=y[y.length-1]:(this.lastChar[0]=y[y.length-2],this.lastChar[1]=y[y.length-1]),y.toString("base64",E,y.length-N))}function v(y){var E=y&&y.length?this.write(y):"";return this.lastNeed?E+this.lastChar.toString("base64",0,3-this.lastNeed):E}function _(y){return y.toString(this.encoding)}function I(y){return y&&y.length?this.write(y):""}}),qo=be((s,f)=>{he(),fe(),ce();var o=Xt(),{PromisePrototypeThen:l,SymbolAsyncIterator:c,SymbolIterator:i}=ze(),{Buffer:e}=(Xe(),De(Je)),{ERR_INVALID_ARG_TYPE:r,ERR_STREAM_NULL_VALUES:t}=ot().codes;function n(h,d,g){let b;if(typeof d=="string"||d instanceof e)return new h({objectMode:!0,...g,read(){this.push(d),this.push(null)}});let m;if(d&&d[c])m=!0,b=d[c]();else if(d&&d[i])m=!1,b=d[i]();else throw new r("iterable",["Iterable"],d);let v=new h({objectMode:!0,highWaterMark:1,...g}),_=!1;v._read=function(){_||(_=!0,y())},v._destroy=function(E,N){l(I(E),()=>o.nextTick(N,E),B=>o.nextTick(N,B||E))};async function I(E){let N=E!=null,B=typeof b.throw=="function";if(N&&B){let{value:S,done:k}=await b.throw(E);if(await S,k)return}if(typeof b.return=="function"){let{value:S}=await b.return();await S}}async function y(){for(;;){try{let{value:E,done:N}=m?await b.next():b.next();if(N)v.push(null);else{let B=E&&typeof E.then=="function"?await E:E;if(B===null)throw _=!1,new t;if(v.push(B))continue;_=!1}}catch(E){v.destroy(E)}break}}return v}f.exports=n}),jr=be((s,f)=>{he(),fe(),ce();var o=Xt(),{ArrayPrototypeIndexOf:l,NumberIsInteger:c,NumberIsNaN:i,NumberParseInt:e,ObjectDefineProperties:r,ObjectKeys:t,ObjectSetPrototypeOf:n,Promise:h,SafeSet:d,SymbolAsyncDispose:g,SymbolAsyncIterator:b,Symbol:m}=ze();f.exports=ee,ee.ReadableState=me;var{EventEmitter:v}=(Jt(),De(Ut)),{Stream:_,prependListener:I}=Rn(),{Buffer:y}=(Xe(),De(Je)),{addAbortSignal:E}=Nr(),N=Dt(),B=at().debuglog("stream",A=>{B=A}),S=xa(),k=nr(),{getHighWaterMark:M,getDefaultHighWaterMark:J}=Lr(),{aggregateTwoErrors:Y,codes:{ERR_INVALID_ARG_TYPE:se,ERR_METHOD_NOT_IMPLEMENTED:O,ERR_OUT_OF_RANGE:K,ERR_STREAM_PUSH_AFTER_EOF:X,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:W},AbortError:ge}=ot(),{validateObject:de}=pr(),le=m("kPaused"),{StringDecoder:Ee}=Ma(),z=qo();n(ee.prototype,_.prototype),n(ee,_);var pe=()=>{},{errorOrDestroy:R}=k,ie=1,ye=2,F=4,Ie=8,H=16,L=32,Z=64,q=128,$=256,V=512,ae=1024,ne=2048,x=4096,U=8192,Q=16384,re=32768,te=65536,ue=1<<17,D=1<<18;function oe(A){return{enumerable:!1,get(){return(this.state&A)!==0},set(P){P?this.state|=A:this.state&=~A}}}r(me.prototype,{objectMode:oe(ie),ended:oe(ye),endEmitted:oe(F),reading:oe(Ie),constructed:oe(H),sync:oe(L),needReadable:oe(Z),emittedReadable:oe(q),readableListening:oe($),resumeScheduled:oe(V),errorEmitted:oe(ae),emitClose:oe(ne),autoDestroy:oe(x),destroyed:oe(U),closed:oe(Q),closeEmitted:oe(re),multiAwaitDrain:oe(te),readingMore:oe(ue),dataEmitted:oe(D)});function me(A,P,ve){typeof ve!="boolean"&&(ve=P instanceof kt()),this.state=ne|x|H|L,A&&A.objectMode&&(this.state|=ie),ve&&A&&A.readableObjectMode&&(this.state|=ie),this.highWaterMark=A?M(this,A,"readableHighWaterMark",ve):J(!1),this.buffer=new S,this.length=0,this.pipes=[],this.flowing=null,this[le]=null,A&&A.emitClose===!1&&(this.state&=-2049),A&&A.autoDestroy===!1&&(this.state&=-4097),this.errored=null,this.defaultEncoding=A&&A.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,A&&A.encoding&&(this.decoder=new Ee(A.encoding),this.encoding=A.encoding)}function ee(A){if(!(this instanceof ee))return new ee(A);let P=this instanceof kt();this._readableState=new me(A,this,P),A&&(typeof A.read=="function"&&(this._read=A.read),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.construct=="function"&&(this._construct=A.construct),A.signal&&!P&&E(A.signal,this)),_.call(this,A),k.construct(this,()=>{this._readableState.needReadable&&_e(this,this._readableState)})}ee.prototype.destroy=k.destroy,ee.prototype._undestroy=k.undestroy,ee.prototype._destroy=function(A,P){P(A)},ee.prototype[v.captureRejectionSymbol]=function(A){this.destroy(A)},ee.prototype[g]=function(){let A;return this.destroyed||(A=this.readableEnded?null:new ge,this.destroy(A)),new h((P,ve)=>N(this,Se=>Se&&Se!==A?ve(Se):P(null)))},ee.prototype.push=function(A,P){return Pe(this,A,P,!1)},ee.prototype.unshift=function(A,P){return Pe(this,A,P,!0)};function Pe(A,P,ve,Se){B("readableAddChunk",P);let ke=A._readableState,tt;if(ke.state&ie||(typeof P=="string"?(ve=ve||ke.defaultEncoding,ke.encoding!==ve&&(Se&&ke.encoding?P=y.from(P,ve).toString(ke.encoding):(P=y.from(P,ve),ve=""))):P instanceof y?ve="":_._isUint8Array(P)?(P=_._uint8ArrayToBuffer(P),ve=""):P!=null&&(tt=new se("chunk",["string","Buffer","Uint8Array"],P))),tt)R(A,tt);else if(P===null)ke.state&=-9,T(A,ke);else if(ke.state&ie||P&&P.length>0)if(Se)if(ke.state&F)R(A,new W);else{if(ke.destroyed||ke.errored)return!1;a(A,ke,P,!0)}else if(ke.ended)R(A,new X);else{if(ke.destroyed||ke.errored)return!1;ke.state&=-9,ke.decoder&&!ve?(P=ke.decoder.write(P),ke.objectMode||P.length!==0?a(A,ke,P,!1):_e(A,ke)):a(A,ke,P,!1)}else Se||(ke.state&=-9,_e(A,ke));return!ke.ended&&(ke.length<ke.highWaterMark||ke.length===0)}function a(A,P,ve,Se){P.flowing&&P.length===0&&!P.sync&&A.listenerCount("data")>0?(P.state&te?P.awaitDrainWriters.clear():P.awaitDrainWriters=null,P.dataEmitted=!0,A.emit("data",ve)):(P.length+=P.objectMode?1:ve.length,Se?P.buffer.unshift(ve):P.buffer.push(ve),P.state&Z&&j(A)),_e(A,P)}ee.prototype.isPaused=function(){let A=this._readableState;return A[le]===!0||A.flowing===!1},ee.prototype.setEncoding=function(A){let P=new Ee(A);this._readableState.decoder=P,this._readableState.encoding=this._readableState.decoder.encoding;let ve=this._readableState.buffer,Se="";for(let ke of ve)Se+=P.write(ke);return ve.clear(),Se!==""&&ve.push(Se),this._readableState.length=Se.length,this};var u=1073741824;function p(A){if(A>u)throw new K("size","<= 1GiB",A);return A--,A|=A>>>1,A|=A>>>2,A|=A>>>4,A|=A>>>8,A|=A>>>16,A++,A}function w(A,P){return A<=0||P.length===0&&P.ended?0:P.state&ie?1:i(A)?P.flowing&&P.length?P.buffer.first().length:P.length:A<=P.length?A:P.ended?P.length:0}ee.prototype.read=function(A){B("read",A),A===void 0?A=NaN:c(A)||(A=e(A,10));let P=this._readableState,ve=A;if(A>P.highWaterMark&&(P.highWaterMark=p(A)),A!==0&&(P.state&=-129),A===0&&P.needReadable&&((P.highWaterMark!==0?P.length>=P.highWaterMark:P.length>0)||P.ended))return B("read: emitReadable",P.length,P.ended),P.length===0&&P.ended?Fe(this):j(this),null;if(A=w(A,P),A===0&&P.ended)return P.length===0&&Fe(this),null;let Se=(P.state&Z)!==0;if(B("need readable",Se),(P.length===0||P.length-A<P.highWaterMark)&&(Se=!0,B("length less than watermark",Se)),P.ended||P.reading||P.destroyed||P.errored||!P.constructed)Se=!1,B("reading, ended or constructing",Se);else if(Se){B("do read"),P.state|=Ie|L,P.length===0&&(P.state|=Z);try{this._read(P.highWaterMark)}catch(tt){R(this,tt)}P.state&=-33,P.reading||(A=w(ve,P))}let ke;return A>0?ke=Re(A,P):ke=null,ke===null?(P.needReadable=P.length<=P.highWaterMark,A=0):(P.length-=A,P.multiAwaitDrain?P.awaitDrainWriters.clear():P.awaitDrainWriters=null),P.length===0&&(P.ended||(P.needReadable=!0),ve!==A&&P.ended&&Fe(this)),ke!==null&&!P.errorEmitted&&!P.closeEmitted&&(P.dataEmitted=!0,this.emit("data",ke)),ke};function T(A,P){if(B("onEofChunk"),!P.ended){if(P.decoder){let ve=P.decoder.end();ve&&ve.length&&(P.buffer.push(ve),P.length+=P.objectMode?1:ve.length)}P.ended=!0,P.sync?j(A):(P.needReadable=!1,P.emittedReadable=!0,G(A))}}function j(A){let P=A._readableState;B("emitReadable",P.needReadable,P.emittedReadable),P.needReadable=!1,P.emittedReadable||(B("emitReadable",P.flowing),P.emittedReadable=!0,o.nextTick(G,A))}function G(A){let P=A._readableState;B("emitReadable_",P.destroyed,P.length,P.ended),!P.destroyed&&!P.errored&&(P.length||P.ended)&&(A.emit("readable"),P.emittedReadable=!1),P.needReadable=!P.flowing&&!P.ended&&P.length<=P.highWaterMark,lt(A)}function _e(A,P){!P.readingMore&&P.constructed&&(P.readingMore=!0,o.nextTick(we,A,P))}function we(A,P){for(;!P.reading&&!P.ended&&(P.length<P.highWaterMark||P.flowing&&P.length===0);){let ve=P.length;if(B("maybeReadMore read 0"),A.read(0),ve===P.length)break}P.readingMore=!1}ee.prototype._read=function(A){throw new O("_read()")},ee.prototype.pipe=function(A,P){let ve=this,Se=this._readableState;Se.pipes.length===1&&(Se.multiAwaitDrain||(Se.multiAwaitDrain=!0,Se.awaitDrainWriters=new d(Se.awaitDrainWriters?[Se.awaitDrainWriters]:[]))),Se.pipes.push(A),B("pipe count=%d opts=%j",Se.pipes.length,P);let ke=(!P||P.end!==!1)&&A!==o.stdout&&A!==o.stderr?ht:sr;Se.endEmitted?o.nextTick(ke):ve.once("end",ke),A.on("unpipe",tt);function tt(Wt,vt){B("onunpipe"),Wt===ve&&vt&&vt.hasUnpiped===!1&&(vt.hasUnpiped=!0,Xs())}function ht(){B("onend"),A.end()}let Ft,jn=!1;function Xs(){B("cleanup"),A.removeListener("close",Wr),A.removeListener("finish",qr),Ft&&A.removeListener("drain",Ft),A.removeListener("error",Fr),A.removeListener("unpipe",tt),ve.removeListener("end",ht),ve.removeListener("end",sr),ve.removeListener("data",Dn),jn=!0,Ft&&Se.awaitDrainWriters&&(!A._writableState||A._writableState.needDrain)&&Ft()}function Un(){jn||(Se.pipes.length===1&&Se.pipes[0]===A?(B("false write response, pause",0),Se.awaitDrainWriters=A,Se.multiAwaitDrain=!1):Se.pipes.length>1&&Se.pipes.includes(A)&&(B("false write response, pause",Se.awaitDrainWriters.size),Se.awaitDrainWriters.add(A)),ve.pause()),Ft||(Ft=Te(ve,A),A.on("drain",Ft))}ve.on("data",Dn);function Dn(Wt){B("ondata");let vt=A.write(Wt);B("dest.write",vt),vt===!1&&Un()}function Fr(Wt){if(B("onerror",Wt),sr(),A.removeListener("error",Fr),A.listenerCount("error")===0){let vt=A._writableState||A._readableState;vt&&!vt.errorEmitted?R(A,Wt):A.emit("error",Wt)}}I(A,"error",Fr);function Wr(){A.removeListener("finish",qr),sr()}A.once("close",Wr);function qr(){B("onfinish"),A.removeListener("close",Wr),sr()}A.once("finish",qr);function sr(){B("unpipe"),ve.unpipe(A)}return A.emit("pipe",ve),A.writableNeedDrain===!0?Un():Se.flowing||(B("pipe resume"),ve.resume()),A};function Te(A,P){return function(){let ve=A._readableState;ve.awaitDrainWriters===P?(B("pipeOnDrain",1),ve.awaitDrainWriters=null):ve.multiAwaitDrain&&(B("pipeOnDrain",ve.awaitDrainWriters.size),ve.awaitDrainWriters.delete(P)),(!ve.awaitDrainWriters||ve.awaitDrainWriters.size===0)&&A.listenerCount("data")&&A.resume()}}ee.prototype.unpipe=function(A){let P=this._readableState,ve={hasUnpiped:!1};if(P.pipes.length===0)return this;if(!A){let ke=P.pipes;P.pipes=[],this.pause();for(let tt=0;tt<ke.length;tt++)ke[tt].emit("unpipe",this,{hasUnpiped:!1});return this}let Se=l(P.pipes,A);return Se===-1?this:(P.pipes.splice(Se,1),P.pipes.length===0&&this.pause(),A.emit("unpipe",this,ve),this)},ee.prototype.on=function(A,P){let ve=_.prototype.on.call(this,A,P),Se=this._readableState;return A==="data"?(Se.readableListening=this.listenerCount("readable")>0,Se.flowing!==!1&&this.resume()):A==="readable"&&!Se.endEmitted&&!Se.readableListening&&(Se.readableListening=Se.needReadable=!0,Se.flowing=!1,Se.emittedReadable=!1,B("on readable",Se.length,Se.reading),Se.length?j(this):Se.reading||o.nextTick(Oe,this)),ve},ee.prototype.addListener=ee.prototype.on,ee.prototype.removeListener=function(A,P){let ve=_.prototype.removeListener.call(this,A,P);return A==="readable"&&o.nextTick(xe,this),ve},ee.prototype.off=ee.prototype.removeListener,ee.prototype.removeAllListeners=function(A){let P=_.prototype.removeAllListeners.apply(this,arguments);return(A==="readable"||A===void 0)&&o.nextTick(xe,this),P};function xe(A){let P=A._readableState;P.readableListening=A.listenerCount("readable")>0,P.resumeScheduled&&P[le]===!1?P.flowing=!0:A.listenerCount("data")>0?A.resume():P.readableListening||(P.flowing=null)}function Oe(A){B("readable nexttick read 0"),A.read(0)}ee.prototype.resume=function(){let A=this._readableState;return A.flowing||(B("resume"),A.flowing=!A.readableListening,gt(this,A)),A[le]=!1,this};function gt(A,P){P.resumeScheduled||(P.resumeScheduled=!0,o.nextTick(st,A,P))}function st(A,P){B("resume",P.reading),P.reading||A.read(0),P.resumeScheduled=!1,A.emit("resume"),lt(A),P.flowing&&!P.reading&&A.read(0)}ee.prototype.pause=function(){return B("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(B("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[le]=!0,this};function lt(A){let P=A._readableState;for(B("flow",P.flowing);P.flowing&&A.read()!==null;);}ee.prototype.wrap=function(A){let P=!1;A.on("data",Se=>{!this.push(Se)&&A.pause&&(P=!0,A.pause())}),A.on("end",()=>{this.push(null)}),A.on("error",Se=>{R(this,Se)}),A.on("close",()=>{this.destroy()}),A.on("destroy",()=>{this.destroy()}),this._read=()=>{P&&A.resume&&(P=!1,A.resume())};let ve=t(A);for(let Se=1;Se<ve.length;Se++){let ke=ve[Se];this[ke]===void 0&&typeof A[ke]=="function"&&(this[ke]=A[ke].bind(A))}return this},ee.prototype[b]=function(){return qe(this)},ee.prototype.iterator=function(A){return A!==void 0&&de(A,"options"),qe(this,A)};function qe(A,P){typeof A.read!="function"&&(A=ee.wrap(A,{objectMode:!0}));let ve=Ye(A,P);return ve.stream=A,ve}async function*Ye(A,P){let ve=pe;function Se(ht){this===A?(ve(),ve=pe):ve=ht}A.on("readable",Se);let ke,tt=N(A,{writable:!1},ht=>{ke=ht?Y(ke,ht):null,ve(),ve=pe});try{for(;;){let ht=A.destroyed?null:A.read();if(ht!==null)yield ht;else{if(ke)throw ke;if(ke===null)return;await new h(Se)}}}catch(ht){throw ke=Y(ke,ht),ke}finally{(ke||(P==null?void 0:P.destroyOnReturn)!==!1)&&(ke===void 0||A._readableState.autoDestroy)?k.destroyer(A,null):(A.off("readable",Se),tt())}}r(ee.prototype,{readable:{__proto__:null,get(){let A=this._readableState;return!!A&&A.readable!==!1&&!A.destroyed&&!A.errorEmitted&&!A.endEmitted},set(A){this._readableState&&(this._readableState.readable=!!A)}},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(A){this._readableState&&(this._readableState.flowing=A)}},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(A){this._readableState&&(this._readableState.destroyed=A)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),r(me.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[le]!==!1},set(A){this[le]=!!A}}}),ee._fromList=Re;function Re(A,P){if(P.length===0)return null;let ve;return P.objectMode?ve=P.buffer.shift():!A||A>=P.length?(P.decoder?ve=P.buffer.join(""):P.buffer.length===1?ve=P.buffer.first():ve=P.buffer.concat(P.length),P.buffer.clear()):ve=P.buffer.consume(A,P.decoder),ve}function Fe(A){let P=A._readableState;B("endReadable",P.endEmitted),P.endEmitted||(P.ended=!0,o.nextTick(et,P,A))}function et(A,P){if(B("endReadableNT",A.endEmitted,A.length),!A.errored&&!A.closeEmitted&&!A.endEmitted&&A.length===0){if(A.endEmitted=!0,P.emit("end"),P.writable&&P.allowHalfOpen===!1)o.nextTick(Qe,P);else if(A.autoDestroy){let ve=P._writableState;(!ve||ve.autoDestroy&&(ve.finished||ve.writable===!1))&&P.destroy()}}}function Qe(A){A.writable&&!A.writableEnded&&!A.destroyed&&A.end()}ee.from=function(A,P){return z(ee,A,P)};var it;function Rt(){return it===void 0&&(it={}),it}ee.fromWeb=function(A,P){return Rt().newStreamReadableFromReadableStream(A,P)},ee.toWeb=function(A,P){return Rt().newReadableStreamFromStreamReadable(A,P)},ee.wrap=function(A,P){var ve,Se;return new ee({objectMode:(ve=(Se=A.readableObjectMode)!==null&&Se!==void 0?Se:A.objectMode)!==null&&ve!==void 0?ve:!0,...P,destroy(ke,tt){k.destroyer(A,ke),tt(ke)}}).wrap(A)}}),xn=be((s,f)=>{he(),fe(),ce();var o=Xt(),{ArrayPrototypeSlice:l,Error:c,FunctionPrototypeSymbolHasInstance:i,ObjectDefineProperty:e,ObjectDefineProperties:r,ObjectSetPrototypeOf:t,StringPrototypeToLowerCase:n,Symbol:h,SymbolHasInstance:d}=ze();f.exports=de,de.WritableState=W;var{EventEmitter:g}=(Jt(),De(Ut)),b=Rn().Stream,{Buffer:m}=(Xe(),De(Je)),v=nr(),{addAbortSignal:_}=Nr(),{getHighWaterMark:I,getDefaultHighWaterMark:y}=Lr(),{ERR_INVALID_ARG_TYPE:E,ERR_METHOD_NOT_IMPLEMENTED:N,ERR_MULTIPLE_CALLBACK:B,ERR_STREAM_CANNOT_PIPE:S,ERR_STREAM_DESTROYED:k,ERR_STREAM_ALREADY_FINISHED:M,ERR_STREAM_NULL_VALUES:J,ERR_STREAM_WRITE_AFTER_END:Y,ERR_UNKNOWN_ENCODING:se}=ot().codes,{errorOrDestroy:O}=v;t(de.prototype,b.prototype),t(de,b);function K(){}var X=h("kOnFinished");function W(x,U,Q){typeof Q!="boolean"&&(Q=U instanceof kt()),this.objectMode=!!(x&&x.objectMode),Q&&(this.objectMode=this.objectMode||!!(x&&x.writableObjectMode)),this.highWaterMark=x?I(this,x,"writableHighWaterMark",Q):y(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let re=!!(x&&x.decodeStrings===!1);this.decodeStrings=!re,this.defaultEncoding=x&&x.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=R.bind(void 0,U),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,ge(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!x||x.emitClose!==!1,this.autoDestroy=!x||x.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[X]=[]}function ge(x){x.buffered=[],x.bufferedIndex=0,x.allBuffers=!0,x.allNoop=!0}W.prototype.getBuffer=function(){return l(this.buffered,this.bufferedIndex)},e(W.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function de(x){let U=this instanceof kt();if(!U&&!i(de,this))return new de(x);this._writableState=new W(x,this,U),x&&(typeof x.write=="function"&&(this._write=x.write),typeof x.writev=="function"&&(this._writev=x.writev),typeof x.destroy=="function"&&(this._destroy=x.destroy),typeof x.final=="function"&&(this._final=x.final),typeof x.construct=="function"&&(this._construct=x.construct),x.signal&&_(x.signal,this)),b.call(this,x),v.construct(this,()=>{let Q=this._writableState;Q.writing||Ie(this,Q),q(this,Q)})}e(de,d,{__proto__:null,value:function(x){return i(this,x)?!0:this!==de?!1:x&&x._writableState instanceof W}}),de.prototype.pipe=function(){O(this,new S)};function le(x,U,Q,re){let te=x._writableState;if(typeof Q=="function")re=Q,Q=te.defaultEncoding;else{if(!Q)Q=te.defaultEncoding;else if(Q!=="buffer"&&!m.isEncoding(Q))throw new se(Q);typeof re!="function"&&(re=K)}if(U===null)throw new J;if(!te.objectMode)if(typeof U=="string")te.decodeStrings!==!1&&(U=m.from(U,Q),Q="buffer");else if(U instanceof m)Q="buffer";else if(b._isUint8Array(U))U=b._uint8ArrayToBuffer(U),Q="buffer";else throw new E("chunk",["string","Buffer","Uint8Array"],U);let ue;return te.ending?ue=new Y:te.destroyed&&(ue=new k("write")),ue?(o.nextTick(re,ue),O(x,ue,!0),ue):(te.pendingcb++,Ee(x,te,U,Q,re))}de.prototype.write=function(x,U,Q){return le(this,x,U,Q)===!0},de.prototype.cork=function(){this._writableState.corked++},de.prototype.uncork=function(){let x=this._writableState;x.corked&&(x.corked--,x.writing||Ie(this,x))},de.prototype.setDefaultEncoding=function(x){if(typeof x=="string"&&(x=n(x)),!m.isEncoding(x))throw new se(x);return this._writableState.defaultEncoding=x,this};function Ee(x,U,Q,re,te){let ue=U.objectMode?1:Q.length;U.length+=ue;let D=U.length<U.highWaterMark;return D||(U.needDrain=!0),U.writing||U.corked||U.errored||!U.constructed?(U.buffered.push({chunk:Q,encoding:re,callback:te}),U.allBuffers&&re!=="buffer"&&(U.allBuffers=!1),U.allNoop&&te!==K&&(U.allNoop=!1)):(U.writelen=ue,U.writecb=te,U.writing=!0,U.sync=!0,x._write(Q,re,U.onwrite),U.sync=!1),D&&!U.errored&&!U.destroyed}function z(x,U,Q,re,te,ue,D){U.writelen=re,U.writecb=D,U.writing=!0,U.sync=!0,U.destroyed?U.onwrite(new k("write")):Q?x._writev(te,U.onwrite):x._write(te,ue,U.onwrite),U.sync=!1}function pe(x,U,Q,re){--U.pendingcb,re(Q),F(U),O(x,Q)}function R(x,U){let Q=x._writableState,re=Q.sync,te=Q.writecb;if(typeof te!="function"){O(x,new B);return}Q.writing=!1,Q.writecb=null,Q.length-=Q.writelen,Q.writelen=0,U?(U.stack,Q.errored||(Q.errored=U),x._readableState&&!x._readableState.errored&&(x._readableState.errored=U),re?o.nextTick(pe,x,Q,U,te):pe(x,Q,U,te)):(Q.buffered.length>Q.bufferedIndex&&Ie(x,Q),re?Q.afterWriteTickInfo!==null&&Q.afterWriteTickInfo.cb===te?Q.afterWriteTickInfo.count++:(Q.afterWriteTickInfo={count:1,cb:te,stream:x,state:Q},o.nextTick(ie,Q.afterWriteTickInfo)):ye(x,Q,1,te))}function ie({stream:x,state:U,count:Q,cb:re}){return U.afterWriteTickInfo=null,ye(x,U,Q,re)}function ye(x,U,Q,re){for(!U.ending&&!x.destroyed&&U.length===0&&U.needDrain&&(U.needDrain=!1,x.emit("drain"));Q-- >0;)U.pendingcb--,re();U.destroyed&&F(U),q(x,U)}function F(x){if(x.writing)return;for(let te=x.bufferedIndex;te<x.buffered.length;++te){var U;let{chunk:ue,callback:D}=x.buffered[te],oe=x.objectMode?1:ue.length;x.length-=oe,D((U=x.errored)!==null&&U!==void 0?U:new k("write"))}let Q=x[X].splice(0);for(let te=0;te<Q.length;te++){var re;Q[te]((re=x.errored)!==null&&re!==void 0?re:new k("end"))}ge(x)}function Ie(x,U){if(U.corked||U.bufferProcessing||U.destroyed||!U.constructed)return;let{buffered:Q,bufferedIndex:re,objectMode:te}=U,ue=Q.length-re;if(!ue)return;let D=re;if(U.bufferProcessing=!0,ue>1&&x._writev){U.pendingcb-=ue-1;let oe=U.allNoop?K:ee=>{for(let Pe=D;Pe<Q.length;++Pe)Q[Pe].callback(ee)},me=U.allNoop&&D===0?Q:l(Q,D);me.allBuffers=U.allBuffers,z(x,U,!0,U.length,me,"",oe),ge(U)}else{do{let{chunk:oe,encoding:me,callback:ee}=Q[D];Q[D++]=null;let Pe=te?1:oe.length;z(x,U,!1,Pe,oe,me,ee)}while(D<Q.length&&!U.writing);D===Q.length?ge(U):D>256?(Q.splice(0,D),U.bufferedIndex=0):U.bufferedIndex=D}U.bufferProcessing=!1}de.prototype._write=function(x,U,Q){if(this._writev)this._writev([{chunk:x,encoding:U}],Q);else throw new N("_write()")},de.prototype._writev=null,de.prototype.end=function(x,U,Q){let re=this._writableState;typeof x=="function"?(Q=x,x=null,U=null):typeof U=="function"&&(Q=U,U=null);let te;if(x!=null){let ue=le(this,x,U);ue instanceof c&&(te=ue)}return re.corked&&(re.corked=1,this.uncork()),te||(!re.errored&&!re.ending?(re.ending=!0,q(this,re,!0),re.ended=!0):re.finished?te=new M("end"):re.destroyed&&(te=new k("end"))),typeof Q=="function"&&(te||re.finished?o.nextTick(Q,te):re[X].push(Q)),this};function H(x){return x.ending&&!x.destroyed&&x.constructed&&x.length===0&&!x.errored&&x.buffered.length===0&&!x.finished&&!x.writing&&!x.errorEmitted&&!x.closeEmitted}function L(x,U){let Q=!1;function re(te){if(Q){O(x,te??B());return}if(Q=!0,U.pendingcb--,te){let ue=U[X].splice(0);for(let D=0;D<ue.length;D++)ue[D](te);O(x,te,U.sync)}else H(U)&&(U.prefinished=!0,x.emit("prefinish"),U.pendingcb++,o.nextTick($,x,U))}U.sync=!0,U.pendingcb++;try{x._final(re)}catch(te){re(te)}U.sync=!1}function Z(x,U){!U.prefinished&&!U.finalCalled&&(typeof x._final=="function"&&!U.destroyed?(U.finalCalled=!0,L(x,U)):(U.prefinished=!0,x.emit("prefinish")))}function q(x,U,Q){H(U)&&(Z(x,U),U.pendingcb===0&&(Q?(U.pendingcb++,o.nextTick((re,te)=>{H(te)?$(re,te):te.pendingcb--},x,U)):H(U)&&(U.pendingcb++,$(x,U))))}function $(x,U){U.pendingcb--,U.finished=!0;let Q=U[X].splice(0);for(let re=0;re<Q.length;re++)Q[re]();if(x.emit("finish"),U.autoDestroy){let re=x._readableState;(!re||re.autoDestroy&&(re.endEmitted||re.readable===!1))&&x.destroy()}}r(de.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(x){this._writableState&&(this._writableState.destroyed=x)}},writable:{__proto__:null,get(){let x=this._writableState;return!!x&&x.writable!==!1&&!x.destroyed&&!x.errored&&!x.ending&&!x.ended},set(x){this._writableState&&(this._writableState.writable=!!x)}},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 x=this._writableState;return x?!x.destroyed&&!x.ending&&x.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=v.destroy;de.prototype.destroy=function(x,U){let Q=this._writableState;return!Q.destroyed&&(Q.bufferedIndex<Q.buffered.length||Q[X].length)&&o.nextTick(F,Q),V.call(this,x,U),this},de.prototype._undestroy=v.undestroy,de.prototype._destroy=function(x,U){U(x)},de.prototype[g.captureRejectionSymbol]=function(x){this.destroy(x)};var ae;function ne(){return ae===void 0&&(ae={}),ae}de.fromWeb=function(x,U){return ne().newStreamWritableFromWritableStream(x,U)},de.toWeb=function(x){return ne().newWritableStreamFromStreamWritable(x)}}),Na=be((s,f)=>{he(),fe(),ce();var o=Xt(),l=(Xe(),De(Je)),{isReadable:c,isWritable:i,isIterable:e,isNodeStream:r,isReadableNodeStream:t,isWritableNodeStream:n,isDuplexNodeStream:h,isReadableStream:d,isWritableStream:g}=Ct(),b=Dt(),{AbortError:m,codes:{ERR_INVALID_ARG_TYPE:v,ERR_INVALID_RETURN_VALUE:_}}=ot(),{destroyer:I}=nr(),y=kt(),E=jr(),N=xn(),{createDeferredPromise:B}=at(),S=qo(),k=globalThis.Blob||l.Blob,M=typeof k<"u"?function(X){return X instanceof k}:function(X){return!1},J=globalThis.AbortController||dr().AbortController,{FunctionPrototypeCall:Y}=ze(),se=class extends y{constructor(X){super(X),(X==null?void 0:X.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(X==null?void 0:X.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};f.exports=function X(W,ge){if(h(W))return W;if(t(W))return K({readable:W});if(n(W))return K({writable:W});if(r(W))return K({writable:!1,readable:!1});if(d(W))return K({readable:E.fromWeb(W)});if(g(W))return K({writable:N.fromWeb(W)});if(typeof W=="function"){let{value:le,write:Ee,final:z,destroy:pe}=O(W);if(e(le))return S(se,le,{objectMode:!0,write:Ee,final:z,destroy:pe});let R=le==null?void 0:le.then;if(typeof R=="function"){let ie,ye=Y(R,le,F=>{if(F!=null)throw new _("nully","body",F)},F=>{I(ie,F)});return ie=new se({objectMode:!0,readable:!1,write:Ee,final(F){z(async()=>{try{await ye,o.nextTick(F,null)}catch(Ie){o.nextTick(F,Ie)}})},destroy:pe})}throw new _("Iterable, AsyncIterable or AsyncFunction",ge,le)}if(M(W))return X(W.arrayBuffer());if(e(W))return S(se,W,{objectMode:!0,writable:!1});if(d(W==null?void 0:W.readable)&&g(W==null?void 0:W.writable))return se.fromWeb(W);if(typeof(W==null?void 0:W.writable)=="object"||typeof(W==null?void 0:W.readable)=="object"){let le=W!=null&&W.readable?t(W==null?void 0:W.readable)?W==null?void 0:W.readable:X(W.readable):void 0,Ee=W!=null&&W.writable?n(W==null?void 0:W.writable)?W==null?void 0:W.writable:X(W.writable):void 0;return K({readable:le,writable:Ee})}let de=W==null?void 0:W.then;if(typeof de=="function"){let le;return Y(de,W,Ee=>{Ee!=null&&le.push(Ee),le.push(null)},Ee=>{I(le,Ee)}),le=new se({objectMode:!0,writable:!1,read(){}})}throw new v(ge,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],W)};function O(X){let{promise:W,resolve:ge}=B(),de=new J,le=de.signal;return{value:X(async function*(){for(;;){let Ee=W;W=null;let{chunk:z,done:pe,cb:R}=await Ee;if(o.nextTick(R),pe)return;if(le.aborted)throw new m(void 0,{cause:le.reason});({promise:W,resolve:ge}=B()),yield z}}(),{signal:le}),write(Ee,z,pe){let R=ge;ge=null,R({chunk:Ee,done:!1,cb:pe})},final(Ee){let z=ge;ge=null,z({done:!0,cb:Ee})},destroy(Ee,z){de.abort(),z(Ee)}}}function K(X){let W=X.readable&&typeof X.readable.read!="function"?E.wrap(X.readable):X.readable,ge=X.writable,de=!!c(W),le=!!i(ge),Ee,z,pe,R,ie;function ye(F){let Ie=R;R=null,Ie?Ie(F):F&&ie.destroy(F)}return ie=new se({readableObjectMode:!!(W!=null&&W.readableObjectMode),writableObjectMode:!!(ge!=null&&ge.writableObjectMode),readable:de,writable:le}),le&&(b(ge,F=>{le=!1,F&&I(W,F),ye(F)}),ie._write=function(F,Ie,H){ge.write(F,Ie)?H():Ee=H},ie._final=function(F){ge.end(),z=F},ge.on("drain",function(){if(Ee){let F=Ee;Ee=null,F()}}),ge.on("finish",function(){if(z){let F=z;z=null,F()}})),de&&(b(W,F=>{de=!1,F&&I(W,F),ye(F)}),W.on("readable",function(){if(pe){let F=pe;pe=null,F()}}),W.on("end",function(){ie.push(null)}),ie._read=function(){for(;;){let F=W.read();if(F===null){pe=ie._read;return}if(!ie.push(F))return}}),ie._destroy=function(F,Ie){!F&&R!==null&&(F=new m),pe=null,Ee=null,z=null,R===null?Ie(F):(R=Ie,I(ge,F),I(W,F))},ie}}),kt=be((s,f)=>{he(),fe(),ce();var{ObjectDefineProperties:o,ObjectGetOwnPropertyDescriptor:l,ObjectKeys:c,ObjectSetPrototypeOf:i}=ze();f.exports=t;var e=jr(),r=xn();i(t.prototype,e.prototype),i(t,e);{let g=c(r.prototype);for(let b=0;b<g.length;b++){let m=g[b];t.prototype[m]||(t.prototype[m]=r.prototype[m])}}function t(g){if(!(this instanceof t))return new t(g);e.call(this,g),r.call(this,g),g?(this.allowHalfOpen=g.allowHalfOpen!==!1,g.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),g.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}o(t.prototype,{writable:{__proto__:null,...l(r.prototype,"writable")},writableHighWaterMark:{__proto__:null,...l(r.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...l(r.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...l(r.prototype,"writableBuffer")},writableLength:{__proto__:null,...l(r.prototype,"writableLength")},writableFinished:{__proto__:null,...l(r.prototype,"writableFinished")},writableCorked:{__proto__:null,...l(r.prototype,"writableCorked")},writableEnded:{__proto__:null,...l(r.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...l(r.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(g){this._readableState&&this._writableState&&(this._readableState.destroyed=g,this._writableState.destroyed=g)}}});var n;function h(){return n===void 0&&(n={}),n}t.fromWeb=function(g,b){return h().newStreamDuplexFromReadableWritablePair(g,b)},t.toWeb=function(g){return h().newReadableWritablePairFromDuplex(g)};var d;t.from=function(g){return d||(d=Na()),d(g,"body")}}),$o=be((s,f)=>{he(),fe(),ce();var{ObjectSetPrototypeOf:o,Symbol:l}=ze();f.exports=t;var{ERR_METHOD_NOT_IMPLEMENTED:c}=ot().codes,i=kt(),{getHighWaterMark:e}=Lr();o(t.prototype,i.prototype),o(t,i);var r=l("kCallback");function t(d){if(!(this instanceof t))return new t(d);let g=d?e(this,d,"readableHighWaterMark",!0):null;g===0&&(d={...d,highWaterMark:null,readableHighWaterMark:g,writableHighWaterMark:d.writableHighWaterMark||0}),i.call(this,d),this._readableState.sync=!1,this[r]=null,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",h)}function n(d){typeof this._flush=="function"&&!this.destroyed?this._flush((g,b)=>{if(g){d?d(g):this.destroy(g);return}b!=null&&this.push(b),this.push(null),d&&d()}):(this.push(null),d&&d())}function h(){this._final!==n&&n.call(this)}t.prototype._final=n,t.prototype._transform=function(d,g,b){throw new c("_transform()")},t.prototype._write=function(d,g,b){let m=this._readableState,v=this._writableState,_=m.length;this._transform(d,g,(I,y)=>{if(I){b(I);return}y!=null&&this.push(y),v.ended||_===m.length||m.length<m.highWaterMark?b():this[r]=b})},t.prototype._read=function(){if(this[r]){let d=this[r];this[r]=null,d()}}}),Vo=be((s,f)=>{he(),fe(),ce();var{ObjectSetPrototypeOf:o}=ze();f.exports=c;var l=$o();o(c.prototype,l.prototype),o(c,l);function c(i){if(!(this instanceof c))return new c(i);l.call(this,i)}c.prototype._transform=function(i,e,r){r(null,i)}}),Bn=be((s,f)=>{he(),fe(),ce();var o=Xt(),{ArrayIsArray:l,Promise:c,SymbolAsyncIterator:i,SymbolDispose:e}=ze(),r=Dt(),{once:t}=at(),n=nr(),h=kt(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:b,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:v,ERR_STREAM_PREMATURE_CLOSE:_},AbortError:I}=ot(),{validateFunction:y,validateAbortSignal:E}=pr(),{isIterable:N,isReadable:B,isReadableNodeStream:S,isNodeStream:k,isTransformStream:M,isWebStream:J,isReadableStream:Y,isReadableFinished:se}=Ct(),O=globalThis.AbortController||dr().AbortController,K,X,W;function ge(F,Ie,H){let L=!1;F.on("close",()=>{L=!0});let Z=r(F,{readable:Ie,writable:H},q=>{L=!q});return{destroy:q=>{L||(L=!0,n.destroyer(F,q||new v("pipe")))},cleanup:Z}}function de(F){return y(F[F.length-1],"streams[stream.length - 1]"),F.pop()}function le(F){if(N(F))return F;if(S(F))return Ee(F);throw new g("val",["Readable","Iterable","AsyncIterable"],F)}async function*Ee(F){X||(X=jr()),yield*X.prototype[i].call(F)}async function z(F,Ie,H,{end:L}){let Z,q=null,$=ne=>{if(ne&&(Z=ne),q){let x=q;q=null,x()}},V=()=>new c((ne,x)=>{Z?x(Z):q=()=>{Z?x(Z):ne()}});Ie.on("drain",$);let ae=r(Ie,{readable:!1},$);try{Ie.writableNeedDrain&&await V();for await(let ne of F)Ie.write(ne)||await V();L&&(Ie.end(),await V()),H()}catch(ne){H(Z!==ne?d(Z,ne):ne)}finally{ae(),Ie.off("drain",$)}}async function pe(F,Ie,H,{end:L}){M(Ie)&&(Ie=Ie.writable);let Z=Ie.getWriter();try{for await(let q of F)await Z.ready,Z.write(q).catch(()=>{});await Z.ready,L&&await Z.close(),H()}catch(q){try{await Z.abort(q),H(q)}catch($){H($)}}}function R(...F){return ie(F,t(de(F)))}function ie(F,Ie,H){if(F.length===1&&l(F[0])&&(F=F[0]),F.length<2)throw new m("streams");let L=new O,Z=L.signal,q=H==null?void 0:H.signal,$=[];E(q,"options.signal");function V(){te(new I)}W=W||at().addAbortListener;let ae;q&&(ae=W(q,V));let ne,x,U=[],Q=0;function re(me){te(me,--Q===0)}function te(me,ee){var Pe;if(me&&(!ne||ne.code==="ERR_STREAM_PREMATURE_CLOSE")&&(ne=me),!(!ne&&!ee)){for(;U.length;)U.shift()(ne);(Pe=ae)===null||Pe===void 0||Pe[e](),L.abort(),ee&&(ne||$.forEach(a=>a()),o.nextTick(Ie,ne,x))}}let ue;for(let me=0;me<F.length;me++){let ee=F[me],Pe=me<F.length-1,a=me>0,u=Pe||(H==null?void 0:H.end)!==!1,p=me===F.length-1;if(k(ee)){let w=function(T){T&&T.name!=="AbortError"&&T.code!=="ERR_STREAM_PREMATURE_CLOSE"&&re(T)};if(u){let{destroy:T,cleanup:j}=ge(ee,Pe,a);U.push(T),B(ee)&&p&&$.push(j)}ee.on("error",w),B(ee)&&p&&$.push(()=>{ee.removeListener("error",w)})}if(me===0)if(typeof ee=="function"){if(ue=ee({signal:Z}),!N(ue))throw new b("Iterable, AsyncIterable or Stream","source",ue)}else N(ee)||S(ee)||M(ee)?ue=ee:ue=h.from(ee);else if(typeof ee=="function"){if(M(ue)){var D;ue=le((D=ue)===null||D===void 0?void 0:D.readable)}else ue=le(ue);if(ue=ee(ue,{signal:Z}),Pe){if(!N(ue,!0))throw new b("AsyncIterable",`transform[${me-1}]`,ue)}else{var oe;K||(K=Vo());let w=new K({objectMode:!0}),T=(oe=ue)===null||oe===void 0?void 0:oe.then;if(typeof T=="function")Q++,T.call(ue,_e=>{x=_e,_e!=null&&w.write(_e),u&&w.end(),o.nextTick(re)},_e=>{w.destroy(_e),o.nextTick(re,_e)});else if(N(ue,!0))Q++,z(ue,w,re,{end:u});else if(Y(ue)||M(ue)){let _e=ue.readable||ue;Q++,z(_e,w,re,{end:u})}else throw new b("AsyncIterable or Promise","destination",ue);ue=w;let{destroy:j,cleanup:G}=ge(ue,!1,!0);U.push(j),p&&$.push(G)}}else if(k(ee)){if(S(ue)){Q+=2;let w=ye(ue,ee,re,{end:u});B(ee)&&p&&$.push(w)}else if(M(ue)||Y(ue)){let w=ue.readable||ue;Q++,z(w,ee,re,{end:u})}else if(N(ue))Q++,z(ue,ee,re,{end:u});else throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ue);ue=ee}else if(J(ee)){if(S(ue))Q++,pe(le(ue),ee,re,{end:u});else if(Y(ue)||N(ue))Q++,pe(ue,ee,re,{end:u});else if(M(ue))Q++,pe(ue.readable,ee,re,{end:u});else throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ue);ue=ee}else ue=h.from(ee)}return(Z!=null&&Z.aborted||q!=null&&q.aborted)&&o.nextTick(V),ue}function ye(F,Ie,H,{end:L}){let Z=!1;if(Ie.on("close",()=>{Z||H(new _)}),F.pipe(Ie,{end:!1}),L){let q=function(){Z=!0,Ie.end()};se(F)?o.nextTick(q):F.once("end",q)}else H();return r(F,{readable:!0,writable:!1},q=>{let $=F._readableState;q&&q.code==="ERR_STREAM_PREMATURE_CLOSE"&&$&&$.ended&&!$.errored&&!$.errorEmitted?F.once("end",H).once("error",H):H(q)}),r(Ie,{readable:!1,writable:!0},H)}f.exports={pipelineImpl:ie,pipeline:R}}),Ho=be((s,f)=>{he(),fe(),ce();var{pipeline:o}=Bn(),l=kt(),{destroyer:c}=nr(),{isNodeStream:i,isReadable:e,isWritable:r,isWebStream:t,isTransformStream:n,isWritableStream:h,isReadableStream:d}=Ct(),{AbortError:g,codes:{ERR_INVALID_ARG_VALUE:b,ERR_MISSING_ARGS:m}}=ot(),v=Dt();f.exports=function(..._){if(_.length===0)throw new m("streams");if(_.length===1)return l.from(_[0]);let I=[..._];if(typeof _[0]=="function"&&(_[0]=l.from(_[0])),typeof _[_.length-1]=="function"){let O=_.length-1;_[O]=l.from(_[O])}for(let O=0;O<_.length;++O)if(!(!i(_[O])&&!t(_[O]))){if(O<_.length-1&&!(e(_[O])||d(_[O])||n(_[O])))throw new b(`streams[${O}]`,I[O],"must be readable");if(O>0&&!(r(_[O])||h(_[O])||n(_[O])))throw new b(`streams[${O}]`,I[O],"must be writable")}let y,E,N,B,S;function k(O){let K=B;B=null,K?K(O):O?S.destroy(O):!se&&!Y&&S.destroy()}let M=_[0],J=o(_,k),Y=!!(r(M)||h(M)||n(M)),se=!!(e(J)||d(J)||n(J));if(S=new l({writableObjectMode:!!(M!=null&&M.writableObjectMode),readableObjectMode:!!(J!=null&&J.readableObjectMode),writable:Y,readable:se}),Y){if(i(M))S._write=function(K,X,W){M.write(K,X)?W():y=W},S._final=function(K){M.end(),E=K},M.on("drain",function(){if(y){let K=y;y=null,K()}});else if(t(M)){let K=(n(M)?M.writable:M).getWriter();S._write=async function(X,W,ge){try{await K.ready,K.write(X).catch(()=>{}),ge()}catch(de){ge(de)}},S._final=async function(X){try{await K.ready,K.close().catch(()=>{}),E=X}catch(W){X(W)}}}let O=n(J)?J.readable:J;v(O,()=>{if(E){let K=E;E=null,K()}})}if(se){if(i(J))J.on("readable",function(){if(N){let O=N;N=null,O()}}),J.on("end",function(){S.push(null)}),S._read=function(){for(;;){let O=J.read();if(O===null){N=S._read;return}if(!S.push(O))return}};else if(t(J)){let O=(n(J)?J.readable:J).getReader();S._read=async function(){for(;;)try{let{value:K,done:X}=await O.read();if(!S.push(K))return;if(X){S.push(null);return}}catch{return}}}}return S._destroy=function(O,K){!O&&B!==null&&(O=new g),N=null,y=null,E=null,B===null?K(O):(B=K,i(J)&&c(J,O))},S}}),La=be((s,f)=>{he(),fe(),ce();var o=globalThis.AbortController||dr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:l,ERR_INVALID_ARG_TYPE:c,ERR_MISSING_ARGS:i,ERR_OUT_OF_RANGE:e},AbortError:r}=ot(),{validateAbortSignal:t,validateInteger:n,validateObject:h}=pr(),d=ze().Symbol("kWeak"),g=ze().Symbol("kResistStopPropagation"),{finished:b}=Dt(),m=Ho(),{addAbortSignalNoValidate:v}=Nr(),{isWritable:_,isNodeStream:I}=Ct(),{deprecate:y}=at(),{ArrayPrototypePush:E,Boolean:N,MathFloor:B,Number:S,NumberIsNaN:k,Promise:M,PromiseReject:J,PromiseResolve:Y,PromisePrototypeThen:se,Symbol:O}=ze(),K=O("kEmpty"),X=O("kEof");function W(q,$){if($!=null&&h($,"options"),($==null?void 0:$.signal)!=null&&t($.signal,"options.signal"),I(q)&&!_(q))throw new l("stream",q,"must be writable");let V=m(this,q);return $!=null&&$.signal&&v($.signal,V),V}function ge(q,$){if(typeof q!="function")throw new c("fn",["Function","AsyncFunction"],q);$!=null&&h($,"options"),($==null?void 0:$.signal)!=null&&t($.signal,"options.signal");let V=1;($==null?void 0:$.concurrency)!=null&&(V=B($.concurrency));let ae=V-1;return($==null?void 0:$.highWaterMark)!=null&&(ae=B($.highWaterMark)),n(V,"options.concurrency",1),n(ae,"options.highWaterMark",0),ae+=V,(async function*(){let ne=at().AbortSignalAny([$==null?void 0:$.signal].filter(N)),x=this,U=[],Q={signal:ne},re,te,ue=!1,D=0;function oe(){ue=!0,me()}function me(){D-=1,ee()}function ee(){te&&!ue&&D<V&&U.length<ae&&(te(),te=null)}async function Pe(){try{for await(let a of x){if(ue)return;if(ne.aborted)throw new r;try{if(a=q(a,Q),a===K)continue;a=Y(a)}catch(u){a=J(u)}D+=1,se(a,me,oe),U.push(a),re&&(re(),re=null),!ue&&(U.length>=ae||D>=V)&&await new M(u=>{te=u})}U.push(X)}catch(a){let u=J(a);se(u,me,oe),U.push(u)}finally{ue=!0,re&&(re(),re=null)}}Pe();try{for(;;){for(;U.length>0;){let a=await U[0];if(a===X)return;if(ne.aborted)throw new r;a!==K&&(yield a),U.shift(),ee()}await new M(a=>{re=a})}}finally{ue=!0,te&&(te(),te=null)}}).call(this)}function de(q=void 0){return q!=null&&h(q,"options"),(q==null?void 0:q.signal)!=null&&t(q.signal,"options.signal"),(async function*(){let $=0;for await(let ae of this){var V;if(q!=null&&(V=q.signal)!==null&&V!==void 0&&V.aborted)throw new r({cause:q.signal.reason});yield[$++,ae]}}).call(this)}async function le(q,$=void 0){for await(let V of R.call(this,q,$))return!0;return!1}async function Ee(q,$=void 0){if(typeof q!="function")throw new c("fn",["Function","AsyncFunction"],q);return!await le.call(this,async(...V)=>!await q(...V),$)}async function z(q,$){for await(let V of R.call(this,q,$))return V}async function pe(q,$){if(typeof q!="function")throw new c("fn",["Function","AsyncFunction"],q);async function V(ae,ne){return await q(ae,ne),K}for await(let ae of ge.call(this,V,$));}function R(q,$){if(typeof q!="function")throw new c("fn",["Function","AsyncFunction"],q);async function V(ae,ne){return await q(ae,ne)?ae:K}return ge.call(this,V,$)}var ie=class extends i{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function ye(q,$,V){var ae;if(typeof q!="function")throw new c("reducer",["Function","AsyncFunction"],q);V!=null&&h(V,"options"),(V==null?void 0:V.signal)!=null&&t(V.signal,"options.signal");let ne=arguments.length>1;if(V!=null&&(ae=V.signal)!==null&&ae!==void 0&&ae.aborted){let te=new r(void 0,{cause:V.signal.reason});throw this.once("error",()=>{}),await b(this.destroy(te)),te}let x=new o,U=x.signal;if(V!=null&&V.signal){let te={once:!0,[d]:this,[g]:!0};V.signal.addEventListener("abort",()=>x.abort(),te)}let Q=!1;try{for await(let te of this){var re;if(Q=!0,V!=null&&(re=V.signal)!==null&&re!==void 0&&re.aborted)throw new r;ne?$=await q($,te,{signal:U}):($=te,ne=!0)}if(!Q&&!ne)throw new ie}finally{x.abort()}return $}async function F(q){q!=null&&h(q,"options"),(q==null?void 0:q.signal)!=null&&t(q.signal,"options.signal");let $=[];for await(let ae of this){var V;if(q!=null&&(V=q.signal)!==null&&V!==void 0&&V.aborted)throw new r(void 0,{cause:q.signal.reason});E($,ae)}return $}function Ie(q,$){let V=ge.call(this,q,$);return(async function*(){for await(let ae of V)yield*ae}).call(this)}function H(q){if(q=S(q),k(q))return 0;if(q<0)throw new e("number",">= 0",q);return q}function L(q,$=void 0){return $!=null&&h($,"options"),($==null?void 0:$.signal)!=null&&t($.signal,"options.signal"),q=H(q),(async function*(){var V;if($!=null&&(V=$.signal)!==null&&V!==void 0&&V.aborted)throw new r;for await(let ne of this){var ae;if($!=null&&(ae=$.signal)!==null&&ae!==void 0&&ae.aborted)throw new r;q--<=0&&(yield ne)}}).call(this)}function Z(q,$=void 0){return $!=null&&h($,"options"),($==null?void 0:$.signal)!=null&&t($.signal,"options.signal"),q=H(q),(async function*(){var V;if($!=null&&(V=$.signal)!==null&&V!==void 0&&V.aborted)throw new r;for await(let ne of this){var ae;if($!=null&&(ae=$.signal)!==null&&ae!==void 0&&ae.aborted)throw new r;if(q-- >0&&(yield ne),q<=0)return}}).call(this)}f.exports.streamReturningOperators={asIndexedPairs:y(de,"readable.asIndexedPairs will be removed in a future version."),drop:L,filter:R,flatMap:Ie,map:ge,take:Z,compose:W},f.exports.promiseReturningOperators={every:Ee,forEach:pe,reduce:ye,toArray:F,some:le,find:z}}),zo=be((s,f)=>{he(),fe(),ce();var{ArrayPrototypePop:o,Promise:l}=ze(),{isIterable:c,isNodeStream:i,isWebStream:e}=Ct(),{pipelineImpl:r}=Bn(),{finished:t}=Dt();Go();function n(...h){return new l((d,g)=>{let b,m,v=h[h.length-1];if(v&&typeof v=="object"&&!i(v)&&!c(v)&&!e(v)){let _=o(h);b=_.signal,m=_.end}r(h,(_,I)=>{_?g(_):d(I)},{signal:b,end:m})})}f.exports={finished:t,pipeline:n}}),Go=be((s,f)=>{he(),fe(),ce();var{Buffer:o}=(Xe(),De(Je)),{ObjectDefineProperty:l,ObjectKeys:c,ReflectApply:i}=ze(),{promisify:{custom:e}}=at(),{streamReturningOperators:r,promiseReturningOperators:t}=La(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:n}}=ot(),h=Ho(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:g}=Lr(),{pipeline:b}=Bn(),{destroyer:m}=nr(),v=Dt(),_=zo(),I=Ct(),y=f.exports=Rn().Stream;y.isDestroyed=I.isDestroyed,y.isDisturbed=I.isDisturbed,y.isErrored=I.isErrored,y.isReadable=I.isReadable,y.isWritable=I.isWritable,y.Readable=jr();for(let N of c(r)){let B=function(...k){if(new.target)throw n();return y.Readable.from(i(S,this,k))},S=r[N];l(B,"name",{__proto__:null,value:S.name}),l(B,"length",{__proto__:null,value:S.length}),l(y.Readable.prototype,N,{__proto__:null,value:B,enumerable:!1,configurable:!0,writable:!0})}for(let N of c(t)){let B=function(...k){if(new.target)throw n();return i(S,this,k)},S=t[N];l(B,"name",{__proto__:null,value:S.name}),l(B,"length",{__proto__:null,value:S.length}),l(y.Readable.prototype,N,{__proto__:null,value:B,enumerable:!1,configurable:!0,writable:!0})}y.Writable=xn(),y.Duplex=kt(),y.Transform=$o(),y.PassThrough=Vo(),y.pipeline=b;var{addAbortSignal:E}=Nr();y.addAbortSignal=E,y.finished=v,y.destroy=m,y.compose=h,y.setDefaultHighWaterMark=d,y.getDefaultHighWaterMark=g,l(y,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),l(b,e,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),l(v,e,{__proto__:null,enumerable:!0,get(){return _.finished}}),y.Stream=y,y._isUint8Array=function(N){return N instanceof Uint8Array},y._uint8ArrayToBuffer=function(N){return o.from(N.buffer,N.byteOffset,N.byteLength)}}),Zt=be((s,f)=>{he(),fe(),ce();var o=Go(),l=zo(),c=o.Readable.destroy;f.exports=o.Readable,f.exports._uint8ArrayToBuffer=o._uint8ArrayToBuffer,f.exports._isUint8Array=o._isUint8Array,f.exports.isDisturbed=o.isDisturbed,f.exports.isErrored=o.isErrored,f.exports.isReadable=o.isReadable,f.exports.Readable=o.Readable,f.exports.Writable=o.Writable,f.exports.Duplex=o.Duplex,f.exports.Transform=o.Transform,f.exports.PassThrough=o.PassThrough,f.exports.addAbortSignal=o.addAbortSignal,f.exports.finished=o.finished,f.exports.destroy=o.destroy,f.exports.destroy=c,f.exports.pipeline=o.pipeline,f.exports.compose=o.compose,Object.defineProperty(o,"promises",{configurable:!0,enumerable:!0,get(){return l}}),f.exports.Stream=o.Stream,f.exports.default=f.exports}),ja=be((s,f)=>{he(),fe(),ce(),typeof Object.create=="function"?f.exports=function(o,l){l&&(o.super_=l,o.prototype=Object.create(l.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}))}:f.exports=function(o,l){if(l){o.super_=l;var c=function(){};c.prototype=l.prototype,o.prototype=new c,o.prototype.constructor=o}}}),Ua=be((s,f)=>{he(),fe(),ce();var{Buffer:o}=(Xe(),De(Je)),l=Symbol.for("BufferList");function c(i){if(!(this instanceof c))return new c(i);c._init.call(this,i)}c._init=function(i){Object.defineProperty(this,l,{value:!0}),this._bufs=[],this.length=0,i&&this.append(i)},c.prototype._new=function(i){return new c(i)},c.prototype._offset=function(i){if(i===0)return[0,0];let e=0;for(let r=0;r<this._bufs.length;r++){let t=e+this._bufs[r].length;if(i<t||r===this._bufs.length-1)return[r,i-e];e=t}},c.prototype._reverseOffset=function(i){let e=i[0],r=i[1];for(let t=0;t<e;t++)r+=this._bufs[t].length;return r},c.prototype.get=function(i){if(i>this.length||i<0)return;let e=this._offset(i);return this._bufs[e[0]][e[1]]},c.prototype.slice=function(i,e){return typeof i=="number"&&i<0&&(i+=this.length),typeof e=="number"&&e<0&&(e+=this.length),this.copy(null,0,i,e)},c.prototype.copy=function(i,e,r,t){if((typeof r!="number"||r<0)&&(r=0),(typeof t!="number"||t>this.length)&&(t=this.length),r>=this.length||t<=0)return i||o.alloc(0);let n=!!i,h=this._offset(r),d=t-r,g=d,b=n&&e||0,m=h[1];if(r===0&&t===this.length){if(!n)return this._bufs.length===1?this._bufs[0]:o.concat(this._bufs,this.length);for(let v=0;v<this._bufs.length;v++)this._bufs[v].copy(i,b),b+=this._bufs[v].length;return i}if(g<=this._bufs[h[0]].length-m)return n?this._bufs[h[0]].copy(i,e,m,m+g):this._bufs[h[0]].slice(m,m+g);n||(i=o.allocUnsafe(d));for(let v=h[0];v<this._bufs.length;v++){let _=this._bufs[v].length-m;if(g>_)this._bufs[v].copy(i,b,m),b+=_;else{this._bufs[v].copy(i,b,m,m+g),b+=_;break}g-=_,m&&(m=0)}return i.length>b?i.slice(0,b):i},c.prototype.shallowSlice=function(i,e){if(i=i||0,e=typeof e!="number"?this.length:e,i<0&&(i+=this.length),e<0&&(e+=this.length),i===e)return this._new();let r=this._offset(i),t=this._offset(e),n=this._bufs.slice(r[0],t[0]+1);return t[1]===0?n.pop():n[n.length-1]=n[n.length-1].slice(0,t[1]),r[1]!==0&&(n[0]=n[0].slice(r[1])),this._new(n)},c.prototype.toString=function(i,e,r){return this.slice(e,r).toString(i)},c.prototype.consume=function(i){if(i=Math.trunc(i),Number.isNaN(i)||i<=0)return this;for(;this._bufs.length;)if(i>=this._bufs[0].length)i-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(i),this.length-=i;break}return this},c.prototype.duplicate=function(){let i=this._new();for(let e=0;e<this._bufs.length;e++)i.append(this._bufs[e]);return i},c.prototype.append=function(i){if(i==null)return this;if(i.buffer)this._appendBuffer(o.from(i.buffer,i.byteOffset,i.byteLength));else if(Array.isArray(i))for(let e=0;e<i.length;e++)this.append(i[e]);else if(this._isBufferList(i))for(let e=0;e<i._bufs.length;e++)this.append(i._bufs[e]);else typeof i=="number"&&(i=i.toString()),this._appendBuffer(o.from(i));return this},c.prototype._appendBuffer=function(i){this._bufs.push(i),this.length+=i.length},c.prototype.indexOf=function(i,e,r){if(r===void 0&&typeof e=="string"&&(r=e,e=void 0),typeof i=="function"||Array.isArray(i))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof i=="number"?i=o.from([i]):typeof i=="string"?i=o.from(i,r):this._isBufferList(i)?i=i.slice():Array.isArray(i.buffer)?i=o.from(i.buffer,i.byteOffset,i.byteLength):o.isBuffer(i)||(i=o.from(i)),e=Number(e||0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),i.length===0)return e>this.length?this.length:e;let t=this._offset(e),n=t[0],h=t[1];for(;n<this._bufs.length;n++){let d=this._bufs[n];for(;h<d.length;)if(d.length-h>=i.length){let g=d.indexOf(i,h);if(g!==-1)return this._reverseOffset([n,g]);h=d.length-i.length+1}else{let g=this._reverseOffset([n,h]);if(this._match(g,i))return g;h++}h=0}return-1},c.prototype._match=function(i,e){if(this.length-i<e.length)return!1;for(let r=0;r<e.length;r++)if(this.get(i+r)!==e[r])return!1;return!0},function(){let i={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 i)(function(r){i[r]===null?c.prototype[r]=function(t,n){return this.slice(t,t+n)[r](0,n)}:c.prototype[r]=function(t=0){return this.slice(t,t+i[r])[r](0)}})(e)}(),c.prototype._isBufferList=function(i){return i instanceof c||c.isBufferList(i)},c.isBufferList=function(i){return i!=null&&i[l]},f.exports=c}),Da=be((s,f)=>{he(),fe(),ce();var o=Zt().Duplex,l=ja(),c=Ua();function i(e){if(!(this instanceof i))return new i(e);if(typeof e=="function"){this._callback=e;let r=(function(t){this._callback&&(this._callback(t),this._callback=null)}).bind(this);this.on("pipe",function(t){t.on("error",r)}),this.on("unpipe",function(t){t.removeListener("error",r)}),e=null}c._init.call(this,e),o.call(this)}l(i,o),Object.assign(i.prototype,c.prototype),i.prototype._new=function(e){return new i(e)},i.prototype._write=function(e,r,t){this._appendBuffer(e),typeof t=="function"&&t()},i.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)},i.prototype.end=function(e){o.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},i.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e)},i.prototype._isBufferList=function(e){return e instanceof i||e instanceof c||i.isBufferList(e)},i.isBufferList=c.isBufferList,f.exports=i,f.exports.BufferListStream=i,f.exports.BufferList=c}),Fa=be((s,f)=>{he(),fe(),ce();var o=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};f.exports=o}),Ko=be((s,f)=>{he(),fe(),ce();var o=f.exports,{Buffer:l}=(Xe(),De(Je));o.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"},o.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},o.requiredHeaderFlagsErrors={};for(let i in o.requiredHeaderFlags){let e=o.requiredHeaderFlags[i];o.requiredHeaderFlagsErrors[i]="Invalid header flag bits, must be 0x"+e.toString(16)+" for "+o.types[i]+" packet"}o.codes={};for(let i in o.types){let e=o.types[i];o.codes[e]=i}o.CMD_SHIFT=4,o.CMD_MASK=240,o.DUP_MASK=8,o.QOS_MASK=3,o.QOS_SHIFT=1,o.RETAIN_MASK=1,o.VARBYTEINT_MASK=127,o.VARBYTEINT_FIN_MASK=128,o.VARBYTEINT_MAX=268435455,o.SESSIONPRESENT_MASK=1,o.SESSIONPRESENT_HEADER=l.from([o.SESSIONPRESENT_MASK]),o.CONNACK_HEADER=l.from([o.codes.connack<<o.CMD_SHIFT]),o.USERNAME_MASK=128,o.PASSWORD_MASK=64,o.WILL_RETAIN_MASK=32,o.WILL_QOS_MASK=24,o.WILL_QOS_SHIFT=3,o.WILL_FLAG_MASK=4,o.CLEAN_SESSION_MASK=2,o.CONNECT_HEADER=l.from([o.codes.connect<<o.CMD_SHIFT]),o.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},o.propertiesCodes={};for(let i in o.properties){let e=o.properties[i];o.propertiesCodes[e]=i}o.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 c(i){return[0,1,2].map(e=>[0,1].map(r=>[0,1].map(t=>{let n=l.alloc(1);return n.writeUInt8(o.codes[i]<<o.CMD_SHIFT|(r?o.DUP_MASK:0)|e<<o.QOS_SHIFT|t,0,!0),n})))}o.PUBLISH_HEADER=c("publish"),o.SUBSCRIBE_HEADER=c("subscribe"),o.SUBSCRIBE_OPTIONS_QOS_MASK=3,o.SUBSCRIBE_OPTIONS_NL_MASK=1,o.SUBSCRIBE_OPTIONS_NL_SHIFT=2,o.SUBSCRIBE_OPTIONS_RAP_MASK=1,o.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,o.SUBSCRIBE_OPTIONS_RH_MASK=3,o.SUBSCRIBE_OPTIONS_RH_SHIFT=4,o.SUBSCRIBE_OPTIONS_RH=[0,16,32],o.SUBSCRIBE_OPTIONS_NL=4,o.SUBSCRIBE_OPTIONS_RAP=8,o.SUBSCRIBE_OPTIONS_QOS=[0,1,2],o.UNSUBSCRIBE_HEADER=c("unsubscribe"),o.ACKS={unsuback:c("unsuback"),puback:c("puback"),pubcomp:c("pubcomp"),pubrel:c("pubrel"),pubrec:c("pubrec")},o.SUBACK_HEADER=l.from([o.codes.suback<<o.CMD_SHIFT]),o.VERSION3=l.from([3]),o.VERSION4=l.from([4]),o.VERSION5=l.from([5]),o.VERSION131=l.from([131]),o.VERSION132=l.from([132]),o.QOS=[0,1,2].map(i=>l.from([i])),o.EMPTY={pingreq:l.from([o.codes.pingreq<<4,0]),pingresp:l.from([o.codes.pingresp<<4,0]),disconnect:l.from([o.codes.disconnect<<4,0])},o.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"},o.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"},o.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"},o.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"},o.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"},o.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}}),Wa=be((s,f)=>{he(),fe(),ce();var o=1e3,l=o*60,c=l*60,i=c*24,e=i*7,r=i*365.25;f.exports=function(g,b){b=b||{};var m=typeof g;if(m==="string"&&g.length>0)return t(g);if(m==="number"&&isFinite(g))return b.long?h(g):n(g);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(g))};function t(g){if(g=String(g),!(g.length>100)){var b=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(g);if(b){var m=parseFloat(b[1]),v=(b[2]||"ms").toLowerCase();switch(v){case"years":case"year":case"yrs":case"yr":case"y":return m*r;case"weeks":case"week":case"w":return m*e;case"days":case"day":case"d":return m*i;case"hours":case"hour":case"hrs":case"hr":case"h":return m*c;case"minutes":case"minute":case"mins":case"min":case"m":return m*l;case"seconds":case"second":case"secs":case"sec":case"s":return m*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function n(g){var b=Math.abs(g);return b>=i?Math.round(g/i)+"d":b>=c?Math.round(g/c)+"h":b>=l?Math.round(g/l)+"m":b>=o?Math.round(g/o)+"s":g+"ms"}function h(g){var b=Math.abs(g);return b>=i?d(g,b,i,"day"):b>=c?d(g,b,c,"hour"):b>=l?d(g,b,l,"minute"):b>=o?d(g,b,o,"second"):g+" ms"}function d(g,b,m,v){var _=b>=m*1.5;return Math.round(g/m)+" "+v+(_?"s":"")}}),qa=be((s,f)=>{he(),fe(),ce();function o(l){i.debug=i,i.default=i,i.coerce=d,i.disable=n,i.enable=r,i.enabled=h,i.humanize=Wa(),i.destroy=g,Object.keys(l).forEach(b=>{i[b]=l[b]}),i.names=[],i.skips=[],i.formatters={};function c(b){let m=0;for(let v=0;v<b.length;v++)m=(m<<5)-m+b.charCodeAt(v),m|=0;return i.colors[Math.abs(m)%i.colors.length]}i.selectColor=c;function i(b){let m,v=null,_,I;function y(...E){if(!y.enabled)return;let N=y,B=Number(new Date),S=B-(m||B);N.diff=S,N.prev=m,N.curr=B,m=B,E[0]=i.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let k=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(M,J)=>{if(M==="%%")return"%";k++;let Y=i.formatters[J];if(typeof Y=="function"){let se=E[k];M=Y.call(N,se),E.splice(k,1),k--}return M}),i.formatArgs.call(N,E),(N.log||i.log).apply(N,E)}return y.namespace=b,y.useColors=i.useColors(),y.color=i.selectColor(b),y.extend=e,y.destroy=i.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>v!==null?v:(_!==i.namespaces&&(_=i.namespaces,I=i.enabled(b)),I),set:E=>{v=E}}),typeof i.init=="function"&&i.init(y),y}function e(b,m){let v=i(this.namespace+(typeof m>"u"?":":m)+b);return v.log=this.log,v}function r(b){i.save(b),i.namespaces=b,i.names=[],i.skips=[];let m=(typeof b=="string"?b:"").trim().replace(" ",",").split(",").filter(Boolean);for(let v of m)v[0]==="-"?i.skips.push(v.slice(1)):i.names.push(v)}function t(b,m){let v=0,_=0,I=-1,y=0;for(;v<b.length;)if(_<m.length&&(m[_]===b[v]||m[_]==="*"))m[_]==="*"?(I=_,y=v,_++):(v++,_++);else if(I!==-1)_=I+1,y++,v=y;else return!1;for(;_<m.length&&m[_]==="*";)_++;return _===m.length}function n(){let b=[...i.names,...i.skips.map(m=>"-"+m)].join(",");return i.enable(""),b}function h(b){for(let m of i.skips)if(t(b,m))return!1;for(let m of i.names)if(t(b,m))return!0;return!1}function d(b){return b instanceof Error?b.stack||b.message:b}function g(){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 i.enable(i.load()),i}f.exports=o}),Tt=be((s,f)=>{he(),fe(),ce(),s.formatArgs=l,s.save=c,s.load=i,s.useColors=o,s.storage=e(),s.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`."))}})(),s.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 o(){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 l(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+f.exports.humanize(this.diff),!this.useColors)return;let n="color: "+this.color;t.splice(1,0,n,"color: inherit");let h=0,d=0;t[0].replace(/%[a-zA-Z%]/g,g=>{g!=="%%"&&(h++,g==="%c"&&(d=h))}),t.splice(d,0,n)}s.log=console.debug||console.log||(()=>{});function c(t){try{t?s.storage.setItem("debug",t):s.storage.removeItem("debug")}catch{}}function i(){let t;try{t=s.storage.getItem("debug")}catch{}return!t&&typeof Le<"u"&&"env"in Le&&(t=Le.env.DEBUG),t}function e(){try{return localStorage}catch{}}f.exports=qa()(s);var{formatters:r}=f.exports;r.j=function(t){try{return JSON.stringify(t)}catch(n){return"[UnexpectedJSONParseError]: "+n.message}}}),$a=be((s,f)=>{he(),fe(),ce();var o=Da(),{EventEmitter:l}=(Jt(),De(Ut)),c=Fa(),i=Ko(),e=Tt()("mqtt-packet:parser"),r=class dn extends l{constructor(){super(),this.parser=this.constructor.parser}static parser(n){return this instanceof dn?(this.settings=n||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new dn().parser(n)}_resetState(){e("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new c,this.error=null,this._list=o(),this._stateCounter=0}parse(n){for(this.error&&this._resetState(),this._list.append(n),e("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++,e("parse: state complete. _stateCounter is now: %d",this._stateCounter),e("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return e("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let n=this._list.readUInt8(0),h=n>>i.CMD_SHIFT;this.packet.cmd=i.types[h];let d=n&15,g=i.requiredHeaderFlags[h];return g!=null&&d!==g?this._emitError(new Error(i.requiredHeaderFlagsErrors[h])):(this.packet.retain=(n&i.RETAIN_MASK)!==0,this.packet.qos=n>>i.QOS_SHIFT&i.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(n&i.DUP_MASK)!==0,e("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let n=this._parseVarByteNum(!0);return n&&(this.packet.length=n.value,this._list.consume(n.bytes)),e("_parseLength %d",n.value),!!n}_parsePayload(){e("_parsePayload: payload %O",this._list);let n=!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"))}n=!0}return e("_parsePayload complete result: %s",n),n}_parseConnect(){e("_parseConnect");let n,h,d,g,b={},m=this.packet,v=this._parseString();if(v===null)return this._emitError(new Error("Cannot parse protocolId"));if(v!=="MQTT"&&v!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(m.protocolId=v,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(m.protocolVersion=this._list.readUInt8(this._pos),m.protocolVersion>=128&&(m.bridgeMode=!0,m.protocolVersion=m.protocolVersion-128),m.protocolVersion!==3&&m.protocolVersion!==4&&m.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(this._list.readUInt8(this._pos)&1)return this._emitError(new Error("Connect flag bit 0 must be 0, but got 1"));b.username=this._list.readUInt8(this._pos)&i.USERNAME_MASK,b.password=this._list.readUInt8(this._pos)&i.PASSWORD_MASK,b.will=this._list.readUInt8(this._pos)&i.WILL_FLAG_MASK;let _=!!(this._list.readUInt8(this._pos)&i.WILL_RETAIN_MASK),I=(this._list.readUInt8(this._pos)&i.WILL_QOS_MASK)>>i.WILL_QOS_SHIFT;if(b.will)m.will={},m.will.retain=_,m.will.qos=I;else{if(_)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(I)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(m.clean=(this._list.readUInt8(this._pos)&i.CLEAN_SESSION_MASK)!==0,this._pos++,m.keepalive=this._parseNum(),m.keepalive===-1)return this._emitError(new Error("Packet too short"));if(m.protocolVersion===5){let E=this._parseProperties();Object.getOwnPropertyNames(E).length&&(m.properties=E)}let y=this._parseString();if(y===null)return this._emitError(new Error("Packet too short"));if(m.clientId=y,e("_parseConnect: packet.clientId: %s",m.clientId),b.will){if(m.protocolVersion===5){let E=this._parseProperties();Object.getOwnPropertyNames(E).length&&(m.will.properties=E)}if(n=this._parseString(),n===null)return this._emitError(new Error("Cannot parse will topic"));if(m.will.topic=n,e("_parseConnect: packet.will.topic: %s",m.will.topic),h=this._parseBuffer(),h===null)return this._emitError(new Error("Cannot parse will payload"));m.will.payload=h,e("_parseConnect: packet.will.paylaod: %s",m.will.payload)}if(b.username){if(g=this._parseString(),g===null)return this._emitError(new Error("Cannot parse username"));m.username=g,e("_parseConnect: packet.username: %s",m.username)}if(b.password){if(d=this._parseBuffer(),d===null)return this._emitError(new Error("Cannot parse password"));m.password=d}return this.settings=m,e("_parseConnect: complete"),m}_parseConnack(){e("_parseConnack");let n=this.packet;if(this._list.length<1)return null;let h=this._list.readUInt8(this._pos++);if(h>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(n.sessionPresent=!!(h&i.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?n.reasonCode=this._list.readUInt8(this._pos++):n.reasonCode=0;else{if(this._list.length<2)return null;n.returnCode=this._list.readUInt8(this._pos++)}if(n.returnCode===-1||n.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(n.properties=d)}e("_parseConnack: complete")}_parsePublish(){e("_parsePublish");let n=this.packet;if(n.topic=this._parseString(),n.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(n.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let h=this._parseProperties();Object.getOwnPropertyNames(h).length&&(n.properties=h)}n.payload=this._list.slice(this._pos,n.length),e("_parsePublish: payload from buffer list: %o",n.payload)}}_parseSubscribe(){e("_parseSubscribe");let n=this.packet,h,d,g,b,m,v,_;if(n.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let I=this._parseProperties();Object.getOwnPropertyNames(I).length&&(n.properties=I)}if(n.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos<n.length;){if(h=this._parseString(),h===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=n.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(d=this._parseByte(),this.settings.protocolVersion===5){if(d&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(d&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(g=d&i.SUBSCRIBE_OPTIONS_QOS_MASK,g>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(v=(d>>i.SUBSCRIBE_OPTIONS_NL_SHIFT&i.SUBSCRIBE_OPTIONS_NL_MASK)!==0,m=(d>>i.SUBSCRIBE_OPTIONS_RAP_SHIFT&i.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,b=d>>i.SUBSCRIBE_OPTIONS_RH_SHIFT&i.SUBSCRIBE_OPTIONS_RH_MASK,b>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));_={topic:h,qos:g},this.settings.protocolVersion===5?(_.nl=v,_.rap=m,_.rh=b):this.settings.bridgeMode&&(_.rh=0,_.rap=!0,_.nl=!0),e("_parseSubscribe: push subscription `%s` to subscription",_),n.subscriptions.push(_)}}}_parseSuback(){e("_parseSuback");let n=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let h=this._parseProperties();Object.getOwnPropertyNames(h).length&&(n.properties=h)}if(n.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos<this.packet.length;){let h=this._list.readUInt8(this._pos++);if(this.settings.protocolVersion===5){if(!i.MQTT5_SUBACK_CODES[h])return this._emitError(new Error("Invalid suback code"))}else if(h>2&&h!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(h)}}}_parseUnsubscribe(){e("_parseUnsubscribe");let n=this.packet;if(n.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let h=this._parseProperties();Object.getOwnPropertyNames(h).length&&(n.properties=h)}if(n.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos<n.length;){let h=this._parseString();if(h===null)return this._emitError(new Error("Cannot parse topic"));e("_parseUnsubscribe: push topic `%s` to unsubscriptions",h),n.unsubscriptions.push(h)}}}_parseUnsuback(){e("_parseUnsuback");let n=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if((this.settings.protocolVersion===3||this.settings.protocolVersion===4)&&n.length!==2)return this._emitError(new Error("Malformed unsuback, payload length must be 2"));if(n.length<=0)return this._emitError(new Error("Malformed unsuback, no payload specified"));if(this.settings.protocolVersion===5){let h=this._parseProperties();for(Object.getOwnPropertyNames(h).length&&(n.properties=h),n.granted=[];this._pos<this.packet.length;){let d=this._list.readUInt8(this._pos++);if(!i.MQTT5_UNSUBACK_CODES[d])return this._emitError(new Error("Invalid unsuback code"));this.packet.granted.push(d)}}}_parseConfirmation(){e("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let n=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5){if(n.length>2){switch(n.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!i.MQTT5_PUBACK_PUBREC_CODES[n.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!i.MQTT5_PUBREL_PUBCOMP_CODES[n.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}e("_parseConfirmation: packet.reasonCode `%d`",n.reasonCode)}else n.reasonCode=0;if(n.length>3){let h=this._parseProperties();Object.getOwnPropertyNames(h).length&&(n.properties=h)}}return!0}_parseDisconnect(){let n=this.packet;if(e("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(n.reasonCode=this._parseByte(),i.MQTT5_DISCONNECT_CODES[n.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):n.reasonCode=0;let h=this._parseProperties();Object.getOwnPropertyNames(h).length&&(n.properties=h)}return e("_parseDisconnect result: true"),!0}_parseAuth(){e("_parseAuth");let n=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(n.reasonCode=this._parseByte(),!i.MQTT5_AUTH_CODES[n.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let h=this._parseProperties();return Object.getOwnPropertyNames(h).length&&(n.properties=h),e("_parseAuth: result: true"),!0}_parseMessageId(){let n=this.packet;return n.messageId=this._parseNum(),n.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(e("_parseMessageId: packet.messageId %d",n.messageId),!0)}_parseString(n){let h=this._parseNum(),d=h+this._pos;if(h===-1||d>this._list.length||d>this.packet.length)return null;let g=this._list.toString("utf8",this._pos,d);return this._pos+=h,e("_parseString: result: %s",g),g}_parseStringPair(){return e("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let n=this._parseNum(),h=n+this._pos;if(n===-1||h>this._list.length||h>this.packet.length)return null;let d=this._list.slice(this._pos,h);return this._pos+=n,e("_parseBuffer: result: %o",d),d}_parseNum(){if(this._list.length-this._pos<2)return-1;let n=this._list.readUInt16BE(this._pos);return this._pos+=2,e("_parseNum: result: %s",n),n}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let n=this._list.readUInt32BE(this._pos);return this._pos+=4,e("_parse4ByteNum: result: %s",n),n}_parseVarByteNum(n){e("_parseVarByteNum");let h=4,d=0,g=1,b=0,m=!1,v,_=this._pos?this._pos:0;for(;d<h&&_+d<this._list.length;){if(v=this._list.readUInt8(_+d++),b+=g*(v&i.VARBYTEINT_MASK),g*=128,!(v&i.VARBYTEINT_FIN_MASK)){m=!0;break}if(this._list.length<=d)break}return!m&&d===h&&this._list.length>=d&&this._emitError(new Error("Invalid variable byte integer")),_&&(this._pos+=d),m?n?m={bytes:d,value:b}:m=b:m=!1,e("_parseVarByteNum: result: %o",m),m}_parseByte(){let n;return this._pos<this._list.length&&(n=this._list.readUInt8(this._pos),this._pos++),e("_parseByte: result: %o",n),n}_parseByType(n){switch(e("_parseByType: type: %s",n),n){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(){e("_parseProperties");let n=this._parseVarByteNum(),h=this._pos+n,d={};for(;this._pos<h;){let g=this._parseByte();if(!g)return this._emitError(new Error("Cannot parse property code type")),!1;let b=i.propertiesCodes[g];if(!b)return this._emitError(new Error("Unknown property")),!1;if(b==="userProperties"){d[b]||(d[b]=Object.create(null));let m=this._parseByType(i.propertiesTypes[b]);if(d[b][m.name])if(Array.isArray(d[b][m.name]))d[b][m.name].push(m.value);else{let v=d[b][m.name];d[b][m.name]=[v],d[b][m.name].push(m.value)}else d[b][m.name]=m.value;continue}d[b]?Array.isArray(d[b])?d[b].push(this._parseByType(i.propertiesTypes[b])):(d[b]=[d[b]],d[b].push(this._parseByType(i.propertiesTypes[b]))):d[b]=this._parseByType(i.propertiesTypes[b])}return d}_newPacket(){return e("_newPacket"),this.packet&&(this._list.consume(this.packet.length),e("_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)),e("_newPacket: new packet"),this.packet=new c,this._pos=0,!0}_emitError(n){e("_emitError",n),this.error=n,this.emit("error",n)}};f.exports=r}),Va=be((s,f)=>{he(),fe(),ce();var{Buffer:o}=(Xe(),De(Je)),l=65536,c={},i=o.isBuffer(o.from([1,2]).subarray(0,1));function e(h){let d=o.allocUnsafe(2);return d.writeUInt8(h>>8,0),d.writeUInt8(h&255,1),d}function r(){for(let h=0;h<l;h++)c[h]=e(h)}function t(h){let d=0,g=0,b=o.allocUnsafe(4);do d=h%128|0,h=h/128|0,h>0&&(d=d|128),b.writeUInt8(d,g++);while(h>0&&g<4);return h>0&&(g=0),i?b.subarray(0,g):b.slice(0,g)}function n(h){let d=o.allocUnsafe(4);return d.writeUInt32BE(h,0),d}f.exports={cache:c,generateCache:r,generateNumber:e,genBufVariableByteInt:t,generate4ByteBuffer:n}}),Ha=be((s,f)=>{he(),fe(),ce(),typeof Le>"u"||!Le.version||Le.version.indexOf("v0.")===0||Le.version.indexOf("v1.")===0&&Le.version.indexOf("v1.8.")!==0?f.exports={nextTick:o}:f.exports=Le;function o(l,c,i,e){if(typeof l!="function")throw new TypeError('"callback" argument must be a function');var r=arguments.length,t,n;switch(r){case 0:case 1:return Le.nextTick(l);case 2:return Le.nextTick(function(){l.call(null,c)});case 3:return Le.nextTick(function(){l.call(null,c,i)});case 4:return Le.nextTick(function(){l.call(null,c,i,e)});default:for(t=new Array(r-1),n=0;n<t.length;)t[n++]=arguments[n];return Le.nextTick(function(){l.apply(null,t)})}}}),Qo=be((s,f)=>{he(),fe(),ce();var o=Ko(),{Buffer:l}=(Xe(),De(Je)),c=l.allocUnsafe(0),i=l.from([0]),e=Va(),r=Ha().nextTick,t=Tt()("mqtt-packet:writeToStream"),n=e.cache,h=e.generateNumber,d=e.generateCache,g=e.genBufVariableByteInt,b=e.generate4ByteBuffer,m=de,v=!0;function _(H,L,Z){switch(t("generate called"),L.cork&&(L.cork(),r(I,L)),v&&(v=!1,d()),t("generate: packet.cmd: %s",H.cmd),H.cmd){case"connect":return y(H,L);case"connack":return E(H,L,Z);case"publish":return N(H,L,Z);case"puback":case"pubrec":case"pubrel":case"pubcomp":return B(H,L,Z);case"subscribe":return S(H,L,Z);case"suback":return k(H,L,Z);case"unsubscribe":return M(H,L,Z);case"unsuback":return J(H,L,Z);case"pingreq":case"pingresp":return Y(H,L);case"disconnect":return se(H,L,Z);case"auth":return O(H,L,Z);default:return L.destroy(new Error("Unknown command")),!1}}Object.defineProperty(_,"cacheNumbers",{get(){return m===de},set(H){H?((!n||Object.keys(n).length===0)&&(v=!0),m=de):(v=!1,m=le)}});function I(H){H.uncork()}function y(H,L,Z){let q=H||{},$=q.protocolId||"MQTT",V=q.protocolVersion||4,ae=q.will,ne=q.clean,x=q.keepalive||0,U=q.clientId||"",Q=q.username,re=q.password,te=q.properties;ne===void 0&&(ne=!0);let ue=0;if(typeof $!="string"&&!l.isBuffer($))return L.destroy(new Error("Invalid protocolId")),!1;if(ue+=$.length+2,V!==3&&V!==4&&V!==5)return L.destroy(new Error("Invalid protocol version")),!1;if(ue+=1,(typeof U=="string"||l.isBuffer(U))&&(U||V>=4)&&(U||ne))ue+=l.byteLength(U)+2;else{if(V<4)return L.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(ne*1===0)return L.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof x!="number"||x<0||x>65535||x%1!==0)return L.destroy(new Error("Invalid keepalive")),!1;ue+=2,ue+=1;let D,oe;if(V===5){if(D=pe(L,te),!D)return!1;ue+=D.length}if(ae){if(typeof ae!="object")return L.destroy(new Error("Invalid will")),!1;if(!ae.topic||typeof ae.topic!="string")return L.destroy(new Error("Invalid will topic")),!1;if(ue+=l.byteLength(ae.topic)+2,ue+=2,ae.payload)if(ae.payload.length>=0)typeof ae.payload=="string"?ue+=l.byteLength(ae.payload):ue+=ae.payload.length;else return L.destroy(new Error("Invalid will payload")),!1;if(oe={},V===5){if(oe=pe(L,ae.properties),!oe)return!1;ue+=oe.length}}let me=!1;if(Q!=null)if(Ie(Q))me=!0,ue+=l.byteLength(Q)+2;else return L.destroy(new Error("Invalid username")),!1;if(re!=null){if(!me)return L.destroy(new Error("Username is required to use password")),!1;if(Ie(re))ue+=F(re)+2;else return L.destroy(new Error("Invalid password")),!1}L.write(o.CONNECT_HEADER),X(L,ue),z(L,$),q.bridgeMode&&(V+=128),L.write(V===131?o.VERSION131:V===132?o.VERSION132:V===4?o.VERSION4:V===5?o.VERSION5:o.VERSION3);let ee=0;return ee|=Q!=null?o.USERNAME_MASK:0,ee|=re!=null?o.PASSWORD_MASK:0,ee|=ae&&ae.retain?o.WILL_RETAIN_MASK:0,ee|=ae&&ae.qos?ae.qos<<o.WILL_QOS_SHIFT:0,ee|=ae?o.WILL_FLAG_MASK:0,ee|=ne?o.CLEAN_SESSION_MASK:0,L.write(l.from([ee])),m(L,x),V===5&&D.write(),z(L,U),ae&&(V===5&&oe.write(),W(L,ae.topic),z(L,ae.payload)),Q!=null&&z(L,Q),re!=null&&z(L,re),!0}function E(H,L,Z){let q=Z?Z.protocolVersion:4,$=H||{},V=q===5?$.reasonCode:$.returnCode,ae=$.properties,ne=2;if(typeof V!="number")return L.destroy(new Error("Invalid return code")),!1;let x=null;if(q===5){if(x=pe(L,ae),!x)return!1;ne+=x.length}return L.write(o.CONNACK_HEADER),X(L,ne),L.write($.sessionPresent?o.SESSIONPRESENT_HEADER:i),L.write(l.from([V])),x==null||x.write(),!0}function N(H,L,Z){t("publish: packet: %o",H);let q=Z?Z.protocolVersion:4,$=H||{},V=$.qos||0,ae=$.retain?o.RETAIN_MASK:0,ne=$.topic,x=$.payload||c,U=$.messageId,Q=$.properties,re=0;if(typeof ne=="string")re+=l.byteLength(ne)+2;else if(l.isBuffer(ne))re+=ne.length+2;else return L.destroy(new Error("Invalid topic")),!1;if(l.isBuffer(x)?re+=x.length:re+=l.byteLength(x),V&&typeof U!="number")return L.destroy(new Error("Invalid messageId")),!1;V&&(re+=2);let te=null;if(q===5){if(te=pe(L,Q),!te)return!1;re+=te.length}return L.write(o.PUBLISH_HEADER[V][$.dup?1:0][ae?1:0]),X(L,re),m(L,F(ne)),L.write(ne),V>0&&m(L,U),te==null||te.write(),t("publish: payload: %o",x),L.write(x)}function B(H,L,Z){let q=Z?Z.protocolVersion:4,$=H||{},V=$.cmd||"puback",ae=$.messageId,ne=$.dup&&V==="pubrel"?o.DUP_MASK:0,x=0,U=$.reasonCode,Q=$.properties,re=q===5?3:2;if(V==="pubrel"&&(x=1),typeof ae!="number")return L.destroy(new Error("Invalid messageId")),!1;let te=null;if(q===5&&typeof Q=="object"){if(te=R(L,Q,Z,re),!te)return!1;re+=te.length}return L.write(o.ACKS[V][x][ne][0]),re===3&&(re+=U!==0?1:-1),X(L,re),m(L,ae),q===5&&re!==2&&L.write(l.from([U])),te!==null?te.write():re===4&&L.write(l.from([0])),!0}function S(H,L,Z){t("subscribe: packet: ");let q=Z?Z.protocolVersion:4,$=H||{},V=$.dup?o.DUP_MASK:0,ae=$.messageId,ne=$.subscriptions,x=$.properties,U=0;if(typeof ae!="number")return L.destroy(new Error("Invalid messageId")),!1;U+=2;let Q=null;if(q===5){if(Q=pe(L,x),!Q)return!1;U+=Q.length}if(typeof ne=="object"&&ne.length)for(let te=0;te<ne.length;te+=1){let ue=ne[te].topic,D=ne[te].qos;if(typeof ue!="string")return L.destroy(new Error("Invalid subscriptions - invalid topic")),!1;if(typeof D!="number")return L.destroy(new Error("Invalid subscriptions - invalid qos")),!1;if(q===5){if(typeof(ne[te].nl||!1)!="boolean")return L.destroy(new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(ne[te].rap||!1)!="boolean")return L.destroy(new Error("Invalid subscriptions - invalid Retain as Published")),!1;let oe=ne[te].rh||0;if(typeof oe!="number"||oe>2)return L.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}U+=l.byteLength(ue)+2+1}else return L.destroy(new Error("Invalid subscriptions")),!1;t("subscribe: writing to stream: %o",o.SUBSCRIBE_HEADER),L.write(o.SUBSCRIBE_HEADER[1][V?1:0][0]),X(L,U),m(L,ae),Q!==null&&Q.write();let re=!0;for(let te of ne){let ue=te.topic,D=te.qos,oe=+te.nl,me=+te.rap,ee=te.rh,Pe;W(L,ue),Pe=o.SUBSCRIBE_OPTIONS_QOS[D],q===5&&(Pe|=oe?o.SUBSCRIBE_OPTIONS_NL:0,Pe|=me?o.SUBSCRIBE_OPTIONS_RAP:0,Pe|=ee?o.SUBSCRIBE_OPTIONS_RH[ee]:0),re=L.write(l.from([Pe]))}return re}function k(H,L,Z){let q=Z?Z.protocolVersion:4,$=H||{},V=$.messageId,ae=$.granted,ne=$.properties,x=0;if(typeof V!="number")return L.destroy(new Error("Invalid messageId")),!1;if(x+=2,typeof ae=="object"&&ae.length)for(let Q=0;Q<ae.length;Q+=1){if(typeof ae[Q]!="number")return L.destroy(new Error("Invalid qos vector")),!1;x+=1}else return L.destroy(new Error("Invalid qos vector")),!1;let U=null;if(q===5){if(U=R(L,ne,Z,x),!U)return!1;x+=U.length}return L.write(o.SUBACK_HEADER),X(L,x),m(L,V),U!==null&&U.write(),L.write(l.from(ae))}function M(H,L,Z){let q=Z?Z.protocolVersion:4,$=H||{},V=$.messageId,ae=$.dup?o.DUP_MASK:0,ne=$.unsubscriptions,x=$.properties,U=0;if(typeof V!="number")return L.destroy(new Error("Invalid messageId")),!1;if(U+=2,typeof ne=="object"&&ne.length)for(let te=0;te<ne.length;te+=1){if(typeof ne[te]!="string")return L.destroy(new Error("Invalid unsubscriptions")),!1;U+=l.byteLength(ne[te])+2}else return L.destroy(new Error("Invalid unsubscriptions")),!1;let Q=null;if(q===5){if(Q=pe(L,x),!Q)return!1;U+=Q.length}L.write(o.UNSUBSCRIBE_HEADER[1][ae?1:0][0]),X(L,U),m(L,V),Q!==null&&Q.write();let re=!0;for(let te=0;te<ne.length;te++)re=W(L,ne[te]);return re}function J(H,L,Z){let q=Z?Z.protocolVersion:4,$=H||{},V=$.messageId,ae=$.dup?o.DUP_MASK:0,ne=$.granted,x=$.properties,U=$.cmd,Q=0,re=2;if(typeof V!="number")return L.destroy(new Error("Invalid messageId")),!1;if(q===5)if(typeof ne=="object"&&ne.length)for(let ue=0;ue<ne.length;ue+=1){if(typeof ne[ue]!="number")return L.destroy(new Error("Invalid qos vector")),!1;re+=1}else return L.destroy(new Error("Invalid qos vector")),!1;let te=null;if(q===5){if(te=R(L,x,Z,re),!te)return!1;re+=te.length}return L.write(o.ACKS[U][Q][ae][0]),X(L,re),m(L,V),te!==null&&te.write(),q===5&&L.write(l.from(ne)),!0}function Y(H,L,Z){return L.write(o.EMPTY[H.cmd])}function se(H,L,Z){let q=Z?Z.protocolVersion:4,$=H||{},V=$.reasonCode,ae=$.properties,ne=q===5?1:0,x=null;if(q===5){if(x=R(L,ae,Z,ne),!x)return!1;ne+=x.length}return L.write(l.from([o.codes.disconnect<<4])),X(L,ne),q===5&&L.write(l.from([V])),x!==null&&x.write(),!0}function O(H,L,Z){let q=Z?Z.protocolVersion:4,$=H||{},V=$.reasonCode,ae=$.properties,ne=q===5?1:0;q!==5&&L.destroy(new Error("Invalid mqtt version for auth packet"));let x=R(L,ae,Z,ne);return x?(ne+=x.length,L.write(l.from([o.codes.auth<<4])),X(L,ne),L.write(l.from([V])),x!==null&&x.write(),!0):!1}var K={};function X(H,L){if(L>o.VARBYTEINT_MAX)return H.destroy(new Error(`Invalid variable byte integer: ${L}`)),!1;let Z=K[L];return Z||(Z=g(L),L<16384&&(K[L]=Z)),t("writeVarByteInt: writing to stream: %o",Z),H.write(Z)}function W(H,L){let Z=l.byteLength(L);return m(H,Z),t("writeString: %s",L),H.write(L,"utf8")}function ge(H,L,Z){W(H,L),W(H,Z)}function de(H,L){return t("writeNumberCached: number: %d",L),t("writeNumberCached: %o",n[L]),H.write(n[L])}function le(H,L){let Z=h(L);return t("writeNumberGenerated: %o",Z),H.write(Z)}function Ee(H,L){let Z=b(L);return t("write4ByteNumber: %o",Z),H.write(Z)}function z(H,L){typeof L=="string"?W(H,L):L?(m(H,L.length),H.write(L)):m(H,0)}function pe(H,L){if(typeof L!="object"||L.length!=null)return{length:1,write(){ye(H,{},0)}};let Z=0;function q($,V){let ae=o.propertiesTypes[$],ne=0;switch(ae){case"byte":{if(typeof V!="boolean")return H.destroy(new Error(`Invalid ${$}: ${V}`)),!1;ne+=2;break}case"int8":{if(typeof V!="number"||V<0||V>255)return H.destroy(new Error(`Invalid ${$}: ${V}`)),!1;ne+=2;break}case"binary":{if(V&&V===null)return H.destroy(new Error(`Invalid ${$}: ${V}`)),!1;ne+=1+l.byteLength(V)+2;break}case"int16":{if(typeof V!="number"||V<0||V>65535)return H.destroy(new Error(`Invalid ${$}: ${V}`)),!1;ne+=3;break}case"int32":{if(typeof V!="number"||V<0||V>4294967295)return H.destroy(new Error(`Invalid ${$}: ${V}`)),!1;ne+=5;break}case"var":{if(typeof V!="number"||V<0||V>268435455)return H.destroy(new Error(`Invalid ${$}: ${V}`)),!1;ne+=1+l.byteLength(g(V));break}case"string":{if(typeof V!="string")return H.destroy(new Error(`Invalid ${$}: ${V}`)),!1;ne+=3+l.byteLength(V.toString());break}case"pair":{if(typeof V!="object")return H.destroy(new Error(`Invalid ${$}: ${V}`)),!1;ne+=Object.getOwnPropertyNames(V).reduce((x,U)=>{let Q=V[U];return Array.isArray(Q)?x+=Q.reduce((re,te)=>(re+=3+l.byteLength(U.toString())+2+l.byteLength(te.toString()),re),0):x+=3+l.byteLength(U.toString())+2+l.byteLength(V[U].toString()),x},0);break}default:return H.destroy(new Error(`Invalid property ${$}: ${V}`)),!1}return ne}if(L)for(let $ in L){let V=0,ae=0,ne=L[$];if(Array.isArray(ne))for(let x=0;x<ne.length;x++){if(ae=q($,ne[x]),!ae)return!1;V+=ae}else{if(ae=q($,ne),!ae)return!1;V=ae}if(!V)return!1;Z+=V}return{length:l.byteLength(g(Z))+Z,write(){ye(H,L,Z)}}}function R(H,L,Z,q){let $=["reasonString","userProperties"],V=Z&&Z.properties&&Z.properties.maximumPacketSize?Z.properties.maximumPacketSize:0,ae=pe(H,L);if(V)for(;q+ae.length>V;){let ne=$.shift();if(ne&&L[ne])delete L[ne],ae=pe(H,L);else return!1}return ae}function ie(H,L,Z){switch(o.propertiesTypes[L]){case"byte":{H.write(l.from([o.properties[L]])),H.write(l.from([+Z]));break}case"int8":{H.write(l.from([o.properties[L]])),H.write(l.from([Z]));break}case"binary":{H.write(l.from([o.properties[L]])),z(H,Z);break}case"int16":{H.write(l.from([o.properties[L]])),m(H,Z);break}case"int32":{H.write(l.from([o.properties[L]])),Ee(H,Z);break}case"var":{H.write(l.from([o.properties[L]])),X(H,Z);break}case"string":{H.write(l.from([o.properties[L]])),W(H,Z);break}case"pair":{Object.getOwnPropertyNames(Z).forEach(q=>{let $=Z[q];Array.isArray($)?$.forEach(V=>{H.write(l.from([o.properties[L]])),ge(H,q.toString(),V.toString())}):(H.write(l.from([o.properties[L]])),ge(H,q.toString(),$.toString()))});break}default:return H.destroy(new Error(`Invalid property ${L} value: ${Z}`)),!1}}function ye(H,L,Z){X(H,Z);for(let q in L)if(Object.prototype.hasOwnProperty.call(L,q)&&L[q]!==null){let $=L[q];if(Array.isArray($))for(let V=0;V<$.length;V++)ie(H,q,$[V]);else ie(H,q,$)}}function F(H){return H?H instanceof l?H.length:l.byteLength(H):0}function Ie(H){return typeof H=="string"||H instanceof l}f.exports=_}),za=be((s,f)=>{he(),fe(),ce();var o=Qo(),{EventEmitter:l}=(Jt(),De(Ut)),{Buffer:c}=(Xe(),De(Je));function i(r,t){let n=new e;return o(r,n,t),n.concat()}var e=class extends l{constructor(){super(),this._array=new Array(20),this._i=0}write(r){return this._array[this._i++]=r,!0}concat(){let r=0,t=new Array(this._array.length),n=this._array,h=0,d;for(d=0;d<n.length&&n[d]!==void 0;d++)typeof n[d]!="string"?t[d]=n[d].length:t[d]=c.byteLength(n[d]),r+=t[d];let g=c.allocUnsafe(r);for(d=0;d<n.length&&n[d]!==void 0;d++)typeof n[d]!="string"?(n[d].copy(g,h),h+=t[d]):(g.write(n[d],h),h+=t[d]);return g}destroy(r){r&&this.emit("error",r)}};f.exports=i}),Ga=be(s=>{he(),fe(),ce(),s.parser=$a().parser,s.generate=za(),s.writeToStream=Qo()}),Yo=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0});var f=class{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let o=this.nextId++;return this.nextId===65536&&(this.nextId=1),o}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(o){return!0}deallocate(o){}clear(){}};s.default=f}),Ka=be((s,f)=>{he(),fe(),ce(),f.exports=l;function o(i){return i instanceof xr?xr.from(i):new i.constructor(i.buffer.slice(),i.byteOffset,i.length)}function l(i){if(i=i||{},i.circles)return c(i);let e=new Map;if(e.set(Date,d=>new Date(d)),e.set(Map,(d,g)=>new Map(t(Array.from(d),g))),e.set(Set,(d,g)=>new Set(t(Array.from(d),g))),i.constructorHandlers)for(let d of i.constructorHandlers)e.set(d[0],d[1]);let r=null;return i.proto?h:n;function t(d,g){let b=Object.keys(d),m=new Array(b.length);for(let v=0;v<b.length;v++){let _=b[v],I=d[_];typeof I!="object"||I===null?m[_]=I:I.constructor!==Object&&(r=e.get(I.constructor))?m[_]=r(I,g):ArrayBuffer.isView(I)?m[_]=o(I):m[_]=g(I)}return m}function n(d){if(typeof d!="object"||d===null)return d;if(Array.isArray(d))return t(d,n);if(d.constructor!==Object&&(r=e.get(d.constructor)))return r(d,n);let g={};for(let b in d){if(Object.hasOwnProperty.call(d,b)===!1)continue;let m=d[b];typeof m!="object"||m===null?g[b]=m:m.constructor!==Object&&(r=e.get(m.constructor))?g[b]=r(m,n):ArrayBuffer.isView(m)?g[b]=o(m):g[b]=n(m)}return g}function h(d){if(typeof d!="object"||d===null)return d;if(Array.isArray(d))return t(d,h);if(d.constructor!==Object&&(r=e.get(d.constructor)))return r(d,h);let g={};for(let b in d){let m=d[b];typeof m!="object"||m===null?g[b]=m:m.constructor!==Object&&(r=e.get(m.constructor))?g[b]=r(m,h):ArrayBuffer.isView(m)?g[b]=o(m):g[b]=h(m)}return g}}function c(i){let e=[],r=[],t=new Map;if(t.set(Date,b=>new Date(b)),t.set(Map,(b,m)=>new Map(h(Array.from(b),m))),t.set(Set,(b,m)=>new Set(h(Array.from(b),m))),i.constructorHandlers)for(let b of i.constructorHandlers)t.set(b[0],b[1]);let n=null;return i.proto?g:d;function h(b,m){let v=Object.keys(b),_=new Array(v.length);for(let I=0;I<v.length;I++){let y=v[I],E=b[y];if(typeof E!="object"||E===null)_[y]=E;else if(E.constructor!==Object&&(n=t.get(E.constructor)))_[y]=n(E,m);else if(ArrayBuffer.isView(E))_[y]=o(E);else{let N=e.indexOf(E);N!==-1?_[y]=r[N]:_[y]=m(E)}}return _}function d(b){if(typeof b!="object"||b===null)return b;if(Array.isArray(b))return h(b,d);if(b.constructor!==Object&&(n=t.get(b.constructor)))return n(b,d);let m={};e.push(b),r.push(m);for(let v in b){if(Object.hasOwnProperty.call(b,v)===!1)continue;let _=b[v];if(typeof _!="object"||_===null)m[v]=_;else if(_.constructor!==Object&&(n=t.get(_.constructor)))m[v]=n(_,d);else if(ArrayBuffer.isView(_))m[v]=o(_);else{let I=e.indexOf(_);I!==-1?m[v]=r[I]:m[v]=d(_)}}return e.pop(),r.pop(),m}function g(b){if(typeof b!="object"||b===null)return b;if(Array.isArray(b))return h(b,g);if(b.constructor!==Object&&(n=t.get(b.constructor)))return n(b,g);let m={};e.push(b),r.push(m);for(let v in b){let _=b[v];if(typeof _!="object"||_===null)m[v]=_;else if(_.constructor!==Object&&(n=t.get(_.constructor)))m[v]=n(_,g);else if(ArrayBuffer.isView(_))m[v]=o(_);else{let I=e.indexOf(_);I!==-1?m[v]=r[I]:m[v]=g(_)}}return e.pop(),r.pop(),m}}}),Qa=be((s,f)=>{he(),fe(),ce(),f.exports=Ka()()}),Ya=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0}),s.validateTopic=f,s.validateTopics=o;function f(l){let c=l.split("/");for(let i=0;i<c.length;i++)if(c[i]!=="+"){if(c[i]==="#")return i===c.length-1;if(c[i].indexOf("+")!==-1||c[i].indexOf("#")!==-1)return!1}return!0}function o(l){if(l.length===0)return"empty_topic_list";for(let c=0;c<l.length;c++)if(!f(l[c]))return l[c];return null}}),Jo=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0});var f=Zt(),o={objectMode:!0},l={clean:!0},c=class{constructor(i){this.options=i||{},this.options=Object.assign(Object.assign({},l),i),this._inflights=new Map}put(i,e){return this._inflights.set(i.messageId,i),e&&e(),this}createStream(){let i=new f.Readable(o),e=[],r=!1,t=0;return this._inflights.forEach((n,h)=>{e.push(n)}),i._read=()=>{!r&&t<e.length?i.push(e[t++]):i.push(null)},i.destroy=n=>{if(!r)return r=!0,setTimeout(()=>{i.emit("close")},0),i},i}del(i,e){let r=this._inflights.get(i.messageId);return r?(this._inflights.delete(i.messageId),e(null,r)):e&&e(new Error("missing packet")),this}get(i,e){let r=this._inflights.get(i.messageId);return r?e(null,r):e&&e(new Error("missing packet")),this}close(i){this.options.clean&&(this._inflights=null),i&&i()}};s.default=c}),Ja=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0});var f=[0,16,128,131,135,144,145,151,153],o=(l,c,i)=>{l.log("handlePublish: packet %o",c),i=typeof i<"u"?i:l.noop;let e=c.topic.toString(),r=c.payload,{qos:t}=c,{messageId:n}=c,{options:h}=l;if(l.options.protocolVersion===5){let d;if(c.properties&&(d=c.properties.topicAlias),typeof d<"u")if(e.length===0)if(d>0&&d<=65535){let g=l.topicAliasRecv.getTopicByAlias(d);if(g)e=g,l.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",e,d);else{l.log("handlePublish :: unregistered topic alias. alias: %d",d),l.emit("error",new Error("Received unregistered Topic Alias"));return}}else{l.log("handlePublish :: topic alias out of range. alias: %d",d),l.emit("error",new Error("Received Topic Alias is out of range"));return}else if(l.topicAliasRecv.put(e,d))l.log("handlePublish :: registered topic: %s - alias: %d",e,d);else{l.log("handlePublish :: topic alias out of range. alias: %d",d),l.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(l.log("handlePublish: qos %d",t),t){case 2:{h.customHandleAcks(e,r,c,(d,g)=>{if(typeof d=="number"&&(g=d,d=null),d)return l.emit("error",d);if(f.indexOf(g)===-1)return l.emit("error",new Error("Wrong reason code for pubrec"));g?l._sendPacket({cmd:"pubrec",messageId:n,reasonCode:g},i):l.incomingStore.put(c,()=>{l._sendPacket({cmd:"pubrec",messageId:n},i)})});break}case 1:{h.customHandleAcks(e,r,c,(d,g)=>{if(typeof d=="number"&&(g=d,d=null),d)return l.emit("error",d);if(f.indexOf(g)===-1)return l.emit("error",new Error("Wrong reason code for puback"));g||l.emit("message",e,r,c),l.handleMessage(c,b=>{if(b)return i&&i(b);l._sendPacket({cmd:"puback",messageId:n,reasonCode:g},i)})});break}case 0:l.emit("message",e,r,c),l.handleMessage(c,i);break;default:l.log("handlePublish: unknown QoS. Doing nothing.");break}};s.default=o}),Xa=be((s,f)=>{f.exports={version:"5.10.4"}}),or=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0}),s.MQTTJS_VERSION=s.nextTick=s.ErrorWithReasonCode=void 0,s.applyMixin=o;var f=class Xo extends Error{constructor(c,i){super(c),this.code=i,Object.setPrototypeOf(this,Xo.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}};s.ErrorWithReasonCode=f;function o(l,c,i=!1){var e;let r=[c];for(;;){let t=r[0],n=Object.getPrototypeOf(t);if(n!=null&&n.prototype)r.unshift(n);else break}for(let t of r)for(let n of Object.getOwnPropertyNames(t.prototype))(i||n!=="constructor")&&Object.defineProperty(l.prototype,n,(e=Object.getOwnPropertyDescriptor(t.prototype,n))!==null&&e!==void 0?e:Object.create(null))}s.nextTick=typeof(Le==null?void 0:Le.nextTick)=="function"?Le.nextTick:l=>{setTimeout(l,0)},s.MQTTJS_VERSION=Xa().version}),Ur=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0}),s.ReasonCodes=void 0;var f=or();s.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 o=(l,c)=>{let{messageId:i}=c,e=c.cmd,r=null,t=l.outgoing[i]?l.outgoing[i].cb:null,n=null;if(!t){l.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(l.log("_handleAck :: packet type",e),e){case"pubcomp":case"puback":{let h=c.reasonCode;h&&h>0&&h!==16?(n=new f.ErrorWithReasonCode(`Publish error: ${s.ReasonCodes[h]}`,h),l._removeOutgoingAndStoreMessage(i,()=>{t(n,c)})):l._removeOutgoingAndStoreMessage(i,t);break}case"pubrec":{r={cmd:"pubrel",qos:2,messageId:i};let h=c.reasonCode;h&&h>0&&h!==16?(n=new f.ErrorWithReasonCode(`Publish error: ${s.ReasonCodes[h]}`,h),l._removeOutgoingAndStoreMessage(i,()=>{t(n,c)})):l._sendPacket(r);break}case"suback":{delete l.outgoing[i],l.messageIdProvider.deallocate(i);let h=c.granted;for(let d=0;d<h.length;d++){let g=h[d];if(g&128){n=new Error(`Subscribe error: ${s.ReasonCodes[g]}`),n.code=g;let b=l.messageIdToTopic[i];b&&b.forEach(m=>{delete l._resubscribeTopics[m]})}}delete l.messageIdToTopic[i],l._invokeStoreProcessingQueue(),t(n,c);break}case"unsuback":{delete l.outgoing[i],l.messageIdProvider.deallocate(i),l._invokeStoreProcessingQueue(),t(null,c);break}default:l.emit("error",new Error("unrecognized packet type"))}l.disconnecting&&Object.keys(l.outgoing).length===0&&l.emit("outgoingEmpty")};s.default=o}),Za=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0});var f=or(),o=Ur(),l=(c,i)=>{let{options:e}=c,r=e.protocolVersion,t=r===5?i.reasonCode:i.returnCode;if(r!==5){let n=new f.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${r}`,t);c.emit("error",n);return}c.handleAuth(i,(n,h)=>{if(n){c.emit("error",n);return}if(t===24)c.reconnecting=!1,c._sendPacket(h);else{let d=new f.ErrorWithReasonCode(`Connection refused: ${o.ReasonCodes[t]}`,t);c.emit("error",d)}})};s.default=l}),el=be(s=>{var b,m,v,_,I,y,E,N,B,S,k,M,J,Y,se,O,K,X,W,ge,de,le,Ee,z,pe,R,ie,ye,F,pn,H,L,Z,q,Zo,V,ae,ne,Mt,Nt,gn,Tr,Cr,We,bn,hr,Lt,mn,Pe;he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0}),s.LRUCache=void 0;var f=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,o=new Set,l=typeof Le=="object"&&Le?Le:{},c=(a,u,p,w)=>{typeof l.emitWarning=="function"?l.emitWarning(a,u,p,w):console.error(`[${p}] ${u}: ${a}`)},i=globalThis.AbortController,e=globalThis.AbortSignal;if(typeof i>"u"){e=class{constructor(){Ne(this,"onabort");Ne(this,"_onabort",[]);Ne(this,"reason");Ne(this,"aborted",!1)}addEventListener(p,w){this._onabort.push(w)}},i=class{constructor(){Ne(this,"signal",new e);u()}abort(p){var w,T;if(!this.signal.aborted){this.signal.reason=p,this.signal.aborted=!0;for(let j of this.signal._onabort)j(p);(T=(w=this.signal).onabort)==null||T.call(w,p)}}};let a=((b=l.env)==null?void 0:b.LRU_CACHE_IGNORE_AC_WARNING)!=="1",u=()=>{a&&(a=!1,c("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",u))}}var r=a=>!o.has(a),t=a=>a&&a===Math.floor(a)&&a>0&&isFinite(a),n=a=>t(a)?a<=Math.pow(2,8)?Uint8Array:a<=Math.pow(2,16)?Uint16Array:a<=Math.pow(2,32)?Uint32Array:a<=Number.MAX_SAFE_INTEGER?h:null:null,h=class extends Array{constructor(a){super(a),this.fill(0)}},d=(m=class{constructor(u,p){Ne(this,"heap");Ne(this,"length");if(!C(m,v))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new p(u),this.length=0}static create(u){let p=n(u);if(!p)return[];Ce(m,v,!0);let w=new m(u,p);return Ce(m,v,!1),w}push(u){this.heap[this.length++]=u}pop(){return this.heap[--this.length]}},v=new WeakMap,Be(m,v,!1),m),g=(Pe=class{constructor(u){Be(this,F);Be(this,y);Be(this,E);Be(this,N);Be(this,B);Be(this,S);Be(this,k);Ne(this,"ttl");Ne(this,"ttlResolution");Ne(this,"ttlAutopurge");Ne(this,"updateAgeOnGet");Ne(this,"updateAgeOnHas");Ne(this,"allowStale");Ne(this,"noDisposeOnSet");Ne(this,"noUpdateTTL");Ne(this,"maxEntrySize");Ne(this,"sizeCalculation");Ne(this,"noDeleteOnFetchRejection");Ne(this,"noDeleteOnStaleGet");Ne(this,"allowStaleOnFetchAbort");Ne(this,"allowStaleOnFetchRejection");Ne(this,"ignoreFetchAbort");Be(this,M);Be(this,J);Be(this,Y);Be(this,se);Be(this,O);Be(this,K);Be(this,X);Be(this,W);Be(this,ge);Be(this,de);Be(this,le);Be(this,Ee);Be(this,z);Be(this,pe);Be(this,R);Be(this,ie);Be(this,ye);Be(this,H,()=>{});Be(this,L,()=>{});Be(this,Z,()=>{});Be(this,q,()=>!1);Be(this,V,u=>{});Be(this,ae,(u,p,w)=>{});Be(this,ne,(u,p,w,T)=>{if(w||T)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});Ne(this,_,"LRUCache");let{max:p=0,ttl:w,ttlResolution:T=1,ttlAutopurge:j,updateAgeOnGet:G,updateAgeOnHas:_e,allowStale:we,dispose:Te,disposeAfter:xe,noDisposeOnSet:Oe,noUpdateTTL:gt,maxSize:st=0,maxEntrySize:lt=0,sizeCalculation:qe,fetchMethod:Ye,memoMethod:Re,noDeleteOnFetchRejection:Fe,noDeleteOnStaleGet:et,allowStaleOnFetchRejection:Qe,allowStaleOnFetchAbort:it,ignoreFetchAbort:Rt}=u;if(p!==0&&!t(p))throw new TypeError("max option must be a nonnegative integer");let A=p?n(p):Array;if(!A)throw new Error("invalid max value: "+p);if(Ce(this,y,p),Ce(this,E,st),this.maxEntrySize=lt||C(this,E),this.sizeCalculation=qe,this.sizeCalculation){if(!C(this,E)&&!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(Re!==void 0&&typeof Re!="function")throw new TypeError("memoMethod must be a function if defined");if(Ce(this,k,Re),Ye!==void 0&&typeof Ye!="function")throw new TypeError("fetchMethod must be a function if specified");if(Ce(this,S,Ye),Ce(this,ie,!!Ye),Ce(this,Y,new Map),Ce(this,se,new Array(p).fill(void 0)),Ce(this,O,new Array(p).fill(void 0)),Ce(this,K,new A(p)),Ce(this,X,new A(p)),Ce(this,W,0),Ce(this,ge,0),Ce(this,de,d.create(p)),Ce(this,M,0),Ce(this,J,0),typeof Te=="function"&&Ce(this,N,Te),typeof xe=="function"?(Ce(this,B,xe),Ce(this,le,[])):(Ce(this,B,void 0),Ce(this,le,void 0)),Ce(this,R,!!C(this,N)),Ce(this,ye,!!C(this,B)),this.noDisposeOnSet=!!Oe,this.noUpdateTTL=!!gt,this.noDeleteOnFetchRejection=!!Fe,this.allowStaleOnFetchRejection=!!Qe,this.allowStaleOnFetchAbort=!!it,this.ignoreFetchAbort=!!Rt,this.maxEntrySize!==0){if(C(this,E)!==0&&!t(C(this,E)))throw new TypeError("maxSize must be a positive integer if specified");if(!t(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Ae(this,F,Zo).call(this)}if(this.allowStale=!!we,this.noDeleteOnStaleGet=!!et,this.updateAgeOnGet=!!G,this.updateAgeOnHas=!!_e,this.ttlResolution=t(T)||T===0?T:1,this.ttlAutopurge=!!j,this.ttl=w||0,this.ttl){if(!t(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Ae(this,F,pn).call(this)}if(C(this,y)===0&&this.ttl===0&&C(this,E)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!C(this,y)&&!C(this,E)){let P="LRU_CACHE_UNBOUNDED";r(P)&&(o.add(P),c("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",P,Pe))}}static unsafeExposeInternals(u){return{starts:C(u,z),ttls:C(u,pe),sizes:C(u,Ee),keyMap:C(u,Y),keyList:C(u,se),valList:C(u,O),next:C(u,K),prev:C(u,X),get head(){return C(u,W)},get tail(){return C(u,ge)},free:C(u,de),isBackgroundFetch:p=>{var w;return Ae(w=u,F,We).call(w,p)},backgroundFetch:(p,w,T,j)=>{var G;return Ae(G=u,F,Cr).call(G,p,w,T,j)},moveToTail:p=>{var w;return Ae(w=u,F,hr).call(w,p)},indexes:p=>{var w;return Ae(w=u,F,Mt).call(w,p)},rindexes:p=>{var w;return Ae(w=u,F,Nt).call(w,p)},isStale:p=>{var w;return C(w=u,q).call(w,p)}}}get max(){return C(this,y)}get maxSize(){return C(this,E)}get calculatedSize(){return C(this,J)}get size(){return C(this,M)}get fetchMethod(){return C(this,S)}get memoMethod(){return C(this,k)}get dispose(){return C(this,N)}get disposeAfter(){return C(this,B)}getRemainingTTL(u){return C(this,Y).has(u)?1/0:0}*entries(){for(let u of Ae(this,F,Mt).call(this))C(this,O)[u]!==void 0&&C(this,se)[u]!==void 0&&!Ae(this,F,We).call(this,C(this,O)[u])&&(yield[C(this,se)[u],C(this,O)[u]])}*rentries(){for(let u of Ae(this,F,Nt).call(this))C(this,O)[u]!==void 0&&C(this,se)[u]!==void 0&&!Ae(this,F,We).call(this,C(this,O)[u])&&(yield[C(this,se)[u],C(this,O)[u]])}*keys(){for(let u of Ae(this,F,Mt).call(this)){let p=C(this,se)[u];p!==void 0&&!Ae(this,F,We).call(this,C(this,O)[u])&&(yield p)}}*rkeys(){for(let u of Ae(this,F,Nt).call(this)){let p=C(this,se)[u];p!==void 0&&!Ae(this,F,We).call(this,C(this,O)[u])&&(yield p)}}*values(){for(let u of Ae(this,F,Mt).call(this))C(this,O)[u]!==void 0&&!Ae(this,F,We).call(this,C(this,O)[u])&&(yield C(this,O)[u])}*rvalues(){for(let u of Ae(this,F,Nt).call(this))C(this,O)[u]!==void 0&&!Ae(this,F,We).call(this,C(this,O)[u])&&(yield C(this,O)[u])}[(I=Symbol.iterator,_=Symbol.toStringTag,I)](){return this.entries()}find(u,p={}){for(let w of Ae(this,F,Mt).call(this)){let T=C(this,O)[w],j=Ae(this,F,We).call(this,T)?T.__staleWhileFetching:T;if(j!==void 0&&u(j,C(this,se)[w],this))return this.get(C(this,se)[w],p)}}forEach(u,p=this){for(let w of Ae(this,F,Mt).call(this)){let T=C(this,O)[w],j=Ae(this,F,We).call(this,T)?T.__staleWhileFetching:T;j!==void 0&&u.call(p,j,C(this,se)[w],this)}}rforEach(u,p=this){for(let w of Ae(this,F,Nt).call(this)){let T=C(this,O)[w],j=Ae(this,F,We).call(this,T)?T.__staleWhileFetching:T;j!==void 0&&u.call(p,j,C(this,se)[w],this)}}purgeStale(){let u=!1;for(let p of Ae(this,F,Nt).call(this,{allowStale:!0}))C(this,q).call(this,p)&&(Ae(this,F,Lt).call(this,C(this,se)[p],"expire"),u=!0);return u}info(u){let p=C(this,Y).get(u);if(p===void 0)return;let w=C(this,O)[p],T=Ae(this,F,We).call(this,w)?w.__staleWhileFetching:w;if(T===void 0)return;let j={value:T};if(C(this,pe)&&C(this,z)){let G=C(this,pe)[p],_e=C(this,z)[p];if(G&&_e){let we=G-(f.now()-_e);j.ttl=we,j.start=Date.now()}}return C(this,Ee)&&(j.size=C(this,Ee)[p]),j}dump(){let u=[];for(let p of Ae(this,F,Mt).call(this,{allowStale:!0})){let w=C(this,se)[p],T=C(this,O)[p],j=Ae(this,F,We).call(this,T)?T.__staleWhileFetching:T;if(j===void 0||w===void 0)continue;let G={value:j};if(C(this,pe)&&C(this,z)){G.ttl=C(this,pe)[p];let _e=f.now()-C(this,z)[p];G.start=Math.floor(Date.now()-_e)}C(this,Ee)&&(G.size=C(this,Ee)[p]),u.unshift([w,G])}return u}load(u){this.clear();for(let[p,w]of u){if(w.start){let T=Date.now()-w.start;w.start=f.now()-T}this.set(p,w.value,w)}}set(u,p,w={}){var gt,st,lt,qe,Ye;if(p===void 0)return this.delete(u),this;let{ttl:T=this.ttl,start:j,noDisposeOnSet:G=this.noDisposeOnSet,sizeCalculation:_e=this.sizeCalculation,status:we}=w,{noUpdateTTL:Te=this.noUpdateTTL}=w,xe=C(this,ne).call(this,u,p,w.size||0,_e);if(this.maxEntrySize&&xe>this.maxEntrySize)return we&&(we.set="miss",we.maxEntrySizeExceeded=!0),Ae(this,F,Lt).call(this,u,"set"),this;let Oe=C(this,M)===0?void 0:C(this,Y).get(u);if(Oe===void 0)Oe=C(this,M)===0?C(this,ge):C(this,de).length!==0?C(this,de).pop():C(this,M)===C(this,y)?Ae(this,F,Tr).call(this,!1):C(this,M),C(this,se)[Oe]=u,C(this,O)[Oe]=p,C(this,Y).set(u,Oe),C(this,K)[C(this,ge)]=Oe,C(this,X)[Oe]=C(this,ge),Ce(this,ge,Oe),gr(this,M)._++,C(this,ae).call(this,Oe,xe,we),we&&(we.set="add"),Te=!1;else{Ae(this,F,hr).call(this,Oe);let Re=C(this,O)[Oe];if(p!==Re){if(C(this,ie)&&Ae(this,F,We).call(this,Re)){Re.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Fe}=Re;Fe!==void 0&&!G&&(C(this,R)&&((gt=C(this,N))==null||gt.call(this,Fe,u,"set")),C(this,ye)&&((st=C(this,le))==null||st.push([Fe,u,"set"])))}else G||(C(this,R)&&((lt=C(this,N))==null||lt.call(this,Re,u,"set")),C(this,ye)&&((qe=C(this,le))==null||qe.push([Re,u,"set"])));if(C(this,V).call(this,Oe),C(this,ae).call(this,Oe,xe,we),C(this,O)[Oe]=p,we){we.set="replace";let Fe=Re&&Ae(this,F,We).call(this,Re)?Re.__staleWhileFetching:Re;Fe!==void 0&&(we.oldValue=Fe)}}else we&&(we.set="update")}if(T!==0&&!C(this,pe)&&Ae(this,F,pn).call(this),C(this,pe)&&(Te||C(this,Z).call(this,Oe,T,j),we&&C(this,L).call(this,we,Oe)),!G&&C(this,ye)&&C(this,le)){let Re=C(this,le),Fe;for(;Fe=Re==null?void 0:Re.shift();)(Ye=C(this,B))==null||Ye.call(this,...Fe)}return this}pop(){var u;try{for(;C(this,M);){let p=C(this,O)[C(this,W)];if(Ae(this,F,Tr).call(this,!0),Ae(this,F,We).call(this,p)){if(p.__staleWhileFetching)return p.__staleWhileFetching}else if(p!==void 0)return p}}finally{if(C(this,ye)&&C(this,le)){let p=C(this,le),w;for(;w=p==null?void 0:p.shift();)(u=C(this,B))==null||u.call(this,...w)}}}has(u,p={}){let{updateAgeOnHas:w=this.updateAgeOnHas,status:T}=p,j=C(this,Y).get(u);if(j!==void 0){let G=C(this,O)[j];if(Ae(this,F,We).call(this,G)&&G.__staleWhileFetching===void 0)return!1;if(C(this,q).call(this,j))T&&(T.has="stale",C(this,L).call(this,T,j));else return w&&C(this,H).call(this,j),T&&(T.has="hit",C(this,L).call(this,T,j)),!0}else T&&(T.has="miss");return!1}peek(u,p={}){let{allowStale:w=this.allowStale}=p,T=C(this,Y).get(u);if(T===void 0||!w&&C(this,q).call(this,T))return;let j=C(this,O)[T];return Ae(this,F,We).call(this,j)?j.__staleWhileFetching:j}async fetch(u,p={}){let{allowStale:w=this.allowStale,updateAgeOnGet:T=this.updateAgeOnGet,noDeleteOnStaleGet:j=this.noDeleteOnStaleGet,ttl:G=this.ttl,noDisposeOnSet:_e=this.noDisposeOnSet,size:we=0,sizeCalculation:Te=this.sizeCalculation,noUpdateTTL:xe=this.noUpdateTTL,noDeleteOnFetchRejection:Oe=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:gt=this.allowStaleOnFetchRejection,ignoreFetchAbort:st=this.ignoreFetchAbort,allowStaleOnFetchAbort:lt=this.allowStaleOnFetchAbort,context:qe,forceRefresh:Ye=!1,status:Re,signal:Fe}=p;if(!C(this,ie))return Re&&(Re.fetch="get"),this.get(u,{allowStale:w,updateAgeOnGet:T,noDeleteOnStaleGet:j,status:Re});let et={allowStale:w,updateAgeOnGet:T,noDeleteOnStaleGet:j,ttl:G,noDisposeOnSet:_e,size:we,sizeCalculation:Te,noUpdateTTL:xe,noDeleteOnFetchRejection:Oe,allowStaleOnFetchRejection:gt,allowStaleOnFetchAbort:lt,ignoreFetchAbort:st,status:Re,signal:Fe},Qe=C(this,Y).get(u);if(Qe===void 0){Re&&(Re.fetch="miss");let it=Ae(this,F,Cr).call(this,u,Qe,et,qe);return it.__returned=it}else{let it=C(this,O)[Qe];if(Ae(this,F,We).call(this,it)){let ve=w&&it.__staleWhileFetching!==void 0;return Re&&(Re.fetch="inflight",ve&&(Re.returnedStale=!0)),ve?it.__staleWhileFetching:it.__returned=it}let Rt=C(this,q).call(this,Qe);if(!Ye&&!Rt)return Re&&(Re.fetch="hit"),Ae(this,F,hr).call(this,Qe),T&&C(this,H).call(this,Qe),Re&&C(this,L).call(this,Re,Qe),it;let A=Ae(this,F,Cr).call(this,u,Qe,et,qe),P=A.__staleWhileFetching!==void 0&&w;return Re&&(Re.fetch=Rt?"stale":"refresh",P&&Rt&&(Re.returnedStale=!0)),P?A.__staleWhileFetching:A.__returned=A}}async forceFetch(u,p={}){let w=await this.fetch(u,p);if(w===void 0)throw new Error("fetch() returned undefined");return w}memo(u,p={}){let w=C(this,k);if(!w)throw new Error("no memoMethod provided to constructor");let{context:T,forceRefresh:j,...G}=p,_e=this.get(u,G);if(!j&&_e!==void 0)return _e;let we=w(u,_e,{options:G,context:T});return this.set(u,we,G),we}get(u,p={}){let{allowStale:w=this.allowStale,updateAgeOnGet:T=this.updateAgeOnGet,noDeleteOnStaleGet:j=this.noDeleteOnStaleGet,status:G}=p,_e=C(this,Y).get(u);if(_e!==void 0){let we=C(this,O)[_e],Te=Ae(this,F,We).call(this,we);return G&&C(this,L).call(this,G,_e),C(this,q).call(this,_e)?(G&&(G.get="stale"),Te?(G&&w&&we.__staleWhileFetching!==void 0&&(G.returnedStale=!0),w?we.__staleWhileFetching:void 0):(j||Ae(this,F,Lt).call(this,u,"expire"),G&&w&&(G.returnedStale=!0),w?we:void 0)):(G&&(G.get="hit"),Te?we.__staleWhileFetching:(Ae(this,F,hr).call(this,_e),T&&C(this,H).call(this,_e),we))}else G&&(G.get="miss")}delete(u){return Ae(this,F,Lt).call(this,u,"delete")}clear(){return Ae(this,F,mn).call(this,"delete")}},y=new WeakMap,E=new WeakMap,N=new WeakMap,B=new WeakMap,S=new WeakMap,k=new WeakMap,M=new WeakMap,J=new WeakMap,Y=new WeakMap,se=new WeakMap,O=new WeakMap,K=new WeakMap,X=new WeakMap,W=new WeakMap,ge=new WeakMap,de=new WeakMap,le=new WeakMap,Ee=new WeakMap,z=new WeakMap,pe=new WeakMap,R=new WeakMap,ie=new WeakMap,ye=new WeakMap,F=new WeakSet,pn=function(){let u=new h(C(this,y)),p=new h(C(this,y));Ce(this,pe,u),Ce(this,z,p),Ce(this,Z,(j,G,_e=f.now())=>{if(p[j]=G!==0?_e:0,u[j]=G,G!==0&&this.ttlAutopurge){let we=setTimeout(()=>{C(this,q).call(this,j)&&Ae(this,F,Lt).call(this,C(this,se)[j],"expire")},G+1);we.unref&&we.unref()}}),Ce(this,H,j=>{p[j]=u[j]!==0?f.now():0}),Ce(this,L,(j,G)=>{if(u[G]){let _e=u[G],we=p[G];if(!_e||!we)return;j.ttl=_e,j.start=we,j.now=w||T();let Te=j.now-we;j.remainingTTL=_e-Te}});let w=0,T=()=>{let j=f.now();if(this.ttlResolution>0){w=j;let G=setTimeout(()=>w=0,this.ttlResolution);G.unref&&G.unref()}return j};this.getRemainingTTL=j=>{let G=C(this,Y).get(j);if(G===void 0)return 0;let _e=u[G],we=p[G];if(!_e||!we)return 1/0;let Te=(w||T())-we;return _e-Te},Ce(this,q,j=>{let G=p[j],_e=u[j];return!!_e&&!!G&&(w||T())-G>_e})},H=new WeakMap,L=new WeakMap,Z=new WeakMap,q=new WeakMap,Zo=function(){let u=new h(C(this,y));Ce(this,J,0),Ce(this,Ee,u),Ce(this,V,p=>{Ce(this,J,C(this,J)-u[p]),u[p]=0}),Ce(this,ne,(p,w,T,j)=>{if(Ae(this,F,We).call(this,w))return 0;if(!t(T))if(j){if(typeof j!="function")throw new TypeError("sizeCalculation must be a function");if(T=j(w,p),!t(T))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 T}),Ce(this,ae,(p,w,T)=>{if(u[p]=w,C(this,E)){let j=C(this,E)-u[p];for(;C(this,J)>j;)Ae(this,F,Tr).call(this,!0)}Ce(this,J,C(this,J)+u[p]),T&&(T.entrySize=w,T.totalCalculatedSize=C(this,J))})},V=new WeakMap,ae=new WeakMap,ne=new WeakMap,Mt=function*({allowStale:u=this.allowStale}={}){if(C(this,M))for(let p=C(this,ge);!(!Ae(this,F,gn).call(this,p)||((u||!C(this,q).call(this,p))&&(yield p),p===C(this,W)));)p=C(this,X)[p]},Nt=function*({allowStale:u=this.allowStale}={}){if(C(this,M))for(let p=C(this,W);!(!Ae(this,F,gn).call(this,p)||((u||!C(this,q).call(this,p))&&(yield p),p===C(this,ge)));)p=C(this,K)[p]},gn=function(u){return u!==void 0&&C(this,Y).get(C(this,se)[u])===u},Tr=function(u){var j,G;let p=C(this,W),w=C(this,se)[p],T=C(this,O)[p];return C(this,ie)&&Ae(this,F,We).call(this,T)?T.__abortController.abort(new Error("evicted")):(C(this,R)||C(this,ye))&&(C(this,R)&&((j=C(this,N))==null||j.call(this,T,w,"evict")),C(this,ye)&&((G=C(this,le))==null||G.push([T,w,"evict"]))),C(this,V).call(this,p),u&&(C(this,se)[p]=void 0,C(this,O)[p]=void 0,C(this,de).push(p)),C(this,M)===1?(Ce(this,W,Ce(this,ge,0)),C(this,de).length=0):Ce(this,W,C(this,K)[p]),C(this,Y).delete(w),gr(this,M)._--,p},Cr=function(u,p,w,T){let j=p===void 0?void 0:C(this,O)[p];if(Ae(this,F,We).call(this,j))return j;let G=new i,{signal:_e}=w;_e==null||_e.addEventListener("abort",()=>G.abort(_e.reason),{signal:G.signal});let we={signal:G.signal,options:w,context:T},Te=(qe,Ye=!1)=>{let{aborted:Re}=G.signal,Fe=w.ignoreFetchAbort&&qe!==void 0;if(w.status&&(Re&&!Ye?(w.status.fetchAborted=!0,w.status.fetchError=G.signal.reason,Fe&&(w.status.fetchAbortIgnored=!0)):w.status.fetchResolved=!0),Re&&!Fe&&!Ye)return Oe(G.signal.reason);let et=st;return C(this,O)[p]===st&&(qe===void 0?et.__staleWhileFetching?C(this,O)[p]=et.__staleWhileFetching:Ae(this,F,Lt).call(this,u,"fetch"):(w.status&&(w.status.fetchUpdated=!0),this.set(u,qe,we.options))),qe},xe=qe=>(w.status&&(w.status.fetchRejected=!0,w.status.fetchError=qe),Oe(qe)),Oe=qe=>{let{aborted:Ye}=G.signal,Re=Ye&&w.allowStaleOnFetchAbort,Fe=Re||w.allowStaleOnFetchRejection,et=Fe||w.noDeleteOnFetchRejection,Qe=st;if(C(this,O)[p]===st&&(!et||Qe.__staleWhileFetching===void 0?Ae(this,F,Lt).call(this,u,"fetch"):Re||(C(this,O)[p]=Qe.__staleWhileFetching)),Fe)return w.status&&Qe.__staleWhileFetching!==void 0&&(w.status.returnedStale=!0),Qe.__staleWhileFetching;if(Qe.__returned===Qe)throw qe},gt=(qe,Ye)=>{var Fe;let Re=(Fe=C(this,S))==null?void 0:Fe.call(this,u,j,we);Re&&Re instanceof Promise&&Re.then(et=>qe(et===void 0?void 0:et),Ye),G.signal.addEventListener("abort",()=>{(!w.ignoreFetchAbort||w.allowStaleOnFetchAbort)&&(qe(void 0),w.allowStaleOnFetchAbort&&(qe=et=>Te(et,!0)))})};w.status&&(w.status.fetchDispatched=!0);let st=new Promise(gt).then(Te,xe),lt=Object.assign(st,{__abortController:G,__staleWhileFetching:j,__returned:void 0});return p===void 0?(this.set(u,lt,{...we.options,status:void 0}),p=C(this,Y).get(u)):C(this,O)[p]=lt,lt},We=function(u){if(!C(this,ie))return!1;let p=u;return!!p&&p instanceof Promise&&p.hasOwnProperty("__staleWhileFetching")&&p.__abortController instanceof i},bn=function(u,p){C(this,X)[p]=u,C(this,K)[u]=p},hr=function(u){u!==C(this,ge)&&(u===C(this,W)?Ce(this,W,C(this,K)[u]):Ae(this,F,bn).call(this,C(this,X)[u],C(this,K)[u]),Ae(this,F,bn).call(this,C(this,ge),u),Ce(this,ge,u))},Lt=function(u,p){var T,j,G,_e;let w=!1;if(C(this,M)!==0){let we=C(this,Y).get(u);if(we!==void 0)if(w=!0,C(this,M)===1)Ae(this,F,mn).call(this,p);else{C(this,V).call(this,we);let Te=C(this,O)[we];if(Ae(this,F,We).call(this,Te)?Te.__abortController.abort(new Error("deleted")):(C(this,R)||C(this,ye))&&(C(this,R)&&((T=C(this,N))==null||T.call(this,Te,u,p)),C(this,ye)&&((j=C(this,le))==null||j.push([Te,u,p]))),C(this,Y).delete(u),C(this,se)[we]=void 0,C(this,O)[we]=void 0,we===C(this,ge))Ce(this,ge,C(this,X)[we]);else if(we===C(this,W))Ce(this,W,C(this,K)[we]);else{let xe=C(this,X)[we];C(this,K)[xe]=C(this,K)[we];let Oe=C(this,K)[we];C(this,X)[Oe]=C(this,X)[we]}gr(this,M)._--,C(this,de).push(we)}}if(C(this,ye)&&((G=C(this,le))!=null&&G.length)){let we=C(this,le),Te;for(;Te=we==null?void 0:we.shift();)(_e=C(this,B))==null||_e.call(this,...Te)}return w},mn=function(u){var p,w,T;for(let j of Ae(this,F,Nt).call(this,{allowStale:!0})){let G=C(this,O)[j];if(Ae(this,F,We).call(this,G))G.__abortController.abort(new Error("deleted"));else{let _e=C(this,se)[j];C(this,R)&&((p=C(this,N))==null||p.call(this,G,_e,u)),C(this,ye)&&((w=C(this,le))==null||w.push([G,_e,u]))}}if(C(this,Y).clear(),C(this,O).fill(void 0),C(this,se).fill(void 0),C(this,pe)&&C(this,z)&&(C(this,pe).fill(0),C(this,z).fill(0)),C(this,Ee)&&C(this,Ee).fill(0),Ce(this,W,0),Ce(this,ge,0),C(this,de).length=0,Ce(this,J,0),Ce(this,M,0),C(this,ye)&&C(this,le)){let j=C(this,le),G;for(;G=j==null?void 0:j.shift();)(T=C(this,B))==null||T.call(this,...G)}},Pe);s.LRUCache=g}),Pt=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.ContainerIterator=s.Container=s.Base=void 0;var f=class{constructor(c=0){this.iteratorType=c}equals(c){return this.o===c.o}};s.ContainerIterator=f;var o=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};s.Base=o;var l=class extends o{};s.Container=l}),tl=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=Pt(),o=class extends f.Base{constructor(c=[]){super(),this.S=[];let i=this;c.forEach(function(e){i.push(e)})}clear(){this.i=0,this.S=[]}push(c){return this.S.push(c),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},l=o;s.default=l}),rl=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=Pt(),o=class extends f.Base{constructor(c=[]){super(),this.j=0,this.q=[];let i=this;c.forEach(function(e){i.push(e)})}clear(){this.q=[],this.i=this.j=0}push(c){let i=this.q.length;if(this.j/i>.5&&this.j+this.i>=i&&i>4096){let e=this.i;for(let r=0;r<e;++r)this.q[r]=this.q[this.j+r];this.j=0,this.q[this.i]=c}else this.q[this.j+this.i]=c;return++this.i}pop(){if(this.i===0)return;let c=this.q[this.j++];return this.i-=1,c}front(){if(this.i!==0)return this.q[this.j]}},l=o;s.default=l}),il=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=Pt(),o=class extends f.Base{constructor(c=[],i=function(r,t){return r>t?-1:r<t?1:0},e=!0){if(super(),this.v=i,Array.isArray(c))this.C=e?[...c]:c;else{this.C=[];let t=this;c.forEach(function(n){t.C.push(n)})}this.i=this.C.length;let r=this.i>>1;for(let t=this.i-1>>1;t>=0;--t)this.k(t,r)}m(c){let i=this.C[c];for(;c>0;){let e=c-1>>1,r=this.C[e];if(this.v(r,i)<=0)break;this.C[c]=r,c=e}this.C[c]=i}k(c,i){let e=this.C[c];for(;c<i;){let r=c<<1|1,t=r+1,n=this.C[r];if(t<this.i&&this.v(n,this.C[t])>0&&(r=t,n=this.C[t]),this.v(n,e)>=0)break;this.C[c]=n,c=r}this.C[c]=e}clear(){this.i=0,this.C.length=0}push(c){this.C.push(c),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let c=this.C[0],i=this.C.pop();return this.i-=1,this.i&&(this.C[0]=i,this.k(0,this.i>>1)),c}top(){return this.C[0]}find(c){return this.C.indexOf(c)>=0}remove(c){let i=this.C.indexOf(c);return i<0?!1:(i===0?this.pop():i===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(i,1,this.C.pop()),this.i-=1,this.m(i),this.k(i,this.i>>1)),!0)}updateItem(c){let i=this.C.indexOf(c);return i<0?!1:(this.m(i),this.k(i,this.i>>1),!0)}toArray(){return[...this.C]}},l=o;s.default=l}),Mn=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=Pt(),o=class extends f.Container{},l=o;s.default=l}),Ot=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.throwIteratorAccessError=f;function f(){throw new RangeError("Iterator access denied!")}}),es=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.RandomIterator=void 0;var f=Pt(),o=Ot(),l=class extends f.ContainerIterator{constructor(c,i){super(i),this.o=c,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,o.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,o.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,o.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,o.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(c){this.container.setElementByPos(this.o,c)}};s.RandomIterator=l}),nl=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=l(Mn()),o=es();function l(r){return r&&r.t?r:{default:r}}var c=class ts extends o.RandomIterator{constructor(t,n,h){super(t,h),this.container=n}copy(){return new ts(this.o,this.container,this.iteratorType)}},i=class extends f.default{constructor(r=[],t=!0){if(super(),Array.isArray(r))this.J=t?[...r]:r,this.i=r.length;else{this.J=[];let n=this;r.forEach(function(h){n.pushBack(h)})}}clear(){this.i=0,this.J.length=0}begin(){return new c(0,this)}end(){return new c(this.i,this)}rBegin(){return new c(this.i-1,this,1)}rEnd(){return new c(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;return this.J[r]}eraseElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;return this.J.splice(r,1),this.i-=1,this.i}eraseElementByValue(r){let t=0;for(let n=0;n<this.i;++n)this.J[n]!==r&&(this.J[t++]=this.J[n]);return this.i=this.J.length=t,this.i}eraseElementByIterator(r){let t=r.o;return r=r.next(),this.eraseElementByPos(t),r}pushBack(r){return this.J.push(r),this.i+=1,this.i}popBack(){if(this.i!==0)return this.i-=1,this.J.pop()}setElementByPos(r,t){if(r<0||r>this.i-1)throw new RangeError;this.J[r]=t}insert(r,t,n=1){if(r<0||r>this.i)throw new RangeError;return this.J.splice(r,0,...new Array(n).fill(t)),this.i+=n,this.i}find(r){for(let t=0;t<this.i;++t)if(this.J[t]===r)return new c(t,this);return this.end()}reverse(){this.J.reverse()}unique(){let r=1;for(let t=1;t<this.i;++t)this.J[t]!==this.J[t-1]&&(this.J[r++]=this.J[t]);return this.i=this.J.length=r,this.i}sort(r){this.J.sort(r)}forEach(r){for(let t=0;t<this.i;++t)r(this.J[t],t,this)}[Symbol.iterator](){return(function*(){yield*this.J}).bind(this)()}},e=i;s.default=e}),ol=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=c(Mn()),o=Pt(),l=Ot();function c(t){return t&&t.t?t:{default:t}}var i=class rs extends o.ContainerIterator{constructor(n,h,d,g){super(g),this.o=n,this.h=h,this.container=d,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o.l}set pointer(n){this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o.l=n}copy(){return new rs(this.o,this.h,this.container,this.iteratorType)}},e=class extends f.default{constructor(t=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let n=this;t.forEach(function(h){n.pushBack(h)})}V(t){let{L:n,B:h}=t;n.B=h,h.L=n,t===this.p&&(this.p=h),t===this._&&(this._=n),this.i-=1}G(t,n){let h=n.B,d={l:t,L:n,B:h};n.B=d,h.L=d,n===this.h&&(this.p=d),h===this.h&&(this._=d),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new i(this.p,this.h,this)}end(){return new i(this.h,this.h,this)}rBegin(){return new i(this._,this.h,this,1)}rEnd(){return new i(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let n=this.p;for(;t--;)n=n.B;return n.l}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let n=this.p;for(;t--;)n=n.B;return this.V(n),this.i}eraseElementByValue(t){let n=this.p;for(;n!==this.h;)n.l===t&&this.V(n),n=n.B;return this.i}eraseElementByIterator(t){let n=t.o;return n===this.h&&(0,l.throwIteratorAccessError)(),t=t.next(),this.V(n),t}pushBack(t){return this.G(t,this._),this.i}popBack(){if(this.i===0)return;let t=this._.l;return this.V(this._),t}pushFront(t){return this.G(t,this.h),this.i}popFront(){if(this.i===0)return;let t=this.p.l;return this.V(this.p),t}setElementByPos(t,n){if(t<0||t>this.i-1)throw new RangeError;let h=this.p;for(;t--;)h=h.B;h.l=n}insert(t,n,h=1){if(t<0||t>this.i)throw new RangeError;if(h<=0)return this.i;if(t===0)for(;h--;)this.pushFront(n);else if(t===this.i)for(;h--;)this.pushBack(n);else{let d=this.p;for(let b=1;b<t;++b)d=d.B;let g=d.B;for(this.i+=h;h--;)d.B={l:n,L:d},d.B.L=d,d=d.B;d.B=g,g.L=d}return this.i}find(t){let n=this.p;for(;n!==this.h;){if(n.l===t)return new i(n,this.h,this);n=n.B}return this.end()}reverse(){if(this.i<=1)return;let t=this.p,n=this._,h=0;for(;h<<1<this.i;){let d=t.l;t.l=n.l,n.l=d,t=t.B,n=n.L,h+=1}}unique(){if(this.i<=1)return this.i;let t=this.p;for(;t!==this.h;){let n=t;for(;n.B!==this.h&&n.l===n.B.l;)n=n.B,this.i-=1;t.B=n.B,t.B.L=t,t=t.B}return this.i}sort(t){if(this.i<=1)return;let n=[];this.forEach(function(d){n.push(d)}),n.sort(t);let h=this.p;n.forEach(function(d){h.l=d,h=h.B})}merge(t){let n=this;if(this.i===0)t.forEach(function(h){n.pushBack(h)});else{let h=this.p;t.forEach(function(d){for(;h!==n.h&&h.l<=d;)h=h.B;n.G(d,h.L)})}return this.i}forEach(t){let n=this.p,h=0;for(;n!==this.h;)t(n.l,h++,this),n=n.B}[Symbol.iterator](){return(function*(){if(this.i===0)return;let t=this.p;for(;t!==this.h;)yield t.l,t=t.B}).bind(this)()}},r=e;s.default=r}),sl=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=l(Mn()),o=es();function l(r){return r&&r.t?r:{default:r}}var c=class is extends o.RandomIterator{constructor(t,n,h){super(t,h),this.container=n}copy(){return new is(this.o,this.container,this.iteratorType)}},i=class extends f.default{constructor(r=[],t=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let n=(()=>{if(typeof r.length=="number")return r.length;if(typeof r.size=="number")return r.size;if(typeof r.size=="function")return r.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=t,this.P=Math.max(Math.ceil(n/this.F),1);for(let g=0;g<this.P;++g)this.A.push(new Array(this.F));let h=Math.ceil(n/this.F);this.j=this.R=(this.P>>1)-(h>>1),this.D=this.N=this.F-n%this.F>>1;let d=this;r.forEach(function(g){d.pushBack(g)})}T(){let r=[],t=Math.max(this.P>>1,1);for(let n=0;n<t;++n)r[n]=new Array(this.F);for(let n=this.j;n<this.P;++n)r[r.length]=this.A[n];for(let n=0;n<this.R;++n)r[r.length]=this.A[n];r[r.length]=[...this.A[this.R]],this.j=t,this.R=r.length-1;for(let n=0;n<t;++n)r[r.length]=new Array(this.F);this.A=r,this.P=r.length}O(r){let t=this.D+r+1,n=t%this.F,h=n-1,d=this.j+(t-n)/this.F;return n===0&&(d-=1),d%=this.P,h<0&&(h+=this.F),{curNodeBucketIndex:d,curNodePointerIndex:h}}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 c(0,this)}end(){return new c(this.i,this)}rBegin(){return new c(this.i-1,this,1)}rEnd(){return new c(-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(r){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]=r,this.i}popBack(){if(this.i===0)return;let r=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,r}pushFront(r){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]=r,this.i}popFront(){if(this.i===0)return;let r=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,r}getElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let{curNodeBucketIndex:t,curNodePointerIndex:n}=this.O(r);return this.A[t][n]}setElementByPos(r,t){if(r<0||r>this.i-1)throw new RangeError;let{curNodeBucketIndex:n,curNodePointerIndex:h}=this.O(r);this.A[n][h]=t}insert(r,t,n=1){if(r<0||r>this.i)throw new RangeError;if(r===0)for(;n--;)this.pushFront(t);else if(r===this.i)for(;n--;)this.pushBack(t);else{let h=[];for(let d=r;d<this.i;++d)h.push(this.getElementByPos(d));this.cut(r-1);for(let d=0;d<n;++d)this.pushBack(t);for(let d=0;d<h.length;++d)this.pushBack(h[d])}return this.i}cut(r){if(r<0)return this.clear(),0;let{curNodeBucketIndex:t,curNodePointerIndex:n}=this.O(r);return this.R=t,this.N=n,this.i=r+1,this.i}eraseElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;if(r===0)this.popFront();else if(r===this.i-1)this.popBack();else{let t=[];for(let h=r+1;h<this.i;++h)t.push(this.getElementByPos(h));this.cut(r),this.popBack();let n=this;t.forEach(function(h){n.pushBack(h)})}return this.i}eraseElementByValue(r){if(this.i===0)return 0;let t=[];for(let h=0;h<this.i;++h){let d=this.getElementByPos(h);d!==r&&t.push(d)}let n=t.length;for(let h=0;h<n;++h)this.setElementByPos(h,t[h]);return this.cut(n-1)}eraseElementByIterator(r){let t=r.o;return this.eraseElementByPos(t),r=r.next(),r}find(r){for(let t=0;t<this.i;++t)if(this.getElementByPos(t)===r)return new c(t,this);return this.end()}reverse(){let r=0,t=this.i-1;for(;r<t;){let n=this.getElementByPos(r);this.setElementByPos(r,this.getElementByPos(t)),this.setElementByPos(t,n),r+=1,t-=1}}unique(){if(this.i<=1)return this.i;let r=1,t=this.getElementByPos(0);for(let n=1;n<this.i;++n){let h=this.getElementByPos(n);h!==t&&(t=h,this.setElementByPos(r++,h))}for(;this.i>r;)this.popBack();return this.i}sort(r){let t=[];for(let n=0;n<this.i;++n)t.push(this.getElementByPos(n));t.sort(r);for(let n=0;n<this.i;++n)this.setElementByPos(n,t[n])}shrinkToFit(){if(this.i===0)return;let r=[];this.forEach(function(t){r.push(t)}),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 t=0;t<this.P;++t)this.A.push(new Array(this.F));for(let t=0;t<r.length;++t)this.pushBack(r[t])}forEach(r){for(let t=0;t<this.i;++t)r(this.getElementByPos(t),t,this)}[Symbol.iterator](){return(function*(){for(let r=0;r<this.i;++r)yield this.getElementByPos(r)}).bind(this)()}},e=i;s.default=e}),al=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.TreeNodeEnableIndex=s.TreeNode=void 0;var f=class{constructor(l,c){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=l,this.l=c}L(){let l=this;if(l.ee===1&&l.tt.tt===l)l=l.W;else if(l.U)for(l=l.U;l.W;)l=l.W;else{let c=l.tt;for(;c.U===l;)l=c,c=l.tt;l=c}return l}B(){let l=this;if(l.W){for(l=l.W;l.U;)l=l.U;return l}else{let c=l.tt;for(;c.W===l;)l=c,c=l.tt;return l.W!==c?c:l}}te(){let l=this.tt,c=this.W,i=c.U;return l.tt===this?l.tt=c:l.U===this?l.U=c:l.W=c,c.tt=l,c.U=this,this.tt=c,this.W=i,i&&(i.tt=this),c}se(){let l=this.tt,c=this.U,i=c.W;return l.tt===this?l.tt=c:l.U===this?l.U=c:l.W=c,c.tt=l,c.W=this,this.tt=c,this.U=i,i&&(i.tt=this),c}};s.TreeNode=f;var o=class extends f{constructor(){super(...arguments),this.rt=1}te(){let l=super.te();return this.ie(),l.ie(),l}se(){let l=super.se();return this.ie(),l.ie(),l}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};s.TreeNodeEnableIndex=o}),ns=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=al(),o=Pt(),l=Ot(),c=class extends o.Container{constructor(e=function(t,n){return t<n?-1:t>n?1:0},r=!1){super(),this.Y=void 0,this.v=e,r?(this.re=f.TreeNodeEnableIndex,this.M=function(t,n,h){let d=this.ne(t,n,h);if(d){let g=d.tt;for(;g!==this.h;)g.rt+=1,g=g.tt;let b=this.he(d);if(b){let{parentNode:m,grandParent:v,curNode:_}=b;m.ie(),v.ie(),_.ie()}}return this.i},this.V=function(t){let n=this.fe(t);for(;n!==this.h;)n.rt-=1,n=n.tt}):(this.re=f.TreeNode,this.M=function(t,n,h){let d=this.ne(t,n,h);return d&&this.he(d),this.i},this.V=this.fe),this.h=new this.re}X(e,r){let t=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)e=e.W;else if(n>0)t=e,e=e.U;else return e}return t}Z(e,r){let t=this.h;for(;e;)this.v(e.u,r)<=0?e=e.W:(t=e,e=e.U);return t}$(e,r){let t=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)t=e,e=e.W;else if(n>0)e=e.U;else return e}return t}rr(e,r){let t=this.h;for(;e;)this.v(e.u,r)<0?(t=e,e=e.W):e=e.U;return t}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 t=r.W;if(t.ee===1)t.ee=0,r.ee=1,r===this.Y?this.Y=r.te():r.te();else if(t.W&&t.W.ee===1){t.ee=r.ee,r.ee=0,t.W.ee=0,r===this.Y?this.Y=r.te():r.te();return}else t.U&&t.U.ee===1?(t.ee=1,t.U.ee=0,t.se()):(t.ee=1,e=r)}else{let t=r.U;if(t.ee===1)t.ee=0,r.ee=1,r===this.Y?this.Y=r.se():r.se();else if(t.U&&t.U.ee===1){t.ee=r.ee,r.ee=0,t.U.ee=0,r===this.Y?this.Y=r.se():r.se();return}else t.W&&t.W.ee===1?(t.ee=1,t.W.ee=0,t.te()):(t.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 t=r.tt;return r===t.U?t.U=void 0:t.W=void 0,this.i-=1,this.Y.ee=0,t}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 t=r.tt;if(r===t.U){let n=t.W;if(n&&n.ee===1){if(n.ee=r.ee=0,t===this.Y)return;t.ee=1,e=t;continue}else if(e===r.W){if(e.ee=0,e.U&&(e.U.tt=r),e.W&&(e.W.tt=t),r.W=e.U,t.U=e.W,e.U=r,e.W=t,t===this.Y)this.Y=e,this.h.tt=e;else{let h=t.tt;h.U===t?h.U=e:h.W=e}return e.tt=t.tt,r.tt=e,t.tt=e,t.ee=1,{parentNode:r,grandParent:t,curNode:e}}else r.ee=0,t===this.Y?this.Y=t.se():t.se(),t.ee=1}else{let n=t.U;if(n&&n.ee===1){if(n.ee=r.ee=0,t===this.Y)return;t.ee=1,e=t;continue}else if(e===r.U){if(e.ee=0,e.U&&(e.U.tt=t),e.W&&(e.W.tt=r),t.W=e.U,r.U=e.W,e.U=t,e.W=r,t===this.Y)this.Y=e,this.h.tt=e;else{let h=t.tt;h.U===t?h.U=e:h.W=e}return e.tt=t.tt,r.tt=e,t.tt=e,t.ee=1,{parentNode:r,grandParent:t,curNode:e}}else r.ee=0,t===this.Y?this.Y=t.te():t.te(),t.ee=1}return}}ne(e,r,t){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,h=this.h.U,d=this.v(h.u,e);if(d===0){h.l=r;return}else if(d>0)h.U=new this.re(e,r),h.U.tt=h,n=h.U,this.h.U=n;else{let g=this.h.W,b=this.v(g.u,e);if(b===0){g.l=r;return}else if(b<0)g.W=new this.re(e,r),g.W.tt=g,n=g.W,this.h.W=n;else{if(t!==void 0){let m=t.o;if(m!==this.h){let v=this.v(m.u,e);if(v===0){m.l=r;return}else if(v>0){let _=m.L(),I=this.v(_.u,e);if(I===0){_.l=r;return}else I<0&&(n=new this.re(e,r),_.W===void 0?(_.W=n,n.tt=_):(m.U=n,n.tt=m))}}}if(n===void 0)for(n=this.Y;;){let m=this.v(n.u,e);if(m>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(m<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 t=this.v(e.u,r);if(t<0)e=e.W;else if(t>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 t=e.o;if(t===this.h&&(0,l.throwIteratorAccessError)(),this.i===1)return t.u=r,!0;if(t===this.h.U)return this.v(t.B().u,r)>0?(t.u=r,!0):!1;if(t===this.h.W)return this.v(t.L().u,r)<0?(t.u=r,!0):!1;let n=t.L().u;if(this.v(n,r)>=0)return!1;let h=t.B().u;return this.v(h,r)<=0?!1:(t.u=r,!0)}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=0,t=this;return this.oe(this.Y,function(n){return e===r?(t.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,l.throwIteratorAccessError)();let t=r.W===void 0;return e.iteratorType===0?t&&e.next():(!t||r.U===void 0)&&e.next(),this.V(r),e}forEach(e){let r=0;for(let t of this)e(t,r++,this)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r,t=0;for(let n of this){if(t===e){r=n;break}t+=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)}},i=c;s.default=i}),os=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=Pt(),o=Ot(),l=class extends f.ContainerIterator{constructor(i,e,r){super(r),this.o=i,this.h=e,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,o.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,o.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,o.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,o.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let i=this.o,e=this.h.tt;if(i===this.h)return e?e.rt-1:0;let r=0;for(i.U&&(r+=i.U.rt);i!==e;){let t=i.tt;i===t.W&&(r+=1,t.U&&(r+=t.U.rt)),i=t}return r}},c=l;s.default=c}),ll=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=c(ns()),o=c(os()),l=Ot();function c(t){return t&&t.t?t:{default:t}}var i=class ss extends o.default{constructor(n,h,d,g){super(n,h,g),this.container=d}get pointer(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o.u}copy(){return new ss(this.o,this.h,this.container,this.iteratorType)}},e=class extends f.default{constructor(t=[],n,h){super(n,h);let d=this;t.forEach(function(g){d.insert(g)})}*K(t){t!==void 0&&(yield*this.K(t.U),yield t.u,yield*this.K(t.W))}begin(){return new i(this.h.U||this.h,this.h,this)}end(){return new i(this.h,this.h,this)}rBegin(){return new i(this.h.W||this.h,this.h,this,1)}rEnd(){return new i(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(t,n){return this.M(t,void 0,n)}find(t){let n=this.I(this.Y,t);return new i(n,this.h,this)}lowerBound(t){let n=this.X(this.Y,t);return new i(n,this.h,this)}upperBound(t){let n=this.Z(this.Y,t);return new i(n,this.h,this)}reverseLowerBound(t){let n=this.$(this.Y,t);return new i(n,this.h,this)}reverseUpperBound(t){let n=this.rr(this.Y,t);return new i(n,this.h,this)}union(t){let n=this;return t.forEach(function(h){n.insert(h)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},r=e;s.default=r}),ul=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=c(ns()),o=c(os()),l=Ot();function c(t){return t&&t.t?t:{default:t}}var i=class as extends o.default{constructor(n,h,d,g){super(n,h,g),this.container=d}get pointer(){this.o===this.h&&(0,l.throwIteratorAccessError)();let n=this;return new Proxy([],{get(h,d){if(d==="0")return n.o.u;if(d==="1")return n.o.l},set(h,d,g){if(d!=="1")throw new TypeError("props must be 1");return n.o.l=g,!0}})}copy(){return new as(this.o,this.h,this.container,this.iteratorType)}},e=class extends f.default{constructor(t=[],n,h){super(n,h);let d=this;t.forEach(function(g){d.setElement(g[0],g[1])})}*K(t){t!==void 0&&(yield*this.K(t.U),yield[t.u,t.l],yield*this.K(t.W))}begin(){return new i(this.h.U||this.h,this.h,this)}end(){return new i(this.h,this.h,this)}rBegin(){return new i(this.h.W||this.h,this.h,this,1)}rEnd(){return new i(this.h,this.h,this,1)}front(){if(this.i===0)return;let t=this.h.U;return[t.u,t.l]}back(){if(this.i===0)return;let t=this.h.W;return[t.u,t.l]}lowerBound(t){let n=this.X(this.Y,t);return new i(n,this.h,this)}upperBound(t){let n=this.Z(this.Y,t);return new i(n,this.h,this)}reverseLowerBound(t){let n=this.$(this.Y,t);return new i(n,this.h,this)}reverseUpperBound(t){let n=this.rr(this.Y,t);return new i(n,this.h,this)}setElement(t,n,h){return this.M(t,n,h)}find(t){let n=this.I(this.Y,t);return new i(n,this.h,this)}getElementByKey(t){return this.I(this.Y,t).l}union(t){let n=this;return t.forEach(function(h){n.setElement(h[0],h[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},r=e;s.default=r}),ls=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=f;function f(o){let l=typeof o;return l==="object"&&o!==null||l==="function"}}),us=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.HashContainerIterator=s.HashContainer=void 0;var f=Pt(),o=c(ls()),l=Ot();function c(r){return r&&r.t?r:{default:r}}var i=class extends f.ContainerIterator{constructor(r,t,n){super(n),this.o=r,this.h=t,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,l.throwIteratorAccessError)(),this.o=this.o.L,this})}};s.HashContainerIterator=i;var e=class extends f.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(r){let{L:t,B:n}=r;t.B=n,n.L=t,r===this.p&&(this.p=n),r===this._&&(this._=t),this.i-=1}M(r,t,n){n===void 0&&(n=(0,o.default)(r));let h;if(n){let d=r[this.HASH_TAG];if(d!==void 0)return this.H[d].l=t,this.i;Object.defineProperty(r,this.HASH_TAG,{value:this.H.length,configurable:!0}),h={u:r,l:t,L:this._,B:this.h},this.H.push(h)}else{let d=this.g[r];if(d)return d.l=t,this.i;h={u:r,l:t,L:this._,B:this.h},this.g[r]=h}return this.i===0?(this.p=h,this.h.B=h):this._.B=h,this._=h,this.h.L=h,++this.i}I(r,t){if(t===void 0&&(t=(0,o.default)(r)),t){let n=r[this.HASH_TAG];return n===void 0?this.h:this.H[n]}else return this.g[r]||this.h}clear(){let r=this.HASH_TAG;this.H.forEach(function(t){delete t.u[r]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(r,t){let n;if(t===void 0&&(t=(0,o.default)(r)),t){let h=r[this.HASH_TAG];if(h===void 0)return!1;delete r[this.HASH_TAG],n=this.H[h],delete this.H[h]}else{if(n=this.g[r],n===void 0)return!1;delete this.g[r]}return this.V(n),!0}eraseElementByIterator(r){let t=r.o;return t===this.h&&(0,l.throwIteratorAccessError)(),this.V(t),r.next()}eraseElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let t=this.p;for(;r--;)t=t.B;return this.V(t),this.i}};s.HashContainer=e}),hl=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=us(),o=Ot(),l=class hs extends f.HashContainerIterator{constructor(r,t,n,h){super(r,t,h),this.container=n}get pointer(){return this.o===this.h&&(0,o.throwIteratorAccessError)(),this.o.u}copy(){return new hs(this.o,this.h,this.container,this.iteratorType)}},c=class extends f.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(t){r.insert(t)})}begin(){return new l(this.p,this.h,this)}end(){return new l(this.h,this.h,this)}rBegin(){return new l(this._,this.h,this,1)}rEnd(){return new l(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(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 t=this.I(e,r);return new l(t,this.h,this)}forEach(e){let r=0,t=this.p;for(;t!==this.h;)e(t.u,r++,this),t=t.B}[Symbol.iterator](){return(function*(){let e=this.p;for(;e!==this.h;)yield e.u,e=e.B}).bind(this)()}},i=c;s.default=i}),cl=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),s.default=void 0;var f=us(),o=c(ls()),l=Ot();function c(t){return t&&t.t?t:{default:t}}var i=class cs extends f.HashContainerIterator{constructor(n,h,d,g){super(n,h,g),this.container=d}get pointer(){this.o===this.h&&(0,l.throwIteratorAccessError)();let n=this;return new Proxy([],{get(h,d){if(d==="0")return n.o.u;if(d==="1")return n.o.l},set(h,d,g){if(d!=="1")throw new TypeError("props must be 1");return n.o.l=g,!0}})}copy(){return new cs(this.o,this.h,this.container,this.iteratorType)}},e=class extends f.HashContainer{constructor(t=[]){super();let n=this;t.forEach(function(h){n.setElement(h[0],h[1])})}begin(){return new i(this.p,this.h,this)}end(){return new i(this.h,this.h,this)}rBegin(){return new i(this._,this.h,this,1)}rEnd(){return new i(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(t,n,h){return this.M(t,n,h)}getElementByKey(t,n){if(n===void 0&&(n=(0,o.default)(t)),n){let d=t[this.HASH_TAG];return d!==void 0?this.H[d].l:void 0}let h=this.g[t];return h?h.l:void 0}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let n=this.p;for(;t--;)n=n.B;return[n.u,n.l]}find(t,n){let h=this.I(t,n);return new i(h,this.h,this)}forEach(t){let n=0,h=this.p;for(;h!==this.h;)t([h.u,h.l],n++,this),h=h.B}[Symbol.iterator](){return(function*(){let t=this.p;for(;t!==this.h;)yield[t.u,t.l],t=t.B}).bind(this)()}},r=e;s.default=r}),fl=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"t",{value:!0}),Object.defineProperty(s,"Deque",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(s,"HashMap",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(s,"HashSet",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(s,"LinkList",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(s,"OrderedMap",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(s,"OrderedSet",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(s,"PriorityQueue",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(s,"Queue",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(s,"Stack",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(s,"Vector",{enumerable:!0,get:function(){return c.default}});var f=d(tl()),o=d(rl()),l=d(il()),c=d(nl()),i=d(ol()),e=d(sl()),r=d(ll()),t=d(ul()),n=d(hl()),h=d(cl());function d(g){return g&&g.t?g:{default:g}}}),dl=be((s,f)=>{he(),fe(),ce();var o=fl().OrderedSet,l=Tt()("number-allocator:trace"),c=Tt()("number-allocator:error");function i(r,t){this.low=r,this.high=t}i.prototype.equals=function(r){return this.low===r.low&&this.high===r.high},i.prototype.compare=function(r){return this.low<r.low&&this.high<r.low?-1:r.low<this.low&&r.high<this.low?1:0};function e(r,t){if(!(this instanceof e))return new e(r,t);this.min=r,this.max=t,this.ss=new o([],(n,h)=>n.compare(h)),l("Create"),this.clear()}e.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},e.prototype.alloc=function(){if(this.ss.size()===0)return l("alloc():empty"),null;let r=this.ss.begin(),t=r.pointer.low,n=r.pointer.high,h=t;return h+1<=n?this.ss.updateKeyByIterator(r,new i(t+1,n)):this.ss.eraseElementByPos(0),l("alloc():"+h),h},e.prototype.use=function(r){let t=new i(r,r),n=this.ss.lowerBound(t);if(!n.equals(this.ss.end())){let h=n.pointer.low,d=n.pointer.high;return n.pointer.equals(t)?(this.ss.eraseElementByIterator(n),l("use():"+r),!0):h>r?!1:h===r?(this.ss.updateKeyByIterator(n,new i(h+1,d)),l("use():"+r),!0):d===r?(this.ss.updateKeyByIterator(n,new i(h,d-1)),l("use():"+r),!0):(this.ss.updateKeyByIterator(n,new i(r+1,d)),this.ss.insert(new i(h,r-1)),l("use():"+r),!0)}return l("use():failed"),!1},e.prototype.free=function(r){if(r<this.min||r>this.max){c("free():"+r+" is out of range");return}let t=new i(r,r),n=this.ss.upperBound(t);if(n.equals(this.ss.end())){if(n.equals(this.ss.begin())){this.ss.insert(t);return}n.pre();let h=n.pointer.high;n.pointer.high+1===r?this.ss.updateKeyByIterator(n,new i(h,r)):this.ss.insert(t)}else if(n.equals(this.ss.begin()))if(r+1===n.pointer.low){let h=n.pointer.high;this.ss.updateKeyByIterator(n,new i(r,h))}else this.ss.insert(t);else{let h=n.pointer.low,d=n.pointer.high;n.pre();let g=n.pointer.low;n.pointer.high+1===r?r+1===h?(this.ss.eraseElementByIterator(n),this.ss.updateKeyByIterator(n,new i(g,d))):this.ss.updateKeyByIterator(n,new i(g,r)):r+1===h?(this.ss.eraseElementByIterator(n.next()),this.ss.insert(new i(r,d))):this.ss.insert(t)}l("free():"+r)},e.prototype.clear=function(){l("clear()"),this.ss.clear(),this.ss.insert(new i(this.min,this.max))},e.prototype.intervalCount=function(){return this.ss.size()},e.prototype.dump=function(){console.log("length:"+this.ss.size());for(let r of this.ss)console.log(r)},f.exports=e}),fs=be((s,f)=>{he(),fe(),ce();var o=dl();f.exports.NumberAllocator=o}),pl=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0});var f=el(),o=fs(),l=class{constructor(c){c>0&&(this.aliasToTopic=new f.LRUCache({max:c}),this.topicToAlias={},this.numberAllocator=new o.NumberAllocator(1,c),this.max=c,this.length=0)}put(c,i){if(i===0||i>this.max)return!1;let e=this.aliasToTopic.get(i);return e&&delete this.topicToAlias[e],this.aliasToTopic.set(i,c),this.topicToAlias[c]=i,this.numberAllocator.use(i),this.length=this.aliasToTopic.size,!0}getTopicByAlias(c){return this.aliasToTopic.get(c)}getAliasByTopic(c){let i=this.topicToAlias[c];return typeof i<"u"&&this.aliasToTopic.get(i),i}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){return this.numberAllocator.firstVacant()||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};s.default=l}),gl=be(s=>{he(),fe(),ce();var f=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var o=Ur(),l=f(pl()),c=or(),i=(e,r)=>{e.log("_handleConnack");let{options:t}=e,n=t.protocolVersion===5?r.reasonCode:r.returnCode;if(clearTimeout(e.connackTimer),delete e.topicAliasSend,r.properties){if(r.properties.topicAliasMaximum){if(r.properties.topicAliasMaximum>65535){e.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}r.properties.topicAliasMaximum>0&&(e.topicAliasSend=new l.default(r.properties.topicAliasMaximum))}r.properties.serverKeepAlive&&t.keepalive&&(t.keepalive=r.properties.serverKeepAlive),r.properties.maximumPacketSize&&(t.properties||(t.properties={}),t.properties.maximumPacketSize=r.properties.maximumPacketSize)}if(n===0)e.reconnecting=!1,e._onConnect(r);else if(n>0){let h=new c.ErrorWithReasonCode(`Connection refused: ${o.ReasonCodes[n]}`,n);e.emit("error",h),e.options.reconnectOnConnackError&&e._cleanUp(!0)}};s.default=i}),bl=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0});var f=(o,l,c)=>{o.log("handling pubrel packet");let i=typeof c<"u"?c:o.noop,{messageId:e}=l,r={cmd:"pubcomp",messageId:e};o.incomingStore.get(l,(t,n)=>{t?o._sendPacket(r,i):(o.emit("message",n.topic,n.payload,n),o.handleMessage(n,h=>{if(h)return i(h);o.incomingStore.del(n,o.noop),o._sendPacket(r,i)}))})};s.default=f}),ml=be(s=>{he(),fe(),ce();var f=s&&s.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(s,"__esModule",{value:!0});var o=f(Ja()),l=f(Za()),c=f(gl()),i=f(Ur()),e=f(bl()),r=(t,n,h)=>{let{options:d}=t;if(d.protocolVersion===5&&d.properties&&d.properties.maximumPacketSize&&d.properties.maximumPacketSize<n.length)return t.emit("error",new Error(`exceeding packets size ${n.cmd}`)),t.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),t;switch(t.log("_handlePacket :: emitting packetreceive"),t.emit("packetreceive",n),n.cmd){case"publish":(0,o.default)(t,n,h);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":t.reschedulePing(),(0,i.default)(t,n),h();break;case"pubrel":t.reschedulePing(),(0,e.default)(t,n,h);break;case"connack":(0,c.default)(t,n),h();break;case"auth":t.reschedulePing(),(0,l.default)(t,n),h();break;case"pingresp":t.log("_handlePacket :: received pingresp"),t.reschedulePing(!0),h();break;case"disconnect":t.emit("disconnect",n),h();break;default:t.log("_handlePacket :: unknown command"),h();break}};s.default=r}),yl=be(s=>{he(),fe(),ce();var f=s&&s.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(s,"__esModule",{value:!0}),s.TypedEventEmitter=void 0;var o=f((Jt(),De(Ut))),l=or(),c=class{};s.TypedEventEmitter=c,(0,l.applyMixin)(c,o.default)}),Dr=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0}),s.isReactNativeBrowser=s.isWebWorker=void 0;var f=()=>{var i;return typeof window<"u"?typeof navigator<"u"&&((i=navigator.userAgent)===null||i===void 0?void 0:i.toLowerCase().indexOf(" electron/"))>-1&&Le!=null&&Le.versions?!Object.prototype.hasOwnProperty.call(Le.versions,"electron"):typeof window.document<"u":!1},o=()=>{var i,e;return!!(typeof self=="object"&&!((e=(i=self==null?void 0:self.constructor)===null||i===void 0?void 0:i.name)===null||e===void 0)&&e.includes("WorkerGlobalScope"))},l=()=>typeof navigator<"u"&&navigator.product==="ReactNative",c=f()||o()||l();s.isWebWorker=o(),s.isReactNativeBrowser=l(),s.default=c}),vl=be((s,f)=>{he(),fe(),ce(),function(o,l){typeof s=="object"&&typeof f<"u"?l(s):typeof define=="function"&&define.amd?define(["exports"],l):(o=typeof globalThis<"u"?globalThis:o||self,l(o.fastUniqueNumbers={}))}(s,function(o){var l=function(b){return function(m){var v=b(m);return m.add(v),v}},c=function(b){return function(m,v){return b.set(m,v),v}},i=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,e=536870912,r=e*2,t=function(b,m){return function(v){var _=m.get(v),I=_===void 0?v.size:_<r?_+1:0;if(!v.has(I))return b(v,I);if(v.size<e){for(;v.has(I);)I=Math.floor(Math.random()*r);return b(v,I)}if(v.size>i)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;v.has(I);)I=Math.floor(Math.random()*i);return b(v,I)}},n=new WeakMap,h=c(n),d=t(h,n),g=l(d);o.addUniqueNumber=g,o.generateUniqueNumber=d})}),_l=be((s,f)=>{he(),fe(),ce(),function(o,l){typeof s=="object"&&typeof f<"u"?l(s,vl()):typeof define=="function"&&define.amd?define(["exports","fast-unique-numbers"],l):(o=typeof globalThis<"u"?globalThis:o||self,l(o.workerTimersBroker={},o.fastUniqueNumbers))}(s,function(o,l){var c=function(r){return r.method!==void 0&&r.method==="call"},i=function(r){return r.error===null&&typeof r.id=="number"},e=function(r){var t=new Map([[0,function(){}]]),n=new Map([[0,function(){}]]),h=new Map,d=new Worker(r);d.addEventListener("message",function(_){var I=_.data;if(c(I)){var y=I.params,E=y.timerId,N=y.timerType;if(N==="interval"){var B=t.get(E);if(typeof B=="number"){var S=h.get(B);if(S===void 0||S.timerId!==E||S.timerType!==N)throw new Error("The timer is in an undefined state.")}else if(typeof B<"u")B();else throw new Error("The timer is in an undefined state.")}else if(N==="timeout"){var k=n.get(E);if(typeof k=="number"){var M=h.get(k);if(M===void 0||M.timerId!==E||M.timerType!==N)throw new Error("The timer is in an undefined state.")}else if(typeof k<"u")k(),n.delete(E);else throw new Error("The timer is in an undefined state.")}}else if(i(I)){var J=I.id,Y=h.get(J);if(Y===void 0)throw new Error("The timer is in an undefined state.");var se=Y.timerId,O=Y.timerType;h.delete(J),O==="interval"?t.delete(se):n.delete(se)}else{var K=I.error.message;throw new Error(K)}});var g=function(_){var I=l.generateUniqueNumber(h);h.set(I,{timerId:_,timerType:"interval"}),t.set(_,I),d.postMessage({id:I,method:"clear",params:{timerId:_,timerType:"interval"}})},b=function(_){var I=l.generateUniqueNumber(h);h.set(I,{timerId:_,timerType:"timeout"}),n.set(_,I),d.postMessage({id:I,method:"clear",params:{timerId:_,timerType:"timeout"}})},m=function(_){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,y=l.generateUniqueNumber(t);return t.set(y,function(){_(),typeof t.get(y)=="function"&&d.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:y,timerType:"interval"}})}),d.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:y,timerType:"interval"}}),y},v=function(_){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,y=l.generateUniqueNumber(n);return n.set(y,_),d.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:y,timerType:"timeout"}}),y};return{clearInterval:g,clearTimeout:b,setInterval:m,setTimeout:v}};o.load=e})}),wl=be((s,f)=>{he(),fe(),ce(),function(o,l){typeof s=="object"&&typeof f<"u"?l(s,_l()):typeof define=="function"&&define.amd?define(["exports","worker-timers-broker"],l):(o=typeof globalThis<"u"?globalThis:o||self,l(o.workerTimers={},o.workerTimersBroker))}(s,function(o,l){var c=function(d,g){var b=null;return function(){if(b!==null)return b;var m=new Blob([g],{type:"application/javascript; charset=utf-8"}),v=URL.createObjectURL(m);return b=d(v),setTimeout(function(){return URL.revokeObjectURL(v)}),b}},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)})()})();`,e=c(l.load,i),r=function(d){return e().clearInterval(d)},t=function(d){return e().clearTimeout(d)},n=function(){var d;return(d=e()).setInterval.apply(d,arguments)},h=function(){var d;return(d=e()).setTimeout.apply(d,arguments)};o.clearInterval=r,o.clearTimeout=t,o.setInterval=n,o.setTimeout=h})}),El=be(s=>{he(),fe(),ce();var f=s&&s.__createBinding||(Object.create?function(n,h,d,g){g===void 0&&(g=d);var b=Object.getOwnPropertyDescriptor(h,d);(!b||("get"in b?!h.__esModule:b.writable||b.configurable))&&(b={enumerable:!0,get:function(){return h[d]}}),Object.defineProperty(n,g,b)}:function(n,h,d,g){g===void 0&&(g=d),n[g]=h[d]}),o=s&&s.__setModuleDefault||(Object.create?function(n,h){Object.defineProperty(n,"default",{enumerable:!0,value:h})}:function(n,h){n.default=h}),l=s&&s.__importStar||function(){var n=function(h){return n=Object.getOwnPropertyNames||function(d){var g=[];for(var b in d)Object.prototype.hasOwnProperty.call(d,b)&&(g[g.length]=b);return g},n(h)};return function(h){if(h&&h.__esModule)return h;var d={};if(h!=null)for(var g=n(h),b=0;b<g.length;b++)g[b]!=="default"&&f(d,h,g[b]);return o(d,h),d}}();Object.defineProperty(s,"__esModule",{value:!0});var c=l(Dr()),i=wl(),e={set:i.setInterval,clear:i.clearInterval},r={set:(n,h)=>setInterval(n,h),clear:n=>clearInterval(n)},t=n=>{switch(n){case"native":return r;case"worker":return e;case"auto":default:return c.default&&!c.isWebWorker&&!c.isReactNativeBrowser?e:r}};s.default=t}),ds=be(s=>{he(),fe(),ce();var f=s&&s.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(s,"__esModule",{value:!0});var o=f(El()),l=class{get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}constructor(c,i){this.destroyed=!1,this.client=c,this.timer=typeof i=="object"&&"set"in i&&"clear"in i?i:(0,o.default)(i),this.setKeepalive(c.options.keepalive)}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(c){if(c*=1e3,isNaN(c)||c<=0||c>2147483647)throw new Error(`Keepalive value must be an integer between 0 and 2147483647. Provided value is ${c}`);this._keepalive=c,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${c}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let c=Math.ceil(this._keepalive*1.5);this._keepaliveTimeoutTimestamp=Date.now()+c,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)}};s.default=l}),yn=be(s=>{he(),fe(),ce();var f=s&&s.__createBinding||(Object.create?function(B,S,k,M){M===void 0&&(M=k);var J=Object.getOwnPropertyDescriptor(S,k);(!J||("get"in J?!S.__esModule:J.writable||J.configurable))&&(J={enumerable:!0,get:function(){return S[k]}}),Object.defineProperty(B,M,J)}:function(B,S,k,M){M===void 0&&(M=k),B[M]=S[k]}),o=s&&s.__setModuleDefault||(Object.create?function(B,S){Object.defineProperty(B,"default",{enumerable:!0,value:S})}:function(B,S){B.default=S}),l=s&&s.__importStar||function(){var B=function(S){return B=Object.getOwnPropertyNames||function(k){var M=[];for(var J in k)Object.prototype.hasOwnProperty.call(k,J)&&(M[M.length]=J);return M},B(S)};return function(S){if(S&&S.__esModule)return S;var k={};if(S!=null)for(var M=B(S),J=0;J<M.length;J++)M[J]!=="default"&&f(k,S,M[J]);return o(k,S),k}}(),c=s&&s.__importDefault||function(B){return B&&B.__esModule?B:{default:B}};Object.defineProperty(s,"__esModule",{value:!0});var i=c(Oa()),e=c(Ga()),r=c(Yo()),t=Zt(),n=c(Qa()),h=l(Ya()),d=c(Tt()),g=c(Jo()),b=c(ml()),m=or(),v=yl(),_=c(ds()),I=l(Dr()),y=globalThis.setImmediate||((...B)=>{let S=B.shift();(0,m.nextTick)(()=>{S(...B)})}),E={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0,timerVariant:"auto"},N=class vn extends v.TypedEventEmitter{static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(S,k){super(),this.options=k||{};for(let M in E)typeof this.options[M]>"u"?this.options[M]=E[M]:this.options[M]=k[M];this.log=this.options.log||(0,d.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: version:",vn.VERSION),I.isWebWorker?this.log("MqttClient :: environment","webworker"):this.log("MqttClient :: environment",I.default?"browser":"node"),this.log("MqttClient :: options.protocol",k.protocol),this.log("MqttClient :: options.protocolVersion",k.protocolVersion),this.log("MqttClient :: options.username",k.username),this.log("MqttClient :: options.keepalive",k.keepalive),this.log("MqttClient :: options.reconnectPeriod",k.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",k.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",k.properties?k.properties.topicAliasMaximum:void 0),this.options.clientId=typeof k.clientId=="string"?k.clientId:vn.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=k.protocolVersion===5&&k.customHandleAcks?k.customHandleAcks:(...M)=>{M[3](null,0)},this.options.writeCache||(e.default.writeToStream.cacheNumbers=!1),this.streamBuilder=S,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new r.default:this.options.messageIdProvider,this.outgoingStore=k.outgoingStore||new g.default,this.incomingStore=k.incomingStore||new g.default,this.queueQoSZero=k.queueQoSZero===void 0?!0:k.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,k.properties&&k.properties.topicAliasMaximum>0&&(k.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new i.default(k.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:M}=this,J=()=>{let Y=M.shift();this.log("deliver :: entry %o",Y);let se=null;if(!Y){this._resubscribe();return}se=Y.packet,this.log("deliver :: call _sendPacket for %o",se);let O=!0;se.messageId&&se.messageId!==0&&(this.messageIdProvider.register(se.messageId)||(O=!1)),O?this._sendPacket(se,K=>{Y.cb&&Y.cb(K),J()}):(this.log("messageId: %d has already used. The message is skipped and removed.",se.messageId),J())};this.log("connect :: sending queued packets"),J()}),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(S,k){k()}handleMessage(S,k){k()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var S;let k=new t.Writable,M=e.default.parser(this.options),J=null,Y=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new g.default,this.outgoingStore=this.options.outgoingStore||new g.default,this.disconnecting=!1,this.disconnected=!1),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),M.on("packet",W=>{this.log("parser :: on packet push to packets array."),Y.push(W)});let se=()=>{this.log("work :: getting next packet in queue");let W=Y.shift();if(W)this.log("work :: packet pulled from queue"),(0,b.default)(this,W,O);else{this.log("work :: no packets in queue");let ge=J;J=null,this.log("work :: done flag is %s",!!ge),ge&&ge()}},O=()=>{if(Y.length)(0,m.nextTick)(se);else{let W=J;J=null,W()}};k._write=(W,ge,de)=>{J=de,this.log("writable stream :: parsing buffer"),M.parse(W),se()};let K=W=>{this.log("streamErrorHandler :: error",W.message),W.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",W)):this.noop(W)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(k),this.stream.on("error",K),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 X={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&&(X.will=Object.assign(Object.assign({},this.options.will),{payload:(S=this.options.will)===null||S===void 0?void 0:S.payload})),this.topicAliasRecv&&(X.properties||(X.properties={}),this.topicAliasRecv&&(X.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(X),M.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){let W=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(W)}}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(S,k,M,J){this.log("publish :: message `%s` to topic `%s`",k,S);let{options:Y}=this;typeof M=="function"&&(J=M,M=null),M=M||{},M=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),M);let{qos:se,retain:O,dup:K,properties:X,cbStorePut:W}=M;if(this._checkDisconnecting(J))return this;let ge=()=>{let de=0;if((se===1||se===2)&&(de=this._nextId(),de===null))return this.log("No messageId left"),!1;let le={cmd:"publish",topic:S,payload:k,qos:se,retain:O,messageId:de,dup:K};switch(Y.protocolVersion===5&&(le.properties=X),this.log("publish :: qos",se),se){case 1:case 2:this.outgoing[le.messageId]={volatile:!1,cb:J||this.noop},this.log("MqttClient:publish: packet cmd: %s",le.cmd),this._sendPacket(le,void 0,W);break;default:this.log("MqttClient:publish: packet cmd: %s",le.cmd),this._sendPacket(le,J,W);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!ge())&&this._storeProcessingQueue.push({invoke:ge,cbStorePut:M.cbStorePut,callback:J}),this}publishAsync(S,k,M){return new Promise((J,Y)=>{this.publish(S,k,M,(se,O)=>{se?Y(se):J(O)})})}subscribe(S,k,M){let J=this.options.protocolVersion;typeof k=="function"&&(M=k),M=M||this.noop;let Y=!1,se=[];typeof S=="string"?(S=[S],se=S):Array.isArray(S)?se=S:typeof S=="object"&&(Y=S.resubscribe,delete S.resubscribe,se=Object.keys(S));let O=h.validateTopics(se);if(O!==null)return y(M,new Error(`Invalid topic ${O}`)),this;if(this._checkDisconnecting(M))return this.log("subscribe: discconecting true"),this;let K={qos:0};J===5&&(K.nl=!1,K.rap=!1,K.rh=0),k=Object.assign(Object.assign({},K),k);let X=k.properties,W=[],ge=(le,Ee)=>{if(Ee=Ee||k,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,le)||this._resubscribeTopics[le].qos<Ee.qos||Y){let z={topic:le,qos:Ee.qos};J===5&&(z.nl=Ee.nl,z.rap=Ee.rap,z.rh=Ee.rh,z.properties=X),this.log("subscribe: pushing topic `%s` and qos `%s` to subs list",z.topic,z.qos),W.push(z)}};if(Array.isArray(S)?S.forEach(le=>{this.log("subscribe: array topic %s",le),ge(le)}):Object.keys(S).forEach(le=>{this.log("subscribe: object topic %s, %o",le,S[le]),ge(le,S[le])}),!W.length)return M(null,[]),this;let de=()=>{let le=this._nextId();if(le===null)return this.log("No messageId left"),!1;let Ee={cmd:"subscribe",subscriptions:W,messageId:le};if(X&&(Ee.properties=X),this.options.resubscribe){this.log("subscribe :: resubscribe true");let z=[];W.forEach(pe=>{if(this.options.reconnectPeriod>0){let R={qos:pe.qos};J===5&&(R.nl=pe.nl||!1,R.rap=pe.rap||!1,R.rh=pe.rh||0,R.properties=pe.properties),this._resubscribeTopics[pe.topic]=R,z.push(pe.topic)}}),this.messageIdToTopic[Ee.messageId]=z}return this.outgoing[Ee.messageId]={volatile:!0,cb(z,pe){if(!z){let{granted:R}=pe;for(let ie=0;ie<R.length;ie+=1)W[ie].qos=R[ie]}M(z,W,pe)}},this.log("subscribe :: call _sendPacket"),this._sendPacket(Ee),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!de())&&this._storeProcessingQueue.push({invoke:de,callback:M}),this}subscribeAsync(S,k){return new Promise((M,J)=>{this.subscribe(S,k,(Y,se)=>{Y?J(Y):M(se)})})}unsubscribe(S,k,M){typeof S=="string"&&(S=[S]),typeof k=="function"&&(M=k),M=M||this.noop;let J=h.validateTopics(S);if(J!==null)return y(M,new Error(`Invalid topic ${J}`)),this;if(this._checkDisconnecting(M))return this;let Y=()=>{let se=this._nextId();if(se===null)return this.log("No messageId left"),!1;let O={cmd:"unsubscribe",messageId:se,unsubscriptions:[]};return typeof S=="string"?O.unsubscriptions=[S]:Array.isArray(S)&&(O.unsubscriptions=S),this.options.resubscribe&&O.unsubscriptions.forEach(K=>{delete this._resubscribeTopics[K]}),typeof k=="object"&&k.properties&&(O.properties=k.properties),this.outgoing[O.messageId]={volatile:!0,cb:M},this.log("unsubscribe: call _sendPacket"),this._sendPacket(O),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!Y())&&this._storeProcessingQueue.push({invoke:Y,callback:M}),this}unsubscribeAsync(S,k){return new Promise((M,J)=>{this.unsubscribe(S,k,(Y,se)=>{Y?J(Y):M(se)})})}end(S,k,M){this.log("end :: (%s)",this.options.clientId),(S==null||typeof S!="boolean")&&(M=M||k,k=S,S=!1),typeof k!="object"&&(M=M||k,k=null),this.log("end :: cb? %s",!!M),(!M||typeof M!="function")&&(M=this.noop);let J=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(se=>{this.outgoingStore.close(O=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),M){let K=se||O;this.log("end :: closeStores: invoking callback with args"),M(K)}})}),this._deferredReconnect?this._deferredReconnect():(this.options.reconnectPeriod===0||this.options.manualConnect)&&(this.disconnecting=!1)},Y=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,S),this._cleanUp(S,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,m.nextTick)(J)},k)};return this.disconnecting?(M(),this):(this._clearReconnect(),this.disconnecting=!0,!S&&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,Y,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),Y()),this)}endAsync(S,k){return new Promise((M,J)=>{this.end(S,k,Y=>{Y?J(Y):M()})})}removeOutgoingMessage(S){if(this.outgoing[S]){let{cb:k}=this.outgoing[S];this._removeOutgoingAndStoreMessage(S,()=>{k(new Error("Message removed"))})}return this}reconnect(S){this.log("client reconnect");let k=()=>{S?(this.options.incomingStore=S.incomingStore,this.options.outgoingStore=S.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new g.default,this.outgoingStore=this.options.outgoingStore||new g.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=k:k(),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(S=>{this.outgoing[S].volatile&&typeof this.outgoing[S].cb=="function"&&(this.outgoing[S].cb(new Error("Connection closed")),delete this.outgoing[S])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(S=>{typeof this.outgoing[S].cb=="function"&&(this.outgoing[S].cb(new Error("Connection closed")),delete this.outgoing[S])}))}_removeTopicAliasAndRecoverTopicName(S){let k;S.properties&&(k=S.properties.topicAlias);let M=S.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",k,M),M.length===0){if(typeof k>"u")return new Error("Unregistered Topic Alias");if(M=this.topicAliasSend.getTopicByAlias(k),typeof M>"u")return new Error("Unregistered Topic Alias");S.topic=M}k&&delete S.properties.topicAlias}_checkDisconnecting(S){return this.disconnecting&&(S&&S!==this.noop?S(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(S,k,M={}){if(k&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",k)),this.log("_cleanUp :: forced? %s",S),S)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let J=Object.assign({cmd:"disconnect"},M);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(J,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),y(()=>{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(),k&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",k),k())}_storeAndSend(S,k,M){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",S.cmd);let J=S,Y;if(J.cmd==="publish"&&(J=(0,n.default)(S),Y=this._removeTopicAliasAndRecoverTopicName(J),Y))return k&&k(Y);this.outgoingStore.put(J,se=>{if(se)return k&&k(se);M(),this._writePacket(S,k)})}_applyTopicAlias(S){if(this.options.protocolVersion===5&&S.cmd==="publish"){let k;S.properties&&(k=S.properties.topicAlias);let M=S.topic.toString();if(this.topicAliasSend)if(k){if(M.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",M,k),!this.topicAliasSend.put(M,k)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",M,k),new Error("Sending Topic Alias out of range")}else M.length!==0&&(this.options.autoAssignTopicAlias?(k=this.topicAliasSend.getAliasByTopic(M),k?(S.topic="",S.properties=Object.assign(Object.assign({},S.properties),{topicAlias:k}),this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",M,k)):(k=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(M,k),S.properties=Object.assign(Object.assign({},S.properties),{topicAlias:k}),this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",M,k))):this.options.autoUseTopicAlias&&(k=this.topicAliasSend.getAliasByTopic(M),k&&(S.topic="",S.properties=Object.assign(Object.assign({},S.properties),{topicAlias:k}),this.log("applyTopicAlias :: auto use topic: %s - alias: %d",M,k))));else if(k)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",M,k),new Error("Sending Topic Alias out of range")}}_noop(S){this.log("noop ::",S)}_writePacket(S,k){this.log("_writePacket :: packet: %O",S),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",S),this.log("_writePacket :: writing to stream");let M=e.default.writeToStream(S,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",M),!M&&k&&k!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",k)):k&&(this.log("_writePacket :: invoking cb"),k())}_sendPacket(S,k,M,J){this.log("_sendPacket :: (%s) :: start",this.options.clientId),M=M||this.noop,k=k||this.noop;let Y=this._applyTopicAlias(S);if(Y){k(Y);return}if(!this.connected){if(S.cmd==="auth"){this._writePacket(S,k);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(S,k,M);return}if(J){this._writePacket(S,k);return}switch(S.cmd){case"publish":break;case"pubrel":this._storeAndSend(S,k,M);return;default:this._writePacket(S,k);return}switch(S.qos){case 2:case 1:this._storeAndSend(S,k,M);break;case 0:default:this._writePacket(S,k);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(S,k,M){this.log("_storePacket :: packet: %o",S),this.log("_storePacket :: cb? %s",!!k),M=M||this.noop;let J=S;if(J.cmd==="publish"){J=(0,n.default)(S);let se=this._removeTopicAliasAndRecoverTopicName(J);if(se)return k&&k(se)}let Y=J.qos||0;Y===0&&this.queueQoSZero||J.cmd!=="publish"?this.queue.push({packet:J,cb:k}):Y>0?(k=this.outgoing[J.messageId]?this.outgoing[J.messageId].cb:null,this.outgoingStore.put(J,se=>{if(se)return k&&k(se);M()})):k&&k(new Error("No connection to broker"))}_setupKeepaliveManager(){this.log("_setupKeepaliveManager :: keepalive %d (seconds)",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new _.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log("_destroyKeepaliveManager :: destroying keepalive manager"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(S=!1){this.keepaliveManager&&this.options.keepalive&&(S||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 S=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&S.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let k=0;k<S.length;k++){let M={};M[S[k]]=this._resubscribeTopics[S[k]],M.resubscribe=!0,this.subscribe(M,{properties:M[S[k]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1}_onConnect(S){if(this.disconnected){this.emit("connect",S);return}this.connackPacket=S,this.messageIdProvider.clear(),this._setupKeepaliveManager(),this.connected=!0;let k=()=>{let M=this.outgoingStore.createStream(),J=()=>{M.destroy(),M=null,this._flushStoreProcessingQueue(),Y()},Y=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",J),M.on("error",O=>{Y(),this._flushStoreProcessingQueue(),this.removeListener("close",J),this.emit("error",O)});let se=()=>{if(!M)return;let O=M.read(1),K;if(!O){M.once("readable",se);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[O.messageId]){se();return}!this.disconnecting&&!this.reconnectTimer?(K=this.outgoing[O.messageId]?this.outgoing[O.messageId].cb:null,this.outgoing[O.messageId]={volatile:!1,cb(X,W){K&&K(X,W),se()}},this._packetIdsDuringStoreProcessing[O.messageId]=!0,this.messageIdProvider.register(O.messageId)?this._sendPacket(O,void 0,void 0,!0):this.log("messageId: %d has already used.",O.messageId)):M.destroy&&M.destroy()};M.on("end",()=>{let O=!0;for(let K in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[K]){O=!1;break}this.removeListener("close",J),O?(Y(),this._invokeAllStoreProcessingQueue(),this.emit("connect",S)):k()}),se()};k()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let S=this._storeProcessingQueue[0];if(S&&S.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let S of this._storeProcessingQueue)S.cbStorePut&&S.cbStorePut(new Error("Connection closed")),S.callback&&S.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(S,k){delete this.outgoing[S],this.outgoingStore.del({messageId:S},(M,J)=>{k(M,J),this.messageIdProvider.deallocate(S),this._invokeStoreProcessingQueue()})}};N.VERSION=m.MQTTJS_VERSION,s.default=N}),Sl=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0});var f=fs(),o=class{constructor(){this.numberAllocator=new f.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(l){return this.numberAllocator.use(l)}deallocate(l){this.numberAllocator.free(l)}clear(){this.numberAllocator.clear()}};s.default=o});function $t(s){throw new RangeError(gs[s])}function Jn(s,f){let o=s.split("@"),l="";o.length>1&&(l=o[0]+"@",s=o[1]);let c=function(i,e){let r=[],t=i.length;for(;t--;)r[t]=e(i[t]);return r}((s=s.replace(ps,".")).split("."),f).join(".");return l+c}function Xn(s){let f=[],o=0,l=s.length;for(;o<l;){let c=s.charCodeAt(o++);if(c>=55296&&c<=56319&&o<l){let i=s.charCodeAt(o++);(64512&i)==56320?f.push(((1023&c)<<10)+(1023&i)+65536):(f.push(c),o--)}else f.push(c)}return f}var Zn,eo,ps,gs,dt,vr,Zr,ei,ti,ri,jt,Al=nt(()=>{he(),fe(),ce(),Zn=/^xn--/,eo=/[^\0-\x7E]/,ps=/[\x2E\u3002\uFF0E\uFF61]/g,gs={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},dt=Math.floor,vr=String.fromCharCode,Zr=function(s,f){return s+22+75*(s<26)-((f!=0)<<5)},ei=function(s,f,o){let l=0;for(s=o?dt(s/700):s>>1,s+=dt(s/f);s>455;l+=36)s=dt(s/35);return dt(l+36*s/(s+38))},ti=function(s){let f=[],o=s.length,l=0,c=128,i=72,e=s.lastIndexOf("-");e<0&&(e=0);for(let t=0;t<e;++t)s.charCodeAt(t)>=128&&$t("not-basic"),f.push(s.charCodeAt(t));for(let t=e>0?e+1:0;t<o;){let n=l;for(let d=1,g=36;;g+=36){t>=o&&$t("invalid-input");let b=(r=s.charCodeAt(t++))-48<10?r-22:r-65<26?r-65:r-97<26?r-97:36;(b>=36||b>dt((2147483647-l)/d))&&$t("overflow"),l+=b*d;let m=g<=i?1:g>=i+26?26:g-i;if(b<m)break;let v=36-m;d>dt(2147483647/v)&&$t("overflow"),d*=v}let h=f.length+1;i=ei(l-n,h,n==0),dt(l/h)>2147483647-c&&$t("overflow"),c+=dt(l/h),l%=h,f.splice(l++,0,c)}var r;return String.fromCodePoint(...f)},ri=function(s){let f=[],o=(s=Xn(s)).length,l=128,c=0,i=72;for(let t of s)t<128&&f.push(vr(t));let e=f.length,r=e;for(e&&f.push("-");r<o;){let t=2147483647;for(let h of s)h>=l&&h<t&&(t=h);let n=r+1;t-l>dt((2147483647-c)/n)&&$t("overflow"),c+=(t-l)*n,l=t;for(let h of s)if(h<l&&++c>2147483647&&$t("overflow"),h==l){let d=c;for(let g=36;;g+=36){let b=g<=i?1:g>=i+26?26:g-i;if(d<b)break;let m=d-b,v=36-b;f.push(vr(Zr(b+m%v,0))),d=dt(m/v)}f.push(vr(Zr(d,0))),i=ei(c,n,r==e),c=0,++r}++c,++l}return f.join("")},jt={version:"2.1.0",ucs2:{decode:Xn,encode:s=>String.fromCodePoint(...s)},decode:ti,encode:ri,toASCII:function(s){return Jn(s,function(f){return eo.test(f)?"xn--"+ri(f):f})},toUnicode:function(s){return Jn(s,function(f){return Zn.test(f)?ti(f.slice(4).toLowerCase()):f})}},jt.decode,jt.encode,jt.toASCII,jt.toUnicode,jt.ucs2,jt.version});function Il(s,f){return Object.prototype.hasOwnProperty.call(s,f)}var to,tr,ro,bt,kl=nt(()=>{he(),fe(),ce(),to=function(s,f,o,l){f=f||"&",o=o||"=";var c={};if(typeof s!="string"||s.length===0)return c;var i=/\+/g;s=s.split(f);var e=1e3;l&&typeof l.maxKeys=="number"&&(e=l.maxKeys);var r=s.length;e>0&&r>e&&(r=e);for(var t=0;t<r;++t){var n,h,d,g,b=s[t].replace(i,"%20"),m=b.indexOf(o);m>=0?(n=b.substr(0,m),h=b.substr(m+1)):(n=b,h=""),d=decodeURIComponent(n),g=decodeURIComponent(h),Il(c,d)?Array.isArray(c[d])?c[d].push(g):c[d]=[c[d],g]:c[d]=g}return c},tr=function(s){switch(typeof s){case"string":return s;case"boolean":return s?"true":"false";case"number":return isFinite(s)?s:"";default:return""}},ro=function(s,f,o,l){return f=f||"&",o=o||"=",s===null&&(s=void 0),typeof s=="object"?Object.keys(s).map(function(c){var i=encodeURIComponent(tr(c))+o;return Array.isArray(s[c])?s[c].map(function(e){return i+encodeURIComponent(tr(e))}).join(f):i+encodeURIComponent(tr(s[c]))}).join(f):l?encodeURIComponent(tr(l))+o+encodeURIComponent(tr(s)):""},bt={},bt.decode=bt.parse=to,bt.encode=bt.stringify=ro,bt.decode,bt.encode,bt.parse,bt.stringify});function _n(){throw new Error("setTimeout has not been defined")}function wn(){throw new Error("clearTimeout has not been defined")}function bs(s){if(St===setTimeout)return setTimeout(s,0);if((St===_n||!St)&&setTimeout)return St=setTimeout,setTimeout(s,0);try{return St(s,0)}catch{try{return St.call(null,s,0)}catch{return St.call(this||Qt,s,0)}}}function Tl(){Yt&&Gt&&(Yt=!1,Gt.length?yt=Gt.concat(yt):fr=-1,yt.length&&ms())}function ms(){if(!Yt){var s=bs(Tl);Yt=!0;for(var f=yt.length;f;){for(Gt=yt,yt=[];++fr<f;)Gt&&Gt[fr].run();fr=-1,f=yt.length}Gt=null,Yt=!1,function(o){if(At===clearTimeout)return clearTimeout(o);if((At===wn||!At)&&clearTimeout)return At=clearTimeout,clearTimeout(o);try{At(o)}catch{try{return At.call(null,o)}catch{return At.call(this||Qt,o)}}}(s)}}function io(s,f){(this||Qt).fun=s,(this||Qt).array=f}function _t(){}var no,St,At,Qt,Ke,Gt,yt,Yt,fr,He,Cl=nt(()=>{he(),fe(),ce(),Qt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Ke=no={},function(){try{St=typeof setTimeout=="function"?setTimeout:_n}catch{St=_n}try{At=typeof clearTimeout=="function"?clearTimeout:wn}catch{At=wn}}(),yt=[],Yt=!1,fr=-1,Ke.nextTick=function(s){var f=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)f[o-1]=arguments[o];yt.push(new io(s,f)),yt.length!==1||Yt||bs(ms)},io.prototype.run=function(){(this||Qt).fun.apply(null,(this||Qt).array)},Ke.title="browser",Ke.browser=!0,Ke.env={},Ke.argv=[],Ke.version="",Ke.versions={},Ke.on=_t,Ke.addListener=_t,Ke.once=_t,Ke.off=_t,Ke.removeListener=_t,Ke.removeAllListeners=_t,Ke.emit=_t,Ke.prependListener=_t,Ke.prependOnceListener=_t,Ke.listeners=function(s){return[]},Ke.binding=function(s){throw new Error("process.binding is not supported")},Ke.cwd=function(){return"/"},Ke.chdir=function(s){throw new Error("process.chdir is not supported")},Ke.umask=function(){return 0},He=no,He.addListener,He.argv,He.binding,He.browser,He.chdir,He.cwd,He.emit,He.env,He.listeners,He.nextTick,He.off,He.on,He.once,He.prependListener,He.prependOnceListener,He.removeAllListeners,He.removeListener,He.title,He.umask,He.version,He.versions});function Pl(){if(En)return Pr;En=!0;var s=Pr={},f,o;function l(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?f=setTimeout:f=l}catch{f=l}try{typeof clearTimeout=="function"?o=clearTimeout:o=c}catch{o=c}})();function i(v){if(f===setTimeout)return setTimeout(v,0);if((f===l||!f)&&setTimeout)return f=setTimeout,setTimeout(v,0);try{return f(v,0)}catch{try{return f.call(null,v,0)}catch{return f.call(this||Ht,v,0)}}}function e(v){if(o===clearTimeout)return clearTimeout(v);if((o===c||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(v);try{return o(v)}catch{try{return o.call(null,v)}catch{return o.call(this||Ht,v)}}}var r=[],t=!1,n,h=-1;function d(){!t||!n||(t=!1,n.length?r=n.concat(r):h=-1,r.length&&g())}function g(){if(!t){var v=i(d);t=!0;for(var _=r.length;_;){for(n=r,r=[];++h<_;)n&&n[h].run();h=-1,_=r.length}n=null,t=!1,e(v)}}s.nextTick=function(v){var _=new Array(arguments.length-1);if(arguments.length>1)for(var I=1;I<arguments.length;I++)_[I-1]=arguments[I];r.push(new b(v,_)),r.length===1&&!t&&i(g)};function b(v,_){(this||Ht).fun=v,(this||Ht).array=_}b.prototype.run=function(){(this||Ht).fun.apply(null,(this||Ht).array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={};function m(){}return s.on=m,s.addListener=m,s.once=m,s.off=m,s.removeListener=m,s.removeAllListeners=m,s.emit=m,s.prependListener=m,s.prependOnceListener=m,s.listeners=function(v){return[]},s.binding=function(v){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(v){throw new Error("process.chdir is not supported")},s.umask=function(){return 0},Pr}var Pr,En,Ht,$e,ys=nt(()=>{he(),fe(),ce(),Pr={},En=!1,Ht=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,$e=Pl(),$e.platform="browser",$e.addListener,$e.argv,$e.binding,$e.browser,$e.chdir,$e.cwd,$e.emit,$e.env,$e.listeners,$e.nextTick,$e.off,$e.on,$e.once,$e.prependListener,$e.prependOnceListener,$e.removeAllListeners,$e.removeListener,$e.title,$e.umask,$e.version,$e.versions});function Ol(){if(Sn)return Or;Sn=!0;var s=$e;function f(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function o(i,e){for(var r="",t=0,n=-1,h=0,d,g=0;g<=i.length;++g){if(g<i.length)d=i.charCodeAt(g);else{if(d===47)break;d=47}if(d===47){if(!(n===g-1||h===1))if(n!==g-1&&h===2){if(r.length<2||t!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var b=r.lastIndexOf("/");if(b!==r.length-1){b===-1?(r="",t=0):(r=r.slice(0,b),t=r.length-1-r.lastIndexOf("/")),n=g,h=0;continue}}else if(r.length===2||r.length===1){r="",t=0,n=g,h=0;continue}}e&&(r.length>0?r+="/..":r="..",t=2)}else r.length>0?r+="/"+i.slice(n+1,g):r=i.slice(n+1,g),t=g-n-1;n=g,h=0}else d===46&&h!==-1?++h:h=-1}return r}function l(i,e){var r=e.dir||e.root,t=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+t:r+i+t:t}var c={resolve:function(){for(var i="",e=!1,r,t=arguments.length-1;t>=-1&&!e;t--){var n;t>=0?n=arguments[t]:(r===void 0&&(r=s.cwd()),n=r),f(n),n.length!==0&&(i=n+"/"+i,e=n.charCodeAt(0)===47)}return i=o(i,!e),e?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(f(i),i.length===0)return".";var e=i.charCodeAt(0)===47,r=i.charCodeAt(i.length-1)===47;return i=o(i,!e),i.length===0&&!e&&(i="."),i.length>0&&r&&(i+="/"),e?"/"+i:i},isAbsolute:function(i){return f(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,e=0;e<arguments.length;++e){var r=arguments[e];f(r),r.length>0&&(i===void 0?i=r:i+="/"+r)}return i===void 0?".":c.normalize(i)},relative:function(i,e){if(f(i),f(e),i===e||(i=c.resolve(i),e=c.resolve(e),i===e))return"";for(var r=1;r<i.length&&i.charCodeAt(r)===47;++r);for(var t=i.length,n=t-r,h=1;h<e.length&&e.charCodeAt(h)===47;++h);for(var d=e.length,g=d-h,b=n<g?n:g,m=-1,v=0;v<=b;++v){if(v===b){if(g>b){if(e.charCodeAt(h+v)===47)return e.slice(h+v+1);if(v===0)return e.slice(h+v)}else n>b&&(i.charCodeAt(r+v)===47?m=v:v===0&&(m=0));break}var _=i.charCodeAt(r+v),I=e.charCodeAt(h+v);if(_!==I)break;_===47&&(m=v)}var y="";for(v=r+m+1;v<=t;++v)(v===t||i.charCodeAt(v)===47)&&(y.length===0?y+="..":y+="/..");return y.length>0?y+e.slice(h+m):(h+=m,e.charCodeAt(h)===47&&++h,e.slice(h))},_makeLong:function(i){return i},dirname:function(i){if(f(i),i.length===0)return".";for(var e=i.charCodeAt(0),r=e===47,t=-1,n=!0,h=i.length-1;h>=1;--h)if(e=i.charCodeAt(h),e===47){if(!n){t=h;break}}else n=!1;return t===-1?r?"/":".":r&&t===1?"//":i.slice(0,t)},basename:function(i,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');f(i);var r=0,t=-1,n=!0,h;if(e!==void 0&&e.length>0&&e.length<=i.length){if(e.length===i.length&&e===i)return"";var d=e.length-1,g=-1;for(h=i.length-1;h>=0;--h){var b=i.charCodeAt(h);if(b===47){if(!n){r=h+1;break}}else g===-1&&(n=!1,g=h+1),d>=0&&(b===e.charCodeAt(d)?--d===-1&&(t=h):(d=-1,t=g))}return r===t?t=g:t===-1&&(t=i.length),i.slice(r,t)}else{for(h=i.length-1;h>=0;--h)if(i.charCodeAt(h)===47){if(!n){r=h+1;break}}else t===-1&&(n=!1,t=h+1);return t===-1?"":i.slice(r,t)}},extname:function(i){f(i);for(var e=-1,r=0,t=-1,n=!0,h=0,d=i.length-1;d>=0;--d){var g=i.charCodeAt(d);if(g===47){if(!n){r=d+1;break}continue}t===-1&&(n=!1,t=d+1),g===46?e===-1?e=d:h!==1&&(h=1):e!==-1&&(h=-1)}return e===-1||t===-1||h===0||h===1&&e===t-1&&e===r+1?"":i.slice(e,t)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return l("/",i)},parse:function(i){f(i);var e={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return e;var r=i.charCodeAt(0),t=r===47,n;t?(e.root="/",n=1):n=0;for(var h=-1,d=0,g=-1,b=!0,m=i.length-1,v=0;m>=n;--m){if(r=i.charCodeAt(m),r===47){if(!b){d=m+1;break}continue}g===-1&&(b=!1,g=m+1),r===46?h===-1?h=m:v!==1&&(v=1):h!==-1&&(v=-1)}return h===-1||g===-1||v===0||v===1&&h===g-1&&h===d+1?g!==-1&&(d===0&&t?e.base=e.name=i.slice(1,g):e.base=e.name=i.slice(d,g)):(d===0&&t?(e.name=i.slice(1,h),e.base=i.slice(1,g)):(e.name=i.slice(d,h),e.base=i.slice(d,g)),e.ext=i.slice(h,g)),d>0?e.dir=i.slice(0,d-1):t&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};return c.posix=c,Or=c,Or}var Or,Sn,An,Rl=nt(()=>{he(),fe(),ce(),ys(),Or={},Sn=!1,An=Ol()}),vs={};ir(vs,{URL:()=>js,Url:()=>xs,default:()=>je,fileURLToPath:()=>_s,format:()=>Bs,parse:()=>Ls,pathToFileURL:()=>ws,resolve:()=>Ms,resolveObject:()=>Ns});function ft(){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 ar(s,f,o){if(s&&pt.isObject(s)&&s instanceof ft)return s;var l=new ft;return l.parse(s,f,o),l}function xl(){if(In)return Rr;In=!0;var s=He;function f(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function o(i,e){for(var r="",t=0,n=-1,h=0,d,g=0;g<=i.length;++g){if(g<i.length)d=i.charCodeAt(g);else{if(d===47)break;d=47}if(d===47){if(!(n===g-1||h===1))if(n!==g-1&&h===2){if(r.length<2||t!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var b=r.lastIndexOf("/");if(b!==r.length-1){b===-1?(r="",t=0):(r=r.slice(0,b),t=r.length-1-r.lastIndexOf("/")),n=g,h=0;continue}}else if(r.length===2||r.length===1){r="",t=0,n=g,h=0;continue}}e&&(r.length>0?r+="/..":r="..",t=2)}else r.length>0?r+="/"+i.slice(n+1,g):r=i.slice(n+1,g),t=g-n-1;n=g,h=0}else d===46&&h!==-1?++h:h=-1}return r}function l(i,e){var r=e.dir||e.root,t=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+t:r+i+t:t}var c={resolve:function(){for(var i="",e=!1,r,t=arguments.length-1;t>=-1&&!e;t--){var n;t>=0?n=arguments[t]:(r===void 0&&(r=s.cwd()),n=r),f(n),n.length!==0&&(i=n+"/"+i,e=n.charCodeAt(0)===47)}return i=o(i,!e),e?i.length>0?"/"+i:"/":i.length>0?i:"."},normalize:function(i){if(f(i),i.length===0)return".";var e=i.charCodeAt(0)===47,r=i.charCodeAt(i.length-1)===47;return i=o(i,!e),i.length===0&&!e&&(i="."),i.length>0&&r&&(i+="/"),e?"/"+i:i},isAbsolute:function(i){return f(i),i.length>0&&i.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var i,e=0;e<arguments.length;++e){var r=arguments[e];f(r),r.length>0&&(i===void 0?i=r:i+="/"+r)}return i===void 0?".":c.normalize(i)},relative:function(i,e){if(f(i),f(e),i===e||(i=c.resolve(i),e=c.resolve(e),i===e))return"";for(var r=1;r<i.length&&i.charCodeAt(r)===47;++r);for(var t=i.length,n=t-r,h=1;h<e.length&&e.charCodeAt(h)===47;++h);for(var d=e.length,g=d-h,b=n<g?n:g,m=-1,v=0;v<=b;++v){if(v===b){if(g>b){if(e.charCodeAt(h+v)===47)return e.slice(h+v+1);if(v===0)return e.slice(h+v)}else n>b&&(i.charCodeAt(r+v)===47?m=v:v===0&&(m=0));break}var _=i.charCodeAt(r+v),I=e.charCodeAt(h+v);if(_!==I)break;_===47&&(m=v)}var y="";for(v=r+m+1;v<=t;++v)(v===t||i.charCodeAt(v)===47)&&(y.length===0?y+="..":y+="/..");return y.length>0?y+e.slice(h+m):(h+=m,e.charCodeAt(h)===47&&++h,e.slice(h))},_makeLong:function(i){return i},dirname:function(i){if(f(i),i.length===0)return".";for(var e=i.charCodeAt(0),r=e===47,t=-1,n=!0,h=i.length-1;h>=1;--h)if(e=i.charCodeAt(h),e===47){if(!n){t=h;break}}else n=!1;return t===-1?r?"/":".":r&&t===1?"//":i.slice(0,t)},basename:function(i,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');f(i);var r=0,t=-1,n=!0,h;if(e!==void 0&&e.length>0&&e.length<=i.length){if(e.length===i.length&&e===i)return"";var d=e.length-1,g=-1;for(h=i.length-1;h>=0;--h){var b=i.charCodeAt(h);if(b===47){if(!n){r=h+1;break}}else g===-1&&(n=!1,g=h+1),d>=0&&(b===e.charCodeAt(d)?--d===-1&&(t=h):(d=-1,t=g))}return r===t?t=g:t===-1&&(t=i.length),i.slice(r,t)}else{for(h=i.length-1;h>=0;--h)if(i.charCodeAt(h)===47){if(!n){r=h+1;break}}else t===-1&&(n=!1,t=h+1);return t===-1?"":i.slice(r,t)}},extname:function(i){f(i);for(var e=-1,r=0,t=-1,n=!0,h=0,d=i.length-1;d>=0;--d){var g=i.charCodeAt(d);if(g===47){if(!n){r=d+1;break}continue}t===-1&&(n=!1,t=d+1),g===46?e===-1?e=d:h!==1&&(h=1):e!==-1&&(h=-1)}return e===-1||t===-1||h===0||h===1&&e===t-1&&e===r+1?"":i.slice(e,t)},format:function(i){if(i===null||typeof i!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof i);return l("/",i)},parse:function(i){f(i);var e={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return e;var r=i.charCodeAt(0),t=r===47,n;t?(e.root="/",n=1):n=0;for(var h=-1,d=0,g=-1,b=!0,m=i.length-1,v=0;m>=n;--m){if(r=i.charCodeAt(m),r===47){if(!b){d=m+1;break}continue}g===-1&&(b=!1,g=m+1),r===46?h===-1?h=m:v!==1&&(v=1):h!==-1&&(v=-1)}return h===-1||g===-1||v===0||v===1&&h===g-1&&h===d+1?g!==-1&&(d===0&&t?e.base=e.name=i.slice(1,g):e.base=e.name=i.slice(d,g)):(d===0&&t?(e.name=i.slice(1,h),e.base=i.slice(1,g)):(e.name=i.slice(d,h),e.base=i.slice(d,g)),e.ext=i.slice(h,g)),d>0?e.dir=i.slice(0,d-1):t&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};return c.posix=c,Rr=c,Rr}function Bl(s){if(typeof s=="string")s=new URL(s);else if(!(s instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(s.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Br?Ml(s):Nl(s)}function Ml(s){let f=s.hostname,o=s.pathname;for(let l=0;l<o.length;l++)if(o[l]==="%"){let c=o.codePointAt(l+2)||32;if(o[l+1]==="2"&&c===102||o[l+1]==="5"&&c===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(o=o.replace(ks,"\\"),o=decodeURIComponent(o),f!=="")return`\\\\${f}${o}`;{let l=o.codePointAt(1)|32,c=o[2];if(l<As||l>Is||c!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return o.slice(1)}}function Nl(s){if(s.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let f=s.pathname;for(let o=0;o<f.length;o++)if(f[o]==="%"){let l=f.codePointAt(o+2)||32;if(f[o+1]==="2"&&l===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(f)}function Ll(s){let f=kn.resolve(s),o=s.charCodeAt(s.length-1);(o===Ss||Br&&o===Es)&&f[f.length-1]!==kn.sep&&(f+="/");let l=new URL("file://");return f.includes("%")&&(f=f.replace(Ts,"%25")),!Br&&f.includes("\\")&&(f=f.replace(Cs,"%5C")),f.includes(`
- `)&&(f=f.replace(Ps,"%0A")),f.includes("\r")&&(f=f.replace(Os,"%0D")),f.includes(" ")&&(f=f.replace(Rs,"%09")),l.pathname=f,l}function _s(s){if(typeof s=="string")s=new URL(s);else if(!(s instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(s.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return Mr?jl(s):Ul(s)}function jl(s){let f=s.hostname,o=s.pathname;for(let l=0;l<o.length;l++)if(o[l]==="%"){let c=o.codePointAt(l+2)||32;if(o[l+1]==="2"&&c===102||o[l+1]==="5"&&c===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(o=o.replace(qs,"\\"),o=decodeURIComponent(o),f!=="")return`\\\\${f}${o}`;{let l=o.codePointAt(1)|32,c=o[2];if(l<Fs||l>Ws||c!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return o.slice(1)}}function Ul(s){if(s.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let f=s.pathname;for(let o=0;o<f.length;o++)if(f[o]==="%"){let l=f.codePointAt(o+2)||32;if(f[o+1]==="2"&&l===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(f)}function ws(s){let f=An.resolve(s),o=s.charCodeAt(s.length-1);(o===Ds||Mr&&o===Us)&&f[f.length-1]!==An.sep&&(f+="/");let l=new URL("file://");return f.includes("%")&&(f=f.replace($s,"%25")),!Mr&&f.includes("\\")&&(f=f.replace(Vs,"%5C")),f.includes(`
- `)&&(f=f.replace(Hs,"%0A")),f.includes("\r")&&(f=f.replace(zs,"%0D")),f.includes(" ")&&(f=f.replace(Gs,"%09")),l.pathname=f,l}var je,oo,pt,so,ao,lo,uo,_r,ii,ni,oi,ho,co,wr,Vt,Er,Rr,In,kn,fo,Es,Ss,As,Is,Br,ks,Ts,Cs,Ps,Os,Rs,po,xs,Bs,Ms,Ns,Ls,js,Us,Ds,Fs,Ws,Mr,qs,$s,Vs,Hs,zs,Gs,Dl=nt(()=>{he(),fe(),ce(),Al(),kl(),Cl(),Rl(),ys(),je={},oo=jt,pt={isString:function(s){return typeof s=="string"},isObject:function(s){return typeof s=="object"&&s!==null},isNull:function(s){return s===null},isNullOrUndefined:function(s){return s==null}},je.parse=ar,je.resolve=function(s,f){return ar(s,!1,!0).resolve(f)},je.resolveObject=function(s,f){return s?ar(s,!1,!0).resolveObject(f):f},je.format=function(s){return pt.isString(s)&&(s=ar(s)),s instanceof ft?s.format():ft.prototype.format.call(s)},je.Url=ft,so=/^([a-z0-9.+-]+:)/i,ao=/:[0-9]*$/,lo=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,uo=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
- `," "]),_r=["'"].concat(uo),ii=["%","/","?",";","#"].concat(_r),ni=["/","?","#"],oi=/^[+a-z0-9A-Z_-]{0,63}$/,ho=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,co={javascript:!0,"javascript:":!0},wr={javascript:!0,"javascript:":!0},Vt={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Er=bt,ft.prototype.parse=function(s,f,o){if(!pt.isString(s))throw new TypeError("Parameter 'url' must be a string, not "+typeof s);var l=s.indexOf("?"),c=l!==-1&&l<s.indexOf("#")?"?":"#",i=s.split(c);i[0]=i[0].replace(/\\/g,"/");var e=s=i.join(c);if(e=e.trim(),!o&&s.split("#").length===1){var r=lo.exec(e);if(r)return this.path=e,this.href=e,this.pathname=r[1],r[2]?(this.search=r[2],this.query=f?Er.parse(this.search.substr(1)):this.search.substr(1)):f&&(this.search="",this.query={}),this}var t=so.exec(e);if(t){var n=(t=t[0]).toLowerCase();this.protocol=n,e=e.substr(t.length)}if(o||t||e.match(/^\/\/[^@\/]+@[^@\/]+/)){var h=e.substr(0,2)==="//";!h||t&&wr[t]||(e=e.substr(2),this.slashes=!0)}if(!wr[t]&&(h||t&&!Vt[t])){for(var d,g,b=-1,m=0;m<ni.length;m++)(v=e.indexOf(ni[m]))!==-1&&(b===-1||v<b)&&(b=v);for((g=b===-1?e.lastIndexOf("@"):e.lastIndexOf("@",b))!==-1&&(d=e.slice(0,g),e=e.slice(g+1),this.auth=decodeURIComponent(d)),b=-1,m=0;m<ii.length;m++){var v;(v=e.indexOf(ii[m]))!==-1&&(b===-1||v<b)&&(b=v)}b===-1&&(b=e.length),this.host=e.slice(0,b),e=e.slice(b),this.parseHost(),this.hostname=this.hostname||"";var _=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!_)for(var I=this.hostname.split(/\./),y=(m=0,I.length);m<y;m++){var E=I[m];if(E&&!E.match(oi)){for(var N="",B=0,S=E.length;B<S;B++)E.charCodeAt(B)>127?N+="x":N+=E[B];if(!N.match(oi)){var k=I.slice(0,m),M=I.slice(m+1),J=E.match(ho);J&&(k.push(J[1]),M.unshift(J[2])),M.length&&(e="/"+M.join(".")+e),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=oo.toASCII(this.hostname));var Y=this.port?":"+this.port:"",se=this.hostname||"";this.host=se+Y,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),e[0]!=="/"&&(e="/"+e))}if(!co[n])for(m=0,y=_r.length;m<y;m++){var O=_r[m];if(e.indexOf(O)!==-1){var K=encodeURIComponent(O);K===O&&(K=escape(O)),e=e.split(O).join(K)}}var X=e.indexOf("#");X!==-1&&(this.hash=e.substr(X),e=e.slice(0,X));var W=e.indexOf("?");if(W!==-1?(this.search=e.substr(W),this.query=e.substr(W+1),f&&(this.query=Er.parse(this.query)),e=e.slice(0,W)):f&&(this.search="",this.query={}),e&&(this.pathname=e),Vt[n]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){Y=this.pathname||"";var ge=this.search||"";this.path=Y+ge}return this.href=this.format(),this},ft.prototype.format=function(){var s=this.auth||"";s&&(s=(s=encodeURIComponent(s)).replace(/%3A/i,":"),s+="@");var f=this.protocol||"",o=this.pathname||"",l=this.hash||"",c=!1,i="";this.host?c=s+this.host:this.hostname&&(c=s+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(c+=":"+this.port)),this.query&&pt.isObject(this.query)&&Object.keys(this.query).length&&(i=Er.stringify(this.query));var e=this.search||i&&"?"+i||"";return f&&f.substr(-1)!==":"&&(f+=":"),this.slashes||(!f||Vt[f])&&c!==!1?(c="//"+(c||""),o&&o.charAt(0)!=="/"&&(o="/"+o)):c||(c=""),l&&l.charAt(0)!=="#"&&(l="#"+l),e&&e.charAt(0)!=="?"&&(e="?"+e),f+c+(o=o.replace(/[?#]/g,function(r){return encodeURIComponent(r)}))+(e=e.replace("#","%23"))+l},ft.prototype.resolve=function(s){return this.resolveObject(ar(s,!1,!0)).format()},ft.prototype.resolveObject=function(s){if(pt.isString(s)){var f=new ft;f.parse(s,!1,!0),s=f}for(var o=new ft,l=Object.keys(this),c=0;c<l.length;c++){var i=l[c];o[i]=this[i]}if(o.hash=s.hash,s.href==="")return o.href=o.format(),o;if(s.slashes&&!s.protocol){for(var e=Object.keys(s),r=0;r<e.length;r++){var t=e[r];t!=="protocol"&&(o[t]=s[t])}return Vt[o.protocol]&&o.hostname&&!o.pathname&&(o.path=o.pathname="/"),o.href=o.format(),o}if(s.protocol&&s.protocol!==o.protocol){if(!Vt[s.protocol]){for(var n=Object.keys(s),h=0;h<n.length;h++){var d=n[h];o[d]=s[d]}return o.href=o.format(),o}if(o.protocol=s.protocol,s.host||wr[s.protocol])o.pathname=s.pathname;else{for(var g=(s.pathname||"").split("/");g.length&&!(s.host=g.shift()););s.host||(s.host=""),s.hostname||(s.hostname=""),g[0]!==""&&g.unshift(""),g.length<2&&g.unshift(""),o.pathname=g.join("/")}if(o.search=s.search,o.query=s.query,o.host=s.host||"",o.auth=s.auth,o.hostname=s.hostname||s.host,o.port=s.port,o.pathname||o.search){var b=o.pathname||"",m=o.search||"";o.path=b+m}return o.slashes=o.slashes||s.slashes,o.href=o.format(),o}var v=o.pathname&&o.pathname.charAt(0)==="/",_=s.host||s.pathname&&s.pathname.charAt(0)==="/",I=_||v||o.host&&s.pathname,y=I,E=o.pathname&&o.pathname.split("/")||[],N=(g=s.pathname&&s.pathname.split("/")||[],o.protocol&&!Vt[o.protocol]);if(N&&(o.hostname="",o.port=null,o.host&&(E[0]===""?E[0]=o.host:E.unshift(o.host)),o.host="",s.protocol&&(s.hostname=null,s.port=null,s.host&&(g[0]===""?g[0]=s.host:g.unshift(s.host)),s.host=null),I=I&&(g[0]===""||E[0]==="")),_)o.host=s.host||s.host===""?s.host:o.host,o.hostname=s.hostname||s.hostname===""?s.hostname:o.hostname,o.search=s.search,o.query=s.query,E=g;else if(g.length)E||(E=[]),E.pop(),E=E.concat(g),o.search=s.search,o.query=s.query;else if(!pt.isNullOrUndefined(s.search))return N&&(o.hostname=o.host=E.shift(),(J=!!(o.host&&o.host.indexOf("@")>0)&&o.host.split("@"))&&(o.auth=J.shift(),o.host=o.hostname=J.shift())),o.search=s.search,o.query=s.query,pt.isNull(o.pathname)&&pt.isNull(o.search)||(o.path=(o.pathname?o.pathname:"")+(o.search?o.search:"")),o.href=o.format(),o;if(!E.length)return o.pathname=null,o.search?o.path="/"+o.search:o.path=null,o.href=o.format(),o;for(var B=E.slice(-1)[0],S=(o.host||s.host||E.length>1)&&(B==="."||B==="..")||B==="",k=0,M=E.length;M>=0;M--)(B=E[M])==="."?E.splice(M,1):B===".."?(E.splice(M,1),k++):k&&(E.splice(M,1),k--);if(!I&&!y)for(;k--;k)E.unshift("..");!I||E[0]===""||E[0]&&E[0].charAt(0)==="/"||E.unshift(""),S&&E.join("/").substr(-1)!=="/"&&E.push("");var J,Y=E[0]===""||E[0]&&E[0].charAt(0)==="/";return N&&(o.hostname=o.host=Y?"":E.length?E.shift():"",(J=!!(o.host&&o.host.indexOf("@")>0)&&o.host.split("@"))&&(o.auth=J.shift(),o.host=o.hostname=J.shift())),(I=I||o.host&&E.length)&&!Y&&E.unshift(""),E.length?o.pathname=E.join("/"):(o.pathname=null,o.path=null),pt.isNull(o.pathname)&&pt.isNull(o.search)||(o.path=(o.pathname?o.pathname:"")+(o.search?o.search:"")),o.auth=s.auth||o.auth,o.slashes=o.slashes||s.slashes,o.href=o.format(),o},ft.prototype.parseHost=function(){var s=this.host,f=ao.exec(s);f&&((f=f[0])!==":"&&(this.port=f.substr(1)),s=s.substr(0,s.length-f.length)),s&&(this.hostname=s)},je.Url,je.format,je.resolve,je.resolveObject,Rr={},In=!1,kn=xl(),fo=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0,je.URL=typeof URL<"u"?URL:null,je.pathToFileURL=Ll,je.fileURLToPath=Bl,je.Url,je.format,je.resolve,je.resolveObject,je.URL,Es=92,Ss=47,As=97,Is=122,Br=fo==="win32",ks=/\//g,Ts=/%/g,Cs=/\\/g,Ps=/\n/g,Os=/\r/g,Rs=/\t/g,po=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0,je.URL=typeof URL<"u"?URL:null,je.pathToFileURL=ws,je.fileURLToPath=_s,xs=je.Url,Bs=je.format,Ms=je.resolve,Ns=je.resolveObject,Ls=je.parse,js=je.URL,Us=92,Ds=47,Fs=97,Ws=122,Mr=po==="win32",qs=/\//g,$s=/%/g,Vs=/\\/g,Hs=/\n/g,zs=/\r/g,Gs=/\t/g}),Fl=be((s,f)=>{he(),fe(),ce(),f.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}}),Nn=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0}),s.BufferedDuplex=void 0,s.writev=l;var f=Zt(),o=(Xe(),De(Je));function l(i,e){let r=new Array(i.length);for(let t=0;t<i.length;t++)typeof i[t].chunk=="string"?r[t]=o.Buffer.from(i[t].chunk,"utf8"):r[t]=i[t].chunk;this._write(o.Buffer.concat(r),"binary",e)}var c=class extends f.Duplex{constructor(i,e,r){super({objectMode:!0}),this.proxy=e,this.socket=r,this.writeQueue=[],i.objectMode||(this._writev=l.bind(this)),this.isSocketOpen=!1,this.proxy.on("data",t=>{!this.destroyed&&this.readable&&this.push(t)})}_read(i){this.proxy.read(i)}_write(i,e,r){this.isSocketOpen?this.writeToProxy(i,e,r):this.writeQueue.push({chunk:i,encoding:e,cb:r})}_final(i){this.writeQueue=[],this.proxy.end(i)}_destroy(i,e){this.writeQueue=[],this.proxy.destroy(),e(i)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(i,e,r){this.proxy.write(i,e)===!1?this.proxy.once("drain",r):r()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:i,encoding:e,cb:r}=this.writeQueue.shift();this.writeToProxy(i,e,r)}}};s.BufferedDuplex=c}),Sr=be(s=>{he(),fe(),ce();var f=s&&s.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(s,"__esModule",{value:!0}),s.streamBuilder=s.browserStreamBuilder=void 0;var o=(Xe(),De(Je)),l=f(Fl()),c=f(Tt()),i=Zt(),e=f(Dr()),r=Nn(),t=(0,c.default)("mqttjs:ws"),n=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function h(I,y){let E=`${I.protocol}://${I.hostname}:${I.port}${I.path}`;return typeof I.transformWsUrl=="function"&&(E=I.transformWsUrl(E,I,y)),E}function d(I){let y=I;return I.port||(I.protocol==="wss"?y.port=443:y.port=80),I.path||(y.path="/"),I.wsOptions||(y.wsOptions={}),!e.default&&!I.forceNativeWebSocket&&I.protocol==="wss"&&n.forEach(E=>{Object.prototype.hasOwnProperty.call(I,E)&&!Object.prototype.hasOwnProperty.call(I.wsOptions,E)&&(y.wsOptions[E]=I[E])}),y}function g(I){let y=d(I);if(y.hostname||(y.hostname=y.host),!y.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let E=new URL(document.URL);y.hostname=E.hostname,y.port||(y.port=Number(E.port))}return y.objectMode===void 0&&(y.objectMode=!(y.binary===!0||y.binary===void 0)),y}function b(I,y,E){t("createWebSocket"),t(`protocol: ${E.protocolId} ${E.protocolVersion}`);let N=E.protocolId==="MQIsdp"&&E.protocolVersion===3?"mqttv3.1":"mqtt";t(`creating new Websocket for url: ${y} and protocol: ${N}`);let B;return E.createWebsocket?B=E.createWebsocket(y,[N],E):B=new l.default(y,[N],E.wsOptions),B}function m(I,y){let E=y.protocolId==="MQIsdp"&&y.protocolVersion===3?"mqttv3.1":"mqtt",N=h(y,I),B;return y.createWebsocket?B=y.createWebsocket(N,[E],y):B=new WebSocket(N,[E]),B.binaryType="arraybuffer",B}var v=(I,y)=>{t("streamBuilder");let E=d(y);E.hostname=E.hostname||E.host||"localhost";let N=h(E,I),B=b(I,N,E),S=l.default.createWebSocketStream(B,E.wsOptions);return S.url=N,B.on("close",()=>{S.destroy()}),S};s.streamBuilder=v;var _=(I,y)=>{t("browserStreamBuilder");let E,N=g(y).browserBufferSize||1024*512,B=y.browserBufferTimeout||1e3,S=!y.objectMode,k=m(I,y),M=Y(y,W,ge);y.objectMode||(M._writev=r.writev.bind(M)),M.on("close",()=>{k.close()});let J=typeof k.addEventListener<"u";k.readyState===k.OPEN?(E=M,E.socket=k):(E=new r.BufferedDuplex(y,M,k),J?k.addEventListener("open",se):k.onopen=se),J?(k.addEventListener("close",O),k.addEventListener("error",K),k.addEventListener("message",X)):(k.onclose=O,k.onerror=K,k.onmessage=X);function Y(de,le,Ee){let z=new i.Transform({objectMode:de.objectMode});return z._write=le,z._flush=Ee,z}function se(){t("WebSocket onOpen"),E instanceof r.BufferedDuplex&&E.socketReady()}function O(de){t("WebSocket onClose",de),E.end(),E.destroy()}function K(de){t("WebSocket onError",de);let le=new Error("WebSocket error");le.event=de,E.destroy(le)}async function X(de){if(!M||M.destroyed||!M.readable)return;let{data:le}=de;le instanceof ArrayBuffer?le=o.Buffer.from(le):le instanceof Blob?le=o.Buffer.from(await new Response(le).arrayBuffer()):le=o.Buffer.from(le,"utf8"),M.push(le)}function W(de,le,Ee){if(k.bufferedAmount>N){setTimeout(W,B,de,le,Ee);return}S&&typeof de=="string"&&(de=o.Buffer.from(de,"utf8"));try{k.send(de)}catch(z){return Ee(z)}Ee()}function ge(de){k.close(),de()}return E};s.browserStreamBuilder=_}),Ln={};ir(Ln,{Server:()=>Ve,Socket:()=>Ve,Stream:()=>Ve,_createServerHandle:()=>Ve,_normalizeArgs:()=>Ve,_setSimultaneousAccepts:()=>Ve,connect:()=>Ve,createConnection:()=>Ve,createServer:()=>Ve,default:()=>Ks,isIP:()=>Ve,isIPv4:()=>Ve,isIPv6:()=>Ve});function Ve(){throw new Error("Node.js net module is not supported by JSPM core outside of Node.js")}var Ks,Qs=nt(()=>{he(),fe(),ce(),Ks={_createServerHandle:Ve,_normalizeArgs:Ve,_setSimultaneousAccepts:Ve,connect:Ve,createConnection:Ve,createServer:Ve,isIP:Ve,isIPv4:Ve,isIPv6:Ve,Server:Ve,Socket:Ve,Stream:Ve}}),go=be(s=>{he(),fe(),ce();var f=s&&s.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(s,"__esModule",{value:!0});var o=f((Qs(),De(Ln))),l=f(Tt()),c=(0,l.default)("mqttjs:tcp"),i=(e,r)=>{r.port=r.port||1883,r.hostname=r.hostname||r.host||"localhost";let{port:t,path:n}=r,h=r.hostname;return c("port %d and host %s",t,h),o.default.createConnection({port:t,host:h,path:n})};s.default=i}),Ys={};ir(Ys,{default:()=>Js});var Js,Wl=nt(()=>{he(),fe(),ce(),Js={}}),bo=be(s=>{he(),fe(),ce();var f=s&&s.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(s,"__esModule",{value:!0});var o=f((Wl(),De(Ys))),l=f((Qs(),De(Ln))),c=f(Tt()),i=(0,c.default)("mqttjs:tls"),e=(r,t)=>{t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",l.default.isIP(t.host)===0&&(t.servername=t.host),t.rejectUnauthorized=t.rejectUnauthorized!==!1,delete t.path,i("port %d host %s rejectUnauthorized %b",t.port,t.host,t.rejectUnauthorized);let n=o.default.connect(t);n.on("secureConnect",()=>{t.rejectUnauthorized&&!n.authorized?n.emit("error",new Error("TLS not authorized")):n.removeListener("error",h)});function h(d){t.rejectUnauthorized&&r.emit("error",d),n.end()}return n.on("error",h),n};s.default=e}),mo=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0});var f=(Xe(),De(Je)),o=Zt(),l=Nn(),c,i,e;function r(){let g=new o.Transform;return g._write=(b,m,v)=>{c.send({data:b.buffer,success(){v()},fail(_){v(new Error(_))}})},g._flush=b=>{c.close({success(){b()}})},g}function t(g){g.hostname||(g.hostname="localhost"),g.path||(g.path="/"),g.wsOptions||(g.wsOptions={})}function n(g,b){let m=g.protocol==="wxs"?"wss":"ws",v=`${m}://${g.hostname}${g.path}`;return g.port&&g.port!==80&&g.port!==443&&(v=`${m}://${g.hostname}:${g.port}${g.path}`),typeof g.transformWsUrl=="function"&&(v=g.transformWsUrl(v,g,b)),v}function h(){c.onOpen(()=>{e.socketReady()}),c.onMessage(g=>{let{data:b}=g;b instanceof ArrayBuffer?b=f.Buffer.from(b):b=f.Buffer.from(b,"utf8"),i.push(b)}),c.onClose(()=>{e.emit("close"),e.end(),e.destroy()}),c.onError(g=>{let b=new Error(g.errMsg);e.destroy(b)})}var d=(g,b)=>{if(b.hostname=b.hostname||b.host,!b.hostname)throw new Error("Could not determine host. Specify host manually.");let m=b.protocolId==="MQIsdp"&&b.protocolVersion===3?"mqttv3.1":"mqtt";t(b);let v=n(b,g);c=wx.connectSocket({url:v,protocols:[m]}),i=r(),e=new l.BufferedDuplex(b,i,c),e._destroy=(I,y)=>{c.close({success(){y&&y(I)}})};let _=e.destroy;return e.destroy=(I,y)=>(e.destroy=_,setTimeout(()=>{c.close({fail(){e._destroy(I,y)}})},0),e),h(),e};s.default=d}),yo=be(s=>{he(),fe(),ce(),Object.defineProperty(s,"__esModule",{value:!0});var f=(Xe(),De(Je)),o=Zt(),l=Nn(),c,i,e,r=!1;function t(){let b=new o.Transform;return b._write=(m,v,_)=>{c.sendSocketMessage({data:m.buffer,success(){_()},fail(){_(new Error)}})},b._flush=m=>{c.closeSocket({success(){m()}})},b}function n(b){b.hostname||(b.hostname="localhost"),b.path||(b.path="/"),b.wsOptions||(b.wsOptions={})}function h(b,m){let v=b.protocol==="alis"?"wss":"ws",_=`${v}://${b.hostname}${b.path}`;return b.port&&b.port!==80&&b.port!==443&&(_=`${v}://${b.hostname}:${b.port}${b.path}`),typeof b.transformWsUrl=="function"&&(_=b.transformWsUrl(_,b,m)),_}function d(){r||(r=!0,c.onSocketOpen(()=>{e.socketReady()}),c.onSocketMessage(b=>{if(typeof b.data=="string"){let m=f.Buffer.from(b.data,"base64");i.push(m)}else{let m=new FileReader;m.addEventListener("load",()=>{let v=m.result;v instanceof ArrayBuffer?v=f.Buffer.from(v):v=f.Buffer.from(v,"utf8"),i.push(v)}),m.readAsArrayBuffer(b.data)}}),c.onSocketClose(()=>{e.end(),e.destroy()}),c.onSocketError(b=>{e.destroy(b)}))}var g=(b,m)=>{if(m.hostname=m.hostname||m.host,!m.hostname)throw new Error("Could not determine host. Specify host manually.");let v=m.protocolId==="MQIsdp"&&m.protocolVersion===3?"mqttv3.1":"mqtt";n(m);let _=h(m,b);return c=m.my,c.connectSocket({url:_,protocols:v}),i=t(),e=new l.BufferedDuplex(m,i,c),d(),e};s.default=g}),ql=be(s=>{he(),fe(),ce();var f=s&&s.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(s,"__esModule",{value:!0}),s.connectAsync=h;var o=f(Tt()),l=f((Dl(),De(vs))),c=f(yn()),i=f(Dr());typeof(Le==null?void 0:Le.nextTick)!="function"&&(Le.nextTick=setImmediate);var e=(0,o.default)("mqttjs"),r=null;function t(d){let g;d.auth&&(g=d.auth.match(/^(.+):(.+)$/),g?(d.username=g[1],d.password=g[2]):d.username=d.auth)}function n(d,g){var b,m,v;if(e("connecting to an MQTT broker..."),typeof d=="object"&&!g&&(g=d,d=""),g=g||{},d&&typeof d=="string"){let y=l.default.parse(d,!0),E={};if(y.port!=null&&(E.port=Number(y.port)),E.host=y.hostname,E.query=y.query,E.auth=y.auth,E.protocol=y.protocol,E.path=y.path,g=Object.assign(Object.assign({},E),g),!g.protocol)throw new Error("Missing protocol");g.protocol=g.protocol.replace(/:$/,"")}if(g.unixSocket=g.unixSocket||((b=g.protocol)===null||b===void 0?void 0:b.includes("+unix")),g.unixSocket?g.protocol=g.protocol.replace("+unix",""):!(!((m=g.protocol)===null||m===void 0)&&m.startsWith("ws"))&&!(!((v=g.protocol)===null||v===void 0)&&v.startsWith("wx"))&&delete g.path,t(g),g.query&&typeof g.query.clientId=="string"&&(g.clientId=g.query.clientId),g.cert&&g.key)if(g.protocol){if(["mqtts","wss","wxs","alis"].indexOf(g.protocol)===-1)switch(g.protocol){case"mqtt":g.protocol="mqtts";break;case"ws":g.protocol="wss";break;case"wx":g.protocol="wxs";break;case"ali":g.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${g.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(r||(r={},!i.default&&!g.forceNativeWebSocket?(r.ws=Sr().streamBuilder,r.wss=Sr().streamBuilder,r.mqtt=go().default,r.tcp=go().default,r.ssl=bo().default,r.tls=r.ssl,r.mqtts=bo().default):(r.ws=Sr().browserStreamBuilder,r.wss=Sr().browserStreamBuilder,r.wx=mo().default,r.wxs=mo().default,r.ali=yo().default,r.alis=yo().default)),!r[g.protocol]){let y=["mqtts","wss"].indexOf(g.protocol)!==-1;g.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((E,N)=>y&&N%2===0?!1:typeof r[E]=="function")[0]}if(g.clean===!1&&!g.clientId)throw new Error("Missing clientId for unclean clients");g.protocol&&(g.defaultProtocol=g.protocol);function _(y){return g.servers&&((!y._reconnectCount||y._reconnectCount===g.servers.length)&&(y._reconnectCount=0),g.host=g.servers[y._reconnectCount].host,g.port=g.servers[y._reconnectCount].port,g.protocol=g.servers[y._reconnectCount].protocol?g.servers[y._reconnectCount].protocol:g.defaultProtocol,g.hostname=g.host,y._reconnectCount++),e("calling streambuilder for",g.protocol),r[g.protocol](y,g)}let I=new c.default(_,g);return I.on("error",()=>{}),I}function h(d,g,b=!0){return new Promise((m,v)=>{let _=n(d,g),I={connect:E=>{y(),m(_)},end:()=>{y(),m(_)},error:E=>{y(),_.end(),v(E)}};b===!1&&(I.close=()=>{I.error(new Error("Couldn't connect to server"))});function y(){Object.keys(I).forEach(E=>{_.off(E,I[E])})}Object.keys(I).forEach(E=>{_.on(E,I[E])})})}s.default=n}),vo=be(s=>{he(),fe(),ce();var f=s&&s.__createBinding||(Object.create?function(b,m,v,_){_===void 0&&(_=v);var I=Object.getOwnPropertyDescriptor(m,v);(!I||("get"in I?!m.__esModule:I.writable||I.configurable))&&(I={enumerable:!0,get:function(){return m[v]}}),Object.defineProperty(b,_,I)}:function(b,m,v,_){_===void 0&&(_=v),b[_]=m[v]}),o=s&&s.__setModuleDefault||(Object.create?function(b,m){Object.defineProperty(b,"default",{enumerable:!0,value:m})}:function(b,m){b.default=m}),l=s&&s.__importStar||function(){var b=function(m){return b=Object.getOwnPropertyNames||function(v){var _=[];for(var I in v)Object.prototype.hasOwnProperty.call(v,I)&&(_[_.length]=I);return _},b(m)};return function(m){if(m&&m.__esModule)return m;var v={};if(m!=null)for(var _=b(m),I=0;I<_.length;I++)_[I]!=="default"&&f(v,m,_[I]);return o(v,m),v}}(),c=s&&s.__exportStar||function(b,m){for(var v in b)v!=="default"&&!Object.prototype.hasOwnProperty.call(m,v)&&f(m,b,v)},i=s&&s.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(s,"__esModule",{value:!0}),s.ReasonCodes=s.KeepaliveManager=s.UniqueMessageIdProvider=s.DefaultMessageIdProvider=s.Store=s.MqttClient=s.connectAsync=s.connect=s.Client=void 0;var e=i(yn());s.MqttClient=e.default;var r=i(Yo());s.DefaultMessageIdProvider=r.default;var t=i(Sl());s.UniqueMessageIdProvider=t.default;var n=i(Jo());s.Store=n.default;var h=l(ql());s.connect=h.default,Object.defineProperty(s,"connectAsync",{enumerable:!0,get:function(){return h.connectAsync}});var d=i(ds());s.KeepaliveManager=d.default,s.Client=e.default,c(yn(),s),c(or(),s);var g=Ur();Object.defineProperty(s,"ReasonCodes",{enumerable:!0,get:function(){return g.ReasonCodes}})}),$l=be(s=>{he(),fe(),ce();var f=s&&s.__createBinding||(Object.create?function(e,r,t,n){n===void 0&&(n=t);var h=Object.getOwnPropertyDescriptor(r,t);(!h||("get"in h?!r.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,h)}:function(e,r,t,n){n===void 0&&(n=t),e[n]=r[t]}),o=s&&s.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),l=s&&s.__importStar||function(){var e=function(r){return e=Object.getOwnPropertyNames||function(t){var n=[];for(var h in t)Object.prototype.hasOwnProperty.call(t,h)&&(n[n.length]=h);return n},e(r)};return function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var n=e(r),h=0;h<n.length;h++)n[h]!=="default"&&f(t,r,n[h]);return o(t,r),t}}(),c=s&&s.__exportStar||function(e,r){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(r,t)&&f(r,e,t)};Object.defineProperty(s,"__esModule",{value:!0});var i=l(vo());s.default=i,c(vo(),s)});const Vl=$l();/*! Bundled license information:
- @jspm/core/nodelibs/browser/buffer.js:
- (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
- safe-buffer/index.js:
- (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
- */class Hl{constructor(f,o,l,c,i){Ne(this,"host");Ne(this,"port");Ne(this,"username");Ne(this,"password");Ne(this,"path");Ne(this,"client");Ne(this,"topicMap",new Map);this.host=f,this.port=o,this.username=l,this.password=c,this.path=i,this.connect()}connect(){this.client=Vl.connect({host:this.host,port:this.port,hostname:this.host,username:this.username,password:this.password,path:this.path,protocol:location.protocol==="http:"?"ws":"wss",keepalive:15}),this.client.once("connect",()=>this.onConnect()),this.client.on("reconnect",()=>console.debug(" mq reconnect.")),this.client.on("disconnect",f=>console.debug(" mq disconnect.",f)),this.client.on("close",()=>console.debug(" mq close."))}onConnect(){this.client.removeAllListeners("message"),this.client.on("message",(f,o,l)=>this.onMessage(f,o.toString(),l)),Array.from(this.topicMap.keys()).length>0&&this.client.subscribe(Array.from(this.topicMap.keys()),(f,o)=>{f?console.error("subscribe to mq error: ",f,o):o?console.debug("subscribe to mq granted: ",o):console.warn("No subscription grants received.")})}onMessage(f,o,l){try{console.debug(l);const c=JSON.parse(o),i=this.topicMap.get(f);i?i.forEach(e=>{try{e(c.data,c.type)}catch(r){console.debug(" process topic cb fun error.",r)}}):console.debug(" can't find subscribe callback.")}catch(c){console.error(" process message error.",c)}}subscribe(f,o){var l,c;this.topicMap.has(f)||((l=this.client)==null||l.subscribe(f,(i,e)=>{i?console.error("subscribe to mq error: ",i,e):e?console.debug("subscribe to mq granted: ",e):console.warn(`No subscription grants received for topic: ${f}`)}),this.topicMap.set(f,new Set)),(c=this.topicMap.get(f))==null||c.add(o)}unsubscribe(f,o){var l,c,i;this.topicMap.has(f)&&(o?(l=this.topicMap.get(f))==null||l.delete(o):(c=this.topicMap.get(f))==null||c.clear(),this.topicMap.get(f).size<=0&&(this.topicMap.delete(f),(i=this.client)==null||i.unsubscribe(f)))}}let Tn;function zl(s){const f={host:"192.168.0.119",port:8083,username:"admin",password:"public",path:"/mqtt",use:!0},o={...f};if(o.use){const l=o.username||f.username,c=o.password||f.password;Tn=new Hl(o.host,o.port,l,c,o.path)}else console.error("MQTT is disabled in the configuration.")}const Gl={class:"vehicle-operation flex items-center justify-center"},Kl={class:"vehicle-content flex flex-col"},Ql={class:"vehicle-content-top flex items-center"},Yl=["aria-label"],Jl={class:"vehicle-operation-car-options"},Xl={class:"click-wrap"},Zl={class:"vehicle-info-content",style:{"margin-top":"0",padding:"0"}},eu={class:"vehicle-info-desc"},tu={class:"vehicle-info-content"},ru={class:"vehicle-info-desc"},iu={class:"vehicle-info-desc"},nu={class:"vehicle-info-desc"},ou={class:"vehicle-info-desc"},su={class:"vehicle-info-desc"},au={class:"vehicle-info-desc"},lu={class:"vehicle-info-desc"},uu={class:"truck-wrapper flex-1"},hu={class:"truck-img-wrap"},cu={class:"license_plate"},fu=pa({__name:"CarArrive",setup(s){const f=ga(),o=f.params.ccmNo||"5";f.params.positionNo;const l=br(!1),c=br({id:"",licensePlate:"",destination:"",typeConfigId:"",ccmNo:"",ccmNo_dictText:"",shift:"",shiftGroup:"",shiftGroup_dictText:"",shift_dictText:"",arrivalTime:"",outTime:"",steel:"",size:"",amountTotal:0,licensePlateStatus:0,hasDestination:!1,steelReachTime:"",positionNum:""}),i=ba(()=>c.value.ccmNo?Wn[String(c.value.ccmNo)].map(m=>m):[]),e=br([]),r=br(!1),t=async()=>{try{let m=[];if(localStorage.getItem("lg_cars")){const{cars_list:v,time:_}=JSON.parse(localStorage.getItem("lg_cars")||"");new Date().getTime()-_<1e3*60*60*24&&(m=v)}if(!m.length){const{data:v}=await Vr.get("/jeecgbootbus/sys/dict/getAllLicensePlate",{params:{}}),{result:_}=v;m=_,localStorage.setItem("lg_cars",JSON.stringify({cars_list:m,time:new Date().getTime()}))}e.value=m}catch(m){console.log("err = ",m)}},n=()=>{r.value=!0},h=(m,v)=>{l.value=!0,Vr.get("/jeecgbootbus/storageBill/queryByLicensePlate",{params:{licensePlate:m,positionNum:v}}).then(_=>{l.value=!1;const{status:I,data:y}=_;if(I===200){const{code:E,result:N}=y;if(E!==200){er.warning(y.message);return}if(!N)return;c.value={...N,ccmNo_dictText:Hr(N==null?void 0:N.ccmNo,"lg_zj"),shift_dictText:Hr(N==null?void 0:N.shift,"lg_bb"),shiftGroup_dictText:Hr(N.shiftGroup,"lg_bz"),typeConfigId:N.typeConfigId&&N.typeConfigId!="1024"?N.typeConfigId:void 0,hasDestination:!!(N&&N.typeConfigId&&N.destination)}}}).catch(_=>{l.value=!1,console.log("err = ",_)})},d=m=>{var v;if(!c.value.licensePlate){er.warning("暂无车辆信息!");return}{if(!c.value.typeConfigId){er.error("请选择目的地!");return}const _=Wn[Number(o)].find(I=>I.value===c.value.typeConfigId);_==null||_.label,c.value.typeConfigId,da.confirm({iconType:"warning",centered:!0,title:Kr("div",[Kr("span","确定车辆已到达 "),Kr("span",{style:{color:"#f5222d",fontSize:"36px"}},`【 ${(v=c.value)==null?void 0:v.licensePlate} 】`)]),content:()=>"注:确认修改车辆到达后,不能修改 !",class:"confirm-destination-modal",okText:"确认",cancelText:"取消",onOk:()=>{g(c.value)}})}},g=(m,v)=>{l.value=!0,Vr.post("/jeecgbootbus/storageBill/updateSteelReachTime",{id:c.value.id,...m},{headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(_=>{const{status:I,data:y}=_;if(I===200){const{code:E,result:N}=y;if(E!==200){er.warning(y.message);return}if(!N)return}er.success("确认成功!")}).catch(_=>{er.error(_.message?_.message:"确认失败!")}).finally(()=>{l.value=!1,h(c.value.licensePlate,c.value.positionNum)})},b=m=>{const{car:v,position:_}=m;v&&h(v,_)};return ma(()=>{t(),zl(),Tn.subscribe("trace/performance/car/arrive",b)}),ya(()=>{Tn.unsubscribe("trace/performance/car/arrive",b)}),(m,v)=>{const _=ia,I=ra,y=sa,E=oa,N=na,B=aa,S=la,k=ha,M=ua,J=ta;return xt(),mr(J,{wrapperClassName:"vehicle-operation-wrapper",spinning:l.value},{default:Ze(()=>[Me("div",Gl,[Me("div",Kl,[Me("div",Ql,[v[4]||(v[4]=Me("div",{class:"title-txt"},"已达目的地",-1)),Ge(I,{class:"select-wrap",size:"large",disabled:!0,placeholder:"请选择目的地",value:c.value.typeConfigId,"onUpdate:value":v[0]||(v[0]=Y=>c.value.typeConfigId=Y)},{default:Ze(()=>[(xt(!0),yr(zr,null,Gr(i.value,Y=>(xt(),mr(_,{value:Y.value,label:Y.label,key:Y.value},{default:Ze(()=>[Me("span",{role:"img","aria-label":Y.label,style:qn({fontSize:"18px",fontWeight:600,color:`${Y.color||"#000"}`})}," "+ct(Y.label),13,Yl)]),_:2},1032,["value","label"]))),128))]),_:1},8,["value"]),v[5]||(v[5]=Me("div",{class:"title-txt txt2"},"到达车辆",-1)),Ge(N,{placement:"bottom",trigger:"click",overlayClassName:"vehicle-operation-car-popover"},{content:Ze(()=>[Me("div",Jl,[(xt(!0),yr(zr,null,Gr(e.value,Y=>(xt(),mr(y,{color:Y.value===c.value.licensePlate?"processing":"default",onClick:()=>c.value.licensePlate=Y.value,key:Y.value},{default:Ze(()=>[$n(ct(Y.label),1)]),_:2},1032,["color","onClick"]))),128))])]),default:Ze(()=>[Me("div",Xl,[Me("div",{class:"vehicle-content-top-icon",onClick:n}),Ge(E,{class:"input-txt",value:c.value.licensePlate,"onUpdate:value":v[1]||(v[1]=Y=>c.value.licensePlate=Y),disabled:""},null,8,["value"])])]),_:1}),c.value.steelReachTime?va("",!0):(xt(),mr(B,{key:0,class:"confirm-btn1",size:"large",type:"primary",disabled:!!c.value.outTime,onClick:v[2]||(v[2]=Y=>d("confirmDestination"))},{default:Ze(()=>v[3]||(v[3]=[$n(" 确认到达 ")])),_:1},8,["disabled"]))]),Ge(S,{style:{height:"1px","background-color":"#104f66"}}),Me("div",Zl,[Ge(M,{gutter:[0,26]},{default:Ze(()=>[Ge(k,{span:24,class:"vehicle-info-content-item f50 flex items-center",style:{"margin-top":"0",padding:"0"}},{default:Ze(()=>[v[6]||(v[6]=Me("div",{class:"vehicle-info-title"},"到达时间",-1)),Ge(S,{type:"vertical",style:{"background-color":"#f50"}}),Me("div",eu,ct(c.value.steelReachTime),1)]),_:1})]),_:1})]),v[15]||(v[15]=Me("div",{class:"vehicle-content-title flex items-center justify-center"},[Me("span",{class:"vehicle-content-title-text"},"装运信息")],-1)),Me("div",tu,[Ge(M,{gutter:[0,26]},{default:Ze(()=>[Ge(k,{span:5,class:"vehicle-info-content-item flex items-center"},{default:Ze(()=>[v[7]||(v[7]=Me("div",{class:"vehicle-info-title"},"铸机",-1)),Ge(S,{type:"vertical",style:{"background-color":"#1e91bb"}}),Me("div",ru,ct(c.value.ccmNo_dictText),1)]),_:1}),Ge(k,{span:5,class:"vehicle-info-content-item green flex items-center"},{default:Ze(()=>[v[8]||(v[8]=Me("div",{class:"vehicle-info-title"},"班组",-1)),Ge(S,{type:"vertical",style:{"background-color":"#1e91bb"}}),Me("div",iu,ct(c.value.shiftGroup_dictText)+" - "+ct(c.value.shift_dictText),1)]),_:1}),Ge(k,{span:7,class:"vehicle-info-content-item green flex items-center"},{default:Ze(()=>[v[9]||(v[9]=Me("div",{class:"vehicle-info-title"},"到站时间",-1)),Ge(S,{type:"vertical",style:{"background-color":"#1e91bb"}}),Me("div",nu,ct(c.value.arrivalTime),1)]),_:1}),Ge(k,{span:7,class:"vehicle-info-content-item red flex items-center"},{default:Ze(()=>[v[10]||(v[10]=Me("div",{class:"vehicle-info-title"},"离站时间",-1)),Ge(S,{type:"vertical",style:{"background-color":"#1e91bb"}}),Me("div",ou,ct(c.value.outTime),1)]),_:1}),Ge(k,{span:5,class:"vehicle-info-content-item flex items-center"},{default:Ze(()=>[v[11]||(v[11]=Me("div",{class:"vehicle-info-title"},"钢种",-1)),Ge(S,{type:"vertical",style:{"background-color":"#1e91bb"}}),Me("div",su,ct(c.value.steel),1)]),_:1}),Ge(k,{span:5,class:"vehicle-info-content-item flex items-center"},{default:Ze(()=>[v[12]||(v[12]=Me("div",{class:"vehicle-info-title"},"定尺",-1)),Ge(S,{type:"vertical",style:{"background-color":"#1e91bb"}}),Me("div",au,ct(c.value.size),1)]),_:1}),Ge(k,{span:5,class:"vehicle-info-content-item flex items-center"},{default:Ze(()=>[v[13]||(v[13]=Me("div",{class:"vehicle-info-title"},"支数",-1)),Ge(S,{type:"vertical",style:{"background-color":"#1e91bb"}}),Me("div",lu,ct(c.value.amountTotal),1)]),_:1})]),_:1})]),Me("div",uu,[(xt(!0),yr(zr,null,Gr(Math.ceil(Number(c.value.amountTotal)/4),(Y,se)=>(xt(),yr("img",{style:qn({transform:`perspective(1000px) translate3d(-65%, -${se*12+6}px, 0px) rotateX(45deg)`}),key:Y,src:ca,class:"steel_billet-img"},null,4))),128)),Me("div",hu,[v[14]||(v[14]=Me("img",{src:fa},null,-1)),Me("div",cu,ct(c.value.licensePlate||""),1)])])])])]),_:1},8,["spinning"])}}}),bu=_a(fu,[["__scopeId","data-v-bc1528f2"]]);export{bu as default};
|