coinley-test 0.39.102 → 0.40.103

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.
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).CoinleyVanilla=t()}(this,function(){"use strict";var e,t,n,r,i,o,s,a,c,l,u,d,h,f,p,m,g,y,b,v,w,E,_,x,k,S,C,I,A,P,M,O,T,R,N,L,B,j,D,U,F,$,z,H,q,W,K,G,V,Z,Y,J,Q,X,ee,te,ne,re,ie,oe,se,ae,ce,le,ue,de,he,fe,pe,me,ge,ye,be,ve,we,Ee,_e,xe,ke,Se=e=>{throw TypeError(e)},Ce=(e,t,n)=>t.has(e)||Se("Cannot "+n),Ie=(e,t,n)=>(Ce(e,t,"read from private field"),n?n.call(e):t.get(e)),Ae=(e,t,n)=>t.has(e)?Se("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Pe=(e,t,n,r)=>(Ce(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Me=(e,t,n)=>(Ce(e,t,"access private method"),n),Oe=(e,t,n,r)=>({set _(r){Pe(e,t,r,n)},get _(){return Ie(e,t,r)}}),Te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};function Re(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ne(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Le={exports:{}},Be={},je=Symbol.for("react.element"),De=Symbol.for("react.portal"),Ue=Symbol.for("react.fragment"),Fe=Symbol.for("react.strict_mode"),$e=Symbol.for("react.profiler"),ze=Symbol.for("react.provider"),He=Symbol.for("react.context"),qe=Symbol.for("react.forward_ref"),We=Symbol.for("react.suspense"),Ke=Symbol.for("react.memo"),Ge=Symbol.for("react.lazy"),Ve=Symbol.iterator;var Ze={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ye=Object.assign,Je={};function Qe(e,t,n){this.props=e,this.context=t,this.refs=Je,this.updater=n||Ze}function Xe(){}function et(e,t,n){this.props=e,this.context=t,this.refs=Je,this.updater=n||Ze}Qe.prototype.isReactComponent={},Qe.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},Qe.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},Xe.prototype=Qe.prototype;var tt=et.prototype=new Xe;tt.constructor=et,Ye(tt,Qe.prototype),tt.isPureReactComponent=!0;var nt=Array.isArray,rt=Object.prototype.hasOwnProperty,it={current:null},ot={key:!0,ref:!0,__self:!0,__source:!0};function st(e,t,n){var r,i={},o=null,s=null;if(null!=t)for(r in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(o=""+t.key),t)rt.call(t,r)&&!ot.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(1===a)i.children=n;else if(1<a){for(var c=Array(a),l=0;l<a;l++)c[l]=arguments[l+2];i.children=c}if(e&&e.defaultProps)for(r in a=e.defaultProps)void 0===i[r]&&(i[r]=a[r]);return{$$typeof:je,type:e,key:o,ref:s,props:i,_owner:it.current}}function at(e){return"object"==typeof e&&null!==e&&e.$$typeof===je}var ct=/\/+/g;function lt(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function ut(e,t,n,r,i){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var s=!1;if(null===e)s=!0;else switch(o){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case je:case De:s=!0}}if(s)return i=i(s=e),e=""===r?"."+lt(s,0):r,nt(i)?(n="",null!=e&&(n=e.replace(ct,"$&/")+"/"),ut(i,t,n,"",function(e){return e})):null!=i&&(at(i)&&(i=function(e,t){return{$$typeof:je,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(ct,"$&/")+"/")+e)),t.push(i)),1;if(s=0,r=""===r?".":r+":",nt(e))for(var a=0;a<e.length;a++){var c=r+lt(o=e[a],a);s+=ut(o,t,n,c,i)}else if(c=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=Ve&&e[Ve]||e["@@iterator"])?e:null}(e),"function"==typeof c)for(e=c.call(e),a=0;!(o=e.next()).done;)s+=ut(o=o.value,t,n,c=r+lt(o,a++),i);else if("object"===o)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function dt(e,t,n){if(null==e)return e;var r=[],i=0;return ut(e,r,"","",function(e){return t.call(n,e,i++)}),r}function ht(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var ft={current:null},pt={transition:null},mt={ReactCurrentDispatcher:ft,ReactCurrentBatchConfig:pt,ReactCurrentOwner:it};function gt(){throw Error("act(...) is not supported in production builds of React.")}Be.Children={map:dt,forEach:function(e,t,n){dt(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return dt(e,function(){t++}),t},toArray:function(e){return dt(e,function(e){return e})||[]},only:function(e){if(!at(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},Be.Component=Qe,Be.Fragment=Ue,Be.Profiler=$e,Be.PureComponent=et,Be.StrictMode=Fe,Be.Suspense=We,Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mt,Be.act=gt,Be.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Ye({},e.props),i=e.key,o=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(o=t.ref,s=it.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(c in t)rt.call(t,c)&&!ot.hasOwnProperty(c)&&(r[c]=void 0===t[c]&&void 0!==a?a[c]:t[c])}var c=arguments.length-2;if(1===c)r.children=n;else if(1<c){a=Array(c);for(var l=0;l<c;l++)a[l]=arguments[l+2];r.children=a}return{$$typeof:je,type:e.type,key:i,ref:o,props:r,_owner:s}},Be.createContext=function(e){return(e={$$typeof:He,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:ze,_context:e},e.Consumer=e},Be.createElement=st,Be.createFactory=function(e){var t=st.bind(null,e);return t.type=e,t},Be.createRef=function(){return{current:null}},Be.forwardRef=function(e){return{$$typeof:qe,render:e}},Be.isValidElement=at,Be.lazy=function(e){return{$$typeof:Ge,_payload:{_status:-1,_result:e},_init:ht}},Be.memo=function(e,t){return{$$typeof:Ke,type:e,compare:void 0===t?null:t}},Be.startTransition=function(e){var t=pt.transition;pt.transition={};try{e()}finally{pt.transition=t}},Be.unstable_act=gt,Be.useCallback=function(e,t){return ft.current.useCallback(e,t)},Be.useContext=function(e){return ft.current.useContext(e)},Be.useDebugValue=function(){},Be.useDeferredValue=function(e){return ft.current.useDeferredValue(e)},Be.useEffect=function(e,t){return ft.current.useEffect(e,t)},Be.useId=function(){return ft.current.useId()},Be.useImperativeHandle=function(e,t,n){return ft.current.useImperativeHandle(e,t,n)},Be.useInsertionEffect=function(e,t){return ft.current.useInsertionEffect(e,t)},Be.useLayoutEffect=function(e,t){return ft.current.useLayoutEffect(e,t)},Be.useMemo=function(e,t){return ft.current.useMemo(e,t)},Be.useReducer=function(e,t,n){return ft.current.useReducer(e,t,n)},Be.useRef=function(e){return ft.current.useRef(e)},Be.useState=function(e){return ft.current.useState(e)},Be.useSyncExternalStore=function(e,t,n){return ft.current.useSyncExternalStore(e,t,n)},Be.useTransition=function(){return ft.current.useTransition()},Be.version="18.3.1",Le.exports=Be;var yt=Le.exports;const bt=Re(yt);var vt={exports:{}},wt={},Et={exports:{}},_t={};
1
+ var CoinleyVanilla=function(){"use strict";var e,t,n,r,i,o,s,a,c,l,u,d,h,f,p,m,g,y,b,v,w,E,_,x,k,S,C,I,A,P,M,O,T,R,N,L,B,j,D,U,F,$,z,H,q,W,K,G,V,Z,Y,J,Q,X,ee,te,ne,re,ie,oe,se,ae,ce,le,ue,de,he,fe,pe,me,ge,ye,be,ve,we,Ee,_e,xe,ke,Se=e=>{throw TypeError(e)},Ce=(e,t,n)=>t.has(e)||Se("Cannot "+n),Ie=(e,t,n)=>(Ce(e,t,"read from private field"),n?n.call(e):t.get(e)),Ae=(e,t,n)=>t.has(e)?Se("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Pe=(e,t,n,r)=>(Ce(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Me=(e,t,n)=>(Ce(e,t,"access private method"),n),Oe=(e,t,n,r)=>({set _(r){Pe(e,t,r,n)},get _(){return Ie(e,t,r)}}),Te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};function Re(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ne(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Le={exports:{}},Be={},je=Symbol.for("react.element"),De=Symbol.for("react.portal"),Ue=Symbol.for("react.fragment"),Fe=Symbol.for("react.strict_mode"),$e=Symbol.for("react.profiler"),ze=Symbol.for("react.provider"),He=Symbol.for("react.context"),qe=Symbol.for("react.forward_ref"),We=Symbol.for("react.suspense"),Ke=Symbol.for("react.memo"),Ge=Symbol.for("react.lazy"),Ve=Symbol.iterator;var Ze={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ye=Object.assign,Je={};function Qe(e,t,n){this.props=e,this.context=t,this.refs=Je,this.updater=n||Ze}function Xe(){}function et(e,t,n){this.props=e,this.context=t,this.refs=Je,this.updater=n||Ze}Qe.prototype.isReactComponent={},Qe.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},Qe.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},Xe.prototype=Qe.prototype;var tt=et.prototype=new Xe;tt.constructor=et,Ye(tt,Qe.prototype),tt.isPureReactComponent=!0;var nt=Array.isArray,rt=Object.prototype.hasOwnProperty,it={current:null},ot={key:!0,ref:!0,__self:!0,__source:!0};function st(e,t,n){var r,i={},o=null,s=null;if(null!=t)for(r in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(o=""+t.key),t)rt.call(t,r)&&!ot.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(1===a)i.children=n;else if(1<a){for(var c=Array(a),l=0;l<a;l++)c[l]=arguments[l+2];i.children=c}if(e&&e.defaultProps)for(r in a=e.defaultProps)void 0===i[r]&&(i[r]=a[r]);return{$$typeof:je,type:e,key:o,ref:s,props:i,_owner:it.current}}function at(e){return"object"==typeof e&&null!==e&&e.$$typeof===je}var ct=/\/+/g;function lt(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function ut(e,t,n,r,i){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var s=!1;if(null===e)s=!0;else switch(o){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case je:case De:s=!0}}if(s)return i=i(s=e),e=""===r?"."+lt(s,0):r,nt(i)?(n="",null!=e&&(n=e.replace(ct,"$&/")+"/"),ut(i,t,n,"",function(e){return e})):null!=i&&(at(i)&&(i=function(e,t){return{$$typeof:je,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(i,n+(!i.key||s&&s.key===i.key?"":(""+i.key).replace(ct,"$&/")+"/")+e)),t.push(i)),1;if(s=0,r=""===r?".":r+":",nt(e))for(var a=0;a<e.length;a++){var c=r+lt(o=e[a],a);s+=ut(o,t,n,c,i)}else if(c=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=Ve&&e[Ve]||e["@@iterator"])?e:null}(e),"function"==typeof c)for(e=c.call(e),a=0;!(o=e.next()).done;)s+=ut(o=o.value,t,n,c=r+lt(o,a++),i);else if("object"===o)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function dt(e,t,n){if(null==e)return e;var r=[],i=0;return ut(e,r,"","",function(e){return t.call(n,e,i++)}),r}function ht(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var ft={current:null},pt={transition:null},mt={ReactCurrentDispatcher:ft,ReactCurrentBatchConfig:pt,ReactCurrentOwner:it};function gt(){throw Error("act(...) is not supported in production builds of React.")}Be.Children={map:dt,forEach:function(e,t,n){dt(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return dt(e,function(){t++}),t},toArray:function(e){return dt(e,function(e){return e})||[]},only:function(e){if(!at(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},Be.Component=Qe,Be.Fragment=Ue,Be.Profiler=$e,Be.PureComponent=et,Be.StrictMode=Fe,Be.Suspense=We,Be.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=mt,Be.act=gt,Be.cloneElement=function(e,t,n){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Ye({},e.props),i=e.key,o=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(o=t.ref,s=it.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(c in t)rt.call(t,c)&&!ot.hasOwnProperty(c)&&(r[c]=void 0===t[c]&&void 0!==a?a[c]:t[c])}var c=arguments.length-2;if(1===c)r.children=n;else if(1<c){a=Array(c);for(var l=0;l<c;l++)a[l]=arguments[l+2];r.children=a}return{$$typeof:je,type:e.type,key:i,ref:o,props:r,_owner:s}},Be.createContext=function(e){return(e={$$typeof:He,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:ze,_context:e},e.Consumer=e},Be.createElement=st,Be.createFactory=function(e){var t=st.bind(null,e);return t.type=e,t},Be.createRef=function(){return{current:null}},Be.forwardRef=function(e){return{$$typeof:qe,render:e}},Be.isValidElement=at,Be.lazy=function(e){return{$$typeof:Ge,_payload:{_status:-1,_result:e},_init:ht}},Be.memo=function(e,t){return{$$typeof:Ke,type:e,compare:void 0===t?null:t}},Be.startTransition=function(e){var t=pt.transition;pt.transition={};try{e()}finally{pt.transition=t}},Be.unstable_act=gt,Be.useCallback=function(e,t){return ft.current.useCallback(e,t)},Be.useContext=function(e){return ft.current.useContext(e)},Be.useDebugValue=function(){},Be.useDeferredValue=function(e){return ft.current.useDeferredValue(e)},Be.useEffect=function(e,t){return ft.current.useEffect(e,t)},Be.useId=function(){return ft.current.useId()},Be.useImperativeHandle=function(e,t,n){return ft.current.useImperativeHandle(e,t,n)},Be.useInsertionEffect=function(e,t){return ft.current.useInsertionEffect(e,t)},Be.useLayoutEffect=function(e,t){return ft.current.useLayoutEffect(e,t)},Be.useMemo=function(e,t){return ft.current.useMemo(e,t)},Be.useReducer=function(e,t,n){return ft.current.useReducer(e,t,n)},Be.useRef=function(e){return ft.current.useRef(e)},Be.useState=function(e){return ft.current.useState(e)},Be.useSyncExternalStore=function(e,t,n){return ft.current.useSyncExternalStore(e,t,n)},Be.useTransition=function(){return ft.current.useTransition()},Be.version="18.3.1",Le.exports=Be;var yt=Le.exports;const bt=Re(yt);var vt={exports:{}},wt={},Et={exports:{}},_t={};
2
2
  /**
3
3
  * @license React
4
4
  * scheduler.production.min.js
@@ -73,5 +73,5 @@ function(e,t){var n=mq,r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}funct
73
73
  *
74
74
  * Copyright (c) 2013 hij1nx
75
75
  * Licensed under the MIT license.
76
- */!function(e){!function(t){var n=Object.hasOwnProperty,r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i="object"==typeof process&&"function"==typeof process.nextTick,o="function"==typeof Symbol,s="object"==typeof Reflect,a="function"==typeof setImmediate?setImmediate:setTimeout,c=o?s&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function l(){this._events={},this._conf&&u.call(this,this._conf)}function u(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==t&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function d(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,process.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var h=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=new Array(r);r--;)i[r]=arguments[r];return i}};function f(e,n){for(var r={},i=e.length,o=0;o<i;o++)r[e[o]]=o<0?n[o]:t;return r}function p(e,t,n){var r,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(n.on||n.off)&&(r=n.on,i=n.off),t.addEventListener?(r=t.addEventListener,i=t.removeEventListener):t.addListener?(r=t.addListener,i=t.removeListener):t.on&&(r=t.on,i=t.off),!r&&!i)throw Error("target does not implement any known event API");if("function"!=typeof r)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=r,this._off=i;var o=e._observers;o?o.push(this):e._observers=[this]}function m(e,r,i,o){var s=Object.assign({},r);if(!e)return s;if("object"!=typeof e)throw TypeError("options must be an object");var a,c,l,u=Object.keys(e),d=u.length;function h(e){throw Error('Invalid "'+a+'" option value'+(e?". Reason: "+e:""))}for(var f=0;f<d;f++){if(a=u[f],!n.call(r,a))throw Error('Unknown "'+a+'" option');(c=e[a])!==t&&(l=i[a],s[a]=l?l(c,h):c)}return s}function g(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function y(e){var t="value must be type of "+e.join("|"),n=e.length,r=e[0],i=e[1];return 1===n?function(e,n){if(typeof e===r)return e;n(t)}:2===n?function(e,n){var o=typeof e;if(o===r||o===i)return e;n(t)}:function(r,i){for(var o=typeof r,s=n;s-- >0;)if(o===e[s])return r;i(t)}}Object.assign(p.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var r=h.apply(null,arguments),s={data:r,name:t,original:e};n?!1!==n.call(i,s)&&o.emit.apply(o,[s.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(s[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===s[e]&&(s[e]=a,r._on.call(i,e,a))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&s[e]&&(s[e]=null,r._off.call(i,e,a))},s[e]=null,o.on("removeListener",this._onRemoveListener)):(s[e]=a,r._on.call(i,e,a))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,s=this._emitter,a=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function u(){i._onNewListener&&(s.off("newListener",i._onNewListener),s.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=E.call(s,i);s._observers.splice(e,1)}if(e){if(!(t=o[e]))return;a.call(l,e,t),delete o[e],--this._listenersCount||u()}else{for(r=(n=c(o)).length;r-- >0;)e=n[r],a.call(l,e,o[e]);this._listeners={},this._listenersCount=0,u()}}});var b=y(["function"]),v=y(["object","function"]);function w(e,t,n){var r,i,o,s=0,a=new e(function(c,l,u){function d(){i&&(i=null),s&&(clearTimeout(s),s=0)}n=m(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof u;var h=function(e){d(),c(e)},f=function(e){d(),l(e)};r?t(h,f,u):(i=[function(e){f(e||Error("canceled"))}],t(h,f,function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)}),o=!0),n.timeout>0&&(s=setTimeout(function(){var e=Error("timeout");e.code="ETIMEDOUT",s=0,a.cancel(e),l(e)},n.timeout))});return r||(a.cancel=function(e){if(i){for(var t=i.length,n=1;n<t;n++)i[n](e);i[0](e),i=null}}),a}function E(e){var t=this._observers;if(!t)return-1;for(var n=t.length,r=0;r<n;r++)if(t[r]._target===e)return r;return-1}function _(e,t,n,r,i){if(!n)return null;if(0===r){var o=typeof t;if("string"===o){var s,a,l=0,u=0,d=this.delimiter,h=d.length;if(-1!==(a=t.indexOf(d))){s=new Array(5);do{s[l++]=t.slice(u,a),u=a+h}while(-1!==(a=t.indexOf(d,u)));s[l++]=t.slice(u),t=s,i=l}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var f,p,m,g,y,b,v,w=null,E=t[r],x=t[r+1];if(r===i)n._listeners&&("function"==typeof n._listeners?(e&&e.push(n._listeners),w=[n]):(e&&e.push.apply(e,n._listeners),w=[n]));else{if("*"===E){for(a=(b=c(n)).length;a-- >0;)"_listeners"!==(f=b[a])&&(v=_(e,t,n[f],r+1,i))&&(w?w.push.apply(w,v):w=v);return w}if("**"===E){for((y=r+1===i||r+2===i&&"*"===x)&&n._listeners&&(w=_(e,t,n,i,i)),a=(b=c(n)).length;a-- >0;)"_listeners"!==(f=b[a])&&("*"===f||"**"===f?(n[f]._listeners&&!y&&(v=_(e,t,n[f],i,i))&&(w?w.push.apply(w,v):w=v),v=_(e,t,n[f],r,i)):v=_(e,t,n[f],f===x?r+2:r,i),v&&(w?w.push.apply(w,v):w=v));return w}n[E]&&(w=_(e,t,n[E],r+1,i))}if((p=n["*"])&&_(e,t,p,r+1,i),m=n["**"])if(r<i)for(m._listeners&&_(e,t,m,i,i),a=(b=c(m)).length;a-- >0;)"_listeners"!==(f=b[a])&&(f===x?_(e,t,m[f],r+2,i):f===E?_(e,t,m[f],r+1,i):((g={})[f]=m[f],_(e,t,{"**":g},r+1,i)));else m._listeners?_(e,t,m,i,i):m["*"]&&m["*"]._listeners&&_(e,t,m["*"],i,i);return w}function x(e,t,n){var r,i,o=0,s=0,a=this.delimiter,c=a.length;if("string"==typeof e)if(-1!==(r=e.indexOf(a))){i=new Array(5);do{i[o++]=e.slice(s,r),s=r+c}while(-1!==(r=e.indexOf(a,s)));i[o++]=e.slice(s)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(r=0;r+1<o;r++)if("**"===i[r]&&"**"===i[r+1])return;var l,u=this.listenerTree;for(r=0;r<o;r++)if(u=u[l=i[r]]||(u[l]={}),r===o-1)return u._listeners?("function"==typeof u._listeners&&(u._listeners=[u._listeners]),n?u._listeners.unshift(t):u._listeners.push(t),!u._listeners.warned&&this._maxListeners>0&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,d.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}function k(e,t,n,r){for(var i,o,s,a,l=c(e),u=l.length,d=e._listeners;u-- >0;)i=e[o=l[u]],s="_listeners"===o?n:n?n.concat(o):[o],a=r||"symbol"==typeof o,d&&t.push(a?s:s.join(this.delimiter)),"object"==typeof i&&k.call(this,i,t,s,a);return t}function S(e){for(var t,n,r,i=c(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||S(t)||delete e[n]);return r}function C(e,t,n){this.emitter=e,this.event=t,this.listener=n}function I(e,n,r){if(!0===r)s=!0;else if(!1===r)o=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var o=r.async,s=r.promisify,c=r.nextTick,l=r.objectify}if(o||c||s){var u=n,d=n._origin||n;if(c&&!i)throw Error("process.nextTick is not supported");s===t&&(s="AsyncFunction"===n.constructor.name),n=function(){var e=arguments,t=this,n=this.event;return s?c?Promise.resolve():new Promise(function(e){a(e)}).then(function(){return t.event=n,u.apply(t,e)}):(c?process.nextTick:a)(function(){t.event=n,u.apply(t,e)})},n._async=!0,n._origin=d}return[n,l?new C(this,e,n):this]}function A(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,u.call(this,e)}C.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},A.EventEmitter2=A,A.prototype.listenTo=function(e,n,i){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function s(t){if("object"!=typeof t)throw TypeError("events must be an object");var n,r=i.reducers,s=E.call(o,e);n=-1===s?new p(o,e,i):o._observers[s];for(var a,l=c(t),u=l.length,d="function"==typeof r,h=0;h<u;h++)a=l[h],n.subscribe(a,t[a]||a,d?r:r&&r[a])}return i=m(i,{on:t,off:t,reducers:t},{on:b,off:b,reducers:v}),r(n)?s(f(n)):s("string"==typeof n?f(n.split(/\s+/)):n),this},A.prototype.stopListeningTo=function(e,t){var n=this._observers;if(!n)return!1;var r,i=n.length,o=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},A.prototype.delimiter=".",A.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},A.prototype.getMaxListeners=function(){return this._maxListeners},A.prototype.event="",A.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},A.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},A.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},A.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},A.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},A.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function s(){return 0===--t&&o.off(e,s),n.apply(this,arguments)}return s._origin=n,this._on(e,s,r,i)},A.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,s,a=arguments[0],c=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return!1;if(c&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(n=a.length,o)for(r=0;r<n;r++)if("symbol"==typeof a[r]){s=!0;break}s||(a=a.join(this.delimiter))}var u,d=arguments.length;if(this._all&&this._all.length)for(r=0,n=(u=this._all.slice()).length;r<n;r++)switch(this.event=a,d){case 1:u[r].call(this,a);break;case 2:u[r].call(this,a,arguments[1]);break;case 3:u[r].call(this,a,arguments[1],arguments[2]);break;default:u[r].apply(this,arguments)}if(c)u=[],_.call(this,u,e,this.listenerTree,0,n);else{if("function"==typeof(u=this._events[a])){switch(this.event=a,d){case 1:u.call(this);break;case 2:u.call(this,arguments[1]);break;case 3:u.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];u.apply(this,t)}return!0}u&&(u=u.slice())}if(u&&u.length){if(d>3)for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];for(r=0,n=u.length;r<n;r++)switch(this.event=a,d){case 1:u[r].call(this);break;case 2:u[r].call(this,arguments[1]);break;case 3:u[r].call(this,arguments[1],arguments[2]);break;default:u[r].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===a)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},A.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,s,a=arguments[0],c=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(c&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(r=a.length,o)for(i=0;i<r;i++)if("symbol"==typeof a[i]){t=!0;break}t||(a=a.join(this.delimiter))}var u,d=[],h=arguments.length;if(this._all)for(i=0,r=this._all.length;i<r;i++)switch(this.event=a,h){case 1:d.push(this._all[i].call(this,a));break;case 2:d.push(this._all[i].call(this,a,arguments[1]));break;case 3:d.push(this._all[i].call(this,a,arguments[1],arguments[2]));break;default:d.push(this._all[i].apply(this,arguments))}if(c?(u=[],_.call(this,u,e,this.listenerTree,0)):u=this._events[a],"function"==typeof u)switch(this.event=a,h){case 1:d.push(u.call(this));break;case 2:d.push(u.call(this,arguments[1]));break;case 3:d.push(u.call(this,arguments[1],arguments[2]));break;default:for(n=new Array(h-1),s=1;s<h;s++)n[s-1]=arguments[s];d.push(u.apply(this,n))}else if(u&&u.length){if(u=u.slice(),h>3)for(n=new Array(h-1),s=1;s<h;s++)n[s-1]=arguments[s];for(i=0,r=u.length;i<r;i++)switch(this.event=a,h){case 1:d.push(u[i].call(this));break;case 2:d.push(u[i].call(this,arguments[1]));break;case 3:d.push(u[i].call(this,arguments[1],arguments[2]));break;default:d.push(u[i].apply(this,n))}}else if(!this.ignoreErrors&&!this._all&&"error"===a)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(d)},A.prototype.on=function(e,t,n){return this._on(e,t,!1,n)},A.prototype.prependListener=function(e,t,n){return this._on(e,t,!0,n)},A.prototype.onAny=function(e){return this._onAny(e,!1)},A.prototype.prependAny=function(e){return this._onAny(e,!0)},A.prototype.addListener=A.prototype.on,A.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},A.prototype._on=function(e,n,r,i){if("function"==typeof e)return this._onAny(e,n),this;if("function"!=typeof n)throw new Error("on only accepts instances of Function");this._events||l.call(this);var o,s=this;return i!==t&&(n=(o=I.call(this,e,n,i))[0],s=o[1]),this._newListener&&this.emit("newListener",e,n),this.wildcard?(x.call(this,e,n,r),s):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(n):this._events[e].push(n),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,d.call(this,this._events[e].length,e))):this._events[e]=n,s)},A.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=_.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var s=0;s<i.length;s++){var a=i[s];if(n=a._listeners,r(n)){for(var c=-1,l=0,u=n.length;l<u;l++)if(n[l]===t||n[l].listener&&n[l].listener===t||n[l]._origin&&n[l]._origin===t){c=l;break}if(c<0)continue;return this.wildcard?a._listeners.splice(c,1):this._events[e].splice(c,1),0===n.length&&(this.wildcard?delete a._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete a._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&S(this.listenerTree),this},A.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(n=0,r=(t=this._all).length;n<r;n++)if(e===t[n])return t.splice(n,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(n=0,r=t.length;n<r;n++)this.emit("removeListenerAny",t[n]);this._all=[]}return this},A.prototype.removeListener=A.prototype.off,A.prototype.removeAllListeners=function(e){if(e===t)return!this._events||l.call(this),this;if(this.wildcard){var n,r=_.call(this,null,e,this.listenerTree,0);if(!r)return this;for(n=0;n<r.length;n++)r[n]._listeners=null;this.listenerTree&&S(this.listenerTree)}else this._events&&(this._events[e]=null);return this},A.prototype.listeners=function(e){var n,r,i,o,s,a=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!a)return[];for(o=(n=c(a)).length,i=[];o-- >0;)"function"==typeof(r=a[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(s=this.listenerTree))return[];var l=[],u="string"==typeof e?e.split(this.delimiter):e.slice();return _.call(this,l,u,s,0),l}return a&&(r=a[e])?"function"==typeof r?[r]:r:[]},A.prototype.eventNames=function(e){var t=this._events;return this.wildcard?k.call(this,this.listenerTree,[],null,e):t?c(t):[]},A.prototype.listenerCount=function(e){return this.listeners(e).length},A.prototype.hasListeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return _.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(e===t?c(i).length:i[e]))},A.prototype.listenersAny=function(){return this._all?this._all:[]},A.prototype.waitFor=function(e,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),w((n=m(n,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:b,Promise:g})).Promise,function(t,i,o){function s(){var o=n.filter;if(!o||o.apply(r,arguments))if(r.off(e,s),n.handleError){var a=arguments[0];a?i(a):t(h.apply(null,arguments).slice(1))}else t(h.apply(null,arguments))}o(function(){r.off(e,s)}),r._on(e,s,!1)},{timeout:n.timeout,overload:n.overload})};var P=A.prototype;Object.defineProperties(A,{defaultMaxListeners:{get:function(){return P._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");P._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return w((n=m(n,{Promise:Promise,timeout:0,overload:!1},{Promise:g})).Promise,function(n,r,i){var o;if("function"==typeof e.addEventListener)return o=function(){n(h.apply(null,arguments))},i(function(){e.removeEventListener(t,o)}),void e.addEventListener(t,o,{once:!0});var s,a=function(){s&&e.removeListener("error",s),n(h.apply(null,arguments))};"error"!==t&&(s=function(n){e.removeListener(t,a),r(n)},e.once("error",s)),i(function(){s&&e.removeListener("error",s),e.removeListener(t,a)}),e.once(t,a)},{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(P,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=A}()}(P4);var M4=P4.exports;const O4=Re(M4);var T4,R4=new Uint8Array(16);function N4(){if(!T4&&!(T4="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return T4(R4)}const L4=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function B4(e){return"string"==typeof e&&L4.test(e)}for(var j4=[],D4=0;D4<256;++D4)j4.push((D4+256).toString(16).substr(1));function U4(e,t,n){var r=(e=e||{}).random||(e.rng||N4)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(j4[e[t+0]]+j4[e[t+1]]+j4[e[t+2]]+j4[e[t+3]]+"-"+j4[e[t+4]]+j4[e[t+5]]+"-"+j4[e[t+6]]+j4[e[t+7]]+"-"+j4[e[t+8]]+j4[e[t+9]]+"-"+j4[e[t+10]]+j4[e[t+11]]+j4[e[t+12]]+j4[e[t+13]]+j4[e[t+14]]+j4[e[t+15]]).toLowerCase();if(!B4(n))throw TypeError("Stringified UUID is invalid");return n}(r)}const F4=Object.create(null);F4.open="0",F4.close="1",F4.ping="2",F4.pong="3",F4.message="4",F4.upgrade="5",F4.noop="6";const $4=Object.create(null);Object.keys(F4).forEach(e=>{$4[F4[e]]=e});const z4={type:"error",data:"parser error"},H4="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),q4="function"==typeof ArrayBuffer,W4=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,K4=({type:e,data:t},n,r)=>H4&&t instanceof Blob?n?r(t):G4(t,r):q4&&(t instanceof ArrayBuffer||W4(t))?n?r(t):G4(new Blob([t]),r):r(F4[e]+(t||"")),G4=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function V4(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Z4;const Y4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",J4="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let $fe=0;$fe<64;$fe++)J4[Y4.charCodeAt($fe)]=$fe;const Q4="function"==typeof ArrayBuffer,X4=(e,t)=>{if("string"!=typeof e)return{type:"message",data:t8(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:e8(e.substring(1),t)};return $4[n]?e.length>1?{type:$4[n],data:e.substring(1)}:{type:$4[n]}:z4},e8=(e,t)=>{if(Q4){const n=(e=>{let t,n,r,i,o,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const l=new ArrayBuffer(s),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=J4[e.charCodeAt(t)],r=J4[e.charCodeAt(t+1)],i=J4[e.charCodeAt(t+2)],o=J4[e.charCodeAt(t+3)],u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|i>>2,u[c++]=(3&i)<<6|63&o;return l})(e);return t8(n,t)}return{base64:!0,data:e}},t8=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,n8=String.fromCharCode(30);function r8(){return new TransformStream({transform(e,t){!function(e,t){H4&&e.data instanceof Blob?e.data.arrayBuffer().then(V4).then(t):q4&&(e.data instanceof ArrayBuffer||W4(e.data))?t(V4(e.data)):K4(e,!1,e=>{Z4||(Z4=new TextEncoder),t(Z4.encode(e))})}(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let i8;function o8(e){return e.reduce((e,t)=>e+t.length,0)}function s8(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function a8(e){if(e)return function(e){for(var t in a8.prototype)e[t]=a8.prototype[t];return e}(e)}a8.prototype.on=a8.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},a8.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},a8.prototype.off=a8.prototype.removeListener=a8.prototype.removeAllListeners=a8.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},a8.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},a8.prototype.emitReserved=a8.prototype.emit,a8.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},a8.prototype.hasListeners=function(e){return!!this.listeners(e).length};const c8="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),l8="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function u8(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const d8=l8.setTimeout,h8=l8.clearTimeout;function f8(e,t){t.useNativeTimers?(e.setTimeoutFn=d8.bind(l8),e.clearTimeoutFn=h8.bind(l8)):(e.setTimeoutFn=l8.setTimeout.bind(l8),e.clearTimeoutFn=l8.clearTimeout.bind(l8))}function p8(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function m8(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class g8 extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class y8 extends a8{constructor(e){super(),this.writable=!1,f8(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new g8(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=X4(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class b8 extends y8{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(n8),r=[];for(let i=0;i<n.length;i++){const e=X4(n[i],t);if(r.push(e),"error"===e.type)break}return r})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((e,o)=>{K4(e,!1,e=>{r[o]=e,++i===n&&t(r.join(n8))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=m8()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let v8=!1;try{v8="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Ffe){}const w8=v8;function E8(){}class _8 extends b8{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}let x8=class e extends a8{constructor(e,t,n){super(),this.createRequest=e,f8(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var t;const n=u8(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(Ufe){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(Ufe){}try{r.setRequestHeader("Accept","*/*")}catch(Ufe){}null===(t=this._opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(Ufe){return void this.setTimeoutFn(()=>{this._onError(Ufe)},0)}"undefined"!=typeof document&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=E8,t)try{this._xhr.abort()}catch(Ufe){}"undefined"!=typeof document&&delete e.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};if(x8.requestsCount=0,x8.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",k8);else if("function"==typeof addEventListener){addEventListener("onpagehide"in l8?"pagehide":"unload",k8,!1)}function k8(){for(let e in x8.requests)x8.requests.hasOwnProperty(e)&&x8.requests[e].abort()}const S8=function(){const e=C8({xdomain:!1});return e&&null!==e.responseType}();function C8(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||w8))return new XMLHttpRequest}catch(Ufe){}if(!t)try{return new(l8[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(Ufe){}}const I8="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class A8 extends y8{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=I8?{}:u8(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(Ffe){return this.emitReserved("error",Ffe)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;K4(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(Ufe){}r&&c8(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=m8()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const P8=l8.WebSocket||l8.MozWebSocket;const M8={websocket:class extends A8{createSocket(e,t,n){return I8?new P8(e,t,n):t?new P8(e,t):new P8(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends y8{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(Ffe){return this.emitReserved("error",Ffe)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=function(e,t){i8||(i8=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(o8(n)<1)break;const e=s8(n,1);o=!(128&~e[0]),i=127&e[0],r=i<126?3:126===i?1:2}else if(1===r){if(o8(n)<2)break;const e=s8(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(o8(n)<8)break;const e=s8(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(z4);break}i=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(o8(n)<i)break;const e=s8(n,i);a.enqueue(X4(o?e:i8.decode(e),t)),r=0}if(0===i||i>e){a.enqueue(z4);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=r8();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&c8(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends _8{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=S8&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new x8(C8,this.uri(),e)}}},O8=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,T8=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function R8(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=O8.exec(e||""),o={},s=14;for(;s--;)o[T8[s]]=i[s]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const N8="function"==typeof addEventListener&&"function"==typeof removeEventListener,L8=[];N8&&addEventListener("offline",()=>{L8.forEach(e=>e())},!1);class B8 extends a8{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=R8(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=R8(t.host).host);f8(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let e=n[r].split("=");t[decodeURIComponent(e[0])]=decodeURIComponent(e[1])}return t}(this.opts.query)),N8&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},L8.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&B8.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",B8.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=p8(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,c8(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(B8.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),N8&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=L8.indexOf(this._offlineEventListener);-1!==e&&L8.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}B8.protocol=4;class j8 extends B8{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;B8.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;B8.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,i(),this.emitReserved("upgradeError",n)};function s(){o("transport closed")}function a(){o("socket closed")}function c(e){t&&e.name!==t.name&&i()}const l=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",s),this.off("close",a),this.off("upgrading",c)};t.once("open",r),t.once("error",o),t.once("close",s),this.once("close",a),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let D8=class extends j8{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>M8[e]).filter(e=>!!e)),super(e,n)}};const U8="function"==typeof ArrayBuffer,F8=Object.prototype.toString,$8="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===F8.call(Blob),z8="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===F8.call(File);function H8(e){return U8&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||$8&&e instanceof Blob||z8&&e instanceof File}function q8(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(q8(e[t]))return!0;return!1}if(H8(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return q8(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&q8(e[n]))return!0;return!1}function W8(e){const t=[],n=e.data,r=e;return r.data=K8(n,t),r.attachments=t.length,{packet:r,buffers:t}}function K8(e,t){if(!e)return e;if(H8(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=K8(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=K8(e[r],t));return n}return e}function G8(e,t){return e.data=V8(e.data,t),delete e.attachments,e}function V8(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=V8(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=V8(e[n],t));return e}const Z8=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Y8,J8;(J8=Y8||(Y8={}))[J8.CONNECT=0]="CONNECT",J8[J8.DISCONNECT=1]="DISCONNECT",J8[J8.EVENT=2]="EVENT",J8[J8.ACK=3]="ACK",J8[J8.CONNECT_ERROR=4]="CONNECT_ERROR",J8[J8.BINARY_EVENT=5]="BINARY_EVENT",J8[J8.BINARY_ACK=6]="BINARY_ACK";function Q8(e){return"[object Object]"===Object.prototype.toString.call(e)}class X8 extends a8{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Y8.BINARY_EVENT;n||t.type===Y8.BINARY_ACK?(t.type=n?Y8.EVENT:Y8.ACK,this.reconstructor=new e7(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!H8(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Y8[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Y8.BINARY_EVENT||n.type===Y8.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!X8.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(Ufe){return!1}}static isPayloadValid(e,t){switch(e){case Y8.CONNECT:return Q8(t);case Y8.DISCONNECT:return void 0===t;case Y8.CONNECT_ERROR:return"string"==typeof t||Q8(t);case Y8.EVENT:case Y8.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Z8.indexOf(t[0]));case Y8.ACK:case Y8.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class e7{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=G8(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const t7=Object.freeze(Object.defineProperty({__proto__:null,Decoder:X8,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Y8.EVENT&&e.type!==Y8.ACK||!q8(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Y8.EVENT?Y8.BINARY_EVENT:Y8.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Y8.BINARY_EVENT&&e.type!==Y8.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=W8(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Y8},protocol:5},Symbol.toStringTag,{value:"Module"}));function n7(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const r7=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class i7 extends a8{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[n7(e,"open",this.onopen.bind(this)),n7(e,"packet",this.onpacket.bind(this)),n7(e,"error",this.onerror.bind(this)),n7(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,i;if(r7.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:Y8.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const s=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,a=this.connected&&!(null===(i=this.io.engine)||void 0===i?void 0:i._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Y8.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Y8.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Y8.EVENT:case Y8.BINARY_EVENT:this.onevent(e);break;case Y8.ACK:case Y8.BINARY_ACK:this.onack(e);break;case Y8.DISCONNECT:this.ondisconnect();break;case Y8.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:Y8.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Y8.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function o7(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}o7.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},o7.prototype.reset=function(){this.attempts=0},o7.prototype.setMin=function(e){this.ms=e},o7.prototype.setMax=function(e){this.max=e},o7.prototype.setJitter=function(e){this.jitter=e};class s7 extends a8{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,f8(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new o7({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||t7;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new D8(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=n7(t,"open",function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=n7(t,"error",i);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(n7(e,"ping",this.onping.bind(this)),n7(e,"data",this.ondata.bind(this)),n7(e,"error",this.onerror.bind(this)),n7(e,"close",this.onclose.bind(this)),n7(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(Ufe){this.onclose("parse error",Ufe)}}ondecoded(e){c8(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new i7(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t){if(this.nsps[n].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const a7={};function c7(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=R8(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=a7[i]&&o in a7[i].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new s7(r,t):(a7[i]||(a7[i]=new s7(r,t)),a=a7[i]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}function l7(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}Object.assign(c7,{Manager:s7,Socket:i7,io:c7,connect:c7}),"function"==typeof SuppressedError&&SuppressedError;var u7="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},d7=[],h7=[],f7="undefined"!=typeof Uint8Array?Uint8Array:Array,p7=!1;function m7(){p7=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)d7[t]=e[t],h7[e.charCodeAt(t)]=t;h7["-".charCodeAt(0)]=62,h7["_".charCodeAt(0)]=63}function g7(e,t,n){for(var r,i,o=[],s=t;s<n;s+=3)r=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(d7[(i=r)>>18&63]+d7[i>>12&63]+d7[i>>6&63]+d7[63&i]);return o.join("")}function y7(e){var t;p7||m7();for(var n=e.length,r=n%3,i="",o=[],s=16383,a=0,c=n-r;a<c;a+=s)o.push(g7(e,a,a+s>c?c:a+s));return 1===r?(t=e[n-1],i+=d7[t>>2],i+=d7[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=d7[t>>10],i+=d7[t>>4&63],i+=d7[t<<2&63],i+="="),o.push(i),o.join("")}function b7(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+e[t+d],d+=h,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+d],d+=h,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)}function v7(e,t,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,d=u>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;e[n+f]=255&s,f+=p,s/=256,l-=8);e[n+f-p]|=128*m}var w7={}.toString,E7=Array.isArray||function(e){return"[object Array]"==w7.call(e)};S7.TYPED_ARRAY_SUPPORT=void 0===u7.TYPED_ARRAY_SUPPORT||u7.TYPED_ARRAY_SUPPORT;var _7=x7();function x7(){return S7.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k7(e,t){if(x7()<t)throw new RangeError("Invalid typed array length");return S7.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=S7.prototype:(null===e&&(e=new S7(t)),e.length=t),e}function S7(e,t,n){if(!(S7.TYPED_ARRAY_SUPPORT||this instanceof S7))return new S7(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return A7(this,e)}return C7(this,e,t,n)}function C7(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),S7.TYPED_ARRAY_SUPPORT?(e=t).__proto__=S7.prototype:e=P7(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!S7.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|T7(t,n),i=(e=k7(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(O7(t)){var n=0|M7(t.length);return 0===(e=k7(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?k7(e,0):P7(e,t);if("Buffer"===t.type&&E7(t.data))return P7(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function I7(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function A7(e,t){if(I7(t),e=k7(e,t<0?0:0|M7(t)),!S7.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function P7(e,t){var n=t.length<0?0:0|M7(t.length);e=k7(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function M7(e){if(e>=x7())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+x7().toString(16)+" bytes");return 0|e}function O7(e){return!(null==e||!e._isBuffer)}function T7(e,t){if(O7(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return o9(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return s9(e).length;default:if(r)return o9(e).length;t=(""+t).toLowerCase(),r=!0}}function R7(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return V7(this,t,n);case"utf8":case"utf-8":return q7(this,t,n);case"ascii":return K7(this,t,n);case"latin1":case"binary":return G7(this,t,n);case"base64":return H7(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z7(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function N7(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function L7(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=S7.from(t,r)),O7(t))return 0===t.length?-1:B7(e,t,n,r,i);if("number"==typeof t)return t&=255,S7.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):B7(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function B7(e,t,n,r,i){var o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var u=-1;for(o=n;o<a;o++)if(l(e,o)===l(t,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===c)return u*s}else-1!==u&&(o-=o-u),u=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var d=!0,h=0;h<c;h++)if(l(e,o+h)!==l(t,h)){d=!1;break}if(d)return o}return-1}function j7(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function D7(e,t,n,r){return a9(o9(t,e.length-n),e,n,r)}function U7(e,t,n,r){return a9(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function F7(e,t,n,r){return U7(e,t,n,r)}function $7(e,t,n,r){return a9(s9(t),e,n,r)}function z7(e,t,n,r){return a9(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function H7(e,t,n){return 0===t&&n===e.length?y7(e):y7(e.slice(t,n))}function q7(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,c,l=e[i],u=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&l)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=d}return function(e){var t=e.length;if(t<=W7)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=W7));return n}(r)}S7.poolSize=8192,S7._augment=function(e){return e.__proto__=S7.prototype,e},S7.from=function(e,t,n){return C7(null,e,t,n)},S7.TYPED_ARRAY_SUPPORT&&(S7.prototype.__proto__=Uint8Array.prototype,S7.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&S7[Symbol.species]),S7.alloc=function(e,t,n){return r=null,o=t,s=n,I7(i=e),i<=0?k7(r,i):void 0!==o?"string"==typeof s?k7(r,i).fill(o,s):k7(r,i).fill(o):k7(r,i);var r,i,o,s},S7.allocUnsafe=function(e){return A7(null,e)},S7.allocUnsafeSlow=function(e){return A7(null,e)},S7.isBuffer=c9,S7.compare=function(e,t){if(!O7(e)||!O7(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},S7.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},S7.concat=function(e,t){if(!E7(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return S7.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=S7.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!O7(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},S7.byteLength=T7,S7.prototype._isBuffer=!0,S7.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)N7(this,t,t+1);return this},S7.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)N7(this,t,t+3),N7(this,t+1,t+2);return this},S7.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)N7(this,t,t+7),N7(this,t+1,t+6),N7(this,t+2,t+5),N7(this,t+3,t+4);return this},S7.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?q7(this,0,e):R7.apply(this,arguments)},S7.prototype.equals=function(e){if(!O7(e))throw new TypeError("Argument must be a Buffer");return this===e||0===S7.compare(this,e)},S7.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},S7.prototype.compare=function(e,t,n,r,i){if(!O7(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(r,i),l=e.slice(t,n),u=0;u<a;++u)if(c[u]!==l[u]){o=c[u],s=l[u];break}return o<s?-1:s<o?1:0},S7.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},S7.prototype.indexOf=function(e,t,n){return L7(this,e,t,n,!0)},S7.prototype.lastIndexOf=function(e,t,n){return L7(this,e,t,n,!1)},S7.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return j7(this,e,t,n);case"utf8":case"utf-8":return D7(this,e,t,n);case"ascii":return U7(this,e,t,n);case"latin1":case"binary":return F7(this,e,t,n);case"base64":return $7(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z7(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},S7.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var W7=4096;function K7(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function G7(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function V7(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=i9(e[o]);return i}function Z7(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Y7(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function J7(e,t,n,r,i,o){if(!O7(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function Q7(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function X7(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function e9(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function t9(e,t,n,r,i){return i||e9(e,0,n,4),v7(e,t,n,r,23,4),n+4}function n9(e,t,n,r,i){return i||e9(e,0,n,8),v7(e,t,n,r,52,8),n+8}S7.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),S7.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=S7.prototype;else{var i=t-e;n=new S7(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},S7.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Y7(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},S7.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Y7(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},S7.prototype.readUInt8=function(e,t){return t||Y7(e,1,this.length),this[e]},S7.prototype.readUInt16LE=function(e,t){return t||Y7(e,2,this.length),this[e]|this[e+1]<<8},S7.prototype.readUInt16BE=function(e,t){return t||Y7(e,2,this.length),this[e]<<8|this[e+1]},S7.prototype.readUInt32LE=function(e,t){return t||Y7(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},S7.prototype.readUInt32BE=function(e,t){return t||Y7(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},S7.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Y7(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},S7.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Y7(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},S7.prototype.readInt8=function(e,t){return t||Y7(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},S7.prototype.readInt16LE=function(e,t){t||Y7(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},S7.prototype.readInt16BE=function(e,t){t||Y7(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},S7.prototype.readInt32LE=function(e,t){return t||Y7(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},S7.prototype.readInt32BE=function(e,t){return t||Y7(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},S7.prototype.readFloatLE=function(e,t){return t||Y7(e,4,this.length),b7(this,e,!0,23,4)},S7.prototype.readFloatBE=function(e,t){return t||Y7(e,4,this.length),b7(this,e,!1,23,4)},S7.prototype.readDoubleLE=function(e,t){return t||Y7(e,8,this.length),b7(this,e,!0,52,8)},S7.prototype.readDoubleBE=function(e,t){return t||Y7(e,8,this.length),b7(this,e,!1,52,8)},S7.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||J7(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},S7.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||J7(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},S7.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,1,255,0),S7.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},S7.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,2,65535,0),S7.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Q7(this,e,t,!0),t+2},S7.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,2,65535,0),S7.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Q7(this,e,t,!1),t+2},S7.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,4,4294967295,0),S7.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):X7(this,e,t,!0),t+4},S7.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,4,4294967295,0),S7.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):X7(this,e,t,!1),t+4},S7.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);J7(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},S7.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);J7(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},S7.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,1,127,-128),S7.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},S7.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,2,32767,-32768),S7.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Q7(this,e,t,!0),t+2},S7.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,2,32767,-32768),S7.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Q7(this,e,t,!1),t+2},S7.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,4,2147483647,-2147483648),S7.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):X7(this,e,t,!0),t+4},S7.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),S7.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):X7(this,e,t,!1),t+4},S7.prototype.writeFloatLE=function(e,t,n){return t9(this,e,t,!0,n)},S7.prototype.writeFloatBE=function(e,t,n){return t9(this,e,t,!1,n)},S7.prototype.writeDoubleLE=function(e,t,n){return n9(this,e,t,!0,n)},S7.prototype.writeDoubleBE=function(e,t,n){return n9(this,e,t,!1,n)},S7.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!S7.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},S7.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!S7.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=O7(e)?e:o9(new S7(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var r9=/[^+\/0-9A-Za-z-_]/g;function i9(e){return e<16?"0"+e.toString(16):e.toString(16)}function o9(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function s9(e){return function(e){var t,n,r,i,o,s;p7||m7();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new f7(3*a/4-o),r=o>0?a-4:a;var c=0;for(t=0,n=0;t<r;t+=4,n+=3)i=h7[e.charCodeAt(t)]<<18|h7[e.charCodeAt(t+1)]<<12|h7[e.charCodeAt(t+2)]<<6|h7[e.charCodeAt(t+3)],s[c++]=i>>16&255,s[c++]=i>>8&255,s[c++]=255&i;return 2===o?(i=h7[e.charCodeAt(t)]<<2|h7[e.charCodeAt(t+1)]>>4,s[c++]=255&i):1===o&&(i=h7[e.charCodeAt(t)]<<10|h7[e.charCodeAt(t+1)]<<4|h7[e.charCodeAt(t+2)]>>2,s[c++]=i>>8&255,s[c++]=255&i),s}(function(e){if((e=(t=e,t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(r9,"")).length<2)return"";for(var t;e.length%4!=0;)e+="=";return e}(e))}function a9(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function c9(e){return null!=e&&(!!e._isBuffer||l9(e)||"function"==typeof(t=e).readFloatLE&&"function"==typeof t.slice&&l9(t.slice(0,0)));var t}function l9(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var u9=Object.freeze({__proto__:null,Buffer:S7,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),S7.alloc(+e)},isBuffer:c9,kMaxLength:_7}),d9="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};function h9(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function f9(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var p9={},m9={},g9={};function y9(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function b9(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function v9(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function w9(e,...t){if(!v9(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function E9(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("hash must be wrapped by utils.wrapConstructor");y9(e.outputLen),y9(e.blockLen)}function _9(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function x9(e,t){w9(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(g9,"__esModule",{value:!0}),g9.isBytes=v9,g9.number=y9,g9.bool=b9,g9.bytes=w9,g9.hash=E9,g9.exists=_9,g9.output=x9;const k9={number:y9,bool:b9,bytes:w9,hash:E9,exists:_9,output:x9};g9.default=k9,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=e.createView=e.u32=e.u16=e.u8=void 0,e.bytesToHex=r,e.hexToBytes=s,e.hexToNumber=a,e.bytesToNumberBE=function(e){return a(r(e))},e.numberToBytesBE=function(e,t){return s(e.toString(16).padStart(2*t,"0"))},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);const t=Date.now()-i;t>=0&&t<n||(await(0,e.nextTick)(),i+=t)}},e.utf8ToBytes=c,e.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},e.toBytes=function(e){if("string"==typeof e)e=c(e);else{if(!(0,t.isBytes)(e))throw new Error("Uint8Array expected, got "+typeof e);e=u(e)}return e},e.concatBytes=function(...e){let n=0;for(let i=0;i<e.length;i++){const r=e[i];(0,t.bytes)(r),n+=r.length}const r=new Uint8Array(n);for(let t=0,i=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.length}return r},e.checkOpts=function(e,t){if(null==t||"object"!=typeof t)throw new Error("options must be defined");return Object.assign(e,t)},e.equalBytes=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},e.setBigUint64=l,e.u64Lengths=function(t,n){const r=new Uint8Array(16),i=(0,e.createView)(r);return l(i,0,BigInt(n?n.length:0),!0),l(i,8,BigInt(t.length),!0),r},e.isAligned32=function(e){return e.byteOffset%4==0},e.copyBytes=u,e.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)};const t=g9;if(e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),e.u16=e=>new Uint16Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/2)),e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function r(e){(0,t.bytes)(e);let r="";for(let t=0;t<e.length;t++)r+=n[e[t]];return r}const i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(e){return e>=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}function s(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const t=o(e.charCodeAt(s)),n=o(e.charCodeAt(s+1));if(void 0===t||void 0===n){const t=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+s)}r[i]=16*t+n}return r}function a(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function c(e){if("string"!=typeof e)throw new Error("string expected, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function l(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)}function u(e){return Uint8Array.from(e)}e.nextTick=async()=>{},e.Hash=class{},e.wrapCipher=(e,t)=>(Object.assign(t,e),t)}(m9);var S9={},C9={};Object.defineProperty(C9,"__esModule",{value:!0}),C9.AEAD_TAG_LENGTH=C9.XCHACHA20_NONCE_LENGTH=C9.CURVE25519_PUBLIC_KEY_SIZE=C9.ETH_PUBLIC_KEY_SIZE=C9.UNCOMPRESSED_PUBLIC_KEY_SIZE=C9.COMPRESSED_PUBLIC_KEY_SIZE=C9.SECRET_KEY_LENGTH=void 0,C9.SECRET_KEY_LENGTH=32,C9.COMPRESSED_PUBLIC_KEY_SIZE=33,C9.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,C9.ETH_PUBLIC_KEY_SIZE=64,C9.CURVE25519_PUBLIC_KEY_SIZE=32,C9.XCHACHA20_NONCE_LENGTH=24,C9.AEAD_TAG_LENGTH=16,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ephemeralKeySize=e.symmetricNonceLength=e.symmetricAlgorithm=e.isHkdfKeyCompressed=e.isEphemeralKeyCompressed=e.ellipticCurve=e.ECIES_CONFIG=void 0;var t=C9;e.ECIES_CONFIG=new function(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16},e.ellipticCurve=function(){return e.ECIES_CONFIG.ellipticCurve},e.isEphemeralKeyCompressed=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed},e.isHkdfKeyCompressed=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed},e.symmetricAlgorithm=function(){return e.ECIES_CONFIG.symmetricAlgorithm},e.symmetricNonceLength=function(){return e.ECIES_CONFIG.symmetricNonceLength},e.ephemeralKeySize=function(){var n={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?t.COMPRESSED_PUBLIC_KEY_SIZE:t.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:t.CURVE25519_PUBLIC_KEY_SIZE,ed25519:t.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in n)return n[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")}}(S9);var I9={},A9={},P9={},M9={},O9={},T9={};Object.defineProperty(T9,"__esModule",{value:!0}),T9.crypto=void 0,T9.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=i,e.getWebcryptoSubtle=o,e.managedNonce=function(e){return(0,n.number)(e.nonceLength),(t,...n)=>({encrypt(o,...s){const{nonceLength:a}=e,c=i(a),l=e(t,c,...n).encrypt(o,...s),u=(0,r.concatBytes)(c,l);return l.fill(0),u},decrypt(r,...i){const{nonceLength:o}=e,s=r.subarray(0,o),a=r.subarray(o);return e(t,s,...n).decrypt(a,...i)}})};const t=T9,n=g9,r=m9;function i(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));if(t.crypto&&"function"==typeof t.crypto.randomBytes)return t.crypto.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}function o(){if(t.crypto&&"object"==typeof t.crypto.subtle&&null!=t.crypto.subtle)return t.crypto.subtle;throw new Error("crypto.subtle must be defined")}e.utils={async encrypt(e,t,n,r){const i=o(),s=await i.importKey("raw",e,t,!0,["encrypt"]),a=await i.encrypt(n,s,r);return new Uint8Array(a)},async decrypt(e,t,n,r){const i=o(),s=await i.importKey("raw",e,t,!0,["decrypt"]),a=await i.decrypt(n,s,r);return new Uint8Array(a)}};const s="AES-CBC",a="AES-CTR",c="AES-GCM";function l(t){return(r,i,o)=>{(0,n.bytes)(r),(0,n.bytes)(i);const l={name:t,length:8*r.length},u=function(e,t,n){if(e===s)return{name:s,iv:t};if(e===a)return{name:a,counter:t,length:64};if(e===c)return n?{name:c,iv:t,additionalData:n}:{name:c,iv:t};throw new Error("unknown aes block mode")}(t,i,o);return{encrypt:t=>((0,n.bytes)(t),e.utils.encrypt(r,l,u,t)),decrypt:t=>((0,n.bytes)(t),e.utils.decrypt(r,l,u,t))}}}e.cbc=l(s),e.ctr=l(a),e.gcm=l(c)}(O9);var R9={},N9={},L9={},B9={};function j9(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function D9(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function U9(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function F9(e,...t){if(!U9(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function $9(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");j9(e.outputLen),j9(e.blockLen)}function z9(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function H9(e,t){F9(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(B9,"__esModule",{value:!0}),B9.isBytes=U9,B9.number=j9,B9.bool=D9,B9.bytes=F9,B9.hash=$9,B9.exists=z9,B9.output=H9;const q9={number:j9,bool:D9,bytes:F9,hash:$9,exists:z9,output:H9};B9.default=q9;var W9={},K9={};Object.defineProperty(K9,"__esModule",{value:!0}),K9.crypto=void 0,K9.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=void 0,e.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name},e.byteSwap32=function(t){for(let n=0;n<t.length;n++)t[n]=(0,e.byteSwap)(t[n])},e.bytesToHex=function(e){(0,n.bytes)(e);let t="";for(let n=0;n<e.length;n++)t+=r[e[n]];return t},e.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const t=o(e.charCodeAt(s)),n=o(e.charCodeAt(s+1));if(void 0===t||void 0===n){const t=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+s)}r[i]=16*t+n}return r},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);const t=Date.now()-i;t>=0&&t<n||(await(0,e.nextTick)(),i+=t)}},e.utf8ToBytes=s,e.toBytes=a,e.concatBytes=function(...e){let t=0;for(let i=0;i<e.length;i++){const r=e[i];(0,n.bytes)(r),t+=r.length}const r=new Uint8Array(t);for(let n=0,i=0;n<e.length;n++){const t=e[n];r.set(t,i),i+=t.length}return r},e.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!==c.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)},e.wrapConstructor=function(e){const t=t=>e().update(a(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(a(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(a(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));if(t.crypto&&"function"==typeof t.crypto.randomBytes)return t.crypto.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")};const t=K9,n=B9;e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),e.rotr=(e,t)=>e<<32-t|e>>>t,e.rotl=(e,t)=>e<<t|e>>>32-t>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],e.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,e.byteSwapIfBE=e.isLE?e=>e:t=>(0,e.byteSwap)(t);const r=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(e){return e>=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}function s(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function a(e){return"string"==typeof e&&(e=s(e)),(0,n.bytes)(e),e}e.nextTick=async()=>{},e.Hash=class{clone(){return this._cloneInto()}};const c={}.toString}(W9),Object.defineProperty(L9,"__esModule",{value:!0}),L9.HashMD=L9.Maj=L9.Chi=void 0;const G9=B9,V9=W9;L9.Chi=(e,t,n)=>e&t^~e&n,L9.Maj=(e,t,n)=>e&t^e&n^t&n,L9.HashMD=class extends V9.Hash{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,V9.createView)(this.buffer)}update(e){(0,G9.exists)(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=(0,V9.toBytes)(e)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0);else{const t=(0,V9.createView)(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,G9.exists)(this),(0,G9.output)(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let u=o;u<r;u++)t[u]=0;!function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=(0,V9.createView)(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<c;u++)s.setUint32(4*u,l[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.length=r,e.pos=s,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(n),e}};var Z9={};Object.defineProperty(Z9,"__esModule",{value:!0}),Z9.add5L=Z9.add5H=Z9.add4H=Z9.add4L=Z9.add3H=Z9.add3L=Z9.rotlBL=Z9.rotlBH=Z9.rotlSL=Z9.rotlSH=Z9.rotr32L=Z9.rotr32H=Z9.rotrBL=Z9.rotrBH=Z9.rotrSL=Z9.rotrSH=Z9.shrSL=Z9.shrSH=Z9.toBig=void 0,Z9.fromBig=Q9,Z9.split=X9,Z9.add=fee;const Y9=BigInt(2**32-1),J9=BigInt(32);function Q9(e,t=!1){return t?{h:Number(e&Y9),l:Number(e>>J9&Y9)}:{h:0|Number(e>>J9&Y9),l:0|Number(e&Y9)}}function X9(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=Q9(e[i],t);[n[i],r[i]]=[o,s]}return[n,r]}const eee=(e,t)=>BigInt(e>>>0)<<J9|BigInt(t>>>0);Z9.toBig=eee;const tee=(e,t,n)=>e>>>n;Z9.shrSH=tee;const nee=(e,t,n)=>e<<32-n|t>>>n;Z9.shrSL=nee;const ree=(e,t,n)=>e>>>n|t<<32-n;Z9.rotrSH=ree;const iee=(e,t,n)=>e<<32-n|t>>>n;Z9.rotrSL=iee;const oee=(e,t,n)=>e<<64-n|t>>>n-32;Z9.rotrBH=oee;const see=(e,t,n)=>e>>>n-32|t<<64-n;Z9.rotrBL=see;const aee=(e,t)=>t;Z9.rotr32H=aee;const cee=(e,t)=>e;Z9.rotr32L=cee;const lee=(e,t,n)=>e<<n|t>>>32-n;Z9.rotlSH=lee;const uee=(e,t,n)=>t<<n|e>>>32-n;Z9.rotlSL=uee;const dee=(e,t,n)=>t<<n-32|e>>>64-n;Z9.rotlBH=dee;const hee=(e,t,n)=>e<<n-32|t>>>64-n;function fee(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}}Z9.rotlBL=hee;const pee=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);Z9.add3L=pee;const mee=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;Z9.add3H=mee;const gee=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);Z9.add4L=gee;const yee=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;Z9.add4H=yee;const bee=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);Z9.add5L=bee;const vee=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0;Z9.add5H=vee;const wee={fromBig:Q9,split:X9,toBig:eee,shrSH:tee,shrSL:nee,rotrSH:ree,rotrSL:iee,rotrBH:oee,rotrBL:see,rotr32H:aee,rotr32L:cee,rotlSH:lee,rotlSL:uee,rotlBH:dee,rotlBL:hee,add:fee,add3L:pee,add3H:mee,add4L:gee,add4H:yee,add5H:vee,add5L:bee};Z9.default=wee,Object.defineProperty(N9,"__esModule",{value:!0}),N9.sha384=N9.sha512_256=N9.sha512_224=N9.sha512=N9.SHA384=N9.SHA512_256=N9.SHA512_224=N9.SHA512=void 0;const Eee=L9,_ee=Z9,xee=W9,[kee,See]=_ee.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Cee=new Uint32Array(80),Iee=new Uint32Array(80);class Aee extends Eee.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:l,Fh:u,Fl:d,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[e,t,n,r,i,o,s,a,c,l,u,d,h,f,p,m]}set(e,t,n,r,i,o,s,a,c,l,u,d,h,f,p,m){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|d,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(e,t){for(let b=0;b<16;b++,t+=4)Cee[b]=e.getUint32(t),Iee[b]=e.getUint32(t+=4);for(let b=16;b<80;b++){const e=0|Cee[b-15],t=0|Iee[b-15],n=_ee.default.rotrSH(e,t,1)^_ee.default.rotrSH(e,t,8)^_ee.default.shrSH(e,t,7),r=_ee.default.rotrSL(e,t,1)^_ee.default.rotrSL(e,t,8)^_ee.default.shrSL(e,t,7),i=0|Cee[b-2],o=0|Iee[b-2],s=_ee.default.rotrSH(i,o,19)^_ee.default.rotrBH(i,o,61)^_ee.default.shrSH(i,o,6),a=_ee.default.rotrSL(i,o,19)^_ee.default.rotrBL(i,o,61)^_ee.default.shrSL(i,o,6),c=_ee.default.add4L(r,a,Iee[b-7],Iee[b-16]),l=_ee.default.add4H(c,n,s,Cee[b-7],Cee[b-16]);Cee[b]=0|l,Iee[b]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:l,Eh:u,El:d,Fh:h,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let b=0;b<80;b++){const e=_ee.default.rotrSH(u,d,14)^_ee.default.rotrSH(u,d,18)^_ee.default.rotrBH(u,d,41),t=_ee.default.rotrSL(u,d,14)^_ee.default.rotrSL(u,d,18)^_ee.default.rotrBL(u,d,41),v=u&h^~u&p,w=d&f^~d&m,E=_ee.default.add5L(y,t,w,See[b],Iee[b]),_=_ee.default.add5H(E,g,e,v,kee[b],Cee[b]),x=0|E,k=_ee.default.rotrSH(n,r,28)^_ee.default.rotrBH(n,r,34)^_ee.default.rotrBH(n,r,39),S=_ee.default.rotrSL(n,r,28)^_ee.default.rotrBL(n,r,34)^_ee.default.rotrBL(n,r,39),C=n&i^n&s^i&s,I=r&o^r&a^o&a;g=0|p,y=0|m,p=0|h,m=0|f,h=0|u,f=0|d,({h:u,l:d}=_ee.default.add(0|c,0|l,0|_,0|x)),c=0|s,l=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const A=_ee.default.add3L(x,S,I);n=_ee.default.add3H(A,_,k,C),r=0|A}({h:n,l:r}=_ee.default.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=_ee.default.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=_ee.default.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:l}=_ee.default.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:d}=_ee.default.add(0|this.Eh,0|this.El,0|u,0|d)),({h:h,l:f}=_ee.default.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:m}=_ee.default.add(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=_ee.default.add(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(n,r,i,o,s,a,c,l,u,d,h,f,p,m,g,y)}roundClean(){Cee.fill(0),Iee.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}N9.SHA512=Aee;class Pee extends Aee{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}N9.SHA512_224=Pee;class Mee extends Aee{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}N9.SHA512_256=Mee;class Oee extends Aee{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}N9.SHA384=Oee,N9.sha512=(0,xee.wrapConstructor)(()=>new Aee),N9.sha512_224=(0,xee.wrapConstructor)(()=>new Pee),N9.sha512_256=(0,xee.wrapConstructor)(()=>new Mee),N9.sha384=(0,xee.wrapConstructor)(()=>new Oee);var Tee={},Ree={},Nee={},Lee={};Object.defineProperty(Lee,"__esModule",{value:!0}),Lee.notImplemented=Lee.bitMask=void 0,Lee.isBytes=Uee,Lee.abytes=Fee,Lee.abool=function(e,t){if("boolean"!=typeof t)throw new Error(`${e} must be valid boolean, got "${t}".`)},Lee.bytesToHex=zee,Lee.numberToHexUnpadded=Hee,Lee.hexToNumber=qee,Lee.hexToBytes=Gee,Lee.bytesToNumberBE=function(e){return qee(zee(e))},Lee.bytesToNumberLE=function(e){return Fee(e),qee(zee(Uint8Array.from(e).reverse()))},Lee.numberToBytesBE=Vee,Lee.numberToBytesLE=function(e,t){return Vee(e,t).reverse()},Lee.numberToVarBytesBE=function(e){return Gee(Hee(e))},Lee.ensureBytes=function(e,t,n){let r;if("string"==typeof t)try{r=Gee(t)}catch(o){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${o}`)}else{if(!Uee(t))throw new Error(`${e} must be hex string or Uint8Array`);r=Uint8Array.from(t)}const i=r.length;if("number"==typeof n&&i!==n)throw new Error(`${e} expected ${n} bytes, got ${i}`);return r},Lee.concatBytes=Zee,Lee.equalBytes=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},Lee.utf8ToBytes=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))},Lee.inRange=Jee,Lee.aInRange=function(e,t,n,r){if(!Jee(t,n,r))throw new Error(`expected valid ${e}: ${n} <= n < ${r}, got ${typeof t} ${t}`)},Lee.bitLen=function(e){let t;for(t=0;e>Bee;e>>=jee,t+=1);return t},Lee.bitGet=function(e,t){return e>>BigInt(t)&jee},Lee.bitSet=function(e,t,n){return e|(n?jee:Bee)<<BigInt(t)},Lee.createHmacDrbg=function(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=Qee(e),i=Qee(e),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...e)=>n(i,r,...e),c=(e=Qee())=>{i=a(Xee([0]),e),r=a(),0!==e.length&&(i=a(Xee([1]),e),r=a())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e<t;){r=a();const t=r.slice();n.push(t),e+=r.length}return Zee(...n)};return(e,t)=>{let n;for(s(),c(e);!(n=t(l()));)c();return s(),n}},Lee.validateObject=function(e,t,n={}){const r=(t,n,r)=>{const i=ete[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=e[t];if(!(r&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${n}`)};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return e},Lee.memoized=function(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(void 0!==i)return i;const o=e(n,...r);return t.set(n,o),o}};const Bee=BigInt(0),jee=BigInt(1),Dee=BigInt(2);function Uee(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function Fee(e){if(!Uee(e))throw new Error("Uint8Array expected")}const $ee=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function zee(e){Fee(e);let t="";for(let n=0;n<e.length;n++)t+=$ee[e[n]];return t}function Hee(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function qee(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}const Wee={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Kee(e){return e>=Wee._0&&e<=Wee._9?e-Wee._0:e>=Wee._A&&e<=Wee._F?e-(Wee._A-10):e>=Wee._a&&e<=Wee._f?e-(Wee._a-10):void 0}function Gee(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const t=Kee(e.charCodeAt(o)),n=Kee(e.charCodeAt(o+1));if(void 0===t||void 0===n){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}r[i]=16*t+n}return r}function Vee(e,t){return Gee(e.toString(16).padStart(2*t,"0"))}function Zee(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];Fee(n),t+=n.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const t=e[r];n.set(t,i),i+=t.length}return n}const Yee=e=>"bigint"==typeof e&&Bee<=e;function Jee(e,t,n){return Yee(e)&&Yee(t)&&Yee(n)&&t<=e&&e<n}Lee.bitMask=e=>(Dee<<BigInt(e-1))-jee;const Qee=e=>new Uint8Array(e),Xee=e=>Uint8Array.from(e),ete={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||Uee(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};Lee.notImplemented=()=>{throw new Error("not implemented")},Object.defineProperty(Nee,"__esModule",{value:!0}),Nee.isNegativeLE=void 0,Nee.mod=lte,Nee.pow=ute,Nee.pow2=function(e,t,n){let r=e;for(;t-- >nte;)r*=r,r%=n;return r},Nee.invert=dte,Nee.tonelliShanks=hte,Nee.FpSqrt=fte,Nee.validateField=function(e){const t=pte.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,tte.validateObject)(e,t)},Nee.FpPow=mte,Nee.FpInvertBatch=gte,Nee.FpDiv=function(e,t,n){return e.mul(t,"bigint"==typeof n?dte(n,e.ORDER):e.inv(n))},Nee.FpLegendre=yte,Nee.FpIsSquare=function(e){const t=yte(e.ORDER);return n=>{const r=t(e,n);return e.eql(r,e.ZERO)||e.eql(r,e.ONE)}},Nee.nLength=bte,Nee.Field=function(e,t,n=!1,r={}){if(e<=nte)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=bte(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=fte(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:(0,tte.bitMask)(i),ZERO:nte,ONE:rte,create:t=>lte(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return nte<=t&&t<e},is0:e=>e===nte,isOdd:e=>(e&rte)===rte,neg:t=>lte(-t,e),eql:(e,t)=>e===t,sqr:t=>lte(t*t,e),add:(t,n)=>lte(t+n,e),sub:(t,n)=>lte(t-n,e),mul:(t,n)=>lte(t*n,e),pow:(e,t)=>mte(a,e,t),div:(t,n)=>lte(t*dte(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>dte(t,e),sqrt:r.sqrt||(e=>s(a,e)),invertBatch:e=>gte(a,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?(0,tte.numberToBytesLE)(e,o):(0,tte.numberToBytesBE)(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return n?(0,tte.bytesToNumberLE)(e):(0,tte.bytesToNumberBE)(e)}});return Object.freeze(a)},Nee.FpSqrtOdd=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?n:e.neg(n)},Nee.FpSqrtEven=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?e.neg(n):n},Nee.hashToPrivateScalar=function(e,t,n=!1){const r=(e=(0,tte.ensureBytes)("privateHash",e)).length,i=bte(t).nByteLength+8;if(i<24||r<i||r>1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${r}`);return lte(n?(0,tte.bytesToNumberLE)(e):(0,tte.bytesToNumberBE)(e),t-rte)+rte},Nee.getFieldBytesLength=vte,Nee.getMinHashLength=wte,Nee.mapHashToField=function(e,t,n=!1){const r=e.length,i=vte(t),o=wte(t);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=lte(n?(0,tte.bytesToNumberBE)(e):(0,tte.bytesToNumberLE)(e),t-rte)+rte;return n?(0,tte.numberToBytesLE)(s,i):(0,tte.numberToBytesBE)(s,i)};const tte=Lee,nte=BigInt(0),rte=BigInt(1),ite=BigInt(2),ote=BigInt(3),ste=BigInt(4),ate=BigInt(5),cte=BigInt(8);function lte(e,t){const n=e%t;return n>=nte?n:t+n}function ute(e,t,n){if(n<=nte||t<nte)throw new Error("Expected power/modulo > 0");if(n===rte)return nte;let r=rte;for(;t>nte;)t&rte&&(r=r*e%n),e=e*e%n,t>>=rte;return r}function dte(e,t){if(e===nte||t<=nte)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=lte(e,t),r=t,i=nte,o=rte;for(;n!==nte;){const e=r%n,t=i-o*(r/n);r=n,n=e,i=o,o=t}if(r!==rte)throw new Error("invert: does not exist");return lte(i,t)}function hte(e){const t=(e-rte)/ite;let n,r,i;for(n=e-rte,r=0;n%ite===nte;n/=ite,r++);for(i=ite;i<e&&ute(i,t,e)!==e-rte;i++);if(1===r){const t=(e+rte)/ste;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}const o=(n+rte)/ite;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=r,c=e.pow(e.mul(e.ONE,i),n),l=e.pow(s,o),u=e.pow(s,n);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(u);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const n=e.pow(c,rte<<BigInt(a-t-1));c=e.sqr(n),l=e.mul(l,n),u=e.mul(u,c),a=t}return l}}function fte(e){if(e%ste===ote){const t=(e+rte)/ste;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%cte===ate){const t=(e-ate)/cte;return function(e,n){const r=e.mul(n,ite),i=e.pow(r,t),o=e.mul(n,i),s=e.mul(e.mul(o,ite),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),n))throw new Error("Cannot find square root");return a}}return hte(e)}BigInt(9),BigInt(16),Nee.isNegativeLE=(e,t)=>(lte(e,t)&rte)===rte;const pte=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function mte(e,t,n){if(n<nte)throw new Error("Expected power > 0");if(n===nte)return e.ONE;if(n===rte)return t;let r=e.ONE,i=t;for(;n>nte;)n&rte&&(r=e.mul(r,i)),i=e.sqr(i),n>>=rte;return r}function gte(e,t){const n=new Array(t.length),r=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),i=e.inv(r);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),i),n}function yte(e){const t=(e-rte)/ite;return(e,n)=>e.pow(n,t)}function bte(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function vte(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function wte(e){const t=vte(e);return t+Math.ceil(t/2)}Object.defineProperty(Ree,"__esModule",{value:!0}),Ree.wNAF=function(e,t){const n=(e,t)=>{const n=t.negate();return e?n:t},r=e=>{if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error(`Wrong window size=${e}, should be [1..${t}]`)},i=e=>(r(e),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;for(;n>xte;)n&kte&&(r=r.add(i)),i=i.double(),n>>=kte;return r},precomputeWindow(e,t){const{windows:n,windowSize:r}=i(t),o=[];let s=e,a=s;for(let i=0;i<n;i++){a=s,o.push(a);for(let e=1;e<r;e++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(t,r,o){const{windows:s,windowSize:a}=i(t);let c=e.ZERO,l=e.BASE;const u=BigInt(2**t-1),d=2**t,h=BigInt(t);for(let e=0;e<s;e++){const t=e*a;let i=Number(o&u);o>>=h,i>a&&(i-=d,o+=kte);const s=t,f=t+Math.abs(i)-1,p=e%2!=0,m=i<0;0===i?l=l.add(n(p,r[s])):c=c.add(n(m,r[f]))}return{p:c,f:l}},wNAFCached(e,t,n){const r=Cte.get(e)||1;let i=Ste.get(e);return i||(i=this.precomputeWindow(e,r),1!==r&&Ste.set(e,n(i))),this.wNAF(r,i,t)},setWindowSize(e,t){r(t),Cte.set(e,t),Ste.delete(e)}}},Ree.pippenger=function(e,t,n,r){if(!Array.isArray(n)||!Array.isArray(r)||r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");r.forEach((e,n)=>{if(!t.isValid(e))throw new Error(`wrong scalar at index ${n}`)}),n.forEach((t,n)=>{if(!(t instanceof e))throw new Error(`wrong point at index ${n}`)});const i=(0,_te.bitLen)(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,s=(1<<o)-1,a=new Array(s+1).fill(e.ZERO),c=Math.floor((t.BITS-1)/o)*o;let l=e.ZERO;for(let u=c;u>=0;u-=o){a.fill(e.ZERO);for(let e=0;e<r.length;e++){const t=r[e],i=Number(t>>BigInt(u)&BigInt(s));a[i]=a[i].add(n[e])}let t=e.ZERO;for(let n=a.length-1,r=e.ZERO;n>0;n--)r=r.add(a[n]),t=t.add(r);if(l=l.add(t),0!==u)for(let e=0;e<o;e++)l=l.double()}return l},Ree.validateBasic=function(e){return(0,Ete.validateField)(e.Fp),(0,_te.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,Ete.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})};const Ete=Nee,_te=Lee,xte=BigInt(0),kte=BigInt(1),Ste=new WeakMap,Cte=new WeakMap;Object.defineProperty(Tee,"__esModule",{value:!0}),Tee.twistedEdwards=function(e){const t=function(e){const t=(0,Ite.validateBasic)(e);return Pte.validateObject(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=t,l=Rte<<BigInt(8*a)-Tte,u=n.create,d=(0,Ate.Field)(t.n,t.nBitLength),h=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch(r){return{isValid:!1,value:Ote}}}),f=t.adjustScalarBytes||(e=>e),p=t.domain||((e,t,n)=>{if((0,Mte.abool)("phflag",n),t.length||n)throw new Error("Contexts/pre-hash are not supported");return e});function m(e,t){Pte.aInRange("coordinate "+e,t,Ote,l)}function g(e){if(!(e instanceof v))throw new Error("ExtendedPoint expected")}const y=(0,Mte.memoized)((e,t)=>{const{ex:r,ey:i,ez:o}=e,s=e.is0();null==t&&(t=s?Nte:n.inv(o));const a=u(r*t),c=u(i*t),l=u(o*t);if(s)return{x:Ote,y:Tte};if(l!==Tte)throw new Error("invZ was invalid");return{x:a,y:c}}),b=(0,Mte.memoized)(e=>{const{a:n,d:r}=t;if(e.is0())throw new Error("bad point: ZERO");const{ex:i,ey:o,ez:s,et:a}=e,c=u(i*i),l=u(o*o),d=u(s*s),h=u(d*d),f=u(c*n);if(u(d*u(f+l))!==u(h+u(r*u(c*l))))throw new Error("bad point: equation left != right (1)");if(u(i*o)!==u(s*a))throw new Error("bad point: equation left != right (2)");return!0});class v{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r,m("x",e),m("y",t),m("z",n),m("t",r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof v)throw new Error("extended point not allowed");const{x:t,y:n}=e||{};return m("x",t),m("y",n),new v(t,n,Tte,u(t*n))}static normalizeZ(e){const t=n.invertBatch(e.map(e=>e.ez));return e.map((e,n)=>e.toAffine(t[n])).map(v.fromAffine)}static msm(e,t){return(0,Ite.pippenger)(v,d,e,t)}_setWindowSize(e){_.setWindowSize(this,e)}assertValidity(){b(this)}equals(e){g(e);const{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=e,a=u(t*s),c=u(i*r),l=u(n*s),d=u(o*r);return a===c&&l===d}is0(){return this.equals(v.ZERO)}negate(){return new v(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:e}=t,{ex:n,ey:r,ez:i}=this,o=u(n*n),s=u(r*r),a=u(Rte*u(i*i)),c=u(e*o),l=n+r,d=u(u(l*l)-o-s),h=c+s,f=h-a,p=c-s,m=u(d*f),g=u(h*p),y=u(d*p),b=u(f*h);return new v(m,g,b,y)}add(e){g(e);const{a:n,d:r}=t,{ex:i,ey:o,ez:s,et:a}=this,{ex:c,ey:l,ez:d,et:h}=e;if(n===BigInt(-1)){const e=u((o-i)*(l+c)),t=u((o+i)*(l-c)),n=u(t-e);if(n===Ote)return this.double();const r=u(s*Rte*h),f=u(a*Rte*d),p=f+r,m=t+e,g=f-r,y=u(p*n),b=u(m*g),w=u(p*g),E=u(n*m);return new v(y,b,E,w)}const f=u(i*c),p=u(o*l),m=u(a*r*h),y=u(s*d),b=u((i+o)*(c+l)-f-p),w=y-m,E=y+m,_=u(p-n*f),x=u(b*w),k=u(E*_),S=u(b*_),C=u(w*E);return new v(x,k,C,S)}subtract(e){return this.add(e.negate())}wNAF(e){return _.wNAFCached(this,e,v.normalizeZ)}multiply(e){const t=e;Pte.aInRange("scalar",t,Tte,r);const{p:n,f:i}=this.wNAF(t);return v.normalizeZ([n,i])[0]}multiplyUnsafe(e){const t=e;return Pte.aInRange("scalar",t,Ote,r),t===Ote?E:this.equals(E)||t===Tte?this:this.equals(w)?this.wNAF(t).p:_.unsafeLadder(this,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return _.unsafeLadder(this,r).is0()}toAffine(e){return y(this,e)}clearCofactor(){const{h:e}=t;return e===Tte?this:this.multiplyUnsafe(e)}static fromHex(e,r=!1){const{d:i,a:o}=t,s=n.BYTES;e=(0,Mte.ensureBytes)("pointHex",e,s),(0,Mte.abool)("zip215",r);const a=e.slice(),c=e[s-1];a[s-1]=-129&c;const d=Pte.bytesToNumberLE(a),f=r?l:n.ORDER;Pte.aInRange("pointHex.y",d,Ote,f);const p=u(d*d),m=u(p-Tte),g=u(i*p-o);let{isValid:y,value:b}=h(m,g);if(!y)throw new Error("Point.fromHex: invalid y coordinate");const w=(b&Tte)===Tte,E=!!(128&c);if(!r&&b===Ote&&E)throw new Error("Point.fromHex: x=0 and x_0=1");return E!==w&&(b=u(-b)),v.fromAffine({x:b,y:d})}static fromPrivateKey(e){return S(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),r=Pte.numberToBytesLE(t,n.BYTES);return r[r.length-1]|=e&Tte?128:0,r}toHex(){return Pte.bytesToHex(this.toRawBytes())}}v.BASE=new v(t.Gx,t.Gy,Tte,u(t.Gx*t.Gy)),v.ZERO=new v(Ote,Tte,Tte,Ote);const{BASE:w,ZERO:E}=v,_=(0,Ite.wNAF)(v,8*a);function x(e){return(0,Ate.mod)(e,r)}function k(e){return x(Pte.bytesToNumberLE(e))}function S(e){const t=a;e=(0,Mte.ensureBytes)("private key",e,t);const n=(0,Mte.ensureBytes)("hashed private key",o(e),2*t),r=f(n.slice(0,t)),i=n.slice(t,2*t),s=k(r),c=w.multiply(s),l=c.toRawBytes();return{head:r,prefix:i,scalar:s,point:c,pointBytes:l}}function C(e=new Uint8Array,...t){const n=Pte.concatBytes(...t);return k(o(p(n,(0,Mte.ensureBytes)("context",e),!!i)))}const I=Lte;w._setWindowSize(8);return{CURVE:t,getPublicKey:function(e){return S(e).pointBytes},sign:function(e,t,o={}){e=(0,Mte.ensureBytes)("message",e),i&&(e=i(e));const{prefix:s,scalar:c,pointBytes:l}=S(t),u=C(o.context,s,e),d=w.multiply(u).toRawBytes(),h=x(u+C(o.context,d,l,e)*c);Pte.aInRange("signature.s",h,Ote,r);const f=Pte.concatBytes(d,Pte.numberToBytesLE(h,n.BYTES));return(0,Mte.ensureBytes)("result",f,2*a)},verify:function(e,t,r,o=I){const{context:s,zip215:a}=o,c=n.BYTES;e=(0,Mte.ensureBytes)("signature",e,2*c),t=(0,Mte.ensureBytes)("message",t),void 0!==a&&(0,Mte.abool)("zip215",a),i&&(t=i(t));const l=Pte.bytesToNumberLE(e.slice(c,2*c));let u,d,h;try{u=v.fromHex(r,a),d=v.fromHex(e.slice(0,c),a),h=w.multiplyUnsafe(l)}catch(p){return!1}if(!a&&u.isSmallOrder())return!1;const f=C(s,d.toRawBytes(),u.toRawBytes(),t);return d.add(u.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:S,randomPrivateKey:()=>s(n.BYTES),precompute:(e=8,t=v.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}};const Ite=Ree,Ate=Nee,Pte=Lee,Mte=Lee,Ote=BigInt(0),Tte=BigInt(1),Rte=BigInt(2),Nte=BigInt(8),Lte={zip215:!0};var Bte={};Object.defineProperty(Bte,"__esModule",{value:!0}),Bte.expand_message_xmd=Hte,Bte.expand_message_xof=qte,Bte.hash_to_field=Wte,Bte.isogenyMap=function(e,t){const n=t.map(e=>Array.from(e).reverse());return(t,r)=>{const[i,o,s,a]=n.map(n=>n.reduce((n,r)=>e.add(e.mul(n,t),r)));return t=e.div(i,o),r=e.mul(r,e.div(s,a)),{x:t,y:r}}},Bte.createHasher=function(e,t,n){if("function"!=typeof t)throw new Error("mapToCurve() must be defined");return{hashToCurve(r,i){const o=Wte(r,2,{...n,DST:n.DST,...i}),s=e.fromAffine(t(o[0])),a=e.fromAffine(t(o[1])),c=s.add(a).clearCofactor();return c.assertValidity(),c},encodeToCurve(r,i){const o=Wte(r,1,{...n,DST:n.encodeDST,...i}),s=e.fromAffine(t(o[0])).clearCofactor();return s.assertValidity(),s},mapToCurve(n){if(!Array.isArray(n))throw new Error("mapToCurve: expected array of bigints");for(const e of n)if("bigint"!=typeof e)throw new Error(`mapToCurve: expected array of bigints, got ${e} in array`);const r=e.fromAffine(t(n)).clearCofactor();return r.assertValidity(),r}}};const jte=Nee,Dte=Lee,Ute=Dte.bytesToNumberBE;function Fte(e,t){if(zte(e),zte(t),e<0||e>=1<<8*t)throw new Error(`bad I2OSP call: value=${e} length=${t}`);const n=Array.from({length:t}).fill(0);for(let r=t-1;r>=0;r--)n[r]=255&e,e>>>=8;return new Uint8Array(n)}function $te(e,t){const n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e[r]^t[r];return n}function zte(e){if(!Number.isSafeInteger(e))throw new Error("number expected")}function Hte(e,t,n,r){(0,Dte.abytes)(e),(0,Dte.abytes)(t),zte(n),t.length>255&&(t=r((0,Dte.concatBytes)((0,Dte.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:i,blockLen:o}=r,s=Math.ceil(n/i);if(n>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");const a=(0,Dte.concatBytes)(t,Fte(t.length,1)),c=Fte(0,o),l=Fte(n,2),u=new Array(s),d=r((0,Dte.concatBytes)(c,e,l,Fte(0,1),a));u[0]=r((0,Dte.concatBytes)(d,Fte(1,1),a));for(let h=1;h<=s;h++){const e=[$te(d,u[h-1]),Fte(h+1,1),a];u[h]=r((0,Dte.concatBytes)(...e))}return(0,Dte.concatBytes)(...u).slice(0,n)}function qte(e,t,n,r,i){if((0,Dte.abytes)(e),(0,Dte.abytes)(t),zte(n),t.length>255){const e=Math.ceil(2*r/8);t=i.create({dkLen:e}).update((0,Dte.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(n>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:n}).update(e).update(Fte(n,2)).update(t).update(Fte(t.length,1)).digest()}function Wte(e,t,n){(0,Dte.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:r,k:i,m:o,hash:s,expand:a,DST:c}=n;(0,Dte.abytes)(e),zte(t);const l="string"==typeof c?(0,Dte.utf8ToBytes)(c):c,u=r.toString(2).length,d=Math.ceil((u+i)/8),h=t*o*d;let f;if("xmd"===a)f=Hte(e,l,h,s);else if("xof"===a)f=qte(e,l,h,i,s);else{if("_internal_pass"!==a)throw new Error('expand must be "xmd" or "xof"');f=e}const p=new Array(t);for(let m=0;m<t;m++){const e=new Array(o);for(let t=0;t<o;t++){const n=d*(t+m*o),i=f.subarray(n,n+d);e[t]=(0,jte.mod)(Ute(i),r)}p[m]=e}return p}var Kte={};Object.defineProperty(Kte,"__esModule",{value:!0}),Kte.montgomery=function(e){const t=(l=e,(0,Vte.validateObject)(l,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...l})),{P:n}=t,r=e=>(0,Gte.mod)(e,n),i=t.montgomeryBits,o=Math.ceil(i/8),s=t.nByteLength,a=t.adjustScalarBytes||(e=>e),c=t.powPminus2||(e=>(0,Gte.pow)(e,n-BigInt(2),n));var l;function u(e,t,n){const i=r(e*(t-n));return[t=r(t-i),n=r(n+i)]}const d=(t.a-BigInt(2))/BigInt(4);function h(e){return(0,Vte.numberToBytesLE)(r(e),o)}function f(e,t){const l=function(e,t){(0,Vte.aInRange)("u",e,Zte,n),(0,Vte.aInRange)("scalar",t,Zte,n);const o=t,s=e;let a,l=Yte,h=Zte,f=e,p=Yte,m=Zte;for(let n=BigInt(i-1);n>=Zte;n--){const e=o>>n&Yte;m^=e,a=u(m,l,f),l=a[0],f=a[1],a=u(m,h,p),h=a[0],p=a[1],m=e;const t=l+h,i=r(t*t),c=l-h,g=r(c*c),y=i-g,b=f+p,v=r((f-p)*t),w=r(b*c),E=v+w,_=v-w;f=r(E*E),p=r(s*r(_*_)),l=r(i*g),h=r(y*(i+r(d*y)))}a=u(m,l,f),l=a[0],f=a[1],a=u(m,h,p),h=a[0],p=a[1];const g=c(h);return r(l*g)}(function(e){const t=(0,Vte.ensureBytes)("u coordinate",e,o);return 32===s&&(t[31]&=127),(0,Vte.bytesToNumberLE)(t)}(t),function(e){const t=(0,Vte.ensureBytes)("scalar",e),n=t.length;if(n!==o&&n!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${n}`);return(0,Vte.bytesToNumberLE)(a(t))}(e));if(l===Zte)throw new Error("Invalid private or public key received");return h(l)}const p=h(t.Gu);function m(e){return f(e,p)}return{scalarMult:f,scalarMultBase:m,getSharedSecret:(e,t)=>f(e,t),getPublicKey:e=>m(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:p}};const Gte=Nee,Vte=Lee,Zte=BigInt(0),Yte=BigInt(1);!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.RistrettoPoint=e.encodeToCurve=e.hashToCurve=e.edwardsToMontgomery=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=e.ED25519_TORSION_SUBGROUP=void 0,e.edwardsToMontgomeryPub=_,e.edwardsToMontgomeryPriv=function(e){const t=w.hash(e.subarray(0,32));return w.adjustScalarBytes(t).subarray(0,32)};const t=N9,n=W9,r=Tee,i=Bte,o=Nee,s=Kte,a=Lee,c=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),u=BigInt(0),d=BigInt(1),h=BigInt(2),f=BigInt(3),p=BigInt(5),m=BigInt(8);function g(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),s=c,a=e*e%s*e%s,l=(0,o.pow2)(a,h,s)*a%s,u=(0,o.pow2)(l,d,s)*e%s,f=(0,o.pow2)(u,p,s)*u%s,m=(0,o.pow2)(f,t,s)*f%s,g=(0,o.pow2)(m,n,s)*m%s,y=(0,o.pow2)(g,r,s)*g%s,b=(0,o.pow2)(y,i,s)*y%s,v=(0,o.pow2)(b,i,s)*y%s,w=(0,o.pow2)(v,t,s)*f%s;return{pow_p_5_8:(0,o.pow2)(w,h,s)*e%s,b2:a}}function y(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function b(e,t){const n=c,r=(0,o.mod)(t*t*t,n),i=g(e*(0,o.mod)(r*r*t,n)).pow_p_5_8;let s=(0,o.mod)(e*r*i,n);const a=(0,o.mod)(t*s*s,n),u=s,d=(0,o.mod)(s*l,n),h=a===e,f=a===(0,o.mod)(-e,n),p=a===(0,o.mod)(-e*l,n);return h&&(s=u),(f||p)&&(s=d),(0,o.isNegativeLE)(s,n)&&(s=(0,o.mod)(-s,n)),{isValid:h||f,value:s}}e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const v=(0,o.Field)(c,void 0,!0),w={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:v,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:m,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:t.sha512,randomBytes:n.randomBytes,adjustScalarBytes:y,uvRatio:b};function E(e,t,r){if(t.length>255)throw new Error("Context is too big");return(0,n.concatBytes)((0,n.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,t.length]),t,e)}function _(t){const{y:n}=e.ed25519.ExtendedPoint.fromHex(t),r=BigInt(1);return v.toBytes(v.create((r+n)*v.inv(r-n)))}e.ed25519=(0,r.twistedEdwards)(w),e.ed25519ctx=(0,r.twistedEdwards)({...w,domain:E}),e.ed25519ph=(0,r.twistedEdwards)(Object.assign({},w,{domain:E,prehash:t.sha512})),e.x25519=(0,s.montgomery)({P:c,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=c,{pow_p_5_8:n,b2:r}=g(e);return(0,o.mod)((0,o.pow2)(n,f,t)*r,t)},adjustScalarBytes:y,randomBytes:n.randomBytes}),e.edwardsToMontgomery=_;const x=(v.ORDER+f)/m,k=v.pow(h,x),S=v.sqrt(v.neg(v.ONE)),C=(0,o.FpSqrtEven)(v,v.neg(BigInt(486664)));const I=(0,i.createHasher)(e.ed25519.ExtendedPoint,e=>function(e){const{xMn:t,xMd:n,yMn:r,yMd:i}=function(e){const t=(v.ORDER-p)/m,n=BigInt(486662);let r=v.sqr(e);r=v.mul(r,h);let i=v.add(r,v.ONE),o=v.neg(n),s=v.sqr(i),a=v.mul(s,i),c=v.mul(r,n);c=v.mul(c,o),c=v.add(c,s),c=v.mul(c,o);let l=v.sqr(a);s=v.sqr(l),l=v.mul(l,a),l=v.mul(l,c),s=v.mul(s,l);let u=v.pow(s,t);u=v.mul(u,l);let f=v.mul(u,S);s=v.sqr(u),s=v.mul(s,a);let g=v.eql(s,c),y=v.cmov(f,u,g),b=v.mul(o,r),w=v.mul(u,e);w=v.mul(w,k);let E=v.mul(w,S),_=v.mul(c,r);s=v.sqr(w),s=v.mul(s,a);let x=v.eql(s,_),C=v.cmov(E,w,x);s=v.sqr(y),s=v.mul(s,a);let I=v.eql(s,c),A=v.cmov(b,o,I),P=v.cmov(C,y,I),M=v.isOdd(P);return P=v.cmov(P,v.neg(P),I!==M),{xMn:A,xMd:i,yMn:P,yMd:d}}(e);let o=v.mul(t,i);o=v.mul(o,C);let s=v.mul(n,r),a=v.sub(t,n),c=v.add(t,n),l=v.mul(s,c),u=v.eql(l,v.ZERO);o=v.cmov(o,v.ZERO,u),s=v.cmov(s,v.ONE,u),a=v.cmov(a,v.ONE,u),c=v.cmov(c,v.ONE,u);const f=v.invertBatch([s,c]);return{x:v.mul(o,f[0]),y:v.mul(a,f[1])}}(e[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:v.ORDER,m:1,k:128,expand:"xmd",hash:t.sha512});function A(e){if(!(e instanceof D))throw new Error("RistrettoPoint expected")}e.hashToCurve=I.hashToCurve,e.encodeToCurve=I.encodeToCurve;const P=l,M=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),O=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),T=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),R=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),N=e=>b(d,e),L=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),B=t=>e.ed25519.CURVE.Fp.create((0,a.bytesToNumberLE)(t)&L);function j(t){const{d:n}=e.ed25519.CURVE,r=e.ed25519.CURVE.Fp.ORDER,i=e.ed25519.CURVE.Fp.create,s=i(P*t*t),a=i((s+d)*T);let c=BigInt(-1);const l=i((c-n*s)*i(s+n));let{isValid:u,value:h}=b(a,l),f=i(h*t);(0,o.isNegativeLE)(f,r)||(f=i(-f)),u||(h=f),u||(c=s);const p=i(c*(s-d)*R-l),m=h*h,g=i((h+h)*l),y=i(p*M),v=i(d-m),w=i(d+m);return new e.ed25519.ExtendedPoint(i(g*w),i(v*y),i(y*w),i(g*v))}class D{constructor(e){this.ep=e}static fromAffine(t){return new D(e.ed25519.ExtendedPoint.fromAffine(t))}static hashToCurve(e){e=(0,a.ensureBytes)("ristrettoHash",e,64);const t=j(B(e.slice(0,32))),n=j(B(e.slice(32,64)));return new D(t.add(n))}static fromHex(t){t=(0,a.ensureBytes)("ristrettoHex",t,32);const{a:n,d:r}=e.ed25519.CURVE,i=e.ed25519.CURVE.Fp.ORDER,s=e.ed25519.CURVE.Fp.create,c="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",l=B(t);if(!(0,a.equalBytes)((0,a.numberToBytesLE)(l,32),t)||(0,o.isNegativeLE)(l,i))throw new Error(c);const h=s(l*l),f=s(d+n*h),p=s(d-n*h),m=s(f*f),g=s(p*p),y=s(n*r*m-g),{isValid:b,value:v}=N(s(y*g)),w=s(v*p),E=s(v*w*y);let _=s((l+l)*w);(0,o.isNegativeLE)(_,i)&&(_=s(-_));const x=s(f*E),k=s(_*x);if(!b||(0,o.isNegativeLE)(k,i)||x===u)throw new Error(c);return new D(new e.ed25519.ExtendedPoint(_,x,d,k))}toRawBytes(){let{ex:t,ey:n,ez:r,et:i}=this.ep;const s=e.ed25519.CURVE.Fp.ORDER,c=e.ed25519.CURVE.Fp.create,l=c(c(r+n)*c(r-n)),u=c(t*n),d=c(u*u),{value:h}=N(c(l*d)),f=c(h*l),p=c(h*u),m=c(f*p*i);let g;if((0,o.isNegativeLE)(i*m,s)){let e=c(n*P),r=c(t*P);t=e,n=r,g=c(f*O)}else g=p;(0,o.isNegativeLE)(t*m,s)&&(n=c(-n));let y=c((r-n)*g);return(0,o.isNegativeLE)(y,s)&&(y=c(-y)),(0,a.numberToBytesLE)(y,32)}toHex(){return(0,a.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(t){A(t);const{ex:n,ey:r}=this.ep,{ex:i,ey:o}=t.ep,s=e.ed25519.CURVE.Fp.create,a=s(n*o)===s(r*i),c=s(r*o)===s(n*i);return a||c}add(e){return A(e),new D(this.ep.add(e.ep))}subtract(e){return A(e),new D(this.ep.subtract(e.ep))}multiply(e){return new D(this.ep.multiply(e))}multiplyUnsafe(e){return new D(this.ep.multiplyUnsafe(e))}double(){return new D(this.ep.double())}negate(){return new D(this.ep.negate())}}e.RistrettoPoint=(D.BASE||(D.BASE=new D(e.ed25519.ExtendedPoint.BASE)),D.ZERO||(D.ZERO=new D(e.ed25519.ExtendedPoint.ZERO)),D),e.hashToRistretto255=(e,r)=>{const o=r.DST,s="string"==typeof o?(0,n.utf8ToBytes)(o):o,a=(0,i.expand_message_xmd)(e,s,64,t.sha512);return D.hashToCurve(a)},e.hash_to_ristretto255=e.hashToRistretto255}(R9);var Jte={},Qte={};Object.defineProperty(Qte,"__esModule",{value:!0}),Qte.sha224=Qte.sha256=Qte.SHA256=void 0;const Xte=L9,ene=W9,tne=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),nne=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rne=new Uint32Array(64);class ine extends Xte.HashMD{constructor(){super(64,32,8,!1),this.A=0|nne[0],this.B=0|nne[1],this.C=0|nne[2],this.D=0|nne[3],this.E=0|nne[4],this.F=0|nne[5],this.G=0|nne[6],this.H=0|nne[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)rne[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=rne[u-15],t=rne[u-2],n=(0,ene.rotr)(e,7)^(0,ene.rotr)(e,18)^e>>>3,r=(0,ene.rotr)(t,17)^(0,ene.rotr)(t,19)^t>>>10;rne[u]=r+rne[u-7]+n+rne[u-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:c,H:l}=this;for(let u=0;u<64;u++){const e=l+((0,ene.rotr)(s,6)^(0,ene.rotr)(s,11)^(0,ene.rotr)(s,25))+(0,Xte.Chi)(s,a,c)+tne[u]+rne[u]|0,t=((0,ene.rotr)(n,2)^(0,ene.rotr)(n,13)^(0,ene.rotr)(n,22))+(0,Xte.Maj)(n,r,i)|0;l=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,o,s,a,c,l)}roundClean(){rne.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}Qte.SHA256=ine;class one extends ine{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}Qte.sha256=(0,ene.wrapConstructor)(()=>new ine),Qte.sha224=(0,ene.wrapConstructor)(()=>new one);var sne={},ane={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=B9,n=W9;class r extends n.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,(0,t.hash)(e);const i=(0,n.toBytes)(r);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(i.length>o?e.create().update(i).digest():i);for(let t=0;t<s.length;t++)s[t]^=54;this.iHash.update(s),this.oHash=e.create();for(let t=0;t<s.length;t++)s[t]^=106;this.oHash.update(s),s.fill(0)}update(e){return(0,t.exists)(this),this.iHash.update(e),this}digestInto(e){(0,t.exists)(this),(0,t.bytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=r,e.hmac=(e,t,n)=>new r(e,t).update(n).digest(),e.hmac.create=(e,t)=>new r(e,t)}(ane);var cne={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=void 0,e.weierstrassPoints=f,e.weierstrass=function(s){const a=function(e){const n=(0,t.validateBasic)(e);return r.validateObject(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}(s),{Fp:u,n:d}=a,h=u.BYTES+1,p=2*u.BYTES+1;function m(e){return n.mod(e,d)}function g(e){return n.invert(e,d)}const{ProjectivePoint:y,normPrivateKeyToScalar:b,weierstrassEquation:v,isWithinCurveOrder:w}=f({...a,toBytes(e,t,n){const o=t.toAffine(),s=u.toBytes(o.x),a=r.concatBytes;return(0,i.abool)("isCompressed",n),n?a(Uint8Array.from([t.hasEvenY()?2:3]),s):a(Uint8Array.from([4]),s,u.toBytes(o.y))},fromBytes(e){const t=e.length,n=e[0],i=e.subarray(1);if(t!==h||2!==n&&3!==n){if(t===p&&4===n)return{x:u.fromBytes(i.subarray(0,u.BYTES)),y:u.fromBytes(i.subarray(u.BYTES,2*u.BYTES))};throw new Error(`Point of length ${t} was invalid. Expected ${h} compressed bytes or ${p} uncompressed bytes`)}{const e=r.bytesToNumberBE(i);if(!r.inRange(e,l,u.ORDER))throw new Error("Point is not on curve");const t=v(e);let s;try{s=u.sqrt(t)}catch(o){const e=o instanceof Error?": "+o.message:"";throw new Error("Point is not on curve"+e)}return!(1&~n)!=((s&l)===l)&&(s=u.neg(s)),{x:e,y:s}}}}),E=e=>r.bytesToHex(r.numberToBytesBE(e,a.nByteLength));function _(e){return e>d>>l}const x=(e,t,n)=>r.bytesToNumberBE(e.slice(t,n));class k{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const t=a.nByteLength;return e=(0,i.ensureBytes)("compactSignature",e,2*t),new k(x(e,0,t),x(e,t,2*t))}static fromDER(t){const{r:n,s:r}=e.DER.toSig((0,i.ensureBytes)("DER",t));return new k(n,r)}assertValidity(){r.aInRange("r",this.r,l,d),r.aInRange("s",this.s,l,d)}addRecoveryBit(e){return new k(this.r,this.s,e)}recoverPublicKey(e){const{r:t,s:n,recovery:r}=this,o=A((0,i.ensureBytes)("msgHash",e));if(null==r||![0,1,2,3].includes(r))throw new Error("recovery id invalid");const s=2===r||3===r?t+a.n:t;if(s>=u.ORDER)throw new Error("recovery id 2 or 3 invalid");const c=1&r?"03":"02",l=y.fromHex(c+E(s)),d=g(s),h=m(-o*d),f=m(n*d),p=y.BASE.multiplyAndAddUnsafe(l,h,f);if(!p)throw new Error("point at infinify");return p.assertValidity(),p}hasHighS(){return _(this.s)}normalizeS(){return this.hasHighS()?new k(this.r,m(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}const S={isValidPrivateKey(e){try{return b(e),!0}catch(t){return!1}},normPrivateKeyToScalar:b,randomPrivateKey:()=>{const e=n.getMinHashLength(a.n);return n.mapHashToField(a.randomBytes(e),a.n)},precompute:(e=8,t=y.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function C(e){const t=r.isBytes(e),n="string"==typeof e,i=(t||n)&&e.length;return t?i===h||i===p:n?i===2*h||i===2*p:e instanceof y}const I=a.bits2int||function(e){const t=r.bytesToNumberBE(e),n=8*e.length-a.nBitLength;return n>0?t>>BigInt(n):t},A=a.bits2int_modN||function(e){return m(I(e))},P=r.bitMask(a.nBitLength);function M(e){return r.aInRange(`num < 2^${a.nBitLength}`,e,c,P),r.numberToBytesBE(e,a.nByteLength)}const O={lowS:a.lowS,prehash:!1},T={lowS:a.lowS,prehash:!1};return y.BASE._setWindowSize(8),{CURVE:a,getPublicKey:function(e,t=!0){return y.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(C(e))throw new Error("first arg must be private key");if(!C(t))throw new Error("second arg must be public key");return y.fromHex(t).multiply(b(e)).toRawBytes(n)},sign:function(e,t,n=O){const{seed:s,k2sig:d}=function(e,t,n=O){if(["recovered","canonical"].some(e=>e in n))throw new Error("sign() legacy options not supported");const{hash:s,randomBytes:d}=a;let{lowS:h,prehash:f,extraEntropy:p}=n;null==h&&(h=!0),e=(0,i.ensureBytes)("msgHash",e),o(n),f&&(e=(0,i.ensureBytes)("prehashed msgHash",s(e)));const v=A(e),E=b(t),x=[M(E),M(v)];if(null!=p&&!1!==p){const e=!0===p?d(u.BYTES):p;x.push((0,i.ensureBytes)("extraEntropy",e))}const S=r.concatBytes(...x),C=v;return{seed:S,k2sig:function(e){const t=I(e);if(!w(t))return;const n=g(t),r=y.BASE.multiply(t).toAffine(),i=m(r.x);if(i===c)return;const o=m(n*m(C+i*E));if(o===c)return;let s=(r.x===i?0:2)|Number(r.y&l),a=o;return h&&_(o)&&(a=_(u=o)?m(-u):u,s^=1),new k(i,a,s);var u}}}(e,t,n),h=a;return r.createHmacDrbg(h.hash.outputLen,h.nByteLength,h.hmac)(s,d)},verify:function(t,n,s,c=T){var l;const u=t;if(n=(0,i.ensureBytes)("msgHash",n),s=(0,i.ensureBytes)("publicKey",s),"strict"in c)throw new Error("options.strict was renamed to lowS");o(c);const{lowS:d,prehash:h}=c;let f,p;try{if("string"==typeof u||r.isBytes(u))try{f=k.fromDER(u)}catch(C){if(!(C instanceof e.DER.Err))throw C;f=k.fromCompact(u)}else{if("object"!=typeof u||"bigint"!=typeof u.r||"bigint"!=typeof u.s)throw new Error("PARSE");{const{r:e,s:t}=u;f=new k(e,t)}}p=y.fromHex(s)}catch(I){if("PARSE"===I.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(d&&f.hasHighS())return!1;h&&(n=a.hash(n));const{r:b,s:v}=f,w=A(n),E=g(v),_=m(w*E),x=m(b*E),S=null==(l=y.BASE.multiplyAndAddUnsafe(p,_,x))?void 0:l.toAffine();if(!S)return!1;return m(S.x)===b},ProjectivePoint:y,Signature:k,utils:S}},e.SWUFpSqrtRatio=p,e.mapToCurveSimpleSWU=function(e,t){if(n.validateField(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const r=p(e,t.Z);if(!e.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let i,o,s,a,c,l,u,d;i=e.sqr(n),i=e.mul(i,t.Z),o=e.sqr(i),o=e.add(o,i),s=e.add(o,e.ONE),s=e.mul(s,t.B),a=e.cmov(t.Z,e.neg(o),!e.eql(o,e.ZERO)),a=e.mul(a,t.A),o=e.sqr(s),l=e.sqr(a),c=e.mul(l,t.A),o=e.add(o,c),o=e.mul(o,s),l=e.mul(l,a),c=e.mul(l,t.B),o=e.add(o,c),u=e.mul(i,s);const{isValid:h,value:f}=r(o,l);d=e.mul(i,n),d=e.mul(d,f),u=e.cmov(u,s,h),d=e.cmov(d,f,h);const p=e.isOdd(n)===e.isOdd(d);return d=e.cmov(e.neg(d),d,p),u=e.div(u,a),{x:u,y:d}}};const t=Ree,n=Nee,r=Lee,i=Lee;function o(e){void 0!==e.lowS&&(0,i.abool)("lowS",e.lowS),void 0!==e.prehash&&(0,i.abool)("prehash",e.prehash)}const{bytesToNumberBE:s,hexToBytes:a}=r;e.DER={Err:class extends Error{constructor(e=""){super(e)}},_tlv:{encode:(t,n)=>{const{Err:i}=e.DER;if(t<0||t>256)throw new i("tlv.encode: wrong tag");if(1&n.length)throw new i("tlv.encode: unpadded data");const o=n.length/2,s=r.numberToHexUnpadded(o);if(s.length/2&128)throw new i("tlv.encode: long form length too big");const a=o>127?r.numberToHexUnpadded(s.length/2|128):"";return`${r.numberToHexUnpadded(t)}${a}${s}${n}`},decode(t,n){const{Err:r}=e.DER;let i=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(n.length<2||n[i++]!==t)throw new r("tlv.decode: wrong tlv");const o=n[i++];let s=0;if(128&o){const e=127&o;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");const t=n.subarray(i,i+e);if(t.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===t[0])throw new r("tlv.decode(long): zero leftmost byte");for(const n of t)s=s<<8|n;if(i+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=o;const a=n.subarray(i,i+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:n.subarray(i+s)}}},_int:{encode(t){const{Err:n}=e.DER;if(t<c)throw new n("integer: negative integers are not allowed");let i=r.numberToHexUnpadded(t);if(8&Number.parseInt(i[0],16)&&(i="00"+i),1&i.length)throw new n("unexpected assertion");return i},decode(t){const{Err:n}=e.DER;if(128&t[0])throw new n("Invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new n("Invalid signature integer: unnecessary leading zero");return s(t)}},toSig(t){const{Err:n,_int:i,_tlv:o}=e.DER,s="string"==typeof t?a(t):t;r.abytes(s);const{v:c,l:l}=o.decode(48,s);if(l.length)throw new n("Invalid signature: left bytes after parsing");const{v:u,l:d}=o.decode(2,c),{v:h,l:f}=o.decode(2,d);if(f.length)throw new n("Invalid signature: left bytes after parsing");return{r:i.decode(u),s:i.decode(h)}},hexFromSig(t){const{_tlv:n,_int:r}=e.DER,i=`${n.encode(2,r.encode(t.r))}${n.encode(2,r.encode(t.s))}`;return n.encode(48,i)}};const c=BigInt(0),l=BigInt(1),u=BigInt(2),d=BigInt(3),h=BigInt(4);function f(e){const o=function(e){const n=(0,t.validateBasic)(e);r.validateObject(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:i,Fp:o,a:s}=n;if(i){if(!o.eql(s,o.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof i||"bigint"!=typeof i.beta||"function"!=typeof i.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...n})}(e),{Fp:s}=o,a=n.Field(o.n,o.nBitLength),u=o.toBytes||((e,t,n)=>{const i=t.toAffine();return r.concatBytes(Uint8Array.from([4]),s.toBytes(i.x),s.toBytes(i.y))}),h=o.fromBytes||(e=>{const t=e.subarray(1);return{x:s.fromBytes(t.subarray(0,s.BYTES)),y:s.fromBytes(t.subarray(s.BYTES,2*s.BYTES))}});function f(e){const{a:t,b:n}=o,r=s.sqr(e),i=s.mul(r,e);return s.add(s.add(i,s.mul(e,t)),n)}if(!s.eql(s.sqr(o.Gy),f(o.Gx)))throw new Error("bad generator point: equation left != right");function p(e){const{allowedPrivateKeyLengths:t,nByteLength:s,wrapPrivateKey:a,n:c}=o;if(t&&"bigint"!=typeof e){if(r.isBytes(e)&&(e=r.bytesToHex(e)),"string"!=typeof e||!t.includes(e.length))throw new Error("Invalid key");e=e.padStart(2*s,"0")}let u;try{u="bigint"==typeof e?e:r.bytesToNumberBE((0,i.ensureBytes)("private key",e,s))}catch(d){throw new Error(`private key must be ${s} bytes, hex or bigint, not ${typeof e}`)}return a&&(u=n.mod(u,c)),r.aInRange("private key",u,l,c),u}function m(e){if(!(e instanceof b))throw new Error("ProjectivePoint expected")}const g=(0,i.memoized)((e,t)=>{const{px:n,py:r,pz:i}=e;if(s.eql(i,s.ONE))return{x:n,y:r};const o=e.is0();null==t&&(t=o?s.ONE:s.inv(i));const a=s.mul(n,t),c=s.mul(r,t),l=s.mul(i,t);if(o)return{x:s.ZERO,y:s.ZERO};if(!s.eql(l,s.ONE))throw new Error("invZ was invalid");return{x:a,y:c}}),y=(0,i.memoized)(e=>{if(e.is0()){if(o.allowInfinityPoint&&!s.is0(e.py))return;throw new Error("bad point: ZERO")}const{x:t,y:n}=e.toAffine();if(!s.isValid(t)||!s.isValid(n))throw new Error("bad point: x or y not FE");const r=s.sqr(n),i=f(t);if(!s.eql(r,i))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class b{constructor(e,t,n){if(this.px=e,this.py=t,this.pz=n,null==e||!s.isValid(e))throw new Error("x required");if(null==t||!s.isValid(t))throw new Error("y required");if(null==n||!s.isValid(n))throw new Error("z required");Object.freeze(this)}static fromAffine(e){const{x:t,y:n}=e||{};if(!e||!s.isValid(t)||!s.isValid(n))throw new Error("invalid affine point");if(e instanceof b)throw new Error("projective point not allowed");const r=e=>s.eql(e,s.ZERO);return r(t)&&r(n)?b.ZERO:new b(t,n,s.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=s.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(b.fromAffine)}static fromHex(e){const t=b.fromAffine(h((0,i.ensureBytes)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return b.BASE.multiply(p(e))}static msm(e,n){return(0,t.pippenger)(b,a,e,n)}_setWindowSize(e){w.setWindowSize(this,e)}assertValidity(){y(this)}hasEvenY(){const{y:e}=this.toAffine();if(s.isOdd)return!s.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){m(e);const{px:t,py:n,pz:r}=this,{px:i,py:o,pz:a}=e,c=s.eql(s.mul(t,a),s.mul(i,r)),l=s.eql(s.mul(n,a),s.mul(o,r));return c&&l}negate(){return new b(this.px,s.neg(this.py),this.pz)}double(){const{a:e,b:t}=o,n=s.mul(t,d),{px:r,py:i,pz:a}=this;let c=s.ZERO,l=s.ZERO,u=s.ZERO,h=s.mul(r,r),f=s.mul(i,i),p=s.mul(a,a),m=s.mul(r,i);return m=s.add(m,m),u=s.mul(r,a),u=s.add(u,u),c=s.mul(e,u),l=s.mul(n,p),l=s.add(c,l),c=s.sub(f,l),l=s.add(f,l),l=s.mul(c,l),c=s.mul(m,c),u=s.mul(n,u),p=s.mul(e,p),m=s.sub(h,p),m=s.mul(e,m),m=s.add(m,u),u=s.add(h,h),h=s.add(u,h),h=s.add(h,p),h=s.mul(h,m),l=s.add(l,h),p=s.mul(i,a),p=s.add(p,p),h=s.mul(p,m),c=s.sub(c,h),u=s.mul(p,f),u=s.add(u,u),u=s.add(u,u),new b(c,l,u)}add(e){m(e);const{px:t,py:n,pz:r}=this,{px:i,py:a,pz:c}=e;let l=s.ZERO,u=s.ZERO,h=s.ZERO;const f=o.a,p=s.mul(o.b,d);let g=s.mul(t,i),y=s.mul(n,a),v=s.mul(r,c),w=s.add(t,n),E=s.add(i,a);w=s.mul(w,E),E=s.add(g,y),w=s.sub(w,E),E=s.add(t,r);let _=s.add(i,c);return E=s.mul(E,_),_=s.add(g,v),E=s.sub(E,_),_=s.add(n,r),l=s.add(a,c),_=s.mul(_,l),l=s.add(y,v),_=s.sub(_,l),h=s.mul(f,E),l=s.mul(p,v),h=s.add(l,h),l=s.sub(y,h),h=s.add(y,h),u=s.mul(l,h),y=s.add(g,g),y=s.add(y,g),v=s.mul(f,v),E=s.mul(p,E),y=s.add(y,v),v=s.sub(g,v),v=s.mul(f,v),E=s.add(E,v),g=s.mul(y,E),u=s.add(u,g),g=s.mul(_,E),l=s.mul(w,l),l=s.sub(l,g),g=s.mul(w,y),h=s.mul(_,h),h=s.add(h,g),new b(l,u,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(b.ZERO)}wNAF(e){return w.wNAFCached(this,e,b.normalizeZ)}multiplyUnsafe(e){r.aInRange("scalar",e,c,o.n);const t=b.ZERO;if(e===c)return t;if(e===l)return this;const{endo:n}=o;if(!n)return w.unsafeLadder(this,e);let{k1neg:i,k1:a,k2neg:u,k2:d}=n.splitScalar(e),h=t,f=t,p=this;for(;a>c||d>c;)a&l&&(h=h.add(p)),d&l&&(f=f.add(p)),p=p.double(),a>>=l,d>>=l;return i&&(h=h.negate()),u&&(f=f.negate()),f=new b(s.mul(f.px,n.beta),f.py,f.pz),h.add(f)}multiply(e){const{endo:t,n:n}=o;let i,a;if(r.aInRange("scalar",e,l,n),t){const{k1neg:n,k1:r,k2neg:o,k2:c}=t.splitScalar(e);let{p:l,f:u}=this.wNAF(r),{p:d,f:h}=this.wNAF(c);l=w.constTimeNegate(n,l),d=w.constTimeNegate(o,d),d=new b(s.mul(d.px,t.beta),d.py,d.pz),i=l.add(d),a=u.add(h)}else{const{p:t,f:n}=this.wNAF(e);i=t,a=n}return b.normalizeZ([i,a])[0]}multiplyAndAddUnsafe(e,t,n){const r=b.BASE,i=(e,t)=>t!==c&&t!==l&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,n));return o.is0()?void 0:o}toAffine(e){return g(this,e)}isTorsionFree(){const{h:e,isTorsionFree:t}=o;if(e===l)return!0;if(t)return t(b,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:t}=o;return e===l?this:t?t(b,this):this.multiplyUnsafe(o.h)}toRawBytes(e=!0){return(0,i.abool)("isCompressed",e),this.assertValidity(),u(b,this,e)}toHex(e=!0){return(0,i.abool)("isCompressed",e),r.bytesToHex(this.toRawBytes(e))}}b.BASE=new b(o.Gx,o.Gy,s.ONE),b.ZERO=new b(s.ZERO,s.ONE,s.ZERO);const v=o.nBitLength,w=(0,t.wNAF)(b,o.endo?Math.ceil(v/2):v);return{CURVE:o,ProjectivePoint:b,normPrivateKeyToScalar:p,weierstrassEquation:f,isWithinCurveOrder:function(e){return r.inRange(e,l,o.n)}}}function p(e,t){const n=e.ORDER;let r=c;for(let d=n-l;d%u===c;d/=u)r+=l;const i=r,o=u<<i-l-l,s=o*u,a=(n-l)/s,f=(a-l)/u,p=s-l,m=o,g=e.pow(t,a),y=e.pow(t,(a+l)/u);let b=(t,n)=>{let r=g,o=e.pow(n,p),s=e.sqr(o);s=e.mul(s,n);let a=e.mul(t,s);a=e.pow(a,f),a=e.mul(a,o),o=e.mul(a,n),s=e.mul(a,t);let c=e.mul(s,o);a=e.pow(c,m);let d=e.eql(a,e.ONE);o=e.mul(s,y),a=e.mul(c,r),s=e.cmov(o,s,d),c=e.cmov(a,c,d);for(let h=i;h>l;h--){let t=h-u;t=u<<t-l;let n=e.pow(c,t);const i=e.eql(n,e.ONE);o=e.mul(s,r),r=e.mul(r,r),n=e.mul(c,r),s=e.cmov(o,s,i),c=e.cmov(n,c,i)}return{isValid:d,value:s}};if(e.ORDER%h===d){const n=(e.ORDER-d)/h,r=e.sqrt(e.neg(t));b=(t,i)=>{let o=e.sqr(i);const s=e.mul(t,i);o=e.mul(o,s);let a=e.pow(o,n);a=e.mul(a,s);const c=e.mul(a,r),l=e.mul(e.sqr(a),i),u=e.eql(l,t);return{isValid:u,value:e.cmov(c,a,u)}}}return b}}(cne),Object.defineProperty(sne,"__esModule",{value:!0}),sne.getHash=hne,sne.createCurve=function(e,t){const n=t=>(0,dne.weierstrass)({...e,...hne(t)});return Object.freeze({...n(t),create:n})};const lne=ane,une=W9,dne=cne;function hne(e){return{hash:e,hmac:(t,...n)=>(0,lne.hmac)(e,t,(0,une.concatBytes)(...n)),randomBytes:une.randomBytes}}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;const t=Qte,n=W9,r=sne,i=Bte,o=Nee,s=Lee,a=cne,c=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),l=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),u=BigInt(1),d=BigInt(2),h=(e,t)=>(e+t/d)/t;function f(e){const t=c,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),a=BigInt(23),l=BigInt(44),u=BigInt(88),h=e*e*e%t,f=h*h*e%t,m=(0,o.pow2)(f,n,t)*f%t,g=(0,o.pow2)(m,n,t)*f%t,y=(0,o.pow2)(g,d,t)*h%t,b=(0,o.pow2)(y,i,t)*y%t,v=(0,o.pow2)(b,s,t)*b%t,w=(0,o.pow2)(v,l,t)*v%t,E=(0,o.pow2)(w,u,t)*w%t,_=(0,o.pow2)(E,l,t)*v%t,x=(0,o.pow2)(_,n,t)*f%t,k=(0,o.pow2)(x,a,t)*b%t,S=(0,o.pow2)(k,r,t)*h%t,C=(0,o.pow2)(S,d,t);if(!p.eql(p.sqr(C),e))throw new Error("Cannot find square root");return C}const p=(0,o.Field)(c,void 0,void 0,{sqrt:f});e.secp256k1=(0,r.createCurve)({a:BigInt(0),b:BigInt(7),Fp:p,n:l,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=l,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-u*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,a=BigInt("0x100000000000000000000000000000000"),c=h(s*e,t),d=h(-r*e,t);let f=(0,o.mod)(e-c*n-d*i,t),p=(0,o.mod)(-c*r-d*s,t);const m=f>a,g=p>a;if(m&&(f=t-f),g&&(p=t-p),f>a||p>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:m,k1:f,k2neg:g,k2:p}}}},t.sha256);const m=BigInt(0),g={};function y(e,...n){let r=g[e];if(void 0===r){const n=(0,t.sha256)(Uint8Array.from(e,e=>e.charCodeAt(0)));r=(0,s.concatBytes)(n,n),g[e]=r}return(0,t.sha256)((0,s.concatBytes)(r,...n))}const b=e=>e.toRawBytes(!0).slice(1),v=e=>(0,s.numberToBytesBE)(e,32),w=e=>(0,o.mod)(e,c),E=e=>(0,o.mod)(e,l),_=e.secp256k1.ProjectivePoint;function x(t){let n=e.secp256k1.utils.normPrivateKeyToScalar(t),r=_.fromPrivateKey(n);return{scalar:r.hasEvenY()?n:E(-n),bytes:b(r)}}function k(e){(0,s.aInRange)("x",e,u,c);const t=w(e*e);let n=f(w(t*e+BigInt(7)));n%d!==m&&(n=w(-n));const r=new _(e,n,u);return r.assertValidity(),r}const S=s.bytesToNumberBE;function C(...e){return E(S(y("BIP0340/challenge",...e)))}function I(e,t,n){const r=(0,s.ensureBytes)("signature",e,64),i=(0,s.ensureBytes)("message",t),o=(0,s.ensureBytes)("publicKey",n,32);try{const e=k(S(o)),t=S(r.subarray(0,32));if(!(0,s.inRange)(t,u,c))return!1;const n=S(r.subarray(32,64));if(!(0,s.inRange)(n,u,l))return!1;const a=C(v(t),b(e),i),d=((e,t,n)=>_.BASE.multiplyAndAddUnsafe(e,t,n))(e,n,E(-a));return!(!d||!d.hasEvenY()||d.toAffine().x!==t)}catch(a){return!1}}e.schnorr={getPublicKey:function(e){return x(e).bytes},sign:function(e,t,r=(0,n.randomBytes)(32)){const i=(0,s.ensureBytes)("message",e),{bytes:o,scalar:a}=x(t),c=(0,s.ensureBytes)("auxRand",r,32),l=v(a^S(y("BIP0340/aux",c))),u=y("BIP0340/nonce",l,o,i),d=E(S(u));if(d===m)throw new Error("sign failed: k is zero");const{bytes:h,scalar:f}=x(d),p=C(h,o,i),g=new Uint8Array(64);if(g.set(h,0),g.set(v(E(f+p*a)),32),!I(g,i,o))throw new Error("sign: Invalid signature produced");return g},verify:I,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:k,pointToBytes:b,numberToBytesBE:s.numberToBytesBE,bytesToNumberBE:s.bytesToNumberBE,taggedHash:y,mod:o.mod}};const A=(0,i.isogenyMap)(p,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(e=>e.map(e=>BigInt(e)))),P=(0,a.mapToCurveSimpleSWU)(p,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:p.create(BigInt("-11"))}),M=(0,i.createHasher)(e.secp256k1.ProjectivePoint,e=>{const{x:t,y:n}=P(p.create(e[0]));return A(t,n)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:p.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256});e.hashToCurve=M.hashToCurve,e.encodeToCurve=M.encodeToCurve}(Jte);var fne={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var t=m9;e.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e},e.decodeHex=function(n){return(0,t.hexToBytes)((0,e.remove0x)(n))}}(fne),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var t=O9,n=R9,r=Jte,i=S9,o=C9,s=fne;function a(e,t,i,o){if("secp256k1"===e)return t(r.secp256k1);if("x25519"===e)return i(n.x25519);if("ed25519"===e)return o(n.ed25519);throw new Error("Not implemented")}e.getValidSecret=function(){var n;do{n=(0,t.randomBytes)(o.SECRET_KEY_LENGTH)}while(!(0,e.isValidPrivateKey)(n));return n},e.isValidPrivateKey=function(e){return a((0,i.ellipticCurve)(),function(t){return t.utils.isValidPrivateKey(e)},function(){return!0},function(){return!0})},e.getPublicKey=function(e){return a((0,i.ellipticCurve)(),function(t){return t.getPublicKey(e)},function(t){return t.getPublicKey(e)},function(t){return t.getPublicKey(e)})},e.getSharedPoint=function(e,t,n){return a((0,i.ellipticCurve)(),function(r){return r.getSharedSecret(e,t,n)},function(n){return n.getSharedSecret(e,t)},function(n){return l(n,e,t)})},e.convertPublicKeyFormat=function(e,t){return a((0,i.ellipticCurve)(),function(n){return n.getSharedSecret(BigInt(1),e,t)},function(){return e},function(){return e})},e.hexToPublicKey=function(e){var t=(0,s.decodeHex)(e);return a((0,i.ellipticCurve)(),function(){return c(t)},function(){return t},function(){return t})};var c=function(e){if(e.length===o.ETH_PUBLIC_KEY_SIZE){var t=new Uint8Array(1+e.length);return t.set([4]),t.set(e,1),t}return e},l=function(e,t,n){var r=e.utils.getExtendedPublicKey(t).scalar;return e.ExtendedPoint.fromHex(n).multiply(r).toRawBytes()}}(M9);var pne={},mne={};Object.defineProperty(mne,"__esModule",{value:!0}),mne.hkdf=void 0,mne.extract=vne,mne.expand=_ne;const gne=B9,yne=W9,bne=ane;function vne(e,t,n){return(0,gne.hash)(e),void 0===n&&(n=new Uint8Array(e.outputLen)),(0,bne.hmac)(e,(0,yne.toBytes)(n),(0,yne.toBytes)(t))}const wne=new Uint8Array([0]),Ene=new Uint8Array;function _ne(e,t,n,r=32){if((0,gne.hash)(e),(0,gne.number)(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/e.outputLen);void 0===n&&(n=Ene);const o=new Uint8Array(i*e.outputLen),s=bne.hmac.create(e,t),a=s._cloneInto(),c=new Uint8Array(s.outputLen);for(let l=0;l<i;l++)wne[0]=l+1,a.update(0===l?Ene:c).update(n).update(wne).digestInto(c),o.set(c,e.outputLen*l),s._cloneInto(a);return s.destroy(),a.destroy(),c.fill(0),wne.fill(0),o.slice(0,r)}mne.hkdf=(e,t,n,r,i)=>_ne(e,vne(e,t,n),r,i),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var t=m9,n=mne,r=Qte;e.deriveKey=function(e,t,i){return(0,n.hkdf)(r.sha256,e,t,i,32)},e.getSharedKey=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(0,e.deriveKey)(t.concatBytes.apply(void 0,n))}}(pne);var xne={},kne={},Sne={},Cne={};Object.defineProperty(Cne,"__esModule",{value:!0}),Cne.polyval=Cne.ghash=void 0,Cne._toGHASHKey=Rne;const Ine=g9,Ane=m9,Pne=16,Mne=new Uint8Array(16),One=(0,Ane.u32)(Mne),Tne=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255;function Rne(e){e.reverse();const t=1&e[15];let n=0;for(let r=0;r<e.length;r++){const t=e[r];e[r]=t>>>1|n,n=(1&t)<<7}return e[0]^=225&-t,e}class Nne{constructor(e,t){this.blockLen=Pne,this.outputLen=Pne,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=(0,Ane.toBytes)(e),(0,Ine.bytes)(e,16);const n=(0,Ane.createView)(e);let r=n.getUint32(0,!1),i=n.getUint32(4,!1),o=n.getUint32(8,!1),s=n.getUint32(12,!1);const a=[];for(let y=0;y<128;y++)a.push({s0:Tne(r),s1:Tne(i),s2:Tne(o),s3:Tne(s)}),({s0:r,s1:i,s2:o,s3:s}={s3:(u=o)<<31|(d=s)>>>1,s2:(l=i)<<31|u>>>1,s1:(c=r)<<31|l>>>1,s0:c>>>1^225<<24&-(1&d)});var c,l,u,d;const h=(f=t||1024)>65536?8:f>1024?4:2;var f;if(![1,2,4,8].includes(h))throw new Error(`ghash: wrong window size=${h}, should be 2, 4 or 8`);this.W=h;const p=128/h,m=this.windowSize=2**h,g=[];for(let y=0;y<p;y++)for(let e=0;e<m;e++){let t=0,n=0,r=0,i=0;for(let o=0;o<h;o++){if(!(e>>>h-o-1&1))continue;const{s0:s,s1:c,s2:l,s3:u}=a[h*y+o];t^=s,n^=c,r^=l,i^=u}g.push({s0:t,s1:n,s2:r,s3:i})}this.t=g}_updateBlock(e,t,n,r){e^=this.s0,t^=this.s1,n^=this.s2,r^=this.s3;const{W:i,t:o,windowSize:s}=this;let a=0,c=0,l=0,u=0;const d=(1<<i)-1;let h=0;for(const f of[e,t,n,r])for(let e=0;e<4;e++){const t=f>>>8*e&255;for(let e=8/i-1;e>=0;e--){const n=t>>>i*e&d,{s0:r,s1:f,s2:p,s3:m}=o[h*s+n];a^=r,c^=f,l^=p,u^=m,h+=1}}this.s0=a,this.s1=c,this.s2=l,this.s3=u}update(e){e=(0,Ane.toBytes)(e),(0,Ine.exists)(this);const t=(0,Ane.u32)(e),n=Math.floor(e.length/Pne),r=e.length%Pne;for(let i=0;i<n;i++)this._updateBlock(t[4*i+0],t[4*i+1],t[4*i+2],t[4*i+3]);return r&&(Mne.set(e.subarray(n*Pne)),this._updateBlock(One[0],One[1],One[2],One[3]),(0,Ane.clean)(One)),this}destroy(){const{t:e}=this;for(const t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){(0,Ine.exists)(this),(0,Ine.output)(e,this),this.finished=!0;const{s0:t,s1:n,s2:r,s3:i}=this,o=(0,Ane.u32)(e);return o[0]=t,o[1]=n,o[2]=r,o[3]=i,e}digest(){const e=new Uint8Array(Pne);return this.digestInto(e),this.destroy(),e}}class Lne extends Nne{constructor(e,t){e=(0,Ane.toBytes)(e);const n=Rne((0,Ane.copyBytes)(e));super(n,t),(0,Ane.clean)(n)}update(e){e=(0,Ane.toBytes)(e),(0,Ine.exists)(this);const t=(0,Ane.u32)(e),n=e.length%Pne,r=Math.floor(e.length/Pne);for(let i=0;i<r;i++)this._updateBlock(Tne(t[4*i+3]),Tne(t[4*i+2]),Tne(t[4*i+1]),Tne(t[4*i+0]));return n&&(Mne.set(e.subarray(r*Pne)),this._updateBlock(Tne(One[3]),Tne(One[2]),Tne(One[1]),Tne(One[0])),(0,Ane.clean)(One)),this}digestInto(e){(0,Ine.exists)(this),(0,Ine.output)(e,this),this.finished=!0;const{s0:t,s1:n,s2:r,s3:i}=this,o=(0,Ane.u32)(e);return o[0]=t,o[1]=n,o[2]=r,o[3]=i,e.reverse()}}function Bne(e){const t=(t,n)=>e(n,t.length).update((0,Ane.toBytes)(t)).digest(),n=e(new Uint8Array(16),0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=(t,n)=>e(t,n),t}Cne.ghash=Bne((e,t)=>new Nne(e,t)),Cne.polyval=Bne((e,t)=>new Lne(e,t)),Object.defineProperty(Sne,"__esModule",{value:!0}),Sne.unsafe=Sne.aeskwp=Sne.aeskw=Sne.siv=Sne.gcm=Sne.cfb=Sne.cbc=Sne.ecb=Sne.ctr=void 0,Sne.expandKeyLE=Xne,Sne.expandKeyDecLE=ere;const jne=g9,Dne=Cne,Une=m9,Fne=16,$ne=new Uint8Array(Fne);function zne(e){return e<<1^283&-(e>>7)}function Hne(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(1&t),e=zne(e);return n}const qne=(()=>{const e=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=zne(r))e[n]=r;const t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=255&(r^r>>4^r>>5^r>>6^r>>7^99)}return(0,Une.clean)(e),t})(),Wne=qne.map((e,t)=>qne.indexOf(t)),Kne=e=>e<<24|e>>>8,Gne=e=>e<<8|e>>>24,Vne=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;function Zne(e,t){if(256!==e.length)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map((n,r)=>t(e[r])),r=n.map(Gne),i=r.map(Gne),o=i.map(Gne),s=new Uint32Array(65536),a=new Uint32Array(65536),c=new Uint16Array(65536);for(let l=0;l<256;l++)for(let t=0;t<256;t++){const u=256*l+t;s[u]=n[l]^r[t],a[u]=i[l]^o[t],c[u]=e[l]<<8|e[t]}return{sbox:e,sbox2:c,T0:n,T1:r,T2:i,T3:o,T01:s,T23:a}}const Yne=Zne(qne,e=>Hne(e,3)<<24|e<<16|e<<8|Hne(e,2)),Jne=Zne(Wne,e=>Hne(e,11)<<24|Hne(e,13)<<16|Hne(e,9)<<8|Hne(e,14)),Qne=(()=>{const e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=zne(n))e[t]=n;return e})();function Xne(e){(0,jne.bytes)(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:n}=Yne,r=[];(0,Une.isAligned32)(e)||r.push(e=(0,Une.copyBytes)(e));const i=(0,Une.u32)(e),o=i.length,s=e=>nre(n,e,e,e,e),a=new Uint32Array(t+28);a.set(i);for(let c=o;c<a.length;c++){let e=a[c-1];c%o==0?e=s(Kne(e))^Qne[c/o-1]:o>6&&c%o==4&&(e=s(e)),a[c]=a[c-o]^e}return(0,Une.clean)(...r),a}function ere(e){const t=Xne(e),n=t.slice(),r=t.length,{sbox2:i}=Yne,{T0:o,T1:s,T2:a,T3:c}=Jne;for(let l=0;l<r;l+=4)for(let e=0;e<4;e++)n[l+e]=t[r-l-4+e];(0,Une.clean)(t);for(let l=4;l<r-4;l++){const e=n[l],t=nre(i,e,e,e,e);n[l]=o[255&t]^s[t>>>8&255]^a[t>>>16&255]^c[t>>>24]}return n}function tre(e,t,n,r,i,o){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|o>>>24&255]}function nre(e,t,n,r,i){return e[255&t|65280&n]|e[r>>>16&255|i>>>16&65280]<<16}function rre(e,t,n,r,i){const{sbox2:o,T01:s,T23:a}=Yne;let c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];const l=e.length/4-2;for(let u=0;u<l;u++){const o=e[c++]^tre(s,a,t,n,r,i),l=e[c++]^tre(s,a,n,r,i,t),u=e[c++]^tre(s,a,r,i,t,n),d=e[c++]^tre(s,a,i,t,n,r);t=o,n=l,r=u,i=d}return{s0:e[c++]^nre(o,t,n,r,i),s1:e[c++]^nre(o,n,r,i,t),s2:e[c++]^nre(o,r,i,t,n),s3:e[c++]^nre(o,i,t,n,r)}}function ire(e,t,n,r,i){const{sbox2:o,T01:s,T23:a}=Jne;let c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];const l=e.length/4-2;for(let u=0;u<l;u++){const o=e[c++]^tre(s,a,t,i,r,n),l=e[c++]^tre(s,a,n,t,i,r),u=e[c++]^tre(s,a,r,n,t,i),d=e[c++]^tre(s,a,i,r,n,t);t=o,n=l,r=u,i=d}return{s0:e[c++]^nre(o,t,i,r,n),s1:e[c++]^nre(o,n,t,i,r),s2:e[c++]^nre(o,r,n,t,i),s3:e[c++]^nre(o,i,r,n,t)}}function ore(e,t){if(void 0===t)return new Uint8Array(e);if((0,jne.bytes)(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);if(!(0,Une.isAligned32)(t))throw new Error("unaligned dst");return t}function sre(e,t,n,r){(0,jne.bytes)(t,Fne),(0,jne.bytes)(n);const i=n.length;r=ore(i,r);const o=t,s=(0,Une.u32)(o);let{s0:a,s1:c,s2:l,s3:u}=rre(e,s[0],s[1],s[2],s[3]);const d=(0,Une.u32)(n),h=(0,Une.u32)(r);for(let p=0;p+4<=d.length;p+=4){h[p+0]=d[p+0]^a,h[p+1]=d[p+1]^c,h[p+2]=d[p+2]^l,h[p+3]=d[p+3]^u;let t=1;for(let e=o.length-1;e>=0;e--)t=t+(255&o[e])|0,o[e]=255&t,t>>>=8;({s0:a,s1:c,s2:l,s3:u}=rre(e,s[0],s[1],s[2],s[3]))}const f=Fne*Math.floor(d.length/4);if(f<i){const e=new Uint32Array([a,c,l,u]),t=(0,Une.u8)(e);for(let o=f,s=0;o<i;o++,s++)r[o]=n[o]^t[s];(0,Une.clean)(e)}return r}function are(e,t,n,r,i){(0,jne.bytes)(n,Fne),(0,jne.bytes)(r),i=ore(r.length,i);const o=n,s=(0,Une.u32)(o),a=(0,Une.createView)(o),c=(0,Une.u32)(r),l=(0,Une.u32)(i),u=t?0:12,d=r.length;let h=a.getUint32(u,t),{s0:f,s1:p,s2:m,s3:g}=rre(e,s[0],s[1],s[2],s[3]);for(let b=0;b+4<=c.length;b+=4)l[b+0]=c[b+0]^f,l[b+1]=c[b+1]^p,l[b+2]=c[b+2]^m,l[b+3]=c[b+3]^g,h=h+1>>>0,a.setUint32(u,h,t),({s0:f,s1:p,s2:m,s3:g}=rre(e,s[0],s[1],s[2],s[3]));const y=Fne*Math.floor(c.length/4);if(y<d){const e=new Uint32Array([f,p,m,g]),t=(0,Une.u8)(e);for(let n=y,o=0;n<d;n++,o++)i[n]=r[n]^t[o];(0,Une.clean)(e)}return i}function cre(e){if((0,jne.bytes)(e),e.length%Fne!=0)throw new Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function lre(e,t,n){(0,jne.bytes)(e);let r=e.length;const i=r%Fne;if(!t&&0!==i)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,Une.isAligned32)(e)||(e=(0,Une.copyBytes)(e));const o=(0,Une.u32)(e);if(t){let e=Fne-i;e||(e=Fne),r+=e}const s=ore(r,n);return{b:o,o:(0,Une.u32)(s),out:s}}function ure(e,t){if(!t)return e;const n=e.length;if(!n)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=e[n-1];if(r<=0||r>16)throw new Error("aes/pcks5: wrong padding");const i=e.subarray(0,-r);for(let o=0;o<r;o++)if(e[n-o-1]!==r)throw new Error("aes/pcks5: wrong padding");return i}function dre(e){const t=new Uint8Array(16),n=(0,Une.u32)(t);t.set(e);const r=Fne-e.length;for(let i=Fne-r;i<Fne;i++)t[i]=r;return n}function hre(e,t,n,r,i){const o=null==i?0:i.length,s=e.create(n,r.length+o);i&&s.update(i),s.update(r);const a=new Uint8Array(16),c=(0,Une.createView)(a);i&&(0,Une.setBigUint64)(c,0,BigInt(8*o),t),(0,Une.setBigUint64)(c,8,BigInt(8*r.length),t),s.update(a);const l=s.digest();return(0,Une.clean)(a),l}Sne.ctr=(0,Une.wrapCipher)({blockSize:16,nonceLength:16},function(e,t){function n(n,r){if((0,jne.bytes)(n),void 0!==r&&((0,jne.bytes)(r),!(0,Une.isAligned32)(r)))throw new Error("unaligned destination");const i=Xne(e),o=(0,Une.copyBytes)(t),s=[i,o];(0,Une.isAligned32)(n)||s.push(n=(0,Une.copyBytes)(n));const a=sre(i,o,n,r);return(0,Une.clean)(...s),a}return(0,jne.bytes)(e),(0,jne.bytes)(t,Fne),{encrypt:(e,t)=>n(e,t),decrypt:(e,t)=>n(e,t)}}),Sne.ecb=(0,Une.wrapCipher)({blockSize:16},function(e,t={}){(0,jne.bytes)(e);const n=!t.disablePadding;return{encrypt(t,r){const{b:i,o:o,out:s}=lre(t,n,r),a=Xne(e);let c=0;for(;c+4<=i.length;){const{s0:e,s1:t,s2:n,s3:r}=rre(a,i[c+0],i[c+1],i[c+2],i[c+3]);o[c++]=e,o[c++]=t,o[c++]=n,o[c++]=r}if(n){const e=dre(t.subarray(4*c)),{s0:n,s1:r,s2:i,s3:s}=rre(a,e[0],e[1],e[2],e[3]);o[c++]=n,o[c++]=r,o[c++]=i,o[c++]=s}return(0,Une.clean)(a),s},decrypt(t,r){cre(t);const i=ere(e),o=ore(t.length,r),s=[i];(0,Une.isAligned32)(t)||s.push(t=(0,Une.copyBytes)(t));const a=(0,Une.u32)(t),c=(0,Une.u32)(o);for(let e=0;e+4<=a.length;){const{s0:t,s1:n,s2:r,s3:o}=ire(i,a[e+0],a[e+1],a[e+2],a[e+3]);c[e++]=t,c[e++]=n,c[e++]=r,c[e++]=o}return(0,Une.clean)(...s),ure(o,n)}}}),Sne.cbc=(0,Une.wrapCipher)({blockSize:16,nonceLength:16},function(e,t,n={}){(0,jne.bytes)(e),(0,jne.bytes)(t,16);const r=!n.disablePadding;return{encrypt(n,i){const o=Xne(e),{b:s,o:a,out:c}=lre(n,r,i);let l=t;const u=[o];(0,Une.isAligned32)(l)||u.push(l=(0,Une.copyBytes)(l));const d=(0,Une.u32)(l);let h=d[0],f=d[1],p=d[2],m=d[3],g=0;for(;g+4<=s.length;)h^=s[g+0],f^=s[g+1],p^=s[g+2],m^=s[g+3],({s0:h,s1:f,s2:p,s3:m}=rre(o,h,f,p,m)),a[g++]=h,a[g++]=f,a[g++]=p,a[g++]=m;if(r){const e=dre(n.subarray(4*g));h^=e[0],f^=e[1],p^=e[2],m^=e[3],({s0:h,s1:f,s2:p,s3:m}=rre(o,h,f,p,m)),a[g++]=h,a[g++]=f,a[g++]=p,a[g++]=m}return(0,Une.clean)(...u),c},decrypt(n,i){cre(n);const o=ere(e);let s=t;const a=[o];(0,Une.isAligned32)(s)||a.push(s=(0,Une.copyBytes)(s));const c=(0,Une.u32)(s),l=ore(n.length,i);(0,Une.isAligned32)(n)||a.push(n=(0,Une.copyBytes)(n));const u=(0,Une.u32)(n),d=(0,Une.u32)(l);let h=c[0],f=c[1],p=c[2],m=c[3];for(let e=0;e+4<=u.length;){const t=h,n=f,r=p,i=m;h=u[e+0],f=u[e+1],p=u[e+2],m=u[e+3];const{s0:s,s1:a,s2:c,s3:l}=ire(o,h,f,p,m);d[e++]=s^t,d[e++]=a^n,d[e++]=c^r,d[e++]=l^i}return(0,Une.clean)(...a),ure(l,r)}}}),Sne.cfb=(0,Une.wrapCipher)({blockSize:16,nonceLength:16},function(e,t){function n(n,r,i){(0,jne.bytes)(n);const o=n.length;i=ore(o,i);const s=Xne(e);let a=t;const c=[s];(0,Une.isAligned32)(a)||c.push(a=(0,Une.copyBytes)(a)),(0,Une.isAligned32)(n)||c.push(n=(0,Une.copyBytes)(n));const l=(0,Une.u32)(n),u=(0,Une.u32)(i),d=r?u:l,h=(0,Une.u32)(a);let f=h[0],p=h[1],m=h[2],g=h[3];for(let e=0;e+4<=l.length;){const{s0:t,s1:n,s2:r,s3:i}=rre(s,f,p,m,g);u[e+0]=l[e+0]^t,u[e+1]=l[e+1]^n,u[e+2]=l[e+2]^r,u[e+3]=l[e+3]^i,f=d[e++],p=d[e++],m=d[e++],g=d[e++]}const y=Fne*Math.floor(l.length/4);if(y<o){({s0:f,s1:p,s2:m,s3:g}=rre(s,f,p,m,g));const e=(0,Une.u8)(new Uint32Array([f,p,m,g]));for(let t=y,r=0;t<o;t++,r++)i[t]=n[t]^e[r];(0,Une.clean)(e)}return(0,Une.clean)(...c),i}return(0,jne.bytes)(e),(0,jne.bytes)(t,16),{encrypt:(e,t)=>n(e,!0,t),decrypt:(e,t)=>n(e,!1,t)}}),Sne.gcm=(0,Une.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){if((0,jne.bytes)(e),(0,jne.bytes)(t),void 0!==n&&(0,jne.bytes)(n),t.length<8)throw new Error("aes/gcm: invalid nonce length");function r(e,t,r){const i=hre(Dne.ghash,!1,e,r,n);for(let n=0;n<t.length;n++)i[n]^=t[n];return i}function i(){const n=Xne(e),r=$ne.slice(),i=$ne.slice();if(are(n,!1,i,i,r),12===t.length)i.set(t);else{const e=$ne.slice(),n=(0,Une.createView)(e);(0,Une.setBigUint64)(n,8,BigInt(8*t.length),!1);const o=Dne.ghash.create(r).update(t).update(e);o.digestInto(i),o.destroy()}return{xk:n,authKey:r,counter:i,tagMask:are(n,!1,i,$ne)}}return{encrypt(e){(0,jne.bytes)(e);const{xk:t,authKey:n,counter:o,tagMask:s}=i(),a=new Uint8Array(e.length+16),c=[t,n,o,s];(0,Une.isAligned32)(e)||c.push(e=(0,Une.copyBytes)(e)),are(t,!1,o,e,a);const l=r(n,s,a.subarray(0,a.length-16));return c.push(l),a.set(l,e.length),(0,Une.clean)(...c),a},decrypt(e){if((0,jne.bytes)(e),e.length<16)throw new Error("aes/gcm: ciphertext less than tagLen (16)");const{xk:t,authKey:n,counter:o,tagMask:s}=i(),a=[t,n,s,o];(0,Une.isAligned32)(e)||a.push(e=(0,Une.copyBytes)(e));const c=e.subarray(0,-16),l=e.subarray(-16),u=r(n,s,c);if(a.push(u),!(0,Une.equalBytes)(u,l))throw new Error("aes/gcm: invalid ghash tag");const d=are(t,!1,o,c);return(0,Une.clean)(...a),d}}});const fre=(e,t,n)=>r=>{if(!Number.isSafeInteger(r)||t>r||r>n)throw new Error(`${e}: invalid value=${r}, must be [${t}..${n}]`)};function pre(e){return null!=e&&"object"==typeof e&&(e instanceof Uint32Array||"Uint32Array"===e.constructor.name)}function mre(e,t){if((0,jne.bytes)(t,16),!pre(e))throw new Error("_encryptBlock accepts result of expandKeyLE");const n=(0,Une.u32)(t);let{s0:r,s1:i,s2:o,s3:s}=rre(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=s,t}function gre(e,t){if((0,jne.bytes)(t,16),!pre(e))throw new Error("_decryptBlock accepts result of expandKeyLE");const n=(0,Une.u32)(t);let{s0:r,s1:i,s2:o,s3:s}=ire(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=s,t}Sne.siv=(0,Une.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){const r=fre("AAD",0,2**36),i=fre("plaintext",0,2**36),o=fre("nonce",12,12),s=fre("ciphertext",16,2**36+16);function a(){const n=Xne(e),r=new Uint8Array(e.length),i=new Uint8Array(16),o=[n,r];let s=t;(0,Une.isAligned32)(s)||o.push(s=(0,Une.copyBytes)(s));const a=(0,Une.u32)(s);let c=0,l=a[0],u=a[1],d=a[2],h=0;for(const e of[i,r].map(Une.u32)){const t=(0,Une.u32)(e);for(let e=0;e<t.length;e+=2){const{s0:r,s1:i}=rre(n,c,l,u,d);t[e+0]=r,t[e+1]=i,c=++h}}const f={authKey:i,encKey:Xne(r)};return(0,Une.clean)(...o),f}function c(e,r,i){const o=hre(Dne.polyval,!0,r,i,n);for(let n=0;n<12;n++)o[n]^=t[n];o[15]&=127;const s=(0,Une.u32)(o);let a=s[0],c=s[1],l=s[2],u=s[3];return({s0:a,s1:c,s2:l,s3:u}=rre(e,a,c,l,u)),s[0]=a,s[1]=c,s[2]=l,s[3]=u,o}function l(e,t,n){let r=(0,Une.copyBytes)(t);r[15]|=128;const i=are(e,!0,r,n);return(0,Une.clean)(r),i}return(0,jne.bytes)(e,16,24,32),(0,jne.bytes)(t),o(t.length),void 0!==n&&((0,jne.bytes)(n),r(n.length)),{encrypt(e){(0,jne.bytes)(e),i(e.length);const{encKey:t,authKey:n}=a(),r=c(t,n,e),o=[t,n,r];(0,Une.isAligned32)(e)||o.push(e=(0,Une.copyBytes)(e));const s=new Uint8Array(e.length+16);return s.set(r,e.length),s.set(l(t,r,e)),(0,Une.clean)(...o),s},decrypt(e){(0,jne.bytes)(e),s(e.length);const t=e.subarray(-16),{encKey:n,authKey:r}=a(),i=[n,r];(0,Une.isAligned32)(e)||i.push(e=(0,Une.copyBytes)(e));const o=l(n,t,e.subarray(0,-16)),u=c(n,r,o);if(i.push(u),!(0,Une.equalBytes)(t,u))throw(0,Une.clean)(...i),new Error("invalid polyval tag");return(0,Une.clean)(...i),o}}});const yre={encrypt(e,t){if(t.length>=2**32)throw new Error("plaintext should be less than 4gb");const n=Xne(e);if(16===t.length)mre(n,t);else{const e=(0,Une.u32)(t);let r=e[0],i=e[1];for(let t=0,o=1;t<6;t++)for(let s=2;s<e.length;s+=2,o++){const{s0:t,s1:a,s2:c,s3:l}=rre(n,r,i,e[s],e[s+1]);r=t,i=a^Vne(o),e[s]=c,e[s+1]=l}e[0]=r,e[1]=i}n.fill(0)},decrypt(e,t){if(t.length-8>=2**32)throw new Error("ciphertext should be less than 4gb");const n=ere(e),r=t.length/8-1;if(1===r)gre(n,t);else{const e=(0,Une.u32)(t);let i=e[0],o=e[1];for(let t=0,s=6*r;t<6;t++)for(let a=2*r;a>=1;a-=2,s--){o^=Vne(s);const{s0:t,s1:r,s2:c,s3:l}=ire(n,i,o,e[a],e[a+1]);i=t,o=r,e[a]=c,e[a+1]=l}e[0]=i,e[1]=o}n.fill(0)}},bre=new Uint8Array(8).fill(166);Sne.aeskw=(0,Une.wrapCipher)({blockSize:8},e=>({encrypt(t){if((0,jne.bytes)(t),!t.length||t.length%8!=0)throw new Error("invalid plaintext length");if(8===t.length)throw new Error("8-byte keys not allowed in AESKW, use AESKWP instead");const n=(0,Une.concatBytes)(bre,t);return yre.encrypt(e,n),n},decrypt(t){if((0,jne.bytes)(t),t.length%8!=0||t.length<24)throw new Error("invalid ciphertext length");const n=(0,Une.copyBytes)(t);if(yre.decrypt(e,n),!(0,Une.equalBytes)(n.subarray(0,8),bre))throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8)}}));const vre=2790873510;Sne.aeskwp=(0,Une.wrapCipher)({blockSize:8},e=>({encrypt(t){if((0,jne.bytes)(t),!t.length)throw new Error("invalid plaintext length");const n=8*Math.ceil(t.length/8),r=new Uint8Array(8+n);r.set(t,8);const i=(0,Une.u32)(r);return i[0]=vre,i[1]=Vne(t.length),yre.encrypt(e,r),r},decrypt(t){if((0,jne.bytes)(t),t.length<16)throw new Error("invalid ciphertext length");const n=(0,Une.copyBytes)(t),r=(0,Une.u32)(n);yre.decrypt(e,n);const i=Vne(r[1])>>>0,o=8*Math.ceil(i/8);if(r[0]!==vre||n.length-8!==o)throw new Error("integrity check failed");for(let e=i;e<o;e++)if(0!==n[8+e])throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8,8+i)}})),Sne.unsafe={expandKeyLE:Xne,expandKeyDecLE:ere,encrypt:rre,decrypt:ire,encryptBlock:mre,decryptBlock:gre,ctrCounter:sre,ctr32:are},Object.defineProperty(kne,"__esModule",{value:!0}),kne.aes256cbc=kne.aes256gcm=void 0;var wre=Sne;kne.aes256gcm=function(e,t,n){return(0,wre.gcm)(e,t,n)},kne.aes256cbc=function(e,t,n){return(0,wre.cbc)(e,t)};var Ere={},_re={},xre={};Object.defineProperty(xre,"__esModule",{value:!0}),xre.sigma=void 0,xre.rotl=function(e,t){return e<<t|e>>>32-t},xre.createCipher=function(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:s}=(0,Sre.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw new Error("core must be a function");return(0,kre.number)(i),(0,kre.number)(s),(0,kre.bool)(o),(0,kre.bool)(n),(t,a,c,l,u=0)=>{(0,kre.bytes)(t),(0,kre.bytes)(a),(0,kre.bytes)(c);const d=c.length;if(void 0===l&&(l=new Uint8Array(d)),(0,kre.bytes)(l),(0,kre.number)(u),u<0||u>=Nre)throw new Error("arx: counter overflow");if(l.length<d)throw new Error(`arx: output (${l.length}) is shorter than data (${d})`);const h=[];let f,p,m=t.length;if(32===m)h.push(f=(0,Sre.copyBytes)(t)),p=Mre;else{if(16!==m||!n)throw new Error(`arx: invalid 32-byte key, got length=${m}`);f=new Uint8Array(32),f.set(t),f.set(t,16),p=Pre,h.push(f)}Ore(a)||h.push(a=(0,Sre.copyBytes)(a));const g=(0,Sre.u32)(f);if(r){if(24!==a.length)throw new Error("arx: extended nonce must be 24 bytes");r(p,g,(0,Sre.u32)(a.subarray(0,16)),g),a=a.subarray(16)}const y=16-i;if(y!==a.length)throw new Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){const e=new Uint8Array(12);e.set(a,o?0:12-a.length),a=e,h.push(a)}const b=(0,Sre.u32)(a);return function(e,t,n,r,i,o,s,a){const c=i.length,l=new Uint8Array(Tre),u=(0,Sre.u32)(l),d=Ore(i)&&Ore(o),h=d?(0,Sre.u32)(i):Lre,f=d?(0,Sre.u32)(o):Lre;for(let p=0;p<c;s++){if(e(t,n,r,u,s,a),s>=Nre)throw new Error("arx: counter overflow");const m=Math.min(Tre,c-p);if(d&&m===Tre){const e=p/4;if(p%4!=0)throw new Error("arx: invalid block position");for(let t,n=0;n<Rre;n++)t=e+n,f[t]=h[t]^u[n];p+=Tre}else{for(let e,t=0;t<m;t++)e=p+t,o[e]=i[e]^l[t];p+=m}}}(e,p,g,b,c,l,u,s),(0,Sre.clean)(...h),l}};const kre=g9,Sre=m9,Cre=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),Ire=Cre("expand 16-byte k"),Are=Cre("expand 32-byte k"),Pre=(0,Sre.u32)(Ire),Mre=(0,Sre.u32)(Are);function Ore(e){return e.byteOffset%4==0}xre.sigma=Mre.slice();const Tre=64,Rre=16,Nre=2**32-1,Lre=new Uint32Array;var Bre={};Object.defineProperty(Bre,"__esModule",{value:!0}),Bre.poly1305=void 0,Bre.wrapConstructorWithKey=$re;const jre=g9,Dre=m9,Ure=(e,t)=>255&e[t++]|(255&e[t++])<<8;class Fre{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=(0,Dre.toBytes)(e),(0,jre.bytes)(e,32);const t=Ure(e,0),n=Ure(e,2),r=Ure(e,4),i=Ure(e,6),o=Ure(e,8),s=Ure(e,10),a=Ure(e,12),c=Ure(e,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|n<<3),this.r[2]=7939&(n>>>10|r<<6),this.r[3]=8191&(r>>>7|i<<9),this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,this.r[6]=8191&(o>>>14|s<<2),this.r[7]=8065&(s>>>11|a<<5),this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127;for(let l=0;l<8;l++)this.pad[l]=Ure(e,16+2*l)}process(e,t,n=!1){const r=n?0:2048,{h:i,r:o}=this,s=o[0],a=o[1],c=o[2],l=o[3],u=o[4],d=o[5],h=o[6],f=o[7],p=o[8],m=o[9],g=Ure(e,t+0),y=Ure(e,t+2),b=Ure(e,t+4),v=Ure(e,t+6),w=Ure(e,t+8),E=Ure(e,t+10),_=Ure(e,t+12),x=Ure(e,t+14);let k=i[0]+(8191&g),S=i[1]+(8191&(g>>>13|y<<3)),C=i[2]+(8191&(y>>>10|b<<6)),I=i[3]+(8191&(b>>>7|v<<9)),A=i[4]+(8191&(v>>>4|w<<12)),P=i[5]+(w>>>1&8191),M=i[6]+(8191&(w>>>14|E<<2)),O=i[7]+(8191&(E>>>11|_<<5)),T=i[8]+(8191&(_>>>8|x<<8)),R=i[9]+(x>>>5|r),N=0,L=N+k*s+S*(5*m)+C*(5*p)+I*(5*f)+A*(5*h);N=L>>>13,L&=8191,L+=P*(5*d)+M*(5*u)+O*(5*l)+T*(5*c)+R*(5*a),N+=L>>>13,L&=8191;let B=N+k*a+S*s+C*(5*m)+I*(5*p)+A*(5*f);N=B>>>13,B&=8191,B+=P*(5*h)+M*(5*d)+O*(5*u)+T*(5*l)+R*(5*c),N+=B>>>13,B&=8191;let j=N+k*c+S*a+C*s+I*(5*m)+A*(5*p);N=j>>>13,j&=8191,j+=P*(5*f)+M*(5*h)+O*(5*d)+T*(5*u)+R*(5*l),N+=j>>>13,j&=8191;let D=N+k*l+S*c+C*a+I*s+A*(5*m);N=D>>>13,D&=8191,D+=P*(5*p)+M*(5*f)+O*(5*h)+T*(5*d)+R*(5*u),N+=D>>>13,D&=8191;let U=N+k*u+S*l+C*c+I*a+A*s;N=U>>>13,U&=8191,U+=P*(5*m)+M*(5*p)+O*(5*f)+T*(5*h)+R*(5*d),N+=U>>>13,U&=8191;let F=N+k*d+S*u+C*l+I*c+A*a;N=F>>>13,F&=8191,F+=P*s+M*(5*m)+O*(5*p)+T*(5*f)+R*(5*h),N+=F>>>13,F&=8191;let $=N+k*h+S*d+C*u+I*l+A*c;N=$>>>13,$&=8191,$+=P*a+M*s+O*(5*m)+T*(5*p)+R*(5*f),N+=$>>>13,$&=8191;let z=N+k*f+S*h+C*d+I*u+A*l;N=z>>>13,z&=8191,z+=P*c+M*a+O*s+T*(5*m)+R*(5*p),N+=z>>>13,z&=8191;let H=N+k*p+S*f+C*h+I*d+A*u;N=H>>>13,H&=8191,H+=P*l+M*c+O*a+T*s+R*(5*m),N+=H>>>13,H&=8191;let q=N+k*m+S*p+C*f+I*h+A*d;N=q>>>13,q&=8191,q+=P*u+M*l+O*c+T*a+R*s,N+=q>>>13,q&=8191,N=(N<<2)+N|0,N=N+L|0,L=8191&N,N>>>=13,B+=N,i[0]=L,i[1]=B,i[2]=j,i[3]=D,i[4]=U,i[5]=F,i[6]=$,i[7]=z,i[8]=H,i[9]=q}finalize(){const{h:e,pad:t}=this,n=new Uint16Array(10);let r=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=r,r=e[s]>>>13,e[s]&=8191;e[0]+=5*r,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,n[0]=e[0]+5,r=n[0]>>>13,n[0]&=8191;for(let s=1;s<10;s++)n[s]=e[s]+r,r=n[s]>>>13,n[s]&=8191;n[9]-=8192;let i=(1^r)-1;for(let s=0;s<10;s++)n[s]&=i;i=~i;for(let s=0;s<10;s++)e[s]=e[s]&i|n[s];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let o=e[0]+t[0];e[0]=65535&o;for(let s=1;s<8;s++)o=(e[s]+t[s]|0)+(o>>>16)|0,e[s]=65535&o;(0,Dre.clean)(n)}update(e){(0,jre.exists)(this);const{buffer:t,blockLen:n}=this,r=(e=(0,Dre.toBytes)(e)).length;for(let i=0;i<r;){const o=Math.min(n-this.pos,r-i);if(o!==n)t.set(e.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===n&&(this.process(t,0,!1),this.pos=0);else for(;n<=r-i;i+=n)this.process(e,i)}return this}destroy(){(0,Dre.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(e){(0,jre.exists)(this),(0,jre.output)(e,this),this.finished=!0;const{buffer:t,h:n}=this;let{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)e[i++]=n[o]>>>0,e[i++]=n[o]>>>8;return e}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}}function $re(e){const t=(t,n)=>e(n).update((0,Dre.toBytes)(t)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}Bre.poly1305=$re(e=>new Fre(e)),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.xchacha20poly1305=e.chacha20poly1305=e._poly1305_aead=e.chacha12=e.chacha8=e.xchacha20=e.chacha20=e.chacha20orig=void 0,e.hchacha=s;const t=xre,n=g9,r=Bre,i=m9;function o(e,n,r,i,o,s=20){let a=e[0],c=e[1],l=e[2],u=e[3],d=n[0],h=n[1],f=n[2],p=n[3],m=n[4],g=n[5],y=n[6],b=n[7],v=o,w=r[0],E=r[1],_=r[2],x=a,k=c,S=l,C=u,I=d,A=h,P=f,M=p,O=m,T=g,R=y,N=b,L=v,B=w,j=E,D=_;for(let F=0;F<s;F+=2)x=x+I|0,L=(0,t.rotl)(L^x,16),O=O+L|0,I=(0,t.rotl)(I^O,12),x=x+I|0,L=(0,t.rotl)(L^x,8),O=O+L|0,I=(0,t.rotl)(I^O,7),k=k+A|0,B=(0,t.rotl)(B^k,16),T=T+B|0,A=(0,t.rotl)(A^T,12),k=k+A|0,B=(0,t.rotl)(B^k,8),T=T+B|0,A=(0,t.rotl)(A^T,7),S=S+P|0,j=(0,t.rotl)(j^S,16),R=R+j|0,P=(0,t.rotl)(P^R,12),S=S+P|0,j=(0,t.rotl)(j^S,8),R=R+j|0,P=(0,t.rotl)(P^R,7),C=C+M|0,D=(0,t.rotl)(D^C,16),N=N+D|0,M=(0,t.rotl)(M^N,12),C=C+M|0,D=(0,t.rotl)(D^C,8),N=N+D|0,M=(0,t.rotl)(M^N,7),x=x+A|0,D=(0,t.rotl)(D^x,16),R=R+D|0,A=(0,t.rotl)(A^R,12),x=x+A|0,D=(0,t.rotl)(D^x,8),R=R+D|0,A=(0,t.rotl)(A^R,7),k=k+P|0,L=(0,t.rotl)(L^k,16),N=N+L|0,P=(0,t.rotl)(P^N,12),k=k+P|0,L=(0,t.rotl)(L^k,8),N=N+L|0,P=(0,t.rotl)(P^N,7),S=S+M|0,B=(0,t.rotl)(B^S,16),O=O+B|0,M=(0,t.rotl)(M^O,12),S=S+M|0,B=(0,t.rotl)(B^S,8),O=O+B|0,M=(0,t.rotl)(M^O,7),C=C+I|0,j=(0,t.rotl)(j^C,16),T=T+j|0,I=(0,t.rotl)(I^T,12),C=C+I|0,j=(0,t.rotl)(j^C,8),T=T+j|0,I=(0,t.rotl)(I^T,7);let U=0;i[U++]=a+x|0,i[U++]=c+k|0,i[U++]=l+S|0,i[U++]=u+C|0,i[U++]=d+I|0,i[U++]=h+A|0,i[U++]=f+P|0,i[U++]=p+M|0,i[U++]=m+O|0,i[U++]=g+T|0,i[U++]=y+R|0,i[U++]=b+N|0,i[U++]=v+L|0,i[U++]=w+B|0,i[U++]=E+j|0,i[U++]=_+D|0}function s(e,n,r,i){let o=e[0],s=e[1],a=e[2],c=e[3],l=n[0],u=n[1],d=n[2],h=n[3],f=n[4],p=n[5],m=n[6],g=n[7],y=r[0],b=r[1],v=r[2],w=r[3];for(let _=0;_<20;_+=2)o=o+l|0,y=(0,t.rotl)(y^o,16),f=f+y|0,l=(0,t.rotl)(l^f,12),o=o+l|0,y=(0,t.rotl)(y^o,8),f=f+y|0,l=(0,t.rotl)(l^f,7),s=s+u|0,b=(0,t.rotl)(b^s,16),p=p+b|0,u=(0,t.rotl)(u^p,12),s=s+u|0,b=(0,t.rotl)(b^s,8),p=p+b|0,u=(0,t.rotl)(u^p,7),a=a+d|0,v=(0,t.rotl)(v^a,16),m=m+v|0,d=(0,t.rotl)(d^m,12),a=a+d|0,v=(0,t.rotl)(v^a,8),m=m+v|0,d=(0,t.rotl)(d^m,7),c=c+h|0,w=(0,t.rotl)(w^c,16),g=g+w|0,h=(0,t.rotl)(h^g,12),c=c+h|0,w=(0,t.rotl)(w^c,8),g=g+w|0,h=(0,t.rotl)(h^g,7),o=o+u|0,w=(0,t.rotl)(w^o,16),m=m+w|0,u=(0,t.rotl)(u^m,12),o=o+u|0,w=(0,t.rotl)(w^o,8),m=m+w|0,u=(0,t.rotl)(u^m,7),s=s+d|0,y=(0,t.rotl)(y^s,16),g=g+y|0,d=(0,t.rotl)(d^g,12),s=s+d|0,y=(0,t.rotl)(y^s,8),g=g+y|0,d=(0,t.rotl)(d^g,7),a=a+h|0,b=(0,t.rotl)(b^a,16),f=f+b|0,h=(0,t.rotl)(h^f,12),a=a+h|0,b=(0,t.rotl)(b^a,8),f=f+b|0,h=(0,t.rotl)(h^f,7),c=c+l|0,v=(0,t.rotl)(v^c,16),p=p+v|0,l=(0,t.rotl)(l^p,12),c=c+l|0,v=(0,t.rotl)(v^c,8),p=p+v|0,l=(0,t.rotl)(l^p,7);let E=0;i[E++]=o,i[E++]=s,i[E++]=a,i[E++]=c,i[E++]=y,i[E++]=b,i[E++]=v,i[E++]=w}e.chacha20orig=(0,t.createCipher)(o,{counterRight:!1,counterLength:8,allowShortKeys:!0}),e.chacha20=(0,t.createCipher)(o,{counterRight:!1,counterLength:4,allowShortKeys:!1}),e.xchacha20=(0,t.createCipher)(o,{counterRight:!1,counterLength:8,extendNonceFn:s,allowShortKeys:!1}),e.chacha8=(0,t.createCipher)(o,{counterRight:!1,counterLength:4,rounds:8}),e.chacha12=(0,t.createCipher)(o,{counterRight:!1,counterLength:4,rounds:12});const a=new Uint8Array(16),c=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(a.subarray(n))},l=new Uint8Array(32);function u(e,t,n,o,s){const a=e(t,n,l),u=r.poly1305.create(a);s&&c(u,s),c(u,o);const d=new Uint8Array(16),h=(0,i.createView)(d);(0,i.setBigUint64)(h,0,BigInt(s?s.length:0),!0),(0,i.setBigUint64)(h,8,BigInt(o.length),!0),u.update(d);const f=u.digest();return(0,i.clean)(a,d),f}e._poly1305_aead=e=>(t,r,o)=>((0,n.bytes)(t,32),(0,n.bytes)(r),{encrypt(s,a){const c=s.length,l=c+16;a?(0,n.bytes)(a,l):a=new Uint8Array(l),e(t,r,s,a,1);const d=u(e,t,r,a.subarray(0,-16),o);return a.set(d,c),(0,i.clean)(d),a},decrypt(s,a){const c=s.length,l=c-16;if(c<16)throw new Error("encrypted data must be at least 16 bytes");a?(0,n.bytes)(a,l):a=new Uint8Array(l);const d=s.subarray(0,-16),h=s.subarray(-16),f=u(e,t,r,d,o);if(!(0,i.equalBytes)(h,f))throw new Error("invalid tag");return e(t,r,d,a,1),(0,i.clean)(f),a}}),e.chacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,e._poly1305_aead)(e.chacha20)),e.xchacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,e._poly1305_aead)(e.xchacha20))}(_re),Object.defineProperty(Ere,"__esModule",{value:!0}),Ere.xchacha20=void 0;var zre,Hre,qre,Wre=_re;Ere.xchacha20=function(e,t,n){return(0,Wre.xchacha20poly1305)(e,t,n)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var t=m9,n=O9,r=kne,i=Ere,o=S9,s=C9;function a(e,t,n,a){var c=(0,o.symmetricAlgorithm)();if("aes-256-gcm"===c)return e(r.aes256gcm,t,n,(0,o.symmetricNonceLength)(),s.AEAD_TAG_LENGTH,a);if("xchacha20"===c)return e(i.xchacha20,t,n,s.XCHACHA20_NONCE_LENGTH,s.AEAD_TAG_LENGTH,a);if("aes-256-cbc"===c)return e(r.aes256cbc,t,n,16,0);throw new Error("Not implemented")}function c(e,r,i,o,s,a){var c=(0,n.randomBytes)(o),l=e(r,c,a).encrypt(i);if(0===s)return(0,t.concatBytes)(c,l);var u=l.length-s,d=l.subarray(0,u),h=l.subarray(u);return(0,t.concatBytes)(c,h,d)}function l(e,n,r,i,o,s){var a=r.subarray(0,i),c=e(n,Uint8Array.from(a),s),l=r.subarray(i);if(0===o)return c.decrypt(l);var u=l.subarray(0,o),d=l.subarray(o);return c.decrypt((0,t.concatBytes)(d,u))}e.symEncrypt=function(e,t,n){return a(c,e,t,n)},e.symDecrypt=function(e,t,n){return a(l,e,t,n)},e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt}(xne),zre=P9,Hre=d9&&d9.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qre=d9&&d9.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||Hre(t,e,n)},Object.defineProperty(zre,"__esModule",{value:!0}),qre(M9,zre),qre(pne,zre),qre(fne,zre),qre(xne,zre);var Kre={};Object.defineProperty(Kre,"__esModule",{value:!0}),Kre.PublicKey=void 0;var Gre=m9,Vre=P9,Zre=function(){function e(e){this.data=(0,Vre.convertPublicKeyFormat)(e,!0)}return e.fromHex=function(t){return new e((0,Vre.hexToPublicKey)(t))},Object.defineProperty(e.prototype,"uncompressed",{get:function(){return S7.from((0,Vre.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"compressed",{get:function(){return S7.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(e){return void 0===e&&(e=!0),(0,Gre.bytesToHex)(e?this.data:this.uncompressed)},e.prototype.decapsulate=function(e,t){void 0===t&&(t=!1);var n=t?this.data:this.uncompressed,r=e.multiply(this,t);return(0,Vre.getSharedKey)(n,r)},e.prototype.equals=function(e){return(0,Gre.equalBytes)(this.data,e.data)},e}();Kre.PublicKey=Zre,Object.defineProperty(A9,"__esModule",{value:!0}),A9.PrivateKey=void 0;var Yre=m9,Jre=P9,Qre=Kre,Xre=function(){function e(e){if(void 0===e)this.data=(0,Jre.getValidSecret)();else{if(!(0,Jre.isValidPrivateKey)(e))throw new Error("Invalid private key");this.data=e}this.publicKey=new Qre.PublicKey((0,Jre.getPublicKey)(this.data))}return e.fromHex=function(t){return new e((0,Jre.decodeHex)(t))},Object.defineProperty(e.prototype,"secret",{get:function(){return S7.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(){return(0,Yre.bytesToHex)(this.data)},e.prototype.encapsulate=function(e,t){void 0===t&&(t=!1);var n=t?this.publicKey.compressed:this.publicKey.uncompressed,r=this.multiply(e,t);return(0,Jre.getSharedKey)(n,r)},e.prototype.multiply=function(e,t){return void 0===t&&(t=!1),(0,Jre.getSharedPoint)(this.data,e.compressed,t)},e.prototype.equals=function(e){return(0,Yre.equalBytes)(this.data,e.data)},e}();A9.PrivateKey=Xre,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var t=A9;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return t.PrivateKey}});var n=Kre;Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return n.PublicKey}})}(I9),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=function(e,o){var s=new r.PrivateKey,a=e instanceof Uint8Array?new r.PublicKey(e):r.PublicKey.fromHex(e),c=s.encapsulate(a,(0,n.isHkdfKeyCompressed)()),l=(0,n.isEphemeralKeyCompressed)()?s.publicKey.compressed:s.publicKey.uncompressed,u=(0,i.symEncrypt)(c,o);return S7.from((0,t.concatBytes)(l,u))},e.decrypt=function(e,t){var o=e instanceof Uint8Array?new r.PrivateKey(e):r.PrivateKey.fromHex(e),s=(0,n.ephemeralKeySize)(),a=new r.PublicKey(t.subarray(0,s)),c=t.subarray(s),l=a.decapsulate(o,(0,n.isHkdfKeyCompressed)());return S7.from((0,i.symDecrypt)(l,c))};var t=m9,n=S9,r=I9,i=P9,o=S9;Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return o.ECIES_CONFIG}});var s=I9;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return s.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return s.PublicKey}}),e.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}}(p9);const eie=f1("KeyExchange:Layer"),tie=f1("SocketService:Layer"),nie=f1("Ecies:Layer"),rie=f1("RemoteCommunication:Layer");eie.color="##95c44e",tie.color="#f638d7",nie.color="#465b9c",rie.color="#47a2be";const iie={KeyExchange:eie,SocketService:tie,Ecies:nie,RemoteCommunication:rie};let oie,sie=[],aie=[];const cie=(e,t)=>l7(void 0,void 0,void 0,function*(){oie=t,aie.push(e),function(e){return l7(this,void 0,void 0,function*(){if(!oie||!e)return;!function(){const e=aie;aie=sie,sie=e}();const t=oie.endsWith("/")?`${oie}evt`:`${oie}/evt`,n=Object.assign({},e);if(delete n.params,e.params)for(const[o,s]of Object.entries(e.params))n[o]=s;const r=JSON.stringify(n);iie.RemoteCommunication(`[sendBufferedEvents] Sending ${sie.length} analytics events to ${t}`);try{const e=yield A4(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:r}),n=yield e.text();iie.RemoteCommunication(`[sendBufferedEvents] Response: ${n}`),sie.length=0}catch(i){}})}(e).catch(()=>{})});class lie{constructor(e){this.enabled=!0,(null==e?void 0:e.debug)&&f1.enable("Ecies:Layer"),this.ecies=(null==e?void 0:e.privateKey)?p9.PrivateKey.fromHex(e.privateKey):new p9.PrivateKey,iie.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),iie.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),iie.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new p9.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,t){let n=e;if(this.enabled)try{iie.Ecies("[ECIES: encrypt()] using otherPublicKey",t);const r=S7.from(e),i=p9.encrypt(t,r);n=S7.from(i).toString("base64")}catch(r){throw iie.Ecies("[ECIES: encrypt()] error encrypt:",r),iie.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),iie.Ecies("[ECIES: encrypt()] data: ",e),iie.Ecies("[ECIES: encrypt()] otherkey: ",t),r}return n}decrypt(e){let t=e;if(this.enabled)try{iie.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());const n=S7.from(e.toString(),"base64");t=p9.decrypt(this.ecies.toHex(),n).toString()}catch(n){throw iie.Ecies("[ECIES: decrypt()] error decrypt",n),iie.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),iie.Ecies("[ECIES: decrypt()] encryptedData: ",e),n}return t}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){iie.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var uie="0.32.0";const die="https://metamask-sdk.api.cx.metamask.io/",hie=["websocket"],fie=6048e5,pie=3e3,mie="eth_requestAccounts";function gie(e){const{context:t}=e;iie.RemoteCommunication(`[RemoteCommunication: clean()] context=${t}`),e.channelConfig=void 0,e.ready=!1,e.originatorConnectStarted=!1}var yie,bie,vie,wie,Eie,_ie,xie,kie;(xie=yie||(yie={})).DISCONNECTED="disconnected",xie.WAITING="waiting",xie.TIMEOUT="timeout",xie.LINKED="linked",xie.PAUSED="paused",xie.TERMINATED="terminated",(kie=bie||(bie={})).KEY_INFO="key_info",kie.SERVICE_STATUS="service_status",kie.PROVIDER_UPDATE="provider_update",kie.RPC_UPDATE="rpc_update",kie.KEYS_EXCHANGED="keys_exchanged",kie.JOIN_CHANNEL="join_channel",kie.PUBLIC_KEY="public_key",kie.CHANNEL_CREATED="channel_created",kie.CLIENTS_CONNECTED="clients_connected",kie.CLIENTS_DISCONNECTED="clients_disconnected",kie.CLIENTS_WAITING="clients_waiting",kie.CLIENTS_READY="clients_ready",kie.REJECTED="rejected",kie.WALLET_INIT="wallet_init",kie.CHANNEL_PERSISTENCE="channel_persistence",kie.CONFIG="config",kie.MESSAGE_ACK="ack",kie.SOCKET_DISCONNECTED="socket_disconnected",kie.SOCKET_RECONNECT="socket_reconnect",kie.OTP="otp",kie.SDK_RPC_CALL="sdk_rpc_call",kie.AUTHORIZED="authorized",kie.CONNECTION_STATUS="connection_status",kie.MESSAGE="message",kie.TERMINATE="terminate",(vie||(vie={})).KEY_EXCHANGE="key_exchange",function(e){e.KEY_HANDSHAKE_START="key_handshake_start",e.KEY_HANDSHAKE_CHECK="key_handshake_check",e.KEY_HANDSHAKE_SYN="key_handshake_SYN",e.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",e.KEY_HANDSHAKE_ACK="key_handshake_ACK",e.KEY_HANDSHAKE_WALLET="key_handshake_wallet",e.KEY_HANDSHAKE_NONE="none"}(wie||(wie={}));class Sie extends M4.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:t,context:n,ecies:r,logging:i}){super(),this.keysExchanged=!1,this.step=wie.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=n,this.communicationLayer=e,(null==r?void 0:r.privateKey)&&t&&(iie.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${t} set keysExchanged to true!`,r),this.keysExchanged=!0),this.myECIES=new lie(Object.assign(Object.assign({},r),{debug:null==i?void 0:i.eciesLayer})),this.communicationLayer.state.eciesInstance=this.myECIES,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=!0===(null==i?void 0:i.keyExchangeLayer),t&&this.setOtherPublicKey(t),this.communicationLayer.on(vie.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){const{relayPersistence:t}=this.communicationLayer.remote.state;if(iie.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${t}`,e),t)return void iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");const{message:n}=e;this.keysExchanged&&iie.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(bie.KEY_INFO,n.type),n.type===wie.KEY_HANDSHAKE_SYN?(this.checkStep([wie.KEY_HANDSHAKE_NONE,wie.KEY_HANDSHAKE_ACK]),iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",n),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:wie.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}).catch(e=>{iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_SYNACK",e)}),this.setStep(wie.KEY_HANDSHAKE_ACK)):n.type===wie.KEY_HANDSHAKE_SYNACK?(this.checkStep([wie.KEY_HANDSHAKE_SYNACK,wie.KEY_HANDSHAKE_ACK,wie.KEY_HANDSHAKE_NONE]),iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:wie.KEY_HANDSHAKE_ACK}).catch(e=>{iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_ACK",e)}),this.keysExchanged=!0,this.setStep(wie.KEY_HANDSHAKE_ACK),this.emit(bie.KEYS_EXCHANGED)):n.type===wie.KEY_HANDSHAKE_ACK&&(iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([wie.KEY_HANDSHAKE_ACK,wie.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(wie.KEY_HANDSHAKE_ACK),this.emit(bie.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new lie(e)}clean(){iie.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(wie.KEY_HANDSHAKE_NONE),this.emit(bie.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:t}){const{relayPersistence:n,protocolVersion:r}=this.communicationLayer.remote.state,i=r>=2;n?iie.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"):(iie.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${r} isOriginator=${e} step=${this.step} force=${t} relayPersistence=${n} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==wie.KEY_HANDSHAKE_NONE&&this.step!==wie.KEY_HANDSHAKE_SYNACK)||t?(iie.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${t}) -- step=${this.step}`,this.step),this.clean(),this.setStep(wie.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:wie.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2}).catch(e=>{iie.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",e)})):iie.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&!0!==t?iie.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):i?this.communicationLayer.sendMessage({type:wie.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}).catch(e=>{iie.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",e)}):(this.communicationLayer.sendMessage({type:wie.KEY_HANDSHAKE_START}).catch(e=>{iie.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",e)}),this.clean()))}setStep(e){this.step=e,this.emit(bie.KEY_INFO,e)}checkStep(e){e.length>0&&e.indexOf(this.step.toString())}setRelayPersistence({localKey:e,otherKey:t}){this.otherPublicKey=t,this.myECIES=new lie({privateKey:e,debug:this.debug}),this.keysExchanged=!0}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){iie.KeyExchange("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw new Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw new Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){const e={keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step};return JSON.stringify(e)}}!function(e){e.TERMINATE="terminate",e.ANSWER="answer",e.OFFER="offer",e.CANDIDATE="candidate",e.JSONRPC="jsonrpc",e.WALLET_INFO="wallet_info",e.WALLET_INIT="wallet_init",e.ORIGINATOR_INFO="originator_info",e.PAUSE="pause",e.OTP="otp",e.AUTHORIZED="authorized",e.PING="ping",e.READY="ready"}(Eie||(Eie={})),function(e){e.REQUEST="sdk_connect_request_started",e.REQUEST_MOBILE="sdk_connect_request_started_mobile",e.RECONNECT="sdk_reconnect_request_started",e.CONNECTED="sdk_connection_established",e.CONNECTED_MOBILE="sdk_connection_established_mobile",e.AUTHORIZED="sdk_connection_authorized",e.REJECTED="sdk_connection_rejected",e.TERMINATED="sdk_connection_terminated",e.DISCONNECTED="sdk_disconnected",e.SDK_USE_EXTENSION="sdk_use_extension",e.SDK_RPC_REQUEST="sdk_rpc_request",e.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",e.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",e.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",e.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser"}(_ie||(_ie={}));const Cie=(e,t,n)=>l7(void 0,void 0,void 0,function*(){var r,i,o,s,a,c;const{remote:l,state:u}=e,{channelId:d,isOriginator:h}=u;if("error_terminated"===t)return iie.SocketService(`handleJoinChannelResults: Channel ${d} terminated`),void e.emit(bie.TERMINATE);if(!n)return void iie.SocketService(`handleJoinChannelResults: No result for channel ${d}`);const{persistence:f,walletKey:p,rejected:m}=n;if(iie.SocketService(`handleJoinChannelResults: Channel ${d} persistence=${f} walletKey=${p} rejected=${m}`),m)return iie.SocketService(`handleJoinChannelResults: Channel ${d} rejected`),yield e.remote.disconnect({terminate:!0}),e.remote.emit(bie.REJECTED,{channelId:d}),void e.remote.emitServiceStatusEvent();if(p&&!(null===(r=l.state.channelConfig)||void 0===r?void 0:r.otherKey)){e.getKeyExchange().setOtherPublicKey(p),null===(i=e.state.keyExchange)||void 0===i||i.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(bie.AUTHORIZED);const{communicationLayer:t,storageManager:n}=l.state,r=Object.assign(Object.assign({},l.state.channelConfig),{channelId:null!==(o=l.state.channelId)&&void 0!==o?o:"",validUntil:Date.now()+fie,localKey:null==t?void 0:t.getKeyInfo().ecies.private,otherKey:p});e.sendMessage({type:wie.KEY_HANDSHAKE_ACK}).catch(e=>{}),null===(s=e.state.socket)||void 0===s||s.emit(Eie.PING,{id:d,clientType:h?"dapp":"wallet",context:"on_channel_reconnect",message:""}),yield null==n?void 0:n.persistChannelConfig(r),l.emitServiceStatusEvent(),l.setConnectionStatus(yie.LINKED)}f&&(e.emit(bie.CHANNEL_PERSISTENCE),null===(a=e.state.keyExchange)||void 0===a||a.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(bie.AUTHORIZED),cie(Object.assign(Object.assign({id:null!=d?d:"",event:h?_ie.CONNECTED:_ie.CONNECTED_MOBILE},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:uie,walletVersion:null===(c=e.remote.state.walletInfo)||void 0===c?void 0:c.version}),u.communicationServerUrl).catch(e=>{}))}),Iie=e=>new Promise(t=>{setTimeout(t,e)}),Aie=(e,t,...n)=>l7(void 0,[e,t,...n],void 0,function*(e,t,n=200){let r;const i=Date.now();let o=!1;for(;!o;){if(o=Date.now()-i>3e5,r=t[e],void 0!==r.elapsedTime)return r;yield Iie(n)}throw new Error(`RPC ${e} timed out`)}),Pie=e=>l7(void 0,void 0,void 0,function*(){const{state:t}=e,{socket:n,channelId:r,context:i,isOriginator:o,isReconnecting:s}=t;if(s)return iie.SocketService("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",e),!1;if(!n)return iie.SocketService("[SocketService: reconnectSocket()] socket is not defined",e),!1;if(!r)return!1;const{connected:a}=n;t.isReconnecting=!0,t.reconnectionAttempts=0,iie.SocketService(`[SocketService: reconnectSocket()] connected=${a} trying to reconnect after socketio disconnection`,e);try{for(;3>t.reconnectionAttempts;){if(iie.SocketService(`[SocketService: reconnectSocket()] Attempt ${t.reconnectionAttempts+1} of 3`,e),yield Iie(200),n.connected)return iie.SocketService("Socket already connected --- ping to retrieve messages"),n.emit(Eie.PING,{id:r,clientType:o?"dapp":"wallet",context:"on_channel_config",message:""}),!0;t.resumed=!0,n.connect(),e.emit(bie.SOCKET_RECONNECT);try{if(yield new Promise((t,s)=>{n.emit(bie.JOIN_CHANNEL,{channelId:r,context:`${i}connect_again`,clientType:o?"dapp":"wallet"},(n,r)=>l7(void 0,void 0,void 0,function*(){try{yield Cie(e,n,r),t()}catch(i){s(i)}}))}),yield Iie(100),n.connected)return iie.SocketService(`Reconnection successful on attempt ${t.reconnectionAttempts+1}`),!0}catch(c){iie.SocketService(`Error during reconnection attempt ${t.reconnectionAttempts+1}:`,c)}t.reconnectionAttempts+=1,3>t.reconnectionAttempts&&(yield Iie(200))}return iie.SocketService("Failed to reconnect after 3 attempts"),!1}finally{t.isReconnecting=!1,t.reconnectionAttempts=0}});function Mie(e,t){return l7(this,void 0,void 0,function*(){var n;const r=null===(n=e.state.keyExchange)||void 0===n?void 0:n.encryptMessage(JSON.stringify(t)),i={id:e.state.channelId,context:e.state.context,clientType:e.state.isOriginator?"dapp":"wallet",message:r,plaintext:e.state.hasPlaintext?JSON.stringify(t):void 0};return iie.SocketService(`[SocketService: encryptAndSendMessage()] context=${e.state.context}`,i),t.type===Eie.TERMINATE&&(e.state.manualDisconnect=!0),new Promise((t,n)=>{var r;null===(r=e.state.socket)||void 0===r||r.emit(bie.MESSAGE,i,(e,r)=>{var i;e&&(iie.SocketService(`[SocketService: encryptAndSendMessage()] error=${e}`),n(e)),iie.SocketService("[encryptAndSendMessage] response",r),t(null!==(i=null==r?void 0:r.success)&&void 0!==i&&i)})})})}var Oie;!function(e){e.RPC_CHECK="rpcCheck",e.SKIPPED_RPC="skippedRpc"}(Oie||(Oie={}));const Tie=["eth_sendTransaction","eth_signTypedData","eth_signTransaction","personal_sign","wallet_requestPermissions","wallet_switchEthereumChain","eth_signTypedData_v3","eth_signTypedData_v4","metamask_connectSign","metamask_connectWith","metamask_batch"].map(e=>e.toLowerCase()),Rie=[{event:bie.CLIENTS_CONNECTED,handler:function(e,t){return n=>l7(this,void 0,void 0,function*(){var n,r,i,o,s,a,c,l,u,d,h;const f=null!==(r=null===(n=e.remote.state.channelConfig)||void 0===n?void 0:n.relayPersistence)&&void 0!==r&&r;if(iie.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected-${t}' relayPersistence=${f} resumed=${e.state.resumed} clientsPaused=${e.state.clientsPaused} keysExchanged=${null===(i=e.state.keyExchange)||void 0===i?void 0:i.areKeysExchanged()} isOriginator=${e.state.isOriginator}`),e.emit(bie.CLIENTS_CONNECTED,{isOriginator:e.state.isOriginator,keysExchanged:null===(o=e.state.keyExchange)||void 0===o?void 0:o.areKeysExchanged(),context:e.state.context}),e.state.resumed)e.state.isOriginator||(iie.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} 'clients_connected' / keysExchanged=${null===(s=e.state.keyExchange)||void 0===s?void 0:s.areKeysExchanged()} -- backward compatibility`),null===(a=e.state.keyExchange)||void 0===a||a.start({isOriginator:null!==(c=e.state.isOriginator)&&void 0!==c&&c})),e.state.resumed=!1;else if(e.state.clientsPaused)iie.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!e.state.isOriginator){const t=!f;iie.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${null===(l=e.state.keyExchange)||void 0===l?void 0:l.areKeysExchanged()} -- force=${t} -- backward compatibility`),iie.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${null===(u=e.state.keyExchange)||void 0===u?void 0:u.areKeysExchanged()} -- force=${t} -- backward compatibility`),null===(d=e.state.keyExchange)||void 0===d||d.start({isOriginator:null!==(h=e.state.isOriginator)&&void 0!==h&&h,force:t})}e.state.clientsConnected=!0,e.state.clientsPaused=!1})}},{event:bie.CHANNEL_CREATED,handler:function(e,t){return n=>{iie.SocketService(`[SocketService: handleChannelCreated()] context=${e.state.context} on 'channel_created-${t}'`,n),e.emit(bie.CHANNEL_CREATED,n)}}},{event:bie.CLIENTS_DISCONNECTED,handler:function(e,t){return()=>{var n;e.state.clientsConnected=!1,iie.SocketService(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}'`),e.remote.state.relayPersistence?iie.SocketService(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}' - relayPersistence enabled, skipping key exchange cleanup.`):(e.state.isOriginator&&!e.state.clientsPaused&&(null===(n=e.state.keyExchange)||void 0===n||n.clean()),e.emit(bie.CLIENTS_DISCONNECTED,t))}}},{event:bie.CONFIG,handler:function(e,t){return n=>l7(this,void 0,void 0,function*(){var r,i,o;iie.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${t}'`,n);const{persistence:s,walletKey:a}=n;e.state.isOriginator&&e.remote.state.channelConfig?(n.walletKey&&!e.remote.state.channelConfig.otherKey&&(iie.SocketService(`Setting wallet key ${a}`),e.remote.state.channelConfig.otherKey=a,e.getKeyExchange().setOtherPublicKey(n.walletKey),null===(r=e.state.keyExchange)||void 0===r||r.setKeysExchanged(!0),yield e.remote.sendMessage({type:wie.KEY_HANDSHAKE_ACK}),yield e.remote.sendMessage({type:Eie.PING}),yield null===(i=e.remote.state.storageManager)||void 0===i?void 0:i.persistChannelConfig(e.remote.state.channelConfig)),!0!==s||e.remote.state.channelConfig.relayPersistence||(iie.SocketService(`Setting relay persistence ${s}`),e.remote.state.channelConfig.relayPersistence=s,e.remote.state.relayPersistence=!0,e.remote.emit(bie.CHANNEL_PERSISTENCE),e.remote.state.authorized=!0,e.remote.state.ready=!0,e.remote.emit(bie.AUTHORIZED),yield null===(o=e.remote.state.storageManager)||void 0===o?void 0:o.persistChannelConfig(e.remote.state.channelConfig))):e.state.isOriginator||n.persistence&&(e.remote.state.relayPersistence=!0,e.remote.emit(bie.CHANNEL_PERSISTENCE))})}},{event:bie.MESSAGE,handler:function(e,t){return n=>{var r,i,o,s,a,c,l,u,d,h,f,p,m,g,y,b,v,w;const{ackId:E,message:_,error:x}=n,k=null!==(r=e.remote.state.relayPersistence)&&void 0!==r&&r;if(iie.SocketService(`[SocketService handleMessage()] relayPersistence=${k} context=${e.state.context} on 'message' ${t} keysExchanged=${null===(i=e.state.keyExchange)||void 0===i?void 0:i.areKeysExchanged()}`,n),x)throw iie.SocketService(`\n [SocketService handleMessage()] context=${e.state.context}::on 'message' error=${x}`),new Error(x);const S="string"==typeof _;if(!S&&(null==_?void 0:_.type)===wie.KEY_HANDSHAKE_START){if(k)return;return iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received HANDSHAKE_START isOriginator=${e.state.isOriginator}`,_),void(null===(o=e.state.keyExchange)||void 0===o||o.start({isOriginator:null!==(s=e.state.isOriginator)&&void 0!==s&&s,force:!0}))}if(!S&&(null===(a=null==_?void 0:_.type)||void 0===a?void 0:a.startsWith("key_handshake"))){if(k)return;return iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' emit KEY_EXCHANGE`,_),void e.emit(vie.KEY_EXCHANGE,{message:_,context:e.state.context})}if(S&&!(null===(c=e.state.keyExchange)||void 0===c?void 0:c.areKeysExchanged())){let t=!1;try{iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' trying to decrypt message`),null===(l=e.state.keyExchange)||void 0===l||l.decryptMessage(_),t=!0}catch(A){iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' error`,A)}if(!t)return e.state.isOriginator?null===(d=e.state.keyExchange)||void 0===d||d.start({isOriginator:null!==(h=e.state.isOriginator)&&void 0!==h&&h}):e.sendMessage({type:wie.KEY_HANDSHAKE_START}).catch(e=>{}),void iie.SocketService(`Message ignored because invalid key exchange status. step=${null===(f=e.state.keyExchange)||void 0===f?void 0:f.getKeyInfo().step}`,null===(p=e.state.keyExchange)||void 0===p?void 0:p.getKeyInfo(),_);iie.SocketService("Invalid key exchange status detected --- updating it."),null===(u=e.state.keyExchange)||void 0===u||u.setKeysExchanged(!0)}else if(!S&&(null==_?void 0:_.type))return void e.emit(bie.MESSAGE,_);if(!S)return void e.emit(bie.MESSAGE,_);const C=null===(m=e.state.keyExchange)||void 0===m?void 0:m.decryptMessage(_),I=JSON.parse(null!=C?C:"{}");if(E&&(null==E?void 0:E.length)>0&&(iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' ackid=${E} channelId=${t}`),null===(g=e.state.socket)||void 0===g||g.emit(bie.MESSAGE_ACK,{ackId:E,channelId:t,clientType:e.state.isOriginator?"dapp":"wallet"})),e.state.clientsPaused=(null==I?void 0:I.type)===Eie.PAUSE,e.state.isOriginator&&I.data){const t=I.data,n=e.state.rpcMethodTracker[t.id];if(n){const r=Date.now()-n.timestamp;iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received answer for id=${t.id} method=${n.method} responseTime=${r}`,I),e.remote.state.analytics&&Tie.includes(n.method.toLowerCase())&&cie(Object.assign(Object.assign({id:null!==(y=e.remote.state.channelId)&&void 0!==y?y:"",event:_ie.SDK_RPC_REQUEST_DONE,sdkVersion:e.remote.state.sdkVersion,commLayerVersion:uie},e.remote.state.originatorInfo),{walletVersion:null===(b=e.remote.state.walletInfo)||void 0===b?void 0:b.version,params:{method:n.method,from:"mobile"}}),e.remote.state.communicationServerUrl).catch(e=>{});const i=Object.assign(Object.assign({},n),{result:t.result,error:t.error?{code:null===(v=t.error)||void 0===v?void 0:v.code,message:null===(w=t.error)||void 0===w?void 0:w.message}:void 0,elapsedTime:r});e.state.rpcMethodTracker[t.id]=i,e.emit(bie.RPC_UPDATE,i)}}e.emit(bie.MESSAGE,{message:I})}}},{event:bie.REJECTED,handler:function(e,t){return n=>l7(this,void 0,void 0,function*(){var n;e.state.isOriginator&&!e.remote.state.ready?(iie.SocketService(`[SocketService: handleChannelRejected()] context=${e.state.context} channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`,e.remote.state.originatorInfo),cie(Object.assign(Object.assign({id:t,event:_ie.REJECTED},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:uie,walletVersion:null===(n=e.remote.state.walletInfo)||void 0===n?void 0:n.version}),e.remote.state.communicationServerUrl).catch(e=>{}),yield e.remote.disconnect({terminate:!0}),e.remote.emit(bie.REJECTED,{channelId:t}),e.remote.setConnectionStatus(yie.DISCONNECTED)):iie.SocketService(`[SocketService: handleChannelRejected()] SKIP -- channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`)})}},{event:"clients_waiting_to_join",handler:function(e,t){return n=>{iie.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${e.state.context} on 'clients_waiting_to_join-${t}'`,n),e.emit(bie.CLIENTS_WAITING,n)}}}],Nie=[{event:bie.KEY_INFO,handler:function(e){return t=>{iie.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",t),e.emit(bie.KEY_INFO,t)}}},{event:bie.KEYS_EXCHANGED,handler:function(e){return()=>{var t,n,r;iie.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${null===(t=e.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged()}`);const{channelConfig:i}=e.remote.state;if(i){const t=e.getKeyExchange().getKeyInfo().ecies;i.localKey=t.private,i.otherKey=t.otherPubKey,e.remote.state.channelConfig=i,null===(n=e.remote.state.storageManager)||void 0===n||n.persistChannelConfig(i).catch(e=>{})}e.emit(bie.KEYS_EXCHANGED,{keysExchanged:null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged(),isOriginator:e.state.isOriginator});const o={keyInfo:e.getKeyInfo()};e.emit(bie.SERVICE_STATUS,o)}}}];function Lie(e,t){iie.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} setting socket listeners for channel ${t}...`);const{socket:n}=e.state,{keyExchange:r}=e.state;n&&e.state.isOriginator&&(e.state.debug&&(null==n||n.io.on("error",t=>{iie.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=error`,t)}),null==n||n.io.on("reconnect",t=>{iie.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect`,t),Pie(e).catch(e=>{})}),null==n||n.io.on("reconnect_error",t=>{iie.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_error`,t)}),null==n||n.io.on("reconnect_failed",()=>{iie.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_failed`)})),null==n||n.on("disconnect",t=>(iie.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${t}' begin recovery...`),function(e){return t=>{iie.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${e.state.manualDisconnect}`,t),e.state.manualDisconnect||(e.emit(bie.SOCKET_DISCONNECTED),Pie(e).catch(e=>{}))}}(e)(t)))),Rie.forEach(({event:r,handler:i})=>{null==n||n.on(`${r}-${t}`,i(e,t))}),Nie.forEach(({event:t,handler:n})=>{null==r||r.on(t,n(e))}),e.state.setupChannelListeners=!0}class Bie extends M4.EventEmitter2{constructor(e){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:"",focusListenerAdded:!1,removeFocusListener:void 0,isReconnecting:!1,reconnectionAttempts:0},this.options=e;const{reconnect:t,communicationLayerPreference:n,communicationServerUrl:r,context:i,remote:o,logging:s}=e;this.state.resumed=t,this.state.context=i,this.state.isOriginator=o.state.isOriginator,this.state.communicationLayerPreference=n,this.state.debug=!0===(null==s?void 0:s.serviceLayer),this.remote=o,!0===(null==s?void 0:s.serviceLayer)&&f1.enable("SocketService:Layer"),this.state.communicationServerUrl=r,this.state.hasPlaintext=this.state.communicationServerUrl!==die&&!0===(null==s?void 0:s.plaintext),iie.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.initSocket()}initSocket(){var e;const{otherPublicKey:t,ecies:n,logging:r}=this.options,i={autoConnect:!1,transports:hie,withCredentials:!0},o=this.state.communicationServerUrl;iie.SocketService(`[SocketService: initSocket()] Socket IO url: ${o}`),this.state.socket=c7(o,i),function(e){if("undefined"!=typeof window&&"undefined"!=typeof document&&(iie.SocketService(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,e),!e.state.focusListenerAdded)){const t=()=>{iie.SocketService("Document has focus --- reconnecting socket"),Pie(e).catch(e=>{})};window.addEventListener("focus",t),e.state.focusListenerAdded=!0,e.state.removeFocusListener=()=>{window.removeEventListener("focus",t),e.state.focusListenerAdded=!1}}}(this);const s={communicationLayer:this,otherPublicKey:t,sendPublicKey:!1,context:null!==(e=this.state.context)&&void 0!==e?e:"",ecies:n,logging:r};this.state.keyExchange=new Sie(s)}resetKeys(){return iie.SocketService("[SocketService: resetKeys()] Resetting keys."),void(null===(e=this.state.keyExchange)||void 0===e||e.resetKeys());var e}createChannel(){return l7(this,void 0,void 0,function*(){return function(e){return l7(this,void 0,void 0,function*(){var t,n,r;if(iie.SocketService(`[SocketService: createChannel()] context=${e.state.context}`),e.state.socket||e.initSocket(),null===(t=e.state.socket)||void 0===t?void 0:t.connected)throw new Error("socket already connected");null===(n=e.state.socket)||void 0===n||n.connect(),e.state.manualDisconnect=!1,e.state.isOriginator=!0;const i=U4();e.state.channelId=i,Lie(e,i),yield new Promise((t,n)=>{var r;null===(r=e.state.socket)||void 0===r||r.emit(bie.JOIN_CHANNEL,{channelId:i,context:`${e.state.context}createChannel`,clientType:"dapp"},(r,i)=>l7(this,void 0,void 0,function*(){try{yield Cie(e,r,i),t()}catch(o){n(o)}}))});const o=null===(r=e.state.keyExchange)||void 0===r?void 0:r.getKeyInfo();return{channelId:i,pubKey:(null==o?void 0:o.ecies.public)||"",privKey:(null==o?void 0:o.ecies.private)||""}})}(this)})}connectToChannel({channelId:e,withKeyExchange:t=!1,authorized:n}){return function(e){return l7(this,arguments,void 0,function*({options:e,instance:t}){const{channelId:n,authorized:r,withKeyExchange:i}=e,{state:o,remote:s}=t,{isOriginator:a=!1,socket:c,keyExchange:l}=o,{channelConfig:u}=s.state;if(null==c?void 0:c.connected)throw new Error("socket already connected");if(a&&(null==u?void 0:u.relayPersistence)){const{localKey:e,otherKey:t}=u;e&&t&&(null==l||l.setRelayPersistence({localKey:e,otherKey:t}))}return Object.assign(o,{manualDisconnect:!1,withKeyExchange:i,isOriginator:a,channelId:n}),null==c||c.connect(),Lie(t,n),!a&&r&&(null==l||l.setKeysExchanged(!0),Object.assign(s.state,{ready:!0,authorized:!0})),new Promise(e=>{var i;const s=null===(i=null==l?void 0:l.getKeyInfo())||void 0===i?void 0:i.ecies.public;null==c||c.emit(bie.JOIN_CHANNEL,{channelId:n,context:`${o.context}_connectToChannel`,clientType:a?"dapp":"wallet",publicKey:r&&!a?s:void 0},(n,r)=>l7(this,void 0,void 0,function*(){yield Cie(t,n,r),e()}))})})}({options:{channelId:e,withKeyExchange:t,authorized:n},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var e,t;null===(t=(e=this).state.socket)||void 0===t||t.emit(bie.MESSAGE,{id:e.state.channelId,context:e.state.context,message:{type:wie.KEY_HANDSHAKE_CHECK,pubkey:e.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(e){return l7(this,void 0,void 0,function*(){return function(e,t){return l7(this,void 0,void 0,function*(){var n,r,i,o,s,a;if(!e.state.channelId)throw iie.SocketService("handleSendMessage: no channelId - Create a channel first"),new Error("Create a channel first");if(iie.SocketService(`[SocketService: handleSendMessage()] context=${e.state.context} areKeysExchanged=${null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`,t),null===(r=null==t?void 0:t.type)||void 0===r?void 0:r.startsWith("key_handshake"))return o=e,s=t,iie.SocketService(`[SocketService: handleKeyHandshake()] context=${o.state.context}`,s),null===(a=o.state.socket)||void 0===a||a.emit(bie.MESSAGE,{id:o.state.channelId,context:o.state.context,clientType:o.state.isOriginator?"dapp":"wallet",message:s}),!0;!function(e,t){var n;if(!(null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged())&&!e.remote.state.relayPersistence)throw iie.SocketService(`[SocketService: validateKeyExchange()] context=${e.state.context} ERROR keys not exchanged`,t),new Error("Keys not exchanged BBB")}(e,t),function(e,t){var n;const r=null!==(n=null==t?void 0:t.method)&&void 0!==n?n:"",i=null==t?void 0:t.id;e.state.isOriginator&&i&&(e.state.rpcMethodTracker[i]={id:i,timestamp:Date.now(),method:r},e.emit(bie.RPC_UPDATE,e.state.rpcMethodTracker[i]))}(e,t);const c=yield Mie(e,t);return e.remote.state.analytics&&e.remote.state.isOriginator&&t.method&&Tie.includes(t.method.toLowerCase())&&cie({id:null!==(i=e.remote.state.channelId)&&void 0!==i?i:"",event:_ie.SDK_RPC_REQUEST,params:{method:t.method,from:"mobile"}},e.remote.state.communicationServerUrl).catch(e=>{}),function(e,t){return l7(this,void 0,void 0,function*(){var n;const r=null==t?void 0:t.id,i=null!==(n=null==t?void 0:t.method)&&void 0!==n?n:"";if(e.state.isOriginator&&r)try{const n=Aie(r,e.state.rpcMethodTracker,200).then(e=>({type:Oie.RPC_CHECK,result:e})),o=(()=>l7(this,void 0,void 0,function*(){const t=yield(i={instance:e,rpcId:r},l7(void 0,[i],void 0,function*({rpcId:e,instance:t}){for(;t.state.lastRpcId===e||void 0===t.state.lastRpcId;)yield Iie(200);return t.state.lastRpcId})),n=yield Aie(t,e.state.rpcMethodTracker,200);var i;return{type:Oie.SKIPPED_RPC,result:n}}))(),s=yield Promise.race([n,o]);if(s.type===Oie.RPC_CHECK){const e=s.result;iie.SocketService(`[SocketService:handleRpcReplies()] id=${t.id} ${i} ( ${e.elapsedTime} ms)`,e.result)}else{if(s.type!==Oie.SKIPPED_RPC)throw new Error(`Error handling RPC replies for ${r}`);{const t=Object.assign(Object.assign({},e.state.rpcMethodTracker[r]),{error:new Error("SDK_CONNECTION_ISSUE")});e.emit(bie.RPC_UPDATE,t);const n={data:Object.assign(Object.assign({},t),{jsonrpc:"2.0"}),name:"metamask-provider"};e.emit(bie.MESSAGE,{message:n})}}}catch(o){throw o}})}(e,t).catch(e=>{}),c})}(this,e)})}ping(){return function(e){return l7(this,void 0,void 0,function*(){var t,n;iie.SocketService(`[SocketService: ping()] context=${e.state.context} originator=${e.state.isOriginator} keysExchanged=${null===(t=e.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged()}`),null===(n=e.state.socket)||void 0===n||n.emit(Eie.PING,{id:e.state.channelId,context:"ping",clientType:e.remote.state.isOriginator?"dapp":"wallet",message:""})})}(this)}pause(){return function(e){return l7(this,void 0,void 0,function*(){var t,n;iie.SocketService(`[SocketService: pause()] context=${e.state.context}`),e.state.manualDisconnect=!0,(null===(t=e.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged())&&(yield e.sendMessage({type:Eie.PAUSE})),null===(n=e.state.socket)||void 0===n||n.disconnect()})}(this)}isConnected(){var e;return null===(e=this.state.socket)||void 0===e?void 0:e.connected}resume(){return function(e){return l7(this,void 0,void 0,function*(){const{state:t,remote:n}=e,{socket:r,channelId:i,context:o,keyExchange:s,isOriginator:a}=t,{isOriginator:c}=n.state;if(iie.SocketService(`[SocketService: resume()] channelId=${i} context=${o} connected=${null==r?void 0:r.connected} manualDisconnect=${t.manualDisconnect} resumed=${t.resumed} keysExchanged=${null==s?void 0:s.areKeysExchanged()}`),!i)throw iie.SocketService("[SocketService: resume()] channelId is not defined"),new Error("ChannelId is not defined");(null==r?void 0:r.connected)?(iie.SocketService("[SocketService: resume()] already connected."),r.emit(Eie.PING,{id:i,clientType:c?"dapp":"wallet",context:"on_channel_config",message:""}),n.hasRelayPersistence()||(null==s?void 0:s.areKeysExchanged())||(a?yield e.sendMessage({type:Eie.READY}):null==s||s.start({isOriginator:!1}))):(null==r||r.connect(),iie.SocketService(`[SocketService: resume()] after connecting socket --\x3e connected=${null==r?void 0:r.connected}`),null==r||r.emit(bie.JOIN_CHANNEL,{channelId:i,context:`${o}_resume`,clientType:c?"dapp":"wallet"},(t,n)=>l7(this,void 0,void 0,function*(){try{yield Cie(e,t,n)}catch(r){}}))),t.manualDisconnect=!1,t.resumed=!0})}(this)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){return t=this,n=e,iie.SocketService(`[SocketService: disconnect()] context=${t.state.context}`,n),(null==n?void 0:n.terminate)&&(null===(i=(r=t.state).removeFocusListener)||void 0===i||i.call(r),t.state.channelId=n.channelId,null===(o=t.state.socket)||void 0===o||o.removeAllListeners(),null===(s=t.state.keyExchange)||void 0===s||s.clean(),t.remote.state.ready=!1,t.state.socket=void 0,t.state.rpcMethodTracker={}),t.state.manualDisconnect=!0,void(null===(a=t.state.socket)||void 0===a||a.disconnect());var t,n,r,i,o,s,a}}var jie,Die,Uie;function Fie(e){return()=>l7(this,void 0,void 0,function*(){var t,n,r;const{state:i}=e;if(i.authorized)return;yield(()=>l7(this,void 0,void 0,function*(){for(;!i.walletInfo;)yield Iie(500)}))();const o="7.3".localeCompare((null===(t=i.walletInfo)||void 0===t?void 0:t.version)||"");if(iie.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${null===(n=i.walletInfo)||void 0===n?void 0:n.version} compareValue=${o}`),1!==o)return;const s=i.platformType===Die.MobileWeb||i.platformType===Die.ReactNative||i.platformType===Die.MetaMaskMobileWebview;iie.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${i.platformType} secure=${s} channel=${i.channelId} walletVersion=${null===(r=i.walletInfo)||void 0===r?void 0:r.version}`),s&&(i.authorized=!0,e.emit(bie.AUTHORIZED))})}function $ie(e){return t=>{const{state:n}=e;iie.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${n.context} on 'channel_created' channelId=${t}`),e.emit(bie.CHANNEL_CREATED,t)}}function zie(e,t){return()=>{var n,r,i,o;const{state:s}=e;iie.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${s.channelId} keysExchanged=${null===(r=null===(n=s.communicationLayer)||void 0===n?void 0:n.getKeyInfo())||void 0===r?void 0:r.keysExchanged}`),s.analytics&&cie(Object.assign(Object.assign({id:null!==(i=s.channelId)&&void 0!==i?i:"",event:s.reconnection?_ie.RECONNECT:s.isOriginator?_ie.REQUEST:_ie.REQUEST_MOBILE},s.originatorInfo),{commLayer:t,sdkVersion:s.sdkVersion,walletVersion:null===(o=s.walletInfo)||void 0===o?void 0:o.version,commLayerVersion:uie}),s.communicationServerUrl).catch(e=>{}),s.clientsConnected=!0,s.originatorInfoSent=!1,e.emit(bie.CLIENTS_CONNECTED)}}function Hie(e){return t=>{const{state:n}=e;iie.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${n.context} on 'clients_disconnected' channelId=${t}`),n.relayPersistence||(n.clientsConnected=!1,n.ready=!1,n.authorized=!1),e.emit(bie.CLIENTS_DISCONNECTED,n.channelId),e.setConnectionStatus(yie.DISCONNECTED)}}function qie(e){return t=>{var n;const{state:r}=e;if(iie.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${r.context} on 'clients_waiting' numberUsers=${t} ready=${r.ready} autoStarted=${r.originatorConnectStarted}`),e.setConnectionStatus(yie.WAITING),e.emit(bie.CLIENTS_WAITING,t),r.originatorConnectStarted){iie.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${r.originatorConnectStarted} timeout`,r.autoConnectOptions);const t=(null===(n=r.autoConnectOptions)||void 0===n?void 0:n.timeout)||3e3,i=setTimeout(()=>{iie.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${t}) terminate channelConfig`,r.autoConnectOptions),r.originatorConnectStarted=!1,r.ready||e.setConnectionStatus(yie.TIMEOUT),clearTimeout(i)},t)}}}function Wie(e,t){return n=>{var r,i,o,s,a,c,l,u;const{state:d}=e;if(iie.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${d.context} on commLayer.'keys_exchanged' channel=${d.channelId}`,n),null===(i=null===(r=d.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.keysExchanged){const t=Object.assign(Object.assign({},d.channelConfig),{channelId:null!==(o=d.channelId)&&void 0!==o?o:"",validUntil:(null===(s=d.channelConfig)||void 0===s?void 0:s.validUntil)||fie,localKey:d.communicationLayer.getKeyInfo().ecies.private,otherKey:d.communicationLayer.getKeyInfo().ecies.otherPubKey});null===(a=d.storageManager)||void 0===a||a.persistChannelConfig(t).catch(e=>{}),e.setConnectionStatus(yie.LINKED)}!function(e,t){var n,r,i,o,s,a,c,l;const{state:u}=e;iie.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${u.channelId}`,t);const d=Object.assign(Object.assign({},u.channelConfig),{channelId:null!==(n=u.channelId)&&void 0!==n?n:"",validUntil:null!==(i=null===(r=u.channelConfig)||void 0===r?void 0:r.validUntil)&&void 0!==i?i:0,relayPersistence:u.relayPersistence,localKey:null===(s=null===(o=u.communicationLayer)||void 0===o?void 0:o.state.keyExchange)||void 0===s?void 0:s.getKeyInfo().ecies.private,otherKey:null===(c=null===(a=u.communicationLayer)||void 0===a?void 0:a.state.keyExchange)||void 0===c?void 0:c.getKeyInfo().ecies.otherPubKey,lastActive:t.getTime()});null===(l=u.storageManager)||void 0===l||l.persistChannelConfig(d)}(e,new Date),d.analytics&&d.channelId&&cie(Object.assign(Object.assign({id:d.channelId,event:n.isOriginator?_ie.CONNECTED:_ie.CONNECTED_MOBILE},d.originatorInfo),{sdkVersion:d.sdkVersion,commLayer:t,commLayerVersion:uie,walletVersion:null===(c=d.walletInfo)||void 0===c?void 0:c.version}),d.communicationServerUrl).catch(e=>{}),d.isOriginator=n.isOriginator,n.isOriginator||(null===(l=d.communicationLayer)||void 0===l||l.sendMessage({type:Eie.READY}),d.ready=!0,d.paused=!1),n.isOriginator&&!d.originatorInfoSent&&(null===(u=d.communicationLayer)||void 0===u||u.sendMessage({type:Eie.ORIGINATOR_INFO,originatorInfo:d.originatorInfo,originator:d.originatorInfo}),d.originatorInfoSent=!0)}}function Kie(e){return t=>{let n=t;t.message&&(n=n.message),function(e,t){const{state:n}=t;if(iie.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${n.context} on 'message' typeof=${typeof e}`,e),t.state.ready=!0,n.isOriginator||e.type!==Eie.ORIGINATOR_INFO)if(n.isOriginator&&e.type===Eie.WALLET_INFO)!function(e,t){const{state:n}=e;n.walletInfo=t.walletInfo,n.paused=!1}(t,e);else{if(n.isOriginator&&e.type===Eie.WALLET_INIT)(function(e,t){return l7(this,void 0,void 0,function*(){var n,r,i;const{state:o}=e;if(o.isOriginator){const o=t.data||{};if("object"==typeof o&&"accounts"in o&&"chainId"in o&&"walletKey"in o)try{const{channelConfig:t}=e.state;if(iie.RemoteCommunication("WALLET_INIT: channelConfig",JSON.stringify(t,null,2)),t){const s=o.accounts,a=o.chainId,c=o.walletKey;let l,u=!1;"deeplinkProtocol"in o&&(u=Boolean(o.deeplinkProtocol),e.state.deeplinkProtocolAvailable=u),"walletVersion"in o&&(l=o.walletVersion),yield null===(n=e.state.storageManager)||void 0===n?void 0:n.persistChannelConfig(Object.assign(Object.assign({},t),{otherKey:c,walletVersion:l,deeplinkProtocolAvailable:u,relayPersistence:!0})),yield null===(r=e.state.storageManager)||void 0===r?void 0:r.persistAccounts(s),yield null===(i=e.state.storageManager)||void 0===i?void 0:i.persistChainId(a)}e.emit(bie.WALLET_INIT,{accounts:o.accounts,chainId:o.chainId})}catch(s){}}})})(t,e).catch(e=>{iie.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${e}`)});else if(e.type===Eie.TERMINATE)(function(e){return l7(this,void 0,void 0,function*(){const{state:t}=e;t.isOriginator&&(yield Jie({options:{terminate:!0,sendMessage:!1},instance:e}),e.emit(bie.TERMINATE))})})(t).catch(e=>{iie.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${e}`)});else if(e.type===Eie.PAUSE)!function(e){const{state:t}=e;t.paused=!0,e.setConnectionStatus(yie.PAUSED)}(t);else if(e.type===Eie.READY&&n.isOriginator)!function(e){const{state:t}=e;e.setConnectionStatus(yie.LINKED);const n=t.paused;t.paused=!1,e.emit(bie.CLIENTS_READY,{isOriginator:t.isOriginator,walletInfo:t.walletInfo}),n&&(t.authorized=!0,e.emit(bie.AUTHORIZED))}(t);else{if(e.type===Eie.OTP&&n.isOriginator)return void function(e,t){var n;const{state:r}=e;e.emit(bie.OTP,t.otpAnswer),1==="6.6".localeCompare((null===(n=r.walletInfo)||void 0===n?void 0:n.version)||"")&&e.emit(bie.SDK_RPC_CALL,{method:mie,params:[]})}(t,e);e.type===Eie.AUTHORIZED&&n.isOriginator&&function(e){const{state:t}=e;t.authorized=!0,e.emit(bie.AUTHORIZED)}(t)}t.emit(bie.MESSAGE,e)}else!function(e,t){var n;const{state:r}=e;null===(n=r.communicationLayer)||void 0===n||n.sendMessage({type:Eie.WALLET_INFO,walletInfo:r.walletInfo}),r.originatorInfo=t.originatorInfo||t.originator,e.emit(bie.CLIENTS_READY,{isOriginator:r.isOriginator,originatorInfo:r.originatorInfo}),r.paused=!1}(t,e)}(n,e)}}function Gie(e){return()=>{const{state:t}=e;iie.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),t.ready=!1,t.authorized=!1,gie(t),e.emitServiceStatusEvent({context:"socket_reconnect"})}}function Vie(e){return()=>{const{state:t}=e;iie.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),t.ready=!1}}function Zie(e){return()=>l7(this,void 0,void 0,function*(){var t,n,r,i,o,s,a;const{state:c}=e;iie.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${c.context}`),e.state.ready=!0,e.state.clientsConnected=!0,e.state.authorized=!0,e.state.relayPersistence=!0,null===(t=e.state.communicationLayer)||void 0===t||t.getKeyExchange().setKeysExchanged(!0),e.emit(bie.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),e.emit(bie.AUTHORIZED),e.emit(bie.CLIENTS_READY),e.emit(bie.CHANNEL_PERSISTENCE);try{c.channelConfig=Object.assign(Object.assign({},c.channelConfig),{localKey:null===(n=c.communicationLayer)||void 0===n?void 0:n.getKeyExchange().getKeyInfo().ecies.private,otherKey:null===(r=c.communicationLayer)||void 0===r?void 0:r.getKeyExchange().getOtherPublicKey(),channelId:null!==(i=c.channelId)&&void 0!==i?i:"",validUntil:null!==(s=null===(o=c.channelConfig)||void 0===o?void 0:o.validUntil)&&void 0!==s?s:fie,relayPersistence:!0}),yield null===(a=c.storageManager)||void 0===a?void 0:a.persistChannelConfig(c.channelConfig)}catch(l){}})}function Yie({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,ecies:r,communicationServerUrl:i=die,instance:o}){var s,a,c,l,u,d,h,f,p,m,g;const{state:y}=o;if(iie.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(y,null,2)),e!==jie.SOCKET)throw new Error("Invalid communication protocol");y.communicationLayer=new Bie({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,transports:y.transports,communicationServerUrl:i,context:y.context,ecies:r,logging:y.logging,remote:o});let b="undefined"!=typeof document&&document.URL||"",v="undefined"!=typeof document&&document.title||"";(null===(s=y.dappMetadata)||void 0===s?void 0:s.url)&&(b=y.dappMetadata.url),(null===(a=y.dappMetadata)||void 0===a?void 0:a.name)&&(v=y.dappMetadata.name);const w=null!==(d=null!==(l=null===(c=y.dappMetadata)||void 0===c?void 0:c.name)&&void 0!==l?l:null===(u=y.dappMetadata)||void 0===u?void 0:u.url)&&void 0!==d?d:"N/A",E="undefined"!=typeof window&&void 0!==window.location&&null!==(h=window.location.hostname)&&void 0!==h?h:w,_={url:b,title:v,source:null===(f=y.dappMetadata)||void 0===f?void 0:f.source,dappId:E,icon:(null===(p=y.dappMetadata)||void 0===p?void 0:p.iconUrl)||(null===(m=y.dappMetadata)||void 0===m?void 0:m.base64Icon),platform:y.platformType,apiVersion:uie,connector:null===(g=y.dappMetadata)||void 0===g?void 0:g.connector};y.originatorInfo=_;const x={[bie.AUTHORIZED]:Fie(o),[bie.MESSAGE]:Kie(o),[bie.CHANNEL_PERSISTENCE]:Zie(o),[bie.CLIENTS_CONNECTED]:zie(o,e),[bie.KEYS_EXCHANGED]:Wie(o,e),[bie.SOCKET_DISCONNECTED]:Vie(o),[bie.SOCKET_RECONNECT]:Gie(o),[bie.CLIENTS_DISCONNECTED]:Hie(o),[bie.KEY_INFO]:()=>{},[bie.CHANNEL_CREATED]:$ie(o),[bie.CLIENTS_WAITING]:qie(o),[bie.RPC_UPDATE]:e=>{o.emit(bie.RPC_UPDATE,e)}};for(const[S,C]of Object.entries(x))try{y.communicationLayer.on(S,C)}catch(k){}}function Jie(e){return l7(this,arguments,void 0,function*({options:e,instance:t}){const{state:n}=t;return iie.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${n.channelId}`,e),new Promise((r,i)=>{var o,s,a,c,l,u;(null==e?void 0:e.terminate)?(t.state.ready&&cie({id:null!==(o=t.state.channelId)&&void 0!==o?o:"",event:_ie.TERMINATED},t.state.communicationServerUrl).catch(e=>{}),n.ready=!1,n.paused=!1,null===(s=n.storageManager)||void 0===s||s.terminate(null!==(a=n.channelId)&&void 0!==a?a:""),t.state.terminated=!0,e.sendMessage?(null===(c=n.communicationLayer)||void 0===c?void 0:c.getKeyInfo().keysExchanged)&&t.state.communicationLayer&&Mie(t.state.communicationLayer,{type:Eie.TERMINATE}).then(()=>{r(!0)}).catch(e=>{i(e)}):r(!0),n.authorized=!1,n.relayPersistence=!1,n.channelId=U4(),e.channelId=n.channelId,n.channelConfig=void 0,n.originatorConnectStarted=!1,null===(l=n.communicationLayer)||void 0===l||l.disconnect(e),t.setConnectionStatus(yie.TERMINATED)):(null===(u=n.communicationLayer)||void 0===u||u.disconnect(e),t.setConnectionStatus(yie.DISCONNECTED),r(!0))})})}(jie||(jie={})).SOCKET="socket",function(e){e.NonBrowser="nodejs",e.MetaMaskMobileWebview="in-app-browser",e.DesktopWeb="web-desktop",e.MobileWeb="web-mobile",e.ReactNative="react-native"}(Die||(Die={}));class Qie extends M4.EventEmitter2{constructor(e){super(),this.state={ready:!1,authorized:!1,isOriginator:!1,terminated:!1,protocolVersion:1,paused:!1,deeplinkProtocolAvailable:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:die,context:"",persist:!1,clientsConnected:!1,sessionDuration:fie,originatorConnectStarted:!1,debug:!1,_connectionStatus:yie.DISCONNECTED},this._options=e;const{platformType:t,communicationLayerPreference:n,otherPublicKey:r,reconnect:i,walletInfo:o,dappMetadata:s,protocolVersion:a,transports:c,context:l,relayPersistence:u,ecies:d,analytics:h=!1,storage:f,sdkVersion:p,communicationServerUrl:m=die,logging:g,autoConnect:y={timeout:pie}}=e;this.state.otherPublicKey=r,this.state.dappMetadata=s,this.state.walletInfo=o,this.state.transports=c,this.state.platformType=t,this.state.analytics=h,this.state.protocolVersion=null!=a?a:1,this.state.isOriginator=!r,this.state.relayPersistence=u,this.state.communicationServerUrl=m,this.state.context=l,this.state.terminated=!1,this.state.sdkVersion=p,this.setMaxListeners(50),this.setConnectionStatus(yie.DISCONNECTED),(null==f?void 0:f.duration)&&(this.state.sessionDuration=fie),this.state.storageOptions=f,this.state.autoConnectOptions=y,this.state.debug=!0===(null==g?void 0:g.remoteLayer),!0===(null==g?void 0:g.remoteLayer)&&f1.enable("RemoteCommunication:Layer"),!0===(null==g?void 0:g.serviceLayer)&&f1.enable("SocketService:Layer"),!0===(null==g?void 0:g.eciesLayer)&&f1.enable("ECIES:Layer"),!0===(null==g?void 0:g.keyExchangeLayer)&&f1.enable("KeyExchange:Layer"),this.state.logging=g,(null==f?void 0:f.storageManager)&&(this.state.storageManager=f.storageManager),iie.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${a} relayPersistence=${u} isOriginator=${this.state.isOriginator} communicationLayerPreference=${n} otherPublicKey=${r} reconnect=${i}`),this.state.isOriginator||Yie({communicationLayerPreference:n,otherPublicKey:r,reconnect:i,ecies:d,communicationServerUrl:m,instance:this}),this.emitServiceStatusEvent({context:"constructor"})}initFromDappStorage(){return l7(this,void 0,void 0,function*(){var e;if(this.state.storageManager){const t=yield this.state.storageManager.getPersistedChannelConfig({});t&&(this.state.channelConfig=t,this.state.channelId=t.channelId,this.state.deeplinkProtocolAvailable=null!==(e=t.deeplinkProtocolAvailable)&&void 0!==e&&e,t.relayPersistence&&(this.state.authorized=!0,this.state.ready=!0,this.setConnectionStatus(yie.LINKED),yield this.connectToChannel({channelId:t.channelId})))}Yie({communicationLayerPreference:jie.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})})}originatorSessionConnect(){return l7(this,void 0,void 0,function*(){return yield function(e){return l7(this,void 0,void 0,function*(){var t;const{state:n}=e;if(!n.storageManager)return void iie.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");const r=yield n.storageManager.getPersistedChannelConfig({});if(iie.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${n.originatorConnectStarted} channelConfig`,r),null===(t=n.communicationLayer)||void 0===t?void 0:t.isConnected())return iie.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),r;if(r){if(r.validUntil>Date.now())return n.channelConfig=r,n.originatorConnectStarted=!0,n.channelId=null==r?void 0:r.channelId,n.reconnection=!0,r;iie.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}n.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return l7(this,void 0,void 0,function*(){return function(e){return l7(this,void 0,void 0,function*(){var t,n,r,i,o,s;if(!e.communicationLayer)throw new Error("communication layer not initialized");if(e.ready)throw new Error("Channel already connected");if(e.channelId&&(null===(t=e.communicationLayer)||void 0===t?void 0:t.isConnected()))return e.channelConfig=Object.assign(Object.assign({},e.channelConfig),{channelId:e.channelId,validUntil:Date.now()+e.sessionDuration}),null===(n=e.storageManager)||void 0===n||n.persistChannelConfig(e.channelConfig),{channelId:e.channelId,privKey:null===(i=null===(r=e.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.ecies.private,pubKey:null===(s=null===(o=e.communicationLayer)||void 0===o?void 0:o.getKeyInfo())||void 0===s?void 0:s.ecies.public};iie.RemoteCommunication("[RemoteCommunication: generateChannelId()]");const a=yield e.communicationLayer.createChannel();iie.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",a);const c=Object.assign(Object.assign({},e.channelConfig),{channelId:a.channelId,localKey:a.privKey,validUntil:Date.now()+e.sessionDuration});return e.channelId=a.channelId,e.channelConfig=c,{channelId:e.channelId,pubKey:a.pubKey,privKey:a.privKey}})}(this.state)})}clean(){return gie(this.state)}connectToChannel({channelId:e,withKeyExchange:t,authorized:n}){return function(e){return l7(this,arguments,void 0,function*({channelId:e,withKeyExchange:t,authorized:n,state:r}){var i,o,s;if(!B4(e))throw iie.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} invalid channel channelId=${e}`),new Error(`Invalid channel ${e}`);if(iie.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} channelId=${e} withKeyExchange=${t}`),null===(i=r.communicationLayer)||void 0===i?void 0:i.isConnected())return void iie.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} already connected - interrupt connection.`);r.channelId=e,yield null===(o=r.communicationLayer)||void 0===o?void 0:o.connectToChannel({channelId:e,authorized:n,withKeyExchange:t});const a=Object.assign(Object.assign({},r.channelConfig),{channelId:e,validUntil:Date.now()+r.sessionDuration});r.channelConfig=a,null===(s=r.storageManager)||void 0===s||s.persistChannelConfig(a)})}({channelId:e,authorized:n,withKeyExchange:t,state:this.state})}sendMessage(e){return function(e,t){return l7(this,void 0,void 0,function*(){var n,r;const{state:i}=e;iie.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context} paused=${i.paused} ready=${i.ready} relayPersistence=${i.relayPersistence} authorized=${i.authorized} socket=${null===(n=i.communicationLayer)||void 0===n?void 0:n.isConnected()} clientsConnected=${i.clientsConnected} status=${i._connectionStatus}`,t),i.relayPersistence||i.ready&&(null===(r=i.communicationLayer)||void 0===r?void 0:r.isConnected())&&i.clientsConnected||(iie.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context} SKIP message waiting for MM mobile readiness.`),yield new Promise(t=>{e.once(bie.CLIENTS_READY,t)}),iie.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context} AFTER SKIP / READY -- sending pending message`));try{return yield function(e,t){return l7(this,void 0,void 0,function*(){return new Promise(n=>{var r;const{state:i}=e;iie.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${i.context} ready=${i.ready} authorized=${i.authorized} method=${t.method}`),!i.isOriginator||i.authorized||i.relayPersistence?null===(r=i.communicationLayer)||void 0===r||r.sendMessage(t).then(e=>{n(e)}).catch(e=>{n(!1)}):e.once(bie.AUTHORIZED,()=>{var e;iie.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${i.context} AFTER SKIP / AUTHORIZED -- sending pending message`),null===(e=i.communicationLayer)||void 0===e||e.sendMessage(t).then(e=>{n(e)}).catch(e=>{n(!1)})})})})}(e,t)}catch(o){throw o}})}(this,e)}testStorage(){return l7(this,void 0,void 0,function*(){return function(e){return l7(this,void 0,void 0,function*(){var t;const n=yield null===(t=e.storageManager)||void 0===t?void 0:t.getPersistedChannelConfig();iie.RemoteCommunication("[RemoteCommunication: testStorage()] res",n)})}(this.state)})}hasDeeplinkProtocol(){return this.state.deeplinkProtocolAvailable}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){return l7(this,void 0,void 0,function*(){var e;iie.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield null===(e=this.state.communicationLayer)||void 0===e?void 0:e.ping()})}testLogger(){iie.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),iie.SocketService(`testLogger() channel=${this.state.channelId}`),iie.Ecies(`testLogger() channel=${this.state.channelId}`),iie.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;iie.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.keyCheck()}setConnectionStatus(e){this.state._connectionStatus!==e&&(this.state._connectionStatus=e,this.emit(bie.CONNECTION_STATUS,e),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(e={}){this.emit(bie.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getKeyInfo()}resetKeys(){var e;null===(e=this.state.communicationLayer)||void 0===e||e.resetKeys()}setOtherPublicKey(e){var t;const n=null===(t=this.state.communicationLayer)||void 0===t?void 0:t.getKeyExchange();if(!n)throw new Error("KeyExchange is not initialized.");n.getOtherPublicKey()!==e&&n.setOtherPublicKey(e)}pause(){return l7(this,void 0,void 0,function*(){var e;iie.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield null===(e=this.state.communicationLayer)||void 0===e?void 0:e.pause(),this.setConnectionStatus(yie.PAUSED)})}getVersion(){return uie}hasRelayPersistence(){var e;return null!==(e=this.state.relayPersistence)&&void 0!==e&&e}resume(){return l7(this,void 0,void 0,function*(){return function(e){return l7(this,void 0,void 0,function*(){var t;const{state:n}=e;iie.RemoteCommunication(`[RemoteCommunication: resume()] channel=${n.channelId}`),yield null===(t=n.communicationLayer)||void 0===t?void 0:t.resume(),e.setConnectionStatus(yie.LINKED)})}(this)})}encrypt(e){var t,n,r;const i=null===(t=this.state.communicationLayer)||void 0===t?void 0:t.getKeyExchange(),o=null==i?void 0:i.getOtherPublicKey();if(!o)throw new Error("KeyExchange not completed");return null===(r=null===(n=this.state.communicationLayer)||void 0===n?void 0:n.state.eciesInstance)||void 0===r?void 0:r.encrypt(e,o)}decrypt(e){var t,n,r;if(!(null===(t=this.state.communicationLayer)||void 0===t?void 0:t.state.eciesInstance))throw new Error("ECIES instance is not initialized");return null===(r=null===(n=this.state.communicationLayer)||void 0===n?void 0:n.state.eciesInstance)||void 0===r?void 0:r.decrypt(e)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getRPCMethodTracker()}reject({channelId:e}){return function(e){return l7(this,arguments,void 0,function*({channelId:e,state:t}){var n,r,i;if(!B4(e))throw iie.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${t.context} invalid channel channelId=${e}`),new Error(`Invalid channel ${e}`);if(t.isOriginator)return void iie.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} isOriginator=${t.isOriginator} channelId=${e}`);const{socket:o}=null!==(r=null===(n=t.communicationLayer)||void 0===n?void 0:n.state)&&void 0!==r?r:{};(null==o?void 0:o.connected)||(iie.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} socket already connected`),null==o||o.connect()),cie(Object.assign(Object.assign({id:e,event:_ie.REJECTED},t.originatorInfo),{sdkVersion:t.sdkVersion,commLayerVersion:uie,walletVersion:null===(i=t.walletInfo)||void 0===i?void 0:i.version}),t.communicationServerUrl).catch(e=>{}),yield new Promise((n,r)=>{null==o||o.emit(bie.REJECTED,{channelId:e},(e,i)=>{iie.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} socket=${null==o?void 0:o.id}`,{error:e,response:i}),e?r(e):n(i)})})})}({channelId:e,state:this.state})}disconnect(e){return l7(this,void 0,void 0,function*(){return Jie({options:e,instance:this})})}}!function(e){e.RENEW="renew",e.LINK="link"}(Uie||(Uie={}));var Xie="ERC721",eoe="ERC1155",toe={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`MetaMask: Connected to chain with ID "${e}".`},warnings:{chainIdDeprecation:"MetaMask: 'ethereum.chainId' is deprecated and may be removed in the future. Please use the 'eth_chainId' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",networkVersionDeprecation:"MetaMask: 'ethereum.networkVersion' is deprecated and may be removed in the future. Please use the 'net_version' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",selectedAddressDeprecation:"MetaMask: 'ethereum.selectedAddress' is deprecated and may be removed in the future. Please use the 'eth_accounts' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",enableDeprecation:"MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1102",sendDeprecation:"MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193",events:{close:"MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect",data:"MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message",networkChanged:"MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged",notification:"MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message"},rpc:{ethDecryptDeprecation:"MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",ethGetEncryptionPublicKeyDeprecation:"MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",walletWatchAssetNFTExperimental:"MetaMask: The RPC method 'wallet_watchAsset' is experimental for ERC721/ERC1155 assets and may change in the future.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md and https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle"},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}};function noe(e){const t={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,i)=>{var o;t.ethDecryptDeprecation||"eth_decrypt"!==n.method?t.ethGetEncryptionPublicKeyDeprecation||"eth_getEncryptionPublicKey"!==n.method?!t.walletWatchAssetNFTExperimental&&"wallet_watchAsset"===n.method&&[Xie,eoe].includes((null==(o=n.params)?void 0:o.type)||"")&&(e.warn(toe.warnings.rpc.walletWatchAssetNFTExperimental),t.walletWatchAssetNFTExperimental=!0):(e.warn(toe.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),t.ethGetEncryptionPublicKeyDeprecation=!0):(e.warn(toe.warnings.rpc.ethDecryptDeprecation),t.ethDecryptDeprecation=!0),i()}}var roe=4294967295,ioe=Math.floor(Math.random()*roe);var ooe=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},soe=(e,t,n)=>(ooe(e,t,"read from private field"),n?n.call(e):t.get(e)),aoe=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},coe=(e,t,n,r)=>(ooe(e,t,"write to private field"),t.set(e,n),n),loe=(e,t,n)=>(ooe(e,t,"access private method"),n),uoe=-32600,doe=-32603,hoe={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function foe(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}var poe=(e,t)=>Object.hasOwnProperty.call(e,t);class moe extends TypeError{constructor(e,t){let n;const{message:r,explanation:i,...o}=e,{path:s}=e,a=0===s.length?r:`At path: ${s.join(".")} -- ${r}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function goe(e){return"object"==typeof e&&null!=e}function yoe(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function boe(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:s}=n,{refinement:a,message:c=`Expected a value of type \`${s}\`${a?` with refinement \`${a}\``:""}, but received: \`${yoe(r)}\``}=e;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*voe(e,t,n,r){var i;goe(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const o of e){const e=boe(o,t,n,r);e&&(yield e)}}function*woe(e,t,n={}){const{path:r=[],branch:i=[e],coerce:o=!1,mask:s=!1}=n,a={path:r,branch:i};if(o&&(e=t.coercer(e,a),s&&"type"!==t.type&&goe(t.schema)&&goe(e)&&!Array.isArray(e)))for(const l in e)void 0===t.schema[l]&&delete e[l];let c="valid";for(const l of t.validator(e,a))l.explanation=n.message,c="not_valid",yield[l,void 0];for(let[l,u,d]of t.entries(e,a)){const t=woe(u,d,{path:void 0===l?r:[...r,l],branch:void 0===l?i:[...i,u],coerce:o,mask:s,message:n.message});for(const n of t)n[0]?(c=null!=n[0].refinement?"not_refined":"not_valid",yield[n[0],void 0]):o&&(u=n[1],void 0===l?e=u:e instanceof Map?e.set(l,u):e instanceof Set?e.add(u):goe(e)&&(void 0!==u||l in e)&&(e[l]=u))}if("not_valid"!==c)for(const l of t.refiner(e,a))l.explanation=n.message,c="not_refined",yield[l,void 0];"valid"===c&&(yield[void 0,e])}class Eoe{constructor(e){const{type:t,schema:n,validator:r,refiner:i,coercer:o=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(e,t)=>voe(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>voe(i(e,t),t,this,e):()=>[]}assert(e,t){return _oe(e,this,t)}create(e,t){return xoe(e,this,t)}is(e){return koe(e,this)}mask(e,t){return function(e,t,n){const r=Soe(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return Soe(e,this,t)}}function _oe(e,t,n){const r=Soe(e,t,{message:n});if(r[0])throw r[0]}function xoe(e,t,n){const r=Soe(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function koe(e,t){return!Soe(e,t)[0]}function Soe(e,t,n={}){const r=woe(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(i[0]){return[new moe(i[0],function*(){for(const e of r)e[0]&&(yield e[0])}),void 0]}return[void 0,i[1]]}function Coe(e,t){return new Eoe({type:e,schema:null,validator:t})}function Ioe(e){let t;return new Eoe({type:"lazy",schema:null,*entries(n,r){t??(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(t??(t=e()),t.validator(n,r)),coercer:(n,r)=>(t??(t=e()),t.coercer(n,r)),refiner:(n,r)=>(t??(t=e()),t.refiner(n,r))})}function Aoe(e){return new Eoe({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${yoe(e)}`})}function Poe(e){const t=yoe(e),n=typeof e;return new Eoe({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${yoe(n)}`})}function Moe(){return Coe("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${yoe(e)}`)}function Ooe(e){const t=e?Object.keys(e):[],n=Coe("never",()=>!1);return new Eoe({type:"object",schema:e||null,*entries(r){if(e&&goe(r)){const i=new Set(Object.keys(r));for(const n of t)i.delete(n),yield[n,r[n],e[n]];for(const e of i)yield[e,r[e],n]}},validator:e=>goe(e)||`Expected an object, but received: ${yoe(e)}`,coercer:e=>goe(e)?{...e}:e})}function Toe(e){return new Eoe({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function Roe(e,t){return new Eoe({type:"record",schema:null,*entries(n){if(goe(n))for(const r in n){const i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>goe(e)||`Expected an object, but received: ${yoe(e)}`})}function Noe(){return Coe("string",e=>"string"==typeof e||`Expected a string, but received: ${yoe(e)}`)}function Loe(e){const t=e.map(e=>e.type).join(" | ");return new Eoe({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const i=[];for(const t of e){const[...e]=woe(n,t,r),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${yoe(n)}`,...i]}})}var Boe=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function joe(){throw new Error("setTimeout has not been defined")}function Doe(){throw new Error("clearTimeout has not been defined")}var Uoe=joe,Foe=Doe;function $oe(e){if(Uoe===setTimeout)return setTimeout(e,0);if((Uoe===joe||!Uoe)&&setTimeout)return Uoe=setTimeout,setTimeout(e,0);try{return Uoe(e,0)}catch(Gle){try{return Uoe.call(null,e,0)}catch(t){return Uoe.call(this,e,0)}}}"function"==typeof u7.setTimeout&&(Uoe=setTimeout),"function"==typeof u7.clearTimeout&&(Foe=clearTimeout);var zoe,Hoe=[],qoe=!1,Woe=-1;function Koe(){qoe&&zoe&&(qoe=!1,zoe.length?Hoe=zoe.concat(Hoe):Woe=-1,Hoe.length&&Goe())}function Goe(){if(!qoe){var e=$oe(Koe);qoe=!0;for(var t=Hoe.length;t;){for(zoe=Hoe,Hoe=[];++Woe<t;)zoe&&zoe[Woe].run();Woe=-1,t=Hoe.length}zoe=null,qoe=!1,function(e){if(Foe===clearTimeout)return clearTimeout(e);if((Foe===Doe||!Foe)&&clearTimeout)return Foe=clearTimeout,clearTimeout(e);try{return Foe(e)}catch(t){try{return Foe.call(null,e)}catch(n){return Foe.call(this,e)}}}(e)}}function Voe(e,t){this.fun=e,this.array=t}function Zoe(){}Voe.prototype.run=function(){this.fun.apply(null,this.array)};var Yoe=Zoe,Joe=Zoe,Qoe=Zoe,Xoe=Zoe,ese=Zoe,tse=Zoe,nse=Zoe,rse=u7.performance||{},ise=rse.now||rse.mozNow||rse.msNow||rse.oNow||rse.webkitNow||function(){return(new Date).getTime()},ose=new Date,sse={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Hoe.push(new Voe(e,t)),1!==Hoe.length||qoe||$oe(Goe)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Yoe,addListener:Joe,once:Qoe,off:Xoe,removeListener:ese,removeAllListeners:tse,emit:nse,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*ise.call(rse),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ose)/1e3}},ase=e=>Ooe(e);function cse({path:e,branch:t}){const n=e[e.length-1];return poe(t[t.length-2],n)}function lse(e){return new Eoe({...e,type:`optional ${e.type}`,validator:(t,n)=>!cse(n)||e.validator(t,n),refiner:(t,n)=>!cse(n)||e.refiner(t,n)})}var use,dse,hse,fse=Loe([Poe(null),Coe("boolean",e=>"boolean"==typeof e),Coe("finite number",e=>koe(e,Moe())&&Number.isFinite(e)),Noe(),Aoe(Ioe(()=>fse)),Roe(Noe(),Ioe(()=>fse))]),pse=(use=fse,dse=Coe("any",()=>!0),hse=e=>(function(e,t,n="Assertion failed",r=Boe){try{_oe(e,t)}catch(i){throw function(e,t){var n,r,i;return i=e,Boolean("string"==typeof(null==(r=null==(n=null==i?void 0:i.prototype)?void 0:n.constructor)?void 0:r.name))?new e({message:t}):e({message:t})}(r,`${n}: ${function(e){return(t=e,"object"==typeof(n=t)&&null!==n&&"message"in n&&"string"==typeof t.message?t.message:null==t?"":String(t)).replace(/\.$/u,"");var t,n}(i)}.`)}}(e,fse),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))),new Eoe({...use,coercer:(e,t)=>koe(e,dse)?use.coercer(hse(e),t):use.coercer(e,t)}));function mse(e){try{return xoe(e,pse),!0}catch{return!1}}var gse=Poe("2.0"),yse=function(e){return new Eoe({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}(Loe([Moe(),Noe()])),bse=ase({code:Coe("integer",e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${yoe(e)}`),message:Noe(),data:lse(pse),stack:lse(Noe())}),vse=Loe([Roe(Noe(),pse),Aoe(pse)]),wse=ase({id:yse,jsonrpc:gse,method:Noe(),params:lse(vse)}),Ese=ase({jsonrpc:gse,method:Noe(),params:lse(vse)});function _se(e){return koe(e,wse)}function xse(e){return koe(e,bse)}Ooe({id:yse,jsonrpc:gse,result:Toe(Coe("unknown",()=>!0)),error:Toe(bse)}),Loe([ase({id:yse,jsonrpc:gse,result:pse}),ase({id:yse,jsonrpc:gse,error:bse})]);var kse={code:doe,message:Cse(doe)},Sse="Unspecified server error.";function Cse(e,t="Unspecified error message. This is a bug, please report it."){if(n=e,Number.isInteger(n)){const t=e.toString();if(poe(hoe,t))return hoe[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return Sse}var n;return t}function Ise(e,{fallbackError:t=kse,shouldIncludeStack:n=!0}={}){if(!xse(t))throw new Error("Must provide fallback error with integer number code and string message.");const r=function(e,t){if(e&&"object"==typeof e&&"serialize"in e&&"function"==typeof e.serialize)return e.serialize();if(xse(e))return e;return{...t,data:{cause:Ase(e)}}}(e,t);return n||delete r.stack,r}function Ase(e){return Array.isArray(e)?e.map(e=>mse(e)?e:foe(e)?Pse(e):null):foe(e)?Pse(e):mse(e)?e:null}function Pse(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{const r=e[n];return mse(r)&&(t[n]=r),t},{})}var Mse=Bse;Bse.default=Bse,Bse.stable=Fse,Bse.stableStringify=Fse;var Ose="[...]",Tse="[Circular]",Rse=[],Nse=[];function Lse(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Bse(e,t,n,r){var i;void 0===r&&(r=Lse()),Dse(e,"",0,[],void 0,0,r);try{i=0===Nse.length?JSON.stringify(e,t,n):JSON.stringify(e,zse(t),n)}catch(s){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==Rse.length;){var o=Rse.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function jse(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);void 0!==i.get?i.configurable?(Object.defineProperty(r,n,{value:e}),Rse.push([r,n,t,i])):Nse.push([t,n,e]):(r[n]=e,Rse.push([r,n,t]))}function Dse(e,t,n,r,i,o,s){var a;if(o+=1,"object"==typeof e&&null!==e){for(a=0;a<r.length;a++)if(r[a]===e)return void jse(Tse,e,t,i);if(void 0!==s.depthLimit&&o>s.depthLimit)return void jse(Ose,e,t,i);if(void 0!==s.edgesLimit&&n+1>s.edgesLimit)return void jse(Ose,e,t,i);if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)Dse(e[a],a,a,r,e,o,s);else{var c=Object.keys(e);for(a=0;a<c.length;a++){var l=c[a];Dse(e[l],l,a,r,e,o,s)}}r.pop()}}function Use(e,t){return e<t?-1:e>t?1:0}function Fse(e,t,n,r){void 0===r&&(r=Lse());var i,o=$se(e,"",0,[],void 0,0,r)||e;try{i=0===Nse.length?JSON.stringify(o,t,n):JSON.stringify(o,zse(t),n)}catch(a){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==Rse.length;){var s=Rse.pop();4===s.length?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function $se(e,t,n,r,i,o,s){var a;if(o+=1,"object"==typeof e&&null!==e){for(a=0;a<r.length;a++)if(r[a]===e)return void jse(Tse,e,t,i);try{if("function"==typeof e.toJSON)return}catch(d){return}if(void 0!==s.depthLimit&&o>s.depthLimit)return void jse(Ose,e,t,i);if(void 0!==s.edgesLimit&&n+1>s.edgesLimit)return void jse(Ose,e,t,i);if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)$se(e[a],a,a,r,e,o,s);else{var c={},l=Object.keys(e).sort(Use);for(a=0;a<l.length;a++){var u=l[a];$se(e[u],u,a,r,e,o,s),c[u]=e[u]}if(void 0===i)return c;Rse.push([i,t,e]),i[t]=c}r.pop()}}function zse(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(Nse.length>0)for(var r=0;r<Nse.length;r++){var i=Nse[r];if(i[1]===t&&i[0]===n){n=i[2],Nse.splice(r,1);break}}return e.call(this,t,n)}}var Hse=h9(Mse),qse=class extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a non-empty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(t){return!1}}(this.data)&&(e.data.cause=Ase(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return Hse(this.serialize(),Wse,2)}};function Wse(e,t){if("[Circular]"!==t)return t}var Kse=e=>function(e,t){const[n,r]=function(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t??void 0,n]}}return[]}(t);return new qse(e,n??Cse(e),r)}(uoe,e);var Gse={};function Vse(){}function Zse(){Zse.init.call(this)}function Yse(e){return void 0===e._maxListeners?Zse.defaultMaxListeners:e._maxListeners}function Jse(e,t,n,r){var i,o,s,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]):(o=e._events=new Vse,e._eventsCount=0),s){if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),!s.warned&&(i=Yse(e))&&i>0&&s.length>i){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,"function"==typeof console.warn&&console.warn(a)}}else s=o[t]=n,++e._eventsCount;return e}function Qse(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function Xse(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function eae(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}Vse.prototype=Object.create(null),Zse.EventEmitter=Zse,Zse.usingDomains=!1,Zse.prototype.domain=void 0,Zse.prototype._events=void 0,Zse.prototype._maxListeners=void 0,Zse.defaultMaxListeners=10,Zse.init=function(){this.domain=null,Zse.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Vse,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Zse.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Zse.prototype.getMaxListeners=function(){return Yse(this)},Zse.prototype.emit=function(e){var t,n,r,i,o,s,a,c="error"===e;if(s=this._events)c=c&&null==s.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=s[e]))return!1;var u="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=eae(e,r),o=0;o<r;++o)i[o].call(n)}(n,u,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=eae(e,i),s=0;s<i;++s)o[s].call(n,r)}(n,u,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,s=eae(e,o),a=0;a<o;++a)s[a].call(n,r,i)}(n,u,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var s=e.length,a=eae(e,s),c=0;c<s;++c)a[c].call(n,r,i,o)}(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=eae(e,i),s=0;s<i;++s)o[s].apply(n,r)}(n,u,this,i)}return!0},Zse.prototype.addListener=function(e,t){return Jse(this,e,t,!1)},Zse.prototype.on=Zse.prototype.addListener,Zse.prototype.prependListener=function(e,t){return Jse(this,e,t,!0)},Zse.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Qse(this,e,t)),this},Zse.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Qse(this,e,t)),this},Zse.prototype.removeListener=function(e,t){var n,r,i,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new Vse:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new Vse,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,s||t)}return this},Zse.prototype.off=function(e,t){return this.removeListener(e,t)},Zse.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new Vse,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new Vse:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new Vse,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Zse.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},Zse.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Xse.call(e,t)},Zse.prototype.listenerCount=Xse,Zse.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var tae=f9(Object.freeze({__proto__:null,EventEmitter:Zse,default:Zse}));Object.defineProperty(Gse,"__esModule",{value:!0});const nae=tae;function rae(e,t,n){try{Reflect.apply(e,t,n)}catch(r){setTimeout(()=>{throw r})}}let iae=class extends nae.EventEmitter{emit(e,...t){let n="error"===e;const r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const n=new Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}const i=r[e];if(void 0===i)return!1;if("function"==typeof i)rae(i,this,t);else{const e=i.length,n=function(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)rae(n[r],this,t)}return!0}};var oae,sae,aae,cae,lae,uae,dae,hae,fae,pae,mae,gae,yae,bae,vae,wae,Eae,_ae,xae,kae=Gse.default=iae,Sae=class e extends kae{constructor({notificationHandler:e}={}){super(),aoe(this,cae),aoe(this,uae),aoe(this,hae),aoe(this,oae,!1),aoe(this,sae,void 0),aoe(this,aae,void 0),coe(this,sae,[]),coe(this,aae,e)}destroy(){soe(this,sae).forEach(e=>{"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}),coe(this,sae,[]),coe(this,oae,!0)}push(e){loe(this,cae,lae).call(this),soe(this,sae).push(e)}handle(e,t){if(loe(this,cae,lae).call(this),t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?loe(this,uae,dae).call(this,e,t):loe(this,uae,dae).call(this,e):t?loe(this,hae,fae).call(this,e,t):this._promiseHandle(e)}asMiddleware(){return loe(this,cae,lae).call(this),async(t,n,r,i)=>{var o,s;try{const[a,c,l]=await loe(o=e,gae,yae).call(o,t,n,soe(this,sae));return c?(await loe(s=e,wae,Eae).call(s,l),i(a)):r(async t=>{var n;try{await loe(n=e,wae,Eae).call(n,l)}catch(kie){return t(kie)}return t()})}catch(kie){return i(kie)}}}async _promiseHandle(e){return new Promise((t,n)=>{loe(this,hae,fae).call(this,e,(e,r)=>{e&&void 0===r?n(e):t(r)}).catch(n)})}};oae=new WeakMap,sae=new WeakMap,aae=new WeakMap,cae=new WeakSet,lae=function(){if(soe(this,oae))throw new Error("This engine is destroyed and can no longer be used.")},uae=new WeakSet,dae=async function(e,t){try{if(0===e.length){const e=[{id:null,jsonrpc:"2.0",error:new qse(uoe,"Request batch must contain plain objects. Received an empty array")}];return t?t(null,e):e}const n=(await Promise.all(e.map(this._promiseHandle.bind(this)))).filter(e=>void 0!==e);return t?t(null,n):n}catch(n){if(t)return t(n);throw n}},hae=new WeakSet,fae=async function(e,t){var n;if(!e||Array.isArray(e)||"object"!=typeof e){const n=new qse(uoe,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(n,{id:null,jsonrpc:"2.0",error:n})}if("string"!=typeof e.method){const n=new qse(uoe,"Must specify a string method. Received: "+typeof e.method,{request:e});return soe(this,aae)&&!_se(e)?t(null):t(n,{id:e.id??null,jsonrpc:"2.0",error:n})}if(soe(this,aae)&&koe(e,Ese)&&!_se(e)){try{await soe(this,aae).call(this,e)}catch(s){return t(s)}return t(null)}let r=null;const i={...e},o={id:i.id,jsonrpc:i.jsonrpc};try{await loe(n=Sae,pae,mae).call(n,i,o,soe(this,sae))}catch(s){r=s}return r&&(delete o.result,o.error||(o.error=Ise(r))),t(r,o)},pae=new WeakSet,mae=async function(e,t,n){var r,i,o;const[s,a,c]=await loe(r=Sae,gae,yae).call(r,e,t,n);if(loe(i=Sae,_ae,xae).call(i,e,t,a),await loe(o=Sae,wae,Eae).call(o,c),s)throw s},gae=new WeakSet,yae=async function(e,t,n){var r;const i=[];let o=null,s=!1;for(const a of n)if([o,s]=await loe(r=Sae,bae,vae).call(r,e,t,a,i),s)break;return[o,s,i.reverse()]},bae=new WeakSet,vae=async function(e,t,n,r){return new Promise(i=>{const o=e=>{const n=e||t.error;n&&(t.error=Ise(n)),i([n,!0])},s=n=>{t.error?o(t.error):(n&&("function"!=typeof n&&o(new qse(doe,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof n}" for request:\n${Iae(e)}`,{request:e})),r.push(n)),i([null,!1]))};try{n(e,t,s,o)}catch(a){o(a)}})},wae=new WeakSet,Eae=async function(e){for(const t of e)await new Promise((e,n)=>{t(t=>t?n(t):e())})},_ae=new WeakSet,xae=function(e,t,n){if(!poe(t,"result")&&!poe(t,"error"))throw new qse(doe,`JsonRpcEngine: Response has no error or result for request:\n${Iae(e)}`,{request:e});if(!n)throw new qse(doe,`JsonRpcEngine: Nothing ended request:\n${Iae(e)}`,{request:e})},aoe(Sae,pae),aoe(Sae,gae),aoe(Sae,bae),aoe(Sae,wae),aoe(Sae,_ae);var Cae=Sae;function Iae(e){return JSON.stringify(e,null,2)}var Aae=Object.freeze(["eth_subscription"]),Pae=(e=console)=>[(e,t,n,r)=>{const i=e.id,o=ioe=(ioe+1)%roe;e.id=o,t.id=o,n(n=>{e.id=i,t.id=i,n()})},Mae(e),noe(e)];function Mae(e){return(t,n,r)=>{"string"==typeof t.method&&t.method||(n.error=Kse({message:"The request 'method' must be a non-empty string.",data:t})),r(t=>{const{error:r}=n;return r?(e.error(`MetaMask - RPC Error: ${r.message}`,r),t()):t()})}}var Oae=(e,t,n=!0)=>(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)},Tae=e=>Boolean(e)&&"string"==typeof e&&e.startsWith("0x"),Rae=()=>{};async function Nae(e,t){try{const t=await async function(){return{name:Lae(window),icon:await Bae(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:t},Rae)}catch(n){t.error({message:toe.errors.sendSiteMetadata(),originalError:n})}}function Lae(e){const{document:t}=e,n=t.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;const r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:window.location.hostname}async function Bae(e){const{document:t}=e,n=t.querySelectorAll('head > link[rel~="icon"]');for(const r of Array.from(n))if(r&&await jae(r.href))return r.href;return null}async function jae(e){return new Promise((t,n)=>{try{const n=document.createElement("img");n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e}catch(r){n(r)}})}var Dae=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Uae=(e,t,n)=>(Dae(e,t,"read from private field"),n?n.call(e):t.get(e)),Fae=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},$ae=(e,t,n,r)=>(Dae(e,t,"write to private field"),t.set(e,n),n);function zae(e,t,n){try{Reflect.apply(e,t,n)}catch(r){setTimeout(()=>{throw r})}}class Hae extends Zse{emit(e,...t){let n="error"===e;const r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const n=new Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}const i=r[e];if(void 0===i)return!1;if("function"==typeof i)zae(i,this,t);else{const e=i.length,n=function(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)zae(n[r],this,t)}return!0}}var qae,Wae,Kae=h9(function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var s=o[i];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n}),Gae=class e extends Hae{constructor({logger:t=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),Fae(this,qae,void 0),Fae(this,Wae,void 0),this._log=t,this.setMaxListeners(n),this._state={...e._defaultState},$ae(this,Wae,null),$ae(this,qae,null),this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);const i=new Cae;r.forEach(e=>i.push(e)),this._rpcEngine=i}get chainId(){return Uae(this,qae)}get selectedAddress(){return Uae(this,Wae)}isConnected(){return this._state.isConnected}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw Kse({message:toe.errors.invalidRequestArgs(),data:e});const{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw Kse({message:toe.errors.invalidRequestMethod(),data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw Kse({message:toe.errors.invalidRequestParams(),data:e});const r=null==n?{method:t}:{method:t,params:n};return new Promise((e,t)=>{this._rpcRequest(r,Oae(e,t))})}_initializeState(e){if(this._state.initialized)throw new Error("Provider already initialized.");if(e){const{accounts:t,chainId:n,isUnlocked:r,networkVersion:i}=e;this._handleConnect(n),this._handleChainChanged({chainId:n,networkVersion:i}),this._handleUnlockStateChanged({accounts:t,isUnlocked:r}),this._handleAccountsChanged(t)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,t){let n=t;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),"eth_accounts"!==e.method&&"eth_requestAccounts"!==e.method||(n=(n,r)=>{this._handleAccountsChanged(r.result??[],"eth_accounts"===e.method),t(n,r)})),this._rpcEngine.handle(e,n)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(toe.info.connected(e)))}_handleDisconnect(e,t){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let n;this._state.isConnected=!1,e?(n=new qse(1013,t??toe.errors.disconnected()),this._log.debug(n)):(n=new qse(1011,t??toe.errors.permanentlyDisconnected()),this._log.error(n),$ae(this,qae,null),this._state.accounts=null,$ae(this,Wae,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",n)}}_handleChainChanged({chainId:e}={}){Tae(e)?(this._handleConnect(e),e!==Uae(this,qae)&&($ae(this,qae,e),this._state.initialized&&this.emit("chainChanged",Uae(this,qae)))):this._log.error(toe.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,t=!1){let n=e;Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),n=[]);for(const r of e)if("string"!=typeof r){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),n=[];break}if(!Kae(this._state.accounts,n)&&(t&&null!==this._state.accounts&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",n),this._state.accounts=n,Uae(this,Wae)!==n[0]&&$ae(this,Wae,n[0]||null),this._state.initialized)){const e=[...n];this.emit("accountsChanged",e)}}_handleUnlockStateChanged({accounts:e,isUnlocked:t}={}){"boolean"==typeof t?t!==this._state.isUnlocked&&(this._state.isUnlocked=t,this._handleAccountsChanged(e??[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}};qae=new WeakMap,Wae=new WeakMap,Gae._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var Vae,Zae,Yae=Gae,Jae={exports:{}};function Qae(){return Zae?Vae:(Zae=1,Vae=tae.EventEmitter)}var Xae,ece=f9(u9);Xae="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var tce=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++)n[t[r]]=Object.getOwnPropertyDescriptor(e,t[r]);return n},nce=/%[sdj%]/g;function rce(e){if(!vce(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(cce(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(nce,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),s=r[n];n<i;s=r[++n])gce(s)||!xce(s)?o+=" "+s:o+=" "+cce(s);return o}function ice(e,t){if(Ece(u7.process))return function(){return ice(e,t).apply(this,arguments)};if(!0===sse.noDeprecation)return e;var n=!1;return function(){if(!n){if(sse.throwDeprecation)throw new Error(t);sse.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var oce,sce={};function ace(e){return Ece(oce)&&(oce=sse.env.NODE_DEBUG||""),e=e.toUpperCase(),sce[e]||(new RegExp("\\b"+e+"\\b","i").test(oce)?sce[e]=function(){var t=rce.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:sce[e]=function(){}),sce[e]}function cce(e,t){var n={seen:[],stylize:uce};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),mce(t)?n.showHidden=t:t&&Oce(n,t),Ece(n.showHidden)&&(n.showHidden=!1),Ece(n.depth)&&(n.depth=2),Ece(n.colors)&&(n.colors=!1),Ece(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=lce),dce(n,e,n.depth)}function lce(e,t){var n=cce.styles[t];return n?"["+cce.colors[n][0]+"m"+e+"["+cce.colors[n][1]+"m":e}function uce(e,t){return e}function dce(e,t,n){if(e.customInspect&&t&&Cce(t.inspect)&&t.inspect!==cce&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return vce(r)||(r=dce(e,r,n)),r}var i=function(e,t){if(Ece(t))return e.stylize("undefined","undefined");if(vce(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return bce(t)?e.stylize(""+t,"number"):mce(t)?e.stylize(""+t,"boolean"):gce(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o,s=Object.keys(t),a=(o={},s.forEach(function(e,t){o[e]=!0}),o);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),Sce(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return hce(t);if(0===s.length){if(Cce(t)){var c=t.name?": "+t.name:"";return e.stylize("[Function"+c+"]","special")}if(_ce(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(kce(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Sce(t))return hce(t)}var l,u="",d=!1,h=["{","}"];return pce(t)&&(d=!0,h=["[","]"]),Cce(t)&&(u=" [Function"+(t.name?": "+t.name:"")+"]"),_ce(t)&&(u=" "+RegExp.prototype.toString.call(t)),kce(t)&&(u=" "+Date.prototype.toUTCString.call(t)),Sce(t)&&(u=" "+hce(t)),0!==s.length||d&&0!=t.length?n<0?_ce(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=d?function(e,t,n,r,i){for(var o=[],s=0,a=t.length;s<a;++s)Tce(t,String(s))?o.push(fce(e,t,n,r,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(fce(e,t,n,r,i,!0))}),o}(e,t,n,a,s):s.map(function(r){return fce(e,t,n,a,r,d)}),e.seen.pop(),function(e,t,n){return e.reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(l,u,h)):h[0]+u+h[1]}function hce(e){return"["+Error.prototype.toString.call(e)+"]"}function fce(e,t,n,r,i,o){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),Tce(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(c.value)<0?(a=gce(n)?dce(e,c.value,null):dce(e,c.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),Ece(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function pce(e){return Array.isArray(e)}function mce(e){return"boolean"==typeof e}function gce(e){return null===e}function yce(e){return null==e}function bce(e){return"number"==typeof e}function vce(e){return"string"==typeof e}function wce(e){return"symbol"==typeof e}function Ece(e){return void 0===e}function _ce(e){return xce(e)&&"[object RegExp]"===Pce(e)}function xce(e){return"object"==typeof e&&null!==e}function kce(e){return xce(e)&&"[object Date]"===Pce(e)}function Sce(e){return xce(e)&&("[object Error]"===Pce(e)||e instanceof Error)}function Cce(e){return"function"==typeof e}function Ice(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Ace(e){return S7.isBuffer(e)}function Pce(e){return Object.prototype.toString.call(e)}cce.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},cce.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function Mce(){}function Oce(e,t){if(!t||!xce(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function Tce(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Rce="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function Nce(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(Rce&&e[Rce]){var t;if("function"!=typeof(t=e[Rce]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,Rce,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise(function(e,r){t=e,n=r}),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push(function(e,r){e?n(e):t(r)});try{e.apply(this,i)}catch(s){n(s)}return r}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Rce&&Object.defineProperty(t,Rce,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,tce(e))}function Lce(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}function Bce(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n]);var r=t.pop();if("function"!=typeof r)throw new TypeError("The last argument must be of type Function");var i=this,o=function(){return r.apply(i,arguments)};e.apply(this,t).then(function(e){sse.nextTick(o.bind(null,null,e))},function(e){sse.nextTick(Lce.bind(null,e,o))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,tce(e)),t}Nce.custom=Rce;var jce,Dce,Uce,Fce,$ce={inherits:Xae,_extend:Oce,log:Mce,isBuffer:Ace,isPrimitive:Ice,isFunction:Cce,isError:Sce,isDate:kce,isObject:xce,isRegExp:_ce,isUndefined:Ece,isSymbol:wce,isString:vce,isNumber:bce,isNullOrUndefined:yce,isNull:gce,isBoolean:mce,isArray:pce,inspect:cce,deprecate:ice,format:rce,debuglog:ace,promisify:Nce,callbackify:Bce},zce=f9(Object.freeze({__proto__:null,_extend:Oce,callbackify:Bce,debuglog:ace,default:$ce,deprecate:ice,format:rce,inherits:Xae,inspect:cce,isArray:pce,isBoolean:mce,isBuffer:Ace,isDate:kce,isError:Sce,isFunction:Cce,isNull:gce,isNullOrUndefined:yce,isNumber:bce,isObject:xce,isPrimitive:Ice,isRegExp:_ce,isString:vce,isSymbol:wce,isUndefined:Ece,log:Mce,promisify:Nce}));function Hce(){if(Dce)return jce;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach(function(e){n(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function n(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Dce=1;var i=ece.Buffer,o=zce.inspect,s=o&&o.custom||"inspect";return jce=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return function(e,t){t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t,n,r,o=i.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=o,r=a,i.prototype.copy.call(t,n,r),a+=s.data.length,s=s.next;return o}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0===(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,s),0===(e-=s)){s===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(s));break}++r}return this.length-=r,t}},{key:s,value:function(e,n){return o(this,t(t({},n),{},{depth:0,customInspect:!1}))}}]),e}()}function qce(){if(Fce)return Uce;function e(e,r){n(e,r),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}return Fce=1,Uce={destroy:function(r,i){var o=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,sse.nextTick(n,this,r)):sse.nextTick(n,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(n){!i&&n?o._writableState?o._writableState.errorEmitted?sse.nextTick(t,o):(o._writableState.errorEmitted=!0,sse.nextTick(e,o,n)):sse.nextTick(e,o,n):i?(sse.nextTick(t,o),i(n)):sse.nextTick(t,o)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},Uce}var Wce,Kce,Gce={},Vce={};function Zce(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,(o=n,s=r,a=i,"string"==typeof t?t:t(o,s,a)))||this;var o,s,a}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,Vce[e]=r}function Yce(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function Jce(){if(Kce)return Wce;Kce=1;var e=Gce.codes.ERR_INVALID_OPT_VALUE;return Wce={getHighWaterMark:function(t,n,r,i){var o,s,a,c=(s=i,a=r,null!=(o=n).highWaterMark?o.highWaterMark:s?o[a]:null);if(null!=c){if(!isFinite(c)||Math.floor(c)!==c||c<0)throw new e(i?r:"highWaterMark",c);return Math.floor(c)}return t.objectMode?16:16384}}}Zce("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),Zce("ERR_INVALID_ARG_TYPE",function(e,t,n){var r,i,o,s,a,c;if("string"==typeof t&&(i="not ",t.substr(0,4)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",s=e,a=" argument",(void 0===c||c>s.length)&&(c=s.length),s.substring(c-9,c)===a)o="The ".concat(e," ").concat(r," ").concat(Yce(t,"type"));else{var l=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+1>e.length)&&-1!==e.indexOf(".",n)}(e)?"property":"argument";o='The "'.concat(e,'" ').concat(l," ").concat(r," ").concat(Yce(t,"type"))}return o+". Received type ".concat(typeof n)},TypeError),Zce("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Zce("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),Zce("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Zce("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),Zce("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Zce("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Zce("ERR_STREAM_WRITE_AFTER_END","write after end"),Zce("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Zce("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),Zce("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Gce.codes=Vce;var Qce,Xce,ele,tle,nle,rle,ile="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},ole=f9(Object.freeze({__proto__:null,default:ile}));function sle(){if(Xce)return Qce;function e(e){try{if(!d9.localStorage)return!1}catch(n){return!1}var t=d9.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return Xce=1,Qce=function(t,n){if(e("noDeprecation"))return t;var r=!1;return function(){if(!r){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return t.apply(this,arguments)}},Qce}function ale(){if(tle)return ele;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t){var n=e.entry;for(e.entry=null;n;){var r=n.callback;t.pendingcb--,r(undefined),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var t;tle=1,ele=E,E.WritableState=w;var n,r={deprecate:sle()},i=Qae(),o=ece.Buffer,s=(void 0!==d9?d9:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=qce(),c=Jce().getHighWaterMark,l=Gce.codes,u=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,h=l.ERR_MULTIPLE_CALLBACK,f=l.ERR_STREAM_CANNOT_PIPE,p=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,y=l.ERR_UNKNOWN_ENCODING,b=a.errorOrDestroy;function v(){}function w(n,r,i){t=t||cle(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=c(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n,r=e._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new h;if((n=r).writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t)!function(e,t,n,r,i){--t.pendingcb,n?(sse.nextTick(i,r),sse.nextTick(I,e,t),e._writableState.errorEmitted=!0,b(e,r)):(i(r),e._writableState.errorEmitted=!0,b(e,r),I(e,t))}(e,r,i,t,o);else{var s=S(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||k(e,r),i?sse.nextTick(x,e,r,s,o):x(e,r,s,o)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function E(e){var r=this instanceof(t=t||cle());if(!r&&!n.call(E,this))return new E(e);this._writableState=new w(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function _(e,t,n,r,i,o,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new p("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function x(e,t,n,r){var i,o;n||(i=e,0===(o=t).length&&o.needDrain&&(o.needDrain=!1,i.emit("drain"))),t.pendingcb--,r(),I(e,t)}function k(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=n.bufferedRequestCount,o=new Array(i),s=n.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)o[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;o.allBuffers=c,_(t,n,!0,n.length,o,"",s.finish),n.pendingcb++,n.lastBufferedRequest=null,s.next?(n.corkedRequestsFree=s.next,s.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,d=r.callback;if(_(t,n,!1,n.objectMode?1:l.length,l,u,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function C(e,t){e._final(function(n){t.pendingcb--,n&&b(e,n),t.prefinished=!0,e.emit("prefinish"),I(e,t)})}function I(e,t){var n,r,i=S(t);if(i&&(n=e,(r=t).prefinished||r.finalCalled||("function"!=typeof n._final||r.destroyed?(r.prefinished=!0,n.emit("prefinish")):(r.pendingcb++,r.finalCalled=!0,sse.nextTick(C,n,r))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var o=e._readableState;(!o||o.autoDestroy&&o.endEmitted)&&e.destroy()}return i}return ole(E,i),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===E&&e&&e._writableState instanceof w}})):n=function(e){return e instanceof this},E.prototype.pipe=function(){b(this,new f)},E.prototype.write=function(e,t,n){var r,i,a=this._writableState,c=!1,l=!a.objectMode&&(r=e,o.isBuffer(r)||r instanceof s);return l&&!o.isBuffer(e)&&(i=e,e=o.from(i)),"function"==typeof t&&(n=t,t=null),l?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof n&&(n=v),a.ending?function(e,t){var n=new g;b(e,n),sse.nextTick(t,n)}(this,n):(l||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new u("chunk",["string","Buffer"],n)),!i||(b(e,i),sse.nextTick(r,i),!1)}(this,a,e,n))&&(a.pendingcb++,c=function(e,t,n,r,i,s){if(!n){var a=(l=r,u=i,(c=t).objectMode||!1===c.decodeStrings||"string"!=typeof l||(l=o.from(l,u)),l);r!==a&&(n=!0,i="buffer",r=a)}var c,l,u,d=t.objectMode?1:r.length;t.length+=d;var h=t.length<t.highWaterMark;if(h||(t.needDrain=!0),t.writing||t.corked){var f=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:s,next:null},f?f.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else _(e,t,!1,d,r,i,s);return h}(this,a,l,e,t,n)),c},E.prototype.cork=function(){this._writableState.corked++},E.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||k(this,e))},E.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new y(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(e,t,n){n(new d("_write()"))},E.prototype._writev=null,E.prototype.end=function(e,t,n){var r,i,o,s=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),s.corked&&(s.corked=1,this.uncork()),s.ending||(r=this,o=n,(i=s).ending=!0,I(r,i),o&&(i.finished?sse.nextTick(o):r.once("finish",o)),i.ended=!0,r.writable=!1),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),E.prototype.destroy=a.destroy,E.prototype._undestroy=a.undestroy,E.prototype._destroy=function(e,t){t(e)},ele}function cle(){if(rle)return nle;rle=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};nle=s;var t=Sle(),n=ale();ole(s,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var o=r[i];s.prototype[o]||(s.prototype[o]=n.prototype[o])}function s(e){if(!(this instanceof s))return new s(e);t.call(this,e),n.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||sse.nextTick(c,this)}function c(e){e.end()}return Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),nle}var lle=S7.isEncoding||function(e){switch(e&&e.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 ule(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!lle(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=hle;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=fle;break;default:return void(this.write=dle)}this.charBuffer=new S7(6),this.charReceived=0,this.charLength=0}function dle(e){return e.toString(this.encoding)}function hle(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function fle(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}ule.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((r=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},ule.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},ule.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var ple=f9(Object.freeze({__proto__:null,StringDecoder:ule})),mle=Gce.codes.ERR_STREAM_PREMATURE_CLOSE;function gle(){}var yle,ble,vle,wle,Ele,_le,xle=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(r||gle);var i=n.readable||!1!==n.readable&&t.readable,o=n.writable||!1!==n.writable&&t.writable,s=function(){t.writable||c()},a=t._writableState&&t._writableState.finished,c=function(){o=!1,a=!0,i||r.call(t)},l=t._readableState&&t._readableState.endEmitted,u=function(){i=!1,l=!0,o||r.call(t)},d=function(e){r.call(t,e)},h=function(){var e;return i&&!l?(t._readableState&&t._readableState.ended||(e=new mle),r.call(t,e)):o&&!a?(t._writableState&&t._writableState.ended||(e=new mle),r.call(t,e)):void 0},f=function(){t.req.on("finish",c)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",c),t.on("abort",h),t.req?f():t.on("request",f)):o&&!t._writableState&&(t.on("end",s),t.on("close",s)),t.on("end",u),t.on("finish",c),!1!==n.error&&t.on("error",d),t.on("close",h),function(){t.removeListener("complete",c),t.removeListener("abort",h),t.removeListener("request",f),t.req&&t.req.removeListener("finish",c),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",c),t.removeListener("end",u),t.removeListener("error",d),t.removeListener("close",h)}};function kle(){if(ble)return yle;var e;function t(e,t,n){return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t,"string"))?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e;var r}ble=1;var n=xle,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),s=Symbol("ended"),a=Symbol("lastPromise"),c=Symbol("handlePromise"),l=Symbol("stream");function u(e,t){return{value:e,done:t}}function d(e){var t=e[r];if(null!==t){var n=e[l].read();null!==n&&(e[a]=null,e[r]=null,e[i]=null,t(u(n,!1)))}}function h(e){sse.nextTick(d,e)}var f=Object.getPrototypeOf(function(){}),p=Object.setPrototypeOf((t(e={get stream(){return this[l]},next:function(){var e=this,t=this[o];if(null!==t)return Promise.reject(t);if(this[s])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise(function(t,n){sse.nextTick(function(){e[o]?n(e[o]):t(u(void 0,!0))})});var n,r=this[a];if(r)n=new Promise(function(e,t){return function(n,r){e.then(function(){t[s]?n(u(void 0,!0)):t[c](n,r)},r)}}(r,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(u(i,!1));n=new Promise(this[c])}return this[a]=n,n}},Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var e=this;return new Promise(function(t,n){e[l].destroy(null,function(e){e?n(e):t(u(void 0,!0))})})}),e),f);return yle=function(e){var d,f=Object.create(p,(t(d={},l,{value:e,writable:!0}),t(d,r,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,o,{value:null,writable:!0}),t(d,s,{value:e._readableState.endEmitted,writable:!0}),t(d,c,{value:function(e,t){var n=f[l].read();n?(f[a]=null,f[r]=null,f[i]=null,e(u(n,!1))):(f[r]=e,f[i]=t)},writable:!0}),d));return f[a]=null,n(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=f[i];return null!==t&&(f[a]=null,f[r]=null,f[i]=null,t(e)),void(f[o]=e)}var n=f[r];null!==n&&(f[a]=null,f[r]=null,f[i]=null,n(u(void 0,!0))),f[s]=!0}),e.on("readable",h.bind(null,f)),f}}function Sle(){if(_le)return Ele;var e;_le=1,Ele=E,E.ReadableState=w,tae.EventEmitter;var t,n=function(e,t){return e.listeners(t).length},r=Qae(),i=ece.Buffer,o=(void 0!==d9?d9:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},s=zce;t=s&&s.debuglog?s.debuglog("stream"):function(){};var a,c,l,u=Hce(),d=qce(),h=Jce().getHighWaterMark,f=Gce.codes,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_STREAM_PUSH_AFTER_EOF,g=f.ERR_METHOD_NOT_IMPLEMENTED,y=f.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;ole(E,r);var b=d.errorOrDestroy,v=["error","close","destroy","pause","resume"];function w(t,n,r){e=e||cle(),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=h(this,t,"readableHighWaterMark",r),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(a||(a=ple.StringDecoder),this.decoder=new a(t.encoding),this.encoding=t.encoding)}function E(t){if(e=e||cle(),!(this instanceof E))return new E(t);var n=this instanceof e;this._readableState=new w(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),r.call(this)}function _(e,n,r,s,a){t("readableAddChunk",n);var c,l,u,d,h,f=e._readableState;if(null===n)f.reading=!1,function(e,n){if(t("onEofChunk"),!n.ended){if(n.decoder){var r=n.decoder.end();r&&r.length&&(n.buffer.push(r),n.length+=n.objectMode?1:r.length)}n.ended=!0,n.sync?C(e):(n.needReadable=!1,n.emittedReadable||(n.emittedReadable=!0,I(e)))}}(e,f);else if(a||(l=f,h=u=n,i.isBuffer(h)||h instanceof o||"string"==typeof u||void 0===u||l.objectMode||(d=new p("chunk",["string","Buffer","Uint8Array"],u)),c=d),c)b(e,c);else if(f.objectMode||n&&n.length>0)if("string"==typeof n||f.objectMode||Object.getPrototypeOf(n)===i.prototype||(n=function(e){return i.from(e)}(n)),s)f.endEmitted?b(e,new y):x(e,f,n,!0);else if(f.ended)b(e,new m);else{if(f.destroyed)return!1;f.reading=!1,f.decoder&&!r?(n=f.decoder.write(n),f.objectMode||0!==n.length?x(e,f,n,!1):A(e,f)):x(e,f,n,!1)}else s||(f.reading=!1,A(e,f));return!f.ended&&(f.length<f.highWaterMark||0===f.length)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&C(e)),A(e,t)}Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),E.prototype.destroy=d.destroy,E.prototype._undestroy=d.undestroy,E.prototype._destroy=function(e,t){t(e)},E.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=i.from(e,t),t=""),n=!0),_(this,e,t,!1,n)},E.prototype.unshift=function(e){return _(this,e,null,!0,!1)},E.prototype.isPaused=function(){return!1===this._readableState.flowing},E.prototype.setEncoding=function(e){a||(a=ple.StringDecoder);var t=new a(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var k=1073741824;function S(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=((n=e)>=k?n=k:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var n}function C(e){var n=e._readableState;t("emitReadable",n.needReadable,n.emittedReadable),n.needReadable=!1,n.emittedReadable||(t("emitReadable",n.flowing),n.emittedReadable=!0,sse.nextTick(I,e))}function I(e){var n=e._readableState;t("emitReadable_",n.destroyed,n.length,n.ended),n.destroyed||!n.length&&!n.ended||(e.emit("readable"),n.emittedReadable=!1),n.needReadable=!n.flowing&&!n.ended&&n.length<=n.highWaterMark,R(e)}function A(e,t){t.readingMore||(t.readingMore=!0,sse.nextTick(P,e,t))}function P(e,n){for(;!n.reading&&!n.ended&&(n.length<n.highWaterMark||n.flowing&&0===n.length);){var r=n.length;if(t("maybeReadMore read 0"),e.read(0),r===n.length)break}n.readingMore=!1}function M(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function O(e){t("readable nexttick read 0"),e.read(0)}function T(e,n){t("resume",n.reading),n.reading||e.read(0),n.resumeScheduled=!1,e.emit("resume"),R(e),n.flowing&&!n.reading&&e.read(0)}function R(e){var n=e._readableState;for(t("flow",n.flowing);n.flowing&&null!==e.read(););}function N(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function L(e){var n=e._readableState;t("endReadable",n.endEmitted),n.endEmitted||(n.ended=!0,sse.nextTick(B,n,e))}function B(e,n){if(t("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,n.readable=!1,n.emit("end"),e.autoDestroy)){var r=n._writableState;(!r||r.autoDestroy&&r.finished)&&n.destroy()}}function j(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return E.prototype.read=function(e){t("read",e),e=parseInt(e,10);var n=this._readableState,r=e;if(0!==e&&(n.emittedReadable=!1),0===e&&n.needReadable&&((0!==n.highWaterMark?n.length>=n.highWaterMark:n.length>0)||n.ended))return t("read: emitReadable",n.length,n.ended),0===n.length&&n.ended?L(this):C(this),null;if(0===(e=S(e,n))&&n.ended)return 0===n.length&&L(this),null;var i,o=n.needReadable;return t("need readable",o),(0===n.length||n.length-e<n.highWaterMark)&&t("length less than watermark",o=!0),n.ended||n.reading?t("reading or ended",o=!1):o&&(t("do read"),n.reading=!0,n.sync=!0,0===n.length&&(n.needReadable=!0),this._read(n.highWaterMark),n.sync=!1,n.reading||(e=S(r,n))),null===(i=e>0?N(e,n):null)?(n.needReadable=n.length<=n.highWaterMark,e=0):(n.length-=e,n.awaitDrain=0),0===n.length&&(n.ended||(n.needReadable=!0),r!==e&&n.ended&&L(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){b(this,new g("_read()"))},E.prototype.pipe=function(e,r){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,t("pipe count=%d opts=%j",o.pipesCount,r);var s=r&&!1===r.end||e===sse.stdout||e===sse.stderr?p:a;function a(){t("onend"),e.end()}o.endEmitted?sse.nextTick(s):i.once("end",s),e.on("unpipe",function n(r,s){t("onunpipe"),r===i&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,t("cleanup"),e.removeListener("close",h),e.removeListener("finish",f),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",n),i.removeListener("end",a),i.removeListener("end",p),i.removeListener("data",u),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||c())});var c=function(e){return function(){var r=e._readableState;t("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&n(e,"data")&&(r.flowing=!0,R(e))}}(i);e.on("drain",c);var l=!1;function u(n){t("ondata");var r=e.write(n);t("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==j(o.pipes,e))&&!l&&(t("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function d(r){t("onerror",r),p(),e.removeListener("error",d),0===n(e,"error")&&b(e,r)}function h(){e.removeListener("finish",f),p()}function f(){t("onfinish"),e.removeListener("close",h),p()}function p(){t("unpipe"),i.unpipe(e)}return i.on("data",u),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",h),e.once("finish",f),e.emit("pipe",i),o.flowing||(t("pipe resume"),i.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=j(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},E.prototype.on=function(e,n){var i=r.prototype.on.call(this,e,n),o=this._readableState;return"data"===e?(o.readableListening=this.listenerCount("readable")>0,!1!==o.flowing&&this.resume()):"readable"===e&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,t("on readable",o.length,o.reading),o.length?C(this):o.reading||sse.nextTick(O,this))),i},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&sse.nextTick(M,this),n},E.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||sse.nextTick(M,this),t},E.prototype.resume=function(){var e,n,r=this._readableState;return r.flowing||(t("resume"),r.flowing=!r.readableListening,e=this,(n=r).resumeScheduled||(n.resumeScheduled=!0,sse.nextTick(T,e,n))),r.paused=!1,this},E.prototype.pause=function(){return t("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(t("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(e){var n=this,r=this._readableState,i=!1;for(var o in e.on("end",function(){if(t("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&n.push(e)}n.push(null)}),e.on("data",function(o){t("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(n.push(o)||(i=!0,e.pause()))}),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var s=0;s<v.length;s++)e.on(v[s],this.emit.bind(this,v[s]));return this._read=function(n){t("wrapped _read",n),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(E.prototype[Symbol.asyncIterator]=function(){return void 0===c&&(c=kle()),c(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),E._fromList=N,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(E.from=function(e,t){return void 0===l&&(l=wle?vle:(wle=1,vle=function(){throw new Error("Readable.from is not available in the browser")})),l(E,e,t)}),Ele}var Cle=Nle,Ile=Gce.codes,Ale=Ile.ERR_METHOD_NOT_IMPLEMENTED,Ple=Ile.ERR_MULTIPLE_CALLBACK,Mle=Ile.ERR_TRANSFORM_ALREADY_TRANSFORMING,Ole=Ile.ERR_TRANSFORM_WITH_LENGTH_0,Tle=cle();function Rle(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new Ple);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Nle(e){if(!(this instanceof Nle))return new Nle(e);Tle.call(this,e),this._transformState={afterTransform:Rle.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Lle)}function Lle(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Ble(this,null,null):this._flush(function(t,n){Ble(e,t,n)})}function Ble(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Ole;if(e._transformState.transforming)throw new Mle;return e.push(null)}ole(Nle,Tle),Nle.prototype.push=function(e,t){return this._transformState.needTransform=!1,Tle.prototype.push.call(this,e,t)},Nle.prototype._transform=function(e,t,n){n(new Ale("_transform()"))},Nle.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Nle.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},Nle.prototype._destroy=function(e,t){Tle.prototype._destroy.call(this,e,function(e){t(e)})};var jle,Dle=Fle,Ule=Cle;function Fle(e){if(!(this instanceof Fle))return new Fle(e);Ule.call(this,e)}ole(Fle,Ule),Fle.prototype._transform=function(e,t,n){n(null,e)};var $le=Gce.codes,zle=$le.ERR_MISSING_ARGS,Hle=$le.ERR_STREAM_DESTROYED;function qle(e){if(e)throw e}function Wle(e){e()}function Kle(e,t){return e.pipe(t)}var Gle,Vle=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i,o=(i=t).length?"function"!=typeof i[i.length-1]?qle:i.pop():qle;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new zle("streams");var s=t.map(function(e,n){var i=n<t.length-1;return function(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var i=!1;e.on("close",function(){i=!0}),void 0===jle&&(jle=xle),jle(e,{readable:t,writable:n},function(e){if(e)return r(e);i=!0,r()});var o=!1;return function(t){if(!i&&!o)return o=!0,(n=e).setHeader&&"function"==typeof n.abort?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new Hle("pipe"));var n}}(e,i,n>0,function(e){r||(r=e),e&&s.forEach(Wle),i||(s.forEach(Wle),o(r))})});return t.reduce(Kle)};Gle=Jae.exports,(Gle=Jae.exports=Sle()).Stream=Gle,Gle.Readable=Gle,Gle.Writable=ale(),Gle.Duplex=cle(),Gle.Transform=Cle,Gle.PassThrough=Dle,Gle.finished=xle,Gle.pipeline=Vle;var Zle=Jae.exports;var Yle={},Jle={exports:{}},Qle=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(e){r[e]=t[e]}),r;function r(){for(var e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];var r=t.apply(this,e),i=e[e.length-1];return"function"==typeof r&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}};function Xle(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function eue(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}Jle.exports=Qle(Xle),Jle.exports.strict=Qle(eue),Xle.proto=Xle(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Xle(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return eue(this)},configurable:!0})});var tue=Jle.exports,nue={};Object.defineProperty(nue,"__esModule",{value:!0}),nue.Substream=void 0;const rue=Zle;class iue extends rue.Duplex{constructor({parent:e,name:t}){super({objectMode:!0}),this._parent=e,this._name=t}_read(){}_write(e,t,n){this._parent.push({name:this._name,data:e}),n()}}nue.Substream=iue;var oue=d9&&d9.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Yle,"__esModule",{value:!0}),Yle.ObjectMultiplex=void 0;const sue=Zle,aue=oue(tue),cue=nue,lue=Symbol("IGNORE_SUBSTREAM");let uue=class extends sue.Duplex{constructor(e={}){super(Object.assign(Object.assign({},e),{objectMode:!0})),this._substreams={}}createStream(e){if(this.destroyed)throw new Error(`ObjectMultiplex - parent stream for name "${e}" already destroyed`);if(this._readableState.ended||this._writableState.ended)throw new Error(`ObjectMultiplex - parent stream for name "${e}" already ended`);if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);const t=new cue.Substream({parent:this,name:e});return this._substreams[e]=t,function(e){const n=(0,aue.default)(e=>t.destroy(e||void 0));(0,sue.finished)(e,{readable:!1},n),(0,sue.finished)(e,{writable:!1},n)}(this),t}ignoreStream(e){if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=lue}_read(){}_write(e,t,n){const{name:r,data:i}=e;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),n();const o=this._substreams[r];return o?(o!==lue&&o.push(i),n()):(console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n())}};Yle.ObjectMultiplex=uue;var due=h9(Yle.ObjectMultiplex);const hue=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;hue.writable=e=>hue(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,hue.readable=e=>hue(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,hue.duplex=e=>hue.writable(e)&&hue.readable(e),hue.transform=e=>hue.duplex(e)&&"function"==typeof e._transform;var fue,pue=hue,mue=class extends Yae{constructor(e,{jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!pue.duplex(e))throw new Error(toe.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new due;Zle.pipeline(e,o,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=function(e={}){const t={},n=new Zle.Duplex({objectMode:!0,read:()=>{},write:function(n,o,s){let a=null;try{n.id?function(e){const{id:n}=e;if(null===n)return;const r=t[n];r?(delete t[n],Object.assign(r.res,e),setTimeout(r.end)):console.warn(`StreamMiddleware - Unknown response id "${n}"`)}(n):(c=n,(null==e?void 0:e.retryOnMessage)&&c.method===e.retryOnMessage&&Object.values(t).forEach(({req:e,retryCount:n=0})=>{if(!e.id)return;if(n>=3)throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${e.id}"`);const r=t[e.id];r&&(r.retryCount=n+1),i(e)}),r.emit("notification",c))}catch(l){a=l}var c;s(a)}}),r=new kae;return{events:r,middleware:(e,n,r,o)=>{t[e.id]={req:e,res:n,next:r,end:o},i(e)},stream:n};function i(e){n.push(e)}}({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),Zle.pipeline(this._jsonRpcConnection.stream,o.createStream(t),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",t=>{const{method:n,params:r}=t;"metamask_accountsChanged"===n?this._handleAccountsChanged(r):"metamask_unlockStateChanged"===n?this._handleUnlockStateChanged(r):"metamask_chainChanged"===n?this._handleChainChanged(r):Aae.includes(n)?this.emit("message",{type:n,data:r}):"METAMASK_STREAM_FAILURE"===n&&e.destroy(new Error(toe.errors.permanentlyDisconnected()))})}async _initializeStateAsync(){let e;try{e=await this.request({method:"metamask_getProviderState"})}catch(t){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",t)}this._initializeState(e)}_handleStreamDisconnect(e,t){let n=`MetaMask: Lost connection to "${e}".`;(null==t?void 0:t.stack)&&(n+=`\n${t.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,t?t.message:void 0)}_handleChainChanged({chainId:e,networkVersion:t}={}){var n;Tae(e)&&(n=t,Boolean(n)&&"string"==typeof n)?"loading"===t?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(toe.errors.invalidNetworkParams(),{chainId:e,networkVersion:t})}},gue=class extends mue{constructor(e,{jsonRpcStreamName:t="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:Pae(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},Fae(this,fue,void 0),this._initializeStateAsync(),$ae(this,fue,null),this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",e=>{const{method:t}=e;Aae.includes(t)&&(this.emit("data",e),this.emit("notification",e.params.result))}),i)if("complete"===document.readyState)Nae(this._rpcEngine,this._log);else{const e=()=>{Nae(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",e)};window.addEventListener("DOMContentLoaded",e)}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(toe.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(toe.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),Uae(this,fue)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(toe.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(e,t){this._rpcRequest(e,t)}addListener(e,t){return this._warnOfDeprecation(e),super.addListener(e,t)}on(e,t){return this._warnOfDeprecation(e),super.on(e,t)}once(e,t){return this._warnOfDeprecation(e),super.once(e,t)}prependListener(e,t){return this._warnOfDeprecation(e),super.prependListener(e,t)}prependOnceListener(e,t){return this._warnOfDeprecation(e),super.prependOnceListener(e,t)}_handleDisconnect(e,t){super._handleDisconnect(e,t),Uae(this,fue)&&!e&&$ae(this,fue,null)}_warnOfDeprecation(e){var t;!1===(null==(t=this._sentWarnings)?void 0:t.events[e])&&(this._log.warn(toe.warnings.events[e]),this._sentWarnings.events[e]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(toe.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise((e,t)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},Oae(e,t))}catch(n){t(n)}})}send(e,t){return this._sentWarnings.send||(this._log.warn(toe.warnings.sendDeprecation),this._sentWarnings.send=!0),"string"!=typeof e||t&&!Array.isArray(t)?e&&"object"==typeof e&&"function"==typeof t?this._rpcRequest(e,t):this._sendSync(e):new Promise((n,r)=>{try{this._rpcRequest({method:e,params:t},Oae(n,r,!1))}catch(i){r(i)}})}_sendSync(e){let t;switch(e.method){case"eth_accounts":t=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":t=this.selectedAddress??null;break;case"eth_uninstallFilter":this._rpcRequest(e,Rae),t=!0;break;case"net_version":t=Uae(this,fue)??null;break;default:throw new Error(toe.errors.unsupportedSync(e.method))}return{id:e.id,jsonrpc:e.jsonrpc,result:t}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise(e=>{this.on("_initialized",()=>e())}),this._state.isUnlocked),requestBatch:async e=>{if(!Array.isArray(e))throw Kse({message:"Batch requests must be made with an array of request objects.",data:e});return new Promise((t,n)=>{this._rpcRequest(e,Oae(t,n))})}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(toe.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==Uae(this,fue)&&($ae(this,fue,t),this._state.initialized&&this.emit("networkChanged",Uae(this,fue)))}};fue=new WeakMap;const yue=f1("MM_SDK");yue.color="#FFAC1C";var bue={},vue={};Object.defineProperty(vue,"__esModule",{value:!0}),vue.EthereumProviderError=vue.EthereumRpcError=void 0;const wue=Mse;class Eue extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return wue.default(this.serialize(),_ue,2)}}function _ue(e,t){if("[Circular]"!==t)return t}vue.EthereumRpcError=Eue,vue.EthereumProviderError=class extends Eue{constructor(e,t,n){if(r=e,!(Number.isInteger(r)&&r>=1e3&&r<=4999))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');var r;super(e,t,n)}};var xue={},kue={};Object.defineProperty(kue,"__esModule",{value:!0}),kue.errorValues=kue.errorCodes=void 0,kue.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},kue.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=kue,n=vue,r=t.errorCodes.rpc.internal,i={code:r,message:o(r)};function o(n,r="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(n)){const r=n.toString();if(l(t.errorValues,r))return t.errorValues[r].message;if(a(n))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return r}function s(e){if(!Number.isInteger(e))return!1;const n=e.toString();return!!t.errorValues[n]||!!a(e)}function a(e){return e>=-32099&&e<=-32e3}function c(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function l(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=o,e.isValidCode=s,e.serializeError=function(e,{fallbackError:t=i,shouldIncludeStack:r=!1}={}){var a,u;if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw new Error("Must provide fallback error with integer number code and string message.");if(e instanceof n.EthereumRpcError)return e.serialize();const d={};if(e&&"object"==typeof e&&!Array.isArray(e)&&l(e,"code")&&s(e.code)){const t=e;d.code=t.code,t.message&&"string"==typeof t.message?(d.message=t.message,l(t,"data")&&(d.data=t.data)):(d.message=o(d.code),d.data={originalError:c(e)})}else{d.code=t.code;const n=null===(a=e)||void 0===a?void 0:a.message;d.message=n&&"string"==typeof n?n:t.message,d.data={originalError:c(e)}}const h=null===(u=e)||void 0===u?void 0:u.stack;return r&&e&&h&&"string"==typeof h&&(d.stack=h),d}}(xue);var Sue={};Object.defineProperty(Sue,"__esModule",{value:!0}),Sue.ethErrors=void 0;const Cue=vue,Iue=xue,Aue=kue;function Pue(e,t){const[n,r]=Oue(t);return new Cue.EthereumRpcError(e,n||Iue.getMessageFromCode(e),r)}function Mue(e,t){const[n,r]=Oue(t);return new Cue.EthereumProviderError(e,n||Iue.getMessageFromCode(e),r)}function Oue(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}Sue.ethErrors={rpc:{parse:e=>Pue(Aue.errorCodes.rpc.parse,e),invalidRequest:e=>Pue(Aue.errorCodes.rpc.invalidRequest,e),invalidParams:e=>Pue(Aue.errorCodes.rpc.invalidParams,e),methodNotFound:e=>Pue(Aue.errorCodes.rpc.methodNotFound,e),internal:e=>Pue(Aue.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Pue(t,e)},invalidInput:e=>Pue(Aue.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>Pue(Aue.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>Pue(Aue.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>Pue(Aue.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>Pue(Aue.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>Pue(Aue.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Mue(Aue.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>Mue(Aue.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>Mue(Aue.errorCodes.provider.unsupportedMethod,e),disconnected:e=>Mue(Aue.errorCodes.provider.disconnected,e),chainDisconnected:e=>Mue(Aue.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw new Error('"message" must be a nonempty string');return new Cue.EthereumProviderError(t,n,r)}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=vue;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const n=xue;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=Sue;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const i=kue;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})}(bue);var Tue={exports:{}};Tue.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,c=e.map([t,n],function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach(function(t){r[t]=e[t]})};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){}var t,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],null&&s(t.prototype,null),n&&s(t,n),e}();t.default=a,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=c(n(92)),i=c(n(93)),o=c(n(94)),s=c(n(95)),a=c(n(17));function c(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach(function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)}),r>0){var s=Object.keys(n),c=a.default.find(s,function(e){return t.isOS(e)});if(c){var l=this.satisfies(n[c]);if(void 0!==l)return l}var u=a.default.find(s,function(e){return t.isPlatform(e)});if(u){var d=this.satisfies(n[u]);if(void 0!==d)return d}}if(o>0){var h=Object.keys(i),f=a.default.find(h,function(e){return t.isBrowser(e,!0)});if(void 0!==f)return this.compareVersion(i[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e)})},e}();t.default=l,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}});var Rue=h9(Tue.exports);const Nue={Initialized:"initialized",DisplayURI:"display_uri",ProviderUpdate:"provider_update",ConnectWithResponse:"connectWithResponse",ConnectionStatus:"connection_status",ServiceStatus:"service_status"};class Lue{constructor({shouldSetOnWindow:e,connectionStream:t,shouldSendMetadata:n=!1,shouldShimWeb3:r,sdkInstance:i}){const o=new Due({connectionStream:t,shouldSendMetadata:n,shouldSetOnWindow:e,shouldShimWeb3:r,autoRequestAccounts:!1}),s=new Proxy(o,{deleteProperty:()=>!0});if(this.provider=s,this.sdkInstance=i,e&&"undefined"!=typeof window)try{a=o,window.ethereum=a,window.dispatchEvent(new Event("ethereum#initialized"))}catch(c){yue("[Ethereum] Unable to set global provider - window.ethereum may be read-only",c)}var a;if(r&&"undefined"!=typeof window)try{!function(e,t=console){let n=!1,r=!1;if(!window.web3){const i="__isMetaMaskShim__";let o={currentProvider:e};Object.defineProperty(o,i,{value:!0,enumerable:!0,configurable:!1,writable:!1}),o=new Proxy(o,{get:(o,s,...a)=>("currentProvider"!==s||n?"currentProvider"===s||s===i||r||(r=!0,t.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),e.request({method:"metamask_logWeb3ShimUsage"}).catch(e=>{t.debug("MetaMask: Failed to log web3 shim usage.",e)})):(n=!0,t.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(o,s,...a)),set:(...e)=>(t.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...e))}),Object.defineProperty(window,"web3",{value:o,enumerable:!1,configurable:!0,writable:!0})}}(this.provider)}catch(c){yue("[Ethereum] Unable to shim web3 - window.web3 may be read-only",c)}this.provider.on("display_uri",e=>{this.sdkInstance.emit(Nue.DisplayURI,e)}),this.provider.on("_initialized",()=>{const e={chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaMask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()};this.sdkInstance.emit(Nue.Initialized,e),yue("[Ethereum: constructor()] provider initialized",e)})}static init(e){var t;return yue("[Ethereum: init()] Initializing Ethereum service"),this.instance=new Lue(e),null===(t=this.instance)||void 0===t?void 0:t.provider}static destroy(){}static getInstance(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}class Bue{constructor({useDeepLink:e,preferredOpenLink:t,debug:n=!1}){this.state={platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=e,this.state.preferredOpenLink=t,this.state.debug=n}openDeeplink(e,t,n){return function(e,t,n,r){const{state:i}=e;yue(`[PlatfformManager: openDeeplink()] universalLink --\x3e ${t}`),yue(`[PlatfformManager: openDeeplink()] deepLink --\x3e ${n}`);try{if(i.preferredOpenLink)return void i.preferredOpenLink(i.useDeeplink?n:t,r);if(yue(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${i.useDeeplink} link=${i.useDeeplink?n:t}`),i.useDeeplink)"undefined"!=typeof window&&(window.location.href=n);else if("undefined"!=typeof document){const e=document.createElement("a");e.href=t,e.target="_self",e.rel="noreferrer noopener",e.click()}}catch(o){}}(this,e,t,n)}isReactNative(){var e;return this.isNotBrowser()&&"undefined"!=typeof window&&(null===window||void 0===window?void 0:window.navigator)&&"ReactNative"===(null===(e=window.navigator)||void 0===e?void 0:e.product)}isMetaMaskInstalled(){return function(){const e=Lue.getProvider()||(null===window||void 0===window?void 0:window.ethereum);return yue(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${null==e?void 0:e.isMetaMask} isConnected=${null==e?void 0:e.isConnected()}`),(null==e?void 0:e.isMetaMask)&&(null==e?void 0:e.isConnected())}()}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,t;const n=Rue.parse(window.navigator.userAgent);return"mobile"===(null===(e=null==n?void 0:n.platform)||void 0===e?void 0:e.type)||"tablet"===(null===(t=null==n?void 0:n.platform)||void 0===t?void 0:t.type)}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return"undefined"!=typeof window&&Boolean(window.ReactNativeWebView)&&Boolean(navigator.userAgent.endsWith("MetaMaskMobile"))}isMobileWeb(){return this.state.platformType===Die.MobileWeb}static isNotBrowser(){var e;return"undefined"==typeof window||!(null===window||void 0===window?void 0:window.navigator)||void 0!==u7&&"ReactNative"===(null===(e=null==u7?void 0:u7.navigator)||void 0===e?void 0:e.product)||"ReactNative"===(null===navigator||void 0===navigator?void 0:navigator.product)}isNotBrowser(){return Bue.isNotBrowser()}static isBrowser(){return!this.isNotBrowser()}isBrowser(){return Bue.isBrowser()}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(e){const{state:t}=e;return t.platformType?t.platformType:e.isReactNative()?Die.ReactNative:e.isNotBrowser()?Die.NonBrowser:e.isMetaMaskMobileWebView()?Die.MetaMaskMobileWebview:e.isMobile()?Die.MobileWeb:Die.DesktopWeb}(this)}}const jue=e=>l7(void 0,void 0,void 0,function*(){if(Bue.isBrowser()){const{StorageManagerWeb:t}=yield Promise.resolve().then(function(){return jde});return new t(e)}const t={persistChannelConfig:()=>l7(void 0,void 0,void 0,function*(){}),getPersistedChannelConfig:()=>l7(void 0,void 0,void 0,function*(){}),persistAccounts:()=>l7(void 0,void 0,void 0,function*(){}),getCachedAccounts:()=>l7(void 0,void 0,void 0,function*(){return[]}),persistChainId:()=>l7(void 0,void 0,void 0,function*(){}),getCachedChainId:()=>l7(void 0,void 0,void 0,function*(){}),terminate:()=>l7(void 0,void 0,void 0,function*(){})};return Promise.resolve(t)});class Due extends gue{constructor({connectionStream:e,shouldSendMetadata:t,autoRequestAccounts:n=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:t}),this.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},yue(`[SDKProvider: constructor()] autoRequestAccounts=${n}`),this.state.autoRequestAccounts=n}forceInitializeState(){return l7(this,void 0,void 0,function*(){return yue(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){yue("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var e;const{accounts:t}=this._state;return t&&0!==t.length?(null===(e=t[0])||void 0===e?void 0:e.toLowerCase())||"":(yue("[SDKProvider: getSelectedAddress] No accounts found"),null)}getChainId(){return this.state.chainId}getNetworkVersion(){return this.state.networkVersion}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleAccountsChanged(e,t){return this._handleAccountsChanged(e,t)}handleDisconnect({terminate:e=!1}){!function({terminate:e=!1,instance:t}){const{state:n}=t;yue(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${e}`,t),e&&(t._state.accounts=null,t._state.isUnlocked=!1,t._state.isPermanentlyDisconnected=!0,t._state.initialized=!1),t._handleAccountsChanged([]),t._state.isConnected=!1,t.emit("disconnect",bue.ethErrors.provider.disconnected()),n.providerStateRequested=!1}({terminate:e,instance:this})}_initializeStateAsync(){return l7(this,void 0,void 0,function*(){return function(e){var t,n;return l7(this,void 0,void 0,function*(){void 0===e.state&&(e.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});const{state:r}=e;let i;if(r.providerStateRequested)yue("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let s;r.providerStateRequested=!0;let a=null,c=!1,l=!1;const u=yield jue({enabled:!0});if(u){const e=yield u.getPersistedChannelConfig({});c=null!==(t=null==e?void 0:e.relayPersistence)&&void 0!==t&&t,s=yield u.getCachedChainId();const n=yield u.getCachedAccounts();n.length>0&&(a=n[0])}if(yue(`[SDKProvider: initializeStateAsync()] relayPersistence=${c}`,{relayPersistence:c,cachedChainId:s,cachedSelectedAddress:a}),c)if(s&&a)i={accounts:[a],chainId:s,isUnlocked:!1},l=!0;else try{i=yield e.request({method:"metamask_getProviderState"})}catch(o){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",o),void(r.providerStateRequested=!1)}if(0===(null===(n=null==i?void 0:i.accounts)||void 0===n?void 0:n.length))if(e.getSelectedAddress())i.accounts=[e.getSelectedAddress()];else{yue("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");const t=yield e.request({method:"eth_requestAccounts",params:[]});i.accounts=t}e._initializeState(i),r.providerStateRequested=!1,l&&(e._state.isConnected=!0,e.emit("connect",{chainId:null==i?void 0:i.chainId}))}})}(this)})}_initializeState(e){return yue("[SDKProvider: _initializeState()]",e),function(e,t,n){return yue("[SDKProvider: initializeState()] set state._initialized to false"),e._state.initialized=!1,t(n)}(this,super._initializeState.bind(this),e)}_handleChainChanged({chainId:e,networkVersion:t}={}){this.state.chainId=e,this.state.networkVersion=t,function({instance:e,chainId:t,networkVersion:n,superHandleChainChanged:r}){yue(`[SDKProvider: handleChainChanged()] chainId=${t} networkVersion=${n}`);let i=n;n||(yue("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),i="1"),e._state.isConnected=!0,e.emit("connect",{chainId:t}),r({chainId:t,networkVersion:i})}({instance:this,chainId:e,networkVersion:t,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var Uue,Fue="0.32.0";!function(e){e.INPAGE="metamask-inpage",e.CONTENT_SCRIPT="metamask-contentscript",e.PROVIDER="metamask-provider"}(Uue||(Uue={}));const $ue="direct",zue="https://metamask.app.link/connect",Hue="metamask://connect",que={NAME:"MetaMask",RDNS:["io.metamask","io.metamask.flask"]},Wue=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,Kue={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_GETPERMISSIONS:"wallet_getPermissions",WALLET_WATCHASSET:"wallet_watchAsset",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",WALLET_SWITCHETHETHEREUMCHAIN:"wallet_switchEthereumChain",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},Gue={[Kue.ETH_REQUESTACCOUNTS]:!0,[Kue.ETH_SENDTRANSACTION]:!0,[Kue.ETH_SIGNTRANSACTION]:!0,[Kue.ETH_SIGN]:!0,[Kue.PERSONAL_SIGN]:!0,[Kue.ETH_ACCOUNTS]:!1,[Kue.ETH_CHAINID]:!1,[Kue.PERSONAL_SIGN]:!0,[Kue.ETH_SIGNTYPEDDATA]:!0,[Kue.ETH_SIGNTYPEDDATA_V3]:!0,[Kue.ETH_SIGNTYPEDDATA_V4]:!0,[Kue.WALLET_REQUESTPERMISSIONS]:!0,[Kue.WALLET_GETPERMISSIONS]:!0,[Kue.WALLET_WATCHASSET]:!0,[Kue.WALLET_ADDETHEREUMCHAIN]:!0,[Kue.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[Kue.METAMASK_CONNECTSIGN]:!0,[Kue.METAMASK_CONNECTWITH]:!0,[Kue.PERSONAL_EC_RECOVER]:!0,[Kue.METAMASK_BATCH]:!0,[Kue.METAMASK_OPEN]:!0},Vue=Object.keys(Gue).map(e=>e.toLowerCase()),Zue=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(e=>e.toLowerCase()),Yue=".sdk-comm",Jue="providerType",Que=".MMSDK_cached_address",Xue=".MMSDK_cached_chainId",ede="chainChanged",tde="accountsChanged",nde="disconnect",rde="connect",ide="connected";var ode;!function(e){e.TERMINATE="terminate",e.EXTENSION="extension",e.INITIALIZED="initialized"}(ode||(ode={}));const sde="undefined"!=typeof window&&window.localStorage;function ade(e){var t,n;return l7(this,void 0,void 0,function*(){yue("[MetaMaskSDK: connectWithExtensionProvider()] ",e),e.sdkProvider=e.activeProvider,e.activeProvider=window.extension,window.ethereum=window.extension;try{const e=yield null===(t=window.extension)||void 0===t?void 0:t.request({method:"eth_requestAccounts"});yue(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${e}`)}catch(r){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",r)}localStorage.setItem(Jue,"extension"),e.extensionActive=!0,e.emit(Nue.ProviderUpdate,ode.EXTENSION),e.options.enableAnalytics&&(null===(n=e.analytics)||void 0===n||n.send({event:_ie.SDK_USE_EXTENSION}))})}function cde(e){let t;if(void 0!==S7)t=S7.from(e,"utf8").toString("base64");else if("function"==typeof btoa)t=btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/gu,(e,t)=>String.fromCharCode(parseInt(t,16))));else{if("object"!=typeof u7||!("Buffer"in u7))throw new Error("Unable to base64 encode: No available method.");t=u7.Buffer.from(e,"utf8").toString("base64")}return t}class lde extends Zle.Duplex{constructor({name:e,remote:t,deeplinkProtocol:n,platformManager:r}){super({objectMode:!0}),this.state={_name:null,remote:null,deeplinkProtocol:!1,platformManager:null},this.state._name=e,this.state.remote=t,this.state.deeplinkProtocol=n,this.state.platformManager=r,this._onMessage=this._onMessage.bind(this),this.state.remote.on(bie.MESSAGE,this._onMessage)}_write(e,t,n){return l7(this,void 0,void 0,function*(){return function(e,t,n,r){var i,o,s,a,c,l,u,d,h,f,p,m,g,y,b,v,w,E,_,x;return l7(this,void 0,void 0,function*(){const n=null===(i=e.state.remote)||void 0===i?void 0:i.isReady(),k=null===(o=e.state.remote)||void 0===o?void 0:o.isConnected(),S=null===(s=e.state.remote)||void 0===s?void 0:s.isPaused(),C=Lue.getProvider(),I=null===(a=e.state.remote)||void 0===a?void 0:a.getChannelId(),A=null===(c=e.state.remote)||void 0===c?void 0:c.isAuthorized(),{deeplinkProtocol:P}=e.state,{method:M,data:O,triggeredInstaller:T}=(e=>{var t,n,r,i;let o;S7.isBuffer(e)?(o=e.toJSON(),o._isBuffer=!0):o=e;const s=null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.method;let a=!1;return"object"==typeof(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.params)&&!0===(null===(i=null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.params)||void 0===i?void 0:i.__triggeredInstaller)&&(a=!0,o.data.params=o.data.params.wrappedParams),{method:s,data:o,triggeredInstaller:a}})(t);if(yue(`[RCPMS: write()] method='${M}' isRemoteReady=${n} channelId=${I} isSocketConnected=${k} isRemotePaused=${S} providerConnected=${C.isConnected()}`,t),!I)return M!==Kue.METAMASK_GETPROVIDERSTATE&&yue(`[RCPMS: write()] ${M} --\x3e channelId is undefined`),r(new Error("disconnected"));yue(`[RCPMS: write()] remote.isPaused()=${null===(l=e.state.remote)||void 0===l?void 0:l.isPaused()} authorized=${A} ready=${n} socketConnected=${k}`,t);const R=null===(u=e.state.platformManager)||void 0===u?void 0:u.isSecure(),N=null!==(h=null===(d=e.state.platformManager)||void 0===d?void 0:d.isMobileWeb())&&void 0!==h&&h,L=null!==(p=null===(f=e.state.remote)||void 0===f?void 0:f.hasDeeplinkProtocol())&&void 0!==p&&p&&N&&A;try{if(!T){const t=JSON.stringify(null==O?void 0:O.data);if(t.length>1e6)return r(new Error(`Message size ${t.length} exceeds maximum allowed size of 1000000 bytes`));null===(m=e.state.remote)||void 0===m||m.sendMessage(null==O?void 0:O.data).then(()=>{yue(`[RCPMS: _write()] ${M} sent successfully`)}).catch(e=>{yue("[RCPMS: _write()] error sending message",e)})}if(!R)return yue(`[RCPMS: _write()] unsecure platform for method ${M} -- return callback`),r();if(T)return yue("[RCPMS: _write()] prevent deeplink -- installation completed separately."),r();const t=null!==(b=null===(y=null===(g=e.state.remote)||void 0===g?void 0:g.getKeyInfo())||void 0===y?void 0:y.ecies.public)&&void 0!==b?b:"";let n=encodeURI(`channelId=${I}&pubkey=${t}&comm=socket&t=d&v=2`);if(L){const t=JSON.stringify(null==O?void 0:O.data),i=null===(v=e.state.remote)||void 0===v?void 0:v.encrypt(t);if(!i)return yue("[RCPMS: _write()] error encrypting message"),r(new Error("RemoteCommunicationPostMessageStream - disconnected"));n+=`&scheme=${P}&rpc=${cde(i)}`}if(!(null===(w=e.state.platformManager)||void 0===w?void 0:w.isMetaMaskInstalled()))return yue("[RCPMS: _write()] prevent deeplink until installation is completed."),r();Gue[M]?(yue(`[RCPMS: _write()] redirect link for '${M}' socketConnected=${k} connect?${n}`),null===(E=e.state.platformManager)||void 0===E||E.openDeeplink(`${zue}?${n}`,`${Hue}?${n}`,"_self")):(null===(_=e.state.remote)||void 0===_?void 0:_.isPaused())?(yue(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${M}`),null===(x=e.state.platformManager)||void 0===x||x.openDeeplink(`${zue}?redirect=true&${n}`,`${Hue}?redirect=true&${n}`,"_self")):yue(`[RCPMS: _write()] method ${M} doesn't need redirect.`)}catch(B){return yue("[RCPMS: _write()] error sending message",B),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()})}(this,e,0,n)})}_read(){}_onMessage(e){return function(e,t){try{if(yue("[RCPMS: onMessage()] message",t),!t||"object"!=typeof t)return;if("object"!=typeof(null==t?void 0:t.data))return;if(!(null==t?void 0:t.name))return void yue("[RCPMS: onMessage()] ignore message without name",t);if((null==t?void 0:t.name)!==Uue.PROVIDER)return void yue(`[RCPMS: onMessage()] ignore message with wrong name message=${t}`);if(S7.isBuffer(t)){const n=S7.from(t);e.push(n)}else e.push(t)}catch(n){yue(`[RCPMS: onMessage()] ignore message error err=${n}`)}}(this,e)}start(){}}let ude=1;const dde=e=>new Promise(t=>{setTimeout(()=>{t(!0)},e)});function hde(e){var t,n,r,i;return l7(this,void 0,void 0,function*(){const{options:o}=e,s={communicationLayerPreference:null!==(t=o.communicationLayerPreference)&&void 0!==t?t:jie.SOCKET,platformManager:e.platformManager,sdk:e,checkInstallationOnAllCalls:o.checkInstallationOnAllCalls,injectProvider:null===(n=o.injectProvider)||void 0===n||n,shouldShimWeb3:null===(r=o.shouldShimWeb3)||void 0===r||r,extensionOnly:null===(i=o.extensionOnly)||void 0===i||i,installer:e.installer,remoteConnection:e.remoteConnection,debug:e.debug},a=yield(({checkInstallationOnAllCalls:t=!1,communicationLayerPreference:n,injectProvider:r,shouldShimWeb3:i,platformManager:o,installer:s,sdk:a,remoteConnection:l,debug:u})=>l7(void 0,void 0,void 0,function*(){var n,d;const h=(({name:e,remoteConnection:t})=>{if(!t||!(null==t?void 0:t.getConnector()))throw new Error("Missing remote connection parameter");return new lde({name:e,remote:null==t?void 0:t.getConnector(),deeplinkProtocol:null==t?void 0:t.state.deeplinkProtocol,platformManager:null==t?void 0:t.getPlatformManager()})})({name:Uue.INPAGE,target:Uue.CONTENT_SCRIPT,remoteConnection:l}),f=o.getPlatformType(),p=a.options.dappMetadata,m=`Sdk/Javascript SdkVersion/${Fue} Platform/${f} dApp/${null!==(n=p.url)&&void 0!==n?n:p.name} dAppTitle/${p.name}`;let g=null,y=null;const b=null===(d=a.options.storage)||void 0===d?void 0:d.storageManager;if(b){try{const e=yield b.getCachedAccounts();e.length>0&&(g=e[0])}catch(e){console.error(`[initializeMobileProvider] failed to get cached addresses: ${e}`)}try{const e=yield b.getCachedChainId();e&&(y=e)}catch(e){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${e}`)}}yue(`[initializeMobileProvider] cachedAccountAddress: ${g}, cachedChainId: ${y}`);const v=!(!r||f===Die.NonBrowser||f===Die.ReactNative),w=Lue.init({shouldSetOnWindow:v,connectionStream:h,shouldShimWeb3:i,sdkInstance:a});let E=!1;const _=e=>{E=e},x=()=>E,k=(n,r,i,u)=>l7(void 0,void 0,void 0,function*(){var d,h,f,p,v,w,k,S,C;const I=Lue.getProvider();if(E){I.emit("display_uri",(null==l?void 0:l.state.qrcodeLink)||""),null==l||l.showActiveModal();let e=x();for(;e;){const t=x(),n=null==l?void 0:l.isAuthorized();e=t&&!n,yue(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${t} authorized: ${n}`),yield dde(1e3)}return yue("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),i(...r)}const A=o.isMetaMaskInstalled(),P=null==l?void 0:l.isConnected();let M=null,O=null,T=null;if(M=null!==(d=I.getSelectedAddress())&&void 0!==d?d:g,T=I.getChainId()||y,M&&b&&M!==g&&b.persistAccounts([M]).catch(e=>{console.error(`[initializeMobileProvider] failed to persist account: ${e}`)}),T&&(y=T,b&&b.persistChainId(T).catch(e=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${e}`)})),yue("[initializeMobileProvider: sendRequest()]",{selectedAddress:M,chainId:T}),u&&yue(`[initializeMobileProvider: sendRequest()] method=${n} ongoing=${E} selectedAddress=${M} isInstalled=${A} checkInstallationOnAllCalls=${t} socketConnected=${P}`),M&&n.toLowerCase()===Kue.ETH_ACCOUNTS.toLowerCase())return[M];if(T&&n.toLowerCase()===Kue.ETH_CHAINID.toLowerCase())return T;const R=[Kue.ETH_REQUESTACCOUNTS,Kue.WALLET_REQUESTPERMISSIONS,Kue.METAMASK_CONNECTSIGN,Kue.METAMASK_CONNECTWITH],N=!Gue[n],L=null===(h=a.options.readonlyRPCMap)||void 0===h?void 0:h[T];if(L&&N)try{const t=null===(f=null==r?void 0:r[0])||void 0===f?void 0:f.params,i=yield(({rpcEndpoint:t,method:n,sdkInfo:r,params:i})=>l7(void 0,void 0,void 0,function*(){const o=JSON.stringify({jsonrpc:"2.0",method:n,params:i,id:(ude+=1,ude)}),s={Accept:"application/json","Content-Type":"application/json"};let a;t.includes("infura")&&(s["Metamask-Sdk-Info"]=r);try{a=yield A4(t,{method:"POST",headers:s,body:o})}catch(e){throw e instanceof Error?new Error(`Failed to fetch from RPC: ${e.message}`):new Error(`Failed to fetch from RPC: ${e}`)}if(!a.ok)throw new Error(`Server responded with a status of ${a.status}`);return(yield a.json()).result}))({rpcEndpoint:L,sdkInfo:m,method:n,params:t||[]});return u&&yue(`initializeProvider::ReadOnlyRPCResponse ${i}`),i}catch(e){console.warn(`[initializeMobileProvider: sendRequest()] method=${n} readOnlyRPCRequest failed:`,e)}if((!A||A&&!P)&&n!==Kue.METAMASK_GETPROVIDERSTATE){const e=(null===(p=null==r?void 0:r[0])||void 0===p?void 0:p.params)||[];if(-1!==R.indexOf(n)||t){_(!0);const t=n===Kue.METAMASK_CONNECTWITH,o=`${Date.now()}`;try{yield s.start({wait:!1,connectWith:t?{method:n,id:o,params:e}:void 0}),yield new Promise((e,t)=>{(null==l?void 0:l.isAuthorized())&&(yue("[initializeMobileProvider: sendRequest()] already authorized"),e(!0)),null==l||l.getConnector().once(bie.AUTHORIZED,()=>{e(!0)}),a.once(bie.PROVIDER_UPDATE,e=>{yue(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${e}`),e===ode.EXTENSION?t(bie.PROVIDER_UPDATE):t(new Error("Connection Terminated"))})})}catch(B){if(ode.EXTENSION===B){if(yue(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${n} on the active provider`),n.toLowerCase()===Kue.METAMASK_CONNECTSIGN.toLowerCase()){const t=yield null===(v=a.getProvider())||void 0===v?void 0:v.request({method:Kue.ETH_REQUESTACCOUNTS,params:[]});if(!t.length)throw new Error("SDK state invalid -- undefined accounts");const n=yield null===(w=a.getProvider())||void 0===w?void 0:w.request({method:Kue.PERSONAL_SIGN,params:[e[0],t[0]]});return a.emit(Nue.ConnectWithResponse,n),n}if(n.toLowerCase()===Kue.METAMASK_CONNECTWITH.toLowerCase()){const[t]=e,n=yield(({method:e,sdk:t,params:n})=>l7(void 0,void 0,void 0,function*(){var r,i,o,s;if(!t.isExtensionActive())throw new Error("SDK state invalid -- extension is not active");yue("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",e,n);const a=yield null===(r=t.getProvider())||void 0===r?void 0:r.request({method:Kue.ETH_REQUESTACCOUNTS,params:[]});if(!a.length)throw new Error("SDK state invalid -- undefined accounts");if((null==e?void 0:e.toLowerCase())===Kue.PERSONAL_SIGN.toLowerCase()){const r={method:e,params:[n[0],a[0]]};return yield null===(i=t.getProvider())||void 0===i?void 0:i.request(r)}if((null==e?void 0:e.toLowerCase())===Kue.ETH_SENDTRANSACTION.toLowerCase()){const r={method:e,params:[Object.assign(Object.assign({},n[0]),{from:a[0]})]};return yield null===(o=t.getProvider())||void 0===o?void 0:o.request(r)}return Zue.includes(e.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${e} -- not handled by the extension -- call separately`),a):yield null===(s=t.getProvider())||void 0===s?void 0:s.request({method:e,params:n})}))({method:t.method,sdk:a,params:t.params});return a.emit(Nue.ConnectWithResponse,n),n}return yue(`[initializeMobileProvider: sendRequest()] sending '${n}' on active provider`,e),yield null===(k=a.getProvider())||void 0===k?void 0:k.request({method:n,params:e})}if(B===bie.REJECTED)throw null==l||l.closeModal(),null===(S=a.getProvider())||void 0===S||S.handleDisconnect({terminate:!1}),Object.assign(new Error("User rejected connection"),{code:4001});throw yue(`[initializeMobileProvider: sendRequest()] failed to start installer: ${B}`),B}finally{_(!1)}if(n===Kue.ETH_REQUESTACCOUNTS)return O=yield new Promise(e=>{const t=setInterval(()=>{const{accounts:n}=I.getState();n&&(clearInterval(t),e(n))},100)}),yue(`[initializeMobileProvider: sendRequest()] selectedAddress: ${M} --- SKIP rpc call`),O;if(n===Kue.METAMASK_CONNECTWITH)try{let e=0;const t=5,n=({resolve:n,reject:r})=>{e+=1;const i=null==l?void 0:l.getConnector().getRPCMethodTracker(),s=null==i?void 0:i[o];return yue(`TRACKER: update method ${o}`,s),(null==s?void 0:s.result)?(yue("[initializeMobileProvider: sendRequest()] found result",s.result),a.emit(Nue.ConnectWithResponse,s.result),void n(s.result)):(null==s?void 0:s.error)?(yue("[initializeMobileProvider: sendRequest()] found error",s.error),void r(s.error)):e>=t?(yue("[initializeMobileProvider: sendRequest()] max message count reached without result"),void r(new Error("Max message count reached without result"))):void yue("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")};let r,i;const s=yield new Promise((e,t)=>{const s=null==l?void 0:l.getConnector().getRPCMethodTracker();yue(`TRACKER: method ${o}`,s),(null==s?void 0:s[o].result)?(yue("[initializeMobileProvider: sendRequest()] found result",null==s?void 0:s[o].result),e(null==s?void 0:s[o].result)):(null==s?void 0:s[o].error)&&(yue("[initializeMobileProvider: sendRequest()] found error",null==s?void 0:s[o].error),t(null==s?void 0:s[o].error)),i=()=>n({resolve:e,reject:t}),r=null==l?void 0:l.getConnector().on(bie.RPC_UPDATE,i)});return i&&(null==r||r.off(bie.RPC_UPDATE,i)),yue("TRACKER: result",s),s}catch(c){throw yue("[initializeMobileProvider: sendRequest()] error:",c),c}return r[0]&&"object"==typeof r[0]&&(r[0].params={__triggeredInstaller:!0,wrappedParams:r[0].params}),i(...r)}if(o.isSecure()&&Gue[n])return i(...r);if(a.isExtensionActive())return yue(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${n}' to it`,r,e),yield null===(C=a.getProvider())||void 0===C?void 0:C.request({method:n,params:e});throw yue(`[initializeMobileProvider: sendRequest()] method=${n} --- skip --- not connected/installed`),new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}try{const e=yield i(...r);if(yue(`[initializeMobileProvider: sendRequest()] method=${n} rpcResponse`,e),n===Kue.WALLET_REQUESTPERMISSIONS){const t=e.reduce((e,t)=>{var n;if("eth_accounts"===t.parentCapability){const r=null===(n=t.caveats.find(e=>"restrictReturnedAccounts"===e.type))||void 0===n?void 0:n.value;r&&e.push(...r)}return e},[]);yue("[initializeMobileProvider: sendRequest()] accountsToPersist:",t),t.length>0&&(I.handleAccountsChanged(t,!1),null==b||b.persistAccounts(t))}return e}catch(e){throw console.error("[initializeMobileProvider: sendRequest()] error:",e),e}}),{request:S}=w;w.request=(...e)=>l7(void 0,void 0,void 0,function*(){return k(null==e?void 0:e[0].method,e,S,u)});const{send:C}=w;return w.send=(...e)=>l7(void 0,void 0,void 0,function*(){return k(null==e?void 0:e[0],e,C,u)}),yue("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),h.start(),w}))(s);var c,l,u,d,h;e.activeProvider=a,null===(u=null===(l=(c=e).remoteConnection)||void 0===l?void 0:l.getConnector())||void 0===u||u.on(Nue.ConnectionStatus,e=>{c.emit(Nue.ConnectionStatus,e)}),null===(h=null===(d=c.remoteConnection)||void 0===d?void 0:d.getConnector())||void 0===h||h.on(Nue.ServiceStatus,e=>{c.emit(Nue.ServiceStatus,e)})})}class fde{constructor({serverUrl:e,enabled:t,originatorInfo:n}){this.serverURL=die,this.serverURL=e,this.originatorInfo=n,this.enabled=null==t||t}send({event:e,params:t}){if(!this.enabled)return;const n=Object.assign(Object.assign({id:"sdk",event:e,sdkVersion:Fue},this.originatorInfo),{params:t});yue(`[Analytics: send()] event: ${e}`,n),cie(n,this.serverURL).catch(e=>{yue(`[Analytics: send()] error: ${e}`)})}}function pde(e){var t,n,r;const{dappMetadata:i}=e,o=function({url:e,name:t}){var n;const r=cde(e+t);if(!localStorage)return"";let i=null!==(n=localStorage.getItem(r))&&void 0!==n?n:"";if(!i){i=U4();try{localStorage.setItem(r,i)}catch(o){return""}}return i}({url:null!==(t=null==i?void 0:i.url)&&void 0!==t?t:"no_url",name:null!==(n=null==i?void 0:i.name)&&void 0!==n?n:"no_name"}),s=null===(r=e.platformManager)||void 0===r?void 0:r.getPlatformType(),a=s===Die.DesktopWeb,c=s===Die.MetaMaskMobileWebview;let l="N/A";return a?l="extension":c&&(l="mobile"),{id:o,from:l}}const mde=({provider:e,sdkInstance:t})=>{if("state"in e)throw new Error("INVALID EXTENSION PROVIDER");return new Proxy(e,{get:(n,r)=>"request"===r?function(e){var r,i;return l7(this,void 0,void 0,function*(){yue("[wrapExtensionProvider()] Overwriting request method",e);const{method:o,params:s}=e,a=Vue.includes(o.toLowerCase()),{id:c,from:l}=pde(t);if(a&&(null===(r=t.analytics)||void 0===r||r.send({event:_ie.SDK_RPC_REQUEST,params:{method:o,from:l,id:c}})),o===Kue.METAMASK_BATCH&&Array.isArray(s))return(({target:e,args:t,trackEvent:n,sdkInstance:r})=>l7(void 0,void 0,void 0,function*(){var i,o;if("metamask_batch"!==t.method)throw new Error("Invalid usage");const s=[],a=null!==(i=null==t?void 0:t.params)&&void 0!==i?i:[];for(const t of a){const n=yield null==e?void 0:e.request({method:t.method,params:t.params});s.push(n)}const{id:c,from:l}=pde(r);return n&&(null===(o=r.analytics)||void 0===o||o.send({event:_ie.SDK_RPC_REQUEST_DONE,params:{method:t.method,from:l,id:c}})),s}))({target:n,args:e,trackEvent:a,sdkInstance:t});if(o.toLowerCase()===Kue.METAMASK_CONNECTSIGN.toLowerCase()&&Array.isArray(s))return(({target:e,params:t})=>l7(void 0,void 0,void 0,function*(){const n=yield e.request({method:Kue.ETH_REQUESTACCOUNTS,params:[]});if(!n.length)throw new Error("SDK state invalid -- undefined accounts");return yield e.request({method:Kue.PERSONAL_SIGN,params:[t[0],n[0]]})}))({target:n,params:s});if(o.toLowerCase()===Kue.METAMASK_CONNECTWITH.toLowerCase()&&Array.isArray(s))return(({target:e,params:t})=>l7(void 0,void 0,void 0,function*(){const[n]=t,r=n.method,i=n.params,o=yield e.request({method:Kue.ETH_REQUESTACCOUNTS,params:[]});if(!o.length)throw new Error("SDK state invalid -- undefined accounts");return(null==r?void 0:r.toLowerCase())===Kue.PERSONAL_SIGN.toLowerCase()?yield e.request({method:r,params:[i[0],o[0]]}):(null==r?void 0:r.toLowerCase())===Kue.ETH_SENDTRANSACTION.toLowerCase()?yield e.request({method:r,params:[Object.assign(Object.assign({},i[0]),{from:o[0]})]}):Zue.includes(r.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${r} -- not handled by the extension -- call separately`),o):yield e.request({method:r,params:i})}))({target:n,params:s});let u;try{return u=yield n.request(e),u}finally{a&&(null===(i=t.analytics)||void 0===i||i.send({event:_ie.SDK_RPC_REQUEST_DONE,params:{method:o,from:l,id:c}}))}})}:"getChainId"===r?function(){return e.chainId}:"getNetworkVersion"===r?function(){return e.networkVersion}:"getSelectedAddress"===r?function(){return e.selectedAddress}:"isConnected"===r?function(){return e._state.isConnected}:n[r]})};var gde;!function(e){e.Announce="eip6963:announceProvider",e.Request="eip6963:requestProvider"}(gde||(gde={}));var yde="INSTALLED",bde="NOT_INSTALLED",vde="REGISTERED",wde="REGISTERING",Ede="RELOADING",_de={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},xde="REGISTRATION_IN_PROGRESS",kde="FORWARDER_ID",Sde=function(){function e(t){var n=void 0===t?{}:t,r=n.forwarderOrigin,i=void 0===r?"https://fwd.metamask.io":r,o=n.forwarderMode,s=void 0===o?e.FORWARDER_MODE.INJECT:o;this.forwarderOrigin=i,this.forwarderMode=s,this.state=e.isMetaMaskInstalled()?yde:bde;var a=e._detectBrowser();this.downloadUrl=a?_de[a]:_de.DEFAULT,this._onMessage=this._onMessage.bind(this),this._onMessageFromForwarder=this._onMessageFromForwarder.bind(this),this._openForwarder=this._openForwarder.bind(this),this._openDownloadPage=this._openDownloadPage.bind(this),this.startOnboarding=this.startOnboarding.bind(this),this.stopOnboarding=this.stopOnboarding.bind(this),window.addEventListener("message",this._onMessage),s===e.FORWARDER_MODE.INJECT&&"true"===sessionStorage.getItem(xde)&&e._injectForwarder(this.forwarderOrigin)}return e.prototype._onMessage=function(e){if(e.origin===this.forwarderOrigin)return"metamask:reload"===e.data.type?this._onMessageFromForwarder(e):void 0},e.prototype._onMessageUnknownStateError=function(e){throw new Error("Unknown state: '"+e+"'")},e.prototype._onMessageFromForwarder=function(t){return function(e,t,n,r){return new(n||(n=Promise))(function(t,i){function o(e){try{a(r.next(e))}catch(t){i(t)}}function s(e){try{a(r.throw(e))}catch(t){i(t)}}function a(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n(function(e){e(r)})).then(o,s)}a((r=r.apply(e,[])).next())})}(this,0,void 0,function(){return function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(a){o=[6,a],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,function(n){switch(n.label){case 0:switch(this.state){case Ede:return[3,1];case bde:return[3,2];case yde:return[3,3];case wde:return[3,5];case vde:return[3,6]}return[3,7];case 1:return[3,8];case 2:return this.state=Ede,location.reload(),[3,8];case 3:return this.state=wde,[4,e._register()];case 4:return n.sent(),this.state=vde,t.source.postMessage({type:"metamask:registrationCompleted"},t.origin),this.stopOnboarding(),[3,8];case 5:case 6:return[3,8];case 7:this._onMessageUnknownStateError(this.state),n.label=8;case 8:return[2]}})})},e.prototype.startOnboarding=function(){sessionStorage.setItem(xde,"true"),this._openDownloadPage(),this._openForwarder()},e.prototype.stopOnboarding=function(){"true"===sessionStorage.getItem(xde)&&(this.forwarderMode===e.FORWARDER_MODE.INJECT&&e._removeForwarder(),sessionStorage.setItem(xde,"false"))},e.prototype._openForwarder=function(){this.forwarderMode===e.FORWARDER_MODE.OPEN_TAB?window.open(this.forwarderOrigin,"_blank"):e._injectForwarder(this.forwarderOrigin)},e.prototype._openDownloadPage=function(){window.open(this.downloadUrl,"_blank")},e.isMetaMaskInstalled=function(){return Boolean(window.ethereum&&window.ethereum.isMetaMask)},e._register=function(){return window.ethereum.request({method:"wallet_registerOnboarding"})},e._injectForwarder=function(e){var t=document.body,n=document.createElement("iframe");n.setAttribute("height","0"),n.setAttribute("width","0"),n.setAttribute("style","display: none;"),n.setAttribute("src",e),n.setAttribute("id",kde),t.insertBefore(n,t.children[0])},e._removeForwarder=function(){var e;null===(e=document.getElementById(kde))||void 0===e||e.remove()},e._detectBrowser=function(){var e=Rue.parse(window.navigator.userAgent);return"Firefox"===e.browser.name?"FIREFOX":["Chrome","Chromium"].includes(e.browser.name||"")?"CHROME":null},e.FORWARDER_MODE={INJECT:"INJECT",OPEN_TAB:"OPEN_TAB"},e}();class Cde{constructor({remote:e,preferDesktop:t,platformManager:n,debug:r=!1}){this.state={isInstalling:!1,hasInstalled:!1,resendRequest:null,preferDesktop:!1,platformManager:null,remote:null,debug:!1,connectWith:void 0},this.state.remote=e,this.state.preferDesktop=t,this.state.platformManager=n,this.state.debug=r}startDesktopOnboarding(){return function(){return l7(this,void 0,void 0,function*(){yue("[MetamaskInstaller: startDesktopOnboarding() starting desktop onboarding"),window.ethereum&&(window.ethereum=void 0),(new Sde).startOnboarding()})}()}redirectToProperInstall(){return l7(this,void 0,void 0,function*(){return function(e){var t,n;return l7(this,void 0,void 0,function*(){const{state:r}=e,i=null===(t=r.platformManager)||void 0===t?void 0:t.getPlatformType();if(yue(`[MetamaskInstaller: redirectToProperInstall()] platform=${i}`),i===Die.MetaMaskMobileWebview)return!1;r.isInstalling=!0;try{yield null===(n=r.remote)||void 0===n?void 0:n.startConnection({connectWith:r.connectWith}),r.isInstalling=!1,r.hasInstalled=!0}catch(o){throw r.isInstalling=!1,o}return!0})}(this)})}checkInstallation(){return l7(this,void 0,void 0,function*(){return function(e){var t;return l7(this,void 0,void 0,function*(){const{state:n}=e,r=null===(t=n.platformManager)||void 0===t?void 0:t.isMetaMaskInstalled();return yue(`[MetamaskInstaller: checkInstallation()] isInstalled=${r}`),!!r||(yield e.redirectToProperInstall())})}(this)})}start({wait:e=!1,connectWith:t}){return l7(this,void 0,void 0,function*(){this.state.connectWith=t,yue(`[MetaMaskInstaller: start()] wait=${e}`,t),yield function(e,{wait:t=!1}){return l7(this,void 0,void 0,function*(){return yue(`[MetamaskInstaller: startInstaller()] wait=${t}`),t&&(yield dde(1e3)),yield e.checkInstallation()})}(this,{wait:e})})}}class Ide{constructor({debug:e,sdkVersion:t}){this.containers={install:void 0,pending:void 0,select:void 0},this.defined={install:!1,pending:!1,select:!1},this.debug=null!=e&&e,this.sdkVersion=t}loadComponent(e){return l7(this,void 0,void 0,function*(){if(!this.defined[e]){this.defined[e]=!0;try{(yield Promise.resolve().then(function(){return Xhe})).defineCustomElements()}catch(Gle){console.error(`Failed to load ${e} modal:`,Gle)}}})}renderInstallModal(e){var t;return l7(this,void 0,void 0,function*(){this.debug,this.containers.install=e.parentElement,yield this.loadComponent("install");const n=document.createElement("mm-install-modal");n.link=e.link,n.preferDesktop=e.preferDesktop,n.sdkVersion=null!==(t=e.sdkVersion)&&void 0!==t?t:this.sdkVersion,n.addEventListener("close",({detail:{shouldTerminate:t}})=>e.onClose(t)),n.addEventListener("startDesktopOnboarding",e.metaMaskInstaller.startDesktopOnboarding),n.addEventListener("trackAnalytics",t=>{var n;return null===(n=e.onAnalyticsEvent)||void 0===n?void 0:n.call(e,t.detail)}),e.parentElement.appendChild(n)})}renderSelectModal(e){var t;return l7(this,void 0,void 0,function*(){this.containers.select=e.parentElement,yield this.loadComponent("select");const n=document.createElement("mm-select-modal");n.link=e.link,n.sdkVersion=null!==(t=e.sdkVersion)&&void 0!==t?t:this.sdkVersion,n.preferDesktop=e.preferDesktop,n.addEventListener("close",({detail:{shouldTerminate:t}})=>e.onClose(t)),n.addEventListener("connectWithExtension",e.connectWithExtension),e.parentElement.appendChild(n),setTimeout(()=>this.updateQRCode(e.link),100)})}renderPendingModal(e){var t;return l7(this,void 0,void 0,function*(){this.containers.pending=e.parentElement,yield this.loadComponent("pending");const n=document.createElement("mm-pending-modal");n.sdkVersion=null!==(t=e.sdkVersion)&&void 0!==t?t:this.sdkVersion,n.displayOTP=e.displayOTP,n.addEventListener("close",e.onClose),n.addEventListener("updateOTPValue",({detail:{otpValue:t}})=>e.updateOTPValue(t)),e.onDisconnect&&n.addEventListener("disconnect",e.onDisconnect),e.parentElement.appendChild(n)})}updateOTPValue(e){const t=()=>{var t;const n=null===(t=this.containers.pending)||void 0===t?void 0:t.querySelector("mm-pending-modal");return!!n&&(n.otpCode=e,!0)};setTimeout(()=>{t()},800)}updateQRCode(e){var t,n;const r=null===(t=this.containers.install)||void 0===t?void 0:t.querySelector("mm-install-modal");if(r)r.link=e;else{const t=null===(n=this.containers.select)||void 0===n?void 0:n.querySelector("mm-select-modal");t&&(t.link=e)}}unmount(){Object.entries(this.containers).forEach(([e,t])=>{var n;null===(n=null==t?void 0:t.parentNode)||void 0===n||n.removeChild(t),this.containers[e]=void 0})}}const Ade=({link:e,debug:t,installer:n,terminate:r,connectWithExtension:i,preferDesktop:o,onAnalyticsEvent:s})=>{let a=null,c=null;yue("[UI: InstallModal-web: sdkWebInstallModal()] ################## Installing Modal #################"),yue(`[UI: InstallModal-web: sdkWebInstallModal()] link=${e}`),yue(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${e}" --ios`),yue(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${e}" --android`),yue(`[UI: InstallModal-web: sdkWebInstallModal()] adb shell am start -a android.intent.action.VIEW -d "${e}"`);const l=e=>{var t;yue("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web unmounting install modal -- shouldTerminate:",e,c),(null==c?void 0:c.parentNode)&&(null===(t=c.parentNode)||void 0===t||t.removeChild(c)),c=null,a=null,!0===e&&(null==r||r())};return{mount:r=>{if(yue("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web mounting install modal",c),c)return c.style.display="block",void(null==a||a.updateQRCode(r));a=new Ide({debug:t,sdkVersion:Fue}),c=document.createElement("div"),document.body.appendChild(c),window.extension?a.renderSelectModal({parentElement:c,connectWithExtension:()=>{l(),null==i||i()},onClose:l,link:e,preferDesktop:null!=o&&o}).catch(e=>{console.error(e)}):a.renderInstallModal({parentElement:c,preferDesktop:null!=o&&o,link:e,metaMaskInstaller:n,onClose:l,onAnalyticsEvent:s}).catch(e=>{console.error("[UI: InstallModal-web: sdkWebInstallModal()]",e)})},unmount:l}},Pde=({onDisconnect:e,debug:t})=>{let n=null,r=null;const i=()=>{yue("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web unmount",n),(null==n?void 0:n.parentNode)&&n.parentNode.removeChild(n),n=null,r=null},o=e=>{yue("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web updateOTPValue",e),r&&r.updateOTPValue(e)},s=({displayOTP:s}={displayOTP:!0})=>{yue("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web mount",n),n?n.style.display="block":(r=new Ide({debug:t,sdkVersion:Fue}),n=document.createElement("div"),document.body.appendChild(n),r.renderPendingModal({parentElement:n,onClose:i,onDisconnect:e,updateOTPValue:o,displayOTP:s}).catch(e=>{console.error("[UI: pendingModal-web: sdkWebPendingModal()]",e)}))};return s(),{mount:s,unmount:i,updateOTPValue:o}};function Mde(e,t){var n,r,i,o;e.connector||(yue("[RemoteConnection: initializeConnector()] initialize connector"),e.connector=new Qie({platformType:t.platformManager.getPlatformType(),communicationLayerPreference:t.communicationLayerPreference,transports:t.transports,dappMetadata:Object.assign(Object.assign({},t.dappMetadata),{source:t._source}),analytics:t.enableAnalytics,communicationServerUrl:t.communicationServerUrl,sdkVersion:Fue,context:"dapp",ecies:t.ecies,storage:t.storage,logging:t.logging}),t.timer&&(yue("[RemoteConnection: initializeConnector()] reset background timer",t.timer),null===(r=null===(n=t.timer)||void 0===n?void 0:n.stopBackgroundTimer)||void 0===r||r.call(n),null===(o=null===(i=t.timer)||void 0===i?void 0:i.runBackgroundTimer)||void 0===o||o.call(i,()=>!1,1e4)))}function Ode(e){e.listeners.forEach(({event:t,handler:n})=>{var r;null===(r=e.connector)||void 0===r||r.off(t,n)}),e.listeners=[]}function Tde(e,t){function n(t,n){var r;null===(r=e.connector)||void 0===r||r.on(t,n),e.listeners.push({event:t,handler:n})}e.connector&&(Ode(e),n(bie.WALLET_INIT,({accounts:e,chainId:t})=>l7(this,void 0,void 0,function*(){yue(`[RemoteConnection: setupListeners() => EventType.WALLET_INIT] 'wallet_init' accounts=${e} chainId=${t}`);const n=Lue.getProvider();n._setConnected();const r={accounts:e,chainId:t,isUnlocked:!1};n._initializeState(r),n.emit("chainChanged",t),n.emit("accountsChanged",e)})),n(bie.AUTHORIZED,()=>l7(this,void 0,void 0,function*(){var t,n,r,i;try{yue("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' closing modals",e.pendingModal,e.installModal);const o=Lue.getProvider();o._setConnected(),null===(n=null===(t=e.pendingModal)||void 0===t?void 0:t.unmount)||void 0===n||n.call(t),null===(i=null===(r=e.installModal)||void 0===r?void 0:r.unmount)||void 0===i||i.call(r,!1),e.otpAnswer=void 0,e.authorized=!0,yue("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' provider.state",o.getState()),yield o.forceInitializeState()}catch(o){}})),n(bie.TERMINATE,()=>{var t,n,r,i,o;null===(n=null===(t=e.pendingModal)||void 0===t?void 0:t.unmount)||void 0===n||n.call(t),null===(i=null===(r=e.installModal)||void 0===r?void 0:r.unmount)||void 0===i||i.call(r,!0),e.pendingModal=void 0,e.installModal=void 0,e.otpAnswer=void 0,null===(o=e.connector)||void 0===o||o.disconnect({terminate:!0}),e.authorized=!1,Lue.getProvider().handleDisconnect({terminate:!0}),Ode(e),yue("[RemoteConnection: setupListeners()] All listeners cleaned up")}))}function Rde(e,t,{initialCheck:n,connectWith:r}={}){var i,o,s,a,c,l,u,d,h,f,p,m,g,y,b,v,w,E,_;return l7(this,void 0,void 0,function*(){try{if(Mde(e,t),!e.connector)throw new Error("no connector defined");Tde(e);const x=Lue.getProvider();e.authorized=!1,x.emit("connecting");const k=yield null===(i=e.connector)||void 0===i?void 0:i.originatorSessionConnect();yue(`[RemoteConnection: startConnection()] after originatorSessionConnect initialCheck=${n}`,k);let S=null!==(o=null==k?void 0:k.channelId)&&void 0!==o?o:"",C=null!==(a=null===(s=e.connector.getKeyInfo())||void 0===s?void 0:s.ecies.public)&&void 0!==a?a:"",I=null!==(l=null===(c=e.connector.getKeyInfo())||void 0===c?void 0:c.ecies.private)&&void 0!==l?l:"";if(n&&!k)return Promise.resolve();if(!k&&!n){const t=yield e.connector.generateChannelIdConnect();S=null!==(u=t.channelId)&&void 0!==u?u:"",C=null!==(d=t.pubKey)&&void 0!==d?d:"",I=null!==(h=t.privKey)&&void 0!==h?h:"";const n=Date.now();null===(f=e.connector.state.storageManager)||void 0===f||f.persistChannelConfig({channelId:S,localKey:I,lastActive:n,validUntil:n+fie})}if(n&&(null==k?void 0:k.channelId))return(null===(p=e.connector)||void 0===p?void 0:p.isConnected())||(yue(`[RemoteConnection: startConnection()] reconnecting to channel initialCheck=${n}`,k),yield null===(m=e.connector)||void 0===m?void 0:m.connectToChannel({channelId:S})),Promise.resolve();k&&!(null===(g=e.connector)||void 0===g?void 0:g.isConnected())&&(yue("[RemoteConnection: startConnection()] reconnecting to channel",k),yield null===(y=e.connector)||void 0===y?void 0:y.connectToChannel({channelId:S}));const A=(null===(b=e.platformManager)||void 0===b?void 0:b.isSecure())?"":"&t=q",P=Fue,{iconUrl:M,name:O,url:T,scheme:R}=t.dappMetadata||{},N=null===(v=e.platformManager)||void 0===v?void 0:v.getPlatformType();let L="N/A";"undefined"!=typeof window&&window.location&&window.location.hostname?L=window.location.hostname:void 0!==O?L=O:void 0!==T&&(L=T);const B={url:null!=T?T:"",title:null!=O?O:"",icon:M,scheme:null!=R?R:"",apiVersion:P,dappId:L||T||"N/A",platform:null!=N?N:"",source:null!==(w=t._source)&&void 0!==w?w:""},j=cde(JSON.stringify(B));let D=`channelId=${S}&v=2&comm=${null!==(E=e.communicationLayerPreference)&&void 0!==E?E:""}&pubkey=${C}${A}&originatorInfo=${j}`;if(r){D+=`&rpc=${cde(JSON.stringify(r))}`;const t=e.connector.getRPCMethodTracker();t&&(t[`${r.id}`]=Object.assign(Object.assign({},r),{id:`${r.id}`,timestamp:Date.now()}))}const U=encodeURI(D),F=`${e.useDeeplink?Hue:zue}?${D}`;return e.qrcodeLink=F,e.developerMode&&yue(`[RemoteConnection: startConnection()] qrcodeLink=${U}`),x.emit("display_uri",F),(null===(_=e.platformManager)||void 0===_?void 0:_.isSecure())?(yield function(e,t){var n,r;return l7(this,void 0,void 0,function*(){const i=`${zue}?${t}`,o=`${Hue}?${t}`;null===(r=null===(n=e.platformManager)||void 0===n?void 0:n.openDeeplink)||void 0===r||r.call(n,i,o,"_self")})}(e,U),new Promise((t,n)=>{var r,i,o;(null===(r=e.connector)||void 0===r?void 0:r.isAuthorized())?t():(null===(i=e.connector)||void 0===i||i.once(bie.AUTHORIZED,()=>{t()}),null===(o=e.connector)||void 0===o||o.once(bie.REJECTED,()=>{n(bie.REJECTED)}))})):function(e,t,n){return l7(this,void 0,void 0,function*(){return new Promise((r,i)=>{if(!e.connector)return void i(new Error("No connector available"));yue("[RemoteConnection: connectWithModalInstaller()]",{state:e,options:t,linkParams:n});const o=`${e.useDeeplink?Hue:zue}?${n}`;var s,a,c,l,u,d,h;a=t,c=o,(s=e).installModal=null===(u=(l=a.modals).install)||void 0===u?void 0:u.call(l,{link:c,preferDesktop:s.preferDesktop,installer:a.getMetaMaskInstaller(),terminate:()=>{yue("[RemoteConnection: showInstallModal() => terminate()] terminate connection"),a.sdk.terminate().catch(e=>{console.warn("[MMSDK] failed to terminate connection",e)})},debug:s.developerMode,connectWithExtension:()=>{var e;return null===(e=a.connectWithExtensionProvider)||void 0===e||e.call(a),!1},onAnalyticsEvent:({event:e,params:t})=>{var n,r,i;const o=Object.assign(Object.assign({},t),{sdkVersion:a.sdk.getVersion(),dappId:null===(n=a.dappMetadata)||void 0===n?void 0:n.name,source:a._source,url:null===(r=a.dappMetadata)||void 0===r?void 0:r.url});null===(i=s.analytics)||void 0===i||i.send({event:e,params:o})}}),null===(h=null===(d=s.installModal)||void 0===d?void 0:d.mount)||void 0===h||h.call(d,c),t.sdk.once(bie.PROVIDER_UPDATE,e=>l7(this,void 0,void 0,function*(){yue("[RemoteConnection: connectWithModalInstaller()] once provider_update -- resolving startConnection promise"),e!==ode.TERMINATE?i(e):i({code:4001,message:"User rejected the request."})})),e.connector.once(bie.AUTHORIZED,()=>{r()}),e.connector.once(bie.REJECTED,()=>{i(bie.REJECTED)}),e.connector.once(bie.CLIENTS_READY,()=>l7(this,void 0,void 0,function*(){yue("[RemoteConnection: connectWithModalInstaller()] once clients_ready -- resolving startConnection promise"),r()}))})})}(e,t,U)}catch(x){throw console.error("[startConnection] error",x),x}})}class Nde{constructor(e){var t,n,r;this.state={connector:void 0,qrcodeLink:void 0,analytics:void 0,developerMode:!1,authorized:!1,reconnection:!1,preferDesktop:!1,deeplinkProtocol:!1,listeners:[],communicationLayerPreference:void 0,platformManager:void 0,pendingModal:void 0,installModal:void 0,otpAnswer:void 0},this.options=e;const i=!0===(null===(t=e.logging)||void 0===t?void 0:t.developerMode)||!0===(null===(n=e.logging)||void 0===n?void 0:n.sdk);this.state.developerMode=i,this.state.analytics=e.analytics,this.state.preferDesktop=null!==(r=e.preferDesktop)&&void 0!==r&&r,this.state.useDeeplink=e.sdk.options.useDeeplink,this.state.communicationLayerPreference=e.communicationLayerPreference,this.state.platformManager=e.platformManager,e.modals.install||(e.modals.install=Ade),e.modals.otp||(e.modals.otp=Pde)}startConnection(e){return l7(this,void 0,void 0,function*(){return Rde(this.state,this.options,e)})}initRemoteCommunication({sdkInstance:e}){var t,n,r;return l7(this,void 0,void 0,function*(){const i=yield null===(n=null===(t=e.options.storage)||void 0===t?void 0:t.storageManager)||void 0===n?void 0:n.getPersistedChannelConfig();if(!this.options.ecies){const e={privateKey:null==i?void 0:i.localKey};this.options.ecies=e}Mde(this.state,this.options),yield null===(r=this.getConnector())||void 0===r?void 0:r.initFromDappStorage(),Tde(this.state,this.options)})}showActiveModal(){return function(e){var t,n,r,i;e.authorized?yue("[RemoteConnection: showActiveModal()] already authorized"):e.pendingModal?null===(n=(t=e.pendingModal).mount)||void 0===n||n.call(t):e.installModal&&(null===(i=(r=e.installModal).mount)||void 0===i||i.call(r,e.qrcodeLink||""))}(this.state)}closeModal(){var e,t,n,r;null===(t=null===(e=this.state.pendingModal)||void 0===e?void 0:e.unmount)||void 0===t||t.call(e),null===(r=null===(n=this.state.installModal)||void 0===n?void 0:n.unmount)||void 0===r||r.call(n,!1)}getUniversalLink(){if(!this.state.qrcodeLink)throw new Error("connection not started. run startConnection() first.");return this.state.qrcodeLink}getChannelConfig(){var e;return null===(e=this.state.connector)||void 0===e?void 0:e.getChannelConfig()}getKeyInfo(){var e;return null===(e=this.state.connector)||void 0===e?void 0:e.getKeyInfo()}getConnector(){if(!this.state.connector)throw new Error("invalid remote connector");return this.state.connector}getPlatformManager(){if(!this.state.platformManager)throw new Error("PlatformManager not available");return this.state.platformManager}isConnected(){var e;return(null===(e=this.state.connector)||void 0===e?void 0:e.isReady())||!1}isAuthorized(){var e;return(null===(e=this.state.connector)||void 0===e?void 0:e.isAuthorized())||!1}isPaused(){var e;return null===(e=this.state.connector)||void 0===e?void 0:e.isPaused()}disconnect(e){var t,n,r,i;yue("[RemoteConnection: disconnect()]",e),(null==e?void 0:e.terminate)&&(Lue.getProvider().handleDisconnect({terminate:!0}),null===(n=null===(t=this.state.pendingModal)||void 0===t?void 0:t.unmount)||void 0===n||n.call(t),this.state.otpAnswer=void 0),null===(r=this.state.connector)||void 0===r||r.disconnect(e),i=this.state,yue("[RemoteConnection: cleanupConnector()] cleaning up connector"),i.connector&&(Ode(i),i.connector.disconnect({terminate:!0}).catch(e=>{yue("[RemoteConnection: cleanupConnector()] error disconnecting connector",e)}))}}function Lde(e){var t,n,r,i,o,s,a,c,l,u,d;return l7(this,void 0,void 0,function*(){const{options:h}=e;if(h.logging=null!==(t=h.logging)&&void 0!==t?t:{},h.communicationLayerPreference=null!==(n=h.communicationLayerPreference)&&void 0!==n?n:jie.SOCKET,void 0!==h.enableDebug&&(f1.enable("MM_SDK"),console.warn("enableDebug is removed. Please use enableAnalytics instead.")),h.enableAnalytics=null===(r=h.enableAnalytics)||void 0===r||r,h.injectProvider=null===(i=h.injectProvider)||void 0===i||i,h.shouldShimWeb3=null===(o=h.shouldShimWeb3)||void 0===o||o,h.extensionOnly=null===(s=h.extensionOnly)||void 0===s||s,h.useDeeplink=null===(a=h.useDeeplink)||void 0===a||a,h.storage=null!==(c=h.storage)&&void 0!==c?c:{enabled:!0},h.headless){f1("[MetaMaskSDK: performSDKInitialization()] headless mode enabled");const e=()=>{},t={install:()=>({mount:e,unmount:e})},n={installer:e};h.modals=t,h.ui=n}const f=!0===(null===(l=h.logging)||void 0===l?void 0:l.developerMode);e.debug=(null===(u=h.logging)||void 0===u?void 0:u.sdk)||f,yue("[MetaMaskSDK: performSDKInitialization()] options",e.options);const p=Object.assign({},h.logging);f&&(p.sdk=!0,p.eciesLayer=!0,p.keyExchangeLayer=!0,p.remoteLayer=!0,p.serviceLayer=!0,p.plaintext=!0),yield function(e){var t;return l7(this,void 0,void 0,function*(){const{options:n}=e;e.platformManager=new Bue({useDeepLink:null!==(t=n.useDeeplink)&&void 0!==t&&t,preferredOpenLink:n.openDeeplink,debug:e.debug})})}(e),yield function(e){var t,n,r,i,o,s,a,c,l;return l7(this,void 0,void 0,function*(){const{options:u}=e,d=null===(t=e.platformManager)||void 0===t?void 0:t.getPlatformType();e.analytics=new fde({serverUrl:null!==(n=u.communicationServerUrl)&&void 0!==n?n:die,enabled:u.enableAnalytics,originatorInfo:{url:null!==(r=u.dappMetadata.url)&&void 0!==r?r:"",title:null!==(i=u.dappMetadata.name)&&void 0!==i?i:"",dappId:"undefined"==typeof window||void 0===window.location?null!==(c=null!==(s=null===(o=u.dappMetadata)||void 0===o?void 0:o.name)&&void 0!==s?s:null===(a=u.dappMetadata)||void 0===a?void 0:a.url)&&void 0!==c?c:"N/A":window.location.hostname,platform:null!=d?d:"",source:null!==(l=u._source)&&void 0!==l?l:""}})})}(e),yield function(e){var t;return l7(this,void 0,void 0,function*(){const{options:n}=e;!0!==(null===(t=n.storage)||void 0===t?void 0:t.enabled)||n.storage.storageManager||(n.storage.storageManager=yield jue(n.storage))})}(e),yield function(e){return l7(this,void 0,void 0,function*(){const{options:t}=e,n=/^(http|https):\/\/[^\s]*$/;if(t.dappMetadata){t.dappMetadata.iconUrl&&!n.test(t.dappMetadata.iconUrl)&&(console.warn("Invalid dappMetadata.iconUrl: URL must start with http:// or https://"),t.dappMetadata.iconUrl=void 0),t.dappMetadata.base64Icon&&t.dappMetadata.base64Icon.length>163400&&(console.warn("Invalid dappMetadata.base64Icon: Base64-encoded icon string length must be less than 163400 characters"),t.dappMetadata.base64Icon=void 0),t.dappMetadata.url&&!n.test(t.dappMetadata.url)&&console.warn("Invalid dappMetadata.url: URL must start with http:// or https://");const e=(()=>{if("undefined"==typeof document)return;let e;const t=document.getElementsByTagName("link");for(let n=0;n<t.length;n++)"icon"!==t[n].getAttribute("rel")&&"shortcut icon"!==t[n].getAttribute("rel")||(e=t[n].getAttribute("href"));return e})();if(e&&!t.dappMetadata.iconUrl&&!t.dappMetadata.base64Icon){const n=`${window.location.protocol}//${window.location.host}${e}`;t.dappMetadata.iconUrl=n}}e.dappMetadata=t.dappMetadata})}(e),yield(e=>l7(void 0,void 0,void 0,function*(){const{options:t}=e,{infuraAPIKey:n}=t;if(!n)return;const r={"0x1":`https://mainnet.infura.io/v3/${n}`,"0x5":`https://goerli.infura.io/v3/${n}`,"0xaa36a7":`https://sepolia.infura.io/v3/${n}`,"0xe708":`https://linea-mainnet.infura.io/v3/${n}`,"0xe704":`https://linea-goerli.infura.io/v3/${n}`,"0x89":`https://polygon-mainnet.infura.io/v3/${n}`,"0x13881":`https://polygon-mumbai.infura.io/v3/${n}`,"0x45":`https://optimism-mainnet.infura.io/v3/${n}`,"0x1a4":`https://optimism-goerli.infura.io/v3/${n}`,"0xa4b1":`https://arbitrum-mainnet.infura.io/v3/${n}`,"0x66eed":`https://arbitrum-goerli.infura.io/v3/${n}`,"0x2a15c308d":`https://palm-mainnet.infura.io/v3/${n}`,"0x2a15c3083":`https://palm-testnet.infura.io/v3/${n}`,"0xa86a":`https://avalanche-mainnet.infura.io/v3/${n}`,"0xa869":`https://avalanche-fuji.infura.io/v3/${n}`,"0x4e454152":`https://aurora-mainnet.infura.io/v3/${n}`,"0x4e454153":`https://aurora-testnet.infura.io/v3/${n}`,"0x534e5f4d41494e":`https://starknet-mainnet.infura.io/v3/${n}`,"0x534e5f474f45524c49":`https://starknet-goerli.infura.io/v3/${n}`,"0x534e5f474f45524c4932":`https://starknet-goerli2.infura.io/v3/${n}`,"0xa4ec":`https://celo-mainnet.infura.io/v3/${n}`,"0xaef3":`https://celo-alfajores.infura.io/v3/${n}`};e.options.readonlyRPCMap?e.options.readonlyRPCMap=Object.assign(Object.assign({},e.options.readonlyRPCMap),r):e.options.readonlyRPCMap=r}))(e),yield(e=>l7(void 0,void 0,void 0,function*(){const{options:t}=e,{readonlyRPCMap:n}=t;if(n)try{yue("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),e.setReadOnlyRPCCalls(!0)}catch(r){throw new Error("Invalid Infura Settings")}}))(e);const{metamaskBrowserExtension:m,preferExtension:g,shouldReturn:y}=yield function(e){var n,r,i,o;return l7(this,void 0,void 0,function*(){const{options:s}=e;let a,c=!1,l=!1;if("undefined"!=typeof window&&window.ethereum&&!(null===(n=e.platformManager)||void 0===n?void 0:n.isMetaMaskMobileWebView())){c="extension"===localStorage.getItem(Jue);try{a=yield function({mustBeMetaMask:e,sdkInstance:n}){return l7(this,void 0,void 0,function*(){if("undefined"==typeof window)throw new Error("window not available");try{const e=yield new Promise((e,t)=>{const n=setTimeout(()=>{t(new Error("eip6963RequestProvider timed out"))},500);window.addEventListener(gde.Announce,t=>{const r=t,{detail:{info:i,provider:o}={}}=r,{name:s,rdns:a,uuid:c}=null!=i?i:{};Wue.test(c)&&s.startsWith(que.NAME)&&que.RDNS.includes(a)&&(clearTimeout(n),e(o))}),window.dispatchEvent(new Event(gde.Request))});return mde({provider:e,sdkInstance:n})}catch(t){throw new Error("Provider not found")}})}({mustBeMetaMask:!0,sdkInstance:e}),window.extension=a,a.on(ede,t=>{yue(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE chainChanged chainId=${t}`),Boolean(e.sdkProvider)&&e.getMobileProvider().emit(ede,t)}),a.on(tde,t=>l7(this,void 0,void 0,function*(){var n;yue(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE accountsChanged accounts=${t}`);const r=Boolean(e.sdkProvider),i=Boolean(e.extensionActive);if(r&&e.getMobileProvider().emit(tde,t),i&&0===(null==t?void 0:t.length)&&0===(yield null===(n=e.getProvider())||void 0===n?void 0:n.request({method:Kue.WALLET_GETPERMISSIONS,params:[]})).length)try{yield e.terminate()}catch(o){yue("[MetaMaskSDK: setupExtensionPreferences()] error terminating on permissions revoked",o)}})),a.on(nde,t=>{yue(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE disconnect error=${t}`),Boolean(e.sdkProvider)&&e.getMobileProvider().emit(nde,t)}),a.on(rde,t=>{yue(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connect args=${t}`),Boolean(e.sdkProvider)&&e.getMobileProvider().emit(rde,t)}),a.on(ide,t=>{yue("[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connected",t),Boolean(e.sdkProvider)&&e.getMobileProvider().emit(ide,t)})}catch(u){window.extension=void 0}}else(null===(r=e.platformManager)||void 0===r?void 0:r.isMetaMaskMobileWebView())&&(null===(i=e.analytics)||void 0===i||i.send({event:_ie.SDK_USE_INAPP_BROWSER}),e.activeProvider=mde({provider:window.ethereum,sdkInstance:e}),e._initialized=!0,l=!0);return a&&s.extensionOnly&&(yue("[MetaMaskSDK: setupExtensionPreferences()] EXTENSION ONLY --- prevent sdk initialization"),null===(o=e.analytics)||void 0===o||o.send({event:_ie.SDK_USE_EXTENSION}),e.activeProvider=a,e.extensionActive=!0,e.extension=a,e._initialized=!0,l=!0),{preferExtension:c,shouldReturn:l,metamaskBrowserExtension:a}})}(e);if(y)yue("[MetaMaskSDK: performSDKInitialization()] shouldReturn=true --- prevent sdk initialization");else{yield function(e,t){var n,r,i,o,s;return l7(this,void 0,void 0,function*(){const{options:a}=e,c=Object.assign({},a.logging);e.remoteConnection=new Nde({preferDesktop:null!==(n=a.preferDesktop)&&void 0!==n&&n,communicationLayerPreference:null!==(r=a.communicationLayerPreference)&&void 0!==r?r:jie.SOCKET,analytics:e.analytics,dappMetadata:a.dappMetadata,_source:a._source,enableAnalytics:null===(i=a.enableAnalytics)||void 0===i||i,timer:a.timer,sdk:e,platformManager:e.platformManager,transports:a.transports,communicationServerUrl:a.communicationServerUrl,storage:null!==(o=a.storage)&&void 0!==o?o:{enabled:!0},getMetaMaskInstaller:()=>{if(!e.installer)throw new Error("Invalid SDK status -- installer not initialized");return e.installer},logging:c,connectWithExtensionProvider:void 0===t?void 0:()=>ade(e),modals:Object.assign(Object.assign({},a.modals),{onPendingModalDisconnect:e.terminate.bind(e)})}),yield e.remoteConnection.initRemoteCommunication({sdkInstance:e}),e.installer=new Cde({remote:e.remoteConnection,preferDesktop:null!==(s=a.preferDesktop)&&void 0!==s&&s,platformManager:e.platformManager,debug:e.debug})})}(e,m),yield hde(e),yield function(e,t){var n,r;return l7(this,void 0,void 0,function*(){const{options:i}=e;t?(yue("[MetaMaskSDK: handleAutoAndExtensionConnections()] preferExtension is detected -- connect with it."),null===(n=e.analytics)||void 0===n||n.send({event:_ie.SDK_EXTENSION_UTILIZED}),ade(e).catch(e=>{console.warn("Can't connect with MetaMask extension...",e),localStorage.removeItem(Jue)})):i.checkInstallationImmediately&&((null===(r=e.platformManager)||void 0===r?void 0:r.isDesktopWeb())?(yue("[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately"),e.connect().catch(e=>{yue(`[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- error on autoconnect _err=${e}`)})):console.warn("[handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- only for web desktop")),e._initialized=!0})}(e,g);try{yield null===(d=e.remoteConnection)||void 0===d?void 0:d.startConnection({initialCheck:!0})}catch(b){console.error("[MetaMaskSDK: setupRemoteConnectionAndInstaller()] Error while checking installation",b)}e.emit(Nue.ProviderUpdate,ode.INITIALIZED)}})}class Bde extends O4{constructor(e={storage:{enabled:!0},injectProvider:!0,forceInjectProvider:!1,enableAnalytics:!0,shouldShimWeb3:!0,useDeeplink:!0,extensionOnly:!0,headless:!1,dappMetadata:{name:"",url:"",iconUrl:""},_source:$ue,i18nOptions:{enabled:!1}}){var t,n,r;super(),this.extensionActive=!1,this._initialized=!1,this.sdkInitPromise=void 0,this.debug=!1,this.readonlyRPCCalls=!1,this.availableLanguages=["en"],f1.disable();const i=!0===(null===(t=e.logging)||void 0===t?void 0:t.developerMode);if(((null===(n=e.logging)||void 0===n?void 0:n.sdk)||i)&&f1.enable("MM_SDK"),yue("[MetaMaskSDK: constructor()]: begin."),this.setMaxListeners(50),!(null===(r=e.dappMetadata)||void 0===r?void 0:r.url)){if("undefined"==typeof window||"undefined"==typeof document)throw new Error("You must provide dAppMetadata url");e.dappMetadata=Object.assign(Object.assign({},e.dappMetadata),{url:`${window.location.protocol}//${window.location.host}`})}this.options=e,this.options._source||(e._source=$ue),this.init().then(()=>{yue("[MetaMaskSDK: constructor()]: initialized successfully."),"undefined"!=typeof window&&(window.mmsdk=this)}).catch(e=>{console.error("[MetaMaskSDK: constructor()] error during initialization",e)})}init(){return l7(this,void 0,void 0,function*(){return function(e){var t;return l7(this,void 0,void 0,function*(){if("undefined"!=typeof window&&(null===(t=window.mmsdk)||void 0===t?void 0:t.isInitialized()))return yue("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),Promise.resolve(window.mmsdk);if(e._initialized)return yue("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),e.sdkInitPromise;if(e.sdkInitPromise)return yue("[MetaMaskSDK: initializeMetaMaskSDK()] already initializing"),e.sdkInitPromise;try{e.sdkInitPromise=Lde(e),yield e.sdkInitPromise}catch(n){throw console.error(n),n}return e.sdkInitPromise})}(this)})}isExtensionActive(){return this.extensionActive}checkExtensionAvailability(){var e;return"undefined"!=typeof window&&Boolean(null===(e=window.ethereum)||void 0===e?void 0:e.isMetaMask)}connect(){return l7(this,void 0,void 0,function*(){return function(e){return l7(this,void 0,void 0,function*(){if(e._initialized||(yue("[MetaMaskSDK: connect()] provider not ready -- wait for init()"),yield e.init()),yue(`[MetaMaskSDK: connect()] isExtensionActive=${e.isExtensionActive()} activeProvider`,e.activeProvider),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");const t=e.activeProvider.getSelectedAddress();return t?[t]:e.activeProvider.request({method:Kue.ETH_REQUESTACCOUNTS,params:[]})})}(this)})}connectAndSign({msg:e}){return l7(this,void 0,void 0,function*(){return function({instance:e,msg:t}){return l7(this,void 0,void 0,function*(){if(e._initialized||(yue("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield e.init()),yue(`[MetaMaskSDK: connectAndSign()] activeProvider=${e.activeProvider}`),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=/^0x([0-9A-Fa-f]{2})*$/u.test(t)?t:function(e){let t;if(void 0!==S7)t=S7.from(e,"utf8").toString("hex");else if("undefined"!=typeof TextEncoder){const n=(new TextEncoder).encode(e);t=Array.from(n).map(e=>e.toString(16).padStart(2,"0")).join("")}else{if("object"!=typeof u7||!("Buffer"in u7))throw new Error("Unable to convert string to hex: No available method.");t=u7.Buffer.from(e,"utf8").toString("hex")}return`0x${t}`}(t);return e.activeProvider.request({method:Kue.METAMASK_CONNECTWITH,params:[{method:Kue.PERSONAL_SIGN,params:[n]}]})})}({instance:this,msg:e})})}connectWith(e){return l7(this,void 0,void 0,function*(){return function({instance:e,rpc:t}){return l7(this,void 0,void 0,function*(){if(e._initialized||(yue("[MetaMaskSDK: connectWith()] provider not ready -- wait for init()"),yield e.init()),yue(`[MetaMaskSDK: connectWith()] method: ${t.method} rpc=${t}`),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");return e.activeProvider.request({method:Kue.METAMASK_CONNECTWITH,params:[t]})})}({instance:this,rpc:e})})}resume(){return function(e){var t,n,r;return l7(this,void 0,void 0,function*(){if(!(null===(n=null===(t=e.remoteConnection)||void 0===t?void 0:t.getConnector())||void 0===n?void 0:n.isReady()))return yue("[MetaMaskSDK: resume()] channel is not ready -- starting connection"),void(null===(r=e.remoteConnection)||void 0===r||r.startConnection());yue("[MetaMaskSDK: resume()] channel is ready")})}(this)}disconnect(){return console.warn("MetaMaskSDK.disconnect() is deprecated, use terminate()"),this.terminate()}isAuthorized(){var e;null===(e=this.remoteConnection)||void 0===e||e.isAuthorized()}terminate(){return function(e){var t,n,r;return l7(this,void 0,void 0,function*(){if(!(null===(t=e.platformManager)||void 0===t?void 0:t.isMetaMaskMobileWebView())){if(sde&&(window.localStorage.removeItem(Jue),window.localStorage.removeItem(Xue),window.localStorage.removeItem(Que)),e.extensionActive){try{yield null===(n=e.activeProvider)||void 0===n?void 0:n.request({method:Kue.WALLET_REVOKEPERMISSIONS,params:[{eth_accounts:{}}]})}catch(i){yue("[MetaMaskSDK: terminate()] error revoking permissions",i)}return e.options.extensionOnly?(e.emit(Nue.ProviderUpdate,ode.TERMINATE),void yue("[MetaMaskSDK: terminate()] extensionOnly --- prevent switching providers")):(e.activeProvider=e.sdkProvider,window.ethereum=e.activeProvider,e.extensionActive=!1,void e.emit(Nue.ProviderUpdate,ode.TERMINATE))}e.emit(Nue.ProviderUpdate,ode.TERMINATE),yue(`[MetaMaskSDK: terminate()] remoteConnection=${e.remoteConnection}`),null===(r=e.remoteConnection)||void 0===r||r.disconnect({terminate:!0,sendMessage:!0})}})}(this)}isInitialized(){return this._initialized}setReadOnlyRPCCalls(e){this.readonlyRPCCalls=e}hasReadOnlyRPCCalls(){return this.readonlyRPCCalls}getProvider(){if(this.activeProvider)return this.activeProvider;console.warn("MetaMaskSDK: No active provider found")}getMobileProvider(){if(!this.sdkProvider)throw new Error("SDK state invalid -- undefined mobile provider");return this.sdkProvider}getUniversalLink(){var e;const t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getUniversalLink();if(!t)throw new Error("No Universal Link available, please call eth_requestAccounts first.");return t}getChannelId(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getChannelConfig())||void 0===t?void 0:t.channelId}getRPCHistory(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t?void 0:t.getRPCMethodTracker()}getVersion(){return Fue}getWalletStatus(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t?void 0:t.getConnectionStatus()}_getChannelConfig(){var e;return null===(e=this.remoteConnection)||void 0===e?void 0:e.getChannelConfig()}_ping(){var e,t;null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t||t.ping()}_keyCheck(){var e,t;null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t||t.keyCheck()}_getServiceStatus(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t?void 0:t.getServiceStatus()}_getRemoteConnection(){return this.remoteConnection}_getDappMetadata(){return this.dappMetadata}_getKeyInfo(){var e;return null===(e=this.remoteConnection)||void 0===e?void 0:e.getKeyInfo()}_resetKeys(){var e,t;null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t||t.resetKeys()}_getConnection(){return this.remoteConnection}emit(e,t){return super.emit(e,t)}on(e,t){return super.on(e,t)}}var jde=Object.freeze({__proto__:null,StorageManagerWeb:class{constructor({enabled:e}={enabled:!1}){this.enabled=!1,this.enabled=e}persistChannelConfig(e){return l7(this,void 0,void 0,function*(){const t=JSON.stringify(e);yue(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,e),localStorage.setItem(Yue,t)})}getPersistedChannelConfig(){return l7(this,void 0,void 0,function*(){let e;try{if(yue(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),e=localStorage.getItem(Yue),yue("[StorageManagerWeb: getPersistedChannelConfig()]",e),!e)return;const t=JSON.parse(e);return yue("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",t),t}catch(t){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",t)}})}persistAccounts(e){return l7(this,void 0,void 0,function*(){yue(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,e);const t=JSON.stringify(e);localStorage.setItem(Que,t)})}getCachedAccounts(){return l7(this,void 0,void 0,function*(){try{const e=localStorage.getItem(Que);return e?JSON.parse(e):[]}catch(kie){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",kie),kie}})}persistChainId(e){return l7(this,void 0,void 0,function*(){yue(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,e),localStorage.setItem(Xue,e)})}getCachedChainId(){return l7(this,void 0,void 0,function*(){try{const e=localStorage.getItem(Xue);return null!=e?e:void 0}catch(kie){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",kie),kie}})}terminate(){return l7(this,void 0,void 0,function*(){yue(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(Yue)})}}});var Dde=Object.defineProperty,Ude=new WeakMap,Fde=e=>Ude.get(e),$de=(e,t)=>Ude.set(t.$lazyInstance$=e,t),zde=(e,t)=>t in e,Hde=(e,t)=>(0,console.error)(e,t),qde=new Map,Wde=new Map,Kde="slot-fb{display:contents}slot-fb[hidden]{display:none}",Gde="undefined"!=typeof window?window:{},Vde=Gde.document||{head:{}},Zde={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,r)=>e.addEventListener(t,n,r),rel:(e,t,n,r)=>e.removeEventListener(t,n,r),ce:(e,t)=>new CustomEvent(e,t)},Yde=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(kie){}return!1})(),Jde=!1,Qde=[],Xde=[],ehe=e=>{for(let n=0;n<e.length;n++)try{e[n](performance.now())}catch(t){Hde(t)}e.length=0},the=()=>{ehe(Qde),ehe(Xde),(Jde=Qde.length>0)&&Zde.raf(the)},nhe=e=>Promise.resolve(void 0).then(e),rhe=(e=>t=>{e.push(t),Jde||(Jde=!0,4&Zde.$flags$?nhe(the):Zde.raf(the))})(Xde),ihe={},ohe=e=>"object"==(e=typeof e)||"function"===e;function she(e){var t,n,r;return null!=(r=null==(n=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?r:void 0}((e,t)=>{for(var n in t)Dde(e,n,{get:t[n],enumerable:!0})})({},{err:()=>che,map:()=>lhe,ok:()=>ahe,unwrap:()=>dhe,unwrapErr:()=>hhe});var ahe=e=>({isOk:!0,isErr:!1,value:e}),che=e=>({isOk:!1,isErr:!0,value:e});function lhe(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then(e=>ahe(e)):ahe(n)}if(e.isErr){const t=e.value;return che(t)}throw"should never get here"}var uhe,dhe=e=>{if(e.isOk)return e.value;throw e.value},hhe=e=>{if(e.isErr)return e.value;throw e.value},fhe=(e,t,...n)=>{let r=null,i=!1,o=!1;const s=[],a=t=>{for(let n=0;n<t.length;n++)r=t[n],Array.isArray(r)?a(r):null!=r&&"boolean"!=typeof r&&((i="function"!=typeof e&&!ohe(r))&&(r=String(r)),i&&o?s[s.length-1].$text$+=r:s.push(i?phe(null,r):r),o=i)};if(a(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter(t=>e[t]).join(" "))}if("function"==typeof e)return e(null===t?{}:t,s,ghe);const c=phe(e,null);return c.$attrs$=t,s.length>0&&(c.$children$=s),c},phe=(e,t)=>({$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null}),mhe={},ghe={forEach:(e,t)=>e.map(yhe).forEach(t),map:(e,t)=>e.map(yhe).map(t).map(bhe)},yhe=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),bhe=e=>{if("function"==typeof e.vtag){const t={...e.vattrs};return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),fhe(e.vtag,t,...e.vchildren||[])}const t=phe(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},vhe=e=>Fde(e).$hostElement$,whe=(e,t,n)=>{const r=vhe(e);return{emit:e=>Ehe(r,t,{bubbles:!0,composed:!0,cancelable:!0,detail:e})}},Ehe=(e,t,n)=>{const r=Zde.ce(t,n);return e.dispatchEvent(r),r},_he=new WeakMap,xhe=(e,t)=>"sc-"+e.$tagName$,khe=(e,t,n,r,i,o)=>{if(n!==r){let a=zde(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,i=Che(n),o=Che(r);t.remove(...i.filter(e=>e&&!o.includes(e))),t.add(...o.filter(e=>e&&!i.includes(e)))}else if("style"===t){for(const t in n)r&&null!=r[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in r)n&&r[t]===n[t]||(t.includes("-")?e.style.setProperty(t,r[t]):e.style[t]=r[t])}else if(a||"o"!==t[0]||"n"!==t[1]){const c=ohe(r);if((a||c&&null!==r)&&!i)try{if(e.tagName.includes("-"))e[t]=r;else{const i=null==r?"":r;"list"===t?a=!1:null!=n&&e[t]==i||("function"==typeof e.__lookupSetter__(t)?e[t]=i:e.setAttribute(t,i))}}catch(s){}null==r||!1===r?!1===r&&""!==e.getAttribute(t)||e.removeAttribute(t):(!a||4&o||i)&&!c&&(r=!0===r?"":r,e.setAttribute(t,r))}else if(t="-"===t[2]?t.slice(3):zde(Gde,c)?c.slice(2):c[2]+t.slice(3),n||r){const i=t.endsWith(Ihe);t=t.replace(Ahe,""),n&&Zde.rel(e,t,n,i),r&&Zde.ael(e,t,r,i)}}},She=/\s/,Che=e=>e?e.split(She):[],Ihe="Capture",Ahe=new RegExp(Ihe+"$"),Phe=(e,t,n)=>{const r=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,i=e&&e.$attrs$||ihe,o=t.$attrs$||ihe;for(const s of Mhe(Object.keys(i)))s in o||khe(r,s,i[s],void 0,n,t.$flags$);for(const s of Mhe(Object.keys(o)))khe(r,s,i[s],o[s],n,t.$flags$)};function Mhe(e){return e.includes("ref")?[...e.filter(e=>"ref"!==e),"ref"]:e}var Ohe=!1,The=(e,t,n,r)=>{const i=t.$children$[n];let o,s,a=0;if(null!==i.$text$)o=i.$elm$=Vde.createTextNode(i.$text$);else{if(Ohe||(Ohe="svg"===i.$tag$),o=i.$elm$=Vde.createElementNS(Ohe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.$tag$),Ohe&&"foreignObject"===i.$tag$&&(Ohe=!1),Phe(null,i,Ohe),o.getRootNode().querySelector("body"),i.$children$)for(a=0;a<i.$children$.length;++a)s=The(e,i,a),s&&o.appendChild(s);"svg"===i.$tag$?Ohe=!1:"foreignObject"===o.tagName&&(Ohe=!0)}return o["s-hn"]=uhe,o},Rhe=(e,t,n,r,i,o)=>{let s,a=e;for(a.shadowRoot&&a.tagName===uhe&&(a=a.shadowRoot);i<=o;++i)r[i]&&(s=The(null,n,i),s&&(r[i].$elm$=s,jhe(a,s,t)))},Nhe=(e,t,n)=>{for(let r=t;r<=n;++r){const t=e[r];if(t){const e=t.$elm$;e&&e.remove()}}},Lhe=(e,t,n=!1)=>e.$tag$===t.$tag$,Bhe=(e,t,n=!1)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,s=t.$tag$,a=t.$text$;null===a?(Phe(e,t,Ohe="svg"===s||"foreignObject"!==s&&Ohe),null!==i&&null!==o?((e,t,n,r,i=!1)=>{let o,s=0,a=0,c=t.length-1,l=t[0],u=t[c],d=r.length-1,h=r[0],f=r[d];for(;s<=c&&a<=d;)null==l?l=t[++s]:null==u?u=t[--c]:null==h?h=r[++a]:null==f?f=r[--d]:Lhe(l,h,i)?(Bhe(l,h,i),l=t[++s],h=r[++a]):Lhe(u,f,i)?(Bhe(u,f,i),u=t[--c],f=r[--d]):Lhe(l,f,i)?(Bhe(l,f,i),jhe(e,l.$elm$,u.$elm$.nextSibling),l=t[++s],f=r[--d]):Lhe(u,h,i)?(Bhe(u,h,i),jhe(e,u.$elm$,l.$elm$),u=t[--c],h=r[++a]):(o=The(t&&t[a],n,a),h=r[++a],o&&jhe(l.$elm$.parentNode,o,l.$elm$));s>c?Rhe(e,null==r[d+1]?null:r[d+1].$elm$,n,r,a,d):a>d&&Nhe(t,s,c)})(r,i,t,o,n):null!==o?(null!==e.$text$&&(r.textContent=""),Rhe(r,null,t,o,0,o.length-1)):!n&&null!==i&&Nhe(i,0,i.length-1),Ohe&&"svg"===s&&(Ohe=!1)):e.$text$!==a&&(r.data=a)},jhe=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),Dhe=(e,t)=>{t&&!e.$onRenderResolve$&&t["s-p"]&&t["s-p"].push(new Promise(t=>e.$onRenderResolve$=t))},Uhe=(e,t)=>{if(e.$flags$|=16,!(4&e.$flags$))return Dhe(e,e.$ancestorComponent$),rhe(()=>Fhe(e,t));e.$flags$|=512},Fhe=(e,t)=>{const n=e.$hostElement$;e.$cmpMeta$.$tagName$;const r=e.$lazyInstance$;if(!r)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);return $he(void 0,()=>Hhe(e,r,t))},$he=(e,t)=>zhe(e)?e.then(t).catch(e=>{console.error(e),t()}):t(),zhe=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,Hhe=async(e,t,n)=>{var r;const i=e.$hostElement$;e.$cmpMeta$.$tagName$;const o=i["s-rc"];n&&(e=>{const t=e.$cmpMeta$,n=e.$hostElement$,r=t.$flags$;t.$tagName$;const i=((e,t)=>{var n;const r=xhe(t),i=Wde.get(r);if(e=11===e.nodeType?e:Vde,i)if("string"==typeof i){e=e.head||e;let o,s=_he.get(e);if(s||_he.set(e,s=new Set),!s.has(r)){{o=Vde.createElement("style"),o.innerHTML=i;const r=null!=(n=Zde.$nonce$)?n:she(Vde);if(null!=r&&o.setAttribute("nonce",r),!(1&t.$flags$))if("HEAD"===e.nodeName){const t=e.querySelectorAll("link[rel=preconnect]"),n=t.length>0?t[t.length-1].nextSibling:e.querySelector("style");e.insertBefore(o,n)}else if("host"in e)if(Yde){const t=new CSSStyleSheet;t.replaceSync(i),e.adoptedStyleSheets=[t,...e.adoptedStyleSheets]}else{const t=e.querySelector("style");t?t.innerHTML=i+t.innerHTML:e.prepend(o)}else e.append(o);1&t.$flags$&&"HEAD"!==e.nodeName&&e.insertBefore(o,null)}4&t.$flags$&&(o.innerHTML+=Kde),s&&s.add(r)}}else e.adoptedStyleSheets.includes(i)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,i]);return r})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&r&&2&r&&(n["s-sc"]=i,n.classList.add(i+"-h"))})(e),e.$cmpMeta$.$tagName$,qhe(e,t,i,n),o&&(o.map(e=>e()),i["s-rc"]=void 0);{const t=null!=(r=i["s-p"])?r:[],n=()=>Whe(e);0===t.length?n():(Promise.all(t).then(n),e.$flags$|=4,t.length=0)}},qhe=(e,t,n,r)=>{try{t=t.render(),e.$flags$&=-17,e.$flags$|=2,((e,t,n=!1)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||phe(null,null),s=(a=t)&&a.$tag$===mhe?t:fhe(null,null,t);var a;if(uhe=r.tagName,n&&s.$attrs$)for(const c of Object.keys(s.$attrs$))r.hasAttribute(c)&&!["key","ref","style","class"].includes(c)&&(s.$attrs$[c]=r[c]);s.$tag$=null,s.$flags$|=4,e.$vnode$=s,s.$elm$=o.$elm$=r.shadowRoot||r,r["s-sc"],i.$flags$,Bhe(o,s,n)})(e,t,r)}catch(i){Hde(i,e.$hostElement$)}return null},Whe=e=>{e.$cmpMeta$.$tagName$;const t=e.$hostElement$,n=e.$lazyInstance$,r=e.$ancestorComponent$;64&e.$flags$||(e.$flags$|=64,Vhe(t),Ghe(n,"componentDidLoad"),e.$onReadyResolve$(t),r||Khe()),e.$onRenderResolve$&&(e.$onRenderResolve$(),e.$onRenderResolve$=void 0),512&e.$flags$&&nhe(()=>Uhe(e,!1)),e.$flags$&=-517},Khe=e=>{Vhe(Vde.documentElement),nhe(()=>Ehe(Gde,"appload",{detail:{namespace:"sdk-install-modal-web"}}))},Ghe=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(r){Hde(r)}},Vhe=e=>e.classList.add("hydrated"),Zhe=(e,t,n)=>{var r,i;const o=e.prototype;if(t.$members$||t.$watchers$||e.watchers){e.watchers&&!t.$watchers$&&(t.$watchers$=e.watchers);const s=Object.entries(null!=(r=t.$members$)?r:{});if(s.map(([e,[r]])=>{(31&r||2&n&&32&r)&&Object.defineProperty(o,e,{get(){return t=e,Fde(this).$instanceValues$.get(t);var t},set(n){((e,t,n,r)=>{const i=Fde(e);if(!i)throw new Error(`Couldn't find host element for "${r.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const o=i.$hostElement$,s=i.$instanceValues$.get(t),a=i.$flags$,c=i.$lazyInstance$;var l,u;l=n,u=r.$members$[t][0],n=null==l||ohe(l)?l:4&u?"false"!==l&&(""===l||!!l):1&u?String(l):l;const d=Number.isNaN(s)&&Number.isNaN(n);if((!(8&a)||void 0===s)&&n!==s&&!d&&(i.$instanceValues$.set(t,n),c)){if(r.$watchers$&&128&a){const e=r.$watchers$[t];e&&e.map(e=>{try{c[e](n,s,t)}catch(r){Hde(r,o)}})}2==(18&a)&&Uhe(i,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})}),1&n){const n=new Map;o.attributeChangedCallback=function(e,r,i){Zde.jmp(()=>{var s;const a=n.get(e);if(this.hasOwnProperty(a))i=this[a],delete this[a];else{if(o.hasOwnProperty(a)&&"number"==typeof this[a]&&this[a]==i)return;if(null==a){const n=Fde(this),o=null==n?void 0:n.$flags$;if(o&&!(8&o)&&128&o&&i!==r){const o=n.$lazyInstance$,a=null==(s=t.$watchers$)?void 0:s[e];null==a||a.forEach(t=>{null!=o[t]&&o[t].call(o,i,r,e)})}return}}this[a]=(null!==i||"boolean"!=typeof this[a])&&i})},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(i=t.$watchers$)?i:{}),...s.filter(([e,t])=>15&t[0]).map(([e,t])=>{const r=t[1]||e;return n.set(r,e),r})]))}}return e},Yhe=e=>{Ghe(e,"connectedCallback")},Jhe=e=>{Ghe(e,"disconnectedCallback")},Qhe=(e,t={})=>{var n;const r=[],i=t.exclude||[],o=Gde.customElements,s=Vde.head,a=s.querySelector("meta[charset]"),c=Vde.createElement("style"),l=[];let u,d=!0;Object.assign(Zde,t),Zde.$resourcesUrl$=new URL(t.resourcesUrl||"./",Vde.baseURI).href;let h=!1;if(e.map(e=>{e[1].map(t=>{var n;const s={$flags$:t[0],$tagName$:t[1],$members$:t[2],$listeners$:t[3]};4&s.$flags$&&(h=!0),s.$members$=t[2],s.$watchers$=null!=(n=t[4])?n:{};const a=s.$tagName$,c=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,t)=>{const n={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};n.$onReadyPromise$=new Promise(e=>n.$onReadyResolve$=e),e["s-p"]=[],e["s-rc"]=[],Ude.set(e,n)})(e=this,s),1&s.$flags$)if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw new Error(`Unable to re-use existing shadow root for ${s.$tagName$}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else e.attachShadow({mode:"open"})}connectedCallback(){Fde(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),u&&(clearTimeout(u),u=null),d?l.push(this):Zde.jmp(()=>(e=>{if(!(1&Zde.$flags$)){const t=Fde(e),n=t.$cmpMeta$;if(n.$tagName$,1&t.$flags$)(null==t?void 0:t.$lazyInstance$)?Yhe(t.$lazyInstance$):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>Yhe(t.$lazyInstance$));else{t.$flags$|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){Dhe(t,t.$ancestorComponent$=n);break}}n.$members$&&Object.entries(n.$members$).map(([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}}),(async(t,n,r)=>{let i;if(!(32&n.$flags$)){if(n.$flags$|=32,r.$lazyBundleId$){const t=(e=>{const t=e.$tagName$.replace(/-/g,"_"),n=e.$lazyBundleId$;if(!n)return;const r=qde.get(n);if(r)return r[t];{const e=e=>(qde.set(n,e),e[t]);if("mm-install-modal_3"===n)return Promise.resolve().then(function(){return jfe}).then(e,Hde)}return import(`./${n}.entry.js`).then(e=>(qde.set(n,e),e[t]),Hde)})(r);if(i=t&&"then"in t?await t:t,!i)throw new Error(`Constructor for "${r.$tagName$}#${n.$modeName$}" was not found`);i.isProxied||(r.$watchers$=i.watchers,Zhe(i,r,2),i.isProxied=!0),r.$tagName$,n.$flags$|=8;try{new i(n)}catch(e){Hde(e)}n.$flags$&=-9,n.$flags$|=128,Yhe(n.$lazyInstance$)}else{i=t.constructor;const e=t.localName;customElements.whenDefined(e).then(()=>n.$flags$|=128)}if(i&&i.style){let e;"string"==typeof i.style&&(e=i.style);const t=xhe(r);Wde.has(t)||(r.$tagName$,((e,t,n)=>{let r=Wde.get(e);Yde&&n?(r=r||new CSSStyleSheet,"string"==typeof r?r=t:r.replaceSync(t)):r=t,Wde.set(e,r)})(t,e,!!(1&r.$flags$)))}}const o=n.$ancestorComponent$,s=()=>Uhe(n,!0);o&&o["s-rc"]?o["s-rc"].push(s):s()})(e,t,n)}}})(this))}disconnectedCallback(){Zde.jmp(()=>(async e=>{if(!(1&Zde.$flags$)){const t=Fde(e);(null==t?void 0:t.$lazyInstance$)?Jhe(t.$lazyInstance$):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>Jhe(t.$lazyInstance$))}})(this))}componentOnReady(){return Fde(this).$onReadyPromise$}};s.$lazyBundleId$=e[0],i.includes(a)||o.get(a)||(r.push(a),o.define(a,Zhe(c,s,1)))})}),r.length>0&&(h&&(c.textContent+=Kde),c.textContent+=r.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",c.innerHTML.length)){c.setAttribute("data-styles","");const e=null!=(n=Zde.$nonce$)?n:she(Vde);null!=e&&c.setAttribute("nonce",e),s.insertBefore(c,a?a.nextSibling:s.firstChild)}d=!1,l.length?l.map(e=>e.connectedCallback()):Zde.jmp(()=>u=setTimeout(Khe,30))};!function(){if("undefined"!=typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}}();var Xhe=Object.freeze({__proto__:null,defineCustomElements:async(e,t)=>{if("undefined"!=typeof window)return await void 0,Qhe([["mm-install-modal_3",[[1,"mm-install-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}],[1,"mm-pending-modal",{displayOTP:[4,"display-o-t-p"],sdkVersion:[1,"sdk-version"],otpCode:[1,"otp-code"],translationsLoaded:[32]}],[1,"mm-select-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}]]]],t)},setNonce:e=>Zde.$nonce$=e});const efe={fontFamily:"Roboto, sans-serif"},tfe=({className:e},t)=>fhe("div",{style:efe,class:e},t),nfe=({Icon:e,text:t})=>fhe("div",{class:"flexContainer",style:{padding:"6",flexDirection:"row"}},fhe("div",{class:"flexItem1"},fhe(e,null)),fhe("div",{class:"flexItem11"},fhe("span",{style:{lineHeight:"2",color:"black"}},t))),rfe=()=>fhe("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M20.0002 7.9702V10.0302C20.0002 10.5802 19.5602 11.0302 19.0002 11.0502H17.0402C15.9602 11.0502 14.9702 10.2602 14.8802 9.1802C14.8202 8.5502 15.0602 7.9602 15.4802 7.5502C15.8502 7.1702 16.3602 6.9502 16.9202 6.9502H19.0002C19.5602 6.9702 20.0002 7.4202 20.0002 7.9702Z",fill:"#037DD6"}),fhe("path",{d:"M18.47 12.55H17.04C15.14 12.55 13.54 11.12 13.38 9.3C13.29 8.26 13.67 7.22 14.43 6.48C15.07 5.82 15.96 5.45 16.92 5.45H18.47C18.76 5.45 19 5.21 18.97 4.92C18.75 2.49 17.14 0.83 14.75 0.55C14.51 0.51 14.26 0.5 14 0.5H5C4.72 0.5 4.45 0.52 4.19 0.56C1.64 0.88 0 2.78 0 5.5V12.5C0 15.26 2.24 17.5 5 17.5H14C16.8 17.5 18.73 15.75 18.97 13.08C19 12.79 18.76 12.55 18.47 12.55ZM11 6.75H5C4.59 6.75 4.25 6.41 4.25 6C4.25 5.59 4.59 5.25 5 5.25H11C11.41 5.25 11.75 5.59 11.75 6C11.75 6.41 11.41 6.75 11 6.75Z",fill:"#037DD6"})),ife=()=>fhe("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M14.44 0.0999756C12.63 0.0999756 11.01 0.979976 10 2.32998C8.99 0.979976 7.37 0.0999756 5.56 0.0999756C2.49 0.0999756 0 2.59998 0 5.68998C0 6.87998 0.19 7.97998 0.52 8.99998C2.1 14 6.97 16.99 9.38 17.81C9.72 17.93 10.28 17.93 10.62 17.81C13.03 16.99 17.9 14 19.48 8.99998C19.81 7.97998 20 6.87998 20 5.68998C20 2.59998 17.51 0.0999756 14.44 0.0999756Z",fill:"#037DD6"})),ofe=()=>fhe("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M16.28 7.53V6.28C16.28 3.58 15.63 0 10 0C4.37 0 3.72 3.58 3.72 6.28V7.53C0.92 7.88 0 9.3 0 12.79V14.65C0 18.75 1.25 20 5.35 20H14.65C18.75 20 20 18.75 20 14.65V12.79C20 9.3 19.08 7.88 16.28 7.53ZM10 16.74C8.33 16.74 6.98 15.38 6.98 13.72C6.98 12.05 8.34 10.7 10 10.7C11.66 10.7 13.02 12.06 13.02 13.72C13.02 15.39 11.67 16.74 10 16.74ZM5.35 7.44C5.27 7.44 5.2 7.44 5.12 7.44V6.28C5.12 3.35 5.95 1.4 10 1.4C14.05 1.4 14.88 3.35 14.88 6.28V7.45C14.8 7.45 14.73 7.45 14.65 7.45H5.35V7.44Z",fill:"#037DD6"})),sfe=()=>fhe("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M16.4405 8.8999C20.0405 9.2099 21.5105 11.0599 21.5105 15.1099V15.2399C21.5105 19.7099 19.7205 21.4999 15.2505 21.4999H8.74047C4.27047 21.4999 2.48047 19.7099 2.48047 15.2399V15.1099C2.48047 11.0899 3.93047 9.2399 7.47047 8.9099",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M12 2V14.88",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M15.3504 12.6499L12.0004 15.9999L8.65039 12.6499",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}));function afe({version:e}){return fhe("div",{style:{textAlign:"center",color:"#BBC0C5",fontSize:"12"}},"SDK Version ",e?`v${e}`:"unknown")}const cfe=()=>fhe("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("rect",{width:"16",height:"16",fill:"white"}),fhe("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.40554 2.40554C2.94627 1.86482 3.82296 1.86482 4.36369 2.40554L8 6.04186L11.6363 2.40554C12.177 1.86482 13.0537 1.86482 13.5945 2.40554C14.1352 2.94627 14.1352 3.82296 13.5945 4.36369L9.95814 8L13.5945 11.6363C14.1352 12.177 14.1352 13.0537 13.5945 13.5945C13.0537 14.1352 12.177 14.1352 11.6363 13.5945L8 9.95814L4.36369 13.5945C3.82296 14.1352 2.94627 14.1352 2.40554 13.5945C1.86482 13.0537 1.86482 12.177 2.40554 11.6363L6.04186 8L2.40554 4.36369C1.86482 3.82296 1.86482 2.94627 2.40554 2.40554Z",fill:"#BBC0C5"})),lfe=()=>fhe("svg",{width:"273",height:"51",viewBox:"0 0 273 51",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M240.882 25.9263C239.472 24.997 237.916 24.3361 236.443 23.5101C235.489 22.9731 234.473 22.4982 233.643 21.8167C232.233 20.6602 232.524 18.3885 233.996 17.3973C236.112 15.993 239.617 16.7777 239.99 19.6483C239.99 19.7102 240.052 19.7515 240.114 19.7515H243.308C243.391 19.7515 243.454 19.6896 243.433 19.607C243.267 17.6244 242.5 15.9723 241.089 14.9191C239.741 13.9072 238.206 13.3702 236.568 13.3702C228.127 13.3702 227.359 22.271 231.901 25.0796C232.42 25.41 236.879 27.6404 238.455 28.611C240.032 29.5816 240.529 31.3576 239.845 32.7619C239.223 34.0423 237.605 34.9303 235.987 34.8271C234.224 34.7238 232.855 33.7738 232.378 32.2869C232.295 32.0185 232.254 31.5022 232.254 31.275C232.254 31.2131 232.192 31.1511 232.129 31.1511H228.666C228.604 31.1511 228.541 31.2131 228.541 31.275C228.541 33.7738 229.164 35.1575 230.864 36.4172C232.461 37.615 234.203 38.1106 236.008 38.1106C240.737 38.1106 243.184 35.4466 243.682 32.6793C244.117 29.974 243.308 27.5371 240.882 25.9263Z",fill:"#24292E"}),fhe("path",{d:"M90.4943 13.8246H88.9595H87.2795C87.2173 13.8246 87.1758 13.8659 87.1551 13.9072L84.3137 23.2416C84.2722 23.3655 84.1063 23.3655 84.0648 23.2416L81.2234 13.9072C81.2026 13.8452 81.1612 13.8246 81.0989 13.8246H79.419H77.8842H75.8102C75.748 13.8246 75.6857 13.8865 75.6857 13.9485V37.7802C75.6857 37.8422 75.748 37.9041 75.8102 37.9041H79.2738C79.336 37.9041 79.3982 37.8422 79.3982 37.7802V19.6689C79.3982 19.5244 79.6056 19.5037 79.6471 19.6276L82.5093 29.024L82.7167 29.6849C82.7374 29.7468 82.7789 29.7675 82.8411 29.7675H85.4959C85.5581 29.7675 85.5996 29.7262 85.6203 29.6849L85.8277 29.024L88.6899 19.6276C88.7313 19.4831 88.9387 19.5244 88.9387 19.6689V37.7802C88.9387 37.8422 89.001 37.9041 89.0632 37.9041H92.5268C92.589 37.9041 92.6513 37.8422 92.6513 37.7802V13.9485C92.6513 13.8865 92.589 13.8246 92.5268 13.8246H90.4943Z",fill:"#24292E"}),fhe("path",{d:"M187.849 13.8246C187.787 13.8246 187.745 13.8659 187.725 13.9072L184.883 23.2416C184.842 23.3655 184.676 23.3655 184.634 23.2416L181.793 13.9072C181.772 13.8452 181.731 13.8246 181.668 13.8246H176.4C176.338 13.8246 176.276 13.8865 176.276 13.9485V37.7802C176.276 37.8422 176.338 37.9041 176.4 37.9041H179.864C179.926 37.9041 179.988 37.8422 179.988 37.7802V19.6689C179.988 19.5244 180.196 19.5037 180.237 19.6276L183.099 29.024L183.307 29.6849C183.328 29.7468 183.369 29.7675 183.431 29.7675H186.086C186.148 29.7675 186.19 29.7262 186.211 29.6849L186.418 29.024L189.28 19.6276C189.322 19.4831 189.529 19.5244 189.529 19.6689V37.7802C189.529 37.8422 189.591 37.9041 189.653 37.9041H193.117C193.179 37.9041 193.241 37.8422 193.241 37.7802V13.9485C193.241 13.8865 193.179 13.8246 193.117 13.8246H187.849Z",fill:"#24292E"}),fhe("path",{d:"M143.174 13.8246H136.724H133.261H126.81C126.748 13.8246 126.686 13.8865 126.686 13.9485V16.9223C126.686 16.9843 126.748 17.0462 126.81 17.0462H133.136V37.7802C133.136 37.8422 133.198 37.9041 133.261 37.9041H136.724C136.786 37.9041 136.849 37.8422 136.849 37.7802V17.0462H143.174C143.237 17.0462 143.299 16.9843 143.299 16.9223V13.9485C143.299 13.8865 143.257 13.8246 143.174 13.8246Z",fill:"#24292E"}),fhe("path",{d:"M163.604 37.9041H166.756C166.839 37.9041 166.901 37.8215 166.881 37.7389L160.368 13.8245C160.347 13.7626 160.306 13.7419 160.244 13.7419H159.041H156.925H155.722C155.66 13.7419 155.619 13.7832 155.598 13.8245L149.085 37.7389C149.065 37.8215 149.127 37.9041 149.21 37.9041H152.362C152.425 37.9041 152.466 37.8628 152.487 37.8215L154.374 30.862C154.395 30.8 154.436 30.7794 154.499 30.7794H161.467C161.53 30.7794 161.571 30.8207 161.592 30.862L163.479 37.8215C163.5 37.8628 163.562 37.9041 163.604 37.9041ZM155.328 27.3719L157.859 18.0581C157.9 17.9342 158.066 17.9342 158.107 18.0581L160.638 27.3719C160.659 27.4545 160.596 27.5371 160.513 27.5371H155.453C155.37 27.5371 155.308 27.4545 155.328 27.3719Z",fill:"#24292E"}),fhe("path",{d:"M217.362 37.9041H220.515C220.598 37.9041 220.66 37.8215 220.639 37.7389L214.127 13.8245C214.106 13.7626 214.065 13.7419 214.002 13.7419H212.8H210.684H209.481C209.419 13.7419 209.377 13.7832 209.357 13.8245L202.844 37.7389C202.823 37.8215 202.886 37.9041 202.969 37.9041H206.121C206.183 37.9041 206.225 37.8628 206.246 37.8215L208.133 30.862C208.154 30.8 208.195 30.7794 208.257 30.7794H215.226C215.288 30.7794 215.33 30.8207 215.351 30.862L217.238 37.8215C217.259 37.8628 217.3 37.9041 217.362 37.9041ZM209.087 27.3719L211.617 18.0581C211.659 17.9342 211.825 17.9342 211.866 18.0581L214.397 27.3719C214.417 27.4545 214.355 27.5371 214.272 27.5371H209.211C209.129 27.5371 209.066 27.4545 209.087 27.3719Z",fill:"#24292E"}),fhe("path",{d:"M106.713 34.3727V26.9795C106.713 26.9176 106.775 26.8556 106.837 26.8556H116.067C116.129 26.8556 116.191 26.7936 116.191 26.7317V23.7579C116.191 23.6959 116.129 23.634 116.067 23.634H106.837C106.775 23.634 106.713 23.572 106.713 23.5101V17.1907C106.713 17.1288 106.775 17.0668 106.837 17.0668H117.332C117.394 17.0668 117.457 17.0049 117.457 16.9429V13.9691C117.457 13.9072 117.394 13.8452 117.332 13.8452H106.713H103.125C103.063 13.8452 103.001 13.9072 103.001 13.9691V17.0668V23.6546V26.8763V34.5173V37.7802C103.001 37.8422 103.063 37.9041 103.125 37.9041H106.713H117.768C117.83 37.9041 117.892 37.8422 117.892 37.7802V34.6412C117.892 34.5792 117.83 34.5173 117.768 34.5173H106.817C106.755 34.4966 106.713 34.4553 106.713 34.3727Z",fill:"#24292E"}),fhe("path",{d:"M272.532 37.6976L260.544 25.3687C260.502 25.3274 260.502 25.2448 260.544 25.2035L271.329 14.0517C271.412 13.9691 271.349 13.8452 271.246 13.8452H266.828C266.787 13.8452 266.766 13.8659 266.745 13.8865L257.599 23.3449C257.516 23.4275 257.391 23.3655 257.391 23.2623V13.9691C257.391 13.9072 257.329 13.8452 257.267 13.8452H253.803C253.741 13.8452 253.679 13.9072 253.679 13.9691V37.8009C253.679 37.8628 253.741 37.9248 253.803 37.9248H257.267C257.329 37.9248 257.391 37.8628 257.391 37.8009V27.3099C257.391 27.2067 257.536 27.1447 257.599 27.2273L267.969 37.8835C267.989 37.9041 268.031 37.9248 268.052 37.9248H272.469C272.552 37.9041 272.615 37.7596 272.532 37.6976Z",fill:"#24292E"}),fhe("path",{d:"M52.021 1L31.0526 16.4886L34.9517 7.36063L52.021 1Z",fill:"#E17726",stroke:"#E17726","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M3.65491 1L24.4366 16.6331L20.7241 7.36063L3.65491 1Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M44.4716 36.9127L38.8925 45.4211L50.8389 48.7047L54.261 37.0986L44.4716 36.9127Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M1.43555 37.0986L4.83695 48.7047L16.7626 45.4211L11.2042 36.9127L1.43555 37.0986Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M16.1197 22.5395L12.8013 27.5371L24.6232 28.074L24.2292 15.3734L16.1197 22.5395Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M39.5561 22.5394L31.3222 15.2288L31.0526 28.0739L42.8746 27.537L39.5561 22.5394Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M16.7626 45.4212L23.918 41.9724L17.7582 37.1813L16.7626 45.4212Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M31.7578 41.9724L38.8925 45.4212L37.9177 37.1813L31.7578 41.9724Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M38.8923 45.4212L31.7577 41.9724L32.3384 46.5983L32.2762 48.5602L38.8923 45.4212Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M16.7625 45.4212L23.3994 48.5602L23.3579 46.5983L23.9179 41.9724L16.7625 45.4212Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M23.5239 34.1249L17.5922 32.3902L21.7818 30.4696L23.5239 34.1249Z",fill:"#233447",stroke:"#233447","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M32.1517 34.1249L33.8939 30.4696L38.1042 32.3902L32.1517 34.1249Z",fill:"#233447",stroke:"#233447","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M16.7626 45.4212L17.7996 36.9128L11.2042 37.0987L16.7626 45.4212Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M37.8761 36.9128L38.8924 45.4212L44.4715 37.0987L37.8761 36.9128Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M42.8745 27.5371L31.0526 28.074L32.1518 34.1249L33.894 30.4696L38.1042 32.3902L42.8745 27.5371Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M17.5922 32.3902L21.7817 30.4696L23.5239 34.1249L24.6232 28.074L12.8012 27.5371L17.5922 32.3902Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M12.8013 27.5371L17.7582 37.1813L17.5923 32.3902L12.8013 27.5371Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M38.1044 32.3902L37.9177 37.1813L42.8746 27.5371L38.1044 32.3902Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M24.6232 28.0741L23.524 34.125L24.9136 41.2703L25.2247 31.8533L24.6232 28.0741Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M31.0526 28.0741L30.4719 31.8327L30.7623 41.2703L32.1519 34.125L31.0526 28.0741Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M32.1519 34.1249L30.7623 41.2702L31.7578 41.9724L37.9177 37.1813L38.1043 32.3901L32.1519 34.1249Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M17.5922 32.3901L17.7581 37.1813L23.918 41.9724L24.9135 41.2702L23.5239 34.1249L17.5922 32.3901Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M32.2763 48.5602L32.3385 46.5983L31.7993 46.1439H23.8765L23.358 46.5983L23.3995 48.5602L16.7626 45.4211L19.0855 47.3211L23.7935 50.5633H31.8615L36.5903 47.3211L38.8924 45.4211L32.2763 48.5602Z",fill:"#C0AC9D",stroke:"#C0AC9D","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M31.7578 41.9724L30.7622 41.2703H24.9135L23.918 41.9724L23.358 46.5983L23.8765 46.144H31.7993L32.3385 46.5983L31.7578 41.9724Z",fill:"#24292E",stroke:"#24292E","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M52.9128 17.5005L54.6757 8.95079L52.021 1L31.7578 15.9723L39.5561 22.5394L50.5692 25.7404L52.9958 22.9111L51.938 22.147L53.618 20.6188L52.3321 19.6276L54.0121 18.3472L52.9128 17.5005Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M1 8.95079L2.78366 17.5005L1.64295 18.3472L3.34365 19.6276L2.05775 20.6188L3.73771 22.147L2.67996 22.9111L5.10657 25.7404L16.1196 22.5394L23.918 15.9723L3.65475 1L1 8.95079Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M50.5692 25.7404L39.5561 22.5394L42.8746 27.5371L37.9177 37.1813L44.4716 37.0987H54.261L50.5692 25.7404Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M16.1196 22.5394L5.10651 25.7404L1.43549 37.0987H11.2041L17.7581 37.1813L12.8011 27.5371L16.1196 22.5394Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M31.0526 28.0741L31.7578 15.9724L34.9518 7.36072H20.7239L23.9179 15.9724L24.6231 28.0741L24.8927 31.8739L24.9135 41.2703H30.7622L30.783 31.8739L31.0526 28.0741Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}));function ufe(e,t){return e.toString(2).padStart(t,"0")}function dfe(e,t){const n=e%t;return n>=0?n:t+n}function hfe(e,t){return new Array(e).fill(t)}function ffe(...e){let t=0;for(const r of e)t=Math.max(t,r.length);const n=[];for(let r=0;r<t;r++)for(const t of e)r>=t.length||n.push(t[r]);return new Uint8Array(n)}function pfe(e,t,n){if(n<0||n+t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[n+r])return!1;return!0}function mfe(e){return{has:t=>e.includes(t),decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map(t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})},encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map(t=>{if(function(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]})}}}class gfe{static size(e,t){if("number"==typeof e&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw new Error(`Bitmap: wrong height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw new Error(`Bitmap: wrong width=${e.width} (${typeof e.width})`);return void 0!==t&&(e={width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}),e}static fromString(e){const t=(e=e.replace(/^\n+/g,"").replace(/\n+$/g,"")).split("\n"),n=t.length,r=new Array(n);let i;for(const o of t){const e=o.split("").map(e=>{if("X"===e)return!0;if(" "===e)return!1;if("?"!==e)throw new Error(`Bitmap.fromString: unknown symbol=${e}`)});if(i&&e.length!==i)throw new Error(`Bitmap.fromString different row sizes: width=${i} cur=${e.length}`);i=e.length,r.push(e)}return i||(i=0),new gfe({height:n,width:i},r)}constructor(e,t){const{height:n,width:r}=gfe.size(e);this.data=t||Array.from({length:n},()=>hfe(r,void 0)),this.height=n,this.width=r}point(e){return this.data[e.y][e.x]}isInside(e){return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};const{x:t,y:n}=this.xy(e);return{height:this.height-n,width:this.width-t}}xy(e){if("number"==typeof e&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw new Error(`Bitmap: wrong x=${e.x}`);if(!Number.isSafeInteger(e.y))throw new Error(`Bitmap: wrong y=${e.y}`);return e.x=dfe(e.x,this.width),e.y=dfe(e.y,this.height),e}rect(e,t,n){const{x:r,y:i}=this.xy(e),{height:o,width:s}=gfe.size(t,this.size({x:r,y:i}));for(let a=0;a<o;a++)for(let e=0;e<s;e++)this.data[i+a][r+e]="function"==typeof n?n({x:e,y:a},this.data[i+a][r+e]):n;return this}rectRead(e,t,n){return this.rect(e,t,(e,t)=>(n(e,t),t))}hLine(e,t,n){return this.rect(e,{width:t,height:1},n)}vLine(e,t,n){return this.rect(e,{width:1,height:t},n)}border(e=2,t){const n=this.height+2*e,r=this.width+2*e,i=hfe(e,t),o=Array.from({length:e},()=>hfe(r,t));return new gfe({height:n,width:r},[...o,...this.data.map(e=>[...i,...e,...i]),...o])}embed(e,t){return this.rect(e,t.size(),({x:e,y:n})=>t.data[n][e])}rectSlice(e,t=this.size()){const n=new gfe(gfe.size(t,this.size(this.xy(e))));return this.rect(e,t,({x:e,y:t},r)=>n.data[t][e]=r),n}inverse(){const{height:e,width:t}=this;return new gfe({height:t,width:e}).rect({x:0,y:0},1/0,({x:e,y:t})=>this.data[e][t])}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw new Error(`Wrong scale factor: ${e}`);const{height:t,width:n}=this;return new gfe({height:e*t,width:e*n}).rect({x:0,y:0},1/0,({x:t,y:n})=>this.data[Math.floor(n/e)][Math.floor(t/e)])}clone(){return new gfe(this.size()).rect({x:0,y:0},this.size(),({x:e,y:t})=>this.data[t][e])}assertDrawn(){this.rectRead(0,1/0,(e,t)=>{if("boolean"!=typeof t)throw new Error("Invalid color type="+typeof t)})}toString(){return this.data.map(e=>e.map(e=>void 0===e?"?":e?"X":" ").join("")).join("\n")}toASCII(){const{height:e,width:t,data:n}=this;let r="";for(let i=0;i<e;i+=2){for(let o=0;o<t;o++){const t=n[i][o],s=i+1>=e||n[i+1][o];t||s?!t&&s?r+="▀":t&&!s?r+="▄":t&&s&&(r+=" "):r+="█"}r+="\n"}return r}toTerm(){const e="",t=` ${e}`,n=` ${e}`;return this.data.map(e=>e.map(e=>e?n:t).join("")).join("\n")}toSVG(){let e=`<svg xmlns:svg="http://www.w3.org/2000/svg" viewBox="0 0 ${this.width} ${this.height}" version="1.1" xmlns="http://www.w3.org/2000/svg">`;return this.rectRead(0,1/0,({x:t,y:n},r)=>{r&&(e+=`<rect x="${t}" y="${n}" width="1" height="1" />`)}),e+="</svg>",e}toGIF(){const e=e=>[255&e,e>>>8&255],t=[...e(this.width),...e(this.height)],n=[];this.rectRead(0,1/0,(e,t)=>n.push(+(!0===t)));const r=126,i=[71,73,70,56,55,97,...t,246,0,0,255,255,255,...hfe(381,0),44,0,0,0,0,...t,0,7],o=Math.floor(n.length/r);for(let s=0;s<o;s++)i.push(127,128,...n.slice(r*s,r*(s+1)).map(e=>+e));return i.push(n.length%r+1,128,...n.slice(o*r).map(e=>+e)),i.push(1,129,0,59),new Uint8Array(i)}toImage(e=!1){const{height:t,width:n}=this.size(),r=new Uint8Array(t*n*(e?3:4));let i=0;for(let o=0;o<t;o++)for(let t=0;t<n;t++){const n=this.data[o][t]?0:255;r[i++]=n,r[i++]=n,r[i++]=n,e||(r[i++]=255)}return{height:t,width:n,data:r}}}const yfe=["low","medium","quartile","high"],bfe=["numeric","alphanumeric","byte","kanji","eci"],vfe=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],wfe={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]},Efe={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},_fe={size:{encode:e=>21+4*(e-1),decode:e=>(e-17)/4},sizeType:e=>Math.floor((e+7)/17),alignmentPatterns(e){if(1===e)return[];const t=_fe.size.encode(e)-6-1,n=t-6,r=Math.ceil(n/28);let i=Math.floor(n/r);i%2?i+=1:n%r*2>=r&&(i+=2);const o=[6];for(let s=1;s<r;s++)o.push(t-(r-s)*i);return o.push(t),o},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(e,t){const n=_fe.ECCode[e]<<3|t;let r=n;for(let i=0;i<10;i++)r=r<<1^1335*(r>>9);return(n<<10|r)^_fe.formatMask},versionBits(e){let t=e;for(let n=0;n<12;n++)t=t<<1^7973*(t>>11);return e<<12|t},alphabet:{numeric:mfe("0123456789"),alphanumerc:mfe("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits:(e,t)=>({numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]}[t][_fe.sizeType(e)]),modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(e,t){const n=vfe[e-1],r=wfe[t][e-1],i=Efe[t][e-1],o=Math.floor(n/i)-r,s=i-n%i;return{words:r,numBlocks:i,shortBlocks:s,blockLen:o,capacity:8*(n-r*i),total:(r+o)*i+i-s}}},xfe=[(e,t)=>(e+t)%2==0,(e,t)=>t%2==0,(e,t)=>e%3==0,(e,t)=>(e+t)%3==0,(e,t)=>(Math.floor(t/2)+Math.floor(e/3))%2==0,(e,t)=>e*t%2+e*t%3==0,(e,t)=>(e*t%2+e*t%3)%2==0,(e,t)=>((e+t)%2+e*t%3)%2==0],kfe={tables:(()=>{const e=hfe(256,0),t=hfe(256,0);for(let n=0,r=1;n<256;n++)e[n]=r,t[r]=n,r<<=1,256&r&&(r^=285);return{exp:e,log:t}})(),exp:e=>kfe.tables.exp[e],log(e){if(0===e)throw new Error(`GF.log: wrong arg=${e}`);return kfe.tables.log[e]%255},mul:(e,t)=>0===e||0===t?0:kfe.tables.exp[(kfe.tables.log[e]+kfe.tables.log[t])%255],add:(e,t)=>e^t,pow:(e,t)=>kfe.tables.exp[kfe.tables.log[e]*t%255],inv(e){if(0===e)throw new Error(`GF.inverse: wrong arg=${e}`);return kfe.tables.exp[255-kfe.tables.log[e]]},polynomial(e){if(0==e.length)throw new Error("GF.polymomial: wrong length");if(0!==e[0])return e;let t=0;for(;t<e.length-1&&0==e[t];t++);return e.slice(t)},monomial(e,t){if(e<0)throw new Error(`GF.monomial: wrong degree=${e}`);if(0==t)return[0];let n=hfe(e+1,0);return n[0]=t,kfe.polynomial(n)},degree:e=>e.length-1,coefficient:(e,t)=>e[kfe.degree(e)-t],mulPoly(e,t){if(0===e[0]||0===t[0])return[0];const n=hfe(e.length+t.length-1,0);for(let r=0;r<e.length;r++)for(let i=0;i<t.length;i++)n[r+i]=kfe.add(n[r+i],kfe.mul(e[r],t[i]));return kfe.polynomial(n)},mulPolyScalar(e,t){if(0==t)return[0];if(1==t)return e;const n=hfe(e.length,0);for(let r=0;r<e.length;r++)n[r]=kfe.mul(e[r],t);return kfe.polynomial(n)},mulPolyMonomial(e,t,n){if(t<0)throw new Error("GF.mulPolyMonomial: wrong degree");if(0==n)return[0];const r=hfe(e.length+t,0);for(let i=0;i<e.length;i++)r[i]=kfe.mul(e[i],n);return kfe.polynomial(r)},addPoly(e,t){if(0===e[0])return t;if(0===t[0])return e;let n=e,r=t;n.length>r.length&&([n,r]=[r,n]);let i=hfe(r.length,0),o=r.length-n.length,s=r.slice(0,o);for(let a=0;a<s.length;a++)i[a]=s[a];for(let a=o;a<r.length;a++)i[a]=kfe.add(n[a-o],r[a]);return kfe.polynomial(i)},remainderPoly(e,t){const n=Array.from(e);for(let r=0;r<e.length-t.length+1;r++){const e=n[r];if(0!==e)for(let i=1;i<t.length;i++)0!==t[i]&&(n[r+i]=kfe.add(n[r+i],kfe.mul(t[i],e)))}return n.slice(e.length-t.length+1,n.length)},divisorPoly(e){let t=[1];for(let n=0;n<e;n++)t=kfe.mulPoly(t,[1,kfe.pow(2,n)]);return t},evalPoly(e,t){if(0==t)return kfe.coefficient(e,0);let n=e[0];for(let r=1;r<e.length;r++)n=kfe.add(kfe.mul(t,n),e[r]);return n},euclidian(e,t,n){kfe.degree(e)<kfe.degree(t)&&([e,t]=[t,e]);let r=e,i=t,o=[0],s=[1];for(;2*kfe.degree(i)>=n;){let e=r,t=o;if(r=i,o=s,0===r[0])throw new Error("rLast[0] === 0");i=e;let n=[0];const a=kfe.inv(r[0]);for(;kfe.degree(i)>=kfe.degree(r)&&0!==i[0];){const e=kfe.degree(i)-kfe.degree(r),t=kfe.mul(i[0],a);n=kfe.addPoly(n,kfe.monomial(e,t)),i=kfe.addPoly(i,kfe.mulPolyMonomial(r,e,t))}if(n=kfe.mulPoly(n,o),s=kfe.addPoly(n,t),kfe.degree(i)>=kfe.degree(r))throw new Error(`Division failed r: ${i}, rLast: ${r}`)}const a=kfe.coefficient(s,0);if(0==a)throw new Error("sigmaTilde(0) was zero");const c=kfe.inv(a);return[kfe.mulPolyScalar(s,c),kfe.mulPolyScalar(i,c)]}};function Sfe(e,t,n,r){let i="",o=n.length;if("numeric"===r){const e=_fe.alphabet.numeric.decode(n.split("")),t=e.length;for(let n=0;n<t-2;n+=3)i+=ufe(100*e[n]+10*e[n+1]+e[n+2],10);t%3==1?i+=ufe(e[t-1],4):t%3==2&&(i+=ufe(10*e[t-2]+e[t-1],7))}else if("alphanumeric"===r){const e=_fe.alphabet.alphanumerc.decode(n.split("")),t=e.length;for(let n=0;n<t-1;n+=2)i+=ufe(45*e[n]+e[n+1],11);t%2==1&&(i+=ufe(e[t-1],6))}else{if("byte"!==r)throw new Error("encode: unsupported type");{const e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(n);o=e.length,i=Array.from(e).map(e=>ufe(e,8)).join("")}}const{capacity:s}=_fe.capacity(e,t),a=ufe(o,_fe.lengthBits(e,r));let c=_fe.modeBits[r]+a+i;if(c.length>s)throw new Error("Capacity overflow");c+="0".repeat(Math.min(4,Math.max(0,s-c.length))),c.length%8&&(c+="0".repeat(8-c.length%8));for(let u=0;c.length!==s;u++)c+="1110110000010001"[u%16];const l=Uint8Array.from(c.match(/(.{8})/g).map(e=>Number(`0b${e}`)));return function(e,t){const{words:n,shortBlocks:r,numBlocks:i,blockLen:o,total:s}=_fe.capacity(e,t),a=(c=n,{encode(e){const t=kfe.divisorPoly(c),n=Array.from(e);return n.push(...t.slice(0,-1).fill(0)),Uint8Array.from(kfe.remainderPoly(n,t))},decode(e){const t=e.slice(),n=kfe.polynomial(Array.from(e));let r=hfe(c,0),i=!1;for(let d=0;d<c;d++){const e=kfe.evalPoly(n,kfe.exp(d));r[r.length-1-d]=e,0!==e&&(i=!0)}if(!i)return t;r=kfe.polynomial(r);const o=kfe.monomial(c,1),[s,a]=kfe.euclidian(o,r,c),l=hfe(kfe.degree(s),0);let u=0;for(let c=1;c<256&&u<l.length;c++)0===kfe.evalPoly(s,c)&&(l[u++]=kfe.inv(c));if(u!==l.length)throw new Error("RS.decode: wrong errors number");for(let c=0;c<l.length;c++){const e=t.length-1-kfe.log(l[c]);if(e<0)throw new Error("RS.decode: wrong error location");const n=kfe.inv(l[c]);let r=1;for(let t=0;t<l.length;t++)c!==t&&(r=kfe.mul(r,kfe.add(1,kfe.mul(l[t],n))));t[e]=kfe.add(t[e],kfe.mul(kfe.evalPoly(a,n),kfe.inv(r)))}return t}});var c;return{encode(e){const t=[],n=[];for(let u=0;u<i;u++){const i=o+(u<r?0:1);t.push(e.subarray(0,i)),n.push(a.encode(e.subarray(0,i))),e=e.subarray(i)}const s=ffe(...t),c=ffe(...n),l=new Uint8Array(s.length+c.length);return l.set(s),l.set(c,s.length),l},decode(e){if(e.length!==s)throw new Error(`interleave.decode: len(data)=${e.length}, total=${s}`);const t=[];for(let s=0;s<i;s++){const e=s<r;t.push(new Uint8Array(n+o+(e?0:1)))}let c=0;for(let n=0;n<o;n++)for(let r=0;r<i;r++)t[r][n]=e[c++];for(let n=r;n<i;n++)t[n][o]=e[c++];for(let s=o;s<o+n;s++)for(let n=0;n<i;n++){const i=n<r;t[n][s+(i?0:1)]=e[c++]}const l=[];for(const r of t)l.push(...Array.from(a.decode(r)).slice(0,-n));return Uint8Array.from(l)}}}(e,t).encode(l)}function Cfe(e,t,n,r,i=!1){const o=function(e,t,n,r=!1){const i=_fe.size.encode(e);let o=new gfe(i+2);const s=new gfe(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);o=o.embed(0,s).embed({x:-s.width,y:0},s).embed({x:0,y:-s.height},s),o=o.rectSlice(1,i);const a=new gfe(1).rect(0,1,!0).border(1,!1).border(1,!0),c=_fe.alignmentPatterns(e);for(const l of c)for(const e of c)void 0===o.data[l][e]&&o.embed({x:e-2,y:l-2},a);o=o.hLine({x:0,y:6},1/0,({x:e},t)=>void 0===t?e%2==0:t).vLine({x:6,y:0},1/0,({y:e},t)=>void 0===t?e%2==0:t);{const e=_fe.formatBits(t,n),s=t=>!r&&1==(e>>t&1);for(let t=0;t<6;t++)o.data[t][8]=s(t);for(let t=6;t<8;t++)o.data[t+1][8]=s(t);for(let t=8;t<15;t++)o.data[i-15+t][8]=s(t);for(let t=0;t<8;t++)o.data[8][i-t-1]=s(t);for(let t=8;t<9;t++)o.data[8][15-t-1+1]=s(t);for(let t=9;t<15;t++)o.data[8][15-t-1]=s(t);o.data[i-8][8]=!r}if(e>=7){const t=_fe.versionBits(e);for(let e=0;e<18;e+=1){const n=!r&&1==(t>>e&1),s=Math.floor(e/3),a=e%3+i-8-3;o.data[s][a]=n,o.data[a][s]=n}}return o}(e,t,r,i);let s=0;const a=8*n.length;if(function(e,t,n){const r=e.height,i=xfe[t];let o=-1,s=r-1;for(let a=r-1;a>0;a-=2){for(6==a&&(a=5);;s+=o){for(let t=0;t<2;t+=1){const r=a-t;void 0===e.data[s][r]&&n(r,s,i(r,s))}if(s+o<0||s+o>=r)break}o=-o}}(o,r,(e,t,r)=>{let i=!1;s<a&&(i=!!(n[s>>>3]>>(7-s&7)&1),s++),o.data[t][e]=i!==r}),s!==a)throw new Error("QR: bytes left after draw");return o}function Ife(e){const t=e.inverse(),n=e=>{let t=0;for(let n,r=0,i=1;r<e.length;r++)n===e[r]&&(i++,r!==e.length-1)||(i>=5&&(t+=i-5+3),n=e[r],i=1);return t};let r=0;e.data.forEach(e=>r+=n(e)),t.data.forEach(e=>r+=n(e));let i=0,o=e.data;const s=e.width-1,a=e.height-1;for(let f=0;f<s;f++)for(let e=0;e<a;e++){const t=f+1,n=e+1;o[f][e]===o[t][e]&&o[t][e]===o[f][n]&&o[t][e]===o[t][n]&&(i+=3)}const c=e=>{const t=[!0,!1,!0,!0,!0,!1,!0],n=[!1,!1,!1,!1],r=[...t,...n],i=[...n,...t];let o=0;for(let s=0;s<e.length;s++)pfe(e,r,s)&&(o+=40),pfe(e,i,s)&&(o+=40);return o};let l=0;for(const f of e.data)l+=c(f);for(const f of t.data)l+=c(f);let u=0;e.rectRead(0,1/0,(e,t)=>u+=t?1:0);const d=u/(e.height*e.width)*100,h=10*Math.floor(Math.abs(d-50)/5);return r+i+l+h}function Afe(e,t="raw",n={}){const r=void 0!==n.ecc?n.ecc:"medium";!function(e){if(!yfe.includes(e))throw new Error(`Invalid error correction mode=${e}. Expected: ${yfe}`)}(r);const i=void 0!==n.encoding?n.encoding:function(e){let t="numeric";for(let n of e)if(!_fe.alphabet.numeric.has(n)&&(t="alphanumeric",!_fe.alphabet.alphanumerc.has(n)))return"byte";return t}(e);!function(e){if(!bfe.includes(e))throw new Error(`Encoding: invalid mode=${e}. Expected: ${bfe}`);if("kanji"===e||"eci"===e)throw new Error(`Encoding: ${e} is not supported (yet?).`)}(i),void 0!==n.mask&&function(e){if(![0,1,2,3,4,5,6,7].includes(e)||!xfe[e])throw new Error(`Invalid mask=${e}. Expected number [0..7]`)}(n.mask);let o,s=n.version,a=new Error("Unknown error");if(void 0!==s)!function(e){if(!Number.isSafeInteger(e)||e<1||e>40)throw new Error(`Invalid version=${e}. Expected number [1..40]`)}(s),o=Sfe(s,r,e,i);else for(let d=1;d<=40;d++)try{o=Sfe(d,r,e,i),s=d;break}catch(u){a=u}if(!s||!o)throw a;let c=function(e,t,n,r){if(void 0===r){const i=function(){let e,t=1/0;return{add(n,r){n>=t||(e=r,t=n)},get:()=>e,score:()=>t}}();for(let r=0;r<xfe.length;r++)i.add(Ife(Cfe(e,t,n,r,!0)),r);r=i.get()}if(void 0===r)throw new Error("Cannot find mask");return Cfe(e,t,n,r)}(s,r,o,n.mask);c.assertDrawn();const l=void 0===n.border?2:n.border;if(!Number.isSafeInteger(l))throw new Error("Wrong border type="+typeof l);if(c=c.border(l,!1),void 0!==n.scale&&(c=c.scale(n.scale)),"raw"===t)return c.data;if("ascii"===t)return c.toASCII();if("svg"===t)return c.toSVG();if("gif"===t)return c.toGIF();if("term"===t)return c.toTerm();throw new Error(`Unknown output: ${t}`)}const Pfe={DESKTOP:"Desktop",MOBILE:"Mobile",META_MASK_MOBILE_APP:"MetaMask mobile app",SCAN_TO_CONNECT:"Scan to connect and sign with",CONNECT_WITH_EXTENSION:"Connect With MetaMask Extension",INSTALL_MODAL:{TRUSTED_BY_USERS:"Trusted by over 30 million users to buy, store, send and swap crypto securely",LEADING_CRYPTO_WALLET:"The leading crypto wallet & gateway to blockchain apps built on Ethereum Mainnet, Polygon, Optimism, and many other networks",CONTROL_DIGITAL_INTERACTIONS:"Puts you in control of your digital interactions by making power of cryptography more accessible",INSTALL_META_MASK_EXTENSION:"Install MetaMask Extension"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Please open the MetaMask wallet app and select the code on the screen OR disconnect",OPEN_META_MASK_CONTINUE:"Open the MetaMask app to continue with your session.",NUMBER_AFTER_OPEN_NOTICE:"If a number doesn't appear after opening MetaMask, please click disconnect and re-scan the QRCode.",DISCONNECT:"Disconnect"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Take control of your crypto and explore the blockchain with the wallet trusted by over 30 million people worldwide"},META_MASK_MODAL:{ADDRESS_COPIED:"Address copied to clipboard!",DISCONNECT:"Disconnect",ACTIVE_NETWORK:"Active Network"}};class Mfe{constructor(e){var t;this.translations=Pfe,this.supportedLocales=["es","fr","he","it","pt","tr"],this.baseUrl=null!==(t=null==e?void 0:e.baseUrl)&&void 0!==t?t:"https://raw.githubusercontent.com/MetaMask/metamask-sdk/refs/heads/gh-pages/locales"}getBrowserLanguage(){if((navigator.languages||[navigator.language]).some(e=>e.toLowerCase().startsWith("en")))return"en";const e=navigator.language.toLowerCase().split("-")[0];return this.supportedLocales.includes(e)?e:"en"}async init(e){const t=this.getBrowserLanguage()||e.fallbackLng;await this.loadTranslations(t)}async loadTranslations(e){const t=e.split("-")[0];if("en"!==t&&this.supportedLocales.includes(t))try{const e=`${this.baseUrl}/${t}.json`,n=await fetch(e);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);this.translations=await n.json()}catch(n){console.warn(`❌ Failed to load ${t} translations, falling back to English:`,n),this.translations=Pfe}else this.translations=Pfe}t(e){return this.getNestedTranslation(e,this.translations)||e}getNestedTranslation(e,t){const n=e.split(".");let r=t;for(const i of n){if("object"!=typeof r)return"";r=r[i]}return"string"==typeof r?r:""}}var Ofe;!function(e){e.SDK_MODAL_VIEWED="sdk_modal_viewed",e.SDK_MODAL_BUTTON_CLICKED="sdk_modal_button_clicked",e.SDK_MODAL_TOGGLE_CHANGED="sdk_modal_toggle_changed"}(Ofe||(Ofe={}));const Tfe=class{constructor(e){$de(this,e),this.close=whe(this,"close"),this.startDesktopOnboarding=whe(this,"startDesktopOnboarding"),this.trackAnalytics=whe(this,"trackAnalytics"),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.onClose=this.onClose.bind(this),this.onStartDesktopOnboardingHandler=this.onStartDesktopOnboardingHandler.bind(this),this.setTab=this.setTab.bind(this),this.render=this.render.bind(this),this.setTab(this.preferDesktop?1:2),this.i18nInstance=new Mfe}componentDidLoad(){this.trackAnalytics.emit({event:Ofe.SDK_MODAL_VIEWED,params:{extensionInstalled:!1,tab:1===this.tab?"desktop":"mobile"}})}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}updatePreferDesktop(e){e?this.setTab(1):this.setTab(2)}onClose(e=!1){this.close.emit({shouldTerminate:e})}onStartDesktopOnboardingHandler(){this.trackAnalytics.emit({event:Ofe.SDK_MODAL_BUTTON_CLICKED,params:{button_type:"install_extension",tab:"desktop"}}),this.startDesktopOnboarding.emit()}setTab(e,t=!1){t&&this.trackAnalytics.emit({event:Ofe.SDK_MODAL_TOGGLE_CHANGED,params:{toggle:1===this.tab?"desktop_to_mobile":"mobile_to_desktop"}}),this.tab=e,this.isDefaultTab=!1}render(){if(!this.translationsLoaded)return null;const e=e=>this.i18nInstance.t(e),t=this.isDefaultTab?this.preferDesktop?1:2:this.tab,n=Afe(this.link,"svg",{ecc:"medium",scale:2});return fhe(tfe,{className:"install-model"},fhe("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),fhe("div",{class:"modal"},fhe("div",{class:"closeButtonContainer"},fhe("div",{class:"right"},fhe("span",{class:"closeButton",onClick:()=>this.onClose(!0)},fhe(cfe,null)))),fhe("div",{class:"logoContainer"},fhe(lfe,null)),fhe("div",null,fhe("div",{class:"tabcontainer"},fhe("div",{class:"flexContainer"},fhe("div",{onClick:()=>this.setTab(1,!0),class:"tab flexItem "+(1===t?"tabactive":"")},e("DESKTOP")),fhe("div",{onClick:()=>this.setTab(2,!0),class:"tab flexItem "+(2===t?"tabactive":"")},e("MOBILE")))),fhe("div",{style:{display:1===t?"none":"block"}},fhe("div",{class:"flexContainer"},fhe("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},n&&fhe("div",{id:"sdk-mm-qrcode",class:"center",innerHTML:n}),fhe("div",{class:"connectMobileText"},e("SCAN_TO_CONNECT")," ",fhe("br",null),fhe("span",{class:"blue"},fhe("b",null,e("META_MASK_MOBILE_APP"))))))),fhe("div",{style:{display:2===t?"none":"block"}},fhe("div",{class:"item"},fhe(nfe,{Icon:ife,text:e("INSTALL_MODAL.TRUSTED_BY_USERS")})),fhe("div",{class:"item"},fhe(nfe,{Icon:rfe,text:e("INSTALL_MODAL.LEADING_CRYPTO_WALLET")})),fhe("div",{class:"item"},fhe(nfe,{Icon:ofe,text:e("INSTALL_MODAL.CONTROL_DIGITAL_INTERACTIONS")})),fhe("button",{class:"button",onClick:()=>this.onStartDesktopOnboardingHandler()},fhe(sfe,null),fhe("span",{class:"installExtensionText"},e("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION"))))),fhe(afe,{version:this.sdkVersion})))}get el(){return vhe(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Tfe.style=".flexContainer {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.flexItem {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem11 {\n flex: 11;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem1 {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.tab {\n padding: 8px;\n cursor: pointer;\n background-color: #F2F4F6;\n font-size: 12px;\n text-align: center;\n color: #24292E;\n}\n\n.tabcontainer {\n padding: 4px;\n background-color: #F2F4F6;\n border-radius: 8px;\n margin-bottom: 30px;\n margin-top: 30px;\n}\n\n.tabactive {\n background-color: white;\n -webkit-transition: background-color 300ms linear;\n -ms-transition: background-color 300ms linear;\n transition: background-color 300ms linear;\n border-radius: 8px;\n}\n\n.item {\n font-size: 12px;\n margin-bottom: 16px;\n border-radius: 8px;\n padding: 10px;\n border: 2px #F2F4F6 solid;\n color: #24292E;\n}\n\n.extensionLabel {\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n text-align: cetner;\n color: #24272A;\n}\n\n.notice {\n font-size: 12px;\n margin-left: 10px;\n margin-right: 10px;\n color: grey;\n}\n\n.button {\n margin-top: 41.5px;\n margin-bottom: 20px;\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 12px 20px;\n background: #037DD6;\n border-radius: 32px;\n color: white;\n border: 0;\n font-size: 14px;\n cursor: pointer;\n}\n\n.backdrop {\n visibility: visible;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n z-index: 99998;\n background: rgba(0, 0, 0, 0.87);\n opacity: 0.3;\n}\n\n.modal {\n visibility: visible;\n position: fixed;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99999;\n background: white;\n padding: 20px;\n border-radius: 8px;\n top: 50%;\n max-width: 100%;\n width: 460px;\n min-width: 300px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n color: #BBC0C5;\n cursor: pointer;\n}\n\n.logoContainer {\n margin-left: 24px;\n margin-right: 24px;\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.connectMobileText {\n font-size: 14px;\n color: black;\n margin-top: 28px;\n margin-bottom: 28px;\n line-height: 2;\n}\n\n.blue {\n color: #037DD6;\n font-weight: 700;\n}\n\n.installExtensionText {\n margin-left: 10px;\n}\n\n.center {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.right {\n display: flex;\n align-items: center;\n justify-content: right;\n}\n\n#sdk-mm-qrcode {\n svg {\n width: 50%;\n }\n}";const Rfe=class{constructor(e){$de(this,e),this.close=whe(this,"close"),this.disconnect=whe(this,"disconnect"),this.updateOTPValue=whe(this,"updateOTPValue"),this.displayOTP=void 0,this.sdkVersion=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new Mfe}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(){this.close.emit()}onDisconnect(){this.disconnect.emit()}onUpdateOTPValueHandler(e){this.updateOTPValue.emit({otpValue:e})}disconnectedCallback(){this.onClose()}render(){var e;if(!this.translationsLoaded)return null;const t=null===(e=this.displayOTP)||void 0===e||e,n=this.sdkVersion,r=e=>this.i18nInstance.t(e);return fhe(tfe,{className:"pending-modal"},fhe("div",{class:"backdrop",onClick:()=>this.onClose()}),fhe("div",{class:"modal"},fhe("div",{class:"closeButtonContainer"},fhe("div",{class:"right"},fhe("span",{class:"closeButton",onClick:()=>this.onClose()},fhe(cfe,null)))),fhe("div",{class:"logoContainer"},fhe(lfe,null)),fhe("div",null,fhe("div",{class:"flexContainer",style:{flexDirection:"column",color:"black"}},fhe("div",{class:"flexItem",style:{textAlign:"center",marginTop:"30px",marginBottom:"30px",fontSize:"16px"}},r(t?"PENDING_MODAL.OPEN_META_MASK_SELECT_CODE":"PENDING_MODAL.OPEN_META_MASK_CONTINUE")),fhe("div",{id:"sdk-mm-otp-value",style:{padding:"10px",fontSize:"32px",display:this.otpCode?"block":"none"}},this.otpCode),t&&fhe("div",{class:"notice"},"* ",r("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))),fhe("div",{style:{marginTop:"20px"}},fhe("button",{class:"button blue",style:{marginTop:"5px",color:"#0376C9",borderColor:"#0376C9",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white"},onClick:()=>this.onDisconnect()},r("PENDING_MODAL.DISCONNECT")))),fhe(afe,{version:n})))}get el(){return vhe(this)}};Rfe.style=".flexContainer {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.flexItem {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem11 {\n flex: 11;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem1 {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.tab {\n padding: 8px;\n cursor: pointer;\n background-color: #F2F4F6;\n font-size: 12px;\n text-align: center;\n color: #24292E;\n}\n\n.tabcontainer {\n padding: 4px;\n background-color: #F2F4F6;\n border-radius: 8px;\n margin-bottom: 30px;\n margin-top: 30px;\n}\n\n.tabactive {\n background-color: white;\n -webkit-transition: background-color 300ms linear;\n -ms-transition: background-color 300ms linear;\n transition: background-color 300ms linear;\n border-radius: 8px;\n}\n\n.item {\n font-size: 12px;\n margin-bottom: 16px;\n border-radius: 8px;\n padding: 10px;\n border: 2px #F2F4F6 solid;\n color: #24292E;\n}\n\n.extensionLabel {\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n text-align: cetner;\n color: #24272A;\n}\n\n.notice {\n font-size: 12px;\n margin-left: 10px;\n margin-right: 10px;\n color: grey;\n}\n\n.button {\n margin-top: 41.5px;\n margin-bottom: 20px;\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 12px 20px;\n background: #037DD6;\n border-radius: 32px;\n color: white;\n border: 0;\n font-size: 14px;\n cursor: pointer;\n}\n\n.backdrop {\n visibility: visible;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n z-index: 99998;\n background: rgba(0, 0, 0, 0.87);\n opacity: 0.3;\n}\n\n.modal {\n visibility: visible;\n position: fixed;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99999;\n background: white;\n padding: 20px;\n border-radius: 8px;\n top: 50%;\n max-width: 100%;\n width: 460px;\n min-width: 300px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n color: #BBC0C5;\n cursor: pointer;\n}\n\n.logoContainer {\n margin-left: 24px;\n margin-right: 24px;\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.connectMobileText {\n font-size: 14px;\n color: black;\n margin-top: 28px;\n margin-bottom: 28px;\n line-height: 2;\n}\n\n.blue {\n color: #037DD6;\n font-weight: 700;\n}\n\n.installExtensionText {\n margin-left: 10px;\n}\n\n.center {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.right {\n display: flex;\n align-items: center;\n justify-content: right;\n}\n\n#sdk-mm-qrcode {\n svg {\n width: 50%;\n }\n}";const Nfe=()=>fhe("svg",{width:"21",height:"15",viewBox:"0 0 21 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M14.1364 14.9851C13.5909 14.9851 13.2273 14.5851 13.2273 13.9851C13.2273 13.3851 13.5909 12.9851 14.1364 12.9851C16.6818 12.9851 18.6818 10.7851 18.6818 7.98508C18.6818 5.18508 16.6818 2.98508 14.1364 2.98508C11.5909 2.98508 9.59091 5.18508 9.59091 7.98508C9.59091 8.58508 9.22727 8.98508 8.68182 8.98508C8.13636 8.98508 7.77273 8.58508 7.77273 7.98508C7.77273 4.08508 10.5909 0.985077 14.1364 0.985077C17.6818 0.985077 20.5 4.08508 20.5 7.98508C20.5 11.8851 17.6818 14.9851 14.1364 14.9851ZM6.68182 14.7851C3.22727 14.7851 0.5 11.6851 0.5 7.98508C0.5 4.28508 3.22727 1.18508 6.68182 1.18508C7.22727 1.18508 7.59091 1.58508 7.59091 2.18508C7.59091 2.78508 7.22727 3.18508 6.68182 3.18508C4.22727 3.18508 2.31818 5.38508 2.31818 7.98508C2.31818 10.5851 4.22727 12.7851 6.68182 12.7851C9.13636 12.7851 11.0455 10.6851 11.0455 7.98508C11.0455 7.38508 11.4091 6.98508 11.9545 6.98508C12.5 6.98508 12.8636 7.38508 12.8636 7.98508C12.7727 11.6851 10.0455 14.7851 6.68182 14.7851Z",fill:"white"})),Lfe=()=>fhe("svg",{width:"400",height:"300",viewBox:"0 0 467 300",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M312.387 280.629C312.549 280.583 312.247 280.735 312.387 280.629L339.678 260.425C340.088 260.118 340.132 259.156 340.07 258.647C340.008 258.138 339.573 258.257 339.106 258.084L311.712 247.455C311.292 247.301 311.308 247.402 310.939 247.673C310.569 247.944 310.356 248.21 310.356 248.672L310.459 279.504C310.461 280.025 311.163 280.619 311.614 280.847C311.913 280.996 312.072 280.718 312.387 280.629ZM336.204 259.736L312.979 276.292L313.439 251.139L336.204 259.736Z",fill:"url(#paint0_linear_1356_14057)"}),fhe("path",{d:"M324.639 260.342C324.358 259.547 323.485 258.91 322.707 259.215C319.6 260.432 318.17 262.313 317.287 264.066C316.482 265.665 316.197 267.482 314.188 268.269C312.178 269.055 310.763 268.663 309.162 268.007C307.406 267.287 305.504 266.182 302.397 267.399C299.289 268.616 297.859 270.497 296.976 272.25C296.171 273.849 295.697 274.886 293.685 275.673C291.675 276.459 290.261 276.067 288.659 275.411C286.903 274.691 284.999 273.587 281.894 274.803C278.789 276.019 277.549 278.681 276.666 280.434C275.861 282.034 275.386 283.07 273.374 283.857C272.596 284.161 271.931 285.055 272.211 285.849C272.492 286.644 273.365 287.281 274.143 286.977C277.25 285.76 278.68 283.879 279.563 282.125C280.368 280.526 280.65 278.71 282.662 277.923C284.672 277.136 286.087 277.528 287.688 278.184C289.444 278.904 291.348 280.009 294.453 278.793C297.561 277.576 298.991 275.695 299.874 273.941C300.679 272.342 301.153 271.306 303.165 270.519C305.175 269.732 306.589 270.124 308.191 270.78C309.947 271.5 311.849 272.605 314.956 271.388C318.063 270.172 319.301 267.511 320.184 265.757C320.989 264.158 321.466 263.121 323.476 262.335C324.254 262.032 324.919 261.137 324.639 260.342Z",fill:"url(#paint1_linear_1356_14057)"}),fhe("path",{d:"M389.034 111.124C388.968 112.406 387.342 113.113 386.324 113.549C384.297 114.419 382.089 114.493 379.942 114.5C376.607 114.509 373.215 114.163 369.89 113.976C366.712 113.798 363.156 113.311 360.03 114.232C357.705 114.919 355.667 116.762 353.452 117.739C351.129 118.765 348.957 119.198 346.489 119.687C335.569 121.85 323.587 120.825 312.656 119.977C311.92 119.92 312.539 118.997 313.237 118.981C313.207 118.815 313.001 118.394 313.045 118.201C313.086 118.029 312.781 117.586 312.853 117.421C312.67 117.198 313.316 117.427 313.626 117.204C315.912 115.557 318.721 114.79 321.363 115.041C324.677 115.355 327.293 116.04 330.641 115.781C334.392 115.491 338.125 114.787 341.857 114.312C345.142 113.892 349.09 113.941 352.106 112.28C352.916 111.834 353.137 111.262 353.269 110.287C353.331 109.828 353.672 108.969 353.658 108.511C353.629 107.529 354.191 107.886 355.013 107.298C356.857 105.981 358.274 105.516 360.428 105.784C362.841 106.083 365.264 107.273 367.578 107.953C370.761 108.888 374.328 108.646 377.631 108.477C380.517 108.329 383.141 107.901 385.944 108.653C387.013 108.941 389.104 109.745 389.034 111.124Z",fill:"url(#paint2_linear_1356_14057)"}),fhe("path",{d:"M278.118 85.4414C280.313 83.8186 283.302 83.9 285.853 83.2728C290.501 82.127 295.644 78.4476 300.549 79.1524C301.299 79.2595 300.904 81.0355 300.159 80.9295C300.131 80.9256 300.187 80.9333 300.159 80.9295C300.089 81.0185 299.516 81.1051 299.385 81.1463C294.999 82.515 292.895 87.5083 289.126 89.8598C287.799 90.688 286.771 90.8351 285.258 90.9441C283.515 91.0691 280.964 90.5775 279.269 90.1219C277.15 89.5532 275.965 87.034 278.118 85.4414Z",fill:"url(#paint3_linear_1356_14057)"}),fhe("path",{d:"M122.567 166.093C113.597 172.832 104.535 179.836 99.517 190.092C98.5342 192.099 97.519 195.019 97.9533 197.204C98.9699 202.316 105.76 203.049 110.691 201.96C113.468 201.347 116.325 199.231 115.921 196.319C115.576 193.81 113.158 192.986 112.072 190.73C110.779 188.04 112.35 184.97 114.218 182.62C128.134 165.099 150.074 157.394 171.093 151.607C175.385 150.425 180.897 147.69 180.581 143.099C180.372 140.072 177.118 137.683 174.221 137.383C171.324 137.082 168.481 138.773 165.715 139.776C158.416 142.419 151.17 143.799 143.489 143.526C136.865 143.29 130.976 143.316 129.562 150.781C128.138 158.276 129.53 160.863 122.567 166.093Z",fill:"url(#paint4_linear_1356_14057)"}),fhe("path",{d:"M79.1056 153.531C60.3932 164.378 43.7478 178.354 32.8214 197.415C30.3313 201.76 27.9216 206.554 27.1821 211.512C26.4448 216.47 27.7591 222.525 30.8133 226.337C34.908 231.446 41.6938 232.915 48.1811 233.125C50.7248 233.208 53.0035 233.066 55.3316 231.947C57.6602 230.83 59.7548 228.359 59.5978 225.742C59.3303 221.315 54.5491 219.665 50.9271 217.34C42.6566 212.037 40.4958 199.493 44.2381 190.032C47.9803 180.57 55.8228 173.173 63.2316 166.338C67.229 162.651 71.5194 158.372 76.777 157.522C79.9167 157.015 83.4706 157.589 86.6295 157.252C93.9004 156.479 99.64 151.404 105.588 146.912C115.048 139.765 126.045 134.283 137.501 132.093C141.913 131.248 146.293 130.493 149.682 127.831C151.37 126.507 150.803 123.567 148.726 123.93C138.542 125.713 128.652 131.135 119.142 134.758C105.627 139.914 91.7133 146.223 79.1056 153.531Z",fill:"url(#paint5_linear_1356_14057)"}),fhe("path",{d:"M96.3677 117.321C96.0315 116.64 95.2914 116.612 94.6293 116.975C91.9858 118.417 91.5452 120.509 90.9466 122.178C90.4004 123.702 89.3647 124.67 87.6542 125.604C85.9437 126.538 85.0983 126.316 83.5956 125.91C81.9481 125.465 79.8603 125.424 77.2168 126.866C74.5734 128.309 74.1348 130.401 73.5341 132.07C72.9879 133.593 71.9522 134.562 70.2417 135.496C68.5313 136.43 67.6859 136.208 66.1832 135.801C64.5357 135.357 62.2569 134.538 59.6128 135.978C56.9694 137.42 56.5308 139.512 55.9301 141.181C55.3839 142.705 54.5398 144.454 52.8293 145.388C52.1667 145.748 52.1006 146.485 52.439 147.165C52.7752 147.845 53.5153 147.874 54.1773 147.511C56.8208 146.069 57.2594 143.977 57.86 142.307C58.4062 140.784 59.4419 139.815 61.1524 138.881C62.8629 137.948 63.7083 138.17 65.211 138.576C66.8585 139.021 68.9458 139.059 71.5898 137.619C74.2333 136.177 74.6718 134.085 75.2725 132.416C75.8187 130.892 76.8544 129.924 78.5649 128.99C80.2754 128.056 81.1207 128.278 82.6235 128.684C84.2709 129.129 86.5503 129.95 89.1938 128.507C91.8373 127.065 92.2779 124.973 92.8765 123.304C93.4227 121.78 94.2663 120.03 95.9773 119.098C96.6378 118.738 96.7039 118.001 96.3677 117.321Z",fill:"#FBC49D"}),fhe("path",{d:"M391.827 164.699C392.04 164.639 392.39 164.573 392.6 164.481C393.87 163.921 395.363 162.429 395.893 161.051C396.421 159.673 396.237 158.321 395.712 156.931C394.629 154.061 391.777 152.62 389.155 153.775C386.531 154.931 384.962 158.455 386.042 161.325C387.038 163.963 389.369 165.392 391.827 164.699ZM394.166 157.367C394.529 158.332 394.52 159.751 394.156 160.706C393.792 161.662 393.1 162.534 392.218 162.921C390.398 163.723 388.338 162.878 387.589 160.889C387.226 159.925 387.234 158.506 387.599 157.55C387.963 156.594 388.654 155.723 389.536 155.336C391.356 154.534 393.416 155.376 394.166 157.367Z",fill:"#86E29B"}),fhe("path",{d:"M62.7198 108.691C64.4912 108.191 66.6152 106.609 67.5596 104.824C68.4273 103.187 68.465 101.455 67.9609 99.7066C67.4547 97.9586 66.0792 96.5141 64.4963 95.6786C62.9135 94.843 61.2077 94.8578 59.4756 95.4255C57.7435 95.9933 56.2768 97.4364 55.409 99.074C53.6185 102.456 55.2032 106.494 58.4723 108.22C60.0142 109.035 61.1315 109.138 62.7198 108.691ZM60.6304 96.7682C61.819 96.4332 63.0232 96.8871 64.1048 97.4571C65.2463 98.0603 66.0495 98.8796 66.4145 100.142C66.7791 101.403 66.4488 103.299 65.8224 104.48C64.5299 106.919 61.2212 107.686 58.8638 106.441C56.5063 105.197 55.8538 101.858 57.1462 99.4185C57.7726 98.2375 58.6059 97.3957 59.8573 96.9862C59.9214 96.9635 60.5631 96.7872 60.6304 96.7682Z",fill:"#FFB0EB"}),fhe("path",{d:"M77.0217 242.979C75.9542 243.28 75.1664 242.151 74.9029 241.074C74.6394 239.996 75 239.378 76.0676 239.077C77.1351 238.776 78.5053 238.907 78.7688 239.984C79.0323 241.061 78.0893 242.678 77.0217 242.979Z",fill:"url(#paint6_linear_1356_14057)"}),fhe("path",{d:"M380.506 184.577C379.439 184.878 378.651 183.749 378.387 182.672C378.124 181.594 378.484 180.976 379.552 180.675C380.619 180.374 381.99 180.505 382.253 181.582C382.517 182.659 381.574 184.276 380.506 184.577Z",fill:"url(#paint7_linear_1356_14057)"}),fhe("path",{d:"M348.82 246.969C347.752 247.27 346.382 247.14 346.119 246.063C345.855 244.985 346.798 243.369 347.866 243.068C348.933 242.767 349.721 243.896 349.985 244.973C350.248 246.05 349.888 246.669 348.82 246.969Z",fill:"url(#paint8_linear_1356_14057)"}),fhe("path",{d:"M140.419 282.412C139.351 282.713 138.754 282.365 138.491 281.288C138.227 280.21 138.397 278.812 139.464 278.511C140.532 278.21 142.093 279.121 142.357 280.198C142.62 281.275 141.486 282.111 140.419 282.412Z",fill:"url(#paint9_linear_1356_14057)"}),fhe("path",{d:"M121.462 101.679C120.395 101.979 119.798 101.631 119.534 100.554C119.271 99.4764 119.44 98.0779 120.508 97.777C121.575 97.4761 123.136 98.3868 123.4 99.4642C123.663 100.542 122.53 101.378 121.462 101.679Z",fill:"url(#paint10_linear_1356_14057)"}),fhe("path",{d:"M370.749 159.005C369.682 159.306 368.311 159.175 368.048 158.098C367.784 157.021 368.727 155.404 369.795 155.103C370.863 154.802 371.65 155.931 371.914 157.008C372.177 158.086 371.817 158.704 370.749 159.005Z",fill:"url(#paint11_linear_1356_14057)"}),fhe("path",{d:"M384.211 245.345C383.143 245.646 381.773 245.515 381.51 244.438C381.246 243.361 382.189 241.744 383.257 241.443C384.324 241.142 385.112 242.271 385.376 243.348C385.639 244.426 385.278 245.044 384.211 245.345Z",fill:"url(#paint12_linear_1356_14057)"}),fhe("path",{d:"M364.771 41.3873C363.063 41.8687 361.337 40.8616 360.915 39.1378C360.493 37.414 361.536 35.6263 363.244 35.1449C364.953 34.6634 366.679 35.6706 367.101 37.3944C367.522 39.1182 366.479 40.9059 364.771 41.3873Z",fill:"url(#paint13_linear_1356_14057)"}),fhe("path",{d:"M404.311 77.905C404.602 77.8231 404.875 77.9236 405.084 77.6871C405.437 77.2908 404.814 76.6385 404.703 76.1265L401.277 58.7418C401.149 58.163 400.687 57.5371 400.123 57.3991C399.558 57.2611 398.969 57.3812 398.576 57.835L385.784 73.1179C385.395 73.564 385.199 74.3453 385.393 74.8964C385.585 75.4481 385.978 76.1646 386.548 76.2391L403.538 78.123C403.744 78.1479 404.114 77.9607 404.311 77.905ZM398.948 62.7348L401.811 74.4394L389.841 72.8085L398.948 62.7348Z",fill:"#FFB0EB"}),fhe("path",{d:"M97.5393 295.311C97.7108 295.263 97.4284 295.461 97.5393 295.311L108.785 280.464C108.975 280.211 108.718 279.972 108.594 279.684C108.47 279.396 108.124 279.917 107.821 279.902L88.5106 278.672C88.2101 278.659 87.895 278.62 87.7374 278.89C87.5798 279.159 87.7755 279.402 87.9283 279.67L96.5753 294.749C96.7102 294.99 97.2696 295.297 97.5393 295.311C97.6283 295.319 97.4556 295.335 97.5393 295.311ZM106.465 281.118L96.9667 292.97L90.6295 280.577L106.465 281.118Z",fill:"#86E29B"}),fhe("path",{d:"M393.699 108.848C389.518 104.446 414.629 114.366 413.945 120.659C413.259 126.952 401.355 129.102 403.894 123.491C406.042 118.747 400.376 115.876 393.699 108.848Z",fill:"#FBC49D"}),fhe("path",{d:"M139.414 115.959C139.434 115.953 139.392 115.965 139.414 115.959C141.963 115.2 143.436 111.976 142.717 109.189C142.37 107.839 141.526 107.199 140.408 106.504C139.289 105.808 138.171 105.449 136.933 105.815C135.698 106.182 134.85 107.033 134.222 108.247C133.595 109.461 133.282 111.234 133.63 112.585C133.978 113.935 134.821 114.574 135.94 115.27C137.04 115.952 138.199 116.301 139.414 115.959ZM137.315 107.375C138.222 107.12 139.005 106.994 139.825 107.502C140.661 108.02 140.912 108.618 141.171 109.625C141.708 111.704 140.935 113.834 139.032 114.398C138.11 114.675 137.356 114.791 136.522 114.272C135.686 113.753 135.436 113.155 135.176 112.149C134.917 111.142 134.718 109.714 135.186 108.81C135.654 107.905 136.394 107.649 137.315 107.375C137.329 107.371 137.299 107.38 137.315 107.375Z",fill:"#75C4FD"}),fhe("path",{d:"M308.981 78.7519C310.052 78.4043 311.158 78.7096 312.265 78.6613C313.655 78.6006 314.936 78.517 316.323 78.3531C319.497 77.9795 322.798 77.4906 325.984 77.3012C329.309 77.1025 332.514 76.8551 335.836 77.0295C338.809 77.1842 342.163 77.3405 345.105 77.7558C352.129 78.7468 359.331 79.0578 366.347 80.1158C372.252 81.008 377.93 82.1319 383.722 83.5644C385.925 84.0054 388.267 85.0754 389.126 85.3792C389.421 85.4833 389.37 85.8347 389.317 86.1595C389.306 86.2271 389.353 86.1146 389.317 86.1595C388.269 87.414 386.564 86.8124 385.259 86.4677C384.406 86.241 381.488 85.9494 381.011 85.9957C380.14 86.0815 379.277 86.014 379.656 87.2114C380.122 88.6824 382.391 89.7375 383.704 90.2419C385.883 91.0803 388.771 91.2561 390.845 92.4015C392.968 92.821 395.425 93.5002 397.022 93.9986C402.83 95.8103 407.806 98.8678 413.033 102.002C415.503 103.482 417.829 104.764 419.973 106.72C421.647 108.248 423.771 109.882 424.595 112.091C425.113 113.482 424.451 115.471 422.848 115.085C420.353 114.488 419.638 111.665 418.227 109.714C415.003 105.251 410.067 102.067 405.118 100.06C402.64 99.0556 399.803 98.729 397.204 98.1176C394.411 97.4613 391.597 97.0442 388.707 97.1736C385.646 97.3097 382.846 97.5534 379.819 98.0078C377.027 98.4264 374.252 98.4441 371.514 97.8441C368.766 97.2421 366.276 96.7553 363.6 95.9021C361.662 95.2848 359.013 94.5583 357.232 93.5247C355.699 92.6339 355.631 91.2381 357.241 90.186C359.87 88.4656 362.778 89.8021 365.546 90.3497C365.561 90.3527 365.532 90.3468 365.546 90.3497C367.858 90.804 369.649 90.098 371.923 89.3884C372.489 89.2128 373.255 89.0482 373.47 88.953C374.383 88.5432 375.895 87.8227 375.407 86.7394C374.868 85.5457 372.659 84.8846 371.55 84.4891C369.74 83.8428 368.053 82.9215 366.147 82.6743C365.654 82.6095 365.109 83.1606 364.6 83.1097C363.36 83.1121 361.769 83.348 360.543 83.418C357.43 83.5916 354.583 83.6228 351.464 83.4719C348.714 83.3377 346.432 82.8542 343.741 82.3102C340.773 81.7101 337.52 81.5879 334.471 81.5839C331.393 81.5811 328.6 81.7214 325.583 82.4181C322.758 83.0702 319.757 83.6198 316.887 84.0326C314.698 84.3481 312.467 84.6054 310.319 84.2137C309.079 83.9871 306.994 83.3394 306.461 81.9635C305.846 80.3659 307.736 79.1556 308.981 78.7519Z",fill:"url(#paint14_linear_1356_14057)"}),fhe("path",{d:"M242.269 242.95C242.295 242.947 242.244 242.955 242.269 242.95C244.934 242.606 247.53 241.858 250.2 241.574C253.133 241.264 256.006 240.56 258.906 239.982C263.26 239.117 268.026 238.52 272.254 237.097C274.429 236.365 276.067 235.298 278.251 234.592C280.361 233.909 283.058 233.12 285.216 232.652C289.317 231.764 293.049 231.66 297.016 230.198C301.109 228.69 305.088 226.673 308.819 224.409C312.645 222.086 316.282 219.769 320.622 218.62C322.381 218.154 323.919 218.219 325.65 218.886C327.016 219.413 327.739 220.337 327.196 221.79C326.557 223.504 324.659 224.7 323.131 225.423C320.854 226.5 319.53 227.184 317.134 227.927C314.619 228.707 311.888 229.24 309.395 230.083C308.226 230.947 307.17 232.522 306.105 233.501C303.996 235.441 301.666 237.03 298.945 237.996C292.934 240.129 286.354 238.602 280.183 239.056C279.661 239.095 279.162 239.442 278.635 239.487C275.592 240.135 272.2 240.63 269.156 241.294C264.546 242.299 260.456 243.409 255.808 244.179C251.971 244.814 243.815 245.854 243.815 245.854L242.074 245.505C240.575 245.281 240.751 243.152 242.269 242.95Z",fill:"url(#paint15_linear_1356_14057)"}),fhe("path",{d:"M432.985 171.626C438.212 165.465 445.109 153.64 442.906 144.649C442.162 137.999 433.671 132.912 424.963 135.518C420.16 136.957 416.435 142.146 419.724 144.498C420.656 145.164 422.187 145.591 423.391 145.969C434.204 149.375 434.925 162.538 425.069 169.683C421.087 172.569 416.347 174.292 411.914 176.719C400.151 183.162 399.887 196.847 387.7 202.712C382.326 205.298 375.761 206.838 370.297 209.275C359.98 213.88 352.555 221.733 342.241 226.341C337.225 228.584 330.266 231.632 323.483 234.12C321.475 234.855 321.999 237.058 324.056 236.46C324.098 236.449 324.017 236.474 324.056 236.46C329.079 234.971 334.437 233.161 339.331 231.33C352.278 226.48 365.28 220.971 377.43 214.775C401.78 202.367 416.881 190.609 432.985 171.626Z",fill:"url(#paint16_linear_1356_14057)"}),fhe("path",{d:"M343.644 241.104C348.002 234.144 357.126 232.455 364.343 231.134C368.176 230.431 372.406 229.878 376.137 228.662C380.691 227.175 384.558 224.095 388.327 221.077C389.452 220.177 391.204 218.466 392.393 217.436C393.185 216.748 393.644 216.026 394.33 215.225C396 213.275 399.599 209.812 401.687 208.16C403.263 206.914 407.779 204.758 408.259 207.986C408.611 210.359 406.379 213.087 404.961 214.747C402.224 217.953 398.998 221.079 395.475 223.243C391.749 225.531 387.701 227.439 383.674 229.051C381.672 229.853 379.519 230.073 377.486 230.785C376.001 231.307 374.486 232.236 373.037 232.866C371.034 233.738 368.99 234.28 367.041 235.38C364.436 236.849 361.782 238.783 359.108 240.105C356.331 241.477 353.823 242.691 350.791 243.27C348.6 243.687 345.501 243.641 343.836 241.884C343.526 241.554 343.389 241.51 343.644 241.104Z",fill:"url(#paint17_linear_1356_14057)"}),fhe("path",{d:"M190.163 273.219C222.905 268.849 232.64 262.943 213.962 259.057C195.285 255.172 187.5 262.08 188.434 266.2C189.366 270.32 180.381 271.326 169.286 272.39C158.193 273.454 157.141 276.354 190.163 273.219Z",fill:"url(#paint18_linear_1356_14057)"}),fhe("path",{d:"M295.952 95.4242L241.395 135.226L251.54 111.77L295.952 95.4242Z",fill:"#E17726",stroke:"#E17726","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M170.111 95.4242L224.181 135.598L214.522 111.77L170.111 95.4242Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M276.309 187.712L261.793 209.576L292.876 218.014L301.78 188.189L276.309 187.712Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M164.336 188.189L173.186 218.014L204.215 209.576L189.753 187.712L164.336 188.189Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M202.542 150.776L193.908 163.618L224.667 164.998L223.642 132.36L202.542 150.776Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M263.52 150.775L242.097 131.989L241.395 164.998L272.154 163.618L263.52 150.775Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M204.215 209.576L222.832 200.714L206.805 188.402L204.215 209.576Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M243.23 200.714L261.793 209.576L259.257 188.402L243.23 200.714Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M261.793 209.576L243.23 200.714L244.741 212.601L244.579 217.643L261.793 209.576Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M204.215 209.576L221.483 217.643L221.375 212.601L222.832 200.714L204.215 209.576Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M221.807 180.547L206.373 176.09L217.274 171.154L221.807 180.547Z",fill:"#233447",stroke:"#233447","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M244.255 180.547L248.788 171.154L259.742 176.09L244.255 180.547Z",fill:"#233447",stroke:"#233447","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M204.215 209.576L206.913 187.712L189.753 188.189L204.215 209.576Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M259.149 187.712L261.793 209.576L276.309 188.189L259.149 187.712Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M272.154 163.618L241.395 164.998L244.255 180.547L248.788 171.154L259.742 176.09L272.154 163.618Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M206.373 176.09L217.274 171.154L221.807 180.547L224.667 164.998L193.908 163.618L206.373 176.09Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M193.908 163.618L206.805 188.402L206.373 176.09L193.908 163.618Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M259.743 176.09L259.257 188.402L272.154 163.618L259.743 176.09Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M224.667 164.998L221.807 180.548L225.422 198.909L226.232 174.71L224.667 164.998Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M241.395 164.998L239.884 174.657L240.64 198.909L244.255 180.548L241.395 164.998Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M244.255 180.547L240.64 198.909L243.23 200.714L259.257 188.402L259.743 176.09L244.255 180.547Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M206.373 176.09L206.805 188.402L222.832 200.714L225.422 198.909L221.807 180.547L206.373 176.09Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M244.579 217.643L244.741 212.601L243.338 211.434H222.724L221.375 212.601L221.483 217.643L204.215 209.576L210.259 214.459L222.508 222.791H243.5L255.803 214.459L261.793 209.576L244.579 217.643Z",fill:"#C0AC9D",stroke:"#C0AC9D","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M243.23 200.714L240.64 198.909H225.422L222.832 200.714L221.375 212.601L222.724 211.434H243.338L244.741 212.601L243.23 200.714Z",fill:"#161616",stroke:"#161616","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M298.272 137.827L302.859 115.856L295.952 95.4242L243.23 133.899L263.52 150.775L292.174 159.001L298.488 151.731L295.736 149.767L300.107 145.84L296.761 143.293L301.132 140.002L298.272 137.827Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M163.203 115.856L167.844 137.827L164.876 140.002L169.301 143.293L165.955 145.84L170.326 149.767L167.574 151.731L173.888 159.001L202.542 150.775L222.832 133.899L170.11 95.4242L163.203 115.856Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M292.175 159.001L263.52 150.775L272.154 163.618L259.257 188.402L276.309 188.189H301.78L292.175 159.001Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M202.542 150.775L173.888 159.001L164.336 188.189H189.753L206.805 188.402L193.908 163.618L202.542 150.775Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M241.395 164.998L243.23 133.9L251.54 111.77H214.522L222.832 133.9L224.667 164.998L225.368 174.763L225.422 198.909H240.64L240.694 174.763L241.395 164.998Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("defs",null,fhe("linearGradient",{id:"paint0_linear_1356_14057",x1:"335.991",y1:"250.487",x2:"303.873",y2:"266.801",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint1_linear_1356_14057",x1:"276.993",y1:"303.722",x2:"205.254",y2:"401.574",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"0.0929","stop-color":"#81C2F6"}),fhe("stop",{offset:"1","stop-color":"#F0B8BD"})),fhe("linearGradient",{id:"paint2_linear_1356_14057",x1:"271.074",y1:"119.924",x2:"553.077",y2:"104.53",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint3_linear_1356_14057",x1:"264.209",y1:"91.0943",x2:"357.834",y2:"72.8792",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint4_linear_1356_14057",x1:"212.46",y1:"121.997",x2:"92.6119",y2:"183.406",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint5_linear_1356_14057",x1:"23.0498",y1:"204.411",x2:"161.86",y2:"163.003",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"0.0929","stop-color":"#81C2F6"}),fhe("stop",{offset:"1","stop-color":"#F0B8BD"})),fhe("linearGradient",{id:"paint6_linear_1356_14057",x1:"78.8647",y1:"240.375",x2:"74.9655",y2:"241.328",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint7_linear_1356_14057",x1:"382.349",y1:"181.971",x2:"378.45",y2:"182.925",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint8_linear_1356_14057",x1:"349.889",y1:"244.583",x2:"345.99",y2:"245.537",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint9_linear_1356_14057",x1:"142.262",y1:"279.808",x2:"138.362",y2:"280.762",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint10_linear_1356_14057",x1:"123.305",y1:"99.0746",x2:"119.406",y2:"100.028",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint11_linear_1356_14057",x1:"371.818",y1:"156.617",x2:"367.919",y2:"157.571",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint12_linear_1356_14057",x1:"385.281",y1:"242.958",x2:"381.382",y2:"243.911",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint13_linear_1356_14057",x1:"367.125",y1:"37.5052",x2:"360.843",y2:"38.8076",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint14_linear_1356_14057",x1:"300.182",y1:"91.321",x2:"479.464",y2:"104.041",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint15_linear_1356_14057",x1:"363.434",y1:"201.232",x2:"102.977",y2:"302.269",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint16_linear_1356_14057",x1:"447.962",y1:"165.159",x2:"313.049",y2:"197.95",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"0.0929","stop-color":"#81C2F6"}),fhe("stop",{offset:"1","stop-color":"#F0B8BD"})),fhe("linearGradient",{id:"paint17_linear_1356_14057",x1:"410.211",y1:"215.859",x2:"341.378",y2:"232.788",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"0.0929","stop-color":"#81C2F6"}),fhe("stop",{offset:"1","stop-color":"#F0B8BD"})),fhe("linearGradient",{id:"paint18_linear_1356_14057",x1:"222.282",y1:"258.986",x2:"162.257",y2:"273.774",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})))),Bfe=class{constructor(e){$de(this,e),this.close=whe(this,"close"),this.connectWithExtension=whe(this,"connectWithExtension"),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.i18nInstance=new Mfe,this.setTab(this.preferDesktop?1:2)}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(e=!1){this.close.emit({shouldTerminate:e})}connectWithExtensionHandler(){this.connectWithExtension.emit()}setTab(e){this.tab=e,this.isDefaultTab=!1}disconnectedCallback(){this.onClose()}updatePreferDesktop(e){e?this.setTab(1):this.setTab(2)}render(){if(!this.translationsLoaded)return null;const e=e=>this.i18nInstance.t(e),t=this.sdkVersion,n=this.isDefaultTab?this.preferDesktop?1:2:this.tab,r=Afe(this.link,"svg",{ecc:"medium",scale:2});return fhe(tfe,{className:"select-modal"},fhe("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),fhe("div",{class:"modal"},fhe("div",{class:"closeButtonContainer"},fhe("div",{class:"right"},fhe("span",{class:"closeButton",onClick:()=>this.onClose(!0)},fhe(cfe,null)))),fhe("div",{class:"logoContainer"},fhe(lfe,null)),fhe("div",null,fhe("div",{class:"tabcontainer"},fhe("div",{class:"flexContainer"},fhe("div",{onClick:()=>this.setTab(1),class:"tab flexItem "+(1===n?"tabactive":"")},e("DESKTOP")),fhe("div",{onClick:()=>this.setTab(2),class:"tab flexItem "+(2===n?"tabactive":"")},e("MOBILE")))),fhe("div",{style:{display:1===n?"none":"block"}},fhe("div",{class:"flexContainer"},fhe("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},fhe("div",{class:"center",id:"sdk-mm-qrcode",innerHTML:r}),fhe("div",{class:"connectMobileText"},e("SCAN_TO_CONNECT"),fhe("br",null),fhe("span",{class:"blue"},fhe("b",null,e("META_MASK_MOBILE_APP"))))))),fhe("div",{style:{display:2===n?"none":"block"}},fhe("div",{style:{display:"flex",justifyContent:"center",height:"300",marginTop:"-20"}},fhe(Lfe,null)),fhe("div",{class:"extensionLabel"},e("SELECT_MODAL.CRYPTO_TAKE_CONTROL_TEXT")),fhe("button",{class:"button",onClick:()=>this.connectWithExtensionHandler()},fhe(Nfe,null),fhe("span",{class:"installExtensionText"},e("CONNECT_WITH_EXTENSION"))))),fhe(afe,{version:t})))}get el(){return vhe(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Bfe.style=".flexContainer {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.flexItem {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem11 {\n flex: 11;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem1 {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.tab {\n padding: 8px;\n cursor: pointer;\n background-color: #F2F4F6;\n font-size: 12px;\n text-align: center;\n color: #24292E;\n}\n\n.tabcontainer {\n padding: 4px;\n background-color: #F2F4F6;\n border-radius: 8px;\n margin-bottom: 30px;\n margin-top: 30px;\n}\n\n.tabactive {\n background-color: white;\n -webkit-transition: background-color 300ms linear;\n -ms-transition: background-color 300ms linear;\n transition: background-color 300ms linear;\n border-radius: 8px;\n}\n\n.item {\n font-size: 12px;\n margin-bottom: 16px;\n border-radius: 8px;\n padding: 10px;\n border: 2px #F2F4F6 solid;\n color: #24292E;\n}\n\n.extensionLabel {\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n text-align: cetner;\n color: #24272A;\n}\n\n.notice {\n font-size: 12px;\n margin-left: 10px;\n margin-right: 10px;\n color: grey;\n}\n\n.button {\n margin-top: 41.5px;\n margin-bottom: 20px;\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 12px 20px;\n background: #037DD6;\n border-radius: 32px;\n color: white;\n border: 0;\n font-size: 14px;\n cursor: pointer;\n}\n\n.backdrop {\n visibility: visible;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n z-index: 99998;\n background: rgba(0, 0, 0, 0.87);\n opacity: 0.3;\n}\n\n.modal {\n visibility: visible;\n position: fixed;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99999;\n background: white;\n padding: 20px;\n border-radius: 8px;\n top: 50%;\n max-width: 100%;\n width: 460px;\n min-width: 300px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n color: #BBC0C5;\n cursor: pointer;\n}\n\n.logoContainer {\n margin-left: 24px;\n margin-right: 24px;\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.connectMobileText {\n font-size: 14px;\n color: black;\n margin-top: 28px;\n margin-bottom: 28px;\n line-height: 2;\n}\n\n.blue {\n color: #037DD6;\n font-weight: 700;\n}\n\n.installExtensionText {\n margin-left: 10px;\n}\n\n.center {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.right {\n display: flex;\n align-items: center;\n justify-content: right;\n}\n\n#sdk-mm-qrcode {\n svg {\n width: 50%;\n }\n}";var jfe=Object.freeze({__proto__:null,mm_install_modal:Tfe,mm_pending_modal:Rfe,mm_select_modal:Bfe});const Dfe=Object.freeze(Object.defineProperty({__proto__:null,get CommunicationLayerPreference(){return jie},get ConnectionStatus(){return yie},DEFAULT_SERVER_URL:die,get EventType(){return bie},get MessageType(){return Eie},MetaMaskSDK:Bde,MetaMaskSDKEvent:Nue,get PROVIDER_UPDATE_TYPE(){return ode},get PlatformType(){return Die},SDKProvider:Due,default:Bde},Symbol.toStringTag,{value:"Module"}));return OO});
77
- //# sourceMappingURL=coinley-vanilla.umd.cjs.map
76
+ */!function(e){!function(t){var n=Object.hasOwnProperty,r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i="object"==typeof process&&"function"==typeof process.nextTick,o="function"==typeof Symbol,s="object"==typeof Reflect,a="function"==typeof setImmediate?setImmediate:setTimeout,c=o?s&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function l(){this._events={},this._conf&&u.call(this,this._conf)}function u(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==t&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function d(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,process.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var h=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=new Array(r);r--;)i[r]=arguments[r];return i}};function f(e,n){for(var r={},i=e.length,o=0;o<i;o++)r[e[o]]=o<0?n[o]:t;return r}function p(e,t,n){var r,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(n.on||n.off)&&(r=n.on,i=n.off),t.addEventListener?(r=t.addEventListener,i=t.removeEventListener):t.addListener?(r=t.addListener,i=t.removeListener):t.on&&(r=t.on,i=t.off),!r&&!i)throw Error("target does not implement any known event API");if("function"!=typeof r)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=r,this._off=i;var o=e._observers;o?o.push(this):e._observers=[this]}function m(e,r,i,o){var s=Object.assign({},r);if(!e)return s;if("object"!=typeof e)throw TypeError("options must be an object");var a,c,l,u=Object.keys(e),d=u.length;function h(e){throw Error('Invalid "'+a+'" option value'+(e?". Reason: "+e:""))}for(var f=0;f<d;f++){if(a=u[f],!n.call(r,a))throw Error('Unknown "'+a+'" option');(c=e[a])!==t&&(l=i[a],s[a]=l?l(c,h):c)}return s}function g(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function y(e){var t="value must be type of "+e.join("|"),n=e.length,r=e[0],i=e[1];return 1===n?function(e,n){if(typeof e===r)return e;n(t)}:2===n?function(e,n){var o=typeof e;if(o===r||o===i)return e;n(t)}:function(r,i){for(var o=typeof r,s=n;s-- >0;)if(o===e[s])return r;i(t)}}Object.assign(p.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var r=h.apply(null,arguments),s={data:r,name:t,original:e};n?!1!==n.call(i,s)&&o.emit.apply(o,[s.name].concat(r)):o.emit.apply(o,[t].concat(r))};if(s[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===s[e]&&(s[e]=a,r._on.call(i,e,a))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&s[e]&&(s[e]=null,r._off.call(i,e,a))},s[e]=null,o.on("removeListener",this._onRemoveListener)):(s[e]=a,r._on.call(i,e,a))},unsubscribe:function(e){var t,n,r,i=this,o=this._listeners,s=this._emitter,a=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function u(){i._onNewListener&&(s.off("newListener",i._onNewListener),s.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=E.call(s,i);s._observers.splice(e,1)}if(e){if(!(t=o[e]))return;a.call(l,e,t),delete o[e],--this._listenersCount||u()}else{for(r=(n=c(o)).length;r-- >0;)e=n[r],a.call(l,e,o[e]);this._listeners={},this._listenersCount=0,u()}}});var b=y(["function"]),v=y(["object","function"]);function w(e,t,n){var r,i,o,s=0,a=new e(function(c,l,u){function d(){i&&(i=null),s&&(clearTimeout(s),s=0)}n=m(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof u;var h=function(e){d(),c(e)},f=function(e){d(),l(e)};r?t(h,f,u):(i=[function(e){f(e||Error("canceled"))}],t(h,f,function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)}),o=!0),n.timeout>0&&(s=setTimeout(function(){var e=Error("timeout");e.code="ETIMEDOUT",s=0,a.cancel(e),l(e)},n.timeout))});return r||(a.cancel=function(e){if(i){for(var t=i.length,n=1;n<t;n++)i[n](e);i[0](e),i=null}}),a}function E(e){var t=this._observers;if(!t)return-1;for(var n=t.length,r=0;r<n;r++)if(t[r]._target===e)return r;return-1}function _(e,t,n,r,i){if(!n)return null;if(0===r){var o=typeof t;if("string"===o){var s,a,l=0,u=0,d=this.delimiter,h=d.length;if(-1!==(a=t.indexOf(d))){s=new Array(5);do{s[l++]=t.slice(u,a),u=a+h}while(-1!==(a=t.indexOf(d,u)));s[l++]=t.slice(u),t=s,i=l}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var f,p,m,g,y,b,v,w=null,E=t[r],x=t[r+1];if(r===i)n._listeners&&("function"==typeof n._listeners?(e&&e.push(n._listeners),w=[n]):(e&&e.push.apply(e,n._listeners),w=[n]));else{if("*"===E){for(a=(b=c(n)).length;a-- >0;)"_listeners"!==(f=b[a])&&(v=_(e,t,n[f],r+1,i))&&(w?w.push.apply(w,v):w=v);return w}if("**"===E){for((y=r+1===i||r+2===i&&"*"===x)&&n._listeners&&(w=_(e,t,n,i,i)),a=(b=c(n)).length;a-- >0;)"_listeners"!==(f=b[a])&&("*"===f||"**"===f?(n[f]._listeners&&!y&&(v=_(e,t,n[f],i,i))&&(w?w.push.apply(w,v):w=v),v=_(e,t,n[f],r,i)):v=_(e,t,n[f],f===x?r+2:r,i),v&&(w?w.push.apply(w,v):w=v));return w}n[E]&&(w=_(e,t,n[E],r+1,i))}if((p=n["*"])&&_(e,t,p,r+1,i),m=n["**"])if(r<i)for(m._listeners&&_(e,t,m,i,i),a=(b=c(m)).length;a-- >0;)"_listeners"!==(f=b[a])&&(f===x?_(e,t,m[f],r+2,i):f===E?_(e,t,m[f],r+1,i):((g={})[f]=m[f],_(e,t,{"**":g},r+1,i)));else m._listeners?_(e,t,m,i,i):m["*"]&&m["*"]._listeners&&_(e,t,m["*"],i,i);return w}function x(e,t,n){var r,i,o=0,s=0,a=this.delimiter,c=a.length;if("string"==typeof e)if(-1!==(r=e.indexOf(a))){i=new Array(5);do{i[o++]=e.slice(s,r),s=r+c}while(-1!==(r=e.indexOf(a,s)));i[o++]=e.slice(s)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(r=0;r+1<o;r++)if("**"===i[r]&&"**"===i[r+1])return;var l,u=this.listenerTree;for(r=0;r<o;r++)if(u=u[l=i[r]]||(u[l]={}),r===o-1)return u._listeners?("function"==typeof u._listeners&&(u._listeners=[u._listeners]),n?u._listeners.unshift(t):u._listeners.push(t),!u._listeners.warned&&this._maxListeners>0&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,d.call(this,u._listeners.length,l))):u._listeners=t,!0;return!0}function k(e,t,n,r){for(var i,o,s,a,l=c(e),u=l.length,d=e._listeners;u-- >0;)i=e[o=l[u]],s="_listeners"===o?n:n?n.concat(o):[o],a=r||"symbol"==typeof o,d&&t.push(a?s:s.join(this.delimiter)),"object"==typeof i&&k.call(this,i,t,s,a);return t}function S(e){for(var t,n,r,i=c(e),o=i.length;o-- >0;)(t=e[n=i[o]])&&(r=!0,"_listeners"===n||S(t)||delete e[n]);return r}function C(e,t,n){this.emitter=e,this.event=t,this.listener=n}function I(e,n,r){if(!0===r)s=!0;else if(!1===r)o=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var o=r.async,s=r.promisify,c=r.nextTick,l=r.objectify}if(o||c||s){var u=n,d=n._origin||n;if(c&&!i)throw Error("process.nextTick is not supported");s===t&&(s="AsyncFunction"===n.constructor.name),n=function(){var e=arguments,t=this,n=this.event;return s?c?Promise.resolve():new Promise(function(e){a(e)}).then(function(){return t.event=n,u.apply(t,e)}):(c?process.nextTick:a)(function(){t.event=n,u.apply(t,e)})},n._async=!0,n._origin=d}return[n,l?new C(this,e,n):this]}function A(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,u.call(this,e)}C.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},A.EventEmitter2=A,A.prototype.listenTo=function(e,n,i){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function s(t){if("object"!=typeof t)throw TypeError("events must be an object");var n,r=i.reducers,s=E.call(o,e);n=-1===s?new p(o,e,i):o._observers[s];for(var a,l=c(t),u=l.length,d="function"==typeof r,h=0;h<u;h++)a=l[h],n.subscribe(a,t[a]||a,d?r:r&&r[a])}return i=m(i,{on:t,off:t,reducers:t},{on:b,off:b,reducers:v}),r(n)?s(f(n)):s("string"==typeof n?f(n.split(/\s+/)):n),this},A.prototype.stopListeningTo=function(e,t){var n=this._observers;if(!n)return!1;var r,i=n.length,o=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)r=n[i],e&&r._target!==e||(r.unsubscribe(t),o=!0);return o},A.prototype.delimiter=".",A.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},A.prototype.getMaxListeners=function(){return this._maxListeners},A.prototype.event="",A.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},A.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},A.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},A.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},A.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},A.prototype._many=function(e,t,n,r,i){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function s(){return 0===--t&&o.off(e,s),n.apply(this,arguments)}return s._origin=n,this._on(e,s,r,i)},A.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,s,a=arguments[0],c=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return!1;if(c&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(n=a.length,o)for(r=0;r<n;r++)if("symbol"==typeof a[r]){s=!0;break}s||(a=a.join(this.delimiter))}var u,d=arguments.length;if(this._all&&this._all.length)for(r=0,n=(u=this._all.slice()).length;r<n;r++)switch(this.event=a,d){case 1:u[r].call(this,a);break;case 2:u[r].call(this,a,arguments[1]);break;case 3:u[r].call(this,a,arguments[1],arguments[2]);break;default:u[r].apply(this,arguments)}if(c)u=[],_.call(this,u,e,this.listenerTree,0,n);else{if("function"==typeof(u=this._events[a])){switch(this.event=a,d){case 1:u.call(this);break;case 2:u.call(this,arguments[1]);break;case 3:u.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];u.apply(this,t)}return!0}u&&(u=u.slice())}if(u&&u.length){if(d>3)for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];for(r=0,n=u.length;r<n;r++)switch(this.event=a,d){case 1:u[r].call(this);break;case 2:u[r].call(this,arguments[1]);break;case 3:u[r].call(this,arguments[1],arguments[2]);break;default:u[r].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===a)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},A.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||l.call(this);var e,t,n,r,i,s,a=arguments[0],c=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(c&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(r=a.length,o)for(i=0;i<r;i++)if("symbol"==typeof a[i]){t=!0;break}t||(a=a.join(this.delimiter))}var u,d=[],h=arguments.length;if(this._all)for(i=0,r=this._all.length;i<r;i++)switch(this.event=a,h){case 1:d.push(this._all[i].call(this,a));break;case 2:d.push(this._all[i].call(this,a,arguments[1]));break;case 3:d.push(this._all[i].call(this,a,arguments[1],arguments[2]));break;default:d.push(this._all[i].apply(this,arguments))}if(c?(u=[],_.call(this,u,e,this.listenerTree,0)):u=this._events[a],"function"==typeof u)switch(this.event=a,h){case 1:d.push(u.call(this));break;case 2:d.push(u.call(this,arguments[1]));break;case 3:d.push(u.call(this,arguments[1],arguments[2]));break;default:for(n=new Array(h-1),s=1;s<h;s++)n[s-1]=arguments[s];d.push(u.apply(this,n))}else if(u&&u.length){if(u=u.slice(),h>3)for(n=new Array(h-1),s=1;s<h;s++)n[s-1]=arguments[s];for(i=0,r=u.length;i<r;i++)switch(this.event=a,h){case 1:d.push(u[i].call(this));break;case 2:d.push(u[i].call(this,arguments[1]));break;case 3:d.push(u[i].call(this,arguments[1],arguments[2]));break;default:d.push(u[i].apply(this,n))}}else if(!this.ignoreErrors&&!this._all&&"error"===a)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(d)},A.prototype.on=function(e,t,n){return this._on(e,t,!1,n)},A.prototype.prependListener=function(e,t,n){return this._on(e,t,!0,n)},A.prototype.onAny=function(e){return this._onAny(e,!1)},A.prototype.prependAny=function(e){return this._onAny(e,!0)},A.prototype.addListener=A.prototype.on,A.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},A.prototype._on=function(e,n,r,i){if("function"==typeof e)return this._onAny(e,n),this;if("function"!=typeof n)throw new Error("on only accepts instances of Function");this._events||l.call(this);var o,s=this;return i!==t&&(n=(o=I.call(this,e,n,i))[0],s=o[1]),this._newListener&&this.emit("newListener",e,n),this.wildcard?(x.call(this,e,n,r),s):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(n):this._events[e].push(n),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,d.call(this,this._events[e].length,e))):this._events[e]=n,s)},A.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=_.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var s=0;s<i.length;s++){var a=i[s];if(n=a._listeners,r(n)){for(var c=-1,l=0,u=n.length;l<u;l++)if(n[l]===t||n[l].listener&&n[l].listener===t||n[l]._origin&&n[l]._origin===t){c=l;break}if(c<0)continue;return this.wildcard?a._listeners.splice(c,1):this._events[e].splice(c,1),0===n.length&&(this.wildcard?delete a._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete a._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&S(this.listenerTree),this},A.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(n=0,r=(t=this._all).length;n<r;n++)if(e===t[n])return t.splice(n,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(n=0,r=t.length;n<r;n++)this.emit("removeListenerAny",t[n]);this._all=[]}return this},A.prototype.removeListener=A.prototype.off,A.prototype.removeAllListeners=function(e){if(e===t)return!this._events||l.call(this),this;if(this.wildcard){var n,r=_.call(this,null,e,this.listenerTree,0);if(!r)return this;for(n=0;n<r.length;n++)r[n]._listeners=null;this.listenerTree&&S(this.listenerTree)}else this._events&&(this._events[e]=null);return this},A.prototype.listeners=function(e){var n,r,i,o,s,a=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!a)return[];for(o=(n=c(a)).length,i=[];o-- >0;)"function"==typeof(r=a[n[o]])?i.push(r):i.push.apply(i,r);return i}if(this.wildcard){if(!(s=this.listenerTree))return[];var l=[],u="string"==typeof e?e.split(this.delimiter):e.slice();return _.call(this,l,u,s,0),l}return a&&(r=a[e])?"function"==typeof r?[r]:r:[]},A.prototype.eventNames=function(e){var t=this._events;return this.wildcard?k.call(this,this.listenerTree,[],null,e):t?c(t):[]},A.prototype.listenerCount=function(e){return this.listeners(e).length},A.prototype.hasListeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return _.call(this,n,r,this.listenerTree,0),n.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(e===t?c(i).length:i[e]))},A.prototype.listenersAny=function(){return this._all?this._all:[]},A.prototype.waitFor=function(e,n){var r=this,i=typeof n;return"number"===i?n={timeout:n}:"function"===i&&(n={filter:n}),w((n=m(n,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:b,Promise:g})).Promise,function(t,i,o){function s(){var o=n.filter;if(!o||o.apply(r,arguments))if(r.off(e,s),n.handleError){var a=arguments[0];a?i(a):t(h.apply(null,arguments).slice(1))}else t(h.apply(null,arguments))}o(function(){r.off(e,s)}),r._on(e,s,!1)},{timeout:n.timeout,overload:n.overload})};var P=A.prototype;Object.defineProperties(A,{defaultMaxListeners:{get:function(){return P._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");P._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return w((n=m(n,{Promise:Promise,timeout:0,overload:!1},{Promise:g})).Promise,function(n,r,i){var o;if("function"==typeof e.addEventListener)return o=function(){n(h.apply(null,arguments))},i(function(){e.removeEventListener(t,o)}),void e.addEventListener(t,o,{once:!0});var s,a=function(){s&&e.removeListener("error",s),n(h.apply(null,arguments))};"error"!==t&&(s=function(n){e.removeListener(t,a),r(n)},e.once("error",s)),i(function(){s&&e.removeListener("error",s),e.removeListener(t,a)}),e.once(t,a)},{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(P,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=A}()}(P4);var M4=P4.exports;const O4=Re(M4);var T4,R4=new Uint8Array(16);function N4(){if(!T4&&!(T4="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return T4(R4)}const L4=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function B4(e){return"string"==typeof e&&L4.test(e)}for(var j4=[],D4=0;D4<256;++D4)j4.push((D4+256).toString(16).substr(1));function U4(e,t,n){var r=(e=e||{}).random||(e.rng||N4)();return r[6]=15&r[6]|64,r[8]=63&r[8]|128,function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(j4[e[t+0]]+j4[e[t+1]]+j4[e[t+2]]+j4[e[t+3]]+"-"+j4[e[t+4]]+j4[e[t+5]]+"-"+j4[e[t+6]]+j4[e[t+7]]+"-"+j4[e[t+8]]+j4[e[t+9]]+"-"+j4[e[t+10]]+j4[e[t+11]]+j4[e[t+12]]+j4[e[t+13]]+j4[e[t+14]]+j4[e[t+15]]).toLowerCase();if(!B4(n))throw TypeError("Stringified UUID is invalid");return n}(r)}const F4=Object.create(null);F4.open="0",F4.close="1",F4.ping="2",F4.pong="3",F4.message="4",F4.upgrade="5",F4.noop="6";const $4=Object.create(null);Object.keys(F4).forEach(e=>{$4[F4[e]]=e});const z4={type:"error",data:"parser error"},H4="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),q4="function"==typeof ArrayBuffer,W4=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,K4=({type:e,data:t},n,r)=>H4&&t instanceof Blob?n?r(t):G4(t,r):q4&&(t instanceof ArrayBuffer||W4(t))?n?r(t):G4(new Blob([t]),r):r(F4[e]+(t||"")),G4=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function V4(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Z4;const Y4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",J4="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let $fe=0;$fe<64;$fe++)J4[Y4.charCodeAt($fe)]=$fe;const Q4="function"==typeof ArrayBuffer,X4=(e,t)=>{if("string"!=typeof e)return{type:"message",data:t8(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:e8(e.substring(1),t)};return $4[n]?e.length>1?{type:$4[n],data:e.substring(1)}:{type:$4[n]}:z4},e8=(e,t)=>{if(Q4){const n=(e=>{let t,n,r,i,o,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const l=new ArrayBuffer(s),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=J4[e.charCodeAt(t)],r=J4[e.charCodeAt(t+1)],i=J4[e.charCodeAt(t+2)],o=J4[e.charCodeAt(t+3)],u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|i>>2,u[c++]=(3&i)<<6|63&o;return l})(e);return t8(n,t)}return{base64:!0,data:e}},t8=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,n8=String.fromCharCode(30);function r8(){return new TransformStream({transform(e,t){!function(e,t){H4&&e.data instanceof Blob?e.data.arrayBuffer().then(V4).then(t):q4&&(e.data instanceof ArrayBuffer||W4(e.data))?t(V4(e.data)):K4(e,!1,e=>{Z4||(Z4=new TextEncoder),t(Z4.encode(e))})}(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let i8;function o8(e){return e.reduce((e,t)=>e+t.length,0)}function s8(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function a8(e){if(e)return function(e){for(var t in a8.prototype)e[t]=a8.prototype[t];return e}(e)}a8.prototype.on=a8.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},a8.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},a8.prototype.off=a8.prototype.removeListener=a8.prototype.removeAllListeners=a8.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},a8.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},a8.prototype.emitReserved=a8.prototype.emit,a8.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},a8.prototype.hasListeners=function(e){return!!this.listeners(e).length};const c8="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),l8="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function u8(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}const d8=l8.setTimeout,h8=l8.clearTimeout;function f8(e,t){t.useNativeTimers?(e.setTimeoutFn=d8.bind(l8),e.clearTimeoutFn=h8.bind(l8)):(e.setTimeoutFn=l8.setTimeout.bind(l8),e.clearTimeoutFn=l8.clearTimeout.bind(l8))}function p8(e){return"string"==typeof e?function(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(e):Math.ceil(1.33*(e.byteLength||e.size))}function m8(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class g8 extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class y8 extends a8{constructor(e){super(),this.writable=!1,f8(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new g8(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=X4(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class b8 extends y8{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(n8),r=[];for(let i=0;i<n.length;i++){const e=X4(n[i],t);if(r.push(e),"error"===e.type)break}return r})(e,this.socket.binaryType).forEach(e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)}),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((e,o)=>{K4(e,!1,e=>{r[o]=e,++i===n&&t(r.join(n8))})})})(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=m8()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let v8=!1;try{v8="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(Ffe){}const w8=v8;function E8(){}class _8 extends b8{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}let x8=class e extends a8{constructor(e,t,n){super(),this.createRequest=e,f8(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var t;const n=u8(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(Ufe){}if("POST"===this._method)try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(Ufe){}try{r.setRequestHeader("Accept","*/*")}catch(Ufe){}null===(t=this._opts.cookieJar)||void 0===t||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;3===r.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(r.getResponseHeader("set-cookie"))),4===r.readyState&&(200===r.status||1223===r.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof r.status?r.status:0)},0))},r.send(this._data)}catch(Ufe){return void this.setTimeoutFn(()=>{this._onError(Ufe)},0)}"undefined"!=typeof document&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(t){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=E8,t)try{this._xhr.abort()}catch(Ufe){}"undefined"!=typeof document&&delete e.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};if(x8.requestsCount=0,x8.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",k8);else if("function"==typeof addEventListener){addEventListener("onpagehide"in l8?"pagehide":"unload",k8,!1)}function k8(){for(let e in x8.requests)x8.requests.hasOwnProperty(e)&&x8.requests[e].abort()}const S8=function(){const e=C8({xdomain:!1});return e&&null!==e.responseType}();function C8(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||w8))return new XMLHttpRequest}catch(Ufe){}if(!t)try{return new(l8[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(Ufe){}}const I8="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class A8 extends y8{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=I8?{}:u8(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(Ffe){return this.emitReserved("error",Ffe)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;K4(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch(Ufe){}r&&c8(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=m8()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const P8=l8.WebSocket||l8.MozWebSocket;const M8={websocket:class extends A8{createSocket(e,t,n){return I8?new P8(e,t,n):t?new P8(e,t):new P8(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends y8{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(Ffe){return this.emitReserved("error",Ffe)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=function(e,t){i8||(i8=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(o8(n)<1)break;const e=s8(n,1);o=!(128&~e[0]),i=127&e[0],r=i<126?3:126===i?1:2}else if(1===r){if(o8(n)<2)break;const e=s8(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(o8(n)<8)break;const e=s8(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){a.enqueue(z4);break}i=o*Math.pow(2,32)+t.getUint32(4),r=3}else{if(o8(n)<i)break;const e=s8(n,i);a.enqueue(X4(o?e:i8.decode(e),t)),r=0}if(0===i||i>e){a.enqueue(z4);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=r8();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&c8(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends _8{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=S8&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new x8(C8,this.uri(),e)}}},O8=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,T8=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function R8(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=O8.exec(e||""),o={},s=14;for(;s--;)o[T8[s]]=i[s]||"";return-1!=n&&-1!=r&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||r.splice(0,1);"/"==t.slice(-1)&&r.splice(r.length-1,1);return r}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}(0,o.query),o}const N8="function"==typeof addEventListener&&"function"==typeof removeEventListener,L8=[];N8&&addEventListener("offline",()=>{L8.forEach(e=>e())},!1);class B8 extends a8{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=R8(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=R8(t.host).host);f8(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let e=n[r].split("=");t[decodeURIComponent(e[0])]=decodeURIComponent(e[1])}return t}(this.opts.query)),N8&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},L8.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);const e=this.opts.rememberUpgrade&&B8.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",B8.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=p8(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,c8(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const i={type:e,data:t,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(B8.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),N8&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=L8.indexOf(this._offlineEventListener);-1!==e&&L8.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}B8.protocol=4;class j8 extends B8{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;B8.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;B8.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,i(),this.emitReserved("upgradeError",n)};function s(){o("transport closed")}function a(){o("socket closed")}function c(e){t&&e.name!==t.name&&i()}const l=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",s),this.off("close",a),this.off("upgrading",c)};t.once("open",r),t.once("error",o),t.once("close",s),this.once("close",a),this.once("upgrading",c),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let D8=class extends j8{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(e=>M8[e]).filter(e=>!!e)),super(e,n)}};const U8="function"==typeof ArrayBuffer,F8=Object.prototype.toString,$8="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===F8.call(Blob),z8="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===F8.call(File);function H8(e){return U8&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||$8&&e instanceof Blob||z8&&e instanceof File}function q8(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(q8(e[t]))return!0;return!1}if(H8(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return q8(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&q8(e[n]))return!0;return!1}function W8(e){const t=[],n=e.data,r=e;return r.data=K8(n,t),r.attachments=t.length,{packet:r,buffers:t}}function K8(e,t){if(!e)return e;if(H8(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=K8(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=K8(e[r],t));return n}return e}function G8(e,t){return e.data=V8(e.data,t),delete e.attachments,e}function V8(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=V8(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=V8(e[n],t));return e}const Z8=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Y8,J8;(J8=Y8||(Y8={}))[J8.CONNECT=0]="CONNECT",J8[J8.DISCONNECT=1]="DISCONNECT",J8[J8.EVENT=2]="EVENT",J8[J8.ACK=3]="ACK",J8[J8.CONNECT_ERROR=4]="CONNECT_ERROR",J8[J8.BINARY_EVENT=5]="BINARY_EVENT",J8[J8.BINARY_ACK=6]="BINARY_ACK";function Q8(e){return"[object Object]"===Object.prototype.toString.call(e)}class X8 extends a8{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Y8.BINARY_EVENT;n||t.type===Y8.BINARY_ACK?(t.type=n?Y8.EVENT:Y8.ACK,this.reconstructor=new e7(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!H8(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Y8[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Y8.BINARY_EVENT||n.type===Y8.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const i=e.substring(r,t);if(i!=Number(i)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!X8.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(Ufe){return!1}}static isPayloadValid(e,t){switch(e){case Y8.CONNECT:return Q8(t);case Y8.DISCONNECT:return void 0===t;case Y8.CONNECT_ERROR:return"string"==typeof t||Q8(t);case Y8.EVENT:case Y8.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Z8.indexOf(t[0]));case Y8.ACK:case Y8.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class e7{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=G8(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const t7=Object.freeze(Object.defineProperty({__proto__:null,Decoder:X8,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Y8.EVENT&&e.type!==Y8.ACK||!q8(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Y8.EVENT?Y8.BINARY_EVENT:Y8.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Y8.BINARY_EVENT&&e.type!==Y8.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=W8(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},get PacketType(){return Y8},protocol:5},Symbol.toStringTag,{value:"Module"}));function n7(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const r7=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class i7 extends a8{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[n7(e,"open",this.onopen.bind(this)),n7(e,"packet",this.onpacket.bind(this)),n7(e,"error",this.onerror.bind(this)),n7(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,r,i;if(r7.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:Y8.EVENT,data:t,options:{}};if(o.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),o.id=e}const s=null===(r=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===r?void 0:r.writable,a=this.connected&&!(null===(i=this.io.engine)||void 0===i?void 0:i._hasPingExpired());return this.flags.volatile&&!s||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))},r),o=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((n,r)=>{const i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()}),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Y8.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Y8.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Y8.EVENT:case Y8.BINARY_EVENT:this.onevent(e);break;case Y8.ACK:case Y8.BINARY_ACK:this.onack(e);break;case Y8.DISCONNECT:this.ondisconnect();break;case Y8.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:Y8.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Y8.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function o7(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}o7.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},o7.prototype.reset=function(){this.attempts=0},o7.prototype.setMin=function(e){this.ms=e},o7.prototype.setMax=function(e){this.max=e},o7.prototype.setJitter=function(e){this.jitter=e};class s7 extends a8{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,f8(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new o7({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||t7;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new D8(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=n7(t,"open",function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=n7(t,"error",i);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(n7(e,"ping",this.onping.bind(this)),n7(e,"data",this.ondata.bind(this)),n7(e,"error",this.onerror.bind(this)),n7(e,"close",this.onclose.bind(this)),n7(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(Ufe){this.onclose("parse error",Ufe)}}ondecoded(e){c8(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new i7(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t){if(this.nsps[n].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const a7={};function c7(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=R8(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+t,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=a7[i]&&o in a7[i].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new s7(r,t):(a7[i]||(a7[i]=new s7(r,t)),a=a7[i]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}function l7(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}Object.assign(c7,{Manager:s7,Socket:i7,io:c7,connect:c7}),"function"==typeof SuppressedError&&SuppressedError;var u7="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},d7=[],h7=[],f7="undefined"!=typeof Uint8Array?Uint8Array:Array,p7=!1;function m7(){p7=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)d7[t]=e[t],h7[e.charCodeAt(t)]=t;h7["-".charCodeAt(0)]=62,h7["_".charCodeAt(0)]=63}function g7(e,t,n){for(var r,i,o=[],s=t;s<n;s+=3)r=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(d7[(i=r)>>18&63]+d7[i>>12&63]+d7[i>>6&63]+d7[63&i]);return o.join("")}function y7(e){var t;p7||m7();for(var n=e.length,r=n%3,i="",o=[],s=16383,a=0,c=n-r;a<c;a+=s)o.push(g7(e,a,a+s>c?c:a+s));return 1===r?(t=e[n-1],i+=d7[t>>2],i+=d7[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=d7[t>>10],i+=d7[t>>4&63],i+=d7[t<<2&63],i+="="),o.push(i),o.join("")}function b7(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+e[t+d],d+=h,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+d],d+=h,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=l}return(f?-1:1)*s*Math.pow(2,o-r)}function v7(e,t,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,d=u>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[n+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;e[n+f]=255&s,f+=p,s/=256,l-=8);e[n+f-p]|=128*m}var w7={}.toString,E7=Array.isArray||function(e){return"[object Array]"==w7.call(e)};S7.TYPED_ARRAY_SUPPORT=void 0===u7.TYPED_ARRAY_SUPPORT||u7.TYPED_ARRAY_SUPPORT;var _7=x7();function x7(){return S7.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function k7(e,t){if(x7()<t)throw new RangeError("Invalid typed array length");return S7.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=S7.prototype:(null===e&&(e=new S7(t)),e.length=t),e}function S7(e,t,n){if(!(S7.TYPED_ARRAY_SUPPORT||this instanceof S7))return new S7(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return A7(this,e)}return C7(this,e,t,n)}function C7(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),S7.TYPED_ARRAY_SUPPORT?(e=t).__proto__=S7.prototype:e=P7(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!S7.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|T7(t,n),i=(e=k7(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(O7(t)){var n=0|M7(t.length);return 0===(e=k7(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?k7(e,0):P7(e,t);if("Buffer"===t.type&&E7(t.data))return P7(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function I7(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function A7(e,t){if(I7(t),e=k7(e,t<0?0:0|M7(t)),!S7.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function P7(e,t){var n=t.length<0?0:0|M7(t.length);e=k7(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function M7(e){if(e>=x7())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+x7().toString(16)+" bytes");return 0|e}function O7(e){return!(null==e||!e._isBuffer)}function T7(e,t){if(O7(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return o9(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return s9(e).length;default:if(r)return o9(e).length;t=(""+t).toLowerCase(),r=!0}}function R7(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return V7(this,t,n);case"utf8":case"utf-8":return q7(this,t,n);case"ascii":return K7(this,t,n);case"latin1":case"binary":return G7(this,t,n);case"base64":return H7(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Z7(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function N7(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function L7(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=S7.from(t,r)),O7(t))return 0===t.length?-1:B7(e,t,n,r,i);if("number"==typeof t)return t&=255,S7.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):B7(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function B7(e,t,n,r,i){var o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var u=-1;for(o=n;o<a;o++)if(l(e,o)===l(t,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===c)return u*s}else-1!==u&&(o-=o-u),u=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var d=!0,h=0;h<c;h++)if(l(e,o+h)!==l(t,h)){d=!1;break}if(d)return o}return-1}function j7(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function D7(e,t,n,r){return a9(o9(t,e.length-n),e,n,r)}function U7(e,t,n,r){return a9(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function F7(e,t,n,r){return U7(e,t,n,r)}function $7(e,t,n,r){return a9(s9(t),e,n,r)}function z7(e,t,n,r){return a9(function(e,t){for(var n,r,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function H7(e,t,n){return 0===t&&n===e.length?y7(e):y7(e.slice(t,n))}function q7(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,s,a,c,l=e[i],u=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&l)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=d}return function(e){var t=e.length;if(t<=W7)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=W7));return n}(r)}S7.poolSize=8192,S7._augment=function(e){return e.__proto__=S7.prototype,e},S7.from=function(e,t,n){return C7(null,e,t,n)},S7.TYPED_ARRAY_SUPPORT&&(S7.prototype.__proto__=Uint8Array.prototype,S7.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&S7[Symbol.species]),S7.alloc=function(e,t,n){return r=null,o=t,s=n,I7(i=e),i<=0?k7(r,i):void 0!==o?"string"==typeof s?k7(r,i).fill(o,s):k7(r,i).fill(o):k7(r,i);var r,i,o,s},S7.allocUnsafe=function(e){return A7(null,e)},S7.allocUnsafeSlow=function(e){return A7(null,e)},S7.isBuffer=c9,S7.compare=function(e,t){if(!O7(e)||!O7(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},S7.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},S7.concat=function(e,t){if(!E7(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return S7.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=S7.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!O7(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},S7.byteLength=T7,S7.prototype._isBuffer=!0,S7.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)N7(this,t,t+1);return this},S7.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)N7(this,t,t+3),N7(this,t+1,t+2);return this},S7.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)N7(this,t,t+7),N7(this,t+1,t+6),N7(this,t+2,t+5),N7(this,t+3,t+4);return this},S7.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?q7(this,0,e):R7.apply(this,arguments)},S7.prototype.equals=function(e){if(!O7(e))throw new TypeError("Argument must be a Buffer");return this===e||0===S7.compare(this,e)},S7.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},S7.prototype.compare=function(e,t,n,r,i){if(!O7(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(r,i),l=e.slice(t,n),u=0;u<a;++u)if(c[u]!==l[u]){o=c[u],s=l[u];break}return o<s?-1:s<o?1:0},S7.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},S7.prototype.indexOf=function(e,t,n){return L7(this,e,t,n,!0)},S7.prototype.lastIndexOf=function(e,t,n){return L7(this,e,t,n,!1)},S7.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return j7(this,e,t,n);case"utf8":case"utf-8":return D7(this,e,t,n);case"ascii":return U7(this,e,t,n);case"latin1":case"binary":return F7(this,e,t,n);case"base64":return $7(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z7(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},S7.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var W7=4096;function K7(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function G7(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function V7(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=i9(e[o]);return i}function Z7(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Y7(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function J7(e,t,n,r,i,o){if(!O7(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function Q7(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function X7(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function e9(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function t9(e,t,n,r,i){return i||e9(e,0,n,4),v7(e,t,n,r,23,4),n+4}function n9(e,t,n,r,i){return i||e9(e,0,n,8),v7(e,t,n,r,52,8),n+8}S7.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),S7.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=S7.prototype;else{var i=t-e;n=new S7(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},S7.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Y7(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},S7.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Y7(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},S7.prototype.readUInt8=function(e,t){return t||Y7(e,1,this.length),this[e]},S7.prototype.readUInt16LE=function(e,t){return t||Y7(e,2,this.length),this[e]|this[e+1]<<8},S7.prototype.readUInt16BE=function(e,t){return t||Y7(e,2,this.length),this[e]<<8|this[e+1]},S7.prototype.readUInt32LE=function(e,t){return t||Y7(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},S7.prototype.readUInt32BE=function(e,t){return t||Y7(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},S7.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Y7(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},S7.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Y7(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},S7.prototype.readInt8=function(e,t){return t||Y7(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},S7.prototype.readInt16LE=function(e,t){t||Y7(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},S7.prototype.readInt16BE=function(e,t){t||Y7(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},S7.prototype.readInt32LE=function(e,t){return t||Y7(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},S7.prototype.readInt32BE=function(e,t){return t||Y7(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},S7.prototype.readFloatLE=function(e,t){return t||Y7(e,4,this.length),b7(this,e,!0,23,4)},S7.prototype.readFloatBE=function(e,t){return t||Y7(e,4,this.length),b7(this,e,!1,23,4)},S7.prototype.readDoubleLE=function(e,t){return t||Y7(e,8,this.length),b7(this,e,!0,52,8)},S7.prototype.readDoubleBE=function(e,t){return t||Y7(e,8,this.length),b7(this,e,!1,52,8)},S7.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||J7(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},S7.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||J7(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},S7.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,1,255,0),S7.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},S7.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,2,65535,0),S7.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Q7(this,e,t,!0),t+2},S7.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,2,65535,0),S7.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Q7(this,e,t,!1),t+2},S7.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,4,4294967295,0),S7.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):X7(this,e,t,!0),t+4},S7.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,4,4294967295,0),S7.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):X7(this,e,t,!1),t+4},S7.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);J7(this,e,t,n,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<n&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},S7.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);J7(this,e,t,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+n},S7.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,1,127,-128),S7.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},S7.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,2,32767,-32768),S7.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Q7(this,e,t,!0),t+2},S7.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,2,32767,-32768),S7.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Q7(this,e,t,!1),t+2},S7.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,4,2147483647,-2147483648),S7.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):X7(this,e,t,!0),t+4},S7.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||J7(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),S7.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):X7(this,e,t,!1),t+4},S7.prototype.writeFloatLE=function(e,t,n){return t9(this,e,t,!0,n)},S7.prototype.writeFloatBE=function(e,t,n){return t9(this,e,t,!1,n)},S7.prototype.writeDoubleLE=function(e,t,n){return n9(this,e,t,!0,n)},S7.prototype.writeDoubleBE=function(e,t,n){return n9(this,e,t,!1,n)},S7.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!S7.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},S7.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!S7.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var s=O7(e)?e:o9(new S7(e,r).toString()),a=s.length;for(o=0;o<n-t;++o)this[o+t]=s[o%a]}return this};var r9=/[^+\/0-9A-Za-z-_]/g;function i9(e){return e<16?"0"+e.toString(16):e.toString(16)}function o9(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function s9(e){return function(e){var t,n,r,i,o,s;p7||m7();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new f7(3*a/4-o),r=o>0?a-4:a;var c=0;for(t=0,n=0;t<r;t+=4,n+=3)i=h7[e.charCodeAt(t)]<<18|h7[e.charCodeAt(t+1)]<<12|h7[e.charCodeAt(t+2)]<<6|h7[e.charCodeAt(t+3)],s[c++]=i>>16&255,s[c++]=i>>8&255,s[c++]=255&i;return 2===o?(i=h7[e.charCodeAt(t)]<<2|h7[e.charCodeAt(t+1)]>>4,s[c++]=255&i):1===o&&(i=h7[e.charCodeAt(t)]<<10|h7[e.charCodeAt(t+1)]<<4|h7[e.charCodeAt(t+2)]>>2,s[c++]=i>>8&255,s[c++]=255&i),s}(function(e){if((e=(t=e,t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(r9,"")).length<2)return"";for(var t;e.length%4!=0;)e+="=";return e}(e))}function a9(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function c9(e){return null!=e&&(!!e._isBuffer||l9(e)||"function"==typeof(t=e).readFloatLE&&"function"==typeof t.slice&&l9(t.slice(0,0)));var t}function l9(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var u9=Object.freeze({__proto__:null,Buffer:S7,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),S7.alloc(+e)},isBuffer:c9,kMaxLength:_7}),d9="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};function h9(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function f9(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var p9={},m9={},g9={};function y9(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function b9(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function v9(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function w9(e,...t){if(!v9(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function E9(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("hash must be wrapped by utils.wrapConstructor");y9(e.outputLen),y9(e.blockLen)}function _9(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function x9(e,t){w9(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(g9,"__esModule",{value:!0}),g9.isBytes=v9,g9.number=y9,g9.bool=b9,g9.bytes=w9,g9.hash=E9,g9.exists=_9,g9.output=x9;const k9={number:y9,bool:b9,bytes:w9,hash:E9,exists:_9,output:x9};g9.default=k9,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=e.createView=e.u32=e.u16=e.u8=void 0,e.bytesToHex=r,e.hexToBytes=s,e.hexToNumber=a,e.bytesToNumberBE=function(e){return a(r(e))},e.numberToBytesBE=function(e,t){return s(e.toString(16).padStart(2*t,"0"))},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);const t=Date.now()-i;t>=0&&t<n||(await(0,e.nextTick)(),i+=t)}},e.utf8ToBytes=c,e.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},e.toBytes=function(e){if("string"==typeof e)e=c(e);else{if(!(0,t.isBytes)(e))throw new Error("Uint8Array expected, got "+typeof e);e=u(e)}return e},e.concatBytes=function(...e){let n=0;for(let i=0;i<e.length;i++){const r=e[i];(0,t.bytes)(r),n+=r.length}const r=new Uint8Array(n);for(let t=0,i=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.length}return r},e.checkOpts=function(e,t){if(null==t||"object"!=typeof t)throw new Error("options must be defined");return Object.assign(e,t)},e.equalBytes=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},e.setBigUint64=l,e.u64Lengths=function(t,n){const r=new Uint8Array(16),i=(0,e.createView)(r);return l(i,0,BigInt(n?n.length:0),!0),l(i,8,BigInt(t.length),!0),r},e.isAligned32=function(e){return e.byteOffset%4==0},e.copyBytes=u,e.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)};const t=g9;if(e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),e.u16=e=>new Uint16Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/2)),e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function r(e){(0,t.bytes)(e);let r="";for(let t=0;t<e.length;t++)r+=n[e[t]];return r}const i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(e){return e>=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}function s(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const t=o(e.charCodeAt(s)),n=o(e.charCodeAt(s+1));if(void 0===t||void 0===n){const t=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+s)}r[i]=16*t+n}return r}function a(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function c(e){if("string"!=typeof e)throw new Error("string expected, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function l(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)}function u(e){return Uint8Array.from(e)}e.nextTick=async()=>{},e.Hash=class{},e.wrapCipher=(e,t)=>(Object.assign(t,e),t)}(m9);var S9={},C9={};Object.defineProperty(C9,"__esModule",{value:!0}),C9.AEAD_TAG_LENGTH=C9.XCHACHA20_NONCE_LENGTH=C9.CURVE25519_PUBLIC_KEY_SIZE=C9.ETH_PUBLIC_KEY_SIZE=C9.UNCOMPRESSED_PUBLIC_KEY_SIZE=C9.COMPRESSED_PUBLIC_KEY_SIZE=C9.SECRET_KEY_LENGTH=void 0,C9.SECRET_KEY_LENGTH=32,C9.COMPRESSED_PUBLIC_KEY_SIZE=33,C9.UNCOMPRESSED_PUBLIC_KEY_SIZE=65,C9.ETH_PUBLIC_KEY_SIZE=64,C9.CURVE25519_PUBLIC_KEY_SIZE=32,C9.XCHACHA20_NONCE_LENGTH=24,C9.AEAD_TAG_LENGTH=16,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ephemeralKeySize=e.symmetricNonceLength=e.symmetricAlgorithm=e.isHkdfKeyCompressed=e.isEphemeralKeyCompressed=e.ellipticCurve=e.ECIES_CONFIG=void 0;var t=C9;e.ECIES_CONFIG=new function(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16},e.ellipticCurve=function(){return e.ECIES_CONFIG.ellipticCurve},e.isEphemeralKeyCompressed=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed},e.isHkdfKeyCompressed=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed},e.symmetricAlgorithm=function(){return e.ECIES_CONFIG.symmetricAlgorithm},e.symmetricNonceLength=function(){return e.ECIES_CONFIG.symmetricNonceLength},e.ephemeralKeySize=function(){var n={secp256k1:e.ECIES_CONFIG.isEphemeralKeyCompressed?t.COMPRESSED_PUBLIC_KEY_SIZE:t.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:t.CURVE25519_PUBLIC_KEY_SIZE,ed25519:t.CURVE25519_PUBLIC_KEY_SIZE};if(e.ECIES_CONFIG.ellipticCurve in n)return n[e.ECIES_CONFIG.ellipticCurve];throw new Error("Not implemented")}}(S9);var I9={},A9={},P9={},M9={},O9={},T9={};Object.defineProperty(T9,"__esModule",{value:!0}),T9.crypto=void 0,T9.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=i,e.getWebcryptoSubtle=o,e.managedNonce=function(e){return(0,n.number)(e.nonceLength),(t,...n)=>({encrypt(o,...s){const{nonceLength:a}=e,c=i(a),l=e(t,c,...n).encrypt(o,...s),u=(0,r.concatBytes)(c,l);return l.fill(0),u},decrypt(r,...i){const{nonceLength:o}=e,s=r.subarray(0,o),a=r.subarray(o);return e(t,s,...n).decrypt(a,...i)}})};const t=T9,n=g9,r=m9;function i(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));if(t.crypto&&"function"==typeof t.crypto.randomBytes)return t.crypto.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}function o(){if(t.crypto&&"object"==typeof t.crypto.subtle&&null!=t.crypto.subtle)return t.crypto.subtle;throw new Error("crypto.subtle must be defined")}e.utils={async encrypt(e,t,n,r){const i=o(),s=await i.importKey("raw",e,t,!0,["encrypt"]),a=await i.encrypt(n,s,r);return new Uint8Array(a)},async decrypt(e,t,n,r){const i=o(),s=await i.importKey("raw",e,t,!0,["decrypt"]),a=await i.decrypt(n,s,r);return new Uint8Array(a)}};const s="AES-CBC",a="AES-CTR",c="AES-GCM";function l(t){return(r,i,o)=>{(0,n.bytes)(r),(0,n.bytes)(i);const l={name:t,length:8*r.length},u=function(e,t,n){if(e===s)return{name:s,iv:t};if(e===a)return{name:a,counter:t,length:64};if(e===c)return n?{name:c,iv:t,additionalData:n}:{name:c,iv:t};throw new Error("unknown aes block mode")}(t,i,o);return{encrypt:t=>((0,n.bytes)(t),e.utils.encrypt(r,l,u,t)),decrypt:t=>((0,n.bytes)(t),e.utils.decrypt(r,l,u,t))}}}e.cbc=l(s),e.ctr=l(a),e.gcm=l(c)}(O9);var R9={},N9={},L9={},B9={};function j9(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function D9(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function U9(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function F9(e,...t){if(!U9(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function $9(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");j9(e.outputLen),j9(e.blockLen)}function z9(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function H9(e,t){F9(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.defineProperty(B9,"__esModule",{value:!0}),B9.isBytes=U9,B9.number=j9,B9.bool=D9,B9.bytes=F9,B9.hash=$9,B9.exists=z9,B9.output=H9;const q9={number:j9,bool:D9,bytes:F9,hash:$9,exists:z9,output:H9};B9.default=q9;var W9={},K9={};Object.defineProperty(K9,"__esModule",{value:!0}),K9.crypto=void 0,K9.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=void 0,e.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name},e.byteSwap32=function(t){for(let n=0;n<t.length;n++)t[n]=(0,e.byteSwap)(t[n])},e.bytesToHex=function(e){(0,n.bytes)(e);let t="";for(let n=0;n<e.length;n++)t+=r[e[n]];return t},e.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const t=o(e.charCodeAt(s)),n=o(e.charCodeAt(s+1));if(void 0===t||void 0===n){const t=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+s)}r[i]=16*t+n}return r},e.asyncLoop=async function(t,n,r){let i=Date.now();for(let o=0;o<t;o++){r(o);const t=Date.now()-i;t>=0&&t<n||(await(0,e.nextTick)(),i+=t)}},e.utf8ToBytes=s,e.toBytes=a,e.concatBytes=function(...e){let t=0;for(let i=0;i<e.length;i++){const r=e[i];(0,n.bytes)(r),t+=r.length}const r=new Uint8Array(t);for(let n=0,i=0;n<e.length;n++){const t=e[n];r.set(t,i),i+=t.length}return r},e.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!==c.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)},e.wrapConstructor=function(e){const t=t=>e().update(a(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(a(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(a(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));if(t.crypto&&"function"==typeof t.crypto.randomBytes)return t.crypto.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")};const t=K9,n=B9;e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),e.rotr=(e,t)=>e<<32-t|e>>>t,e.rotl=(e,t)=>e<<t|e>>>32-t>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],e.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,e.byteSwapIfBE=e.isLE?e=>e:t=>(0,e.byteSwap)(t);const r=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(e){return e>=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}function s(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function a(e){return"string"==typeof e&&(e=s(e)),(0,n.bytes)(e),e}e.nextTick=async()=>{},e.Hash=class{clone(){return this._cloneInto()}};const c={}.toString}(W9),Object.defineProperty(L9,"__esModule",{value:!0}),L9.HashMD=L9.Maj=L9.Chi=void 0;const G9=B9,V9=W9;L9.Chi=(e,t,n)=>e&t^~e&n,L9.Maj=(e,t,n)=>e&t^e&n^t&n,L9.HashMD=class extends V9.Hash{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,V9.createView)(this.buffer)}update(e){(0,G9.exists)(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=(0,V9.toBytes)(e)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0);else{const t=(0,V9.createView)(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,G9.exists)(this),(0,G9.output)(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let u=o;u<r;u++)t[u]=0;!function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=(0,V9.createView)(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<c;u++)s.setUint32(4*u,l[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.length=r,e.pos=s,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(n),e}};var Z9={};Object.defineProperty(Z9,"__esModule",{value:!0}),Z9.add5L=Z9.add5H=Z9.add4H=Z9.add4L=Z9.add3H=Z9.add3L=Z9.rotlBL=Z9.rotlBH=Z9.rotlSL=Z9.rotlSH=Z9.rotr32L=Z9.rotr32H=Z9.rotrBL=Z9.rotrBH=Z9.rotrSL=Z9.rotrSH=Z9.shrSL=Z9.shrSH=Z9.toBig=void 0,Z9.fromBig=Q9,Z9.split=X9,Z9.add=fee;const Y9=BigInt(2**32-1),J9=BigInt(32);function Q9(e,t=!1){return t?{h:Number(e&Y9),l:Number(e>>J9&Y9)}:{h:0|Number(e>>J9&Y9),l:0|Number(e&Y9)}}function X9(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=Q9(e[i],t);[n[i],r[i]]=[o,s]}return[n,r]}const eee=(e,t)=>BigInt(e>>>0)<<J9|BigInt(t>>>0);Z9.toBig=eee;const tee=(e,t,n)=>e>>>n;Z9.shrSH=tee;const nee=(e,t,n)=>e<<32-n|t>>>n;Z9.shrSL=nee;const ree=(e,t,n)=>e>>>n|t<<32-n;Z9.rotrSH=ree;const iee=(e,t,n)=>e<<32-n|t>>>n;Z9.rotrSL=iee;const oee=(e,t,n)=>e<<64-n|t>>>n-32;Z9.rotrBH=oee;const see=(e,t,n)=>e>>>n-32|t<<64-n;Z9.rotrBL=see;const aee=(e,t)=>t;Z9.rotr32H=aee;const cee=(e,t)=>e;Z9.rotr32L=cee;const lee=(e,t,n)=>e<<n|t>>>32-n;Z9.rotlSH=lee;const uee=(e,t,n)=>t<<n|e>>>32-n;Z9.rotlSL=uee;const dee=(e,t,n)=>t<<n-32|e>>>64-n;Z9.rotlBH=dee;const hee=(e,t,n)=>e<<n-32|t>>>64-n;function fee(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}}Z9.rotlBL=hee;const pee=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);Z9.add3L=pee;const mee=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;Z9.add3H=mee;const gee=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);Z9.add4L=gee;const yee=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;Z9.add4H=yee;const bee=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);Z9.add5L=bee;const vee=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0;Z9.add5H=vee;const wee={fromBig:Q9,split:X9,toBig:eee,shrSH:tee,shrSL:nee,rotrSH:ree,rotrSL:iee,rotrBH:oee,rotrBL:see,rotr32H:aee,rotr32L:cee,rotlSH:lee,rotlSL:uee,rotlBH:dee,rotlBL:hee,add:fee,add3L:pee,add3H:mee,add4L:gee,add4H:yee,add5H:vee,add5L:bee};Z9.default=wee,Object.defineProperty(N9,"__esModule",{value:!0}),N9.sha384=N9.sha512_256=N9.sha512_224=N9.sha512=N9.SHA384=N9.SHA512_256=N9.SHA512_224=N9.SHA512=void 0;const Eee=L9,_ee=Z9,xee=W9,[kee,See]=_ee.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Cee=new Uint32Array(80),Iee=new Uint32Array(80);class Aee extends Eee.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:l,Fh:u,Fl:d,Gh:h,Gl:f,Hh:p,Hl:m}=this;return[e,t,n,r,i,o,s,a,c,l,u,d,h,f,p,m]}set(e,t,n,r,i,o,s,a,c,l,u,d,h,f,p,m){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|d,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|m}process(e,t){for(let b=0;b<16;b++,t+=4)Cee[b]=e.getUint32(t),Iee[b]=e.getUint32(t+=4);for(let b=16;b<80;b++){const e=0|Cee[b-15],t=0|Iee[b-15],n=_ee.default.rotrSH(e,t,1)^_ee.default.rotrSH(e,t,8)^_ee.default.shrSH(e,t,7),r=_ee.default.rotrSL(e,t,1)^_ee.default.rotrSL(e,t,8)^_ee.default.shrSL(e,t,7),i=0|Cee[b-2],o=0|Iee[b-2],s=_ee.default.rotrSH(i,o,19)^_ee.default.rotrBH(i,o,61)^_ee.default.shrSH(i,o,6),a=_ee.default.rotrSL(i,o,19)^_ee.default.rotrBL(i,o,61)^_ee.default.shrSL(i,o,6),c=_ee.default.add4L(r,a,Iee[b-7],Iee[b-16]),l=_ee.default.add4H(c,n,s,Cee[b-7],Cee[b-16]);Cee[b]=0|l,Iee[b]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:l,Eh:u,El:d,Fh:h,Fl:f,Gh:p,Gl:m,Hh:g,Hl:y}=this;for(let b=0;b<80;b++){const e=_ee.default.rotrSH(u,d,14)^_ee.default.rotrSH(u,d,18)^_ee.default.rotrBH(u,d,41),t=_ee.default.rotrSL(u,d,14)^_ee.default.rotrSL(u,d,18)^_ee.default.rotrBL(u,d,41),v=u&h^~u&p,w=d&f^~d&m,E=_ee.default.add5L(y,t,w,See[b],Iee[b]),_=_ee.default.add5H(E,g,e,v,kee[b],Cee[b]),x=0|E,k=_ee.default.rotrSH(n,r,28)^_ee.default.rotrBH(n,r,34)^_ee.default.rotrBH(n,r,39),S=_ee.default.rotrSL(n,r,28)^_ee.default.rotrBL(n,r,34)^_ee.default.rotrBL(n,r,39),C=n&i^n&s^i&s,I=r&o^r&a^o&a;g=0|p,y=0|m,p=0|h,m=0|f,h=0|u,f=0|d,({h:u,l:d}=_ee.default.add(0|c,0|l,0|_,0|x)),c=0|s,l=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const A=_ee.default.add3L(x,S,I);n=_ee.default.add3H(A,_,k,C),r=0|A}({h:n,l:r}=_ee.default.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=_ee.default.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=_ee.default.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:l}=_ee.default.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:d}=_ee.default.add(0|this.Eh,0|this.El,0|u,0|d)),({h:h,l:f}=_ee.default.add(0|this.Fh,0|this.Fl,0|h,0|f)),({h:p,l:m}=_ee.default.add(0|this.Gh,0|this.Gl,0|p,0|m)),({h:g,l:y}=_ee.default.add(0|this.Hh,0|this.Hl,0|g,0|y)),this.set(n,r,i,o,s,a,c,l,u,d,h,f,p,m,g,y)}roundClean(){Cee.fill(0),Iee.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}N9.SHA512=Aee;class Pee extends Aee{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}N9.SHA512_224=Pee;class Mee extends Aee{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}N9.SHA512_256=Mee;class Oee extends Aee{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}N9.SHA384=Oee,N9.sha512=(0,xee.wrapConstructor)(()=>new Aee),N9.sha512_224=(0,xee.wrapConstructor)(()=>new Pee),N9.sha512_256=(0,xee.wrapConstructor)(()=>new Mee),N9.sha384=(0,xee.wrapConstructor)(()=>new Oee);var Tee={},Ree={},Nee={},Lee={};Object.defineProperty(Lee,"__esModule",{value:!0}),Lee.notImplemented=Lee.bitMask=void 0,Lee.isBytes=Uee,Lee.abytes=Fee,Lee.abool=function(e,t){if("boolean"!=typeof t)throw new Error(`${e} must be valid boolean, got "${t}".`)},Lee.bytesToHex=zee,Lee.numberToHexUnpadded=Hee,Lee.hexToNumber=qee,Lee.hexToBytes=Gee,Lee.bytesToNumberBE=function(e){return qee(zee(e))},Lee.bytesToNumberLE=function(e){return Fee(e),qee(zee(Uint8Array.from(e).reverse()))},Lee.numberToBytesBE=Vee,Lee.numberToBytesLE=function(e,t){return Vee(e,t).reverse()},Lee.numberToVarBytesBE=function(e){return Gee(Hee(e))},Lee.ensureBytes=function(e,t,n){let r;if("string"==typeof t)try{r=Gee(t)}catch(o){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${o}`)}else{if(!Uee(t))throw new Error(`${e} must be hex string or Uint8Array`);r=Uint8Array.from(t)}const i=r.length;if("number"==typeof n&&i!==n)throw new Error(`${e} expected ${n} bytes, got ${i}`);return r},Lee.concatBytes=Zee,Lee.equalBytes=function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n},Lee.utf8ToBytes=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))},Lee.inRange=Jee,Lee.aInRange=function(e,t,n,r){if(!Jee(t,n,r))throw new Error(`expected valid ${e}: ${n} <= n < ${r}, got ${typeof t} ${t}`)},Lee.bitLen=function(e){let t;for(t=0;e>Bee;e>>=jee,t+=1);return t},Lee.bitGet=function(e,t){return e>>BigInt(t)&jee},Lee.bitSet=function(e,t,n){return e|(n?jee:Bee)<<BigInt(t)},Lee.createHmacDrbg=function(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=Qee(e),i=Qee(e),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...e)=>n(i,r,...e),c=(e=Qee())=>{i=a(Xee([0]),e),r=a(),0!==e.length&&(i=a(Xee([1]),e),r=a())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e<t;){r=a();const t=r.slice();n.push(t),e+=r.length}return Zee(...n)};return(e,t)=>{let n;for(s(),c(e);!(n=t(l()));)c();return s(),n}},Lee.validateObject=function(e,t,n={}){const r=(t,n,r)=>{const i=ete[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const o=e[t];if(!(r&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${n}`)};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return e},Lee.memoized=function(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(void 0!==i)return i;const o=e(n,...r);return t.set(n,o),o}};const Bee=BigInt(0),jee=BigInt(1),Dee=BigInt(2);function Uee(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function Fee(e){if(!Uee(e))throw new Error("Uint8Array expected")}const $ee=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function zee(e){Fee(e);let t="";for(let n=0;n<e.length;n++)t+=$ee[e[n]];return t}function Hee(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function qee(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}const Wee={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Kee(e){return e>=Wee._0&&e<=Wee._9?e-Wee._0:e>=Wee._A&&e<=Wee._F?e-(Wee._A-10):e>=Wee._a&&e<=Wee._f?e-(Wee._a-10):void 0}function Gee(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const t=Kee(e.charCodeAt(o)),n=Kee(e.charCodeAt(o+1));if(void 0===t||void 0===n){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}r[i]=16*t+n}return r}function Vee(e,t){return Gee(e.toString(16).padStart(2*t,"0"))}function Zee(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];Fee(n),t+=n.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const t=e[r];n.set(t,i),i+=t.length}return n}const Yee=e=>"bigint"==typeof e&&Bee<=e;function Jee(e,t,n){return Yee(e)&&Yee(t)&&Yee(n)&&t<=e&&e<n}Lee.bitMask=e=>(Dee<<BigInt(e-1))-jee;const Qee=e=>new Uint8Array(e),Xee=e=>Uint8Array.from(e),ete={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||Uee(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};Lee.notImplemented=()=>{throw new Error("not implemented")},Object.defineProperty(Nee,"__esModule",{value:!0}),Nee.isNegativeLE=void 0,Nee.mod=lte,Nee.pow=ute,Nee.pow2=function(e,t,n){let r=e;for(;t-- >nte;)r*=r,r%=n;return r},Nee.invert=dte,Nee.tonelliShanks=hte,Nee.FpSqrt=fte,Nee.validateField=function(e){const t=pte.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,tte.validateObject)(e,t)},Nee.FpPow=mte,Nee.FpInvertBatch=gte,Nee.FpDiv=function(e,t,n){return e.mul(t,"bigint"==typeof n?dte(n,e.ORDER):e.inv(n))},Nee.FpLegendre=yte,Nee.FpIsSquare=function(e){const t=yte(e.ORDER);return n=>{const r=t(e,n);return e.eql(r,e.ZERO)||e.eql(r,e.ONE)}},Nee.nLength=bte,Nee.Field=function(e,t,n=!1,r={}){if(e<=nte)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=bte(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=fte(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:(0,tte.bitMask)(i),ZERO:nte,ONE:rte,create:t=>lte(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return nte<=t&&t<e},is0:e=>e===nte,isOdd:e=>(e&rte)===rte,neg:t=>lte(-t,e),eql:(e,t)=>e===t,sqr:t=>lte(t*t,e),add:(t,n)=>lte(t+n,e),sub:(t,n)=>lte(t-n,e),mul:(t,n)=>lte(t*n,e),pow:(e,t)=>mte(a,e,t),div:(t,n)=>lte(t*dte(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>dte(t,e),sqrt:r.sqrt||(e=>s(a,e)),invertBatch:e=>gte(a,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?(0,tte.numberToBytesLE)(e,o):(0,tte.numberToBytesBE)(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return n?(0,tte.bytesToNumberLE)(e):(0,tte.bytesToNumberBE)(e)}});return Object.freeze(a)},Nee.FpSqrtOdd=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?n:e.neg(n)},Nee.FpSqrtEven=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?e.neg(n):n},Nee.hashToPrivateScalar=function(e,t,n=!1){const r=(e=(0,tte.ensureBytes)("privateHash",e)).length,i=bte(t).nByteLength+8;if(i<24||r<i||r>1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${r}`);return lte(n?(0,tte.bytesToNumberLE)(e):(0,tte.bytesToNumberBE)(e),t-rte)+rte},Nee.getFieldBytesLength=vte,Nee.getMinHashLength=wte,Nee.mapHashToField=function(e,t,n=!1){const r=e.length,i=vte(t),o=wte(t);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=lte(n?(0,tte.bytesToNumberBE)(e):(0,tte.bytesToNumberLE)(e),t-rte)+rte;return n?(0,tte.numberToBytesLE)(s,i):(0,tte.numberToBytesBE)(s,i)};const tte=Lee,nte=BigInt(0),rte=BigInt(1),ite=BigInt(2),ote=BigInt(3),ste=BigInt(4),ate=BigInt(5),cte=BigInt(8);function lte(e,t){const n=e%t;return n>=nte?n:t+n}function ute(e,t,n){if(n<=nte||t<nte)throw new Error("Expected power/modulo > 0");if(n===rte)return nte;let r=rte;for(;t>nte;)t&rte&&(r=r*e%n),e=e*e%n,t>>=rte;return r}function dte(e,t){if(e===nte||t<=nte)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=lte(e,t),r=t,i=nte,o=rte;for(;n!==nte;){const e=r%n,t=i-o*(r/n);r=n,n=e,i=o,o=t}if(r!==rte)throw new Error("invert: does not exist");return lte(i,t)}function hte(e){const t=(e-rte)/ite;let n,r,i;for(n=e-rte,r=0;n%ite===nte;n/=ite,r++);for(i=ite;i<e&&ute(i,t,e)!==e-rte;i++);if(1===r){const t=(e+rte)/ste;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}const o=(n+rte)/ite;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=r,c=e.pow(e.mul(e.ONE,i),n),l=e.pow(s,o),u=e.pow(s,n);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(u);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const n=e.pow(c,rte<<BigInt(a-t-1));c=e.sqr(n),l=e.mul(l,n),u=e.mul(u,c),a=t}return l}}function fte(e){if(e%ste===ote){const t=(e+rte)/ste;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%cte===ate){const t=(e-ate)/cte;return function(e,n){const r=e.mul(n,ite),i=e.pow(r,t),o=e.mul(n,i),s=e.mul(e.mul(o,ite),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),n))throw new Error("Cannot find square root");return a}}return hte(e)}BigInt(9),BigInt(16),Nee.isNegativeLE=(e,t)=>(lte(e,t)&rte)===rte;const pte=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function mte(e,t,n){if(n<nte)throw new Error("Expected power > 0");if(n===nte)return e.ONE;if(n===rte)return t;let r=e.ONE,i=t;for(;n>nte;)n&rte&&(r=e.mul(r,i)),i=e.sqr(i),n>>=rte;return r}function gte(e,t){const n=new Array(t.length),r=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),i=e.inv(r);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),i),n}function yte(e){const t=(e-rte)/ite;return(e,n)=>e.pow(n,t)}function bte(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function vte(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function wte(e){const t=vte(e);return t+Math.ceil(t/2)}Object.defineProperty(Ree,"__esModule",{value:!0}),Ree.wNAF=function(e,t){const n=(e,t)=>{const n=t.negate();return e?n:t},r=e=>{if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error(`Wrong window size=${e}, should be [1..${t}]`)},i=e=>(r(e),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;for(;n>xte;)n&kte&&(r=r.add(i)),i=i.double(),n>>=kte;return r},precomputeWindow(e,t){const{windows:n,windowSize:r}=i(t),o=[];let s=e,a=s;for(let i=0;i<n;i++){a=s,o.push(a);for(let e=1;e<r;e++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(t,r,o){const{windows:s,windowSize:a}=i(t);let c=e.ZERO,l=e.BASE;const u=BigInt(2**t-1),d=2**t,h=BigInt(t);for(let e=0;e<s;e++){const t=e*a;let i=Number(o&u);o>>=h,i>a&&(i-=d,o+=kte);const s=t,f=t+Math.abs(i)-1,p=e%2!=0,m=i<0;0===i?l=l.add(n(p,r[s])):c=c.add(n(m,r[f]))}return{p:c,f:l}},wNAFCached(e,t,n){const r=Cte.get(e)||1;let i=Ste.get(e);return i||(i=this.precomputeWindow(e,r),1!==r&&Ste.set(e,n(i))),this.wNAF(r,i,t)},setWindowSize(e,t){r(t),Cte.set(e,t),Ste.delete(e)}}},Ree.pippenger=function(e,t,n,r){if(!Array.isArray(n)||!Array.isArray(r)||r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");r.forEach((e,n)=>{if(!t.isValid(e))throw new Error(`wrong scalar at index ${n}`)}),n.forEach((t,n)=>{if(!(t instanceof e))throw new Error(`wrong point at index ${n}`)});const i=(0,_te.bitLen)(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,s=(1<<o)-1,a=new Array(s+1).fill(e.ZERO),c=Math.floor((t.BITS-1)/o)*o;let l=e.ZERO;for(let u=c;u>=0;u-=o){a.fill(e.ZERO);for(let e=0;e<r.length;e++){const t=r[e],i=Number(t>>BigInt(u)&BigInt(s));a[i]=a[i].add(n[e])}let t=e.ZERO;for(let n=a.length-1,r=e.ZERO;n>0;n--)r=r.add(a[n]),t=t.add(r);if(l=l.add(t),0!==u)for(let e=0;e<o;e++)l=l.double()}return l},Ree.validateBasic=function(e){return(0,Ete.validateField)(e.Fp),(0,_te.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,Ete.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})};const Ete=Nee,_te=Lee,xte=BigInt(0),kte=BigInt(1),Ste=new WeakMap,Cte=new WeakMap;Object.defineProperty(Tee,"__esModule",{value:!0}),Tee.twistedEdwards=function(e){const t=function(e){const t=(0,Ite.validateBasic)(e);return Pte.validateObject(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=t,l=Rte<<BigInt(8*a)-Tte,u=n.create,d=(0,Ate.Field)(t.n,t.nBitLength),h=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch(r){return{isValid:!1,value:Ote}}}),f=t.adjustScalarBytes||(e=>e),p=t.domain||((e,t,n)=>{if((0,Mte.abool)("phflag",n),t.length||n)throw new Error("Contexts/pre-hash are not supported");return e});function m(e,t){Pte.aInRange("coordinate "+e,t,Ote,l)}function g(e){if(!(e instanceof v))throw new Error("ExtendedPoint expected")}const y=(0,Mte.memoized)((e,t)=>{const{ex:r,ey:i,ez:o}=e,s=e.is0();null==t&&(t=s?Nte:n.inv(o));const a=u(r*t),c=u(i*t),l=u(o*t);if(s)return{x:Ote,y:Tte};if(l!==Tte)throw new Error("invZ was invalid");return{x:a,y:c}}),b=(0,Mte.memoized)(e=>{const{a:n,d:r}=t;if(e.is0())throw new Error("bad point: ZERO");const{ex:i,ey:o,ez:s,et:a}=e,c=u(i*i),l=u(o*o),d=u(s*s),h=u(d*d),f=u(c*n);if(u(d*u(f+l))!==u(h+u(r*u(c*l))))throw new Error("bad point: equation left != right (1)");if(u(i*o)!==u(s*a))throw new Error("bad point: equation left != right (2)");return!0});class v{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r,m("x",e),m("y",t),m("z",n),m("t",r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof v)throw new Error("extended point not allowed");const{x:t,y:n}=e||{};return m("x",t),m("y",n),new v(t,n,Tte,u(t*n))}static normalizeZ(e){const t=n.invertBatch(e.map(e=>e.ez));return e.map((e,n)=>e.toAffine(t[n])).map(v.fromAffine)}static msm(e,t){return(0,Ite.pippenger)(v,d,e,t)}_setWindowSize(e){_.setWindowSize(this,e)}assertValidity(){b(this)}equals(e){g(e);const{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=e,a=u(t*s),c=u(i*r),l=u(n*s),d=u(o*r);return a===c&&l===d}is0(){return this.equals(v.ZERO)}negate(){return new v(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:e}=t,{ex:n,ey:r,ez:i}=this,o=u(n*n),s=u(r*r),a=u(Rte*u(i*i)),c=u(e*o),l=n+r,d=u(u(l*l)-o-s),h=c+s,f=h-a,p=c-s,m=u(d*f),g=u(h*p),y=u(d*p),b=u(f*h);return new v(m,g,b,y)}add(e){g(e);const{a:n,d:r}=t,{ex:i,ey:o,ez:s,et:a}=this,{ex:c,ey:l,ez:d,et:h}=e;if(n===BigInt(-1)){const e=u((o-i)*(l+c)),t=u((o+i)*(l-c)),n=u(t-e);if(n===Ote)return this.double();const r=u(s*Rte*h),f=u(a*Rte*d),p=f+r,m=t+e,g=f-r,y=u(p*n),b=u(m*g),w=u(p*g),E=u(n*m);return new v(y,b,E,w)}const f=u(i*c),p=u(o*l),m=u(a*r*h),y=u(s*d),b=u((i+o)*(c+l)-f-p),w=y-m,E=y+m,_=u(p-n*f),x=u(b*w),k=u(E*_),S=u(b*_),C=u(w*E);return new v(x,k,C,S)}subtract(e){return this.add(e.negate())}wNAF(e){return _.wNAFCached(this,e,v.normalizeZ)}multiply(e){const t=e;Pte.aInRange("scalar",t,Tte,r);const{p:n,f:i}=this.wNAF(t);return v.normalizeZ([n,i])[0]}multiplyUnsafe(e){const t=e;return Pte.aInRange("scalar",t,Ote,r),t===Ote?E:this.equals(E)||t===Tte?this:this.equals(w)?this.wNAF(t).p:_.unsafeLadder(this,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return _.unsafeLadder(this,r).is0()}toAffine(e){return y(this,e)}clearCofactor(){const{h:e}=t;return e===Tte?this:this.multiplyUnsafe(e)}static fromHex(e,r=!1){const{d:i,a:o}=t,s=n.BYTES;e=(0,Mte.ensureBytes)("pointHex",e,s),(0,Mte.abool)("zip215",r);const a=e.slice(),c=e[s-1];a[s-1]=-129&c;const d=Pte.bytesToNumberLE(a),f=r?l:n.ORDER;Pte.aInRange("pointHex.y",d,Ote,f);const p=u(d*d),m=u(p-Tte),g=u(i*p-o);let{isValid:y,value:b}=h(m,g);if(!y)throw new Error("Point.fromHex: invalid y coordinate");const w=(b&Tte)===Tte,E=!!(128&c);if(!r&&b===Ote&&E)throw new Error("Point.fromHex: x=0 and x_0=1");return E!==w&&(b=u(-b)),v.fromAffine({x:b,y:d})}static fromPrivateKey(e){return S(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),r=Pte.numberToBytesLE(t,n.BYTES);return r[r.length-1]|=e&Tte?128:0,r}toHex(){return Pte.bytesToHex(this.toRawBytes())}}v.BASE=new v(t.Gx,t.Gy,Tte,u(t.Gx*t.Gy)),v.ZERO=new v(Ote,Tte,Tte,Ote);const{BASE:w,ZERO:E}=v,_=(0,Ite.wNAF)(v,8*a);function x(e){return(0,Ate.mod)(e,r)}function k(e){return x(Pte.bytesToNumberLE(e))}function S(e){const t=a;e=(0,Mte.ensureBytes)("private key",e,t);const n=(0,Mte.ensureBytes)("hashed private key",o(e),2*t),r=f(n.slice(0,t)),i=n.slice(t,2*t),s=k(r),c=w.multiply(s),l=c.toRawBytes();return{head:r,prefix:i,scalar:s,point:c,pointBytes:l}}function C(e=new Uint8Array,...t){const n=Pte.concatBytes(...t);return k(o(p(n,(0,Mte.ensureBytes)("context",e),!!i)))}const I=Lte;w._setWindowSize(8);return{CURVE:t,getPublicKey:function(e){return S(e).pointBytes},sign:function(e,t,o={}){e=(0,Mte.ensureBytes)("message",e),i&&(e=i(e));const{prefix:s,scalar:c,pointBytes:l}=S(t),u=C(o.context,s,e),d=w.multiply(u).toRawBytes(),h=x(u+C(o.context,d,l,e)*c);Pte.aInRange("signature.s",h,Ote,r);const f=Pte.concatBytes(d,Pte.numberToBytesLE(h,n.BYTES));return(0,Mte.ensureBytes)("result",f,2*a)},verify:function(e,t,r,o=I){const{context:s,zip215:a}=o,c=n.BYTES;e=(0,Mte.ensureBytes)("signature",e,2*c),t=(0,Mte.ensureBytes)("message",t),void 0!==a&&(0,Mte.abool)("zip215",a),i&&(t=i(t));const l=Pte.bytesToNumberLE(e.slice(c,2*c));let u,d,h;try{u=v.fromHex(r,a),d=v.fromHex(e.slice(0,c),a),h=w.multiplyUnsafe(l)}catch(p){return!1}if(!a&&u.isSmallOrder())return!1;const f=C(s,d.toRawBytes(),u.toRawBytes(),t);return d.add(u.multiplyUnsafe(f)).subtract(h).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:S,randomPrivateKey:()=>s(n.BYTES),precompute:(e=8,t=v.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}};const Ite=Ree,Ate=Nee,Pte=Lee,Mte=Lee,Ote=BigInt(0),Tte=BigInt(1),Rte=BigInt(2),Nte=BigInt(8),Lte={zip215:!0};var Bte={};Object.defineProperty(Bte,"__esModule",{value:!0}),Bte.expand_message_xmd=Hte,Bte.expand_message_xof=qte,Bte.hash_to_field=Wte,Bte.isogenyMap=function(e,t){const n=t.map(e=>Array.from(e).reverse());return(t,r)=>{const[i,o,s,a]=n.map(n=>n.reduce((n,r)=>e.add(e.mul(n,t),r)));return t=e.div(i,o),r=e.mul(r,e.div(s,a)),{x:t,y:r}}},Bte.createHasher=function(e,t,n){if("function"!=typeof t)throw new Error("mapToCurve() must be defined");return{hashToCurve(r,i){const o=Wte(r,2,{...n,DST:n.DST,...i}),s=e.fromAffine(t(o[0])),a=e.fromAffine(t(o[1])),c=s.add(a).clearCofactor();return c.assertValidity(),c},encodeToCurve(r,i){const o=Wte(r,1,{...n,DST:n.encodeDST,...i}),s=e.fromAffine(t(o[0])).clearCofactor();return s.assertValidity(),s},mapToCurve(n){if(!Array.isArray(n))throw new Error("mapToCurve: expected array of bigints");for(const e of n)if("bigint"!=typeof e)throw new Error(`mapToCurve: expected array of bigints, got ${e} in array`);const r=e.fromAffine(t(n)).clearCofactor();return r.assertValidity(),r}}};const jte=Nee,Dte=Lee,Ute=Dte.bytesToNumberBE;function Fte(e,t){if(zte(e),zte(t),e<0||e>=1<<8*t)throw new Error(`bad I2OSP call: value=${e} length=${t}`);const n=Array.from({length:t}).fill(0);for(let r=t-1;r>=0;r--)n[r]=255&e,e>>>=8;return new Uint8Array(n)}function $te(e,t){const n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e[r]^t[r];return n}function zte(e){if(!Number.isSafeInteger(e))throw new Error("number expected")}function Hte(e,t,n,r){(0,Dte.abytes)(e),(0,Dte.abytes)(t),zte(n),t.length>255&&(t=r((0,Dte.concatBytes)((0,Dte.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:i,blockLen:o}=r,s=Math.ceil(n/i);if(n>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");const a=(0,Dte.concatBytes)(t,Fte(t.length,1)),c=Fte(0,o),l=Fte(n,2),u=new Array(s),d=r((0,Dte.concatBytes)(c,e,l,Fte(0,1),a));u[0]=r((0,Dte.concatBytes)(d,Fte(1,1),a));for(let h=1;h<=s;h++){const e=[$te(d,u[h-1]),Fte(h+1,1),a];u[h]=r((0,Dte.concatBytes)(...e))}return(0,Dte.concatBytes)(...u).slice(0,n)}function qte(e,t,n,r,i){if((0,Dte.abytes)(e),(0,Dte.abytes)(t),zte(n),t.length>255){const e=Math.ceil(2*r/8);t=i.create({dkLen:e}).update((0,Dte.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(n>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:n}).update(e).update(Fte(n,2)).update(t).update(Fte(t.length,1)).digest()}function Wte(e,t,n){(0,Dte.validateObject)(n,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:r,k:i,m:o,hash:s,expand:a,DST:c}=n;(0,Dte.abytes)(e),zte(t);const l="string"==typeof c?(0,Dte.utf8ToBytes)(c):c,u=r.toString(2).length,d=Math.ceil((u+i)/8),h=t*o*d;let f;if("xmd"===a)f=Hte(e,l,h,s);else if("xof"===a)f=qte(e,l,h,i,s);else{if("_internal_pass"!==a)throw new Error('expand must be "xmd" or "xof"');f=e}const p=new Array(t);for(let m=0;m<t;m++){const e=new Array(o);for(let t=0;t<o;t++){const n=d*(t+m*o),i=f.subarray(n,n+d);e[t]=(0,jte.mod)(Ute(i),r)}p[m]=e}return p}var Kte={};Object.defineProperty(Kte,"__esModule",{value:!0}),Kte.montgomery=function(e){const t=(l=e,(0,Vte.validateObject)(l,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...l})),{P:n}=t,r=e=>(0,Gte.mod)(e,n),i=t.montgomeryBits,o=Math.ceil(i/8),s=t.nByteLength,a=t.adjustScalarBytes||(e=>e),c=t.powPminus2||(e=>(0,Gte.pow)(e,n-BigInt(2),n));var l;function u(e,t,n){const i=r(e*(t-n));return[t=r(t-i),n=r(n+i)]}const d=(t.a-BigInt(2))/BigInt(4);function h(e){return(0,Vte.numberToBytesLE)(r(e),o)}function f(e,t){const l=function(e,t){(0,Vte.aInRange)("u",e,Zte,n),(0,Vte.aInRange)("scalar",t,Zte,n);const o=t,s=e;let a,l=Yte,h=Zte,f=e,p=Yte,m=Zte;for(let n=BigInt(i-1);n>=Zte;n--){const e=o>>n&Yte;m^=e,a=u(m,l,f),l=a[0],f=a[1],a=u(m,h,p),h=a[0],p=a[1],m=e;const t=l+h,i=r(t*t),c=l-h,g=r(c*c),y=i-g,b=f+p,v=r((f-p)*t),w=r(b*c),E=v+w,_=v-w;f=r(E*E),p=r(s*r(_*_)),l=r(i*g),h=r(y*(i+r(d*y)))}a=u(m,l,f),l=a[0],f=a[1],a=u(m,h,p),h=a[0],p=a[1];const g=c(h);return r(l*g)}(function(e){const t=(0,Vte.ensureBytes)("u coordinate",e,o);return 32===s&&(t[31]&=127),(0,Vte.bytesToNumberLE)(t)}(t),function(e){const t=(0,Vte.ensureBytes)("scalar",e),n=t.length;if(n!==o&&n!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${n}`);return(0,Vte.bytesToNumberLE)(a(t))}(e));if(l===Zte)throw new Error("Invalid private or public key received");return h(l)}const p=h(t.Gu);function m(e){return f(e,p)}return{scalarMult:f,scalarMultBase:m,getSharedSecret:(e,t)=>f(e,t),getPublicKey:e=>m(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:p}};const Gte=Nee,Vte=Lee,Zte=BigInt(0),Yte=BigInt(1);!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hash_to_ristretto255=e.hashToRistretto255=e.RistrettoPoint=e.encodeToCurve=e.hashToCurve=e.edwardsToMontgomery=e.x25519=e.ed25519ph=e.ed25519ctx=e.ed25519=e.ED25519_TORSION_SUBGROUP=void 0,e.edwardsToMontgomeryPub=_,e.edwardsToMontgomeryPriv=function(e){const t=w.hash(e.subarray(0,32));return w.adjustScalarBytes(t).subarray(0,32)};const t=N9,n=W9,r=Tee,i=Bte,o=Nee,s=Kte,a=Lee,c=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),l=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),u=BigInt(0),d=BigInt(1),h=BigInt(2),f=BigInt(3),p=BigInt(5),m=BigInt(8);function g(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),s=c,a=e*e%s*e%s,l=(0,o.pow2)(a,h,s)*a%s,u=(0,o.pow2)(l,d,s)*e%s,f=(0,o.pow2)(u,p,s)*u%s,m=(0,o.pow2)(f,t,s)*f%s,g=(0,o.pow2)(m,n,s)*m%s,y=(0,o.pow2)(g,r,s)*g%s,b=(0,o.pow2)(y,i,s)*y%s,v=(0,o.pow2)(b,i,s)*y%s,w=(0,o.pow2)(v,t,s)*f%s;return{pow_p_5_8:(0,o.pow2)(w,h,s)*e%s,b2:a}}function y(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function b(e,t){const n=c,r=(0,o.mod)(t*t*t,n),i=g(e*(0,o.mod)(r*r*t,n)).pow_p_5_8;let s=(0,o.mod)(e*r*i,n);const a=(0,o.mod)(t*s*s,n),u=s,d=(0,o.mod)(s*l,n),h=a===e,f=a===(0,o.mod)(-e,n),p=a===(0,o.mod)(-e*l,n);return h&&(s=u),(f||p)&&(s=d),(0,o.isNegativeLE)(s,n)&&(s=(0,o.mod)(-s,n)),{isValid:h||f,value:s}}e.ED25519_TORSION_SUBGROUP=["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"];const v=(0,o.Field)(c,void 0,!0),w={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:v,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:m,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:t.sha512,randomBytes:n.randomBytes,adjustScalarBytes:y,uvRatio:b};function E(e,t,r){if(t.length>255)throw new Error("Context is too big");return(0,n.concatBytes)((0,n.utf8ToBytes)("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,t.length]),t,e)}function _(t){const{y:n}=e.ed25519.ExtendedPoint.fromHex(t),r=BigInt(1);return v.toBytes(v.create((r+n)*v.inv(r-n)))}e.ed25519=(0,r.twistedEdwards)(w),e.ed25519ctx=(0,r.twistedEdwards)({...w,domain:E}),e.ed25519ph=(0,r.twistedEdwards)(Object.assign({},w,{domain:E,prehash:t.sha512})),e.x25519=(0,s.montgomery)({P:c,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=c,{pow_p_5_8:n,b2:r}=g(e);return(0,o.mod)((0,o.pow2)(n,f,t)*r,t)},adjustScalarBytes:y,randomBytes:n.randomBytes}),e.edwardsToMontgomery=_;const x=(v.ORDER+f)/m,k=v.pow(h,x),S=v.sqrt(v.neg(v.ONE)),C=(0,o.FpSqrtEven)(v,v.neg(BigInt(486664)));const I=(0,i.createHasher)(e.ed25519.ExtendedPoint,e=>function(e){const{xMn:t,xMd:n,yMn:r,yMd:i}=function(e){const t=(v.ORDER-p)/m,n=BigInt(486662);let r=v.sqr(e);r=v.mul(r,h);let i=v.add(r,v.ONE),o=v.neg(n),s=v.sqr(i),a=v.mul(s,i),c=v.mul(r,n);c=v.mul(c,o),c=v.add(c,s),c=v.mul(c,o);let l=v.sqr(a);s=v.sqr(l),l=v.mul(l,a),l=v.mul(l,c),s=v.mul(s,l);let u=v.pow(s,t);u=v.mul(u,l);let f=v.mul(u,S);s=v.sqr(u),s=v.mul(s,a);let g=v.eql(s,c),y=v.cmov(f,u,g),b=v.mul(o,r),w=v.mul(u,e);w=v.mul(w,k);let E=v.mul(w,S),_=v.mul(c,r);s=v.sqr(w),s=v.mul(s,a);let x=v.eql(s,_),C=v.cmov(E,w,x);s=v.sqr(y),s=v.mul(s,a);let I=v.eql(s,c),A=v.cmov(b,o,I),P=v.cmov(C,y,I),M=v.isOdd(P);return P=v.cmov(P,v.neg(P),I!==M),{xMn:A,xMd:i,yMn:P,yMd:d}}(e);let o=v.mul(t,i);o=v.mul(o,C);let s=v.mul(n,r),a=v.sub(t,n),c=v.add(t,n),l=v.mul(s,c),u=v.eql(l,v.ZERO);o=v.cmov(o,v.ZERO,u),s=v.cmov(s,v.ONE,u),a=v.cmov(a,v.ONE,u),c=v.cmov(c,v.ONE,u);const f=v.invertBatch([s,c]);return{x:v.mul(o,f[0]),y:v.mul(a,f[1])}}(e[0]),{DST:"edwards25519_XMD:SHA-512_ELL2_RO_",encodeDST:"edwards25519_XMD:SHA-512_ELL2_NU_",p:v.ORDER,m:1,k:128,expand:"xmd",hash:t.sha512});function A(e){if(!(e instanceof D))throw new Error("RistrettoPoint expected")}e.hashToCurve=I.hashToCurve,e.encodeToCurve=I.encodeToCurve;const P=l,M=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),O=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),T=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),R=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),N=e=>b(d,e),L=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),B=t=>e.ed25519.CURVE.Fp.create((0,a.bytesToNumberLE)(t)&L);function j(t){const{d:n}=e.ed25519.CURVE,r=e.ed25519.CURVE.Fp.ORDER,i=e.ed25519.CURVE.Fp.create,s=i(P*t*t),a=i((s+d)*T);let c=BigInt(-1);const l=i((c-n*s)*i(s+n));let{isValid:u,value:h}=b(a,l),f=i(h*t);(0,o.isNegativeLE)(f,r)||(f=i(-f)),u||(h=f),u||(c=s);const p=i(c*(s-d)*R-l),m=h*h,g=i((h+h)*l),y=i(p*M),v=i(d-m),w=i(d+m);return new e.ed25519.ExtendedPoint(i(g*w),i(v*y),i(y*w),i(g*v))}class D{constructor(e){this.ep=e}static fromAffine(t){return new D(e.ed25519.ExtendedPoint.fromAffine(t))}static hashToCurve(e){e=(0,a.ensureBytes)("ristrettoHash",e,64);const t=j(B(e.slice(0,32))),n=j(B(e.slice(32,64)));return new D(t.add(n))}static fromHex(t){t=(0,a.ensureBytes)("ristrettoHex",t,32);const{a:n,d:r}=e.ed25519.CURVE,i=e.ed25519.CURVE.Fp.ORDER,s=e.ed25519.CURVE.Fp.create,c="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",l=B(t);if(!(0,a.equalBytes)((0,a.numberToBytesLE)(l,32),t)||(0,o.isNegativeLE)(l,i))throw new Error(c);const h=s(l*l),f=s(d+n*h),p=s(d-n*h),m=s(f*f),g=s(p*p),y=s(n*r*m-g),{isValid:b,value:v}=N(s(y*g)),w=s(v*p),E=s(v*w*y);let _=s((l+l)*w);(0,o.isNegativeLE)(_,i)&&(_=s(-_));const x=s(f*E),k=s(_*x);if(!b||(0,o.isNegativeLE)(k,i)||x===u)throw new Error(c);return new D(new e.ed25519.ExtendedPoint(_,x,d,k))}toRawBytes(){let{ex:t,ey:n,ez:r,et:i}=this.ep;const s=e.ed25519.CURVE.Fp.ORDER,c=e.ed25519.CURVE.Fp.create,l=c(c(r+n)*c(r-n)),u=c(t*n),d=c(u*u),{value:h}=N(c(l*d)),f=c(h*l),p=c(h*u),m=c(f*p*i);let g;if((0,o.isNegativeLE)(i*m,s)){let e=c(n*P),r=c(t*P);t=e,n=r,g=c(f*O)}else g=p;(0,o.isNegativeLE)(t*m,s)&&(n=c(-n));let y=c((r-n)*g);return(0,o.isNegativeLE)(y,s)&&(y=c(-y)),(0,a.numberToBytesLE)(y,32)}toHex(){return(0,a.bytesToHex)(this.toRawBytes())}toString(){return this.toHex()}equals(t){A(t);const{ex:n,ey:r}=this.ep,{ex:i,ey:o}=t.ep,s=e.ed25519.CURVE.Fp.create,a=s(n*o)===s(r*i),c=s(r*o)===s(n*i);return a||c}add(e){return A(e),new D(this.ep.add(e.ep))}subtract(e){return A(e),new D(this.ep.subtract(e.ep))}multiply(e){return new D(this.ep.multiply(e))}multiplyUnsafe(e){return new D(this.ep.multiplyUnsafe(e))}double(){return new D(this.ep.double())}negate(){return new D(this.ep.negate())}}e.RistrettoPoint=(D.BASE||(D.BASE=new D(e.ed25519.ExtendedPoint.BASE)),D.ZERO||(D.ZERO=new D(e.ed25519.ExtendedPoint.ZERO)),D),e.hashToRistretto255=(e,r)=>{const o=r.DST,s="string"==typeof o?(0,n.utf8ToBytes)(o):o,a=(0,i.expand_message_xmd)(e,s,64,t.sha512);return D.hashToCurve(a)},e.hash_to_ristretto255=e.hashToRistretto255}(R9);var Jte={},Qte={};Object.defineProperty(Qte,"__esModule",{value:!0}),Qte.sha224=Qte.sha256=Qte.SHA256=void 0;const Xte=L9,ene=W9,tne=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),nne=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rne=new Uint32Array(64);class ine extends Xte.HashMD{constructor(){super(64,32,8,!1),this.A=0|nne[0],this.B=0|nne[1],this.C=0|nne[2],this.D=0|nne[3],this.E=0|nne[4],this.F=0|nne[5],this.G=0|nne[6],this.H=0|nne[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)rne[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=rne[u-15],t=rne[u-2],n=(0,ene.rotr)(e,7)^(0,ene.rotr)(e,18)^e>>>3,r=(0,ene.rotr)(t,17)^(0,ene.rotr)(t,19)^t>>>10;rne[u]=r+rne[u-7]+n+rne[u-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:c,H:l}=this;for(let u=0;u<64;u++){const e=l+((0,ene.rotr)(s,6)^(0,ene.rotr)(s,11)^(0,ene.rotr)(s,25))+(0,Xte.Chi)(s,a,c)+tne[u]+rne[u]|0,t=((0,ene.rotr)(n,2)^(0,ene.rotr)(n,13)^(0,ene.rotr)(n,22))+(0,Xte.Maj)(n,r,i)|0;l=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,o,s,a,c,l)}roundClean(){rne.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}Qte.SHA256=ine;class one extends ine{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}Qte.sha256=(0,ene.wrapConstructor)(()=>new ine),Qte.sha224=(0,ene.wrapConstructor)(()=>new one);var sne={},ane={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=B9,n=W9;class r extends n.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,(0,t.hash)(e);const i=(0,n.toBytes)(r);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,s=new Uint8Array(o);s.set(i.length>o?e.create().update(i).digest():i);for(let t=0;t<s.length;t++)s[t]^=54;this.iHash.update(s),this.oHash=e.create();for(let t=0;t<s.length;t++)s[t]^=106;this.oHash.update(s),s.fill(0)}update(e){return(0,t.exists)(this),this.iHash.update(e),this}digestInto(e){(0,t.exists)(this),(0,t.bytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=r,e.hmac=(e,t,n)=>new r(e,t).update(n).digest(),e.hmac.create=(e,t)=>new r(e,t)}(ane);var cne={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=void 0,e.weierstrassPoints=f,e.weierstrass=function(s){const a=function(e){const n=(0,t.validateBasic)(e);return r.validateObject(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}(s),{Fp:u,n:d}=a,h=u.BYTES+1,p=2*u.BYTES+1;function m(e){return n.mod(e,d)}function g(e){return n.invert(e,d)}const{ProjectivePoint:y,normPrivateKeyToScalar:b,weierstrassEquation:v,isWithinCurveOrder:w}=f({...a,toBytes(e,t,n){const o=t.toAffine(),s=u.toBytes(o.x),a=r.concatBytes;return(0,i.abool)("isCompressed",n),n?a(Uint8Array.from([t.hasEvenY()?2:3]),s):a(Uint8Array.from([4]),s,u.toBytes(o.y))},fromBytes(e){const t=e.length,n=e[0],i=e.subarray(1);if(t!==h||2!==n&&3!==n){if(t===p&&4===n)return{x:u.fromBytes(i.subarray(0,u.BYTES)),y:u.fromBytes(i.subarray(u.BYTES,2*u.BYTES))};throw new Error(`Point of length ${t} was invalid. Expected ${h} compressed bytes or ${p} uncompressed bytes`)}{const e=r.bytesToNumberBE(i);if(!r.inRange(e,l,u.ORDER))throw new Error("Point is not on curve");const t=v(e);let s;try{s=u.sqrt(t)}catch(o){const e=o instanceof Error?": "+o.message:"";throw new Error("Point is not on curve"+e)}return!(1&~n)!=((s&l)===l)&&(s=u.neg(s)),{x:e,y:s}}}}),E=e=>r.bytesToHex(r.numberToBytesBE(e,a.nByteLength));function _(e){return e>d>>l}const x=(e,t,n)=>r.bytesToNumberBE(e.slice(t,n));class k{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const t=a.nByteLength;return e=(0,i.ensureBytes)("compactSignature",e,2*t),new k(x(e,0,t),x(e,t,2*t))}static fromDER(t){const{r:n,s:r}=e.DER.toSig((0,i.ensureBytes)("DER",t));return new k(n,r)}assertValidity(){r.aInRange("r",this.r,l,d),r.aInRange("s",this.s,l,d)}addRecoveryBit(e){return new k(this.r,this.s,e)}recoverPublicKey(e){const{r:t,s:n,recovery:r}=this,o=A((0,i.ensureBytes)("msgHash",e));if(null==r||![0,1,2,3].includes(r))throw new Error("recovery id invalid");const s=2===r||3===r?t+a.n:t;if(s>=u.ORDER)throw new Error("recovery id 2 or 3 invalid");const c=1&r?"03":"02",l=y.fromHex(c+E(s)),d=g(s),h=m(-o*d),f=m(n*d),p=y.BASE.multiplyAndAddUnsafe(l,h,f);if(!p)throw new Error("point at infinify");return p.assertValidity(),p}hasHighS(){return _(this.s)}normalizeS(){return this.hasHighS()?new k(this.r,m(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}const S={isValidPrivateKey(e){try{return b(e),!0}catch(t){return!1}},normPrivateKeyToScalar:b,randomPrivateKey:()=>{const e=n.getMinHashLength(a.n);return n.mapHashToField(a.randomBytes(e),a.n)},precompute:(e=8,t=y.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function C(e){const t=r.isBytes(e),n="string"==typeof e,i=(t||n)&&e.length;return t?i===h||i===p:n?i===2*h||i===2*p:e instanceof y}const I=a.bits2int||function(e){const t=r.bytesToNumberBE(e),n=8*e.length-a.nBitLength;return n>0?t>>BigInt(n):t},A=a.bits2int_modN||function(e){return m(I(e))},P=r.bitMask(a.nBitLength);function M(e){return r.aInRange(`num < 2^${a.nBitLength}`,e,c,P),r.numberToBytesBE(e,a.nByteLength)}const O={lowS:a.lowS,prehash:!1},T={lowS:a.lowS,prehash:!1};return y.BASE._setWindowSize(8),{CURVE:a,getPublicKey:function(e,t=!0){return y.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(C(e))throw new Error("first arg must be private key");if(!C(t))throw new Error("second arg must be public key");return y.fromHex(t).multiply(b(e)).toRawBytes(n)},sign:function(e,t,n=O){const{seed:s,k2sig:d}=function(e,t,n=O){if(["recovered","canonical"].some(e=>e in n))throw new Error("sign() legacy options not supported");const{hash:s,randomBytes:d}=a;let{lowS:h,prehash:f,extraEntropy:p}=n;null==h&&(h=!0),e=(0,i.ensureBytes)("msgHash",e),o(n),f&&(e=(0,i.ensureBytes)("prehashed msgHash",s(e)));const v=A(e),E=b(t),x=[M(E),M(v)];if(null!=p&&!1!==p){const e=!0===p?d(u.BYTES):p;x.push((0,i.ensureBytes)("extraEntropy",e))}const S=r.concatBytes(...x),C=v;return{seed:S,k2sig:function(e){const t=I(e);if(!w(t))return;const n=g(t),r=y.BASE.multiply(t).toAffine(),i=m(r.x);if(i===c)return;const o=m(n*m(C+i*E));if(o===c)return;let s=(r.x===i?0:2)|Number(r.y&l),a=o;return h&&_(o)&&(a=_(u=o)?m(-u):u,s^=1),new k(i,a,s);var u}}}(e,t,n),h=a;return r.createHmacDrbg(h.hash.outputLen,h.nByteLength,h.hmac)(s,d)},verify:function(t,n,s,c=T){var l;const u=t;if(n=(0,i.ensureBytes)("msgHash",n),s=(0,i.ensureBytes)("publicKey",s),"strict"in c)throw new Error("options.strict was renamed to lowS");o(c);const{lowS:d,prehash:h}=c;let f,p;try{if("string"==typeof u||r.isBytes(u))try{f=k.fromDER(u)}catch(C){if(!(C instanceof e.DER.Err))throw C;f=k.fromCompact(u)}else{if("object"!=typeof u||"bigint"!=typeof u.r||"bigint"!=typeof u.s)throw new Error("PARSE");{const{r:e,s:t}=u;f=new k(e,t)}}p=y.fromHex(s)}catch(I){if("PARSE"===I.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(d&&f.hasHighS())return!1;h&&(n=a.hash(n));const{r:b,s:v}=f,w=A(n),E=g(v),_=m(w*E),x=m(b*E),S=null==(l=y.BASE.multiplyAndAddUnsafe(p,_,x))?void 0:l.toAffine();if(!S)return!1;return m(S.x)===b},ProjectivePoint:y,Signature:k,utils:S}},e.SWUFpSqrtRatio=p,e.mapToCurveSimpleSWU=function(e,t){if(n.validateField(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const r=p(e,t.Z);if(!e.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let i,o,s,a,c,l,u,d;i=e.sqr(n),i=e.mul(i,t.Z),o=e.sqr(i),o=e.add(o,i),s=e.add(o,e.ONE),s=e.mul(s,t.B),a=e.cmov(t.Z,e.neg(o),!e.eql(o,e.ZERO)),a=e.mul(a,t.A),o=e.sqr(s),l=e.sqr(a),c=e.mul(l,t.A),o=e.add(o,c),o=e.mul(o,s),l=e.mul(l,a),c=e.mul(l,t.B),o=e.add(o,c),u=e.mul(i,s);const{isValid:h,value:f}=r(o,l);d=e.mul(i,n),d=e.mul(d,f),u=e.cmov(u,s,h),d=e.cmov(d,f,h);const p=e.isOdd(n)===e.isOdd(d);return d=e.cmov(e.neg(d),d,p),u=e.div(u,a),{x:u,y:d}}};const t=Ree,n=Nee,r=Lee,i=Lee;function o(e){void 0!==e.lowS&&(0,i.abool)("lowS",e.lowS),void 0!==e.prehash&&(0,i.abool)("prehash",e.prehash)}const{bytesToNumberBE:s,hexToBytes:a}=r;e.DER={Err:class extends Error{constructor(e=""){super(e)}},_tlv:{encode:(t,n)=>{const{Err:i}=e.DER;if(t<0||t>256)throw new i("tlv.encode: wrong tag");if(1&n.length)throw new i("tlv.encode: unpadded data");const o=n.length/2,s=r.numberToHexUnpadded(o);if(s.length/2&128)throw new i("tlv.encode: long form length too big");const a=o>127?r.numberToHexUnpadded(s.length/2|128):"";return`${r.numberToHexUnpadded(t)}${a}${s}${n}`},decode(t,n){const{Err:r}=e.DER;let i=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(n.length<2||n[i++]!==t)throw new r("tlv.decode: wrong tlv");const o=n[i++];let s=0;if(128&o){const e=127&o;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");const t=n.subarray(i,i+e);if(t.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===t[0])throw new r("tlv.decode(long): zero leftmost byte");for(const n of t)s=s<<8|n;if(i+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=o;const a=n.subarray(i,i+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:n.subarray(i+s)}}},_int:{encode(t){const{Err:n}=e.DER;if(t<c)throw new n("integer: negative integers are not allowed");let i=r.numberToHexUnpadded(t);if(8&Number.parseInt(i[0],16)&&(i="00"+i),1&i.length)throw new n("unexpected assertion");return i},decode(t){const{Err:n}=e.DER;if(128&t[0])throw new n("Invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new n("Invalid signature integer: unnecessary leading zero");return s(t)}},toSig(t){const{Err:n,_int:i,_tlv:o}=e.DER,s="string"==typeof t?a(t):t;r.abytes(s);const{v:c,l:l}=o.decode(48,s);if(l.length)throw new n("Invalid signature: left bytes after parsing");const{v:u,l:d}=o.decode(2,c),{v:h,l:f}=o.decode(2,d);if(f.length)throw new n("Invalid signature: left bytes after parsing");return{r:i.decode(u),s:i.decode(h)}},hexFromSig(t){const{_tlv:n,_int:r}=e.DER,i=`${n.encode(2,r.encode(t.r))}${n.encode(2,r.encode(t.s))}`;return n.encode(48,i)}};const c=BigInt(0),l=BigInt(1),u=BigInt(2),d=BigInt(3),h=BigInt(4);function f(e){const o=function(e){const n=(0,t.validateBasic)(e);r.validateObject(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:i,Fp:o,a:s}=n;if(i){if(!o.eql(s,o.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof i||"bigint"!=typeof i.beta||"function"!=typeof i.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...n})}(e),{Fp:s}=o,a=n.Field(o.n,o.nBitLength),u=o.toBytes||((e,t,n)=>{const i=t.toAffine();return r.concatBytes(Uint8Array.from([4]),s.toBytes(i.x),s.toBytes(i.y))}),h=o.fromBytes||(e=>{const t=e.subarray(1);return{x:s.fromBytes(t.subarray(0,s.BYTES)),y:s.fromBytes(t.subarray(s.BYTES,2*s.BYTES))}});function f(e){const{a:t,b:n}=o,r=s.sqr(e),i=s.mul(r,e);return s.add(s.add(i,s.mul(e,t)),n)}if(!s.eql(s.sqr(o.Gy),f(o.Gx)))throw new Error("bad generator point: equation left != right");function p(e){const{allowedPrivateKeyLengths:t,nByteLength:s,wrapPrivateKey:a,n:c}=o;if(t&&"bigint"!=typeof e){if(r.isBytes(e)&&(e=r.bytesToHex(e)),"string"!=typeof e||!t.includes(e.length))throw new Error("Invalid key");e=e.padStart(2*s,"0")}let u;try{u="bigint"==typeof e?e:r.bytesToNumberBE((0,i.ensureBytes)("private key",e,s))}catch(d){throw new Error(`private key must be ${s} bytes, hex or bigint, not ${typeof e}`)}return a&&(u=n.mod(u,c)),r.aInRange("private key",u,l,c),u}function m(e){if(!(e instanceof b))throw new Error("ProjectivePoint expected")}const g=(0,i.memoized)((e,t)=>{const{px:n,py:r,pz:i}=e;if(s.eql(i,s.ONE))return{x:n,y:r};const o=e.is0();null==t&&(t=o?s.ONE:s.inv(i));const a=s.mul(n,t),c=s.mul(r,t),l=s.mul(i,t);if(o)return{x:s.ZERO,y:s.ZERO};if(!s.eql(l,s.ONE))throw new Error("invZ was invalid");return{x:a,y:c}}),y=(0,i.memoized)(e=>{if(e.is0()){if(o.allowInfinityPoint&&!s.is0(e.py))return;throw new Error("bad point: ZERO")}const{x:t,y:n}=e.toAffine();if(!s.isValid(t)||!s.isValid(n))throw new Error("bad point: x or y not FE");const r=s.sqr(n),i=f(t);if(!s.eql(r,i))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class b{constructor(e,t,n){if(this.px=e,this.py=t,this.pz=n,null==e||!s.isValid(e))throw new Error("x required");if(null==t||!s.isValid(t))throw new Error("y required");if(null==n||!s.isValid(n))throw new Error("z required");Object.freeze(this)}static fromAffine(e){const{x:t,y:n}=e||{};if(!e||!s.isValid(t)||!s.isValid(n))throw new Error("invalid affine point");if(e instanceof b)throw new Error("projective point not allowed");const r=e=>s.eql(e,s.ZERO);return r(t)&&r(n)?b.ZERO:new b(t,n,s.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=s.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(b.fromAffine)}static fromHex(e){const t=b.fromAffine(h((0,i.ensureBytes)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return b.BASE.multiply(p(e))}static msm(e,n){return(0,t.pippenger)(b,a,e,n)}_setWindowSize(e){w.setWindowSize(this,e)}assertValidity(){y(this)}hasEvenY(){const{y:e}=this.toAffine();if(s.isOdd)return!s.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){m(e);const{px:t,py:n,pz:r}=this,{px:i,py:o,pz:a}=e,c=s.eql(s.mul(t,a),s.mul(i,r)),l=s.eql(s.mul(n,a),s.mul(o,r));return c&&l}negate(){return new b(this.px,s.neg(this.py),this.pz)}double(){const{a:e,b:t}=o,n=s.mul(t,d),{px:r,py:i,pz:a}=this;let c=s.ZERO,l=s.ZERO,u=s.ZERO,h=s.mul(r,r),f=s.mul(i,i),p=s.mul(a,a),m=s.mul(r,i);return m=s.add(m,m),u=s.mul(r,a),u=s.add(u,u),c=s.mul(e,u),l=s.mul(n,p),l=s.add(c,l),c=s.sub(f,l),l=s.add(f,l),l=s.mul(c,l),c=s.mul(m,c),u=s.mul(n,u),p=s.mul(e,p),m=s.sub(h,p),m=s.mul(e,m),m=s.add(m,u),u=s.add(h,h),h=s.add(u,h),h=s.add(h,p),h=s.mul(h,m),l=s.add(l,h),p=s.mul(i,a),p=s.add(p,p),h=s.mul(p,m),c=s.sub(c,h),u=s.mul(p,f),u=s.add(u,u),u=s.add(u,u),new b(c,l,u)}add(e){m(e);const{px:t,py:n,pz:r}=this,{px:i,py:a,pz:c}=e;let l=s.ZERO,u=s.ZERO,h=s.ZERO;const f=o.a,p=s.mul(o.b,d);let g=s.mul(t,i),y=s.mul(n,a),v=s.mul(r,c),w=s.add(t,n),E=s.add(i,a);w=s.mul(w,E),E=s.add(g,y),w=s.sub(w,E),E=s.add(t,r);let _=s.add(i,c);return E=s.mul(E,_),_=s.add(g,v),E=s.sub(E,_),_=s.add(n,r),l=s.add(a,c),_=s.mul(_,l),l=s.add(y,v),_=s.sub(_,l),h=s.mul(f,E),l=s.mul(p,v),h=s.add(l,h),l=s.sub(y,h),h=s.add(y,h),u=s.mul(l,h),y=s.add(g,g),y=s.add(y,g),v=s.mul(f,v),E=s.mul(p,E),y=s.add(y,v),v=s.sub(g,v),v=s.mul(f,v),E=s.add(E,v),g=s.mul(y,E),u=s.add(u,g),g=s.mul(_,E),l=s.mul(w,l),l=s.sub(l,g),g=s.mul(w,y),h=s.mul(_,h),h=s.add(h,g),new b(l,u,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(b.ZERO)}wNAF(e){return w.wNAFCached(this,e,b.normalizeZ)}multiplyUnsafe(e){r.aInRange("scalar",e,c,o.n);const t=b.ZERO;if(e===c)return t;if(e===l)return this;const{endo:n}=o;if(!n)return w.unsafeLadder(this,e);let{k1neg:i,k1:a,k2neg:u,k2:d}=n.splitScalar(e),h=t,f=t,p=this;for(;a>c||d>c;)a&l&&(h=h.add(p)),d&l&&(f=f.add(p)),p=p.double(),a>>=l,d>>=l;return i&&(h=h.negate()),u&&(f=f.negate()),f=new b(s.mul(f.px,n.beta),f.py,f.pz),h.add(f)}multiply(e){const{endo:t,n:n}=o;let i,a;if(r.aInRange("scalar",e,l,n),t){const{k1neg:n,k1:r,k2neg:o,k2:c}=t.splitScalar(e);let{p:l,f:u}=this.wNAF(r),{p:d,f:h}=this.wNAF(c);l=w.constTimeNegate(n,l),d=w.constTimeNegate(o,d),d=new b(s.mul(d.px,t.beta),d.py,d.pz),i=l.add(d),a=u.add(h)}else{const{p:t,f:n}=this.wNAF(e);i=t,a=n}return b.normalizeZ([i,a])[0]}multiplyAndAddUnsafe(e,t,n){const r=b.BASE,i=(e,t)=>t!==c&&t!==l&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,n));return o.is0()?void 0:o}toAffine(e){return g(this,e)}isTorsionFree(){const{h:e,isTorsionFree:t}=o;if(e===l)return!0;if(t)return t(b,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:t}=o;return e===l?this:t?t(b,this):this.multiplyUnsafe(o.h)}toRawBytes(e=!0){return(0,i.abool)("isCompressed",e),this.assertValidity(),u(b,this,e)}toHex(e=!0){return(0,i.abool)("isCompressed",e),r.bytesToHex(this.toRawBytes(e))}}b.BASE=new b(o.Gx,o.Gy,s.ONE),b.ZERO=new b(s.ZERO,s.ONE,s.ZERO);const v=o.nBitLength,w=(0,t.wNAF)(b,o.endo?Math.ceil(v/2):v);return{CURVE:o,ProjectivePoint:b,normPrivateKeyToScalar:p,weierstrassEquation:f,isWithinCurveOrder:function(e){return r.inRange(e,l,o.n)}}}function p(e,t){const n=e.ORDER;let r=c;for(let d=n-l;d%u===c;d/=u)r+=l;const i=r,o=u<<i-l-l,s=o*u,a=(n-l)/s,f=(a-l)/u,p=s-l,m=o,g=e.pow(t,a),y=e.pow(t,(a+l)/u);let b=(t,n)=>{let r=g,o=e.pow(n,p),s=e.sqr(o);s=e.mul(s,n);let a=e.mul(t,s);a=e.pow(a,f),a=e.mul(a,o),o=e.mul(a,n),s=e.mul(a,t);let c=e.mul(s,o);a=e.pow(c,m);let d=e.eql(a,e.ONE);o=e.mul(s,y),a=e.mul(c,r),s=e.cmov(o,s,d),c=e.cmov(a,c,d);for(let h=i;h>l;h--){let t=h-u;t=u<<t-l;let n=e.pow(c,t);const i=e.eql(n,e.ONE);o=e.mul(s,r),r=e.mul(r,r),n=e.mul(c,r),s=e.cmov(o,s,i),c=e.cmov(n,c,i)}return{isValid:d,value:s}};if(e.ORDER%h===d){const n=(e.ORDER-d)/h,r=e.sqrt(e.neg(t));b=(t,i)=>{let o=e.sqr(i);const s=e.mul(t,i);o=e.mul(o,s);let a=e.pow(o,n);a=e.mul(a,s);const c=e.mul(a,r),l=e.mul(e.sqr(a),i),u=e.eql(l,t);return{isValid:u,value:e.cmov(c,a,u)}}}return b}}(cne),Object.defineProperty(sne,"__esModule",{value:!0}),sne.getHash=hne,sne.createCurve=function(e,t){const n=t=>(0,dne.weierstrass)({...e,...hne(t)});return Object.freeze({...n(t),create:n})};const lne=ane,une=W9,dne=cne;function hne(e){return{hash:e,hmac:(t,...n)=>(0,lne.hmac)(e,t,(0,une.concatBytes)(...n)),randomBytes:une.randomBytes}}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;const t=Qte,n=W9,r=sne,i=Bte,o=Nee,s=Lee,a=cne,c=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),l=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),u=BigInt(1),d=BigInt(2),h=(e,t)=>(e+t/d)/t;function f(e){const t=c,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),a=BigInt(23),l=BigInt(44),u=BigInt(88),h=e*e*e%t,f=h*h*e%t,m=(0,o.pow2)(f,n,t)*f%t,g=(0,o.pow2)(m,n,t)*f%t,y=(0,o.pow2)(g,d,t)*h%t,b=(0,o.pow2)(y,i,t)*y%t,v=(0,o.pow2)(b,s,t)*b%t,w=(0,o.pow2)(v,l,t)*v%t,E=(0,o.pow2)(w,u,t)*w%t,_=(0,o.pow2)(E,l,t)*v%t,x=(0,o.pow2)(_,n,t)*f%t,k=(0,o.pow2)(x,a,t)*b%t,S=(0,o.pow2)(k,r,t)*h%t,C=(0,o.pow2)(S,d,t);if(!p.eql(p.sqr(C),e))throw new Error("Cannot find square root");return C}const p=(0,o.Field)(c,void 0,void 0,{sqrt:f});e.secp256k1=(0,r.createCurve)({a:BigInt(0),b:BigInt(7),Fp:p,n:l,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=l,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-u*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,a=BigInt("0x100000000000000000000000000000000"),c=h(s*e,t),d=h(-r*e,t);let f=(0,o.mod)(e-c*n-d*i,t),p=(0,o.mod)(-c*r-d*s,t);const m=f>a,g=p>a;if(m&&(f=t-f),g&&(p=t-p),f>a||p>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:m,k1:f,k2neg:g,k2:p}}}},t.sha256);const m=BigInt(0),g={};function y(e,...n){let r=g[e];if(void 0===r){const n=(0,t.sha256)(Uint8Array.from(e,e=>e.charCodeAt(0)));r=(0,s.concatBytes)(n,n),g[e]=r}return(0,t.sha256)((0,s.concatBytes)(r,...n))}const b=e=>e.toRawBytes(!0).slice(1),v=e=>(0,s.numberToBytesBE)(e,32),w=e=>(0,o.mod)(e,c),E=e=>(0,o.mod)(e,l),_=e.secp256k1.ProjectivePoint;function x(t){let n=e.secp256k1.utils.normPrivateKeyToScalar(t),r=_.fromPrivateKey(n);return{scalar:r.hasEvenY()?n:E(-n),bytes:b(r)}}function k(e){(0,s.aInRange)("x",e,u,c);const t=w(e*e);let n=f(w(t*e+BigInt(7)));n%d!==m&&(n=w(-n));const r=new _(e,n,u);return r.assertValidity(),r}const S=s.bytesToNumberBE;function C(...e){return E(S(y("BIP0340/challenge",...e)))}function I(e,t,n){const r=(0,s.ensureBytes)("signature",e,64),i=(0,s.ensureBytes)("message",t),o=(0,s.ensureBytes)("publicKey",n,32);try{const e=k(S(o)),t=S(r.subarray(0,32));if(!(0,s.inRange)(t,u,c))return!1;const n=S(r.subarray(32,64));if(!(0,s.inRange)(n,u,l))return!1;const a=C(v(t),b(e),i),d=((e,t,n)=>_.BASE.multiplyAndAddUnsafe(e,t,n))(e,n,E(-a));return!(!d||!d.hasEvenY()||d.toAffine().x!==t)}catch(a){return!1}}e.schnorr={getPublicKey:function(e){return x(e).bytes},sign:function(e,t,r=(0,n.randomBytes)(32)){const i=(0,s.ensureBytes)("message",e),{bytes:o,scalar:a}=x(t),c=(0,s.ensureBytes)("auxRand",r,32),l=v(a^S(y("BIP0340/aux",c))),u=y("BIP0340/nonce",l,o,i),d=E(S(u));if(d===m)throw new Error("sign failed: k is zero");const{bytes:h,scalar:f}=x(d),p=C(h,o,i),g=new Uint8Array(64);if(g.set(h,0),g.set(v(E(f+p*a)),32),!I(g,i,o))throw new Error("sign: Invalid signature produced");return g},verify:I,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:k,pointToBytes:b,numberToBytesBE:s.numberToBytesBE,bytesToNumberBE:s.bytesToNumberBE,taggedHash:y,mod:o.mod}};const A=(0,i.isogenyMap)(p,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(e=>e.map(e=>BigInt(e)))),P=(0,a.mapToCurveSimpleSWU)(p,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:p.create(BigInt("-11"))}),M=(0,i.createHasher)(e.secp256k1.ProjectivePoint,e=>{const{x:t,y:n}=P(p.create(e[0]));return A(t,n)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:p.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256});e.hashToCurve=M.hashToCurve,e.encodeToCurve=M.encodeToCurve}(Jte);var fne={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var t=m9;e.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e},e.decodeHex=function(n){return(0,t.hexToBytes)((0,e.remove0x)(n))}}(fne),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var t=O9,n=R9,r=Jte,i=S9,o=C9,s=fne;function a(e,t,i,o){if("secp256k1"===e)return t(r.secp256k1);if("x25519"===e)return i(n.x25519);if("ed25519"===e)return o(n.ed25519);throw new Error("Not implemented")}e.getValidSecret=function(){var n;do{n=(0,t.randomBytes)(o.SECRET_KEY_LENGTH)}while(!(0,e.isValidPrivateKey)(n));return n},e.isValidPrivateKey=function(e){return a((0,i.ellipticCurve)(),function(t){return t.utils.isValidPrivateKey(e)},function(){return!0},function(){return!0})},e.getPublicKey=function(e){return a((0,i.ellipticCurve)(),function(t){return t.getPublicKey(e)},function(t){return t.getPublicKey(e)},function(t){return t.getPublicKey(e)})},e.getSharedPoint=function(e,t,n){return a((0,i.ellipticCurve)(),function(r){return r.getSharedSecret(e,t,n)},function(n){return n.getSharedSecret(e,t)},function(n){return l(n,e,t)})},e.convertPublicKeyFormat=function(e,t){return a((0,i.ellipticCurve)(),function(n){return n.getSharedSecret(BigInt(1),e,t)},function(){return e},function(){return e})},e.hexToPublicKey=function(e){var t=(0,s.decodeHex)(e);return a((0,i.ellipticCurve)(),function(){return c(t)},function(){return t},function(){return t})};var c=function(e){if(e.length===o.ETH_PUBLIC_KEY_SIZE){var t=new Uint8Array(1+e.length);return t.set([4]),t.set(e,1),t}return e},l=function(e,t,n){var r=e.utils.getExtendedPublicKey(t).scalar;return e.ExtendedPoint.fromHex(n).multiply(r).toRawBytes()}}(M9);var pne={},mne={};Object.defineProperty(mne,"__esModule",{value:!0}),mne.hkdf=void 0,mne.extract=vne,mne.expand=_ne;const gne=B9,yne=W9,bne=ane;function vne(e,t,n){return(0,gne.hash)(e),void 0===n&&(n=new Uint8Array(e.outputLen)),(0,bne.hmac)(e,(0,yne.toBytes)(n),(0,yne.toBytes)(t))}const wne=new Uint8Array([0]),Ene=new Uint8Array;function _ne(e,t,n,r=32){if((0,gne.hash)(e),(0,gne.number)(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/e.outputLen);void 0===n&&(n=Ene);const o=new Uint8Array(i*e.outputLen),s=bne.hmac.create(e,t),a=s._cloneInto(),c=new Uint8Array(s.outputLen);for(let l=0;l<i;l++)wne[0]=l+1,a.update(0===l?Ene:c).update(n).update(wne).digestInto(c),o.set(c,e.outputLen*l),s._cloneInto(a);return s.destroy(),a.destroy(),c.fill(0),wne.fill(0),o.slice(0,r)}mne.hkdf=(e,t,n,r,i)=>_ne(e,vne(e,t,n),r,i),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var t=m9,n=mne,r=Qte;e.deriveKey=function(e,t,i){return(0,n.hkdf)(r.sha256,e,t,i,32)},e.getSharedKey=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return(0,e.deriveKey)(t.concatBytes.apply(void 0,n))}}(pne);var xne={},kne={},Sne={},Cne={};Object.defineProperty(Cne,"__esModule",{value:!0}),Cne.polyval=Cne.ghash=void 0,Cne._toGHASHKey=Rne;const Ine=g9,Ane=m9,Pne=16,Mne=new Uint8Array(16),One=(0,Ane.u32)(Mne),Tne=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255;function Rne(e){e.reverse();const t=1&e[15];let n=0;for(let r=0;r<e.length;r++){const t=e[r];e[r]=t>>>1|n,n=(1&t)<<7}return e[0]^=225&-t,e}class Nne{constructor(e,t){this.blockLen=Pne,this.outputLen=Pne,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,e=(0,Ane.toBytes)(e),(0,Ine.bytes)(e,16);const n=(0,Ane.createView)(e);let r=n.getUint32(0,!1),i=n.getUint32(4,!1),o=n.getUint32(8,!1),s=n.getUint32(12,!1);const a=[];for(let y=0;y<128;y++)a.push({s0:Tne(r),s1:Tne(i),s2:Tne(o),s3:Tne(s)}),({s0:r,s1:i,s2:o,s3:s}={s3:(u=o)<<31|(d=s)>>>1,s2:(l=i)<<31|u>>>1,s1:(c=r)<<31|l>>>1,s0:c>>>1^225<<24&-(1&d)});var c,l,u,d;const h=(f=t||1024)>65536?8:f>1024?4:2;var f;if(![1,2,4,8].includes(h))throw new Error(`ghash: wrong window size=${h}, should be 2, 4 or 8`);this.W=h;const p=128/h,m=this.windowSize=2**h,g=[];for(let y=0;y<p;y++)for(let e=0;e<m;e++){let t=0,n=0,r=0,i=0;for(let o=0;o<h;o++){if(!(e>>>h-o-1&1))continue;const{s0:s,s1:c,s2:l,s3:u}=a[h*y+o];t^=s,n^=c,r^=l,i^=u}g.push({s0:t,s1:n,s2:r,s3:i})}this.t=g}_updateBlock(e,t,n,r){e^=this.s0,t^=this.s1,n^=this.s2,r^=this.s3;const{W:i,t:o,windowSize:s}=this;let a=0,c=0,l=0,u=0;const d=(1<<i)-1;let h=0;for(const f of[e,t,n,r])for(let e=0;e<4;e++){const t=f>>>8*e&255;for(let e=8/i-1;e>=0;e--){const n=t>>>i*e&d,{s0:r,s1:f,s2:p,s3:m}=o[h*s+n];a^=r,c^=f,l^=p,u^=m,h+=1}}this.s0=a,this.s1=c,this.s2=l,this.s3=u}update(e){e=(0,Ane.toBytes)(e),(0,Ine.exists)(this);const t=(0,Ane.u32)(e),n=Math.floor(e.length/Pne),r=e.length%Pne;for(let i=0;i<n;i++)this._updateBlock(t[4*i+0],t[4*i+1],t[4*i+2],t[4*i+3]);return r&&(Mne.set(e.subarray(n*Pne)),this._updateBlock(One[0],One[1],One[2],One[3]),(0,Ane.clean)(One)),this}destroy(){const{t:e}=this;for(const t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){(0,Ine.exists)(this),(0,Ine.output)(e,this),this.finished=!0;const{s0:t,s1:n,s2:r,s3:i}=this,o=(0,Ane.u32)(e);return o[0]=t,o[1]=n,o[2]=r,o[3]=i,e}digest(){const e=new Uint8Array(Pne);return this.digestInto(e),this.destroy(),e}}class Lne extends Nne{constructor(e,t){e=(0,Ane.toBytes)(e);const n=Rne((0,Ane.copyBytes)(e));super(n,t),(0,Ane.clean)(n)}update(e){e=(0,Ane.toBytes)(e),(0,Ine.exists)(this);const t=(0,Ane.u32)(e),n=e.length%Pne,r=Math.floor(e.length/Pne);for(let i=0;i<r;i++)this._updateBlock(Tne(t[4*i+3]),Tne(t[4*i+2]),Tne(t[4*i+1]),Tne(t[4*i+0]));return n&&(Mne.set(e.subarray(r*Pne)),this._updateBlock(Tne(One[3]),Tne(One[2]),Tne(One[1]),Tne(One[0])),(0,Ane.clean)(One)),this}digestInto(e){(0,Ine.exists)(this),(0,Ine.output)(e,this),this.finished=!0;const{s0:t,s1:n,s2:r,s3:i}=this,o=(0,Ane.u32)(e);return o[0]=t,o[1]=n,o[2]=r,o[3]=i,e.reverse()}}function Bne(e){const t=(t,n)=>e(n,t.length).update((0,Ane.toBytes)(t)).digest(),n=e(new Uint8Array(16),0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=(t,n)=>e(t,n),t}Cne.ghash=Bne((e,t)=>new Nne(e,t)),Cne.polyval=Bne((e,t)=>new Lne(e,t)),Object.defineProperty(Sne,"__esModule",{value:!0}),Sne.unsafe=Sne.aeskwp=Sne.aeskw=Sne.siv=Sne.gcm=Sne.cfb=Sne.cbc=Sne.ecb=Sne.ctr=void 0,Sne.expandKeyLE=Xne,Sne.expandKeyDecLE=ere;const jne=g9,Dne=Cne,Une=m9,Fne=16,$ne=new Uint8Array(Fne);function zne(e){return e<<1^283&-(e>>7)}function Hne(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(1&t),e=zne(e);return n}const qne=(()=>{const e=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=zne(r))e[n]=r;const t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=255&(r^r>>4^r>>5^r>>6^r>>7^99)}return(0,Une.clean)(e),t})(),Wne=qne.map((e,t)=>qne.indexOf(t)),Kne=e=>e<<24|e>>>8,Gne=e=>e<<8|e>>>24,Vne=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;function Zne(e,t){if(256!==e.length)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map((n,r)=>t(e[r])),r=n.map(Gne),i=r.map(Gne),o=i.map(Gne),s=new Uint32Array(65536),a=new Uint32Array(65536),c=new Uint16Array(65536);for(let l=0;l<256;l++)for(let t=0;t<256;t++){const u=256*l+t;s[u]=n[l]^r[t],a[u]=i[l]^o[t],c[u]=e[l]<<8|e[t]}return{sbox:e,sbox2:c,T0:n,T1:r,T2:i,T3:o,T01:s,T23:a}}const Yne=Zne(qne,e=>Hne(e,3)<<24|e<<16|e<<8|Hne(e,2)),Jne=Zne(Wne,e=>Hne(e,11)<<24|Hne(e,13)<<16|Hne(e,9)<<8|Hne(e,14)),Qne=(()=>{const e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=zne(n))e[t]=n;return e})();function Xne(e){(0,jne.bytes)(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:n}=Yne,r=[];(0,Une.isAligned32)(e)||r.push(e=(0,Une.copyBytes)(e));const i=(0,Une.u32)(e),o=i.length,s=e=>nre(n,e,e,e,e),a=new Uint32Array(t+28);a.set(i);for(let c=o;c<a.length;c++){let e=a[c-1];c%o==0?e=s(Kne(e))^Qne[c/o-1]:o>6&&c%o==4&&(e=s(e)),a[c]=a[c-o]^e}return(0,Une.clean)(...r),a}function ere(e){const t=Xne(e),n=t.slice(),r=t.length,{sbox2:i}=Yne,{T0:o,T1:s,T2:a,T3:c}=Jne;for(let l=0;l<r;l+=4)for(let e=0;e<4;e++)n[l+e]=t[r-l-4+e];(0,Une.clean)(t);for(let l=4;l<r-4;l++){const e=n[l],t=nre(i,e,e,e,e);n[l]=o[255&t]^s[t>>>8&255]^a[t>>>16&255]^c[t>>>24]}return n}function tre(e,t,n,r,i,o){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|o>>>24&255]}function nre(e,t,n,r,i){return e[255&t|65280&n]|e[r>>>16&255|i>>>16&65280]<<16}function rre(e,t,n,r,i){const{sbox2:o,T01:s,T23:a}=Yne;let c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];const l=e.length/4-2;for(let u=0;u<l;u++){const o=e[c++]^tre(s,a,t,n,r,i),l=e[c++]^tre(s,a,n,r,i,t),u=e[c++]^tre(s,a,r,i,t,n),d=e[c++]^tre(s,a,i,t,n,r);t=o,n=l,r=u,i=d}return{s0:e[c++]^nre(o,t,n,r,i),s1:e[c++]^nre(o,n,r,i,t),s2:e[c++]^nre(o,r,i,t,n),s3:e[c++]^nre(o,i,t,n,r)}}function ire(e,t,n,r,i){const{sbox2:o,T01:s,T23:a}=Jne;let c=0;t^=e[c++],n^=e[c++],r^=e[c++],i^=e[c++];const l=e.length/4-2;for(let u=0;u<l;u++){const o=e[c++]^tre(s,a,t,i,r,n),l=e[c++]^tre(s,a,n,t,i,r),u=e[c++]^tre(s,a,r,n,t,i),d=e[c++]^tre(s,a,i,r,n,t);t=o,n=l,r=u,i=d}return{s0:e[c++]^nre(o,t,i,r,n),s1:e[c++]^nre(o,n,t,i,r),s2:e[c++]^nre(o,r,n,t,i),s3:e[c++]^nre(o,i,r,n,t)}}function ore(e,t){if(void 0===t)return new Uint8Array(e);if((0,jne.bytes)(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);if(!(0,Une.isAligned32)(t))throw new Error("unaligned dst");return t}function sre(e,t,n,r){(0,jne.bytes)(t,Fne),(0,jne.bytes)(n);const i=n.length;r=ore(i,r);const o=t,s=(0,Une.u32)(o);let{s0:a,s1:c,s2:l,s3:u}=rre(e,s[0],s[1],s[2],s[3]);const d=(0,Une.u32)(n),h=(0,Une.u32)(r);for(let p=0;p+4<=d.length;p+=4){h[p+0]=d[p+0]^a,h[p+1]=d[p+1]^c,h[p+2]=d[p+2]^l,h[p+3]=d[p+3]^u;let t=1;for(let e=o.length-1;e>=0;e--)t=t+(255&o[e])|0,o[e]=255&t,t>>>=8;({s0:a,s1:c,s2:l,s3:u}=rre(e,s[0],s[1],s[2],s[3]))}const f=Fne*Math.floor(d.length/4);if(f<i){const e=new Uint32Array([a,c,l,u]),t=(0,Une.u8)(e);for(let o=f,s=0;o<i;o++,s++)r[o]=n[o]^t[s];(0,Une.clean)(e)}return r}function are(e,t,n,r,i){(0,jne.bytes)(n,Fne),(0,jne.bytes)(r),i=ore(r.length,i);const o=n,s=(0,Une.u32)(o),a=(0,Une.createView)(o),c=(0,Une.u32)(r),l=(0,Une.u32)(i),u=t?0:12,d=r.length;let h=a.getUint32(u,t),{s0:f,s1:p,s2:m,s3:g}=rre(e,s[0],s[1],s[2],s[3]);for(let b=0;b+4<=c.length;b+=4)l[b+0]=c[b+0]^f,l[b+1]=c[b+1]^p,l[b+2]=c[b+2]^m,l[b+3]=c[b+3]^g,h=h+1>>>0,a.setUint32(u,h,t),({s0:f,s1:p,s2:m,s3:g}=rre(e,s[0],s[1],s[2],s[3]));const y=Fne*Math.floor(c.length/4);if(y<d){const e=new Uint32Array([f,p,m,g]),t=(0,Une.u8)(e);for(let n=y,o=0;n<d;n++,o++)i[n]=r[n]^t[o];(0,Une.clean)(e)}return i}function cre(e){if((0,jne.bytes)(e),e.length%Fne!=0)throw new Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function lre(e,t,n){(0,jne.bytes)(e);let r=e.length;const i=r%Fne;if(!t&&0!==i)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,Une.isAligned32)(e)||(e=(0,Une.copyBytes)(e));const o=(0,Une.u32)(e);if(t){let e=Fne-i;e||(e=Fne),r+=e}const s=ore(r,n);return{b:o,o:(0,Une.u32)(s),out:s}}function ure(e,t){if(!t)return e;const n=e.length;if(!n)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=e[n-1];if(r<=0||r>16)throw new Error("aes/pcks5: wrong padding");const i=e.subarray(0,-r);for(let o=0;o<r;o++)if(e[n-o-1]!==r)throw new Error("aes/pcks5: wrong padding");return i}function dre(e){const t=new Uint8Array(16),n=(0,Une.u32)(t);t.set(e);const r=Fne-e.length;for(let i=Fne-r;i<Fne;i++)t[i]=r;return n}function hre(e,t,n,r,i){const o=null==i?0:i.length,s=e.create(n,r.length+o);i&&s.update(i),s.update(r);const a=new Uint8Array(16),c=(0,Une.createView)(a);i&&(0,Une.setBigUint64)(c,0,BigInt(8*o),t),(0,Une.setBigUint64)(c,8,BigInt(8*r.length),t),s.update(a);const l=s.digest();return(0,Une.clean)(a),l}Sne.ctr=(0,Une.wrapCipher)({blockSize:16,nonceLength:16},function(e,t){function n(n,r){if((0,jne.bytes)(n),void 0!==r&&((0,jne.bytes)(r),!(0,Une.isAligned32)(r)))throw new Error("unaligned destination");const i=Xne(e),o=(0,Une.copyBytes)(t),s=[i,o];(0,Une.isAligned32)(n)||s.push(n=(0,Une.copyBytes)(n));const a=sre(i,o,n,r);return(0,Une.clean)(...s),a}return(0,jne.bytes)(e),(0,jne.bytes)(t,Fne),{encrypt:(e,t)=>n(e,t),decrypt:(e,t)=>n(e,t)}}),Sne.ecb=(0,Une.wrapCipher)({blockSize:16},function(e,t={}){(0,jne.bytes)(e);const n=!t.disablePadding;return{encrypt(t,r){const{b:i,o:o,out:s}=lre(t,n,r),a=Xne(e);let c=0;for(;c+4<=i.length;){const{s0:e,s1:t,s2:n,s3:r}=rre(a,i[c+0],i[c+1],i[c+2],i[c+3]);o[c++]=e,o[c++]=t,o[c++]=n,o[c++]=r}if(n){const e=dre(t.subarray(4*c)),{s0:n,s1:r,s2:i,s3:s}=rre(a,e[0],e[1],e[2],e[3]);o[c++]=n,o[c++]=r,o[c++]=i,o[c++]=s}return(0,Une.clean)(a),s},decrypt(t,r){cre(t);const i=ere(e),o=ore(t.length,r),s=[i];(0,Une.isAligned32)(t)||s.push(t=(0,Une.copyBytes)(t));const a=(0,Une.u32)(t),c=(0,Une.u32)(o);for(let e=0;e+4<=a.length;){const{s0:t,s1:n,s2:r,s3:o}=ire(i,a[e+0],a[e+1],a[e+2],a[e+3]);c[e++]=t,c[e++]=n,c[e++]=r,c[e++]=o}return(0,Une.clean)(...s),ure(o,n)}}}),Sne.cbc=(0,Une.wrapCipher)({blockSize:16,nonceLength:16},function(e,t,n={}){(0,jne.bytes)(e),(0,jne.bytes)(t,16);const r=!n.disablePadding;return{encrypt(n,i){const o=Xne(e),{b:s,o:a,out:c}=lre(n,r,i);let l=t;const u=[o];(0,Une.isAligned32)(l)||u.push(l=(0,Une.copyBytes)(l));const d=(0,Une.u32)(l);let h=d[0],f=d[1],p=d[2],m=d[3],g=0;for(;g+4<=s.length;)h^=s[g+0],f^=s[g+1],p^=s[g+2],m^=s[g+3],({s0:h,s1:f,s2:p,s3:m}=rre(o,h,f,p,m)),a[g++]=h,a[g++]=f,a[g++]=p,a[g++]=m;if(r){const e=dre(n.subarray(4*g));h^=e[0],f^=e[1],p^=e[2],m^=e[3],({s0:h,s1:f,s2:p,s3:m}=rre(o,h,f,p,m)),a[g++]=h,a[g++]=f,a[g++]=p,a[g++]=m}return(0,Une.clean)(...u),c},decrypt(n,i){cre(n);const o=ere(e);let s=t;const a=[o];(0,Une.isAligned32)(s)||a.push(s=(0,Une.copyBytes)(s));const c=(0,Une.u32)(s),l=ore(n.length,i);(0,Une.isAligned32)(n)||a.push(n=(0,Une.copyBytes)(n));const u=(0,Une.u32)(n),d=(0,Une.u32)(l);let h=c[0],f=c[1],p=c[2],m=c[3];for(let e=0;e+4<=u.length;){const t=h,n=f,r=p,i=m;h=u[e+0],f=u[e+1],p=u[e+2],m=u[e+3];const{s0:s,s1:a,s2:c,s3:l}=ire(o,h,f,p,m);d[e++]=s^t,d[e++]=a^n,d[e++]=c^r,d[e++]=l^i}return(0,Une.clean)(...a),ure(l,r)}}}),Sne.cfb=(0,Une.wrapCipher)({blockSize:16,nonceLength:16},function(e,t){function n(n,r,i){(0,jne.bytes)(n);const o=n.length;i=ore(o,i);const s=Xne(e);let a=t;const c=[s];(0,Une.isAligned32)(a)||c.push(a=(0,Une.copyBytes)(a)),(0,Une.isAligned32)(n)||c.push(n=(0,Une.copyBytes)(n));const l=(0,Une.u32)(n),u=(0,Une.u32)(i),d=r?u:l,h=(0,Une.u32)(a);let f=h[0],p=h[1],m=h[2],g=h[3];for(let e=0;e+4<=l.length;){const{s0:t,s1:n,s2:r,s3:i}=rre(s,f,p,m,g);u[e+0]=l[e+0]^t,u[e+1]=l[e+1]^n,u[e+2]=l[e+2]^r,u[e+3]=l[e+3]^i,f=d[e++],p=d[e++],m=d[e++],g=d[e++]}const y=Fne*Math.floor(l.length/4);if(y<o){({s0:f,s1:p,s2:m,s3:g}=rre(s,f,p,m,g));const e=(0,Une.u8)(new Uint32Array([f,p,m,g]));for(let t=y,r=0;t<o;t++,r++)i[t]=n[t]^e[r];(0,Une.clean)(e)}return(0,Une.clean)(...c),i}return(0,jne.bytes)(e),(0,jne.bytes)(t,16),{encrypt:(e,t)=>n(e,!0,t),decrypt:(e,t)=>n(e,!1,t)}}),Sne.gcm=(0,Une.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){if((0,jne.bytes)(e),(0,jne.bytes)(t),void 0!==n&&(0,jne.bytes)(n),t.length<8)throw new Error("aes/gcm: invalid nonce length");function r(e,t,r){const i=hre(Dne.ghash,!1,e,r,n);for(let n=0;n<t.length;n++)i[n]^=t[n];return i}function i(){const n=Xne(e),r=$ne.slice(),i=$ne.slice();if(are(n,!1,i,i,r),12===t.length)i.set(t);else{const e=$ne.slice(),n=(0,Une.createView)(e);(0,Une.setBigUint64)(n,8,BigInt(8*t.length),!1);const o=Dne.ghash.create(r).update(t).update(e);o.digestInto(i),o.destroy()}return{xk:n,authKey:r,counter:i,tagMask:are(n,!1,i,$ne)}}return{encrypt(e){(0,jne.bytes)(e);const{xk:t,authKey:n,counter:o,tagMask:s}=i(),a=new Uint8Array(e.length+16),c=[t,n,o,s];(0,Une.isAligned32)(e)||c.push(e=(0,Une.copyBytes)(e)),are(t,!1,o,e,a);const l=r(n,s,a.subarray(0,a.length-16));return c.push(l),a.set(l,e.length),(0,Une.clean)(...c),a},decrypt(e){if((0,jne.bytes)(e),e.length<16)throw new Error("aes/gcm: ciphertext less than tagLen (16)");const{xk:t,authKey:n,counter:o,tagMask:s}=i(),a=[t,n,s,o];(0,Une.isAligned32)(e)||a.push(e=(0,Une.copyBytes)(e));const c=e.subarray(0,-16),l=e.subarray(-16),u=r(n,s,c);if(a.push(u),!(0,Une.equalBytes)(u,l))throw new Error("aes/gcm: invalid ghash tag");const d=are(t,!1,o,c);return(0,Une.clean)(...a),d}}});const fre=(e,t,n)=>r=>{if(!Number.isSafeInteger(r)||t>r||r>n)throw new Error(`${e}: invalid value=${r}, must be [${t}..${n}]`)};function pre(e){return null!=e&&"object"==typeof e&&(e instanceof Uint32Array||"Uint32Array"===e.constructor.name)}function mre(e,t){if((0,jne.bytes)(t,16),!pre(e))throw new Error("_encryptBlock accepts result of expandKeyLE");const n=(0,Une.u32)(t);let{s0:r,s1:i,s2:o,s3:s}=rre(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=s,t}function gre(e,t){if((0,jne.bytes)(t,16),!pre(e))throw new Error("_decryptBlock accepts result of expandKeyLE");const n=(0,Une.u32)(t);let{s0:r,s1:i,s2:o,s3:s}=ire(e,n[0],n[1],n[2],n[3]);return n[0]=r,n[1]=i,n[2]=o,n[3]=s,t}Sne.siv=(0,Une.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){const r=fre("AAD",0,2**36),i=fre("plaintext",0,2**36),o=fre("nonce",12,12),s=fre("ciphertext",16,2**36+16);function a(){const n=Xne(e),r=new Uint8Array(e.length),i=new Uint8Array(16),o=[n,r];let s=t;(0,Une.isAligned32)(s)||o.push(s=(0,Une.copyBytes)(s));const a=(0,Une.u32)(s);let c=0,l=a[0],u=a[1],d=a[2],h=0;for(const e of[i,r].map(Une.u32)){const t=(0,Une.u32)(e);for(let e=0;e<t.length;e+=2){const{s0:r,s1:i}=rre(n,c,l,u,d);t[e+0]=r,t[e+1]=i,c=++h}}const f={authKey:i,encKey:Xne(r)};return(0,Une.clean)(...o),f}function c(e,r,i){const o=hre(Dne.polyval,!0,r,i,n);for(let n=0;n<12;n++)o[n]^=t[n];o[15]&=127;const s=(0,Une.u32)(o);let a=s[0],c=s[1],l=s[2],u=s[3];return({s0:a,s1:c,s2:l,s3:u}=rre(e,a,c,l,u)),s[0]=a,s[1]=c,s[2]=l,s[3]=u,o}function l(e,t,n){let r=(0,Une.copyBytes)(t);r[15]|=128;const i=are(e,!0,r,n);return(0,Une.clean)(r),i}return(0,jne.bytes)(e,16,24,32),(0,jne.bytes)(t),o(t.length),void 0!==n&&((0,jne.bytes)(n),r(n.length)),{encrypt(e){(0,jne.bytes)(e),i(e.length);const{encKey:t,authKey:n}=a(),r=c(t,n,e),o=[t,n,r];(0,Une.isAligned32)(e)||o.push(e=(0,Une.copyBytes)(e));const s=new Uint8Array(e.length+16);return s.set(r,e.length),s.set(l(t,r,e)),(0,Une.clean)(...o),s},decrypt(e){(0,jne.bytes)(e),s(e.length);const t=e.subarray(-16),{encKey:n,authKey:r}=a(),i=[n,r];(0,Une.isAligned32)(e)||i.push(e=(0,Une.copyBytes)(e));const o=l(n,t,e.subarray(0,-16)),u=c(n,r,o);if(i.push(u),!(0,Une.equalBytes)(t,u))throw(0,Une.clean)(...i),new Error("invalid polyval tag");return(0,Une.clean)(...i),o}}});const yre={encrypt(e,t){if(t.length>=2**32)throw new Error("plaintext should be less than 4gb");const n=Xne(e);if(16===t.length)mre(n,t);else{const e=(0,Une.u32)(t);let r=e[0],i=e[1];for(let t=0,o=1;t<6;t++)for(let s=2;s<e.length;s+=2,o++){const{s0:t,s1:a,s2:c,s3:l}=rre(n,r,i,e[s],e[s+1]);r=t,i=a^Vne(o),e[s]=c,e[s+1]=l}e[0]=r,e[1]=i}n.fill(0)},decrypt(e,t){if(t.length-8>=2**32)throw new Error("ciphertext should be less than 4gb");const n=ere(e),r=t.length/8-1;if(1===r)gre(n,t);else{const e=(0,Une.u32)(t);let i=e[0],o=e[1];for(let t=0,s=6*r;t<6;t++)for(let a=2*r;a>=1;a-=2,s--){o^=Vne(s);const{s0:t,s1:r,s2:c,s3:l}=ire(n,i,o,e[a],e[a+1]);i=t,o=r,e[a]=c,e[a+1]=l}e[0]=i,e[1]=o}n.fill(0)}},bre=new Uint8Array(8).fill(166);Sne.aeskw=(0,Une.wrapCipher)({blockSize:8},e=>({encrypt(t){if((0,jne.bytes)(t),!t.length||t.length%8!=0)throw new Error("invalid plaintext length");if(8===t.length)throw new Error("8-byte keys not allowed in AESKW, use AESKWP instead");const n=(0,Une.concatBytes)(bre,t);return yre.encrypt(e,n),n},decrypt(t){if((0,jne.bytes)(t),t.length%8!=0||t.length<24)throw new Error("invalid ciphertext length");const n=(0,Une.copyBytes)(t);if(yre.decrypt(e,n),!(0,Une.equalBytes)(n.subarray(0,8),bre))throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8)}}));const vre=2790873510;Sne.aeskwp=(0,Une.wrapCipher)({blockSize:8},e=>({encrypt(t){if((0,jne.bytes)(t),!t.length)throw new Error("invalid plaintext length");const n=8*Math.ceil(t.length/8),r=new Uint8Array(8+n);r.set(t,8);const i=(0,Une.u32)(r);return i[0]=vre,i[1]=Vne(t.length),yre.encrypt(e,r),r},decrypt(t){if((0,jne.bytes)(t),t.length<16)throw new Error("invalid ciphertext length");const n=(0,Une.copyBytes)(t),r=(0,Une.u32)(n);yre.decrypt(e,n);const i=Vne(r[1])>>>0,o=8*Math.ceil(i/8);if(r[0]!==vre||n.length-8!==o)throw new Error("integrity check failed");for(let e=i;e<o;e++)if(0!==n[8+e])throw new Error("integrity check failed");return n.subarray(0,8).fill(0),n.subarray(8,8+i)}})),Sne.unsafe={expandKeyLE:Xne,expandKeyDecLE:ere,encrypt:rre,decrypt:ire,encryptBlock:mre,decryptBlock:gre,ctrCounter:sre,ctr32:are},Object.defineProperty(kne,"__esModule",{value:!0}),kne.aes256cbc=kne.aes256gcm=void 0;var wre=Sne;kne.aes256gcm=function(e,t,n){return(0,wre.gcm)(e,t,n)},kne.aes256cbc=function(e,t,n){return(0,wre.cbc)(e,t)};var Ere={},_re={},xre={};Object.defineProperty(xre,"__esModule",{value:!0}),xre.sigma=void 0,xre.rotl=function(e,t){return e<<t|e>>>32-t},xre.createCipher=function(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:s}=(0,Sre.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw new Error("core must be a function");return(0,kre.number)(i),(0,kre.number)(s),(0,kre.bool)(o),(0,kre.bool)(n),(t,a,c,l,u=0)=>{(0,kre.bytes)(t),(0,kre.bytes)(a),(0,kre.bytes)(c);const d=c.length;if(void 0===l&&(l=new Uint8Array(d)),(0,kre.bytes)(l),(0,kre.number)(u),u<0||u>=Nre)throw new Error("arx: counter overflow");if(l.length<d)throw new Error(`arx: output (${l.length}) is shorter than data (${d})`);const h=[];let f,p,m=t.length;if(32===m)h.push(f=(0,Sre.copyBytes)(t)),p=Mre;else{if(16!==m||!n)throw new Error(`arx: invalid 32-byte key, got length=${m}`);f=new Uint8Array(32),f.set(t),f.set(t,16),p=Pre,h.push(f)}Ore(a)||h.push(a=(0,Sre.copyBytes)(a));const g=(0,Sre.u32)(f);if(r){if(24!==a.length)throw new Error("arx: extended nonce must be 24 bytes");r(p,g,(0,Sre.u32)(a.subarray(0,16)),g),a=a.subarray(16)}const y=16-i;if(y!==a.length)throw new Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){const e=new Uint8Array(12);e.set(a,o?0:12-a.length),a=e,h.push(a)}const b=(0,Sre.u32)(a);return function(e,t,n,r,i,o,s,a){const c=i.length,l=new Uint8Array(Tre),u=(0,Sre.u32)(l),d=Ore(i)&&Ore(o),h=d?(0,Sre.u32)(i):Lre,f=d?(0,Sre.u32)(o):Lre;for(let p=0;p<c;s++){if(e(t,n,r,u,s,a),s>=Nre)throw new Error("arx: counter overflow");const m=Math.min(Tre,c-p);if(d&&m===Tre){const e=p/4;if(p%4!=0)throw new Error("arx: invalid block position");for(let t,n=0;n<Rre;n++)t=e+n,f[t]=h[t]^u[n];p+=Tre}else{for(let e,t=0;t<m;t++)e=p+t,o[e]=i[e]^l[t];p+=m}}}(e,p,g,b,c,l,u,s),(0,Sre.clean)(...h),l}};const kre=g9,Sre=m9,Cre=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),Ire=Cre("expand 16-byte k"),Are=Cre("expand 32-byte k"),Pre=(0,Sre.u32)(Ire),Mre=(0,Sre.u32)(Are);function Ore(e){return e.byteOffset%4==0}xre.sigma=Mre.slice();const Tre=64,Rre=16,Nre=2**32-1,Lre=new Uint32Array;var Bre={};Object.defineProperty(Bre,"__esModule",{value:!0}),Bre.poly1305=void 0,Bre.wrapConstructorWithKey=$re;const jre=g9,Dre=m9,Ure=(e,t)=>255&e[t++]|(255&e[t++])<<8;class Fre{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=(0,Dre.toBytes)(e),(0,jre.bytes)(e,32);const t=Ure(e,0),n=Ure(e,2),r=Ure(e,4),i=Ure(e,6),o=Ure(e,8),s=Ure(e,10),a=Ure(e,12),c=Ure(e,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|n<<3),this.r[2]=7939&(n>>>10|r<<6),this.r[3]=8191&(r>>>7|i<<9),this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,this.r[6]=8191&(o>>>14|s<<2),this.r[7]=8065&(s>>>11|a<<5),this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127;for(let l=0;l<8;l++)this.pad[l]=Ure(e,16+2*l)}process(e,t,n=!1){const r=n?0:2048,{h:i,r:o}=this,s=o[0],a=o[1],c=o[2],l=o[3],u=o[4],d=o[5],h=o[6],f=o[7],p=o[8],m=o[9],g=Ure(e,t+0),y=Ure(e,t+2),b=Ure(e,t+4),v=Ure(e,t+6),w=Ure(e,t+8),E=Ure(e,t+10),_=Ure(e,t+12),x=Ure(e,t+14);let k=i[0]+(8191&g),S=i[1]+(8191&(g>>>13|y<<3)),C=i[2]+(8191&(y>>>10|b<<6)),I=i[3]+(8191&(b>>>7|v<<9)),A=i[4]+(8191&(v>>>4|w<<12)),P=i[5]+(w>>>1&8191),M=i[6]+(8191&(w>>>14|E<<2)),O=i[7]+(8191&(E>>>11|_<<5)),T=i[8]+(8191&(_>>>8|x<<8)),R=i[9]+(x>>>5|r),N=0,L=N+k*s+S*(5*m)+C*(5*p)+I*(5*f)+A*(5*h);N=L>>>13,L&=8191,L+=P*(5*d)+M*(5*u)+O*(5*l)+T*(5*c)+R*(5*a),N+=L>>>13,L&=8191;let B=N+k*a+S*s+C*(5*m)+I*(5*p)+A*(5*f);N=B>>>13,B&=8191,B+=P*(5*h)+M*(5*d)+O*(5*u)+T*(5*l)+R*(5*c),N+=B>>>13,B&=8191;let j=N+k*c+S*a+C*s+I*(5*m)+A*(5*p);N=j>>>13,j&=8191,j+=P*(5*f)+M*(5*h)+O*(5*d)+T*(5*u)+R*(5*l),N+=j>>>13,j&=8191;let D=N+k*l+S*c+C*a+I*s+A*(5*m);N=D>>>13,D&=8191,D+=P*(5*p)+M*(5*f)+O*(5*h)+T*(5*d)+R*(5*u),N+=D>>>13,D&=8191;let U=N+k*u+S*l+C*c+I*a+A*s;N=U>>>13,U&=8191,U+=P*(5*m)+M*(5*p)+O*(5*f)+T*(5*h)+R*(5*d),N+=U>>>13,U&=8191;let F=N+k*d+S*u+C*l+I*c+A*a;N=F>>>13,F&=8191,F+=P*s+M*(5*m)+O*(5*p)+T*(5*f)+R*(5*h),N+=F>>>13,F&=8191;let $=N+k*h+S*d+C*u+I*l+A*c;N=$>>>13,$&=8191,$+=P*a+M*s+O*(5*m)+T*(5*p)+R*(5*f),N+=$>>>13,$&=8191;let z=N+k*f+S*h+C*d+I*u+A*l;N=z>>>13,z&=8191,z+=P*c+M*a+O*s+T*(5*m)+R*(5*p),N+=z>>>13,z&=8191;let H=N+k*p+S*f+C*h+I*d+A*u;N=H>>>13,H&=8191,H+=P*l+M*c+O*a+T*s+R*(5*m),N+=H>>>13,H&=8191;let q=N+k*m+S*p+C*f+I*h+A*d;N=q>>>13,q&=8191,q+=P*u+M*l+O*c+T*a+R*s,N+=q>>>13,q&=8191,N=(N<<2)+N|0,N=N+L|0,L=8191&N,N>>>=13,B+=N,i[0]=L,i[1]=B,i[2]=j,i[3]=D,i[4]=U,i[5]=F,i[6]=$,i[7]=z,i[8]=H,i[9]=q}finalize(){const{h:e,pad:t}=this,n=new Uint16Array(10);let r=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=r,r=e[s]>>>13,e[s]&=8191;e[0]+=5*r,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,n[0]=e[0]+5,r=n[0]>>>13,n[0]&=8191;for(let s=1;s<10;s++)n[s]=e[s]+r,r=n[s]>>>13,n[s]&=8191;n[9]-=8192;let i=(1^r)-1;for(let s=0;s<10;s++)n[s]&=i;i=~i;for(let s=0;s<10;s++)e[s]=e[s]&i|n[s];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let o=e[0]+t[0];e[0]=65535&o;for(let s=1;s<8;s++)o=(e[s]+t[s]|0)+(o>>>16)|0,e[s]=65535&o;(0,Dre.clean)(n)}update(e){(0,jre.exists)(this);const{buffer:t,blockLen:n}=this,r=(e=(0,Dre.toBytes)(e)).length;for(let i=0;i<r;){const o=Math.min(n-this.pos,r-i);if(o!==n)t.set(e.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===n&&(this.process(t,0,!1),this.pos=0);else for(;n<=r-i;i+=n)this.process(e,i)}return this}destroy(){(0,Dre.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(e){(0,jre.exists)(this),(0,jre.output)(e,this),this.finished=!0;const{buffer:t,h:n}=this;let{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)e[i++]=n[o]>>>0,e[i++]=n[o]>>>8;return e}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}}function $re(e){const t=(t,n)=>e(n).update((0,Dre.toBytes)(t)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}Bre.poly1305=$re(e=>new Fre(e)),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.xchacha20poly1305=e.chacha20poly1305=e._poly1305_aead=e.chacha12=e.chacha8=e.xchacha20=e.chacha20=e.chacha20orig=void 0,e.hchacha=s;const t=xre,n=g9,r=Bre,i=m9;function o(e,n,r,i,o,s=20){let a=e[0],c=e[1],l=e[2],u=e[3],d=n[0],h=n[1],f=n[2],p=n[3],m=n[4],g=n[5],y=n[6],b=n[7],v=o,w=r[0],E=r[1],_=r[2],x=a,k=c,S=l,C=u,I=d,A=h,P=f,M=p,O=m,T=g,R=y,N=b,L=v,B=w,j=E,D=_;for(let F=0;F<s;F+=2)x=x+I|0,L=(0,t.rotl)(L^x,16),O=O+L|0,I=(0,t.rotl)(I^O,12),x=x+I|0,L=(0,t.rotl)(L^x,8),O=O+L|0,I=(0,t.rotl)(I^O,7),k=k+A|0,B=(0,t.rotl)(B^k,16),T=T+B|0,A=(0,t.rotl)(A^T,12),k=k+A|0,B=(0,t.rotl)(B^k,8),T=T+B|0,A=(0,t.rotl)(A^T,7),S=S+P|0,j=(0,t.rotl)(j^S,16),R=R+j|0,P=(0,t.rotl)(P^R,12),S=S+P|0,j=(0,t.rotl)(j^S,8),R=R+j|0,P=(0,t.rotl)(P^R,7),C=C+M|0,D=(0,t.rotl)(D^C,16),N=N+D|0,M=(0,t.rotl)(M^N,12),C=C+M|0,D=(0,t.rotl)(D^C,8),N=N+D|0,M=(0,t.rotl)(M^N,7),x=x+A|0,D=(0,t.rotl)(D^x,16),R=R+D|0,A=(0,t.rotl)(A^R,12),x=x+A|0,D=(0,t.rotl)(D^x,8),R=R+D|0,A=(0,t.rotl)(A^R,7),k=k+P|0,L=(0,t.rotl)(L^k,16),N=N+L|0,P=(0,t.rotl)(P^N,12),k=k+P|0,L=(0,t.rotl)(L^k,8),N=N+L|0,P=(0,t.rotl)(P^N,7),S=S+M|0,B=(0,t.rotl)(B^S,16),O=O+B|0,M=(0,t.rotl)(M^O,12),S=S+M|0,B=(0,t.rotl)(B^S,8),O=O+B|0,M=(0,t.rotl)(M^O,7),C=C+I|0,j=(0,t.rotl)(j^C,16),T=T+j|0,I=(0,t.rotl)(I^T,12),C=C+I|0,j=(0,t.rotl)(j^C,8),T=T+j|0,I=(0,t.rotl)(I^T,7);let U=0;i[U++]=a+x|0,i[U++]=c+k|0,i[U++]=l+S|0,i[U++]=u+C|0,i[U++]=d+I|0,i[U++]=h+A|0,i[U++]=f+P|0,i[U++]=p+M|0,i[U++]=m+O|0,i[U++]=g+T|0,i[U++]=y+R|0,i[U++]=b+N|0,i[U++]=v+L|0,i[U++]=w+B|0,i[U++]=E+j|0,i[U++]=_+D|0}function s(e,n,r,i){let o=e[0],s=e[1],a=e[2],c=e[3],l=n[0],u=n[1],d=n[2],h=n[3],f=n[4],p=n[5],m=n[6],g=n[7],y=r[0],b=r[1],v=r[2],w=r[3];for(let _=0;_<20;_+=2)o=o+l|0,y=(0,t.rotl)(y^o,16),f=f+y|0,l=(0,t.rotl)(l^f,12),o=o+l|0,y=(0,t.rotl)(y^o,8),f=f+y|0,l=(0,t.rotl)(l^f,7),s=s+u|0,b=(0,t.rotl)(b^s,16),p=p+b|0,u=(0,t.rotl)(u^p,12),s=s+u|0,b=(0,t.rotl)(b^s,8),p=p+b|0,u=(0,t.rotl)(u^p,7),a=a+d|0,v=(0,t.rotl)(v^a,16),m=m+v|0,d=(0,t.rotl)(d^m,12),a=a+d|0,v=(0,t.rotl)(v^a,8),m=m+v|0,d=(0,t.rotl)(d^m,7),c=c+h|0,w=(0,t.rotl)(w^c,16),g=g+w|0,h=(0,t.rotl)(h^g,12),c=c+h|0,w=(0,t.rotl)(w^c,8),g=g+w|0,h=(0,t.rotl)(h^g,7),o=o+u|0,w=(0,t.rotl)(w^o,16),m=m+w|0,u=(0,t.rotl)(u^m,12),o=o+u|0,w=(0,t.rotl)(w^o,8),m=m+w|0,u=(0,t.rotl)(u^m,7),s=s+d|0,y=(0,t.rotl)(y^s,16),g=g+y|0,d=(0,t.rotl)(d^g,12),s=s+d|0,y=(0,t.rotl)(y^s,8),g=g+y|0,d=(0,t.rotl)(d^g,7),a=a+h|0,b=(0,t.rotl)(b^a,16),f=f+b|0,h=(0,t.rotl)(h^f,12),a=a+h|0,b=(0,t.rotl)(b^a,8),f=f+b|0,h=(0,t.rotl)(h^f,7),c=c+l|0,v=(0,t.rotl)(v^c,16),p=p+v|0,l=(0,t.rotl)(l^p,12),c=c+l|0,v=(0,t.rotl)(v^c,8),p=p+v|0,l=(0,t.rotl)(l^p,7);let E=0;i[E++]=o,i[E++]=s,i[E++]=a,i[E++]=c,i[E++]=y,i[E++]=b,i[E++]=v,i[E++]=w}e.chacha20orig=(0,t.createCipher)(o,{counterRight:!1,counterLength:8,allowShortKeys:!0}),e.chacha20=(0,t.createCipher)(o,{counterRight:!1,counterLength:4,allowShortKeys:!1}),e.xchacha20=(0,t.createCipher)(o,{counterRight:!1,counterLength:8,extendNonceFn:s,allowShortKeys:!1}),e.chacha8=(0,t.createCipher)(o,{counterRight:!1,counterLength:4,rounds:8}),e.chacha12=(0,t.createCipher)(o,{counterRight:!1,counterLength:4,rounds:12});const a=new Uint8Array(16),c=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(a.subarray(n))},l=new Uint8Array(32);function u(e,t,n,o,s){const a=e(t,n,l),u=r.poly1305.create(a);s&&c(u,s),c(u,o);const d=new Uint8Array(16),h=(0,i.createView)(d);(0,i.setBigUint64)(h,0,BigInt(s?s.length:0),!0),(0,i.setBigUint64)(h,8,BigInt(o.length),!0),u.update(d);const f=u.digest();return(0,i.clean)(a,d),f}e._poly1305_aead=e=>(t,r,o)=>((0,n.bytes)(t,32),(0,n.bytes)(r),{encrypt(s,a){const c=s.length,l=c+16;a?(0,n.bytes)(a,l):a=new Uint8Array(l),e(t,r,s,a,1);const d=u(e,t,r,a.subarray(0,-16),o);return a.set(d,c),(0,i.clean)(d),a},decrypt(s,a){const c=s.length,l=c-16;if(c<16)throw new Error("encrypted data must be at least 16 bytes");a?(0,n.bytes)(a,l):a=new Uint8Array(l);const d=s.subarray(0,-16),h=s.subarray(-16),f=u(e,t,r,d,o);if(!(0,i.equalBytes)(h,f))throw new Error("invalid tag");return e(t,r,d,a,1),(0,i.clean)(f),a}}),e.chacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,e._poly1305_aead)(e.chacha20)),e.xchacha20poly1305=(0,i.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,e._poly1305_aead)(e.xchacha20))}(_re),Object.defineProperty(Ere,"__esModule",{value:!0}),Ere.xchacha20=void 0;var zre,Hre,qre,Wre=_re;Ere.xchacha20=function(e,t,n){return(0,Wre.xchacha20poly1305)(e,t,n)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var t=m9,n=O9,r=kne,i=Ere,o=S9,s=C9;function a(e,t,n,a){var c=(0,o.symmetricAlgorithm)();if("aes-256-gcm"===c)return e(r.aes256gcm,t,n,(0,o.symmetricNonceLength)(),s.AEAD_TAG_LENGTH,a);if("xchacha20"===c)return e(i.xchacha20,t,n,s.XCHACHA20_NONCE_LENGTH,s.AEAD_TAG_LENGTH,a);if("aes-256-cbc"===c)return e(r.aes256cbc,t,n,16,0);throw new Error("Not implemented")}function c(e,r,i,o,s,a){var c=(0,n.randomBytes)(o),l=e(r,c,a).encrypt(i);if(0===s)return(0,t.concatBytes)(c,l);var u=l.length-s,d=l.subarray(0,u),h=l.subarray(u);return(0,t.concatBytes)(c,h,d)}function l(e,n,r,i,o,s){var a=r.subarray(0,i),c=e(n,Uint8Array.from(a),s),l=r.subarray(i);if(0===o)return c.decrypt(l);var u=l.subarray(0,o),d=l.subarray(o);return c.decrypt((0,t.concatBytes)(d,u))}e.symEncrypt=function(e,t,n){return a(c,e,t,n)},e.symDecrypt=function(e,t,n){return a(l,e,t,n)},e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt}(xne),zre=P9,Hre=d9&&d9.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),qre=d9&&d9.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||Hre(t,e,n)},Object.defineProperty(zre,"__esModule",{value:!0}),qre(M9,zre),qre(pne,zre),qre(fne,zre),qre(xne,zre);var Kre={};Object.defineProperty(Kre,"__esModule",{value:!0}),Kre.PublicKey=void 0;var Gre=m9,Vre=P9,Zre=function(){function e(e){this.data=(0,Vre.convertPublicKeyFormat)(e,!0)}return e.fromHex=function(t){return new e((0,Vre.hexToPublicKey)(t))},Object.defineProperty(e.prototype,"uncompressed",{get:function(){return S7.from((0,Vre.convertPublicKeyFormat)(this.data,!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"compressed",{get:function(){return S7.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(e){return void 0===e&&(e=!0),(0,Gre.bytesToHex)(e?this.data:this.uncompressed)},e.prototype.decapsulate=function(e,t){void 0===t&&(t=!1);var n=t?this.data:this.uncompressed,r=e.multiply(this,t);return(0,Vre.getSharedKey)(n,r)},e.prototype.equals=function(e){return(0,Gre.equalBytes)(this.data,e.data)},e}();Kre.PublicKey=Zre,Object.defineProperty(A9,"__esModule",{value:!0}),A9.PrivateKey=void 0;var Yre=m9,Jre=P9,Qre=Kre,Xre=function(){function e(e){if(void 0===e)this.data=(0,Jre.getValidSecret)();else{if(!(0,Jre.isValidPrivateKey)(e))throw new Error("Invalid private key");this.data=e}this.publicKey=new Qre.PublicKey((0,Jre.getPublicKey)(this.data))}return e.fromHex=function(t){return new e((0,Jre.decodeHex)(t))},Object.defineProperty(e.prototype,"secret",{get:function(){return S7.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(){return(0,Yre.bytesToHex)(this.data)},e.prototype.encapsulate=function(e,t){void 0===t&&(t=!1);var n=t?this.publicKey.compressed:this.publicKey.uncompressed,r=this.multiply(e,t);return(0,Jre.getSharedKey)(n,r)},e.prototype.multiply=function(e,t){return void 0===t&&(t=!1),(0,Jre.getSharedPoint)(this.data,e.compressed,t)},e.prototype.equals=function(e){return(0,Yre.equalBytes)(this.data,e.data)},e}();A9.PrivateKey=Xre,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var t=A9;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return t.PrivateKey}});var n=Kre;Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return n.PublicKey}})}(I9),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=function(e,o){var s=new r.PrivateKey,a=e instanceof Uint8Array?new r.PublicKey(e):r.PublicKey.fromHex(e),c=s.encapsulate(a,(0,n.isHkdfKeyCompressed)()),l=(0,n.isEphemeralKeyCompressed)()?s.publicKey.compressed:s.publicKey.uncompressed,u=(0,i.symEncrypt)(c,o);return S7.from((0,t.concatBytes)(l,u))},e.decrypt=function(e,t){var o=e instanceof Uint8Array?new r.PrivateKey(e):r.PrivateKey.fromHex(e),s=(0,n.ephemeralKeySize)(),a=new r.PublicKey(t.subarray(0,s)),c=t.subarray(s),l=a.decapsulate(o,(0,n.isHkdfKeyCompressed)());return S7.from((0,i.symDecrypt)(l,c))};var t=m9,n=S9,r=I9,i=P9,o=S9;Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return o.ECIES_CONFIG}});var s=I9;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return s.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return s.PublicKey}}),e.utils={aesEncrypt:i.aesEncrypt,aesDecrypt:i.aesDecrypt,symEncrypt:i.symEncrypt,symDecrypt:i.symDecrypt,decodeHex:i.decodeHex,getValidSecret:i.getValidSecret,remove0x:i.remove0x}}(p9);const eie=f1("KeyExchange:Layer"),tie=f1("SocketService:Layer"),nie=f1("Ecies:Layer"),rie=f1("RemoteCommunication:Layer");eie.color="##95c44e",tie.color="#f638d7",nie.color="#465b9c",rie.color="#47a2be";const iie={KeyExchange:eie,SocketService:tie,Ecies:nie,RemoteCommunication:rie};let oie,sie=[],aie=[];const cie=(e,t)=>l7(void 0,void 0,void 0,function*(){oie=t,aie.push(e),function(e){return l7(this,void 0,void 0,function*(){if(!oie||!e)return;!function(){const e=aie;aie=sie,sie=e}();const t=oie.endsWith("/")?`${oie}evt`:`${oie}/evt`,n=Object.assign({},e);if(delete n.params,e.params)for(const[o,s]of Object.entries(e.params))n[o]=s;const r=JSON.stringify(n);iie.RemoteCommunication(`[sendBufferedEvents] Sending ${sie.length} analytics events to ${t}`);try{const e=yield A4(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:r}),n=yield e.text();iie.RemoteCommunication(`[sendBufferedEvents] Response: ${n}`),sie.length=0}catch(i){}})}(e).catch(()=>{})});class lie{constructor(e){this.enabled=!0,(null==e?void 0:e.debug)&&f1.enable("Ecies:Layer"),this.ecies=(null==e?void 0:e.privateKey)?p9.PrivateKey.fromHex(e.privateKey):new p9.PrivateKey,iie.Ecies("[ECIES constructor()] initialized secret: ",this.ecies.toHex()),iie.Ecies("[ECIES constructor()] initialized public: ",this.ecies.publicKey.toHex()),iie.Ecies("[ECIES constructor()] init with",this)}generateECIES(){this.ecies=new p9.PrivateKey}getPublicKey(){return this.ecies.publicKey.toHex()}encrypt(e,t){let n=e;if(this.enabled)try{iie.Ecies("[ECIES: encrypt()] using otherPublicKey",t);const r=S7.from(e),i=p9.encrypt(t,r);n=S7.from(i).toString("base64")}catch(r){throw iie.Ecies("[ECIES: encrypt()] error encrypt:",r),iie.Ecies("[ECIES: encrypt()] private: ",this.ecies.toHex()),iie.Ecies("[ECIES: encrypt()] data: ",e),iie.Ecies("[ECIES: encrypt()] otherkey: ",t),r}return n}decrypt(e){let t=e;if(this.enabled)try{iie.Ecies("[ECIES: decrypt()] using privateKey",this.ecies.toHex());const n=S7.from(e.toString(),"base64");t=p9.decrypt(this.ecies.toHex(),n).toString()}catch(n){throw iie.Ecies("[ECIES: decrypt()] error decrypt",n),iie.Ecies("[ECIES: decrypt()] private: ",this.ecies.toHex()),iie.Ecies("[ECIES: decrypt()] encryptedData: ",e),n}return t}getKeyInfo(){return{private:this.ecies.toHex(),public:this.ecies.publicKey.toHex()}}toString(){iie.Ecies("[ECIES: toString()]",this.getKeyInfo())}}var uie="0.32.0";const die="https://metamask-sdk.api.cx.metamask.io/",hie=["websocket"],fie=6048e5,pie=3e3,mie="eth_requestAccounts";function gie(e){const{context:t}=e;iie.RemoteCommunication(`[RemoteCommunication: clean()] context=${t}`),e.channelConfig=void 0,e.ready=!1,e.originatorConnectStarted=!1}var yie,bie,vie,wie,Eie,_ie,xie,kie;(xie=yie||(yie={})).DISCONNECTED="disconnected",xie.WAITING="waiting",xie.TIMEOUT="timeout",xie.LINKED="linked",xie.PAUSED="paused",xie.TERMINATED="terminated",(kie=bie||(bie={})).KEY_INFO="key_info",kie.SERVICE_STATUS="service_status",kie.PROVIDER_UPDATE="provider_update",kie.RPC_UPDATE="rpc_update",kie.KEYS_EXCHANGED="keys_exchanged",kie.JOIN_CHANNEL="join_channel",kie.PUBLIC_KEY="public_key",kie.CHANNEL_CREATED="channel_created",kie.CLIENTS_CONNECTED="clients_connected",kie.CLIENTS_DISCONNECTED="clients_disconnected",kie.CLIENTS_WAITING="clients_waiting",kie.CLIENTS_READY="clients_ready",kie.REJECTED="rejected",kie.WALLET_INIT="wallet_init",kie.CHANNEL_PERSISTENCE="channel_persistence",kie.CONFIG="config",kie.MESSAGE_ACK="ack",kie.SOCKET_DISCONNECTED="socket_disconnected",kie.SOCKET_RECONNECT="socket_reconnect",kie.OTP="otp",kie.SDK_RPC_CALL="sdk_rpc_call",kie.AUTHORIZED="authorized",kie.CONNECTION_STATUS="connection_status",kie.MESSAGE="message",kie.TERMINATE="terminate",(vie||(vie={})).KEY_EXCHANGE="key_exchange",function(e){e.KEY_HANDSHAKE_START="key_handshake_start",e.KEY_HANDSHAKE_CHECK="key_handshake_check",e.KEY_HANDSHAKE_SYN="key_handshake_SYN",e.KEY_HANDSHAKE_SYNACK="key_handshake_SYNACK",e.KEY_HANDSHAKE_ACK="key_handshake_ACK",e.KEY_HANDSHAKE_WALLET="key_handshake_wallet",e.KEY_HANDSHAKE_NONE="none"}(wie||(wie={}));class Sie extends M4.EventEmitter2{constructor({communicationLayer:e,otherPublicKey:t,context:n,ecies:r,logging:i}){super(),this.keysExchanged=!1,this.step=wie.KEY_HANDSHAKE_NONE,this.debug=!1,this.context=n,this.communicationLayer=e,(null==r?void 0:r.privateKey)&&t&&(iie.KeyExchange(`[KeyExchange: constructor()] otherPubKey=${t} set keysExchanged to true!`,r),this.keysExchanged=!0),this.myECIES=new lie(Object.assign(Object.assign({},r),{debug:null==i?void 0:i.eciesLayer})),this.communicationLayer.state.eciesInstance=this.myECIES,this.myPublicKey=this.myECIES.getPublicKey(),this.debug=!0===(null==i?void 0:i.keyExchangeLayer),t&&this.setOtherPublicKey(t),this.communicationLayer.on(vie.KEY_EXCHANGE,this.onKeyExchangeMessage.bind(this))}onKeyExchangeMessage(e){const{relayPersistence:t}=this.communicationLayer.remote.state;if(iie.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} keysExchanged=${this.keysExchanged} relayPersistence=${t}`,e),t)return void iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Ignoring key exchange message because relay persistence is activated");const{message:n}=e;this.keysExchanged&&iie.KeyExchange(`[KeyExchange: onKeyExchangeMessage()] context=${this.context} received handshake while already exchanged. step=${this.step} otherPubKey=${this.otherPublicKey}`),this.emit(bie.KEY_INFO,n.type),n.type===wie.KEY_HANDSHAKE_SYN?(this.checkStep([wie.KEY_HANDSHAKE_NONE,wie.KEY_HANDSHAKE_ACK]),iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYN",n),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:wie.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey}).catch(e=>{iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_SYNACK",e)}),this.setStep(wie.KEY_HANDSHAKE_ACK)):n.type===wie.KEY_HANDSHAKE_SYNACK?(this.checkStep([wie.KEY_HANDSHAKE_SYNACK,wie.KEY_HANDSHAKE_ACK,wie.KEY_HANDSHAKE_NONE]),iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_SYNACK"),n.pubkey&&this.setOtherPublicKey(n.pubkey),this.communicationLayer.sendMessage({type:wie.KEY_HANDSHAKE_ACK}).catch(e=>{iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] Error sending KEY_HANDSHAKE_ACK",e)}),this.keysExchanged=!0,this.setStep(wie.KEY_HANDSHAKE_ACK),this.emit(bie.KEYS_EXCHANGED)):n.type===wie.KEY_HANDSHAKE_ACK&&(iie.KeyExchange("[KeyExchange: onKeyExchangeMessage()] KEY_HANDSHAKE_ACK set keysExchanged to true!"),this.checkStep([wie.KEY_HANDSHAKE_ACK,wie.KEY_HANDSHAKE_NONE]),this.keysExchanged=!0,this.setStep(wie.KEY_HANDSHAKE_ACK),this.emit(bie.KEYS_EXCHANGED))}resetKeys(e){this.clean(),this.myECIES=new lie(e)}clean(){iie.KeyExchange(`[KeyExchange: clean()] context=${this.context} reset handshake state`),this.setStep(wie.KEY_HANDSHAKE_NONE),this.emit(bie.KEY_INFO,this.step),this.keysExchanged=!1}start({isOriginator:e,force:t}){const{relayPersistence:n,protocolVersion:r}=this.communicationLayer.remote.state,i=r>=2;n?iie.KeyExchange("[KeyExchange: start()] Ignoring key exchange message because relay persistence is activated"):(iie.KeyExchange(`[KeyExchange: start()] context=${this.context} protocolVersion=${r} isOriginator=${e} step=${this.step} force=${t} relayPersistence=${n} keysExchanged=${this.keysExchanged}`),e?!(this.keysExchanged||this.step!==wie.KEY_HANDSHAKE_NONE&&this.step!==wie.KEY_HANDSHAKE_SYNACK)||t?(iie.KeyExchange(`[KeyExchange: start()] context=${this.context} -- start key exchange (force=${t}) -- step=${this.step}`,this.step),this.clean(),this.setStep(wie.KEY_HANDSHAKE_SYNACK),this.communicationLayer.sendMessage({type:wie.KEY_HANDSHAKE_SYN,pubkey:this.myPublicKey,v:2}).catch(e=>{iie.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYN",e)})):iie.KeyExchange(`[KeyExchange: start()] context=${this.context} -- key exchange already ${this.keysExchanged?"done":"in progress"} -- aborted.`,this.step):this.keysExchanged&&!0!==t?iie.KeyExchange("[KeyExchange: start()] don't send KEY_HANDSHAKE_START -- exchange already done."):i?this.communicationLayer.sendMessage({type:wie.KEY_HANDSHAKE_SYNACK,pubkey:this.myPublicKey,v:2}).catch(e=>{iie.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_SYNACK",e)}):(this.communicationLayer.sendMessage({type:wie.KEY_HANDSHAKE_START}).catch(e=>{iie.KeyExchange("[KeyExchange: start()] Error sending KEY_HANDSHAKE_START",e)}),this.clean()))}setStep(e){this.step=e,this.emit(bie.KEY_INFO,e)}checkStep(e){e.length>0&&e.indexOf(this.step.toString())}setRelayPersistence({localKey:e,otherKey:t}){this.otherPublicKey=t,this.myECIES=new lie({privateKey:e,debug:this.debug}),this.keysExchanged=!0}setKeysExchanged(e){this.keysExchanged=e}areKeysExchanged(){return this.keysExchanged}getMyPublicKey(){return this.myPublicKey}getOtherPublicKey(){return this.otherPublicKey}setOtherPublicKey(e){iie.KeyExchange("[KeyExchange: setOtherPubKey()]",e),this.otherPublicKey=e}encryptMessage(e){if(!this.otherPublicKey)throw new Error("encryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.encrypt(e,this.otherPublicKey)}decryptMessage(e){if(!this.otherPublicKey)throw new Error("decryptMessage: Keys not exchanged - missing otherPubKey");return this.myECIES.decrypt(e)}getKeyInfo(){return{ecies:Object.assign(Object.assign({},this.myECIES.getKeyInfo()),{otherPubKey:this.otherPublicKey}),step:this.step,keysExchanged:this.areKeysExchanged()}}toString(){const e={keyInfo:this.getKeyInfo(),keysExchanged:this.keysExchanged,step:this.step};return JSON.stringify(e)}}!function(e){e.TERMINATE="terminate",e.ANSWER="answer",e.OFFER="offer",e.CANDIDATE="candidate",e.JSONRPC="jsonrpc",e.WALLET_INFO="wallet_info",e.WALLET_INIT="wallet_init",e.ORIGINATOR_INFO="originator_info",e.PAUSE="pause",e.OTP="otp",e.AUTHORIZED="authorized",e.PING="ping",e.READY="ready"}(Eie||(Eie={})),function(e){e.REQUEST="sdk_connect_request_started",e.REQUEST_MOBILE="sdk_connect_request_started_mobile",e.RECONNECT="sdk_reconnect_request_started",e.CONNECTED="sdk_connection_established",e.CONNECTED_MOBILE="sdk_connection_established_mobile",e.AUTHORIZED="sdk_connection_authorized",e.REJECTED="sdk_connection_rejected",e.TERMINATED="sdk_connection_terminated",e.DISCONNECTED="sdk_disconnected",e.SDK_USE_EXTENSION="sdk_use_extension",e.SDK_RPC_REQUEST="sdk_rpc_request",e.SDK_RPC_REQUEST_RECEIVED="sdk_rpc_request_received",e.SDK_RPC_REQUEST_DONE="sdk_rpc_request_done",e.SDK_EXTENSION_UTILIZED="sdk_extension_utilized",e.SDK_USE_INAPP_BROWSER="sdk_use_inapp_browser"}(_ie||(_ie={}));const Cie=(e,t,n)=>l7(void 0,void 0,void 0,function*(){var r,i,o,s,a,c;const{remote:l,state:u}=e,{channelId:d,isOriginator:h}=u;if("error_terminated"===t)return iie.SocketService(`handleJoinChannelResults: Channel ${d} terminated`),void e.emit(bie.TERMINATE);if(!n)return void iie.SocketService(`handleJoinChannelResults: No result for channel ${d}`);const{persistence:f,walletKey:p,rejected:m}=n;if(iie.SocketService(`handleJoinChannelResults: Channel ${d} persistence=${f} walletKey=${p} rejected=${m}`),m)return iie.SocketService(`handleJoinChannelResults: Channel ${d} rejected`),yield e.remote.disconnect({terminate:!0}),e.remote.emit(bie.REJECTED,{channelId:d}),void e.remote.emitServiceStatusEvent();if(p&&!(null===(r=l.state.channelConfig)||void 0===r?void 0:r.otherKey)){e.getKeyExchange().setOtherPublicKey(p),null===(i=e.state.keyExchange)||void 0===i||i.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(bie.AUTHORIZED);const{communicationLayer:t,storageManager:n}=l.state,r=Object.assign(Object.assign({},l.state.channelConfig),{channelId:null!==(o=l.state.channelId)&&void 0!==o?o:"",validUntil:Date.now()+fie,localKey:null==t?void 0:t.getKeyInfo().ecies.private,otherKey:p});e.sendMessage({type:wie.KEY_HANDSHAKE_ACK}).catch(e=>{}),null===(s=e.state.socket)||void 0===s||s.emit(Eie.PING,{id:d,clientType:h?"dapp":"wallet",context:"on_channel_reconnect",message:""}),yield null==n?void 0:n.persistChannelConfig(r),l.emitServiceStatusEvent(),l.setConnectionStatus(yie.LINKED)}f&&(e.emit(bie.CHANNEL_PERSISTENCE),null===(a=e.state.keyExchange)||void 0===a||a.setKeysExchanged(!0),l.state.ready=!0,l.state.authorized=!0,l.emit(bie.AUTHORIZED),cie(Object.assign(Object.assign({id:null!=d?d:"",event:h?_ie.CONNECTED:_ie.CONNECTED_MOBILE},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:uie,walletVersion:null===(c=e.remote.state.walletInfo)||void 0===c?void 0:c.version}),u.communicationServerUrl).catch(e=>{}))}),Iie=e=>new Promise(t=>{setTimeout(t,e)}),Aie=(e,t,...n)=>l7(void 0,[e,t,...n],void 0,function*(e,t,n=200){let r;const i=Date.now();let o=!1;for(;!o;){if(o=Date.now()-i>3e5,r=t[e],void 0!==r.elapsedTime)return r;yield Iie(n)}throw new Error(`RPC ${e} timed out`)}),Pie=e=>l7(void 0,void 0,void 0,function*(){const{state:t}=e,{socket:n,channelId:r,context:i,isOriginator:o,isReconnecting:s}=t;if(s)return iie.SocketService("[SocketService: reconnectSocket()] Reconnection already in progress, skipping",e),!1;if(!n)return iie.SocketService("[SocketService: reconnectSocket()] socket is not defined",e),!1;if(!r)return!1;const{connected:a}=n;t.isReconnecting=!0,t.reconnectionAttempts=0,iie.SocketService(`[SocketService: reconnectSocket()] connected=${a} trying to reconnect after socketio disconnection`,e);try{for(;3>t.reconnectionAttempts;){if(iie.SocketService(`[SocketService: reconnectSocket()] Attempt ${t.reconnectionAttempts+1} of 3`,e),yield Iie(200),n.connected)return iie.SocketService("Socket already connected --- ping to retrieve messages"),n.emit(Eie.PING,{id:r,clientType:o?"dapp":"wallet",context:"on_channel_config",message:""}),!0;t.resumed=!0,n.connect(),e.emit(bie.SOCKET_RECONNECT);try{if(yield new Promise((t,s)=>{n.emit(bie.JOIN_CHANNEL,{channelId:r,context:`${i}connect_again`,clientType:o?"dapp":"wallet"},(n,r)=>l7(void 0,void 0,void 0,function*(){try{yield Cie(e,n,r),t()}catch(i){s(i)}}))}),yield Iie(100),n.connected)return iie.SocketService(`Reconnection successful on attempt ${t.reconnectionAttempts+1}`),!0}catch(c){iie.SocketService(`Error during reconnection attempt ${t.reconnectionAttempts+1}:`,c)}t.reconnectionAttempts+=1,3>t.reconnectionAttempts&&(yield Iie(200))}return iie.SocketService("Failed to reconnect after 3 attempts"),!1}finally{t.isReconnecting=!1,t.reconnectionAttempts=0}});function Mie(e,t){return l7(this,void 0,void 0,function*(){var n;const r=null===(n=e.state.keyExchange)||void 0===n?void 0:n.encryptMessage(JSON.stringify(t)),i={id:e.state.channelId,context:e.state.context,clientType:e.state.isOriginator?"dapp":"wallet",message:r,plaintext:e.state.hasPlaintext?JSON.stringify(t):void 0};return iie.SocketService(`[SocketService: encryptAndSendMessage()] context=${e.state.context}`,i),t.type===Eie.TERMINATE&&(e.state.manualDisconnect=!0),new Promise((t,n)=>{var r;null===(r=e.state.socket)||void 0===r||r.emit(bie.MESSAGE,i,(e,r)=>{var i;e&&(iie.SocketService(`[SocketService: encryptAndSendMessage()] error=${e}`),n(e)),iie.SocketService("[encryptAndSendMessage] response",r),t(null!==(i=null==r?void 0:r.success)&&void 0!==i&&i)})})})}var Oie;!function(e){e.RPC_CHECK="rpcCheck",e.SKIPPED_RPC="skippedRpc"}(Oie||(Oie={}));const Tie=["eth_sendTransaction","eth_signTypedData","eth_signTransaction","personal_sign","wallet_requestPermissions","wallet_switchEthereumChain","eth_signTypedData_v3","eth_signTypedData_v4","metamask_connectSign","metamask_connectWith","metamask_batch"].map(e=>e.toLowerCase()),Rie=[{event:bie.CLIENTS_CONNECTED,handler:function(e,t){return n=>l7(this,void 0,void 0,function*(){var n,r,i,o,s,a,c,l,u,d,h;const f=null!==(r=null===(n=e.remote.state.channelConfig)||void 0===n?void 0:n.relayPersistence)&&void 0!==r&&r;if(iie.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected-${t}' relayPersistence=${f} resumed=${e.state.resumed} clientsPaused=${e.state.clientsPaused} keysExchanged=${null===(i=e.state.keyExchange)||void 0===i?void 0:i.areKeysExchanged()} isOriginator=${e.state.isOriginator}`),e.emit(bie.CLIENTS_CONNECTED,{isOriginator:e.state.isOriginator,keysExchanged:null===(o=e.state.keyExchange)||void 0===o?void 0:o.areKeysExchanged(),context:e.state.context}),e.state.resumed)e.state.isOriginator||(iie.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} 'clients_connected' / keysExchanged=${null===(s=e.state.keyExchange)||void 0===s?void 0:s.areKeysExchanged()} -- backward compatibility`),null===(a=e.state.keyExchange)||void 0===a||a.start({isOriginator:null!==(c=e.state.isOriginator)&&void 0!==c&&c})),e.state.resumed=!1;else if(e.state.clientsPaused)iie.SocketService("[SocketService: handleClientsConnected()] 'clients_connected' skip sending originatorInfo on pause");else if(!e.state.isOriginator){const t=!f;iie.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${null===(l=e.state.keyExchange)||void 0===l?void 0:l.areKeysExchanged()} -- force=${t} -- backward compatibility`),iie.SocketService(`[SocketService: handleClientsConnected()] context=${e.state.context} on 'clients_connected' / keysExchanged=${null===(u=e.state.keyExchange)||void 0===u?void 0:u.areKeysExchanged()} -- force=${t} -- backward compatibility`),null===(d=e.state.keyExchange)||void 0===d||d.start({isOriginator:null!==(h=e.state.isOriginator)&&void 0!==h&&h,force:t})}e.state.clientsConnected=!0,e.state.clientsPaused=!1})}},{event:bie.CHANNEL_CREATED,handler:function(e,t){return n=>{iie.SocketService(`[SocketService: handleChannelCreated()] context=${e.state.context} on 'channel_created-${t}'`,n),e.emit(bie.CHANNEL_CREATED,n)}}},{event:bie.CLIENTS_DISCONNECTED,handler:function(e,t){return()=>{var n;e.state.clientsConnected=!1,iie.SocketService(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}'`),e.remote.state.relayPersistence?iie.SocketService(`[SocketService: handlesClientsDisconnected()] context=${e.state.context} on 'clients_disconnected-${t}' - relayPersistence enabled, skipping key exchange cleanup.`):(e.state.isOriginator&&!e.state.clientsPaused&&(null===(n=e.state.keyExchange)||void 0===n||n.clean()),e.emit(bie.CLIENTS_DISCONNECTED,t))}}},{event:bie.CONFIG,handler:function(e,t){return n=>l7(this,void 0,void 0,function*(){var r,i,o;iie.SocketService(`[SocketService: handleChannelConfig()] update relayPersistence on 'config-${t}'`,n);const{persistence:s,walletKey:a}=n;e.state.isOriginator&&e.remote.state.channelConfig?(n.walletKey&&!e.remote.state.channelConfig.otherKey&&(iie.SocketService(`Setting wallet key ${a}`),e.remote.state.channelConfig.otherKey=a,e.getKeyExchange().setOtherPublicKey(n.walletKey),null===(r=e.state.keyExchange)||void 0===r||r.setKeysExchanged(!0),yield e.remote.sendMessage({type:wie.KEY_HANDSHAKE_ACK}),yield e.remote.sendMessage({type:Eie.PING}),yield null===(i=e.remote.state.storageManager)||void 0===i?void 0:i.persistChannelConfig(e.remote.state.channelConfig)),!0!==s||e.remote.state.channelConfig.relayPersistence||(iie.SocketService(`Setting relay persistence ${s}`),e.remote.state.channelConfig.relayPersistence=s,e.remote.state.relayPersistence=!0,e.remote.emit(bie.CHANNEL_PERSISTENCE),e.remote.state.authorized=!0,e.remote.state.ready=!0,e.remote.emit(bie.AUTHORIZED),yield null===(o=e.remote.state.storageManager)||void 0===o?void 0:o.persistChannelConfig(e.remote.state.channelConfig))):e.state.isOriginator||n.persistence&&(e.remote.state.relayPersistence=!0,e.remote.emit(bie.CHANNEL_PERSISTENCE))})}},{event:bie.MESSAGE,handler:function(e,t){return n=>{var r,i,o,s,a,c,l,u,d,h,f,p,m,g,y,b,v,w;const{ackId:E,message:_,error:x}=n,k=null!==(r=e.remote.state.relayPersistence)&&void 0!==r&&r;if(iie.SocketService(`[SocketService handleMessage()] relayPersistence=${k} context=${e.state.context} on 'message' ${t} keysExchanged=${null===(i=e.state.keyExchange)||void 0===i?void 0:i.areKeysExchanged()}`,n),x)throw iie.SocketService(`\n [SocketService handleMessage()] context=${e.state.context}::on 'message' error=${x}`),new Error(x);const S="string"==typeof _;if(!S&&(null==_?void 0:_.type)===wie.KEY_HANDSHAKE_START){if(k)return;return iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received HANDSHAKE_START isOriginator=${e.state.isOriginator}`,_),void(null===(o=e.state.keyExchange)||void 0===o||o.start({isOriginator:null!==(s=e.state.isOriginator)&&void 0!==s&&s,force:!0}))}if(!S&&(null===(a=null==_?void 0:_.type)||void 0===a?void 0:a.startsWith("key_handshake"))){if(k)return;return iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' emit KEY_EXCHANGE`,_),void e.emit(vie.KEY_EXCHANGE,{message:_,context:e.state.context})}if(S&&!(null===(c=e.state.keyExchange)||void 0===c?void 0:c.areKeysExchanged())){let t=!1;try{iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' trying to decrypt message`),null===(l=e.state.keyExchange)||void 0===l||l.decryptMessage(_),t=!0}catch(A){iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' error`,A)}if(!t)return e.state.isOriginator?null===(d=e.state.keyExchange)||void 0===d||d.start({isOriginator:null!==(h=e.state.isOriginator)&&void 0!==h&&h}):e.sendMessage({type:wie.KEY_HANDSHAKE_START}).catch(e=>{}),void iie.SocketService(`Message ignored because invalid key exchange status. step=${null===(f=e.state.keyExchange)||void 0===f?void 0:f.getKeyInfo().step}`,null===(p=e.state.keyExchange)||void 0===p?void 0:p.getKeyInfo(),_);iie.SocketService("Invalid key exchange status detected --- updating it."),null===(u=e.state.keyExchange)||void 0===u||u.setKeysExchanged(!0)}else if(!S&&(null==_?void 0:_.type))return void e.emit(bie.MESSAGE,_);if(!S)return void e.emit(bie.MESSAGE,_);const C=null===(m=e.state.keyExchange)||void 0===m?void 0:m.decryptMessage(_),I=JSON.parse(null!=C?C:"{}");if(E&&(null==E?void 0:E.length)>0&&(iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' ackid=${E} channelId=${t}`),null===(g=e.state.socket)||void 0===g||g.emit(bie.MESSAGE_ACK,{ackId:E,channelId:t,clientType:e.state.isOriginator?"dapp":"wallet"})),e.state.clientsPaused=(null==I?void 0:I.type)===Eie.PAUSE,e.state.isOriginator&&I.data){const t=I.data,n=e.state.rpcMethodTracker[t.id];if(n){const r=Date.now()-n.timestamp;iie.SocketService(`[SocketService handleMessage()] context=${e.state.context}::on 'message' received answer for id=${t.id} method=${n.method} responseTime=${r}`,I),e.remote.state.analytics&&Tie.includes(n.method.toLowerCase())&&cie(Object.assign(Object.assign({id:null!==(y=e.remote.state.channelId)&&void 0!==y?y:"",event:_ie.SDK_RPC_REQUEST_DONE,sdkVersion:e.remote.state.sdkVersion,commLayerVersion:uie},e.remote.state.originatorInfo),{walletVersion:null===(b=e.remote.state.walletInfo)||void 0===b?void 0:b.version,params:{method:n.method,from:"mobile"}}),e.remote.state.communicationServerUrl).catch(e=>{});const i=Object.assign(Object.assign({},n),{result:t.result,error:t.error?{code:null===(v=t.error)||void 0===v?void 0:v.code,message:null===(w=t.error)||void 0===w?void 0:w.message}:void 0,elapsedTime:r});e.state.rpcMethodTracker[t.id]=i,e.emit(bie.RPC_UPDATE,i)}}e.emit(bie.MESSAGE,{message:I})}}},{event:bie.REJECTED,handler:function(e,t){return n=>l7(this,void 0,void 0,function*(){var n;e.state.isOriginator&&!e.remote.state.ready?(iie.SocketService(`[SocketService: handleChannelRejected()] context=${e.state.context} channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`,e.remote.state.originatorInfo),cie(Object.assign(Object.assign({id:t,event:_ie.REJECTED},e.remote.state.originatorInfo),{sdkVersion:e.remote.state.sdkVersion,commLayer:e.state.communicationLayerPreference,commLayerVersion:uie,walletVersion:null===(n=e.remote.state.walletInfo)||void 0===n?void 0:n.version}),e.remote.state.communicationServerUrl).catch(e=>{}),yield e.remote.disconnect({terminate:!0}),e.remote.emit(bie.REJECTED,{channelId:t}),e.remote.setConnectionStatus(yie.DISCONNECTED)):iie.SocketService(`[SocketService: handleChannelRejected()] SKIP -- channelId=${t} isOriginator=${e.state.isOriginator} ready=${e.remote.state.ready}`)})}},{event:"clients_waiting_to_join",handler:function(e,t){return n=>{iie.SocketService(`[SocketService: handleClientsWaitingToJoin()] context=${e.state.context} on 'clients_waiting_to_join-${t}'`,n),e.emit(bie.CLIENTS_WAITING,n)}}}],Nie=[{event:bie.KEY_INFO,handler:function(e){return t=>{iie.SocketService("[SocketService: handleKeyInfo()] on 'KEY_INFO'",t),e.emit(bie.KEY_INFO,t)}}},{event:bie.KEYS_EXCHANGED,handler:function(e){return()=>{var t,n,r;iie.SocketService(`[SocketService: handleKeysExchanged()] on 'keys_exchanged' keyschanged=${null===(t=e.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged()}`);const{channelConfig:i}=e.remote.state;if(i){const t=e.getKeyExchange().getKeyInfo().ecies;i.localKey=t.private,i.otherKey=t.otherPubKey,e.remote.state.channelConfig=i,null===(n=e.remote.state.storageManager)||void 0===n||n.persistChannelConfig(i).catch(e=>{})}e.emit(bie.KEYS_EXCHANGED,{keysExchanged:null===(r=e.state.keyExchange)||void 0===r?void 0:r.areKeysExchanged(),isOriginator:e.state.isOriginator});const o={keyInfo:e.getKeyInfo()};e.emit(bie.SERVICE_STATUS,o)}}}];function Lie(e,t){iie.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} setting socket listeners for channel ${t}...`);const{socket:n}=e.state,{keyExchange:r}=e.state;n&&e.state.isOriginator&&(e.state.debug&&(null==n||n.io.on("error",t=>{iie.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=error`,t)}),null==n||n.io.on("reconnect",t=>{iie.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect`,t),Pie(e).catch(e=>{})}),null==n||n.io.on("reconnect_error",t=>{iie.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_error`,t)}),null==n||n.io.on("reconnect_failed",()=>{iie.SocketService(`[SocketService: setupChannelListener()] context=${e.state.context} socket event=reconnect_failed`)})),null==n||n.on("disconnect",t=>(iie.SocketService(`[SocketService: setupChannelListener()] on 'disconnect' -- MetaMaskSDK socket disconnected '${t}' begin recovery...`),function(e){return t=>{iie.SocketService(`[SocketService: handleDisconnect()] on 'disconnect' manualDisconnect=${e.state.manualDisconnect}`,t),e.state.manualDisconnect||(e.emit(bie.SOCKET_DISCONNECTED),Pie(e).catch(e=>{}))}}(e)(t)))),Rie.forEach(({event:r,handler:i})=>{null==n||n.on(`${r}-${t}`,i(e,t))}),Nie.forEach(({event:t,handler:n})=>{null==r||r.on(t,n(e))}),e.state.setupChannelListeners=!0}class Bie extends M4.EventEmitter2{constructor(e){super(),this.state={clientsConnected:!1,clientsPaused:!1,manualDisconnect:!1,lastRpcId:void 0,rpcMethodTracker:{},hasPlaintext:!1,communicationServerUrl:"",focusListenerAdded:!1,removeFocusListener:void 0,isReconnecting:!1,reconnectionAttempts:0},this.options=e;const{reconnect:t,communicationLayerPreference:n,communicationServerUrl:r,context:i,remote:o,logging:s}=e;this.state.resumed=t,this.state.context=i,this.state.isOriginator=o.state.isOriginator,this.state.communicationLayerPreference=n,this.state.debug=!0===(null==s?void 0:s.serviceLayer),this.remote=o,!0===(null==s?void 0:s.serviceLayer)&&f1.enable("SocketService:Layer"),this.state.communicationServerUrl=r,this.state.hasPlaintext=this.state.communicationServerUrl!==die&&!0===(null==s?void 0:s.plaintext),iie.SocketService(`[SocketService: constructor()] Socket IO url: ${this.state.communicationServerUrl}`),this.initSocket()}initSocket(){var e;const{otherPublicKey:t,ecies:n,logging:r}=this.options,i={autoConnect:!1,transports:hie,withCredentials:!0},o=this.state.communicationServerUrl;iie.SocketService(`[SocketService: initSocket()] Socket IO url: ${o}`),this.state.socket=c7(o,i),function(e){if("undefined"!=typeof window&&"undefined"!=typeof document&&(iie.SocketService(`[SocketService: setupSocketFocusListener()] hasFocus=${document.hasFocus()}`,e),!e.state.focusListenerAdded)){const t=()=>{iie.SocketService("Document has focus --- reconnecting socket"),Pie(e).catch(e=>{})};window.addEventListener("focus",t),e.state.focusListenerAdded=!0,e.state.removeFocusListener=()=>{window.removeEventListener("focus",t),e.state.focusListenerAdded=!1}}}(this);const s={communicationLayer:this,otherPublicKey:t,sendPublicKey:!1,context:null!==(e=this.state.context)&&void 0!==e?e:"",ecies:n,logging:r};this.state.keyExchange=new Sie(s)}resetKeys(){return iie.SocketService("[SocketService: resetKeys()] Resetting keys."),void(null===(e=this.state.keyExchange)||void 0===e||e.resetKeys());var e}createChannel(){return l7(this,void 0,void 0,function*(){return function(e){return l7(this,void 0,void 0,function*(){var t,n,r;if(iie.SocketService(`[SocketService: createChannel()] context=${e.state.context}`),e.state.socket||e.initSocket(),null===(t=e.state.socket)||void 0===t?void 0:t.connected)throw new Error("socket already connected");null===(n=e.state.socket)||void 0===n||n.connect(),e.state.manualDisconnect=!1,e.state.isOriginator=!0;const i=U4();e.state.channelId=i,Lie(e,i),yield new Promise((t,n)=>{var r;null===(r=e.state.socket)||void 0===r||r.emit(bie.JOIN_CHANNEL,{channelId:i,context:`${e.state.context}createChannel`,clientType:"dapp"},(r,i)=>l7(this,void 0,void 0,function*(){try{yield Cie(e,r,i),t()}catch(o){n(o)}}))});const o=null===(r=e.state.keyExchange)||void 0===r?void 0:r.getKeyInfo();return{channelId:i,pubKey:(null==o?void 0:o.ecies.public)||"",privKey:(null==o?void 0:o.ecies.private)||""}})}(this)})}connectToChannel({channelId:e,withKeyExchange:t=!1,authorized:n}){return function(e){return l7(this,arguments,void 0,function*({options:e,instance:t}){const{channelId:n,authorized:r,withKeyExchange:i}=e,{state:o,remote:s}=t,{isOriginator:a=!1,socket:c,keyExchange:l}=o,{channelConfig:u}=s.state;if(null==c?void 0:c.connected)throw new Error("socket already connected");if(a&&(null==u?void 0:u.relayPersistence)){const{localKey:e,otherKey:t}=u;e&&t&&(null==l||l.setRelayPersistence({localKey:e,otherKey:t}))}return Object.assign(o,{manualDisconnect:!1,withKeyExchange:i,isOriginator:a,channelId:n}),null==c||c.connect(),Lie(t,n),!a&&r&&(null==l||l.setKeysExchanged(!0),Object.assign(s.state,{ready:!0,authorized:!0})),new Promise(e=>{var i;const s=null===(i=null==l?void 0:l.getKeyInfo())||void 0===i?void 0:i.ecies.public;null==c||c.emit(bie.JOIN_CHANNEL,{channelId:n,context:`${o.context}_connectToChannel`,clientType:a?"dapp":"wallet",publicKey:r&&!a?s:void 0},(n,r)=>l7(this,void 0,void 0,function*(){yield Cie(t,n,r),e()}))})})}({options:{channelId:e,withKeyExchange:t,authorized:n},instance:this})}getKeyInfo(){return this.state.keyExchange.getKeyInfo()}keyCheck(){var e,t;null===(t=(e=this).state.socket)||void 0===t||t.emit(bie.MESSAGE,{id:e.state.channelId,context:e.state.context,message:{type:wie.KEY_HANDSHAKE_CHECK,pubkey:e.getKeyInfo().ecies.otherPubKey}})}getKeyExchange(){return this.state.keyExchange}sendMessage(e){return l7(this,void 0,void 0,function*(){return function(e,t){return l7(this,void 0,void 0,function*(){var n,r,i,o,s,a;if(!e.state.channelId)throw iie.SocketService("handleSendMessage: no channelId - Create a channel first"),new Error("Create a channel first");if(iie.SocketService(`[SocketService: handleSendMessage()] context=${e.state.context} areKeysExchanged=${null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged()}`,t),null===(r=null==t?void 0:t.type)||void 0===r?void 0:r.startsWith("key_handshake"))return o=e,s=t,iie.SocketService(`[SocketService: handleKeyHandshake()] context=${o.state.context}`,s),null===(a=o.state.socket)||void 0===a||a.emit(bie.MESSAGE,{id:o.state.channelId,context:o.state.context,clientType:o.state.isOriginator?"dapp":"wallet",message:s}),!0;!function(e,t){var n;if(!(null===(n=e.state.keyExchange)||void 0===n?void 0:n.areKeysExchanged())&&!e.remote.state.relayPersistence)throw iie.SocketService(`[SocketService: validateKeyExchange()] context=${e.state.context} ERROR keys not exchanged`,t),new Error("Keys not exchanged BBB")}(e,t),function(e,t){var n;const r=null!==(n=null==t?void 0:t.method)&&void 0!==n?n:"",i=null==t?void 0:t.id;e.state.isOriginator&&i&&(e.state.rpcMethodTracker[i]={id:i,timestamp:Date.now(),method:r},e.emit(bie.RPC_UPDATE,e.state.rpcMethodTracker[i]))}(e,t);const c=yield Mie(e,t);return e.remote.state.analytics&&e.remote.state.isOriginator&&t.method&&Tie.includes(t.method.toLowerCase())&&cie({id:null!==(i=e.remote.state.channelId)&&void 0!==i?i:"",event:_ie.SDK_RPC_REQUEST,params:{method:t.method,from:"mobile"}},e.remote.state.communicationServerUrl).catch(e=>{}),function(e,t){return l7(this,void 0,void 0,function*(){var n;const r=null==t?void 0:t.id,i=null!==(n=null==t?void 0:t.method)&&void 0!==n?n:"";if(e.state.isOriginator&&r)try{const n=Aie(r,e.state.rpcMethodTracker,200).then(e=>({type:Oie.RPC_CHECK,result:e})),o=(()=>l7(this,void 0,void 0,function*(){const t=yield(i={instance:e,rpcId:r},l7(void 0,[i],void 0,function*({rpcId:e,instance:t}){for(;t.state.lastRpcId===e||void 0===t.state.lastRpcId;)yield Iie(200);return t.state.lastRpcId})),n=yield Aie(t,e.state.rpcMethodTracker,200);var i;return{type:Oie.SKIPPED_RPC,result:n}}))(),s=yield Promise.race([n,o]);if(s.type===Oie.RPC_CHECK){const e=s.result;iie.SocketService(`[SocketService:handleRpcReplies()] id=${t.id} ${i} ( ${e.elapsedTime} ms)`,e.result)}else{if(s.type!==Oie.SKIPPED_RPC)throw new Error(`Error handling RPC replies for ${r}`);{const t=Object.assign(Object.assign({},e.state.rpcMethodTracker[r]),{error:new Error("SDK_CONNECTION_ISSUE")});e.emit(bie.RPC_UPDATE,t);const n={data:Object.assign(Object.assign({},t),{jsonrpc:"2.0"}),name:"metamask-provider"};e.emit(bie.MESSAGE,{message:n})}}}catch(o){throw o}})}(e,t).catch(e=>{}),c})}(this,e)})}ping(){return function(e){return l7(this,void 0,void 0,function*(){var t,n;iie.SocketService(`[SocketService: ping()] context=${e.state.context} originator=${e.state.isOriginator} keysExchanged=${null===(t=e.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged()}`),null===(n=e.state.socket)||void 0===n||n.emit(Eie.PING,{id:e.state.channelId,context:"ping",clientType:e.remote.state.isOriginator?"dapp":"wallet",message:""})})}(this)}pause(){return function(e){return l7(this,void 0,void 0,function*(){var t,n;iie.SocketService(`[SocketService: pause()] context=${e.state.context}`),e.state.manualDisconnect=!0,(null===(t=e.state.keyExchange)||void 0===t?void 0:t.areKeysExchanged())&&(yield e.sendMessage({type:Eie.PAUSE})),null===(n=e.state.socket)||void 0===n||n.disconnect()})}(this)}isConnected(){var e;return null===(e=this.state.socket)||void 0===e?void 0:e.connected}resume(){return function(e){return l7(this,void 0,void 0,function*(){const{state:t,remote:n}=e,{socket:r,channelId:i,context:o,keyExchange:s,isOriginator:a}=t,{isOriginator:c}=n.state;if(iie.SocketService(`[SocketService: resume()] channelId=${i} context=${o} connected=${null==r?void 0:r.connected} manualDisconnect=${t.manualDisconnect} resumed=${t.resumed} keysExchanged=${null==s?void 0:s.areKeysExchanged()}`),!i)throw iie.SocketService("[SocketService: resume()] channelId is not defined"),new Error("ChannelId is not defined");(null==r?void 0:r.connected)?(iie.SocketService("[SocketService: resume()] already connected."),r.emit(Eie.PING,{id:i,clientType:c?"dapp":"wallet",context:"on_channel_config",message:""}),n.hasRelayPersistence()||(null==s?void 0:s.areKeysExchanged())||(a?yield e.sendMessage({type:Eie.READY}):null==s||s.start({isOriginator:!1}))):(null==r||r.connect(),iie.SocketService(`[SocketService: resume()] after connecting socket --\x3e connected=${null==r?void 0:r.connected}`),null==r||r.emit(bie.JOIN_CHANNEL,{channelId:i,context:`${o}_resume`,clientType:c?"dapp":"wallet"},(t,n)=>l7(this,void 0,void 0,function*(){try{yield Cie(e,t,n)}catch(r){}}))),t.manualDisconnect=!1,t.resumed=!0})}(this)}getRPCMethodTracker(){return this.state.rpcMethodTracker}disconnect(e){return t=this,n=e,iie.SocketService(`[SocketService: disconnect()] context=${t.state.context}`,n),(null==n?void 0:n.terminate)&&(null===(i=(r=t.state).removeFocusListener)||void 0===i||i.call(r),t.state.channelId=n.channelId,null===(o=t.state.socket)||void 0===o||o.removeAllListeners(),null===(s=t.state.keyExchange)||void 0===s||s.clean(),t.remote.state.ready=!1,t.state.socket=void 0,t.state.rpcMethodTracker={}),t.state.manualDisconnect=!0,void(null===(a=t.state.socket)||void 0===a||a.disconnect());var t,n,r,i,o,s,a}}var jie,Die,Uie;function Fie(e){return()=>l7(this,void 0,void 0,function*(){var t,n,r;const{state:i}=e;if(i.authorized)return;yield(()=>l7(this,void 0,void 0,function*(){for(;!i.walletInfo;)yield Iie(500)}))();const o="7.3".localeCompare((null===(t=i.walletInfo)||void 0===t?void 0:t.version)||"");if(iie.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' version=${null===(n=i.walletInfo)||void 0===n?void 0:n.version} compareValue=${o}`),1!==o)return;const s=i.platformType===Die.MobileWeb||i.platformType===Die.ReactNative||i.platformType===Die.MetaMaskMobileWebview;iie.RemoteCommunication(`[RemoteCommunication: handleAuthorizedEvent()] HACK 'authorized' platform=${i.platformType} secure=${s} channel=${i.channelId} walletVersion=${null===(r=i.walletInfo)||void 0===r?void 0:r.version}`),s&&(i.authorized=!0,e.emit(bie.AUTHORIZED))})}function $ie(e){return t=>{const{state:n}=e;iie.RemoteCommunication(`[RemoteCommunication: handleChannelCreatedEvent()] context=${n.context} on 'channel_created' channelId=${t}`),e.emit(bie.CHANNEL_CREATED,t)}}function zie(e,t){return()=>{var n,r,i,o;const{state:s}=e;iie.RemoteCommunication(`[RemoteCommunication: handleClientsConnectedEvent()] on 'clients_connected' channel=${s.channelId} keysExchanged=${null===(r=null===(n=s.communicationLayer)||void 0===n?void 0:n.getKeyInfo())||void 0===r?void 0:r.keysExchanged}`),s.analytics&&cie(Object.assign(Object.assign({id:null!==(i=s.channelId)&&void 0!==i?i:"",event:s.reconnection?_ie.RECONNECT:s.isOriginator?_ie.REQUEST:_ie.REQUEST_MOBILE},s.originatorInfo),{commLayer:t,sdkVersion:s.sdkVersion,walletVersion:null===(o=s.walletInfo)||void 0===o?void 0:o.version,commLayerVersion:uie}),s.communicationServerUrl).catch(e=>{}),s.clientsConnected=!0,s.originatorInfoSent=!1,e.emit(bie.CLIENTS_CONNECTED)}}function Hie(e){return t=>{const{state:n}=e;iie.RemoteCommunication(`[RemoteCommunication: handleClientsDisconnectedEvent()] context=${n.context} on 'clients_disconnected' channelId=${t}`),n.relayPersistence||(n.clientsConnected=!1,n.ready=!1,n.authorized=!1),e.emit(bie.CLIENTS_DISCONNECTED,n.channelId),e.setConnectionStatus(yie.DISCONNECTED)}}function qie(e){return t=>{var n;const{state:r}=e;if(iie.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] context=${r.context} on 'clients_waiting' numberUsers=${t} ready=${r.ready} autoStarted=${r.originatorConnectStarted}`),e.setConnectionStatus(yie.WAITING),e.emit(bie.CLIENTS_WAITING,t),r.originatorConnectStarted){iie.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] on 'clients_waiting' watch autoStarted=${r.originatorConnectStarted} timeout`,r.autoConnectOptions);const t=(null===(n=r.autoConnectOptions)||void 0===n?void 0:n.timeout)||3e3,i=setTimeout(()=>{iie.RemoteCommunication(`[RemoteCommunication: handleClientsWaitingEvent()] setTimeout(${t}) terminate channelConfig`,r.autoConnectOptions),r.originatorConnectStarted=!1,r.ready||e.setConnectionStatus(yie.TIMEOUT),clearTimeout(i)},t)}}}function Wie(e,t){return n=>{var r,i,o,s,a,c,l,u;const{state:d}=e;if(iie.RemoteCommunication(`[RemoteCommunication: handleKeysExchangedEvent()] context=${d.context} on commLayer.'keys_exchanged' channel=${d.channelId}`,n),null===(i=null===(r=d.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.keysExchanged){const t=Object.assign(Object.assign({},d.channelConfig),{channelId:null!==(o=d.channelId)&&void 0!==o?o:"",validUntil:(null===(s=d.channelConfig)||void 0===s?void 0:s.validUntil)||fie,localKey:d.communicationLayer.getKeyInfo().ecies.private,otherKey:d.communicationLayer.getKeyInfo().ecies.otherPubKey});null===(a=d.storageManager)||void 0===a||a.persistChannelConfig(t).catch(e=>{}),e.setConnectionStatus(yie.LINKED)}!function(e,t){var n,r,i,o,s,a,c,l;const{state:u}=e;iie.RemoteCommunication(`[RemoteCommunication: setLastActiveDate()] channel=${u.channelId}`,t);const d=Object.assign(Object.assign({},u.channelConfig),{channelId:null!==(n=u.channelId)&&void 0!==n?n:"",validUntil:null!==(i=null===(r=u.channelConfig)||void 0===r?void 0:r.validUntil)&&void 0!==i?i:0,relayPersistence:u.relayPersistence,localKey:null===(s=null===(o=u.communicationLayer)||void 0===o?void 0:o.state.keyExchange)||void 0===s?void 0:s.getKeyInfo().ecies.private,otherKey:null===(c=null===(a=u.communicationLayer)||void 0===a?void 0:a.state.keyExchange)||void 0===c?void 0:c.getKeyInfo().ecies.otherPubKey,lastActive:t.getTime()});null===(l=u.storageManager)||void 0===l||l.persistChannelConfig(d)}(e,new Date),d.analytics&&d.channelId&&cie(Object.assign(Object.assign({id:d.channelId,event:n.isOriginator?_ie.CONNECTED:_ie.CONNECTED_MOBILE},d.originatorInfo),{sdkVersion:d.sdkVersion,commLayer:t,commLayerVersion:uie,walletVersion:null===(c=d.walletInfo)||void 0===c?void 0:c.version}),d.communicationServerUrl).catch(e=>{}),d.isOriginator=n.isOriginator,n.isOriginator||(null===(l=d.communicationLayer)||void 0===l||l.sendMessage({type:Eie.READY}),d.ready=!0,d.paused=!1),n.isOriginator&&!d.originatorInfoSent&&(null===(u=d.communicationLayer)||void 0===u||u.sendMessage({type:Eie.ORIGINATOR_INFO,originatorInfo:d.originatorInfo,originator:d.originatorInfo}),d.originatorInfoSent=!0)}}function Kie(e){return t=>{let n=t;t.message&&(n=n.message),function(e,t){const{state:n}=t;if(iie.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] context=${n.context} on 'message' typeof=${typeof e}`,e),t.state.ready=!0,n.isOriginator||e.type!==Eie.ORIGINATOR_INFO)if(n.isOriginator&&e.type===Eie.WALLET_INFO)!function(e,t){const{state:n}=e;n.walletInfo=t.walletInfo,n.paused=!1}(t,e);else{if(n.isOriginator&&e.type===Eie.WALLET_INIT)(function(e,t){return l7(this,void 0,void 0,function*(){var n,r,i;const{state:o}=e;if(o.isOriginator){const o=t.data||{};if("object"==typeof o&&"accounts"in o&&"chainId"in o&&"walletKey"in o)try{const{channelConfig:t}=e.state;if(iie.RemoteCommunication("WALLET_INIT: channelConfig",JSON.stringify(t,null,2)),t){const s=o.accounts,a=o.chainId,c=o.walletKey;let l,u=!1;"deeplinkProtocol"in o&&(u=Boolean(o.deeplinkProtocol),e.state.deeplinkProtocolAvailable=u),"walletVersion"in o&&(l=o.walletVersion),yield null===(n=e.state.storageManager)||void 0===n?void 0:n.persistChannelConfig(Object.assign(Object.assign({},t),{otherKey:c,walletVersion:l,deeplinkProtocolAvailable:u,relayPersistence:!0})),yield null===(r=e.state.storageManager)||void 0===r?void 0:r.persistAccounts(s),yield null===(i=e.state.storageManager)||void 0===i?void 0:i.persistChainId(a)}e.emit(bie.WALLET_INIT,{accounts:o.accounts,chainId:o.chainId})}catch(s){}}})})(t,e).catch(e=>{iie.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${e}`)});else if(e.type===Eie.TERMINATE)(function(e){return l7(this,void 0,void 0,function*(){const{state:t}=e;t.isOriginator&&(yield Jie({options:{terminate:!0,sendMessage:!1},instance:e}),e.emit(bie.TERMINATE))})})(t).catch(e=>{iie.RemoteCommunication(`[RemoteCommunication: onCommunicationLayerMessage()] error=${e}`)});else if(e.type===Eie.PAUSE)!function(e){const{state:t}=e;t.paused=!0,e.setConnectionStatus(yie.PAUSED)}(t);else if(e.type===Eie.READY&&n.isOriginator)!function(e){const{state:t}=e;e.setConnectionStatus(yie.LINKED);const n=t.paused;t.paused=!1,e.emit(bie.CLIENTS_READY,{isOriginator:t.isOriginator,walletInfo:t.walletInfo}),n&&(t.authorized=!0,e.emit(bie.AUTHORIZED))}(t);else{if(e.type===Eie.OTP&&n.isOriginator)return void function(e,t){var n;const{state:r}=e;e.emit(bie.OTP,t.otpAnswer),1==="6.6".localeCompare((null===(n=r.walletInfo)||void 0===n?void 0:n.version)||"")&&e.emit(bie.SDK_RPC_CALL,{method:mie,params:[]})}(t,e);e.type===Eie.AUTHORIZED&&n.isOriginator&&function(e){const{state:t}=e;t.authorized=!0,e.emit(bie.AUTHORIZED)}(t)}t.emit(bie.MESSAGE,e)}else!function(e,t){var n;const{state:r}=e;null===(n=r.communicationLayer)||void 0===n||n.sendMessage({type:Eie.WALLET_INFO,walletInfo:r.walletInfo}),r.originatorInfo=t.originatorInfo||t.originator,e.emit(bie.CLIENTS_READY,{isOriginator:r.isOriginator,originatorInfo:r.originatorInfo}),r.paused=!1}(t,e)}(n,e)}}function Gie(e){return()=>{const{state:t}=e;iie.RemoteCommunication("[RemoteCommunication: handleSocketReconnectEvent()] on 'socket_reconnect' -- reset key exchange status / set ready to false"),t.ready=!1,t.authorized=!1,gie(t),e.emitServiceStatusEvent({context:"socket_reconnect"})}}function Vie(e){return()=>{const{state:t}=e;iie.RemoteCommunication("[RemoteCommunication: handleSocketDisconnectedEvent()] on 'socket_Disconnected' set ready to false"),t.ready=!1}}function Zie(e){return()=>l7(this,void 0,void 0,function*(){var t,n,r,i,o,s,a;const{state:c}=e;iie.RemoteCommunication(`[RemoteCommunication: handleFullPersistenceEvent()] context=${c.context}`),e.state.ready=!0,e.state.clientsConnected=!0,e.state.authorized=!0,e.state.relayPersistence=!0,null===(t=e.state.communicationLayer)||void 0===t||t.getKeyExchange().setKeysExchanged(!0),e.emit(bie.KEYS_EXCHANGED,{keysExchanged:!0,isOriginator:!0}),e.emit(bie.AUTHORIZED),e.emit(bie.CLIENTS_READY),e.emit(bie.CHANNEL_PERSISTENCE);try{c.channelConfig=Object.assign(Object.assign({},c.channelConfig),{localKey:null===(n=c.communicationLayer)||void 0===n?void 0:n.getKeyExchange().getKeyInfo().ecies.private,otherKey:null===(r=c.communicationLayer)||void 0===r?void 0:r.getKeyExchange().getOtherPublicKey(),channelId:null!==(i=c.channelId)&&void 0!==i?i:"",validUntil:null!==(s=null===(o=c.channelConfig)||void 0===o?void 0:o.validUntil)&&void 0!==s?s:fie,relayPersistence:!0}),yield null===(a=c.storageManager)||void 0===a?void 0:a.persistChannelConfig(c.channelConfig)}catch(l){}})}function Yie({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,ecies:r,communicationServerUrl:i=die,instance:o}){var s,a,c,l,u,d,h,f,p,m,g;const{state:y}=o;if(iie.RemoteCommunication("[initCommunicationLayer()] ",JSON.stringify(y,null,2)),e!==jie.SOCKET)throw new Error("Invalid communication protocol");y.communicationLayer=new Bie({communicationLayerPreference:e,otherPublicKey:t,reconnect:n,transports:y.transports,communicationServerUrl:i,context:y.context,ecies:r,logging:y.logging,remote:o});let b="undefined"!=typeof document&&document.URL||"",v="undefined"!=typeof document&&document.title||"";(null===(s=y.dappMetadata)||void 0===s?void 0:s.url)&&(b=y.dappMetadata.url),(null===(a=y.dappMetadata)||void 0===a?void 0:a.name)&&(v=y.dappMetadata.name);const w=null!==(d=null!==(l=null===(c=y.dappMetadata)||void 0===c?void 0:c.name)&&void 0!==l?l:null===(u=y.dappMetadata)||void 0===u?void 0:u.url)&&void 0!==d?d:"N/A",E="undefined"!=typeof window&&void 0!==window.location&&null!==(h=window.location.hostname)&&void 0!==h?h:w,_={url:b,title:v,source:null===(f=y.dappMetadata)||void 0===f?void 0:f.source,dappId:E,icon:(null===(p=y.dappMetadata)||void 0===p?void 0:p.iconUrl)||(null===(m=y.dappMetadata)||void 0===m?void 0:m.base64Icon),platform:y.platformType,apiVersion:uie,connector:null===(g=y.dappMetadata)||void 0===g?void 0:g.connector};y.originatorInfo=_;const x={[bie.AUTHORIZED]:Fie(o),[bie.MESSAGE]:Kie(o),[bie.CHANNEL_PERSISTENCE]:Zie(o),[bie.CLIENTS_CONNECTED]:zie(o,e),[bie.KEYS_EXCHANGED]:Wie(o,e),[bie.SOCKET_DISCONNECTED]:Vie(o),[bie.SOCKET_RECONNECT]:Gie(o),[bie.CLIENTS_DISCONNECTED]:Hie(o),[bie.KEY_INFO]:()=>{},[bie.CHANNEL_CREATED]:$ie(o),[bie.CLIENTS_WAITING]:qie(o),[bie.RPC_UPDATE]:e=>{o.emit(bie.RPC_UPDATE,e)}};for(const[S,C]of Object.entries(x))try{y.communicationLayer.on(S,C)}catch(k){}}function Jie(e){return l7(this,arguments,void 0,function*({options:e,instance:t}){const{state:n}=t;return iie.RemoteCommunication(`[RemoteCommunication: disconnect()] channel=${n.channelId}`,e),new Promise((r,i)=>{var o,s,a,c,l,u;(null==e?void 0:e.terminate)?(t.state.ready&&cie({id:null!==(o=t.state.channelId)&&void 0!==o?o:"",event:_ie.TERMINATED},t.state.communicationServerUrl).catch(e=>{}),n.ready=!1,n.paused=!1,null===(s=n.storageManager)||void 0===s||s.terminate(null!==(a=n.channelId)&&void 0!==a?a:""),t.state.terminated=!0,e.sendMessage?(null===(c=n.communicationLayer)||void 0===c?void 0:c.getKeyInfo().keysExchanged)&&t.state.communicationLayer&&Mie(t.state.communicationLayer,{type:Eie.TERMINATE}).then(()=>{r(!0)}).catch(e=>{i(e)}):r(!0),n.authorized=!1,n.relayPersistence=!1,n.channelId=U4(),e.channelId=n.channelId,n.channelConfig=void 0,n.originatorConnectStarted=!1,null===(l=n.communicationLayer)||void 0===l||l.disconnect(e),t.setConnectionStatus(yie.TERMINATED)):(null===(u=n.communicationLayer)||void 0===u||u.disconnect(e),t.setConnectionStatus(yie.DISCONNECTED),r(!0))})})}(jie||(jie={})).SOCKET="socket",function(e){e.NonBrowser="nodejs",e.MetaMaskMobileWebview="in-app-browser",e.DesktopWeb="web-desktop",e.MobileWeb="web-mobile",e.ReactNative="react-native"}(Die||(Die={}));class Qie extends M4.EventEmitter2{constructor(e){super(),this.state={ready:!1,authorized:!1,isOriginator:!1,terminated:!1,protocolVersion:1,paused:!1,deeplinkProtocolAvailable:!1,platformType:"metamask-mobile",analytics:!1,reconnection:!1,originatorInfoSent:!1,communicationServerUrl:die,context:"",persist:!1,clientsConnected:!1,sessionDuration:fie,originatorConnectStarted:!1,debug:!1,_connectionStatus:yie.DISCONNECTED},this._options=e;const{platformType:t,communicationLayerPreference:n,otherPublicKey:r,reconnect:i,walletInfo:o,dappMetadata:s,protocolVersion:a,transports:c,context:l,relayPersistence:u,ecies:d,analytics:h=!1,storage:f,sdkVersion:p,communicationServerUrl:m=die,logging:g,autoConnect:y={timeout:pie}}=e;this.state.otherPublicKey=r,this.state.dappMetadata=s,this.state.walletInfo=o,this.state.transports=c,this.state.platformType=t,this.state.analytics=h,this.state.protocolVersion=null!=a?a:1,this.state.isOriginator=!r,this.state.relayPersistence=u,this.state.communicationServerUrl=m,this.state.context=l,this.state.terminated=!1,this.state.sdkVersion=p,this.setMaxListeners(50),this.setConnectionStatus(yie.DISCONNECTED),(null==f?void 0:f.duration)&&(this.state.sessionDuration=fie),this.state.storageOptions=f,this.state.autoConnectOptions=y,this.state.debug=!0===(null==g?void 0:g.remoteLayer),!0===(null==g?void 0:g.remoteLayer)&&f1.enable("RemoteCommunication:Layer"),!0===(null==g?void 0:g.serviceLayer)&&f1.enable("SocketService:Layer"),!0===(null==g?void 0:g.eciesLayer)&&f1.enable("ECIES:Layer"),!0===(null==g?void 0:g.keyExchangeLayer)&&f1.enable("KeyExchange:Layer"),this.state.logging=g,(null==f?void 0:f.storageManager)&&(this.state.storageManager=f.storageManager),iie.RemoteCommunication(`[RemoteCommunication: constructor()] protocolVersion=${a} relayPersistence=${u} isOriginator=${this.state.isOriginator} communicationLayerPreference=${n} otherPublicKey=${r} reconnect=${i}`),this.state.isOriginator||Yie({communicationLayerPreference:n,otherPublicKey:r,reconnect:i,ecies:d,communicationServerUrl:m,instance:this}),this.emitServiceStatusEvent({context:"constructor"})}initFromDappStorage(){return l7(this,void 0,void 0,function*(){var e;if(this.state.storageManager){const t=yield this.state.storageManager.getPersistedChannelConfig({});t&&(this.state.channelConfig=t,this.state.channelId=t.channelId,this.state.deeplinkProtocolAvailable=null!==(e=t.deeplinkProtocolAvailable)&&void 0!==e&&e,t.relayPersistence&&(this.state.authorized=!0,this.state.ready=!0,this.setConnectionStatus(yie.LINKED),yield this.connectToChannel({channelId:t.channelId})))}Yie({communicationLayerPreference:jie.SOCKET,otherPublicKey:this.state.otherPublicKey,reconnect:this._options.reconnect,ecies:this._options.ecies,communicationServerUrl:this.state.communicationServerUrl,instance:this})})}originatorSessionConnect(){return l7(this,void 0,void 0,function*(){return yield function(e){return l7(this,void 0,void 0,function*(){var t;const{state:n}=e;if(!n.storageManager)return void iie.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] no storage manager defined - skip");const r=yield n.storageManager.getPersistedChannelConfig({});if(iie.RemoteCommunication(`[RemoteCommunication: originatorSessionConnect()] autoStarted=${n.originatorConnectStarted} channelConfig`,r),null===(t=n.communicationLayer)||void 0===t?void 0:t.isConnected())return iie.RemoteCommunication("[RemoteCommunication: originatorSessionConnect()] socket already connected - skip"),r;if(r){if(r.validUntil>Date.now())return n.channelConfig=r,n.originatorConnectStarted=!0,n.channelId=null==r?void 0:r.channelId,n.reconnection=!0,r;iie.RemoteCommunication("[RemoteCommunication: autoConnect()] Session has expired")}n.originatorConnectStarted=!1})}(this)})}generateChannelIdConnect(){return l7(this,void 0,void 0,function*(){return function(e){return l7(this,void 0,void 0,function*(){var t,n,r,i,o,s;if(!e.communicationLayer)throw new Error("communication layer not initialized");if(e.ready)throw new Error("Channel already connected");if(e.channelId&&(null===(t=e.communicationLayer)||void 0===t?void 0:t.isConnected()))return e.channelConfig=Object.assign(Object.assign({},e.channelConfig),{channelId:e.channelId,validUntil:Date.now()+e.sessionDuration}),null===(n=e.storageManager)||void 0===n||n.persistChannelConfig(e.channelConfig),{channelId:e.channelId,privKey:null===(i=null===(r=e.communicationLayer)||void 0===r?void 0:r.getKeyInfo())||void 0===i?void 0:i.ecies.private,pubKey:null===(s=null===(o=e.communicationLayer)||void 0===o?void 0:o.getKeyInfo())||void 0===s?void 0:s.ecies.public};iie.RemoteCommunication("[RemoteCommunication: generateChannelId()]");const a=yield e.communicationLayer.createChannel();iie.RemoteCommunication("[RemoteCommunication: generateChannelId()] channel created",a);const c=Object.assign(Object.assign({},e.channelConfig),{channelId:a.channelId,localKey:a.privKey,validUntil:Date.now()+e.sessionDuration});return e.channelId=a.channelId,e.channelConfig=c,{channelId:e.channelId,pubKey:a.pubKey,privKey:a.privKey}})}(this.state)})}clean(){return gie(this.state)}connectToChannel({channelId:e,withKeyExchange:t,authorized:n}){return function(e){return l7(this,arguments,void 0,function*({channelId:e,withKeyExchange:t,authorized:n,state:r}){var i,o,s;if(!B4(e))throw iie.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} invalid channel channelId=${e}`),new Error(`Invalid channel ${e}`);if(iie.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} channelId=${e} withKeyExchange=${t}`),null===(i=r.communicationLayer)||void 0===i?void 0:i.isConnected())return void iie.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${r.context} already connected - interrupt connection.`);r.channelId=e,yield null===(o=r.communicationLayer)||void 0===o?void 0:o.connectToChannel({channelId:e,authorized:n,withKeyExchange:t});const a=Object.assign(Object.assign({},r.channelConfig),{channelId:e,validUntil:Date.now()+r.sessionDuration});r.channelConfig=a,null===(s=r.storageManager)||void 0===s||s.persistChannelConfig(a)})}({channelId:e,authorized:n,withKeyExchange:t,state:this.state})}sendMessage(e){return function(e,t){return l7(this,void 0,void 0,function*(){var n,r;const{state:i}=e;iie.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context} paused=${i.paused} ready=${i.ready} relayPersistence=${i.relayPersistence} authorized=${i.authorized} socket=${null===(n=i.communicationLayer)||void 0===n?void 0:n.isConnected()} clientsConnected=${i.clientsConnected} status=${i._connectionStatus}`,t),i.relayPersistence||i.ready&&(null===(r=i.communicationLayer)||void 0===r?void 0:r.isConnected())&&i.clientsConnected||(iie.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context} SKIP message waiting for MM mobile readiness.`),yield new Promise(t=>{e.once(bie.CLIENTS_READY,t)}),iie.RemoteCommunication(`[RemoteCommunication: sendMessage()] context=${i.context} AFTER SKIP / READY -- sending pending message`));try{return yield function(e,t){return l7(this,void 0,void 0,function*(){return new Promise(n=>{var r;const{state:i}=e;iie.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${i.context} ready=${i.ready} authorized=${i.authorized} method=${t.method}`),!i.isOriginator||i.authorized||i.relayPersistence?null===(r=i.communicationLayer)||void 0===r||r.sendMessage(t).then(e=>{n(e)}).catch(e=>{n(!1)}):e.once(bie.AUTHORIZED,()=>{var e;iie.RemoteCommunication(`[RemoteCommunication: handleAuthorization()] context=${i.context} AFTER SKIP / AUTHORIZED -- sending pending message`),null===(e=i.communicationLayer)||void 0===e||e.sendMessage(t).then(e=>{n(e)}).catch(e=>{n(!1)})})})})}(e,t)}catch(o){throw o}})}(this,e)}testStorage(){return l7(this,void 0,void 0,function*(){return function(e){return l7(this,void 0,void 0,function*(){var t;const n=yield null===(t=e.storageManager)||void 0===t?void 0:t.getPersistedChannelConfig();iie.RemoteCommunication("[RemoteCommunication: testStorage()] res",n)})}(this.state)})}hasDeeplinkProtocol(){return this.state.deeplinkProtocolAvailable}getChannelConfig(){return this.state.channelConfig}isReady(){return this.state.ready}isConnected(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.isConnected()}isAuthorized(){return this.state.authorized}isPaused(){return this.state.paused}getCommunicationLayer(){return this.state.communicationLayer}ping(){return l7(this,void 0,void 0,function*(){var e;iie.RemoteCommunication(`[RemoteCommunication: ping()] channel=${this.state.channelId}`),yield null===(e=this.state.communicationLayer)||void 0===e?void 0:e.ping()})}testLogger(){iie.RemoteCommunication(`testLogger() channel=${this.state.channelId}`),iie.SocketService(`testLogger() channel=${this.state.channelId}`),iie.Ecies(`testLogger() channel=${this.state.channelId}`),iie.KeyExchange(`testLogger() channel=${this.state.channelId}`)}keyCheck(){var e;iie.RemoteCommunication(`[RemoteCommunication: keyCheck()] channel=${this.state.channelId}`),null===(e=this.state.communicationLayer)||void 0===e||e.keyCheck()}setConnectionStatus(e){this.state._connectionStatus!==e&&(this.state._connectionStatus=e,this.emit(bie.CONNECTION_STATUS,e),this.emitServiceStatusEvent({context:"setConnectionStatus"}))}emitServiceStatusEvent(e={}){this.emit(bie.SERVICE_STATUS,this.getServiceStatus())}getConnectionStatus(){return this.state._connectionStatus}getServiceStatus(){return{originatorInfo:this.state.originatorInfo,keyInfo:this.getKeyInfo(),connectionStatus:this.state._connectionStatus,channelConfig:this.state.channelConfig,channelId:this.state.channelId}}getKeyInfo(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getKeyInfo()}resetKeys(){var e;null===(e=this.state.communicationLayer)||void 0===e||e.resetKeys()}setOtherPublicKey(e){var t;const n=null===(t=this.state.communicationLayer)||void 0===t?void 0:t.getKeyExchange();if(!n)throw new Error("KeyExchange is not initialized.");n.getOtherPublicKey()!==e&&n.setOtherPublicKey(e)}pause(){return l7(this,void 0,void 0,function*(){var e;iie.RemoteCommunication(`[RemoteCommunication: pause()] channel=${this.state.channelId}`),yield null===(e=this.state.communicationLayer)||void 0===e?void 0:e.pause(),this.setConnectionStatus(yie.PAUSED)})}getVersion(){return uie}hasRelayPersistence(){var e;return null!==(e=this.state.relayPersistence)&&void 0!==e&&e}resume(){return l7(this,void 0,void 0,function*(){return function(e){return l7(this,void 0,void 0,function*(){var t;const{state:n}=e;iie.RemoteCommunication(`[RemoteCommunication: resume()] channel=${n.channelId}`),yield null===(t=n.communicationLayer)||void 0===t?void 0:t.resume(),e.setConnectionStatus(yie.LINKED)})}(this)})}encrypt(e){var t,n,r;const i=null===(t=this.state.communicationLayer)||void 0===t?void 0:t.getKeyExchange(),o=null==i?void 0:i.getOtherPublicKey();if(!o)throw new Error("KeyExchange not completed");return null===(r=null===(n=this.state.communicationLayer)||void 0===n?void 0:n.state.eciesInstance)||void 0===r?void 0:r.encrypt(e,o)}decrypt(e){var t,n,r;if(!(null===(t=this.state.communicationLayer)||void 0===t?void 0:t.state.eciesInstance))throw new Error("ECIES instance is not initialized");return null===(r=null===(n=this.state.communicationLayer)||void 0===n?void 0:n.state.eciesInstance)||void 0===r?void 0:r.decrypt(e)}getChannelId(){return this.state.channelId}getRPCMethodTracker(){var e;return null===(e=this.state.communicationLayer)||void 0===e?void 0:e.getRPCMethodTracker()}reject({channelId:e}){return function(e){return l7(this,arguments,void 0,function*({channelId:e,state:t}){var n,r,i;if(!B4(e))throw iie.RemoteCommunication(`[RemoteCommunication: connectToChannel()] context=${t.context} invalid channel channelId=${e}`),new Error(`Invalid channel ${e}`);if(t.isOriginator)return void iie.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} isOriginator=${t.isOriginator} channelId=${e}`);const{socket:o}=null!==(r=null===(n=t.communicationLayer)||void 0===n?void 0:n.state)&&void 0!==r?r:{};(null==o?void 0:o.connected)||(iie.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} socket already connected`),null==o||o.connect()),cie(Object.assign(Object.assign({id:e,event:_ie.REJECTED},t.originatorInfo),{sdkVersion:t.sdkVersion,commLayerVersion:uie,walletVersion:null===(i=t.walletInfo)||void 0===i?void 0:i.version}),t.communicationServerUrl).catch(e=>{}),yield new Promise((n,r)=>{null==o||o.emit(bie.REJECTED,{channelId:e},(e,i)=>{iie.RemoteCommunication(`[RemoteCommunication: reject()] context=${t.context} socket=${null==o?void 0:o.id}`,{error:e,response:i}),e?r(e):n(i)})})})}({channelId:e,state:this.state})}disconnect(e){return l7(this,void 0,void 0,function*(){return Jie({options:e,instance:this})})}}!function(e){e.RENEW="renew",e.LINK="link"}(Uie||(Uie={}));var Xie="ERC721",eoe="ERC1155",toe={errors:{disconnected:()=>"MetaMask: Disconnected from chain. Attempting to connect.",permanentlyDisconnected:()=>"MetaMask: Disconnected from MetaMask background. Page reload required.",sendSiteMetadata:()=>"MetaMask: Failed to send site metadata. This is an internal error, please report this bug.",unsupportedSync:e=>`MetaMask: The MetaMask Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidNetworkParams:()=>"MetaMask: Received invalid network parameters. Please report this bug.",invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`MetaMask: Connected to chain with ID "${e}".`},warnings:{chainIdDeprecation:"MetaMask: 'ethereum.chainId' is deprecated and may be removed in the future. Please use the 'eth_chainId' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",networkVersionDeprecation:"MetaMask: 'ethereum.networkVersion' is deprecated and may be removed in the future. Please use the 'net_version' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",selectedAddressDeprecation:"MetaMask: 'ethereum.selectedAddress' is deprecated and may be removed in the future. Please use the 'eth_accounts' RPC method instead.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/discussions/23",enableDeprecation:"MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1102",sendDeprecation:"MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193",events:{close:"MetaMask: The event 'close' is deprecated and may be removed in the future. Please use 'disconnect' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#disconnect",data:"MetaMask: The event 'data' is deprecated and will be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message",networkChanged:"MetaMask: The event 'networkChanged' is deprecated and may be removed in the future. Use 'chainChanged' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#chainchanged",notification:"MetaMask: The event 'notification' is deprecated and may be removed in the future. Use 'message' instead.\nFor more information, see: https://eips.ethereum.org/EIPS/eip-1193#message"},rpc:{ethDecryptDeprecation:"MetaMask: The RPC method 'eth_decrypt' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",ethGetEncryptionPublicKeyDeprecation:"MetaMask: The RPC method 'eth_getEncryptionPublicKey' is deprecated and may be removed in the future.\nFor more information, see: https://medium.com/metamask/metamask-api-method-deprecation-2b0564a84686",walletWatchAssetNFTExperimental:"MetaMask: The RPC method 'wallet_watchAsset' is experimental for ERC721/ERC1155 assets and may change in the future.\nFor more information, see: https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md and https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle"},experimentalMethods:"MetaMask: 'ethereum._metamask' exposes non-standard, experimental methods. They may be removed or changed without warning."}};function noe(e){const t={ethDecryptDeprecation:!1,ethGetEncryptionPublicKeyDeprecation:!1,walletWatchAssetNFTExperimental:!1};return(n,r,i)=>{var o;t.ethDecryptDeprecation||"eth_decrypt"!==n.method?t.ethGetEncryptionPublicKeyDeprecation||"eth_getEncryptionPublicKey"!==n.method?!t.walletWatchAssetNFTExperimental&&"wallet_watchAsset"===n.method&&[Xie,eoe].includes((null==(o=n.params)?void 0:o.type)||"")&&(e.warn(toe.warnings.rpc.walletWatchAssetNFTExperimental),t.walletWatchAssetNFTExperimental=!0):(e.warn(toe.warnings.rpc.ethGetEncryptionPublicKeyDeprecation),t.ethGetEncryptionPublicKeyDeprecation=!0):(e.warn(toe.warnings.rpc.ethDecryptDeprecation),t.ethDecryptDeprecation=!0),i()}}var roe=4294967295,ioe=Math.floor(Math.random()*roe);var ooe=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},soe=(e,t,n)=>(ooe(e,t,"read from private field"),n?n.call(e):t.get(e)),aoe=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},coe=(e,t,n,r)=>(ooe(e,t,"write to private field"),t.set(e,n),n),loe=(e,t,n)=>(ooe(e,t,"access private method"),n),uoe=-32600,doe=-32603,hoe={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};function foe(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)}var poe=(e,t)=>Object.hasOwnProperty.call(e,t);class moe extends TypeError{constructor(e,t){let n;const{message:r,explanation:i,...o}=e,{path:s}=e,a=0===s.length?r:`At path: ${s.join(".")} -- ${r}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...t()])}}function goe(e){return"object"==typeof e&&null!=e}function yoe(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function boe(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:s}=n,{refinement:a,message:c=`Expected a value of type \`${s}\`${a?` with refinement \`${a}\``:""}, but received: \`${yoe(r)}\``}=e;return{value:r,type:s,refinement:a,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*voe(e,t,n,r){var i;goe(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const o of e){const e=boe(o,t,n,r);e&&(yield e)}}function*woe(e,t,n={}){const{path:r=[],branch:i=[e],coerce:o=!1,mask:s=!1}=n,a={path:r,branch:i};if(o&&(e=t.coercer(e,a),s&&"type"!==t.type&&goe(t.schema)&&goe(e)&&!Array.isArray(e)))for(const l in e)void 0===t.schema[l]&&delete e[l];let c="valid";for(const l of t.validator(e,a))l.explanation=n.message,c="not_valid",yield[l,void 0];for(let[l,u,d]of t.entries(e,a)){const t=woe(u,d,{path:void 0===l?r:[...r,l],branch:void 0===l?i:[...i,u],coerce:o,mask:s,message:n.message});for(const n of t)n[0]?(c=null!=n[0].refinement?"not_refined":"not_valid",yield[n[0],void 0]):o&&(u=n[1],void 0===l?e=u:e instanceof Map?e.set(l,u):e instanceof Set?e.add(u):goe(e)&&(void 0!==u||l in e)&&(e[l]=u))}if("not_valid"!==c)for(const l of t.refiner(e,a))l.explanation=n.message,c="not_refined",yield[l,void 0];"valid"===c&&(yield[void 0,e])}class Eoe{constructor(e){const{type:t,schema:n,validator:r,refiner:i,coercer:o=e=>e,entries:s=function*(){}}=e;this.type=t,this.schema=n,this.entries=s,this.coercer=o,this.validator=r?(e,t)=>voe(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>voe(i(e,t),t,this,e):()=>[]}assert(e,t){return _oe(e,this,t)}create(e,t){return xoe(e,this,t)}is(e){return koe(e,this)}mask(e,t){return function(e,t,n){const r=Soe(e,t,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(e,this,t)}validate(e,t={}){return Soe(e,this,t)}}function _oe(e,t,n){const r=Soe(e,t,{message:n});if(r[0])throw r[0]}function xoe(e,t,n){const r=Soe(e,t,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}function koe(e,t){return!Soe(e,t)[0]}function Soe(e,t,n={}){const r=woe(e,t,n),i=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(r);if(i[0]){return[new moe(i[0],function*(){for(const e of r)e[0]&&(yield e[0])}),void 0]}return[void 0,i[1]]}function Coe(e,t){return new Eoe({type:e,schema:null,validator:t})}function Ioe(e){let t;return new Eoe({type:"lazy",schema:null,*entries(n,r){t??(t=e()),yield*t.entries(n,r)},validator:(n,r)=>(t??(t=e()),t.validator(n,r)),coercer:(n,r)=>(t??(t=e()),t.coercer(n,r)),refiner:(n,r)=>(t??(t=e()),t.refiner(n,r))})}function Aoe(e){return new Eoe({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${yoe(e)}`})}function Poe(e){const t=yoe(e),n=typeof e;return new Eoe({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${yoe(n)}`})}function Moe(){return Coe("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${yoe(e)}`)}function Ooe(e){const t=e?Object.keys(e):[],n=Coe("never",()=>!1);return new Eoe({type:"object",schema:e||null,*entries(r){if(e&&goe(r)){const i=new Set(Object.keys(r));for(const n of t)i.delete(n),yield[n,r[n],e[n]];for(const e of i)yield[e,r[e],n]}},validator:e=>goe(e)||`Expected an object, but received: ${yoe(e)}`,coercer:e=>goe(e)?{...e}:e})}function Toe(e){return new Eoe({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function Roe(e,t){return new Eoe({type:"record",schema:null,*entries(n){if(goe(n))for(const r in n){const i=n[r];yield[r,r,e],yield[r,i,t]}},validator:e=>goe(e)||`Expected an object, but received: ${yoe(e)}`})}function Noe(){return Coe("string",e=>"string"==typeof e||`Expected a string, but received: ${yoe(e)}`)}function Loe(e){const t=e.map(e=>e.type).join(" | ");return new Eoe({type:"union",schema:null,coercer(t){for(const n of e){const[e,r]=n.validate(t,{coerce:!0});if(!e)return r}return t},validator(n,r){const i=[];for(const t of e){const[...e]=woe(n,t,r),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${yoe(n)}`,...i]}})}var Boe=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function joe(){throw new Error("setTimeout has not been defined")}function Doe(){throw new Error("clearTimeout has not been defined")}var Uoe=joe,Foe=Doe;function $oe(e){if(Uoe===setTimeout)return setTimeout(e,0);if((Uoe===joe||!Uoe)&&setTimeout)return Uoe=setTimeout,setTimeout(e,0);try{return Uoe(e,0)}catch(Gle){try{return Uoe.call(null,e,0)}catch(t){return Uoe.call(this,e,0)}}}"function"==typeof u7.setTimeout&&(Uoe=setTimeout),"function"==typeof u7.clearTimeout&&(Foe=clearTimeout);var zoe,Hoe=[],qoe=!1,Woe=-1;function Koe(){qoe&&zoe&&(qoe=!1,zoe.length?Hoe=zoe.concat(Hoe):Woe=-1,Hoe.length&&Goe())}function Goe(){if(!qoe){var e=$oe(Koe);qoe=!0;for(var t=Hoe.length;t;){for(zoe=Hoe,Hoe=[];++Woe<t;)zoe&&zoe[Woe].run();Woe=-1,t=Hoe.length}zoe=null,qoe=!1,function(e){if(Foe===clearTimeout)return clearTimeout(e);if((Foe===Doe||!Foe)&&clearTimeout)return Foe=clearTimeout,clearTimeout(e);try{return Foe(e)}catch(t){try{return Foe.call(null,e)}catch(n){return Foe.call(this,e)}}}(e)}}function Voe(e,t){this.fun=e,this.array=t}function Zoe(){}Voe.prototype.run=function(){this.fun.apply(null,this.array)};var Yoe=Zoe,Joe=Zoe,Qoe=Zoe,Xoe=Zoe,ese=Zoe,tse=Zoe,nse=Zoe,rse=u7.performance||{},ise=rse.now||rse.mozNow||rse.msNow||rse.oNow||rse.webkitNow||function(){return(new Date).getTime()},ose=new Date,sse={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];Hoe.push(new Voe(e,t)),1!==Hoe.length||qoe||$oe(Goe)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Yoe,addListener:Joe,once:Qoe,off:Xoe,removeListener:ese,removeAllListeners:tse,emit:nse,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*ise.call(rse),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ose)/1e3}},ase=e=>Ooe(e);function cse({path:e,branch:t}){const n=e[e.length-1];return poe(t[t.length-2],n)}function lse(e){return new Eoe({...e,type:`optional ${e.type}`,validator:(t,n)=>!cse(n)||e.validator(t,n),refiner:(t,n)=>!cse(n)||e.refiner(t,n)})}var use,dse,hse,fse=Loe([Poe(null),Coe("boolean",e=>"boolean"==typeof e),Coe("finite number",e=>koe(e,Moe())&&Number.isFinite(e)),Noe(),Aoe(Ioe(()=>fse)),Roe(Noe(),Ioe(()=>fse))]),pse=(use=fse,dse=Coe("any",()=>!0),hse=e=>(function(e,t,n="Assertion failed",r=Boe){try{_oe(e,t)}catch(i){throw function(e,t){var n,r,i;return i=e,Boolean("string"==typeof(null==(r=null==(n=null==i?void 0:i.prototype)?void 0:n.constructor)?void 0:r.name))?new e({message:t}):e({message:t})}(r,`${n}: ${function(e){return(t=e,"object"==typeof(n=t)&&null!==n&&"message"in n&&"string"==typeof t.message?t.message:null==t?"":String(t)).replace(/\.$/u,"");var t,n}(i)}.`)}}(e,fse),JSON.parse(JSON.stringify(e,(e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))),new Eoe({...use,coercer:(e,t)=>koe(e,dse)?use.coercer(hse(e),t):use.coercer(e,t)}));function mse(e){try{return xoe(e,pse),!0}catch{return!1}}var gse=Poe("2.0"),yse=function(e){return new Eoe({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})}(Loe([Moe(),Noe()])),bse=ase({code:Coe("integer",e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${yoe(e)}`),message:Noe(),data:lse(pse),stack:lse(Noe())}),vse=Loe([Roe(Noe(),pse),Aoe(pse)]),wse=ase({id:yse,jsonrpc:gse,method:Noe(),params:lse(vse)}),Ese=ase({jsonrpc:gse,method:Noe(),params:lse(vse)});function _se(e){return koe(e,wse)}function xse(e){return koe(e,bse)}Ooe({id:yse,jsonrpc:gse,result:Toe(Coe("unknown",()=>!0)),error:Toe(bse)}),Loe([ase({id:yse,jsonrpc:gse,result:pse}),ase({id:yse,jsonrpc:gse,error:bse})]);var kse={code:doe,message:Cse(doe)},Sse="Unspecified server error.";function Cse(e,t="Unspecified error message. This is a bug, please report it."){if(n=e,Number.isInteger(n)){const t=e.toString();if(poe(hoe,t))return hoe[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return Sse}var n;return t}function Ise(e,{fallbackError:t=kse,shouldIncludeStack:n=!0}={}){if(!xse(t))throw new Error("Must provide fallback error with integer number code and string message.");const r=function(e,t){if(e&&"object"==typeof e&&"serialize"in e&&"function"==typeof e.serialize)return e.serialize();if(xse(e))return e;return{...t,data:{cause:Ase(e)}}}(e,t);return n||delete r.stack,r}function Ase(e){return Array.isArray(e)?e.map(e=>mse(e)?e:foe(e)?Pse(e):null):foe(e)?Pse(e):mse(e)?e:null}function Pse(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{const r=e[n];return mse(r)&&(t[n]=r),t},{})}var Mse=Bse;Bse.default=Bse,Bse.stable=Fse,Bse.stableStringify=Fse;var Ose="[...]",Tse="[Circular]",Rse=[],Nse=[];function Lse(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Bse(e,t,n,r){var i;void 0===r&&(r=Lse()),Dse(e,"",0,[],void 0,0,r);try{i=0===Nse.length?JSON.stringify(e,t,n):JSON.stringify(e,zse(t),n)}catch(s){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==Rse.length;){var o=Rse.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function jse(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);void 0!==i.get?i.configurable?(Object.defineProperty(r,n,{value:e}),Rse.push([r,n,t,i])):Nse.push([t,n,e]):(r[n]=e,Rse.push([r,n,t]))}function Dse(e,t,n,r,i,o,s){var a;if(o+=1,"object"==typeof e&&null!==e){for(a=0;a<r.length;a++)if(r[a]===e)return void jse(Tse,e,t,i);if(void 0!==s.depthLimit&&o>s.depthLimit)return void jse(Ose,e,t,i);if(void 0!==s.edgesLimit&&n+1>s.edgesLimit)return void jse(Ose,e,t,i);if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)Dse(e[a],a,a,r,e,o,s);else{var c=Object.keys(e);for(a=0;a<c.length;a++){var l=c[a];Dse(e[l],l,a,r,e,o,s)}}r.pop()}}function Use(e,t){return e<t?-1:e>t?1:0}function Fse(e,t,n,r){void 0===r&&(r=Lse());var i,o=$se(e,"",0,[],void 0,0,r)||e;try{i=0===Nse.length?JSON.stringify(o,t,n):JSON.stringify(o,zse(t),n)}catch(a){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==Rse.length;){var s=Rse.pop();4===s.length?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function $se(e,t,n,r,i,o,s){var a;if(o+=1,"object"==typeof e&&null!==e){for(a=0;a<r.length;a++)if(r[a]===e)return void jse(Tse,e,t,i);try{if("function"==typeof e.toJSON)return}catch(d){return}if(void 0!==s.depthLimit&&o>s.depthLimit)return void jse(Ose,e,t,i);if(void 0!==s.edgesLimit&&n+1>s.edgesLimit)return void jse(Ose,e,t,i);if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)$se(e[a],a,a,r,e,o,s);else{var c={},l=Object.keys(e).sort(Use);for(a=0;a<l.length;a++){var u=l[a];$se(e[u],u,a,r,e,o,s),c[u]=e[u]}if(void 0===i)return c;Rse.push([i,t,e]),i[t]=c}r.pop()}}function zse(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(Nse.length>0)for(var r=0;r<Nse.length;r++){var i=Nse[r];if(i[1]===t&&i[0]===n){n=i[2],Nse.splice(r,1);break}}return e.call(this,t,n)}}var Hse=h9(Mse),qse=class extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a non-empty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(t){return!1}}(this.data)&&(e.data.cause=Ase(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return Hse(this.serialize(),Wse,2)}};function Wse(e,t){if("[Circular]"!==t)return t}var Kse=e=>function(e,t){const[n,r]=function(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t??void 0,n]}}return[]}(t);return new qse(e,n??Cse(e),r)}(uoe,e);var Gse={};function Vse(){}function Zse(){Zse.init.call(this)}function Yse(e){return void 0===e._maxListeners?Zse.defaultMaxListeners:e._maxListeners}function Jse(e,t,n,r){var i,o,s,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]):(o=e._events=new Vse,e._eventsCount=0),s){if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),!s.warned&&(i=Yse(e))&&i>0&&s.length>i){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,"function"==typeof console.warn&&console.warn(a)}}else s=o[t]=n,++e._eventsCount;return e}function Qse(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments))}return i.listener=n,i}function Xse(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function eae(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}Vse.prototype=Object.create(null),Zse.EventEmitter=Zse,Zse.usingDomains=!1,Zse.prototype.domain=void 0,Zse.prototype._events=void 0,Zse.prototype._maxListeners=void 0,Zse.defaultMaxListeners=10,Zse.init=function(){this.domain=null,Zse.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Vse,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Zse.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},Zse.prototype.getMaxListeners=function(){return Yse(this)},Zse.prototype.emit=function(e){var t,n,r,i,o,s,a,c="error"===e;if(s=this._events)c=c&&null==s.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=s[e]))return!1;var u="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=eae(e,r),o=0;o<r;++o)i[o].call(n)}(n,u,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=eae(e,i),s=0;s<i;++s)o[s].call(n,r)}(n,u,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,s=eae(e,o),a=0;a<o;++a)s[a].call(n,r,i)}(n,u,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var s=e.length,a=eae(e,s),c=0;c<s;++c)a[c].call(n,r,i,o)}(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=eae(e,i),s=0;s<i;++s)o[s].apply(n,r)}(n,u,this,i)}return!0},Zse.prototype.addListener=function(e,t){return Jse(this,e,t,!1)},Zse.prototype.on=Zse.prototype.addListener,Zse.prototype.prependListener=function(e,t){return Jse(this,e,t,!0)},Zse.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,Qse(this,e,t)),this},Zse.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,Qse(this,e,t)),this},Zse.prototype.removeListener=function(e,t){var n,r,i,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener&&n.listener===t)0==--this._eventsCount?this._events=new Vse:(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length;o-- >0;)if(n[o]===t||n[o].listener&&n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new Vse,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,i);r.removeListener&&this.emit("removeListener",e,s||t)}return this},Zse.prototype.off=function(e,t){return this.removeListener(e,t)},Zse.prototype.removeAllListeners=function(e){var t,n;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=new Vse,this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=new Vse:delete n[e]),this;if(0===arguments.length){for(var r,i=Object.keys(n),o=0;o<i.length;++o)"removeListener"!==(r=i[o])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new Vse,this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},Zse.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},Zse.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Xse.call(e,t)},Zse.prototype.listenerCount=Xse,Zse.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var tae=f9(Object.freeze({__proto__:null,EventEmitter:Zse,default:Zse}));Object.defineProperty(Gse,"__esModule",{value:!0});const nae=tae;function rae(e,t,n){try{Reflect.apply(e,t,n)}catch(r){setTimeout(()=>{throw r})}}let iae=class extends nae.EventEmitter{emit(e,...t){let n="error"===e;const r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const n=new Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}const i=r[e];if(void 0===i)return!1;if("function"==typeof i)rae(i,this,t);else{const e=i.length,n=function(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)rae(n[r],this,t)}return!0}};var oae,sae,aae,cae,lae,uae,dae,hae,fae,pae,mae,gae,yae,bae,vae,wae,Eae,_ae,xae,kae=Gse.default=iae,Sae=class e extends kae{constructor({notificationHandler:e}={}){super(),aoe(this,cae),aoe(this,uae),aoe(this,hae),aoe(this,oae,!1),aoe(this,sae,void 0),aoe(this,aae,void 0),coe(this,sae,[]),coe(this,aae,e)}destroy(){soe(this,sae).forEach(e=>{"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}),coe(this,sae,[]),coe(this,oae,!0)}push(e){loe(this,cae,lae).call(this),soe(this,sae).push(e)}handle(e,t){if(loe(this,cae,lae).call(this),t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?loe(this,uae,dae).call(this,e,t):loe(this,uae,dae).call(this,e):t?loe(this,hae,fae).call(this,e,t):this._promiseHandle(e)}asMiddleware(){return loe(this,cae,lae).call(this),async(t,n,r,i)=>{var o,s;try{const[a,c,l]=await loe(o=e,gae,yae).call(o,t,n,soe(this,sae));return c?(await loe(s=e,wae,Eae).call(s,l),i(a)):r(async t=>{var n;try{await loe(n=e,wae,Eae).call(n,l)}catch(kie){return t(kie)}return t()})}catch(kie){return i(kie)}}}async _promiseHandle(e){return new Promise((t,n)=>{loe(this,hae,fae).call(this,e,(e,r)=>{e&&void 0===r?n(e):t(r)}).catch(n)})}};oae=new WeakMap,sae=new WeakMap,aae=new WeakMap,cae=new WeakSet,lae=function(){if(soe(this,oae))throw new Error("This engine is destroyed and can no longer be used.")},uae=new WeakSet,dae=async function(e,t){try{if(0===e.length){const e=[{id:null,jsonrpc:"2.0",error:new qse(uoe,"Request batch must contain plain objects. Received an empty array")}];return t?t(null,e):e}const n=(await Promise.all(e.map(this._promiseHandle.bind(this)))).filter(e=>void 0!==e);return t?t(null,n):n}catch(n){if(t)return t(n);throw n}},hae=new WeakSet,fae=async function(e,t){var n;if(!e||Array.isArray(e)||"object"!=typeof e){const n=new qse(uoe,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(n,{id:null,jsonrpc:"2.0",error:n})}if("string"!=typeof e.method){const n=new qse(uoe,"Must specify a string method. Received: "+typeof e.method,{request:e});return soe(this,aae)&&!_se(e)?t(null):t(n,{id:e.id??null,jsonrpc:"2.0",error:n})}if(soe(this,aae)&&koe(e,Ese)&&!_se(e)){try{await soe(this,aae).call(this,e)}catch(s){return t(s)}return t(null)}let r=null;const i={...e},o={id:i.id,jsonrpc:i.jsonrpc};try{await loe(n=Sae,pae,mae).call(n,i,o,soe(this,sae))}catch(s){r=s}return r&&(delete o.result,o.error||(o.error=Ise(r))),t(r,o)},pae=new WeakSet,mae=async function(e,t,n){var r,i,o;const[s,a,c]=await loe(r=Sae,gae,yae).call(r,e,t,n);if(loe(i=Sae,_ae,xae).call(i,e,t,a),await loe(o=Sae,wae,Eae).call(o,c),s)throw s},gae=new WeakSet,yae=async function(e,t,n){var r;const i=[];let o=null,s=!1;for(const a of n)if([o,s]=await loe(r=Sae,bae,vae).call(r,e,t,a,i),s)break;return[o,s,i.reverse()]},bae=new WeakSet,vae=async function(e,t,n,r){return new Promise(i=>{const o=e=>{const n=e||t.error;n&&(t.error=Ise(n)),i([n,!0])},s=n=>{t.error?o(t.error):(n&&("function"!=typeof n&&o(new qse(doe,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof n}" for request:\n${Iae(e)}`,{request:e})),r.push(n)),i([null,!1]))};try{n(e,t,s,o)}catch(a){o(a)}})},wae=new WeakSet,Eae=async function(e){for(const t of e)await new Promise((e,n)=>{t(t=>t?n(t):e())})},_ae=new WeakSet,xae=function(e,t,n){if(!poe(t,"result")&&!poe(t,"error"))throw new qse(doe,`JsonRpcEngine: Response has no error or result for request:\n${Iae(e)}`,{request:e});if(!n)throw new qse(doe,`JsonRpcEngine: Nothing ended request:\n${Iae(e)}`,{request:e})},aoe(Sae,pae),aoe(Sae,gae),aoe(Sae,bae),aoe(Sae,wae),aoe(Sae,_ae);var Cae=Sae;function Iae(e){return JSON.stringify(e,null,2)}var Aae=Object.freeze(["eth_subscription"]),Pae=(e=console)=>[(e,t,n,r)=>{const i=e.id,o=ioe=(ioe+1)%roe;e.id=o,t.id=o,n(n=>{e.id=i,t.id=i,n()})},Mae(e),noe(e)];function Mae(e){return(t,n,r)=>{"string"==typeof t.method&&t.method||(n.error=Kse({message:"The request 'method' must be a non-empty string.",data:t})),r(t=>{const{error:r}=n;return r?(e.error(`MetaMask - RPC Error: ${r.message}`,r),t()):t()})}}var Oae=(e,t,n=!0)=>(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)},Tae=e=>Boolean(e)&&"string"==typeof e&&e.startsWith("0x"),Rae=()=>{};async function Nae(e,t){try{const t=await async function(){return{name:Lae(window),icon:await Bae(window)}}();e.handle({jsonrpc:"2.0",id:1,method:"metamask_sendDomainMetadata",params:t},Rae)}catch(n){t.error({message:toe.errors.sendSiteMetadata(),originalError:n})}}function Lae(e){const{document:t}=e,n=t.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;const r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:window.location.hostname}async function Bae(e){const{document:t}=e,n=t.querySelectorAll('head > link[rel~="icon"]');for(const r of Array.from(n))if(r&&await jae(r.href))return r.href;return null}async function jae(e){return new Promise((t,n)=>{try{const n=document.createElement("img");n.onload=()=>t(!0),n.onerror=()=>t(!1),n.src=e}catch(r){n(r)}})}var Dae=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Uae=(e,t,n)=>(Dae(e,t,"read from private field"),n?n.call(e):t.get(e)),Fae=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},$ae=(e,t,n,r)=>(Dae(e,t,"write to private field"),t.set(e,n),n);function zae(e,t,n){try{Reflect.apply(e,t,n)}catch(r){setTimeout(()=>{throw r})}}class Hae extends Zse{emit(e,...t){let n="error"===e;const r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const n=new Error("Unhandled error."+(e?` (${e.message})`:""));throw n.context=e,n}const i=r[e];if(void 0===i)return!1;if("function"==typeof i)zae(i,this,t);else{const e=i.length,n=function(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}(i);for(let r=0;r<e;r+=1)zae(n[r],this,t)}return!0}}var qae,Wae,Kae=h9(function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var s=o[i];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n}),Gae=class e extends Hae{constructor({logger:t=console,maxEventListeners:n=100,rpcMiddleware:r=[]}={}){super(),Fae(this,qae,void 0),Fae(this,Wae,void 0),this._log=t,this.setMaxListeners(n),this._state={...e._defaultState},$ae(this,Wae,null),$ae(this,qae,null),this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleConnect=this._handleConnect.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this.request=this.request.bind(this);const i=new Cae;r.forEach(e=>i.push(e)),this._rpcEngine=i}get chainId(){return Uae(this,qae)}get selectedAddress(){return Uae(this,Wae)}isConnected(){return this._state.isConnected}async request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw Kse({message:toe.errors.invalidRequestArgs(),data:e});const{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw Kse({message:toe.errors.invalidRequestMethod(),data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw Kse({message:toe.errors.invalidRequestParams(),data:e});const r=null==n?{method:t}:{method:t,params:n};return new Promise((e,t)=>{this._rpcRequest(r,Oae(e,t))})}_initializeState(e){if(this._state.initialized)throw new Error("Provider already initialized.");if(e){const{accounts:t,chainId:n,isUnlocked:r,networkVersion:i}=e;this._handleConnect(n),this._handleChainChanged({chainId:n,networkVersion:i}),this._handleUnlockStateChanged({accounts:t,isUnlocked:r}),this._handleAccountsChanged(t)}this._state.initialized=!0,this.emit("_initialized")}_rpcRequest(e,t){let n=t;return Array.isArray(e)||(e.jsonrpc||(e.jsonrpc="2.0"),"eth_accounts"!==e.method&&"eth_requestAccounts"!==e.method||(n=(n,r)=>{this._handleAccountsChanged(r.result??[],"eth_accounts"===e.method),t(n,r)})),this._rpcEngine.handle(e,n)}_handleConnect(e){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:e}),this._log.debug(toe.info.connected(e)))}_handleDisconnect(e,t){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!e){let n;this._state.isConnected=!1,e?(n=new qse(1013,t??toe.errors.disconnected()),this._log.debug(n)):(n=new qse(1011,t??toe.errors.permanentlyDisconnected()),this._log.error(n),$ae(this,qae,null),this._state.accounts=null,$ae(this,Wae,null),this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",n)}}_handleChainChanged({chainId:e}={}){Tae(e)?(this._handleConnect(e),e!==Uae(this,qae)&&($ae(this,qae,e),this._state.initialized&&this.emit("chainChanged",Uae(this,qae)))):this._log.error(toe.errors.invalidNetworkParams(),{chainId:e})}_handleAccountsChanged(e,t=!1){let n=e;Array.isArray(e)||(this._log.error("MetaMask: Received invalid accounts parameter. Please report this bug.",e),n=[]);for(const r of e)if("string"!=typeof r){this._log.error("MetaMask: Received non-string account. Please report this bug.",e),n=[];break}if(!Kae(this._state.accounts,n)&&(t&&null!==this._state.accounts&&this._log.error("MetaMask: 'eth_accounts' unexpectedly updated accounts. Please report this bug.",n),this._state.accounts=n,Uae(this,Wae)!==n[0]&&$ae(this,Wae,n[0]||null),this._state.initialized)){const e=[...n];this.emit("accountsChanged",e)}}_handleUnlockStateChanged({accounts:e,isUnlocked:t}={}){"boolean"==typeof t?t!==this._state.isUnlocked&&(this._state.isUnlocked=t,this._handleAccountsChanged(e??[])):this._log.error("MetaMask: Received invalid isUnlocked parameter. Please report this bug.")}};qae=new WeakMap,Wae=new WeakMap,Gae._defaultState={accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1};var Vae,Zae,Yae=Gae,Jae={exports:{}};function Qae(){return Zae?Vae:(Zae=1,Vae=tae.EventEmitter)}var Xae,ece=f9(u9);Xae="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var tce=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++)n[t[r]]=Object.getOwnPropertyDescriptor(e,t[r]);return n},nce=/%[sdj%]/g;function rce(e){if(!vce(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(cce(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,o=String(e).replace(nce,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),s=r[n];n<i;s=r[++n])gce(s)||!xce(s)?o+=" "+s:o+=" "+cce(s);return o}function ice(e,t){if(Ece(u7.process))return function(){return ice(e,t).apply(this,arguments)};if(!0===sse.noDeprecation)return e;var n=!1;return function(){if(!n){if(sse.throwDeprecation)throw new Error(t);sse.traceDeprecation?console.trace(t):console.error(t),n=!0}return e.apply(this,arguments)}}var oce,sce={};function ace(e){return Ece(oce)&&(oce=sse.env.NODE_DEBUG||""),e=e.toUpperCase(),sce[e]||(new RegExp("\\b"+e+"\\b","i").test(oce)?sce[e]=function(){var t=rce.apply(null,arguments);console.error("%s %d: %s",e,0,t)}:sce[e]=function(){}),sce[e]}function cce(e,t){var n={seen:[],stylize:uce};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),mce(t)?n.showHidden=t:t&&Oce(n,t),Ece(n.showHidden)&&(n.showHidden=!1),Ece(n.depth)&&(n.depth=2),Ece(n.colors)&&(n.colors=!1),Ece(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=lce),dce(n,e,n.depth)}function lce(e,t){var n=cce.styles[t];return n?"["+cce.colors[n][0]+"m"+e+"["+cce.colors[n][1]+"m":e}function uce(e,t){return e}function dce(e,t,n){if(e.customInspect&&t&&Cce(t.inspect)&&t.inspect!==cce&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return vce(r)||(r=dce(e,r,n)),r}var i=function(e,t){if(Ece(t))return e.stylize("undefined","undefined");if(vce(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return bce(t)?e.stylize(""+t,"number"):mce(t)?e.stylize(""+t,"boolean"):gce(t)?e.stylize("null","null"):void 0}(e,t);if(i)return i;var o,s=Object.keys(t),a=(o={},s.forEach(function(e,t){o[e]=!0}),o);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),Sce(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return hce(t);if(0===s.length){if(Cce(t)){var c=t.name?": "+t.name:"";return e.stylize("[Function"+c+"]","special")}if(_ce(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(kce(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Sce(t))return hce(t)}var l,u="",d=!1,h=["{","}"];return pce(t)&&(d=!0,h=["[","]"]),Cce(t)&&(u=" [Function"+(t.name?": "+t.name:"")+"]"),_ce(t)&&(u=" "+RegExp.prototype.toString.call(t)),kce(t)&&(u=" "+Date.prototype.toUTCString.call(t)),Sce(t)&&(u=" "+hce(t)),0!==s.length||d&&0!=t.length?n<0?_ce(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),l=d?function(e,t,n,r,i){for(var o=[],s=0,a=t.length;s<a;++s)Tce(t,String(s))?o.push(fce(e,t,n,r,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(fce(e,t,n,r,i,!0))}),o}(e,t,n,a,s):s.map(function(r){return fce(e,t,n,a,r,d)}),e.seen.pop(),function(e,t,n){return e.reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}(l,u,h)):h[0]+u+h[1]}function hce(e){return"["+Error.prototype.toString.call(e)+"]"}function fce(e,t,n,r,i,o){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),Tce(r,i)||(s="["+i+"]"),a||(e.seen.indexOf(c.value)<0?(a=gce(n)?dce(e,c.value,null):dce(e,c.value,n-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),Ece(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function pce(e){return Array.isArray(e)}function mce(e){return"boolean"==typeof e}function gce(e){return null===e}function yce(e){return null==e}function bce(e){return"number"==typeof e}function vce(e){return"string"==typeof e}function wce(e){return"symbol"==typeof e}function Ece(e){return void 0===e}function _ce(e){return xce(e)&&"[object RegExp]"===Pce(e)}function xce(e){return"object"==typeof e&&null!==e}function kce(e){return xce(e)&&"[object Date]"===Pce(e)}function Sce(e){return xce(e)&&("[object Error]"===Pce(e)||e instanceof Error)}function Cce(e){return"function"==typeof e}function Ice(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Ace(e){return S7.isBuffer(e)}function Pce(e){return Object.prototype.toString.call(e)}cce.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},cce.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function Mce(){}function Oce(e,t){if(!t||!xce(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function Tce(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Rce="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function Nce(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(Rce&&e[Rce]){var t;if("function"!=typeof(t=e[Rce]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,Rce,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise(function(e,r){t=e,n=r}),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push(function(e,r){e?n(e):t(r)});try{e.apply(this,i)}catch(s){n(s)}return r}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Rce&&Object.defineProperty(t,Rce,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,tce(e))}function Lce(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}function Bce(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],n=0;n<arguments.length;n++)t.push(arguments[n]);var r=t.pop();if("function"!=typeof r)throw new TypeError("The last argument must be of type Function");var i=this,o=function(){return r.apply(i,arguments)};e.apply(this,t).then(function(e){sse.nextTick(o.bind(null,null,e))},function(e){sse.nextTick(Lce.bind(null,e,o))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,tce(e)),t}Nce.custom=Rce;var jce,Dce,Uce,Fce,$ce={inherits:Xae,_extend:Oce,log:Mce,isBuffer:Ace,isPrimitive:Ice,isFunction:Cce,isError:Sce,isDate:kce,isObject:xce,isRegExp:_ce,isUndefined:Ece,isSymbol:wce,isString:vce,isNumber:bce,isNullOrUndefined:yce,isNull:gce,isBoolean:mce,isArray:pce,inspect:cce,deprecate:ice,format:rce,debuglog:ace,promisify:Nce,callbackify:Bce},zce=f9(Object.freeze({__proto__:null,_extend:Oce,callbackify:Bce,debuglog:ace,default:$ce,deprecate:ice,format:rce,inherits:Xae,inspect:cce,isArray:pce,isBoolean:mce,isBuffer:Ace,isDate:kce,isError:Sce,isFunction:Cce,isNull:gce,isNullOrUndefined:yce,isNumber:bce,isObject:xce,isPrimitive:Ice,isRegExp:_ce,isString:vce,isSymbol:wce,isUndefined:Ece,log:Mce,promisify:Nce}));function Hce(){if(Dce)return jce;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach(function(e){n(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function n(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e){var t=function(e){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}Dce=1;var i=ece.Buffer,o=zce.inspect,s=o&&o.custom||"inspect";return jce=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return function(e,t){t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return i.alloc(0);for(var t,n,r,o=i.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=o,r=a,i.prototype.copy.call(t,n,r),a+=s.data.length,s=s.next;return o}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0===(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=i.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(t,t.length-e,0,s),0===(e-=s)){s===o.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(s));break}++r}return this.length-=r,t}},{key:s,value:function(e,n){return o(this,t(t({},n),{},{depth:0,customInspect:!1}))}}]),e}()}function qce(){if(Fce)return Uce;function e(e,r){n(e,r),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}return Fce=1,Uce={destroy:function(r,i){var o=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,sse.nextTick(n,this,r)):sse.nextTick(n,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(n){!i&&n?o._writableState?o._writableState.errorEmitted?sse.nextTick(t,o):(o._writableState.errorEmitted=!0,sse.nextTick(e,o,n)):sse.nextTick(e,o,n):i?(sse.nextTick(t,o),i(n)):sse.nextTick(t,o)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}},Uce}var Wce,Kce,Gce={},Vce={};function Zce(e,t,n){n||(n=Error);var r=function(e){var n,r;function i(n,r,i){return e.call(this,(o=n,s=r,a=i,"string"==typeof t?t:t(o,s,a)))||this;var o,s,a}return r=e,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);r.prototype.name=n.name,r.prototype.code=e,Vce[e]=r}function Yce(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function Jce(){if(Kce)return Wce;Kce=1;var e=Gce.codes.ERR_INVALID_OPT_VALUE;return Wce={getHighWaterMark:function(t,n,r,i){var o,s,a,c=(s=i,a=r,null!=(o=n).highWaterMark?o.highWaterMark:s?o[a]:null);if(null!=c){if(!isFinite(c)||Math.floor(c)!==c||c<0)throw new e(i?r:"highWaterMark",c);return Math.floor(c)}return t.objectMode?16:16384}}}Zce("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),Zce("ERR_INVALID_ARG_TYPE",function(e,t,n){var r,i,o,s,a,c;if("string"==typeof t&&(i="not ",t.substr(0,4)===i)?(r="must not be",t=t.replace(/^not /,"")):r="must be",s=e,a=" argument",(void 0===c||c>s.length)&&(c=s.length),s.substring(c-9,c)===a)o="The ".concat(e," ").concat(r," ").concat(Yce(t,"type"));else{var l=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+1>e.length)&&-1!==e.indexOf(".",n)}(e)?"property":"argument";o='The "'.concat(e,'" ').concat(l," ").concat(r," ").concat(Yce(t,"type"))}return o+". Received type ".concat(typeof n)},TypeError),Zce("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),Zce("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),Zce("ERR_STREAM_PREMATURE_CLOSE","Premature close"),Zce("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),Zce("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),Zce("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),Zce("ERR_STREAM_WRITE_AFTER_END","write after end"),Zce("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Zce("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),Zce("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Gce.codes=Vce;var Qce,Xce,ele,tle,nle,rle,ile="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},ole=f9(Object.freeze({__proto__:null,default:ile}));function sle(){if(Xce)return Qce;function e(e){try{if(!d9.localStorage)return!1}catch(n){return!1}var t=d9.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return Xce=1,Qce=function(t,n){if(e("noDeprecation"))return t;var r=!1;return function(){if(!r){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return t.apply(this,arguments)}},Qce}function ale(){if(tle)return ele;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t){var n=e.entry;for(e.entry=null;n;){var r=n.callback;t.pendingcb--,r(undefined),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var t;tle=1,ele=E,E.WritableState=w;var n,r={deprecate:sle()},i=Qae(),o=ece.Buffer,s=(void 0!==d9?d9:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},a=qce(),c=Jce().getHighWaterMark,l=Gce.codes,u=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,h=l.ERR_MULTIPLE_CALLBACK,f=l.ERR_STREAM_CANNOT_PIPE,p=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,y=l.ERR_UNKNOWN_ENCODING,b=a.errorOrDestroy;function v(){}function w(n,r,i){t=t||cle(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=c(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===n.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n,r=e._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new h;if((n=r).writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t)!function(e,t,n,r,i){--t.pendingcb,n?(sse.nextTick(i,r),sse.nextTick(I,e,t),e._writableState.errorEmitted=!0,b(e,r)):(i(r),e._writableState.errorEmitted=!0,b(e,r),I(e,t))}(e,r,i,t,o);else{var s=S(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||k(e,r),i?sse.nextTick(x,e,r,s,o):x(e,r,s,o)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function E(e){var r=this instanceof(t=t||cle());if(!r&&!n.call(E,this))return new E(e);this._writableState=new w(e,this,r),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),i.call(this)}function _(e,t,n,r,i,o,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new p("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function x(e,t,n,r){var i,o;n||(i=e,0===(o=t).length&&o.needDrain&&(o.needDrain=!1,i.emit("drain"))),t.pendingcb--,r(),I(e,t)}function k(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=n.bufferedRequestCount,o=new Array(i),s=n.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)o[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;o.allBuffers=c,_(t,n,!0,n.length,o,"",s.finish),n.pendingcb++,n.lastBufferedRequest=null,s.next?(n.corkedRequestsFree=s.next,s.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,d=r.callback;if(_(t,n,!1,n.objectMode?1:l.length,l,u,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function C(e,t){e._final(function(n){t.pendingcb--,n&&b(e,n),t.prefinished=!0,e.emit("prefinish"),I(e,t)})}function I(e,t){var n,r,i=S(t);if(i&&(n=e,(r=t).prefinished||r.finalCalled||("function"!=typeof n._final||r.destroyed?(r.prefinished=!0,n.emit("prefinish")):(r.pendingcb++,r.finalCalled=!0,sse.nextTick(C,n,r))),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var o=e._readableState;(!o||o.autoDestroy&&o.endEmitted)&&e.destroy()}return i}return ole(E,i),w.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(w.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(n=Function.prototype[Symbol.hasInstance],Object.defineProperty(E,Symbol.hasInstance,{value:function(e){return!!n.call(this,e)||this===E&&e&&e._writableState instanceof w}})):n=function(e){return e instanceof this},E.prototype.pipe=function(){b(this,new f)},E.prototype.write=function(e,t,n){var r,i,a=this._writableState,c=!1,l=!a.objectMode&&(r=e,o.isBuffer(r)||r instanceof s);return l&&!o.isBuffer(e)&&(i=e,e=o.from(i)),"function"==typeof t&&(n=t,t=null),l?t="buffer":t||(t=a.defaultEncoding),"function"!=typeof n&&(n=v),a.ending?function(e,t){var n=new g;b(e,n),sse.nextTick(t,n)}(this,n):(l||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new u("chunk",["string","Buffer"],n)),!i||(b(e,i),sse.nextTick(r,i),!1)}(this,a,e,n))&&(a.pendingcb++,c=function(e,t,n,r,i,s){if(!n){var a=(l=r,u=i,(c=t).objectMode||!1===c.decodeStrings||"string"!=typeof l||(l=o.from(l,u)),l);r!==a&&(n=!0,i="buffer",r=a)}var c,l,u,d=t.objectMode?1:r.length;t.length+=d;var h=t.length<t.highWaterMark;if(h||(t.needDrain=!0),t.writing||t.corked){var f=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:s,next:null},f?f.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else _(e,t,!1,d,r,i,s);return h}(this,a,l,e,t,n)),c},E.prototype.cork=function(){this._writableState.corked++},E.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||k(this,e))},E.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new y(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(E.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(e,t,n){n(new d("_write()"))},E.prototype._writev=null,E.prototype.end=function(e,t,n){var r,i,o,s=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),s.corked&&(s.corked=1,this.uncork()),s.ending||(r=this,o=n,(i=s).ending=!0,I(r,i),o&&(i.finished?sse.nextTick(o):r.once("finish",o)),i.ended=!0,r.writable=!1),this},Object.defineProperty(E.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),E.prototype.destroy=a.destroy,E.prototype._undestroy=a.undestroy,E.prototype._destroy=function(e,t){t(e)},ele}function cle(){if(rle)return nle;rle=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};nle=s;var t=Sle(),n=ale();ole(s,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var o=r[i];s.prototype[o]||(s.prototype[o]=n.prototype[o])}function s(e){if(!(this instanceof s))return new s(e);t.call(this,e),n.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||sse.nextTick(c,this)}function c(e){e.end()}return Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),nle}var lle=S7.isEncoding||function(e){switch(e&&e.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 ule(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!lle(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=hle;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=fle;break;default:return void(this.write=dle)}this.charBuffer=new S7(6),this.charReceived=0,this.charLength=0}function dle(e){return e.toString(this.encoding)}function hle(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function fle(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}ule.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(e=e.slice(n,e.length),!((r=(t=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(t.length-1))>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r,i=e.length;if(this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),i=(t+=e.toString(this.encoding,0,i)).length-1,(r=t.charCodeAt(i))>=55296&&r<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},ule.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},ule.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t};var ple=f9(Object.freeze({__proto__:null,StringDecoder:ule})),mle=Gce.codes.ERR_STREAM_PREMATURE_CLOSE;function gle(){}var yle,ble,vle,wle,Ele,_le,xle=function e(t,n,r){if("function"==typeof n)return e(t,null,n);n||(n={}),r=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(r||gle);var i=n.readable||!1!==n.readable&&t.readable,o=n.writable||!1!==n.writable&&t.writable,s=function(){t.writable||c()},a=t._writableState&&t._writableState.finished,c=function(){o=!1,a=!0,i||r.call(t)},l=t._readableState&&t._readableState.endEmitted,u=function(){i=!1,l=!0,o||r.call(t)},d=function(e){r.call(t,e)},h=function(){var e;return i&&!l?(t._readableState&&t._readableState.ended||(e=new mle),r.call(t,e)):o&&!a?(t._writableState&&t._writableState.ended||(e=new mle),r.call(t,e)):void 0},f=function(){t.req.on("finish",c)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",c),t.on("abort",h),t.req?f():t.on("request",f)):o&&!t._writableState&&(t.on("end",s),t.on("close",s)),t.on("end",u),t.on("finish",c),!1!==n.error&&t.on("error",d),t.on("close",h),function(){t.removeListener("complete",c),t.removeListener("abort",h),t.removeListener("request",f),t.req&&t.req.removeListener("finish",c),t.removeListener("end",s),t.removeListener("close",s),t.removeListener("finish",c),t.removeListener("end",u),t.removeListener("error",d),t.removeListener("close",h)}};function kle(){if(ble)return yle;var e;function t(e,t,n){return(t="symbol"==typeof(r=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t,"string"))?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e;var r}ble=1;var n=xle,r=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),s=Symbol("ended"),a=Symbol("lastPromise"),c=Symbol("handlePromise"),l=Symbol("stream");function u(e,t){return{value:e,done:t}}function d(e){var t=e[r];if(null!==t){var n=e[l].read();null!==n&&(e[a]=null,e[r]=null,e[i]=null,t(u(n,!1)))}}function h(e){sse.nextTick(d,e)}var f=Object.getPrototypeOf(function(){}),p=Object.setPrototypeOf((t(e={get stream(){return this[l]},next:function(){var e=this,t=this[o];if(null!==t)return Promise.reject(t);if(this[s])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise(function(t,n){sse.nextTick(function(){e[o]?n(e[o]):t(u(void 0,!0))})});var n,r=this[a];if(r)n=new Promise(function(e,t){return function(n,r){e.then(function(){t[s]?n(u(void 0,!0)):t[c](n,r)},r)}}(r,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(u(i,!1));n=new Promise(this[c])}return this[a]=n,n}},Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var e=this;return new Promise(function(t,n){e[l].destroy(null,function(e){e?n(e):t(u(void 0,!0))})})}),e),f);return yle=function(e){var d,f=Object.create(p,(t(d={},l,{value:e,writable:!0}),t(d,r,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,o,{value:null,writable:!0}),t(d,s,{value:e._readableState.endEmitted,writable:!0}),t(d,c,{value:function(e,t){var n=f[l].read();n?(f[a]=null,f[r]=null,f[i]=null,e(u(n,!1))):(f[r]=e,f[i]=t)},writable:!0}),d));return f[a]=null,n(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=f[i];return null!==t&&(f[a]=null,f[r]=null,f[i]=null,t(e)),void(f[o]=e)}var n=f[r];null!==n&&(f[a]=null,f[r]=null,f[i]=null,n(u(void 0,!0))),f[s]=!0}),e.on("readable",h.bind(null,f)),f}}function Sle(){if(_le)return Ele;var e;_le=1,Ele=E,E.ReadableState=w,tae.EventEmitter;var t,n=function(e,t){return e.listeners(t).length},r=Qae(),i=ece.Buffer,o=(void 0!==d9?d9:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},s=zce;t=s&&s.debuglog?s.debuglog("stream"):function(){};var a,c,l,u=Hce(),d=qce(),h=Jce().getHighWaterMark,f=Gce.codes,p=f.ERR_INVALID_ARG_TYPE,m=f.ERR_STREAM_PUSH_AFTER_EOF,g=f.ERR_METHOD_NOT_IMPLEMENTED,y=f.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;ole(E,r);var b=d.errorOrDestroy,v=["error","close","destroy","pause","resume"];function w(t,n,r){e=e||cle(),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=h(this,t,"readableHighWaterMark",r),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(a||(a=ple.StringDecoder),this.decoder=new a(t.encoding),this.encoding=t.encoding)}function E(t){if(e=e||cle(),!(this instanceof E))return new E(t);var n=this instanceof e;this._readableState=new w(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),r.call(this)}function _(e,n,r,s,a){t("readableAddChunk",n);var c,l,u,d,h,f=e._readableState;if(null===n)f.reading=!1,function(e,n){if(t("onEofChunk"),!n.ended){if(n.decoder){var r=n.decoder.end();r&&r.length&&(n.buffer.push(r),n.length+=n.objectMode?1:r.length)}n.ended=!0,n.sync?C(e):(n.needReadable=!1,n.emittedReadable||(n.emittedReadable=!0,I(e)))}}(e,f);else if(a||(l=f,h=u=n,i.isBuffer(h)||h instanceof o||"string"==typeof u||void 0===u||l.objectMode||(d=new p("chunk",["string","Buffer","Uint8Array"],u)),c=d),c)b(e,c);else if(f.objectMode||n&&n.length>0)if("string"==typeof n||f.objectMode||Object.getPrototypeOf(n)===i.prototype||(n=function(e){return i.from(e)}(n)),s)f.endEmitted?b(e,new y):x(e,f,n,!0);else if(f.ended)b(e,new m);else{if(f.destroyed)return!1;f.reading=!1,f.decoder&&!r?(n=f.decoder.write(n),f.objectMode||0!==n.length?x(e,f,n,!1):A(e,f)):x(e,f,n,!1)}else s||(f.reading=!1,A(e,f));return!f.ended&&(f.length<f.highWaterMark||0===f.length)}function x(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&C(e)),A(e,t)}Object.defineProperty(E.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),E.prototype.destroy=d.destroy,E.prototype._undestroy=d.undestroy,E.prototype._destroy=function(e,t){t(e)},E.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=i.from(e,t),t=""),n=!0),_(this,e,t,!1,n)},E.prototype.unshift=function(e){return _(this,e,null,!0,!1)},E.prototype.isPaused=function(){return!1===this._readableState.flowing},E.prototype.setEncoding=function(e){a||(a=ple.StringDecoder);var t=new a(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var k=1073741824;function S(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=((n=e)>=k?n=k:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var n}function C(e){var n=e._readableState;t("emitReadable",n.needReadable,n.emittedReadable),n.needReadable=!1,n.emittedReadable||(t("emitReadable",n.flowing),n.emittedReadable=!0,sse.nextTick(I,e))}function I(e){var n=e._readableState;t("emitReadable_",n.destroyed,n.length,n.ended),n.destroyed||!n.length&&!n.ended||(e.emit("readable"),n.emittedReadable=!1),n.needReadable=!n.flowing&&!n.ended&&n.length<=n.highWaterMark,R(e)}function A(e,t){t.readingMore||(t.readingMore=!0,sse.nextTick(P,e,t))}function P(e,n){for(;!n.reading&&!n.ended&&(n.length<n.highWaterMark||n.flowing&&0===n.length);){var r=n.length;if(t("maybeReadMore read 0"),e.read(0),r===n.length)break}n.readingMore=!1}function M(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function O(e){t("readable nexttick read 0"),e.read(0)}function T(e,n){t("resume",n.reading),n.reading||e.read(0),n.resumeScheduled=!1,e.emit("resume"),R(e),n.flowing&&!n.reading&&e.read(0)}function R(e){var n=e._readableState;for(t("flow",n.flowing);n.flowing&&null!==e.read(););}function N(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function L(e){var n=e._readableState;t("endReadable",n.endEmitted),n.endEmitted||(n.ended=!0,sse.nextTick(B,n,e))}function B(e,n){if(t("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,n.readable=!1,n.emit("end"),e.autoDestroy)){var r=n._writableState;(!r||r.autoDestroy&&r.finished)&&n.destroy()}}function j(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return E.prototype.read=function(e){t("read",e),e=parseInt(e,10);var n=this._readableState,r=e;if(0!==e&&(n.emittedReadable=!1),0===e&&n.needReadable&&((0!==n.highWaterMark?n.length>=n.highWaterMark:n.length>0)||n.ended))return t("read: emitReadable",n.length,n.ended),0===n.length&&n.ended?L(this):C(this),null;if(0===(e=S(e,n))&&n.ended)return 0===n.length&&L(this),null;var i,o=n.needReadable;return t("need readable",o),(0===n.length||n.length-e<n.highWaterMark)&&t("length less than watermark",o=!0),n.ended||n.reading?t("reading or ended",o=!1):o&&(t("do read"),n.reading=!0,n.sync=!0,0===n.length&&(n.needReadable=!0),this._read(n.highWaterMark),n.sync=!1,n.reading||(e=S(r,n))),null===(i=e>0?N(e,n):null)?(n.needReadable=n.length<=n.highWaterMark,e=0):(n.length-=e,n.awaitDrain=0),0===n.length&&(n.ended||(n.needReadable=!0),r!==e&&n.ended&&L(this)),null!==i&&this.emit("data",i),i},E.prototype._read=function(e){b(this,new g("_read()"))},E.prototype.pipe=function(e,r){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,t("pipe count=%d opts=%j",o.pipesCount,r);var s=r&&!1===r.end||e===sse.stdout||e===sse.stderr?p:a;function a(){t("onend"),e.end()}o.endEmitted?sse.nextTick(s):i.once("end",s),e.on("unpipe",function n(r,s){t("onunpipe"),r===i&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,t("cleanup"),e.removeListener("close",h),e.removeListener("finish",f),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",n),i.removeListener("end",a),i.removeListener("end",p),i.removeListener("data",u),l=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||c())});var c=function(e){return function(){var r=e._readableState;t("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&n(e,"data")&&(r.flowing=!0,R(e))}}(i);e.on("drain",c);var l=!1;function u(n){t("ondata");var r=e.write(n);t("dest.write",r),!1===r&&((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==j(o.pipes,e))&&!l&&(t("false write response, pause",o.awaitDrain),o.awaitDrain++),i.pause())}function d(r){t("onerror",r),p(),e.removeListener("error",d),0===n(e,"error")&&b(e,r)}function h(){e.removeListener("finish",f),p()}function f(){t("onfinish"),e.removeListener("close",h),p()}function p(){t("unpipe"),i.unpipe(e)}return i.on("data",u),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",d),e.once("close",h),e.once("finish",f),e.emit("pipe",i),o.flowing||(t("pipe resume"),i.resume()),e},E.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=j(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},E.prototype.on=function(e,n){var i=r.prototype.on.call(this,e,n),o=this._readableState;return"data"===e?(o.readableListening=this.listenerCount("readable")>0,!1!==o.flowing&&this.resume()):"readable"===e&&(o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.flowing=!1,o.emittedReadable=!1,t("on readable",o.length,o.reading),o.length?C(this):o.reading||sse.nextTick(O,this))),i},E.prototype.addListener=E.prototype.on,E.prototype.removeListener=function(e,t){var n=r.prototype.removeListener.call(this,e,t);return"readable"===e&&sse.nextTick(M,this),n},E.prototype.removeAllListeners=function(e){var t=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||sse.nextTick(M,this),t},E.prototype.resume=function(){var e,n,r=this._readableState;return r.flowing||(t("resume"),r.flowing=!r.readableListening,e=this,(n=r).resumeScheduled||(n.resumeScheduled=!0,sse.nextTick(T,e,n))),r.paused=!1,this},E.prototype.pause=function(){return t("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(t("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},E.prototype.wrap=function(e){var n=this,r=this._readableState,i=!1;for(var o in e.on("end",function(){if(t("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&n.push(e)}n.push(null)}),e.on("data",function(o){t("wrapped data"),r.decoder&&(o=r.decoder.write(o)),r.objectMode&&null==o||(r.objectMode||o&&o.length)&&(n.push(o)||(i=!0,e.pause()))}),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var s=0;s<v.length;s++)e.on(v[s],this.emit.bind(this,v[s]));return this._read=function(n){t("wrapped _read",n),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(E.prototype[Symbol.asyncIterator]=function(){return void 0===c&&(c=kle()),c(this)}),Object.defineProperty(E.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(E.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(E.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),E._fromList=N,Object.defineProperty(E.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(E.from=function(e,t){return void 0===l&&(l=wle?vle:(wle=1,vle=function(){throw new Error("Readable.from is not available in the browser")})),l(E,e,t)}),Ele}var Cle=Nle,Ile=Gce.codes,Ale=Ile.ERR_METHOD_NOT_IMPLEMENTED,Ple=Ile.ERR_MULTIPLE_CALLBACK,Mle=Ile.ERR_TRANSFORM_ALREADY_TRANSFORMING,Ole=Ile.ERR_TRANSFORM_WITH_LENGTH_0,Tle=cle();function Rle(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new Ple);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Nle(e){if(!(this instanceof Nle))return new Nle(e);Tle.call(this,e),this._transformState={afterTransform:Rle.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",Lle)}function Lle(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?Ble(this,null,null):this._flush(function(t,n){Ble(e,t,n)})}function Ble(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Ole;if(e._transformState.transforming)throw new Mle;return e.push(null)}ole(Nle,Tle),Nle.prototype.push=function(e,t){return this._transformState.needTransform=!1,Tle.prototype.push.call(this,e,t)},Nle.prototype._transform=function(e,t,n){n(new Ale("_transform()"))},Nle.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Nle.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},Nle.prototype._destroy=function(e,t){Tle.prototype._destroy.call(this,e,function(e){t(e)})};var jle,Dle=Fle,Ule=Cle;function Fle(e){if(!(this instanceof Fle))return new Fle(e);Ule.call(this,e)}ole(Fle,Ule),Fle.prototype._transform=function(e,t,n){n(null,e)};var $le=Gce.codes,zle=$le.ERR_MISSING_ARGS,Hle=$le.ERR_STREAM_DESTROYED;function qle(e){if(e)throw e}function Wle(e){e()}function Kle(e,t){return e.pipe(t)}var Gle,Vle=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i,o=(i=t).length?"function"!=typeof i[i.length-1]?qle:i.pop():qle;if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new zle("streams");var s=t.map(function(e,n){var i=n<t.length-1;return function(e,t,n,r){r=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(r);var i=!1;e.on("close",function(){i=!0}),void 0===jle&&(jle=xle),jle(e,{readable:t,writable:n},function(e){if(e)return r(e);i=!0,r()});var o=!1;return function(t){if(!i&&!o)return o=!0,(n=e).setHeader&&"function"==typeof n.abort?e.abort():"function"==typeof e.destroy?e.destroy():void r(t||new Hle("pipe"));var n}}(e,i,n>0,function(e){r||(r=e),e&&s.forEach(Wle),i||(s.forEach(Wle),o(r))})});return t.reduce(Kle)};Gle=Jae.exports,(Gle=Jae.exports=Sle()).Stream=Gle,Gle.Readable=Gle,Gle.Writable=ale(),Gle.Duplex=cle(),Gle.Transform=Cle,Gle.PassThrough=Dle,Gle.finished=xle,Gle.pipeline=Vle;var Zle=Jae.exports;var Yle={},Jle={exports:{}},Qle=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach(function(e){r[e]=t[e]}),r;function r(){for(var e=new Array(arguments.length),n=0;n<e.length;n++)e[n]=arguments[n];var r=t.apply(this,e),i=e[e.length-1];return"function"==typeof r&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}};function Xle(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function eue(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}Jle.exports=Qle(Xle),Jle.exports.strict=Qle(eue),Xle.proto=Xle(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Xle(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return eue(this)},configurable:!0})});var tue=Jle.exports,nue={};Object.defineProperty(nue,"__esModule",{value:!0}),nue.Substream=void 0;const rue=Zle;class iue extends rue.Duplex{constructor({parent:e,name:t}){super({objectMode:!0}),this._parent=e,this._name=t}_read(){}_write(e,t,n){this._parent.push({name:this._name,data:e}),n()}}nue.Substream=iue;var oue=d9&&d9.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Yle,"__esModule",{value:!0}),Yle.ObjectMultiplex=void 0;const sue=Zle,aue=oue(tue),cue=nue,lue=Symbol("IGNORE_SUBSTREAM");let uue=class extends sue.Duplex{constructor(e={}){super(Object.assign(Object.assign({},e),{objectMode:!0})),this._substreams={}}createStream(e){if(this.destroyed)throw new Error(`ObjectMultiplex - parent stream for name "${e}" already destroyed`);if(this._readableState.ended||this._writableState.ended)throw new Error(`ObjectMultiplex - parent stream for name "${e}" already ended`);if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);const t=new cue.Substream({parent:this,name:e});return this._substreams[e]=t,function(e){const n=(0,aue.default)(e=>t.destroy(e||void 0));(0,sue.finished)(e,{readable:!1},n),(0,sue.finished)(e,{writable:!1},n)}(this),t}ignoreStream(e){if(!e)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[e])throw new Error(`ObjectMultiplex - Substream for name "${e}" already exists`);this._substreams[e]=lue}_read(){}_write(e,t,n){const{name:r,data:i}=e;if(!r)return console.warn(`ObjectMultiplex - malformed chunk without name "${e}"`),n();const o=this._substreams[r];return o?(o!==lue&&o.push(i),n()):(console.warn(`ObjectMultiplex - orphaned data for stream "${r}"`),n())}};Yle.ObjectMultiplex=uue;var due=h9(Yle.ObjectMultiplex);const hue=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;hue.writable=e=>hue(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,hue.readable=e=>hue(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,hue.duplex=e=>hue.writable(e)&&hue.readable(e),hue.transform=e=>hue.duplex(e)&&"function"==typeof e._transform;var fue,pue=hue,mue=class extends Yae{constructor(e,{jsonRpcStreamName:t,logger:n=console,maxEventListeners:r=100,rpcMiddleware:i=[]}){if(super({logger:n,maxEventListeners:r,rpcMiddleware:i}),!pue.duplex(e))throw new Error(toe.errors.invalidDuplexStream());this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this);const o=new due;Zle.pipeline(e,o,e,this._handleStreamDisconnect.bind(this,"MetaMask")),this._jsonRpcConnection=function(e={}){const t={},n=new Zle.Duplex({objectMode:!0,read:()=>{},write:function(n,o,s){let a=null;try{n.id?function(e){const{id:n}=e;if(null===n)return;const r=t[n];r?(delete t[n],Object.assign(r.res,e),setTimeout(r.end)):console.warn(`StreamMiddleware - Unknown response id "${n}"`)}(n):(c=n,(null==e?void 0:e.retryOnMessage)&&c.method===e.retryOnMessage&&Object.values(t).forEach(({req:e,retryCount:n=0})=>{if(!e.id)return;if(n>=3)throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${e.id}"`);const r=t[e.id];r&&(r.retryCount=n+1),i(e)}),r.emit("notification",c))}catch(l){a=l}var c;s(a)}}),r=new kae;return{events:r,middleware:(e,n,r,o)=>{t[e.id]={req:e,res:n,next:r,end:o},i(e)},stream:n};function i(e){n.push(e)}}({retryOnMessage:"METAMASK_EXTENSION_CONNECT_CAN_RETRY"}),Zle.pipeline(this._jsonRpcConnection.stream,o.createStream(t),this._jsonRpcConnection.stream,this._handleStreamDisconnect.bind(this,"MetaMask RpcProvider")),this._rpcEngine.push(this._jsonRpcConnection.middleware),this._jsonRpcConnection.events.on("notification",t=>{const{method:n,params:r}=t;"metamask_accountsChanged"===n?this._handleAccountsChanged(r):"metamask_unlockStateChanged"===n?this._handleUnlockStateChanged(r):"metamask_chainChanged"===n?this._handleChainChanged(r):Aae.includes(n)?this.emit("message",{type:n,data:r}):"METAMASK_STREAM_FAILURE"===n&&e.destroy(new Error(toe.errors.permanentlyDisconnected()))})}async _initializeStateAsync(){let e;try{e=await this.request({method:"metamask_getProviderState"})}catch(t){this._log.error("MetaMask: Failed to get initial state. Please report this bug.",t)}this._initializeState(e)}_handleStreamDisconnect(e,t){let n=`MetaMask: Lost connection to "${e}".`;(null==t?void 0:t.stack)&&(n+=`\n${t.stack}`),this._log.warn(n),this.listenerCount("error")>0&&this.emit("error",n),this._handleDisconnect(!1,t?t.message:void 0)}_handleChainChanged({chainId:e,networkVersion:t}={}){var n;Tae(e)&&(n=t,Boolean(n)&&"string"==typeof n)?"loading"===t?this._handleDisconnect(!0):super._handleChainChanged({chainId:e}):this._log.error(toe.errors.invalidNetworkParams(),{chainId:e,networkVersion:t})}},gue=class extends mue{constructor(e,{jsonRpcStreamName:t="metamask-provider",logger:n=console,maxEventListeners:r=100,shouldSendMetadata:i}={}){if(super(e,{jsonRpcStreamName:t,logger:n,maxEventListeners:r,rpcMiddleware:Pae(n)}),this._sentWarnings={chainId:!1,networkVersion:!1,selectedAddress:!1,enable:!1,experimentalMethods:!1,send:!1,events:{close:!1,data:!1,networkChanged:!1,notification:!1}},Fae(this,fue,void 0),this._initializeStateAsync(),$ae(this,fue,null),this.isMetaMask=!0,this._sendSync=this._sendSync.bind(this),this.enable=this.enable.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this._warnOfDeprecation=this._warnOfDeprecation.bind(this),this._metamask=this._getExperimentalApi(),this._jsonRpcConnection.events.on("notification",e=>{const{method:t}=e;Aae.includes(t)&&(this.emit("data",e),this.emit("notification",e.params.result))}),i)if("complete"===document.readyState)Nae(this._rpcEngine,this._log);else{const e=()=>{Nae(this._rpcEngine,this._log),window.removeEventListener("DOMContentLoaded",e)};window.addEventListener("DOMContentLoaded",e)}}get chainId(){return this._sentWarnings.chainId||(this._log.warn(toe.warnings.chainIdDeprecation),this._sentWarnings.chainId=!0),super.chainId}get networkVersion(){return this._sentWarnings.networkVersion||(this._log.warn(toe.warnings.networkVersionDeprecation),this._sentWarnings.networkVersion=!0),Uae(this,fue)}get selectedAddress(){return this._sentWarnings.selectedAddress||(this._log.warn(toe.warnings.selectedAddressDeprecation),this._sentWarnings.selectedAddress=!0),super.selectedAddress}sendAsync(e,t){this._rpcRequest(e,t)}addListener(e,t){return this._warnOfDeprecation(e),super.addListener(e,t)}on(e,t){return this._warnOfDeprecation(e),super.on(e,t)}once(e,t){return this._warnOfDeprecation(e),super.once(e,t)}prependListener(e,t){return this._warnOfDeprecation(e),super.prependListener(e,t)}prependOnceListener(e,t){return this._warnOfDeprecation(e),super.prependOnceListener(e,t)}_handleDisconnect(e,t){super._handleDisconnect(e,t),Uae(this,fue)&&!e&&$ae(this,fue,null)}_warnOfDeprecation(e){var t;!1===(null==(t=this._sentWarnings)?void 0:t.events[e])&&(this._log.warn(toe.warnings.events[e]),this._sentWarnings.events[e]=!0)}async enable(){return this._sentWarnings.enable||(this._log.warn(toe.warnings.enableDeprecation),this._sentWarnings.enable=!0),new Promise((e,t)=>{try{this._rpcRequest({method:"eth_requestAccounts",params:[]},Oae(e,t))}catch(n){t(n)}})}send(e,t){return this._sentWarnings.send||(this._log.warn(toe.warnings.sendDeprecation),this._sentWarnings.send=!0),"string"!=typeof e||t&&!Array.isArray(t)?e&&"object"==typeof e&&"function"==typeof t?this._rpcRequest(e,t):this._sendSync(e):new Promise((n,r)=>{try{this._rpcRequest({method:e,params:t},Oae(n,r,!1))}catch(i){r(i)}})}_sendSync(e){let t;switch(e.method){case"eth_accounts":t=this.selectedAddress?[this.selectedAddress]:[];break;case"eth_coinbase":t=this.selectedAddress??null;break;case"eth_uninstallFilter":this._rpcRequest(e,Rae),t=!0;break;case"net_version":t=Uae(this,fue)??null;break;default:throw new Error(toe.errors.unsupportedSync(e.method))}return{id:e.id,jsonrpc:e.jsonrpc,result:t}}_getExperimentalApi(){return new Proxy({isUnlocked:async()=>(this._state.initialized||await new Promise(e=>{this.on("_initialized",()=>e())}),this._state.isUnlocked),requestBatch:async e=>{if(!Array.isArray(e))throw Kse({message:"Batch requests must be made with an array of request objects.",data:e});return new Promise((t,n)=>{this._rpcRequest(e,Oae(t,n))})}},{get:(e,t,...n)=>(this._sentWarnings.experimentalMethods||(this._log.warn(toe.warnings.experimentalMethods),this._sentWarnings.experimentalMethods=!0),Reflect.get(e,t,...n))})}_handleChainChanged({chainId:e,networkVersion:t}={}){super._handleChainChanged({chainId:e,networkVersion:t}),this._state.isConnected&&t!==Uae(this,fue)&&($ae(this,fue,t),this._state.initialized&&this.emit("networkChanged",Uae(this,fue)))}};fue=new WeakMap;const yue=f1("MM_SDK");yue.color="#FFAC1C";var bue={},vue={};Object.defineProperty(vue,"__esModule",{value:!0}),vue.EthereumProviderError=vue.EthereumRpcError=void 0;const wue=Mse;class Eue extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return wue.default(this.serialize(),_ue,2)}}function _ue(e,t){if("[Circular]"!==t)return t}vue.EthereumRpcError=Eue,vue.EthereumProviderError=class extends Eue{constructor(e,t,n){if(r=e,!(Number.isInteger(r)&&r>=1e3&&r<=4999))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');var r;super(e,t,n)}};var xue={},kue={};Object.defineProperty(kue,"__esModule",{value:!0}),kue.errorValues=kue.errorCodes=void 0,kue.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}},kue.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=kue,n=vue,r=t.errorCodes.rpc.internal,i={code:r,message:o(r)};function o(n,r="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(n)){const r=n.toString();if(l(t.errorValues,r))return t.errorValues[r].message;if(a(n))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return r}function s(e){if(!Number.isInteger(e))return!1;const n=e.toString();return!!t.errorValues[n]||!!a(e)}function a(e){return e>=-32099&&e<=-32e3}function c(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function l(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=o,e.isValidCode=s,e.serializeError=function(e,{fallbackError:t=i,shouldIncludeStack:r=!1}={}){var a,u;if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw new Error("Must provide fallback error with integer number code and string message.");if(e instanceof n.EthereumRpcError)return e.serialize();const d={};if(e&&"object"==typeof e&&!Array.isArray(e)&&l(e,"code")&&s(e.code)){const t=e;d.code=t.code,t.message&&"string"==typeof t.message?(d.message=t.message,l(t,"data")&&(d.data=t.data)):(d.message=o(d.code),d.data={originalError:c(e)})}else{d.code=t.code;const n=null===(a=e)||void 0===a?void 0:a.message;d.message=n&&"string"==typeof n?n:t.message,d.data={originalError:c(e)}}const h=null===(u=e)||void 0===u?void 0:u.stack;return r&&e&&h&&"string"==typeof h&&(d.stack=h),d}}(xue);var Sue={};Object.defineProperty(Sue,"__esModule",{value:!0}),Sue.ethErrors=void 0;const Cue=vue,Iue=xue,Aue=kue;function Pue(e,t){const[n,r]=Oue(t);return new Cue.EthereumRpcError(e,n||Iue.getMessageFromCode(e),r)}function Mue(e,t){const[n,r]=Oue(t);return new Cue.EthereumProviderError(e,n||Iue.getMessageFromCode(e),r)}function Oue(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}Sue.ethErrors={rpc:{parse:e=>Pue(Aue.errorCodes.rpc.parse,e),invalidRequest:e=>Pue(Aue.errorCodes.rpc.invalidRequest,e),invalidParams:e=>Pue(Aue.errorCodes.rpc.invalidParams,e),methodNotFound:e=>Pue(Aue.errorCodes.rpc.methodNotFound,e),internal:e=>Pue(Aue.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Pue(t,e)},invalidInput:e=>Pue(Aue.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>Pue(Aue.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>Pue(Aue.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>Pue(Aue.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>Pue(Aue.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>Pue(Aue.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Mue(Aue.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>Mue(Aue.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>Mue(Aue.errorCodes.provider.unsupportedMethod,e),disconnected:e=>Mue(Aue.errorCodes.provider.disconnected,e),chainDisconnected:e=>Mue(Aue.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw new Error('"message" must be a nonempty string');return new Cue.EthereumProviderError(t,n,r)}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=vue;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const n=xue;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=Sue;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const i=kue;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})}(bue);var Tue={exports:{}};Tue.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=n(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,r){void 0===r&&(r=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(i,o),a=0,c=e.map([t,n],function(t){var n=s-e.getVersionPrecision(t),r=t+new Array(n+1).join(".0");return e.map(r.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});for(r&&(a=s-Math.min(i,o)),s-=1;s>=a;){if(c[0][s]>c[1][s])return 1;if(c[0][s]===c[1][s]){if(s===a)return 0;s-=1}else if(c[0][s]<c[1][s])return-1}},e.map=function(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)r.push(t(e[n]));return r},e.find=function(e,t){var n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){var i=e[n];if(t(i,n))return i}},e.assign=function(e){for(var t,n,r=e,i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach(function(t){r[t]=e[t]})};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return r.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return r.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,n){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(91))&&r.__esModule?r:{default:r},o=n(18);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(){}var t,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],null&&s(t.prototype,null),n&&s(t,n),e}();t.default=a,e.exports=t.default},91:function(e,t,n){t.__esModule=!0,t.default=void 0;var r=c(n(92)),i=c(n(93)),o=c(n(94)),s=c(n(95)),a=c(n(17));function c(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(r.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(i.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some(function(t){return e.test(t)});throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},r=0,i={},o=0;if(Object.keys(e).forEach(function(t){var s=e[t];"string"==typeof s?(i[t]=s,o+=1):"object"==typeof s&&(n[t]=s,r+=1)}),r>0){var s=Object.keys(n),c=a.default.find(s,function(e){return t.isOS(e)});if(c){var l=this.satisfies(n[c]);if(void 0!==l)return l}var u=a.default.find(s,function(e){return t.isPlatform(e)});if(u){var d=this.satisfies(n[u]);if(void 0!==d)return d}}if(o>0){var h=Object.keys(i),f=a.default.find(h,function(e){return t.isBrowser(e,!0)});if(void 0!==f)return this.compareVersion(i[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),r=e.toLowerCase(),i=a.default.getBrowserTypeByAlias(r);return t&&i&&(r=i.toLowerCase()),r===n},t.compareVersion=function(e){var t=[0],n=e,r=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(i,n,r))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e)})},e}();t.default=l,e.exports=t.default},92:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=i.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=i.default.getMacOSVersionName(t),r={name:o.OS_MAP.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=i.default.getAndroidVersionName(t),r={name:o.OS_MAP.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){t.__esModule=!0,t.default=void 0;var r,i=(r=n(17))&&r.__esModule?r:{default:r},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}});var Rue=h9(Tue.exports);const Nue={Initialized:"initialized",DisplayURI:"display_uri",ProviderUpdate:"provider_update",ConnectWithResponse:"connectWithResponse",ConnectionStatus:"connection_status",ServiceStatus:"service_status"};class Lue{constructor({shouldSetOnWindow:e,connectionStream:t,shouldSendMetadata:n=!1,shouldShimWeb3:r,sdkInstance:i}){const o=new Due({connectionStream:t,shouldSendMetadata:n,shouldSetOnWindow:e,shouldShimWeb3:r,autoRequestAccounts:!1}),s=new Proxy(o,{deleteProperty:()=>!0});if(this.provider=s,this.sdkInstance=i,e&&"undefined"!=typeof window)try{a=o,window.ethereum=a,window.dispatchEvent(new Event("ethereum#initialized"))}catch(c){yue("[Ethereum] Unable to set global provider - window.ethereum may be read-only",c)}var a;if(r&&"undefined"!=typeof window)try{!function(e,t=console){let n=!1,r=!1;if(!window.web3){const i="__isMetaMaskShim__";let o={currentProvider:e};Object.defineProperty(o,i,{value:!0,enumerable:!0,configurable:!1,writable:!1}),o=new Proxy(o,{get:(o,s,...a)=>("currentProvider"!==s||n?"currentProvider"===s||s===i||r||(r=!0,t.error("MetaMask no longer injects web3. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),e.request({method:"metamask_logWeb3ShimUsage"}).catch(e=>{t.debug("MetaMask: Failed to log web3 shim usage.",e)})):(n=!0,t.warn("You are accessing the MetaMask window.web3.currentProvider shim. This property is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3")),Reflect.get(o,s,...a)),set:(...e)=>(t.warn("You are accessing the MetaMask window.web3 shim. This object is deprecated; use window.ethereum instead. For details, see: https://docs.metamask.io/guide/provider-migration.html#replacing-window-web3"),Reflect.set(...e))}),Object.defineProperty(window,"web3",{value:o,enumerable:!1,configurable:!0,writable:!0})}}(this.provider)}catch(c){yue("[Ethereum] Unable to shim web3 - window.web3 may be read-only",c)}this.provider.on("display_uri",e=>{this.sdkInstance.emit(Nue.DisplayURI,e)}),this.provider.on("_initialized",()=>{const e={chainId:this.provider.getChainId(),isConnected:this.provider.isConnected(),isMetaMask:this.provider.isMetaMask,selectedAddress:this.provider.getSelectedAddress(),networkVersion:this.provider.getNetworkVersion()};this.sdkInstance.emit(Nue.Initialized,e),yue("[Ethereum: constructor()] provider initialized",e)})}static init(e){var t;return yue("[Ethereum: init()] Initializing Ethereum service"),this.instance=new Lue(e),null===(t=this.instance)||void 0===t?void 0:t.provider}static destroy(){}static getInstance(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance}static getProvider(){var e;if(!(null===(e=this.instance)||void 0===e?void 0:e.provider))throw new Error("Ethereum instance not intiialized - call Ethereum.factory first.");return this.instance.provider}}class Bue{constructor({useDeepLink:e,preferredOpenLink:t,debug:n=!1}){this.state={platformType:void 0,useDeeplink:!1,preferredOpenLink:void 0,debug:!1},this.state.platformType=this.getPlatformType(),this.state.useDeeplink=e,this.state.preferredOpenLink=t,this.state.debug=n}openDeeplink(e,t,n){return function(e,t,n,r){const{state:i}=e;yue(`[PlatfformManager: openDeeplink()] universalLink --\x3e ${t}`),yue(`[PlatfformManager: openDeeplink()] deepLink --\x3e ${n}`);try{if(i.preferredOpenLink)return void i.preferredOpenLink(i.useDeeplink?n:t,r);if(yue(`[PlatfformManager: openDeeplink()] open link now useDeepLink=${i.useDeeplink} link=${i.useDeeplink?n:t}`),i.useDeeplink)"undefined"!=typeof window&&(window.location.href=n);else if("undefined"!=typeof document){const e=document.createElement("a");e.href=t,e.target="_self",e.rel="noreferrer noopener",e.click()}}catch(o){}}(this,e,t,n)}isReactNative(){var e;return this.isNotBrowser()&&"undefined"!=typeof window&&(null===window||void 0===window?void 0:window.navigator)&&"ReactNative"===(null===(e=window.navigator)||void 0===e?void 0:e.product)}isMetaMaskInstalled(){return function(){const e=Lue.getProvider()||(null===window||void 0===window?void 0:window.ethereum);return yue(`[PlatfformManager: isMetaMaskInstalled()] isMetaMask=${null==e?void 0:e.isMetaMask} isConnected=${null==e?void 0:e.isConnected()}`),(null==e?void 0:e.isMetaMask)&&(null==e?void 0:e.isConnected())}()}isDesktopWeb(){return this.isBrowser()&&!this.isMobileWeb()}isMobile(){var e,t;const n=Rue.parse(window.navigator.userAgent);return"mobile"===(null===(e=null==n?void 0:n.platform)||void 0===e?void 0:e.type)||"tablet"===(null===(t=null==n?void 0:n.platform)||void 0===t?void 0:t.type)}isSecure(){return this.isReactNative()||this.isMobileWeb()}isMetaMaskMobileWebView(){return"undefined"!=typeof window&&Boolean(window.ReactNativeWebView)&&Boolean(navigator.userAgent.endsWith("MetaMaskMobile"))}isMobileWeb(){return this.state.platformType===Die.MobileWeb}static isNotBrowser(){var e;return"undefined"==typeof window||!(null===window||void 0===window?void 0:window.navigator)||void 0!==u7&&"ReactNative"===(null===(e=null==u7?void 0:u7.navigator)||void 0===e?void 0:e.product)||"ReactNative"===(null===navigator||void 0===navigator?void 0:navigator.product)}isNotBrowser(){return Bue.isNotBrowser()}static isBrowser(){return!this.isNotBrowser()}isBrowser(){return Bue.isBrowser()}isNodeJS(){return this.isNotBrowser()&&!this.isReactNative()}isUseDeepLink(){return this.state.useDeeplink}getPlatformType(){return function(e){const{state:t}=e;return t.platformType?t.platformType:e.isReactNative()?Die.ReactNative:e.isNotBrowser()?Die.NonBrowser:e.isMetaMaskMobileWebView()?Die.MetaMaskMobileWebview:e.isMobile()?Die.MobileWeb:Die.DesktopWeb}(this)}}const jue=e=>l7(void 0,void 0,void 0,function*(){if(Bue.isBrowser()){const{StorageManagerWeb:t}=yield Promise.resolve().then(function(){return jde});return new t(e)}const t={persistChannelConfig:()=>l7(void 0,void 0,void 0,function*(){}),getPersistedChannelConfig:()=>l7(void 0,void 0,void 0,function*(){}),persistAccounts:()=>l7(void 0,void 0,void 0,function*(){}),getCachedAccounts:()=>l7(void 0,void 0,void 0,function*(){return[]}),persistChainId:()=>l7(void 0,void 0,void 0,function*(){}),getCachedChainId:()=>l7(void 0,void 0,void 0,function*(){}),terminate:()=>l7(void 0,void 0,void 0,function*(){})};return Promise.resolve(t)});class Due extends gue{constructor({connectionStream:e,shouldSendMetadata:t,autoRequestAccounts:n=!1}){super(e,{logger:console,maxEventListeners:100,shouldSendMetadata:t}),this.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:"",networkVersion:""},yue(`[SDKProvider: constructor()] autoRequestAccounts=${n}`),this.state.autoRequestAccounts=n}forceInitializeState(){return l7(this,void 0,void 0,function*(){return yue(`[SDKProvider: forceInitializeState()] autoRequestAccounts=${this.state.autoRequestAccounts}`),this._initializeStateAsync()})}_setConnected(){yue("[SDKProvider: _setConnected()] Setting connected state"),this._state.isConnected=!0}getState(){return this._state}getSDKProviderState(){return this.state}getSelectedAddress(){var e;const{accounts:t}=this._state;return t&&0!==t.length?(null===(e=t[0])||void 0===e?void 0:e.toLowerCase())||"":(yue("[SDKProvider: getSelectedAddress] No accounts found"),null)}getChainId(){return this.state.chainId}getNetworkVersion(){return this.state.networkVersion}setSDKProviderState(e){this.state=Object.assign(Object.assign({},this.state),e)}handleAccountsChanged(e,t){return this._handleAccountsChanged(e,t)}handleDisconnect({terminate:e=!1}){!function({terminate:e=!1,instance:t}){const{state:n}=t;yue(`[SDKProvider: handleDisconnect()] cleaning up provider state terminate=${e}`,t),e&&(t._state.accounts=null,t._state.isUnlocked=!1,t._state.isPermanentlyDisconnected=!0,t._state.initialized=!1),t._handleAccountsChanged([]),t._state.isConnected=!1,t.emit("disconnect",bue.ethErrors.provider.disconnected()),n.providerStateRequested=!1}({terminate:e,instance:this})}_initializeStateAsync(){return l7(this,void 0,void 0,function*(){return function(e){var t,n;return l7(this,void 0,void 0,function*(){void 0===e.state&&(e.state={accounts:null,autoRequestAccounts:!1,providerStateRequested:!1,chainId:""});const{state:r}=e;let i;if(r.providerStateRequested)yue("[SDKProvider: initializeStateAsync()] initialization already in progress");else{let s;r.providerStateRequested=!0;let a=null,c=!1,l=!1;const u=yield jue({enabled:!0});if(u){const e=yield u.getPersistedChannelConfig({});c=null!==(t=null==e?void 0:e.relayPersistence)&&void 0!==t&&t,s=yield u.getCachedChainId();const n=yield u.getCachedAccounts();n.length>0&&(a=n[0])}if(yue(`[SDKProvider: initializeStateAsync()] relayPersistence=${c}`,{relayPersistence:c,cachedChainId:s,cachedSelectedAddress:a}),c)if(s&&a)i={accounts:[a],chainId:s,isUnlocked:!1},l=!0;else try{i=yield e.request({method:"metamask_getProviderState"})}catch(o){return e._log.error("MetaMask: Failed to get initial state. Please report this bug.",o),void(r.providerStateRequested=!1)}if(0===(null===(n=null==i?void 0:i.accounts)||void 0===n?void 0:n.length))if(e.getSelectedAddress())i.accounts=[e.getSelectedAddress()];else{yue("[SDKProvider: initializeStateAsync()] Fetch accounts remotely.");const t=yield e.request({method:"eth_requestAccounts",params:[]});i.accounts=t}e._initializeState(i),r.providerStateRequested=!1,l&&(e._state.isConnected=!0,e.emit("connect",{chainId:null==i?void 0:i.chainId}))}})}(this)})}_initializeState(e){return yue("[SDKProvider: _initializeState()]",e),function(e,t,n){return yue("[SDKProvider: initializeState()] set state._initialized to false"),e._state.initialized=!1,t(n)}(this,super._initializeState.bind(this),e)}_handleChainChanged({chainId:e,networkVersion:t}={}){this.state.chainId=e,this.state.networkVersion=t,function({instance:e,chainId:t,networkVersion:n,superHandleChainChanged:r}){yue(`[SDKProvider: handleChainChanged()] chainId=${t} networkVersion=${n}`);let i=n;n||(yue("[SDKProvider: handleChainChanged()] forced network version to prevent provider error"),i="1"),e._state.isConnected=!0,e.emit("connect",{chainId:t}),r({chainId:t,networkVersion:i})}({instance:this,chainId:e,networkVersion:t,superHandleChainChanged:super._handleChainChanged.bind(this)})}}var Uue,Fue="0.32.0";!function(e){e.INPAGE="metamask-inpage",e.CONTENT_SCRIPT="metamask-contentscript",e.PROVIDER="metamask-provider"}(Uue||(Uue={}));const $ue="direct",zue="https://metamask.app.link/connect",Hue="metamask://connect",que={NAME:"MetaMask",RDNS:["io.metamask","io.metamask.flask"]},Wue=/(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,Kue={METAMASK_GETPROVIDERSTATE:"metamask_getProviderState",METAMASK_CONNECTSIGN:"metamask_connectSign",METAMASK_CONNECTWITH:"metamask_connectWith",METAMASK_OPEN:"metamask_open",METAMASK_BATCH:"metamask_batch",PERSONAL_SIGN:"personal_sign",WALLET_REQUESTPERMISSIONS:"wallet_requestPermissions",WALLET_REVOKEPERMISSIONS:"wallet_revokePermissions",WALLET_GETPERMISSIONS:"wallet_getPermissions",WALLET_WATCHASSET:"wallet_watchAsset",WALLET_ADDETHEREUMCHAIN:"wallet_addEthereumChain",WALLET_SWITCHETHETHEREUMCHAIN:"wallet_switchEthereumChain",ETH_REQUESTACCOUNTS:"eth_requestAccounts",ETH_ACCOUNTS:"eth_accounts",ETH_CHAINID:"eth_chainId",ETH_SENDTRANSACTION:"eth_sendTransaction",ETH_SIGNTYPEDDATA:"eth_signTypedData",ETH_SIGNTYPEDDATA_V3:"eth_signTypedData_v3",ETH_SIGNTYPEDDATA_V4:"eth_signTypedData_v4",ETH_SIGNTRANSACTION:"eth_signTransaction",ETH_SIGN:"eth_sign",PERSONAL_EC_RECOVER:"personal_ecRecover"},Gue={[Kue.ETH_REQUESTACCOUNTS]:!0,[Kue.ETH_SENDTRANSACTION]:!0,[Kue.ETH_SIGNTRANSACTION]:!0,[Kue.ETH_SIGN]:!0,[Kue.PERSONAL_SIGN]:!0,[Kue.ETH_ACCOUNTS]:!1,[Kue.ETH_CHAINID]:!1,[Kue.PERSONAL_SIGN]:!0,[Kue.ETH_SIGNTYPEDDATA]:!0,[Kue.ETH_SIGNTYPEDDATA_V3]:!0,[Kue.ETH_SIGNTYPEDDATA_V4]:!0,[Kue.WALLET_REQUESTPERMISSIONS]:!0,[Kue.WALLET_GETPERMISSIONS]:!0,[Kue.WALLET_WATCHASSET]:!0,[Kue.WALLET_ADDETHEREUMCHAIN]:!0,[Kue.WALLET_SWITCHETHETHEREUMCHAIN]:!0,[Kue.METAMASK_CONNECTSIGN]:!0,[Kue.METAMASK_CONNECTWITH]:!0,[Kue.PERSONAL_EC_RECOVER]:!0,[Kue.METAMASK_BATCH]:!0,[Kue.METAMASK_OPEN]:!0},Vue=Object.keys(Gue).map(e=>e.toLowerCase()),Zue=["eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sign"].map(e=>e.toLowerCase()),Yue=".sdk-comm",Jue="providerType",Que=".MMSDK_cached_address",Xue=".MMSDK_cached_chainId",ede="chainChanged",tde="accountsChanged",nde="disconnect",rde="connect",ide="connected";var ode;!function(e){e.TERMINATE="terminate",e.EXTENSION="extension",e.INITIALIZED="initialized"}(ode||(ode={}));const sde="undefined"!=typeof window&&window.localStorage;function ade(e){var t,n;return l7(this,void 0,void 0,function*(){yue("[MetaMaskSDK: connectWithExtensionProvider()] ",e),e.sdkProvider=e.activeProvider,e.activeProvider=window.extension,window.ethereum=window.extension;try{const e=yield null===(t=window.extension)||void 0===t?void 0:t.request({method:"eth_requestAccounts"});yue(`[MetaMaskSDK: connectWithExtensionProvider()] accounts=${e}`)}catch(r){return void console.warn("[MetaMaskSDK: connectWithExtensionProvider()] can't request accounts error",r)}localStorage.setItem(Jue,"extension"),e.extensionActive=!0,e.emit(Nue.ProviderUpdate,ode.EXTENSION),e.options.enableAnalytics&&(null===(n=e.analytics)||void 0===n||n.send({event:_ie.SDK_USE_EXTENSION}))})}function cde(e){let t;if(void 0!==S7)t=S7.from(e,"utf8").toString("base64");else if("function"==typeof btoa)t=btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/gu,(e,t)=>String.fromCharCode(parseInt(t,16))));else{if("object"!=typeof u7||!("Buffer"in u7))throw new Error("Unable to base64 encode: No available method.");t=u7.Buffer.from(e,"utf8").toString("base64")}return t}class lde extends Zle.Duplex{constructor({name:e,remote:t,deeplinkProtocol:n,platformManager:r}){super({objectMode:!0}),this.state={_name:null,remote:null,deeplinkProtocol:!1,platformManager:null},this.state._name=e,this.state.remote=t,this.state.deeplinkProtocol=n,this.state.platformManager=r,this._onMessage=this._onMessage.bind(this),this.state.remote.on(bie.MESSAGE,this._onMessage)}_write(e,t,n){return l7(this,void 0,void 0,function*(){return function(e,t,n,r){var i,o,s,a,c,l,u,d,h,f,p,m,g,y,b,v,w,E,_,x;return l7(this,void 0,void 0,function*(){const n=null===(i=e.state.remote)||void 0===i?void 0:i.isReady(),k=null===(o=e.state.remote)||void 0===o?void 0:o.isConnected(),S=null===(s=e.state.remote)||void 0===s?void 0:s.isPaused(),C=Lue.getProvider(),I=null===(a=e.state.remote)||void 0===a?void 0:a.getChannelId(),A=null===(c=e.state.remote)||void 0===c?void 0:c.isAuthorized(),{deeplinkProtocol:P}=e.state,{method:M,data:O,triggeredInstaller:T}=(e=>{var t,n,r,i;let o;S7.isBuffer(e)?(o=e.toJSON(),o._isBuffer=!0):o=e;const s=null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.method;let a=!1;return"object"==typeof(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.params)&&!0===(null===(i=null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.params)||void 0===i?void 0:i.__triggeredInstaller)&&(a=!0,o.data.params=o.data.params.wrappedParams),{method:s,data:o,triggeredInstaller:a}})(t);if(yue(`[RCPMS: write()] method='${M}' isRemoteReady=${n} channelId=${I} isSocketConnected=${k} isRemotePaused=${S} providerConnected=${C.isConnected()}`,t),!I)return M!==Kue.METAMASK_GETPROVIDERSTATE&&yue(`[RCPMS: write()] ${M} --\x3e channelId is undefined`),r(new Error("disconnected"));yue(`[RCPMS: write()] remote.isPaused()=${null===(l=e.state.remote)||void 0===l?void 0:l.isPaused()} authorized=${A} ready=${n} socketConnected=${k}`,t);const R=null===(u=e.state.platformManager)||void 0===u?void 0:u.isSecure(),N=null!==(h=null===(d=e.state.platformManager)||void 0===d?void 0:d.isMobileWeb())&&void 0!==h&&h,L=null!==(p=null===(f=e.state.remote)||void 0===f?void 0:f.hasDeeplinkProtocol())&&void 0!==p&&p&&N&&A;try{if(!T){const t=JSON.stringify(null==O?void 0:O.data);if(t.length>1e6)return r(new Error(`Message size ${t.length} exceeds maximum allowed size of 1000000 bytes`));null===(m=e.state.remote)||void 0===m||m.sendMessage(null==O?void 0:O.data).then(()=>{yue(`[RCPMS: _write()] ${M} sent successfully`)}).catch(e=>{yue("[RCPMS: _write()] error sending message",e)})}if(!R)return yue(`[RCPMS: _write()] unsecure platform for method ${M} -- return callback`),r();if(T)return yue("[RCPMS: _write()] prevent deeplink -- installation completed separately."),r();const t=null!==(b=null===(y=null===(g=e.state.remote)||void 0===g?void 0:g.getKeyInfo())||void 0===y?void 0:y.ecies.public)&&void 0!==b?b:"";let n=encodeURI(`channelId=${I}&pubkey=${t}&comm=socket&t=d&v=2`);if(L){const t=JSON.stringify(null==O?void 0:O.data),i=null===(v=e.state.remote)||void 0===v?void 0:v.encrypt(t);if(!i)return yue("[RCPMS: _write()] error encrypting message"),r(new Error("RemoteCommunicationPostMessageStream - disconnected"));n+=`&scheme=${P}&rpc=${cde(i)}`}if(!(null===(w=e.state.platformManager)||void 0===w?void 0:w.isMetaMaskInstalled()))return yue("[RCPMS: _write()] prevent deeplink until installation is completed."),r();Gue[M]?(yue(`[RCPMS: _write()] redirect link for '${M}' socketConnected=${k} connect?${n}`),null===(E=e.state.platformManager)||void 0===E||E.openDeeplink(`${zue}?${n}`,`${Hue}?${n}`,"_self")):(null===(_=e.state.remote)||void 0===_?void 0:_.isPaused())?(yue(`[RCPMS: _write()] MM is PAUSED! deeplink with connect! targetMethod=${M}`),null===(x=e.state.platformManager)||void 0===x||x.openDeeplink(`${zue}?redirect=true&${n}`,`${Hue}?redirect=true&${n}`,"_self")):yue(`[RCPMS: _write()] method ${M} doesn't need redirect.`)}catch(B){return yue("[RCPMS: _write()] error sending message",B),r(new Error("RemoteCommunicationPostMessageStream - disconnected"))}return r()})}(this,e,0,n)})}_read(){}_onMessage(e){return function(e,t){try{if(yue("[RCPMS: onMessage()] message",t),!t||"object"!=typeof t)return;if("object"!=typeof(null==t?void 0:t.data))return;if(!(null==t?void 0:t.name))return void yue("[RCPMS: onMessage()] ignore message without name",t);if((null==t?void 0:t.name)!==Uue.PROVIDER)return void yue(`[RCPMS: onMessage()] ignore message with wrong name message=${t}`);if(S7.isBuffer(t)){const n=S7.from(t);e.push(n)}else e.push(t)}catch(n){yue(`[RCPMS: onMessage()] ignore message error err=${n}`)}}(this,e)}start(){}}let ude=1;const dde=e=>new Promise(t=>{setTimeout(()=>{t(!0)},e)});function hde(e){var t,n,r,i;return l7(this,void 0,void 0,function*(){const{options:o}=e,s={communicationLayerPreference:null!==(t=o.communicationLayerPreference)&&void 0!==t?t:jie.SOCKET,platformManager:e.platformManager,sdk:e,checkInstallationOnAllCalls:o.checkInstallationOnAllCalls,injectProvider:null===(n=o.injectProvider)||void 0===n||n,shouldShimWeb3:null===(r=o.shouldShimWeb3)||void 0===r||r,extensionOnly:null===(i=o.extensionOnly)||void 0===i||i,installer:e.installer,remoteConnection:e.remoteConnection,debug:e.debug},a=yield(({checkInstallationOnAllCalls:t=!1,communicationLayerPreference:n,injectProvider:r,shouldShimWeb3:i,platformManager:o,installer:s,sdk:a,remoteConnection:l,debug:u})=>l7(void 0,void 0,void 0,function*(){var n,d;const h=(({name:e,remoteConnection:t})=>{if(!t||!(null==t?void 0:t.getConnector()))throw new Error("Missing remote connection parameter");return new lde({name:e,remote:null==t?void 0:t.getConnector(),deeplinkProtocol:null==t?void 0:t.state.deeplinkProtocol,platformManager:null==t?void 0:t.getPlatformManager()})})({name:Uue.INPAGE,target:Uue.CONTENT_SCRIPT,remoteConnection:l}),f=o.getPlatformType(),p=a.options.dappMetadata,m=`Sdk/Javascript SdkVersion/${Fue} Platform/${f} dApp/${null!==(n=p.url)&&void 0!==n?n:p.name} dAppTitle/${p.name}`;let g=null,y=null;const b=null===(d=a.options.storage)||void 0===d?void 0:d.storageManager;if(b){try{const e=yield b.getCachedAccounts();e.length>0&&(g=e[0])}catch(e){console.error(`[initializeMobileProvider] failed to get cached addresses: ${e}`)}try{const e=yield b.getCachedChainId();e&&(y=e)}catch(e){console.error(`[initializeMobileProvider] failed to parse cached chainId: ${e}`)}}yue(`[initializeMobileProvider] cachedAccountAddress: ${g}, cachedChainId: ${y}`);const v=!(!r||f===Die.NonBrowser||f===Die.ReactNative),w=Lue.init({shouldSetOnWindow:v,connectionStream:h,shouldShimWeb3:i,sdkInstance:a});let E=!1;const _=e=>{E=e},x=()=>E,k=(n,r,i,u)=>l7(void 0,void 0,void 0,function*(){var d,h,f,p,v,w,k,S,C;const I=Lue.getProvider();if(E){I.emit("display_uri",(null==l?void 0:l.state.qrcodeLink)||""),null==l||l.showActiveModal();let e=x();for(;e;){const t=x(),n=null==l?void 0:l.isAuthorized();e=t&&!n,yue(`[initializeMobileProvider: sendRequest()] waiting for initialization to complete - initializing: ${t} authorized: ${n}`),yield dde(1e3)}return yue("[initializeMobileProvider: sendRequest()] initial method completed -- prevent installation and call provider"),i(...r)}const A=o.isMetaMaskInstalled(),P=null==l?void 0:l.isConnected();let M=null,O=null,T=null;if(M=null!==(d=I.getSelectedAddress())&&void 0!==d?d:g,T=I.getChainId()||y,M&&b&&M!==g&&b.persistAccounts([M]).catch(e=>{console.error(`[initializeMobileProvider] failed to persist account: ${e}`)}),T&&(y=T,b&&b.persistChainId(T).catch(e=>{console.error(`[initializeMobileProvider] failed to persist chainId: ${e}`)})),yue("[initializeMobileProvider: sendRequest()]",{selectedAddress:M,chainId:T}),u&&yue(`[initializeMobileProvider: sendRequest()] method=${n} ongoing=${E} selectedAddress=${M} isInstalled=${A} checkInstallationOnAllCalls=${t} socketConnected=${P}`),M&&n.toLowerCase()===Kue.ETH_ACCOUNTS.toLowerCase())return[M];if(T&&n.toLowerCase()===Kue.ETH_CHAINID.toLowerCase())return T;const R=[Kue.ETH_REQUESTACCOUNTS,Kue.WALLET_REQUESTPERMISSIONS,Kue.METAMASK_CONNECTSIGN,Kue.METAMASK_CONNECTWITH],N=!Gue[n],L=null===(h=a.options.readonlyRPCMap)||void 0===h?void 0:h[T];if(L&&N)try{const t=null===(f=null==r?void 0:r[0])||void 0===f?void 0:f.params,i=yield(({rpcEndpoint:t,method:n,sdkInfo:r,params:i})=>l7(void 0,void 0,void 0,function*(){const o=JSON.stringify({jsonrpc:"2.0",method:n,params:i,id:(ude+=1,ude)}),s={Accept:"application/json","Content-Type":"application/json"};let a;t.includes("infura")&&(s["Metamask-Sdk-Info"]=r);try{a=yield A4(t,{method:"POST",headers:s,body:o})}catch(e){throw e instanceof Error?new Error(`Failed to fetch from RPC: ${e.message}`):new Error(`Failed to fetch from RPC: ${e}`)}if(!a.ok)throw new Error(`Server responded with a status of ${a.status}`);return(yield a.json()).result}))({rpcEndpoint:L,sdkInfo:m,method:n,params:t||[]});return u&&yue(`initializeProvider::ReadOnlyRPCResponse ${i}`),i}catch(e){console.warn(`[initializeMobileProvider: sendRequest()] method=${n} readOnlyRPCRequest failed:`,e)}if((!A||A&&!P)&&n!==Kue.METAMASK_GETPROVIDERSTATE){const e=(null===(p=null==r?void 0:r[0])||void 0===p?void 0:p.params)||[];if(-1!==R.indexOf(n)||t){_(!0);const t=n===Kue.METAMASK_CONNECTWITH,o=`${Date.now()}`;try{yield s.start({wait:!1,connectWith:t?{method:n,id:o,params:e}:void 0}),yield new Promise((e,t)=>{(null==l?void 0:l.isAuthorized())&&(yue("[initializeMobileProvider: sendRequest()] already authorized"),e(!0)),null==l||l.getConnector().once(bie.AUTHORIZED,()=>{e(!0)}),a.once(bie.PROVIDER_UPDATE,e=>{yue(`[initializeMobileProvider: sendRequest()] PROVIDER_UPDATE --- remote provider request interupted type=${e}`),e===ode.EXTENSION?t(bie.PROVIDER_UPDATE):t(new Error("Connection Terminated"))})})}catch(B){if(ode.EXTENSION===B){if(yue(`[initializeMobileProvider: sendRequest()] extension provider detect: re-create ${n} on the active provider`),n.toLowerCase()===Kue.METAMASK_CONNECTSIGN.toLowerCase()){const t=yield null===(v=a.getProvider())||void 0===v?void 0:v.request({method:Kue.ETH_REQUESTACCOUNTS,params:[]});if(!t.length)throw new Error("SDK state invalid -- undefined accounts");const n=yield null===(w=a.getProvider())||void 0===w?void 0:w.request({method:Kue.PERSONAL_SIGN,params:[e[0],t[0]]});return a.emit(Nue.ConnectWithResponse,n),n}if(n.toLowerCase()===Kue.METAMASK_CONNECTWITH.toLowerCase()){const[t]=e,n=yield(({method:e,sdk:t,params:n})=>l7(void 0,void 0,void 0,function*(){var r,i,o,s;if(!t.isExtensionActive())throw new Error("SDK state invalid -- extension is not active");yue("[MetaMaskProvider: extensionConnectWithOverwrite()] Overwriting request method",e,n);const a=yield null===(r=t.getProvider())||void 0===r?void 0:r.request({method:Kue.ETH_REQUESTACCOUNTS,params:[]});if(!a.length)throw new Error("SDK state invalid -- undefined accounts");if((null==e?void 0:e.toLowerCase())===Kue.PERSONAL_SIGN.toLowerCase()){const r={method:e,params:[n[0],a[0]]};return yield null===(i=t.getProvider())||void 0===i?void 0:i.request(r)}if((null==e?void 0:e.toLowerCase())===Kue.ETH_SENDTRANSACTION.toLowerCase()){const r={method:e,params:[Object.assign(Object.assign({},n[0]),{from:a[0]})]};return yield null===(o=t.getProvider())||void 0===o?void 0:o.request(r)}return Zue.includes(e.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${e} -- not handled by the extension -- call separately`),a):yield null===(s=t.getProvider())||void 0===s?void 0:s.request({method:e,params:n})}))({method:t.method,sdk:a,params:t.params});return a.emit(Nue.ConnectWithResponse,n),n}return yue(`[initializeMobileProvider: sendRequest()] sending '${n}' on active provider`,e),yield null===(k=a.getProvider())||void 0===k?void 0:k.request({method:n,params:e})}if(B===bie.REJECTED)throw null==l||l.closeModal(),null===(S=a.getProvider())||void 0===S||S.handleDisconnect({terminate:!1}),Object.assign(new Error("User rejected connection"),{code:4001});throw yue(`[initializeMobileProvider: sendRequest()] failed to start installer: ${B}`),B}finally{_(!1)}if(n===Kue.ETH_REQUESTACCOUNTS)return O=yield new Promise(e=>{const t=setInterval(()=>{const{accounts:n}=I.getState();n&&(clearInterval(t),e(n))},100)}),yue(`[initializeMobileProvider: sendRequest()] selectedAddress: ${M} --- SKIP rpc call`),O;if(n===Kue.METAMASK_CONNECTWITH)try{let e=0;const t=5,n=({resolve:n,reject:r})=>{e+=1;const i=null==l?void 0:l.getConnector().getRPCMethodTracker(),s=null==i?void 0:i[o];return yue(`TRACKER: update method ${o}`,s),(null==s?void 0:s.result)?(yue("[initializeMobileProvider: sendRequest()] found result",s.result),a.emit(Nue.ConnectWithResponse,s.result),void n(s.result)):(null==s?void 0:s.error)?(yue("[initializeMobileProvider: sendRequest()] found error",s.error),void r(s.error)):e>=t?(yue("[initializeMobileProvider: sendRequest()] max message count reached without result"),void r(new Error("Max message count reached without result"))):void yue("[initializeMobileProvider: sendRequest()] not found yet, need to wait for next update")};let r,i;const s=yield new Promise((e,t)=>{const s=null==l?void 0:l.getConnector().getRPCMethodTracker();yue(`TRACKER: method ${o}`,s),(null==s?void 0:s[o].result)?(yue("[initializeMobileProvider: sendRequest()] found result",null==s?void 0:s[o].result),e(null==s?void 0:s[o].result)):(null==s?void 0:s[o].error)&&(yue("[initializeMobileProvider: sendRequest()] found error",null==s?void 0:s[o].error),t(null==s?void 0:s[o].error)),i=()=>n({resolve:e,reject:t}),r=null==l?void 0:l.getConnector().on(bie.RPC_UPDATE,i)});return i&&(null==r||r.off(bie.RPC_UPDATE,i)),yue("TRACKER: result",s),s}catch(c){throw yue("[initializeMobileProvider: sendRequest()] error:",c),c}return r[0]&&"object"==typeof r[0]&&(r[0].params={__triggeredInstaller:!0,wrappedParams:r[0].params}),i(...r)}if(o.isSecure()&&Gue[n])return i(...r);if(a.isExtensionActive())return yue(`[initializeMobileProvider: sendRequest()] EXTENSION active - redirect request '${n}' to it`,r,e),yield null===(C=a.getProvider())||void 0===C?void 0:C.request({method:n,params:e});throw yue(`[initializeMobileProvider: sendRequest()] method=${n} --- skip --- not connected/installed`),new Error("MetaMask is not connected/installed, please call eth_requestAccounts to connect first.")}try{const e=yield i(...r);if(yue(`[initializeMobileProvider: sendRequest()] method=${n} rpcResponse`,e),n===Kue.WALLET_REQUESTPERMISSIONS){const t=e.reduce((e,t)=>{var n;if("eth_accounts"===t.parentCapability){const r=null===(n=t.caveats.find(e=>"restrictReturnedAccounts"===e.type))||void 0===n?void 0:n.value;r&&e.push(...r)}return e},[]);yue("[initializeMobileProvider: sendRequest()] accountsToPersist:",t),t.length>0&&(I.handleAccountsChanged(t,!1),null==b||b.persistAccounts(t))}return e}catch(e){throw console.error("[initializeMobileProvider: sendRequest()] error:",e),e}}),{request:S}=w;w.request=(...e)=>l7(void 0,void 0,void 0,function*(){return k(null==e?void 0:e[0].method,e,S,u)});const{send:C}=w;return w.send=(...e)=>l7(void 0,void 0,void 0,function*(){return k(null==e?void 0:e[0],e,C,u)}),yue("[initializeMobileProvider: sendRequest()] metamaskStream.start()"),h.start(),w}))(s);var c,l,u,d,h;e.activeProvider=a,null===(u=null===(l=(c=e).remoteConnection)||void 0===l?void 0:l.getConnector())||void 0===u||u.on(Nue.ConnectionStatus,e=>{c.emit(Nue.ConnectionStatus,e)}),null===(h=null===(d=c.remoteConnection)||void 0===d?void 0:d.getConnector())||void 0===h||h.on(Nue.ServiceStatus,e=>{c.emit(Nue.ServiceStatus,e)})})}class fde{constructor({serverUrl:e,enabled:t,originatorInfo:n}){this.serverURL=die,this.serverURL=e,this.originatorInfo=n,this.enabled=null==t||t}send({event:e,params:t}){if(!this.enabled)return;const n=Object.assign(Object.assign({id:"sdk",event:e,sdkVersion:Fue},this.originatorInfo),{params:t});yue(`[Analytics: send()] event: ${e}`,n),cie(n,this.serverURL).catch(e=>{yue(`[Analytics: send()] error: ${e}`)})}}function pde(e){var t,n,r;const{dappMetadata:i}=e,o=function({url:e,name:t}){var n;const r=cde(e+t);if(!localStorage)return"";let i=null!==(n=localStorage.getItem(r))&&void 0!==n?n:"";if(!i){i=U4();try{localStorage.setItem(r,i)}catch(o){return""}}return i}({url:null!==(t=null==i?void 0:i.url)&&void 0!==t?t:"no_url",name:null!==(n=null==i?void 0:i.name)&&void 0!==n?n:"no_name"}),s=null===(r=e.platformManager)||void 0===r?void 0:r.getPlatformType(),a=s===Die.DesktopWeb,c=s===Die.MetaMaskMobileWebview;let l="N/A";return a?l="extension":c&&(l="mobile"),{id:o,from:l}}const mde=({provider:e,sdkInstance:t})=>{if("state"in e)throw new Error("INVALID EXTENSION PROVIDER");return new Proxy(e,{get:(n,r)=>"request"===r?function(e){var r,i;return l7(this,void 0,void 0,function*(){yue("[wrapExtensionProvider()] Overwriting request method",e);const{method:o,params:s}=e,a=Vue.includes(o.toLowerCase()),{id:c,from:l}=pde(t);if(a&&(null===(r=t.analytics)||void 0===r||r.send({event:_ie.SDK_RPC_REQUEST,params:{method:o,from:l,id:c}})),o===Kue.METAMASK_BATCH&&Array.isArray(s))return(({target:e,args:t,trackEvent:n,sdkInstance:r})=>l7(void 0,void 0,void 0,function*(){var i,o;if("metamask_batch"!==t.method)throw new Error("Invalid usage");const s=[],a=null!==(i=null==t?void 0:t.params)&&void 0!==i?i:[];for(const t of a){const n=yield null==e?void 0:e.request({method:t.method,params:t.params});s.push(n)}const{id:c,from:l}=pde(r);return n&&(null===(o=r.analytics)||void 0===o||o.send({event:_ie.SDK_RPC_REQUEST_DONE,params:{method:t.method,from:l,id:c}})),s}))({target:n,args:e,trackEvent:a,sdkInstance:t});if(o.toLowerCase()===Kue.METAMASK_CONNECTSIGN.toLowerCase()&&Array.isArray(s))return(({target:e,params:t})=>l7(void 0,void 0,void 0,function*(){const n=yield e.request({method:Kue.ETH_REQUESTACCOUNTS,params:[]});if(!n.length)throw new Error("SDK state invalid -- undefined accounts");return yield e.request({method:Kue.PERSONAL_SIGN,params:[t[0],n[0]]})}))({target:n,params:s});if(o.toLowerCase()===Kue.METAMASK_CONNECTWITH.toLowerCase()&&Array.isArray(s))return(({target:e,params:t})=>l7(void 0,void 0,void 0,function*(){const[n]=t,r=n.method,i=n.params,o=yield e.request({method:Kue.ETH_REQUESTACCOUNTS,params:[]});if(!o.length)throw new Error("SDK state invalid -- undefined accounts");return(null==r?void 0:r.toLowerCase())===Kue.PERSONAL_SIGN.toLowerCase()?yield e.request({method:r,params:[i[0],o[0]]}):(null==r?void 0:r.toLowerCase())===Kue.ETH_SENDTRANSACTION.toLowerCase()?yield e.request({method:r,params:[Object.assign(Object.assign({},i[0]),{from:o[0]})]}):Zue.includes(r.toLowerCase())?(console.warn(`MetaMaskSDK connectWith method=${r} -- not handled by the extension -- call separately`),o):yield e.request({method:r,params:i})}))({target:n,params:s});let u;try{return u=yield n.request(e),u}finally{a&&(null===(i=t.analytics)||void 0===i||i.send({event:_ie.SDK_RPC_REQUEST_DONE,params:{method:o,from:l,id:c}}))}})}:"getChainId"===r?function(){return e.chainId}:"getNetworkVersion"===r?function(){return e.networkVersion}:"getSelectedAddress"===r?function(){return e.selectedAddress}:"isConnected"===r?function(){return e._state.isConnected}:n[r]})};var gde;!function(e){e.Announce="eip6963:announceProvider",e.Request="eip6963:requestProvider"}(gde||(gde={}));var yde="INSTALLED",bde="NOT_INSTALLED",vde="REGISTERED",wde="REGISTERING",Ede="RELOADING",_de={CHROME:"https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",FIREFOX:"https://addons.mozilla.org/firefox/addon/ether-metamask/",DEFAULT:"https://metamask.io"},xde="REGISTRATION_IN_PROGRESS",kde="FORWARDER_ID",Sde=function(){function e(t){var n=void 0===t?{}:t,r=n.forwarderOrigin,i=void 0===r?"https://fwd.metamask.io":r,o=n.forwarderMode,s=void 0===o?e.FORWARDER_MODE.INJECT:o;this.forwarderOrigin=i,this.forwarderMode=s,this.state=e.isMetaMaskInstalled()?yde:bde;var a=e._detectBrowser();this.downloadUrl=a?_de[a]:_de.DEFAULT,this._onMessage=this._onMessage.bind(this),this._onMessageFromForwarder=this._onMessageFromForwarder.bind(this),this._openForwarder=this._openForwarder.bind(this),this._openDownloadPage=this._openDownloadPage.bind(this),this.startOnboarding=this.startOnboarding.bind(this),this.stopOnboarding=this.stopOnboarding.bind(this),window.addEventListener("message",this._onMessage),s===e.FORWARDER_MODE.INJECT&&"true"===sessionStorage.getItem(xde)&&e._injectForwarder(this.forwarderOrigin)}return e.prototype._onMessage=function(e){if(e.origin===this.forwarderOrigin)return"metamask:reload"===e.data.type?this._onMessageFromForwarder(e):void 0},e.prototype._onMessageUnknownStateError=function(e){throw new Error("Unknown state: '"+e+"'")},e.prototype._onMessageFromForwarder=function(t){return function(e,t,n,r){return new(n||(n=Promise))(function(t,i){function o(e){try{a(r.next(e))}catch(t){i(t)}}function s(e){try{a(r.throw(e))}catch(t){i(t)}}function a(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n(function(e){e(r)})).then(o,s)}a((r=r.apply(e,[])).next())})}(this,0,void 0,function(){return function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(a){o=[6,a],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,function(n){switch(n.label){case 0:switch(this.state){case Ede:return[3,1];case bde:return[3,2];case yde:return[3,3];case wde:return[3,5];case vde:return[3,6]}return[3,7];case 1:return[3,8];case 2:return this.state=Ede,location.reload(),[3,8];case 3:return this.state=wde,[4,e._register()];case 4:return n.sent(),this.state=vde,t.source.postMessage({type:"metamask:registrationCompleted"},t.origin),this.stopOnboarding(),[3,8];case 5:case 6:return[3,8];case 7:this._onMessageUnknownStateError(this.state),n.label=8;case 8:return[2]}})})},e.prototype.startOnboarding=function(){sessionStorage.setItem(xde,"true"),this._openDownloadPage(),this._openForwarder()},e.prototype.stopOnboarding=function(){"true"===sessionStorage.getItem(xde)&&(this.forwarderMode===e.FORWARDER_MODE.INJECT&&e._removeForwarder(),sessionStorage.setItem(xde,"false"))},e.prototype._openForwarder=function(){this.forwarderMode===e.FORWARDER_MODE.OPEN_TAB?window.open(this.forwarderOrigin,"_blank"):e._injectForwarder(this.forwarderOrigin)},e.prototype._openDownloadPage=function(){window.open(this.downloadUrl,"_blank")},e.isMetaMaskInstalled=function(){return Boolean(window.ethereum&&window.ethereum.isMetaMask)},e._register=function(){return window.ethereum.request({method:"wallet_registerOnboarding"})},e._injectForwarder=function(e){var t=document.body,n=document.createElement("iframe");n.setAttribute("height","0"),n.setAttribute("width","0"),n.setAttribute("style","display: none;"),n.setAttribute("src",e),n.setAttribute("id",kde),t.insertBefore(n,t.children[0])},e._removeForwarder=function(){var e;null===(e=document.getElementById(kde))||void 0===e||e.remove()},e._detectBrowser=function(){var e=Rue.parse(window.navigator.userAgent);return"Firefox"===e.browser.name?"FIREFOX":["Chrome","Chromium"].includes(e.browser.name||"")?"CHROME":null},e.FORWARDER_MODE={INJECT:"INJECT",OPEN_TAB:"OPEN_TAB"},e}();class Cde{constructor({remote:e,preferDesktop:t,platformManager:n,debug:r=!1}){this.state={isInstalling:!1,hasInstalled:!1,resendRequest:null,preferDesktop:!1,platformManager:null,remote:null,debug:!1,connectWith:void 0},this.state.remote=e,this.state.preferDesktop=t,this.state.platformManager=n,this.state.debug=r}startDesktopOnboarding(){return function(){return l7(this,void 0,void 0,function*(){yue("[MetamaskInstaller: startDesktopOnboarding() starting desktop onboarding"),window.ethereum&&(window.ethereum=void 0),(new Sde).startOnboarding()})}()}redirectToProperInstall(){return l7(this,void 0,void 0,function*(){return function(e){var t,n;return l7(this,void 0,void 0,function*(){const{state:r}=e,i=null===(t=r.platformManager)||void 0===t?void 0:t.getPlatformType();if(yue(`[MetamaskInstaller: redirectToProperInstall()] platform=${i}`),i===Die.MetaMaskMobileWebview)return!1;r.isInstalling=!0;try{yield null===(n=r.remote)||void 0===n?void 0:n.startConnection({connectWith:r.connectWith}),r.isInstalling=!1,r.hasInstalled=!0}catch(o){throw r.isInstalling=!1,o}return!0})}(this)})}checkInstallation(){return l7(this,void 0,void 0,function*(){return function(e){var t;return l7(this,void 0,void 0,function*(){const{state:n}=e,r=null===(t=n.platformManager)||void 0===t?void 0:t.isMetaMaskInstalled();return yue(`[MetamaskInstaller: checkInstallation()] isInstalled=${r}`),!!r||(yield e.redirectToProperInstall())})}(this)})}start({wait:e=!1,connectWith:t}){return l7(this,void 0,void 0,function*(){this.state.connectWith=t,yue(`[MetaMaskInstaller: start()] wait=${e}`,t),yield function(e,{wait:t=!1}){return l7(this,void 0,void 0,function*(){return yue(`[MetamaskInstaller: startInstaller()] wait=${t}`),t&&(yield dde(1e3)),yield e.checkInstallation()})}(this,{wait:e})})}}class Ide{constructor({debug:e,sdkVersion:t}){this.containers={install:void 0,pending:void 0,select:void 0},this.defined={install:!1,pending:!1,select:!1},this.debug=null!=e&&e,this.sdkVersion=t}loadComponent(e){return l7(this,void 0,void 0,function*(){if(!this.defined[e]){this.defined[e]=!0;try{(yield Promise.resolve().then(function(){return Xhe})).defineCustomElements()}catch(Gle){console.error(`Failed to load ${e} modal:`,Gle)}}})}renderInstallModal(e){var t;return l7(this,void 0,void 0,function*(){this.debug,this.containers.install=e.parentElement,yield this.loadComponent("install");const n=document.createElement("mm-install-modal");n.link=e.link,n.preferDesktop=e.preferDesktop,n.sdkVersion=null!==(t=e.sdkVersion)&&void 0!==t?t:this.sdkVersion,n.addEventListener("close",({detail:{shouldTerminate:t}})=>e.onClose(t)),n.addEventListener("startDesktopOnboarding",e.metaMaskInstaller.startDesktopOnboarding),n.addEventListener("trackAnalytics",t=>{var n;return null===(n=e.onAnalyticsEvent)||void 0===n?void 0:n.call(e,t.detail)}),e.parentElement.appendChild(n)})}renderSelectModal(e){var t;return l7(this,void 0,void 0,function*(){this.containers.select=e.parentElement,yield this.loadComponent("select");const n=document.createElement("mm-select-modal");n.link=e.link,n.sdkVersion=null!==(t=e.sdkVersion)&&void 0!==t?t:this.sdkVersion,n.preferDesktop=e.preferDesktop,n.addEventListener("close",({detail:{shouldTerminate:t}})=>e.onClose(t)),n.addEventListener("connectWithExtension",e.connectWithExtension),e.parentElement.appendChild(n),setTimeout(()=>this.updateQRCode(e.link),100)})}renderPendingModal(e){var t;return l7(this,void 0,void 0,function*(){this.containers.pending=e.parentElement,yield this.loadComponent("pending");const n=document.createElement("mm-pending-modal");n.sdkVersion=null!==(t=e.sdkVersion)&&void 0!==t?t:this.sdkVersion,n.displayOTP=e.displayOTP,n.addEventListener("close",e.onClose),n.addEventListener("updateOTPValue",({detail:{otpValue:t}})=>e.updateOTPValue(t)),e.onDisconnect&&n.addEventListener("disconnect",e.onDisconnect),e.parentElement.appendChild(n)})}updateOTPValue(e){const t=()=>{var t;const n=null===(t=this.containers.pending)||void 0===t?void 0:t.querySelector("mm-pending-modal");return!!n&&(n.otpCode=e,!0)};setTimeout(()=>{t()},800)}updateQRCode(e){var t,n;const r=null===(t=this.containers.install)||void 0===t?void 0:t.querySelector("mm-install-modal");if(r)r.link=e;else{const t=null===(n=this.containers.select)||void 0===n?void 0:n.querySelector("mm-select-modal");t&&(t.link=e)}}unmount(){Object.entries(this.containers).forEach(([e,t])=>{var n;null===(n=null==t?void 0:t.parentNode)||void 0===n||n.removeChild(t),this.containers[e]=void 0})}}const Ade=({link:e,debug:t,installer:n,terminate:r,connectWithExtension:i,preferDesktop:o,onAnalyticsEvent:s})=>{let a=null,c=null;yue("[UI: InstallModal-web: sdkWebInstallModal()] ################## Installing Modal #################"),yue(`[UI: InstallModal-web: sdkWebInstallModal()] link=${e}`),yue(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${e}" --ios`),yue(`[UI: InstallModal-web: sdkWebInstallModal()] npx uri-scheme open "${e}" --android`),yue(`[UI: InstallModal-web: sdkWebInstallModal()] adb shell am start -a android.intent.action.VIEW -d "${e}"`);const l=e=>{var t;yue("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web unmounting install modal -- shouldTerminate:",e,c),(null==c?void 0:c.parentNode)&&(null===(t=c.parentNode)||void 0===t||t.removeChild(c)),c=null,a=null,!0===e&&(null==r||r())};return{mount:r=>{if(yue("[UI: InstallModal-web: sdkWebInstallModal()] installModal-web mounting install modal",c),c)return c.style.display="block",void(null==a||a.updateQRCode(r));a=new Ide({debug:t,sdkVersion:Fue}),c=document.createElement("div"),document.body.appendChild(c),window.extension?a.renderSelectModal({parentElement:c,connectWithExtension:()=>{l(),null==i||i()},onClose:l,link:e,preferDesktop:null!=o&&o}).catch(e=>{console.error(e)}):a.renderInstallModal({parentElement:c,preferDesktop:null!=o&&o,link:e,metaMaskInstaller:n,onClose:l,onAnalyticsEvent:s}).catch(e=>{console.error("[UI: InstallModal-web: sdkWebInstallModal()]",e)})},unmount:l}},Pde=({onDisconnect:e,debug:t})=>{let n=null,r=null;const i=()=>{yue("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web unmount",n),(null==n?void 0:n.parentNode)&&n.parentNode.removeChild(n),n=null,r=null},o=e=>{yue("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web updateOTPValue",e),r&&r.updateOTPValue(e)},s=({displayOTP:s}={displayOTP:!0})=>{yue("[UI: pendingModal-web: sdkWebPendingModal()] pendingModal-web mount",n),n?n.style.display="block":(r=new Ide({debug:t,sdkVersion:Fue}),n=document.createElement("div"),document.body.appendChild(n),r.renderPendingModal({parentElement:n,onClose:i,onDisconnect:e,updateOTPValue:o,displayOTP:s}).catch(e=>{console.error("[UI: pendingModal-web: sdkWebPendingModal()]",e)}))};return s(),{mount:s,unmount:i,updateOTPValue:o}};function Mde(e,t){var n,r,i,o;e.connector||(yue("[RemoteConnection: initializeConnector()] initialize connector"),e.connector=new Qie({platformType:t.platformManager.getPlatformType(),communicationLayerPreference:t.communicationLayerPreference,transports:t.transports,dappMetadata:Object.assign(Object.assign({},t.dappMetadata),{source:t._source}),analytics:t.enableAnalytics,communicationServerUrl:t.communicationServerUrl,sdkVersion:Fue,context:"dapp",ecies:t.ecies,storage:t.storage,logging:t.logging}),t.timer&&(yue("[RemoteConnection: initializeConnector()] reset background timer",t.timer),null===(r=null===(n=t.timer)||void 0===n?void 0:n.stopBackgroundTimer)||void 0===r||r.call(n),null===(o=null===(i=t.timer)||void 0===i?void 0:i.runBackgroundTimer)||void 0===o||o.call(i,()=>!1,1e4)))}function Ode(e){e.listeners.forEach(({event:t,handler:n})=>{var r;null===(r=e.connector)||void 0===r||r.off(t,n)}),e.listeners=[]}function Tde(e,t){function n(t,n){var r;null===(r=e.connector)||void 0===r||r.on(t,n),e.listeners.push({event:t,handler:n})}e.connector&&(Ode(e),n(bie.WALLET_INIT,({accounts:e,chainId:t})=>l7(this,void 0,void 0,function*(){yue(`[RemoteConnection: setupListeners() => EventType.WALLET_INIT] 'wallet_init' accounts=${e} chainId=${t}`);const n=Lue.getProvider();n._setConnected();const r={accounts:e,chainId:t,isUnlocked:!1};n._initializeState(r),n.emit("chainChanged",t),n.emit("accountsChanged",e)})),n(bie.AUTHORIZED,()=>l7(this,void 0,void 0,function*(){var t,n,r,i;try{yue("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' closing modals",e.pendingModal,e.installModal);const o=Lue.getProvider();o._setConnected(),null===(n=null===(t=e.pendingModal)||void 0===t?void 0:t.unmount)||void 0===n||n.call(t),null===(i=null===(r=e.installModal)||void 0===r?void 0:r.unmount)||void 0===i||i.call(r,!1),e.otpAnswer=void 0,e.authorized=!0,yue("[RemoteConnection: setupListeners() => EventType.AUTHORIZED] 'authorized' provider.state",o.getState()),yield o.forceInitializeState()}catch(o){}})),n(bie.TERMINATE,()=>{var t,n,r,i,o;null===(n=null===(t=e.pendingModal)||void 0===t?void 0:t.unmount)||void 0===n||n.call(t),null===(i=null===(r=e.installModal)||void 0===r?void 0:r.unmount)||void 0===i||i.call(r,!0),e.pendingModal=void 0,e.installModal=void 0,e.otpAnswer=void 0,null===(o=e.connector)||void 0===o||o.disconnect({terminate:!0}),e.authorized=!1,Lue.getProvider().handleDisconnect({terminate:!0}),Ode(e),yue("[RemoteConnection: setupListeners()] All listeners cleaned up")}))}function Rde(e,t,{initialCheck:n,connectWith:r}={}){var i,o,s,a,c,l,u,d,h,f,p,m,g,y,b,v,w,E,_;return l7(this,void 0,void 0,function*(){try{if(Mde(e,t),!e.connector)throw new Error("no connector defined");Tde(e);const x=Lue.getProvider();e.authorized=!1,x.emit("connecting");const k=yield null===(i=e.connector)||void 0===i?void 0:i.originatorSessionConnect();yue(`[RemoteConnection: startConnection()] after originatorSessionConnect initialCheck=${n}`,k);let S=null!==(o=null==k?void 0:k.channelId)&&void 0!==o?o:"",C=null!==(a=null===(s=e.connector.getKeyInfo())||void 0===s?void 0:s.ecies.public)&&void 0!==a?a:"",I=null!==(l=null===(c=e.connector.getKeyInfo())||void 0===c?void 0:c.ecies.private)&&void 0!==l?l:"";if(n&&!k)return Promise.resolve();if(!k&&!n){const t=yield e.connector.generateChannelIdConnect();S=null!==(u=t.channelId)&&void 0!==u?u:"",C=null!==(d=t.pubKey)&&void 0!==d?d:"",I=null!==(h=t.privKey)&&void 0!==h?h:"";const n=Date.now();null===(f=e.connector.state.storageManager)||void 0===f||f.persistChannelConfig({channelId:S,localKey:I,lastActive:n,validUntil:n+fie})}if(n&&(null==k?void 0:k.channelId))return(null===(p=e.connector)||void 0===p?void 0:p.isConnected())||(yue(`[RemoteConnection: startConnection()] reconnecting to channel initialCheck=${n}`,k),yield null===(m=e.connector)||void 0===m?void 0:m.connectToChannel({channelId:S})),Promise.resolve();k&&!(null===(g=e.connector)||void 0===g?void 0:g.isConnected())&&(yue("[RemoteConnection: startConnection()] reconnecting to channel",k),yield null===(y=e.connector)||void 0===y?void 0:y.connectToChannel({channelId:S}));const A=(null===(b=e.platformManager)||void 0===b?void 0:b.isSecure())?"":"&t=q",P=Fue,{iconUrl:M,name:O,url:T,scheme:R}=t.dappMetadata||{},N=null===(v=e.platformManager)||void 0===v?void 0:v.getPlatformType();let L="N/A";"undefined"!=typeof window&&window.location&&window.location.hostname?L=window.location.hostname:void 0!==O?L=O:void 0!==T&&(L=T);const B={url:null!=T?T:"",title:null!=O?O:"",icon:M,scheme:null!=R?R:"",apiVersion:P,dappId:L||T||"N/A",platform:null!=N?N:"",source:null!==(w=t._source)&&void 0!==w?w:""},j=cde(JSON.stringify(B));let D=`channelId=${S}&v=2&comm=${null!==(E=e.communicationLayerPreference)&&void 0!==E?E:""}&pubkey=${C}${A}&originatorInfo=${j}`;if(r){D+=`&rpc=${cde(JSON.stringify(r))}`;const t=e.connector.getRPCMethodTracker();t&&(t[`${r.id}`]=Object.assign(Object.assign({},r),{id:`${r.id}`,timestamp:Date.now()}))}const U=encodeURI(D),F=`${e.useDeeplink?Hue:zue}?${D}`;return e.qrcodeLink=F,e.developerMode&&yue(`[RemoteConnection: startConnection()] qrcodeLink=${U}`),x.emit("display_uri",F),(null===(_=e.platformManager)||void 0===_?void 0:_.isSecure())?(yield function(e,t){var n,r;return l7(this,void 0,void 0,function*(){const i=`${zue}?${t}`,o=`${Hue}?${t}`;null===(r=null===(n=e.platformManager)||void 0===n?void 0:n.openDeeplink)||void 0===r||r.call(n,i,o,"_self")})}(e,U),new Promise((t,n)=>{var r,i,o;(null===(r=e.connector)||void 0===r?void 0:r.isAuthorized())?t():(null===(i=e.connector)||void 0===i||i.once(bie.AUTHORIZED,()=>{t()}),null===(o=e.connector)||void 0===o||o.once(bie.REJECTED,()=>{n(bie.REJECTED)}))})):function(e,t,n){return l7(this,void 0,void 0,function*(){return new Promise((r,i)=>{if(!e.connector)return void i(new Error("No connector available"));yue("[RemoteConnection: connectWithModalInstaller()]",{state:e,options:t,linkParams:n});const o=`${e.useDeeplink?Hue:zue}?${n}`;var s,a,c,l,u,d,h;a=t,c=o,(s=e).installModal=null===(u=(l=a.modals).install)||void 0===u?void 0:u.call(l,{link:c,preferDesktop:s.preferDesktop,installer:a.getMetaMaskInstaller(),terminate:()=>{yue("[RemoteConnection: showInstallModal() => terminate()] terminate connection"),a.sdk.terminate().catch(e=>{console.warn("[MMSDK] failed to terminate connection",e)})},debug:s.developerMode,connectWithExtension:()=>{var e;return null===(e=a.connectWithExtensionProvider)||void 0===e||e.call(a),!1},onAnalyticsEvent:({event:e,params:t})=>{var n,r,i;const o=Object.assign(Object.assign({},t),{sdkVersion:a.sdk.getVersion(),dappId:null===(n=a.dappMetadata)||void 0===n?void 0:n.name,source:a._source,url:null===(r=a.dappMetadata)||void 0===r?void 0:r.url});null===(i=s.analytics)||void 0===i||i.send({event:e,params:o})}}),null===(h=null===(d=s.installModal)||void 0===d?void 0:d.mount)||void 0===h||h.call(d,c),t.sdk.once(bie.PROVIDER_UPDATE,e=>l7(this,void 0,void 0,function*(){yue("[RemoteConnection: connectWithModalInstaller()] once provider_update -- resolving startConnection promise"),e!==ode.TERMINATE?i(e):i({code:4001,message:"User rejected the request."})})),e.connector.once(bie.AUTHORIZED,()=>{r()}),e.connector.once(bie.REJECTED,()=>{i(bie.REJECTED)}),e.connector.once(bie.CLIENTS_READY,()=>l7(this,void 0,void 0,function*(){yue("[RemoteConnection: connectWithModalInstaller()] once clients_ready -- resolving startConnection promise"),r()}))})})}(e,t,U)}catch(x){throw console.error("[startConnection] error",x),x}})}class Nde{constructor(e){var t,n,r;this.state={connector:void 0,qrcodeLink:void 0,analytics:void 0,developerMode:!1,authorized:!1,reconnection:!1,preferDesktop:!1,deeplinkProtocol:!1,listeners:[],communicationLayerPreference:void 0,platformManager:void 0,pendingModal:void 0,installModal:void 0,otpAnswer:void 0},this.options=e;const i=!0===(null===(t=e.logging)||void 0===t?void 0:t.developerMode)||!0===(null===(n=e.logging)||void 0===n?void 0:n.sdk);this.state.developerMode=i,this.state.analytics=e.analytics,this.state.preferDesktop=null!==(r=e.preferDesktop)&&void 0!==r&&r,this.state.useDeeplink=e.sdk.options.useDeeplink,this.state.communicationLayerPreference=e.communicationLayerPreference,this.state.platformManager=e.platformManager,e.modals.install||(e.modals.install=Ade),e.modals.otp||(e.modals.otp=Pde)}startConnection(e){return l7(this,void 0,void 0,function*(){return Rde(this.state,this.options,e)})}initRemoteCommunication({sdkInstance:e}){var t,n,r;return l7(this,void 0,void 0,function*(){const i=yield null===(n=null===(t=e.options.storage)||void 0===t?void 0:t.storageManager)||void 0===n?void 0:n.getPersistedChannelConfig();if(!this.options.ecies){const e={privateKey:null==i?void 0:i.localKey};this.options.ecies=e}Mde(this.state,this.options),yield null===(r=this.getConnector())||void 0===r?void 0:r.initFromDappStorage(),Tde(this.state,this.options)})}showActiveModal(){return function(e){var t,n,r,i;e.authorized?yue("[RemoteConnection: showActiveModal()] already authorized"):e.pendingModal?null===(n=(t=e.pendingModal).mount)||void 0===n||n.call(t):e.installModal&&(null===(i=(r=e.installModal).mount)||void 0===i||i.call(r,e.qrcodeLink||""))}(this.state)}closeModal(){var e,t,n,r;null===(t=null===(e=this.state.pendingModal)||void 0===e?void 0:e.unmount)||void 0===t||t.call(e),null===(r=null===(n=this.state.installModal)||void 0===n?void 0:n.unmount)||void 0===r||r.call(n,!1)}getUniversalLink(){if(!this.state.qrcodeLink)throw new Error("connection not started. run startConnection() first.");return this.state.qrcodeLink}getChannelConfig(){var e;return null===(e=this.state.connector)||void 0===e?void 0:e.getChannelConfig()}getKeyInfo(){var e;return null===(e=this.state.connector)||void 0===e?void 0:e.getKeyInfo()}getConnector(){if(!this.state.connector)throw new Error("invalid remote connector");return this.state.connector}getPlatformManager(){if(!this.state.platformManager)throw new Error("PlatformManager not available");return this.state.platformManager}isConnected(){var e;return(null===(e=this.state.connector)||void 0===e?void 0:e.isReady())||!1}isAuthorized(){var e;return(null===(e=this.state.connector)||void 0===e?void 0:e.isAuthorized())||!1}isPaused(){var e;return null===(e=this.state.connector)||void 0===e?void 0:e.isPaused()}disconnect(e){var t,n,r,i;yue("[RemoteConnection: disconnect()]",e),(null==e?void 0:e.terminate)&&(Lue.getProvider().handleDisconnect({terminate:!0}),null===(n=null===(t=this.state.pendingModal)||void 0===t?void 0:t.unmount)||void 0===n||n.call(t),this.state.otpAnswer=void 0),null===(r=this.state.connector)||void 0===r||r.disconnect(e),i=this.state,yue("[RemoteConnection: cleanupConnector()] cleaning up connector"),i.connector&&(Ode(i),i.connector.disconnect({terminate:!0}).catch(e=>{yue("[RemoteConnection: cleanupConnector()] error disconnecting connector",e)}))}}function Lde(e){var t,n,r,i,o,s,a,c,l,u,d;return l7(this,void 0,void 0,function*(){const{options:h}=e;if(h.logging=null!==(t=h.logging)&&void 0!==t?t:{},h.communicationLayerPreference=null!==(n=h.communicationLayerPreference)&&void 0!==n?n:jie.SOCKET,void 0!==h.enableDebug&&(f1.enable("MM_SDK"),console.warn("enableDebug is removed. Please use enableAnalytics instead.")),h.enableAnalytics=null===(r=h.enableAnalytics)||void 0===r||r,h.injectProvider=null===(i=h.injectProvider)||void 0===i||i,h.shouldShimWeb3=null===(o=h.shouldShimWeb3)||void 0===o||o,h.extensionOnly=null===(s=h.extensionOnly)||void 0===s||s,h.useDeeplink=null===(a=h.useDeeplink)||void 0===a||a,h.storage=null!==(c=h.storage)&&void 0!==c?c:{enabled:!0},h.headless){f1("[MetaMaskSDK: performSDKInitialization()] headless mode enabled");const e=()=>{},t={install:()=>({mount:e,unmount:e})},n={installer:e};h.modals=t,h.ui=n}const f=!0===(null===(l=h.logging)||void 0===l?void 0:l.developerMode);e.debug=(null===(u=h.logging)||void 0===u?void 0:u.sdk)||f,yue("[MetaMaskSDK: performSDKInitialization()] options",e.options);const p=Object.assign({},h.logging);f&&(p.sdk=!0,p.eciesLayer=!0,p.keyExchangeLayer=!0,p.remoteLayer=!0,p.serviceLayer=!0,p.plaintext=!0),yield function(e){var t;return l7(this,void 0,void 0,function*(){const{options:n}=e;e.platformManager=new Bue({useDeepLink:null!==(t=n.useDeeplink)&&void 0!==t&&t,preferredOpenLink:n.openDeeplink,debug:e.debug})})}(e),yield function(e){var t,n,r,i,o,s,a,c,l;return l7(this,void 0,void 0,function*(){const{options:u}=e,d=null===(t=e.platformManager)||void 0===t?void 0:t.getPlatformType();e.analytics=new fde({serverUrl:null!==(n=u.communicationServerUrl)&&void 0!==n?n:die,enabled:u.enableAnalytics,originatorInfo:{url:null!==(r=u.dappMetadata.url)&&void 0!==r?r:"",title:null!==(i=u.dappMetadata.name)&&void 0!==i?i:"",dappId:"undefined"==typeof window||void 0===window.location?null!==(c=null!==(s=null===(o=u.dappMetadata)||void 0===o?void 0:o.name)&&void 0!==s?s:null===(a=u.dappMetadata)||void 0===a?void 0:a.url)&&void 0!==c?c:"N/A":window.location.hostname,platform:null!=d?d:"",source:null!==(l=u._source)&&void 0!==l?l:""}})})}(e),yield function(e){var t;return l7(this,void 0,void 0,function*(){const{options:n}=e;!0!==(null===(t=n.storage)||void 0===t?void 0:t.enabled)||n.storage.storageManager||(n.storage.storageManager=yield jue(n.storage))})}(e),yield function(e){return l7(this,void 0,void 0,function*(){const{options:t}=e,n=/^(http|https):\/\/[^\s]*$/;if(t.dappMetadata){t.dappMetadata.iconUrl&&!n.test(t.dappMetadata.iconUrl)&&(console.warn("Invalid dappMetadata.iconUrl: URL must start with http:// or https://"),t.dappMetadata.iconUrl=void 0),t.dappMetadata.base64Icon&&t.dappMetadata.base64Icon.length>163400&&(console.warn("Invalid dappMetadata.base64Icon: Base64-encoded icon string length must be less than 163400 characters"),t.dappMetadata.base64Icon=void 0),t.dappMetadata.url&&!n.test(t.dappMetadata.url)&&console.warn("Invalid dappMetadata.url: URL must start with http:// or https://");const e=(()=>{if("undefined"==typeof document)return;let e;const t=document.getElementsByTagName("link");for(let n=0;n<t.length;n++)"icon"!==t[n].getAttribute("rel")&&"shortcut icon"!==t[n].getAttribute("rel")||(e=t[n].getAttribute("href"));return e})();if(e&&!t.dappMetadata.iconUrl&&!t.dappMetadata.base64Icon){const n=`${window.location.protocol}//${window.location.host}${e}`;t.dappMetadata.iconUrl=n}}e.dappMetadata=t.dappMetadata})}(e),yield(e=>l7(void 0,void 0,void 0,function*(){const{options:t}=e,{infuraAPIKey:n}=t;if(!n)return;const r={"0x1":`https://mainnet.infura.io/v3/${n}`,"0x5":`https://goerli.infura.io/v3/${n}`,"0xaa36a7":`https://sepolia.infura.io/v3/${n}`,"0xe708":`https://linea-mainnet.infura.io/v3/${n}`,"0xe704":`https://linea-goerli.infura.io/v3/${n}`,"0x89":`https://polygon-mainnet.infura.io/v3/${n}`,"0x13881":`https://polygon-mumbai.infura.io/v3/${n}`,"0x45":`https://optimism-mainnet.infura.io/v3/${n}`,"0x1a4":`https://optimism-goerli.infura.io/v3/${n}`,"0xa4b1":`https://arbitrum-mainnet.infura.io/v3/${n}`,"0x66eed":`https://arbitrum-goerli.infura.io/v3/${n}`,"0x2a15c308d":`https://palm-mainnet.infura.io/v3/${n}`,"0x2a15c3083":`https://palm-testnet.infura.io/v3/${n}`,"0xa86a":`https://avalanche-mainnet.infura.io/v3/${n}`,"0xa869":`https://avalanche-fuji.infura.io/v3/${n}`,"0x4e454152":`https://aurora-mainnet.infura.io/v3/${n}`,"0x4e454153":`https://aurora-testnet.infura.io/v3/${n}`,"0x534e5f4d41494e":`https://starknet-mainnet.infura.io/v3/${n}`,"0x534e5f474f45524c49":`https://starknet-goerli.infura.io/v3/${n}`,"0x534e5f474f45524c4932":`https://starknet-goerli2.infura.io/v3/${n}`,"0xa4ec":`https://celo-mainnet.infura.io/v3/${n}`,"0xaef3":`https://celo-alfajores.infura.io/v3/${n}`};e.options.readonlyRPCMap?e.options.readonlyRPCMap=Object.assign(Object.assign({},e.options.readonlyRPCMap),r):e.options.readonlyRPCMap=r}))(e),yield(e=>l7(void 0,void 0,void 0,function*(){const{options:t}=e,{readonlyRPCMap:n}=t;if(n)try{yue("[MetaMaskSDK: setupReadOnlyRPCProviders()] Setting up Readonly RPC Providers",n),e.setReadOnlyRPCCalls(!0)}catch(r){throw new Error("Invalid Infura Settings")}}))(e);const{metamaskBrowserExtension:m,preferExtension:g,shouldReturn:y}=yield function(e){var n,r,i,o;return l7(this,void 0,void 0,function*(){const{options:s}=e;let a,c=!1,l=!1;if("undefined"!=typeof window&&window.ethereum&&!(null===(n=e.platformManager)||void 0===n?void 0:n.isMetaMaskMobileWebView())){c="extension"===localStorage.getItem(Jue);try{a=yield function({mustBeMetaMask:e,sdkInstance:n}){return l7(this,void 0,void 0,function*(){if("undefined"==typeof window)throw new Error("window not available");try{const e=yield new Promise((e,t)=>{const n=setTimeout(()=>{t(new Error("eip6963RequestProvider timed out"))},500);window.addEventListener(gde.Announce,t=>{const r=t,{detail:{info:i,provider:o}={}}=r,{name:s,rdns:a,uuid:c}=null!=i?i:{};Wue.test(c)&&s.startsWith(que.NAME)&&que.RDNS.includes(a)&&(clearTimeout(n),e(o))}),window.dispatchEvent(new Event(gde.Request))});return mde({provider:e,sdkInstance:n})}catch(t){throw new Error("Provider not found")}})}({mustBeMetaMask:!0,sdkInstance:e}),window.extension=a,a.on(ede,t=>{yue(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE chainChanged chainId=${t}`),Boolean(e.sdkProvider)&&e.getMobileProvider().emit(ede,t)}),a.on(tde,t=>l7(this,void 0,void 0,function*(){var n;yue(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE accountsChanged accounts=${t}`);const r=Boolean(e.sdkProvider),i=Boolean(e.extensionActive);if(r&&e.getMobileProvider().emit(tde,t),i&&0===(null==t?void 0:t.length)&&0===(yield null===(n=e.getProvider())||void 0===n?void 0:n.request({method:Kue.WALLET_GETPERMISSIONS,params:[]})).length)try{yield e.terminate()}catch(o){yue("[MetaMaskSDK: setupExtensionPreferences()] error terminating on permissions revoked",o)}})),a.on(nde,t=>{yue(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE disconnect error=${t}`),Boolean(e.sdkProvider)&&e.getMobileProvider().emit(nde,t)}),a.on(rde,t=>{yue(`[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connect args=${t}`),Boolean(e.sdkProvider)&&e.getMobileProvider().emit(rde,t)}),a.on(ide,t=>{yue("[MetaMaskSDK: setupExtensionPreferences()] PROPAGATE connected",t),Boolean(e.sdkProvider)&&e.getMobileProvider().emit(ide,t)})}catch(u){window.extension=void 0}}else(null===(r=e.platformManager)||void 0===r?void 0:r.isMetaMaskMobileWebView())&&(null===(i=e.analytics)||void 0===i||i.send({event:_ie.SDK_USE_INAPP_BROWSER}),e.activeProvider=mde({provider:window.ethereum,sdkInstance:e}),e._initialized=!0,l=!0);return a&&s.extensionOnly&&(yue("[MetaMaskSDK: setupExtensionPreferences()] EXTENSION ONLY --- prevent sdk initialization"),null===(o=e.analytics)||void 0===o||o.send({event:_ie.SDK_USE_EXTENSION}),e.activeProvider=a,e.extensionActive=!0,e.extension=a,e._initialized=!0,l=!0),{preferExtension:c,shouldReturn:l,metamaskBrowserExtension:a}})}(e);if(y)yue("[MetaMaskSDK: performSDKInitialization()] shouldReturn=true --- prevent sdk initialization");else{yield function(e,t){var n,r,i,o,s;return l7(this,void 0,void 0,function*(){const{options:a}=e,c=Object.assign({},a.logging);e.remoteConnection=new Nde({preferDesktop:null!==(n=a.preferDesktop)&&void 0!==n&&n,communicationLayerPreference:null!==(r=a.communicationLayerPreference)&&void 0!==r?r:jie.SOCKET,analytics:e.analytics,dappMetadata:a.dappMetadata,_source:a._source,enableAnalytics:null===(i=a.enableAnalytics)||void 0===i||i,timer:a.timer,sdk:e,platformManager:e.platformManager,transports:a.transports,communicationServerUrl:a.communicationServerUrl,storage:null!==(o=a.storage)&&void 0!==o?o:{enabled:!0},getMetaMaskInstaller:()=>{if(!e.installer)throw new Error("Invalid SDK status -- installer not initialized");return e.installer},logging:c,connectWithExtensionProvider:void 0===t?void 0:()=>ade(e),modals:Object.assign(Object.assign({},a.modals),{onPendingModalDisconnect:e.terminate.bind(e)})}),yield e.remoteConnection.initRemoteCommunication({sdkInstance:e}),e.installer=new Cde({remote:e.remoteConnection,preferDesktop:null!==(s=a.preferDesktop)&&void 0!==s&&s,platformManager:e.platformManager,debug:e.debug})})}(e,m),yield hde(e),yield function(e,t){var n,r;return l7(this,void 0,void 0,function*(){const{options:i}=e;t?(yue("[MetaMaskSDK: handleAutoAndExtensionConnections()] preferExtension is detected -- connect with it."),null===(n=e.analytics)||void 0===n||n.send({event:_ie.SDK_EXTENSION_UTILIZED}),ade(e).catch(e=>{console.warn("Can't connect with MetaMask extension...",e),localStorage.removeItem(Jue)})):i.checkInstallationImmediately&&((null===(r=e.platformManager)||void 0===r?void 0:r.isDesktopWeb())?(yue("[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately"),e.connect().catch(e=>{yue(`[MetaMaskSDK: handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- error on autoconnect _err=${e}`)})):console.warn("[handleAutoAndExtensionConnections()] checkInstallationImmediately --- IGNORED --- only for web desktop")),e._initialized=!0})}(e,g);try{yield null===(d=e.remoteConnection)||void 0===d?void 0:d.startConnection({initialCheck:!0})}catch(b){console.error("[MetaMaskSDK: setupRemoteConnectionAndInstaller()] Error while checking installation",b)}e.emit(Nue.ProviderUpdate,ode.INITIALIZED)}})}class Bde extends O4{constructor(e={storage:{enabled:!0},injectProvider:!0,forceInjectProvider:!1,enableAnalytics:!0,shouldShimWeb3:!0,useDeeplink:!0,extensionOnly:!0,headless:!1,dappMetadata:{name:"",url:"",iconUrl:""},_source:$ue,i18nOptions:{enabled:!1}}){var t,n,r;super(),this.extensionActive=!1,this._initialized=!1,this.sdkInitPromise=void 0,this.debug=!1,this.readonlyRPCCalls=!1,this.availableLanguages=["en"],f1.disable();const i=!0===(null===(t=e.logging)||void 0===t?void 0:t.developerMode);if(((null===(n=e.logging)||void 0===n?void 0:n.sdk)||i)&&f1.enable("MM_SDK"),yue("[MetaMaskSDK: constructor()]: begin."),this.setMaxListeners(50),!(null===(r=e.dappMetadata)||void 0===r?void 0:r.url)){if("undefined"==typeof window||"undefined"==typeof document)throw new Error("You must provide dAppMetadata url");e.dappMetadata=Object.assign(Object.assign({},e.dappMetadata),{url:`${window.location.protocol}//${window.location.host}`})}this.options=e,this.options._source||(e._source=$ue),this.init().then(()=>{yue("[MetaMaskSDK: constructor()]: initialized successfully."),"undefined"!=typeof window&&(window.mmsdk=this)}).catch(e=>{console.error("[MetaMaskSDK: constructor()] error during initialization",e)})}init(){return l7(this,void 0,void 0,function*(){return function(e){var t;return l7(this,void 0,void 0,function*(){if("undefined"!=typeof window&&(null===(t=window.mmsdk)||void 0===t?void 0:t.isInitialized()))return yue("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),Promise.resolve(window.mmsdk);if(e._initialized)return yue("[MetaMaskSDK: initializeMetaMaskSDK()] already initialized"),e.sdkInitPromise;if(e.sdkInitPromise)return yue("[MetaMaskSDK: initializeMetaMaskSDK()] already initializing"),e.sdkInitPromise;try{e.sdkInitPromise=Lde(e),yield e.sdkInitPromise}catch(n){throw console.error(n),n}return e.sdkInitPromise})}(this)})}isExtensionActive(){return this.extensionActive}checkExtensionAvailability(){var e;return"undefined"!=typeof window&&Boolean(null===(e=window.ethereum)||void 0===e?void 0:e.isMetaMask)}connect(){return l7(this,void 0,void 0,function*(){return function(e){return l7(this,void 0,void 0,function*(){if(e._initialized||(yue("[MetaMaskSDK: connect()] provider not ready -- wait for init()"),yield e.init()),yue(`[MetaMaskSDK: connect()] isExtensionActive=${e.isExtensionActive()} activeProvider`,e.activeProvider),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");const t=e.activeProvider.getSelectedAddress();return t?[t]:e.activeProvider.request({method:Kue.ETH_REQUESTACCOUNTS,params:[]})})}(this)})}connectAndSign({msg:e}){return l7(this,void 0,void 0,function*(){return function({instance:e,msg:t}){return l7(this,void 0,void 0,function*(){if(e._initialized||(yue("[MetaMaskSDK: connectAndSign()] provider not ready -- wait for init()"),yield e.init()),yue(`[MetaMaskSDK: connectAndSign()] activeProvider=${e.activeProvider}`),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");const n=/^0x([0-9A-Fa-f]{2})*$/u.test(t)?t:function(e){let t;if(void 0!==S7)t=S7.from(e,"utf8").toString("hex");else if("undefined"!=typeof TextEncoder){const n=(new TextEncoder).encode(e);t=Array.from(n).map(e=>e.toString(16).padStart(2,"0")).join("")}else{if("object"!=typeof u7||!("Buffer"in u7))throw new Error("Unable to convert string to hex: No available method.");t=u7.Buffer.from(e,"utf8").toString("hex")}return`0x${t}`}(t);return e.activeProvider.request({method:Kue.METAMASK_CONNECTWITH,params:[{method:Kue.PERSONAL_SIGN,params:[n]}]})})}({instance:this,msg:e})})}connectWith(e){return l7(this,void 0,void 0,function*(){return function({instance:e,rpc:t}){return l7(this,void 0,void 0,function*(){if(e._initialized||(yue("[MetaMaskSDK: connectWith()] provider not ready -- wait for init()"),yield e.init()),yue(`[MetaMaskSDK: connectWith()] method: ${t.method} rpc=${t}`),!e.activeProvider)throw new Error("SDK state invalid -- undefined provider");return e.activeProvider.request({method:Kue.METAMASK_CONNECTWITH,params:[t]})})}({instance:this,rpc:e})})}resume(){return function(e){var t,n,r;return l7(this,void 0,void 0,function*(){if(!(null===(n=null===(t=e.remoteConnection)||void 0===t?void 0:t.getConnector())||void 0===n?void 0:n.isReady()))return yue("[MetaMaskSDK: resume()] channel is not ready -- starting connection"),void(null===(r=e.remoteConnection)||void 0===r||r.startConnection());yue("[MetaMaskSDK: resume()] channel is ready")})}(this)}disconnect(){return console.warn("MetaMaskSDK.disconnect() is deprecated, use terminate()"),this.terminate()}isAuthorized(){var e;null===(e=this.remoteConnection)||void 0===e||e.isAuthorized()}terminate(){return function(e){var t,n,r;return l7(this,void 0,void 0,function*(){if(!(null===(t=e.platformManager)||void 0===t?void 0:t.isMetaMaskMobileWebView())){if(sde&&(window.localStorage.removeItem(Jue),window.localStorage.removeItem(Xue),window.localStorage.removeItem(Que)),e.extensionActive){try{yield null===(n=e.activeProvider)||void 0===n?void 0:n.request({method:Kue.WALLET_REVOKEPERMISSIONS,params:[{eth_accounts:{}}]})}catch(i){yue("[MetaMaskSDK: terminate()] error revoking permissions",i)}return e.options.extensionOnly?(e.emit(Nue.ProviderUpdate,ode.TERMINATE),void yue("[MetaMaskSDK: terminate()] extensionOnly --- prevent switching providers")):(e.activeProvider=e.sdkProvider,window.ethereum=e.activeProvider,e.extensionActive=!1,void e.emit(Nue.ProviderUpdate,ode.TERMINATE))}e.emit(Nue.ProviderUpdate,ode.TERMINATE),yue(`[MetaMaskSDK: terminate()] remoteConnection=${e.remoteConnection}`),null===(r=e.remoteConnection)||void 0===r||r.disconnect({terminate:!0,sendMessage:!0})}})}(this)}isInitialized(){return this._initialized}setReadOnlyRPCCalls(e){this.readonlyRPCCalls=e}hasReadOnlyRPCCalls(){return this.readonlyRPCCalls}getProvider(){if(this.activeProvider)return this.activeProvider;console.warn("MetaMaskSDK: No active provider found")}getMobileProvider(){if(!this.sdkProvider)throw new Error("SDK state invalid -- undefined mobile provider");return this.sdkProvider}getUniversalLink(){var e;const t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getUniversalLink();if(!t)throw new Error("No Universal Link available, please call eth_requestAccounts first.");return t}getChannelId(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getChannelConfig())||void 0===t?void 0:t.channelId}getRPCHistory(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t?void 0:t.getRPCMethodTracker()}getVersion(){return Fue}getWalletStatus(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t?void 0:t.getConnectionStatus()}_getChannelConfig(){var e;return null===(e=this.remoteConnection)||void 0===e?void 0:e.getChannelConfig()}_ping(){var e,t;null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t||t.ping()}_keyCheck(){var e,t;null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t||t.keyCheck()}_getServiceStatus(){var e,t;return null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t?void 0:t.getServiceStatus()}_getRemoteConnection(){return this.remoteConnection}_getDappMetadata(){return this.dappMetadata}_getKeyInfo(){var e;return null===(e=this.remoteConnection)||void 0===e?void 0:e.getKeyInfo()}_resetKeys(){var e,t;null===(t=null===(e=this.remoteConnection)||void 0===e?void 0:e.getConnector())||void 0===t||t.resetKeys()}_getConnection(){return this.remoteConnection}emit(e,t){return super.emit(e,t)}on(e,t){return super.on(e,t)}}var jde=Object.freeze({__proto__:null,StorageManagerWeb:class{constructor({enabled:e}={enabled:!1}){this.enabled=!1,this.enabled=e}persistChannelConfig(e){return l7(this,void 0,void 0,function*(){const t=JSON.stringify(e);yue(`[StorageManagerWeb: persistChannelConfig()] enabled=${this.enabled}`,e),localStorage.setItem(Yue,t)})}getPersistedChannelConfig(){return l7(this,void 0,void 0,function*(){let e;try{if(yue(`[StorageManagerWeb: getPersistedChannelConfig()] enabled=${this.enabled}`),e=localStorage.getItem(Yue),yue("[StorageManagerWeb: getPersistedChannelConfig()]",e),!e)return;const t=JSON.parse(e);return yue("[StorageManagerWeb: getPersistedChannelConfig()] channelConfig",t),t}catch(t){return void console.error("[StorageManagerWeb: getPersistedChannelConfig()] Can't find existing channel config",t)}})}persistAccounts(e){return l7(this,void 0,void 0,function*(){yue(`[StorageManagerWeb: persistAccounts()] enabled=${this.enabled}`,e);const t=JSON.stringify(e);localStorage.setItem(Que,t)})}getCachedAccounts(){return l7(this,void 0,void 0,function*(){try{const e=localStorage.getItem(Que);return e?JSON.parse(e):[]}catch(kie){throw console.error("[StorageManagerWeb: getCachedAccounts()] Error reading cached accounts",kie),kie}})}persistChainId(e){return l7(this,void 0,void 0,function*(){yue(`[StorageManagerWeb: persistChainId()] enabled=${this.enabled}`,e),localStorage.setItem(Xue,e)})}getCachedChainId(){return l7(this,void 0,void 0,function*(){try{const e=localStorage.getItem(Xue);return null!=e?e:void 0}catch(kie){throw console.error("[StorageManagerWeb: getCachedChainId()] Error reading cached chainId",kie),kie}})}terminate(){return l7(this,void 0,void 0,function*(){yue(`[StorageManagerWeb: terminate()] enabled=${this.enabled}`),localStorage.removeItem(Yue)})}}});var Dde=Object.defineProperty,Ude=new WeakMap,Fde=e=>Ude.get(e),$de=(e,t)=>Ude.set(t.$lazyInstance$=e,t),zde=(e,t)=>t in e,Hde=(e,t)=>(0,console.error)(e,t),qde=new Map,Wde=new Map,Kde="slot-fb{display:contents}slot-fb[hidden]{display:none}",Gde="undefined"!=typeof window?window:{},Vde=Gde.document||{head:{}},Zde={$flags$:0,$resourcesUrl$:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,r)=>e.addEventListener(t,n,r),rel:(e,t,n,r)=>e.removeEventListener(t,n,r),ce:(e,t)=>new CustomEvent(e,t)},Yde=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(kie){}return!1})(),Jde=!1,Qde=[],Xde=[],ehe=e=>{for(let n=0;n<e.length;n++)try{e[n](performance.now())}catch(t){Hde(t)}e.length=0},the=()=>{ehe(Qde),ehe(Xde),(Jde=Qde.length>0)&&Zde.raf(the)},nhe=e=>Promise.resolve(void 0).then(e),rhe=(e=>t=>{e.push(t),Jde||(Jde=!0,4&Zde.$flags$?nhe(the):Zde.raf(the))})(Xde),ihe={},ohe=e=>"object"==(e=typeof e)||"function"===e;function she(e){var t,n,r;return null!=(r=null==(n=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?r:void 0}((e,t)=>{for(var n in t)Dde(e,n,{get:t[n],enumerable:!0})})({},{err:()=>che,map:()=>lhe,ok:()=>ahe,unwrap:()=>dhe,unwrapErr:()=>hhe});var ahe=e=>({isOk:!0,isErr:!1,value:e}),che=e=>({isOk:!1,isErr:!0,value:e});function lhe(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then(e=>ahe(e)):ahe(n)}if(e.isErr){const t=e.value;return che(t)}throw"should never get here"}var uhe,dhe=e=>{if(e.isOk)return e.value;throw e.value},hhe=e=>{if(e.isErr)return e.value;throw e.value},fhe=(e,t,...n)=>{let r=null,i=!1,o=!1;const s=[],a=t=>{for(let n=0;n<t.length;n++)r=t[n],Array.isArray(r)?a(r):null!=r&&"boolean"!=typeof r&&((i="function"!=typeof e&&!ohe(r))&&(r=String(r)),i&&o?s[s.length-1].$text$+=r:s.push(i?phe(null,r):r),o=i)};if(a(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter(t=>e[t]).join(" "))}if("function"==typeof e)return e(null===t?{}:t,s,ghe);const c=phe(e,null);return c.$attrs$=t,s.length>0&&(c.$children$=s),c},phe=(e,t)=>({$flags$:0,$tag$:e,$text$:t,$elm$:null,$children$:null,$attrs$:null}),mhe={},ghe={forEach:(e,t)=>e.map(yhe).forEach(t),map:(e,t)=>e.map(yhe).map(t).map(bhe)},yhe=e=>({vattrs:e.$attrs$,vchildren:e.$children$,vkey:e.$key$,vname:e.$name$,vtag:e.$tag$,vtext:e.$text$}),bhe=e=>{if("function"==typeof e.vtag){const t={...e.vattrs};return e.vkey&&(t.key=e.vkey),e.vname&&(t.name=e.vname),fhe(e.vtag,t,...e.vchildren||[])}const t=phe(e.vtag,e.vtext);return t.$attrs$=e.vattrs,t.$children$=e.vchildren,t.$key$=e.vkey,t.$name$=e.vname,t},vhe=e=>Fde(e).$hostElement$,whe=(e,t,n)=>{const r=vhe(e);return{emit:e=>Ehe(r,t,{bubbles:!0,composed:!0,cancelable:!0,detail:e})}},Ehe=(e,t,n)=>{const r=Zde.ce(t,n);return e.dispatchEvent(r),r},_he=new WeakMap,xhe=(e,t)=>"sc-"+e.$tagName$,khe=(e,t,n,r,i,o)=>{if(n!==r){let a=zde(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,i=Che(n),o=Che(r);t.remove(...i.filter(e=>e&&!o.includes(e))),t.add(...o.filter(e=>e&&!i.includes(e)))}else if("style"===t){for(const t in n)r&&null!=r[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in r)n&&r[t]===n[t]||(t.includes("-")?e.style.setProperty(t,r[t]):e.style[t]=r[t])}else if(a||"o"!==t[0]||"n"!==t[1]){const c=ohe(r);if((a||c&&null!==r)&&!i)try{if(e.tagName.includes("-"))e[t]=r;else{const i=null==r?"":r;"list"===t?a=!1:null!=n&&e[t]==i||("function"==typeof e.__lookupSetter__(t)?e[t]=i:e.setAttribute(t,i))}}catch(s){}null==r||!1===r?!1===r&&""!==e.getAttribute(t)||e.removeAttribute(t):(!a||4&o||i)&&!c&&(r=!0===r?"":r,e.setAttribute(t,r))}else if(t="-"===t[2]?t.slice(3):zde(Gde,c)?c.slice(2):c[2]+t.slice(3),n||r){const i=t.endsWith(Ihe);t=t.replace(Ahe,""),n&&Zde.rel(e,t,n,i),r&&Zde.ael(e,t,r,i)}}},She=/\s/,Che=e=>e?e.split(She):[],Ihe="Capture",Ahe=new RegExp(Ihe+"$"),Phe=(e,t,n)=>{const r=11===t.$elm$.nodeType&&t.$elm$.host?t.$elm$.host:t.$elm$,i=e&&e.$attrs$||ihe,o=t.$attrs$||ihe;for(const s of Mhe(Object.keys(i)))s in o||khe(r,s,i[s],void 0,n,t.$flags$);for(const s of Mhe(Object.keys(o)))khe(r,s,i[s],o[s],n,t.$flags$)};function Mhe(e){return e.includes("ref")?[...e.filter(e=>"ref"!==e),"ref"]:e}var Ohe=!1,The=(e,t,n,r)=>{const i=t.$children$[n];let o,s,a=0;if(null!==i.$text$)o=i.$elm$=Vde.createTextNode(i.$text$);else{if(Ohe||(Ohe="svg"===i.$tag$),o=i.$elm$=Vde.createElementNS(Ohe?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.$tag$),Ohe&&"foreignObject"===i.$tag$&&(Ohe=!1),Phe(null,i,Ohe),o.getRootNode().querySelector("body"),i.$children$)for(a=0;a<i.$children$.length;++a)s=The(e,i,a),s&&o.appendChild(s);"svg"===i.$tag$?Ohe=!1:"foreignObject"===o.tagName&&(Ohe=!0)}return o["s-hn"]=uhe,o},Rhe=(e,t,n,r,i,o)=>{let s,a=e;for(a.shadowRoot&&a.tagName===uhe&&(a=a.shadowRoot);i<=o;++i)r[i]&&(s=The(null,n,i),s&&(r[i].$elm$=s,jhe(a,s,t)))},Nhe=(e,t,n)=>{for(let r=t;r<=n;++r){const t=e[r];if(t){const e=t.$elm$;e&&e.remove()}}},Lhe=(e,t,n=!1)=>e.$tag$===t.$tag$,Bhe=(e,t,n=!1)=>{const r=t.$elm$=e.$elm$,i=e.$children$,o=t.$children$,s=t.$tag$,a=t.$text$;null===a?(Phe(e,t,Ohe="svg"===s||"foreignObject"!==s&&Ohe),null!==i&&null!==o?((e,t,n,r,i=!1)=>{let o,s=0,a=0,c=t.length-1,l=t[0],u=t[c],d=r.length-1,h=r[0],f=r[d];for(;s<=c&&a<=d;)null==l?l=t[++s]:null==u?u=t[--c]:null==h?h=r[++a]:null==f?f=r[--d]:Lhe(l,h,i)?(Bhe(l,h,i),l=t[++s],h=r[++a]):Lhe(u,f,i)?(Bhe(u,f,i),u=t[--c],f=r[--d]):Lhe(l,f,i)?(Bhe(l,f,i),jhe(e,l.$elm$,u.$elm$.nextSibling),l=t[++s],f=r[--d]):Lhe(u,h,i)?(Bhe(u,h,i),jhe(e,u.$elm$,l.$elm$),u=t[--c],h=r[++a]):(o=The(t&&t[a],n,a),h=r[++a],o&&jhe(l.$elm$.parentNode,o,l.$elm$));s>c?Rhe(e,null==r[d+1]?null:r[d+1].$elm$,n,r,a,d):a>d&&Nhe(t,s,c)})(r,i,t,o,n):null!==o?(null!==e.$text$&&(r.textContent=""),Rhe(r,null,t,o,0,o.length-1)):!n&&null!==i&&Nhe(i,0,i.length-1),Ohe&&"svg"===s&&(Ohe=!1)):e.$text$!==a&&(r.data=a)},jhe=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),Dhe=(e,t)=>{t&&!e.$onRenderResolve$&&t["s-p"]&&t["s-p"].push(new Promise(t=>e.$onRenderResolve$=t))},Uhe=(e,t)=>{if(e.$flags$|=16,!(4&e.$flags$))return Dhe(e,e.$ancestorComponent$),rhe(()=>Fhe(e,t));e.$flags$|=512},Fhe=(e,t)=>{const n=e.$hostElement$;e.$cmpMeta$.$tagName$;const r=e.$lazyInstance$;if(!r)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);return $he(void 0,()=>Hhe(e,r,t))},$he=(e,t)=>zhe(e)?e.then(t).catch(e=>{console.error(e),t()}):t(),zhe=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,Hhe=async(e,t,n)=>{var r;const i=e.$hostElement$;e.$cmpMeta$.$tagName$;const o=i["s-rc"];n&&(e=>{const t=e.$cmpMeta$,n=e.$hostElement$,r=t.$flags$;t.$tagName$;const i=((e,t)=>{var n;const r=xhe(t),i=Wde.get(r);if(e=11===e.nodeType?e:Vde,i)if("string"==typeof i){e=e.head||e;let o,s=_he.get(e);if(s||_he.set(e,s=new Set),!s.has(r)){{o=Vde.createElement("style"),o.innerHTML=i;const r=null!=(n=Zde.$nonce$)?n:she(Vde);if(null!=r&&o.setAttribute("nonce",r),!(1&t.$flags$))if("HEAD"===e.nodeName){const t=e.querySelectorAll("link[rel=preconnect]"),n=t.length>0?t[t.length-1].nextSibling:e.querySelector("style");e.insertBefore(o,n)}else if("host"in e)if(Yde){const t=new CSSStyleSheet;t.replaceSync(i),e.adoptedStyleSheets=[t,...e.adoptedStyleSheets]}else{const t=e.querySelector("style");t?t.innerHTML=i+t.innerHTML:e.prepend(o)}else e.append(o);1&t.$flags$&&"HEAD"!==e.nodeName&&e.insertBefore(o,null)}4&t.$flags$&&(o.innerHTML+=Kde),s&&s.add(r)}}else e.adoptedStyleSheets.includes(i)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,i]);return r})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&r&&2&r&&(n["s-sc"]=i,n.classList.add(i+"-h"))})(e),e.$cmpMeta$.$tagName$,qhe(e,t,i,n),o&&(o.map(e=>e()),i["s-rc"]=void 0);{const t=null!=(r=i["s-p"])?r:[],n=()=>Whe(e);0===t.length?n():(Promise.all(t).then(n),e.$flags$|=4,t.length=0)}},qhe=(e,t,n,r)=>{try{t=t.render(),e.$flags$&=-17,e.$flags$|=2,((e,t,n=!1)=>{const r=e.$hostElement$,i=e.$cmpMeta$,o=e.$vnode$||phe(null,null),s=(a=t)&&a.$tag$===mhe?t:fhe(null,null,t);var a;if(uhe=r.tagName,n&&s.$attrs$)for(const c of Object.keys(s.$attrs$))r.hasAttribute(c)&&!["key","ref","style","class"].includes(c)&&(s.$attrs$[c]=r[c]);s.$tag$=null,s.$flags$|=4,e.$vnode$=s,s.$elm$=o.$elm$=r.shadowRoot||r,r["s-sc"],i.$flags$,Bhe(o,s,n)})(e,t,r)}catch(i){Hde(i,e.$hostElement$)}return null},Whe=e=>{e.$cmpMeta$.$tagName$;const t=e.$hostElement$,n=e.$lazyInstance$,r=e.$ancestorComponent$;64&e.$flags$||(e.$flags$|=64,Vhe(t),Ghe(n,"componentDidLoad"),e.$onReadyResolve$(t),r||Khe()),e.$onRenderResolve$&&(e.$onRenderResolve$(),e.$onRenderResolve$=void 0),512&e.$flags$&&nhe(()=>Uhe(e,!1)),e.$flags$&=-517},Khe=e=>{Vhe(Vde.documentElement),nhe(()=>Ehe(Gde,"appload",{detail:{namespace:"sdk-install-modal-web"}}))},Ghe=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(r){Hde(r)}},Vhe=e=>e.classList.add("hydrated"),Zhe=(e,t,n)=>{var r,i;const o=e.prototype;if(t.$members$||t.$watchers$||e.watchers){e.watchers&&!t.$watchers$&&(t.$watchers$=e.watchers);const s=Object.entries(null!=(r=t.$members$)?r:{});if(s.map(([e,[r]])=>{(31&r||2&n&&32&r)&&Object.defineProperty(o,e,{get(){return t=e,Fde(this).$instanceValues$.get(t);var t},set(n){((e,t,n,r)=>{const i=Fde(e);if(!i)throw new Error(`Couldn't find host element for "${r.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const o=i.$hostElement$,s=i.$instanceValues$.get(t),a=i.$flags$,c=i.$lazyInstance$;var l,u;l=n,u=r.$members$[t][0],n=null==l||ohe(l)?l:4&u?"false"!==l&&(""===l||!!l):1&u?String(l):l;const d=Number.isNaN(s)&&Number.isNaN(n);if((!(8&a)||void 0===s)&&n!==s&&!d&&(i.$instanceValues$.set(t,n),c)){if(r.$watchers$&&128&a){const e=r.$watchers$[t];e&&e.map(e=>{try{c[e](n,s,t)}catch(r){Hde(r,o)}})}2==(18&a)&&Uhe(i,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})}),1&n){const n=new Map;o.attributeChangedCallback=function(e,r,i){Zde.jmp(()=>{var s;const a=n.get(e);if(this.hasOwnProperty(a))i=this[a],delete this[a];else{if(o.hasOwnProperty(a)&&"number"==typeof this[a]&&this[a]==i)return;if(null==a){const n=Fde(this),o=null==n?void 0:n.$flags$;if(o&&!(8&o)&&128&o&&i!==r){const o=n.$lazyInstance$,a=null==(s=t.$watchers$)?void 0:s[e];null==a||a.forEach(t=>{null!=o[t]&&o[t].call(o,i,r,e)})}return}}this[a]=(null!==i||"boolean"!=typeof this[a])&&i})},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(i=t.$watchers$)?i:{}),...s.filter(([e,t])=>15&t[0]).map(([e,t])=>{const r=t[1]||e;return n.set(r,e),r})]))}}return e},Yhe=e=>{Ghe(e,"connectedCallback")},Jhe=e=>{Ghe(e,"disconnectedCallback")},Qhe=(e,t={})=>{var n;const r=[],i=t.exclude||[],o=Gde.customElements,s=Vde.head,a=s.querySelector("meta[charset]"),c=Vde.createElement("style"),l=[];let u,d=!0;Object.assign(Zde,t),Zde.$resourcesUrl$=new URL(t.resourcesUrl||"./",Vde.baseURI).href;let h=!1;if(e.map(e=>{e[1].map(t=>{var n;const s={$flags$:t[0],$tagName$:t[1],$members$:t[2],$listeners$:t[3]};4&s.$flags$&&(h=!0),s.$members$=t[2],s.$watchers$=null!=(n=t[4])?n:{};const a=s.$tagName$,c=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,t)=>{const n={$flags$:0,$hostElement$:e,$cmpMeta$:t,$instanceValues$:new Map};n.$onReadyPromise$=new Promise(e=>n.$onReadyResolve$=e),e["s-p"]=[],e["s-rc"]=[],Ude.set(e,n)})(e=this,s),1&s.$flags$)if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw new Error(`Unable to re-use existing shadow root for ${s.$tagName$}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else e.attachShadow({mode:"open"})}connectedCallback(){Fde(this),this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),u&&(clearTimeout(u),u=null),d?l.push(this):Zde.jmp(()=>(e=>{if(!(1&Zde.$flags$)){const t=Fde(e),n=t.$cmpMeta$;if(n.$tagName$,1&t.$flags$)(null==t?void 0:t.$lazyInstance$)?Yhe(t.$lazyInstance$):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>Yhe(t.$lazyInstance$));else{t.$flags$|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){Dhe(t,t.$ancestorComponent$=n);break}}n.$members$&&Object.entries(n.$members$).map(([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}}),(async(t,n,r)=>{let i;if(!(32&n.$flags$)){if(n.$flags$|=32,r.$lazyBundleId$){const t=(e=>{const t=e.$tagName$.replace(/-/g,"_"),n=e.$lazyBundleId$;if(!n)return;const r=qde.get(n);if(r)return r[t];{const e=e=>(qde.set(n,e),e[t]);if("mm-install-modal_3"===n)return Promise.resolve().then(function(){return jfe}).then(e,Hde)}return import(`./${n}.entry.js`).then(e=>(qde.set(n,e),e[t]),Hde)})(r);if(i=t&&"then"in t?await t:t,!i)throw new Error(`Constructor for "${r.$tagName$}#${n.$modeName$}" was not found`);i.isProxied||(r.$watchers$=i.watchers,Zhe(i,r,2),i.isProxied=!0),r.$tagName$,n.$flags$|=8;try{new i(n)}catch(e){Hde(e)}n.$flags$&=-9,n.$flags$|=128,Yhe(n.$lazyInstance$)}else{i=t.constructor;const e=t.localName;customElements.whenDefined(e).then(()=>n.$flags$|=128)}if(i&&i.style){let e;"string"==typeof i.style&&(e=i.style);const t=xhe(r);Wde.has(t)||(r.$tagName$,((e,t,n)=>{let r=Wde.get(e);Yde&&n?(r=r||new CSSStyleSheet,"string"==typeof r?r=t:r.replaceSync(t)):r=t,Wde.set(e,r)})(t,e,!!(1&r.$flags$)))}}const o=n.$ancestorComponent$,s=()=>Uhe(n,!0);o&&o["s-rc"]?o["s-rc"].push(s):s()})(e,t,n)}}})(this))}disconnectedCallback(){Zde.jmp(()=>(async e=>{if(!(1&Zde.$flags$)){const t=Fde(e);(null==t?void 0:t.$lazyInstance$)?Jhe(t.$lazyInstance$):(null==t?void 0:t.$onReadyPromise$)&&t.$onReadyPromise$.then(()=>Jhe(t.$lazyInstance$))}})(this))}componentOnReady(){return Fde(this).$onReadyPromise$}};s.$lazyBundleId$=e[0],i.includes(a)||o.get(a)||(r.push(a),o.define(a,Zhe(c,s,1)))})}),r.length>0&&(h&&(c.textContent+=Kde),c.textContent+=r.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",c.innerHTML.length)){c.setAttribute("data-styles","");const e=null!=(n=Zde.$nonce$)?n:she(Vde);null!=e&&c.setAttribute("nonce",e),s.insertBefore(c,a?a.nextSibling:s.firstChild)}d=!1,l.length?l.map(e=>e.connectedCallback()):Zde.jmp(()=>u=setTimeout(Khe,30))};!function(){if("undefined"!=typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}}();var Xhe=Object.freeze({__proto__:null,defineCustomElements:async(e,t)=>{if("undefined"!=typeof window)return await void 0,Qhe([["mm-install-modal_3",[[1,"mm-install-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}],[1,"mm-pending-modal",{displayOTP:[4,"display-o-t-p"],sdkVersion:[1,"sdk-version"],otpCode:[1,"otp-code"],translationsLoaded:[32]}],[1,"mm-select-modal",{link:[1],sdkVersion:[1,"sdk-version"],preferDesktop:[4,"prefer-desktop"],tab:[32],isDefaultTab:[32],translationsLoaded:[32]},null,{preferDesktop:["updatePreferDesktop"]}]]]],t)},setNonce:e=>Zde.$nonce$=e});const efe={fontFamily:"Roboto, sans-serif"},tfe=({className:e},t)=>fhe("div",{style:efe,class:e},t),nfe=({Icon:e,text:t})=>fhe("div",{class:"flexContainer",style:{padding:"6",flexDirection:"row"}},fhe("div",{class:"flexItem1"},fhe(e,null)),fhe("div",{class:"flexItem11"},fhe("span",{style:{lineHeight:"2",color:"black"}},t))),rfe=()=>fhe("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M20.0002 7.9702V10.0302C20.0002 10.5802 19.5602 11.0302 19.0002 11.0502H17.0402C15.9602 11.0502 14.9702 10.2602 14.8802 9.1802C14.8202 8.5502 15.0602 7.9602 15.4802 7.5502C15.8502 7.1702 16.3602 6.9502 16.9202 6.9502H19.0002C19.5602 6.9702 20.0002 7.4202 20.0002 7.9702Z",fill:"#037DD6"}),fhe("path",{d:"M18.47 12.55H17.04C15.14 12.55 13.54 11.12 13.38 9.3C13.29 8.26 13.67 7.22 14.43 6.48C15.07 5.82 15.96 5.45 16.92 5.45H18.47C18.76 5.45 19 5.21 18.97 4.92C18.75 2.49 17.14 0.83 14.75 0.55C14.51 0.51 14.26 0.5 14 0.5H5C4.72 0.5 4.45 0.52 4.19 0.56C1.64 0.88 0 2.78 0 5.5V12.5C0 15.26 2.24 17.5 5 17.5H14C16.8 17.5 18.73 15.75 18.97 13.08C19 12.79 18.76 12.55 18.47 12.55ZM11 6.75H5C4.59 6.75 4.25 6.41 4.25 6C4.25 5.59 4.59 5.25 5 5.25H11C11.41 5.25 11.75 5.59 11.75 6C11.75 6.41 11.41 6.75 11 6.75Z",fill:"#037DD6"})),ife=()=>fhe("svg",{width:"20",height:"18",viewBox:"0 0 20 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M14.44 0.0999756C12.63 0.0999756 11.01 0.979976 10 2.32998C8.99 0.979976 7.37 0.0999756 5.56 0.0999756C2.49 0.0999756 0 2.59998 0 5.68998C0 6.87998 0.19 7.97998 0.52 8.99998C2.1 14 6.97 16.99 9.38 17.81C9.72 17.93 10.28 17.93 10.62 17.81C13.03 16.99 17.9 14 19.48 8.99998C19.81 7.97998 20 6.87998 20 5.68998C20 2.59998 17.51 0.0999756 14.44 0.0999756Z",fill:"#037DD6"})),ofe=()=>fhe("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M16.28 7.53V6.28C16.28 3.58 15.63 0 10 0C4.37 0 3.72 3.58 3.72 6.28V7.53C0.92 7.88 0 9.3 0 12.79V14.65C0 18.75 1.25 20 5.35 20H14.65C18.75 20 20 18.75 20 14.65V12.79C20 9.3 19.08 7.88 16.28 7.53ZM10 16.74C8.33 16.74 6.98 15.38 6.98 13.72C6.98 12.05 8.34 10.7 10 10.7C11.66 10.7 13.02 12.06 13.02 13.72C13.02 15.39 11.67 16.74 10 16.74ZM5.35 7.44C5.27 7.44 5.2 7.44 5.12 7.44V6.28C5.12 3.35 5.95 1.4 10 1.4C14.05 1.4 14.88 3.35 14.88 6.28V7.45C14.8 7.45 14.73 7.45 14.65 7.45H5.35V7.44Z",fill:"#037DD6"})),sfe=()=>fhe("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M16.4405 8.8999C20.0405 9.2099 21.5105 11.0599 21.5105 15.1099V15.2399C21.5105 19.7099 19.7205 21.4999 15.2505 21.4999H8.74047C4.27047 21.4999 2.48047 19.7099 2.48047 15.2399V15.1099C2.48047 11.0899 3.93047 9.2399 7.47047 8.9099",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M12 2V14.88",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M15.3504 12.6499L12.0004 15.9999L8.65039 12.6499",stroke:"white","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}));function afe({version:e}){return fhe("div",{style:{textAlign:"center",color:"#BBC0C5",fontSize:"12"}},"SDK Version ",e?`v${e}`:"unknown")}const cfe=()=>fhe("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("rect",{width:"16",height:"16",fill:"white"}),fhe("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.40554 2.40554C2.94627 1.86482 3.82296 1.86482 4.36369 2.40554L8 6.04186L11.6363 2.40554C12.177 1.86482 13.0537 1.86482 13.5945 2.40554C14.1352 2.94627 14.1352 3.82296 13.5945 4.36369L9.95814 8L13.5945 11.6363C14.1352 12.177 14.1352 13.0537 13.5945 13.5945C13.0537 14.1352 12.177 14.1352 11.6363 13.5945L8 9.95814L4.36369 13.5945C3.82296 14.1352 2.94627 14.1352 2.40554 13.5945C1.86482 13.0537 1.86482 12.177 2.40554 11.6363L6.04186 8L2.40554 4.36369C1.86482 3.82296 1.86482 2.94627 2.40554 2.40554Z",fill:"#BBC0C5"})),lfe=()=>fhe("svg",{width:"273",height:"51",viewBox:"0 0 273 51",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M240.882 25.9263C239.472 24.997 237.916 24.3361 236.443 23.5101C235.489 22.9731 234.473 22.4982 233.643 21.8167C232.233 20.6602 232.524 18.3885 233.996 17.3973C236.112 15.993 239.617 16.7777 239.99 19.6483C239.99 19.7102 240.052 19.7515 240.114 19.7515H243.308C243.391 19.7515 243.454 19.6896 243.433 19.607C243.267 17.6244 242.5 15.9723 241.089 14.9191C239.741 13.9072 238.206 13.3702 236.568 13.3702C228.127 13.3702 227.359 22.271 231.901 25.0796C232.42 25.41 236.879 27.6404 238.455 28.611C240.032 29.5816 240.529 31.3576 239.845 32.7619C239.223 34.0423 237.605 34.9303 235.987 34.8271C234.224 34.7238 232.855 33.7738 232.378 32.2869C232.295 32.0185 232.254 31.5022 232.254 31.275C232.254 31.2131 232.192 31.1511 232.129 31.1511H228.666C228.604 31.1511 228.541 31.2131 228.541 31.275C228.541 33.7738 229.164 35.1575 230.864 36.4172C232.461 37.615 234.203 38.1106 236.008 38.1106C240.737 38.1106 243.184 35.4466 243.682 32.6793C244.117 29.974 243.308 27.5371 240.882 25.9263Z",fill:"#24292E"}),fhe("path",{d:"M90.4943 13.8246H88.9595H87.2795C87.2173 13.8246 87.1758 13.8659 87.1551 13.9072L84.3137 23.2416C84.2722 23.3655 84.1063 23.3655 84.0648 23.2416L81.2234 13.9072C81.2026 13.8452 81.1612 13.8246 81.0989 13.8246H79.419H77.8842H75.8102C75.748 13.8246 75.6857 13.8865 75.6857 13.9485V37.7802C75.6857 37.8422 75.748 37.9041 75.8102 37.9041H79.2738C79.336 37.9041 79.3982 37.8422 79.3982 37.7802V19.6689C79.3982 19.5244 79.6056 19.5037 79.6471 19.6276L82.5093 29.024L82.7167 29.6849C82.7374 29.7468 82.7789 29.7675 82.8411 29.7675H85.4959C85.5581 29.7675 85.5996 29.7262 85.6203 29.6849L85.8277 29.024L88.6899 19.6276C88.7313 19.4831 88.9387 19.5244 88.9387 19.6689V37.7802C88.9387 37.8422 89.001 37.9041 89.0632 37.9041H92.5268C92.589 37.9041 92.6513 37.8422 92.6513 37.7802V13.9485C92.6513 13.8865 92.589 13.8246 92.5268 13.8246H90.4943Z",fill:"#24292E"}),fhe("path",{d:"M187.849 13.8246C187.787 13.8246 187.745 13.8659 187.725 13.9072L184.883 23.2416C184.842 23.3655 184.676 23.3655 184.634 23.2416L181.793 13.9072C181.772 13.8452 181.731 13.8246 181.668 13.8246H176.4C176.338 13.8246 176.276 13.8865 176.276 13.9485V37.7802C176.276 37.8422 176.338 37.9041 176.4 37.9041H179.864C179.926 37.9041 179.988 37.8422 179.988 37.7802V19.6689C179.988 19.5244 180.196 19.5037 180.237 19.6276L183.099 29.024L183.307 29.6849C183.328 29.7468 183.369 29.7675 183.431 29.7675H186.086C186.148 29.7675 186.19 29.7262 186.211 29.6849L186.418 29.024L189.28 19.6276C189.322 19.4831 189.529 19.5244 189.529 19.6689V37.7802C189.529 37.8422 189.591 37.9041 189.653 37.9041H193.117C193.179 37.9041 193.241 37.8422 193.241 37.7802V13.9485C193.241 13.8865 193.179 13.8246 193.117 13.8246H187.849Z",fill:"#24292E"}),fhe("path",{d:"M143.174 13.8246H136.724H133.261H126.81C126.748 13.8246 126.686 13.8865 126.686 13.9485V16.9223C126.686 16.9843 126.748 17.0462 126.81 17.0462H133.136V37.7802C133.136 37.8422 133.198 37.9041 133.261 37.9041H136.724C136.786 37.9041 136.849 37.8422 136.849 37.7802V17.0462H143.174C143.237 17.0462 143.299 16.9843 143.299 16.9223V13.9485C143.299 13.8865 143.257 13.8246 143.174 13.8246Z",fill:"#24292E"}),fhe("path",{d:"M163.604 37.9041H166.756C166.839 37.9041 166.901 37.8215 166.881 37.7389L160.368 13.8245C160.347 13.7626 160.306 13.7419 160.244 13.7419H159.041H156.925H155.722C155.66 13.7419 155.619 13.7832 155.598 13.8245L149.085 37.7389C149.065 37.8215 149.127 37.9041 149.21 37.9041H152.362C152.425 37.9041 152.466 37.8628 152.487 37.8215L154.374 30.862C154.395 30.8 154.436 30.7794 154.499 30.7794H161.467C161.53 30.7794 161.571 30.8207 161.592 30.862L163.479 37.8215C163.5 37.8628 163.562 37.9041 163.604 37.9041ZM155.328 27.3719L157.859 18.0581C157.9 17.9342 158.066 17.9342 158.107 18.0581L160.638 27.3719C160.659 27.4545 160.596 27.5371 160.513 27.5371H155.453C155.37 27.5371 155.308 27.4545 155.328 27.3719Z",fill:"#24292E"}),fhe("path",{d:"M217.362 37.9041H220.515C220.598 37.9041 220.66 37.8215 220.639 37.7389L214.127 13.8245C214.106 13.7626 214.065 13.7419 214.002 13.7419H212.8H210.684H209.481C209.419 13.7419 209.377 13.7832 209.357 13.8245L202.844 37.7389C202.823 37.8215 202.886 37.9041 202.969 37.9041H206.121C206.183 37.9041 206.225 37.8628 206.246 37.8215L208.133 30.862C208.154 30.8 208.195 30.7794 208.257 30.7794H215.226C215.288 30.7794 215.33 30.8207 215.351 30.862L217.238 37.8215C217.259 37.8628 217.3 37.9041 217.362 37.9041ZM209.087 27.3719L211.617 18.0581C211.659 17.9342 211.825 17.9342 211.866 18.0581L214.397 27.3719C214.417 27.4545 214.355 27.5371 214.272 27.5371H209.211C209.129 27.5371 209.066 27.4545 209.087 27.3719Z",fill:"#24292E"}),fhe("path",{d:"M106.713 34.3727V26.9795C106.713 26.9176 106.775 26.8556 106.837 26.8556H116.067C116.129 26.8556 116.191 26.7936 116.191 26.7317V23.7579C116.191 23.6959 116.129 23.634 116.067 23.634H106.837C106.775 23.634 106.713 23.572 106.713 23.5101V17.1907C106.713 17.1288 106.775 17.0668 106.837 17.0668H117.332C117.394 17.0668 117.457 17.0049 117.457 16.9429V13.9691C117.457 13.9072 117.394 13.8452 117.332 13.8452H106.713H103.125C103.063 13.8452 103.001 13.9072 103.001 13.9691V17.0668V23.6546V26.8763V34.5173V37.7802C103.001 37.8422 103.063 37.9041 103.125 37.9041H106.713H117.768C117.83 37.9041 117.892 37.8422 117.892 37.7802V34.6412C117.892 34.5792 117.83 34.5173 117.768 34.5173H106.817C106.755 34.4966 106.713 34.4553 106.713 34.3727Z",fill:"#24292E"}),fhe("path",{d:"M272.532 37.6976L260.544 25.3687C260.502 25.3274 260.502 25.2448 260.544 25.2035L271.329 14.0517C271.412 13.9691 271.349 13.8452 271.246 13.8452H266.828C266.787 13.8452 266.766 13.8659 266.745 13.8865L257.599 23.3449C257.516 23.4275 257.391 23.3655 257.391 23.2623V13.9691C257.391 13.9072 257.329 13.8452 257.267 13.8452H253.803C253.741 13.8452 253.679 13.9072 253.679 13.9691V37.8009C253.679 37.8628 253.741 37.9248 253.803 37.9248H257.267C257.329 37.9248 257.391 37.8628 257.391 37.8009V27.3099C257.391 27.2067 257.536 27.1447 257.599 27.2273L267.969 37.8835C267.989 37.9041 268.031 37.9248 268.052 37.9248H272.469C272.552 37.9041 272.615 37.7596 272.532 37.6976Z",fill:"#24292E"}),fhe("path",{d:"M52.021 1L31.0526 16.4886L34.9517 7.36063L52.021 1Z",fill:"#E17726",stroke:"#E17726","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M3.65491 1L24.4366 16.6331L20.7241 7.36063L3.65491 1Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M44.4716 36.9127L38.8925 45.4211L50.8389 48.7047L54.261 37.0986L44.4716 36.9127Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M1.43555 37.0986L4.83695 48.7047L16.7626 45.4211L11.2042 36.9127L1.43555 37.0986Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M16.1197 22.5395L12.8013 27.5371L24.6232 28.074L24.2292 15.3734L16.1197 22.5395Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M39.5561 22.5394L31.3222 15.2288L31.0526 28.0739L42.8746 27.537L39.5561 22.5394Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M16.7626 45.4212L23.918 41.9724L17.7582 37.1813L16.7626 45.4212Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M31.7578 41.9724L38.8925 45.4212L37.9177 37.1813L31.7578 41.9724Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M38.8923 45.4212L31.7577 41.9724L32.3384 46.5983L32.2762 48.5602L38.8923 45.4212Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M16.7625 45.4212L23.3994 48.5602L23.3579 46.5983L23.9179 41.9724L16.7625 45.4212Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M23.5239 34.1249L17.5922 32.3902L21.7818 30.4696L23.5239 34.1249Z",fill:"#233447",stroke:"#233447","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M32.1517 34.1249L33.8939 30.4696L38.1042 32.3902L32.1517 34.1249Z",fill:"#233447",stroke:"#233447","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M16.7626 45.4212L17.7996 36.9128L11.2042 37.0987L16.7626 45.4212Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M37.8761 36.9128L38.8924 45.4212L44.4715 37.0987L37.8761 36.9128Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M42.8745 27.5371L31.0526 28.074L32.1518 34.1249L33.894 30.4696L38.1042 32.3902L42.8745 27.5371Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M17.5922 32.3902L21.7817 30.4696L23.5239 34.1249L24.6232 28.074L12.8012 27.5371L17.5922 32.3902Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M12.8013 27.5371L17.7582 37.1813L17.5923 32.3902L12.8013 27.5371Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M38.1044 32.3902L37.9177 37.1813L42.8746 27.5371L38.1044 32.3902Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M24.6232 28.0741L23.524 34.125L24.9136 41.2703L25.2247 31.8533L24.6232 28.0741Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M31.0526 28.0741L30.4719 31.8327L30.7623 41.2703L32.1519 34.125L31.0526 28.0741Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M32.1519 34.1249L30.7623 41.2702L31.7578 41.9724L37.9177 37.1813L38.1043 32.3901L32.1519 34.1249Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M17.5922 32.3901L17.7581 37.1813L23.918 41.9724L24.9135 41.2702L23.5239 34.1249L17.5922 32.3901Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M32.2763 48.5602L32.3385 46.5983L31.7993 46.1439H23.8765L23.358 46.5983L23.3995 48.5602L16.7626 45.4211L19.0855 47.3211L23.7935 50.5633H31.8615L36.5903 47.3211L38.8924 45.4211L32.2763 48.5602Z",fill:"#C0AC9D",stroke:"#C0AC9D","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M31.7578 41.9724L30.7622 41.2703H24.9135L23.918 41.9724L23.358 46.5983L23.8765 46.144H31.7993L32.3385 46.5983L31.7578 41.9724Z",fill:"#24292E",stroke:"#24292E","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M52.9128 17.5005L54.6757 8.95079L52.021 1L31.7578 15.9723L39.5561 22.5394L50.5692 25.7404L52.9958 22.9111L51.938 22.147L53.618 20.6188L52.3321 19.6276L54.0121 18.3472L52.9128 17.5005Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M1 8.95079L2.78366 17.5005L1.64295 18.3472L3.34365 19.6276L2.05775 20.6188L3.73771 22.147L2.67996 22.9111L5.10657 25.7404L16.1196 22.5394L23.918 15.9723L3.65475 1L1 8.95079Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M50.5692 25.7404L39.5561 22.5394L42.8746 27.5371L37.9177 37.1813L44.4716 37.0987H54.261L50.5692 25.7404Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M16.1196 22.5394L5.10651 25.7404L1.43549 37.0987H11.2041L17.7581 37.1813L12.8011 27.5371L16.1196 22.5394Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M31.0526 28.0741L31.7578 15.9724L34.9518 7.36072H20.7239L23.9179 15.9724L24.6231 28.0741L24.8927 31.8739L24.9135 41.2703H30.7622L30.783 31.8739L31.0526 28.0741Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.5","stroke-linecap":"round","stroke-linejoin":"round"}));function ufe(e,t){return e.toString(2).padStart(t,"0")}function dfe(e,t){const n=e%t;return n>=0?n:t+n}function hfe(e,t){return new Array(e).fill(t)}function ffe(...e){let t=0;for(const r of e)t=Math.max(t,r.length);const n=[];for(let r=0;r<t;r++)for(const t of e)r>=t.length||n.push(t[r]);return new Uint8Array(n)}function pfe(e,t,n){if(n<0||n+t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[n+r])return!1;return!0}function mfe(e){return{has:t=>e.includes(t),decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map(t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})},encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map(t=>{if(function(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]})}}}class gfe{static size(e,t){if("number"==typeof e&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw new Error(`Bitmap: wrong height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw new Error(`Bitmap: wrong width=${e.width} (${typeof e.width})`);return void 0!==t&&(e={width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}),e}static fromString(e){const t=(e=e.replace(/^\n+/g,"").replace(/\n+$/g,"")).split("\n"),n=t.length,r=new Array(n);let i;for(const o of t){const e=o.split("").map(e=>{if("X"===e)return!0;if(" "===e)return!1;if("?"!==e)throw new Error(`Bitmap.fromString: unknown symbol=${e}`)});if(i&&e.length!==i)throw new Error(`Bitmap.fromString different row sizes: width=${i} cur=${e.length}`);i=e.length,r.push(e)}return i||(i=0),new gfe({height:n,width:i},r)}constructor(e,t){const{height:n,width:r}=gfe.size(e);this.data=t||Array.from({length:n},()=>hfe(r,void 0)),this.height=n,this.width=r}point(e){return this.data[e.y][e.x]}isInside(e){return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};const{x:t,y:n}=this.xy(e);return{height:this.height-n,width:this.width-t}}xy(e){if("number"==typeof e&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw new Error(`Bitmap: wrong x=${e.x}`);if(!Number.isSafeInteger(e.y))throw new Error(`Bitmap: wrong y=${e.y}`);return e.x=dfe(e.x,this.width),e.y=dfe(e.y,this.height),e}rect(e,t,n){const{x:r,y:i}=this.xy(e),{height:o,width:s}=gfe.size(t,this.size({x:r,y:i}));for(let a=0;a<o;a++)for(let e=0;e<s;e++)this.data[i+a][r+e]="function"==typeof n?n({x:e,y:a},this.data[i+a][r+e]):n;return this}rectRead(e,t,n){return this.rect(e,t,(e,t)=>(n(e,t),t))}hLine(e,t,n){return this.rect(e,{width:t,height:1},n)}vLine(e,t,n){return this.rect(e,{width:1,height:t},n)}border(e=2,t){const n=this.height+2*e,r=this.width+2*e,i=hfe(e,t),o=Array.from({length:e},()=>hfe(r,t));return new gfe({height:n,width:r},[...o,...this.data.map(e=>[...i,...e,...i]),...o])}embed(e,t){return this.rect(e,t.size(),({x:e,y:n})=>t.data[n][e])}rectSlice(e,t=this.size()){const n=new gfe(gfe.size(t,this.size(this.xy(e))));return this.rect(e,t,({x:e,y:t},r)=>n.data[t][e]=r),n}inverse(){const{height:e,width:t}=this;return new gfe({height:t,width:e}).rect({x:0,y:0},1/0,({x:e,y:t})=>this.data[e][t])}scale(e){if(!Number.isSafeInteger(e)||e>1024)throw new Error(`Wrong scale factor: ${e}`);const{height:t,width:n}=this;return new gfe({height:e*t,width:e*n}).rect({x:0,y:0},1/0,({x:t,y:n})=>this.data[Math.floor(n/e)][Math.floor(t/e)])}clone(){return new gfe(this.size()).rect({x:0,y:0},this.size(),({x:e,y:t})=>this.data[t][e])}assertDrawn(){this.rectRead(0,1/0,(e,t)=>{if("boolean"!=typeof t)throw new Error("Invalid color type="+typeof t)})}toString(){return this.data.map(e=>e.map(e=>void 0===e?"?":e?"X":" ").join("")).join("\n")}toASCII(){const{height:e,width:t,data:n}=this;let r="";for(let i=0;i<e;i+=2){for(let o=0;o<t;o++){const t=n[i][o],s=i+1>=e||n[i+1][o];t||s?!t&&s?r+="▀":t&&!s?r+="▄":t&&s&&(r+=" "):r+="█"}r+="\n"}return r}toTerm(){const e="",t=` ${e}`,n=` ${e}`;return this.data.map(e=>e.map(e=>e?n:t).join("")).join("\n")}toSVG(){let e=`<svg xmlns:svg="http://www.w3.org/2000/svg" viewBox="0 0 ${this.width} ${this.height}" version="1.1" xmlns="http://www.w3.org/2000/svg">`;return this.rectRead(0,1/0,({x:t,y:n},r)=>{r&&(e+=`<rect x="${t}" y="${n}" width="1" height="1" />`)}),e+="</svg>",e}toGIF(){const e=e=>[255&e,e>>>8&255],t=[...e(this.width),...e(this.height)],n=[];this.rectRead(0,1/0,(e,t)=>n.push(+(!0===t)));const r=126,i=[71,73,70,56,55,97,...t,246,0,0,255,255,255,...hfe(381,0),44,0,0,0,0,...t,0,7],o=Math.floor(n.length/r);for(let s=0;s<o;s++)i.push(127,128,...n.slice(r*s,r*(s+1)).map(e=>+e));return i.push(n.length%r+1,128,...n.slice(o*r).map(e=>+e)),i.push(1,129,0,59),new Uint8Array(i)}toImage(e=!1){const{height:t,width:n}=this.size(),r=new Uint8Array(t*n*(e?3:4));let i=0;for(let o=0;o<t;o++)for(let t=0;t<n;t++){const n=this.data[o][t]?0:255;r[i++]=n,r[i++]=n,r[i++]=n,e||(r[i++]=255)}return{height:t,width:n,data:r}}}const yfe=["low","medium","quartile","high"],bfe=["numeric","alphanumeric","byte","kanji","eci"],vfe=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],wfe={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]},Efe={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},_fe={size:{encode:e=>21+4*(e-1),decode:e=>(e-17)/4},sizeType:e=>Math.floor((e+7)/17),alignmentPatterns(e){if(1===e)return[];const t=_fe.size.encode(e)-6-1,n=t-6,r=Math.ceil(n/28);let i=Math.floor(n/r);i%2?i+=1:n%r*2>=r&&(i+=2);const o=[6];for(let s=1;s<r;s++)o.push(t-(r-s)*i);return o.push(t),o},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(e,t){const n=_fe.ECCode[e]<<3|t;let r=n;for(let i=0;i<10;i++)r=r<<1^1335*(r>>9);return(n<<10|r)^_fe.formatMask},versionBits(e){let t=e;for(let n=0;n<12;n++)t=t<<1^7973*(t>>11);return e<<12|t},alphabet:{numeric:mfe("0123456789"),alphanumerc:mfe("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits:(e,t)=>({numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]}[t][_fe.sizeType(e)]),modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(e,t){const n=vfe[e-1],r=wfe[t][e-1],i=Efe[t][e-1],o=Math.floor(n/i)-r,s=i-n%i;return{words:r,numBlocks:i,shortBlocks:s,blockLen:o,capacity:8*(n-r*i),total:(r+o)*i+i-s}}},xfe=[(e,t)=>(e+t)%2==0,(e,t)=>t%2==0,(e,t)=>e%3==0,(e,t)=>(e+t)%3==0,(e,t)=>(Math.floor(t/2)+Math.floor(e/3))%2==0,(e,t)=>e*t%2+e*t%3==0,(e,t)=>(e*t%2+e*t%3)%2==0,(e,t)=>((e+t)%2+e*t%3)%2==0],kfe={tables:(()=>{const e=hfe(256,0),t=hfe(256,0);for(let n=0,r=1;n<256;n++)e[n]=r,t[r]=n,r<<=1,256&r&&(r^=285);return{exp:e,log:t}})(),exp:e=>kfe.tables.exp[e],log(e){if(0===e)throw new Error(`GF.log: wrong arg=${e}`);return kfe.tables.log[e]%255},mul:(e,t)=>0===e||0===t?0:kfe.tables.exp[(kfe.tables.log[e]+kfe.tables.log[t])%255],add:(e,t)=>e^t,pow:(e,t)=>kfe.tables.exp[kfe.tables.log[e]*t%255],inv(e){if(0===e)throw new Error(`GF.inverse: wrong arg=${e}`);return kfe.tables.exp[255-kfe.tables.log[e]]},polynomial(e){if(0==e.length)throw new Error("GF.polymomial: wrong length");if(0!==e[0])return e;let t=0;for(;t<e.length-1&&0==e[t];t++);return e.slice(t)},monomial(e,t){if(e<0)throw new Error(`GF.monomial: wrong degree=${e}`);if(0==t)return[0];let n=hfe(e+1,0);return n[0]=t,kfe.polynomial(n)},degree:e=>e.length-1,coefficient:(e,t)=>e[kfe.degree(e)-t],mulPoly(e,t){if(0===e[0]||0===t[0])return[0];const n=hfe(e.length+t.length-1,0);for(let r=0;r<e.length;r++)for(let i=0;i<t.length;i++)n[r+i]=kfe.add(n[r+i],kfe.mul(e[r],t[i]));return kfe.polynomial(n)},mulPolyScalar(e,t){if(0==t)return[0];if(1==t)return e;const n=hfe(e.length,0);for(let r=0;r<e.length;r++)n[r]=kfe.mul(e[r],t);return kfe.polynomial(n)},mulPolyMonomial(e,t,n){if(t<0)throw new Error("GF.mulPolyMonomial: wrong degree");if(0==n)return[0];const r=hfe(e.length+t,0);for(let i=0;i<e.length;i++)r[i]=kfe.mul(e[i],n);return kfe.polynomial(r)},addPoly(e,t){if(0===e[0])return t;if(0===t[0])return e;let n=e,r=t;n.length>r.length&&([n,r]=[r,n]);let i=hfe(r.length,0),o=r.length-n.length,s=r.slice(0,o);for(let a=0;a<s.length;a++)i[a]=s[a];for(let a=o;a<r.length;a++)i[a]=kfe.add(n[a-o],r[a]);return kfe.polynomial(i)},remainderPoly(e,t){const n=Array.from(e);for(let r=0;r<e.length-t.length+1;r++){const e=n[r];if(0!==e)for(let i=1;i<t.length;i++)0!==t[i]&&(n[r+i]=kfe.add(n[r+i],kfe.mul(t[i],e)))}return n.slice(e.length-t.length+1,n.length)},divisorPoly(e){let t=[1];for(let n=0;n<e;n++)t=kfe.mulPoly(t,[1,kfe.pow(2,n)]);return t},evalPoly(e,t){if(0==t)return kfe.coefficient(e,0);let n=e[0];for(let r=1;r<e.length;r++)n=kfe.add(kfe.mul(t,n),e[r]);return n},euclidian(e,t,n){kfe.degree(e)<kfe.degree(t)&&([e,t]=[t,e]);let r=e,i=t,o=[0],s=[1];for(;2*kfe.degree(i)>=n;){let e=r,t=o;if(r=i,o=s,0===r[0])throw new Error("rLast[0] === 0");i=e;let n=[0];const a=kfe.inv(r[0]);for(;kfe.degree(i)>=kfe.degree(r)&&0!==i[0];){const e=kfe.degree(i)-kfe.degree(r),t=kfe.mul(i[0],a);n=kfe.addPoly(n,kfe.monomial(e,t)),i=kfe.addPoly(i,kfe.mulPolyMonomial(r,e,t))}if(n=kfe.mulPoly(n,o),s=kfe.addPoly(n,t),kfe.degree(i)>=kfe.degree(r))throw new Error(`Division failed r: ${i}, rLast: ${r}`)}const a=kfe.coefficient(s,0);if(0==a)throw new Error("sigmaTilde(0) was zero");const c=kfe.inv(a);return[kfe.mulPolyScalar(s,c),kfe.mulPolyScalar(i,c)]}};function Sfe(e,t,n,r){let i="",o=n.length;if("numeric"===r){const e=_fe.alphabet.numeric.decode(n.split("")),t=e.length;for(let n=0;n<t-2;n+=3)i+=ufe(100*e[n]+10*e[n+1]+e[n+2],10);t%3==1?i+=ufe(e[t-1],4):t%3==2&&(i+=ufe(10*e[t-2]+e[t-1],7))}else if("alphanumeric"===r){const e=_fe.alphabet.alphanumerc.decode(n.split("")),t=e.length;for(let n=0;n<t-1;n+=2)i+=ufe(45*e[n]+e[n+1],11);t%2==1&&(i+=ufe(e[t-1],6))}else{if("byte"!==r)throw new Error("encode: unsupported type");{const e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(n);o=e.length,i=Array.from(e).map(e=>ufe(e,8)).join("")}}const{capacity:s}=_fe.capacity(e,t),a=ufe(o,_fe.lengthBits(e,r));let c=_fe.modeBits[r]+a+i;if(c.length>s)throw new Error("Capacity overflow");c+="0".repeat(Math.min(4,Math.max(0,s-c.length))),c.length%8&&(c+="0".repeat(8-c.length%8));for(let u=0;c.length!==s;u++)c+="1110110000010001"[u%16];const l=Uint8Array.from(c.match(/(.{8})/g).map(e=>Number(`0b${e}`)));return function(e,t){const{words:n,shortBlocks:r,numBlocks:i,blockLen:o,total:s}=_fe.capacity(e,t),a=(c=n,{encode(e){const t=kfe.divisorPoly(c),n=Array.from(e);return n.push(...t.slice(0,-1).fill(0)),Uint8Array.from(kfe.remainderPoly(n,t))},decode(e){const t=e.slice(),n=kfe.polynomial(Array.from(e));let r=hfe(c,0),i=!1;for(let d=0;d<c;d++){const e=kfe.evalPoly(n,kfe.exp(d));r[r.length-1-d]=e,0!==e&&(i=!0)}if(!i)return t;r=kfe.polynomial(r);const o=kfe.monomial(c,1),[s,a]=kfe.euclidian(o,r,c),l=hfe(kfe.degree(s),0);let u=0;for(let c=1;c<256&&u<l.length;c++)0===kfe.evalPoly(s,c)&&(l[u++]=kfe.inv(c));if(u!==l.length)throw new Error("RS.decode: wrong errors number");for(let c=0;c<l.length;c++){const e=t.length-1-kfe.log(l[c]);if(e<0)throw new Error("RS.decode: wrong error location");const n=kfe.inv(l[c]);let r=1;for(let t=0;t<l.length;t++)c!==t&&(r=kfe.mul(r,kfe.add(1,kfe.mul(l[t],n))));t[e]=kfe.add(t[e],kfe.mul(kfe.evalPoly(a,n),kfe.inv(r)))}return t}});var c;return{encode(e){const t=[],n=[];for(let u=0;u<i;u++){const i=o+(u<r?0:1);t.push(e.subarray(0,i)),n.push(a.encode(e.subarray(0,i))),e=e.subarray(i)}const s=ffe(...t),c=ffe(...n),l=new Uint8Array(s.length+c.length);return l.set(s),l.set(c,s.length),l},decode(e){if(e.length!==s)throw new Error(`interleave.decode: len(data)=${e.length}, total=${s}`);const t=[];for(let s=0;s<i;s++){const e=s<r;t.push(new Uint8Array(n+o+(e?0:1)))}let c=0;for(let n=0;n<o;n++)for(let r=0;r<i;r++)t[r][n]=e[c++];for(let n=r;n<i;n++)t[n][o]=e[c++];for(let s=o;s<o+n;s++)for(let n=0;n<i;n++){const i=n<r;t[n][s+(i?0:1)]=e[c++]}const l=[];for(const r of t)l.push(...Array.from(a.decode(r)).slice(0,-n));return Uint8Array.from(l)}}}(e,t).encode(l)}function Cfe(e,t,n,r,i=!1){const o=function(e,t,n,r=!1){const i=_fe.size.encode(e);let o=new gfe(i+2);const s=new gfe(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);o=o.embed(0,s).embed({x:-s.width,y:0},s).embed({x:0,y:-s.height},s),o=o.rectSlice(1,i);const a=new gfe(1).rect(0,1,!0).border(1,!1).border(1,!0),c=_fe.alignmentPatterns(e);for(const l of c)for(const e of c)void 0===o.data[l][e]&&o.embed({x:e-2,y:l-2},a);o=o.hLine({x:0,y:6},1/0,({x:e},t)=>void 0===t?e%2==0:t).vLine({x:6,y:0},1/0,({y:e},t)=>void 0===t?e%2==0:t);{const e=_fe.formatBits(t,n),s=t=>!r&&1==(e>>t&1);for(let t=0;t<6;t++)o.data[t][8]=s(t);for(let t=6;t<8;t++)o.data[t+1][8]=s(t);for(let t=8;t<15;t++)o.data[i-15+t][8]=s(t);for(let t=0;t<8;t++)o.data[8][i-t-1]=s(t);for(let t=8;t<9;t++)o.data[8][15-t-1+1]=s(t);for(let t=9;t<15;t++)o.data[8][15-t-1]=s(t);o.data[i-8][8]=!r}if(e>=7){const t=_fe.versionBits(e);for(let e=0;e<18;e+=1){const n=!r&&1==(t>>e&1),s=Math.floor(e/3),a=e%3+i-8-3;o.data[s][a]=n,o.data[a][s]=n}}return o}(e,t,r,i);let s=0;const a=8*n.length;if(function(e,t,n){const r=e.height,i=xfe[t];let o=-1,s=r-1;for(let a=r-1;a>0;a-=2){for(6==a&&(a=5);;s+=o){for(let t=0;t<2;t+=1){const r=a-t;void 0===e.data[s][r]&&n(r,s,i(r,s))}if(s+o<0||s+o>=r)break}o=-o}}(o,r,(e,t,r)=>{let i=!1;s<a&&(i=!!(n[s>>>3]>>(7-s&7)&1),s++),o.data[t][e]=i!==r}),s!==a)throw new Error("QR: bytes left after draw");return o}function Ife(e){const t=e.inverse(),n=e=>{let t=0;for(let n,r=0,i=1;r<e.length;r++)n===e[r]&&(i++,r!==e.length-1)||(i>=5&&(t+=i-5+3),n=e[r],i=1);return t};let r=0;e.data.forEach(e=>r+=n(e)),t.data.forEach(e=>r+=n(e));let i=0,o=e.data;const s=e.width-1,a=e.height-1;for(let f=0;f<s;f++)for(let e=0;e<a;e++){const t=f+1,n=e+1;o[f][e]===o[t][e]&&o[t][e]===o[f][n]&&o[t][e]===o[t][n]&&(i+=3)}const c=e=>{const t=[!0,!1,!0,!0,!0,!1,!0],n=[!1,!1,!1,!1],r=[...t,...n],i=[...n,...t];let o=0;for(let s=0;s<e.length;s++)pfe(e,r,s)&&(o+=40),pfe(e,i,s)&&(o+=40);return o};let l=0;for(const f of e.data)l+=c(f);for(const f of t.data)l+=c(f);let u=0;e.rectRead(0,1/0,(e,t)=>u+=t?1:0);const d=u/(e.height*e.width)*100,h=10*Math.floor(Math.abs(d-50)/5);return r+i+l+h}function Afe(e,t="raw",n={}){const r=void 0!==n.ecc?n.ecc:"medium";!function(e){if(!yfe.includes(e))throw new Error(`Invalid error correction mode=${e}. Expected: ${yfe}`)}(r);const i=void 0!==n.encoding?n.encoding:function(e){let t="numeric";for(let n of e)if(!_fe.alphabet.numeric.has(n)&&(t="alphanumeric",!_fe.alphabet.alphanumerc.has(n)))return"byte";return t}(e);!function(e){if(!bfe.includes(e))throw new Error(`Encoding: invalid mode=${e}. Expected: ${bfe}`);if("kanji"===e||"eci"===e)throw new Error(`Encoding: ${e} is not supported (yet?).`)}(i),void 0!==n.mask&&function(e){if(![0,1,2,3,4,5,6,7].includes(e)||!xfe[e])throw new Error(`Invalid mask=${e}. Expected number [0..7]`)}(n.mask);let o,s=n.version,a=new Error("Unknown error");if(void 0!==s)!function(e){if(!Number.isSafeInteger(e)||e<1||e>40)throw new Error(`Invalid version=${e}. Expected number [1..40]`)}(s),o=Sfe(s,r,e,i);else for(let d=1;d<=40;d++)try{o=Sfe(d,r,e,i),s=d;break}catch(u){a=u}if(!s||!o)throw a;let c=function(e,t,n,r){if(void 0===r){const i=function(){let e,t=1/0;return{add(n,r){n>=t||(e=r,t=n)},get:()=>e,score:()=>t}}();for(let r=0;r<xfe.length;r++)i.add(Ife(Cfe(e,t,n,r,!0)),r);r=i.get()}if(void 0===r)throw new Error("Cannot find mask");return Cfe(e,t,n,r)}(s,r,o,n.mask);c.assertDrawn();const l=void 0===n.border?2:n.border;if(!Number.isSafeInteger(l))throw new Error("Wrong border type="+typeof l);if(c=c.border(l,!1),void 0!==n.scale&&(c=c.scale(n.scale)),"raw"===t)return c.data;if("ascii"===t)return c.toASCII();if("svg"===t)return c.toSVG();if("gif"===t)return c.toGIF();if("term"===t)return c.toTerm();throw new Error(`Unknown output: ${t}`)}const Pfe={DESKTOP:"Desktop",MOBILE:"Mobile",META_MASK_MOBILE_APP:"MetaMask mobile app",SCAN_TO_CONNECT:"Scan to connect and sign with",CONNECT_WITH_EXTENSION:"Connect With MetaMask Extension",INSTALL_MODAL:{TRUSTED_BY_USERS:"Trusted by over 30 million users to buy, store, send and swap crypto securely",LEADING_CRYPTO_WALLET:"The leading crypto wallet & gateway to blockchain apps built on Ethereum Mainnet, Polygon, Optimism, and many other networks",CONTROL_DIGITAL_INTERACTIONS:"Puts you in control of your digital interactions by making power of cryptography more accessible",INSTALL_META_MASK_EXTENSION:"Install MetaMask Extension"},PENDING_MODAL:{OPEN_META_MASK_SELECT_CODE:"Please open the MetaMask wallet app and select the code on the screen OR disconnect",OPEN_META_MASK_CONTINUE:"Open the MetaMask app to continue with your session.",NUMBER_AFTER_OPEN_NOTICE:"If a number doesn't appear after opening MetaMask, please click disconnect and re-scan the QRCode.",DISCONNECT:"Disconnect"},SELECT_MODAL:{CRYPTO_TAKE_CONTROL_TEXT:"Take control of your crypto and explore the blockchain with the wallet trusted by over 30 million people worldwide"},META_MASK_MODAL:{ADDRESS_COPIED:"Address copied to clipboard!",DISCONNECT:"Disconnect",ACTIVE_NETWORK:"Active Network"}};class Mfe{constructor(e){var t;this.translations=Pfe,this.supportedLocales=["es","fr","he","it","pt","tr"],this.baseUrl=null!==(t=null==e?void 0:e.baseUrl)&&void 0!==t?t:"https://raw.githubusercontent.com/MetaMask/metamask-sdk/refs/heads/gh-pages/locales"}getBrowserLanguage(){if((navigator.languages||[navigator.language]).some(e=>e.toLowerCase().startsWith("en")))return"en";const e=navigator.language.toLowerCase().split("-")[0];return this.supportedLocales.includes(e)?e:"en"}async init(e){const t=this.getBrowserLanguage()||e.fallbackLng;await this.loadTranslations(t)}async loadTranslations(e){const t=e.split("-")[0];if("en"!==t&&this.supportedLocales.includes(t))try{const e=`${this.baseUrl}/${t}.json`,n=await fetch(e);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);this.translations=await n.json()}catch(n){console.warn(`❌ Failed to load ${t} translations, falling back to English:`,n),this.translations=Pfe}else this.translations=Pfe}t(e){return this.getNestedTranslation(e,this.translations)||e}getNestedTranslation(e,t){const n=e.split(".");let r=t;for(const i of n){if("object"!=typeof r)return"";r=r[i]}return"string"==typeof r?r:""}}var Ofe;!function(e){e.SDK_MODAL_VIEWED="sdk_modal_viewed",e.SDK_MODAL_BUTTON_CLICKED="sdk_modal_button_clicked",e.SDK_MODAL_TOGGLE_CHANGED="sdk_modal_toggle_changed"}(Ofe||(Ofe={}));const Tfe=class{constructor(e){$de(this,e),this.close=whe(this,"close"),this.startDesktopOnboarding=whe(this,"startDesktopOnboarding"),this.trackAnalytics=whe(this,"trackAnalytics"),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.onClose=this.onClose.bind(this),this.onStartDesktopOnboardingHandler=this.onStartDesktopOnboardingHandler.bind(this),this.setTab=this.setTab.bind(this),this.render=this.render.bind(this),this.setTab(this.preferDesktop?1:2),this.i18nInstance=new Mfe}componentDidLoad(){this.trackAnalytics.emit({event:Ofe.SDK_MODAL_VIEWED,params:{extensionInstalled:!1,tab:1===this.tab?"desktop":"mobile"}})}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}updatePreferDesktop(e){e?this.setTab(1):this.setTab(2)}onClose(e=!1){this.close.emit({shouldTerminate:e})}onStartDesktopOnboardingHandler(){this.trackAnalytics.emit({event:Ofe.SDK_MODAL_BUTTON_CLICKED,params:{button_type:"install_extension",tab:"desktop"}}),this.startDesktopOnboarding.emit()}setTab(e,t=!1){t&&this.trackAnalytics.emit({event:Ofe.SDK_MODAL_TOGGLE_CHANGED,params:{toggle:1===this.tab?"desktop_to_mobile":"mobile_to_desktop"}}),this.tab=e,this.isDefaultTab=!1}render(){if(!this.translationsLoaded)return null;const e=e=>this.i18nInstance.t(e),t=this.isDefaultTab?this.preferDesktop?1:2:this.tab,n=Afe(this.link,"svg",{ecc:"medium",scale:2});return fhe(tfe,{className:"install-model"},fhe("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),fhe("div",{class:"modal"},fhe("div",{class:"closeButtonContainer"},fhe("div",{class:"right"},fhe("span",{class:"closeButton",onClick:()=>this.onClose(!0)},fhe(cfe,null)))),fhe("div",{class:"logoContainer"},fhe(lfe,null)),fhe("div",null,fhe("div",{class:"tabcontainer"},fhe("div",{class:"flexContainer"},fhe("div",{onClick:()=>this.setTab(1,!0),class:"tab flexItem "+(1===t?"tabactive":"")},e("DESKTOP")),fhe("div",{onClick:()=>this.setTab(2,!0),class:"tab flexItem "+(2===t?"tabactive":"")},e("MOBILE")))),fhe("div",{style:{display:1===t?"none":"block"}},fhe("div",{class:"flexContainer"},fhe("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},n&&fhe("div",{id:"sdk-mm-qrcode",class:"center",innerHTML:n}),fhe("div",{class:"connectMobileText"},e("SCAN_TO_CONNECT")," ",fhe("br",null),fhe("span",{class:"blue"},fhe("b",null,e("META_MASK_MOBILE_APP"))))))),fhe("div",{style:{display:2===t?"none":"block"}},fhe("div",{class:"item"},fhe(nfe,{Icon:ife,text:e("INSTALL_MODAL.TRUSTED_BY_USERS")})),fhe("div",{class:"item"},fhe(nfe,{Icon:rfe,text:e("INSTALL_MODAL.LEADING_CRYPTO_WALLET")})),fhe("div",{class:"item"},fhe(nfe,{Icon:ofe,text:e("INSTALL_MODAL.CONTROL_DIGITAL_INTERACTIONS")})),fhe("button",{class:"button",onClick:()=>this.onStartDesktopOnboardingHandler()},fhe(sfe,null),fhe("span",{class:"installExtensionText"},e("INSTALL_MODAL.INSTALL_META_MASK_EXTENSION"))))),fhe(afe,{version:this.sdkVersion})))}get el(){return vhe(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Tfe.style=".flexContainer {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.flexItem {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem11 {\n flex: 11;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem1 {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.tab {\n padding: 8px;\n cursor: pointer;\n background-color: #F2F4F6;\n font-size: 12px;\n text-align: center;\n color: #24292E;\n}\n\n.tabcontainer {\n padding: 4px;\n background-color: #F2F4F6;\n border-radius: 8px;\n margin-bottom: 30px;\n margin-top: 30px;\n}\n\n.tabactive {\n background-color: white;\n -webkit-transition: background-color 300ms linear;\n -ms-transition: background-color 300ms linear;\n transition: background-color 300ms linear;\n border-radius: 8px;\n}\n\n.item {\n font-size: 12px;\n margin-bottom: 16px;\n border-radius: 8px;\n padding: 10px;\n border: 2px #F2F4F6 solid;\n color: #24292E;\n}\n\n.extensionLabel {\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n text-align: cetner;\n color: #24272A;\n}\n\n.notice {\n font-size: 12px;\n margin-left: 10px;\n margin-right: 10px;\n color: grey;\n}\n\n.button {\n margin-top: 41.5px;\n margin-bottom: 20px;\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 12px 20px;\n background: #037DD6;\n border-radius: 32px;\n color: white;\n border: 0;\n font-size: 14px;\n cursor: pointer;\n}\n\n.backdrop {\n visibility: visible;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n z-index: 99998;\n background: rgba(0, 0, 0, 0.87);\n opacity: 0.3;\n}\n\n.modal {\n visibility: visible;\n position: fixed;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99999;\n background: white;\n padding: 20px;\n border-radius: 8px;\n top: 50%;\n max-width: 100%;\n width: 460px;\n min-width: 300px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n color: #BBC0C5;\n cursor: pointer;\n}\n\n.logoContainer {\n margin-left: 24px;\n margin-right: 24px;\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.connectMobileText {\n font-size: 14px;\n color: black;\n margin-top: 28px;\n margin-bottom: 28px;\n line-height: 2;\n}\n\n.blue {\n color: #037DD6;\n font-weight: 700;\n}\n\n.installExtensionText {\n margin-left: 10px;\n}\n\n.center {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.right {\n display: flex;\n align-items: center;\n justify-content: right;\n}\n\n#sdk-mm-qrcode {\n svg {\n width: 50%;\n }\n}";const Rfe=class{constructor(e){$de(this,e),this.close=whe(this,"close"),this.disconnect=whe(this,"disconnect"),this.updateOTPValue=whe(this,"updateOTPValue"),this.displayOTP=void 0,this.sdkVersion=void 0,this.otpCode=void 0,this.translationsLoaded=!1,this.i18nInstance=new Mfe}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(){this.close.emit()}onDisconnect(){this.disconnect.emit()}onUpdateOTPValueHandler(e){this.updateOTPValue.emit({otpValue:e})}disconnectedCallback(){this.onClose()}render(){var e;if(!this.translationsLoaded)return null;const t=null===(e=this.displayOTP)||void 0===e||e,n=this.sdkVersion,r=e=>this.i18nInstance.t(e);return fhe(tfe,{className:"pending-modal"},fhe("div",{class:"backdrop",onClick:()=>this.onClose()}),fhe("div",{class:"modal"},fhe("div",{class:"closeButtonContainer"},fhe("div",{class:"right"},fhe("span",{class:"closeButton",onClick:()=>this.onClose()},fhe(cfe,null)))),fhe("div",{class:"logoContainer"},fhe(lfe,null)),fhe("div",null,fhe("div",{class:"flexContainer",style:{flexDirection:"column",color:"black"}},fhe("div",{class:"flexItem",style:{textAlign:"center",marginTop:"30px",marginBottom:"30px",fontSize:"16px"}},r(t?"PENDING_MODAL.OPEN_META_MASK_SELECT_CODE":"PENDING_MODAL.OPEN_META_MASK_CONTINUE")),fhe("div",{id:"sdk-mm-otp-value",style:{padding:"10px",fontSize:"32px",display:this.otpCode?"block":"none"}},this.otpCode),t&&fhe("div",{class:"notice"},"* ",r("PENDING_MODAL.NUMBER_AFTER_OPEN_NOTICE"))),fhe("div",{style:{marginTop:"20px"}},fhe("button",{class:"button blue",style:{marginTop:"5px",color:"#0376C9",borderColor:"#0376C9",borderWidth:"1px",borderStyle:"solid",backgroundColor:"white"},onClick:()=>this.onDisconnect()},r("PENDING_MODAL.DISCONNECT")))),fhe(afe,{version:n})))}get el(){return vhe(this)}};Rfe.style=".flexContainer {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.flexItem {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem11 {\n flex: 11;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem1 {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.tab {\n padding: 8px;\n cursor: pointer;\n background-color: #F2F4F6;\n font-size: 12px;\n text-align: center;\n color: #24292E;\n}\n\n.tabcontainer {\n padding: 4px;\n background-color: #F2F4F6;\n border-radius: 8px;\n margin-bottom: 30px;\n margin-top: 30px;\n}\n\n.tabactive {\n background-color: white;\n -webkit-transition: background-color 300ms linear;\n -ms-transition: background-color 300ms linear;\n transition: background-color 300ms linear;\n border-radius: 8px;\n}\n\n.item {\n font-size: 12px;\n margin-bottom: 16px;\n border-radius: 8px;\n padding: 10px;\n border: 2px #F2F4F6 solid;\n color: #24292E;\n}\n\n.extensionLabel {\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n text-align: cetner;\n color: #24272A;\n}\n\n.notice {\n font-size: 12px;\n margin-left: 10px;\n margin-right: 10px;\n color: grey;\n}\n\n.button {\n margin-top: 41.5px;\n margin-bottom: 20px;\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 12px 20px;\n background: #037DD6;\n border-radius: 32px;\n color: white;\n border: 0;\n font-size: 14px;\n cursor: pointer;\n}\n\n.backdrop {\n visibility: visible;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n z-index: 99998;\n background: rgba(0, 0, 0, 0.87);\n opacity: 0.3;\n}\n\n.modal {\n visibility: visible;\n position: fixed;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99999;\n background: white;\n padding: 20px;\n border-radius: 8px;\n top: 50%;\n max-width: 100%;\n width: 460px;\n min-width: 300px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n color: #BBC0C5;\n cursor: pointer;\n}\n\n.logoContainer {\n margin-left: 24px;\n margin-right: 24px;\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.connectMobileText {\n font-size: 14px;\n color: black;\n margin-top: 28px;\n margin-bottom: 28px;\n line-height: 2;\n}\n\n.blue {\n color: #037DD6;\n font-weight: 700;\n}\n\n.installExtensionText {\n margin-left: 10px;\n}\n\n.center {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.right {\n display: flex;\n align-items: center;\n justify-content: right;\n}\n\n#sdk-mm-qrcode {\n svg {\n width: 50%;\n }\n}";const Nfe=()=>fhe("svg",{width:"21",height:"15",viewBox:"0 0 21 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M14.1364 14.9851C13.5909 14.9851 13.2273 14.5851 13.2273 13.9851C13.2273 13.3851 13.5909 12.9851 14.1364 12.9851C16.6818 12.9851 18.6818 10.7851 18.6818 7.98508C18.6818 5.18508 16.6818 2.98508 14.1364 2.98508C11.5909 2.98508 9.59091 5.18508 9.59091 7.98508C9.59091 8.58508 9.22727 8.98508 8.68182 8.98508C8.13636 8.98508 7.77273 8.58508 7.77273 7.98508C7.77273 4.08508 10.5909 0.985077 14.1364 0.985077C17.6818 0.985077 20.5 4.08508 20.5 7.98508C20.5 11.8851 17.6818 14.9851 14.1364 14.9851ZM6.68182 14.7851C3.22727 14.7851 0.5 11.6851 0.5 7.98508C0.5 4.28508 3.22727 1.18508 6.68182 1.18508C7.22727 1.18508 7.59091 1.58508 7.59091 2.18508C7.59091 2.78508 7.22727 3.18508 6.68182 3.18508C4.22727 3.18508 2.31818 5.38508 2.31818 7.98508C2.31818 10.5851 4.22727 12.7851 6.68182 12.7851C9.13636 12.7851 11.0455 10.6851 11.0455 7.98508C11.0455 7.38508 11.4091 6.98508 11.9545 6.98508C12.5 6.98508 12.8636 7.38508 12.8636 7.98508C12.7727 11.6851 10.0455 14.7851 6.68182 14.7851Z",fill:"white"})),Lfe=()=>fhe("svg",{width:"400",height:"300",viewBox:"0 0 467 300",fill:"none",xmlns:"http://www.w3.org/2000/svg"},fhe("path",{d:"M312.387 280.629C312.549 280.583 312.247 280.735 312.387 280.629L339.678 260.425C340.088 260.118 340.132 259.156 340.07 258.647C340.008 258.138 339.573 258.257 339.106 258.084L311.712 247.455C311.292 247.301 311.308 247.402 310.939 247.673C310.569 247.944 310.356 248.21 310.356 248.672L310.459 279.504C310.461 280.025 311.163 280.619 311.614 280.847C311.913 280.996 312.072 280.718 312.387 280.629ZM336.204 259.736L312.979 276.292L313.439 251.139L336.204 259.736Z",fill:"url(#paint0_linear_1356_14057)"}),fhe("path",{d:"M324.639 260.342C324.358 259.547 323.485 258.91 322.707 259.215C319.6 260.432 318.17 262.313 317.287 264.066C316.482 265.665 316.197 267.482 314.188 268.269C312.178 269.055 310.763 268.663 309.162 268.007C307.406 267.287 305.504 266.182 302.397 267.399C299.289 268.616 297.859 270.497 296.976 272.25C296.171 273.849 295.697 274.886 293.685 275.673C291.675 276.459 290.261 276.067 288.659 275.411C286.903 274.691 284.999 273.587 281.894 274.803C278.789 276.019 277.549 278.681 276.666 280.434C275.861 282.034 275.386 283.07 273.374 283.857C272.596 284.161 271.931 285.055 272.211 285.849C272.492 286.644 273.365 287.281 274.143 286.977C277.25 285.76 278.68 283.879 279.563 282.125C280.368 280.526 280.65 278.71 282.662 277.923C284.672 277.136 286.087 277.528 287.688 278.184C289.444 278.904 291.348 280.009 294.453 278.793C297.561 277.576 298.991 275.695 299.874 273.941C300.679 272.342 301.153 271.306 303.165 270.519C305.175 269.732 306.589 270.124 308.191 270.78C309.947 271.5 311.849 272.605 314.956 271.388C318.063 270.172 319.301 267.511 320.184 265.757C320.989 264.158 321.466 263.121 323.476 262.335C324.254 262.032 324.919 261.137 324.639 260.342Z",fill:"url(#paint1_linear_1356_14057)"}),fhe("path",{d:"M389.034 111.124C388.968 112.406 387.342 113.113 386.324 113.549C384.297 114.419 382.089 114.493 379.942 114.5C376.607 114.509 373.215 114.163 369.89 113.976C366.712 113.798 363.156 113.311 360.03 114.232C357.705 114.919 355.667 116.762 353.452 117.739C351.129 118.765 348.957 119.198 346.489 119.687C335.569 121.85 323.587 120.825 312.656 119.977C311.92 119.92 312.539 118.997 313.237 118.981C313.207 118.815 313.001 118.394 313.045 118.201C313.086 118.029 312.781 117.586 312.853 117.421C312.67 117.198 313.316 117.427 313.626 117.204C315.912 115.557 318.721 114.79 321.363 115.041C324.677 115.355 327.293 116.04 330.641 115.781C334.392 115.491 338.125 114.787 341.857 114.312C345.142 113.892 349.09 113.941 352.106 112.28C352.916 111.834 353.137 111.262 353.269 110.287C353.331 109.828 353.672 108.969 353.658 108.511C353.629 107.529 354.191 107.886 355.013 107.298C356.857 105.981 358.274 105.516 360.428 105.784C362.841 106.083 365.264 107.273 367.578 107.953C370.761 108.888 374.328 108.646 377.631 108.477C380.517 108.329 383.141 107.901 385.944 108.653C387.013 108.941 389.104 109.745 389.034 111.124Z",fill:"url(#paint2_linear_1356_14057)"}),fhe("path",{d:"M278.118 85.4414C280.313 83.8186 283.302 83.9 285.853 83.2728C290.501 82.127 295.644 78.4476 300.549 79.1524C301.299 79.2595 300.904 81.0355 300.159 80.9295C300.131 80.9256 300.187 80.9333 300.159 80.9295C300.089 81.0185 299.516 81.1051 299.385 81.1463C294.999 82.515 292.895 87.5083 289.126 89.8598C287.799 90.688 286.771 90.8351 285.258 90.9441C283.515 91.0691 280.964 90.5775 279.269 90.1219C277.15 89.5532 275.965 87.034 278.118 85.4414Z",fill:"url(#paint3_linear_1356_14057)"}),fhe("path",{d:"M122.567 166.093C113.597 172.832 104.535 179.836 99.517 190.092C98.5342 192.099 97.519 195.019 97.9533 197.204C98.9699 202.316 105.76 203.049 110.691 201.96C113.468 201.347 116.325 199.231 115.921 196.319C115.576 193.81 113.158 192.986 112.072 190.73C110.779 188.04 112.35 184.97 114.218 182.62C128.134 165.099 150.074 157.394 171.093 151.607C175.385 150.425 180.897 147.69 180.581 143.099C180.372 140.072 177.118 137.683 174.221 137.383C171.324 137.082 168.481 138.773 165.715 139.776C158.416 142.419 151.17 143.799 143.489 143.526C136.865 143.29 130.976 143.316 129.562 150.781C128.138 158.276 129.53 160.863 122.567 166.093Z",fill:"url(#paint4_linear_1356_14057)"}),fhe("path",{d:"M79.1056 153.531C60.3932 164.378 43.7478 178.354 32.8214 197.415C30.3313 201.76 27.9216 206.554 27.1821 211.512C26.4448 216.47 27.7591 222.525 30.8133 226.337C34.908 231.446 41.6938 232.915 48.1811 233.125C50.7248 233.208 53.0035 233.066 55.3316 231.947C57.6602 230.83 59.7548 228.359 59.5978 225.742C59.3303 221.315 54.5491 219.665 50.9271 217.34C42.6566 212.037 40.4958 199.493 44.2381 190.032C47.9803 180.57 55.8228 173.173 63.2316 166.338C67.229 162.651 71.5194 158.372 76.777 157.522C79.9167 157.015 83.4706 157.589 86.6295 157.252C93.9004 156.479 99.64 151.404 105.588 146.912C115.048 139.765 126.045 134.283 137.501 132.093C141.913 131.248 146.293 130.493 149.682 127.831C151.37 126.507 150.803 123.567 148.726 123.93C138.542 125.713 128.652 131.135 119.142 134.758C105.627 139.914 91.7133 146.223 79.1056 153.531Z",fill:"url(#paint5_linear_1356_14057)"}),fhe("path",{d:"M96.3677 117.321C96.0315 116.64 95.2914 116.612 94.6293 116.975C91.9858 118.417 91.5452 120.509 90.9466 122.178C90.4004 123.702 89.3647 124.67 87.6542 125.604C85.9437 126.538 85.0983 126.316 83.5956 125.91C81.9481 125.465 79.8603 125.424 77.2168 126.866C74.5734 128.309 74.1348 130.401 73.5341 132.07C72.9879 133.593 71.9522 134.562 70.2417 135.496C68.5313 136.43 67.6859 136.208 66.1832 135.801C64.5357 135.357 62.2569 134.538 59.6128 135.978C56.9694 137.42 56.5308 139.512 55.9301 141.181C55.3839 142.705 54.5398 144.454 52.8293 145.388C52.1667 145.748 52.1006 146.485 52.439 147.165C52.7752 147.845 53.5153 147.874 54.1773 147.511C56.8208 146.069 57.2594 143.977 57.86 142.307C58.4062 140.784 59.4419 139.815 61.1524 138.881C62.8629 137.948 63.7083 138.17 65.211 138.576C66.8585 139.021 68.9458 139.059 71.5898 137.619C74.2333 136.177 74.6718 134.085 75.2725 132.416C75.8187 130.892 76.8544 129.924 78.5649 128.99C80.2754 128.056 81.1207 128.278 82.6235 128.684C84.2709 129.129 86.5503 129.95 89.1938 128.507C91.8373 127.065 92.2779 124.973 92.8765 123.304C93.4227 121.78 94.2663 120.03 95.9773 119.098C96.6378 118.738 96.7039 118.001 96.3677 117.321Z",fill:"#FBC49D"}),fhe("path",{d:"M391.827 164.699C392.04 164.639 392.39 164.573 392.6 164.481C393.87 163.921 395.363 162.429 395.893 161.051C396.421 159.673 396.237 158.321 395.712 156.931C394.629 154.061 391.777 152.62 389.155 153.775C386.531 154.931 384.962 158.455 386.042 161.325C387.038 163.963 389.369 165.392 391.827 164.699ZM394.166 157.367C394.529 158.332 394.52 159.751 394.156 160.706C393.792 161.662 393.1 162.534 392.218 162.921C390.398 163.723 388.338 162.878 387.589 160.889C387.226 159.925 387.234 158.506 387.599 157.55C387.963 156.594 388.654 155.723 389.536 155.336C391.356 154.534 393.416 155.376 394.166 157.367Z",fill:"#86E29B"}),fhe("path",{d:"M62.7198 108.691C64.4912 108.191 66.6152 106.609 67.5596 104.824C68.4273 103.187 68.465 101.455 67.9609 99.7066C67.4547 97.9586 66.0792 96.5141 64.4963 95.6786C62.9135 94.843 61.2077 94.8578 59.4756 95.4255C57.7435 95.9933 56.2768 97.4364 55.409 99.074C53.6185 102.456 55.2032 106.494 58.4723 108.22C60.0142 109.035 61.1315 109.138 62.7198 108.691ZM60.6304 96.7682C61.819 96.4332 63.0232 96.8871 64.1048 97.4571C65.2463 98.0603 66.0495 98.8796 66.4145 100.142C66.7791 101.403 66.4488 103.299 65.8224 104.48C64.5299 106.919 61.2212 107.686 58.8638 106.441C56.5063 105.197 55.8538 101.858 57.1462 99.4185C57.7726 98.2375 58.6059 97.3957 59.8573 96.9862C59.9214 96.9635 60.5631 96.7872 60.6304 96.7682Z",fill:"#FFB0EB"}),fhe("path",{d:"M77.0217 242.979C75.9542 243.28 75.1664 242.151 74.9029 241.074C74.6394 239.996 75 239.378 76.0676 239.077C77.1351 238.776 78.5053 238.907 78.7688 239.984C79.0323 241.061 78.0893 242.678 77.0217 242.979Z",fill:"url(#paint6_linear_1356_14057)"}),fhe("path",{d:"M380.506 184.577C379.439 184.878 378.651 183.749 378.387 182.672C378.124 181.594 378.484 180.976 379.552 180.675C380.619 180.374 381.99 180.505 382.253 181.582C382.517 182.659 381.574 184.276 380.506 184.577Z",fill:"url(#paint7_linear_1356_14057)"}),fhe("path",{d:"M348.82 246.969C347.752 247.27 346.382 247.14 346.119 246.063C345.855 244.985 346.798 243.369 347.866 243.068C348.933 242.767 349.721 243.896 349.985 244.973C350.248 246.05 349.888 246.669 348.82 246.969Z",fill:"url(#paint8_linear_1356_14057)"}),fhe("path",{d:"M140.419 282.412C139.351 282.713 138.754 282.365 138.491 281.288C138.227 280.21 138.397 278.812 139.464 278.511C140.532 278.21 142.093 279.121 142.357 280.198C142.62 281.275 141.486 282.111 140.419 282.412Z",fill:"url(#paint9_linear_1356_14057)"}),fhe("path",{d:"M121.462 101.679C120.395 101.979 119.798 101.631 119.534 100.554C119.271 99.4764 119.44 98.0779 120.508 97.777C121.575 97.4761 123.136 98.3868 123.4 99.4642C123.663 100.542 122.53 101.378 121.462 101.679Z",fill:"url(#paint10_linear_1356_14057)"}),fhe("path",{d:"M370.749 159.005C369.682 159.306 368.311 159.175 368.048 158.098C367.784 157.021 368.727 155.404 369.795 155.103C370.863 154.802 371.65 155.931 371.914 157.008C372.177 158.086 371.817 158.704 370.749 159.005Z",fill:"url(#paint11_linear_1356_14057)"}),fhe("path",{d:"M384.211 245.345C383.143 245.646 381.773 245.515 381.51 244.438C381.246 243.361 382.189 241.744 383.257 241.443C384.324 241.142 385.112 242.271 385.376 243.348C385.639 244.426 385.278 245.044 384.211 245.345Z",fill:"url(#paint12_linear_1356_14057)"}),fhe("path",{d:"M364.771 41.3873C363.063 41.8687 361.337 40.8616 360.915 39.1378C360.493 37.414 361.536 35.6263 363.244 35.1449C364.953 34.6634 366.679 35.6706 367.101 37.3944C367.522 39.1182 366.479 40.9059 364.771 41.3873Z",fill:"url(#paint13_linear_1356_14057)"}),fhe("path",{d:"M404.311 77.905C404.602 77.8231 404.875 77.9236 405.084 77.6871C405.437 77.2908 404.814 76.6385 404.703 76.1265L401.277 58.7418C401.149 58.163 400.687 57.5371 400.123 57.3991C399.558 57.2611 398.969 57.3812 398.576 57.835L385.784 73.1179C385.395 73.564 385.199 74.3453 385.393 74.8964C385.585 75.4481 385.978 76.1646 386.548 76.2391L403.538 78.123C403.744 78.1479 404.114 77.9607 404.311 77.905ZM398.948 62.7348L401.811 74.4394L389.841 72.8085L398.948 62.7348Z",fill:"#FFB0EB"}),fhe("path",{d:"M97.5393 295.311C97.7108 295.263 97.4284 295.461 97.5393 295.311L108.785 280.464C108.975 280.211 108.718 279.972 108.594 279.684C108.47 279.396 108.124 279.917 107.821 279.902L88.5106 278.672C88.2101 278.659 87.895 278.62 87.7374 278.89C87.5798 279.159 87.7755 279.402 87.9283 279.67L96.5753 294.749C96.7102 294.99 97.2696 295.297 97.5393 295.311C97.6283 295.319 97.4556 295.335 97.5393 295.311ZM106.465 281.118L96.9667 292.97L90.6295 280.577L106.465 281.118Z",fill:"#86E29B"}),fhe("path",{d:"M393.699 108.848C389.518 104.446 414.629 114.366 413.945 120.659C413.259 126.952 401.355 129.102 403.894 123.491C406.042 118.747 400.376 115.876 393.699 108.848Z",fill:"#FBC49D"}),fhe("path",{d:"M139.414 115.959C139.434 115.953 139.392 115.965 139.414 115.959C141.963 115.2 143.436 111.976 142.717 109.189C142.37 107.839 141.526 107.199 140.408 106.504C139.289 105.808 138.171 105.449 136.933 105.815C135.698 106.182 134.85 107.033 134.222 108.247C133.595 109.461 133.282 111.234 133.63 112.585C133.978 113.935 134.821 114.574 135.94 115.27C137.04 115.952 138.199 116.301 139.414 115.959ZM137.315 107.375C138.222 107.12 139.005 106.994 139.825 107.502C140.661 108.02 140.912 108.618 141.171 109.625C141.708 111.704 140.935 113.834 139.032 114.398C138.11 114.675 137.356 114.791 136.522 114.272C135.686 113.753 135.436 113.155 135.176 112.149C134.917 111.142 134.718 109.714 135.186 108.81C135.654 107.905 136.394 107.649 137.315 107.375C137.329 107.371 137.299 107.38 137.315 107.375Z",fill:"#75C4FD"}),fhe("path",{d:"M308.981 78.7519C310.052 78.4043 311.158 78.7096 312.265 78.6613C313.655 78.6006 314.936 78.517 316.323 78.3531C319.497 77.9795 322.798 77.4906 325.984 77.3012C329.309 77.1025 332.514 76.8551 335.836 77.0295C338.809 77.1842 342.163 77.3405 345.105 77.7558C352.129 78.7468 359.331 79.0578 366.347 80.1158C372.252 81.008 377.93 82.1319 383.722 83.5644C385.925 84.0054 388.267 85.0754 389.126 85.3792C389.421 85.4833 389.37 85.8347 389.317 86.1595C389.306 86.2271 389.353 86.1146 389.317 86.1595C388.269 87.414 386.564 86.8124 385.259 86.4677C384.406 86.241 381.488 85.9494 381.011 85.9957C380.14 86.0815 379.277 86.014 379.656 87.2114C380.122 88.6824 382.391 89.7375 383.704 90.2419C385.883 91.0803 388.771 91.2561 390.845 92.4015C392.968 92.821 395.425 93.5002 397.022 93.9986C402.83 95.8103 407.806 98.8678 413.033 102.002C415.503 103.482 417.829 104.764 419.973 106.72C421.647 108.248 423.771 109.882 424.595 112.091C425.113 113.482 424.451 115.471 422.848 115.085C420.353 114.488 419.638 111.665 418.227 109.714C415.003 105.251 410.067 102.067 405.118 100.06C402.64 99.0556 399.803 98.729 397.204 98.1176C394.411 97.4613 391.597 97.0442 388.707 97.1736C385.646 97.3097 382.846 97.5534 379.819 98.0078C377.027 98.4264 374.252 98.4441 371.514 97.8441C368.766 97.2421 366.276 96.7553 363.6 95.9021C361.662 95.2848 359.013 94.5583 357.232 93.5247C355.699 92.6339 355.631 91.2381 357.241 90.186C359.87 88.4656 362.778 89.8021 365.546 90.3497C365.561 90.3527 365.532 90.3468 365.546 90.3497C367.858 90.804 369.649 90.098 371.923 89.3884C372.489 89.2128 373.255 89.0482 373.47 88.953C374.383 88.5432 375.895 87.8227 375.407 86.7394C374.868 85.5457 372.659 84.8846 371.55 84.4891C369.74 83.8428 368.053 82.9215 366.147 82.6743C365.654 82.6095 365.109 83.1606 364.6 83.1097C363.36 83.1121 361.769 83.348 360.543 83.418C357.43 83.5916 354.583 83.6228 351.464 83.4719C348.714 83.3377 346.432 82.8542 343.741 82.3102C340.773 81.7101 337.52 81.5879 334.471 81.5839C331.393 81.5811 328.6 81.7214 325.583 82.4181C322.758 83.0702 319.757 83.6198 316.887 84.0326C314.698 84.3481 312.467 84.6054 310.319 84.2137C309.079 83.9871 306.994 83.3394 306.461 81.9635C305.846 80.3659 307.736 79.1556 308.981 78.7519Z",fill:"url(#paint14_linear_1356_14057)"}),fhe("path",{d:"M242.269 242.95C242.295 242.947 242.244 242.955 242.269 242.95C244.934 242.606 247.53 241.858 250.2 241.574C253.133 241.264 256.006 240.56 258.906 239.982C263.26 239.117 268.026 238.52 272.254 237.097C274.429 236.365 276.067 235.298 278.251 234.592C280.361 233.909 283.058 233.12 285.216 232.652C289.317 231.764 293.049 231.66 297.016 230.198C301.109 228.69 305.088 226.673 308.819 224.409C312.645 222.086 316.282 219.769 320.622 218.62C322.381 218.154 323.919 218.219 325.65 218.886C327.016 219.413 327.739 220.337 327.196 221.79C326.557 223.504 324.659 224.7 323.131 225.423C320.854 226.5 319.53 227.184 317.134 227.927C314.619 228.707 311.888 229.24 309.395 230.083C308.226 230.947 307.17 232.522 306.105 233.501C303.996 235.441 301.666 237.03 298.945 237.996C292.934 240.129 286.354 238.602 280.183 239.056C279.661 239.095 279.162 239.442 278.635 239.487C275.592 240.135 272.2 240.63 269.156 241.294C264.546 242.299 260.456 243.409 255.808 244.179C251.971 244.814 243.815 245.854 243.815 245.854L242.074 245.505C240.575 245.281 240.751 243.152 242.269 242.95Z",fill:"url(#paint15_linear_1356_14057)"}),fhe("path",{d:"M432.985 171.626C438.212 165.465 445.109 153.64 442.906 144.649C442.162 137.999 433.671 132.912 424.963 135.518C420.16 136.957 416.435 142.146 419.724 144.498C420.656 145.164 422.187 145.591 423.391 145.969C434.204 149.375 434.925 162.538 425.069 169.683C421.087 172.569 416.347 174.292 411.914 176.719C400.151 183.162 399.887 196.847 387.7 202.712C382.326 205.298 375.761 206.838 370.297 209.275C359.98 213.88 352.555 221.733 342.241 226.341C337.225 228.584 330.266 231.632 323.483 234.12C321.475 234.855 321.999 237.058 324.056 236.46C324.098 236.449 324.017 236.474 324.056 236.46C329.079 234.971 334.437 233.161 339.331 231.33C352.278 226.48 365.28 220.971 377.43 214.775C401.78 202.367 416.881 190.609 432.985 171.626Z",fill:"url(#paint16_linear_1356_14057)"}),fhe("path",{d:"M343.644 241.104C348.002 234.144 357.126 232.455 364.343 231.134C368.176 230.431 372.406 229.878 376.137 228.662C380.691 227.175 384.558 224.095 388.327 221.077C389.452 220.177 391.204 218.466 392.393 217.436C393.185 216.748 393.644 216.026 394.33 215.225C396 213.275 399.599 209.812 401.687 208.16C403.263 206.914 407.779 204.758 408.259 207.986C408.611 210.359 406.379 213.087 404.961 214.747C402.224 217.953 398.998 221.079 395.475 223.243C391.749 225.531 387.701 227.439 383.674 229.051C381.672 229.853 379.519 230.073 377.486 230.785C376.001 231.307 374.486 232.236 373.037 232.866C371.034 233.738 368.99 234.28 367.041 235.38C364.436 236.849 361.782 238.783 359.108 240.105C356.331 241.477 353.823 242.691 350.791 243.27C348.6 243.687 345.501 243.641 343.836 241.884C343.526 241.554 343.389 241.51 343.644 241.104Z",fill:"url(#paint17_linear_1356_14057)"}),fhe("path",{d:"M190.163 273.219C222.905 268.849 232.64 262.943 213.962 259.057C195.285 255.172 187.5 262.08 188.434 266.2C189.366 270.32 180.381 271.326 169.286 272.39C158.193 273.454 157.141 276.354 190.163 273.219Z",fill:"url(#paint18_linear_1356_14057)"}),fhe("path",{d:"M295.952 95.4242L241.395 135.226L251.54 111.77L295.952 95.4242Z",fill:"#E17726",stroke:"#E17726","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M170.111 95.4242L224.181 135.598L214.522 111.77L170.111 95.4242Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M276.309 187.712L261.793 209.576L292.876 218.014L301.78 188.189L276.309 187.712Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M164.336 188.189L173.186 218.014L204.215 209.576L189.753 187.712L164.336 188.189Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M202.542 150.776L193.908 163.618L224.667 164.998L223.642 132.36L202.542 150.776Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M263.52 150.775L242.097 131.989L241.395 164.998L272.154 163.618L263.52 150.775Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M204.215 209.576L222.832 200.714L206.805 188.402L204.215 209.576Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M243.23 200.714L261.793 209.576L259.257 188.402L243.23 200.714Z",fill:"#E27625",stroke:"#E27625","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M261.793 209.576L243.23 200.714L244.741 212.601L244.579 217.643L261.793 209.576Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M204.215 209.576L221.483 217.643L221.375 212.601L222.832 200.714L204.215 209.576Z",fill:"#D5BFB2",stroke:"#D5BFB2","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M221.807 180.547L206.373 176.09L217.274 171.154L221.807 180.547Z",fill:"#233447",stroke:"#233447","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M244.255 180.547L248.788 171.154L259.742 176.09L244.255 180.547Z",fill:"#233447",stroke:"#233447","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M204.215 209.576L206.913 187.712L189.753 188.189L204.215 209.576Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M259.149 187.712L261.793 209.576L276.309 188.189L259.149 187.712Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M272.154 163.618L241.395 164.998L244.255 180.547L248.788 171.154L259.742 176.09L272.154 163.618Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M206.373 176.09L217.274 171.154L221.807 180.547L224.667 164.998L193.908 163.618L206.373 176.09Z",fill:"#CC6228",stroke:"#CC6228","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M193.908 163.618L206.805 188.402L206.373 176.09L193.908 163.618Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M259.743 176.09L259.257 188.402L272.154 163.618L259.743 176.09Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M224.667 164.998L221.807 180.548L225.422 198.909L226.232 174.71L224.667 164.998Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M241.395 164.998L239.884 174.657L240.64 198.909L244.255 180.548L241.395 164.998Z",fill:"#E27525",stroke:"#E27525","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M244.255 180.547L240.64 198.909L243.23 200.714L259.257 188.402L259.743 176.09L244.255 180.547Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M206.373 176.09L206.805 188.402L222.832 200.714L225.422 198.909L221.807 180.547L206.373 176.09Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M244.579 217.643L244.741 212.601L243.338 211.434H222.724L221.375 212.601L221.483 217.643L204.215 209.576L210.259 214.459L222.508 222.791H243.5L255.803 214.459L261.793 209.576L244.579 217.643Z",fill:"#C0AC9D",stroke:"#C0AC9D","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M243.23 200.714L240.64 198.909H225.422L222.832 200.714L221.375 212.601L222.724 211.434H243.338L244.741 212.601L243.23 200.714Z",fill:"#161616",stroke:"#161616","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M298.272 137.827L302.859 115.856L295.952 95.4242L243.23 133.899L263.52 150.775L292.174 159.001L298.488 151.731L295.736 149.767L300.107 145.84L296.761 143.293L301.132 140.002L298.272 137.827Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M163.203 115.856L167.844 137.827L164.876 140.002L169.301 143.293L165.955 145.84L170.326 149.767L167.574 151.731L173.888 159.001L202.542 150.775L222.832 133.899L170.11 95.4242L163.203 115.856Z",fill:"#763E1A",stroke:"#763E1A","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M292.175 159.001L263.52 150.775L272.154 163.618L259.257 188.402L276.309 188.189H301.78L292.175 159.001Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M202.542 150.775L173.888 159.001L164.336 188.189H189.753L206.805 188.402L193.908 163.618L202.542 150.775Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("path",{d:"M241.395 164.998L243.23 133.9L251.54 111.77H214.522L222.832 133.9L224.667 164.998L225.368 174.763L225.422 198.909H240.64L240.694 174.763L241.395 164.998Z",fill:"#F5841F",stroke:"#F5841F","stroke-width":"0.94513","stroke-linecap":"round","stroke-linejoin":"round"}),fhe("defs",null,fhe("linearGradient",{id:"paint0_linear_1356_14057",x1:"335.991",y1:"250.487",x2:"303.873",y2:"266.801",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint1_linear_1356_14057",x1:"276.993",y1:"303.722",x2:"205.254",y2:"401.574",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"0.0929","stop-color":"#81C2F6"}),fhe("stop",{offset:"1","stop-color":"#F0B8BD"})),fhe("linearGradient",{id:"paint2_linear_1356_14057",x1:"271.074",y1:"119.924",x2:"553.077",y2:"104.53",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint3_linear_1356_14057",x1:"264.209",y1:"91.0943",x2:"357.834",y2:"72.8792",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint4_linear_1356_14057",x1:"212.46",y1:"121.997",x2:"92.6119",y2:"183.406",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint5_linear_1356_14057",x1:"23.0498",y1:"204.411",x2:"161.86",y2:"163.003",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"0.0929","stop-color":"#81C2F6"}),fhe("stop",{offset:"1","stop-color":"#F0B8BD"})),fhe("linearGradient",{id:"paint6_linear_1356_14057",x1:"78.8647",y1:"240.375",x2:"74.9655",y2:"241.328",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint7_linear_1356_14057",x1:"382.349",y1:"181.971",x2:"378.45",y2:"182.925",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint8_linear_1356_14057",x1:"349.889",y1:"244.583",x2:"345.99",y2:"245.537",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint9_linear_1356_14057",x1:"142.262",y1:"279.808",x2:"138.362",y2:"280.762",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint10_linear_1356_14057",x1:"123.305",y1:"99.0746",x2:"119.406",y2:"100.028",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint11_linear_1356_14057",x1:"371.818",y1:"156.617",x2:"367.919",y2:"157.571",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint12_linear_1356_14057",x1:"385.281",y1:"242.958",x2:"381.382",y2:"243.911",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint13_linear_1356_14057",x1:"367.125",y1:"37.5052",x2:"360.843",y2:"38.8076",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"1","stop-color":"#75C3FC"})),fhe("linearGradient",{id:"paint14_linear_1356_14057",x1:"300.182",y1:"91.321",x2:"479.464",y2:"104.041",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint15_linear_1356_14057",x1:"363.434",y1:"201.232",x2:"102.977",y2:"302.269",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})),fhe("linearGradient",{id:"paint16_linear_1356_14057",x1:"447.962",y1:"165.159",x2:"313.049",y2:"197.95",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"0.0929","stop-color":"#81C2F6"}),fhe("stop",{offset:"1","stop-color":"#F0B8BD"})),fhe("linearGradient",{id:"paint17_linear_1356_14057",x1:"410.211",y1:"215.859",x2:"341.378",y2:"232.788",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#75C3FC"}),fhe("stop",{offset:"0.0929","stop-color":"#81C2F6"}),fhe("stop",{offset:"1","stop-color":"#F0B8BD"})),fhe("linearGradient",{id:"paint18_linear_1356_14057",x1:"222.282",y1:"258.986",x2:"162.257",y2:"273.774",gradientUnits:"userSpaceOnUse"},fhe("stop",{"stop-color":"#FFE466"}),fhe("stop",{offset:"1","stop-color":"#FFAFEA"})))),Bfe=class{constructor(e){$de(this,e),this.close=whe(this,"close"),this.connectWithExtension=whe(this,"connectWithExtension"),this.link=void 0,this.sdkVersion=void 0,this.preferDesktop=void 0,this.tab=1,this.isDefaultTab=!0,this.translationsLoaded=!1,this.i18nInstance=new Mfe,this.setTab(this.preferDesktop?1:2)}async connectedCallback(){await this.i18nInstance.init({fallbackLng:"en"}),this.translationsLoaded=!0}onClose(e=!1){this.close.emit({shouldTerminate:e})}connectWithExtensionHandler(){this.connectWithExtension.emit()}setTab(e){this.tab=e,this.isDefaultTab=!1}disconnectedCallback(){this.onClose()}updatePreferDesktop(e){e?this.setTab(1):this.setTab(2)}render(){if(!this.translationsLoaded)return null;const e=e=>this.i18nInstance.t(e),t=this.sdkVersion,n=this.isDefaultTab?this.preferDesktop?1:2:this.tab,r=Afe(this.link,"svg",{ecc:"medium",scale:2});return fhe(tfe,{className:"select-modal"},fhe("div",{class:"backdrop",onClick:()=>this.onClose(!0)}),fhe("div",{class:"modal"},fhe("div",{class:"closeButtonContainer"},fhe("div",{class:"right"},fhe("span",{class:"closeButton",onClick:()=>this.onClose(!0)},fhe(cfe,null)))),fhe("div",{class:"logoContainer"},fhe(lfe,null)),fhe("div",null,fhe("div",{class:"tabcontainer"},fhe("div",{class:"flexContainer"},fhe("div",{onClick:()=>this.setTab(1),class:"tab flexItem "+(1===n?"tabactive":"")},e("DESKTOP")),fhe("div",{onClick:()=>this.setTab(2),class:"tab flexItem "+(2===n?"tabactive":"")},e("MOBILE")))),fhe("div",{style:{display:1===n?"none":"block"}},fhe("div",{class:"flexContainer"},fhe("div",{class:"flexItem",style:{textAlign:"center",marginTop:"4"}},fhe("div",{class:"center",id:"sdk-mm-qrcode",innerHTML:r}),fhe("div",{class:"connectMobileText"},e("SCAN_TO_CONNECT"),fhe("br",null),fhe("span",{class:"blue"},fhe("b",null,e("META_MASK_MOBILE_APP"))))))),fhe("div",{style:{display:2===n?"none":"block"}},fhe("div",{style:{display:"flex",justifyContent:"center",height:"300",marginTop:"-20"}},fhe(Lfe,null)),fhe("div",{class:"extensionLabel"},e("SELECT_MODAL.CRYPTO_TAKE_CONTROL_TEXT")),fhe("button",{class:"button",onClick:()=>this.connectWithExtensionHandler()},fhe(Nfe,null),fhe("span",{class:"installExtensionText"},e("CONNECT_WITH_EXTENSION"))))),fhe(afe,{version:t})))}get el(){return vhe(this)}static get watchers(){return{preferDesktop:["updatePreferDesktop"]}}};Bfe.style=".flexContainer {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n}\n\n.flexItem {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem11 {\n flex: 11;\n justify-content: center;\n align-items: center;\n}\n\n.flexItem1 {\n flex: 1;\n justify-content: center;\n align-items: center;\n}\n\n.tab {\n padding: 8px;\n cursor: pointer;\n background-color: #F2F4F6;\n font-size: 12px;\n text-align: center;\n color: #24292E;\n}\n\n.tabcontainer {\n padding: 4px;\n background-color: #F2F4F6;\n border-radius: 8px;\n margin-bottom: 30px;\n margin-top: 30px;\n}\n\n.tabactive {\n background-color: white;\n -webkit-transition: background-color 300ms linear;\n -ms-transition: background-color 300ms linear;\n transition: background-color 300ms linear;\n border-radius: 8px;\n}\n\n.item {\n font-size: 12px;\n margin-bottom: 16px;\n border-radius: 8px;\n padding: 10px;\n border: 2px #F2F4F6 solid;\n color: #24292E;\n}\n\n.extensionLabel {\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n text-align: cetner;\n color: #24272A;\n}\n\n.notice {\n font-size: 12px;\n margin-left: 10px;\n margin-right: 10px;\n color: grey;\n}\n\n.button {\n margin-top: 41.5px;\n margin-bottom: 20px;\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 12px 20px;\n background: #037DD6;\n border-radius: 32px;\n color: white;\n border: 0;\n font-size: 14px;\n cursor: pointer;\n}\n\n.backdrop {\n visibility: visible;\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n z-index: 99998;\n background: rgba(0, 0, 0, 0.87);\n opacity: 0.3;\n}\n\n.modal {\n visibility: visible;\n position: fixed;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 99999;\n background: white;\n padding: 20px;\n border-radius: 8px;\n top: 50%;\n max-width: 100%;\n width: 460px;\n min-width: 300px;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 11px 15px -7px, rgba(0, 0, 0, 0.14) 0px 24px 38px 3px, rgba(0, 0, 0, 0.12) 0px 9px 46px 8px;\n -webkit-font-smoothing: antialiased;\n}\n\n.closeButton {\n color: #BBC0C5;\n cursor: pointer;\n}\n\n.logoContainer {\n margin-left: 24px;\n margin-right: 24px;\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.connectMobileText {\n font-size: 14px;\n color: black;\n margin-top: 28px;\n margin-bottom: 28px;\n line-height: 2;\n}\n\n.blue {\n color: #037DD6;\n font-weight: 700;\n}\n\n.installExtensionText {\n margin-left: 10px;\n}\n\n.center {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.right {\n display: flex;\n align-items: center;\n justify-content: right;\n}\n\n#sdk-mm-qrcode {\n svg {\n width: 50%;\n }\n}";var jfe=Object.freeze({__proto__:null,mm_install_modal:Tfe,mm_pending_modal:Rfe,mm_select_modal:Bfe});const Dfe=Object.freeze(Object.defineProperty({__proto__:null,get CommunicationLayerPreference(){return jie},get ConnectionStatus(){return yie},DEFAULT_SERVER_URL:die,get EventType(){return bie},get MessageType(){return Eie},MetaMaskSDK:Bde,MetaMaskSDKEvent:Nue,get PROVIDER_UPDATE_TYPE(){return ode},get PlatformType(){return Die},SDKProvider:Due,default:Bde},Symbol.toStringTag,{value:"Module"}));return OO}();
77
+ //# sourceMappingURL=coinley-vanilla.min.js.map