@mysetup/mqtt 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -112
- package/dist/mqttClient.d.ts +17 -0
- package/dist/mqttClient.d.ts.map +1 -0
- package/dist/mqttClient.js +149 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,113 +1,17 @@
|
|
|
1
|
-
"use strict";var Gb=Object.create;var Di=Object.defineProperty;var Qb=Object.getOwnPropertyDescriptor;var Jb=Object.getOwnPropertyNames;var Yb=Object.getPrototypeOf,Xb=Object.prototype.hasOwnProperty;var B=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),vs=(t,e)=>{for(var r in e)Di(t,r,{get:e[r],enumerable:!0})},au=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Jb(e))!Xb.call(t,n)&&n!==r&&Di(t,n,{get:()=>e[n],enumerable:!(i=Qb(e,n))||i.enumerable});return t};var Es=(t,e,r)=>(r=t!=null?Gb(Yb(t)):{},au(e||!t||!t.__esModule?Di(r,"default",{value:t,enumerable:!0}):r,t)),xs=t=>au(Di({},"__esModule",{value:!0}),t);var uu=S(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});var Os=class{constructor(e){this.aliasToTopic={},this.max=e}put(e,r){return r===0||r>this.max?!1:(this.aliasToTopic[r]=e,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(e){return this.aliasToTopic[e]}clear(){this.aliasToTopic={}}};Ts.default=Os});var z=S((wR,cu)=>{"use strict";cu.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var wu=S((zr,Hr)=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});var yu=new WeakMap,As=new WeakMap;function U(t){let e=yu.get(t);return console.assert(e!=null,"'this' is expected an Event object, but got",t),e}function fu(t){if(t.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",t.passiveListener);return}t.event.cancelable&&(t.canceled=!0,typeof t.event.preventDefault=="function"&&t.event.preventDefault())}function lr(t,e){yu.set(this,{eventTarget:t,event:e,eventPhase:2,currentTarget:t,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:e.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let r=Object.keys(e);for(let i=0;i<r.length;++i){let n=r[i];n in this||Object.defineProperty(this,n,_u(n))}}lr.prototype={get type(){return U(this).event.type},get target(){return U(this).eventTarget},get currentTarget(){return U(this).currentTarget},composedPath(){let t=U(this).currentTarget;return t==null?[]:[t]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return U(this).eventPhase},stopPropagation(){let t=U(this);t.stopped=!0,typeof t.event.stopPropagation=="function"&&t.event.stopPropagation()},stopImmediatePropagation(){let t=U(this);t.stopped=!0,t.immediateStopped=!0,typeof t.event.stopImmediatePropagation=="function"&&t.event.stopImmediatePropagation()},get bubbles(){return!!U(this).event.bubbles},get cancelable(){return!!U(this).event.cancelable},preventDefault(){fu(U(this))},get defaultPrevented(){return U(this).canceled},get composed(){return!!U(this).event.composed},get timeStamp(){return U(this).timeStamp},get srcElement(){return U(this).eventTarget},get cancelBubble(){return U(this).stopped},set cancelBubble(t){if(!t)return;let e=U(this);e.stopped=!0,typeof e.event.cancelBubble=="boolean"&&(e.event.cancelBubble=!0)},get returnValue(){return!U(this).canceled},set returnValue(t){t||fu(U(this))},initEvent(){}};Object.defineProperty(lr.prototype,"constructor",{value:lr,configurable:!0,writable:!0});typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(lr.prototype,window.Event.prototype),As.set(window.Event.prototype,lr));function _u(t){return{get(){return U(this).event[t]},set(e){U(this).event[t]=e},configurable:!0,enumerable:!0}}function Zb(t){return{value(){let e=U(this).event;return e[t].apply(e,arguments)},configurable:!0,enumerable:!0}}function em(t,e){let r=Object.keys(e);if(r.length===0)return t;function i(n,s){t.call(this,n,s)}i.prototype=Object.create(t.prototype,{constructor:{value:i,configurable:!0,writable:!0}});for(let n=0;n<r.length;++n){let s=r[n];if(!(s in t.prototype)){let u=typeof Object.getOwnPropertyDescriptor(e,s).value=="function";Object.defineProperty(i.prototype,s,u?Zb(s):_u(s))}}return i}function bu(t){if(t==null||t===Object.prototype)return lr;let e=As.get(t);return e==null&&(e=em(bu(Object.getPrototypeOf(t)),t),As.set(t,e)),e}function tm(t,e){let r=bu(Object.getPrototypeOf(e));return new r(t,e)}function rm(t){return U(t).immediateStopped}function im(t,e){U(t).eventPhase=e}function nm(t,e){U(t).currentTarget=e}function hu(t,e){U(t).passiveListener=e}var mu=new WeakMap,du=1,pu=2,Wi=3;function Fi(t){return t!==null&&typeof t=="object"}function Kr(t){let e=mu.get(t);if(e==null)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return e}function sm(t){return{get(){let r=Kr(this).get(t);for(;r!=null;){if(r.listenerType===Wi)return r.listener;r=r.next}return null},set(e){typeof e!="function"&&!Fi(e)&&(e=null);let r=Kr(this),i=null,n=r.get(t);for(;n!=null;)n.listenerType===Wi?i!==null?i.next=n.next:n.next!==null?r.set(t,n.next):r.delete(t):i=n,n=n.next;if(e!==null){let s={listener:e,listenerType:Wi,passive:!1,once:!1,next:null};i===null?r.set(t,s):i.next=s}},configurable:!0,enumerable:!0}}function ks(t,e){Object.defineProperty(t,`on${e}`,sm(e))}function gu(t){function e(){Te.call(this)}e.prototype=Object.create(Te.prototype,{constructor:{value:e,configurable:!0,writable:!0}});for(let r=0;r<t.length;++r)ks(e.prototype,t[r]);return e}function Te(){if(this instanceof Te){mu.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return gu(arguments[0]);if(arguments.length>0){let t=new Array(arguments.length);for(let e=0;e<arguments.length;++e)t[e]=arguments[e];return gu(t)}throw new TypeError("Cannot call a class as a function")}Te.prototype={addEventListener(t,e,r){if(e==null)return;if(typeof e!="function"&&!Fi(e))throw new TypeError("'listener' should be a function or an object.");let i=Kr(this),n=Fi(r),o=(n?!!r.capture:!!r)?du:pu,u={listener:e,listenerType:o,passive:n&&!!r.passive,once:n&&!!r.once,next:null},a=i.get(t);if(a===void 0){i.set(t,u);return}let l=null;for(;a!=null;){if(a.listener===e&&a.listenerType===o)return;l=a,a=a.next}l.next=u},removeEventListener(t,e,r){if(e==null)return;let i=Kr(this),s=(Fi(r)?!!r.capture:!!r)?du:pu,o=null,u=i.get(t);for(;u!=null;){if(u.listener===e&&u.listenerType===s){o!==null?o.next=u.next:u.next!==null?i.set(t,u.next):i.delete(t);return}o=u,u=u.next}},dispatchEvent(t){if(t==null||typeof t.type!="string")throw new TypeError('"event.type" should be a string.');let e=Kr(this),r=t.type,i=e.get(r);if(i==null)return!0;let n=tm(this,t),s=null;for(;i!=null;){if(i.once?s!==null?s.next=i.next:i.next!==null?e.set(r,i.next):e.delete(r):s=i,hu(n,i.passive?i.listener:null),typeof i.listener=="function")try{i.listener.call(this,n)}catch(o){typeof console<"u"&&typeof console.error=="function"&&console.error(o)}else i.listenerType!==Wi&&typeof i.listener.handleEvent=="function"&&i.listener.handleEvent(n);if(rm(n))break;i=i.next}return hu(n,null),im(n,0),nm(n,null),!n.defaultPrevented}};Object.defineProperty(Te.prototype,"constructor",{value:Te,configurable:!0,writable:!0});typeof window<"u"&&typeof window.EventTarget<"u"&&Object.setPrototypeOf(Te.prototype,window.EventTarget.prototype);zr.defineEventAttribute=ks;zr.EventTarget=Te;zr.default=Te;Hr.exports=Te;Hr.exports.EventTarget=Hr.exports.default=Te;Hr.exports.defineEventAttribute=ks});var ar=S((Qr,Gr)=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});var Is=wu(),dt=class extends Is.EventTarget{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){let e=Ui.get(this);if(typeof e!="boolean")throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return e}};Is.defineEventAttribute(dt.prototype,"abort");function om(){let t=Object.create(dt.prototype);return Is.EventTarget.call(t),Ui.set(t,!1),t}function lm(t){Ui.get(t)===!1&&(Ui.set(t,!0),t.dispatchEvent({type:"abort"}))}var Ui=new WeakMap;Object.defineProperties(dt.prototype,{aborted:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(dt.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});var pt=class{constructor(){vu.set(this,om())}get signal(){return Su(this)}abort(){lm(Su(this))}},vu=new WeakMap;function Su(t){let e=vu.get(t);if(e==null)throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${t===null?"null":typeof t}`);return e}Object.defineProperties(pt.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}});typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(pt.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});Qr.AbortController=pt;Qr.AbortSignal=dt;Qr.default=pt;Gr.exports=pt;Gr.exports.AbortController=Gr.exports.default=pt;Gr.exports.AbortSignal=dt});var se=S((SR,Ps)=>{"use strict";var am=require("buffer"),{kResistStopPropagation:um,SymbolDispose:cm}=z(),fm=globalThis.AbortSignal||ar().AbortSignal,hm=globalThis.AbortController||ar().AbortController,dm=Object.getPrototypeOf(async function(){}).constructor,Eu=globalThis.Blob||am.Blob,pm=typeof Eu<"u"?function(e){return e instanceof Eu}:function(e){return!1},xu=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},gm=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},Cs=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
|
|
2
|
-
`;super(r),this.name="AggregateError",this.errors=e}};Ps.exports={AggregateError:Cs,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof dm},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:pm,deprecate(t,e){return t},addAbortListener:require("events").addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);xu(e,"signal"),gm(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[um]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[cm](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:fm.any||function(e){if(e.length===1)return e[0];let r=new hm,i=()=>r.abort();return e.forEach(n=>{xu(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal}};Ps.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var ae=S((vR,Au)=>{"use strict";var{format:ym,inspect:$i,AggregateError:_m}=se(),bm=globalThis.AggregateError||_m,mm=Symbol("kIsNodeError"),wm=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Sm=/^([A-Z][a-z0-9]*)+$/,vm="__node_internal_",Vi={};function Rt(t,e){if(!t)throw new Vi.ERR_INTERNAL_ASSERTION(e)}function Ou(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Em(t,e,r){if(typeof e=="function")return Rt(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return Rt(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:ym(e,...r)}function ie(t,e,r){r||(r=Error);class i extends r{constructor(...s){super(Em(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[mm]=!0,Vi[t]=i}function Tu(t){let e=vm+t.name;return Object.defineProperty(t,"name",{value:e}),t}function xm(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new bm([e,t],e.message);return r.code=e.code,r}return t||e}var Rs=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Vi.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};ie("ERR_ASSERTION","%s",Error);ie("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Rt(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],s=[],o=[];for(let a of e)Rt(typeof a=="string","All expected entries have to be of type string"),wm.includes(a)?n.push(a.toLowerCase()):Sm.test(a)?s.push(a):(Rt(a!=="object",'The value "object" should be written as "Object"'),o.push(a));if(s.length>0){let a=n.indexOf("object");a!==-1&&(n.splice(n,a,1),s.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let a=n.pop();i+=`one of type ${n.join(", ")}, or ${a}`}}(s.length>0||o.length>0)&&(i+=" or ")}if(s.length>0){switch(s.length){case 1:i+=`an instance of ${s[0]}`;break;case 2:i+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let a=s.pop();i+=`an instance of ${s.join(", ")}, or ${a}`}}o.length>0&&(i+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(i+="an "),i+=`${o[0]}`;break;case 2:i+=`one of ${o[0]} or ${o[1]}`;break;default:{let a=o.pop();i+=`one of ${o.join(", ")}, or ${a}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var u;if((u=r.constructor)!==null&&u!==void 0&&u.name)i+=`. Received an instance of ${r.constructor.name}`;else{let a=$i(r,{depth:-1});i+=`. Received ${a}`}}else{let a=$i(r,{colors:!1});a.length>25&&(a=`${a.slice(0,25)}...`),i+=`. Received type ${typeof r} (${a})`}return i},TypeError);ie("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=$i(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);ie("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);ie("ERR_MISSING_ARGS",(...t)=>{Rt(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);ie("ERR_OUT_OF_RANGE",(t,e,r)=>{Rt(e,'Missing "range" argument');let i;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Ou(String(r)):typeof r=="bigint"?(i=String(r),(r>2n**32n||r<-(2n**32n))&&(i=Ou(i)),i+="n"):i=$i(r),`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);ie("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);ie("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);ie("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);ie("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);ie("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);ie("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);ie("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);ie("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);ie("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);ie("ERR_STREAM_WRITE_AFTER_END","write after end",Error);ie("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Au.exports={AbortError:Rs,aggregateTwoErrors:Tu(xm),hideStackFrames:Tu,codes:Vi}});var cr=S((ER,ju)=>{"use strict";var{ArrayIsArray:Bs,ArrayPrototypeIncludes:Pu,ArrayPrototypeJoin:Ru,ArrayPrototypeMap:Om,NumberIsInteger:Ls,NumberIsNaN:Tm,NumberMAX_SAFE_INTEGER:Am,NumberMIN_SAFE_INTEGER:km,NumberParseInt:Im,ObjectPrototypeHasOwnProperty:Cm,RegExpPrototypeExec:Mu,String:Pm,StringPrototypeToUpperCase:Rm,StringPrototypeTrim:Mm}=z(),{hideStackFrames:_e,codes:{ERR_SOCKET_BAD_PORT:Bm,ERR_INVALID_ARG_TYPE:oe,ERR_INVALID_ARG_VALUE:ur,ERR_OUT_OF_RANGE:Mt,ERR_UNKNOWN_SIGNAL:ku}}=ae(),{normalizeEncoding:Lm}=se(),{isAsyncFunction:Nm,isArrayBufferView:jm}=se().types,Iu={};function qm(t){return t===(t|0)}function Dm(t){return t===t>>>0}var Wm=/^[0-7]+$/,Fm="must be a 32-bit unsigned integer or an octal string";function Um(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(Mu(Wm,t)===null)throw new ur(e,t,Fm);t=Im(t,8)}return Bu(t,e),t}var $m=_e((t,e,r=km,i=Am)=>{if(typeof t!="number")throw new oe(e,"number",t);if(!Ls(t))throw new Mt(e,"an integer",t);if(t<r||t>i)throw new Mt(e,`>= ${r} && <= ${i}`,t)}),Vm=_e((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new oe(e,"number",t);if(!Ls(t))throw new Mt(e,"an integer",t);if(t<r||t>i)throw new Mt(e,`>= ${r} && <= ${i}`,t)}),Bu=_e((t,e,r=!1)=>{if(typeof t!="number")throw new oe(e,"number",t);if(!Ls(t))throw new Mt(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new Mt(e,`>= ${i} && <= ${n}`,t)});function Ns(t,e){if(typeof t!="string")throw new oe(e,"string",t)}function Km(t,e,r=void 0,i){if(typeof t!="number")throw new oe(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Tm(t))throw new Mt(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var Hm=_e((t,e,r)=>{if(!Pu(r,t)){let n="must be one of: "+Ru(Om(r,s=>typeof s=="string"?`'${s}'`:Pm(s)),", ");throw new ur(e,t,n)}});function Lu(t,e){if(typeof t!="boolean")throw new oe(e,"boolean",t)}function Ms(t,e,r){return t==null||!Cm(t,e)?r:t[e]}var zm=_e((t,e,r=null)=>{let i=Ms(r,"allowArray",!1),n=Ms(r,"allowFunction",!1);if(!Ms(r,"nullable",!1)&&t===null||!i&&Bs(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new oe(e,"Object",t)}),Gm=_e((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new oe(e,"a dictionary",t)}),Ki=_e((t,e,r=0)=>{if(!Bs(t))throw new oe(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new ur(e,t,i)}});function Qm(t,e){Ki(t,e);for(let r=0;r<t.length;r++)Ns(t[r],`${e}[${r}]`)}function Jm(t,e){Ki(t,e);for(let r=0;r<t.length;r++)Lu(t[r],`${e}[${r}]`)}function Ym(t,e){Ki(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new oe(n,"AbortSignal",i);Nu(i,n)}}function Xm(t,e="signal"){if(Ns(t,e),Iu[t]===void 0)throw Iu[Rm(t)]!==void 0?new ku(t+" (signals must use all capital letters)"):new ku(t)}var Zm=_e((t,e="buffer")=>{if(!jm(t))throw new oe(e,["Buffer","TypedArray","DataView"],t)});function ew(t,e){let r=Lm(e),i=t.length;if(r==="hex"&&i%2!==0)throw new ur("encoding",e,`is invalid for data of length ${i}`)}function tw(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Mm(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Bm(e,t,r);return t|0}var Nu=_e((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new oe(e,"AbortSignal",t)}),rw=_e((t,e)=>{if(typeof t!="function")throw new oe(e,"Function",t)}),iw=_e((t,e)=>{if(typeof t!="function"||Nm(t))throw new oe(e,"Function",t)}),nw=_e((t,e)=>{if(t!==void 0)throw new oe(e,"undefined",t)});function sw(t,e,r){if(!Pu(r,t))throw new oe(e,`('${Ru(r,"|")}')`,t)}var ow=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Cu(t,e){if(typeof t>"u"||!Mu(ow,t))throw new ur(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function lw(t){if(typeof t=="string")return Cu(t,"hints"),t;if(Bs(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];Cu(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new ur("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}ju.exports={isInt32:qm,isUint32:Dm,parseFileMode:Um,validateArray:Ki,validateStringArray:Qm,validateBooleanArray:Jm,validateAbortSignalArray:Ym,validateBoolean:Lu,validateBuffer:Zm,validateDictionary:Gm,validateEncoding:ew,validateFunction:rw,validateInt32:Vm,validateInteger:$m,validateNumber:Km,validateObject:zm,validateOneOf:Hm,validatePlainFunction:iw,validatePort:tw,validateSignalName:Xm,validateString:Ns,validateUint32:Bu,validateUndefined:nw,validateUnion:sw,validateAbortSignal:Nu,validateLinkHeaderValue:lw}});var gt=S((xR,qu)=>{"use strict";qu.exports=global.process});var Le=S((OR,Zu)=>{"use strict";var{SymbolAsyncIterator:Du,SymbolIterator:Wu,SymbolFor:Bt}=z(),Fu=Bt("nodejs.stream.destroyed"),Uu=Bt("nodejs.stream.errored"),js=Bt("nodejs.stream.readable"),qs=Bt("nodejs.stream.writable"),$u=Bt("nodejs.stream.disturbed"),aw=Bt("nodejs.webstream.isClosedPromise"),uw=Bt("nodejs.webstream.controllerErrorFunction");function Hi(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function zi(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function cw(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function Be(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Vu(t){return!!(t&&!Be(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Ku(t){return!!(t&&!Be(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Hu(t){return!!(t&&!Be(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function fw(t){return Vu(t)||Ku(t)||Hu(t)}function hw(t,e){return t==null?!1:e===!0?typeof t[Du]=="function":e===!1?typeof t[Wu]=="function":typeof t[Du]=="function"||typeof t[Wu]=="function"}function Gi(t){if(!Be(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[Fu]||i!=null&&i.destroyed)}function zu(t){if(!zi(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function dw(t,e){if(!zi(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function pw(t){if(!Hi(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Gu(t,e){if(!Hi(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Qu(t){return t&&t[js]!=null?t[js]:typeof t?.readable!="boolean"?null:Gi(t)?!1:Hi(t)&&t.readable&&!Gu(t)}function Ju(t){return t&&t[qs]!=null?t[qs]:typeof t?.writable!="boolean"?null:Gi(t)?!1:zi(t)&&t.writable&&!zu(t)}function gw(t,e){return Be(t)?Gi(t)?!0:!(e?.readable!==!1&&Qu(t)||e?.writable!==!1&&Ju(t)):null}function yw(t){var e,r;return Be(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function _w(t){var e,r;return Be(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function bw(t){if(!Be(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Yu(t)?t._closed:null}function Yu(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Xu(t){return typeof t._sent100=="boolean"&&Yu(t)}function mw(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function ww(t){if(!Be(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&Xu(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function Sw(t){var e;return!!(t&&((e=t[$u])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function vw(t){var e,r,i,n,s,o,u,a,l,c;return!!(t&&((e=(r=(i=(n=(s=(o=t[Uu])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&n!==void 0?n:(u=t._readableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&i!==void 0?i:(a=t._writableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&r!==void 0?r:(l=t._readableState)===null||l===void 0?void 0:l.errored)!==null&&e!==void 0?e:!((c=t._writableState)===null||c===void 0)&&c.errored))}Zu.exports={isDestroyed:Gi,kIsDestroyed:Fu,isDisturbed:Sw,kIsDisturbed:$u,isErrored:vw,kIsErrored:Uu,isReadable:Qu,kIsReadable:js,kIsClosedPromise:aw,kControllerErrorFunction:uw,kIsWritable:qs,isClosed:bw,isDuplexNodeStream:cw,isFinished:gw,isIterable:hw,isReadableNodeStream:Hi,isReadableStream:Vu,isReadableEnded:pw,isReadableFinished:Gu,isReadableErrored:_w,isNodeStream:Be,isWebStream:fw,isWritable:Ju,isWritableNodeStream:zi,isWritableStream:Ku,isWritableEnded:zu,isWritableFinished:dw,isWritableErrored:yw,isServerRequest:mw,isServerResponse:Xu,willEmitClose:ww,isTransformStream:Hu}});var Xe=S((TR,$s)=>{"use strict";var yt=gt(),{AbortError:ac,codes:Ew}=ae(),{ERR_INVALID_ARG_TYPE:xw,ERR_STREAM_PREMATURE_CLOSE:ec}=Ew,{kEmptyObject:Ws,once:Fs}=se(),{validateAbortSignal:Ow,validateFunction:Tw,validateObject:Aw,validateBoolean:kw}=cr(),{Promise:Iw,PromisePrototypeThen:Cw,SymbolDispose:uc}=z(),{isClosed:Pw,isReadable:tc,isReadableNodeStream:Ds,isReadableStream:Rw,isReadableFinished:rc,isReadableErrored:ic,isWritable:nc,isWritableNodeStream:sc,isWritableStream:Mw,isWritableFinished:oc,isWritableErrored:lc,isNodeStream:Bw,willEmitClose:Lw,kIsClosedPromise:Nw}=Le(),fr;function jw(t){return t.setHeader&&typeof t.abort=="function"}var Us=()=>{};function cc(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Ws):e==null?e=Ws:Aw(e,"options"),Tw(r,"callback"),Ow(e.signal,"options.signal"),r=Fs(r),Rw(t)||Mw(t))return qw(t,e,r);if(!Bw(t))throw new xw("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:Ds(t),o=(n=e.writable)!==null&&n!==void 0?n:sc(t),u=t._writableState,a=t._readableState,l=()=>{t.writable||h()},c=Lw(t)&&Ds(t)===s&&sc(t)===o,f=oc(t,!1),h=()=>{f=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||s))&&(!s||p)&&r.call(t)},p=rc(t,!1),d=()=>{p=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||o))&&(!o||f)&&r.call(t)},g=E=>{r.call(t,E)},_=Pw(t),y=()=>{_=!0;let E=lc(t)||ic(t);if(E&&typeof E!="boolean")return r.call(t,E);if(s&&!p&&Ds(t,!0)&&!rc(t,!1))return r.call(t,new ec);if(o&&!f&&!oc(t,!1))return r.call(t,new ec);r.call(t)},b=()=>{_=!0;let E=lc(t)||ic(t);if(E&&typeof E!="boolean")return r.call(t,E);r.call(t)},m=()=>{t.req.on("finish",h)};jw(t)?(t.on("complete",h),c||t.on("abort",y),t.req?m():t.on("request",m)):o&&!u&&(t.on("end",l),t.on("close",l)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",y),t.on("end",d),t.on("finish",h),e.error!==!1&&t.on("error",g),t.on("close",y),_?yt.nextTick(y):u!=null&&u.errorEmitted||a!=null&&a.errorEmitted?c||yt.nextTick(b):(!s&&(!c||tc(t))&&(f||nc(t)===!1)||!o&&(!c||nc(t))&&(p||tc(t)===!1)||a&&t.req&&t.aborted)&&yt.nextTick(b);let w=()=>{r=Us,t.removeListener("aborted",y),t.removeListener("complete",h),t.removeListener("abort",y),t.removeListener("request",m),t.req&&t.req.removeListener("finish",h),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",h),t.removeListener("end",d),t.removeListener("error",g),t.removeListener("close",y)};if(e.signal&&!_){let E=()=>{let A=r;w(),A.call(t,new ac(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)yt.nextTick(E);else{fr=fr||se().addAbortListener;let A=fr(e.signal,E),T=r;r=Fs((...k)=>{A[uc](),T.apply(t,k)})}}return w}function qw(t,e,r){let i=!1,n=Us;if(e.signal)if(n=()=>{i=!0,r.call(t,new ac(void 0,{cause:e.signal.reason}))},e.signal.aborted)yt.nextTick(n);else{fr=fr||se().addAbortListener;let o=fr(e.signal,n),u=r;r=Fs((...a)=>{o[uc](),u.apply(t,a)})}let s=(...o)=>{i||yt.nextTick(()=>r.apply(t,o))};return Cw(t[Nw].promise,s,s),Us}function Dw(t,e){var r;let i=!1;return e===null&&(e=Ws),(r=e)!==null&&r!==void 0&&r.cleanup&&(kw(e.cleanup,"cleanup"),i=e.cleanup),new Iw((n,s)=>{let o=cc(t,e,u=>{i&&o(),u?s(u):n()})})}$s.exports=cc;$s.exports.finished=Dw});var Lt=S((AR,bc)=>{"use strict";var Ne=gt(),{aggregateTwoErrors:Ww,codes:{ERR_MULTIPLE_CALLBACK:Fw},AbortError:Uw}=ae(),{Symbol:dc}=z(),{kIsDestroyed:$w,isDestroyed:Vw,isFinished:Kw,isServerRequest:Hw}=Le(),pc=dc("kDestroy"),Vs=dc("kConstruct");function gc(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function zw(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(gc(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?fc(this,t,e):this.once(pc,function(s){fc(this,Ww(s,t),e)}),this)}function fc(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,u=t._writableState;gc(s,u,o),u&&(u.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?Ne.nextTick(Gw,t,s):Ne.nextTick(yc,t)}try{t._destroy(e||null,n)}catch(s){n(s)}}function Gw(t,e){Ks(t,e),yc(t)}function yc(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function Ks(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Qw(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function Hs(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?Ne.nextTick(Ks,t,e):Ks(t,e))}function Jw(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(Vs,e),!(t.listenerCount(Vs)>1)&&Ne.nextTick(Yw,t)}function Yw(t){let e=!1;function r(i){if(e){Hs(t,i??new Fw);return}e=!0;let n=t._readableState,s=t._writableState,o=s||n;n&&(n.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(pc,i):i?Hs(t,i,!0):Ne.nextTick(Xw,t)}try{t._construct(i=>{Ne.nextTick(r,i)})}catch(i){Ne.nextTick(r,i)}}function Xw(t){t.emit(Vs)}function hc(t){return t?.setHeader&&typeof t.abort=="function"}function _c(t){t.emit("close")}function Zw(t,e){t.emit("error",e),Ne.nextTick(_c,t)}function e0(t,e){!t||Vw(t)||(!e&&!Kw(t)&&(e=new Uw),Hw(t)?(t.socket=null,t.destroy(e)):hc(t)?t.abort():hc(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Ne.nextTick(Zw,t,e):Ne.nextTick(_c,t),t.destroyed||(t[$w]=!0))}bc.exports={construct:Jw,destroyer:e0,destroy:zw,undestroy:Qw,errorOrDestroy:Hs}});var Yi=S((kR,wc)=>{"use strict";var{ArrayIsArray:t0,ObjectSetPrototypeOf:mc}=z(),{EventEmitter:Qi}=require("events");function Ji(t){Qi.call(this,t)}mc(Ji.prototype,Qi.prototype);mc(Ji,Qi);Ji.prototype.pipe=function(t,e){let r=this;function i(c){t.writable&&t.write(c)===!1&&r.pause&&r.pause()}r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",o),r.on("close",u));let s=!1;function o(){s||(s=!0,t.end())}function u(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}function a(c){l(),Qi.listenerCount(this,"error")===0&&this.emit("error",c)}zs(r,"error",a),zs(t,"error",a);function l(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",o),r.removeListener("close",u),r.removeListener("error",a),t.removeListener("error",a),r.removeListener("end",l),r.removeListener("close",l),t.removeListener("close",l)}return r.on("end",l),r.on("close",l),t.on("close",l),t.emit("pipe",r),t};function zs(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):t0(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}wc.exports={Stream:Ji,prependListener:zs}});var Jr=S((IR,Xi)=>{"use strict";var{SymbolDispose:r0}=z(),{AbortError:Sc,codes:i0}=ae(),{isNodeStream:vc,isWebStream:n0,kControllerErrorFunction:s0}=Le(),o0=Xe(),{ERR_INVALID_ARG_TYPE:Ec}=i0,Gs,l0=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Ec(e,"AbortSignal",t)};Xi.exports.addAbortSignal=function(e,r){if(l0(e,"signal"),!vc(r)&&!n0(r))throw new Ec("stream",["ReadableStream","WritableStream","Stream"],r);return Xi.exports.addAbortSignalNoValidate(e,r)};Xi.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=vc(e)?()=>{e.destroy(new Sc(void 0,{cause:t.reason}))}:()=>{e[s0](new Sc(void 0,{cause:t.reason}))};if(t.aborted)r();else{Gs=Gs||se().addAbortListener;let i=Gs(t,r);o0(e,i[r0])}return e}});var Tc=S((PR,Oc)=>{"use strict";var{StringPrototypeSlice:xc,SymbolIterator:a0,TypedArrayPrototypeSet:Zi,Uint8Array:u0}=z(),{Buffer:Qs}=require("buffer"),{inspect:c0}=se();Oc.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return Qs.alloc(0);let r=Qs.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)Zi(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[a0](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",i=this.head,n=0;do{let s=i.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=xc(s,0,e),this.head=i,i.data=xc(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=Qs.allocUnsafe(e),i=e,n=this.head,s=0;do{let o=n.data;if(e>o.length)Zi(r,o,i-e),e-=o.length;else{e===o.length?(Zi(r,o,i-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(Zi(r,new u0(o.buffer,o.byteOffset,e),i-e),this.head=n,n.data=o.slice(e));break}++s}while((n=n.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return c0(this,{...r,depth:0,customInspect:!1})}}});var Yr=S((RR,Cc)=>{"use strict";var{MathFloor:f0,NumberIsInteger:h0}=z(),{validateInteger:d0}=cr(),{ERR_INVALID_ARG_VALUE:p0}=ae().codes,Ac=16*1024,kc=16;function g0(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Ic(t){return t?kc:Ac}function y0(t,e){d0(e,"value",0),t?kc=e:Ac=e}function _0(t,e,r,i){let n=g0(e,i,r);if(n!=null){if(!h0(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new p0(s,n)}return f0(n)}return Ic(t.objectMode)}Cc.exports={getHighWaterMark:_0,getDefaultHighWaterMark:Ic,setDefaultHighWaterMark:y0}});var Js=S((MR,Bc)=>{"use strict";var Pc=gt(),{PromisePrototypeThen:b0,SymbolAsyncIterator:Rc,SymbolIterator:Mc}=z(),{Buffer:m0}=require("buffer"),{ERR_INVALID_ARG_TYPE:w0,ERR_STREAM_NULL_VALUES:S0}=ae().codes;function v0(t,e,r){let i;if(typeof e=="string"||e instanceof m0)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[Rc])n=!0,i=e[Rc]();else if(e&&e[Mc])n=!1,i=e[Mc]();else throw new w0("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...r}),o=!1;s._read=function(){o||(o=!0,a())},s._destroy=function(l,c){b0(u(l),()=>Pc.nextTick(c,l),f=>Pc.nextTick(c,f||l))};async function u(l){let c=l!=null,f=typeof i.throw=="function";if(c&&f){let{value:h,done:p}=await i.throw(l);if(await h,p)return}if(typeof i.return=="function"){let{value:h}=await i.return();await h}}async function a(){for(;;){try{let{value:l,done:c}=n?await i.next():i.next();if(c)s.push(null);else{let f=l&&typeof l.then=="function"?await l:l;if(f===null)throw o=!1,new S0;if(s.push(f))continue;o=!1}}catch(l){s.destroy(l)}break}}return s}Bc.exports=v0});var Zr=S((BR,Xc)=>{"use strict";var Ae=gt(),{ArrayPrototypeIndexOf:E0,NumberIsInteger:x0,NumberIsNaN:O0,NumberParseInt:T0,ObjectDefineProperties:no,ObjectKeys:A0,ObjectSetPrototypeOf:jc,Promise:qc,SafeSet:k0,SymbolAsyncDispose:I0,SymbolAsyncIterator:C0,Symbol:P0}=z();Xc.exports=M;M.ReadableState=nn;var{EventEmitter:R0}=require("events"),{Stream:_t,prependListener:M0}=Yi(),{Buffer:Ys}=require("buffer"),{addAbortSignal:B0}=Jr(),Dc=Xe(),N=se().debuglog("stream",t=>{N=t}),L0=Tc(),pr=Lt(),{getHighWaterMark:N0,getDefaultHighWaterMark:j0}=Yr(),{aggregateTwoErrors:Lc,codes:{ERR_INVALID_ARG_TYPE:q0,ERR_METHOD_NOT_IMPLEMENTED:D0,ERR_OUT_OF_RANGE:W0,ERR_STREAM_PUSH_AFTER_EOF:F0,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:U0},AbortError:$0}=ae(),{validateObject:V0}=cr(),Nt=P0("kPaused"),{StringDecoder:Wc}=require("string_decoder"),K0=Js();jc(M.prototype,_t.prototype);jc(M,_t);var Xs=()=>{},{errorOrDestroy:hr}=pr,dr=1,H0=2,Fc=4,Xr=8,Uc=16,en=32,tn=64,$c=128,z0=256,G0=512,Q0=1024,ro=2048,io=4096,J0=8192,Y0=16384,X0=32768,Vc=65536,Z0=1<<17,eS=1<<18;function J(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}no(nn.prototype,{objectMode:J(dr),ended:J(H0),endEmitted:J(Fc),reading:J(Xr),constructed:J(Uc),sync:J(en),needReadable:J(tn),emittedReadable:J($c),readableListening:J(z0),resumeScheduled:J(G0),errorEmitted:J(Q0),emitClose:J(ro),autoDestroy:J(io),destroyed:J(J0),closed:J(Y0),closeEmitted:J(X0),multiAwaitDrain:J(Vc),readingMore:J(Z0),dataEmitted:J(eS)});function nn(t,e,r){typeof r!="boolean"&&(r=e instanceof je()),this.state=ro|io|Uc|en,t&&t.objectMode&&(this.state|=dr),r&&t&&t.readableObjectMode&&(this.state|=dr),this.highWaterMark=t?N0(this,t,"readableHighWaterMark",r):j0(!1),this.buffer=new L0,this.length=0,this.pipes=[],this.flowing=null,this[Nt]=null,t&&t.emitClose===!1&&(this.state&=~ro),t&&t.autoDestroy===!1&&(this.state&=~io),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Wc(t.encoding),this.encoding=t.encoding)}function M(t){if(!(this instanceof M))return new M(t);let e=this instanceof je();this._readableState=new nn(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&B0(t.signal,this)),_t.call(this,t),pr.construct(this,()=>{this._readableState.needReadable&&rn(this,this._readableState)})}M.prototype.destroy=pr.destroy;M.prototype._undestroy=pr.undestroy;M.prototype._destroy=function(t,e){e(t)};M.prototype[R0.captureRejectionSymbol]=function(t){this.destroy(t)};M.prototype[I0]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new $0,this.destroy(t)),new qc((e,r)=>Dc(this,i=>i&&i!==t?r(i):e(null)))};M.prototype.push=function(t,e){return Kc(this,t,e,!1)};M.prototype.unshift=function(t,e){return Kc(this,t,e,!0)};function Kc(t,e,r,i){N("readableAddChunk",e);let n=t._readableState,s;if(n.state&dr||(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=Ys.from(e,r).toString(n.encoding):(e=Ys.from(e,r),r=""))):e instanceof Ys?r="":_t._isUint8Array(e)?(e=_t._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new q0("chunk",["string","Buffer","Uint8Array"],e))),s)hr(t,s);else if(e===null)n.state&=~Xr,iS(t,n);else if(n.state&dr||e&&e.length>0)if(i)if(n.state&Fc)hr(t,new U0);else{if(n.destroyed||n.errored)return!1;Zs(t,n,e,!0)}else if(n.ended)hr(t,new F0);else{if(n.destroyed||n.errored)return!1;n.state&=~Xr,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Zs(t,n,e,!1):rn(t,n)):Zs(t,n,e,!1)}else i||(n.state&=~Xr,rn(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}function Zs(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&Vc?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.state&tn&&sn(t)),rn(t,e)}M.prototype.isPaused=function(){let t=this._readableState;return t[Nt]===!0||t.flowing===!1};M.prototype.setEncoding=function(t){let e=new Wc(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var tS=1073741824;function rS(t){if(t>tS)throw new W0("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Nc(t,e){return t<=0||e.length===0&&e.ended?0:e.state&dr?1:O0(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}M.prototype.read=function(t){N("read",t),t===void 0?t=NaN:x0(t)||(t=T0(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=rS(t)),t!==0&&(e.state&=~$c),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return N("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?eo(this):sn(this),null;if(t=Nc(t,e),t===0&&e.ended)return e.length===0&&eo(this),null;let i=(e.state&tn)!==0;if(N("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,N("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,N("reading, ended or constructing",i);else if(i){N("do read"),e.state|=Xr|en,e.length===0&&(e.state|=tn);try{this._read(e.highWaterMark)}catch(s){hr(this,s)}e.state&=~en,e.reading||(t=Nc(r,e))}let n;return t>0?n=Jc(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&eo(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function iS(t,e){if(N("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?sn(t):(e.needReadable=!1,e.emittedReadable=!0,Hc(t))}}function sn(t){let e=t._readableState;N("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(N("emitReadable",e.flowing),e.emittedReadable=!0,Ae.nextTick(Hc,t))}function Hc(t){let e=t._readableState;N("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Gc(t)}function rn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Ae.nextTick(nS,t,e))}function nS(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(N("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}M.prototype._read=function(t){throw new D0("_read()")};M.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new k0(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),N("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==Ae.stdout&&t!==Ae.stderr?u:_;i.endEmitted?Ae.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(y,b){N("onunpipe"),y===r&&b&&b.hasUnpiped===!1&&(b.hasUnpiped=!0,c())}function u(){N("onend"),t.end()}let a,l=!1;function c(){N("cleanup"),t.removeListener("close",d),t.removeListener("finish",g),a&&t.removeListener("drain",a),t.removeListener("error",p),t.removeListener("unpipe",o),r.removeListener("end",u),r.removeListener("end",_),r.removeListener("data",h),l=!0,a&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&a()}function f(){l||(i.pipes.length===1&&i.pipes[0]===t?(N("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(N("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),a||(a=sS(r,t),t.on("drain",a))}r.on("data",h);function h(y){N("ondata");let b=t.write(y);N("dest.write",b),b===!1&&f()}function p(y){if(N("onerror",y),_(),t.removeListener("error",p),t.listenerCount("error")===0){let b=t._writableState||t._readableState;b&&!b.errorEmitted?hr(t,y):t.emit("error",y)}}M0(t,"error",p);function d(){t.removeListener("finish",g),_()}t.once("close",d);function g(){N("onfinish"),t.removeListener("close",d),_()}t.once("finish",g);function _(){N("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?f():i.flowing||(N("pipe resume"),r.resume()),t};function sS(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(N("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(N("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}M.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let s=0;s<n.length;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}let i=E0(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};M.prototype.on=function(t,e){let r=_t.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,N("on readable",i.length,i.reading),i.length?sn(this):i.reading||Ae.nextTick(oS,this)),r};M.prototype.addListener=M.prototype.on;M.prototype.removeListener=function(t,e){let r=_t.prototype.removeListener.call(this,t,e);return t==="readable"&&Ae.nextTick(zc,this),r};M.prototype.off=M.prototype.removeListener;M.prototype.removeAllListeners=function(t){let e=_t.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Ae.nextTick(zc,this),e};function zc(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Nt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function oS(t){N("readable nexttick read 0"),t.read(0)}M.prototype.resume=function(){let t=this._readableState;return t.flowing||(N("resume"),t.flowing=!t.readableListening,lS(this,t)),t[Nt]=!1,this};function lS(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Ae.nextTick(aS,t,e))}function aS(t,e){N("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Gc(t),e.flowing&&!e.reading&&t.read(0)}M.prototype.pause=function(){return N("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(N("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Nt]=!0,this};function Gc(t){let e=t._readableState;for(N("flow",e.flowing);e.flowing&&t.read()!==null;);}M.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{hr(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=A0(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};M.prototype[C0]=function(){return Qc(this)};M.prototype.iterator=function(t){return t!==void 0&&V0(t,"options"),Qc(this,t)};function Qc(t,e){typeof t.read!="function"&&(t=M.wrap(t,{objectMode:!0}));let r=uS(t,e);return r.stream=t,r}async function*uS(t,e){let r=Xs;function i(o){this===t?(r(),r=Xs):r=o}t.on("readable",i);let n,s=Dc(t,{writable:!1},o=>{n=o?Lc(n,o):null,r(),r=Xs});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(n)throw n;if(n===null)return;await new qc(i)}}}catch(o){throw n=Lc(n,o),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?pr.destroyer(t,null):(t.off("readable",i),s())}}no(M.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});no(nn.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Nt]!==!1},set(t){this[Nt]=!!t}}});M._fromList=Jc;function Jc(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function eo(t){let e=t._readableState;N("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Ae.nextTick(cS,e,t))}function cS(t,e){if(N("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)Ae.nextTick(fS,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function fS(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}M.from=function(t,e){return K0(M,t,e)};var to;function Yc(){return to===void 0&&(to={}),to}M.fromWeb=function(t,e){return Yc().newStreamReadableFromReadableStream(t,e)};M.toWeb=function(t,e){return Yc().newReadableStreamFromStreamReadable(t,e)};M.wrap=function(t,e){var r,i;return new M({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,s){pr.destroyer(t,n),s(n)}}).wrap(t)}});var cn=S((LR,ff)=>{"use strict";var jt=gt(),{ArrayPrototypeSlice:tf,Error:hS,FunctionPrototypeSymbolHasInstance:rf,ObjectDefineProperty:nf,ObjectDefineProperties:dS,ObjectSetPrototypeOf:sf,StringPrototypeToLowerCase:pS,Symbol:gS,SymbolHasInstance:yS}=z();ff.exports=G;G.WritableState=ri;var{EventEmitter:_S}=require("events"),ei=Yi().Stream,{Buffer:on}=require("buffer"),un=Lt(),{addAbortSignal:bS}=Jr(),{getHighWaterMark:mS,getDefaultHighWaterMark:wS}=Yr(),{ERR_INVALID_ARG_TYPE:SS,ERR_METHOD_NOT_IMPLEMENTED:vS,ERR_MULTIPLE_CALLBACK:of,ERR_STREAM_CANNOT_PIPE:ES,ERR_STREAM_DESTROYED:ti,ERR_STREAM_ALREADY_FINISHED:xS,ERR_STREAM_NULL_VALUES:OS,ERR_STREAM_WRITE_AFTER_END:TS,ERR_UNKNOWN_ENCODING:lf}=ae().codes,{errorOrDestroy:gr}=un;sf(G.prototype,ei.prototype);sf(G,ei);function lo(){}var yr=gS("kOnFinished");function ri(t,e,r){typeof r!="boolean"&&(r=e instanceof je()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?mS(this,t,"writableHighWaterMark",r):wS(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=kS.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,an(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[yr]=[]}function an(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}ri.prototype.getBuffer=function(){return tf(this.buffered,this.bufferedIndex)};nf(ri.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function G(t){let e=this instanceof je();if(!e&&!rf(G,this))return new G(t);this._writableState=new ri(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&bS(t.signal,this)),ei.call(this,t),un.construct(this,()=>{let r=this._writableState;r.writing||uo(this,r),co(this,r)})}nf(G,yS,{__proto__:null,value:function(t){return rf(this,t)?!0:this!==G?!1:t&&t._writableState instanceof ri}});G.prototype.pipe=function(){gr(this,new ES)};function af(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!on.isEncoding(r))throw new lf(r);typeof i!="function"&&(i=lo)}if(e===null)throw new OS;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=on.from(e,r),r="buffer");else if(e instanceof on)r="buffer";else if(ei._isUint8Array(e))e=ei._uint8ArrayToBuffer(e),r="buffer";else throw new SS("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new TS:n.destroyed&&(s=new ti("write")),s?(jt.nextTick(i,s),gr(t,s,!0),s):(n.pendingcb++,AS(t,n,e,r,i))}G.prototype.write=function(t,e,r){return af(this,t,e,r)===!0};G.prototype.cork=function(){this._writableState.corked++};G.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||uo(this,t))};G.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=pS(e)),!on.isEncoding(e))throw new lf(e);return this._writableState.defaultEncoding=e,this};function AS(t,e,r,i,n){let s=e.objectMode?1:r.length;e.length+=s;let o=e.length<e.highWaterMark;return o||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==lo&&(e.allNoop=!1)):(e.writelen=s,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}function Zc(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new ti("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function ef(t,e,r,i){--e.pendingcb,i(r),ao(e),gr(t,r)}function kS(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){gr(t,new of);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?jt.nextTick(ef,t,r,e,n):ef(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&uo(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},jt.nextTick(IS,r.afterWriteTickInfo)):uf(t,r,1,n))}function IS({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,uf(t,e,r,i)}function uf(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&ao(e),co(t,e)}function ao(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:s,callback:o}=t.buffered[n],u=t.objectMode?1:s.length;t.length-=u,o((e=t.errored)!==null&&e!==void 0?e:new ti("write"))}let r=t[yr].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new ti("end"))}an(t)}function uo(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,s=r.length-i;if(!s)return;let o=i;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let u=e.allNoop?lo:l=>{for(let c=o;c<r.length;++c)r[c].callback(l)},a=e.allNoop&&o===0?r:tf(r,o);a.allBuffers=e.allBuffers,Zc(t,e,!0,e.length,a,"",u),an(e)}else{do{let{chunk:u,encoding:a,callback:l}=r[o];r[o++]=null;let c=n?1:u.length;Zc(t,e,!1,c,u,a,l)}while(o<r.length&&!e.writing);o===r.length?an(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}G.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new vS("_write()")};G.prototype._writev=null;G.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let s=af(this,t,e);s instanceof hS&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,co(this,i,!0),i.ended=!0):i.finished?n=new xS("end"):i.destroyed&&(n=new ti("end"))),typeof r=="function"&&(n||i.finished?jt.nextTick(r,n):i[yr].push(r)),this};function ln(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function CS(t,e){let r=!1;function i(n){if(r){gr(t,n??of());return}if(r=!0,e.pendingcb--,n){let s=e[yr].splice(0);for(let o=0;o<s.length;o++)s[o](n);gr(t,n,e.sync)}else ln(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,jt.nextTick(oo,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function PS(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,CS(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function co(t,e,r){ln(e)&&(PS(t,e),e.pendingcb===0&&(r?(e.pendingcb++,jt.nextTick((i,n)=>{ln(n)?oo(i,n):n.pendingcb--},t,e)):ln(e)&&(e.pendingcb++,oo(t,e))))}function oo(t,e){e.pendingcb--,e.finished=!0;let r=e[yr].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy()}}dS(G.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var RS=un.destroy;G.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[yr].length)&&jt.nextTick(ao,r),RS.call(this,t,e),this};G.prototype._undestroy=un.undestroy;G.prototype._destroy=function(t,e){e(t)};G.prototype[_S.captureRejectionSymbol]=function(t){this.destroy(t)};var so;function cf(){return so===void 0&&(so={}),so}G.fromWeb=function(t,e){return cf().newStreamWritableFromWritableStream(t,e)};G.toWeb=function(t){return cf().newWritableStreamFromStreamWritable(t)}});var Tf=S((NR,Of)=>{"use strict";var fo=gt(),MS=require("buffer"),{isReadable:BS,isWritable:LS,isIterable:hf,isNodeStream:NS,isReadableNodeStream:df,isWritableNodeStream:pf,isDuplexNodeStream:jS,isReadableStream:gf,isWritableStream:yf}=Le(),_f=Xe(),{AbortError:Ef,codes:{ERR_INVALID_ARG_TYPE:qS,ERR_INVALID_RETURN_VALUE:bf}}=ae(),{destroyer:br}=Lt(),DS=je(),xf=Zr(),WS=cn(),{createDeferredPromise:mf}=se(),wf=Js(),Sf=globalThis.Blob||MS.Blob,FS=typeof Sf<"u"?function(e){return e instanceof Sf}:function(e){return!1},US=globalThis.AbortController||ar().AbortController,{FunctionPrototypeCall:vf}=z(),bt=class extends DS{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Of.exports=function t(e,r){if(jS(e))return e;if(df(e))return _r({readable:e});if(pf(e))return _r({writable:e});if(NS(e))return _r({writable:!1,readable:!1});if(gf(e))return _r({readable:xf.fromWeb(e)});if(yf(e))return _r({writable:WS.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:u}=$S(e);if(hf(n))return wf(bt,n,{objectMode:!0,write:s,final:o,destroy:u});let a=n?.then;if(typeof a=="function"){let l,c=vf(a,n,f=>{if(f!=null)throw new bf("nully","body",f)},f=>{br(l,f)});return l=new bt({objectMode:!0,readable:!1,write:s,final(f){o(async()=>{try{await c,fo.nextTick(f,null)}catch(h){fo.nextTick(f,h)}})},destroy:u})}throw new bf("Iterable, AsyncIterable or AsyncFunction",r,n)}if(FS(e))return t(e.arrayBuffer());if(hf(e))return wf(bt,e,{objectMode:!0,writable:!1});if(gf(e?.readable)&&yf(e?.writable))return bt.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?df(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?pf(e?.writable)?e?.writable:t(e.writable):void 0;return _r({readable:n,writable:s})}let i=e?.then;if(typeof i=="function"){let n;return vf(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{br(n,s)}),n=new bt({objectMode:!0,writable:!1,read(){}})}throw new qS(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function $S(t){let{promise:e,resolve:r}=mf(),i=new US,n=i.signal;return{value:t(async function*(){for(;;){let o=e;e=null;let{chunk:u,done:a,cb:l}=await o;if(fo.nextTick(l),a)return;if(n.aborted)throw new Ef(void 0,{cause:n.reason});({promise:e,resolve:r}=mf()),yield u}}(),{signal:n}),write(o,u,a){let l=r;r=null,l({chunk:o,done:!1,cb:a})},final(o){let u=r;r=null,u({done:!0,cb:o})},destroy(o,u){i.abort(),u(o)}}}function _r(t){let e=t.readable&&typeof t.readable.read!="function"?xf.wrap(t.readable):t.readable,r=t.writable,i=!!BS(e),n=!!LS(r),s,o,u,a,l;function c(f){let h=a;a=null,h?h(f):f&&l.destroy(f)}return l=new bt({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(_f(r,f=>{n=!1,f&&br(e,f),c(f)}),l._write=function(f,h,p){r.write(f,h)?p():s=p},l._final=function(f){r.end(),o=f},r.on("drain",function(){if(s){let f=s;s=null,f()}}),r.on("finish",function(){if(o){let f=o;o=null,f()}})),i&&(_f(e,f=>{i=!1,f&&br(e,f),c(f)}),e.on("readable",function(){if(u){let f=u;u=null,f()}}),e.on("end",function(){l.push(null)}),l._read=function(){for(;;){let f=e.read();if(f===null){u=l._read;return}if(!l.push(f))return}}),l._destroy=function(f,h){!f&&a!==null&&(f=new Ef),u=null,s=null,o=null,a===null?h(f):(a=h,br(r,f),br(e,f))},l}});var je=S((jR,If)=>{"use strict";var{ObjectDefineProperties:VS,ObjectGetOwnPropertyDescriptor:Ze,ObjectKeys:KS,ObjectSetPrototypeOf:Af}=z();If.exports=ke;var go=Zr(),be=cn();Af(ke.prototype,go.prototype);Af(ke,go);{let t=KS(be.prototype);for(let e=0;e<t.length;e++){let r=t[e];ke.prototype[r]||(ke.prototype[r]=be.prototype[r])}}function ke(t){if(!(this instanceof ke))return new ke(t);go.call(this,t),be.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}VS(ke.prototype,{writable:{__proto__:null,...Ze(be.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Ze(be.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Ze(be.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Ze(be.prototype,"writableBuffer")},writableLength:{__proto__:null,...Ze(be.prototype,"writableLength")},writableFinished:{__proto__:null,...Ze(be.prototype,"writableFinished")},writableCorked:{__proto__:null,...Ze(be.prototype,"writableCorked")},writableEnded:{__proto__:null,...Ze(be.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Ze(be.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var ho;function kf(){return ho===void 0&&(ho={}),ho}ke.fromWeb=function(t,e){return kf().newStreamDuplexFromReadableWritablePair(t,e)};ke.toWeb=function(t){return kf().newReadableWritablePairFromDuplex(t)};var po;ke.from=function(t){return po||(po=Tf()),po(t,"body")}});var bo=S((qR,Pf)=>{"use strict";var{ObjectSetPrototypeOf:Cf,Symbol:HS}=z();Pf.exports=et;var{ERR_METHOD_NOT_IMPLEMENTED:zS}=ae().codes,_o=je(),{getHighWaterMark:GS}=Yr();Cf(et.prototype,_o.prototype);Cf(et,_o);var ii=HS("kCallback");function et(t){if(!(this instanceof et))return new et(t);let e=t?GS(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),_o.call(this,t),this._readableState.sync=!1,this[ii]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",QS)}function yo(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function QS(){this._final!==yo&&yo.call(this)}et.prototype._final=yo;et.prototype._transform=function(t,e,r){throw new zS("_transform()")};et.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,s=i.length;this._transform(t,e,(o,u)=>{if(o){r(o);return}u!=null&&this.push(u),n.ended||s===i.length||i.length<i.highWaterMark?r():this[ii]=r})};et.prototype._read=function(){if(this[ii]){let t=this[ii];this[ii]=null,t()}}});var wo=S((DR,Mf)=>{"use strict";var{ObjectSetPrototypeOf:Rf}=z();Mf.exports=mr;var mo=bo();Rf(mr.prototype,mo.prototype);Rf(mr,mo);function mr(t){if(!(this instanceof mr))return new mr(t);mo.call(this,t)}mr.prototype._transform=function(t,e,r){r(null,t)}});var pn=S((WR,qf)=>{"use strict";var ni=gt(),{ArrayIsArray:JS,Promise:YS,SymbolAsyncIterator:XS,SymbolDispose:ZS}=z(),dn=Xe(),{once:ev}=se(),tv=Lt(),Bf=je(),{aggregateTwoErrors:rv,codes:{ERR_INVALID_ARG_TYPE:Io,ERR_INVALID_RETURN_VALUE:So,ERR_MISSING_ARGS:iv,ERR_STREAM_DESTROYED:nv,ERR_STREAM_PREMATURE_CLOSE:sv},AbortError:ov}=ae(),{validateFunction:lv,validateAbortSignal:av}=cr(),{isIterable:qt,isReadable:vo,isReadableNodeStream:hn,isNodeStream:Lf,isTransformStream:wr,isWebStream:uv,isReadableStream:Eo,isReadableFinished:cv}=Le(),fv=globalThis.AbortController||ar().AbortController,xo,Oo,To;function Nf(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=dn(t,{readable:e,writable:r},s=>{i=!s});return{destroy:s=>{i||(i=!0,tv.destroyer(t,s||new nv("pipe")))},cleanup:n}}function hv(t){return lv(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function Ao(t){if(qt(t))return t;if(hn(t))return dv(t);throw new Io("val",["Readable","Iterable","AsyncIterable"],t)}async function*dv(t){Oo||(Oo=Zr()),yield*Oo.prototype[XS].call(t)}async function fn(t,e,r,{end:i}){let n,s=null,o=l=>{if(l&&(n=l),s){let c=s;s=null,c()}},u=()=>new YS((l,c)=>{n?c(n):s=()=>{n?c(n):l()}});e.on("drain",o);let a=dn(e,{readable:!1},o);try{e.writableNeedDrain&&await u();for await(let l of t)e.write(l)||await u();i&&(e.end(),await u()),r()}catch(l){r(n!==l?rv(n,l):l)}finally{a(),e.off("drain",o)}}async function ko(t,e,r,{end:i}){wr(e)&&(e=e.writable);let n=e.getWriter();try{for await(let s of t)await n.ready,n.write(s).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(s){try{await n.abort(s),r(s)}catch(o){r(o)}}}function pv(...t){return jf(t,ev(hv(t)))}function jf(t,e,r){if(t.length===1&&JS(t[0])&&(t=t[0]),t.length<2)throw new iv("streams");let i=new fv,n=i.signal,s=r?.signal,o=[];av(s,"options.signal");function u(){d(new ov)}To=To||se().addAbortListener;let a;s&&(a=To(s,u));let l,c,f=[],h=0;function p(m){d(m,--h===0)}function d(m,w){var E;if(m&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=m),!(!l&&!w)){for(;f.length;)f.shift()(l);(E=a)===null||E===void 0||E[ZS](),i.abort(),w&&(l||o.forEach(A=>A()),ni.nextTick(e,l,c))}}let g;for(let m=0;m<t.length;m++){let w=t[m],E=m<t.length-1,A=m>0,T=E||r?.end!==!1,k=m===t.length-1;if(Lf(w)){let O=function(R){R&&R.name!=="AbortError"&&R.code!=="ERR_STREAM_PREMATURE_CLOSE"&&p(R)};var b=O;if(T){let{destroy:R,cleanup:H}=Nf(w,E,A);f.push(R),vo(w)&&k&&o.push(H)}w.on("error",O),vo(w)&&k&&o.push(()=>{w.removeListener("error",O)})}if(m===0)if(typeof w=="function"){if(g=w({signal:n}),!qt(g))throw new So("Iterable, AsyncIterable or Stream","source",g)}else qt(w)||hn(w)||wr(w)?g=w:g=Bf.from(w);else if(typeof w=="function"){if(wr(g)){var _;g=Ao((_=g)===null||_===void 0?void 0:_.readable)}else g=Ao(g);if(g=w(g,{signal:n}),E){if(!qt(g,!0))throw new So("AsyncIterable",`transform[${m-1}]`,g)}else{var y;xo||(xo=wo());let O=new xo({objectMode:!0}),R=(y=g)===null||y===void 0?void 0:y.then;if(typeof R=="function")h++,R.call(g,V=>{c=V,V!=null&&O.write(V),T&&O.end(),ni.nextTick(p)},V=>{O.destroy(V),ni.nextTick(p,V)});else if(qt(g,!0))h++,fn(g,O,p,{end:T});else if(Eo(g)||wr(g)){let V=g.readable||g;h++,fn(V,O,p,{end:T})}else throw new So("AsyncIterable or Promise","destination",g);g=O;let{destroy:H,cleanup:W}=Nf(g,!1,!0);f.push(H),k&&o.push(W)}}else if(Lf(w)){if(hn(g)){h+=2;let O=gv(g,w,p,{end:T});vo(w)&&k&&o.push(O)}else if(wr(g)||Eo(g)){let O=g.readable||g;h++,fn(O,w,p,{end:T})}else if(qt(g))h++,fn(g,w,p,{end:T});else throw new Io("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],g);g=w}else if(uv(w)){if(hn(g))h++,ko(Ao(g),w,p,{end:T});else if(Eo(g)||qt(g))h++,ko(g,w,p,{end:T});else if(wr(g))h++,ko(g.readable,w,p,{end:T});else throw new Io("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],g);g=w}else g=Bf.from(w)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&ni.nextTick(u),g}function gv(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new sv)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;cv(t)?ni.nextTick(o):t.once("end",o)}else r();return dn(t,{readable:!0,writable:!1},o=>{let u=t._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&u&&u.ended&&!u.errored&&!u.errorEmitted?t.once("end",r).once("error",r):r(o)}),dn(e,{readable:!1,writable:!0},r)}qf.exports={pipelineImpl:jf,pipeline:pv}});var Po=S((FR,Vf)=>{"use strict";var{pipeline:yv}=pn(),gn=je(),{destroyer:_v}=Lt(),{isNodeStream:yn,isReadable:Df,isWritable:Wf,isWebStream:Co,isTransformStream:Dt,isWritableStream:Ff,isReadableStream:Uf}=Le(),{AbortError:bv,codes:{ERR_INVALID_ARG_VALUE:$f,ERR_MISSING_ARGS:mv}}=ae(),wv=Xe();Vf.exports=function(...e){if(e.length===0)throw new mv("streams");if(e.length===1)return gn.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=gn.from(e[0])),typeof e[e.length-1]=="function"){let p=e.length-1;e[p]=gn.from(e[p])}for(let p=0;p<e.length;++p)if(!(!yn(e[p])&&!Co(e[p]))){if(p<e.length-1&&!(Df(e[p])||Uf(e[p])||Dt(e[p])))throw new $f(`streams[${p}]`,r[p],"must be readable");if(p>0&&!(Wf(e[p])||Ff(e[p])||Dt(e[p])))throw new $f(`streams[${p}]`,r[p],"must be writable")}let i,n,s,o,u;function a(p){let d=o;o=null,d?d(p):p?u.destroy(p):!h&&!f&&u.destroy()}let l=e[0],c=yv(e,a),f=!!(Wf(l)||Ff(l)||Dt(l)),h=!!(Df(c)||Uf(c)||Dt(c));if(u=new gn({writableObjectMode:!!(l!=null&&l.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:f,readable:h}),f){if(yn(l))u._write=function(d,g,_){l.write(d,g)?_():i=_},u._final=function(d){l.end(),n=d},l.on("drain",function(){if(i){let d=i;i=null,d()}});else if(Co(l)){let g=(Dt(l)?l.writable:l).getWriter();u._write=async function(_,y,b){try{await g.ready,g.write(_).catch(()=>{}),b()}catch(m){b(m)}},u._final=async function(_){try{await g.ready,g.close().catch(()=>{}),n=_}catch(y){_(y)}}}let p=Dt(c)?c.readable:c;wv(p,()=>{if(n){let d=n;n=null,d()}})}if(h){if(yn(c))c.on("readable",function(){if(s){let p=s;s=null,p()}}),c.on("end",function(){u.push(null)}),u._read=function(){for(;;){let p=c.read();if(p===null){s=u._read;return}if(!u.push(p))return}};else if(Co(c)){let d=(Dt(c)?c.readable:c).getReader();u._read=async function(){for(;;)try{let{value:g,done:_}=await d.read();if(!u.push(g))return;if(_){u.push(null);return}}catch{return}}}}return u._destroy=function(p,d){!p&&o!==null&&(p=new bv),s=null,i=null,n=null,o===null?d(p):(o=d,yn(c)&&_v(c,p))},u}});var eh=S((UR,Bo)=>{"use strict";var Sv=globalThis.AbortController||ar().AbortController,{codes:{ERR_INVALID_ARG_VALUE:vv,ERR_INVALID_ARG_TYPE:si,ERR_MISSING_ARGS:Ev,ERR_OUT_OF_RANGE:xv},AbortError:qe}=ae(),{validateAbortSignal:Wt,validateInteger:Kf,validateObject:Ft}=cr(),Ov=z().Symbol("kWeak"),Tv=z().Symbol("kResistStopPropagation"),{finished:Av}=Xe(),kv=Po(),{addAbortSignalNoValidate:Iv}=Jr(),{isWritable:Cv,isNodeStream:Pv}=Le(),{deprecate:Rv}=se(),{ArrayPrototypePush:Mv,Boolean:Bv,MathFloor:Hf,Number:Lv,NumberIsNaN:Nv,Promise:zf,PromiseReject:Gf,PromiseResolve:jv,PromisePrototypeThen:Qf,Symbol:Yf}=z(),_n=Yf("kEmpty"),Jf=Yf("kEof");function qv(t,e){if(e!=null&&Ft(e,"options"),e?.signal!=null&&Wt(e.signal,"options.signal"),Pv(t)&&!Cv(t))throw new vv("stream",t,"must be writable");let r=kv(this,t);return e!=null&&e.signal&&Iv(e.signal,r),r}function bn(t,e){if(typeof t!="function")throw new si("fn",["Function","AsyncFunction"],t);e!=null&&Ft(e,"options"),e?.signal!=null&&Wt(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Hf(e.concurrency));let i=r-1;return e?.highWaterMark!=null&&(i=Hf(e.highWaterMark)),Kf(r,"options.concurrency",1),Kf(i,"options.highWaterMark",0),i+=r,async function*(){let s=se().AbortSignalAny([e?.signal].filter(Bv)),o=this,u=[],a={signal:s},l,c,f=!1,h=0;function p(){f=!0,d()}function d(){h-=1,g()}function g(){c&&!f&&h<r&&u.length<i&&(c(),c=null)}async function _(){try{for await(let y of o){if(f)return;if(s.aborted)throw new qe;try{if(y=t(y,a),y===_n)continue;y=jv(y)}catch(b){y=Gf(b)}h+=1,Qf(y,d,p),u.push(y),l&&(l(),l=null),!f&&(u.length>=i||h>=r)&&await new zf(b=>{c=b})}u.push(Jf)}catch(y){let b=Gf(y);Qf(b,d,p),u.push(b)}finally{f=!0,l&&(l(),l=null)}}_();try{for(;;){for(;u.length>0;){let y=await u[0];if(y===Jf)return;if(s.aborted)throw new qe;y!==_n&&(yield y),u.shift(),g()}await new zf(y=>{l=y})}}finally{f=!0,c&&(c(),c=null)}}.call(this)}function Dv(t=void 0){return t!=null&&Ft(t,"options"),t?.signal!=null&&Wt(t.signal,"options.signal"),async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new qe({cause:t.signal.reason});yield[r++,n]}}.call(this)}async function Xf(t,e=void 0){for await(let r of Mo.call(this,t,e))return!0;return!1}async function Wv(t,e=void 0){if(typeof t!="function")throw new si("fn",["Function","AsyncFunction"],t);return!await Xf.call(this,async(...r)=>!await t(...r),e)}async function Fv(t,e){for await(let r of Mo.call(this,t,e))return r}async function Uv(t,e){if(typeof t!="function")throw new si("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),_n}for await(let i of bn.call(this,r,e));}function Mo(t,e){if(typeof t!="function")throw new si("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:_n}return bn.call(this,r,e)}var Ro=class extends Ev{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function $v(t,e,r){var i;if(typeof t!="function")throw new si("reducer",["Function","AsyncFunction"],t);r!=null&&Ft(r,"options"),r?.signal!=null&&Wt(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let l=new qe(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await Av(this.destroy(l)),l}let s=new Sv,o=s.signal;if(r!=null&&r.signal){let l={once:!0,[Ov]:this,[Tv]:!0};r.signal.addEventListener("abort",()=>s.abort(),l)}let u=!1;try{for await(let l of this){var a;if(u=!0,r!=null&&(a=r.signal)!==null&&a!==void 0&&a.aborted)throw new qe;n?e=await t(e,l,{signal:o}):(e=l,n=!0)}if(!u&&!n)throw new Ro}finally{s.abort()}return e}async function Vv(t){t!=null&&Ft(t,"options"),t?.signal!=null&&Wt(t.signal,"options.signal");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new qe(void 0,{cause:t.signal.reason});Mv(e,i)}return e}function Kv(t,e){let r=bn.call(this,t,e);return async function*(){for await(let n of r)yield*n}.call(this)}function Zf(t){if(t=Lv(t),Nv(t))return 0;if(t<0)throw new xv("number",">= 0",t);return t}function Hv(t,e=void 0){return e!=null&&Ft(e,"options"),e?.signal!=null&&Wt(e.signal,"options.signal"),t=Zf(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new qe;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new qe;t--<=0&&(yield s)}}.call(this)}function zv(t,e=void 0){return e!=null&&Ft(e,"options"),e?.signal!=null&&Wt(e.signal,"options.signal"),t=Zf(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new qe;for await(let s of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new qe;if(t-- >0&&(yield s),t<=0)return}}.call(this)}Bo.exports.streamReturningOperators={asIndexedPairs:Rv(Dv,"readable.asIndexedPairs will be removed in a future version."),drop:Hv,filter:Mo,flatMap:Kv,map:bn,take:zv,compose:qv};Bo.exports.promiseReturningOperators={every:Wv,forEach:Uv,reduce:$v,toArray:Vv,some:Xf,find:Fv}});var Lo=S(($R,th)=>{"use strict";var{ArrayPrototypePop:Gv,Promise:Qv}=z(),{isIterable:Jv,isNodeStream:Yv,isWebStream:Xv}=Le(),{pipelineImpl:Zv}=pn(),{finished:eE}=Xe();No();function tE(...t){return new Qv((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!Yv(s)&&!Jv(s)&&!Xv(s)){let o=Gv(t);i=o.signal,n=o.end}Zv(t,(o,u)=>{o?r(o):e(u)},{signal:i,end:n})})}th.exports={finished:eE,pipeline:tE}});var No=S((VR,ch)=>{"use strict";var{Buffer:rE}=require("buffer"),{ObjectDefineProperty:tt,ObjectKeys:nh,ReflectApply:sh}=z(),{promisify:{custom:oh}}=se(),{streamReturningOperators:rh,promiseReturningOperators:ih}=eh(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:lh}}=ae(),iE=Po(),{setDefaultHighWaterMark:nE,getDefaultHighWaterMark:sE}=Yr(),{pipeline:ah}=pn(),{destroyer:oE}=Lt(),uh=Xe(),jo=Lo(),oi=Le(),$=ch.exports=Yi().Stream;$.isDestroyed=oi.isDestroyed;$.isDisturbed=oi.isDisturbed;$.isErrored=oi.isErrored;$.isReadable=oi.isReadable;$.isWritable=oi.isWritable;$.Readable=Zr();for(let t of nh(rh)){let r=function(...i){if(new.target)throw lh();return $.Readable.from(sh(e,this,i))};qo=r;let e=rh[t];tt(r,"name",{__proto__:null,value:e.name}),tt(r,"length",{__proto__:null,value:e.length}),tt($.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var qo;for(let t of nh(ih)){let r=function(...n){if(new.target)throw lh();return sh(e,this,n)};qo=r;let e=ih[t];tt(r,"name",{__proto__:null,value:e.name}),tt(r,"length",{__proto__:null,value:e.length}),tt($.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var qo;$.Writable=cn();$.Duplex=je();$.Transform=bo();$.PassThrough=wo();$.pipeline=ah;var{addAbortSignal:lE}=Jr();$.addAbortSignal=lE;$.finished=uh;$.destroy=oE;$.compose=iE;$.setDefaultHighWaterMark=nE;$.getDefaultHighWaterMark=sE;tt($,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return jo}});tt(ah,oh,{__proto__:null,enumerable:!0,get(){return jo.pipeline}});tt(uh,oh,{__proto__:null,enumerable:!0,get(){return jo.finished}});$.Stream=$;$._isUint8Array=function(e){return e instanceof Uint8Array};$._uint8ArrayToBuffer=function(e){return rE.from(e.buffer,e.byteOffset,e.byteLength)}});var mt=S((KR,L)=>{"use strict";var Y=require("stream");if(Y&&process.env.READABLE_STREAM==="disable"){let t=Y.promises;L.exports._uint8ArrayToBuffer=Y._uint8ArrayToBuffer,L.exports._isUint8Array=Y._isUint8Array,L.exports.isDisturbed=Y.isDisturbed,L.exports.isErrored=Y.isErrored,L.exports.isReadable=Y.isReadable,L.exports.Readable=Y.Readable,L.exports.Writable=Y.Writable,L.exports.Duplex=Y.Duplex,L.exports.Transform=Y.Transform,L.exports.PassThrough=Y.PassThrough,L.exports.addAbortSignal=Y.addAbortSignal,L.exports.finished=Y.finished,L.exports.destroy=Y.destroy,L.exports.pipeline=Y.pipeline,L.exports.compose=Y.compose,Object.defineProperty(Y,"promises",{configurable:!0,enumerable:!0,get(){return t}}),L.exports.Stream=Y.Stream}else{let t=No(),e=Lo(),r=t.Readable.destroy;L.exports=t.Readable,L.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,L.exports._isUint8Array=t._isUint8Array,L.exports.isDisturbed=t.isDisturbed,L.exports.isErrored=t.isErrored,L.exports.isReadable=t.isReadable,L.exports.Readable=t.Readable,L.exports.Writable=t.Writable,L.exports.Duplex=t.Duplex,L.exports.Transform=t.Transform,L.exports.PassThrough=t.PassThrough,L.exports.addAbortSignal=t.addAbortSignal,L.exports.finished=t.finished,L.exports.destroy=t.destroy,L.exports.destroy=r,L.exports.pipeline=t.pipeline,L.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get(){return e}}),L.exports.Stream=t.Stream}L.exports.default=L.exports});var fh=S((HR,Do)=>{"use strict";typeof Object.create=="function"?Do.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Do.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var hh=S((zR,Fo)=>{"use strict";try{if(Wo=require("util"),typeof Wo.inherits!="function")throw"";Fo.exports=Wo.inherits}catch{Fo.exports=fh()}var Wo});var gh=S((GR,ph)=>{"use strict";var{Buffer:Ie}=require("buffer"),dh=Symbol.for("BufferList");function F(t){if(!(this instanceof F))return new F(t);F._init.call(this,t)}F._init=function(e){Object.defineProperty(this,dh,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};F.prototype._new=function(e){return new F(e)};F.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let i=0;i<this._bufs.length;i++){let n=r+this._bufs[i].length;if(e<n||i===this._bufs.length-1)return[i,e-r];r=n}};F.prototype._reverseOffset=function(t){let e=t[0],r=t[1];for(let i=0;i<e;i++)r+=this._bufs[i].length;return r};F.prototype.get=function(e){if(e>this.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};F.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};F.prototype.copy=function(e,r,i,n){if((typeof i!="number"||i<0)&&(i=0),(typeof n!="number"||n>this.length)&&(n=this.length),i>=this.length||n<=0)return e||Ie.alloc(0);let s=!!e,o=this._offset(i),u=n-i,a=u,l=s&&r||0,c=o[1];if(i===0&&n===this.length){if(!s)return this._bufs.length===1?this._bufs[0]:Ie.concat(this._bufs,this.length);for(let f=0;f<this._bufs.length;f++)this._bufs[f].copy(e,l),l+=this._bufs[f].length;return e}if(a<=this._bufs[o[0]].length-c)return s?this._bufs[o[0]].copy(e,r,c,c+a):this._bufs[o[0]].slice(c,c+a);s||(e=Ie.allocUnsafe(u));for(let f=o[0];f<this._bufs.length;f++){let h=this._bufs[f].length-c;if(a>h)this._bufs[f].copy(e,l,c),l+=h;else{this._bufs[f].copy(e,l,c,c+a),l+=h;break}a-=h,c&&(c=0)}return e.length>l?e.slice(0,l):e};F.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let i=this._offset(e),n=this._offset(r),s=this._bufs.slice(i[0],n[0]+1);return n[1]===0?s.pop():s[s.length-1]=s[s.length-1].slice(0,n[1]),i[1]!==0&&(s[0]=s[0].slice(i[1])),this._new(s)};F.prototype.toString=function(e,r,i){return this.slice(r,i).toString(e)};F.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};F.prototype.duplicate=function(){let e=this._new();for(let r=0;r<this._bufs.length;r++)e.append(this._bufs[r]);return e};F.prototype.append=function(e){if(e==null)return this;if(e.buffer)this._appendBuffer(Ie.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let r=0;r<e.length;r++)this.append(e[r]);else if(this._isBufferList(e))for(let r=0;r<e._bufs.length;r++)this.append(e._bufs[r]);else typeof e=="number"&&(e=e.toString()),this._appendBuffer(Ie.from(e));return this};F.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length};F.prototype.indexOf=function(t,e,r){if(r===void 0&&typeof e=="string"&&(r=e,e=void 0),typeof t=="function"||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof t=="number"?t=Ie.from([t]):typeof t=="string"?t=Ie.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=Ie.from(t.buffer,t.byteOffset,t.byteLength):Ie.isBuffer(t)||(t=Ie.from(t)),e=Number(e||0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let i=this._offset(e),n=i[0],s=i[1];for(;n<this._bufs.length;n++){let o=this._bufs[n];for(;s<o.length;)if(o.length-s>=t.length){let a=o.indexOf(t,s);if(a!==-1)return this._reverseOffset([n,a]);s=o.length-t.length+1}else{let a=this._reverseOffset([n,s]);if(this._match(a,t))return a;s++}s=0}return-1};F.prototype._match=function(t,e){if(this.length-t<e.length)return!1;for(let r=0;r<e.length;r++)if(this.get(t+r)!==e[r])return!1;return!0};(function(){let t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readBigInt64BE:8,readBigInt64LE:8,readBigUInt64BE:8,readBigUInt64LE:8,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let e in t)(function(r){t[r]===null?F.prototype[r]=function(i,n){return this.slice(i,i+n)[r](0,n)}:F.prototype[r]=function(i=0){return this.slice(i,i+t[r])[r](0)}})(e)})();F.prototype._isBufferList=function(e){return e instanceof F||F.isBufferList(e)};F.isBufferList=function(e){return e!=null&&e[dh]};ph.exports=F});var yh=S((QR,mn)=>{"use strict";var Uo=mt().Duplex,aE=hh(),li=gh();function le(t){if(!(this instanceof le))return new le(t);if(typeof t=="function"){this._callback=t;let e=function(i){this._callback&&(this._callback(i),this._callback=null)}.bind(this);this.on("pipe",function(i){i.on("error",e)}),this.on("unpipe",function(i){i.removeListener("error",e)}),t=null}li._init.call(this,t),Uo.call(this)}aE(le,Uo);Object.assign(le.prototype,li.prototype);le.prototype._new=function(e){return new le(e)};le.prototype._write=function(e,r,i){this._appendBuffer(e),typeof i=="function"&&i()};le.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)};le.prototype.end=function(e){Uo.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)};le.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e)};le.prototype._isBufferList=function(e){return e instanceof le||e instanceof li||le.isBufferList(e)};le.isBufferList=li.isBufferList;mn.exports=le;mn.exports.BufferListStream=le;mn.exports.BufferList=li});var bh=S((JR,_h)=>{"use strict";var $o=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};_h.exports=$o});var Vo=S((YR,mh)=>{"use strict";var x=mh.exports,{Buffer:fe}=require("buffer");x.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"};x.requiredHeaderFlags={1:0,2:0,4:0,5:0,6:2,7:0,8:2,9:0,10:2,11:0,12:0,13:0,14:0,15:0};x.requiredHeaderFlagsErrors={};for(let t in x.requiredHeaderFlags){let e=x.requiredHeaderFlags[t];x.requiredHeaderFlagsErrors[t]="Invalid header flag bits, must be 0x"+e.toString(16)+" for "+x.types[t]+" packet"}x.codes={};for(let t in x.types){let e=x.types[t];x.codes[e]=t}x.CMD_SHIFT=4;x.CMD_MASK=240;x.DUP_MASK=8;x.QOS_MASK=3;x.QOS_SHIFT=1;x.RETAIN_MASK=1;x.VARBYTEINT_MASK=127;x.VARBYTEINT_FIN_MASK=128;x.VARBYTEINT_MAX=268435455;x.SESSIONPRESENT_MASK=1;x.SESSIONPRESENT_HEADER=fe.from([x.SESSIONPRESENT_MASK]);x.CONNACK_HEADER=fe.from([x.codes.connack<<x.CMD_SHIFT]);x.USERNAME_MASK=128;x.PASSWORD_MASK=64;x.WILL_RETAIN_MASK=32;x.WILL_QOS_MASK=24;x.WILL_QOS_SHIFT=3;x.WILL_FLAG_MASK=4;x.CLEAN_SESSION_MASK=2;x.CONNECT_HEADER=fe.from([x.codes.connect<<x.CMD_SHIFT]);x.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11};x.propertiesCodes={};for(let t in x.properties){let e=x.properties[t];x.propertiesCodes[e]=t}x.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"};function wt(t){return[0,1,2].map(e=>[0,1].map(r=>[0,1].map(i=>{let n=fe.alloc(1);return n.writeUInt8(x.codes[t]<<x.CMD_SHIFT|(r?x.DUP_MASK:0)|e<<x.QOS_SHIFT|i,0,!0),n})))}x.PUBLISH_HEADER=wt("publish");x.SUBSCRIBE_HEADER=wt("subscribe");x.SUBSCRIBE_OPTIONS_QOS_MASK=3;x.SUBSCRIBE_OPTIONS_NL_MASK=1;x.SUBSCRIBE_OPTIONS_NL_SHIFT=2;x.SUBSCRIBE_OPTIONS_RAP_MASK=1;x.SUBSCRIBE_OPTIONS_RAP_SHIFT=3;x.SUBSCRIBE_OPTIONS_RH_MASK=3;x.SUBSCRIBE_OPTIONS_RH_SHIFT=4;x.SUBSCRIBE_OPTIONS_RH=[0,16,32];x.SUBSCRIBE_OPTIONS_NL=4;x.SUBSCRIBE_OPTIONS_RAP=8;x.SUBSCRIBE_OPTIONS_QOS=[0,1,2];x.UNSUBSCRIBE_HEADER=wt("unsubscribe");x.ACKS={unsuback:wt("unsuback"),puback:wt("puback"),pubcomp:wt("pubcomp"),pubrel:wt("pubrel"),pubrec:wt("pubrec")};x.SUBACK_HEADER=fe.from([x.codes.suback<<x.CMD_SHIFT]);x.VERSION3=fe.from([3]);x.VERSION4=fe.from([4]);x.VERSION5=fe.from([5]);x.VERSION131=fe.from([131]);x.VERSION132=fe.from([132]);x.QOS=[0,1,2].map(t=>fe.from([t]));x.EMPTY={pingreq:fe.from([x.codes.pingreq<<4,0]),pingresp:fe.from([x.codes.pingresp<<4,0]),disconnect:fe.from([x.codes.disconnect<<4,0])};x.MQTT5_PUBACK_PUBREC_CODES={0:"Success",16:"No matching subscribers",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",144:"Topic Name invalid",145:"Packet identifier in use",151:"Quota exceeded",153:"Payload format invalid"};x.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"};x.MQTT5_SUBACK_CODES={0:"Granted QoS 0",1:"Granted QoS 1",2:"Granted QoS 2",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use",151:"Quota exceeded",158:"Shared Subscriptions not supported",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};x.MQTT5_UNSUBACK_CODES={0:"Success",17:"No subscription existed",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use"};x.MQTT5_DISCONNECT_CODES={0:"Normal disconnection",4:"Disconnect with Will Message",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",135:"Not authorized",137:"Server busy",139:"Server shutting down",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};x.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}});var Sh=S((XR,wh)=>{"use strict";var Sr=1e3,vr=Sr*60,Er=vr*60,Ut=Er*24,uE=Ut*7,cE=Ut*365.25;wh.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return fE(t);if(r==="number"&&isFinite(t))return e.long?dE(t):hE(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function fE(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*cE;case"weeks":case"week":case"w":return r*uE;case"days":case"day":case"d":return r*Ut;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Er;case"minutes":case"minute":case"mins":case"min":case"m":return r*vr;case"seconds":case"second":case"secs":case"sec":case"s":return r*Sr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function hE(t){var e=Math.abs(t);return e>=Ut?Math.round(t/Ut)+"d":e>=Er?Math.round(t/Er)+"h":e>=vr?Math.round(t/vr)+"m":e>=Sr?Math.round(t/Sr)+"s":t+"ms"}function dE(t){var e=Math.abs(t);return e>=Ut?wn(t,e,Ut,"day"):e>=Er?wn(t,e,Er,"hour"):e>=vr?wn(t,e,vr,"minute"):e>=Sr?wn(t,e,Sr,"second"):t+" ms"}function wn(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var Ko=S((ZR,vh)=>{"use strict";function pE(t){r.debug=r,r.default=r,r.coerce=a,r.disable=s,r.enable=n,r.enabled=o,r.humanize=Sh(),r.destroy=l,Object.keys(t).forEach(c=>{r[c]=t[c]}),r.names=[],r.skips=[],r.formatters={};function e(c){let f=0;for(let h=0;h<c.length;h++)f=(f<<5)-f+c.charCodeAt(h),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=e;function r(c){let f,h=null,p,d;function g(..._){if(!g.enabled)return;let y=g,b=Number(new Date),m=b-(f||b);y.diff=m,y.prev=f,y.curr=b,f=b,_[0]=r.coerce(_[0]),typeof _[0]!="string"&&_.unshift("%O");let w=0;_[0]=_[0].replace(/%([a-zA-Z%])/g,(A,T)=>{if(A==="%%")return"%";w++;let k=r.formatters[T];if(typeof k=="function"){let O=_[w];A=k.call(y,O),_.splice(w,1),w--}return A}),r.formatArgs.call(y,_),(y.log||r.log).apply(y,_)}return g.namespace=c,g.useColors=r.useColors(),g.color=r.selectColor(c),g.extend=i,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==r.namespaces&&(p=r.namespaces,d=r.enabled(c)),d),set:_=>{h=_}}),typeof r.init=="function"&&r.init(g),g}function i(c,f){let h=r(this.namespace+(typeof f>"u"?":":f)+c);return h.log=this.log,h}function n(c){r.save(c),r.namespaces=c,r.names=[],r.skips=[];let f,h=(typeof c=="string"?c:"").split(/[\s,]+/),p=h.length;for(f=0;f<p;f++)h[f]&&(c=h[f].replace(/\*/g,".*?"),c[0]==="-"?r.skips.push(new RegExp("^"+c.slice(1)+"$")):r.names.push(new RegExp("^"+c+"$")))}function s(){let c=[...r.names.map(u),...r.skips.map(u).map(f=>"-"+f)].join(",");return r.enable(""),c}function o(c){if(c[c.length-1]==="*")return!0;let f,h;for(f=0,h=r.skips.length;f<h;f++)if(r.skips[f].test(c))return!1;for(f=0,h=r.names.length;f<h;f++)if(r.names[f].test(c))return!0;return!1}function u(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function a(c){return c instanceof Error?c.stack||c.message:c}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}vh.exports=pE});var Eh=S((pe,Sn)=>{"use strict";pe.formatArgs=yE;pe.save=_E;pe.load=bE;pe.useColors=gE;pe.storage=mE();pe.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();pe.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function gE(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function yE(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Sn.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}pe.log=console.debug||console.log||(()=>{});function _E(t){try{t?pe.storage.setItem("debug",t):pe.storage.removeItem("debug")}catch{}}function bE(){let t;try{t=pe.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function mE(){try{return localStorage}catch{}}Sn.exports=Ko()(pe);var{formatters:wE}=Sn.exports;wE.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Oh=S((eM,xh)=>{"use strict";xh.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",i=e.indexOf(r+t),n=e.indexOf("--");return i!==-1&&(n===-1||i<n)}});var kh=S((tM,Ah)=>{"use strict";var SE=require("os"),Th=require("tty"),me=Oh(),{env:Z}=process,St;me("no-color")||me("no-colors")||me("color=false")||me("color=never")?St=0:(me("color")||me("colors")||me("color=true")||me("color=always"))&&(St=1);"FORCE_COLOR"in Z&&(Z.FORCE_COLOR==="true"?St=1:Z.FORCE_COLOR==="false"?St=0:St=Z.FORCE_COLOR.length===0?1:Math.min(parseInt(Z.FORCE_COLOR,10),3));function Ho(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function zo(t,e){if(St===0)return 0;if(me("color=16m")||me("color=full")||me("color=truecolor"))return 3;if(me("color=256"))return 2;if(t&&!e&&St===void 0)return 0;let r=St||0;if(Z.TERM==="dumb")return r;if(process.platform==="win32"){let i=SE.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in Z)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(i=>i in Z)||Z.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Z)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Z.TEAMCITY_VERSION)?1:0;if(Z.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Z){let i=parseInt((Z.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Z.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Z.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Z.TERM)||"COLORTERM"in Z?1:r}function vE(t){let e=zo(t,t&&t.isTTY);return Ho(e)}Ah.exports={supportsColor:vE,stdout:Ho(zo(!0,Th.isatty(1))),stderr:Ho(zo(!0,Th.isatty(2)))}});var Ch=S((ee,En)=>{"use strict";var EE=require("tty"),vn=require("util");ee.init=CE;ee.log=AE;ee.formatArgs=OE;ee.save=kE;ee.load=IE;ee.useColors=xE;ee.destroy=vn.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");ee.colors=[6,2,3,4,5,1];try{let t=kh();t&&(t.stderr||t).level>=2&&(ee.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}ee.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,s)=>s.toUpperCase()),i=process.env[e];return/^(yes|on|true|enabled)$/i.test(i)?i=!0:/^(no|off|false|disabled)$/i.test(i)?i=!1:i==="null"?i=null:i=Number(i),t[r]=i,t},{});function xE(){return"colors"in ee.inspectOpts?!!ee.inspectOpts.colors:EE.isatty(process.stderr.fd)}function OE(t){let{namespace:e,useColors:r}=this;if(r){let i=this.color,n="\x1B[3"+(i<8?i:"8;5;"+i),s=` ${n};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`).map(e=>e.trim()).join(" ")};Ih.O=function(t){return this.inspectOpts.colors=this.useColors,vn.inspect(t,this.inspectOpts)}});var De=S((rM,Go)=>{"use strict";typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Go.exports=Eh():Go.exports=Ch()});var Mh=S((iM,Rh)=>{"use strict";var PE=yh(),{EventEmitter:RE}=require("events"),Ph=bh(),j=Vo(),C=De()("mqtt-packet:parser"),Qo=class t extends RE{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof t?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new t().parser(e)}_resetState(){C("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new Ph,this.error=null,this._list=PE(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),C("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,C("parse: state complete. _stateCounter is now: %d",this._stateCounter),C("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return C("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0),r=e>>j.CMD_SHIFT;this.packet.cmd=j.types[r];let i=e&15,n=j.requiredHeaderFlags[r];return n!=null&&i!==n?this._emitError(new Error(j.requiredHeaderFlagsErrors[r])):(this.packet.retain=(e&j.RETAIN_MASK)!==0,this.packet.qos=e>>j.QOS_SHIFT&j.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(e&j.DUP_MASK)!==0,C("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),C("_parseLength %d",e.value),!!e}_parsePayload(){C("_parsePayload: payload %O",this._list);let e=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}e=!0}return C("_parsePayload complete result: %s",e),e}_parseConnect(){C("_parseConnect");let e,r,i,n,s={},o=this.packet,u=this._parseString();if(u===null)return this._emitError(new Error("Cannot parse protocolId"));if(u!=="MQTT"&&u!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(o.protocolId=u,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(o.protocolVersion=this._list.readUInt8(this._pos),o.protocolVersion>=128&&(o.bridgeMode=!0,o.protocolVersion=o.protocolVersion-128),o.protocolVersion!==3&&o.protocolVersion!==4&&o.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(this._list.readUInt8(this._pos)&1)return this._emitError(new Error("Connect flag bit 0 must be 0, but got 1"));s.username=this._list.readUInt8(this._pos)&j.USERNAME_MASK,s.password=this._list.readUInt8(this._pos)&j.PASSWORD_MASK,s.will=this._list.readUInt8(this._pos)&j.WILL_FLAG_MASK;let a=!!(this._list.readUInt8(this._pos)&j.WILL_RETAIN_MASK),l=(this._list.readUInt8(this._pos)&j.WILL_QOS_MASK)>>j.WILL_QOS_SHIFT;if(s.will)o.will={},o.will.retain=a,o.will.qos=l;else{if(a)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(l)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(o.clean=(this._list.readUInt8(this._pos)&j.CLEAN_SESSION_MASK)!==0,this._pos++,o.keepalive=this._parseNum(),o.keepalive===-1)return this._emitError(new Error("Packet too short"));if(o.protocolVersion===5){let f=this._parseProperties();Object.getOwnPropertyNames(f).length&&(o.properties=f)}let c=this._parseString();if(c===null)return this._emitError(new Error("Packet too short"));if(o.clientId=c,C("_parseConnect: packet.clientId: %s",o.clientId),s.will){if(o.protocolVersion===5){let f=this._parseProperties();Object.getOwnPropertyNames(f).length&&(o.will.properties=f)}if(e=this._parseString(),e===null)return this._emitError(new Error("Cannot parse will topic"));if(o.will.topic=e,C("_parseConnect: packet.will.topic: %s",o.will.topic),r=this._parseBuffer(),r===null)return this._emitError(new Error("Cannot parse will payload"));o.will.payload=r,C("_parseConnect: packet.will.paylaod: %s",o.will.payload)}if(s.username){if(n=this._parseString(),n===null)return this._emitError(new Error("Cannot parse username"));o.username=n,C("_parseConnect: packet.username: %s",o.username)}if(s.password){if(i=this._parseBuffer(),i===null)return this._emitError(new Error("Cannot parse password"));o.password=i}return this.settings=o,C("_parseConnect: complete"),o}_parseConnack(){C("_parseConnack");let e=this.packet;if(this._list.length<1)return null;let r=this._list.readUInt8(this._pos++);if(r>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(e.sessionPresent=!!(r&j.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(e.returnCode===-1||e.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(e.properties=i)}C("_parseConnack: complete")}_parsePublish(){C("_parsePublish");let e=this.packet;if(e.topic=this._parseString(),e.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}e.payload=this._list.slice(this._pos,e.length),C("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){C("_parseSubscribe");let e=this.packet,r,i,n,s,o,u,a;if(e.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let l=this._parseProperties();Object.getOwnPropertyNames(l).length&&(e.properties=l)}if(e.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos<e.length;){if(r=this._parseString(),r===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(i=this._parseByte(),this.settings.protocolVersion===5){if(i&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(i&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(n=i&j.SUBSCRIBE_OPTIONS_QOS_MASK,n>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(u=(i>>j.SUBSCRIBE_OPTIONS_NL_SHIFT&j.SUBSCRIBE_OPTIONS_NL_MASK)!==0,o=(i>>j.SUBSCRIBE_OPTIONS_RAP_SHIFT&j.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,s=i>>j.SUBSCRIBE_OPTIONS_RH_SHIFT&j.SUBSCRIBE_OPTIONS_RH_MASK,s>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));a={topic:r,qos:n},this.settings.protocolVersion===5?(a.nl=u,a.rap=o,a.rh=s):this.settings.bridgeMode&&(a.rh=0,a.rap=!0,a.nl=!0),C("_parseSubscribe: push subscription `%s` to subscription",a),e.subscriptions.push(a)}}}_parseSuback(){C("_parseSuback");let e=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos<this.packet.length;){let r=this._list.readUInt8(this._pos++);if(this.settings.protocolVersion===5){if(!j.MQTT5_SUBACK_CODES[r])return this._emitError(new Error("Invalid suback code"))}else if(r>2&&r!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(r)}}}_parseUnsubscribe(){C("_parseUnsubscribe");let e=this.packet;if(e.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos<e.length;){let r=this._parseString();if(r===null)return this._emitError(new Error("Cannot parse topic"));C("_parseUnsubscribe: push topic `%s` to unsubscriptions",r),e.unsubscriptions.push(r)}}}_parseUnsuback(){C("_parseUnsuback");let e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if((this.settings.protocolVersion===3||this.settings.protocolVersion===4)&&e.length!==2)return this._emitError(new Error("Malformed unsuback, payload length must be 2"));if(e.length<=0)return this._emitError(new Error("Malformed unsuback, no payload specified"));if(this.settings.protocolVersion===5){let r=this._parseProperties();for(Object.getOwnPropertyNames(r).length&&(e.properties=r),e.granted=[];this._pos<this.packet.length;){let i=this._list.readUInt8(this._pos++);if(!j.MQTT5_UNSUBACK_CODES[i])return this._emitError(new Error("Invalid unsuback code"));this.packet.granted.push(i)}}}_parseConfirmation(){C("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let e=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5){if(e.length>2){switch(e.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!j.MQTT5_PUBACK_PUBREC_CODES[e.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!j.MQTT5_PUBREL_PUBCOMP_CODES[e.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}C("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)}else e.reasonCode=0;if(e.length>3){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}}return!0}_parseDisconnect(){let e=this.packet;if(C("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(e.reasonCode=this._parseByte(),j.MQTT5_DISCONNECT_CODES[e.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):e.reasonCode=0;let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}return C("_parseDisconnect result: true"),!0}_parseAuth(){C("_parseAuth");let e=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(e.reasonCode=this._parseByte(),!j.MQTT5_AUTH_CODES[e.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let r=this._parseProperties();return Object.getOwnPropertyNames(r).length&&(e.properties=r),C("_parseAuth: result: true"),!0}_parseMessageId(){let e=this.packet;return e.messageId=this._parseNum(),e.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(C("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){let r=this._parseNum(),i=r+this._pos;if(r===-1||i>this._list.length||i>this.packet.length)return null;let n=this._list.toString("utf8",this._pos,i);return this._pos+=r,C("_parseString: result: %s",n),n}_parseStringPair(){return C("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let e=this._parseNum(),r=e+this._pos;if(e===-1||r>this._list.length||r>this.packet.length)return null;let i=this._list.slice(this._pos,r);return this._pos+=e,C("_parseBuffer: result: %o",i),i}_parseNum(){if(this._list.length-this._pos<2)return-1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,C("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let e=this._list.readUInt32BE(this._pos);return this._pos+=4,C("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){C("_parseVarByteNum");let r=4,i=0,n=1,s=0,o=!1,u,a=this._pos?this._pos:0;for(;i<r&&a+i<this._list.length;){if(u=this._list.readUInt8(a+i++),s+=n*(u&j.VARBYTEINT_MASK),n*=128,!(u&j.VARBYTEINT_FIN_MASK)){o=!0;break}if(this._list.length<=i)break}return!o&&i===r&&this._list.length>=i&&this._emitError(new Error("Invalid variable byte integer")),a&&(this._pos+=i),o?e?o={bytes:i,value:s}:o=s:o=!1,C("_parseVarByteNum: result: %o",o),o}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),C("_parseByte: result: %o",e),e}_parseByType(e){switch(C("_parseByType: type: %s",e),e){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){C("_parseProperties");let e=this._parseVarByteNum(),i=this._pos+e,n={};for(;this._pos<i;){let s=this._parseByte();if(!s)return this._emitError(new Error("Cannot parse property code type")),!1;let o=j.propertiesCodes[s];if(!o)return this._emitError(new Error("Unknown property")),!1;if(o==="userProperties"){n[o]||(n[o]=Object.create(null));let u=this._parseByType(j.propertiesTypes[o]);if(n[o][u.name])if(Array.isArray(n[o][u.name]))n[o][u.name].push(u.value);else{let a=n[o][u.name];n[o][u.name]=[a],n[o][u.name].push(u.value)}else n[o][u.name]=u.value;continue}n[o]?Array.isArray(n[o])?n[o].push(this._parseByType(j.propertiesTypes[o])):(n[o]=[n[o]],n[o].push(this._parseByType(j.propertiesTypes[o]))):n[o]=this._parseByType(j.propertiesTypes[o])}return n}_newPacket(){return C("_newPacket"),this.packet&&(this._list.consume(this.packet.length),C("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),C("_newPacket: new packet"),this.packet=new Ph,this._pos=0,!0}_emitError(e){C("_emitError",e),this.error=e,this.emit("error",e)}};Rh.exports=Qo});var jh=S((nM,Nh)=>{"use strict";var{Buffer:ai}=require("buffer"),ME=65536,Bh={},BE=ai.isBuffer(ai.from([1,2]).subarray(0,1));function Lh(t){let e=ai.allocUnsafe(2);return e.writeUInt8(t>>8,0),e.writeUInt8(t&255,1),e}function LE(){for(let t=0;t<ME;t++)Bh[t]=Lh(t)}function NE(t){let r=0,i=0,n=ai.allocUnsafe(4);do r=t%128|0,t=t/128|0,t>0&&(r=r|128),n.writeUInt8(r,i++);while(t>0&&i<4);return t>0&&(i=0),BE?n.subarray(0,i):n.slice(0,i)}function jE(t){let e=ai.allocUnsafe(4);return e.writeUInt32BE(t,0),e}Nh.exports={cache:Bh,generateCache:LE,generateNumber:Lh,genBufVariableByteInt:NE,generate4ByteBuffer:jE}});var qh=S((sM,Jo)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Jo.exports={nextTick:qE}:Jo.exports=process;function qE(t,e,r,i){if(typeof t!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,s,o;switch(n){case 0:case 1:return process.nextTick(t);case 2:return process.nextTick(function(){t.call(null,e)});case 3:return process.nextTick(function(){t.call(null,e,r)});case 4:return process.nextTick(function(){t.call(null,e,r,i)});default:for(s=new Array(n-1),o=0;o<s.length;)s[o++]=arguments[o];return process.nextTick(function(){t.apply(null,s)})}}});var Zo=S((oM,Hh)=>{"use strict";var P=Vo(),{Buffer:I}=require("buffer"),DE=I.allocUnsafe(0),WE=I.from([0]),ui=jh(),FE=qh().nextTick,we=De()("mqtt-packet:writeToStream"),xn=ui.cache,UE=ui.generateNumber,$E=ui.generateCache,Yo=ui.genBufVariableByteInt,VE=ui.generate4ByteBuffer,ue=Xo,On=!0;function Vh(t,e,r){switch(we("generate called"),e.cork&&(e.cork(),FE(KE,e)),On&&(On=!1,$E()),we("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return HE(t,e,r);case"connack":return zE(t,e,r);case"publish":return GE(t,e,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return QE(t,e,r);case"subscribe":return JE(t,e,r);case"suback":return YE(t,e,r);case"unsubscribe":return XE(t,e,r);case"unsuback":return ZE(t,e,r);case"pingreq":case"pingresp":return e1(t,e,r);case"disconnect":return t1(t,e,r);case"auth":return r1(t,e,r);default:return e.destroy(new Error("Unknown command")),!1}}Object.defineProperty(Vh,"cacheNumbers",{get(){return ue===Xo},set(t){t?((!xn||Object.keys(xn).length===0)&&(On=!0),ue=Xo):(On=!1,ue=i1)}});function KE(t){t.uncork()}function HE(t,e,r){let i=t||{},n=i.protocolId||"MQTT",s=i.protocolVersion||4,o=i.will,u=i.clean,a=i.keepalive||0,l=i.clientId||"",c=i.username,f=i.password,h=i.properties;u===void 0&&(u=!0);let p=0;if(!n||typeof n!="string"&&!I.isBuffer(n))return e.destroy(new Error("Invalid protocolId")),!1;if(p+=n.length+2,s!==3&&s!==4&&s!==5)return e.destroy(new Error("Invalid protocol version")),!1;if(p+=1,(typeof l=="string"||I.isBuffer(l))&&(l||s>=4)&&(l||u))p+=I.byteLength(l)+2;else{if(s<4)return e.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(u*1===0)return e.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof a!="number"||a<0||a>65535||a%1!==0)return e.destroy(new Error("Invalid keepalive")),!1;p+=2,p+=1;let d,g;if(s===5){if(d=vt(e,h),!d)return!1;p+=d.length}if(o){if(typeof o!="object")return e.destroy(new Error("Invalid will")),!1;if(!o.topic||typeof o.topic!="string")return e.destroy(new Error("Invalid will topic")),!1;if(p+=I.byteLength(o.topic)+2,p+=2,o.payload)if(o.payload.length>=0)typeof o.payload=="string"?p+=I.byteLength(o.payload):p+=o.payload.length;else return e.destroy(new Error("Invalid will payload")),!1;if(g={},s===5){if(g=vt(e,o.properties),!g)return!1;p+=g.length}}let _=!1;if(c!=null)if($h(c))_=!0,p+=I.byteLength(c)+2;else return e.destroy(new Error("Invalid username")),!1;if(f!=null){if(!_)return e.destroy(new Error("Username is required to use password")),!1;if($h(f))p+=Kh(f)+2;else return e.destroy(new Error("Invalid password")),!1}e.write(P.CONNECT_HEADER),Se(e,p),xr(e,n),i.bridgeMode&&(s+=128),e.write(s===131?P.VERSION131:s===132?P.VERSION132:s===4?P.VERSION4:s===5?P.VERSION5:P.VERSION3);let y=0;return y|=c!=null?P.USERNAME_MASK:0,y|=f!=null?P.PASSWORD_MASK:0,y|=o&&o.retain?P.WILL_RETAIN_MASK:0,y|=o&&o.qos?o.qos<<P.WILL_QOS_SHIFT:0,y|=o?P.WILL_FLAG_MASK:0,y|=u?P.CLEAN_SESSION_MASK:0,e.write(I.from([y])),ue(e,a),s===5&&d.write(),xr(e,l),o&&(s===5&&g.write(),$t(e,o.topic),xr(e,o.payload)),c!=null&&xr(e,c),f!=null&&xr(e,f),!0}function zE(t,e,r){let i=r?r.protocolVersion:4,n=t||{},s=i===5?n.reasonCode:n.returnCode,o=n.properties,u=2;if(typeof s!="number")return e.destroy(new Error("Invalid return code")),!1;let a=null;if(i===5){if(a=vt(e,o),!a)return!1;u+=a.length}return e.write(P.CONNACK_HEADER),Se(e,u),e.write(n.sessionPresent?P.SESSIONPRESENT_HEADER:WE),e.write(I.from([s])),a?.write(),!0}function GE(t,e,r){we("publish: packet: %o",t);let i=r?r.protocolVersion:4,n=t||{},s=n.qos||0,o=n.retain?P.RETAIN_MASK:0,u=n.topic,a=n.payload||DE,l=n.messageId,c=n.properties,f=0;if(typeof u=="string")f+=I.byteLength(u)+2;else if(I.isBuffer(u))f+=u.length+2;else return e.destroy(new Error("Invalid topic")),!1;if(I.isBuffer(a)?f+=a.length:f+=I.byteLength(a),s&&typeof l!="number")return e.destroy(new Error("Invalid messageId")),!1;s&&(f+=2);let h=null;if(i===5){if(h=vt(e,c),!h)return!1;f+=h.length}return e.write(P.PUBLISH_HEADER[s][n.dup?1:0][o?1:0]),Se(e,f),ue(e,Kh(u)),e.write(u),s>0&&ue(e,l),h?.write(),we("publish: payload: %o",a),e.write(a)}function QE(t,e,r){let i=r?r.protocolVersion:4,n=t||{},s=n.cmd||"puback",o=n.messageId,u=n.dup&&s==="pubrel"?P.DUP_MASK:0,a=0,l=n.reasonCode,c=n.properties,f=i===5?3:2;if(s==="pubrel"&&(a=1),typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;let h=null;if(i===5&&typeof c=="object"){if(h=ci(e,c,r,f),!h)return!1;f+=h.length}return e.write(P.ACKS[s][a][u][0]),f===3&&(f+=l!==0?1:-1),Se(e,f),ue(e,o),i===5&&f!==2&&e.write(I.from([l])),h!==null?h.write():f===4&&e.write(I.from([0])),!0}function JE(t,e,r){we("subscribe: packet: ");let i=r?r.protocolVersion:4,n=t||{},s=n.dup?P.DUP_MASK:0,o=n.messageId,u=n.subscriptions,a=n.properties,l=0;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;l+=2;let c=null;if(i===5){if(c=vt(e,a),!c)return!1;l+=c.length}if(typeof u=="object"&&u.length)for(let h=0;h<u.length;h+=1){let p=u[h].topic,d=u[h].qos;if(typeof p!="string")return e.destroy(new Error("Invalid subscriptions - invalid topic")),!1;if(typeof d!="number")return e.destroy(new Error("Invalid subscriptions - invalid qos")),!1;if(i===5){if(typeof(u[h].nl||!1)!="boolean")return e.destroy(new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(u[h].rap||!1)!="boolean")return e.destroy(new Error("Invalid subscriptions - invalid Retain as Published")),!1;let y=u[h].rh||0;if(typeof y!="number"||y>2)return e.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}l+=I.byteLength(p)+2+1}else return e.destroy(new Error("Invalid subscriptions")),!1;we("subscribe: writing to stream: %o",P.SUBSCRIBE_HEADER),e.write(P.SUBSCRIBE_HEADER[1][s?1:0][0]),Se(e,l),ue(e,o),c!==null&&c.write();let f=!0;for(let h of u){let p=h.topic,d=h.qos,g=+h.nl,_=+h.rap,y=h.rh,b;$t(e,p),b=P.SUBSCRIBE_OPTIONS_QOS[d],i===5&&(b|=g?P.SUBSCRIBE_OPTIONS_NL:0,b|=_?P.SUBSCRIBE_OPTIONS_RAP:0,b|=y?P.SUBSCRIBE_OPTIONS_RH[y]:0),f=e.write(I.from([b]))}return f}function YE(t,e,r){let i=r?r.protocolVersion:4,n=t||{},s=n.messageId,o=n.granted,u=n.properties,a=0;if(typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;if(a+=2,typeof o=="object"&&o.length)for(let c=0;c<o.length;c+=1){if(typeof o[c]!="number")return e.destroy(new Error("Invalid qos vector")),!1;a+=1}else return e.destroy(new Error("Invalid qos vector")),!1;let l=null;if(i===5){if(l=ci(e,u,r,a),!l)return!1;a+=l.length}return e.write(P.SUBACK_HEADER),Se(e,a),ue(e,s),l!==null&&l.write(),e.write(I.from(o))}function XE(t,e,r){let i=r?r.protocolVersion:4,n=t||{},s=n.messageId,o=n.dup?P.DUP_MASK:0,u=n.unsubscriptions,a=n.properties,l=0;if(typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;if(l+=2,typeof u=="object"&&u.length)for(let h=0;h<u.length;h+=1){if(typeof u[h]!="string")return e.destroy(new Error("Invalid unsubscriptions")),!1;l+=I.byteLength(u[h])+2}else return e.destroy(new Error("Invalid unsubscriptions")),!1;let c=null;if(i===5){if(c=vt(e,a),!c)return!1;l+=c.length}e.write(P.UNSUBSCRIBE_HEADER[1][o?1:0][0]),Se(e,l),ue(e,s),c!==null&&c.write();let f=!0;for(let h=0;h<u.length;h++)f=$t(e,u[h]);return f}function ZE(t,e,r){let i=r?r.protocolVersion:4,n=t||{},s=n.messageId,o=n.dup?P.DUP_MASK:0,u=n.granted,a=n.properties,l=n.cmd,c=0,f=2;if(typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;if(i===5)if(typeof u=="object"&&u.length)for(let p=0;p<u.length;p+=1){if(typeof u[p]!="number")return e.destroy(new Error("Invalid qos vector")),!1;f+=1}else return e.destroy(new Error("Invalid qos vector")),!1;let h=null;if(i===5){if(h=ci(e,a,r,f),!h)return!1;f+=h.length}return e.write(P.ACKS[l][c][o][0]),Se(e,f),ue(e,s),h!==null&&h.write(),i===5&&e.write(I.from(u)),!0}function e1(t,e,r){return e.write(P.EMPTY[t.cmd])}function t1(t,e,r){let i=r?r.protocolVersion:4,n=t||{},s=n.reasonCode,o=n.properties,u=i===5?1:0,a=null;if(i===5){if(a=ci(e,o,r,u),!a)return!1;u+=a.length}return e.write(I.from([P.codes.disconnect<<4])),Se(e,u),i===5&&e.write(I.from([s])),a!==null&&a.write(),!0}function r1(t,e,r){let i=r?r.protocolVersion:4,n=t||{},s=n.reasonCode,o=n.properties,u=i===5?1:0;i!==5&&e.destroy(new Error("Invalid mqtt version for auth packet"));let a=ci(e,o,r,u);return a?(u+=a.length,e.write(I.from([P.codes.auth<<4])),Se(e,u),e.write(I.from([s])),a!==null&&a.write(),!0):!1}var Dh={};function Se(t,e){if(e>P.VARBYTEINT_MAX)return t.destroy(new Error(`Invalid variable byte integer: ${e}`)),!1;let r=Dh[e];return r||(r=Yo(e),e<16384&&(Dh[e]=r)),we("writeVarByteInt: writing to stream: %o",r),t.write(r)}function $t(t,e){let r=I.byteLength(e);return ue(t,r),we("writeString: %s",e),t.write(e,"utf8")}function Wh(t,e,r){$t(t,e),$t(t,r)}function Xo(t,e){return we("writeNumberCached: number: %d",e),we("writeNumberCached: %o",xn[e]),t.write(xn[e])}function i1(t,e){let r=UE(e);return we("writeNumberGenerated: %o",r),t.write(r)}function n1(t,e){let r=VE(e);return we("write4ByteNumber: %o",r),t.write(r)}function xr(t,e){typeof e=="string"?$t(t,e):e?(ue(t,e.length),t.write(e)):ue(t,0)}function vt(t,e){if(typeof e!="object"||e.length!=null)return{length:1,write(){Uh(t,{},0)}};let r=0;function i(s,o){let u=P.propertiesTypes[s],a=0;switch(u){case"byte":{if(typeof o!="boolean")return t.destroy(new Error(`Invalid ${s}: ${o}`)),!1;a+=2;break}case"int8":{if(typeof o!="number"||o<0||o>255)return t.destroy(new Error(`Invalid ${s}: ${o}`)),!1;a+=2;break}case"binary":{if(o&&o===null)return t.destroy(new Error(`Invalid ${s}: ${o}`)),!1;a+=1+I.byteLength(o)+2;break}case"int16":{if(typeof o!="number"||o<0||o>65535)return t.destroy(new Error(`Invalid ${s}: ${o}`)),!1;a+=3;break}case"int32":{if(typeof o!="number"||o<0||o>4294967295)return t.destroy(new Error(`Invalid ${s}: ${o}`)),!1;a+=5;break}case"var":{if(typeof o!="number"||o<0||o>268435455)return t.destroy(new Error(`Invalid ${s}: ${o}`)),!1;a+=1+I.byteLength(Yo(o));break}case"string":{if(typeof o!="string")return t.destroy(new Error(`Invalid ${s}: ${o}`)),!1;a+=3+I.byteLength(o.toString());break}case"pair":{if(typeof o!="object")return t.destroy(new Error(`Invalid ${s}: ${o}`)),!1;a+=Object.getOwnPropertyNames(o).reduce((l,c)=>{let f=o[c];return Array.isArray(f)?l+=f.reduce((h,p)=>(h+=3+I.byteLength(c.toString())+2+I.byteLength(p.toString()),h),0):l+=3+I.byteLength(c.toString())+2+I.byteLength(o[c].toString()),l},0);break}default:return t.destroy(new Error(`Invalid property ${s}: ${o}`)),!1}return a}if(e)for(let s in e){let o=0,u=0,a=e[s];if(Array.isArray(a))for(let l=0;l<a.length;l++){if(u=i(s,a[l]),!u)return!1;o+=u}else{if(u=i(s,a),!u)return!1;o=u}if(!o)return!1;r+=o}return{length:I.byteLength(Yo(r))+r,write(){Uh(t,e,r)}}}function ci(t,e,r,i){let n=["reasonString","userProperties"],s=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0,o=vt(t,e);if(s)for(;i+o.length>s;){let u=n.shift();if(u&&e[u])delete e[u],o=vt(t,e);else return!1}return o}function Fh(t,e,r){switch(P.propertiesTypes[e]){case"byte":{t.write(I.from([P.properties[e]])),t.write(I.from([+r]));break}case"int8":{t.write(I.from([P.properties[e]])),t.write(I.from([r]));break}case"binary":{t.write(I.from([P.properties[e]])),xr(t,r);break}case"int16":{t.write(I.from([P.properties[e]])),ue(t,r);break}case"int32":{t.write(I.from([P.properties[e]])),n1(t,r);break}case"var":{t.write(I.from([P.properties[e]])),Se(t,r);break}case"string":{t.write(I.from([P.properties[e]])),$t(t,r);break}case"pair":{Object.getOwnPropertyNames(r).forEach(n=>{let s=r[n];Array.isArray(s)?s.forEach(o=>{t.write(I.from([P.properties[e]])),Wh(t,n.toString(),o.toString())}):(t.write(I.from([P.properties[e]])),Wh(t,n.toString(),s.toString()))});break}default:return t.destroy(new Error(`Invalid property ${e} value: ${r}`)),!1}}function Uh(t,e,r){Se(t,r);for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==null){let n=e[i];if(Array.isArray(n))for(let s=0;s<n.length;s++)Fh(t,i,n[s]);else Fh(t,i,n)}}function Kh(t){return t?t instanceof I?t.length:I.byteLength(t):0}function $h(t){return typeof t=="string"||t instanceof I}Hh.exports=Vh});var Qh=S((lM,Gh)=>{"use strict";var s1=Zo(),{EventEmitter:o1}=require("events"),{Buffer:zh}=require("buffer");function l1(t,e){let r=new el;return s1(t,r,e),r.concat()}var el=class extends o1{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0,r=new Array(this._array.length),i=this._array,n=0,s;for(s=0;s<i.length&&i[s]!==void 0;s++)typeof i[s]!="string"?r[s]=i[s].length:r[s]=zh.byteLength(i[s]),e+=r[s];let o=zh.allocUnsafe(e);for(s=0;s<i.length&&i[s]!==void 0;s++)typeof i[s]!="string"?(i[s].copy(o,n),n+=r[s]):(o.write(i[s],n),n+=r[s]);return o}destroy(e){e&&this.emit("error",e)}};Gh.exports=l1});var Jh=S(Tn=>{"use strict";Tn.parser=Mh().parser;Tn.generate=Qh();Tn.writeToStream=Zo()});var il=S(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});var tl=class{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let e=this.nextId++;return this.nextId===65536&&(this.nextId=1),e}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(e){return!0}deallocate(e){}clear(){}};rl.default=tl});var Xh=S((cM,Yh)=>{"use strict";Yh.exports=a1;function Or(t){return t instanceof Buffer?Buffer.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function a1(t){if(t=t||{},t.circles)return u1(t);let e=new Map;if(e.set(Date,o=>new Date(o)),e.set(Map,(o,u)=>new Map(i(Array.from(o),u))),e.set(Set,(o,u)=>new Set(i(Array.from(o),u))),t.constructorHandlers)for(let o of t.constructorHandlers)e.set(o[0],o[1]);let r=null;return t.proto?s:n;function i(o,u){let a=Object.keys(o),l=new Array(a.length);for(let c=0;c<a.length;c++){let f=a[c],h=o[f];typeof h!="object"||h===null?l[f]=h:h.constructor!==Object&&(r=e.get(h.constructor))?l[f]=r(h,u):ArrayBuffer.isView(h)?l[f]=Or(h):l[f]=u(h)}return l}function n(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return i(o,n);if(o.constructor!==Object&&(r=e.get(o.constructor)))return r(o,n);let u={};for(let a in o){if(Object.hasOwnProperty.call(o,a)===!1)continue;let l=o[a];typeof l!="object"||l===null?u[a]=l:l.constructor!==Object&&(r=e.get(l.constructor))?u[a]=r(l,n):ArrayBuffer.isView(l)?u[a]=Or(l):u[a]=n(l)}return u}function s(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return i(o,s);if(o.constructor!==Object&&(r=e.get(o.constructor)))return r(o,s);let u={};for(let a in o){let l=o[a];typeof l!="object"||l===null?u[a]=l:l.constructor!==Object&&(r=e.get(l.constructor))?u[a]=r(l,s):ArrayBuffer.isView(l)?u[a]=Or(l):u[a]=s(l)}return u}}function u1(t){let e=[],r=[],i=new Map;if(i.set(Date,a=>new Date(a)),i.set(Map,(a,l)=>new Map(s(Array.from(a),l))),i.set(Set,(a,l)=>new Set(s(Array.from(a),l))),t.constructorHandlers)for(let a of t.constructorHandlers)i.set(a[0],a[1]);let n=null;return t.proto?u:o;function s(a,l){let c=Object.keys(a),f=new Array(c.length);for(let h=0;h<c.length;h++){let p=c[h],d=a[p];if(typeof d!="object"||d===null)f[p]=d;else if(d.constructor!==Object&&(n=i.get(d.constructor)))f[p]=n(d,l);else if(ArrayBuffer.isView(d))f[p]=Or(d);else{let g=e.indexOf(d);g!==-1?f[p]=r[g]:f[p]=l(d)}}return f}function o(a){if(typeof a!="object"||a===null)return a;if(Array.isArray(a))return s(a,o);if(a.constructor!==Object&&(n=i.get(a.constructor)))return n(a,o);let l={};e.push(a),r.push(l);for(let c in a){if(Object.hasOwnProperty.call(a,c)===!1)continue;let f=a[c];if(typeof f!="object"||f===null)l[c]=f;else if(f.constructor!==Object&&(n=i.get(f.constructor)))l[c]=n(f,o);else if(ArrayBuffer.isView(f))l[c]=Or(f);else{let h=e.indexOf(f);h!==-1?l[c]=r[h]:l[c]=o(f)}}return e.pop(),r.pop(),l}function u(a){if(typeof a!="object"||a===null)return a;if(Array.isArray(a))return s(a,u);if(a.constructor!==Object&&(n=i.get(a.constructor)))return n(a,u);let l={};e.push(a),r.push(l);for(let c in a){let f=a[c];if(typeof f!="object"||f===null)l[c]=f;else if(f.constructor!==Object&&(n=i.get(f.constructor)))l[c]=n(f,u);else if(ArrayBuffer.isView(f))l[c]=Or(f);else{let h=e.indexOf(f);h!==-1?l[c]=r[h]:l[c]=u(f)}}return e.pop(),r.pop(),l}}});var ed=S((fM,Zh)=>{"use strict";Zh.exports=Xh()()});var rd=S(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.validateTopics=Tr.validateTopic=void 0;function td(t){let e=t.split("/");for(let r=0;r<e.length;r++)if(e[r]!=="+"){if(e[r]==="#")return r===e.length-1;if(e[r].indexOf("+")!==-1||e[r].indexOf("#")!==-1)return!1}return!0}Tr.validateTopic=td;function c1(t){if(t.length===0)return"empty_topic_list";for(let e=0;e<t.length;e++)if(!td(t[e]))return t[e];return null}Tr.validateTopics=c1});var ol=S(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});var f1=mt(),h1={objectMode:!0},d1={clean:!0},nl=class{constructor(e){this.options=e||{},this.options=Object.assign(Object.assign({},d1),e),this._inflights=new Map}put(e,r){return this._inflights.set(e.messageId,e),r&&r(),this}createStream(){let e=new f1.Readable(h1),r=[],i=!1,n=0;return this._inflights.forEach((s,o)=>{r.push(s)}),e._read=()=>{!i&&n<r.length?e.push(r[n++]):e.push(null)},e.destroy=s=>{if(!i)return i=!0,setTimeout(()=>{e.emit("close")},0),e},e}del(e,r){let i=this._inflights.get(e.messageId);return i?(this._inflights.delete(e.messageId),r(null,i)):r&&r(new Error("missing packet")),this}get(e,r){let i=this._inflights.get(e.messageId);return i?r(null,i):r&&r(new Error("missing packet")),this}close(e){this.options.clean&&(this._inflights=null),e&&e()}};sl.default=nl});var nd=S(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});var id=[0,16,128,131,135,144,145,151,153],p1=(t,e,r)=>{t.log("handlePublish: packet %o",e),r=typeof r<"u"?r:t.noop;let i=e.topic.toString(),n=e.payload,{qos:s}=e,{messageId:o}=e,{options:u}=t;if(t.options.protocolVersion===5){let a;if(e.properties&&(a=e.properties.topicAlias),typeof a<"u")if(i.length===0)if(a>0&&a<=65535){let l=t.topicAliasRecv.getTopicByAlias(a);if(l)i=l,t.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",i,a);else{t.log("handlePublish :: unregistered topic alias. alias: %d",a),t.emit("error",new Error("Received unregistered Topic Alias"));return}}else{t.log("handlePublish :: topic alias out of range. alias: %d",a),t.emit("error",new Error("Received Topic Alias is out of range"));return}else if(t.topicAliasRecv.put(i,a))t.log("handlePublish :: registered topic: %s - alias: %d",i,a);else{t.log("handlePublish :: topic alias out of range. alias: %d",a),t.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(t.log("handlePublish: qos %d",s),s){case 2:{u.customHandleAcks(i,n,e,(a,l)=>{if(typeof a=="number"&&(l=a,a=null),a)return t.emit("error",a);if(id.indexOf(l)===-1)return t.emit("error",new Error("Wrong reason code for pubrec"));l?t._sendPacket({cmd:"pubrec",messageId:o,reasonCode:l},r):t.incomingStore.put(e,()=>{t._sendPacket({cmd:"pubrec",messageId:o},r)})});break}case 1:{u.customHandleAcks(i,n,e,(a,l)=>{if(typeof a=="number"&&(l=a,a=null),a)return t.emit("error",a);if(id.indexOf(l)===-1)return t.emit("error",new Error("Wrong reason code for puback"));l||t.emit("message",i,n,e),t.handleMessage(e,c=>{if(c)return r&&r(c);t._sendPacket({cmd:"puback",messageId:o,reasonCode:l},r)})});break}case 0:t.emit("message",i,n,e),t.handleMessage(e,r);break;default:t.log("handlePublish: unknown QoS. Doing nothing.");break}};ll.default=p1});var sd=S((gM,g1)=>{g1.exports={name:"mqtt",description:"A library for the MQTT protocol",version:"5.10.1",contributors:["Adam Rudd <adamvrr@gmail.com>","Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)","Siarhei Buntsevich <scarry0506@gmail.com> (https://github.com/scarry1992)","Yoseph Maguire <yomaguir@microsoft.com> (https://github.com/YoDaMa)","Daniel Lando <daniel.sorridi@gmail.com> (https://github.com/robertsLando)"],keywords:["mqtt","publish/subscribe","publish","subscribe"],license:"MIT",repository:{type:"git",url:"git://github.com/mqttjs/MQTT.js.git"},main:"./build/index.js",module:"./dist/mqtt.esm.js",bin:{mqtt_pub:"./build/bin/pub.js",mqtt_sub:"./build/bin/sub.js",mqtt:"./build/bin/mqtt.js"},files:["dist/","CONTRIBUTING.md","LICENSE.md","help/","build/","src/"],exports:{".":{browser:{import:"./dist/mqtt.esm.js",default:"./dist/mqtt.min.js"},default:"./build/index.js"},"./package.json":"./package.json","./*.map":"./build/*.js.map","./dist/*":"./dist/*.js","./*":"./build/*.js"},types:"build/index.d.ts",typesVersions:{"*":{"*":["./build/index.d.ts"]}},scripts:{lint:"eslint --ext .ts .","lint-fix":"eslint --fix --ext .ts .","build:ts":"rimraf build/ && tsc -p tsconfig.build.json","build:browser":"node esbuild.js",build:"npm run build:ts && npm run build:browser",prepare:"npm run build","unit-test:node":"node_modules/.bin/nyc node -r esbuild-register test/runTests.ts","unit-test:browser":"wtr","test:node":"npm run unit-test:node && codecov","test:browser":"npm run build && npm run unit-test:browser",test:"npm run test:node",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md","changelog-init":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0",release:"read -p 'GITHUB_TOKEN: ' GITHUB_TOKEN && export GITHUB_TOKEN=$GITHUB_TOKEN && release-it"},"release-it":{github:{release:!0},git:{tagName:"v${version}",commitMessage:"chore(release): ${version}"},hooks:{"before:init":["npm run test"]},npm:{publish:!0},plugins:{"@release-it/conventional-changelog":{preset:"angular",infile:"CHANGELOG.md"}}},"pre-commit":["lint"],engines:{node:">=16.0.0"},browser:{"./mqtt.js":"./dist/mqtt.js",fs:!1,tls:!1,net:!1},dependencies:{"@types/readable-stream":"^4.0.5","@types/ws":"^8.5.9",commist:"^3.2.0","concat-stream":"^2.0.0",debug:"^4.3.4","help-me":"^5.0.0","lru-cache":"^10.0.1",minimist:"^1.2.8","mqtt-packet":"^9.0.0","number-allocator":"^1.0.14","readable-stream":"^4.4.2",reinterval:"^1.1.0",rfdc:"^1.3.0",split2:"^4.2.0","worker-timers":"^7.1.4",ws:"^8.17.1"},devDependencies:{"@esm-bundle/chai":"^4.3.4-fix.0","@release-it/conventional-changelog":"^7.0.2","@types/chai":"^4.3.10","@types/node":"^20.9.0","@types/sinon":"^17.0.1","@types/tape":"^5.6.4","@typescript-eslint/eslint-plugin":"^6.10.0","@typescript-eslint/parser":"^6.10.0","@web/test-runner":"^0.18.0","@web/test-runner-playwright":"^0.11.0","aedes-cli":"^0.8.0",chai:"^4.3.10",chokidar:"^3.5.3",codecov:"^3.8.2","conventional-changelog-cli":"^4.1.0","end-of-stream":"^1.4.4",esbuild:"^0.19.5","esbuild-plugin-polyfill-node":"^0.3.0","esbuild-register":"^3.5.0",eslint:"^8.53.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-airbnb-typescript":"^17.1.0","eslint-config-prettier":"^9.0.0","eslint-plugin-import":"^2.29.0","eslint-plugin-prettier":"^5.0.1",global:"^4.4.0","leaked-handles":"^5.2.0",mkdirp:"^3.0.1","mqtt-connection":"^4.1.0","mqtt-level-store":"^3.1.0",nyc:"^15.1.0","pre-commit":"^1.2.2",prettier:"^3.0.3","release-it":"^16.2.1",rimraf:"^5.0.5",should:"^13.2.3",sinon:"^17.0.1",snazzy:"^9.0.0",tape:"^5.7.2","ts-node":"^10.9.1",typescript:"^5.2.2"}}});var Vt=S(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.MQTTJS_VERSION=We.nextTick=We.applyMixin=We.ErrorWithReasonCode=void 0;var al=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}};We.ErrorWithReasonCode=al;function y1(t,e,r=!1){var i;let n=[e];for(;;){let s=n[0],o=Object.getPrototypeOf(s);if(o?.prototype)n.unshift(o);else break}for(let s of n)for(let o of Object.getOwnPropertyNames(s.prototype))(r||o!=="constructor")&&Object.defineProperty(t.prototype,o,(i=Object.getOwnPropertyDescriptor(s.prototype,o))!==null&&i!==void 0?i:Object.create(null))}We.applyMixin=y1;We.nextTick=typeof(process==null?void 0:process.nextTick)=="function"?process.nextTick:t=>{setTimeout(t,0)};We.MQTTJS_VERSION=sd().version});var fi=S(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.ReasonCodes=void 0;var od=Vt();Et.ReasonCodes={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};var _1=(t,e)=>{let{messageId:r}=e,i=e.cmd,n=null,s=t.outgoing[r]?t.outgoing[r].cb:null,o=null;if(!s){t.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(t.log("_handleAck :: packet type",i),i){case"pubcomp":case"puback":{let u=e.reasonCode;u&&u>0&&u!==16?(o=new od.ErrorWithReasonCode(`Publish error: ${Et.ReasonCodes[u]}`,u),t._removeOutgoingAndStoreMessage(r,()=>{s(o,e)})):t._removeOutgoingAndStoreMessage(r,s);break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:r};let u=e.reasonCode;u&&u>0&&u!==16?(o=new od.ErrorWithReasonCode(`Publish error: ${Et.ReasonCodes[u]}`,u),t._removeOutgoingAndStoreMessage(r,()=>{s(o,e)})):t._sendPacket(n);break}case"suback":{delete t.outgoing[r],t.messageIdProvider.deallocate(r);let u=e.granted;for(let a=0;a<u.length;a++){let l=u[a];if(l&128){o=new Error(`Subscribe error: ${Et.ReasonCodes[l]}`),o.code=l;let c=t.messageIdToTopic[r];c&&c.forEach(f=>{delete t._resubscribeTopics[f]})}}delete t.messageIdToTopic[r],t._invokeStoreProcessingQueue(),s(o,e);break}case"unsuback":{delete t.outgoing[r],t.messageIdProvider.deallocate(r),t._invokeStoreProcessingQueue(),s(null,e);break}default:t.emit("error",new Error("unrecognized packet type"))}t.disconnecting&&Object.keys(t.outgoing).length===0&&t.emit("outgoingEmpty")};Et.default=_1});var ad=S(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});var ld=Vt(),b1=fi(),m1=(t,e)=>{let{options:r}=t,i=r.protocolVersion,n=i===5?e.reasonCode:e.returnCode;if(i!==5){let s=new ld.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${i}`,n);t.emit("error",s);return}t.handleAuth(e,(s,o)=>{if(s){t.emit("error",s);return}if(n===24)t.reconnecting=!1,t._sendPacket(o);else{let u=new ld.ErrorWithReasonCode(`Connection refused: ${b1.ReasonCodes[n]}`,n);t.emit("error",u)}})};ul.default=m1});var dd=S(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.LRUCache=void 0;var Ar=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,cd=new Set,cl=typeof process=="object"&&process?process:{},fd=(t,e,r,i)=>{typeof cl.emitWarning=="function"?cl.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`)},An=globalThis.AbortController,ud=globalThis.AbortSignal;if(typeof An>"u"){ud=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,n){this._onabort.push(n)}},An=class{constructor(){e()}signal=new ud;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let n of this.signal._onabort)n(i);this.signal.onabort?.(i)}}};let t=cl.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,fd("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var w1=t=>!cd.has(t),SM=Symbol("type"),xt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),hd=t=>xt(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?kr:null:null,kr=class extends Array{constructor(e){super(e),this.fill(0)}},fl=class t{heap;length;static#a=!1;static create(e){let r=hd(e);if(!r)return[];t.#a=!0;let i=new t(e,r);return t.#a=!1,i}constructor(e,r){if(!t.#a)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},hl=class t{#a;#f;#g;#y;#C;#P;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#_;#i;#r;#e;#u;#h;#l;#s;#b;#o;#m;#w;#d;#S;#T;#c;static unsafeExposeInternals(e){return{starts:e.#w,ttls:e.#d,sizes:e.#m,keyMap:e.#i,keyList:e.#r,valList:e.#e,next:e.#u,prev:e.#h,get head(){return e.#l},get tail(){return e.#s},free:e.#b,isBackgroundFetch:r=>e.#t(r),backgroundFetch:(r,i,n,s)=>e.#B(r,i,n,s),moveToTail:r=>e.#I(r),indexes:r=>e.#v(r),rindexes:r=>e.#E(r),isStale:r=>e.#p(r)}}get max(){return this.#a}get maxSize(){return this.#f}get calculatedSize(){return this.#_}get size(){return this.#n}get fetchMethod(){return this.#C}get memoMethod(){return this.#P}get dispose(){return this.#g}get disposeAfter(){return this.#y}constructor(e){let{max:r=0,ttl:i,ttlResolution:n=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:u,allowStale:a,dispose:l,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:h,maxSize:p=0,maxEntrySize:d=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:m,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:E,ignoreFetchAbort:A}=e;if(r!==0&&!xt(r))throw new TypeError("max option must be a nonnegative integer");let T=r?hd(r):Array;if(!T)throw new Error("invalid max value: "+r);if(this.#a=r,this.#f=p,this.maxEntrySize=d||this.#f,this.sizeCalculation=g,this.sizeCalculation){if(!this.#f&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#P=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#C=_,this.#T=!!_,this.#i=new Map,this.#r=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#u=new T(r),this.#h=new T(r),this.#l=0,this.#s=0,this.#b=fl.create(r),this.#n=0,this.#_=0,typeof l=="function"&&(this.#g=l),typeof c=="function"?(this.#y=c,this.#o=[]):(this.#y=void 0,this.#o=void 0),this.#S=!!this.#g,this.#c=!!this.#y,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!h,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!E,this.ignoreFetchAbort=!!A,this.maxEntrySize!==0){if(this.#f!==0&&!xt(this.#f))throw new TypeError("maxSize must be a positive integer if specified");if(!xt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#F()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!m,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!u,this.ttlResolution=xt(n)||n===0?n:1,this.ttlAutopurge=!!s,this.ttl=i||0,this.ttl){if(!xt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#L()}if(this.#a===0&&this.ttl===0&&this.#f===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#a&&!this.#f){let k="LRU_CACHE_UNBOUNDED";w1(k)&&(cd.add(k),fd("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",k,t))}}getRemainingTTL(e){return this.#i.has(e)?1/0:0}#L(){let e=new kr(this.#a),r=new kr(this.#a);this.#d=e,this.#w=r,this.#N=(s,o,u=Ar.now())=>{if(r[s]=o!==0?u:0,e[s]=o,o!==0&&this.ttlAutopurge){let a=setTimeout(()=>{this.#p(s)&&this.#x(this.#r[s],"expire")},o+1);a.unref&&a.unref()}},this.#A=s=>{r[s]=e[s]!==0?Ar.now():0},this.#O=(s,o)=>{if(e[o]){let u=e[o],a=r[o];if(!u||!a)return;s.ttl=u,s.start=a,s.now=i||n();let l=s.now-a;s.remainingTTL=u-l}};let i=0,n=()=>{let s=Ar.now();if(this.ttlResolution>0){i=s;let o=setTimeout(()=>i=0,this.ttlResolution);o.unref&&o.unref()}return s};this.getRemainingTTL=s=>{let o=this.#i.get(s);if(o===void 0)return 0;let u=e[o],a=r[o];if(!u||!a)return 1/0;let l=(i||n())-a;return u-l},this.#p=s=>{let o=r[s],u=e[s];return!!u&&!!o&&(i||n())-o>u}}#A=()=>{};#O=()=>{};#N=()=>{};#p=()=>!1;#F(){let e=new kr(this.#a);this.#_=0,this.#m=e,this.#k=r=>{this.#_-=e[r],e[r]=0},this.#j=(r,i,n,s)=>{if(this.#t(i))return 0;if(!xt(n))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(n=s(i,r),!xt(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#R=(r,i,n)=>{if(e[r]=i,this.#f){let s=this.#f-e[r];for(;this.#_>s;)this.#M(!0)}this.#_+=e[r],n&&(n.entrySize=i,n.totalCalculatedSize=this.#_)}}#k=e=>{};#R=(e,r,i)=>{};#j=(e,r,i,n)=>{if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#v({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#s;!(!this.#q(r)||((e||!this.#p(r))&&(yield r),r===this.#l));)r=this.#h[r]}*#E({allowStale:e=this.allowStale}={}){if(this.#n)for(let r=this.#l;!(!this.#q(r)||((e||!this.#p(r))&&(yield r),r===this.#s));)r=this.#u[r]}#q(e){return e!==void 0&&this.#i.get(this.#r[e])===e}*entries(){for(let e of this.#v())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#E())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#v()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*rkeys(){for(let e of this.#E()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*values(){for(let e of this.#v())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#E())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let i of this.#v()){let n=this.#e[i],s=this.#t(n)?n.__staleWhileFetching:n;if(s!==void 0&&e(s,this.#r[i],this))return this.get(this.#r[i],r)}}forEach(e,r=this){for(let i of this.#v()){let n=this.#e[i],s=this.#t(n)?n.__staleWhileFetching:n;s!==void 0&&e.call(r,s,this.#r[i],this)}}rforEach(e,r=this){for(let i of this.#E()){let n=this.#e[i],s=this.#t(n)?n.__staleWhileFetching:n;s!==void 0&&e.call(r,s,this.#r[i],this)}}purgeStale(){let e=!1;for(let r of this.#E({allowStale:!0}))this.#p(r)&&(this.#x(this.#r[r],"expire"),e=!0);return e}info(e){let r=this.#i.get(e);if(r===void 0)return;let i=this.#e[r],n=this.#t(i)?i.__staleWhileFetching:i;if(n===void 0)return;let s={value:n};if(this.#d&&this.#w){let o=this.#d[r],u=this.#w[r];if(o&&u){let a=o-(Ar.now()-u);s.ttl=a,s.start=Date.now()}}return this.#m&&(s.size=this.#m[r]),s}dump(){let e=[];for(let r of this.#v({allowStale:!0})){let i=this.#r[r],n=this.#e[r],s=this.#t(n)?n.__staleWhileFetching:n;if(s===void 0||i===void 0)continue;let o={value:s};if(this.#d&&this.#w){o.ttl=this.#d[r];let u=Ar.now()-this.#w[r];o.start=Math.floor(Date.now()-u)}this.#m&&(o.size=this.#m[r]),e.unshift([i,o])}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let n=Date.now()-i.start;i.start=Ar.now()-n}this.set(r,i.value,i)}}set(e,r,i={}){if(r===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:u=this.sizeCalculation,status:a}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,c=this.#j(e,r,i.size||0,u);if(this.maxEntrySize&&c>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#x(e,"set"),this;let f=this.#n===0?void 0:this.#i.get(e);if(f===void 0)f=this.#n===0?this.#s:this.#b.length!==0?this.#b.pop():this.#n===this.#a?this.#M(!1):this.#n,this.#r[f]=e,this.#e[f]=r,this.#i.set(e,f),this.#u[this.#s]=f,this.#h[f]=this.#s,this.#s=f,this.#n++,this.#R(f,c,a),a&&(a.set="add"),l=!1;else{this.#I(f);let h=this.#e[f];if(r!==h){if(this.#T&&this.#t(h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=h;p!==void 0&&!o&&(this.#S&&this.#g?.(p,e,"set"),this.#c&&this.#o?.push([p,e,"set"]))}else o||(this.#S&&this.#g?.(h,e,"set"),this.#c&&this.#o?.push([h,e,"set"]));if(this.#k(f),this.#R(f,c,a),this.#e[f]=r,a){a.set="replace";let p=h&&this.#t(h)?h.__staleWhileFetching:h;p!==void 0&&(a.oldValue=p)}}else a&&(a.set="update")}if(n!==0&&!this.#d&&this.#L(),this.#d&&(l||this.#N(f,n,s),a&&this.#O(a,f)),!o&&this.#c&&this.#o){let h=this.#o,p;for(;p=h?.shift();)this.#y?.(...p)}return this}pop(){try{for(;this.#n;){let e=this.#e[this.#l];if(this.#M(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#c&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#y?.(...r)}}}#M(e){let r=this.#l,i=this.#r[r],n=this.#e[r];return this.#T&&this.#t(n)?n.__abortController.abort(new Error("evicted")):(this.#S||this.#c)&&(this.#S&&this.#g?.(n,i,"evict"),this.#c&&this.#o?.push([n,i,"evict"])),this.#k(r),e&&(this.#r[r]=void 0,this.#e[r]=void 0,this.#b.push(r)),this.#n===1?(this.#l=this.#s=0,this.#b.length=0):this.#l=this.#u[r],this.#i.delete(i),this.#n--,r}has(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=r,s=this.#i.get(e);if(s!==void 0){let o=this.#e[s];if(this.#t(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#p(s))n&&(n.has="stale",this.#O(n,s));else return i&&this.#A(s),n&&(n.has="hit",this.#O(n,s)),!0}else n&&(n.has="miss");return!1}peek(e,r={}){let{allowStale:i=this.allowStale}=r,n=this.#i.get(e);if(n===void 0||!i&&this.#p(n))return;let s=this.#e[n];return this.#t(s)?s.__staleWhileFetching:s}#B(e,r,i,n){let s=r===void 0?void 0:this.#e[r];if(this.#t(s))return s;let o=new An,{signal:u}=i;u?.addEventListener("abort",()=>o.abort(u.reason),{signal:o.signal});let a={signal:o.signal,options:i,context:n},l=(g,_=!1)=>{let{aborted:y}=o.signal,b=i.ignoreFetchAbort&&g!==void 0;if(i.status&&(y&&!_?(i.status.fetchAborted=!0,i.status.fetchError=o.signal.reason,b&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),y&&!b&&!_)return f(o.signal.reason);let m=p;return this.#e[r]===p&&(g===void 0?m.__staleWhileFetching?this.#e[r]=m.__staleWhileFetching:this.#x(e,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.set(e,g,a.options))),g},c=g=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=g),f(g)),f=g=>{let{aborted:_}=o.signal,y=_&&i.allowStaleOnFetchAbort,b=y||i.allowStaleOnFetchRejection,m=b||i.noDeleteOnFetchRejection,w=p;if(this.#e[r]===p&&(!m||w.__staleWhileFetching===void 0?this.#x(e,"fetch"):y||(this.#e[r]=w.__staleWhileFetching)),b)return i.status&&w.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),w.__staleWhileFetching;if(w.__returned===w)throw g},h=(g,_)=>{let y=this.#C?.(e,s,a);y&&y instanceof Promise&&y.then(b=>g(b===void 0?void 0:b),_),o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(g(void 0),i.allowStaleOnFetchAbort&&(g=b=>l(b,!0)))})};i.status&&(i.status.fetchDispatched=!0);let p=new Promise(h).then(l,c),d=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,d,{...a.options,status:void 0}),r=this.#i.get(e)):this.#e[r]=d,d}#t(e){if(!this.#T)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof An}async fetch(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:u=this.noDisposeOnSet,size:a=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:f=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:h=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:g,forceRefresh:_=!1,status:y,signal:b}=r;if(!this.#T)return y&&(y.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:s,status:y});let m={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:u,size:a,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:f,allowStaleOnFetchRejection:h,allowStaleOnFetchAbort:d,ignoreFetchAbort:p,status:y,signal:b},w=this.#i.get(e);if(w===void 0){y&&(y.fetch="miss");let E=this.#B(e,w,m,g);return E.__returned=E}else{let E=this.#e[w];if(this.#t(E)){let R=i&&E.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",R&&(y.returnedStale=!0)),R?E.__staleWhileFetching:E.__returned=E}let A=this.#p(w);if(!_&&!A)return y&&(y.fetch="hit"),this.#I(w),n&&this.#A(w),y&&this.#O(y,w),E;let T=this.#B(e,w,m,g),O=T.__staleWhileFetching!==void 0&&i;return y&&(y.fetch=A?"stale":"refresh",O&&A&&(y.returnedStale=!0)),O?T.__staleWhileFetching:T.__returned=T}}async forceFetch(e,r={}){let i=await this.fetch(e,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(e,r={}){let i=this.#P;if(!i)throw new Error("no memoMethod provided to constructor");let{context:n,forceRefresh:s,...o}=r,u=this.get(e,o);if(!s&&u!==void 0)return u;let a=i(e,u,{options:o,context:n});return this.set(e,a,o),a}get(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=r,u=this.#i.get(e);if(u!==void 0){let a=this.#e[u],l=this.#t(a);return o&&this.#O(o,u),this.#p(u)?(o&&(o.get="stale"),l?(o&&i&&a.__staleWhileFetching!==void 0&&(o.returnedStale=!0),i?a.__staleWhileFetching:void 0):(s||this.#x(e,"expire"),o&&i&&(o.returnedStale=!0),i?a:void 0)):(o&&(o.get="hit"),l?a.__staleWhileFetching:(this.#I(u),n&&this.#A(u),a))}else o&&(o.get="miss")}#D(e,r){this.#h[r]=e,this.#u[e]=r}#I(e){e!==this.#s&&(e===this.#l?this.#l=this.#u[e]:this.#D(this.#h[e],this.#u[e]),this.#D(this.#s,e),this.#s=e)}delete(e){return this.#x(e,"delete")}#x(e,r){let i=!1;if(this.#n!==0){let n=this.#i.get(e);if(n!==void 0)if(i=!0,this.#n===1)this.#W(r);else{this.#k(n);let s=this.#e[n];if(this.#t(s)?s.__abortController.abort(new Error("deleted")):(this.#S||this.#c)&&(this.#S&&this.#g?.(s,e,r),this.#c&&this.#o?.push([s,e,r])),this.#i.delete(e),this.#r[n]=void 0,this.#e[n]=void 0,n===this.#s)this.#s=this.#h[n];else if(n===this.#l)this.#l=this.#u[n];else{let o=this.#h[n];this.#u[o]=this.#u[n];let u=this.#u[n];this.#h[u]=this.#h[n]}this.#n--,this.#b.push(n)}}if(this.#c&&this.#o?.length){let n=this.#o,s;for(;s=n?.shift();)this.#y?.(...s)}return i}clear(){return this.#W("delete")}#W(e){for(let r of this.#E({allowStale:!0})){let i=this.#e[r];if(this.#t(i))i.__abortController.abort(new Error("deleted"));else{let n=this.#r[r];this.#S&&this.#g?.(i,n,e),this.#c&&this.#o?.push([i,n,e])}}if(this.#i.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#d&&this.#w&&(this.#d.fill(0),this.#w.fill(0)),this.#m&&this.#m.fill(0),this.#l=0,this.#s=0,this.#b.length=0,this.#_=0,this.#n=0,this.#c&&this.#o){let r=this.#o,i;for(;i=r?.shift();)this.#y?.(...i)}}};kn.LRUCache=hl});var S1,Ot,Kt,Ir,Fe=B(()=>{"use strict";S1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),Ot=function(){function t(e){e===void 0&&(e=0),this.iteratorType=e}return t.prototype.equals=function(e){return this.o===e.o},t}(),Kt=function(){function t(){this.M=0}return Object.defineProperty(t.prototype,"length",{get:function(){return this.M},enumerable:!1,configurable:!0}),t.prototype.size=function(){return this.M},t.prototype.empty=function(){return this.M===0},t}(),Ir=function(t){S1(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Kt)});var v1,E1,pd,gd=B(()=>{"use strict";Fe();v1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),E1=function(t){v1(e,t);function e(r){r===void 0&&(r=[]);var i=t.call(this)||this;i.nt=[];var n=i;return r.forEach(function(s){n.push(s)}),i}return e.prototype.clear=function(){this.M=0,this.nt=[]},e.prototype.push=function(r){return this.nt.push(r),this.M+=1,this.M},e.prototype.pop=function(){if(this.M!==0)return this.M-=1,this.nt.pop()},e.prototype.top=function(){return this.nt[this.M-1]},e}(Kt),pd=E1});var x1,O1,yd,_d=B(()=>{"use strict";Fe();x1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),O1=function(t){x1(e,t);function e(r){r===void 0&&(r=[]);var i=t.call(this)||this;i.A=0,i.tt=[];var n=i;return r.forEach(function(s){n.push(s)}),i}return e.prototype.clear=function(){this.tt=[],this.M=this.A=0},e.prototype.push=function(r){var i=this.tt.length;if(this.A/i>.5&&this.A+this.M>=i&&i>4096){for(var n=this.M,s=0;s<n;++s)this.tt[s]=this.tt[this.A+s];this.A=0,this.tt[this.M]=r}else this.tt[this.A+this.M]=r;return++this.M},e.prototype.pop=function(){if(this.M!==0){var r=this.tt[this.A++];return this.M-=1,r}},e.prototype.front=function(){if(this.M!==0)return this.tt[this.A]},e}(Kt),yd=O1});var T1,bd,md,A1,wd,Sd=B(()=>{"use strict";Fe();T1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),bd=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(u){o={error:u}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},md=function(t,e,r){if(r||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))},A1=function(t){T1(e,t);function e(r,i,n){r===void 0&&(r=[]),i===void 0&&(i=function(l,c){return l>c?-1:l<c?1:0}),n===void 0&&(n=!0);var s=t.call(this)||this;if(s.$=i,Array.isArray(r))s.ii=n?md([],bd(r),!1):r;else{s.ii=[];var o=s;r.forEach(function(l){o.ii.push(l)})}s.M=s.ii.length;for(var u=s.M>>1,a=s.M-1>>1;a>=0;--a)s.ri(a,u);return s}return e.prototype.ti=function(r){for(var i=this.ii[r];r>0;){var n=r-1>>1,s=this.ii[n];if(this.$(s,i)<=0)break;this.ii[r]=s,r=n}this.ii[r]=i},e.prototype.ri=function(r,i){for(var n=this.ii[r];r<i;){var s=r<<1|1,o=s+1,u=this.ii[s];if(o<this.M&&this.$(u,this.ii[o])>0&&(s=o,u=this.ii[o]),this.$(u,n)>=0)break;this.ii[r]=u,r=s}this.ii[r]=n},e.prototype.clear=function(){this.M=0,this.ii.length=0},e.prototype.push=function(r){this.ii.push(r),this.ti(this.M),this.M+=1},e.prototype.pop=function(){if(this.M!==0){var r=this.ii[0],i=this.ii.pop();return this.M-=1,this.M&&(this.ii[0]=i,this.ri(0,this.M>>1)),r}},e.prototype.top=function(){return this.ii[0]},e.prototype.find=function(r){return this.ii.indexOf(r)>=0},e.prototype.remove=function(r){var i=this.ii.indexOf(r);return i<0?!1:(i===0?this.pop():i===this.M-1?(this.ii.pop(),this.M-=1):(this.ii.splice(i,1,this.ii.pop()),this.M-=1,this.ti(i),this.ri(i,this.M>>1)),!0)},e.prototype.updateItem=function(r){var i=this.ii.indexOf(r);return i<0?!1:(this.ti(i),this.ri(i,this.M>>1),!0)},e.prototype.toArray=function(){return md([],bd(this.ii),!1)},e}(Kt),wd=A1});var k1,I1,Cr,In=B(()=>{"use strict";Fe();k1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),I1=function(t){k1(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Ir),Cr=I1});function q(){throw new RangeError("Iterator access denied!")}var Ue=B(()=>{"use strict"});var C1,Cn,dl=B(()=>{"use strict";Fe();Ue();C1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),Cn=function(t){C1(e,t);function e(r,i){var n=t.call(this,i)||this;return n.o=r,n.iteratorType===0?(n.pre=function(){return this.o===0&&q(),this.o-=1,this},n.next=function(){return this.o===this.container.size()&&q(),this.o+=1,this}):(n.pre=function(){return this.o===this.container.size()-1&&q(),this.o+=1,this},n.next=function(){return this.o===-1&&q(),this.o-=1,this}),n}return Object.defineProperty(e.prototype,"pointer",{get:function(){return this.container.getElementByPos(this.o)},set:function(r){this.container.setElementByPos(this.o,r)},enumerable:!1,configurable:!0}),e}(Ot)});var xd,P1,vd,Ed,R1,hi,M1,Od,Td=B(()=>{"use strict";In();dl();xd=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),P1=function(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(l){return function(c){return a([l,c])}}function a(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},vd=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(u){o={error:u}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},Ed=function(t,e,r){if(r||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))},R1=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},hi=function(t){xd(e,t);function e(r,i,n){var s=t.call(this,r,n)||this;return s.container=i,s}return e.prototype.copy=function(){return new e(this.o,this.container,this.iteratorType)},e}(Cn),M1=function(t){xd(e,t);function e(r,i){r===void 0&&(r=[]),i===void 0&&(i=!0);var n=t.call(this)||this;if(Array.isArray(r))n.J=i?Ed([],vd(r),!1):r,n.M=r.length;else{n.J=[];var s=n;r.forEach(function(o){s.pushBack(o)})}return n}return e.prototype.clear=function(){this.M=0,this.J.length=0},e.prototype.begin=function(){return new hi(0,this)},e.prototype.end=function(){return new hi(this.M,this)},e.prototype.rBegin=function(){return new hi(this.M-1,this,1)},e.prototype.rEnd=function(){return new hi(-1,this,1)},e.prototype.front=function(){return this.J[0]},e.prototype.back=function(){return this.J[this.M-1]},e.prototype.getElementByPos=function(r){if(r<0||r>this.M-1)throw new RangeError;return this.J[r]},e.prototype.eraseElementByPos=function(r){if(r<0||r>this.M-1)throw new RangeError;return this.J.splice(r,1),this.M-=1,this.M},e.prototype.eraseElementByValue=function(r){for(var i=0,n=0;n<this.M;++n)this.J[n]!==r&&(this.J[i++]=this.J[n]);return this.M=this.J.length=i,this.M},e.prototype.eraseElementByIterator=function(r){var i=r.o;return r=r.next(),this.eraseElementByPos(i),r},e.prototype.pushBack=function(r){return this.J.push(r),this.M+=1,this.M},e.prototype.popBack=function(){if(this.M!==0)return this.M-=1,this.J.pop()},e.prototype.setElementByPos=function(r,i){if(r<0||r>this.M-1)throw new RangeError;this.J[r]=i},e.prototype.insert=function(r,i,n){var s;if(n===void 0&&(n=1),r<0||r>this.M)throw new RangeError;return(s=this.J).splice.apply(s,Ed([r,0],vd(new Array(n).fill(i)),!1)),this.M+=n,this.M},e.prototype.find=function(r){for(var i=0;i<this.M;++i)if(this.J[i]===r)return new hi(i,this);return this.end()},e.prototype.reverse=function(){this.J.reverse()},e.prototype.unique=function(){for(var r=1,i=1;i<this.M;++i)this.J[i]!==this.J[i-1]&&(this.J[r++]=this.J[i]);return this.M=this.J.length=r,this.M},e.prototype.sort=function(r){this.J.sort(r)},e.prototype.forEach=function(r){for(var i=0;i<this.M;++i)r(this.J[i],i,this)},e.prototype[Symbol.iterator]=function(){return function(){return P1(this,function(r){switch(r.label){case 0:return[5,R1(this.J)];case 1:return r.sent(),[2]}})}.bind(this)()},e}(Cr),Od=M1});var Ad,B1,di,L1,kd,Id=B(()=>{"use strict";In();Fe();Ue();Ad=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),B1=function(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(l){return function(c){return a([l,c])}}function a(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},di=function(t){Ad(e,t);function e(r,i,n,s){var o=t.call(this,s)||this;return o.o=r,o.h=i,o.container=n,o.iteratorType===0?(o.pre=function(){return this.o.L===this.h&&q(),this.o=this.o.L,this},o.next=function(){return this.o===this.h&&q(),this.o=this.o.m,this}):(o.pre=function(){return this.o.m===this.h&&q(),this.o=this.o.m,this},o.next=function(){return this.o===this.h&&q(),this.o=this.o.L,this}),o}return Object.defineProperty(e.prototype,"pointer",{get:function(){return this.o===this.h&&q(),this.o.p},set:function(r){this.o===this.h&&q(),this.o.p=r},enumerable:!1,configurable:!0}),e.prototype.copy=function(){return new e(this.o,this.h,this.container,this.iteratorType)},e}(Ot),L1=function(t){Ad(e,t);function e(r){r===void 0&&(r=[]);var i=t.call(this)||this;i.h={},i.H=i.l=i.h.L=i.h.m=i.h;var n=i;return r.forEach(function(s){n.pushBack(s)}),i}return e.prototype.G=function(r){var i=r.L,n=r.m;i.m=n,n.L=i,r===this.H&&(this.H=n),r===this.l&&(this.l=i),this.M-=1},e.prototype.F=function(r,i){var n=i.m,s={p:r,L:i,m:n};i.m=s,n.L=s,i===this.h&&(this.H=s),n===this.h&&(this.l=s),this.M+=1},e.prototype.clear=function(){this.M=0,this.H=this.l=this.h.L=this.h.m=this.h},e.prototype.begin=function(){return new di(this.H,this.h,this)},e.prototype.end=function(){return new di(this.h,this.h,this)},e.prototype.rBegin=function(){return new di(this.l,this.h,this,1)},e.prototype.rEnd=function(){return new di(this.h,this.h,this,1)},e.prototype.front=function(){return this.H.p},e.prototype.back=function(){return this.l.p},e.prototype.getElementByPos=function(r){if(r<0||r>this.M-1)throw new RangeError;for(var i=this.H;r--;)i=i.m;return i.p},e.prototype.eraseElementByPos=function(r){if(r<0||r>this.M-1)throw new RangeError;for(var i=this.H;r--;)i=i.m;return this.G(i),this.M},e.prototype.eraseElementByValue=function(r){for(var i=this.H;i!==this.h;)i.p===r&&this.G(i),i=i.m;return this.M},e.prototype.eraseElementByIterator=function(r){var i=r.o;return i===this.h&&q(),r=r.next(),this.G(i),r},e.prototype.pushBack=function(r){return this.F(r,this.l),this.M},e.prototype.popBack=function(){if(this.M!==0){var r=this.l.p;return this.G(this.l),r}},e.prototype.pushFront=function(r){return this.F(r,this.h),this.M},e.prototype.popFront=function(){if(this.M!==0){var r=this.H.p;return this.G(this.H),r}},e.prototype.setElementByPos=function(r,i){if(r<0||r>this.M-1)throw new RangeError;for(var n=this.H;r--;)n=n.m;n.p=i},e.prototype.insert=function(r,i,n){if(n===void 0&&(n=1),r<0||r>this.M)throw new RangeError;if(n<=0)return this.M;if(r===0)for(;n--;)this.pushFront(i);else if(r===this.M)for(;n--;)this.pushBack(i);else{for(var s=this.H,o=1;o<r;++o)s=s.m;var u=s.m;for(this.M+=n;n--;)s.m={p:i,L:s},s.m.L=s,s=s.m;s.m=u,u.L=s}return this.M},e.prototype.find=function(r){for(var i=this.H;i!==this.h;){if(i.p===r)return new di(i,this.h,this);i=i.m}return this.end()},e.prototype.reverse=function(){if(!(this.M<=1))for(var r=this.H,i=this.l,n=0;n<<1<this.M;){var s=r.p;r.p=i.p,i.p=s,r=r.m,i=i.L,n+=1}},e.prototype.unique=function(){if(this.M<=1)return this.M;for(var r=this.H;r!==this.h;){for(var i=r;i.m!==this.h&&i.p===i.m.p;)i=i.m,this.M-=1;r.m=i.m,r.m.L=r,r=r.m}return this.M},e.prototype.sort=function(r){if(!(this.M<=1)){var i=[];this.forEach(function(s){i.push(s)}),i.sort(r);var n=this.H;i.forEach(function(s){n.p=s,n=n.m})}},e.prototype.merge=function(r){var i=this;if(this.M===0)r.forEach(function(s){i.pushBack(s)});else{var n=this.H;r.forEach(function(s){for(;n!==i.h&&n.p<=s;)n=n.m;i.F(s,n.L)})}return this.M},e.prototype.forEach=function(r){for(var i=this.H,n=0;i!==this.h;)r(i.p,n++,this),i=i.m},e.prototype[Symbol.iterator]=function(){return function(){var r;return B1(this,function(i){switch(i.label){case 0:if(this.M===0)return[2];r=this.H,i.label=1;case 1:return r===this.h?[3,3]:[4,r.p];case 2:return i.sent(),r=r.m,[3,1];case 3:return[2]}})}.bind(this)()},e}(Cr),kd=L1});var Cd,N1,j1,q1,pi,D1,Pd,Rd=B(()=>{"use strict";In();dl();Cd=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),N1=function(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(l){return function(c){return a([l,c])}}function a(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},j1=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(u){o={error:u}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},q1=function(t,e,r){if(r||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))},pi=function(t){Cd(e,t);function e(r,i,n){var s=t.call(this,r,n)||this;return s.container=i,s}return e.prototype.copy=function(){return new e(this.o,this.container,this.iteratorType)},e}(Cn),D1=function(t){Cd(e,t);function e(r,i){r===void 0&&(r=[]),i===void 0&&(i=4096);var n=t.call(this)||this;n.A=0,n.S=0,n.R=0,n.k=0,n.C=0,n.j=[];var s=function(){if(typeof r.length=="number")return r.length;if(typeof r.size=="number")return r.size;if(typeof r.size=="function")return r.size();throw new TypeError("Cannot get the length or size of the container")}();n.B=i,n.C=Math.max(Math.ceil(s/n.B),1);for(var o=0;o<n.C;++o)n.j.push(new Array(n.B));var u=Math.ceil(s/n.B);n.A=n.R=(n.C>>1)-(u>>1),n.S=n.k=n.B-s%n.B>>1;var a=n;return r.forEach(function(l){a.pushBack(l)}),n}return e.prototype.O=function(){for(var r=[],i=Math.max(this.C>>1,1),n=0;n<i;++n)r[n]=new Array(this.B);for(var n=this.A;n<this.C;++n)r[r.length]=this.j[n];for(var n=0;n<this.R;++n)r[r.length]=this.j[n];r[r.length]=q1([],j1(this.j[this.R]),!1),this.A=i,this.R=r.length-1;for(var n=0;n<i;++n)r[r.length]=new Array(this.B);this.j=r,this.C=r.length},e.prototype.T=function(r){var i=this.S+r+1,n=i%this.B,s=n-1,o=this.A+(i-n)/this.B;return n===0&&(o-=1),o%=this.C,s<0&&(s+=this.B),{curNodeBucketIndex:o,curNodePointerIndex:s}},e.prototype.clear=function(){this.j=[new Array(this.B)],this.C=1,this.A=this.R=this.M=0,this.S=this.k=this.B>>1},e.prototype.begin=function(){return new pi(0,this)},e.prototype.end=function(){return new pi(this.M,this)},e.prototype.rBegin=function(){return new pi(this.M-1,this,1)},e.prototype.rEnd=function(){return new pi(-1,this,1)},e.prototype.front=function(){if(this.M!==0)return this.j[this.A][this.S]},e.prototype.back=function(){if(this.M!==0)return this.j[this.R][this.k]},e.prototype.pushBack=function(r){return this.M&&(this.k<this.B-1?this.k+=1:this.R<this.C-1?(this.R+=1,this.k=0):(this.R=0,this.k=0),this.R===this.A&&this.k===this.S&&this.O()),this.M+=1,this.j[this.R][this.k]=r,this.M},e.prototype.popBack=function(){if(this.M!==0){var r=this.j[this.R][this.k];return this.M!==1&&(this.k>0?this.k-=1:this.R>0?(this.R-=1,this.k=this.B-1):(this.R=this.C-1,this.k=this.B-1)),this.M-=1,r}},e.prototype.pushFront=function(r){return this.M&&(this.S>0?this.S-=1:this.A>0?(this.A-=1,this.S=this.B-1):(this.A=this.C-1,this.S=this.B-1),this.A===this.R&&this.S===this.k&&this.O()),this.M+=1,this.j[this.A][this.S]=r,this.M},e.prototype.popFront=function(){if(this.M!==0){var r=this.j[this.A][this.S];return this.M!==1&&(this.S<this.B-1?this.S+=1:this.A<this.C-1?(this.A+=1,this.S=0):(this.A=0,this.S=0)),this.M-=1,r}},e.prototype.getElementByPos=function(r){if(r<0||r>this.M-1)throw new RangeError;var i=this.T(r),n=i.curNodeBucketIndex,s=i.curNodePointerIndex;return this.j[n][s]},e.prototype.setElementByPos=function(r,i){if(r<0||r>this.M-1)throw new RangeError;var n=this.T(r),s=n.curNodeBucketIndex,o=n.curNodePointerIndex;this.j[s][o]=i},e.prototype.insert=function(r,i,n){if(n===void 0&&(n=1),r<0||r>this.M)throw new RangeError;if(r===0)for(;n--;)this.pushFront(i);else if(r===this.M)for(;n--;)this.pushBack(i);else{for(var s=[],o=r;o<this.M;++o)s.push(this.getElementByPos(o));this.cut(r-1);for(var o=0;o<n;++o)this.pushBack(i);for(var o=0;o<s.length;++o)this.pushBack(s[o])}return this.M},e.prototype.cut=function(r){if(r<0)return this.clear(),0;var i=this.T(r),n=i.curNodeBucketIndex,s=i.curNodePointerIndex;return this.R=n,this.k=s,this.M=r+1,this.M},e.prototype.eraseElementByPos=function(r){if(r<0||r>this.M-1)throw new RangeError;if(r===0)this.popFront();else if(r===this.M-1)this.popBack();else{for(var i=[],n=r+1;n<this.M;++n)i.push(this.getElementByPos(n));this.cut(r),this.popBack();var s=this;i.forEach(function(o){s.pushBack(o)})}return this.M},e.prototype.eraseElementByValue=function(r){if(this.M===0)return 0;for(var i=[],n=0;n<this.M;++n){var s=this.getElementByPos(n);s!==r&&i.push(s)}for(var o=i.length,n=0;n<o;++n)this.setElementByPos(n,i[n]);return this.cut(o-1)},e.prototype.eraseElementByIterator=function(r){var i=r.o;return this.eraseElementByPos(i),r=r.next(),r},e.prototype.find=function(r){for(var i=0;i<this.M;++i)if(this.getElementByPos(i)===r)return new pi(i,this);return this.end()},e.prototype.reverse=function(){for(var r=0,i=this.M-1;r<i;){var n=this.getElementByPos(r);this.setElementByPos(r,this.getElementByPos(i)),this.setElementByPos(i,n),r+=1,i-=1}},e.prototype.unique=function(){if(this.M<=1)return this.M;for(var r=1,i=this.getElementByPos(0),n=1;n<this.M;++n){var s=this.getElementByPos(n);s!==i&&(i=s,this.setElementByPos(r++,s))}for(;this.M>r;)this.popBack();return this.M},e.prototype.sort=function(r){for(var i=[],n=0;n<this.M;++n)i.push(this.getElementByPos(n));i.sort(r);for(var n=0;n<this.M;++n)this.setElementByPos(n,i[n])},e.prototype.shrinkToFit=function(){if(this.M!==0){var r=[];this.forEach(function(n){r.push(n)}),this.C=Math.max(Math.ceil(this.M/this.B),1),this.M=this.A=this.R=this.S=this.k=0,this.j=[];for(var i=0;i<this.C;++i)this.j.push(new Array(this.B));for(var i=0;i<r.length;++i)this.pushBack(r[i])}},e.prototype.forEach=function(r){for(var i=0;i<this.M;++i)r(this.getElementByPos(i),i,this)},e.prototype[Symbol.iterator]=function(){return function(){var r;return N1(this,function(i){switch(i.label){case 0:r=0,i.label=1;case 1:return r<this.M?[4,this.getElementByPos(r)]:[3,4];case 2:i.sent(),i.label=3;case 3:return++r,[3,1];case 4:return[2]}})}.bind(this)()},e}(Cr),Pd=D1});var W1,pl,Md,Bd=B(()=>{"use strict";W1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),pl=function(){function t(e,r){this.ee=1,this.u=void 0,this.p=void 0,this.K=void 0,this.N=void 0,this.rr=void 0,this.u=e,this.p=r}return t.prototype.L=function(){var e=this;if(e.ee===1&&e.rr.rr===e)e=e.N;else if(e.K)for(e=e.K;e.N;)e=e.N;else{for(var r=e.rr;r.K===e;)e=r,r=e.rr;e=r}return e},t.prototype.m=function(){var e=this;if(e.N){for(e=e.N;e.K;)e=e.K;return e}else{for(var r=e.rr;r.N===e;)e=r,r=e.rr;return e.N!==r?r:e}},t.prototype.ne=function(){var e=this.rr,r=this.N,i=r.K;return e.rr===this?e.rr=r:e.K===this?e.K=r:e.N=r,r.rr=e,r.K=this,this.rr=r,this.N=i,i&&(i.rr=this),r},t.prototype.te=function(){var e=this.rr,r=this.K,i=r.N;return e.rr===this?e.rr=r:e.K===this?e.K=r:e.N=r,r.rr=e,r.N=this,this.rr=r,this.K=i,i&&(i.rr=this),r},t}(),Md=function(t){W1(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.tr=1,r}return e.prototype.ne=function(){var r=t.prototype.ne.call(this);return this.ie(),r.ie(),r},e.prototype.te=function(){var r=t.prototype.te.call(this);return this.ie(),r.ie(),r},e.prototype.ie=function(){this.tr=1,this.K&&(this.tr+=this.K.tr),this.N&&(this.tr+=this.N.tr)},e}(pl)});var F1,Ld,Nd,U1,Pn,gl=B(()=>{"use strict";Bd();Fe();Ue();F1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),Ld=function(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(u){o={error:u}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s},Nd=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},U1=function(t){F1(e,t);function e(r,i){r===void 0&&(r=function(s,o){return s<o?-1:s>o?1:0}),i===void 0&&(i=!1);var n=t.call(this)||this;return n.W=void 0,n.$=r,i?(n.re=Md,n.v=function(s,o,u){var a=this.se(s,o,u);if(a){for(var l=a.rr;l!==this.h;)l.tr+=1,l=l.rr;var c=this.fe(a);if(c){var f=c,h=f.parentNode,p=f.grandParent,d=f.curNode;h.ie(),p.ie(),d.ie()}}return this.M},n.G=function(s){for(var o=this.he(s);o!==this.h;)o.tr-=1,o=o.rr}):(n.re=pl,n.v=function(s,o,u){var a=this.se(s,o,u);return a&&this.fe(a),this.M},n.G=n.he),n.h=new n.re,n}return e.prototype.U=function(r,i){for(var n=this.h;r;){var s=this.$(r.u,i);if(s<0)r=r.N;else if(s>0)n=r,r=r.K;else return r}return n},e.prototype.X=function(r,i){for(var n=this.h;r;){var s=this.$(r.u,i);s<=0?r=r.N:(n=r,r=r.K)}return n},e.prototype.Y=function(r,i){for(var n=this.h;r;){var s=this.$(r.u,i);if(s<0)n=r,r=r.N;else if(s>0)r=r.K;else return r}return n},e.prototype.Z=function(r,i){for(var n=this.h;r;){var s=this.$(r.u,i);s<0?(n=r,r=r.N):r=r.K}return n},e.prototype.ue=function(r){for(;;){var i=r.rr;if(i===this.h)return;if(r.ee===1){r.ee=0;return}if(r===i.K){var n=i.N;if(n.ee===1)n.ee=0,i.ee=1,i===this.W?this.W=i.ne():i.ne();else if(n.N&&n.N.ee===1){n.ee=i.ee,i.ee=0,n.N.ee=0,i===this.W?this.W=i.ne():i.ne();return}else n.K&&n.K.ee===1?(n.ee=1,n.K.ee=0,n.te()):(n.ee=1,r=i)}else{var n=i.K;if(n.ee===1)n.ee=0,i.ee=1,i===this.W?this.W=i.te():i.te();else if(n.K&&n.K.ee===1){n.ee=i.ee,i.ee=0,n.K.ee=0,i===this.W?this.W=i.te():i.te();return}else n.N&&n.N.ee===1?(n.ee=1,n.N.ee=0,n.ne()):(n.ee=1,r=i)}}},e.prototype.he=function(r){var i,n;if(this.M===1)return this.clear(),this.h;for(var s=r;s.K||s.N;){if(s.N)for(s=s.N;s.K;)s=s.K;else s=s.K;i=Ld([s.u,r.u],2),r.u=i[0],s.u=i[1],n=Ld([s.p,r.p],2),r.p=n[0],s.p=n[1],r=s}this.h.K===s?this.h.K=s.rr:this.h.N===s&&(this.h.N=s.rr),this.ue(s);var o=s.rr;return s===o.K?o.K=void 0:o.N=void 0,this.M-=1,this.W.ee=0,o},e.prototype.ae=function(r,i){if(r===void 0)return!1;var n=this.ae(r.K,i);return n||i(r)?!0:this.ae(r.N,i)},e.prototype.fe=function(r){for(;;){var i=r.rr;if(i.ee===0)return;var n=i.rr;if(i===n.K){var s=n.N;if(s&&s.ee===1){if(s.ee=i.ee=0,n===this.W)return;n.ee=1,r=n;continue}else if(r===i.N){if(r.ee=0,r.K&&(r.K.rr=i),r.N&&(r.N.rr=n),i.N=r.K,n.K=r.N,r.K=i,r.N=n,n===this.W)this.W=r,this.h.rr=r;else{var o=n.rr;o.K===n?o.K=r:o.N=r}return r.rr=n.rr,i.rr=r,n.rr=r,n.ee=1,{parentNode:i,grandParent:n,curNode:r}}else i.ee=0,n===this.W?this.W=n.te():n.te(),n.ee=1}else{var s=n.K;if(s&&s.ee===1){if(s.ee=i.ee=0,n===this.W)return;n.ee=1,r=n;continue}else if(r===i.K){if(r.ee=0,r.K&&(r.K.rr=n),r.N&&(r.N.rr=i),n.N=r.K,i.K=r.N,r.K=n,r.N=i,n===this.W)this.W=r,this.h.rr=r;else{var o=n.rr;o.K===n?o.K=r:o.N=r}return r.rr=n.rr,i.rr=r,n.rr=r,n.ee=1,{parentNode:i,grandParent:n,curNode:r}}else i.ee=0,n===this.W?this.W=n.ne():n.ne(),n.ee=1}return}},e.prototype.se=function(r,i,n){if(this.W===void 0){this.M+=1,this.W=new this.re(r,i),this.W.ee=0,this.W.rr=this.h,this.h.rr=this.W,this.h.K=this.W,this.h.N=this.W;return}var s,o=this.h.K,u=this.$(o.u,r);if(u===0){o.p=i;return}else if(u>0)o.K=new this.re(r,i),o.K.rr=o,s=o.K,this.h.K=s;else{var a=this.h.N,l=this.$(a.u,r);if(l===0){a.p=i;return}else if(l<0)a.N=new this.re(r,i),a.N.rr=a,s=a.N,this.h.N=s;else{if(n!==void 0){var c=n.o;if(c!==this.h){var f=this.$(c.u,r);if(f===0){c.p=i;return}else if(f>0){var h=c.L(),p=this.$(h.u,r);if(p===0){h.p=i;return}else p<0&&(s=new this.re(r,i),h.N===void 0?(h.N=s,s.rr=h):(c.K=s,s.rr=c))}}}if(s===void 0)for(s=this.W;;){var d=this.$(s.u,r);if(d>0){if(s.K===void 0){s.K=new this.re(r,i),s.K.rr=s,s=s.K;break}s=s.K}else if(d<0){if(s.N===void 0){s.N=new this.re(r,i),s.N.rr=s,s=s.N;break}s=s.N}else{s.p=i;return}}}}return this.M+=1,s},e.prototype.g=function(r,i){for(;r;){var n=this.$(r.u,i);if(n<0)r=r.N;else if(n>0)r=r.K;else return r}return r||this.h},e.prototype.clear=function(){this.M=0,this.W=void 0,this.h.rr=void 0,this.h.K=this.h.N=void 0},e.prototype.updateKeyByIterator=function(r,i){var n=r.o;if(n===this.h&&q(),this.M===1)return n.u=i,!0;if(n===this.h.K)return this.$(n.m().u,i)>0?(n.u=i,!0):!1;if(n===this.h.N)return this.$(n.L().u,i)<0?(n.u=i,!0):!1;var s=n.L().u;if(this.$(s,i)>=0)return!1;var o=n.m().u;return this.$(o,i)<=0?!1:(n.u=i,!0)},e.prototype.eraseElementByPos=function(r){if(r<0||r>this.M-1)throw new RangeError;var i=0,n=this;return this.ae(this.W,function(s){return r===i?(n.G(s),!0):(i+=1,!1)}),this.M},e.prototype.eraseElementByKey=function(r){if(this.M===0)return!1;var i=this.g(this.W,r);return i===this.h?!1:(this.G(i),!0)},e.prototype.eraseElementByIterator=function(r){var i=r.o;i===this.h&&q();var n=i.N===void 0,s=r.iteratorType===0;return s?n&&r.next():(!n||i.K===void 0)&&r.next(),this.G(i),r},e.prototype.forEach=function(r){var i,n,s=0;try{for(var o=Nd(this),u=o.next();!u.done;u=o.next()){var a=u.value;r(a,s++,this)}}catch(l){i={error:l}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}},e.prototype.getElementByPos=function(r){var i,n;if(r<0||r>this.M-1)throw new RangeError;var s,o=0;try{for(var u=Nd(this),a=u.next();!a.done;a=u.next()){var l=a.value;if(o===r){s=l;break}o+=1}}catch(c){i={error:c}}finally{try{a&&!a.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}return s},e.prototype.getHeight=function(){if(this.M===0)return 0;var r=function(i){return i?Math.max(r(i.K),r(i.N))+1:0};return r(this.W)},e}(Ir),Pn=U1});var $1,V1,Rn,yl=B(()=>{"use strict";Fe();Ue();$1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),V1=function(t){$1(e,t);function e(r,i,n){var s=t.call(this,n)||this;return s.o=r,s.h=i,s.iteratorType===0?(s.pre=function(){return this.o===this.h.K&&q(),this.o=this.o.L(),this},s.next=function(){return this.o===this.h&&q(),this.o=this.o.m(),this}):(s.pre=function(){return this.o===this.h.N&&q(),this.o=this.o.m(),this},s.next=function(){return this.o===this.h&&q(),this.o=this.o.L(),this}),s}return Object.defineProperty(e.prototype,"index",{get:function(){var r=this.o,i=this.h.rr;if(r===this.h)return i?i.tr-1:0;var n=0;for(r.K&&(n+=r.K.tr);r!==i;){var s=r.rr;r===s.N&&(n+=1,s.K&&(n+=s.K.tr)),r=s}return n},enumerable:!1,configurable:!0}),e}(Ot),Rn=V1});var qd,K1,jd,rt,H1,Dd,Wd=B(()=>{"use strict";gl();yl();Ue();qd=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),K1=function(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(l){return function(c){return a([l,c])}}function a(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},jd=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},rt=function(t){qd(e,t);function e(r,i,n,s){var o=t.call(this,r,i,s)||this;return o.container=n,o}return Object.defineProperty(e.prototype,"pointer",{get:function(){return this.o===this.h&&q(),this.o.u},enumerable:!1,configurable:!0}),e.prototype.copy=function(){return new e(this.o,this.h,this.container,this.iteratorType)},e}(Rn),H1=function(t){qd(e,t);function e(r,i,n){r===void 0&&(r=[]);var s=t.call(this,i,n)||this,o=s;return r.forEach(function(u){o.insert(u)}),s}return e.prototype.P=function(r){return K1(this,function(i){switch(i.label){case 0:return r===void 0?[2]:[5,jd(this.P(r.K))];case 1:return i.sent(),[4,r.u];case 2:return i.sent(),[5,jd(this.P(r.N))];case 3:return i.sent(),[2]}})},e.prototype.begin=function(){return new rt(this.h.K||this.h,this.h,this)},e.prototype.end=function(){return new rt(this.h,this.h,this)},e.prototype.rBegin=function(){return new rt(this.h.N||this.h,this.h,this,1)},e.prototype.rEnd=function(){return new rt(this.h,this.h,this,1)},e.prototype.front=function(){return this.h.K?this.h.K.u:void 0},e.prototype.back=function(){return this.h.N?this.h.N.u:void 0},e.prototype.insert=function(r,i){return this.v(r,void 0,i)},e.prototype.find=function(r){var i=this.g(this.W,r);return new rt(i,this.h,this)},e.prototype.lowerBound=function(r){var i=this.U(this.W,r);return new rt(i,this.h,this)},e.prototype.upperBound=function(r){var i=this.X(this.W,r);return new rt(i,this.h,this)},e.prototype.reverseLowerBound=function(r){var i=this.Y(this.W,r);return new rt(i,this.h,this)},e.prototype.reverseUpperBound=function(r){var i=this.Z(this.W,r);return new rt(i,this.h,this)},e.prototype.union=function(r){var i=this;return r.forEach(function(n){i.insert(n)}),this.M},e.prototype[Symbol.iterator]=function(){return this.P(this.W)},e}(Pn),Dd=H1});var Ud,z1,Fd,it,G1,$d,Vd=B(()=>{"use strict";gl();yl();Ue();Ud=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),z1=function(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(l){return function(c){return a([l,c])}}function a(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Fd=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},it=function(t){Ud(e,t);function e(r,i,n,s){var o=t.call(this,r,i,s)||this;return o.container=n,o}return Object.defineProperty(e.prototype,"pointer",{get:function(){this.o===this.h&&q();var r=this;return new Proxy([],{get:function(i,n){if(n==="0")return r.o.u;if(n==="1")return r.o.p},set:function(i,n,s){if(n!=="1")throw new TypeError("props must be 1");return r.o.p=s,!0}})},enumerable:!1,configurable:!0}),e.prototype.copy=function(){return new e(this.o,this.h,this.container,this.iteratorType)},e}(Rn),G1=function(t){Ud(e,t);function e(r,i,n){r===void 0&&(r=[]);var s=t.call(this,i,n)||this,o=s;return r.forEach(function(u){o.setElement(u[0],u[1])}),s}return e.prototype.P=function(r){return z1(this,function(i){switch(i.label){case 0:return r===void 0?[2]:[5,Fd(this.P(r.K))];case 1:return i.sent(),[4,[r.u,r.p]];case 2:return i.sent(),[5,Fd(this.P(r.N))];case 3:return i.sent(),[2]}})},e.prototype.begin=function(){return new it(this.h.K||this.h,this.h,this)},e.prototype.end=function(){return new it(this.h,this.h,this)},e.prototype.rBegin=function(){return new it(this.h.N||this.h,this.h,this,1)},e.prototype.rEnd=function(){return new it(this.h,this.h,this,1)},e.prototype.front=function(){if(this.M!==0){var r=this.h.K;return[r.u,r.p]}},e.prototype.back=function(){if(this.M!==0){var r=this.h.N;return[r.u,r.p]}},e.prototype.lowerBound=function(r){var i=this.U(this.W,r);return new it(i,this.h,this)},e.prototype.upperBound=function(r){var i=this.X(this.W,r);return new it(i,this.h,this)},e.prototype.reverseLowerBound=function(r){var i=this.Y(this.W,r);return new it(i,this.h,this)},e.prototype.reverseUpperBound=function(r){var i=this.Z(this.W,r);return new it(i,this.h,this)},e.prototype.setElement=function(r,i,n){return this.v(r,i,n)},e.prototype.find=function(r){var i=this.g(this.W,r);return new it(i,this.h,this)},e.prototype.getElementByKey=function(r){var i=this.g(this.W,r);return i.p},e.prototype.union=function(r){var i=this;return r.forEach(function(n){i.setElement(n[0],n[1])}),this.M},e.prototype[Symbol.iterator]=function(){return this.P(this.W)},e}(Pn),$d=G1});function Ht(t){var e=typeof t;return e==="object"&&t!==null||e==="function"}var _l=B(()=>{"use strict"});var Kd,Mn,Bn,bl=B(()=>{"use strict";Fe();_l();Ue();Kd=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),Mn=function(t){Kd(e,t);function e(r,i,n){var s=t.call(this,n)||this;return s.o=r,s.h=i,s.iteratorType===0?(s.pre=function(){return this.o.L===this.h&&q(),this.o=this.o.L,this},s.next=function(){return this.o===this.h&&q(),this.o=this.o.m,this}):(s.pre=function(){return this.o.m===this.h&&q(),this.o=this.o.m,this},s.next=function(){return this.o===this.h&&q(),this.o=this.o.L,this}),s}return e}(Ot),Bn=function(t){Kd(e,t);function e(){var r=t.call(this)||this;return r._=[],r.I={},r.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(r.I,null),r.h={},r.h.L=r.h.m=r.H=r.l=r.h,r}return e.prototype.G=function(r){var i=r.L,n=r.m;i.m=n,n.L=i,r===this.H&&(this.H=n),r===this.l&&(this.l=i),this.M-=1},e.prototype.v=function(r,i,n){n===void 0&&(n=Ht(r));var s;if(n){var o=r[this.HASH_TAG];if(o!==void 0)return this._[o].p=i,this.M;Object.defineProperty(r,this.HASH_TAG,{value:this._.length,configurable:!0}),s={u:r,p:i,L:this.l,m:this.h},this._.push(s)}else{var u=this.I[r];if(u)return u.p=i,this.M;s={u:r,p:i,L:this.l,m:this.h},this.I[r]=s}return this.M===0?(this.H=s,this.h.m=s):this.l.m=s,this.l=s,this.h.L=s,++this.M},e.prototype.g=function(r,i){if(i===void 0&&(i=Ht(r)),i){var n=r[this.HASH_TAG];return n===void 0?this.h:this._[n]}else return this.I[r]||this.h},e.prototype.clear=function(){var r=this.HASH_TAG;this._.forEach(function(i){delete i.u[r]}),this._=[],this.I={},Object.setPrototypeOf(this.I,null),this.M=0,this.H=this.l=this.h.L=this.h.m=this.h},e.prototype.eraseElementByKey=function(r,i){var n;if(i===void 0&&(i=Ht(r)),i){var s=r[this.HASH_TAG];if(s===void 0)return!1;delete r[this.HASH_TAG],n=this._[s],delete this._[s]}else{if(n=this.I[r],n===void 0)return!1;delete this.I[r]}return this.G(n),!0},e.prototype.eraseElementByIterator=function(r){var i=r.o;return i===this.h&&q(),this.G(i),r.next()},e.prototype.eraseElementByPos=function(r){if(r<0||r>this.M-1)throw new RangeError;for(var i=this.H;r--;)i=i.m;return this.G(i),this.M},e}(Ir)});var Hd,Q1,gi,J1,zd,Gd=B(()=>{"use strict";bl();Ue();Hd=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),Q1=function(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(l){return function(c){return a([l,c])}}function a(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},gi=function(t){Hd(e,t);function e(r,i,n,s){var o=t.call(this,r,i,s)||this;return o.container=n,o}return Object.defineProperty(e.prototype,"pointer",{get:function(){return this.o===this.h&&q(),this.o.u},enumerable:!1,configurable:!0}),e.prototype.copy=function(){return new e(this.o,this.h,this.container,this.iteratorType)},e}(Mn),J1=function(t){Hd(e,t);function e(r){r===void 0&&(r=[]);var i=t.call(this)||this,n=i;return r.forEach(function(s){n.insert(s)}),i}return e.prototype.begin=function(){return new gi(this.H,this.h,this)},e.prototype.end=function(){return new gi(this.h,this.h,this)},e.prototype.rBegin=function(){return new gi(this.l,this.h,this,1)},e.prototype.rEnd=function(){return new gi(this.h,this.h,this,1)},e.prototype.front=function(){return this.H.u},e.prototype.back=function(){return this.l.u},e.prototype.insert=function(r,i){return this.v(r,void 0,i)},e.prototype.getElementByPos=function(r){if(r<0||r>this.M-1)throw new RangeError;for(var i=this.H;r--;)i=i.m;return i.u},e.prototype.find=function(r,i){var n=this.g(r,i);return new gi(n,this.h,this)},e.prototype.forEach=function(r){for(var i=0,n=this.H;n!==this.h;)r(n.u,i++,this),n=n.m},e.prototype[Symbol.iterator]=function(){return function(){var r;return Q1(this,function(i){switch(i.label){case 0:r=this.H,i.label=1;case 1:return r===this.h?[3,3]:[4,r.u];case 2:return i.sent(),r=r.m,[3,1];case 3:return[2]}})}.bind(this)()},e}(Bn),zd=J1});var Qd,Y1,yi,X1,Jd,Yd=B(()=>{"use strict";bl();_l();Ue();Qd=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function i(){this.constructor=e}e.prototype=r===null?Object.create(r):(i.prototype=r.prototype,new i)}}(),Y1=function(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(l){return function(c){return a([l,c])}}function a(l){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=l[0]&2?n.return:l[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,l[1])).done)return s;switch(n=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,n=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){r.label=l[1];break}if(l[0]===6&&r.label<s[1]){r.label=s[1],s=l;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(l);break}s[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(c){l=[6,c],n=0}finally{i=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},yi=function(t){Qd(e,t);function e(r,i,n,s){var o=t.call(this,r,i,s)||this;return o.container=n,o}return Object.defineProperty(e.prototype,"pointer",{get:function(){this.o===this.h&&q();var r=this;return new Proxy([],{get:function(i,n){if(n==="0")return r.o.u;if(n==="1")return r.o.p},set:function(i,n,s){if(n!=="1")throw new TypeError("props must be 1");return r.o.p=s,!0}})},enumerable:!1,configurable:!0}),e.prototype.copy=function(){return new e(this.o,this.h,this.container,this.iteratorType)},e}(Mn),X1=function(t){Qd(e,t);function e(r){r===void 0&&(r=[]);var i=t.call(this)||this,n=i;return r.forEach(function(s){n.setElement(s[0],s[1])}),i}return e.prototype.begin=function(){return new yi(this.H,this.h,this)},e.prototype.end=function(){return new yi(this.h,this.h,this)},e.prototype.rBegin=function(){return new yi(this.l,this.h,this,1)},e.prototype.rEnd=function(){return new yi(this.h,this.h,this,1)},e.prototype.front=function(){if(this.M!==0)return[this.H.u,this.H.p]},e.prototype.back=function(){if(this.M!==0)return[this.l.u,this.l.p]},e.prototype.setElement=function(r,i,n){return this.v(r,i,n)},e.prototype.getElementByKey=function(r,i){if(i===void 0&&(i=Ht(r)),i){var n=r[this.HASH_TAG];return n!==void 0?this._[n].p:void 0}var s=this.I[r];return s?s.p:void 0},e.prototype.getElementByPos=function(r){if(r<0||r>this.M-1)throw new RangeError;for(var i=this.H;r--;)i=i.m;return[i.u,i.p]},e.prototype.find=function(r,i){var n=this.g(r,i);return new yi(n,this.h,this)},e.prototype.forEach=function(r){for(var i=0,n=this.H;n!==this.h;)r([n.u,n.p],i++,this),n=n.m},e.prototype[Symbol.iterator]=function(){return function(){var r;return Y1(this,function(i){switch(i.label){case 0:r=this.H,i.label=1;case 1:return r===this.h?[3,3]:[4,[r.u,r.p]];case 2:return i.sent(),r=r.m,[3,1];case 3:return[2]}})}.bind(this)()},e}(Bn),Jd=X1});var Xd={};vs(Xd,{Deque:()=>Pd,HashMap:()=>Jd,HashSet:()=>zd,LinkList:()=>kd,OrderedMap:()=>$d,OrderedSet:()=>Dd,PriorityQueue:()=>wd,Queue:()=>yd,Stack:()=>pd,Vector:()=>Od});var Zd=B(()=>{"use strict";gd();_d();Sd();Td();Id();Rd();Wd();Vd();Gd();Yd()});var tp=S((CB,ep)=>{"use strict";var Z1=(Zd(),xs(Xd)).OrderedSet,$e=De()("number-allocator:trace"),ex=De()("number-allocator:error");function ce(t,e){this.low=t,this.high=e}ce.prototype.equals=function(t){return this.low===t.low&&this.high===t.high};ce.prototype.compare=function(t){return this.low<t.low&&this.high<t.low?-1:t.low<this.low&&t.high<this.low?1:0};function Ve(t,e){if(!(this instanceof Ve))return new Ve(t,e);this.min=t,this.max=e,this.ss=new Z1([],(r,i)=>r.compare(i)),$e("Create"),this.clear()}Ve.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low};Ve.prototype.alloc=function(){if(this.ss.size()===0)return $e("alloc():empty"),null;let t=this.ss.begin(),e=t.pointer.low,r=t.pointer.high,i=e;return i+1<=r?this.ss.updateKeyByIterator(t,new ce(e+1,r)):this.ss.eraseElementByPos(0),$e("alloc():"+i),i};Ve.prototype.use=function(t){let e=new ce(t,t),r=this.ss.lowerBound(e);if(!r.equals(this.ss.end())){let i=r.pointer.low,n=r.pointer.high;return r.pointer.equals(e)?(this.ss.eraseElementByIterator(r),$e("use():"+t),!0):i>t?!1:i===t?(this.ss.updateKeyByIterator(r,new ce(i+1,n)),$e("use():"+t),!0):n===t?(this.ss.updateKeyByIterator(r,new ce(i,n-1)),$e("use():"+t),!0):(this.ss.updateKeyByIterator(r,new ce(t+1,n)),this.ss.insert(new ce(i,t-1)),$e("use():"+t),!0)}return $e("use():failed"),!1};Ve.prototype.free=function(t){if(t<this.min||t>this.max){ex("free():"+t+" is out of range");return}let e=new ce(t,t),r=this.ss.upperBound(e);if(r.equals(this.ss.end())){if(r.equals(this.ss.begin())){this.ss.insert(e);return}r.pre();let i=r.pointer.high;r.pointer.high+1===t?this.ss.updateKeyByIterator(r,new ce(i,t)):this.ss.insert(e)}else if(r.equals(this.ss.begin()))if(t+1===r.pointer.low){let i=r.pointer.high;this.ss.updateKeyByIterator(r,new ce(t,i))}else this.ss.insert(e);else{let i=r.pointer.low,n=r.pointer.high;r.pre();let s=r.pointer.low;r.pointer.high+1===t?t+1===i?(this.ss.eraseElementByIterator(r),this.ss.updateKeyByIterator(r,new ce(s,n))):this.ss.updateKeyByIterator(r,new ce(s,t)):t+1===i?(this.ss.eraseElementByIterator(r.next()),this.ss.insert(new ce(t,n))):this.ss.insert(e)}$e("free():"+t)};Ve.prototype.clear=function(){$e("clear()"),this.ss.clear(),this.ss.insert(new ce(this.min,this.max))};Ve.prototype.intervalCount=function(){return this.ss.size()};Ve.prototype.dump=function(){console.log("length:"+this.ss.size());for(let t of this.ss)console.log(t)};ep.exports=Ve});var ml=S((PB,rp)=>{"use strict";var tx=tp();rp.exports.NumberAllocator=tx});var ip=S(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});var rx=dd(),ix=ml(),wl=class{constructor(e){e>0&&(this.aliasToTopic=new rx.LRUCache({max:e}),this.topicToAlias={},this.numberAllocator=new ix.NumberAllocator(1,e),this.max=e,this.length=0)}put(e,r){if(r===0||r>this.max)return!1;let i=this.aliasToTopic.get(r);return i&&delete this.topicToAlias[i],this.aliasToTopic.set(r,e),this.topicToAlias[e]=r,this.numberAllocator.use(r),this.length=this.aliasToTopic.size,!0}getTopicByAlias(e){return this.aliasToTopic.get(e)}getAliasByTopic(e){let r=this.topicToAlias[e];return typeof r<"u"&&this.aliasToTopic.get(r),r}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){let e=this.numberAllocator.firstVacant();return e||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};Sl.default=wl});var np=S(_i=>{"use strict";var nx=_i&&_i.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_i,"__esModule",{value:!0});var sx=fi(),ox=nx(ip()),lx=Vt(),ax=(t,e)=>{t.log("_handleConnack");let{options:r}=t,n=r.protocolVersion===5?e.reasonCode:e.returnCode;if(clearTimeout(t.connackTimer),delete t.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535){t.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}e.properties.topicAliasMaximum>0&&(t.topicAliasSend=new ox.default(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&r.keepalive&&(r.keepalive=e.properties.serverKeepAlive),e.properties.maximumPacketSize&&(r.properties||(r.properties={}),r.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(n===0)t.reconnecting=!1,t._onConnect(e);else if(n>0){let s=new lx.ErrorWithReasonCode(`Connection refused: ${sx.ReasonCodes[n]}`,n);t.emit("error",s)}};_i.default=ax});var sp=S(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});var ux=(t,e,r)=>{t.log("handling pubrel packet");let i=typeof r<"u"?r:t.noop,{messageId:n}=e,s={cmd:"pubcomp",messageId:n};t.incomingStore.get(e,(o,u)=>{o?t._sendPacket(s,i):(t.emit("message",u.topic,u.payload,u),t.handleMessage(u,a=>{if(a)return i(a);t.incomingStore.del(u,t.noop),t._sendPacket(s,i)}))})};vl.default=ux});var op=S(bi=>{"use strict";var mi=bi&&bi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bi,"__esModule",{value:!0});var cx=mi(nd()),fx=mi(ad()),hx=mi(np()),dx=mi(fi()),px=mi(sp()),gx=(t,e,r)=>{let{options:i}=t;if(i.protocolVersion===5&&i.properties&&i.properties.maximumPacketSize&&i.properties.maximumPacketSize<e.length)return t.emit("error",new Error(`exceeding packets size ${e.cmd}`)),t.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),t;switch(t.log("_handlePacket :: emitting packetreceive"),t.emit("packetreceive",e),e.cmd){case"publish":(0,cx.default)(t,e,r);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":t.reschedulePing(),(0,dx.default)(t,e),r();break;case"pubrel":t.reschedulePing(),(0,px.default)(t,e,r);break;case"connack":(0,hx.default)(t,e),r();break;case"auth":t.reschedulePing(),(0,fx.default)(t,e),r();break;case"pingresp":t.log("_handlePacket :: received pingresp"),t.reschedulePing(!0),r();break;case"disconnect":t.emit("disconnect",e),r();break;default:t.log("_handlePacket :: unknown command"),r();break}};bi.default=gx});var lp=S(Pr=>{"use strict";var yx=Pr&&Pr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.TypedEventEmitter=void 0;var _x=yx(require("events")),bx=Vt(),Ln=class{};Pr.TypedEventEmitter=Ln;(0,bx.applyMixin)(Ln,_x.default)});var wi=S(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.isReactNativeBrowser=zt.isWebWorker=void 0;var mx=()=>{var t;return typeof window<"u"?typeof navigator<"u"&&((t=navigator.userAgent)===null||t===void 0?void 0:t.toLowerCase().indexOf(" electron/"))>-1&&(process!=null&&process.versions)?!Object.prototype.hasOwnProperty.call(process.versions,"electron"):typeof window.document<"u":!1},ap=()=>{var t,e;return!!(typeof self=="object"&&(!((e=(t=self?.constructor)===null||t===void 0?void 0:t.name)===null||e===void 0)&&e.includes("WorkerGlobalScope")))},up=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Sx=mx()||ap()||up();zt.isWebWorker=ap();zt.isReactNativeBrowser=up();zt.default=Sx});var cp,fp=B(()=>{"use strict";cp=t=>e=>{let r=t(e);return e.add(r),r}});var hp,dp=B(()=>{"use strict";hp=t=>(e,r)=>(t.set(e,r),r)});var pp,yp,gp,_p,bp=B(()=>{"use strict";pp=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,yp=536870912,gp=yp*2,_p=(t,e)=>r=>{let i=e.get(r),n=i===void 0?r.size:i<gp?i+1:0;if(!r.has(n))return t(r,n);if(r.size<yp){for(;r.has(n);)n=Math.floor(Math.random()*gp);return t(r,n)}if(r.size>pp)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(n);)n=Math.floor(Math.random()*pp);return t(r,n)}});var mp=B(()=>{"use strict"});var wp=B(()=>{"use strict"});var Sp=B(()=>{"use strict"});var vp=B(()=>{"use strict"});var Ep=B(()=>{"use strict"});var xp=B(()=>{"use strict"});var Op=B(()=>{"use strict";mp();wp();Sp();vp();Ep();xp()});var Tp,vx,Rr,JB,Ap=B(()=>{"use strict";fp();dp();bp();Op();Tp=new WeakMap,vx=hp(Tp),Rr=_p(vx,Tp),JB=cp(Rr)});var kp,Ip=B(()=>{"use strict";kp=t=>t.method!==void 0&&t.method==="call"});var Cp,Pp=B(()=>{"use strict";Cp=t=>t.error===null&&typeof t.id=="number"});var Rp,Mp=B(()=>{"use strict";Ap();Ip();Pp();Rp=t=>{let e=new Map([[0,()=>{}]]),r=new Map([[0,()=>{}]]),i=new Map,n=new Worker(t);return n.addEventListener("message",({data:l})=>{if(kp(l)){let{params:{timerId:c,timerType:f}}=l;if(f==="interval"){let h=e.get(c);if(typeof h=="number"){let p=i.get(h);if(p===void 0||p.timerId!==c||p.timerType!==f)throw new Error("The timer is in an undefined state.")}else if(typeof h<"u")h();else throw new Error("The timer is in an undefined state.")}else if(f==="timeout"){let h=r.get(c);if(typeof h=="number"){let p=i.get(h);if(p===void 0||p.timerId!==c||p.timerType!==f)throw new Error("The timer is in an undefined state.")}else if(typeof h<"u")h(),r.delete(c);else throw new Error("The timer is in an undefined state.")}}else if(Cp(l)){let{id:c}=l,f=i.get(c);if(f===void 0)throw new Error("The timer is in an undefined state.");let{timerId:h,timerType:p}=f;i.delete(c),p==="interval"?e.delete(h):r.delete(h)}else{let{error:{message:c}}=l;throw new Error(c)}}),{clearInterval:l=>{let c=Rr(i);i.set(c,{timerId:l,timerType:"interval"}),e.set(l,c),n.postMessage({id:c,method:"clear",params:{timerId:l,timerType:"interval"}})},clearTimeout:l=>{let c=Rr(i);i.set(c,{timerId:l,timerType:"timeout"}),r.set(l,c),n.postMessage({id:c,method:"clear",params:{timerId:l,timerType:"timeout"}})},setInterval:(l,c=0)=>{let f=Rr(e);return e.set(f,()=>{l(),typeof e.get(f)=="function"&&n.postMessage({id:null,method:"set",params:{delay:c,now:performance.now(),timerId:f,timerType:"interval"}})}),n.postMessage({id:null,method:"set",params:{delay:c,now:performance.now(),timerId:f,timerType:"interval"}}),f},setTimeout:(l,c=0)=>{let f=Rr(r);return r.set(f,l),n.postMessage({id:null,method:"set",params:{delay:c,now:performance.now(),timerId:f,timerType:"timeout"}}),f}}}});var Bp,Lp=B(()=>{"use strict";Bp=(t,e)=>{let r=null;return()=>{if(r!==null)return r;let i=new Blob([e],{type:"application/javascript; charset=utf-8"}),n=URL.createObjectURL(i);return r=t(n),setTimeout(()=>URL.revokeObjectURL(n)),r}}});var Np,jp=B(()=>{"use strict";Np=`(()=>{"use strict";const e=new Map,t=new Map,r=(e,t)=>{let r,o;const i=performance.now();r=i,o=e-Math.max(0,i-t);return{expected:r+o,remainingDelay:o}},o=(e,t,r,i)=>{const s=performance.now();s>r?postMessage({id:null,method:"call",params:{timerId:t,timerType:i}}):e.set(t,setTimeout(o,r-s,e,t,r,i))};addEventListener("message",(i=>{let{data:s}=i;try{if("clear"===s.method){const{id:r,params:{timerId:o,timerType:i}}=s;if("interval"===i)(t=>{const r=e.get(t);if(void 0===r)throw new Error('There is no interval scheduled with the given id "'.concat(t,'".'));clearTimeout(r),e.delete(t)})(o),postMessage({error:null,id:r});else{if("timeout"!==i)throw new Error('The given type "'.concat(i,'" is not supported'));(e=>{const r=t.get(e);if(void 0===r)throw new Error('There is no timeout scheduled with the given id "'.concat(e,'".'));clearTimeout(r),t.delete(e)})(o),postMessage({error:null,id:r})}}else{if("set"!==s.method)throw new Error('The given method "'.concat(s.method,'" is not supported'));{const{params:{delay:i,now:n,timerId:a,timerType:d}}=s;if("interval"===d)((t,i,s)=>{const{expected:n,remainingDelay:a}=r(t,s);e.set(i,setTimeout(o,a,e,i,n,"interval"))})(i,a,n);else{if("timeout"!==d)throw new Error('The given type "'.concat(d,'" is not supported'));((e,i,s)=>{const{expected:n,remainingDelay:a}=r(e,s);t.set(i,setTimeout(o,a,t,i,n,"timeout"))})(i,a,n)}}}}catch(e){postMessage({error:{message:e.message},id:s.id,result:null})}}))})();`});var qp={};vs(qp,{clearInterval:()=>Ex,clearTimeout:()=>xx,setInterval:()=>Ox,setTimeout:()=>Tx});var Nn,Ex,xx,Ox,Tx,Dp=B(()=>{"use strict";Mp();Lp();jp();Nn=Bp(Rp,Np),Ex=t=>Nn().clearInterval(t),xx=t=>Nn().clearTimeout(t),Ox=(...t)=>Nn().setInterval(...t),Tx=(...t)=>Nn().setTimeout(...t)});var $p=S(nt=>{"use strict";var Ax=nt&&nt.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),kx=nt&&nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Ix=nt&&nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ax(e,t,r);return kx(e,t),e};Object.defineProperty(nt,"__esModule",{value:!0});var El=Ix(wi()),Wp=(Dp(),xs(qp)),Fp={set:Wp.setInterval,clear:Wp.clearInterval},Up={set:(t,e)=>setInterval(t,e),clear:t=>clearInterval(t)},Cx=t=>{switch(t){case"native":return Up;case"worker":return Fp;case"auto":default:return El.default&&!El.isWebWorker&&!El.isReactNativeBrowser?Fp:Up}};nt.default=Cx});var Ol=S(Si=>{"use strict";var Px=Si&&Si.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Si,"__esModule",{value:!0});var Rx=Px($p()),xl=class{get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}constructor(e,r){this.destroyed=!1,this.client=e,this.timer=typeof r=="object"&&"set"in r&&"clear"in r?r:(0,Rx.default)(r),this.setKeepalive(e.options.keepalive)}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(e){if(e*=1e3,isNaN(e)||e<=0||e>2147483647)throw new Error(`Keepalive value must be an integer between 0 and 2147483647. Provided value is ${e}`);this._keepalive=e,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${e}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let e=Math.ceil(this._keepalive*1.5);this._keepaliveTimeoutTimestamp=Date.now()+e,this._intervalEvery=Math.ceil(this._keepalive/2),this.timerId=this.timer.set(()=>{this.destroyed||(this.counter+=1,this.counter===2?this.client.sendPing():this.counter>2&&this.client.onKeepaliveTimeout())},this._intervalEvery)}};Si.default=xl});var Dn=S(Ce=>{"use strict";var Mx=Ce&&Ce.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Bx=Ce&&Ce.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gp=Ce&&Ce.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Mx(e,t,r);return Bx(e,t),e},Tt=Ce&&Ce.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ce,"__esModule",{value:!0});var Lx=Tt(uu()),Tl=Tt(Jh()),Nx=Tt(il()),jx=mt(),Vp=Tt(ed()),Kp=Gp(rd()),qx=Tt(De()),Mr=Tt(ol()),Dx=Tt(op()),jn=Vt(),Wx=lp(),Fx=Tt(Ol()),Hp=Gp(wi()),Al=globalThis.setImmediate||((...t)=>{let e=t.shift();(0,jn.nextTick)(()=>{e(...t)})}),zp={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0,timerVariant:"auto"},qn=class t extends Wx.TypedEventEmitter{static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(e,r){super(),this.options=r||{};for(let i in zp)typeof this.options[i]>"u"?this.options[i]=zp[i]:this.options[i]=r[i];this.log=this.options.log||(0,qx.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: version:",t.VERSION),Hp.isWebWorker?this.log("MqttClient :: environment","webworker"):this.log("MqttClient :: environment",Hp.default?"browser":"node"),this.log("MqttClient :: options.protocol",r.protocol),this.log("MqttClient :: options.protocolVersion",r.protocolVersion),this.log("MqttClient :: options.username",r.username),this.log("MqttClient :: options.keepalive",r.keepalive),this.log("MqttClient :: options.reconnectPeriod",r.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",r.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",r.properties?r.properties.topicAliasMaximum:void 0),this.options.clientId=typeof r.clientId=="string"?r.clientId:t.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=r.protocolVersion===5&&r.customHandleAcks?r.customHandleAcks:(...i)=>{i[3](null,0)},this.options.writeCache||(Tl.default.writeToStream.cacheNumbers=!1),this.streamBuilder=e,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new Nx.default:this.options.messageIdProvider,this.outgoingStore=r.outgoingStore||new Mr.default,this.incomingStore=r.incomingStore||new Mr.default,this.queueQoSZero=r.queueQoSZero===void 0?!0:r.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.keepaliveManager=null,this.connected=!1,this.disconnecting=!1,this.reconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,r.properties&&r.properties.topicAliasMaximum>0&&(r.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new Lx.default(r.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:i}=this,n=()=>{let s=i.shift();this.log("deliver :: entry %o",s);let o=null;if(!s){this._resubscribe();return}o=s.packet,this.log("deliver :: call _sendPacket for %o",o);let u=!0;o.messageId&&o.messageId!==0&&(this.messageIdProvider.register(o.messageId)||(u=!1)),u?this._sendPacket(o,a=>{s.cb&&s.cb(a),n()}):(this.log("messageId: %d has already used. The message is skipped and removed.",o.messageId),n())};this.log("connect :: sending queued packets"),n()}),this.on("close",()=>{this.log("close :: connected set to `false`"),this.connected=!1,this.log("close :: clearing connackTimer"),clearTimeout(this.connackTimer),this._destroyKeepaliveManager(),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log("close :: calling _setupReconnect"),this._setupReconnect()}),this.options.manualConnect||(this.log("MqttClient :: setting up stream"),this.connect())}handleAuth(e,r){r()}handleMessage(e,r){r()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var e;let r=new jx.Writable,i=Tl.default.parser(this.options),n=null,s=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new Mr.default,this.outgoingStore=this.options.outgoingStore||new Mr.default,this.disconnecting=!1,this.disconnected=!1),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),i.on("packet",c=>{this.log("parser :: on packet push to packets array."),s.push(c)});let o=()=>{this.log("work :: getting next packet in queue");let c=s.shift();if(c)this.log("work :: packet pulled from queue"),(0,Dx.default)(this,c,u);else{this.log("work :: no packets in queue");let f=n;n=null,this.log("work :: done flag is %s",!!f),f&&f()}},u=()=>{if(s.length)(0,jn.nextTick)(o);else{let c=n;n=null,c()}};r._write=(c,f,h)=>{n=h,this.log("writable stream :: parsing buffer"),i.parse(c),o()};let a=c=>{this.log("streamErrorHandler :: error",c.message),c.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",c)):this.noop(c)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(r),this.stream.on("error",a),this.stream.on("close",()=>{this.log("(%s)stream :: on close",this.options.clientId),this._flushVolatile(),this.log("stream: emit close to MqttClient"),this.emit("close")}),this.log("connect: sending packet `connect`");let l={cmd:"connect",protocolId:this.options.protocolId,protocolVersion:this.options.protocolVersion,clean:this.options.clean,clientId:this.options.clientId,keepalive:this.options.keepalive,username:this.options.username,password:this.options.password,properties:this.options.properties};if(this.options.will&&(l.will=Object.assign(Object.assign({},this.options.will),{payload:(e=this.options.will)===null||e===void 0?void 0:e.payload})),this.topicAliasRecv&&(l.properties||(l.properties={}),this.topicAliasRecv&&(l.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(l),i.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){let c=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(c)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(()=>{this.log("!!connectTimeout hit!! Calling _cleanUp with force `true`"),this.emit("error",new Error("connack timeout")),this._cleanUp(!0)},this.options.connectTimeout),this}publish(e,r,i,n){this.log("publish :: message `%s` to topic `%s`",r,e);let{options:s}=this;typeof i=="function"&&(n=i,i=null),i=i||{},i=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),i);let{qos:u,retain:a,dup:l,properties:c,cbStorePut:f}=i;if(this._checkDisconnecting(n))return this;let h=()=>{let p=0;if((u===1||u===2)&&(p=this._nextId(),p===null))return this.log("No messageId left"),!1;let d={cmd:"publish",topic:e,payload:r,qos:u,retain:a,messageId:p,dup:l};switch(s.protocolVersion===5&&(d.properties=c),this.log("publish :: qos",u),u){case 1:case 2:this.outgoing[d.messageId]={volatile:!1,cb:n||this.noop},this.log("MqttClient:publish: packet cmd: %s",d.cmd),this._sendPacket(d,void 0,f);break;default:this.log("MqttClient:publish: packet cmd: %s",d.cmd),this._sendPacket(d,n,f);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!h())&&this._storeProcessingQueue.push({invoke:h,cbStorePut:i.cbStorePut,callback:n}),this}publishAsync(e,r,i){return new Promise((n,s)=>{this.publish(e,r,i,(o,u)=>{o?s(o):n(u)})})}subscribe(e,r,i){let n=this.options.protocolVersion;typeof r=="function"&&(i=r),i=i||this.noop;let s=!1,o=[];typeof e=="string"?(e=[e],o=e):Array.isArray(e)?o=e:typeof e=="object"&&(s=e.resubscribe,delete e.resubscribe,o=Object.keys(e));let u=Kp.validateTopics(o);if(u!==null)return Al(i,new Error(`Invalid topic ${u}`)),this;if(this._checkDisconnecting(i))return this.log("subscribe: discconecting true"),this;let a={qos:0};n===5&&(a.nl=!1,a.rap=!1,a.rh=0),r=Object.assign(Object.assign({},a),r);let l=r.properties,c=[],f=(p,d)=>{if(d=d||r,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,p)||this._resubscribeTopics[p].qos<d.qos||s){let g={topic:p,qos:d.qos};n===5&&(g.nl=d.nl,g.rap=d.rap,g.rh=d.rh,g.properties=l),this.log("subscribe: pushing topic `%s` and qos `%s` to subs list",g.topic,g.qos),c.push(g)}};if(Array.isArray(e)?e.forEach(p=>{this.log("subscribe: array topic %s",p),f(p)}):Object.keys(e).forEach(p=>{this.log("subscribe: object topic %s, %o",p,e[p]),f(p,e[p])}),!c.length)return i(null,[]),this;let h=()=>{let p=this._nextId();if(p===null)return this.log("No messageId left"),!1;let d={cmd:"subscribe",subscriptions:c,messageId:p};if(l&&(d.properties=l),this.options.resubscribe){this.log("subscribe :: resubscribe true");let g=[];c.forEach(_=>{if(this.options.reconnectPeriod>0){let y={qos:_.qos};n===5&&(y.nl=_.nl||!1,y.rap=_.rap||!1,y.rh=_.rh||0,y.properties=_.properties),this._resubscribeTopics[_.topic]=y,g.push(_.topic)}}),this.messageIdToTopic[d.messageId]=g}return this.outgoing[d.messageId]={volatile:!0,cb(g,_){if(!g){let{granted:y}=_;for(let b=0;b<y.length;b+=1)c[b].qos=y[b]}i(g,c,_)}},this.log("subscribe :: call _sendPacket"),this._sendPacket(d),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!h())&&this._storeProcessingQueue.push({invoke:h,callback:i}),this}subscribeAsync(e,r){return new Promise((i,n)=>{this.subscribe(e,r,(s,o)=>{s?n(s):i(o)})})}unsubscribe(e,r,i){typeof e=="string"&&(e=[e]),typeof r=="function"&&(i=r),i=i||this.noop;let n=Kp.validateTopics(e);if(n!==null)return Al(i,new Error(`Invalid topic ${n}`)),this;if(this._checkDisconnecting(i))return this;let s=()=>{let o=this._nextId();if(o===null)return this.log("No messageId left"),!1;let u={cmd:"unsubscribe",messageId:o,unsubscriptions:[]};return typeof e=="string"?u.unsubscriptions=[e]:Array.isArray(e)&&(u.unsubscriptions=e),this.options.resubscribe&&u.unsubscriptions.forEach(a=>{delete this._resubscribeTopics[a]}),typeof r=="object"&&r.properties&&(u.properties=r.properties),this.outgoing[u.messageId]={volatile:!0,cb:i},this.log("unsubscribe: call _sendPacket"),this._sendPacket(u),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!s())&&this._storeProcessingQueue.push({invoke:s,callback:i}),this}unsubscribeAsync(e,r){return new Promise((i,n)=>{this.unsubscribe(e,r,(s,o)=>{s?n(s):i(o)})})}end(e,r,i){this.log("end :: (%s)",this.options.clientId),(e==null||typeof e!="boolean")&&(i=i||r,r=e,e=!1),typeof r!="object"&&(i=i||r,r=null),this.log("end :: cb? %s",!!i),(!i||typeof i!="function")&&(i=this.noop);let n=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(o=>{this.outgoingStore.close(u=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),i){let a=o||u;this.log("end :: closeStores: invoking callback with args"),i(a)}})}),this._deferredReconnect?this._deferredReconnect():(this.options.reconnectPeriod===0||this.options.manualConnect)&&(this.disconnecting=!1)},s=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,e),this._cleanUp(e,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,jn.nextTick)(n)},r)};return this.disconnecting?(i(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(this.log("end :: (%s) :: calling finish in 10ms once outgoing is empty",this.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,s,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),s()),this)}endAsync(e,r){return new Promise((i,n)=>{this.end(e,r,s=>{s?n(s):i()})})}removeOutgoingMessage(e){if(this.outgoing[e]){let{cb:r}=this.outgoing[e];this._removeOutgoingAndStoreMessage(e,()=>{r(new Error("Message removed"))})}return this}reconnect(e){this.log("client reconnect");let r=()=>{e?(this.options.incomingStore=e.incomingStore,this.options.outgoingStore=e.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new Mr.default,this.outgoingStore=this.options.outgoingStore||new Mr.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this}_flushVolatile(){this.outgoing&&(this.log("_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(this.outgoing).forEach(e=>{this.outgoing[e].volatile&&typeof this.outgoing[e].cb=="function"&&(this.outgoing[e].cb(new Error("Connection closed")),delete this.outgoing[e])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(e=>{typeof this.outgoing[e].cb=="function"&&(this.outgoing[e].cb(new Error("Connection closed")),delete this.outgoing[e])}))}_removeTopicAliasAndRecoverTopicName(e){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",r,i),i.length===0){if(typeof r>"u")return new Error("Unregistered Topic Alias");if(i=this.topicAliasSend.getTopicByAlias(r),typeof i>"u")return new Error("Unregistered Topic Alias");e.topic=i}r&&delete e.properties.topicAlias}_checkDisconnecting(e){return this.disconnecting&&(e&&e!==this.noop?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting}_reconnect(){this.log("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this.connect()}),this.log("client already connected. disconnecting first.")):(this.log("_reconnect: calling connect"),this.connect())}_setupReconnect(){!this.disconnecting&&!this.reconnectTimer&&this.options.reconnectPeriod>0?(this.reconnecting||(this.log("_setupReconnect :: emit `offline` state"),this.emit("offline"),this.log("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),this.log("_setupReconnect :: setting reconnectTimer for %d ms",this.options.reconnectPeriod),this.reconnectTimer=setInterval(()=>{this.log("reconnectTimer :: reconnect triggered!"),this._reconnect()},this.options.reconnectPeriod)):this.log("_setupReconnect :: doing nothing...")}_clearReconnect(){this.log("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)}_cleanUp(e,r,i={}){if(r&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",r)),this.log("_cleanUp :: forced? %s",e),e)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let n=Object.assign({cmd:"disconnect"},i);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(n,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),Al(()=>{this.stream.end(()=>{this.log("_cleanUp :: (%s) :: stream destroyed",this.options.clientId)})})})}!this.disconnecting&&!this.reconnecting&&(this.log("_cleanUp :: client not disconnecting/reconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this._destroyKeepaliveManager(),r&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",r),r())}_storeAndSend(e,r,i){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",e.cmd);let n=e,s;if(n.cmd==="publish"&&(n=(0,Vp.default)(e),s=this._removeTopicAliasAndRecoverTopicName(n),s))return r&&r(s);this.outgoingStore.put(n,o=>{if(o)return r&&r(o);i(),this._writePacket(e,r)})}_applyTopicAlias(e){if(this.options.protocolVersion===5&&e.cmd==="publish"){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.topicAliasSend)if(r){if(i.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",i,r),!this.topicAliasSend.put(i,r)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}else i.length!==0&&(this.options.autoAssignTopicAlias?(r=this.topicAliasSend.getAliasByTopic(i),r?(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",i,r)):(r=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(i,r),e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",i,r))):this.options.autoUseTopicAlias&&(r=this.topicAliasSend.getAliasByTopic(i),r&&(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto use topic: %s - alias: %d",i,r))));else if(r)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}}_noop(e){this.log("noop ::",e)}_writePacket(e,r){this.log("_writePacket :: packet: %O",e),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",e),this.log("_writePacket :: writing to stream");let i=Tl.default.writeToStream(e,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",i),!i&&r&&r!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",r)):r&&(this.log("_writePacket :: invoking cb"),r())}_sendPacket(e,r,i,n){this.log("_sendPacket :: (%s) :: start",this.options.clientId),i=i||this.noop,r=r||this.noop;let s=this._applyTopicAlias(e);if(s){r(s);return}if(!this.connected){if(e.cmd==="auth"){this._writePacket(e,r);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(e,r,i);return}if(n){this._writePacket(e,r);return}switch(e.cmd){case"publish":break;case"pubrel":this._storeAndSend(e,r,i);return;default:this._writePacket(e,r);return}switch(e.qos){case 2:case 1:this._storeAndSend(e,r,i);break;case 0:default:this._writePacket(e,r);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(e,r,i){this.log("_storePacket :: packet: %o",e),this.log("_storePacket :: cb? %s",!!r),i=i||this.noop;let n=e;if(n.cmd==="publish"){n=(0,Vp.default)(e);let o=this._removeTopicAliasAndRecoverTopicName(n);if(o)return r&&r(o)}let s=n.qos||0;s===0&&this.queueQoSZero||n.cmd!=="publish"?this.queue.push({packet:n,cb:r}):s>0?(r=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,o=>{if(o)return r&&r(o);i()})):r&&r(new Error("No connection to broker"))}_setupKeepaliveManager(){this.log("_setupKeepaliveManager :: keepalive %d (seconds)",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new Fx.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log("_destroyKeepaliveManager :: destroying keepalive manager"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(e=!1){this.keepaliveManager&&this.options.keepalive&&(e||this.options.reschedulePings)&&this._reschedulePing()}_reschedulePing(){this.log("_reschedulePing :: rescheduling ping"),this.keepaliveManager.reschedule()}sendPing(){this.log("_sendPing :: sending pingreq"),this._sendPacket({cmd:"pingreq"})}onKeepaliveTimeout(){this.emit("error",new Error("Keepalive timeout")),this.log("onKeepaliveTimeout :: calling _cleanUp with force true"),this._cleanUp(!0)}_resubscribe(){this.log("_resubscribe");let e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let r=0;r<e.length;r++){let i={};i[e[r]]=this._resubscribeTopics[e[r]],i.resubscribe=!0,this.subscribe(i,{properties:i[e[r]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1}_onConnect(e){if(this.disconnected){this.emit("connect",e);return}this.connackPacket=e,this.messageIdProvider.clear(),this._setupKeepaliveManager(),this.connected=!0;let r=()=>{let i=this.outgoingStore.createStream(),n=()=>{i.destroy(),i=null,this._flushStoreProcessingQueue(),s()},s=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",n),i.on("error",u=>{s(),this._flushStoreProcessingQueue(),this.removeListener("close",n),this.emit("error",u)});let o=()=>{if(!i)return;let u=i.read(1),a;if(!u){i.once("readable",o);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[u.messageId]){o();return}!this.disconnecting&&!this.reconnectTimer?(a=this.outgoing[u.messageId]?this.outgoing[u.messageId].cb:null,this.outgoing[u.messageId]={volatile:!1,cb(l,c){a&&a(l,c),o()}},this._packetIdsDuringStoreProcessing[u.messageId]=!0,this.messageIdProvider.register(u.messageId)?this._sendPacket(u,void 0,void 0,!0):this.log("messageId: %d has already used.",u.messageId)):i.destroy&&i.destroy()};i.on("end",()=>{let u=!0;for(let a in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[a]){u=!1;break}this.removeListener("close",n),u?(s(),this._invokeAllStoreProcessingQueue(),this.emit("connect",e)):r()}),o()};r()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error("Connection closed")),e.callback&&e.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(e,r){delete this.outgoing[e],this.outgoingStore.del({messageId:e},(i,n)=>{r(i,n),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue()})}};qn.VERSION=jn.MQTTJS_VERSION;Ce.default=qn});var Qp=S(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});var Ux=ml(),kl=class{constructor(){this.numberAllocator=new Ux.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(e){return this.numberAllocator.use(e)}deallocate(e){this.numberAllocator.free(e)}clear(){this.numberAllocator.clear()}};Il.default=kl});var st=S((pL,Xp)=>{"use strict";var Jp=["nodebuffer","arraybuffer","fragments"],Yp=typeof Blob<"u";Yp&&Jp.push("blob");Xp.exports={BINARY_TYPES:Jp,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Yp,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var vi=S((gL,Wn)=>{"use strict";var{EMPTY_BUFFER:$x}=st(),Cl=Buffer[Symbol.species];function Vx(t,e){if(t.length===0)return $x;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),i=0;for(let n=0;n<t.length;n++){let s=t[n];r.set(s,i),i+=s.length}return i<e?new Cl(r.buffer,r.byteOffset,i):r}function Zp(t,e,r,i,n){for(let s=0;s<n;s++)r[i+s]=t[s]^e[s&3]}function eg(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function Kx(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function Pl(t){if(Pl.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Cl(t):ArrayBuffer.isView(t)?e=new Cl(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),Pl.readOnly=!1),e}Wn.exports={concat:Vx,mask:Zp,toArrayBuffer:Kx,toBuffer:Pl,unmask:eg};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=require("bufferutil");Wn.exports.mask=function(e,r,i,n,s){s<48?Zp(e,r,i,n,s):t.mask(e,r,i,n,s)},Wn.exports.unmask=function(e,r){e.length<32?eg(e,r):t.unmask(e,r)}}catch{}});var ig=S((yL,rg)=>{"use strict";var tg=Symbol("kDone"),Rl=Symbol("kRun"),Ml=class{constructor(e){this[tg]=()=>{this.pending--,this[Rl]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Rl]()}[Rl](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[tg])}}};rg.exports=Ml});var Oi=S((_L,lg)=>{"use strict";var Ei=require("zlib"),ng=vi(),Hx=ig(),{kStatusCode:sg}=st(),zx=Buffer[Symbol.species],Gx=Buffer.from([0,0,255,255]),$n=Symbol("permessage-deflate"),ot=Symbol("total-length"),xi=Symbol("callback"),At=Symbol("buffers"),Un=Symbol("error"),Fn,Bl=class{constructor(e,r,i){if(this._maxPayload=i|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!r,this._deflate=null,this._inflate=null,this.params=null,!Fn){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Fn=new Hx(n)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[xi];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,i=e.find(n=>!(r.serverNoContextTakeover===!1&&n.server_no_context_takeover||n.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>n.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!n.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(i.server_no_context_takeover=!0),r.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(i.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?i.client_max_window_bits=r.clientMaxWindowBits:(i.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(i=>{let n=r[i];if(n.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(n=n[0],i==="client_max_window_bits"){if(n!==!0){let s=+n;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${i}": ${n}`);n=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${n}`)}else if(i==="server_max_window_bits"){let s=+n;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${i}": ${n}`);n=s}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(n!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${n}`)}else throw new Error(`Unknown parameter "${i}"`);r[i]=n})}),e}decompress(e,r,i){Fn.add(n=>{this._decompress(e,r,(s,o)=>{n(),i(s,o)})})}compress(e,r,i){Fn.add(n=>{this._compress(e,r,(s,o)=>{n(),i(s,o)})})}_decompress(e,r,i){let n=this._isServer?"client":"server";if(!this._inflate){let s=`${n}_max_window_bits`,o=typeof this.params[s]!="number"?Ei.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Ei.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[$n]=this,this._inflate[ot]=0,this._inflate[At]=[],this._inflate.on("error",Jx),this._inflate.on("data",og)}this._inflate[xi]=i,this._inflate.write(e),r&&this._inflate.write(Gx),this._inflate.flush(()=>{let s=this._inflate[Un];if(s){this._inflate.close(),this._inflate=null,i(s);return}let o=ng.concat(this._inflate[At],this._inflate[ot]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ot]=0,this._inflate[At]=[],r&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),i(null,o)})}_compress(e,r,i){let n=this._isServer?"server":"client";if(!this._deflate){let s=`${n}_max_window_bits`,o=typeof this.params[s]!="number"?Ei.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Ei.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[ot]=0,this._deflate[At]=[],this._deflate.on("data",Qx)}this._deflate[xi]=i,this._deflate.write(e),this._deflate.flush(Ei.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=ng.concat(this._deflate[At],this._deflate[ot]);r&&(s=new zx(s.buffer,s.byteOffset,s.length-4)),this._deflate[xi]=null,this._deflate[ot]=0,this._deflate[At]=[],r&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),i(null,s)})}};lg.exports=Bl;function Qx(t){this[At].push(t),this[ot]+=t.length}function og(t){if(this[ot]+=t.length,this[$n]._maxPayload<1||this[ot]<=this[$n]._maxPayload){this[At].push(t);return}this[Un]=new RangeError("Max payload size exceeded"),this[Un].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Un][sg]=1009,this.removeListener("data",og),this.reset()}function Jx(t){this[$n]._inflate=null,t[sg]=1007,this[xi](t)}});var Br=S((bL,Vn)=>{"use strict";var{isUtf8:ag}=require("buffer"),{hasBlob:Yx}=st(),Xx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Zx(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Ll(t){let e=t.length,r=0;for(;r<e;)if(!(t[r]&128))r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function eO(t){return Yx&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}Vn.exports={isBlob:eO,isValidStatusCode:Zx,isValidUTF8:Ll,tokenChars:Xx};if(ag)Vn.exports.isValidUTF8=function(t){return t.length<24?Ll(t):ag(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=require("utf-8-validate");Vn.exports.isValidUTF8=function(e){return e.length<32?Ll(e):t(e)}}catch{}});var Wl=S((mL,gg)=>{"use strict";var{Writable:tO}=require("stream"),ug=Oi(),{BINARY_TYPES:rO,EMPTY_BUFFER:cg,kStatusCode:iO,kWebSocket:nO}=st(),{concat:Nl,toArrayBuffer:sO,unmask:oO}=vi(),{isValidStatusCode:lO,isValidUTF8:fg}=Br(),Kn=Buffer[Symbol.species],ve=0,hg=1,dg=2,pg=3,jl=4,ql=5,Hn=6,Dl=class extends tO{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||rO[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[nO]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=ve}_write(e,r,i){if(this._opcode===8&&this._state==ve)return i();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(i)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let i=this._buffers[0];return this._buffers[0]=new Kn(i.buffer,i.byteOffset+e,i.length-e),new Kn(i.buffer,i.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let i=this._buffers[0],n=r.length-e;e>=i.length?r.set(this._buffers.shift(),n):(r.set(new Uint8Array(i.buffer,i.byteOffset,e),n),this._buffers[0]=new Kn(i.buffer,i.byteOffset+e,i.length-e)),e-=i.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case ve:this.getInfo(e);break;case hg:this.getPayloadLength16(e);break;case dg:this.getPayloadLength64(e);break;case pg:this.getMask();break;case jl:this.getData(e);break;case ql:case Hn:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if(r[0]&48){let n=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(n);return}let i=(r[0]&64)===64;if(i&&!this._extensions[ug.extensionName]){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(i){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(!this._fragmented){let n=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let n=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let n=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(n);return}if(i){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let n=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(n);return}}else{let n=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let n=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(n);return}}else if(this._masked){let n=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(n);return}this._payloadLength===126?this._state=hg:this._payloadLength===127?this._state=dg:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),i=r.readUInt32BE(0);if(i>Math.pow(2,21)-1){let n=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(n);return}this._payloadLength=i*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=pg:this._state=jl}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=jl}getData(e){let r=cg;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&oO(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=ql,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[ug.extensionName].decompress(e,this._fin,(n,s)=>{if(n)return r(n);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(o);return}this._fragments.push(s)}this.dataMessage(r),this._state===ve&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=ve;return}let r=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let n;this._binaryType==="nodebuffer"?n=Nl(i,r):this._binaryType==="arraybuffer"?n=sO(Nl(i,r)):this._binaryType==="blob"?n=new Blob(i):n=i,this._allowSynchronousEvents?(this.emit("message",n,!0),this._state=ve):(this._state=Hn,setImmediate(()=>{this.emit("message",n,!0),this._state=ve,this.startLoop(e)}))}else{let n=Nl(i,r);if(!this._skipUTF8Validation&&!fg(n)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===ql||this._allowSynchronousEvents?(this.emit("message",n,!1),this._state=ve):(this._state=Hn,setImmediate(()=>{this.emit("message",n,!1),this._state=ve,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,cg),this.end();else{let i=e.readUInt16BE(0);if(!lO(i)){let s=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let n=new Kn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!fg(n)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(s);return}this._loop=!1,this.emit("conclude",i,n),this.end()}this._state=ve;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=ve):(this._state=Hn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=ve,this.startLoop(r)}))}createError(e,r,i,n,s){this._loop=!1,this._errored=!0;let o=new e(i?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(o,this.createError),o.code=s,o[iO]=n,o}};gg.exports=Dl});var $l=S((SL,bg)=>{"use strict";var{Duplex:wL}=require("stream"),{randomFillSync:aO}=require("crypto"),yg=Oi(),{EMPTY_BUFFER:uO,kWebSocket:cO,NOOP:fO}=st(),{isBlob:Lr,isValidStatusCode:hO}=Br(),{mask:_g,toBuffer:Gt}=vi(),Ee=Symbol("kByteLength"),dO=Buffer.alloc(4),zn=8*1024,Qt,Nr=zn,Pe=0,pO=1,gO=2,Fl=class t{constructor(e,r,i){this._extensions=r||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Pe,this.onerror=fO,this[cO]=void 0}static frame(e,r){let i,n=!1,s=2,o=!1;r.mask&&(i=r.maskBuffer||dO,r.generateMask?r.generateMask(i):(Nr===zn&&(Qt===void 0&&(Qt=Buffer.alloc(zn)),aO(Qt,0,zn),Nr=0),i[0]=Qt[Nr++],i[1]=Qt[Nr++],i[2]=Qt[Nr++],i[3]=Qt[Nr++]),o=(i[0]|i[1]|i[2]|i[3])===0,s=6);let u;typeof e=="string"?(!r.mask||o)&&r[Ee]!==void 0?u=r[Ee]:(e=Buffer.from(e),u=e.length):(u=e.length,n=r.mask&&r.readOnly&&!o);let a=u;u>=65536?(s+=8,a=127):u>125&&(s+=2,a=126);let l=Buffer.allocUnsafe(n?u+s:s);return l[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(l[0]|=64),l[1]=a,a===126?l.writeUInt16BE(u,2):a===127&&(l[2]=l[3]=0,l.writeUIntBE(u,4,6)),r.mask?(l[1]|=128,l[s-4]=i[0],l[s-3]=i[1],l[s-2]=i[2],l[s-1]=i[3],o?[l,e]:n?(_g(e,i,l,s,u),[l]):(_g(e,i,e,0,u),[l,e])):[l,e]}close(e,r,i,n){let s;if(e===void 0)s=uO;else{if(typeof e!="number"||!hO(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let u=Buffer.byteLength(r);if(u>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+u),s.writeUInt16BE(e,0),typeof r=="string"?s.write(r,2):s.set(r,2)}}let o={[Ee]:s.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Pe?this.enqueue([this.dispatch,s,!1,o,n]):this.sendFrame(t.frame(s,o),n)}ping(e,r,i){let n,s;if(typeof e=="string"?(n=Buffer.byteLength(e),s=!1):Lr(e)?(n=e.size,s=!1):(e=Gt(e),n=e.length,s=Gt.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[Ee]:n,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};Lr(e)?this._state!==Pe?this.enqueue([this.getBlobData,e,!1,o,i]):this.getBlobData(e,!1,o,i):this._state!==Pe?this.enqueue([this.dispatch,e,!1,o,i]):this.sendFrame(t.frame(e,o),i)}pong(e,r,i){let n,s;if(typeof e=="string"?(n=Buffer.byteLength(e),s=!1):Lr(e)?(n=e.size,s=!1):(e=Gt(e),n=e.length,s=Gt.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[Ee]:n,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};Lr(e)?this._state!==Pe?this.enqueue([this.getBlobData,e,!1,o,i]):this.getBlobData(e,!1,o,i):this._state!==Pe?this.enqueue([this.dispatch,e,!1,o,i]):this.sendFrame(t.frame(e,o),i)}send(e,r,i){let n=this._extensions[yg.extensionName],s=r.binary?2:1,o=r.compress,u,a;typeof e=="string"?(u=Buffer.byteLength(e),a=!1):Lr(e)?(u=e.size,a=!1):(e=Gt(e),u=e.length,a=Gt.readOnly),this._firstFragment?(this._firstFragment=!1,o&&n&&n.params[n._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=u>=n._threshold),this._compress=o):(o=!1,s=0),r.fin&&(this._firstFragment=!0);let l={[Ee]:u,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:a,rsv1:o};Lr(e)?this._state!==Pe?this.enqueue([this.getBlobData,e,this._compress,l,i]):this.getBlobData(e,this._compress,l,i):this._state!==Pe?this.enqueue([this.dispatch,e,this._compress,l,i]):this.dispatch(e,this._compress,l,i)}getBlobData(e,r,i,n){this._bufferedBytes+=i[Ee],this._state=gO,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let u=new Error("The socket was closed while the blob was being read");process.nextTick(Ul,this,u,n);return}this._bufferedBytes-=i[Ee];let o=Gt(s);r?this.dispatch(o,r,i,n):(this._state=Pe,this.sendFrame(t.frame(o,i),n),this.dequeue())}).catch(s=>{process.nextTick(yO,this,s,n)})}dispatch(e,r,i,n){if(!r){this.sendFrame(t.frame(e,i),n);return}let s=this._extensions[yg.extensionName];this._bufferedBytes+=i[Ee],this._state=pO,s.compress(e,i.fin,(o,u)=>{if(this._socket.destroyed){let a=new Error("The socket was closed while data was being compressed");Ul(this,a,n);return}this._bufferedBytes-=i[Ee],this._state=Pe,i.readOnly=!1,this.sendFrame(t.frame(u,i),n),this.dequeue()})}dequeue(){for(;this._state===Pe&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][Ee],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][Ee],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};bg.exports=Fl;function Ul(t,e,r){typeof r=="function"&&r(e);for(let i=0;i<t._queue.length;i++){let n=t._queue[i],s=n[n.length-1];typeof s=="function"&&s(e)}}function yO(t,e,r){Ul(t,e,r),t.onerror(e)}});var Ag=S((vL,Tg)=>{"use strict";var{kForOnEventAttribute:Ti,kListener:Vl}=st(),mg=Symbol("kCode"),wg=Symbol("kData"),Sg=Symbol("kError"),vg=Symbol("kMessage"),Eg=Symbol("kReason"),jr=Symbol("kTarget"),xg=Symbol("kType"),Og=Symbol("kWasClean"),lt=class{constructor(e){this[jr]=null,this[xg]=e}get target(){return this[jr]}get type(){return this[xg]}};Object.defineProperty(lt.prototype,"target",{enumerable:!0});Object.defineProperty(lt.prototype,"type",{enumerable:!0});var Jt=class extends lt{constructor(e,r={}){super(e),this[mg]=r.code===void 0?0:r.code,this[Eg]=r.reason===void 0?"":r.reason,this[Og]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[mg]}get reason(){return this[Eg]}get wasClean(){return this[Og]}};Object.defineProperty(Jt.prototype,"code",{enumerable:!0});Object.defineProperty(Jt.prototype,"reason",{enumerable:!0});Object.defineProperty(Jt.prototype,"wasClean",{enumerable:!0});var qr=class extends lt{constructor(e,r={}){super(e),this[Sg]=r.error===void 0?null:r.error,this[vg]=r.message===void 0?"":r.message}get error(){return this[Sg]}get message(){return this[vg]}};Object.defineProperty(qr.prototype,"error",{enumerable:!0});Object.defineProperty(qr.prototype,"message",{enumerable:!0});var Ai=class extends lt{constructor(e,r={}){super(e),this[wg]=r.data===void 0?null:r.data}get data(){return this[wg]}};Object.defineProperty(Ai.prototype,"data",{enumerable:!0});var _O={addEventListener(t,e,r={}){for(let n of this.listeners(t))if(!r[Ti]&&n[Vl]===e&&!n[Ti])return;let i;if(t==="message")i=function(s,o){let u=new Ai("message",{data:o?s:s.toString()});u[jr]=this,Gn(e,this,u)};else if(t==="close")i=function(s,o){let u=new Jt("close",{code:s,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});u[jr]=this,Gn(e,this,u)};else if(t==="error")i=function(s){let o=new qr("error",{error:s,message:s.message});o[jr]=this,Gn(e,this,o)};else if(t==="open")i=function(){let s=new lt("open");s[jr]=this,Gn(e,this,s)};else return;i[Ti]=!!r[Ti],i[Vl]=e,r.once?this.once(t,i):this.on(t,i)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[Vl]===e&&!r[Ti]){this.removeListener(t,r);break}}};Tg.exports={CloseEvent:Jt,ErrorEvent:qr,Event:lt,EventTarget:_O,MessageEvent:Ai};function Gn(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var Kl=S((EL,kg)=>{"use strict";var{tokenChars:ki}=Br();function Ke(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function bO(t){let e=Object.create(null),r=Object.create(null),i=!1,n=!1,s=!1,o,u,a=-1,l=-1,c=-1,f=0;for(;f<t.length;f++)if(l=t.charCodeAt(f),o===void 0)if(c===-1&&ki[l]===1)a===-1&&(a=f);else if(f!==0&&(l===32||l===9))c===-1&&a!==-1&&(c=f);else if(l===59||l===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${f}`);c===-1&&(c=f);let p=t.slice(a,c);l===44?(Ke(e,p,r),r=Object.create(null)):o=p,a=c=-1}else throw new SyntaxError(`Unexpected character at index ${f}`);else if(u===void 0)if(c===-1&&ki[l]===1)a===-1&&(a=f);else if(l===32||l===9)c===-1&&a!==-1&&(c=f);else if(l===59||l===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${f}`);c===-1&&(c=f),Ke(r,t.slice(a,c),!0),l===44&&(Ke(e,o,r),r=Object.create(null),o=void 0),a=c=-1}else if(l===61&&a!==-1&&c===-1)u=t.slice(a,f),a=c=-1;else throw new SyntaxError(`Unexpected character at index ${f}`);else if(n){if(ki[l]!==1)throw new SyntaxError(`Unexpected character at index ${f}`);a===-1?a=f:i||(i=!0),n=!1}else if(s)if(ki[l]===1)a===-1&&(a=f);else if(l===34&&a!==-1)s=!1,c=f;else if(l===92)n=!0;else throw new SyntaxError(`Unexpected character at index ${f}`);else if(l===34&&t.charCodeAt(f-1)===61)s=!0;else if(c===-1&&ki[l]===1)a===-1&&(a=f);else if(a!==-1&&(l===32||l===9))c===-1&&(c=f);else if(l===59||l===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${f}`);c===-1&&(c=f);let p=t.slice(a,c);i&&(p=p.replace(/\\/g,""),i=!1),Ke(r,u,p),l===44&&(Ke(e,o,r),r=Object.create(null),o=void 0),u=void 0,a=c=-1}else throw new SyntaxError(`Unexpected character at index ${f}`);if(a===-1||s||l===32||l===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=f);let h=t.slice(a,c);return o===void 0?Ke(e,h,r):(u===void 0?Ke(r,h,!0):i?Ke(r,u,h.replace(/\\/g,"")):Ke(r,u,h),Ke(e,o,r)),e}function mO(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(i=>[e].concat(Object.keys(i).map(n=>{let s=i[n];return Array.isArray(s)||(s=[s]),s.map(o=>o===!0?n:`${n}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}kg.exports={format:mO,parse:bO}});var Jl=S((TL,Wg)=>{"use strict";var wO=require("events"),SO=require("https"),vO=require("http"),Pg=require("net"),EO=require("tls"),{randomBytes:xO,createHash:OO}=require("crypto"),{Duplex:xL,Readable:OL}=require("stream"),{URL:Hl}=require("url"),kt=Oi(),TO=Wl(),AO=$l(),{isBlob:kO}=Br(),{BINARY_TYPES:Ig,EMPTY_BUFFER:Qn,GUID:IO,kForOnEventAttribute:zl,kListener:CO,kStatusCode:PO,kWebSocket:te,NOOP:Rg}=st(),{EventTarget:{addEventListener:RO,removeEventListener:MO}}=Ag(),{format:BO,parse:LO}=Kl(),{toBuffer:NO}=vi(),jO=30*1e3,Mg=Symbol("kAborted"),Gl=[8,13],at=["CONNECTING","OPEN","CLOSING","CLOSED"],qO=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,K=class t extends wO{constructor(e,r,i){super(),this._binaryType=Ig[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Qn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(i=r,r=[]):r=[r]),Bg(this,e,r,i)):(this._autoPong=i.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Ig.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,i){let n=new TO({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation}),s=new AO(e,this._extensions,i.generateMask);this._receiver=n,this._sender=s,this._socket=e,n[te]=this,s[te]=this,e[te]=this,n.on("conclude",FO),n.on("drain",UO),n.on("error",$O),n.on("message",VO),n.on("ping",KO),n.on("pong",HO),s.onerror=zO,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",jg),e.on("data",Yn),e.on("end",qg),e.on("error",Dg),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[kt.extensionName]&&this._extensions[kt.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){ge(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Ng(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,i){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=r=void 0):typeof r=="function"&&(i=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Ql(this,e,i);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||Qn,r,i)}pong(e,r,i){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=r=void 0):typeof r=="function"&&(i=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Ql(this,e,i);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||Qn,r,i)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,i){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(i=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Ql(this,e,i);return}let n={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[kt.extensionName]||(n.compress=!1),this._sender.send(e||Qn,n,i)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){ge(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(K,"CONNECTING",{enumerable:!0,value:at.indexOf("CONNECTING")});Object.defineProperty(K.prototype,"CONNECTING",{enumerable:!0,value:at.indexOf("CONNECTING")});Object.defineProperty(K,"OPEN",{enumerable:!0,value:at.indexOf("OPEN")});Object.defineProperty(K.prototype,"OPEN",{enumerable:!0,value:at.indexOf("OPEN")});Object.defineProperty(K,"CLOSING",{enumerable:!0,value:at.indexOf("CLOSING")});Object.defineProperty(K.prototype,"CLOSING",{enumerable:!0,value:at.indexOf("CLOSING")});Object.defineProperty(K,"CLOSED",{enumerable:!0,value:at.indexOf("CLOSED")});Object.defineProperty(K.prototype,"CLOSED",{enumerable:!0,value:at.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(K.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(K.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[zl])return e[CO];return null},set(e){for(let r of this.listeners(t))if(r[zl]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[zl]:!0})}})});K.prototype.addEventListener=RO;K.prototype.removeEventListener=MO;Wg.exports=K;function Bg(t,e,r,i){let n={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Gl[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...i,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=n.autoPong,!Gl.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${Gl.join(", ")})`);let s;if(e instanceof Hl)s=e;else try{s=new Hl(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),t._url=s.href;let o=s.protocol==="wss:",u=s.protocol==="ws+unix:",a;if(s.protocol!=="ws:"&&!o&&!u?a=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:u&&!s.pathname?a="The URL's pathname is empty":s.hash&&(a="The URL contains a fragment identifier"),a){let g=new SyntaxError(a);if(t._redirects===0)throw g;Jn(t,g);return}let l=o?443:80,c=xO(16).toString("base64"),f=o?SO.request:vO.request,h=new Set,p;if(n.createConnection=n.createConnection||(o?WO:DO),n.defaultPort=n.defaultPort||l,n.port=s.port||l,n.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,n.headers={...n.headers,"Sec-WebSocket-Version":n.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"},n.path=s.pathname+s.search,n.timeout=n.handshakeTimeout,n.perMessageDeflate&&(p=new kt(n.perMessageDeflate!==!0?n.perMessageDeflate:{},!1,n.maxPayload),n.headers["Sec-WebSocket-Extensions"]=BO({[kt.extensionName]:p.offer()})),r.length){for(let g of r){if(typeof g!="string"||!qO.test(g)||h.has(g))throw new SyntaxError("An invalid or duplicated subprotocol was specified");h.add(g)}n.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(n.origin&&(n.protocolVersion<13?n.headers["Sec-WebSocket-Origin"]=n.origin:n.headers.Origin=n.origin),(s.username||s.password)&&(n.auth=`${s.username}:${s.password}`),u){let g=n.path.split(":");n.socketPath=g[0],n.path=g[1]}let d;if(n.followRedirects){if(t._redirects===0){t._originalIpc=u,t._originalSecure=o,t._originalHostOrSocketPath=u?n.socketPath:s.host;let g=i&&i.headers;if(i={...i,headers:{}},g)for(let[_,y]of Object.entries(g))i.headers[_.toLowerCase()]=y}else if(t.listenerCount("redirect")===0){let g=u?t._originalIpc?n.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:s.host===t._originalHostOrSocketPath;(!g||t._originalSecure&&!o)&&(delete n.headers.authorization,delete n.headers.cookie,g||delete n.headers.host,n.auth=void 0)}n.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(n.auth).toString("base64")),d=t._req=f(n),t._redirects&&t.emit("redirect",t.url,d)}else d=t._req=f(n);n.timeout&&d.on("timeout",()=>{ge(t,d,"Opening handshake has timed out")}),d.on("error",g=>{d===null||d[Mg]||(d=t._req=null,Jn(t,g))}),d.on("response",g=>{let _=g.headers.location,y=g.statusCode;if(_&&n.followRedirects&&y>=300&&y<400){if(++t._redirects>n.maxRedirects){ge(t,d,"Maximum redirects exceeded");return}d.abort();let b;try{b=new Hl(_,e)}catch{let w=new SyntaxError(`Invalid URL: ${_}`);Jn(t,w);return}Bg(t,b,r,i)}else t.emit("unexpected-response",d,g)||ge(t,d,`Unexpected server response: ${g.statusCode}`)}),d.on("upgrade",(g,_,y)=>{if(t.emit("upgrade",g),t.readyState!==K.CONNECTING)return;d=t._req=null;let b=g.headers.upgrade;if(b===void 0||b.toLowerCase()!=="websocket"){ge(t,_,"Invalid Upgrade header");return}let m=OO("sha1").update(c+IO).digest("base64");if(g.headers["sec-websocket-accept"]!==m){ge(t,_,"Invalid Sec-WebSocket-Accept header");return}let w=g.headers["sec-websocket-protocol"],E;if(w!==void 0?h.size?h.has(w)||(E="Server sent an invalid subprotocol"):E="Server sent a subprotocol but none was requested":h.size&&(E="Server sent no subprotocol"),E){ge(t,_,E);return}w&&(t._protocol=w);let A=g.headers["sec-websocket-extensions"];if(A!==void 0){if(!p){ge(t,_,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let T;try{T=LO(A)}catch{ge(t,_,"Invalid Sec-WebSocket-Extensions header");return}let k=Object.keys(T);if(k.length!==1||k[0]!==kt.extensionName){ge(t,_,"Server indicated an extension that was not requested");return}try{p.accept(T[kt.extensionName])}catch{ge(t,_,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[kt.extensionName]=p}t.setSocket(_,y,{allowSynchronousEvents:n.allowSynchronousEvents,generateMask:n.generateMask,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation})}),n.finishRequest?n.finishRequest(d,t):d.end()}function Jn(t,e){t._readyState=K.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function DO(t){return t.path=t.socketPath,Pg.connect(t)}function WO(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=Pg.isIP(t.host)?"":t.host),EO.connect(t)}function ge(t,e,r){t._readyState=K.CLOSING;let i=new Error(r);Error.captureStackTrace(i,ge),e.setHeader?(e[Mg]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Jn,t,i)):(e.destroy(i),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function Ql(t,e,r){if(e){let i=kO(e)?e.size:NO(e).length;t._socket?t._sender._bufferedBytes+=i:t._bufferedAmount+=i}if(r){let i=new Error(`WebSocket is not open: readyState ${t.readyState} (${at[t.readyState]})`);process.nextTick(r,i)}}function FO(t,e){let r=this[te];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[te]!==void 0&&(r._socket.removeListener("data",Yn),process.nextTick(Lg,r._socket),t===1005?r.close():r.close(t,e))}function UO(){let t=this[te];t.isPaused||t._socket.resume()}function $O(t){let e=this[te];e._socket[te]!==void 0&&(e._socket.removeListener("data",Yn),process.nextTick(Lg,e._socket),e.close(t[PO])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function Cg(){this[te].emitClose()}function VO(t,e){this[te].emit("message",t,e)}function KO(t){let e=this[te];e._autoPong&&e.pong(t,!this._isServer,Rg),e.emit("ping",t)}function HO(t){this[te].emit("pong",t)}function Lg(t){t.resume()}function zO(t){let e=this[te];e.readyState!==K.CLOSED&&(e.readyState===K.OPEN&&(e._readyState=K.CLOSING,Ng(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function Ng(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),jO)}function jg(){let t=this[te];this.removeListener("close",jg),this.removeListener("data",Yn),this.removeListener("end",qg),t._readyState=K.CLOSING;let e;!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&(e=t._socket.read())!==null&&t._receiver.write(e),t._receiver.end(),this[te]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",Cg),t._receiver.on("finish",Cg))}function Yn(t){this[te]._receiver.write(t)||this.pause()}function qg(){let t=this[te];t._readyState=K.CLOSING,t._receiver.end(),this.end()}function Dg(){let t=this[te];this.removeListener("error",Dg),this.on("error",Rg),t&&(t._readyState=K.CLOSING,this.destroy())}});var Vg=S((AL,$g)=>{"use strict";var{Duplex:GO}=require("stream");function Fg(t){t.emit("close")}function QO(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Ug(t){this.removeListener("error",Ug),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function JO(t,e){let r=!0,i=new GO({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",function(s,o){let u=!o&&i._readableState.objectMode?s.toString():s;i.push(u)||t.pause()}),t.once("error",function(s){i.destroyed||(r=!1,i.destroy(s))}),t.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(n,s){if(t.readyState===t.CLOSED){s(n),process.nextTick(Fg,i);return}let o=!1;t.once("error",function(a){o=!0,s(a)}),t.once("close",function(){o||s(n),process.nextTick(Fg,i)}),r&&t.terminate()},i._final=function(n){if(t.readyState===t.CONNECTING){t.once("open",function(){i._final(n)});return}t._socket!==null&&(t._socket._writableState.finished?(n(),i._readableState.endEmitted&&i.destroy()):(t._socket.once("finish",function(){n()}),t.close()))},i._read=function(){t.isPaused&&t.resume()},i._write=function(n,s,o){if(t.readyState===t.CONNECTING){t.once("open",function(){i._write(n,s,o)});return}t.send(n,o)},i.on("end",QO),i.on("error",Ug),i}$g.exports=JO});var Hg=S((kL,Kg)=>{"use strict";var{tokenChars:YO}=Br();function XO(t){let e=new Set,r=-1,i=-1,n=0;for(n;n<t.length;n++){let o=t.charCodeAt(n);if(i===-1&&YO[o]===1)r===-1&&(r=n);else if(n!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=n);else if(o===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${n}`);i===-1&&(i=n);let u=t.slice(r,i);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);e.add(u),r=i=-1}else throw new SyntaxError(`Unexpected character at index ${n}`)}if(r===-1||i!==-1)throw new SyntaxError("Unexpected end of input");let s=t.slice(r,n);if(e.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return e.add(s),e}Kg.exports={parse:XO}});var Zg=S((CL,Xg)=>{"use strict";var ZO=require("events"),Xn=require("http"),{Duplex:IL}=require("stream"),{createHash:eT}=require("crypto"),zg=Kl(),Yt=Oi(),tT=Hg(),rT=Jl(),{GUID:iT,kWebSocket:nT}=st(),sT=/^[+/0-9A-Za-z]{22}==$/,Gg=0,Qg=1,Yg=2,Yl=class extends ZO{constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:rT,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Xn.createServer((i,n)=>{let s=Xn.STATUS_CODES[426];n.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),n.end(s)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=oT(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(n,s,o)=>{this.handleUpgrade(n,s,o,i)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Gg}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Yg){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Ii,this);return}if(e&&this.once("close",e),this._state!==Qg)if(this._state=Qg,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Ii,this):process.nextTick(Ii,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Ii(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,i,n){r.on("error",Jg);let s=e.headers["sec-websocket-key"],o=e.headers.upgrade,u=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Xt(this,e,r,405,"Invalid HTTP method");return}if(o===void 0||o.toLowerCase()!=="websocket"){Xt(this,e,r,400,"Invalid Upgrade header");return}if(s===void 0||!sT.test(s)){Xt(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(u!==8&&u!==13){Xt(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){Ci(r,400);return}let a=e.headers["sec-websocket-protocol"],l=new Set;if(a!==void 0)try{l=tT.parse(a)}catch{Xt(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let c=e.headers["sec-websocket-extensions"],f={};if(this.options.perMessageDeflate&&c!==void 0){let h=new Yt(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let p=zg.parse(c);p[Yt.extensionName]&&(h.accept(p[Yt.extensionName]),f[Yt.extensionName]=h)}catch{Xt(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${u===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(p,d,g,_)=>{if(!p)return Ci(r,d||401,g,_);this.completeUpgrade(f,s,l,e,r,i,n)});return}if(!this.options.verifyClient(h))return Ci(r,401)}this.completeUpgrade(f,s,l,e,r,i,n)}completeUpgrade(e,r,i,n,s,o,u){if(!s.readable||!s.writable)return s.destroy();if(s[nT])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Gg)return Ci(s,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${eT("sha1").update(r+iT).digest("base64")}`],c=new this.options.WebSocket(null,void 0,this.options);if(i.size){let f=this.options.handleProtocols?this.options.handleProtocols(i,n):i.values().next().value;f&&(l.push(`Sec-WebSocket-Protocol: ${f}`),c._protocol=f)}if(e[Yt.extensionName]){let f=e[Yt.extensionName].params,h=zg.format({[Yt.extensionName]:[f]});l.push(`Sec-WebSocket-Extensions: ${h}`),c._extensions=e}this.emit("headers",l,n),s.write(l.concat(`\r
|
|
7
|
-
`).join(`\r
|
|
8
|
-
`)),s.removeListener("error",Jg),c.setSocket(s,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Ii,this)})),u(c,n)}};Xg.exports=Yl;function oT(t,e){for(let r of Object.keys(e))t.on(r,e[r]);return function(){for(let i of Object.keys(e))t.removeListener(i,e[i])}}function Ii(t){t._state=Yg,t.emit("close")}function Jg(){this.destroy()}function Ci(t,e,r,i){r=r||Xn.STATUS_CODES[e],i={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...i},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${Xn.STATUS_CODES[e]}\r
|
|
9
|
-
`+Object.keys(i).map(n=>`${n}: ${i[n]}`).join(`\r
|
|
10
|
-
`)+`\r
|
|
11
|
-
\r
|
|
12
|
-
`+r)}function Xt(t,e,r,i,n){if(t.listenerCount("wsClientError")){let s=new Error(n);Error.captureStackTrace(s,Xt),t.emit("wsClientError",s,r,e)}else Ci(r,i,n)}});var ty=S((PL,ey)=>{"use strict";var ut=Jl();ut.createWebSocketStream=Vg();ut.Server=Zg();ut.Receiver=Wl();ut.Sender=$l();ut.WebSocket=ut;ut.WebSocketServer=ut.Server;ey.exports=ut});var Zn=S(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.BufferedDuplex=Dr.writev=void 0;var lT=mt(),ry=require("buffer");function iy(t,e){let r=new Array(t.length);for(let i=0;i<t.length;i++)typeof t[i].chunk=="string"?r[i]=ry.Buffer.from(t[i].chunk,"utf8"):r[i]=t[i].chunk;this._write(ry.Buffer.concat(r),"binary",e)}Dr.writev=iy;var Xl=class extends lT.Duplex{constructor(e,r,i){super({objectMode:!0}),this.proxy=r,this.socket=i,this.writeQueue=[],e.objectMode||(this._writev=iy.bind(this)),this.isSocketOpen=!1,this.proxy.on("data",n=>{this.destroyed||this.push(n)})}_read(e){this.proxy.read(e)}_write(e,r,i){this.isSocketOpen?this.writeToProxy(e,r,i):this.writeQueue.push({chunk:e,encoding:r,cb:i})}_final(e){this.writeQueue=[],this.proxy.end(e)}_destroy(e,r){this.writeQueue=[],this.proxy.destroy(),r(e)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(e,r,i){this.proxy.write(e,r)===!1?this.proxy.once("drain",i):i()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:e,encoding:r,cb:i}=this.writeQueue.shift();this.writeToProxy(e,r,i)}}};Dr.BufferedDuplex=Xl});var Pi=S(Ct=>{"use strict";var ea=Ct&&Ct.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.streamBuilder=Ct.browserStreamBuilder=void 0;var es=require("buffer"),ny=ea(ty()),aT=ea(De()),uT=mt(),cT=ea(wi()),Zl=Zn(),It=(0,aT.default)("mqttjs:ws"),fT=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function sy(t,e){let r=`${t.protocol}://${t.hostname}:${t.port}${t.path}`;return typeof t.transformWsUrl=="function"&&(r=t.transformWsUrl(r,t,e)),r}function oy(t){let e=t;return t.port||(t.protocol==="wss"?e.port=443:e.port=80),t.path||(e.path="/"),t.wsOptions||(e.wsOptions={}),!cT.default&&!t.forceNativeWebSocket&&t.protocol==="wss"&&fT.forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r])}),e}function hT(t){let e=oy(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let r=new URL(document.URL);e.hostname=r.hostname,e.port||(e.port=Number(r.port))}return e.objectMode===void 0&&(e.objectMode=!(e.binary===!0||e.binary===void 0)),e}function dT(t,e,r){It("createWebSocket"),It(`protocol: ${r.protocolId} ${r.protocolVersion}`);let i=r.protocolId==="MQIsdp"&&r.protocolVersion===3?"mqttv3.1":"mqtt";It(`creating new Websocket for url: ${e} and protocol: ${i}`);let n;return r.createWebsocket?n=r.createWebsocket(e,[i],r):n=new ny.default(e,[i],r.wsOptions),n}function pT(t,e){let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt",i=sy(e,t),n;return e.createWebsocket?n=e.createWebsocket(i,[r],e):n=new WebSocket(i,[r]),n.binaryType="arraybuffer",n}var gT=(t,e)=>{It("streamBuilder");let r=oy(e);r.hostname=r.hostname||r.host||"localhost";let i=sy(r,t),n=dT(t,i,r),s=ny.default.createWebSocketStream(n,r.wsOptions);return s.url=i,n.on("close",()=>{s.destroy()}),s};Ct.streamBuilder=gT;var yT=(t,e)=>{It("browserStreamBuilder");let r,n=hT(e).browserBufferSize||1024*512,s=e.browserBufferTimeout||1e3,o=!e.objectMode,u=pT(t,e),a=c(e,g,_);e.objectMode||(a._writev=Zl.writev.bind(a)),a.on("close",()=>{u.close()});let l=typeof u.addEventListener<"u";u.readyState===u.OPEN?(r=a,r.socket=u):(r=new Zl.BufferedDuplex(e,a,u),l?u.addEventListener("open",f):u.onopen=f),l?(u.addEventListener("close",h),u.addEventListener("error",p),u.addEventListener("message",d)):(u.onclose=h,u.onerror=p,u.onmessage=d);function c(y,b,m){let w=new uT.Transform({objectMode:y.objectMode});return w._write=b,w._flush=m,w}function f(){It("WebSocket onOpen"),r instanceof Zl.BufferedDuplex&&r.socketReady()}function h(y){It("WebSocket onClose",y),r.end(),r.destroy()}function p(y){It("WebSocket onError",y);let b=new Error("WebSocket error");b.event=y,r.destroy(b)}async function d(y){let{data:b}=y;b instanceof ArrayBuffer?b=es.Buffer.from(b):b instanceof Blob?b=es.Buffer.from(await new Response(b).arrayBuffer()):b=es.Buffer.from(b,"utf8"),a&&!a.destroyed&&a.push(b)}function g(y,b,m){if(u.bufferedAmount>n){setTimeout(g,s,y,b,m);return}o&&typeof y=="string"&&(y=es.Buffer.from(y,"utf8"));try{u.send(y)}catch(w){return m(w)}m()}function _(y){u.close(),y()}return r};Ct.browserStreamBuilder=yT});var ta=S(Ri=>{"use strict";var ly=Ri&&Ri.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ri,"__esModule",{value:!0});var _T=ly(require("net")),bT=ly(De()),mT=(0,bT.default)("mqttjs:tcp"),wT=(t,e)=>{e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost";let{port:r,path:i}=e,n=e.hostname;return mT("port %d and host %s",r,n),_T.default.createConnection({port:r,host:n,path:i})};Ri.default=wT});var ia=S(Mi=>{"use strict";var ra=Mi&&Mi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mi,"__esModule",{value:!0});var ST=ra(require("tls")),vT=ra(require("net")),ET=ra(De()),xT=(0,ET.default)("mqttjs:tls"),OT=(t,e)=>{e.port=e.port||8883,e.host=e.hostname||e.host||"localhost",vT.default.isIP(e.host)===0&&(e.servername=e.host),e.rejectUnauthorized=e.rejectUnauthorized!==!1,delete e.path,xT("port %d host %s rejectUnauthorized %b",e.port,e.host,e.rejectUnauthorized);let r=ST.default.connect(e);r.on("secureConnect",()=>{e.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",i)});function i(n){e.rejectUnauthorized&&t.emit("error",n),r.end()}return r.on("error",i),r};Mi.default=OT});var oa=S(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});var ay=require("buffer"),TT=mt(),AT=Zn(),He,na,ye;function kT(){let t=new TT.Transform;return t._write=(e,r,i)=>{He.send({data:e.buffer,success(){i()},fail(n){i(new Error(n))}})},t._flush=e=>{He.close({success(){e()}})},t}function IT(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function CT(t,e){let r=t.protocol==="wxs"?"wss":"ws",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl=="function"&&(i=t.transformWsUrl(i,t,e)),i}function PT(){He.onOpen(()=>{ye.socketReady()}),He.onMessage(t=>{let{data:e}=t;e instanceof ArrayBuffer?e=ay.Buffer.from(e):e=ay.Buffer.from(e,"utf8"),na.push(e)}),He.onClose(()=>{ye.emit("close"),ye.end(),ye.destroy()}),He.onError(t=>{let e=new Error(t.errMsg);ye.destroy(e)})}var RT=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt";IT(e);let i=CT(e,t);He=wx.connectSocket({url:i,protocols:[r]}),na=kT(),ye=new AT.BufferedDuplex(e,na,He),ye._destroy=(s,o)=>{He.close({success(){o&&o(s)}})};let n=ye.destroy;return ye.destroy=(s,o)=>(ye.destroy=n,setTimeout(()=>{He.close({fail(){ye._destroy(s,o)}})},0),ye),PT(),ye};sa.default=RT});var ua=S(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var la=require("buffer"),MT=mt(),BT=Zn(),ct,ts,Wr,uy=!1;function LT(){let t=new MT.Transform;return t._write=(e,r,i)=>{ct.sendSocketMessage({data:e.buffer,success(){i()},fail(){i(new Error)}})},t._flush=e=>{ct.closeSocket({success(){e()}})},t}function NT(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function jT(t,e){let r=t.protocol==="alis"?"wss":"ws",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl=="function"&&(i=t.transformWsUrl(i,t,e)),i}function qT(){uy||(uy=!0,ct.onSocketOpen(()=>{Wr.socketReady()}),ct.onSocketMessage(t=>{if(typeof t.data=="string"){let e=la.Buffer.from(t.data,"base64");ts.push(e)}else{let e=new FileReader;e.addEventListener("load",()=>{let r=e.result;r instanceof ArrayBuffer?r=la.Buffer.from(r):r=la.Buffer.from(r,"utf8"),ts.push(r)}),e.readAsArrayBuffer(t.data)}}),ct.onSocketClose(()=>{Wr.end(),Wr.destroy()}),ct.onSocketError(t=>{Wr.destroy(t)}))}var DT=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt";NT(e);let i=jT(e,t);return ct=e.my,ct.connectSocket({url:i,protocols:r}),ts=LT(),Wr=new BT.BufferedDuplex(e,ts,ct),qT(),Wr};aa.default=DT});var hy=S(Zt=>{"use strict";var rs=Zt&&Zt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.connectAsync=void 0;var WT=rs(De()),FT=rs(require("url")),UT=rs(Dn()),$T=rs(wi());typeof(process==null?void 0:process.nextTick)!="function"&&(process.nextTick=setImmediate);var cy=(0,WT.default)("mqttjs"),X=null;function VT(t){let e;t.auth&&(e=t.auth.match(/^(.+):(.+)$/),e?(t.username=e[1],t.password=e[2]):t.username=t.auth)}function fy(t,e){var r,i,n,s;if(cy("connecting to an MQTT broker..."),typeof t=="object"&&!e&&(e=t,t=""),e=e||{},t&&typeof t=="string"){let a=FT.default.parse(t,!0),l={};if(a.port!=null&&(l.port=Number(a.port)),l.host=a.hostname,l.query=a.query,l.auth=a.auth,l.protocol=a.protocol,l.path=a.path,l.protocol=(r=l.protocol)===null||r===void 0?void 0:r.replace(/:$/,""),e=Object.assign(Object.assign({},l),e),!e.protocol)throw new Error("Missing protocol")}if(e.unixSocket=e.unixSocket||((i=e.protocol)===null||i===void 0?void 0:i.includes("+unix")),e.unixSocket?e.protocol=e.protocol.replace("+unix",""):!(!((n=e.protocol)===null||n===void 0)&&n.startsWith("ws"))&&!(!((s=e.protocol)===null||s===void 0)&&s.startsWith("wx"))&&delete e.path,VT(e),e.query&&typeof e.query.clientId=="string"&&(e.clientId=e.query.clientId),e.cert&&e.key)if(e.protocol){if(["mqtts","wss","wxs","alis"].indexOf(e.protocol)===-1)switch(e.protocol){case"mqtt":e.protocol="mqtts";break;case"ws":e.protocol="wss";break;case"wx":e.protocol="wxs";break;case"ali":e.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${e.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(X||(X={},!$T.default&&!e.forceNativeWebSocket?(X.ws=Pi().streamBuilder,X.wss=Pi().streamBuilder,X.mqtt=ta().default,X.tcp=ta().default,X.ssl=ia().default,X.tls=X.ssl,X.mqtts=ia().default):(X.ws=Pi().browserStreamBuilder,X.wss=Pi().browserStreamBuilder,X.wx=oa().default,X.wxs=oa().default,X.ali=ua().default,X.alis=ua().default)),!X[e.protocol]){let a=["mqtts","wss"].indexOf(e.protocol)!==-1;e.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((l,c)=>a&&c%2===0?!1:typeof X[l]=="function")[0]}if(e.clean===!1&&!e.clientId)throw new Error("Missing clientId for unclean clients");e.protocol&&(e.defaultProtocol=e.protocol);function o(a){return e.servers&&((!a._reconnectCount||a._reconnectCount===e.servers.length)&&(a._reconnectCount=0),e.host=e.servers[a._reconnectCount].host,e.port=e.servers[a._reconnectCount].port,e.protocol=e.servers[a._reconnectCount].protocol?e.servers[a._reconnectCount].protocol:e.defaultProtocol,e.hostname=e.host,a._reconnectCount++),cy("calling streambuilder for",e.protocol),X[e.protocol](a,e)}let u=new UT.default(o,e);return u.on("error",()=>{}),u}function KT(t,e,r=!0){return new Promise((i,n)=>{let s=fy(t,e),o={connect:a=>{u(),i(s)},end:()=>{u(),i(s)},error:a=>{u(),s.end(),n(a)}};r===!1&&(o.close=()=>{o.error(new Error("Couldn't connect to server"))});function u(){Object.keys(o).forEach(a=>{s.off(a,o[a])})}Object.keys(o).forEach(a=>{s.on(a,o[a])})})}Zt.connectAsync=KT;Zt.default=fy});var ca=S(D=>{"use strict";var dy=D&&D.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),HT=D&&D.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),zT=D&&D.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dy(e,t,r);return HT(e,t),e},py=D&&D.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&dy(e,t,r)},Bi=D&&D.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(D,"__esModule",{value:!0});D.ReasonCodes=D.KeepaliveManager=D.UniqueMessageIdProvider=D.DefaultMessageIdProvider=D.Store=D.MqttClient=D.connectAsync=D.connect=D.Client=void 0;var gy=Bi(Dn());D.MqttClient=gy.default;var GT=Bi(il());D.DefaultMessageIdProvider=GT.default;var QT=Bi(Qp());D.UniqueMessageIdProvider=QT.default;var JT=Bi(ol());D.Store=JT.default;var yy=zT(hy());D.connect=yy.default;Object.defineProperty(D,"connectAsync",{enumerable:!0,get:function(){return yy.connectAsync}});var YT=Bi(Ol());D.KeepaliveManager=YT.default;D.Client=gy.default;py(Dn(),D);py(Vt(),D);var XT=fi();Object.defineProperty(D,"ReasonCodes",{enumerable:!0,get:function(){return XT.ReasonCodes}})});var by=S(xe=>{"use strict";var _y=xe&&xe.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),ZT=xe&&xe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eA=xe&&xe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_y(e,t,r);return ZT(e,t),e},tA=xe&&xe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&_y(e,t,r)};Object.defineProperty(xe,"__esModule",{value:!0});var rA=eA(ca());xe.default=rA;tA(ca(),xe)});var ha=S((FL,Sy)=>{"use strict";var Li=t=>t&&typeof t.message=="string",fa=t=>{if(!t)return;let e=t.cause;if(typeof e=="function"){let r=t.cause();return Li(r)?r:void 0}else return Li(e)?e:void 0},my=(t,e)=>{if(!Li(t))return"";let r=t.stack||"";if(e.has(t))return r+`
|
|
13
|
-
causes have become circular...`;let i=fa(t);return i?(e.add(t),r+`
|
|
14
|
-
caused by: `+my(i,e)):r},iA=t=>my(t,new Set),wy=(t,e,r)=>{if(!Li(t))return"";let i=r?"":t.message||"";if(e.has(t))return i+": ...";let n=fa(t);if(n){e.add(t);let s=typeof t.cause=="function";return i+(s?"":": ")+wy(n,e,s)}else return i},nA=t=>wy(t,new Set);Sy.exports={isErrorLike:Li,getErrorCause:fa,stackWithCauses:iA,messageWithCauses:nA}});var da=S((UL,Ey)=>{"use strict";var sA=Symbol("circular-ref-tag"),is=Symbol("pino-raw-err-ref"),vy=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[is]},set:function(t){this[is]=t}}});Object.defineProperty(vy,is,{writable:!0,value:{}});Ey.exports={pinoErrProto:vy,pinoErrorSymbols:{seen:sA,rawSymbol:is}}});var Ty=S(($L,Oy)=>{"use strict";Oy.exports=ga;var{messageWithCauses:oA,stackWithCauses:lA,isErrorLike:xy}=ha(),{pinoErrProto:aA,pinoErrorSymbols:uA}=da(),{seen:pa}=uA,{toString:cA}=Object.prototype;function ga(t){if(!xy(t))return t;t[pa]=void 0;let e=Object.create(aA);e.type=cA.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=oA(t),e.stack=lA(t),Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>ga(r)));for(let r in t)if(e[r]===void 0){let i=t[r];xy(i)?r!=="cause"&&!Object.prototype.hasOwnProperty.call(i,pa)&&(e[r]=ga(i)):e[r]=i}return delete t[pa],e.raw=t,e}});var ky=S((VL,Ay)=>{"use strict";Ay.exports=ss;var{isErrorLike:ya}=ha(),{pinoErrProto:fA,pinoErrorSymbols:hA}=da(),{seen:ns}=hA,{toString:dA}=Object.prototype;function ss(t){if(!ya(t))return t;t[ns]=void 0;let e=Object.create(fA);e.type=dA.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=t.message,e.stack=t.stack,Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>ss(r))),ya(t.cause)&&!Object.prototype.hasOwnProperty.call(t.cause,ns)&&(e.cause=ss(t.cause));for(let r in t)if(e[r]===void 0){let i=t[r];ya(i)?Object.prototype.hasOwnProperty.call(i,ns)||(e[r]=ss(i)):e[r]=i}return delete t[ns],e.raw=t,e}});var Ry=S((KL,Py)=>{"use strict";Py.exports={mapHttpRequest:pA,reqSerializer:Cy};var _a=Symbol("pino-raw-req-ref"),Iy=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[_a]},set:function(t){this[_a]=t}}});Object.defineProperty(Iy,_a,{writable:!0,value:{}});function Cy(t){let e=t.info||t.socket,r=Object.create(Iy);if(r.id=typeof t.id=="function"?t.id():t.id||(t.info?t.info.id:void 0),r.method=t.method,t.originalUrl)r.url=t.originalUrl;else{let i=t.path;r.url=typeof i=="string"?i:t.url?t.url.path||t.url:void 0}return t.query&&(r.query=t.query),t.params&&(r.params=t.params),r.headers=t.headers,r.remoteAddress=e&&e.remoteAddress,r.remotePort=e&&e.remotePort,r.raw=t.raw||t,r}function pA(t){return{req:Cy(t)}}});var Ny=S((HL,Ly)=>{"use strict";Ly.exports={mapHttpResponse:gA,resSerializer:By};var ba=Symbol("pino-raw-res-ref"),My=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[ba]},set:function(t){this[ba]=t}}});Object.defineProperty(My,ba,{writable:!0,value:{}});function By(t){let e=Object.create(My);return e.statusCode=t.headersSent?t.statusCode:null,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function gA(t){return{res:By(t)}}});var wa=S((zL,jy)=>{"use strict";var ma=Ty(),yA=ky(),os=Ry(),ls=Ny();jy.exports={err:ma,errWithCause:yA,mapHttpRequest:os.mapHttpRequest,mapHttpResponse:ls.mapHttpResponse,req:os.reqSerializer,res:ls.resSerializer,wrapErrorSerializer:function(e){return e===ma?e:function(i){return e(ma(i))}},wrapRequestSerializer:function(e){return e===os.reqSerializer?e:function(i){return e(os.reqSerializer(i))}},wrapResponseSerializer:function(e){return e===ls.resSerializer?e:function(i){return e(ls.resSerializer(i))}}}});var Sa=S((GL,qy)=>{"use strict";function _A(t,e){return e}qy.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=_A;let r=new Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(r))return;let i=r.slice(2),n=[];for(let s of i)s&&n.push(s.getFileName());return n}});var Wy=S((QL,Dy)=>{"use strict";Dy.exports=bA;function bA(t={}){let{ERR_PATHS_MUST_BE_STRINGS:e=()=>"fast-redact - Paths must be (non-empty) strings",ERR_INVALID_PATH:r=i=>`fast-redact \u2013 Invalid path (${i})`}=t;return function({paths:n}){n.forEach(s=>{if(typeof s!="string")throw Error(e());try{if(/〇/.test(s))throw Error();let o=(s[0]==="["?"":".")+s.replace(/^\*/,"\u3007").replace(/\.\*/g,".\u3007").replace(/\[\*\]/g,"[\u3007]");if(/\n|\r|;/.test(o)||/\/\*/.test(o))throw Error();Function(`
|
|
15
|
-
'use strict'
|
|
16
|
-
const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });
|
|
17
|
-
const \u3007 = null;
|
|
18
|
-
o${o}
|
|
19
|
-
if ([o${o}].length !== 1) throw Error()`)()}catch{throw Error(r(s))}})}}});var as=S((JL,Fy)=>{"use strict";Fy.exports=/[^.[\]]+|\[((?:.)*?)\]/g});var $y=S((YL,Uy)=>{"use strict";var mA=as();Uy.exports=wA;function wA({paths:t}){let e=[];var r=0;let i=t.reduce(function(n,s,o){var u=s.match(mA).map(c=>c.replace(/'|"|`/g,""));let a=s[0]==="[";u=u.map(c=>c[0]==="["?c.substr(1,c.length-2):c);let l=u.indexOf("*");if(l>-1){let c=u.slice(0,l),f=c.join("."),h=u.slice(l+1,u.length),p=h.length>0;r++,e.push({before:c,beforeStr:f,after:h,nested:p})}else n[s]={path:u,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(s),leadingBracket:a};return n},{});return{wildcards:e,wcLen:r,secret:i}}});var Ky=S((XL,Vy)=>{"use strict";var SA=as();Vy.exports=vA;function vA({secret:t,serialize:e,wcLen:r,strict:i,isCensorFct:n,censorFctTakesPath:s},o){let u=Function("o",`
|
|
20
|
-
if (typeof o !== 'object' || o == null) {
|
|
21
|
-
${TA(i,e)}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
7
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.secret = originalSecret
|
|
34
|
-
${OA(e)}
|
|
35
|
-
`).bind(o);return u.state=o,e===!1&&(u.restore=a=>o.restore(a)),u}function EA(t,e,r){return Object.keys(t).map(i=>{let{escPath:n,leadingBracket:s,path:o}=t[i],u=s?1:0,a=s?"":".",l=[];for(var c;(c=SA.exec(i))!==null;){let[,d]=c,{index:g,input:_}=c;g>u&&l.push(_.substring(0,g-(d?0:1)))}var f=l.map(d=>`o${a}${d}`).join(" && ");f.length===0?f+=`o${a}${i} != null`:f+=` && o${a}${i} != null`;let h=`
|
|
36
|
-
switch (true) {
|
|
37
|
-
${l.reverse().map(d=>`
|
|
38
|
-
case o${a}${d} === censor:
|
|
39
|
-
secret[${n}].circle = ${JSON.stringify(d)}
|
|
40
|
-
break
|
|
41
|
-
`).join(`
|
|
42
|
-
`)}
|
|
43
|
-
}
|
|
44
|
-
`,p=r?`val, ${JSON.stringify(o)}`:"val";return`
|
|
45
|
-
if (${f}) {
|
|
46
|
-
const val = o${a}${i}
|
|
47
|
-
if (val === censor) {
|
|
48
|
-
secret[${n}].precensored = true
|
|
49
|
-
} else {
|
|
50
|
-
secret[${n}].val = val
|
|
51
|
-
o${a}${i} = ${e?`censor(${p})`:"censor"}
|
|
52
|
-
${h}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
`}).join(`
|
|
56
|
-
`)}function xA(t,e,r){return t===!0?`
|
|
57
|
-
{
|
|
58
|
-
const { wildcards, wcLen, groupRedact, nestedRedact } = this
|
|
59
|
-
for (var i = 0; i < wcLen; i++) {
|
|
60
|
-
const { before, beforeStr, after, nested } = wildcards[i]
|
|
61
|
-
if (nested === true) {
|
|
62
|
-
secret[beforeStr] = secret[beforeStr] || []
|
|
63
|
-
nestedRedact(secret[beforeStr], o, before, after, censor, ${e}, ${r})
|
|
64
|
-
} else secret[beforeStr] = groupRedact(o, before, censor, ${e}, ${r})
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
`:""}function OA(t){return t===!1?"return o":`
|
|
68
|
-
var s = this.serialize(o)
|
|
69
|
-
this.restore(o)
|
|
70
|
-
return s
|
|
71
|
-
`}function TA(t,e){return t===!0?"throw Error('fast-redact: primitives cannot be redacted')":e===!1?"return o":"return this.serialize(o)"}});var Ea=S((ZL,Gy)=>{"use strict";Gy.exports={groupRedact:kA,groupRestore:AA,nestedRedact:CA,nestedRestore:IA};function AA({keys:t,values:e,target:r}){if(r==null||typeof r=="string")return;let i=t.length;for(var n=0;n<i;n++){let s=t[n];r[s]=e[n]}}function kA(t,e,r,i,n){let s=Hy(t,e);if(s==null||typeof s=="string")return{keys:null,values:null,target:s,flat:!0};let o=Object.keys(s),u=o.length,a=e.length,l=n?[...e]:void 0,c=new Array(u);for(var f=0;f<u;f++){let h=o[f];c[f]=s[h],n?(l[a]=h,s[h]=r(s[h],l)):i?s[h]=r(s[h]):s[h]=r}return{keys:o,values:c,target:s,flat:!0}}function IA(t){for(let e=0;e<t.length;e++){let{target:r,path:i,value:n}=t[e],s=r;for(let o=i.length-1;o>0;o--)s=s[i[o]];s[i[0]]=n}}function CA(t,e,r,i,n,s,o){let u=Hy(e,r);if(u==null)return;let a=Object.keys(u),l=a.length;for(var c=0;c<l;c++){let f=a[c];PA(t,u,f,r,i,n,s,o)}return t}function va(t,e){return t!=null?"hasOwn"in Object?Object.hasOwn(t,e):Object.prototype.hasOwnProperty.call(t,e):!1}function PA(t,e,r,i,n,s,o,u){let a=n.length,l=a-1,c=r;var f=-1,h,p,d,g=null,_=null,y,b,m=!1,w=0,E=0,A=RA();if(d=h=e[r],typeof h=="object"){for(;h!=null&&++f<a&&(E+=1,r=n[f],g=d,!(r!=="*"&&!_&&!(typeof h=="object"&&r in h)));)if(!(r==="*"&&(_==="*"&&(m=!0),_=r,f!==l))){if(_){let k=Object.keys(h);for(var T=0;T<k.length;T++){let O=k[T];if(b=h[O],y=r==="*",m)A=ft(A,O,E),w=f,d=zy(b,w-1,r,i,n,s,o,u,c,h,p,d,y,O,f,l,A,t,e[c],E+1);else if(y||typeof b=="object"&&b!==null&&r in b){if(y?d=b:d=b[r],p=f!==l?d:o?u?s(d,[...i,c,...n]):s(d):s,y){let R=Ni(ft(A,O,E),d,e[c]);t.push(R),h[O]=p}else if(b[r]!==p)if(p===void 0&&s!==void 0||va(b,r)&&p===d)A=ft(A,O,E);else{A=ft(A,O,E);let R=Ni(ft(A,r,E+1),d,e[c]);t.push(R),b[r]=p}}}_=null}else{if(d=h[r],A=ft(A,r,E),p=f!==l?d:o?u?s(d,[...i,c,...n]):s(d):s,!(va(h,r)&&p===d||p===void 0&&s!==void 0)){let k=Ni(A,d,e[c]);t.push(k),h[r]=p}h=h[r]}if(typeof h!="object")break}}}function Hy(t,e){for(var r=-1,i=e.length,n=t;n!=null&&++r<i;)n=n[e[r]];return n}function zy(t,e,r,i,n,s,o,u,a,l,c,f,h,p,d,g,_,y,b,m){if(e===0&&(h||typeof t=="object"&&t!==null&&r in t)){if(h?f=t:f=t[r],c=d!==g?f:o?u?s(f,[...i,a,...n]):s(f):s,h){let w=Ni(_,f,b);y.push(w),l[p]=c}else if(t[r]!==c){if(!(c===void 0&&s!==void 0||va(t,r)&&c===f)){let w=Ni(ft(_,r,m+1),f,b);y.push(w),t[r]=c}}}for(let w in t)typeof t[w]=="object"&&(_=ft(_,w,m),zy(t[w],e-1,r,i,n,s,o,u,a,l,c,f,h,p,d,g,_,y,b,m+1))}function RA(){return{parent:null,key:null,children:[],depth:0}}function ft(t,e,r){if(t.depth===r)return ft(t.parent,e,r);var i={parent:t,key:e,depth:r,children:[]};return t.children.push(i),i}function Ni(t,e,r){let i=t,n=[];do n.push(i.key),i=i.parent;while(i.parent!=null);return{path:n,value:e,target:r}}});var Jy=S((eN,Qy)=>{"use strict";var{groupRestore:MA,nestedRestore:BA}=Ea();Qy.exports=LA;function LA(){return function(){if(this.restore){this.restore.state.secret=this.secret;return}let{secret:e,wcLen:r}=this,i=Object.keys(e),n=NA(e,i),s=r>0,o=s?{secret:e,groupRestore:MA,nestedRestore:BA}:{secret:e};this.restore=Function("o",jA(n,i,s)).bind(o),this.restore.state=o}}function NA(t,e){return e.map(r=>{let{circle:i,escPath:n,leadingBracket:s}=t[r],u=i?`o.${i} = secret[${n}].val`:`o${s?"":"."}${r} = secret[${n}].val`,a=`secret[${n}].val = undefined`;return`
|
|
72
|
-
if (secret[${n}].val !== undefined) {
|
|
73
|
-
try { ${u} } catch (e) {}
|
|
74
|
-
${a}
|
|
75
|
-
}
|
|
76
|
-
`}).join("")}function jA(t,e,r){return`
|
|
77
|
-
const secret = this.secret
|
|
78
|
-
${r===!0?`
|
|
79
|
-
const keys = Object.keys(secret)
|
|
80
|
-
const len = keys.length
|
|
81
|
-
for (var i = len - 1; i >= ${e.length}; i--) {
|
|
82
|
-
const k = keys[i]
|
|
83
|
-
const o = secret[k]
|
|
84
|
-
if (o) {
|
|
85
|
-
if (o.flat === true) this.groupRestore(o)
|
|
86
|
-
else this.nestedRestore(o)
|
|
87
|
-
secret[k] = null
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
`:""}
|
|
91
|
-
${t}
|
|
92
|
-
return o
|
|
93
|
-
`}});var Xy=S((tN,Yy)=>{"use strict";Yy.exports=qA;function qA(t){let{secret:e,censor:r,compileRestore:i,serialize:n,groupRedact:s,nestedRedact:o,wildcards:u,wcLen:a}=t,l=[{secret:e,censor:r,compileRestore:i}];return n!==!1&&l.push({serialize:n}),a>0&&l.push({groupRedact:s,nestedRedact:o,wildcards:u,wcLen:a}),Object.assign(...l)}});var t_=S((rN,e_)=>{"use strict";var Zy=Wy(),DA=$y(),WA=Ky(),FA=Jy(),{groupRedact:UA,nestedRedact:$A}=Ea(),VA=Xy(),KA=as(),HA=Zy(),xa=t=>t;xa.restore=xa;var zA="[REDACTED]";Oa.rx=KA;Oa.validator=Zy;e_.exports=Oa;function Oa(t={}){let e=Array.from(new Set(t.paths||[])),r="serialize"in t&&(t.serialize===!1||typeof t.serialize=="function")?t.serialize:JSON.stringify,i=t.remove;if(i===!0&&r!==JSON.stringify)throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");let n=i===!0?void 0:"censor"in t?t.censor:zA,s=typeof n=="function",o=s&&n.length>1;if(e.length===0)return r||xa;HA({paths:e,serialize:r,censor:n});let{wildcards:u,wcLen:a,secret:l}=DA({paths:e,censor:n}),c=FA(),f="strict"in t?t.strict:!0;return WA({secret:l,wcLen:a,serialize:r,strict:f,isCensorFct:s,censorFctTakesPath:o},VA({secret:l,censor:n,compileRestore:c,serialize:r,groupRedact:UA,nestedRedact:$A,wildcards:u,wcLen:a}))}});var Fr=S((iN,r_)=>{"use strict";var GA=Symbol("pino.setLevel"),QA=Symbol("pino.getLevel"),JA=Symbol("pino.levelVal"),YA=Symbol("pino.levelComp"),XA=Symbol("pino.useLevelLabels"),ZA=Symbol("pino.useOnlyCustomLevels"),ek=Symbol("pino.mixin"),tk=Symbol("pino.lsCache"),rk=Symbol("pino.chindings"),ik=Symbol("pino.asJson"),nk=Symbol("pino.write"),sk=Symbol("pino.redactFmt"),ok=Symbol("pino.time"),lk=Symbol("pino.timeSliceIndex"),ak=Symbol("pino.stream"),uk=Symbol("pino.stringify"),ck=Symbol("pino.stringifySafe"),fk=Symbol("pino.stringifiers"),hk=Symbol("pino.end"),dk=Symbol("pino.formatOpts"),pk=Symbol("pino.messageKey"),gk=Symbol("pino.errorKey"),yk=Symbol("pino.nestedKey"),_k=Symbol("pino.nestedKeyStr"),bk=Symbol("pino.mixinMergeStrategy"),mk=Symbol("pino.msgPrefix"),wk=Symbol("pino.wildcardFirst"),Sk=Symbol.for("pino.serializers"),vk=Symbol.for("pino.formatters"),Ek=Symbol.for("pino.hooks"),xk=Symbol.for("pino.metadata");r_.exports={setLevelSym:GA,getLevelSym:QA,levelValSym:JA,levelCompSym:YA,useLevelLabelsSym:XA,mixinSym:ek,lsCacheSym:tk,chindingsSym:rk,asJsonSym:ik,writeSym:nk,serializersSym:Sk,redactFmtSym:sk,timeSym:ok,timeSliceIndexSym:lk,streamSym:ak,stringifySym:uk,stringifySafeSym:ck,stringifiersSym:fk,endSym:hk,formatOptsSym:dk,messageKeySym:pk,errorKeySym:gk,nestedKeySym:yk,wildcardFirstSym:wk,needsMetadataGsym:xk,useOnlyCustomLevelsSym:ZA,formattersSym:vk,hooksSym:Ek,nestedKeyStrSym:_k,mixinMergeStrategySym:bk,msgPrefixSym:mk}});var ka=S((nN,o_)=>{"use strict";var Aa=t_(),{redactFmtSym:Ok,wildcardFirstSym:us}=Fr(),{rx:Ta,validator:Tk}=Aa,i_=Tk({ERR_PATHS_MUST_BE_STRINGS:()=>"pino \u2013 redacted paths must be strings",ERR_INVALID_PATH:t=>`pino \u2013 redact paths array contains an invalid path (${t})`}),n_="[Redacted]",s_=!1;function Ak(t,e){let{paths:r,censor:i}=kk(t),n=r.reduce((u,a)=>{Ta.lastIndex=0;let l=Ta.exec(a),c=Ta.exec(a),f=l[1]!==void 0?l[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):l[0];if(f==="*"&&(f=us),c===null)return u[f]=null,u;if(u[f]===null)return u;let{index:h}=c,p=`${a.substr(h,a.length-1)}`;return u[f]=u[f]||[],f!==us&&u[f].length===0&&u[f].push(...u[us]||[]),f===us&&Object.keys(u).forEach(function(d){u[d]&&u[d].push(p)}),u[f].push(p),u},{}),s={[Ok]:Aa({paths:r,censor:i,serialize:e,strict:s_})},o=(...u)=>e(typeof i=="function"?i(...u):i);return[...Object.keys(n),...Object.getOwnPropertySymbols(n)].reduce((u,a)=>{if(n[a]===null)u[a]=l=>o(l,[a]);else{let l=typeof i=="function"?(c,f)=>i(c,[a,...f]):i;u[a]=Aa({paths:n[a],censor:l,serialize:e,strict:s_})}return u},s)}function kk(t){if(Array.isArray(t))return t={paths:t,censor:n_},i_(t),t;let{paths:e,censor:r=n_,remove:i}=t;if(Array.isArray(e)===!1)throw Error("pino \u2013 redact must contain an array of strings");return i===!0&&(r=void 0),i_({paths:e,censor:r}),{paths:e,censor:r}}o_.exports=Ak});var a_=S((sN,l_)=>{"use strict";var Ik=()=>"",Ck=()=>`,"time":${Date.now()}`,Pk=()=>`,"time":${Math.round(Date.now()/1e3)}`,Rk=()=>`,"time":"${new Date(Date.now()).toISOString()}"`;l_.exports={nullTime:Ik,epochTime:Ck,unixTime:Pk,isoTime:Rk}});var c_=S((oN,u_)=>{"use strict";function Mk(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}u_.exports=Bk;function Bk(t,e,r){var i=r&&r.stringify||Mk,n=1;if(typeof t=="object"&&t!==null){var s=e.length+n;if(s===1)return t;var o=new Array(s);o[0]=i(t);for(var u=1;u<s;u++)o[u]=i(e[u]);return o.join(" ")}if(typeof t!="string")return t;var a=e.length;if(a===0)return t;for(var l="",c=1-n,f=-1,h=t&&t.length||0,p=0;p<h;){if(t.charCodeAt(p)===37&&p+1<h){switch(f=f>-1?f:0,t.charCodeAt(p+1)){case 100:case 102:if(c>=a||e[c]==null)break;f<p&&(l+=t.slice(f,p)),l+=Number(e[c]),f=p+2,p++;break;case 105:if(c>=a||e[c]==null)break;f<p&&(l+=t.slice(f,p)),l+=Math.floor(Number(e[c])),f=p+2,p++;break;case 79:case 111:case 106:if(c>=a||e[c]===void 0)break;f<p&&(l+=t.slice(f,p));var d=typeof e[c];if(d==="string"){l+="'"+e[c]+"'",f=p+2,p++;break}if(d==="function"){l+=e[c].name||"<anonymous>",f=p+2,p++;break}l+=i(e[c]),f=p+2,p++;break;case 115:if(c>=a)break;f<p&&(l+=t.slice(f,p)),l+=String(e[c]),f=p+2,p++;break;case 37:f<p&&(l+=t.slice(f,p)),l+="%",f=p+2,p++,c--;break}++c}++p}return f===-1?t:(f<h&&(l+=t.slice(f)),l)}});var Ca=S((lN,Ia)=>{"use strict";if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let e=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(t,0,0,Number(r))},t=new Int32Array(new SharedArrayBuffer(4));Ia.exports=e}else{let t=function(e){if((e>0&&e<1/0)===!1)throw typeof e!="number"&&typeof e!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let i=Date.now()+Number(e);for(;i>Date.now(););};Ia.exports=t}});var b_=S((aN,__)=>{"use strict";var Q=require("fs"),Lk=require("events"),Nk=require("util").inherits,f_=require("path"),Ra=Ca(),jk=require("assert"),cs=100,fs=Buffer.allocUnsafe(0),qk=16*1024,h_="buffer",d_="utf8",[Dk,Wk]=(process.versions.node||"0.0").split(".").map(Number),Fk=Dk>=22&&Wk>=7;function p_(t,e){e._opening=!0,e._writing=!0,e._asyncDrainScheduled=!1;function r(s,o){if(s){e._reopening=!1,e._writing=!1,e._opening=!1,e.sync?process.nextTick(()=>{e.listenerCount("error")>0&&e.emit("error",s)}):e.emit("error",s);return}let u=e._reopening;e.fd=o,e.file=t,e._reopening=!1,e._opening=!1,e._writing=!1,e.sync?process.nextTick(()=>e.emit("ready")):e.emit("ready"),!e.destroyed&&(!e._writing&&e._len>e.minLength||e._flushPending?e._actualWrite():u&&process.nextTick(()=>e.emit("drain")))}let i=e.append?"a":"w",n=e.mode;if(e.sync)try{e.mkdir&&Q.mkdirSync(f_.dirname(t),{recursive:!0});let s=Q.openSync(t,i,n);r(null,s)}catch(s){throw r(s),s}else e.mkdir?Q.mkdir(f_.dirname(t),{recursive:!0},s=>{if(s)return r(s);Q.open(t,i,n,r)}):Q.open(t,i,n,r)}function Re(t){if(!(this instanceof Re))return new Re(t);let{fd:e,dest:r,minLength:i,maxLength:n,maxWrite:s,periodicFlush:o,sync:u,append:a=!0,mkdir:l,retryEAGAIN:c,fsync:f,contentMode:h,mode:p}=t||{};e=e||r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=n||0,this.maxWrite=s||qk,this._periodicFlush=o||0,this._periodicFlushTimer=void 0,this.sync=u||!1,this.writable=!0,this._fsync=f||!1,this.append=a||!1,this.mode=p,this.retryEAGAIN=c||(()=>!0),this.mkdir=l||!1;let d,g;if(h===h_)this._writingBuf=fs,this.write=Vk,this.flush=Hk,this.flushSync=Gk,this._actualWrite=Jk,d=()=>Q.writeSync(this.fd,this._writingBuf),g=()=>Q.write(this.fd,this._writingBuf,this.release);else if(h===void 0||h===d_)this._writingBuf="",this.write=$k,this.flush=Kk,this.flushSync=zk,this._actualWrite=Qk,d=()=>Q.writeSync(this.fd,this._writingBuf,"utf8"),g=()=>Q.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${d_}" and "${h_}", but passed ${h}`);if(typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")p_(e,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(_,y)=>{if(_){if((_.code==="EAGAIN"||_.code==="EBUSY")&&this.retryEAGAIN(_,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{Ra(cs),this.release(void 0,0)}catch(w){this.release(w)}else setTimeout(g,cs);else this._writing=!1,this.emit("error",_);return}this.emit("write",y);let b=Pa(this._writingBuf,this._len,y);if(this._len=b.len,this._writingBuf=b.writingBuf,this._writingBuf.length){if(!this.sync){g();return}try{do{let w=d(),E=Pa(this._writingBuf,this._len,w);this._len=E.len,this._writingBuf=E.writingBuf}while(this._writingBuf.length)}catch(w){this.release(w);return}}this._fsync&&Q.fsyncSync(this.fd);let m=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):m>this.minLength?this._actualWrite():this._ending?m>0?this._actualWrite():(this._writing=!1,hs(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(Uk,this)):this.emit("drain"))},this.on("newListener",function(_){_==="drain"&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function Pa(t,e,r){return typeof t=="string"&&Buffer.byteLength(t)!==r&&(r=Buffer.from(t).subarray(0,r).toString().length),e=Math.max(e-r,0),t=t.slice(r),{writingBuf:t,len:e}}function Uk(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}Nk(Re,Lk);function g_(t,e){return t.length===0?fs:t.length===1?t[0]:Buffer.concat(t,e)}function $k(t){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+t.length,r=this._bufs;return this.maxLength&&e>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(r.length===0||r[r.length-1].length+t.length>this.maxWrite?r.push(""+t):r[r.length-1]+=t,this._len=e,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function Vk(t){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+t.length,r=this._bufs,i=this._lens;return this.maxLength&&e>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(r.length===0||i[i.length-1]+t.length>this.maxWrite?(r.push([t]),i.push(t.length)):(r[r.length-1].push(t),i[i.length-1]+=t.length),this._len=e,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function y_(t){this._flushPending=!0;let e=()=>{if(this._fsync)this._flushPending=!1,t();else try{Q.fsync(this.fd,i=>{this._flushPending=!1,t(i)})}catch(i){t(i)}this.off("error",r)},r=i=>{this._flushPending=!1,t(i),this.off("drain",e)};this.once("drain",e),this.once("error",r)}function Kk(t){if(t!=null&&typeof t!="function")throw new Error("flush cb must be a function");if(this.destroyed){let e=new Error("SonicBoom destroyed");if(t){t(e);return}throw e}if(this.minLength<=0){t?.();return}t&&y_.call(this,t),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function Hk(t){if(t!=null&&typeof t!="function")throw new Error("flush cb must be a function");if(this.destroyed){let e=new Error("SonicBoom destroyed");if(t){t(e);return}throw e}if(this.minLength<=0){t?.();return}t&&y_.call(this,t),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}Re.prototype.reopen=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(t)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(t&&(this.file=t),this._reopening=!0,this._writing)return;let e=this.fd;this.once("ready",()=>{e!==this.fd&&Q.close(e,r=>{if(r)return this.emit("error",r)})}),p_(this.file,this)};Re.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():hs(this)))};function zk(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");let t="";for(;this._bufs.length||t;){t.length<=0&&(t=this._bufs[0]);try{let e=Q.writeSync(this.fd,t,"utf8"),r=Pa(t,this._len,e);t=r.writingBuf,this._len=r.len,t.length<=0&&this._bufs.shift()}catch(e){if((e.code==="EAGAIN"||e.code==="EBUSY")&&!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;Ra(cs)}}try{Q.fsyncSync(this.fd)}catch{}}function Gk(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=fs);let t=fs;for(;this._bufs.length||t.length;){t.length<=0&&(t=g_(this._bufs[0],this._lens[0]));try{let e=Q.writeSync(this.fd,t);t=t.subarray(e),this._len=Math.max(this._len-e,0),t.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(e){if((e.code==="EAGAIN"||e.code==="EBUSY")&&!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;Ra(cs)}}}Re.prototype.destroy=function(){this.destroyed||hs(this)};function Qk(){let t=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf||this._bufs.shift()||"",this.sync)try{let e=Q.writeSync(this.fd,this._writingBuf,"utf8");t(null,e)}catch(e){t(e)}else Q.write(this.fd,this._writingBuf,"utf8",t)}function Jk(){let t=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:g_(this._bufs.shift(),this._lens.shift()),this.sync)try{let e=Q.writeSync(this.fd,this._writingBuf);t(null,e)}catch(e){t(e)}else Fk&&(this._writingBuf=Buffer.from(this._writingBuf)),Q.write(this.fd,this._writingBuf,t)}function hs(t){if(t.fd===-1){t.once("ready",hs.bind(null,t));return}t._periodicFlushTimer!==void 0&&clearInterval(t._periodicFlushTimer),t.destroyed=!0,t._bufs=[],t._lens=[],jk(typeof t.fd=="number",`sonic.fd must be a number, got ${typeof t.fd}`);try{Q.fsync(t.fd,e)}catch{}function e(){t.fd!==1&&t.fd!==2?Q.close(t.fd,r):r()}function r(i){if(i){t.emit("error",i);return}t._ending&&!t._writing&&t.emit("finish"),t.emit("close")}}Re.SonicBoom=Re;Re.default=Re;__.exports=Re});var Ma=S((uN,E_)=>{"use strict";var Me={exit:[],beforeExit:[]},m_={exit:Zk,beforeExit:eI},Ur;function Yk(){Ur===void 0&&(Ur=new FinalizationRegistry(tI))}function Xk(t){Me[t].length>0||process.on(t,m_[t])}function w_(t){Me[t].length>0||(process.removeListener(t,m_[t]),Me.exit.length===0&&Me.beforeExit.length===0&&(Ur=void 0))}function Zk(){S_("exit")}function eI(){S_("beforeExit")}function S_(t){for(let e of Me[t]){let r=e.deref(),i=e.fn;r!==void 0&&i(r,t)}Me[t]=[]}function tI(t){for(let e of["exit","beforeExit"]){let r=Me[e].indexOf(t);Me[e].splice(r,r+1),w_(e)}}function v_(t,e,r){if(e===void 0)throw new Error("the object can't be undefined");Xk(t);let i=new WeakRef(e);i.fn=r,Yk(),Ur.register(e,i),Me[t].push(i)}function rI(t,e){v_("exit",t,e)}function iI(t,e){v_("beforeExit",t,e)}function nI(t){if(Ur!==void 0){Ur.unregister(t);for(let e of["exit","beforeExit"])Me[e]=Me[e].filter(r=>{let i=r.deref();return i&&i!==t}),w_(e)}}E_.exports={register:rI,registerBeforeExit:iI,unregister:nI}});var x_=S((cN,sI)=>{sI.exports={name:"thread-stream",version:"3.1.0",description:"A streaming way to send data to a Node.js Worker Thread",main:"index.js",types:"index.d.ts",dependencies:{"real-require":"^0.2.0"},devDependencies:{"@types/node":"^20.1.0","@types/tap":"^15.0.0","@yao-pkg/pkg":"^5.11.5",desm:"^1.3.0",fastbench:"^1.0.1",husky:"^9.0.6","pino-elasticsearch":"^8.0.0","sonic-boom":"^4.0.1",standard:"^17.0.0",tap:"^16.2.0","ts-node":"^10.8.0",typescript:"^5.3.2","why-is-node-running":"^2.2.2"},scripts:{build:"tsc --noEmit",test:'standard && npm run build && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts',"test:ci":"standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts","test:ci:js":'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"',"test:ci:ts":'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"',"test:yarn":'npm run transpile && tap "test/**/*.test.js" --no-check-coverage',transpile:"sh ./test/ts/transpile.sh",prepare:"husky install"},standard:{ignore:["test/ts/**/*","test/syntax-error.mjs"]},repository:{type:"git",url:"git+https://github.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matteocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com/mcollina/thread-stream#readme"}});var T_=S((fN,O_)=>{"use strict";function oI(t,e,r,i,n){let s=Date.now()+i,o=Atomics.load(t,e);if(o===r){n(null,"ok");return}let u=o,a=l=>{Date.now()>s?n(null,"timed-out"):setTimeout(()=>{u=o,o=Atomics.load(t,e),o===u?a(l>=1e3?1e3:l*2):o===r?n(null,"ok"):n(null,"not-equal")},l)};a(1)}function lI(t,e,r,i,n){let s=Date.now()+i,o=Atomics.load(t,e);if(o!==r){n(null,"ok");return}let u=a=>{Date.now()>s?n(null,"timed-out"):setTimeout(()=>{o=Atomics.load(t,e),o!==r?n(null,"ok"):u(a>=1e3?1e3:a*2)},a)};u(1)}O_.exports={wait:oI,waitDiff:lI}});var k_=S((hN,A_)=>{"use strict";A_.exports={WRITE_INDEX:4,READ_INDEX:8}});var M_=S((dN,R_)=>{"use strict";var{version:aI}=x_(),{EventEmitter:uI}=require("events"),{Worker:cI}=require("worker_threads"),{join:fI}=require("path"),{pathToFileURL:hI}=require("url"),{wait:dI}=T_(),{WRITE_INDEX:he,READ_INDEX:ze}=k_(),pI=require("buffer"),gI=require("assert"),v=Symbol("kImpl"),yI=pI.constants.MAX_STRING_LENGTH,ji=class{constructor(e){this._value=e}deref(){return this._value}},ps=class{register(){}unregister(){}},_I=process.env.NODE_V8_COVERAGE?ps:global.FinalizationRegistry||ps,bI=process.env.NODE_V8_COVERAGE?ji:global.WeakRef||ji,I_=new _I(t=>{t.exited||t.terminate()});function mI(t,e){let{filename:r,workerData:i}=e,s=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||fI(__dirname,"lib","worker.js"),o=new cI(s,{...e.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:hI(r).href,dataBuf:t[v].dataBuf,stateBuf:t[v].stateBuf,workerData:{$context:{threadStreamVersion:aI},...i}}});return o.stream=new ji(t),o.on("message",wI),o.on("exit",P_),I_.register(t,o),o}function C_(t){gI(!t[v].sync),t[v].needDrain&&(t[v].needDrain=!1,t.emit("drain"))}function ds(t){let e=Atomics.load(t[v].state,he),r=t[v].data.length-e;if(r>0){if(t[v].buf.length===0){t[v].flushing=!1,t[v].ending?qa(t):t[v].needDrain&&process.nextTick(C_,t);return}let i=t[v].buf.slice(0,r),n=Buffer.byteLength(i);n<=r?(t[v].buf=t[v].buf.slice(r),gs(t,i,ds.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[v].state,ze,0),Atomics.store(t[v].state,he,0);n>t[v].data.length;)r=r/2,i=t[v].buf.slice(0,r),n=Buffer.byteLength(i);t[v].buf=t[v].buf.slice(r),gs(t,i,ds.bind(null,t))}})}else if(r===0){if(e===0&&t[v].buf.length===0)return;t.flush(()=>{Atomics.store(t[v].state,ze,0),Atomics.store(t[v].state,he,0),ds(t)})}else Ge(t,new Error("overwritten"))}function wI(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new bI(e),e.flush(()=>{e[v].ready=!0,e.emit("ready")});break;case"ERROR":Ge(e,t.err);break;case"EVENT":Array.isArray(t.args)?e.emit(t.name,...t.args):e.emit(t.name,t.args);break;case"WARNING":process.emitWarning(t.err);break;default:Ge(e,new Error("this should not happen: "+t.code))}}function P_(t){let e=this.stream.deref();e!==void 0&&(I_.unregister(e),e.worker.exited=!0,e.worker.off("exit",P_),Ge(e,t!==0?new Error("the worker thread exited"):null))}var La=class extends uI{constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[v]={},this[v].stateBuf=new SharedArrayBuffer(128),this[v].state=new Int32Array(this[v].stateBuf),this[v].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[v].data=Buffer.from(this[v].dataBuf),this[v].sync=e.sync||!1,this[v].ending=!1,this[v].ended=!1,this[v].needDrain=!1,this[v].destroyed=!1,this[v].flushing=!1,this[v].ready=!1,this[v].finished=!1,this[v].errored=null,this[v].closed=!1,this[v].buf="",this.worker=mI(this,e),this.on("message",(r,i)=>{this.worker.postMessage(r,i)})}write(e){if(this[v].destroyed)return Na(this,new Error("the worker has exited")),!1;if(this[v].ending)return Na(this,new Error("the worker is ending")),!1;if(this[v].flushing&&this[v].buf.length+e.length>=yI)try{Ba(this),this[v].flushing=!0}catch(r){return Ge(this,r),!1}if(this[v].buf+=e,this[v].sync)try{return Ba(this),!0}catch(r){return Ge(this,r),!1}return this[v].flushing||(this[v].flushing=!0,setImmediate(ds,this)),this[v].needDrain=this[v].data.length-this[v].buf.length-Atomics.load(this[v].state,he)<=0,!this[v].needDrain}end(){this[v].destroyed||(this[v].ending=!0,qa(this))}flush(e){if(this[v].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let r=Atomics.load(this[v].state,he);dI(this[v].state,ze,r,1/0,(i,n)=>{if(i){Ge(this,i),process.nextTick(e,i);return}if(n==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[v].destroyed||(Ba(this),ja(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[v].ready}get destroyed(){return this[v].destroyed}get closed(){return this[v].closed}get writable(){return!this[v].destroyed&&!this[v].ending}get writableEnded(){return this[v].ending}get writableFinished(){return this[v].finished}get writableNeedDrain(){return this[v].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[v].errored}};function Na(t,e){setImmediate(()=>{t.emit("error",e)})}function Ge(t,e){t[v].destroyed||(t[v].destroyed=!0,e&&(t[v].errored=e,Na(t,e)),t.worker.exited?setImmediate(()=>{t[v].closed=!0,t.emit("close")}):t.worker.terminate().catch(()=>{}).then(()=>{t[v].closed=!0,t.emit("close")}))}function gs(t,e,r){let i=Atomics.load(t[v].state,he),n=Buffer.byteLength(e);return t[v].data.write(e,i),Atomics.store(t[v].state,he,i+n),Atomics.notify(t[v].state,he),r(),!0}function qa(t){if(!(t[v].ended||!t[v].ending||t[v].flushing)){t[v].ended=!0;try{t.flushSync();let e=Atomics.load(t[v].state,ze);Atomics.store(t[v].state,he,-1),Atomics.notify(t[v].state,he);let r=0;for(;e!==-1;){if(Atomics.wait(t[v].state,ze,e,1e3),e=Atomics.load(t[v].state,ze),e===-2){Ge(t,new Error("end() failed"));return}if(++r===10){Ge(t,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{t[v].finished=!0,t.emit("finish")})}catch(e){Ge(t,e)}}}function Ba(t){let e=()=>{t[v].ending?qa(t):t[v].needDrain&&process.nextTick(C_,t)};for(t[v].flushing=!1;t[v].buf.length!==0;){let r=Atomics.load(t[v].state,he),i=t[v].data.length-r;if(i===0){ja(t),Atomics.store(t[v].state,ze,0),Atomics.store(t[v].state,he,0);continue}else if(i<0)throw new Error("overwritten");let n=t[v].buf.slice(0,i),s=Buffer.byteLength(n);if(s<=i)t[v].buf=t[v].buf.slice(i),gs(t,n,e);else{for(ja(t),Atomics.store(t[v].state,ze,0),Atomics.store(t[v].state,he,0);s>t[v].buf.length;)i=i/2,n=t[v].buf.slice(0,i),s=Buffer.byteLength(n);t[v].buf=t[v].buf.slice(i),gs(t,n,e)}}}function ja(t){if(t[v].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[v].state,he),r=0;for(;;){let i=Atomics.load(t[v].state,ze);if(i===-2)throw Error("_flushSync failed");if(i!==e)Atomics.wait(t[v].state,ze,i,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}R_.exports=La});var Fa=S((pN,B_)=>{"use strict";var{createRequire:SI}=require("module"),vI=Sa(),{join:Da,isAbsolute:EI,sep:xI}=require("path"),OI=Ca(),Wa=Ma(),TI=M_();function AI(t){Wa.register(t,II),Wa.registerBeforeExit(t,CI),t.on("close",function(){Wa.unregister(t)})}function kI(t,e,r,i){let n=new TI({filename:t,workerData:e,workerOpts:r,sync:i});n.on("ready",s),n.on("close",function(){process.removeListener("exit",o)}),process.on("exit",o);function s(){process.removeListener("exit",o),n.unref(),r.autoEnd!==!1&&AI(n)}function o(){n.closed||(n.flushSync(),OI(100),n.end())}return n}function II(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function CI(t){t.flushSync()}function PI(t){let{pipeline:e,targets:r,levels:i,dedupe:n,worker:s={},caller:o=vI(),sync:u=!1}=t,a={...t.options},l=typeof o=="string"?[o]:o,c="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},f=t.target;if(f&&r)throw new Error("only one of target or targets can be specified");return r?(f=c["pino-worker"]||Da(__dirname,"worker.js"),a.targets=r.filter(p=>p.target).map(p=>({...p,target:h(p.target)})),a.pipelines=r.filter(p=>p.pipeline).map(p=>p.pipeline.map(d=>({...d,level:p.level,target:h(d.target)})))):e&&(f=c["pino-worker"]||Da(__dirname,"worker.js"),a.pipelines=[e.map(p=>({...p,target:h(p.target)}))]),i&&(a.levels=i),n&&(a.dedupe=n),a.pinoWillSendConfig=!0,kI(h(f),a,s,u);function h(p){if(p=c[p]||p,EI(p)||p.indexOf("file://")===0)return p;if(p==="pino/file")return Da(__dirname,"..","file.js");let d;for(let g of l)try{let _=g==="node:repl"?process.cwd()+xI:g;d=SI(_).resolve(p);break}catch{continue}if(!d)throw new Error(`unable to determine transport target for "${p}"`);return d}}B_.exports=PI});var bs=S((gN,K_)=>{"use strict";var L_=c_(),{mapHttpRequest:RI,mapHttpResponse:MI}=wa(),$a=b_(),N_=Ma(),{lsCacheSym:BI,chindingsSym:D_,writeSym:j_,serializersSym:W_,formatOptsSym:q_,endSym:LI,stringifiersSym:F_,stringifySym:U_,stringifySafeSym:Va,wildcardFirstSym:$_,nestedKeySym:NI,formattersSym:V_,messageKeySym:jI,errorKeySym:qI,nestedKeyStrSym:DI,msgPrefixSym:ys}=Fr(),{isMainThread:WI}=require("worker_threads"),FI=Fa();function $r(){}function UI(t,e){if(!e)return r;return function(...n){e.call(this,n,r,t)};function r(i,...n){if(typeof i=="object"){let s=i;i!==null&&(i.method&&i.headers&&i.socket?i=RI(i):typeof i.setHeader=="function"&&(i=MI(i)));let o;s===null&&n.length===0?o=[null]:(s=n.shift(),o=n),typeof this[ys]=="string"&&s!==void 0&&s!==null&&(s=this[ys]+s),this[j_](i,L_(s,o,this[q_]),t)}else{let s=i===void 0?n.shift():i;typeof this[ys]=="string"&&s!==void 0&&s!==null&&(s=this[ys]+s),this[j_](null,L_(s,n,this[q_]),t)}}}function Ua(t){let e="",r=0,i=!1,n=255,s=t.length;if(s>100)return JSON.stringify(t);for(var o=0;o<s&&n>=32;o++)n=t.charCodeAt(o),(n===34||n===92)&&(e+=t.slice(r,o)+"\\",r=o,i=!0);return i?e+=t.slice(r):e=t,n<32?JSON.stringify(t):'"'+e+'"'}function $I(t,e,r,i){let n=this[U_],s=this[Va],o=this[F_],u=this[LI],a=this[D_],l=this[W_],c=this[V_],f=this[jI],h=this[qI],p=this[BI][r]+i;p=p+a;let d;c.log&&(t=c.log(t));let g=o[$_],_="";for(let b in t)if(d=t[b],Object.prototype.hasOwnProperty.call(t,b)&&d!==void 0){l[b]?d=l[b](d):b===h&&l.err&&(d=l.err(d));let m=o[b]||g;switch(typeof d){case"undefined":case"function":continue;case"number":Number.isFinite(d)===!1&&(d=null);case"boolean":m&&(d=m(d));break;case"string":d=(m||Ua)(d);break;default:d=(m||n)(d,s)}if(d===void 0)continue;let w=Ua(b);_+=","+w+":"+d}let y="";if(e!==void 0){d=l[f]?l[f](e):e;let b=o[f]||g;switch(typeof d){case"function":break;case"number":Number.isFinite(d)===!1&&(d=null);case"boolean":b&&(d=b(d)),y=',"'+f+'":'+d;break;case"string":d=(b||Ua)(d),y=',"'+f+'":'+d;break;default:d=(b||n)(d,s),y=',"'+f+'":'+d}}return this[NI]&&_?p+this[DI]+_.slice(1)+"}"+y+u:p+_+y+u}function VI(t,e){let r,i=t[D_],n=t[U_],s=t[Va],o=t[F_],u=o[$_],a=t[W_],l=t[V_].bindings;e=l(e);for(let c in e)if(r=e[c],(c!=="level"&&c!=="serializers"&&c!=="formatters"&&c!=="customLevels"&&e.hasOwnProperty(c)&&r!==void 0)===!0){if(r=a[c]?a[c](r):r,r=(o[c]||u||n)(r,s),r===void 0)continue;i+=',"'+c+'":'+r}return i}function KI(t){return t.write!==t.constructor.prototype.write}var HI=process.env.NODE_V8_COVERAGE||process.env.V8_COVERAGE;function _s(t){let e=new $a(t);return e.on("error",r),!HI&&!t.sync&&WI&&(N_.register(e,zI),e.on("close",function(){N_.unregister(e)})),e;function r(i){if(i.code==="EPIPE"){e.write=$r,e.end=$r,e.flushSync=$r,e.destroy=$r;return}e.removeListener("error",r),e.emit("error",i)}}function zI(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function GI(t){return function(r,i,n={},s){if(typeof n=="string")s=_s({dest:n}),n={};else if(typeof s=="string"){if(n&&n.transport)throw Error("only one of option.transport or stream can be specified");s=_s({dest:s})}else if(n instanceof $a||n.writable||n._writableState)s=n,n={};else if(n.transport){if(n.transport instanceof $a||n.transport.writable||n.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(n.transport.targets&&n.transport.targets.length&&n.formatters&&typeof n.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let a;n.customLevels&&(a=n.useOnlyCustomLevels?n.customLevels:Object.assign({},n.levels,n.customLevels)),s=FI({caller:i,...n.transport,levels:a})}if(n=Object.assign({},t,n),n.serializers=Object.assign({},t.serializers,n.serializers),n.formatters=Object.assign({},t.formatters,n.formatters),n.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:o,onChild:u}=n;return o===!1&&(n.level="silent"),u||(n.onChild=$r),s||(KI(process.stdout)?s=process.stdout:s=_s({fd:process.stdout.fd||1})),{opts:n,stream:s}}}function QI(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[Va])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function JI(t,e,r){return{level:t,bindings:e,log:r}}function YI(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t===void 0?1:t}K_.exports={noop:$r,buildSafeSonicBoom:_s,asChindings:VI,asJson:$I,genLog:UI,createArgsNormalizer:GI,stringify:QI,buildFormatters:JI,normalizeDestFileDescriptor:YI}});var ms=S((yN,H_)=>{"use strict";var XI={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},ZI={ASC:"ASC",DESC:"DESC"};H_.exports={DEFAULT_LEVELS:XI,SORTING_ORDER:ZI}});var za=S((_N,J_)=>{"use strict";var{lsCacheSym:eC,levelValSym:Ka,useOnlyCustomLevelsSym:tC,streamSym:rC,formattersSym:iC,hooksSym:nC,levelCompSym:z_}=Fr(),{noop:sC,genLog:er}=bs(),{DEFAULT_LEVELS:Qe,SORTING_ORDER:G_}=ms(),Q_={fatal:t=>{let e=er(Qe.fatal,t);return function(...r){let i=this[rC];if(e.call(this,...r),typeof i.flushSync=="function")try{i.flushSync()}catch{}}},error:t=>er(Qe.error,t),warn:t=>er(Qe.warn,t),info:t=>er(Qe.info,t),debug:t=>er(Qe.debug,t),trace:t=>er(Qe.trace,t)},Ha=Object.keys(Qe).reduce((t,e)=>(t[Qe[e]]=e,t),{}),oC=Object.keys(Ha).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function lC(t){let e=t[iC].level,{labels:r}=t.levels,i={};for(let n in r){let s=e(r[n],Number(n));i[n]=JSON.stringify(s).slice(0,-1)}return t[eC]=i,t}function aC(t,e){if(e)return!1;switch(t){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function uC(t){let{labels:e,values:r}=this.levels;if(typeof t=="number"){if(e[t]===void 0)throw Error("unknown level value"+t);t=e[t]}if(r[t]===void 0)throw Error("unknown level "+t);let i=this[Ka],n=this[Ka]=r[t],s=this[tC],o=this[z_],u=this[nC].logMethod;for(let a in r){if(o(r[a],n)===!1){this[a]=sC;continue}this[a]=aC(a,s)?Q_[a](u):er(r[a],u)}this.emit("level-change",t,n,e[i],i,this)}function cC(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function fC(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&this[z_](r,this[Ka])}function hC(t,e,r){return t===G_.DESC?e<=r:e>=r}function dC(t){return typeof t=="string"?hC.bind(null,t):t}function pC(t=null,e=!1){let r=t?Object.keys(t).reduce((s,o)=>(s[t[o]]=o,s),{}):null,i=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),e?null:Ha,r),n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:Qe,t);return{labels:i,values:n}}function gC(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(s=>e[s]),r?[]:Object.keys(Ha).map(s=>+s),1/0).includes(t))throw Error(`default level:${t} must be included in custom levels`);return}let i=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:Qe,e);if(!(t in i))throw Error(`default level:${t} must be included in custom levels`)}function yC(t,e){let{labels:r,values:i}=t;for(let n in e){if(n in i)throw Error("levels cannot be overridden");if(e[n]in r)throw Error("pre-existing level values cannot be used for new levels")}}function _C(t){if(typeof t!="function"&&!(typeof t=="string"&&Object.values(G_).includes(t)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}J_.exports={initialLsCache:oC,genLsCache:lC,levelMethods:Q_,getLevel:cC,setLevel:uC,isLevelEnabled:fC,mappings:pC,assertNoLevelCollisions:yC,assertDefaultLevelFound:gC,genLevelComparison:dC,assertLevelComparison:_C}});var Ga=S((bN,Y_)=>{"use strict";Y_.exports={version:"9.5.0"}});var ab=S((wN,lb)=>{"use strict";var{EventEmitter:bC}=require("events"),{lsCacheSym:mC,levelValSym:wC,setLevelSym:Ja,getLevelSym:X_,chindingsSym:Ya,parsedChindingsSym:SC,mixinSym:vC,asJsonSym:ib,writeSym:EC,mixinMergeStrategySym:xC,timeSym:OC,timeSliceIndexSym:TC,streamSym:nb,serializersSym:tr,formattersSym:Qa,errorKeySym:AC,messageKeySym:kC,useOnlyCustomLevelsSym:IC,needsMetadataGsym:CC,redactFmtSym:PC,stringifySym:RC,formatOptsSym:MC,stringifiersSym:BC,msgPrefixSym:Z_}=Fr(),{getLevel:LC,setLevel:NC,isLevelEnabled:jC,mappings:qC,initialLsCache:DC,genLsCache:WC,assertNoLevelCollisions:FC}=za(),{asChindings:sb,asJson:UC,buildFormatters:eb,stringify:tb}=bs(),{version:$C}=Ga(),VC=ka(),KC=class{},ob={constructor:KC,child:HC,bindings:zC,setBindings:GC,flush:XC,isLevelEnabled:jC,version:$C,get level(){return this[X_]()},set level(t){this[Ja](t)},get levelVal(){return this[wC]},set levelVal(t){throw Error("levelVal is read-only")},[mC]:DC,[EC]:JC,[ib]:UC,[X_]:LC,[Ja]:NC};Object.setPrototypeOf(ob,bC.prototype);lb.exports=function(){return Object.create(ob)};var rb=t=>t;function HC(t,e){if(!t)throw Error("missing bindings for child Pino");e=e||{};let r=this[tr],i=this[Qa],n=Object.create(this);if(e.hasOwnProperty("serializers")===!0){n[tr]=Object.create(null);for(let c in r)n[tr][c]=r[c];let a=Object.getOwnPropertySymbols(r);for(var s=0;s<a.length;s++){let c=a[s];n[tr][c]=r[c]}for(let c in e.serializers)n[tr][c]=e.serializers[c];let l=Object.getOwnPropertySymbols(e.serializers);for(var o=0;o<l.length;o++){let c=l[o];n[tr][c]=e.serializers[c]}}else n[tr]=r;if(e.hasOwnProperty("formatters")){let{level:a,bindings:l,log:c}=e.formatters;n[Qa]=eb(a||i.level,l||rb,c||i.log)}else n[Qa]=eb(i.level,rb,i.log);if(e.hasOwnProperty("customLevels")===!0&&(FC(this.levels,e.customLevels),n.levels=qC(e.customLevels,n[IC]),WC(n)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){n.redact=e.redact;let a=VC(n.redact,tb),l={stringify:a[PC]};n[RC]=tb,n[BC]=a,n[MC]=l}typeof e.msgPrefix=="string"&&(n[Z_]=(this[Z_]||"")+e.msgPrefix),n[Ya]=sb(n,t);let u=e.level||this.level;return n[Ja](u),this.onChild(n),n}function zC(){let e=`{${this[Ya].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function GC(t){let e=sb(this,t);this[Ya]=e,delete this[SC]}function QC(t,e){return Object.assign(e,t)}function JC(t,e,r){let i=this[OC](),n=this[vC],s=this[AC],o=this[kC],u=this[xC]||QC,a;t==null?a={}:t instanceof Error?(a={[s]:t},e===void 0&&(e=t.message)):(a=t,e===void 0&&t[o]===void 0&&t[s]&&(e=t[s].message)),n&&(a=u(a,n(a,r,this)));let l=this[ib](a,e,r,i),c=this[nb];c[CC]===!0&&(c.lastLevel=r,c.lastObj=a,c.lastMsg=e,c.lastTime=i.slice(this[TC]),c.lastLogger=this),c.write(l)}function YC(){}function XC(t){if(t!=null&&typeof t!="function")throw Error("callback must be a function");let e=this[nb];typeof e.flush=="function"?e.flush(t||YC):t&&t()}});var hb=S((tu,fb)=>{"use strict";var{hasOwnProperty:qi}=Object.prototype,ir=eu();ir.configure=eu;ir.stringify=ir;ir.default=ir;tu.stringify=ir;tu.configure=eu;fb.exports=ir;var ZC=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function Pt(t){return t.length<5e3&&!ZC.test(t)?`"${t}"`:JSON.stringify(t)}function Xa(t,e){if(t.length>200||e)return t.sort(e);for(let r=1;r<t.length;r++){let i=t[r],n=r;for(;n!==0&&t[n-1]>i;)t[n]=t[n-1],n--;t[n]=i}return t}var eP=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function Za(t){return eP.call(t)!==void 0&&t.length!==0}function ub(t,e,r){t.length<r&&(r=t.length);let i=e===","?"":" ",n=`"0":${i}${t[0]}`;for(let s=1;s<r;s++)n+=`${e}"${s}":${i}${t[s]}`;return n}function tP(t){if(qi.call(t,"circularValue")){let e=t.circularValue;if(typeof e=="string")return`"${e}"`;if(e==null)return e;if(e===Error||e===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function rP(t){let e;if(qi.call(t,"deterministic")&&(e=t.deterministic,typeof e!="boolean"&&typeof e!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return e===void 0?!0:e}function iP(t,e){let r;if(qi.call(t,e)&&(r=t[e],typeof r!="boolean"))throw new TypeError(`The "${e}" argument must be of type boolean`);return r===void 0?!0:r}function cb(t,e){let r;if(qi.call(t,e)){if(r=t[e],typeof r!="number")throw new TypeError(`The "${e}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${e}" argument must be an integer`);if(r<1)throw new RangeError(`The "${e}" argument must be >= 1`)}return r===void 0?1/0:r}function rr(t){return t===1?"1 item":`${t} items`}function nP(t){let e=new Set;for(let r of t)(typeof r=="string"||typeof r=="number")&&e.add(String(r));return e}function sP(t){if(qi.call(t,"strict")){let e=t.strict;if(typeof e!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(e)return r=>{let i=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(i+=` (${r.toString()})`),new Error(i)}}}function eu(t){t={...t};let e=sP(t);e&&(t.bigint===void 0&&(t.bigint=!1),"circularValue"in t||(t.circularValue=Error));let r=tP(t),i=iP(t,"bigint"),n=rP(t),s=typeof n=="function"?n:void 0,o=cb(t,"maximumDepth"),u=cb(t,"maximumBreadth");function a(p,d,g,_,y,b){let m=d[p];switch(typeof m=="object"&&m!==null&&typeof m.toJSON=="function"&&(m=m.toJSON(p)),m=_.call(d,p,m),typeof m){case"string":return Pt(m);case"object":{if(m===null)return"null";if(g.indexOf(m)!==-1)return r;let w="",E=",",A=b;if(Array.isArray(m)){if(m.length===0)return"[]";if(o<g.length+1)return'"[Array]"';g.push(m),y!==""&&(b+=y,w+=`
|
|
94
|
-
${b}`,E=`,
|
|
95
|
-
${b}`);let W=Math.min(m.length,u),V=0;for(;V<W-1;V++){let de=a(String(V),m,g,_,y,b);w+=de!==void 0?de:"null",w+=E}let re=a(String(V),m,g,_,y,b);if(w+=re!==void 0?re:"null",m.length-1>u){let de=m.length-u-1;w+=`${E}"... ${rr(de)} not stringified"`}return y!==""&&(w+=`
|
|
96
|
-
${A}`),g.pop(),`[${w}]`}let T=Object.keys(m),k=T.length;if(k===0)return"{}";if(o<g.length+1)return'"[Object]"';let O="",R="";y!==""&&(b+=y,E=`,
|
|
97
|
-
${b}`,O=" ");let H=Math.min(k,u);n&&!Za(m)&&(T=Xa(T,s)),g.push(m);for(let W=0;W<H;W++){let V=T[W],re=a(V,m,g,_,y,b);re!==void 0&&(w+=`${R}${Pt(V)}:${O}${re}`,R=E)}if(k>u){let W=k-u;w+=`${R}"...":${O}"${rr(W)} not stringified"`,R=E}return y!==""&&R.length>1&&(w=`
|
|
98
|
-
${b}${w}
|
|
99
|
-
${A}`),g.pop(),`{${w}}`}case"number":return isFinite(m)?String(m):e?e(m):"null";case"boolean":return m===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(m);default:return e?e(m):void 0}}function l(p,d,g,_,y,b){switch(typeof d=="object"&&d!==null&&typeof d.toJSON=="function"&&(d=d.toJSON(p)),typeof d){case"string":return Pt(d);case"object":{if(d===null)return"null";if(g.indexOf(d)!==-1)return r;let m=b,w="",E=",";if(Array.isArray(d)){if(d.length===0)return"[]";if(o<g.length+1)return'"[Array]"';g.push(d),y!==""&&(b+=y,w+=`
|
|
100
|
-
${b}`,E=`,
|
|
101
|
-
${b}`);let k=Math.min(d.length,u),O=0;for(;O<k-1;O++){let H=l(String(O),d[O],g,_,y,b);w+=H!==void 0?H:"null",w+=E}let R=l(String(O),d[O],g,_,y,b);if(w+=R!==void 0?R:"null",d.length-1>u){let H=d.length-u-1;w+=`${E}"... ${rr(H)} not stringified"`}return y!==""&&(w+=`
|
|
102
|
-
${m}`),g.pop(),`[${w}]`}g.push(d);let A="";y!==""&&(b+=y,E=`,
|
|
103
|
-
${b}`,A=" ");let T="";for(let k of _){let O=l(k,d[k],g,_,y,b);O!==void 0&&(w+=`${T}${Pt(k)}:${A}${O}`,T=E)}return y!==""&&T.length>1&&(w=`
|
|
104
|
-
${b}${w}
|
|
105
|
-
${m}`),g.pop(),`{${w}}`}case"number":return isFinite(d)?String(d):e?e(d):"null";case"boolean":return d===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(d);default:return e?e(d):void 0}}function c(p,d,g,_,y){switch(typeof d){case"string":return Pt(d);case"object":{if(d===null)return"null";if(typeof d.toJSON=="function"){if(d=d.toJSON(p),typeof d!="object")return c(p,d,g,_,y);if(d===null)return"null"}if(g.indexOf(d)!==-1)return r;let b=y;if(Array.isArray(d)){if(d.length===0)return"[]";if(o<g.length+1)return'"[Array]"';g.push(d),y+=_;let O=`
|
|
106
|
-
${y}`,R=`,
|
|
107
|
-
${y}`,H=Math.min(d.length,u),W=0;for(;W<H-1;W++){let re=c(String(W),d[W],g,_,y);O+=re!==void 0?re:"null",O+=R}let V=c(String(W),d[W],g,_,y);if(O+=V!==void 0?V:"null",d.length-1>u){let re=d.length-u-1;O+=`${R}"... ${rr(re)} not stringified"`}return O+=`
|
|
108
|
-
${b}`,g.pop(),`[${O}]`}let m=Object.keys(d),w=m.length;if(w===0)return"{}";if(o<g.length+1)return'"[Object]"';y+=_;let E=`,
|
|
109
|
-
${y}`,A="",T="",k=Math.min(w,u);Za(d)&&(A+=ub(d,E,u),m=m.slice(d.length),k-=d.length,T=E),n&&(m=Xa(m,s)),g.push(d);for(let O=0;O<k;O++){let R=m[O],H=c(R,d[R],g,_,y);H!==void 0&&(A+=`${T}${Pt(R)}: ${H}`,T=E)}if(w>u){let O=w-u;A+=`${T}"...": "${rr(O)} not stringified"`,T=E}return T!==""&&(A=`
|
|
110
|
-
${y}${A}
|
|
111
|
-
${b}`),g.pop(),`{${A}}`}case"number":return isFinite(d)?String(d):e?e(d):"null";case"boolean":return d===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(d);default:return e?e(d):void 0}}function f(p,d,g){switch(typeof d){case"string":return Pt(d);case"object":{if(d===null)return"null";if(typeof d.toJSON=="function"){if(d=d.toJSON(p),typeof d!="object")return f(p,d,g);if(d===null)return"null"}if(g.indexOf(d)!==-1)return r;let _="",y=d.length!==void 0;if(y&&Array.isArray(d)){if(d.length===0)return"[]";if(o<g.length+1)return'"[Array]"';g.push(d);let A=Math.min(d.length,u),T=0;for(;T<A-1;T++){let O=f(String(T),d[T],g);_+=O!==void 0?O:"null",_+=","}let k=f(String(T),d[T],g);if(_+=k!==void 0?k:"null",d.length-1>u){let O=d.length-u-1;_+=`,"... ${rr(O)} not stringified"`}return g.pop(),`[${_}]`}let b=Object.keys(d),m=b.length;if(m===0)return"{}";if(o<g.length+1)return'"[Object]"';let w="",E=Math.min(m,u);y&&Za(d)&&(_+=ub(d,",",u),b=b.slice(d.length),E-=d.length,w=","),n&&(b=Xa(b,s)),g.push(d);for(let A=0;A<E;A++){let T=b[A],k=f(T,d[T],g);k!==void 0&&(_+=`${w}${Pt(T)}:${k}`,w=",")}if(m>u){let A=m-u;_+=`${w}"...":"${rr(A)} not stringified"`}return g.pop(),`{${_}}`}case"number":return isFinite(d)?String(d):e?e(d):"null";case"boolean":return d===!0?"true":"false";case"undefined":return;case"bigint":if(i)return String(d);default:return e?e(d):void 0}}function h(p,d,g){if(arguments.length>1){let _="";if(typeof g=="number"?_=" ".repeat(Math.min(g,10)):typeof g=="string"&&(_=g.slice(0,10)),d!=null){if(typeof d=="function")return a("",{"":p},[],d,_,"");if(Array.isArray(d))return l("",p,[],nP(d),_,"")}if(_.length!==0)return c("",p,[],_,"")}return f("",p,[])}return h}});var gb=S((SN,pb)=>{"use strict";var ru=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:db}=ms(),oP=db.info;function lP(t,e){let r=0;t=t||[],e=e||{dedupe:!1};let i=Object.create(db);i.silent=1/0,e.levels&&typeof e.levels=="object"&&Object.keys(e.levels).forEach(f=>{i[f]=e.levels[f]});let n={write:s,add:a,emit:o,flushSync:u,end:l,minLevel:0,streams:[],clone:c,[ru]:!0,streamLevels:i};return Array.isArray(t)?t.forEach(a,n):a.call(n,t),t=null,n;function s(f){let h,p=this.lastLevel,{streams:d}=this,g=0,_;for(let y=uP(d.length,e.dedupe);fP(y,d.length,e.dedupe);y=cP(y,e.dedupe))if(h=d[y],h.level<=p){if(g!==0&&g!==h.level)break;if(_=h.stream,_[ru]){let{lastTime:b,lastMsg:m,lastObj:w,lastLogger:E}=this;_.lastLevel=p,_.lastTime=b,_.lastMsg=m,_.lastObj=w,_.lastLogger=E}_.write(f),e.dedupe&&(g=h.level)}else if(!e.dedupe)break}function o(...f){for(let{stream:h}of this.streams)typeof h.emit=="function"&&h.emit(...f)}function u(){for(let{stream:f}of this.streams)typeof f.flushSync=="function"&&f.flushSync()}function a(f){if(!f)return n;let h=typeof f.write=="function"||f.stream,p=f.write?f:f.stream;if(!h)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:d,streamLevels:g}=this,_;typeof f.levelVal=="number"?_=f.levelVal:typeof f.level=="string"?_=g[f.level]:typeof f.level=="number"?_=f.level:_=oP;let y={stream:p,level:_,levelVal:void 0,id:r++};return d.unshift(y),d.sort(aP),this.minLevel=d[0].level,n}function l(){for(let{stream:f}of this.streams)typeof f.flushSync=="function"&&f.flushSync(),f.end()}function c(f){let h=new Array(this.streams.length);for(let p=0;p<h.length;p++)h[p]={level:f,stream:this.streams[p].stream};return{write:s,add:a,minLevel:f,streams:h,clone:c,emit:o,flushSync:u,[ru]:!0}}}function aP(t,e){return t.level-e.level}function uP(t,e){return e?t-1:0}function cP(t,e){return e?t-1:t+1}function fP(t,e,r){return r?t>=0:t<e}pb.exports=lP});var Ib=S((vN,Oe)=>{"use strict";var hP=require("os"),Eb=wa(),dP=Sa(),pP=ka(),xb=a_(),gP=ab(),Ob=Fr(),{configure:yP}=hb(),{assertDefaultLevelFound:_P,mappings:Tb,genLsCache:bP,genLevelComparison:mP,assertLevelComparison:wP}=za(),{DEFAULT_LEVELS:Ab,SORTING_ORDER:SP}=ms(),{createArgsNormalizer:vP,asChindings:EP,buildSafeSonicBoom:yb,buildFormatters:xP,stringify:iu,normalizeDestFileDescriptor:_b,noop:OP}=bs(),{version:TP}=Ga(),{chindingsSym:bb,redactFmtSym:AP,serializersSym:mb,timeSym:kP,timeSliceIndexSym:IP,streamSym:CP,stringifySym:wb,stringifySafeSym:nu,stringifiersSym:Sb,setLevelSym:PP,endSym:RP,formatOptsSym:MP,messageKeySym:BP,errorKeySym:LP,nestedKeySym:NP,mixinSym:jP,levelCompSym:qP,useOnlyCustomLevelsSym:DP,formattersSym:vb,hooksSym:WP,nestedKeyStrSym:FP,mixinMergeStrategySym:UP,msgPrefixSym:$P}=Ob,{epochTime:kb,nullTime:VP}=xb,{pid:KP}=process,HP=hP.hostname(),zP=Eb.err,GP={level:"info",levelComparison:SP.ASC,levels:Ab,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:KP,hostname:HP},serializers:Object.assign(Object.create(null),{err:zP}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0},timestamp:kb,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},QP=vP(GP),JP=Object.assign(Object.create(null),Eb);function su(...t){let e={},{opts:r,stream:i}=QP(e,dP(),...t);r.level&&typeof r.level=="string"&&Ab[r.level.toLowerCase()]!==void 0&&(r.level=r.level.toLowerCase());let{redact:n,crlf:s,serializers:o,timestamp:u,messageKey:a,errorKey:l,nestedKey:c,base:f,name:h,level:p,customLevels:d,levelComparison:g,mixin:_,mixinMergeStrategy:y,useOnlyCustomLevels:b,formatters:m,hooks:w,depthLimit:E,edgeLimit:A,onChild:T,msgPrefix:k}=r,O=yP({maximumDepth:E,maximumBreadth:A}),R=xP(m.level,m.bindings,m.log),H=iu.bind({[nu]:O}),W=n?pP(n,H):{},V=n?{stringify:W[AP]}:{stringify:H},re="}"+(s?`\r
|
|
112
|
-
`:`
|
|
113
|
-
`),de=EP.bind(null,{[bb]:"",[mb]:o,[Sb]:W,[wb]:iu,[nu]:O,[vb]:R}),Ye="";f!==null&&(h===void 0?Ye=de(f):Ye=de(Object.assign({},f,{name:h})));let ht=u instanceof Function?u:u?kb:VP,Ss=ht().indexOf(":")+1;if(b&&!d)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(_&&typeof _!="function")throw Error(`Unknown mixin type "${typeof _}" - expected "function"`);if(k&&typeof k!="string")throw Error(`Unknown msgPrefix type "${typeof k}" - expected "string"`);_P(p,d,b);let lu=Tb(d,b);typeof i.emit=="function"&&i.emit("message",{code:"PINO_CONFIG",config:{levels:lu,messageKey:a,errorKey:l}}),wP(g);let zb=mP(g);return Object.assign(e,{levels:lu,[qP]:zb,[DP]:b,[CP]:i,[kP]:ht,[IP]:Ss,[wb]:iu,[nu]:O,[Sb]:W,[RP]:re,[MP]:V,[BP]:a,[LP]:l,[NP]:c,[FP]:c?`,${JSON.stringify(c)}:{`:"",[mb]:o,[jP]:_,[UP]:y,[bb]:Ye,[vb]:R,[WP]:w,silent:OP,onChild:T,[$P]:k}),Object.setPrototypeOf(e,gP()),bP(e),e[PP](p),e}Oe.exports=su;Oe.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=_b(t.dest||process.stdout.fd),yb(t)):yb({dest:_b(t),minLength:0});Oe.exports.transport=Fa();Oe.exports.multistream=gb();Oe.exports.levels=Tb();Oe.exports.stdSerializers=JP;Oe.exports.stdTimeFunctions=Object.assign({},xb);Oe.exports.symbols=Ob;Oe.exports.version=TP;Oe.exports.default=su;Oe.exports.pino=su});var Cb=S(Vr=>{"use strict";var YP=Vr&&Vr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.logger=void 0;var XP=YP(Ib()),ZP=(0,XP.default)({});Vr.logger=ZP});var Pb=S(nr=>{"use strict";var eR=nr&&nr.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),tR=nr&&nr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&eR(e,t,r)};Object.defineProperty(nr,"__esModule",{value:!0});tR(Cb(),nr)});var Rb=S((ON,ws)=>{"use strict";var rR=function(){"use strict";function t(c,f){return f!=null&&c instanceof f}var e;try{e=Map}catch{e=function(){}}var r;try{r=Set}catch{r=function(){}}var i;try{i=Promise}catch{i=function(){}}function n(c,f,h,p,d){typeof f=="object"&&(h=f.depth,p=f.prototype,d=f.includeNonEnumerable,f=f.circular);var g=[],_=[],y=typeof Buffer<"u";typeof f>"u"&&(f=!0),typeof h>"u"&&(h=1/0);function b(m,w){if(m===null)return null;if(w===0)return m;var E,A;if(typeof m!="object")return m;if(t(m,e))E=new e;else if(t(m,r))E=new r;else if(t(m,i))E=new i(function(de,Ye){m.then(function(ht){de(b(ht,w-1))},function(ht){Ye(b(ht,w-1))})});else if(n.__isArray(m))E=[];else if(n.__isRegExp(m))E=new RegExp(m.source,l(m)),m.lastIndex&&(E.lastIndex=m.lastIndex);else if(n.__isDate(m))E=new Date(m.getTime());else{if(y&&Buffer.isBuffer(m))return Buffer.allocUnsafe?E=Buffer.allocUnsafe(m.length):E=new Buffer(m.length),m.copy(E),E;t(m,Error)?E=Object.create(m):typeof p>"u"?(A=Object.getPrototypeOf(m),E=Object.create(A)):(E=Object.create(p),A=p)}if(f){var T=g.indexOf(m);if(T!=-1)return _[T];g.push(m),_.push(E)}t(m,e)&&m.forEach(function(de,Ye){var ht=b(Ye,w-1),Ss=b(de,w-1);E.set(ht,Ss)}),t(m,r)&&m.forEach(function(de){var Ye=b(de,w-1);E.add(Ye)});for(var k in m){var O;A&&(O=Object.getOwnPropertyDescriptor(A,k)),!(O&&O.set==null)&&(E[k]=b(m[k],w-1))}if(Object.getOwnPropertySymbols)for(var R=Object.getOwnPropertySymbols(m),k=0;k<R.length;k++){var H=R[k],W=Object.getOwnPropertyDescriptor(m,H);W&&!W.enumerable&&!d||(E[H]=b(m[H],w-1),W.enumerable||Object.defineProperty(E,H,{enumerable:!1}))}if(d)for(var V=Object.getOwnPropertyNames(m),k=0;k<V.length;k++){var re=V[k],W=Object.getOwnPropertyDescriptor(m,re);W&&W.enumerable||(E[re]=b(m[re],w-1),Object.defineProperty(E,re,{enumerable:!1}))}return E}return b(c,h)}n.clonePrototype=function(f){if(f===null)return null;var h=function(){};return h.prototype=f,new h};function s(c){return Object.prototype.toString.call(c)}n.__objToStr=s;function o(c){return typeof c=="object"&&s(c)==="[object Date]"}n.__isDate=o;function u(c){return typeof c=="object"&&s(c)==="[object Array]"}n.__isArray=u;function a(c){return typeof c=="object"&&s(c)==="[object RegExp]"}n.__isRegExp=a;function l(c){var f="";return c.global&&(f+="g"),c.ignoreCase&&(f+="i"),c.multiline&&(f+="m"),f}return n.__getRegExpFlags=l,n}();typeof ws=="object"&&ws.exports&&(ws.exports=rR)});var Lb=S((Mb,Bb)=>{"use strict";(function(){var t,e,r,i=[].splice,n=function(o,u){if(!(o instanceof u))throw new Error("Bound instance method accessed before binding")},s=[].indexOf;r=Rb(),t=require("events").EventEmitter,Bb.exports=e=function(){class o extends t{constructor(a={}){super(),this.get=this.get.bind(this),this.mget=this.mget.bind(this),this.set=this.set.bind(this),this.mset=this.mset.bind(this),this.del=this.del.bind(this),this.take=this.take.bind(this),this.ttl=this.ttl.bind(this),this.getTtl=this.getTtl.bind(this),this.keys=this.keys.bind(this),this.has=this.has.bind(this),this.getStats=this.getStats.bind(this),this.flushAll=this.flushAll.bind(this),this.flushStats=this.flushStats.bind(this),this.close=this.close.bind(this),this._checkData=this._checkData.bind(this),this._check=this._check.bind(this),this._isInvalidKey=this._isInvalidKey.bind(this),this._wrap=this._wrap.bind(this),this._getValLength=this._getValLength.bind(this),this._error=this._error.bind(this),this._initErrors=this._initErrors.bind(this),this.options=a,this._initErrors(),this.data={},this.options=Object.assign({forceString:!1,objectValueSize:80,promiseValueSize:80,arrayValueSize:40,stdTTL:0,checkperiod:600,useClones:!0,deleteOnExpire:!0,enableLegacyCallbacks:!1,maxKeys:-1},this.options),this.options.enableLegacyCallbacks&&(console.warn("WARNING! node-cache legacy callback support will drop in v6.x"),["get","mget","set","del","ttl","getTtl","keys","has"].forEach(l=>{var c;c=this[l],this[l]=function(...f){var h,p,d,g;if(d=f,[...f]=d,[h]=i.call(f,-1),typeof h=="function")try{g=c(...f),h(null,g)}catch(_){p=_,h(p)}else return c(...f,h)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(a){var l,c;if(n(this,o),(c=this._isInvalidKey(a))!=null)throw c;if(this.data[a]!=null&&this._check(a,this.data[a]))return this.stats.hits++,l=this._unwrap(this.data[a]),l;this.stats.misses++}mget(a){var l,c,f,h,p,d;if(n(this,o),!Array.isArray(a))throw l=this._error("EKEYSTYPE"),l;for(d={},f=0,p=a.length;f<p;f++){if(h=a[f],(c=this._isInvalidKey(h))!=null)throw c;this.data[h]!=null&&this._check(h,this.data[h])?(this.stats.hits++,d[h]=this._unwrap(this.data[h])):this.stats.misses++}return d}set(a,l,c){var f,h,p;if(n(this,o),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw f=this._error("ECACHEFULL"),f;if(this.options.forceString&&!1==="string"&&(l=JSON.stringify(l)),c==null&&(c=this.options.stdTTL),(h=this._isInvalidKey(a))!=null)throw h;return p=!1,this.data[a]&&(p=!0,this.stats.vsize-=this._getValLength(this._unwrap(this.data[a],!1))),this.data[a]=this._wrap(l,c),this.stats.vsize+=this._getValLength(l),p||(this.stats.ksize+=this._getKeyLength(a),this.stats.keys++),this.emit("set",a,l),!0}mset(a){var l,c,f,h,p,d,g,_,y,b;if(n(this,o),this.options.maxKeys>-1&&this.stats.keys+a.length>=this.options.maxKeys)throw l=this._error("ECACHEFULL"),l;for(f=0,g=a.length;f<g;f++){if(d=a[f],{key:p,val:b,ttl:y}=d,y&&typeof y!="number")throw l=this._error("ETTLTYPE"),l;if((c=this._isInvalidKey(p))!=null)throw c}for(h=0,_=a.length;h<_;h++)d=a[h],{key:p,val:b,ttl:y}=d,this.set(p,b,y);return!0}del(a){var l,c,f,h,p,d;for(n(this,o),Array.isArray(a)||(a=[a]),l=0,f=0,p=a.length;f<p;f++){if(h=a[f],(c=this._isInvalidKey(h))!=null)throw c;this.data[h]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[h],!1)),this.stats.ksize-=this._getKeyLength(h),this.stats.keys--,l++,d=this.data[h],delete this.data[h],this.emit("del",h,d.v))}return l}take(a){var l;return n(this,o),l=this.get(a),l!=null&&this.del(a),l}ttl(a,l){var c;if(n(this,o),l||(l=this.options.stdTTL),!a)return!1;if((c=this._isInvalidKey(a))!=null)throw c;return this.data[a]!=null&&this._check(a,this.data[a])?(l>=0?this.data[a]=this._wrap(this.data[a].v,l,!1):this.del(a),!0):!1}getTtl(a){var l,c;if(n(this,o),!!a){if((c=this._isInvalidKey(a))!=null)throw c;if(this.data[a]!=null&&this._check(a,this.data[a]))return l=this.data[a].t,l}}keys(){var a;return n(this,o),a=Object.keys(this.data),a}has(a){var l;return n(this,o),l=this.data[a]!=null&&this._check(a,this.data[a]),l}getStats(){return n(this,o),this.stats}flushAll(a=!0){n(this,o),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(a),this.emit("flush")}flushStats(){n(this,o),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){n(this,o),this._killCheckPeriod()}_checkData(a=!0){var l,c,f;n(this,o),c=this.data;for(l in c)f=c[l],this._check(l,f);a&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,a),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(a,l){var c;return n(this,o),c=!0,l.t!==0&&l.t<Date.now()&&(this.options.deleteOnExpire&&(c=!1,this.del(a)),this.emit("expired",a,this._unwrap(l))),c}_isInvalidKey(a){var l;if(n(this,o),l=typeof a,s.call(this.validKeyTypes,l)<0)return this._error("EKEYTYPE",{type:typeof a})}_wrap(a,l,c=!0){var f,h,p,d;return n(this,o),this.options.useClones||(c=!1),h=Date.now(),f=0,d=1e3,l===0?f=0:l?f=h+l*d:this.options.stdTTL===0?f=this.options.stdTTL:f=h+this.options.stdTTL*d,p={t:f,v:c?r(a):a}}_unwrap(a,l=!0){return this.options.useClones||(l=!1),a.v!=null?l?r(a.v):a.v:null}_getKeyLength(a){return a.toString().length}_getValLength(a){return n(this,o),typeof a=="string"?a.length:this.options.forceString?JSON.stringify(a).length:Array.isArray(a)?this.options.arrayValueSize*a.length:typeof a=="number"?8:typeof a?.then=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(a)?a.length:a!=null&&typeof a=="object"?this.options.objectValueSize*Object.keys(a).length:typeof a=="boolean"?8:0}_error(a,l={}){var c;return n(this,o),c=new Error,c.name=a,c.errorcode=a,c.message=this.ERRORS[a]!=null?this.ERRORS[a](l):"-",c.data=l,c}_initErrors(){var a,l,c;n(this,o),this.ERRORS={},c=this._ERRORS;for(l in c)a=c[l],this.ERRORS[l]=this.createErrorMessage(a)}createErrorMessage(a){return function(l){return a.replace("__key",l.type)}}}return o.prototype._ERRORS={ENOTFOUND:"Key `__key` not found",ECACHEFULL:"Cache max keys amount exceeded",EKEYTYPE:"The key argument has to be of type `string` or `number`. Found: `__key`",EKEYSTYPE:"The keys argument has to be an array.",ETTLTYPE:"The ttl argument has to be a number."},o}.call(this)}).call(Mb)});var qb=S((Nb,jb)=>{"use strict";(function(){var t;t=jb.exports=Lb(),t.version="5.1.2"}).call(Nb)});var Db=S(Je=>{"use strict";var iR=Je&&Je.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Je,"__esModule",{value:!0});Je.deleteCacheData=Je.getCacheData=Je.setCacheData=void 0;var nR=iR(qb()),ou=new nR.default,sR=function(t,e){ou.set(t,e)};Je.setCacheData=sR;var oR=function(t){return ou.get(t)};Je.getCacheData=oR;var lR=function(t){return ou.del(t)};Je.deleteCacheData=lR});var Wb=S(sr=>{"use strict";var aR=sr&&sr.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),uR=sr&&sr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&aR(e,t,r)};Object.defineProperty(sr,"__esModule",{value:!0});uR(Db(),sr)});var _R={};vs(_R,{getMqttClient:()=>yR,mqttCreateConnection:()=>gR,mqttDisconnect:()=>Vb,mqttOnMessage:()=>Kb,mqttSub:()=>$b,mqttUnSub:()=>dR});module.exports=xs(_R);var Fb=Es(by()),ne=Es(Pb()),or=Es(Wb()),cR={protocol:"mqtt",port:1883,host:"test.mosquitto.org"},fR={protocol:"wss",port:8081,host:"test.mosquitto.org"},Ub="",hR=t=>{let{protocol:e,host:r,port:i}=t.option==="web"?fR:cR,n=`${e}://${r}:${i}`,s=(0,Fb.connect)(n,{clientId:t.value,clean:!0,rejectUnauthorized:!1,resubscribe:!0,keepalive:300});return Ub=t.value,s.setMaxListeners(100),s.on("connect",()=>{ne.logger.info("MQTT connection successful"),(0,or.setCacheData)("mqttClientStatus","connect"),$b(t.topicList,t.messageCallback,s)}),s.on("error",o=>{ne.logger.error(`MQTT Connection error: ${JSON.stringify(o)}`),(0,or.setCacheData)("mqttClientStatus","error"),Vb(t,!0,s)}),s.on("reconnect",()=>{(0,or.setCacheData)("mqttClientStatus","reconnect"),ne.logger.info("MQTT Reconnecting")}),s.on("close",()=>{(0,or.setCacheData)("mqttClientStatus","close"),ne.logger.info("MQTT connection closed")}),s.on("offline",()=>{(0,or.setCacheData)("mqttClientStatus","offline"),ne.logger.info("MQTT connection offline")}),s},$b=(t,e,r)=>{try{r?.subscribe(t,{qos:0},(i,n)=>{i&&ne.logger.error(`Subscribe to topics error: ${i.message}`);let s=[];n?.forEach(o=>{s.push(o.topic),ne.logger.info(`Subscribed to topics: ${o.topic}`)}),(0,or.setCacheData)("subscribedTopic",s),e&&Kb(e,r)})}catch(i){ne.logger.error(`Subscribed error ${JSON.stringify(i)}`)}},dR=(t,e)=>{try{e?.unsubscribe(t,r=>{if(r){ne.logger.error(`Unsubscribe to topics error: ${r.message}`);return}t.forEach(i=>{ne.logger.info(`unsubscribed to topic: ${i}`)})})}catch(r){ne.logger.error(`unsubscribed error: ${JSON.stringify(r)}`)}},Vb=(t,e,r)=>{try{r?.end(!1,()=>{ne.logger.info("MQTT disconnected successfully"),e&&Hb({...t,value:`client${Math.random().toString(36).substring(7)}`})})}catch(i){ne.logger.error(`disconnect error: ${JSON.stringify(i)}`)}},Kb=(t,e)=>{try{e?.on("message",(r,i)=>{t(r,i.toString())})}catch(r){ne.logger.error(`MQTT onmessage error: ${JSON.stringify(r)}`)}},pR=()=>{let t={};return e=>{if(e.value in t)return ne.logger.info("fetching mqtt cache"),t[e.value];ne.logger.info("Creating new mqtt cache");let r=hR(e);return t[e.value]=r,r}},Hb=pR(),gR=t=>Hb(t),yR=()=>Ub;0&&(module.exports={getMqttClient,mqttCreateConnection,mqttDisconnect,mqttOnMessage,mqttSub,mqttUnSub});
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./mqttClient"), exports);
|