UNPKG

@walletconnect/sign-client

Version:

Sign Client for WalletConnect Protocol

14 lines (12 loc) 406 kB
(function(W,bt){typeof exports=="object"&&typeof module<"u"?bt(exports):typeof define=="function"&&define.amd?define(["exports"],bt):(W=typeof globalThis<"u"?globalThis:W||self,bt(W["@walletconnect/sign-client"]={}))})(this,function(W){"use strict";var bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ka(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 Ke={exports:{}},Cr=typeof Reflect=="object"?Reflect:null,Ha=Cr&&typeof Cr.apply=="function"?Cr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},li;Cr&&typeof Cr.ownKeys=="function"?li=Cr.ownKeys:Object.getOwnPropertySymbols?li=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:li=function(e){return Object.getOwnPropertyNames(e)};function Gf(t){console&&console.warn&&console.warn(t)}var Wa=Number.isNaN||function(e){return e!==e};function re(){re.init.call(this)}Ke.exports=re,Ke.exports.once=Jf,re.EventEmitter=re,re.prototype._events=void 0,re.prototype._eventsCount=0,re.prototype._maxListeners=void 0;var Ga=10;function hi(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(re,"defaultMaxListeners",{enumerable:!0,get:function(){return Ga},set:function(t){if(typeof t!="number"||t<0||Wa(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ga=t}}),re.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},re.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Wa(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 Ya(t){return t._maxListeners===void 0?re.defaultMaxListeners:t._maxListeners}re.prototype.getMaxListeners=function(){return Ya(this)},re.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")Ha(c,this,r);else for(var u=c.length,l=ec(c,u),n=0;n<u;++n)Ha(l[n],this,r);return!0};function Za(t,e,r,n){var i,s,o;if(hi(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=Ya(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,Gf(a)}return t}re.prototype.addListener=function(e,r){return Za(this,e,r,!1)},re.prototype.on=re.prototype.addListener,re.prototype.prependListener=function(e,r){return Za(this,e,r,!0)};function Yf(){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 Xa(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Yf.bind(n);return i.listener=r,n.wrapFn=i,i}re.prototype.once=function(e,r){return hi(r),this.on(e,Xa(this,e,r)),this},re.prototype.prependOnceListener=function(e,r){return hi(r),this.prependListener(e,Xa(this,e,r)),this},re.prototype.removeListener=function(e,r){var n,i,s,o,a;if(hi(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():Zf(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this},re.prototype.off=re.prototype.removeListener,re.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 Ja(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?Xf(i):ec(i,i.length)}re.prototype.listeners=function(e){return Ja(this,e,!0)},re.prototype.rawListeners=function(e){return Ja(this,e,!1)},re.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Qa.call(t,e)},re.prototype.listenerCount=Qa;function Qa(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}re.prototype.eventNames=function(){return this._eventsCount>0?li(this._events):[]};function ec(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Zf(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Xf(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Jf(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))}tc(t,e,s,{once:!0}),e!=="error"&&Qf(t,i,{once:!0})})}function Qf(t,e,r){typeof t.on=="function"&&tc(t,"error",e,r)}function tc(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 F={};/*! ***************************************************************************** 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 ys=function(t,e){return ys=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])},ys(t,e)};function ep(t,e){ys(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var ws=function(){return ws=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},ws.apply(this,arguments)};function tp(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 rp(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 np(t,e){return function(r,n){e(r,n,t)}}function ip(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function sp(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 op(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 ap(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}function cp(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function bs(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 rc(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 up(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(rc(arguments[e]));return t}function lp(){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 gn(t){return this instanceof gn?(this.v=t,this):new gn(t)}function hp(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(d){n[d]&&(i[d]=function(p){return new Promise(function(f,y){s.push([d,p,f,y])>1||a(d,p)})})}function a(d,p){try{c(n[d](p))}catch(f){h(s[0][3],f)}}function c(d){d.value instanceof gn?Promise.resolve(d.value.v).then(u,l):h(s[0][2],d)}function u(d){a("next",d)}function l(d){a("throw",d)}function h(d,p){d(p),s.shift(),s.length&&a(s[0][0],s[0][1])}}function dp(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:gn(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function fp(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 bs=="function"?bs(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 pp(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function gp(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 yp(t){return t&&t.__esModule?t:{default:t}}function wp(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function bp(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 mp=Object.freeze({__proto__:null,__extends:ep,get __assign(){return ws},__rest:tp,__decorate:rp,__param:np,__metadata:ip,__awaiter:sp,__generator:op,__createBinding:ap,__exportStar:cp,__values:bs,__read:rc,__spread:up,__spreadArrays:lp,__await:gn,__asyncGenerator:hp,__asyncDelegator:dp,__asyncValues:fp,__makeTemplateObject:pp,__importStar:gp,__importDefault:yp,__classPrivateFieldGet:wp,__classPrivateFieldSet:bp}),di=Ka(mp),ms={},yn={},nc;function vp(){if(nc)return yn;nc=1,Object.defineProperty(yn,"__esModule",{value:!0}),yn.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return yn.delay=t,yn}var lr={},vs={},hr={},ic;function Ep(){return ic||(ic=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 Es={},sc;function _p(){return sc||(sc=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}(Es)),Es}var oc;function ac(){return oc||(oc=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=di;e.__exportStar(Ep(),t),e.__exportStar(_p(),t)}(vs)),vs}var cc;function Sp(){if(cc)return lr;cc=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.fromMiliseconds=lr.toMiliseconds=void 0;const t=ac();function e(n){return n*t.ONE_THOUSAND}lr.toMiliseconds=e;function r(n){return Math.floor(n/t.ONE_THOUSAND)}return lr.fromMiliseconds=r,lr}var uc;function Ip(){return uc||(uc=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=di;e.__exportStar(vp(),t),e.__exportStar(Sp(),t)}(ms)),ms}var Br={},lc;function xp(){if(lc)return Br;lc=1,Object.defineProperty(Br,"__esModule",{value:!0}),Br.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 Br.Watch=t,Br.default=t,Br}var _s={},wn={},hc;function Op(){if(hc)return wn;hc=1,Object.defineProperty(wn,"__esModule",{value:!0}),wn.IWatch=void 0;class t{}return wn.IWatch=t,wn}var dc;function Dp(){return dc||(dc=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),di.__exportStar(Op(),t)}(_s)),_s}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=di;e.__exportStar(Ip(),t),e.__exportStar(xp(),t),e.__exportStar(Dp(),t),e.__exportStar(ac(),t)})(F);class dr{}class Ap extends dr{constructor(e){super()}}const fc=F.FIVE_SECONDS,Fr={pulse:"heartbeat_pulse"};class Ss extends Ap{constructor(e){super(e),this.events=new Ke.exports.EventEmitter,this.interval=fc,this.interval=e?.interval||fc}static async init(e){const r=new Ss(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(),F.toMiliseconds(this.interval))}pulse(){this.events.emit(Fr.pulse)}}const $p=/"(?:_|\\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*:/,Tp=/"(?: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*:/,Pp=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Np(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){Rp(t);return}return e}function Rp(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function fi(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!Pp.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if($p.test(t)||Tp.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,Np)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}function Cp(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function _e(t,...e){try{return Cp(t(...e))}catch(r){return Promise.reject(r)}}function Bp(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function Fp(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function pi(t){if(Bp(t))return String(t);if(Fp(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return pi(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const Is="base64:";function Lp(t){return typeof t=="string"?t:Is+Mp(t)}function Up(t){return typeof t!="string"||!t.startsWith(Is)?t:kp(t.slice(Is.length))}function kp(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function Mp(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function He(t){return t&&t.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function jp(...t){return He(t.join(":"))}function gi(t){return t=He(t),t?t+":":""}function qD(t){return t}const qp="memory",zp=()=>{const t=new Map;return{name:qp,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||zp()},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=He(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 pc(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 d=new Map,p=f=>{let y=d.get(f.base);return y||(y={driver:f.driver,base:f.base,items:[]},d.set(f.base,y)),y};for(const f of u){const y=typeof f=="string",g=He(y?f:f.key),b=y?void 0:f.value,w=y||!f.options?l:{...l,...f.options},m=r(g);p(m).items.push({key:g,value:b,relativeKey:m.relativeKey,options:w})}return Promise.all([...d.values()].map(f=>h(f))).then(f=>f.flat())},c={hasItem(u,l={}){u=He(u);const{relativeKey:h,driver:d}=r(u);return _e(d.hasItem,h,l)},getItem(u,l={}){u=He(u);const{relativeKey:h,driver:d}=r(u);return _e(d.getItem,h,l).then(p=>fi(p))},getItems(u,l={}){return a(u,l,h=>h.driver.getItems?_e(h.driver.getItems,h.items.map(d=>({key:d.relativeKey,options:d.options})),l).then(d=>d.map(p=>({key:jp(h.base,p.key),value:fi(p.value)}))):Promise.all(h.items.map(d=>_e(h.driver.getItem,d.relativeKey,d.options).then(p=>({key:d.key,value:fi(p)})))))},getItemRaw(u,l={}){u=He(u);const{relativeKey:h,driver:d}=r(u);return d.getItemRaw?_e(d.getItemRaw,h,l):_e(d.getItem,h,l).then(p=>Up(p))},async setItem(u,l,h={}){if(l===void 0)return c.removeItem(u);u=He(u);const{relativeKey:d,driver:p}=r(u);p.setItem&&(await _e(p.setItem,d,pi(l),h),p.watch||i("update",u))},async setItems(u,l){await a(u,l,async h=>{if(h.driver.setItems)return _e(h.driver.setItems,h.items.map(d=>({key:d.relativeKey,value:pi(d.value),options:d.options})),l);h.driver.setItem&&await Promise.all(h.items.map(d=>_e(h.driver.setItem,d.relativeKey,pi(d.value),d.options)))})},async setItemRaw(u,l,h={}){if(l===void 0)return c.removeItem(u,h);u=He(u);const{relativeKey:d,driver:p}=r(u);if(p.setItemRaw)await _e(p.setItemRaw,d,l,h);else if(p.setItem)await _e(p.setItem,d,Lp(l),h);else return;p.watch||i("update",u)},async removeItem(u,l={}){typeof l=="boolean"&&(l={removeMeta:l}),u=He(u);const{relativeKey:h,driver:d}=r(u);d.removeItem&&(await _e(d.removeItem,h,l),(l.removeMeta||l.removeMata)&&await _e(d.removeItem,h+"$",l),d.watch||i("remove",u))},async getMeta(u,l={}){typeof l=="boolean"&&(l={nativeOnly:l}),u=He(u);const{relativeKey:h,driver:d}=r(u),p=Object.create(null);if(d.getMeta&&Object.assign(p,await _e(d.getMeta,h,l)),!l.nativeOnly){const f=await _e(d.getItem,h+"$",l).then(y=>fi(y));f&&typeof f=="object"&&(typeof f.atime=="string"&&(f.atime=new Date(f.atime)),typeof f.mtime=="string"&&(f.mtime=new Date(f.mtime)),Object.assign(p,f))}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=gi(u);const h=n(u,!0);let d=[];const p=[];for(const f of h){const y=await _e(f.driver.getKeys,f.relativeBase,l);for(const g of y){const b=f.mountpoint+He(g);d.some(w=>b.startsWith(w))||p.push(b)}d=[f.mountpoint,...d.filter(g=>!g.startsWith(f.mountpoint))]}return u?p.filter(f=>f.startsWith(u)&&f[f.length-1]!=="$"):p.filter(f=>f[f.length-1]!=="$")},async clear(u,l={}){u=gi(u),await Promise.all(n(u,!1).map(async h=>{if(h.driver.clear)return _e(h.driver.clear,h.relativeBase,l);if(h.driver.removeItem){const d=await h.driver.getKeys(h.relativeBase||"",l);return Promise.all(d.map(p=>h.driver.removeItem(p,l)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(u=>gc(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=gi(u),u&&e.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(e.mountpoints.push(u),e.mountpoints.sort((h,d)=>d.length-h.length)),e.mounts[u]=l,e.watching&&Promise.resolve(pc(l,i,u)).then(h=>{e.unwatch[u]=h}).catch(console.error),c},async unmount(u,l=!0){u=gi(u),!(!u||!e.mounts[u])&&(e.watching&&u in e.unwatch&&(e.unwatch[u]?.(),delete e.unwatch[u]),l&&await gc(e.mounts[u]),e.mountpoints=e.mountpoints.filter(h=>h!==u),delete e.mounts[u])},getMount(u=""){u=He(u)+":";const l=r(u);return{driver:l.driver,base:l.base}},getMounts(u="",l={}){return u=He(u),n(u,l.parents).map(d=>({driver:d.driver,base:d.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 pc(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function gc(t){typeof t.dispose=="function"&&await _e(t.dispose)}function fr(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function yc(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const n=fr(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}let xs;function bn(){return xs||(xs=yc("keyval-store","keyval")),xs}function wc(t,e=bn()){return e("readonly",r=>fr(r.get(t)))}function Kp(t,e,r=bn()){return r("readwrite",n=>(n.put(e,t),fr(n.transaction)))}function Hp(t,e=bn()){return e("readwrite",r=>(r.delete(t),fr(r.transaction)))}function Wp(t=bn()){return t("readwrite",e=>(e.clear(),fr(e.transaction)))}function Gp(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},fr(t.transaction)}function Yp(t=bn()){return t("readonly",e=>{if(e.getAllKeys)return fr(e.getAllKeys());const r=[];return Gp(e,n=>r.push(n.key)).then(()=>r)})}const Zp=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),Xp=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 Lr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return Xp(t)}catch{return t}}function pr(t){return typeof t=="string"?t:Zp(t)||""}const Jp="idb-keyval";var Qp=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i;let n;return t.dbName&&t.storeName&&(n=yc(t.dbName,t.storeName)),{name:Jp,options:t,async hasItem(i){return!(typeof await wc(r(i),n)>"u")},async getItem(i){return await wc(r(i),n)??null},setItem(i,s){return Kp(r(i),s,n)},removeItem(i){return Hp(r(i),n)},getKeys(){return Yp(n)},clear(){return Wp(n)}}};const eg="WALLET_CONNECT_V2_INDEXED_DB",tg="keyvaluestorage";class rg{constructor(){this.indexedDb=Vp({driver:Qp({dbName:eg,storeName:tg})})}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,pr(r))}async removeItem(e){await this.indexedDb.removeItem(e)}}var Os=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},yi={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 Os<"u"&&Os.localStorage?yi.exports=Os.localStorage:typeof window<"u"&&window.localStorage?yi.exports=window.localStorage:yi.exports=new e})();function ng(t){var e;return[t[0],Lr((e=t[1])!=null?e:"")]}class ig{constructor(){this.localStorage=yi.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(ng)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return Lr(r)}async setItem(e,r){this.localStorage.setItem(e,pr(r))}async removeItem(e){this.localStorage.removeItem(e)}}const sg="wc_storage_version",bc=1,og=async(t,e,r)=>{const n=sg,i=await e.getItem(n);if(i&&i>=bc){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,bc),r(e),ag(t,o)},ag=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};class cg{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new ig;this.storage=e;try{const r=new rg;og(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 ug(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var lg=hg;function hg(t,e,r){var n=r&&r.stringify||ug,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,d=t&&t.length||0,p=0;p<d;){if(t.charCodeAt(p)===37&&p+1<d){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 f=typeof e[l];if(f==="string"){u+="'"+e[l]+"'",h=p+2,p++;break}if(f==="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<d&&(u+=t.slice(h)),u)}const mc=lg;var Pt=mt;const mn=Eg().console||{},dg={mapHttpRequest:bi,mapHttpResponse:bi,wrapRequestSerializer:As,wrapResponseSerializer:As,wrapErrorSerializer:As,req:bi,res:bi,err:wg};function fg(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!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||mn;t.browser.write&&(t.browser.asObject=!0);const n=t.serializers||{},i=fg(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:d});const u={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:bg(t)};c.levels=mt.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=Ds());function l(){return this.level==="silent"?1/0:this.levels.values[this.level]}function h(){return this._level}function d(f){if(f!=="silent"&&!this.levels.values[f])throw Error("unknown level "+f);this._level=f,Ur(u,c,"error","log"),Ur(u,c,"fatal","error"),Ur(u,c,"warn","error"),Ur(u,c,"info","log"),Ur(u,c,"debug","log"),Ur(u,c,"trace","log")}function p(f,y){if(!f)throw new Error("missing bindings for child Pino");y=y||{},i&&f.serializers&&(y.serializers=f.serializers);const g=y.serializers;if(i&&g){var b=Object.assign({},n,g),w=t.browser.serialize===!0?Object.keys(b):i;delete f.serializers,wi([f],w,b,this._stdErrSerialize)}function m(E){this._childLevel=(E._childLevel|0)+1,this.error=kr(E,f,"error"),this.fatal=kr(E,f,"fatal"),this.warn=kr(E,f,"warn"),this.info=kr(E,f,"info"),this.debug=kr(E,f,"debug"),this.trace=kr(E,f,"trace"),b&&(this.serializers=b,this._serialize=w),e&&(this._logEvent=Ds([].concat(E._logEvent.bindings,f)))}return m.prototype=this,new m(this)}return c}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=dg,mt.stdTimeFunctions=Object.assign({},{nullTime:vc,epochTime:Ec,unixTime:mg,isoTime:vg});function Ur(t,e,r,n){const i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?vn:i[r]?i[r]:mn[r]||mn[n]||vn,pg(t,e,r)}function pg(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)===mn?mn:this;for(var c=0;c<o.length;c++)o[c]=arguments[c];if(t.serialize&&!t.asObject&&wi(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?n.call(a,gg(this,r,o,s)):n.apply(a,o),t.transmit){const u=t.transmit.level||e.level,l=mt.levels.values[u],h=mt.levels.values[r];if(h<l)return;yg(this,{ts:s,methodLevel:r,methodValue:h,transmitLevel:u,transmitValue:mt.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function gg(t,e,r,n){t._serialize&&wi(r,t._serialize,t.serializers,t._stdErrSerialize);const i=r.slice();let s=i[0];const o={};n&&(o.time=n),o.level=mt.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?mc(i.shift(),i):void 0}else typeof s=="string"&&(s=mc(i.shift(),i));return s!==void 0&&(o.msg=s),o}function wi(t,e,r,n){for(const i in t)if(n&&t[i]instanceof Error)t[i]=mt.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 kr(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 yg(t,e,r){const n=e.send,i=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,c=t._logEvent.bindings;wi(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=Ds(c)}function Ds(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function wg(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 bg(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?vc:Ec}function bi(){return{}}function As(t){return t}function vn(){}function vc(){return!1}function Ec(){return Date.now()}function mg(){return Math.round(Date.now()/1e3)}function vg(){return new Date(Date.now()).toISOString()}function Eg(){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 _g={level:"info"},En="custom_context",$s=1e3*1024;class Sg{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 _c{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new Sg(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 Sc{constructor(e,r=$s){this.level=e??"error",this.levelValue=Pt.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new _c(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===Pt.levels.values.error?console.error(e):r===Pt.levels.values.warn?console.warn(e):r===Pt.levels.values.debug?console.debug(e):r===Pt.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(pr({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 _c(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(pr({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class Ig{constructor(e,r=$s){this.baseChunkLogger=new Sc(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 xg{constructor(e,r=$s){this.baseChunkLogger=new Sc(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 Og=Object.defineProperty,Dg=Object.defineProperties,Ag=Object.getOwnPropertyDescriptors,Ic=Object.getOwnPropertySymbols,$g=Object.prototype.hasOwnProperty,Tg=Object.prototype.propertyIsEnumerable,xc=(t,e,r)=>e in t?Og(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mi=(t,e)=>{for(var r in e||(e={}))$g.call(e,r)&&xc(t,r,e[r]);if(Ic)for(var r of Ic(e))Tg.call(e,r)&&xc(t,r,e[r]);return t},vi=(t,e)=>Dg(t,Ag(e));function Ts(t){return vi(mi({},t),{level:t?.level||_g.level})}function Pg(t,e=En){return t[e]||""}function Ng(t,e,r=En){return t[r]=e,t}function We(t,e=En){let r="";return typeof t.bindings>"u"?r=Pg(t,e):r=t.bindings().context||"",r}function Rg(t,e,r=En){const n=We(t,r);return n.trim()?`${n}/${e}`:e}function Me(t,e,r=En){const n=Rg(t,e,r),i=t.child({context:n});return Ng(i,n,r)}function Cg(t){var e,r;const n=new Ig((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Pt(vi(mi({},t.opts),{level:"trace",browser:vi(mi({},(r=t.opts)==null?void 0:r.browser),{write:i=>n.write(i)})})),chunkLoggerController:n}}function Bg(t){var e;const r=new xg((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Pt(vi(mi({},t.opts),{level:"trace"})),chunkLoggerController:r}}function Fg(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Cg(t):Bg(t)}var Lg=Object.defineProperty,Ug=(t,e,r)=>e in t?Lg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Oc=(t,e,r)=>Ug(t,typeof e!="symbol"?e+"":e,r);class kg extends dr{constructor(e){super(),this.opts=e,Oc(this,"protocol","wc"),Oc(this,"version",2)}}var Mg=Object.defineProperty,jg=(t,e,r)=>e in t?Mg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qg=(t,e,r)=>jg(t,typeof e!="symbol"?e+"":e,r);class zg extends dr{constructor(e,r){super(),this.core=e,this.logger=r,qg(this,"records",new Map)}}class Vg{constructor(e,r){this.logger=e,this.core=r}}class Kg extends dr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Hg extends dr{constructor(e){super()}}class Wg{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}}class Gg extends dr{constructor(e,r){super(),this.relayer=e,this.logger=r}}class Yg extends dr{constructor(e,r){super(),this.core=e,this.logger=r}}class Zg{constructor(e,r,n){this.core=e,this.logger=r,this.store=n}}class Xg{constructor(e,r){this.projectId=e,this.logger=r}}class Jg{constructor(e,r,n){this.core=e,this.logger=r,this.telemetryEnabled=n}}var Qg=Object.defineProperty,ey=(t,e,r)=>e in t?Qg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dc=(t,e,r)=>ey(t,typeof e!="symbol"?e+"":e,r);class ty{constructor(e){this.opts=e,Dc(this,"protocol","wc"),Dc(this,"version",2)}}class ry{constructor(e){this.client=e}}function ny(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function Ac(t,...e){if(!ny(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 $c(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 iy(t,e){Ac(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const Mr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ps=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function sy(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}function Tc(t){return typeof t=="string"&&(t=sy(t)),Ac(t),t}class oy{clone(){return this._cloneInto()}}function ay(t){const e=n=>t().update(Tc(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Pc(t=32){if(Mr&&typeof Mr.getRandomValues=="function")return Mr.getRandomValues(new Uint8Array(t));if(Mr&&typeof Mr.randomBytes=="function")return Mr.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}function cy(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 uy extends oy{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=Ps(this.buffer)}update(e){$c(this);const{view:r,buffer:n,blockLen:i}=this;e=Tc(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=Ps(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){$c(this),iy(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;cy(n,i-8,BigInt(this.length*8),s),this.process(n,0);const a=Ps(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 Ei=BigInt(2**32-1),Ns=BigInt(32);function Nc(t,e=!1){return e?{h:Number(t&Ei),l:Number(t>>Ns&Ei)}:{h:Number(t>>Ns&Ei)|0,l:Number(t&Ei)|0}}function ly(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}=Nc(t[i],e);[r[i],n[i]]=[s,o]}return[r,n]}const hy=(t,e)=>BigInt(t>>>0)<<Ns|BigInt(e>>>0),dy=(t,e,r)=>t>>>r,fy=(t,e,r)=>t<<32-r|e>>>r,py=(t,e,r)=>t>>>r|e<<32-r,gy=(t,e,r)=>t<<32-r|e>>>r,yy=(t,e,r)=>t<<64-r|e>>>r-32,wy=(t,e,r)=>t>>>r-32|e<<64-r,by=(t,e)=>e,my=(t,e)=>t,vy=(t,e,r)=>t<<r|e>>>32-r,Ey=(t,e,r)=>e<<r|t>>>32-r,_y=(t,e,r)=>e<<r-32|t>>>64-r,Sy=(t,e,r)=>t<<r-32|e>>>64-r;function Iy(t,e,r,n){const i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}const xy=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Oy=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Dy=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),Ay=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,$y=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),Ty=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0,H={fromBig:Nc,split:ly,toBig:hy,shrSH:dy,shrSL:fy,rotrSH:py,rotrSL:gy,rotrBH:yy,rotrBL:wy,rotr32H:by,rotr32L:my,rotlSH:vy,rotlSL:Ey,rotlBH:_y,rotlBL:Sy,add:Iy,add3L:xy,add3H:Oy,add4L:Dy,add4H:Ay,add5H:Ty,add5L:$y},[Py,Ny]=H.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))),Gt=new Uint32Array(80),Yt=new Uint32Array(80);class Ry extends uy{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:d,Gh:p,Gl:f,Hh:y,Hl:g}=this;return[e,r,n,i,s,o,a,c,u,l,h,d,p,f,y,g]}set(e,r,n,i,s,o,a,c,u,l,h,d,p,f,y,g){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=d|0,this.Gh=p|0,this.Gl=f|0,this.Hh=y|0,this.Hl=g|0}process(e,r){for(let m=0;m<16;m++,r+=4)Gt[m]=e.getUint32(r),Yt[m]=e.getUint32(r+=4);for(let m=16;m<80;m++){const E=Gt[m-15]|0,T=Yt[m-15]|0,O=H.rotrSH(E,T,1)^H.rotrSH(E,T,8)^H.shrSH(E,T,7),S=H.rotrSL(E,T,1)^H.rotrSL(E,T,8)^H.shrSL(E,T,7),$=Gt[m-2]|0,I=Yt[m-2]|0,M=H.rotrSH($,I,19)^H.rotrBH($,I,61)^H.shrSH($,I,6),R=H.rotrSL($,I,19)^H.rotrBL($,I,61)^H.shrSL($,I,6),B=H.add4L(S,R,Yt[m-7],Yt[m-16]),j=H.add4H(B,O,M,Gt[m-7],Gt[m-16]);Gt[m]=j|0,Yt[m]=B|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:h,El:d,Fh:p,Fl:f,Gh:y,Gl:g,Hh:b,Hl:w}=this;for(let m=0;m<80;m++){const E=H.rotrSH(h,d,14)^H.rotrSH(h,d,18)^H.rotrBH(h,d,41),T=H.rotrSL(h,d,14)^H.rotrSL(h,d,18)^H.rotrBL(h,d,41),O=h&p^~h&y,S=d&f^~d&g,$=H.add5L(w,T,S,Ny[m],Yt[m]),I=H.add5H($,b,E,O,Py[m],Gt[m]