UNPKG

@walletconnect/sign-client

Version:

Sign Client for WalletConnect Protocol

14 lines (12 loc) 464 kB
(function(Z,Ut){typeof exports=="object"&&typeof module<"u"?Ut(exports):typeof define=="function"&&define.amd?define(["exports"],Ut):(Z=typeof globalThis<"u"?globalThis:Z||self,Ut(Z["@walletconnect/sign-client"]={}))})(this,function(Z){"use strict";var Ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function gu(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Ye={exports:{}},fn=typeof Reflect=="object"?Reflect:null,yu=fn&&typeof fn.apply=="function"?fn.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Xi;fn&&typeof fn.ownKeys=="function"?Xi=fn.ownKeys:Object.getOwnPropertySymbols?Xi=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Xi=function(e){return Object.getOwnPropertyNames(e)};function d0(t){console&&console.warn&&console.warn(t)}var wu=Number.isNaN||function(e){return e!==e};function ae(){ae.init.call(this)}Ye.exports=ae,Ye.exports.once=w0,ae.EventEmitter=ae,ae.prototype._events=void 0,ae.prototype._eventsCount=0,ae.prototype._maxListeners=void 0;var bu=10;function Ji(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ae,"defaultMaxListeners",{enumerable:!0,get:function(){return bu},set:function(t){if(typeof t!="number"||t<0||wu(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");bu=t}}),ae.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ae.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||wu(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function mu(t){return t._maxListeners===void 0?ae.defaultMaxListeners:t._maxListeners}ae.prototype.getMaxListeners=function(){return mu(this)},ae.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")yu(c,this,r);else for(var u=c.length,l=Su(c,u),n=0;n<u;++n)yu(l[n],this,r);return!0};function vu(t,e,r,n){var i,s,o;if(Ji(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=mu(t),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,d0(a)}return t}ae.prototype.addListener=function(e,r){return vu(this,e,r,!1)},ae.prototype.on=ae.prototype.addListener,ae.prototype.prependListener=function(e,r){return vu(this,e,r,!0)};function p0(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Eu(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=p0.bind(n);return i.listener=r,n.wrapFn=i,i}ae.prototype.once=function(e,r){return Ji(r),this.on(e,Eu(this,e,r)),this},ae.prototype.prependOnceListener=function(e,r){return Ji(r),this.prependListener(e,Eu(this,e,r)),this},ae.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Ji(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():g0(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},ae.prototype.off=ae.prototype.removeListener,ae.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function _u(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?y0(i):Su(i,i.length)}ae.prototype.listeners=function(e){return _u(this,e,!0)},ae.prototype.rawListeners=function(e){return _u(this,e,!1)},ae.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):xu.call(t,e)},ae.prototype.listenerCount=xu;function xu(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ae.prototype.eventNames=function(){return this._eventsCount>0?Xi(this._events):[]};function Su(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function g0(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function y0(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function w0(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Iu(t,e,s,{once:!0}),e!=="error"&&b0(t,i,{once:!0})})}function b0(t,e,r){typeof t.on=="function"&&Iu(t,"error",e,r)}function Iu(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var M={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var vo=function(t,e){return vo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},vo(t,e)};function m0(t,e){vo(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Eo=function(){return Eo=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Eo.apply(this,arguments)};function v0(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function E0(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function _0(t,e){return function(r,n){e(r,n,t)}}function x0(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function S0(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{u(n.next(l))}catch(h){o(h)}}function c(l){try{u(n.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):i(l.value).then(a,c)}u((n=n.apply(t,e||[])).next())})}function I0(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){r.label=u[1];break}if(u[0]===6&&r.label<s[1]){r.label=s[1],s=u;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(u);break}s[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function A0(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function D0(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function _o(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Au(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function O0(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Au(arguments[e]));return t}function $0(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function kn(t){return this instanceof kn?(this.v=t,this):new kn(t)}function T0(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(f){n[f]&&(i[f]=function(p){return new Promise(function(d,g){s.push([f,p,d,g])>1||a(f,p)})})}function a(f,p){try{c(n[f](p))}catch(d){h(s[0][3],d)}}function c(f){f.value instanceof kn?Promise.resolve(f.value.v).then(u,l):h(s[0][2],f)}function u(f){a("next",f)}function l(f){a("throw",f)}function h(f,p){f(p),s.shift(),s.length&&a(s[0][0],s[0][1])}}function B0(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:kn(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function P0(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof _o=="function"?_o(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}function N0(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function C0(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function R0(t){return t&&t.__esModule?t:{default:t}}function U0(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function F0(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var L0=Object.freeze({__proto__:null,__extends:m0,get __assign(){return Eo},__rest:v0,__decorate:E0,__param:_0,__metadata:x0,__awaiter:S0,__generator:I0,__createBinding:A0,__exportStar:D0,__values:_o,__read:Au,__spread:O0,__spreadArrays:$0,__await:kn,__asyncGenerator:T0,__asyncDelegator:B0,__asyncValues:P0,__makeTemplateObject:N0,__importStar:C0,__importDefault:R0,__classPrivateFieldGet:U0,__classPrivateFieldSet:F0}),Qi=gu(L0),xo={},Mn={},Du;function k0(){if(Du)return Mn;Du=1,Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Mn.delay=t,Mn}var kr={},So={},Mr={},Ou;function M0(){return Ou||(Ou=1,Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.ONE_THOUSAND=Mr.ONE_HUNDRED=void 0,Mr.ONE_HUNDRED=100,Mr.ONE_THOUSAND=1e3),Mr}var Io={},$u;function z0(){return $u||($u=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(Io)),Io}var Tu;function Bu(){return Tu||(Tu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Qi;e.__exportStar(M0(),t),e.__exportStar(z0(),t)}(So)),So}var Pu;function q0(){if(Pu)return kr;Pu=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.fromMiliseconds=kr.toMiliseconds=void 0;const t=Bu();function e(n){return n*t.ONE_THOUSAND}kr.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return kr.fromMiliseconds=r,kr}var Nu;function j0(){return Nu||(Nu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Qi;e.__exportStar(k0(),t),e.__exportStar(q0(),t)}(xo)),xo}var dn={},Cu;function V0(){if(Cu)return dn;Cu=1,Object.defineProperty(dn,"__esModule",{value:!0}),dn.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const n=this.get(r);if(typeof n.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const i=Date.now()-n.started;this.timestamps.set(r,{started:n.started,elapsed:i})}get(r){const n=this.timestamps.get(r);if(typeof n>"u")throw new Error(`No timestamp found for label: ${r}`);return n}elapsed(r){const n=this.get(r);return n.elapsed||Date.now()-n.started}}return dn.Watch=t,dn.default=t,dn}var Ao={},zn={},Ru;function H0(){if(Ru)return zn;Ru=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.IWatch=void 0;class t{}return zn.IWatch=t,zn}var Uu;function K0(){return Uu||(Uu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Qi.__exportStar(H0(),t)}(Ao)),Ao}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Qi;e.__exportStar(j0(),t),e.__exportStar(V0(),t),e.__exportStar(K0(),t),e.__exportStar(Bu(),t)})(M);class zr{}class G0 extends zr{constructor(e){super()}}const Fu=M.FIVE_SECONDS,qr={pulse:"heartbeat_pulse"};class Do extends G0{constructor(e){super(e),this.events=new Ye.exports.EventEmitter,this.interval=Fu,this.interval=e?.interval||Fu}static async init(e){const r=new Do(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),M.toMiliseconds(this.interval))}pulse(){this.events.emit(qr.pulse)}}const W0=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Y0=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Z0=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function X0(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){J0(t);return}return e}function J0(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function es(t,e={}){if(typeof t!="string")return t;if(t[0]==='"'&&t[t.length-1]==='"'&&t.indexOf("\\")===-1)return t.slice(1,-1);const r=t.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!Z0.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(W0.test(t)||Y0.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,X0)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function Q0(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function xe(t,...e){try{return Q0(t(...e))}catch(r){return Promise.reject(r)}}function ey(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function ty(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function ts(t){if(ey(t))return String(t);if(ty(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return ts(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const Oo="base64:";function ry(t){return typeof t=="string"?t:Oo+sy(t)}function ny(t){return typeof t!="string"||!t.startsWith(Oo)?t:iy(t.slice(Oo.length))}function iy(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function sy(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Ze(t){return t&&t.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function oy(...t){return Ze(t.join(":"))}function rs(t){return t=Ze(t),t?t+":":""}function ay(t,e){if(e===void 0)return!0;let r=0,n=t.indexOf(":");for(;n>-1;)r++,n=t.indexOf(":",n+1);return r<=e}function cy(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}function NO(t){return t}const uy="memory",ly=()=>{const t=new Map;return{name:uy,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function hy(t={}){const e={mounts:{"":t.driver||ly()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=u=>{for(const l of e.mountpoints)if(u.startsWith(l))return{base:l,relativeKey:u.slice(l.length),driver:e.mounts[l]};return{base:"",relativeKey:u,driver:e.mounts[""]}},n=(u,l)=>e.mountpoints.filter(h=>h.startsWith(u)||l&&u.startsWith(h)).map(h=>({relativeBase:u.length>h.length?u.slice(h.length):void 0,mountpoint:h,driver:e.mounts[h]})),i=(u,l)=>{if(e.watching){l=Ze(l);for(const h of e.watchListeners)h(u,l)}},s=async()=>{if(!e.watching){e.watching=!0;for(const u in e.mounts)e.unwatch[u]=await Lu(e.mounts[u],i,u)}},o=async()=>{if(e.watching){for(const u in e.unwatch)await e.unwatch[u]();e.unwatch={},e.watching=!1}},a=(u,l,h)=>{const f=new Map,p=d=>{let g=f.get(d.base);return g||(g={driver:d.driver,base:d.base,items:[]},f.set(d.base,g)),g};for(const d of u){const g=typeof d=="string",y=Ze(g?d:d.key),x=g?void 0:d.value,A=g||!d.options?l:{...l,...d.options},m=r(y);p(m).items.push({key:y,value:x,relativeKey:m.relativeKey,options:A})}return Promise.all([...f.values()].map(d=>h(d))).then(d=>d.flat())},c={hasItem(u,l={}){u=Ze(u);const{relativeKey:h,driver:f}=r(u);return xe(f.hasItem,h,l)},getItem(u,l={}){u=Ze(u);const{relativeKey:h,driver:f}=r(u);return xe(f.getItem,h,l).then(p=>es(p))},getItems(u,l={}){return a(u,l,h=>h.driver.getItems?xe(h.driver.getItems,h.items.map(f=>({key:f.relativeKey,options:f.options})),l).then(f=>f.map(p=>({key:oy(h.base,p.key),value:es(p.value)}))):Promise.all(h.items.map(f=>xe(h.driver.getItem,f.relativeKey,f.options).then(p=>({key:f.key,value:es(p)})))))},getItemRaw(u,l={}){u=Ze(u);const{relativeKey:h,driver:f}=r(u);return f.getItemRaw?xe(f.getItemRaw,h,l):xe(f.getItem,h,l).then(p=>ny(p))},async setItem(u,l,h={}){if(l===void 0)return c.removeItem(u);u=Ze(u);const{relativeKey:f,driver:p}=r(u);p.setItem&&(await xe(p.setItem,f,ts(l),h),p.watch||i("update",u))},async setItems(u,l){await a(u,l,async h=>{if(h.driver.setItems)return xe(h.driver.setItems,h.items.map(f=>({key:f.relativeKey,value:ts(f.value),options:f.options})),l);h.driver.setItem&&await Promise.all(h.items.map(f=>xe(h.driver.setItem,f.relativeKey,ts(f.value),f.options)))})},async setItemRaw(u,l,h={}){if(l===void 0)return c.removeItem(u,h);u=Ze(u);const{relativeKey:f,driver:p}=r(u);if(p.setItemRaw)await xe(p.setItemRaw,f,l,h);else if(p.setItem)await xe(p.setItem,f,ry(l),h);else return;p.watch||i("update",u)},async removeItem(u,l={}){typeof l=="boolean"&&(l={removeMeta:l}),u=Ze(u);const{relativeKey:h,driver:f}=r(u);f.removeItem&&(await xe(f.removeItem,h,l),(l.removeMeta||l.removeMata)&&await xe(f.removeItem,h+"$",l),f.watch||i("remove",u))},async getMeta(u,l={}){typeof l=="boolean"&&(l={nativeOnly:l}),u=Ze(u);const{relativeKey:h,driver:f}=r(u),p=Object.create(null);if(f.getMeta&&Object.assign(p,await xe(f.getMeta,h,l)),!l.nativeOnly){const d=await xe(f.getItem,h+"$",l).then(g=>es(g));d&&typeof d=="object"&&(typeof d.atime=="string"&&(d.atime=new Date(d.atime)),typeof d.mtime=="string"&&(d.mtime=new Date(d.mtime)),Object.assign(p,d))}return p},setMeta(u,l,h={}){return this.setItem(u+"$",l,h)},removeMeta(u,l={}){return this.removeItem(u+"$",l)},async getKeys(u,l={}){u=rs(u);const h=n(u,!0);let f=[];const p=[];let d=!0;for(const y of h){y.driver.flags?.maxDepth||(d=!1);const x=await xe(y.driver.getKeys,y.relativeBase,l);for(const A of x){const m=y.mountpoint+Ze(A);f.some(v=>m.startsWith(v))||p.push(m)}f=[y.mountpoint,...f.filter(A=>!A.startsWith(y.mountpoint))]}const g=l.maxDepth!==void 0&&!d;return p.filter(y=>(!g||ay(y,l.maxDepth))&&cy(y,u))},async clear(u,l={}){u=rs(u),await Promise.all(n(u,!1).map(async h=>{if(h.driver.clear)return xe(h.driver.clear,h.relativeBase,l);if(h.driver.removeItem){const f=await h.driver.getKeys(h.relativeBase||"",l);return Promise.all(f.map(p=>h.driver.removeItem(p,l)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>ku(u)))},async watch(u){return await s(),e.watchListeners.push(u),async()=>{e.watchListeners=e.watchListeners.filter(l=>l!==u),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(u,l){if(u=rs(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((h,f)=>f.length-h.length)),e.mounts[u]=l,e.watching&&Promise.resolve(Lu(l,i,u)).then(h=>{e.unwatch[u]=h}).catch(console.error),c},async unmount(u,l=!0){u=rs(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u]?.(),delete e.unwatch[u]),l&&await ku(e.mounts[u]),e.mountpoints=e.mountpoints.filter(h=>h!==u),delete e.mounts[u])},getMount(u=""){u=Ze(u)+":";const l=r(u);return{driver:l.driver,base:l.base}},getMounts(u="",l={}){return u=Ze(u),n(u,l.parents).map(f=>({driver:f.driver,base:f.mountpoint}))},keys:(u,l={})=>c.getKeys(u,l),get:(u,l={})=>c.getItem(u,l),set:(u,l,h={})=>c.setItem(u,l,h),has:(u,l={})=>c.hasItem(u,l),del:(u,l={})=>c.removeItem(u,l),remove:(u,l={})=>c.removeItem(u,l)};return c}function Lu(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function ku(t){typeof t.dispose=="function"&&await xe(t.dispose)}function jr(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function Mu(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=jr(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let $o;function qn(){return $o||($o=Mu("keyval-store","keyval")),$o}function zu(t,e=qn()){return e("readonly",r=>jr(r.get(t)))}function fy(t,e,r=qn()){return r("readwrite",n=>(n.put(e,t),jr(n.transaction)))}function dy(t,e=qn()){return e("readwrite",r=>(r.delete(t),jr(r.transaction)))}function py(t=qn()){return t("readwrite",e=>(e.clear(),jr(e.transaction)))}function gy(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},jr(t.transaction)}function yy(t=qn()){return t("readonly",e=>{if(e.getAllKeys)return jr(e.getAllKeys());const r=[];return gy(e,n=>r.push(n.key)).then(()=>r)})}const wy=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),by=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)};function pn(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return by(t)}catch{return t}}function Vr(t){return typeof t=="string"?t:wy(t)||""}const my="idb-keyval";var vy=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=Mu(t.dbName,t.storeName)),{name:my,options:t,async hasItem(i){return!(typeof await zu(r(i),n)>"u")},async getItem(i){return await zu(r(i),n)??null},setItem(i,s){return fy(r(i),s,n)},removeItem(i){return dy(r(i),n)},getKeys(){return yy(n)},clear(){return py(n)}}};const Ey="WALLET_CONNECT_V2_INDEXED_DB",_y="keyvaluestorage";class xy{constructor(){this.indexedDb=hy({driver:vy({dbName:Ey,storeName:_y})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Vr(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var To=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ns={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof To<"u"&&To.localStorage?ns.exports=To.localStorage:typeof window<"u"&&window.localStorage?ns.exports=window.localStorage:ns.exports=new e})();function Sy(t){var e;return[t[0],pn((e=t[1])!=null?e:"")]}class Iy{constructor(){this.localStorage=ns.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Sy)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return pn(r)}async setItem(e,r){this.localStorage.setItem(e,Vr(r))}async removeItem(e){this.localStorage.removeItem(e)}}const Ay="wc_storage_version",qu=1,Dy=async(t,e,r)=>{const n=Ay,i=await e.getItem(n);if(i&&i>=qu){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const c=a.toLowerCase();if(c.includes("wc@")||c.includes("walletconnect")||c.includes("wc_")||c.includes("wallet_connect")){const u=await t.getItem(a);await e.setItem(a,u),o.push(a)}}await e.setItem(n,qu),r(e),Oy(t,o)},Oy=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class $y{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new Iy;this.storage=e;try{const r=new xy;Dy(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}function Ty(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var By=Py;function Py(t,e,r){var n=r&&r.stringify||Ty,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a<s;a++)o[a]=n(e[a]);return o.join(" ")}if(typeof t!="string")return t;var c=e.length;if(c===0)return t;for(var u="",l=1-i,h=-1,f=t&&t.length||0,p=0;p<f;){if(t.charCodeAt(p)===37&&p+1<f){switch(h=h>-1?h:0,t.charCodeAt(p+1)){case 100:case 102:if(l>=c||e[l]==null)break;h<p&&(u+=t.slice(h,p)),u+=Number(e[l]),h=p+2,p++;break;case 105:if(l>=c||e[l]==null)break;h<p&&(u+=t.slice(h,p)),u+=Math.floor(Number(e[l])),h=p+2,p++;break;case 79:case 111:case 106:if(l>=c||e[l]===void 0)break;h<p&&(u+=t.slice(h,p));var d=typeof e[l];if(d==="string"){u+="'"+e[l]+"'",h=p+2,p++;break}if(d==="function"){u+=e[l].name||"<anonymous>",h=p+2,p++;break}u+=n(e[l]),h=p+2,p++;break;case 115:if(l>=c)break;h<p&&(u+=t.slice(h,p)),u+=String(e[l]),h=p+2,p++;break;case 37:h<p&&(u+=t.slice(h,p)),u+="%",h=p+2,p++,l--;break}++l}++p}return h===-1?t:(h<f&&(u+=t.slice(h)),u)}const ju=By;var Yt=Ft;const jn=qy().console||{},Ny={mapHttpRequest:ss,mapHttpResponse:ss,wrapRequestSerializer:Po,wrapResponseSerializer:Po,wrapErrorSerializer:Po,req:ss,res:ss,err:Ly};function Cy(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Ft(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||jn;t.browser.write&&(t.browser.asObject=!0);const n=t.serializers||{},i=Cy(t.browser.serialize,n);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",c=Object.create(r);c.log||(c.log=Vn),Object.defineProperty(c,"levelVal",{get:l}),Object.defineProperty(c,"level",{get:h,set:f});const u={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:ky(t)};c.levels=Ft.levels,c.level=a,c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=Vn,c.serializers=n,c._serialize=i,c._stdErrSerialize=s,c.child=p,e&&(c._logEvent=Bo());function l(){return this.level==="silent"?1/0:this.levels.values[this.level]}function h(){return this._level}function f(d){if(d!=="silent"&&!this.levels.values[d])throw Error("unknown level "+d);this._level=d,gn(u,c,"error","log"),gn(u,c,"fatal","error"),gn(u,c,"warn","error"),gn(u,c,"info","log"),gn(u,c,"debug","log"),gn(u,c,"trace","log")}function p(d,g){if(!d)throw new Error("missing bindings for child Pino");g=g||{},i&&d.serializers&&(g.serializers=d.serializers);const y=g.serializers;if(i&&y){var x=Object.assign({},n,y),A=t.browser.serialize===!0?Object.keys(x):i;delete d.serializers,is([d],A,x,this._stdErrSerialize)}function m(v){this._childLevel=(v._childLevel|0)+1,this.error=yn(v,d,"error"),this.fatal=yn(v,d,"fatal"),this.warn=yn(v,d,"warn"),this.info=yn(v,d,"info"),this.debug=yn(v,d,"debug"),this.trace=yn(v,d,"trace"),x&&(this.serializers=x,this._serialize=A),e&&(this._logEvent=Bo([].concat(v._logEvent.bindings,d)))}return m.prototype=this,new m(this)}return c}Ft.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},Ft.stdSerializers=Ny,Ft.stdTimeFunctions=Object.assign({},{nullTime:Vu,epochTime:Hu,unixTime:My,isoTime:zy});function gn(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Vn:i[r]?i[r]:jn[r]||jn[n]||Vn,Ry(t,e,r)}function Ry(t,e,r){!t.transmit&&e[r]===Vn||(e[r]=function(n){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===jn?jn:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];if(t.serialize&&!t.asObject&&is(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?n.call(a,Uy(this,r,o,s)):n.apply(a,o),t.transmit){const u=t.transmit.level||e.level,l=Ft.levels.values[u],h=Ft.levels.values[r];if(h<l)return;Fy(this,{ts:s,methodLevel:r,methodValue:h,transmitLevel:u,transmitValue:Ft.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function Uy(t,e,r,n){t._serialize&&is(r,t._serialize,t.serializers,t._stdErrSerialize);const i=r.slice();let s=i[0];const o={};n&&(o.time=n),o.level=Ft.levels.values[e];let a=(t._childLevel|0)+1;if(a<1&&(a=1),s!==null&&typeof s=="object"){for(;a--&&typeof i[0]=="object";)Object.assign(o,i.shift());s=i.length?ju(i.shift(),i):void 0}else typeof s=="string"&&(s=ju(i.shift(),i));return s!==void 0&&(o.msg=s),o}function is(t,e,r,n){for(const i in t)if(n&&t[i]instanceof Error)t[i]=Ft.stdSerializers.err(t[i]);else if(typeof t[i]=="object"&&!Array.isArray(t[i]))for(const s in t[i])e&&e.indexOf(s)>-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function yn(t,e,r){return function(){const n=new Array(1+arguments.length);n[0]=e;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return t[r].apply(this,n)}}function Fy(t,e,r){const n=e.send,i=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,c=t._logEvent.bindings;is(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=i,t._logEvent.messages=r.filter(function(u){return c.indexOf(u)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=o,n(s,t._logEvent,a),t._logEvent=Bo(c)}function Bo(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Ly(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function ky(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Vu:Hu}function ss(){return{}}function Po(t){return t}function Vn(){}function Vu(){return!1}function Hu(){return Date.now()}function My(){return Math.round(Date.now()/1e3)}function zy(){return new Date(Date.now()).toISOString()}function qy(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const jy={level:"info"},Hn="custom_context",No=1e3*1024;class Vy{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Ku{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new Vy(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}}class Gu{constructor(e,r=No){this.level=e??"error",this.levelValue=Yt.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Ku(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===Yt.levels.values.error?console.error(e):r===Yt.levels.values.warn?console.warn(e):r===Yt.levels.values.debug?console.debug(e):r===Yt.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Vr({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Ku(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(Vr({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class Hy{constructor(e,r=No){this.baseChunkLogger=new Gu(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=r,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}}class Ky{constructor(e,r=No){this.baseChunkLogger=new Gu(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var Gy=Object.defineProperty,Wy=Object.defineProperties,Yy=Object.getOwnPropertyDescriptors,Wu=Object.getOwnPropertySymbols,Zy=Object.prototype.hasOwnProperty,Xy=Object.prototype.propertyIsEnumerable,Yu=(t,e,r)=>e in t?Gy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,os=(t,e)=>{for(var r in e||(e={}))Zy.call(e,r)&&Yu(t,r,e[r]);if(Wu)for(var r of Wu(e))Xy.call(e,r)&&Yu(t,r,e[r]);return t},as=(t,e)=>Wy(t,Yy(e));function Co(t){return as(os({},t),{level:t?.level||jy.level})}function Jy(t,e=Hn){return t[e]||""}function Qy(t,e,r=Hn){return t[r]=e,t}function Xe(t,e=Hn){let r="";return typeof t.bindings>"u"?r=Jy(t,e):r=t.bindings().context||"",r}function e1(t,e,r=Hn){const n=Xe(t,r);return n.trim()?`${n}/${e}`:e}function je(t,e,r=Hn){const n=e1(t,e,r),i=t.child({context:n});return Qy(i,n,r)}function t1(t){var e,r;const n=new Hy((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Yt(as(os({},t.opts),{level:"trace",browser:as(os({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function r1(t){var e;const r=new Ky((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Yt(as(os({},t.opts),{level:"trace"})),chunkLoggerController:r}}function n1(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?t1(t):r1(t)}var i1=Object.defineProperty,s1=(t,e,r)=>e in t?i1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zu=(t,e,r)=>s1(t,typeof e!="symbol"?e+"":e,r);class o1 extends zr{constructor(e){super(),this.opts=e,Zu(this,"protocol","wc"),Zu(this,"version",2)}}var a1=Object.defineProperty,c1=(t,e,r)=>e in t?a1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,u1=(t,e,r)=>c1(t,typeof e!="symbol"?e+"":e,r);class l1 extends zr{constructor(e,r){super(),this.core=e,this.logger=r,u1(this,"records",new Map)}}class h1{constructor(e,r){this.logger=e,this.core=r}}class f1 extends zr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class d1 extends zr{constructor(e){super()}}class p1{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class g1 extends zr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class y1 extends zr{constructor(e,r){super(),this.core=e,this.logger=r}}class w1{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}}class b1{constructor(e,r){this.projectId=e,this.logger=r}}class m1{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}}var v1=Object.defineProperty,E1=(t,e,r)=>e in t?v1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xu=(t,e,r)=>E1(t,typeof e!="symbol"?e+"":e,r);class _1{constructor(e){this.opts=e,Xu(this,"protocol","wc"),Xu(this,"version",2)}}class x1{constructor(e){this.client=e}}function S1(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Ju(t,...e){if(!S1(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Qu(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function I1(t,e){Ju(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const wn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ro=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function A1(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function el(t){return typeof t=="string"&&(t=A1(t)),Ju(t),t}class D1{clone(){return this._cloneInto()}}function O1(t){const e=n=>t().update(el(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function tl(t=32){if(wn&&typeof wn.getRandomValues=="function")return wn.getRandomValues(new Uint8Array(t));if(wn&&typeof wn.randomBytes=="function")return wn.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function $1(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;t.setUint32(e+c,o,n),t.setUint32(e+u,a,n)}class T1 extends D1{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Ro(this.buffer)}update(e){Qu(this);const{view:r,buffer:n,blockLen:i}=this;e=el(e);const s=e.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=Ro(e);for(;i<=s-o;o+=i)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Qu(this),I1(e,this),this.finished=!0;const{buffer:r,view:n,blockLen:i,isLE:s}=this;let{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let h=o;h<i;h++)r[h]=0;$1(n,i-8,BigInt(this.length*8),s),this.process(n,0);const a=Ro(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)a.setUint32(4*h,l[h],s)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:n,length:i,finished:s,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=s,e.destroyed=o,i%r&&e.buffer.set(n),e}}const cs=BigInt(2**32-1),Uo=BigInt(32);function rl(t,e=!1){return e?{h:Number(t&cs),l:Number(t>>Uo&cs)}:{h:Number(t>>Uo&cs)|0,l:Number(t&cs)|0}}function B1(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:s,l:o}=rl(t[i],e);[r[i],n[i]]=[s,o]}return[r,n]}const P1=(t,e)=>BigInt(t>>>0)<<Uo|BigInt(e>>>0),N1=(t,e,r)=>t>>>r,C1=(t,e,r)=>t<<32-r|e>>>r,R1=(t,e,r)=>t>>>r|e<<32-r,U1=(t,e,r)=>t<<32-r|e>>>r,F1=(t,e,r)=>t<<64-r|e>>>r-32,L1=(t,e,r)=>t>>>r-32|e<<64-r,k1=(t,e)=>e,M1=(t,e)=>t,z1=(t,e,r)=>t<<r|e>>>32-r,q1=(t,e,r)=>e<<r|t>>>32-r,j1=(t,e,r)=>e<<r-32|t>>>64-r,V1=(t,e,r)=>t<<r-32|e>>>64-r;function H1(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}const K1=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),G1=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,W1=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),Y1=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Z1=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),X1=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0,Y={fromBig:rl,split:B1,toBig:P1,shrSH:N1,shrSL:C1,rotrSH:R1,rotrSL:U1,rotrBH:F1,rotrBL:L1,rotr32H:k1,rotr32L:M1,rotlSH:z1,rotlSL:q1,rotlBH:j1,rotlBL:V1,add:H1,add3L:K1,add3H:G1,add4L:W1,add4H:Y1,add5H:X1,add5L:Z1},[J1,Q1]=Y.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(t=>BigInt(t))),hr=new Uint32Array(80),fr=new Uint32Array(80);class ew extends T1{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:r,Bh:n,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:h,Fl:f,Gh:p,Gl:d,Hh:g,Hl:y}=this;return[e,r,n,i,s,o,a,c,u,l,h,f,p,d,g,y]}set(e,r,n,i,s,o,a,c,u,l,h,f,p,d,g,y){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=h|0,this.Fl=f|0,this.Gh=p|0,this.Gl=d|0,this.Hh=g|0,this.Hl=y|0}process(e,r){for(let m=0;m<16;m++,r+=4)hr[m]=e.getUint32(r),fr[m]=e.getUint32(r+=4);for(let m=16;m<80;m++){const v=hr[m-15]|0,_=fr[m-15]|0,T=Y.rotrSH(v,_,1)^Y.rotrSH(v,_,8)^Y.shrSH(v,_,7),C=Y.rotrSL(v,_,1)^Y.rotrSL(v,_,8)^Y.shrSL(v,_,7),N=hr[m-2]|0,b=fr[m-2]|0,B=Y.rotrSH(N,b,19)^Y.rotrBH(N,b,61)^Y.shrSH(N,b,6),I=Y.rotrSL(N,b,19)^Y.rotrBL(N,b,61)^Y.shrSL(N,b,6),O=Y.add4L(C,I,fr[m-7],fr[m-16]),P=Y.add4H(O,T,B,hr[m-7],hr[m-16]);hr[m]=P|0,fr[m]=O|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:h,El:f,Fh:p,Fl:d,Gh:g,Gl:y,Hh:x,Hl:A}=this