UNPKG

@skalenetwork/metaport

Version:

SKALE Metaport Widget

1,604 lines 119 kB
import { s as Ar, a as qr, p as Ur, c as ne, I as $r, E as Ut, f as ut, J as _t, H as Pr } from "./http-ff4a9d39.mjs"; import { p as $e, t as Dr, u as jr, v as Hr, w as Wr, x as Fr, y as Br, z as zr, A as Qr, C as Vr, D as Jr, E as Gr, F as Yr, G as Kr, J as Zr, K as Xr, L as eo, M as to, N as no, q as $t, O as ro } from "./index-4375ce67.mjs"; import "react"; import "react/jsx-runtime"; import "react-dom"; var re, y, Pt, H, dt, Dt, Re, jt, X = {}, Ht = [], oo = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, pe = Array.isArray; function A(t, e) { for (var n in e) t[n] = e[n]; return t; } function Wt(t) { var e = t.parentNode; e && e.removeChild(t); } function M(t, e, n) { var r, o, i, c = {}; for (i in e) i == "key" ? r = e[i] : i == "ref" ? o = e[i] : c[i] = e[i]; if (arguments.length > 2 && (c.children = arguments.length > 3 ? re.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (i in t.defaultProps) c[i] === void 0 && (c[i] = t.defaultProps[i]); return K(t, c, r, o, null); } function K(t, e, n, r, o) { var i = { type: t, props: e, key: n, ref: r, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: o ?? ++Pt, __i: -1, __u: 0 }; return o == null && y.vnode != null && y.vnode(i), i; } function Ft() { return { current: null }; } function L(t) { return t.children; } function N(t, e) { this.props = t, this.context = e; } function z(t, e) { if (e == null) return t.__ ? z(t.__, t.__i + 1) : null; for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e; return typeof t.type == "function" ? z(t) : null; } function Bt(t) { var e, n; if ((t = t.__) != null && t.__c != null) { for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) { t.__e = t.__c.base = n.__e; break; } return Bt(t); } } function Te(t) { (!t.__d && (t.__d = !0) && H.push(t) && !de.__r++ || dt !== y.debounceRendering) && ((dt = y.debounceRendering) || Dt)(de); } function de() { var t, e, n, r, o, i, c, l, d; for (H.sort(Re); t = H.shift(); ) t.__d && (e = H.length, r = void 0, i = (o = (n = t).__v).__e, l = [], d = [], (c = n.__P) && ((r = A({}, o)).__v = o.__v + 1, y.vnode && y.vnode(r), Pe(c, r, o, n.__n, c.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, l, i ?? z(o), !!(32 & o.__u), d), r.__.__k[r.__i] = r, Vt(l, r, d), r.__e != i && Bt(r)), H.length > e && H.sort(Re)); de.__r = 0; } function zt(t, e, n, r, o, i, c, l, d, _, m) { var s, b, v, k, I, S = r && r.__k || Ht, a = e.length; for (n.__d = d, io(n, e, S), d = n.__d, s = 0; s < a; s++) (v = n.__k[s]) != null && typeof v != "boolean" && typeof v != "function" && (b = v.__i === -1 ? X : S[v.__i] || X, v.__i = s, Pe(t, v, b, o, i, c, l, d, _, m), k = v.__e, v.ref && b.ref != v.ref && (b.ref && De(b.ref, null, v), m.push(v.ref, v.__c || k, v)), I == null && k != null && (I = k), 65536 & v.__u || b.__k === v.__k ? d = Qt(v, d, t) : typeof v.type == "function" && v.__d !== void 0 ? d = v.__d : k && (d = k.nextSibling), v.__d = void 0, v.__u &= -196609); n.__d = d, n.__e = I; } function io(t, e, n) { var r, o, i, c, l, d = e.length, _ = n.length, m = _, s = 0; for (t.__k = [], r = 0; r < d; r++) (o = t.__k[r] = (o = e[r]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? K(null, o, null, null, o) : pe(o) ? K(L, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? K(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = t, o.__b = t.__b + 1, l = so(o, n, c = r + s, m), o.__i = l, i = null, l !== -1 && (m--, (i = n[l]) && (i.__u |= 131072)), i == null || i.__v === null ? (l == -1 && s--, typeof o.type != "function" && (o.__u |= 65536)) : l !== c && (l === c + 1 ? s++ : l > c ? m > d - c ? s += l - c : s-- : s = l < c && l == c - 1 ? l - c : 0, l !== r + s && (o.__u |= 65536))) : (i = n[r]) && i.key == null && i.__e && (i.__e == t.__d && (t.__d = z(i)), Oe(i, i, !1), n[r] = null, m--); if (m) for (r = 0; r < _; r++) (i = n[r]) != null && !(131072 & i.__u) && (i.__e == t.__d && (t.__d = z(i)), Oe(i, i)); } function Qt(t, e, n) { var r, o; if (typeof t.type == "function") { for (r = t.__k, o = 0; r && o < r.length; o++) r[o] && (r[o].__ = t, e = Qt(r[o], e, n)); return e; } return t.__e != e && (n.insertBefore(t.__e, e || null), e = t.__e), e && e.nextSibling; } function q(t, e) { return e = e || [], t == null || typeof t == "boolean" || (pe(t) ? t.some(function(n) { q(n, e); }) : e.push(t)), e; } function so(t, e, n, r) { var o = t.key, i = t.type, c = n - 1, l = n + 1, d = e[n]; if (d === null || d && o == d.key && i === d.type) return n; if (r > (d != null && !(131072 & d.__u) ? 1 : 0)) for (; c >= 0 || l < e.length; ) { if (c >= 0) { if ((d = e[c]) && !(131072 & d.__u) && o == d.key && i === d.type) return c; c--; } if (l < e.length) { if ((d = e[l]) && !(131072 & d.__u) && o == d.key && i === d.type) return l; l++; } } return -1; } function ft(t, e, n) { e[0] === "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || oo.test(e) ? n : n + "px"; } function ce(t, e, n, r, o) { var i; e: if (e === "style") if (typeof n == "string") t.style.cssText = n; else { if (typeof r == "string" && (t.style.cssText = r = ""), r) for (e in r) n && e in n || ft(t.style, e, ""); if (n) for (e in n) r && n[e] === r[e] || ft(t.style, e, n[e]); } else if (e[0] === "o" && e[1] === "n") i = e !== (e = e.replace(/(PointerCapture)$|Capture$/, "$1")), e = e.toLowerCase() in t ? e.toLowerCase().slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + i] = n, n ? r ? n.u = r.u : (n.u = Date.now(), t.addEventListener(e, i ? pt : ht, i)) : t.removeEventListener(e, i ? pt : ht, i); else { if (o) e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s"); else if (e !== "width" && e !== "height" && e !== "href" && e !== "list" && e !== "form" && e !== "tabIndex" && e !== "download" && e !== "rowSpan" && e !== "colSpan" && e !== "role" && e in t) try { t[e] = n ?? ""; break e; } catch { } typeof n == "function" || (n == null || n === !1 && e[4] !== "-" ? t.removeAttribute(e) : t.setAttribute(e, n)); } } function ht(t) { var e = this.l[t.type + !1]; if (t.t) { if (t.t <= e.u) return; } else t.t = Date.now(); return e(y.event ? y.event(t) : t); } function pt(t) { return this.l[t.type + !0](y.event ? y.event(t) : t); } function Pe(t, e, n, r, o, i, c, l, d, _) { var m, s, b, v, k, I, S, a, u, h, f, g, E, w, R, x = e.type; if (e.constructor !== void 0) return null; 128 & n.__u && (d = !!(32 & n.__u), i = [l = e.__e = n.__e]), (m = y.__b) && m(e); e: if (typeof x == "function") try { if (a = e.props, u = (m = x.contextType) && r[m.__c], h = m ? u ? u.props.value : m.__ : r, n.__c ? S = (s = e.__c = n.__c).__ = s.__E : ("prototype" in x && x.prototype.render ? e.__c = s = new x(a, h) : (e.__c = s = new N(a, h), s.constructor = x, s.render = co), u && u.sub(s), s.props = a, s.state || (s.state = {}), s.context = h, s.__n = r, b = s.__d = !0, s.__h = [], s._sb = []), s.__s == null && (s.__s = s.state), x.getDerivedStateFromProps != null && (s.__s == s.state && (s.__s = A({}, s.__s)), A(s.__s, x.getDerivedStateFromProps(a, s.__s))), v = s.props, k = s.state, s.__v = e, b) x.getDerivedStateFromProps == null && s.componentWillMount != null && s.componentWillMount(), s.componentDidMount != null && s.__h.push(s.componentDidMount); else { if (x.getDerivedStateFromProps == null && a !== v && s.componentWillReceiveProps != null && s.componentWillReceiveProps(a, h), !s.__e && (s.shouldComponentUpdate != null && s.shouldComponentUpdate(a, s.__s, h) === !1 || e.__v === n.__v)) { for (e.__v !== n.__v && (s.props = a, s.state = s.__s, s.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.forEach(function(O) { O && (O.__ = e); }), f = 0; f < s._sb.length; f++) s.__h.push(s._sb[f]); s._sb = [], s.__h.length && c.push(s); break e; } s.componentWillUpdate != null && s.componentWillUpdate(a, s.__s, h), s.componentDidUpdate != null && s.__h.push(function() { s.componentDidUpdate(v, k, I); }); } if (s.context = h, s.props = a, s.__P = t, s.__e = !1, g = y.__r, E = 0, "prototype" in x && x.prototype.render) { for (s.state = s.__s, s.__d = !1, g && g(e), m = s.render(s.props, s.state, s.context), w = 0; w < s._sb.length; w++) s.__h.push(s._sb[w]); s._sb = []; } else do s.__d = !1, g && g(e), m = s.render(s.props, s.state, s.context), s.state = s.__s; while (s.__d && ++E < 25); s.state = s.__s, s.getChildContext != null && (r = A(A({}, r), s.getChildContext())), b || s.getSnapshotBeforeUpdate == null || (I = s.getSnapshotBeforeUpdate(v, k)), zt(t, pe(R = m != null && m.type === L && m.key == null ? m.props.children : m) ? R : [R], e, n, r, o, i, c, l, d, _), s.base = e.__e, e.__u &= -161, s.__h.length && c.push(s), S && (s.__E = s.__ = null); } catch (O) { e.__v = null, d || i != null ? (e.__e = l, e.__u |= d ? 160 : 32, i[i.indexOf(l)] = null) : (e.__e = n.__e, e.__k = n.__k), y.__e(O, e, n); } else i == null && e.__v === n.__v ? (e.__k = n.__k, e.__e = n.__e) : e.__e = ao(n.__e, e, n, r, o, i, c, d, _); (m = y.diffed) && m(e); } function Vt(t, e, n) { e.__d = void 0; for (var r = 0; r < n.length; r++) De(n[r], n[++r], n[++r]); y.__c && y.__c(e, t), t.some(function(o) { try { t = o.__h, o.__h = [], t.some(function(i) { i.call(o); }); } catch (i) { y.__e(i, o.__v); } }); } function ao(t, e, n, r, o, i, c, l, d) { var _, m, s, b, v, k, I, S = n.props, a = e.props, u = e.type; if (u === "svg" && (o = !0), i != null) { for (_ = 0; _ < i.length; _++) if ((v = i[_]) && "setAttribute" in v == !!u && (u ? v.localName === u : v.nodeType === 3)) { t = v, i[_] = null; break; } } if (t == null) { if (u === null) return document.createTextNode(a); t = o ? document.createElementNS("http://www.w3.org/2000/svg", u) : document.createElement(u, a.is && a), i = null, l = !1; } if (u === null) S === a || l && t.data === a || (t.data = a); else { if (i = i && re.call(t.childNodes), S = n.props || X, !l && i != null) for (S = {}, _ = 0; _ < t.attributes.length; _++) S[(v = t.attributes[_]).name] = v.value; for (_ in S) v = S[_], _ == "children" || (_ == "dangerouslySetInnerHTML" ? s = v : _ === "key" || _ in a || ce(t, _, null, v, o)); for (_ in a) v = a[_], _ == "children" ? b = v : _ == "dangerouslySetInnerHTML" ? m = v : _ == "value" ? k = v : _ == "checked" ? I = v : _ === "key" || l && typeof v != "function" || S[_] === v || ce(t, _, v, S[_], o); if (m) l || s && (m.__html === s.__html || m.__html === t.innerHTML) || (t.innerHTML = m.__html), e.__k = []; else if (s && (t.innerHTML = ""), zt(t, pe(b) ? b : [b], e, n, r, o && u !== "foreignObject", i, c, i ? i[0] : n.__k && z(n, 0), l, d), i != null) for (_ = i.length; _--; ) i[_] != null && Wt(i[_]); l || (_ = "value", k !== void 0 && (k !== t[_] || u === "progress" && !k || u === "option" && k !== S[_]) && ce(t, _, k, S[_], !1), _ = "checked", I !== void 0 && I !== t[_] && ce(t, _, I, S[_], !1)); } return t; } function De(t, e, n) { try { typeof t == "function" ? t(e) : t.current = e; } catch (r) { y.__e(r, n); } } function Oe(t, e, n) { var r, o; if (y.unmount && y.unmount(t), (r = t.ref) && (r.current && r.current !== t.__e || De(r, null, e)), (r = t.__c) != null) { if (r.componentWillUnmount) try { r.componentWillUnmount(); } catch (i) { y.__e(i, e); } r.base = r.__P = null, t.__c = void 0; } if (r = t.__k) for (o = 0; o < r.length; o++) r[o] && Oe(r[o], e, n || typeof t.type != "function"); n || t.__e == null || Wt(t.__e), t.__ = t.__e = t.__d = void 0; } function co(t, e, n) { return this.constructor(t, n); } function ee(t, e, n) { var r, o, i, c; y.__ && y.__(t, e), o = (r = typeof n == "function") ? null : n && n.__k || e.__k, i = [], c = [], Pe(e, t = (!r && n || e).__k = M(L, null, [t]), o || X, X, e.ownerSVGElement !== void 0, !r && n ? [n] : o ? null : e.firstChild ? re.call(e.childNodes) : null, i, !r && n ? n : o ? o.__e : e.firstChild, r, c), Vt(i, t, c); } function Jt(t, e) { ee(t, e, Jt); } function lo(t, e, n) { var r, o, i, c, l = A({}, t.props); for (i in t.type && t.type.defaultProps && (c = t.type.defaultProps), e) i == "key" ? r = e[i] : i == "ref" ? o = e[i] : l[i] = e[i] === void 0 && c !== void 0 ? c[i] : e[i]; return arguments.length > 2 && (l.children = arguments.length > 3 ? re.call(arguments, 2) : n), K(t.type, l, r || t.key, o || t.ref, null); } function Gt(t, e) { var n = { __c: e = "__cC" + jt++, __: t, Consumer: function(r, o) { return r.children(o); }, Provider: function(r) { var o, i; return this.getChildContext || (o = [], (i = {})[e] = this, this.getChildContext = function() { return i; }, this.shouldComponentUpdate = function(c) { this.props.value !== c.value && o.some(function(l) { l.__e = !0, Te(l); }); }, this.sub = function(c) { o.push(c); var l = c.componentWillUnmount; c.componentWillUnmount = function() { o.splice(o.indexOf(c), 1), l && l.call(c); }; }), r.children; } }; return n.Provider.__ = n.Consumer.contextType = n; } re = Ht.slice, y = { __e: function(t, e, n, r) { for (var o, i, c; e = e.__; ) if ((o = e.__c) && !o.__) try { if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(t)), c = o.__d), o.componentDidCatch != null && (o.componentDidCatch(t, r || {}), c = o.__d), c) return o.__E = o; } catch (l) { t = l; } throw t; } }, Pt = 0, N.prototype.setState = function(t, e) { var n; n = this.__s != null && this.__s !== this.state ? this.__s : this.__s = A({}, this.state), typeof t == "function" && (t = t(A({}, n), this.props)), t && A(n, t), t != null && this.__v && (e && this._sb.push(e), Te(this)); }, N.prototype.forceUpdate = function(t) { this.__v && (this.__e = !0, t && this.__h.push(t), Te(this)); }, N.prototype.render = L, H = [], Dt = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Re = function(t, e) { return t.__v.__b - e.__v.__b; }, de.__r = 0, jt = 0; var U, C, Ce, mt, Q = 0, Yt = [], le = [], gt = y.__b, vt = y.__r, yt = y.diffed, wt = y.__c, bt = y.unmount; function W(t, e) { y.__h && y.__h(C, t, Q || e), Q = 0; var n = C.__H || (C.__H = { __: [], __h: [] }); return t >= n.__.length && n.__.push({ __V: le }), n.__[t]; } function me(t) { return Q = 1, je(rn, t); } function je(t, e, n) { var r = W(U++, 2); if (r.t = t, !r.__c && (r.__ = [n ? n(e) : rn(void 0, e), function(l) { var d = r.__N ? r.__N[0] : r.__[0], _ = r.t(d, l); d !== _ && (r.__N = [_, r.__[1]], r.__c.setState({})); }], r.__c = C, !C.u)) { var o = function(l, d, _) { if (!r.__c.__H) return !0; var m = r.__c.__H.__.filter(function(b) { return b.__c; }); if (m.every(function(b) { return !b.__N; })) return !i || i.call(this, l, d, _); var s = !1; return m.forEach(function(b) { if (b.__N) { var v = b.__[0]; b.__ = b.__N, b.__N = void 0, v !== b.__[0] && (s = !0); } }), !(!s && r.__c.props === l) && (!i || i.call(this, l, d, _)); }; C.u = !0; var i = C.shouldComponentUpdate, c = C.componentWillUpdate; C.componentWillUpdate = function(l, d, _) { if (this.__e) { var m = i; i = void 0, o(l, d, _), i = m; } c && c.call(this, l, d, _); }, C.shouldComponentUpdate = o; } return r.__N || r.__; } function He(t, e) { var n = W(U++, 3); !y.__s && We(n.__H, e) && (n.__ = t, n.i = e, C.__H.__h.push(n)); } function oe(t, e) { var n = W(U++, 4); !y.__s && We(n.__H, e) && (n.__ = t, n.i = e, C.__h.push(n)); } function Kt(t) { return Q = 5, ge(function() { return { current: t }; }, []); } function Zt(t, e, n) { Q = 6, oe(function() { return typeof t == "function" ? (t(e()), function() { return t(null); }) : t ? (t.current = e(), function() { return t.current = null; }) : void 0; }, n == null ? n : n.concat(t)); } function ge(t, e) { var n = W(U++, 7); return We(n.__H, e) ? (n.__V = t(), n.i = e, n.__h = t, n.__V) : n.__; } function Xt(t, e) { return Q = 8, ge(function() { return t; }, e); } function en(t) { var e = C.context[t.__c], n = W(U++, 9); return n.c = t, e ? (n.__ == null && (n.__ = !0, e.sub(C)), e.props.value) : t.__; } function tn(t, e) { y.useDebugValue && y.useDebugValue(e ? e(t) : t); } function uo(t) { var e = W(U++, 10), n = me(); return e.__ = t, C.componentDidCatch || (C.componentDidCatch = function(r, o) { e.__ && e.__(r, o), n[1](r); }), [n[0], function() { n[1](void 0); }]; } function nn() { var t = W(U++, 11); if (!t.__) { for (var e = C.__v; e !== null && !e.__m && e.__ !== null; ) e = e.__; var n = e.__m || (e.__m = [0, 0]); t.__ = "P" + n[0] + "-" + n[1]++; } return t.__; } function _o() { for (var t; t = Yt.shift(); ) if (t.__P && t.__H) try { t.__H.__h.forEach(ue), t.__H.__h.forEach(Ne), t.__H.__h = []; } catch (e) { t.__H.__h = [], y.__e(e, t.__v); } } y.__b = function(t) { C = null, gt && gt(t); }, y.__r = function(t) { vt && vt(t), U = 0; var e = (C = t.__c).__H; e && (Ce === C ? (e.__h = [], C.__h = [], e.__.forEach(function(n) { n.__N && (n.__ = n.__N), n.__V = le, n.__N = n.i = void 0; })) : (e.__h.forEach(ue), e.__h.forEach(Ne), e.__h = [], U = 0)), Ce = C; }, y.diffed = function(t) { yt && yt(t); var e = t.__c; e && e.__H && (e.__H.__h.length && (Yt.push(e) !== 1 && mt === y.requestAnimationFrame || ((mt = y.requestAnimationFrame) || fo)(_o)), e.__H.__.forEach(function(n) { n.i && (n.__H = n.i), n.__V !== le && (n.__ = n.__V), n.i = void 0, n.__V = le; })), Ce = C = null; }, y.__c = function(t, e) { e.some(function(n) { try { n.__h.forEach(ue), n.__h = n.__h.filter(function(r) { return !r.__ || Ne(r); }); } catch (r) { e.some(function(o) { o.__h && (o.__h = []); }), e = [], y.__e(r, n.__v); } }), wt && wt(t, e); }, y.unmount = function(t) { bt && bt(t); var e, n = t.__c; n && n.__H && (n.__H.__.forEach(function(r) { try { ue(r); } catch (o) { e = o; } }), n.__H = void 0, e && y.__e(e, n.__v)); }; var Et = typeof requestAnimationFrame == "function"; function fo(t) { var e, n = function() { clearTimeout(r), Et && cancelAnimationFrame(e), setTimeout(t); }, r = setTimeout(n, 100); Et && (e = requestAnimationFrame(n)); } function ue(t) { var e = C, n = t.__c; typeof n == "function" && (t.__c = void 0, n()), C = e; } function Ne(t) { var e = C; t.__c = t.__(), C = e; } function We(t, e) { return !t || t.length !== e.length || e.some(function(n, r) { return n !== t[r]; }); } function rn(t, e) { return typeof e == "function" ? e(t) : e; } const Se = "Session currently connected", j = "Session currently disconnected", ho = "Session Rejected", po = "Missing JSON RPC response", mo = 'JSON-RPC success response must include "result" field', go = 'JSON-RPC error response must include "error" field', vo = 'JSON RPC request must have valid "method" value', yo = 'JSON RPC request must have valid "id" value', wo = "Missing one of the required parameters: bridge / uri / session", kt = "JSON RPC response format is invalid", bo = "URI format is invalid", Eo = "QRCode Modal not provided", Ct = "User close QRCode Modal", ko = [ "session_request", "session_update", "exchange_key", "connect", "disconnect", "display_uri", "modal_closed", "transport_open", "transport_close", "transport_error" ], Co = [ "wallet_addEthereumChain", "wallet_switchEthereumChain", "wallet_getPermissions", "wallet_requestPermissions", "wallet_registerOnboarding", "wallet_watchAsset", "wallet_scanQRCode" ], Fe = [ "eth_sendTransaction", "eth_signTransaction", "eth_sign", "eth_signTypedData", "eth_signTypedData_v1", "eth_signTypedData_v2", "eth_signTypedData_v3", "eth_signTypedData_v4", "personal_sign", ...Co ], Me = "WALLETCONNECT_DEEPLINK_CHOICE", So = { 1: "mainnet", 3: "ropsten", 4: "rinkeby", 5: "goerli", 42: "kovan" }; var on = Be; Be.strict = sn; Be.loose = an; var xo = Object.prototype.toString, Io = { "[object Int8Array]": !0, "[object Int16Array]": !0, "[object Int32Array]": !0, "[object Uint8Array]": !0, "[object Uint8ClampedArray]": !0, "[object Uint16Array]": !0, "[object Uint32Array]": !0, "[object Float32Array]": !0, "[object Float64Array]": !0 }; function Be(t) { return sn(t) || an(t); } function sn(t) { return t instanceof Int8Array || t instanceof Int16Array || t instanceof Int32Array || t instanceof Uint8Array || t instanceof Uint8ClampedArray || t instanceof Uint16Array || t instanceof Uint32Array || t instanceof Float32Array || t instanceof Float64Array; } function an(t) { return Io[xo.call(t)]; } const Ro = /* @__PURE__ */ $e(on); var To = on.strict, Oo = function(e) { if (To(e)) { var n = Buffer.from(e.buffer); return e.byteLength !== e.buffer.byteLength && (n = n.slice(e.byteOffset, e.byteOffset + e.byteLength)), n; } else return Buffer.from(e); }; const No = /* @__PURE__ */ $e(Oo), ze = "hex", Qe = "utf8", Mo = "binary", Lo = "buffer", Ao = "array", qo = "typed-array", Uo = "array-buffer", ve = "0"; function V(t) { return new Uint8Array(t); } function Ve(t, e = !1) { const n = t.toString(ze); return e ? ie(n) : n; } function Je(t) { return t.toString(Qe); } function cn(t) { return t.readUIntBE(0, t.length); } function G(t) { return No(t); } function $(t, e = !1) { return Ve(G(t), e); } function ln(t) { return Je(G(t)); } function un(t) { return cn(G(t)); } function Ge(t) { return Buffer.from(J(t), ze); } function P(t) { return V(Ge(t)); } function $o(t) { return Je(Ge(t)); } function Po(t) { return un(P(t)); } function Ye(t) { return Buffer.from(t, Qe); } function _n(t) { return V(Ye(t)); } function Do(t, e = !1) { return Ve(Ye(t), e); } function jo(t) { const e = parseInt(t, 10); return oi(ri(e), "Number can only safely store up to 53 bits"), e; } function Ho(t) { return zo(Ke(t)); } function Wo(t) { return Ze(Ke(t)); } function Fo(t, e) { return Qo(Ke(t), e); } function Bo(t) { return `${t}`; } function Ke(t) { const e = (t >>> 0).toString(2); return et(e); } function zo(t) { return G(Ze(t)); } function Ze(t) { return new Uint8Array(Zo(t).map((e) => parseInt(e, 2))); } function Qo(t, e) { return $(Ze(t), e); } function Vo(t) { return !(typeof t != "string" || !new RegExp(/^[01]+$/).test(t) || t.length % 8 !== 0); } function dn(t, e) { return !(typeof t != "string" || !t.match(/^0x[0-9A-Fa-f]*$/) || e && t.length !== 2 + 2 * e); } function ye(t) { return Buffer.isBuffer(t); } function Xe(t) { return Ro.strict(t) && !ye(t); } function fn(t) { return !Xe(t) && !ye(t) && typeof t.byteLength < "u"; } function Jo(t) { return ye(t) ? Lo : Xe(t) ? qo : fn(t) ? Uo : Array.isArray(t) ? Ao : typeof t; } function Go(t) { return Vo(t) ? Mo : dn(t) ? ze : Qe; } function Yo(...t) { return Buffer.concat(t); } function hn(...t) { let e = []; return t.forEach((n) => e = e.concat(Array.from(n))), new Uint8Array([...e]); } function Ko(t, e = 8) { const n = t % e; return n ? (t - n) / e * e + e : t; } function Zo(t, e = 8) { const n = et(t).match(new RegExp(`.{${e}}`, "gi")); return Array.from(n || []); } function et(t, e = 8, n = ve) { return Xo(t, Ko(t.length, e), n); } function Xo(t, e, n = ve) { return ii(t, e, !0, n); } function J(t) { return t.replace(/^0x/, ""); } function ie(t) { return t.startsWith("0x") ? t : `0x${t}`; } function ei(t) { return t = J(t), t = et(t, 2), t && (t = ie(t)), t; } function ti(t) { const e = t.startsWith("0x"); return t = J(t), t = t.startsWith(ve) ? t.substring(1) : t, e ? ie(t) : t; } function ni(t) { return typeof t > "u"; } function ri(t) { return !ni(t); } function oi(t, e) { if (!t) throw new Error(e); } function ii(t, e, n, r = ve) { const o = e - t.length; let i = t; if (o > 0) { const c = r.repeat(o); i = n ? c + t : t + c; } return i; } function fe(t) { return G(new Uint8Array(t)); } function si(t) { return ln(new Uint8Array(t)); } function pn(t, e) { return $(new Uint8Array(t), !e); } function ai(t) { return un(new Uint8Array(t)); } function ci(...t) { return P(t.map((e) => $(new Uint8Array(e))).join("")).buffer; } function mn(t) { return V(t).buffer; } function li(t) { return Je(t); } function ui(t, e) { return Ve(t, !e); } function _i(t) { return cn(t); } function di(...t) { return Yo(...t); } function fi(t) { return _n(t).buffer; } function hi(t) { return Ye(t); } function pi(t, e) { return Do(t, !e); } function mi(t) { return jo(t); } function gi(t) { return Ge(t); } function gn(t) { return P(t).buffer; } function vi(t) { return $o(t); } function yi(t) { return Po(t); } function wi(t) { return Ho(t); } function bi(t) { return Wo(t).buffer; } function Ei(t) { return Bo(t); } function vn(t, e) { return Fo(Number(t), !e); } const ki = Wr, Ci = Fr, Si = Br, xi = zr, Ii = Qr, yn = Hr, Ri = Vr, wn = Dr, Ti = Jr, Oi = Gr, Ni = Yr, we = jr; function be(t) { return Kr(t); } function Ee() { const t = be(); return t && t.os ? t.os : void 0; } function bn() { const t = Ee(); return t ? t.toLowerCase().includes("android") : !1; } function En() { const t = Ee(); return t ? t.toLowerCase().includes("ios") || t.toLowerCase().includes("mac") && navigator.maxTouchPoints > 1 : !1; } function kn() { return Ee() ? bn() || En() : !1; } function Cn() { const t = be(); return t && t.name ? t.name.toLowerCase() === "node" : !1; } function Sn() { return !Cn() && !!yn(); } const xn = Ar, In = qr; function tt(t, e) { const n = In(e), r = we(); r && r.setItem(t, n); } function nt(t) { let e = null, n = null; const r = we(); return r && (n = r.getItem(t)), e = n && xn(n), e; } function rt(t) { const e = we(); e && e.removeItem(t); } function Le() { return Zr(); } function Mi(t) { return ei(t); } function Li(t) { return ie(t); } function Ai(t) { return J(t); } function qi(t) { return ti(ie(t)); } const Rn = Ur; function _e() { return ((e, n) => { for (n = e = ""; e++ < 36; n += e * 51 & 52 ? (e ^ 15 ? 8 ^ Math.random() * (e ^ 20 ? 16 : 4) : 4).toString(16) : "-") ; return n; })(); } function Ui() { console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!"); } function Tn(t, e) { let n; const r = So[t]; return r && (n = `https://${r}.infura.io/v3/${e}`), n; } function On(t, e) { let n; const r = Tn(t, e.infuraId); return e.custom && e.custom[t] ? n = e.custom[t] : r && (n = r), n; } function $i(t, e) { const n = encodeURIComponent(t); return e.universalLink ? `${e.universalLink}/wc?uri=${n}` : e.deepLink ? `${e.deepLink}${e.deepLink.endsWith(":") ? "//" : "/"}wc?uri=${n}` : ""; } function Pi(t) { const e = t.href.split("?")[0]; tt(Me, Object.assign(Object.assign({}, t), { href: e })); } function Nn(t, e) { return t.filter((n) => n.name.toLowerCase().includes(e.toLowerCase()))[0]; } function Di(t, e) { let n = t; return e && (n = e.map((r) => Nn(t, r)).filter(Boolean)), n; } function ji(t, e) { return async (...r) => new Promise((o, i) => { const c = (l, d) => { (l === null || typeof l > "u") && i(l), o(d); }; t.apply(e, [...r, c]); }); } function Mn(t) { const e = t.message || "Failed or Rejected Request"; let n = -32e3; if (t && !t.code) switch (e) { case "Parse error": n = -32700; break; case "Invalid request": n = -32600; break; case "Method not found": n = -32601; break; case "Invalid params": n = -32602; break; case "Internal error": n = -32603; break; default: n = -32e3; break; } const r = { code: n, message: e }; return t.data && (r.data = t.data), r; } const Ln = "https://registry.walletconnect.com"; function Hi() { return Ln + "/api/v2/wallets"; } function Wi() { return Ln + "/api/v2/dapps"; } function An(t, e = "mobile") { var n; return { name: t.name || "", shortName: t.metadata.shortName || "", color: t.metadata.colors.primary || "", logo: (n = t.image_url.sm) !== null && n !== void 0 ? n : "", universalLink: t[e].universal || "", deepLink: t[e].native || "" }; } function Fi(t, e = "mobile") { return Object.values(t).filter((n) => !!n[e].universal || !!n[e].native).map((n) => An(n, e)); } var ot = {}; (function(t) { const e = to, n = no, r = Xr, o = eo, i = (a) => a == null; function c(a) { switch (a.arrayFormat) { case "index": return (u) => (h, f) => { const g = h.length; return f === void 0 || a.skipNull && f === null || a.skipEmptyString && f === "" ? h : f === null ? [...h, [_(u, a), "[", g, "]"].join("")] : [ ...h, [_(u, a), "[", _(g, a), "]=", _(f, a)].join("") ]; }; case "bracket": return (u) => (h, f) => f === void 0 || a.skipNull && f === null || a.skipEmptyString && f === "" ? h : f === null ? [...h, [_(u, a), "[]"].join("")] : [...h, [_(u, a), "[]=", _(f, a)].join("")]; case "comma": case "separator": return (u) => (h, f) => f == null || f.length === 0 ? h : h.length === 0 ? [[_(u, a), "=", _(f, a)].join("")] : [[h, _(f, a)].join(a.arrayFormatSeparator)]; default: return (u) => (h, f) => f === void 0 || a.skipNull && f === null || a.skipEmptyString && f === "" ? h : f === null ? [...h, _(u, a)] : [...h, [_(u, a), "=", _(f, a)].join("")]; } } function l(a) { let u; switch (a.arrayFormat) { case "index": return (h, f, g) => { if (u = /\[(\d*)\]$/.exec(h), h = h.replace(/\[\d*\]$/, ""), !u) { g[h] = f; return; } g[h] === void 0 && (g[h] = {}), g[h][u[1]] = f; }; case "bracket": return (h, f, g) => { if (u = /(\[\])$/.exec(h), h = h.replace(/\[\]$/, ""), !u) { g[h] = f; return; } if (g[h] === void 0) { g[h] = [f]; return; } g[h] = [].concat(g[h], f); }; case "comma": case "separator": return (h, f, g) => { const E = typeof f == "string" && f.includes(a.arrayFormatSeparator), w = typeof f == "string" && !E && m(f, a).includes(a.arrayFormatSeparator); f = w ? m(f, a) : f; const R = E || w ? f.split(a.arrayFormatSeparator).map((x) => m(x, a)) : f === null ? f : m(f, a); g[h] = R; }; default: return (h, f, g) => { if (g[h] === void 0) { g[h] = f; return; } g[h] = [].concat(g[h], f); }; } } function d(a) { if (typeof a != "string" || a.length !== 1) throw new TypeError("arrayFormatSeparator must be single character string"); } function _(a, u) { return u.encode ? u.strict ? e(a) : encodeURIComponent(a) : a; } function m(a, u) { return u.decode ? n(a) : a; } function s(a) { return Array.isArray(a) ? a.sort() : typeof a == "object" ? s(Object.keys(a)).sort((u, h) => Number(u) - Number(h)).map((u) => a[u]) : a; } function b(a) { const u = a.indexOf("#"); return u !== -1 && (a = a.slice(0, u)), a; } function v(a) { let u = ""; const h = a.indexOf("#"); return h !== -1 && (u = a.slice(h)), u; } function k(a) { a = b(a); const u = a.indexOf("?"); return u === -1 ? "" : a.slice(u + 1); } function I(a, u) { return u.parseNumbers && !Number.isNaN(Number(a)) && typeof a == "string" && a.trim() !== "" ? a = Number(a) : u.parseBooleans && a !== null && (a.toLowerCase() === "true" || a.toLowerCase() === "false") && (a = a.toLowerCase() === "true"), a; } function S(a, u) { u = Object.assign({ decode: !0, sort: !0, arrayFormat: "none", arrayFormatSeparator: ",", parseNumbers: !1, parseBooleans: !1 }, u), d(u.arrayFormatSeparator); const h = l(u), f = /* @__PURE__ */ Object.create(null); if (typeof a != "string" || (a = a.trim().replace(/^[?#&]/, ""), !a)) return f; for (const g of a.split("&")) { if (g === "") continue; let [E, w] = r(u.decode ? g.replace(/\+/g, " ") : g, "="); w = w === void 0 ? null : ["comma", "separator"].includes(u.arrayFormat) ? w : m(w, u), h(m(E, u), w, f); } for (const g of Object.keys(f)) { const E = f[g]; if (typeof E == "object" && E !== null) for (const w of Object.keys(E)) E[w] = I(E[w], u); else f[g] = I(E, u); } return u.sort === !1 ? f : (u.sort === !0 ? Object.keys(f).sort() : Object.keys(f).sort(u.sort)).reduce((g, E) => { const w = f[E]; return w && typeof w == "object" && !Array.isArray(w) ? g[E] = s(w) : g[E] = w, g; }, /* @__PURE__ */ Object.create(null)); } t.extract = k, t.parse = S, t.stringify = (a, u) => { if (!a) return ""; u = Object.assign({ encode: !0, strict: !0, arrayFormat: "none", arrayFormatSeparator: "," }, u), d(u.arrayFormatSeparator); const h = (w) => u.skipNull && i(a[w]) || u.skipEmptyString && a[w] === "", f = c(u), g = {}; for (const w of Object.keys(a)) h(w) || (g[w] = a[w]); const E = Object.keys(g); return u.sort !== !1 && E.sort(u.sort), E.map((w) => { const R = a[w]; return R === void 0 ? "" : R === null ? _(w, u) : Array.isArray(R) ? R.reduce(f(w), []).join("&") : _(w, u) + "=" + _(R, u); }).filter((w) => w.length > 0).join("&"); }, t.parseUrl = (a, u) => { u = Object.assign({ decode: !0 }, u); const [h, f] = r(a, "#"); return Object.assign( { url: h.split("?")[0] || "", query: S(k(a), u) }, u && u.parseFragmentIdentifier && f ? { fragmentIdentifier: m(f, u) } : {} ); }, t.stringifyUrl = (a, u) => { u = Object.assign({ encode: !0, strict: !0 }, u); const h = b(a.url).split("?")[0] || "", f = t.extract(a.url), g = t.parse(f, { sort: !1 }), E = Object.assign(g, a.query); let w = t.stringify(E, u); w && (w = `?${w}`); let R = v(a.url); return a.fragmentIdentifier && (R = `#${_(a.fragmentIdentifier, u)}`), `${h}${w}${R}`; }, t.pick = (a, u, h) => { h = Object.assign({ parseFragmentIdentifier: !0 }, h); const { url: f, query: g, fragmentIdentifier: E } = t.parseUrl(a, h); return t.stringifyUrl({ url: f, query: o(g, u), fragmentIdentifier: E }, h); }, t.exclude = (a, u, h) => { const f = Array.isArray(u) ? (g) => !u.includes(g) : (g, E) => !u(g, E); return t.pick(a, f, h); }; })(ot); function qn(t) { const e = t.indexOf("?") !== -1 ? t.indexOf("?") : void 0; return typeof e < "u" ? t.substr(e) : ""; } function Un(t, e) { let n = it(t); return n = Object.assign(Object.assign({}, n), e), t = $n(n), t; } function it(t) { return ot.parse(t); } function $n(t) { return ot.stringify(t); } function Pn(t) { return typeof t.bridge < "u"; } function Dn(t) { const e = t.indexOf(":"), n = t.indexOf("?") !== -1 ? t.indexOf("?") : void 0, r = t.substring(0, e), o = t.substring(e + 1, n); function i(s) { const b = "@", v = s.split(b); return { handshakeTopic: v[0], version: parseInt(v[1], 10) }; } const c = i(o), l = typeof n < "u" ? t.substr(n) : ""; function d(s) { const b = it(s); return { key: b.key || "", bridge: b.bridge || "" }; } const _ = d(l); return Object.assign(Object.assign({ protocol: r }, c), _); } function Bi(t) { return t === "" || typeof t == "string" && t.trim() === ""; } function zi(t) { return !(t && t.length); } function Qi(t) { return ye(t); } function Vi(t) { return Xe(t); } function Ji(t) { return fn(t); } function Gi(t) { return Jo(t); } function Yi(t) { return Go(t); } function Ki(t, e) { return dn(t, e); } function Zi(t) { return typeof t.params == "object"; } function jn(t) { return typeof t.method < "u"; } function F(t) { return typeof t.result < "u"; } function te(t) { return typeof t.error < "u"; } function Ae(t) { return typeof t.event < "u"; } function Hn(t) { return ko.includes(t) || t.startsWith("wc_"); } function Wn(t) { return t.method.startsWith("wc_") ? !0 : !Fe.includes(t.method); } const Xi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, addHexPrefix: Li, appendToQueryString: Un, concatArrayBuffers: ci, concatBuffers: di, convertArrayBufferToBuffer: fe, convertArrayBufferToHex: pn, convertArrayBufferToNumber: ai, convertArrayBufferToUtf8: si, convertBufferToArrayBuffer: mn, convertBufferToHex: ui, convertBufferToNumber: _i, convertBufferToUtf8: li, convertHexToArrayBuffer: gn, convertHexToBuffer: gi, convertHexToNumber: yi, convertHexToUtf8: vi, convertNumberToArrayBuffer: bi, convertNumberToBuffer: wi, convertNumberToHex: vn, convertNumberToUtf8: Ei, convertUtf8ToArrayBuffer: fi, convertUtf8ToBuffer: hi, convertUtf8ToHex: pi, convertUtf8ToNumber: mi, detectEnv: be, detectOS: Ee, formatIOSMobile: $i, formatMobileRegistry: Fi, formatMobileRegistryEntry: An, formatQueryString: $n, formatRpcError: Mn, getClientMeta: Le, getCrypto: Oi, getCryptoOrThrow: Ti, getDappRegistryUrl: Wi, getDocument: xi, getDocumentOrThrow: Si, getEncoding: Yi, getFromWindow: ki, getFromWindowOrThrow: Ci, getInfuraRpcUrl: Tn, getLocal: nt, getLocalStorage: we, getLocalStorageOrThrow: Ni, getLocation: wn, getLocationOrThrow: Ri, getMobileLinkRegistry: Di, getMobileRegistryEntry: Nn, getNavigator: yn, getNavigatorOrThrow: Ii, getQueryString: qn, getRpcUrl: On, getType: Gi, getWalletRegistryUrl: Hi, isAndroid: bn, isArrayBuffer: Ji, isBrowser: Sn, isBuffer: Qi, isEmptyArray: zi, isEmptyString: Bi, isHexString: Ki, isIOS: En, isInternalEvent: Ae, isJsonRpcRequest: jn, isJsonRpcResponseError: te, isJsonRpcResponseSuccess: F, isJsonRpcSubscription: Zi, isMobile: kn, isNode: Cn, isReservedEvent: Hn, isSilentPayload: Wn, isTypedArray: Vi, isWalletConnectSession: Pn, logDeprecationWarning: Ui, parseQueryString: it, parseWalletConnectUri: Dn, payloadId: Rn, promisify: ji, removeHexLeadingZeros: qi, removeHexPrefix: Ai, removeLocal: rt, safeJsonParse: xn, safeJsonStringify: In, sanitizeHex: Mi, saveMobileLinkInfo: Pi, setLocal: tt, uuid: _e }, Symbol.toStringTag, { value: "Module" })); class es { constructor() { this._eventEmitters = [], typeof window < "u" && typeof window.addEventListener < "u" && (window.addEventListener("online", () => this.trigger("online")), window.addEventListener("offline", () => this.trigger("offline"))); } on(e, n) { this._eventEmitters.push({ event: e, callback: n }); } trigger(e) { let n = []; e && (n = this._eventEmitters.filter((r) => r.event === e)), n.forEach((r) => { r.callback(); }); } } const ts = typeof global.WebSocket < "u" ? global.WebSocket : require("ws"); class ns { constructor(e) { if (this.opts = e, this._queue = [], this._events = [], this._subscriptions = [], this._protocol = e.protocol, this._version = e.version, this._url = "", this._netMonitor = null, this._socket = null, this._nextSocket = null, this._subscriptions = e.subscriptions || [], this._netMonitor = e.netMonitor || new es(), !e.url || typeof e.url != "string") throw new Error("Missing or invalid WebSocket url"); this._url = e.url, this._netMonitor.on("online", () => this._socketCreate()); } set readyState(e) { } get readyState() { return this._socket ? this._socket.readyState : -1; } set connecting(e) { } get connecting() { return this.readyState === 0; } set connected(e) { } get connected() { return this.readyState === 1; } set closing(e) { } get closing() { return this.readyState === 2; } set closed(e) { } get closed() { return this.readyState === 3; } open() { this._socketCreate(); } close() { this._socketClose(); } send(e, n, r) { if (!n || typeof n != "string") throw new Error("Missing or invalid topic field"); this._socketSend({ topic: n, type: "pub", payload: e, silent: !!r }); } subscribe(e) { this._socketSend({ topic: e, type: "sub", payload: "", silent: !0 }); } on(e, n) { this._events.push({ event: e, callback: n }); } _socketCreate() { if (this._nextSocket) return; const e = rs(this._url, this._protocol, this._version); if (this._nextSocket = new ts(e), !this._nextSocket) throw new Error("Failed to create socket"); this._nextSocket.onmessage = (n) => this._socketReceive(n), this._nextSocket.onopen = () => this._socketOpen(), this._nextSocket.onerror = (n) => this._socketError(n), this._nextSocket.onclose = () => { setTimeout(() => { this._nextSocket = null, this._socketCreate(); }, 1e3); }; } _socketOpen() { this._socketClose(), this._socket = this._nextSocket, this._nextSocket = null, this._queueSubscriptions(), this._pushQueue(); } _socketClose() { this._socket && (this._socket.onclose = () => { }, this._socket.close()); } _socketSend(e) { const n = JSON.stringify(e); this._socket && this._socket.readyState === 1 ? this._socket.send(n) : (this._setToQueue(e), this._socketCreate()); } async _socketReceive(e) { let n; try { n = JSON.parse(e.data); } catch { return; } if (this._socketSend({ topic: n.topic, type: "ack", payload: "", silent: !0 }), this._socket && this._socket.readyState === 1) { const r = this._events.filter((o) => o.event === "message"); r && r.length && r.forEach((o) => o.callback(n)); } } _socketError(e) { const n = this._events.filter((r) => r.event === "error"); n && n.length && n.forEach((r) => r.callback(e)); } _queueSubscriptions() { this._subscriptions.forEach((n) => this._queue.push({ topic: n, type: "sub", payload: "", silent: !0 })), this._subscriptions = this.opts.subscriptions || []; } _setToQueue(e) { this._queue.push(e); } _pushQueue() { this._queue.forEach((n) => this._socketSend(n)), this._queue = []; } } function rs(t, e, n) { var r, o; const c = (t.startsWith("https") ? t.replace("https", "wss") : t.startsWith("http") ? t.replace("http", "ws") : t).split("?"), l = Sn() ? { protocol: e, version: n, env: "browser", host: ((r = wn()) === null || r === void 0 ? void 0 : r.host) || "" } : { protocol: e, version: n, env: ((o = be()) === null || o === void 0 ? void 0 : o.name) || "" }, d = Un(qn(c[1] || ""), l); return c[0] + "?" + d; } class os { constructor() { this._eventEmitters = []; } subscribe(e) { this._eventEmitters.push(e); } unsubscribe(e) { this._eventEmitters = this._eventEmitters.filter((n) => n.event !== e); } trigger(e) { let n = [], r; jn(e) ? r = e.method : F(e) || te(e) ? r = `response:${e.id}` : Ae(e) ? r = e.event : r = "", r && (n = this._eventEmitters.filter((o) => o.event === r)), (!n || !n.length) && !Hn(r) && !Ae(r) && (n = this._eventEmitters.filter((o) => o.event === "call_request")), n.forEach((o) => { if (te(e)) { const i = new Error(e.error.message); o.callback(i, null); } else o.callback(null, e); }); } } class is { constructor(e = "walletconnect") { this.storageId = e; } getSession() { let e = null; const n = nt(this.storageId); return n && Pn(n) && (e = n), e; } setSession(e) { return tt(this.storageId, e), e; } removeSession() { rt(this.storageId); } } const ss = "walletconnect.org", as = "abcdefghijklmnopqrstuvwxyz0123456789", Fn = as.split("").map((t) => `https://${t}.bridge.walletconnect.org`); function cs(t) { let e = t.indexOf("//") > -1 ? t.split("/")[2] : t.split("/")[0]; return e = e.split(":")[0], e = e.split("?")[0], e; } function ls(t) { return cs(t).split(".").slice(-2).join("."); } function us() { return Math.floor(Math.random() * Fn.length); } function _s() { return Fn[us()]; } function ds(t) { return ls(t) === ss; } function fs(t) { return ds(t) ? _s() : t; } class hs { constructor(e) { if (this.protocol = "wc", this.version = 1, this._bridge = "", this._key = null, this._clientId = "", this._clientMeta = null, this._peerId = "", this._peerMeta = null, this._handshakeId = 0, this._handshakeTopic = "", this._connected = !1, this._accounts = [], this._chainId = 0, this._networkId = 0, this._rpcUrl = "", this._eventManager = new os(), this._clientMeta = Le() || e.connectorOpts.clientMeta || null, this._cryptoLib = e.cryptoLib, this._sessionStorage = e.sessionStorage || new is(e.connectorOpts.storageId), this._qrcodeModal = e.connectorOpts.qrcodeModal, this._qrcodeModalOptions = e.connectorOpts.qrcodeModalOptions, this._signingMethods = [...Fe, ...e.connectorOpts.signingMethods || []], !e.connectorOpts.bridge && !e.connectorOpts.uri && !e.connectorOpts.session) throw new Error(wo); e.connectorOpts.bridge && (this.bridge = fs(e.connectorOpts.bridge)), e.connectorOpts.uri && (this.uri = e.connectorOpts.uri); const n = e.connectorOpts.session || this._getStorageSession(); n && (this.session = n), this.handshakeId && this._subscribeToSessionResponse(this.handshakeId, "Session request rejected"), this._transport = e.transport || new ns({ protocol: this.protocol, version: this.version, url: this.bridge, subscriptions: [this.clientId] }), this._subscribeToInternalEvents(), this._initTransport(), e.connectorOpts.uri && this._subscribeToSessionRequest(), e.pushServerOpts && this._registerPushServer(e.pushServerOpts); } set bridge(e) { e && (this._bridge = e); } get bridge() { return this._bridge; } set key(e) { if (!e) return; const n = gn(e); this._key = n; } get key() { return this._key ? pn(this._key, !0) : ""; } set clientId(e) { e && (this._clientId = e); } get clientId() { let e = this._clientId; return e || (e = this._clientId = _e()), this._clientId; } set peerId(e) { e && (this._peerId = e); } get peerId() { return this._peerId; } set clientMeta(e) { } get clientMeta() { let e = this._clientMeta; return e || (e = this._clientMeta = Le()), e; } set peerMeta(e) { this._peerMeta = e; } get peerMeta() { return this._peerMeta; } set handshakeTopic(e) { e && (this._handshakeTopic = e); } get handshakeTopic() { return this._handshakeTopic; } set handshakeId(e) { e && (this._handshakeId = e); } get handshakeId() { return this._handshakeId; } get uri() { return this._formatUri(); } set uri(e) { if (!e) return; const { handshakeTopic: n, bridge: r, key: o } = this._parseUri(e); this.handshakeTopic = n, this.bridge = r, this.key = o; } set chainId(e) { this._chainId = e; } get chainId() { return this._chainId; } set networkId(e) { this._networkId = e; } get networkId() { return this._networkId; } set accounts(e) { this._accounts = e; } get accounts() { return this._accounts; } set rpcUrl(e) { this._rpcUrl = e; } get rpcUrl() { return this._rpcUrl; } set connected(e) { } get connected() { return this._connected; } set pending(e) { } get pending() { return !!this._handshakeTopic; } get session() { return { connected: this.connected, accounts: this.accounts, chainId: this.chainId, bridge: this.bridge, key: this.key, clientId: this.clientId, clientMeta: this.clientMeta, peerId: this.peerId, peerMeta: this.peerMeta, handshakeId: this.handshakeId, handshakeTopic: this.handshakeTopic }; } set session(e) { e && (this._connected = e.connected, this.accounts = e.accounts, this.chainId = e.chainId, this.bridge = e.bridge, this.key = e.key, this.clientId = e.clientId, this.clientMet