@ramme-io/kernel 2.1.0 → 2.1.2

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.
Files changed (53) hide show
  1. package/dist/index-rELWPQV7.js +1157 -0
  2. package/dist/index.es.js +40238 -9287
  3. package/dist/kernel/src/components/AIChatPanel.d.ts +22 -0
  4. package/dist/kernel/src/components/AIChatPanel.d.ts.map +1 -0
  5. package/dist/kernel/src/components/settings/AiSettingsPanel.d.ts +10 -0
  6. package/dist/kernel/src/components/settings/AiSettingsPanel.d.ts.map +1 -0
  7. package/dist/kernel/src/components/settings/SettingsModal.d.ts.map +1 -1
  8. package/dist/kernel/src/engine/runtime/useRammeAI.d.ts +43 -0
  9. package/dist/kernel/src/engine/runtime/useRammeAI.d.ts.map +1 -0
  10. package/dist/kernel/src/index.d.ts +10 -0
  11. package/dist/kernel/src/index.d.ts.map +1 -1
  12. package/dist/kernel/src/server.d.ts +39 -0
  13. package/dist/kernel/src/server.d.ts.map +1 -0
  14. package/dist/kernel/src/services/AiGateway.d.ts +18 -0
  15. package/dist/kernel/src/services/AiGateway.d.ts.map +1 -0
  16. package/dist/kernel/src/services/ai/AiGatewayService.d.ts +31 -0
  17. package/dist/kernel/src/services/ai/AiGatewayService.d.ts.map +1 -0
  18. package/dist/kernel/src/services/ai/ConfigResolver.d.ts +32 -0
  19. package/dist/kernel/src/services/ai/ConfigResolver.d.ts.map +1 -0
  20. package/dist/kernel/src/services/ai/RateLimiter.d.ts +18 -0
  21. package/dist/kernel/src/services/ai/RateLimiter.d.ts.map +1 -0
  22. package/dist/kernel/src/services/ai/adapters/LocalTransportAdapter.d.ts +7 -0
  23. package/dist/kernel/src/services/ai/adapters/LocalTransportAdapter.d.ts.map +1 -0
  24. package/dist/kernel/src/services/ai/adapters/ProxyTransportAdapter.d.ts +9 -0
  25. package/dist/kernel/src/services/ai/adapters/ProxyTransportAdapter.d.ts.map +1 -0
  26. package/dist/kernel/src/services/ai/index.d.ts +18 -0
  27. package/dist/kernel/src/services/ai/index.d.ts.map +1 -0
  28. package/dist/kernel/src/services/ai/models.d.ts +6 -0
  29. package/dist/kernel/src/services/ai/models.d.ts.map +1 -0
  30. package/dist/kernel/src/services/ai/providers/AnthropicAdapter.d.ts +10 -0
  31. package/dist/kernel/src/services/ai/providers/AnthropicAdapter.d.ts.map +1 -0
  32. package/dist/kernel/src/services/ai/providers/DeepSeekAdapter.d.ts +10 -0
  33. package/dist/kernel/src/services/ai/providers/DeepSeekAdapter.d.ts.map +1 -0
  34. package/dist/kernel/src/services/ai/providers/GeminiAdapter.d.ts +10 -0
  35. package/dist/kernel/src/services/ai/providers/GeminiAdapter.d.ts.map +1 -0
  36. package/dist/kernel/src/services/ai/providers/GrokAdapter.d.ts +10 -0
  37. package/dist/kernel/src/services/ai/providers/GrokAdapter.d.ts.map +1 -0
  38. package/dist/kernel/src/services/ai/providers/OllamaAdapter.d.ts +9 -0
  39. package/dist/kernel/src/services/ai/providers/OllamaAdapter.d.ts.map +1 -0
  40. package/dist/kernel/src/services/ai/providers/OpenAIAdapter.d.ts +10 -0
  41. package/dist/kernel/src/services/ai/providers/OpenAIAdapter.d.ts.map +1 -0
  42. package/dist/kernel/src/services/ai/transport.d.ts +37 -0
  43. package/dist/kernel/src/services/ai/transport.d.ts.map +1 -0
  44. package/dist/kernel/src/services/ai/types.d.ts +38 -0
  45. package/dist/kernel/src/services/ai/types.d.ts.map +1 -0
  46. package/dist/kernel/src/stores/spatialStore.d.ts +25 -0
  47. package/dist/kernel/src/stores/spatialStore.d.ts.map +1 -0
  48. package/dist/kernel/src/stores/useSettingsStore.d.ts +17 -0
  49. package/dist/kernel/src/stores/useSettingsStore.d.ts.map +1 -1
  50. package/dist/server.d.ts +1 -0
  51. package/dist/server.es.js +26 -0
  52. package/package.json +14 -8
  53. package/dist/index.umd.js +0 -120
package/dist/index.umd.js DELETED
@@ -1,120 +0,0 @@
1
- (function(je,Te){typeof exports=="object"&&typeof module<"u"?Te(exports,require("react"),require("@ramme-io/ui"),require("zod")):typeof define=="function"&&define.amd?define(["exports","react","@ramme-io/ui","zod"],Te):(je=typeof globalThis<"u"?globalThis:je||self,Te(je.RammeKernel={},je.React,je.ui,je.Zod))})(this,function(je,Te,qe,be){"use strict";var Xh=Object.defineProperty;var pu=je=>{throw TypeError(je)};var Zh=(je,Te,qe)=>Te in je?Xh(je,Te,{enumerable:!0,configurable:!0,writable:!0,value:qe}):je[Te]=qe;var Pe=(je,Te,qe)=>Zh(je,typeof Te!="symbol"?Te+"":Te,qe),zo=(je,Te,qe)=>Te.has(je)||pu("Cannot "+qe);var F=(je,Te,qe)=>(zo(je,Te,"read from private field"),qe?qe.call(je):Te.get(je)),Qe=(je,Te,qe)=>Te.has(je)?pu("Cannot add the same private member more than once"):Te instanceof WeakSet?Te.add(je):Te.set(je,qe),$e=(je,Te,qe,be)=>(zo(je,Te,"write to private field"),be?be.call(je,qe):Te.set(je,qe),qe),Le=(je,Te,qe)=>(zo(je,Te,"access private method"),qe);var ln=(je,Te,qe,be)=>({set _(fn){$e(je,Te,fn,qe)},get _(){return F(je,Te,be)}});function fn(o){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(l,s,a.get?a:{enumerable:!0,get:()=>o[s]})}}return l.default=o,Object.freeze(l)}const st=fn(Te);var hn={exports:{}},fr={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Jo;function Au(){if(Jo)return fr;Jo=1;var o=Te,l=Symbol.for("react.element"),s=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,u=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,r={key:!0,ref:!0,__self:!0,__source:!0};function t(n,e,i){var c,h={},d=null,m=null;i!==void 0&&(d=""+i),e.key!==void 0&&(d=""+e.key),e.ref!==void 0&&(m=e.ref);for(c in e)a.call(e,c)&&!r.hasOwnProperty(c)&&(h[c]=e[c]);if(n&&n.defaultProps)for(c in e=n.defaultProps,e)h[c]===void 0&&(h[c]=e[c]);return{$$typeof:l,type:n,key:d,ref:m,props:h,_owner:u.current}}return fr.Fragment=s,fr.jsx=t,fr.jsxs=t,fr}var hr={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Xo;function xu(){return Xo||(Xo=1,process.env.NODE_ENV!=="production"&&function(){var o=Te,l=Symbol.for("react.element"),s=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),n=Symbol.for("react.context"),e=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),b=Symbol.iterator,w="@@iterator";function _(K){if(K===null||typeof K!="object")return null;var Ae=b&&K[b]||K[w];return typeof Ae=="function"?Ae:null}var A=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(K){{for(var Ae=arguments.length,Re=new Array(Ae>1?Ae-1:0),We=1;We<Ae;We++)Re[We-1]=arguments[We];S("error",K,Re)}}function S(K,Ae,Re){{var We=A.ReactDebugCurrentFrame,He=We.getStackAddendum();He!==""&&(Ae+="%s",Re=Re.concat([He]));var Ge=Re.map(function(ze){return String(ze)});Ge.unshift("Warning: "+Ae),Function.prototype.apply.call(console[K],console,Ge)}}var E=!1,v=!1,C=!1,P=!1,I=!1,O;O=Symbol.for("react.module.reference");function k(K){return!!(typeof K=="string"||typeof K=="function"||K===a||K===r||I||K===u||K===i||K===c||P||K===m||E||v||C||typeof K=="object"&&K!==null&&(K.$$typeof===d||K.$$typeof===h||K.$$typeof===t||K.$$typeof===n||K.$$typeof===e||K.$$typeof===O||K.getModuleId!==void 0))}function M(K,Ae,Re){var We=K.displayName;if(We)return We;var He=Ae.displayName||Ae.name||"";return He!==""?Re+"("+He+")":Re}function x(K){return K.displayName||"Context"}function W(K){if(K==null)return null;if(typeof K.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof K=="function")return K.displayName||K.name||null;if(typeof K=="string")return K;switch(K){case a:return"Fragment";case s:return"Portal";case r:return"Profiler";case u:return"StrictMode";case i:return"Suspense";case c:return"SuspenseList"}if(typeof K=="object")switch(K.$$typeof){case n:var Ae=K;return x(Ae)+".Consumer";case t:var Re=K;return x(Re._context)+".Provider";case e:return M(K,K.render,"ForwardRef");case h:var We=K.displayName||null;return We!==null?We:W(K.type)||"Memo";case d:{var He=K,Ge=He._payload,ze=He._init;try{return W(ze(Ge))}catch{return null}}}return null}var $=Object.assign,L=0,le,re,ee,ue,G,oe,R;function Q(){}Q.__reactDisabledLog=!0;function he(){{if(L===0){le=console.log,re=console.info,ee=console.warn,ue=console.error,G=console.group,oe=console.groupCollapsed,R=console.groupEnd;var K={configurable:!0,enumerable:!0,value:Q,writable:!0};Object.defineProperties(console,{info:K,log:K,warn:K,error:K,group:K,groupCollapsed:K,groupEnd:K})}L++}}function V(){{if(L--,L===0){var K={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:$({},K,{value:le}),info:$({},K,{value:re}),warn:$({},K,{value:ee}),error:$({},K,{value:ue}),group:$({},K,{value:G}),groupCollapsed:$({},K,{value:oe}),groupEnd:$({},K,{value:R})})}L<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ee=A.ReactCurrentDispatcher,X;function U(K,Ae,Re){{if(X===void 0)try{throw Error()}catch(He){var We=He.stack.trim().match(/\n( *(at )?)/);X=We&&We[1]||""}return`
18
- `+X+K}}var ae=!1,H;{var te=typeof WeakMap=="function"?WeakMap:Map;H=new te}function ne(K,Ae){if(!K||ae)return"";{var Re=H.get(K);if(Re!==void 0)return Re}var We;ae=!0;var He=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ge;Ge=Ee.current,Ee.current=null,he();try{if(Ae){var ze=function(){throw Error()};if(Object.defineProperty(ze.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ze,[])}catch(At){We=At}Reflect.construct(K,[],ze)}else{try{ze.call()}catch(At){We=At}K.call(ze.prototype)}}else{try{throw Error()}catch(At){We=At}K()}}catch(At){if(At&&We&&typeof At.stack=="string"){for(var Ve=At.stack.split(`
19
- `),it=We.stack.split(`
20
- `),et=Ve.length-1,ht=it.length-1;et>=1&&ht>=0&&Ve[et]!==it[ht];)ht--;for(;et>=1&&ht>=0;et--,ht--)if(Ve[et]!==it[ht]){if(et!==1||ht!==1)do if(et--,ht--,ht<0||Ve[et]!==it[ht]){var It=`
21
- `+Ve[et].replace(" at new "," at ");return K.displayName&&It.includes("<anonymous>")&&(It=It.replace("<anonymous>",K.displayName)),typeof K=="function"&&H.set(K,It),It}while(et>=1&&ht>=0);break}}}finally{ae=!1,Ee.current=Ge,V(),Error.prepareStackTrace=He}var cr=K?K.displayName||K.name:"",rr=cr?U(cr):"";return typeof K=="function"&&H.set(K,rr),rr}function ve(K,Ae,Re){return ne(K,!1)}function ce(K){var Ae=K.prototype;return!!(Ae&&Ae.isReactComponent)}function B(K,Ae,Re){if(K==null)return"";if(typeof K=="function")return ne(K,ce(K));if(typeof K=="string")return U(K);switch(K){case i:return U("Suspense");case c:return U("SuspenseList")}if(typeof K=="object")switch(K.$$typeof){case e:return ve(K.render);case h:return B(K.type,Ae,Re);case d:{var We=K,He=We._payload,Ge=We._init;try{return B(Ge(He),Ae,Re)}catch{}}}return""}var Y=Object.prototype.hasOwnProperty,se={},ye=A.ReactDebugCurrentFrame;function pe(K){if(K){var Ae=K._owner,Re=B(K.type,K._source,Ae?Ae.type:null);ye.setExtraStackFrame(Re)}else ye.setExtraStackFrame(null)}function Se(K,Ae,Re,We,He){{var Ge=Function.call.bind(Y);for(var ze in K)if(Ge(K,ze)){var Ve=void 0;try{if(typeof K[ze]!="function"){var it=Error((We||"React class")+": "+Re+" type `"+ze+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof K[ze]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw it.name="Invariant Violation",it}Ve=K[ze](Ae,ze,We,Re,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(et){Ve=et}Ve&&!(Ve instanceof Error)&&(pe(He),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",We||"React class",Re,ze,typeof Ve),pe(null)),Ve instanceof Error&&!(Ve.message in se)&&(se[Ve.message]=!0,pe(He),g("Failed %s type: %s",Re,Ve.message),pe(null))}}}var Z=Array.isArray;function we(K){return Z(K)}function ke(K){{var Ae=typeof Symbol=="function"&&Symbol.toStringTag,Re=Ae&&K[Symbol.toStringTag]||K.constructor.name||"Object";return Re}}function fe(K){try{return Ue(K),!1}catch{return!0}}function Ue(K){return""+K}function f(K){if(fe(K))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ke(K)),Ue(K)}var p=A.ReactCurrentOwner,y={key:!0,ref:!0,__self:!0,__source:!0},T,N;function z(K){if(Y.call(K,"ref")){var Ae=Object.getOwnPropertyDescriptor(K,"ref").get;if(Ae&&Ae.isReactWarning)return!1}return K.ref!==void 0}function ie(K){if(Y.call(K,"key")){var Ae=Object.getOwnPropertyDescriptor(K,"key").get;if(Ae&&Ae.isReactWarning)return!1}return K.key!==void 0}function q(K,Ae){typeof K.ref=="string"&&p.current}function J(K,Ae){{var Re=function(){T||(T=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Ae))};Re.isReactWarning=!0,Object.defineProperty(K,"key",{get:Re,configurable:!0})}}function Oe(K,Ae){{var Re=function(){N||(N=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",Ae))};Re.isReactWarning=!0,Object.defineProperty(K,"ref",{get:Re,configurable:!0})}}var Me=function(K,Ae,Re,We,He,Ge,ze){var Ve={$$typeof:l,type:K,key:Ae,ref:Re,props:ze,_owner:Ge};return Ve._store={},Object.defineProperty(Ve._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ve,"_self",{configurable:!1,enumerable:!1,writable:!1,value:We}),Object.defineProperty(Ve,"_source",{configurable:!1,enumerable:!1,writable:!1,value:He}),Object.freeze&&(Object.freeze(Ve.props),Object.freeze(Ve)),Ve};function Ne(K,Ae,Re,We,He){{var Ge,ze={},Ve=null,it=null;Re!==void 0&&(f(Re),Ve=""+Re),ie(Ae)&&(f(Ae.key),Ve=""+Ae.key),z(Ae)&&(it=Ae.ref,q(Ae,He));for(Ge in Ae)Y.call(Ae,Ge)&&!y.hasOwnProperty(Ge)&&(ze[Ge]=Ae[Ge]);if(K&&K.defaultProps){var et=K.defaultProps;for(Ge in et)ze[Ge]===void 0&&(ze[Ge]=et[Ge])}if(Ve||it){var ht=typeof K=="function"?K.displayName||K.name||"Unknown":K;Ve&&J(ze,ht),it&&Oe(ze,ht)}return Me(K,Ve,it,He,We,p.current,ze)}}var Fe=A.ReactCurrentOwner,nt=A.ReactDebugCurrentFrame;function rt(K){if(K){var Ae=K._owner,Re=B(K.type,K._source,Ae?Ae.type:null);nt.setExtraStackFrame(Re)}else nt.setExtraStackFrame(null)}var Ke;Ke=!1;function Xe(K){return typeof K=="object"&&K!==null&&K.$$typeof===l}function De(){{if(Fe.current){var K=W(Fe.current.type);if(K)return`
22
-
23
- Check the render method of \``+K+"`."}return""}}function Ye(K){return""}var Ze={};function lt(K){{var Ae=De();if(!Ae){var Re=typeof K=="string"?K:K.displayName||K.name;Re&&(Ae=`
24
-
25
- Check the top-level render call using <`+Re+">.")}return Ae}}function ct(K,Ae){{if(!K._store||K._store.validated||K.key!=null)return;K._store.validated=!0;var Re=lt(Ae);if(Ze[Re])return;Ze[Re]=!0;var We="";K&&K._owner&&K._owner!==Fe.current&&(We=" It was passed a child from "+W(K._owner.type)+"."),rt(K),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Re,We),rt(null)}}function Et(K,Ae){{if(typeof K!="object")return;if(we(K))for(var Re=0;Re<K.length;Re++){var We=K[Re];Xe(We)&&ct(We,Ae)}else if(Xe(K))K._store&&(K._store.validated=!0);else if(K){var He=_(K);if(typeof He=="function"&&He!==K.entries)for(var Ge=He.call(K),ze;!(ze=Ge.next()).done;)Xe(ze.value)&&ct(ze.value,Ae)}}}function j(K){{var Ae=K.type;if(Ae==null||typeof Ae=="string")return;var Re;if(typeof Ae=="function")Re=Ae.propTypes;else if(typeof Ae=="object"&&(Ae.$$typeof===e||Ae.$$typeof===h))Re=Ae.propTypes;else return;if(Re){var We=W(Ae);Se(Re,K.props,"prop",We,K)}else if(Ae.PropTypes!==void 0&&!Ke){Ke=!0;var He=W(Ae);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",He||"Unknown")}typeof Ae.getDefaultProps=="function"&&!Ae.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function D(K){{for(var Ae=Object.keys(K.props),Re=0;Re<Ae.length;Re++){var We=Ae[Re];if(We!=="children"&&We!=="key"){rt(K),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",We),rt(null);break}}K.ref!==null&&(rt(K),g("Invalid attribute `ref` supplied to `React.Fragment`."),rt(null))}}var xe={};function Ce(K,Ae,Re,We,He,Ge){{var ze=k(K);if(!ze){var Ve="";(K===void 0||typeof K=="object"&&K!==null&&Object.keys(K).length===0)&&(Ve+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var it=Ye();it?Ve+=it:Ve+=De();var et;K===null?et="null":we(K)?et="array":K!==void 0&&K.$$typeof===l?(et="<"+(W(K.type)||"Unknown")+" />",Ve=" Did you accidentally export a JSX literal instead of a component?"):et=typeof K,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",et,Ve)}var ht=Ne(K,Ae,Re,He,Ge);if(ht==null)return ht;if(ze){var It=Ae.children;if(It!==void 0)if(We)if(we(It)){for(var cr=0;cr<It.length;cr++)Et(It[cr],K);Object.freeze&&Object.freeze(It)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Et(It,K)}if(Y.call(Ae,"key")){var rr=W(K),At=Object.keys(Ae).filter(function(Jh){return Jh!=="key"}),Vo=At.length>0?"{key: someKey, "+At.join(": ..., ")+": ...}":"{key: someKey}";if(!xe[rr+Vo]){var Qh=At.length>0?"{"+At.join(": ..., ")+": ...}":"{}";g(`A props object containing a "key" prop is being spread into JSX:
26
- let props = %s;
27
- <%s {...props} />
28
- React keys must be passed directly to JSX without using spread:
29
- let props = %s;
30
- <%s key={someKey} {...props} />`,Vo,rr,Qh,rr),xe[rr+Vo]=!0}}return K===a?D(ht):j(ht),ht}}function Be(K,Ae,Re){return Ce(K,Ae,Re,!0)}function ft(K,Ae,Re){return Ce(K,Ae,Re,!1)}var mt=ft,xt=Be;hr.Fragment=a,hr.jsx=mt,hr.jsxs=xt}()),hr}process.env.NODE_ENV==="production"?hn.exports=Au():hn.exports=xu();var Ie=hn.exports;const pn=Te.createContext(null),Iu=({children:o,manifest:l})=>{const[s,a]=Te.useState(l),[u,r]=Te.useState(!1),t=Te.useRef(!1);return Te.useEffect(()=>{if(t.current)return;t.current=!0;const n=e=>{var i;if(((i=e.data)==null?void 0:i.type)==="RAMME_SYNC_MANIFEST"){const c=e.data.payload;a(c),r(!0)}};return window.addEventListener("message",n),window.parent!==window&&!window.__RAMME_HANDSHAKE_SENT&&(console.log("🔌 [Context] Handshake Sent 🤝"),window.parent.postMessage({type:"RAMME_CLIENT_READY"},"*"),window.__RAMME_HANDSHAKE_SENT=!0),()=>{window.removeEventListener("message",n),t.current=!1}},[]),Ie.jsx(pn.Provider,{value:{manifest:s,isLive:u},children:o})},Ht=()=>{const o=Te.useContext(pn);if(!o)throw new Error("useManifest must be used within a ManifestProvider");return o.manifest},dn=()=>{const o=Te.useContext(pn);return o!=null&&o.isLive?"live":"static"};var gn=Object.defineProperty,ku=Object.getOwnPropertyDescriptor,Tu=Object.getOwnPropertyNames,Ou=Object.prototype.hasOwnProperty,_t=(o,l)=>()=>(o&&(l=o(o=0)),l),_e=(o,l)=>()=>(l||o((l={exports:{}}).exports,l),l.exports),nr=(o,l)=>{for(var s in l)gn(o,s,{get:l[s],enumerable:!0})},Pu=(o,l,s,a)=>{if(l&&typeof l=="object"||typeof l=="function")for(let u of Tu(l))!Ou.call(o,u)&&u!==s&&gn(o,u,{get:()=>l[u],enumerable:!(a=ku(l,u))||a.enumerable});return o},tt=o=>Pu(gn({},"__esModule",{value:!0}),o),de=_t(()=>{}),Je={};nr(Je,{_debugEnd:()=>Qn,_debugProcess:()=>Yn,_events:()=>hi,_eventsCount:()=>pi,_exiting:()=>Nn,_fatalExceptions:()=>Kn,_getActiveHandles:()=>os,_getActiveRequests:()=>is,_kill:()=>Dn,_linkedBinding:()=>rs,_maxListeners:()=>fi,_preload_modules:()=>li,_rawDebug:()=>jn,_startProfilerIdleNotifier:()=>Jn,_stopProfilerIdleNotifier:()=>Xn,_tickCallback:()=>Gn,abort:()=>ri,addListener:()=>di,allowedNodeEnvironmentFlags:()=>Vn,arch:()=>bn,argv:()=>_n,argv0:()=>ai,assert:()=>ss,binding:()=>In,browser:()=>Cn,chdir:()=>On,config:()=>Bn,cpuUsage:()=>dr,cwd:()=>Tn,debugPort:()=>si,default:()=>Si,dlopen:()=>ns,domain:()=>Mn,emit:()=>vi,emitWarning:()=>xn,env:()=>wn,execArgv:()=>Sn,execPath:()=>oi,exit:()=>$n,features:()=>zn,hasUncaughtExceptionCaptureCallback:()=>as,hrtime:()=>Er,kill:()=>Wn,listeners:()=>us,memoryUsage:()=>Fn,moduleLoadList:()=>Rn,nextTick:()=>es,off:()=>mi,on:()=>Ot,once:()=>gi,openStdin:()=>qn,pid:()=>ni,platform:()=>vn,ppid:()=>ii,prependListener:()=>wi,prependOnceListener:()=>_i,reallyExit:()=>Ln,release:()=>Pn,removeAllListeners:()=>bi,removeListener:()=>yi,resourceUsage:()=>Un,setSourceMapsEnabled:()=>ui,setUncaughtExceptionCaptureCallback:()=>Hn,stderr:()=>ei,stdin:()=>ti,stdout:()=>Zn,title:()=>yn,umask:()=>kn,uptime:()=>ls,version:()=>En,versions:()=>An});function mn(o){throw new Error("Node.js process "+o+" is not supported by JSPM core outside of Node.js")}function Cu(){!Gt||!Yt||(Gt=!1,Yt.length?kt=Yt.concat(kt):pr=-1,kt.length&&Zo())}function Zo(){if(!Gt){var o=setTimeout(Cu,0);Gt=!0;for(var l=kt.length;l;){for(Yt=kt,kt=[];++pr<l;)Yt&&Yt[pr].run();pr=-1,l=kt.length}Yt=null,Gt=!1,clearTimeout(o)}}function es(o){var l=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)l[s-1]=arguments[s];kt.push(new ts(o,l)),kt.length===1&&!Gt&&setTimeout(Zo,0)}function ts(o,l){this.fun=o,this.array=l}function yt(){}function rs(o){mn("_linkedBinding")}function ns(o){mn("dlopen")}function is(){return[]}function os(){return[]}function ss(o,l){if(!o)throw new Error(l||"assertion error")}function as(){return!1}function ls(){return Pt.now()/1e3}function Er(o){var l=Math.floor((Date.now()-Pt.now())*.001),s=Pt.now()*.001,a=Math.floor(s)+l,u=Math.floor(s%1*1e9);return o&&(a=a-o[0],u=u-o[1],u<0&&(a--,u+=Ar)),[a,u]}function Ot(){return Si}function us(o){return[]}var kt,Gt,Yt,pr,yn,bn,vn,wn,_n,Sn,En,An,xn,In,kn,Tn,On,Pn,Cn,jn,Rn,Mn,Nn,Bn,Ln,Dn,dr,Un,Fn,Wn,$n,qn,Vn,zn,Kn,Hn,Gn,Yn,Qn,Jn,Xn,Zn,ei,ti,ri,ni,ii,oi,si,ai,li,ui,Pt,ci,Ar,fi,hi,pi,di,gi,mi,yi,bi,vi,wi,_i,Si,ju=_t(()=>{de(),me(),ge(),kt=[],Gt=!1,pr=-1,ts.prototype.run=function(){this.fun.apply(null,this.array)},yn="browser",bn="x64",vn="browser",wn={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},_n=["/usr/bin/node"],Sn=[],En="v16.8.0",An={},xn=function(o,l){console.warn((l?l+": ":"")+o)},In=function(o){mn("binding")},kn=function(o){return 0},Tn=function(){return"/"},On=function(o){},Pn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},Cn=!0,jn=yt,Rn=[],Mn={},Nn=!1,Bn={},Ln=yt,Dn=yt,dr=function(){return{}},Un=dr,Fn=dr,Wn=yt,$n=yt,qn=yt,Vn={},zn={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Kn=yt,Hn=yt,Gn=yt,Yn=yt,Qn=yt,Jn=yt,Xn=yt,Zn=void 0,ei=void 0,ti=void 0,ri=yt,ni=2,ii=1,oi="/bin/usr/node",si=9229,ai="node",li=[],ui=yt,Pt={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},Pt.now===void 0&&(ci=Date.now(),Pt.timing&&Pt.timing.navigationStart&&(ci=Pt.timing.navigationStart),Pt.now=()=>Date.now()-ci),Ar=1e9,Er.bigint=function(o){var l=Er(o);return typeof BigInt>"u"?l[0]*Ar+l[1]:BigInt(l[0]*Ar)+BigInt(l[1])},fi=10,hi={},pi=0,di=Ot,gi=Ot,mi=Ot,yi=Ot,bi=Ot,vi=yt,wi=Ot,_i=Ot,Si={version:En,versions:An,arch:bn,platform:vn,browser:Cn,release:Pn,_rawDebug:jn,moduleLoadList:Rn,binding:In,_linkedBinding:rs,_events:hi,_eventsCount:pi,_maxListeners:fi,on:Ot,addListener:di,once:gi,off:mi,removeListener:yi,removeAllListeners:bi,emit:vi,prependListener:wi,prependOnceListener:_i,listeners:us,domain:Mn,_exiting:Nn,config:Bn,dlopen:ns,uptime:ls,_getActiveRequests:is,_getActiveHandles:os,reallyExit:Ln,_kill:Dn,cpuUsage:dr,resourceUsage:Un,memoryUsage:Fn,kill:Wn,exit:$n,openStdin:qn,allowedNodeEnvironmentFlags:Vn,assert:ss,features:zn,_fatalExceptions:Kn,setUncaughtExceptionCaptureCallback:Hn,hasUncaughtExceptionCaptureCallback:as,emitWarning:xn,nextTick:es,_tickCallback:Gn,_debugProcess:Yn,_debugEnd:Qn,_startProfilerIdleNotifier:Jn,_stopProfilerIdleNotifier:Xn,stdout:Zn,stdin:ti,stderr:ei,abort:ri,umask:kn,chdir:On,cwd:Tn,env:wn,title:yn,argv:_n,execArgv:Sn,pid:ni,ppid:ii,execPath:oi,debugPort:si,hrtime:Er,argv0:ai,_preload_modules:li,setSourceMapsEnabled:ui}}),ge=_t(()=>{ju()});function Ru(){if(Ei)return ir;Ei=!0,ir.byteLength=n,ir.toByteArray=i,ir.fromByteArray=d;for(var o=[],l=[],s=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,r=a.length;u<r;++u)o[u]=a[u],l[a.charCodeAt(u)]=u;l[45]=62,l[95]=63;function t(m){var b=m.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var w=m.indexOf("=");w===-1&&(w=b);var _=w===b?0:4-w%4;return[w,_]}function n(m){var b=t(m),w=b[0],_=b[1];return(w+_)*3/4-_}function e(m,b,w){return(b+w)*3/4-w}function i(m){var b,w=t(m),_=w[0],A=w[1],g=new s(e(m,_,A)),S=0,E=A>0?_-4:_,v;for(v=0;v<E;v+=4)b=l[m.charCodeAt(v)]<<18|l[m.charCodeAt(v+1)]<<12|l[m.charCodeAt(v+2)]<<6|l[m.charCodeAt(v+3)],g[S++]=b>>16&255,g[S++]=b>>8&255,g[S++]=b&255;return A===2&&(b=l[m.charCodeAt(v)]<<2|l[m.charCodeAt(v+1)]>>4,g[S++]=b&255),A===1&&(b=l[m.charCodeAt(v)]<<10|l[m.charCodeAt(v+1)]<<4|l[m.charCodeAt(v+2)]>>2,g[S++]=b>>8&255,g[S++]=b&255),g}function c(m){return o[m>>18&63]+o[m>>12&63]+o[m>>6&63]+o[m&63]}function h(m,b,w){for(var _,A=[],g=b;g<w;g+=3)_=(m[g]<<16&16711680)+(m[g+1]<<8&65280)+(m[g+2]&255),A.push(c(_));return A.join("")}function d(m){for(var b,w=m.length,_=w%3,A=[],g=16383,S=0,E=w-_;S<E;S+=g)A.push(h(m,S,S+g>E?E:S+g));return _===1?(b=m[w-1],A.push(o[b>>2]+o[b<<4&63]+"==")):_===2&&(b=(m[w-2]<<8)+m[w-1],A.push(o[b>>10]+o[b>>4&63]+o[b<<2&63]+"=")),A.join("")}return ir}function Mu(){return Ai?gr:(Ai=!0,gr.read=function(o,l,s,a,u){var r,t,n=u*8-a-1,e=(1<<n)-1,i=e>>1,c=-7,h=s?u-1:0,d=s?-1:1,m=o[l+h];for(h+=d,r=m&(1<<-c)-1,m>>=-c,c+=n;c>0;r=r*256+o[l+h],h+=d,c-=8);for(t=r&(1<<-c)-1,r>>=-c,c+=a;c>0;t=t*256+o[l+h],h+=d,c-=8);if(r===0)r=1-i;else{if(r===e)return t?NaN:(m?-1:1)*(1/0);t=t+Math.pow(2,a),r=r-i}return(m?-1:1)*t*Math.pow(2,r-a)},gr.write=function(o,l,s,a,u,r){var t,n,e,i=r*8-u-1,c=(1<<i)-1,h=c>>1,d=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=a?0:r-1,b=a?1:-1,w=l<0||l===0&&1/l<0?1:0;for(l=Math.abs(l),isNaN(l)||l===1/0?(n=isNaN(l)?1:0,t=c):(t=Math.floor(Math.log(l)/Math.LN2),l*(e=Math.pow(2,-t))<1&&(t--,e*=2),t+h>=1?l+=d/e:l+=d*Math.pow(2,1-h),l*e>=2&&(t++,e/=2),t+h>=c?(n=0,t=c):t+h>=1?(n=(l*e-1)*Math.pow(2,u),t=t+h):(n=l*Math.pow(2,h-1)*Math.pow(2,u),t=0));u>=8;o[s+m]=n&255,m+=b,n/=256,u-=8);for(t=t<<u|n,i+=u;i>0;o[s+m]=t&255,m+=b,t/=256,i-=8);o[s+m-b]|=w*128},gr)}function Nu(){if(xi)return Dt;xi=!0;let o=Ru(),l=Mu(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Dt.Buffer=t,Dt.SlowBuffer=A,Dt.INSPECT_MAX_BYTES=50;let a=2147483647;Dt.kMaxLength=a,t.TYPED_ARRAY_SUPPORT=u(),!t.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function u(){try{let f=new Uint8Array(1),p={foo:function(){return 42}};return Object.setPrototypeOf(p,Uint8Array.prototype),Object.setPrototypeOf(f,p),f.foo()===42}catch{return!1}}Object.defineProperty(t.prototype,"parent",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.buffer}}),Object.defineProperty(t.prototype,"offset",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.byteOffset}});function r(f){if(f>a)throw new RangeError('The value "'+f+'" is invalid for option "size"');let p=new Uint8Array(f);return Object.setPrototypeOf(p,t.prototype),p}function t(f,p,y){if(typeof f=="number"){if(typeof p=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return c(f)}return n(f,p,y)}t.poolSize=8192;function n(f,p,y){if(typeof f=="string")return h(f,p);if(ArrayBuffer.isView(f))return m(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(Z(f,ArrayBuffer)||f&&Z(f.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Z(f,SharedArrayBuffer)||f&&Z(f.buffer,SharedArrayBuffer)))return b(f,p,y);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let T=f.valueOf&&f.valueOf();if(T!=null&&T!==f)return t.from(T,p,y);let N=w(f);if(N)return N;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return t.from(f[Symbol.toPrimitive]("string"),p,y);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}t.from=function(f,p,y){return n(f,p,y)},Object.setPrototypeOf(t.prototype,Uint8Array.prototype),Object.setPrototypeOf(t,Uint8Array);function e(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function i(f,p,y){return e(f),f<=0?r(f):p!==void 0?typeof y=="string"?r(f).fill(p,y):r(f).fill(p):r(f)}t.alloc=function(f,p,y){return i(f,p,y)};function c(f){return e(f),r(f<0?0:_(f)|0)}t.allocUnsafe=function(f){return c(f)},t.allocUnsafeSlow=function(f){return c(f)};function h(f,p){if((typeof p!="string"||p==="")&&(p="utf8"),!t.isEncoding(p))throw new TypeError("Unknown encoding: "+p);let y=g(f,p)|0,T=r(y),N=T.write(f,p);return N!==y&&(T=T.slice(0,N)),T}function d(f){let p=f.length<0?0:_(f.length)|0,y=r(p);for(let T=0;T<p;T+=1)y[T]=f[T]&255;return y}function m(f){if(Z(f,Uint8Array)){let p=new Uint8Array(f);return b(p.buffer,p.byteOffset,p.byteLength)}return d(f)}function b(f,p,y){if(p<0||f.byteLength<p)throw new RangeError('"offset" is outside of buffer bounds');if(f.byteLength<p+(y||0))throw new RangeError('"length" is outside of buffer bounds');let T;return p===void 0&&y===void 0?T=new Uint8Array(f):y===void 0?T=new Uint8Array(f,p):T=new Uint8Array(f,p,y),Object.setPrototypeOf(T,t.prototype),T}function w(f){if(t.isBuffer(f)){let p=_(f.length)|0,y=r(p);return y.length===0||f.copy(y,0,0,p),y}if(f.length!==void 0)return typeof f.length!="number"||we(f.length)?r(0):d(f);if(f.type==="Buffer"&&Array.isArray(f.data))return d(f.data)}function _(f){if(f>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return f|0}function A(f){return+f!=f&&(f=0),t.alloc(+f)}t.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==t.prototype},t.compare=function(f,p){if(Z(f,Uint8Array)&&(f=t.from(f,f.offset,f.byteLength)),Z(p,Uint8Array)&&(p=t.from(p,p.offset,p.byteLength)),!t.isBuffer(f)||!t.isBuffer(p))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===p)return 0;let y=f.length,T=p.length;for(let N=0,z=Math.min(y,T);N<z;++N)if(f[N]!==p[N]){y=f[N],T=p[N];break}return y<T?-1:T<y?1:0},t.isEncoding=function(f){switch(String(f).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(f,p){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return t.alloc(0);let y;if(p===void 0)for(p=0,y=0;y<f.length;++y)p+=f[y].length;let T=t.allocUnsafe(p),N=0;for(y=0;y<f.length;++y){let z=f[y];if(Z(z,Uint8Array))N+z.length>T.length?(t.isBuffer(z)||(z=t.from(z)),z.copy(T,N)):Uint8Array.prototype.set.call(T,z,N);else if(t.isBuffer(z))z.copy(T,N);else throw new TypeError('"list" argument must be an Array of Buffers');N+=z.length}return T};function g(f,p){if(t.isBuffer(f))return f.length;if(ArrayBuffer.isView(f)||Z(f,ArrayBuffer))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);let y=f.length,T=arguments.length>2&&arguments[2]===!0;if(!T&&y===0)return 0;let N=!1;for(;;)switch(p){case"ascii":case"latin1":case"binary":return y;case"utf8":case"utf-8":return Y(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y*2;case"hex":return y>>>1;case"base64":return pe(f).length;default:if(N)return T?-1:Y(f).length;p=(""+p).toLowerCase(),N=!0}}t.byteLength=g;function S(f,p,y){let T=!1;if((p===void 0||p<0)&&(p=0),p>this.length||((y===void 0||y>this.length)&&(y=this.length),y<=0)||(y>>>=0,p>>>=0,y<=p))return"";for(f||(f="utf8");;)switch(f){case"hex":return ee(this,p,y);case"utf8":case"utf-8":return W(this,p,y);case"ascii":return le(this,p,y);case"latin1":case"binary":return re(this,p,y);case"base64":return x(this,p,y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ue(this,p,y);default:if(T)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),T=!0}}t.prototype._isBuffer=!0;function E(f,p,y){let T=f[p];f[p]=f[y],f[y]=T}t.prototype.swap16=function(){let f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let p=0;p<f;p+=2)E(this,p,p+1);return this},t.prototype.swap32=function(){let f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let p=0;p<f;p+=4)E(this,p,p+3),E(this,p+1,p+2);return this},t.prototype.swap64=function(){let f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let p=0;p<f;p+=8)E(this,p,p+7),E(this,p+1,p+6),E(this,p+2,p+5),E(this,p+3,p+4);return this},t.prototype.toString=function(){let f=this.length;return f===0?"":arguments.length===0?W(this,0,f):S.apply(this,arguments)},t.prototype.toLocaleString=t.prototype.toString,t.prototype.equals=function(f){if(!t.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:t.compare(this,f)===0},t.prototype.inspect=function(){let f="",p=Dt.INSPECT_MAX_BYTES;return f=this.toString("hex",0,p).replace(/(.{2})/g,"$1 ").trim(),this.length>p&&(f+=" ... "),"<Buffer "+f+">"},s&&(t.prototype[s]=t.prototype.inspect),t.prototype.compare=function(f,p,y,T,N){if(Z(f,Uint8Array)&&(f=t.from(f,f.offset,f.byteLength)),!t.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(p===void 0&&(p=0),y===void 0&&(y=f?f.length:0),T===void 0&&(T=0),N===void 0&&(N=this.length),p<0||y>f.length||T<0||N>this.length)throw new RangeError("out of range index");if(T>=N&&p>=y)return 0;if(T>=N)return-1;if(p>=y)return 1;if(p>>>=0,y>>>=0,T>>>=0,N>>>=0,this===f)return 0;let z=N-T,ie=y-p,q=Math.min(z,ie),J=this.slice(T,N),Oe=f.slice(p,y);for(let Me=0;Me<q;++Me)if(J[Me]!==Oe[Me]){z=J[Me],ie=Oe[Me];break}return z<ie?-1:ie<z?1:0};function v(f,p,y,T,N){if(f.length===0)return-1;if(typeof y=="string"?(T=y,y=0):y>2147483647?y=2147483647:y<-2147483648&&(y=-2147483648),y=+y,we(y)&&(y=N?0:f.length-1),y<0&&(y=f.length+y),y>=f.length){if(N)return-1;y=f.length-1}else if(y<0)if(N)y=0;else return-1;if(typeof p=="string"&&(p=t.from(p,T)),t.isBuffer(p))return p.length===0?-1:C(f,p,y,T,N);if(typeof p=="number")return p=p&255,typeof Uint8Array.prototype.indexOf=="function"?N?Uint8Array.prototype.indexOf.call(f,p,y):Uint8Array.prototype.lastIndexOf.call(f,p,y):C(f,[p],y,T,N);throw new TypeError("val must be string, number or Buffer")}function C(f,p,y,T,N){let z=1,ie=f.length,q=p.length;if(T!==void 0&&(T=String(T).toLowerCase(),T==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="utf-16le")){if(f.length<2||p.length<2)return-1;z=2,ie/=2,q/=2,y/=2}function J(Me,Ne){return z===1?Me[Ne]:Me.readUInt16BE(Ne*z)}let Oe;if(N){let Me=-1;for(Oe=y;Oe<ie;Oe++)if(J(f,Oe)===J(p,Me===-1?0:Oe-Me)){if(Me===-1&&(Me=Oe),Oe-Me+1===q)return Me*z}else Me!==-1&&(Oe-=Oe-Me),Me=-1}else for(y+q>ie&&(y=ie-q),Oe=y;Oe>=0;Oe--){let Me=!0;for(let Ne=0;Ne<q;Ne++)if(J(f,Oe+Ne)!==J(p,Ne)){Me=!1;break}if(Me)return Oe}return-1}t.prototype.includes=function(f,p,y){return this.indexOf(f,p,y)!==-1},t.prototype.indexOf=function(f,p,y){return v(this,f,p,y,!0)},t.prototype.lastIndexOf=function(f,p,y){return v(this,f,p,y,!1)};function P(f,p,y,T){y=Number(y)||0;let N=f.length-y;T?(T=Number(T),T>N&&(T=N)):T=N;let z=p.length;T>z/2&&(T=z/2);let ie;for(ie=0;ie<T;++ie){let q=parseInt(p.substr(ie*2,2),16);if(we(q))return ie;f[y+ie]=q}return ie}function I(f,p,y,T){return Se(Y(p,f.length-y),f,y,T)}function O(f,p,y,T){return Se(se(p),f,y,T)}function k(f,p,y,T){return Se(pe(p),f,y,T)}function M(f,p,y,T){return Se(ye(p,f.length-y),f,y,T)}t.prototype.write=function(f,p,y,T){if(p===void 0)T="utf8",y=this.length,p=0;else if(y===void 0&&typeof p=="string")T=p,y=this.length,p=0;else if(isFinite(p))p=p>>>0,isFinite(y)?(y=y>>>0,T===void 0&&(T="utf8")):(T=y,y=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let N=this.length-p;if((y===void 0||y>N)&&(y=N),f.length>0&&(y<0||p<0)||p>this.length)throw new RangeError("Attempt to write outside buffer bounds");T||(T="utf8");let z=!1;for(;;)switch(T){case"hex":return P(this,f,p,y);case"utf8":case"utf-8":return I(this,f,p,y);case"ascii":case"latin1":case"binary":return O(this,f,p,y);case"base64":return k(this,f,p,y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,f,p,y);default:if(z)throw new TypeError("Unknown encoding: "+T);T=(""+T).toLowerCase(),z=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function x(f,p,y){return p===0&&y===f.length?o.fromByteArray(f):o.fromByteArray(f.slice(p,y))}function W(f,p,y){y=Math.min(f.length,y);let T=[],N=p;for(;N<y;){let z=f[N],ie=null,q=z>239?4:z>223?3:z>191?2:1;if(N+q<=y){let J,Oe,Me,Ne;switch(q){case 1:z<128&&(ie=z);break;case 2:J=f[N+1],(J&192)===128&&(Ne=(z&31)<<6|J&63,Ne>127&&(ie=Ne));break;case 3:J=f[N+1],Oe=f[N+2],(J&192)===128&&(Oe&192)===128&&(Ne=(z&15)<<12|(J&63)<<6|Oe&63,Ne>2047&&(Ne<55296||Ne>57343)&&(ie=Ne));break;case 4:J=f[N+1],Oe=f[N+2],Me=f[N+3],(J&192)===128&&(Oe&192)===128&&(Me&192)===128&&(Ne=(z&15)<<18|(J&63)<<12|(Oe&63)<<6|Me&63,Ne>65535&&Ne<1114112&&(ie=Ne))}}ie===null?(ie=65533,q=1):ie>65535&&(ie-=65536,T.push(ie>>>10&1023|55296),ie=56320|ie&1023),T.push(ie),N+=q}return L(T)}let $=4096;function L(f){let p=f.length;if(p<=$)return String.fromCharCode.apply(String,f);let y="",T=0;for(;T<p;)y+=String.fromCharCode.apply(String,f.slice(T,T+=$));return y}function le(f,p,y){let T="";y=Math.min(f.length,y);for(let N=p;N<y;++N)T+=String.fromCharCode(f[N]&127);return T}function re(f,p,y){let T="";y=Math.min(f.length,y);for(let N=p;N<y;++N)T+=String.fromCharCode(f[N]);return T}function ee(f,p,y){let T=f.length;(!p||p<0)&&(p=0),(!y||y<0||y>T)&&(y=T);let N="";for(let z=p;z<y;++z)N+=ke[f[z]];return N}function ue(f,p,y){let T=f.slice(p,y),N="";for(let z=0;z<T.length-1;z+=2)N+=String.fromCharCode(T[z]+T[z+1]*256);return N}t.prototype.slice=function(f,p){let y=this.length;f=~~f,p=p===void 0?y:~~p,f<0?(f+=y,f<0&&(f=0)):f>y&&(f=y),p<0?(p+=y,p<0&&(p=0)):p>y&&(p=y),p<f&&(p=f);let T=this.subarray(f,p);return Object.setPrototypeOf(T,t.prototype),T};function G(f,p,y){if(f%1!==0||f<0)throw new RangeError("offset is not uint");if(f+p>y)throw new RangeError("Trying to access beyond buffer length")}t.prototype.readUintLE=t.prototype.readUIntLE=function(f,p,y){f=f>>>0,p=p>>>0,y||G(f,p,this.length);let T=this[f],N=1,z=0;for(;++z<p&&(N*=256);)T+=this[f+z]*N;return T},t.prototype.readUintBE=t.prototype.readUIntBE=function(f,p,y){f=f>>>0,p=p>>>0,y||G(f,p,this.length);let T=this[f+--p],N=1;for(;p>0&&(N*=256);)T+=this[f+--p]*N;return T},t.prototype.readUint8=t.prototype.readUInt8=function(f,p){return f=f>>>0,p||G(f,1,this.length),this[f]},t.prototype.readUint16LE=t.prototype.readUInt16LE=function(f,p){return f=f>>>0,p||G(f,2,this.length),this[f]|this[f+1]<<8},t.prototype.readUint16BE=t.prototype.readUInt16BE=function(f,p){return f=f>>>0,p||G(f,2,this.length),this[f]<<8|this[f+1]},t.prototype.readUint32LE=t.prototype.readUInt32LE=function(f,p){return f=f>>>0,p||G(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},t.prototype.readUint32BE=t.prototype.readUInt32BE=function(f,p){return f=f>>>0,p||G(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},t.prototype.readBigUInt64LE=fe(function(f){f=f>>>0,ne(f,"offset");let p=this[f],y=this[f+7];(p===void 0||y===void 0)&&ve(f,this.length-8);let T=p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,N=this[++f]+this[++f]*2**8+this[++f]*2**16+y*2**24;return BigInt(T)+(BigInt(N)<<BigInt(32))}),t.prototype.readBigUInt64BE=fe(function(f){f=f>>>0,ne(f,"offset");let p=this[f],y=this[f+7];(p===void 0||y===void 0)&&ve(f,this.length-8);let T=p*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],N=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+y;return(BigInt(T)<<BigInt(32))+BigInt(N)}),t.prototype.readIntLE=function(f,p,y){f=f>>>0,p=p>>>0,y||G(f,p,this.length);let T=this[f],N=1,z=0;for(;++z<p&&(N*=256);)T+=this[f+z]*N;return N*=128,T>=N&&(T-=Math.pow(2,8*p)),T},t.prototype.readIntBE=function(f,p,y){f=f>>>0,p=p>>>0,y||G(f,p,this.length);let T=p,N=1,z=this[f+--T];for(;T>0&&(N*=256);)z+=this[f+--T]*N;return N*=128,z>=N&&(z-=Math.pow(2,8*p)),z},t.prototype.readInt8=function(f,p){return f=f>>>0,p||G(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},t.prototype.readInt16LE=function(f,p){f=f>>>0,p||G(f,2,this.length);let y=this[f]|this[f+1]<<8;return y&32768?y|4294901760:y},t.prototype.readInt16BE=function(f,p){f=f>>>0,p||G(f,2,this.length);let y=this[f+1]|this[f]<<8;return y&32768?y|4294901760:y},t.prototype.readInt32LE=function(f,p){return f=f>>>0,p||G(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},t.prototype.readInt32BE=function(f,p){return f=f>>>0,p||G(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},t.prototype.readBigInt64LE=fe(function(f){f=f>>>0,ne(f,"offset");let p=this[f],y=this[f+7];(p===void 0||y===void 0)&&ve(f,this.length-8);let T=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+(y<<24);return(BigInt(T)<<BigInt(32))+BigInt(p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),t.prototype.readBigInt64BE=fe(function(f){f=f>>>0,ne(f,"offset");let p=this[f],y=this[f+7];(p===void 0||y===void 0)&&ve(f,this.length-8);let T=(p<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(T)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+y)}),t.prototype.readFloatLE=function(f,p){return f=f>>>0,p||G(f,4,this.length),l.read(this,f,!0,23,4)},t.prototype.readFloatBE=function(f,p){return f=f>>>0,p||G(f,4,this.length),l.read(this,f,!1,23,4)},t.prototype.readDoubleLE=function(f,p){return f=f>>>0,p||G(f,8,this.length),l.read(this,f,!0,52,8)},t.prototype.readDoubleBE=function(f,p){return f=f>>>0,p||G(f,8,this.length),l.read(this,f,!1,52,8)};function oe(f,p,y,T,N,z){if(!t.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(p>N||p<z)throw new RangeError('"value" argument is out of bounds');if(y+T>f.length)throw new RangeError("Index out of range")}t.prototype.writeUintLE=t.prototype.writeUIntLE=function(f,p,y,T){if(f=+f,p=p>>>0,y=y>>>0,!T){let ie=Math.pow(2,8*y)-1;oe(this,f,p,y,ie,0)}let N=1,z=0;for(this[p]=f&255;++z<y&&(N*=256);)this[p+z]=f/N&255;return p+y},t.prototype.writeUintBE=t.prototype.writeUIntBE=function(f,p,y,T){if(f=+f,p=p>>>0,y=y>>>0,!T){let ie=Math.pow(2,8*y)-1;oe(this,f,p,y,ie,0)}let N=y-1,z=1;for(this[p+N]=f&255;--N>=0&&(z*=256);)this[p+N]=f/z&255;return p+y},t.prototype.writeUint8=t.prototype.writeUInt8=function(f,p,y){return f=+f,p=p>>>0,y||oe(this,f,p,1,255,0),this[p]=f&255,p+1},t.prototype.writeUint16LE=t.prototype.writeUInt16LE=function(f,p,y){return f=+f,p=p>>>0,y||oe(this,f,p,2,65535,0),this[p]=f&255,this[p+1]=f>>>8,p+2},t.prototype.writeUint16BE=t.prototype.writeUInt16BE=function(f,p,y){return f=+f,p=p>>>0,y||oe(this,f,p,2,65535,0),this[p]=f>>>8,this[p+1]=f&255,p+2},t.prototype.writeUint32LE=t.prototype.writeUInt32LE=function(f,p,y){return f=+f,p=p>>>0,y||oe(this,f,p,4,4294967295,0),this[p+3]=f>>>24,this[p+2]=f>>>16,this[p+1]=f>>>8,this[p]=f&255,p+4},t.prototype.writeUint32BE=t.prototype.writeUInt32BE=function(f,p,y){return f=+f,p=p>>>0,y||oe(this,f,p,4,4294967295,0),this[p]=f>>>24,this[p+1]=f>>>16,this[p+2]=f>>>8,this[p+3]=f&255,p+4};function R(f,p,y,T,N){te(p,T,N,f,y,7);let z=Number(p&BigInt(4294967295));f[y++]=z,z=z>>8,f[y++]=z,z=z>>8,f[y++]=z,z=z>>8,f[y++]=z;let ie=Number(p>>BigInt(32)&BigInt(4294967295));return f[y++]=ie,ie=ie>>8,f[y++]=ie,ie=ie>>8,f[y++]=ie,ie=ie>>8,f[y++]=ie,y}function Q(f,p,y,T,N){te(p,T,N,f,y,7);let z=Number(p&BigInt(4294967295));f[y+7]=z,z=z>>8,f[y+6]=z,z=z>>8,f[y+5]=z,z=z>>8,f[y+4]=z;let ie=Number(p>>BigInt(32)&BigInt(4294967295));return f[y+3]=ie,ie=ie>>8,f[y+2]=ie,ie=ie>>8,f[y+1]=ie,ie=ie>>8,f[y]=ie,y+8}t.prototype.writeBigUInt64LE=fe(function(f,p=0){return R(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),t.prototype.writeBigUInt64BE=fe(function(f,p=0){return Q(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),t.prototype.writeIntLE=function(f,p,y,T){if(f=+f,p=p>>>0,!T){let q=Math.pow(2,8*y-1);oe(this,f,p,y,q-1,-q)}let N=0,z=1,ie=0;for(this[p]=f&255;++N<y&&(z*=256);)f<0&&ie===0&&this[p+N-1]!==0&&(ie=1),this[p+N]=(f/z>>0)-ie&255;return p+y},t.prototype.writeIntBE=function(f,p,y,T){if(f=+f,p=p>>>0,!T){let q=Math.pow(2,8*y-1);oe(this,f,p,y,q-1,-q)}let N=y-1,z=1,ie=0;for(this[p+N]=f&255;--N>=0&&(z*=256);)f<0&&ie===0&&this[p+N+1]!==0&&(ie=1),this[p+N]=(f/z>>0)-ie&255;return p+y},t.prototype.writeInt8=function(f,p,y){return f=+f,p=p>>>0,y||oe(this,f,p,1,127,-128),f<0&&(f=255+f+1),this[p]=f&255,p+1},t.prototype.writeInt16LE=function(f,p,y){return f=+f,p=p>>>0,y||oe(this,f,p,2,32767,-32768),this[p]=f&255,this[p+1]=f>>>8,p+2},t.prototype.writeInt16BE=function(f,p,y){return f=+f,p=p>>>0,y||oe(this,f,p,2,32767,-32768),this[p]=f>>>8,this[p+1]=f&255,p+2},t.prototype.writeInt32LE=function(f,p,y){return f=+f,p=p>>>0,y||oe(this,f,p,4,2147483647,-2147483648),this[p]=f&255,this[p+1]=f>>>8,this[p+2]=f>>>16,this[p+3]=f>>>24,p+4},t.prototype.writeInt32BE=function(f,p,y){return f=+f,p=p>>>0,y||oe(this,f,p,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[p]=f>>>24,this[p+1]=f>>>16,this[p+2]=f>>>8,this[p+3]=f&255,p+4},t.prototype.writeBigInt64LE=fe(function(f,p=0){return R(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),t.prototype.writeBigInt64BE=fe(function(f,p=0){return Q(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function he(f,p,y,T,N,z){if(y+T>f.length)throw new RangeError("Index out of range");if(y<0)throw new RangeError("Index out of range")}function V(f,p,y,T,N){return p=+p,y=y>>>0,N||he(f,p,y,4),l.write(f,p,y,T,23,4),y+4}t.prototype.writeFloatLE=function(f,p,y){return V(this,f,p,!0,y)},t.prototype.writeFloatBE=function(f,p,y){return V(this,f,p,!1,y)};function Ee(f,p,y,T,N){return p=+p,y=y>>>0,N||he(f,p,y,8),l.write(f,p,y,T,52,8),y+8}t.prototype.writeDoubleLE=function(f,p,y){return Ee(this,f,p,!0,y)},t.prototype.writeDoubleBE=function(f,p,y){return Ee(this,f,p,!1,y)},t.prototype.copy=function(f,p,y,T){if(!t.isBuffer(f))throw new TypeError("argument should be a Buffer");if(y||(y=0),!T&&T!==0&&(T=this.length),p>=f.length&&(p=f.length),p||(p=0),T>0&&T<y&&(T=y),T===y||f.length===0||this.length===0)return 0;if(p<0)throw new RangeError("targetStart out of bounds");if(y<0||y>=this.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("sourceEnd out of bounds");T>this.length&&(T=this.length),f.length-p<T-y&&(T=f.length-p+y);let N=T-y;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(p,y,T):Uint8Array.prototype.set.call(f,this.subarray(y,T),p),N},t.prototype.fill=function(f,p,y,T){if(typeof f=="string"){if(typeof p=="string"?(T=p,p=0,y=this.length):typeof y=="string"&&(T=y,y=this.length),T!==void 0&&typeof T!="string")throw new TypeError("encoding must be a string");if(typeof T=="string"&&!t.isEncoding(T))throw new TypeError("Unknown encoding: "+T);if(f.length===1){let z=f.charCodeAt(0);(T==="utf8"&&z<128||T==="latin1")&&(f=z)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(p<0||this.length<p||this.length<y)throw new RangeError("Out of range index");if(y<=p)return this;p=p>>>0,y=y===void 0?this.length:y>>>0,f||(f=0);let N;if(typeof f=="number")for(N=p;N<y;++N)this[N]=f;else{let z=t.isBuffer(f)?f:t.from(f,T),ie=z.length;if(ie===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(N=0;N<y-p;++N)this[N+p]=z[N%ie]}return this};let X={};function U(f,p,y){X[f]=class extends y{constructor(){super(),Object.defineProperty(this,"message",{value:p.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${f}]`,this.stack,delete this.name}get code(){return f}set code(T){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:T,writable:!0})}toString(){return`${this.name} [${f}]: ${this.message}`}}}U("ERR_BUFFER_OUT_OF_BOUNDS",function(f){return f?`${f} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),U("ERR_INVALID_ARG_TYPE",function(f,p){return`The "${f}" argument must be of type number. Received type ${typeof p}`},TypeError),U("ERR_OUT_OF_RANGE",function(f,p,y){let T=`The value of "${f}" is out of range.`,N=y;return Number.isInteger(y)&&Math.abs(y)>2**32?N=ae(String(y)):typeof y=="bigint"&&(N=String(y),(y>BigInt(2)**BigInt(32)||y<-(BigInt(2)**BigInt(32)))&&(N=ae(N)),N+="n"),T+=` It must be ${p}. Received ${N}`,T},RangeError);function ae(f){let p="",y=f.length,T=f[0]==="-"?1:0;for(;y>=T+4;y-=3)p=`_${f.slice(y-3,y)}${p}`;return`${f.slice(0,y)}${p}`}function H(f,p,y){ne(p,"offset"),(f[p]===void 0||f[p+y]===void 0)&&ve(p,f.length-(y+1))}function te(f,p,y,T,N,z){if(f>y||f<p){let ie=typeof p=="bigint"?"n":"",q;throw p===0||p===BigInt(0)?q=`>= 0${ie} and < 2${ie} ** ${(z+1)*8}${ie}`:q=`>= -(2${ie} ** ${(z+1)*8-1}${ie}) and < 2 ** ${(z+1)*8-1}${ie}`,new X.ERR_OUT_OF_RANGE("value",q,f)}H(T,N,z)}function ne(f,p){if(typeof f!="number")throw new X.ERR_INVALID_ARG_TYPE(p,"number",f)}function ve(f,p,y){throw Math.floor(f)!==f?(ne(f,y),new X.ERR_OUT_OF_RANGE("offset","an integer",f)):p<0?new X.ERR_BUFFER_OUT_OF_BOUNDS:new X.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${p}`,f)}let ce=/[^+/0-9A-Za-z-_]/g;function B(f){if(f=f.split("=")[0],f=f.trim().replace(ce,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function Y(f,p){p=p||1/0;let y,T=f.length,N=null,z=[];for(let ie=0;ie<T;++ie){if(y=f.charCodeAt(ie),y>55295&&y<57344){if(!N){if(y>56319){(p-=3)>-1&&z.push(239,191,189);continue}else if(ie+1===T){(p-=3)>-1&&z.push(239,191,189);continue}N=y;continue}if(y<56320){(p-=3)>-1&&z.push(239,191,189),N=y;continue}y=(N-55296<<10|y-56320)+65536}else N&&(p-=3)>-1&&z.push(239,191,189);if(N=null,y<128){if((p-=1)<0)break;z.push(y)}else if(y<2048){if((p-=2)<0)break;z.push(y>>6|192,y&63|128)}else if(y<65536){if((p-=3)<0)break;z.push(y>>12|224,y>>6&63|128,y&63|128)}else if(y<1114112){if((p-=4)<0)break;z.push(y>>18|240,y>>12&63|128,y>>6&63|128,y&63|128)}else throw new Error("Invalid code point")}return z}function se(f){let p=[];for(let y=0;y<f.length;++y)p.push(f.charCodeAt(y)&255);return p}function ye(f,p){let y,T,N,z=[];for(let ie=0;ie<f.length&&!((p-=2)<0);++ie)y=f.charCodeAt(ie),T=y>>8,N=y%256,z.push(N),z.push(T);return z}function pe(f){return o.toByteArray(B(f))}function Se(f,p,y,T){let N;for(N=0;N<T&&!(N+y>=p.length||N>=f.length);++N)p[N+y]=f[N];return N}function Z(f,p){return f instanceof p||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===p.name}function we(f){return f!==f}let ke=function(){let f="0123456789abcdef",p=new Array(256);for(let y=0;y<16;++y){let T=y*16;for(let N=0;N<16;++N)p[T+N]=f[y]+f[N]}return p}();function fe(f){return typeof BigInt>"u"?Ue:f}function Ue(){throw new Error("BigInt not supported")}return Dt}var ir,Ei,gr,Ai,Dt,xi,Bu=_t(()=>{de(),me(),ge(),ir={},Ei=!1,gr={},Ai=!1,Dt={},xi=!1}),pt={};nr(pt,{Buffer:()=>xr,INSPECT_MAX_BYTES:()=>cs,default:()=>Ct,kMaxLength:()=>fs});var Ct,xr,cs,fs,dt=_t(()=>{de(),me(),ge(),Bu(),Ct=Nu(),Ct.Buffer,Ct.SlowBuffer,Ct.INSPECT_MAX_BYTES,Ct.kMaxLength,xr=Ct.Buffer,cs=Ct.INSPECT_MAX_BYTES,fs=Ct.kMaxLength}),me=_t(()=>{dt()}),ut=_e((o,l)=>{de(),me(),ge();var s=class extends Error{constructor(a){if(!Array.isArray(a))throw new TypeError(`Expected input to be an Array, got ${typeof a}`);let u="";for(let r=0;r<a.length;r++)u+=` ${a[r].stack}
31
- `;super(u),this.name="AggregateError",this.errors=a}};l.exports={AggregateError:s,ArrayIsArray(a){return Array.isArray(a)},ArrayPrototypeIncludes(a,u){return a.includes(u)},ArrayPrototypeIndexOf(a,u){return a.indexOf(u)},ArrayPrototypeJoin(a,u){return a.join(u)},ArrayPrototypeMap(a,u){return a.map(u)},ArrayPrototypePop(a,u){return a.pop(u)},ArrayPrototypePush(a,u){return a.push(u)},ArrayPrototypeSlice(a,u,r){return a.slice(u,r)},Error,FunctionPrototypeCall(a,u,...r){return a.call(u,...r)},FunctionPrototypeSymbolHasInstance(a,u){return Function.prototype[Symbol.hasInstance].call(a,u)},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(a,u){return Object.defineProperties(a,u)},ObjectDefineProperty(a,u,r){return Object.defineProperty(a,u,r)},ObjectGetOwnPropertyDescriptor(a,u){return Object.getOwnPropertyDescriptor(a,u)},ObjectKeys(a){return Object.keys(a)},ObjectSetPrototypeOf(a,u){return Object.setPrototypeOf(a,u)},Promise,PromisePrototypeCatch(a,u){return a.catch(u)},PromisePrototypeThen(a,u,r){return a.then(u,r)},PromiseReject(a){return Promise.reject(a)},PromiseResolve(a){return Promise.resolve(a)},ReflectApply:Reflect.apply,RegExpPrototypeTest(a,u){return a.test(u)},SafeSet:Set,String,StringPrototypeSlice(a,u,r){return a.slice(u,r)},StringPrototypeToLowerCase(a){return a.toLowerCase()},StringPrototypeToUpperCase(a){return a.toUpperCase()},StringPrototypeTrim(a){return a.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(a,u,r){return a.set(u,r)},Boolean,Uint8Array}}),hs=_e((o,l)=>{de(),me(),ge(),l.exports={format(s,...a){return s.replace(/%([sdifj])/g,function(...[u,r]){let t=a.shift();return r==="f"?t.toFixed(6):r==="j"?JSON.stringify(t):r==="s"&&typeof t=="object"?`${t.constructor!==Object?t.constructor.name:""} {}`.trim():t.toString()})},inspect(s){switch(typeof s){case"string":if(s.includes("'"))if(s.includes('"')){if(!s.includes("`")&&!s.includes("${"))return`\`${s}\``}else return`"${s}"`;return`'${s}'`;case"number":return isNaN(s)?"NaN":Object.is(s,-0)?String(s):s;case"bigint":return`${String(s)}n`;case"boolean":case"undefined":return String(s);case"object":return"{}"}}}}),wt=_e((o,l)=>{de(),me(),ge();var{format:s,inspect:a}=hs(),{AggregateError:u}=ut(),r=globalThis.AggregateError||u,t=Symbol("kIsNodeError"),n=["string","function","number","object","Function","Object","boolean","bigint","symbol"],e=/^([A-Z][a-z0-9]*)+$/,i="__node_internal_",c={};function h(g,S){if(!g)throw new c.ERR_INTERNAL_ASSERTION(S)}function d(g){let S="",E=g.length,v=g[0]==="-"?1:0;for(;E>=v+4;E-=3)S=`_${g.slice(E-3,E)}${S}`;return`${g.slice(0,E)}${S}`}function m(g,S,E){if(typeof S=="function")return h(S.length<=E.length,`Code: ${g}; The provided arguments length (${E.length}) does not match the required ones (${S.length}).`),S(...E);let v=(S.match(/%[dfijoOs]/g)||[]).length;return h(v===E.length,`Code: ${g}; The provided arguments length (${E.length}) does not match the required ones (${v}).`),E.length===0?S:s(S,...E)}function b(g,S,E){E||(E=Error);class v extends E{constructor(...P){super(m(g,S,P))}toString(){return`${this.name} [${g}]: ${this.message}`}}Object.defineProperties(v.prototype,{name:{value:E.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${g}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),v.prototype.code=g,v.prototype[t]=!0,c[g]=v}function w(g){let S=i+g.name;return Object.defineProperty(g,"name",{value:S}),g}function _(g,S){if(g&&S&&g!==S){if(Array.isArray(S.errors))return S.errors.push(g),S;let E=new r([S,g],S.message);return E.code=S.code,E}return g||S}var A=class extends Error{constructor(g="The operation was aborted",S=void 0){if(S!==void 0&&typeof S!="object")throw new c.ERR_INVALID_ARG_TYPE("options","Object",S);super(g,S),this.code="ABORT_ERR",this.name="AbortError"}};b("ERR_ASSERTION","%s",Error),b("ERR_INVALID_ARG_TYPE",(g,S,E)=>{h(typeof g=="string","'name' must be a string"),Array.isArray(S)||(S=[S]);let v="The ";g.endsWith(" argument")?v+=`${g} `:v+=`"${g}" ${g.includes(".")?"property":"argument"} `,v+="must be ";let C=[],P=[],I=[];for(let k of S)h(typeof k=="string","All expected entries have to be of type string"),n.includes(k)?C.push(k.toLowerCase()):e.test(k)?P.push(k):(h(k!=="object",'The value "object" should be written as "Object"'),I.push(k));if(P.length>0){let k=C.indexOf("object");k!==-1&&(C.splice(C,k,1),P.push("Object"))}if(C.length>0){switch(C.length){case 1:v+=`of type ${C[0]}`;break;case 2:v+=`one of type ${C[0]} or ${C[1]}`;break;default:{let k=C.pop();v+=`one of type ${C.join(", ")}, or ${k}`}}(P.length>0||I.length>0)&&(v+=" or ")}if(P.length>0){switch(P.length){case 1:v+=`an instance of ${P[0]}`;break;case 2:v+=`an instance of ${P[0]} or ${P[1]}`;break;default:{let k=P.pop();v+=`an instance of ${P.join(", ")}, or ${k}`}}I.length>0&&(v+=" or ")}switch(I.length){case 0:break;case 1:I[0].toLowerCase()!==I[0]&&(v+="an "),v+=`${I[0]}`;break;case 2:v+=`one of ${I[0]} or ${I[1]}`;break;default:{let k=I.pop();v+=`one of ${I.join(", ")}, or ${k}`}}if(E==null)v+=`. Received ${E}`;else if(typeof E=="function"&&E.name)v+=`. Received function ${E.name}`;else if(typeof E=="object"){var O;if((O=E.constructor)!==null&&O!==void 0&&O.name)v+=`. Received an instance of ${E.constructor.name}`;else{let k=a(E,{depth:-1});v+=`. Received ${k}`}}else{let k=a(E,{colors:!1});k.length>25&&(k=`${k.slice(0,25)}...`),v+=`. Received type ${typeof E} (${k})`}return v},TypeError),b("ERR_INVALID_ARG_VALUE",(g,S,E="is invalid")=>{let v=a(S);return v.length>128&&(v=v.slice(0,128)+"..."),`The ${g.includes(".")?"property":"argument"} '${g}' ${E}. Received ${v}`},TypeError),b("ERR_INVALID_RETURN_VALUE",(g,S,E)=>{var v;let C=E!=null&&(v=E.constructor)!==null&&v!==void 0&&v.name?`instance of ${E.constructor.name}`:`type ${typeof E}`;return`Expected ${g} to be returned from the "${S}" function but got ${C}.`},TypeError),b("ERR_MISSING_ARGS",(...g)=>{h(g.length>0,"At least one arg needs to be specified");let S,E=g.length;switch(g=(Array.isArray(g)?g:[g]).map(v=>`"${v}"`).join(" or "),E){case 1:S+=`The ${g[0]} argument`;break;case 2:S+=`The ${g[0]} and ${g[1]} arguments`;break;default:{let v=g.pop();S+=`The ${g.join(", ")}, and ${v} arguments`}break}return`${S} must be specified`},TypeError),b("ERR_OUT_OF_RANGE",(g,S,E)=>{h(S,'Missing "range" argument');let v;if(Number.isInteger(E)&&Math.abs(E)>2**32)v=d(String(E));else if(typeof E=="bigint"){v=String(E);let C=BigInt(2)**BigInt(32);(E>C||E<-C)&&(v=d(v)),v+="n"}else v=a(E);return`The value of "${g}" is out of range. It must be ${S}. Received ${v}`},RangeError),b("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),b("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),b("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),b("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),b("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),b("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),b("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),b("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),b("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),b("ERR_STREAM_WRITE_AFTER_END","write after end",Error),b("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),l.exports={AbortError:A,aggregateTwoErrors:w(_),hideStackFrames:w,codes:c}}),mr=_e((o,l)=>{de(),me(),ge();var{AbortController:s,AbortSignal:a}=typeof self<"u"?self:typeof window<"u"?window:void 0;l.exports=s,l.exports.AbortSignal=a,l.exports.default=s}),Ut={};nr(Ut,{EventEmitter:()=>ps,default:()=>or,defaultMaxListeners:()=>ds,init:()=>gs,listenerCount:()=>ms,on:()=>ys,once:()=>bs});function Lu(){if(Ii)return yr;Ii=!0;var o=typeof Reflect=="object"?Reflect:null,l=o&&typeof o.apply=="function"?o.apply:function(E,v,C){return Function.prototype.apply.call(E,v,C)},s;o&&typeof o.ownKeys=="function"?s=o.ownKeys:Object.getOwnPropertySymbols?s=function(E){return Object.getOwnPropertyNames(E).concat(Object.getOwnPropertySymbols(E))}:s=function(E){return Object.getOwnPropertyNames(E)};function a(E){console&&console.warn&&console.warn(E)}var u=Number.isNaN||function(E){return E!==E};function r(){r.init.call(this)}yr=r,yr.once=A,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var t=10;function n(E){if(typeof E!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof E)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return t},set:function(E){if(typeof E!="number"||E<0||u(E))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+E+".");t=E}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(E){if(typeof E!="number"||E<0||u(E))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+E+".");return this._maxListeners=E,this};function e(E){return E._maxListeners===void 0?r.defaultMaxListeners:E._maxListeners}r.prototype.getMaxListeners=function(){return e(this)},r.prototype.emit=function(E){for(var v=[],C=1;C<arguments.length;C++)v.push(arguments[C]);var P=E==="error",I=this._events;if(I!==void 0)P=P&&I.error===void 0;else if(!P)return!1;if(P){var O;if(v.length>0&&(O=v[0]),O instanceof Error)throw O;var k=new Error("Unhandled error."+(O?" ("+O.message+")":""));throw k.context=O,k}var M=I[E];if(M===void 0)return!1;if(typeof M=="function")l(M,this,v);else for(var x=M.length,W=b(M,x),C=0;C<x;++C)l(W[C],this,v);return!0};function i(E,v,C,P){var I,O,k;if(n(C),O=E._events,O===void 0?(O=E._events=Object.create(null),E._eventsCount=0):(O.newListener!==void 0&&(E.emit("newListener",v,C.listener?C.listener:C),O=E._events),k=O[v]),k===void 0)k=O[v]=C,++E._eventsCount;else if(typeof k=="function"?k=O[v]=P?[C,k]:[k,C]:P?k.unshift(C):k.push(C),I=e(E),I>0&&k.length>I&&!k.warned){k.warned=!0;var M=new Error("Possible EventEmitter memory leak detected. "+k.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");M.name="MaxListenersExceededWarning",M.emitter=E,M.type=v,M.count=k.length,a(M)}return E}r.prototype.addListener=function(E,v){return i(this,E,v,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(E,v){return i(this,E,v,!0)};function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(E,v,C){var P={fired:!1,wrapFn:void 0,target:E,type:v,listener:C},I=c.bind(P);return I.listener=C,P.wrapFn=I,I}r.prototype.once=function(E,v){return n(v),this.on(E,h(this,E,v)),this},r.prototype.prependOnceListener=function(E,v){return n(v),this.prependListener(E,h(this,E,v)),this},r.prototype.removeListener=function(E,v){var C,P,I,O,k;if(n(v),P=this._events,P===void 0)return this;if(C=P[E],C===void 0)return this;if(C===v||C.listener===v)--this._eventsCount===0?this._events=Object.create(null):(delete P[E],P.removeListener&&this.emit("removeListener",E,C.listener||v));else if(typeof C!="function"){for(I=-1,O=C.length-1;O>=0;O--)if(C[O]===v||C[O].listener===v){k=C[O].listener,I=O;break}if(I<0)return this;I===0?C.shift():w(C,I),C.length===1&&(P[E]=C[0]),P.removeListener!==void 0&&this.emit("removeListener",E,k||v)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(E){var v,C,P;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[E]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[E]),this;if(arguments.length===0){var I=Object.keys(C),O;for(P=0;P<I.length;++P)O=I[P],O!=="removeListener"&&this.removeAllListeners(O);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(v=C[E],typeof v=="function")this.removeListener(E,v);else if(v!==void 0)for(P=v.length-1;P>=0;P--)this.removeListener(E,v[P]);return this};function d(E,v,C){var P=E._events;if(P===void 0)return[];var I=P[v];return I===void 0?[]:typeof I=="function"?C?[I.listener||I]:[I]:C?_(I):b(I,I.length)}r.prototype.listeners=function(E){return d(this,E,!0)},r.prototype.rawListeners=function(E){return d(this,E,!1)},r.listenerCount=function(E,v){return typeof E.listenerCount=="function"?E.listenerCount(v):m.call(E,v)},r.prototype.listenerCount=m;function m(E){var v=this._events;if(v!==void 0){var C=v[E];if(typeof C=="function")return 1;if(C!==void 0)return C.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?s(this._events):[]};function b(E,v){for(var C=new Array(v),P=0;P<v;++P)C[P]=E[P];return C}function w(E,v){for(;v+1<E.length;v++)E[v]=E[v+1];E.pop()}function _(E){for(var v=new Array(E.length),C=0;C<v.length;++C)v[C]=E[C].listener||E[C];return v}function A(E,v){return new Promise(function(C,P){function I(k){E.removeListener(v,O),P(k)}function O(){typeof E.removeListener=="function"&&E.removeListener("error",I),C([].slice.call(arguments))}S(E,v,O,{once:!0}),v!=="error"&&g(E,I,{once:!0})})}function g(E,v,C){typeof E.on=="function"&&S(E,"error",v,C)}function S(E,v,C,P){if(typeof E.on=="function")P.once?E.once(v,C):E.on(v,C);else if(typeof E.addEventListener=="function")E.addEventListener(v,function I(O){P.once&&E.removeEventListener(v,I),C(O)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof E)}return yr}var yr,Ii,or,ps,ds,gs,ms,ys,bs,Qt=_t(()=>{de(),me(),ge(),yr={},Ii=!1,or=Lu(),or.once,or.once=function(o,l){return new Promise((s,a)=>{function u(...t){r!==void 0&&o.removeListener("error",r),s(t)}let r;l!=="error"&&(r=t=>{o.removeListener(name,u),a(t)},o.once("error",r)),o.once(l,u)})},or.on=function(o,l){let s=[],a=[],u=null,r=!1,t={async next(){let i=s.shift();if(i)return createIterResult(i,!1);if(u){let c=Promise.reject(u);return u=null,c}return r?createIterResult(void 0,!0):new Promise((c,h)=>a.push({resolve:c,reject:h}))},async return(){o.removeListener(l,n),o.removeListener("error",e),r=!0;for(let i of a)i.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(i){u=i,o.removeListener(l,n),o.removeListener("error",e)},[Symbol.asyncIterator](){return this}};return o.on(l,n),o.on("error",e),t;function n(...i){let c=a.shift();c?c.resolve(createIterResult(i,!1)):s.push(i)}function e(i){r=!0;let c=a.shift();c?c.reject(i):u=i,t.return()}},{EventEmitter:ps,defaultMaxListeners:ds,init:gs,listenerCount:ms,on:ys,once:bs}=or}),St=_e((o,l)=>{de(),me(),ge();var s=(dt(),tt(pt)),{format:a,inspect:u}=hs(),{codes:{ERR_INVALID_ARG_TYPE:r}}=wt(),{kResistStopPropagation:t,AggregateError:n,SymbolDispose:e}=ut(),i=globalThis.AbortSignal||mr().AbortSignal,c=globalThis.AbortController||mr().AbortController,h=Object.getPrototypeOf(async function(){}).constructor,d=globalThis.Blob||s.Blob,m=typeof d<"u"?function(_){return _ instanceof d}:function(_){return!1},b=(_,A)=>{if(_!==void 0&&(_===null||typeof _!="object"||!("aborted"in _)))throw new r(A,"AbortSignal",_)},w=(_,A)=>{if(typeof _!="function")throw new r(A,"Function",_)};l.exports={AggregateError:n,kEmptyObject:Object.freeze({}),once(_){let A=!1;return function(...g){A||(A=!0,_.apply(this,g))}},createDeferredPromise:function(){let _,A;return{promise:new Promise((g,S)=>{_=g,A=S}),resolve:_,reject:A}},promisify(_){return new Promise((A,g)=>{_((S,...E)=>S?g(S):A(...E))})},debuglog(){return function(){}},format:a,inspect:u,types:{isAsyncFunction(_){return _ instanceof h},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:m,deprecate(_,A){return _},addAbortListener:(Qt(),tt(Ut)).addAbortListener||function(_,A){if(_===void 0)throw new r("signal","AbortSignal",_);b(_,"signal"),w(A,"listener");let g;return _.aborted?queueMicrotask(()=>A()):(_.addEventListener("abort",A,{__proto__:null,once:!0,[t]:!0}),g=()=>{_.removeEventListener("abort",A)}),{__proto__:null,[e](){var S;(S=g)===null||S===void 0||S()}}},AbortSignalAny:i.any||function(_){if(_.length===1)return _[0];let A=new c,g=()=>A.abort();return _.forEach(S=>{b(S,"signals"),S.addEventListener("abort",g,{once:!0})}),A.signal.addEventListener("abort",()=>{_.forEach(S=>S.removeEventListener("abort",g))},{once:!0}),A.signal}},l.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),br=_e((o,l)=>{de(),me(),ge();var{ArrayIsArray:s,ArrayPrototypeIncludes:a,ArrayPrototypeJoin:u,ArrayPrototypeMap:r,NumberIsInteger:t,NumberIsNaN:n,NumberMAX_SAFE_INTEGER:e,NumberMIN_SAFE_INTEGER:i,NumberParseInt:c,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:d,String:m,StringPrototypeToUpperCase:b,StringPrototypeTrim:w}=ut(),{hideStackFrames:_,codes:{ERR_SOCKET_BAD_PORT:A,ERR_INVALID_ARG_TYPE:g,ERR_INVALID_ARG_VALUE:S,ERR_OUT_OF_RANGE:E,ERR_UNKNOWN_SIGNAL:v}}=wt(),{normalizeEncoding:C}=St(),{isAsyncFunction:P,isArrayBufferView:I}=St().types,O={};function k(Z){return Z===(Z|0)}function M(Z){return Z===Z>>>0}var x=/^[0-7]+$/,W="must be a 32-bit unsigned integer or an octal string";function $(Z,we,ke){if(typeof Z>"u"&&(Z=ke),typeof Z=="string"){if(d(x,Z)===null)throw new S(we,Z,W);Z=c(Z,8)}return re(Z,we),Z}var L=_((Z,we,ke=i,fe=e)=>{if(typeof Z!="number")throw new g(we,"number",Z);if(!t(Z))throw new E(we,"an integer",Z);if(Z<ke||Z>fe)throw new E(we,`>= ${ke} && <= ${fe}`,Z)}),le=_((Z,we,ke=-2147483648,fe=2147483647)=>{if(typeof Z!="number")throw new g(we,"number",Z);if(!t(Z))throw new E(we,"an integer",Z);if(Z<ke||Z>fe)throw new E(we,`>= ${ke} && <= ${fe}`,Z)}),re=_((Z,we,ke=!1)=>{if(typeof Z!="number")throw new g(we,"number",Z);if(!t(Z))throw new E(we,"an integer",Z);let fe=ke?1:0,Ue=4294967295;if(Z<fe||Z>Ue)throw new E(we,`>= ${fe} && <= ${Ue}`,Z)});function ee(Z,we){if(typeof Z!="string")throw new g(we,"string",Z)}function ue(Z,we,ke=void 0,fe){if(typeof Z!="number")throw new g(we,"number",Z);if(ke!=null&&Z<ke||fe!=null&&Z>fe||(ke!=null||fe!=null)&&n(Z))throw new E(we,`${ke!=null?`>= ${ke}`:""}${ke!=null&&fe!=null?" && ":""}${fe!=null?`<= ${fe}`:""}`,Z)}var G=_((Z,we,ke)=>{if(!a(ke,Z)){let fe="must be one of: "+u(r(ke,Ue=>typeof Ue=="string"?`'${Ue}'`:m(Ue)),", ");throw new S(we,Z,fe)}});function oe(Z,we){if(typeof Z!="boolean")throw new g(we,"boolean",Z)}function R(Z,we,ke){return Z==null||!h(Z,we)?ke:Z[we]}var Q=_((Z,we,ke=null)=>{let fe=R(ke,"allowArray",!1),Ue=R(ke,"allowFunction",!1);if(!R(ke,"nullable",!1)&&Z===null||!fe&&s(Z)||typeof Z!="object"&&(!Ue||typeof Z!="function"))throw new g(we,"Object",Z)}),he=_((Z,we)=>{if(Z!=null&&typeof Z!="object"&&typeof Z!="function")throw new g(we,"a dictionary",Z)}),V=_((Z,we,ke=0)=>{if(!s(Z))throw new g(we,"Array",Z);if(Z.length<ke){let fe=`must be longer than ${ke}`;throw new S(we,Z,fe)}});function Ee(Z,we){V(Z,we);for(let ke=0;ke<Z.length;ke++)ee(Z[ke],`${we}[${ke}]`)}function X(Z,we){V(Z,we);for(let ke=0;ke<Z.length;ke++)oe(Z[ke],`${we}[${ke}]`)}function U(Z,we){V(Z,we);for(let ke=0;ke<Z.length;ke++){let fe=Z[ke],Ue=`${we}[${ke}]`;if(fe==null)throw new g(Ue,"AbortSignal",fe);ve(fe,Ue)}}function ae(Z,we="signal"){if(ee(Z,we),O[Z]===void 0)throw O[b(Z)]!==void 0?new v(Z+" (signals must use all capital letters)"):new v(Z)}var H=_((Z,we="buffer")=>{if(!I(Z))throw new g(we,["Buffer","TypedArray","DataView"],Z)});function te(Z,we){let ke=C(we),fe=Z.length;if(ke==="hex"&&fe%2!==0)throw new S("encoding",we,`is invalid for data of length ${fe}`)}function ne(Z,we="Port",ke=!0){if(typeof Z!="number"&&typeof Z!="string"||typeof Z=="string"&&w(Z).length===0||+Z!==+Z>>>0||Z>65535||Z===0&&!ke)throw new A(we,Z,ke);return Z|0}var ve=_((Z,we)=>{if(Z!==void 0&&(Z===null||typeof Z!="object"||!("aborted"in Z)))throw new g(we,"AbortSignal",Z)}),ce=_((Z,we)=>{if(typeof Z!="function")throw new g(we,"Function",Z)}),B=_((Z,we)=>{if(typeof Z!="function"||P(Z))throw new g(we,"Function",Z)}),Y=_((Z,we)=>{if(Z!==void 0)throw new g(we,"undefined",Z)});function se(Z,we,ke){if(!a(ke,Z))throw new g(we,`('${u(ke,"|")}')`,Z)}var ye=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe(Z,we){if(typeof Z>"u"||!d(ye,Z))throw new S(we,Z,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Se(Z){if(typeof Z=="string")return pe(Z,"hints"),Z;if(s(Z)){let we=Z.length,ke="";if(we===0)return ke;for(let fe=0;fe<we;fe++){let Ue=Z[fe];pe(Ue,"hints"),ke+=Ue,fe!==we-1&&(ke+=", ")}return ke}throw new S("hints",Z,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}l.exports={isInt32:k,isUint32:M,parseFileMode:$,validateArray:V,validateStringArray:Ee,validateBooleanArray:X,validateAbortSignalArray:U,validateBoolean:oe,validateBuffer:H,validateDictionary:he,validateEncoding:te,validateFunction:ce,validateInt32:le,validateInteger:L,validateNumber:ue,validateObject:Q,validateOneOf:G,validatePlainFunction:B,validatePort:ne,validateSignalName:ae,validateString:ee,validateUint32:re,validateUndefined:Y,validateUnion:se,validateAbortSignal:ve,validateLinkHeaderValue:Se}}),Jt=_e((o,l)=>{de(),me(),ge();var s=l.exports={},a,u;function r(){throw new Error("setTimeout has not been defined")}function t(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?a=setTimeout:a=r}catch{a=r}try{typeof clearTimeout=="function"?u=clearTimeout:u=t}catch{u=t}})();function n(A){if(a===setTimeout)return setTimeout(A,0);if((a===r||!a)&&setTimeout)return a=setTimeout,setTimeout(A,0);try{return a(A,0)}catch{try{return a.call(null,A,0)}catch{return a.call(this,A,0)}}}function e(A){if(u===clearTimeout)return clearTimeout(A);if((u===t||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(A);try{return u(A)}catch{try{return u.call(null,A)}catch{return u.call(this,A)}}}var i=[],c=!1,h,d=-1;function m(){!c||!h||(c=!1,h.length?i=h.concat(i):d=-1,i.length&&b())}function b(){if(!c){var A=n(m);c=!0;for(var g=i.length;g;){for(h=i,i=[];++d<g;)h&&h[d].run();d=-1,g=i.length}h=null,c=!1,e(A)}}s.nextTick=function(A){var g=new Array(arguments.length-1);if(arguments.length>1)for(var S=1;S<arguments.length;S++)g[S-1]=arguments[S];i.push(new w(A,g)),i.length===1&&!c&&n(b)};function w(A,g){this.fun=A,this.array=g}w.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={};function _(){}s.on=_,s.addListener=_,s.once=_,s.off=_,s.removeListener=_,s.removeAllListeners=_,s.emit=_,s.prependListener=_,s.prependOnceListener=_,s.listeners=function(A){return[]},s.binding=function(A){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(A){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}}),jt=_e((o,l)=>{de(),me(),ge();var{SymbolAsyncIterator:s,SymbolIterator:a,SymbolFor:u}=ut(),r=u("nodejs.stream.destroyed"),t=u("nodejs.stream.errored"),n=u("nodejs.stream.readable"),e=u("nodejs.stream.writable"),i=u("nodejs.stream.disturbed"),c=u("nodejs.webstream.isClosedPromise"),h=u("nodejs.webstream.controllerErrorFunction");function d(R,Q=!1){var he;return!!(R&&typeof R.pipe=="function"&&typeof R.on=="function"&&(!Q||typeof R.pause=="function"&&typeof R.resume=="function")&&(!R._writableState||((he=R._readableState)===null||he===void 0?void 0:he.readable)!==!1)&&(!R._writableState||R._readableState))}function m(R){var Q;return!!(R&&typeof R.write=="function"&&typeof R.on=="function"&&(!R._readableState||((Q=R._writableState)===null||Q===void 0?void 0:Q.writable)!==!1))}function b(R){return!!(R&&typeof R.pipe=="function"&&R._readableState&&typeof R.on=="function"&&typeof R.write=="function")}function w(R){return R&&(R._readableState||R._writableState||typeof R.write=="function"&&typeof R.on=="function"||typeof R.pipe=="function"&&typeof R.on=="function")}function _(R){return!!(R&&!w(R)&&typeof R.pipeThrough=="function"&&typeof R.getReader=="function"&&typeof R.cancel=="function")}function A(R){return!!(R&&!w(R)&&typeof R.getWriter=="function"&&typeof R.abort=="function")}function g(R){return!!(R&&!w(R)&&typeof R.readable=="object"&&typeof R.writable=="object")}function S(R){return _(R)||A(R)||g(R)}function E(R,Q){return R==null?!1:Q===!0?typeof R[s]=="function":Q===!1?typeof R[a]=="function":typeof R[s]=="function"||typeof R[a]=="function"}function v(R){if(!w(R))return null;let Q=R._writableState,he=R._readableState,V=Q||he;return!!(R.destroyed||R[r]||V!=null&&V.destroyed)}function C(R){if(!m(R))return null;if(R.writableEnded===!0)return!0;let Q=R._writableState;return Q!=null&&Q.errored?!1:typeof(Q==null?void 0:Q.ended)!="boolean"?null:Q.ended}function P(R,Q){if(!m(R))return null;if(R.writableFinished===!0)return!0;let he=R._writableState;return he!=null&&he.errored?!1:typeof(he==null?void 0:he.finished)!="boolean"?null:!!(he.finished||Q===!1&&he.ended===!0&&he.length===0)}function I(R){if(!d(R))return null;if(R.readableEnded===!0)return!0;let Q=R._readableState;return!Q||Q.errored?!1:typeof(Q==null?void 0:Q.ended)!="boolean"?null:Q.ended}function O(R,Q){if(!d(R))return null;let he=R._readableState;return he!=null&&he.errored?!1:typeof(he==null?void 0:he.endEmitted)!="boolean"?null:!!(he.endEmitted||Q===!1&&he.ended===!0&&he.length===0)}function k(R){return R&&R[n]!=null?R[n]:typeof(R==null?void 0:R.readable)!="boolean"?null:v(R)?!1:d(R)&&R.readable&&!O(R)}function M(R){return R&&R[e]!=null?R[e]:typeof(R==null?void 0:R.writable)!="boolean"?null:v(R)?!1:m(R)&&R.writable&&!C(R)}function x(R,Q){return w(R)?v(R)?!0:!((Q==null?void 0:Q.readable)!==!1&&k(R)||(Q==null?void 0:Q.writable)!==!1&&M(R)):null}function W(R){var Q,he;return w(R)?R.writableErrored?R.writableErrored:(Q=(he=R._writableState)===null||he===void 0?void 0:he.errored)!==null&&Q!==void 0?Q:null:null}function $(R){var Q,he;return w(R)?R.readableErrored?R.readableErrored:(Q=(he=R._readableState)===null||he===void 0?void 0:he.errored)!==null&&Q!==void 0?Q:null:null}function L(R){if(!w(R))return null;if(typeof R.closed=="boolean")return R.closed;let Q=R._writableState,he=R._readableState;return typeof(Q==null?void 0:Q.closed)=="boolean"||typeof(he==null?void 0:he.closed)=="boolean"?(Q==null?void 0:Q.closed)||(he==null?void 0:he.closed):typeof R._closed=="boolean"&&le(R)?R._closed:null}function le(R){return typeof R._closed=="boolean"&&typeof R._defaultKeepAlive=="boolean"&&typeof R._removedConnection=="boolean"&&typeof R._removedContLen=="boolean"}function re(R){return typeof R._sent100=="boolean"&&le(R)}function ee(R){var Q;return typeof R._consuming=="boolean"&&typeof R._dumped=="boolean"&&((Q=R.req)===null||Q===void 0?void 0:Q.upgradeOrConnect)===void 0}function ue(R){if(!w(R))return null;let Q=R._writableState,he=R._readableState,V=Q||he;return!V&&re(R)||!!(V&&V.autoDestroy&&V.emitClose&&V.closed===!1)}function G(R){var Q;return!!(R&&((Q=R[i])!==null&&Q!==void 0?Q:R.readableDidRead||R.readableAborted))}function oe(R){var Q,he,V,Ee,X,U,ae,H,te,ne;return!!(R&&((Q=(he=(V=(Ee=(X=(U=R[t])!==null&&U!==void 0?U:R.readableErrored)!==null&&X!==void 0?X:R.writableErrored)!==null&&Ee!==void 0?Ee:(ae=R._readableState)===null||ae===void 0?void 0:ae.errorEmitted)!==null&&V!==void 0?V:(H=R._writableState)===null||H===void 0?void 0:H.errorEmitted)!==null&&he!==void 0?he:(te=R._readableState)===null||te===void 0?void 0:te.errored)!==null&&Q!==void 0?Q:!((ne=R._writableState)===null||ne===void 0)&&ne.errored))}l.exports={isDestroyed:v,kIsDestroyed:r,isDisturbed:G,kIsDisturbed:i,isErrored:oe,kIsErrored:t,isReadable:k,kIsReadable:n,kIsClosedPromise:c,kControllerErrorFunction:h,kIsWritable:e,isClosed:L,isDuplexNodeStream:b,isFinished:x,isIterable:E,isReadableNodeStream:d,isReadableStream:_,isReadableEnded:I,isReadableFinished:O,isReadableErrored:$,isNodeStream:w,isWebStream:S,isWritable:M,isWritableNodeStream:m,isWritableStream:A,isWritableEnded:C,isWritableFinished:P,isWritableErrored:W,isServerRequest:ee,isServerResponse:re,willEmitClose:ue,isTransformStream:g}}),Ft=_e((o,l)=>{de(),me(),ge();var s=Jt(),{AbortError:a,codes:u}=wt(),{ERR_INVALID_ARG_TYPE:r,ERR_STREAM_PREMATURE_CLOSE:t}=u,{kEmptyObject:n,once:e}=St(),{validateAbortSignal:i,validateFunction:c,validateObject:h,validateBoolean:d}=br(),{Promise:m,PromisePrototypeThen:b,SymbolDispose:w}=ut(),{isClosed:_,isReadable:A,isReadableNodeStream:g,isReadableStream:S,isReadableFinished:E,isReadableErrored:v,isWritable:C,isWritableNodeStream:P,isWritableStream:I,isWritableFinished:O,isWritableErrored:k,isNodeStream:M,willEmitClose:x,kIsClosedPromise:W}=jt(),$;function L(G){return G.setHeader&&typeof G.abort=="function"}var le=()=>{};function re(G,oe,R){var Q,he;if(arguments.length===2?(R=oe,oe=n):oe==null?oe=n:h(oe,"options"),c(R,"callback"),i(oe.signal,"options.signal"),R=e(R),S(G)||I(G))return ee(G,oe,R);if(!M(G))throw new r("stream",["ReadableStream","WritableStream","Stream"],G);let V=(Q=oe.readable)!==null&&Q!==void 0?Q:g(G),Ee=(he=oe.writable)!==null&&he!==void 0?he:P(G),X=G._writableState,U=G._readableState,ae=()=>{G.writable||ne()},H=x(G)&&g(G)===V&&P(G)===Ee,te=O(G,!1),ne=()=>{te=!0,G.destroyed&&(H=!1),!(H&&(!G.readable||V))&&(!V||ve)&&R.call(G)},ve=E(G,!1),ce=()=>{ve=!0,G.destroyed&&(H=!1),!(H&&(!G.writable||Ee))&&(!Ee||te)&&R.call(G)},B=Z=>{R.call(G,Z)},Y=_(G),se=()=>{Y=!0;let Z=k(G)||v(G);if(Z&&typeof Z!="boolean")return R.call(G,Z);if(V&&!ve&&g(G,!0)&&!E(G,!1))return R.call(G,new t);if(Ee&&!te&&!O(G,!1))return R.call(G,new t);R.call(G)},ye=()=>{Y=!0;let Z=k(G)||v(G);if(Z&&typeof Z!="boolean")return R.call(G,Z);R.call(G)},pe=()=>{G.req.on("finish",ne)};L(G)?(G.on("complete",ne),H||G.on("abort",se),G.req?pe():G.on("request",pe)):Ee&&!X&&(G.on("end",ae),G.on("close",ae)),!H&&typeof G.aborted=="boolean"&&G.on("aborted",se),G.on("end",ce),G.on("finish",ne),oe.error!==!1&&G.on("error",B),G.on("close",se),Y?s.nextTick(se):X!=null&&X.errorEmitted||U!=null&&U.errorEmitted?H||s.nextTick(ye):(!V&&(!H||A(G))&&(te||C(G)===!1)||!Ee&&(!H||C(G))&&(ve||A(G)===!1)||U&&G.req&&G.aborted)&&s.nextTick(ye);let Se=()=>{R=le,G.removeListener("aborted",se),G.removeListener("complete",ne),G.removeListener("abort",se),G.removeListener("request",pe),G.req&&G.req.removeListener("finish",ne),G.removeListener("end",ae),G.removeListener("close",ae),G.removeListener("finish",ne),G.removeListener("end",ce),G.removeListener("error",B),G.removeListener("close",se)};if(oe.signal&&!Y){let Z=()=>{let we=R;Se(),we.call(G,new a(void 0,{cause:oe.signal.reason}))};if(oe.signal.aborted)s.nextTick(Z);else{$=$||St().addAbortListener;let we=$(oe.signal,Z),ke=R;R=e((...fe)=>{we[w](),ke.apply(G,fe)})}}return Se}function ee(G,oe,R){let Q=!1,he=le;if(oe.signal)if(he=()=>{Q=!0,R.call(G,new a(void 0,{cause:oe.signal.reason}))},oe.signal.aborted)s.nextTick(he);else{$=$||St().addAbortListener;let Ee=$(oe.signal,he),X=R;R=e((...U)=>{Ee[w](),X.apply(G,U)})}let V=(...Ee)=>{Q||s.nextTick(()=>R.apply(G,Ee))};return b(G[W].promise,V,V),le}function ue(G,oe){var R;let Q=!1;return oe===null&&(oe=n),(R=oe)!==null&&R!==void 0&&R.cleanup&&(d(oe.cleanup,"cleanup"),Q=oe.cleanup),new m((he,V)=>{let Ee=re(G,oe,X=>{Q&&Ee(),X?V(X):he()})})}l.exports=re,l.exports.finished=ue}),sr=_e((o,l)=>{de(),me(),ge();var s=Jt(),{aggregateTwoErrors:a,codes:{ERR_MULTIPLE_CALLBACK:u},AbortError:r}=wt(),{Symbol:t}=ut(),{kIsDestroyed:n,isDestroyed:e,isFinished:i,isServerRequest:c}=jt(),h=t("kDestroy"),d=t("kConstruct");function m(x,W,$){x&&(x.stack,W&&!W.errored&&(W.errored=x),$&&!$.errored&&($.errored=x))}function b(x,W){let $=this._readableState,L=this._writableState,le=L||$;return L!=null&&L.destroyed||$!=null&&$.destroyed?(typeof W=="function"&&W(),this):(m(x,L,$),L&&(L.destroyed=!0),$&&($.destroyed=!0),le.constructed?w(this,x,W):this.once(h,function(re){w(this,a(re,x),W)}),this)}function w(x,W,$){let L=!1;function le(re){if(L)return;L=!0;let ee=x._readableState,ue=x._writableState;m(re,ue,ee),ue&&(ue.closed=!0),ee&&(ee.closed=!0),typeof $=="function"&&$(re),re?s.nextTick(_,x,re):s.nextTick(A,x)}try{x._destroy(W||null,le)}catch(re){le(re)}}function _(x,W){g(x,W),A(x)}function A(x){let W=x._readableState,$=x._writableState;$&&($.closeEmitted=!0),W&&(W.closeEmitted=!0),($!=null&&$.emitClose||W!=null&&W.emitClose)&&x.emit("close")}function g(x,W){let $=x._readableState,L=x._writableState;L!=null&&L.errorEmitted||$!=null&&$.errorEmitted||(L&&(L.errorEmitted=!0),$&&($.errorEmitted=!0),x.emit("error",W))}function S(){let x=this._readableState,W=this._writableState;x&&(x.constructed=!0,x.closed=!1,x.closeEmitted=!1,x.destroyed=!1,x.errored=null,x.errorEmitted=!1,x.reading=!1,x.ended=x.readable===!1,x.endEmitted=x.readable===!1),W&&(W.constructed=!0,W.destroyed=!1,W.closed=!1,W.closeEmitted=!1,W.errored=null,W.errorEmitted=!1,W.finalCalled=!1,W.prefinished=!1,W.ended=W.writable===!1,W.ending=W.writable===!1,W.finished=W.writable===!1)}function E(x,W,$){let L=x._readableState,le=x._writableState;if(le!=null&&le.destroyed||L!=null&&L.destroyed)return this;L!=null&&L.autoDestroy||le!=null&&le.autoDestroy?x.destroy(W):W&&(W.stack,le&&!le.errored&&(le.errored=W),L&&!L.errored&&(L.errored=W),$?s.nextTick(g,x,W):g(x,W))}function v(x,W){if(typeof x._construct!="function")return;let $=x._readableState,L=x._writableState;$&&($.constructed=!1),L&&(L.constructed=!1),x.once(d,W),!(x.listenerCount(d)>1)&&s.nextTick(C,x)}function C(x){let W=!1;function $(L){if(W){E(x,L??new u);return}W=!0;let le=x._readableState,re=x._writableState,ee=re||le;le&&(le.constructed=!0),re&&(re.constructed=!0),ee.destroyed?x.emit(h,L):L?E(x,L,!0):s.nextTick(P,x)}try{x._construct(L=>{s.nextTick($,L)})}catch(L){s.nextTick($,L)}}function P(x){x.emit(d)}function I(x){return(x==null?void 0:x.setHeader)&&typeof x.abort=="function"}function O(x){x.emit("close")}function k(x,W){x.emit("error",W),s.nextTick(O,x)}function M(x,W){!x||e(x)||(!W&&!i(x)&&(W=new r),c(x)?(x.socket=null,x.destroy(W)):I(x)?x.abort():I(x.req)?x.req.abort():typeof x.destroy=="function"?x.destroy(W):typeof x.close=="function"?x.close():W?s.nextTick(k,x,W):s.nextTick(O,x),x.destroyed||(x[n]=!0))}l.exports={construct:v,destroyer:M,destroy:b,undestroy:S,errorOrDestroy:E}}),ki=_e((o,l)=>{de(),me(),ge();var{ArrayIsArray:s,ObjectSetPrototypeOf:a}=ut(),{EventEmitter:u}=(Qt(),tt(Ut));function r(n){u.call(this,n)}a(r.prototype,u.prototype),a(r,u),r.prototype.pipe=function(n,e){let i=this;function c(A){n.writable&&n.write(A)===!1&&i.pause&&i.pause()}i.on("data",c);function h(){i.readable&&i.resume&&i.resume()}n.on("drain",h),!n._isStdio&&(!e||e.end!==!1)&&(i.on("end",m),i.on("close",b));let d=!1;function m(){d||(d=!0,n.end())}function b(){d||(d=!0,typeof n.destroy=="function"&&n.destroy())}function w(A){_(),u.listenerCount(this,"error")===0&&this.emit("error",A)}t(i,"error",w),t(n,"error",w);function _(){i.removeListener("data",c),n.removeListener("drain",h),i.removeListener("end",m),i.removeListener("close",b),i.removeListener("error",w),n.removeListener("error",w),i.removeListener("end",_),i.removeListener("close",_),n.removeListener("close",_)}return i.on("end",_),i.on("close",_),n.on("close",_),n.emit("pipe",i),n};function t(n,e,i){if(typeof n.prependListener=="function")return n.prependListener(e,i);!n._events||!n._events[e]?n.on(e,i):s(n._events[e])?n._events[e].unshift(i):n._events[e]=[i,n._events[e]]}l.exports={Stream:r,prependListener:t}}),Ir=_e((o,l)=>{de(),me(),ge();var{SymbolDispose:s}=ut(),{AbortError:a,codes:u}=wt(),{isNodeStream:r,isWebStream:t,kControllerErrorFunction:n}=jt(),e=Ft(),{ERR_INVALID_ARG_TYPE:i}=u,c,h=(d,m)=>{if(typeof d!="object"||!("aborted"in d))throw new i(m,"AbortSignal",d)};l.exports.addAbortSignal=function(d,m){if(h(d,"signal"),!r(m)&&!t(m))throw new i("stream",["ReadableStream","WritableStream","Stream"],m);return l.exports.addAbortSignalNoValidate(d,m)},l.exports.addAbortSignalNoValidate=function(d,m){if(typeof d!="object"||!("aborted"in d))return m;let b=r(m)?()=>{m.destroy(new a(void 0,{cause:d.reason}))}:()=>{m[n](new a(void 0,{cause:d.reason}))};if(d.aborted)b();else{c=c||St().addAbortListener;let w=c(d,b);e(m,w[s])}return m}}),Du=_e((o,l)=>{de(),me(),ge();var{StringPrototypeSlice:s,SymbolIterator:a,TypedArrayPrototypeSet:u,Uint8Array:r}=ut(),{Buffer:t}=(dt(),tt(pt)),{inspect:n}=St();l.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let i={data:e,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}unshift(e){let i={data:e,next:this.head};this.length===0&&(this.tail=i),this.head=i,++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 i=this.head,c=""+i.data;for(;(i=i.next)!==null;)c+=e+i.data;return c}concat(e){if(this.length===0)return t.alloc(0);let i=t.allocUnsafe(e>>>0),c=this.head,h=0;for(;c;)u(i,c.data,h),h+=c.data.length,c=c.next;return i}consume(e,i){let c=this.head.data;if(e<c.length){let h=c.slice(0,e);return this.head.data=c.slice(e),h}return e===c.length?this.shift():i?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[a](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let i="",c=this.head,h=0;do{let d=c.data;if(e>d.length)i+=d,e-=d.length;else{e===d.length?(i+=d,++h,c.next?this.head=c.next:this.head=this.tail=null):(i+=s(d,0,e),this.head=c,c.data=s(d,e));break}++h}while((c=c.next)!==null);return this.length-=h,i}_getBuffer(e){let i=t.allocUnsafe(e),c=e,h=this.head,d=0;do{let m=h.data;if(e>m.length)u(i,m,c-e),e-=m.length;else{e===m.length?(u(i,m,c-e),++d,h.next?this.head=h.next:this.head=this.tail=null):(u(i,new r(m.buffer,m.byteOffset,e),c-e),this.head=h,h.data=m.slice(e));break}++d}while((h=h.next)!==null);return this.length-=d,i}[Symbol.for("nodejs.util.inspect.custom")](e,i){return n(this,{...i,depth:0,customInspect:!1})}}}),kr=_e((o,l)=>{de(),me(),ge();var{MathFloor:s,NumberIsInteger:a}=ut(),{validateInteger:u}=br(),{ERR_INVALID_ARG_VALUE:r}=wt().codes,t=16*1024,n=16;function e(d,m,b){return d.highWaterMark!=null?d.highWaterMark:m?d[b]:null}function i(d){return d?n:t}function c(d,m){u(m,"value",0),d?n=m:t=m}function h(d,m,b,w){let _=e(m,w,b);if(_!=null){if(!a(_)||_<0){let A=w?`options.${b}`:"options.highWaterMark";throw new r(A,_)}return s(_)}return i(d.objectMode)}l.exports={getHighWaterMark:h,getDefaultHighWaterMark:i,setDefaultHighWaterMark:c}}),Uu=_e((o,l)=>{de(),me(),ge();var s=(dt(),tt(pt)),a=s.Buffer;function u(t,n){for(var e in t)n[e]=t[e]}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?l.exports=s:(u(s,o),o.Buffer=r);function r(t,n,e){return a(t,n,e)}r.prototype=Object.create(a.prototype),u(a,r),r.from=function(t,n,e){if(typeof t=="number")throw new TypeError("Argument must not be a number");return a(t,n,e)},r.alloc=function(t,n,e){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=a(t);return n!==void 0?typeof e=="string"?i.fill(n,e):i.fill(n):i.fill(0),i},r.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return a(t)},r.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return s.SlowBuffer(t)}}),Fu=_e(o=>{de(),me(),ge();var l=Uu().Buffer,s=l.isEncoding||function(g){switch(g=""+g,g&&g.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(g){if(!g)return"utf8";for(var S;;)switch(g){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return g;default:if(S)return;g=(""+g).toLowerCase(),S=!0}}function u(g){var S=a(g);if(typeof S!="string"&&(l.isEncoding===s||!s(g)))throw new Error("Unknown encoding: "+g);return S||g}o.StringDecoder=r;function r(g){this.encoding=u(g);var S;switch(this.encoding){case"utf16le":this.text=d,this.end=m,S=4;break;case"utf8":this.fillLast=i,S=4;break;case"base64":this.text=b,this.end=w,S=3;break;default:this.write=_,this.end=A;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=l.allocUnsafe(S)}r.prototype.write=function(g){if(g.length===0)return"";var S,E;if(this.lastNeed){if(S=this.fillLast(g),S===void 0)return"";E=this.lastNeed,this.lastNeed=0}else E=0;return E<g.length?S?S+this.text(g,E):this.text(g,E):S||""},r.prototype.end=h,r.prototype.text=c,r.prototype.fillLast=function(g){if(this.lastNeed<=g.length)return g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,this.lastTotal-this.lastNeed,0,g.length),this.lastNeed-=g.length};function t(g){return g<=127?0:g>>5===6?2:g>>4===14?3:g>>3===30?4:g>>6===2?-1:-2}function n(g,S,E){var v=S.length-1;if(v<E)return 0;var C=t(S[v]);return C>=0?(C>0&&(g.lastNeed=C-1),C):--v<E||C===-2?0:(C=t(S[v]),C>=0?(C>0&&(g.lastNeed=C-2),C):--v<E||C===-2?0:(C=t(S[v]),C>=0?(C>0&&(C===2?C=0:g.lastNeed=C-3),C):0))}function e(g,S,E){if((S[0]&192)!==128)return g.lastNeed=0,"�";if(g.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return g.lastNeed=1,"�";if(g.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return g.lastNeed=2,"�"}}function i(g){var S=this.lastTotal-this.lastNeed,E=e(this,g);if(E!==void 0)return E;if(this.lastNeed<=g.length)return g.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);g.copy(this.lastChar,S,0,g.length),this.lastNeed-=g.length}function c(g,S){var E=n(this,g,S);if(!this.lastNeed)return g.toString("utf8",S);this.lastTotal=E;var v=g.length-(E-this.lastNeed);return g.copy(this.lastChar,0,v),g.toString("utf8",S,v)}function h(g){var S=g&&g.length?this.write(g):"";return this.lastNeed?S+"�":S}function d(g,S){if((g.length-S)%2===0){var E=g.toString("utf16le",S);if(E){var v=E.charCodeAt(E.length-1);if(v>=55296&&v<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1],E.slice(0,-1)}return E}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=g[g.length-1],g.toString("utf16le",S,g.length-1)}function m(g){var S=g&&g.length?this.write(g):"";if(this.lastNeed){var E=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,E)}return S}function b(g,S){var E=(g.length-S)%3;return E===0?g.toString("base64",S):(this.lastNeed=3-E,this.lastTotal=3,E===1?this.lastChar[0]=g[g.length-1]:(this.lastChar[0]=g[g.length-2],this.lastChar[1]=g[g.length-1]),g.toString("base64",S,g.length-E))}function w(g){var S=g&&g.length?this.write(g):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function _(g){return g.toString(this.encoding)}function A(g){return g&&g.length?this.write(g):""}}),vs=_e((o,l)=>{de(),me(),ge();var s=Jt(),{PromisePrototypeThen:a,SymbolAsyncIterator:u,SymbolIterator:r}=ut(),{Buffer:t}=(dt(),tt(pt)),{ERR_INVALID_ARG_TYPE:n,ERR_STREAM_NULL_VALUES:e}=wt().codes;function i(c,h,d){let m;if(typeof h=="string"||h instanceof t)return new c({objectMode:!0,...d,read(){this.push(h),this.push(null)}});let b;if(h&&h[u])b=!0,m=h[u]();else if(h&&h[r])b=!1,m=h[r]();else throw new n("iterable",["Iterable"],h);let w=new c({objectMode:!0,highWaterMark:1,...d}),_=!1;w._read=function(){_||(_=!0,g())},w._destroy=function(S,E){a(A(S),()=>s.nextTick(E,S),v=>s.nextTick(E,v||S))};async function A(S){let E=S!=null,v=typeof m.throw=="function";if(E&&v){let{value:C,done:P}=await m.throw(S);if(await C,P)return}if(typeof m.return=="function"){let{value:C}=await m.return();await C}}async function g(){for(;;){try{let{value:S,done:E}=b?await m.next():m.next();if(E)w.push(null);else{let v=S&&typeof S.then=="function"?await S:S;if(v===null)throw _=!1,new e;if(w.push(v))continue;_=!1}}catch(S){w.destroy(S)}break}}return w}l.exports=i}),Tr=_e((o,l)=>{de(),me(),ge();var s=Jt(),{ArrayPrototypeIndexOf:a,NumberIsInteger:u,NumberIsNaN:r,NumberParseInt:t,ObjectDefineProperties:n,ObjectKeys:e,ObjectSetPrototypeOf:i,Promise:c,SafeSet:h,SymbolAsyncDispose:d,SymbolAsyncIterator:m,Symbol:b}=ut();l.exports=fe,fe.ReadableState=ke;var{EventEmitter:w}=(Qt(),tt(Ut)),{Stream:_,prependListener:A}=ki(),{Buffer:g}=(dt(),tt(pt)),{addAbortSignal:S}=Ir(),E=Ft(),v=St().debuglog("stream",j=>{v=j}),C=Du(),P=sr(),{getHighWaterMark:I,getDefaultHighWaterMark:O}=kr(),{aggregateTwoErrors:k,codes:{ERR_INVALID_ARG_TYPE:M,ERR_METHOD_NOT_IMPLEMENTED:x,ERR_OUT_OF_RANGE:W,ERR_STREAM_PUSH_AFTER_EOF:$,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:L},AbortError:le}=wt(),{validateObject:re}=br(),ee=b("kPaused"),{StringDecoder:ue}=Fu(),G=vs();i(fe.prototype,_.prototype),i(fe,_);var oe=()=>{},{errorOrDestroy:R}=P,Q=1,he=2,V=4,Ee=8,X=16,U=32,ae=64,H=128,te=256,ne=512,ve=1024,ce=2048,B=4096,Y=8192,se=16384,ye=32768,pe=65536,Se=1<<17,Z=1<<18;function we(j){return{enumerable:!1,get(){return(this.state&j)!==0},set(D){D?this.state|=j:this.state&=~j}}}n(ke.prototype,{objectMode:we(Q),ended:we(he),endEmitted:we(V),reading:we(Ee),constructed:we(X),sync:we(U),needReadable:we(ae),emittedReadable:we(H),readableListening:we(te),resumeScheduled:we(ne),errorEmitted:we(ve),emitClose:we(ce),autoDestroy:we(B),destroyed:we(Y),closed:we(se),closeEmitted:we(ye),multiAwaitDrain:we(pe),readingMore:we(Se),dataEmitted:we(Z)});function ke(j,D,xe){typeof xe!="boolean"&&(xe=D instanceof Rt()),this.state=ce|B|X|U,j&&j.objectMode&&(this.state|=Q),xe&&j&&j.readableObjectMode&&(this.state|=Q),this.highWaterMark=j?I(this,j,"readableHighWaterMark",xe):O(!1),this.buffer=new C,this.length=0,this.pipes=[],this.flowing=null,this[ee]=null,j&&j.emitClose===!1&&(this.state&=~ce),j&&j.autoDestroy===!1&&(this.state&=~B),this.errored=null,this.defaultEncoding=j&&j.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,j&&j.encoding&&(this.decoder=new ue(j.encoding),this.encoding=j.encoding)}function fe(j){if(!(this instanceof fe))return new fe(j);let D=this instanceof Rt();this._readableState=new ke(j,this,D),j&&(typeof j.read=="function"&&(this._read=j.read),typeof j.destroy=="function"&&(this._destroy=j.destroy),typeof j.construct=="function"&&(this._construct=j.construct),j.signal&&!D&&S(j.signal,this)),_.call(this,j),P.construct(this,()=>{this._readableState.needReadable&&q(this,this._readableState)})}fe.prototype.destroy=P.destroy,fe.prototype._undestroy=P.undestroy,fe.prototype._destroy=function(j,D){D(j)},fe.prototype[w.captureRejectionSymbol]=function(j){this.destroy(j)},fe.prototype[d]=function(){let j;return this.destroyed||(j=this.readableEnded?null:new le,this.destroy(j)),new c((D,xe)=>E(this,Ce=>Ce&&Ce!==j?xe(Ce):D(null)))},fe.prototype.push=function(j,D){return Ue(this,j,D,!1)},fe.prototype.unshift=function(j,D){return Ue(this,j,D,!0)};function Ue(j,D,xe,Ce){v("readableAddChunk",D);let Be=j._readableState,ft;if(!(Be.state&Q)&&(typeof D=="string"?(xe=xe||Be.defaultEncoding,Be.encoding!==xe&&(Ce&&Be.encoding?D=g.from(D,xe).toString(Be.encoding):(D=g.from(D,xe),xe=""))):D instanceof g?xe="":_._isUint8Array(D)?(D=_._uint8ArrayToBuffer(D),xe=""):D!=null&&(ft=new M("chunk",["string","Buffer","Uint8Array"],D))),ft)R(j,ft);else if(D===null)Be.state&=~Ee,N(j,Be);else if(Be.state&Q||D&&D.length>0)if(Ce)if(Be.state&V)R(j,new L);else{if(Be.destroyed||Be.errored)return!1;f(j,Be,D,!0)}else if(Be.ended)R(j,new $);else{if(Be.destroyed||Be.errored)return!1;Be.state&=~Ee,Be.decoder&&!xe?(D=Be.decoder.write(D),Be.objectMode||D.length!==0?f(j,Be,D,!1):q(j,Be)):f(j,Be,D,!1)}else Ce||(Be.state&=~Ee,q(j,Be));return!Be.ended&&(Be.length<Be.highWaterMark||Be.length===0)}function f(j,D,xe,Ce){D.flowing&&D.length===0&&!D.sync&&j.listenerCount("data")>0?(D.state&pe?D.awaitDrainWriters.clear():D.awaitDrainWriters=null,D.dataEmitted=!0,j.emit("data",xe)):(D.length+=D.objectMode?1:xe.length,Ce?D.buffer.unshift(xe):D.buffer.push(xe),D.state&ae&&z(j)),q(j,D)}fe.prototype.isPaused=function(){let j=this._readableState;return j[ee]===!0||j.flowing===!1},fe.prototype.setEncoding=function(j){let D=new ue(j);this._readableState.decoder=D,this._readableState.encoding=this._readableState.decoder.encoding;let xe=this._readableState.buffer,Ce="";for(let Be of xe)Ce+=D.write(Be);return xe.clear(),Ce!==""&&xe.push(Ce),this._readableState.length=Ce.length,this};var p=1073741824;function y(j){if(j>p)throw new W("size","<= 1GiB",j);return j--,j|=j>>>1,j|=j>>>2,j|=j>>>4,j|=j>>>8,j|=j>>>16,j++,j}function T(j,D){return j<=0||D.length===0&&D.ended?0:D.state&Q?1:r(j)?D.flowing&&D.length?D.buffer.first().length:D.length:j<=D.length?j:D.ended?D.length:0}fe.prototype.read=function(j){v("read",j),j===void 0?j=NaN:u(j)||(j=t(j,10));let D=this._readableState,xe=j;if(j>D.highWaterMark&&(D.highWaterMark=y(j)),j!==0&&(D.state&=~H),j===0&&D.needReadable&&((D.highWaterMark!==0?D.length>=D.highWaterMark:D.length>0)||D.ended))return v("read: emitReadable",D.length,D.ended),D.length===0&&D.ended?Ye(this):z(this),null;if(j=T(j,D),j===0&&D.ended)return D.length===0&&Ye(this),null;let Ce=(D.state&ae)!==0;if(v("need readable",Ce),(D.length===0||D.length-j<D.highWaterMark)&&(Ce=!0,v("length less than watermark",Ce)),D.ended||D.reading||D.destroyed||D.errored||!D.constructed)Ce=!1,v("reading, ended or constructing",Ce);else if(Ce){v("do read"),D.state|=Ee|U,D.length===0&&(D.state|=ae);try{this._read(D.highWaterMark)}catch(ft){R(this,ft)}D.state&=~U,D.reading||(j=T(xe,D))}let Be;return j>0?Be=De(j,D):Be=null,Be===null?(D.needReadable=D.length<=D.highWaterMark,j=0):(D.length-=j,D.multiAwaitDrain?D.awaitDrainWriters.clear():D.awaitDrainWriters=null),D.length===0&&(D.ended||(D.needReadable=!0),xe!==j&&D.ended&&Ye(this)),Be!==null&&!D.errorEmitted&&!D.closeEmitted&&(D.dataEmitted=!0,this.emit("data",Be)),Be};function N(j,D){if(v("onEofChunk"),!D.ended){if(D.decoder){let xe=D.decoder.end();xe&&xe.length&&(D.buffer.push(xe),D.length+=D.objectMode?1:xe.length)}D.ended=!0,D.sync?z(j):(D.needReadable=!1,D.emittedReadable=!0,ie(j))}}function z(j){let D=j._readableState;v("emitReadable",D.needReadable,D.emittedReadable),D.needReadable=!1,D.emittedReadable||(v("emitReadable",D.flowing),D.emittedReadable=!0,s.nextTick(ie,j))}function ie(j){let D=j._readableState;v("emitReadable_",D.destroyed,D.length,D.ended),!D.destroyed&&!D.errored&&(D.length||D.ended)&&(j.emit("readable"),D.emittedReadable=!1),D.needReadable=!D.flowing&&!D.ended&&D.length<=D.highWaterMark,rt(j)}function q(j,D){!D.readingMore&&D.constructed&&(D.readingMore=!0,s.nextTick(J,j,D))}function J(j,D){for(;!D.reading&&!D.ended&&(D.length<D.highWaterMark||D.flowing&&D.length===0);){let xe=D.length;if(v("maybeReadMore read 0"),j.read(0),xe===D.length)break}D.readingMore=!1}fe.prototype._read=function(j){throw new x("_read()")},fe.prototype.pipe=function(j,D){let xe=this,Ce=this._readableState;Ce.pipes.length===1&&(Ce.multiAwaitDrain||(Ce.multiAwaitDrain=!0,Ce.awaitDrainWriters=new h(Ce.awaitDrainWriters?[Ce.awaitDrainWriters]:[]))),Ce.pipes.push(j),v("pipe count=%d opts=%j",Ce.pipes.length,D);let Be=(!D||D.end!==!1)&&j!==s.stdout&&j!==s.stderr?mt:Ve;Ce.endEmitted?s.nextTick(Be):xe.once("end",Be),j.on("unpipe",ft);function ft(it,et){v("onunpipe"),it===xe&&et&&et.hasUnpiped===!1&&(et.hasUnpiped=!0,Ae())}function mt(){v("onend"),j.end()}let xt,K=!1;function Ae(){v("cleanup"),j.removeListener("close",Ge),j.removeListener("finish",ze),xt&&j.removeListener("drain",xt),j.removeListener("error",He),j.removeListener("unpipe",ft),xe.removeListener("end",mt),xe.removeListener("end",Ve),xe.removeListener("data",We),K=!0,xt&&Ce.awaitDrainWriters&&(!j._writableState||j._writableState.needDrain)&&xt()}function Re(){K||(Ce.pipes.length===1&&Ce.pipes[0]===j?(v("false write response, pause",0),Ce.awaitDrainWriters=j,Ce.multiAwaitDrain=!1):Ce.pipes.length>1&&Ce.pipes.includes(j)&&(v("false write response, pause",Ce.awaitDrainWriters.size),Ce.awaitDrainWriters.add(j)),xe.pause()),xt||(xt=Oe(xe,j),j.on("drain",xt))}xe.on("data",We);function We(it){v("ondata");let et=j.write(it);v("dest.write",et),et===!1&&Re()}function He(it){if(v("onerror",it),Ve(),j.removeListener("error",He),j.listenerCount("error")===0){let et=j._writableState||j._readableState;et&&!et.errorEmitted?R(j,it):j.emit("error",it)}}A(j,"error",He);function Ge(){j.removeListener("finish",ze),Ve()}j.once("close",Ge);function ze(){v("onfinish"),j.removeListener("close",Ge),Ve()}j.once("finish",ze);function Ve(){v("unpipe"),xe.unpipe(j)}return j.emit("pipe",xe),j.writableNeedDrain===!0?Re():Ce.flowing||(v("pipe resume"),xe.resume()),j};function Oe(j,D){return function(){let xe=j._readableState;xe.awaitDrainWriters===D?(v("pipeOnDrain",1),xe.awaitDrainWriters=null):xe.multiAwaitDrain&&(v("pipeOnDrain",xe.awaitDrainWriters.size),xe.awaitDrainWriters.delete(D)),(!xe.awaitDrainWriters||xe.awaitDrainWriters.size===0)&&j.listenerCount("data")&&j.resume()}}fe.prototype.unpipe=function(j){let D=this._readableState,xe={hasUnpiped:!1};if(D.pipes.length===0)return this;if(!j){let Be=D.pipes;D.pipes=[],this.pause();for(let ft=0;ft<Be.length;ft++)Be[ft].emit("unpipe",this,{hasUnpiped:!1});return this}let Ce=a(D.pipes,j);return Ce===-1?this:(D.pipes.splice(Ce,1),D.pipes.length===0&&this.pause(),j.emit("unpipe",this,xe),this)},fe.prototype.on=function(j,D){let xe=_.prototype.on.call(this,j,D),Ce=this._readableState;return j==="data"?(Ce.readableListening=this.listenerCount("readable")>0,Ce.flowing!==!1&&this.resume()):j==="readable"&&!Ce.endEmitted&&!Ce.readableListening&&(Ce.readableListening=Ce.needReadable=!0,Ce.flowing=!1,Ce.emittedReadable=!1,v("on readable",Ce.length,Ce.reading),Ce.length?z(this):Ce.reading||s.nextTick(Ne,this)),xe},fe.prototype.addListener=fe.prototype.on,fe.prototype.removeListener=function(j,D){let xe=_.prototype.removeListener.call(this,j,D);return j==="readable"&&s.nextTick(Me,this),xe},fe.prototype.off=fe.prototype.removeListener,fe.prototype.removeAllListeners=function(j){let D=_.prototype.removeAllListeners.apply(this,arguments);return(j==="readable"||j===void 0)&&s.nextTick(Me,this),D};function Me(j){let D=j._readableState;D.readableListening=j.listenerCount("readable")>0,D.resumeScheduled&&D[ee]===!1?D.flowing=!0:j.listenerCount("data")>0?j.resume():D.readableListening||(D.flowing=null)}function Ne(j){v("readable nexttick read 0"),j.read(0)}fe.prototype.resume=function(){let j=this._readableState;return j.flowing||(v("resume"),j.flowing=!j.readableListening,Fe(this,j)),j[ee]=!1,this};function Fe(j,D){D.resumeScheduled||(D.resumeScheduled=!0,s.nextTick(nt,j,D))}function nt(j,D){v("resume",D.reading),D.reading||j.read(0),D.resumeScheduled=!1,j.emit("resume"),rt(j),D.flowing&&!D.reading&&j.read(0)}fe.prototype.pause=function(){return v("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(v("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[ee]=!0,this};function rt(j){let D=j._readableState;for(v("flow",D.flowing);D.flowing&&j.read()!==null;);}fe.prototype.wrap=function(j){let D=!1;j.on("data",Ce=>{!this.push(Ce)&&j.pause&&(D=!0,j.pause())}),j.on("end",()=>{this.push(null)}),j.on("error",Ce=>{R(this,Ce)}),j.on("close",()=>{this.destroy()}),j.on("destroy",()=>{this.destroy()}),this._read=()=>{D&&j.resume&&(D=!1,j.resume())};let xe=e(j);for(let Ce=1;Ce<xe.length;Ce++){let Be=xe[Ce];this[Be]===void 0&&typeof j[Be]=="function"&&(this[Be]=j[Be].bind(j))}return this},fe.prototype[m]=function(){return Ke(this)},fe.prototype.iterator=function(j){return j!==void 0&&re(j,"options"),Ke(this,j)};function Ke(j,D){typeof j.read!="function"&&(j=fe.wrap(j,{objectMode:!0}));let xe=Xe(j,D);return xe.stream=j,xe}async function*Xe(j,D){let xe=oe;function Ce(mt){this===j?(xe(),xe=oe):xe=mt}j.on("readable",Ce);let Be,ft=E(j,{writable:!1},mt=>{Be=mt?k(Be,mt):null,xe(),xe=oe});try{for(;;){let mt=j.destroyed?null:j.read();if(mt!==null)yield mt;else{if(Be)throw Be;if(Be===null)return;await new c(Ce)}}}catch(mt){throw Be=k(Be,mt),Be}finally{(Be||(D==null?void 0:D.destroyOnReturn)!==!1)&&(Be===void 0||j._readableState.autoDestroy)?P.destroyer(j,null):(j.off("readable",Ce),ft())}}n(fe.prototype,{readable:{__proto__:null,get(){let j=this._readableState;return!!j&&j.readable!==!1&&!j.destroyed&&!j.errorEmitted&&!j.endEmitted},set(j){this._readableState&&(this._readableState.readable=!!j)}},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(j){this._readableState&&(this._readableState.flowing=j)}},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(j){this._readableState&&(this._readableState.destroyed=j)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),n(ke.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[ee]!==!1},set(j){this[ee]=!!j}}}),fe._fromList=De;function De(j,D){if(D.length===0)return null;let xe;return D.objectMode?xe=D.buffer.shift():!j||j>=D.length?(D.decoder?xe=D.buffer.join(""):D.buffer.length===1?xe=D.buffer.first():xe=D.buffer.concat(D.length),D.buffer.clear()):xe=D.buffer.consume(j,D.decoder),xe}function Ye(j){let D=j._readableState;v("endReadable",D.endEmitted),D.endEmitted||(D.ended=!0,s.nextTick(Ze,D,j))}function Ze(j,D){if(v("endReadableNT",j.endEmitted,j.length),!j.errored&&!j.closeEmitted&&!j.endEmitted&&j.length===0){if(j.endEmitted=!0,D.emit("end"),D.writable&&D.allowHalfOpen===!1)s.nextTick(lt,D);else if(j.autoDestroy){let xe=D._writableState;(!xe||xe.autoDestroy&&(xe.finished||xe.writable===!1))&&D.destroy()}}}function lt(j){j.writable&&!j.writableEnded&&!j.destroyed&&j.end()}fe.from=function(j,D){return G(fe,j,D)};var ct;function Et(){return ct===void 0&&(ct={}),ct}fe.fromWeb=function(j,D){return Et().newStreamReadableFromReadableStream(j,D)},fe.toWeb=function(j,D){return Et().newReadableStreamFromStreamReadable(j,D)},fe.wrap=function(j,D){var xe,Ce;return new fe({objectMode:(xe=(Ce=j.readableObjectMode)!==null&&Ce!==void 0?Ce:j.objectMode)!==null&&xe!==void 0?xe:!0,...D,destroy(Be,ft){P.destroyer(j,Be),ft(Be)}}).wrap(j)}}),Ti=_e((o,l)=>{de(),me(),ge();var s=Jt(),{ArrayPrototypeSlice:a,Error:u,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:t,ObjectDefineProperties:n,ObjectSetPrototypeOf:e,StringPrototypeToLowerCase:i,Symbol:c,SymbolHasInstance:h}=ut();l.exports=re,re.WritableState=L;var{EventEmitter:d}=(Qt(),tt(Ut)),m=ki().Stream,{Buffer:b}=(dt(),tt(pt)),w=sr(),{addAbortSignal:_}=Ir(),{getHighWaterMark:A,getDefaultHighWaterMark:g}=kr(),{ERR_INVALID_ARG_TYPE:S,ERR_METHOD_NOT_IMPLEMENTED:E,ERR_MULTIPLE_CALLBACK:v,ERR_STREAM_CANNOT_PIPE:C,ERR_STREAM_DESTROYED:P,ERR_STREAM_ALREADY_FINISHED:I,ERR_STREAM_NULL_VALUES:O,ERR_STREAM_WRITE_AFTER_END:k,ERR_UNKNOWN_ENCODING:M}=wt().codes,{errorOrDestroy:x}=w;e(re.prototype,m.prototype),e(re,m);function W(){}var $=c("kOnFinished");function L(B,Y,se){typeof se!="boolean"&&(se=Y instanceof Rt()),this.objectMode=!!(B&&B.objectMode),se&&(this.objectMode=this.objectMode||!!(B&&B.writableObjectMode)),this.highWaterMark=B?A(this,B,"writableHighWaterMark",se):g(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let ye=!!(B&&B.decodeStrings===!1);this.decodeStrings=!ye,this.defaultEncoding=B&&B.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=R.bind(void 0,Y),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,le(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!B||B.emitClose!==!1,this.autoDestroy=!B||B.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[$]=[]}function le(B){B.buffered=[],B.bufferedIndex=0,B.allBuffers=!0,B.allNoop=!0}L.prototype.getBuffer=function(){return a(this.buffered,this.bufferedIndex)},t(L.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function re(B){let Y=this instanceof Rt();if(!Y&&!r(re,this))return new re(B);this._writableState=new L(B,this,Y),B&&(typeof B.write=="function"&&(this._write=B.write),typeof B.writev=="function"&&(this._writev=B.writev),typeof B.destroy=="function"&&(this._destroy=B.destroy),typeof B.final=="function"&&(this._final=B.final),typeof B.construct=="function"&&(this._construct=B.construct),B.signal&&_(B.signal,this)),m.call(this,B),w.construct(this,()=>{let se=this._writableState;se.writing||Ee(this,se),H(this,se)})}t(re,h,{__proto__:null,value:function(B){return r(this,B)?!0:this!==re?!1:B&&B._writableState instanceof L}}),re.prototype.pipe=function(){x(this,new C)};function ee(B,Y,se,ye){let pe=B._writableState;if(typeof se=="function")ye=se,se=pe.defaultEncoding;else{if(!se)se=pe.defaultEncoding;else if(se!=="buffer"&&!b.isEncoding(se))throw new M(se);typeof ye!="function"&&(ye=W)}if(Y===null)throw new O;if(!pe.objectMode)if(typeof Y=="string")pe.decodeStrings!==!1&&(Y=b.from(Y,se),se="buffer");else if(Y instanceof b)se="buffer";else if(m._isUint8Array(Y))Y=m._uint8ArrayToBuffer(Y),se="buffer";else throw new S("chunk",["string","Buffer","Uint8Array"],Y);let Se;return pe.ending?Se=new k:pe.destroyed&&(Se=new P("write")),Se?(s.nextTick(ye,Se),x(B,Se,!0),Se):(pe.pendingcb++,ue(B,pe,Y,se,ye))}re.prototype.write=function(B,Y,se){return ee(this,B,Y,se)===!0},re.prototype.cork=function(){this._writableState.corked++},re.prototype.uncork=function(){let B=this._writableState;B.corked&&(B.corked--,B.writing||Ee(this,B))},re.prototype.setDefaultEncoding=function(B){if(typeof B=="string"&&(B=i(B)),!b.isEncoding(B))throw new M(B);return this._writableState.defaultEncoding=B,this};function ue(B,Y,se,ye,pe){let Se=Y.objectMode?1:se.length;Y.length+=Se;let Z=Y.length<Y.highWaterMark;return Z||(Y.needDrain=!0),Y.writing||Y.corked||Y.errored||!Y.constructed?(Y.buffered.push({chunk:se,encoding:ye,callback:pe}),Y.allBuffers&&ye!=="buffer"&&(Y.allBuffers=!1),Y.allNoop&&pe!==W&&(Y.allNoop=!1)):(Y.writelen=Se,Y.writecb=pe,Y.writing=!0,Y.sync=!0,B._write(se,ye,Y.onwrite),Y.sync=!1),Z&&!Y.errored&&!Y.destroyed}function G(B,Y,se,ye,pe,Se,Z){Y.writelen=ye,Y.writecb=Z,Y.writing=!0,Y.sync=!0,Y.destroyed?Y.onwrite(new P("write")):se?B._writev(pe,Y.onwrite):B._write(pe,Se,Y.onwrite),Y.sync=!1}function oe(B,Y,se,ye){--Y.pendingcb,ye(se),V(Y),x(B,se)}function R(B,Y){let se=B._writableState,ye=se.sync,pe=se.writecb;if(typeof pe!="function"){x(B,new v);return}se.writing=!1,se.writecb=null,se.length-=se.writelen,se.writelen=0,Y?(Y.stack,se.errored||(se.errored=Y),B._readableState&&!B._readableState.errored&&(B._readableState.errored=Y),ye?s.nextTick(oe,B,se,Y,pe):oe(B,se,Y,pe)):(se.buffered.length>se.bufferedIndex&&Ee(B,se),ye?se.afterWriteTickInfo!==null&&se.afterWriteTickInfo.cb===pe?se.afterWriteTickInfo.count++:(se.afterWriteTickInfo={count:1,cb:pe,stream:B,state:se},s.nextTick(Q,se.afterWriteTickInfo)):he(B,se,1,pe))}function Q({stream:B,state:Y,count:se,cb:ye}){return Y.afterWriteTickInfo=null,he(B,Y,se,ye)}function he(B,Y,se,ye){for(!Y.ending&&!B.destroyed&&Y.length===0&&Y.needDrain&&(Y.needDrain=!1,B.emit("drain"));se-- >0;)Y.pendingcb--,ye();Y.destroyed&&V(Y),H(B,Y)}function V(B){if(B.writing)return;for(let pe=B.bufferedIndex;pe<B.buffered.length;++pe){var Y;let{chunk:Se,callback:Z}=B.buffered[pe],we=B.objectMode?1:Se.length;B.length-=we,Z((Y=B.errored)!==null&&Y!==void 0?Y:new P("write"))}let se=B[$].splice(0);for(let pe=0;pe<se.length;pe++){var ye;se[pe]((ye=B.errored)!==null&&ye!==void 0?ye:new P("end"))}le(B)}function Ee(B,Y){if(Y.corked||Y.bufferProcessing||Y.destroyed||!Y.constructed)return;let{buffered:se,bufferedIndex:ye,objectMode:pe}=Y,Se=se.length-ye;if(!Se)return;let Z=ye;if(Y.bufferProcessing=!0,Se>1&&B._writev){Y.pendingcb-=Se-1;let we=Y.allNoop?W:fe=>{for(let Ue=Z;Ue<se.length;++Ue)se[Ue].callback(fe)},ke=Y.allNoop&&Z===0?se:a(se,Z);ke.allBuffers=Y.allBuffers,G(B,Y,!0,Y.length,ke,"",we),le(Y)}else{do{let{chunk:we,encoding:ke,callback:fe}=se[Z];se[Z++]=null;let Ue=pe?1:we.length;G(B,Y,!1,Ue,we,ke,fe)}while(Z<se.length&&!Y.writing);Z===se.length?le(Y):Z>256?(se.splice(0,Z),Y.bufferedIndex=0):Y.bufferedIndex=Z}Y.bufferProcessing=!1}re.prototype._write=function(B,Y,se){if(this._writev)this._writev([{chunk:B,encoding:Y}],se);else throw new E("_write()")},re.prototype._writev=null,re.prototype.end=function(B,Y,se){let ye=this._writableState;typeof B=="function"?(se=B,B=null,Y=null):typeof Y=="function"&&(se=Y,Y=null);let pe;if(B!=null){let Se=ee(this,B,Y);Se instanceof u&&(pe=Se)}return ye.corked&&(ye.corked=1,this.uncork()),pe||(!ye.errored&&!ye.ending?(ye.ending=!0,H(this,ye,!0),ye.ended=!0):ye.finished?pe=new I("end"):ye.destroyed&&(pe=new P("end"))),typeof se=="function"&&(pe||ye.finished?s.nextTick(se,pe):ye[$].push(se)),this};function X(B){return B.ending&&!B.destroyed&&B.constructed&&B.length===0&&!B.errored&&B.buffered.length===0&&!B.finished&&!B.writing&&!B.errorEmitted&&!B.closeEmitted}function U(B,Y){let se=!1;function ye(pe){if(se){x(B,pe??v());return}if(se=!0,Y.pendingcb--,pe){let Se=Y[$].splice(0);for(let Z=0;Z<Se.length;Z++)Se[Z](pe);x(B,pe,Y.sync)}else X(Y)&&(Y.prefinished=!0,B.emit("prefinish"),Y.pendingcb++,s.nextTick(te,B,Y))}Y.sync=!0,Y.pendingcb++;try{B._final(ye)}catch(pe){ye(pe)}Y.sync=!1}function ae(B,Y){!Y.prefinished&&!Y.finalCalled&&(typeof B._final=="function"&&!Y.destroyed?(Y.finalCalled=!0,U(B,Y)):(Y.prefinished=!0,B.emit("prefinish")))}function H(B,Y,se){X(Y)&&(ae(B,Y),Y.pendingcb===0&&(se?(Y.pendingcb++,s.nextTick((ye,pe)=>{X(pe)?te(ye,pe):pe.pendingcb--},B,Y)):X(Y)&&(Y.pendingcb++,te(B,Y))))}function te(B,Y){Y.pendingcb--,Y.finished=!0;let se=Y[$].splice(0);for(let ye=0;ye<se.length;ye++)se[ye]();if(B.emit("finish"),Y.autoDestroy){let ye=B._readableState;(!ye||ye.autoDestroy&&(ye.endEmitted||ye.readable===!1))&&B.destroy()}}n(re.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(B){this._writableState&&(this._writableState.destroyed=B)}},writable:{__proto__:null,get(){let B=this._writableState;return!!B&&B.writable!==!1&&!B.destroyed&&!B.errored&&!B.ending&&!B.ended},set(B){this._writableState&&(this._writableState.writable=!!B)}},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 B=this._writableState;return B?!B.destroyed&&!B.ending&&B.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 ne=w.destroy;re.prototype.destroy=function(B,Y){let se=this._writableState;return!se.destroyed&&(se.bufferedIndex<se.buffered.length||se[$].length)&&s.nextTick(V,se),ne.call(this,B,Y),this},re.prototype._undestroy=w.undestroy,re.prototype._destroy=function(B,Y){Y(B)},re.prototype[d.captureRejectionSymbol]=function(B){this.destroy(B)};var ve;function ce(){return ve===void 0&&(ve={}),ve}re.fromWeb=function(B,Y){return ce().newStreamWritableFromWritableStream(B,Y)},re.toWeb=function(B){return ce().newWritableStreamFromStreamWritable(B)}}),Wu=_e((o,l)=>{de(),me(),ge();var s=Jt(),a=(dt(),tt(pt)),{isReadable:u,isWritable:r,isIterable:t,isNodeStream:n,isReadableNodeStream:e,isWritableNodeStream:i,isDuplexNodeStream:c,isReadableStream:h,isWritableStream:d}=jt(),m=Ft(),{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:w,ERR_INVALID_RETURN_VALUE:_}}=wt(),{destroyer:A}=sr(),g=Rt(),S=Tr(),E=Ti(),{createDeferredPromise:v}=St(),C=vs(),P=globalThis.Blob||a.Blob,I=typeof P<"u"?function($){return $ instanceof P}:function($){return!1},O=globalThis.AbortController||mr().AbortController,{FunctionPrototypeCall:k}=ut(),M=class extends g{constructor($){super($),($==null?void 0:$.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),($==null?void 0:$.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};l.exports=function $(L,le){if(c(L))return L;if(e(L))return W({readable:L});if(i(L))return W({writable:L});if(n(L))return W({writable:!1,readable:!1});if(h(L))return W({readable:S.fromWeb(L)});if(d(L))return W({writable:E.fromWeb(L)});if(typeof L=="function"){let{value:ee,write:ue,final:G,destroy:oe}=x(L);if(t(ee))return C(M,ee,{objectMode:!0,write:ue,final:G,destroy:oe});let R=ee==null?void 0:ee.then;if(typeof R=="function"){let Q,he=k(R,ee,V=>{if(V!=null)throw new _("nully","body",V)},V=>{A(Q,V)});return Q=new M({objectMode:!0,readable:!1,write:ue,final(V){G(async()=>{try{await he,s.nextTick(V,null)}catch(Ee){s.nextTick(V,Ee)}})},destroy:oe})}throw new _("Iterable, AsyncIterable or AsyncFunction",le,ee)}if(I(L))return $(L.arrayBuffer());if(t(L))return C(M,L,{objectMode:!0,writable:!1});if(h(L==null?void 0:L.readable)&&d(L==null?void 0:L.writable))return M.fromWeb(L);if(typeof(L==null?void 0:L.writable)=="object"||typeof(L==null?void 0:L.readable)=="object"){let ee=L!=null&&L.readable?e(L==null?void 0:L.readable)?L==null?void 0:L.readable:$(L.readable):void 0,ue=L!=null&&L.writable?i(L==null?void 0:L.writable)?L==null?void 0:L.writable:$(L.writable):void 0;return W({readable:ee,writable:ue})}let re=L==null?void 0:L.then;if(typeof re=="function"){let ee;return k(re,L,ue=>{ue!=null&&ee.push(ue),ee.push(null)},ue=>{A(ee,ue)}),ee=new M({objectMode:!0,writable:!1,read(){}})}throw new w(le,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],L)};function x($){let{promise:L,resolve:le}=v(),re=new O,ee=re.signal;return{value:$(async function*(){for(;;){let ue=L;L=null;let{chunk:G,done:oe,cb:R}=await ue;if(s.nextTick(R),oe)return;if(ee.aborted)throw new b(void 0,{cause:ee.reason});({promise:L,resolve:le}=v()),yield G}}(),{signal:ee}),write(ue,G,oe){let R=le;le=null,R({chunk:ue,done:!1,cb:oe})},final(ue){let G=le;le=null,G({done:!0,cb:ue})},destroy(ue,G){re.abort(),G(ue)}}}function W($){let L=$.readable&&typeof $.readable.read!="function"?S.wrap($.readable):$.readable,le=$.writable,re=!!u(L),ee=!!r(le),ue,G,oe,R,Q;function he(V){let Ee=R;R=null,Ee?Ee(V):V&&Q.destroy(V)}return Q=new M({readableObjectMode:!!(L!=null&&L.readableObjectMode),writableObjectMode:!!(le!=null&&le.writableObjectMode),readable:re,writable:ee}),ee&&(m(le,V=>{ee=!1,V&&A(L,V),he(V)}),Q._write=function(V,Ee,X){le.write(V,Ee)?X():ue=X},Q._final=function(V){le.end(),G=V},le.on("drain",function(){if(ue){let V=ue;ue=null,V()}}),le.on("finish",function(){if(G){let V=G;G=null,V()}})),re&&(m(L,V=>{re=!1,V&&A(L,V),he(V)}),L.on("readable",function(){if(oe){let V=oe;oe=null,V()}}),L.on("end",function(){Q.push(null)}),Q._read=function(){for(;;){let V=L.read();if(V===null){oe=Q._read;return}if(!Q.push(V))return}}),Q._destroy=function(V,Ee){!V&&R!==null&&(V=new b),oe=null,ue=null,G=null,R===null?Ee(V):(R=Ee,A(le,V),A(L,V))},Q}}),Rt=_e((o,l)=>{de(),me(),ge();var{ObjectDefineProperties:s,ObjectGetOwnPropertyDescriptor:a,ObjectKeys:u,ObjectSetPrototypeOf:r}=ut();l.exports=e;var t=Tr(),n=Ti();r(e.prototype,t.prototype),r(e,t);{let d=u(n.prototype);for(let m=0;m<d.length;m++){let b=d[m];e.prototype[b]||(e.prototype[b]=n.prototype[b])}}function e(d){if(!(this instanceof e))return new e(d);t.call(this,d),n.call(this,d),d?(this.allowHalfOpen=d.allowHalfOpen!==!1,d.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),d.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}s(e.prototype,{writable:{__proto__:null,...a(n.prototype,"writable")},writableHighWaterMark:{__proto__:null,...a(n.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...a(n.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...a(n.prototype,"writableBuffer")},writableLength:{__proto__:null,...a(n.prototype,"writableLength")},writableFinished:{__proto__:null,...a(n.prototype,"writableFinished")},writableCorked:{__proto__:null,...a(n.prototype,"writableCorked")},writableEnded:{__proto__:null,...a(n.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...a(n.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(d){this._readableState&&this._writableState&&(this._readableState.destroyed=d,this._writableState.destroyed=d)}}});var i;function c(){return i===void 0&&(i={}),i}e.fromWeb=function(d,m){return c().newStreamDuplexFromReadableWritablePair(d,m)},e.toWeb=function(d){return c().newReadableWritablePairFromDuplex(d)};var h;e.from=function(d){return h||(h=Wu()),h(d,"body")}}),ws=_e((o,l)=>{de(),me(),ge();var{ObjectSetPrototypeOf:s,Symbol:a}=ut();l.exports=e;var{ERR_METHOD_NOT_IMPLEMENTED:u}=wt().codes,r=Rt(),{getHighWaterMark:t}=kr();s(e.prototype,r.prototype),s(e,r);var n=a("kCallback");function e(h){if(!(this instanceof e))return new e(h);let d=h?t(this,h,"readableHighWaterMark",!0):null;d===0&&(h={...h,highWaterMark:null,readableHighWaterMark:d,writableHighWaterMark:h.writableHighWaterMark||0}),r.call(this,h),this._readableState.sync=!1,this[n]=null,h&&(typeof h.transform=="function"&&(this._transform=h.transform),typeof h.flush=="function"&&(this._flush=h.flush)),this.on("prefinish",c)}function i(h){typeof this._flush=="function"&&!this.destroyed?this._flush((d,m)=>{if(d){h?h(d):this.destroy(d);return}m!=null&&this.push(m),this.push(null),h&&h()}):(this.push(null),h&&h())}function c(){this._final!==i&&i.call(this)}e.prototype._final=i,e.prototype._transform=function(h,d,m){throw new u("_transform()")},e.prototype._write=function(h,d,m){let b=this._readableState,w=this._writableState,_=b.length;this._transform(h,d,(A,g)=>{if(A){m(A);return}g!=null&&this.push(g),w.ended||_===b.length||b.length<b.highWaterMark?m():this[n]=m})},e.prototype._read=function(){if(this[n]){let h=this[n];this[n]=null,h()}}}),_s=_e((o,l)=>{de(),me(),ge();var{ObjectSetPrototypeOf:s}=ut();l.exports=u;var a=ws();s(u.prototype,a.prototype),s(u,a);function u(r){if(!(this instanceof u))return new u(r);a.call(this,r)}u.prototype._transform=function(r,t,n){n(null,r)}}),Oi=_e((o,l)=>{de(),me(),ge();var s=Jt(),{ArrayIsArray:a,Promise:u,SymbolAsyncIterator:r,SymbolDispose:t}=ut(),n=Ft(),{once:e}=St(),i=sr(),c=Rt(),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:d,ERR_INVALID_RETURN_VALUE:m,ERR_MISSING_ARGS:b,ERR_STREAM_DESTROYED:w,ERR_STREAM_PREMATURE_CLOSE:_},AbortError:A}=wt(),{validateFunction:g,validateAbortSignal:S}=br(),{isIterable:E,isReadable:v,isReadableNodeStream:C,isNodeStream:P,isTransformStream:I,isWebStream:O,isReadableStream:k,isReadableFinished:M}=jt(),x=globalThis.AbortController||mr().AbortController,W,$,L;function le(V,Ee,X){let U=!1;V.on("close",()=>{U=!0});let ae=n(V,{readable:Ee,writable:X},H=>{U=!H});return{destroy:H=>{U||(U=!0,i.destroyer(V,H||new w("pipe")))},cleanup:ae}}function re(V){return g(V[V.length-1],"streams[stream.length - 1]"),V.pop()}function ee(V){if(E(V))return V;if(C(V))return ue(V);throw new d("val",["Readable","Iterable","AsyncIterable"],V)}async function*ue(V){$||($=Tr()),yield*$.prototype[r].call(V)}async function G(V,Ee,X,{end:U}){let ae,H=null,te=ce=>{if(ce&&(ae=ce),H){let B=H;H=null,B()}},ne=()=>new u((ce,B)=>{ae?B(ae):H=()=>{ae?B(ae):ce()}});Ee.on("drain",te);let ve=n(Ee,{readable:!1},te);try{Ee.writableNeedDrain&&await ne();for await(let ce of V)Ee.write(ce)||await ne();U&&(Ee.end(),await ne()),X()}catch(ce){X(ae!==ce?h(ae,ce):ce)}finally{ve(),Ee.off("drain",te)}}async function oe(V,Ee,X,{end:U}){I(Ee)&&(Ee=Ee.writable);let ae=Ee.getWriter();try{for await(let H of V)await ae.ready,ae.write(H).catch(()=>{});await ae.ready,U&&await ae.close(),X()}catch(H){try{await ae.abort(H),X(H)}catch(te){X(te)}}}function R(...V){return Q(V,e(re(V)))}function Q(V,Ee,X){if(V.length===1&&a(V[0])&&(V=V[0]),V.length<2)throw new b("streams");let U=new x,ae=U.signal,H=X==null?void 0:X.signal,te=[];S(H,"options.signal");function ne(){pe(new A)}L=L||St().addAbortListener;let ve;H&&(ve=L(H,ne));let ce,B,Y=[],se=0;function ye(ke){pe(ke,--se===0)}function pe(ke,fe){var Ue;if(ke&&(!ce||ce.code==="ERR_STREAM_PREMATURE_CLOSE")&&(ce=ke),!(!ce&&!fe)){for(;Y.length;)Y.shift()(ce);(Ue=ve)===null||Ue===void 0||Ue[t](),U.abort(),fe&&(ce||te.forEach(f=>f()),s.nextTick(Ee,ce,B))}}let Se;for(let ke=0;ke<V.length;ke++){let fe=V[ke],Ue=ke<V.length-1,f=ke>0,p=Ue||(X==null?void 0:X.end)!==!1,y=ke===V.length-1;if(P(fe)){let T=function(N){N&&N.name!=="AbortError"&&N.code!=="ERR_STREAM_PREMATURE_CLOSE"&&ye(N)};if(p){let{destroy:N,cleanup:z}=le(fe,Ue,f);Y.push(N),v(fe)&&y&&te.push(z)}fe.on("error",T),v(fe)&&y&&te.push(()=>{fe.removeListener("error",T)})}if(ke===0)if(typeof fe=="function"){if(Se=fe({signal:ae}),!E(Se))throw new m("Iterable, AsyncIterable or Stream","source",Se)}else E(fe)||C(fe)||I(fe)?Se=fe:Se=c.from(fe);else if(typeof fe=="function"){if(I(Se)){var Z;Se=ee((Z=Se)===null||Z===void 0?void 0:Z.readable)}else Se=ee(Se);if(Se=fe(Se,{signal:ae}),Ue){if(!E(Se,!0))throw new m("AsyncIterable",`transform[${ke-1}]`,Se)}else{var we;W||(W=_s());let T=new W({objectMode:!0}),N=(we=Se)===null||we===void 0?void 0:we.then;if(typeof N=="function")se++,N.call(Se,q=>{B=q,q!=null&&T.write(q),p&&T.end(),s.nextTick(ye)},q=>{T.destroy(q),s.nextTick(ye,q)});else if(E(Se,!0))se++,G(Se,T,ye,{end:p});else if(k(Se)||I(Se)){let q=Se.readable||Se;se++,G(q,T,ye,{end:p})}else throw new m("AsyncIterable or Promise","destination",Se);Se=T;let{destroy:z,cleanup:ie}=le(Se,!1,!0);Y.push(z),y&&te.push(ie)}}else if(P(fe)){if(C(Se)){se+=2;let T=he(Se,fe,ye,{end:p});v(fe)&&y&&te.push(T)}else if(I(Se)||k(Se)){let T=Se.readable||Se;se++,G(T,fe,ye,{end:p})}else if(E(Se))se++,G(Se,fe,ye,{end:p});else throw new d("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Se);Se=fe}else if(O(fe)){if(C(Se))se++,oe(ee(Se),fe,ye,{end:p});else if(k(Se)||E(Se))se++,oe(Se,fe,ye,{end:p});else if(I(Se))se++,oe(Se.readable,fe,ye,{end:p});else throw new d("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Se);Se=fe}else Se=c.from(fe)}return(ae!=null&&ae.aborted||H!=null&&H.aborted)&&s.nextTick(ne),Se}function he(V,Ee,X,{end:U}){let ae=!1;if(Ee.on("close",()=>{ae||X(new _)}),V.pipe(Ee,{end:!1}),U){let H=function(){ae=!0,Ee.end()};M(V)?s.nextTick(H):V.once("end",H)}else X();return n(V,{readable:!0,writable:!1},H=>{let te=V._readableState;H&&H.code==="ERR_STREAM_PREMATURE_CLOSE"&&te&&te.ended&&!te.errored&&!te.errorEmitted?V.once("end",X).once("error",X):X(H)}),n(Ee,{readable:!1,writable:!0},X)}l.exports={pipelineImpl:Q,pipeline:R}}),Ss=_e((o,l)=>{de(),me(),ge();var{pipeline:s}=Oi(),a=Rt(),{destroyer:u}=sr(),{isNodeStream:r,isReadable:t,isWritable:n,isWebStream:e,isTransformStream:i,isWritableStream:c,isReadableStream:h}=jt(),{AbortError:d,codes:{ERR_INVALID_ARG_VALUE:m,ERR_MISSING_ARGS:b}}=wt(),w=Ft();l.exports=function(..._){if(_.length===0)throw new b("streams");if(_.length===1)return a.from(_[0]);let A=[..._];if(typeof _[0]=="function"&&(_[0]=a.from(_[0])),typeof _[_.length-1]=="function"){let x=_.length-1;_[x]=a.from(_[x])}for(let x=0;x<_.length;++x)if(!(!r(_[x])&&!e(_[x]))){if(x<_.length-1&&!(t(_[x])||h(_[x])||i(_[x])))throw new m(`streams[${x}]`,A[x],"must be readable");if(x>0&&!(n(_[x])||c(_[x])||i(_[x])))throw new m(`streams[${x}]`,A[x],"must be writable")}let g,S,E,v,C;function P(x){let W=v;v=null,W?W(x):x?C.destroy(x):!M&&!k&&C.destroy()}let I=_[0],O=s(_,P),k=!!(n(I)||c(I)||i(I)),M=!!(t(O)||h(O)||i(O));if(C=new a({writableObjectMode:!!(I!=null&&I.writableObjectMode),readableObjectMode:!!(O!=null&&O.readableObjectMode),writable:k,readable:M}),k){if(r(I))C._write=function(W,$,L){I.write(W,$)?L():g=L},C._final=function(W){I.end(),S=W},I.on("drain",function(){if(g){let W=g;g=null,W()}});else if(e(I)){let W=(i(I)?I.writable:I).getWriter();C._write=async function($,L,le){try{await W.ready,W.write($).catch(()=>{}),le()}catch(re){le(re)}},C._final=async function($){try{await W.ready,W.close().catch(()=>{}),S=$}catch(L){$(L)}}}let x=i(O)?O.readable:O;w(x,()=>{if(S){let W=S;S=null,W()}})}if(M){if(r(O))O.on("readable",function(){if(E){let x=E;E=null,x()}}),O.on("end",function(){C.push(null)}),C._read=function(){for(;;){let x=O.read();if(x===null){E=C._read;return}if(!C.push(x))return}};else if(e(O)){let x=(i(O)?O.readable:O).getReader();C._read=async function(){for(;;)try{let{value:W,done:$}=await x.read();if(!C.push(W))return;if($){C.push(null);return}}catch{return}}}}return C._destroy=function(x,W){!x&&v!==null&&(x=new d),E=null,g=null,S=null,v===null?W(x):(v=W,r(O)&&u(O,x))},C}}),$u=_e((o,l)=>{de(),me(),ge();var s=globalThis.AbortController||mr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:a,ERR_INVALID_ARG_TYPE:u,ERR_MISSING_ARGS:r,ERR_OUT_OF_RANGE:t},AbortError:n}=wt(),{validateAbortSignal:e,validateInteger:i,validateObject:c}=br(),h=ut().Symbol("kWeak"),d=ut().Symbol("kResistStopPropagation"),{finished:m}=Ft(),b=Ss(),{addAbortSignalNoValidate:w}=Ir(),{isWritable:_,isNodeStream:A}=jt(),{deprecate:g}=St(),{ArrayPrototypePush:S,Boolean:E,MathFloor:v,Number:C,NumberIsNaN:P,Promise:I,PromiseReject:O,PromiseResolve:k,PromisePrototypeThen:M,Symbol:x}=ut(),W=x("kEmpty"),$=x("kEof");function L(H,te){if(te!=null&&c(te,"options"),(te==null?void 0:te.signal)!=null&&e(te.signal,"options.signal"),A(H)&&!_(H))throw new a("stream",H,"must be writable");let ne=b(this,H);return te!=null&&te.signal&&w(te.signal,ne),ne}function le(H,te){if(typeof H!="function")throw new u("fn",["Function","AsyncFunction"],H);te!=null&&c(te,"options"),(te==null?void 0:te.signal)!=null&&e(te.signal,"options.signal");let ne=1;(te==null?void 0:te.concurrency)!=null&&(ne=v(te.concurrency));let ve=ne-1;return(te==null?void 0:te.highWaterMark)!=null&&(ve=v(te.highWaterMark)),i(ne,"options.concurrency",1),i(ve,"options.highWaterMark",0),ve+=ne,(async function*(){let ce=St().AbortSignalAny([te==null?void 0:te.signal].filter(E)),B=this,Y=[],se={signal:ce},ye,pe,Se=!1,Z=0;function we(){Se=!0,ke()}function ke(){Z-=1,fe()}function fe(){pe&&!Se&&Z<ne&&Y.length<ve&&(pe(),pe=null)}async function Ue(){try{for await(let f of B){if(Se)return;if(ce.aborted)throw new n;try{if(f=H(f,se),f===W)continue;f=k(f)}catch(p){f=O(p)}Z+=1,M(f,ke,we),Y.push(f),ye&&(ye(),ye=null),!Se&&(Y.length>=ve||Z>=ne)&&await new I(p=>{pe=p})}Y.push($)}catch(f){let p=O(f);M(p,ke,we),Y.push(p)}finally{Se=!0,ye&&(ye(),ye=null)}}Ue();try{for(;;){for(;Y.length>0;){let f=await Y[0];if(f===$)return;if(ce.aborted)throw new n;f!==W&&(yield f),Y.shift(),fe()}await new I(f=>{ye=f})}}finally{Se=!0,pe&&(pe(),pe=null)}}).call(this)}function re(H=void 0){return H!=null&&c(H,"options"),(H==null?void 0:H.signal)!=null&&e(H.signal,"options.signal"),(async function*(){let te=0;for await(let ve of this){var ne;if(H!=null&&(ne=H.signal)!==null&&ne!==void 0&&ne.aborted)throw new n({cause:H.signal.reason});yield[te++,ve]}}).call(this)}async function ee(H,te=void 0){for await(let ne of R.call(this,H,te))return!0;return!1}async function ue(H,te=void 0){if(typeof H!="function")throw new u("fn",["Function","AsyncFunction"],H);return!await ee.call(this,async(...ne)=>!await H(...ne),te)}async function G(H,te){for await(let ne of R.call(this,H,te))return ne}async function oe(H,te){if(typeof H!="function")throw new u("fn",["Function","AsyncFunction"],H);async function ne(ve,ce){return await H(ve,ce),W}for await(let ve of le.call(this,ne,te));}function R(H,te){if(typeof H!="function")throw new u("fn",["Function","AsyncFunction"],H);async function ne(ve,ce){return await H(ve,ce)?ve:W}return le.call(this,ne,te)}var Q=class extends r{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function he(H,te,ne){var ve;if(typeof H!="function")throw new u("reducer",["Function","AsyncFunction"],H);ne!=null&&c(ne,"options"),(ne==null?void 0:ne.signal)!=null&&e(ne.signal,"options.signal");let ce=arguments.length>1;if(ne!=null&&(ve=ne.signal)!==null&&ve!==void 0&&ve.aborted){let pe=new n(void 0,{cause:ne.signal.reason});throw this.once("error",()=>{}),await m(this.destroy(pe)),pe}let B=new s,Y=B.signal;if(ne!=null&&ne.signal){let pe={once:!0,[h]:this,[d]:!0};ne.signal.addEventListener("abort",()=>B.abort(),pe)}let se=!1;try{for await(let pe of this){var ye;if(se=!0,ne!=null&&(ye=ne.signal)!==null&&ye!==void 0&&ye.aborted)throw new n;ce?te=await H(te,pe,{signal:Y}):(te=pe,ce=!0)}if(!se&&!ce)throw new Q}finally{B.abort()}return te}async function V(H){H!=null&&c(H,"options"),(H==null?void 0:H.signal)!=null&&e(H.signal,"options.signal");let te=[];for await(let ve of this){var ne;if(H!=null&&(ne=H.signal)!==null&&ne!==void 0&&ne.aborted)throw new n(void 0,{cause:H.signal.reason});S(te,ve)}return te}function Ee(H,te){let ne=le.call(this,H,te);return(async function*(){for await(let ve of ne)yield*ve}).call(this)}function X(H){if(H=C(H),P(H))return 0;if(H<0)throw new t("number",">= 0",H);return H}function U(H,te=void 0){return te!=null&&c(te,"options"),(te==null?void 0:te.signal)!=null&&e(te.signal,"options.signal"),H=X(H),(async function*(){var ne;if(te!=null&&(ne=te.signal)!==null&&ne!==void 0&&ne.aborted)throw new n;for await(let ce of this){var ve;if(te!=null&&(ve=te.signal)!==null&&ve!==void 0&&ve.aborted)throw new n;H--<=0&&(yield ce)}}).call(this)}function ae(H,te=void 0){return te!=null&&c(te,"options"),(te==null?void 0:te.signal)!=null&&e(te.signal,"options.signal"),H=X(H),(async function*(){var ne;if(te!=null&&(ne=te.signal)!==null&&ne!==void 0&&ne.aborted)throw new n;for await(let ce of this){var ve;if(te!=null&&(ve=te.signal)!==null&&ve!==void 0&&ve.aborted)throw new n;if(H-- >0&&(yield ce),H<=0)return}}).call(this)}l.exports.streamReturningOperators={asIndexedPairs:g(re,"readable.asIndexedPairs will be removed in a future version."),drop:U,filter:R,flatMap:Ee,map:le,take:ae,compose:L},l.exports.promiseReturningOperators={every:ue,forEach:oe,reduce:he,toArray:V,some:ee,find:G}}),Es=_e((o,l)=>{de(),me(),ge();var{ArrayPrototypePop:s,Promise:a}=ut(),{isIterable:u,isNodeStream:r,isWebStream:t}=jt(),{pipelineImpl:n}=Oi(),{finished:e}=Ft();As();function i(...c){return new a((h,d)=>{let m,b,w=c[c.length-1];if(w&&typeof w=="object"&&!r(w)&&!u(w)&&!t(w)){let _=s(c);m=_.signal,b=_.end}n(c,(_,A)=>{_?d(_):h(A)},{signal:m,end:b})})}l.exports={finished:e,pipeline:i}}),As=_e((o,l)=>{de(),me(),ge();var{Buffer:s}=(dt(),tt(pt)),{ObjectDefineProperty:a,ObjectKeys:u,ReflectApply:r}=ut(),{promisify:{custom:t}}=St(),{streamReturningOperators:n,promiseReturningOperators:e}=$u(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:i}}=wt(),c=Ss(),{setDefaultHighWaterMark:h,getDefaultHighWaterMark:d}=kr(),{pipeline:m}=Oi(),{destroyer:b}=sr(),w=Ft(),_=Es(),A=jt(),g=l.exports=ki().Stream;g.isDestroyed=A.isDestroyed,g.isDisturbed=A.isDisturbed,g.isErrored=A.isErrored,g.isReadable=A.isReadable,g.isWritable=A.isWritable,g.Readable=Tr();for(let E of u(n)){let v=function(...P){if(new.target)throw i();return g.Readable.from(r(C,this,P))},C=n[E];a(v,"name",{__proto__:null,value:C.name}),a(v,"length",{__proto__:null,value:C.length}),a(g.Readable.prototype,E,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}for(let E of u(e)){let v=function(...P){if(new.target)throw i();return r(C,this,P)},C=e[E];a(v,"name",{__proto__:null,value:C.name}),a(v,"length",{__proto__:null,value:C.length}),a(g.Readable.prototype,E,{__proto__:null,value:v,enumerable:!1,configurable:!0,writable:!0})}g.Writable=Ti(),g.Duplex=Rt(),g.Transform=ws(),g.PassThrough=_s(),g.pipeline=m;var{addAbortSignal:S}=Ir();g.addAbortSignal=S,g.finished=w,g.destroy=b,g.compose=c,g.setDefaultHighWaterMark=h,g.getDefaultHighWaterMark=d,a(g,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),a(m,t,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),a(w,t,{__proto__:null,enumerable:!0,get(){return _.finished}}),g.Stream=g,g._isUint8Array=function(E){return E instanceof Uint8Array},g._uint8ArrayToBuffer=function(E){return s.from(E.buffer,E.byteOffset,E.byteLength)}}),Xt=_e((o,l)=>{de(),me(),ge();var s=As(),a=Es(),u=s.Readable.destroy;l.exports=s.Readable,l.exports._uint8ArrayToBuffer=s._uint8ArrayToBuffer,l.exports._isUint8Array=s._isUint8Array,l.exports.isDisturbed=s.isDisturbed,l.exports.isErrored=s.isErrored,l.exports.isReadable=s.isReadable,l.exports.Readable=s.Readable,l.exports.Writable=s.Writable,l.exports.Duplex=s.Duplex,l.exports.Transform=s.Transform,l.exports.PassThrough=s.PassThrough,l.exports.addAbortSignal=s.addAbortSignal,l.exports.finished=s.finished,l.exports.destroy=s.destroy,l.exports.destroy=u,l.exports.pipeline=s.pipeline,l.exports.compose=s.compose,Object.defineProperty(s,"promises",{configurable:!0,enumerable:!0,get(){return a}}),l.exports.Stream=s.Stream,l.exports.default=l.exports}),qu=_e((o,l)=>{de(),me(),ge(),typeof Object.create=="function"?l.exports=function(s,a){a&&(s.super_=a,s.prototype=Object.create(a.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}))}:l.exports=function(s,a){if(a){s.super_=a;var u=function(){};u.prototype=a.prototype,s.prototype=new u,s.prototype.constructor=s}}}),Vu=_e((o,l)=>{de(),me(),ge();var{Buffer:s}=(dt(),tt(pt)),a=Symbol.for("BufferList");function u(r){if(!(this instanceof u))return new u(r);u._init.call(this,r)}u._init=function(r){Object.defineProperty(this,a,{value:!0}),this._bufs=[],this.length=0,r&&this.append(r)},u.prototype._new=function(r){return new u(r)},u.prototype._offset=function(r){if(r===0)return[0,0];let t=0;for(let n=0;n<this._bufs.length;n++){let e=t+this._bufs[n].length;if(r<e||n===this._bufs.length-1)return[n,r-t];t=e}},u.prototype._reverseOffset=function(r){let t=r[0],n=r[1];for(let e=0;e<t;e++)n+=this._bufs[e].length;return n},u.prototype.getBuffers=function(){return this._bufs},u.prototype.get=function(r){if(r>this.length||r<0)return;let t=this._offset(r);return this._bufs[t[0]][t[1]]},u.prototype.slice=function(r,t){return typeof r=="number"&&r<0&&(r+=this.length),typeof t=="number"&&t<0&&(t+=this.length),this.copy(null,0,r,t)},u.prototype.copy=function(r,t,n,e){if((typeof n!="number"||n<0)&&(n=0),(typeof e!="number"||e>this.length)&&(e=this.length),n>=this.length||e<=0)return r||s.alloc(0);let i=!!r,c=this._offset(n),h=e-n,d=h,m=i&&t||0,b=c[1];if(n===0&&e===this.length){if(!i)return this._bufs.length===1?this._bufs[0]:s.concat(this._bufs,this.length);for(let w=0;w<this._bufs.length;w++)this._bufs[w].copy(r,m),m+=this._bufs[w].length;return r}if(d<=this._bufs[c[0]].length-b)return i?this._bufs[c[0]].copy(r,t,b,b+d):this._bufs[c[0]].slice(b,b+d);i||(r=s.allocUnsafe(h));for(let w=c[0];w<this._bufs.length;w++){let _=this._bufs[w].length-b;if(d>_)this._bufs[w].copy(r,m,b),m+=_;else{this._bufs[w].copy(r,m,b,b+d),m+=_;break}d-=_,b&&(b=0)}return r.length>m?r.slice(0,m):r},u.prototype.shallowSlice=function(r,t){if(r=r||0,t=typeof t!="number"?this.length:t,r<0&&(r+=this.length),t<0&&(t+=this.length),r===t)return this._new();let n=this._offset(r),e=this._offset(t),i=this._bufs.slice(n[0],e[0]+1);return e[1]===0?i.pop():i[i.length-1]=i[i.length-1].slice(0,e[1]),n[1]!==0&&(i[0]=i[0].slice(n[1])),this._new(i)},u.prototype.toString=function(r,t,n){return this.slice(t,n).toString(r)},u.prototype.consume=function(r){if(r=Math.trunc(r),Number.isNaN(r)||r<=0)return this;for(;this._bufs.length;)if(r>=this._bufs[0].length)r-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(r),this.length-=r;break}return this},u.prototype.duplicate=function(){let r=this._new();for(let t=0;t<this._bufs.length;t++)r.append(this._bufs[t]);return r},u.prototype.append=function(r){return this._attach(r,u.prototype._appendBuffer)},u.prototype.prepend=function(r){return this._attach(r,u.prototype._prependBuffer,!0)},u.prototype._attach=function(r,t,n){if(r==null)return this;if(r.buffer)t.call(this,s.from(r.buffer,r.byteOffset,r.byteLength));else if(Array.isArray(r)){let[e,i]=n?[r.length-1,-1]:[0,1];for(let c=e;c>=0&&c<r.length;c+=i)this._attach(r[c],t,n)}else if(this._isBufferList(r)){let[e,i]=n?[r._bufs.length-1,-1]:[0,1];for(let c=e;c>=0&&c<r._bufs.length;c+=i)this._attach(r._bufs[c],t,n)}else typeof r=="number"&&(r=r.toString()),t.call(this,s.from(r));return this},u.prototype._appendBuffer=function(r){this._bufs.push(r),this.length+=r.length},u.prototype._prependBuffer=function(r){this._bufs.unshift(r),this.length+=r.length},u.prototype.indexOf=function(r,t,n){if(n===void 0&&typeof t=="string"&&(n=t,t=void 0),typeof r=="function"||Array.isArray(r))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof r=="number"?r=s.from([r]):typeof r=="string"?r=s.from(r,n):this._isBufferList(r)?r=r.slice():Array.isArray(r.buffer)?r=s.from(r.buffer,r.byteOffset,r.byteLength):s.isBuffer(r)||(r=s.from(r)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),r.length===0)return t>this.length?this.length:t;let e=this._offset(t),i=e[0],c=e[1];for(;i<this._bufs.length;i++){let h=this._bufs[i];for(;c<h.length;)if(h.length-c>=r.length){let d=h.indexOf(r,c);if(d!==-1)return this._reverseOffset([i,d]);c=h.length-r.length+1}else{let d=this._reverseOffset([i,c]);if(this._match(d,r))return d;c++}c=0}return-1},u.prototype._match=function(r,t){if(this.length-r<t.length)return!1;for(let n=0;n<t.length;n++)if(this.get(r+n)!==t[n])return!1;return!0},function(){let r={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 t in r)(function(n){r[n]===null?u.prototype[n]=function(e,i){return this.slice(e,e+i)[n](0,i)}:u.prototype[n]=function(e=0){return this.slice(e,e+r[n])[n](0)}})(t)}(),u.prototype._isBufferList=function(r){return r instanceof u||u.isBufferList(r)},u.isBufferList=function(r){return r!=null&&r[a]},l.exports=u}),zu=_e((o,l)=>{de(),me(),ge();var s=Xt().Duplex,a=qu(),u=Vu();function r(t){if(!(this instanceof r))return new r(t);if(typeof t=="function"){this._callback=t;let n=(function(e){this._callback&&(this._callback(e),this._callback=null)}).bind(this);this.on("pipe",function(e){e.on("error",n)}),this.on("unpipe",function(e){e.removeListener("error",n)}),t=null}u._init.call(this,t),s.call(this)}a(r,s),Object.assign(r.prototype,u.prototype),r.prototype._new=function(t){return new r(t)},r.prototype._write=function(t,n,e){this._appendBuffer(t),typeof e=="function"&&e()},r.prototype._read=function(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)},r.prototype.end=function(t){s.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},r.prototype._destroy=function(t,n){this._bufs.length=0,this.length=0,n(t)},r.prototype._isBufferList=function(t){return t instanceof r||t instanceof u||r.isBufferList(t)},r.isBufferList=u.isBufferList,l.exports=r,l.exports.BufferListStream=r,l.exports.BufferList=u}),Ku=_e((o,l)=>{de(),me(),ge();var s=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};l.exports=s}),xs=_e((o,l)=>{de(),me(),ge();var s=l.exports,{Buffer:a}=(dt(),tt(pt));s.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"},s.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},s.requiredHeaderFlagsErrors={};for(let r in s.requiredHeaderFlags){let t=s.requiredHeaderFlags[r];s.requiredHeaderFlagsErrors[r]="Invalid header flag bits, must be 0x"+t.toString(16)+" for "+s.types[r]+" packet"}s.codes={};for(let r in s.types){let t=s.types[r];s.codes[t]=r}s.CMD_SHIFT=4,s.CMD_MASK=240,s.DUP_MASK=8,s.QOS_MASK=3,s.QOS_SHIFT=1,s.RETAIN_MASK=1,s.VARBYTEINT_MASK=127,s.VARBYTEINT_FIN_MASK=128,s.VARBYTEINT_MAX=268435455,s.SESSIONPRESENT_MASK=1,s.SESSIONPRESENT_HEADER=a.from([s.SESSIONPRESENT_MASK]),s.CONNACK_HEADER=a.from([s.codes.connack<<s.CMD_SHIFT]),s.USERNAME_MASK=128,s.PASSWORD_MASK=64,s.WILL_RETAIN_MASK=32,s.WILL_QOS_MASK=24,s.WILL_QOS_SHIFT=3,s.WILL_FLAG_MASK=4,s.CLEAN_SESSION_MASK=2,s.CONNECT_HEADER=a.from([s.codes.connect<<s.CMD_SHIFT]),s.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},s.propertiesCodes={};for(let r in s.properties){let t=s.properties[r];s.propertiesCodes[t]=r}s.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 u(r){return[0,1,2].map(t=>[0,1].map(n=>[0,1].map(e=>{let i=a.alloc(1);return i.writeUInt8(s.codes[r]<<s.CMD_SHIFT|(n?s.DUP_MASK:0)|t<<s.QOS_SHIFT|e,0,!0),i})))}s.PUBLISH_HEADER=u("publish"),s.SUBSCRIBE_HEADER=u("subscribe"),s.SUBSCRIBE_OPTIONS_QOS_MASK=3,s.SUBSCRIBE_OPTIONS_NL_MASK=1,s.SUBSCRIBE_OPTIONS_NL_SHIFT=2,s.SUBSCRIBE_OPTIONS_RAP_MASK=1,s.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,s.SUBSCRIBE_OPTIONS_RH_MASK=3,s.SUBSCRIBE_OPTIONS_RH_SHIFT=4,s.SUBSCRIBE_OPTIONS_RH=[0,16,32],s.SUBSCRIBE_OPTIONS_NL=4,s.SUBSCRIBE_OPTIONS_RAP=8,s.SUBSCRIBE_OPTIONS_QOS=[0,1,2],s.UNSUBSCRIBE_HEADER=u("unsubscribe"),s.ACKS={unsuback:u("unsuback"),puback:u("puback"),pubcomp:u("pubcomp"),pubrel:u("pubrel"),pubrec:u("pubrec")},s.SUBACK_HEADER=a.from([s.codes.suback<<s.CMD_SHIFT]),s.VERSION3=a.from([3]),s.VERSION4=a.from([4]),s.VERSION5=a.from([5]),s.VERSION131=a.from([131]),s.VERSION132=a.from([132]),s.QOS=[0,1,2].map(r=>a.from([r])),s.EMPTY={pingreq:a.from([s.codes.pingreq<<4,0]),pingresp:a.from([s.codes.pingresp<<4,0]),disconnect:a.from([s.codes.disconnect<<4,0])},s.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"},s.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"},s.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"},s.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"},s.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"},s.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}}),Hu=_e((o,l)=>{de(),me(),ge();var s=1e3,a=s*60,u=a*60,r=u*24,t=r*7,n=r*365.25;l.exports=function(d,m){m=m||{};var b=typeof d;if(b==="string"&&d.length>0)return e(d);if(b==="number"&&isFinite(d))return m.long?c(d):i(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function e(d){if(d=String(d),!(d.length>100)){var m=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(m){var b=parseFloat(m[1]),w=(m[2]||"ms").toLowerCase();switch(w){case"years":case"year":case"yrs":case"yr":case"y":return b*n;case"weeks":case"week":case"w":return b*t;case"days":case"day":case"d":return b*r;case"hours":case"hour":case"hrs":case"hr":case"h":return b*u;case"minutes":case"minute":case"mins":case"min":case"m":return b*a;case"seconds":case"second":case"secs":case"sec":case"s":return b*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return b;default:return}}}}function i(d){var m=Math.abs(d);return m>=r?Math.round(d/r)+"d":m>=u?Math.round(d/u)+"h":m>=a?Math.round(d/a)+"m":m>=s?Math.round(d/s)+"s":d+"ms"}function c(d){var m=Math.abs(d);return m>=r?h(d,m,r,"day"):m>=u?h(d,m,u,"hour"):m>=a?h(d,m,a,"minute"):m>=s?h(d,m,s,"second"):d+" ms"}function h(d,m,b,w){var _=m>=b*1.5;return Math.round(d/b)+" "+w+(_?"s":"")}}),Gu=_e((o,l)=>{de(),me(),ge();function s(a){r.debug=r,r.default=r,r.coerce=h,r.disable=i,r.enable=n,r.enabled=c,r.humanize=Hu(),r.destroy=d,Object.keys(a).forEach(m=>{r[m]=a[m]}),r.names=[],r.skips=[],r.formatters={};function u(m){let b=0;for(let w=0;w<m.length;w++)b=(b<<5)-b+m.charCodeAt(w),b|=0;return r.colors[Math.abs(b)%r.colors.length]}r.selectColor=u;function r(m){let b,w=null,_,A;function g(...S){if(!g.enabled)return;let E=g,v=Number(new Date),C=v-(b||v);E.diff=C,E.prev=b,E.curr=v,b=v,S[0]=r.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let P=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(I,O)=>{if(I==="%%")return"%";P++;let k=r.formatters[O];if(typeof k=="function"){let M=S[P];I=k.call(E,M),S.splice(P,1),P--}return I}),r.formatArgs.call(E,S),(E.log||r.log).apply(E,S)}return g.namespace=m,g.useColors=r.useColors(),g.color=r.selectColor(m),g.extend=t,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>w!==null?w:(_!==r.namespaces&&(_=r.namespaces,A=r.enabled(m)),A),set:S=>{w=S}}),typeof r.init=="function"&&r.init(g),g}function t(m,b){let w=r(this.namespace+(typeof b>"u"?":":b)+m);return w.log=this.log,w}function n(m){r.save(m),r.namespaces=m,r.names=[],r.skips=[];let b=(typeof m=="string"?m:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let w of b)w[0]==="-"?r.skips.push(w.slice(1)):r.names.push(w)}function e(m,b){let w=0,_=0,A=-1,g=0;for(;w<m.length;)if(_<b.length&&(b[_]===m[w]||b[_]==="*"))b[_]==="*"?(A=_,g=w,_++):(w++,_++);else if(A!==-1)_=A+1,g++,w=g;else return!1;for(;_<b.length&&b[_]==="*";)_++;return _===b.length}function i(){let m=[...r.names,...r.skips.map(b=>"-"+b)].join(",");return r.enable(""),m}function c(m){for(let b of r.skips)if(e(m,b))return!1;for(let b of r.names)if(e(m,b))return!0;return!1}function h(m){return m instanceof Error?m.stack||m.message:m}function d(){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}l.exports=s}),Mt=_e((o,l)=>{de(),me(),ge(),o.formatArgs=a,o.save=u,o.load=r,o.useColors=s,o.storage=t(),o.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})(),o.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 s(){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 e;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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function a(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+l.exports.humanize(this.diff),!this.useColors)return;let i="color: "+this.color;e.splice(1,0,i,"color: inherit");let c=0,h=0;e[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(c++,d==="%c"&&(h=c))}),e.splice(h,0,i)}o.log=console.debug||console.log||(()=>{});function u(e){try{e?o.storage.setItem("debug",e):o.storage.removeItem("debug")}catch{}}function r(){let e;try{e=o.storage.getItem("debug")||o.storage.getItem("DEBUG")}catch{}return!e&&typeof Je<"u"&&"env"in Je&&(e=Je.env.DEBUG),e}function t(){try{return localStorage}catch{}}l.exports=Gu()(o);var{formatters:n}=l.exports;n.j=function(e){try{return JSON.stringify(e)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}}}),Yu=_e((o,l)=>{de(),me(),ge();var s=zu(),{EventEmitter:a}=(Qt(),tt(Ut)),u=Ku(),r=xs(),t=Mt()("mqtt-packet:parser"),n=class Ko extends a{constructor(){super(),this.parser=this.constructor.parser}static parser(i){return this instanceof Ko?(this.settings=i||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new Ko().parser(i)}_resetState(){t("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new u,this.error=null,this._list=s(),this._stateCounter=0}parse(i){for(this.error&&this._resetState(),this._list.append(i),t("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++,t("parse: state complete. _stateCounter is now: %d",this._stateCounter),t("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return t("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let i=this._list.readUInt8(0),c=i>>r.CMD_SHIFT;this.packet.cmd=r.types[c];let h=i&15,d=r.requiredHeaderFlags[c];return d!=null&&h!==d?this._emitError(new Error(r.requiredHeaderFlagsErrors[c])):(this.packet.retain=(i&r.RETAIN_MASK)!==0,this.packet.qos=i>>r.QOS_SHIFT&r.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(i&r.DUP_MASK)!==0,t("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let i=this._parseVarByteNum(!0);return i&&(this.packet.length=i.value,this._list.consume(i.bytes)),t("_parseLength %d",i.value),!!i}_parsePayload(){t("_parsePayload: payload %O",this._list);let i=!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"))}i=!0}return t("_parsePayload complete result: %s",i),i}_parseConnect(){t("_parseConnect");let i,c,h,d,m={},b=this.packet,w=this._parseString();if(w===null)return this._emitError(new Error("Cannot parse protocolId"));if(w!=="MQTT"&&w!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(b.protocolId=w,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(b.protocolVersion=this._list.readUInt8(this._pos),b.protocolVersion>=128&&(b.bridgeMode=!0,b.protocolVersion=b.protocolVersion-128),b.protocolVersion!==3&&b.protocolVersion!==4&&b.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"));m.username=this._list.readUInt8(this._pos)&r.USERNAME_MASK,m.password=this._list.readUInt8(this._pos)&r.PASSWORD_MASK,m.will=this._list.readUInt8(this._pos)&r.WILL_FLAG_MASK;let _=!!(this._list.readUInt8(this._pos)&r.WILL_RETAIN_MASK),A=(this._list.readUInt8(this._pos)&r.WILL_QOS_MASK)>>r.WILL_QOS_SHIFT;if(m.will)b.will={},b.will.retain=_,b.will.qos=A;else{if(_)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(A)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(b.clean=(this._list.readUInt8(this._pos)&r.CLEAN_SESSION_MASK)!==0,this._pos++,b.keepalive=this._parseNum(),b.keepalive===-1)return this._emitError(new Error("Packet too short"));if(b.protocolVersion===5){let S=this._parseProperties();Object.getOwnPropertyNames(S).length&&(b.properties=S)}let g=this._parseString();if(g===null)return this._emitError(new Error("Packet too short"));if(b.clientId=g,t("_parseConnect: packet.clientId: %s",b.clientId),m.will){if(b.protocolVersion===5){let S=this._parseProperties();Object.getOwnPropertyNames(S).length&&(b.will.properties=S)}if(i=this._parseString(),i===null)return this._emitError(new Error("Cannot parse will topic"));if(b.will.topic=i,t("_parseConnect: packet.will.topic: %s",b.will.topic),c=this._parseBuffer(),c===null)return this._emitError(new Error("Cannot parse will payload"));b.will.payload=c,t("_parseConnect: packet.will.paylaod: %s",b.will.payload)}if(m.username){if(d=this._parseString(),d===null)return this._emitError(new Error("Cannot parse username"));b.username=d,t("_parseConnect: packet.username: %s",b.username)}if(m.password){if(h=this._parseBuffer(),h===null)return this._emitError(new Error("Cannot parse password"));b.password=h}return this.settings=b,t("_parseConnect: complete"),b}_parseConnack(){t("_parseConnack");let i=this.packet;if(this._list.length<1)return null;let c=this._list.readUInt8(this._pos++);if(c>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(i.sessionPresent=!!(c&r.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?i.reasonCode=this._list.readUInt8(this._pos++):i.reasonCode=0;else{if(this._list.length<2)return null;i.returnCode=this._list.readUInt8(this._pos++)}if(i.returnCode===-1||i.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let h=this._parseProperties();Object.getOwnPropertyNames(h).length&&(i.properties=h)}t("_parseConnack: complete")}_parsePublish(){t("_parsePublish");let i=this.packet;if(i.topic=this._parseString(),i.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(i.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(i.properties=c)}i.payload=this._list.slice(this._pos,i.length),t("_parsePublish: payload from buffer list: %o",i.payload)}}_parseSubscribe(){t("_parseSubscribe");let i=this.packet,c,h,d,m,b,w,_;if(i.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let A=this._parseProperties();Object.getOwnPropertyNames(A).length&&(i.properties=A)}if(i.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos<i.length;){if(c=this._parseString(),c===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=i.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(h=this._parseByte(),this.settings.protocolVersion===5){if(h&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(h&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(d=h&r.SUBSCRIBE_OPTIONS_QOS_MASK,d>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(w=(h>>r.SUBSCRIBE_OPTIONS_NL_SHIFT&r.SUBSCRIBE_OPTIONS_NL_MASK)!==0,b=(h>>r.SUBSCRIBE_OPTIONS_RAP_SHIFT&r.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,m=h>>r.SUBSCRIBE_OPTIONS_RH_SHIFT&r.SUBSCRIBE_OPTIONS_RH_MASK,m>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));_={topic:c,qos:d},this.settings.protocolVersion===5?(_.nl=w,_.rap=b,_.rh=m):this.settings.bridgeMode&&(_.rh=0,_.rap=!0,_.nl=!0),t("_parseSubscribe: push subscription `%s` to subscription",_),i.subscriptions.push(_)}}}_parseSuback(){t("_parseSuback");let i=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(i.properties=c)}if(i.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos<this.packet.length;){let c=this._list.readUInt8(this._pos++);if(this.settings.protocolVersion===5){if(!r.MQTT5_SUBACK_CODES[c])return this._emitError(new Error("Invalid suback code"))}else if(c>2&&c!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(c)}}}_parseUnsubscribe(){t("_parseUnsubscribe");let i=this.packet;if(i.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(i.properties=c)}if(i.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos<i.length;){let c=this._parseString();if(c===null)return this._emitError(new Error("Cannot parse topic"));t("_parseUnsubscribe: push topic `%s` to unsubscriptions",c),i.unsubscriptions.push(c)}}}_parseUnsuback(){t("_parseUnsuback");let i=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if((this.settings.protocolVersion===3||this.settings.protocolVersion===4)&&i.length!==2)return this._emitError(new Error("Malformed unsuback, payload length must be 2"));if(i.length<=0)return this._emitError(new Error("Malformed unsuback, no payload specified"));if(this.settings.protocolVersion===5){let c=this._parseProperties();for(Object.getOwnPropertyNames(c).length&&(i.properties=c),i.granted=[];this._pos<this.packet.length;){let h=this._list.readUInt8(this._pos++);if(!r.MQTT5_UNSUBACK_CODES[h])return this._emitError(new Error("Invalid unsuback code"));this.packet.granted.push(h)}}}_parseConfirmation(){t("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let i=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5){if(i.length>2){switch(i.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!r.MQTT5_PUBACK_PUBREC_CODES[i.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!r.MQTT5_PUBREL_PUBCOMP_CODES[i.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}t("_parseConfirmation: packet.reasonCode `%d`",i.reasonCode)}else i.reasonCode=0;if(i.length>3){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(i.properties=c)}}return!0}_parseDisconnect(){let i=this.packet;if(t("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(i.reasonCode=this._parseByte(),r.MQTT5_DISCONNECT_CODES[i.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):i.reasonCode=0;let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(i.properties=c)}return t("_parseDisconnect result: true"),!0}_parseAuth(){t("_parseAuth");let i=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(i.reasonCode=this._parseByte(),!r.MQTT5_AUTH_CODES[i.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let c=this._parseProperties();return Object.getOwnPropertyNames(c).length&&(i.properties=c),t("_parseAuth: result: true"),!0}_parseMessageId(){let i=this.packet;return i.messageId=this._parseNum(),i.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(t("_parseMessageId: packet.messageId %d",i.messageId),!0)}_parseString(i){let c=this._parseNum(),h=c+this._pos;if(c===-1||h>this._list.length||h>this.packet.length)return null;let d=this._list.toString("utf8",this._pos,h);return this._pos+=c,t("_parseString: result: %s",d),d}_parseStringPair(){return t("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let i=this._parseNum(),c=i+this._pos;if(i===-1||c>this._list.length||c>this.packet.length)return null;let h=this._list.slice(this._pos,c);return this._pos+=i,t("_parseBuffer: result: %o",h),h}_parseNum(){if(this._list.length-this._pos<2)return-1;let i=this._list.readUInt16BE(this._pos);return this._pos+=2,t("_parseNum: result: %s",i),i}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let i=this._list.readUInt32BE(this._pos);return this._pos+=4,t("_parse4ByteNum: result: %s",i),i}_parseVarByteNum(i){t("_parseVarByteNum");let c=4,h=0,d=1,m=0,b=!1,w,_=this._pos?this._pos:0;for(;h<c&&_+h<this._list.length;){if(w=this._list.readUInt8(_+h++),m+=d*(w&r.VARBYTEINT_MASK),d*=128,(w&r.VARBYTEINT_FIN_MASK)===0){b=!0;break}if(this._list.length<=h)break}return!b&&h===c&&this._list.length>=h&&this._emitError(new Error("Invalid variable byte integer")),_&&(this._pos+=h),b?i?b={bytes:h,value:m}:b=m:b=!1,t("_parseVarByteNum: result: %o",b),b}_parseByte(){let i;return this._pos<this._list.length&&(i=this._list.readUInt8(this._pos),this._pos++),t("_parseByte: result: %o",i),i}_parseByType(i){switch(t("_parseByType: type: %s",i),i){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(){t("_parseProperties");let i=this._parseVarByteNum(),c=this._pos+i,h={};for(;this._pos<c;){let d=this._parseByte();if(!d)return this._emitError(new Error("Cannot parse property code type")),!1;let m=r.propertiesCodes[d];if(!m)return this._emitError(new Error("Unknown property")),!1;if(m==="userProperties"){h[m]||(h[m]=Object.create(null));let b=this._parseByType(r.propertiesTypes[m]);if(h[m][b.name])if(Array.isArray(h[m][b.name]))h[m][b.name].push(b.value);else{let w=h[m][b.name];h[m][b.name]=[w],h[m][b.name].push(b.value)}else h[m][b.name]=b.value;continue}h[m]?Array.isArray(h[m])?h[m].push(this._parseByType(r.propertiesTypes[m])):(h[m]=[h[m]],h[m].push(this._parseByType(r.propertiesTypes[m]))):h[m]=this._parseByType(r.propertiesTypes[m])}return h}_newPacket(){return t("_newPacket"),this.packet&&(this._list.consume(this.packet.length),t("_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)),t("_newPacket: new packet"),this.packet=new u,this._pos=0,!0}_emitError(i){t("_emitError",i),this.error=i,this.emit("error",i)}};l.exports=n}),Qu=_e((o,l)=>{de(),me(),ge();var{Buffer:s}=(dt(),tt(pt)),a=65536,u={},r=s.isBuffer(s.from([1,2]).subarray(0,1));function t(c){let h=s.allocUnsafe(2);return h.writeUInt8(c>>8,0),h.writeUInt8(c&255,1),h}function n(){for(let c=0;c<a;c++)u[c]=t(c)}function e(c){let h=0,d=0,m=s.allocUnsafe(4);do h=c%128|0,c=c/128|0,c>0&&(h=h|128),m.writeUInt8(h,d++);while(c>0&&d<4);return c>0&&(d=0),r?m.subarray(0,d):m.slice(0,d)}function i(c){let h=s.allocUnsafe(4);return h.writeUInt32BE(c,0),h}l.exports={cache:u,generateCache:n,generateNumber:t,genBufVariableByteInt:e,generate4ByteBuffer:i}}),Ju=_e((o,l)=>{de(),me(),ge(),typeof Je>"u"||!Je.version||Je.version.indexOf("v0.")===0||Je.version.indexOf("v1.")===0&&Je.version.indexOf("v1.8.")!==0?l.exports={nextTick:s}:l.exports=Je;function s(a,u,r,t){if(typeof a!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,e,i;switch(n){case 0:case 1:return Je.nextTick(a);case 2:return Je.nextTick(function(){a.call(null,u)});case 3:return Je.nextTick(function(){a.call(null,u,r)});case 4:return Je.nextTick(function(){a.call(null,u,r,t)});default:for(e=new Array(n-1),i=0;i<e.length;)e[i++]=arguments[i];return Je.nextTick(function(){a.apply(null,e)})}}}),Is=_e((o,l)=>{de(),me(),ge();var s=xs(),{Buffer:a}=(dt(),tt(pt)),u=a.allocUnsafe(0),r=a.from([0]),t=Qu(),n=Ju().nextTick,e=Mt()("mqtt-packet:writeToStream"),i=t.cache,c=t.generateNumber,h=t.generateCache,d=t.genBufVariableByteInt,m=t.generate4ByteBuffer,b=re,w=!0;function _(X,U,ae){switch(e("generate called"),U.cork&&(U.cork(),n(A,U)),w&&(w=!1,h()),e("generate: packet.cmd: %s",X.cmd),X.cmd){case"connect":return g(X,U);case"connack":return S(X,U,ae);case"publish":return E(X,U,ae);case"puback":case"pubrec":case"pubrel":case"pubcomp":return v(X,U,ae);case"subscribe":return C(X,U,ae);case"suback":return P(X,U,ae);case"unsubscribe":return I(X,U,ae);case"unsuback":return O(X,U,ae);case"pingreq":case"pingresp":return k(X,U);case"disconnect":return M(X,U,ae);case"auth":return x(X,U,ae);default:return U.destroy(new Error("Unknown command")),!1}}Object.defineProperty(_,"cacheNumbers",{get(){return b===re},set(X){X?((!i||Object.keys(i).length===0)&&(w=!0),b=re):(w=!1,b=ee)}});function A(X){X.uncork()}function g(X,U,ae){let H=X||{},te=H.protocolId||"MQTT",ne=H.protocolVersion||4,ve=H.will,ce=H.clean,B=H.keepalive||0,Y=H.clientId||"",se=H.username,ye=H.password,pe=H.properties;ce===void 0&&(ce=!0);let Se=0;if(typeof te!="string"&&!a.isBuffer(te))return U.destroy(new Error("Invalid protocolId")),!1;if(Se+=te.length+2,ne!==3&&ne!==4&&ne!==5)return U.destroy(new Error("Invalid protocol version")),!1;if(Se+=1,(typeof Y=="string"||a.isBuffer(Y))&&(Y||ne>=4)&&(Y||ce))Se+=a.byteLength(Y)+2;else{if(ne<4)return U.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(ce*1===0)return U.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof B!="number"||B<0||B>65535||B%1!==0)return U.destroy(new Error("Invalid keepalive")),!1;Se+=2,Se+=1;let Z,we;if(ne===5){if(Z=oe(U,pe),!Z)return!1;Se+=Z.length}if(ve){if(typeof ve!="object")return U.destroy(new Error("Invalid will")),!1;if(!ve.topic||typeof ve.topic!="string")return U.destroy(new Error("Invalid will topic")),!1;if(Se+=a.byteLength(ve.topic)+2,Se+=2,ve.payload)if(ve.payload.length>=0)typeof ve.payload=="string"?Se+=a.byteLength(ve.payload):Se+=ve.payload.length;else return U.destroy(new Error("Invalid will payload")),!1;if(we={},ne===5){if(we=oe(U,ve.properties),!we)return!1;Se+=we.length}}let ke=!1;if(se!=null)if(Ee(se))ke=!0,Se+=a.byteLength(se)+2;else return U.destroy(new Error("Invalid username")),!1;if(ye!=null){if(!ke)return U.destroy(new Error("Username is required to use password")),!1;if(Ee(ye))Se+=V(ye)+2;else return U.destroy(new Error("Invalid password")),!1}U.write(s.CONNECT_HEADER),$(U,Se),G(U,te),H.bridgeMode&&(ne+=128),U.write(ne===131?s.VERSION131:ne===132?s.VERSION132:ne===4?s.VERSION4:ne===5?s.VERSION5:s.VERSION3);let fe=0;return fe|=se!=null?s.USERNAME_MASK:0,fe|=ye!=null?s.PASSWORD_MASK:0,fe|=ve&&ve.retain?s.WILL_RETAIN_MASK:0,fe|=ve&&ve.qos?ve.qos<<s.WILL_QOS_SHIFT:0,fe|=ve?s.WILL_FLAG_MASK:0,fe|=ce?s.CLEAN_SESSION_MASK:0,U.write(a.from([fe])),b(U,B),ne===5&&Z.write(),G(U,Y),ve&&(ne===5&&we.write(),L(U,ve.topic),G(U,ve.payload)),se!=null&&G(U,se),ye!=null&&G(U,ye),!0}function S(X,U,ae){let H=ae?ae.protocolVersion:4,te=X||{},ne=H===5?te.reasonCode:te.returnCode,ve=te.properties,ce=2;if(typeof ne!="number")return U.destroy(new Error("Invalid return code")),!1;let B=null;if(H===5){if(B=oe(U,ve),!B)return!1;ce+=B.length}return U.write(s.CONNACK_HEADER),$(U,ce),U.write(te.sessionPresent?s.SESSIONPRESENT_HEADER:r),U.write(a.from([ne])),B==null||B.write(),!0}function E(X,U,ae){e("publish: packet: %o",X);let H=ae?ae.protocolVersion:4,te=X||{},ne=te.qos||0,ve=te.retain?s.RETAIN_MASK:0,ce=te.topic,B=te.payload||u,Y=te.messageId,se=te.properties,ye=0;if(typeof ce=="string")ye+=a.byteLength(ce)+2;else if(a.isBuffer(ce))ye+=ce.length+2;else return U.destroy(new Error("Invalid topic")),!1;if(a.isBuffer(B)?ye+=B.length:ye+=a.byteLength(B),ne&&typeof Y!="number")return U.destroy(new Error("Invalid messageId")),!1;ne&&(ye+=2);let pe=null;if(H===5){if(pe=oe(U,se),!pe)return!1;ye+=pe.length}return U.write(s.PUBLISH_HEADER[ne][te.dup?1:0][ve?1:0]),$(U,ye),b(U,V(ce)),U.write(ce),ne>0&&b(U,Y),pe==null||pe.write(),e("publish: payload: %o",B),U.write(B)}function v(X,U,ae){let H=ae?ae.protocolVersion:4,te=X||{},ne=te.cmd||"puback",ve=te.messageId,ce=te.dup&&ne==="pubrel"?s.DUP_MASK:0,B=0,Y=te.reasonCode,se=te.properties,ye=H===5?3:2;if(ne==="pubrel"&&(B=1),typeof ve!="number")return U.destroy(new Error("Invalid messageId")),!1;let pe=null;if(H===5&&typeof se=="object"){if(pe=R(U,se,ae,ye),!pe)return!1;ye+=pe.length}return U.write(s.ACKS[ne][B][ce][0]),ye===3&&(ye+=Y!==0?1:-1),$(U,ye),b(U,ve),H===5&&ye!==2&&U.write(a.from([Y])),pe!==null?pe.write():ye===4&&U.write(a.from([0])),!0}function C(X,U,ae){e("subscribe: packet: ");let H=ae?ae.protocolVersion:4,te=X||{},ne=te.dup?s.DUP_MASK:0,ve=te.messageId,ce=te.subscriptions,B=te.properties,Y=0;if(typeof ve!="number")return U.destroy(new Error("Invalid messageId")),!1;Y+=2;let se=null;if(H===5){if(se=oe(U,B),!se)return!1;Y+=se.length}if(typeof ce=="object"&&ce.length)for(let pe=0;pe<ce.length;pe+=1){let Se=ce[pe].topic,Z=ce[pe].qos;if(typeof Se!="string")return U.destroy(new Error("Invalid subscriptions - invalid topic")),!1;if(typeof Z!="number")return U.destroy(new Error("Invalid subscriptions - invalid qos")),!1;if(H===5){if(typeof(ce[pe].nl||!1)!="boolean")return U.destroy(new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(ce[pe].rap||!1)!="boolean")return U.destroy(new Error("Invalid subscriptions - invalid Retain as Published")),!1;let we=ce[pe].rh||0;if(typeof we!="number"||we>2)return U.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}Y+=a.byteLength(Se)+2+1}else return U.destroy(new Error("Invalid subscriptions")),!1;e("subscribe: writing to stream: %o",s.SUBSCRIBE_HEADER),U.write(s.SUBSCRIBE_HEADER[1][ne?1:0][0]),$(U,Y),b(U,ve),se!==null&&se.write();let ye=!0;for(let pe of ce){let Se=pe.topic,Z=pe.qos,we=+pe.nl,ke=+pe.rap,fe=pe.rh,Ue;L(U,Se),Ue=s.SUBSCRIBE_OPTIONS_QOS[Z],H===5&&(Ue|=we?s.SUBSCRIBE_OPTIONS_NL:0,Ue|=ke?s.SUBSCRIBE_OPTIONS_RAP:0,Ue|=fe?s.SUBSCRIBE_OPTIONS_RH[fe]:0),ye=U.write(a.from([Ue]))}return ye}function P(X,U,ae){let H=ae?ae.protocolVersion:4,te=X||{},ne=te.messageId,ve=te.granted,ce=te.properties,B=0;if(typeof ne!="number")return U.destroy(new Error("Invalid messageId")),!1;if(B+=2,typeof ve=="object"&&ve.length)for(let se=0;se<ve.length;se+=1){if(typeof ve[se]!="number")return U.destroy(new Error("Invalid qos vector")),!1;B+=1}else return U.destroy(new Error("Invalid qos vector")),!1;let Y=null;if(H===5){if(Y=R(U,ce,ae,B),!Y)return!1;B+=Y.length}return U.write(s.SUBACK_HEADER),$(U,B),b(U,ne),Y!==null&&Y.write(),U.write(a.from(ve))}function I(X,U,ae){let H=ae?ae.protocolVersion:4,te=X||{},ne=te.messageId,ve=te.dup?s.DUP_MASK:0,ce=te.unsubscriptions,B=te.properties,Y=0;if(typeof ne!="number")return U.destroy(new Error("Invalid messageId")),!1;if(Y+=2,typeof ce=="object"&&ce.length)for(let pe=0;pe<ce.length;pe+=1){if(typeof ce[pe]!="string")return U.destroy(new Error("Invalid unsubscriptions")),!1;Y+=a.byteLength(ce[pe])+2}else return U.destroy(new Error("Invalid unsubscriptions")),!1;let se=null;if(H===5){if(se=oe(U,B),!se)return!1;Y+=se.length}U.write(s.UNSUBSCRIBE_HEADER[1][ve?1:0][0]),$(U,Y),b(U,ne),se!==null&&se.write();let ye=!0;for(let pe=0;pe<ce.length;pe++)ye=L(U,ce[pe]);return ye}function O(X,U,ae){let H=ae?ae.protocolVersion:4,te=X||{},ne=te.messageId,ve=te.dup?s.DUP_MASK:0,ce=te.granted,B=te.properties,Y=te.cmd,se=0,ye=2;if(typeof ne!="number")return U.destroy(new Error("Invalid messageId")),!1;if(H===5)if(typeof ce=="object"&&ce.length)for(let Se=0;Se<ce.length;Se+=1){if(typeof ce[Se]!="number")return U.destroy(new Error("Invalid qos vector")),!1;ye+=1}else return U.destroy(new Error("Invalid qos vector")),!1;let pe=null;if(H===5){if(pe=R(U,B,ae,ye),!pe)return!1;ye+=pe.length}return U.write(s.ACKS[Y][se][ve][0]),$(U,ye),b(U,ne),pe!==null&&pe.write(),H===5&&U.write(a.from(ce)),!0}function k(X,U,ae){return U.write(s.EMPTY[X.cmd])}function M(X,U,ae){let H=ae?ae.protocolVersion:4,te=X||{},ne=te.reasonCode,ve=te.properties,ce=H===5?1:0,B=null;if(H===5){if(B=R(U,ve,ae,ce),!B)return!1;ce+=B.length}return U.write(a.from([s.codes.disconnect<<4])),$(U,ce),H===5&&U.write(a.from([ne])),B!==null&&B.write(),!0}function x(X,U,ae){let H=ae?ae.protocolVersion:4,te=X||{},ne=te.reasonCode,ve=te.properties,ce=H===5?1:0;H!==5&&U.destroy(new Error("Invalid mqtt version for auth packet"));let B=R(U,ve,ae,ce);return B?(ce+=B.length,U.write(a.from([s.codes.auth<<4])),$(U,ce),U.write(a.from([ne])),B!==null&&B.write(),!0):!1}var W={};function $(X,U){if(U>s.VARBYTEINT_MAX)return X.destroy(new Error(`Invalid variable byte integer: ${U}`)),!1;let ae=W[U];return ae||(ae=d(U),U<16384&&(W[U]=ae)),e("writeVarByteInt: writing to stream: %o",ae),X.write(ae)}function L(X,U){let ae=a.byteLength(U);return b(X,ae),e("writeString: %s",U),X.write(U,"utf8")}function le(X,U,ae){L(X,U),L(X,ae)}function re(X,U){return e("writeNumberCached: number: %d",U),e("writeNumberCached: %o",i[U]),X.write(i[U])}function ee(X,U){let ae=c(U);return e("writeNumberGenerated: %o",ae),X.write(ae)}function ue(X,U){let ae=m(U);return e("write4ByteNumber: %o",ae),X.write(ae)}function G(X,U){typeof U=="string"?L(X,U):U?(b(X,U.length),X.write(U)):b(X,0)}function oe(X,U){if(typeof U!="object"||U.length!=null)return{length:1,write(){he(X,{},0)}};let ae=0;function H(te,ne){let ve=s.propertiesTypes[te],ce=0;switch(ve){case"byte":{if(typeof ne!="boolean")return X.destroy(new Error(`Invalid ${te}: ${ne}`)),!1;ce+=2;break}case"int8":{if(typeof ne!="number"||ne<0||ne>255)return X.destroy(new Error(`Invalid ${te}: ${ne}`)),!1;ce+=2;break}case"binary":{if(ne&&ne===null)return X.destroy(new Error(`Invalid ${te}: ${ne}`)),!1;ce+=1+a.byteLength(ne)+2;break}case"int16":{if(typeof ne!="number"||ne<0||ne>65535)return X.destroy(new Error(`Invalid ${te}: ${ne}`)),!1;ce+=3;break}case"int32":{if(typeof ne!="number"||ne<0||ne>4294967295)return X.destroy(new Error(`Invalid ${te}: ${ne}`)),!1;ce+=5;break}case"var":{if(typeof ne!="number"||ne<0||ne>268435455)return X.destroy(new Error(`Invalid ${te}: ${ne}`)),!1;ce+=1+a.byteLength(d(ne));break}case"string":{if(typeof ne!="string")return X.destroy(new Error(`Invalid ${te}: ${ne}`)),!1;ce+=3+a.byteLength(ne.toString());break}case"pair":{if(typeof ne!="object")return X.destroy(new Error(`Invalid ${te}: ${ne}`)),!1;ce+=Object.getOwnPropertyNames(ne).reduce((B,Y)=>{let se=ne[Y];return Array.isArray(se)?B+=se.reduce((ye,pe)=>(ye+=3+a.byteLength(Y.toString())+2+a.byteLength(pe.toString()),ye),0):B+=3+a.byteLength(Y.toString())+2+a.byteLength(ne[Y].toString()),B},0);break}default:return X.destroy(new Error(`Invalid property ${te}: ${ne}`)),!1}return ce}if(U)for(let te in U){let ne=0,ve=0,ce=U[te];if(ce!==void 0){if(Array.isArray(ce))for(let B=0;B<ce.length;B++){if(ve=H(te,ce[B]),!ve)return!1;ne+=ve}else{if(ve=H(te,ce),!ve)return!1;ne=ve}if(!ne)return!1;ae+=ne}}return{length:a.byteLength(d(ae))+ae,write(){he(X,U,ae)}}}function R(X,U,ae,H){let te=["reasonString","userProperties"],ne=ae&&ae.properties&&ae.properties.maximumPacketSize?ae.properties.maximumPacketSize:0,ve=oe(X,U);if(ne)for(;H+ve.length>ne;){let ce=te.shift();if(ce&&U[ce])delete U[ce],ve=oe(X,U);else return!1}return ve}function Q(X,U,ae){switch(s.propertiesTypes[U]){case"byte":{X.write(a.from([s.properties[U]])),X.write(a.from([+ae]));break}case"int8":{X.write(a.from([s.properties[U]])),X.write(a.from([ae]));break}case"binary":{X.write(a.from([s.properties[U]])),G(X,ae);break}case"int16":{X.write(a.from([s.properties[U]])),b(X,ae);break}case"int32":{X.write(a.from([s.properties[U]])),ue(X,ae);break}case"var":{X.write(a.from([s.properties[U]])),$(X,ae);break}case"string":{X.write(a.from([s.properties[U]])),L(X,ae);break}case"pair":{Object.getOwnPropertyNames(ae).forEach(H=>{let te=ae[H];Array.isArray(te)?te.forEach(ne=>{X.write(a.from([s.properties[U]])),le(X,H.toString(),ne.toString())}):(X.write(a.from([s.properties[U]])),le(X,H.toString(),te.toString()))});break}default:return X.destroy(new Error(`Invalid property ${U} value: ${ae}`)),!1}}function he(X,U,ae){$(X,ae);for(let H in U)if(Object.prototype.hasOwnProperty.call(U,H)&&U[H]!=null){let te=U[H];if(Array.isArray(te))for(let ne=0;ne<te.length;ne++)Q(X,H,te[ne]);else Q(X,H,te)}}function V(X){return X?X instanceof a?X.length:a.byteLength(X):0}function Ee(X){return typeof X=="string"||X instanceof a}l.exports=_}),Xu=_e((o,l)=>{de(),me(),ge();var s=Is(),{EventEmitter:a}=(Qt(),tt(Ut)),{Buffer:u}=(dt(),tt(pt));function r(n,e){let i=new t;return s(n,i,e),i.concat()}var t=class extends a{constructor(){super(),this._array=new Array(20),this._i=0}write(n){return this._array[this._i++]=n,!0}concat(){let n=0,e=new Array(this._array.length),i=this._array,c=0,h;for(h=0;h<i.length&&i[h]!==void 0;h++)typeof i[h]!="string"?e[h]=i[h].length:e[h]=u.byteLength(i[h]),n+=e[h];let d=u.allocUnsafe(n);for(h=0;h<i.length&&i[h]!==void 0;h++)typeof i[h]!="string"?(i[h].copy(d,c),c+=e[h]):(d.write(i[h],c),c+=e[h]);return d}destroy(n){n&&this.emit("error",n)}};l.exports=r}),Zu=_e(o=>{de(),me(),ge(),o.parser=Yu().parser,o.generate=Xu(),o.writeToStream=Is()}),ec=_e((o,l)=>{de(),me(),ge(),l.exports=a;function s(r){return r instanceof xr?xr.from(r):new r.constructor(r.buffer.slice(),r.byteOffset,r.length)}function a(r){if(r=r||{},r.circles)return u(r);let t=new Map;if(t.set(Date,h=>new Date(h)),t.set(Map,(h,d)=>new Map(e(Array.from(h),d))),t.set(Set,(h,d)=>new Set(e(Array.from(h),d))),r.constructorHandlers)for(let h of r.constructorHandlers)t.set(h[0],h[1]);let n=null;return r.proto?c:i;function e(h,d){let m=Object.keys(h),b=new Array(m.length);for(let w=0;w<m.length;w++){let _=m[w],A=h[_];typeof A!="object"||A===null?b[_]=A:A.constructor!==Object&&(n=t.get(A.constructor))?b[_]=n(A,d):ArrayBuffer.isView(A)?b[_]=s(A):b[_]=d(A)}return b}function i(h){if(typeof h!="object"||h===null)return h;if(Array.isArray(h))return e(h,i);if(h.constructor!==Object&&(n=t.get(h.constructor)))return n(h,i);let d={};for(let m in h){if(Object.hasOwnProperty.call(h,m)===!1)continue;let b=h[m];typeof b!="object"||b===null?d[m]=b:b.constructor!==Object&&(n=t.get(b.constructor))?d[m]=n(b,i):ArrayBuffer.isView(b)?d[m]=s(b):d[m]=i(b)}return d}function c(h){if(typeof h!="object"||h===null)return h;if(Array.isArray(h))return e(h,c);if(h.constructor!==Object&&(n=t.get(h.constructor)))return n(h,c);let d={};for(let m in h){let b=h[m];typeof b!="object"||b===null?d[m]=b:b.constructor!==Object&&(n=t.get(b.constructor))?d[m]=n(b,c):ArrayBuffer.isView(b)?d[m]=s(b):d[m]=c(b)}return d}}function u(r){let t=[],n=[],e=new Map;if(e.set(Date,m=>new Date(m)),e.set(Map,(m,b)=>new Map(c(Array.from(m),b))),e.set(Set,(m,b)=>new Set(c(Array.from(m),b))),r.constructorHandlers)for(let m of r.constructorHandlers)e.set(m[0],m[1]);let i=null;return r.proto?d:h;function c(m,b){let w=Object.keys(m),_=new Array(w.length);for(let A=0;A<w.length;A++){let g=w[A],S=m[g];if(typeof S!="object"||S===null)_[g]=S;else if(S.constructor!==Object&&(i=e.get(S.constructor)))_[g]=i(S,b);else if(ArrayBuffer.isView(S))_[g]=s(S);else{let E=t.indexOf(S);E!==-1?_[g]=n[E]:_[g]=b(S)}}return _}function h(m){if(typeof m!="object"||m===null)return m;if(Array.isArray(m))return c(m,h);if(m.constructor!==Object&&(i=e.get(m.constructor)))return i(m,h);let b={};t.push(m),n.push(b);for(let w in m){if(Object.hasOwnProperty.call(m,w)===!1)continue;let _=m[w];if(typeof _!="object"||_===null)b[w]=_;else if(_.constructor!==Object&&(i=e.get(_.constructor)))b[w]=i(_,h);else if(ArrayBuffer.isView(_))b[w]=s(_);else{let A=t.indexOf(_);A!==-1?b[w]=n[A]:b[w]=h(_)}}return t.pop(),n.pop(),b}function d(m){if(typeof m!="object"||m===null)return m;if(Array.isArray(m))return c(m,d);if(m.constructor!==Object&&(i=e.get(m.constructor)))return i(m,d);let b={};t.push(m),n.push(b);for(let w in m){let _=m[w];if(typeof _!="object"||_===null)b[w]=_;else if(_.constructor!==Object&&(i=e.get(_.constructor)))b[w]=i(_,d);else if(ArrayBuffer.isView(_))b[w]=s(_);else{let A=t.indexOf(_);A!==-1?b[w]=n[A]:b[w]=d(_)}}return t.pop(),n.pop(),b}}}),tc=_e((o,l)=>{de(),me(),ge(),l.exports=ec()()}),rc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0}),o.validateTopic=l,o.validateTopics=s;function l(a){let u=a.split("/");for(let r=0;r<u.length;r++)if(u[r]!=="+"){if(u[r]==="#")return r===u.length-1;if(u[r].indexOf("+")!==-1||u[r].indexOf("#")!==-1)return!1}return!0}function s(a){if(a.length===0)return"empty_topic_list";for(let u=0;u<a.length;u++)if(!l(a[u]))return a[u];return null}}),ks=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0});var l=Xt(),s={objectMode:!0},a={clean:!0},u=class{constructor(r){Pe(this,"options");Pe(this,"_inflights");this.options=r||{},this.options={...a,...r},this._inflights=new Map}put(r,t){return this._inflights.set(r.messageId,r),t&&t(),this}createStream(){let r=new l.Readable(s),t=[],n=!1,e=0;return this._inflights.forEach((i,c)=>{t.push(i)}),r._read=()=>{!n&&e<t.length?r.push(t[e++]):r.push(null)},r.destroy=i=>{if(!n)return n=!0,setTimeout(()=>{r.emit("close")},0),r},r}del(r,t){let n=this._inflights.get(r.messageId);return n?(this._inflights.delete(r.messageId),t(null,n)):t&&t(new Error("missing packet")),this}get(r,t){let n=this._inflights.get(r.messageId);return n?t(null,n):t&&t(new Error("missing packet")),this}close(r){this.options.clean&&(this._inflights=null),r&&r()}};o.default=u}),nc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0});var l=[0,16,128,131,135,144,145,151,153],s=(a,u,r)=>{a.log("handlePublish: packet %o",u),r=typeof r<"u"?r:a.noop;let t=u.topic.toString(),n=u.payload,{qos:e}=u,{messageId:i}=u,{options:c}=a;if(a.options.protocolVersion===5){let h;if(u.properties&&(h=u.properties.topicAlias),typeof h<"u")if(t.length===0)if(h>0&&h<=65535){let d=a.topicAliasRecv.getTopicByAlias(h);if(d)t=d,a.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",t,h);else{a.log("handlePublish :: unregistered topic alias. alias: %d",h),a.emit("error",new Error("Received unregistered Topic Alias"));return}}else{a.log("handlePublish :: topic alias out of range. alias: %d",h),a.emit("error",new Error("Received Topic Alias is out of range"));return}else if(a.topicAliasRecv.put(t,h))a.log("handlePublish :: registered topic: %s - alias: %d",t,h);else{a.log("handlePublish :: topic alias out of range. alias: %d",h),a.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(a.log("handlePublish: qos %d",e),e){case 2:{c.customHandleAcks(t,n,u,(h,d)=>{if(typeof h=="number"&&(d=h,h=null),h)return a.emit("error",h);if(l.indexOf(d)===-1)return a.emit("error",new Error("Wrong reason code for pubrec"));d?a._sendPacket({cmd:"pubrec",messageId:i,reasonCode:d},r):a.incomingStore.put(u,()=>{a._sendPacket({cmd:"pubrec",messageId:i},r)})});break}case 1:{c.customHandleAcks(t,n,u,(h,d)=>{if(typeof h=="number"&&(d=h,h=null),h)return a.emit("error",h);if(l.indexOf(d)===-1)return a.emit("error",new Error("Wrong reason code for puback"));d||a.emit("message",t,n,u),a.handleMessage(u,m=>{if(m)return r&&r(m);a._sendPacket({cmd:"puback",messageId:i,reasonCode:d},r)})});break}case 0:a.emit("message",t,n,u),a.handleMessage(u,r);break;default:a.log("handlePublish: unknown QoS. Doing nothing.");break}};o.default=s}),ic=_e((o,l)=>{l.exports={version:"5.14.1"}}),ar=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0}),o.MQTTJS_VERSION=o.nextTick=o.ErrorWithSubackPacket=o.ErrorWithReasonCode=void 0,o.applyMixin=a;var l=class du extends Error{constructor(t,n){super(t);Pe(this,"code");this.code=n,Object.setPrototypeOf(this,du.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}};o.ErrorWithReasonCode=l;var s=class gu extends Error{constructor(t,n){super(t);Pe(this,"packet");this.packet=n,Object.setPrototypeOf(this,gu.prototype),Object.getPrototypeOf(this).name="ErrorWithSubackPacket"}};o.ErrorWithSubackPacket=s;function a(u,r,t=!1){let n=[r];for(;;){let e=n[0],i=Object.getPrototypeOf(e);if(i!=null&&i.prototype)n.unshift(i);else break}for(let e of n)for(let i of Object.getOwnPropertyNames(e.prototype))(t||i!=="constructor")&&Object.defineProperty(u.prototype,i,Object.getOwnPropertyDescriptor(e.prototype,i)??Object.create(null))}o.nextTick=typeof(Je==null?void 0:Je.nextTick)=="function"?Je.nextTick:u=>{setTimeout(u,0)},o.MQTTJS_VERSION=ic().version}),Or=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0}),o.ReasonCodes=void 0;var l=ar();o.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 s=(a,u)=>{let{messageId:r}=u,t=u.cmd,n=null,e=a.outgoing[r]?a.outgoing[r].cb:null,i=null;if(!e){a.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(a.log("_handleAck :: packet type",t),t){case"pubcomp":case"puback":{let c=u.reasonCode;c&&c>0&&c!==16?(i=new l.ErrorWithReasonCode(`Publish error: ${o.ReasonCodes[c]}`,c),a._removeOutgoingAndStoreMessage(r,()=>{e(i,u)})):a._removeOutgoingAndStoreMessage(r,e);break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:r};let c=u.reasonCode;c&&c>0&&c!==16?(i=new l.ErrorWithReasonCode(`Publish error: ${o.ReasonCodes[c]}`,c),a._removeOutgoingAndStoreMessage(r,()=>{e(i,u)})):a._sendPacket(n);break}case"suback":{delete a.outgoing[r],a.messageIdProvider.deallocate(r);let c=u.granted;for(let h=0;h<c.length;h++){let d=c[h];if(d&128){i=new Error(`Subscribe error: ${o.ReasonCodes[d]}`),i.code=d;let m=a.messageIdToTopic[r];m&&m.forEach(b=>{delete a._resubscribeTopics[b]})}}delete a.messageIdToTopic[r],a._invokeStoreProcessingQueue(),e(i,u);break}case"unsuback":{delete a.outgoing[r],a.messageIdProvider.deallocate(r),a._invokeStoreProcessingQueue(),e(null,u);break}default:a.emit("error",new Error("unrecognized packet type"))}a.disconnecting&&Object.keys(a.outgoing).length===0&&a.emit("outgoingEmpty")};o.default=s}),oc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0});var l=ar(),s=Or(),a=(u,r)=>{let{options:t}=u,n=t.protocolVersion,e=n===5?r.reasonCode:r.returnCode;if(n!==5){let i=new l.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${n}`,e);u.emit("error",i);return}u.handleAuth(r,(i,c)=>{if(i){u.emit("error",i);return}if(e===24)u.reconnecting=!1,u._sendPacket(c);else{let h=new l.ErrorWithReasonCode(`Connection refused: ${s.ReasonCodes[e]}`,e);u.emit("error",h)}})};o.default=a}),sc=_e(o=>{var m,b,w,_,A,g,S,E,v,C,P,I,O,k,M,x,W,$,L,le,re,ee,ue,G,oe,R,Q,he,V,Ho,X,U,ae,H,mu,ne,ve,ce,Vt,zt,Go,un,cn,ot,Yo,Sr,Kt,Qo,Ue;de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0}),o.LRUCache=void 0;var l=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,s=new Set,a=typeof Je=="object"&&Je?Je:{},u=(f,p,y,T)=>{typeof a.emitWarning=="function"?a.emitWarning(f,p,y,T):console.error(`[${y}] ${p}: ${f}`)},r=globalThis.AbortController,t=globalThis.AbortSignal;if(typeof r>"u"){t=class{constructor(){Pe(this,"onabort");Pe(this,"_onabort",[]);Pe(this,"reason");Pe(this,"aborted",!1)}addEventListener(y,T){this._onabort.push(T)}},r=class{constructor(){Pe(this,"signal",new t);p()}abort(y){var T,N;if(!this.signal.aborted){this.signal.reason=y,this.signal.aborted=!0;for(let z of this.signal._onabort)z(y);(N=(T=this.signal).onabort)==null||N.call(T,y)}}};let f=((m=a.env)==null?void 0:m.LRU_CACHE_IGNORE_AC_WARNING)!=="1",p=()=>{f&&(f=!1,u("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",p))}}var n=f=>!s.has(f),e=f=>f&&f===Math.floor(f)&&f>0&&isFinite(f),i=f=>e(f)?f<=Math.pow(2,8)?Uint8Array:f<=Math.pow(2,16)?Uint16Array:f<=Math.pow(2,32)?Uint32Array:f<=Number.MAX_SAFE_INTEGER?c:null:null,c=class extends Array{constructor(f){super(f),this.fill(0)}},h=(b=class{constructor(p,y){Pe(this,"heap");Pe(this,"length");if(!F(b,w))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new y(p),this.length=0}static create(p){let y=i(p);if(!y)return[];$e(b,w,!0);let T=new b(p,y);return $e(b,w,!1),T}push(p){this.heap[this.length++]=p}pop(){return this.heap[--this.length]}},w=new WeakMap,Qe(b,w,!1),b),d=(Ue=class{constructor(p){Qe(this,V);Qe(this,g);Qe(this,S);Qe(this,E);Qe(this,v);Qe(this,C);Qe(this,P);Pe(this,"ttl");Pe(this,"ttlResolution");Pe(this,"ttlAutopurge");Pe(this,"updateAgeOnGet");Pe(this,"updateAgeOnHas");Pe(this,"allowStale");Pe(this,"noDisposeOnSet");Pe(this,"noUpdateTTL");Pe(this,"maxEntrySize");Pe(this,"sizeCalculation");Pe(this,"noDeleteOnFetchRejection");Pe(this,"noDeleteOnStaleGet");Pe(this,"allowStaleOnFetchAbort");Pe(this,"allowStaleOnFetchRejection");Pe(this,"ignoreFetchAbort");Qe(this,I);Qe(this,O);Qe(this,k);Qe(this,M);Qe(this,x);Qe(this,W);Qe(this,$);Qe(this,L);Qe(this,le);Qe(this,re);Qe(this,ee);Qe(this,ue);Qe(this,G);Qe(this,oe);Qe(this,R);Qe(this,Q);Qe(this,he);Qe(this,X,()=>{});Qe(this,U,()=>{});Qe(this,ae,()=>{});Qe(this,H,()=>!1);Qe(this,ne,p=>{});Qe(this,ve,(p,y,T)=>{});Qe(this,ce,(p,y,T,N)=>{if(T||N)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});Pe(this,_,"LRUCache");let{max:y=0,ttl:T,ttlResolution:N=1,ttlAutopurge:z,updateAgeOnGet:ie,updateAgeOnHas:q,allowStale:J,dispose:Oe,disposeAfter:Me,noDisposeOnSet:Ne,noUpdateTTL:Fe,maxSize:nt=0,maxEntrySize:rt=0,sizeCalculation:Ke,fetchMethod:Xe,memoMethod:De,noDeleteOnFetchRejection:Ye,noDeleteOnStaleGet:Ze,allowStaleOnFetchRejection:lt,allowStaleOnFetchAbort:ct,ignoreFetchAbort:Et}=p;if(y!==0&&!e(y))throw new TypeError("max option must be a nonnegative integer");let j=y?i(y):Array;if(!j)throw new Error("invalid max value: "+y);if($e(this,g,y),$e(this,S,nt),this.maxEntrySize=rt||F(this,S),this.sizeCalculation=Ke,this.sizeCalculation){if(!F(this,S)&&!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(De!==void 0&&typeof De!="function")throw new TypeError("memoMethod must be a function if defined");if($e(this,P,De),Xe!==void 0&&typeof Xe!="function")throw new TypeError("fetchMethod must be a function if specified");if($e(this,C,Xe),$e(this,Q,!!Xe),$e(this,k,new Map),$e(this,M,new Array(y).fill(void 0)),$e(this,x,new Array(y).fill(void 0)),$e(this,W,new j(y)),$e(this,$,new j(y)),$e(this,L,0),$e(this,le,0),$e(this,re,h.create(y)),$e(this,I,0),$e(this,O,0),typeof Oe=="function"&&$e(this,E,Oe),typeof Me=="function"?($e(this,v,Me),$e(this,ee,[])):($e(this,v,void 0),$e(this,ee,void 0)),$e(this,R,!!F(this,E)),$e(this,he,!!F(this,v)),this.noDisposeOnSet=!!Ne,this.noUpdateTTL=!!Fe,this.noDeleteOnFetchRejection=!!Ye,this.allowStaleOnFetchRejection=!!lt,this.allowStaleOnFetchAbort=!!ct,this.ignoreFetchAbort=!!Et,this.maxEntrySize!==0){if(F(this,S)!==0&&!e(F(this,S)))throw new TypeError("maxSize must be a positive integer if specified");if(!e(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Le(this,V,mu).call(this)}if(this.allowStale=!!J,this.noDeleteOnStaleGet=!!Ze,this.updateAgeOnGet=!!ie,this.updateAgeOnHas=!!q,this.ttlResolution=e(N)||N===0?N:1,this.ttlAutopurge=!!z,this.ttl=T||0,this.ttl){if(!e(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Le(this,V,Ho).call(this)}if(F(this,g)===0&&this.ttl===0&&F(this,S)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!F(this,g)&&!F(this,S)){let D="LRU_CACHE_UNBOUNDED";n(D)&&(s.add(D),u("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",D,Ue))}}static unsafeExposeInternals(p){return{starts:F(p,G),ttls:F(p,oe),sizes:F(p,ue),keyMap:F(p,k),keyList:F(p,M),valList:F(p,x),next:F(p,W),prev:F(p,$),get head(){return F(p,L)},get tail(){return F(p,le)},free:F(p,re),isBackgroundFetch:y=>{var T;return Le(T=p,V,ot).call(T,y)},backgroundFetch:(y,T,N,z)=>{var ie;return Le(ie=p,V,cn).call(ie,y,T,N,z)},moveToTail:y=>{var T;return Le(T=p,V,Sr).call(T,y)},indexes:y=>{var T;return Le(T=p,V,Vt).call(T,y)},rindexes:y=>{var T;return Le(T=p,V,zt).call(T,y)},isStale:y=>{var T;return F(T=p,H).call(T,y)}}}get max(){return F(this,g)}get maxSize(){return F(this,S)}get calculatedSize(){return F(this,O)}get size(){return F(this,I)}get fetchMethod(){return F(this,C)}get memoMethod(){return F(this,P)}get dispose(){return F(this,E)}get disposeAfter(){return F(this,v)}getRemainingTTL(p){return F(this,k).has(p)?1/0:0}*entries(){for(let p of Le(this,V,Vt).call(this))F(this,x)[p]!==void 0&&F(this,M)[p]!==void 0&&!Le(this,V,ot).call(this,F(this,x)[p])&&(yield[F(this,M)[p],F(this,x)[p]])}*rentries(){for(let p of Le(this,V,zt).call(this))F(this,x)[p]!==void 0&&F(this,M)[p]!==void 0&&!Le(this,V,ot).call(this,F(this,x)[p])&&(yield[F(this,M)[p],F(this,x)[p]])}*keys(){for(let p of Le(this,V,Vt).call(this)){let y=F(this,M)[p];y!==void 0&&!Le(this,V,ot).call(this,F(this,x)[p])&&(yield y)}}*rkeys(){for(let p of Le(this,V,zt).call(this)){let y=F(this,M)[p];y!==void 0&&!Le(this,V,ot).call(this,F(this,x)[p])&&(yield y)}}*values(){for(let p of Le(this,V,Vt).call(this))F(this,x)[p]!==void 0&&!Le(this,V,ot).call(this,F(this,x)[p])&&(yield F(this,x)[p])}*rvalues(){for(let p of Le(this,V,zt).call(this))F(this,x)[p]!==void 0&&!Le(this,V,ot).call(this,F(this,x)[p])&&(yield F(this,x)[p])}[(A=Symbol.iterator,_=Symbol.toStringTag,A)](){return this.entries()}find(p,y={}){for(let T of Le(this,V,Vt).call(this)){let N=F(this,x)[T],z=Le(this,V,ot).call(this,N)?N.__staleWhileFetching:N;if(z!==void 0&&p(z,F(this,M)[T],this))return this.get(F(this,M)[T],y)}}forEach(p,y=this){for(let T of Le(this,V,Vt).call(this)){let N=F(this,x)[T],z=Le(this,V,ot).call(this,N)?N.__staleWhileFetching:N;z!==void 0&&p.call(y,z,F(this,M)[T],this)}}rforEach(p,y=this){for(let T of Le(this,V,zt).call(this)){let N=F(this,x)[T],z=Le(this,V,ot).call(this,N)?N.__staleWhileFetching:N;z!==void 0&&p.call(y,z,F(this,M)[T],this)}}purgeStale(){let p=!1;for(let y of Le(this,V,zt).call(this,{allowStale:!0}))F(this,H).call(this,y)&&(Le(this,V,Kt).call(this,F(this,M)[y],"expire"),p=!0);return p}info(p){let y=F(this,k).get(p);if(y===void 0)return;let T=F(this,x)[y],N=Le(this,V,ot).call(this,T)?T.__staleWhileFetching:T;if(N===void 0)return;let z={value:N};if(F(this,oe)&&F(this,G)){let ie=F(this,oe)[y],q=F(this,G)[y];if(ie&&q){let J=ie-(l.now()-q);z.ttl=J,z.start=Date.now()}}return F(this,ue)&&(z.size=F(this,ue)[y]),z}dump(){let p=[];for(let y of Le(this,V,Vt).call(this,{allowStale:!0})){let T=F(this,M)[y],N=F(this,x)[y],z=Le(this,V,ot).call(this,N)?N.__staleWhileFetching:N;if(z===void 0||T===void 0)continue;let ie={value:z};if(F(this,oe)&&F(this,G)){ie.ttl=F(this,oe)[y];let q=l.now()-F(this,G)[y];ie.start=Math.floor(Date.now()-q)}F(this,ue)&&(ie.size=F(this,ue)[y]),p.unshift([T,ie])}return p}load(p){this.clear();for(let[y,T]of p){if(T.start){let N=Date.now()-T.start;T.start=l.now()-N}this.set(y,T.value,T)}}set(p,y,T={}){var Fe,nt,rt,Ke,Xe;if(y===void 0)return this.delete(p),this;let{ttl:N=this.ttl,start:z,noDisposeOnSet:ie=this.noDisposeOnSet,sizeCalculation:q=this.sizeCalculation,status:J}=T,{noUpdateTTL:Oe=this.noUpdateTTL}=T,Me=F(this,ce).call(this,p,y,T.size||0,q);if(this.maxEntrySize&&Me>this.maxEntrySize)return J&&(J.set="miss",J.maxEntrySizeExceeded=!0),Le(this,V,Kt).call(this,p,"set"),this;let Ne=F(this,I)===0?void 0:F(this,k).get(p);if(Ne===void 0)Ne=F(this,I)===0?F(this,le):F(this,re).length!==0?F(this,re).pop():F(this,I)===F(this,g)?Le(this,V,un).call(this,!1):F(this,I),F(this,M)[Ne]=p,F(this,x)[Ne]=y,F(this,k).set(p,Ne),F(this,W)[F(this,le)]=Ne,F(this,$)[Ne]=F(this,le),$e(this,le,Ne),ln(this,I)._++,F(this,ve).call(this,Ne,Me,J),J&&(J.set="add"),Oe=!1;else{Le(this,V,Sr).call(this,Ne);let De=F(this,x)[Ne];if(y!==De){if(F(this,Q)&&Le(this,V,ot).call(this,De)){De.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:Ye}=De;Ye!==void 0&&!ie&&(F(this,R)&&((Fe=F(this,E))==null||Fe.call(this,Ye,p,"set")),F(this,he)&&((nt=F(this,ee))==null||nt.push([Ye,p,"set"])))}else ie||(F(this,R)&&((rt=F(this,E))==null||rt.call(this,De,p,"set")),F(this,he)&&((Ke=F(this,ee))==null||Ke.push([De,p,"set"])));if(F(this,ne).call(this,Ne),F(this,ve).call(this,Ne,Me,J),F(this,x)[Ne]=y,J){J.set="replace";let Ye=De&&Le(this,V,ot).call(this,De)?De.__staleWhileFetching:De;Ye!==void 0&&(J.oldValue=Ye)}}else J&&(J.set="update")}if(N!==0&&!F(this,oe)&&Le(this,V,Ho).call(this),F(this,oe)&&(Oe||F(this,ae).call(this,Ne,N,z),J&&F(this,U).call(this,J,Ne)),!ie&&F(this,he)&&F(this,ee)){let De=F(this,ee),Ye;for(;Ye=De==null?void 0:De.shift();)(Xe=F(this,v))==null||Xe.call(this,...Ye)}return this}pop(){var p;try{for(;F(this,I);){let y=F(this,x)[F(this,L)];if(Le(this,V,un).call(this,!0),Le(this,V,ot).call(this,y)){if(y.__staleWhileFetching)return y.__staleWhileFetching}else if(y!==void 0)return y}}finally{if(F(this,he)&&F(this,ee)){let y=F(this,ee),T;for(;T=y==null?void 0:y.shift();)(p=F(this,v))==null||p.call(this,...T)}}}has(p,y={}){let{updateAgeOnHas:T=this.updateAgeOnHas,status:N}=y,z=F(this,k).get(p);if(z!==void 0){let ie=F(this,x)[z];if(Le(this,V,ot).call(this,ie)&&ie.__staleWhileFetching===void 0)return!1;if(F(this,H).call(this,z))N&&(N.has="stale",F(this,U).call(this,N,z));else return T&&F(this,X).call(this,z),N&&(N.has="hit",F(this,U).call(this,N,z)),!0}else N&&(N.has="miss");return!1}peek(p,y={}){let{allowStale:T=this.allowStale}=y,N=F(this,k).get(p);if(N===void 0||!T&&F(this,H).call(this,N))return;let z=F(this,x)[N];return Le(this,V,ot).call(this,z)?z.__staleWhileFetching:z}async fetch(p,y={}){let{allowStale:T=this.allowStale,updateAgeOnGet:N=this.updateAgeOnGet,noDeleteOnStaleGet:z=this.noDeleteOnStaleGet,ttl:ie=this.ttl,noDisposeOnSet:q=this.noDisposeOnSet,size:J=0,sizeCalculation:Oe=this.sizeCalculation,noUpdateTTL:Me=this.noUpdateTTL,noDeleteOnFetchRejection:Ne=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:Fe=this.allowStaleOnFetchRejection,ignoreFetchAbort:nt=this.ignoreFetchAbort,allowStaleOnFetchAbort:rt=this.allowStaleOnFetchAbort,context:Ke,forceRefresh:Xe=!1,status:De,signal:Ye}=y;if(!F(this,Q))return De&&(De.fetch="get"),this.get(p,{allowStale:T,updateAgeOnGet:N,noDeleteOnStaleGet:z,status:De});let Ze={allowStale:T,updateAgeOnGet:N,noDeleteOnStaleGet:z,ttl:ie,noDisposeOnSet:q,size:J,sizeCalculation:Oe,noUpdateTTL:Me,noDeleteOnFetchRejection:Ne,allowStaleOnFetchRejection:Fe,allowStaleOnFetchAbort:rt,ignoreFetchAbort:nt,status:De,signal:Ye},lt=F(this,k).get(p);if(lt===void 0){De&&(De.fetch="miss");let ct=Le(this,V,cn).call(this,p,lt,Ze,Ke);return ct.__returned=ct}else{let ct=F(this,x)[lt];if(Le(this,V,ot).call(this,ct)){let xe=T&&ct.__staleWhileFetching!==void 0;return De&&(De.fetch="inflight",xe&&(De.returnedStale=!0)),xe?ct.__staleWhileFetching:ct.__returned=ct}let Et=F(this,H).call(this,lt);if(!Xe&&!Et)return De&&(De.fetch="hit"),Le(this,V,Sr).call(this,lt),N&&F(this,X).call(this,lt),De&&F(this,U).call(this,De,lt),ct;let j=Le(this,V,cn).call(this,p,lt,Ze,Ke),D=j.__staleWhileFetching!==void 0&&T;return De&&(De.fetch=Et?"stale":"refresh",D&&Et&&(De.returnedStale=!0)),D?j.__staleWhileFetching:j.__returned=j}}async forceFetch(p,y={}){let T=await this.fetch(p,y);if(T===void 0)throw new Error("fetch() returned undefined");return T}memo(p,y={}){let T=F(this,P);if(!T)throw new Error("no memoMethod provided to constructor");let{context:N,forceRefresh:z,...ie}=y,q=this.get(p,ie);if(!z&&q!==void 0)return q;let J=T(p,q,{options:ie,context:N});return this.set(p,J,ie),J}get(p,y={}){let{allowStale:T=this.allowStale,updateAgeOnGet:N=this.updateAgeOnGet,noDeleteOnStaleGet:z=this.noDeleteOnStaleGet,status:ie}=y,q=F(this,k).get(p);if(q!==void 0){let J=F(this,x)[q],Oe=Le(this,V,ot).call(this,J);return ie&&F(this,U).call(this,ie,q),F(this,H).call(this,q)?(ie&&(ie.get="stale"),Oe?(ie&&T&&J.__staleWhileFetching!==void 0&&(ie.returnedStale=!0),T?J.__staleWhileFetching:void 0):(z||Le(this,V,Kt).call(this,p,"expire"),ie&&T&&(ie.returnedStale=!0),T?J:void 0)):(ie&&(ie.get="hit"),Oe?J.__staleWhileFetching:(Le(this,V,Sr).call(this,q),N&&F(this,X).call(this,q),J))}else ie&&(ie.get="miss")}delete(p){return Le(this,V,Kt).call(this,p,"delete")}clear(){return Le(this,V,Qo).call(this,"delete")}},g=new WeakMap,S=new WeakMap,E=new WeakMap,v=new WeakMap,C=new WeakMap,P=new WeakMap,I=new WeakMap,O=new WeakMap,k=new WeakMap,M=new WeakMap,x=new WeakMap,W=new WeakMap,$=new WeakMap,L=new WeakMap,le=new WeakMap,re=new WeakMap,ee=new WeakMap,ue=new WeakMap,G=new WeakMap,oe=new WeakMap,R=new WeakMap,Q=new WeakMap,he=new WeakMap,V=new WeakSet,Ho=function(){let p=new c(F(this,g)),y=new c(F(this,g));$e(this,oe,p),$e(this,G,y),$e(this,ae,(z,ie,q=l.now())=>{if(y[z]=ie!==0?q:0,p[z]=ie,ie!==0&&this.ttlAutopurge){let J=setTimeout(()=>{F(this,H).call(this,z)&&Le(this,V,Kt).call(this,F(this,M)[z],"expire")},ie+1);J.unref&&J.unref()}}),$e(this,X,z=>{y[z]=p[z]!==0?l.now():0}),$e(this,U,(z,ie)=>{if(p[ie]){let q=p[ie],J=y[ie];if(!q||!J)return;z.ttl=q,z.start=J,z.now=T||N();let Oe=z.now-J;z.remainingTTL=q-Oe}});let T=0,N=()=>{let z=l.now();if(this.ttlResolution>0){T=z;let ie=setTimeout(()=>T=0,this.ttlResolution);ie.unref&&ie.unref()}return z};this.getRemainingTTL=z=>{let ie=F(this,k).get(z);if(ie===void 0)return 0;let q=p[ie],J=y[ie];if(!q||!J)return 1/0;let Oe=(T||N())-J;return q-Oe},$e(this,H,z=>{let ie=y[z],q=p[z];return!!q&&!!ie&&(T||N())-ie>q})},X=new WeakMap,U=new WeakMap,ae=new WeakMap,H=new WeakMap,mu=function(){let p=new c(F(this,g));$e(this,O,0),$e(this,ue,p),$e(this,ne,y=>{$e(this,O,F(this,O)-p[y]),p[y]=0}),$e(this,ce,(y,T,N,z)=>{if(Le(this,V,ot).call(this,T))return 0;if(!e(N))if(z){if(typeof z!="function")throw new TypeError("sizeCalculation must be a function");if(N=z(T,y),!e(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}),$e(this,ve,(y,T,N)=>{if(p[y]=T,F(this,S)){let z=F(this,S)-p[y];for(;F(this,O)>z;)Le(this,V,un).call(this,!0)}$e(this,O,F(this,O)+p[y]),N&&(N.entrySize=T,N.totalCalculatedSize=F(this,O))})},ne=new WeakMap,ve=new WeakMap,ce=new WeakMap,Vt=function*({allowStale:p=this.allowStale}={}){if(F(this,I))for(let y=F(this,le);!(!Le(this,V,Go).call(this,y)||((p||!F(this,H).call(this,y))&&(yield y),y===F(this,L)));)y=F(this,$)[y]},zt=function*({allowStale:p=this.allowStale}={}){if(F(this,I))for(let y=F(this,L);!(!Le(this,V,Go).call(this,y)||((p||!F(this,H).call(this,y))&&(yield y),y===F(this,le)));)y=F(this,W)[y]},Go=function(p){return p!==void 0&&F(this,k).get(F(this,M)[p])===p},un=function(p){var z,ie;let y=F(this,L),T=F(this,M)[y],N=F(this,x)[y];return F(this,Q)&&Le(this,V,ot).call(this,N)?N.__abortController.abort(new Error("evicted")):(F(this,R)||F(this,he))&&(F(this,R)&&((z=F(this,E))==null||z.call(this,N,T,"evict")),F(this,he)&&((ie=F(this,ee))==null||ie.push([N,T,"evict"]))),F(this,ne).call(this,y),p&&(F(this,M)[y]=void 0,F(this,x)[y]=void 0,F(this,re).push(y)),F(this,I)===1?($e(this,L,$e(this,le,0)),F(this,re).length=0):$e(this,L,F(this,W)[y]),F(this,k).delete(T),ln(this,I)._--,y},cn=function(p,y,T,N){let z=y===void 0?void 0:F(this,x)[y];if(Le(this,V,ot).call(this,z))return z;let ie=new r,{signal:q}=T;q==null||q.addEventListener("abort",()=>ie.abort(q.reason),{signal:ie.signal});let J={signal:ie.signal,options:T,context:N},Oe=(Ke,Xe=!1)=>{let{aborted:De}=ie.signal,Ye=T.ignoreFetchAbort&&Ke!==void 0;if(T.status&&(De&&!Xe?(T.status.fetchAborted=!0,T.status.fetchError=ie.signal.reason,Ye&&(T.status.fetchAbortIgnored=!0)):T.status.fetchResolved=!0),De&&!Ye&&!Xe)return Ne(ie.signal.reason);let Ze=nt;return F(this,x)[y]===nt&&(Ke===void 0?Ze.__staleWhileFetching?F(this,x)[y]=Ze.__staleWhileFetching:Le(this,V,Kt).call(this,p,"fetch"):(T.status&&(T.status.fetchUpdated=!0),this.set(p,Ke,J.options))),Ke},Me=Ke=>(T.status&&(T.status.fetchRejected=!0,T.status.fetchError=Ke),Ne(Ke)),Ne=Ke=>{let{aborted:Xe}=ie.signal,De=Xe&&T.allowStaleOnFetchAbort,Ye=De||T.allowStaleOnFetchRejection,Ze=Ye||T.noDeleteOnFetchRejection,lt=nt;if(F(this,x)[y]===nt&&(!Ze||lt.__staleWhileFetching===void 0?Le(this,V,Kt).call(this,p,"fetch"):De||(F(this,x)[y]=lt.__staleWhileFetching)),Ye)return T.status&&lt.__staleWhileFetching!==void 0&&(T.status.returnedStale=!0),lt.__staleWhileFetching;if(lt.__returned===lt)throw Ke},Fe=(Ke,Xe)=>{var Ye;let De=(Ye=F(this,C))==null?void 0:Ye.call(this,p,z,J);De&&De instanceof Promise&&De.then(Ze=>Ke(Ze===void 0?void 0:Ze),Xe),ie.signal.addEventListener("abort",()=>{(!T.ignoreFetchAbort||T.allowStaleOnFetchAbort)&&(Ke(void 0),T.allowStaleOnFetchAbort&&(Ke=Ze=>Oe(Ze,!0)))})};T.status&&(T.status.fetchDispatched=!0);let nt=new Promise(Fe).then(Oe,Me),rt=Object.assign(nt,{__abortController:ie,__staleWhileFetching:z,__returned:void 0});return y===void 0?(this.set(p,rt,{...J.options,status:void 0}),y=F(this,k).get(p)):F(this,x)[y]=rt,rt},ot=function(p){if(!F(this,Q))return!1;let y=p;return!!y&&y instanceof Promise&&y.hasOwnProperty("__staleWhileFetching")&&y.__abortController instanceof r},Yo=function(p,y){F(this,$)[y]=p,F(this,W)[p]=y},Sr=function(p){p!==F(this,le)&&(p===F(this,L)?$e(this,L,F(this,W)[p]):Le(this,V,Yo).call(this,F(this,$)[p],F(this,W)[p]),Le(this,V,Yo).call(this,F(this,le),p),$e(this,le,p))},Kt=function(p,y){var N,z,ie,q;let T=!1;if(F(this,I)!==0){let J=F(this,k).get(p);if(J!==void 0)if(T=!0,F(this,I)===1)Le(this,V,Qo).call(this,y);else{F(this,ne).call(this,J);let Oe=F(this,x)[J];if(Le(this,V,ot).call(this,Oe)?Oe.__abortController.abort(new Error("deleted")):(F(this,R)||F(this,he))&&(F(this,R)&&((N=F(this,E))==null||N.call(this,Oe,p,y)),F(this,he)&&((z=F(this,ee))==null||z.push([Oe,p,y]))),F(this,k).delete(p),F(this,M)[J]=void 0,F(this,x)[J]=void 0,J===F(this,le))$e(this,le,F(this,$)[J]);else if(J===F(this,L))$e(this,L,F(this,W)[J]);else{let Me=F(this,$)[J];F(this,W)[Me]=F(this,W)[J];let Ne=F(this,W)[J];F(this,$)[Ne]=F(this,$)[J]}ln(this,I)._--,F(this,re).push(J)}}if(F(this,he)&&((ie=F(this,ee))!=null&&ie.length)){let J=F(this,ee),Oe;for(;Oe=J==null?void 0:J.shift();)(q=F(this,v))==null||q.call(this,...Oe)}return T},Qo=function(p){var y,T,N;for(let z of Le(this,V,zt).call(this,{allowStale:!0})){let ie=F(this,x)[z];if(Le(this,V,ot).call(this,ie))ie.__abortController.abort(new Error("deleted"));else{let q=F(this,M)[z];F(this,R)&&((y=F(this,E))==null||y.call(this,ie,q,p)),F(this,he)&&((T=F(this,ee))==null||T.push([ie,q,p]))}}if(F(this,k).clear(),F(this,x).fill(void 0),F(this,M).fill(void 0),F(this,oe)&&F(this,G)&&(F(this,oe).fill(0),F(this,G).fill(0)),F(this,ue)&&F(this,ue).fill(0),$e(this,L,0),$e(this,le,0),F(this,re).length=0,$e(this,O,0),$e(this,I,0),F(this,he)&&F(this,ee)){let z=F(this,ee),ie;for(;ie=z==null?void 0:z.shift();)(N=F(this,v))==null||N.call(this,...ie)}},Ue);o.LRUCache=d}),Nt=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.ContainerIterator=o.Container=o.Base=void 0;var l=class{constructor(u=0){this.iteratorType=u}equals(u){return this.o===u.o}};o.ContainerIterator=l;var s=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};o.Base=s;var a=class extends s{};o.Container=a}),ac=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=Nt(),s=class extends l.Base{constructor(u=[]){super(),this.S=[];let r=this;u.forEach(function(t){r.push(t)})}clear(){this.i=0,this.S=[]}push(u){return this.S.push(u),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},a=s;o.default=a}),lc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=Nt(),s=class extends l.Base{constructor(u=[]){super(),this.j=0,this.q=[];let r=this;u.forEach(function(t){r.push(t)})}clear(){this.q=[],this.i=this.j=0}push(u){let r=this.q.length;if(this.j/r>.5&&this.j+this.i>=r&&r>4096){let t=this.i;for(let n=0;n<t;++n)this.q[n]=this.q[this.j+n];this.j=0,this.q[this.i]=u}else this.q[this.j+this.i]=u;return++this.i}pop(){if(this.i===0)return;let u=this.q[this.j++];return this.i-=1,u}front(){if(this.i!==0)return this.q[this.j]}},a=s;o.default=a}),uc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=Nt(),s=class extends l.Base{constructor(u=[],r=function(n,e){return n>e?-1:n<e?1:0},t=!0){if(super(),this.v=r,Array.isArray(u))this.C=t?[...u]:u;else{this.C=[];let e=this;u.forEach(function(i){e.C.push(i)})}this.i=this.C.length;let n=this.i>>1;for(let e=this.i-1>>1;e>=0;--e)this.k(e,n)}m(u){let r=this.C[u];for(;u>0;){let t=u-1>>1,n=this.C[t];if(this.v(n,r)<=0)break;this.C[u]=n,u=t}this.C[u]=r}k(u,r){let t=this.C[u];for(;u<r;){let n=u<<1|1,e=n+1,i=this.C[n];if(e<this.i&&this.v(i,this.C[e])>0&&(n=e,i=this.C[e]),this.v(i,t)>=0)break;this.C[u]=i,u=n}this.C[u]=t}clear(){this.i=0,this.C.length=0}push(u){this.C.push(u),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let u=this.C[0],r=this.C.pop();return this.i-=1,this.i&&(this.C[0]=r,this.k(0,this.i>>1)),u}top(){return this.C[0]}find(u){return this.C.indexOf(u)>=0}remove(u){let r=this.C.indexOf(u);return r<0?!1:(r===0?this.pop():r===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(r,1,this.C.pop()),this.i-=1,this.m(r),this.k(r,this.i>>1)),!0)}updateItem(u){let r=this.C.indexOf(u);return r<0?!1:(this.m(r),this.k(r,this.i>>1),!0)}toArray(){return[...this.C]}},a=s;o.default=a}),Pi=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=Nt(),s=class extends l.Container{},a=s;o.default=a}),Bt=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.throwIteratorAccessError=l;function l(){throw new RangeError("Iterator access denied!")}}),Ts=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.RandomIterator=void 0;var l=Nt(),s=Bt(),a=class extends l.ContainerIterator{constructor(u,r){super(r),this.o=u,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,s.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,s.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,s.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,s.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(u){this.container.setElementByPos(this.o,u)}};o.RandomIterator=a}),cc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=a(Pi()),s=Ts();function a(n){return n&&n.t?n:{default:n}}var u=class yu extends s.RandomIterator{constructor(e,i,c){super(e,c),this.container=i}copy(){return new yu(this.o,this.container,this.iteratorType)}},r=class extends l.default{constructor(n=[],e=!0){if(super(),Array.isArray(n))this.J=e?[...n]:n,this.i=n.length;else{this.J=[];let i=this;n.forEach(function(c){i.pushBack(c)})}}clear(){this.i=0,this.J.length=0}begin(){return new u(0,this)}end(){return new u(this.i,this)}rBegin(){return new u(this.i-1,this,1)}rEnd(){return new u(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(n){if(n<0||n>this.i-1)throw new RangeError;return this.J[n]}eraseElementByPos(n){if(n<0||n>this.i-1)throw new RangeError;return this.J.splice(n,1),this.i-=1,this.i}eraseElementByValue(n){let e=0;for(let i=0;i<this.i;++i)this.J[i]!==n&&(this.J[e++]=this.J[i]);return this.i=this.J.length=e,this.i}eraseElementByIterator(n){let e=n.o;return n=n.next(),this.eraseElementByPos(e),n}pushBack(n){return this.J.push(n),this.i+=1,this.i}popBack(){if(this.i!==0)return this.i-=1,this.J.pop()}setElementByPos(n,e){if(n<0||n>this.i-1)throw new RangeError;this.J[n]=e}insert(n,e,i=1){if(n<0||n>this.i)throw new RangeError;return this.J.splice(n,0,...new Array(i).fill(e)),this.i+=i,this.i}find(n){for(let e=0;e<this.i;++e)if(this.J[e]===n)return new u(e,this);return this.end()}reverse(){this.J.reverse()}unique(){let n=1;for(let e=1;e<this.i;++e)this.J[e]!==this.J[e-1]&&(this.J[n++]=this.J[e]);return this.i=this.J.length=n,this.i}sort(n){this.J.sort(n)}forEach(n){for(let e=0;e<this.i;++e)n(this.J[e],e,this)}[Symbol.iterator](){return(function*(){yield*this.J}).bind(this)()}},t=r;o.default=t}),fc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=u(Pi()),s=Nt(),a=Bt();function u(e){return e&&e.t?e:{default:e}}var r=class bu extends s.ContainerIterator{constructor(i,c,h,d){super(d),this.o=i,this.h=c,this.container=h,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,a.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,a.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,a.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,a.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,a.throwIteratorAccessError)(),this.o.l}set pointer(i){this.o===this.h&&(0,a.throwIteratorAccessError)(),this.o.l=i}copy(){return new bu(this.o,this.h,this.container,this.iteratorType)}},t=class extends l.default{constructor(e=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let i=this;e.forEach(function(c){i.pushBack(c)})}V(e){let{L:i,B:c}=e;i.B=c,c.L=i,e===this.p&&(this.p=c),e===this._&&(this._=i),this.i-=1}G(e,i){let c=i.B,h={l:e,L:i,B:c};i.B=h,c.L=h,i===this.h&&(this.p=h),c===this.h&&(this._=h),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new r(this.p,this.h,this)}end(){return new r(this.h,this.h,this)}rBegin(){return new r(this._,this.h,this,1)}rEnd(){return new r(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;return i.l}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;return this.V(i),this.i}eraseElementByValue(e){let i=this.p;for(;i!==this.h;)i.l===e&&this.V(i),i=i.B;return this.i}eraseElementByIterator(e){let i=e.o;return i===this.h&&(0,a.throwIteratorAccessError)(),e=e.next(),this.V(i),e}pushBack(e){return this.G(e,this._),this.i}popBack(){if(this.i===0)return;let e=this._.l;return this.V(this._),e}pushFront(e){return this.G(e,this.h),this.i}popFront(){if(this.i===0)return;let e=this.p.l;return this.V(this.p),e}setElementByPos(e,i){if(e<0||e>this.i-1)throw new RangeError;let c=this.p;for(;e--;)c=c.B;c.l=i}insert(e,i,c=1){if(e<0||e>this.i)throw new RangeError;if(c<=0)return this.i;if(e===0)for(;c--;)this.pushFront(i);else if(e===this.i)for(;c--;)this.pushBack(i);else{let h=this.p;for(let m=1;m<e;++m)h=h.B;let d=h.B;for(this.i+=c;c--;)h.B={l:i,L:h},h.B.L=h,h=h.B;h.B=d,d.L=h}return this.i}find(e){let i=this.p;for(;i!==this.h;){if(i.l===e)return new r(i,this.h,this);i=i.B}return this.end()}reverse(){if(this.i<=1)return;let e=this.p,i=this._,c=0;for(;c<<1<this.i;){let h=e.l;e.l=i.l,i.l=h,e=e.B,i=i.L,c+=1}}unique(){if(this.i<=1)return this.i;let e=this.p;for(;e!==this.h;){let i=e;for(;i.B!==this.h&&i.l===i.B.l;)i=i.B,this.i-=1;e.B=i.B,e.B.L=e,e=e.B}return this.i}sort(e){if(this.i<=1)return;let i=[];this.forEach(function(h){i.push(h)}),i.sort(e);let c=this.p;i.forEach(function(h){c.l=h,c=c.B})}merge(e){let i=this;if(this.i===0)e.forEach(function(c){i.pushBack(c)});else{let c=this.p;e.forEach(function(h){for(;c!==i.h&&c.l<=h;)c=c.B;i.G(h,c.L)})}return this.i}forEach(e){let i=this.p,c=0;for(;i!==this.h;)e(i.l,c++,this),i=i.B}[Symbol.iterator](){return(function*(){if(this.i===0)return;let e=this.p;for(;e!==this.h;)yield e.l,e=e.B}).bind(this)()}},n=t;o.default=n}),hc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=a(Pi()),s=Ts();function a(n){return n&&n.t?n:{default:n}}var u=class vu extends s.RandomIterator{constructor(e,i,c){super(e,c),this.container=i}copy(){return new vu(this.o,this.container,this.iteratorType)}},r=class extends l.default{constructor(n=[],e=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let i=(()=>{if(typeof n.length=="number")return n.length;if(typeof n.size=="number")return n.size;if(typeof n.size=="function")return n.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=e,this.P=Math.max(Math.ceil(i/this.F),1);for(let d=0;d<this.P;++d)this.A.push(new Array(this.F));let c=Math.ceil(i/this.F);this.j=this.R=(this.P>>1)-(c>>1),this.D=this.N=this.F-i%this.F>>1;let h=this;n.forEach(function(d){h.pushBack(d)})}T(){let n=[],e=Math.max(this.P>>1,1);for(let i=0;i<e;++i)n[i]=new Array(this.F);for(let i=this.j;i<this.P;++i)n[n.length]=this.A[i];for(let i=0;i<this.R;++i)n[n.length]=this.A[i];n[n.length]=[...this.A[this.R]],this.j=e,this.R=n.length-1;for(let i=0;i<e;++i)n[n.length]=new Array(this.F);this.A=n,this.P=n.length}O(n){let e=this.D+n+1,i=e%this.F,c=i-1,h=this.j+(e-i)/this.F;return i===0&&(h-=1),h%=this.P,c<0&&(c+=this.F),{curNodeBucketIndex:h,curNodePointerIndex:c}}clear(){this.A=[new Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}begin(){return new u(0,this)}end(){return new u(this.i,this)}rBegin(){return new u(this.i-1,this,1)}rEnd(){return new u(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(n){return this.i&&(this.N<this.F-1?this.N+=1:this.R<this.P-1?(this.R+=1,this.N=0):(this.R=0,this.N=0),this.R===this.j&&this.N===this.D&&this.T()),this.i+=1,this.A[this.R][this.N]=n,this.i}popBack(){if(this.i===0)return;let n=this.A[this.R][this.N];return this.i!==1&&(this.N>0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,n}pushFront(n){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=n,this.i}popFront(){if(this.i===0)return;let n=this.A[this.j][this.D];return this.i!==1&&(this.D<this.F-1?this.D+=1:this.j<this.P-1?(this.j+=1,this.D=0):(this.j=0,this.D=0)),this.i-=1,n}getElementByPos(n){if(n<0||n>this.i-1)throw new RangeError;let{curNodeBucketIndex:e,curNodePointerIndex:i}=this.O(n);return this.A[e][i]}setElementByPos(n,e){if(n<0||n>this.i-1)throw new RangeError;let{curNodeBucketIndex:i,curNodePointerIndex:c}=this.O(n);this.A[i][c]=e}insert(n,e,i=1){if(n<0||n>this.i)throw new RangeError;if(n===0)for(;i--;)this.pushFront(e);else if(n===this.i)for(;i--;)this.pushBack(e);else{let c=[];for(let h=n;h<this.i;++h)c.push(this.getElementByPos(h));this.cut(n-1);for(let h=0;h<i;++h)this.pushBack(e);for(let h=0;h<c.length;++h)this.pushBack(c[h])}return this.i}cut(n){if(n<0)return this.clear(),0;let{curNodeBucketIndex:e,curNodePointerIndex:i}=this.O(n);return this.R=e,this.N=i,this.i=n+1,this.i}eraseElementByPos(n){if(n<0||n>this.i-1)throw new RangeError;if(n===0)this.popFront();else if(n===this.i-1)this.popBack();else{let e=[];for(let c=n+1;c<this.i;++c)e.push(this.getElementByPos(c));this.cut(n),this.popBack();let i=this;e.forEach(function(c){i.pushBack(c)})}return this.i}eraseElementByValue(n){if(this.i===0)return 0;let e=[];for(let c=0;c<this.i;++c){let h=this.getElementByPos(c);h!==n&&e.push(h)}let i=e.length;for(let c=0;c<i;++c)this.setElementByPos(c,e[c]);return this.cut(i-1)}eraseElementByIterator(n){let e=n.o;return this.eraseElementByPos(e),n=n.next(),n}find(n){for(let e=0;e<this.i;++e)if(this.getElementByPos(e)===n)return new u(e,this);return this.end()}reverse(){let n=0,e=this.i-1;for(;n<e;){let i=this.getElementByPos(n);this.setElementByPos(n,this.getElementByPos(e)),this.setElementByPos(e,i),n+=1,e-=1}}unique(){if(this.i<=1)return this.i;let n=1,e=this.getElementByPos(0);for(let i=1;i<this.i;++i){let c=this.getElementByPos(i);c!==e&&(e=c,this.setElementByPos(n++,c))}for(;this.i>n;)this.popBack();return this.i}sort(n){let e=[];for(let i=0;i<this.i;++i)e.push(this.getElementByPos(i));e.sort(n);for(let i=0;i<this.i;++i)this.setElementByPos(i,e[i])}shrinkToFit(){if(this.i===0)return;let n=[];this.forEach(function(e){n.push(e)}),this.P=Math.max(Math.ceil(this.i/this.F),1),this.i=this.j=this.R=this.D=this.N=0,this.A=[];for(let e=0;e<this.P;++e)this.A.push(new Array(this.F));for(let e=0;e<n.length;++e)this.pushBack(n[e])}forEach(n){for(let e=0;e<this.i;++e)n(this.getElementByPos(e),e,this)}[Symbol.iterator](){return(function*(){for(let n=0;n<this.i;++n)yield this.getElementByPos(n)}).bind(this)()}},t=r;o.default=t}),pc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.TreeNodeEnableIndex=o.TreeNode=void 0;var l=class{constructor(a,u){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=a,this.l=u}L(){let a=this;if(a.ee===1&&a.tt.tt===a)a=a.W;else if(a.U)for(a=a.U;a.W;)a=a.W;else{let u=a.tt;for(;u.U===a;)a=u,u=a.tt;a=u}return a}B(){let a=this;if(a.W){for(a=a.W;a.U;)a=a.U;return a}else{let u=a.tt;for(;u.W===a;)a=u,u=a.tt;return a.W!==u?u:a}}te(){let a=this.tt,u=this.W,r=u.U;return a.tt===this?a.tt=u:a.U===this?a.U=u:a.W=u,u.tt=a,u.U=this,this.tt=u,this.W=r,r&&(r.tt=this),u}se(){let a=this.tt,u=this.U,r=u.W;return a.tt===this?a.tt=u:a.U===this?a.U=u:a.W=u,u.tt=a,u.W=this,this.tt=u,this.U=r,r&&(r.tt=this),u}};o.TreeNode=l;var s=class extends l{constructor(){super(...arguments),this.rt=1}te(){let a=super.te();return this.ie(),a.ie(),a}se(){let a=super.se();return this.ie(),a.ie(),a}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};o.TreeNodeEnableIndex=s}),Os=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=pc(),s=Nt(),a=Bt(),u=class extends s.Container{constructor(t=function(e,i){return e<i?-1:e>i?1:0},n=!1){super(),this.Y=void 0,this.v=t,n?(this.re=l.TreeNodeEnableIndex,this.M=function(e,i,c){let h=this.ne(e,i,c);if(h){let d=h.tt;for(;d!==this.h;)d.rt+=1,d=d.tt;let m=this.he(h);if(m){let{parentNode:b,grandParent:w,curNode:_}=m;b.ie(),w.ie(),_.ie()}}return this.i},this.V=function(e){let i=this.fe(e);for(;i!==this.h;)i.rt-=1,i=i.tt}):(this.re=l.TreeNode,this.M=function(e,i,c){let h=this.ne(e,i,c);return h&&this.he(h),this.i},this.V=this.fe),this.h=new this.re}X(t,n){let e=this.h;for(;t;){let i=this.v(t.u,n);if(i<0)t=t.W;else if(i>0)e=t,t=t.U;else return t}return e}Z(t,n){let e=this.h;for(;t;)this.v(t.u,n)<=0?t=t.W:(e=t,t=t.U);return e}$(t,n){let e=this.h;for(;t;){let i=this.v(t.u,n);if(i<0)e=t,t=t.W;else if(i>0)t=t.U;else return t}return e}rr(t,n){let e=this.h;for(;t;)this.v(t.u,n)<0?(e=t,t=t.W):t=t.U;return e}ue(t){for(;;){let n=t.tt;if(n===this.h)return;if(t.ee===1){t.ee=0;return}if(t===n.U){let e=n.W;if(e.ee===1)e.ee=0,n.ee=1,n===this.Y?this.Y=n.te():n.te();else if(e.W&&e.W.ee===1){e.ee=n.ee,n.ee=0,e.W.ee=0,n===this.Y?this.Y=n.te():n.te();return}else e.U&&e.U.ee===1?(e.ee=1,e.U.ee=0,e.se()):(e.ee=1,t=n)}else{let e=n.U;if(e.ee===1)e.ee=0,n.ee=1,n===this.Y?this.Y=n.se():n.se();else if(e.U&&e.U.ee===1){e.ee=n.ee,n.ee=0,e.U.ee=0,n===this.Y?this.Y=n.se():n.se();return}else e.W&&e.W.ee===1?(e.ee=1,e.W.ee=0,e.te()):(e.ee=1,t=n)}}}fe(t){if(this.i===1)return this.clear(),this.h;let n=t;for(;n.U||n.W;){if(n.W)for(n=n.W;n.U;)n=n.U;else n=n.U;[t.u,n.u]=[n.u,t.u],[t.l,n.l]=[n.l,t.l],t=n}this.h.U===n?this.h.U=n.tt:this.h.W===n&&(this.h.W=n.tt),this.ue(n);let e=n.tt;return n===e.U?e.U=void 0:e.W=void 0,this.i-=1,this.Y.ee=0,e}oe(t,n){return t===void 0?!1:this.oe(t.U,n)||n(t)?!0:this.oe(t.W,n)}he(t){for(;;){let n=t.tt;if(n.ee===0)return;let e=n.tt;if(n===e.U){let i=e.W;if(i&&i.ee===1){if(i.ee=n.ee=0,e===this.Y)return;e.ee=1,t=e;continue}else if(t===n.W){if(t.ee=0,t.U&&(t.U.tt=n),t.W&&(t.W.tt=e),n.W=t.U,e.U=t.W,t.U=n,t.W=e,e===this.Y)this.Y=t,this.h.tt=t;else{let c=e.tt;c.U===e?c.U=t:c.W=t}return t.tt=e.tt,n.tt=t,e.tt=t,e.ee=1,{parentNode:n,grandParent:e,curNode:t}}else n.ee=0,e===this.Y?this.Y=e.se():e.se(),e.ee=1}else{let i=e.U;if(i&&i.ee===1){if(i.ee=n.ee=0,e===this.Y)return;e.ee=1,t=e;continue}else if(t===n.U){if(t.ee=0,t.U&&(t.U.tt=e),t.W&&(t.W.tt=n),e.W=t.U,n.U=t.W,t.U=e,t.W=n,e===this.Y)this.Y=t,this.h.tt=t;else{let c=e.tt;c.U===e?c.U=t:c.W=t}return t.tt=e.tt,n.tt=t,e.tt=t,e.ee=1,{parentNode:n,grandParent:e,curNode:t}}else n.ee=0,e===this.Y?this.Y=e.te():e.te(),e.ee=1}return}}ne(t,n,e){if(this.Y===void 0){this.i+=1,this.Y=new this.re(t,n),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let i,c=this.h.U,h=this.v(c.u,t);if(h===0){c.l=n;return}else if(h>0)c.U=new this.re(t,n),c.U.tt=c,i=c.U,this.h.U=i;else{let d=this.h.W,m=this.v(d.u,t);if(m===0){d.l=n;return}else if(m<0)d.W=new this.re(t,n),d.W.tt=d,i=d.W,this.h.W=i;else{if(e!==void 0){let b=e.o;if(b!==this.h){let w=this.v(b.u,t);if(w===0){b.l=n;return}else if(w>0){let _=b.L(),A=this.v(_.u,t);if(A===0){_.l=n;return}else A<0&&(i=new this.re(t,n),_.W===void 0?(_.W=i,i.tt=_):(b.U=i,i.tt=b))}}}if(i===void 0)for(i=this.Y;;){let b=this.v(i.u,t);if(b>0){if(i.U===void 0){i.U=new this.re(t,n),i.U.tt=i,i=i.U;break}i=i.U}else if(b<0){if(i.W===void 0){i.W=new this.re(t,n),i.W.tt=i,i=i.W;break}i=i.W}else{i.l=n;return}}}}return this.i+=1,i}I(t,n){for(;t;){let e=this.v(t.u,n);if(e<0)t=t.W;else if(e>0)t=t.U;else return t}return t||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(t,n){let e=t.o;if(e===this.h&&(0,a.throwIteratorAccessError)(),this.i===1)return e.u=n,!0;if(e===this.h.U)return this.v(e.B().u,n)>0?(e.u=n,!0):!1;if(e===this.h.W)return this.v(e.L().u,n)<0?(e.u=n,!0):!1;let i=e.L().u;if(this.v(i,n)>=0)return!1;let c=e.B().u;return this.v(c,n)<=0?!1:(e.u=n,!0)}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let n=0,e=this;return this.oe(this.Y,function(i){return t===n?(e.V(i),!0):(n+=1,!1)}),this.i}eraseElementByKey(t){if(this.i===0)return!1;let n=this.I(this.Y,t);return n===this.h?!1:(this.V(n),!0)}eraseElementByIterator(t){let n=t.o;n===this.h&&(0,a.throwIteratorAccessError)();let e=n.W===void 0;return t.iteratorType===0?e&&t.next():(!e||n.U===void 0)&&t.next(),this.V(n),t}forEach(t){let n=0;for(let e of this)t(e,n++,this)}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let n,e=0;for(let i of this){if(e===t){n=i;break}e+=1}return n}getHeight(){if(this.i===0)return 0;let t=function(n){return n?Math.max(t(n.U),t(n.W))+1:0};return t(this.Y)}},r=u;o.default=r}),Ps=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=Nt(),s=Bt(),a=class extends l.ContainerIterator{constructor(r,t,n){super(n),this.o=r,this.h=t,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,s.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,s.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let r=this.o,t=this.h.tt;if(r===this.h)return t?t.rt-1:0;let n=0;for(r.U&&(n+=r.U.rt);r!==t;){let e=r.tt;r===e.W&&(n+=1,e.U&&(n+=e.U.rt)),r=e}return n}},u=a;o.default=u}),dc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=u(Os()),s=u(Ps()),a=Bt();function u(e){return e&&e.t?e:{default:e}}var r=class wu extends s.default{constructor(i,c,h,d){super(i,c,d),this.container=h}get pointer(){return this.o===this.h&&(0,a.throwIteratorAccessError)(),this.o.u}copy(){return new wu(this.o,this.h,this.container,this.iteratorType)}},t=class extends l.default{constructor(e=[],i,c){super(i,c);let h=this;e.forEach(function(d){h.insert(d)})}*K(e){e!==void 0&&(yield*this.K(e.U),yield e.u,yield*this.K(e.W))}begin(){return new r(this.h.U||this.h,this.h,this)}end(){return new r(this.h,this.h,this)}rBegin(){return new r(this.h.W||this.h,this.h,this,1)}rEnd(){return new r(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(e,i){return this.M(e,void 0,i)}find(e){let i=this.I(this.Y,e);return new r(i,this.h,this)}lowerBound(e){let i=this.X(this.Y,e);return new r(i,this.h,this)}upperBound(e){let i=this.Z(this.Y,e);return new r(i,this.h,this)}reverseLowerBound(e){let i=this.$(this.Y,e);return new r(i,this.h,this)}reverseUpperBound(e){let i=this.rr(this.Y,e);return new r(i,this.h,this)}union(e){let i=this;return e.forEach(function(c){i.insert(c)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},n=t;o.default=n}),gc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=u(Os()),s=u(Ps()),a=Bt();function u(e){return e&&e.t?e:{default:e}}var r=class _u extends s.default{constructor(i,c,h,d){super(i,c,d),this.container=h}get pointer(){this.o===this.h&&(0,a.throwIteratorAccessError)();let i=this;return new Proxy([],{get(c,h){if(h==="0")return i.o.u;if(h==="1")return i.o.l},set(c,h,d){if(h!=="1")throw new TypeError("props must be 1");return i.o.l=d,!0}})}copy(){return new _u(this.o,this.h,this.container,this.iteratorType)}},t=class extends l.default{constructor(e=[],i,c){super(i,c);let h=this;e.forEach(function(d){h.setElement(d[0],d[1])})}*K(e){e!==void 0&&(yield*this.K(e.U),yield[e.u,e.l],yield*this.K(e.W))}begin(){return new r(this.h.U||this.h,this.h,this)}end(){return new r(this.h,this.h,this)}rBegin(){return new r(this.h.W||this.h,this.h,this,1)}rEnd(){return new r(this.h,this.h,this,1)}front(){if(this.i===0)return;let e=this.h.U;return[e.u,e.l]}back(){if(this.i===0)return;let e=this.h.W;return[e.u,e.l]}lowerBound(e){let i=this.X(this.Y,e);return new r(i,this.h,this)}upperBound(e){let i=this.Z(this.Y,e);return new r(i,this.h,this)}reverseLowerBound(e){let i=this.$(this.Y,e);return new r(i,this.h,this)}reverseUpperBound(e){let i=this.rr(this.Y,e);return new r(i,this.h,this)}setElement(e,i,c){return this.M(e,i,c)}find(e){let i=this.I(this.Y,e);return new r(i,this.h,this)}getElementByKey(e){return this.I(this.Y,e).l}union(e){let i=this;return e.forEach(function(c){i.setElement(c[0],c[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},n=t;o.default=n}),Cs=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=l;function l(s){let a=typeof s;return a==="object"&&s!==null||a==="function"}}),js=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.HashContainerIterator=o.HashContainer=void 0;var l=Nt(),s=u(Cs()),a=Bt();function u(n){return n&&n.t?n:{default:n}}var r=class extends l.ContainerIterator{constructor(n,e,i){super(i),this.o=n,this.h=e,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,a.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,a.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,a.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,a.throwIteratorAccessError)(),this.o=this.o.L,this})}};o.HashContainerIterator=r;var t=class extends l.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(n){let{L:e,B:i}=n;e.B=i,i.L=e,n===this.p&&(this.p=i),n===this._&&(this._=e),this.i-=1}M(n,e,i){i===void 0&&(i=(0,s.default)(n));let c;if(i){let h=n[this.HASH_TAG];if(h!==void 0)return this.H[h].l=e,this.i;Object.defineProperty(n,this.HASH_TAG,{value:this.H.length,configurable:!0}),c={u:n,l:e,L:this._,B:this.h},this.H.push(c)}else{let h=this.g[n];if(h)return h.l=e,this.i;c={u:n,l:e,L:this._,B:this.h},this.g[n]=c}return this.i===0?(this.p=c,this.h.B=c):this._.B=c,this._=c,this.h.L=c,++this.i}I(n,e){if(e===void 0&&(e=(0,s.default)(n)),e){let i=n[this.HASH_TAG];return i===void 0?this.h:this.H[i]}else return this.g[n]||this.h}clear(){let n=this.HASH_TAG;this.H.forEach(function(e){delete e.u[n]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(n,e){let i;if(e===void 0&&(e=(0,s.default)(n)),e){let c=n[this.HASH_TAG];if(c===void 0)return!1;delete n[this.HASH_TAG],i=this.H[c],delete this.H[c]}else{if(i=this.g[n],i===void 0)return!1;delete this.g[n]}return this.V(i),!0}eraseElementByIterator(n){let e=n.o;return e===this.h&&(0,a.throwIteratorAccessError)(),this.V(e),n.next()}eraseElementByPos(n){if(n<0||n>this.i-1)throw new RangeError;let e=this.p;for(;n--;)e=e.B;return this.V(e),this.i}};o.HashContainer=t}),mc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=js(),s=Bt(),a=class Su extends l.HashContainerIterator{constructor(n,e,i,c){super(n,e,c),this.container=i}get pointer(){return this.o===this.h&&(0,s.throwIteratorAccessError)(),this.o.u}copy(){return new Su(this.o,this.h,this.container,this.iteratorType)}},u=class extends l.HashContainer{constructor(t=[]){super();let n=this;t.forEach(function(e){n.insert(e)})}begin(){return new a(this.p,this.h,this)}end(){return new a(this.h,this.h,this)}rBegin(){return new a(this._,this.h,this,1)}rEnd(){return new a(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(t,n){return this.M(t,void 0,n)}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let n=this.p;for(;t--;)n=n.B;return n.u}find(t,n){let e=this.I(t,n);return new a(e,this.h,this)}forEach(t){let n=0,e=this.p;for(;e!==this.h;)t(e.u,n++,this),e=e.B}[Symbol.iterator](){return(function*(){let t=this.p;for(;t!==this.h;)yield t.u,t=t.B}).bind(this)()}},r=u;o.default=r}),yc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),o.default=void 0;var l=js(),s=u(Cs()),a=Bt();function u(e){return e&&e.t?e:{default:e}}var r=class Eu extends l.HashContainerIterator{constructor(i,c,h,d){super(i,c,d),this.container=h}get pointer(){this.o===this.h&&(0,a.throwIteratorAccessError)();let i=this;return new Proxy([],{get(c,h){if(h==="0")return i.o.u;if(h==="1")return i.o.l},set(c,h,d){if(h!=="1")throw new TypeError("props must be 1");return i.o.l=d,!0}})}copy(){return new Eu(this.o,this.h,this.container,this.iteratorType)}},t=class extends l.HashContainer{constructor(e=[]){super();let i=this;e.forEach(function(c){i.setElement(c[0],c[1])})}begin(){return new r(this.p,this.h,this)}end(){return new r(this.h,this.h,this)}rBegin(){return new r(this._,this.h,this,1)}rEnd(){return new r(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(e,i,c){return this.M(e,i,c)}getElementByKey(e,i){if(i===void 0&&(i=(0,s.default)(e)),i){let h=e[this.HASH_TAG];return h!==void 0?this.H[h].l:void 0}let c=this.g[e];return c?c.l:void 0}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;return[i.u,i.l]}find(e,i){let c=this.I(e,i);return new r(c,this.h,this)}forEach(e){let i=0,c=this.p;for(;c!==this.h;)e([c.u,c.l],i++,this),c=c.B}[Symbol.iterator](){return(function*(){let e=this.p;for(;e!==this.h;)yield[e.u,e.l],e=e.B}).bind(this)()}},n=t;o.default=n}),bc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"t",{value:!0}),Object.defineProperty(o,"Deque",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(o,"HashMap",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(o,"HashSet",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(o,"LinkList",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(o,"OrderedMap",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(o,"OrderedSet",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(o,"PriorityQueue",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(o,"Queue",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(o,"Stack",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(o,"Vector",{enumerable:!0,get:function(){return u.default}});var l=h(ac()),s=h(lc()),a=h(uc()),u=h(cc()),r=h(fc()),t=h(hc()),n=h(dc()),e=h(gc()),i=h(mc()),c=h(yc());function h(d){return d&&d.t?d:{default:d}}}),vc=_e((o,l)=>{de(),me(),ge();var s=bc().OrderedSet,a=Mt()("number-allocator:trace"),u=Mt()("number-allocator:error");function r(n,e){this.low=n,this.high=e}r.prototype.equals=function(n){return this.low===n.low&&this.high===n.high},r.prototype.compare=function(n){return this.low<n.low&&this.high<n.low?-1:n.low<this.low&&n.high<this.low?1:0};function t(n,e){if(!(this instanceof t))return new t(n,e);this.min=n,this.max=e,this.ss=new s([],(i,c)=>i.compare(c)),a("Create"),this.clear()}t.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},t.prototype.alloc=function(){if(this.ss.size()===0)return a("alloc():empty"),null;let n=this.ss.begin(),e=n.pointer.low,i=n.pointer.high,c=e;return c+1<=i?this.ss.updateKeyByIterator(n,new r(e+1,i)):this.ss.eraseElementByPos(0),a("alloc():"+c),c},t.prototype.use=function(n){let e=new r(n,n),i=this.ss.lowerBound(e);if(!i.equals(this.ss.end())){let c=i.pointer.low,h=i.pointer.high;return i.pointer.equals(e)?(this.ss.eraseElementByIterator(i),a("use():"+n),!0):c>n?!1:c===n?(this.ss.updateKeyByIterator(i,new r(c+1,h)),a("use():"+n),!0):h===n?(this.ss.updateKeyByIterator(i,new r(c,h-1)),a("use():"+n),!0):(this.ss.updateKeyByIterator(i,new r(n+1,h)),this.ss.insert(new r(c,n-1)),a("use():"+n),!0)}return a("use():failed"),!1},t.prototype.free=function(n){if(n<this.min||n>this.max){u("free():"+n+" is out of range");return}let e=new r(n,n),i=this.ss.upperBound(e);if(i.equals(this.ss.end())){if(i.equals(this.ss.begin())){this.ss.insert(e);return}i.pre();let c=i.pointer.high;i.pointer.high+1===n?this.ss.updateKeyByIterator(i,new r(c,n)):this.ss.insert(e)}else if(i.equals(this.ss.begin()))if(n+1===i.pointer.low){let c=i.pointer.high;this.ss.updateKeyByIterator(i,new r(n,c))}else this.ss.insert(e);else{let c=i.pointer.low,h=i.pointer.high;i.pre();let d=i.pointer.low;i.pointer.high+1===n?n+1===c?(this.ss.eraseElementByIterator(i),this.ss.updateKeyByIterator(i,new r(d,h))):this.ss.updateKeyByIterator(i,new r(d,n)):n+1===c?(this.ss.eraseElementByIterator(i.next()),this.ss.insert(new r(n,h))):this.ss.insert(e)}a("free():"+n)},t.prototype.clear=function(){a("clear()"),this.ss.clear(),this.ss.insert(new r(this.min,this.max))},t.prototype.intervalCount=function(){return this.ss.size()},t.prototype.dump=function(){console.log("length:"+this.ss.size());for(let n of this.ss)console.log(n)},l.exports=t}),Rs=_e((o,l)=>{de(),me(),ge();var s=vc();l.exports.NumberAllocator=s}),wc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0});var l=sc(),s=Rs(),a=class{constructor(u){Pe(this,"aliasToTopic");Pe(this,"topicToAlias");Pe(this,"max");Pe(this,"numberAllocator");Pe(this,"length");u>0&&(this.aliasToTopic=new l.LRUCache({max:u}),this.topicToAlias={},this.numberAllocator=new s.NumberAllocator(1,u),this.max=u,this.length=0)}put(u,r){if(r===0||r>this.max)return!1;let t=this.aliasToTopic.get(r);return t&&delete this.topicToAlias[t],this.aliasToTopic.set(r,u),this.topicToAlias[u]=r,this.numberAllocator.use(r),this.length=this.aliasToTopic.size,!0}getTopicByAlias(u){return this.aliasToTopic.get(u)}getAliasByTopic(u){let r=this.topicToAlias[u];return typeof r<"u"&&this.aliasToTopic.get(r),r}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){return this.numberAllocator.firstVacant()||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};o.default=a}),_c=_e(o=>{de(),me(),ge();var l=o&&o.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(o,"__esModule",{value:!0});var s=Or(),a=l(wc()),u=ar(),r=(t,n)=>{t.log("_handleConnack");let{options:e}=t,i=e.protocolVersion===5?n.reasonCode:n.returnCode;if(clearTimeout(t.connackTimer),delete t.topicAliasSend,n.properties){if(n.properties.topicAliasMaximum){if(n.properties.topicAliasMaximum>65535){t.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}n.properties.topicAliasMaximum>0&&(t.topicAliasSend=new a.default(n.properties.topicAliasMaximum))}n.properties.serverKeepAlive&&e.keepalive&&(e.keepalive=n.properties.serverKeepAlive),n.properties.maximumPacketSize&&(e.properties||(e.properties={}),e.properties.maximumPacketSize=n.properties.maximumPacketSize)}if(i===0)t.reconnecting=!1,t._onConnect(n);else if(i>0){let c=new u.ErrorWithReasonCode(`Connection refused: ${s.ReasonCodes[i]}`,i);t.emit("error",c),t.options.reconnectOnConnackError&&t._cleanUp(!0)}};o.default=r}),Sc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0});var l=(s,a,u)=>{s.log("handling pubrel packet");let r=typeof u<"u"?u:s.noop,{messageId:t}=a,n={cmd:"pubcomp",messageId:t};s.incomingStore.get(a,(e,i)=>{e?s._sendPacket(n,r):(s.emit("message",i.topic,i.payload,i),s.handleMessage(i,c=>{if(c)return r(c);s.incomingStore.del(i,s.noop),s._sendPacket(n,r)}))})};o.default=l}),Ec=_e(o=>{de(),me(),ge();var l=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(o,"__esModule",{value:!0});var s=l(nc()),a=l(oc()),u=l(_c()),r=l(Or()),t=l(Sc()),n=(e,i,c)=>{let{options:h}=e;if(h.protocolVersion===5&&h.properties&&h.properties.maximumPacketSize&&h.properties.maximumPacketSize<i.length)return e.emit("error",new Error(`exceeding packets size ${i.cmd}`)),e.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),e;switch(e.log("_handlePacket :: emitting packetreceive"),e.emit("packetreceive",i),i.cmd){case"publish":(0,s.default)(e,i,c);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":e.reschedulePing(),(0,r.default)(e,i),c();break;case"pubrel":e.reschedulePing(),(0,t.default)(e,i,c);break;case"connack":(0,u.default)(e,i),c();break;case"auth":e.reschedulePing(),(0,a.default)(e,i),c();break;case"pingresp":e.log("_handlePacket :: received pingresp"),e.reschedulePing(!0),c();break;case"disconnect":e.emit("disconnect",i),c();break;default:e.log("_handlePacket :: unknown command"),c();break}};o.default=n}),Ms=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0});var l=class{constructor(){Pe(this,"nextId");this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let s=this.nextId++;return this.nextId===65536&&(this.nextId=1),s}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(s){return!0}deallocate(s){}clear(){}};o.default=l}),Ac=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0});var l=class{constructor(s){Pe(this,"aliasToTopic");Pe(this,"max");Pe(this,"length");this.aliasToTopic={},this.max=s}put(s,a){return a===0||a>this.max?!1:(this.aliasToTopic[a]=s,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(s){return this.aliasToTopic[s]}clear(){this.aliasToTopic={}}};o.default=l}),xc=_e(o=>{de(),me(),ge();var l=o&&o.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(o,"__esModule",{value:!0}),o.TypedEventEmitter=void 0;var s=l((Qt(),tt(Ut))),a=ar(),u=class{};o.TypedEventEmitter=u,(0,a.applyMixin)(u,s.default)}),Pr=_e((o,l)=>{de(),me(),ge();function s(a){"@babel/helpers - typeof";return l.exports=s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},l.exports.__esModule=!0,l.exports.default=l.exports,s(a)}l.exports=s,l.exports.__esModule=!0,l.exports.default=l.exports}),Ic=_e((o,l)=>{de(),me(),ge();var s=Pr().default;function a(u,r){if(s(u)!="object"||!u)return u;var t=u[Symbol.toPrimitive];if(t!==void 0){var n=t.call(u,r||"default");if(s(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(u)}l.exports=a,l.exports.__esModule=!0,l.exports.default=l.exports}),kc=_e((o,l)=>{de(),me(),ge();var s=Pr().default,a=Ic();function u(r){var t=a(r,"string");return s(t)=="symbol"?t:t+""}l.exports=u,l.exports.__esModule=!0,l.exports.default=l.exports}),Tc=_e((o,l)=>{de(),me(),ge();var s=kc();function a(u,r,t){return(r=s(r))in u?Object.defineProperty(u,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[r]=t,u}l.exports=a,l.exports.__esModule=!0,l.exports.default=l.exports}),Oc=_e((o,l)=>{de(),me(),ge();function s(a){if(Array.isArray(a))return a}l.exports=s,l.exports.__esModule=!0,l.exports.default=l.exports}),Pc=_e((o,l)=>{de(),me(),ge();function s(a,u){var r=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(r!=null){var t,n,e,i,c=[],h=!0,d=!1;try{if(e=(r=r.call(a)).next,u===0){if(Object(r)!==r)return;h=!1}else for(;!(h=(t=e.call(r)).done)&&(c.push(t.value),c.length!==u);h=!0);}catch(m){d=!0,n=m}finally{try{if(!h&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(d)throw n}}return c}}l.exports=s,l.exports.__esModule=!0,l.exports.default=l.exports}),Cc=_e((o,l)=>{de(),me(),ge();function s(a,u){(u==null||u>a.length)&&(u=a.length);for(var r=0,t=Array(u);r<u;r++)t[r]=a[r];return t}l.exports=s,l.exports.__esModule=!0,l.exports.default=l.exports}),jc=_e((o,l)=>{de(),me(),ge();var s=Cc();function a(u,r){if(u){if(typeof u=="string")return s(u,r);var t={}.toString.call(u).slice(8,-1);return t==="Object"&&u.constructor&&(t=u.constructor.name),t==="Map"||t==="Set"?Array.from(u):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?s(u,r):void 0}}l.exports=a,l.exports.__esModule=!0,l.exports.default=l.exports}),Rc=_e((o,l)=>{de(),me(),ge();function s(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
32
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}l.exports=s,l.exports.__esModule=!0,l.exports.default=l.exports}),Mc=_e((o,l)=>{de(),me(),ge();var s=Oc(),a=Pc(),u=jc(),r=Rc();function t(n,e){return s(n)||a(n,e)||u(n,e)||r()}l.exports=t,l.exports.__esModule=!0,l.exports.default=l.exports}),Ns=_e((o,l)=>{de(),me(),ge(),function(s,a){typeof o=="object"&&typeof l<"u"?a(o):typeof define=="function"&&define.amd?define(["exports"],a):(s=typeof globalThis<"u"?globalThis:s||self,a(s.fastUniqueNumbers={}))}(o,function(s){var a=function(m){return function(b){var w=m(b);return b.add(w),w}},u=function(m){return function(b,w){return m.set(b,w),w}},r=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,t=536870912,n=t*2,e=function(m,b){return function(w){var _=b.get(w),A=_===void 0?w.size:_<n?_+1:0;if(!w.has(A))return m(w,A);if(w.size<t){for(;w.has(A);)A=Math.floor(Math.random()*n);return m(w,A)}if(w.size>r)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;w.has(A);)A=Math.floor(Math.random()*r);return m(w,A)}},i=new WeakMap,c=u(i),h=e(c,i),d=a(h);s.addUniqueNumber=d,s.generateUniqueNumber=h})}),Nc=_e((o,l)=>{de(),me(),ge();function s(u,r,t,n,e,i,c){try{var h=u[i](c),d=h.value}catch(m){return void t(m)}h.done?r(d):Promise.resolve(d).then(n,e)}function a(u){return function(){var r=this,t=arguments;return new Promise(function(n,e){var i=u.apply(r,t);function c(d){s(i,n,e,c,h,"next",d)}function h(d){s(i,n,e,c,h,"throw",d)}c(void 0)})}}l.exports=a,l.exports.__esModule=!0,l.exports.default=l.exports}),Bs=_e((o,l)=>{de(),me(),ge();function s(a,u){this.v=a,this.k=u}l.exports=s,l.exports.__esModule=!0,l.exports.default=l.exports}),Ls=_e((o,l)=>{de(),me(),ge();function s(a,u,r,t){var n=Object.defineProperty;try{n({},"",{})}catch{n=0}l.exports=s=function(e,i,c,h){function d(m,b){s(e,m,function(w){return this._invoke(m,b,w)})}i?n?n(e,i,{value:c,enumerable:!h,configurable:!h,writable:!h}):e[i]=c:(d("next",0),d("throw",1),d("return",2))},l.exports.__esModule=!0,l.exports.default=l.exports,s(a,u,r,t)}l.exports=s,l.exports.__esModule=!0,l.exports.default=l.exports}),Ds=_e((o,l)=>{de(),me(),ge();var s=Ls();function a(){var u,r,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",e=t.toStringTag||"@@toStringTag";function i(A,g,S,E){var v=g&&g.prototype instanceof h?g:h,C=Object.create(v.prototype);return s(C,"_invoke",function(P,I,O){var k,M,x,W=0,$=O||[],L=!1,le={p:0,n:0,v:u,a:re,f:re.bind(u,4),d:function(ee,ue){return k=ee,M=0,x=u,le.n=ue,c}};function re(ee,ue){for(M=ee,x=ue,r=0;!L&&W&&!G&&r<$.length;r++){var G,oe=$[r],R=le.p,Q=oe[2];ee>3?(G=Q===ue)&&(x=oe[(M=oe[4])?5:(M=3,3)],oe[4]=oe[5]=u):oe[0]<=R&&((G=ee<2&&R<oe[1])?(M=0,le.v=ue,le.n=oe[1]):R<Q&&(G=ee<3||oe[0]>ue||ue>Q)&&(oe[4]=ee,oe[5]=ue,le.n=Q,M=0))}if(G||ee>1)return c;throw L=!0,ue}return function(ee,ue,G){if(W>1)throw TypeError("Generator is already running");for(L&&ue===1&&re(ue,G),M=ue,x=G;(r=M<2?u:x)||!L;){k||(M?M<3?(M>1&&(le.n=-1),re(M,x)):le.n=x:le.v=x);try{if(W=2,k){if(M||(ee="next"),r=k[ee]){if(!(r=r.call(k,x)))throw TypeError("iterator result is not an object");if(!r.done)return r;x=r.value,M<2&&(M=0)}else M===1&&(r=k.return)&&r.call(k),M<2&&(x=TypeError("The iterator does not provide a '"+ee+"' method"),M=1);k=u}else if((r=(L=le.n<0)?x:P.call(I,le))!==c)break}catch(oe){k=u,M=1,x=oe}finally{W=1}}return{value:r,done:L}}}(A,S,E),!0),C}var c={};function h(){}function d(){}function m(){}r=Object.getPrototypeOf;var b=[][n]?r(r([][n]())):(s(r={},n,function(){return this}),r),w=m.prototype=h.prototype=Object.create(b);function _(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,m):(A.__proto__=m,s(A,e,"GeneratorFunction")),A.prototype=Object.create(w),A}return d.prototype=m,s(w,"constructor",m),s(m,"constructor",d),d.displayName="GeneratorFunction",s(m,e,"GeneratorFunction"),s(w),s(w,e,"Generator"),s(w,n,function(){return this}),s(w,"toString",function(){return"[object Generator]"}),(l.exports=a=function(){return{w:i,m:_}},l.exports.__esModule=!0,l.exports.default=l.exports)()}l.exports=a,l.exports.__esModule=!0,l.exports.default=l.exports}),Us=_e((o,l)=>{de(),me(),ge();var s=Bs(),a=Ls();function u(r,t){function n(i,c,h,d){try{var m=r[i](c),b=m.value;return b instanceof s?t.resolve(b.v).then(function(w){n("next",w,h,d)},function(w){n("throw",w,h,d)}):t.resolve(b).then(function(w){m.value=w,h(m)},function(w){return n("throw",w,h,d)})}catch(w){d(w)}}var e;this.next||(a(u.prototype),a(u.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),a(this,"_invoke",function(i,c,h){function d(){return new t(function(m,b){n(i,h,m,b)})}return e=e?e.then(d,d):d()},!0)}l.exports=u,l.exports.__esModule=!0,l.exports.default=l.exports}),Fs=_e((o,l)=>{de(),me(),ge();var s=Ds(),a=Us();function u(r,t,n,e,i){return new a(s().w(r,t,n,e),i||Promise)}l.exports=u,l.exports.__esModule=!0,l.exports.default=l.exports}),Bc=_e((o,l)=>{de(),me(),ge();var s=Fs();function a(u,r,t,n,e){var i=s(u,r,t,n,e);return i.next().then(function(c){return c.done?c.value:i.next()})}l.exports=a,l.exports.__esModule=!0,l.exports.default=l.exports}),Lc=_e((o,l)=>{de(),me(),ge();function s(a){var u=Object(a),r=[];for(var t in u)r.unshift(t);return function n(){for(;r.length;)if((t=r.pop())in u)return n.value=t,n.done=!1,n;return n.done=!0,n}}l.exports=s,l.exports.__esModule=!0,l.exports.default=l.exports}),Dc=_e((o,l)=>{de(),me(),ge();var s=Pr().default;function a(u){if(u!=null){var r=u[typeof Symbol=="function"&&Symbol.iterator||"@@iterator"],t=0;if(r)return r.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length))return{next:function(){return u&&t>=u.length&&(u=void 0),{value:u&&u[t++],done:!u}}}}throw new TypeError(s(u)+" is not iterable")}l.exports=a,l.exports.__esModule=!0,l.exports.default=l.exports}),Uc=_e((o,l)=>{de(),me(),ge();var s=Bs(),a=Ds(),u=Bc(),r=Fs(),t=Us(),n=Lc(),e=Dc();function i(){var c=a(),h=c.m(i),d=(Object.getPrototypeOf?Object.getPrototypeOf(h):h.__proto__).constructor;function m(_){var A=typeof _=="function"&&_.constructor;return!!A&&(A===d||(A.displayName||A.name)==="GeneratorFunction")}var b={throw:1,return:2,break:3,continue:3};function w(_){var A,g;return function(S){A||(A={stop:function(){return g(S.a,2)},catch:function(){return S.v},abrupt:function(E,v){return g(S.a,b[E],v)},delegateYield:function(E,v,C){return A.resultName=v,g(S.d,e(E),C)},finish:function(E){return g(S.f,E)}},g=function(E,v,C){S.p=A.prev,S.n=A.next;try{return E(v,C)}finally{A.next=S.n}}),A.resultName&&(A[A.resultName]=S.v,A.resultName=void 0),A.sent=S.v,A.next=S.n;try{return _.call(this,A)}finally{S.p=A.prev,S.n=A.next}}}return(l.exports=i=function(){return{wrap:function(_,A,g,S){return c.w(w(_),A,g,S&&S.reverse())},isGeneratorFunction:m,mark:c.m,awrap:function(_,A){return new s(_,A)},AsyncIterator:t,async:function(_,A,g,S,E){return(m(A)?r:u)(w(_),A,g,S,E)},keys:n,values:e}},l.exports.__esModule=!0,l.exports.default=l.exports)()}l.exports=i,l.exports.__esModule=!0,l.exports.default=l.exports}),Fc=_e((o,l)=>{de(),me(),ge();var s=Uc()();l.exports=s;try{regeneratorRuntime=s}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=s:Function("r","regeneratorRuntime = r")(s)}}),Wc=_e((o,l)=>{de(),me(),ge(),function(s,a){typeof o=="object"&&typeof l<"u"?a(o,Tc(),Mc(),Ns(),Nc(),Fc()):typeof define=="function"&&define.amd?define(["exports","@babel/runtime/helpers/defineProperty","@babel/runtime/helpers/slicedToArray","fast-unique-numbers","@babel/runtime/helpers/asyncToGenerator","@babel/runtime/regenerator"],a):(s=typeof globalThis<"u"?globalThis:s||self,a(s.brokerFactory={},s._defineProperty,s._slicedToArray,s.fastUniqueNumbers,s._asyncToGenerator,s._regeneratorRuntime))}(o,function(s,a,u,r,t,n){var e=function(g){return typeof g.start=="function"},i=new WeakMap;function c(g,S){var E=Object.keys(g);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(g);S&&(v=v.filter(function(C){return Object.getOwnPropertyDescriptor(g,C).enumerable})),E.push.apply(E,v)}return E}function h(g){for(var S=1;S<arguments.length;S++){var E=arguments[S]!=null?arguments[S]:{};S%2?c(Object(E),!0).forEach(function(v){a(g,v,E[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(E)):c(Object(E)).forEach(function(v){Object.defineProperty(g,v,Object.getOwnPropertyDescriptor(E,v))})}return g}var d=function(g){return h(h({},g),{},{connect:function(S){var E=S.call;return t(n.mark(function v(){var C,P,I,O;return n.wrap(function(k){for(;;)switch(k.prev=k.next){case 0:return C=new MessageChannel,P=C.port1,I=C.port2,k.next=1,E("connect",{port:P},[P]);case 1:return O=k.sent,i.set(I,O),k.abrupt("return",I);case 2:case"end":return k.stop()}},v)}))},disconnect:function(S){var E=S.call;return function(){var v=t(n.mark(function C(P){var I;return n.wrap(function(O){for(;;)switch(O.prev=O.next){case 0:if(I=i.get(P),I!==void 0){O.next=1;break}throw new Error("The given port is not connected.");case 1:return O.next=2,E("disconnect",{portId:I});case 2:case"end":return O.stop()}},C)}));return function(C){return v.apply(this,arguments)}}()},isSupported:function(S){var E=S.call;return function(){return E("isSupported")}}})};function m(g,S){var E=Object.keys(g);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(g);S&&(v=v.filter(function(C){return Object.getOwnPropertyDescriptor(g,C).enumerable})),E.push.apply(E,v)}return E}function b(g){for(var S=1;S<arguments.length;S++){var E=arguments[S]!=null?arguments[S]:{};S%2?m(Object(E),!0).forEach(function(v){a(g,v,E[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(E)):m(Object(E)).forEach(function(v){Object.defineProperty(g,v,Object.getOwnPropertyDescriptor(E,v))})}return g}var w=new WeakMap,_=function(g){if(w.has(g))return w.get(g);var S=new Map;return w.set(g,S),S},A=function(g){var S=d(g);return function(E){var v=_(E);E.addEventListener("message",function($){var L=$.data,le=L.id;if(le!==null&&v.has(le)){var re=v.get(le),ee=re.reject,ue=re.resolve;v.delete(le),L.error===void 0?ue(L.result):ee(new Error(L.error.message))}}),e(E)&&E.start();for(var C=function($){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return new Promise(function(re,ee){var ue=r.generateUniqueNumber(v);v.set(ue,{reject:ee,resolve:re}),L===null?E.postMessage({id:ue,method:$},le):E.postMessage({id:ue,method:$,params:L},le)})},P=function($,L){var le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];E.postMessage({id:null,method:$,params:L},le)},I={},O=0,k=Object.entries(S);O<k.length;O++){var M=u(k[O],2),x=M[0],W=M[1];I=b(b({},I),{},a({},x,W({call:C,notify:P})))}return b({},I)}};s.createBroker=A})}),$c=_e((o,l)=>{de(),me(),ge(),function(s,a){typeof o=="object"&&typeof l<"u"?a(o,Pr(),Wc(),Ns()):typeof define=="function"&&define.amd?define(["exports","@babel/runtime/helpers/typeof","broker-factory","fast-unique-numbers"],a):(s=typeof globalThis<"u"?globalThis:s||self,a(s.workerTimersBroker={},s._typeof,s.brokerFactory,s.fastUniqueNumbers))}(o,function(s,a,u,r){var t=new Map([[0,null]]),n=new Map([[0,null]]),e=u.createBroker({clearInterval:function(c){var h=c.call;return function(d){a(t.get(d))==="symbol"&&(t.set(d,null),h("clear",{timerId:d,timerType:"interval"}).then(function(){t.delete(d)}))}},clearTimeout:function(c){var h=c.call;return function(d){a(n.get(d))==="symbol"&&(n.set(d,null),h("clear",{timerId:d,timerType:"timeout"}).then(function(){n.delete(d)}))}},setInterval:function(c){var h=c.call;return function(d){for(var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,b=arguments.length,w=new Array(b>2?b-2:0),_=2;_<b;_++)w[_-2]=arguments[_];var A=Symbol(),g=r.generateUniqueNumber(t);t.set(g,A);var S=function(){return h("set",{delay:m,now:performance.timeOrigin+performance.now(),timerId:g,timerType:"interval"}).then(function(){var E=t.get(g);if(E===void 0)throw new Error("The timer is in an undefined state.");E===A&&(d.apply(void 0,w),t.get(g)===A&&S())})};return S(),g}},setTimeout:function(c){var h=c.call;return function(d){for(var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,b=arguments.length,w=new Array(b>2?b-2:0),_=2;_<b;_++)w[_-2]=arguments[_];var A=Symbol(),g=r.generateUniqueNumber(n);return n.set(g,A),h("set",{delay:m,now:performance.timeOrigin+performance.now(),timerId:g,timerType:"timeout"}).then(function(){var S=n.get(g);if(S===void 0)throw new Error("The timer is in an undefined state.");S===A&&(n.delete(g),d.apply(void 0,w))}),g}}}),i=function(c){var h=new Worker(c);return e(h)};s.load=i,s.wrap=e})}),qc=_e((o,l)=>{de(),me(),ge(),function(s,a){typeof o=="object"&&typeof l<"u"?a(o,$c()):typeof define=="function"&&define.amd?define(["exports","worker-timers-broker"],a):(s=typeof globalThis<"u"?globalThis:s||self,a(s.workerTimers={},s.workerTimersBroker))}(o,function(s,a){var u=function(h,d){var m=null;return function(){if(m!==null)return m;var b=new Blob([d],{type:"application/javascript; charset=utf-8"}),w=URL.createObjectURL(b);return m=h(w),setTimeout(function(){return URL.revokeObjectURL(w)}),m}},r=`(()=>{var e={45:(e,t,r)=>{var n=r(738).default;e.exports=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},79:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n},e.exports.__esModule=!0,e.exports.default=e.exports},122:(e,t,r)=>{var n=r(79);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},156:e=>{e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,u,a,i=[],s=!0,c=!1;try{if(u=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=u.call(r)).done)&&(i.push(n.value),i.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return i}},e.exports.__esModule=!0,e.exports.default=e.exports},172:e=>{e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},293:e=>{function t(e,t,r,n,o,u,a){try{var i=e[u](a),s=i.value}catch(e){return void r(e)}i.done?t(s):Promise.resolve(s).then(n,o)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(o,u){var a=e.apply(r,n);function i(e){t(a,o,u,i,s,"next",e)}function s(e){t(a,o,u,i,s,"throw",e)}i(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports},373:e=>{e.exports=function(e){var t=Object(e),r=[];for(var n in t)r.unshift(n);return function e(){for(;r.length;)if((n=r.pop())in t)return e.value=n,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},389:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,u=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<u?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*u);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,s=r(i),c=a(s,i),f=t(c);e.addUniqueNumber=f,e.generateUniqueNumber=c}(t)},472:function(e,t,r){!function(e,t,r,n){"use strict";var o=function(e,t){return function(r){var o=t.get(r);if(void 0===o)return Promise.resolve(!1);var u=n(o,2),a=u[0],i=u[1];return e(a),t.delete(r),i(!1),Promise.resolve(!0)}},u=function(e,t){var r=function(n,o,u,a){var i=n-e.now();i>0?o.set(a,[t(r,i,n,o,u,a),u]):(o.delete(a),u(!0))};return r},a=function(e,t,r,n){return function(o,u,a){var i=o+u-t.timeOrigin,s=i-t.now();return new Promise((function(t){e.set(a,[r(n,s,i,e,t,a),t])}))}},i=new Map,s=o(globalThis.clearTimeout,i),c=new Map,f=o(globalThis.clearTimeout,c),l=u(performance,globalThis.setTimeout),p=a(i,performance,globalThis.setTimeout,l),d=a(c,performance,globalThis.setTimeout,l);r.createWorker(self,{clear:function(){var r=e(t.mark((function e(r){var n,o,u;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.timerId,o=r.timerType,e.next=1,"interval"===o?s(n):f(n);case 1:return u=e.sent,e.abrupt("return",{result:u});case 2:case"end":return e.stop()}}),e)})));function n(e){return r.apply(this,arguments)}return n}(),set:function(){var r=e(t.mark((function e(r){var n,o,u,a,i;return t.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.delay,o=r.now,u=r.timerId,a=r.timerType,e.next=1,("interval"===a?p:d)(n,o,u);case 1:return i=e.sent,e.abrupt("return",{result:i});case 2:case"end":return e.stop()}}),e)})));function n(e){return r.apply(this,arguments)}return n}()})}(r(293),r(756),r(623),r(715))},546:e=>{function t(r,n,o,u){var a=Object.defineProperty;try{a({},"",{})}catch(r){a=0}e.exports=t=function(e,r,n,o){if(r)a?a(e,r,{value:n,enumerable:!o,configurable:!o,writable:!o}):e[r]=n;else{var u=function(r,n){t(e,r,(function(e){return this._invoke(r,n,e)}))};u("next",0),u("throw",1),u("return",2)}},e.exports.__esModule=!0,e.exports.default=e.exports,t(r,n,o,u)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},579:(e,t,r)=>{var n=r(738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(n(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},623:function(e,t,r){!function(e,t,r,n,o){"use strict";var u={INTERNAL_ERROR:-32603,INVALID_PARAMS:-32602,METHOD_NOT_FOUND:-32601},a=function(e,t){return Object.assign(new Error(e),{status:t})},i=function(e){return a('The requested method called "'.concat(e,'" is not supported.'),u.METHOD_NOT_FOUND)},s=function(e){return a('The handler of the method called "'.concat(e,'" returned no required result.'),u.INTERNAL_ERROR)},c=function(e){return a('The handler of the method called "'.concat(e,'" returned an unexpected result.'),u.INTERNAL_ERROR)},f=function(e){return a('The specified parameter called "portId" with the given value "'.concat(e,'" does not identify a port connected to this worker.'),u.INVALID_PARAMS)},l=function(e,n){return function(){var o=t(r.mark((function t(o){var u,a,f,l,p,d,v,x,y,b,h,m,_,g,w;return r.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(u=o.data,a=u.id,f=u.method,l=u.params,p=n[f],t.prev=1,void 0!==p){t.next=2;break}throw i(f);case 2:if(void 0!==(d=void 0===l?p():p(l))){t.next=3;break}throw s(f);case 3:if(!(d instanceof Promise)){t.next=5;break}return t.next=4,d;case 4:g=t.sent,t.next=6;break;case 5:g=d;case 6:if(v=g,null!==a){t.next=8;break}if(void 0===v.result){t.next=7;break}throw c(f);case 7:t.next=10;break;case 8:if(void 0!==v.result){t.next=9;break}throw c(f);case 9:x=v.result,y=v.transferables,b=void 0===y?[]:y,e.postMessage({id:a,result:x},b);case 10:t.next=12;break;case 11:t.prev=11,w=t.catch(1),h=w.message,m=w.status,_=void 0===m?-32603:m,e.postMessage({error:{code:_,message:h},id:a});case 12:case"end":return t.stop()}}),t,null,[[1,11]])})));return function(e){return o.apply(this,arguments)}}()},p=function(){return new Promise((function(e){var t=new ArrayBuffer(0),r=new MessageChannel,n=r.port1,o=r.port2;n.onmessage=function(t){var r=t.data;return e(null!==r)},o.postMessage(t,[t])}))};function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var x=new Map,y=function(e,n,u){return v(v({},n),{},{connect:function(t){var r=t.port;r.start();var u=e(r,n),a=o.generateUniqueNumber(x);return x.set(a,(function(){u(),r.close(),x.delete(a)})),{result:a}},disconnect:function(e){var t=e.portId,r=x.get(t);if(void 0===r)throw f(t);return r(),{result:null}},isSupported:function(){var e=t(r.mark((function e(){var t,n,o;return r.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,p();case 1:if(!e.sent){e.next=5;break}if(!((t=u())instanceof Promise)){e.next=3;break}return e.next=2,t;case 2:o=e.sent,e.next=4;break;case 3:o=t;case 4:return n=o,e.abrupt("return",{result:n});case 5:return e.abrupt("return",{result:!1});case 6:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()})},b=function(e,t){var r=y(b,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0}),n=l(e,r);return e.addEventListener("message",n),function(){return e.removeEventListener("message",n)}};e.createWorker=b,e.isSupported=p}(t,r(293),r(756),r(693),r(389))},633:(e,t,r)=>{var n=r(172),o=r(993),u=r(869),a=r(887),i=r(791),s=r(373),c=r(579);function f(){"use strict";var t=o(),r=t.m(f),l=(Object.getPrototypeOf?Object.getPrototypeOf(r):r.__proto__).constructor;function p(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===l||"GeneratorFunction"===(t.displayName||t.name))}var d={throw:1,return:2,break:3,continue:3};function v(e){var t,r;return function(n){t||(t={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(e,t){return r(n.a,d[e],t)},delegateYield:function(e,o,u){return t.resultName=o,r(n.d,c(e),u)},finish:function(e){return r(n.f,e)}},r=function(e,r,o){n.p=t.prev,n.n=t.next;try{return e(r,o)}finally{t.next=n.n}}),t.resultName&&(t[t.resultName]=n.v,t.resultName=void 0),t.sent=n.v,t.next=n.n;try{return e.call(this,t)}finally{n.p=t.prev,n.n=t.next}}}return(e.exports=f=function(){return{wrap:function(e,r,n,o){return t.w(v(e),r,n,o&&o.reverse())},isGeneratorFunction:p,mark:t.m,awrap:function(e,t){return new n(e,t)},AsyncIterator:i,async:function(e,t,r,n,o){return(p(t)?a:u)(v(e),t,r,n,o)},keys:s,values:c}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=f,e.exports.__esModule=!0,e.exports.default=e.exports},693:(e,t,r)=>{var n=r(736);e.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},715:(e,t,r)=>{var n=r(987),o=r(156),u=r(122),a=r(752);e.exports=function(e,t){return n(e)||o(e,t)||u(e,t)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},736:(e,t,r)=>{var n=r(738).default,o=r(45);e.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:t+""},e.exports.__esModule=!0,e.exports.default=e.exports},738:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},752:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},756:(e,t,r)=>{var n=r(633)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},791:(e,t,r)=>{var n=r(172),o=r(546);e.exports=function e(t,r){function u(e,o,a,i){try{var s=t[e](o),c=s.value;return c instanceof n?r.resolve(c.v).then((function(e){u("next",e,a,i)}),(function(e){u("throw",e,a,i)})):r.resolve(c).then((function(e){s.value=e,a(s)}),(function(e){return u("throw",e,a,i)}))}catch(e){i(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",(function(){return this}))),o(this,"_invoke",(function(e,t,n){function o(){return new r((function(t,r){u(e,n,t,r)}))}return a=a?a.then(o,o):o()}),!0)},e.exports.__esModule=!0,e.exports.default=e.exports},869:(e,t,r)=>{var n=r(887);e.exports=function(e,t,r,o,u){var a=n(e,t,r,o,u);return a.next().then((function(e){return e.done?e.value:a.next()}))},e.exports.__esModule=!0,e.exports.default=e.exports},887:(e,t,r)=>{var n=r(993),o=r(791);e.exports=function(e,t,r,u,a){return new o(n().w(e,t,r,u),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},987:e=>{e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},993:(e,t,r)=>{var n=r(546);function o(){var t,r,u="function"==typeof Symbol?Symbol:{},a=u.iterator||"@@iterator",i=u.toStringTag||"@@toStringTag";function s(e,o,u,a){var i=o&&o.prototype instanceof f?o:f,s=Object.create(i.prototype);return n(s,"_invoke",function(e,n,o){var u,a,i,s=0,f=o||[],l=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return u=e,a=0,i=t,p.n=r,c}};function d(e,n){for(a=e,i=n,r=0;!l&&s&&!o&&r<f.length;r++){var o,u=f[r],d=p.p,v=u[2];e>3?(o=v===n)&&(i=u[(a=u[4])?5:(a=3,3)],u[4]=u[5]=t):u[0]<=d&&((o=e<2&&d<u[1])?(a=0,p.v=n,p.n=u[1]):d<v&&(o=e<3||u[0]>n||n>v)&&(u[4]=e,u[5]=n,p.n=v,a=0))}if(o||e>1)return c;throw l=!0,n}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&d(f,v),a=f,i=v;(r=a<2?t:i)||!l;){u||(a?a<3?(a>1&&(p.n=-1),d(a,i)):p.n=i:p.v=i);try{if(s=2,u){if(a||(o="next"),r=u[o]){if(!(r=r.call(u,i)))throw TypeError("iterator result is not an object");if(!r.done)return r;i=r.value,a<2&&(a=0)}else 1===a&&(r=u.return)&&r.call(u),a<2&&(i=TypeError("The iterator does not provide a '"+o+"' method"),a=1);u=t}else if((r=(l=p.n<0)?i:e.call(n,p))!==c)break}catch(e){u=t,a=1,i=e}finally{s=1}}return{value:r,done:l}}}(e,u,a),!0),s}var c={};function f(){}function l(){}function p(){}r=Object.getPrototypeOf;var d=[][a]?r(r([][a]())):(n(r={},a,(function(){return this})),r),v=p.prototype=f.prototype=Object.create(d);function x(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,n(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e}return l.prototype=p,n(v,"constructor",p),n(p,"constructor",l),l.displayName="GeneratorFunction",n(p,i,"GeneratorFunction"),n(v),n(v,i,"Generator"),n(v,a,(function(){return this})),n(v,"toString",(function(){return"[object Generator]"})),(e.exports=o=function(){return{w:s,m:x}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var u=t[n]={exports:{}};return e[n].call(u.exports,u,u.exports,r),u.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(472)})()})();`,t=u(a.load,r),n=function(h){return t().clearInterval(h)},e=function(h){return t().clearTimeout(h)},i=function(){var h;return(h=t()).setInterval.apply(h,arguments)},c=function(){var h;return(h=t()).setTimeout.apply(h,arguments)};s.clearInterval=n,s.clearTimeout=e,s.setInterval=i,s.setTimeout=c})}),Cr=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0}),o.isReactNativeBrowser=o.isWebWorker=void 0;var l=()=>{var r;return typeof window<"u"?typeof navigator<"u"&&((r=navigator.userAgent)==null?void 0:r.toLowerCase().indexOf(" electron/"))>-1&&(Je!=null&&Je.versions)?!Object.prototype.hasOwnProperty.call(Je.versions,"electron"):typeof window.document<"u":!1},s=()=>{var r,t;return!!(typeof self=="object"&&((t=(r=self==null?void 0:self.constructor)==null?void 0:r.name)!=null&&t.includes("WorkerGlobalScope"))&&typeof Deno>"u")},a=()=>typeof navigator<"u"&&navigator.product==="ReactNative",u=l()||s()||a();o.isWebWorker=s(),o.isReactNativeBrowser=a(),o.default=u}),Vc=_e(o=>{de(),me(),ge();var l=o&&o.__createBinding||(Object.create?function(i,c,h,d){d===void 0&&(d=h);var m=Object.getOwnPropertyDescriptor(c,h);(!m||("get"in m?!c.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return c[h]}}),Object.defineProperty(i,d,m)}:function(i,c,h,d){d===void 0&&(d=h),i[d]=c[h]}),s=o&&o.__setModuleDefault||(Object.create?function(i,c){Object.defineProperty(i,"default",{enumerable:!0,value:c})}:function(i,c){i.default=c}),a=o&&o.__importStar||function(){var i=function(c){return i=Object.getOwnPropertyNames||function(h){var d=[];for(var m in h)Object.prototype.hasOwnProperty.call(h,m)&&(d[d.length]=m);return d},i(c)};return function(c){if(c&&c.__esModule)return c;var h={};if(c!=null)for(var d=i(c),m=0;m<d.length;m++)d[m]!=="default"&&l(h,c,d[m]);return s(h,c),h}}();Object.defineProperty(o,"__esModule",{value:!0});var u=qc(),r=a(Cr()),t={set:u.setInterval,clear:u.clearInterval},n={set:(i,c)=>setInterval(i,c),clear:i=>clearInterval(i)},e=i=>{switch(i){case"native":return n;case"worker":return t;case"auto":default:return r.default&&!r.isWebWorker&&!r.isReactNativeBrowser?t:n}};o.default=e}),Ws=_e(o=>{de(),me(),ge();var l=o&&o.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(o,"__esModule",{value:!0});var s=l(Vc()),a=class{constructor(u,r){Pe(this,"_keepalive");Pe(this,"timerId");Pe(this,"timer");Pe(this,"destroyed",!1);Pe(this,"counter");Pe(this,"client");Pe(this,"_keepaliveTimeoutTimestamp");Pe(this,"_intervalEvery");this.client=u,this.timer=typeof r=="object"&&"set"in r&&"clear"in r?r:(0,s.default)(r),this.setKeepalive(u.options.keepalive)}get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(u){if(u*=1e3,isNaN(u)||u<=0||u>2147483647)throw new Error(`Keepalive value must be an integer between 0 and 2147483647. Provided value is ${u}`);this._keepalive=u,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${u}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let u=Math.ceil(this._keepalive*1.5);this._keepaliveTimeoutTimestamp=Date.now()+u,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)}};o.default=a}),Ci=_e(o=>{var v;de(),me(),ge();var l=o&&o.__createBinding||(Object.create?function(C,P,I,O){O===void 0&&(O=I);var k=Object.getOwnPropertyDescriptor(P,I);(!k||("get"in k?!P.__esModule:k.writable||k.configurable))&&(k={enumerable:!0,get:function(){return P[I]}}),Object.defineProperty(C,O,k)}:function(C,P,I,O){O===void 0&&(O=I),C[O]=P[I]}),s=o&&o.__setModuleDefault||(Object.create?function(C,P){Object.defineProperty(C,"default",{enumerable:!0,value:P})}:function(C,P){C.default=P}),a=o&&o.__importStar||function(){var C=function(P){return C=Object.getOwnPropertyNames||function(I){var O=[];for(var k in I)Object.prototype.hasOwnProperty.call(I,k)&&(O[O.length]=k);return O},C(P)};return function(P){if(P&&P.__esModule)return P;var I={};if(P!=null)for(var O=C(P),k=0;k<O.length;k++)O[k]!=="default"&&l(I,P,O[k]);return s(I,P),I}}(),u=o&&o.__importDefault||function(C){return C&&C.__esModule?C:{default:C}};Object.defineProperty(o,"__esModule",{value:!0});var r=u(Zu()),t=Xt(),n=u(tc()),e=u(Mt()),i=a(rc()),c=u(ks()),h=u(Ec()),d=u(Ms()),m=u(Ac()),b=ar(),w=xc(),_=u(Ws()),A=a(Cr()),g=globalThis.setImmediate||((...C)=>{let P=C.shift();(0,b.nextTick)(()=>{P(...C)})}),S={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,subscribeBatchSize:null,writeCache:!0,timerVariant:"auto"},E=(v=class extends w.TypedEventEmitter{constructor(I,O){super();Pe(this,"connected");Pe(this,"disconnecting");Pe(this,"disconnected");Pe(this,"reconnecting");Pe(this,"incomingStore");Pe(this,"outgoingStore");Pe(this,"options");Pe(this,"queueQoSZero");Pe(this,"_reconnectCount");Pe(this,"log");Pe(this,"messageIdProvider");Pe(this,"outgoing");Pe(this,"messageIdToTopic");Pe(this,"noop");Pe(this,"keepaliveManager");Pe(this,"stream");Pe(this,"queue");Pe(this,"streamBuilder");Pe(this,"_resubscribeTopics");Pe(this,"connackTimer");Pe(this,"reconnectTimer");Pe(this,"_storeProcessing");Pe(this,"_packetIdsDuringStoreProcessing");Pe(this,"_storeProcessingQueue");Pe(this,"_firstConnection");Pe(this,"topicAliasRecv");Pe(this,"topicAliasSend");Pe(this,"_deferredReconnect");Pe(this,"connackPacket");this.options=O||{};for(let k in S)typeof this.options[k]>"u"?this.options[k]=S[k]:this.options[k]=O[k];this.log=this.options.log||(0,e.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: version:",v.VERSION),A.isWebWorker?this.log("MqttClient :: environment","webworker"):this.log("MqttClient :: environment",A.default?"browser":"node"),this.log("MqttClient :: options.protocol",O.protocol),this.log("MqttClient :: options.protocolVersion",O.protocolVersion),this.log("MqttClient :: options.username",O.username),this.log("MqttClient :: options.keepalive",O.keepalive),this.log("MqttClient :: options.reconnectPeriod",O.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",O.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",O.properties?O.properties.topicAliasMaximum:void 0),this.options.clientId=typeof O.clientId=="string"?O.clientId:v.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=O.protocolVersion===5&&O.customHandleAcks?O.customHandleAcks:(...k)=>{k[3](null,0)},this.options.writeCache||(r.default.writeToStream.cacheNumbers=!1),this.streamBuilder=I,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new d.default:this.options.messageIdProvider,this.outgoingStore=O.outgoingStore||new c.default,this.incomingStore=O.incomingStore||new c.default,this.queueQoSZero=O.queueQoSZero===void 0?!0:O.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,O.properties&&O.properties.topicAliasMaximum>0&&(O.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new m.default(O.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:k}=this,M=()=>{let x=k.shift();this.log("deliver :: entry %o",x);let W=null;if(!x){this._resubscribe();return}W=x.packet,this.log("deliver :: call _sendPacket for %o",W);let $=!0;W.messageId&&W.messageId!==0&&(this.messageIdProvider.register(W.messageId)||($=!1)),$?this._sendPacket(W,L=>{x.cb&&x.cb(L),M()}):(this.log("messageId: %d has already used. The message is skipped and removed.",W.messageId),M())};this.log("connect :: sending queued packets"),M()}),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())}static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}handleAuth(I,O){O()}handleMessage(I,O){O()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var le;let I=new t.Writable,O=r.default.parser(this.options),k=null,M=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new c.default,this.outgoingStore=this.options.outgoingStore||new c.default,this.disconnecting=!1,this.disconnected=!1),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),O.on("packet",re=>{this.log("parser :: on packet push to packets array."),M.push(re)});let x=()=>{this.log("work :: getting next packet in queue");let re=M.shift();if(re)this.log("work :: packet pulled from queue"),(0,h.default)(this,re,W);else{this.log("work :: no packets in queue");let ee=k;k=null,this.log("work :: done flag is %s",!!ee),ee&&ee()}},W=()=>{if(M.length)(0,b.nextTick)(x);else{let re=k;k=null,re()}};I._write=(re,ee,ue)=>{k=ue,this.log("writable stream :: parsing buffer"),O.parse(re),x()};let $=re=>{this.log("streamErrorHandler :: error",re.message),re.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",re)):this.noop(re)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(I),this.stream.on("error",$),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={...this.options.will,payload:(le=this.options.will)==null?void 0:le.payload}),this.topicAliasRecv&&(L.properties||(L.properties={}),this.topicAliasRecv&&(L.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(L),O.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 re={cmd:"auth",reasonCode:0,...this.options.authPacket};this._writePacket(re)}}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(I,O,k,M){this.log("publish :: message `%s` to topic `%s`",O,I);let{options:x}=this;typeof k=="function"&&(M=k,k=null),k=k||{},k={qos:0,retain:!1,dup:!1,...k};let{qos:W,retain:$,dup:L,properties:le,cbStorePut:re}=k;if(this._checkDisconnecting(M))return this;let ee=()=>{let ue=0;if((W===1||W===2)&&(ue=this._nextId(),ue===null))return this.log("No messageId left"),!1;let G={cmd:"publish",topic:I,payload:O,qos:W,retain:$,messageId:ue,dup:L};switch(x.protocolVersion===5&&(G.properties=le),this.log("publish :: qos",W),W){case 1:case 2:this.outgoing[G.messageId]={volatile:!1,cb:M||this.noop},this.log("MqttClient:publish: packet cmd: %s",G.cmd),this._sendPacket(G,void 0,re);break;default:this.log("MqttClient:publish: packet cmd: %s",G.cmd),this._sendPacket(G,M,re);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!ee())&&this._storeProcessingQueue.push({invoke:ee,cbStorePut:k.cbStorePut,callback:M}),this}publishAsync(I,O,k){return new Promise((M,x)=>{this.publish(I,O,k,(W,$)=>{W?x(W):M($)})})}subscribe(I,O,k){let M=this.options.protocolVersion;typeof O=="function"&&(k=O),k=k||this.noop;let x=!1,W=[];typeof I=="string"?(I=[I],W=I):Array.isArray(I)?W=I:typeof I=="object"&&(x=I.resubscribe,delete I.resubscribe,W=Object.keys(I));let $=i.validateTopics(W);if($!==null)return g(k,new Error(`Invalid topic ${$}`)),this;if(this._checkDisconnecting(k))return this.log("subscribe: discconecting true"),this;let L={qos:0};M===5&&(L.nl=!1,L.rap=!1,L.rh=0),O={...L,...O};let{properties:le}=O,re=[],ee=(oe,R)=>{if(R=R||O,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,oe)||this._resubscribeTopics[oe].qos<R.qos||x){let Q={topic:oe,qos:R.qos};M===5&&(Q.nl=R.nl,Q.rap=R.rap,Q.rh=R.rh,Q.properties=le),this.log("subscribe: pushing topic `%s` and qos `%s` to subs list",Q.topic,Q.qos),re.push(Q)}};if(Array.isArray(I)?I.forEach(oe=>{this.log("subscribe: array topic %s",oe),ee(oe)}):Object.keys(I).forEach(oe=>{this.log("subscribe: object topic %s, %o",oe,I[oe]),ee(oe,I[oe])}),!re.length)return k(null,[]),this;let ue=(oe,R)=>{let Q={cmd:"subscribe",subscriptions:oe,messageId:R};if(le&&(Q.properties=le),this.options.resubscribe){this.log("subscribe :: resubscribe true");let V=[];oe.forEach(Ee=>{if(this.options.reconnectPeriod>0){let X={qos:Ee.qos};M===5&&(X.nl=Ee.nl||!1,X.rap=Ee.rap||!1,X.rh=Ee.rh||0,X.properties=Ee.properties),this._resubscribeTopics[Ee.topic]=X,V.push(Ee.topic)}}),this.messageIdToTopic[Q.messageId]=V}let he=new Promise((V,Ee)=>{this.outgoing[Q.messageId]={volatile:!0,cb(X,U){if(!X){let{granted:ae}=U;for(let H=0;H<ae.length;H+=1)oe[H].qos=ae[H]}X?Ee(new b.ErrorWithSubackPacket(X.message,U)):V(U)}}});return this.log("subscribe :: call _sendPacket"),this._sendPacket(Q),he},G=()=>{let oe=this.options.subscribeBatchSize??re.length,R=[];for(let Q=0;Q<re.length;Q+=oe){let he=re.slice(Q,Q+oe),V=this._nextId();if(V===null)return this.log("No messageId left"),!1;R.push(ue(he,V))}return Promise.all(R).then(Q=>{k(null,re,Q.at(-1))}).catch(Q=>{k(Q,re,Q.packet)}),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!G())&&this._storeProcessingQueue.push({invoke:G,callback:k}),this}subscribeAsync(I,O){return new Promise((k,M)=>{this.subscribe(I,O,(x,W)=>{x?M(x):k(W)})})}unsubscribe(I,O,k){typeof I=="string"&&(I=[I]),typeof O=="function"&&(k=O),k=k||this.noop;let M=i.validateTopics(I);if(M!==null)return g(k,new Error(`Invalid topic ${M}`)),this;if(this._checkDisconnecting(k))return this;let x=()=>{let W=this._nextId();if(W===null)return this.log("No messageId left"),!1;let $={cmd:"unsubscribe",messageId:W,unsubscriptions:[]};return typeof I=="string"?$.unsubscriptions=[I]:Array.isArray(I)&&($.unsubscriptions=I),this.options.resubscribe&&$.unsubscriptions.forEach(L=>{delete this._resubscribeTopics[L]}),typeof O=="object"&&O.properties&&($.properties=O.properties),this.outgoing[$.messageId]={volatile:!0,cb:k},this.log("unsubscribe: call _sendPacket"),this._sendPacket($),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!x())&&this._storeProcessingQueue.push({invoke:x,callback:k}),this}unsubscribeAsync(I,O){return new Promise((k,M)=>{this.unsubscribe(I,O,(x,W)=>{x?M(x):k(W)})})}end(I,O,k){this.log("end :: (%s)",this.options.clientId),(I==null||typeof I!="boolean")&&(k=k||O,O=I,I=!1),typeof O!="object"&&(k=k||O,O=null),this.log("end :: cb? %s",!!k),(!k||typeof k!="function")&&(k=this.noop);let M=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(W=>{this.outgoingStore.close($=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),k){let L=W||$;this.log("end :: closeStores: invoking callback with args"),k(L)}})}),this._deferredReconnect?this._deferredReconnect():(this.options.reconnectPeriod===0||this.options.manualConnect)&&(this.disconnecting=!1)},x=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,I),this._cleanUp(I,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,b.nextTick)(M)},O)};return this.disconnecting?(k(),this):(this._clearReconnect(),this.disconnecting=!0,!I&&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,x,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),x()),this)}endAsync(I,O){return new Promise((k,M)=>{this.end(I,O,x=>{x?M(x):k()})})}removeOutgoingMessage(I){if(this.outgoing[I]){let{cb:O}=this.outgoing[I];this._removeOutgoingAndStoreMessage(I,()=>{O(new Error("Message removed"))})}return this}reconnect(I){this.log("client reconnect");let O=()=>{I?(this.options.incomingStore=I.incomingStore,this.options.outgoingStore=I.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new c.default,this.outgoingStore=this.options.outgoingStore||new c.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=O:O(),this}_flushVolatile(){this.outgoing&&(this.log("_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(this.outgoing).forEach(I=>{this.outgoing[I].volatile&&typeof this.outgoing[I].cb=="function"&&(this.outgoing[I].cb(new Error("Connection closed")),delete this.outgoing[I])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(I=>{typeof this.outgoing[I].cb=="function"&&(this.outgoing[I].cb(new Error("Connection closed")),delete this.outgoing[I])}))}_removeTopicAliasAndRecoverTopicName(I){let O;I.properties&&(O=I.properties.topicAlias);let k=I.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",O,k),k.length===0){if(typeof O>"u")return new Error("Unregistered Topic Alias");if(k=this.topicAliasSend.getTopicByAlias(O),typeof k>"u")return new Error("Unregistered Topic Alias");I.topic=k}O&&delete I.properties.topicAlias}_checkDisconnecting(I){return this.disconnecting&&(I&&I!==this.noop?I(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(I,O,k={}){if(O&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",O)),this.log("_cleanUp :: forced? %s",I),I)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let M={cmd:"disconnect",...k};this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(M,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),g(()=>{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(),O&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",O),O())}_storeAndSend(I,O,k){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",I.cmd);let M=I,x;if(M.cmd==="publish"&&(M=(0,n.default)(I),x=this._removeTopicAliasAndRecoverTopicName(M),x))return O&&O(x);this.outgoingStore.put(M,W=>{if(W)return O&&O(W);k(),this._writePacket(I,O)})}_applyTopicAlias(I){if(this.options.protocolVersion===5&&I.cmd==="publish"){let O;I.properties&&(O=I.properties.topicAlias);let k=I.topic.toString();if(this.topicAliasSend)if(O){if(k.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",k,O),!this.topicAliasSend.put(k,O)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",k,O),new Error("Sending Topic Alias out of range")}else k.length!==0&&(this.options.autoAssignTopicAlias?(O=this.topicAliasSend.getAliasByTopic(k),O?(I.topic="",I.properties={...I.properties,topicAlias:O},this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",k,O)):(O=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(k,O),I.properties={...I.properties,topicAlias:O},this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",k,O))):this.options.autoUseTopicAlias&&(O=this.topicAliasSend.getAliasByTopic(k),O&&(I.topic="",I.properties={...I.properties,topicAlias:O},this.log("applyTopicAlias :: auto use topic: %s - alias: %d",k,O))));else if(O)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",k,O),new Error("Sending Topic Alias out of range")}}_noop(I){this.log("noop ::",I)}_writePacket(I,O){this.log("_writePacket :: packet: %O",I),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",I),this.log("_writePacket :: writing to stream");let k=r.default.writeToStream(I,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",k),!k&&O&&O!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",O)):O&&(this.log("_writePacket :: invoking cb"),O())}_sendPacket(I,O,k,M){this.log("_sendPacket :: (%s) :: start",this.options.clientId),k=k||this.noop,O=O||this.noop;let x=this._applyTopicAlias(I);if(x){O(x);return}if(!this.connected){if(I.cmd==="auth"){this._writePacket(I,O);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(I,O,k);return}if(M){this._writePacket(I,O);return}switch(I.cmd){case"publish":break;case"pubrel":this._storeAndSend(I,O,k);return;default:this._writePacket(I,O);return}switch(I.qos){case 2:case 1:this._storeAndSend(I,O,k);break;case 0:default:this._writePacket(I,O);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(I,O,k){this.log("_storePacket :: packet: %o",I),this.log("_storePacket :: cb? %s",!!O),k=k||this.noop;let M=I;if(M.cmd==="publish"){M=(0,n.default)(I);let W=this._removeTopicAliasAndRecoverTopicName(M);if(W)return O&&O(W)}let x=M.qos||0;x===0&&this.queueQoSZero||M.cmd!=="publish"?this.queue.push({packet:M,cb:O}):x>0?(O=this.outgoing[M.messageId]?this.outgoing[M.messageId].cb:null,this.outgoingStore.put(M,W=>{if(W)return O&&O(W);k()})):O&&O(new Error("No connection to broker"))}_setupKeepaliveManager(){this.log("_setupKeepaliveManager :: keepalive %d (seconds)",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new _.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log("_destroyKeepaliveManager :: destroying keepalive manager"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(I=!1){this.keepaliveManager&&this.options.keepalive&&(I||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 I=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&I.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let O=0;O<I.length;O++){let k={};k[I[O]]=this._resubscribeTopics[I[O]],k.resubscribe=!0,this.subscribe(k,{properties:k[I[O]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1}_onConnect(I){if(this.disconnected){this.emit("connect",I);return}this.connackPacket=I,this.messageIdProvider.clear(),this._setupKeepaliveManager(),this.connected=!0;let O=()=>{let k=this.outgoingStore.createStream(),M=()=>{k.destroy(),k=null,this._flushStoreProcessingQueue(),x()},x=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",M),k.on("error",$=>{x(),this._flushStoreProcessingQueue(),this.removeListener("close",M),this.emit("error",$)});let W=()=>{if(!k)return;let $=k.read(1),L;if(!$){k.once("readable",W);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[$.messageId]){W();return}!this.disconnecting&&!this.reconnectTimer?(L=this.outgoing[$.messageId]?this.outgoing[$.messageId].cb:null,this.outgoing[$.messageId]={volatile:!1,cb(le,re){L&&L(le,re),W()}},this._packetIdsDuringStoreProcessing[$.messageId]=!0,this.messageIdProvider.register($.messageId)?this._sendPacket($,void 0,void 0,!0):this.log("messageId: %d has already used.",$.messageId)):k.destroy&&k.destroy()};k.on("end",()=>{let $=!0;for(let L in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[L]){$=!1;break}this.removeListener("close",M),$?(x(),this._invokeAllStoreProcessingQueue(),this.emit("connect",I)):O()}),W()};O()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let I=this._storeProcessingQueue[0];if(I&&I.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let I of this._storeProcessingQueue)I.cbStorePut&&I.cbStorePut(new Error("Connection closed")),I.callback&&I.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(I,O){delete this.outgoing[I],this.outgoingStore.del({messageId:I},(k,M)=>{O(k,M),this.messageIdProvider.deallocate(I),this._invokeStoreProcessingQueue()})}},Pe(v,"VERSION",b.MQTTJS_VERSION),v);o.default=E}),zc=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0});var l=Rs(),s=class{constructor(){Pe(this,"numberAllocator");Pe(this,"lastId");this.numberAllocator=new l.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(a){return this.numberAllocator.use(a)}deallocate(a){this.numberAllocator.free(a)}clear(){this.numberAllocator.clear()}};o.default=s});function Kc(){if(ji)return jr;ji=!0;let o=2147483647,l=36,s=1,a=26,u=38,r=700,t=72,n=128,e="-",i=/^xn--/,c=/[^\0-\x7F]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=l-s,b=Math.floor,w=String.fromCharCode;function _(k){throw new RangeError(d[k])}function A(k,M){let x=[],W=k.length;for(;W--;)x[W]=M(k[W]);return x}function g(k,M){let x=k.split("@"),W="";x.length>1&&(W=x[0]+"@",k=x[1]),k=k.replace(h,".");let $=k.split("."),L=A($,M).join(".");return W+L}function S(k){let M=[],x=0,W=k.length;for(;x<W;){let $=k.charCodeAt(x++);if($>=55296&&$<=56319&&x<W){let L=k.charCodeAt(x++);(L&64512)==56320?M.push((($&1023)<<10)+(L&1023)+65536):(M.push($),x--)}else M.push($)}return M}let E=k=>String.fromCodePoint(...k),v=function(k){return k>=48&&k<58?26+(k-48):k>=65&&k<91?k-65:k>=97&&k<123?k-97:l},C=function(k,M){return k+22+75*(k<26)-((M!=0)<<5)},P=function(k,M,x){let W=0;for(k=x?b(k/r):k>>1,k+=b(k/M);k>m*a>>1;W+=l)k=b(k/m);return b(W+(m+1)*k/(k+u))},I=function(k){let M=[],x=k.length,W=0,$=n,L=t,le=k.lastIndexOf(e);le<0&&(le=0);for(let re=0;re<le;++re)k.charCodeAt(re)>=128&&_("not-basic"),M.push(k.charCodeAt(re));for(let re=le>0?le+1:0;re<x;){let ee=W;for(let G=1,oe=l;;oe+=l){re>=x&&_("invalid-input");let R=v(k.charCodeAt(re++));R>=l&&_("invalid-input"),R>b((o-W)/G)&&_("overflow"),W+=R*G;let Q=oe<=L?s:oe>=L+a?a:oe-L;if(R<Q)break;let he=l-Q;G>b(o/he)&&_("overflow"),G*=he}let ue=M.length+1;L=P(W-ee,ue,ee==0),b(W/ue)>o-$&&_("overflow"),$+=b(W/ue),W%=ue,M.splice(W++,0,$)}return String.fromCodePoint(...M)},O=function(k){let M=[];k=S(k);let x=k.length,W=n,$=0,L=t;for(let ee of k)ee<128&&M.push(w(ee));let le=M.length,re=le;for(le&&M.push(e);re<x;){let ee=o;for(let G of k)G>=W&&G<ee&&(ee=G);let ue=re+1;ee-W>b((o-$)/ue)&&_("overflow"),$+=(ee-W)*ue,W=ee;for(let G of k)if(G<W&&++$>o&&_("overflow"),G===W){let oe=$;for(let R=l;;R+=l){let Q=R<=L?s:R>=L+a?a:R-L;if(oe<Q)break;let he=oe-Q,V=l-Q;M.push(w(C(Q+he%V,0))),oe=b(he/V)}M.push(w(C(oe,0))),L=P($,ue,re===le),$=0,++re}++$,++W}return M.join("")};return jr={version:"2.3.1",ucs2:{decode:S,encode:E},decode:I,encode:O,toASCII:function(k){return g(k,function(M){return c.test(M)?"xn--"+O(M):M})},toUnicode:function(k){return g(k,function(M){return i.test(M)?I(M.slice(4).toLowerCase()):M})}},jr}var jr,ji,Wt,Hc=_t(()=>{de(),me(),ge(),jr={},ji=!1,Wt=Kc(),Wt.decode,Wt.encode,Wt.toASCII,Wt.toUnicode,Wt.ucs2,Wt.version});function Gc(){return Bi||(Bi=!0,Ni=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var o={},l=Symbol("test"),s=Object(l);if(typeof l=="string"||Object.prototype.toString.call(l)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var a=42;o[l]=a;for(l in o)return!1;if(typeof Object.keys=="function"&&Object.keys(o).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(o).length!==0)return!1;var u=Object.getOwnPropertySymbols(o);if(u.length!==1||u[0]!==l||!Object.prototype.propertyIsEnumerable.call(o,l))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var r=Object.getOwnPropertyDescriptor(o,l);if(r.value!==a||r.enumerable!==!0)return!1}return!0}),Ni}function Yc(){return Di||(Di=!0,Li=Error),Li}function Qc(){return Fi||(Fi=!0,Ui=EvalError),Ui}function Jc(){return $i||($i=!0,Wi=RangeError),Wi}function Xc(){return Vi||(Vi=!0,qi=ReferenceError),qi}function $s(){return Ki||(Ki=!0,zi=SyntaxError),zi}function vr(){return Gi||(Gi=!0,Hi=TypeError),Hi}function Zc(){return Qi||(Qi=!0,Yi=URIError),Yi}function ef(){if(Ji)return Rr;Ji=!0;var o=typeof Symbol<"u"&&Symbol,l=Gc();return Rr=function(){return typeof o!="function"||typeof Symbol!="function"||typeof o("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:l()},Rr}function tf(){if(Xi)return Mr;Xi=!0;var o={__proto__:null,foo:{}},l=Object;return Mr=function(){return{__proto__:o}.foo===o.foo&&!(o instanceof l)},Mr}function rf(){if(Zi)return Nr;Zi=!0;var o="Function.prototype.bind called on incompatible ",l=Object.prototype.toString,s=Math.max,a="[object Function]",u=function(n,e){for(var i=[],c=0;c<n.length;c+=1)i[c]=n[c];for(var h=0;h<e.length;h+=1)i[h+n.length]=e[h];return i},r=function(n,e){for(var i=[],c=e,h=0;c<n.length;c+=1,h+=1)i[h]=n[c];return i},t=function(n,e){for(var i="",c=0;c<n.length;c+=1)i+=n[c],c+1<n.length&&(i+=e);return i};return Nr=function(n){var e=this;if(typeof e!="function"||l.apply(e)!==a)throw new TypeError(o+e);for(var i=r(arguments,1),c,h=function(){if(this instanceof c){var _=e.apply(this,u(i,arguments));return Object(_)===_?_:this}return e.apply(n,u(i,arguments))},d=s(0,e.length-i.length),m=[],b=0;b<d;b++)m[b]="$"+b;if(c=Function("binder","return function ("+t(m,",")+"){ return binder.apply(this,arguments); }")(h),e.prototype){var w=function(){};w.prototype=e.prototype,c.prototype=new w,w.prototype=null}return c},Nr}function Ri(){if(eo)return Br;eo=!0;var o=rf();return Br=Function.prototype.bind||o,Br}function nf(){if(to)return Lr;to=!0;var o=Function.prototype.call,l=Object.prototype.hasOwnProperty,s=Ri();return Lr=s.call(o,l),Lr}function lr(){if(ro)return Dr;ro=!0;var o,l=Yc(),s=Qc(),a=Jc(),u=Xc(),r=$s(),t=vr(),n=Zc(),e=Function,i=function(re){try{return e('"use strict"; return ('+re+").constructor;")()}catch{}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch{c=null}var h=function(){throw new t},d=c?function(){try{return arguments.callee,h}catch{try{return c(arguments,"callee").get}catch{return h}}}():h,m=ef()(),b=tf()(),w=Object.getPrototypeOf||(b?function(re){return re.__proto__}:null),_={},A=typeof Uint8Array>"u"||!w?o:w(Uint8Array),g={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?o:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?o:ArrayBuffer,"%ArrayIteratorPrototype%":m&&w?w([][Symbol.iterator]()):o,"%AsyncFromSyncIteratorPrototype%":o,"%AsyncFunction%":_,"%AsyncGenerator%":_,"%AsyncGeneratorFunction%":_,"%AsyncIteratorPrototype%":_,"%Atomics%":typeof Atomics>"u"?o:Atomics,"%BigInt%":typeof BigInt>"u"?o:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?o:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?o:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?o:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":l,"%eval%":eval,"%EvalError%":s,"%Float32Array%":typeof Float32Array>"u"?o:Float32Array,"%Float64Array%":typeof Float64Array>"u"?o:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?o:FinalizationRegistry,"%Function%":e,"%GeneratorFunction%":_,"%Int8Array%":typeof Int8Array>"u"?o:Int8Array,"%Int16Array%":typeof Int16Array>"u"?o:Int16Array,"%Int32Array%":typeof Int32Array>"u"?o:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&w?w(w([][Symbol.iterator]())):o,"%JSON%":typeof JSON=="object"?JSON:o,"%Map%":typeof Map>"u"?o:Map,"%MapIteratorPrototype%":typeof Map>"u"||!m||!w?o:w(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?o:Promise,"%Proxy%":typeof Proxy>"u"?o:Proxy,"%RangeError%":a,"%ReferenceError%":u,"%Reflect%":typeof Reflect>"u"?o:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?o:Set,"%SetIteratorPrototype%":typeof Set>"u"||!m||!w?o:w(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?o:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&w?w(""[Symbol.iterator]()):o,"%Symbol%":m?Symbol:o,"%SyntaxError%":r,"%ThrowTypeError%":d,"%TypedArray%":A,"%TypeError%":t,"%Uint8Array%":typeof Uint8Array>"u"?o:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?o:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?o:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?o:Uint32Array,"%URIError%":n,"%WeakMap%":typeof WeakMap>"u"?o:WeakMap,"%WeakRef%":typeof WeakRef>"u"?o:WeakRef,"%WeakSet%":typeof WeakSet>"u"?o:WeakSet};if(w)try{null.error}catch(re){var S=w(w(re));g["%Error.prototype%"]=S}var E=function re(ee){var ue;if(ee==="%AsyncFunction%")ue=i("async function () {}");else if(ee==="%GeneratorFunction%")ue=i("function* () {}");else if(ee==="%AsyncGeneratorFunction%")ue=i("async function* () {}");else if(ee==="%AsyncGenerator%"){var G=re("%AsyncGeneratorFunction%");G&&(ue=G.prototype)}else if(ee==="%AsyncIteratorPrototype%"){var oe=re("%AsyncGenerator%");oe&&w&&(ue=w(oe.prototype))}return g[ee]=ue,ue},v={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},C=Ri(),P=nf(),I=C.call(Function.call,Array.prototype.concat),O=C.call(Function.apply,Array.prototype.splice),k=C.call(Function.call,String.prototype.replace),M=C.call(Function.call,String.prototype.slice),x=C.call(Function.call,RegExp.prototype.exec),W=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,$=/\\(\\)?/g,L=function(re){var ee=M(re,0,1),ue=M(re,-1);if(ee==="%"&&ue!=="%")throw new r("invalid intrinsic syntax, expected closing `%`");if(ue==="%"&&ee!=="%")throw new r("invalid intrinsic syntax, expected opening `%`");var G=[];return k(re,W,function(oe,R,Q,he){G[G.length]=Q?k(he,$,"$1"):R||oe}),G},le=function(re,ee){var ue=re,G;if(P(v,ue)&&(G=v[ue],ue="%"+G[0]+"%"),P(g,ue)){var oe=g[ue];if(oe===_&&(oe=E(ue)),typeof oe>"u"&&!ee)throw new t("intrinsic "+re+" exists, but is not available. Please file an issue!");return{alias:G,name:ue,value:oe}}throw new r("intrinsic "+re+" does not exist!")};return Dr=function(re,ee){if(typeof re!="string"||re.length===0)throw new t("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof ee!="boolean")throw new t('"allowMissing" argument must be a boolean');if(x(/^%?[^%]*%?$/,re)===null)throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var ue=L(re),G=ue.length>0?ue[0]:"",oe=le("%"+G+"%",ee),R=oe.name,Q=oe.value,he=!1,V=oe.alias;V&&(G=V[0],O(ue,I([0,1],V)));for(var Ee=1,X=!0;Ee<ue.length;Ee+=1){var U=ue[Ee],ae=M(U,0,1),H=M(U,-1);if((ae==='"'||ae==="'"||ae==="`"||H==='"'||H==="'"||H==="`")&&ae!==H)throw new r("property names with quotes must have matching quotes");if((U==="constructor"||!X)&&(he=!0),G+="."+U,R="%"+G+"%",P(g,R))Q=g[R];else if(Q!=null){if(!(U in Q)){if(!ee)throw new t("base intrinsic for "+re+" exists, but the property is not available.");return}if(c&&Ee+1>=ue.length){var te=c(Q,U);X=!!te,X&&"get"in te&&!("originalValue"in te.get)?Q=te.get:Q=Q[U]}else X=P(Q,U),Q=Q[U];X&&!he&&(g[R]=Q)}}return Q},Dr}function Mi(){if(no)return Ur;no=!0;var o=lr(),l=o("%Object.defineProperty%",!0)||!1;if(l)try{l({},"a",{value:1})}catch{l=!1}return Ur=l,Ur}function qs(){if(io)return Fr;io=!0;var o=lr(),l=o("%Object.getOwnPropertyDescriptor%",!0);if(l)try{l([],"length")}catch{l=null}return Fr=l,Fr}function of(){if(oo)return Wr;oo=!0;var o=Mi(),l=$s(),s=vr(),a=qs();return Wr=function(u,r,t){if(!u||typeof u!="object"&&typeof u!="function")throw new s("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new s("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new s("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new s("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new s("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new s("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,e=arguments.length>4?arguments[4]:null,i=arguments.length>5?arguments[5]:null,c=arguments.length>6?arguments[6]:!1,h=!!a&&a(u,r);if(o)o(u,r,{configurable:i===null&&h?h.configurable:!i,enumerable:n===null&&h?h.enumerable:!n,value:t,writable:e===null&&h?h.writable:!e});else if(c||!n&&!e&&!i)u[r]=t;else throw new l("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Wr}function sf(){if(so)return $r;so=!0;var o=Mi(),l=function(){return!!o};return l.hasArrayLengthDefineBug=function(){if(!o)return null;try{return o([],"length",{value:1}).length!==1}catch{return!0}},$r=l,$r}function af(){if(ao)return qr;ao=!0;var o=lr(),l=of(),s=sf()(),a=qs(),u=vr(),r=o("%Math.floor%");return qr=function(t,n){if(typeof t!="function")throw new u("`fn` is not a function");if(typeof n!="number"||n<0||n>4294967295||r(n)!==n)throw new u("`length` must be a positive 32-bit integer");var e=arguments.length>2&&!!arguments[2],i=!0,c=!0;if("length"in t&&a){var h=a(t,"length");h&&!h.configurable&&(i=!1),h&&!h.writable&&(c=!1)}return(i||c||!e)&&(s?l(t,"length",n,!0,!0):l(t,"length",n)),t},qr}function lf(){if(lo)return ur;lo=!0;var o=Ri(),l=lr(),s=af(),a=vr(),u=l("%Function.prototype.apply%"),r=l("%Function.prototype.call%"),t=l("%Reflect.apply%",!0)||o.call(r,u),n=Mi(),e=l("%Math.max%");ur=function(c){if(typeof c!="function")throw new a("a function is required");var h=t(o,r,arguments);return s(h,1+e(0,c.length-(arguments.length-1)),!0)};var i=function(){return t(o,u,arguments)};return n?n(ur,"apply",{value:i}):ur.apply=i,ur}function uf(){if(uo)return Vr;uo=!0;var o=lr(),l=lf(),s=l(o("String.prototype.indexOf"));return Vr=function(a,u){var r=o(a,!!u);return typeof r=="function"&&s(a,".prototype.")>-1?l(r):r},Vr}var Ni,Bi,Li,Di,Ui,Fi,Wi,$i,qi,Vi,zi,Ki,Hi,Gi,Yi,Qi,Rr,Ji,Mr,Xi,Nr,Zi,Br,eo,Lr,to,Dr,ro,Ur,no,Fr,io,Wr,oo,$r,so,qr,ao,ur,lo,Vr,uo,cf=_t(()=>{de(),me(),ge(),Ni={},Bi=!1,Li={},Di=!1,Ui={},Fi=!1,Wi={},$i=!1,qi={},Vi=!1,zi={},Ki=!1,Hi={},Gi=!1,Yi={},Qi=!1,Rr={},Ji=!1,Mr={},Xi=!1,Nr={},Zi=!1,Br={},eo=!1,Lr={},to=!1,Dr={},ro=!1,Ur={},no=!1,Fr={},io=!1,Wr={},oo=!1,$r={},so=!1,qr={},ao=!1,ur={},lo=!1,Vr={},uo=!1});function co(o){throw new Error("Node.js process "+o+" is not supported by JSPM core outside of Node.js")}function ff(){!Zt||!er||(Zt=!1,er.length?Tt=er.concat(Tt):wr=-1,Tt.length&&Vs())}function Vs(){if(!Zt){var o=setTimeout(ff,0);Zt=!0;for(var l=Tt.length;l;){for(er=Tt,Tt=[];++wr<l;)er&&er[wr].run();wr=-1,l=Tt.length}er=null,Zt=!1,clearTimeout(o)}}function hf(o){var l=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)l[s-1]=arguments[s];Tt.push(new zs(o,l)),Tt.length===1&&!Zt&&setTimeout(Vs,0)}function zs(o,l){this.fun=o,this.array=l}function bt(){}function pf(o){co("_linkedBinding")}function df(o){co("dlopen")}function gf(){return[]}function mf(){return[]}function yf(o,l){if(!o)throw new Error(l||"assertion error")}function bf(){return!1}function vf(){return Lt.now()/1e3}function fo(o){var l=Math.floor((Date.now()-Lt.now())*.001),s=Lt.now()*.001,a=Math.floor(s)+l,u=Math.floor(s%1*1e9);return o&&(a=a-o[0],u=u-o[1],u<0&&(a--,u+=Kr)),[a,u]}function $t(){return po}function wf(o){return[]}var Tt,Zt,er,wr,Ks,Hs,Gs,Ys,Qs,Js,Xs,Zs,ea,ta,ra,na,ia,oa,sa,aa,la,ua,ca,fa,ha,zr,pa,da,ga,ma,ya,ba,va,wa,_a,Sa,Ea,Aa,xa,Ia,ka,Ta,Oa,Pa,Ca,ja,Ra,Ma,Na,Ba,La,Lt,ho,Kr,Da,Ua,Fa,Wa,$a,qa,Va,za,Ka,Ha,Ga,po,Ya=_t(()=>{de(),me(),ge(),Tt=[],Zt=!1,wr=-1,zs.prototype.run=function(){this.fun.apply(null,this.array)},Ks="browser",Hs="x64",Gs="browser",Ys={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Qs=["/usr/bin/node"],Js=[],Xs="v16.8.0",Zs={},ea=function(o,l){console.warn((l?l+": ":"")+o)},ta=function(o){co("binding")},ra=function(o){return 0},na=function(){return"/"},ia=function(o){},oa={name:"node",sourceUrl:"",headersUrl:"",libUrl:""},sa=bt,aa=[],la={},ua=!1,ca={},fa=bt,ha=bt,zr=function(){return{}},pa=zr,da=zr,ga=bt,ma=bt,ya=bt,ba={},va={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},wa=bt,_a=bt,Sa=bt,Ea=bt,Aa=bt,xa=bt,Ia=bt,ka=void 0,Ta=void 0,Oa=void 0,Pa=bt,Ca=2,ja=1,Ra="/bin/usr/node",Ma=9229,Na="node",Ba=[],La=bt,Lt={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},Lt.now===void 0&&(ho=Date.now(),Lt.timing&&Lt.timing.navigationStart&&(ho=Lt.timing.navigationStart),Lt.now=()=>Date.now()-ho),Kr=1e9,fo.bigint=function(o){var l=fo(o);return typeof BigInt>"u"?l[0]*Kr+l[1]:BigInt(l[0]*Kr)+BigInt(l[1])},Da=10,Ua={},Fa=0,Wa=$t,$a=$t,qa=$t,Va=$t,za=$t,Ka=bt,Ha=$t,Ga=$t,po={version:Xs,versions:Zs,arch:Hs,platform:Gs,release:oa,_rawDebug:sa,moduleLoadList:aa,binding:ta,_linkedBinding:pf,_events:Ua,_eventsCount:Fa,_maxListeners:Da,on:$t,addListener:Wa,once:$a,off:qa,removeListener:Va,removeAllListeners:za,emit:Ka,prependListener:Ha,prependOnceListener:Ga,listeners:wf,domain:la,_exiting:ua,config:ca,dlopen:df,uptime:vf,_getActiveRequests:gf,_getActiveHandles:mf,reallyExit:fa,_kill:ha,cpuUsage:zr,resourceUsage:pa,memoryUsage:da,kill:ga,exit:ma,openStdin:ya,allowedNodeEnvironmentFlags:ba,assert:yf,features:va,_fatalExceptions:wa,setUncaughtExceptionCaptureCallback:_a,hasUncaughtExceptionCaptureCallback:bf,emitWarning:ea,nextTick:hf,_tickCallback:Sa,_debugProcess:Ea,_debugEnd:Aa,_startProfilerIdleNotifier:xa,_stopProfilerIdleNotifier:Ia,stdout:ka,stdin:Oa,stderr:Ta,abort:Pa,umask:ra,chdir:ia,cwd:na,env:Ys,title:Ks,argv:Qs,execArgv:Js,pid:Ca,ppid:ja,execPath:Ra,debugPort:Ma,hrtime:fo,argv0:Na,_preload_modules:Ba,setSourceMapsEnabled:La}});function _f(){if(go)return Hr;go=!0;var o=po;function l(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}function s(r,t){for(var n="",e=0,i=-1,c=0,h,d=0;d<=r.length;++d){if(d<r.length)h=r.charCodeAt(d);else{if(h===47)break;h=47}if(h===47){if(!(i===d-1||c===1))if(i!==d-1&&c===2){if(n.length<2||e!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){var m=n.lastIndexOf("/");if(m!==n.length-1){m===-1?(n="",e=0):(n=n.slice(0,m),e=n.length-1-n.lastIndexOf("/")),i=d,c=0;continue}}else if(n.length===2||n.length===1){n="",e=0,i=d,c=0;continue}}t&&(n.length>0?n+="/..":n="..",e=2)}else n.length>0?n+="/"+r.slice(i+1,d):n=r.slice(i+1,d),e=d-i-1;i=d,c=0}else h===46&&c!==-1?++c:c=-1}return n}function a(r,t){var n=t.dir||t.root,e=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+e:n+r+e:e}var u={resolve:function(){for(var r="",t=!1,n,e=arguments.length-1;e>=-1&&!t;e--){var i;e>=0?i=arguments[e]:(n===void 0&&(n=o.cwd()),i=n),l(i),i.length!==0&&(r=i+"/"+r,t=i.charCodeAt(0)===47)}return r=s(r,!t),t?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(r){if(l(r),r.length===0)return".";var t=r.charCodeAt(0)===47,n=r.charCodeAt(r.length-1)===47;return r=s(r,!t),r.length===0&&!t&&(r="."),r.length>0&&n&&(r+="/"),t?"/"+r:r},isAbsolute:function(r){return l(r),r.length>0&&r.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var r,t=0;t<arguments.length;++t){var n=arguments[t];l(n),n.length>0&&(r===void 0?r=n:r+="/"+n)}return r===void 0?".":u.normalize(r)},relative:function(r,t){if(l(r),l(t),r===t||(r=u.resolve(r),t=u.resolve(t),r===t))return"";for(var n=1;n<r.length&&r.charCodeAt(n)===47;++n);for(var e=r.length,i=e-n,c=1;c<t.length&&t.charCodeAt(c)===47;++c);for(var h=t.length,d=h-c,m=i<d?i:d,b=-1,w=0;w<=m;++w){if(w===m){if(d>m){if(t.charCodeAt(c+w)===47)return t.slice(c+w+1);if(w===0)return t.slice(c+w)}else i>m&&(r.charCodeAt(n+w)===47?b=w:w===0&&(b=0));break}var _=r.charCodeAt(n+w),A=t.charCodeAt(c+w);if(_!==A)break;_===47&&(b=w)}var g="";for(w=n+b+1;w<=e;++w)(w===e||r.charCodeAt(w)===47)&&(g.length===0?g+="..":g+="/..");return g.length>0?g+t.slice(c+b):(c+=b,t.charCodeAt(c)===47&&++c,t.slice(c))},_makeLong:function(r){return r},dirname:function(r){if(l(r),r.length===0)return".";for(var t=r.charCodeAt(0),n=t===47,e=-1,i=!0,c=r.length-1;c>=1;--c)if(t=r.charCodeAt(c),t===47){if(!i){e=c;break}}else i=!1;return e===-1?n?"/":".":n&&e===1?"//":r.slice(0,e)},basename:function(r,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');l(r);var n=0,e=-1,i=!0,c;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";var h=t.length-1,d=-1;for(c=r.length-1;c>=0;--c){var m=r.charCodeAt(c);if(m===47){if(!i){n=c+1;break}}else d===-1&&(i=!1,d=c+1),h>=0&&(m===t.charCodeAt(h)?--h===-1&&(e=c):(h=-1,e=d))}return n===e?e=d:e===-1&&(e=r.length),r.slice(n,e)}else{for(c=r.length-1;c>=0;--c)if(r.charCodeAt(c)===47){if(!i){n=c+1;break}}else e===-1&&(i=!1,e=c+1);return e===-1?"":r.slice(n,e)}},extname:function(r){l(r);for(var t=-1,n=0,e=-1,i=!0,c=0,h=r.length-1;h>=0;--h){var d=r.charCodeAt(h);if(d===47){if(!i){n=h+1;break}continue}e===-1&&(i=!1,e=h+1),d===46?t===-1?t=h:c!==1&&(c=1):t!==-1&&(c=-1)}return t===-1||e===-1||c===0||c===1&&t===e-1&&t===n+1?"":r.slice(t,e)},format:function(r){if(r===null||typeof r!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof r);return a("/",r)},parse:function(r){l(r);var t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;var n=r.charCodeAt(0),e=n===47,i;e?(t.root="/",i=1):i=0;for(var c=-1,h=0,d=-1,m=!0,b=r.length-1,w=0;b>=i;--b){if(n=r.charCodeAt(b),n===47){if(!m){h=b+1;break}continue}d===-1&&(m=!1,d=b+1),n===46?c===-1?c=b:w!==1&&(w=1):c!==-1&&(w=-1)}return c===-1||d===-1||w===0||w===1&&c===d-1&&c===h+1?d!==-1&&(h===0&&e?t.base=t.name=r.slice(1,d):t.base=t.name=r.slice(h,d)):(h===0&&e?(t.name=r.slice(1,c),t.base=r.slice(1,d)):(t.name=r.slice(h,c),t.base=r.slice(h,d)),t.ext=r.slice(c,d)),h>0?t.dir=r.slice(0,h-1):e&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};return u.posix=u,Hr=u,Hr}var Hr,go,mo,Sf=_t(()=>{de(),me(),ge(),Ya(),Hr={},go=!1,mo=_f()}),Qa={};nr(Qa,{URL:()=>al,Url:()=>rl,default:()=>vt,fileURLToPath:()=>Xa,format:()=>nl,parse:()=>sl,pathToFileURL:()=>Za,resolve:()=>il,resolveObject:()=>ol});function Ef(){if(bo)return Gr;bo=!0;var o=typeof Map=="function"&&Map.prototype,l=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,s=o&&l&&typeof l.get=="function"?l.get:null,a=o&&Map.prototype.forEach,u=typeof Set=="function"&&Set.prototype,r=Object.getOwnPropertyDescriptor&&u?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,t=u&&r&&typeof r.get=="function"?r.get:null,n=u&&Set.prototype.forEach,e=typeof WeakMap=="function"&&WeakMap.prototype,i=e?WeakMap.prototype.has:null,c=typeof WeakSet=="function"&&WeakSet.prototype,h=c?WeakSet.prototype.has:null,d=typeof WeakRef=="function"&&WeakRef.prototype,m=d?WeakRef.prototype.deref:null,b=Boolean.prototype.valueOf,w=Object.prototype.toString,_=Function.prototype.toString,A=String.prototype.match,g=String.prototype.slice,S=String.prototype.replace,E=String.prototype.toUpperCase,v=String.prototype.toLowerCase,C=RegExp.prototype.test,P=Array.prototype.concat,I=Array.prototype.join,O=Array.prototype.slice,k=Math.floor,M=typeof BigInt=="function"?BigInt.prototype.valueOf:null,x=Object.getOwnPropertySymbols,W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,$=typeof Symbol=="function"&&typeof Symbol.iterator=="object",L=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===$||!0)?Symbol.toStringTag:null,le=Object.prototype.propertyIsEnumerable,re=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(q){return q.__proto__}:null);function ee(q,J){if(q===1/0||q===-1/0||q!==q||q&&q>-1e3&&q<1e3||C.call(/e/,J))return J;var Oe=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof q=="number"){var Me=q<0?-k(-q):k(q);if(Me!==q){var Ne=String(Me),Fe=g.call(J,Ne.length+1);return S.call(Ne,Oe,"$&_")+"."+S.call(S.call(Fe,/([0-9]{3})/g,"$&_"),/_$/,"")}}return S.call(J,Oe,"$&_")}var ue=el,G=ue.custom,oe=te(G)?G:null;Gr=function q(J,Oe,Me,Ne){var Fe=Oe||{};if(ce(Fe,"quoteStyle")&&Fe.quoteStyle!=="single"&&Fe.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ce(Fe,"maxStringLength")&&(typeof Fe.maxStringLength=="number"?Fe.maxStringLength<0&&Fe.maxStringLength!==1/0:Fe.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var nt=ce(Fe,"customInspect")?Fe.customInspect:!0;if(typeof nt!="boolean"&&nt!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ce(Fe,"indent")&&Fe.indent!==null&&Fe.indent!==" "&&!(parseInt(Fe.indent,10)===Fe.indent&&Fe.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ce(Fe,"numericSeparator")&&typeof Fe.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var rt=Fe.numericSeparator;if(typeof J>"u")return"undefined";if(J===null)return"null";if(typeof J=="boolean")return J?"true":"false";if(typeof J=="string")return fe(J,Fe);if(typeof J=="number"){if(J===0)return 1/0/J>0?"0":"-0";var Ke=String(J);return rt?ee(J,Ke):Ke}if(typeof J=="bigint"){var Xe=String(J)+"n";return rt?ee(J,Xe):Xe}var De=typeof Fe.depth>"u"?5:Fe.depth;if(typeof Me>"u"&&(Me=0),Me>=De&&De>0&&typeof J=="object")return he(J)?"[Array]":"[Object]";var Ye=N(Fe,Me);if(typeof Ne>"u")Ne=[];else if(se(Ne,J)>=0)return"[Circular]";function Ze(Ge,ze,Ve){if(ze&&(Ne=O.call(Ne),Ne.push(ze)),Ve){var it={depth:Fe.depth};return ce(Fe,"quoteStyle")&&(it.quoteStyle=Fe.quoteStyle),q(Ge,it,Me+1,Ne)}return q(Ge,Fe,Me+1,Ne)}if(typeof J=="function"&&!Ee(J)){var lt=Y(J),ct=ie(J,Ze);return"[Function"+(lt?": "+lt:" (anonymous)")+"]"+(ct.length>0?" { "+I.call(ct,", ")+" }":"")}if(te(J)){var Et=$?S.call(String(J),/^(Symbol\(.*\))_[^)]*$/,"$1"):W.call(J);return typeof J=="object"&&!$?f(Et):Et}if(ke(J)){for(var j="<"+v.call(String(J.nodeName)),D=J.attributes||[],xe=0;xe<D.length;xe++)j+=" "+D[xe].name+"="+R(Q(D[xe].value),"double",Fe);return j+=">",J.childNodes&&J.childNodes.length&&(j+="..."),j+="</"+v.call(String(J.nodeName))+">",j}if(he(J)){if(J.length===0)return"[]";var Ce=ie(J,Ze);return Ye&&!T(Ce)?"["+z(Ce,Ye)+"]":"[ "+I.call(Ce,", ")+" ]"}if(X(J)){var Be=ie(J,Ze);return!("cause"in Error.prototype)&&"cause"in J&&!le.call(J,"cause")?"{ ["+String(J)+"] "+I.call(P.call("[cause]: "+Ze(J.cause),Be),", ")+" }":Be.length===0?"["+String(J)+"]":"{ ["+String(J)+"] "+I.call(Be,", ")+" }"}if(typeof J=="object"&&nt){if(oe&&typeof J[oe]=="function"&&ue)return ue(J,{depth:De-Me});if(nt!=="symbol"&&typeof J.inspect=="function")return J.inspect()}if(ye(J)){var ft=[];return a&&a.call(J,function(Ge,ze){ft.push(Ze(ze,J,!0)+" => "+Ze(Ge,J))}),y("Map",s.call(J),ft,Ye)}if(Z(J)){var mt=[];return n&&n.call(J,function(Ge){mt.push(Ze(Ge,J))}),y("Set",t.call(J),mt,Ye)}if(pe(J))return p("WeakMap");if(we(J))return p("WeakSet");if(Se(J))return p("WeakRef");if(ae(J))return f(Ze(Number(J)));if(ne(J))return f(Ze(M.call(J)));if(H(J))return f(b.call(J));if(U(J))return f(Ze(String(J)));if(typeof window<"u"&&J===window)return"{ [object Window] }";if(typeof globalThis<"u"&&J===globalThis||typeof Yr<"u"&&J===Yr)return"{ [object globalThis] }";if(!V(J)&&!Ee(J)){var xt=ie(J,Ze),K=re?re(J)===Object.prototype:J instanceof Object||J.constructor===Object,Ae=J instanceof Object?"":"null prototype",Re=!K&&L&&Object(J)===J&&L in J?g.call(B(J),8,-1):Ae?"Object":"",We=K||typeof J.constructor!="function"?"":J.constructor.name?J.constructor.name+" ":"",He=We+(Re||Ae?"["+I.call(P.call([],Re||[],Ae||[]),": ")+"] ":"");return xt.length===0?He+"{}":Ye?He+"{"+z(xt,Ye)+"}":He+"{ "+I.call(xt,", ")+" }"}return String(J)};function R(q,J,Oe){var Me=(Oe.quoteStyle||J)==="double"?'"':"'";return Me+q+Me}function Q(q){return S.call(String(q),/"/g,"&quot;")}function he(q){return B(q)==="[object Array]"&&(!L||!(typeof q=="object"&&L in q))}function V(q){return B(q)==="[object Date]"&&(!L||!(typeof q=="object"&&L in q))}function Ee(q){return B(q)==="[object RegExp]"&&(!L||!(typeof q=="object"&&L in q))}function X(q){return B(q)==="[object Error]"&&(!L||!(typeof q=="object"&&L in q))}function U(q){return B(q)==="[object String]"&&(!L||!(typeof q=="object"&&L in q))}function ae(q){return B(q)==="[object Number]"&&(!L||!(typeof q=="object"&&L in q))}function H(q){return B(q)==="[object Boolean]"&&(!L||!(typeof q=="object"&&L in q))}function te(q){if($)return q&&typeof q=="object"&&q instanceof Symbol;if(typeof q=="symbol")return!0;if(!q||typeof q!="object"||!W)return!1;try{return W.call(q),!0}catch{}return!1}function ne(q){if(!q||typeof q!="object"||!M)return!1;try{return M.call(q),!0}catch{}return!1}var ve=Object.prototype.hasOwnProperty||function(q){return q in(this||Yr)};function ce(q,J){return ve.call(q,J)}function B(q){return w.call(q)}function Y(q){if(q.name)return q.name;var J=A.call(_.call(q),/^function\s*([\w$]+)/);return J?J[1]:null}function se(q,J){if(q.indexOf)return q.indexOf(J);for(var Oe=0,Me=q.length;Oe<Me;Oe++)if(q[Oe]===J)return Oe;return-1}function ye(q){if(!s||!q||typeof q!="object")return!1;try{s.call(q);try{t.call(q)}catch{return!0}return q instanceof Map}catch{}return!1}function pe(q){if(!i||!q||typeof q!="object")return!1;try{i.call(q,i);try{h.call(q,h)}catch{return!0}return q instanceof WeakMap}catch{}return!1}function Se(q){if(!m||!q||typeof q!="object")return!1;try{return m.call(q),!0}catch{}return!1}function Z(q){if(!t||!q||typeof q!="object")return!1;try{t.call(q);try{s.call(q)}catch{return!0}return q instanceof Set}catch{}return!1}function we(q){if(!h||!q||typeof q!="object")return!1;try{h.call(q,h);try{i.call(q,i)}catch{return!0}return q instanceof WeakSet}catch{}return!1}function ke(q){return!q||typeof q!="object"?!1:typeof HTMLElement<"u"&&q instanceof HTMLElement?!0:typeof q.nodeName=="string"&&typeof q.getAttribute=="function"}function fe(q,J){if(q.length>J.maxStringLength){var Oe=q.length-J.maxStringLength,Me="... "+Oe+" more character"+(Oe>1?"s":"");return fe(g.call(q,0,J.maxStringLength),J)+Me}var Ne=S.call(S.call(q,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Ue);return R(Ne,"single",J)}function Ue(q){var J=q.charCodeAt(0),Oe={8:"b",9:"t",10:"n",12:"f",13:"r"}[J];return Oe?"\\"+Oe:"\\x"+(J<16?"0":"")+E.call(J.toString(16))}function f(q){return"Object("+q+")"}function p(q){return q+" { ? }"}function y(q,J,Oe,Me){var Ne=Me?z(Oe,Me):I.call(Oe,", ");return q+" ("+J+") {"+Ne+"}"}function T(q){for(var J=0;J<q.length;J++)if(se(q[J],`
33
- `)>=0)return!1;return!0}function N(q,J){var Oe;if(q.indent===" ")Oe=" ";else if(typeof q.indent=="number"&&q.indent>0)Oe=I.call(Array(q.indent+1)," ");else return null;return{base:Oe,prev:I.call(Array(J+1),Oe)}}function z(q,J){if(q.length===0)return"";var Oe=`
34
- `+J.prev+J.base;return Oe+I.call(q,","+Oe)+`
35
- `+J.prev}function ie(q,J){var Oe=he(q),Me=[];if(Oe){Me.length=q.length;for(var Ne=0;Ne<q.length;Ne++)Me[Ne]=ce(q,Ne)?J(q[Ne],q):""}var Fe=typeof x=="function"?x(q):[],nt;if($){nt={};for(var rt=0;rt<Fe.length;rt++)nt["$"+Fe[rt]]=Fe[rt]}for(var Ke in q)ce(q,Ke)&&(Oe&&String(Number(Ke))===Ke&&Ke<q.length||$&&nt["$"+Ke]instanceof Symbol||(C.call(/[^\w$]/,Ke)?Me.push(J(Ke,q)+": "+J(q[Ke],q)):Me.push(Ke+": "+J(q[Ke],q))));if(typeof x=="function")for(var Xe=0;Xe<Fe.length;Xe++)le.call(q,Fe[Xe])&&Me.push("["+J(Fe[Xe])+"]: "+J(q[Fe[Xe]],q));return Me}return Gr}function Af(){if(vo)return Qr;vo=!0;var o=lr(),l=uf(),s=Ef(),a=vr(),u=o("%WeakMap%",!0),r=o("%Map%",!0),t=l("WeakMap.prototype.get",!0),n=l("WeakMap.prototype.set",!0),e=l("WeakMap.prototype.has",!0),i=l("Map.prototype.get",!0),c=l("Map.prototype.set",!0),h=l("Map.prototype.has",!0),d=function(_,A){for(var g=_,S;(S=g.next)!==null;g=S)if(S.key===A)return g.next=S.next,S.next=_.next,_.next=S,S},m=function(_,A){var g=d(_,A);return g&&g.value},b=function(_,A,g){var S=d(_,A);S?S.value=g:_.next={key:A,next:_.next,value:g}},w=function(_,A){return!!d(_,A)};return Qr=function(){var _,A,g,S={assert:function(E){if(!S.has(E))throw new a("Side channel does not contain "+s(E))},get:function(E){if(u&&E&&(typeof E=="object"||typeof E=="function")){if(_)return t(_,E)}else if(r){if(A)return i(A,E)}else if(g)return m(g,E)},has:function(E){if(u&&E&&(typeof E=="object"||typeof E=="function")){if(_)return e(_,E)}else if(r){if(A)return h(A,E)}else if(g)return w(g,E);return!1},set:function(E,v){u&&E&&(typeof E=="object"||typeof E=="function")?(_||(_=new u),n(_,E,v)):r?(A||(A=new r),c(A,E,v)):(g||(g={key:{},next:null}),b(g,E,v))}};return S},Qr}function yo(){if(wo)return Jr;wo=!0;var o=String.prototype.replace,l=/%20/g,s={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Jr={default:s.RFC3986,formatters:{RFC1738:function(a){return o.call(a,l,"+")},RFC3986:function(a){return String(a)}},RFC1738:s.RFC1738,RFC3986:s.RFC3986},Jr}function Ja(){if(_o)return Xr;_o=!0;var o=yo(),l=Object.prototype.hasOwnProperty,s=Array.isArray,a=function(){for(var _=[],A=0;A<256;++A)_.push("%"+((A<16?"0":"")+A.toString(16)).toUpperCase());return _}(),u=function(_){for(;_.length>1;){var A=_.pop(),g=A.obj[A.prop];if(s(g)){for(var S=[],E=0;E<g.length;++E)typeof g[E]<"u"&&S.push(g[E]);A.obj[A.prop]=S}}},r=function(_,A){for(var g=A&&A.plainObjects?Object.create(null):{},S=0;S<_.length;++S)typeof _[S]<"u"&&(g[S]=_[S]);return g},t=function _(A,g,S){if(!g)return A;if(typeof g!="object"){if(s(A))A.push(g);else if(A&&typeof A=="object")(S&&(S.plainObjects||S.allowPrototypes)||!l.call(Object.prototype,g))&&(A[g]=!0);else return[A,g];return A}if(!A||typeof A!="object")return[A].concat(g);var E=A;return s(A)&&!s(g)&&(E=r(A,S)),s(A)&&s(g)?(g.forEach(function(v,C){if(l.call(A,C)){var P=A[C];P&&typeof P=="object"&&v&&typeof v=="object"?A[C]=_(P,v,S):A.push(v)}else A[C]=v}),A):Object.keys(g).reduce(function(v,C){var P=g[C];return l.call(v,C)?v[C]=_(v[C],P,S):v[C]=P,v},E)},n=function(_,A){return Object.keys(A).reduce(function(g,S){return g[S]=A[S],g},_)},e=function(_,A,g){var S=_.replace(/\+/g," ");if(g==="iso-8859-1")return S.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(S)}catch{return S}},i=1024,c=function(_,A,g,S,E){if(_.length===0)return _;var v=_;if(typeof _=="symbol"?v=Symbol.prototype.toString.call(_):typeof _!="string"&&(v=String(_)),g==="iso-8859-1")return escape(v).replace(/%u[0-9a-f]{4}/gi,function(x){return"%26%23"+parseInt(x.slice(2),16)+"%3B"});for(var C="",P=0;P<v.length;P+=i){for(var I=v.length>=i?v.slice(P,P+i):v,O=[],k=0;k<I.length;++k){var M=I.charCodeAt(k);if(M===45||M===46||M===95||M===126||M>=48&&M<=57||M>=65&&M<=90||M>=97&&M<=122||E===o.RFC1738&&(M===40||M===41)){O[O.length]=I.charAt(k);continue}if(M<128){O[O.length]=a[M];continue}if(M<2048){O[O.length]=a[192|M>>6]+a[128|M&63];continue}if(M<55296||M>=57344){O[O.length]=a[224|M>>12]+a[128|M>>6&63]+a[128|M&63];continue}k+=1,M=65536+((M&1023)<<10|I.charCodeAt(k)&1023),O[O.length]=a[240|M>>18]+a[128|M>>12&63]+a[128|M>>6&63]+a[128|M&63]}C+=O.join("")}return C},h=function(_){for(var A=[{obj:{o:_},prop:"o"}],g=[],S=0;S<A.length;++S)for(var E=A[S],v=E.obj[E.prop],C=Object.keys(v),P=0;P<C.length;++P){var I=C[P],O=v[I];typeof O=="object"&&O!==null&&g.indexOf(O)===-1&&(A.push({obj:v,prop:I}),g.push(O))}return u(A),_},d=function(_){return Object.prototype.toString.call(_)==="[object RegExp]"},m=function(_){return!_||typeof _!="object"?!1:!!(_.constructor&&_.constructor.isBuffer&&_.constructor.isBuffer(_))},b=function(_,A){return[].concat(_,A)},w=function(_,A){if(s(_)){for(var g=[],S=0;S<_.length;S+=1)g.push(A(_[S]));return g}return A(_)};return Xr={arrayToObject:r,assign:n,combine:b,compact:h,decode:e,encode:c,isBuffer:m,isRegExp:d,maybeMap:w,merge:t},Xr}function xf(){if(So)return Zr;So=!0;var o=Af(),l=Ja(),s=yo(),a=Object.prototype.hasOwnProperty,u={brackets:function(w){return w+"[]"},comma:"comma",indices:function(w,_){return w+"["+_+"]"},repeat:function(w){return w}},r=Array.isArray,t=Array.prototype.push,n=function(w,_){t.apply(w,r(_)?_:[_])},e=Date.prototype.toISOString,i=s.default,c={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:l.encode,encodeValuesOnly:!1,format:i,formatter:s.formatters[i],indices:!1,serializeDate:function(w){return e.call(w)},skipNulls:!1,strictNullHandling:!1},h=function(w){return typeof w=="string"||typeof w=="number"||typeof w=="boolean"||typeof w=="symbol"||typeof w=="bigint"},d={},m=function w(_,A,g,S,E,v,C,P,I,O,k,M,x,W,$,L,le,re){for(var ee=_,ue=re,G=0,oe=!1;(ue=ue.get(d))!==void 0&&!oe;){var R=ue.get(_);if(G+=1,typeof R<"u"){if(R===G)throw new RangeError("Cyclic object value");oe=!0}typeof ue.get(d)>"u"&&(G=0)}if(typeof O=="function"?ee=O(A,ee):ee instanceof Date?ee=x(ee):g==="comma"&&r(ee)&&(ee=l.maybeMap(ee,function(B){return B instanceof Date?x(B):B})),ee===null){if(v)return I&&!L?I(A,c.encoder,le,"key",W):A;ee=""}if(h(ee)||l.isBuffer(ee)){if(I){var Q=L?A:I(A,c.encoder,le,"key",W);return[$(Q)+"="+$(I(ee,c.encoder,le,"value",W))]}return[$(A)+"="+$(String(ee))]}var he=[];if(typeof ee>"u")return he;var V;if(g==="comma"&&r(ee))L&&I&&(ee=l.maybeMap(ee,I)),V=[{value:ee.length>0?ee.join(",")||null:void 0}];else if(r(O))V=O;else{var Ee=Object.keys(ee);V=k?Ee.sort(k):Ee}var X=P?A.replace(/\./g,"%2E"):A,U=S&&r(ee)&&ee.length===1?X+"[]":X;if(E&&r(ee)&&ee.length===0)return U+"[]";for(var ae=0;ae<V.length;++ae){var H=V[ae],te=typeof H=="object"&&typeof H.value<"u"?H.value:ee[H];if(!(C&&te===null)){var ne=M&&P?H.replace(/\./g,"%2E"):H,ve=r(ee)?typeof g=="function"?g(U,ne):U:U+(M?"."+ne:"["+ne+"]");re.set(_,G);var ce=o();ce.set(d,re),n(he,w(te,ve,g,S,E,v,C,P,g==="comma"&&L&&r(ee)?null:I,O,k,M,x,W,$,L,le,ce))}}return he},b=function(w){if(!w)return c;if(typeof w.allowEmptyArrays<"u"&&typeof w.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof w.encodeDotInKeys<"u"&&typeof w.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(w.encoder!==null&&typeof w.encoder<"u"&&typeof w.encoder!="function")throw new TypeError("Encoder has to be a function.");var _=w.charset||c.charset;if(typeof w.charset<"u"&&w.charset!=="utf-8"&&w.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var A=s.default;if(typeof w.format<"u"){if(!a.call(s.formatters,w.format))throw new TypeError("Unknown format option provided.");A=w.format}var g=s.formatters[A],S=c.filter;(typeof w.filter=="function"||r(w.filter))&&(S=w.filter);var E;if(w.arrayFormat in u?E=w.arrayFormat:"indices"in w?E=w.indices?"indices":"repeat":E=c.arrayFormat,"commaRoundTrip"in w&&typeof w.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var v=typeof w.allowDots>"u"?w.encodeDotInKeys===!0?!0:c.allowDots:!!w.allowDots;return{addQueryPrefix:typeof w.addQueryPrefix=="boolean"?w.addQueryPrefix:c.addQueryPrefix,allowDots:v,allowEmptyArrays:typeof w.allowEmptyArrays=="boolean"?!!w.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:E,charset:_,charsetSentinel:typeof w.charsetSentinel=="boolean"?w.charsetSentinel:c.charsetSentinel,commaRoundTrip:w.commaRoundTrip,delimiter:typeof w.delimiter>"u"?c.delimiter:w.delimiter,encode:typeof w.encode=="boolean"?w.encode:c.encode,encodeDotInKeys:typeof w.encodeDotInKeys=="boolean"?w.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof w.encoder=="function"?w.encoder:c.encoder,encodeValuesOnly:typeof w.encodeValuesOnly=="boolean"?w.encodeValuesOnly:c.encodeValuesOnly,filter:S,format:A,formatter:g,serializeDate:typeof w.serializeDate=="function"?w.serializeDate:c.serializeDate,skipNulls:typeof w.skipNulls=="boolean"?w.skipNulls:c.skipNulls,sort:typeof w.sort=="function"?w.sort:null,strictNullHandling:typeof w.strictNullHandling=="boolean"?w.strictNullHandling:c.strictNullHandling}};return Zr=function(w,_){var A=w,g=b(_),S,E;typeof g.filter=="function"?(E=g.filter,A=E("",A)):r(g.filter)&&(E=g.filter,S=E);var v=[];if(typeof A!="object"||A===null)return"";var C=u[g.arrayFormat],P=C==="comma"&&g.commaRoundTrip;S||(S=Object.keys(A)),g.sort&&S.sort(g.sort);for(var I=o(),O=0;O<S.length;++O){var k=S[O];g.skipNulls&&A[k]===null||n(v,m(A[k],k,C,P,g.allowEmptyArrays,g.strictNullHandling,g.skipNulls,g.encodeDotInKeys,g.encode?g.encoder:null,g.filter,g.sort,g.allowDots,g.serializeDate,g.format,g.formatter,g.encodeValuesOnly,g.charset,I))}var M=v.join(g.delimiter),x=g.addQueryPrefix===!0?"?":"";return g.charsetSentinel&&(g.charset==="iso-8859-1"?x+="utf8=%26%2310003%3B&":x+="utf8=%E2%9C%93&"),M.length>0?x+M:""},Zr}function If(){if(Eo)return en;Eo=!0;var o=Ja(),l=Object.prototype.hasOwnProperty,s=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:o.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},u=function(d){return d.replace(/&#(\d+);/g,function(m,b){return String.fromCharCode(parseInt(b,10))})},r=function(d,m){return d&&typeof d=="string"&&m.comma&&d.indexOf(",")>-1?d.split(","):d},t="utf8=%26%2310003%3B",n="utf8=%E2%9C%93",e=function(d,m){var b={__proto__:null},w=m.ignoreQueryPrefix?d.replace(/^\?/,""):d;w=w.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var _=m.parameterLimit===1/0?void 0:m.parameterLimit,A=w.split(m.delimiter,_),g=-1,S,E=m.charset;if(m.charsetSentinel)for(S=0;S<A.length;++S)A[S].indexOf("utf8=")===0&&(A[S]===n?E="utf-8":A[S]===t&&(E="iso-8859-1"),g=S,S=A.length);for(S=0;S<A.length;++S)if(S!==g){var v=A[S],C=v.indexOf("]="),P=C===-1?v.indexOf("="):C+1,I,O;P===-1?(I=m.decoder(v,a.decoder,E,"key"),O=m.strictNullHandling?null:""):(I=m.decoder(v.slice(0,P),a.decoder,E,"key"),O=o.maybeMap(r(v.slice(P+1),m),function(M){return m.decoder(M,a.decoder,E,"value")})),O&&m.interpretNumericEntities&&E==="iso-8859-1"&&(O=u(O)),v.indexOf("[]=")>-1&&(O=s(O)?[O]:O);var k=l.call(b,I);k&&m.duplicates==="combine"?b[I]=o.combine(b[I],O):(!k||m.duplicates==="last")&&(b[I]=O)}return b},i=function(d,m,b,w){for(var _=w?m:r(m,b),A=d.length-1;A>=0;--A){var g,S=d[A];if(S==="[]"&&b.parseArrays)g=b.allowEmptyArrays&&(_===""||b.strictNullHandling&&_===null)?[]:[].concat(_);else{g=b.plainObjects?Object.create(null):{};var E=S.charAt(0)==="["&&S.charAt(S.length-1)==="]"?S.slice(1,-1):S,v=b.decodeDotInKeys?E.replace(/%2E/g,"."):E,C=parseInt(v,10);!b.parseArrays&&v===""?g={0:_}:!isNaN(C)&&S!==v&&String(C)===v&&C>=0&&b.parseArrays&&C<=b.arrayLimit?(g=[],g[C]=_):v!=="__proto__"&&(g[v]=_)}_=g}return _},c=function(d,m,b,w){if(d){var _=b.allowDots?d.replace(/\.([^.[]+)/g,"[$1]"):d,A=/(\[[^[\]]*])/,g=/(\[[^[\]]*])/g,S=b.depth>0&&A.exec(_),E=S?_.slice(0,S.index):_,v=[];if(E){if(!b.plainObjects&&l.call(Object.prototype,E)&&!b.allowPrototypes)return;v.push(E)}for(var C=0;b.depth>0&&(S=g.exec(_))!==null&&C<b.depth;){if(C+=1,!b.plainObjects&&l.call(Object.prototype,S[1].slice(1,-1))&&!b.allowPrototypes)return;v.push(S[1])}if(S){if(b.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+b.depth+" and strictDepth is true");v.push("["+_.slice(S.index)+"]")}return i(v,m,b,w)}},h=function(d){if(!d)return a;if(typeof d.allowEmptyArrays<"u"&&typeof d.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof d.decodeDotInKeys<"u"&&typeof d.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(d.decoder!==null&&typeof d.decoder<"u"&&typeof d.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof d.charset<"u"&&d.charset!=="utf-8"&&d.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var m=typeof d.charset>"u"?a.charset:d.charset,b=typeof d.duplicates>"u"?a.duplicates:d.duplicates;if(b!=="combine"&&b!=="first"&&b!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var w=typeof d.allowDots>"u"?d.decodeDotInKeys===!0?!0:a.allowDots:!!d.allowDots;return{allowDots:w,allowEmptyArrays:typeof d.allowEmptyArrays=="boolean"?!!d.allowEmptyArrays:a.allowEmptyArrays,allowPrototypes:typeof d.allowPrototypes=="boolean"?d.allowPrototypes:a.allowPrototypes,allowSparse:typeof d.allowSparse=="boolean"?d.allowSparse:a.allowSparse,arrayLimit:typeof d.arrayLimit=="number"?d.arrayLimit:a.arrayLimit,charset:m,charsetSentinel:typeof d.charsetSentinel=="boolean"?d.charsetSentinel:a.charsetSentinel,comma:typeof d.comma=="boolean"?d.comma:a.comma,decodeDotInKeys:typeof d.decodeDotInKeys=="boolean"?d.decodeDotInKeys:a.decodeDotInKeys,decoder:typeof d.decoder=="function"?d.decoder:a.decoder,delimiter:typeof d.delimiter=="string"||o.isRegExp(d.delimiter)?d.delimiter:a.delimiter,depth:typeof d.depth=="number"||d.depth===!1?+d.depth:a.depth,duplicates:b,ignoreQueryPrefix:d.ignoreQueryPrefix===!0,interpretNumericEntities:typeof d.interpretNumericEntities=="boolean"?d.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:typeof d.parameterLimit=="number"?d.parameterLimit:a.parameterLimit,parseArrays:d.parseArrays!==!1,plainObjects:typeof d.plainObjects=="boolean"?d.plainObjects:a.plainObjects,strictDepth:typeof d.strictDepth=="boolean"?!!d.strictDepth:a.strictDepth,strictNullHandling:typeof d.strictNullHandling=="boolean"?d.strictNullHandling:a.strictNullHandling}};return en=function(d,m){var b=h(m);if(d===""||d===null||typeof d>"u")return b.plainObjects?Object.create(null):{};for(var w=typeof d=="string"?e(d,b):d,_=b.plainObjects?Object.create(null):{},A=Object.keys(w),g=0;g<A.length;++g){var S=A[g],E=c(S,w[S],b,typeof d=="string");_=o.merge(_,E,b)}return b.allowSparse===!0?_:o.compact(_)},en}function kf(){if(Ao)return tn;Ao=!0;var o=xf(),l=If(),s=yo();return tn={formats:s,parse:l,stringify:o},tn}function Tf(){if(xo)return qt;xo=!0;var o=Wt;function l(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,r=["<",">",'"',"`"," ","\r",`
36
- `," "],t=["{","}","|","\\","^","`"].concat(r),n=["'"].concat(t),e=["%","/","?",";","#"].concat(n),i=["/","?","#"],c=255,h=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=kf();function A(v,C,P){if(v&&typeof v=="object"&&v instanceof l)return v;var I=new l;return I.parse(v,C,P),I}l.prototype.parse=function(v,C,P){if(typeof v!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof v);var I=v.indexOf("?"),O=I!==-1&&I<v.indexOf("#")?"?":"#",k=v.split(O),M=/\\/g;k[0]=k[0].replace(M,"/"),v=k.join(O);var x=v;if(x=x.trim(),!P&&v.split("#").length===1){var W=u.exec(x);if(W)return this.path=x,this.href=x,this.pathname=W[1],W[2]?(this.search=W[2],C?this.query=_.parse(this.search.substr(1)):this.query=this.search.substr(1)):C&&(this.search="",this.query={}),this}var $=s.exec(x);if($){$=$[0];var L=$.toLowerCase();this.protocol=L,x=x.substr($.length)}if(P||$||x.match(/^\/\/[^@/]+@[^@/]+/)){var le=x.substr(0,2)==="//";le&&!($&&b[$])&&(x=x.substr(2),this.slashes=!0)}if(!b[$]&&(le||$&&!w[$])){for(var re=-1,ee=0;ee<i.length;ee++){var ue=x.indexOf(i[ee]);ue!==-1&&(re===-1||ue<re)&&(re=ue)}var G,oe;re===-1?oe=x.lastIndexOf("@"):oe=x.lastIndexOf("@",re),oe!==-1&&(G=x.slice(0,oe),x=x.slice(oe+1),this.auth=decodeURIComponent(G)),re=-1;for(var ee=0;ee<e.length;ee++){var ue=x.indexOf(e[ee]);ue!==-1&&(re===-1||ue<re)&&(re=ue)}re===-1&&(re=x.length),this.host=x.slice(0,re),x=x.slice(re),this.parseHost(),this.hostname=this.hostname||"";var R=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!R)for(var Q=this.hostname.split(/\./),ee=0,he=Q.length;ee<he;ee++){var V=Q[ee];if(V&&!V.match(h)){for(var Ee="",X=0,U=V.length;X<U;X++)V.charCodeAt(X)>127?Ee+="x":Ee+=V[X];if(!Ee.match(h)){var ae=Q.slice(0,ee),H=Q.slice(ee+1),te=V.match(d);te&&(ae.push(te[1]),H.unshift(te[2])),H.length&&(x="/"+H.join(".")+x),this.hostname=ae.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=o.toASCII(this.hostname));var ne=this.port?":"+this.port:"",ve=this.hostname||"";this.host=ve+ne,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),x[0]!=="/"&&(x="/"+x))}if(!m[L])for(var ee=0,he=n.length;ee<he;ee++){var ce=n[ee];if(x.indexOf(ce)!==-1){var B=encodeURIComponent(ce);B===ce&&(B=escape(ce)),x=x.split(ce).join(B)}}var Y=x.indexOf("#");Y!==-1&&(this.hash=x.substr(Y),x=x.slice(0,Y));var se=x.indexOf("?");if(se!==-1?(this.search=x.substr(se),this.query=x.substr(se+1),C&&(this.query=_.parse(this.query)),x=x.slice(0,se)):C&&(this.search="",this.query={}),x&&(this.pathname=x),w[L]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var ne=this.pathname||"",ye=this.search||"";this.path=ne+ye}return this.href=this.format(),this};function g(v){return typeof v=="string"&&(v=A(v)),v instanceof l?v.format():l.prototype.format.call(v)}l.prototype.format=function(){var v=this.auth||"";v&&(v=encodeURIComponent(v),v=v.replace(/%3A/i,":"),v+="@");var C=this.protocol||"",P=this.pathname||"",I=this.hash||"",O=!1,k="";this.host?O=v+this.host:this.hostname&&(O=v+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(O+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(k=_.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var M=this.search||k&&"?"+k||"";return C&&C.substr(-1)!==":"&&(C+=":"),this.slashes||(!C||w[C])&&O!==!1?(O="//"+(O||""),P&&P.charAt(0)!=="/"&&(P="/"+P)):O||(O=""),I&&I.charAt(0)!=="#"&&(I="#"+I),M&&M.charAt(0)!=="?"&&(M="?"+M),P=P.replace(/[?#]/g,function(x){return encodeURIComponent(x)}),M=M.replace("#","%23"),C+O+P+M+I};function S(v,C){return A(v,!1,!0).resolve(C)}l.prototype.resolve=function(v){return this.resolveObject(A(v,!1,!0)).format()};function E(v,C){return v?A(v,!1,!0).resolveObject(C):C}return l.prototype.resolveObject=function(v){if(typeof v=="string"){var C=new l;C.parse(v,!1,!0),v=C}for(var P=new l,I=Object.keys(this),O=0;O<I.length;O++){var k=I[O];P[k]=this[k]}if(P.hash=v.hash,v.href==="")return P.href=P.format(),P;if(v.slashes&&!v.protocol){for(var M=Object.keys(v),x=0;x<M.length;x++){var W=M[x];W!=="protocol"&&(P[W]=v[W])}return w[P.protocol]&&P.hostname&&!P.pathname&&(P.pathname="/",P.path=P.pathname),P.href=P.format(),P}if(v.protocol&&v.protocol!==P.protocol){if(!w[v.protocol]){for(var $=Object.keys(v),L=0;L<$.length;L++){var le=$[L];P[le]=v[le]}return P.href=P.format(),P}if(P.protocol=v.protocol,!v.host&&!b[v.protocol]){for(var he=(v.pathname||"").split("/");he.length&&!(v.host=he.shift()););v.host||(v.host=""),v.hostname||(v.hostname=""),he[0]!==""&&he.unshift(""),he.length<2&&he.unshift(""),P.pathname=he.join("/")}else P.pathname=v.pathname;if(P.search=v.search,P.query=v.query,P.host=v.host||"",P.auth=v.auth,P.hostname=v.hostname||v.host,P.port=v.port,P.pathname||P.search){var re=P.pathname||"",ee=P.search||"";P.path=re+ee}return P.slashes=P.slashes||v.slashes,P.href=P.format(),P}var ue=P.pathname&&P.pathname.charAt(0)==="/",G=v.host||v.pathname&&v.pathname.charAt(0)==="/",oe=G||ue||P.host&&v.pathname,R=oe,Q=P.pathname&&P.pathname.split("/")||[],he=v.pathname&&v.pathname.split("/")||[],V=P.protocol&&!w[P.protocol];if(V&&(P.hostname="",P.port=null,P.host&&(Q[0]===""?Q[0]=P.host:Q.unshift(P.host)),P.host="",v.protocol&&(v.hostname=null,v.port=null,v.host&&(he[0]===""?he[0]=v.host:he.unshift(v.host)),v.host=null),oe=oe&&(he[0]===""||Q[0]==="")),G)P.host=v.host||v.host===""?v.host:P.host,P.hostname=v.hostname||v.hostname===""?v.hostname:P.hostname,P.search=v.search,P.query=v.query,Q=he;else if(he.length)Q||(Q=[]),Q.pop(),Q=Q.concat(he),P.search=v.search,P.query=v.query;else if(v.search!=null){if(V){P.host=Q.shift(),P.hostname=P.host;var Ee=P.host&&P.host.indexOf("@")>0?P.host.split("@"):!1;Ee&&(P.auth=Ee.shift(),P.hostname=Ee.shift(),P.host=P.hostname)}return P.search=v.search,P.query=v.query,(P.pathname!==null||P.search!==null)&&(P.path=(P.pathname?P.pathname:"")+(P.search?P.search:"")),P.href=P.format(),P}if(!Q.length)return P.pathname=null,P.search?P.path="/"+P.search:P.path=null,P.href=P.format(),P;for(var X=Q.slice(-1)[0],U=(P.host||v.host||Q.length>1)&&(X==="."||X==="..")||X==="",ae=0,H=Q.length;H>=0;H--)X=Q[H],X==="."?Q.splice(H,1):X===".."?(Q.splice(H,1),ae++):ae&&(Q.splice(H,1),ae--);if(!oe&&!R)for(;ae--;ae)Q.unshift("..");oe&&Q[0]!==""&&(!Q[0]||Q[0].charAt(0)!=="/")&&Q.unshift(""),U&&Q.join("/").substr(-1)!=="/"&&Q.push("");var te=Q[0]===""||Q[0]&&Q[0].charAt(0)==="/";if(V){P.hostname=te?"":Q.length?Q.shift():"",P.host=P.hostname;var Ee=P.host&&P.host.indexOf("@")>0?P.host.split("@"):!1;Ee&&(P.auth=Ee.shift(),P.hostname=Ee.shift(),P.host=P.hostname)}return oe=oe||P.host&&Q.length,oe&&!te&&Q.unshift(""),Q.length>0?P.pathname=Q.join("/"):(P.pathname=null,P.path=null),(P.pathname!==null||P.search!==null)&&(P.path=(P.pathname?P.pathname:"")+(P.search?P.search:"")),P.auth=v.auth||P.auth,P.slashes=P.slashes||v.slashes,P.href=P.format(),P},l.prototype.parseHost=function(){var v=this.host,C=a.exec(v);C&&(C=C[0],C!==":"&&(this.port=C.substr(1)),v=v.substr(0,v.length-C.length)),v&&(this.hostname=v)},qt.parse=A,qt.resolve=S,qt.resolveObject=E,qt.format=g,qt.Url=l,qt}function Xa(o){if(typeof o=="string")o=new URL(o);else if(!(o instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(o.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return rn?Of(o):Pf(o)}function Of(o){let l=o.hostname,s=o.pathname;for(let a=0;a<s.length;a++)if(s[a]==="%"){let u=s.codePointAt(a+2)||32;if(s[a+1]==="2"&&u===102||s[a+1]==="5"&&u===99)throw new Deno.errors.InvalidData("must not include encoded \\ or / characters")}if(s=s.replace(hl,"\\"),s=decodeURIComponent(s),l!=="")return`\\\\${l}${s}`;{let a=s.codePointAt(1)|32,u=s[2];if(a<cl||a>fl||u!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return s.slice(1)}}function Pf(o){if(o.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let l=o.pathname;for(let s=0;s<l.length;s++)if(l[s]==="%"){let a=l.codePointAt(s+2)||32;if(l[s+1]==="2"&&a===102)throw new Deno.errors.InvalidData("must not include encoded / characters")}return decodeURIComponent(l)}function Za(o){let l=mo.resolve(o),s=o.charCodeAt(o.length-1);(s===ul||rn&&s===ll)&&l[l.length-1]!==mo.sep&&(l+="/");let a=new URL("file://");return l.includes("%")&&(l=l.replace(pl,"%25")),!rn&&l.includes("\\")&&(l=l.replace(dl,"%5C")),l.includes(`
37
- `)&&(l=l.replace(gl,"%0A")),l.includes("\r")&&(l=l.replace(ml,"%0D")),l.includes(" ")&&(l=l.replace(yl,"%09")),a.pathname=l,a}var el,Gr,bo,Yr,Qr,vo,Jr,wo,Xr,_o,Zr,So,en,Eo,tn,Ao,qt,xo,vt,tl,rl,nl,il,ol,sl,al,ll,ul,cl,fl,rn,hl,pl,dl,gl,ml,yl,Cf=_t(()=>{de(),me(),ge(),Hc(),cf(),Sf(),Ya(),el=Object.freeze(Object.create(null)),Gr={},bo=!1,Yr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,Qr={},vo=!1,Jr={},wo=!1,Xr={},_o=!1,Zr={},So=!1,en={},Eo=!1,tn={},Ao=!1,qt={},xo=!1,vt=Tf(),vt.parse,vt.resolve,vt.resolveObject,vt.format,vt.Url,tl=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0,vt.URL=typeof URL<"u"?URL:null,vt.pathToFileURL=Za,vt.fileURLToPath=Xa,rl=vt.Url,nl=vt.format,il=vt.resolve,ol=vt.resolveObject,sl=vt.parse,al=vt.URL,ll=92,ul=47,cl=97,fl=122,rn=tl==="win32",hl=/\//g,pl=/%/g,dl=/\\/g,gl=/\n/g,ml=/\r/g,yl=/\t/g}),jf=_e((o,l)=>{de(),me(),ge(),l.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}}),Io=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0}),o.BufferedDuplex=void 0,o.writev=a;var l=Xt(),s=(dt(),tt(pt));function a(r,t){let n=new Array(r.length);for(let e=0;e<r.length;e++)typeof r[e].chunk=="string"?n[e]=s.Buffer.from(r[e].chunk,"utf8"):n[e]=r[e].chunk;this._write(s.Buffer.concat(n),"binary",t)}var u=class extends l.Duplex{constructor(t,n,e){super({objectMode:!0});Pe(this,"socket");Pe(this,"proxy");Pe(this,"isSocketOpen");Pe(this,"writeQueue");this.proxy=n,this.socket=e,this.writeQueue=[],t.objectMode||(this._writev=a.bind(this)),this.isSocketOpen=!1,this.proxy.on("data",i=>{!this.destroyed&&this.readable&&this.push(i)})}_read(t){this.proxy.read(t)}_write(t,n,e){this.isSocketOpen?this.writeToProxy(t,n,e):this.writeQueue.push({chunk:t,encoding:n,cb:e})}_final(t){this.writeQueue=[],this.proxy.end(t)}_destroy(t,n){this.writeQueue=[],this.proxy.destroy(),n(t)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(t,n,e){this.proxy.write(t,n)===!1?this.proxy.once("drain",e):e()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:t,encoding:n,cb:e}=this.writeQueue.shift();this.writeToProxy(t,n,e)}}};o.BufferedDuplex=u}),nn=_e(o=>{de(),me(),ge();var l=o&&o.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(o,"__esModule",{value:!0}),o.streamBuilder=o.browserStreamBuilder=void 0;var s=(dt(),tt(pt)),a=l(jf()),u=l(Mt()),r=Xt(),t=l(Cr()),n=Io(),e=(0,u.default)("mqttjs:ws"),i=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function c(A,g){let S=`${A.protocol}://${A.hostname}:${A.port}${A.path}`;return typeof A.transformWsUrl=="function"&&(S=A.transformWsUrl(S,A,g)),S}function h(A){let g=A;return A.port||(A.protocol==="wss"?g.port=443:g.port=80),A.path||(g.path="/"),A.wsOptions||(g.wsOptions={}),!t.default&&!A.forceNativeWebSocket&&A.protocol==="wss"&&i.forEach(S=>{Object.prototype.hasOwnProperty.call(A,S)&&!Object.prototype.hasOwnProperty.call(A.wsOptions,S)&&(g.wsOptions[S]=A[S])}),g}function d(A){let g=h(A);if(g.hostname||(g.hostname=g.host),!g.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let S=new URL(document.URL);g.hostname=S.hostname,g.port||(g.port=Number(S.port))}return g.objectMode===void 0&&(g.objectMode=!(g.binary===!0||g.binary===void 0)),g}function m(A,g,S){e("createWebSocket"),e(`protocol: ${S.protocolId} ${S.protocolVersion}`);let E=S.protocolId==="MQIsdp"&&S.protocolVersion===3?"mqttv3.1":"mqtt";e(`creating new Websocket for url: ${g} and protocol: ${E}`);let v;return S.createWebsocket?v=S.createWebsocket(g,[E],S):v=new a.default(g,[E],S.wsOptions),v}function b(A,g){let S=g.protocolId==="MQIsdp"&&g.protocolVersion===3?"mqttv3.1":"mqtt",E=c(g,A),v;return g.createWebsocket?v=g.createWebsocket(E,[S],g):v=new WebSocket(E,[S]),v.binaryType="arraybuffer",v}var w=(A,g)=>{e("streamBuilder");let S=h(g);S.hostname=S.hostname||S.host||"localhost";let E=c(S,A),v=m(A,E,S),C=a.default.createWebSocketStream(v,S.wsOptions);return C.url=E,v.on("close",()=>{C.destroy()}),C};o.streamBuilder=w;var _=(A,g)=>{e("browserStreamBuilder");let S,E=d(g).browserBufferSize||1024*512,v=g.browserBufferTimeout||1e3,C=!g.objectMode,P=b(A,g),I=k(g,L,le);g.objectMode||(I._writev=n.writev.bind(I)),I.on("close",()=>{P.close()});let O=typeof P.addEventListener<"u";P.readyState===P.OPEN?(S=I,S.socket=P):(S=new n.BufferedDuplex(g,I,P),O?P.addEventListener("open",M):P.onopen=M),O?(P.addEventListener("close",x),P.addEventListener("error",W),P.addEventListener("message",$)):(P.onclose=x,P.onerror=W,P.onmessage=$);function k(re,ee,ue){let G=new r.Transform({objectMode:re.objectMode});return G._write=ee,G._flush=ue,G}function M(){e("WebSocket onOpen"),S instanceof n.BufferedDuplex&&S.socketReady()}function x(re){e("WebSocket onClose",re),S.end(),S.destroy()}function W(re){e("WebSocket onError",re);let ee=new Error("WebSocket error");ee.event=re,S.destroy(ee)}async function $(re){if(!I||!I.readable||!I.writable)return;let{data:ee}=re;ee instanceof ArrayBuffer?ee=s.Buffer.from(ee):ee instanceof Blob?ee=s.Buffer.from(await new Response(ee).arrayBuffer()):ee=s.Buffer.from(ee,"utf8"),I.push(ee)}function L(re,ee,ue){if(P.bufferedAmount>E){setTimeout(L,v,re,ee,ue);return}C&&typeof re=="string"&&(re=s.Buffer.from(re,"utf8"));try{P.send(re)}catch(G){return ue(G)}ue()}function le(re){P.close(),re()}return S};o.browserStreamBuilder=_}),ko={};nr(ko,{Server:()=>at,Socket:()=>at,Stream:()=>at,_createServerHandle:()=>at,_normalizeArgs:()=>at,_setSimultaneousAccepts:()=>at,connect:()=>at,createConnection:()=>at,createServer:()=>at,default:()=>bl,isIP:()=>at,isIPv4:()=>at,isIPv6:()=>at});function at(){throw new Error("Node.js net module is not supported by JSPM core outside of Node.js")}var bl,vl=_t(()=>{de(),me(),ge(),bl={_createServerHandle:at,_normalizeArgs:at,_setSimultaneousAccepts:at,connect:at,createConnection:at,createServer:at,isIP:at,isIPv4:at,isIPv6:at,Server:at,Socket:at,Stream:at}}),wl=_e((o,l)=>{de(),me(),ge(),l.exports={}}),_l=_e(o=>{de(),me(),ge();var l=o&&o.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(o,"__esModule",{value:!0});var s=l((vl(),tt(ko))),a=l(Mt()),u=l(wl()),r=(0,a.default)("mqttjs:tcp"),t=(n,e)=>{if(e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost",e.socksProxy)return(0,u.default)(e.hostname,e.port,e.socksProxy,{timeout:e.socksTimeout});let{port:i,path:c}=e,h=e.hostname;return r("port %d and host %s",i,h),s.default.createConnection({port:i,host:h,path:c})};o.default=t}),Sl={};nr(Sl,{default:()=>El});var El,Rf=_t(()=>{de(),me(),ge(),El={}}),Al=_e(o=>{de(),me(),ge();var l=o&&o.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(o,"__esModule",{value:!0});var s=(Rf(),tt(Sl)),a=l((vl(),tt(ko))),u=l(Mt()),r=l(wl()),t=(0,u.default)("mqttjs:tls");function n(i){let{host:c,port:h,socksProxy:d,...m}=i;if(d!==void 0){let b=(0,r.default)(c,h,d,{timeout:i.socksTimeout});return(0,s.connect)({...m,socket:b})}return(0,s.connect)(i)}var e=(i,c)=>{c.port=c.port||8883,c.host=c.hostname||c.host||"localhost",a.default.isIP(c.host)===0&&(c.servername=c.host),c.rejectUnauthorized=c.rejectUnauthorized!==!1,delete c.path,t("port %d host %s rejectUnauthorized %b",c.port,c.host,c.rejectUnauthorized);let h=n(c);h.on("secureConnect",()=>{c.rejectUnauthorized&&!h.authorized?h.emit("error",new Error("TLS not authorized")):h.removeListener("error",d)});function d(m){c.rejectUnauthorized&&i.emit("error",m),h.end()}return h.on("error",d),h};o.default=e}),xl=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0});var l=(dt(),tt(pt)),s=Xt(),a=Io(),u,r,t;function n(){let d=new s.Transform;return d._write=(m,b,w)=>{u.send({data:m.buffer,success(){w()},fail(_){w(new Error(_))}})},d._flush=m=>{u.close({success(){m()}})},d}function e(d){d.hostname||(d.hostname="localhost"),d.path||(d.path="/"),d.wsOptions||(d.wsOptions={})}function i(d,m){let b=d.protocol==="wxs"?"wss":"ws",w=`${b}://${d.hostname}${d.path}`;return d.port&&d.port!==80&&d.port!==443&&(w=`${b}://${d.hostname}:${d.port}${d.path}`),typeof d.transformWsUrl=="function"&&(w=d.transformWsUrl(w,d,m)),w}function c(){u.onOpen(()=>{t.socketReady()}),u.onMessage(d=>{let{data:m}=d;m instanceof ArrayBuffer?m=l.Buffer.from(m):m=l.Buffer.from(m,"utf8"),r.push(m)}),u.onClose(()=>{t.emit("close"),t.end(),t.destroy()}),u.onError(d=>{let m=new Error(d.errMsg);t.destroy(m)})}var h=(d,m)=>{if(m.hostname=m.hostname||m.host,!m.hostname)throw new Error("Could not determine host. Specify host manually.");let b=m.protocolId==="MQIsdp"&&m.protocolVersion===3?"mqttv3.1":"mqtt";e(m);let w=i(m,d);u=wx.connectSocket({url:w,protocols:[b]}),r=n(),t=new a.BufferedDuplex(m,r,u),t._destroy=(A,g)=>{u.close({success(){g&&g(A)}})};let _=t.destroy;return t.destroy=(A,g)=>(t.destroy=_,setTimeout(()=>{u.close({fail(){t._destroy(A,g)}})},0),t),c(),t};o.default=h}),Il=_e(o=>{de(),me(),ge(),Object.defineProperty(o,"__esModule",{value:!0});var l=(dt(),tt(pt)),s=Xt(),a=Io(),u,r,t,n=!1;function e(){let m=new s.Transform;return m._write=(b,w,_)=>{u.sendSocketMessage({data:b.buffer,success(){_()},fail(){_(new Error)}})},m._flush=b=>{u.closeSocket({success(){b()}})},m}function i(m){m.hostname||(m.hostname="localhost"),m.path||(m.path="/"),m.wsOptions||(m.wsOptions={})}function c(m,b){let w=m.protocol==="alis"?"wss":"ws",_=`${w}://${m.hostname}${m.path}`;return m.port&&m.port!==80&&m.port!==443&&(_=`${w}://${m.hostname}:${m.port}${m.path}`),typeof m.transformWsUrl=="function"&&(_=m.transformWsUrl(_,m,b)),_}function h(){n||(n=!0,u.onSocketOpen(()=>{t.socketReady()}),u.onSocketMessage(m=>{if(typeof m.data=="string"){let b=l.Buffer.from(m.data,"base64");r.push(b)}else{let b=new FileReader;b.addEventListener("load",()=>{if(b.result instanceof ArrayBuffer){r.push(l.Buffer.from(b.result));return}r.push(l.Buffer.from(b.result,"utf-8"))}),b.readAsArrayBuffer(m.data)}}),u.onSocketClose(()=>{t.end(),t.destroy()}),u.onSocketError(m=>{t.destroy(m)}))}var d=(m,b)=>{if(b.hostname=b.hostname||b.host,!b.hostname)throw new Error("Could not determine host. Specify host manually.");let w=b.protocolId==="MQIsdp"&&b.protocolVersion===3?"mqttv3.1":"mqtt";i(b);let _=c(b,m);return u=b.my,u.connectSocket({url:_,protocols:w}),r=e(),t=new a.BufferedDuplex(b,r,u),h(),t};o.default=d}),Mf=_e(o=>{de(),me(),ge();var l=o&&o.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(o,"__esModule",{value:!0}),o.connectAsync=c;var s=l(Mt()),a=l((Cf(),tt(Qa))),u=l(Ci()),r=l(Cr());typeof(Je==null?void 0:Je.nextTick)!="function"&&(Je.nextTick=setImmediate);var t=(0,s.default)("mqttjs"),n=null;function e(h){let d;if(h.auth)if(d=h.auth.match(/^(.+):(.+)$/),d){let[,m,b]=d;h.username=m,h.password=b}else h.username=h.auth}function i(h,d){var w,_,A;if(t("connecting to an MQTT broker..."),typeof h=="object"&&!d&&(d=h,h=""),d=d||{},h&&typeof h=="string"){let g=a.default.parse(h,!0),S={};if(g.port!=null&&(S.port=Number(g.port)),S.host=g.hostname,S.query=g.query,S.auth=g.auth,S.protocol=g.protocol,S.path=g.path,d={...S,...d},!d.protocol)throw new Error("Missing protocol");d.protocol=d.protocol.replace(/:$/,"")}if(d.unixSocket=d.unixSocket||((w=d.protocol)==null?void 0:w.includes("+unix")),d.unixSocket?d.protocol=d.protocol.replace("+unix",""):!((_=d.protocol)!=null&&_.startsWith("ws"))&&!((A=d.protocol)!=null&&A.startsWith("wx"))&&delete d.path,e(d),d.query&&typeof d.query.clientId=="string"&&(d.clientId=d.query.clientId),r.default||d.unixSocket?d.socksProxy=void 0:d.socksProxy===void 0&&typeof Je<"u"&&(d.socksProxy=Je.env.MQTTJS_SOCKS_PROXY),d.cert&&d.key)if(d.protocol){if(["mqtts","wss","wxs","alis"].indexOf(d.protocol)===-1)switch(d.protocol){case"mqtt":d.protocol="mqtts";break;case"ws":d.protocol="wss";break;case"wx":d.protocol="wxs";break;case"ali":d.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${d.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(n||(n={},!r.default&&!d.forceNativeWebSocket?(n.ws=nn().streamBuilder,n.wss=nn().streamBuilder,n.mqtt=_l().default,n.tcp=_l().default,n.ssl=Al().default,n.tls=n.ssl,n.mqtts=Al().default):(n.ws=nn().browserStreamBuilder,n.wss=nn().browserStreamBuilder,n.wx=xl().default,n.wxs=xl().default,n.ali=Il().default,n.alis=Il().default)),!n[d.protocol]){let g=["mqtts","wss"].indexOf(d.protocol)!==-1;d.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((S,E)=>g&&E%2===0?!1:typeof n[S]=="function")[0]}if(d.clean===!1&&!d.clientId)throw new Error("Missing clientId for unclean clients");d.protocol&&(d.defaultProtocol=d.protocol);function m(g){return d.servers&&((!g._reconnectCount||g._reconnectCount===d.servers.length)&&(g._reconnectCount=0),d.host=d.servers[g._reconnectCount].host,d.port=d.servers[g._reconnectCount].port,d.protocol=d.servers[g._reconnectCount].protocol?d.servers[g._reconnectCount].protocol:d.defaultProtocol,d.hostname=d.host,g._reconnectCount++),t("calling streambuilder for",d.protocol),n[d.protocol](g,d)}let b=new u.default(m,d);return b.on("error",()=>{}),b}function c(h,d,m=!0){return new Promise((b,w)=>{let _=i(h,d),A={connect:S=>{g(),b(_)},end:()=>{g(),b(_)},error:S=>{g(),_.end(),w(S)}};m===!1&&(A.close=()=>{A.error(new Error("Couldn't connect to server"))});function g(){Object.keys(A).forEach(S=>{_.off(S,A[S])})}Object.keys(A).forEach(S=>{_.on(S,A[S])})})}o.default=i}),kl=_e(o=>{de(),me(),ge();var l=o&&o.__createBinding||(Object.create?function(m,b,w,_){_===void 0&&(_=w);var A=Object.getOwnPropertyDescriptor(b,w);(!A||("get"in A?!b.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return b[w]}}),Object.defineProperty(m,_,A)}:function(m,b,w,_){_===void 0&&(_=w),m[_]=b[w]}),s=o&&o.__setModuleDefault||(Object.create?function(m,b){Object.defineProperty(m,"default",{enumerable:!0,value:b})}:function(m,b){m.default=b}),a=o&&o.__importStar||function(){var m=function(b){return m=Object.getOwnPropertyNames||function(w){var _=[];for(var A in w)Object.prototype.hasOwnProperty.call(w,A)&&(_[_.length]=A);return _},m(b)};return function(b){if(b&&b.__esModule)return b;var w={};if(b!=null)for(var _=m(b),A=0;A<_.length;A++)_[A]!=="default"&&l(w,b,_[A]);return s(w,b),w}}(),u=o&&o.__exportStar||function(m,b){for(var w in m)w!=="default"&&!Object.prototype.hasOwnProperty.call(b,w)&&l(b,m,w)},r=o&&o.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(o,"__esModule",{value:!0}),o.ReasonCodes=o.KeepaliveManager=o.UniqueMessageIdProvider=o.DefaultMessageIdProvider=o.Store=o.MqttClient=o.connectAsync=o.connect=o.Client=void 0;var t=r(Ci());o.MqttClient=t.default;var n=r(Ms());o.DefaultMessageIdProvider=n.default;var e=r(zc());o.UniqueMessageIdProvider=e.default;var i=r(ks());o.Store=i.default;var c=a(Mf());o.connect=c.default,Object.defineProperty(o,"connectAsync",{enumerable:!0,get:function(){return c.connectAsync}});var h=r(Ws());o.KeepaliveManager=h.default,o.Client=t.default,u(Ci(),o),u(ar(),o);var d=Or();Object.defineProperty(o,"ReasonCodes",{enumerable:!0,get:function(){return d.ReasonCodes}})}),Nf=_e(o=>{de(),me(),ge();var l=o&&o.__createBinding||(Object.create?function(t,n,e,i){i===void 0&&(i=e);var c=Object.getOwnPropertyDescriptor(n,e);(!c||("get"in c?!n.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return n[e]}}),Object.defineProperty(t,i,c)}:function(t,n,e,i){i===void 0&&(i=e),t[i]=n[e]}),s=o&&o.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),a=o&&o.__importStar||function(){var t=function(n){return t=Object.getOwnPropertyNames||function(e){var i=[];for(var c in e)Object.prototype.hasOwnProperty.call(e,c)&&(i[i.length]=c);return i},t(n)};return function(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var i=t(n),c=0;c<i.length;c++)i[c]!=="default"&&l(e,n,i[c]);return s(e,n),e}}(),u=o&&o.__exportStar||function(t,n){for(var e in t)e!=="default"&&!Object.prototype.hasOwnProperty.call(n,e)&&l(n,t,e)};Object.defineProperty(o,"__esModule",{value:!0});var r=a(kl());o.default=r,u(kl(),o)});const Bf=Nf();/*! Bundled license information:
38
-
39
- @jspm/core/nodelibs/browser/chunk-DtuTasat.js:
40
- (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
41
-
42
- safe-buffer/index.js:
43
- (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
44
-
45
- @babel/runtime/helpers/regenerator.js:
46
- (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
47
- */const Tl=Te.createContext(null),Lf=({children:o})=>{const[l,s]=Te.useState(!1),[a,u]=Te.useState({}),r=Te.useRef(null),t=Te.useRef(new Set),n=Ht();Te.useEffect(()=>{const h=n.config.brokerUrl||"wss://test.mosquitto.org:8081";console.log(`[MQTT] Connecting to ${h}...`),r.current&&r.current.end();const d=Bf.connect(h);return r.current=d,d.on("connect",()=>{console.log("[MQTT] Connected ✅"),s(!0),t.current.forEach(m=>d.subscribe(m))}),d.on("message",(m,b)=>{const w=b.toString();u(_=>({..._,[m]:w}))}),d.on("error",m=>{console.error("[MQTT] Connection error: ",m),d.end()}),()=>{console.log("[MQTT] Disconnecting..."),d.end()}},[n.config.brokerUrl]);const e=h=>{r.current&&!t.current.has(h)&&(r.current.subscribe(h),t.current.add(h))},i=h=>{r.current&&t.current.has(h)&&(r.current.unsubscribe(h),t.current.delete(h))},c=(h,d)=>{r.current&&r.current.publish(h,d)};return Ie.jsx(Tl.Provider,{value:{isConnected:l,lastMessage:a,subscribe:e,unsubscribe:i,publish:c},children:o})},To=()=>{const o=Te.useContext(Tl);if(!o)throw new Error("useMqtt must be used within an MqttProvider");return o},Ol=Te.createContext([]),Df=()=>{const o=Te.useContext(Ol);if(o===void 0)throw new Error("useSitemap must be used within a SitemapProvider");return o},Uf=Ol.Provider,Ff=()=>{const{publish:o,isConnected:l}=To(),s=Ht(),{config:a,domain:u}=s;return{sendAction:Te.useCallback(async(t,n)=>{const e=u.entities.find(h=>h.id===t);if(!e){console.warn(`[Action] Entity ID '${t}' not found in manifest.`);return}const i=e.signals[0],c=u.signals.find(h=>h.id===i);if(!c){console.warn(`[Action] No signal linked to entity: ${t}`);return}if(a.mockMode){console.log(`%c[Mock Action] Setting ${e.name} to:`,"color: #10b981; font-weight: bold;",n);return}if(c.source==="mqtt"&&c.topic){if(!l){console.warn("[Action] Cannot send: MQTT disconnected");return}const h=typeof n=="object"?JSON.stringify(n):String(n);console.log(`[MQTT] Publishing to '${c.topic}': ${h}`),o(c.topic,h)}if(c.source==="http"&&c.endpoint)try{await fetch(c.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:c.id,value:n})})}catch{console.log("[HTTP] (Simulation) Request sent.")}},[a.mockMode,l,o,u])}},Pl=(o,l)=>{const[s,a]=Te.useState(()=>{if(typeof window>"u")return l;try{const n=window.localStorage.getItem(o);return n?JSON.parse(n):(window.localStorage.setItem(o,JSON.stringify(l)),l)}catch(n){return console.error(`[Data Lake] Error reading key "${o}":`,n),l}}),u=Te.useCallback(n=>{a(e=>{let i;e.length>0&&typeof e[0].id=="number"?i=e.reduce((b,w)=>typeof w.id=="number"&&w.id>b?w.id:b,0)+1:i=`id_${Date.now()}`;const h={...n,id:i},d=[...e,h];return window.localStorage.setItem(o,JSON.stringify(d)),d})},[o]),r=Te.useCallback(n=>{a(e=>{const i=e.map(c=>c.id===n.id?n:c);return window.localStorage.setItem(o,JSON.stringify(i)),i})},[o]),t=Te.useCallback(n=>{a(e=>{const i=e.filter(c=>c.id!==n);return window.localStorage.setItem(o,JSON.stringify(i)),i})},[o]);return{data:s,createItem:u,updateItem:r,deleteItem:t}};function Wf(o,l={}){const{filters:s,sort:a,page:u=1,pageSize:r=10}=l,t=Te.useMemo(()=>!s||s.length===0?o:o.filter(i=>s.every(c=>{const h=i[c.field];switch(c.operator){case"equals":return h==c.value;case"neq":return h!=c.value;case"contains":return String(h).toLowerCase().includes(String(c.value).toLowerCase());case"gt":return h>c.value;case"lt":return h<c.value;default:return!0}})),[o,s]),n=Te.useMemo(()=>a?[...t].sort((i,c)=>{const h=i[a.field],d=c[a.field];return h<d?a.direction==="asc"?-1:1:h>d?a.direction==="asc"?1:-1:0}):t,[t,a]);return{data:Te.useMemo(()=>{const i=(u-1)*r;return n.slice(i,i+r)},[n,u,r]),total:t.length,pageCount:Math.ceil(t.length/r)}}const $f="ramme_db_",qf=(o,l)=>{const s=l+1,a=o.label||"Item";switch(o.type){case"text":return`${a} ${s}`;case"number":return Math.floor(Math.random()*100)+1;case"currency":return(Math.random()*1e3).toFixed(2);case"boolean":return Math.random()>.5;case"date":const u=new Date;return u.setDate(u.getDate()-s*2),u.toISOString().split("T")[0];case"status":return["Active","Pending","Inactive","Archived"][l%4];case"email":return`user${s}@example.com`;case"image":return`https://i.pravatar.cc/150?u=${s}`;case"textarea":return`This is a sample description for ${a} ${s}. It contains enough text to test multi-line rendering.`;default:return`${a}-${s}`}},Oo=(o,l)=>Te.useMemo(()=>{if(!o)return[];if(typeof window<"u"){const s=`${$f}${o}`,a=localStorage.getItem(s);if(a)try{const u=JSON.parse(a);if(Array.isArray(u)&&u.length>0)return u}catch{console.warn(`[JIT Seeder] Corrupt data in ${s}, falling back to generation.`)}}return l?(console.log(`🌱 [JIT Seeder] Generating 5 mock records for: ${o}`),Array.from({length:5}).map((a,u)=>{const r={id:`jit_${o}_${u+1}`};return l.fields.forEach(t=>{t.key!=="id"&&(r[t.key]=qf(t,u))}),r})):[]},[o,l]),Cl=({isOpen:o,onClose:l,onSubmit:s,title:a,fields:u,initialData:r})=>{const t=r||{},n=!!t.id,e=Te.useMemo(()=>u.filter(i=>!(i.key==="id"&&!n)).map(i=>{const c=i.key==="id",h={name:i.key,label:i.label,required:i.required,placeholder:i.description||`Enter ${i.label.toLowerCase()}`,value:t[i.key]!==void 0?t[i.key]:i.defaultValue||"",colSpan:1,disabled:c};switch(i.type){case"number":case"integer":case"currency":return{...h,type:"number",value:Number(h.value)||0};case"boolean":return{...h,type:"toggle",checked:!!h.value};case"date":return{...h,type:"datepicker",value:h.value?new Date(h.value):null};case"status":return{...h,type:"select",options:[{value:"Active",label:"Active"},{value:"Pending",label:"Pending"},{value:"Inactive",label:"Inactive"},{value:"Archived",label:"Archived"}]};case"textarea":return{...h,type:"textarea",colSpan:2};case"email":return{...h,type:"email"};default:return{...h,type:"text"}}}),[u,t,n]);return Ie.jsx(qe.Drawer,{isOpen:o,onClose:l,title:`${n?"Edit":"New"} ${a}`,size:"500px",children:Ie.jsx("div",{className:"p-6",children:Ie.jsx(qe.FormTemplate,{fields:e,onSubmit:i=>{s({...t,...i})},children:Ie.jsxs("div",{className:"flex justify-end gap-2 mt-8 pt-4 border-t border-border",children:[Ie.jsx(qe.Button,{variant:"outline",onClick:l,type:"button",children:"Cancel"}),Ie.jsx(qe.Button,{type:"submit",variant:"primary",children:n?"Save Changes":"Create Record"})]})})})})},Po=({dataId:o,title:l,getResourceMeta:s,loading:a=!1,height:u="600px",onRowClick:r})=>{const{addToast:t}=qe.useToast(),n=Ht(),e=Te.useMemo(()=>{var W;const M=(W=n.resources)==null?void 0:W.find($=>$.id===o);if(M)return M;const x=s==null?void 0:s(o);return x?{...x,id:o}:null},[n,o]),i=Oo(o,e),{data:c,createItem:h,updateItem:d,deleteItem:m}=Pl(`ramme_db_${o}`,i),[b,w]=Te.useState(!1),[_,A]=Te.useState(null),[g,S]=Te.useState(null),E=Te.useMemo(()=>e!=null&&e.fields?e.fields.map(M=>({key:M.key,label:M.label,type:M.type,hide:M.key==="id"})):[],[e]),v=Te.useCallback(M=>{A(M),w(!0)},[]),C=Te.useCallback(M=>{confirm("Delete this item?")&&m(M.id)},[m]),P=Te.useMemo(()=>[{id:"edit",icon:"edit-2",variant:"ghost",onClick:v},{id:"delete",icon:"trash-2",variant:"danger",onClick:C}],[v,C]),I=Te.useCallback(M=>{M.id&&(_!=null&&_.id)?(d(M),t("Item updated","success")):(h({...M,id:void 0}),t("Item created","success")),w(!1)},[_,d,h,t]),O=Te.useCallback(M=>{g==null||g.updateGridOptions({quickFilterText:M.target.value})},[g]),k=Te.useCallback(()=>{A({}),w(!0)},[]);return Ie.jsxs(qe.Card,{className:"flex flex-col border border-border shadow-sm overflow-hidden bg-card",style:{height:u},children:[Ie.jsxs("div",{className:"p-4 border-b border-border flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 bg-muted/5",children:[Ie.jsxs("div",{className:"flex items-center gap-2",children:[Ie.jsx("h3",{className:"text-base font-bold",children:l||(e==null?void 0:e.name)||o}),Ie.jsx("span",{className:"text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded",children:c.length})]}),Ie.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[Ie.jsx("div",{className:"w-full sm:w-64",children:Ie.jsx(qe.SearchInput,{placeholder:"Search...",onChange:O})}),Ie.jsx(qe.Button,{size:"sm",iconLeft:"plus",onClick:k,children:"New"})]})]}),Ie.jsxs("div",{className:"flex-1 w-full bg-card relative overflow-hidden",children:[Ie.jsx("div",{className:"hidden md:block h-full",children:Ie.jsx(qe.DataTable,{rowData:c,schema:E,actions:P,loading:a,height:"100%",onGridReady:M=>S(M.api),onRowClicked:r?M=>r(M.data):void 0,emptyState:Ie.jsx("div",{className:"text-muted-foreground",children:"No records found."})})}),Ie.jsxs("div",{className:"block md:hidden h-full overflow-y-auto p-4 space-y-3 bg-muted/5",children:[c.map((M,x)=>{var W;return Ie.jsxs("div",{className:"bg-background border border-border rounded-lg p-4 shadow-sm relative group",children:[Ie.jsxs("div",{className:"flex justify-between items-start mb-3 pb-2 border-b border-dashed",children:[Ie.jsx("span",{className:"font-semibold text-foreground",children:M[((W=E.find($=>$.type==="text"&&$.key!=="id"))==null?void 0:W.key)||"id"]}),(()=>{const $=E.find(L=>L.type==="status");return $?qe.formatValue(M[$.key],"status"):null})()]}),Ie.jsx("div",{className:"space-y-2 text-sm",children:E.filter($=>!$.hide&&$.type!=="status").slice(0,5).map($=>Ie.jsxs("div",{className:"flex justify-between",children:[Ie.jsxs("span",{className:"text-muted-foreground",children:[$.label,":"]}),Ie.jsx("span",{className:"font-medium text-right",children:qe.formatValue(M[$.key],$.type)})]},$.key))}),Ie.jsxs("div",{className:"flex gap-2 pt-3 mt-3 border-t border-border/50",children:[Ie.jsx(qe.Button,{size:"sm",variant:"outline",className:"flex-1 h-8 text-xs",onClick:()=>{A(M),w(!0)},children:"Edit"}),Ie.jsx(qe.Button,{size:"sm",variant:"ghost",className:"h-8 w-8 text-destructive",onClick:()=>{confirm("Delete?")&&m(M.id)},children:Ie.jsx(qe.Icon,{name:"trash-2",size:14})})]})]},M.id||x)}),c.length===0&&Ie.jsx("div",{className:"text-center p-8 text-muted-foreground",children:"No records."})]})]}),Ie.jsx(Cl,{isOpen:b,onClose:()=>w(!1),onSubmit:I,title:(e==null?void 0:e.name)||"Item",fields:(e==null?void 0:e.fields)||[],initialData:_})]})};/**
48
- * @license lucide-react v0.537.0 - ISC
49
- *
50
- * This source code is licensed under the ISC license.
51
- * See the LICENSE file in the root directory of this source tree.
52
- */const Vf=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zf=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(l,s,a)=>a?a.toUpperCase():s.toLowerCase()),jl=o=>{const l=zf(o);return l.charAt(0).toUpperCase()+l.slice(1)},Rl=(...o)=>o.filter((l,s,a)=>!!l&&l.trim()!==""&&a.indexOf(l)===s).join(" ").trim(),Kf=o=>{for(const l in o)if(l.startsWith("aria-")||l==="role"||l==="title")return!0};/**
53
- * @license lucide-react v0.537.0 - ISC
54
- *
55
- * This source code is licensed under the ISC license.
56
- * See the LICENSE file in the root directory of this source tree.
57
- */var Hf={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
58
- * @license lucide-react v0.537.0 - ISC
59
- *
60
- * This source code is licensed under the ISC license.
61
- * See the LICENSE file in the root directory of this source tree.
62
- */const Gf=Te.forwardRef(({color:o="currentColor",size:l=24,strokeWidth:s=2,absoluteStrokeWidth:a,className:u="",children:r,iconNode:t,...n},e)=>Te.createElement("svg",{ref:e,...Hf,width:l,height:l,stroke:o,strokeWidth:a?Number(s)*24/Number(l):s,className:Rl("lucide",u),...!r&&!Kf(n)&&{"aria-hidden":"true"},...n},[...t.map(([i,c])=>Te.createElement(i,c)),...Array.isArray(r)?r:[r]]));/**
63
- * @license lucide-react v0.537.0 - ISC
64
- *
65
- * This source code is licensed under the ISC license.
66
- * See the LICENSE file in the root directory of this source tree.
67
- */const tr=(o,l)=>{const s=Te.forwardRef(({className:a,...u},r)=>Te.createElement(Gf,{ref:r,iconNode:l,className:Rl(`lucide-${Vf(jl(o))}`,`lucide-${o}`,a),...u}));return s.displayName=jl(o),s};/**
68
- * @license lucide-react v0.537.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */const Yf=tr("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
73
- * @license lucide-react v0.537.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const Qf=tr("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
78
- * @license lucide-react v0.537.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */const Jf=tr("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
83
- * @license lucide-react v0.537.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const Xf=tr("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
88
- * @license lucide-react v0.537.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */const Zf=tr("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
93
- * @license lucide-react v0.537.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const eh=tr("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
98
- * @license lucide-react v0.537.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const th=tr("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),Ml={SmartTable:Po,DataTable:Po,StatCard:qe.StatCard,DeviceCard:qe.DeviceCard,BarChart:qe.BarChart,LineChart:qe.LineChart,Button:qe.Button,Unknown:({type:o})=>Ie.jsxs("div",{className:"h-24 w-full border-2 border-dashed border-amber-300 bg-amber-50 rounded-lg flex flex-col items-center justify-center text-amber-700 text-sm",children:[Ie.jsx(Qf,{className:"mb-2 opacity-50",size:20}),Ie.jsxs("span",{children:["Unknown Component: ",Ie.jsx("strong",{children:o})]})]})},rh=o=>Ml[o]||Ml.Unknown;class nh extends Te.Component{constructor(l){super(l),this.state={hasError:!1,error:""}}static getDerivedStateFromError(l){return{hasError:!0,error:l.message}}render(){return this.state.hasError?Ie.jsxs("div",{className:"h-full min-h-[100px] p-4 border-2 border-dashed border-red-300 bg-red-50/50 rounded-lg flex flex-col items-center justify-center text-red-600 text-xs",children:[Ie.jsx(Xf,{size:16,className:"mb-2 opacity-80"}),Ie.jsx("span",{className:"font-bold",children:"Render Error"}),Ie.jsx("span",{className:"opacity-75 text-center truncate max-w-[200px]",children:this.state.error})]}):this.props.children}}const ih=({block:o,manifest:l})=>{var e,i,c,h,d;const s=rh(o.type),a=(e=o.props.dataId)==null?void 0:e.toLowerCase(),u=Te.useMemo(()=>{var m;return(m=l.resources)==null?void 0:m.find(b=>b.id.toLowerCase()===a)},[l,a]),r=Oo(a,u),t=(c=(i=r==null?void 0:r[0])==null?void 0:i.id)==null?void 0:c.toString().startsWith("jit_"),n=Te.useMemo(()=>{if(a&&o.type==="SmartTable"&&!o.props.columnDefs&&u)return u.fields.map(m=>({field:m.key,headerName:m.label,filter:!0,flex:1,cellRenderer:m.type==="status"?b=>Ie.jsx(qe.Badge,{variant:"secondary",children:b.value}):void 0}))},[a,o.type,u,o.props.columnDefs]);return Ie.jsx("div",{style:{gridColumn:`span ${((h=o.layout)==null?void 0:h.colSpan)||1}`,gridRow:`span ${((d=o.layout)==null?void 0:d.rowSpan)||1}`},className:"relative group",children:Ie.jsxs(nh,{children:[Ie.jsx("div",{className:"absolute -top-3 right-0 opacity-0 group-hover:opacity-100 transition-opacity z-20 pointer-events-none translate-y-2 group-hover:translate-y-0 duration-200",children:Ie.jsxs("div",{className:`text-[10px] px-2 py-1 rounded-md shadow-lg border border-white/10 flex items-center gap-1.5 font-mono ${t?"bg-amber-600 text-white":"bg-slate-800 text-slate-200"}`,children:[Ie.jsx("span",{className:"font-bold",children:o.type}),a&&Ie.jsxs(Ie.Fragment,{children:[" ",Ie.jsx("span",{className:"opacity-40",children:"|"})," ",t?Ie.jsx(Zf,{size:10,className:"animate-pulse"}):Ie.jsx(Yf,{size:10})," ",a]})]})}),Ie.jsx(s,{...o.props,rowData:o.type==="SmartTable"?void 0:r,columnDefs:o.props.columnDefs||n,className:"w-full h-full"})]})})},Nl=({pageId:o})=>{var t;const l=Ht(),a=dn()==="live",u=Te.useMemo(()=>{var n;return(n=l.pages)==null?void 0:n.find(e=>e.id===o)},[l,o]);if(!u)return Ie.jsxs("div",{className:"p-8 space-y-4 flex flex-col items-center justify-center h-[50vh]",children:[Ie.jsx(Jf,{className:"animate-spin text-primary mb-4",size:32}),Ie.jsx("p",{className:"text-muted-foreground",children:"Loading Blueprint..."})]});const r=Ie.jsxs("div",{className:`flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-bold border transition-colors duration-300 ${a?"bg-green-100 text-green-700 border-green-200":"bg-slate-100 text-slate-500 border-slate-200"}`,children:[a?Ie.jsx(th,{size:14,className:"text-green-600 animate-pulse"}):Ie.jsx(eh,{size:14}),a?"LIVE BRIDGE":"STATIC MODE"]});return Ie.jsxs("div",{className:"p-6 md:p-8 max-w-7xl mx-auto w-full space-y-8",children:[Ie.jsxs("header",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4 border-b border-border/40 pb-6",children:[Ie.jsxs("div",{className:"space-y-1",children:[Ie.jsx("h1",{className:"text-3xl font-bold tracking-tight text-foreground",children:u.title}),u.description&&Ie.jsx("p",{className:"text-muted-foreground",children:u.description})]}),Ie.jsx("div",{className:"flex items-center gap-2",children:r})]}),Ie.jsx("div",{className:"grid gap-8 pb-20",children:(t=u.sections)==null?void 0:t.map(n=>{var e;return Ie.jsxs("section",{className:"space-y-6",children:[n.title&&Ie.jsx("div",{className:"flex items-center gap-2 pb-2 border-b border-border/60",children:Ie.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-muted-foreground/80",children:n.title})}),Ie.jsx("div",{className:"grid gap-6",style:{gridTemplateColumns:`repeat(${((e=n.layout)==null?void 0:e.columns)||1}, minmax(0, 1fr))`},children:n.blocks.map(i=>Ie.jsx(ih,{block:i,manifest:l},i.id))})]},n.id)})})]})},oh=o=>{const l=Ht(),a=dn()==="live";return Te.useMemo(()=>{const u=(l.pages||[]).map(n=>({id:n.id,path:n.slug,title:n.title,icon:n.icon||"layout",component:()=>Ie.jsx(Nl,{pageId:n.id})}));if(a&&u.length>0)return u;const r=new Set(o.map(n=>n.id)),t=u.filter(n=>!r.has(n.id));return[...o,...t]},[l,o,a])},sh={name:"loading",version:"0.0.0",capabilities:[],navigation:[]};function ah(){const[o,l]=Te.useState(sh),{lastMessage:s,isConnected:a}=To();return Te.useEffect(()=>{if(s&&s.topic==="ramme/manifest/update")try{const u=JSON.parse(s.payload.toString());l(u)}catch(u){console.error("Failed to parse manifest update",u)}},[s]),{manifest:o,isLive:a}}const Bl=o=>{let l;const s=new Set,a=(i,c)=>{const h=typeof i=="function"?i(l):i;if(!Object.is(h,l)){const d=l;l=c??(typeof h!="object"||h===null)?h:Object.assign({},l,h),s.forEach(m=>m(l,d))}},u=()=>l,n={setState:a,getState:u,getInitialState:()=>e,subscribe:i=>(s.add(i),()=>s.delete(i))},e=l=o(a,u,n);return n},lh=o=>o?Bl(o):Bl,uh=o=>o;function ch(o,l=uh){const s=Te.useSyncExternalStore(o.subscribe,Te.useCallback(()=>l(o.getState()),[o,l]),Te.useCallback(()=>l(o.getInitialState()),[o,l]));return Te.useDebugValue(s),s}const Ll=o=>{const l=lh(o),s=a=>ch(l,a);return Object.assign(s,l),s},Co=o=>o?Ll(o):Ll,fh={living_room_ac:{value:72,timestamp:Date.now()},living_room_hum:{value:45,timestamp:Date.now()},server_01:{value:42,timestamp:Date.now()},front_door_lock:{value:"LOCKED",timestamp:Date.now()}},on=Co(o=>({signals:fh,updateSignal:(l,s)=>o(a=>({signals:{...a.signals,[l]:{value:s,timestamp:Date.now()}}})),updateSignals:l=>o(s=>{const a={...s.signals};return Object.entries(l).forEach(([u,r])=>{a[u]={value:r,timestamp:Date.now()}}),{signals:a}})})),Dl=()=>on(o=>o.signals),hh=(o=!0)=>{const{updateSignals:l}=on();Te.useEffect(()=>{if(!o)return;console.log("[System] Simulation Mode: ON 🎲");const s=setInterval(()=>{const a={};a.living_room_ac=Number((72+(Math.random()*4-2)).toFixed(1)),a.living_room_hum=Number((45+(Math.random()*6-3)).toFixed(1)),a.server_01=Math.floor(Math.random()*100),Math.random()>.99&&(a.front_door_lock=Math.random()>.5?"LOCKED":"UNLOCKED"),l(a)},2e3);return()=>clearInterval(s)},[o,l])},ph=o=>{const l=on(t=>t.signals[o]),s=Ht(),a=Te.useMemo(()=>s.domain.signals.find(t=>t.id===o),[o,s]),u=(l==null?void 0:l.value)??(a==null?void 0:a.defaultValue)??0,r=l?Date.now()-l.timestamp>1e4:!0;return{id:o,value:u,unit:a==null?void 0:a.unit,min:a==null?void 0:a.min,max:a==null?void 0:a.max,timestamp:l==null?void 0:l.timestamp,status:r?"stale":"fresh"}},dh="ramme_db_",gh=o=>{if(!(typeof window>"u")){if(!o){console.warn("⚠️ [Data Lake] No registry provided to seeder. Skipping initialization.");return}console.groupCollapsed("🌊 [Data Lake] Initialization"),Object.entries(o).forEach(([l,s])=>{const a=`${dh}${l}`;localStorage.getItem(a)||(console.log(`✨ Seeding collection: ${l}`),localStorage.setItem(a,JSON.stringify(s)))}),console.groupEnd()}};function Ul(o,l){let s;try{s=o()}catch{return}return{getItem:u=>{var r;const t=e=>e===null?null:JSON.parse(e,void 0),n=(r=s.getItem(u))!=null?r:null;return n instanceof Promise?n.then(t):t(n)},setItem:(u,r)=>s.setItem(u,JSON.stringify(r,void 0)),removeItem:u=>s.removeItem(u)}}const jo=o=>l=>{try{const s=o(l);return s instanceof Promise?s:{then(a){return jo(a)(s)},catch(a){return this}}}catch(s){return{then(a){return this},catch(a){return jo(a)(s)}}}},mh=(o,l)=>(s,a,u)=>{let r={storage:Ul(()=>localStorage),partialize:w=>w,version:0,merge:(w,_)=>({..._,...w}),...l},t=!1;const n=new Set,e=new Set;let i=r.storage;if(!i)return o((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),s(...w)},a,u);const c=()=>{const w=r.partialize({...a()});return i.setItem(r.name,{state:w,version:r.version})},h=u.setState;u.setState=(w,_)=>(h(w,_),c());const d=o((...w)=>(s(...w),c()),a,u);u.getInitialState=()=>d;let m;const b=()=>{var w,_;if(!i)return;t=!1,n.forEach(g=>{var S;return g((S=a())!=null?S:d)});const A=((_=r.onRehydrateStorage)==null?void 0:_.call(r,(w=a())!=null?w:d))||void 0;return jo(i.getItem.bind(i))(r.name).then(g=>{if(g)if(typeof g.version=="number"&&g.version!==r.version){if(r.migrate){const S=r.migrate(g.state,g.version);return S instanceof Promise?S.then(E=>[!0,E]):[!0,S]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,g.state];return[!1,void 0]}).then(g=>{var S;const[E,v]=g;if(m=r.merge(v,(S=a())!=null?S:d),s(m,!0),E)return c()}).then(()=>{A==null||A(m,void 0),m=a(),t=!0,e.forEach(g=>g(m))}).catch(g=>{A==null||A(void 0,g)})};return u.persist={setOptions:w=>{r={...r,...w},w.storage&&(i=w.storage)},clearStorage:()=>{i==null||i.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>b(),hasHydrated:()=>t,onHydrate:w=>(n.add(w),()=>{n.delete(w)}),onFinishHydration:w=>(e.add(w),()=>{e.delete(w)})},r.skipHydration||b(),m||d},Ro=Co()(mh((o,l)=>({geminiApiKey:null,isSettingsOpen:!1,setGeminiApiKey:s=>{s&&o({geminiApiKey:s.trim()})},clearKeys:()=>o({geminiApiKey:null}),hasKey:()=>!!l().geminiApiKey,toggleSettings:s=>o(a=>({isSettingsOpen:s??!a.isSettingsOpen}))}),{name:"ramme_db_vault",storage:Ul(()=>localStorage),partialize:o=>({geminiApiKey:o.geminiApiKey})})),yh=()=>{const{geminiApiKey:o}=Ro();return Te.useEffect(()=>{console.log(o?"🧠 [Kernel] Workflow Engine: Online":"🧠 [Kernel] Workflow Engine: Standby (No Key)")},[o]),{isReady:!!o,status:o?"active":"idle"}},Mo=o=>`${o}_${Date.now()}`,bh={meta:{name:"My Ramme App",version:"0.0.1"},config:{theme:"system",mockMode:!0},domain:{signals:[],entities:[],workflows:[]},modules:[],resources:[],pages:[{id:"home",title:"Home",slug:"/",sections:[{id:"main_section",title:"Main Content",layout:{columns:1},blocks:[]}]}]},vh=Co(o=>({manifest:bh,activePageId:"home",selectedBlockId:null,setManifest:l=>o({manifest:l}),setActivePage:l=>o({activePageId:l}),selectBlock:l=>o({selectedBlockId:l}),addPage:l=>o(s=>{const a={id:Mo("page"),title:l,slug:l.toLowerCase().replace(/\s+/g,"-"),sections:[{id:Mo("sect"),title:"Main",layout:{columns:1},blocks:[]}]};return{manifest:{...s.manifest,pages:[...s.manifest.pages||[],a]}}}),updatePage:(l,s)=>o(a=>{var u;return{manifest:{...a.manifest,pages:(u=a.manifest.pages)==null?void 0:u.map(r=>r.id===l?{...r,...s}:r)}}}),deletePage:l=>o(s=>{var r,t;const a=((r=s.manifest.pages)==null?void 0:r.filter(n=>n.id!==l))||[],u=s.activePageId===l?((t=a[0])==null?void 0:t.id)||null:s.activePageId;return{manifest:{...s.manifest,pages:a},activePageId:u}}),addBlock:(l,s,a,u={})=>o(r=>{var n;const t={id:Mo("blk"),type:a,props:u};return{manifest:{...r.manifest,pages:(n=r.manifest.pages)==null?void 0:n.map(e=>e.id!==l?e:{...e,sections:e.sections.map(i=>i.id!==s?i:{...i,blocks:[...i.blocks,t]})})}}}),updateBlock:(l,s,a)=>o(u=>{var r;return{manifest:{...u.manifest,pages:(r=u.manifest.pages)==null?void 0:r.map(t=>t.id!==l?t:{...t,sections:t.sections.map(n=>n.blocks.some(e=>e.id===s)?{...n,blocks:n.blocks.map(e=>e.id===s?{...e,props:{...e.props,...a}}:e)}:n)})}}}),deleteBlock:(l,s)=>o(a=>{var u;return{manifest:{...a.manifest,pages:(u=a.manifest.pages)==null?void 0:u.map(r=>r.id!==l?r:{...r,sections:r.sections.map(t=>({...t,blocks:t.blocks.filter(n=>n.id!==s)}))})}}})}));var wh=Object.defineProperty,_h=(o,l)=>{for(var s in l)wh(o,s,{get:l[s],enumerable:!0})},Fl=be.z.object({key:be.z.string(),label:be.z.string(),type:be.z.enum(["text","number","currency","date","boolean","status","email","image","textarea"]),required:be.z.boolean().optional(),description:be.z.string().optional(),defaultValue:be.z.any().optional()}),Wl=be.z.object({id:be.z.string(),name:be.z.string(),fields:be.z.array(Fl),defaultView:be.z.enum(["table","grid","list"]).optional(),features:be.z.object({searchable:be.z.boolean().optional(),creatable:be.z.boolean().optional(),editable:be.z.boolean().optional(),deletable:be.z.boolean().optional(),exportable:be.z.boolean().optional()}).optional()}),$l=be.z.object({id:be.z.string().min(1,"Signal ID is required"),label:be.z.string(),description:be.z.string().optional(),kind:be.z.enum(["sensor","actuator","setpoint","metric","status","kpi"]),source:be.z.enum(["mock","mqtt","http","derived","local"]),topic:be.z.string().optional(),endpoint:be.z.string().optional(),jsonPath:be.z.string().optional(),refreshRate:be.z.number().optional().default(1e3),defaultValue:be.z.any().optional(),unit:be.z.string().optional(),min:be.z.number().optional(),max:be.z.number().optional()}),ql=be.z.object({id:be.z.string(),name:be.z.string(),description:be.z.string().optional(),type:be.z.string(),category:be.z.string().default("logical"),signals:be.z.array(be.z.string()),ui:be.z.object({icon:be.z.string().optional(),color:be.z.string().optional(),dashboardComponent:be.z.string().optional()}).optional()}),Vl=be.z.object({id:be.z.string(),type:be.z.enum(["signal_change","manual_action","schedule","webhook"]),config:be.z.record(be.z.string(),be.z.any())}),zl=be.z.object({id:be.z.string(),type:be.z.enum(["update_resource","send_notification","mqtt_publish","api_call","navigate","agent_task"]),config:be.z.record(be.z.string(),be.z.any())}),Kl=be.z.object({id:be.z.string(),name:be.z.string(),active:be.z.boolean().default(!0),trigger:Vl,actions:be.z.array(zl)}),Hl=be.z.object({id:be.z.string(),type:be.z.string(),props:be.z.record(be.z.string(),be.z.any()),layout:be.z.object({colSpan:be.z.number().optional(),rowSpan:be.z.number().optional()}).optional()}),Gl=be.z.object({id:be.z.string(),title:be.z.string().optional(),description:be.z.string().optional(),layout:be.z.object({columns:be.z.number().optional(),variant:be.z.enum(["grid","stack","split"]).optional()}).optional(),blocks:be.z.array(Hl)}),Yl=be.z.object({id:be.z.string(),slug:be.z.string(),title:be.z.string(),description:be.z.string().optional(),icon:be.z.string().optional(),sections:be.z.array(Gl)}),Sh=be.z.object({meta:be.z.object({name:be.z.string(),version:be.z.string(),description:be.z.string().optional(),author:be.z.string().optional(),createdAt:be.z.string().optional()}),config:be.z.object({theme:be.z.enum(["light","dark","system","corporate","midnight","blueprint"]).default("system"),mockMode:be.z.boolean().default(!0),brokerUrl:be.z.string().optional()}),modules:be.z.array(be.z.string()).optional(),resources:be.z.array(Wl).optional(),domain:be.z.object({signals:be.z.array($l),entities:be.z.array(ql),workflows:be.z.array(Kl).optional()}),pages:be.z.array(Yl).optional()}),Eh=be.z.object({timestamp:be.z.number(),soilMoisture:be.z.number().min(0).max(100),ambientLight:be.z.number().min(0).max(1e5),temperature:be.z.number().min(-40).max(125)}),Ah={};_h(Ah,{BodewellCommandSchema:()=>Ih,BodewellDeviceID:()=>No,BodewellTelemetrySchema:()=>xh});var No=be.z.enum(["STK-V1-001","STK-V1-002","STK-V1-003","STK-PRO-001","STK-VIS-001"]),xh=be.z.object({device_id:No,stick_id:be.z.string().optional().describe("Firmware alias for device_id"),timestamp:be.z.number().optional().describe("Epoch timestamp from NTP"),air_temp:be.z.number().optional().describe("Celsius"),air_humid:be.z.number().optional().describe("Relative Humidity %"),humidity:be.z.number().optional().describe("Firmware alias for air_humid"),air_pressure:be.z.number().optional().describe("hPa"),pressure:be.z.number().optional().describe("Firmware alias for air_pressure"),light_lux:be.z.number().optional().describe("Lux level"),soil_temp_stemma:be.z.number().optional().describe("Celsius"),soil_vwc:be.z.number().describe("Volumetric Water Content / Raw Capacitance"),soil_moisture:be.z.number().optional().describe("Firmware alias for raw capacitance"),soil_moisture_raw:be.z.number().optional().describe("Unscaled capacitance (300-1100)")}).passthrough(),Ih=be.z.object({stick_id:No,type:be.z.enum(["dry","wet"]),value:be.z.number()});class kh{constructor(){this.intervalId=null,this.subscribers=new Set,this.baseMoisture=45,this.baseLight=15e3,this.baseTemp=23.5}start(l=50){if(this.intervalId!==null)return;const s=1e3/l;this.intervalId=window.setInterval(()=>{this.tick()},s)}stop(){this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null)}subscribe(l){return this.subscribers.add(l),()=>this.subscribers.delete(l)}tick(){this.baseMoisture+=(Math.random()-.5)*.1,this.baseLight+=(Math.random()-.5)*100,this.baseTemp+=(Math.random()-.5)*.05;const l=()=>1+(Math.random()-.5)*.2,s={timestamp:Date.now(),soilMoisture:Math.max(0,Math.min(100,this.baseMoisture*l())),ambientLight:Math.max(0,Math.min(1e5,this.baseLight*l())),temperature:Math.max(-40,Math.min(125,this.baseTemp*l()))},a=Eh.safeParse(s);a.success?this.subscribers.forEach(u=>u(a.data)):console.warn("HITL Simulator: Schema violation detected in mock data",a.error)}}class Th{constructor(l=.2){this.smoothedData={},this.alpha=l}addSample(l){if(Object.keys(this.smoothedData).length===0){this.smoothedData={...l};return}this.smoothedData.soilMoisture=this.applyEma(this.smoothedData.soilMoisture,l.soilMoisture),this.smoothedData.ambientLight=this.applyEma(this.smoothedData.ambientLight,l.ambientLight),this.smoothedData.temperature=this.applyEma(this.smoothedData.temperature,l.temperature),this.smoothedData.timestamp=l.timestamp}applyEma(l,s){return s*this.alpha+l*(1-this.alpha)}getSmoothed(){return Object.keys(this.smoothedData).length===0?null:this.smoothedData}}const Ql=new kh,Bo=new Th(.15);let Jl=!1;function Oh(){const[o,l]=Te.useState(Bo.getSmoothed()),s=Te.useRef(0),a=Te.useRef(null);return Te.useEffect(()=>{Jl||(Ql.start(50),Jl=!0);const u=t=>{Bo.addSample(t),performance.now()-s.current>=66&&(a.current&&cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{l(Bo.getSmoothed()),s.current=performance.now()}))},r=Ql.subscribe(u);return()=>{r(),a.current&&cancelAnimationFrame(a.current)}},[]),o}const Xl=o=>{switch(o){case"fresh":return"online";case"stale":return"warning";case"disconnected":return"offline";case"error":return"error";default:return"offline"}},Ph=({block:o,getComponent:l,getMockData:s})=>{const a=l(o.type),u=Dl(),{signalId:r,dataId:t,...n}=o.props,e={...n,dataId:t,signalId:r};if(t){const i=s(t);e.data=i||[],e.rowData=i||[]}if(r&&u&&r in u){const i=u[r];if(i){const c=typeof i=="object"&&i!==null,h=c&&"value"in i?i.value:i,d=c&&"status"in i?i.status:"fresh";e.value=typeof h=="number"?h:String(h),e.status=Xl(String(d))}else e.status=Xl("disconnected")}return Ie.jsx(a,{...e},o.id)};/**
103
- * @remix-run/router v1.23.2
104
- *
105
- * Copyright (c) Remix Software Inc.
106
- *
107
- * This source code is licensed under the MIT license found in the
108
- * LICENSE.md file in the root directory of this source tree.
109
- *
110
- * @license MIT
111
- */function Lo(){return Lo=Object.assign?Object.assign.bind():function(o){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(o[a]=s[a])}return o},Lo.apply(this,arguments)}var Zl;(function(o){o.Pop="POP",o.Push="PUSH",o.Replace="REPLACE"})(Zl||(Zl={}));function gt(o,l){if(o===!1||o===null||typeof o>"u")throw new Error(l)}function sn(o,l){if(!o){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function eu(o){let l={};if(o){let s=o.indexOf("#");s>=0&&(l.hash=o.substr(s),o=o.substr(0,s));let a=o.indexOf("?");a>=0&&(l.search=o.substr(a),o=o.substr(0,a)),o&&(l.pathname=o)}return l}var tu;(function(o){o.data="data",o.deferred="deferred",o.redirect="redirect",o.error="error"})(tu||(tu={}));const Ch=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,jh=o=>Ch.test(o);function Rh(o,l){l===void 0&&(l="/");let{pathname:s,search:a="",hash:u=""}=typeof o=="string"?eu(o):o,r;if(s)if(jh(s))r=s;else{if(s.includes("//")){let t=s;s=s.replace(/\/\/+/g,"/"),sn(!1,"Pathnames cannot have embedded double slashes - normalizing "+(t+" -> "+s))}s.startsWith("/")?r=ru(s.substring(1),"/"):r=ru(s,l)}else r=l;return{pathname:r,search:Bh(a),hash:Lh(u)}}function ru(o,l){let s=l.replace(/\/+$/,"").split("/");return o.split("/").forEach(u=>{u===".."?s.length>1&&s.pop():u!=="."&&s.push(u)}),s.length>1?s.join("/"):"/"}function Do(o,l,s,a){return"Cannot include a '"+o+"' character in a manually specified "+("`to."+l+"` field ["+JSON.stringify(a)+"]. Please separate it out to the ")+("`to."+s+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Mh(o){return o.filter((l,s)=>s===0||l.route.path&&l.route.path.length>0)}function nu(o,l){let s=Mh(o);return l?s.map((a,u)=>u===s.length-1?a.pathname:a.pathnameBase):s.map(a=>a.pathnameBase)}function iu(o,l,s,a){a===void 0&&(a=!1);let u;typeof o=="string"?u=eu(o):(u=Lo({},o),gt(!u.pathname||!u.pathname.includes("?"),Do("?","pathname","search",u)),gt(!u.pathname||!u.pathname.includes("#"),Do("#","pathname","hash",u)),gt(!u.search||!u.search.includes("#"),Do("#","search","hash",u)));let r=o===""||u.pathname==="",t=r?"/":u.pathname,n;if(t==null)n=s;else{let h=l.length-1;if(!a&&t.startsWith("..")){let d=t.split("/");for(;d[0]==="..";)d.shift(),h-=1;u.pathname=d.join("/")}n=h>=0?l[h]:"/"}let e=Rh(u,n),i=t&&t!=="/"&&t.endsWith("/"),c=(r||t===".")&&s.endsWith("/");return!e.pathname.endsWith("/")&&(i||c)&&(e.pathname+="/"),e}const Nh=o=>o.join("/").replace(/\/\/+/g,"/"),Bh=o=>!o||o==="?"?"":o.startsWith("?")?o:"?"+o,Lh=o=>!o||o==="#"?"":o.startsWith("#")?o:"#"+o,ou=["post","put","patch","delete"];new Set(ou);const Dh=["get",...ou];new Set(Dh);/**
112
- * React Router v6.30.3
113
- *
114
- * Copyright (c) Remix Software Inc.
115
- *
116
- * This source code is licensed under the MIT license found in the
117
- * LICENSE.md file in the root directory of this source tree.
118
- *
119
- * @license MIT
120
- */function Uo(){return Uo=Object.assign?Object.assign.bind():function(o){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(o[a]=s[a])}return o},Uo.apply(this,arguments)}const Fo=st.createContext(null);process.env.NODE_ENV!=="production"&&(Fo.displayName="DataRouter");const Uh=st.createContext(null);process.env.NODE_ENV!=="production"&&(Uh.displayName="DataRouterState");const Fh=st.createContext(null);process.env.NODE_ENV!=="production"&&(Fh.displayName="Await");const an=st.createContext(null);process.env.NODE_ENV!=="production"&&(an.displayName="Navigation");const Wo=st.createContext(null);process.env.NODE_ENV!=="production"&&(Wo.displayName="Location");const _r=st.createContext({outlet:null,matches:[],isDataRoute:!1});process.env.NODE_ENV!=="production"&&(_r.displayName="Route");const Wh=st.createContext(null);process.env.NODE_ENV!=="production"&&(Wh.displayName="RouteError");function $o(){return st.useContext(Wo)!=null}function su(){return $o()||(process.env.NODE_ENV!=="production"?gt(!1,"useLocation() may be used only in the context of a <Router> component."):gt(!1)),st.useContext(Wo).location}const au="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function lu(o){st.useContext(an).static||st.useLayoutEffect(o)}function $h(){let{isDataRoute:o}=st.useContext(_r);return o?Hh():qh()}function qh(){$o()||(process.env.NODE_ENV!=="production"?gt(!1,"useNavigate() may be used only in the context of a <Router> component."):gt(!1));let o=st.useContext(Fo),{basename:l,future:s,navigator:a}=st.useContext(an),{matches:u}=st.useContext(_r),{pathname:r}=su(),t=JSON.stringify(nu(u,s.v7_relativeSplatPath)),n=st.useRef(!1);return lu(()=>{n.current=!0}),st.useCallback(function(i,c){if(c===void 0&&(c={}),process.env.NODE_ENV!=="production"&&sn(n.current,au),!n.current)return;if(typeof i=="number"){a.go(i);return}let h=iu(i,JSON.parse(t),r,c.relative==="path");o==null&&l!=="/"&&(h.pathname=h.pathname==="/"?l:Nh([l,h.pathname])),(c.replace?a.replace:a.push)(h,c.state,c)},[l,a,t,r,o])}var uu=function(o){return o.UseBlocker="useBlocker",o.UseRevalidator="useRevalidator",o.UseNavigateStable="useNavigate",o}(uu||{}),cu=function(o){return o.UseBlocker="useBlocker",o.UseLoaderData="useLoaderData",o.UseActionData="useActionData",o.UseRouteError="useRouteError",o.UseNavigation="useNavigation",o.UseRouteLoaderData="useRouteLoaderData",o.UseMatches="useMatches",o.UseRevalidator="useRevalidator",o.UseNavigateStable="useNavigate",o.UseRouteId="useRouteId",o}(cu||{});function fu(o){return o+" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router."}function Vh(o){let l=st.useContext(Fo);return l||(process.env.NODE_ENV!=="production"?gt(!1,fu(o)):gt(!1)),l}function zh(o){let l=st.useContext(_r);return l||(process.env.NODE_ENV!=="production"?gt(!1,fu(o)):gt(!1)),l}function Kh(o){let l=zh(o),s=l.matches[l.matches.length-1];return s.route.id||(process.env.NODE_ENV!=="production"?gt(!1,o+' can only be used on routes that contain a unique "id"'):gt(!1)),s.route.id}function Hh(){let{router:o}=Vh(uu.UseNavigateStable),l=Kh(cu.UseNavigateStable),s=st.useRef(!1);return lu(()=>{s.current=!0}),st.useCallback(function(u,r){r===void 0&&(r={}),process.env.NODE_ENV!=="production"&&sn(s.current,au),s.current&&(typeof u=="number"?o.navigate(u):o.navigate(u,Uo({fromRouteId:l},r)))},[o,l])}function Gh(o){let{to:l,replace:s,state:a,relative:u}=o;$o()||(process.env.NODE_ENV!=="production"?gt(!1,"<Navigate> may be used only in the context of a <Router> component."):gt(!1));let{future:r,static:t}=st.useContext(an);process.env.NODE_ENV!=="production"&&sn(!t,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:n}=st.useContext(_r),{pathname:e}=su(),i=$h(),c=iu(l,nu(n,r.v7_relativeSplatPath),e,u==="path"),h=JSON.stringify(c);return st.useEffect(()=>i(JSON.parse(h),{replace:s,state:a,relative:u}),[i,h,u,s,a]),null}function qo(o){process.env.NODE_ENV!=="production"?gt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>."):gt(!1)}new Promise(()=>{});const hu=o=>o.map(l=>{if(l.children&&l.children.length>0){const s=l.children[0].path;return Ie.jsxs(qo,{path:l.path,element:Ie.jsx(l.component,{}),children:[Ie.jsx(qo,{index:!0,element:Ie.jsx(Gh,{to:s,replace:!0})}),hu(l.children)]},l.id)}return Ie.jsx(qo,{path:l.path,element:Ie.jsx(l.component,{})},l.id)}),Yh=({isOpen:o,onClose:l})=>{const{geminiApiKey:s,setGeminiApiKey:a,clearKeys:u}=Ro(),[r,t]=Te.useState(""),[n,e]=Te.useState(!1),{addToast:i}=qe.useToast();Te.useEffect(()=>{o&&t(s||"")},[o,s]);const c=()=>{a(r),i("Vault saved","success"),l()},h=()=>{confirm("Clear API Key?")&&(u(),t(""),i("Vault cleared","info"))};return Ie.jsx(qe.Modal,{title:"Ramme Settings",isOpen:o,onClose:l,children:Ie.jsxs("div",{className:"space-y-6 py-4",children:[Ie.jsxs("div",{className:"space-y-3",children:[Ie.jsxs("div",{className:"flex items-center justify-between",children:[Ie.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Gemini API Key"}),Ie.jsxs("a",{href:"https://aistudio.google.com/app/apikey",target:"_blank",rel:"noreferrer",className:"text-xs text-primary flex gap-1 items-center hover:underline",children:["Get Key ",Ie.jsx(qe.Icon,{name:"external-link",className:"w-3 h-3"})]})]}),Ie.jsxs("div",{className:"relative",children:[Ie.jsx(qe.Input,{type:n?"text":"password",value:r,onChange:d=>t(d.target.value),placeholder:"AIzaSy...",className:"pr-10 font-mono text-sm"}),Ie.jsx("button",{type:"button",onClick:()=>e(!n),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:Ie.jsx(qe.Icon,{name:n?"eye-off":"eye",className:"w-4 h-4"})})]}),Ie.jsx("p",{className:"text-[0.8rem] text-muted-foreground",children:"Stored securely in your browser's LocalStorage."})]}),Ie.jsxs("div",{className:"flex justify-between pt-4 border-t mt-6",children:[Ie.jsx(qe.Button,{variant:"ghost",className:"text-destructive",onClick:h,disabled:!s,children:"Clear Key"}),Ie.jsxs("div",{className:"flex gap-2",children:[Ie.jsx(qe.Button,{variant:"outline",onClick:l,children:"Cancel"}),Ie.jsx(qe.Button,{onClick:c,children:"Save"})]})]})]})})};je.ActionSchema=zl,je.AppSpecificationSchema=Sh,je.AutoForm=Cl,je.BlockSchema=Hl,je.DynamicBlock=Ph,je.DynamicPage=Nl,je.EntitySchema=ql,je.FieldSchema=Fl,je.ManifestProvider=Iu,je.MqttProvider=Lf,je.PageSchema=Yl,je.PageSectionSchema=Gl,je.ResourceSchema=Wl,je.SettingsModal=Yh,je.SignalSchema=$l,je.SitemapProvider=Uf,je.SmartTable=Po,je.TriggerSchema=Vl,je.WorkflowSchema=Kl,je.generateRoutes=hu,je.initializeDataLake=gh,je.useAction=Ff,je.useAppStore=vh,je.useBridgeStatus=dn,je.useCrudLocalStorage=Pl,je.useDataQuery=Wf,je.useDevice=Oh,je.useDynamicSitemap=oh,je.useGeneratedSignals=Dl,je.useJustInTimeSeeder=Oo,je.useLiveBridge=ah,je.useManifest=Ht,je.useMqtt=To,je.useSettingsStore=Ro,je.useSignal=ph,je.useSignalStore=on,je.useSimulation=hh,je.useSitemap=Df,je.useWorkflowEngine=yh,Object.defineProperty(je,Symbol.toStringTag,{value:"Module"})});