mqtt-plus 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ (function(ot,Je){typeof exports=="object"&&typeof module<"u"?module.exports=Je():typeof define=="function"&&define.amd?define(Je):(ot=typeof globalThis<"u"?globalThis:ot||self,ot.MQTTp=Je())})(this,(function(){"use strict";const ot="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Je=(s=21)=>{let o="",h=crypto.getRandomValues(new Uint8Array(s|=0));for(;s--;)o+=ot[h[s]&63];return o};var dn={},lt={};lt.byteLength=Ro,lt.toByteArray=xo,lt.fromByteArray=Uo;for(var De=[],Pe=[],Bo=typeof Uint8Array<"u"?Uint8Array:Array,bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qe=0,Io=bt.length;Qe<Io;++Qe)De[Qe]=bt[Qe],Pe[bt.charCodeAt(Qe)]=Qe;Pe[45]=62,Pe[95]=63;function yn(s){var o=s.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var h=s.indexOf("=");h===-1&&(h=o);var d=h===o?0:4-h%4;return[h,d]}function Ro(s){var o=yn(s),h=o[0],d=o[1];return(h+d)*3/4-d}function To(s,o,h){return(o+h)*3/4-h}function xo(s){var o,h=yn(s),d=h[0],y=h[1],i=new Bo(To(s,d,y)),a=0,u=y>0?d-4:d,p;for(p=0;p<u;p+=4)o=Pe[s.charCodeAt(p)]<<18|Pe[s.charCodeAt(p+1)]<<12|Pe[s.charCodeAt(p+2)]<<6|Pe[s.charCodeAt(p+3)],i[a++]=o>>16&255,i[a++]=o>>8&255,i[a++]=o&255;return y===2&&(o=Pe[s.charCodeAt(p)]<<2|Pe[s.charCodeAt(p+1)]>>4,i[a++]=o&255),y===1&&(o=Pe[s.charCodeAt(p)]<<10|Pe[s.charCodeAt(p+1)]<<4|Pe[s.charCodeAt(p+2)]>>2,i[a++]=o>>8&255,i[a++]=o&255),i}function Fo(s){return De[s>>18&63]+De[s>>12&63]+De[s>>6&63]+De[s&63]}function Oo(s,o,h){for(var d,y=[],i=o;i<h;i+=3)d=(s[i]<<16&16711680)+(s[i+1]<<8&65280)+(s[i+2]&255),y.push(Fo(d));return y.join("")}function Uo(s){for(var o,h=s.length,d=h%3,y=[],i=16383,a=0,u=h-d;a<u;a+=i)y.push(Oo(s,a,a+i>u?u:a+i));return d===1?(o=s[h-1],y.push(De[o>>2]+De[o<<4&63]+"==")):d===2&&(o=(s[h-2]<<8)+s[h-1],y.push(De[o>>10]+De[o>>4&63]+De[o<<2&63]+"=")),y.join("")}var _t={};_t.read=function(s,o,h,d,y){var i,a,u=y*8-d-1,p=(1<<u)-1,b=p>>1,c=-7,T=h?y-1:0,R=h?-1:1,x=s[o+T];for(T+=R,i=x&(1<<-c)-1,x>>=-c,c+=u;c>0;i=i*256+s[o+T],T+=R,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=d;c>0;a=a*256+s[o+T],T+=R,c-=8);if(i===0)i=1-b;else{if(i===p)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,d),i=i-b}return(x?-1:1)*a*Math.pow(2,i-d)},_t.write=function(s,o,h,d,y,i){var a,u,p,b=i*8-y-1,c=(1<<b)-1,T=c>>1,R=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=d?0:i-1,v=d?1:-1,L=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(u=isNaN(o)?1:0,a=c):(a=Math.floor(Math.log(o)/Math.LN2),o*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+T>=1?o+=R/p:o+=R*Math.pow(2,1-T),o*p>=2&&(a++,p/=2),a+T>=c?(u=0,a=c):a+T>=1?(u=(o*p-1)*Math.pow(2,y),a=a+T):(u=o*Math.pow(2,T-1)*Math.pow(2,y),a=0));y>=8;s[h+x]=u&255,x+=v,u/=256,y-=8);for(a=a<<y|u,b+=y;b>0;s[h+x]=a&255,x+=v,a/=256,b-=8);s[h+x-v]|=L*128};(function(s){const o=lt,h=_t,d=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;s.Buffer=c,s.SlowBuffer=m,s.INSPECT_MAX_BYTES=50;const y=2147483647;s.kMaxLength=y;const{Uint8Array:i,ArrayBuffer:a,SharedArrayBuffer:u}=globalThis;c.TYPED_ARRAY_SUPPORT=p(),!c.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 p(){try{const f=new i(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,i.prototype),Object.setPrototypeOf(f,e),f.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function b(f){if(f>y)throw new RangeError('The value "'+f+'" is invalid for option "size"');const e=new i(f);return Object.setPrototypeOf(e,c.prototype),e}function c(f,e,r){if(typeof f=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(f)}return T(f,e,r)}c.poolSize=8192;function T(f,e,r){if(typeof f=="string")return L(f,e);if(a.isView(f))return S(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(Fe(f,a)||f&&Fe(f.buffer,a)||typeof u<"u"&&(Fe(f,u)||f&&Fe(f.buffer,u)))return O(f,e,r);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const E=f.valueOf&&f.valueOf();if(E!=null&&E!==f)return c.from(E,e,r);const P=F(f);if(P)return P;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return c.from(f[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}c.from=function(f,e,r){return T(f,e,r)},Object.setPrototypeOf(c.prototype,i.prototype),Object.setPrototypeOf(c,i);function R(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function x(f,e,r){return R(f),f<=0?b(f):e!==void 0?typeof r=="string"?b(f).fill(e,r):b(f).fill(e):b(f)}c.alloc=function(f,e,r){return x(f,e,r)};function v(f){return R(f),b(f<0?0:I(f)|0)}c.allocUnsafe=function(f){return v(f)},c.allocUnsafeSlow=function(f){return v(f)};function L(f,e){if((typeof e!="string"||e==="")&&(e="utf8"),!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=M(f,e)|0;let E=b(r);const P=E.write(f,e);return P!==r&&(E=E.slice(0,P)),E}function N(f){const e=f.length<0?0:I(f.length)|0,r=b(e);for(let E=0;E<e;E+=1)r[E]=f[E]&255;return r}function S(f){if(Fe(f,i)){const e=new i(f);return O(e.buffer,e.byteOffset,e.byteLength)}return N(f)}function O(f,e,r){if(e<0||f.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(f.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let E;return e===void 0&&r===void 0?E=new i(f):r===void 0?E=new i(f,e):E=new i(f,e,r),Object.setPrototypeOf(E,c.prototype),E}function F(f){if(c.isBuffer(f)){const e=I(f.length)|0,r=b(e);return r.length===0||f.copy(r,0,0,e),r}if(f.length!==void 0)return typeof f.length!="number"||Le(f.length)?b(0):N(f);if(f.type==="Buffer"&&Array.isArray(f.data))return N(f.data)}function I(f){if(f>=y)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+y.toString(16)+" bytes");return f|0}function m(f){return+f!=f&&(f=0),c.alloc(+f)}c.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==c.prototype},c.compare=function(e,r){if(Fe(e,i)&&(e=c.from(e,e.offset,e.byteLength)),Fe(r,i)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(e)||!c.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let E=e.length,P=r.length;for(let W=0,Q=Math.min(E,P);W<Q;++W)if(e[W]!==r[W]){E=e[W],P=r[W];break}return E<P?-1:P<E?1:0},c.isEncoding=function(e){switch(String(e).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}},c.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return c.alloc(0);let E;if(r===void 0)for(r=0,E=0;E<e.length;++E)r+=e[E].length;const P=c.allocUnsafe(r);let W=0;for(E=0;E<e.length;++E){let Q=e[E];if(Fe(Q,i))W+Q.length>P.length?(c.isBuffer(Q)||(Q=c.from(Q)),Q.copy(P,W)):i.prototype.set.call(P,Q,W);else if(c.isBuffer(Q))Q.copy(P,W);else throw new TypeError('"list" argument must be an Array of Buffers');W+=Q.length}return P};function M(f,e){if(c.isBuffer(f))return f.length;if(a.isView(f)||Fe(f,a))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);const r=f.length,E=arguments.length>2&&arguments[2]===!0;if(!E&&r===0)return 0;let P=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Ue(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return _e(f).length;default:if(P)return E?-1:Ue(f).length;e=(""+e).toLowerCase(),P=!0}}c.byteLength=M;function B(f,e,r){let E=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(f||(f="utf8");;)switch(f){case"hex":return G(this,e,r);case"utf8":case"utf-8":return se(this,e,r);case"ascii":return ce(this,e,r);case"latin1":case"binary":return we(this,e,r);case"base64":return oe(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,e,r);default:if(E)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),E=!0}}c.prototype._isBuffer=!0;function j(f,e,r){const E=f[e];f[e]=f[r],f[r]=E}c.prototype.swap16=function(){const e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)j(this,r,r+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)j(this,r,r+3),j(this,r+1,r+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)j(this,r,r+7),j(this,r+1,r+6),j(this,r+2,r+5),j(this,r+3,r+4);return this},c.prototype.toString=function(){const e=this.length;return e===0?"":arguments.length===0?se(this,0,e):B.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:c.compare(this,e)===0},c.prototype.inspect=function(){let e="";const r=s.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},d&&(c.prototype[d]=c.prototype.inspect),c.prototype.compare=function(e,r,E,P,W){if(Fe(e,i)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),E===void 0&&(E=e?e.length:0),P===void 0&&(P=0),W===void 0&&(W=this.length),r<0||E>e.length||P<0||W>this.length)throw new RangeError("out of range index");if(P>=W&&r>=E)return 0;if(P>=W)return-1;if(r>=E)return 1;if(r>>>=0,E>>>=0,P>>>=0,W>>>=0,this===e)return 0;let Q=W-P,de=E-r;const ve=Math.min(Q,de),Se=this.slice(P,W),Ae=e.slice(r,E);for(let me=0;me<ve;++me)if(Se[me]!==Ae[me]){Q=Se[me],de=Ae[me];break}return Q<de?-1:de<Q?1:0};function H(f,e,r,E,P){if(f.length===0)return-1;if(typeof r=="string"?(E=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Le(r)&&(r=P?0:f.length-1),r<0&&(r=f.length+r),r>=f.length){if(P)return-1;r=f.length-1}else if(r<0)if(P)r=0;else return-1;if(typeof e=="string"&&(e=c.from(e,E)),c.isBuffer(e))return e.length===0?-1:ee(f,e,r,E,P);if(typeof e=="number")return e=e&255,typeof i.prototype.indexOf=="function"?P?i.prototype.indexOf.call(f,e,r):i.prototype.lastIndexOf.call(f,e,r):ee(f,[e],r,E,P);throw new TypeError("val must be string, number or Buffer")}function ee(f,e,r,E,P){let W=1,Q=f.length,de=e.length;if(E!==void 0&&(E=String(E).toLowerCase(),E==="ucs2"||E==="ucs-2"||E==="utf16le"||E==="utf-16le")){if(f.length<2||e.length<2)return-1;W=2,Q/=2,de/=2,r/=2}function ve(Ae,me){return W===1?Ae[me]:Ae.readUInt16BE(me*W)}let Se;if(P){let Ae=-1;for(Se=r;Se<Q;Se++)if(ve(f,Se)===ve(e,Ae===-1?0:Se-Ae)){if(Ae===-1&&(Ae=Se),Se-Ae+1===de)return Ae*W}else Ae!==-1&&(Se-=Se-Ae),Ae=-1}else for(r+de>Q&&(r=Q-de),Se=r;Se>=0;Se--){let Ae=!0;for(let me=0;me<de;me++)if(ve(f,Se+me)!==ve(e,me)){Ae=!1;break}if(Ae)return Se}return-1}c.prototype.includes=function(e,r,E){return this.indexOf(e,r,E)!==-1},c.prototype.indexOf=function(e,r,E){return H(this,e,r,E,!0)},c.prototype.lastIndexOf=function(e,r,E){return H(this,e,r,E,!1)};function K(f,e,r,E){r=Number(r)||0;const P=f.length-r;E?(E=Number(E),E>P&&(E=P)):E=P;const W=e.length;E>W/2&&(E=W/2);let Q;for(Q=0;Q<E;++Q){const de=parseInt(e.substr(Q*2,2),16);if(Le(de))return Q;f[r+Q]=de}return Q}function U(f,e,r,E){return Me(Ue(e,f.length-r),f,r,E)}function A(f,e,r,E){return Me(Ne(e),f,r,E)}function q(f,e,r,E){return Me(_e(e),f,r,E)}function ne(f,e,r,E){return Me(Ee(e,f.length-r),f,r,E)}c.prototype.write=function(e,r,E,P){if(r===void 0)P="utf8",E=this.length,r=0;else if(E===void 0&&typeof r=="string")P=r,E=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(E)?(E=E>>>0,P===void 0&&(P="utf8")):(P=E,E=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const W=this.length-r;if((E===void 0||E>W)&&(E=W),e.length>0&&(E<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");P||(P="utf8");let Q=!1;for(;;)switch(P){case"hex":return K(this,e,r,E);case"utf8":case"utf-8":return U(this,e,r,E);case"ascii":case"latin1":case"binary":return A(this,e,r,E);case"base64":return q(this,e,r,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ne(this,e,r,E);default:if(Q)throw new TypeError("Unknown encoding: "+P);P=(""+P).toLowerCase(),Q=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function oe(f,e,r){return e===0&&r===f.length?o.fromByteArray(f):o.fromByteArray(f.slice(e,r))}function se(f,e,r){r=Math.min(f.length,r);const E=[];let P=e;for(;P<r;){const W=f[P];let Q=null,de=W>239?4:W>223?3:W>191?2:1;if(P+de<=r){let ve,Se,Ae,me;switch(de){case 1:W<128&&(Q=W);break;case 2:ve=f[P+1],(ve&192)===128&&(me=(W&31)<<6|ve&63,me>127&&(Q=me));break;case 3:ve=f[P+1],Se=f[P+2],(ve&192)===128&&(Se&192)===128&&(me=(W&15)<<12|(ve&63)<<6|Se&63,me>2047&&(me<55296||me>57343)&&(Q=me));break;case 4:ve=f[P+1],Se=f[P+2],Ae=f[P+3],(ve&192)===128&&(Se&192)===128&&(Ae&192)===128&&(me=(W&15)<<18|(ve&63)<<12|(Se&63)<<6|Ae&63,me>65535&&me<1114112&&(Q=me))}}Q===null?(Q=65533,de=1):Q>65535&&(Q-=65536,E.push(Q>>>10&1023|55296),Q=56320|Q&1023),E.push(Q),P+=de}return le(E)}const fe=4096;function le(f){const e=f.length;if(e<=fe)return String.fromCharCode.apply(String,f);let r="",E=0;for(;E<e;)r+=String.fromCharCode.apply(String,f.slice(E,E+=fe));return r}function ce(f,e,r){let E="";r=Math.min(f.length,r);for(let P=e;P<r;++P)E+=String.fromCharCode(f[P]&127);return E}function we(f,e,r){let E="";r=Math.min(f.length,r);for(let P=e;P<r;++P)E+=String.fromCharCode(f[P]);return E}function G(f,e,r){const E=f.length;(!e||e<0)&&(e=0),(!r||r<0||r>E)&&(r=E);let P="";for(let W=e;W<r;++W)P+=ke[f[W]];return P}function Y(f,e,r){const E=f.slice(e,r);let P="";for(let W=0;W<E.length-1;W+=2)P+=String.fromCharCode(E[W]+E[W+1]*256);return P}c.prototype.slice=function(e,r){const E=this.length;e=~~e,r=r===void 0?E:~~r,e<0?(e+=E,e<0&&(e=0)):e>E&&(e=E),r<0?(r+=E,r<0&&(r=0)):r>E&&(r=E),r<e&&(r=e);const P=this.subarray(e,r);return Object.setPrototypeOf(P,c.prototype),P};function z(f,e,r){if(f%1!==0||f<0)throw new RangeError("offset is not uint");if(f+e>r)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(e,r,E){e=e>>>0,r=r>>>0,E||z(e,r,this.length);let P=this[e],W=1,Q=0;for(;++Q<r&&(W*=256);)P+=this[e+Q]*W;return P},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,r,E){e=e>>>0,r=r>>>0,E||z(e,r,this.length);let P=this[e+--r],W=1;for(;r>0&&(W*=256);)P+=this[e+--r]*W;return P},c.prototype.readUint8=c.prototype.readUInt8=function(e,r){return e=e>>>0,r||z(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||z(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||z(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||z(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||z(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=xe(function(e){e=e>>>0,ue(e,"offset");const r=this[e],E=this[e+7];(r===void 0||E===void 0)&&he(e,this.length-8);const P=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,W=this[++e]+this[++e]*2**8+this[++e]*2**16+E*2**24;return BigInt(P)+(BigInt(W)<<BigInt(32))}),c.prototype.readBigUInt64BE=xe(function(e){e=e>>>0,ue(e,"offset");const r=this[e],E=this[e+7];(r===void 0||E===void 0)&&he(e,this.length-8);const P=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],W=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+E;return(BigInt(P)<<BigInt(32))+BigInt(W)}),c.prototype.readIntLE=function(e,r,E){e=e>>>0,r=r>>>0,E||z(e,r,this.length);let P=this[e],W=1,Q=0;for(;++Q<r&&(W*=256);)P+=this[e+Q]*W;return W*=128,P>=W&&(P-=Math.pow(2,8*r)),P},c.prototype.readIntBE=function(e,r,E){e=e>>>0,r=r>>>0,E||z(e,r,this.length);let P=r,W=1,Q=this[e+--P];for(;P>0&&(W*=256);)Q+=this[e+--P]*W;return W*=128,Q>=W&&(Q-=Math.pow(2,8*r)),Q},c.prototype.readInt8=function(e,r){return e=e>>>0,r||z(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},c.prototype.readInt16LE=function(e,r){e=e>>>0,r||z(e,2,this.length);const E=this[e]|this[e+1]<<8;return E&32768?E|4294901760:E},c.prototype.readInt16BE=function(e,r){e=e>>>0,r||z(e,2,this.length);const E=this[e+1]|this[e]<<8;return E&32768?E|4294901760:E},c.prototype.readInt32LE=function(e,r){return e=e>>>0,r||z(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,r){return e=e>>>0,r||z(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=xe(function(e){e=e>>>0,ue(e,"offset");const r=this[e],E=this[e+7];(r===void 0||E===void 0)&&he(e,this.length-8);const P=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(E<<24);return(BigInt(P)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),c.prototype.readBigInt64BE=xe(function(e){e=e>>>0,ue(e,"offset");const r=this[e],E=this[e+7];(r===void 0||E===void 0)&&he(e,this.length-8);const P=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(P)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+E)}),c.prototype.readFloatLE=function(e,r){return e=e>>>0,r||z(e,4,this.length),h.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,r){return e=e>>>0,r||z(e,4,this.length),h.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||z(e,8,this.length),h.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||z(e,8,this.length),h.read(this,e,!1,52,8)};function ae(f,e,r,E,P,W){if(!c.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>P||e<W)throw new RangeError('"value" argument is out of bounds');if(r+E>f.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,r,E,P){if(e=+e,r=r>>>0,E=E>>>0,!P){const de=Math.pow(2,8*E)-1;ae(this,e,r,E,de,0)}let W=1,Q=0;for(this[r]=e&255;++Q<E&&(W*=256);)this[r+Q]=e/W&255;return r+E},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,r,E,P){if(e=+e,r=r>>>0,E=E>>>0,!P){const de=Math.pow(2,8*E)-1;ae(this,e,r,E,de,0)}let W=E-1,Q=1;for(this[r+W]=e&255;--W>=0&&(Q*=256);)this[r+W]=e/Q&255;return r+E},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,r,E){return e=+e,r=r>>>0,E||ae(this,e,r,1,255,0),this[r]=e&255,r+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,r,E){return e=+e,r=r>>>0,E||ae(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,r,E){return e=+e,r=r>>>0,E||ae(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,r,E){return e=+e,r=r>>>0,E||ae(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,r,E){return e=+e,r=r>>>0,E||ae(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function k(f,e,r,E,P){pe(e,E,P,f,r,7);let W=Number(e&BigInt(4294967295));f[r++]=W,W=W>>8,f[r++]=W,W=W>>8,f[r++]=W,W=W>>8,f[r++]=W;let Q=Number(e>>BigInt(32)&BigInt(4294967295));return f[r++]=Q,Q=Q>>8,f[r++]=Q,Q=Q>>8,f[r++]=Q,Q=Q>>8,f[r++]=Q,r}function D(f,e,r,E,P){pe(e,E,P,f,r,7);let W=Number(e&BigInt(4294967295));f[r+7]=W,W=W>>8,f[r+6]=W,W=W>>8,f[r+5]=W,W=W>>8,f[r+4]=W;let Q=Number(e>>BigInt(32)&BigInt(4294967295));return f[r+3]=Q,Q=Q>>8,f[r+2]=Q,Q=Q>>8,f[r+1]=Q,Q=Q>>8,f[r]=Q,r+8}c.prototype.writeBigUInt64LE=xe(function(e,r=0){return k(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=xe(function(e,r=0){return D(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,r,E,P){if(e=+e,r=r>>>0,!P){const ve=Math.pow(2,8*E-1);ae(this,e,r,E,ve-1,-ve)}let W=0,Q=1,de=0;for(this[r]=e&255;++W<E&&(Q*=256);)e<0&&de===0&&this[r+W-1]!==0&&(de=1),this[r+W]=(e/Q>>0)-de&255;return r+E},c.prototype.writeIntBE=function(e,r,E,P){if(e=+e,r=r>>>0,!P){const ve=Math.pow(2,8*E-1);ae(this,e,r,E,ve-1,-ve)}let W=E-1,Q=1,de=0;for(this[r+W]=e&255;--W>=0&&(Q*=256);)e<0&&de===0&&this[r+W+1]!==0&&(de=1),this[r+W]=(e/Q>>0)-de&255;return r+E},c.prototype.writeInt8=function(e,r,E){return e=+e,r=r>>>0,E||ae(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1},c.prototype.writeInt16LE=function(e,r,E){return e=+e,r=r>>>0,E||ae(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2},c.prototype.writeInt16BE=function(e,r,E){return e=+e,r=r>>>0,E||ae(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2},c.prototype.writeInt32LE=function(e,r,E){return e=+e,r=r>>>0,E||ae(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4},c.prototype.writeInt32BE=function(e,r,E){return e=+e,r=r>>>0,E||ae(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4},c.prototype.writeBigInt64LE=xe(function(e,r=0){return k(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=xe(function(e,r=0){return D(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function V(f,e,r,E,P,W){if(r+E>f.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function te(f,e,r,E,P){return e=+e,r=r>>>0,P||V(f,e,r,4),h.write(f,e,r,E,23,4),r+4}c.prototype.writeFloatLE=function(e,r,E){return te(this,e,r,!0,E)},c.prototype.writeFloatBE=function(e,r,E){return te(this,e,r,!1,E)};function re(f,e,r,E,P){return e=+e,r=r>>>0,P||V(f,e,r,8),h.write(f,e,r,E,52,8),r+8}c.prototype.writeDoubleLE=function(e,r,E){return re(this,e,r,!0,E)},c.prototype.writeDoubleBE=function(e,r,E){return re(this,e,r,!1,E)},c.prototype.copy=function(e,r,E,P){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(E||(E=0),!P&&P!==0&&(P=this.length),r>=e.length&&(r=e.length),r||(r=0),P>0&&P<E&&(P=E),P===E||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(E<0||E>=this.length)throw new RangeError("Index out of range");if(P<0)throw new RangeError("sourceEnd out of bounds");P>this.length&&(P=this.length),e.length-r<P-E&&(P=e.length-r+E);const W=P-E;return this===e&&typeof i.prototype.copyWithin=="function"?this.copyWithin(r,E,P):i.prototype.set.call(e,this.subarray(E,P),r),W},c.prototype.fill=function(e,r,E,P){if(typeof e=="string"){if(typeof r=="string"?(P=r,r=0,E=this.length):typeof E=="string"&&(P=E,E=this.length),P!==void 0&&typeof P!="string")throw new TypeError("encoding must be a string");if(typeof P=="string"&&!c.isEncoding(P))throw new TypeError("Unknown encoding: "+P);if(e.length===1){const Q=e.charCodeAt(0);(P==="utf8"&&Q<128||P==="latin1")&&(e=Q)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<E)throw new RangeError("Out of range index");if(E<=r)return this;r=r>>>0,E=E===void 0?this.length:E>>>0,e||(e=0);let W;if(typeof e=="number")for(W=r;W<E;++W)this[W]=e;else{const Q=c.isBuffer(e)?e:c.from(e,P),de=Q.length;if(de===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(W=0;W<E-r;++W)this[W+r]=Q[W%de]}return this};const g={};function w(f,e,r){g[f]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${f}]`,this.stack,delete this.name}get code(){return f}set code(P){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:P,writable:!0})}toString(){return`${this.name} [${f}]: ${this.message}`}}}w("ERR_BUFFER_OUT_OF_BOUNDS",function(f){return f?`${f} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),w("ERR_INVALID_ARG_TYPE",function(f,e){return`The "${f}" argument must be of type number. Received type ${typeof e}`},TypeError),w("ERR_OUT_OF_RANGE",function(f,e,r){let E=`The value of "${f}" is out of range.`,P=r;return Number.isInteger(r)&&Math.abs(r)>2**32?P=J(String(r)):typeof r=="bigint"&&(P=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(P=J(P)),P+="n"),E+=` It must be ${e}. Received ${P}`,E},RangeError);function J(f){let e="",r=f.length;const E=f[0]==="-"?1:0;for(;r>=E+4;r-=3)e=`_${f.slice(r-3,r)}${e}`;return`${f.slice(0,r)}${e}`}function ie(f,e,r){ue(e,"offset"),(f[e]===void 0||f[e+r]===void 0)&&he(e,f.length-(r+1))}function pe(f,e,r,E,P,W){if(f>r||f<e){const Q=typeof e=="bigint"?"n":"";let de;throw e===0||e===BigInt(0)?de=`>= 0${Q} and < 2${Q} ** ${(W+1)*8}${Q}`:de=`>= -(2${Q} ** ${(W+1)*8-1}${Q}) and < 2 ** ${(W+1)*8-1}${Q}`,new g.ERR_OUT_OF_RANGE("value",de,f)}ie(E,P,W)}function ue(f,e){if(typeof f!="number")throw new g.ERR_INVALID_ARG_TYPE(e,"number",f)}function he(f,e,r){throw Math.floor(f)!==f?(ue(f,r),new g.ERR_OUT_OF_RANGE("offset","an integer",f)):e<0?new g.ERR_BUFFER_OUT_OF_BOUNDS:new g.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${e}`,f)}const Oe=/[^+/0-9A-Za-z-_]/g;function X(f){if(f=f.split("=")[0],f=f.trim().replace(Oe,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function Ue(f,e){e=e||1/0;let r;const E=f.length;let P=null;const W=[];for(let Q=0;Q<E;++Q){if(r=f.charCodeAt(Q),r>55295&&r<57344){if(!P){if(r>56319){(e-=3)>-1&&W.push(239,191,189);continue}else if(Q+1===E){(e-=3)>-1&&W.push(239,191,189);continue}P=r;continue}if(r<56320){(e-=3)>-1&&W.push(239,191,189),P=r;continue}r=(P-55296<<10|r-56320)+65536}else P&&(e-=3)>-1&&W.push(239,191,189);if(P=null,r<128){if((e-=1)<0)break;W.push(r)}else if(r<2048){if((e-=2)<0)break;W.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;W.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;W.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return W}function Ne(f){const e=[];for(let r=0;r<f.length;++r)e.push(f.charCodeAt(r)&255);return e}function Ee(f,e){let r,E,P;const W=[];for(let Q=0;Q<f.length&&!((e-=2)<0);++Q)r=f.charCodeAt(Q),E=r>>8,P=r%256,W.push(P),W.push(E);return W}function _e(f){return o.toByteArray(X(f))}function Me(f,e,r,E){let P;for(P=0;P<E&&!(P+r>=e.length||P>=f.length);++P)e[P+r]=f[P];return P}function Fe(f,e){return f instanceof e||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===e.name}function Le(f){return f!==f}const ke=(function(){const f="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const E=r*16;for(let P=0;P<16;++P)e[E+P]=f[r]+f[P]}return e})();function xe(f){return typeof BigInt>"u"?Ve:f}function Ve(){throw new Error("BigInt not supported")}})(dn);const No=dn.Buffer;var $e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mo(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ct={exports:{}},gn;function vt(){if(gn)return ct.exports;gn=1;var s=typeof Reflect=="object"?Reflect:null,o=s&&typeof s.apply=="function"?s.apply:function(m,M,B){return Function.prototype.apply.call(m,M,B)},h;s&&typeof s.ownKeys=="function"?h=s.ownKeys:Object.getOwnPropertySymbols?h=function(m){return Object.getOwnPropertyNames(m).concat(Object.getOwnPropertySymbols(m))}:h=function(m){return Object.getOwnPropertyNames(m)};function d(I){console&&console.warn&&console.warn(I)}var y=Number.isNaN||function(m){return m!==m};function i(){i.init.call(this)}ct.exports=i,ct.exports.once=S,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function u(I){if(typeof I!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof I)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(I){if(typeof I!="number"||I<0||y(I))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+I+".");a=I}}),i.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},i.prototype.setMaxListeners=function(m){if(typeof m!="number"||m<0||y(m))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+m+".");return this._maxListeners=m,this};function p(I){return I._maxListeners===void 0?i.defaultMaxListeners:I._maxListeners}i.prototype.getMaxListeners=function(){return p(this)},i.prototype.emit=function(m){for(var M=[],B=1;B<arguments.length;B++)M.push(arguments[B]);var j=m==="error",H=this._events;if(H!==void 0)j=j&&H.error===void 0;else if(!j)return!1;if(j){var ee;if(M.length>0&&(ee=M[0]),ee instanceof Error)throw ee;var K=new Error("Unhandled error."+(ee?" ("+ee.message+")":""));throw K.context=ee,K}var U=H[m];if(U===void 0)return!1;if(typeof U=="function")o(U,this,M);else for(var A=U.length,q=v(U,A),B=0;B<A;++B)o(q[B],this,M);return!0};function b(I,m,M,B){var j,H,ee;if(u(M),H=I._events,H===void 0?(H=I._events=Object.create(null),I._eventsCount=0):(H.newListener!==void 0&&(I.emit("newListener",m,M.listener?M.listener:M),H=I._events),ee=H[m]),ee===void 0)ee=H[m]=M,++I._eventsCount;else if(typeof ee=="function"?ee=H[m]=B?[M,ee]:[ee,M]:B?ee.unshift(M):ee.push(M),j=p(I),j>0&&ee.length>j&&!ee.warned){ee.warned=!0;var K=new Error("Possible EventEmitter memory leak detected. "+ee.length+" "+String(m)+" listeners added. Use emitter.setMaxListeners() to increase limit");K.name="MaxListenersExceededWarning",K.emitter=I,K.type=m,K.count=ee.length,d(K)}return I}i.prototype.addListener=function(m,M){return b(this,m,M,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(m,M){return b(this,m,M,!0)};function c(){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 T(I,m,M){var B={fired:!1,wrapFn:void 0,target:I,type:m,listener:M},j=c.bind(B);return j.listener=M,B.wrapFn=j,j}i.prototype.once=function(m,M){return u(M),this.on(m,T(this,m,M)),this},i.prototype.prependOnceListener=function(m,M){return u(M),this.prependListener(m,T(this,m,M)),this},i.prototype.removeListener=function(m,M){var B,j,H,ee,K;if(u(M),j=this._events,j===void 0)return this;if(B=j[m],B===void 0)return this;if(B===M||B.listener===M)--this._eventsCount===0?this._events=Object.create(null):(delete j[m],j.removeListener&&this.emit("removeListener",m,B.listener||M));else if(typeof B!="function"){for(H=-1,ee=B.length-1;ee>=0;ee--)if(B[ee]===M||B[ee].listener===M){K=B[ee].listener,H=ee;break}if(H<0)return this;H===0?B.shift():L(B,H),B.length===1&&(j[m]=B[0]),j.removeListener!==void 0&&this.emit("removeListener",m,K||M)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(m){var M,B,j;if(B=this._events,B===void 0)return this;if(B.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):B[m]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete B[m]),this;if(arguments.length===0){var H=Object.keys(B),ee;for(j=0;j<H.length;++j)ee=H[j],ee!=="removeListener"&&this.removeAllListeners(ee);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(M=B[m],typeof M=="function")this.removeListener(m,M);else if(M!==void 0)for(j=M.length-1;j>=0;j--)this.removeListener(m,M[j]);return this};function R(I,m,M){var B=I._events;if(B===void 0)return[];var j=B[m];return j===void 0?[]:typeof j=="function"?M?[j.listener||j]:[j]:M?N(j):v(j,j.length)}i.prototype.listeners=function(m){return R(this,m,!0)},i.prototype.rawListeners=function(m){return R(this,m,!1)},i.listenerCount=function(I,m){return typeof I.listenerCount=="function"?I.listenerCount(m):x.call(I,m)},i.prototype.listenerCount=x;function x(I){var m=this._events;if(m!==void 0){var M=m[I];if(typeof M=="function")return 1;if(M!==void 0)return M.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?h(this._events):[]};function v(I,m){for(var M=new Array(m),B=0;B<m;++B)M[B]=I[B];return M}function L(I,m){for(;m+1<I.length;m++)I[m]=I[m+1];I.pop()}function N(I){for(var m=new Array(I.length),M=0;M<m.length;++M)m[M]=I[M].listener||I[M];return m}function S(I,m){return new Promise(function(M,B){function j(ee){I.removeListener(m,H),B(ee)}function H(){typeof I.removeListener=="function"&&I.removeListener("error",j),M([].slice.call(arguments))}F(I,m,H,{once:!0}),m!=="error"&&O(I,j,{once:!0})})}function O(I,m,M){typeof I.on=="function"&&F(I,"error",m,M)}function F(I,m,M,B){if(typeof I.on=="function")B.once?I.once(m,M):I.on(m,M);else if(typeof I.addEventListener=="function")I.addEventListener(m,function j(H){B.once&&I.removeEventListener(m,j),M(H)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof I)}return ct.exports}var ht={exports:{}},wn;function ze(){return wn||(wn=1,typeof Object.create=="function"?ht.exports=function(o,h){h&&(o.super_=h,o.prototype=Object.create(h.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}))}:ht.exports=function(o,h){if(h){o.super_=h;var d=function(){};d.prototype=h.prototype,o.prototype=new d,o.prototype.constructor=o}}),ht.exports}function Po(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var mn={exports:{}},Te=mn.exports={},qe,je;function St(){throw new Error("setTimeout has not been defined")}function At(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?qe=setTimeout:qe=St}catch{qe=St}try{typeof clearTimeout=="function"?je=clearTimeout:je=At}catch{je=At}})();function En(s){if(qe===setTimeout)return setTimeout(s,0);if((qe===St||!qe)&&setTimeout)return qe=setTimeout,setTimeout(s,0);try{return qe(s,0)}catch{try{return qe.call(null,s,0)}catch{return qe.call(this,s,0)}}}function Lo(s){if(je===clearTimeout)return clearTimeout(s);if((je===At||!je)&&clearTimeout)return je=clearTimeout,clearTimeout(s);try{return je(s)}catch{try{return je.call(null,s)}catch{return je.call(this,s)}}}var We=[],Ze=!1,Xe,pt=-1;function Co(){!Ze||!Xe||(Ze=!1,Xe.length?We=Xe.concat(We):pt=-1,We.length&&bn())}function bn(){if(!Ze){var s=En(Co);Ze=!0;for(var o=We.length;o;){for(Xe=We,We=[];++pt<o;)Xe&&Xe[pt].run();pt=-1,o=We.length}Xe=null,Ze=!1,Lo(s)}}Te.nextTick=function(s){var o=new Array(arguments.length-1);if(arguments.length>1)for(var h=1;h<arguments.length;h++)o[h-1]=arguments[h];We.push(new _n(s,o)),We.length===1&&!Ze&&En(bn)};function _n(s,o){this.fun=s,this.array=o}_n.prototype.run=function(){this.fun.apply(null,this.array)},Te.title="browser",Te.browser=!0,Te.env={},Te.argv=[],Te.version="",Te.versions={};function He(){}Te.on=He,Te.addListener=He,Te.once=He,Te.off=He,Te.removeListener=He,Te.removeAllListeners=He,Te.emit=He,Te.prependListener=He,Te.prependOnceListener=He,Te.listeners=function(s){return[]},Te.binding=function(s){throw new Error("process.binding is not supported")},Te.cwd=function(){return"/"},Te.chdir=function(s){throw new Error("process.chdir is not supported")},Te.umask=function(){return 0};var ko=mn.exports;const ye=Po(ko);var Bt,vn;function Sn(){return vn||(vn=1,Bt=vt().EventEmitter),Bt}var It={},An;function Ce(){return An||(An=1,(function(s){Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var o={},h={};h.byteLength=c,h.toByteArray=R,h.fromByteArray=L;for(var d=[],y=[],i=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,p=a.length;u<p;++u)d[u]=a[u],y[a.charCodeAt(u)]=u;y[45]=62,y[95]=63;function b(O){var F=O.length;if(F%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var I=O.indexOf("=");I===-1&&(I=F);var m=I===F?0:4-I%4;return[I,m]}function c(O){var F=b(O),I=F[0],m=F[1];return(I+m)*3/4-m}function T(O,F,I){return(F+I)*3/4-I}function R(O){var F,I=b(O),m=I[0],M=I[1],B=new i(T(O,m,M)),j=0,H=M>0?m-4:m,ee;for(ee=0;ee<H;ee+=4)F=y[O.charCodeAt(ee)]<<18|y[O.charCodeAt(ee+1)]<<12|y[O.charCodeAt(ee+2)]<<6|y[O.charCodeAt(ee+3)],B[j++]=F>>16&255,B[j++]=F>>8&255,B[j++]=F&255;return M===2&&(F=y[O.charCodeAt(ee)]<<2|y[O.charCodeAt(ee+1)]>>4,B[j++]=F&255),M===1&&(F=y[O.charCodeAt(ee)]<<10|y[O.charCodeAt(ee+1)]<<4|y[O.charCodeAt(ee+2)]>>2,B[j++]=F>>8&255,B[j++]=F&255),B}function x(O){return d[O>>18&63]+d[O>>12&63]+d[O>>6&63]+d[O&63]}function v(O,F,I){for(var m,M=[],B=F;B<I;B+=3)m=(O[B]<<16&16711680)+(O[B+1]<<8&65280)+(O[B+2]&255),M.push(x(m));return M.join("")}function L(O){for(var F,I=O.length,m=I%3,M=[],B=16383,j=0,H=I-m;j<H;j+=B)M.push(v(O,j,j+B>H?H:j+B));return m===1?(F=O[I-1],M.push(d[F>>2]+d[F<<4&63]+"==")):m===2&&(F=(O[I-2]<<8)+O[I-1],M.push(d[F>>10]+d[F>>4&63]+d[F<<2&63]+"=")),M.join("")}var N={};N.read=function(O,F,I,m,M){var B,j,H=M*8-m-1,ee=(1<<H)-1,K=ee>>1,U=-7,A=I?M-1:0,q=I?-1:1,ne=O[F+A];for(A+=q,B=ne&(1<<-U)-1,ne>>=-U,U+=H;U>0;B=B*256+O[F+A],A+=q,U-=8);for(j=B&(1<<-U)-1,B>>=-U,U+=m;U>0;j=j*256+O[F+A],A+=q,U-=8);if(B===0)B=1-K;else{if(B===ee)return j?NaN:(ne?-1:1)*(1/0);j=j+Math.pow(2,m),B=B-K}return(ne?-1:1)*j*Math.pow(2,B-m)},N.write=function(O,F,I,m,M,B){var j,H,ee,K=B*8-M-1,U=(1<<K)-1,A=U>>1,q=M===23?Math.pow(2,-24)-Math.pow(2,-77):0,ne=m?0:B-1,oe=m?1:-1,se=F<0||F===0&&1/F<0?1:0;for(F=Math.abs(F),isNaN(F)||F===1/0?(H=isNaN(F)?1:0,j=U):(j=Math.floor(Math.log(F)/Math.LN2),F*(ee=Math.pow(2,-j))<1&&(j--,ee*=2),j+A>=1?F+=q/ee:F+=q*Math.pow(2,1-A),F*ee>=2&&(j++,ee/=2),j+A>=U?(H=0,j=U):j+A>=1?(H=(F*ee-1)*Math.pow(2,M),j=j+A):(H=F*Math.pow(2,A-1)*Math.pow(2,M),j=0));M>=8;O[I+ne]=H&255,ne+=oe,H/=256,M-=8);for(j=j<<M|H,K+=M;K>0;O[I+ne]=j&255,ne+=oe,j/=256,K-=8);O[I+ne-oe]|=se*128};(function(O){const F=h,I=N,m=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;O.Buffer=U,O.SlowBuffer=Y,O.INSPECT_MAX_BYTES=50;const M=2147483647;O.kMaxLength=M;const{Uint8Array:B,ArrayBuffer:j,SharedArrayBuffer:H}=globalThis;U.TYPED_ARRAY_SUPPORT=ee(),!U.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 ee(){try{const l=new B(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,B.prototype),Object.setPrototypeOf(l,t),l.foo()===42}catch{return!1}}Object.defineProperty(U.prototype,"parent",{enumerable:!0,get:function(){if(U.isBuffer(this))return this.buffer}}),Object.defineProperty(U.prototype,"offset",{enumerable:!0,get:function(){if(U.isBuffer(this))return this.byteOffset}});function K(l){if(l>M)throw new RangeError('The value "'+l+'" is invalid for option "size"');const t=new B(l);return Object.setPrototypeOf(t,U.prototype),t}function U(l,t,n){if(typeof l=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return oe(l)}return A(l,t,n)}U.poolSize=8192;function A(l,t,n){if(typeof l=="string")return se(l,t);if(j.isView(l))return le(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(Ge(l,j)||l&&Ge(l.buffer,j)||typeof H<"u"&&(Ge(l,H)||l&&Ge(l.buffer,H)))return ce(l,t,n);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const _=l.valueOf&&l.valueOf();if(_!=null&&_!==l)return U.from(_,t,n);const C=we(l);if(C)return C;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return U.from(l[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}U.from=function(l,t,n){return A(l,t,n)},Object.setPrototypeOf(U.prototype,B.prototype),Object.setPrototypeOf(U,B);function q(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function ne(l,t,n){return q(l),l<=0?K(l):t!==void 0?typeof n=="string"?K(l).fill(t,n):K(l).fill(t):K(l)}U.alloc=function(l,t,n){return ne(l,t,n)};function oe(l){return q(l),K(l<0?0:G(l)|0)}U.allocUnsafe=function(l){return oe(l)},U.allocUnsafeSlow=function(l){return oe(l)};function se(l,t){if((typeof t!="string"||t==="")&&(t="utf8"),!U.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=z(l,t)|0;let _=K(n);const C=_.write(l,t);return C!==n&&(_=_.slice(0,C)),_}function fe(l){const t=l.length<0?0:G(l.length)|0,n=K(t);for(let _=0;_<t;_+=1)n[_]=l[_]&255;return n}function le(l){if(Ge(l,B)){const t=new B(l);return ce(t.buffer,t.byteOffset,t.byteLength)}return fe(l)}function ce(l,t,n){if(t<0||l.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let _;return t===void 0&&n===void 0?_=new B(l):n===void 0?_=new B(l,t):_=new B(l,t,n),Object.setPrototypeOf(_,U.prototype),_}function we(l){if(U.isBuffer(l)){const t=G(l.length)|0,n=K(t);return n.length===0||l.copy(n,0,0,t),n}if(l.length!==void 0)return typeof l.length!="number"||pn(l.length)?K(0):fe(l);if(l.type==="Buffer"&&Array.isArray(l.data))return fe(l.data)}function G(l){if(l>=M)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+M.toString(16)+" bytes");return l|0}function Y(l){return+l!=l&&(l=0),U.alloc(+l)}U.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==U.prototype},U.compare=function(t,n){if(Ge(t,B)&&(t=U.from(t,t.offset,t.byteLength)),Ge(n,B)&&(n=U.from(n,n.offset,n.byteLength)),!U.isBuffer(t)||!U.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===n)return 0;let _=t.length,C=n.length;for(let $=0,Z=Math.min(_,C);$<Z;++$)if(t[$]!==n[$]){_=t[$],C=n[$];break}return _<C?-1:C<_?1:0},U.isEncoding=function(t){switch(String(t).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}},U.concat=function(t,n){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return U.alloc(0);let _;if(n===void 0)for(n=0,_=0;_<t.length;++_)n+=t[_].length;const C=U.allocUnsafe(n);let $=0;for(_=0;_<t.length;++_){let Z=t[_];if(Ge(Z,B))$+Z.length>C.length?(U.isBuffer(Z)||(Z=U.from(Z)),Z.copy(C,$)):B.prototype.set.call(C,Z,$);else if(U.isBuffer(Z))Z.copy(C,$);else throw new TypeError('"list" argument must be an Array of Buffers');$+=Z.length}return C};function z(l,t){if(U.isBuffer(l))return l.length;if(j.isView(l)||Ge(l,j))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);const n=l.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&n===0)return 0;let C=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ve(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return me(l).length;default:if(C)return _?-1:ve(l).length;t=(""+t).toLowerCase(),C=!0}}U.byteLength=z;function ae(l,t,n){let _=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return"";for(l||(l="utf8");;)switch(l){case"hex":return Ue(this,t,n);case"utf8":case"utf-8":return pe(this,t,n);case"ascii":return Oe(this,t,n);case"latin1":case"binary":return X(this,t,n);case"base64":return ie(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ne(this,t,n);default:if(_)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),_=!0}}U.prototype._isBuffer=!0;function k(l,t,n){const _=l[t];l[t]=l[n],l[n]=_}U.prototype.swap16=function(){const t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<t;n+=2)k(this,n,n+1);return this},U.prototype.swap32=function(){const t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<t;n+=4)k(this,n,n+3),k(this,n+1,n+2);return this},U.prototype.swap64=function(){const t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<t;n+=8)k(this,n,n+7),k(this,n+1,n+6),k(this,n+2,n+5),k(this,n+3,n+4);return this},U.prototype.toString=function(){const t=this.length;return t===0?"":arguments.length===0?pe(this,0,t):ae.apply(this,arguments)},U.prototype.toLocaleString=U.prototype.toString,U.prototype.equals=function(t){if(!U.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:U.compare(this,t)===0},U.prototype.inspect=function(){let t="";const n=O.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},m&&(U.prototype[m]=U.prototype.inspect),U.prototype.compare=function(t,n,_,C,$){if(Ge(t,B)&&(t=U.from(t,t.offset,t.byteLength)),!U.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(n===void 0&&(n=0),_===void 0&&(_=t?t.length:0),C===void 0&&(C=0),$===void 0&&($=this.length),n<0||_>t.length||C<0||$>this.length)throw new RangeError("out of range index");if(C>=$&&n>=_)return 0;if(C>=$)return-1;if(n>=_)return 1;if(n>>>=0,_>>>=0,C>>>=0,$>>>=0,this===t)return 0;let Z=$-C,ge=_-n;const Ie=Math.min(Z,ge),Be=this.slice(C,$),Re=t.slice(n,_);for(let be=0;be<Ie;++be)if(Be[be]!==Re[be]){Z=Be[be],ge=Re[be];break}return Z<ge?-1:ge<Z?1:0};function D(l,t,n,_,C){if(l.length===0)return-1;if(typeof n=="string"?(_=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,pn(n)&&(n=C?0:l.length-1),n<0&&(n=l.length+n),n>=l.length){if(C)return-1;n=l.length-1}else if(n<0)if(C)n=0;else return-1;if(typeof t=="string"&&(t=U.from(t,_)),U.isBuffer(t))return t.length===0?-1:V(l,t,n,_,C);if(typeof t=="number")return t=t&255,typeof B.prototype.indexOf=="function"?C?B.prototype.indexOf.call(l,t,n):B.prototype.lastIndexOf.call(l,t,n):V(l,[t],n,_,C);throw new TypeError("val must be string, number or Buffer")}function V(l,t,n,_,C){let $=1,Z=l.length,ge=t.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(l.length<2||t.length<2)return-1;$=2,Z/=2,ge/=2,n/=2}function Ie(Re,be){return $===1?Re[be]:Re.readUInt16BE(be*$)}let Be;if(C){let Re=-1;for(Be=n;Be<Z;Be++)if(Ie(l,Be)===Ie(t,Re===-1?0:Be-Re)){if(Re===-1&&(Re=Be),Be-Re+1===ge)return Re*$}else Re!==-1&&(Be-=Be-Re),Re=-1}else for(n+ge>Z&&(n=Z-ge),Be=n;Be>=0;Be--){let Re=!0;for(let be=0;be<ge;be++)if(Ie(l,Be+be)!==Ie(t,be)){Re=!1;break}if(Re)return Be}return-1}U.prototype.includes=function(t,n,_){return this.indexOf(t,n,_)!==-1},U.prototype.indexOf=function(t,n,_){return D(this,t,n,_,!0)},U.prototype.lastIndexOf=function(t,n,_){return D(this,t,n,_,!1)};function te(l,t,n,_){n=Number(n)||0;const C=l.length-n;_?(_=Number(_),_>C&&(_=C)):_=C;const $=t.length;_>$/2&&(_=$/2);let Z;for(Z=0;Z<_;++Z){const ge=parseInt(t.substr(Z*2,2),16);if(pn(ge))return Z;l[n+Z]=ge}return Z}function re(l,t,n,_){return Et(ve(t,l.length-n),l,n,_)}function g(l,t,n,_){return Et(Se(t),l,n,_)}function w(l,t,n,_){return Et(me(t),l,n,_)}function J(l,t,n,_){return Et(Ae(t,l.length-n),l,n,_)}U.prototype.write=function(t,n,_,C){if(n===void 0)C="utf8",_=this.length,n=0;else if(_===void 0&&typeof n=="string")C=n,_=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(_)?(_=_>>>0,C===void 0&&(C="utf8")):(C=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const $=this.length-n;if((_===void 0||_>$)&&(_=$),t.length>0&&(_<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");C||(C="utf8");let Z=!1;for(;;)switch(C){case"hex":return te(this,t,n,_);case"utf8":case"utf-8":return re(this,t,n,_);case"ascii":case"latin1":case"binary":return g(this,t,n,_);case"base64":return w(this,t,n,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return J(this,t,n,_);default:if(Z)throw new TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),Z=!0}},U.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ie(l,t,n){return t===0&&n===l.length?F.fromByteArray(l):F.fromByteArray(l.slice(t,n))}function pe(l,t,n){n=Math.min(l.length,n);const _=[];let C=t;for(;C<n;){const $=l[C];let Z=null,ge=$>239?4:$>223?3:$>191?2:1;if(C+ge<=n){let Ie,Be,Re,be;switch(ge){case 1:$<128&&(Z=$);break;case 2:Ie=l[C+1],(Ie&192)===128&&(be=($&31)<<6|Ie&63,be>127&&(Z=be));break;case 3:Ie=l[C+1],Be=l[C+2],(Ie&192)===128&&(Be&192)===128&&(be=($&15)<<12|(Ie&63)<<6|Be&63,be>2047&&(be<55296||be>57343)&&(Z=be));break;case 4:Ie=l[C+1],Be=l[C+2],Re=l[C+3],(Ie&192)===128&&(Be&192)===128&&(Re&192)===128&&(be=($&15)<<18|(Ie&63)<<12|(Be&63)<<6|Re&63,be>65535&&be<1114112&&(Z=be))}}Z===null?(Z=65533,ge=1):Z>65535&&(Z-=65536,_.push(Z>>>10&1023|55296),Z=56320|Z&1023),_.push(Z),C+=ge}return he(_)}const ue=4096;function he(l){const t=l.length;if(t<=ue)return String.fromCharCode.apply(String,l);let n="",_=0;for(;_<t;)n+=String.fromCharCode.apply(String,l.slice(_,_+=ue));return n}function Oe(l,t,n){let _="";n=Math.min(l.length,n);for(let C=t;C<n;++C)_+=String.fromCharCode(l[C]&127);return _}function X(l,t,n){let _="";n=Math.min(l.length,n);for(let C=t;C<n;++C)_+=String.fromCharCode(l[C]);return _}function Ue(l,t,n){const _=l.length;(!t||t<0)&&(t=0),(!n||n<0||n>_)&&(n=_);let C="";for(let $=t;$<n;++$)C+=ks[l[$]];return C}function Ne(l,t,n){const _=l.slice(t,n);let C="";for(let $=0;$<_.length-1;$+=2)C+=String.fromCharCode(_[$]+_[$+1]*256);return C}U.prototype.slice=function(t,n){const _=this.length;t=~~t,n=n===void 0?_:~~n,t<0?(t+=_,t<0&&(t=0)):t>_&&(t=_),n<0?(n+=_,n<0&&(n=0)):n>_&&(n=_),n<t&&(n=t);const C=this.subarray(t,n);return Object.setPrototypeOf(C,U.prototype),C};function Ee(l,t,n){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+t>n)throw new RangeError("Trying to access beyond buffer length")}U.prototype.readUintLE=U.prototype.readUIntLE=function(t,n,_){t=t>>>0,n=n>>>0,_||Ee(t,n,this.length);let C=this[t],$=1,Z=0;for(;++Z<n&&($*=256);)C+=this[t+Z]*$;return C},U.prototype.readUintBE=U.prototype.readUIntBE=function(t,n,_){t=t>>>0,n=n>>>0,_||Ee(t,n,this.length);let C=this[t+--n],$=1;for(;n>0&&($*=256);)C+=this[t+--n]*$;return C},U.prototype.readUint8=U.prototype.readUInt8=function(t,n){return t=t>>>0,n||Ee(t,1,this.length),this[t]},U.prototype.readUint16LE=U.prototype.readUInt16LE=function(t,n){return t=t>>>0,n||Ee(t,2,this.length),this[t]|this[t+1]<<8},U.prototype.readUint16BE=U.prototype.readUInt16BE=function(t,n){return t=t>>>0,n||Ee(t,2,this.length),this[t]<<8|this[t+1]},U.prototype.readUint32LE=U.prototype.readUInt32LE=function(t,n){return t=t>>>0,n||Ee(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},U.prototype.readUint32BE=U.prototype.readUInt32BE=function(t,n){return t=t>>>0,n||Ee(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},U.prototype.readBigUInt64LE=Ke(function(t){t=t>>>0,P(t,"offset");const n=this[t],_=this[t+7];(n===void 0||_===void 0)&&W(t,this.length-8);const C=n+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,$=this[++t]+this[++t]*2**8+this[++t]*2**16+_*2**24;return BigInt(C)+(BigInt($)<<BigInt(32))}),U.prototype.readBigUInt64BE=Ke(function(t){t=t>>>0,P(t,"offset");const n=this[t],_=this[t+7];(n===void 0||_===void 0)&&W(t,this.length-8);const C=n*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],$=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+_;return(BigInt(C)<<BigInt(32))+BigInt($)}),U.prototype.readIntLE=function(t,n,_){t=t>>>0,n=n>>>0,_||Ee(t,n,this.length);let C=this[t],$=1,Z=0;for(;++Z<n&&($*=256);)C+=this[t+Z]*$;return $*=128,C>=$&&(C-=Math.pow(2,8*n)),C},U.prototype.readIntBE=function(t,n,_){t=t>>>0,n=n>>>0,_||Ee(t,n,this.length);let C=n,$=1,Z=this[t+--C];for(;C>0&&($*=256);)Z+=this[t+--C]*$;return $*=128,Z>=$&&(Z-=Math.pow(2,8*n)),Z},U.prototype.readInt8=function(t,n){return t=t>>>0,n||Ee(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},U.prototype.readInt16LE=function(t,n){t=t>>>0,n||Ee(t,2,this.length);const _=this[t]|this[t+1]<<8;return _&32768?_|4294901760:_},U.prototype.readInt16BE=function(t,n){t=t>>>0,n||Ee(t,2,this.length);const _=this[t+1]|this[t]<<8;return _&32768?_|4294901760:_},U.prototype.readInt32LE=function(t,n){return t=t>>>0,n||Ee(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},U.prototype.readInt32BE=function(t,n){return t=t>>>0,n||Ee(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},U.prototype.readBigInt64LE=Ke(function(t){t=t>>>0,P(t,"offset");const n=this[t],_=this[t+7];(n===void 0||_===void 0)&&W(t,this.length-8);const C=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(_<<24);return(BigInt(C)<<BigInt(32))+BigInt(n+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)}),U.prototype.readBigInt64BE=Ke(function(t){t=t>>>0,P(t,"offset");const n=this[t],_=this[t+7];(n===void 0||_===void 0)&&W(t,this.length-8);const C=(n<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(C)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+_)}),U.prototype.readFloatLE=function(t,n){return t=t>>>0,n||Ee(t,4,this.length),I.read(this,t,!0,23,4)},U.prototype.readFloatBE=function(t,n){return t=t>>>0,n||Ee(t,4,this.length),I.read(this,t,!1,23,4)},U.prototype.readDoubleLE=function(t,n){return t=t>>>0,n||Ee(t,8,this.length),I.read(this,t,!0,52,8)},U.prototype.readDoubleBE=function(t,n){return t=t>>>0,n||Ee(t,8,this.length),I.read(this,t,!1,52,8)};function _e(l,t,n,_,C,$){if(!U.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>C||t<$)throw new RangeError('"value" argument is out of bounds');if(n+_>l.length)throw new RangeError("Index out of range")}U.prototype.writeUintLE=U.prototype.writeUIntLE=function(t,n,_,C){if(t=+t,n=n>>>0,_=_>>>0,!C){const ge=Math.pow(2,8*_)-1;_e(this,t,n,_,ge,0)}let $=1,Z=0;for(this[n]=t&255;++Z<_&&($*=256);)this[n+Z]=t/$&255;return n+_},U.prototype.writeUintBE=U.prototype.writeUIntBE=function(t,n,_,C){if(t=+t,n=n>>>0,_=_>>>0,!C){const ge=Math.pow(2,8*_)-1;_e(this,t,n,_,ge,0)}let $=_-1,Z=1;for(this[n+$]=t&255;--$>=0&&(Z*=256);)this[n+$]=t/Z&255;return n+_},U.prototype.writeUint8=U.prototype.writeUInt8=function(t,n,_){return t=+t,n=n>>>0,_||_e(this,t,n,1,255,0),this[n]=t&255,n+1},U.prototype.writeUint16LE=U.prototype.writeUInt16LE=function(t,n,_){return t=+t,n=n>>>0,_||_e(this,t,n,2,65535,0),this[n]=t&255,this[n+1]=t>>>8,n+2},U.prototype.writeUint16BE=U.prototype.writeUInt16BE=function(t,n,_){return t=+t,n=n>>>0,_||_e(this,t,n,2,65535,0),this[n]=t>>>8,this[n+1]=t&255,n+2},U.prototype.writeUint32LE=U.prototype.writeUInt32LE=function(t,n,_){return t=+t,n=n>>>0,_||_e(this,t,n,4,4294967295,0),this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=t&255,n+4},U.prototype.writeUint32BE=U.prototype.writeUInt32BE=function(t,n,_){return t=+t,n=n>>>0,_||_e(this,t,n,4,4294967295,0),this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255,n+4};function Me(l,t,n,_,C){E(t,_,C,l,n,7);let $=Number(t&BigInt(4294967295));l[n++]=$,$=$>>8,l[n++]=$,$=$>>8,l[n++]=$,$=$>>8,l[n++]=$;let Z=Number(t>>BigInt(32)&BigInt(4294967295));return l[n++]=Z,Z=Z>>8,l[n++]=Z,Z=Z>>8,l[n++]=Z,Z=Z>>8,l[n++]=Z,n}function Fe(l,t,n,_,C){E(t,_,C,l,n,7);let $=Number(t&BigInt(4294967295));l[n+7]=$,$=$>>8,l[n+6]=$,$=$>>8,l[n+5]=$,$=$>>8,l[n+4]=$;let Z=Number(t>>BigInt(32)&BigInt(4294967295));return l[n+3]=Z,Z=Z>>8,l[n+2]=Z,Z=Z>>8,l[n+1]=Z,Z=Z>>8,l[n]=Z,n+8}U.prototype.writeBigUInt64LE=Ke(function(t,n=0){return Me(this,t,n,BigInt(0),BigInt("0xffffffffffffffff"))}),U.prototype.writeBigUInt64BE=Ke(function(t,n=0){return Fe(this,t,n,BigInt(0),BigInt("0xffffffffffffffff"))}),U.prototype.writeIntLE=function(t,n,_,C){if(t=+t,n=n>>>0,!C){const Ie=Math.pow(2,8*_-1);_e(this,t,n,_,Ie-1,-Ie)}let $=0,Z=1,ge=0;for(this[n]=t&255;++$<_&&(Z*=256);)t<0&&ge===0&&this[n+$-1]!==0&&(ge=1),this[n+$]=(t/Z>>0)-ge&255;return n+_},U.prototype.writeIntBE=function(t,n,_,C){if(t=+t,n=n>>>0,!C){const Ie=Math.pow(2,8*_-1);_e(this,t,n,_,Ie-1,-Ie)}let $=_-1,Z=1,ge=0;for(this[n+$]=t&255;--$>=0&&(Z*=256);)t<0&&ge===0&&this[n+$+1]!==0&&(ge=1),this[n+$]=(t/Z>>0)-ge&255;return n+_},U.prototype.writeInt8=function(t,n,_){return t=+t,n=n>>>0,_||_e(this,t,n,1,127,-128),t<0&&(t=255+t+1),this[n]=t&255,n+1},U.prototype.writeInt16LE=function(t,n,_){return t=+t,n=n>>>0,_||_e(this,t,n,2,32767,-32768),this[n]=t&255,this[n+1]=t>>>8,n+2},U.prototype.writeInt16BE=function(t,n,_){return t=+t,n=n>>>0,_||_e(this,t,n,2,32767,-32768),this[n]=t>>>8,this[n+1]=t&255,n+2},U.prototype.writeInt32LE=function(t,n,_){return t=+t,n=n>>>0,_||_e(this,t,n,4,2147483647,-2147483648),this[n]=t&255,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24,n+4},U.prototype.writeInt32BE=function(t,n,_){return t=+t,n=n>>>0,_||_e(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255,n+4},U.prototype.writeBigInt64LE=Ke(function(t,n=0){return Me(this,t,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),U.prototype.writeBigInt64BE=Ke(function(t,n=0){return Fe(this,t,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Le(l,t,n,_,C,$){if(n+_>l.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ke(l,t,n,_,C){return t=+t,n=n>>>0,C||Le(l,t,n,4),I.write(l,t,n,_,23,4),n+4}U.prototype.writeFloatLE=function(t,n,_){return ke(this,t,n,!0,_)},U.prototype.writeFloatBE=function(t,n,_){return ke(this,t,n,!1,_)};function xe(l,t,n,_,C){return t=+t,n=n>>>0,C||Le(l,t,n,8),I.write(l,t,n,_,52,8),n+8}U.prototype.writeDoubleLE=function(t,n,_){return xe(this,t,n,!0,_)},U.prototype.writeDoubleBE=function(t,n,_){return xe(this,t,n,!1,_)},U.prototype.copy=function(t,n,_,C){if(!U.isBuffer(t))throw new TypeError("argument should be a Buffer");if(_||(_=0),!C&&C!==0&&(C=this.length),n>=t.length&&(n=t.length),n||(n=0),C>0&&C<_&&(C=_),C===_||t.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("sourceEnd out of bounds");C>this.length&&(C=this.length),t.length-n<C-_&&(C=t.length-n+_);const $=C-_;return this===t&&typeof B.prototype.copyWithin=="function"?this.copyWithin(n,_,C):B.prototype.set.call(t,this.subarray(_,C),n),$},U.prototype.fill=function(t,n,_,C){if(typeof t=="string"){if(typeof n=="string"?(C=n,n=0,_=this.length):typeof _=="string"&&(C=_,_=this.length),C!==void 0&&typeof C!="string")throw new TypeError("encoding must be a string");if(typeof C=="string"&&!U.isEncoding(C))throw new TypeError("Unknown encoding: "+C);if(t.length===1){const Z=t.charCodeAt(0);(C==="utf8"&&Z<128||C==="latin1")&&(t=Z)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(n<0||this.length<n||this.length<_)throw new RangeError("Out of range index");if(_<=n)return this;n=n>>>0,_=_===void 0?this.length:_>>>0,t||(t=0);let $;if(typeof t=="number")for($=n;$<_;++$)this[$]=t;else{const Z=U.isBuffer(t)?t:U.from(t,C),ge=Z.length;if(ge===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for($=0;$<_-n;++$)this[$+n]=Z[$%ge]}return this};const Ve={};function f(l,t,n){Ve[l]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${l}]`,this.stack,delete this.name}get code(){return l}set code(C){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:C,writable:!0})}toString(){return`${this.name} [${l}]: ${this.message}`}}}f("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),f("ERR_INVALID_ARG_TYPE",function(l,t){return`The "${l}" argument must be of type number. Received type ${typeof t}`},TypeError),f("ERR_OUT_OF_RANGE",function(l,t,n){let _=`The value of "${l}" is out of range.`,C=n;return Number.isInteger(n)&&Math.abs(n)>2**32?C=e(String(n)):typeof n=="bigint"&&(C=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(C=e(C)),C+="n"),_+=` It must be ${t}. Received ${C}`,_},RangeError);function e(l){let t="",n=l.length;const _=l[0]==="-"?1:0;for(;n>=_+4;n-=3)t=`_${l.slice(n-3,n)}${t}`;return`${l.slice(0,n)}${t}`}function r(l,t,n){P(t,"offset"),(l[t]===void 0||l[t+n]===void 0)&&W(t,l.length-(n+1))}function E(l,t,n,_,C,$){if(l>n||l<t){const Z=typeof t=="bigint"?"n":"";let ge;throw t===0||t===BigInt(0)?ge=`>= 0${Z} and < 2${Z} ** ${($+1)*8}${Z}`:ge=`>= -(2${Z} ** ${($+1)*8-1}${Z}) and < 2 ** ${($+1)*8-1}${Z}`,new Ve.ERR_OUT_OF_RANGE("value",ge,l)}r(_,C,$)}function P(l,t){if(typeof l!="number")throw new Ve.ERR_INVALID_ARG_TYPE(t,"number",l)}function W(l,t,n){throw Math.floor(l)!==l?(P(l,n),new Ve.ERR_OUT_OF_RANGE("offset","an integer",l)):t<0?new Ve.ERR_BUFFER_OUT_OF_BOUNDS:new Ve.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,l)}const Q=/[^+/0-9A-Za-z-_]/g;function de(l){if(l=l.split("=")[0],l=l.trim().replace(Q,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function ve(l,t){t=t||1/0;let n;const _=l.length;let C=null;const $=[];for(let Z=0;Z<_;++Z){if(n=l.charCodeAt(Z),n>55295&&n<57344){if(!C){if(n>56319){(t-=3)>-1&&$.push(239,191,189);continue}else if(Z+1===_){(t-=3)>-1&&$.push(239,191,189);continue}C=n;continue}if(n<56320){(t-=3)>-1&&$.push(239,191,189),C=n;continue}n=(C-55296<<10|n-56320)+65536}else C&&(t-=3)>-1&&$.push(239,191,189);if(C=null,n<128){if((t-=1)<0)break;$.push(n)}else if(n<2048){if((t-=2)<0)break;$.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;$.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;$.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return $}function Se(l){const t=[];for(let n=0;n<l.length;++n)t.push(l.charCodeAt(n)&255);return t}function Ae(l,t){let n,_,C;const $=[];for(let Z=0;Z<l.length&&!((t-=2)<0);++Z)n=l.charCodeAt(Z),_=n>>8,C=n%256,$.push(C),$.push(_);return $}function me(l){return F.toByteArray(de(l))}function Et(l,t,n,_){let C;for(C=0;C<_&&!(C+n>=t.length||C>=l.length);++C)t[C+n]=l[C];return C}function Ge(l,t){return l instanceof t||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===t.name}function pn(l){return l!==l}const ks=(function(){const l="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const _=n*16;for(let C=0;C<16;++C)t[_+C]=l[n]+l[C]}return t})();function Ke(l){return typeof BigInt>"u"?Ds:l}function Ds(){throw new Error("BigInt not supported")}})(o);const S=o.Buffer;s.Blob=o.Blob,s.BlobOptions=o.BlobOptions,s.Buffer=o.Buffer,s.File=o.File,s.FileOptions=o.FileOptions,s.INSPECT_MAX_BYTES=o.INSPECT_MAX_BYTES,s.SlowBuffer=o.SlowBuffer,s.TranscodeEncoding=o.TranscodeEncoding,s.atob=o.atob,s.btoa=o.btoa,s.constants=o.constants,s.default=S,s.isAscii=o.isAscii,s.isUtf8=o.isUtf8,s.kMaxLength=o.kMaxLength,s.kStringMaxLength=o.kStringMaxLength,s.resolveObjectURL=o.resolveObjectURL,s.transcode=o.transcode})(It)),It}var Rt={},Tt={},xt,Bn;function In(){return Bn||(Bn=1,xt=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var o={},h=Symbol("test"),d=Object(h);if(typeof h=="string"||Object.prototype.toString.call(h)!=="[object Symbol]"||Object.prototype.toString.call(d)!=="[object Symbol]")return!1;var y=42;o[h]=y;for(var i in o)return!1;if(typeof Object.keys=="function"&&Object.keys(o).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(o).length!==0)return!1;var a=Object.getOwnPropertySymbols(o);if(a.length!==1||a[0]!==h||!Object.prototype.propertyIsEnumerable.call(o,h))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(o,h);if(u.value!==y||u.enumerable!==!0)return!1}return!0}),xt}var Ft,Rn;function dt(){if(Rn)return Ft;Rn=1;var s=In();return Ft=function(){return s()&&!!Symbol.toStringTag},Ft}var Ot,Tn;function xn(){return Tn||(Tn=1,Ot=Object),Ot}var Ut,Fn;function Do(){return Fn||(Fn=1,Ut=Error),Ut}var Nt,On;function qo(){return On||(On=1,Nt=EvalError),Nt}var Mt,Un;function jo(){return Un||(Un=1,Mt=RangeError),Mt}var Pt,Nn;function Go(){return Nn||(Nn=1,Pt=ReferenceError),Pt}var Lt,Mn;function Pn(){return Mn||(Mn=1,Lt=SyntaxError),Lt}var Ct,Ln;function st(){return Ln||(Ln=1,Ct=TypeError),Ct}var kt,Cn;function Wo(){return Cn||(Cn=1,kt=URIError),kt}var Dt,kn;function Ho(){return kn||(kn=1,Dt=Math.abs),Dt}var qt,Dn;function $o(){return Dn||(Dn=1,qt=Math.floor),qt}var jt,qn;function Yo(){return qn||(qn=1,jt=Math.max),jt}var Gt,jn;function Vo(){return jn||(jn=1,Gt=Math.min),Gt}var Wt,Gn;function Ko(){return Gn||(Gn=1,Wt=Math.pow),Wt}var Ht,Wn;function Jo(){return Wn||(Wn=1,Ht=Math.round),Ht}var $t,Hn;function zo(){return Hn||(Hn=1,$t=Number.isNaN||function(o){return o!==o}),$t}var Yt,$n;function Xo(){if($n)return Yt;$n=1;var s=zo();return Yt=function(h){return s(h)||h===0?h:h<0?-1:1},Yt}var Vt,Yn;function Qo(){return Yn||(Yn=1,Vt=Object.getOwnPropertyDescriptor),Vt}var Kt,Vn;function et(){if(Vn)return Kt;Vn=1;var s=Qo();if(s)try{s([],"length")}catch{s=null}return Kt=s,Kt}var Jt,Kn;function yt(){if(Kn)return Jt;Kn=1;var s=Object.defineProperty||!1;if(s)try{s({},"a",{value:1})}catch{s=!1}return Jt=s,Jt}var zt,Jn;function Zo(){if(Jn)return zt;Jn=1;var s=typeof Symbol<"u"&&Symbol,o=In();return zt=function(){return typeof s!="function"||typeof Symbol!="function"||typeof s("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:o()},zt}var Xt,zn;function Xn(){return zn||(zn=1,Xt=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Xt}var Qt,Qn;function Zn(){if(Qn)return Qt;Qn=1;var s=xn();return Qt=s.getPrototypeOf||null,Qt}var Zt,ei;function es(){if(ei)return Zt;ei=1;var s="Function.prototype.bind called on incompatible ",o=Object.prototype.toString,h=Math.max,d="[object Function]",y=function(p,b){for(var c=[],T=0;T<p.length;T+=1)c[T]=p[T];for(var R=0;R<b.length;R+=1)c[R+p.length]=b[R];return c},i=function(p,b){for(var c=[],T=b,R=0;T<p.length;T+=1,R+=1)c[R]=p[T];return c},a=function(u,p){for(var b="",c=0;c<u.length;c+=1)b+=u[c],c+1<u.length&&(b+=p);return b};return Zt=function(p){var b=this;if(typeof b!="function"||o.apply(b)!==d)throw new TypeError(s+b);for(var c=i(arguments,1),T,R=function(){if(this instanceof T){var S=b.apply(this,y(c,arguments));return Object(S)===S?S:this}return b.apply(p,y(c,arguments))},x=h(0,b.length-c.length),v=[],L=0;L<x;L++)v[L]="$"+L;if(T=Function("binder","return function ("+a(v,",")+"){ return binder.apply(this,arguments); }")(R),b.prototype){var N=function(){};N.prototype=b.prototype,T.prototype=new N,N.prototype=null}return T},Zt}var er,ti;function at(){if(ti)return er;ti=1;var s=es();return er=Function.prototype.bind||s,er}var tr,ri;function rr(){return ri||(ri=1,tr=Function.prototype.call),tr}var nr,ni;function ir(){return ni||(ni=1,nr=Function.prototype.apply),nr}var or,ii;function ts(){return ii||(ii=1,or=typeof Reflect<"u"&&Reflect&&Reflect.apply),or}var sr,oi;function si(){if(oi)return sr;oi=1;var s=at(),o=ir(),h=rr(),d=ts();return sr=d||s.call(h,o),sr}var ar,ai;function ur(){if(ai)return ar;ai=1;var s=at(),o=st(),h=rr(),d=si();return ar=function(i){if(i.length<1||typeof i[0]!="function")throw new o("a function is required");return d(s,h,i)},ar}var fr,ui;function rs(){if(ui)return fr;ui=1;var s=ur(),o=et(),h;try{h=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var d=!!h&&o&&o(Object.prototype,"__proto__"),y=Object,i=y.getPrototypeOf;return fr=d&&typeof d.get=="function"?s([d.get]):typeof i=="function"?function(u){return i(u==null?u:y(u))}:!1,fr}var lr,fi;function cr(){if(fi)return lr;fi=1;var s=Xn(),o=Zn(),h=rs();return lr=s?function(y){return s(y)}:o?function(y){if(!y||typeof y!="object"&&typeof y!="function")throw new TypeError("getProto: not an object");return o(y)}:h?function(y){return h(y)}:null,lr}var hr,li;function ci(){if(li)return hr;li=1;var s=Function.prototype.call,o=Object.prototype.hasOwnProperty,h=at();return hr=h.call(s,o),hr}var pr,hi;function pi(){if(hi)return pr;hi=1;var s,o=xn(),h=Do(),d=qo(),y=jo(),i=Go(),a=Pn(),u=st(),p=Wo(),b=Ho(),c=$o(),T=Yo(),R=Vo(),x=Ko(),v=Jo(),L=Xo(),N=Function,S=function(te){try{return N('"use strict"; return ('+te+").constructor;")()}catch{}},O=et(),F=yt(),I=function(){throw new u},m=O?(function(){try{return arguments.callee,I}catch{try{return O(arguments,"callee").get}catch{return I}}})():I,M=Zo()(),B=cr(),j=Zn(),H=Xn(),ee=ir(),K=rr(),U={},A=typeof Uint8Array>"u"||!B?s:B(Uint8Array),q={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?s:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?s:ArrayBuffer,"%ArrayIteratorPrototype%":M&&B?B([][Symbol.iterator]()):s,"%AsyncFromSyncIteratorPrototype%":s,"%AsyncFunction%":U,"%AsyncGenerator%":U,"%AsyncGeneratorFunction%":U,"%AsyncIteratorPrototype%":U,"%Atomics%":typeof Atomics>"u"?s:Atomics,"%BigInt%":typeof BigInt>"u"?s:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?s:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?s:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?s:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":h,"%eval%":eval,"%EvalError%":d,"%Float16Array%":typeof Float16Array>"u"?s:Float16Array,"%Float32Array%":typeof Float32Array>"u"?s:Float32Array,"%Float64Array%":typeof Float64Array>"u"?s:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?s:FinalizationRegistry,"%Function%":N,"%GeneratorFunction%":U,"%Int8Array%":typeof Int8Array>"u"?s:Int8Array,"%Int16Array%":typeof Int16Array>"u"?s:Int16Array,"%Int32Array%":typeof Int32Array>"u"?s:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":M&&B?B(B([][Symbol.iterator]())):s,"%JSON%":typeof JSON=="object"?JSON:s,"%Map%":typeof Map>"u"?s:Map,"%MapIteratorPrototype%":typeof Map>"u"||!M||!B?s:B(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":o,"%Object.getOwnPropertyDescriptor%":O,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?s:Promise,"%Proxy%":typeof Proxy>"u"?s:Proxy,"%RangeError%":y,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?s:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?s:Set,"%SetIteratorPrototype%":typeof Set>"u"||!M||!B?s:B(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?s:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":M&&B?B(""[Symbol.iterator]()):s,"%Symbol%":M?Symbol:s,"%SyntaxError%":a,"%ThrowTypeError%":m,"%TypedArray%":A,"%TypeError%":u,"%Uint8Array%":typeof Uint8Array>"u"?s:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?s:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?s:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?s:Uint32Array,"%URIError%":p,"%WeakMap%":typeof WeakMap>"u"?s:WeakMap,"%WeakRef%":typeof WeakRef>"u"?s:WeakRef,"%WeakSet%":typeof WeakSet>"u"?s:WeakSet,"%Function.prototype.call%":K,"%Function.prototype.apply%":ee,"%Object.defineProperty%":F,"%Object.getPrototypeOf%":j,"%Math.abs%":b,"%Math.floor%":c,"%Math.max%":T,"%Math.min%":R,"%Math.pow%":x,"%Math.round%":v,"%Math.sign%":L,"%Reflect.getPrototypeOf%":H};if(B)try{null.error}catch(te){var ne=B(B(te));q["%Error.prototype%"]=ne}var oe=function te(re){var g;if(re==="%AsyncFunction%")g=S("async function () {}");else if(re==="%GeneratorFunction%")g=S("function* () {}");else if(re==="%AsyncGeneratorFunction%")g=S("async function* () {}");else if(re==="%AsyncGenerator%"){var w=te("%AsyncGeneratorFunction%");w&&(g=w.prototype)}else if(re==="%AsyncIteratorPrototype%"){var J=te("%AsyncGenerator%");J&&B&&(g=B(J.prototype))}return q[re]=g,g},se={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},fe=at(),le=ci(),ce=fe.call(K,Array.prototype.concat),we=fe.call(ee,Array.prototype.splice),G=fe.call(K,String.prototype.replace),Y=fe.call(K,String.prototype.slice),z=fe.call(K,RegExp.prototype.exec),ae=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,k=/\\(\\)?/g,D=function(re){var g=Y(re,0,1),w=Y(re,-1);if(g==="%"&&w!=="%")throw new a("invalid intrinsic syntax, expected closing `%`");if(w==="%"&&g!=="%")throw new a("invalid intrinsic syntax, expected opening `%`");var J=[];return G(re,ae,function(ie,pe,ue,he){J[J.length]=ue?G(he,k,"$1"):pe||ie}),J},V=function(re,g){var w=re,J;if(le(se,w)&&(J=se[w],w="%"+J[0]+"%"),le(q,w)){var ie=q[w];if(ie===U&&(ie=oe(w)),typeof ie>"u"&&!g)throw new u("intrinsic "+re+" exists, but is not available. Please file an issue!");return{alias:J,name:w,value:ie}}throw new a("intrinsic "+re+" does not exist!")};return pr=function(re,g){if(typeof re!="string"||re.length===0)throw new u("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof g!="boolean")throw new u('"allowMissing" argument must be a boolean');if(z(/^%?[^%]*%?$/,re)===null)throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var w=D(re),J=w.length>0?w[0]:"",ie=V("%"+J+"%",g),pe=ie.name,ue=ie.value,he=!1,Oe=ie.alias;Oe&&(J=Oe[0],we(w,ce([0,1],Oe)));for(var X=1,Ue=!0;X<w.length;X+=1){var Ne=w[X],Ee=Y(Ne,0,1),_e=Y(Ne,-1);if((Ee==='"'||Ee==="'"||Ee==="`"||_e==='"'||_e==="'"||_e==="`")&&Ee!==_e)throw new a("property names with quotes must have matching quotes");if((Ne==="constructor"||!Ue)&&(he=!0),J+="."+Ne,pe="%"+J+"%",le(q,pe))ue=q[pe];else if(ue!=null){if(!(Ne in ue)){if(!g)throw new u("base intrinsic for "+re+" exists, but the property is not available.");return}if(O&&X+1>=w.length){var Me=O(ue,Ne);Ue=!!Me,Ue&&"get"in Me&&!("originalValue"in Me.get)?ue=Me.get:ue=ue[Ne]}else Ue=le(ue,Ne),ue=ue[Ne];Ue&&!he&&(q[pe]=ue)}}return ue},pr}var dr,di;function ut(){if(di)return dr;di=1;var s=pi(),o=ur(),h=o([s("%String.prototype.indexOf%")]);return dr=function(y,i){var a=s(y,!!i);return typeof a=="function"&&h(y,".prototype.")>-1?o([a]):a},dr}var yr,yi;function ns(){if(yi)return yr;yi=1;var s=dt()(),o=ut(),h=o("Object.prototype.toString"),d=function(u){return s&&u&&typeof u=="object"&&Symbol.toStringTag in u?!1:h(u)==="[object Arguments]"},y=function(u){return d(u)?!0:u!==null&&typeof u=="object"&&"length"in u&&typeof u.length=="number"&&u.length>=0&&h(u)!=="[object Array]"&&"callee"in u&&h(u.callee)==="[object Function]"},i=(function(){return d(arguments)})();return d.isLegacyArguments=y,yr=i?d:y,yr}var gr,gi;function is(){if(gi)return gr;gi=1;var s=ut(),o=dt()(),h=ci(),d=et(),y;if(o){var i=s("RegExp.prototype.exec"),a={},u=function(){throw a},p={toString:u,valueOf:u};typeof Symbol.toPrimitive=="symbol"&&(p[Symbol.toPrimitive]=u),y=function(R){if(!R||typeof R!="object")return!1;var x=d(R,"lastIndex"),v=x&&h(x,"value");if(!v)return!1;try{i(R,p)}catch(L){return L===a}}}else{var b=s("Object.prototype.toString"),c="[object RegExp]";y=function(R){return!R||typeof R!="object"&&typeof R!="function"?!1:b(R)===c}}return gr=y,gr}var wr,wi;function os(){if(wi)return wr;wi=1;var s=ut(),o=is(),h=s("RegExp.prototype.exec"),d=st();return wr=function(i){if(!o(i))throw new d("`regex` must be a RegExp");return function(u){return h(i,u)!==null}},wr}var mr,mi;function ss(){if(mi)return mr;mi=1;const s=function*(){}.constructor;return mr=()=>s,mr}var Er,Ei;function as(){if(Ei)return Er;Ei=1;var s=ut(),o=os(),h=o(/^\s*(?:function)?\*/),d=dt()(),y=cr(),i=s("Object.prototype.toString"),a=s("Function.prototype.toString"),u=ss();return Er=function(b){if(typeof b!="function")return!1;if(h(a(b)))return!0;if(!d){var c=i(b);return c==="[object GeneratorFunction]"}if(!y)return!1;var T=u();return T&&y(b)===T.prototype},Er}var br,bi;function us(){if(bi)return br;bi=1;var s=Function.prototype.toString,o=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,h,d;if(typeof o=="function"&&typeof Object.defineProperty=="function")try{h=Object.defineProperty({},"length",{get:function(){throw d}}),d={},o(function(){throw 42},null,h)}catch(O){O!==d&&(o=null)}else o=null;var y=/^\s*class\b/,i=function(F){try{var I=s.call(F);return y.test(I)}catch{return!1}},a=function(F){try{return i(F)?!1:(s.call(F),!0)}catch{return!1}},u=Object.prototype.toString,p="[object Object]",b="[object Function]",c="[object GeneratorFunction]",T="[object HTMLAllCollection]",R="[object HTML document.all class]",x="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,L=!(0 in[,]),N=function(){return!1};if(typeof document=="object"){var S=document.all;u.call(S)===u.call(document.all)&&(N=function(F){if((L||!F)&&(typeof F>"u"||typeof F=="object"))try{var I=u.call(F);return(I===T||I===R||I===x||I===p)&&F("")==null}catch{}return!1})}return br=o?function(F){if(N(F))return!0;if(!F||typeof F!="function"&&typeof F!="object")return!1;try{o(F,null,h)}catch(I){if(I!==d)return!1}return!i(F)&&a(F)}:function(F){if(N(F))return!0;if(!F||typeof F!="function"&&typeof F!="object")return!1;if(v)return a(F);if(i(F))return!1;var I=u.call(F);return I!==b&&I!==c&&!/^\[object HTML/.test(I)?!1:a(F)},br}var _r,_i;function fs(){if(_i)return _r;_i=1;var s=us(),o=Object.prototype.toString,h=Object.prototype.hasOwnProperty,d=function(p,b,c){for(var T=0,R=p.length;T<R;T++)h.call(p,T)&&(c==null?b(p[T],T,p):b.call(c,p[T],T,p))},y=function(p,b,c){for(var T=0,R=p.length;T<R;T++)c==null?b(p.charAt(T),T,p):b.call(c,p.charAt(T),T,p)},i=function(p,b,c){for(var T in p)h.call(p,T)&&(c==null?b(p[T],T,p):b.call(c,p[T],T,p))};function a(u){return o.call(u)==="[object Array]"}return _r=function(p,b,c){if(!s(b))throw new TypeError("iterator must be a function");var T;arguments.length>=3&&(T=c),a(p)?d(p,b,T):typeof p=="string"?y(p,b,T):i(p,b,T)},_r}var vr,vi;function ls(){return vi||(vi=1,vr=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),vr}var Sr,Si;function cs(){if(Si)return Sr;Si=1;var s=ls(),o=typeof globalThis>"u"?$e:globalThis;return Sr=function(){for(var d=[],y=0;y<s.length;y++)typeof o[s[y]]=="function"&&(d[d.length]=s[y]);return d},Sr}var Ar={exports:{}},Br,Ai;function hs(){if(Ai)return Br;Ai=1;var s=yt(),o=Pn(),h=st(),d=et();return Br=function(i,a,u){if(!i||typeof i!="object"&&typeof i!="function")throw new h("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new h("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new h("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new h("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new h("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new h("`loose`, if provided, must be a boolean");var p=arguments.length>3?arguments[3]:null,b=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,T=arguments.length>6?arguments[6]:!1,R=!!d&&d(i,a);if(s)s(i,a,{configurable:c===null&&R?R.configurable:!c,enumerable:p===null&&R?R.enumerable:!p,value:u,writable:b===null&&R?R.writable:!b});else if(T||!p&&!b&&!c)i[a]=u;else throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Br}var Ir,Bi;function ps(){if(Bi)return Ir;Bi=1;var s=yt(),o=function(){return!!s};return o.hasArrayLengthDefineBug=function(){if(!s)return null;try{return s([],"length",{value:1}).length!==1}catch{return!0}},Ir=o,Ir}var Rr,Ii;function ds(){if(Ii)return Rr;Ii=1;var s=pi(),o=hs(),h=ps()(),d=et(),y=st(),i=s("%Math.floor%");return Rr=function(u,p){if(typeof u!="function")throw new y("`fn` is not a function");if(typeof p!="number"||p<0||p>4294967295||i(p)!==p)throw new y("`length` must be a positive 32-bit integer");var b=arguments.length>2&&!!arguments[2],c=!0,T=!0;if("length"in u&&d){var R=d(u,"length");R&&!R.configurable&&(c=!1),R&&!R.writable&&(T=!1)}return(c||T||!b)&&(h?o(u,"length",p,!0,!0):o(u,"length",p)),u},Rr}var Tr,Ri;function ys(){if(Ri)return Tr;Ri=1;var s=at(),o=ir(),h=si();return Tr=function(){return h(s,o,arguments)},Tr}var Ti;function gs(){return Ti||(Ti=1,(function(s){var o=ds(),h=yt(),d=ur(),y=ys();s.exports=function(a){var u=d(arguments),p=a.length-(arguments.length-1);return o(u,1+(p>0?p:0),!0)},h?h(s.exports,"apply",{value:y}):s.exports.apply=y})(Ar)),Ar.exports}var xr,xi;function Fi(){if(xi)return xr;xi=1;var s=fs(),o=cs(),h=gs(),d=ut(),y=et(),i=cr(),a=d("Object.prototype.toString"),u=dt()(),p=typeof globalThis>"u"?$e:globalThis,b=o(),c=d("String.prototype.slice"),T=d("Array.prototype.indexOf",!0)||function(N,S){for(var O=0;O<N.length;O+=1)if(N[O]===S)return O;return-1},R={__proto__:null};u&&y&&i?s(b,function(L){var N=new p[L];if(Symbol.toStringTag in N&&i){var S=i(N),O=y(S,Symbol.toStringTag);if(!O&&S){var F=i(S);O=y(F,Symbol.toStringTag)}R["$"+L]=h(O.get)}}):s(b,function(L){var N=new p[L],S=N.slice||N.set;S&&(R["$"+L]=h(S))});var x=function(N){var S=!1;return s(R,function(O,F){if(!S)try{"$"+O(N)===F&&(S=c(F,1))}catch{}}),S},v=function(N){var S=!1;return s(R,function(O,F){if(!S)try{O(N),S=c(F,1)}catch{}}),S};return xr=function(N){if(!N||typeof N!="object")return!1;if(!u){var S=c(a(N),8,-1);return T(b,S)>-1?S:S!=="Object"?!1:v(N)}return y?x(N):null},xr}var Fr,Oi;function ws(){if(Oi)return Fr;Oi=1;var s=Fi();return Fr=function(h){return!!s(h)},Fr}var Ui;function ms(){return Ui||(Ui=1,(function(s){var o=ns(),h=as(),d=Fi(),y=ws();function i(X){return X.call.bind(X)}var a=typeof BigInt<"u",u=typeof Symbol<"u",p=i(Object.prototype.toString),b=i(Number.prototype.valueOf),c=i(String.prototype.valueOf),T=i(Boolean.prototype.valueOf);if(a)var R=i(BigInt.prototype.valueOf);if(u)var x=i(Symbol.prototype.valueOf);function v(X,Ue){if(typeof X!="object")return!1;try{return Ue(X),!0}catch{return!1}}s.isArgumentsObject=o,s.isGeneratorFunction=h,s.isTypedArray=y;function L(X){return typeof Promise<"u"&&X instanceof Promise||X!==null&&typeof X=="object"&&typeof X.then=="function"&&typeof X.catch=="function"}s.isPromise=L;function N(X){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(X):y(X)||Y(X)}s.isArrayBufferView=N;function S(X){return d(X)==="Uint8Array"}s.isUint8Array=S;function O(X){return d(X)==="Uint8ClampedArray"}s.isUint8ClampedArray=O;function F(X){return d(X)==="Uint16Array"}s.isUint16Array=F;function I(X){return d(X)==="Uint32Array"}s.isUint32Array=I;function m(X){return d(X)==="Int8Array"}s.isInt8Array=m;function M(X){return d(X)==="Int16Array"}s.isInt16Array=M;function B(X){return d(X)==="Int32Array"}s.isInt32Array=B;function j(X){return d(X)==="Float32Array"}s.isFloat32Array=j;function H(X){return d(X)==="Float64Array"}s.isFloat64Array=H;function ee(X){return d(X)==="BigInt64Array"}s.isBigInt64Array=ee;function K(X){return d(X)==="BigUint64Array"}s.isBigUint64Array=K;function U(X){return p(X)==="[object Map]"}U.working=typeof Map<"u"&&U(new Map);function A(X){return typeof Map>"u"?!1:U.working?U(X):X instanceof Map}s.isMap=A;function q(X){return p(X)==="[object Set]"}q.working=typeof Set<"u"&&q(new Set);function ne(X){return typeof Set>"u"?!1:q.working?q(X):X instanceof Set}s.isSet=ne;function oe(X){return p(X)==="[object WeakMap]"}oe.working=typeof WeakMap<"u"&&oe(new WeakMap);function se(X){return typeof WeakMap>"u"?!1:oe.working?oe(X):X instanceof WeakMap}s.isWeakMap=se;function fe(X){return p(X)==="[object WeakSet]"}fe.working=typeof WeakSet<"u"&&fe(new WeakSet);function le(X){return fe(X)}s.isWeakSet=le;function ce(X){return p(X)==="[object ArrayBuffer]"}ce.working=typeof ArrayBuffer<"u"&&ce(new ArrayBuffer);function we(X){return typeof ArrayBuffer>"u"?!1:ce.working?ce(X):X instanceof ArrayBuffer}s.isArrayBuffer=we;function G(X){return p(X)==="[object DataView]"}G.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&G(new DataView(new ArrayBuffer(1),0,1));function Y(X){return typeof DataView>"u"?!1:G.working?G(X):X instanceof DataView}s.isDataView=Y;var z=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function ae(X){return p(X)==="[object SharedArrayBuffer]"}function k(X){return typeof z>"u"?!1:(typeof ae.working>"u"&&(ae.working=ae(new z)),ae.working?ae(X):X instanceof z)}s.isSharedArrayBuffer=k;function D(X){return p(X)==="[object AsyncFunction]"}s.isAsyncFunction=D;function V(X){return p(X)==="[object Map Iterator]"}s.isMapIterator=V;function te(X){return p(X)==="[object Set Iterator]"}s.isSetIterator=te;function re(X){return p(X)==="[object Generator]"}s.isGeneratorObject=re;function g(X){return p(X)==="[object WebAssembly.Module]"}s.isWebAssemblyCompiledModule=g;function w(X){return v(X,b)}s.isNumberObject=w;function J(X){return v(X,c)}s.isStringObject=J;function ie(X){return v(X,T)}s.isBooleanObject=ie;function pe(X){return a&&v(X,R)}s.isBigIntObject=pe;function ue(X){return u&&v(X,x)}s.isSymbolObject=ue;function he(X){return w(X)||J(X)||ie(X)||pe(X)||ue(X)}s.isBoxedPrimitive=he;function Oe(X){return typeof Uint8Array<"u"&&(we(X)||k(X))}s.isAnyArrayBuffer=Oe,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(X){Object.defineProperty(s,X,{enumerable:!1,value:function(){throw new Error(X+" is not supported in userland")}})})})(Tt)),Tt}var Or,Ni;function Es(){return Ni||(Ni=1,Or=function(o){return o&&typeof o=="object"&&typeof o.copy=="function"&&typeof o.fill=="function"&&typeof o.readUInt8=="function"}),Or}var Mi;function Pi(){return Mi||(Mi=1,(function(s){var o=Object.getOwnPropertyDescriptors||function(Y){for(var z=Object.keys(Y),ae={},k=0;k<z.length;k++)ae[z[k]]=Object.getOwnPropertyDescriptor(Y,z[k]);return ae},h=/%[sdj%]/g;s.format=function(G){if(!m(G)){for(var Y=[],z=0;z<arguments.length;z++)Y.push(a(arguments[z]));return Y.join(" ")}for(var z=1,ae=arguments,k=ae.length,D=String(G).replace(h,function(te){if(te==="%%")return"%";if(z>=k)return te;switch(te){case"%s":return String(ae[z++]);case"%d":return Number(ae[z++]);case"%j":try{return JSON.stringify(ae[z++])}catch{return"[Circular]"}default:return te}}),V=ae[z];z<k;V=ae[++z])O(V)||!H(V)?D+=" "+V:D+=" "+a(V);return D},s.deprecate=function(G,Y){if(typeof ye<"u"&&ye.noDeprecation===!0)return G;if(typeof ye>"u")return function(){return s.deprecate(G,Y).apply(this,arguments)};var z=!1;function ae(){if(!z){if(ye.throwDeprecation)throw new Error(Y);ye.traceDeprecation?console.trace(Y):console.error(Y),z=!0}return G.apply(this,arguments)}return ae};var d={},y=/^$/;if(ye.env.NODE_DEBUG){var i=ye.env.NODE_DEBUG;i=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),y=new RegExp("^"+i+"$","i")}s.debuglog=function(G){if(G=G.toUpperCase(),!d[G])if(y.test(G)){var Y=ye.pid;d[G]=function(){var z=s.format.apply(s,arguments);console.error("%s %d: %s",G,Y,z)}}else d[G]=function(){};return d[G]};function a(G,Y){var z={seen:[],stylize:p};return arguments.length>=3&&(z.depth=arguments[2]),arguments.length>=4&&(z.colors=arguments[3]),S(Y)?z.showHidden=Y:Y&&s._extend(z,Y),B(z.showHidden)&&(z.showHidden=!1),B(z.depth)&&(z.depth=2),B(z.colors)&&(z.colors=!1),B(z.customInspect)&&(z.customInspect=!0),z.colors&&(z.stylize=u),c(z,G,z.depth)}s.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function u(G,Y){var z=a.styles[Y];return z?"\x1B["+a.colors[z][0]+"m"+G+"\x1B["+a.colors[z][1]+"m":G}function p(G,Y){return G}function b(G){var Y={};return G.forEach(function(z,ae){Y[z]=!0}),Y}function c(G,Y,z){if(G.customInspect&&Y&&U(Y.inspect)&&Y.inspect!==s.inspect&&!(Y.constructor&&Y.constructor.prototype===Y)){var ae=Y.inspect(z,G);return m(ae)||(ae=c(G,ae,z)),ae}var k=T(G,Y);if(k)return k;var D=Object.keys(Y),V=b(D);if(G.showHidden&&(D=Object.getOwnPropertyNames(Y)),K(Y)&&(D.indexOf("message")>=0||D.indexOf("description")>=0))return R(Y);if(D.length===0){if(U(Y)){var te=Y.name?": "+Y.name:"";return G.stylize("[Function"+te+"]","special")}if(j(Y))return G.stylize(RegExp.prototype.toString.call(Y),"regexp");if(ee(Y))return G.stylize(Date.prototype.toString.call(Y),"date");if(K(Y))return R(Y)}var re="",g=!1,w=["{","}"];if(N(Y)&&(g=!0,w=["[","]"]),U(Y)){var J=Y.name?": "+Y.name:"";re=" [Function"+J+"]"}if(j(Y)&&(re=" "+RegExp.prototype.toString.call(Y)),ee(Y)&&(re=" "+Date.prototype.toUTCString.call(Y)),K(Y)&&(re=" "+R(Y)),D.length===0&&(!g||Y.length==0))return w[0]+re+w[1];if(z<0)return j(Y)?G.stylize(RegExp.prototype.toString.call(Y),"regexp"):G.stylize("[Object]","special");G.seen.push(Y);var ie;return g?ie=x(G,Y,z,V,D):ie=D.map(function(pe){return v(G,Y,z,V,pe,g)}),G.seen.pop(),L(ie,re,w)}function T(G,Y){if(B(Y))return G.stylize("undefined","undefined");if(m(Y)){var z="'"+JSON.stringify(Y).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return G.stylize(z,"string")}if(I(Y))return G.stylize(""+Y,"number");if(S(Y))return G.stylize(""+Y,"boolean");if(O(Y))return G.stylize("null","null")}function R(G){return"["+Error.prototype.toString.call(G)+"]"}function x(G,Y,z,ae,k){for(var D=[],V=0,te=Y.length;V<te;++V)fe(Y,String(V))?D.push(v(G,Y,z,ae,String(V),!0)):D.push("");return k.forEach(function(re){re.match(/^\d+$/)||D.push(v(G,Y,z,ae,re,!0))}),D}function v(G,Y,z,ae,k,D){var V,te,re;if(re=Object.getOwnPropertyDescriptor(Y,k)||{value:Y[k]},re.get?re.set?te=G.stylize("[Getter/Setter]","special"):te=G.stylize("[Getter]","special"):re.set&&(te=G.stylize("[Setter]","special")),fe(ae,k)||(V="["+k+"]"),te||(G.seen.indexOf(re.value)<0?(O(z)?te=c(G,re.value,null):te=c(G,re.value,z-1),te.indexOf(`
2
+ `)>-1&&(D?te=te.split(`
3
+ `).map(function(g){return" "+g}).join(`
4
+ `).slice(2):te=`
5
+ `+te.split(`
6
+ `).map(function(g){return" "+g}).join(`
7
+ `))):te=G.stylize("[Circular]","special")),B(V)){if(D&&k.match(/^\d+$/))return te;V=JSON.stringify(""+k),V.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(V=V.slice(1,-1),V=G.stylize(V,"name")):(V=V.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),V=G.stylize(V,"string"))}return V+": "+te}function L(G,Y,z){var ae=G.reduce(function(k,D){return D.indexOf(`
8
+ `)>=0,k+D.replace(/\u001b\[\d\d?m/g,"").length+1},0);return ae>60?z[0]+(Y===""?"":Y+`
9
+ `)+" "+G.join(`,
10
+ `)+" "+z[1]:z[0]+Y+" "+G.join(", ")+" "+z[1]}s.types=ms();function N(G){return Array.isArray(G)}s.isArray=N;function S(G){return typeof G=="boolean"}s.isBoolean=S;function O(G){return G===null}s.isNull=O;function F(G){return G==null}s.isNullOrUndefined=F;function I(G){return typeof G=="number"}s.isNumber=I;function m(G){return typeof G=="string"}s.isString=m;function M(G){return typeof G=="symbol"}s.isSymbol=M;function B(G){return G===void 0}s.isUndefined=B;function j(G){return H(G)&&q(G)==="[object RegExp]"}s.isRegExp=j,s.types.isRegExp=j;function H(G){return typeof G=="object"&&G!==null}s.isObject=H;function ee(G){return H(G)&&q(G)==="[object Date]"}s.isDate=ee,s.types.isDate=ee;function K(G){return H(G)&&(q(G)==="[object Error]"||G instanceof Error)}s.isError=K,s.types.isNativeError=K;function U(G){return typeof G=="function"}s.isFunction=U;function A(G){return G===null||typeof G=="boolean"||typeof G=="number"||typeof G=="string"||typeof G=="symbol"||typeof G>"u"}s.isPrimitive=A,s.isBuffer=Es();function q(G){return Object.prototype.toString.call(G)}function ne(G){return G<10?"0"+G.toString(10):G.toString(10)}var oe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function se(){var G=new Date,Y=[ne(G.getHours()),ne(G.getMinutes()),ne(G.getSeconds())].join(":");return[G.getDate(),oe[G.getMonth()],Y].join(" ")}s.log=function(){console.log("%s - %s",se(),s.format.apply(s,arguments))},s.inherits=ze(),s._extend=function(G,Y){if(!Y||!H(Y))return G;for(var z=Object.keys(Y),ae=z.length;ae--;)G[z[ae]]=Y[z[ae]];return G};function fe(G,Y){return Object.prototype.hasOwnProperty.call(G,Y)}var le=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;s.promisify=function(Y){if(typeof Y!="function")throw new TypeError('The "original" argument must be of type Function');if(le&&Y[le]){var z=Y[le];if(typeof z!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(z,le,{value:z,enumerable:!1,writable:!1,configurable:!0}),z}function z(){for(var ae,k,D=new Promise(function(re,g){ae=re,k=g}),V=[],te=0;te<arguments.length;te++)V.push(arguments[te]);V.push(function(re,g){re?k(re):ae(g)});try{Y.apply(this,V)}catch(re){k(re)}return D}return Object.setPrototypeOf(z,Object.getPrototypeOf(Y)),le&&Object.defineProperty(z,le,{value:z,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(z,o(Y))},s.promisify.custom=le;function ce(G,Y){if(!G){var z=new Error("Promise was rejected with a falsy value");z.reason=G,G=z}return Y(G)}function we(G){if(typeof G!="function")throw new TypeError('The "original" argument must be of type Function');function Y(){for(var z=[],ae=0;ae<arguments.length;ae++)z.push(arguments[ae]);var k=z.pop();if(typeof k!="function")throw new TypeError("The last argument must be of type Function");var D=this,V=function(){return k.apply(D,arguments)};G.apply(this,z).then(function(te){ye.nextTick(V.bind(null,null,te))},function(te){ye.nextTick(ce.bind(null,te,V))})}return Object.setPrototypeOf(Y,Object.getPrototypeOf(G)),Object.defineProperties(Y,o(G)),Y}s.callbackify=we})(Rt)),Rt}var Ur,Li;function bs(){if(Li)return Ur;Li=1;function s(v,L){var N=Object.keys(v);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(v);L&&(S=S.filter(function(O){return Object.getOwnPropertyDescriptor(v,O).enumerable})),N.push.apply(N,S)}return N}function o(v){for(var L=1;L<arguments.length;L++){var N=arguments[L]!=null?arguments[L]:{};L%2?s(Object(N),!0).forEach(function(S){h(v,S,N[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(N)):s(Object(N)).forEach(function(S){Object.defineProperty(v,S,Object.getOwnPropertyDescriptor(N,S))})}return v}function h(v,L,N){return L=a(L),L in v?Object.defineProperty(v,L,{value:N,enumerable:!0,configurable:!0,writable:!0}):v[L]=N,v}function d(v,L){if(!(v instanceof L))throw new TypeError("Cannot call a class as a function")}function y(v,L){for(var N=0;N<L.length;N++){var S=L[N];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,a(S.key),S)}}function i(v,L,N){return L&&y(v.prototype,L),Object.defineProperty(v,"prototype",{writable:!1}),v}function a(v){var L=u(v,"string");return typeof L=="symbol"?L:String(L)}function u(v,L){if(typeof v!="object"||v===null)return v;var N=v[Symbol.toPrimitive];if(N!==void 0){var S=N.call(v,L);if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(v)}var p=Ce(),b=p.Buffer,c=Pi(),T=c.inspect,R=T&&T.custom||"inspect";function x(v,L,N){b.prototype.copy.call(v,L,N)}return Ur=(function(){function v(){d(this,v),this.head=null,this.tail=null,this.length=0}return i(v,[{key:"push",value:function(N){var S={data:N,next:null};this.length>0?this.tail.next=S:this.head=S,this.tail=S,++this.length}},{key:"unshift",value:function(N){var S={data:N,next:this.head};this.length===0&&(this.tail=S),this.head=S,++this.length}},{key:"shift",value:function(){if(this.length!==0){var N=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,N}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(N){if(this.length===0)return"";for(var S=this.head,O=""+S.data;S=S.next;)O+=N+S.data;return O}},{key:"concat",value:function(N){if(this.length===0)return b.alloc(0);for(var S=b.allocUnsafe(N>>>0),O=this.head,F=0;O;)x(O.data,S,F),F+=O.data.length,O=O.next;return S}},{key:"consume",value:function(N,S){var O;return N<this.head.data.length?(O=this.head.data.slice(0,N),this.head.data=this.head.data.slice(N)):N===this.head.data.length?O=this.shift():O=S?this._getString(N):this._getBuffer(N),O}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(N){var S=this.head,O=1,F=S.data;for(N-=F.length;S=S.next;){var I=S.data,m=N>I.length?I.length:N;if(m===I.length?F+=I:F+=I.slice(0,N),N-=m,N===0){m===I.length?(++O,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=I.slice(m));break}++O}return this.length-=O,F}},{key:"_getBuffer",value:function(N){var S=b.allocUnsafe(N),O=this.head,F=1;for(O.data.copy(S),N-=O.data.length;O=O.next;){var I=O.data,m=N>I.length?I.length:N;if(I.copy(S,S.length-N,0,m),N-=m,N===0){m===I.length?(++F,O.next?this.head=O.next:this.head=this.tail=null):(this.head=O,O.data=I.slice(m));break}++F}return this.length-=F,S}},{key:R,value:function(N,S){return T(this,o(o({},S),{},{depth:0,customInspect:!1}))}}]),v})(),Ur}var Nr,Ci;function ki(){if(Ci)return Nr;Ci=1;function s(a,u){var p=this,b=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return b||c?(u?u(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ye.nextTick(y,this,a)):ye.nextTick(y,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(T){!u&&T?p._writableState?p._writableState.errorEmitted?ye.nextTick(h,p):(p._writableState.errorEmitted=!0,ye.nextTick(o,p,T)):ye.nextTick(o,p,T):u?(ye.nextTick(h,p),u(T)):ye.nextTick(h,p)}),this)}function o(a,u){y(a,u),h(a)}function h(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.emit("close")}function d(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function y(a,u){a.emit("error",u)}function i(a,u){var p=a._readableState,b=a._writableState;p&&p.autoDestroy||b&&b.autoDestroy?a.destroy(u):a.emit("error",u)}return Nr={destroy:s,undestroy:d,errorOrDestroy:i},Nr}var Mr={},Di;function tt(){if(Di)return Mr;Di=1;function s(u,p){u.prototype=Object.create(p.prototype),u.prototype.constructor=u,u.__proto__=p}var o={};function h(u,p,b){b||(b=Error);function c(R,x,v){return typeof p=="string"?p:p(R,x,v)}var T=(function(R){s(x,R);function x(v,L,N){return R.call(this,c(v,L,N))||this}return x})(b);T.prototype.name=b.name,T.prototype.code=u,o[u]=T}function d(u,p){if(Array.isArray(u)){var b=u.length;return u=u.map(function(c){return String(c)}),b>2?"one of ".concat(p," ").concat(u.slice(0,b-1).join(", "),", or ")+u[b-1]:b===2?"one of ".concat(p," ").concat(u[0]," or ").concat(u[1]):"of ".concat(p," ").concat(u[0])}else return"of ".concat(p," ").concat(String(u))}function y(u,p,b){return u.substr(0,p.length)===p}function i(u,p,b){return(b===void 0||b>u.length)&&(b=u.length),u.substring(b-p.length,b)===p}function a(u,p,b){return typeof b!="number"&&(b=0),b+p.length>u.length?!1:u.indexOf(p,b)!==-1}return h("ERR_INVALID_OPT_VALUE",function(u,p){return'The value "'+p+'" is invalid for option "'+u+'"'},TypeError),h("ERR_INVALID_ARG_TYPE",function(u,p,b){var c;typeof p=="string"&&y(p,"not ")?(c="must not be",p=p.replace(/^not /,"")):c="must be";var T;if(i(u," argument"))T="The ".concat(u," ").concat(c," ").concat(d(p,"type"));else{var R=a(u,".")?"property":"argument";T='The "'.concat(u,'" ').concat(R," ").concat(c," ").concat(d(p,"type"))}return T+=". Received type ".concat(typeof b),T},TypeError),h("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),h("ERR_METHOD_NOT_IMPLEMENTED",function(u){return"The "+u+" method is not implemented"}),h("ERR_STREAM_PREMATURE_CLOSE","Premature close"),h("ERR_STREAM_DESTROYED",function(u){return"Cannot call "+u+" after a stream was destroyed"}),h("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),h("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),h("ERR_STREAM_WRITE_AFTER_END","write after end"),h("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),h("ERR_UNKNOWN_ENCODING",function(u){return"Unknown encoding: "+u},TypeError),h("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Mr.codes=o,Mr}var Pr,qi;function ji(){if(qi)return Pr;qi=1;var s=tt().codes.ERR_INVALID_OPT_VALUE;function o(d,y,i){return d.highWaterMark!=null?d.highWaterMark:y?d[i]:null}function h(d,y,i,a){var u=o(y,a,i);if(u!=null){if(!(isFinite(u)&&Math.floor(u)===u)||u<0){var p=a?i:"highWaterMark";throw new s(p,u)}return Math.floor(u)}return d.objectMode?16:16*1024}return Pr={getHighWaterMark:h},Pr}var Lr,Gi;function _s(){if(Gi)return Lr;Gi=1,Lr=s;function s(h,d){if(o("noDeprecation"))return h;var y=!1;function i(){if(!y){if(o("throwDeprecation"))throw new Error(d);o("traceDeprecation")?console.trace(d):console.warn(d),y=!0}return h.apply(this,arguments)}return i}function o(h){try{if(!$e.localStorage)return!1}catch{return!1}var d=$e.localStorage[h];return d==null?!1:String(d).toLowerCase()==="true"}return Lr}var Cr,Wi;function Hi(){if(Wi)return Cr;Wi=1,Cr=j;function s(k){var D=this;this.next=null,this.entry=null,this.finish=function(){ae(D,k)}}var o;j.WritableState=M;var h={deprecate:_s()},d=Sn(),y=Ce().Buffer,i=(typeof $e<"u"?$e:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(k){return y.from(k)}function u(k){return y.isBuffer(k)||k instanceof i}var p=ki(),b=ji(),c=b.getHighWaterMark,T=tt().codes,R=T.ERR_INVALID_ARG_TYPE,x=T.ERR_METHOD_NOT_IMPLEMENTED,v=T.ERR_MULTIPLE_CALLBACK,L=T.ERR_STREAM_CANNOT_PIPE,N=T.ERR_STREAM_DESTROYED,S=T.ERR_STREAM_NULL_VALUES,O=T.ERR_STREAM_WRITE_AFTER_END,F=T.ERR_UNKNOWN_ENCODING,I=p.errorOrDestroy;ze()(j,d);function m(){}function M(k,D,V){o=o||rt(),k=k||{},typeof V!="boolean"&&(V=D instanceof o),this.objectMode=!!k.objectMode,V&&(this.objectMode=this.objectMode||!!k.writableObjectMode),this.highWaterMark=c(this,k,"writableHighWaterMark",V),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var te=k.decodeStrings===!1;this.decodeStrings=!te,this.defaultEncoding=k.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(re){oe(D,re)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=k.emitClose!==!1,this.autoDestroy=!!k.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}M.prototype.getBuffer=function(){for(var D=this.bufferedRequest,V=[];D;)V.push(D),D=D.next;return V},(function(){try{Object.defineProperty(M.prototype,"buffer",{get:h.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var B;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(B=Function.prototype[Symbol.hasInstance],Object.defineProperty(j,Symbol.hasInstance,{value:function(D){return B.call(this,D)?!0:this!==j?!1:D&&D._writableState instanceof M}})):B=function(D){return D instanceof this};function j(k){o=o||rt();var D=this instanceof o;if(!D&&!B.call(j,this))return new j(k);this._writableState=new M(k,this,D),this.writable=!0,k&&(typeof k.write=="function"&&(this._write=k.write),typeof k.writev=="function"&&(this._writev=k.writev),typeof k.destroy=="function"&&(this._destroy=k.destroy),typeof k.final=="function"&&(this._final=k.final)),d.call(this)}j.prototype.pipe=function(){I(this,new L)};function H(k,D){var V=new O;I(k,V),ye.nextTick(D,V)}function ee(k,D,V,te){var re;return V===null?re=new S:typeof V!="string"&&!D.objectMode&&(re=new R("chunk",["string","Buffer"],V)),re?(I(k,re),ye.nextTick(te,re),!1):!0}j.prototype.write=function(k,D,V){var te=this._writableState,re=!1,g=!te.objectMode&&u(k);return g&&!y.isBuffer(k)&&(k=a(k)),typeof D=="function"&&(V=D,D=null),g?D="buffer":D||(D=te.defaultEncoding),typeof V!="function"&&(V=m),te.ending?H(this,V):(g||ee(this,te,k,V))&&(te.pendingcb++,re=U(this,te,g,k,D,V)),re},j.prototype.cork=function(){this._writableState.corked++},j.prototype.uncork=function(){var k=this._writableState;k.corked&&(k.corked--,!k.writing&&!k.corked&&!k.bufferProcessing&&k.bufferedRequest&&le(this,k))},j.prototype.setDefaultEncoding=function(D){if(typeof D=="string"&&(D=D.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((D+"").toLowerCase())>-1))throw new F(D);return this._writableState.defaultEncoding=D,this},Object.defineProperty(j.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function K(k,D,V){return!k.objectMode&&k.decodeStrings!==!1&&typeof D=="string"&&(D=y.from(D,V)),D}Object.defineProperty(j.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function U(k,D,V,te,re,g){if(!V){var w=K(D,te,re);te!==w&&(V=!0,re="buffer",te=w)}var J=D.objectMode?1:te.length;D.length+=J;var ie=D.length<D.highWaterMark;if(ie||(D.needDrain=!0),D.writing||D.corked){var pe=D.lastBufferedRequest;D.lastBufferedRequest={chunk:te,encoding:re,isBuf:V,callback:g,next:null},pe?pe.next=D.lastBufferedRequest:D.bufferedRequest=D.lastBufferedRequest,D.bufferedRequestCount+=1}else A(k,D,!1,J,te,re,g);return ie}function A(k,D,V,te,re,g,w){D.writelen=te,D.writecb=w,D.writing=!0,D.sync=!0,D.destroyed?D.onwrite(new N("write")):V?k._writev(re,D.onwrite):k._write(re,g,D.onwrite),D.sync=!1}function q(k,D,V,te,re){--D.pendingcb,V?(ye.nextTick(re,te),ye.nextTick(Y,k,D),k._writableState.errorEmitted=!0,I(k,te)):(re(te),k._writableState.errorEmitted=!0,I(k,te),Y(k,D))}function ne(k){k.writing=!1,k.writecb=null,k.length-=k.writelen,k.writelen=0}function oe(k,D){var V=k._writableState,te=V.sync,re=V.writecb;if(typeof re!="function")throw new v;if(ne(V),D)q(k,V,te,D,re);else{var g=ce(V)||k.destroyed;!g&&!V.corked&&!V.bufferProcessing&&V.bufferedRequest&&le(k,V),te?ye.nextTick(se,k,V,g,re):se(k,V,g,re)}}function se(k,D,V,te){V||fe(k,D),D.pendingcb--,te(),Y(k,D)}function fe(k,D){D.length===0&&D.needDrain&&(D.needDrain=!1,k.emit("drain"))}function le(k,D){D.bufferProcessing=!0;var V=D.bufferedRequest;if(k._writev&&V&&V.next){var te=D.bufferedRequestCount,re=new Array(te),g=D.corkedRequestsFree;g.entry=V;for(var w=0,J=!0;V;)re[w]=V,V.isBuf||(J=!1),V=V.next,w+=1;re.allBuffers=J,A(k,D,!0,D.length,re,"",g.finish),D.pendingcb++,D.lastBufferedRequest=null,g.next?(D.corkedRequestsFree=g.next,g.next=null):D.corkedRequestsFree=new s(D),D.bufferedRequestCount=0}else{for(;V;){var ie=V.chunk,pe=V.encoding,ue=V.callback,he=D.objectMode?1:ie.length;if(A(k,D,!1,he,ie,pe,ue),V=V.next,D.bufferedRequestCount--,D.writing)break}V===null&&(D.lastBufferedRequest=null)}D.bufferedRequest=V,D.bufferProcessing=!1}j.prototype._write=function(k,D,V){V(new x("_write()"))},j.prototype._writev=null,j.prototype.end=function(k,D,V){var te=this._writableState;return typeof k=="function"?(V=k,k=null,D=null):typeof D=="function"&&(V=D,D=null),k!=null&&this.write(k,D),te.corked&&(te.corked=1,this.uncork()),te.ending||z(this,te,V),this},Object.defineProperty(j.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function ce(k){return k.ending&&k.length===0&&k.bufferedRequest===null&&!k.finished&&!k.writing}function we(k,D){k._final(function(V){D.pendingcb--,V&&I(k,V),D.prefinished=!0,k.emit("prefinish"),Y(k,D)})}function G(k,D){!D.prefinished&&!D.finalCalled&&(typeof k._final=="function"&&!D.destroyed?(D.pendingcb++,D.finalCalled=!0,ye.nextTick(we,k,D)):(D.prefinished=!0,k.emit("prefinish")))}function Y(k,D){var V=ce(D);if(V&&(G(k,D),D.pendingcb===0&&(D.finished=!0,k.emit("finish"),D.autoDestroy))){var te=k._readableState;(!te||te.autoDestroy&&te.endEmitted)&&k.destroy()}return V}function z(k,D,V){D.ending=!0,Y(k,D),V&&(D.finished?ye.nextTick(V):k.once("finish",V)),D.ended=!0,k.writable=!1}function ae(k,D,V){var te=k.entry;for(k.entry=null;te;){var re=te.callback;D.pendingcb--,re(V),te=te.next}D.corkedRequestsFree.next=k}return Object.defineProperty(j.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(D){this._writableState&&(this._writableState.destroyed=D)}}),j.prototype.destroy=p.destroy,j.prototype._undestroy=p.undestroy,j.prototype._destroy=function(k,D){D(k)},Cr}var kr,$i;function rt(){if($i)return kr;$i=1;var s=Object.keys||function(b){var c=[];for(var T in b)c.push(T);return c};kr=a;var o=Zi(),h=Hi();ze()(a,o);for(var d=s(h.prototype),y=0;y<d.length;y++){var i=d[y];a.prototype[i]||(a.prototype[i]=h.prototype[i])}function a(b){if(!(this instanceof a))return new a(b);o.call(this,b),h.call(this,b),this.allowHalfOpen=!0,b&&(b.readable===!1&&(this.readable=!1),b.writable===!1&&(this.writable=!1),b.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",u)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function u(){this._writableState.ended||ye.nextTick(p,this)}function p(b){b.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(c){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=c,this._writableState.destroyed=c)}}),kr}var Dr={},gt={exports:{}};var Yi;function vs(){return Yi||(Yi=1,(function(s,o){var h=Ce(),d=h.Buffer;function y(a,u){for(var p in a)u[p]=a[p]}d.from&&d.alloc&&d.allocUnsafe&&d.allocUnsafeSlow?s.exports=h:(y(h,o),o.Buffer=i);function i(a,u,p){return d(a,u,p)}i.prototype=Object.create(d.prototype),y(d,i),i.from=function(a,u,p){if(typeof a=="number")throw new TypeError("Argument must not be a number");return d(a,u,p)},i.alloc=function(a,u,p){if(typeof a!="number")throw new TypeError("Argument must be a number");var b=d(a);return u!==void 0?typeof p=="string"?b.fill(u,p):b.fill(u):b.fill(0),b},i.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return d(a)},i.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return h.SlowBuffer(a)}})(gt,gt.exports)),gt.exports}var Vi;function Ki(){if(Vi)return Dr;Vi=1;var s=vs().Buffer,o=s.isEncoding||function(S){switch(S=""+S,S&&S.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 h(S){if(!S)return"utf8";for(var O;;)switch(S){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 S;default:if(O)return;S=(""+S).toLowerCase(),O=!0}}function d(S){var O=h(S);if(typeof O!="string"&&(s.isEncoding===o||!o(S)))throw new Error("Unknown encoding: "+S);return O||S}Dr.StringDecoder=y;function y(S){this.encoding=d(S);var O;switch(this.encoding){case"utf16le":this.text=T,this.end=R,O=4;break;case"utf8":this.fillLast=p,O=4;break;case"base64":this.text=x,this.end=v,O=3;break;default:this.write=L,this.end=N;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=s.allocUnsafe(O)}y.prototype.write=function(S){if(S.length===0)return"";var O,F;if(this.lastNeed){if(O=this.fillLast(S),O===void 0)return"";F=this.lastNeed,this.lastNeed=0}else F=0;return F<S.length?O?O+this.text(S,F):this.text(S,F):O||""},y.prototype.end=c,y.prototype.text=b,y.prototype.fillLast=function(S){if(this.lastNeed<=S.length)return S.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);S.copy(this.lastChar,this.lastTotal-this.lastNeed,0,S.length),this.lastNeed-=S.length};function i(S){return S<=127?0:S>>5===6?2:S>>4===14?3:S>>3===30?4:S>>6===2?-1:-2}function a(S,O,F){var I=O.length-1;if(I<F)return 0;var m=i(O[I]);return m>=0?(m>0&&(S.lastNeed=m-1),m):--I<F||m===-2?0:(m=i(O[I]),m>=0?(m>0&&(S.lastNeed=m-2),m):--I<F||m===-2?0:(m=i(O[I]),m>=0?(m>0&&(m===2?m=0:S.lastNeed=m-3),m):0))}function u(S,O,F){if((O[0]&192)!==128)return S.lastNeed=0,"�";if(S.lastNeed>1&&O.length>1){if((O[1]&192)!==128)return S.lastNeed=1,"�";if(S.lastNeed>2&&O.length>2&&(O[2]&192)!==128)return S.lastNeed=2,"�"}}function p(S){var O=this.lastTotal-this.lastNeed,F=u(this,S);if(F!==void 0)return F;if(this.lastNeed<=S.length)return S.copy(this.lastChar,O,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);S.copy(this.lastChar,O,0,S.length),this.lastNeed-=S.length}function b(S,O){var F=a(this,S,O);if(!this.lastNeed)return S.toString("utf8",O);this.lastTotal=F;var I=S.length-(F-this.lastNeed);return S.copy(this.lastChar,0,I),S.toString("utf8",O,I)}function c(S){var O=S&&S.length?this.write(S):"";return this.lastNeed?O+"�":O}function T(S,O){if((S.length-O)%2===0){var F=S.toString("utf16le",O);if(F){var I=F.charCodeAt(F.length-1);if(I>=55296&&I<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=S[S.length-2],this.lastChar[1]=S[S.length-1],F.slice(0,-1)}return F}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=S[S.length-1],S.toString("utf16le",O,S.length-1)}function R(S){var O=S&&S.length?this.write(S):"";if(this.lastNeed){var F=this.lastTotal-this.lastNeed;return O+this.lastChar.toString("utf16le",0,F)}return O}function x(S,O){var F=(S.length-O)%3;return F===0?S.toString("base64",O):(this.lastNeed=3-F,this.lastTotal=3,F===1?this.lastChar[0]=S[S.length-1]:(this.lastChar[0]=S[S.length-2],this.lastChar[1]=S[S.length-1]),S.toString("base64",O,S.length-F))}function v(S){var O=S&&S.length?this.write(S):"";return this.lastNeed?O+this.lastChar.toString("base64",0,3-this.lastNeed):O}function L(S){return S.toString(this.encoding)}function N(S){return S&&S.length?this.write(S):""}return Dr}var qr,Ji;function jr(){if(Ji)return qr;Ji=1;var s=tt().codes.ERR_STREAM_PREMATURE_CLOSE;function o(i){var a=!1;return function(){if(!a){a=!0;for(var u=arguments.length,p=new Array(u),b=0;b<u;b++)p[b]=arguments[b];i.apply(this,p)}}}function h(){}function d(i){return i.setHeader&&typeof i.abort=="function"}function y(i,a,u){if(typeof a=="function")return y(i,null,a);a||(a={}),u=o(u||h);var p=a.readable||a.readable!==!1&&i.readable,b=a.writable||a.writable!==!1&&i.writable,c=function(){i.writable||R()},T=i._writableState&&i._writableState.finished,R=function(){b=!1,T=!0,p||u.call(i)},x=i._readableState&&i._readableState.endEmitted,v=function(){p=!1,x=!0,b||u.call(i)},L=function(F){u.call(i,F)},N=function(){var F;if(p&&!x)return(!i._readableState||!i._readableState.ended)&&(F=new s),u.call(i,F);if(b&&!T)return(!i._writableState||!i._writableState.ended)&&(F=new s),u.call(i,F)},S=function(){i.req.on("finish",R)};return d(i)?(i.on("complete",R),i.on("abort",N),i.req?S():i.on("request",S)):b&&!i._writableState&&(i.on("end",c),i.on("close",c)),i.on("end",v),i.on("finish",R),a.error!==!1&&i.on("error",L),i.on("close",N),function(){i.removeListener("complete",R),i.removeListener("abort",N),i.removeListener("request",S),i.req&&i.req.removeListener("finish",R),i.removeListener("end",c),i.removeListener("close",c),i.removeListener("finish",R),i.removeListener("end",v),i.removeListener("error",L),i.removeListener("close",N)}}return qr=y,qr}var Gr,zi;function Ss(){if(zi)return Gr;zi=1;var s;function o(F,I,m){return I=h(I),I in F?Object.defineProperty(F,I,{value:m,enumerable:!0,configurable:!0,writable:!0}):F[I]=m,F}function h(F){var I=d(F,"string");return typeof I=="symbol"?I:String(I)}function d(F,I){if(typeof F!="object"||F===null)return F;var m=F[Symbol.toPrimitive];if(m!==void 0){var M=m.call(F,I);if(typeof M!="object")return M;throw new TypeError("@@toPrimitive must return a primitive value.")}return(I==="string"?String:Number)(F)}var y=jr(),i=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),p=Symbol("ended"),b=Symbol("lastPromise"),c=Symbol("handlePromise"),T=Symbol("stream");function R(F,I){return{value:F,done:I}}function x(F){var I=F[i];if(I!==null){var m=F[T].read();m!==null&&(F[b]=null,F[i]=null,F[a]=null,I(R(m,!1)))}}function v(F){ye.nextTick(x,F)}function L(F,I){return function(m,M){F.then(function(){if(I[p]){m(R(void 0,!0));return}I[c](m,M)},M)}}var N=Object.getPrototypeOf(function(){}),S=Object.setPrototypeOf((s={get stream(){return this[T]},next:function(){var I=this,m=this[u];if(m!==null)return Promise.reject(m);if(this[p])return Promise.resolve(R(void 0,!0));if(this[T].destroyed)return new Promise(function(H,ee){ye.nextTick(function(){I[u]?ee(I[u]):H(R(void 0,!0))})});var M=this[b],B;if(M)B=new Promise(L(M,this));else{var j=this[T].read();if(j!==null)return Promise.resolve(R(j,!1));B=new Promise(this[c])}return this[b]=B,B}},o(s,Symbol.asyncIterator,function(){return this}),o(s,"return",function(){var I=this;return new Promise(function(m,M){I[T].destroy(null,function(B){if(B){M(B);return}m(R(void 0,!0))})})}),s),N),O=function(I){var m,M=Object.create(S,(m={},o(m,T,{value:I,writable:!0}),o(m,i,{value:null,writable:!0}),o(m,a,{value:null,writable:!0}),o(m,u,{value:null,writable:!0}),o(m,p,{value:I._readableState.endEmitted,writable:!0}),o(m,c,{value:function(j,H){var ee=M[T].read();ee?(M[b]=null,M[i]=null,M[a]=null,j(R(ee,!1))):(M[i]=j,M[a]=H)},writable:!0}),m));return M[b]=null,y(I,function(B){if(B&&B.code!=="ERR_STREAM_PREMATURE_CLOSE"){var j=M[a];j!==null&&(M[b]=null,M[i]=null,M[a]=null,j(B)),M[u]=B;return}var H=M[i];H!==null&&(M[b]=null,M[i]=null,M[a]=null,H(R(void 0,!0))),M[p]=!0}),I.on("readable",v.bind(null,M)),M};return Gr=O,Gr}var Wr,Xi;function As(){return Xi||(Xi=1,Wr=function(){throw new Error("Readable.from is not available in the browser")}),Wr}var Hr,Qi;function Zi(){if(Qi)return Hr;Qi=1,Hr=H;var s;H.ReadableState=j,vt().EventEmitter;var o=function(w,J){return w.listeners(J).length},h=Sn(),d=Ce().Buffer,y=(typeof $e<"u"?$e:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(g){return d.from(g)}function a(g){return d.isBuffer(g)||g instanceof y}var u=Pi(),p;u&&u.debuglog?p=u.debuglog("stream"):p=function(){};var b=bs(),c=ki(),T=ji(),R=T.getHighWaterMark,x=tt().codes,v=x.ERR_INVALID_ARG_TYPE,L=x.ERR_STREAM_PUSH_AFTER_EOF,N=x.ERR_METHOD_NOT_IMPLEMENTED,S=x.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,O,F,I;ze()(H,h);var m=c.errorOrDestroy,M=["error","close","destroy","pause","resume"];function B(g,w,J){if(typeof g.prependListener=="function")return g.prependListener(w,J);!g._events||!g._events[w]?g.on(w,J):Array.isArray(g._events[w])?g._events[w].unshift(J):g._events[w]=[J,g._events[w]]}function j(g,w,J){s=s||rt(),g=g||{},typeof J!="boolean"&&(J=w instanceof s),this.objectMode=!!g.objectMode,J&&(this.objectMode=this.objectMode||!!g.readableObjectMode),this.highWaterMark=R(this,g,"readableHighWaterMark",J),this.buffer=new b,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=g.emitClose!==!1,this.autoDestroy=!!g.autoDestroy,this.destroyed=!1,this.defaultEncoding=g.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,g.encoding&&(O||(O=Ki().StringDecoder),this.decoder=new O(g.encoding),this.encoding=g.encoding)}function H(g){if(s=s||rt(),!(this instanceof H))return new H(g);var w=this instanceof s;this._readableState=new j(g,this,w),this.readable=!0,g&&(typeof g.read=="function"&&(this._read=g.read),typeof g.destroy=="function"&&(this._destroy=g.destroy)),h.call(this)}Object.defineProperty(H.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(w){this._readableState&&(this._readableState.destroyed=w)}}),H.prototype.destroy=c.destroy,H.prototype._undestroy=c.undestroy,H.prototype._destroy=function(g,w){w(g)},H.prototype.push=function(g,w){var J=this._readableState,ie;return J.objectMode?ie=!0:typeof g=="string"&&(w=w||J.defaultEncoding,w!==J.encoding&&(g=d.from(g,w),w=""),ie=!0),ee(this,g,w,!1,ie)},H.prototype.unshift=function(g){return ee(this,g,null,!0,!1)};function ee(g,w,J,ie,pe){p("readableAddChunk",w);var ue=g._readableState;if(w===null)ue.reading=!1,oe(g,ue);else{var he;if(pe||(he=U(ue,w)),he)m(g,he);else if(ue.objectMode||w&&w.length>0)if(typeof w!="string"&&!ue.objectMode&&Object.getPrototypeOf(w)!==d.prototype&&(w=i(w)),ie)ue.endEmitted?m(g,new S):K(g,ue,w,!0);else if(ue.ended)m(g,new L);else{if(ue.destroyed)return!1;ue.reading=!1,ue.decoder&&!J?(w=ue.decoder.write(w),ue.objectMode||w.length!==0?K(g,ue,w,!1):le(g,ue)):K(g,ue,w,!1)}else ie||(ue.reading=!1,le(g,ue))}return!ue.ended&&(ue.length<ue.highWaterMark||ue.length===0)}function K(g,w,J,ie){w.flowing&&w.length===0&&!w.sync?(w.awaitDrain=0,g.emit("data",J)):(w.length+=w.objectMode?1:J.length,ie?w.buffer.unshift(J):w.buffer.push(J),w.needReadable&&se(g)),le(g,w)}function U(g,w){var J;return!a(w)&&typeof w!="string"&&w!==void 0&&!g.objectMode&&(J=new v("chunk",["string","Buffer","Uint8Array"],w)),J}H.prototype.isPaused=function(){return this._readableState.flowing===!1},H.prototype.setEncoding=function(g){O||(O=Ki().StringDecoder);var w=new O(g);this._readableState.decoder=w,this._readableState.encoding=this._readableState.decoder.encoding;for(var J=this._readableState.buffer.head,ie="";J!==null;)ie+=w.write(J.data),J=J.next;return this._readableState.buffer.clear(),ie!==""&&this._readableState.buffer.push(ie),this._readableState.length=ie.length,this};var A=1073741824;function q(g){return g>=A?g=A:(g--,g|=g>>>1,g|=g>>>2,g|=g>>>4,g|=g>>>8,g|=g>>>16,g++),g}function ne(g,w){return g<=0||w.length===0&&w.ended?0:w.objectMode?1:g!==g?w.flowing&&w.length?w.buffer.head.data.length:w.length:(g>w.highWaterMark&&(w.highWaterMark=q(g)),g<=w.length?g:w.ended?w.length:(w.needReadable=!0,0))}H.prototype.read=function(g){p("read",g),g=parseInt(g,10);var w=this._readableState,J=g;if(g!==0&&(w.emittedReadable=!1),g===0&&w.needReadable&&((w.highWaterMark!==0?w.length>=w.highWaterMark:w.length>0)||w.ended))return p("read: emitReadable",w.length,w.ended),w.length===0&&w.ended?V(this):se(this),null;if(g=ne(g,w),g===0&&w.ended)return w.length===0&&V(this),null;var ie=w.needReadable;p("need readable",ie),(w.length===0||w.length-g<w.highWaterMark)&&(ie=!0,p("length less than watermark",ie)),w.ended||w.reading?(ie=!1,p("reading or ended",ie)):ie&&(p("do read"),w.reading=!0,w.sync=!0,w.length===0&&(w.needReadable=!0),this._read(w.highWaterMark),w.sync=!1,w.reading||(g=ne(J,w)));var pe;return g>0?pe=D(g,w):pe=null,pe===null?(w.needReadable=w.length<=w.highWaterMark,g=0):(w.length-=g,w.awaitDrain=0),w.length===0&&(w.ended||(w.needReadable=!0),J!==g&&w.ended&&V(this)),pe!==null&&this.emit("data",pe),pe};function oe(g,w){if(p("onEofChunk"),!w.ended){if(w.decoder){var J=w.decoder.end();J&&J.length&&(w.buffer.push(J),w.length+=w.objectMode?1:J.length)}w.ended=!0,w.sync?se(g):(w.needReadable=!1,w.emittedReadable||(w.emittedReadable=!0,fe(g)))}}function se(g){var w=g._readableState;p("emitReadable",w.needReadable,w.emittedReadable),w.needReadable=!1,w.emittedReadable||(p("emitReadable",w.flowing),w.emittedReadable=!0,ye.nextTick(fe,g))}function fe(g){var w=g._readableState;p("emitReadable_",w.destroyed,w.length,w.ended),!w.destroyed&&(w.length||w.ended)&&(g.emit("readable"),w.emittedReadable=!1),w.needReadable=!w.flowing&&!w.ended&&w.length<=w.highWaterMark,k(g)}function le(g,w){w.readingMore||(w.readingMore=!0,ye.nextTick(ce,g,w))}function ce(g,w){for(;!w.reading&&!w.ended&&(w.length<w.highWaterMark||w.flowing&&w.length===0);){var J=w.length;if(p("maybeReadMore read 0"),g.read(0),J===w.length)break}w.readingMore=!1}H.prototype._read=function(g){m(this,new N("_read()"))},H.prototype.pipe=function(g,w){var J=this,ie=this._readableState;switch(ie.pipesCount){case 0:ie.pipes=g;break;case 1:ie.pipes=[ie.pipes,g];break;default:ie.pipes.push(g);break}ie.pipesCount+=1,p("pipe count=%d opts=%j",ie.pipesCount,w);var pe=(!w||w.end!==!1)&&g!==ye.stdout&&g!==ye.stderr,ue=pe?Oe:Le;ie.endEmitted?ye.nextTick(ue):J.once("end",ue),g.on("unpipe",he);function he(ke,xe){p("onunpipe"),ke===J&&xe&&xe.hasUnpiped===!1&&(xe.hasUnpiped=!0,Ne())}function Oe(){p("onend"),g.end()}var X=we(J);g.on("drain",X);var Ue=!1;function Ne(){p("cleanup"),g.removeListener("close",Me),g.removeListener("finish",Fe),g.removeListener("drain",X),g.removeListener("error",_e),g.removeListener("unpipe",he),J.removeListener("end",Oe),J.removeListener("end",Le),J.removeListener("data",Ee),Ue=!0,ie.awaitDrain&&(!g._writableState||g._writableState.needDrain)&&X()}J.on("data",Ee);function Ee(ke){p("ondata");var xe=g.write(ke);p("dest.write",xe),xe===!1&&((ie.pipesCount===1&&ie.pipes===g||ie.pipesCount>1&&re(ie.pipes,g)!==-1)&&!Ue&&(p("false write response, pause",ie.awaitDrain),ie.awaitDrain++),J.pause())}function _e(ke){p("onerror",ke),Le(),g.removeListener("error",_e),o(g,"error")===0&&m(g,ke)}B(g,"error",_e);function Me(){g.removeListener("finish",Fe),Le()}g.once("close",Me);function Fe(){p("onfinish"),g.removeListener("close",Me),Le()}g.once("finish",Fe);function Le(){p("unpipe"),J.unpipe(g)}return g.emit("pipe",J),ie.flowing||(p("pipe resume"),J.resume()),g};function we(g){return function(){var J=g._readableState;p("pipeOnDrain",J.awaitDrain),J.awaitDrain&&J.awaitDrain--,J.awaitDrain===0&&o(g,"data")&&(J.flowing=!0,k(g))}}H.prototype.unpipe=function(g){var w=this._readableState,J={hasUnpiped:!1};if(w.pipesCount===0)return this;if(w.pipesCount===1)return g&&g!==w.pipes?this:(g||(g=w.pipes),w.pipes=null,w.pipesCount=0,w.flowing=!1,g&&g.emit("unpipe",this,J),this);if(!g){var ie=w.pipes,pe=w.pipesCount;w.pipes=null,w.pipesCount=0,w.flowing=!1;for(var ue=0;ue<pe;ue++)ie[ue].emit("unpipe",this,{hasUnpiped:!1});return this}var he=re(w.pipes,g);return he===-1?this:(w.pipes.splice(he,1),w.pipesCount-=1,w.pipesCount===1&&(w.pipes=w.pipes[0]),g.emit("unpipe",this,J),this)},H.prototype.on=function(g,w){var J=h.prototype.on.call(this,g,w),ie=this._readableState;return g==="data"?(ie.readableListening=this.listenerCount("readable")>0,ie.flowing!==!1&&this.resume()):g==="readable"&&!ie.endEmitted&&!ie.readableListening&&(ie.readableListening=ie.needReadable=!0,ie.flowing=!1,ie.emittedReadable=!1,p("on readable",ie.length,ie.reading),ie.length?se(this):ie.reading||ye.nextTick(Y,this)),J},H.prototype.addListener=H.prototype.on,H.prototype.removeListener=function(g,w){var J=h.prototype.removeListener.call(this,g,w);return g==="readable"&&ye.nextTick(G,this),J},H.prototype.removeAllListeners=function(g){var w=h.prototype.removeAllListeners.apply(this,arguments);return(g==="readable"||g===void 0)&&ye.nextTick(G,this),w};function G(g){var w=g._readableState;w.readableListening=g.listenerCount("readable")>0,w.resumeScheduled&&!w.paused?w.flowing=!0:g.listenerCount("data")>0&&g.resume()}function Y(g){p("readable nexttick read 0"),g.read(0)}H.prototype.resume=function(){var g=this._readableState;return g.flowing||(p("resume"),g.flowing=!g.readableListening,z(this,g)),g.paused=!1,this};function z(g,w){w.resumeScheduled||(w.resumeScheduled=!0,ye.nextTick(ae,g,w))}function ae(g,w){p("resume",w.reading),w.reading||g.read(0),w.resumeScheduled=!1,g.emit("resume"),k(g),w.flowing&&!w.reading&&g.read(0)}H.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function k(g){var w=g._readableState;for(p("flow",w.flowing);w.flowing&&g.read()!==null;);}H.prototype.wrap=function(g){var w=this,J=this._readableState,ie=!1;g.on("end",function(){if(p("wrapped end"),J.decoder&&!J.ended){var he=J.decoder.end();he&&he.length&&w.push(he)}w.push(null)}),g.on("data",function(he){if(p("wrapped data"),J.decoder&&(he=J.decoder.write(he)),!(J.objectMode&&he==null)&&!(!J.objectMode&&(!he||!he.length))){var Oe=w.push(he);Oe||(ie=!0,g.pause())}});for(var pe in g)this[pe]===void 0&&typeof g[pe]=="function"&&(this[pe]=(function(Oe){return function(){return g[Oe].apply(g,arguments)}})(pe));for(var ue=0;ue<M.length;ue++)g.on(M[ue],this.emit.bind(this,M[ue]));return this._read=function(he){p("wrapped _read",he),ie&&(ie=!1,g.resume())},this},typeof Symbol=="function"&&(H.prototype[Symbol.asyncIterator]=function(){return F===void 0&&(F=Ss()),F(this)}),Object.defineProperty(H.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(H.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(H.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(w){this._readableState&&(this._readableState.flowing=w)}}),H._fromList=D,Object.defineProperty(H.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function D(g,w){if(w.length===0)return null;var J;return w.objectMode?J=w.buffer.shift():!g||g>=w.length?(w.decoder?J=w.buffer.join(""):w.buffer.length===1?J=w.buffer.first():J=w.buffer.concat(w.length),w.buffer.clear()):J=w.buffer.consume(g,w.decoder),J}function V(g){var w=g._readableState;p("endReadable",w.endEmitted),w.endEmitted||(w.ended=!0,ye.nextTick(te,w,g))}function te(g,w){if(p("endReadableNT",g.endEmitted,g.length),!g.endEmitted&&g.length===0&&(g.endEmitted=!0,w.readable=!1,w.emit("end"),g.autoDestroy)){var J=w._writableState;(!J||J.autoDestroy&&J.finished)&&w.destroy()}}typeof Symbol=="function"&&(H.from=function(g,w){return I===void 0&&(I=As()),I(H,g,w)});function re(g,w){for(var J=0,ie=g.length;J<ie;J++)if(g[J]===w)return J;return-1}return Hr}var $r,eo;function to(){if(eo)return $r;eo=1,$r=u;var s=tt().codes,o=s.ERR_METHOD_NOT_IMPLEMENTED,h=s.ERR_MULTIPLE_CALLBACK,d=s.ERR_TRANSFORM_ALREADY_TRANSFORMING,y=s.ERR_TRANSFORM_WITH_LENGTH_0,i=rt();ze()(u,i);function a(c,T){var R=this._transformState;R.transforming=!1;var x=R.writecb;if(x===null)return this.emit("error",new h);R.writechunk=null,R.writecb=null,T!=null&&this.push(T),x(c);var v=this._readableState;v.reading=!1,(v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}function u(c){if(!(this instanceof u))return new u(c);i.call(this,c),this._transformState={afterTransform:a.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,c&&(typeof c.transform=="function"&&(this._transform=c.transform),typeof c.flush=="function"&&(this._flush=c.flush)),this.on("prefinish",p)}function p(){var c=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(T,R){b(c,T,R)}):b(this,null,null)}u.prototype.push=function(c,T){return this._transformState.needTransform=!1,i.prototype.push.call(this,c,T)},u.prototype._transform=function(c,T,R){R(new o("_transform()"))},u.prototype._write=function(c,T,R){var x=this._transformState;if(x.writecb=R,x.writechunk=c,x.writeencoding=T,!x.transforming){var v=this._readableState;(x.needTransform||v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}},u.prototype._read=function(c){var T=this._transformState;T.writechunk!==null&&!T.transforming?(T.transforming=!0,this._transform(T.writechunk,T.writeencoding,T.afterTransform)):T.needTransform=!0},u.prototype._destroy=function(c,T){i.prototype._destroy.call(this,c,function(R){T(R)})};function b(c,T,R){if(T)return c.emit("error",T);if(R!=null&&c.push(R),c._writableState.length)throw new y;if(c._transformState.transforming)throw new d;return c.push(null)}return $r}var Yr,ro;function Bs(){if(ro)return Yr;ro=1,Yr=o;var s=to();ze()(o,s);function o(h){if(!(this instanceof o))return new o(h);s.call(this,h)}return o.prototype._transform=function(h,d,y){y(null,h)},Yr}var Vr,no;function Is(){if(no)return Vr;no=1;var s;function o(R){var x=!1;return function(){x||(x=!0,R.apply(void 0,arguments))}}var h=tt().codes,d=h.ERR_MISSING_ARGS,y=h.ERR_STREAM_DESTROYED;function i(R){if(R)throw R}function a(R){return R.setHeader&&typeof R.abort=="function"}function u(R,x,v,L){L=o(L);var N=!1;R.on("close",function(){N=!0}),s===void 0&&(s=jr()),s(R,{readable:x,writable:v},function(O){if(O)return L(O);N=!0,L()});var S=!1;return function(O){if(!N&&!S){if(S=!0,a(R))return R.abort();if(typeof R.destroy=="function")return R.destroy();L(O||new y("pipe"))}}}function p(R){R()}function b(R,x){return R.pipe(x)}function c(R){return!R.length||typeof R[R.length-1]!="function"?i:R.pop()}function T(){for(var R=arguments.length,x=new Array(R),v=0;v<R;v++)x[v]=arguments[v];var L=c(x);if(Array.isArray(x[0])&&(x=x[0]),x.length<2)throw new d("streams");var N,S=x.map(function(O,F){var I=F<x.length-1,m=F>0;return u(O,I,m,function(M){N||(N=M),M&&S.forEach(p),!I&&(S.forEach(p),L(N))})});return x.reduce(b)}return Vr=T,Vr}var Kr,io;function nt(){if(io)return Kr;io=1,Kr=h;var s=vt().EventEmitter,o=ze();o(h,s),h.Readable=Zi(),h.Writable=Hi(),h.Duplex=rt(),h.Transform=to(),h.PassThrough=Bs(),h.finished=jr(),h.pipeline=Is(),h.Stream=h;function h(){s.call(this)}return h.prototype.pipe=function(d,y){var i=this;function a(x){d.writable&&d.write(x)===!1&&i.pause&&i.pause()}i.on("data",a);function u(){i.readable&&i.resume&&i.resume()}d.on("drain",u),!d._isStdio&&(!y||y.end!==!1)&&(i.on("end",b),i.on("close",c));var p=!1;function b(){p||(p=!0,d.end())}function c(){p||(p=!0,typeof d.destroy=="function"&&d.destroy())}function T(x){if(R(),s.listenerCount(this,"error")===0)throw x}i.on("error",T),d.on("error",T);function R(){i.removeListener("data",a),d.removeListener("drain",u),i.removeListener("end",b),i.removeListener("close",c),i.removeListener("error",T),d.removeListener("error",T),i.removeListener("end",R),i.removeListener("close",R),d.removeListener("close",R)}return i.on("end",R),i.on("close",R),d.on("close",R),d.emit("pipe",i),d},Kr}var Jr={},zr,oo;function it(){if(oo)return zr;oo=1;const s=nt(),{Buffer:o}=Ce(),h=new TextDecoder("utf8",{fatal:!0,ignoreBOM:!0});class d extends s.Transform{constructor(i,a,u={}){let p=null,b=null;switch(typeof i){case"object":o.isBuffer(i)?p=i:i&&(u=i);break;case"string":p=i;break;case"undefined":break;default:throw new TypeError("Invalid input")}switch(typeof a){case"object":a&&(u=a);break;case"string":b=a;break;case"undefined":break;default:throw new TypeError("Invalid inputEncoding")}if(!u||typeof u!="object")throw new TypeError("Invalid options");p==null&&(p=u.input),b==null&&(b=u.inputEncoding),delete u.input,delete u.inputEncoding;const c=u.watchPipe==null?!0:u.watchPipe;delete u.watchPipe;const T=!!u.readError;delete u.readError,super(u),this.readError=T,c&&this.on("pipe",R=>{const x=R._readableState.objectMode;if(this.length>0&&x!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");this._readableState.objectMode=x,this._writableState.objectMode=x}),p!=null&&this.end(p,b)}static isNoFilter(i){return i instanceof this}static compare(i,a){if(!(i instanceof this))throw new TypeError("Arguments must be NoFilters");return i===a?0:i.compare(a)}static concat(i,a){if(!Array.isArray(i))throw new TypeError("list argument must be an Array of NoFilters");if(i.length===0||a===0)return o.alloc(0);a==null&&(a=i.reduce((c,T)=>{if(!(T instanceof d))throw new TypeError("list argument must be an Array of NoFilters");return c+T.length},0));let u=!0,p=!0;const b=i.map(c=>{if(!(c instanceof d))throw new TypeError("list argument must be an Array of NoFilters");const T=c.slice();return o.isBuffer(T)?p=!1:u=!1,T});if(u)return o.concat(b,a);if(p)return[].concat(...b).slice(0,a);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(i,a,u){!this._readableState.objectMode&&!o.isBuffer(i)&&(i=o.from(i,a)),this.push(i),u()}_bufArray(){let i=this._readableState.buffer;if(!Array.isArray(i)){let a=i.head;for(i=[];a!=null;)i.push(a.data),a=a.next}return i}read(i){const a=super.read(i);if(a!=null){if(this.emit("read",a),this.readError&&a.length<i)throw new Error(`Read ${a.length}, wanted ${i}`)}else if(this.readError)throw new Error(`No data available, wanted ${i}`);return a}readFull(i){let a=null,u=null,p=null;return new Promise((b,c)=>{if(this.length>=i){b(this.read(i));return}if(this.writableFinished){c(new Error(`Stream finished before ${i} bytes were available`));return}a=T=>{this.length>=i&&b(this.read(i))},u=()=>{c(new Error(`Stream finished before ${i} bytes were available`))},p=c,this.on("readable",a),this.on("error",p),this.on("finish",u)}).finally(()=>{a&&(this.removeListener("readable",a),this.removeListener("error",p),this.removeListener("finish",u))})}promise(i){let a=!1;return new Promise((u,p)=>{this.on("finish",()=>{const b=this.read();i!=null&&!a&&(a=!0,i(null,b)),u(b)}),this.on("error",b=>{i!=null&&!a&&(a=!0,i(b)),p(b)})})}compare(i){if(!(i instanceof d))throw new TypeError("Arguments must be NoFilters");if(this===i)return 0;const a=this.slice(),u=i.slice();if(o.isBuffer(a)&&o.isBuffer(u))return a.compare(u);throw new Error("Cannot compare streams in object mode")}equals(i){return this.compare(i)===0}slice(i,a){if(this._readableState.objectMode)return this._bufArray().slice(i,a);const u=this._bufArray();switch(u.length){case 0:return o.alloc(0);case 1:return u[0].slice(i,a);default:return o.concat(u).slice(i,a)}}get(i){return this.slice()[i]}toJSON(){const i=this.slice();return o.isBuffer(i)?i.toJSON():i}toString(i,a,u){const p=this.slice(a,u);return o.isBuffer(p)?!i||i==="utf8"?h.decode(p):p.toString(i):JSON.stringify(p)}[Symbol.for("nodejs.util.inspect.custom")](i,a){const p=this._bufArray().map(b=>o.isBuffer(b)?a.stylize(b.toString("hex"),"string"):JSON.stringify(b)).join(", ");return`${this.constructor.name} [${p}]`}get length(){return this._readableState.length}writeBigInt(i){let a=i.toString(16);if(i<0){const u=BigInt(Math.floor(a.length/2));i=(BigInt(1)<<u*BigInt(8))+i,a=i.toString(16)}return a.length%2&&(a=`0${a}`),this.push(o.from(a,"hex"))}readUBigInt(i){const a=this.read(i);return o.isBuffer(a)?BigInt(`0x${a.toString("hex")}`):null}readBigInt(i){const a=this.read(i);if(!o.isBuffer(a))return null;let u=BigInt(`0x${a.toString("hex")}`);if(a[0]&128){const p=BigInt(1)<<BigInt(a.length)*BigInt(8);u-=p}return u}writeUInt8(i){const a=o.from([i]);return this.push(a)}writeUInt16LE(i){const a=o.alloc(2);return a.writeUInt16LE(i),this.push(a)}writeUInt16BE(i){const a=o.alloc(2);return a.writeUInt16BE(i),this.push(a)}writeUInt32LE(i){const a=o.alloc(4);return a.writeUInt32LE(i),this.push(a)}writeUInt32BE(i){const a=o.alloc(4);return a.writeUInt32BE(i),this.push(a)}writeInt8(i){const a=o.from([i]);return this.push(a)}writeInt16LE(i){const a=o.alloc(2);return a.writeUInt16LE(i),this.push(a)}writeInt16BE(i){const a=o.alloc(2);return a.writeUInt16BE(i),this.push(a)}writeInt32LE(i){const a=o.alloc(4);return a.writeUInt32LE(i),this.push(a)}writeInt32BE(i){const a=o.alloc(4);return a.writeUInt32BE(i),this.push(a)}writeFloatLE(i){const a=o.alloc(4);return a.writeFloatLE(i),this.push(a)}writeFloatBE(i){const a=o.alloc(4);return a.writeFloatBE(i),this.push(a)}writeDoubleLE(i){const a=o.alloc(8);return a.writeDoubleLE(i),this.push(a)}writeDoubleBE(i){const a=o.alloc(8);return a.writeDoubleBE(i),this.push(a)}writeBigInt64LE(i){const a=o.alloc(8);return a.writeBigInt64LE(i),this.push(a)}writeBigInt64BE(i){const a=o.alloc(8);return a.writeBigInt64BE(i),this.push(a)}writeBigUInt64LE(i){const a=o.alloc(8);return a.writeBigUInt64LE(i),this.push(a)}writeBigUInt64BE(i){const a=o.alloc(8);return a.writeBigUInt64BE(i),this.push(a)}readUInt8(){const i=this.read(1);return o.isBuffer(i)?i.readUInt8():null}readUInt16LE(){const i=this.read(2);return o.isBuffer(i)?i.readUInt16LE():null}readUInt16BE(){const i=this.read(2);return o.isBuffer(i)?i.readUInt16BE():null}readUInt32LE(){const i=this.read(4);return o.isBuffer(i)?i.readUInt32LE():null}readUInt32BE(){const i=this.read(4);return o.isBuffer(i)?i.readUInt32BE():null}readInt8(){const i=this.read(1);return o.isBuffer(i)?i.readInt8():null}readInt16LE(){const i=this.read(2);return o.isBuffer(i)?i.readInt16LE():null}readInt16BE(){const i=this.read(2);return o.isBuffer(i)?i.readInt16BE():null}readInt32LE(){const i=this.read(4);return o.isBuffer(i)?i.readInt32LE():null}readInt32BE(){const i=this.read(4);return o.isBuffer(i)?i.readInt32BE():null}readFloatLE(){const i=this.read(4);return o.isBuffer(i)?i.readFloatLE():null}readFloatBE(){const i=this.read(4);return o.isBuffer(i)?i.readFloatBE():null}readDoubleLE(){const i=this.read(8);return o.isBuffer(i)?i.readDoubleLE():null}readDoubleBE(){const i=this.read(8);return o.isBuffer(i)?i.readDoubleBE():null}readBigInt64LE(){const i=this.read(8);return o.isBuffer(i)?i.readBigInt64LE():null}readBigInt64BE(){const i=this.read(8);return o.isBuffer(i)?i.readBigInt64BE():null}readBigUInt64LE(){const i=this.read(8);return o.isBuffer(i)?i.readBigUInt64LE():null}readBigUInt64BE(){const i=this.read(8);return o.isBuffer(i)?i.readBigUInt64BE():null}}return zr=d,zr}var Xr={},so;function Ye(){return so||(so=1,(function(s){s.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},s.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36,SET:258},s.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},s.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},s.SYMS={NULL:Symbol.for("github.com/hildjj/node-cbor/null"),UNDEFINED:Symbol.for("github.com/hildjj/node-cbor/undef"),PARENT:Symbol.for("github.com/hildjj/node-cbor/parent"),BREAK:Symbol.for("github.com/hildjj/node-cbor/break"),STREAM:Symbol.for("github.com/hildjj/node-cbor/stream")},s.SHIFT32=4294967296,s.BI={MINUS_ONE:BigInt(-1),NEG_MAX:BigInt(-1)-BigInt(Number.MAX_SAFE_INTEGER),MAXINT32:BigInt("0xffffffff"),MAXINT64:BigInt("0xffffffffffffffff"),SHIFT32:BigInt(s.SHIFT32)}})(Xr)),Xr}var ao;function ft(){return ao||(ao=1,(function(s){const{Buffer:o}=Ce(),h=it(),d=nt(),y=Ye(),{NUMBYTES:i,SHIFT32:a,BI:u,SYMS:p}=y,b=2097151,c=new TextDecoder("utf8",{fatal:!0,ignoreBOM:!0});s.utf8=x=>c.decode(x),s.utf8.checksUTF8=!0;function T(x){return x instanceof d.Readable?!0:["read","on","pipe"].every(v=>typeof x[v]=="function")}s.isBufferish=function(v){return v&&typeof v=="object"&&(o.isBuffer(v)||v instanceof Uint8Array||v instanceof Uint8ClampedArray||v instanceof ArrayBuffer||v instanceof DataView)},s.bufferishToBuffer=function(v){return o.isBuffer(v)?v:ArrayBuffer.isView(v)?o.from(v.buffer,v.byteOffset,v.byteLength):v instanceof ArrayBuffer?o.from(v):null},s.parseCBORint=function(v,L){switch(v){case i.ONE:return L.readUInt8(0);case i.TWO:return L.readUInt16BE(0);case i.FOUR:return L.readUInt32BE(0);case i.EIGHT:{const N=L.readUInt32BE(0),S=L.readUInt32BE(4);return N>b?BigInt(N)*u.SHIFT32+BigInt(S):N*a+S}default:throw new Error(`Invalid additional info for int: ${v}`)}},s.writeHalf=function(v,L){const N=o.allocUnsafe(4);N.writeFloatBE(L,0);const S=N.readUInt32BE(0);if((S&8191)!==0)return!1;let O=S>>16&32768;const F=S>>23&255,I=S&8388607;if(F>=113&&F<=142)O+=(F-112<<10)+(I>>13);else if(F>=103&&F<113){if(I&(1<<126-F)-1)return!1;O+=I+8388608>>126-F}else return!1;return v.writeUInt16BE(O),!0},s.parseHalf=function(v){const L=v[0]&128?-1:1,N=(v[0]&124)>>2,S=(v[0]&3)<<8|v[1];if(N){if(N===31)return L*(S?NaN:1/0)}else return L*5960464477539063e-23*S;return L*2**(N-25)*(1024+S)},s.parseCBORfloat=function(v){switch(v.length){case 2:return s.parseHalf(v);case 4:return v.readFloatBE(0);case 8:return v.readDoubleBE(0);default:throw new Error(`Invalid float size: ${v.length}`)}},s.hex=function(v){return o.from(v.replace(/^0x/,""),"hex")},s.bin=function(v){v=v.replace(/\s/g,"");let L=0,N=v.length%8||8;const S=[];for(;N<=v.length;)S.push(parseInt(v.slice(L,N),2)),L=N,N+=8;return o.from(S)},s.arrayEqual=function(v,L){return v==null&&L==null?!0:v==null||L==null?!1:v.length===L.length&&v.every((N,S)=>N===L[S])},s.bufferToBigInt=function(v){return BigInt(`0x${v.toString("hex")}`)},s.cborValueToString=function(v,L=-1){switch(typeof v){case"symbol":{switch(v){case p.NULL:return"null";case p.UNDEFINED:return"undefined";case p.BREAK:return"BREAK"}if(v.description)return v.description;const S=v.toString().match(/^Symbol\((?<name>.*)\)/);return S&&S.groups.name?S.groups.name:"Symbol"}case"string":return JSON.stringify(v);case"bigint":return v.toString();case"number":{const N=Object.is(v,-0)?"-0":String(v);return L>0?`${N}_${L}`:N}case"object":{if(!v)return"null";const N=s.bufferishToBuffer(v);if(N){const S=N.toString("hex");return L===-1/0?S:`h'${S}'`}return v&&typeof v[Symbol.for("nodejs.util.inspect.custom")]=="function"?v[Symbol.for("nodejs.util.inspect.custom")]():Array.isArray(v)?"[]":"{}"}}return String(v)},s.guessEncoding=function(v,L){if(typeof v=="string")return new h(v,L??"hex");const N=s.bufferishToBuffer(v);if(N)return new h(N);if(T(v))return v;throw new Error("Unknown input type")};const R={"=":"","+":"-","/":"_"};s.base64url=function(v){return s.bufferishToBuffer(v).toString("base64").replace(/[=+/]/g,L=>R[L])},s.base64=function(v){return s.bufferishToBuffer(v).toString("base64")},s.isBigEndian=function(){const v=new Uint8Array(4),L=new Uint32Array(v.buffer);return!((L[0]=1)&v[0])}})(Jr)),Jr}var Qr,uo;function Rs(){if(uo)return Qr;uo=1;const s=nt(),o=it();class h extends s.Transform{constructor(y){super(y),this._writableState.objectMode=!1,this._readableState.objectMode=!0,this.bs=new o,this.__restart()}_transform(y,i,a){for(this.bs.write(y);this.bs.length>=this.__needed;){let u=null;const p=this.__needed===null?void 0:this.bs.read(this.__needed);try{u=this.__parser.next(p)}catch(b){return a(b)}this.__needed&&(this.__fresh=!1),u.done?(this.push(u.value),this.__restart()):this.__needed=u.value||1/0}return a()}*_parse(){throw new Error("Must be implemented in subclass")}__restart(){this.__needed=null,this.__parser=this._parse(),this.__fresh=!0}_flush(y){y(this.__fresh?null:new Error("unexpected end of input"))}}return Qr=h,Qr}var Zr,fo;function lo(){if(fo)return Zr;fo=1;const s=Ye(),o=ft(),h=Symbol("INTERNAL_JSON");function d(x,v){if(o.isBufferish(x))x.toJSON=v;else if(Array.isArray(x))for(const L of x)d(L,v);else if(x&&typeof x=="object"&&(!(x instanceof R)||x.tag<21||x.tag>23))for(const L of Object.values(x))d(L,v)}function y(){return o.base64(this)}function i(){return o.base64url(this)}function a(){return this.toString("hex")}function u(x,v,L,N){const S=new DataView(x),[O,F]={2:[S.getUint16,S.setUint16],4:[S.getUint32,S.setUint32],8:[S.getBigUint64,S.setBigUint64]}[v],I=L+N;for(let m=L;m<I;m+=v)F.call(S,m,O.call(S,m,!0))}const p={0:x=>new Date(x),1:x=>new Date(x*1e3),2:x=>o.bufferToBigInt(x),3:x=>s.BI.MINUS_ONE-o.bufferToBigInt(x),21:(x,v)=>(o.isBufferish(x)?v[h]=i:d(x,i),v),22:(x,v)=>(o.isBufferish(x)?v[h]=y:d(x,y),v),23:(x,v)=>(o.isBufferish(x)?v[h]=a:d(x,a),v),32:x=>new URL(x),33:(x,v)=>{if(!x.match(/^[a-zA-Z0-9_-]+$/))throw new Error("Invalid base64url characters");const L=x.length%4;if(L===1)throw new Error("Invalid base64url length");if(L===2){if("AQgw".indexOf(x[x.length-1])===-1)throw new Error("Invalid base64 padding")}else if(L===3&&"AEIMQUYcgkosw048".indexOf(x[x.length-1])===-1)throw new Error("Invalid base64 padding");return v},34:(x,v)=>{const L=x.match(/^[a-zA-Z0-9+/]+(?<padding>={0,2})$/);if(!L)throw new Error("Invalid base64 characters");if(x.length%4!==0)throw new Error("Invalid base64 length");if(L.groups.padding==="="){if("AQgw".indexOf(x[x.length-2])===-1)throw new Error("Invalid base64 padding")}else if(L.groups.padding==="=="&&"AEIMQUYcgkosw048".indexOf(x[x.length-3])===-1)throw new Error("Invalid base64 padding");return v},35:x=>new RegExp(x),258:x=>new Set(x)},b={64:Uint8Array,65:Uint16Array,66:Uint32Array,68:Uint8ClampedArray,69:Uint16Array,70:Uint32Array,72:Int8Array,73:Int16Array,74:Int32Array,77:Int16Array,78:Int32Array,81:Float32Array,82:Float64Array,85:Float32Array,86:Float64Array};typeof BigUint64Array<"u"&&(b[67]=BigUint64Array,b[71]=BigUint64Array),typeof BigInt64Array<"u"&&(b[75]=BigInt64Array,b[79]=BigInt64Array);function c(x,v){if(!o.isBufferish(x))throw new TypeError("val not a buffer");const{tag:L}=v,N=b[L];if(!N)throw new Error(`Invalid typed array tag: ${L}`);const S=L&4,F=2**(((L&16)>>4)+(L&3));!S!==o.isBigEndian()&&F>1&&u(x.buffer,F,x.byteOffset,x.byteLength);const I=x.buffer.slice(x.byteOffset,x.byteOffset+x.byteLength);return new N(I)}for(const x of Object.keys(b))p[x]=c;let T={};class R{constructor(v,L,N){if(this.tag=v,this.value=L,this.err=N,typeof this.tag!="number")throw new Error(`Invalid tag type (${typeof this.tag})`);if(this.tag<0||(this.tag|0)!==this.tag)throw new Error(`Tag must be a positive integer: ${this.tag}`)}toJSON(){if(this[h])return this[h].call(this.value);const v={tag:this.tag,value:this.value};return this.err&&(v.err=this.err),v}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(v){return v._pushTag(this.tag),v.pushAny(this.value)}convert(v){let L=v?.[this.tag];if(L===null)return this;if(typeof L!="function"&&(L=R.TAGS[this.tag],typeof L!="function"))return this;try{return L.call(this,this.value,this)}catch(N){return N&&N.message&&N.message.length>0?this.err=N.message:this.err=N,this}}static get TAGS(){return T}static set TAGS(v){T=v}static reset(){R.TAGS={...p}}}return R.INTERNAL_JSON=h,R.reset(),Zr=R,Zr}var en,co;function ho(){if(co)return en;co=1;const{MT:s,SIMPLE:o,SYMS:h}=Ye();class d{constructor(i){if(typeof i!="number")throw new Error(`Invalid Simple type: ${typeof i}`);if(i<0||i>255||(i|0)!==i)throw new Error(`value must be a small positive integer: ${i}`);this.value=i}toString(){return`simple(${this.value})`}[Symbol.for("nodejs.util.inspect.custom")](i,a){return`simple(${this.value})`}encodeCBOR(i){return i._pushInt(this.value,s.SIMPLE_FLOAT)}static isSimple(i){return i instanceof d}static decode(i,a=!0,u=!1){switch(i){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return a?null:h.NULL;case o.UNDEFINED:return a?void 0:h.UNDEFINED;case-1:if(!a||!u)throw new Error("Invalid BREAK");return h.BREAK;default:return new d(i)}}}return en=d,en}var tn,po;function wt(){if(po)return tn;po=1;const s=Rs(),o=lo(),h=ho(),d=ft(),y=it(),i=Ye(),{MT:a,NUMBYTES:u,SYMS:p,BI:b}=i,{Buffer:c}=Ce(),T=Symbol("count"),R=Symbol("major type"),x=Symbol("error"),v=Symbol("not found");function L(I,m,M){const B=[];return B[T]=M,B[p.PARENT]=I,B[R]=m,B}function N(I,m){const M=new y;return M[T]=-1,M[p.PARENT]=I,M[R]=m,M}class S extends Error{constructor(m,M){super(`Unexpected data: 0x${m.toString(16)}`),this.name="UnexpectedDataError",this.byte=m,this.value=M}}function O(I,m){switch(typeof I){case"function":return{options:{},cb:I};case"string":return{options:{encoding:I},cb:m};case"object":return{options:I||{},cb:m};default:throw new TypeError("Unknown option type")}}class F extends s{constructor(m={}){const{tags:M={},max_depth:B=-1,preferMap:j=!1,preferWeb:H=!1,required:ee=!1,encoding:K="hex",extendedResults:U=!1,preventDuplicateKeys:A=!1,...q}=m;super({defaultEncoding:K,...q}),this.running=!0,this.max_depth=B,this.tags=M,this.preferMap=j,this.preferWeb=H,this.extendedResults=U,this.required=ee,this.preventDuplicateKeys=A,U&&(this.bs.on("read",this._onRead.bind(this)),this.valueBytes=new y)}static nullcheck(m){switch(m){case p.NULL:return null;case p.UNDEFINED:return;case v:throw new Error("Value not found");default:return m}}static decodeFirstSync(m,M={}){if(m==null)throw new TypeError("input required");({options:M}=O(M));const{encoding:B="hex",...j}=M,H=new F(j),ee=d.guessEncoding(m,B),K=H._parse();let U=K.next();for(;!U.done;){const q=ee.read(U.value);if(q==null||q.length!==U.value)throw new Error("Insufficient data");H.extendedResults&&H.valueBytes.write(q),U=K.next(q)}let A=null;if(H.extendedResults)A=U.value,A.unused=ee.read();else if(A=F.nullcheck(U.value),ee.length>0){const q=ee.read(1);throw ee.unshift(q),new S(q[0],A)}return A}static decodeAllSync(m,M={}){if(m==null)throw new TypeError("input required");({options:M}=O(M));const{encoding:B="hex",...j}=M,H=new F(j),ee=d.guessEncoding(m,B),K=[];for(;ee.length>0;){const U=H._parse();let A=U.next();for(;!A.done;){const q=ee.read(A.value);if(q==null||q.length!==A.value)throw new Error("Insufficient data");H.extendedResults&&H.valueBytes.write(q),A=U.next(q)}K.push(F.nullcheck(A.value))}return K}static decodeFirst(m,M={},B=null){if(m==null)throw new TypeError("input required");({options:M,cb:B}=O(M,B));const{encoding:j="hex",required:H=!1,...ee}=M,K=new F(ee);let U=v;const A=d.guessEncoding(m,j),q=new Promise((ne,oe)=>{K.on("data",se=>{U=F.nullcheck(se),K.close()}),K.once("error",se=>K.extendedResults&&se instanceof S?(U.unused=K.bs.slice(),ne(U)):(U!==v&&(se.value=U),U=x,K.close(),oe(se))),K.once("end",()=>{switch(U){case v:return H?oe(new Error("No CBOR found")):ne(U);case x:return;default:return ne(U)}})});return typeof B=="function"&&q.then(ne=>B(null,ne),B),A.pipe(K),q}static decodeAll(m,M={},B=null){if(m==null)throw new TypeError("input required");({options:M,cb:B}=O(M,B));const{encoding:j="hex",...H}=M,ee=new F(H),K=[];ee.on("data",A=>K.push(F.nullcheck(A)));const U=new Promise((A,q)=>{ee.on("error",q),ee.on("end",()=>A(K))});return typeof B=="function"&&U.then(A=>B(void 0,A),A=>B(A,void 0)),d.guessEncoding(m,j).pipe(ee),U}close(){this.running=!1,this.__fresh=!0}_onRead(m){this.valueBytes.write(m)}*_parse(){let m=null,M=0,B=null;for(;;){if(this.max_depth>=0&&M>this.max_depth)throw new Error(`Maximum depth ${this.max_depth} exceeded`);const[j]=yield 1;if(!this.running)throw this.bs.unshift(c.from([j])),new S(j);const H=j>>5,ee=j&31,K=m?.[R],U=m?.length;switch(ee){case u.ONE:this.emit("more-bytes",H,1,K,U),[B]=yield 1;break;case u.TWO:case u.FOUR:case u.EIGHT:{const q=1<<ee-24;this.emit("more-bytes",H,q,K,U);const ne=yield q;B=H===a.SIMPLE_FLOAT?ne:d.parseCBORint(ee,ne);break}case 28:case 29:case 30:throw this.running=!1,new Error(`Additional info not implemented: ${ee}`);case u.INDEFINITE:switch(H){case a.POS_INT:case a.NEG_INT:case a.TAG:throw new Error(`Invalid indefinite encoding for MT ${H}`)}B=-1;break;default:B=ee}switch(H){case a.POS_INT:break;case a.NEG_INT:B===Number.MAX_SAFE_INTEGER?B=b.NEG_MAX:B=typeof B=="bigint"?b.MINUS_ONE-B:-1-B;break;case a.BYTE_STRING:case a.UTF8_STRING:switch(B){case 0:this.emit("start-string",H,B,K,U),H===a.UTF8_STRING?B="":B=this.preferWeb?new Uint8Array(0):c.allocUnsafe(0);break;case-1:this.emit("start",H,p.STREAM,K,U),m=N(m,H),M++;continue;default:this.emit("start-string",H,B,K,U),B=yield B,H===a.UTF8_STRING?B=d.utf8(B):this.preferWeb&&(B=new Uint8Array(B.buffer,B.byteOffset,B.length))}break;case a.ARRAY:case a.MAP:switch(B){case 0:H===a.MAP?B=this.preferMap?new Map:{}:B=[];break;case-1:this.emit("start",H,p.STREAM,K,U),m=L(m,H,-1),M++;continue;default:this.emit("start",H,B,K,U),m=L(m,H,B*(H-3)),M++;continue}break;case a.TAG:this.emit("start",H,B,K,U),m=L(m,H,1),m.push(B),M++;continue;case a.SIMPLE_FLOAT:if(typeof B=="number"){if(ee===u.ONE&&B<32)throw new Error(`Invalid two-byte encoding of simple value ${B}`);const q=m!=null;B=h.decode(B,q,q&&m[T]<0)}else B=d.parseCBORfloat(B)}this.emit("value",B,K,U,ee);let A=!1;for(;m!=null;){if(B===p.BREAK)m[T]=1;else if(Array.isArray(m))m.push(B);else{const ne=m[R];if(ne!=null&&ne!==H)throw this.running=!1,new Error("Invalid major type in indefinite encoding");m.write(B)}if(--m[T]!==0){A=!0;break}if(--M,delete m[T],Array.isArray(m))switch(m[R]){case a.ARRAY:B=m;break;case a.MAP:{let ne=!this.preferMap;if(m.length%2!==0)throw new Error(`Invalid map length: ${m.length}`);for(let oe=0,se=m.length;ne&&oe<se;oe+=2)if(typeof m[oe]!="string"||m[oe]==="__proto__"){ne=!1;break}if(ne){B={};for(let oe=0,se=m.length;oe<se;oe+=2){if(this.preventDuplicateKeys&&Object.prototype.hasOwnProperty.call(B,m[oe]))throw new Error("Duplicate keys in a map");B[m[oe]]=m[oe+1]}}else{B=new Map;for(let oe=0,se=m.length;oe<se;oe+=2){if(this.preventDuplicateKeys&&B.has(m[oe]))throw new Error("Duplicate keys in a map");B.set(m[oe],m[oe+1])}}break}case a.TAG:{B=new o(m[0],m[1]).convert(this.tags);break}}else if(m instanceof y)switch(m[R]){case a.BYTE_STRING:B=m.slice(),this.preferWeb&&(B=new Uint8Array(B.buffer,B.byteOffset,B.length));break;case a.UTF8_STRING:B=m.toString("utf-8");break}this.emit("stop",m[R]);const q=m;m=m[p.PARENT],delete q[p.PARENT],delete q[R]}if(!A){if(this.extendedResults){const q=this.valueBytes.slice(),ne={value:F.nullcheck(B),bytes:q,length:q.length};return this.valueBytes=new y,ne}return B}}}}return F.NOT_FOUND=v,tn=F,tn}var rn,yo;function Ts(){if(yo)return rn;yo=1;const s=nt(),o=ft(),h=wt(),d=it(),{MT:y,NUMBYTES:i,SYMS:a}=Ye(),{Buffer:u}=Ce();function p(T){return T>1?"s":""}function b(T,R){switch(typeof T){case"function":return{options:{},cb:T};case"string":return{options:{encoding:T},cb:R};case"number":return{options:{max_depth:T},cb:R};case"object":return{options:T||{},cb:R};default:throw new TypeError("Unknown option type")}}class c extends s.Transform{constructor(R={}){const{depth:x=1,max_depth:v=10,no_summary:L=!1,tags:N={},preferWeb:S,encoding:O,...F}=R;super({...F,readableObjectMode:!1,writableObjectMode:!1}),this.depth=x,this.max_depth=v,this.all=new d,N[24]||(N[24]=this._tag_24.bind(this)),this.parser=new h({tags:N,max_depth:v,preferWeb:S,encoding:O}),this.parser.on("value",this._on_value.bind(this)),this.parser.on("start",this._on_start.bind(this)),this.parser.on("start-string",this._on_start_string.bind(this)),this.parser.on("stop",this._on_stop.bind(this)),this.parser.on("more-bytes",this._on_more.bind(this)),this.parser.on("error",this._on_error.bind(this)),L||this.parser.on("data",this._on_data.bind(this)),this.parser.bs.on("read",this._on_read.bind(this))}_tag_24(R){const x=new c({depth:this.depth+1,no_summary:!0});x.on("data",v=>this.push(v)),x.on("error",v=>this.emit("error",v)),x.end(R)}_transform(R,x,v){this.parser.write(R,x,v)}_flush(R){return this.parser._flush(R)}static comment(R,x={},v=null){if(R==null)throw new Error("input required");({options:x,cb:v}=b(x,v));const L=new d,{encoding:N="hex",...S}=x,O=new c(S);let F=null;return typeof v=="function"?(O.on("end",()=>{v(null,L.toString("utf8"))}),O.on("error",v)):F=new Promise((I,m)=>{O.on("end",()=>{I(L.toString("utf8"))}),O.on("error",m)}),O.pipe(L),o.guessEncoding(R,N).pipe(O),F}_on_error(R){this.push("ERROR: "),this.push(R.toString()),this.push(`
11
+ `)}_on_read(R){this.all.write(R);const x=R.toString("hex");this.push(new Array(this.depth+1).join(" ")),this.push(x);let v=(this.max_depth-this.depth)*2-x.length;v<1&&(v=1),this.push(new Array(v+1).join(" ")),this.push("-- ")}_on_more(R,x,v,L){let N="";switch(this.depth++,R){case y.POS_INT:N="Positive number,";break;case y.NEG_INT:N="Negative number,";break;case y.ARRAY:N="Array, length";break;case y.MAP:N="Map, count";break;case y.BYTE_STRING:N="Bytes, length";break;case y.UTF8_STRING:N="String, length";break;case y.SIMPLE_FLOAT:x===1?N="Simple value,":N="Float,";break}this.push(`${N} next ${x} byte${p(x)}
12
+ `)}_on_start_string(R,x,v,L){let N="";switch(this.depth++,R){case y.BYTE_STRING:N=`Bytes, length: ${x}`;break;case y.UTF8_STRING:N=`String, length: ${x.toString()}`;break}this.push(`${N}
13
+ `)}_on_start(R,x,v,L){switch(this.depth++,v){case y.ARRAY:this.push(`[${L}], `);break;case y.MAP:L%2?this.push(`{Val:${Math.floor(L/2)}}, `):this.push(`{Key:${Math.floor(L/2)}}, `);break}switch(R){case y.TAG:this.push(`Tag #${x}`),x===24&&this.push(" Encoded CBOR data item");break;case y.ARRAY:x===a.STREAM?this.push("Array (streaming)"):this.push(`Array, ${x} item${p(x)}`);break;case y.MAP:x===a.STREAM?this.push("Map (streaming)"):this.push(`Map, ${x} pair${p(x)}`);break;case y.BYTE_STRING:this.push("Bytes (streaming)");break;case y.UTF8_STRING:this.push("String (streaming)");break}this.push(`
14
+ `)}_on_stop(R){this.depth--}_on_value(R,x,v,L){if(R!==a.BREAK)switch(x){case y.ARRAY:this.push(`[${v}], `);break;case y.MAP:v%2?this.push(`{Val:${Math.floor(v/2)}}, `):this.push(`{Key:${Math.floor(v/2)}}, `);break}const N=o.cborValueToString(R,-1/0);switch(typeof R=="string"||u.isBuffer(R)?(R.length>0&&(this.push(N),this.push(`
15
+ `)),this.depth--):(this.push(N),this.push(`
16
+ `)),L){case i.ONE:case i.TWO:case i.FOUR:case i.EIGHT:this.depth--}}_on_data(){this.push("0x"),this.push(this.all.read().toString("hex")),this.push(`
17
+ `)}}return rn=c,rn}var nn,go;function xs(){if(go)return nn;go=1;const s=nt(),o=wt(),h=ft(),d=it(),{MT:y,SYMS:i}=Ye();function a(p,b){switch(typeof p){case"function":return{options:{},cb:p};case"string":return{options:{encoding:p},cb:b};case"object":return{options:p||{},cb:b};default:throw new TypeError("Unknown option type")}}class u extends s.Transform{constructor(b={}){const{separator:c=`
18
+ `,stream_errors:T=!1,tags:R,max_depth:x,preferWeb:v,encoding:L,...N}=b;super({...N,readableObjectMode:!1,writableObjectMode:!1}),this.float_bytes=-1,this.separator=c,this.stream_errors=T,this.parser=new o({tags:R,max_depth:x,preferWeb:v,encoding:L}),this.parser.on("more-bytes",this._on_more.bind(this)),this.parser.on("value",this._on_value.bind(this)),this.parser.on("start",this._on_start.bind(this)),this.parser.on("stop",this._on_stop.bind(this)),this.parser.on("data",this._on_data.bind(this)),this.parser.on("error",this._on_error.bind(this))}_transform(b,c,T){this.parser.write(b,c,T)}_flush(b){this.parser._flush(c=>this.stream_errors?(c&&this._on_error(c),b()):b(c))}static diagnose(b,c={},T=null){if(b==null)throw new TypeError("input required");({options:c,cb:T}=a(c,T));const{encoding:R="hex",...x}=c,v=new d,L=new u(x);let N=null;return typeof T=="function"?(L.on("end",()=>T(null,v.toString("utf8"))),L.on("error",T)):N=new Promise((S,O)=>{L.on("end",()=>S(v.toString("utf8"))),L.on("error",O)}),L.pipe(v),h.guessEncoding(b,R).pipe(L),N}_on_error(b){this.stream_errors?this.push(b.toString()):this.emit("error",b)}_on_more(b,c,T,R){b===y.SIMPLE_FLOAT&&(this.float_bytes={2:1,4:2,8:3}[c])}_fore(b,c){switch(b){case y.BYTE_STRING:case y.UTF8_STRING:case y.ARRAY:c>0&&this.push(", ");break;case y.MAP:c>0&&(c%2?this.push(": "):this.push(", "))}}_on_value(b,c,T){if(b===i.BREAK)return;this._fore(c,T);const R=this.float_bytes;this.float_bytes=-1,this.push(h.cborValueToString(b,R))}_on_start(b,c,T,R){switch(this._fore(T,R),b){case y.TAG:this.push(`${c}(`);break;case y.ARRAY:this.push("[");break;case y.MAP:this.push("{");break;case y.BYTE_STRING:case y.UTF8_STRING:this.push("(");break}c===i.STREAM&&this.push("_ ")}_on_stop(b){switch(b){case y.TAG:this.push(")");break;case y.ARRAY:this.push("]");break;case y.MAP:this.push("}");break;case y.BYTE_STRING:case y.UTF8_STRING:this.push(")");break}}_on_data(){this.push(this.separator)}}return nn=u,nn}var on,wo;function sn(){if(wo)return on;wo=1;const s=nt(),o=it(),h=ft(),d=Ye(),{MT:y,NUMBYTES:i,SHIFT32:a,SIMPLE:u,SYMS:p,TAG:b,BI:c}=d,{Buffer:T}=Ce(),R=y.SIMPLE_FLOAT<<5|i.TWO,x=y.SIMPLE_FLOAT<<5|i.FOUR,v=y.SIMPLE_FLOAT<<5|i.EIGHT,L=y.SIMPLE_FLOAT<<5|u.TRUE,N=y.SIMPLE_FLOAT<<5|u.FALSE,S=y.SIMPLE_FLOAT<<5|u.UNDEFINED,O=y.SIMPLE_FLOAT<<5|u.NULL,F=T.from([255]),I=T.from("f97e00","hex"),m=T.from("f9fc00","hex"),M=T.from("f97c00","hex"),B=T.from("f98000","hex"),j={};let H={};function ee(U){if(!U)return"number";switch(U.toLowerCase()){case"number":return"number";case"float":return"float";case"int":case"integer":return"int";case"string":return"string"}throw new TypeError(`dateType invalid, got "${U}"`)}class K extends s.Transform{constructor(A={}){const{canonical:q=!1,encodeUndefined:ne,disallowUndefinedKeys:oe=!1,dateType:se="number",collapseBigIntegers:fe=!1,detectLoops:le=!1,omitUndefinedProperties:ce=!1,genTypes:we=[],...G}=A;if(super({...G,readableObjectMode:!1,writableObjectMode:!0}),this.canonical=q,this.encodeUndefined=ne,this.disallowUndefinedKeys=oe,this.dateType=ee(se),this.collapseBigIntegers=this.canonical?!0:fe,this.detectLoops=void 0,typeof le=="boolean")le&&(this.detectLoops=new WeakSet);else if(le instanceof WeakSet)this.detectLoops=le;else throw new TypeError("detectLoops must be boolean or WeakSet");if(this.omitUndefinedProperties=ce,this.semanticTypes={...K.SEMANTIC_TYPES},Array.isArray(we))for(let Y=0,z=we.length;Y<z;Y+=2)this.addSemanticType(we[Y],we[Y+1]);else for(const[Y,z]of Object.entries(we))this.addSemanticType(Y,z)}_transform(A,q,ne){const oe=this.pushAny(A);ne(oe===!1?new Error("Push Error"):void 0)}_flush(A){A()}_pushUInt8(A){const q=T.allocUnsafe(1);return q.writeUInt8(A,0),this.push(q)}_pushUInt16BE(A){const q=T.allocUnsafe(2);return q.writeUInt16BE(A,0),this.push(q)}_pushUInt32BE(A){const q=T.allocUnsafe(4);return q.writeUInt32BE(A,0),this.push(q)}_pushFloatBE(A){const q=T.allocUnsafe(4);return q.writeFloatBE(A,0),this.push(q)}_pushDoubleBE(A){const q=T.allocUnsafe(8);return q.writeDoubleBE(A,0),this.push(q)}_pushNaN(){return this.push(I)}_pushInfinity(A){const q=A<0?m:M;return this.push(q)}_pushFloat(A){if(this.canonical){const q=T.allocUnsafe(2);if(h.writeHalf(q,A))return this._pushUInt8(R)&&this.push(q)}return Math.fround(A)===A?this._pushUInt8(x)&&this._pushFloatBE(A):this._pushUInt8(v)&&this._pushDoubleBE(A)}_pushInt(A,q,ne){const oe=q<<5;if(A<24)return this._pushUInt8(oe|A);if(A<=255)return this._pushUInt8(oe|i.ONE)&&this._pushUInt8(A);if(A<=65535)return this._pushUInt8(oe|i.TWO)&&this._pushUInt16BE(A);if(A<=4294967295)return this._pushUInt8(oe|i.FOUR)&&this._pushUInt32BE(A);let se=Number.MAX_SAFE_INTEGER;return q===y.NEG_INT&&se--,A<=se?this._pushUInt8(oe|i.EIGHT)&&this._pushUInt32BE(Math.floor(A/a))&&this._pushUInt32BE(A%a):q===y.NEG_INT?this._pushFloat(ne):this._pushFloat(A)}_pushIntNum(A){return Object.is(A,-0)?this.push(B):A<0?this._pushInt(-A-1,y.NEG_INT,A):this._pushInt(A,y.POS_INT)}_pushNumber(A){return isNaN(A)?this._pushNaN():isFinite(A)?Math.round(A)===A?this._pushIntNum(A):this._pushFloat(A):this._pushInfinity(A)}_pushString(A){const q=T.byteLength(A,"utf8");return this._pushInt(q,y.UTF8_STRING)&&this.push(A,"utf8")}_pushBoolean(A){return this._pushUInt8(A?L:N)}_pushUndefined(A){switch(typeof this.encodeUndefined){case"undefined":return this._pushUInt8(S);case"function":return this.pushAny(this.encodeUndefined(A));case"object":{const q=h.bufferishToBuffer(this.encodeUndefined);if(q)return this.push(q)}}return this.pushAny(this.encodeUndefined)}_pushNull(A){return this._pushUInt8(O)}_pushTag(A){return this._pushInt(A,y.TAG)}_pushJSBigint(A){let q=y.POS_INT,ne=b.POS_BIGINT;if(A<0&&(A=-A+c.MINUS_ONE,q=y.NEG_INT,ne=b.NEG_BIGINT),this.collapseBigIntegers&&A<=c.MAXINT64)return A<=4294967295?this._pushInt(Number(A),q):this._pushUInt8(q<<5|i.EIGHT)&&this._pushUInt32BE(Number(A/c.SHIFT32))&&this._pushUInt32BE(Number(A%c.SHIFT32));let oe=A.toString(16);oe.length%2&&(oe=`0${oe}`);const se=T.from(oe,"hex");return this._pushTag(ne)&&K._pushBuffer(this,se)}_pushObject(A,q){if(!A)return this._pushNull(A);if(q={indefinite:!1,skipTypes:!1,...q},!q.indefinite&&this.detectLoops){if(this.detectLoops.has(A))throw new Error(`Loop detected while CBOR encoding.
19
+ Call removeLoopDetectors before resuming.`);this.detectLoops.add(A)}if(!q.skipTypes){const fe=A.encodeCBOR;if(typeof fe=="function")return fe.call(A,this);const le=this.semanticTypes[A.constructor.name];if(le)return le.call(A,this,A)}const ne=Object.keys(A).filter(fe=>{const le=typeof A[fe];return le!=="function"&&(!this.omitUndefinedProperties||le!=="undefined")}),oe={};if(this.canonical&&ne.sort((fe,le)=>{const ce=oe[fe]||(oe[fe]=K.encode(fe)),we=oe[le]||(oe[le]=K.encode(le));return ce.compare(we)}),q.indefinite){if(!this._pushUInt8(y.MAP<<5|i.INDEFINITE))return!1}else if(!this._pushInt(ne.length,y.MAP))return!1;let se=null;for(let fe=0,le=ne.length;fe<le;fe++){const ce=ne[fe];if(this.canonical&&(se=oe[ce])){if(!this.push(se))return!1}else if(!this._pushString(ce))return!1;if(!this.pushAny(A[ce]))return!1}if(q.indefinite){if(!this.push(F))return!1}else this.detectLoops&&this.detectLoops.delete(A);return!0}_encodeAll(A){const q=new o({highWaterMark:this.readableHighWaterMark});this.pipe(q);for(const ne of A)this.pushAny(ne);return this.end(),q.read()}addSemanticType(A,q){const ne=typeof A=="string"?A:A.name,oe=this.semanticTypes[ne];if(q){if(typeof q!="function")throw new TypeError("fun must be of type function");this.semanticTypes[ne]=q}else oe&&delete this.semanticTypes[ne];return oe}pushAny(A){switch(typeof A){case"number":return this._pushNumber(A);case"bigint":return this._pushJSBigint(A);case"string":return this._pushString(A);case"boolean":return this._pushBoolean(A);case"undefined":return this._pushUndefined(A);case"object":return this._pushObject(A);case"symbol":switch(A){case p.NULL:return this._pushNull(null);case p.UNDEFINED:return this._pushUndefined(void 0);default:throw new TypeError(`Unknown symbol: ${A.toString()}`)}default:throw new TypeError(`Unknown type: ${typeof A}, ${typeof A.toString=="function"?A.toString():""}`)}}static pushArray(A,q,ne){ne={indefinite:!1,...ne};const oe=q.length;if(ne.indefinite){if(!A._pushUInt8(y.ARRAY<<5|i.INDEFINITE))return!1}else if(!A._pushInt(oe,y.ARRAY))return!1;for(let se=0;se<oe;se++)if(!A.pushAny(q[se]))return!1;return!(ne.indefinite&&!A.push(F))}removeLoopDetectors(){return this.detectLoops?(this.detectLoops=new WeakSet,!0):!1}static _pushDate(A,q){switch(A.dateType){case"string":return A._pushTag(b.DATE_STRING)&&A._pushString(q.toISOString());case"int":return A._pushTag(b.DATE_EPOCH)&&A._pushIntNum(Math.round(q.getTime()/1e3));case"float":return A._pushTag(b.DATE_EPOCH)&&A._pushFloat(q.getTime()/1e3);default:return A._pushTag(b.DATE_EPOCH)&&A.pushAny(q.getTime()/1e3)}}static _pushBuffer(A,q){return A._pushInt(q.length,y.BYTE_STRING)&&A.push(q)}static _pushNoFilter(A,q){return K._pushBuffer(A,q.slice())}static _pushRegexp(A,q){return A._pushTag(b.REGEXP)&&A.pushAny(q.source)}static _pushSet(A,q){if(!A._pushTag(b.SET)||!A._pushInt(q.size,y.ARRAY))return!1;for(const ne of q)if(!A.pushAny(ne))return!1;return!0}static _pushURL(A,q){return A._pushTag(b.URI)&&A.pushAny(q.toString())}static _pushBoxed(A,q){return A.pushAny(q.valueOf())}static _pushMap(A,q,ne){ne={indefinite:!1,...ne};let oe=[...q.entries()];if(A.omitUndefinedProperties&&(oe=oe.filter(([se,fe])=>fe!==void 0)),ne.indefinite){if(!A._pushUInt8(y.MAP<<5|i.INDEFINITE))return!1}else if(!A._pushInt(oe.length,y.MAP))return!1;if(A.canonical){const se=new K({genTypes:A.semanticTypes,canonical:A.canonical,detectLoops:!!A.detectLoops,dateType:A.dateType,disallowUndefinedKeys:A.disallowUndefinedKeys,collapseBigIntegers:A.collapseBigIntegers}),fe=new o({highWaterMark:A.readableHighWaterMark});se.pipe(fe),oe.sort(([le],[ce])=>{se.pushAny(le);const we=fe.read();se.pushAny(ce);const G=fe.read();return we.compare(G)});for(const[le,ce]of oe){if(A.disallowUndefinedKeys&&typeof le>"u")throw new Error("Invalid Map key: undefined");if(!(A.pushAny(le)&&A.pushAny(ce)))return!1}}else for(const[se,fe]of oe){if(A.disallowUndefinedKeys&&typeof se>"u")throw new Error("Invalid Map key: undefined");if(!(A.pushAny(se)&&A.pushAny(fe)))return!1}return!(ne.indefinite&&!A.push(F))}static _pushTypedArray(A,q){let ne=64,oe=q.BYTES_PER_ELEMENT;const{name:se}=q.constructor;return se.startsWith("Float")?(ne|=16,oe/=2):se.includes("U")||(ne|=8),(se.includes("Clamped")||oe!==1&&!h.isBigEndian())&&(ne|=4),ne|={1:0,2:1,4:2,8:3}[oe],A._pushTag(ne)?K._pushBuffer(A,T.from(q.buffer,q.byteOffset,q.byteLength)):!1}static _pushArrayBuffer(A,q){return K._pushBuffer(A,T.from(q))}static encodeIndefinite(A,q,ne={}){if(q==null){if(this==null)throw new Error("No object to encode");q=this}const{chunkSize:oe=4096}=ne;let se=!0;const fe=typeof q;let le=null;if(fe==="string"){se=se&&A._pushUInt8(y.UTF8_STRING<<5|i.INDEFINITE);let ce=0;for(;ce<q.length;){const we=ce+oe;se=se&&A._pushString(q.slice(ce,we)),ce=we}se=se&&A.push(F)}else if(le=h.bufferishToBuffer(q)){se=se&&A._pushUInt8(y.BYTE_STRING<<5|i.INDEFINITE);let ce=0;for(;ce<le.length;){const we=ce+oe;se=se&&K._pushBuffer(A,le.slice(ce,we)),ce=we}se=se&&A.push(F)}else if(Array.isArray(q))se=se&&K.pushArray(A,q,{indefinite:!0});else if(q instanceof Map)se=se&&K._pushMap(A,q,{indefinite:!0});else{if(fe!=="object")throw new Error("Invalid indefinite encoding");se=se&&A._pushObject(q,{indefinite:!0,skipTypes:!0})}return se}static encode(...A){return new K()._encodeAll(A)}static encodeCanonical(...A){return new K({canonical:!0})._encodeAll(A)}static encodeOne(A,q){return new K(q)._encodeAll([A])}static encodeAsync(A,q){return new Promise((ne,oe)=>{const se=[],fe=new K(q);fe.on("data",le=>se.push(le)),fe.on("error",oe),fe.on("finish",()=>ne(T.concat(se))),fe.pushAny(A),fe.end()})}static get SEMANTIC_TYPES(){return H}static set SEMANTIC_TYPES(A){H=A}static reset(){K.SEMANTIC_TYPES={...j}}}return Object.assign(j,{Array:K.pushArray,Date:K._pushDate,Buffer:K._pushBuffer,[T.name]:K._pushBuffer,Map:K._pushMap,NoFilter:K._pushNoFilter,[o.name]:K._pushNoFilter,RegExp:K._pushRegexp,Set:K._pushSet,ArrayBuffer:K._pushArrayBuffer,Uint8ClampedArray:K._pushTypedArray,Uint8Array:K._pushTypedArray,Uint16Array:K._pushTypedArray,Uint32Array:K._pushTypedArray,Int8Array:K._pushTypedArray,Int16Array:K._pushTypedArray,Int32Array:K._pushTypedArray,Float32Array:K._pushTypedArray,Float64Array:K._pushTypedArray,URL:K._pushURL,Boolean:K._pushBoxed,Number:K._pushBoxed,String:K._pushBoxed}),typeof BigUint64Array<"u"&&(j[BigUint64Array.name]=K._pushTypedArray),typeof BigInt64Array<"u"&&(j[BigInt64Array.name]=K._pushTypedArray),K.reset(),on=K,on}var an,mo;function Fs(){if(mo)return an;mo=1;const{Buffer:s}=Ce(),o=sn(),h=wt(),{MT:d}=Ye();class y extends Map{constructor(a){super(a)}static _encode(a){return o.encodeCanonical(a).toString("base64")}static _decode(a){return h.decodeFirstSync(a,"base64")}get(a){return super.get(y._encode(a))}set(a,u){return super.set(y._encode(a),u)}delete(a){return super.delete(y._encode(a))}has(a){return super.has(y._encode(a))}*keys(){for(const a of super.keys())yield y._decode(a)}*entries(){for(const a of super.entries())yield[y._decode(a[0]),a[1]]}[Symbol.iterator](){return this.entries()}forEach(a,u=this){if(typeof a!="function")throw new TypeError("Must be function");for(const p of super.entries())a.call(u,p[1],y._decode(p[0]),this)}encodeCBOR(a){if(!a._pushInt(this.size,d.MAP))return!1;if(a.canonical){const u=Array.from(super.entries()).map(p=>[s.from(p[0],"base64"),p[1]]);u.sort((p,b)=>p[0].compare(b[0]));for(const p of u)if(!(a.push(p[0])&&a.pushAny(p[1])))return!1}else for(const u of super.entries())if(!(a.push(s.from(u[0],"base64"))&&a.pushAny(u[1])))return!1;return!0}}return an=y,an}var un,Eo;function Os(){if(Eo)return un;Eo=1;class s{constructor(){this.clear()}clear(){this.map=new WeakMap,this.count=0,this.recording=!0}stop(){this.recording=!1}check(h){const d=this.map.get(h);if(d)return d.length>1?d[0]||this.recording?d[1]:(d[0]=!0,s.FIRST):this.recording?(d.push(this.count++),d[1]):s.NEVER;if(!this.recording)throw new Error("New object detected when not recording");return this.map.set(h,[!1]),s.NEVER}}return s.NEVER=-1,s.FIRST=-2,un=s,un}var fn,bo;function Us(){if(bo)return fn;bo=1;const s=sn(),o=Os(),{Buffer:h}=Ce();class d extends s{constructor(i){super(i),this.valueSharing=new o}_pushObject(i,a){if(i!==null){const u=this.valueSharing.check(i);switch(u){case o.FIRST:this._pushTag(28);break;case o.NEVER:break;default:return this._pushTag(29)&&this._pushIntNum(u)}}return super._pushObject(i,a)}stopRecording(){this.valueSharing.stop()}clearRecording(){this.valueSharing.clear()}static encode(...i){const a=new d;a.on("data",()=>{});for(const u of i)a.pushAny(u);return a.stopRecording(),a.removeAllListeners("data"),a._encodeAll(i)}static encodeCanonical(...i){throw new Error("Cannot encode canonically in a SharedValueEncoder, which serializes objects multiple times.")}static encodeOne(i,a){const u=new d(a);return u.on("data",()=>{}),u.pushAny(i),u.stopRecording(),u.removeAllListeners("data"),u._encodeAll([i])}static encodeAsync(i,a){return new Promise((u,p)=>{const b=[],c=new d(a);c.on("data",()=>{}),c.on("error",p),c.on("finish",()=>u(h.concat(b))),c.pushAny(i),c.stopRecording(),c.removeAllListeners("data"),c.on("data",T=>b.push(T)),c.pushAny(i),c.end()})}}return fn=d,fn}var ln,_o;function Ns(){if(_o)return ln;_o=1;const s=Ts(),o=xs(),h=wt(),d=sn(),y=ho(),i=lo(),a=Fs(),u=Us();return ln={Commented:s,Diagnose:o,Decoder:h,Encoder:d,Simple:y,Tagged:i,Map:a,SharedValueEncoder:u,comment:s.comment,decodeAll:h.decodeAll,decodeFirst:h.decodeFirst,decodeAllSync:h.decodeAllSync,decodeFirstSync:h.decodeFirstSync,diagnose:o.diagnose,encode:d.encode,encodeCanonical:d.encodeCanonical,encodeOne:d.encodeOne,encodeAsync:d.encodeAsync,decode:h.decodeFirstSync,leveldb:{decode:h.decodeFirstSync,encode:d.encode,buffer:!0,name:"cbor"},reset(){d.reset(),i.reset()}},ln}var Ms=Ns();const vo=Mo(Ms);class Ps{constructor(o){this.type=o}encode(o){let h;if(this.type==="cbor")try{h=vo.encode(o)}catch{throw new Error("failed to encode CBOR format")}else if(this.type==="json")try{h=JSON.stringify(o)}catch{throw new Error("failed to encode JSON format")}else throw new Error("invalid format");return h}decode(o){let h;if(this.type==="cbor"&&typeof o=="object"&&o instanceof No)try{h=vo.decode(o)}catch{throw new Error("failed to decode CBOR format")}else if(this.type==="json"&&typeof o=="string")try{h=JSON.parse(o)}catch{throw new Error("failed to decode JSON format")}else throw new Error("invalid format or wrong data type");return h}}class mt{constructor(o,h,d){this.id=o,this.sender=h,this.receiver=d}}class So extends mt{constructor(o,h,d,y,i){super(o,y,i),this.event=h,this.params=d}}class Ao extends mt{constructor(o,h,d,y,i){super(o,y,i),this.service=h,this.params=d}}class cn extends mt{constructor(o,h,d,y){super(o,d,y),this.result=h}}class hn extends mt{constructor(o,h,d,y){super(o,d,y),this.error=h}}class Ls{makeEventEmission(o,h,d,y,i){return new So(o,h,d,y,i)}makeServiceRequest(o,h,d,y,i){return new Ao(o,h,d,y,i)}makeServiceResponseSuccess(o,h,d,y){return new cn(o,h,d,y)}makeServiceResponseError(o,h,d,y){return new hn(o,h,d,y)}parse(o){if(typeof o!="object"||o===null)throw new Error("invalid argument: not an object");if(!("id"in o)||typeof o.id!="string")throw new Error('invalid object: missing or invalid "id" field');if("sender"in o&&typeof o.sender!="string")throw new Error('invalid object: invalid "sender" field');if("receiver"in o&&typeof o.sender!="string")throw new Error('invalid object: invalid "receiver" field');const h=(d,y)=>Object.keys(d).some(i=>!y.includes(i));if("event"in o){if(typeof o.event!="string")throw new Error('invalid EventEmission object: "event" field must be a string');if(h(o,["type","id","event","params","sender","receiver"]))throw new Error("invalid EventEmission object: contains unknown fields");if(o.params!==void 0&&(typeof o.params!="object"||!Array.isArray(o.params)))throw new Error('invalid EventEmission object: "params" field must be an array');return this.makeEventEmission(o.id,o.event,o.params,o.sender,o.receiver)}else if("service"in o){if(typeof o.service!="string")throw new Error('invalid ServiceRequest object: "service" field must be a string');if(h(o,["type","id","service","params","sender","receiver"]))throw new Error("invalid ServiceRequest object: contains unknown fields");if(o.params!==void 0&&(typeof o.params!="object"||!Array.isArray(o.params)))throw new Error('invalid ServiceRequest object: "params" field must be an array');return this.makeServiceRequest(o.id,o.service,o.params,o.sender,o.receiver)}else if("result"in o){if(h(o,["type","id","result","sender","receiver"]))throw new Error("invalid ServiceResponseSuccess object: contains unknown fields");return this.makeServiceResponseSuccess(o.id,o.result,o.sender,o.receiver)}else if("error"in o){if(h(o,["type","id","error","sender","receiver"]))throw new Error("invalid ServiceResponseError object: contains unknown fields");return this.makeServiceResponseError(o.id,o.error,o.sender,o.receiver)}else throw new Error("invalid object: not of any known type")}}class Cs{constructor(o,h={}){this.mqtt=o,this.msg=new Ls,this.registry=new Map,this.requests=new Map,this.subscriptions=new Map,this.options={id:Je(),codec:"cbor",timeout:10*1e3,topicEventNoticeMake:(d,y)=>y?`${d}/event-notice/${y}`:`${d}/event-notice`,topicServiceRequestMake:(d,y)=>y?`${d}/service-request/${y}`:`${d}/service-request`,topicServiceResponseMake:(d,y)=>y?`${d}/service-response/${y}`:`${d}/service-response`,topicEventNoticeMatch:d=>{const y=d.match(/^(.+?)\/event-notice(?:\/(.+))?$/);return y?{name:y[1],peerId:y[2]}:null},topicServiceRequestMatch:d=>{const y=d.match(/^(.+?)\/service-request(?:\/(.+))?$/);return y?{name:y[1],peerId:y[2]}:null},topicServiceResponseMatch:d=>{const y=d.match(/^(.+?)\/service-response\/(.+)$/);return y?{name:y[1],peerId:y[2]}:null},...h},this.codec=new Ps(this.options.codec),this.mqtt.on("message",(d,y)=>{this._onMessage(d,y)})}async _subscribeTopic(o,h={}){return new Promise((d,y)=>{this.mqtt.subscribe(o,{qos:2,...h},(i,a)=>{i?y(i):d()})})}async _unsubscribeTopic(o){return new Promise((h,d)=>{this.mqtt.unsubscribe(o,(y,i)=>{y?d(y):h()})})}async subscribe(o,...h){let d={},y=h[0];if(h.length===2&&typeof h[0]=="object"&&(d=h[0],y=h[1]),this.registry.has(o))throw new Error(`subscribe: event "${o}" already subscribed`);const i=this.options.topicEventNoticeMake(o),a=this.options.topicEventNoticeMake(o,this.options.id);await Promise.all([this._subscribeTopic(i,{qos:0,...d}),this._subscribeTopic(a,{qos:0,...d})]).catch(b=>{throw this._unsubscribeTopic(i).catch(()=>{}),this._unsubscribeTopic(a).catch(()=>{}),b}),this.registry.set(o,y);const u=this;return{async unsubscribe(){if(!u.registry.has(o))throw new Error(`unsubscribe: event "${o}" not subscribed`);return u.registry.delete(o),Promise.all([u._unsubscribeTopic(i),u._unsubscribeTopic(a)]).then(()=>{})}}}async register(o,...h){let d={},y=h[0];if(h.length===2&&typeof h[0]=="object"&&(d=h[0],y=h[1]),this.registry.has(o))throw new Error(`register: service "${o}" already registered`);const i=this.options.topicServiceRequestMake(o),a=this.options.topicServiceRequestMake(o,this.options.id);await Promise.all([this._subscribeTopic(i,{qos:2,...d}),this._subscribeTopic(a,{qos:2,...d})]).catch(b=>{throw this._unsubscribeTopic(i).catch(()=>{}),this._unsubscribeTopic(a).catch(()=>{}),b}),this.registry.set(o,y);const u=this;return{async unregister(){if(!u.registry.has(o))throw new Error(`unregister: service "${o}" not registered`);return u.registry.delete(o),Promise.all([u._unsubscribeTopic(i),u._unsubscribeTopic(a)]).then(()=>{})}}}_isIClientPublishOptions(o){if(typeof o!="object")return!1;const h=["qos","retain","dup","properties","cbStorePut"];return Object.keys(o).every(d=>h.includes(d))}receiver(o){return{__receiver:o}}_getReceiver(o){return o.__receiver}_isReceiver(o){return typeof o=="object"&&o!==null&&"__receiver"in o&&typeof o.__receiver=="string"}_parseCallArgs(o){let h,d={},y=o;return o.length>=2&&this._isReceiver(o[0])&&this._isIClientPublishOptions(o[1])?(h=this._getReceiver(o[0]),d=o[1],y=o.slice(2)):o.length>=1&&this._isReceiver(o[0])?(h=this._getReceiver(o[0]),y=o.slice(1)):o.length>=1&&this._isIClientPublishOptions(o[0])&&(d=o[0],y=o.slice(1)),{receiver:h,options:d,params:y}}emit(o,...h){const{receiver:d,options:y,params:i}=this._parseCallArgs(h),a=Je(),u=this.msg.makeEventEmission(a,o,i,this.options.id,d),p=this.codec.encode(u),b=this.options.topicEventNoticeMake(o,d);this.mqtt.publish(b,p,{qos:2,...y})}call(o,...h){const{receiver:d,options:y,params:i}=this._parseCallArgs(h),a=Je();this._responseSubscribe(o,{qos:y.qos??2});const u=new Promise((T,R)=>{let x=setTimeout(()=>{this.requests.delete(a),this._responseUnsubscribe(o),x=null,R(new Error("communication timeout"))},this.options.timeout);this.requests.set(a,{service:o,callback:(v,L)=>{x!==null&&(clearTimeout(x),x=null),v?R(v):T(L)}})}),p=this.msg.makeServiceRequest(a,o,i,this.options.id,d),b=this.codec.encode(p),c=this.options.topicServiceRequestMake(o,d);return this.mqtt.publish(c,b,{qos:2,...y},T=>{const R=this.requests.get(a);T&&R!==void 0&&(this.requests.delete(a),this._responseUnsubscribe(o),R.callback(T,void 0))}),u}_responseSubscribe(o,h={qos:2}){const d=this.options.topicServiceResponseMake(o,this.options.id);this.subscriptions.has(d)||(this.subscriptions.set(d,0),this.mqtt.subscribe(d,h,y=>{y&&this.mqtt.emit("error",y)})),this.subscriptions.set(d,this.subscriptions.get(d)+1)}_responseUnsubscribe(o){const h=this.options.topicServiceResponseMake(o,this.options.id);this.subscriptions.has(h)&&(this.subscriptions.set(h,this.subscriptions.get(h)-1),this.subscriptions.get(h)===0&&(this.subscriptions.delete(h),this.mqtt.unsubscribe(h,d=>{d&&this.mqtt.emit("error",d)})))}_onMessage(o,h){let d=null,y=null,i=null;if((d=this.options.topicEventNoticeMatch(o))===null&&(y=this.options.topicServiceRequestMatch(o))===null&&(i=this.options.topicServiceResponseMatch(o))===null)return;const a=d?.peerId??y?.peerId??i?.peerId;if(a!==void 0&&a!==this.options.id)return;let u;try{let p=h;this.options.codec==="json"&&(p=h.toString());const b=this.codec.decode(p);u=this.msg.parse(b)}catch(p){const b=p instanceof Error?new Error(`failed to parse message: ${p.message}`):new Error("failed to parse message");this.mqtt.emit("error",b);return}if(u instanceof So){const p=u.event,b=this.registry.get(p),c=u.params??[],T={sender:u.sender??"",receiver:u.receiver};b?.(...c,T)}else if(u instanceof Ao){const p=u.id,b=u.service,c=this.registry.get(b);let T;if(c!==void 0){const R=u.params??[],x={sender:u.sender??"",receiver:u.receiver};T=Promise.resolve().then(()=>c(...R,x))}else T=Promise.reject(new Error(`method not found: ${b}`));T.then(R=>this.msg.makeServiceResponseSuccess(p,R,this.options.id,u.sender),R=>{let x;return R==null?x="undefined error":typeof R=="string"?x=R:R instanceof Error?x=R.message:x=String(R),this.msg.makeServiceResponseError(p,x,this.options.id,u.sender)}).then(R=>{const x=u.sender;if(x===void 0)throw new Error("invalid request: missing sender");const v=this.codec.encode(R),L=this.options.topicServiceResponseMake(b,x);this.mqtt.publish(L,v,{qos:2})}).catch(R=>{this.mqtt.emit("error",R)})}else if(u instanceof cn||u instanceof hn){const p=u.id,b=this.requests.get(p);b!==void 0&&(u instanceof cn?b.callback(void 0,u.result):u instanceof hn&&b.callback(new Error(u.error),void 0),this.requests.delete(p),this._responseUnsubscribe(b.service))}}}return Cs}));