@walletconnect/sign-client
Version:
Sign Client for WalletConnect Protocol
14 lines (12 loc) • 444 kB
JavaScript
(function(Y,ct){typeof exports=="object"&&typeof module<"u"?ct(exports,require("crypto")):typeof define=="function"&&define.amd?define(["exports","crypto"],ct):(Y=typeof globalThis<"u"?globalThis:Y||self,ct(Y["@walletconnect/sign-client"]={}))})(this,function(Y){"use strict";var ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ba(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function i(){var n=!1;try{n=this instanceof i}catch{}return n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var Gi={exports:{}},Ra;function Ad(){if(Ra)return Gi.exports;Ra=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(b,x,O){return Function.prototype.apply.call(b,x,O)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:r=function(b){return Object.getOwnPropertyNames(b)};function i(m){console&&console.warn&&console.warn(m)}var n=Number.isNaN||function(b){return b!==b};function s(){s.init.call(this)}Gi.exports=s,Gi.exports.once=v,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(m){if(typeof m!="number"||m<0||n(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");o=m}}),s.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},s.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||n(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function c(m){return m._maxListeners===void 0?s.defaultMaxListeners:m._maxListeners}s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(b){for(var x=[],O=1;O<arguments.length;O++)x.push(arguments[O]);var T=b==="error",R=this._events;if(R!==void 0)T=T&&R.error===void 0;else if(!T)return!1;if(T){var F;if(x.length>0&&(F=x[0]),F instanceof Error)throw F;var U=new Error("Unhandled error."+(F?" ("+F.message+")":""));throw U.context=F,U}var N=R[b];if(N===void 0)return!1;if(typeof N=="function")e(N,this,x);else for(var D=N.length,P=d(N,D),O=0;O<D;++O)e(P[O],this,x);return!0};function u(m,b,x,O){var T,R,F;if(a(x),R=m._events,R===void 0?(R=m._events=Object.create(null),m._eventsCount=0):(R.newListener!==void 0&&(m.emit("newListener",b,x.listener?x.listener:x),R=m._events),F=R[b]),F===void 0)F=R[b]=x,++m._eventsCount;else if(typeof F=="function"?F=R[b]=O?[x,F]:[F,x]:O?F.unshift(x):F.push(x),T=c(m),T>0&&F.length>T&&!F.warned){F.warned=!0;var U=new Error("Possible EventEmitter memory leak detected. "+F.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");U.name="MaxListenersExceededWarning",U.emitter=m,U.type=b,U.count=F.length,i(U)}return m}s.prototype.addListener=function(b,x){return u(this,b,x,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(b,x){return u(this,b,x,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(m,b,x){var O={fired:!1,wrapFn:void 0,target:m,type:b,listener:x},T=l.bind(O);return T.listener=x,O.wrapFn=T,T}s.prototype.once=function(b,x){return a(x),this.on(b,h(this,b,x)),this},s.prototype.prependOnceListener=function(b,x){return a(x),this.prependListener(b,h(this,b,x)),this},s.prototype.removeListener=function(b,x){var O,T,R,F,U;if(a(x),T=this._events,T===void 0)return this;if(O=T[b],O===void 0)return this;if(O===x||O.listener===x)--this._eventsCount===0?this._events=Object.create(null):(delete T[b],T.removeListener&&this.emit("removeListener",b,O.listener||x));else if(typeof O!="function"){for(R=-1,F=O.length-1;F>=0;F--)if(O[F]===x||O[F].listener===x){U=O[F].listener,R=F;break}if(R<0)return this;R===0?O.shift():g(O,R),O.length===1&&(T[b]=O[0]),T.removeListener!==void 0&&this.emit("removeListener",b,U||x)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(b){var x,O,T;if(O=this._events,O===void 0)return this;if(O.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):O[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete O[b]),this;if(arguments.length===0){var R=Object.keys(O),F;for(T=0;T<R.length;++T)F=R[T],F!=="removeListener"&&this.removeAllListeners(F);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(x=O[b],typeof x=="function")this.removeListener(b,x);else if(x!==void 0)for(T=x.length-1;T>=0;T--)this.removeListener(b,x[T]);return this};function f(m,b,x){var O=m._events;if(O===void 0)return[];var T=O[b];return T===void 0?[]:typeof T=="function"?x?[T.listener||T]:[T]:x?y(T):d(T,T.length)}s.prototype.listeners=function(b){return f(this,b,!0)},s.prototype.rawListeners=function(b){return f(this,b,!1)},s.listenerCount=function(m,b){return typeof m.listenerCount=="function"?m.listenerCount(b):p.call(m,b)},s.prototype.listenerCount=p;function p(m){var b=this._events;if(b!==void 0){var x=b[m];if(typeof x=="function")return 1;if(x!==void 0)return x.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function d(m,b){for(var x=new Array(b),O=0;O<b;++O)x[O]=m[O];return x}function g(m,b){for(;b+1<m.length;b++)m[b]=m[b+1];m.pop()}function y(m){for(var b=new Array(m.length),x=0;x<b.length;++x)b[x]=m[x].listener||m[x];return b}function v(m,b){return new Promise(function(x,O){function T(F){m.removeListener(b,R),O(F)}function R(){typeof m.removeListener=="function"&&m.removeListener("error",T),x([].slice.call(arguments))}w(m,b,R,{once:!0}),b!=="error"&&S(m,T,{once:!0})})}function S(m,b,x){typeof m.on=="function"&&w(m,"error",b,x)}function w(m,b,x,O){if(typeof m.on=="function")O.once?m.once(b,x):m.on(b,x);else if(typeof m.addEventListener=="function")m.addEventListener(b,function T(R){O.once&&m.removeEventListener(b,T),x(R)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof m)}return Gi.exports}var Je=Ad(),Pa=Dd(Je),cs={};/*! *****************************************************************************
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 us=function(t,e){return us=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},us(t,e)};function Od(t,e){us(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var ls=function(){return ls=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},ls.apply(this,arguments)};function Td(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function Bd(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function Rd(t,e){return function(r,i){e(r,i,t)}}function Pd(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function $d(t,e,r,i){function n(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(i.next(l))}catch(h){o(h)}}function c(l){try{u(i.throw(l))}catch(h){o(h)}}function u(l){l.done?s(l.value):n(l.value).then(a,c)}u((i=i.apply(t,e||[])).next())})}function Nd(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next: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(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=u[0]&2?n.return:u[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,u[1])).done)return s;switch(n=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++,n=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],n=0}finally{i=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Cd(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function Fd(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function hs(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function $a(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function Ud(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat($a(arguments[e]));return t}function Ld(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i}function ei(t){return this instanceof ei?(this.v=t,this):new ei(t)}function kd(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(f){i[f]&&(n[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(i[f](p))}catch(d){h(s[0][3],d)}}function c(f){f.value instanceof ei?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 Md(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(o){return(r=!r)?{value:ei(t[n](o)),done:n==="return"}:s?s(o):o}:s}}function qd(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 hs=="function"?hs(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),n(a,c,o.done,o.value)})}}function n(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}function zd(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function jd(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 Vd(t){return t&&t.__esModule?t:{default:t}}function Kd(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function Hd(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 Gd=Object.freeze({__proto__:null,get __assign(){return ls},__asyncDelegator:Md,__asyncGenerator:kd,__asyncValues:qd,__await:ei,__awaiter:$d,__classPrivateFieldGet:Kd,__classPrivateFieldSet:Hd,__createBinding:Cd,__decorate:Bd,__exportStar:Fd,__extends:Od,__generator:Nd,__importDefault:Vd,__importStar:jd,__makeTemplateObject:zd,__metadata:Pd,__param:Rd,__read:$a,__rest:Td,__spread:Ud,__spreadArrays:Ld,__values:hs}),Wi=Ba(Gd),fs={},ti={},Na;function Wd(){if(Na)return ti;Na=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return ti.delay=t,ti}var lr={},ds={},hr={},Ca;function Yd(){return Ca||(Ca=1,Object.defineProperty(hr,"__esModule",{value:!0}),hr.ONE_THOUSAND=hr.ONE_HUNDRED=void 0,hr.ONE_HUNDRED=100,hr.ONE_THOUSAND=1e3),hr}var ps={},Fa;function Zd(){return Fa||(Fa=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}(ps)),ps}var Ua;function La(){return Ua||(Ua=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Wi;e.__exportStar(Yd(),t),e.__exportStar(Zd(),t)}(ds)),ds}var ka;function Xd(){if(ka)return lr;ka=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.fromMiliseconds=lr.toMiliseconds=void 0;const t=La();function e(i){return i*t.ONE_THOUSAND}lr.toMiliseconds=e;function r(i){return Math.floor(i/t.ONE_THOUSAND)}return lr.fromMiliseconds=r,lr}var Ma;function Jd(){return Ma||(Ma=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Wi;e.__exportStar(Wd(),t),e.__exportStar(Xd(),t)}(fs)),fs}var Nr={},qa;function Qd(){if(qa)return Nr;qa=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.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 i=this.get(r);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const n=Date.now()-i.started;this.timestamps.set(r,{started:i.started,elapsed:n})}get(r){const i=this.timestamps.get(r);if(typeof i>"u")throw new Error(`No timestamp found for label: ${r}`);return i}elapsed(r){const i=this.get(r);return i.elapsed||Date.now()-i.started}}return Nr.Watch=t,Nr.default=t,Nr}var gs={},ri={},za;function ep(){if(za)return ri;za=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.IWatch=void 0;class t{}return ri.IWatch=t,ri}var ja;function tp(){return ja||(ja=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Wi.__exportStar(ep(),t)}(gs)),gs}var Va;function rp(){return Va||(Va=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Wi;e.__exportStar(Jd(),t),e.__exportStar(Qd(),t),e.__exportStar(tp(),t),e.__exportStar(La(),t)}(cs)),cs}var k=rp();class fr{}let ip=class extends fr{constructor(e){super()}};const Ka=k.FIVE_SECONDS,dr={pulse:"heartbeat_pulse"};class ys extends ip{constructor(e){super(e),this.events=new Je.EventEmitter,this.interval=Ka,this.interval=e?.interval||Ka}static async init(e){const r=new ys(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(),k.toMiliseconds(this.interval))}pulse(){this.events.emit(dr.pulse)}}const np=/"(?:_|\\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*:/,sp=/"(?: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*:/,op=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function ap(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){cp(t);return}return e}function cp(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Yi(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(!op.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(np.test(t)||sp.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,ap)}return JSON.parse(t)}catch(i){if(e.strict)throw i;return t}}function up(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function fe(t,...e){try{return up(t(...e))}catch(r){return Promise.reject(r)}}function lp(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function hp(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Zi(t){if(lp(t))return String(t);if(hp(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Zi(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const ws="base64:";function fp(t){return typeof t=="string"?t:ws+gp(t)}function dp(t){return typeof t!="string"||!t.startsWith(ws)?t:pp(t.slice(ws.length))}function pp(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function gp(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Te(t){return t&&t.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function yp(...t){return Te(t.join(":"))}function Xi(t){return t=Te(t),t?t+":":""}function wp(t,e){if(e===void 0)return!0;let r=0,i=t.indexOf(":");for(;i>-1;)r++,i=t.indexOf(":",i+1);return r<=e}function mp(t,e){return e?t.startsWith(e)&&t[t.length-1]!=="$":t[t.length-1]!=="$"}function cS(t){return t}const bp="memory",Ep=()=>{const t=new Map;return{name:bp,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 vp(t={}){const e={mounts:{"":t.driver||Ep()},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[""]}},i=(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]})),n=(u,l)=>{if(e.watching){l=Te(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 Ha(e.mounts[u],n,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=Te(g?d:d.key),v=g?void 0:d.value,S=g||!d.options?l:{...l,...d.options},w=r(y);p(w).items.push({key:y,value:v,relativeKey:w.relativeKey,options:S})}return Promise.all([...f.values()].map(d=>h(d))).then(d=>d.flat())},c={hasItem(u,l={}){u=Te(u);const{relativeKey:h,driver:f}=r(u);return fe(f.hasItem,h,l)},getItem(u,l={}){u=Te(u);const{relativeKey:h,driver:f}=r(u);return fe(f.getItem,h,l).then(p=>Yi(p))},getItems(u,l={}){return a(u,l,h=>h.driver.getItems?fe(h.driver.getItems,h.items.map(f=>({key:f.relativeKey,options:f.options})),l).then(f=>f.map(p=>({key:yp(h.base,p.key),value:Yi(p.value)}))):Promise.all(h.items.map(f=>fe(h.driver.getItem,f.relativeKey,f.options).then(p=>({key:f.key,value:Yi(p)})))))},getItemRaw(u,l={}){u=Te(u);const{relativeKey:h,driver:f}=r(u);return f.getItemRaw?fe(f.getItemRaw,h,l):fe(f.getItem,h,l).then(p=>dp(p))},async setItem(u,l,h={}){if(l===void 0)return c.removeItem(u);u=Te(u);const{relativeKey:f,driver:p}=r(u);p.setItem&&(await fe(p.setItem,f,Zi(l),h),p.watch||n("update",u))},async setItems(u,l){await a(u,l,async h=>{if(h.driver.setItems)return fe(h.driver.setItems,h.items.map(f=>({key:f.relativeKey,value:Zi(f.value),options:f.options})),l);h.driver.setItem&&await Promise.all(h.items.map(f=>fe(h.driver.setItem,f.relativeKey,Zi(f.value),f.options)))})},async setItemRaw(u,l,h={}){if(l===void 0)return c.removeItem(u,h);u=Te(u);const{relativeKey:f,driver:p}=r(u);if(p.setItemRaw)await fe(p.setItemRaw,f,l,h);else if(p.setItem)await fe(p.setItem,f,fp(l),h);else return;p.watch||n("update",u)},async removeItem(u,l={}){typeof l=="boolean"&&(l={removeMeta:l}),u=Te(u);const{relativeKey:h,driver:f}=r(u);f.removeItem&&(await fe(f.removeItem,h,l),(l.removeMeta||l.removeMata)&&await fe(f.removeItem,h+"$",l),f.watch||n("remove",u))},async getMeta(u,l={}){typeof l=="boolean"&&(l={nativeOnly:l}),u=Te(u);const{relativeKey:h,driver:f}=r(u),p=Object.create(null);if(f.getMeta&&Object.assign(p,await fe(f.getMeta,h,l)),!l.nativeOnly){const d=await fe(f.getItem,h+"$",l).then(g=>Yi(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=Xi(u);const h=i(u,!0);let f=[];const p=[];let d=!0;for(const y of h){y.driver.flags?.maxDepth||(d=!1);const v=await fe(y.driver.getKeys,y.relativeBase,l);for(const S of v){const w=y.mountpoint+Te(S);f.some(m=>w.startsWith(m))||p.push(w)}f=[y.mountpoint,...f.filter(S=>!S.startsWith(y.mountpoint))]}const g=l.maxDepth!==void 0&&!d;return p.filter(y=>(!g||wp(y,l.maxDepth))&&mp(y,u))},async clear(u,l={}){u=Xi(u),await Promise.all(i(u,!1).map(async h=>{if(h.driver.clear)return fe(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=>Ga(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=Xi(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(Ha(l,n,u)).then(h=>{e.unwatch[u]=h}).catch(console.error),c},async unmount(u,l=!0){u=Xi(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u]?.(),delete e.unwatch[u]),l&&await Ga(e.mounts[u]),e.mountpoints=e.mountpoints.filter(h=>h!==u),delete e.mounts[u])},getMount(u=""){u=Te(u)+":";const l=r(u);return{driver:l.driver,base:l.base}},getMounts(u="",l={}){return u=Te(u),i(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 Ha(t,e,r){return t.watch?t.watch((i,n)=>e(i,r+n)):()=>{}}async function Ga(t){typeof t.dispose=="function"&&await fe(t.dispose)}function pr(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function Wa(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const i=pr(r);return(n,s)=>i.then(o=>s(o.transaction(e,n).objectStore(e)))}let ms;function ii(){return ms||(ms=Wa("keyval-store","keyval")),ms}function Ya(t,e=ii()){return e("readonly",r=>pr(r.get(t)))}function _p(t,e,r=ii()){return r("readwrite",i=>(i.put(e,t),pr(i.transaction)))}function xp(t,e=ii()){return e("readwrite",r=>(r.delete(t),pr(r.transaction)))}function Ip(t=ii()){return t("readwrite",e=>(e.clear(),pr(e.transaction)))}function Sp(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},pr(t.transaction)}function Dp(t=ii()){return t("readonly",e=>{if(e.getAllKeys)return pr(e.getAllKeys());const r=[];return Sp(e,i=>r.push(i.key)).then(()=>r)})}const Ap=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),Op=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,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function Cr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Op(t)}catch{return t}}function ni(t){return typeof t=="string"?t:Ap(t)||""}const Tp="idb-keyval";var Bp=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=n=>e+n;let i;return t.dbName&&t.storeName&&(i=Wa(t.dbName,t.storeName)),{name:Tp,options:t,async hasItem(n){return!(typeof await Ya(r(n),i)>"u")},async getItem(n){return await Ya(r(n),i)??null},setItem(n,s){return _p(r(n),s,i)},removeItem(n){return xp(r(n),i)},getKeys(){return Dp(i)},clear(){return Ip(i)}}};const Rp="WALLET_CONNECT_V2_INDEXED_DB",Pp="keyvaluestorage";class $p{constructor(){this.indexedDb=vp({driver:Bp({dbName:Rp,storeName:Pp})})}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,ni(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var bs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ji={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,i){this[r]=String(i)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(i){r[i]=void 0,delete r[i]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof bs<"u"&&bs.localStorage?Ji.exports=bs.localStorage:typeof window<"u"&&window.localStorage?Ji.exports=window.localStorage:Ji.exports=new e})();function Np(t){var e;return[t[0],Cr((e=t[1])!=null?e:"")]}let Cp=class{constructor(){this.localStorage=Ji.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Np)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Cr(r)}async setItem(e,r){this.localStorage.setItem(e,ni(r))}async removeItem(e){this.localStorage.removeItem(e)}};const Fp="wc_storage_version",Za=1,Up=async(t,e,r)=>{const i=Fp,n=await e.getItem(i);if(n&&n>=Za){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(i,Za),r(e),Lp(t,o)},Lp=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let kp=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new Cp;this.storage=e;try{const r=new $p;Up(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)})}};var ut={exports:{}};function Mp(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var qp=zp;function zp(t,e,r){var i=r&&r.stringify||Mp,n=1;if(typeof t=="object"&&t!==null){var s=e.length+n;if(s===1)return t;var o=new Array(s);o[0]=i(t);for(var a=1;a<s;a++)o[a]=i(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-n,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+=i(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 Xa=qp;ut.exports=mt;const si=ig().console||{},jp={mapHttpRequest:Qi,mapHttpResponse:Qi,wrapRequestSerializer:Is,wrapResponseSerializer:Is,wrapErrorSerializer:Is,req:Qi,res:Qi,err:Qa,errWithCause:Qa};function Ut(t,e){return t==="silent"?1/0:e.levels.values[t]}const Es=Symbol("pino.logFuncs"),vs=Symbol("pino.hierarchy"),Vp={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Ja(t,e){const r={logger:e,parent:t[vs]};e[vs]=r}function Kp(t,e,r){const i={};e.forEach(n=>{i[n]=r[n]?r[n]:si[n]||si[Vp[n]||"log"]||Fr}),t[Es]=i}function Hp(t,e){return Array.isArray(t)?t.filter(function(r){return r!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function mt(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||si;t.browser.write&&(t.browser.asObject=!0);const i=t.serializers||{},n=Hp(t.browser.serialize,i);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=Object.keys(t.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(o);typeof r=="function"&&a.forEach(function(g){r[g]=r}),(t.enabled===!1||t.browser.disabled)&&(t.level="silent");const c=t.level||"info",u=Object.create(r);u.log||(u.log=Fr),Kp(u,a,r),Ja({},u),Object.defineProperty(u,"levelVal",{get:h}),Object.defineProperty(u,"level",{get:f,set:p});const l={transmit:e,serialize:n,asObject:t.browser.asObject,asObjectBindingsOnly:t.browser.asObjectBindingsOnly,formatters:t.browser.formatters,levels:a,timestamp:eg(t),messageKey:t.messageKey||"msg",onChild:t.onChild||Fr};u.levels=Gp(t),u.level=c,u.isLevelEnabled=function(g){return this.levels.values[g]?this.levels.values[g]>=this.levels.values[this.level]:!1},u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Fr,u.serializers=i,u._serialize=n,u._stdErrSerialize=s,u.child=function(...g){return d.call(this,l,...g)},e&&(u._logEvent=xs());function h(){return Ut(this.level,this)}function f(){return this._level}function p(g){if(g!=="silent"&&!this.levels.values[g])throw Error("unknown level "+g);this._level=g,gr(this,l,u,"error"),gr(this,l,u,"fatal"),gr(this,l,u,"warn"),gr(this,l,u,"info"),gr(this,l,u,"debug"),gr(this,l,u,"trace"),o.forEach(y=>{gr(this,l,u,y)})}function d(g,y,v){if(!y)throw new Error("missing bindings for child Pino");v=v||{},n&&y.serializers&&(v.serializers=y.serializers);const S=v.serializers;if(n&&S){var w=Object.assign({},i,S),m=t.browser.serialize===!0?Object.keys(w):n;delete y.serializers,_s([y],m,w,this._stdErrSerialize)}function b(O){this._childLevel=(O._childLevel|0)+1,this.bindings=y,w&&(this.serializers=w,this._serialize=m),e&&(this._logEvent=xs([].concat(O._logEvent.bindings,y)))}b.prototype=this;const x=new b(this);return Ja(this,x),x.child=function(...O){return d.call(this,g,...O)},x.level=v.level||this.level,g.onChild(x),x}return u}function Gp(t){const e=t.customLevels||{},r=Object.assign({},mt.levels.values,e),i=Object.assign({},mt.levels.labels,Wp(e));return{values:r,labels:i}}function Wp(t){const e={};return Object.keys(t).forEach(function(r){e[t[r]]=r}),e}mt.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"}},mt.stdSerializers=jp,mt.stdTimeFunctions=Object.assign({},{nullTime:ec,epochTime:tc,unixTime:tg,isoTime:rg});function Yp(t){const e=[];t.bindings&&e.push(t.bindings);let r=t[vs];for(;r.parent;)r=r.parent,r.logger.bindings&&e.push(r.logger.bindings);return e.reverse()}function gr(t,e,r,i){if(Object.defineProperty(t,i,{value:Ut(t.level,r)>Ut(i,r)?Fr:r[Es][i],writable:!0,enumerable:!0,configurable:!0}),t[i]===Fr){if(!e.transmit)return;const s=e.transmit.level||t.level,o=Ut(s,r);if(Ut(i,r)<o)return}t[i]=Xp(t,e,r,i);const n=Yp(t);n.length!==0&&(t[i]=Zp(n,t[i]))}function Zp(t,e){return function(){return e.apply(this,[...t,...arguments])}}function Xp(t,e,r,i){return function(n){return function(){const s=e.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===si?si:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];var u=!1;if(e.serialize&&(_s(o,this._serialize,this.serializers,this._stdErrSerialize),u=!0),e.asObject||e.formatters?n.call(a,...Jp(this,i,o,s,e)):n.apply(a,o),e.transmit){const l=e.transmit.level||t._level,h=Ut(l,r),f=Ut(i,r);if(f<h)return;Qp(this,{ts:s,methodLevel:i,methodValue:f,transmitValue:r.levels.values[e.transmit.level||t._level],send:e.transmit.send,val:Ut(t._level,r)},o,u)}}}(t[Es][i])}function Jp(t,e,r,i,n){const{level:s,log:o=h=>h}=n.formatters||{},a=r.slice();let c=a[0];const u={};let l=(t._childLevel|0)+1;if(l<1&&(l=1),i&&(u.time=i),s){const h=s(e,t.levels.values[e]);Object.assign(u,h)}else u.level=t.levels.values[e];if(n.asObjectBindingsOnly){if(c!==null&&typeof c=="object")for(;l--&&typeof a[0]=="object";)Object.assign(u,a.shift());return[o(u),...a]}else{if(c!==null&&typeof c=="object"){for(;l--&&typeof a[0]=="object";)Object.assign(u,a.shift());c=a.length?Xa(a.shift(),a):void 0}else typeof c=="string"&&(c=Xa(a.shift(),a));return c!==void 0&&(u[n.messageKey]=c),[o(u)]}}function _s(t,e,r,i){for(const n in t)if(i&&t[n]instanceof Error)t[n]=mt.stdSerializers.err(t[n]);else if(typeof t[n]=="object"&&!Array.isArray(t[n])&&e)for(const s in t[n])e.indexOf(s)>-1&&s in r&&(t[n][s]=r[s](t[n][s]))}function Qp(t,e,r,i=!1){const n=e.send,s=e.ts,o=e.methodLevel,a=e.methodValue,c=e.val,u=t._logEvent.bindings;i||_s(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=s,t._logEvent.messages=r.filter(function(l){return u.indexOf(l)===-1}),t._logEvent.level.label=o,t._logEvent.level.value=a,n(o,t._logEvent,c),t._logEvent=xs(u)}function xs(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Qa(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 eg(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?ec:tc}function Qi(){return{}}function Is(t){return t}function Fr(){}function ec(){return!1}function tc(){return Date.now()}function tg(){return Math.round(Date.now()/1e3)}function rg(){return new Date(Date.now()).toISOString()}function ig(){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)||{}}}ut.exports.default=mt,ut.exports.pino=mt;const ng={level:"info"},en="custom_context",Ss=1e3*1024;var sg=Object.defineProperty,og=(t,e,r)=>e in t?sg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Lt=(t,e,r)=>og(t,typeof e!="symbol"?e+"":e,r);let ag=class{constructor(e){Lt(this,"nodeValue"),Lt(this,"sizeInBytes"),Lt(this,"next"),this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},rc=class{constructor(e){Lt(this,"lengthInNodes"),Lt(this,"sizeInBytes"),Lt(this,"head"),Lt(this,"tail"),Lt(this,"maxSizeInBytes"),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new ag(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}}}}};const cg=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r);function ic(t){return typeof t=="string"?t:cg(t)||""}var ug=Object.defineProperty,lg=(t,e,r)=>e in t?ug(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tn=(t,e,r)=>lg(t,typeof e!="symbol"?e+"":e,r);let nc=class{constructor(e,r=Ss){tn(this,"logs"),tn(this,"level"),tn(this,"levelValue"),tn(this,"MAX_LOG_SIZE_IN_BYTES"),this.level=e??"error",this.levelValue=ut.exports.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new rc(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===ut.exports.levels.values.error?console.error(e):r===ut.exports.levels.values.warn?console.warn(e):r===ut.exports.levels.values.debug?console.debug(e):r===ut.exports.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(ic({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 rc(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(ic({extraMetadata:e})),new Blob(r,{type:"application/json"})}};var hg=Object.defineProperty,fg=(t,e,r)=>e in t?hg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,dg=(t,e,r)=>fg(t,e+"",r);let pg=class{constructor(e,r=Ss){dg(this,"baseChunkLogger"),this.baseChunkLogger=new nc(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)),i=document.createElement("a");i.href=r,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}};var gg=Object.defineProperty,yg=(t,e,r)=>e in t?gg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wg=(t,e,r)=>yg(t,e+"",r);let mg=class{constructor(e,r=Ss){wg(this,"baseChunkLogger"),this.baseChunkLogger=new nc(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 bg=Object.defineProperty,Eg=Object.defineProperties,vg=Object.getOwnPropertyDescriptors,sc=Object.getOwnPropertySymbols,_g=Object.prototype.hasOwnProperty,xg=Object.prototype.propertyIsEnumerable,oc=(t,e,r)=>e in t?bg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kt=(t,e)=>{for(var r in e||(e={}))_g.call(e,r)&&oc(t,r,e[r]);if(sc)for(var r of sc(e))xg.call(e,r)&&oc(t,r,e[r]);return t},Mt=(t,e)=>Eg(t,vg(e));function Ig(t){return Mt(kt({},t),{level:t?.level||ng.level})}function Sg(t,e,r=en){return t[r]=e,t}function Be(t,e=en){return t[e]||""}function Dg(t,e,r=en){const i=Be(t,r);return i.trim()?`${i}/${e}`:e}function ke(t,e,r=en){const i=Dg(t,e,r),n=t.child({context:i});return Sg(n,i,r)}function Ag(t){var e,r;const i=new pg((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:ut.exports(Mt(kt({},t.opts),{level:"trace",browser:Mt(kt({},(r=t.opts)==null?void 0:r.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function Og(t){var e,r;const i=new mg((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:ut.exports(Mt(kt({},t.opts),{level:"trace",browser:Mt(kt({},(r=t.opts)==null?void 0:r.browser),{write:n=>i.write(n)})}),i),chunkLoggerController:i}}function ac(t){var e;if(typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string")return{logger:t.loggerOverride,chunkLoggerController:null};const r=Mt(kt({},t.opts),{level:typeof t.loggerOverride=="string"?t.loggerOverride:(e=t.opts)==null?void 0:e.level});return typeof window<"u"?Ag(Mt(kt({},t),{opts:r})):Og(Mt(kt({},t),{opts:r}))}class Tg extends fr{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}class Bg extends fr{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}}let Rg=class{constructor(e,r){this.logger=e,this.core=r}};class Pg extends fr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class $g extends fr{constructor(e){super()}}class Ng{constructor(e,r,i,n){this.core=e,this.logger=r,this.name=i}}let Cg=class extends fr{constructor(e,r){super(),this.relayer=e,this.logger=r}},Fg=class extends fr{constructor(e,r){super(),this.core=e,this.logger=r}};class Ug{constructor(e,r,i){this.core=e,this.logger=r,this.store=i}}let Lg=class{constructor(e,r){this.projectId=e,this.logger=r}},kg=class{constructor(e,r,i){this.core=e,this.logger=r,this.telemetryEnabled=i}};class Mg{constructor(e){this.opts=e,this.protocol="wc",this.version=2}}let qg=class{constructor(e){this.client=e}};function zg(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function cc(t,...e){if(!zg(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 uc(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 jg(t,e){cc(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const Ur=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ds=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function Vg(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function lc(t){return typeof t=="string"&&(t=Vg(t)),cc(t),t}let Kg=class{clone(){return this._cloneInto()}};function Hg(t){const e=i=>t().update(lc(i)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function hc(t=32){if(Ur&&typeof Ur.getRandomValues=="function")return Ur.getRandomValues(new Uint8Array(t));if(Ur&&typeof Ur.randomBytes=="function")return Ur.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function Gg(t,e,r,i){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,i);const n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,u=i?0:4;t.setUint32(e+c,o,i),t.setUint32(e+u,a,i)}let Wg=class extends Kg{constructor(e,r,i,n){super(),this.blockLen=e,this.outputLen=r,this.padOffset=i,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Ds(this.buffer)}update(e){uc(this);const{view:r,buffer:i,blockLen:n}=this;e=lc(e);const s=e.length;for(let o=0;o<s;){const a=Math.min(n-this.pos,s-o);if(a===n){const c=Ds(e);for(;n<=s-o;o+=n)this.process(c,o);continue}i.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){uc(this),jg(e,this),this.finished=!0;const{buffer:r,view:i,blockLen:n,isLE:s}=this;let{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(i,0),o=0);for(let h=o;h<n;h++)r[h]=0;Gg(i,n-8,BigInt(this.length*8),s),this.process(i,0);const a=Ds(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 i=e.slice(0,r);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:i,length:n,finished:s,destroyed:o,pos:a}=this;return e.length=n,e.pos=a,e.finished=s,e.destroyed=o,n%r&&e.buffer.set(i),e}};const rn=BigInt(2**32-1),As=BigInt(32);function fc(t,e=!1){return e?{h:Number(t&rn),l:Number(t>>As&rn)}:{h:Number(t>>As&rn)|0,l:Number(t&rn)|0}}function Yg(t,e=!1){let r=new Uint32Array(t.length),i=new Uint32Array(t.length);for(let n=0;n<t.length;n++){const{h:s,l:o}=fc(t[n],e);[r[n],i[n]]=[s,o]}return[r,i]}const Zg=(t,e)=>BigInt(t>>>0)<<As|BigInt(e>>>0),Xg=(t,e,r)=>t>>>r,Jg=(t,e,r)=>t<<32-r|e>>>r,Qg=(t,e,r)=>t>>>r|e<<32-r,e0=(t,e,r)=>t<<32-r|e>>>r,t0=(t,e,r)=>t<<64-r|e>>>r-32,r0=(t,e,r)=>t>>>r-32|e<<64-r,i0=(t,e)=>e,n0=(t,e)=>t,s0=(t,e,r)=>t<<r|e>>>32-r,o0=(t,e,r)=>e<<r|t>>>32-r,a0=(t,e,r)=>e<<r-32|t>>>64-r,c0=(t,e,r)=>t<<r-32|e>>>64-r;function u0(t,e,r,i){const n=(e>>>0)+(i>>>0);return{h:t+r+(n/2**32|0)|0,l:n|0}}const l0=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),h0=(t,e,r,i)=>e+r+i+(t/2**32|0)|0,f0=(t,e,r,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),d0=(t,e,r,i,n)=>e+r+i+n+(t/2**32|0)|0,p0=(t,e,r,i,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0)+(n>>>0),g0=(t,e,r,i,n,s)=>e+r+i+n+s+(t/2**32|0)|0,W={fromBig:fc,split:Yg,toBig:Zg,shrSH:Xg,shrSL:Jg,rotrSH:Qg,rotrSL:e0,rotrBH:t0,rotrBL:r0,rotr32H:i0,rotr32L:n0,rotlSH:s0,rotlSL:o0,rotlBH:a0,rotlBL:c0,add:u0,add3L:l0,add3H:h0,add4L:f0,add4H:d0,add5H:g0,add5L:p0},[y0,w0]=W.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4