@walletconnect/utils
Version:
Utilities for WalletConnect Protocol
15 lines (13 loc) • 314 kB
JavaScript
(function(A,Rt){typeof exports=="object"&&typeof module<"u"?Rt(exports):typeof define=="function"&&define.amd?define(["exports"],Rt):(A=typeof globalThis<"u"?globalThis:A||self,Rt(A["@walletconnect/utils"]={}))})(this,function(A){"use strict";const Rt=":";function Mi(e){const[t,n]=e.split(Rt);return{namespace:t,reference:n}}function Ec(e){const{namespace:t,reference:n}=e;return[t,n].join(Rt)}function ji(e){const[t,n,r]=e.split(Rt);return{namespace:t,reference:n,address:r}}function xc(e){const{namespace:t,reference:n,address:r}=e;return[t,n,r].join(Rt)}function zi(e,t){const n=[];return e.forEach(r=>{const i=t(r);n.includes(i)||n.push(i)}),n}function vc(e){const{address:t}=ji(e);return t}function Bc(e){const{namespace:t,reference:n}=ji(e);return Ec({namespace:t,reference:n})}function y0(e,t){const{namespace:n,reference:r}=Mi(t);return xc({namespace:n,reference:r,address:e})}function m0(e){return zi(e,vc)}function Sc(e){return zi(e,Bc)}function E0(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const i=e[r];n.push(...i.accounts)}),n}function x0(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const i=e[r];n.push(...Sc(i.accounts))}),n}function v0(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const i=e[r];n.push(...Rr(r,i))}),n}function Rr(e,t){return e.includes(":")?[e]:t.chains||[]}var Ac=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},B0=function(){function e(t,n,r){this.name=t,this.version=n,this.os=r,this.type="browser"}return e}(),S0=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),A0=function(){function e(t,n,r,i){this.name=t,this.version=n,this.os=r,this.bot=i,this.type="bot-device"}return e}(),D0=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),_0=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),I0=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,O0=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Dc=3,U0=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",I0]],_c=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function N0(e){return e?Ic(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new _0:typeof navigator<"u"?Ic(navigator.userAgent):R0()}function T0(e){return e!==""&&U0.reduce(function(t,n){var r=n[0],i=n[1];if(t)return t;var o=i.exec(e);return!!o&&[r,o]},!1)}function Ic(e){var t=T0(e);if(!t)return null;var n=t[0],r=t[1];if(n==="searchbot")return new D0;var i=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);i?i.length<Dc&&(i=Ac(Ac([],i,!0),$0(Dc-i.length),!0)):i=[];var o=i.join("."),s=C0(e),c=O0.exec(e);return c&&c[1]?new A0(n,o,s,c[1]):new B0(n,o,s)}function C0(e){for(var t=0,n=_c.length;t<n;t++){var r=_c[t],i=r[0],o=r[1],s=o.exec(e);if(s)return i}return null}function R0(){var e=typeof process<"u"&&process.version;return e?new S0(process.version.slice(1)):null}function $0(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}function P0(e){var t=e.default;if(typeof t=="function"){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var fn={};/*! *****************************************************************************
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 Hi=function(e,t){return Hi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)r.hasOwnProperty(i)&&(n[i]=r[i])},Hi(e,t)};function F0(e,t){Hi(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var qi=function(){return qi=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},qi.apply(this,arguments)};function L0(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function k0(e,t,n,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(s=e[c])&&(o=(i<3?s(o):i>3?s(t,n,o):s(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}function M0(e,t){return function(n,r){t(n,r,e)}}function j0(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function z0(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function c(u){try{f(r.next(u))}catch(d){s(d)}}function a(u){try{f(r.throw(u))}catch(d){s(d)}}function f(u){u.done?o(u.value):i(u.value).then(c,a)}f((r=r.apply(e,t||[])).next())})}function H0(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(f){return function(u){return a([f,u])}}function a(f){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=f[0]&2?i.return:f[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,f[1])).done)return o;switch(i=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){n.label=f[1];break}if(f[0]===6&&n.label<o[1]){n.label=o[1],o=f;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(f);break}o[2]&&n.ops.pop(),n.trys.pop();continue}f=t.call(e,n)}catch(u){f=[6,u],i=0}finally{r=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function q0(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function V0(e,t){for(var n in e)n!=="default"&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function Vi(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Oc(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function K0(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Oc(arguments[t]));return e}function G0(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],s=0,c=o.length;s<c;s++,i++)r[i]=o[s];return r}function Wn(e){return this instanceof Wn?(this.v=e,this):new Wn(e)}function Z0(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(h){r[h]&&(i[h]=function(l){return new Promise(function(g,w){o.push([h,l,g,w])>1||c(h,l)})})}function c(h,l){try{a(r[h](l))}catch(g){d(o[0][3],g)}}function a(h){h.value instanceof Wn?Promise.resolve(h.value.v).then(f,u):d(o[0][2],h)}function f(h){c("next",h)}function u(h){c("throw",h)}function d(h,l){h(l),o.shift(),o.length&&c(o[0][0],o[0][1])}}function W0(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:Wn(e[i](s)),done:i==="return"}:o?o(s):s}:o}}function Y0(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Vi=="function"?Vi(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(c,a){s=e[o](s),i(c,a,s.done,s.value)})}}function i(o,s,c,a){Promise.resolve(a).then(function(f){o({value:f,done:c})},s)}}function X0(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function J0(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Q0(e){return e&&e.__esModule?e:{default:e}}function eh(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function th(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}var nh=Object.freeze({__proto__:null,__extends:F0,get __assign(){return qi},__rest:L0,__decorate:k0,__param:M0,__metadata:j0,__awaiter:z0,__generator:H0,__createBinding:q0,__exportStar:V0,__values:Vi,__read:Oc,__spread:K0,__spreadArrays:G0,__await:Wn,__asyncGenerator:Z0,__asyncDelegator:W0,__asyncValues:Y0,__makeTemplateObject:X0,__importStar:J0,__importDefault:Q0,__classPrivateFieldGet:eh,__classPrivateFieldSet:th}),$r=P0(nh),Ki={},Yn={},Uc;function rh(){if(Uc)return Yn;Uc=1,Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.delay=void 0;function e(t){return new Promise(n=>{setTimeout(()=>{n(!0)},t)})}return Yn.delay=e,Yn}var un={},Gi={},ln={},Nc;function ih(){return Nc||(Nc=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.ONE_THOUSAND=ln.ONE_HUNDRED=void 0,ln.ONE_HUNDRED=100,ln.ONE_THOUSAND=1e3),ln}var Zi={},Tc;function oh(){return Tc||(Tc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ONE_YEAR=e.FOUR_WEEKS=e.THREE_WEEKS=e.TWO_WEEKS=e.ONE_WEEK=e.THIRTY_DAYS=e.SEVEN_DAYS=e.FIVE_DAYS=e.THREE_DAYS=e.ONE_DAY=e.TWENTY_FOUR_HOURS=e.TWELVE_HOURS=e.SIX_HOURS=e.THREE_HOURS=e.ONE_HOUR=e.SIXTY_MINUTES=e.THIRTY_MINUTES=e.TEN_MINUTES=e.FIVE_MINUTES=e.ONE_MINUTE=e.SIXTY_SECONDS=e.THIRTY_SECONDS=e.TEN_SECONDS=e.FIVE_SECONDS=e.ONE_SECOND=void 0,e.ONE_SECOND=1,e.FIVE_SECONDS=5,e.TEN_SECONDS=10,e.THIRTY_SECONDS=30,e.SIXTY_SECONDS=60,e.ONE_MINUTE=e.SIXTY_SECONDS,e.FIVE_MINUTES=e.ONE_MINUTE*5,e.TEN_MINUTES=e.ONE_MINUTE*10,e.THIRTY_MINUTES=e.ONE_MINUTE*30,e.SIXTY_MINUTES=e.ONE_MINUTE*60,e.ONE_HOUR=e.SIXTY_MINUTES,e.THREE_HOURS=e.ONE_HOUR*3,e.SIX_HOURS=e.ONE_HOUR*6,e.TWELVE_HOURS=e.ONE_HOUR*12,e.TWENTY_FOUR_HOURS=e.ONE_HOUR*24,e.ONE_DAY=e.TWENTY_FOUR_HOURS,e.THREE_DAYS=e.ONE_DAY*3,e.FIVE_DAYS=e.ONE_DAY*5,e.SEVEN_DAYS=e.ONE_DAY*7,e.THIRTY_DAYS=e.ONE_DAY*30,e.ONE_WEEK=e.SEVEN_DAYS,e.TWO_WEEKS=e.ONE_WEEK*2,e.THREE_WEEKS=e.ONE_WEEK*3,e.FOUR_WEEKS=e.ONE_WEEK*4,e.ONE_YEAR=e.ONE_DAY*365}(Zi)),Zi}var Cc;function Rc(){return Cc||(Cc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=$r;t.__exportStar(ih(),e),t.__exportStar(oh(),e)}(Gi)),Gi}var $c;function sh(){if($c)return un;$c=1,Object.defineProperty(un,"__esModule",{value:!0}),un.fromMiliseconds=un.toMiliseconds=void 0;const e=Rc();function t(r){return r*e.ONE_THOUSAND}un.toMiliseconds=t;function n(r){return Math.floor(r/e.ONE_THOUSAND)}return un.fromMiliseconds=n,un}var Pc;function ch(){return Pc||(Pc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=$r;t.__exportStar(rh(),e),t.__exportStar(sh(),e)}(Ki)),Ki}var In={},Fc;function ah(){if(Fc)return In;Fc=1,Object.defineProperty(In,"__esModule",{value:!0}),In.Watch=void 0;class e{constructor(){this.timestamps=new Map}start(n){if(this.timestamps.has(n))throw new Error(`Watch already started for label: ${n}`);this.timestamps.set(n,{started:Date.now()})}stop(n){const r=this.get(n);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${n}`);const i=Date.now()-r.started;this.timestamps.set(n,{started:r.started,elapsed:i})}get(n){const r=this.timestamps.get(n);if(typeof r>"u")throw new Error(`No timestamp found for label: ${n}`);return r}elapsed(n){const r=this.get(n);return r.elapsed||Date.now()-r.started}}return In.Watch=e,In.default=e,In}var Wi={},Xn={},Lc;function fh(){if(Lc)return Xn;Lc=1,Object.defineProperty(Xn,"__esModule",{value:!0}),Xn.IWatch=void 0;class e{}return Xn.IWatch=e,Xn}var kc;function uh(){return kc||(kc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),$r.__exportStar(fh(),e)}(Wi)),Wi}(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=$r;t.__exportStar(ch(),e),t.__exportStar(ah(),e),t.__exportStar(uh(),e),t.__exportStar(Rc(),e)})(fn);var ce={};Object.defineProperty(ce,"__esModule",{value:!0}),ce.getLocalStorage=ce.getLocalStorageOrThrow=ce.getCrypto=ce.getCryptoOrThrow=Xi=ce.getLocation=ce.getLocationOrThrow=Yi=ce.getNavigator=ce.getNavigatorOrThrow=Un=ce.getDocument=ce.getDocumentOrThrow=ce.getFromWindowOrThrow=ce.getFromWindow=void 0;function dn(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}ce.getFromWindow=dn;function On(e){const t=dn(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}ce.getFromWindowOrThrow=On;function lh(){return On("document")}ce.getDocumentOrThrow=lh;function dh(){return dn("document")}var Un=ce.getDocument=dh;function hh(){return On("navigator")}ce.getNavigatorOrThrow=hh;function bh(){return dn("navigator")}var Yi=ce.getNavigator=bh;function gh(){return On("location")}ce.getLocationOrThrow=gh;function ph(){return dn("location")}var Xi=ce.getLocation=ph;function wh(){return On("crypto")}ce.getCryptoOrThrow=wh;function yh(){return dn("crypto")}ce.getCrypto=yh;function mh(){return On("localStorage")}ce.getLocalStorageOrThrow=mh;function Eh(){return dn("localStorage")}ce.getLocalStorage=Eh;var Ji={};Object.defineProperty(Ji,"__esModule",{value:!0});var Mc=Ji.getWindowMetadata=void 0;const jc=ce;function xh(){let e,t;try{e=jc.getDocumentOrThrow(),t=jc.getLocationOrThrow()}catch{return null}function n(){const d=e.getElementsByTagName("link"),h=[];for(let l=0;l<d.length;l++){const g=d[l],w=g.getAttribute("rel");if(w&&w.toLowerCase().indexOf("icon")>-1){const x=g.getAttribute("href");if(x)if(x.toLowerCase().indexOf("https:")===-1&&x.toLowerCase().indexOf("http:")===-1&&x.indexOf("//")!==0){let I=t.protocol+"//"+t.host;if(x.indexOf("/")===0)I+=x;else{const $=t.pathname.split("/");$.pop();const B=$.join("/");I+=B+"/"+x}h.push(I)}else if(x.indexOf("//")===0){const I=t.protocol+x;h.push(I)}else h.push(x)}}return h}function r(...d){const h=e.getElementsByTagName("meta");for(let l=0;l<h.length;l++){const g=h[l],w=["itemprop","property","name"].map(x=>g.getAttribute(x)).filter(x=>x?d.includes(x):!1);if(w.length&&w){const x=g.getAttribute("content");if(x)return x}}return""}function i(){let d=r("name","og:site_name","og:title","twitter:title");return d||(d=e.title),d}function o(){return r("description","og:description","twitter:description","keywords")}const s=i(),c=o(),a=t.origin,f=n();return{description:c,url:a,icons:f,name:s}}Mc=Ji.getWindowMetadata=xh;var vh=Object.defineProperty,Bh=Object.defineProperties,Sh=Object.getOwnPropertyDescriptors,zc=Object.getOwnPropertySymbols,Ah=Object.prototype.hasOwnProperty,Dh=Object.prototype.propertyIsEnumerable,Qi=(e,t,n)=>t in e?vh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hc=(e,t)=>{for(var n in t||(t={}))Ah.call(t,n)&&Qi(e,n,t[n]);if(zc)for(var n of zc(t))Dh.call(t,n)&&Qi(e,n,t[n]);return e},_h=(e,t)=>Bh(e,Sh(t)),qc=(e,t,n)=>Qi(e,typeof t!="symbol"?t+"":t,n);const Vc="ReactNative",Ue={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Pr=" ",Ih=":",Kc="/",eo=2,Oh=1e3,Gc="js";function to(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function $t(){return!Un()&&!!Yi()&&navigator.product===Vc}function Uh(){return $t()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function Nh(){return $t()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function Nn(){return!to()&&!!Yi()&&!!Un()}function hn(){return $t()?Ue.reactNative:to()?Ue.node:Nn()?Ue.browser:Ue.unknown}function Th(){var e;try{return $t()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(e=global.Application)==null?void 0:e.applicationId:void 0}catch{return}}function Zc(e,t){const n=new URLSearchParams(e);return Object.entries(t).sort(([r],[i])=>r.localeCompare(i)).forEach(([r,i])=>{i!=null&&n.set(r,String(i))}),n.toString()}function Ch(e){var t,n;const r=Wc();try{return e!=null&&e.url&&r.url&&new URL(e.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${e.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),e.url=r.url),(t=e?.icons)!=null&&t.length&&e.icons.length>0&&(e.icons=e.icons.filter(i=>i!=="")),_h(Hc(Hc({},r),e),{url:e?.url||r.url,name:e?.name||r.name,description:e?.description||r.description,icons:(n=e?.icons)!=null&&n.length&&e.icons.length>0?e.icons:r.icons})}catch(i){return console.warn("Error populating app metadata",i),e||r}}function Wc(){return Mc()||{name:"",description:"",url:"",icons:[""]}}function Rh(e,t){var n;const r=hn(),i={protocol:e,version:t,env:r};return r==="browser"&&(i.host=((n=Xi())==null?void 0:n.host)||"unknown"),i}function Yc(){if(hn()===Ue.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:n,Version:r}=global.Platform;return[n,r].join("-")}const e=N0();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function Xc(){var e;const t=hn();return t===Ue.browser?[t,((e=Xi())==null?void 0:e.host)||"unknown"].join(":"):t}function Jc(e,t,n){const r=Yc(),i=Xc();return[[e,t].join("-"),[Gc,n].join("-"),r,i].join("/")}function $h({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:i,projectId:o,useOnCloseEvent:s,bundleId:c,packageName:a}){const f=n.split("?"),u=Jc(e,t,r),d={auth:i,ua:u,projectId:o,useOnCloseEvent:s||void 0,packageName:a||void 0,bundleId:c||void 0},h=Zc(f[1]||"",d);return f[0]+"?"+h}function Ph(e){let t=(e.match(/^[^:]+(?=:\/\/)/gi)||[])[0];const n=typeof t<"u"?e.split("://")[1]:e;return t=t==="wss"?"https":"http",[t,n].join("://")}function Fh(e,t,n){if(!e[t]||typeof e[t]!==n)throw new Error(`Missing or invalid "${t}" param`)}function Qc(e,t=eo){return ea(e.split(Kc),t)}function Lh(e){return Qc(e).join(Pr)}function Pt(e,t){return e.filter(n=>t.includes(n)).length===e.length}function ea(e,t=eo){return e.slice(Math.max(e.length-t,0))}function kh(e){return Object.fromEntries(e.entries())}function Mh(e){return new Map(Object.entries(e))}function jh(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}const zh=e=>e;function ta(e){return e.trim().replace(/^\w/,t=>t.toUpperCase())}function Hh(e){return e.split(Pr).map(t=>ta(t)).join(Pr)}function qh(e=fn.FIVE_MINUTES,t){const n=fn.toMiliseconds(e||fn.FIVE_MINUTES);let r,i,o,s;return{resolve:c=>{o&&r&&(clearTimeout(o),r(c),s=Promise.resolve(c))},reject:c=>{o&&i&&(clearTimeout(o),i(c))},done:()=>new Promise((c,a)=>{if(s)return c(s);o=setTimeout(()=>{const f=new Error(t);s=Promise.reject(f),a(f)},n),r=c,i=a})}}function Vh(e,t,n){return new Promise(async(r,i)=>{const o=setTimeout(()=>i(new Error(n)),t);try{const s=await e;r(s)}catch(s){i(s)}clearTimeout(o)})}function no(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Kh(e){return no("topic",e)}function Gh(e){return no("id",e)}function Zh(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function Wh(e,t){return fn.fromMiliseconds((t||Date.now())+fn.toMiliseconds(e))}function Yh(e){return Date.now()>=fn.toMiliseconds(e)}function Xh(e,t){return`${e}${t?`:${t}`:""}`}function Ze(e=[],t=[]){return[...new Set([...e,...t])]}async function Jh({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;const i=typeof n=="string"?JSON.parse(n):n,o=i?.href;if(typeof o!="string")return;const s=na(o,e,t),c=hn();if(c===Ue.browser){if(!((r=Un())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}ra(s)}else c===Ue.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(i){console.error(i)}}function na(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let i=`${e}`;if(e.startsWith("https://t.me")){const o=e.includes("?")?"&startapp=":"?startapp=";i=`${i}${o}${sa(r,!0)}`}else i=`${i}/wc?${r}`;return i}function ra(e){let t="_self";oa()?t="_top":(ia()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function Qh(e,t){let n="";try{if(Nn()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function ro(e,t){return e.filter(n=>t.includes(n))}function e1(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function t1(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function n1(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function ia(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function oa(){try{return window.self!==window.top}catch{return!1}}function sa(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function io(e){return Buffer.from(e,"base64").toString("utf-8")}function r1(e){return new Promise(t=>setTimeout(t,e))}class i1{constructor({limit:t}){qc(this,"limit"),qc(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const n=this.set.values().next().value;n&&this.set.delete(n)}this.set.add(t)}}has(t){return this.set.has(t)}}const Fr=BigInt(2**32-1),ca=BigInt(32);function aa(e,t=!1){return t?{h:Number(e&Fr),l:Number(e>>ca&Fr)}:{h:Number(e>>ca&Fr)|0,l:Number(e&Fr)|0}}function fa(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;o<n;o++){const{h:s,l:c}=aa(e[o],t);[r[o],i[o]]=[s,c]}return[r,i]}const ua=(e,t,n)=>e>>>n,la=(e,t,n)=>e<<32-n|t>>>n,Ft=(e,t,n)=>e>>>n|t<<32-n,Lt=(e,t,n)=>e<<32-n|t>>>n,Jn=(e,t,n)=>e<<64-n|t>>>n-32,Qn=(e,t,n)=>e>>>n-32|t<<64-n,o1=(e,t)=>t,s1=(e,t)=>e,c1=(e,t,n)=>e<<n|t>>>32-n,a1=(e,t,n)=>t<<n|e>>>32-n,f1=(e,t,n)=>t<<n-32|e>>>64-n,u1=(e,t,n)=>e<<n-32|t>>>64-n;function et(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}const oo=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),so=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,l1=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),d1=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,h1=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),b1=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,Tn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Lr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function st(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function tt(e,...t){if(!Lr(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function kr(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");st(e.outputLen),st(e.blockLen)}function kt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function co(e,t){tt(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function er(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function We(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ao(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ct(e,t){return e<<32-t|e>>>t}const da=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ha(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const ht=da?e=>e:e=>ha(e);function g1(e){for(let t=0;t<e.length;t++)e[t]=ha(e[t]);return e}const Mt=da?e=>e:g1,ba=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",p1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Cn(e){if(tt(e),ba)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=p1[e[n]];return t}const bt={_0:48,_9:57,A:65,F:70,a:97,f:102};function ga(e){if(e>=bt._0&&e<=bt._9)return e-bt._0;if(e>=bt.A&&e<=bt.F)return e-(bt.A-10);if(e>=bt.a&&e<=bt.f)return e-(bt.a-10)}function Mr(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(ba)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const s=ga(e.charCodeAt(o)),c=ga(e.charCodeAt(o+1));if(s===void 0||c===void 0){const a=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+o)}r[i]=s*16+c}return r}function fo(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function nt(e){return typeof e=="string"&&(e=fo(e)),tt(e),e}function gt(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];tt(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const o=e[r];n.set(o,i),i+=o.length}return n}class jr{}function tr(e){const t=r=>e().update(nt(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function w1(e){const t=(r,i)=>e(i).update(nt(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function pt(e=32){if(Tn&&typeof Tn.getRandomValues=="function")return Tn.getRandomValues(new Uint8Array(e));if(Tn&&typeof Tn.randomBytes=="function")return Uint8Array.from(Tn.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const y1=BigInt(0),nr=BigInt(1),m1=BigInt(2),E1=BigInt(7),x1=BigInt(256),v1=BigInt(113),pa=[],wa=[],ya=[];for(let e=0,t=nr,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],pa.push(2*(5*r+n)),wa.push((e+1)*(e+2)/2%64);let i=y1;for(let o=0;o<7;o++)t=(t<<nr^(t>>E1)*v1)%x1,t&m1&&(i^=nr<<(nr<<BigInt(o))-nr);ya.push(i)}const ma=fa(ya,!0),B1=ma[0],S1=ma[1],Ea=(e,t,n)=>n>32?f1(e,t,n):c1(e,t,n),xa=(e,t,n)=>n>32?u1(e,t,n):a1(e,t,n);function A1(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){const c=(s+8)%10,a=(s+2)%10,f=n[a],u=n[a+1],d=Ea(f,u,1)^n[c],h=xa(f,u,1)^n[c+1];for(let l=0;l<50;l+=10)e[s+l]^=d,e[s+l+1]^=h}let i=e[2],o=e[3];for(let s=0;s<24;s++){const c=wa[s],a=Ea(i,o,c),f=xa(i,o,c),u=pa[s];i=e[u],o=e[u+1],e[u]=a,e[u+1]=f}for(let s=0;s<50;s+=10){for(let c=0;c<10;c++)n[c]=e[s+c];for(let c=0;c<10;c++)e[s+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=B1[r],e[1]^=S1[r]}We(n)}class uo extends jr{constructor(t,n,r,i=!1,o=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=o,st(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=er(this.state)}clone(){return this._cloneInto()}keccak(){Mt(this.state32),A1(this.state32,this.rounds),Mt(this.state32),this.posOut=0,this.pos=0}update(t){kt(this),t=nt(t),tt(t);const{blockLen:n,state:r}=this,i=t.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);for(let c=0;c<s;c++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:i}=this;t[r]^=n,(n&128)!==0&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){kt(this,!1),tt(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,o=t.length;i<o;){this.posOut>=r&&this.keccak();const s=Math.min(r-this.posOut,o-i);t.set(n.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return st(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(co(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,We(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:o,enableXOF:s}=this;return t||(t=new uo(n,r,i,s,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=i,t.enableXOF=s,t.destroyed=this.destroyed,t}}const D1=(e,t,n)=>tr(()=>new uo(t,e,n)),va=D1(1,136,256/8),_1="0.1.1";function I1(){return _1}class se extends Error{constructor(t,n={}){const r=(()=>{if(n.cause instanceof se){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:n.cause?.message?n.cause.message:n.details})(),i=n.cause instanceof se&&n.cause.docsPath||n.docsPath,s=`https://oxlib.sh${i??""}`,c=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||i?["",r?`Details: ${r}`:void 0,i?`See: ${s}`:void 0]:[]].filter(a=>typeof a=="string").join(`
`);super(c,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${I1()}`}),this.cause=n.cause,this.details=r,this.docs=s,this.docsPath=i,this.shortMessage=t}walk(t){return Ba(this,t)}}function Ba(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Ba(e.cause,t):t?null:e}function O1(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),c=Number(n&o),a=r?4:0,f=r?0:4;e.setUint32(t+a,s,r),e.setUint32(t+f,c,r)}function U1(e,t,n){return e&t^~e&n}function N1(e,t,n){return e&t^e&n^t&n}class Sa extends jr{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=ao(this.buffer)}update(t){kt(this),t=nt(t),tt(t);const{view:n,buffer:r,blockLen:i}=this,o=t.length;for(let s=0;s<o;){const c=Math.min(i-this.pos,o-s);if(c===i){const a=ao(t);for(;i<=o-s;s+=i)this.process(a,s);continue}r.set(t.subarray(s,s+c),this.pos),this.pos+=c,s+=c,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){kt(this),co(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:o}=this;let{pos:s}=this;n[s++]=128,We(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(r,0),s=0);for(let d=s;d<i;d++)n[d]=0;O1(r,i-8,BigInt(this.length*8),o),this.process(r,0);const c=ao(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const f=a/4,u=this.get();if(f>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<f;d++)c.setUint32(4*d,u[d],o)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:o,destroyed:s,pos:c}=this;return t.destroyed=s,t.finished=o,t.length=i,t.pos=c,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const wt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Be=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Se=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),T1=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),jt=new Uint32Array(64);class C1 extends Sa{constructor(t=32){super(64,t,8,!1),this.A=wt[0]|0,this.B=wt[1]|0,this.C=wt[2]|0,this.D=wt[3]|0,this.E=wt[4]|0,this.F=wt[5]|0,this.G=wt[6]|0,this.H=wt[7]|0}get(){const{A:t,B:n,C:r,D:i,E:o,F:s,G:c,H:a}=this;return[t,n,r,i,o,s,c,a]}set(t,n,r,i,o,s,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=c|0,this.H=a|0}process(t,n){for(let d=0;d<16;d++,n+=4)jt[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const h=jt[d-15],l=jt[d-2],g=ct(h,7)^ct(h,18)^h>>>3,w=ct(l,17)^ct(l,19)^l>>>10;jt[d]=w+jt[d-7]+g+jt[d-16]|0}let{A:r,B:i,C:o,D:s,E:c,F:a,G:f,H:u}=this;for(let d=0;d<64;d++){const h=ct(c,6)^ct(c,11)^ct(c,25),l=u+h+U1(c,a,f)+T1[d]+jt[d]|0,w=(ct(r,2)^ct(r,13)^ct(r,22))+N1(r,i,o)|0;u=f,f=a,a=c,c=s+l|0,s=o,o=i,i=r,r=l+w|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,c=c+this.E|0,a=a+this.F|0,f=f+this.G|0,u=u+this.H|0,this.set(r,i,o,s,c,a,f,u)}roundClean(){We(jt)}destroy(){this.set(0,0,0,0,0,0,0,0),We(this.buffer)}}const Aa=fa(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),R1=Aa[0],$1=Aa[1],zt=new Uint32Array(80),Ht=new Uint32Array(80);class lo extends Sa{constructor(t=64){super(128,t,16,!1),this.Ah=Se[0]|0,this.Al=Se[1]|0,this.Bh=Se[2]|0,this.Bl=Se[3]|0,this.Ch=Se[4]|0,this.Cl=Se[5]|0,this.Dh=Se[6]|0,this.Dl=Se[7]|0,this.Eh=Se[8]|0,this.El=Se[9]|0,this.Fh=Se[10]|0,this.Fl=Se[11]|0,this.Gh=Se[12]|0,this.Gl=Se[13]|0,this.Hh=Se[14]|0,this.Hl=Se[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:i,Ch:o,Cl:s,Dh:c,Dl:a,Eh:f,El:u,Fh:d,Fl:h,Gh:l,Gl:g,Hh:w,Hl:x}=this;return[t,n,r,i,o,s,c,a,f,u,d,h,l,g,w,x]}set(t,n,r,i,o,s,c,a,f,u,d,h,l,g,w,x){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=c|0,this.Dl=a|0,this.Eh=f|0,this.El=u|0,this.Fh=d|0,this.Fl=h|0,this.Gh=l|0,this.Gl=g|0,this.Hh=w|0,this.Hl=x|0}process(t,n){for(let B=0;B<16;B++,n+=4)zt[B]=t.getUint32(n),Ht[B]=t.getUint32(n+=4);for(let B=16;B<80;B++){const E=zt[B-15]|0,U=Ht[B-15]|0,T=Ft(E,U,1)^Ft(E,U,8)^ua(E,U,7),F=Lt(E,U,1)^Lt(E,U,8)^la(E,U,7),L=zt[B-2]|0,R=Ht[B-2]|0,q=Ft(L,R,19)^Jn(L,R,61)^ua(L,R,6),z=Lt(L,R,19)^Qn(L,R,61)^la(L,R,6),m=l1(F,z,Ht[B-7],Ht[B-16]),b=d1(m,T,q,zt[B-7],zt[B-16]);zt[B]=b|0,Ht[B]=m|0}let{Ah:r,Al:i,Bh:o,Bl:s,Ch:c,Cl:a,Dh:f,Dl:u,Eh:d,El:h,Fh:l,Fl:g,Gh:w,Gl:x,Hh:I,Hl:$}=this;for(let B=0;B<80;B++){const E=Ft(d,h,14)^Ft(d,h,18)^Jn(d,h,41),U=Lt(d,h,14)^Lt(d,h,18)^Qn(d,h,41),T=d&l^~d&w,F=h&g^~h&x,L=h1($,U,F,$1[B],Ht[B]),R=b1(L,I,E,T,R1[B],zt[B]),q=L|0,z=Ft(r,i,28)^Jn(r,i,34)^Jn(r,i,39),m=Lt(r,i,28)^Qn(r,i,34)^Qn(r,i,39),b=r&o^r&c^o&c,v=i&s^i&a^s&a;I=w|0,$=x|0,w=l|0,x=g|0,l=d|0,g=h|0,{h:d,l:h}=et(f|0,u|0,R|0,q|0),f=c|0,u=a|0,c=o|0,a=s|0,o=r|0,s=i|0;const p=oo(q,m,v);r=so(p,R,z,b),i=p|0}({h:r,l:i}=et(this.Ah|0,this.Al|0,r|0,i|0)),{h:o,l:s}=et(this.Bh|0,this.Bl|0,o|0,s|0),{h:c,l:a}=et(this.Ch|0,this.Cl|0,c|0,a|0),{h:f,l:u}=et(this.Dh|0,this.Dl|0,f|0,u|0),{h:d,l:h}=et(this.Eh|0,this.El|0,d|0,h|0),{h:l,l:g}=et(this.Fh|0,this.Fl|0,l|0,g|0),{h:w,l:x}=et(this.Gh|0,this.Gl|0,w|0,x|0),{h:I,l:$}=et(this.Hh|0,this.Hl|0,I|0,$|0),this.set(r,i,o,s,c,a,f,u,d,h,l,g,w,x,I,$)}roundClean(){We(zt,Ht)}destroy(){We(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class P1 extends lo{constructor(){super(48),this.Ah=Be[0]|0,this.Al=Be[1]|0,this.Bh=Be[2]|0,this.Bl=Be[3]|0,this.Ch=Be[4]|0,this.Cl=Be[5]|0,this.Dh=Be[6]|0,this.Dl=Be[7]|0,this.Eh=Be[8]|0,this.El=Be[9]|0,this.Fh=Be[10]|0,this.Fl=Be[11]|0,this.Gh=Be[12]|0,this.Gl=Be[13]|0,this.Hh=Be[14]|0,this.Hl=Be[15]|0}}const Ae=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class F1 extends lo{constructor(){super(32),this.Ah=Ae[0]|0,this.Al=Ae[1]|0,this.Bh=Ae[2]|0,this.Bl=Ae[3]|0,this.Ch=Ae[4]|0,this.Cl=Ae[5]|0,this.Dh=Ae[6]|0,this.Dl=Ae[7]|0,this.Eh=Ae[8]|0,this.El=Ae[9]|0,this.Fh=Ae[10]|0,this.Fl=Ae[11]|0,this.Gh=Ae[12]|0,this.Gl=Ae[13]|0,this.Hh=Ae[14]|0,this.Hl=Ae[15]|0}}const at=tr(()=>new C1),Da=tr(()=>new lo),_a=tr(()=>new P1),L1=tr(()=>new F1),zr=at;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ho=BigInt(0),Hr=BigInt(1);function rr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function qt(e){if(!rr(e))throw new Error("Uint8Array expected")}function ir(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function qr(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Ia(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?ho:BigInt("0x"+e)}const Oa=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",k1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bn(e){if(qt(e),Oa)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=k1[e[n]];return t}const yt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ua(e){if(e>=yt._0&&e<=yt._9)return e-yt._0;if(e>=yt.A&&e<=yt.F)return e-(yt.A-10);if(e>=yt.a&&e<=yt.f)return e-(yt.a-10)}function Vr(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Oa)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const s=Ua(e.charCodeAt(o)),c=Ua(e.charCodeAt(o+1));if(s===void 0||c===void 0){const a=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+o)}r[i]=s*16+c}return r}function Ne(e){return Ia(bn(e))}function Na(e){return qt(e),Ia(bn(Uint8Array.from(e).reverse()))}function he(e,t){return Vr(e.toString(16).padStart(t*2,"0"))}function Ta(e,t){return he(e,t).reverse()}function De(e,t,n){let r;if(typeof t=="string")try{r=Vr(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(rr(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}function le(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];qt(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const o=e[r];n.set(o,i),i+=o.length}return n}function bo(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}const go=e=>typeof e=="bigint"&&ho<=e;function po(e,t,n){return go(e)&&go(t)&&go(n)&&t<=e&&e<n}function Rn(e,t,n,r){if(!po(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function or(e){let t;for(t=0;e>ho;e>>=Hr,t+=1);return t}function M1(e,t){return e>>BigInt(t)&Hr}const gn=e=>(Hr<<BigInt(e))-Hr,wo=e=>new Uint8Array(e),Ca=e=>Uint8Array.from(e);function j1(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=wo(e),i=wo(e),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},c=(...d)=>n(i,r,...d),a=(d=wo(0))=>{i=c(Ca([0]),d),r=c(),d.length!==0&&(i=c(Ca([1]),d),r=c())},f=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const h=[];for(;d<t;){r=c();const l=r.slice();h.push(l),d+=r.length}return le(...h)};return(d,h)=>{s(),a(d);let l;for(;!(l=h(f()));)a();return s(),l}}const z1={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||rr(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function sr(e,t,n={}){const r=(i,o,s)=>{const c=z1[o];if(typeof c!="function")throw new Error("invalid validator function");const a=e[i];if(!(s&&a===void 0)&&!c(a,e))throw new Error("param "+String(i)+" is invalid. Expected "+o+", got "+a)};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return e}const Ra=()=>{throw new Error("not implemented")};function yo(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const o=e(n,...r);return t.set(n,o),o}}function H1(e,t){if(Ma(e)>t)throw new lb({givenSize:Ma(e),maxSize:t})}const mt={zero:48,nine:57,A:65,F:70,a:97,f:102};function $a(e){if(e>=mt.zero&&e<=mt.nine)return e-mt.zero;if(e>=mt.A&&e<=mt.F)return e-(mt.A-10);if(e>=mt.a&&e<=mt.f)return e-(mt.a-10)}function q1(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new db({size:e.length,targetSize:r,type:"Bytes"});const i=new Uint8Array(r);for(let o=0;o<r;o++){const s=n==="right";i[s?o:r-o-1]=e[s?o:e.length-o-1]}return i}function mo(e,t){if(xt(e)>t)throw new tb({givenSize:xt(e),maxSize:t})}function V1(e,t){if(typeof t=="number"&&t>0&&t>xt(e)-1)throw new ka({offset:t,position:"start",size:xt(e)})}function K1(e,t,n){if(typeof t=="number"&&typeof n=="number"&&xt(e)!==n-t)throw new ka({offset:n,position:"end",size:xt(e)})}function Pa(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const i=e.replace("0x","");if(i.length>r*2)throw new nb({size:Math.ceil(i.length/2),targetSize:r,type:"Hex"});return`0x${i[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const G1="#__bigint";function Eo(e,t,n){return JSON.stringify(e,(r,i)=>typeof t=="function"?t(r,i):typeof i=="bigint"?i.toString()+G1:i,n)}const Z1=new TextEncoder,W1=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Y1(e,t={}){const{strict:n=!1}=t;if(!e)throw new Fa(e);if(typeof e!="string")throw new Fa(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new La(e);if(!e.startsWith("0x"))throw new La(e)}function xo(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function vo(e){return e instanceof Uint8Array?cr(e):Array.isArray(e)?cr(new Uint8Array(e)):e}function X1(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(mo(n,t.size),Gr(n,t.size)):n}function cr(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=W1[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(mo(r,t.size),Bo(r,t.size)):r}function Kr(e,t={}){const{signed:n,size:r}=t,i=BigInt(e);let o;r?n?o=(1n<<BigInt(r)*8n-1n)-1n:o=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const s=typeof o=="bigint"&&n?-o-1n:0;if(o&&i>o||i<s){const f=typeof e=="bigint"?"n":"";throw new eb({max:o?`${o}${f}`:void 0,min:`${s}${f}`,signed:n,size:r,value:`${e}${f}`})}const a=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?Gr(a,r):a}function J1(e,t={}){return cr(Z1.encode(e),t)}function Gr(e,t){return Pa(e,{dir:"left",size:t})}function Bo(e,t){return Pa(e,{dir:"right",size:t})}function Et(e,t,n,r={}){const{strict:i}=r;V1(e,t);const o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return