@dcl/dao-site 0.1.0-9665947846.commit-7f9b152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/1949206f0b8ec64d-808ab637.svg +9 -0
- package/assets/2bb1eda4abde747b-9a6386f8.svg +14 -0
- package/assets/405a77eb97c6d08b-39806354.png +0 -0
- package/assets/42a115892c45f786-52e9d5a0.png +0 -0
- package/assets/43a07b610a8dc06b-2805bd4f.png +0 -0
- package/assets/4681c4394eec49bce9599519ba179a34-1661de91.svg +9 -0
- package/assets/6fc36cd396ba9f47-457b8bc0.svg +16 -0
- package/assets/7b3beb6bcbc56ed9-1bed553a.png +0 -0
- package/assets/7b593e6c5f18da0e-7aec344f.png +0 -0
- package/assets/7da6c0fe9cc15329-ed9b180b.png +0 -0
- package/assets/805322223c96be40-5d829f5a.png +0 -0
- package/assets/81ac9d1ac3d6324c-15cdd640.svg +17 -0
- package/assets/93c9e021d08ebd29-581a0127.svg +11 -0
- package/assets/97d7aa272cd605ea-9a905beb.png +0 -0
- package/assets/Sentient-Variable-e57342c5.ttf +0 -0
- package/assets/b60869efa9cf4f8c-06465811.svg +18 -0
- package/assets/brand-icons-42e369dc.ttf +0 -0
- package/assets/brand-icons-6519a15b.svg +1008 -0
- package/assets/brand-icons-9fafd6c3.woff +0 -0
- package/assets/brand-icons-d023c55f.eot +0 -0
- package/assets/brand-icons-e7d4d534.woff2 +0 -0
- package/assets/council-23633596.png +0 -0
- package/assets/da0e2040ea4c51ef-19df0e50.svg +1 -0
- package/assets/dax-fe45aa94.webp +0 -0
- package/assets/decentraland-fd65fd50.svg +1 -0
- package/assets/flags-94d5c7f1.png +0 -0
- package/assets/footer-d8fda202.webp +0 -0
- package/assets/fortmatic-101518a1.js +14 -0
- package/assets/fortmatic-101518a1.js.map +1 -0
- package/assets/gc-73b5d709.webp +0 -0
- package/assets/grants-4cf59142.png +0 -0
- package/assets/grants-mobile-ed3af932.png +0 -0
- package/assets/grants_timeline_desktop-11f86fa8.svg +1 -0
- package/assets/grants_timeline_mobile-ee5fa2e5.svg +1 -0
- package/assets/header_recipients-aa54cae2.webp +0 -0
- package/assets/header_resources-f29c07f6.webp +0 -0
- package/assets/hero_desktop-62440ce0.webp +0 -0
- package/assets/hero_mobile-127431da.webp +0 -0
- package/assets/how-3260f470.png +0 -0
- package/assets/icons-282a64fb.svg +1518 -0
- package/assets/icons-434466b5.woff2 +0 -0
- package/assets/icons-8b4e1b84.eot +0 -0
- package/assets/icons-95b6a484.woff +0 -0
- package/assets/icons-cb7f81f5.ttf +0 -0
- package/assets/index-1bbd512b.js +15 -0
- package/assets/index-1bbd512b.js.map +1 -0
- package/assets/index-307c6e2d.js +55 -0
- package/assets/index-307c6e2d.js.map +1 -0
- package/assets/index-48ae71d8.css +691 -0
- package/assets/index-4bd9c4f0.js +6 -0
- package/assets/index-4bd9c4f0.js.map +1 -0
- package/assets/index-7c221453.js +2 -0
- package/assets/index-7c221453.js.map +1 -0
- package/assets/index-c3e34aec.js +4296 -0
- package/assets/index-c3e34aec.js.map +1 -0
- package/assets/index-cca00e0b.js +2 -0
- package/assets/index-cca00e0b.js.map +1 -0
- package/assets/index-fbe84902.js +13 -0
- package/assets/index-fbe84902.js.map +1 -0
- package/assets/index.es-4c3a1f45.js +57 -0
- package/assets/index.es-4c3a1f45.js.map +1 -0
- package/assets/marketplace-7ef0d210.png +0 -0
- package/assets/nf-bb5918bf.webp +0 -0
- package/assets/outline-icons-4537fa06.eot +0 -0
- package/assets/outline-icons-4bc359c2.woff +0 -0
- package/assets/outline-icons-4d288344.woff2 +0 -0
- package/assets/outline-icons-67172172.ttf +0 -0
- package/assets/outline-icons-ae8fd02a.svg +366 -0
- package/assets/services-cd0fa3dc.webp +0 -0
- package/assets/ship-4d8f16f2.png +0 -0
- package/assets/wearables-cec92369.png +0 -0
- package/assets/what_is-3b76744c.png +0 -0
- package/assets/why-f395c935.png +0 -0
- package/favicon.ico +0 -0
- package/index.html +20 -0
- package/manifest.json +6 -0
- package/package.json +22 -0
- package/robots.txt +2 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import{b as ri,g as C1,c as n6,r as s6,a as Ie,B as P1,e as Di,d as Bl,f as Zi,h as Ll,o as hd,_ as o6}from"./index-c3e34aec.js";var ld=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var i=0,s=t.length,a;i<s;i++)(a||!(i in t))&&(a||(a=Array.prototype.slice.call(t,0,i)),a[i]=t[i]);return r.concat(a||Array.prototype.slice.call(t))},a6=function(){function r(t,e,i){this.name=t,this.version=e,this.os=i,this.type="browser"}return r}(),c6=function(){function r(t){this.version=t,this.type="node",this.name="node",this.os=ri.platform}return r}(),u6=function(){function r(t,e,i,s){this.name=t,this.version=e,this.os=i,this.bot=s,this.type="bot-device"}return r}(),h6=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),l6=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),f6=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,d6=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,fd=3,p6=[["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",f6]],dd=[["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 g6(r){return r?pd(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new l6:typeof navigator<"u"?pd(navigator.userAgent):y6()}function m6(r){return r!==""&&p6.reduce(function(t,e){var i=e[0],s=e[1];if(t)return t;var a=s.exec(r);return!!a&&[i,a]},!1)}function pd(r){var t=m6(r);if(!t)return null;var e=t[0],i=t[1];if(e==="searchbot")return new h6;var s=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);s?s.length<fd&&(s=ld(ld([],s,!0),w6(fd-s.length),!0)):s=[];var a=s.join("."),u=v6(r),l=d6.exec(r);return l&&l[1]?new u6(e,a,u,l[1]):new a6(e,a,u)}function v6(r){for(var t=0,e=dd.length;t<e;t++){var i=dd[t],s=i[0],a=i[1],u=a.exec(r);if(u)return s}return null}function y6(){var r=typeof ri<"u"&&ri.version;return r?new c6(ri.version.slice(1)):null}function w6(r){for(var t=[],e=0;e<r;e++)t.push("0");return t}var yt={};/*! *****************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */var ul=function(r,t){return ul=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])},ul(r,t)};function b6(r,t){ul(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var hl=function(){return hl=Object.assign||function(t){for(var e,i=1,s=arguments.length;i<s;i++){e=arguments[i];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},hl.apply(this,arguments)};function _6(r,t){var e={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(r);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(r,i[s])&&(e[i[s]]=r[i[s]]);return e}function E6(r,t,e,i){var s=arguments.length,a=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,t,e,i);else for(var l=r.length-1;l>=0;l--)(u=r[l])&&(a=(s<3?u(a):s>3?u(t,e,a):u(t,e))||a);return s>3&&a&&Object.defineProperty(t,e,a),a}function A6(r,t){return function(e,i){t(e,i,r)}}function S6(r,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,t)}function I6(r,t,e,i){function s(a){return a instanceof e?a:new e(function(u){u(a)})}return new(e||(e=Promise))(function(a,u){function l(w){try{f(i.next(w))}catch(E){u(E)}}function d(w){try{f(i.throw(w))}catch(E){u(E)}}function f(w){w.done?a(w.value):s(w.value).then(l,d)}f((i=i.apply(r,t||[])).next())})}function D6(r,t){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,s,a,u;return u={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function l(f){return function(w){return d([f,w])}}function d(f){if(i)throw new TypeError("Generator is already executing.");for(;e;)try{if(i=1,s&&(a=f[0]&2?s.return:f[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,f[1])).done)return a;switch(s=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return e.label++,{value:f[1],done:!1};case 5:e.label++,s=f[1],f=[0];continue;case 7:f=e.ops.pop(),e.trys.pop();continue;default:if(a=e.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){e=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]<a[3])){e.label=f[1];break}if(f[0]===6&&e.label<a[1]){e.label=a[1],a=f;break}if(a&&e.label<a[2]){e.label=a[2],e.ops.push(f);break}a[2]&&e.ops.pop(),e.trys.pop();continue}f=t.call(r,e)}catch(w){f=[6,w],s=0}finally{i=a=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function x6(r,t,e,i){i===void 0&&(i=e),r[i]=t[e]}function M6(r,t){for(var e in r)e!=="default"&&!t.hasOwnProperty(e)&&(t[e]=r[e])}function ll(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function O1(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),s,a=[],u;try{for(;(t===void 0||t-- >0)&&!(s=i.next()).done;)a.push(s.value)}catch(l){u={error:l}}finally{try{s&&!s.done&&(e=i.return)&&e.call(i)}finally{if(u)throw u.error}}return a}function C6(){for(var r=[],t=0;t<arguments.length;t++)r=r.concat(O1(arguments[t]));return r}function P6(){for(var r=0,t=0,e=arguments.length;t<e;t++)r+=arguments[t].length;for(var i=Array(r),s=0,t=0;t<e;t++)for(var a=arguments[t],u=0,l=a.length;u<l;u++,s++)i[s]=a[u];return i}function ea(r){return this instanceof ea?(this.v=r,this):new ea(r)}function O6(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=e.apply(r,t||[]),s,a=[];return s={},u("next"),u("throw"),u("return"),s[Symbol.asyncIterator]=function(){return this},s;function u(S){i[S]&&(s[S]=function(D){return new Promise(function(P,Y){a.push([S,D,P,Y])>1||l(S,D)})})}function l(S,D){try{d(i[S](D))}catch(P){E(a[0][3],P)}}function d(S){S.value instanceof ea?Promise.resolve(S.value.v).then(f,w):E(a[0][2],S)}function f(S){l("next",S)}function w(S){l("throw",S)}function E(S,D){S(D),a.shift(),a.length&&l(a[0][0],a[0][1])}}function N6(r){var t,e;return t={},i("next"),i("throw",function(s){throw s}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(s,a){t[s]=r[s]?function(u){return(e=!e)?{value:ea(r[s](u)),done:s==="return"}:a?a(u):u}:a}}function R6(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof ll=="function"?ll(r):r[Symbol.iterator](),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(a){e[a]=r[a]&&function(u){return new Promise(function(l,d){u=r[a](u),s(l,d,u.done,u.value)})}}function s(a,u,l,d){Promise.resolve(d).then(function(f){a({value:f,done:l})},u)}}function T6(r,t){return Object.defineProperty?Object.defineProperty(r,"raw",{value:t}):r.raw=t,r}function F6(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)Object.hasOwnProperty.call(r,e)&&(t[e]=r[e]);return t.default=r,t}function U6(r){return r&&r.__esModule?r:{default:r}}function B6(r,t){if(!t.has(r))throw new TypeError("attempted to get private field on non-instance");return t.get(r)}function L6(r,t,e){if(!t.has(r))throw new TypeError("attempted to set private field on non-instance");return t.set(r,e),e}const q6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return hl},__asyncDelegator:N6,__asyncGenerator:O6,__asyncValues:R6,__await:ea,__awaiter:I6,__classPrivateFieldGet:B6,__classPrivateFieldSet:L6,__createBinding:x6,__decorate:E6,__exportStar:M6,__extends:b6,__generator:D6,__importDefault:U6,__importStar:F6,__makeTemplateObject:T6,__metadata:S6,__param:A6,__read:O1,__rest:_6,__spread:C6,__spreadArrays:P6,__values:ll},Symbol.toStringTag,{value:"Module"})),ua=C1(q6);var xh={},jo={},gd;function j6(){if(gd)return jo;gd=1,Object.defineProperty(jo,"__esModule",{value:!0}),jo.delay=void 0;function r(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}return jo.delay=r,jo}var ys={},Mh={},ws={},md;function $6(){return md||(md=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.ONE_THOUSAND=ws.ONE_HUNDRED=void 0,ws.ONE_HUNDRED=100,ws.ONE_THOUSAND=1e3),ws}var Ch={},vd;function z6(){return vd||(vd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Ch)),Ch}var yd;function N1(){return yd||(yd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ua;t.__exportStar($6(),r),t.__exportStar(z6(),r)}(Mh)),Mh}var wd;function k6(){if(wd)return ys;wd=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.fromMiliseconds=ys.toMiliseconds=void 0;const r=N1();function t(i){return i*r.ONE_THOUSAND}ys.toMiliseconds=t;function e(i){return Math.floor(i/r.ONE_THOUSAND)}return ys.fromMiliseconds=e,ys}var bd;function H6(){return bd||(bd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ua;t.__exportStar(j6(),r),t.__exportStar(k6(),r)}(xh)),xh}var Qs={},_d;function K6(){if(_d)return Qs;_d=1,Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const i=this.get(e);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);const s=Date.now()-i.started;this.timestamps.set(e,{started:i.started,elapsed:s})}get(e){const i=this.timestamps.get(e);if(typeof i>"u")throw new Error(`No timestamp found for label: ${e}`);return i}elapsed(e){const i=this.get(e);return i.elapsed||Date.now()-i.started}}return Qs.Watch=r,Qs.default=r,Qs}var Ph={},$o={},Ed;function V6(){if(Ed)return $o;Ed=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.IWatch=void 0;class r{}return $o.IWatch=r,$o}var Ad;function G6(){return Ad||(Ad=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),ua.__exportStar(V6(),r)}(Ph)),Ph}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ua;t.__exportStar(H6(),r),t.__exportStar(K6(),r),t.__exportStar(G6(),r),t.__exportStar(N1(),r)})(yt);var je={};Object.defineProperty(je,"__esModule",{value:!0});je.getLocalStorage=je.getLocalStorageOrThrow=je.getCrypto=je.getCryptoOrThrow=R1=je.getLocation=je.getLocationOrThrow=jl=je.getNavigator=je.getNavigatorOrThrow=ql=je.getDocument=je.getDocumentOrThrow=je.getFromWindowOrThrow=je.getFromWindow=void 0;function xs(r){let t;return typeof window<"u"&&typeof window[r]<"u"&&(t=window[r]),t}je.getFromWindow=xs;function lo(r){const t=xs(r);if(!t)throw new Error(`${r} is not defined in Window`);return t}je.getFromWindowOrThrow=lo;function W6(){return lo("document")}je.getDocumentOrThrow=W6;function Y6(){return xs("document")}var ql=je.getDocument=Y6;function Q6(){return lo("navigator")}je.getNavigatorOrThrow=Q6;function J6(){return xs("navigator")}var jl=je.getNavigator=J6;function X6(){return lo("location")}je.getLocationOrThrow=X6;function Z6(){return xs("location")}var R1=je.getLocation=Z6;function t_(){return lo("crypto")}je.getCryptoOrThrow=t_;function e_(){return xs("crypto")}je.getCrypto=e_;function r_(){return lo("localStorage")}je.getLocalStorageOrThrow=r_;function i_(){return xs("localStorage")}je.getLocalStorage=i_;var $l={};Object.defineProperty($l,"__esModule",{value:!0});var T1=$l.getWindowMetadata=void 0;const Sd=je;function n_(){let r,t;try{r=Sd.getDocumentOrThrow(),t=Sd.getLocationOrThrow()}catch{return null}function e(){const E=r.getElementsByTagName("link"),S=[];for(let D=0;D<E.length;D++){const P=E[D],Y=P.getAttribute("rel");if(Y&&Y.toLowerCase().indexOf("icon")>-1){const G=P.getAttribute("href");if(G)if(G.toLowerCase().indexOf("https:")===-1&&G.toLowerCase().indexOf("http:")===-1&&G.indexOf("//")!==0){let tt=t.protocol+"//"+t.host;if(G.indexOf("/")===0)tt+=G;else{const K=t.pathname.split("/");K.pop();const V=K.join("/");tt+=V+"/"+G}S.push(tt)}else if(G.indexOf("//")===0){const tt=t.protocol+G;S.push(tt)}else S.push(G)}}return S}function i(...E){const S=r.getElementsByTagName("meta");for(let D=0;D<S.length;D++){const P=S[D],Y=["itemprop","property","name"].map(G=>P.getAttribute(G)).filter(G=>G?E.includes(G):!1);if(Y.length&&Y){const G=P.getAttribute("content");if(G)return G}}return""}function s(){let E=i("name","og:site_name","og:title","twitter:title");return E||(E=r.title),E}function a(){return i("description","og:description","twitter:description","keywords")}const u=s(),l=a(),d=t.origin,f=e();return{description:l,url:d,icons:f,name:u}}T1=$l.getWindowMetadata=n_;var ra={},s_=r=>encodeURIComponent(r).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),F1="%[a-f0-9]{2}",Id=new RegExp("("+F1+")|([^%]+?)","gi"),Dd=new RegExp("("+F1+")+","gi");function fl(r,t){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;t=t||1;var e=r.slice(0,t),i=r.slice(t);return Array.prototype.concat.call([],fl(e),fl(i))}function o_(r){try{return decodeURIComponent(r)}catch{for(var t=r.match(Id)||[],e=1;e<t.length;e++)r=fl(t,e).join(""),t=r.match(Id)||[];return r}}function a_(r){for(var t={"%FE%FF":"��","%FF%FE":"��"},e=Dd.exec(r);e;){try{t[e[0]]=decodeURIComponent(e[0])}catch{var i=o_(e[0]);i!==e[0]&&(t[e[0]]=i)}e=Dd.exec(r)}t["%C2"]="�";for(var s=Object.keys(t),a=0;a<s.length;a++){var u=s[a];r=r.replace(new RegExp(u,"g"),t[u])}return r}var c_=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return a_(r)}},u_=(r,t)=>{if(!(typeof r=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[r];const e=r.indexOf(t);return e===-1?[r]:[r.slice(0,e),r.slice(e+t.length)]},h_=function(r,t){for(var e={},i=Object.keys(r),s=Array.isArray(t),a=0;a<i.length;a++){var u=i[a],l=r[u];(s?t.indexOf(u)!==-1:t(u,l,r))&&(e[u]=l)}return e};(function(r){const t=s_,e=c_,i=u_,s=h_,a=K=>K==null,u=Symbol("encodeFragmentIdentifier");function l(K){switch(K.arrayFormat){case"index":return V=>(B,z)=>{const $=B.length;return z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),"[",$,"]"].join("")]:[...B,[w(V,K),"[",w($,K),"]=",w(z,K)].join("")]};case"bracket":return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),"[]"].join("")]:[...B,[w(V,K),"[]=",w(z,K)].join("")];case"colon-list-separator":return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),":list="].join("")]:[...B,[w(V,K),":list=",w(z,K)].join("")];case"comma":case"separator":case"bracket-separator":{const V=K.arrayFormat==="bracket-separator"?"[]=":"=";return B=>(z,$)=>$===void 0||K.skipNull&&$===null||K.skipEmptyString&&$===""?z:($=$===null?"":$,z.length===0?[[w(B,K),V,w($,K)].join("")]:[[z,w($,K)].join(K.arrayFormatSeparator)])}default:return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,w(V,K)]:[...B,[w(V,K),"=",w(z,K)].join("")]}}function d(K){let V;switch(K.arrayFormat){case"index":return(B,z,$)=>{if(V=/\[(\d*)\]$/.exec(B),B=B.replace(/\[\d*\]$/,""),!V){$[B]=z;return}$[B]===void 0&&($[B]={}),$[B][V[1]]=z};case"bracket":return(B,z,$)=>{if(V=/(\[\])$/.exec(B),B=B.replace(/\[\]$/,""),!V){$[B]=z;return}if($[B]===void 0){$[B]=[z];return}$[B]=[].concat($[B],z)};case"colon-list-separator":return(B,z,$)=>{if(V=/(:list)$/.exec(B),B=B.replace(/:list$/,""),!V){$[B]=z;return}if($[B]===void 0){$[B]=[z];return}$[B]=[].concat($[B],z)};case"comma":case"separator":return(B,z,$)=>{const v=typeof z=="string"&&z.includes(K.arrayFormatSeparator),T=typeof z=="string"&&!v&&E(z,K).includes(K.arrayFormatSeparator);z=T?E(z,K):z;const nt=v||T?z.split(K.arrayFormatSeparator).map(ft=>E(ft,K)):z===null?z:E(z,K);$[B]=nt};case"bracket-separator":return(B,z,$)=>{const v=/(\[\])$/.test(B);if(B=B.replace(/\[\]$/,""),!v){$[B]=z&&E(z,K);return}const T=z===null?[]:z.split(K.arrayFormatSeparator).map(nt=>E(nt,K));if($[B]===void 0){$[B]=T;return}$[B]=[].concat($[B],T)};default:return(B,z,$)=>{if($[B]===void 0){$[B]=z;return}$[B]=[].concat($[B],z)}}}function f(K){if(typeof K!="string"||K.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function w(K,V){return V.encode?V.strict?t(K):encodeURIComponent(K):K}function E(K,V){return V.decode?e(K):K}function S(K){return Array.isArray(K)?K.sort():typeof K=="object"?S(Object.keys(K)).sort((V,B)=>Number(V)-Number(B)).map(V=>K[V]):K}function D(K){const V=K.indexOf("#");return V!==-1&&(K=K.slice(0,V)),K}function P(K){let V="";const B=K.indexOf("#");return B!==-1&&(V=K.slice(B)),V}function Y(K){K=D(K);const V=K.indexOf("?");return V===-1?"":K.slice(V+1)}function G(K,V){return V.parseNumbers&&!Number.isNaN(Number(K))&&typeof K=="string"&&K.trim()!==""?K=Number(K):V.parseBooleans&&K!==null&&(K.toLowerCase()==="true"||K.toLowerCase()==="false")&&(K=K.toLowerCase()==="true"),K}function tt(K,V){V=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},V),f(V.arrayFormatSeparator);const B=d(V),z=Object.create(null);if(typeof K!="string"||(K=K.trim().replace(/^[?#&]/,""),!K))return z;for(const $ of K.split("&")){if($==="")continue;let[v,T]=i(V.decode?$.replace(/\+/g," "):$,"=");T=T===void 0?null:["comma","separator","bracket-separator"].includes(V.arrayFormat)?T:E(T,V),B(E(v,V),T,z)}for(const $ of Object.keys(z)){const v=z[$];if(typeof v=="object"&&v!==null)for(const T of Object.keys(v))v[T]=G(v[T],V);else z[$]=G(v,V)}return V.sort===!1?z:(V.sort===!0?Object.keys(z).sort():Object.keys(z).sort(V.sort)).reduce(($,v)=>{const T=z[v];return T&&typeof T=="object"&&!Array.isArray(T)?$[v]=S(T):$[v]=T,$},Object.create(null))}r.extract=Y,r.parse=tt,r.stringify=(K,V)=>{if(!K)return"";V=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},V),f(V.arrayFormatSeparator);const B=T=>V.skipNull&&a(K[T])||V.skipEmptyString&&K[T]==="",z=l(V),$={};for(const T of Object.keys(K))B(T)||($[T]=K[T]);const v=Object.keys($);return V.sort!==!1&&v.sort(V.sort),v.map(T=>{const nt=K[T];return nt===void 0?"":nt===null?w(T,V):Array.isArray(nt)?nt.length===0&&V.arrayFormat==="bracket-separator"?w(T,V)+"[]":nt.reduce(z(T),[]).join("&"):w(T,V)+"="+w(nt,V)}).filter(T=>T.length>0).join("&")},r.parseUrl=(K,V)=>{V=Object.assign({decode:!0},V);const[B,z]=i(K,"#");return Object.assign({url:B.split("?")[0]||"",query:tt(Y(K),V)},V&&V.parseFragmentIdentifier&&z?{fragmentIdentifier:E(z,V)}:{})},r.stringifyUrl=(K,V)=>{V=Object.assign({encode:!0,strict:!0,[u]:!0},V);const B=D(K.url).split("?")[0]||"",z=r.extract(K.url),$=r.parse(z,{sort:!1}),v=Object.assign($,K.query);let T=r.stringify(v,V);T&&(T=`?${T}`);let nt=P(K.url);return K.fragmentIdentifier&&(nt=`#${V[u]?w(K.fragmentIdentifier,V):K.fragmentIdentifier}`),`${B}${T}${nt}`},r.pick=(K,V,B)=>{B=Object.assign({parseFragmentIdentifier:!0,[u]:!1},B);const{url:z,query:$,fragmentIdentifier:v}=r.parseUrl(K,B);return r.stringifyUrl({url:z,query:s($,V),fragmentIdentifier:v},B)},r.exclude=(K,V,B)=>{const z=Array.isArray(V)?$=>!V.includes($):($,v)=>!V($,v);return r.pick(K,z,B)}})(ra);var zl={},nu={},oe={},U1={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function t(l,d){var f=l>>>16&65535,w=l&65535,E=d>>>16&65535,S=d&65535;return w*S+(f*S+w*E<<16>>>0)|0}r.mul=Math.imul||t;function e(l,d){return l+d|0}r.add=e;function i(l,d){return l-d|0}r.sub=i;function s(l,d){return l<<d|l>>>32-d}r.rotl=s;function a(l,d){return l<<32-d|l>>>d}r.rotr=a;function u(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}r.isInteger=Number.isInteger||u,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(l){return r.isInteger(l)&&l>=-r.MAX_SAFE_INTEGER&&l<=r.MAX_SAFE_INTEGER}})(U1);Object.defineProperty(oe,"__esModule",{value:!0});var B1=U1;function l_(r,t){return t===void 0&&(t=0),(r[t+0]<<8|r[t+1])<<16>>16}oe.readInt16BE=l_;function f_(r,t){return t===void 0&&(t=0),(r[t+0]<<8|r[t+1])>>>0}oe.readUint16BE=f_;function d_(r,t){return t===void 0&&(t=0),(r[t+1]<<8|r[t])<<16>>16}oe.readInt16LE=d_;function p_(r,t){return t===void 0&&(t=0),(r[t+1]<<8|r[t])>>>0}oe.readUint16LE=p_;function L1(r,t,e){return t===void 0&&(t=new Uint8Array(2)),e===void 0&&(e=0),t[e+0]=r>>>8,t[e+1]=r>>>0,t}oe.writeUint16BE=L1;oe.writeInt16BE=L1;function q1(r,t,e){return t===void 0&&(t=new Uint8Array(2)),e===void 0&&(e=0),t[e+0]=r>>>0,t[e+1]=r>>>8,t}oe.writeUint16LE=q1;oe.writeInt16LE=q1;function dl(r,t){return t===void 0&&(t=0),r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3]}oe.readInt32BE=dl;function pl(r,t){return t===void 0&&(t=0),(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}oe.readUint32BE=pl;function gl(r,t){return t===void 0&&(t=0),r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]}oe.readInt32LE=gl;function ml(r,t){return t===void 0&&(t=0),(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t])>>>0}oe.readUint32LE=ml;function Hc(r,t,e){return t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0),t[e+0]=r>>>24,t[e+1]=r>>>16,t[e+2]=r>>>8,t[e+3]=r>>>0,t}oe.writeUint32BE=Hc;oe.writeInt32BE=Hc;function Kc(r,t,e){return t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0),t[e+0]=r>>>0,t[e+1]=r>>>8,t[e+2]=r>>>16,t[e+3]=r>>>24,t}oe.writeUint32LE=Kc;oe.writeInt32LE=Kc;function g_(r,t){t===void 0&&(t=0);var e=dl(r,t),i=dl(r,t+4);return e*4294967296+i-(i>>31)*4294967296}oe.readInt64BE=g_;function m_(r,t){t===void 0&&(t=0);var e=pl(r,t),i=pl(r,t+4);return e*4294967296+i}oe.readUint64BE=m_;function v_(r,t){t===void 0&&(t=0);var e=gl(r,t),i=gl(r,t+4);return i*4294967296+e-(e>>31)*4294967296}oe.readInt64LE=v_;function y_(r,t){t===void 0&&(t=0);var e=ml(r,t),i=ml(r,t+4);return i*4294967296+e}oe.readUint64LE=y_;function j1(r,t,e){return t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0),Hc(r/4294967296>>>0,t,e),Hc(r>>>0,t,e+4),t}oe.writeUint64BE=j1;oe.writeInt64BE=j1;function $1(r,t,e){return t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0),Kc(r>>>0,t,e),Kc(r/4294967296>>>0,t,e+4),t}oe.writeUint64LE=$1;oe.writeInt64LE=$1;function w_(r,t,e){if(e===void 0&&(e=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>t.length-e)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,s=1,a=r/8+e-1;a>=e;a--)i+=t[a]*s,s*=256;return i}oe.readUintBE=w_;function b_(r,t,e){if(e===void 0&&(e=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>t.length-e)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,s=1,a=e;a<e+r/8;a++)i+=t[a]*s,s*=256;return i}oe.readUintLE=b_;function __(r,t,e,i){if(e===void 0&&(e=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!B1.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var s=1,a=r/8+i-1;a>=i;a--)e[a]=t/s&255,s*=256;return e}oe.writeUintBE=__;function E_(r,t,e,i){if(e===void 0&&(e=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!B1.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,a=i;a<i+r/8;a++)e[a]=t/s&255,s*=256;return e}oe.writeUintLE=E_;function A_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat32(t)}oe.readFloat32BE=A_;function S_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat32(t,!0)}oe.readFloat32LE=S_;function I_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat64(t)}oe.readFloat64BE=I_;function D_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat64(t,!0)}oe.readFloat64LE=D_;function x_(r,t,e){t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat32(e,r),t}oe.writeFloat32BE=x_;function M_(r,t,e){t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat32(e,r,!0),t}oe.writeFloat32LE=M_;function C_(r,t,e){t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat64(e,r),t}oe.writeFloat64BE=C_;function P_(r,t,e){t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat64(e,r,!0),t}oe.writeFloat64LE=P_;var si={};Object.defineProperty(si,"__esModule",{value:!0});function O_(r){for(var t=0;t<r.length;t++)r[t]=0;return r}si.wipe=O_;Object.defineProperty(nu,"__esModule",{value:!0});var _r=oe,vl=si,N_=20;function R_(r,t,e){for(var i=1634760805,s=857760878,a=2036477234,u=1797285236,l=e[3]<<24|e[2]<<16|e[1]<<8|e[0],d=e[7]<<24|e[6]<<16|e[5]<<8|e[4],f=e[11]<<24|e[10]<<16|e[9]<<8|e[8],w=e[15]<<24|e[14]<<16|e[13]<<8|e[12],E=e[19]<<24|e[18]<<16|e[17]<<8|e[16],S=e[23]<<24|e[22]<<16|e[21]<<8|e[20],D=e[27]<<24|e[26]<<16|e[25]<<8|e[24],P=e[31]<<24|e[30]<<16|e[29]<<8|e[28],Y=t[3]<<24|t[2]<<16|t[1]<<8|t[0],G=t[7]<<24|t[6]<<16|t[5]<<8|t[4],tt=t[11]<<24|t[10]<<16|t[9]<<8|t[8],K=t[15]<<24|t[14]<<16|t[13]<<8|t[12],V=i,B=s,z=a,$=u,v=l,T=d,nt=f,ft=w,pt=E,mt=S,h=D,y=P,b=Y,M=G,C=tt,R=K,j=0;j<N_;j+=2)V=V+v|0,b^=V,b=b>>>32-16|b<<16,pt=pt+b|0,v^=pt,v=v>>>32-12|v<<12,B=B+T|0,M^=B,M=M>>>32-16|M<<16,mt=mt+M|0,T^=mt,T=T>>>32-12|T<<12,z=z+nt|0,C^=z,C=C>>>32-16|C<<16,h=h+C|0,nt^=h,nt=nt>>>32-12|nt<<12,$=$+ft|0,R^=$,R=R>>>32-16|R<<16,y=y+R|0,ft^=y,ft=ft>>>32-12|ft<<12,z=z+nt|0,C^=z,C=C>>>32-8|C<<8,h=h+C|0,nt^=h,nt=nt>>>32-7|nt<<7,$=$+ft|0,R^=$,R=R>>>32-8|R<<8,y=y+R|0,ft^=y,ft=ft>>>32-7|ft<<7,B=B+T|0,M^=B,M=M>>>32-8|M<<8,mt=mt+M|0,T^=mt,T=T>>>32-7|T<<7,V=V+v|0,b^=V,b=b>>>32-8|b<<8,pt=pt+b|0,v^=pt,v=v>>>32-7|v<<7,V=V+T|0,R^=V,R=R>>>32-16|R<<16,h=h+R|0,T^=h,T=T>>>32-12|T<<12,B=B+nt|0,b^=B,b=b>>>32-16|b<<16,y=y+b|0,nt^=y,nt=nt>>>32-12|nt<<12,z=z+ft|0,M^=z,M=M>>>32-16|M<<16,pt=pt+M|0,ft^=pt,ft=ft>>>32-12|ft<<12,$=$+v|0,C^=$,C=C>>>32-16|C<<16,mt=mt+C|0,v^=mt,v=v>>>32-12|v<<12,z=z+ft|0,M^=z,M=M>>>32-8|M<<8,pt=pt+M|0,ft^=pt,ft=ft>>>32-7|ft<<7,$=$+v|0,C^=$,C=C>>>32-8|C<<8,mt=mt+C|0,v^=mt,v=v>>>32-7|v<<7,B=B+nt|0,b^=B,b=b>>>32-8|b<<8,y=y+b|0,nt^=y,nt=nt>>>32-7|nt<<7,V=V+T|0,R^=V,R=R>>>32-8|R<<8,h=h+R|0,T^=h,T=T>>>32-7|T<<7;_r.writeUint32LE(V+i|0,r,0),_r.writeUint32LE(B+s|0,r,4),_r.writeUint32LE(z+a|0,r,8),_r.writeUint32LE($+u|0,r,12),_r.writeUint32LE(v+l|0,r,16),_r.writeUint32LE(T+d|0,r,20),_r.writeUint32LE(nt+f|0,r,24),_r.writeUint32LE(ft+w|0,r,28),_r.writeUint32LE(pt+E|0,r,32),_r.writeUint32LE(mt+S|0,r,36),_r.writeUint32LE(h+D|0,r,40),_r.writeUint32LE(y+P|0,r,44),_r.writeUint32LE(b+Y|0,r,48),_r.writeUint32LE(M+G|0,r,52),_r.writeUint32LE(C+tt|0,r,56),_r.writeUint32LE(R+K|0,r,60)}function z1(r,t,e,i,s){if(s===void 0&&(s=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<e.length)throw new Error("ChaCha: destination is shorter than source");var a,u;if(s===0){if(t.length!==8&&t.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=new Uint8Array(16),u=a.length-t.length,a.set(t,u)}else{if(t.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");a=t,u=s}for(var l=new Uint8Array(64),d=0;d<e.length;d+=64){R_(l,a,r);for(var f=d;f<d+64&&f<e.length;f++)i[f]=e[f]^l[f-d];F_(a,0,u)}return vl.wipe(l),s===0&&vl.wipe(a),i}nu.streamXOR=z1;function T_(r,t,e,i){return i===void 0&&(i=0),vl.wipe(e),z1(r,t,e,e,i)}nu.stream=T_;function F_(r,t,e){for(var i=1;e--;)i=i+(r[t]&255)|0,r[t]=i&255,i>>>=8,t++;if(i>0)throw new Error("ChaCha: counter overflow")}var k1={},Qn={};Object.defineProperty(Qn,"__esModule",{value:!0});function U_(r,t,e){return~(r-1)&t|r-1&e}Qn.select=U_;function B_(r,t){return(r|0)-(t|0)-1>>>31&1}Qn.lessOrEqual=B_;function H1(r,t){if(r.length!==t.length)return 0;for(var e=0,i=0;i<r.length;i++)e|=r[i]^t[i];return 1&e-1>>>8}Qn.compare=H1;function L_(r,t){return r.length===0||t.length===0?!1:H1(r,t)!==0}Qn.equal=L_;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=Qn,e=si;r.DIGEST_LENGTH=16;var i=function(){function u(l){this.digestLength=r.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var d=l[0]|l[1]<<8;this._r[0]=d&8191;var f=l[2]|l[3]<<8;this._r[1]=(d>>>13|f<<3)&8191;var w=l[4]|l[5]<<8;this._r[2]=(f>>>10|w<<6)&7939;var E=l[6]|l[7]<<8;this._r[3]=(w>>>7|E<<9)&8191;var S=l[8]|l[9]<<8;this._r[4]=(E>>>4|S<<12)&255,this._r[5]=S>>>1&8190;var D=l[10]|l[11]<<8;this._r[6]=(S>>>14|D<<2)&8191;var P=l[12]|l[13]<<8;this._r[7]=(D>>>11|P<<5)&8065;var Y=l[14]|l[15]<<8;this._r[8]=(P>>>8|Y<<8)&8191,this._r[9]=Y>>>5&127,this._pad[0]=l[16]|l[17]<<8,this._pad[1]=l[18]|l[19]<<8,this._pad[2]=l[20]|l[21]<<8,this._pad[3]=l[22]|l[23]<<8,this._pad[4]=l[24]|l[25]<<8,this._pad[5]=l[26]|l[27]<<8,this._pad[6]=l[28]|l[29]<<8,this._pad[7]=l[30]|l[31]<<8}return u.prototype._blocks=function(l,d,f){for(var w=this._fin?0:2048,E=this._h[0],S=this._h[1],D=this._h[2],P=this._h[3],Y=this._h[4],G=this._h[5],tt=this._h[6],K=this._h[7],V=this._h[8],B=this._h[9],z=this._r[0],$=this._r[1],v=this._r[2],T=this._r[3],nt=this._r[4],ft=this._r[5],pt=this._r[6],mt=this._r[7],h=this._r[8],y=this._r[9];f>=16;){var b=l[d+0]|l[d+1]<<8;E+=b&8191;var M=l[d+2]|l[d+3]<<8;S+=(b>>>13|M<<3)&8191;var C=l[d+4]|l[d+5]<<8;D+=(M>>>10|C<<6)&8191;var R=l[d+6]|l[d+7]<<8;P+=(C>>>7|R<<9)&8191;var j=l[d+8]|l[d+9]<<8;Y+=(R>>>4|j<<12)&8191,G+=j>>>1&8191;var I=l[d+10]|l[d+11]<<8;tt+=(j>>>14|I<<2)&8191;var g=l[d+12]|l[d+13]<<8;K+=(I>>>11|g<<5)&8191;var N=l[d+14]|l[d+15]<<8;V+=(g>>>8|N<<8)&8191,B+=N>>>5|w;var it=0,lt=it;lt+=E*z,lt+=S*(5*y),lt+=D*(5*h),lt+=P*(5*mt),lt+=Y*(5*pt),it=lt>>>13,lt&=8191,lt+=G*(5*ft),lt+=tt*(5*nt),lt+=K*(5*T),lt+=V*(5*v),lt+=B*(5*$),it+=lt>>>13,lt&=8191;var _=it;_+=E*$,_+=S*z,_+=D*(5*y),_+=P*(5*h),_+=Y*(5*mt),it=_>>>13,_&=8191,_+=G*(5*pt),_+=tt*(5*ft),_+=K*(5*nt),_+=V*(5*T),_+=B*(5*v),it+=_>>>13,_&=8191;var Z=it;Z+=E*v,Z+=S*$,Z+=D*z,Z+=P*(5*y),Z+=Y*(5*h),it=Z>>>13,Z&=8191,Z+=G*(5*mt),Z+=tt*(5*pt),Z+=K*(5*ft),Z+=V*(5*nt),Z+=B*(5*T),it+=Z>>>13,Z&=8191;var U=it;U+=E*T,U+=S*v,U+=D*$,U+=P*z,U+=Y*(5*y),it=U>>>13,U&=8191,U+=G*(5*h),U+=tt*(5*mt),U+=K*(5*pt),U+=V*(5*ft),U+=B*(5*nt),it+=U>>>13,U&=8191;var L=it;L+=E*nt,L+=S*T,L+=D*v,L+=P*$,L+=Y*z,it=L>>>13,L&=8191,L+=G*(5*y),L+=tt*(5*h),L+=K*(5*mt),L+=V*(5*pt),L+=B*(5*ft),it+=L>>>13,L&=8191;var k=it;k+=E*ft,k+=S*nt,k+=D*T,k+=P*v,k+=Y*$,it=k>>>13,k&=8191,k+=G*z,k+=tt*(5*y),k+=K*(5*h),k+=V*(5*mt),k+=B*(5*pt),it+=k>>>13,k&=8191;var p=it;p+=E*pt,p+=S*ft,p+=D*nt,p+=P*T,p+=Y*v,it=p>>>13,p&=8191,p+=G*$,p+=tt*z,p+=K*(5*y),p+=V*(5*h),p+=B*(5*mt),it+=p>>>13,p&=8191;var F=it;F+=E*mt,F+=S*pt,F+=D*ft,F+=P*nt,F+=Y*T,it=F>>>13,F&=8191,F+=G*v,F+=tt*$,F+=K*z,F+=V*(5*y),F+=B*(5*h),it+=F>>>13,F&=8191;var et=it;et+=E*h,et+=S*mt,et+=D*pt,et+=P*ft,et+=Y*nt,it=et>>>13,et&=8191,et+=G*T,et+=tt*v,et+=K*$,et+=V*z,et+=B*(5*y),it+=et>>>13,et&=8191;var ut=it;ut+=E*y,ut+=S*h,ut+=D*mt,ut+=P*pt,ut+=Y*ft,it=ut>>>13,ut&=8191,ut+=G*nt,ut+=tt*T,ut+=K*v,ut+=V*$,ut+=B*z,it+=ut>>>13,ut&=8191,it=(it<<2)+it|0,it=it+lt|0,lt=it&8191,it=it>>>13,_+=it,E=lt,S=_,D=Z,P=U,Y=L,G=k,tt=p,K=F,V=et,B=ut,d+=16,f-=16}this._h[0]=E,this._h[1]=S,this._h[2]=D,this._h[3]=P,this._h[4]=Y,this._h[5]=G,this._h[6]=tt,this._h[7]=K,this._h[8]=V,this._h[9]=B},u.prototype.finish=function(l,d){d===void 0&&(d=0);var f=new Uint16Array(10),w,E,S,D;if(this._leftover){for(D=this._leftover,this._buffer[D++]=1;D<16;D++)this._buffer[D]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,D=2;D<10;D++)this._h[D]+=w,w=this._h[D]>>>13,this._h[D]&=8191;for(this._h[0]+=w*5,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,f[0]=this._h[0]+5,w=f[0]>>>13,f[0]&=8191,D=1;D<10;D++)f[D]=this._h[D]+w,w=f[D]>>>13,f[D]&=8191;for(f[9]-=8192,E=(w^1)-1,D=0;D<10;D++)f[D]&=E;for(E=~E,D=0;D<10;D++)this._h[D]=this._h[D]&E|f[D];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,S=this._h[0]+this._pad[0],this._h[0]=S&65535,D=1;D<8;D++)S=(this._h[D]+this._pad[D]|0)+(S>>>16)|0,this._h[D]=S&65535;return l[d+0]=this._h[0]>>>0,l[d+1]=this._h[0]>>>8,l[d+2]=this._h[1]>>>0,l[d+3]=this._h[1]>>>8,l[d+4]=this._h[2]>>>0,l[d+5]=this._h[2]>>>8,l[d+6]=this._h[3]>>>0,l[d+7]=this._h[3]>>>8,l[d+8]=this._h[4]>>>0,l[d+9]=this._h[4]>>>8,l[d+10]=this._h[5]>>>0,l[d+11]=this._h[5]>>>8,l[d+12]=this._h[6]>>>0,l[d+13]=this._h[6]>>>8,l[d+14]=this._h[7]>>>0,l[d+15]=this._h[7]>>>8,this._finished=!0,this},u.prototype.update=function(l){var d=0,f=l.length,w;if(this._leftover){w=16-this._leftover,w>f&&(w=f);for(var E=0;E<w;E++)this._buffer[this._leftover+E]=l[d+E];if(f-=w,d+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(f>=16&&(w=f-f%16,this._blocks(l,d,w),d+=w,f-=w),f){for(var E=0;E<f;E++)this._buffer[this._leftover+E]=l[d+E];this._leftover+=f}return this},u.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var l=new Uint8Array(16);return this.finish(l),l},u.prototype.clean=function(){return e.wipe(this._buffer),e.wipe(this._r),e.wipe(this._h),e.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},u}();r.Poly1305=i;function s(u,l){var d=new i(u);d.update(l);var f=d.digest();return d.clean(),f}r.oneTimeAuth=s;function a(u,l){return u.length!==r.DIGEST_LENGTH||l.length!==r.DIGEST_LENGTH?!1:t.equal(u,l)}r.equal=a})(k1);(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=nu,e=k1,i=si,s=oe,a=Qn;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var u=new Uint8Array(16),l=function(){function d(f){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,f.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(f)}return d.prototype.seal=function(f,w,E,S){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var D=new Uint8Array(16);D.set(f,D.length-f.length);var P=new Uint8Array(32);t.stream(this._key,D,P,4);var Y=w.length+this.tagLength,G;if(S){if(S.length!==Y)throw new Error("ChaCha20Poly1305: incorrect destination length");G=S}else G=new Uint8Array(Y);return t.streamXOR(this._key,D,w,G,4),this._authenticate(G.subarray(G.length-this.tagLength,G.length),P,G.subarray(0,G.length-this.tagLength),E),i.wipe(D),G},d.prototype.open=function(f,w,E,S){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(w.length<this.tagLength)return null;var D=new Uint8Array(16);D.set(f,D.length-f.length);var P=new Uint8Array(32);t.stream(this._key,D,P,4);var Y=new Uint8Array(this.tagLength);if(this._authenticate(Y,P,w.subarray(0,w.length-this.tagLength),E),!a.equal(Y,w.subarray(w.length-this.tagLength,w.length)))return null;var G=w.length-this.tagLength,tt;if(S){if(S.length!==G)throw new Error("ChaCha20Poly1305: incorrect destination length");tt=S}else tt=new Uint8Array(G);return t.streamXOR(this._key,D,w.subarray(0,w.length-this.tagLength),tt,4),i.wipe(D),tt},d.prototype.clean=function(){return i.wipe(this._key),this},d.prototype._authenticate=function(f,w,E,S){var D=new e.Poly1305(w);S&&(D.update(S),S.length%16>0&&D.update(u.subarray(S.length%16))),D.update(E),E.length%16>0&&D.update(u.subarray(E.length%16));var P=new Uint8Array(8);S&&s.writeUint64LE(S.length,P),D.update(P),s.writeUint64LE(E.length,P),D.update(P);for(var Y=D.digest(),G=0;G<Y.length;G++)f[G]=Y[G];D.clean(),i.wipe(Y),i.wipe(P)},d}();r.ChaCha20Poly1305=l})(zl);var K1={},ha={},kl={};Object.defineProperty(kl,"__esModule",{value:!0});function q_(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}kl.isSerializableHash=q_;Object.defineProperty(ha,"__esModule",{value:!0});var Gi=kl,j_=Qn,$_=si,V1=function(){function r(t,e){this._finished=!1,this._inner=new t,this._outer=new t,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);e.length>this.blockSize?this._inner.update(e).finish(i).clean():i.set(e);for(var s=0;s<i.length;s++)i[s]^=54;this._inner.update(i);for(var s=0;s<i.length;s++)i[s]^=106;this._outer.update(i),Gi.isSerializableHash(this._inner)&&Gi.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),$_.wipe(i)}return r.prototype.reset=function(){if(!Gi.isSerializableHash(this._inner)||!Gi.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){Gi.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Gi.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(t){return this._inner.update(t),this},r.prototype.finish=function(t){return this._finished?(this._outer.finish(t),this):(this._inner.finish(t),this._outer.update(t.subarray(0,this.digestLength)).finish(t),this._finished=!0,this)},r.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},r.prototype.saveState=function(){if(!Gi.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(t){if(!Gi.isSerializableHash(this._inner)||!Gi.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(t),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(t){if(!Gi.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(t)},r}();ha.HMAC=V1;function z_(r,t,e){var i=new V1(r,t);i.update(e);var s=i.digest();return i.clean(),s}ha.hmac=z_;ha.equal=j_.equal;Object.defineProperty(K1,"__esModule",{value:!0});var xd=ha,Md=si,k_=function(){function r(t,e,i,s){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=t,this._info=s;var a=xd.hmac(this._hash,i,e);this._hmac=new xd.HMAC(t,a),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var t=this._counter[0];if(t===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),t>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},r.prototype.expand=function(t){for(var e=new Uint8Array(t),i=0;i<e.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),e[i]=this._buffer[this._bufpos++];return e},r.prototype.clean=function(){this._hmac.clean(),Md.wipe(this._buffer),Md.wipe(this._counter),this._bufpos=0},r}(),H_=K1.HKDF=k_,fo={},su={},ou={};Object.defineProperty(ou,"__esModule",{value:!0});ou.BrowserRandomSource=void 0;const Cd=65536;class K_{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t=typeof self<"u"?self.crypto||self.msCrypto:null;t&&t.getRandomValues!==void 0&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const e=new Uint8Array(t);for(let i=0;i<e.length;i+=Cd)this._crypto.getRandomValues(e.subarray(i,i+Math.min(e.length-i,Cd)));return e}}ou.BrowserRandomSource=K_;var au={};Object.defineProperty(au,"__esModule",{value:!0});au.NodeRandomSource=void 0;const V_=si;class G_{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof n6<"u"){const t=s6;t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(t);for(let s=0;s<i.length;s++)i[s]=e[s];return(0,V_.wipe)(e),i}}au.NodeRandomSource=G_;Object.defineProperty(su,"__esModule",{value:!0});su.SystemRandomSource=void 0;const W_=ou,Y_=au;class Q_{constructor(){if(this.isAvailable=!1,this.name="",this._source=new W_.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Y_.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}}su.SystemRandomSource=Q_;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const t=su,e=oe,i=si;r.defaultRandomSource=new t.SystemRandomSource;function s(f,w=r.defaultRandomSource){return w.randomBytes(f)}r.randomBytes=s;function a(f=r.defaultRandomSource){const w=s(4,f),E=(0,e.readUint32LE)(w);return(0,i.wipe)(w),E}r.randomUint32=a;const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(f,w=u,E=r.defaultRandomSource){if(w.length<2)throw new Error("randomString charset is too short");if(w.length>256)throw new Error("randomString charset is too long");let S="";const D=w.length,P=256-256%D;for(;f>0;){const Y=s(Math.ceil(f*256/P),E);for(let G=0;G<Y.length&&f>0;G++){const tt=Y[G];tt<P&&(S+=w.charAt(tt%D),f--)}(0,i.wipe)(Y)}return S}r.randomString=l;function d(f,w=u,E=r.defaultRandomSource){const S=Math.ceil(f/(Math.log(w.length)/Math.LN2));return l(S,w,E)}r.randomStringForEntropy=d})(fo);var cu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=oe,e=si;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function l(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return l.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){e.wipe(this._buffer),e.wipe(this._temp),this.reset()},l.prototype.update=function(d,f){if(f===void 0&&(f=d.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var w=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&f>0;)this._buffer[this._bufferLength++]=d[w++],f--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(w=a(this._temp,this._state,d,w,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=d[w++],f--;return this},l.prototype.finish=function(d){if(!this._finished){var f=this._bytesHashed,w=this._bufferLength,E=f/536870912|0,S=f<<3,D=f%64<56?64:128;this._buffer[w]=128;for(var P=w+1;P<D-8;P++)this._buffer[P]=0;t.writeUint32BE(E,this._buffer,D-8),t.writeUint32BE(S,this._buffer,D-4),a(this._temp,this._state,this._buffer,0,D),this._finished=!0}for(var P=0;P<this.digestLength/4;P++)t.writeUint32BE(this._state[P],d,P*4);return this},l.prototype.digest=function(){var d=new Uint8Array(this.digestLength);return this.finish(d),d},l.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},l.prototype.restoreState=function(d){return this._state.set(d.state),this._bufferLength=d.bufferLength,d.buffer&&this._buffer.set(d.buffer),this._bytesHashed=d.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(d){e.wipe(d.state),d.buffer&&e.wipe(d.buffer),d.bufferLength=0,d.bytesHashed=0},l}();r.SHA256=i;var s=new Int32Array([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]);function a(l,d,f,w,E){for(;E>=64;){for(var S=d[0],D=d[1],P=d[2],Y=d[3],G=d[4],tt=d[5],K=d[6],V=d[7],B=0;B<16;B++){var z=w+B*4;l[B]=t.readUint32BE(f,z)}for(var B=16;B<64;B++){var $=l[B-2],v=($>>>17|$<<32-17)^($>>>19|$<<32-19)^$>>>10;$=l[B-15];var T=($>>>7|$<<32-7)^($>>>18|$<<32-18)^$>>>3;l[B]=(v+l[B-7]|0)+(T+l[B-16]|0)}for(var B=0;B<64;B++){var v=(((G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7))+(G&tt^~G&K)|0)+(V+(s[B]+l[B]|0)|0)|0,T=((S>>>2|S<<32-2)^(S>>>13|S<<32-13)^(S>>>22|S<<32-22))+(S&D^S&P^D&P)|0;V=K,K=tt,tt=G,G=Y+v|0,Y=P,P=D,D=S,S=v+T|0}d[0]+=S,d[1]+=D,d[2]+=P,d[3]+=Y,d[4]+=G,d[5]+=tt,d[6]+=K,d[7]+=V,w+=64,E-=64}return w}function u(l){var d=new i;d.update(l);var f=d.digest();return d.clean(),f}r.hash=u})(cu);var Hl={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const t=fo,e=si;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(B){const z=new Float64Array(16);if(B)for(let $=0;$<B.length;$++)z[$]=B[$];return z}const s=new Uint8Array(32);s[0]=9;const a=i([56129,1]);function u(B){let z=1;for(let $=0;$<16;$++){let v=B[$]+z+65535;z=Math.floor(v/65536),B[$]=v-z*65536}B[0]+=z-1+37*(z-1)}function l(B,z,$){const v=~($-1);for(let T=0;T<16;T++){const nt=v&(B[T]^z[T]);B[T]^=nt,z[T]^=nt}}function d(B,z){const $=i(),v=i();for(let T=0;T<16;T++)v[T]=z[T];u(v),u(v),u(v);for(let T=0;T<2;T++){$[0]=v[0]-65517;for(let ft=1;ft<15;ft++)$[ft]=v[ft]-65535-($[ft-1]>>16&1),$[ft-1]&=65535;$[15]=v[15]-32767-($[14]>>16&1);const nt=$[15]>>16&1;$[14]&=65535,l(v,$,1-nt)}for(let T=0;T<16;T++)B[2*T]=v[T]&255,B[2*T+1]=v[T]>>8}function f(B,z){for(let $=0;$<16;$++)B[$]=z[2*$]+(z[2*$+1]<<8);B[15]&=32767}function w(B,z,$){for(let v=0;v<16;v++)B[v]=z[v]+$[v]}function E(B,z,$){for(let v=0;v<16;v++)B[v]=z[v]-$[v]}function S(B,z,$){let v,T,nt=0,ft=0,pt=0,mt=0,h=0,y=0,b=0,M=0,C=0,R=0,j=0,I=0,g=0,N=0,it=0,lt=0,_=0,Z=0,U=0,L=0,k=0,p=0,F=0,et=0,ut=0,at=0,Mt=0,Pt=0,It=0,Ee=0,$t=0,xt=$[0],Bt=$[1],_t=$[2],Et=$[3],Vt=$[4],wt=$[5],At=$[6],Ut=$[7],bt=$[8],Ct=$[9],Lt=$[10],Ot=$[11],Nt=$[12],se=$[13],Tt=$[14],Rt=$[15];v=z[0],nt+=v*xt,ft+=v*Bt,pt+=v*_t,mt+=v*Et,h+=v*Vt,y+=v*wt,b+=v*At,M+=v*Ut,C+=v*bt,R+=v*Ct,j+=v*Lt,I+=v*Ot,g+=v*Nt,N+=v*se,it+=v*Tt,lt+=v*Rt,v=z[1],ft+=v*xt,pt+=v*Bt,mt+=v*_t,h+=v*Et,y+=v*Vt,b+=v*wt,M+=v*At,C+=v*Ut,R+=v*bt,j+=v*Ct,I+=v*Lt,g+=v*Ot,N+=v*Nt,it+=v*se,lt+=v*Tt,_+=v*Rt,v=z[2],pt+=v*xt,mt+=v*Bt,h+=v*_t,y+=v*Et,b+=v*Vt,M+=v*wt,C+=v*At,R+=v*Ut,j+=v*bt,I+=v*Ct,g+=v*Lt,N+=v*Ot,it+=v*Nt,lt+=v*se,_+=v*Tt,Z+=v*Rt,v=z[3],mt+=v*xt,h+=v*Bt,y+=v*_t,b+=v*Et,M+=v*Vt,C+=v*wt,R+=v*At,j+=v*Ut,I+=v*bt,g+=v*Ct,N+=v*Lt,it+=v*Ot,lt+=v*Nt,_+=v*se,Z+=v*Tt,U+=v*Rt,v=z[4],h+=v*xt,y+=v*Bt,b+=v*_t,M+=v*Et,C+=v*Vt,R+=v*wt,j+=v*At,I+=v*Ut,g+=v*bt,N+=v*Ct,it+=v*Lt,lt+=v*Ot,_+=v*Nt,Z+=v*se,U+=v*Tt,L+=v*Rt,v=z[5],y+=v*xt,b+=v*Bt,M+=v*_t,C+=v*Et,R+=v*Vt,j+=v*wt,I+=v*At,g+=v*Ut,N+=v*bt,it+=v*Ct,lt+=v*Lt,_+=v*Ot,Z+=v*Nt,U+=v*se,L+=v*Tt,k+=v*Rt,v=z[6],b+=v*xt,M+=v*Bt,C+=v*_t,R+=v*Et,j+=v*Vt,I+=v*wt,g+=v*At,N+=v*Ut,it+=v*bt,lt+=v*Ct,_+=v*Lt,Z+=v*Ot,U+=v*Nt,L+=v*se,k+=v*Tt,p+=v*Rt,v=z[7],M+=v*xt,C+=v*Bt,R+=v*_t,j+=v*Et,I+=v*Vt,g+=v*wt,N+=v*At,it+=v*Ut,lt+=v*bt,_+=v*Ct,Z+=v*Lt,U+=v*Ot,L+=v*Nt,k+=v*se,p+=v*Tt,F+=v*Rt,v=z[8],C+=v*xt,R+=v*Bt,j+=v*_t,I+=v*Et,g+=v*Vt,N+=v*wt,it+=v*At,lt+=v*Ut,_+=v*bt,Z+=v*Ct,U+=v*Lt,L+=v*Ot,k+=v*Nt,p+=v*se,F+=v*Tt,et+=v*Rt,v=z[9],R+=v*xt,j+=v*Bt,I+=v*_t,g+=v*Et,N+=v*Vt,it+=v*wt,lt+=v*At,_+=v*Ut,Z+=v*bt,U+=v*Ct,L+=v*Lt,k+=v*Ot,p+=v*Nt,F+=v*se,et+=v*Tt,ut+=v*Rt,v=z[10],j+=v*xt,I+=v*Bt,g+=v*_t,N+=v*Et,it+=v*Vt,lt+=v*wt,_+=v*At,Z+=v*Ut,U+=v*bt,L+=v*Ct,k+=v*Lt,p+=v*Ot,F+=v*Nt,et+=v*se,ut+=v*Tt,at+=v*Rt,v=z[11],I+=v*xt,g+=v*Bt,N+=v*_t,it+=v*Et,lt+=v*Vt,_+=v*wt,Z+=v*At,U+=v*Ut,L+=v*bt,k+=v*Ct,p+=v*Lt,F+=v*Ot,et+=v*Nt,ut+=v*se,at+=v*Tt,Mt+=v*Rt,v=z[12],g+=v*xt,N+=v*Bt,it+=v*_t,lt+=v*Et,_+=v*Vt,Z+=v*wt,U+=v*At,L+=v*Ut,k+=v*bt,p+=v*Ct,F+=v*Lt,et+=v*Ot,ut+=v*Nt,at+=v*se,Mt+=v*Tt,Pt+=v*Rt,v=z[13],N+=v*xt,it+=v*Bt,lt+=v*_t,_+=v*Et,Z+=v*Vt,U+=v*wt,L+=v*At,k+=v*Ut,p+=v*bt,F+=v*Ct,et+=v*Lt,ut+=v*Ot,at+=v*Nt,Mt+=v*se,Pt+=v*Tt,It+=v*Rt,v=z[14],it+=v*xt,lt+=v*Bt,_+=v*_t,Z+=v*Et,U+=v*Vt,L+=v*wt,k+=v*At,p+=v*Ut,F+=v*bt,et+=v*Ct,ut+=v*Lt,at+=v*Ot,Mt+=v*Nt,Pt+=v*se,It+=v*Tt,Ee+=v*Rt,v=z[15],lt+=v*xt,_+=v*Bt,Z+=v*_t,U+=v*Et,L+=v*Vt,k+=v*wt,p+=v*At,F+=v*Ut,et+=v*bt,ut+=v*Ct,at+=v*Lt,Mt+=v*Ot,Pt+=v*Nt,It+=v*se,Ee+=v*Tt,$t+=v*Rt,nt+=38*_,ft+=38*Z,pt+=38*U,mt+=38*L,h+=38*k,y+=38*p,b+=38*F,M+=38*et,C+=38*ut,R+=38*at,j+=38*Mt,I+=38*Pt,g+=38*It,N+=38*Ee,it+=38*$t,T=1,v=nt+T+65535,T=Math.floor(v/65536),nt=v-T*65536,v=ft+T+65535,T=Math.floor(v/65536),ft=v-T*65536,v=pt+T+65535,T=Math.floor(v/65536),pt=v-T*65536,v=mt+T+65535,T=Math.floor(v/65536),mt=v-T*65536,v=h+T+65535,T=Math.floor(v/65536),h=v-T*65536,v=y+T+65535,T=Math.floor(v/65536),y=v-T*65536,v=b+T+65535,T=Math.floor(v/65536),b=v-T*65536,v=M+T+65535,T=Math.floor(v/65536),M=v-T*65536,v=C+T+65535,T=Math.floor(v/65536),C=v-T*65536,v=R+T+65535,T=Math.floor(v/65536),R=v-T*65536,v=j+T+65535,T=Math.floor(v/65536),j=v-T*65536,v=I+T+65535,T=Math.floor(v/65536),I=v-T*65536,v=g+T+65535,T=Math.floor(v/65536),g=v-T*65536,v=N+T+65535,T=Math.floor(v/65536),N=v-T*65536,v=it+T+65535,T=Math.floor(v/65536),it=v-T*65536,v=lt+T+65535,T=Math.floor(v/65536),lt=v-T*65536,nt+=T-1+37*(T-1),T=1,v=nt+T+65535,T=Math.floor(v/65536),nt=v-T*65536,v=ft+T+65535,T=Math.floor(v/65536),ft=v-T*65536,v=pt+T+65535,T=Math.floor(v/65536),pt=v-T*65536,v=mt+T+65535,T=Math.floor(v/65536),mt=v-T*65536,v=h+T+65535,T=Math.floor(v/65536),h=v-T*65536,v=y+T+65535,T=Math.floor(v/65536),y=v-T*65536,v=b+T+65535,T=Math.floor(v/65536),b=v-T*65536,v=M+T+65535,T=Math.floor(v/65536),M=v-T*65536,v=C+T+65535,T=Math.floor(v/65536),C=v-T*65536,v=R+T+65535,T=Math.floor(v/65536),R=v-T*65536,v=j+T+65535,T=Math.floor(v/65536),j=v-T*65536,v=I+T+65535,T=Math.floor(v/65536),I=v-T*65536,v=g+T+65535,T=Math.floor(v/65536),g=v-T*65536,v=N+T+65535,T=Math.floor(v/65536),N=v-T*65536,v=it+T+65535,T=Math.floor(v/65536),it=v-T*65536,v=lt+T+65535,T=Math.floor(v/65536),lt=v-T*65536,nt+=T-1+37*(T-1),B[0]=nt,B[1]=ft,B[2]=pt,B[3]=mt,B[4]=h,B[5]=y,B[6]=b,B[7]=M,B[8]=C,B[9]=R,B[10]=j,B[11]=I,B[12]=g,B[13]=N,B[14]=it,B[15]=lt}function D(B,z){S(B,z,z)}function P(B,z){const $=i();for(let v=0;v<16;v++)$[v]=z[v];for(let v=253;v>=0;v--)D($,$),v!==2&&v!==4&&S($,$,z);for(let v=0;v<16;v++)B[v]=$[v]}function Y(B,z){const $=new Uint8Array(32),v=new Float64Array(80),T=i(),nt=i(),ft=i(),pt=i(),mt=i(),h=i();for(let C=0;C<31;C++)$[C]=B[C];$[31]=B[31]&127|64,$[0]&=248,f(v,z);for(let C=0;C<16;C++)nt[C]=v[C];T[0]=pt[0]=1;for(let C=254;C>=0;--C){const R=$[C>>>3]>>>(C&7)&1;l(T,nt,R),l(ft,pt,R),w(mt,T,ft),E(T,T,ft),w(ft,nt,pt),E(nt,nt,pt),D(pt,mt),D(h,T),S(T,ft,T),S(ft,nt,mt),w(mt,T,ft),E(T,T,ft),D(nt,T),E(ft,pt,h),S(T,ft,a),w(T,T,pt),S(ft,ft,T),S(T,pt,h),S(pt,nt,v),D(nt,mt),l(T,nt,R),l(ft,pt,R)}for(let C=0;C<16;C++)v[C+16]=T[C],v[C+32]=ft[C],v[C+48]=nt[C],v[C+64]=pt[C];const y=v.subarray(32),b=v.subarray(16);P(y,y),S(b,b,y);const M=new Uint8Array(32);return d(M,b),M}r.scalarMult=Y;function G(B){return Y(B,s)}r.scalarMultBase=G;function tt(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(B);return{publicKey:G(z),secretKey:z}}r.generateKeyPairFromSeed=tt;function K(B){const z=(0,t.randomBytes)(32,B),$=tt(z);return(0,e.wipe)(z),$}r.generateKeyPair=K;function V(B,z,$=!1){if(B.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const v=Y(B,z);if($){let T=0;for(let nt=0;nt<v.length;nt++)T|=v[nt];if(T===0)throw new Error("X25519: invalid shared key")}return v}r.sharedKey=V})(Hl);function G1(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function yl(r,t){t||(t=r.reduce((s,a)=>s+a.length,0));const e=G1(t);let i=0;for(const s of r)e.set(s,i),i+=s.length;return e}function J_(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),i=0;i<e.length;i++)e[i]=255;for(var s=0;s<r.length;s++){var a=r.charAt(s),u=a.charCodeAt(0);if(e[u]!==255)throw new TypeError(a+" is ambiguous");e[u]=s}var l=r.length,d=r.charAt(0),f=Math.log(l)/Math.log(256),w=Math.log(256)/Math.log(l);function E(P){if(P instanceof Uint8Array||(ArrayBuffer.isView(P)?P=new Uint8Array(P.buffer,P.byteOffset,P.byteLength):Array.isArray(P)&&(P=Uint8Array.from(P))),!(P instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(P.length===0)return"";for(var Y=0,G=0,tt=0,K=P.length;tt!==K&&P[tt]===0;)tt++,Y++;for(var V=(K-tt)*w+1>>>0,B=new Uint8Array(V);tt!==K;){for(var z=P[tt],$=0,v=V-1;(z!==0||$<G)&&v!==-1;v--,$++)z+=256*B[v]>>>0,B[v]=z%l>>>0,z=z/l>>>0;if(z!==0)throw new Error("Non-zero carry");G=$,tt++}for(var T=V-G;T!==V&&B[T]===0;)T++;for(var nt=d.repeat(Y);T<V;++T)nt+=r.charAt(B[T]);return nt}function S(P){if(typeof P!="string")throw new TypeError("Expected String");if(P.length===0)return new Uint8Array;var Y=0;if(P[Y]!==" "){for(var G=0,tt=0;P[Y]===d;)G++,Y++;for(var K=(P.length-Y)*f+1>>>0,V=new Uint8Array(K);P[Y];){var B=e[P.charCodeAt(Y)];if(B===255)return;for(var z=0,$=K-1;(B!==0||z<tt)&&$!==-1;$--,z++)B+=l*V[$]>>>0,V[$]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");tt=z,Y++}if(P[Y]!==" "){for(var v=K-tt;v!==K&&V[v]===0;)v++;for(var T=new Uint8Array(G+(K-v)),nt=G;v!==K;)T[nt++]=V[v++];return T}}}function D(P){var Y=S(P);if(Y)return Y;throw new Error(`Non-${t} character`)}return{encode:E,decodeUnsafe:S,decode:D}}var X_=J_,Z_=X_;const tE=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},eE=r=>new TextEncoder().encode(r),rE=r=>new TextDecoder().decode(r);class iE{constructor(t,e,i){this.name=t,this.prefix=e,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class nE{constructor(t,e,i){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=i}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return W1(this,t)}}class sE{constructor(t){this.decoders=t}or(t){return W1(this,t)}decode(t){const e=t[0],i=this.decoders[e];if(i)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const W1=(r,t)=>new sE({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class oE{constructor(t,e,i,s){this.name=t,this.prefix=e,this.baseEncode=i,this.baseDecode=s,this.encoder=new iE(t,e,i),this.decoder=new nE(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const uu=({name:r,prefix:t,encode:e,decode:i})=>new oE(r,t,e,i),la=({prefix:r,name:t,alphabet:e})=>{const{encode:i,decode:s}=Z_(e,t);return uu({prefix:r,name:t,encode:i,decode:a=>tE(s(a))})},aE=(r,t,e,i)=>{const s={};for(let w=0;w<t.length;++w)s[t[w]]=w;let a=r.length;for(;r[a-1]==="=";)--a;const u=new Uint8Array(a*e/8|0);let l=0,d=0,f=0;for(let w=0;w<a;++w){const E=s[r[w]];if(E===void 0)throw new SyntaxError(`Non-${i} character`);d=d<<e|E,l+=e,l>=8&&(l-=8,u[f++]=255&d>>l)}if(l>=e||255&d<<8-l)throw new SyntaxError("Unexpected end of data");return u},cE=(r,t,e)=>{const i=t[t.length-1]==="=",s=(1<<e)-1;let a="",u=0,l=0;for(let d=0;d<r.length;++d)for(l=l<<8|r[d],u+=8;u>e;)u-=e,a+=t[s&l>>u];if(u&&(a+=t[s&l<<e-u]),i)for(;a.length*e&7;)a+="=";return a},vr=({name:r,prefix:t,bitsPerChar:e,alphabet:i})=>uu({prefix:t,name:r,encode(s){return cE(s,i,e)},decode(s){return aE(s,i,e,r)}}),uE=uu({prefix:"\0",name:"identity",encode:r=>rE(r),decode:r=>eE(r)}),hE=Object.freeze(Object.defineProperty({__proto__:null,identity:uE},Symbol.toStringTag,{value:"Module"})),lE=vr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),fE=Object.freeze(Object.defineProperty({__proto__:null,base2:lE},Symbol.toStringTag,{value:"Module"})),dE=vr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),pE=Object.freeze(Object.defineProperty({__proto__:null,base8:dE},Symbol.toStringTag,{value:"Module"})),gE=la({prefix:"9",name:"base10",alphabet:"0123456789"}),mE=Object.freeze(Object.defineProperty({__proto__:null,base10:gE},Symbol.toStringTag,{value:"Module"})),vE=vr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),yE=vr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),wE=Object.freeze(Object.defineProperty({__proto__:null,base16:vE,base16upper:yE},Symbol.toStringTag,{value:"Module"})),bE=vr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),_E=vr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),EE=vr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),AE=vr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),SE=vr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),IE=vr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),DE=vr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),xE=vr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ME=vr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),CE=Object.freeze(Object.defineProperty({__proto__:null,base32:bE,base32hex:SE,base32hexpad:DE,base32hexpadupper:xE,base32hexupper:IE,base32pad:EE,base32padupper:AE,base32upper:_E,base32z:ME},Symbol.toStringTag,{value:"Module"})),PE=la({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),OE=la({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),NE=Object.freeze(Object.defineProperty({__proto__:null,base36:PE,base36upper:OE},Symbol.toStringTag,{value:"Module"})),RE=la({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),TE=la({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),FE=Object.freeze(Object.defineProperty({__proto__:null,base58btc:RE,base58flickr:TE},Symbol.toStringTag,{value:"Module"})),UE=vr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),BE=vr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),LE=vr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),qE=vr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),jE=Object.freeze(Object.defineProperty({__proto__:null,base64:UE,base64pad:BE,base64url:LE,base64urlpad:qE},Symbol.toStringTag,{value:"Module"})),Y1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),$E=Y1.reduce((r,t,e)=>(r[e]=t,r),[]),zE=Y1.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function kE(r){return r.reduce((t,e)=>(t+=$E[e],t),"")}function HE(r){const t=[];for(const e of r){const i=zE[e.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}const KE=uu({prefix:"🚀",name:"base256emoji",encode:kE,decode:HE}),VE=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:KE},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const Pd={...hE,...fE,...pE,...mE,...wE,...CE,...NE,...FE,...jE,...VE};function Q1(r,t,e,i){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:i}}}const Od=Q1("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Oh=Q1("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=G1(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),J1={utf8:Od,"utf-8":Od,hex:Pd.base16,latin1:Oh,ascii:Oh,binary:Oh,...Pd};function Kr(r,t="utf8"){const e=J1[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):e.decoder.decode(`${e.prefix}${r}`)}function Tr(r,t="utf8"){const e=J1[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}const GE={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},WE=":";function Tc(r){const[t,e]=r.split(WE);return{namespace:t,reference:e}}function Nd(r,t=[]){const e=[];return Object.keys(r).forEach(i=>{if(t.length&&!t.includes(i))return;const s=r[i];e.push(...s.accounts)}),e}function X1(r,t){return r.includes(":")?[r]:t.chains||[]}var YE=Object.defineProperty,Rd=Object.getOwnPropertySymbols,QE=Object.prototype.hasOwnProperty,JE=Object.prototype.propertyIsEnumerable,Td=(r,t,e)=>t in r?YE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fd=(r,t)=>{for(var e in t||(t={}))QE.call(t,e)&&Td(r,e,t[e]);if(Rd)for(var e of Rd(t))JE.call(t,e)&&Td(r,e,t[e]);return r};const XE="ReactNative",ei={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},ZE="js";function ia(){return typeof ri<"u"&&typeof ri.versions<"u"&&typeof ri.versions.node<"u"}function po(){return!ql()&&!!jl()&&navigator.product===XE}function go(){return!ia()&&!!jl()&&!!ql()}function fa(){return po()?ei.reactNative:ia()?ei.node:go()?ei.browser:ei.unknown}function t5(){var r;try{return po()&&typeof Ie<"u"&&typeof(Ie==null?void 0:Ie.Application)<"u"?(r=Ie.Application)==null?void 0:r.applicationId:void 0}catch{return}}function e5(r,t){let e=ra.parse(r);return e=Fd(Fd({},e),t),r=ra.stringify(e),r}function r5(){return T1()||{name:"",description:"",url:"",icons:[""]}}function i5(){if(fa()===ei.reactNative&&typeof Ie<"u"&&typeof(Ie==null?void 0:Ie.Platform)<"u"){const{OS:e,Version:i}=Ie.Platform;return[e,i].join("-")}const r=g6();if(r===null)return"unknown";const t=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[t,r.name,r.version].join("-"):[t,r.version].join("-")}function n5(){var r;const t=fa();return t===ei.browser?[t,((r=R1())==null?void 0:r.host)||"unknown"].join(":"):t}function s5(r,t,e){const i=i5(),s=n5();return[[r,t].join("-"),[ZE,e].join("-"),i,s].join("/")}function o5({protocol:r,version:t,relayUrl:e,sdkVersion:i,auth:s,projectId:a,useOnCloseEvent:u,bundleId:l}){const d=e.split("?"),f=s5(r,t,i),w={auth:s,ua:f,projectId:a,useOnCloseEvent:u||void 0,origin:l||void 0},E=e5(d[1]||"",w);return d[0]+"?"+E}function Es(r,t){return r.filter(e=>t.includes(e)).length===r.length}function Z1(r){return Object.fromEntries(r.entries())}function tg(r){return new Map(Object.entries(r))}function _s(r=yt.FIVE_MINUTES,t){const e=yt.toMiliseconds(r||yt.FIVE_MINUTES);let i,s,a;return{resolve:u=>{a&&i&&(clearTimeout(a),i(u))},reject:u=>{a&&s&&(clearTimeout(a),s(u))},done:()=>new Promise((u,l)=>{a=setTimeout(()=>{l(new Error(t))},e),i=u,s=l})}}function so(r,t,e){return new Promise(async(i,s)=>{const a=setTimeout(()=>s(new Error(e)),t);try{const u=await r;i(u)}catch(u){s(u)}clearTimeout(a)})}function eg(r,t){if(typeof t=="string"&&t.startsWith(`${r}:`))return t;if(r.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(r.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: ${r}`)}function a5(r){return eg("topic",r)}function c5(r){return eg("id",r)}function rg(r){const[t,e]=r.split(":"),i={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")i.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))i.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return i}function gr(r,t){return yt.fromMiliseconds((t||Date.now())+yt.toMiliseconds(r))}function Hn(r){return Date.now()>=yt.toMiliseconds(r)}function de(r,t){return`${r}${t?`:${t}`:""}`}function Fc(r=[],t=[]){return[...new Set([...r,...t])]}async function u5({id:r,topic:t,wcDeepLink:e}){try{if(!e)return;const i=typeof e=="string"?JSON.parse(e):e;let s=i==null?void 0:i.href;if(typeof s!="string")return;s.endsWith("/")&&(s=s.slice(0,-1));const a=`${s}/wc?requestId=${r}&sessionTopic=${t}`,u=fa();u===ei.browser?a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,"_self","noreferrer noopener"):u===ei.reactNative&&typeof(Ie==null?void 0:Ie.Linking)<"u"&&await Ie.Linking.openURL(a)}catch(i){console.error(i)}}async function h5(r,t){try{return await r.getItem(t)||(go()?localStorage.getItem(t):void 0)}catch(e){console.error(e)}}var ig=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ie<"u"?Ie:typeof self<"u"?self:{};function l5(r){var t=r.default;if(typeof t=="function"){var e=function(){return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var ng={exports:{}};/**
|
|
15
|
+
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
16
|
+
*
|
|
17
|
+
* @version 0.8.0
|
|
18
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
19
|
+
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
20
|
+
* @license MIT
|
|
21
|
+
*/(function(r){(function(){var t="input is invalid type",e="finalize already called",i=typeof window=="object",s=i?window:{};s.JS_SHA3_NO_WINDOW&&(i=!1);var a=!i&&typeof self=="object",u=!s.JS_SHA3_NO_NODE_JS&&typeof ri=="object"&&ri.versions&&ri.versions.node;u?s=ig:a&&(s=self);var l=!s.JS_SHA3_NO_COMMON_JS&&!0&&r.exports,d=!s.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),w=[31,7936,2031616,520093696],E=[4,1024,262144,67108864],S=[1,256,65536,16777216],D=[6,1536,393216,100663296],P=[0,8,16,24],Y=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],G=[224,256,384,512],tt=[128,256],K=["hex","buffer","arrayBuffer","array","digest"],V={128:168,256:136};(s.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(_){return Object.prototype.toString.call(_)==="[object Array]"}),d&&(s.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(_){return typeof _=="object"&&_.buffer&&_.buffer.constructor===ArrayBuffer});for(var B=function(_,Z,U){return function(L){return new N(_,Z,_).update(L)[U]()}},z=function(_,Z,U){return function(L,k){return new N(_,Z,k).update(L)[U]()}},$=function(_,Z,U){return function(L,k,p,F){return y["cshake"+_].update(L,k,p,F)[U]()}},v=function(_,Z,U){return function(L,k,p,F){return y["kmac"+_].update(L,k,p,F)[U]()}},T=function(_,Z,U,L){for(var k=0;k<K.length;++k){var p=K[k];_[p]=Z(U,L,p)}return _},nt=function(_,Z){var U=B(_,Z,"hex");return U.create=function(){return new N(_,Z,_)},U.update=function(L){return U.create().update(L)},T(U,B,_,Z)},ft=function(_,Z){var U=z(_,Z,"hex");return U.create=function(L){return new N(_,Z,L)},U.update=function(L,k){return U.create(k).update(L)},T(U,z,_,Z)},pt=function(_,Z){var U=V[_],L=$(_,Z,"hex");return L.create=function(k,p,F){return!p&&!F?y["shake"+_].create(k):new N(_,Z,k).bytepad([p,F],U)},L.update=function(k,p,F,et){return L.create(p,F,et).update(k)},T(L,$,_,Z)},mt=function(_,Z){var U=V[_],L=v(_,Z,"hex");return L.create=function(k,p,F){return new it(_,Z,p).bytepad(["KMAC",F],U).bytepad([k],U)},L.update=function(k,p,F,et){return L.create(k,F,et).update(p)},T(L,v,_,Z)},h=[{name:"keccak",padding:S,bits:G,createMethod:nt},{name:"sha3",padding:D,bits:G,createMethod:nt},{name:"shake",padding:w,bits:tt,createMethod:ft},{name:"cshake",padding:E,bits:tt,createMethod:pt},{name:"kmac",padding:E,bits:tt,createMethod:mt}],y={},b=[],M=0;M<h.length;++M)for(var C=h[M],R=C.bits,j=0;j<R.length;++j){var I=C.name+"_"+R[j];if(b.push(I),y[I]=C.createMethod(R[j],C.padding),C.name!=="sha3"){var g=C.name+R[j];b.push(g),y[g]=y[I]}}function N(_,Z,U){this.blocks=[],this.s=[],this.padding=Z,this.outputBits=U,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(_<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var L=0;L<50;++L)this.s[L]=0}N.prototype.update=function(_){if(this.finalized)throw new Error(e);var Z,U=typeof _;if(U!=="string"){if(U==="object"){if(_===null)throw new Error(t);if(d&&_.constructor===ArrayBuffer)_=new Uint8Array(_);else if(!Array.isArray(_)&&(!d||!ArrayBuffer.isView(_)))throw new Error(t)}else throw new Error(t);Z=!0}for(var L=this.blocks,k=this.byteCount,p=_.length,F=this.blockCount,et=0,ut=this.s,at,Mt;et<p;){if(this.reset)for(this.reset=!1,L[0]=this.block,at=1;at<F+1;++at)L[at]=0;if(Z)for(at=this.start;et<p&&at<k;++et)L[at>>2]|=_[et]<<P[at++&3];else for(at=this.start;et<p&&at<k;++et)Mt=_.charCodeAt(et),Mt<128?L[at>>2]|=Mt<<P[at++&3]:Mt<2048?(L[at>>2]|=(192|Mt>>6)<<P[at++&3],L[at>>2]|=(128|Mt&63)<<P[at++&3]):Mt<55296||Mt>=57344?(L[at>>2]|=(224|Mt>>12)<<P[at++&3],L[at>>2]|=(128|Mt>>6&63)<<P[at++&3],L[at>>2]|=(128|Mt&63)<<P[at++&3]):(Mt=65536+((Mt&1023)<<10|_.charCodeAt(++et)&1023),L[at>>2]|=(240|Mt>>18)<<P[at++&3],L[at>>2]|=(128|Mt>>12&63)<<P[at++&3],L[at>>2]|=(128|Mt>>6&63)<<P[at++&3],L[at>>2]|=(128|Mt&63)<<P[at++&3]);if(this.lastByteIndex=at,at>=k){for(this.start=at-k,this.block=L[F],at=0;at<F;++at)ut[at]^=L[at];lt(ut),this.reset=!0}else this.start=at}return this},N.prototype.encode=function(_,Z){var U=_&255,L=1,k=[U];for(_=_>>8,U=_&255;U>0;)k.unshift(U),_=_>>8,U=_&255,++L;return Z?k.push(L):k.unshift(L),this.update(k),k.length},N.prototype.encodeString=function(_){var Z,U=typeof _;if(U!=="string"){if(U==="object"){if(_===null)throw new Error(t);if(d&&_.constructor===ArrayBuffer)_=new Uint8Array(_);else if(!Array.isArray(_)&&(!d||!ArrayBuffer.isView(_)))throw new Error(t)}else throw new Error(t);Z=!0}var L=0,k=_.length;if(Z)L=k;else for(var p=0;p<_.length;++p){var F=_.charCodeAt(p);F<128?L+=1:F<2048?L+=2:F<55296||F>=57344?L+=3:(F=65536+((F&1023)<<10|_.charCodeAt(++p)&1023),L+=4)}return L+=this.encode(L*8),this.update(_),L},N.prototype.bytepad=function(_,Z){for(var U=this.encode(Z),L=0;L<_.length;++L)U+=this.encodeString(_[L]);var k=Z-U%Z,p=[];return p.length=k,this.update(p),this},N.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var _=this.blocks,Z=this.lastByteIndex,U=this.blockCount,L=this.s;if(_[Z>>2]|=this.padding[Z&3],this.lastByteIndex===this.byteCount)for(_[0]=_[U],Z=1;Z<U+1;++Z)_[Z]=0;for(_[U-1]|=2147483648,Z=0;Z<U;++Z)L[Z]^=_[Z];lt(L)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var _=this.blockCount,Z=this.s,U=this.outputBlocks,L=this.extraBytes,k=0,p=0,F="",et;p<U;){for(k=0;k<_&&p<U;++k,++p)et=Z[k],F+=f[et>>4&15]+f[et&15]+f[et>>12&15]+f[et>>8&15]+f[et>>20&15]+f[et>>16&15]+f[et>>28&15]+f[et>>24&15];p%_===0&&(lt(Z),k=0)}return L&&(et=Z[k],F+=f[et>>4&15]+f[et&15],L>1&&(F+=f[et>>12&15]+f[et>>8&15]),L>2&&(F+=f[et>>20&15]+f[et>>16&15])),F},N.prototype.arrayBuffer=function(){this.finalize();var _=this.blockCount,Z=this.s,U=this.outputBlocks,L=this.extraBytes,k=0,p=0,F=this.outputBits>>3,et;L?et=new ArrayBuffer(U+1<<2):et=new ArrayBuffer(F);for(var ut=new Uint32Array(et);p<U;){for(k=0;k<_&&p<U;++k,++p)ut[p]=Z[k];p%_===0&<(Z)}return L&&(ut[k]=Z[k],et=et.slice(0,F)),et},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var _=this.blockCount,Z=this.s,U=this.outputBlocks,L=this.extraBytes,k=0,p=0,F=[],et,ut;p<U;){for(k=0;k<_&&p<U;++k,++p)et=p<<2,ut=Z[k],F[et]=ut&255,F[et+1]=ut>>8&255,F[et+2]=ut>>16&255,F[et+3]=ut>>24&255;p%_===0&<(Z)}return L&&(et=p<<2,ut=Z[k],F[et]=ut&255,L>1&&(F[et+1]=ut>>8&255),L>2&&(F[et+2]=ut>>16&255)),F};function it(_,Z,U){N.call(this,_,Z,U)}it.prototype=new N,it.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var lt=function(_){var Z,U,L,k,p,F,et,ut,at,Mt,Pt,It,Ee,$t,xt,Bt,_t,Et,Vt,wt,At,Ut,bt,Ct,Lt,Ot,Nt,se,Tt,Rt,Ke,ce,pe,Ve,ye,_e,Ar,Gt,zt,De,Wt,Kt,Ae,Jt,Xt,xe,Zt,Yt,Ce,Qt,qt,Te,te,Pe,xi,Oe,le,oi,ai,ci,ui,hi,ar;for(L=0;L<48;L+=2)k=_[0]^_[10]^_[20]^_[30]^_[40],p=_[1]^_[11]^_[21]^_[31]^_[41],F=_[2]^_[12]^_[22]^_[32]^_[42],et=_[3]^_[13]^_[23]^_[33]^_[43],ut=_[4]^_[14]^_[24]^_[34]^_[44],at=_[5]^_[15]^_[25]^_[35]^_[45],Mt=_[6]^_[16]^_[26]^_[36]^_[46],Pt=_[7]^_[17]^_[27]^_[37]^_[47],It=_[8]^_[18]^_[28]^_[38]^_[48],Ee=_[9]^_[19]^_[29]^_[39]^_[49],Z=It^(F<<1|et>>>31),U=Ee^(et<<1|F>>>31),_[0]^=Z,_[1]^=U,_[10]^=Z,_[11]^=U,_[20]^=Z,_[21]^=U,_[30]^=Z,_[31]^=U,_[40]^=Z,_[41]^=U,Z=k^(ut<<1|at>>>31),U=p^(at<<1|ut>>>31),_[2]^=Z,_[3]^=U,_[12]^=Z,_[13]^=U,_[22]^=Z,_[23]^=U,_[32]^=Z,_[33]^=U,_[42]^=Z,_[43]^=U,Z=F^(Mt<<1|Pt>>>31),U=et^(Pt<<1|Mt>>>31),_[4]^=Z,_[5]^=U,_[14]^=Z,_[15]^=U,_[24]^=Z,_[25]^=U,_[34]^=Z,_[35]^=U,_[44]^=Z,_[45]^=U,Z=ut^(It<<1|Ee>>>31),U=at^(Ee<<1|It>>>31),_[6]^=Z,_[7]^=U,_[16]^=Z,_[17]^=U,_[26]^=Z,_[27]^=U,_[36]^=Z,_[37]^=U,_[46]^=Z,_[47]^=U,Z=Mt^(k<<1|p>>>31),U=Pt^(p<<1|k>>>31),_[8]^=Z,_[9]^=U,_[18]^=Z,_[19]^=U,_[28]^=Z,_[29]^=U,_[38]^=Z,_[39]^=U,_[48]^=Z,_[49]^=U,$t=_[0],xt=_[1],xe=_[11]<<4|_[10]>>>28,Zt=_[10]<<4|_[11]>>>28,se=_[20]<<3|_[21]>>>29,Tt=_[21]<<3|_[20]>>>29,ci=_[31]<<9|_[30]>>>23,ui=_[30]<<9|_[31]>>>23,Kt=_[40]<<18|_[41]>>>14,Ae=_[41]<<18|_[40]>>>14,Ve=_[2]<<1|_[3]>>>31,ye=_[3]<<1|_[2]>>>31,Bt=_[13]<<12|_[12]>>>20,_t=_[12]<<12|_[13]>>>20,Yt=_[22]<<10|_[23]>>>22,Ce=_[23]<<10|_[22]>>>22,Rt=_[33]<<13|_[32]>>>19,Ke=_[32]<<13|_[33]>>>19,hi=_[42]<<2|_[43]>>>30,ar=_[43]<<2|_[42]>>>30,Pe=_[5]<<30|_[4]>>>2,xi=_[4]<<30|_[5]>>>2,_e=_[14]<<6|_[15]>>>26,Ar=_[15]<<6|_[14]>>>26,Et=_[25]<<11|_[24]>>>21,Vt=_[24]<<11|_[25]>>>21,Qt=_[34]<<15|_[35]>>>17,qt=_[35]<<15|_[34]>>>17,ce=_[45]<<29|_[44]>>>3,pe=_[44]<<29|_[45]>>>3,Ct=_[6]<<28|_[7]>>>4,Lt=_[7]<<28|_[6]>>>4,Oe=_[17]<<23|_[16]>>>9,le=_[16]<<23|_[17]>>>9,Gt=_[26]<<25|_[27]>>>7,zt=_[27]<<25|_[26]>>>7,wt=_[36]<<21|_[37]>>>11,At=_[37]<<21|_[36]>>>11,Te=_[47]<<24|_[46]>>>8,te=_[46]<<24|_[47]>>>8,Jt=_[8]<<27|_[9]>>>5,Xt=_[9]<<27|_[8]>>>5,Ot=_[18]<<20|_[19]>>>12,Nt=_[19]<<20|_[18]>>>12,oi=_[29]<<7|_[28]>>>25,ai=_[28]<<7|_[29]>>>25,De=_[38]<<8|_[39]>>>24,Wt=_[39]<<8|_[38]>>>24,Ut=_[48]<<14|_[49]>>>18,bt=_[49]<<14|_[48]>>>18,_[0]=$t^~Bt&Et,_[1]=xt^~_t&Vt,_[10]=Ct^~Ot&se,_[11]=Lt^~Nt&Tt,_[20]=Ve^~_e&Gt,_[21]=ye^~Ar&zt,_[30]=Jt^~xe&Yt,_[31]=Xt^~Zt&Ce,_[40]=Pe^~Oe&oi,_[41]=xi^~le&ai,_[2]=Bt^~Et&wt,_[3]=_t^~Vt&At,_[12]=Ot^~se&Rt,_[13]=Nt^~Tt&Ke,_[22]=_e^~Gt&De,_[23]=Ar^~zt&Wt,_[32]=xe^~Yt&Qt,_[33]=Zt^~Ce&qt,_[42]=Oe^~oi&ci,_[43]=le^~ai&ui,_[4]=Et^~wt&Ut,_[5]=Vt^~At&bt,_[14]=se^~Rt&ce,_[15]=Tt^~Ke&pe,_[24]=Gt^~De&Kt,_[25]=zt^~Wt&Ae,_[34]=Yt^~Qt&Te,_[35]=Ce^~qt&te,_[44]=oi^~ci&hi,_[45]=ai^~ui&ar,_[6]=wt^~Ut&$t,_[7]=At^~bt&xt,_[16]=Rt^~ce&Ct,_[17]=Ke^~pe&Lt,_[26]=De^~Kt&Ve,_[27]=Wt^~Ae&ye,_[36]=Qt^~Te&Jt,_[37]=qt^~te&Xt,_[46]=ci^~hi&Pe,_[47]=ui^~ar&xi,_[8]=Ut^~$t&Bt,_[9]=bt^~xt&_t,_[18]=ce^~Ct&Ot,_[19]=pe^~Lt&Nt,_[28]=Kt^~Ve&_e,_[29]=Ae^~ye&Ar,_[38]=Te^~Jt&xe,_[39]=te^~Xt&Zt,_[48]=hi^~Pe&Oe,_[49]=ar^~xi&le,_[0]^=Y[L],_[1]^=Y[L+1]};if(l)r.exports=y;else for(M=0;M<b.length;++M)s[b[M]]=y[b[M]]})()})(ng);var f5=ng.exports;const d5="logger/5.7.0";let Ud=!1,Bd=!1;const Uc={debug:1,default:2,info:2,warning:3,error:4,off:5};let Ld=Uc.default,Nh=null;function p5(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{r.push(t)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const qd=p5();var wl;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(wl||(wl={}));var Ui;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(Ui||(Ui={}));const jd="0123456789abcdef";let mr=class or{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const i=t.toLowerCase();Uc[i]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(Ld>Uc[i])&&console.log.apply(console,e)}debug(...t){this._log(or.levels.DEBUG,t)}info(...t){this._log(or.levels.INFO,t)}warn(...t){this._log(or.levels.WARNING,t)}makeError(t,e,i){if(Bd)return this.makeError("censored error",e,{});e||(e=or.errors.UNKNOWN_ERROR),i||(i={});const s=[];Object.keys(i).forEach(d=>{const f=i[d];try{if(f instanceof Uint8Array){let w="";for(let E=0;E<f.length;E++)w+=jd[f[E]>>4],w+=jd[f[E]&15];s.push(d+"=Uint8Array(0x"+w+")")}else s.push(d+"="+JSON.stringify(f))}catch{s.push(d+"="+JSON.stringify(i[d].toString()))}}),s.push(`code=${e}`),s.push(`version=${this.version}`);const a=t;let u="";switch(e){case Ui.NUMERIC_FAULT:{u="NUMERIC_FAULT";const d=t;switch(d){case"overflow":case"underflow":case"division-by-zero":u+="-"+d;break;case"negative-power":case"negative-width":u+="-unsupported";break;case"unbound-bitwise-result":u+="-unbound-result";break}break}case Ui.CALL_EXCEPTION:case Ui.INSUFFICIENT_FUNDS:case Ui.MISSING_NEW:case Ui.NONCE_EXPIRED:case Ui.REPLACEMENT_UNDERPRICED:case Ui.TRANSACTION_REPLACED:case Ui.UNPREDICTABLE_GAS_LIMIT:u=e;break}u&&(t+=" [ See: https://links.ethers.org/v5-errors-"+u+" ]"),s.length&&(t+=" ("+s.join(", ")+")");const l=new Error(t);return l.reason=a,l.code=e,Object.keys(i).forEach(function(d){l[d]=i[d]}),l}throwError(t,e,i){throw this.makeError(t,e,i)}throwArgumentError(t,e,i){return this.throwError(t,or.errors.INVALID_ARGUMENT,{argument:e,value:i})}assert(t,e,i,s){t||this.throwError(e,i,s)}assertArgument(t,e,i,s){t||this.throwArgumentError(e,i,s)}checkNormalize(t){qd&&this.throwError("platform missing String.prototype.normalize",or.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:qd})}checkSafeUint53(t,e){typeof t=="number"&&(e==null&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,or.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,or.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,i){i?i=": "+i:i="",t<e&&this.throwError("missing argument"+i,or.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+i,or.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){(t===Object||t==null)&&this.throwError("missing new",or.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",or.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",or.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Nh||(Nh=new or(d5)),Nh}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",or.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ud){if(!t)return;this.globalLogger().throwError("error censorship permanent",or.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Bd=!!t,Ud=!!e}static setLogLevel(t){const e=Uc[t.toLowerCase()];if(e==null){or.globalLogger().warn("invalid log level - "+t);return}Ld=e}static from(t){return new or(t)}};mr.errors=Ui,mr.levels=wl;const g5="bytes/5.7.0",Ze=new mr(g5);function sg(r){return!!r.toHexString}function oo(r){return r.slice||(r.slice=function(){const t=Array.prototype.slice.call(arguments);return oo(new Uint8Array(Array.prototype.slice.apply(r,t)))}),r}function m5(r){return ii(r)&&!(r.length%2)||mo(r)}function $d(r){return typeof r=="number"&&r==r&&r%1===0}function mo(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!$d(r.length)||r.length<0)return!1;for(let t=0;t<r.length;t++){const e=r[t];if(!$d(e)||e<0||e>=256)return!1}return!0}function Ye(r,t){if(t||(t={}),typeof r=="number"){Ze.checkSafeUint53(r,"invalid arrayify value");const e=[];for(;r;)e.unshift(r&255),r=parseInt(String(r/256));return e.length===0&&e.push(0),oo(new Uint8Array(e))}if(t.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),sg(r)&&(r=r.toHexString()),ii(r)){let e=r.substring(2);e.length%2&&(t.hexPad==="left"?e="0"+e:t.hexPad==="right"?e+="0":Ze.throwArgumentError("hex data is odd-length","value",r));const i=[];for(let s=0;s<e.length;s+=2)i.push(parseInt(e.substring(s,s+2),16));return oo(new Uint8Array(i))}return mo(r)?oo(new Uint8Array(r)):Ze.throwArgumentError("invalid arrayify value","value",r)}function v5(r){const t=r.map(s=>Ye(s)),e=t.reduce((s,a)=>s+a.length,0),i=new Uint8Array(e);return t.reduce((s,a)=>(i.set(a,s),s+a.length),0),oo(i)}function y5(r,t){r=Ye(r),r.length>t&&Ze.throwArgumentError("value out of range","value",arguments[0]);const e=new Uint8Array(t);return e.set(r,t-r.length),oo(e)}function ii(r,t){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||t&&r.length!==2+2*t)}const Rh="0123456789abcdef";function Pr(r,t){if(t||(t={}),typeof r=="number"){Ze.checkSafeUint53(r,"invalid hexlify value");let e="";for(;r;)e=Rh[r&15]+e,r=Math.floor(r/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(t.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),sg(r))return r.toHexString();if(ii(r))return r.length%2&&(t.hexPad==="left"?r="0x0"+r.substring(2):t.hexPad==="right"?r+="0":Ze.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(mo(r)){let e="0x";for(let i=0;i<r.length;i++){let s=r[i];e+=Rh[(s&240)>>4]+Rh[s&15]}return e}return Ze.throwArgumentError("invalid hexlify value","value",r)}function w5(r){if(typeof r!="string")r=Pr(r);else if(!ii(r)||r.length%2)return null;return(r.length-2)/2}function zd(r,t,e){return typeof r!="string"?r=Pr(r):(!ii(r)||r.length%2)&&Ze.throwArgumentError("invalid hexData","value",r),t=2+2*t,e!=null?"0x"+r.substring(t,2+2*e):"0x"+r.substring(t)}function nn(r,t){for(typeof r!="string"?r=Pr(r):ii(r)||Ze.throwArgumentError("invalid hex string","value",r),r.length>2*t+2&&Ze.throwArgumentError("value out of range","value",arguments[1]);r.length<2*t+2;)r="0x0"+r.substring(2);return r}function og(r){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(m5(r)){let e=Ye(r);e.length===64?(t.v=27+(e[32]>>7),e[32]&=127,t.r=Pr(e.slice(0,32)),t.s=Pr(e.slice(32,64))):e.length===65?(t.r=Pr(e.slice(0,32)),t.s=Pr(e.slice(32,64)),t.v=e[64]):Ze.throwArgumentError("invalid signature string","signature",r),t.v<27&&(t.v===0||t.v===1?t.v+=27:Ze.throwArgumentError("signature invalid v byte","signature",r)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(e[32]|=128),t._vs=Pr(e.slice(32,64))}else{if(t.r=r.r,t.s=r.s,t.v=r.v,t.recoveryParam=r.recoveryParam,t._vs=r._vs,t._vs!=null){const s=y5(Ye(t._vs),32);t._vs=Pr(s);const a=s[0]>=128?1:0;t.recoveryParam==null?t.recoveryParam=a:t.recoveryParam!==a&&Ze.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),s[0]&=127;const u=Pr(s);t.s==null?t.s=u:t.s!==u&&Ze.throwArgumentError("signature v mismatch _vs","signature",r)}if(t.recoveryParam==null)t.v==null?Ze.throwArgumentError("signature missing v and recoveryParam","signature",r):t.v===0||t.v===1?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(t.v==null)t.v=27+t.recoveryParam;else{const s=t.v===0||t.v===1?t.v:1-t.v%2;t.recoveryParam!==s&&Ze.throwArgumentError("signature recoveryParam mismatch v","signature",r)}t.r==null||!ii(t.r)?Ze.throwArgumentError("signature missing or invalid r","signature",r):t.r=nn(t.r,32),t.s==null||!ii(t.s)?Ze.throwArgumentError("signature missing or invalid s","signature",r):t.s=nn(t.s,32);const e=Ye(t.s);e[0]>=128&&Ze.throwArgumentError("signature s out of range","signature",r),t.recoveryParam&&(e[0]|=128);const i=Pr(e);t._vs&&(ii(t._vs)||Ze.throwArgumentError("signature invalid _vs","signature",r),t._vs=nn(t._vs,32)),t._vs==null?t._vs=i:t._vs!==i&&Ze.throwArgumentError("signature _vs mismatch v and s","signature",r)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Kl(r){return"0x"+f5.keccak_256(Ye(r))}var ag={exports:{}},b5={},_5=Object.freeze({__proto__:null,default:b5}),E5=l5(_5);(function(r){(function(t,e){function i(h,y){if(!h)throw new Error(y||"Assertion failed")}function s(h,y){h.super_=y;var b=function(){};b.prototype=y.prototype,h.prototype=new b,h.prototype.constructor=h}function a(h,y,b){if(a.isBN(h))return h;this.negative=0,this.words=null,this.length=0,this.red=null,h!==null&&((y==="le"||y==="be")&&(b=y,y=10),this._init(h||0,y||10,b||"be"))}typeof t=="object"?t.exports=a:e.BN=a,a.BN=a,a.wordSize=26;var u;try{typeof window<"u"&&typeof window.Buffer<"u"?u=window.Buffer:u=E5.Buffer}catch{}a.isBN=function(h){return h instanceof a?!0:h!==null&&typeof h=="object"&&h.constructor.wordSize===a.wordSize&&Array.isArray(h.words)},a.max=function(h,y){return h.cmp(y)>0?h:y},a.min=function(h,y){return h.cmp(y)<0?h:y},a.prototype._init=function(h,y,b){if(typeof h=="number")return this._initNumber(h,y,b);if(typeof h=="object")return this._initArray(h,y,b);y==="hex"&&(y=16),i(y===(y|0)&&y>=2&&y<=36),h=h.toString().replace(/\s+/g,"");var M=0;h[0]==="-"&&(M++,this.negative=1),M<h.length&&(y===16?this._parseHex(h,M,b):(this._parseBase(h,y,M),b==="le"&&this._initArray(this.toArray(),y,b)))},a.prototype._initNumber=function(h,y,b){h<0&&(this.negative=1,h=-h),h<67108864?(this.words=[h&67108863],this.length=1):h<4503599627370496?(this.words=[h&67108863,h/67108864&67108863],this.length=2):(i(h<9007199254740992),this.words=[h&67108863,h/67108864&67108863,1],this.length=3),b==="le"&&this._initArray(this.toArray(),y,b)},a.prototype._initArray=function(h,y,b){if(i(typeof h.length=="number"),h.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(h.length/3),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var C,R,j=0;if(b==="be")for(M=h.length-1,C=0;M>=0;M-=3)R=h[M]|h[M-1]<<8|h[M-2]<<16,this.words[C]|=R<<j&67108863,this.words[C+1]=R>>>26-j&67108863,j+=24,j>=26&&(j-=26,C++);else if(b==="le")for(M=0,C=0;M<h.length;M+=3)R=h[M]|h[M+1]<<8|h[M+2]<<16,this.words[C]|=R<<j&67108863,this.words[C+1]=R>>>26-j&67108863,j+=24,j>=26&&(j-=26,C++);return this._strip()};function l(h,y){var b=h.charCodeAt(y);if(b>=48&&b<=57)return b-48;if(b>=65&&b<=70)return b-55;if(b>=97&&b<=102)return b-87;i(!1,"Invalid character in "+h)}function d(h,y,b){var M=l(h,b);return b-1>=y&&(M|=l(h,b-1)<<4),M}a.prototype._parseHex=function(h,y,b){this.length=Math.ceil((h.length-y)/6),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var C=0,R=0,j;if(b==="be")for(M=h.length-1;M>=y;M-=2)j=d(h,y,M)<<C,this.words[R]|=j&67108863,C>=18?(C-=18,R+=1,this.words[R]|=j>>>26):C+=8;else{var I=h.length-y;for(M=I%2===0?y+1:y;M<h.length;M+=2)j=d(h,y,M)<<C,this.words[R]|=j&67108863,C>=18?(C-=18,R+=1,this.words[R]|=j>>>26):C+=8}this._strip()};function f(h,y,b,M){for(var C=0,R=0,j=Math.min(h.length,b),I=y;I<j;I++){var g=h.charCodeAt(I)-48;C*=M,g>=49?R=g-49+10:g>=17?R=g-17+10:R=g,i(g>=0&&R<M,"Invalid character"),C+=R}return C}a.prototype._parseBase=function(h,y,b){this.words=[0],this.length=1;for(var M=0,C=1;C<=67108863;C*=y)M++;M--,C=C/y|0;for(var R=h.length-b,j=R%M,I=Math.min(R,R-j)+b,g=0,N=b;N<I;N+=M)g=f(h,N,N+M,y),this.imuln(C),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(j!==0){var it=1;for(g=f(h,N,h.length,y),N=0;N<j;N++)it*=y;this.imuln(it),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},a.prototype.copy=function(h){h.words=new Array(this.length);for(var y=0;y<this.length;y++)h.words[y]=this.words[y];h.length=this.length,h.negative=this.negative,h.red=this.red};function w(h,y){h.words=y.words,h.length=y.length,h.negative=y.negative,h.red=y.red}if(a.prototype._move=function(h){w(h,this)},a.prototype.clone=function(){var h=new a(null);return this.copy(h),h},a.prototype._expand=function(h){for(;this.length<h;)this.words[this.length++]=0;return this},a.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},a.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=E}catch{a.prototype.inspect=E}else a.prototype.inspect=E;function E(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var S=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],D=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],P=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(h,y){h=h||10,y=y|0||1;var b;if(h===16||h==="hex"){b="";for(var M=0,C=0,R=0;R<this.length;R++){var j=this.words[R],I=((j<<M|C)&16777215).toString(16);C=j>>>24-M&16777215,M+=2,M>=26&&(M-=26,R--),C!==0||R!==this.length-1?b=S[6-I.length]+I+b:b=I+b}for(C!==0&&(b=C.toString(16)+b);b.length%y!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}if(h===(h|0)&&h>=2&&h<=36){var g=D[h],N=P[h];b="";var it=this.clone();for(it.negative=0;!it.isZero();){var lt=it.modrn(N).toString(h);it=it.idivn(N),it.isZero()?b=lt+b:b=S[g-lt.length]+lt+b}for(this.isZero()&&(b="0"+b);b.length%y!==0;)b="0"+b;return this.negative!==0&&(b="-"+b),b}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var h=this.words[0];return this.length===2?h+=this.words[1]*67108864:this.length===3&&this.words[2]===1?h+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-h:h},a.prototype.toJSON=function(){return this.toString(16,2)},u&&(a.prototype.toBuffer=function(h,y){return this.toArrayLike(u,h,y)}),a.prototype.toArray=function(h,y){return this.toArrayLike(Array,h,y)};var Y=function(h,y){return h.allocUnsafe?h.allocUnsafe(y):new h(y)};a.prototype.toArrayLike=function(h,y,b){this._strip();var M=this.byteLength(),C=b||Math.max(1,M);i(M<=C,"byte array longer than desired length"),i(C>0,"Requested array length <= 0");var R=Y(h,C),j=y==="le"?"LE":"BE";return this["_toArrayLike"+j](R,M),R},a.prototype._toArrayLikeLE=function(h,y){for(var b=0,M=0,C=0,R=0;C<this.length;C++){var j=this.words[C]<<R|M;h[b++]=j&255,b<h.length&&(h[b++]=j>>8&255),b<h.length&&(h[b++]=j>>16&255),R===6?(b<h.length&&(h[b++]=j>>24&255),M=0,R=0):(M=j>>>24,R+=2)}if(b<h.length)for(h[b++]=M;b<h.length;)h[b++]=0},a.prototype._toArrayLikeBE=function(h,y){for(var b=h.length-1,M=0,C=0,R=0;C<this.length;C++){var j=this.words[C]<<R|M;h[b--]=j&255,b>=0&&(h[b--]=j>>8&255),b>=0&&(h[b--]=j>>16&255),R===6?(b>=0&&(h[b--]=j>>24&255),M=0,R=0):(M=j>>>24,R+=2)}if(b>=0)for(h[b--]=M;b>=0;)h[b--]=0},Math.clz32?a.prototype._countBits=function(h){return 32-Math.clz32(h)}:a.prototype._countBits=function(h){var y=h,b=0;return y>=4096&&(b+=13,y>>>=13),y>=64&&(b+=7,y>>>=7),y>=8&&(b+=4,y>>>=4),y>=2&&(b+=2,y>>>=2),b+y},a.prototype._zeroBits=function(h){if(h===0)return 26;var y=h,b=0;return y&8191||(b+=13,y>>>=13),y&127||(b+=7,y>>>=7),y&15||(b+=4,y>>>=4),y&3||(b+=2,y>>>=2),y&1||b++,b},a.prototype.bitLength=function(){var h=this.words[this.length-1],y=this._countBits(h);return(this.length-1)*26+y};function G(h){for(var y=new Array(h.bitLength()),b=0;b<y.length;b++){var M=b/26|0,C=b%26;y[b]=h.words[M]>>>C&1}return y}a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var h=0,y=0;y<this.length;y++){var b=this._zeroBits(this.words[y]);if(h+=b,b!==26)break}return h},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(h){return this.negative!==0?this.abs().inotn(h).iaddn(1):this.clone()},a.prototype.fromTwos=function(h){return this.testn(h-1)?this.notn(h).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return this.negative!==0},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(h){for(;this.length<h.length;)this.words[this.length++]=0;for(var y=0;y<h.length;y++)this.words[y]=this.words[y]|h.words[y];return this._strip()},a.prototype.ior=function(h){return i((this.negative|h.negative)===0),this.iuor(h)},a.prototype.or=function(h){return this.length>h.length?this.clone().ior(h):h.clone().ior(this)},a.prototype.uor=function(h){return this.length>h.length?this.clone().iuor(h):h.clone().iuor(this)},a.prototype.iuand=function(h){var y;this.length>h.length?y=h:y=this;for(var b=0;b<y.length;b++)this.words[b]=this.words[b]&h.words[b];return this.length=y.length,this._strip()},a.prototype.iand=function(h){return i((this.negative|h.negative)===0),this.iuand(h)},a.prototype.and=function(h){return this.length>h.length?this.clone().iand(h):h.clone().iand(this)},a.prototype.uand=function(h){return this.length>h.length?this.clone().iuand(h):h.clone().iuand(this)},a.prototype.iuxor=function(h){var y,b;this.length>h.length?(y=this,b=h):(y=h,b=this);for(var M=0;M<b.length;M++)this.words[M]=y.words[M]^b.words[M];if(this!==y)for(;M<y.length;M++)this.words[M]=y.words[M];return this.length=y.length,this._strip()},a.prototype.ixor=function(h){return i((this.negative|h.negative)===0),this.iuxor(h)},a.prototype.xor=function(h){return this.length>h.length?this.clone().ixor(h):h.clone().ixor(this)},a.prototype.uxor=function(h){return this.length>h.length?this.clone().iuxor(h):h.clone().iuxor(this)},a.prototype.inotn=function(h){i(typeof h=="number"&&h>=0);var y=Math.ceil(h/26)|0,b=h%26;this._expand(y),b>0&&y--;for(var M=0;M<y;M++)this.words[M]=~this.words[M]&67108863;return b>0&&(this.words[M]=~this.words[M]&67108863>>26-b),this._strip()},a.prototype.notn=function(h){return this.clone().inotn(h)},a.prototype.setn=function(h,y){i(typeof h=="number"&&h>=0);var b=h/26|0,M=h%26;return this._expand(b+1),y?this.words[b]=this.words[b]|1<<M:this.words[b]=this.words[b]&~(1<<M),this._strip()},a.prototype.iadd=function(h){var y;if(this.negative!==0&&h.negative===0)return this.negative=0,y=this.isub(h),this.negative^=1,this._normSign();if(this.negative===0&&h.negative!==0)return h.negative=0,y=this.isub(h),h.negative=1,y._normSign();var b,M;this.length>h.length?(b=this,M=h):(b=h,M=this);for(var C=0,R=0;R<M.length;R++)y=(b.words[R]|0)+(M.words[R]|0)+C,this.words[R]=y&67108863,C=y>>>26;for(;C!==0&&R<b.length;R++)y=(b.words[R]|0)+C,this.words[R]=y&67108863,C=y>>>26;if(this.length=b.length,C!==0)this.words[this.length]=C,this.length++;else if(b!==this)for(;R<b.length;R++)this.words[R]=b.words[R];return this},a.prototype.add=function(h){var y;return h.negative!==0&&this.negative===0?(h.negative=0,y=this.sub(h),h.negative^=1,y):h.negative===0&&this.negative!==0?(this.negative=0,y=h.sub(this),this.negative=1,y):this.length>h.length?this.clone().iadd(h):h.clone().iadd(this)},a.prototype.isub=function(h){if(h.negative!==0){h.negative=0;var y=this.iadd(h);return h.negative=1,y._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(h),this.negative=1,this._normSign();var b=this.cmp(h);if(b===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,C;b>0?(M=this,C=h):(M=h,C=this);for(var R=0,j=0;j<C.length;j++)y=(M.words[j]|0)-(C.words[j]|0)+R,R=y>>26,this.words[j]=y&67108863;for(;R!==0&&j<M.length;j++)y=(M.words[j]|0)+R,R=y>>26,this.words[j]=y&67108863;if(R===0&&j<M.length&&M!==this)for(;j<M.length;j++)this.words[j]=M.words[j];return this.length=Math.max(this.length,j),M!==this&&(this.negative=1),this._strip()},a.prototype.sub=function(h){return this.clone().isub(h)};function tt(h,y,b){b.negative=y.negative^h.negative;var M=h.length+y.length|0;b.length=M,M=M-1|0;var C=h.words[0]|0,R=y.words[0]|0,j=C*R,I=j&67108863,g=j/67108864|0;b.words[0]=I;for(var N=1;N<M;N++){for(var it=g>>>26,lt=g&67108863,_=Math.min(N,y.length-1),Z=Math.max(0,N-h.length+1);Z<=_;Z++){var U=N-Z|0;C=h.words[U]|0,R=y.words[Z]|0,j=C*R+lt,it+=j/67108864|0,lt=j&67108863}b.words[N]=lt|0,g=it|0}return g!==0?b.words[N]=g|0:b.length--,b._strip()}var K=function(h,y,b){var M=h.words,C=y.words,R=b.words,j=0,I,g,N,it=M[0]|0,lt=it&8191,_=it>>>13,Z=M[1]|0,U=Z&8191,L=Z>>>13,k=M[2]|0,p=k&8191,F=k>>>13,et=M[3]|0,ut=et&8191,at=et>>>13,Mt=M[4]|0,Pt=Mt&8191,It=Mt>>>13,Ee=M[5]|0,$t=Ee&8191,xt=Ee>>>13,Bt=M[6]|0,_t=Bt&8191,Et=Bt>>>13,Vt=M[7]|0,wt=Vt&8191,At=Vt>>>13,Ut=M[8]|0,bt=Ut&8191,Ct=Ut>>>13,Lt=M[9]|0,Ot=Lt&8191,Nt=Lt>>>13,se=C[0]|0,Tt=se&8191,Rt=se>>>13,Ke=C[1]|0,ce=Ke&8191,pe=Ke>>>13,Ve=C[2]|0,ye=Ve&8191,_e=Ve>>>13,Ar=C[3]|0,Gt=Ar&8191,zt=Ar>>>13,De=C[4]|0,Wt=De&8191,Kt=De>>>13,Ae=C[5]|0,Jt=Ae&8191,Xt=Ae>>>13,xe=C[6]|0,Zt=xe&8191,Yt=xe>>>13,Ce=C[7]|0,Qt=Ce&8191,qt=Ce>>>13,Te=C[8]|0,te=Te&8191,Pe=Te>>>13,xi=C[9]|0,Oe=xi&8191,le=xi>>>13;b.negative=h.negative^y.negative,b.length=19,I=Math.imul(lt,Tt),g=Math.imul(lt,Rt),g=g+Math.imul(_,Tt)|0,N=Math.imul(_,Rt);var oi=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(oi>>>26)|0,oi&=67108863,I=Math.imul(U,Tt),g=Math.imul(U,Rt),g=g+Math.imul(L,Tt)|0,N=Math.imul(L,Rt),I=I+Math.imul(lt,ce)|0,g=g+Math.imul(lt,pe)|0,g=g+Math.imul(_,ce)|0,N=N+Math.imul(_,pe)|0;var ai=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(ai>>>26)|0,ai&=67108863,I=Math.imul(p,Tt),g=Math.imul(p,Rt),g=g+Math.imul(F,Tt)|0,N=Math.imul(F,Rt),I=I+Math.imul(U,ce)|0,g=g+Math.imul(U,pe)|0,g=g+Math.imul(L,ce)|0,N=N+Math.imul(L,pe)|0,I=I+Math.imul(lt,ye)|0,g=g+Math.imul(lt,_e)|0,g=g+Math.imul(_,ye)|0,N=N+Math.imul(_,_e)|0;var ci=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(ci>>>26)|0,ci&=67108863,I=Math.imul(ut,Tt),g=Math.imul(ut,Rt),g=g+Math.imul(at,Tt)|0,N=Math.imul(at,Rt),I=I+Math.imul(p,ce)|0,g=g+Math.imul(p,pe)|0,g=g+Math.imul(F,ce)|0,N=N+Math.imul(F,pe)|0,I=I+Math.imul(U,ye)|0,g=g+Math.imul(U,_e)|0,g=g+Math.imul(L,ye)|0,N=N+Math.imul(L,_e)|0,I=I+Math.imul(lt,Gt)|0,g=g+Math.imul(lt,zt)|0,g=g+Math.imul(_,Gt)|0,N=N+Math.imul(_,zt)|0;var ui=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(ui>>>26)|0,ui&=67108863,I=Math.imul(Pt,Tt),g=Math.imul(Pt,Rt),g=g+Math.imul(It,Tt)|0,N=Math.imul(It,Rt),I=I+Math.imul(ut,ce)|0,g=g+Math.imul(ut,pe)|0,g=g+Math.imul(at,ce)|0,N=N+Math.imul(at,pe)|0,I=I+Math.imul(p,ye)|0,g=g+Math.imul(p,_e)|0,g=g+Math.imul(F,ye)|0,N=N+Math.imul(F,_e)|0,I=I+Math.imul(U,Gt)|0,g=g+Math.imul(U,zt)|0,g=g+Math.imul(L,Gt)|0,N=N+Math.imul(L,zt)|0,I=I+Math.imul(lt,Wt)|0,g=g+Math.imul(lt,Kt)|0,g=g+Math.imul(_,Wt)|0,N=N+Math.imul(_,Kt)|0;var hi=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(hi>>>26)|0,hi&=67108863,I=Math.imul($t,Tt),g=Math.imul($t,Rt),g=g+Math.imul(xt,Tt)|0,N=Math.imul(xt,Rt),I=I+Math.imul(Pt,ce)|0,g=g+Math.imul(Pt,pe)|0,g=g+Math.imul(It,ce)|0,N=N+Math.imul(It,pe)|0,I=I+Math.imul(ut,ye)|0,g=g+Math.imul(ut,_e)|0,g=g+Math.imul(at,ye)|0,N=N+Math.imul(at,_e)|0,I=I+Math.imul(p,Gt)|0,g=g+Math.imul(p,zt)|0,g=g+Math.imul(F,Gt)|0,N=N+Math.imul(F,zt)|0,I=I+Math.imul(U,Wt)|0,g=g+Math.imul(U,Kt)|0,g=g+Math.imul(L,Wt)|0,N=N+Math.imul(L,Kt)|0,I=I+Math.imul(lt,Jt)|0,g=g+Math.imul(lt,Xt)|0,g=g+Math.imul(_,Jt)|0,N=N+Math.imul(_,Xt)|0;var ar=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(ar>>>26)|0,ar&=67108863,I=Math.imul(_t,Tt),g=Math.imul(_t,Rt),g=g+Math.imul(Et,Tt)|0,N=Math.imul(Et,Rt),I=I+Math.imul($t,ce)|0,g=g+Math.imul($t,pe)|0,g=g+Math.imul(xt,ce)|0,N=N+Math.imul(xt,pe)|0,I=I+Math.imul(Pt,ye)|0,g=g+Math.imul(Pt,_e)|0,g=g+Math.imul(It,ye)|0,N=N+Math.imul(It,_e)|0,I=I+Math.imul(ut,Gt)|0,g=g+Math.imul(ut,zt)|0,g=g+Math.imul(at,Gt)|0,N=N+Math.imul(at,zt)|0,I=I+Math.imul(p,Wt)|0,g=g+Math.imul(p,Kt)|0,g=g+Math.imul(F,Wt)|0,N=N+Math.imul(F,Kt)|0,I=I+Math.imul(U,Jt)|0,g=g+Math.imul(U,Xt)|0,g=g+Math.imul(L,Jt)|0,N=N+Math.imul(L,Xt)|0,I=I+Math.imul(lt,Zt)|0,g=g+Math.imul(lt,Yt)|0,g=g+Math.imul(_,Zt)|0,N=N+Math.imul(_,Yt)|0;var qi=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(qi>>>26)|0,qi&=67108863,I=Math.imul(wt,Tt),g=Math.imul(wt,Rt),g=g+Math.imul(At,Tt)|0,N=Math.imul(At,Rt),I=I+Math.imul(_t,ce)|0,g=g+Math.imul(_t,pe)|0,g=g+Math.imul(Et,ce)|0,N=N+Math.imul(Et,pe)|0,I=I+Math.imul($t,ye)|0,g=g+Math.imul($t,_e)|0,g=g+Math.imul(xt,ye)|0,N=N+Math.imul(xt,_e)|0,I=I+Math.imul(Pt,Gt)|0,g=g+Math.imul(Pt,zt)|0,g=g+Math.imul(It,Gt)|0,N=N+Math.imul(It,zt)|0,I=I+Math.imul(ut,Wt)|0,g=g+Math.imul(ut,Kt)|0,g=g+Math.imul(at,Wt)|0,N=N+Math.imul(at,Kt)|0,I=I+Math.imul(p,Jt)|0,g=g+Math.imul(p,Xt)|0,g=g+Math.imul(F,Jt)|0,N=N+Math.imul(F,Xt)|0,I=I+Math.imul(U,Zt)|0,g=g+Math.imul(U,Yt)|0,g=g+Math.imul(L,Zt)|0,N=N+Math.imul(L,Yt)|0,I=I+Math.imul(lt,Qt)|0,g=g+Math.imul(lt,qt)|0,g=g+Math.imul(_,Qt)|0,N=N+Math.imul(_,qt)|0;var Xn=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,I=Math.imul(bt,Tt),g=Math.imul(bt,Rt),g=g+Math.imul(Ct,Tt)|0,N=Math.imul(Ct,Rt),I=I+Math.imul(wt,ce)|0,g=g+Math.imul(wt,pe)|0,g=g+Math.imul(At,ce)|0,N=N+Math.imul(At,pe)|0,I=I+Math.imul(_t,ye)|0,g=g+Math.imul(_t,_e)|0,g=g+Math.imul(Et,ye)|0,N=N+Math.imul(Et,_e)|0,I=I+Math.imul($t,Gt)|0,g=g+Math.imul($t,zt)|0,g=g+Math.imul(xt,Gt)|0,N=N+Math.imul(xt,zt)|0,I=I+Math.imul(Pt,Wt)|0,g=g+Math.imul(Pt,Kt)|0,g=g+Math.imul(It,Wt)|0,N=N+Math.imul(It,Kt)|0,I=I+Math.imul(ut,Jt)|0,g=g+Math.imul(ut,Xt)|0,g=g+Math.imul(at,Jt)|0,N=N+Math.imul(at,Xt)|0,I=I+Math.imul(p,Zt)|0,g=g+Math.imul(p,Yt)|0,g=g+Math.imul(F,Zt)|0,N=N+Math.imul(F,Yt)|0,I=I+Math.imul(U,Qt)|0,g=g+Math.imul(U,qt)|0,g=g+Math.imul(L,Qt)|0,N=N+Math.imul(L,qt)|0,I=I+Math.imul(lt,te)|0,g=g+Math.imul(lt,Pe)|0,g=g+Math.imul(_,te)|0,N=N+Math.imul(_,Pe)|0;var ji=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(ji>>>26)|0,ji&=67108863,I=Math.imul(Ot,Tt),g=Math.imul(Ot,Rt),g=g+Math.imul(Nt,Tt)|0,N=Math.imul(Nt,Rt),I=I+Math.imul(bt,ce)|0,g=g+Math.imul(bt,pe)|0,g=g+Math.imul(Ct,ce)|0,N=N+Math.imul(Ct,pe)|0,I=I+Math.imul(wt,ye)|0,g=g+Math.imul(wt,_e)|0,g=g+Math.imul(At,ye)|0,N=N+Math.imul(At,_e)|0,I=I+Math.imul(_t,Gt)|0,g=g+Math.imul(_t,zt)|0,g=g+Math.imul(Et,Gt)|0,N=N+Math.imul(Et,zt)|0,I=I+Math.imul($t,Wt)|0,g=g+Math.imul($t,Kt)|0,g=g+Math.imul(xt,Wt)|0,N=N+Math.imul(xt,Kt)|0,I=I+Math.imul(Pt,Jt)|0,g=g+Math.imul(Pt,Xt)|0,g=g+Math.imul(It,Jt)|0,N=N+Math.imul(It,Xt)|0,I=I+Math.imul(ut,Zt)|0,g=g+Math.imul(ut,Yt)|0,g=g+Math.imul(at,Zt)|0,N=N+Math.imul(at,Yt)|0,I=I+Math.imul(p,Qt)|0,g=g+Math.imul(p,qt)|0,g=g+Math.imul(F,Qt)|0,N=N+Math.imul(F,qt)|0,I=I+Math.imul(U,te)|0,g=g+Math.imul(U,Pe)|0,g=g+Math.imul(L,te)|0,N=N+Math.imul(L,Pe)|0,I=I+Math.imul(lt,Oe)|0,g=g+Math.imul(lt,le)|0,g=g+Math.imul(_,Oe)|0,N=N+Math.imul(_,le)|0;var Zn=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,I=Math.imul(Ot,ce),g=Math.imul(Ot,pe),g=g+Math.imul(Nt,ce)|0,N=Math.imul(Nt,pe),I=I+Math.imul(bt,ye)|0,g=g+Math.imul(bt,_e)|0,g=g+Math.imul(Ct,ye)|0,N=N+Math.imul(Ct,_e)|0,I=I+Math.imul(wt,Gt)|0,g=g+Math.imul(wt,zt)|0,g=g+Math.imul(At,Gt)|0,N=N+Math.imul(At,zt)|0,I=I+Math.imul(_t,Wt)|0,g=g+Math.imul(_t,Kt)|0,g=g+Math.imul(Et,Wt)|0,N=N+Math.imul(Et,Kt)|0,I=I+Math.imul($t,Jt)|0,g=g+Math.imul($t,Xt)|0,g=g+Math.imul(xt,Jt)|0,N=N+Math.imul(xt,Xt)|0,I=I+Math.imul(Pt,Zt)|0,g=g+Math.imul(Pt,Yt)|0,g=g+Math.imul(It,Zt)|0,N=N+Math.imul(It,Yt)|0,I=I+Math.imul(ut,Qt)|0,g=g+Math.imul(ut,qt)|0,g=g+Math.imul(at,Qt)|0,N=N+Math.imul(at,qt)|0,I=I+Math.imul(p,te)|0,g=g+Math.imul(p,Pe)|0,g=g+Math.imul(F,te)|0,N=N+Math.imul(F,Pe)|0,I=I+Math.imul(U,Oe)|0,g=g+Math.imul(U,le)|0,g=g+Math.imul(L,Oe)|0,N=N+Math.imul(L,le)|0;var ts=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(ts>>>26)|0,ts&=67108863,I=Math.imul(Ot,ye),g=Math.imul(Ot,_e),g=g+Math.imul(Nt,ye)|0,N=Math.imul(Nt,_e),I=I+Math.imul(bt,Gt)|0,g=g+Math.imul(bt,zt)|0,g=g+Math.imul(Ct,Gt)|0,N=N+Math.imul(Ct,zt)|0,I=I+Math.imul(wt,Wt)|0,g=g+Math.imul(wt,Kt)|0,g=g+Math.imul(At,Wt)|0,N=N+Math.imul(At,Kt)|0,I=I+Math.imul(_t,Jt)|0,g=g+Math.imul(_t,Xt)|0,g=g+Math.imul(Et,Jt)|0,N=N+Math.imul(Et,Xt)|0,I=I+Math.imul($t,Zt)|0,g=g+Math.imul($t,Yt)|0,g=g+Math.imul(xt,Zt)|0,N=N+Math.imul(xt,Yt)|0,I=I+Math.imul(Pt,Qt)|0,g=g+Math.imul(Pt,qt)|0,g=g+Math.imul(It,Qt)|0,N=N+Math.imul(It,qt)|0,I=I+Math.imul(ut,te)|0,g=g+Math.imul(ut,Pe)|0,g=g+Math.imul(at,te)|0,N=N+Math.imul(at,Pe)|0,I=I+Math.imul(p,Oe)|0,g=g+Math.imul(p,le)|0,g=g+Math.imul(F,Oe)|0,N=N+Math.imul(F,le)|0;var $i=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+($i>>>26)|0,$i&=67108863,I=Math.imul(Ot,Gt),g=Math.imul(Ot,zt),g=g+Math.imul(Nt,Gt)|0,N=Math.imul(Nt,zt),I=I+Math.imul(bt,Wt)|0,g=g+Math.imul(bt,Kt)|0,g=g+Math.imul(Ct,Wt)|0,N=N+Math.imul(Ct,Kt)|0,I=I+Math.imul(wt,Jt)|0,g=g+Math.imul(wt,Xt)|0,g=g+Math.imul(At,Jt)|0,N=N+Math.imul(At,Xt)|0,I=I+Math.imul(_t,Zt)|0,g=g+Math.imul(_t,Yt)|0,g=g+Math.imul(Et,Zt)|0,N=N+Math.imul(Et,Yt)|0,I=I+Math.imul($t,Qt)|0,g=g+Math.imul($t,qt)|0,g=g+Math.imul(xt,Qt)|0,N=N+Math.imul(xt,qt)|0,I=I+Math.imul(Pt,te)|0,g=g+Math.imul(Pt,Pe)|0,g=g+Math.imul(It,te)|0,N=N+Math.imul(It,Pe)|0,I=I+Math.imul(ut,Oe)|0,g=g+Math.imul(ut,le)|0,g=g+Math.imul(at,Oe)|0,N=N+Math.imul(at,le)|0;var On=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(On>>>26)|0,On&=67108863,I=Math.imul(Ot,Wt),g=Math.imul(Ot,Kt),g=g+Math.imul(Nt,Wt)|0,N=Math.imul(Nt,Kt),I=I+Math.imul(bt,Jt)|0,g=g+Math.imul(bt,Xt)|0,g=g+Math.imul(Ct,Jt)|0,N=N+Math.imul(Ct,Xt)|0,I=I+Math.imul(wt,Zt)|0,g=g+Math.imul(wt,Yt)|0,g=g+Math.imul(At,Zt)|0,N=N+Math.imul(At,Yt)|0,I=I+Math.imul(_t,Qt)|0,g=g+Math.imul(_t,qt)|0,g=g+Math.imul(Et,Qt)|0,N=N+Math.imul(Et,qt)|0,I=I+Math.imul($t,te)|0,g=g+Math.imul($t,Pe)|0,g=g+Math.imul(xt,te)|0,N=N+Math.imul(xt,Pe)|0,I=I+Math.imul(Pt,Oe)|0,g=g+Math.imul(Pt,le)|0,g=g+Math.imul(It,Oe)|0,N=N+Math.imul(It,le)|0;var Nn=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,I=Math.imul(Ot,Jt),g=Math.imul(Ot,Xt),g=g+Math.imul(Nt,Jt)|0,N=Math.imul(Nt,Xt),I=I+Math.imul(bt,Zt)|0,g=g+Math.imul(bt,Yt)|0,g=g+Math.imul(Ct,Zt)|0,N=N+Math.imul(Ct,Yt)|0,I=I+Math.imul(wt,Qt)|0,g=g+Math.imul(wt,qt)|0,g=g+Math.imul(At,Qt)|0,N=N+Math.imul(At,qt)|0,I=I+Math.imul(_t,te)|0,g=g+Math.imul(_t,Pe)|0,g=g+Math.imul(Et,te)|0,N=N+Math.imul(Et,Pe)|0,I=I+Math.imul($t,Oe)|0,g=g+Math.imul($t,le)|0,g=g+Math.imul(xt,Oe)|0,N=N+Math.imul(xt,le)|0;var Sr=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(Sr>>>26)|0,Sr&=67108863,I=Math.imul(Ot,Zt),g=Math.imul(Ot,Yt),g=g+Math.imul(Nt,Zt)|0,N=Math.imul(Nt,Yt),I=I+Math.imul(bt,Qt)|0,g=g+Math.imul(bt,qt)|0,g=g+Math.imul(Ct,Qt)|0,N=N+Math.imul(Ct,qt)|0,I=I+Math.imul(wt,te)|0,g=g+Math.imul(wt,Pe)|0,g=g+Math.imul(At,te)|0,N=N+Math.imul(At,Pe)|0,I=I+Math.imul(_t,Oe)|0,g=g+Math.imul(_t,le)|0,g=g+Math.imul(Et,Oe)|0,N=N+Math.imul(Et,le)|0;var es=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(es>>>26)|0,es&=67108863,I=Math.imul(Ot,Qt),g=Math.imul(Ot,qt),g=g+Math.imul(Nt,Qt)|0,N=Math.imul(Nt,qt),I=I+Math.imul(bt,te)|0,g=g+Math.imul(bt,Pe)|0,g=g+Math.imul(Ct,te)|0,N=N+Math.imul(Ct,Pe)|0,I=I+Math.imul(wt,Oe)|0,g=g+Math.imul(wt,le)|0,g=g+Math.imul(At,Oe)|0,N=N+Math.imul(At,le)|0;var rs=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(rs>>>26)|0,rs&=67108863,I=Math.imul(Ot,te),g=Math.imul(Ot,Pe),g=g+Math.imul(Nt,te)|0,N=Math.imul(Nt,Pe),I=I+Math.imul(bt,Oe)|0,g=g+Math.imul(bt,le)|0,g=g+Math.imul(Ct,Oe)|0,N=N+Math.imul(Ct,le)|0;var is=(j+I|0)+((g&8191)<<13)|0;j=(N+(g>>>13)|0)+(is>>>26)|0,is&=67108863,I=Math.imul(Ot,Oe),g=Math.imul(Ot,le),g=g+Math.imul(Nt,Oe)|0,N=Math.imul(Nt,le);var ns=(j+I|0)+((g&8191)<<13)|0;return j=(N+(g>>>13)|0)+(ns>>>26)|0,ns&=67108863,R[0]=oi,R[1]=ai,R[2]=ci,R[3]=ui,R[4]=hi,R[5]=ar,R[6]=qi,R[7]=Xn,R[8]=ji,R[9]=Zn,R[10]=ts,R[11]=$i,R[12]=On,R[13]=Nn,R[14]=Sr,R[15]=es,R[16]=rs,R[17]=is,R[18]=ns,j!==0&&(R[19]=j,b.length++),b};Math.imul||(K=tt);function V(h,y,b){b.negative=y.negative^h.negative,b.length=h.length+y.length;for(var M=0,C=0,R=0;R<b.length-1;R++){var j=C;C=0;for(var I=M&67108863,g=Math.min(R,y.length-1),N=Math.max(0,R-h.length+1);N<=g;N++){var it=R-N,lt=h.words[it]|0,_=y.words[N]|0,Z=lt*_,U=Z&67108863;j=j+(Z/67108864|0)|0,U=U+I|0,I=U&67108863,j=j+(U>>>26)|0,C+=j>>>26,j&=67108863}b.words[R]=I,M=j,j=C}return M!==0?b.words[R]=M:b.length--,b._strip()}function B(h,y,b){return V(h,y,b)}a.prototype.mulTo=function(h,y){var b,M=this.length+h.length;return this.length===10&&h.length===10?b=K(this,h,y):M<63?b=tt(this,h,y):M<1024?b=V(this,h,y):b=B(this,h,y),b},a.prototype.mul=function(h){var y=new a(null);return y.words=new Array(this.length+h.length),this.mulTo(h,y)},a.prototype.mulf=function(h){var y=new a(null);return y.words=new Array(this.length+h.length),B(this,h,y)},a.prototype.imul=function(h){return this.clone().mulTo(h,this)},a.prototype.imuln=function(h){var y=h<0;y&&(h=-h),i(typeof h=="number"),i(h<67108864);for(var b=0,M=0;M<this.length;M++){var C=(this.words[M]|0)*h,R=(C&67108863)+(b&67108863);b>>=26,b+=C/67108864|0,b+=R>>>26,this.words[M]=R&67108863}return b!==0&&(this.words[M]=b,this.length++),y?this.ineg():this},a.prototype.muln=function(h){return this.clone().imuln(h)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(h){var y=G(h);if(y.length===0)return new a(1);for(var b=this,M=0;M<y.length&&y[M]===0;M++,b=b.sqr());if(++M<y.length)for(var C=b.sqr();M<y.length;M++,C=C.sqr())y[M]!==0&&(b=b.mul(C));return b},a.prototype.iushln=function(h){i(typeof h=="number"&&h>=0);var y=h%26,b=(h-y)/26,M=67108863>>>26-y<<26-y,C;if(y!==0){var R=0;for(C=0;C<this.length;C++){var j=this.words[C]&M,I=(this.words[C]|0)-j<<y;this.words[C]=I|R,R=j>>>26-y}R&&(this.words[C]=R,this.length++)}if(b!==0){for(C=this.length-1;C>=0;C--)this.words[C+b]=this.words[C];for(C=0;C<b;C++)this.words[C]=0;this.length+=b}return this._strip()},a.prototype.ishln=function(h){return i(this.negative===0),this.iushln(h)},a.prototype.iushrn=function(h,y,b){i(typeof h=="number"&&h>=0);var M;y?M=(y-y%26)/26:M=0;var C=h%26,R=Math.min((h-C)/26,this.length),j=67108863^67108863>>>C<<C,I=b;if(M-=R,M=Math.max(0,M),I){for(var g=0;g<R;g++)I.words[g]=this.words[g];I.length=R}if(R!==0)if(this.length>R)for(this.length-=R,g=0;g<this.length;g++)this.words[g]=this.words[g+R];else this.words[0]=0,this.length=1;var N=0;for(g=this.length-1;g>=0&&(N!==0||g>=M);g--){var it=this.words[g]|0;this.words[g]=N<<26-C|it>>>C,N=it&j}return I&&N!==0&&(I.words[I.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(h,y,b){return i(this.negative===0),this.iushrn(h,y,b)},a.prototype.shln=function(h){return this.clone().ishln(h)},a.prototype.ushln=function(h){return this.clone().iushln(h)},a.prototype.shrn=function(h){return this.clone().ishrn(h)},a.prototype.ushrn=function(h){return this.clone().iushrn(h)},a.prototype.testn=function(h){i(typeof h=="number"&&h>=0);var y=h%26,b=(h-y)/26,M=1<<y;if(this.length<=b)return!1;var C=this.words[b];return!!(C&M)},a.prototype.imaskn=function(h){i(typeof h=="number"&&h>=0);var y=h%26,b=(h-y)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=b)return this;if(y!==0&&b++,this.length=Math.min(b,this.length),y!==0){var M=67108863^67108863>>>y<<y;this.words[this.length-1]&=M}return this._strip()},a.prototype.maskn=function(h){return this.clone().imaskn(h)},a.prototype.iaddn=function(h){return i(typeof h=="number"),i(h<67108864),h<0?this.isubn(-h):this.negative!==0?this.length===1&&(this.words[0]|0)<=h?(this.words[0]=h-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(h),this.negative=1,this):this._iaddn(h)},a.prototype._iaddn=function(h){this.words[0]+=h;for(var y=0;y<this.length&&this.words[y]>=67108864;y++)this.words[y]-=67108864,y===this.length-1?this.words[y+1]=1:this.words[y+1]++;return this.length=Math.max(this.length,y+1),this},a.prototype.isubn=function(h){if(i(typeof h=="number"),i(h<67108864),h<0)return this.iaddn(-h);if(this.negative!==0)return this.negative=0,this.iaddn(h),this.negative=1,this;if(this.words[0]-=h,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var y=0;y<this.length&&this.words[y]<0;y++)this.words[y]+=67108864,this.words[y+1]-=1;return this._strip()},a.prototype.addn=function(h){return this.clone().iaddn(h)},a.prototype.subn=function(h){return this.clone().isubn(h)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(h,y,b){var M=h.length+b,C;this._expand(M);var R,j=0;for(C=0;C<h.length;C++){R=(this.words[C+b]|0)+j;var I=(h.words[C]|0)*y;R-=I&67108863,j=(R>>26)-(I/67108864|0),this.words[C+b]=R&67108863}for(;C<this.length-b;C++)R=(this.words[C+b]|0)+j,j=R>>26,this.words[C+b]=R&67108863;if(j===0)return this._strip();for(i(j===-1),j=0,C=0;C<this.length;C++)R=-(this.words[C]|0)+j,j=R>>26,this.words[C]=R&67108863;return this.negative=1,this._strip()},a.prototype._wordDiv=function(h,y){var b=this.length-h.length,M=this.clone(),C=h,R=C.words[C.length-1]|0,j=this._countBits(R);b=26-j,b!==0&&(C=C.ushln(b),M.iushln(b),R=C.words[C.length-1]|0);var I=M.length-C.length,g;if(y!=="mod"){g=new a(null),g.length=I+1,g.words=new Array(g.length);for(var N=0;N<g.length;N++)g.words[N]=0}var it=M.clone()._ishlnsubmul(C,1,I);it.negative===0&&(M=it,g&&(g.words[I]=1));for(var lt=I-1;lt>=0;lt--){var _=(M.words[C.length+lt]|0)*67108864+(M.words[C.length+lt-1]|0);for(_=Math.min(_/R|0,67108863),M._ishlnsubmul(C,_,lt);M.negative!==0;)_--,M.negative=0,M._ishlnsubmul(C,1,lt),M.isZero()||(M.negative^=1);g&&(g.words[lt]=_)}return g&&g._strip(),M._strip(),y!=="div"&&b!==0&&M.iushrn(b),{div:g||null,mod:M}},a.prototype.divmod=function(h,y,b){if(i(!h.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var M,C,R;return this.negative!==0&&h.negative===0?(R=this.neg().divmod(h,y),y!=="mod"&&(M=R.div.neg()),y!=="div"&&(C=R.mod.neg(),b&&C.negative!==0&&C.iadd(h)),{div:M,mod:C}):this.negative===0&&h.negative!==0?(R=this.divmod(h.neg(),y),y!=="mod"&&(M=R.div.neg()),{div:M,mod:R.mod}):this.negative&h.negative?(R=this.neg().divmod(h.neg(),y),y!=="div"&&(C=R.mod.neg(),b&&C.negative!==0&&C.isub(h)),{div:R.div,mod:C}):h.length>this.length||this.cmp(h)<0?{div:new a(0),mod:this}:h.length===1?y==="div"?{div:this.divn(h.words[0]),mod:null}:y==="mod"?{div:null,mod:new a(this.modrn(h.words[0]))}:{div:this.divn(h.words[0]),mod:new a(this.modrn(h.words[0]))}:this._wordDiv(h,y)},a.prototype.div=function(h){return this.divmod(h,"div",!1).div},a.prototype.mod=function(h){return this.divmod(h,"mod",!1).mod},a.prototype.umod=function(h){return this.divmod(h,"mod",!0).mod},a.prototype.divRound=function(h){var y=this.divmod(h);if(y.mod.isZero())return y.div;var b=y.div.negative!==0?y.mod.isub(h):y.mod,M=h.ushrn(1),C=h.andln(1),R=b.cmp(M);return R<0||C===1&&R===0?y.div:y.div.negative!==0?y.div.isubn(1):y.div.iaddn(1)},a.prototype.modrn=function(h){var y=h<0;y&&(h=-h),i(h<=67108863);for(var b=(1<<26)%h,M=0,C=this.length-1;C>=0;C--)M=(b*M+(this.words[C]|0))%h;return y?-M:M},a.prototype.modn=function(h){return this.modrn(h)},a.prototype.idivn=function(h){var y=h<0;y&&(h=-h),i(h<=67108863);for(var b=0,M=this.length-1;M>=0;M--){var C=(this.words[M]|0)+b*67108864;this.words[M]=C/h|0,b=C%h}return this._strip(),y?this.ineg():this},a.prototype.divn=function(h){return this.clone().idivn(h)},a.prototype.egcd=function(h){i(h.negative===0),i(!h.isZero());var y=this,b=h.clone();y.negative!==0?y=y.umod(h):y=y.clone();for(var M=new a(1),C=new a(0),R=new a(0),j=new a(1),I=0;y.isEven()&&b.isEven();)y.iushrn(1),b.iushrn(1),++I;for(var g=b.clone(),N=y.clone();!y.isZero();){for(var it=0,lt=1;!(y.words[0]<)&&it<26;++it,lt<<=1);if(it>0)for(y.iushrn(it);it-- >0;)(M.isOdd()||C.isOdd())&&(M.iadd(g),C.isub(N)),M.iushrn(1),C.iushrn(1);for(var _=0,Z=1;!(b.words[0]&Z)&&_<26;++_,Z<<=1);if(_>0)for(b.iushrn(_);_-- >0;)(R.isOdd()||j.isOdd())&&(R.iadd(g),j.isub(N)),R.iushrn(1),j.iushrn(1);y.cmp(b)>=0?(y.isub(b),M.isub(R),C.isub(j)):(b.isub(y),R.isub(M),j.isub(C))}return{a:R,b:j,gcd:b.iushln(I)}},a.prototype._invmp=function(h){i(h.negative===0),i(!h.isZero());var y=this,b=h.clone();y.negative!==0?y=y.umod(h):y=y.clone();for(var M=new a(1),C=new a(0),R=b.clone();y.cmpn(1)>0&&b.cmpn(1)>0;){for(var j=0,I=1;!(y.words[0]&I)&&j<26;++j,I<<=1);if(j>0)for(y.iushrn(j);j-- >0;)M.isOdd()&&M.iadd(R),M.iushrn(1);for(var g=0,N=1;!(b.words[0]&N)&&g<26;++g,N<<=1);if(g>0)for(b.iushrn(g);g-- >0;)C.isOdd()&&C.iadd(R),C.iushrn(1);y.cmp(b)>=0?(y.isub(b),M.isub(C)):(b.isub(y),C.isub(M))}var it;return y.cmpn(1)===0?it=M:it=C,it.cmpn(0)<0&&it.iadd(h),it},a.prototype.gcd=function(h){if(this.isZero())return h.abs();if(h.isZero())return this.abs();var y=this.clone(),b=h.clone();y.negative=0,b.negative=0;for(var M=0;y.isEven()&&b.isEven();M++)y.iushrn(1),b.iushrn(1);do{for(;y.isEven();)y.iushrn(1);for(;b.isEven();)b.iushrn(1);var C=y.cmp(b);if(C<0){var R=y;y=b,b=R}else if(C===0||b.cmpn(1)===0)break;y.isub(b)}while(!0);return b.iushln(M)},a.prototype.invm=function(h){return this.egcd(h).a.umod(h)},a.prototype.isEven=function(){return(this.words[0]&1)===0},a.prototype.isOdd=function(){return(this.words[0]&1)===1},a.prototype.andln=function(h){return this.words[0]&h},a.prototype.bincn=function(h){i(typeof h=="number");var y=h%26,b=(h-y)/26,M=1<<y;if(this.length<=b)return this._expand(b+1),this.words[b]|=M,this;for(var C=M,R=b;C!==0&&R<this.length;R++){var j=this.words[R]|0;j+=C,C=j>>>26,j&=67108863,this.words[R]=j}return C!==0&&(this.words[R]=C,this.length++),this},a.prototype.isZero=function(){return this.length===1&&this.words[0]===0},a.prototype.cmpn=function(h){var y=h<0;if(this.negative!==0&&!y)return-1;if(this.negative===0&&y)return 1;this._strip();var b;if(this.length>1)b=1;else{y&&(h=-h),i(h<=67108863,"Number is too big");var M=this.words[0]|0;b=M===h?0:M<h?-1:1}return this.negative!==0?-b|0:b},a.prototype.cmp=function(h){if(this.negative!==0&&h.negative===0)return-1;if(this.negative===0&&h.negative!==0)return 1;var y=this.ucmp(h);return this.negative!==0?-y|0:y},a.prototype.ucmp=function(h){if(this.length>h.length)return 1;if(this.length<h.length)return-1;for(var y=0,b=this.length-1;b>=0;b--){var M=this.words[b]|0,C=h.words[b]|0;if(M!==C){M<C?y=-1:M>C&&(y=1);break}}return y},a.prototype.gtn=function(h){return this.cmpn(h)===1},a.prototype.gt=function(h){return this.cmp(h)===1},a.prototype.gten=function(h){return this.cmpn(h)>=0},a.prototype.gte=function(h){return this.cmp(h)>=0},a.prototype.ltn=function(h){return this.cmpn(h)===-1},a.prototype.lt=function(h){return this.cmp(h)===-1},a.prototype.lten=function(h){return this.cmpn(h)<=0},a.prototype.lte=function(h){return this.cmp(h)<=0},a.prototype.eqn=function(h){return this.cmpn(h)===0},a.prototype.eq=function(h){return this.cmp(h)===0},a.red=function(h){return new pt(h)},a.prototype.toRed=function(h){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),h.convertTo(this)._forceRed(h)},a.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(h){return this.red=h,this},a.prototype.forceRed=function(h){return i(!this.red,"Already a number in reduction context"),this._forceRed(h)},a.prototype.redAdd=function(h){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,h)},a.prototype.redIAdd=function(h){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,h)},a.prototype.redSub=function(h){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,h)},a.prototype.redISub=function(h){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,h)},a.prototype.redShl=function(h){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,h)},a.prototype.redMul=function(h){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.mul(this,h)},a.prototype.redIMul=function(h){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.imul(this,h)},a.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(h){return i(this.red&&!h.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,h)};var z={k256:null,p224:null,p192:null,p25519:null};function $(h,y){this.name=h,this.p=new a(y,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}$.prototype._tmp=function(){var h=new a(null);return h.words=new Array(Math.ceil(this.n/13)),h},$.prototype.ireduce=function(h){var y=h,b;do this.split(y,this.tmp),y=this.imulK(y),y=y.iadd(this.tmp),b=y.bitLength();while(b>this.n);var M=b<this.n?-1:y.ucmp(this.p);return M===0?(y.words[0]=0,y.length=1):M>0?y.isub(this.p):y.strip!==void 0?y.strip():y._strip(),y},$.prototype.split=function(h,y){h.iushrn(this.n,0,y)},$.prototype.imulK=function(h){return h.imul(this.k)};function v(){$.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(v,$),v.prototype.split=function(h,y){for(var b=4194303,M=Math.min(h.length,9),C=0;C<M;C++)y.words[C]=h.words[C];if(y.length=M,h.length<=9){h.words[0]=0,h.length=1;return}var R=h.words[9];for(y.words[y.length++]=R&b,C=10;C<h.length;C++){var j=h.words[C]|0;h.words[C-10]=(j&b)<<4|R>>>22,R=j}R>>>=22,h.words[C-10]=R,R===0&&h.length>10?h.length-=10:h.length-=9},v.prototype.imulK=function(h){h.words[h.length]=0,h.words[h.length+1]=0,h.length+=2;for(var y=0,b=0;b<h.length;b++){var M=h.words[b]|0;y+=M*977,h.words[b]=y&67108863,y=M*64+(y/67108864|0)}return h.words[h.length-1]===0&&(h.length--,h.words[h.length-1]===0&&h.length--),h};function T(){$.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(T,$);function nt(){$.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(nt,$);function ft(){$.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(ft,$),ft.prototype.imulK=function(h){for(var y=0,b=0;b<h.length;b++){var M=(h.words[b]|0)*19+y,C=M&67108863;M>>>=26,h.words[b]=C,y=M}return y!==0&&(h.words[h.length++]=y),h},a._prime=function(h){if(z[h])return z[h];var y;if(h==="k256")y=new v;else if(h==="p224")y=new T;else if(h==="p192")y=new nt;else if(h==="p25519")y=new ft;else throw new Error("Unknown prime "+h);return z[h]=y,y};function pt(h){if(typeof h=="string"){var y=a._prime(h);this.m=y.p,this.prime=y}else i(h.gtn(1),"modulus must be greater than 1"),this.m=h,this.prime=null}pt.prototype._verify1=function(h){i(h.negative===0,"red works only with positives"),i(h.red,"red works only with red numbers")},pt.prototype._verify2=function(h,y){i((h.negative|y.negative)===0,"red works only with positives"),i(h.red&&h.red===y.red,"red works only with red numbers")},pt.prototype.imod=function(h){return this.prime?this.prime.ireduce(h)._forceRed(this):(w(h,h.umod(this.m)._forceRed(this)),h)},pt.prototype.neg=function(h){return h.isZero()?h.clone():this.m.sub(h)._forceRed(this)},pt.prototype.add=function(h,y){this._verify2(h,y);var b=h.add(y);return b.cmp(this.m)>=0&&b.isub(this.m),b._forceRed(this)},pt.prototype.iadd=function(h,y){this._verify2(h,y);var b=h.iadd(y);return b.cmp(this.m)>=0&&b.isub(this.m),b},pt.prototype.sub=function(h,y){this._verify2(h,y);var b=h.sub(y);return b.cmpn(0)<0&&b.iadd(this.m),b._forceRed(this)},pt.prototype.isub=function(h,y){this._verify2(h,y);var b=h.isub(y);return b.cmpn(0)<0&&b.iadd(this.m),b},pt.prototype.shl=function(h,y){return this._verify1(h),this.imod(h.ushln(y))},pt.prototype.imul=function(h,y){return this._verify2(h,y),this.imod(h.imul(y))},pt.prototype.mul=function(h,y){return this._verify2(h,y),this.imod(h.mul(y))},pt.prototype.isqr=function(h){return this.imul(h,h.clone())},pt.prototype.sqr=function(h){return this.mul(h,h)},pt.prototype.sqrt=function(h){if(h.isZero())return h.clone();var y=this.m.andln(3);if(i(y%2===1),y===3){var b=this.m.add(new a(1)).iushrn(2);return this.pow(h,b)}for(var M=this.m.subn(1),C=0;!M.isZero()&&M.andln(1)===0;)C++,M.iushrn(1);i(!M.isZero());var R=new a(1).toRed(this),j=R.redNeg(),I=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new a(2*g*g).toRed(this);this.pow(g,I).cmp(j)!==0;)g.redIAdd(j);for(var N=this.pow(g,M),it=this.pow(h,M.addn(1).iushrn(1)),lt=this.pow(h,M),_=C;lt.cmp(R)!==0;){for(var Z=lt,U=0;Z.cmp(R)!==0;U++)Z=Z.redSqr();i(U<_);var L=this.pow(N,new a(1).iushln(_-U-1));it=it.redMul(L),N=L.redSqr(),lt=lt.redMul(N),_=U}return it},pt.prototype.invm=function(h){var y=h._invmp(this.m);return y.negative!==0?(y.negative=0,this.imod(y).redNeg()):this.imod(y)},pt.prototype.pow=function(h,y){if(y.isZero())return new a(1).toRed(this);if(y.cmpn(1)===0)return h.clone();var b=4,M=new Array(1<<b);M[0]=new a(1).toRed(this),M[1]=h;for(var C=2;C<M.length;C++)M[C]=this.mul(M[C-1],h);var R=M[0],j=0,I=0,g=y.bitLength()%26;for(g===0&&(g=26),C=y.length-1;C>=0;C--){for(var N=y.words[C],it=g-1;it>=0;it--){var lt=N>>it&1;if(R!==M[0]&&(R=this.sqr(R)),lt===0&&j===0){I=0;continue}j<<=1,j|=lt,I++,!(I!==b&&(C!==0||it!==0))&&(R=this.mul(R,M[j]),I=0,j=0)}g=26}return R},pt.prototype.convertTo=function(h){var y=h.umod(this.m);return y===h?y.clone():y},pt.prototype.convertFrom=function(h){var y=h.clone();return y.red=null,y},a.mont=function(h){return new mt(h)};function mt(h){pt.call(this,h),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(mt,pt),mt.prototype.convertTo=function(h){return this.imod(h.ushln(this.shift))},mt.prototype.convertFrom=function(h){var y=this.imod(h.mul(this.rinv));return y.red=null,y},mt.prototype.imul=function(h,y){if(h.isZero()||y.isZero())return h.words[0]=0,h.length=1,h;var b=h.imul(y),M=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),C=b.isub(M).iushrn(this.shift),R=C;return C.cmp(this.m)>=0?R=C.isub(this.m):C.cmpn(0)<0&&(R=C.iadd(this.m)),R._forceRed(this)},mt.prototype.mul=function(h,y){if(h.isZero()||y.isZero())return new a(0)._forceRed(this);var b=h.mul(y),M=b.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),C=b.isub(M).iushrn(this.shift),R=C;return C.cmp(this.m)>=0?R=C.isub(this.m):C.cmpn(0)<0&&(R=C.iadd(this.m)),R._forceRed(this)},mt.prototype.invm=function(h){var y=this.imod(h._invmp(this.m).mul(this.r2));return y._forceRed(this)}})(r,ig)})(ag);var ne=ag.exports;const cg="bignumber/5.7.0";var Vc=ne.BN;const Sn=new mr(cg),Th={},kd=9007199254740991;function A5(r){return r!=null&&(Fr.isBigNumber(r)||typeof r=="number"&&r%1===0||typeof r=="string"&&!!r.match(/^-?[0-9]+$/)||ii(r)||typeof r=="bigint"||mo(r))}let Hd=!1,Fr=class Fi{constructor(t,e){t!==Th&&Sn.throwError("cannot call constructor directly; use BigNumber.from",mr.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return $r(me(this).fromTwos(t))}toTwos(t){return $r(me(this).toTwos(t))}abs(){return this._hex[0]==="-"?Fi.from(this._hex.substring(1)):this}add(t){return $r(me(this).add(me(t)))}sub(t){return $r(me(this).sub(me(t)))}div(t){return Fi.from(t).isZero()&&wi("division-by-zero","div"),$r(me(this).div(me(t)))}mul(t){return $r(me(this).mul(me(t)))}mod(t){const e=me(t);return e.isNeg()&&wi("division-by-zero","mod"),$r(me(this).umod(e))}pow(t){const e=me(t);return e.isNeg()&&wi("negative-power","pow"),$r(me(this).pow(e))}and(t){const e=me(t);return(this.isNegative()||e.isNeg())&&wi("unbound-bitwise-result","and"),$r(me(this).and(e))}or(t){const e=me(t);return(this.isNegative()||e.isNeg())&&wi("unbound-bitwise-result","or"),$r(me(this).or(e))}xor(t){const e=me(t);return(this.isNegative()||e.isNeg())&&wi("unbound-bitwise-result","xor"),$r(me(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&wi("negative-width","mask"),$r(me(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&wi("negative-width","shl"),$r(me(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&wi("negative-width","shr"),$r(me(this).shrn(t))}eq(t){return me(this).eq(me(t))}lt(t){return me(this).lt(me(t))}lte(t){return me(this).lte(me(t))}gt(t){return me(this).gt(me(t))}gte(t){return me(this).gte(me(t))}isNegative(){return this._hex[0]==="-"}isZero(){return me(this).isZero()}toNumber(){try{return me(this).toNumber()}catch{wi("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Sn.throwError("this platform does not support BigInt",mr.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Hd||(Hd=!0,Sn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Sn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",mr.errors.UNEXPECTED_ARGUMENT,{}):Sn.throwError("BigNumber.toString does not accept parameters",mr.errors.UNEXPECTED_ARGUMENT,{})),me(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof Fi)return t;if(typeof t=="string")return t.match(/^-?0x[0-9a-f]+$/i)?new Fi(Th,na(t)):t.match(/^-?[0-9]+$/)?new Fi(Th,na(new Vc(t))):Sn.throwArgumentError("invalid BigNumber string","value",t);if(typeof t=="number")return t%1&&wi("underflow","BigNumber.from",t),(t>=kd||t<=-kd)&&wi("overflow","BigNumber.from",t),Fi.from(String(t));const e=t;if(typeof e=="bigint")return Fi.from(e.toString());if(mo(e))return Fi.from(Pr(e));if(e)if(e.toHexString){const i=e.toHexString();if(typeof i=="string")return Fi.from(i)}else{let i=e._hex;if(i==null&&e.type==="BigNumber"&&(i=e.hex),typeof i=="string"&&(ii(i)||i[0]==="-"&&ii(i.substring(1))))return Fi.from(i)}return Sn.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!!(t&&t._isBigNumber)}};function na(r){if(typeof r!="string")return na(r.toString(16));if(r[0]==="-")return r=r.substring(1),r[0]==="-"&&Sn.throwArgumentError("invalid hex","value",r),r=na(r),r==="0x00"?r:"-"+r;if(r.substring(0,2)!=="0x"&&(r="0x"+r),r==="0x")return"0x00";for(r.length%2&&(r="0x0"+r.substring(2));r.length>4&&r.substring(0,4)==="0x00";)r="0x"+r.substring(4);return r}function $r(r){return Fr.from(na(r))}function me(r){const t=Fr.from(r).toHexString();return t[0]==="-"?new Vc("-"+t.substring(3),16):new Vc(t.substring(2),16)}function wi(r,t,e){const i={fault:r,operation:t};return e!=null&&(i.value=e),Sn.throwError(r,mr.errors.NUMERIC_FAULT,i)}function S5(r){return new Vc(r,36).toString(16)}const Or=new mr(cg),Xo={},ug=Fr.from(0),hg=Fr.from(-1);function lg(r,t,e,i){const s={fault:t,operation:e};return i!==void 0&&(s.value=i),Or.throwError(r,mr.errors.NUMERIC_FAULT,s)}let Zo="0";for(;Zo.length<256;)Zo+=Zo;function Vl(r){if(typeof r!="number")try{r=Fr.from(r).toNumber()}catch{}return typeof r=="number"&&r>=0&&r<=256&&!(r%1)?"1"+Zo.substring(0,r):Or.throwArgumentError("invalid decimal size","decimals",r)}function Fh(r,t){t==null&&(t=0);const e=Vl(t);r=Fr.from(r);const i=r.lt(ug);i&&(r=r.mul(hg));let s=r.mod(e).toString();for(;s.length<e.length-1;)s="0"+s;s=s.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=r.div(e).toString();return e.length===1?r=a:r=a+"."+s,i&&(r="-"+r),r}function _n(r,t){t==null&&(t=0);const e=Vl(t);(typeof r!="string"||!r.match(/^-?[0-9.]+$/))&&Or.throwArgumentError("invalid decimal value","value",r);const i=r.substring(0,1)==="-";i&&(r=r.substring(1)),r==="."&&Or.throwArgumentError("missing value","value",r);const s=r.split(".");s.length>2&&Or.throwArgumentError("too many decimal points","value",r);let a=s[0],u=s[1];for(a||(a="0"),u||(u="0");u[u.length-1]==="0";)u=u.substring(0,u.length-1);for(u.length>e.length-1&&lg("fractional component exceeds decimals","underflow","parseFixed"),u===""&&(u="0");u.length<e.length-1;)u+="0";const l=Fr.from(a),d=Fr.from(u);let f=l.mul(e).add(d);return i&&(f=f.mul(hg)),f}let Uh=class bl{constructor(t,e,i,s){t!==Xo&&Or.throwError("cannot use FixedFormat constructor; use FixedFormat.from",mr.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=i,this.decimals=s,this.name=(e?"":"u")+"fixed"+String(i)+"x"+String(s),this._multiplier=Vl(s),Object.freeze(this)}static from(t){if(t instanceof bl)return t;typeof t=="number"&&(t=`fixed128x${t}`);let e=!0,i=128,s=18;if(typeof t=="string"){if(t!=="fixed")if(t==="ufixed")e=!1;else{const a=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);a||Or.throwArgumentError("invalid fixed format","format",t),e=a[1]!=="u",i=parseInt(a[2]),s=parseInt(a[3])}}else if(t){const a=(u,l,d)=>t[u]==null?d:(typeof t[u]!==l&&Or.throwArgumentError("invalid fixed format ("+u+" not "+l+")","format."+u,t[u]),t[u]);e=a("signed","boolean",e),i=a("width","number",i),s=a("decimals","number",s)}return i%8&&Or.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),s>80&&Or.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",s),new bl(Xo,e,i,s)}},fg=class Cr{constructor(t,e,i,s){t!==Xo&&Or.throwError("cannot use FixedNumber constructor; use FixedNumber.from",mr.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=s,this._hex=e,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&Or.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=_n(this._value,this.format.decimals),i=_n(t._value,t.format.decimals);return Cr.fromValue(e.add(i),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=_n(this._value,this.format.decimals),i=_n(t._value,t.format.decimals);return Cr.fromValue(e.sub(i),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=_n(this._value,this.format.decimals),i=_n(t._value,t.format.decimals);return Cr.fromValue(e.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=_n(this._value,this.format.decimals),i=_n(t._value,t.format.decimals);return Cr.fromValue(e.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");t.length===1&&t.push("0");let e=Cr.from(t[0],this.format);const i=!t[1].match(/^(0*)$/);return this.isNegative()&&i&&(e=e.subUnsafe(Kd.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");t.length===1&&t.push("0");let e=Cr.from(t[0],this.format);const i=!t[1].match(/^(0*)$/);return!this.isNegative()&&i&&(e=e.addUnsafe(Kd.toFormat(e.format))),e}round(t){t==null&&(t=0);const e=this.toString().split(".");if(e.length===1&&e.push("0"),(t<0||t>80||t%1)&&Or.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const i=Cr.from("1"+Zo.substring(0,t),this.format),s=I5.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(s).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(t){if(t==null)return this._hex;t%8&&Or.throwArgumentError("invalid byte width","width",t);const e=Fr.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return nn(e,t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return Cr.fromString(this._value,t)}static fromValue(t,e,i){return i==null&&e!=null&&!A5(e)&&(i=e,e=null),e==null&&(e=0),i==null&&(i="fixed"),Cr.fromString(Fh(t,e),Uh.from(i))}static fromString(t,e){e==null&&(e="fixed");const i=Uh.from(e),s=_n(t,i.decimals);!i.signed&&s.lt(ug)&&lg("unsigned value cannot be negative","overflow","value",t);let a=null;i.signed?a=s.toTwos(i.width).toHexString():(a=s.toHexString(),a=nn(a,i.width/8));const u=Fh(s,i.decimals);return new Cr(Xo,a,u,i)}static fromBytes(t,e){e==null&&(e="fixed");const i=Uh.from(e);if(Ye(t).length>i.width/8)throw new Error("overflow");let s=Fr.from(t);i.signed&&(s=s.fromTwos(i.width));const a=s.toTwos((i.signed?0:1)+i.width).toHexString(),u=Fh(s,i.decimals);return new Cr(Xo,a,u,i)}static from(t,e){if(typeof t=="string")return Cr.fromString(t,e);if(mo(t))return Cr.fromBytes(t,e);try{return Cr.fromValue(t,0,e)}catch(i){if(i.code!==mr.errors.INVALID_ARGUMENT)throw i}return Or.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!!(t&&t._isFixedNumber)}};const Kd=fg.from(1),I5=fg.from("0.5"),D5="strings/5.7.0",x5=new mr(D5);var Gc;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(Gc||(Gc={}));var Vd;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(Vd||(Vd={}));function Bh(r,t=Gc.current){t!=Gc.current&&(x5.checkNormalize(),r=r.normalize(t));let e=[];for(let i=0;i<r.length;i++){const s=r.charCodeAt(i);if(s<128)e.push(s);else if(s<2048)e.push(s>>6|192),e.push(s&63|128);else if((s&64512)==55296){i++;const a=r.charCodeAt(i);if(i>=r.length||(a&64512)!==56320)throw new Error("invalid utf-8 string");const u=65536+((s&1023)<<10)+(a&1023);e.push(u>>18|240),e.push(u>>12&63|128),e.push(u>>6&63|128),e.push(u&63|128)}else e.push(s>>12|224),e.push(s>>6&63|128),e.push(s&63|128)}return Ye(e)}function M5(r){if(r.length%4!==0)throw new Error("bad data");let t=[];for(let e=0;e<r.length;e+=4)t.push(parseInt(r.substring(e,e+4),16));return t}function Lh(r,t){t||(t=function(s){return[parseInt(s,16)]});let e=0,i={};return r.split(",").forEach(s=>{let a=s.split(":");e+=parseInt(a[0],16),i[e]=t(a[1])}),i}function Gd(r){let t=0;return r.split(",").map(e=>{let i=e.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let s=t+parseInt(i[0],16);return t=parseInt(i[1],16),{l:s,h:t}})}Gd("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(r=>parseInt(r,16)),Lh("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Lh("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Lh("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",M5),Gd("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function C5(r){r=atob(r);const t=[];for(let e=0;e<r.length;e++)t.push(r.charCodeAt(e));return Ye(t)}function dg(r,t){t==null&&(t=1);const e=[],i=e.forEach,s=function(a,u){i.call(a,function(l){u>0&&Array.isArray(l)?s(l,u-1):e.push(l)})};return s(r,t),e}function P5(r){const t={};for(let e=0;e<r.length;e++){const i=r[e];t[i[0]]=i[1]}return t}function O5(r){let t=0;function e(){return r[t++]<<8|r[t++]}let i=e(),s=1,a=[0,1];for(let z=1;z<i;z++)a.push(s+=e());let u=e(),l=t;t+=u;let d=0,f=0;function w(){return d==0&&(f=f<<8|r[t++],d=8),f>>--d&1}const E=31,S=Math.pow(2,E),D=S>>>1,P=D>>1,Y=S-1;let G=0;for(let z=0;z<E;z++)G=G<<1|w();let tt=[],K=0,V=S;for(;;){let z=Math.floor(((G-K+1)*s-1)/V),$=0,v=i;for(;v-$>1;){let ft=$+v>>>1;z<a[ft]?v=ft:$=ft}if($==0)break;tt.push($);let T=K+Math.floor(V*a[$]/s),nt=K+Math.floor(V*a[$+1]/s)-1;for(;!((T^nt)&D);)G=G<<1&Y|w(),T=T<<1&Y,nt=nt<<1&Y|1;for(;T&~nt&P;)G=G&D|G<<1&Y>>>1|w(),T=T<<1^D,nt=(nt^D)<<1|D|1;K=T,V=1+nt-T}let B=i-4;return tt.map(z=>{switch(z-B){case 3:return B+65792+(r[l++]<<16|r[l++]<<8|r[l++]);case 2:return B+256+(r[l++]<<8|r[l++]);case 1:return B+r[l++];default:return z-1}})}function N5(r){let t=0;return()=>r[t++]}function R5(r){return N5(O5(r))}function T5(r){return r&1?~r>>1:r>>1}function F5(r,t){let e=Array(r);for(let i=0;i<r;i++)e[i]=1+t();return e}function Wd(r,t){let e=Array(r);for(let i=0,s=-1;i<r;i++)e[i]=s+=1+t();return e}function U5(r,t){let e=Array(r);for(let i=0,s=0;i<r;i++)e[i]=s+=T5(t());return e}function Wc(r,t){let e=Wd(r(),r),i=r(),s=Wd(i,r),a=F5(i,r);for(let u=0;u<i;u++)for(let l=0;l<a[u];l++)e.push(s[u]+l);return t?e.map(u=>t[u]):e}function B5(r){let t=[];for(;;){let e=r();if(e==0)break;t.push(q5(e,r))}for(;;){let e=r()-1;if(e<0)break;t.push(j5(e,r))}return P5(dg(t))}function L5(r){let t=[];for(;;){let e=r();if(e==0)break;t.push(e)}return t}function pg(r,t,e){let i=Array(r).fill(void 0).map(()=>[]);for(let s=0;s<t;s++)U5(r,e).forEach((a,u)=>i[u].push(a));return i}function q5(r,t){let e=1+t(),i=t(),s=L5(t),a=pg(s.length,1+r,t);return dg(a.map((u,l)=>{const d=u[0],f=u.slice(1);return Array(s[l]).fill(void 0).map((w,E)=>{let S=E*i;return[d+E*e,f.map(D=>D+S)]})}))}function j5(r,t){let e=1+t();return pg(e,1+r,t).map(i=>[i[0],i.slice(1)])}function $5(r){let t=Wc(r).sort((i,s)=>i-s);return e();function e(){let i=[];for(;;){let f=Wc(r,t);if(f.length==0)break;i.push({set:new Set(f),node:e()})}i.sort((f,w)=>w.set.size-f.set.size);let s=r(),a=s%3;s=s/3|0;let u=!!(s&1);s>>=1;let l=s==1,d=s==2;return{branches:i,valid:a,fe0f:u,save:l,check:d}}}function z5(){return R5(C5("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Ac=z5();new Set(Wc(Ac)),new Set(Wc(Ac)),B5(Ac),$5(Ac);const k5=new Uint8Array(32);k5.fill(0);const H5=`Ethereum Signed Message:
|
|
22
|
+
`;function gg(r){return typeof r=="string"&&(r=Bh(r)),Kl(v5([Bh(H5),Bh(String(r.length)),r]))}const K5="address/5.7.0",Yo=new mr(K5);function Yd(r){ii(r,20)||Yo.throwArgumentError("invalid address","address",r),r=r.toLowerCase();const t=r.substring(2).split(""),e=new Uint8Array(40);for(let s=0;s<40;s++)e[s]=t[s].charCodeAt(0);const i=Ye(Kl(e));for(let s=0;s<40;s+=2)i[s>>1]>>4>=8&&(t[s]=t[s].toUpperCase()),(i[s>>1]&15)>=8&&(t[s+1]=t[s+1].toUpperCase());return"0x"+t.join("")}const V5=9007199254740991;function G5(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}const Gl={};for(let r=0;r<10;r++)Gl[String(r)]=String(r);for(let r=0;r<26;r++)Gl[String.fromCharCode(65+r)]=String(10+r);const Qd=Math.floor(G5(V5));function W5(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let t=r.split("").map(i=>Gl[i]).join("");for(;t.length>=Qd;){let i=t.substring(0,Qd);t=parseInt(i,10)%97+t.substring(i.length)}let e=String(98-parseInt(t,10)%97);for(;e.length<2;)e="0"+e;return e}function Y5(r){let t=null;if(typeof r!="string"&&Yo.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),t=Yd(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==r&&Yo.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==W5(r)&&Yo.throwArgumentError("bad icap checksum","address",r),t=S5(r.substring(4));t.length<40;)t="0"+t;t=Yd("0x"+t)}else Yo.throwArgumentError("invalid address","address",r);return t}function zo(r,t,e){Object.defineProperty(r,t,{enumerable:!0,value:e,writable:!1})}const Q5=new Uint8Array(32);Q5.fill(0),Fr.from(-1);const J5=Fr.from(0),X5=Fr.from(1);Fr.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),nn(X5.toHexString(),32),nn(J5.toHexString(),32);var Yi={},ve={},da=mg;function mg(r,t){if(!r)throw new Error(t||"Assertion failed")}mg.equal=function(r,t,e){if(r!=t)throw new Error(e||"Assertion failed: "+r+" != "+t)};var _l={exports:{}};typeof Object.create=="function"?_l.exports=function(r,t){t&&(r.super_=t,r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:_l.exports=function(r,t){if(t){r.super_=t;var e=function(){};e.prototype=t.prototype,r.prototype=new e,r.prototype.constructor=r}};var Z5=da,tA=_l.exports;ve.inherits=tA;function eA(r,t){return(r.charCodeAt(t)&64512)!==55296||t<0||t+1>=r.length?!1:(r.charCodeAt(t+1)&64512)===56320}function rA(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var e=[];if(typeof r=="string")if(t){if(t==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),s=0;s<r.length;s+=2)e.push(parseInt(r[s]+r[s+1],16))}else for(var i=0,s=0;s<r.length;s++){var a=r.charCodeAt(s);a<128?e[i++]=a:a<2048?(e[i++]=a>>6|192,e[i++]=a&63|128):eA(r,s)?(a=65536+((a&1023)<<10)+(r.charCodeAt(++s)&1023),e[i++]=a>>18|240,e[i++]=a>>12&63|128,e[i++]=a>>6&63|128,e[i++]=a&63|128):(e[i++]=a>>12|224,e[i++]=a>>6&63|128,e[i++]=a&63|128)}else for(s=0;s<r.length;s++)e[s]=r[s]|0;return e}ve.toArray=rA;function iA(r){for(var t="",e=0;e<r.length;e++)t+=yg(r[e].toString(16));return t}ve.toHex=iA;function vg(r){var t=r>>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return t>>>0}ve.htonl=vg;function nA(r,t){for(var e="",i=0;i<r.length;i++){var s=r[i];t==="little"&&(s=vg(s)),e+=wg(s.toString(16))}return e}ve.toHex32=nA;function yg(r){return r.length===1?"0"+r:r}ve.zero2=yg;function wg(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}ve.zero8=wg;function sA(r,t,e,i){var s=e-t;Z5(s%4===0);for(var a=new Array(s/4),u=0,l=t;u<a.length;u++,l+=4){var d;i==="big"?d=r[l]<<24|r[l+1]<<16|r[l+2]<<8|r[l+3]:d=r[l+3]<<24|r[l+2]<<16|r[l+1]<<8|r[l],a[u]=d>>>0}return a}ve.join32=sA;function oA(r,t){for(var e=new Array(r.length*4),i=0,s=0;i<r.length;i++,s+=4){var a=r[i];t==="big"?(e[s]=a>>>24,e[s+1]=a>>>16&255,e[s+2]=a>>>8&255,e[s+3]=a&255):(e[s+3]=a>>>24,e[s+2]=a>>>16&255,e[s+1]=a>>>8&255,e[s]=a&255)}return e}ve.split32=oA;function aA(r,t){return r>>>t|r<<32-t}ve.rotr32=aA;function cA(r,t){return r<<t|r>>>32-t}ve.rotl32=cA;function uA(r,t){return r+t>>>0}ve.sum32=uA;function hA(r,t,e){return r+t+e>>>0}ve.sum32_3=hA;function lA(r,t,e,i){return r+t+e+i>>>0}ve.sum32_4=lA;function fA(r,t,e,i,s){return r+t+e+i+s>>>0}ve.sum32_5=fA;function dA(r,t,e,i){var s=r[t],a=r[t+1],u=i+a>>>0,l=(u<i?1:0)+e+s;r[t]=l>>>0,r[t+1]=u}ve.sum64=dA;function pA(r,t,e,i){var s=t+i>>>0,a=(s<t?1:0)+r+e;return a>>>0}ve.sum64_hi=pA;function gA(r,t,e,i){var s=t+i;return s>>>0}ve.sum64_lo=gA;function mA(r,t,e,i,s,a,u,l){var d=0,f=t;f=f+i>>>0,d+=f<t?1:0,f=f+a>>>0,d+=f<a?1:0,f=f+l>>>0,d+=f<l?1:0;var w=r+e+s+u+d;return w>>>0}ve.sum64_4_hi=mA;function vA(r,t,e,i,s,a,u,l){var d=t+i+a+l;return d>>>0}ve.sum64_4_lo=vA;function yA(r,t,e,i,s,a,u,l,d,f){var w=0,E=t;E=E+i>>>0,w+=E<t?1:0,E=E+a>>>0,w+=E<a?1:0,E=E+l>>>0,w+=E<l?1:0,E=E+f>>>0,w+=E<f?1:0;var S=r+e+s+u+d+w;return S>>>0}ve.sum64_5_hi=yA;function wA(r,t,e,i,s,a,u,l,d,f){var w=t+i+a+l+f;return w>>>0}ve.sum64_5_lo=wA;function bA(r,t,e){var i=t<<32-e|r>>>e;return i>>>0}ve.rotr64_hi=bA;function _A(r,t,e){var i=r<<32-e|t>>>e;return i>>>0}ve.rotr64_lo=_A;function EA(r,t,e){return r>>>e}ve.shr64_hi=EA;function AA(r,t,e){var i=r<<32-e|t>>>e;return i>>>0}ve.shr64_lo=AA;var vo={},Jd=ve,SA=da;function Sc(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}vo.BlockHash=Sc,Sc.prototype.update=function(r,t){if(r=Jd.toArray(r,t),this.pending?this.pending=this.pending.concat(r):this.pending=r,this.pendingTotal+=r.length,this.pending.length>=this._delta8){r=this.pending;var e=r.length%this._delta8;this.pending=r.slice(r.length-e,r.length),this.pending.length===0&&(this.pending=null),r=Jd.join32(r,0,r.length-e,this.endian);for(var i=0;i<r.length;i+=this._delta32)this._update(r,i,i+this._delta32)}return this},Sc.prototype.digest=function(r){return this.update(this._pad()),SA(this.pending===null),this._digest(r)},Sc.prototype._pad=function(){var r=this.pendingTotal,t=this._delta8,e=t-(r+this.padLength)%t,i=new Array(e+this.padLength);i[0]=128;for(var s=1;s<e;s++)i[s]=0;if(r<<=3,this.endian==="big"){for(var a=8;a<this.padLength;a++)i[s++]=0;i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=r>>>24&255,i[s++]=r>>>16&255,i[s++]=r>>>8&255,i[s++]=r&255}else for(i[s++]=r&255,i[s++]=r>>>8&255,i[s++]=r>>>16&255,i[s++]=r>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,a=8;a<this.padLength;a++)i[s++]=0;return i};var to={},hn={},IA=ve,sn=IA.rotr32;function DA(r,t,e,i){if(r===0)return bg(t,e,i);if(r===1||r===3)return Eg(t,e,i);if(r===2)return _g(t,e,i)}hn.ft_1=DA;function bg(r,t,e){return r&t^~r&e}hn.ch32=bg;function _g(r,t,e){return r&t^r&e^t&e}hn.maj32=_g;function Eg(r,t,e){return r^t^e}hn.p32=Eg;function xA(r){return sn(r,2)^sn(r,13)^sn(r,22)}hn.s0_256=xA;function MA(r){return sn(r,6)^sn(r,11)^sn(r,25)}hn.s1_256=MA;function CA(r){return sn(r,7)^sn(r,18)^r>>>3}hn.g0_256=CA;function PA(r){return sn(r,17)^sn(r,19)^r>>>10}hn.g1_256=PA;var uo=ve,OA=vo,NA=hn,qh=uo.rotl32,ko=uo.sum32,RA=uo.sum32_5,TA=NA.ft_1,Ag=OA.BlockHash,FA=[1518500249,1859775393,2400959708,3395469782];function tn(){if(!(this instanceof tn))return new tn;Ag.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}uo.inherits(tn,Ag);var UA=tn;tn.blockSize=512,tn.outSize=160,tn.hmacStrength=80,tn.padLength=64,tn.prototype._update=function(r,t){for(var e=this.W,i=0;i<16;i++)e[i]=r[t+i];for(;i<e.length;i++)e[i]=qh(e[i-3]^e[i-8]^e[i-14]^e[i-16],1);var s=this.h[0],a=this.h[1],u=this.h[2],l=this.h[3],d=this.h[4];for(i=0;i<e.length;i++){var f=~~(i/20),w=RA(qh(s,5),TA(f,a,u,l),d,e[i],FA[f]);d=l,l=u,u=qh(a,30),a=s,s=w}this.h[0]=ko(this.h[0],s),this.h[1]=ko(this.h[1],a),this.h[2]=ko(this.h[2],u),this.h[3]=ko(this.h[3],l),this.h[4]=ko(this.h[4],d)},tn.prototype._digest=function(r){return r==="hex"?uo.toHex32(this.h,"big"):uo.split32(this.h,"big")};var ho=ve,BA=vo,yo=hn,LA=da,Ri=ho.sum32,qA=ho.sum32_4,jA=ho.sum32_5,$A=yo.ch32,zA=yo.maj32,kA=yo.s0_256,HA=yo.s1_256,KA=yo.g0_256,VA=yo.g1_256,Sg=BA.BlockHash,GA=[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];function en(){if(!(this instanceof en))return new en;Sg.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=GA,this.W=new Array(64)}ho.inherits(en,Sg);var Ig=en;en.blockSize=512,en.outSize=256,en.hmacStrength=192,en.padLength=64,en.prototype._update=function(r,t){for(var e=this.W,i=0;i<16;i++)e[i]=r[t+i];for(;i<e.length;i++)e[i]=qA(VA(e[i-2]),e[i-7],KA(e[i-15]),e[i-16]);var s=this.h[0],a=this.h[1],u=this.h[2],l=this.h[3],d=this.h[4],f=this.h[5],w=this.h[6],E=this.h[7];for(LA(this.k.length===e.length),i=0;i<e.length;i++){var S=jA(E,HA(d),$A(d,f,w),this.k[i],e[i]),D=Ri(kA(s),zA(s,a,u));E=w,w=f,f=d,d=Ri(l,S),l=u,u=a,a=s,s=Ri(S,D)}this.h[0]=Ri(this.h[0],s),this.h[1]=Ri(this.h[1],a),this.h[2]=Ri(this.h[2],u),this.h[3]=Ri(this.h[3],l),this.h[4]=Ri(this.h[4],d),this.h[5]=Ri(this.h[5],f),this.h[6]=Ri(this.h[6],w),this.h[7]=Ri(this.h[7],E)},en.prototype._digest=function(r){return r==="hex"?ho.toHex32(this.h,"big"):ho.split32(this.h,"big")};var El=ve,Dg=Ig;function In(){if(!(this instanceof In))return new In;Dg.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}El.inherits(In,Dg);var WA=In;In.blockSize=512,In.outSize=224,In.hmacStrength=192,In.padLength=64,In.prototype._digest=function(r){return r==="hex"?El.toHex32(this.h.slice(0,7),"big"):El.split32(this.h.slice(0,7),"big")};var Vr=ve,YA=vo,QA=da,on=Vr.rotr64_hi,an=Vr.rotr64_lo,xg=Vr.shr64_hi,Mg=Vr.shr64_lo,kn=Vr.sum64,jh=Vr.sum64_hi,$h=Vr.sum64_lo,JA=Vr.sum64_4_hi,XA=Vr.sum64_4_lo,ZA=Vr.sum64_5_hi,t8=Vr.sum64_5_lo,Cg=YA.BlockHash,e8=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Bi(){if(!(this instanceof Bi))return new Bi;Cg.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=e8,this.W=new Array(160)}Vr.inherits(Bi,Cg);var Pg=Bi;Bi.blockSize=1024,Bi.outSize=512,Bi.hmacStrength=192,Bi.padLength=128,Bi.prototype._prepareBlock=function(r,t){for(var e=this.W,i=0;i<32;i++)e[i]=r[t+i];for(;i<e.length;i+=2){var s=f8(e[i-4],e[i-3]),a=d8(e[i-4],e[i-3]),u=e[i-14],l=e[i-13],d=h8(e[i-30],e[i-29]),f=l8(e[i-30],e[i-29]),w=e[i-32],E=e[i-31];e[i]=JA(s,a,u,l,d,f,w,E),e[i+1]=XA(s,a,u,l,d,f,w,E)}},Bi.prototype._update=function(r,t){this._prepareBlock(r,t);var e=this.W,i=this.h[0],s=this.h[1],a=this.h[2],u=this.h[3],l=this.h[4],d=this.h[5],f=this.h[6],w=this.h[7],E=this.h[8],S=this.h[9],D=this.h[10],P=this.h[11],Y=this.h[12],G=this.h[13],tt=this.h[14],K=this.h[15];QA(this.k.length===e.length);for(var V=0;V<e.length;V+=2){var B=tt,z=K,$=c8(E,S),v=u8(E,S),T=r8(E,S,D,P,Y),nt=i8(E,S,D,P,Y,G),ft=this.k[V],pt=this.k[V+1],mt=e[V],h=e[V+1],y=ZA(B,z,$,v,T,nt,ft,pt,mt,h),b=t8(B,z,$,v,T,nt,ft,pt,mt,h);B=o8(i,s),z=a8(i,s),$=n8(i,s,a,u,l),v=s8(i,s,a,u,l,d);var M=jh(B,z,$,v),C=$h(B,z,$,v);tt=Y,K=G,Y=D,G=P,D=E,P=S,E=jh(f,w,y,b),S=$h(w,w,y,b),f=l,w=d,l=a,d=u,a=i,u=s,i=jh(y,b,M,C),s=$h(y,b,M,C)}kn(this.h,0,i,s),kn(this.h,2,a,u),kn(this.h,4,l,d),kn(this.h,6,f,w),kn(this.h,8,E,S),kn(this.h,10,D,P),kn(this.h,12,Y,G),kn(this.h,14,tt,K)},Bi.prototype._digest=function(r){return r==="hex"?Vr.toHex32(this.h,"big"):Vr.split32(this.h,"big")};function r8(r,t,e,i,s){var a=r&e^~r&s;return a<0&&(a+=4294967296),a}function i8(r,t,e,i,s,a){var u=t&i^~t&a;return u<0&&(u+=4294967296),u}function n8(r,t,e,i,s){var a=r&e^r&s^e&s;return a<0&&(a+=4294967296),a}function s8(r,t,e,i,s,a){var u=t&i^t&a^i&a;return u<0&&(u+=4294967296),u}function o8(r,t){var e=on(r,t,28),i=on(t,r,2),s=on(t,r,7),a=e^i^s;return a<0&&(a+=4294967296),a}function a8(r,t){var e=an(r,t,28),i=an(t,r,2),s=an(t,r,7),a=e^i^s;return a<0&&(a+=4294967296),a}function c8(r,t){var e=on(r,t,14),i=on(r,t,18),s=on(t,r,9),a=e^i^s;return a<0&&(a+=4294967296),a}function u8(r,t){var e=an(r,t,14),i=an(r,t,18),s=an(t,r,9),a=e^i^s;return a<0&&(a+=4294967296),a}function h8(r,t){var e=on(r,t,1),i=on(r,t,8),s=xg(r,t,7),a=e^i^s;return a<0&&(a+=4294967296),a}function l8(r,t){var e=an(r,t,1),i=an(r,t,8),s=Mg(r,t,7),a=e^i^s;return a<0&&(a+=4294967296),a}function f8(r,t){var e=on(r,t,19),i=on(t,r,29),s=xg(r,t,6),a=e^i^s;return a<0&&(a+=4294967296),a}function d8(r,t){var e=an(r,t,19),i=an(t,r,29),s=Mg(r,t,6),a=e^i^s;return a<0&&(a+=4294967296),a}var Al=ve,Og=Pg;function Dn(){if(!(this instanceof Dn))return new Dn;Og.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Al.inherits(Dn,Og);var p8=Dn;Dn.blockSize=1024,Dn.outSize=384,Dn.hmacStrength=192,Dn.padLength=128,Dn.prototype._digest=function(r){return r==="hex"?Al.toHex32(this.h.slice(0,12),"big"):Al.split32(this.h.slice(0,12),"big")},to.sha1=UA,to.sha224=WA,to.sha256=Ig,to.sha384=p8,to.sha512=Pg;var Ng={},Is=ve,g8=vo,Ic=Is.rotl32,Xd=Is.sum32,Ho=Is.sum32_3,Zd=Is.sum32_4,Rg=g8.BlockHash;function Qi(){if(!(this instanceof Qi))return new Qi;Rg.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Is.inherits(Qi,Rg),Ng.ripemd160=Qi,Qi.blockSize=512,Qi.outSize=160,Qi.hmacStrength=192,Qi.padLength=64,Qi.prototype._update=function(r,t){for(var e=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],u=this.h[4],l=e,d=i,f=s,w=a,E=u,S=0;S<80;S++){var D=Xd(Ic(Zd(e,tp(S,i,s,a),r[y8[S]+t],m8(S)),b8[S]),u);e=u,u=a,a=Ic(s,10),s=i,i=D,D=Xd(Ic(Zd(l,tp(79-S,d,f,w),r[w8[S]+t],v8(S)),_8[S]),E),l=E,E=w,w=Ic(f,10),f=d,d=D}D=Ho(this.h[1],s,w),this.h[1]=Ho(this.h[2],a,E),this.h[2]=Ho(this.h[3],u,l),this.h[3]=Ho(this.h[4],e,d),this.h[4]=Ho(this.h[0],i,f),this.h[0]=D},Qi.prototype._digest=function(r){return r==="hex"?Is.toHex32(this.h,"little"):Is.split32(this.h,"little")};function tp(r,t,e,i){return r<=15?t^e^i:r<=31?t&e|~t&i:r<=47?(t|~e)^i:r<=63?t&i|e&~i:t^(e|~i)}function m8(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}function v8(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}var y8=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],w8=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],b8=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],_8=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],E8=ve,A8=da;function ao(r,t,e){if(!(this instanceof ao))return new ao(r,t,e);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(E8.toArray(t,e))}var S8=ao;ao.prototype._init=function(r){r.length>this.blockSize&&(r=new this.Hash().update(r).digest()),A8(r.length<=this.blockSize);for(var t=r.length;t<this.blockSize;t++)r.push(0);for(t=0;t<r.length;t++)r[t]^=54;for(this.inner=new this.Hash().update(r),t=0;t<r.length;t++)r[t]^=106;this.outer=new this.Hash().update(r)},ao.prototype.update=function(r,t){return this.inner.update(r,t),this},ao.prototype.digest=function(r){return this.outer.update(this.inner.digest()),this.outer.digest(r)},function(r){var t=r;t.utils=ve,t.common=vo,t.sha=to,t.ripemd=Ng,t.hmac=S8,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(Yi);function wo(r,t,e){return e={path:t,exports:{},require:function(i,s){return I8(i,s??e.path)}},r(e,e.exports),e.exports}function I8(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Wl=Tg;function Tg(r,t){if(!r)throw new Error(t||"Assertion failed")}Tg.equal=function(r,t,e){if(r!=t)throw new Error(e||"Assertion failed: "+r+" != "+t)};var Li=wo(function(r,t){var e=t;function i(u,l){if(Array.isArray(u))return u.slice();if(!u)return[];var d=[];if(typeof u!="string"){for(var f=0;f<u.length;f++)d[f]=u[f]|0;return d}if(l==="hex"){u=u.replace(/[^a-z0-9]+/ig,""),u.length%2!==0&&(u="0"+u);for(var f=0;f<u.length;f+=2)d.push(parseInt(u[f]+u[f+1],16))}else for(var f=0;f<u.length;f++){var w=u.charCodeAt(f),E=w>>8,S=w&255;E?d.push(E,S):d.push(S)}return d}e.toArray=i;function s(u){return u.length===1?"0"+u:u}e.zero2=s;function a(u){for(var l="",d=0;d<u.length;d++)l+=s(u[d].toString(16));return l}e.toHex=a,e.encode=function(u,l){return l==="hex"?a(u):u}}),ni=wo(function(r,t){var e=t;e.assert=Wl,e.toArray=Li.toArray,e.zero2=Li.zero2,e.toHex=Li.toHex,e.encode=Li.encode;function i(d,f,w){var E=new Array(Math.max(d.bitLength(),w)+1);E.fill(0);for(var S=1<<f+1,D=d.clone(),P=0;P<E.length;P++){var Y,G=D.andln(S-1);D.isOdd()?(G>(S>>1)-1?Y=(S>>1)-G:Y=G,D.isubn(Y)):Y=0,E[P]=Y,D.iushrn(1)}return E}e.getNAF=i;function s(d,f){var w=[[],[]];d=d.clone(),f=f.clone();for(var E=0,S=0,D;d.cmpn(-E)>0||f.cmpn(-S)>0;){var P=d.andln(3)+E&3,Y=f.andln(3)+S&3;P===3&&(P=-1),Y===3&&(Y=-1);var G;P&1?(D=d.andln(7)+E&7,(D===3||D===5)&&Y===2?G=-P:G=P):G=0,w[0].push(G);var tt;Y&1?(D=f.andln(7)+S&7,(D===3||D===5)&&P===2?tt=-Y:tt=Y):tt=0,w[1].push(tt),2*E===G+1&&(E=1-E),2*S===tt+1&&(S=1-S),d.iushrn(1),f.iushrn(1)}return w}e.getJSF=s;function a(d,f,w){var E="_"+f;d.prototype[f]=function(){return this[E]!==void 0?this[E]:this[E]=w.call(this)}}e.cachedProperty=a;function u(d){return typeof d=="string"?e.toArray(d,"hex"):d}e.parseBytes=u;function l(d){return new ne(d,"hex","le")}e.intFromLE=l}),Dc=ni.getNAF,D8=ni.getJSF,Yc=ni.assert;function Vn(r,t){this.type=r,this.p=new ne(t.p,16),this.red=t.prime?ne.red(t.prime):ne.mont(this.p),this.zero=new ne(0).toRed(this.red),this.one=new ne(1).toRed(this.red),this.two=new ne(2).toRed(this.red),this.n=t.n&&new ne(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var e=this.n&&this.p.div(this.n);!e||e.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ms=Vn;Vn.prototype.point=function(){throw new Error("Not implemented")},Vn.prototype.validate=function(){throw new Error("Not implemented")},Vn.prototype._fixedNafMul=function(r,t){Yc(r.precomputed);var e=r._getDoubles(),i=Dc(t,1,this._bitLength),s=(1<<e.step+1)-(e.step%2===0?2:1);s/=3;var a=[],u,l;for(u=0;u<i.length;u+=e.step){l=0;for(var d=u+e.step-1;d>=u;d--)l=(l<<1)+i[d];a.push(l)}for(var f=this.jpoint(null,null,null),w=this.jpoint(null,null,null),E=s;E>0;E--){for(u=0;u<a.length;u++)l=a[u],l===E?w=w.mixedAdd(e.points[u]):l===-E&&(w=w.mixedAdd(e.points[u].neg()));f=f.add(w)}return f.toP()},Vn.prototype._wnafMul=function(r,t){var e=4,i=r._getNAFPoints(e);e=i.wnd;for(var s=i.points,a=Dc(t,e,this._bitLength),u=this.jpoint(null,null,null),l=a.length-1;l>=0;l--){for(var d=0;l>=0&&a[l]===0;l--)d++;if(l>=0&&d++,u=u.dblp(d),l<0)break;var f=a[l];Yc(f!==0),r.type==="affine"?f>0?u=u.mixedAdd(s[f-1>>1]):u=u.mixedAdd(s[-f-1>>1].neg()):f>0?u=u.add(s[f-1>>1]):u=u.add(s[-f-1>>1].neg())}return r.type==="affine"?u.toP():u},Vn.prototype._wnafMulAdd=function(r,t,e,i,s){var a=this._wnafT1,u=this._wnafT2,l=this._wnafT3,d=0,f,w,E;for(f=0;f<i;f++){E=t[f];var S=E._getNAFPoints(r);a[f]=S.wnd,u[f]=S.points}for(f=i-1;f>=1;f-=2){var D=f-1,P=f;if(a[D]!==1||a[P]!==1){l[D]=Dc(e[D],a[D],this._bitLength),l[P]=Dc(e[P],a[P],this._bitLength),d=Math.max(l[D].length,d),d=Math.max(l[P].length,d);continue}var Y=[t[D],null,null,t[P]];t[D].y.cmp(t[P].y)===0?(Y[1]=t[D].add(t[P]),Y[2]=t[D].toJ().mixedAdd(t[P].neg())):t[D].y.cmp(t[P].y.redNeg())===0?(Y[1]=t[D].toJ().mixedAdd(t[P]),Y[2]=t[D].add(t[P].neg())):(Y[1]=t[D].toJ().mixedAdd(t[P]),Y[2]=t[D].toJ().mixedAdd(t[P].neg()));var G=[-3,-1,-5,-7,0,7,5,1,3],tt=D8(e[D],e[P]);for(d=Math.max(tt[0].length,d),l[D]=new Array(d),l[P]=new Array(d),w=0;w<d;w++){var K=tt[0][w]|0,V=tt[1][w]|0;l[D][w]=G[(K+1)*3+(V+1)],l[P][w]=0,u[D]=Y}}var B=this.jpoint(null,null,null),z=this._wnafT4;for(f=d;f>=0;f--){for(var $=0;f>=0;){var v=!0;for(w=0;w<i;w++)z[w]=l[w][f]|0,z[w]!==0&&(v=!1);if(!v)break;$++,f--}if(f>=0&&$++,B=B.dblp($),f<0)break;for(w=0;w<i;w++){var T=z[w];T!==0&&(T>0?E=u[w][T-1>>1]:T<0&&(E=u[w][-T-1>>1].neg()),E.type==="affine"?B=B.mixedAdd(E):B=B.add(E))}}for(f=0;f<i;f++)u[f]=null;return s?B:B.toP()};function bi(r,t){this.curve=r,this.type=t,this.precomputed=null}Vn.BasePoint=bi,bi.prototype.eq=function(){throw new Error("Not implemented")},bi.prototype.validate=function(){return this.curve.validate(this)},Vn.prototype.decodePoint=function(r,t){r=ni.toArray(r,t);var e=this.p.byteLength();if((r[0]===4||r[0]===6||r[0]===7)&&r.length-1===2*e){r[0]===6?Yc(r[r.length-1]%2===0):r[0]===7&&Yc(r[r.length-1]%2===1);var i=this.point(r.slice(1,1+e),r.slice(1+e,1+2*e));return i}else if((r[0]===2||r[0]===3)&&r.length-1===e)return this.pointFromX(r.slice(1,1+e),r[0]===3);throw new Error("Unknown point format")},bi.prototype.encodeCompressed=function(r){return this.encode(r,!0)},bi.prototype._encode=function(r){var t=this.curve.p.byteLength(),e=this.getX().toArray("be",t);return r?[this.getY().isEven()?2:3].concat(e):[4].concat(e,this.getY().toArray("be",t))},bi.prototype.encode=function(r,t){return ni.encode(this._encode(t),r)},bi.prototype.precompute=function(r){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,r),t.beta=this._getBeta(),this.precomputed=t,this},bi.prototype._hasDoubles=function(r){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((r.bitLength()+1)/t.step):!1},bi.prototype._getDoubles=function(r,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var e=[this],i=this,s=0;s<t;s+=r){for(var a=0;a<r;a++)i=i.dbl();e.push(i)}return{step:r,points:e}},bi.prototype._getNAFPoints=function(r){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],e=(1<<r)-1,i=e===1?null:this.dbl(),s=1;s<e;s++)t[s]=t[s-1].add(i);return{wnd:r,points:t}},bi.prototype._getBeta=function(){return null},bi.prototype.dblp=function(r){for(var t=this,e=0;e<r;e++)t=t.dbl();return t};var Yl=wo(function(r){typeof Object.create=="function"?r.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(t,e){if(e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}}}),x8=ni.assert;function Ii(r){Ms.call(this,"short",r),this.a=new ne(r.a,16).toRed(this.red),this.b=new ne(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Yl(Ii,Ms);var M8=Ii;Ii.prototype._getEndomorphism=function(r){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,e;if(r.beta)t=new ne(r.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(r.lambda)e=new ne(r.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?e=s[0]:(e=s[1],x8(this.g.mul(e).x.cmp(this.g.x.redMul(t))===0))}var a;return r.basis?a=r.basis.map(function(u){return{a:new ne(u.a,16),b:new ne(u.b,16)}}):a=this._getEndoBasis(e),{beta:t,lambda:e,basis:a}}},Ii.prototype._getEndoRoots=function(r){var t=r===this.p?this.red:ne.mont(r),e=new ne(2).toRed(t).redInvm(),i=e.redNeg(),s=new ne(3).toRed(t).redNeg().redSqrt().redMul(e),a=i.redAdd(s).fromRed(),u=i.redSub(s).fromRed();return[a,u]},Ii.prototype._getEndoBasis=function(r){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),e=r,i=this.n.clone(),s=new ne(1),a=new ne(0),u=new ne(0),l=new ne(1),d,f,w,E,S,D,P,Y=0,G,tt;e.cmpn(0)!==0;){var K=i.div(e);G=i.sub(K.mul(e)),tt=u.sub(K.mul(s));var V=l.sub(K.mul(a));if(!w&&G.cmp(t)<0)d=P.neg(),f=s,w=G.neg(),E=tt;else if(w&&++Y===2)break;P=G,i=e,e=G,u=s,s=tt,l=a,a=V}S=G.neg(),D=tt;var B=w.sqr().add(E.sqr()),z=S.sqr().add(D.sqr());return z.cmp(B)>=0&&(S=d,D=f),w.negative&&(w=w.neg(),E=E.neg()),S.negative&&(S=S.neg(),D=D.neg()),[{a:w,b:E},{a:S,b:D}]},Ii.prototype._endoSplit=function(r){var t=this.endo.basis,e=t[0],i=t[1],s=i.b.mul(r).divRound(this.n),a=e.b.neg().mul(r).divRound(this.n),u=s.mul(e.a),l=a.mul(i.a),d=s.mul(e.b),f=a.mul(i.b),w=r.sub(u).sub(l),E=d.add(f).neg();return{k1:w,k2:E}},Ii.prototype.pointFromX=function(r,t){r=new ne(r,16),r.red||(r=r.toRed(this.red));var e=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),i=e.redSqrt();if(i.redSqr().redSub(e).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(r,i)},Ii.prototype.validate=function(r){if(r.inf)return!0;var t=r.x,e=r.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return e.redSqr().redISub(s).cmpn(0)===0},Ii.prototype._endoWnafMulAdd=function(r,t,e){for(var i=this._endoWnafT1,s=this._endoWnafT2,a=0;a<r.length;a++){var u=this._endoSplit(t[a]),l=r[a],d=l._getBeta();u.k1.negative&&(u.k1.ineg(),l=l.neg(!0)),u.k2.negative&&(u.k2.ineg(),d=d.neg(!0)),i[a*2]=l,i[a*2+1]=d,s[a*2]=u.k1,s[a*2+1]=u.k2}for(var f=this._wnafMulAdd(1,i,s,a*2,e),w=0;w<a*2;w++)i[w]=null,s[w]=null;return f};function hr(r,t,e,i){Ms.BasePoint.call(this,r,"affine"),t===null&&e===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new ne(t,16),this.y=new ne(e,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Yl(hr,Ms.BasePoint),Ii.prototype.point=function(r,t,e){return new hr(this,r,t,e)},Ii.prototype.pointFromJSON=function(r,t){return hr.fromJSON(this,r,t)},hr.prototype._getBeta=function(){if(this.curve.endo){var r=this.precomputed;if(r&&r.beta)return r.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(r){var e=this.curve,i=function(s){return e.point(s.x.redMul(e.endo.beta),s.y)};r.beta=t,t.precomputed={beta:null,naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t}},hr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},hr.fromJSON=function(r,t,e){typeof t=="string"&&(t=JSON.parse(t));var i=r.point(t[0],t[1],e);if(!t[2])return i;function s(u){return r.point(u[0],u[1],e)}var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(s))}},i},hr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},hr.prototype.isInfinity=function(){return this.inf},hr.prototype.add=function(r){if(this.inf)return r;if(r.inf)return this;if(this.eq(r))return this.dbl();if(this.neg().eq(r))return this.curve.point(null,null);if(this.x.cmp(r.x)===0)return this.curve.point(null,null);var t=this.y.redSub(r.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(r.x).redInvm()));var e=t.redSqr().redISub(this.x).redISub(r.x),i=t.redMul(this.x.redSub(e)).redISub(this.y);return this.curve.point(e,i)},hr.prototype.dbl=function(){if(this.inf)return this;var r=this.y.redAdd(this.y);if(r.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,e=this.x.redSqr(),i=r.redInvm(),s=e.redAdd(e).redIAdd(e).redIAdd(t).redMul(i),a=s.redSqr().redISub(this.x.redAdd(this.x)),u=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,u)},hr.prototype.getX=function(){return this.x.fromRed()},hr.prototype.getY=function(){return this.y.fromRed()},hr.prototype.mul=function(r){return r=new ne(r,16),this.isInfinity()?this:this._hasDoubles(r)?this.curve._fixedNafMul(this,r):this.curve.endo?this.curve._endoWnafMulAdd([this],[r]):this.curve._wnafMul(this,r)},hr.prototype.mulAdd=function(r,t,e){var i=[this,t],s=[r,e];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},hr.prototype.jmulAdd=function(r,t,e){var i=[this,t],s=[r,e];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},hr.prototype.eq=function(r){return this===r||this.inf===r.inf&&(this.inf||this.x.cmp(r.x)===0&&this.y.cmp(r.y)===0)},hr.prototype.neg=function(r){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(r&&this.precomputed){var e=this.precomputed,i=function(s){return s.neg()};t.precomputed={naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t},hr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var r=this.curve.jpoint(this.x,this.y,this.curve.one);return r};function dr(r,t,e,i){Ms.BasePoint.call(this,r,"jacobian"),t===null&&e===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ne(0)):(this.x=new ne(t,16),this.y=new ne(e,16),this.z=new ne(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Yl(dr,Ms.BasePoint),Ii.prototype.jpoint=function(r,t,e){return new dr(this,r,t,e)},dr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var r=this.z.redInvm(),t=r.redSqr(),e=this.x.redMul(t),i=this.y.redMul(t).redMul(r);return this.curve.point(e,i)},dr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},dr.prototype.add=function(r){if(this.isInfinity())return r;if(r.isInfinity())return this;var t=r.z.redSqr(),e=this.z.redSqr(),i=this.x.redMul(t),s=r.x.redMul(e),a=this.y.redMul(t.redMul(r.z)),u=r.y.redMul(e.redMul(this.z)),l=i.redSub(s),d=a.redSub(u);if(l.cmpn(0)===0)return d.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=l.redSqr(),w=f.redMul(l),E=i.redMul(f),S=d.redSqr().redIAdd(w).redISub(E).redISub(E),D=d.redMul(E.redISub(S)).redISub(a.redMul(w)),P=this.z.redMul(r.z).redMul(l);return this.curve.jpoint(S,D,P)},dr.prototype.mixedAdd=function(r){if(this.isInfinity())return r.toJ();if(r.isInfinity())return this;var t=this.z.redSqr(),e=this.x,i=r.x.redMul(t),s=this.y,a=r.y.redMul(t).redMul(this.z),u=e.redSub(i),l=s.redSub(a);if(u.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var d=u.redSqr(),f=d.redMul(u),w=e.redMul(d),E=l.redSqr().redIAdd(f).redISub(w).redISub(w),S=l.redMul(w.redISub(E)).redISub(s.redMul(f)),D=this.z.redMul(u);return this.curve.jpoint(E,S,D)},dr.prototype.dblp=function(r){if(r===0)return this;if(this.isInfinity())return this;if(!r)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var e=this;for(t=0;t<r;t++)e=e.dbl();return e}var i=this.curve.a,s=this.curve.tinv,a=this.x,u=this.y,l=this.z,d=l.redSqr().redSqr(),f=u.redAdd(u);for(t=0;t<r;t++){var w=a.redSqr(),E=f.redSqr(),S=E.redSqr(),D=w.redAdd(w).redIAdd(w).redIAdd(i.redMul(d)),P=a.redMul(E),Y=D.redSqr().redISub(P.redAdd(P)),G=P.redISub(Y),tt=D.redMul(G);tt=tt.redIAdd(tt).redISub(S);var K=f.redMul(l);t+1<r&&(d=d.redMul(S)),a=Y,l=K,f=tt}return this.curve.jpoint(a,f.redMul(s),l)},dr.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},dr.prototype._zeroDbl=function(){var r,t,e;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),u=this.x.redAdd(s).redSqr().redISub(i).redISub(a);u=u.redIAdd(u);var l=i.redAdd(i).redIAdd(i),d=l.redSqr().redISub(u).redISub(u),f=a.redIAdd(a);f=f.redIAdd(f),f=f.redIAdd(f),r=d,t=l.redMul(u.redISub(d)).redISub(f),e=this.y.redAdd(this.y)}else{var w=this.x.redSqr(),E=this.y.redSqr(),S=E.redSqr(),D=this.x.redAdd(E).redSqr().redISub(w).redISub(S);D=D.redIAdd(D);var P=w.redAdd(w).redIAdd(w),Y=P.redSqr(),G=S.redIAdd(S);G=G.redIAdd(G),G=G.redIAdd(G),r=Y.redISub(D).redISub(D),t=P.redMul(D.redISub(r)).redISub(G),e=this.y.redMul(this.z),e=e.redIAdd(e)}return this.curve.jpoint(r,t,e)},dr.prototype._threeDbl=function(){var r,t,e;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),u=this.x.redAdd(s).redSqr().redISub(i).redISub(a);u=u.redIAdd(u);var l=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),d=l.redSqr().redISub(u).redISub(u);r=d;var f=a.redIAdd(a);f=f.redIAdd(f),f=f.redIAdd(f),t=l.redMul(u.redISub(d)).redISub(f),e=this.y.redAdd(this.y)}else{var w=this.z.redSqr(),E=this.y.redSqr(),S=this.x.redMul(E),D=this.x.redSub(w).redMul(this.x.redAdd(w));D=D.redAdd(D).redIAdd(D);var P=S.redIAdd(S);P=P.redIAdd(P);var Y=P.redAdd(P);r=D.redSqr().redISub(Y),e=this.y.redAdd(this.z).redSqr().redISub(E).redISub(w);var G=E.redSqr();G=G.redIAdd(G),G=G.redIAdd(G),G=G.redIAdd(G),t=D.redMul(P.redISub(r)).redISub(G)}return this.curve.jpoint(r,t,e)},dr.prototype._dbl=function(){var r=this.curve.a,t=this.x,e=this.y,i=this.z,s=i.redSqr().redSqr(),a=t.redSqr(),u=e.redSqr(),l=a.redAdd(a).redIAdd(a).redIAdd(r.redMul(s)),d=t.redAdd(t);d=d.redIAdd(d);var f=d.redMul(u),w=l.redSqr().redISub(f.redAdd(f)),E=f.redISub(w),S=u.redSqr();S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var D=l.redMul(E).redISub(S),P=e.redAdd(e).redMul(i);return this.curve.jpoint(w,D,P)},dr.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var r=this.x.redSqr(),t=this.y.redSqr(),e=this.z.redSqr(),i=t.redSqr(),s=r.redAdd(r).redIAdd(r),a=s.redSqr(),u=this.x.redAdd(t).redSqr().redISub(r).redISub(i);u=u.redIAdd(u),u=u.redAdd(u).redIAdd(u),u=u.redISub(a);var l=u.redSqr(),d=i.redIAdd(i);d=d.redIAdd(d),d=d.redIAdd(d),d=d.redIAdd(d);var f=s.redIAdd(u).redSqr().redISub(a).redISub(l).redISub(d),w=t.redMul(f);w=w.redIAdd(w),w=w.redIAdd(w);var E=this.x.redMul(l).redISub(w);E=E.redIAdd(E),E=E.redIAdd(E);var S=this.y.redMul(f.redMul(d.redISub(f)).redISub(u.redMul(l)));S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var D=this.z.redAdd(u).redSqr().redISub(e).redISub(l);return this.curve.jpoint(E,S,D)},dr.prototype.mul=function(r,t){return r=new ne(r,t),this.curve._wnafMul(this,r)},dr.prototype.eq=function(r){if(r.type==="affine")return this.eq(r.toJ());if(this===r)return!0;var t=this.z.redSqr(),e=r.z.redSqr();if(this.x.redMul(e).redISub(r.x.redMul(t)).cmpn(0)!==0)return!1;var i=t.redMul(this.z),s=e.redMul(r.z);return this.y.redMul(s).redISub(r.y.redMul(i)).cmpn(0)===0},dr.prototype.eqXToP=function(r){var t=this.z.redSqr(),e=r.toRed(this.curve.red).redMul(t);if(this.x.cmp(e)===0)return!0;for(var i=r.clone(),s=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(s),this.x.cmp(e)===0)return!0}},dr.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},dr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Bc=wo(function(r,t){var e=t;e.base=Ms,e.short=M8,e.mont=null,e.edwards=null}),Lc=wo(function(r,t){var e=t,i=ni.assert;function s(l){l.type==="short"?this.curve=new Bc.short(l):l.type==="edwards"?this.curve=new Bc.edwards(l):this.curve=new Bc.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=s;function a(l,d){Object.defineProperty(e,l,{configurable:!0,enumerable:!0,get:function(){var f=new s(d);return Object.defineProperty(e,l,{configurable:!0,enumerable:!0,value:f}),f}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Yi.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Yi.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Yi.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Yi.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Yi.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Yi.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Yi.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=null.crash()}catch{u=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Yi.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})});function Gn(r){if(!(this instanceof Gn))return new Gn(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Li.toArray(r.entropy,r.entropyEnc||"hex"),e=Li.toArray(r.nonce,r.nonceEnc||"hex"),i=Li.toArray(r.pers,r.persEnc||"hex");Wl(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,e,i)}var ep=Gn;Gn.prototype._init=function(r,t,e){var i=r.concat(t).concat(e);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},Gn.prototype._hmac=function(){return new Yi.hmac(this.hash,this.K)},Gn.prototype._update=function(r){var t=this._hmac().update(this.V).update([0]);r&&(t=t.update(r)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),r&&(this.K=this._hmac().update(this.V).update([1]).update(r).digest(),this.V=this._hmac().update(this.V).digest())},Gn.prototype.reseed=function(r,t,e,i){typeof t!="string"&&(i=e,e=t,t=null),r=Li.toArray(r,t),e=Li.toArray(e,i),Wl(r.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(r.concat(e||[])),this._reseed=1},Gn.prototype.generate=function(r,t,e,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=e,e=t,t=null),e&&(e=Li.toArray(e,i||"hex"),this._update(e));for(var s=[];s.length<r;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,r);return this._update(e),this._reseed++,Li.encode(a,t)};var zh=ni.assert;function Er(r,t){this.ec=r,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var kh=Er;Er.fromPublic=function(r,t,e){return t instanceof Er?t:new Er(r,{pub:t,pubEnc:e})},Er.fromPrivate=function(r,t,e){return t instanceof Er?t:new Er(r,{priv:t,privEnc:e})},Er.prototype.validate=function(){var r=this.getPublic();return r.isInfinity()?{result:!1,reason:"Invalid public key"}:r.validate()?r.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Er.prototype.getPublic=function(r,t){return typeof r=="string"&&(t=r,r=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,r):this.pub},Er.prototype.getPrivate=function(r){return r==="hex"?this.priv.toString(16,2):this.priv},Er.prototype._importPrivate=function(r,t){this.priv=new ne(r,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Er.prototype._importPublic=function(r,t){if(r.x||r.y){this.ec.curve.type==="mont"?zh(r.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&zh(r.x&&r.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(r.x,r.y);return}this.pub=this.ec.curve.decodePoint(r,t)},Er.prototype.derive=function(r){return r.validate()||zh(r.validate(),"public point not validated"),r.mul(this.priv).getX()},Er.prototype.sign=function(r,t,e){return this.ec.sign(r,this,t,e)},Er.prototype.verify=function(r,t){return this.ec.verify(r,t,this)},Er.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var C8=ni.assert;function hu(r,t){if(r instanceof hu)return r;this._importDER(r,t)||(C8(r.r&&r.s,"Signature without r or s"),this.r=new ne(r.r,16),this.s=new ne(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var xc=hu;function P8(){this.place=0}function Hh(r,t){var e=r[t.place++];if(!(e&128))return e;var i=e&15;if(i===0||i>4)return!1;for(var s=0,a=0,u=t.place;a<i;a++,u++)s<<=8,s|=r[u],s>>>=0;return s<=127?!1:(t.place=u,s)}function rp(r){for(var t=0,e=r.length-1;!r[t]&&!(r[t+1]&128)&&t<e;)t++;return t===0?r:r.slice(t)}hu.prototype._importDER=function(r,t){r=ni.toArray(r,t);var e=new P8;if(r[e.place++]!==48)return!1;var i=Hh(r,e);if(i===!1||i+e.place!==r.length||r[e.place++]!==2)return!1;var s=Hh(r,e);if(s===!1)return!1;var a=r.slice(e.place,s+e.place);if(e.place+=s,r[e.place++]!==2)return!1;var u=Hh(r,e);if(u===!1||r.length!==u+e.place)return!1;var l=r.slice(e.place,u+e.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;return this.r=new ne(a),this.s=new ne(l),this.recoveryParam=null,!0};function Kh(r,t){if(t<128){r.push(t);return}var e=1+(Math.log(t)/Math.LN2>>>3);for(r.push(e|128);--e;)r.push(t>>>(e<<3)&255);r.push(t)}hu.prototype.toDER=function(r){var t=this.r.toArray(),e=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),e[0]&128&&(e=[0].concat(e)),t=rp(t),e=rp(e);!e[0]&&!(e[1]&128);)e=e.slice(1);var i=[2];Kh(i,t.length),i=i.concat(t),i.push(2),Kh(i,e.length);var s=i.concat(e),a=[48];return Kh(a,s.length),a=a.concat(s),ni.encode(a,r)};var O8=function(){throw new Error("unsupported")},Fg=ni.assert;function Ai(r){if(!(this instanceof Ai))return new Ai(r);typeof r=="string"&&(Fg(Object.prototype.hasOwnProperty.call(Lc,r),"Unknown curve "+r),r=Lc[r]),r instanceof Lc.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}var N8=Ai;Ai.prototype.keyPair=function(r){return new kh(this,r)},Ai.prototype.keyFromPrivate=function(r,t){return kh.fromPrivate(this,r,t)},Ai.prototype.keyFromPublic=function(r,t){return kh.fromPublic(this,r,t)},Ai.prototype.genKeyPair=function(r){r||(r={});for(var t=new ep({hash:this.hash,pers:r.pers,persEnc:r.persEnc||"utf8",entropy:r.entropy||O8(this.hash.hmacStrength),entropyEnc:r.entropy&&r.entropyEnc||"utf8",nonce:this.n.toArray()}),e=this.n.byteLength(),i=this.n.sub(new ne(2));;){var s=new ne(t.generate(e));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},Ai.prototype._truncateToN=function(r,t){var e=r.byteLength()*8-this.n.bitLength();return e>0&&(r=r.ushrn(e)),!t&&r.cmp(this.n)>=0?r.sub(this.n):r},Ai.prototype.sign=function(r,t,e,i){typeof e=="object"&&(i=e,e=null),i||(i={}),t=this.keyFromPrivate(t,e),r=this._truncateToN(new ne(r,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),u=r.toArray("be",s),l=new ep({hash:this.hash,entropy:a,nonce:u,pers:i.pers,persEnc:i.persEnc||"utf8"}),d=this.n.sub(new ne(1)),f=0;;f++){var w=i.k?i.k(f):new ne(l.generate(this.n.byteLength()));if(w=this._truncateToN(w,!0),!(w.cmpn(1)<=0||w.cmp(d)>=0)){var E=this.g.mul(w);if(!E.isInfinity()){var S=E.getX(),D=S.umod(this.n);if(D.cmpn(0)!==0){var P=w.invm(this.n).mul(D.mul(t.getPrivate()).iadd(r));if(P=P.umod(this.n),P.cmpn(0)!==0){var Y=(E.getY().isOdd()?1:0)|(S.cmp(D)!==0?2:0);return i.canonical&&P.cmp(this.nh)>0&&(P=this.n.sub(P),Y^=1),new xc({r:D,s:P,recoveryParam:Y})}}}}}},Ai.prototype.verify=function(r,t,e,i){r=this._truncateToN(new ne(r,16)),e=this.keyFromPublic(e,i),t=new xc(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u=a.invm(this.n),l=u.mul(r).umod(this.n),d=u.mul(s).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(l,e.getPublic(),d),f.isInfinity()?!1:f.eqXToP(s)):(f=this.g.mulAdd(l,e.getPublic(),d),f.isInfinity()?!1:f.getX().umod(this.n).cmp(s)===0)},Ai.prototype.recoverPubKey=function(r,t,e,i){Fg((3&e)===e,"The recovery param is more than two bits"),t=new xc(t,i);var s=this.n,a=new ne(r),u=t.r,l=t.s,d=e&1,f=e>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");f?u=this.curve.pointFromX(u.add(this.curve.n),d):u=this.curve.pointFromX(u,d);var w=t.r.invm(s),E=s.sub(a).mul(w).umod(s),S=l.mul(w).umod(s);return this.g.mulAdd(E,u,S)},Ai.prototype.getKeyRecoveryParam=function(r,t,e,i){if(t=new xc(t,i),t.recoveryParam!==null)return t.recoveryParam;for(var s=0;s<4;s++){var a;try{a=this.recoverPubKey(r,t,s)}catch{continue}if(a.eq(e))return s}throw new Error("Unable to find valid recovery factor")};var R8=wo(function(r,t){var e=t;e.version="6.5.4",e.utils=ni,e.rand=function(){throw new Error("unsupported")},e.curve=Bc,e.curves=Lc,e.ec=N8,e.eddsa=null}),T8=R8.ec;const F8="signing-key/5.7.0",Sl=new mr(F8);let Vh=null;function rn(){return Vh||(Vh=new T8("secp256k1")),Vh}class U8{constructor(t){zo(this,"curve","secp256k1"),zo(this,"privateKey",Pr(t)),w5(this.privateKey)!==32&&Sl.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=rn().keyFromPrivate(Ye(this.privateKey));zo(this,"publicKey","0x"+e.getPublic(!1,"hex")),zo(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),zo(this,"_isSigningKey",!0)}_addPoint(t){const e=rn().keyFromPublic(Ye(this.publicKey)),i=rn().keyFromPublic(Ye(t));return"0x"+e.pub.add(i.pub).encodeCompressed("hex")}signDigest(t){const e=rn().keyFromPrivate(Ye(this.privateKey)),i=Ye(t);i.length!==32&&Sl.throwArgumentError("bad digest length","digest",t);const s=e.sign(i,{canonical:!0});return og({recoveryParam:s.recoveryParam,r:nn("0x"+s.r.toString(16),32),s:nn("0x"+s.s.toString(16),32)})}computeSharedSecret(t){const e=rn().keyFromPrivate(Ye(this.privateKey)),i=rn().keyFromPublic(Ye(Ug(t)));return nn("0x"+e.derive(i.getPublic()).toString(16),32)}static isSigningKey(t){return!!(t&&t._isSigningKey)}}function B8(r,t){const e=og(t),i={r:Ye(e.r),s:Ye(e.s)};return"0x"+rn().recoverPubKey(Ye(r),i,e.recoveryParam).encode("hex",!1)}function Ug(r,t){const e=Ye(r);if(e.length===32){const i=new U8(e);return t?"0x"+rn().keyFromPrivate(e).getPublic(!0,"hex"):i.publicKey}else{if(e.length===33)return t?Pr(e):"0x"+rn().keyFromPublic(e).getPublic(!1,"hex");if(e.length===65)return t?"0x"+rn().keyFromPublic(e).getPublic(!0,"hex"):Pr(e)}return Sl.throwArgumentError("invalid public or private key","key","[REDACTED]")}var ip;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(ip||(ip={}));function L8(r){const t=Ug(r);return Y5(zd(Kl(zd(t,1)),12))}function q8(r,t){return L8(B8(Ye(r),t))}const j8="https://rpc.walletconnect.com/v1";async function $8(r,t,e,i,s,a){switch(e.t){case"eip191":return z8(r,t,e.s);case"eip1271":return await k8(r,t,e.s,i,s,a);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${e.t}`)}}function z8(r,t,e){return q8(gg(t),e).toLowerCase()===r.toLowerCase()}async function k8(r,t,e,i,s,a){try{const u="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",d="0000000000000000000000000000000000000000000000000000000000000041",f=e.substring(2),w=gg(t).substring(2),E=u+w+l+d+f,S=await fetch(`${a||j8}/?chainId=${i}&projectId=${s}`,{method:"POST",body:JSON.stringify({id:H8(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:E},"latest"]})}),{result:D}=await S.json();return D?D.slice(0,u.length).toLowerCase()===u.toLowerCase():!1}catch(u){return console.error("isValidEip1271Signature: ",u),!1}}function H8(){return Date.now()+Math.floor(Math.random()*1e3)}var K8=Object.defineProperty,V8=Object.defineProperties,G8=Object.getOwnPropertyDescriptors,np=Object.getOwnPropertySymbols,W8=Object.prototype.hasOwnProperty,Y8=Object.prototype.propertyIsEnumerable,sp=(r,t,e)=>t in r?K8(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Q8=(r,t)=>{for(var e in t||(t={}))W8.call(t,e)&&sp(r,e,t[e]);if(np)for(var e of np(t))Y8.call(t,e)&&sp(r,e,t[e]);return r},J8=(r,t)=>V8(r,G8(t));const X8="did:pkh:",Ql=r=>r==null?void 0:r.split(":"),Bg=r=>{const t=r&&Ql(r);if(t)return r.includes(X8)?t[3]:t[1]},op=r=>{const t=r&&Ql(r);if(t)return t[2]+":"+t[3]},Qc=r=>{const t=r&&Ql(r);if(t)return t.pop()};async function ap(r){const{cacao:t,projectId:e}=r,{s:i,p:s}=t,a=Lg(s,s.iss),u=Qc(s.iss);return await $8(u,a,i,Bg(s.iss),e)}const Lg=(r,t)=>{const e=`${r.domain} wants you to sign in with your Ethereum account:`,i=Qc(t);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let s=r.statement||void 0;const a=`URI: ${r.aud||r.uri}`,u=`Version: ${r.version}`,l=`Chain ID: ${Bg(t)}`,d=`Nonce: ${r.nonce}`,f=`Issued At: ${r.iat}`,w=r.resources?`Resources:${r.resources.map(S=>`
|
|
23
|
+
- ${S}`).join("")}`:void 0,E=qc(r.resources);if(E){const S=sa(E);s=a4(s,S)}return[e,i,"",s,"",a,u,l,d,f,w].filter(S=>S!=null).join(`
|
|
24
|
+
`)};function Z8(r){return P1.from(JSON.stringify(r)).toString("base64")}function t4(r){return JSON.parse(P1.from(r,"base64").toString("utf-8"))}function Ds(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const t=Object.keys(r.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(e=>{const i=r.att[e];if(Array.isArray(i))throw new Error(`Resource must be an object: ${e}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${e}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${e}`);Object.keys(i).forEach(s=>{const a=i[s];if(!Array.isArray(a))throw new Error(`Ability limits ${s} must be an array of objects, found: ${a}`);if(!a.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);a.forEach(u=>{if(typeof u!="object")throw new Error(`Ability limits (${s}) must be an array of objects, found: ${u}`)})})})}function e4(r,t,e,i={}){return e==null||e.sort((s,a)=>s.localeCompare(a)),{att:{[r]:r4(t,e,i)}}}function r4(r,t,e={}){t=t==null?void 0:t.sort((s,a)=>s.localeCompare(a));const i=t.map(s=>({[`${r}/${s}`]:[e]}));return Object.assign({},...i)}function qg(r){return Ds(r),`urn:recap:${Z8(r).replace(/=/g,"")}`}function sa(r){const t=t4(r.replace("urn:recap:",""));return Ds(t),t}function i4(r,t,e){const i=e4(r,t,e);return qg(i)}function n4(r){return r&&r.includes("urn:recap:")}function s4(r,t){const e=sa(r),i=sa(t),s=o4(e,i);return qg(s)}function o4(r,t){Ds(r),Ds(t);const e=Object.keys(r.att).concat(Object.keys(t.att)).sort((s,a)=>s.localeCompare(a)),i={att:{}};return e.forEach(s=>{var a,u;Object.keys(((a=r.att)==null?void 0:a[s])||{}).concat(Object.keys(((u=t.att)==null?void 0:u[s])||{})).sort((l,d)=>l.localeCompare(d)).forEach(l=>{var d,f;i.att[s]=J8(Q8({},i.att[s]),{[l]:((d=r.att[s])==null?void 0:d[l])||((f=t.att[s])==null?void 0:f[l])})})}),i}function a4(r="",t){Ds(t);const e="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(e))return r;const i=[];let s=0;Object.keys(t.att).forEach(l=>{const d=Object.keys(t.att[l]).map(E=>({ability:E.split("/")[0],action:E.split("/")[1]}));d.sort((E,S)=>E.action.localeCompare(S.action));const f={};d.forEach(E=>{f[E.ability]||(f[E.ability]=[]),f[E.ability].push(E.action)});const w=Object.keys(f).map(E=>(s++,`(${s}) '${E}': '${f[E].join("', '")}' for '${l}'.`));i.push(w.join(", ").replace(".,","."))});const a=i.join(" "),u=`${e}${a}`;return`${r?r+" ":""}${u}`}function cp(r){var t;const e=sa(r);Ds(e);const i=(t=e.att)==null?void 0:t.eip155;return i?Object.keys(i).map(s=>s.split("/")[1]):[]}function up(r){const t=sa(r);Ds(t);const e=[];return Object.values(t.att).forEach(i=>{Object.values(i).forEach(s=>{var a;(a=s==null?void 0:s[0])!=null&&a.chains&&e.push(s[0].chains)})}),[...new Set(e.flat())]}function qc(r){if(!r)return;const t=r==null?void 0:r[r.length-1];return n4(t)?t:void 0}const jg="base10",Rr="base16",Il="base64pad",Jl="utf8",$g=0,xn=1,c4=0,hp=1,Dl=12,Xl=32;function u4(){const r=Hl.generateKeyPair();return{privateKey:Tr(r.secretKey,Rr),publicKey:Tr(r.publicKey,Rr)}}function xl(){const r=fo.randomBytes(Xl);return Tr(r,Rr)}function h4(r,t){const e=Hl.sharedKey(Kr(r,Rr),Kr(t,Rr),!0),i=new H_(cu.SHA256,e).expand(Xl);return Tr(i,Rr)}function jc(r){const t=cu.hash(Kr(r,Rr));return Tr(t,Rr)}function As(r){const t=cu.hash(Kr(r,Jl));return Tr(t,Rr)}function l4(r){return Kr(`${r}`,jg)}function pa(r){return Number(Tr(r,jg))}function f4(r){const t=l4(typeof r.type<"u"?r.type:$g);if(pa(t)===xn&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const e=typeof r.senderPublicKey<"u"?Kr(r.senderPublicKey,Rr):void 0,i=typeof r.iv<"u"?Kr(r.iv,Rr):fo.randomBytes(Dl),s=new zl.ChaCha20Poly1305(Kr(r.symKey,Rr)).seal(i,Kr(r.message,Jl));return p4({type:t,sealed:s,iv:i,senderPublicKey:e})}function d4(r){const t=new zl.ChaCha20Poly1305(Kr(r.symKey,Rr)),{sealed:e,iv:i}=Jc(r.encoded),s=t.open(i,e);if(s===null)throw new Error("Failed to decrypt");return Tr(s,Jl)}function p4(r){if(pa(r.type)===xn){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tr(yl([r.type,r.senderPublicKey,r.iv,r.sealed]),Il)}return Tr(yl([r.type,r.iv,r.sealed]),Il)}function Jc(r){const t=Kr(r,Il),e=t.slice(c4,hp),i=hp;if(pa(e)===xn){const l=i+Xl,d=l+Dl,f=t.slice(i,l),w=t.slice(l,d),E=t.slice(d);return{type:e,sealed:E,iv:w,senderPublicKey:f}}const s=i+Dl,a=t.slice(i,s),u=t.slice(s);return{type:e,sealed:u,iv:a}}function g4(r,t){const e=Jc(r);return zg({type:pa(e.type),senderPublicKey:typeof e.senderPublicKey<"u"?Tr(e.senderPublicKey,Rr):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function zg(r){const t=(r==null?void 0:r.type)||$g;if(t===xn){if(typeof(r==null?void 0:r.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(r==null?void 0:r.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:r==null?void 0:r.senderPublicKey,receiverPublicKey:r==null?void 0:r.receiverPublicKey}}function lp(r){return r.type===xn&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}const m4="irn";function Ml(r){return(r==null?void 0:r.relay)||{protocol:m4}}function Qo(r){const t=GE[r];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${r}`);return t}var v4=Object.defineProperty,y4=Object.defineProperties,w4=Object.getOwnPropertyDescriptors,fp=Object.getOwnPropertySymbols,b4=Object.prototype.hasOwnProperty,_4=Object.prototype.propertyIsEnumerable,dp=(r,t,e)=>t in r?v4(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pp=(r,t)=>{for(var e in t||(t={}))b4.call(t,e)&&dp(r,e,t[e]);if(fp)for(var e of fp(t))_4.call(t,e)&&dp(r,e,t[e]);return r},E4=(r,t)=>y4(r,w4(t));function A4(r,t="-"){const e={},i="relay"+t;return Object.keys(r).forEach(s=>{if(s.startsWith(i)){const a=s.replace(i,""),u=r[s];e[a]=u}}),e}function gp(r){r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const t=r.indexOf(":"),e=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,t),s=r.substring(t+1,e).split("@"),a=typeof e<"u"?r.substring(e):"",u=ra.parse(a),l=typeof u.methods=="string"?u.methods.split(","):void 0;return{protocol:i,topic:S4(s[0]),version:parseInt(s[1],10),symKey:u.symKey,relay:A4(u),methods:l,expiryTimestamp:u.expiryTimestamp?parseInt(u.expiryTimestamp,10):void 0}}function S4(r){return r.startsWith("//")?r.substring(2):r}function I4(r,t="-"){const e="relay",i={};return Object.keys(r).forEach(s=>{const a=e+t+s;r[s]&&(i[a]=r[s])}),i}function D4(r){return`${r.protocol}:${r.topic}@${r.version}?`+ra.stringify(pp(E4(pp({symKey:r.symKey},I4(r.relay)),{expiryTimestamp:r.expiryTimestamp}),r.methods?{methods:r.methods.join(",")}:{}))}function bo(r){const t=[];return r.forEach(e=>{const[i,s]=e.split(":");t.push(`${i}:${s}`)}),t}function x4(r){const t=[];return Object.values(r).forEach(e=>{t.push(...bo(e.accounts))}),t}function M4(r,t){const e=[];return Object.values(r).forEach(i=>{bo(i.accounts).includes(t)&&e.push(...i.methods)}),e}function C4(r,t){const e=[];return Object.values(r).forEach(i=>{bo(i.accounts).includes(t)&&e.push(...i.events)}),e}function Zl(r){return r.includes(":")}function Jo(r){return Zl(r)?r.split(":")[0]:r}function P4(r){const t={};return r==null||r.forEach(e=>{const[i,s]=e.split(":");t[i]||(t[i]={accounts:[],chains:[],events:[]}),t[i].accounts.push(e),t[i].chains.push(`${i}:${s}`)}),t}function mp(r,t){t=t.map(i=>i.replace("did:pkh:",""));const e=P4(t);for(const[i,s]of Object.entries(e))s.methods?s.methods=Fc(s.methods,r):s.methods=r,s.events=["chainChanged","accountsChanged"];return e}const O4={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},N4={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function gt(r,t){const{message:e,code:i}=N4[r];return{message:t?`${e} ${t}`:e,code:i}}function Re(r,t){const{message:e,code:i}=O4[r];return{message:t?`${e} ${t}`:e,code:i}}function un(r,t){return Array.isArray(r)?typeof t<"u"&&r.length?r.every(t):!0:!1}function oa(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function Nr(r){return typeof r>"u"}function tr(r,t){return t&&Nr(r)?!0:typeof r=="string"&&!!r.trim().length}function tf(r,t){return t&&Nr(r)?!0:typeof r=="number"&&!isNaN(r)}function R4(r,t){const{requiredNamespaces:e}=t,i=Object.keys(r.namespaces),s=Object.keys(e);let a=!0;return Es(s,i)?(i.forEach(u=>{const{accounts:l,methods:d,events:f}=r.namespaces[u],w=bo(l),E=e[u];(!Es(X1(u,E),w)||!Es(E.methods,d)||!Es(E.events,f))&&(a=!1)}),a):!1}function Xc(r){return tr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function T4(r){if(tr(r,!1)&&r.includes(":")){const t=r.split(":");if(t.length===3){const e=t[0]+":"+t[1];return!!t[2]&&Xc(e)}}return!1}function F4(r){if(tr(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function U4(r){var t;return(t=r==null?void 0:r.proposer)==null?void 0:t.publicKey}function B4(r){return r==null?void 0:r.topic}function L4(r,t){let e=null;return tr(r==null?void 0:r.publicKey,!1)||(e=gt("MISSING_OR_INVALID",`${t} controller public key should be a string`)),e}function vp(r){let t=!0;return un(r)?r.length&&(t=r.every(e=>tr(e,!1))):t=!1,t}function q4(r,t,e){let i=null;return un(t)&&t.length?t.forEach(s=>{i||Xc(s)||(i=Re("UNSUPPORTED_CHAINS",`${e}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):Xc(r)||(i=Re("UNSUPPORTED_CHAINS",`${e}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function j4(r,t,e){let i=null;return Object.entries(r).forEach(([s,a])=>{if(i)return;const u=q4(s,X1(s,a),`${t} ${e}`);u&&(i=u)}),i}function $4(r,t){let e=null;return un(r)?r.forEach(i=>{e||T4(i)||(e=Re("UNSUPPORTED_ACCOUNTS",`${t}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):e=Re("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),e}function z4(r,t){let e=null;return Object.values(r).forEach(i=>{if(e)return;const s=$4(i==null?void 0:i.accounts,`${t} namespace`);s&&(e=s)}),e}function k4(r,t){let e=null;return vp(r==null?void 0:r.methods)?vp(r==null?void 0:r.events)||(e=Re("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):e=Re("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),e}function kg(r,t){let e=null;return Object.values(r).forEach(i=>{if(e)return;const s=k4(i,`${t}, namespace`);s&&(e=s)}),e}function H4(r,t,e){let i=null;if(r&&oa(r)){const s=kg(r,t);s&&(i=s);const a=j4(r,t,e);a&&(i=a)}else i=gt("MISSING_OR_INVALID",`${t}, ${e} should be an object with data`);return i}function Gh(r,t){let e=null;if(r&&oa(r)){const i=kg(r,t);i&&(e=i);const s=z4(r,t);s&&(e=s)}else e=gt("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return e}function Hg(r){return tr(r.protocol,!0)}function K4(r,t){let e=!1;return t&&!r?e=!0:r&&un(r)&&r.length&&r.forEach(i=>{e=Hg(i)}),e}function V4(r){return typeof r=="number"}function kr(r){return typeof r<"u"&&typeof r!==null}function G4(r){return!(!r||typeof r!="object"||!r.code||!tf(r.code,!1)||!r.message||!tr(r.message,!1))}function W4(r){return!(Nr(r)||!tr(r.method,!1))}function Y4(r){return!(Nr(r)||Nr(r.result)&&Nr(r.error)||!tf(r.id,!1)||!tr(r.jsonrpc,!1))}function Q4(r){return!(Nr(r)||!tr(r.name,!1))}function yp(r,t){return!(!Xc(t)||!x4(r).includes(t))}function J4(r,t,e){return tr(e,!1)?M4(r,t).includes(e):!1}function X4(r,t,e){return tr(e,!1)?C4(r,t).includes(e):!1}function wp(r,t,e){let i=null;const s=Z4(r),a=tS(t),u=Object.keys(s),l=Object.keys(a),d=bp(Object.keys(r)),f=bp(Object.keys(t)),w=d.filter(E=>!f.includes(E));return w.length&&(i=gt("NON_CONFORMING_NAMESPACES",`${e} namespaces keys don't satisfy requiredNamespaces.
|
|
25
|
+
Required: ${w.toString()}
|
|
26
|
+
Received: ${Object.keys(t).toString()}`)),Es(u,l)||(i=gt("NON_CONFORMING_NAMESPACES",`${e} namespaces chains don't satisfy required namespaces.
|
|
27
|
+
Required: ${u.toString()}
|
|
28
|
+
Approved: ${l.toString()}`)),Object.keys(t).forEach(E=>{if(!E.includes(":")||i)return;const S=bo(t[E].accounts);S.includes(E)||(i=gt("NON_CONFORMING_NAMESPACES",`${e} namespaces accounts don't satisfy namespace accounts for ${E}
|
|
29
|
+
Required: ${E}
|
|
30
|
+
Approved: ${S.toString()}`))}),u.forEach(E=>{i||(Es(s[E].methods,a[E].methods)?Es(s[E].events,a[E].events)||(i=gt("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${E}`)):i=gt("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${E}`))}),i}function Z4(r){const t={};return Object.keys(r).forEach(e=>{var i;e.includes(":")?t[e]=r[e]:(i=r[e].chains)==null||i.forEach(s=>{t[s]={methods:r[e].methods,events:r[e].events}})}),t}function bp(r){return[...new Set(r.map(t=>t.includes(":")?t.split(":")[0]:t))]}function tS(r){const t={};return Object.keys(r).forEach(e=>{if(e.includes(":"))t[e]=r[e];else{const i=bo(r[e].accounts);i==null||i.forEach(s=>{t[s]={accounts:r[e].accounts.filter(a=>a.includes(`${s}:`)),methods:r[e].methods,events:r[e].events}})}}),t}function eS(r,t){return tf(r,!1)&&r<=t.max&&r>=t.min}function _p(){const r=fa();return new Promise(t=>{switch(r){case ei.browser:t(rS());break;case ei.reactNative:t(iS());break;case ei.node:t(nS());break;default:t(!0)}})}function rS(){return go()&&(navigator==null?void 0:navigator.onLine)}async function iS(){if(po()&&typeof Ie<"u"&&Ie!=null&&Ie.NetInfo){const r=await(Ie==null?void 0:Ie.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function nS(){return!0}function sS(r){switch(fa()){case ei.browser:oS(r);break;case ei.reactNative:aS(r);break}}function oS(r){!po()&&go()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function aS(r){var t;po()&&typeof Ie<"u"&&Ie!=null&&Ie.NetInfo&&((t=Ie)==null||t.NetInfo.addEventListener(e=>r(e==null?void 0:e.isConnected)))}const Wh={};class Ko{static get(t){return Wh[t]}static set(t,e){Wh[t]=e}static delete(t){delete Wh[t]}}const cS=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,uS=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,hS=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function lS(r,t){if(r==="__proto__"||r==="constructor"&&t&&typeof t=="object"&&"prototype"in t){fS(r);return}return t}function fS(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function Mc(r,t={}){if(typeof r!="string")return r;const e=r.trim();if(r[0]==='"'&&r.endsWith('"')&&!r.includes("\\"))return e.slice(1,-1);if(e.length<=9){const i=e.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!hS.test(r)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(cS.test(r)||uS.test(r)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,lS)}return JSON.parse(r)}catch(i){if(t.strict)throw i;return r}}function dS(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function lr(r,...t){try{return dS(r(...t))}catch(e){return Promise.reject(e)}}function pS(r){const t=typeof r;return r===null||t!=="object"&&t!=="function"}function gS(r){const t=Object.getPrototypeOf(r);return!t||t.isPrototypeOf(Object)}function $c(r){if(pS(r))return String(r);if(gS(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return $c(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Kg(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const Cl="base64:";function mS(r){if(typeof r=="string")return r;Kg();const t=Buffer.from(r).toString("base64");return Cl+t}function vS(r){return typeof r!="string"||!r.startsWith(Cl)?r:(Kg(),Buffer.from(r.slice(Cl.length),"base64"))}function zr(r){return r?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function yS(...r){return zr(r.join(":"))}function Cc(r){return r=zr(r),r?r+":":""}const wS="memory",bS=()=>{const r=new Map;return{name:wS,options:{},hasItem(t){return r.has(t)},getItem(t){return r.get(t)??null},getItemRaw(t){return r.get(t)??null},setItem(t,e){r.set(t,e)},setItemRaw(t,e){r.set(t,e)},removeItem(t){r.delete(t)},getKeys(){return Array.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};function _S(r={}){const t={mounts:{"":r.driver||bS()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=f=>{for(const w of t.mountpoints)if(f.startsWith(w))return{base:w,relativeKey:f.slice(w.length),driver:t.mounts[w]};return{base:"",relativeKey:f,driver:t.mounts[""]}},i=(f,w)=>t.mountpoints.filter(E=>E.startsWith(f)||w&&f.startsWith(E)).map(E=>({relativeBase:f.length>E.length?f.slice(E.length):void 0,mountpoint:E,driver:t.mounts[E]})),s=(f,w)=>{if(t.watching){w=zr(w);for(const E of t.watchListeners)E(f,w)}},a=async()=>{if(!t.watching){t.watching=!0;for(const f in t.mounts)t.unwatch[f]=await Ep(t.mounts[f],s,f)}},u=async()=>{if(t.watching){for(const f in t.unwatch)await t.unwatch[f]();t.unwatch={},t.watching=!1}},l=(f,w,E)=>{const S=new Map,D=P=>{let Y=S.get(P.base);return Y||(Y={driver:P.driver,base:P.base,items:[]},S.set(P.base,Y)),Y};for(const P of f){const Y=typeof P=="string",G=zr(Y?P:P.key),tt=Y?void 0:P.value,K=Y||!P.options?w:{...w,...P.options},V=e(G);D(V).items.push({key:G,value:tt,relativeKey:V.relativeKey,options:K})}return Promise.all([...S.values()].map(P=>E(P))).then(P=>P.flat())},d={hasItem(f,w={}){f=zr(f);const{relativeKey:E,driver:S}=e(f);return lr(S.hasItem,E,w)},getItem(f,w={}){f=zr(f);const{relativeKey:E,driver:S}=e(f);return lr(S.getItem,E,w).then(D=>Mc(D))},getItems(f,w){return l(f,w,E=>E.driver.getItems?lr(E.driver.getItems,E.items.map(S=>({key:S.relativeKey,options:S.options})),w).then(S=>S.map(D=>({key:yS(E.base,D.key),value:Mc(D.value)}))):Promise.all(E.items.map(S=>lr(E.driver.getItem,S.relativeKey,S.options).then(D=>({key:S.key,value:Mc(D)})))))},getItemRaw(f,w={}){f=zr(f);const{relativeKey:E,driver:S}=e(f);return S.getItemRaw?lr(S.getItemRaw,E,w):lr(S.getItem,E,w).then(D=>vS(D))},async setItem(f,w,E={}){if(w===void 0)return d.removeItem(f);f=zr(f);const{relativeKey:S,driver:D}=e(f);D.setItem&&(await lr(D.setItem,S,$c(w),E),D.watch||s("update",f))},async setItems(f,w){await l(f,w,async E=>{if(E.driver.setItems)return lr(E.driver.setItems,E.items.map(S=>({key:S.relativeKey,value:$c(S.value),options:S.options})),w);E.driver.setItem&&await Promise.all(E.items.map(S=>lr(E.driver.setItem,S.relativeKey,$c(S.value),S.options)))})},async setItemRaw(f,w,E={}){if(w===void 0)return d.removeItem(f,E);f=zr(f);const{relativeKey:S,driver:D}=e(f);if(D.setItemRaw)await lr(D.setItemRaw,S,w,E);else if(D.setItem)await lr(D.setItem,S,mS(w),E);else return;D.watch||s("update",f)},async removeItem(f,w={}){typeof w=="boolean"&&(w={removeMeta:w}),f=zr(f);const{relativeKey:E,driver:S}=e(f);S.removeItem&&(await lr(S.removeItem,E,w),(w.removeMeta||w.removeMata)&&await lr(S.removeItem,E+"$",w),S.watch||s("remove",f))},async getMeta(f,w={}){typeof w=="boolean"&&(w={nativeOnly:w}),f=zr(f);const{relativeKey:E,driver:S}=e(f),D=Object.create(null);if(S.getMeta&&Object.assign(D,await lr(S.getMeta,E,w)),!w.nativeOnly){const P=await lr(S.getItem,E+"$",w).then(Y=>Mc(Y));P&&typeof P=="object"&&(typeof P.atime=="string"&&(P.atime=new Date(P.atime)),typeof P.mtime=="string"&&(P.mtime=new Date(P.mtime)),Object.assign(D,P))}return D},setMeta(f,w,E={}){return this.setItem(f+"$",w,E)},removeMeta(f,w={}){return this.removeItem(f+"$",w)},async getKeys(f,w={}){f=Cc(f);const E=i(f,!0);let S=[];const D=[];for(const P of E){const G=(await lr(P.driver.getKeys,P.relativeBase,w)).map(tt=>P.mountpoint+zr(tt)).filter(tt=>!S.some(K=>tt.startsWith(K)));D.push(...G),S=[P.mountpoint,...S.filter(tt=>!tt.startsWith(P.mountpoint))]}return f?D.filter(P=>P.startsWith(f)&&!P.endsWith("$")):D.filter(P=>!P.endsWith("$"))},async clear(f,w={}){f=Cc(f),await Promise.all(i(f,!1).map(async E=>{if(E.driver.clear)return lr(E.driver.clear,E.relativeBase,w);if(E.driver.removeItem){const S=await E.driver.getKeys(E.relativeBase||"",w);return Promise.all(S.map(D=>E.driver.removeItem(D,w)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(f=>Ap(f)))},async watch(f){return await a(),t.watchListeners.push(f),async()=>{t.watchListeners=t.watchListeners.filter(w=>w!==f),t.watchListeners.length===0&&await u()}},async unwatch(){t.watchListeners=[],await u()},mount(f,w){if(f=Cc(f),f&&t.mounts[f])throw new Error(`already mounted at ${f}`);return f&&(t.mountpoints.push(f),t.mountpoints.sort((E,S)=>S.length-E.length)),t.mounts[f]=w,t.watching&&Promise.resolve(Ep(w,s,f)).then(E=>{t.unwatch[f]=E}).catch(console.error),d},async unmount(f,w=!0){f=Cc(f),!(!f||!t.mounts[f])&&(t.watching&&f in t.unwatch&&(t.unwatch[f](),delete t.unwatch[f]),w&&await Ap(t.mounts[f]),t.mountpoints=t.mountpoints.filter(E=>E!==f),delete t.mounts[f])},getMount(f=""){f=zr(f)+":";const w=e(f);return{driver:w.driver,base:w.base}},getMounts(f="",w={}){return f=zr(f),i(f,w.parents).map(S=>({driver:S.driver,base:S.mountpoint}))}};return d}function Ep(r,t,e){return r.watch?r.watch((i,s)=>t(i,e+s)):()=>{}}async function Ap(r){typeof r.dispose=="function"&&await lr(r.dispose)}function Cs(r){return new Promise((t,e)=>{r.oncomplete=r.onsuccess=()=>t(r.result),r.onabort=r.onerror=()=>e(r.error)})}function Vg(r,t){const e=indexedDB.open(r);e.onupgradeneeded=()=>e.result.createObjectStore(t);const i=Cs(e);return(s,a)=>i.then(u=>a(u.transaction(t,s).objectStore(t)))}let Yh;function ga(){return Yh||(Yh=Vg("keyval-store","keyval")),Yh}function Sp(r,t=ga()){return t("readonly",e=>Cs(e.get(r)))}function ES(r,t,e=ga()){return e("readwrite",i=>(i.put(t,r),Cs(i.transaction)))}function AS(r,t=ga()){return t("readwrite",e=>(e.delete(r),Cs(e.transaction)))}function SS(r=ga()){return r("readwrite",t=>(t.clear(),Cs(t.transaction)))}function IS(r,t){return r.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},Cs(r.transaction)}function DS(r=ga()){return r("readonly",t=>{if(t.getAllKeys)return Cs(t.getAllKeys());const e=[];return IS(t,i=>e.push(i.key)).then(()=>e)})}const xS=r=>JSON.stringify(r,(t,e)=>typeof e=="bigint"?e.toString()+"n":e),MS=r=>{const t=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,e=r.replace(t,'$1"$2n"$3');return JSON.parse(e,(i,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function ma(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return MS(r)}catch{return r}}function Mn(r){return typeof r=="string"?r:xS(r)||""}const CS="idb-keyval";var PS=(r={})=>{const t=r.base&&r.base.length>0?`${r.base}:`:"",e=s=>t+s;let i;return r.dbName&&r.storeName&&(i=Vg(r.dbName,r.storeName)),{name:CS,options:r,async hasItem(s){return!(typeof await Sp(e(s),i)>"u")},async getItem(s){return await Sp(e(s),i)??null},setItem(s,a){return ES(e(s),a,i)},removeItem(s){return AS(e(s),i)},getKeys(){return DS(i)},clear(){return SS(i)}}};const OS="WALLET_CONNECT_V2_INDEXED_DB",NS="keyvaluestorage";let RS=class{constructor(){this.indexedDb=_S({driver:PS({dbName:OS,storeName:NS})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const e=await this.indexedDb.getItem(t);if(e!==null)return e}async setItem(t,e){await this.indexedDb.setItem(t,Mn(e))}async removeItem(t){await this.indexedDb.removeItem(t)}};var Qh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ie<"u"?Ie:typeof self<"u"?self:{},zc={exports:{}};(function(){let r;function t(){}r=t,r.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},r.prototype.setItem=function(e,i){this[e]=String(i)},r.prototype.removeItem=function(e){delete this[e]},r.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(i){e[i]=void 0,delete e[i]})},r.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Qh<"u"&&Qh.localStorage?zc.exports=Qh.localStorage:typeof window<"u"&&window.localStorage?zc.exports=window.localStorage:zc.exports=new t})();function TS(r){var t;return[r[0],ma((t=r[1])!=null?t:"")]}class FS{constructor(){this.localStorage=zc.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(TS)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return ma(e)}async setItem(t,e){this.localStorage.setItem(t,Mn(e))}async removeItem(t){this.localStorage.removeItem(t)}}const US="wc_storage_version",Ip=1,BS=async(r,t,e)=>{const i=US,s=await t.getItem(i);if(s&&s>=Ip){e(t);return}const a=await r.getKeys();if(!a.length){e(t);return}const u=[];for(;a.length;){const l=a.shift();if(!l)continue;const d=l.toLowerCase();if(d.includes("wc@")||d.includes("walletconnect")||d.includes("wc_")||d.includes("wallet_connect")){const f=await r.getItem(l);await t.setItem(l,f),u.push(l)}}await t.setItem(i,Ip),e(t),LS(r,u)},LS=async(r,t)=>{t.length&&t.forEach(async e=>{await r.removeItem(e)})};let qS=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new FS;this.storage=t;try{const e=new RS;BS(t,e,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,e){return await this.initialize(),this.storage.setItem(t,e)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const e=setInterval(()=>{this.initialized&&(clearInterval(e),t())},20)})}};class Ps{}let jS=class extends Ps{constructor(t){super()}};const Dp=yt.FIVE_SECONDS,va={pulse:"heartbeat_pulse"};let $S=class Gg extends jS{constructor(t){super(t),this.events=new Di.EventEmitter,this.interval=Dp,this.interval=(t==null?void 0:t.interval)||Dp}static async init(t){const e=new Gg(t);return await e.init(),e}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),yt.toMiliseconds(this.interval))}pulse(){this.events.emit(va.pulse)}};function zS(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}var kS=HS;function HS(r,t,e){var i=e&&e.stringify||zS,s=1;if(typeof r=="object"&&r!==null){var a=t.length+s;if(a===1)return r;var u=new Array(a);u[0]=i(r);for(var l=1;l<a;l++)u[l]=i(t[l]);return u.join(" ")}if(typeof r!="string")return r;var d=t.length;if(d===0)return r;for(var f="",w=1-s,E=-1,S=r&&r.length||0,D=0;D<S;){if(r.charCodeAt(D)===37&&D+1<S){switch(E=E>-1?E:0,r.charCodeAt(D+1)){case 100:case 102:if(w>=d||t[w]==null)break;E<D&&(f+=r.slice(E,D)),f+=Number(t[w]),E=D+2,D++;break;case 105:if(w>=d||t[w]==null)break;E<D&&(f+=r.slice(E,D)),f+=Math.floor(Number(t[w])),E=D+2,D++;break;case 79:case 111:case 106:if(w>=d||t[w]===void 0)break;E<D&&(f+=r.slice(E,D));var P=typeof t[w];if(P==="string"){f+="'"+t[w]+"'",E=D+2,D++;break}if(P==="function"){f+=t[w].name||"<anonymous>",E=D+2,D++;break}f+=i(t[w]),E=D+2,D++;break;case 115:if(w>=d)break;E<D&&(f+=r.slice(E,D)),f+=String(t[w]),E=D+2,D++;break;case 37:E<D&&(f+=r.slice(E,D)),f+="%",E=D+2,D++,w--;break}++w}++D}return E===-1?r:(E<S&&(f+=r.slice(E)),f)}const xp=kS;var eo=cn;const aa=tI().console||{},KS={mapHttpRequest:Pc,mapHttpResponse:Pc,wrapRequestSerializer:Jh,wrapResponseSerializer:Jh,wrapErrorSerializer:Jh,req:Pc,res:Pc,err:QS};function VS(r,t){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(t):!1}function cn(r){r=r||{},r.browser=r.browser||{};const t=r.browser.transmit;if(t&&typeof t.send!="function")throw Error("pino: transmit option must have a send function");const e=r.browser.write||aa;r.browser.write&&(r.browser.asObject=!0);const i=r.serializers||{},s=VS(r.browser.serialize,i);let a=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);const u=["error","fatal","warn","info","debug","trace"];typeof e=="function"&&(e.error=e.fatal=e.warn=e.info=e.debug=e.trace=e),r.enabled===!1&&(r.level="silent");const l=r.level||"info",d=Object.create(e);d.log||(d.log=ca),Object.defineProperty(d,"levelVal",{get:w}),Object.defineProperty(d,"level",{get:E,set:S});const f={transmit:t,serialize:s,asObject:r.browser.asObject,levels:u,timestamp:JS(r)};d.levels=cn.levels,d.level=l,d.setMaxListeners=d.getMaxListeners=d.emit=d.addListener=d.on=d.prependListener=d.once=d.prependOnceListener=d.removeListener=d.removeAllListeners=d.listeners=d.listenerCount=d.eventNames=d.write=d.flush=ca,d.serializers=i,d._serialize=s,d._stdErrSerialize=a,d.child=D,t&&(d._logEvent=Pl());function w(){return this.level==="silent"?1/0:this.levels.values[this.level]}function E(){return this._level}function S(P){if(P!=="silent"&&!this.levels.values[P])throw Error("unknown level "+P);this._level=P,Js(f,d,"error","log"),Js(f,d,"fatal","error"),Js(f,d,"warn","error"),Js(f,d,"info","log"),Js(f,d,"debug","log"),Js(f,d,"trace","log")}function D(P,Y){if(!P)throw new Error("missing bindings for child Pino");Y=Y||{},s&&P.serializers&&(Y.serializers=P.serializers);const G=Y.serializers;if(s&&G){var tt=Object.assign({},i,G),K=r.browser.serialize===!0?Object.keys(tt):s;delete P.serializers,lu([P],K,tt,this._stdErrSerialize)}function V(B){this._childLevel=(B._childLevel|0)+1,this.error=Xs(B,P,"error"),this.fatal=Xs(B,P,"fatal"),this.warn=Xs(B,P,"warn"),this.info=Xs(B,P,"info"),this.debug=Xs(B,P,"debug"),this.trace=Xs(B,P,"trace"),tt&&(this.serializers=tt,this._serialize=K),t&&(this._logEvent=Pl([].concat(B._logEvent.bindings,P)))}return V.prototype=this,new V(this)}return d}cn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};cn.stdSerializers=KS;cn.stdTimeFunctions=Object.assign({},{nullTime:Wg,epochTime:Yg,unixTime:XS,isoTime:ZS});function Js(r,t,e,i){const s=Object.getPrototypeOf(t);t[e]=t.levelVal>t.levels.values[e]?ca:s[e]?s[e]:aa[e]||aa[i]||ca,GS(r,t,e)}function GS(r,t,e){!r.transmit&&t[e]===ca||(t[e]=function(i){return function(){const a=r.timestamp(),u=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===aa?aa:this;for(var d=0;d<u.length;d++)u[d]=arguments[d];if(r.serialize&&!r.asObject&&lu(u,this._serialize,this.serializers,this._stdErrSerialize),r.asObject?i.call(l,WS(this,e,u,a)):i.apply(l,u),r.transmit){const f=r.transmit.level||t.level,w=cn.levels.values[f],E=cn.levels.values[e];if(E<w)return;YS(this,{ts:a,methodLevel:e,methodValue:E,transmitLevel:f,transmitValue:cn.levels.values[r.transmit.level||t.level],send:r.transmit.send,val:t.levelVal},u)}}}(t[e]))}function WS(r,t,e,i){r._serialize&&lu(e,r._serialize,r.serializers,r._stdErrSerialize);const s=e.slice();let a=s[0];const u={};i&&(u.time=i),u.level=cn.levels.values[t];let l=(r._childLevel|0)+1;if(l<1&&(l=1),a!==null&&typeof a=="object"){for(;l--&&typeof s[0]=="object";)Object.assign(u,s.shift());a=s.length?xp(s.shift(),s):void 0}else typeof a=="string"&&(a=xp(s.shift(),s));return a!==void 0&&(u.msg=a),u}function lu(r,t,e,i){for(const s in r)if(i&&r[s]instanceof Error)r[s]=cn.stdSerializers.err(r[s]);else if(typeof r[s]=="object"&&!Array.isArray(r[s]))for(const a in r[s])t&&t.indexOf(a)>-1&&a in e&&(r[s][a]=e[a](r[s][a]))}function Xs(r,t,e){return function(){const i=new Array(1+arguments.length);i[0]=t;for(var s=1;s<i.length;s++)i[s]=arguments[s-1];return r[e].apply(this,i)}}function YS(r,t,e){const i=t.send,s=t.ts,a=t.methodLevel,u=t.methodValue,l=t.val,d=r._logEvent.bindings;lu(e,r._serialize||Object.keys(r.serializers),r.serializers,r._stdErrSerialize===void 0?!0:r._stdErrSerialize),r._logEvent.ts=s,r._logEvent.messages=e.filter(function(f){return d.indexOf(f)===-1}),r._logEvent.level.label=a,r._logEvent.level.value=u,i(a,r._logEvent,l),r._logEvent=Pl(d)}function Pl(r){return{ts:0,messages:[],bindings:r||[],level:{label:"",value:0}}}function QS(r){const t={type:r.constructor.name,msg:r.message,stack:r.stack};for(const e in r)t[e]===void 0&&(t[e]=r[e]);return t}function JS(r){return typeof r.timestamp=="function"?r.timestamp:r.timestamp===!1?Wg:Yg}function Pc(){return{}}function Jh(r){return r}function ca(){}function Wg(){return!1}function Yg(){return Date.now()}function XS(){return Math.round(Date.now()/1e3)}function ZS(){return new Date(Date.now()).toISOString()}function tI(){function r(t){return typeof t<"u"&&t}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return r(self)||r(window)||r(this)||{}}}const ya=Bl(eo),eI={level:"info"},wa="custom_context",ef=1e3*1024;let rI=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},Mp=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new rI(t);if(e.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${e.size}`);for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let e=this.head;for(;e!==null;)t.push(e.value),e=e.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const e=t.value;return t=t.next,{done:!1,value:e}}}}},Qg=class{constructor(t,e=ef){this.level=t??"error",this.levelValue=eo.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new Mp(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===eo.levels.values.error?console.error(t):e===eo.levels.values.warn?console.warn(t):e===eo.levels.values.debug?console.debug(t):e===eo.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(Mn({timestamp:new Date().toISOString(),log:t}));const e=typeof t=="string"?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}getLogs(){return this.logs}clearLogs(){this.logs=new Mp(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(Mn({extraMetadata:t})),new Blob(e,{type:"application/json"})}},iI=class{constructor(t,e=ef){this.baseChunkLogger=new Qg(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const e=URL.createObjectURL(this.logsToBlob(t)),i=document.createElement("a");i.href=e,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(e)}},nI=class{constructor(t,e=ef){this.baseChunkLogger=new Qg(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var sI=Object.defineProperty,oI=Object.defineProperties,aI=Object.getOwnPropertyDescriptors,Cp=Object.getOwnPropertySymbols,cI=Object.prototype.hasOwnProperty,uI=Object.prototype.propertyIsEnumerable,Pp=(r,t,e)=>t in r?sI(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Zc=(r,t)=>{for(var e in t||(t={}))cI.call(t,e)&&Pp(r,e,t[e]);if(Cp)for(var e of Cp(t))uI.call(t,e)&&Pp(r,e,t[e]);return r},tu=(r,t)=>oI(r,aI(t));function fu(r){return tu(Zc({},r),{level:(r==null?void 0:r.level)||eI.level})}function hI(r,t=wa){return r[t]||""}function lI(r,t,e=wa){return r[e]=t,r}function Gr(r,t=wa){let e="";return typeof r.bindings>"u"?e=hI(r,t):e=r.bindings().context||"",e}function fI(r,t,e=wa){const i=Gr(r,e);return i.trim()?`${i}/${t}`:t}function Wr(r,t,e=wa){const i=fI(r,t,e),s=r.child({context:i});return lI(s,i,e)}function dI(r){var t,e;const i=new iI((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:ya(tu(Zc({},r.opts),{level:"trace",browser:tu(Zc({},(e=r.opts)==null?void 0:e.browser),{write:s=>i.write(s)})})),chunkLoggerController:i}}function pI(r){var t;const e=new nI((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:ya(tu(Zc({},r.opts),{level:"trace"}),e),chunkLoggerController:e}}function gI(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?dI(r):pI(r)}let mI=class extends Ps{constructor(t){super(),this.opts=t,this.protocol="wc",this.version=2}},vI=class extends Ps{constructor(t,e){super(),this.core=t,this.logger=e,this.records=new Map}},yI=class{constructor(t,e){this.logger=t,this.core=e}},wI=class extends Ps{constructor(t,e){super(),this.relayer=t,this.logger=e}},bI=class extends Ps{constructor(t){super()}},_I=class{constructor(t,e,i,s){this.core=t,this.logger=e,this.name=i}},EI=class extends Ps{constructor(t,e){super(),this.relayer=t,this.logger=e}},AI=class extends Ps{constructor(t,e){super(),this.core=t,this.logger=e}},SI=class{constructor(t,e){this.projectId=t,this.logger=e}},II=class{constructor(t,e){this.projectId=t,this.logger=e}},DI=class{constructor(t){this.opts=t,this.protocol="wc",this.version=2}},xI=class{constructor(t){this.client=t}};var rf={},Jg={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=oe,e=si;r.DIGEST_LENGTH=64,r.BLOCK_SIZE=128;var i=function(){function l(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return l.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){e.wipe(this._buffer),e.wipe(this._tempHi),e.wipe(this._tempLo),this.reset()},l.prototype.update=function(d,f){if(f===void 0&&(f=d.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var w=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<r.BLOCK_SIZE&&f>0;)this._buffer[this._bufferLength++]=d[w++],f--;this._bufferLength===this.blockSize&&(a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(w=a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,d,w,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=d[w++],f--;return this},l.prototype.finish=function(d){if(!this._finished){var f=this._bytesHashed,w=this._bufferLength,E=f/536870912|0,S=f<<3,D=f%128<112?128:256;this._buffer[w]=128;for(var P=w+1;P<D-8;P++)this._buffer[P]=0;t.writeUint32BE(E,this._buffer,D-8),t.writeUint32BE(S,this._buffer,D-4),a(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,D),this._finished=!0}for(var P=0;P<this.digestLength/8;P++)t.writeUint32BE(this._stateHi[P],d,P*8),t.writeUint32BE(this._stateLo[P],d,P*8+4);return this},l.prototype.digest=function(){var d=new Uint8Array(this.digestLength);return this.finish(d),d},l.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},l.prototype.restoreState=function(d){return this._stateHi.set(d.stateHi),this._stateLo.set(d.stateLo),this._bufferLength=d.bufferLength,d.buffer&&this._buffer.set(d.buffer),this._bytesHashed=d.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(d){e.wipe(d.stateHi),e.wipe(d.stateLo),d.buffer&&e.wipe(d.buffer),d.bufferLength=0,d.bytesHashed=0},l}();r.SHA512=i;var s=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function a(l,d,f,w,E,S,D){for(var P=f[0],Y=f[1],G=f[2],tt=f[3],K=f[4],V=f[5],B=f[6],z=f[7],$=w[0],v=w[1],T=w[2],nt=w[3],ft=w[4],pt=w[5],mt=w[6],h=w[7],y,b,M,C,R,j,I,g;D>=128;){for(var N=0;N<16;N++){var it=8*N+S;l[N]=t.readUint32BE(E,it),d[N]=t.readUint32BE(E,it+4)}for(var N=0;N<80;N++){var lt=P,_=Y,Z=G,U=tt,L=K,k=V,p=B,F=z,et=$,ut=v,at=T,Mt=nt,Pt=ft,It=pt,Ee=mt,$t=h;if(y=z,b=h,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=(K>>>14|ft<<32-14)^(K>>>18|ft<<32-18)^(ft>>>41-32|K<<32-(41-32)),b=(ft>>>14|K<<32-14)^(ft>>>18|K<<32-18)^(K>>>41-32|ft<<32-(41-32)),R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,y=K&V^~K&B,b=ft&pt^~ft&mt,R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,y=s[N*2],b=s[N*2+1],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,y=l[N%16],b=d[N%16],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,M=I&65535|g<<16,C=R&65535|j<<16,y=M,b=C,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=(P>>>28|$<<32-28)^($>>>34-32|P<<32-(34-32))^($>>>39-32|P<<32-(39-32)),b=($>>>28|P<<32-28)^(P>>>34-32|$<<32-(34-32))^(P>>>39-32|$<<32-(39-32)),R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,y=P&Y^P&G^Y&G,b=$&v^$&T^v&T,R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,F=I&65535|g<<16,$t=R&65535|j<<16,y=U,b=Mt,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=M,b=C,R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,U=I&65535|g<<16,Mt=R&65535|j<<16,Y=lt,G=_,tt=Z,K=U,V=L,B=k,z=p,P=F,v=et,T=ut,nt=at,ft=Mt,pt=Pt,mt=It,h=Ee,$=$t,N%16===15)for(var it=0;it<16;it++)y=l[it],b=d[it],R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=l[(it+9)%16],b=d[(it+9)%16],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,M=l[(it+1)%16],C=d[(it+1)%16],y=(M>>>1|C<<32-1)^(M>>>8|C<<32-8)^M>>>7,b=(C>>>1|M<<32-1)^(C>>>8|M<<32-8)^(C>>>7|M<<32-7),R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,M=l[(it+14)%16],C=d[(it+14)%16],y=(M>>>19|C<<32-19)^(C>>>61-32|M<<32-(61-32))^M>>>6,b=(C>>>19|M<<32-19)^(M>>>61-32|C<<32-(61-32))^(C>>>6|M<<32-6),R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,l[it]=I&65535|g<<16,d[it]=R&65535|j<<16}y=P,b=$,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=f[0],b=w[0],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,f[0]=P=I&65535|g<<16,w[0]=$=R&65535|j<<16,y=Y,b=v,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=f[1],b=w[1],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,f[1]=Y=I&65535|g<<16,w[1]=v=R&65535|j<<16,y=G,b=T,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=f[2],b=w[2],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,f[2]=G=I&65535|g<<16,w[2]=T=R&65535|j<<16,y=tt,b=nt,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=f[3],b=w[3],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,f[3]=tt=I&65535|g<<16,w[3]=nt=R&65535|j<<16,y=K,b=ft,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=f[4],b=w[4],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,f[4]=K=I&65535|g<<16,w[4]=ft=R&65535|j<<16,y=V,b=pt,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=f[5],b=w[5],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,f[5]=V=I&65535|g<<16,w[5]=pt=R&65535|j<<16,y=B,b=mt,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=f[6],b=w[6],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,f[6]=B=I&65535|g<<16,w[6]=mt=R&65535|j<<16,y=z,b=h,R=b&65535,j=b>>>16,I=y&65535,g=y>>>16,y=f[7],b=w[7],R+=b&65535,j+=b>>>16,I+=y&65535,g+=y>>>16,j+=R>>>16,I+=j>>>16,g+=I>>>16,f[7]=z=I&65535|g<<16,w[7]=h=R&65535|j<<16,S+=128,D-=128}return S}function u(l){var d=new i;d.update(l);var f=d.digest();return d.clean(),f}r.hash=u})(Jg);(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertSecretKeyToX25519=r.convertPublicKeyToX25519=r.verify=r.sign=r.extractPublicKeyFromSecretKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.SEED_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=r.SIGNATURE_LENGTH=void 0;const t=fo,e=Jg,i=si;r.SIGNATURE_LENGTH=64,r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=64,r.SEED_LENGTH=32;function s(U){const L=new Float64Array(16);if(U)for(let k=0;k<U.length;k++)L[k]=U[k];return L}const a=new Uint8Array(32);a[0]=9;const u=s(),l=s([1]),d=s([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),f=s([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),w=s([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),E=s([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),S=s([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function D(U,L){for(let k=0;k<16;k++)U[k]=L[k]|0}function P(U){let L=1;for(let k=0;k<16;k++){let p=U[k]+L+65535;L=Math.floor(p/65536),U[k]=p-L*65536}U[0]+=L-1+37*(L-1)}function Y(U,L,k){const p=~(k-1);for(let F=0;F<16;F++){const et=p&(U[F]^L[F]);U[F]^=et,L[F]^=et}}function G(U,L){const k=s(),p=s();for(let F=0;F<16;F++)p[F]=L[F];P(p),P(p),P(p);for(let F=0;F<2;F++){k[0]=p[0]-65517;for(let ut=1;ut<15;ut++)k[ut]=p[ut]-65535-(k[ut-1]>>16&1),k[ut-1]&=65535;k[15]=p[15]-32767-(k[14]>>16&1);const et=k[15]>>16&1;k[14]&=65535,Y(p,k,1-et)}for(let F=0;F<16;F++)U[2*F]=p[F]&255,U[2*F+1]=p[F]>>8}function tt(U,L){let k=0;for(let p=0;p<32;p++)k|=U[p]^L[p];return(1&k-1>>>8)-1}function K(U,L){const k=new Uint8Array(32),p=new Uint8Array(32);return G(k,U),G(p,L),tt(k,p)}function V(U){const L=new Uint8Array(32);return G(L,U),L[0]&1}function B(U,L){for(let k=0;k<16;k++)U[k]=L[2*k]+(L[2*k+1]<<8);U[15]&=32767}function z(U,L,k){for(let p=0;p<16;p++)U[p]=L[p]+k[p]}function $(U,L,k){for(let p=0;p<16;p++)U[p]=L[p]-k[p]}function v(U,L,k){let p,F,et=0,ut=0,at=0,Mt=0,Pt=0,It=0,Ee=0,$t=0,xt=0,Bt=0,_t=0,Et=0,Vt=0,wt=0,At=0,Ut=0,bt=0,Ct=0,Lt=0,Ot=0,Nt=0,se=0,Tt=0,Rt=0,Ke=0,ce=0,pe=0,Ve=0,ye=0,_e=0,Ar=0,Gt=k[0],zt=k[1],De=k[2],Wt=k[3],Kt=k[4],Ae=k[5],Jt=k[6],Xt=k[7],xe=k[8],Zt=k[9],Yt=k[10],Ce=k[11],Qt=k[12],qt=k[13],Te=k[14],te=k[15];p=L[0],et+=p*Gt,ut+=p*zt,at+=p*De,Mt+=p*Wt,Pt+=p*Kt,It+=p*Ae,Ee+=p*Jt,$t+=p*Xt,xt+=p*xe,Bt+=p*Zt,_t+=p*Yt,Et+=p*Ce,Vt+=p*Qt,wt+=p*qt,At+=p*Te,Ut+=p*te,p=L[1],ut+=p*Gt,at+=p*zt,Mt+=p*De,Pt+=p*Wt,It+=p*Kt,Ee+=p*Ae,$t+=p*Jt,xt+=p*Xt,Bt+=p*xe,_t+=p*Zt,Et+=p*Yt,Vt+=p*Ce,wt+=p*Qt,At+=p*qt,Ut+=p*Te,bt+=p*te,p=L[2],at+=p*Gt,Mt+=p*zt,Pt+=p*De,It+=p*Wt,Ee+=p*Kt,$t+=p*Ae,xt+=p*Jt,Bt+=p*Xt,_t+=p*xe,Et+=p*Zt,Vt+=p*Yt,wt+=p*Ce,At+=p*Qt,Ut+=p*qt,bt+=p*Te,Ct+=p*te,p=L[3],Mt+=p*Gt,Pt+=p*zt,It+=p*De,Ee+=p*Wt,$t+=p*Kt,xt+=p*Ae,Bt+=p*Jt,_t+=p*Xt,Et+=p*xe,Vt+=p*Zt,wt+=p*Yt,At+=p*Ce,Ut+=p*Qt,bt+=p*qt,Ct+=p*Te,Lt+=p*te,p=L[4],Pt+=p*Gt,It+=p*zt,Ee+=p*De,$t+=p*Wt,xt+=p*Kt,Bt+=p*Ae,_t+=p*Jt,Et+=p*Xt,Vt+=p*xe,wt+=p*Zt,At+=p*Yt,Ut+=p*Ce,bt+=p*Qt,Ct+=p*qt,Lt+=p*Te,Ot+=p*te,p=L[5],It+=p*Gt,Ee+=p*zt,$t+=p*De,xt+=p*Wt,Bt+=p*Kt,_t+=p*Ae,Et+=p*Jt,Vt+=p*Xt,wt+=p*xe,At+=p*Zt,Ut+=p*Yt,bt+=p*Ce,Ct+=p*Qt,Lt+=p*qt,Ot+=p*Te,Nt+=p*te,p=L[6],Ee+=p*Gt,$t+=p*zt,xt+=p*De,Bt+=p*Wt,_t+=p*Kt,Et+=p*Ae,Vt+=p*Jt,wt+=p*Xt,At+=p*xe,Ut+=p*Zt,bt+=p*Yt,Ct+=p*Ce,Lt+=p*Qt,Ot+=p*qt,Nt+=p*Te,se+=p*te,p=L[7],$t+=p*Gt,xt+=p*zt,Bt+=p*De,_t+=p*Wt,Et+=p*Kt,Vt+=p*Ae,wt+=p*Jt,At+=p*Xt,Ut+=p*xe,bt+=p*Zt,Ct+=p*Yt,Lt+=p*Ce,Ot+=p*Qt,Nt+=p*qt,se+=p*Te,Tt+=p*te,p=L[8],xt+=p*Gt,Bt+=p*zt,_t+=p*De,Et+=p*Wt,Vt+=p*Kt,wt+=p*Ae,At+=p*Jt,Ut+=p*Xt,bt+=p*xe,Ct+=p*Zt,Lt+=p*Yt,Ot+=p*Ce,Nt+=p*Qt,se+=p*qt,Tt+=p*Te,Rt+=p*te,p=L[9],Bt+=p*Gt,_t+=p*zt,Et+=p*De,Vt+=p*Wt,wt+=p*Kt,At+=p*Ae,Ut+=p*Jt,bt+=p*Xt,Ct+=p*xe,Lt+=p*Zt,Ot+=p*Yt,Nt+=p*Ce,se+=p*Qt,Tt+=p*qt,Rt+=p*Te,Ke+=p*te,p=L[10],_t+=p*Gt,Et+=p*zt,Vt+=p*De,wt+=p*Wt,At+=p*Kt,Ut+=p*Ae,bt+=p*Jt,Ct+=p*Xt,Lt+=p*xe,Ot+=p*Zt,Nt+=p*Yt,se+=p*Ce,Tt+=p*Qt,Rt+=p*qt,Ke+=p*Te,ce+=p*te,p=L[11],Et+=p*Gt,Vt+=p*zt,wt+=p*De,At+=p*Wt,Ut+=p*Kt,bt+=p*Ae,Ct+=p*Jt,Lt+=p*Xt,Ot+=p*xe,Nt+=p*Zt,se+=p*Yt,Tt+=p*Ce,Rt+=p*Qt,Ke+=p*qt,ce+=p*Te,pe+=p*te,p=L[12],Vt+=p*Gt,wt+=p*zt,At+=p*De,Ut+=p*Wt,bt+=p*Kt,Ct+=p*Ae,Lt+=p*Jt,Ot+=p*Xt,Nt+=p*xe,se+=p*Zt,Tt+=p*Yt,Rt+=p*Ce,Ke+=p*Qt,ce+=p*qt,pe+=p*Te,Ve+=p*te,p=L[13],wt+=p*Gt,At+=p*zt,Ut+=p*De,bt+=p*Wt,Ct+=p*Kt,Lt+=p*Ae,Ot+=p*Jt,Nt+=p*Xt,se+=p*xe,Tt+=p*Zt,Rt+=p*Yt,Ke+=p*Ce,ce+=p*Qt,pe+=p*qt,Ve+=p*Te,ye+=p*te,p=L[14],At+=p*Gt,Ut+=p*zt,bt+=p*De,Ct+=p*Wt,Lt+=p*Kt,Ot+=p*Ae,Nt+=p*Jt,se+=p*Xt,Tt+=p*xe,Rt+=p*Zt,Ke+=p*Yt,ce+=p*Ce,pe+=p*Qt,Ve+=p*qt,ye+=p*Te,_e+=p*te,p=L[15],Ut+=p*Gt,bt+=p*zt,Ct+=p*De,Lt+=p*Wt,Ot+=p*Kt,Nt+=p*Ae,se+=p*Jt,Tt+=p*Xt,Rt+=p*xe,Ke+=p*Zt,ce+=p*Yt,pe+=p*Ce,Ve+=p*Qt,ye+=p*qt,_e+=p*Te,Ar+=p*te,et+=38*bt,ut+=38*Ct,at+=38*Lt,Mt+=38*Ot,Pt+=38*Nt,It+=38*se,Ee+=38*Tt,$t+=38*Rt,xt+=38*Ke,Bt+=38*ce,_t+=38*pe,Et+=38*Ve,Vt+=38*ye,wt+=38*_e,At+=38*Ar,F=1,p=et+F+65535,F=Math.floor(p/65536),et=p-F*65536,p=ut+F+65535,F=Math.floor(p/65536),ut=p-F*65536,p=at+F+65535,F=Math.floor(p/65536),at=p-F*65536,p=Mt+F+65535,F=Math.floor(p/65536),Mt=p-F*65536,p=Pt+F+65535,F=Math.floor(p/65536),Pt=p-F*65536,p=It+F+65535,F=Math.floor(p/65536),It=p-F*65536,p=Ee+F+65535,F=Math.floor(p/65536),Ee=p-F*65536,p=$t+F+65535,F=Math.floor(p/65536),$t=p-F*65536,p=xt+F+65535,F=Math.floor(p/65536),xt=p-F*65536,p=Bt+F+65535,F=Math.floor(p/65536),Bt=p-F*65536,p=_t+F+65535,F=Math.floor(p/65536),_t=p-F*65536,p=Et+F+65535,F=Math.floor(p/65536),Et=p-F*65536,p=Vt+F+65535,F=Math.floor(p/65536),Vt=p-F*65536,p=wt+F+65535,F=Math.floor(p/65536),wt=p-F*65536,p=At+F+65535,F=Math.floor(p/65536),At=p-F*65536,p=Ut+F+65535,F=Math.floor(p/65536),Ut=p-F*65536,et+=F-1+37*(F-1),F=1,p=et+F+65535,F=Math.floor(p/65536),et=p-F*65536,p=ut+F+65535,F=Math.floor(p/65536),ut=p-F*65536,p=at+F+65535,F=Math.floor(p/65536),at=p-F*65536,p=Mt+F+65535,F=Math.floor(p/65536),Mt=p-F*65536,p=Pt+F+65535,F=Math.floor(p/65536),Pt=p-F*65536,p=It+F+65535,F=Math.floor(p/65536),It=p-F*65536,p=Ee+F+65535,F=Math.floor(p/65536),Ee=p-F*65536,p=$t+F+65535,F=Math.floor(p/65536),$t=p-F*65536,p=xt+F+65535,F=Math.floor(p/65536),xt=p-F*65536,p=Bt+F+65535,F=Math.floor(p/65536),Bt=p-F*65536,p=_t+F+65535,F=Math.floor(p/65536),_t=p-F*65536,p=Et+F+65535,F=Math.floor(p/65536),Et=p-F*65536,p=Vt+F+65535,F=Math.floor(p/65536),Vt=p-F*65536,p=wt+F+65535,F=Math.floor(p/65536),wt=p-F*65536,p=At+F+65535,F=Math.floor(p/65536),At=p-F*65536,p=Ut+F+65535,F=Math.floor(p/65536),Ut=p-F*65536,et+=F-1+37*(F-1),U[0]=et,U[1]=ut,U[2]=at,U[3]=Mt,U[4]=Pt,U[5]=It,U[6]=Ee,U[7]=$t,U[8]=xt,U[9]=Bt,U[10]=_t,U[11]=Et,U[12]=Vt,U[13]=wt,U[14]=At,U[15]=Ut}function T(U,L){v(U,L,L)}function nt(U,L){const k=s();let p;for(p=0;p<16;p++)k[p]=L[p];for(p=253;p>=0;p--)T(k,k),p!==2&&p!==4&&v(k,k,L);for(p=0;p<16;p++)U[p]=k[p]}function ft(U,L){const k=s();let p;for(p=0;p<16;p++)k[p]=L[p];for(p=250;p>=0;p--)T(k,k),p!==1&&v(k,k,L);for(p=0;p<16;p++)U[p]=k[p]}function pt(U,L){const k=s(),p=s(),F=s(),et=s(),ut=s(),at=s(),Mt=s(),Pt=s(),It=s();$(k,U[1],U[0]),$(It,L[1],L[0]),v(k,k,It),z(p,U[0],U[1]),z(It,L[0],L[1]),v(p,p,It),v(F,U[3],L[3]),v(F,F,f),v(et,U[2],L[2]),z(et,et,et),$(ut,p,k),$(at,et,F),z(Mt,et,F),z(Pt,p,k),v(U[0],ut,at),v(U[1],Pt,Mt),v(U[2],Mt,at),v(U[3],ut,Pt)}function mt(U,L,k){for(let p=0;p<4;p++)Y(U[p],L[p],k)}function h(U,L){const k=s(),p=s(),F=s();nt(F,L[2]),v(k,L[0],F),v(p,L[1],F),G(U,p),U[31]^=V(k)<<7}function y(U,L,k){D(U[0],u),D(U[1],l),D(U[2],l),D(U[3],u);for(let p=255;p>=0;--p){const F=k[p/8|0]>>(p&7)&1;mt(U,L,F),pt(L,U),pt(U,U),mt(U,L,F)}}function b(U,L){const k=[s(),s(),s(),s()];D(k[0],w),D(k[1],E),D(k[2],l),v(k[3],w,E),y(U,k,L)}function M(U){if(U.length!==r.SEED_LENGTH)throw new Error(`ed25519: seed must be ${r.SEED_LENGTH} bytes`);const L=(0,e.hash)(U);L[0]&=248,L[31]&=127,L[31]|=64;const k=new Uint8Array(32),p=[s(),s(),s(),s()];b(p,L),h(k,p);const F=new Uint8Array(64);return F.set(U),F.set(k,32),{publicKey:k,secretKey:F}}r.generateKeyPairFromSeed=M;function C(U){const L=(0,t.randomBytes)(32,U),k=M(L);return(0,i.wipe)(L),k}r.generateKeyPair=C;function R(U){if(U.length!==r.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${r.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(U.subarray(32))}r.extractPublicKeyFromSecretKey=R;const j=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function I(U,L){let k,p,F,et;for(p=63;p>=32;--p){for(k=0,F=p-32,et=p-12;F<et;++F)L[F]+=k-16*L[p]*j[F-(p-32)],k=Math.floor((L[F]+128)/256),L[F]-=k*256;L[F]+=k,L[p]=0}for(k=0,F=0;F<32;F++)L[F]+=k-(L[31]>>4)*j[F],k=L[F]>>8,L[F]&=255;for(F=0;F<32;F++)L[F]-=k*j[F];for(p=0;p<32;p++)L[p+1]+=L[p]>>8,U[p]=L[p]&255}function g(U){const L=new Float64Array(64);for(let k=0;k<64;k++)L[k]=U[k];for(let k=0;k<64;k++)U[k]=0;I(U,L)}function N(U,L){const k=new Float64Array(64),p=[s(),s(),s(),s()],F=(0,e.hash)(U.subarray(0,32));F[0]&=248,F[31]&=127,F[31]|=64;const et=new Uint8Array(64);et.set(F.subarray(32),32);const ut=new e.SHA512;ut.update(et.subarray(32)),ut.update(L);const at=ut.digest();ut.clean(),g(at),b(p,at),h(et,p),ut.reset(),ut.update(et.subarray(0,32)),ut.update(U.subarray(32)),ut.update(L);const Mt=ut.digest();g(Mt);for(let Pt=0;Pt<32;Pt++)k[Pt]=at[Pt];for(let Pt=0;Pt<32;Pt++)for(let It=0;It<32;It++)k[Pt+It]+=Mt[Pt]*F[It];return I(et.subarray(32),k),et}r.sign=N;function it(U,L){const k=s(),p=s(),F=s(),et=s(),ut=s(),at=s(),Mt=s();return D(U[2],l),B(U[1],L),T(F,U[1]),v(et,F,d),$(F,F,U[2]),z(et,U[2],et),T(ut,et),T(at,ut),v(Mt,at,ut),v(k,Mt,F),v(k,k,et),ft(k,k),v(k,k,F),v(k,k,et),v(k,k,et),v(U[0],k,et),T(p,U[0]),v(p,p,et),K(p,F)&&v(U[0],U[0],S),T(p,U[0]),v(p,p,et),K(p,F)?-1:(V(U[0])===L[31]>>7&&$(U[0],u,U[0]),v(U[3],U[0],U[1]),0)}function lt(U,L,k){const p=new Uint8Array(32),F=[s(),s(),s(),s()],et=[s(),s(),s(),s()];if(k.length!==r.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${r.SIGNATURE_LENGTH} bytes`);if(it(et,U))return!1;const ut=new e.SHA512;ut.update(k.subarray(0,32)),ut.update(U),ut.update(L);const at=ut.digest();return g(at),y(F,et,at),b(et,k.subarray(32)),pt(F,et),h(p,F),!tt(k,p)}r.verify=lt;function _(U){let L=[s(),s(),s(),s()];if(it(L,U))throw new Error("Ed25519: invalid public key");let k=s(),p=s(),F=L[1];z(k,l,F),$(p,l,F),nt(p,p),v(k,k,p);let et=new Uint8Array(32);return G(et,k),et}r.convertPublicKeyToX25519=_;function Z(U){const L=(0,e.hash)(U.subarray(0,32));L[0]&=248,L[31]&=127,L[31]|=64;const k=new Uint8Array(L.subarray(0,32));return(0,i.wipe)(L),k}r.convertSecretKeyToX25519=Z})(rf);const MI="EdDSA",CI="JWT",Xg=".",Zg="base64url",PI="utf8",OI="utf8",NI=":",RI="did",TI="key",Op="base58btc",FI="z",UI="K36",BI=32;function eu(r){return Tr(Kr(Mn(r),PI),Zg)}function tm(r){const t=Kr(UI,Op),e=FI+Tr(yl([t,r]),Op);return[RI,TI,e].join(NI)}function LI(r){return Tr(r,Zg)}function qI(r){return Kr([eu(r.header),eu(r.payload)].join(Xg),OI)}function jI(r){return[eu(r.header),eu(r.payload),LI(r.signature)].join(Xg)}function Np(r=fo.randomBytes(BI)){return rf.generateKeyPairFromSeed(r)}async function $I(r,t,e,i,s=yt.fromMiliseconds(Date.now())){const a={alg:MI,typ:CI},u=tm(i.publicKey),l=s+e,d={iss:u,sub:r,aud:t,iat:s,exp:l},f=qI({header:a,payload:d}),w=rf.sign(i.secretKey,f);return jI({header:a,payload:d,signature:w})}const zI="PARSE_ERROR",kI="INVALID_REQUEST",HI="METHOD_NOT_FOUND",KI="INVALID_PARAMS",em="INTERNAL_ERROR",nf="SERVER_ERROR",VI=[-32700,-32600,-32601,-32602,-32603],ta={[zI]:{code:-32700,message:"Parse error"},[kI]:{code:-32600,message:"Invalid Request"},[HI]:{code:-32601,message:"Method not found"},[KI]:{code:-32602,message:"Invalid params"},[em]:{code:-32603,message:"Internal error"},[nf]:{code:-32e3,message:"Server error"}},rm=nf;function GI(r){return VI.includes(r)}function Rp(r){return Object.keys(ta).includes(r)?ta[r]:ta[rm]}function WI(r){const t=Object.values(ta).find(e=>e.code===r);return t||ta[rm]}function im(r,t,e){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${e} RPC url at ${t}`):r}var nm={},En={},Tp;function YI(){if(Tp)return En;Tp=1,Object.defineProperty(En,"__esModule",{value:!0}),En.isBrowserCryptoAvailable=En.getSubtleCrypto=En.getBrowerCrypto=void 0;function r(){return(Zi===null||Zi===void 0?void 0:Zi.crypto)||(Zi===null||Zi===void 0?void 0:Zi.msCrypto)||{}}En.getBrowerCrypto=r;function t(){const i=r();return i.subtle||i.webkitSubtle}En.getSubtleCrypto=t;function e(){return!!r()&&!!t()}return En.isBrowserCryptoAvailable=e,En}var An={},Fp;function QI(){if(Fp)return An;Fp=1,Object.defineProperty(An,"__esModule",{value:!0}),An.isBrowser=An.isNode=An.isReactNative=void 0;function r(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}An.isReactNative=r;function t(){return typeof ri<"u"&&typeof ri.versions<"u"&&typeof ri.versions.node<"u"}An.isNode=t;function e(){return!r()&&!t()}return An.isBrowser=e,An}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ua;t.__exportStar(YI(),r),t.__exportStar(QI(),r)})(nm);function Kn(r=3){const t=Date.now()*Math.pow(10,r),e=Math.floor(Math.random()*Math.pow(10,r));return t+e}function Ss(r=6){return BigInt(Kn(r))}function co(r,t,e){return{id:e||Kn(),jsonrpc:"2.0",method:r,params:t}}function du(r,t){return{id:r,jsonrpc:"2.0",result:t}}function pu(r,t,e){return{id:r,jsonrpc:"2.0",error:JI(t,e)}}function JI(r,t){return typeof r>"u"?Rp(em):(typeof r=="string"&&(r=Object.assign(Object.assign({},Rp(nf)),{message:r})),typeof t<"u"&&(r.data=t),GI(r.code)&&(r=WI(r.code)),r)}class XI{}class ZI extends XI{constructor(){super()}}class tD extends ZI{constructor(t){super()}}const eD="^https?:",rD="^wss?:";function iD(r){const t=r.match(new RegExp(/^\w+:/,"gi"));if(!(!t||!t.length))return t[0]}function sm(r,t){const e=iD(r);return typeof e>"u"?!1:new RegExp(t).test(e)}function Up(r){return sm(r,eD)}function Bp(r){return sm(r,rD)}function nD(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}function om(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function sf(r){return om(r)&&"method"in r}function gu(r){return om(r)&&(Ji(r)||Si(r))}function Ji(r){return"result"in r}function Si(r){return"error"in r}class Cn extends tD{constructor(t){super(t),this.events=new Di.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(t),this.connection.connected&&this.registerEventListeners()}async connect(t=this.connection){await this.open(t)}async disconnect(){await this.close()}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async request(t,e){return this.requestStrict(co(t.method,t.params||[],t.id||Ss().toString()),e)}async requestStrict(t,e){return new Promise(async(i,s)=>{if(!this.connection.connected)try{await this.open()}catch(a){s(a)}this.events.on(`${t.id}`,a=>{Si(a)?s(a.error):i(a.result)});try{await this.connection.send(t,e)}catch(a){s(a)}})}setConnection(t=this.connection){return t}onPayload(t){this.events.emit("payload",t),gu(t)?this.events.emit(`${t.id}`,t):this.events.emit("message",{type:t.method,data:t.params})}onClose(t){t&&t.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${t.code} ${t.reason?`(${t.reason})`:""}`)),this.events.emit("disconnect")}async open(t=this.connection){this.connection===t&&this.connection.connected||(this.connection.connected&&this.close(),typeof t=="string"&&(await this.connection.open(t),t=this.connection),this.connection=this.setConnection(t),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",t=>this.onPayload(t)),this.connection.on("close",t=>this.onClose(t)),this.connection.on("error",t=>this.events.emit("error",t)),this.connection.on("register_error",t=>this.onClose()),this.hasRegisteredEventListeners=!0)}}var Xh,Lp;function sD(){return Lp||(Lp=1,Xh=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),Xh}const oD=()=>typeof WebSocket<"u"?WebSocket:typeof Ie<"u"&&typeof Ie.WebSocket<"u"?Ie.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:sD(),aD=()=>typeof WebSocket<"u"||typeof Ie<"u"&&typeof Ie.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",qp=r=>r.split("?")[0],jp=10,cD=oD();let uD=class{constructor(t){if(this.url=t,this.events=new Di.EventEmitter,this.registering=!1,!Bp(t))throw new Error(`Provided URL is not compatible with WebSocket connection: ${t}`);this.url=t}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async open(t=this.url){await this.register(t)}async close(){return new Promise((t,e)=>{if(typeof this.socket>"u"){e(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),t()},this.socket.close()})}async send(t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Mn(t))}catch(e){this.onError(t.id,e)}}register(t=this.url){if(!Bp(t))throw new Error(`Provided URL is not compatible with WebSocket connection: ${t}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((i,s)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),s(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return s(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=t,this.registering=!0,new Promise((e,i)=>{const s=new URLSearchParams(t).get("origin"),a=nm.isReactNative()?{headers:{origin:s}}:{rejectUnauthorized:!nD(t)},u=new cD(t,[],a);aD()?u.onerror=l=>{const d=l;i(this.emitError(d.error))}:u.on("error",l=>{i(this.emitError(l))}),u.onopen=()=>{this.onOpen(u),e(u)}})}onOpen(t){t.onmessage=e=>this.onPayload(e),t.onclose=e=>this.onClose(e),this.socket=t,this.registering=!1,this.events.emit("open")}onClose(t){this.socket=void 0,this.registering=!1,this.events.emit("close",t)}onPayload(t){if(typeof t.data>"u")return;const e=typeof t.data=="string"?ma(t.data):t.data;this.events.emit("payload",e)}onError(t,e){const i=this.parseError(e),s=i.message||i.toString(),a=pu(t,s);this.events.emit("payload",a)}parseError(t,e=this.url){return im(t,qp(e),"WS")}resetMaxListeners(){this.events.getMaxListeners()>jp&&this.events.setMaxListeners(jp)}emitError(t){const e=this.parseError(new Error((t==null?void 0:t.message)||`WebSocket connection failed for host: ${qp(this.url)}`));return this.events.emit("register_error",e),e}};var ru={exports:{}};ru.exports;(function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,a=2,u=9007199254740991,l="[object Arguments]",d="[object Array]",f="[object AsyncFunction]",w="[object Boolean]",E="[object Date]",S="[object Error]",D="[object Function]",P="[object GeneratorFunction]",Y="[object Map]",G="[object Number]",tt="[object Null]",K="[object Object]",V="[object Promise]",B="[object Proxy]",z="[object RegExp]",$="[object Set]",v="[object String]",T="[object Symbol]",nt="[object Undefined]",ft="[object WeakMap]",pt="[object ArrayBuffer]",mt="[object DataView]",h="[object Float32Array]",y="[object Float64Array]",b="[object Int8Array]",M="[object Int16Array]",C="[object Int32Array]",R="[object Uint8Array]",j="[object Uint8ClampedArray]",I="[object Uint16Array]",g="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,it=/^\[object .+?Constructor\]$/,lt=/^(?:0|[1-9]\d*)$/,_={};_[h]=_[y]=_[b]=_[M]=_[C]=_[R]=_[j]=_[I]=_[g]=!0,_[l]=_[d]=_[pt]=_[w]=_[mt]=_[E]=_[S]=_[D]=_[Y]=_[G]=_[K]=_[z]=_[$]=_[v]=_[ft]=!1;var Z=typeof Zi=="object"&&Zi&&Zi.Object===Object&&Zi,U=typeof self=="object"&&self&&self.Object===Object&&self,L=Z||U||Function("return this")(),k=t&&!t.nodeType&&t,p=k&&!0&&r&&!r.nodeType&&r,F=p&&p.exports===k,et=F&&Z.process,ut=function(){try{return et&&et.binding&&et.binding("util")}catch{}}(),at=ut&&ut.isTypedArray;function Mt(q,Q){for(var ht=-1,St=q==null?0:q.length,Be=0,re=[];++ht<St;){var $e=q[ht];Q($e,ht,q)&&(re[Be++]=$e)}return re}function Pt(q,Q){for(var ht=-1,St=Q.length,Be=q.length;++ht<St;)q[Be+ht]=Q[ht];return q}function It(q,Q){for(var ht=-1,St=q==null?0:q.length;++ht<St;)if(Q(q[ht],ht,q))return!0;return!1}function Ee(q,Q){for(var ht=-1,St=Array(q);++ht<q;)St[ht]=Q(ht);return St}function $t(q){return function(Q){return q(Q)}}function xt(q,Q){return q.has(Q)}function Bt(q,Q){return q==null?void 0:q[Q]}function _t(q){var Q=-1,ht=Array(q.size);return q.forEach(function(St,Be){ht[++Q]=[Be,St]}),ht}function Et(q,Q){return function(ht){return q(Q(ht))}}function Vt(q){var Q=-1,ht=Array(q.size);return q.forEach(function(St){ht[++Q]=St}),ht}var wt=Array.prototype,At=Function.prototype,Ut=Object.prototype,bt=L["__core-js_shared__"],Ct=At.toString,Lt=Ut.hasOwnProperty,Ot=function(){var q=/[^.]+$/.exec(bt&&bt.keys&&bt.keys.IE_PROTO||"");return q?"Symbol(src)_1."+q:""}(),Nt=Ut.toString,se=RegExp("^"+Ct.call(Lt).replace(N,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Tt=F?L.Buffer:void 0,Rt=L.Symbol,Ke=L.Uint8Array,ce=Ut.propertyIsEnumerable,pe=wt.splice,Ve=Rt?Rt.toStringTag:void 0,ye=Object.getOwnPropertySymbols,_e=Tt?Tt.isBuffer:void 0,Ar=Et(Object.keys,Object),Gt=Yr(L,"DataView"),zt=Yr(L,"Map"),De=Yr(L,"Promise"),Wt=Yr(L,"Set"),Kt=Yr(L,"WeakMap"),Ae=Yr(Object,"create"),Jt=ln(Gt),Xt=ln(zt),xe=ln(De),Zt=ln(Wt),Yt=ln(Kt),Ce=Rt?Rt.prototype:void 0,Qt=Ce?Ce.valueOf:void 0;function qt(q){var Q=-1,ht=q==null?0:q.length;for(this.clear();++Q<ht;){var St=q[Q];this.set(St[0],St[1])}}function Te(){this.__data__=Ae?Ae(null):{},this.size=0}function te(q){var Q=this.has(q)&&delete this.__data__[q];return this.size-=Q?1:0,Q}function Pe(q){var Q=this.__data__;if(Ae){var ht=Q[q];return ht===i?void 0:ht}return Lt.call(Q,q)?Q[q]:void 0}function xi(q){var Q=this.__data__;return Ae?Q[q]!==void 0:Lt.call(Q,q)}function Oe(q,Q){var ht=this.__data__;return this.size+=this.has(q)?0:1,ht[q]=Ae&&Q===void 0?i:Q,this}qt.prototype.clear=Te,qt.prototype.delete=te,qt.prototype.get=Pe,qt.prototype.has=xi,qt.prototype.set=Oe;function le(q){var Q=-1,ht=q==null?0:q.length;for(this.clear();++Q<ht;){var St=q[Q];this.set(St[0],St[1])}}function oi(){this.__data__=[],this.size=0}function ai(q){var Q=this.__data__,ht=ss(Q,q);if(ht<0)return!1;var St=Q.length-1;return ht==St?Q.pop():pe.call(Q,ht,1),--this.size,!0}function ci(q){var Q=this.__data__,ht=ss(Q,q);return ht<0?void 0:Q[ht][1]}function ui(q){return ss(this.__data__,q)>-1}function hi(q,Q){var ht=this.__data__,St=ss(ht,q);return St<0?(++this.size,ht.push([q,Q])):ht[St][1]=Q,this}le.prototype.clear=oi,le.prototype.delete=ai,le.prototype.get=ci,le.prototype.has=ui,le.prototype.set=hi;function ar(q){var Q=-1,ht=q==null?0:q.length;for(this.clear();++Q<ht;){var St=q[Q];this.set(St[0],St[1])}}function qi(){this.size=0,this.__data__={hash:new qt,map:new(zt||le),string:new qt}}function Xn(q){var Q=Rn(this,q).delete(q);return this.size-=Q?1:0,Q}function ji(q){return Rn(this,q).get(q)}function Zn(q){return Rn(this,q).has(q)}function ts(q,Q){var ht=Rn(this,q),St=ht.size;return ht.set(q,Q),this.size+=ht.size==St?0:1,this}ar.prototype.clear=qi,ar.prototype.delete=Xn,ar.prototype.get=ji,ar.prototype.has=Zn,ar.prototype.set=ts;function $i(q){var Q=-1,ht=q==null?0:q.length;for(this.__data__=new ar;++Q<ht;)this.add(q[Q])}function On(q){return this.__data__.set(q,i),this}function Nn(q){return this.__data__.has(q)}$i.prototype.add=$i.prototype.push=On,$i.prototype.has=Nn;function Sr(q){var Q=this.__data__=new le(q);this.size=Q.size}function es(){this.__data__=new le,this.size=0}function rs(q){var Q=this.__data__,ht=Q.delete(q);return this.size=Q.size,ht}function is(q){return this.__data__.get(q)}function ns(q){return this.__data__.has(q)}function _a(q,Q){var ht=this.__data__;if(ht instanceof le){var St=ht.__data__;if(!zt||St.length<e-1)return St.push([q,Q]),this.size=++ht.size,this;ht=this.__data__=new ar(St)}return ht.set(q,Q),this.size=ht.size,this}Sr.prototype.clear=es,Sr.prototype.delete=rs,Sr.prototype.get=is,Sr.prototype.has=ns,Sr.prototype.set=_a;function Ea(q,Q){var ht=Fs(q),St=!ht&&Ta(q),Be=!ht&&!St&&Ao(q),re=!ht&&!St&&!Be&&Ba(q),$e=ht||St||Be||re,er=$e?Ee(q.length,String):[],we=er.length;for(var Le in q)(Q||Lt.call(q,Le))&&!($e&&(Le=="length"||Be&&(Le=="offset"||Le=="parent")||re&&(Le=="buffer"||Le=="byteLength"||Le=="byteOffset")||Ca(Le,we)))&&er.push(Le);return er}function ss(q,Q){for(var ht=q.length;ht--;)if(Ra(q[ht][0],Q))return ht;return-1}function _o(q,Q,ht){var St=Q(q);return Fs(q)?St:Pt(St,ht(q))}function os(q){return q==null?q===void 0?nt:tt:Ve&&Ve in Object(q)?xa(q):bu(q)}function Eo(q){return cs(q)&&os(q)==l}function as(q,Q,ht,St,Be){return q===Q?!0:q==null||Q==null||!cs(q)&&!cs(Q)?q!==q&&Q!==Q:Aa(q,Q,ht,St,as,Be)}function Aa(q,Q,ht,St,Be,re){var $e=Fs(q),er=Fs(Q),we=$e?d:zi(q),Le=er?d:zi(Q);we=we==l?K:we,Le=Le==l?K:Le;var Qe=we==K,Ur=Le==K,rr=we==Le;if(rr&&Ao(q)){if(!Ao(Q))return!1;$e=!0,Qe=!1}if(rr&&!Qe)return re||(re=new Sr),$e||Ba(q)?Rs(q,Q,ht,St,Be,re):wu(q,Q,we,ht,St,Be,re);if(!(ht&s)){var ze=Qe&&Lt.call(q,"__wrapped__"),Ir=Ur&&Lt.call(Q,"__wrapped__");if(ze||Ir){var Mi=ze?q.value():q,li=Ir?Q.value():Q;return re||(re=new Sr),Be(Mi,li,ht,St,re)}}return rr?(re||(re=new Sr),Da(q,Q,ht,St,Be,re)):!1}function yu(q){if(!Ua(q)||Oa(q))return!1;var Q=Us(q)?se:it;return Q.test(ln(q))}function Sa(q){return cs(q)&&Fa(q.length)&&!!_[os(q)]}function Ia(q){if(!Na(q))return Ar(q);var Q=[];for(var ht in Object(q))Lt.call(q,ht)&&ht!="constructor"&&Q.push(ht);return Q}function Rs(q,Q,ht,St,Be,re){var $e=ht&s,er=q.length,we=Q.length;if(er!=we&&!($e&&we>er))return!1;var Le=re.get(q);if(Le&&re.get(Q))return Le==Q;var Qe=-1,Ur=!0,rr=ht&a?new $i:void 0;for(re.set(q,Q),re.set(Q,q);++Qe<er;){var ze=q[Qe],Ir=Q[Qe];if(St)var Mi=$e?St(Ir,ze,Qe,Q,q,re):St(ze,Ir,Qe,q,Q,re);if(Mi!==void 0){if(Mi)continue;Ur=!1;break}if(rr){if(!It(Q,function(li,ki){if(!xt(rr,ki)&&(ze===li||Be(ze,li,ht,St,re)))return rr.push(ki)})){Ur=!1;break}}else if(!(ze===Ir||Be(ze,Ir,ht,St,re))){Ur=!1;break}}return re.delete(q),re.delete(Q),Ur}function wu(q,Q,ht,St,Be,re,$e){switch(ht){case mt:if(q.byteLength!=Q.byteLength||q.byteOffset!=Q.byteOffset)return!1;q=q.buffer,Q=Q.buffer;case pt:return!(q.byteLength!=Q.byteLength||!re(new Ke(q),new Ke(Q)));case w:case E:case G:return Ra(+q,+Q);case S:return q.name==Q.name&&q.message==Q.message;case z:case v:return q==Q+"";case Y:var er=_t;case $:var we=St&s;if(er||(er=Vt),q.size!=Q.size&&!we)return!1;var Le=$e.get(q);if(Le)return Le==Q;St|=a,$e.set(q,Q);var Qe=Rs(er(q),er(Q),St,Be,re,$e);return $e.delete(q),Qe;case T:if(Qt)return Qt.call(q)==Qt.call(Q)}return!1}function Da(q,Q,ht,St,Be,re){var $e=ht&s,er=Ts(q),we=er.length,Le=Ts(Q),Qe=Le.length;if(we!=Qe&&!$e)return!1;for(var Ur=we;Ur--;){var rr=er[Ur];if(!($e?rr in Q:Lt.call(Q,rr)))return!1}var ze=re.get(q);if(ze&&re.get(Q))return ze==Q;var Ir=!0;re.set(q,Q),re.set(Q,q);for(var Mi=$e;++Ur<we;){rr=er[Ur];var li=q[rr],ki=Q[rr];if(St)var So=$e?St(ki,li,rr,Q,q,re):St(li,ki,rr,q,Q,re);if(!(So===void 0?li===ki||Be(li,ki,ht,St,re):So)){Ir=!1;break}Mi||(Mi=rr=="constructor")}if(Ir&&!Mi){var us=q.constructor,cr=Q.constructor;us!=cr&&"constructor"in q&&"constructor"in Q&&!(typeof us=="function"&&us instanceof us&&typeof cr=="function"&&cr instanceof cr)&&(Ir=!1)}return re.delete(q),re.delete(Q),Ir}function Ts(q){return _o(q,Au,Ma)}function Rn(q,Q){var ht=q.__data__;return Pa(Q)?ht[typeof Q=="string"?"string":"hash"]:ht.map}function Yr(q,Q){var ht=Bt(q,Q);return yu(ht)?ht:void 0}function xa(q){var Q=Lt.call(q,Ve),ht=q[Ve];try{q[Ve]=void 0;var St=!0}catch{}var Be=Nt.call(q);return St&&(Q?q[Ve]=ht:delete q[Ve]),Be}var Ma=ye?function(q){return q==null?[]:(q=Object(q),Mt(ye(q),function(Q){return ce.call(q,Q)}))}:Ue,zi=os;(Gt&&zi(new Gt(new ArrayBuffer(1)))!=mt||zt&&zi(new zt)!=Y||De&&zi(De.resolve())!=V||Wt&&zi(new Wt)!=$||Kt&&zi(new Kt)!=ft)&&(zi=function(q){var Q=os(q),ht=Q==K?q.constructor:void 0,St=ht?ln(ht):"";if(St)switch(St){case Jt:return mt;case Xt:return Y;case xe:return V;case Zt:return $;case Yt:return ft}return Q});function Ca(q,Q){return Q=Q??u,!!Q&&(typeof q=="number"||lt.test(q))&&q>-1&&q%1==0&&q<Q}function Pa(q){var Q=typeof q;return Q=="string"||Q=="number"||Q=="symbol"||Q=="boolean"?q!=="__proto__":q===null}function Oa(q){return!!Ot&&Ot in q}function Na(q){var Q=q&&q.constructor,ht=typeof Q=="function"&&Q.prototype||Ut;return q===ht}function bu(q){return Nt.call(q)}function ln(q){if(q!=null){try{return Ct.call(q)}catch{}try{return q+""}catch{}}return""}function Ra(q,Q){return q===Q||q!==q&&Q!==Q}var Ta=Eo(function(){return arguments}())?Eo:function(q){return cs(q)&&Lt.call(q,"callee")&&!ce.call(q,"callee")},Fs=Array.isArray;function _u(q){return q!=null&&Fa(q.length)&&!Us(q)}var Ao=_e||Fe;function Eu(q,Q){return as(q,Q)}function Us(q){if(!Ua(q))return!1;var Q=os(q);return Q==D||Q==P||Q==f||Q==B}function Fa(q){return typeof q=="number"&&q>-1&&q%1==0&&q<=u}function Ua(q){var Q=typeof q;return q!=null&&(Q=="object"||Q=="function")}function cs(q){return q!=null&&typeof q=="object"}var Ba=at?$t(at):Sa;function Au(q){return _u(q)?Ea(q):Ia(q)}function Ue(){return[]}function Fe(){return!1}r.exports=Eu})(ru,ru.exports);var hD=ru.exports;const lD=Bl(hD);function fD(r,t){return t=t||{},new Promise(function(e,i){var s=new XMLHttpRequest,a=[],u=[],l={},d=function(){return{ok:(s.status/100|0)==2,statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:d,headers:{keys:function(){return a},entries:function(){return u},get:function(w){return l[w.toLowerCase()]},has:function(w){return w.toLowerCase()in l}}}};for(var f in s.open(t.method||"get",r,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(w,E,S){a.push(E=E.toLowerCase()),u.push([E,S]),l[E]=l[E]?l[E]+","+S:S}),e(d())},s.onerror=i,s.withCredentials=t.credentials=="include",t.headers)s.setRequestHeader(f,t.headers[f]);s.send(t.body||null)})}const dD=Object.freeze(Object.defineProperty({__proto__:null,default:fD},Symbol.toStringTag,{value:"Module"})),$p=C1(dD);var pD=self.fetch||(self.fetch=$p.default||$p);const gD=Bl(pD);function mD(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),i=0;i<e.length;i++)e[i]=255;for(var s=0;s<r.length;s++){var a=r.charAt(s),u=a.charCodeAt(0);if(e[u]!==255)throw new TypeError(a+" is ambiguous");e[u]=s}var l=r.length,d=r.charAt(0),f=Math.log(l)/Math.log(256),w=Math.log(256)/Math.log(l);function E(P){if(P instanceof Uint8Array||(ArrayBuffer.isView(P)?P=new Uint8Array(P.buffer,P.byteOffset,P.byteLength):Array.isArray(P)&&(P=Uint8Array.from(P))),!(P instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(P.length===0)return"";for(var Y=0,G=0,tt=0,K=P.length;tt!==K&&P[tt]===0;)tt++,Y++;for(var V=(K-tt)*w+1>>>0,B=new Uint8Array(V);tt!==K;){for(var z=P[tt],$=0,v=V-1;(z!==0||$<G)&&v!==-1;v--,$++)z+=256*B[v]>>>0,B[v]=z%l>>>0,z=z/l>>>0;if(z!==0)throw new Error("Non-zero carry");G=$,tt++}for(var T=V-G;T!==V&&B[T]===0;)T++;for(var nt=d.repeat(Y);T<V;++T)nt+=r.charAt(B[T]);return nt}function S(P){if(typeof P!="string")throw new TypeError("Expected String");if(P.length===0)return new Uint8Array;var Y=0;if(P[Y]!==" "){for(var G=0,tt=0;P[Y]===d;)G++,Y++;for(var K=(P.length-Y)*f+1>>>0,V=new Uint8Array(K);P[Y];){var B=e[P.charCodeAt(Y)];if(B===255)return;for(var z=0,$=K-1;(B!==0||z<tt)&&$!==-1;$--,z++)B+=l*V[$]>>>0,V[$]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");tt=z,Y++}if(P[Y]!==" "){for(var v=K-tt;v!==K&&V[v]===0;)v++;for(var T=new Uint8Array(G+(K-v)),nt=G;v!==K;)T[nt++]=V[v++];return T}}}function D(P){var Y=S(P);if(Y)return Y;throw new Error(`Non-${t} character`)}return{encode:E,decodeUnsafe:S,decode:D}}var vD=mD,yD=vD;const am=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},wD=r=>new TextEncoder().encode(r),bD=r=>new TextDecoder().decode(r);class _D{constructor(t,e,i){this.name=t,this.prefix=e,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}let ED=class{constructor(t,e,i){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=i}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return cm(this,t)}},AD=class{constructor(t){this.decoders=t}or(t){return cm(this,t)}decode(t){const e=t[0],i=this.decoders[e];if(i)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const cm=(r,t)=>new AD({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});let SD=class{constructor(t,e,i,s){this.name=t,this.prefix=e,this.baseEncode=i,this.baseDecode=s,this.encoder=new _D(t,e,i),this.decoder=new ED(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};const mu=({name:r,prefix:t,encode:e,decode:i})=>new SD(r,t,e,i),ba=({prefix:r,name:t,alphabet:e})=>{const{encode:i,decode:s}=yD(e,t);return mu({prefix:r,name:t,encode:i,decode:a=>am(s(a))})},ID=(r,t,e,i)=>{const s={};for(let w=0;w<t.length;++w)s[t[w]]=w;let a=r.length;for(;r[a-1]==="=";)--a;const u=new Uint8Array(a*e/8|0);let l=0,d=0,f=0;for(let w=0;w<a;++w){const E=s[r[w]];if(E===void 0)throw new SyntaxError(`Non-${i} character`);d=d<<e|E,l+=e,l>=8&&(l-=8,u[f++]=255&d>>l)}if(l>=e||255&d<<8-l)throw new SyntaxError("Unexpected end of data");return u},DD=(r,t,e)=>{const i=t[t.length-1]==="=",s=(1<<e)-1;let a="",u=0,l=0;for(let d=0;d<r.length;++d)for(l=l<<8|r[d],u+=8;u>e;)u-=e,a+=t[s&l>>u];if(u&&(a+=t[s&l<<e-u]),i)for(;a.length*e&7;)a+="=";return a},yr=({name:r,prefix:t,bitsPerChar:e,alphabet:i})=>mu({prefix:t,name:r,encode(s){return DD(s,i,e)},decode(s){return ID(s,i,e,r)}}),xD=mu({prefix:"\0",name:"identity",encode:r=>bD(r),decode:r=>wD(r)});var MD=Object.freeze({__proto__:null,identity:xD});const CD=yr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var PD=Object.freeze({__proto__:null,base2:CD});const OD=yr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ND=Object.freeze({__proto__:null,base8:OD});const RD=ba({prefix:"9",name:"base10",alphabet:"0123456789"});var TD=Object.freeze({__proto__:null,base10:RD});const FD=yr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),UD=yr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var BD=Object.freeze({__proto__:null,base16:FD,base16upper:UD});const LD=yr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),qD=yr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),jD=yr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),$D=yr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),zD=yr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),kD=yr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),HD=yr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),KD=yr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),VD=yr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var GD=Object.freeze({__proto__:null,base32:LD,base32upper:qD,base32pad:jD,base32padupper:$D,base32hex:zD,base32hexupper:kD,base32hexpad:HD,base32hexpadupper:KD,base32z:VD});const WD=ba({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),YD=ba({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var QD=Object.freeze({__proto__:null,base36:WD,base36upper:YD});const JD=ba({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),XD=ba({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ZD=Object.freeze({__proto__:null,base58btc:JD,base58flickr:XD});const tx=yr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ex=yr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),rx=yr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ix=yr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var nx=Object.freeze({__proto__:null,base64:tx,base64pad:ex,base64url:rx,base64urlpad:ix});const um=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),sx=um.reduce((r,t,e)=>(r[e]=t,r),[]),ox=um.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function ax(r){return r.reduce((t,e)=>(t+=sx[e],t),"")}function cx(r){const t=[];for(const e of r){const i=ox[e.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}const ux=mu({prefix:"🚀",name:"base256emoji",encode:ax,decode:cx});var hx=Object.freeze({__proto__:null,base256emoji:ux}),lx=hm,zp=128,fx=127,dx=~fx,px=Math.pow(2,31);function hm(r,t,e){t=t||[],e=e||0;for(var i=e;r>=px;)t[e++]=r&255|zp,r/=128;for(;r&dx;)t[e++]=r&255|zp,r>>>=7;return t[e]=r|0,hm.bytes=e-i+1,t}var gx=Ol,mx=128,kp=127;function Ol(r,i){var e=0,i=i||0,s=0,a=i,u,l=r.length;do{if(a>=l)throw Ol.bytes=0,new RangeError("Could not decode varint");u=r[a++],e+=s<28?(u&kp)<<s:(u&kp)*Math.pow(2,s),s+=7}while(u>=mx);return Ol.bytes=a-i,e}var vx=Math.pow(2,7),yx=Math.pow(2,14),wx=Math.pow(2,21),bx=Math.pow(2,28),_x=Math.pow(2,35),Ex=Math.pow(2,42),Ax=Math.pow(2,49),Sx=Math.pow(2,56),Ix=Math.pow(2,63),Dx=function(r){return r<vx?1:r<yx?2:r<wx?3:r<bx?4:r<_x?5:r<Ex?6:r<Ax?7:r<Sx?8:r<Ix?9:10},xx={encode:lx,decode:gx,encodingLength:Dx},lm=xx;const Hp=(r,t,e=0)=>(lm.encode(r,t,e),t),Kp=r=>lm.encodingLength(r),Nl=(r,t)=>{const e=t.byteLength,i=Kp(r),s=i+Kp(e),a=new Uint8Array(s+e);return Hp(r,a,0),Hp(e,a,i),a.set(t,s),new Mx(r,e,t,a)};class Mx{constructor(t,e,i,s){this.code=t,this.size=e,this.digest=i,this.bytes=s}}const fm=({name:r,code:t,encode:e})=>new Cx(r,t,e);class Cx{constructor(t,e,i){this.name=t,this.code=e,this.encode=i}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?Nl(this.code,e):e.then(i=>Nl(this.code,i))}else throw Error("Unknown type, must be binary type")}}const dm=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),Px=fm({name:"sha2-256",code:18,encode:dm("SHA-256")}),Ox=fm({name:"sha2-512",code:19,encode:dm("SHA-512")});var Nx=Object.freeze({__proto__:null,sha256:Px,sha512:Ox});const pm=0,Rx="identity",gm=am,Tx=r=>Nl(pm,gm(r)),Fx={code:pm,name:Rx,encode:gm,digest:Tx};var Ux=Object.freeze({__proto__:null,identity:Fx});new TextEncoder,new TextDecoder;const Vp={...MD,...PD,...ND,...TD,...BD,...GD,...QD,...ZD,...nx,...hx};({...Nx,...Ux});function Bx(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function mm(r,t,e,i){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:i}}}const Gp=mm("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Zh=mm("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=Bx(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Lx={utf8:Gp,"utf-8":Gp,hex:Vp.base16,latin1:Zh,ascii:Zh,binary:Zh,...Vp};function qx(r,t="utf8"){const e=Lx[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):e.decoder.decode(`${e.prefix}${r}`)}const vm="wc",jx=2,of="core",Wn=`${vm}@2:${of}:`,$x={name:of,logger:"error"},zx={database:":memory:"},kx="crypto",Wp="client_ed25519_seed",Hx=yt.ONE_DAY,Kx="keychain",Vx="0.3",Gx="messages",Wx="0.3",Yx=yt.SIX_HOURS,Qx="publisher",ym="irn",Jx="error",wm="wss://relay.walletconnect.com",Yp="wss://relay.walletconnect.org",Xx="relayer",Hr={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Zx="_subscription",_i={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},t7=yt.ONE_SECOND,e7="2.13.3",r7=1e4,i7="0.3",n7="WALLETCONNECT_CLIENT_ID",Xi={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},s7="subscription",o7="0.3",a7=yt.FIVE_SECONDS*1e3,c7="pairing",u7="0.3",Vo={wc_pairingDelete:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:yt.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:yt.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:yt.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:0},res:{ttl:yt.ONE_DAY,prompt:!1,tag:0}}},io={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Ti={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},h7="history",l7="0.3",f7="expirer",Ei={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},d7="0.3",tl="verify-api",no="https://verify.walletconnect.com",Rl="https://verify.walletconnect.org",p7=[no,Rl],g7="echo",m7="https://echo.walletconnect.com";class v7{constructor(t,e){this.core=t,this.logger=e,this.keychain=new Map,this.name=Kx,this.version=Vx,this.initialized=!1,this.storagePrefix=Wn,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,s)=>{this.isInitialized(),this.keychain.set(i,s),await this.persist()},this.get=i=>{this.isInitialized();const s=this.keychain.get(i);if(typeof s>"u"){const{message:a}=gt("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(a)}return s},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=t,this.logger=Wr(e,this.name)}get context(){return Gr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,Z1(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?tg(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=gt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class y7{constructor(t,e,i){this.core=t,this.logger=e,this.name=kx,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=s=>(this.isInitialized(),this.keychain.has(s)),this.getClientId=async()=>{this.isInitialized();const s=await this.getClientSeed(),a=Np(s);return tm(a.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const s=u4();return this.setPrivateKey(s.publicKey,s.privateKey)},this.signJWT=async s=>{this.isInitialized();const a=await this.getClientSeed(),u=Np(a),l=xl();return await $I(l,s,Hx,u)},this.generateSharedKey=(s,a,u)=>{this.isInitialized();const l=this.getPrivateKey(s),d=h4(l,a);return this.setSymKey(d,u)},this.setSymKey=async(s,a)=>{this.isInitialized();const u=a||jc(s);return await this.keychain.set(u,s),u},this.deleteKeyPair=async s=>{this.isInitialized(),await this.keychain.del(s)},this.deleteSymKey=async s=>{this.isInitialized(),await this.keychain.del(s)},this.encode=async(s,a,u)=>{this.isInitialized();const l=zg(u),d=Mn(a);if(lp(l)){const S=l.senderPublicKey,D=l.receiverPublicKey;s=await this.generateSharedKey(S,D)}const f=this.getSymKey(s),{type:w,senderPublicKey:E}=l;return f4({type:w,symKey:f,message:d,senderPublicKey:E})},this.decode=async(s,a,u)=>{this.isInitialized();const l=g4(a,u);if(lp(l)){const d=l.receiverPublicKey,f=l.senderPublicKey;s=await this.generateSharedKey(d,f)}try{const d=this.getSymKey(s),f=d4({symKey:d,encoded:a});return ma(f)}catch(d){this.logger.error(`Failed to decode message from topic: '${s}', clientId: '${await this.getClientId()}'`),this.logger.error(d)}},this.getPayloadType=s=>{const a=Jc(s);return pa(a.type)},this.getPayloadSenderPublicKey=s=>{const a=Jc(s);return a.senderPublicKey?Tr(a.senderPublicKey,Rr):void 0},this.core=t,this.logger=Wr(e,this.name),this.keychain=i||new v7(this.core,this.logger)}get context(){return Gr(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(Wp)}catch{t=xl(),await this.keychain.set(Wp,t)}return qx(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=gt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class w7 extends yI{constructor(t,e){super(t,e),this.logger=t,this.core=e,this.messages=new Map,this.name=Gx,this.version=Wx,this.initialized=!1,this.storagePrefix=Wn,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,s)=>{this.isInitialized();const a=As(s);let u=this.messages.get(i);return typeof u>"u"&&(u={}),typeof u[a]<"u"||(u[a]=s,this.messages.set(i,u),await this.persist()),a},this.get=i=>{this.isInitialized();let s=this.messages.get(i);return typeof s>"u"&&(s={}),s},this.has=(i,s)=>{this.isInitialized();const a=this.get(i),u=As(s);return typeof a[u]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=Wr(t,this.name),this.core=e}get context(){return Gr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,Z1(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?tg(t):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:t}=gt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class b7 extends wI{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,this.events=new Di.EventEmitter,this.name=Qx,this.queue=new Map,this.publishTimeout=yt.toMiliseconds(yt.ONE_MINUTE),this.failedPublishTimeout=yt.toMiliseconds(yt.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(i,s,a)=>{var u;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:s,opts:a}});const l=(a==null?void 0:a.ttl)||Yx,d=Ml(a),f=(a==null?void 0:a.prompt)||!1,w=(a==null?void 0:a.tag)||0,E=(a==null?void 0:a.id)||Ss().toString(),S={topic:i,message:s,opts:{ttl:l,relay:d,prompt:f,tag:w,id:E}},D=`Failed to publish payload, please try again. id:${E} tag:${w}`,P=Date.now();let Y,G=1;try{for(;Y===void 0;){if(Date.now()-P>this.publishTimeout)throw new Error(D);this.logger.trace({id:E,attempts:G},`publisher.publish - attempt ${G}`),Y=await await so(this.rpcPublish(i,s,l,d,f,w,E).catch(tt=>this.logger.warn(tt)),this.publishTimeout,D),G++,Y||await new Promise(tt=>setTimeout(tt,this.failedPublishTimeout))}this.relayer.events.emit(Hr.publish,S),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:E,topic:i,message:s,opts:a}})}catch(tt){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(tt),(u=a==null?void 0:a.internal)!=null&&u.throwOnFailedPublish)throw tt;this.queue.set(E,S)}},this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.relayer=t,this.logger=Wr(e,this.name),this.registerEventListeners()}get context(){return Gr(this.logger)}rpcPublish(t,e,i,s,a,u,l){var d,f,w,E;const S={method:Qo(s.protocol).publish,params:{topic:t,message:e,ttl:i,prompt:a,tag:u},id:l};return Nr((d=S.params)==null?void 0:d.prompt)&&((f=S.params)==null||delete f.prompt),Nr((w=S.params)==null?void 0:w.tag)&&((E=S.params)==null||delete E.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:S}),this.relayer.request(S)}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async t=>{const{topic:e,message:i,opts:s}=t;await this.publish(e,i,s)})}registerEventListeners(){this.relayer.core.heartbeat.on(va.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Hr.connection_stalled);return}this.checkQueue()}),this.relayer.on(Hr.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}class _7{constructor(){this.map=new Map,this.set=(t,e)=>{const i=this.get(t);this.exists(t,e)||this.map.set(t,[...i,e])},this.get=t=>this.map.get(t)||[],this.exists=(t,e)=>this.get(t).includes(e),this.delete=(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const i=this.get(t);if(!this.exists(t,e))return;const s=i.filter(a=>a!==e);if(!s.length){this.map.delete(t);return}this.map.set(t,s)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var E7=Object.defineProperty,A7=Object.defineProperties,S7=Object.getOwnPropertyDescriptors,Qp=Object.getOwnPropertySymbols,I7=Object.prototype.hasOwnProperty,D7=Object.prototype.propertyIsEnumerable,Jp=(r,t,e)=>t in r?E7(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Go=(r,t)=>{for(var e in t||(t={}))I7.call(t,e)&&Jp(r,e,t[e]);if(Qp)for(var e of Qp(t))D7.call(t,e)&&Jp(r,e,t[e]);return r},el=(r,t)=>A7(r,S7(t));class x7 extends EI{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,this.subscriptions=new Map,this.topicMap=new _7,this.events=new Di.EventEmitter,this.name=s7,this.version=o7,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=Wn,this.subscribeTimeout=yt.toMiliseconds(yt.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(i,s)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:s}});try{const a=Ml(s),u={topic:i,relay:a};this.pending.set(i,u);const l=await this.rpcSubscribe(i,a);return typeof l=="string"&&(this.onSubscribe(l,u),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:s}})),l}catch(a){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(a),a}},this.unsubscribe=async(i,s)=>{await this.restartToComplete(),this.isInitialized(),typeof(s==null?void 0:s.id)<"u"?await this.unsubscribeById(i,s.id,s):await this.unsubscribeByTopic(i,s)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const s=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((a,u)=>{const l=new yt.Watch;l.start(s);const d=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(d),l.stop(s),a(!0)),l.elapsed(s)>=a7&&(clearInterval(d),l.stop(s),u(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=t,this.logger=Wr(e,this.name),this.clientId=""}get context(){return Gr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(t,e){let i=!1;try{i=this.getSubscription(t).topic===e}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,e){const i=this.topicMap.get(t);await Promise.all(i.map(async s=>await this.unsubscribeById(t,s,e)))}async unsubscribeById(t,e,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:i}});try{const s=Ml(i);await this.rpcUnsubscribe(t,e,s);const a=Re("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,a),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:i}})}catch(s){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(s),s}}async rpcSubscribe(t,e){const i={method:Qo(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await so(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)?As(t+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Hr.connection_stalled)}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,i={method:Qo(e.protocol).batchSubscribe,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await so(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(Hr.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,i={method:Qo(e.protocol).batchFetchMessages,params:{topics:t.map(a=>a.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let s;try{s=await await so(this.relayer.request(i).catch(a=>this.logger.warn(a)),this.subscribeTimeout)}catch{this.relayer.events.emit(Hr.connection_stalled)}return s}rpcUnsubscribe(t,e,i){const s={method:Qo(i.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(t,e){this.setSubscription(t,el(Go({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,Go({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,i){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,i),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,Go({},e)),this.topicMap.set(e.topic,t),this.events.emit(Xi.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:i}=gt("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(i)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const i=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(i.topic,t),this.events.emit(Xi.deleted,el(Go({},i),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Xi.sync)}async reset(){if(this.cached.length){const t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let e=0;e<t;e++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(i),await this.batchSubscribe(i)}}this.events.emit(Xi.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size){const{message:e}=gt("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){if(!t.length)return;const e=await this.rpcBatchSubscribe(t);un(e)&&this.onBatchSubscribe(e.map((i,s)=>el(Go({},t[s]),{id:i})))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(e.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const t=[];this.pending.forEach(e=>{t.push(e)}),await this.batchSubscribe(t),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(va.pulse,async()=>{await this.checkPending()}),this.events.on(Xi.created,async t=>{const e=Xi.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),await this.persist()}),this.events.on(Xi.deleted,async t=>{const e=Xi.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=gt("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(){this.restartInProgress&&await new Promise(t=>{const e=setInterval(()=>{this.restartInProgress||(clearInterval(e),t())},this.pollingInterval)})}}var M7=Object.defineProperty,Xp=Object.getOwnPropertySymbols,C7=Object.prototype.hasOwnProperty,P7=Object.prototype.propertyIsEnumerable,Zp=(r,t,e)=>t in r?M7(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,O7=(r,t)=>{for(var e in t||(t={}))C7.call(t,e)&&Zp(r,e,t[e]);if(Xp)for(var e of Xp(t))P7.call(t,e)&&Zp(r,e,t[e]);return r};class N7 extends bI{constructor(t){super(t),this.protocol="wc",this.version=2,this.events=new Di.EventEmitter,this.name=Xx,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=yt.toMiliseconds(yt.THIRTY_SECONDS+yt.ONE_SECOND),this.request=async e=>{var i,s;this.logger.debug("Publishing Request Payload");const a=e.id||Ss().toString();await this.toEstablishConnection();try{const u=this.provider.request(e);this.requestsInFlight.set(a,{promise:u,request:e}),this.logger.trace({id:a,method:e.method,topic:(i=e.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const l=await new Promise(async(d,f)=>{const w=()=>{f(new Error(`relayer.request - publish interrupted, id: ${a}`))};this.provider.on(_i.disconnect,w);const E=await u;this.provider.off(_i.disconnect,w),d(E)});return this.logger.trace({id:a,method:e.method,topic:(s=e.params)==null?void 0:s.topic},"relayer.request - published"),l}catch(u){throw this.logger.debug(`Failed to Publish Request: ${a}`),u}finally{this.requestsInFlight.delete(a)}},this.resetPingTimeout=()=>{if(ia())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,i,s;(s=(i=(e=this.provider)==null?void 0:e.connection)==null?void 0:i.socket)==null||s.terminate()},this.heartBeatTimeout)}catch(e){this.logger.warn(e)}},this.onPayloadHandler=e=>{this.onProviderPayload(e),this.resetPingTimeout()},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(Hr.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=e=>{this.logger.error(e),this.events.emit(Hr.error,e),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(_i.payload,this.onPayloadHandler),this.provider.on(_i.connect,this.onConnectHandler),this.provider.on(_i.disconnect,this.onDisconnectHandler),this.provider.on(_i.error,this.onProviderErrorHandler)},this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Wr(t.logger,this.name):ya(fu({level:t.logger||Jx})),this.messages=new w7(this.logger,t.core),this.subscriber=new x7(this,this.logger),this.publisher=new b7(this,this.logger),this.relayUrl=(t==null?void 0:t.relayUrl)||wm,this.projectId=t.projectId,this.bundleId=t5(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Yp}...`),await this.restartTransport(Yp)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},r7)}get context(){return Gr(this.logger)}get connected(){var t,e,i;return((i=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:i.readyState)===1}get connecting(){var t,e,i;return((i=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:i.readyState)===0}async publish(t,e,i){this.isInitialized(),await this.publisher.publish(t,e,i),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now()})}async subscribe(t,e){var i;this.isInitialized();let s=((i=this.subscriber.topicMap.get(t))==null?void 0:i[0])||"",a;const u=l=>{l.topic===t&&(this.subscriber.off(Xi.created,u),a())};return await Promise.all([new Promise(l=>{a=l,this.subscriber.on(Xi.created,u)}),new Promise(async l=>{s=await this.subscriber.subscribe(t,e)||s,l()})]),s}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(t=>t.promise))}catch(t){this.logger.warn(t)}this.hasExperiencedNetworkDisruption||this.connected?await so(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(e,i)=>{const s=()=>{this.provider.off(_i.disconnect,s),i(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(_i.disconnect,s),await so(this.provider.connect(),yt.toMiliseconds(yt.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(a=>{i(a)}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,e()})}catch(e){this.logger.error(e);const i=e;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw e}finally{this.connectionAttemptInProgress=!1}}async restartTransport(t){this.connectionAttemptInProgress||(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await _p())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((i,s)=>i.publishedAt-s.publishedAt);this.logger.trace(`Batch of ${e.length} message events sorted`);for(const i of e)try{await this.onMessageEvent(i)}catch(s){this.logger.warn(s)}this.logger.trace(`Batch of ${e.length} message events processed`)}startPingTimeout(){var t,e,i,s,a;if(ia())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((a=(s=(i=this.provider)==null?void 0:i.connection)==null?void 0:s.socket)==null||a.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(u){this.logger.warn(u)}}isConnectionStalled(t){return this.staleConnectionErrors.some(e=>t.includes(e))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Cn(new uD(o5({sdkVersion:e7,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(t){const{topic:e,message:i}=t;await this.messages.set(e,i)}async shouldIgnoreMessageEvent(t){const{topic:e,message:i}=t;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(e))return this.logger.debug(`Ignoring message for non-subscribed topic ${e}`),!0;const s=this.messages.has(e,i);return s&&this.logger.debug(`Ignoring duplicate message: ${i}`),s}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),sf(t)){if(!t.method.endsWith(Zx))return;const e=t.params,{topic:i,message:s,publishedAt:a}=e.data,u={topic:i,message:s,publishedAt:a};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(O7({type:"event",event:e.id},u)),this.events.emit(e.id,u),await this.acknowledgePayload(t),await this.onMessageEvent(u)}else gu(t)&&this.events.emit(Hr.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(this.events.emit(Hr.message,t),await this.recordMessageEvent(t))}async acknowledgePayload(t){const e=du(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(_i.payload,this.onPayloadHandler),this.provider.off(_i.connect,this.onConnectHandler),this.provider.off(_i.disconnect,this.onDisconnectHandler),this.provider.off(_i.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await _p();sS(async e=>{t!==e&&(t=e,e?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(Hr.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t))},yt.toMiliseconds(t7))}isInitialized(){if(!this.initialized){const{message:t}=gt("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(t=>{const e=setInterval(()=>{this.connected&&(clearInterval(e),t())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var R7=Object.defineProperty,t1=Object.getOwnPropertySymbols,T7=Object.prototype.hasOwnProperty,F7=Object.prototype.propertyIsEnumerable,e1=(r,t,e)=>t in r?R7(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,r1=(r,t)=>{for(var e in t||(t={}))T7.call(t,e)&&e1(r,e,t[e]);if(t1)for(var e of t1(t))F7.call(t,e)&&e1(r,e,t[e]);return r};class Os extends _I{constructor(t,e,i,s=Wn,a=void 0){super(t,e,i,s),this.core=t,this.logger=e,this.name=i,this.map=new Map,this.version=i7,this.cached=[],this.initialized=!1,this.storagePrefix=Wn,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(u=>{this.getKey&&u!==null&&!Nr(u)?this.map.set(this.getKey(u),u):U4(u)?this.map.set(u.id,u):B4(u)&&this.map.set(u.topic,u)}),this.cached=[],this.initialized=!0)},this.set=async(u,l)=>{this.isInitialized(),this.map.has(u)?await this.update(u,l):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:u,value:l}),this.map.set(u,l),await this.persist())},this.get=u=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:u}),this.getData(u)),this.getAll=u=>(this.isInitialized(),u?this.values.filter(l=>Object.keys(u).every(d=>lD(l[d],u[d]))):this.values),this.update=async(u,l)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:u,update:l});const d=r1(r1({},this.getData(u)),l);this.map.set(u,d),await this.persist()},this.delete=async(u,l)=>{this.isInitialized(),this.map.has(u)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:u,reason:l}),this.map.delete(u),this.addToRecentlyDeleted(u),await this.persist())},this.logger=Wr(e,this.name),this.storagePrefix=s,this.getKey=a}get context(){return Gr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:s}=gt("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(s),new Error(s)}const{message:i}=gt("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(i),new Error(i)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=gt("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=gt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class U7{constructor(t,e){this.core=t,this.logger=e,this.name=c7,this.version=u7,this.events=new Ll,this.initialized=!1,this.storagePrefix=Wn,this.ignoredPayloadTypes=[xn],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const s=xl(),a=await this.core.crypto.setSymKey(s),u=gr(yt.FIVE_MINUTES),l={protocol:ym},d={topic:a,expiry:u,relay:l,active:!1},f=D4({protocol:this.core.protocol,version:this.core.version,topic:a,symKey:s,relay:l,expiryTimestamp:u,methods:i==null?void 0:i.methods});return this.core.expirer.set(a,u),await this.pairings.set(a,d),await this.core.relayer.subscribe(a),{topic:a,uri:f}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);const{topic:s,symKey:a,relay:u,expiryTimestamp:l,methods:d}=gp(i.uri);let f;if(this.pairings.keys.includes(s)&&(f=this.pairings.get(s),f.active))throw new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);const w=l||gr(yt.FIVE_MINUTES),E={topic:s,relay:u,expiry:w,active:!1,methods:d};return this.core.expirer.set(s,w),await this.pairings.set(s,E),i.activatePairing&&await this.activate({topic:s}),this.events.emit(io.create,E),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(a,s),await this.core.relayer.subscribe(s,{relay:u}),E},this.activate=async({topic:i})=>{this.isInitialized();const s=gr(yt.THIRTY_DAYS);this.core.expirer.set(i,s),await this.pairings.update(i,{active:!0,expiry:s})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:s}=i;if(this.pairings.keys.includes(s)){const a=await this.sendRequest(s,"wc_pairingPing",{}),{done:u,resolve:l,reject:d}=_s();this.events.once(de("pairing_ping",a),({error:f})=>{f?d(f):l()}),await u()}},this.updateExpiry=async({topic:i,expiry:s})=>{this.isInitialized(),await this.pairings.update(i,{expiry:s})},this.updateMetadata=async({topic:i,metadata:s})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:s})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:s}=i;this.pairings.keys.includes(s)&&(await this.sendRequest(s,"wc_pairingDelete",Re("USER_DISCONNECTED")),await this.deletePairing(s))},this.sendRequest=async(i,s,a)=>{const u=co(s,a),l=await this.core.crypto.encode(i,u),d=Vo[s].req;return this.core.history.set(i,u),this.core.relayer.publish(i,l,d),u.id},this.sendResult=async(i,s,a)=>{const u=du(i,a),l=await this.core.crypto.encode(s,u),d=await this.core.history.get(s,i),f=Vo[d.request.method].res;await this.core.relayer.publish(s,l,f),await this.core.history.resolve(u)},this.sendError=async(i,s,a)=>{const u=pu(i,a),l=await this.core.crypto.encode(s,u),d=await this.core.history.get(s,i),f=Vo[d.request.method]?Vo[d.request.method].res:Vo.unregistered_method.res;await this.core.relayer.publish(s,l,f),await this.core.history.resolve(u)},this.deletePairing=async(i,s)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,Re("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),s?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(s=>Hn(s.expiry));await Promise.all(i.map(s=>this.deletePairing(s.topic)))},this.onRelayEventRequest=i=>{const{topic:s,payload:a}=i;switch(a.method){case"wc_pairingPing":return this.onPairingPingRequest(s,a);case"wc_pairingDelete":return this.onPairingDeleteRequest(s,a);default:return this.onUnknownRpcMethodRequest(s,a)}},this.onRelayEventResponse=async i=>{const{topic:s,payload:a}=i,u=(await this.core.history.get(s,a.id)).request.method;switch(u){case"wc_pairingPing":return this.onPairingPingResponse(s,a);default:return this.onUnknownRpcMethodResponse(u)}},this.onPairingPingRequest=async(i,s)=>{const{id:a}=s;try{this.isValidPing({topic:i}),await this.sendResult(a,i,!0),this.events.emit(io.ping,{id:a,topic:i})}catch(u){await this.sendError(a,i,u),this.logger.error(u)}},this.onPairingPingResponse=(i,s)=>{const{id:a}=s;setTimeout(()=>{Ji(s)?this.events.emit(de("pairing_ping",a),{}):Si(s)&&this.events.emit(de("pairing_ping",a),{error:s.error})},500)},this.onPairingDeleteRequest=async(i,s)=>{const{id:a}=s;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(io.delete,{id:a,topic:i})}catch(u){await this.sendError(a,i,u),this.logger.error(u)}},this.onUnknownRpcMethodRequest=async(i,s)=>{const{id:a,method:u}=s;try{if(this.registeredMethods.includes(u))return;const l=Re("WC_METHOD_UNSUPPORTED",u);await this.sendError(a,i,l),this.logger.error(l)}catch(l){await this.sendError(a,i,l),this.logger.error(l)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(Re("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=i=>{var s;if(!kr(i)){const{message:u}=gt("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(u)}if(!F4(i.uri)){const{message:u}=gt("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(u)}const a=gp(i.uri);if(!((s=a==null?void 0:a.relay)!=null&&s.protocol)){const{message:u}=gt("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(u)}if(!(a!=null&&a.symKey)){const{message:u}=gt("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(u)}if(a!=null&&a.expiryTimestamp&&yt.toMiliseconds(a==null?void 0:a.expiryTimestamp)<Date.now()){const{message:u}=gt("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(u)}},this.isValidPing=async i=>{if(!kr(i)){const{message:a}=gt("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(a)}const{topic:s}=i;await this.isValidPairingTopic(s)},this.isValidDisconnect=async i=>{if(!kr(i)){const{message:a}=gt("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(a)}const{topic:s}=i;await this.isValidPairingTopic(s)},this.isValidPairingTopic=async i=>{if(!tr(i,!1)){const{message:s}=gt("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(s)}if(!this.pairings.keys.includes(i)){const{message:s}=gt("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(s)}if(Hn(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:s}=gt("EXPIRED",`pairing topic: ${i}`);throw new Error(s)}},this.core=t,this.logger=Wr(e,this.name),this.pairings=new Os(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Gr(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=gt("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(Hr.message,async t=>{const{topic:e,message:i}=t;if(!this.pairings.keys.includes(e)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(e,i);try{sf(s)?(this.core.history.set(e,s),this.onRelayEventRequest({topic:e,payload:s})):gu(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id))}catch(a){this.logger.error(a)}})}registerExpirerEvents(){this.core.expirer.on(Ei.expired,async t=>{const{topic:e}=rg(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(io.expire,{topic:e}))})}}class B7 extends vI{constructor(t,e){super(t,e),this.core=t,this.logger=e,this.records=new Map,this.events=new Di.EventEmitter,this.name=h7,this.version=l7,this.cached=[],this.initialized=!1,this.storagePrefix=Wn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,s,a)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:s,chainId:a}),this.records.has(s.id))return;const u={id:s.id,topic:i,request:{method:s.method,params:s.params||null},chainId:a,expiry:gr(yt.THIRTY_DAYS)};this.records.set(u.id,u),this.persist(),this.events.emit(Ti.created,u)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const s=await this.getRecord(i.id);typeof s.response>"u"&&(s.response=Si(i)?{error:i.error}:{result:i.result},this.records.set(s.id,s),this.persist(),this.events.emit(Ti.updated,s))},this.get=async(i,s)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:s}),await this.getRecord(s)),this.delete=(i,s)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:s}),this.values.forEach(a=>{if(a.topic===i){if(typeof s<"u"&&a.id!==s)return;this.records.delete(a.id),this.events.emit(Ti.deleted,a)}}),this.persist()},this.exists=async(i,s)=>(this.isInitialized(),this.records.has(s)?(await this.getRecord(s)).topic===i:!1),this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.logger=Wr(e,this.name)}get context(){return Gr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const i={topic:e.topic,request:co(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(i)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:i}=gt("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(i)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Ti.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=gt("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(Ti.created,t=>{const e=Ti.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(Ti.updated,t=>{const e=Ti.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(Ti.deleted,t=>{const e=Ti.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(va.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{yt.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(Ti.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=gt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class L7 extends AI{constructor(t,e){super(t,e),this.core=t,this.logger=e,this.expirations=new Map,this.events=new Di.EventEmitter,this.name=f7,this.version=d7,this.cached=[],this.initialized=!1,this.storagePrefix=Wn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const s=this.formatTarget(i);return typeof this.getExpiration(s)<"u"}catch{return!1}},this.set=(i,s)=>{this.isInitialized();const a=this.formatTarget(i),u={target:a,expiry:s};this.expirations.set(a,u),this.checkExpiry(a,u),this.events.emit(Ei.created,{target:a,expiration:u})},this.get=i=>{this.isInitialized();const s=this.formatTarget(i);return this.getExpiration(s)},this.del=i=>{if(this.isInitialized(),this.has(i)){const s=this.formatTarget(i),a=this.getExpiration(s);this.expirations.delete(s),this.events.emit(Ei.deleted,{target:s,expiration:a})}},this.on=(i,s)=>{this.events.on(i,s)},this.once=(i,s)=>{this.events.once(i,s)},this.off=(i,s)=>{this.events.off(i,s)},this.removeListener=(i,s)=>{this.events.removeListener(i,s)},this.logger=Wr(e,this.name)}get context(){return Gr(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(t){if(typeof t=="string")return a5(t);if(typeof t=="number")return c5(t);const{message:e}=gt("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ei.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=gt("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:i}=gt("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(i),new Error(i)}return e}checkExpiry(t,e){const{expiry:i}=e;yt.toMiliseconds(i)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(Ei.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(va.pulse,()=>this.checkExpirations()),this.events.on(Ei.created,t=>{const e=Ei.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Ei.expired,t=>{const e=Ei.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Ei.deleted,t=>{const e=Ei.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=gt("NOT_INITIALIZED",this.name);throw new Error(t)}}}class q7 extends SI{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,this.name=tl,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async i=>{if(this.verifyDisabled||po()||!go())return;const s=this.getVerifyUrl(i==null?void 0:i.verifyUrl);this.verifyUrl!==s&&this.removeIframe(),this.verifyUrl=s;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Rl;try{await this.createIframe()}catch(a){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(a),this.verifyDisabled=!0}}},this.register=async i=>{this.initialized?this.sendPost(i.attestationId):(this.addToQueue(i.attestationId),await this.init())},this.resolve=async i=>{if(this.isDevEnv)return"";const s=this.getVerifyUrl(i==null?void 0:i.verifyUrl);let a;try{a=await this.fetchAttestation(i.attestationId,s)}catch(u){this.logger.info(`failed to resolve attestation: ${i.attestationId} from url: ${s}`),this.logger.info(u),a=await this.fetchAttestation(i.attestationId,Rl)}return a},this.fetchAttestation=async(i,s)=>{this.logger.info(`resolving attestation: ${i} from url: ${s}`);const a=this.startAbortTimer(yt.ONE_SECOND*2),u=await fetch(`${s}/attestation/${i}`,{signal:this.abortController.signal});return clearTimeout(a),u.status===200?await u.json():void 0},this.addToQueue=i=>{this.queue.push(i)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(i=>this.sendPost(i)),this.queue=[])},this.sendPost=i=>{var s;try{if(!this.iframe)return;(s=this.iframe.contentWindow)==null||s.postMessage(i,"*"),this.logger.info(`postMessage sent: ${i} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let i;const s=a=>{a.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",s),i())};await Promise.race([new Promise(a=>{const u=document.getElementById(tl);if(u)return this.iframe=u,this.onInit(),a();window.addEventListener("message",s);const l=document.createElement("iframe");l.id=tl,l.src=`${this.verifyUrl}/${this.projectId}`,l.style.display="none",document.body.append(l),this.iframe=l,i=a}),new Promise((a,u)=>setTimeout(()=>{window.removeEventListener("message",s),u("verify iframe load timeout")},yt.toMiliseconds(yt.FIVE_SECONDS)))])},this.onInit=()=>{this.initialized=!0,this.processQueue()},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=i=>{let s=i||no;return p7.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${no}`),s=no),s},this.logger=Wr(e,this.name),this.verifyUrl=no,this.abortController=new AbortController,this.isDevEnv=ia()&&{}.IS_VITEST}get context(){return Gr(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),yt.toMiliseconds(t))}}let j7=class extends II{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,this.context=g7,this.registerDeviceToken=async i=>{const{clientId:s,token:a,notificationType:u,enableEncrypted:l=!1}=i,d=`${m7}/${this.projectId}/clients`;await gD(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:s,type:u,token:a,always_raw:l})})},this.logger=Wr(e,this.context)}};var $7=Object.defineProperty,i1=Object.getOwnPropertySymbols,z7=Object.prototype.hasOwnProperty,k7=Object.prototype.propertyIsEnumerable,n1=(r,t,e)=>t in r?$7(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,s1=(r,t)=>{for(var e in t||(t={}))z7.call(t,e)&&n1(r,e,t[e]);if(i1)for(var e of i1(t))k7.call(t,e)&&n1(r,e,t[e]);return r};let H7=class bm extends mI{constructor(t){var e;super(t),this.protocol=vm,this.version=jx,this.name=of,this.events=new Di.EventEmitter,this.initialized=!1,this.on=(u,l)=>this.events.on(u,l),this.once=(u,l)=>this.events.once(u,l),this.off=(u,l)=>this.events.off(u,l),this.removeListener=(u,l)=>this.events.removeListener(u,l),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||wm,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const i=fu({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:$x.logger}),{logger:s,chunkLoggerController:a}=gI({opts:i,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=a,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var u,l;(u=this.logChunkController)!=null&&u.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Wr(s,this.name),this.heartbeat=new $S,this.crypto=new y7(this,this.logger,t==null?void 0:t.keychain),this.history=new B7(this,this.logger),this.expirer=new L7(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new qS(s1(s1({},zx),t==null?void 0:t.storageOptions)),this.relayer=new N7({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new U7(this,this.logger),this.verify=new q7(this.projectId||"",this.logger),this.echoClient=new j7(this.projectId||"",this.logger)}static async init(t){const e=new bm(t);await e.initialize();const i=await e.crypto.getClientId();return await e.storage.setItem(n7,i),e}get context(){return Gr(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}};const K7=H7,_m="wc",Em=2,Am="client",af=`${_m}@${Em}:${Am}:`,rl={name:Am,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},o1="WALLETCONNECT_DEEPLINK_CHOICE",V7="proposal",Sm="Proposal expired",G7="session",Zs=yt.SEVEN_DAYS,W7="engine",pr={wc_sessionPropose:{req:{ttl:yt.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:1104},res:{ttl:yt.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:1106},res:{ttl:yt.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:yt.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:yt.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:1112},res:{ttl:yt.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:yt.ONE_DAY,prompt:!1,tag:1114},res:{ttl:yt.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:yt.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:yt.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:yt.FIVE_MINUTES,prompt:!1,tag:1119}}},il={min:yt.FIVE_MINUTES,max:yt.SEVEN_DAYS},Wi={idle:"IDLE",active:"ACTIVE"},Y7="request",Q7=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],J7="wc",X7="auth",Z7="authKeys",t9="pairingTopics",e9="requests",vu=`${J7}@${1.5}:${X7}:`,kc=`${vu}:PUB_KEY`;var r9=Object.defineProperty,i9=Object.defineProperties,n9=Object.getOwnPropertyDescriptors,a1=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,o9=Object.prototype.propertyIsEnumerable,c1=(r,t,e)=>t in r?r9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,sr=(r,t)=>{for(var e in t||(t={}))s9.call(t,e)&&c1(r,e,t[e]);if(a1)for(var e of a1(t))o9.call(t,e)&&c1(r,e,t[e]);return r},bs=(r,t)=>i9(r,n9(t));class a9 extends xI{constructor(t){super(t),this.name=W7,this.events=new Ll,this.initialized=!1,this.requestQueue={state:Wi.idle,queue:[]},this.sessionRequestQueue={state:Wi.idle,queue:[]},this.requestQueueDelay=yt.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(pr)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},yt.toMiliseconds(this.requestQueueDelay)))},this.connect=async e=>{await this.isInitialized();const i=bs(sr({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:s,requiredNamespaces:a,optionalNamespaces:u,sessionProperties:l,relays:d}=i;let f=s,w,E=!1;try{f&&(E=this.client.core.pairing.pairings.get(f).active)}catch(B){throw this.client.logger.error(`connect() -> pairing.get(${f}) failed`),B}if(!f||!E){const{topic:B,uri:z}=await this.client.core.pairing.create();f=B,w=z}if(!f){const{message:B}=gt("NO_MATCHING_KEY",`connect() pairing topic: ${f}`);throw new Error(B)}const S=await this.client.core.crypto.generateKeyPair(),D=pr.wc_sessionPropose.req.ttl||yt.FIVE_MINUTES,P=gr(D),Y=sr({requiredNamespaces:a,optionalNamespaces:u,relays:d??[{protocol:ym}],proposer:{publicKey:S,metadata:this.client.metadata},expiryTimestamp:P,pairingTopic:f},l&&{sessionProperties:l}),{reject:G,resolve:tt,done:K}=_s(D,Sm);this.events.once(de("session_connect"),async({error:B,session:z})=>{if(B)G(B);else if(z){z.self.publicKey=S;const $=bs(sr({},z),{pairingTopic:Y.pairingTopic,requiredNamespaces:Y.requiredNamespaces,optionalNamespaces:Y.optionalNamespaces});await this.client.session.set(z.topic,$),await this.setExpiry(z.topic,z.expiry),f&&await this.client.core.pairing.updateMetadata({topic:f,metadata:z.peer.metadata}),this.cleanupDuplicatePairings($),tt($)}});const V=await this.sendRequest({topic:f,method:"wc_sessionPropose",params:Y,throwOnFailedPublish:!0});return await this.setProposal(V,sr({id:V},Y)),{uri:w,approval:K}},this.pair=async e=>{await this.isInitialized();try{return await this.client.core.pairing.pair(e)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async e=>{await this.isInitialized();try{await this.isValidApprove(e)}catch(K){throw this.client.logger.error("approve() -> isValidApprove() failed"),K}const{id:i,relayProtocol:s,namespaces:a,sessionProperties:u,sessionConfig:l}=e;let d;try{d=this.client.proposal.get(i)}catch(K){throw this.client.logger.error(`approve() -> proposal.get(${i}) failed`),K}const{pairingTopic:f,proposer:w,requiredNamespaces:E,optionalNamespaces:S}=d,D=await this.client.core.crypto.generateKeyPair(),P=w.publicKey,Y=await this.client.core.crypto.generateSharedKey(D,P),G=sr(sr({relay:{protocol:s??"irn"},namespaces:a,controller:{publicKey:D,metadata:this.client.metadata},expiry:gr(Zs)},u&&{sessionProperties:u}),l&&{sessionConfig:l});await this.client.core.relayer.subscribe(Y);const tt=bs(sr({},G),{topic:Y,requiredNamespaces:E,optionalNamespaces:S,pairingTopic:f,acknowledged:!1,self:G.controller,peer:{publicKey:w.publicKey,metadata:w.metadata},controller:D});await this.client.session.set(Y,tt);try{await this.sendResult({id:i,topic:f,result:{relay:{protocol:s??"irn"},responderPublicKey:D},throwOnFailedPublish:!0}),await this.sendRequest({topic:Y,method:"wc_sessionSettle",params:G,throwOnFailedPublish:!0})}catch(K){throw this.client.logger.error(K),this.client.session.delete(Y,Re("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(Y),K}return await this.client.core.pairing.updateMetadata({topic:f,metadata:w.metadata}),await this.client.proposal.delete(i,Re("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(Y,gr(Zs)),{topic:Y,acknowledged:()=>new Promise(K=>setTimeout(()=>K(this.client.session.get(Y)),500))}},this.reject=async e=>{await this.isInitialized();try{await this.isValidReject(e)}catch(u){throw this.client.logger.error("reject() -> isValidReject() failed"),u}const{id:i,reason:s}=e;let a;try{a=this.client.proposal.get(i).pairingTopic}catch(u){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),u}a&&(await this.sendError({id:i,topic:a,error:s,rpcOpts:pr.wc_sessionPropose.reject}),await this.client.proposal.delete(i,Re("USER_DISCONNECTED")))},this.update=async e=>{await this.isInitialized();try{await this.isValidUpdate(e)}catch(E){throw this.client.logger.error("update() -> isValidUpdate() failed"),E}const{topic:i,namespaces:s}=e,{done:a,resolve:u,reject:l}=_s(),d=Kn(),f=Ss().toString(),w=this.client.session.get(i).namespaces;return this.events.once(de("session_update",d),({error:E})=>{E?l(E):u()}),await this.client.session.update(i,{namespaces:s}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:s},throwOnFailedPublish:!0,clientRpcId:d,relayRpcId:f}).catch(E=>{this.client.logger.error(E),this.client.session.update(i,{namespaces:w}),l(E)}),{acknowledged:a}},this.extend=async e=>{await this.isInitialized();try{await this.isValidExtend(e)}catch(d){throw this.client.logger.error("extend() -> isValidExtend() failed"),d}const{topic:i}=e,s=Kn(),{done:a,resolve:u,reject:l}=_s();return this.events.once(de("session_extend",s),({error:d})=>{d?l(d):u()}),await this.setExpiry(i,gr(Zs)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:s,throwOnFailedPublish:!0}).catch(d=>{l(d)}),{acknowledged:a}},this.request=async e=>{await this.isInitialized();try{await this.isValidRequest(e)}catch(D){throw this.client.logger.error("request() -> isValidRequest() failed"),D}const{chainId:i,request:s,topic:a,expiry:u=pr.wc_sessionRequest.req.ttl}=e,l=this.client.session.get(a),d=Kn(),f=Ss().toString(),{done:w,resolve:E,reject:S}=_s(u,"Request expired. Please try again.");return this.events.once(de("session_request",d),({error:D,result:P})=>{D?S(D):E(P)}),await Promise.all([new Promise(async D=>{await this.sendRequest({clientRpcId:d,relayRpcId:f,topic:a,method:"wc_sessionRequest",params:{request:bs(sr({},s),{expiryTimestamp:gr(u)}),chainId:i},expiry:u,throwOnFailedPublish:!0}).catch(P=>S(P)),this.client.events.emit("session_request_sent",{topic:a,request:s,chainId:i,id:d}),D()}),new Promise(async D=>{var P;if(!((P=l.sessionConfig)!=null&&P.disableDeepLink)){const Y=await h5(this.client.core.storage,o1);u5({id:d,topic:a,wcDeepLink:Y})}D()}),w()]).then(D=>D[2])},this.respond=async e=>{await this.isInitialized(),await this.isValidRespond(e);const{topic:i,response:s}=e,{id:a}=s;Ji(s)?await this.sendResult({id:a,topic:i,result:s.result,throwOnFailedPublish:!0}):Si(s)&&await this.sendError({id:a,topic:i,error:s.error}),this.cleanupAfterResponse(e)},this.ping=async e=>{await this.isInitialized();try{await this.isValidPing(e)}catch(s){throw this.client.logger.error("ping() -> isValidPing() failed"),s}const{topic:i}=e;if(this.client.session.keys.includes(i)){const s=Kn(),a=Ss().toString(),{done:u,resolve:l,reject:d}=_s();this.events.once(de("session_ping",s),({error:f})=>{f?d(f):l()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:a}),u()])}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async e=>{await this.isInitialized(),await this.isValidEmit(e);const{topic:i,event:s,chainId:a}=e,u=Ss().toString();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:s,chainId:a},throwOnFailedPublish:!0,relayRpcId:u})},this.disconnect=async e=>{await this.isInitialized(),await this.isValidDisconnect(e);const{topic:i}=e;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:Re("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:s}=gt("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(s)}},this.find=e=>(this.isInitialized(),this.client.session.getAll().filter(i=>R4(i,e))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async e=>{this.isInitialized(),this.isValidAuthenticate(e);const{chains:i,statement:s="",uri:a,domain:u,nonce:l,type:d,exp:f,nbf:w,methods:E=[],expiry:S}=e,D=[...e.resources||[]],{topic:P,uri:Y}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:P,uri:Y}});const G=await this.client.core.crypto.generateKeyPair(),tt=jc(G);if(await Promise.all([this.client.auth.authKeys.set(kc,{responseTopic:tt,publicKey:G}),this.client.auth.pairingTopics.set(tt,{topic:tt,pairingTopic:P})]),await this.client.core.relayer.subscribe(tt),this.client.logger.info(`sending request to new pairing topic: ${P}`),E.length>0){const{namespace:h}=Tc(i[0]);let y=i4(h,"request",E);qc(D)&&(y=s4(y,D.pop())),D.push(y)}const K=S&&S>pr.wc_sessionAuthenticate.req.ttl?S:pr.wc_sessionAuthenticate.req.ttl,V={authPayload:{type:d??"caip122",chains:i,statement:s,aud:a,domain:u,version:"1",nonce:l,iat:new Date().toISOString(),exp:f,nbf:w,resources:D},requester:{publicKey:G,metadata:this.client.metadata},expiryTimestamp:gr(K)},B={eip155:{chains:i,methods:[...new Set(["personal_sign",...E])],events:["chainChanged","accountsChanged"]}},z={requiredNamespaces:{},optionalNamespaces:B,relays:[{protocol:"irn"}],pairingTopic:P,proposer:{publicKey:G,metadata:this.client.metadata},expiryTimestamp:gr(pr.wc_sessionPropose.req.ttl)},{done:$,resolve:v,reject:T}=_s(K,"Request expired"),nt=async({error:h,session:y})=>{if(this.events.off(de("session_request",pt),ft),h)T(h);else if(y){y.self.publicKey=G,await this.client.session.set(y.topic,y),await this.setExpiry(y.topic,y.expiry),P&&await this.client.core.pairing.updateMetadata({topic:P,metadata:y.peer.metadata});const b=this.client.session.get(y.topic);await this.deleteProposal(mt),v({session:b})}},ft=async h=>{if(await this.deletePendingAuthRequest(pt,{message:"fulfilled",code:0}),h.error){const I=Re("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return h.error.code===I.code?void 0:(this.events.off(de("session_connect"),nt),T(h.error.message))}await this.deleteProposal(mt),this.events.off(de("session_connect"),nt);const{cacaos:y,responder:b}=h.result,M=[],C=[];for(const I of y){await ap({cacao:I,projectId:this.client.core.projectId})||(this.client.logger.error(I,"Signature verification failed"),T(Re("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:g}=I,N=qc(g.resources),it=[op(g.iss)],lt=Qc(g.iss);if(N){const _=cp(N),Z=up(N);M.push(..._),it.push(...Z)}for(const _ of it)C.push(`${_}:${lt}`)}const R=await this.client.core.crypto.generateSharedKey(G,b.publicKey);let j;M.length>0&&(j={topic:R,acknowledged:!0,self:{publicKey:G,metadata:this.client.metadata},peer:b,controller:b.publicKey,expiry:gr(Zs),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:P,namespaces:mp([...new Set(M)],[...new Set(C)])},await this.client.core.relayer.subscribe(R),await this.client.session.set(R,j),j=this.client.session.get(R)),v({auths:y,session:j})},pt=Kn(),mt=Kn();this.events.once(de("session_connect"),nt),this.events.once(de("session_request",pt),ft);try{await Promise.all([this.sendRequest({topic:P,method:"wc_sessionAuthenticate",params:V,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:pt}),this.sendRequest({topic:P,method:"wc_sessionPropose",params:z,expiry:pr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:mt})])}catch(h){throw this.events.off(de("session_connect"),nt),this.events.off(de("session_request",pt),ft),h}return await this.setProposal(mt,sr({id:mt},z)),await this.setAuthRequest(pt,{request:bs(sr({},V),{verifyContext:{}}),pairingTopic:P}),{uri:Y,response:$}},this.approveSessionAuthenticate=async e=>{this.isInitialized();const{id:i,auths:s}=e,a=this.getPendingAuthRequest(i);if(!a)throw new Error(`Could not find pending auth request with id ${i}`);const u=a.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=jc(u),f={type:xn,receiverPublicKey:u,senderPublicKey:l},w=[],E=[];for(const P of s){if(!await ap({cacao:P,projectId:this.client.core.projectId})){const V=Re("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:d,error:V,encodeOpts:f}),new Error(V.message)}const{p:Y}=P,G=qc(Y.resources),tt=[op(Y.iss)],K=Qc(Y.iss);if(G){const V=cp(G),B=up(G);w.push(...V),tt.push(...B)}for(const V of tt)E.push(`${V}:${K}`)}const S=await this.client.core.crypto.generateSharedKey(l,u);let D;return(w==null?void 0:w.length)>0&&(D={topic:S,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:u,metadata:a.requester.metadata},controller:u,expiry:gr(Zs),authentication:s,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:"",namespaces:mp([...new Set(w)],[...new Set(E)])},await this.client.core.relayer.subscribe(S),await this.client.session.set(S,D)),await this.sendResult({topic:d,id:i,result:{cacaos:s,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:f,throwOnFailedPublish:!0}),await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:a.pairingTopic}),{session:D}},this.rejectSessionAuthenticate=async e=>{await this.isInitialized();const{id:i,reason:s}=e,a=this.getPendingAuthRequest(i);if(!a)throw new Error(`Could not find pending auth request with id ${i}`);const u=a.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),d=jc(u),f={type:xn,receiverPublicKey:u,senderPublicKey:l};await this.sendError({id:i,topic:d,error:s,encodeOpts:f,rpcOpts:pr.wc_sessionAuthenticate.reject}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,Re("USER_DISCONNECTED"))},this.formatAuthMessage=e=>{this.isInitialized();const{request:i,iss:s}=e;return Lg(i,s)},this.cleanupDuplicatePairings=async e=>{if(e.pairingTopic)try{const i=this.client.core.pairing.pairings.get(e.pairingTopic),s=this.client.core.pairing.pairings.getAll().filter(a=>{var u,l;return((u=a.peerMetadata)==null?void 0:u.url)&&((l=a.peerMetadata)==null?void 0:l.url)===e.peer.metadata.url&&a.topic&&a.topic!==i.topic});if(s.length===0)return;this.client.logger.info(`Cleaning up ${s.length} duplicate pairing(s)`),await Promise.all(s.map(a=>this.client.core.pairing.disconnect({topic:a.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async e=>{var i;const{topic:s,expirerHasDeleted:a=!1,emitEvent:u=!0,id:l=0}=e,{self:d}=this.client.session.get(s);await this.client.core.relayer.unsubscribe(s),await this.client.session.delete(s,Re("USER_DISCONNECTED")),this.addToRecentlyDeleted(s,"session"),this.client.core.crypto.keychain.has(d.publicKey)&&await this.client.core.crypto.deleteKeyPair(d.publicKey),this.client.core.crypto.keychain.has(s)&&await this.client.core.crypto.deleteSymKey(s),a||this.client.core.expirer.del(s),this.client.core.storage.removeItem(o1).catch(f=>this.client.logger.warn(f)),this.getPendingSessionRequests().forEach(f=>{f.topic===s&&this.deletePendingSessionRequest(f.id,Re("USER_DISCONNECTED"))}),s===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=Wi.idle),u&&this.client.events.emit("session_delete",{id:l,topic:s})},this.deleteProposal=async(e,i)=>{await Promise.all([this.client.proposal.delete(e,Re("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")},this.deletePendingSessionRequest=async(e,i,s=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,i),s?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(a=>a.id!==e),s&&(this.sessionRequestQueue.state=Wi.idle,this.client.events.emit("session_request_expire",{id:e}))},this.deletePendingAuthRequest=async(e,i,s=!1)=>{await Promise.all([this.client.auth.requests.delete(e,i),s?Promise.resolve():this.client.core.expirer.del(e)])},this.setExpiry=async(e,i)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,i),await this.client.session.update(e,{expiry:i}))},this.setProposal=async(e,i)=>{this.client.core.expirer.set(e,gr(pr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,i)},this.setAuthRequest=async(e,i)=>{const{request:s,pairingTopic:a}=i;this.client.core.expirer.set(e,s.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:s.authPayload,requester:s.requester,expiryTimestamp:s.expiryTimestamp,id:e,pairingTopic:a,verifyContext:s.verifyContext})},this.setPendingSessionRequest=async e=>{const{id:i,topic:s,params:a,verifyContext:u}=e,l=a.request.expiryTimestamp||gr(pr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,l),await this.client.pendingRequest.set(i,{id:i,topic:s,params:a,verifyContext:u})},this.sendRequest=async e=>{const{topic:i,method:s,params:a,expiry:u,relayRpcId:l,clientRpcId:d,throwOnFailedPublish:f}=e,w=co(s,a,d);if(go()&&Q7.includes(s)){const D=As(JSON.stringify(w));this.client.core.verify.register({attestationId:D})}let E;try{E=await this.client.core.crypto.encode(i,w)}catch(D){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),D}const S=pr[s].req;return u&&(S.ttl=u),l&&(S.id=l),this.client.core.history.set(i,w),f?(S.internal=bs(sr({},S.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,E,S)):this.client.core.relayer.publish(i,E,S).catch(D=>this.client.logger.error(D)),w.id},this.sendResult=async e=>{const{id:i,topic:s,result:a,throwOnFailedPublish:u,encodeOpts:l}=e,d=du(i,a);let f;try{f=await this.client.core.crypto.encode(s,d,l)}catch(S){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),S}let w;try{w=await this.client.core.history.get(s,i)}catch(S){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${i}) failed`),S}const E=pr[w.request.method].res;u?(E.internal=bs(sr({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,f,E)):this.client.core.relayer.publish(s,f,E).catch(S=>this.client.logger.error(S)),await this.client.core.history.resolve(d)},this.sendError=async e=>{const{id:i,topic:s,error:a,encodeOpts:u,rpcOpts:l}=e,d=pu(i,a);let f;try{f=await this.client.core.crypto.encode(s,d,u)}catch(S){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),S}let w;try{w=await this.client.core.history.get(s,i)}catch(S){throw this.client.logger.error(`sendError() -> history.get(${s}, ${i}) failed`),S}const E=l||pr[w.request.method].res;this.client.core.relayer.publish(s,f,E),await this.client.core.history.resolve(d)},this.cleanup=async()=>{const e=[],i=[];this.client.session.getAll().forEach(s=>{let a=!1;Hn(s.expiry)&&(a=!0),this.client.core.crypto.keychain.has(s.topic)||(a=!0),a&&e.push(s.topic)}),this.client.proposal.getAll().forEach(s=>{Hn(s.expiryTimestamp)&&i.push(s.id)}),await Promise.all([...e.map(s=>this.deleteSession({topic:s})),...i.map(s=>this.deleteProposal(s))])},this.onRelayEventRequest=async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Wi.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Wi.active;const e=this.requestQueue.queue.shift();if(e)try{this.processRequest(e),await new Promise(i=>setTimeout(i,300))}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=Wi.idle},this.processRequest=e=>{const{topic:i,payload:s}=e,a=s.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:a}))switch(a){case"wc_sessionPropose":return this.onSessionProposeRequest(i,s);case"wc_sessionSettle":return this.onSessionSettleRequest(i,s);case"wc_sessionUpdate":return this.onSessionUpdateRequest(i,s);case"wc_sessionExtend":return this.onSessionExtendRequest(i,s);case"wc_sessionPing":return this.onSessionPingRequest(i,s);case"wc_sessionDelete":return this.onSessionDeleteRequest(i,s);case"wc_sessionRequest":return this.onSessionRequest(i,s);case"wc_sessionEvent":return this.onSessionEventRequest(i,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateRequest(i,s);default:return this.client.logger.info(`Unsupported request method ${a}`)}},this.onRelayEventResponse=async e=>{const{topic:i,payload:s}=e,a=(await this.client.core.history.get(i,s.id)).request.method;switch(a){case"wc_sessionPropose":return this.onSessionProposeResponse(i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(i,s);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,s);case"wc_sessionExtend":return this.onSessionExtendResponse(i,s);case"wc_sessionPing":return this.onSessionPingResponse(i,s);case"wc_sessionRequest":return this.onSessionRequestResponse(i,s);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,s);default:return this.client.logger.info(`Unsupported response method ${a}`)}},this.onRelayEventUnknownPayload=e=>{const{topic:i}=e,{message:s}=gt("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(s)},this.shouldIgnorePairingRequest=e=>{const{topic:i,requestMethod:s}=e,a=this.expectedPairingMethodMap.get(i);return!a||a.includes(s)?!1:!!(a.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async(e,i)=>{const{params:s,id:a}=i;try{this.isValidConnect(sr({},i.params));const u=s.expiryTimestamp||gr(pr.wc_sessionPropose.req.ttl),l=sr({id:a,pairingTopic:e,expiryTimestamp:u},s);await this.setProposal(a,l);const d=As(JSON.stringify(i)),f=await this.getVerifyContext(d,l.proposer.metadata);this.client.events.emit("session_proposal",{id:a,params:l,verifyContext:f})}catch(u){await this.sendError({id:a,topic:e,error:u,rpcOpts:pr.wc_sessionPropose.autoReject}),this.client.logger.error(u)}},this.onSessionProposeResponse=async(e,i)=>{const{id:s}=i;if(Ji(i)){const{result:a}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:a});const u=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:u});const l=u.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const d=a.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:d});const f=await this.client.core.crypto.generateSharedKey(l,d);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:f});const w=await this.client.core.relayer.subscribe(f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:w}),await this.client.core.pairing.activate({topic:e})}else if(Si(i)){await this.client.proposal.delete(s,Re("USER_DISCONNECTED"));const a=de("session_connect");if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners, 954`);this.events.emit(de("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(e,i)=>{const{id:s,params:a}=i;try{this.isValidSessionSettleRequest(a);const{relay:u,controller:l,expiry:d,namespaces:f,sessionProperties:w,sessionConfig:E}=i.params,S=sr(sr({topic:e,relay:u,expiry:d,namespaces:f,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:l.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:l.publicKey,metadata:l.metadata}},w&&{sessionProperties:w}),E&&{sessionConfig:E});await this.sendResult({id:i.id,topic:e,result:!0,throwOnFailedPublish:!0});const D=de("session_connect");if(this.events.listenerCount(D)===0)throw new Error(`emitting ${D} without any listeners 997`);this.events.emit(de("session_connect"),{session:S})}catch(u){await this.sendError({id:s,topic:e,error:u}),this.client.logger.error(u)}},this.onSessionSettleResponse=async(e,i)=>{const{id:s}=i;Ji(i)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(de("session_approve",s),{})):Si(i)&&(await this.client.session.delete(e,Re("USER_DISCONNECTED")),this.events.emit(de("session_approve",s),{error:i.error}))},this.onSessionUpdateRequest=async(e,i)=>{const{params:s,id:a}=i;try{const u=`${e}_session_update`,l=Ko.get(u);if(l&&this.isRequestOutOfSync(l,a)){this.client.logger.info(`Discarding out of sync request - ${a}`),this.sendError({id:a,topic:e,error:Re("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(sr({topic:e},s));try{Ko.set(u,a),await this.client.session.update(e,{namespaces:s.namespaces}),await this.sendResult({id:a,topic:e,result:!0,throwOnFailedPublish:!0})}catch(d){throw Ko.delete(u),d}this.client.events.emit("session_update",{id:a,topic:e,params:s})}catch(u){await this.sendError({id:a,topic:e,error:u}),this.client.logger.error(u)}},this.isRequestOutOfSync=(e,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(e.toString().slice(0,-3)),this.onSessionUpdateResponse=(e,i)=>{const{id:s}=i,a=de("session_update",s);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Ji(i)?this.events.emit(de("session_update",s),{}):Si(i)&&this.events.emit(de("session_update",s),{error:i.error})},this.onSessionExtendRequest=async(e,i)=>{const{id:s}=i;try{this.isValidExtend({topic:e}),await this.setExpiry(e,gr(Zs)),await this.sendResult({id:s,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:s,topic:e})}catch(a){await this.sendError({id:s,topic:e,error:a}),this.client.logger.error(a)}},this.onSessionExtendResponse=(e,i)=>{const{id:s}=i,a=de("session_extend",s);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Ji(i)?this.events.emit(de("session_extend",s),{}):Si(i)&&this.events.emit(de("session_extend",s),{error:i.error})},this.onSessionPingRequest=async(e,i)=>{const{id:s}=i;try{this.isValidPing({topic:e}),await this.sendResult({id:s,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:s,topic:e})}catch(a){await this.sendError({id:s,topic:e,error:a}),this.client.logger.error(a)}},this.onSessionPingResponse=(e,i)=>{const{id:s}=i,a=de("session_ping",s);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);setTimeout(()=>{Ji(i)?this.events.emit(de("session_ping",s),{}):Si(i)&&this.events.emit(de("session_ping",s),{error:i.error})},500)},this.onSessionDeleteRequest=async(e,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:e,reason:i.params}),await Promise.all([new Promise(a=>{this.client.core.relayer.once(Hr.publish,async()=>{a(await this.deleteSession({topic:e,id:s}))})}),this.sendResult({id:s,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:Re("USER_DISCONNECTED")})])}catch(a){this.client.logger.error(a)}},this.onSessionRequest=async(e,i)=>{var s;const{id:a,params:u}=i;try{await this.isValidRequest(sr({topic:e},u));const l=As(JSON.stringify(co("wc_sessionRequest",u,a))),d=this.client.session.get(e),f=await this.getVerifyContext(l,d.peer.metadata),w={id:a,topic:e,params:u,verifyContext:f};await this.setPendingSessionRequest(w),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(w):(this.addSessionRequestToSessionRequestQueue(w),this.processSessionRequestQueue())}catch(l){await this.sendError({id:a,topic:e,error:l}),this.client.logger.error(l)}},this.onSessionRequestResponse=(e,i)=>{const{id:s}=i,a=de("session_request",s);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);Ji(i)?this.events.emit(de("session_request",s),{result:i.result}):Si(i)&&this.events.emit(de("session_request",s),{error:i.error})},this.onSessionEventRequest=async(e,i)=>{const{id:s,params:a}=i;try{const u=`${e}_session_event_${a.event.name}`,l=Ko.get(u);if(l&&this.isRequestOutOfSync(l,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidEmit(sr({topic:e},a)),this.client.events.emit("session_event",{id:s,topic:e,params:a}),Ko.set(u,s)}catch(u){await this.sendError({id:s,topic:e,error:u}),this.client.logger.error(u)}},this.onSessionAuthenticateResponse=(e,i)=>{const{id:s}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:i}),Ji(i)?this.events.emit(de("session_request",s),{result:i.result}):Si(i)&&this.events.emit(de("session_request",s),{error:i.error})},this.onSessionAuthenticateRequest=async(e,i)=>{try{const{requester:s,authPayload:a,expiryTimestamp:u}=i.params,l=As(JSON.stringify(i)),d=await this.getVerifyContext(l,this.client.metadata),f={requester:s,pairingTopic:e,id:i.id,authPayload:a,verifyContext:d,expiryTimestamp:u};await this.setAuthRequest(i.id,{request:f,pairingTopic:e}),this.client.events.emit("session_authenticate",{topic:e,params:i.params,id:i.id})}catch(s){this.client.logger.error(s);const a=i.params.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),l={type:xn,receiverPublicKey:a,senderPublicKey:u};await this.sendError({id:i.id,topic:e,error:s,encodeOpts:l,rpcOpts:pr.wc_sessionAuthenticate.autoReject})}},this.addSessionRequestToSessionRequestQueue=e=>{this.sessionRequestQueue.queue.push(e)},this.cleanupAfterResponse=e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Wi.idle,this.processSessionRequestQueue()},yt.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:e,error:i})=>{const s=this.client.core.history.pending;s.length>0&&s.filter(a=>a.topic===e&&a.request.method==="wc_sessionRequest").forEach(a=>{const u=a.request.id,l=de("session_request",u);if(this.events.listenerCount(l)===0)throw new Error(`emitting ${l} without any listeners`);this.events.emit(de("session_request",a.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Wi.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Wi.active,this.emitSessionRequest(e)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=e=>{this.client.events.emit("session_request",e)},this.onPairingCreated=e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const i=this.client.proposal.getAll().find(s=>s.pairingTopic===e.topic);i&&this.onSessionProposeRequest(e.topic,co("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id))},this.isValidConnect=async e=>{if(!kr(e)){const{message:d}=gt("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(d)}const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:a,sessionProperties:u,relays:l}=e;if(Nr(i)||await this.isValidPairingTopic(i),!K4(l,!0)){const{message:d}=gt("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(d)}!Nr(s)&&oa(s)!==0&&this.validateNamespaces(s,"requiredNamespaces"),!Nr(a)&&oa(a)!==0&&this.validateNamespaces(a,"optionalNamespaces"),Nr(u)||this.validateSessionProps(u,"sessionProperties")},this.validateNamespaces=(e,i)=>{const s=H4(e,"connect()",i);if(s)throw new Error(s.message)},this.isValidApprove=async e=>{if(!kr(e))throw new Error(gt("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:i,namespaces:s,relayProtocol:a,sessionProperties:u}=e;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const l=this.client.proposal.get(i),d=Gh(s,"approve()");if(d)throw new Error(d.message);const f=wp(l.requiredNamespaces,s,"approve()");if(f)throw new Error(f.message);if(!tr(a,!0)){const{message:w}=gt("MISSING_OR_INVALID",`approve() relayProtocol: ${a}`);throw new Error(w)}Nr(u)||this.validateSessionProps(u,"sessionProperties")},this.isValidReject=async e=>{if(!kr(e)){const{message:a}=gt("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(a)}const{id:i,reason:s}=e;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!G4(s)){const{message:a}=gt("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(s)}`);throw new Error(a)}},this.isValidSessionSettleRequest=e=>{if(!kr(e)){const{message:f}=gt("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(f)}const{relay:i,controller:s,namespaces:a,expiry:u}=e;if(!Hg(i)){const{message:f}=gt("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(f)}const l=L4(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);const d=Gh(a,"onSessionSettleRequest()");if(d)throw new Error(d.message);if(Hn(u)){const{message:f}=gt("EXPIRED","onSessionSettleRequest()");throw new Error(f)}},this.isValidUpdate=async e=>{if(!kr(e)){const{message:d}=gt("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(d)}const{topic:i,namespaces:s}=e;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const a=this.client.session.get(i),u=Gh(s,"update()");if(u)throw new Error(u.message);const l=wp(a.requiredNamespaces,s,"update()");if(l)throw new Error(l.message)},this.isValidExtend=async e=>{if(!kr(e)){const{message:s}=gt("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(s)}const{topic:i}=e;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async e=>{if(!kr(e)){const{message:d}=gt("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(d)}const{topic:i,request:s,chainId:a,expiry:u}=e;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:l}=this.client.session.get(i);if(!yp(l,a)){const{message:d}=gt("MISSING_OR_INVALID",`request() chainId: ${a}`);throw new Error(d)}if(!W4(s)){const{message:d}=gt("MISSING_OR_INVALID",`request() ${JSON.stringify(s)}`);throw new Error(d)}if(!J4(l,a,s.method)){const{message:d}=gt("MISSING_OR_INVALID",`request() method: ${s.method}`);throw new Error(d)}if(u&&!eS(u,il)){const{message:d}=gt("MISSING_OR_INVALID",`request() expiry: ${u}. Expiry must be a number (in seconds) between ${il.min} and ${il.max}`);throw new Error(d)}},this.isValidRespond=async e=>{var i;if(!kr(e)){const{message:u}=gt("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(u)}const{topic:s,response:a}=e;try{await this.isValidSessionTopic(s)}catch(u){throw(i=e==null?void 0:e.response)!=null&&i.id&&this.cleanupAfterResponse(e),u}if(!Y4(a)){const{message:u}=gt("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(u)}},this.isValidPing=async e=>{if(!kr(e)){const{message:s}=gt("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(s)}const{topic:i}=e;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async e=>{if(!kr(e)){const{message:l}=gt("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(l)}const{topic:i,event:s,chainId:a}=e;await this.isValidSessionTopic(i);const{namespaces:u}=this.client.session.get(i);if(!yp(u,a)){const{message:l}=gt("MISSING_OR_INVALID",`emit() chainId: ${a}`);throw new Error(l)}if(!Q4(s)){const{message:l}=gt("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(l)}if(!X4(u,a,s.name)){const{message:l}=gt("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(s)}`);throw new Error(l)}},this.isValidDisconnect=async e=>{if(!kr(e)){const{message:s}=gt("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(s)}const{topic:i}=e;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=e=>{const{chains:i,uri:s,domain:a,nonce:u}=e;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!tr(s,!1))throw new Error("uri is required parameter");if(!tr(a,!1))throw new Error("domain is required parameter");if(!tr(u,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(d=>Tc(d).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:l}=Tc(i[0]);if(l!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async(e,i)=>{const s={verified:{verifyUrl:i.verifyUrl||no,validation:"UNKNOWN",origin:i.url||""}};try{const a=await this.client.core.verify.resolve({attestationId:e,verifyUrl:i.verifyUrl});a&&(s.verified.origin=a.origin,s.verified.isScam=a.isScam,s.verified.validation=a.origin===new URL(i.url).origin?"VALID":"INVALID")}catch(a){this.client.logger.info(a)}return this.client.logger.info(`Verify context: ${JSON.stringify(s)}`),s},this.validateSessionProps=(e,i)=>{Object.values(e).forEach(s=>{if(!tr(s,!1)){const{message:a}=gt("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(s)}`);throw new Error(a)}})},this.getPendingAuthRequest=e=>{const i=this.client.auth.requests.get(e);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(e,i)=>{if(this.recentlyDeletedMap.set(e,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let s=0;const a=this.recentlyDeletedLimit/2;for(const u of this.recentlyDeletedMap.keys()){if(s++>=a)break;this.recentlyDeletedMap.delete(u)}}},this.checkRecentlyDeleted=e=>{const i=this.recentlyDeletedMap.get(e);if(i){const{message:s}=gt("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${e}`);throw new Error(s)}}}async isInitialized(){if(!this.initialized){const{message:t}=gt("NOT_INITIALIZED",this.name);throw new Error(t)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Hr.message,async t=>{const{topic:e,message:i}=t,{publicKey:s}=this.client.auth.authKeys.keys.includes(kc)?this.client.auth.authKeys.get(kc):{responseTopic:void 0,publicKey:void 0},a=await this.client.core.crypto.decode(e,i,{receiverPublicKey:s});try{sf(a)?(this.client.core.history.set(e,a),this.onRelayEventRequest({topic:e,payload:a})):gu(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:e,payload:a}),this.client.core.history.delete(e,a.id)):this.onRelayEventUnknownPayload({topic:e,payload:a})}catch(u){this.client.logger.error(u)}})}registerExpirerEvents(){this.client.core.expirer.on(Ei.expired,async t=>{const{topic:e,id:i}=rg(t.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,gt("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,gt("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(io.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(io.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!tr(t,!1)){const{message:e}=gt("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=gt("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(Hn(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=gt("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!tr(t,!1)){const{message:e}=gt("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=gt("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(Hn(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=gt("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=gt("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(tr(t,!1)){const{message:e}=gt("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=gt("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!V4(t)){const{message:e}=gt("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=gt("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(Hn(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=gt("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class c9 extends Os{constructor(t,e){super(t,e,V7,af),this.core=t,this.logger=e}}class u9 extends Os{constructor(t,e){super(t,e,G7,af),this.core=t,this.logger=e}}class h9 extends Os{constructor(t,e){super(t,e,Y7,af,i=>i.id),this.core=t,this.logger=e}}class l9 extends Os{constructor(t,e){super(t,e,Z7,vu,()=>kc),this.core=t,this.logger=e}}class f9 extends Os{constructor(t,e){super(t,e,t9,vu),this.core=t,this.logger=e}}class d9 extends Os{constructor(t,e){super(t,e,e9,vu,i=>i.id),this.core=t,this.logger=e}}class p9{constructor(t,e){this.core=t,this.logger=e,this.authKeys=new l9(this.core,this.logger),this.pairingTopics=new f9(this.core,this.logger),this.requests=new d9(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class cf extends DI{constructor(t){super(t),this.protocol=_m,this.version=Em,this.name=rl.name,this.events=new Di.EventEmitter,this.on=(i,s)=>this.events.on(i,s),this.once=(i,s)=>this.events.once(i,s),this.off=(i,s)=>this.events.off(i,s),this.removeListener=(i,s)=>this.events.removeListener(i,s),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(s){throw this.logger.error(s.message),s}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(s){throw this.logger.error(s.message),s}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(s){throw this.logger.error(s.message),s}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(s){throw this.logger.error(s.message),s}},this.update=async i=>{try{return await this.engine.update(i)}catch(s){throw this.logger.error(s.message),s}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(s){throw this.logger.error(s.message),s}},this.request=async i=>{try{return await this.engine.request(i)}catch(s){throw this.logger.error(s.message),s}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(s){throw this.logger.error(s.message),s}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(s){throw this.logger.error(s.message),s}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(s){throw this.logger.error(s.message),s}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(s){throw this.logger.error(s.message),s}},this.find=i=>{try{return this.engine.find(i)}catch(s){throw this.logger.error(s.message),s}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async i=>{try{return await this.engine.authenticate(i)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(s){throw this.logger.error(s.message),s}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(s){throw this.logger.error(s.message),s}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(s){throw this.logger.error(s.message),s}},this.name=(t==null?void 0:t.name)||rl.name,this.metadata=(t==null?void 0:t.metadata)||r5(),this.signConfig=t==null?void 0:t.signConfig;const e=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:ya(fu({level:(t==null?void 0:t.logger)||rl.logger}));this.core=(t==null?void 0:t.core)||new K7(t),this.logger=Wr(e,this.name),this.session=new u9(this.core,this.logger),this.proposal=new c9(this.core,this.logger),this.pendingRequest=new h9(this.core,this.logger),this.engine=new a9(this),this.auth=new p9(this.core,this.logger)}static async init(t){const e=new cf(t);return await e.initialize(),e}get context(){return Gr(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),await this.auth.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}var g9=Object.defineProperty,m9=Object.defineProperties,v9=Object.getOwnPropertyDescriptors,u1=Object.getOwnPropertySymbols,y9=Object.prototype.hasOwnProperty,w9=Object.prototype.propertyIsEnumerable,h1=(r,t,e)=>t in r?g9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,l1=(r,t)=>{for(var e in t||(t={}))y9.call(t,e)&&h1(r,e,t[e]);if(u1)for(var e of u1(t))w9.call(t,e)&&h1(r,e,t[e]);return r},f1=(r,t)=>m9(r,v9(t));const b9={Accept:"application/json","Content-Type":"application/json"},_9="POST",d1={headers:b9,method:_9},p1=10;class Jn{constructor(t,e=!1){if(this.url=t,this.disableProviderPing=e,this.events=new Di.EventEmitter,this.isAvailable=!1,this.registering=!1,!Up(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);this.url=t,this.disableProviderPing=e}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async open(t=this.url){await this.register(t)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(t){this.isAvailable||await this.register();try{const e=Mn(t),i=await(await hd(this.url,f1(l1({},d1),{body:e}))).json();this.onPayload({data:i})}catch(e){this.onError(t.id,e)}}async register(t=this.url){if(!Up(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((i,s)=>{this.events.once("register_error",a=>{this.resetMaxListeners(),s(a)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return s(new Error("HTTP connection is missing or invalid"));i()})})}this.url=t,this.registering=!0;try{if(!this.disableProviderPing){const e=Mn({id:1,jsonrpc:"2.0",method:"test",params:[]});await hd(t,f1(l1({},d1),{body:e}))}this.onOpen()}catch(e){const i=this.parseError(e);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(t){if(typeof t.data>"u")return;const e=typeof t.data=="string"?ma(t.data):t.data;this.events.emit("payload",e)}onError(t,e){const i=this.parseError(e),s=i.message||i.toString(),a=pu(t,s);this.events.emit("payload",a)}parseError(t,e=this.url){return im(t,e,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>p1&&this.events.setMaxListeners(p1)}}const g1="error",E9="wss://relay.walletconnect.com",A9="wc",S9="universal_provider",m1=`${A9}@2:${S9}:`,I9="https://rpc.walletconnect.com/v1/",Pn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var Wo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ie<"u"?Ie:typeof self<"u"?self:{},Tl={exports:{}};/**
|
|
31
|
+
* @license
|
|
32
|
+
* Lodash <https://lodash.com/>
|
|
33
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
34
|
+
* Released under MIT license <https://lodash.com/license>
|
|
35
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
36
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
37
|
+
*/(function(r,t){(function(){var e,i="4.17.21",s=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",u="Expected a function",l="Invalid `variable` option passed into `_.template`",d="__lodash_hash_undefined__",f=500,w="__lodash_placeholder__",E=1,S=2,D=4,P=1,Y=2,G=1,tt=2,K=4,V=8,B=16,z=32,$=64,v=128,T=256,nt=512,ft=30,pt="...",mt=800,h=16,y=1,b=2,M=3,C=1/0,R=9007199254740991,j=17976931348623157e292,I=0/0,g=4294967295,N=g-1,it=g>>>1,lt=[["ary",v],["bind",G],["bindKey",tt],["curry",V],["curryRight",B],["flip",nt],["partial",z],["partialRight",$],["rearg",T]],_="[object Arguments]",Z="[object Array]",U="[object AsyncFunction]",L="[object Boolean]",k="[object Date]",p="[object DOMException]",F="[object Error]",et="[object Function]",ut="[object GeneratorFunction]",at="[object Map]",Mt="[object Number]",Pt="[object Null]",It="[object Object]",Ee="[object Promise]",$t="[object Proxy]",xt="[object RegExp]",Bt="[object Set]",_t="[object String]",Et="[object Symbol]",Vt="[object Undefined]",wt="[object WeakMap]",At="[object WeakSet]",Ut="[object ArrayBuffer]",bt="[object DataView]",Ct="[object Float32Array]",Lt="[object Float64Array]",Ot="[object Int8Array]",Nt="[object Int16Array]",se="[object Int32Array]",Tt="[object Uint8Array]",Rt="[object Uint8ClampedArray]",Ke="[object Uint16Array]",ce="[object Uint32Array]",pe=/\b__p \+= '';/g,Ve=/\b(__p \+=) '' \+/g,ye=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_e=/&(?:amp|lt|gt|quot|#39);/g,Ar=/[&<>"']/g,Gt=RegExp(_e.source),zt=RegExp(Ar.source),De=/<%-([\s\S]+?)%>/g,Wt=/<%([\s\S]+?)%>/g,Kt=/<%=([\s\S]+?)%>/g,Ae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Jt=/^\w*$/,Xt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xe=/[\\^$.*+?()[\]{}|]/g,Zt=RegExp(xe.source),Yt=/^\s+/,Ce=/\s/,Qt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,qt=/\{\n\/\* \[wrapped with (.+)\] \*/,Te=/,? & /,te=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Pe=/[()=,{}\[\]\/\s]/,xi=/\\(\\)?/g,Oe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,le=/\w*$/,oi=/^[-+]0x[0-9a-f]+$/i,ai=/^0b[01]+$/i,ci=/^\[object .+?Constructor\]$/,ui=/^0o[0-7]+$/i,hi=/^(?:0|[1-9]\d*)$/,ar=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,qi=/($^)/,Xn=/['\n\r\u2028\u2029\\]/g,ji="\\ud800-\\udfff",Zn="\\u0300-\\u036f",ts="\\ufe20-\\ufe2f",$i="\\u20d0-\\u20ff",On=Zn+ts+$i,Nn="\\u2700-\\u27bf",Sr="a-z\\xdf-\\xf6\\xf8-\\xff",es="\\xac\\xb1\\xd7\\xf7",rs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",is="\\u2000-\\u206f",ns=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",_a="A-Z\\xc0-\\xd6\\xd8-\\xde",Ea="\\ufe0e\\ufe0f",ss=es+rs+is+ns,_o="['’]",os="["+ji+"]",Eo="["+ss+"]",as="["+On+"]",Aa="\\d+",yu="["+Nn+"]",Sa="["+Sr+"]",Ia="[^"+ji+ss+Aa+Nn+Sr+_a+"]",Rs="\\ud83c[\\udffb-\\udfff]",wu="(?:"+as+"|"+Rs+")",Da="[^"+ji+"]",Ts="(?:\\ud83c[\\udde6-\\uddff]){2}",Rn="[\\ud800-\\udbff][\\udc00-\\udfff]",Yr="["+_a+"]",xa="\\u200d",Ma="(?:"+Sa+"|"+Ia+")",zi="(?:"+Yr+"|"+Ia+")",Ca="(?:"+_o+"(?:d|ll|m|re|s|t|ve))?",Pa="(?:"+_o+"(?:D|LL|M|RE|S|T|VE))?",Oa=wu+"?",Na="["+Ea+"]?",bu="(?:"+xa+"(?:"+[Da,Ts,Rn].join("|")+")"+Na+Oa+")*",ln="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ra="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ta=Na+Oa+bu,Fs="(?:"+[yu,Ts,Rn].join("|")+")"+Ta,_u="(?:"+[Da+as+"?",as,Ts,Rn,os].join("|")+")",Ao=RegExp(_o,"g"),Eu=RegExp(as,"g"),Us=RegExp(Rs+"(?="+Rs+")|"+_u+Ta,"g"),Fa=RegExp([Yr+"?"+Sa+"+"+Ca+"(?="+[Eo,Yr,"$"].join("|")+")",zi+"+"+Pa+"(?="+[Eo,Yr+Ma,"$"].join("|")+")",Yr+"?"+Ma+"+"+Ca,Yr+"+"+Pa,Ra,ln,Aa,Fs].join("|"),"g"),Ua=RegExp("["+xa+ji+On+Ea+"]"),cs=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ba=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Au=-1,Ue={};Ue[Ct]=Ue[Lt]=Ue[Ot]=Ue[Nt]=Ue[se]=Ue[Tt]=Ue[Rt]=Ue[Ke]=Ue[ce]=!0,Ue[_]=Ue[Z]=Ue[Ut]=Ue[L]=Ue[bt]=Ue[k]=Ue[F]=Ue[et]=Ue[at]=Ue[Mt]=Ue[It]=Ue[xt]=Ue[Bt]=Ue[_t]=Ue[wt]=!1;var Fe={};Fe[_]=Fe[Z]=Fe[Ut]=Fe[bt]=Fe[L]=Fe[k]=Fe[Ct]=Fe[Lt]=Fe[Ot]=Fe[Nt]=Fe[se]=Fe[at]=Fe[Mt]=Fe[It]=Fe[xt]=Fe[Bt]=Fe[_t]=Fe[Et]=Fe[Tt]=Fe[Rt]=Fe[Ke]=Fe[ce]=!0,Fe[F]=Fe[et]=Fe[wt]=!1;var q={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Q={"&":"&","<":"<",">":">",'"':""","'":"'"},ht={"&":"&","<":"<",">":">",""":'"',"'":"'"},St={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Be=parseFloat,re=parseInt,$e=typeof Wo=="object"&&Wo&&Wo.Object===Object&&Wo,er=typeof self=="object"&&self&&self.Object===Object&&self,we=$e||er||Function("return this")(),Le=t&&!t.nodeType&&t,Qe=Le&&!0&&r&&!r.nodeType&&r,Ur=Qe&&Qe.exports===Le,rr=Ur&&$e.process,ze=function(){try{var J=Qe&&Qe.require&&Qe.require("util").types;return J||rr&&rr.binding&&rr.binding("util")}catch{}}(),Ir=ze&&ze.isArrayBuffer,Mi=ze&&ze.isDate,li=ze&&ze.isMap,ki=ze&&ze.isRegExp,So=ze&&ze.isSet,us=ze&&ze.isTypedArray;function cr(J,st,rt){switch(rt.length){case 0:return J.call(st);case 1:return J.call(st,rt[0]);case 2:return J.call(st,rt[0],rt[1]);case 3:return J.call(st,rt[0],rt[1],rt[2])}return J.apply(st,rt)}function xm(J,st,rt,Dt){for(var ee=-1,Se=J==null?0:J.length;++ee<Se;){var ir=J[ee];st(Dt,ir,rt(ir),J)}return Dt}function fi(J,st){for(var rt=-1,Dt=J==null?0:J.length;++rt<Dt&&st(J[rt],rt,J)!==!1;);return J}function Mm(J,st){for(var rt=J==null?0:J.length;rt--&&st(J[rt],rt,J)!==!1;);return J}function lf(J,st){for(var rt=-1,Dt=J==null?0:J.length;++rt<Dt;)if(!st(J[rt],rt,J))return!1;return!0}function Tn(J,st){for(var rt=-1,Dt=J==null?0:J.length,ee=0,Se=[];++rt<Dt;){var ir=J[rt];st(ir,rt,J)&&(Se[ee++]=ir)}return Se}function La(J,st){var rt=J==null?0:J.length;return!!rt&&Bs(J,st,0)>-1}function Su(J,st,rt){for(var Dt=-1,ee=J==null?0:J.length;++Dt<ee;)if(rt(st,J[Dt]))return!0;return!1}function ke(J,st){for(var rt=-1,Dt=J==null?0:J.length,ee=Array(Dt);++rt<Dt;)ee[rt]=st(J[rt],rt,J);return ee}function Fn(J,st){for(var rt=-1,Dt=st.length,ee=J.length;++rt<Dt;)J[ee+rt]=st[rt];return J}function Iu(J,st,rt,Dt){var ee=-1,Se=J==null?0:J.length;for(Dt&&Se&&(rt=J[++ee]);++ee<Se;)rt=st(rt,J[ee],ee,J);return rt}function Cm(J,st,rt,Dt){var ee=J==null?0:J.length;for(Dt&&ee&&(rt=J[--ee]);ee--;)rt=st(rt,J[ee],ee,J);return rt}function Du(J,st){for(var rt=-1,Dt=J==null?0:J.length;++rt<Dt;)if(st(J[rt],rt,J))return!0;return!1}var Pm=xu("length");function Om(J){return J.split("")}function Nm(J){return J.match(te)||[]}function ff(J,st,rt){var Dt;return rt(J,function(ee,Se,ir){if(st(ee,Se,ir))return Dt=Se,!1}),Dt}function qa(J,st,rt,Dt){for(var ee=J.length,Se=rt+(Dt?1:-1);Dt?Se--:++Se<ee;)if(st(J[Se],Se,J))return Se;return-1}function Bs(J,st,rt){return st===st?Hm(J,st,rt):qa(J,df,rt)}function Rm(J,st,rt,Dt){for(var ee=rt-1,Se=J.length;++ee<Se;)if(Dt(J[ee],st))return ee;return-1}function df(J){return J!==J}function pf(J,st){var rt=J==null?0:J.length;return rt?Cu(J,st)/rt:I}function xu(J){return function(st){return st==null?e:st[J]}}function Mu(J){return function(st){return J==null?e:J[st]}}function gf(J,st,rt,Dt,ee){return ee(J,function(Se,ir,qe){rt=Dt?(Dt=!1,Se):st(rt,Se,ir,qe)}),rt}function Tm(J,st){var rt=J.length;for(J.sort(st);rt--;)J[rt]=J[rt].value;return J}function Cu(J,st){for(var rt,Dt=-1,ee=J.length;++Dt<ee;){var Se=st(J[Dt]);Se!==e&&(rt=rt===e?Se:rt+Se)}return rt}function Pu(J,st){for(var rt=-1,Dt=Array(J);++rt<J;)Dt[rt]=st(rt);return Dt}function Fm(J,st){return ke(st,function(rt){return[rt,J[rt]]})}function mf(J){return J&&J.slice(0,bf(J)+1).replace(Yt,"")}function Qr(J){return function(st){return J(st)}}function Ou(J,st){return ke(st,function(rt){return J[rt]})}function Io(J,st){return J.has(st)}function vf(J,st){for(var rt=-1,Dt=J.length;++rt<Dt&&Bs(st,J[rt],0)>-1;);return rt}function yf(J,st){for(var rt=J.length;rt--&&Bs(st,J[rt],0)>-1;);return rt}function Um(J,st){for(var rt=J.length,Dt=0;rt--;)J[rt]===st&&++Dt;return Dt}var Bm=Mu(q),Lm=Mu(Q);function qm(J){return"\\"+St[J]}function jm(J,st){return J==null?e:J[st]}function Ls(J){return Ua.test(J)}function $m(J){return cs.test(J)}function zm(J){for(var st,rt=[];!(st=J.next()).done;)rt.push(st.value);return rt}function Nu(J){var st=-1,rt=Array(J.size);return J.forEach(function(Dt,ee){rt[++st]=[ee,Dt]}),rt}function wf(J,st){return function(rt){return J(st(rt))}}function Un(J,st){for(var rt=-1,Dt=J.length,ee=0,Se=[];++rt<Dt;){var ir=J[rt];(ir===st||ir===w)&&(J[rt]=w,Se[ee++]=rt)}return Se}function ja(J){var st=-1,rt=Array(J.size);return J.forEach(function(Dt){rt[++st]=Dt}),rt}function km(J){var st=-1,rt=Array(J.size);return J.forEach(function(Dt){rt[++st]=[Dt,Dt]}),rt}function Hm(J,st,rt){for(var Dt=rt-1,ee=J.length;++Dt<ee;)if(J[Dt]===st)return Dt;return-1}function Km(J,st,rt){for(var Dt=rt+1;Dt--;)if(J[Dt]===st)return Dt;return Dt}function qs(J){return Ls(J)?Gm(J):Pm(J)}function Ci(J){return Ls(J)?Wm(J):Om(J)}function bf(J){for(var st=J.length;st--&&Ce.test(J.charAt(st)););return st}var Vm=Mu(ht);function Gm(J){for(var st=Us.lastIndex=0;Us.test(J);)++st;return st}function Wm(J){return J.match(Us)||[]}function Ym(J){return J.match(Fa)||[]}var Qm=function J(st){st=st==null?we:js.defaults(we.Object(),st,js.pick(we,Ba));var rt=st.Array,Dt=st.Date,ee=st.Error,Se=st.Function,ir=st.Math,qe=st.Object,Ru=st.RegExp,Jm=st.String,di=st.TypeError,$a=rt.prototype,Xm=Se.prototype,$s=qe.prototype,za=st["__core-js_shared__"],ka=Xm.toString,Ne=$s.hasOwnProperty,Zm=0,_f=function(){var n=/[^.]+$/.exec(za&&za.keys&&za.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),Ha=$s.toString,tv=ka.call(qe),ev=we._,rv=Ru("^"+ka.call(Ne).replace(xe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ka=Ur?st.Buffer:e,Bn=st.Symbol,Va=st.Uint8Array,Ef=Ka?Ka.allocUnsafe:e,Ga=wf(qe.getPrototypeOf,qe),Af=qe.create,Sf=$s.propertyIsEnumerable,Wa=$a.splice,If=Bn?Bn.isConcatSpreadable:e,Do=Bn?Bn.iterator:e,hs=Bn?Bn.toStringTag:e,Ya=function(){try{var n=gs(qe,"defineProperty");return n({},"",{}),n}catch{}}(),iv=st.clearTimeout!==we.clearTimeout&&st.clearTimeout,nv=Dt&&Dt.now!==we.Date.now&&Dt.now,sv=st.setTimeout!==we.setTimeout&&st.setTimeout,Qa=ir.ceil,Ja=ir.floor,Tu=qe.getOwnPropertySymbols,ov=Ka?Ka.isBuffer:e,Df=st.isFinite,av=$a.join,cv=wf(qe.keys,qe),nr=ir.max,wr=ir.min,uv=Dt.now,hv=st.parseInt,xf=ir.random,lv=$a.reverse,Fu=gs(st,"DataView"),xo=gs(st,"Map"),Uu=gs(st,"Promise"),zs=gs(st,"Set"),Mo=gs(st,"WeakMap"),Co=gs(qe,"create"),Xa=Mo&&new Mo,ks={},fv=ms(Fu),dv=ms(xo),pv=ms(Uu),gv=ms(zs),mv=ms(Mo),Za=Bn?Bn.prototype:e,Po=Za?Za.valueOf:e,Mf=Za?Za.toString:e;function x(n){if(We(n)&&!ie(n)&&!(n instanceof ge)){if(n instanceof pi)return n;if(Ne.call(n,"__wrapped__"))return C0(n)}return new pi(n)}var Hs=function(){function n(){}return function(o){if(!Ge(o))return{};if(Af)return Af(o);n.prototype=o;var c=new n;return n.prototype=e,c}}();function tc(){}function pi(n,o){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!o,this.__index__=0,this.__values__=e}x.templateSettings={escape:De,evaluate:Wt,interpolate:Kt,variable:"",imports:{_:x}},x.prototype=tc.prototype,x.prototype.constructor=x,pi.prototype=Hs(tc.prototype),pi.prototype.constructor=pi;function ge(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=g,this.__views__=[]}function vv(){var n=new ge(this.__wrapped__);return n.__actions__=Br(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Br(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Br(this.__views__),n}function yv(){if(this.__filtered__){var n=new ge(this);n.__dir__=-1,n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function wv(){var n=this.__wrapped__.value(),o=this.__dir__,c=ie(n),m=o<0,A=c?n.length:0,O=Oy(0,A,this.__views__),H=O.start,W=O.end,X=W-H,ot=m?W:H-1,ct=this.__iteratees__,dt=ct.length,vt=0,Ft=wr(X,this.__takeCount__);if(!c||!m&&A==X&&Ft==X)return Xf(n,this.__actions__);var kt=[];t:for(;X--&&vt<Ft;){ot+=o;for(var ue=-1,Ht=n[ot];++ue<dt;){var fe=ct[ue],be=fe.iteratee,Zr=fe.type,Mr=be(Ht);if(Zr==b)Ht=Mr;else if(!Mr){if(Zr==y)continue t;break t}}kt[vt++]=Ht}return kt}ge.prototype=Hs(tc.prototype),ge.prototype.constructor=ge;function ls(n){var o=-1,c=n==null?0:n.length;for(this.clear();++o<c;){var m=n[o];this.set(m[0],m[1])}}function bv(){this.__data__=Co?Co(null):{},this.size=0}function _v(n){var o=this.has(n)&&delete this.__data__[n];return this.size-=o?1:0,o}function Ev(n){var o=this.__data__;if(Co){var c=o[n];return c===d?e:c}return Ne.call(o,n)?o[n]:e}function Av(n){var o=this.__data__;return Co?o[n]!==e:Ne.call(o,n)}function Sv(n,o){var c=this.__data__;return this.size+=this.has(n)?0:1,c[n]=Co&&o===e?d:o,this}ls.prototype.clear=bv,ls.prototype.delete=_v,ls.prototype.get=Ev,ls.prototype.has=Av,ls.prototype.set=Sv;function fn(n){var o=-1,c=n==null?0:n.length;for(this.clear();++o<c;){var m=n[o];this.set(m[0],m[1])}}function Iv(){this.__data__=[],this.size=0}function Dv(n){var o=this.__data__,c=ec(o,n);if(c<0)return!1;var m=o.length-1;return c==m?o.pop():Wa.call(o,c,1),--this.size,!0}function xv(n){var o=this.__data__,c=ec(o,n);return c<0?e:o[c][1]}function Mv(n){return ec(this.__data__,n)>-1}function Cv(n,o){var c=this.__data__,m=ec(c,n);return m<0?(++this.size,c.push([n,o])):c[m][1]=o,this}fn.prototype.clear=Iv,fn.prototype.delete=Dv,fn.prototype.get=xv,fn.prototype.has=Mv,fn.prototype.set=Cv;function dn(n){var o=-1,c=n==null?0:n.length;for(this.clear();++o<c;){var m=n[o];this.set(m[0],m[1])}}function Pv(){this.size=0,this.__data__={hash:new ls,map:new(xo||fn),string:new ls}}function Ov(n){var o=dc(this,n).delete(n);return this.size-=o?1:0,o}function Nv(n){return dc(this,n).get(n)}function Rv(n){return dc(this,n).has(n)}function Tv(n,o){var c=dc(this,n),m=c.size;return c.set(n,o),this.size+=c.size==m?0:1,this}dn.prototype.clear=Pv,dn.prototype.delete=Ov,dn.prototype.get=Nv,dn.prototype.has=Rv,dn.prototype.set=Tv;function fs(n){var o=-1,c=n==null?0:n.length;for(this.__data__=new dn;++o<c;)this.add(n[o])}function Fv(n){return this.__data__.set(n,d),this}function Uv(n){return this.__data__.has(n)}fs.prototype.add=fs.prototype.push=Fv,fs.prototype.has=Uv;function Pi(n){var o=this.__data__=new fn(n);this.size=o.size}function Bv(){this.__data__=new fn,this.size=0}function Lv(n){var o=this.__data__,c=o.delete(n);return this.size=o.size,c}function qv(n){return this.__data__.get(n)}function jv(n){return this.__data__.has(n)}function $v(n,o){var c=this.__data__;if(c instanceof fn){var m=c.__data__;if(!xo||m.length<s-1)return m.push([n,o]),this.size=++c.size,this;c=this.__data__=new dn(m)}return c.set(n,o),this.size=c.size,this}Pi.prototype.clear=Bv,Pi.prototype.delete=Lv,Pi.prototype.get=qv,Pi.prototype.has=jv,Pi.prototype.set=$v;function Cf(n,o){var c=ie(n),m=!c&&vs(n),A=!c&&!m&&zn(n),O=!c&&!m&&!A&&Ws(n),H=c||m||A||O,W=H?Pu(n.length,Jm):[],X=W.length;for(var ot in n)(o||Ne.call(n,ot))&&!(H&&(ot=="length"||A&&(ot=="offset"||ot=="parent")||O&&(ot=="buffer"||ot=="byteLength"||ot=="byteOffset")||vn(ot,X)))&&W.push(ot);return W}function Pf(n){var o=n.length;return o?n[Gu(0,o-1)]:e}function zv(n,o){return pc(Br(n),ds(o,0,n.length))}function kv(n){return pc(Br(n))}function Bu(n,o,c){(c!==e&&!Oi(n[o],c)||c===e&&!(o in n))&&pn(n,o,c)}function Oo(n,o,c){var m=n[o];(!(Ne.call(n,o)&&Oi(m,c))||c===e&&!(o in n))&&pn(n,o,c)}function ec(n,o){for(var c=n.length;c--;)if(Oi(n[c][0],o))return c;return-1}function Hv(n,o,c,m){return Ln(n,function(A,O,H){o(m,A,c(A),H)}),m}function Of(n,o){return n&&Ki(o,ur(o),n)}function Kv(n,o){return n&&Ki(o,qr(o),n)}function pn(n,o,c){o=="__proto__"&&Ya?Ya(n,o,{configurable:!0,enumerable:!0,value:c,writable:!0}):n[o]=c}function Lu(n,o){for(var c=-1,m=o.length,A=rt(m),O=n==null;++c<m;)A[c]=O?e:yh(n,o[c]);return A}function ds(n,o,c){return n===n&&(c!==e&&(n=n<=c?n:c),o!==e&&(n=n>=o?n:o)),n}function gi(n,o,c,m,A,O){var H,W=o&E,X=o&S,ot=o&D;if(c&&(H=A?c(n,m,A,O):c(n)),H!==e)return H;if(!Ge(n))return n;var ct=ie(n);if(ct){if(H=Ry(n),!W)return Br(n,H)}else{var dt=br(n),vt=dt==et||dt==ut;if(zn(n))return e0(n,W);if(dt==It||dt==_||vt&&!A){if(H=X||vt?{}:b0(n),!W)return X?Ey(n,Kv(H,n)):_y(n,Of(H,n))}else{if(!Fe[dt])return A?n:{};H=Ty(n,dt,W)}}O||(O=new Pi);var Ft=O.get(n);if(Ft)return Ft;O.set(n,H),Y0(n)?n.forEach(function(Ht){H.add(gi(Ht,o,c,Ht,n,O))}):G0(n)&&n.forEach(function(Ht,fe){H.set(fe,gi(Ht,o,c,fe,n,O))});var kt=ot?X?nh:ih:X?qr:ur,ue=ct?e:kt(n);return fi(ue||n,function(Ht,fe){ue&&(fe=Ht,Ht=n[fe]),Oo(H,fe,gi(Ht,o,c,fe,n,O))}),H}function Vv(n){var o=ur(n);return function(c){return Nf(c,n,o)}}function Nf(n,o,c){var m=c.length;if(n==null)return!m;for(n=qe(n);m--;){var A=c[m],O=o[A],H=n[A];if(H===e&&!(A in n)||!O(H))return!1}return!0}function Rf(n,o,c){if(typeof n!="function")throw new di(u);return Lo(function(){n.apply(e,c)},o)}function No(n,o,c,m){var A=-1,O=La,H=!0,W=n.length,X=[],ot=o.length;if(!W)return X;c&&(o=ke(o,Qr(c))),m?(O=Su,H=!1):o.length>=s&&(O=Io,H=!1,o=new fs(o));t:for(;++A<W;){var ct=n[A],dt=c==null?ct:c(ct);if(ct=m||ct!==0?ct:0,H&&dt===dt){for(var vt=ot;vt--;)if(o[vt]===dt)continue t;X.push(ct)}else O(o,dt,m)||X.push(ct)}return X}var Ln=o0(Hi),Tf=o0(ju,!0);function Gv(n,o){var c=!0;return Ln(n,function(m,A,O){return c=!!o(m,A,O),c}),c}function rc(n,o,c){for(var m=-1,A=n.length;++m<A;){var O=n[m],H=o(O);if(H!=null&&(W===e?H===H&&!Xr(H):c(H,W)))var W=H,X=O}return X}function Wv(n,o,c,m){var A=n.length;for(c=ae(c),c<0&&(c=-c>A?0:A+c),m=m===e||m>A?A:ae(m),m<0&&(m+=A),m=c>m?0:J0(m);c<m;)n[c++]=o;return n}function Ff(n,o){var c=[];return Ln(n,function(m,A,O){o(m,A,O)&&c.push(m)}),c}function fr(n,o,c,m,A){var O=-1,H=n.length;for(c||(c=Uy),A||(A=[]);++O<H;){var W=n[O];o>0&&c(W)?o>1?fr(W,o-1,c,m,A):Fn(A,W):m||(A[A.length]=W)}return A}var qu=a0(),Uf=a0(!0);function Hi(n,o){return n&&qu(n,o,ur)}function ju(n,o){return n&&Uf(n,o,ur)}function ic(n,o){return Tn(o,function(c){return yn(n[c])})}function ps(n,o){o=jn(o,n);for(var c=0,m=o.length;n!=null&&c<m;)n=n[Vi(o[c++])];return c&&c==m?n:e}function Bf(n,o,c){var m=o(n);return ie(n)?m:Fn(m,c(n))}function Dr(n){return n==null?n===e?Vt:Pt:hs&&hs in qe(n)?Py(n):ky(n)}function $u(n,o){return n>o}function Yv(n,o){return n!=null&&Ne.call(n,o)}function Qv(n,o){return n!=null&&o in qe(n)}function Jv(n,o,c){return n>=wr(o,c)&&n<nr(o,c)}function zu(n,o,c){for(var m=c?Su:La,A=n[0].length,O=n.length,H=O,W=rt(O),X=1/0,ot=[];H--;){var ct=n[H];H&&o&&(ct=ke(ct,Qr(o))),X=wr(ct.length,X),W[H]=!c&&(o||A>=120&&ct.length>=120)?new fs(H&&ct):e}ct=n[0];var dt=-1,vt=W[0];t:for(;++dt<A&&ot.length<X;){var Ft=ct[dt],kt=o?o(Ft):Ft;if(Ft=c||Ft!==0?Ft:0,!(vt?Io(vt,kt):m(ot,kt,c))){for(H=O;--H;){var ue=W[H];if(!(ue?Io(ue,kt):m(n[H],kt,c)))continue t}vt&&vt.push(kt),ot.push(Ft)}}return ot}function Xv(n,o,c,m){return Hi(n,function(A,O,H){o(m,c(A),O,H)}),m}function Ro(n,o,c){o=jn(o,n),n=S0(n,o);var m=n==null?n:n[Vi(vi(o))];return m==null?e:cr(m,n,c)}function Lf(n){return We(n)&&Dr(n)==_}function Zv(n){return We(n)&&Dr(n)==Ut}function ty(n){return We(n)&&Dr(n)==k}function To(n,o,c,m,A){return n===o?!0:n==null||o==null||!We(n)&&!We(o)?n!==n&&o!==o:ey(n,o,c,m,To,A)}function ey(n,o,c,m,A,O){var H=ie(n),W=ie(o),X=H?Z:br(n),ot=W?Z:br(o);X=X==_?It:X,ot=ot==_?It:ot;var ct=X==It,dt=ot==It,vt=X==ot;if(vt&&zn(n)){if(!zn(o))return!1;H=!0,ct=!1}if(vt&&!ct)return O||(O=new Pi),H||Ws(n)?v0(n,o,c,m,A,O):My(n,o,X,c,m,A,O);if(!(c&P)){var Ft=ct&&Ne.call(n,"__wrapped__"),kt=dt&&Ne.call(o,"__wrapped__");if(Ft||kt){var ue=Ft?n.value():n,Ht=kt?o.value():o;return O||(O=new Pi),A(ue,Ht,c,m,O)}}return vt?(O||(O=new Pi),Cy(n,o,c,m,A,O)):!1}function ry(n){return We(n)&&br(n)==at}function ku(n,o,c,m){var A=c.length,O=A,H=!m;if(n==null)return!O;for(n=qe(n);A--;){var W=c[A];if(H&&W[2]?W[1]!==n[W[0]]:!(W[0]in n))return!1}for(;++A<O;){W=c[A];var X=W[0],ot=n[X],ct=W[1];if(H&&W[2]){if(ot===e&&!(X in n))return!1}else{var dt=new Pi;if(m)var vt=m(ot,ct,X,n,o,dt);if(!(vt===e?To(ct,ot,P|Y,m,dt):vt))return!1}}return!0}function qf(n){if(!Ge(n)||Ly(n))return!1;var o=yn(n)?rv:ci;return o.test(ms(n))}function iy(n){return We(n)&&Dr(n)==xt}function ny(n){return We(n)&&br(n)==Bt}function sy(n){return We(n)&&bc(n.length)&&!!Ue[Dr(n)]}function jf(n){return typeof n=="function"?n:n==null?jr:typeof n=="object"?ie(n)?kf(n[0],n[1]):zf(n):cd(n)}function Hu(n){if(!Bo(n))return cv(n);var o=[];for(var c in qe(n))Ne.call(n,c)&&c!="constructor"&&o.push(c);return o}function oy(n){if(!Ge(n))return zy(n);var o=Bo(n),c=[];for(var m in n)m=="constructor"&&(o||!Ne.call(n,m))||c.push(m);return c}function Ku(n,o){return n<o}function $f(n,o){var c=-1,m=Lr(n)?rt(n.length):[];return Ln(n,function(A,O,H){m[++c]=o(A,O,H)}),m}function zf(n){var o=oh(n);return o.length==1&&o[0][2]?E0(o[0][0],o[0][1]):function(c){return c===n||ku(c,n,o)}}function kf(n,o){return ch(n)&&_0(o)?E0(Vi(n),o):function(c){var m=yh(c,n);return m===e&&m===o?wh(c,n):To(o,m,P|Y)}}function nc(n,o,c,m,A){n!==o&&qu(o,function(O,H){if(A||(A=new Pi),Ge(O))ay(n,o,H,c,nc,m,A);else{var W=m?m(hh(n,H),O,H+"",n,o,A):e;W===e&&(W=O),Bu(n,H,W)}},qr)}function ay(n,o,c,m,A,O,H){var W=hh(n,c),X=hh(o,c),ot=H.get(X);if(ot){Bu(n,c,ot);return}var ct=O?O(W,X,c+"",n,o,H):e,dt=ct===e;if(dt){var vt=ie(X),Ft=!vt&&zn(X),kt=!vt&&!Ft&&Ws(X);ct=X,vt||Ft||kt?ie(W)?ct=W:Je(W)?ct=Br(W):Ft?(dt=!1,ct=e0(X,!0)):kt?(dt=!1,ct=r0(X,!0)):ct=[]:qo(X)||vs(X)?(ct=W,vs(W)?ct=X0(W):(!Ge(W)||yn(W))&&(ct=b0(X))):dt=!1}dt&&(H.set(X,ct),A(ct,X,m,O,H),H.delete(X)),Bu(n,c,ct)}function Hf(n,o){var c=n.length;if(c)return o+=o<0?c:0,vn(o,c)?n[o]:e}function Kf(n,o,c){o.length?o=ke(o,function(O){return ie(O)?function(H){return ps(H,O.length===1?O[0]:O)}:O}):o=[jr];var m=-1;o=ke(o,Qr(jt()));var A=$f(n,function(O,H,W){var X=ke(o,function(ot){return ot(O)});return{criteria:X,index:++m,value:O}});return Tm(A,function(O,H){return by(O,H,c)})}function cy(n,o){return Vf(n,o,function(c,m){return wh(n,m)})}function Vf(n,o,c){for(var m=-1,A=o.length,O={};++m<A;){var H=o[m],W=ps(n,H);c(W,H)&&Fo(O,jn(H,n),W)}return O}function uy(n){return function(o){return ps(o,n)}}function Vu(n,o,c,m){var A=m?Rm:Bs,O=-1,H=o.length,W=n;for(n===o&&(o=Br(o)),c&&(W=ke(n,Qr(c)));++O<H;)for(var X=0,ot=o[O],ct=c?c(ot):ot;(X=A(W,ct,X,m))>-1;)W!==n&&Wa.call(W,X,1),Wa.call(n,X,1);return n}function Gf(n,o){for(var c=n?o.length:0,m=c-1;c--;){var A=o[c];if(c==m||A!==O){var O=A;vn(A)?Wa.call(n,A,1):Qu(n,A)}}return n}function Gu(n,o){return n+Ja(xf()*(o-n+1))}function hy(n,o,c,m){for(var A=-1,O=nr(Qa((o-n)/(c||1)),0),H=rt(O);O--;)H[m?O:++A]=n,n+=c;return H}function Wu(n,o){var c="";if(!n||o<1||o>R)return c;do o%2&&(c+=n),o=Ja(o/2),o&&(n+=n);while(o);return c}function he(n,o){return lh(A0(n,o,jr),n+"")}function ly(n){return Pf(Ys(n))}function fy(n,o){var c=Ys(n);return pc(c,ds(o,0,c.length))}function Fo(n,o,c,m){if(!Ge(n))return n;o=jn(o,n);for(var A=-1,O=o.length,H=O-1,W=n;W!=null&&++A<O;){var X=Vi(o[A]),ot=c;if(X==="__proto__"||X==="constructor"||X==="prototype")return n;if(A!=H){var ct=W[X];ot=m?m(ct,X,W):e,ot===e&&(ot=Ge(ct)?ct:vn(o[A+1])?[]:{})}Oo(W,X,ot),W=W[X]}return n}var Wf=Xa?function(n,o){return Xa.set(n,o),n}:jr,dy=Ya?function(n,o){return Ya(n,"toString",{configurable:!0,enumerable:!1,value:_h(o),writable:!0})}:jr;function py(n){return pc(Ys(n))}function mi(n,o,c){var m=-1,A=n.length;o<0&&(o=-o>A?0:A+o),c=c>A?A:c,c<0&&(c+=A),A=o>c?0:c-o>>>0,o>>>=0;for(var O=rt(A);++m<A;)O[m]=n[m+o];return O}function gy(n,o){var c;return Ln(n,function(m,A,O){return c=o(m,A,O),!c}),!!c}function sc(n,o,c){var m=0,A=n==null?m:n.length;if(typeof o=="number"&&o===o&&A<=it){for(;m<A;){var O=m+A>>>1,H=n[O];H!==null&&!Xr(H)&&(c?H<=o:H<o)?m=O+1:A=O}return A}return Yu(n,o,jr,c)}function Yu(n,o,c,m){var A=0,O=n==null?0:n.length;if(O===0)return 0;o=c(o);for(var H=o!==o,W=o===null,X=Xr(o),ot=o===e;A<O;){var ct=Ja((A+O)/2),dt=c(n[ct]),vt=dt!==e,Ft=dt===null,kt=dt===dt,ue=Xr(dt);if(H)var Ht=m||kt;else ot?Ht=kt&&(m||vt):W?Ht=kt&&vt&&(m||!Ft):X?Ht=kt&&vt&&!Ft&&(m||!ue):Ft||ue?Ht=!1:Ht=m?dt<=o:dt<o;Ht?A=ct+1:O=ct}return wr(O,N)}function Yf(n,o){for(var c=-1,m=n.length,A=0,O=[];++c<m;){var H=n[c],W=o?o(H):H;if(!c||!Oi(W,X)){var X=W;O[A++]=H===0?0:H}}return O}function Qf(n){return typeof n=="number"?n:Xr(n)?I:+n}function Jr(n){if(typeof n=="string")return n;if(ie(n))return ke(n,Jr)+"";if(Xr(n))return Mf?Mf.call(n):"";var o=n+"";return o=="0"&&1/n==-C?"-0":o}function qn(n,o,c){var m=-1,A=La,O=n.length,H=!0,W=[],X=W;if(c)H=!1,A=Su;else if(O>=s){var ot=o?null:Dy(n);if(ot)return ja(ot);H=!1,A=Io,X=new fs}else X=o?[]:W;t:for(;++m<O;){var ct=n[m],dt=o?o(ct):ct;if(ct=c||ct!==0?ct:0,H&&dt===dt){for(var vt=X.length;vt--;)if(X[vt]===dt)continue t;o&&X.push(dt),W.push(ct)}else A(X,dt,c)||(X!==W&&X.push(dt),W.push(ct))}return W}function Qu(n,o){return o=jn(o,n),n=S0(n,o),n==null||delete n[Vi(vi(o))]}function Jf(n,o,c,m){return Fo(n,o,c(ps(n,o)),m)}function oc(n,o,c,m){for(var A=n.length,O=m?A:-1;(m?O--:++O<A)&&o(n[O],O,n););return c?mi(n,m?0:O,m?O+1:A):mi(n,m?O+1:0,m?A:O)}function Xf(n,o){var c=n;return c instanceof ge&&(c=c.value()),Iu(o,function(m,A){return A.func.apply(A.thisArg,Fn([m],A.args))},c)}function Ju(n,o,c){var m=n.length;if(m<2)return m?qn(n[0]):[];for(var A=-1,O=rt(m);++A<m;)for(var H=n[A],W=-1;++W<m;)W!=A&&(O[A]=No(O[A]||H,n[W],o,c));return qn(fr(O,1),o,c)}function Zf(n,o,c){for(var m=-1,A=n.length,O=o.length,H={};++m<A;){var W=m<O?o[m]:e;c(H,n[m],W)}return H}function Xu(n){return Je(n)?n:[]}function Zu(n){return typeof n=="function"?n:jr}function jn(n,o){return ie(n)?n:ch(n,o)?[n]:M0(Me(n))}var my=he;function $n(n,o,c){var m=n.length;return c=c===e?m:c,!o&&c>=m?n:mi(n,o,c)}var t0=iv||function(n){return we.clearTimeout(n)};function e0(n,o){if(o)return n.slice();var c=n.length,m=Ef?Ef(c):new n.constructor(c);return n.copy(m),m}function th(n){var o=new n.constructor(n.byteLength);return new Va(o).set(new Va(n)),o}function vy(n,o){var c=o?th(n.buffer):n.buffer;return new n.constructor(c,n.byteOffset,n.byteLength)}function yy(n){var o=new n.constructor(n.source,le.exec(n));return o.lastIndex=n.lastIndex,o}function wy(n){return Po?qe(Po.call(n)):{}}function r0(n,o){var c=o?th(n.buffer):n.buffer;return new n.constructor(c,n.byteOffset,n.length)}function i0(n,o){if(n!==o){var c=n!==e,m=n===null,A=n===n,O=Xr(n),H=o!==e,W=o===null,X=o===o,ot=Xr(o);if(!W&&!ot&&!O&&n>o||O&&H&&X&&!W&&!ot||m&&H&&X||!c&&X||!A)return 1;if(!m&&!O&&!ot&&n<o||ot&&c&&A&&!m&&!O||W&&c&&A||!H&&A||!X)return-1}return 0}function by(n,o,c){for(var m=-1,A=n.criteria,O=o.criteria,H=A.length,W=c.length;++m<H;){var X=i0(A[m],O[m]);if(X){if(m>=W)return X;var ot=c[m];return X*(ot=="desc"?-1:1)}}return n.index-o.index}function n0(n,o,c,m){for(var A=-1,O=n.length,H=c.length,W=-1,X=o.length,ot=nr(O-H,0),ct=rt(X+ot),dt=!m;++W<X;)ct[W]=o[W];for(;++A<H;)(dt||A<O)&&(ct[c[A]]=n[A]);for(;ot--;)ct[W++]=n[A++];return ct}function s0(n,o,c,m){for(var A=-1,O=n.length,H=-1,W=c.length,X=-1,ot=o.length,ct=nr(O-W,0),dt=rt(ct+ot),vt=!m;++A<ct;)dt[A]=n[A];for(var Ft=A;++X<ot;)dt[Ft+X]=o[X];for(;++H<W;)(vt||A<O)&&(dt[Ft+c[H]]=n[A++]);return dt}function Br(n,o){var c=-1,m=n.length;for(o||(o=rt(m));++c<m;)o[c]=n[c];return o}function Ki(n,o,c,m){var A=!c;c||(c={});for(var O=-1,H=o.length;++O<H;){var W=o[O],X=m?m(c[W],n[W],W,c,n):e;X===e&&(X=n[W]),A?pn(c,W,X):Oo(c,W,X)}return c}function _y(n,o){return Ki(n,ah(n),o)}function Ey(n,o){return Ki(n,y0(n),o)}function ac(n,o){return function(c,m){var A=ie(c)?xm:Hv,O=o?o():{};return A(c,n,jt(m,2),O)}}function Ks(n){return he(function(o,c){var m=-1,A=c.length,O=A>1?c[A-1]:e,H=A>2?c[2]:e;for(O=n.length>3&&typeof O=="function"?(A--,O):e,H&&xr(c[0],c[1],H)&&(O=A<3?e:O,A=1),o=qe(o);++m<A;){var W=c[m];W&&n(o,W,m,O)}return o})}function o0(n,o){return function(c,m){if(c==null)return c;if(!Lr(c))return n(c,m);for(var A=c.length,O=o?A:-1,H=qe(c);(o?O--:++O<A)&&m(H[O],O,H)!==!1;);return c}}function a0(n){return function(o,c,m){for(var A=-1,O=qe(o),H=m(o),W=H.length;W--;){var X=H[n?W:++A];if(c(O[X],X,O)===!1)break}return o}}function Ay(n,o,c){var m=o&G,A=Uo(n);function O(){var H=this&&this!==we&&this instanceof O?A:n;return H.apply(m?c:this,arguments)}return O}function c0(n){return function(o){o=Me(o);var c=Ls(o)?Ci(o):e,m=c?c[0]:o.charAt(0),A=c?$n(c,1).join(""):o.slice(1);return m[n]()+A}}function Vs(n){return function(o){return Iu(od(sd(o).replace(Ao,"")),n,"")}}function Uo(n){return function(){var o=arguments;switch(o.length){case 0:return new n;case 1:return new n(o[0]);case 2:return new n(o[0],o[1]);case 3:return new n(o[0],o[1],o[2]);case 4:return new n(o[0],o[1],o[2],o[3]);case 5:return new n(o[0],o[1],o[2],o[3],o[4]);case 6:return new n(o[0],o[1],o[2],o[3],o[4],o[5]);case 7:return new n(o[0],o[1],o[2],o[3],o[4],o[5],o[6])}var c=Hs(n.prototype),m=n.apply(c,o);return Ge(m)?m:c}}function Sy(n,o,c){var m=Uo(n);function A(){for(var O=arguments.length,H=rt(O),W=O,X=Gs(A);W--;)H[W]=arguments[W];var ot=O<3&&H[0]!==X&&H[O-1]!==X?[]:Un(H,X);if(O-=ot.length,O<c)return d0(n,o,cc,A.placeholder,e,H,ot,e,e,c-O);var ct=this&&this!==we&&this instanceof A?m:n;return cr(ct,this,H)}return A}function u0(n){return function(o,c,m){var A=qe(o);if(!Lr(o)){var O=jt(c,3);o=ur(o),c=function(W){return O(A[W],W,A)}}var H=n(o,c,m);return H>-1?A[O?o[H]:H]:e}}function h0(n){return mn(function(o){var c=o.length,m=c,A=pi.prototype.thru;for(n&&o.reverse();m--;){var O=o[m];if(typeof O!="function")throw new di(u);if(A&&!H&&fc(O)=="wrapper")var H=new pi([],!0)}for(m=H?m:c;++m<c;){O=o[m];var W=fc(O),X=W=="wrapper"?sh(O):e;X&&uh(X[0])&&X[1]==(v|V|z|T)&&!X[4].length&&X[9]==1?H=H[fc(X[0])].apply(H,X[3]):H=O.length==1&&uh(O)?H[W]():H.thru(O)}return function(){var ot=arguments,ct=ot[0];if(H&&ot.length==1&&ie(ct))return H.plant(ct).value();for(var dt=0,vt=c?o[dt].apply(this,ot):ct;++dt<c;)vt=o[dt].call(this,vt);return vt}})}function cc(n,o,c,m,A,O,H,W,X,ot){var ct=o&v,dt=o&G,vt=o&tt,Ft=o&(V|B),kt=o&nt,ue=vt?e:Uo(n);function Ht(){for(var fe=arguments.length,be=rt(fe),Zr=fe;Zr--;)be[Zr]=arguments[Zr];if(Ft)var Mr=Gs(Ht),ti=Um(be,Mr);if(m&&(be=n0(be,m,A,Ft)),O&&(be=s0(be,O,H,Ft)),fe-=ti,Ft&&fe<ot){var Xe=Un(be,Mr);return d0(n,o,cc,Ht.placeholder,c,be,Xe,W,X,ot-fe)}var Ni=dt?c:this,bn=vt?Ni[n]:n;return fe=be.length,W?be=Hy(be,W):kt&&fe>1&&be.reverse(),ct&&X<fe&&(be.length=X),this&&this!==we&&this instanceof Ht&&(bn=ue||Uo(bn)),bn.apply(Ni,be)}return Ht}function l0(n,o){return function(c,m){return Xv(c,n,o(m),{})}}function uc(n,o){return function(c,m){var A;if(c===e&&m===e)return o;if(c!==e&&(A=c),m!==e){if(A===e)return m;typeof c=="string"||typeof m=="string"?(c=Jr(c),m=Jr(m)):(c=Qf(c),m=Qf(m)),A=n(c,m)}return A}}function eh(n){return mn(function(o){return o=ke(o,Qr(jt())),he(function(c){var m=this;return n(o,function(A){return cr(A,m,c)})})})}function hc(n,o){o=o===e?" ":Jr(o);var c=o.length;if(c<2)return c?Wu(o,n):o;var m=Wu(o,Qa(n/qs(o)));return Ls(o)?$n(Ci(m),0,n).join(""):m.slice(0,n)}function Iy(n,o,c,m){var A=o&G,O=Uo(n);function H(){for(var W=-1,X=arguments.length,ot=-1,ct=m.length,dt=rt(ct+X),vt=this&&this!==we&&this instanceof H?O:n;++ot<ct;)dt[ot]=m[ot];for(;X--;)dt[ot++]=arguments[++W];return cr(vt,A?c:this,dt)}return H}function f0(n){return function(o,c,m){return m&&typeof m!="number"&&xr(o,c,m)&&(c=m=e),o=wn(o),c===e?(c=o,o=0):c=wn(c),m=m===e?o<c?1:-1:wn(m),hy(o,c,m,n)}}function lc(n){return function(o,c){return typeof o=="string"&&typeof c=="string"||(o=yi(o),c=yi(c)),n(o,c)}}function d0(n,o,c,m,A,O,H,W,X,ot){var ct=o&V,dt=ct?H:e,vt=ct?e:H,Ft=ct?O:e,kt=ct?e:O;o|=ct?z:$,o&=~(ct?$:z),o&K||(o&=~(G|tt));var ue=[n,o,A,Ft,dt,kt,vt,W,X,ot],Ht=c.apply(e,ue);return uh(n)&&I0(Ht,ue),Ht.placeholder=m,D0(Ht,n,o)}function rh(n){var o=ir[n];return function(c,m){if(c=yi(c),m=m==null?0:wr(ae(m),292),m&&Df(c)){var A=(Me(c)+"e").split("e"),O=o(A[0]+"e"+(+A[1]+m));return A=(Me(O)+"e").split("e"),+(A[0]+"e"+(+A[1]-m))}return o(c)}}var Dy=zs&&1/ja(new zs([,-0]))[1]==C?function(n){return new zs(n)}:Sh;function p0(n){return function(o){var c=br(o);return c==at?Nu(o):c==Bt?km(o):Fm(o,n(o))}}function gn(n,o,c,m,A,O,H,W){var X=o&tt;if(!X&&typeof n!="function")throw new di(u);var ot=m?m.length:0;if(ot||(o&=~(z|$),m=A=e),H=H===e?H:nr(ae(H),0),W=W===e?W:ae(W),ot-=A?A.length:0,o&$){var ct=m,dt=A;m=A=e}var vt=X?e:sh(n),Ft=[n,o,c,m,A,ct,dt,O,H,W];if(vt&&$y(Ft,vt),n=Ft[0],o=Ft[1],c=Ft[2],m=Ft[3],A=Ft[4],W=Ft[9]=Ft[9]===e?X?0:n.length:nr(Ft[9]-ot,0),!W&&o&(V|B)&&(o&=~(V|B)),!o||o==G)var kt=Ay(n,o,c);else o==V||o==B?kt=Sy(n,o,W):(o==z||o==(G|z))&&!A.length?kt=Iy(n,o,c,m):kt=cc.apply(e,Ft);var ue=vt?Wf:I0;return D0(ue(kt,Ft),n,o)}function g0(n,o,c,m){return n===e||Oi(n,$s[c])&&!Ne.call(m,c)?o:n}function m0(n,o,c,m,A,O){return Ge(n)&&Ge(o)&&(O.set(o,n),nc(n,o,e,m0,O),O.delete(o)),n}function xy(n){return qo(n)?e:n}function v0(n,o,c,m,A,O){var H=c&P,W=n.length,X=o.length;if(W!=X&&!(H&&X>W))return!1;var ot=O.get(n),ct=O.get(o);if(ot&&ct)return ot==o&&ct==n;var dt=-1,vt=!0,Ft=c&Y?new fs:e;for(O.set(n,o),O.set(o,n);++dt<W;){var kt=n[dt],ue=o[dt];if(m)var Ht=H?m(ue,kt,dt,o,n,O):m(kt,ue,dt,n,o,O);if(Ht!==e){if(Ht)continue;vt=!1;break}if(Ft){if(!Du(o,function(fe,be){if(!Io(Ft,be)&&(kt===fe||A(kt,fe,c,m,O)))return Ft.push(be)})){vt=!1;break}}else if(!(kt===ue||A(kt,ue,c,m,O))){vt=!1;break}}return O.delete(n),O.delete(o),vt}function My(n,o,c,m,A,O,H){switch(c){case bt:if(n.byteLength!=o.byteLength||n.byteOffset!=o.byteOffset)return!1;n=n.buffer,o=o.buffer;case Ut:return!(n.byteLength!=o.byteLength||!O(new Va(n),new Va(o)));case L:case k:case Mt:return Oi(+n,+o);case F:return n.name==o.name&&n.message==o.message;case xt:case _t:return n==o+"";case at:var W=Nu;case Bt:var X=m&P;if(W||(W=ja),n.size!=o.size&&!X)return!1;var ot=H.get(n);if(ot)return ot==o;m|=Y,H.set(n,o);var ct=v0(W(n),W(o),m,A,O,H);return H.delete(n),ct;case Et:if(Po)return Po.call(n)==Po.call(o)}return!1}function Cy(n,o,c,m,A,O){var H=c&P,W=ih(n),X=W.length,ot=ih(o),ct=ot.length;if(X!=ct&&!H)return!1;for(var dt=X;dt--;){var vt=W[dt];if(!(H?vt in o:Ne.call(o,vt)))return!1}var Ft=O.get(n),kt=O.get(o);if(Ft&&kt)return Ft==o&&kt==n;var ue=!0;O.set(n,o),O.set(o,n);for(var Ht=H;++dt<X;){vt=W[dt];var fe=n[vt],be=o[vt];if(m)var Zr=H?m(be,fe,vt,o,n,O):m(fe,be,vt,n,o,O);if(!(Zr===e?fe===be||A(fe,be,c,m,O):Zr)){ue=!1;break}Ht||(Ht=vt=="constructor")}if(ue&&!Ht){var Mr=n.constructor,ti=o.constructor;Mr!=ti&&"constructor"in n&&"constructor"in o&&!(typeof Mr=="function"&&Mr instanceof Mr&&typeof ti=="function"&&ti instanceof ti)&&(ue=!1)}return O.delete(n),O.delete(o),ue}function mn(n){return lh(A0(n,e,N0),n+"")}function ih(n){return Bf(n,ur,ah)}function nh(n){return Bf(n,qr,y0)}var sh=Xa?function(n){return Xa.get(n)}:Sh;function fc(n){for(var o=n.name+"",c=ks[o],m=Ne.call(ks,o)?c.length:0;m--;){var A=c[m],O=A.func;if(O==null||O==n)return A.name}return o}function Gs(n){var o=Ne.call(x,"placeholder")?x:n;return o.placeholder}function jt(){var n=x.iteratee||Eh;return n=n===Eh?jf:n,arguments.length?n(arguments[0],arguments[1]):n}function dc(n,o){var c=n.__data__;return By(o)?c[typeof o=="string"?"string":"hash"]:c.map}function oh(n){for(var o=ur(n),c=o.length;c--;){var m=o[c],A=n[m];o[c]=[m,A,_0(A)]}return o}function gs(n,o){var c=jm(n,o);return qf(c)?c:e}function Py(n){var o=Ne.call(n,hs),c=n[hs];try{n[hs]=e;var m=!0}catch{}var A=Ha.call(n);return m&&(o?n[hs]=c:delete n[hs]),A}var ah=Tu?function(n){return n==null?[]:(n=qe(n),Tn(Tu(n),function(o){return Sf.call(n,o)}))}:Ih,y0=Tu?function(n){for(var o=[];n;)Fn(o,ah(n)),n=Ga(n);return o}:Ih,br=Dr;(Fu&&br(new Fu(new ArrayBuffer(1)))!=bt||xo&&br(new xo)!=at||Uu&&br(Uu.resolve())!=Ee||zs&&br(new zs)!=Bt||Mo&&br(new Mo)!=wt)&&(br=function(n){var o=Dr(n),c=o==It?n.constructor:e,m=c?ms(c):"";if(m)switch(m){case fv:return bt;case dv:return at;case pv:return Ee;case gv:return Bt;case mv:return wt}return o});function Oy(n,o,c){for(var m=-1,A=c.length;++m<A;){var O=c[m],H=O.size;switch(O.type){case"drop":n+=H;break;case"dropRight":o-=H;break;case"take":o=wr(o,n+H);break;case"takeRight":n=nr(n,o-H);break}}return{start:n,end:o}}function Ny(n){var o=n.match(qt);return o?o[1].split(Te):[]}function w0(n,o,c){o=jn(o,n);for(var m=-1,A=o.length,O=!1;++m<A;){var H=Vi(o[m]);if(!(O=n!=null&&c(n,H)))break;n=n[H]}return O||++m!=A?O:(A=n==null?0:n.length,!!A&&bc(A)&&vn(H,A)&&(ie(n)||vs(n)))}function Ry(n){var o=n.length,c=new n.constructor(o);return o&&typeof n[0]=="string"&&Ne.call(n,"index")&&(c.index=n.index,c.input=n.input),c}function b0(n){return typeof n.constructor=="function"&&!Bo(n)?Hs(Ga(n)):{}}function Ty(n,o,c){var m=n.constructor;switch(o){case Ut:return th(n);case L:case k:return new m(+n);case bt:return vy(n,c);case Ct:case Lt:case Ot:case Nt:case se:case Tt:case Rt:case Ke:case ce:return r0(n,c);case at:return new m;case Mt:case _t:return new m(n);case xt:return yy(n);case Bt:return new m;case Et:return wy(n)}}function Fy(n,o){var c=o.length;if(!c)return n;var m=c-1;return o[m]=(c>1?"& ":"")+o[m],o=o.join(c>2?", ":" "),n.replace(Qt,`{
|
|
38
|
+
/* [wrapped with `+o+`] */
|
|
39
|
+
`)}function Uy(n){return ie(n)||vs(n)||!!(If&&n&&n[If])}function vn(n,o){var c=typeof n;return o=o??R,!!o&&(c=="number"||c!="symbol"&&hi.test(n))&&n>-1&&n%1==0&&n<o}function xr(n,o,c){if(!Ge(c))return!1;var m=typeof o;return(m=="number"?Lr(c)&&vn(o,c.length):m=="string"&&o in c)?Oi(c[o],n):!1}function ch(n,o){if(ie(n))return!1;var c=typeof n;return c=="number"||c=="symbol"||c=="boolean"||n==null||Xr(n)?!0:Jt.test(n)||!Ae.test(n)||o!=null&&n in qe(o)}function By(n){var o=typeof n;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?n!=="__proto__":n===null}function uh(n){var o=fc(n),c=x[o];if(typeof c!="function"||!(o in ge.prototype))return!1;if(n===c)return!0;var m=sh(c);return!!m&&n===m[0]}function Ly(n){return!!_f&&_f in n}var qy=za?yn:Dh;function Bo(n){var o=n&&n.constructor,c=typeof o=="function"&&o.prototype||$s;return n===c}function _0(n){return n===n&&!Ge(n)}function E0(n,o){return function(c){return c==null?!1:c[n]===o&&(o!==e||n in qe(c))}}function jy(n){var o=yc(n,function(m){return c.size===f&&c.clear(),m}),c=o.cache;return o}function $y(n,o){var c=n[1],m=o[1],A=c|m,O=A<(G|tt|v),H=m==v&&c==V||m==v&&c==T&&n[7].length<=o[8]||m==(v|T)&&o[7].length<=o[8]&&c==V;if(!(O||H))return n;m&G&&(n[2]=o[2],A|=c&G?0:K);var W=o[3];if(W){var X=n[3];n[3]=X?n0(X,W,o[4]):W,n[4]=X?Un(n[3],w):o[4]}return W=o[5],W&&(X=n[5],n[5]=X?s0(X,W,o[6]):W,n[6]=X?Un(n[5],w):o[6]),W=o[7],W&&(n[7]=W),m&v&&(n[8]=n[8]==null?o[8]:wr(n[8],o[8])),n[9]==null&&(n[9]=o[9]),n[0]=o[0],n[1]=A,n}function zy(n){var o=[];if(n!=null)for(var c in qe(n))o.push(c);return o}function ky(n){return Ha.call(n)}function A0(n,o,c){return o=nr(o===e?n.length-1:o,0),function(){for(var m=arguments,A=-1,O=nr(m.length-o,0),H=rt(O);++A<O;)H[A]=m[o+A];A=-1;for(var W=rt(o+1);++A<o;)W[A]=m[A];return W[o]=c(H),cr(n,this,W)}}function S0(n,o){return o.length<2?n:ps(n,mi(o,0,-1))}function Hy(n,o){for(var c=n.length,m=wr(o.length,c),A=Br(n);m--;){var O=o[m];n[m]=vn(O,c)?A[O]:e}return n}function hh(n,o){if(!(o==="constructor"&&typeof n[o]=="function")&&o!="__proto__")return n[o]}var I0=x0(Wf),Lo=sv||function(n,o){return we.setTimeout(n,o)},lh=x0(dy);function D0(n,o,c){var m=o+"";return lh(n,Fy(m,Ky(Ny(m),c)))}function x0(n){var o=0,c=0;return function(){var m=uv(),A=h-(m-c);if(c=m,A>0){if(++o>=mt)return arguments[0]}else o=0;return n.apply(e,arguments)}}function pc(n,o){var c=-1,m=n.length,A=m-1;for(o=o===e?m:o;++c<o;){var O=Gu(c,A),H=n[O];n[O]=n[c],n[c]=H}return n.length=o,n}var M0=jy(function(n){var o=[];return n.charCodeAt(0)===46&&o.push(""),n.replace(Xt,function(c,m,A,O){o.push(A?O.replace(xi,"$1"):m||c)}),o});function Vi(n){if(typeof n=="string"||Xr(n))return n;var o=n+"";return o=="0"&&1/n==-C?"-0":o}function ms(n){if(n!=null){try{return ka.call(n)}catch{}try{return n+""}catch{}}return""}function Ky(n,o){return fi(lt,function(c){var m="_."+c[0];o&c[1]&&!La(n,m)&&n.push(m)}),n.sort()}function C0(n){if(n instanceof ge)return n.clone();var o=new pi(n.__wrapped__,n.__chain__);return o.__actions__=Br(n.__actions__),o.__index__=n.__index__,o.__values__=n.__values__,o}function Vy(n,o,c){(c?xr(n,o,c):o===e)?o=1:o=nr(ae(o),0);var m=n==null?0:n.length;if(!m||o<1)return[];for(var A=0,O=0,H=rt(Qa(m/o));A<m;)H[O++]=mi(n,A,A+=o);return H}function Gy(n){for(var o=-1,c=n==null?0:n.length,m=0,A=[];++o<c;){var O=n[o];O&&(A[m++]=O)}return A}function Wy(){var n=arguments.length;if(!n)return[];for(var o=rt(n-1),c=arguments[0],m=n;m--;)o[m-1]=arguments[m];return Fn(ie(c)?Br(c):[c],fr(o,1))}var Yy=he(function(n,o){return Je(n)?No(n,fr(o,1,Je,!0)):[]}),Qy=he(function(n,o){var c=vi(o);return Je(c)&&(c=e),Je(n)?No(n,fr(o,1,Je,!0),jt(c,2)):[]}),Jy=he(function(n,o){var c=vi(o);return Je(c)&&(c=e),Je(n)?No(n,fr(o,1,Je,!0),e,c):[]});function Xy(n,o,c){var m=n==null?0:n.length;return m?(o=c||o===e?1:ae(o),mi(n,o<0?0:o,m)):[]}function Zy(n,o,c){var m=n==null?0:n.length;return m?(o=c||o===e?1:ae(o),o=m-o,mi(n,0,o<0?0:o)):[]}function tw(n,o){return n&&n.length?oc(n,jt(o,3),!0,!0):[]}function ew(n,o){return n&&n.length?oc(n,jt(o,3),!0):[]}function rw(n,o,c,m){var A=n==null?0:n.length;return A?(c&&typeof c!="number"&&xr(n,o,c)&&(c=0,m=A),Wv(n,o,c,m)):[]}function P0(n,o,c){var m=n==null?0:n.length;if(!m)return-1;var A=c==null?0:ae(c);return A<0&&(A=nr(m+A,0)),qa(n,jt(o,3),A)}function O0(n,o,c){var m=n==null?0:n.length;if(!m)return-1;var A=m-1;return c!==e&&(A=ae(c),A=c<0?nr(m+A,0):wr(A,m-1)),qa(n,jt(o,3),A,!0)}function N0(n){var o=n==null?0:n.length;return o?fr(n,1):[]}function iw(n){var o=n==null?0:n.length;return o?fr(n,C):[]}function nw(n,o){var c=n==null?0:n.length;return c?(o=o===e?1:ae(o),fr(n,o)):[]}function sw(n){for(var o=-1,c=n==null?0:n.length,m={};++o<c;){var A=n[o];m[A[0]]=A[1]}return m}function R0(n){return n&&n.length?n[0]:e}function ow(n,o,c){var m=n==null?0:n.length;if(!m)return-1;var A=c==null?0:ae(c);return A<0&&(A=nr(m+A,0)),Bs(n,o,A)}function aw(n){var o=n==null?0:n.length;return o?mi(n,0,-1):[]}var cw=he(function(n){var o=ke(n,Xu);return o.length&&o[0]===n[0]?zu(o):[]}),uw=he(function(n){var o=vi(n),c=ke(n,Xu);return o===vi(c)?o=e:c.pop(),c.length&&c[0]===n[0]?zu(c,jt(o,2)):[]}),hw=he(function(n){var o=vi(n),c=ke(n,Xu);return o=typeof o=="function"?o:e,o&&c.pop(),c.length&&c[0]===n[0]?zu(c,e,o):[]});function lw(n,o){return n==null?"":av.call(n,o)}function vi(n){var o=n==null?0:n.length;return o?n[o-1]:e}function fw(n,o,c){var m=n==null?0:n.length;if(!m)return-1;var A=m;return c!==e&&(A=ae(c),A=A<0?nr(m+A,0):wr(A,m-1)),o===o?Km(n,o,A):qa(n,df,A,!0)}function dw(n,o){return n&&n.length?Hf(n,ae(o)):e}var pw=he(T0);function T0(n,o){return n&&n.length&&o&&o.length?Vu(n,o):n}function gw(n,o,c){return n&&n.length&&o&&o.length?Vu(n,o,jt(c,2)):n}function mw(n,o,c){return n&&n.length&&o&&o.length?Vu(n,o,e,c):n}var vw=mn(function(n,o){var c=n==null?0:n.length,m=Lu(n,o);return Gf(n,ke(o,function(A){return vn(A,c)?+A:A}).sort(i0)),m});function yw(n,o){var c=[];if(!(n&&n.length))return c;var m=-1,A=[],O=n.length;for(o=jt(o,3);++m<O;){var H=n[m];o(H,m,n)&&(c.push(H),A.push(m))}return Gf(n,A),c}function fh(n){return n==null?n:lv.call(n)}function ww(n,o,c){var m=n==null?0:n.length;return m?(c&&typeof c!="number"&&xr(n,o,c)?(o=0,c=m):(o=o==null?0:ae(o),c=c===e?m:ae(c)),mi(n,o,c)):[]}function bw(n,o){return sc(n,o)}function _w(n,o,c){return Yu(n,o,jt(c,2))}function Ew(n,o){var c=n==null?0:n.length;if(c){var m=sc(n,o);if(m<c&&Oi(n[m],o))return m}return-1}function Aw(n,o){return sc(n,o,!0)}function Sw(n,o,c){return Yu(n,o,jt(c,2),!0)}function Iw(n,o){var c=n==null?0:n.length;if(c){var m=sc(n,o,!0)-1;if(Oi(n[m],o))return m}return-1}function Dw(n){return n&&n.length?Yf(n):[]}function xw(n,o){return n&&n.length?Yf(n,jt(o,2)):[]}function Mw(n){var o=n==null?0:n.length;return o?mi(n,1,o):[]}function Cw(n,o,c){return n&&n.length?(o=c||o===e?1:ae(o),mi(n,0,o<0?0:o)):[]}function Pw(n,o,c){var m=n==null?0:n.length;return m?(o=c||o===e?1:ae(o),o=m-o,mi(n,o<0?0:o,m)):[]}function Ow(n,o){return n&&n.length?oc(n,jt(o,3),!1,!0):[]}function Nw(n,o){return n&&n.length?oc(n,jt(o,3)):[]}var Rw=he(function(n){return qn(fr(n,1,Je,!0))}),Tw=he(function(n){var o=vi(n);return Je(o)&&(o=e),qn(fr(n,1,Je,!0),jt(o,2))}),Fw=he(function(n){var o=vi(n);return o=typeof o=="function"?o:e,qn(fr(n,1,Je,!0),e,o)});function Uw(n){return n&&n.length?qn(n):[]}function Bw(n,o){return n&&n.length?qn(n,jt(o,2)):[]}function Lw(n,o){return o=typeof o=="function"?o:e,n&&n.length?qn(n,e,o):[]}function dh(n){if(!(n&&n.length))return[];var o=0;return n=Tn(n,function(c){if(Je(c))return o=nr(c.length,o),!0}),Pu(o,function(c){return ke(n,xu(c))})}function F0(n,o){if(!(n&&n.length))return[];var c=dh(n);return o==null?c:ke(c,function(m){return cr(o,e,m)})}var qw=he(function(n,o){return Je(n)?No(n,o):[]}),jw=he(function(n){return Ju(Tn(n,Je))}),$w=he(function(n){var o=vi(n);return Je(o)&&(o=e),Ju(Tn(n,Je),jt(o,2))}),zw=he(function(n){var o=vi(n);return o=typeof o=="function"?o:e,Ju(Tn(n,Je),e,o)}),kw=he(dh);function Hw(n,o){return Zf(n||[],o||[],Oo)}function Kw(n,o){return Zf(n||[],o||[],Fo)}var Vw=he(function(n){var o=n.length,c=o>1?n[o-1]:e;return c=typeof c=="function"?(n.pop(),c):e,F0(n,c)});function U0(n){var o=x(n);return o.__chain__=!0,o}function Gw(n,o){return o(n),n}function gc(n,o){return o(n)}var Ww=mn(function(n){var o=n.length,c=o?n[0]:0,m=this.__wrapped__,A=function(O){return Lu(O,n)};return o>1||this.__actions__.length||!(m instanceof ge)||!vn(c)?this.thru(A):(m=m.slice(c,+c+(o?1:0)),m.__actions__.push({func:gc,args:[A],thisArg:e}),new pi(m,this.__chain__).thru(function(O){return o&&!O.length&&O.push(e),O}))});function Yw(){return U0(this)}function Qw(){return new pi(this.value(),this.__chain__)}function Jw(){this.__values__===e&&(this.__values__=Q0(this.value()));var n=this.__index__>=this.__values__.length,o=n?e:this.__values__[this.__index__++];return{done:n,value:o}}function Xw(){return this}function Zw(n){for(var o,c=this;c instanceof tc;){var m=C0(c);m.__index__=0,m.__values__=e,o?A.__wrapped__=m:o=m;var A=m;c=c.__wrapped__}return A.__wrapped__=n,o}function tb(){var n=this.__wrapped__;if(n instanceof ge){var o=n;return this.__actions__.length&&(o=new ge(this)),o=o.reverse(),o.__actions__.push({func:gc,args:[fh],thisArg:e}),new pi(o,this.__chain__)}return this.thru(fh)}function eb(){return Xf(this.__wrapped__,this.__actions__)}var rb=ac(function(n,o,c){Ne.call(n,c)?++n[c]:pn(n,c,1)});function ib(n,o,c){var m=ie(n)?lf:Gv;return c&&xr(n,o,c)&&(o=e),m(n,jt(o,3))}function nb(n,o){var c=ie(n)?Tn:Ff;return c(n,jt(o,3))}var sb=u0(P0),ob=u0(O0);function ab(n,o){return fr(mc(n,o),1)}function cb(n,o){return fr(mc(n,o),C)}function ub(n,o,c){return c=c===e?1:ae(c),fr(mc(n,o),c)}function B0(n,o){var c=ie(n)?fi:Ln;return c(n,jt(o,3))}function L0(n,o){var c=ie(n)?Mm:Tf;return c(n,jt(o,3))}var hb=ac(function(n,o,c){Ne.call(n,c)?n[c].push(o):pn(n,c,[o])});function lb(n,o,c,m){n=Lr(n)?n:Ys(n),c=c&&!m?ae(c):0;var A=n.length;return c<0&&(c=nr(A+c,0)),_c(n)?c<=A&&n.indexOf(o,c)>-1:!!A&&Bs(n,o,c)>-1}var fb=he(function(n,o,c){var m=-1,A=typeof o=="function",O=Lr(n)?rt(n.length):[];return Ln(n,function(H){O[++m]=A?cr(o,H,c):Ro(H,o,c)}),O}),db=ac(function(n,o,c){pn(n,c,o)});function mc(n,o){var c=ie(n)?ke:$f;return c(n,jt(o,3))}function pb(n,o,c,m){return n==null?[]:(ie(o)||(o=o==null?[]:[o]),c=m?e:c,ie(c)||(c=c==null?[]:[c]),Kf(n,o,c))}var gb=ac(function(n,o,c){n[c?0:1].push(o)},function(){return[[],[]]});function mb(n,o,c){var m=ie(n)?Iu:gf,A=arguments.length<3;return m(n,jt(o,4),c,A,Ln)}function vb(n,o,c){var m=ie(n)?Cm:gf,A=arguments.length<3;return m(n,jt(o,4),c,A,Tf)}function yb(n,o){var c=ie(n)?Tn:Ff;return c(n,wc(jt(o,3)))}function wb(n){var o=ie(n)?Pf:ly;return o(n)}function bb(n,o,c){(c?xr(n,o,c):o===e)?o=1:o=ae(o);var m=ie(n)?zv:fy;return m(n,o)}function _b(n){var o=ie(n)?kv:py;return o(n)}function Eb(n){if(n==null)return 0;if(Lr(n))return _c(n)?qs(n):n.length;var o=br(n);return o==at||o==Bt?n.size:Hu(n).length}function Ab(n,o,c){var m=ie(n)?Du:gy;return c&&xr(n,o,c)&&(o=e),m(n,jt(o,3))}var Sb=he(function(n,o){if(n==null)return[];var c=o.length;return c>1&&xr(n,o[0],o[1])?o=[]:c>2&&xr(o[0],o[1],o[2])&&(o=[o[0]]),Kf(n,fr(o,1),[])}),vc=nv||function(){return we.Date.now()};function Ib(n,o){if(typeof o!="function")throw new di(u);return n=ae(n),function(){if(--n<1)return o.apply(this,arguments)}}function q0(n,o,c){return o=c?e:o,o=n&&o==null?n.length:o,gn(n,v,e,e,e,e,o)}function j0(n,o){var c;if(typeof o!="function")throw new di(u);return n=ae(n),function(){return--n>0&&(c=o.apply(this,arguments)),n<=1&&(o=e),c}}var ph=he(function(n,o,c){var m=G;if(c.length){var A=Un(c,Gs(ph));m|=z}return gn(n,m,o,c,A)}),$0=he(function(n,o,c){var m=G|tt;if(c.length){var A=Un(c,Gs($0));m|=z}return gn(o,m,n,c,A)});function z0(n,o,c){o=c?e:o;var m=gn(n,V,e,e,e,e,e,o);return m.placeholder=z0.placeholder,m}function k0(n,o,c){o=c?e:o;var m=gn(n,B,e,e,e,e,e,o);return m.placeholder=k0.placeholder,m}function H0(n,o,c){var m,A,O,H,W,X,ot=0,ct=!1,dt=!1,vt=!0;if(typeof n!="function")throw new di(u);o=yi(o)||0,Ge(c)&&(ct=!!c.leading,dt="maxWait"in c,O=dt?nr(yi(c.maxWait)||0,o):O,vt="trailing"in c?!!c.trailing:vt);function Ft(Xe){var Ni=m,bn=A;return m=A=e,ot=Xe,H=n.apply(bn,Ni),H}function kt(Xe){return ot=Xe,W=Lo(fe,o),ct?Ft(Xe):H}function ue(Xe){var Ni=Xe-X,bn=Xe-ot,ud=o-Ni;return dt?wr(ud,O-bn):ud}function Ht(Xe){var Ni=Xe-X,bn=Xe-ot;return X===e||Ni>=o||Ni<0||dt&&bn>=O}function fe(){var Xe=vc();if(Ht(Xe))return be(Xe);W=Lo(fe,ue(Xe))}function be(Xe){return W=e,vt&&m?Ft(Xe):(m=A=e,H)}function Zr(){W!==e&&t0(W),ot=0,m=X=A=W=e}function Mr(){return W===e?H:be(vc())}function ti(){var Xe=vc(),Ni=Ht(Xe);if(m=arguments,A=this,X=Xe,Ni){if(W===e)return kt(X);if(dt)return t0(W),W=Lo(fe,o),Ft(X)}return W===e&&(W=Lo(fe,o)),H}return ti.cancel=Zr,ti.flush=Mr,ti}var Db=he(function(n,o){return Rf(n,1,o)}),xb=he(function(n,o,c){return Rf(n,yi(o)||0,c)});function Mb(n){return gn(n,nt)}function yc(n,o){if(typeof n!="function"||o!=null&&typeof o!="function")throw new di(u);var c=function(){var m=arguments,A=o?o.apply(this,m):m[0],O=c.cache;if(O.has(A))return O.get(A);var H=n.apply(this,m);return c.cache=O.set(A,H)||O,H};return c.cache=new(yc.Cache||dn),c}yc.Cache=dn;function wc(n){if(typeof n!="function")throw new di(u);return function(){var o=arguments;switch(o.length){case 0:return!n.call(this);case 1:return!n.call(this,o[0]);case 2:return!n.call(this,o[0],o[1]);case 3:return!n.call(this,o[0],o[1],o[2])}return!n.apply(this,o)}}function Cb(n){return j0(2,n)}var Pb=my(function(n,o){o=o.length==1&&ie(o[0])?ke(o[0],Qr(jt())):ke(fr(o,1),Qr(jt()));var c=o.length;return he(function(m){for(var A=-1,O=wr(m.length,c);++A<O;)m[A]=o[A].call(this,m[A]);return cr(n,this,m)})}),gh=he(function(n,o){var c=Un(o,Gs(gh));return gn(n,z,e,o,c)}),K0=he(function(n,o){var c=Un(o,Gs(K0));return gn(n,$,e,o,c)}),Ob=mn(function(n,o){return gn(n,T,e,e,e,o)});function Nb(n,o){if(typeof n!="function")throw new di(u);return o=o===e?o:ae(o),he(n,o)}function Rb(n,o){if(typeof n!="function")throw new di(u);return o=o==null?0:nr(ae(o),0),he(function(c){var m=c[o],A=$n(c,0,o);return m&&Fn(A,m),cr(n,this,A)})}function Tb(n,o,c){var m=!0,A=!0;if(typeof n!="function")throw new di(u);return Ge(c)&&(m="leading"in c?!!c.leading:m,A="trailing"in c?!!c.trailing:A),H0(n,o,{leading:m,maxWait:o,trailing:A})}function Fb(n){return q0(n,1)}function Ub(n,o){return gh(Zu(o),n)}function Bb(){if(!arguments.length)return[];var n=arguments[0];return ie(n)?n:[n]}function Lb(n){return gi(n,D)}function qb(n,o){return o=typeof o=="function"?o:e,gi(n,D,o)}function jb(n){return gi(n,E|D)}function $b(n,o){return o=typeof o=="function"?o:e,gi(n,E|D,o)}function zb(n,o){return o==null||Nf(n,o,ur(o))}function Oi(n,o){return n===o||n!==n&&o!==o}var kb=lc($u),Hb=lc(function(n,o){return n>=o}),vs=Lf(function(){return arguments}())?Lf:function(n){return We(n)&&Ne.call(n,"callee")&&!Sf.call(n,"callee")},ie=rt.isArray,Kb=Ir?Qr(Ir):Zv;function Lr(n){return n!=null&&bc(n.length)&&!yn(n)}function Je(n){return We(n)&&Lr(n)}function Vb(n){return n===!0||n===!1||We(n)&&Dr(n)==L}var zn=ov||Dh,Gb=Mi?Qr(Mi):ty;function Wb(n){return We(n)&&n.nodeType===1&&!qo(n)}function Yb(n){if(n==null)return!0;if(Lr(n)&&(ie(n)||typeof n=="string"||typeof n.splice=="function"||zn(n)||Ws(n)||vs(n)))return!n.length;var o=br(n);if(o==at||o==Bt)return!n.size;if(Bo(n))return!Hu(n).length;for(var c in n)if(Ne.call(n,c))return!1;return!0}function Qb(n,o){return To(n,o)}function Jb(n,o,c){c=typeof c=="function"?c:e;var m=c?c(n,o):e;return m===e?To(n,o,e,c):!!m}function mh(n){if(!We(n))return!1;var o=Dr(n);return o==F||o==p||typeof n.message=="string"&&typeof n.name=="string"&&!qo(n)}function Xb(n){return typeof n=="number"&&Df(n)}function yn(n){if(!Ge(n))return!1;var o=Dr(n);return o==et||o==ut||o==U||o==$t}function V0(n){return typeof n=="number"&&n==ae(n)}function bc(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=R}function Ge(n){var o=typeof n;return n!=null&&(o=="object"||o=="function")}function We(n){return n!=null&&typeof n=="object"}var G0=li?Qr(li):ry;function Zb(n,o){return n===o||ku(n,o,oh(o))}function t2(n,o,c){return c=typeof c=="function"?c:e,ku(n,o,oh(o),c)}function e2(n){return W0(n)&&n!=+n}function r2(n){if(qy(n))throw new ee(a);return qf(n)}function i2(n){return n===null}function n2(n){return n==null}function W0(n){return typeof n=="number"||We(n)&&Dr(n)==Mt}function qo(n){if(!We(n)||Dr(n)!=It)return!1;var o=Ga(n);if(o===null)return!0;var c=Ne.call(o,"constructor")&&o.constructor;return typeof c=="function"&&c instanceof c&&ka.call(c)==tv}var vh=ki?Qr(ki):iy;function s2(n){return V0(n)&&n>=-R&&n<=R}var Y0=So?Qr(So):ny;function _c(n){return typeof n=="string"||!ie(n)&&We(n)&&Dr(n)==_t}function Xr(n){return typeof n=="symbol"||We(n)&&Dr(n)==Et}var Ws=us?Qr(us):sy;function o2(n){return n===e}function a2(n){return We(n)&&br(n)==wt}function c2(n){return We(n)&&Dr(n)==At}var u2=lc(Ku),h2=lc(function(n,o){return n<=o});function Q0(n){if(!n)return[];if(Lr(n))return _c(n)?Ci(n):Br(n);if(Do&&n[Do])return zm(n[Do]());var o=br(n),c=o==at?Nu:o==Bt?ja:Ys;return c(n)}function wn(n){if(!n)return n===0?n:0;if(n=yi(n),n===C||n===-C){var o=n<0?-1:1;return o*j}return n===n?n:0}function ae(n){var o=wn(n),c=o%1;return o===o?c?o-c:o:0}function J0(n){return n?ds(ae(n),0,g):0}function yi(n){if(typeof n=="number")return n;if(Xr(n))return I;if(Ge(n)){var o=typeof n.valueOf=="function"?n.valueOf():n;n=Ge(o)?o+"":o}if(typeof n!="string")return n===0?n:+n;n=mf(n);var c=ai.test(n);return c||ui.test(n)?re(n.slice(2),c?2:8):oi.test(n)?I:+n}function X0(n){return Ki(n,qr(n))}function l2(n){return n?ds(ae(n),-R,R):n===0?n:0}function Me(n){return n==null?"":Jr(n)}var f2=Ks(function(n,o){if(Bo(o)||Lr(o)){Ki(o,ur(o),n);return}for(var c in o)Ne.call(o,c)&&Oo(n,c,o[c])}),Z0=Ks(function(n,o){Ki(o,qr(o),n)}),Ec=Ks(function(n,o,c,m){Ki(o,qr(o),n,m)}),d2=Ks(function(n,o,c,m){Ki(o,ur(o),n,m)}),p2=mn(Lu);function g2(n,o){var c=Hs(n);return o==null?c:Of(c,o)}var m2=he(function(n,o){n=qe(n);var c=-1,m=o.length,A=m>2?o[2]:e;for(A&&xr(o[0],o[1],A)&&(m=1);++c<m;)for(var O=o[c],H=qr(O),W=-1,X=H.length;++W<X;){var ot=H[W],ct=n[ot];(ct===e||Oi(ct,$s[ot])&&!Ne.call(n,ot))&&(n[ot]=O[ot])}return n}),v2=he(function(n){return n.push(e,m0),cr(td,e,n)});function y2(n,o){return ff(n,jt(o,3),Hi)}function w2(n,o){return ff(n,jt(o,3),ju)}function b2(n,o){return n==null?n:qu(n,jt(o,3),qr)}function _2(n,o){return n==null?n:Uf(n,jt(o,3),qr)}function E2(n,o){return n&&Hi(n,jt(o,3))}function A2(n,o){return n&&ju(n,jt(o,3))}function S2(n){return n==null?[]:ic(n,ur(n))}function I2(n){return n==null?[]:ic(n,qr(n))}function yh(n,o,c){var m=n==null?e:ps(n,o);return m===e?c:m}function D2(n,o){return n!=null&&w0(n,o,Yv)}function wh(n,o){return n!=null&&w0(n,o,Qv)}var x2=l0(function(n,o,c){o!=null&&typeof o.toString!="function"&&(o=Ha.call(o)),n[o]=c},_h(jr)),M2=l0(function(n,o,c){o!=null&&typeof o.toString!="function"&&(o=Ha.call(o)),Ne.call(n,o)?n[o].push(c):n[o]=[c]},jt),C2=he(Ro);function ur(n){return Lr(n)?Cf(n):Hu(n)}function qr(n){return Lr(n)?Cf(n,!0):oy(n)}function P2(n,o){var c={};return o=jt(o,3),Hi(n,function(m,A,O){pn(c,o(m,A,O),m)}),c}function O2(n,o){var c={};return o=jt(o,3),Hi(n,function(m,A,O){pn(c,A,o(m,A,O))}),c}var N2=Ks(function(n,o,c){nc(n,o,c)}),td=Ks(function(n,o,c,m){nc(n,o,c,m)}),R2=mn(function(n,o){var c={};if(n==null)return c;var m=!1;o=ke(o,function(O){return O=jn(O,n),m||(m=O.length>1),O}),Ki(n,nh(n),c),m&&(c=gi(c,E|S|D,xy));for(var A=o.length;A--;)Qu(c,o[A]);return c});function T2(n,o){return ed(n,wc(jt(o)))}var F2=mn(function(n,o){return n==null?{}:cy(n,o)});function ed(n,o){if(n==null)return{};var c=ke(nh(n),function(m){return[m]});return o=jt(o),Vf(n,c,function(m,A){return o(m,A[0])})}function U2(n,o,c){o=jn(o,n);var m=-1,A=o.length;for(A||(A=1,n=e);++m<A;){var O=n==null?e:n[Vi(o[m])];O===e&&(m=A,O=c),n=yn(O)?O.call(n):O}return n}function B2(n,o,c){return n==null?n:Fo(n,o,c)}function L2(n,o,c,m){return m=typeof m=="function"?m:e,n==null?n:Fo(n,o,c,m)}var rd=p0(ur),id=p0(qr);function q2(n,o,c){var m=ie(n),A=m||zn(n)||Ws(n);if(o=jt(o,4),c==null){var O=n&&n.constructor;A?c=m?new O:[]:Ge(n)?c=yn(O)?Hs(Ga(n)):{}:c={}}return(A?fi:Hi)(n,function(H,W,X){return o(c,H,W,X)}),c}function j2(n,o){return n==null?!0:Qu(n,o)}function $2(n,o,c){return n==null?n:Jf(n,o,Zu(c))}function z2(n,o,c,m){return m=typeof m=="function"?m:e,n==null?n:Jf(n,o,Zu(c),m)}function Ys(n){return n==null?[]:Ou(n,ur(n))}function k2(n){return n==null?[]:Ou(n,qr(n))}function H2(n,o,c){return c===e&&(c=o,o=e),c!==e&&(c=yi(c),c=c===c?c:0),o!==e&&(o=yi(o),o=o===o?o:0),ds(yi(n),o,c)}function K2(n,o,c){return o=wn(o),c===e?(c=o,o=0):c=wn(c),n=yi(n),Jv(n,o,c)}function V2(n,o,c){if(c&&typeof c!="boolean"&&xr(n,o,c)&&(o=c=e),c===e&&(typeof o=="boolean"?(c=o,o=e):typeof n=="boolean"&&(c=n,n=e)),n===e&&o===e?(n=0,o=1):(n=wn(n),o===e?(o=n,n=0):o=wn(o)),n>o){var m=n;n=o,o=m}if(c||n%1||o%1){var A=xf();return wr(n+A*(o-n+Be("1e-"+((A+"").length-1))),o)}return Gu(n,o)}var G2=Vs(function(n,o,c){return o=o.toLowerCase(),n+(c?nd(o):o)});function nd(n){return bh(Me(n).toLowerCase())}function sd(n){return n=Me(n),n&&n.replace(ar,Bm).replace(Eu,"")}function W2(n,o,c){n=Me(n),o=Jr(o);var m=n.length;c=c===e?m:ds(ae(c),0,m);var A=c;return c-=o.length,c>=0&&n.slice(c,A)==o}function Y2(n){return n=Me(n),n&&zt.test(n)?n.replace(Ar,Lm):n}function Q2(n){return n=Me(n),n&&Zt.test(n)?n.replace(xe,"\\$&"):n}var J2=Vs(function(n,o,c){return n+(c?"-":"")+o.toLowerCase()}),X2=Vs(function(n,o,c){return n+(c?" ":"")+o.toLowerCase()}),Z2=c0("toLowerCase");function t3(n,o,c){n=Me(n),o=ae(o);var m=o?qs(n):0;if(!o||m>=o)return n;var A=(o-m)/2;return hc(Ja(A),c)+n+hc(Qa(A),c)}function e3(n,o,c){n=Me(n),o=ae(o);var m=o?qs(n):0;return o&&m<o?n+hc(o-m,c):n}function r3(n,o,c){n=Me(n),o=ae(o);var m=o?qs(n):0;return o&&m<o?hc(o-m,c)+n:n}function i3(n,o,c){return c||o==null?o=0:o&&(o=+o),hv(Me(n).replace(Yt,""),o||0)}function n3(n,o,c){return(c?xr(n,o,c):o===e)?o=1:o=ae(o),Wu(Me(n),o)}function s3(){var n=arguments,o=Me(n[0]);return n.length<3?o:o.replace(n[1],n[2])}var o3=Vs(function(n,o,c){return n+(c?"_":"")+o.toLowerCase()});function a3(n,o,c){return c&&typeof c!="number"&&xr(n,o,c)&&(o=c=e),c=c===e?g:c>>>0,c?(n=Me(n),n&&(typeof o=="string"||o!=null&&!vh(o))&&(o=Jr(o),!o&&Ls(n))?$n(Ci(n),0,c):n.split(o,c)):[]}var c3=Vs(function(n,o,c){return n+(c?" ":"")+bh(o)});function u3(n,o,c){return n=Me(n),c=c==null?0:ds(ae(c),0,n.length),o=Jr(o),n.slice(c,c+o.length)==o}function h3(n,o,c){var m=x.templateSettings;c&&xr(n,o,c)&&(o=e),n=Me(n),o=Ec({},o,m,g0);var A=Ec({},o.imports,m.imports,g0),O=ur(A),H=Ou(A,O),W,X,ot=0,ct=o.interpolate||qi,dt="__p += '",vt=Ru((o.escape||qi).source+"|"+ct.source+"|"+(ct===Kt?Oe:qi).source+"|"+(o.evaluate||qi).source+"|$","g"),Ft="//# sourceURL="+(Ne.call(o,"sourceURL")?(o.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Au+"]")+`
|
|
40
|
+
`;n.replace(vt,function(Ht,fe,be,Zr,Mr,ti){return be||(be=Zr),dt+=n.slice(ot,ti).replace(Xn,qm),fe&&(W=!0,dt+=`' +
|
|
41
|
+
__e(`+fe+`) +
|
|
42
|
+
'`),Mr&&(X=!0,dt+=`';
|
|
43
|
+
`+Mr+`;
|
|
44
|
+
__p += '`),be&&(dt+=`' +
|
|
45
|
+
((__t = (`+be+`)) == null ? '' : __t) +
|
|
46
|
+
'`),ot=ti+Ht.length,Ht}),dt+=`';
|
|
47
|
+
`;var kt=Ne.call(o,"variable")&&o.variable;if(!kt)dt=`with (obj) {
|
|
48
|
+
`+dt+`
|
|
49
|
+
}
|
|
50
|
+
`;else if(Pe.test(kt))throw new ee(l);dt=(X?dt.replace(pe,""):dt).replace(Ve,"$1").replace(ye,"$1;"),dt="function("+(kt||"obj")+`) {
|
|
51
|
+
`+(kt?"":`obj || (obj = {});
|
|
52
|
+
`)+"var __t, __p = ''"+(W?", __e = _.escape":"")+(X?`, __j = Array.prototype.join;
|
|
53
|
+
function print() { __p += __j.call(arguments, '') }
|
|
54
|
+
`:`;
|
|
55
|
+
`)+dt+`return __p
|
|
56
|
+
}`;var ue=ad(function(){return Se(O,Ft+"return "+dt).apply(e,H)});if(ue.source=dt,mh(ue))throw ue;return ue}function l3(n){return Me(n).toLowerCase()}function f3(n){return Me(n).toUpperCase()}function d3(n,o,c){if(n=Me(n),n&&(c||o===e))return mf(n);if(!n||!(o=Jr(o)))return n;var m=Ci(n),A=Ci(o),O=vf(m,A),H=yf(m,A)+1;return $n(m,O,H).join("")}function p3(n,o,c){if(n=Me(n),n&&(c||o===e))return n.slice(0,bf(n)+1);if(!n||!(o=Jr(o)))return n;var m=Ci(n),A=yf(m,Ci(o))+1;return $n(m,0,A).join("")}function g3(n,o,c){if(n=Me(n),n&&(c||o===e))return n.replace(Yt,"");if(!n||!(o=Jr(o)))return n;var m=Ci(n),A=vf(m,Ci(o));return $n(m,A).join("")}function m3(n,o){var c=ft,m=pt;if(Ge(o)){var A="separator"in o?o.separator:A;c="length"in o?ae(o.length):c,m="omission"in o?Jr(o.omission):m}n=Me(n);var O=n.length;if(Ls(n)){var H=Ci(n);O=H.length}if(c>=O)return n;var W=c-qs(m);if(W<1)return m;var X=H?$n(H,0,W).join(""):n.slice(0,W);if(A===e)return X+m;if(H&&(W+=X.length-W),vh(A)){if(n.slice(W).search(A)){var ot,ct=X;for(A.global||(A=Ru(A.source,Me(le.exec(A))+"g")),A.lastIndex=0;ot=A.exec(ct);)var dt=ot.index;X=X.slice(0,dt===e?W:dt)}}else if(n.indexOf(Jr(A),W)!=W){var vt=X.lastIndexOf(A);vt>-1&&(X=X.slice(0,vt))}return X+m}function v3(n){return n=Me(n),n&&Gt.test(n)?n.replace(_e,Vm):n}var y3=Vs(function(n,o,c){return n+(c?" ":"")+o.toUpperCase()}),bh=c0("toUpperCase");function od(n,o,c){return n=Me(n),o=c?e:o,o===e?$m(n)?Ym(n):Nm(n):n.match(o)||[]}var ad=he(function(n,o){try{return cr(n,e,o)}catch(c){return mh(c)?c:new ee(c)}}),w3=mn(function(n,o){return fi(o,function(c){c=Vi(c),pn(n,c,ph(n[c],n))}),n});function b3(n){var o=n==null?0:n.length,c=jt();return n=o?ke(n,function(m){if(typeof m[1]!="function")throw new di(u);return[c(m[0]),m[1]]}):[],he(function(m){for(var A=-1;++A<o;){var O=n[A];if(cr(O[0],this,m))return cr(O[1],this,m)}})}function _3(n){return Vv(gi(n,E))}function _h(n){return function(){return n}}function E3(n,o){return n==null||n!==n?o:n}var A3=h0(),S3=h0(!0);function jr(n){return n}function Eh(n){return jf(typeof n=="function"?n:gi(n,E))}function I3(n){return zf(gi(n,E))}function D3(n,o){return kf(n,gi(o,E))}var x3=he(function(n,o){return function(c){return Ro(c,n,o)}}),M3=he(function(n,o){return function(c){return Ro(n,c,o)}});function Ah(n,o,c){var m=ur(o),A=ic(o,m);c==null&&!(Ge(o)&&(A.length||!m.length))&&(c=o,o=n,n=this,A=ic(o,ur(o)));var O=!(Ge(c)&&"chain"in c)||!!c.chain,H=yn(n);return fi(A,function(W){var X=o[W];n[W]=X,H&&(n.prototype[W]=function(){var ot=this.__chain__;if(O||ot){var ct=n(this.__wrapped__),dt=ct.__actions__=Br(this.__actions__);return dt.push({func:X,args:arguments,thisArg:n}),ct.__chain__=ot,ct}return X.apply(n,Fn([this.value()],arguments))})}),n}function C3(){return we._===this&&(we._=ev),this}function Sh(){}function P3(n){return n=ae(n),he(function(o){return Hf(o,n)})}var O3=eh(ke),N3=eh(lf),R3=eh(Du);function cd(n){return ch(n)?xu(Vi(n)):uy(n)}function T3(n){return function(o){return n==null?e:ps(n,o)}}var F3=f0(),U3=f0(!0);function Ih(){return[]}function Dh(){return!1}function B3(){return{}}function L3(){return""}function q3(){return!0}function j3(n,o){if(n=ae(n),n<1||n>R)return[];var c=g,m=wr(n,g);o=jt(o),n-=g;for(var A=Pu(m,o);++c<n;)o(c);return A}function $3(n){return ie(n)?ke(n,Vi):Xr(n)?[n]:Br(M0(Me(n)))}function z3(n){var o=++Zm;return Me(n)+o}var k3=uc(function(n,o){return n+o},0),H3=rh("ceil"),K3=uc(function(n,o){return n/o},1),V3=rh("floor");function G3(n){return n&&n.length?rc(n,jr,$u):e}function W3(n,o){return n&&n.length?rc(n,jt(o,2),$u):e}function Y3(n){return pf(n,jr)}function Q3(n,o){return pf(n,jt(o,2))}function J3(n){return n&&n.length?rc(n,jr,Ku):e}function X3(n,o){return n&&n.length?rc(n,jt(o,2),Ku):e}var Z3=uc(function(n,o){return n*o},1),t6=rh("round"),e6=uc(function(n,o){return n-o},0);function r6(n){return n&&n.length?Cu(n,jr):0}function i6(n,o){return n&&n.length?Cu(n,jt(o,2)):0}return x.after=Ib,x.ary=q0,x.assign=f2,x.assignIn=Z0,x.assignInWith=Ec,x.assignWith=d2,x.at=p2,x.before=j0,x.bind=ph,x.bindAll=w3,x.bindKey=$0,x.castArray=Bb,x.chain=U0,x.chunk=Vy,x.compact=Gy,x.concat=Wy,x.cond=b3,x.conforms=_3,x.constant=_h,x.countBy=rb,x.create=g2,x.curry=z0,x.curryRight=k0,x.debounce=H0,x.defaults=m2,x.defaultsDeep=v2,x.defer=Db,x.delay=xb,x.difference=Yy,x.differenceBy=Qy,x.differenceWith=Jy,x.drop=Xy,x.dropRight=Zy,x.dropRightWhile=tw,x.dropWhile=ew,x.fill=rw,x.filter=nb,x.flatMap=ab,x.flatMapDeep=cb,x.flatMapDepth=ub,x.flatten=N0,x.flattenDeep=iw,x.flattenDepth=nw,x.flip=Mb,x.flow=A3,x.flowRight=S3,x.fromPairs=sw,x.functions=S2,x.functionsIn=I2,x.groupBy=hb,x.initial=aw,x.intersection=cw,x.intersectionBy=uw,x.intersectionWith=hw,x.invert=x2,x.invertBy=M2,x.invokeMap=fb,x.iteratee=Eh,x.keyBy=db,x.keys=ur,x.keysIn=qr,x.map=mc,x.mapKeys=P2,x.mapValues=O2,x.matches=I3,x.matchesProperty=D3,x.memoize=yc,x.merge=N2,x.mergeWith=td,x.method=x3,x.methodOf=M3,x.mixin=Ah,x.negate=wc,x.nthArg=P3,x.omit=R2,x.omitBy=T2,x.once=Cb,x.orderBy=pb,x.over=O3,x.overArgs=Pb,x.overEvery=N3,x.overSome=R3,x.partial=gh,x.partialRight=K0,x.partition=gb,x.pick=F2,x.pickBy=ed,x.property=cd,x.propertyOf=T3,x.pull=pw,x.pullAll=T0,x.pullAllBy=gw,x.pullAllWith=mw,x.pullAt=vw,x.range=F3,x.rangeRight=U3,x.rearg=Ob,x.reject=yb,x.remove=yw,x.rest=Nb,x.reverse=fh,x.sampleSize=bb,x.set=B2,x.setWith=L2,x.shuffle=_b,x.slice=ww,x.sortBy=Sb,x.sortedUniq=Dw,x.sortedUniqBy=xw,x.split=a3,x.spread=Rb,x.tail=Mw,x.take=Cw,x.takeRight=Pw,x.takeRightWhile=Ow,x.takeWhile=Nw,x.tap=Gw,x.throttle=Tb,x.thru=gc,x.toArray=Q0,x.toPairs=rd,x.toPairsIn=id,x.toPath=$3,x.toPlainObject=X0,x.transform=q2,x.unary=Fb,x.union=Rw,x.unionBy=Tw,x.unionWith=Fw,x.uniq=Uw,x.uniqBy=Bw,x.uniqWith=Lw,x.unset=j2,x.unzip=dh,x.unzipWith=F0,x.update=$2,x.updateWith=z2,x.values=Ys,x.valuesIn=k2,x.without=qw,x.words=od,x.wrap=Ub,x.xor=jw,x.xorBy=$w,x.xorWith=zw,x.zip=kw,x.zipObject=Hw,x.zipObjectDeep=Kw,x.zipWith=Vw,x.entries=rd,x.entriesIn=id,x.extend=Z0,x.extendWith=Ec,Ah(x,x),x.add=k3,x.attempt=ad,x.camelCase=G2,x.capitalize=nd,x.ceil=H3,x.clamp=H2,x.clone=Lb,x.cloneDeep=jb,x.cloneDeepWith=$b,x.cloneWith=qb,x.conformsTo=zb,x.deburr=sd,x.defaultTo=E3,x.divide=K3,x.endsWith=W2,x.eq=Oi,x.escape=Y2,x.escapeRegExp=Q2,x.every=ib,x.find=sb,x.findIndex=P0,x.findKey=y2,x.findLast=ob,x.findLastIndex=O0,x.findLastKey=w2,x.floor=V3,x.forEach=B0,x.forEachRight=L0,x.forIn=b2,x.forInRight=_2,x.forOwn=E2,x.forOwnRight=A2,x.get=yh,x.gt=kb,x.gte=Hb,x.has=D2,x.hasIn=wh,x.head=R0,x.identity=jr,x.includes=lb,x.indexOf=ow,x.inRange=K2,x.invoke=C2,x.isArguments=vs,x.isArray=ie,x.isArrayBuffer=Kb,x.isArrayLike=Lr,x.isArrayLikeObject=Je,x.isBoolean=Vb,x.isBuffer=zn,x.isDate=Gb,x.isElement=Wb,x.isEmpty=Yb,x.isEqual=Qb,x.isEqualWith=Jb,x.isError=mh,x.isFinite=Xb,x.isFunction=yn,x.isInteger=V0,x.isLength=bc,x.isMap=G0,x.isMatch=Zb,x.isMatchWith=t2,x.isNaN=e2,x.isNative=r2,x.isNil=n2,x.isNull=i2,x.isNumber=W0,x.isObject=Ge,x.isObjectLike=We,x.isPlainObject=qo,x.isRegExp=vh,x.isSafeInteger=s2,x.isSet=Y0,x.isString=_c,x.isSymbol=Xr,x.isTypedArray=Ws,x.isUndefined=o2,x.isWeakMap=a2,x.isWeakSet=c2,x.join=lw,x.kebabCase=J2,x.last=vi,x.lastIndexOf=fw,x.lowerCase=X2,x.lowerFirst=Z2,x.lt=u2,x.lte=h2,x.max=G3,x.maxBy=W3,x.mean=Y3,x.meanBy=Q3,x.min=J3,x.minBy=X3,x.stubArray=Ih,x.stubFalse=Dh,x.stubObject=B3,x.stubString=L3,x.stubTrue=q3,x.multiply=Z3,x.nth=dw,x.noConflict=C3,x.noop=Sh,x.now=vc,x.pad=t3,x.padEnd=e3,x.padStart=r3,x.parseInt=i3,x.random=V2,x.reduce=mb,x.reduceRight=vb,x.repeat=n3,x.replace=s3,x.result=U2,x.round=t6,x.runInContext=J,x.sample=wb,x.size=Eb,x.snakeCase=o3,x.some=Ab,x.sortedIndex=bw,x.sortedIndexBy=_w,x.sortedIndexOf=Ew,x.sortedLastIndex=Aw,x.sortedLastIndexBy=Sw,x.sortedLastIndexOf=Iw,x.startCase=c3,x.startsWith=u3,x.subtract=e6,x.sum=r6,x.sumBy=i6,x.template=h3,x.times=j3,x.toFinite=wn,x.toInteger=ae,x.toLength=J0,x.toLower=l3,x.toNumber=yi,x.toSafeInteger=l2,x.toString=Me,x.toUpper=f3,x.trim=d3,x.trimEnd=p3,x.trimStart=g3,x.truncate=m3,x.unescape=v3,x.uniqueId=z3,x.upperCase=y3,x.upperFirst=bh,x.each=B0,x.eachRight=L0,x.first=R0,Ah(x,function(){var n={};return Hi(x,function(o,c){Ne.call(x.prototype,c)||(n[c]=o)}),n}(),{chain:!1}),x.VERSION=i,fi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){x[n].placeholder=x}),fi(["drop","take"],function(n,o){ge.prototype[n]=function(c){c=c===e?1:nr(ae(c),0);var m=this.__filtered__&&!o?new ge(this):this.clone();return m.__filtered__?m.__takeCount__=wr(c,m.__takeCount__):m.__views__.push({size:wr(c,g),type:n+(m.__dir__<0?"Right":"")}),m},ge.prototype[n+"Right"]=function(c){return this.reverse()[n](c).reverse()}}),fi(["filter","map","takeWhile"],function(n,o){var c=o+1,m=c==y||c==M;ge.prototype[n]=function(A){var O=this.clone();return O.__iteratees__.push({iteratee:jt(A,3),type:c}),O.__filtered__=O.__filtered__||m,O}}),fi(["head","last"],function(n,o){var c="take"+(o?"Right":"");ge.prototype[n]=function(){return this[c](1).value()[0]}}),fi(["initial","tail"],function(n,o){var c="drop"+(o?"":"Right");ge.prototype[n]=function(){return this.__filtered__?new ge(this):this[c](1)}}),ge.prototype.compact=function(){return this.filter(jr)},ge.prototype.find=function(n){return this.filter(n).head()},ge.prototype.findLast=function(n){return this.reverse().find(n)},ge.prototype.invokeMap=he(function(n,o){return typeof n=="function"?new ge(this):this.map(function(c){return Ro(c,n,o)})}),ge.prototype.reject=function(n){return this.filter(wc(jt(n)))},ge.prototype.slice=function(n,o){n=ae(n);var c=this;return c.__filtered__&&(n>0||o<0)?new ge(c):(n<0?c=c.takeRight(-n):n&&(c=c.drop(n)),o!==e&&(o=ae(o),c=o<0?c.dropRight(-o):c.take(o-n)),c)},ge.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},ge.prototype.toArray=function(){return this.take(g)},Hi(ge.prototype,function(n,o){var c=/^(?:filter|find|map|reject)|While$/.test(o),m=/^(?:head|last)$/.test(o),A=x[m?"take"+(o=="last"?"Right":""):o],O=m||/^find/.test(o);A&&(x.prototype[o]=function(){var H=this.__wrapped__,W=m?[1]:arguments,X=H instanceof ge,ot=W[0],ct=X||ie(H),dt=function(fe){var be=A.apply(x,Fn([fe],W));return m&&vt?be[0]:be};ct&&c&&typeof ot=="function"&&ot.length!=1&&(X=ct=!1);var vt=this.__chain__,Ft=!!this.__actions__.length,kt=O&&!vt,ue=X&&!Ft;if(!O&&ct){H=ue?H:new ge(this);var Ht=n.apply(H,W);return Ht.__actions__.push({func:gc,args:[dt],thisArg:e}),new pi(Ht,vt)}return kt&&ue?n.apply(this,W):(Ht=this.thru(dt),kt?m?Ht.value()[0]:Ht.value():Ht)})}),fi(["pop","push","shift","sort","splice","unshift"],function(n){var o=$a[n],c=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",m=/^(?:pop|shift)$/.test(n);x.prototype[n]=function(){var A=arguments;if(m&&!this.__chain__){var O=this.value();return o.apply(ie(O)?O:[],A)}return this[c](function(H){return o.apply(ie(H)?H:[],A)})}}),Hi(ge.prototype,function(n,o){var c=x[o];if(c){var m=c.name+"";Ne.call(ks,m)||(ks[m]=[]),ks[m].push({name:o,func:c})}}),ks[cc(e,tt).name]=[{name:"wrapper",func:e}],ge.prototype.clone=vv,ge.prototype.reverse=yv,ge.prototype.value=wv,x.prototype.at=Ww,x.prototype.chain=Yw,x.prototype.commit=Qw,x.prototype.next=Jw,x.prototype.plant=Zw,x.prototype.reverse=tb,x.prototype.toJSON=x.prototype.valueOf=x.prototype.value=eb,x.prototype.first=x.prototype.head,Do&&(x.prototype[Do]=Xw),x},js=Qm();Qe?((Qe.exports=js)._=js,Le._=js):we._=js}).call(Wo)})(Tl,Tl.exports);var D9=Object.defineProperty,x9=Object.defineProperties,M9=Object.getOwnPropertyDescriptors,v1=Object.getOwnPropertySymbols,C9=Object.prototype.hasOwnProperty,P9=Object.prototype.propertyIsEnumerable,y1=(r,t,e)=>t in r?D9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Oc=(r,t)=>{for(var e in t||(t={}))C9.call(t,e)&&y1(r,e,t[e]);if(v1)for(var e of v1(t))P9.call(t,e)&&y1(r,e,t[e]);return r},O9=(r,t)=>x9(r,M9(t));function Yn(r,t,e){var i;const s=Tc(r);return((i=t.rpcMap)==null?void 0:i[s.reference])||`${I9}?chainId=${s.namespace}:${s.reference}&projectId=${e}`}function Ns(r){return r.includes(":")?r.split(":")[1]:r}function Im(r){return r.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function N9(r,t){const e=Object.keys(t.namespaces).filter(s=>s.includes(r));if(!e.length)return[];const i=[];return e.forEach(s=>{const a=t.namespaces[s].accounts;i.push(...a)}),i}function nl(r={},t={}){const e=w1(r),i=w1(t);return Tl.exports.merge(e,i)}function w1(r){var t,e,i,s;const a={};if(!oa(r))return a;for(const[u,l]of Object.entries(r)){const d=Zl(u)?[u]:l.chains,f=l.methods||[],w=l.events||[],E=l.rpcMap||{},S=Jo(u);a[S]=O9(Oc(Oc({},a[S]),l),{chains:Fc(d,(t=a[S])==null?void 0:t.chains),methods:Fc(f,(e=a[S])==null?void 0:e.methods),events:Fc(w,(i=a[S])==null?void 0:i.events),rpcMap:Oc(Oc({},E),(s=a[S])==null?void 0:s.rpcMap)})}return a}function R9(r){return r.includes(":")?r.split(":")[2]:r}function b1(r){const t={};for(const[e,i]of Object.entries(r)){const s=i.methods||[],a=i.events||[],u=i.accounts||[],l=Zl(e)?[e]:i.chains?i.chains:Im(i.accounts);t[e]={chains:l,methods:s,events:a,accounts:u}}return t}function sl(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const Dm={},He=r=>Dm[r],ol=(r,t)=>{Dm[r]=t};class T9{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}var F9=Object.defineProperty,U9=Object.defineProperties,B9=Object.getOwnPropertyDescriptors,_1=Object.getOwnPropertySymbols,L9=Object.prototype.hasOwnProperty,q9=Object.prototype.propertyIsEnumerable,E1=(r,t,e)=>t in r?F9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,A1=(r,t)=>{for(var e in t||(t={}))L9.call(t,e)&&E1(r,e,t[e]);if(_1)for(var e of _1(t))q9.call(t,e)&&E1(r,e,t[e]);return r},S1=(r,t)=>U9(r,B9(t));class j9{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const i=e||Yn(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=parseInt(Ns(e));t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}async handleSwitchChain(t){var e,i;let s=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const a=parseInt(s,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:s}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,i,s;const a=(i=(e=t.request)==null?void 0:e.params)==null?void 0:i[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(t.topic),l=((s=u==null?void 0:u.sessionProperties)==null?void 0:s.capabilities)||{};if(l!=null&&l[a])return l==null?void 0:l[a];const d=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:S1(A1({},u.sessionProperties||{}),{capabilities:S1(A1({},l||{}),{[a]:d})})})}catch(f){console.warn("Failed to update session with capabilities",f)}return d}}class $9{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class z9{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class k9{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const i=this.getCardanoRPCUrl(e),s=Ns(e);t[s]=this.createHttpProvider(s,i)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||this.getCardanoRPCUrl(t);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class H9{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class K9{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class V9{constructor(t){this.name="near",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const i=e||Yn(`${this.name}:${t}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,i)}this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;t[e]=this.createHttpProvider(e,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace);return typeof i>"u"?void 0:new Cn(new Jn(i,He("disableProviderPing")))}}var G9=Object.defineProperty,W9=Object.defineProperties,Y9=Object.getOwnPropertyDescriptors,I1=Object.getOwnPropertySymbols,Q9=Object.prototype.hasOwnProperty,J9=Object.prototype.propertyIsEnumerable,D1=(r,t,e)=>t in r?G9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Nc=(r,t)=>{for(var e in t||(t={}))Q9.call(t,e)&&D1(r,e,t[e]);if(I1)for(var e of I1(t))J9.call(t,e)&&D1(r,e,t[e]);return r},al=(r,t)=>W9(r,Y9(t));class uf{constructor(t){this.events=new Ll,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:ya(fu({level:(t==null?void 0:t.logger)||g1})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new uf(t);return await e.initialize(),e}async request(t,e,i){const[s,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Nc({},t),chainId:`${s}:${a}`,topic:this.session.topic,expiry:i})}sendAsync(t,e,i,s){const a=new Date().getTime();this.request(t,i,s).then(u=>e(null,du(a,u))).catch(u=>e(u,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Re("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:e,response:i}=await this.client.authenticate(t);e&&(this.uri=e,this.events.emit("display_uri",e));const s=await i();if(this.session=s.session,this.session){const a=b1(this.session.namespaces);this.namespaces=nl(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let e=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(e>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await s().then(a=>{this.session=a;const u=b1(a.namespaces);this.namespaces=nl(this.namespaces,u),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==Sm)throw a;e++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[i,s]=this.validateChain(t);this.getProvider(i).setDefaultChain(s,e)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(un(e)){for(const i of e)t.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${e.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await cf.init({logger:this.providerOpts.logger||g1,relayUrl:this.providerOpts.relayUrl||E9,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const t=[...new Set(Object.keys(this.session.namespaces).map(e=>Jo(e)))];ol("client",this.client),ol("events",this.events),ol("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const i=N9(e,this.session),s=Im(i),a=nl(this.namespaces,this.optionalNamespaces),u=al(Nc({},a[e]),{accounts:i,chains:s});switch(e){case"eip155":this.rpcProviders[e]=new j9({namespace:u});break;case"solana":this.rpcProviders[e]=new $9({namespace:u});break;case"cosmos":this.rpcProviders[e]=new z9({namespace:u});break;case"polkadot":this.rpcProviders[e]=new T9({namespace:u});break;case"cip34":this.rpcProviders[e]=new k9({namespace:u});break;case"elrond":this.rpcProviders[e]=new H9({namespace:u});break;case"multiversx":this.rpcProviders[e]=new K9({namespace:u});break;case"near":this.rpcProviders[e]=new V9({namespace:u});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:e}=t,{event:i}=e;if(i.name==="accountsChanged"){const s=i.data;s&&un(s)&&this.events.emit("accountsChanged",s.map(R9))}else if(i.name==="chainChanged"){const s=e.chainId,a=e.event.data,u=Jo(s),l=sl(s)!==sl(a)?`${u}:${sl(a)}`:s;this.onChainChanged(l)}else this.events.emit(i.name,i.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var i;const{namespaces:s}=e,a=(i=this.client)==null?void 0:i.session.get(t);this.session=al(Nc({},a),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",al(Nc({},Re("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Pn.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e,optionalNamespaces:i,sessionProperties:s}=t;e&&Object.keys(e).length&&(this.namespaces=e),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=s,this.persist("namespaces",e),this.persist("optionalNamespaces",i)}validateChain(t){const[e,i]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,i];if(e&&!Object.keys(this.namespaces||{}).map(u=>Jo(u)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&i)return[e,i];const s=Jo(Object.keys(this.namespaces)[0]),a=this.rpcProviders[s].getDefaultChain();return[s,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,e=!1){if(!this.namespaces)return;const[i,s]=this.validateChain(t);s&&(e||this.getProvider(i).setDefaultChain(s),this.namespaces[i]?this.namespaces[i].defaultChain=s:this.namespaces[`${i}:${s}`]?this.namespaces[`${i}:${s}`].defaultChain=s:this.namespaces[`${i}:${s}`]={defaultChain:s},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",s))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(t,e){this.client.core.storage.setItem(`${m1}/${t}`,e)}async getFromStore(t){return await this.client.core.storage.getItem(`${m1}/${t}`)}}const X9=uf,Z9="wc",tM="ethereum_provider",eM=`${Z9}@2:${tM}:`,rM="https://rpc.walletconnect.com/v1/",Fl=["eth_sendTransaction","personal_sign"],iM=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],Ul=["chainChanged","accountsChanged"],nM=["chainChanged","accountsChanged","message","disconnect","connect"];var sM=Object.defineProperty,oM=Object.defineProperties,aM=Object.getOwnPropertyDescriptors,x1=Object.getOwnPropertySymbols,cM=Object.prototype.hasOwnProperty,uM=Object.prototype.propertyIsEnumerable,M1=(r,t,e)=>t in r?sM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ro=(r,t)=>{for(var e in t||(t={}))cM.call(t,e)&&M1(r,e,t[e]);if(x1)for(var e of x1(t))uM.call(t,e)&&M1(r,e,t[e]);return r},cl=(r,t)=>oM(r,aM(t));function iu(r){return Number(r[0].split(":")[1])}function Rc(r){return`0x${r.toString(16)}`}function hM(r){const{chains:t,optionalChains:e,methods:i,optionalMethods:s,events:a,optionalEvents:u,rpcMap:l}=r;if(!un(t))throw new Error("Invalid chains");const d={chains:t,methods:i||Fl,events:a||Ul,rpcMap:ro({},t.length?{[iu(t)]:l[iu(t)]}:{})},f=a==null?void 0:a.filter(D=>!Ul.includes(D)),w=i==null?void 0:i.filter(D=>!Fl.includes(D));if(!e&&!u&&!s&&!(f!=null&&f.length)&&!(w!=null&&w.length))return{required:t.length?d:void 0};const E=(f==null?void 0:f.length)&&(w==null?void 0:w.length)||!e,S={chains:[...new Set(E?d.chains.concat(e||[]):e)],methods:[...new Set(d.methods.concat(s!=null&&s.length?s:iM))],events:[...new Set(d.events.concat(u!=null&&u.length?u:nM))],rpcMap:l};return{required:t.length?d:void 0,optional:e.length?S:void 0}}class hf{constructor(){this.events=new Di.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=eM,this.on=(t,e)=>(this.events.on(t,e),this),this.once=(t,e)=>(this.events.once(t,e),this),this.removeListener=(t,e)=>(this.events.removeListener(t,e),this),this.off=(t,e)=>(this.events.off(t,e),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const e=new hf;return await e.initialize(t),e}async request(t,e){return await this.signer.request(t,this.formatChainId(this.chainId),e)}sendAsync(t,e,i){this.signer.sendAsync(t,e,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:e,optional:i}=hM(this.rpc);try{const s=await new Promise(async(u,l)=>{var d;this.rpc.showQrModal&&((d=this.modal)==null||d.subscribeModal(f=>{!f.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),l(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(cl(ro({namespaces:ro({},e&&{[this.namespace]:e})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(f=>{u(f)}).catch(f=>{l(new Error(f.message))})});if(!s)return;const a=Nd(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Rc(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{this.modal&&this.modal.closeModal()}}async authenticate(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t==null?void 0:t.chains});try{const e=await new Promise(async(s,a)=>{var u;this.rpc.showQrModal&&((u=this.modal)==null||u.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(cl(ro({},t),{chains:this.rpc.chains})).then(l=>{s(l)}).catch(l=>{a(new Error(l.message))})}),i=e.session;if(i){const s=Nd(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:Rc(this.chainId)})}return e}catch(e){throw this.signer.logger.error(e),e}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",t=>{const{params:e}=t,{event:i}=e;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const e=parseInt(t);this.chainId=e,this.events.emit("chainChanged",Rc(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",cl(ro({},Re("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var e,i;this.rpc.showQrModal&&((e=this.modal)==null||e.closeModal(),(i=this.modal)==null||i.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const e=t.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));e.length&&(this.chainId=e[0],this.events.emit("chainChanged",Rc(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const e=this.parseChainId(t);this.chainId=e,this.switchEthereumChain(e)}}parseAccountId(t){const[e,i,s]=t.split(":");return{chainId:`${e}:${i}`,address:s}}setAccounts(t){this.accounts=t.filter(e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId).map(e=>this.parseAccountId(e).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var e,i;const s=(e=t==null?void 0:t.chains)!=null?e:[],a=(i=t==null?void 0:t.optionalChains)!=null?i:[],u=s.concat(a);if(!u.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const l=s.length?(t==null?void 0:t.methods)||Fl:[],d=s.length?(t==null?void 0:t.events)||Ul:[],f=(t==null?void 0:t.optionalMethods)||[],w=(t==null?void 0:t.optionalEvents)||[],E=(t==null?void 0:t.rpcMap)||this.buildRpcMap(u,t.projectId),S=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(D=>this.formatChainId(D)),optionalChains:a.map(D=>this.formatChainId(D)),methods:l,events:d,optionalMethods:f,optionalEvents:w,rpcMap:E,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:S,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,e){const i={};return t.forEach(s=>{i[s]=this.getRpcUrl(s,e)}),i}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?iu(this.rpc.chains):iu(this.rpc.optionalChains),this.signer=await X9.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{const{WalletConnectModal:i}=await o6(()=>import("./index-7c221453.js").then(s=>s.i),["assets/index-7c221453.js","assets/index-c3e34aec.js","assets/index-48ae71d8.css"]);e=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(ro({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:e,optionalChains:i,rpcMap:s}=t;e&&un(e)&&(this.rpc.chains=e.map(a=>this.formatChainId(a)),e.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)})),i&&un(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)}))}getRpcUrl(t,e){var i;return((i=this.rpc.rpcMap)==null?void 0:i[t])||`${rM}?chainId=eip155:${t}&projectId=${e||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),e=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:e==null?void 0:e.accounts),this.setAccounts(e==null?void 0:e.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),await this.disconnect().catch(e=>this.signer.logger.warn(e))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(e=>this.parseAccount(e))}}const BM=hf;export{BM as EthereumProvider,nM as OPTIONAL_EVENTS,iM as OPTIONAL_METHODS,Ul as REQUIRED_EVENTS,Fl as REQUIRED_METHODS,hf as default};
|
|
57
|
+
//# sourceMappingURL=index.es-4c3a1f45.js.map
|