waku-lab/buddybook/assets/index-Cu6T4rb4.js
status-im-auto 3fd5f73b75 Updates
2024-11-13 05:22:22 +00:00

8 lines
339 KiB
JavaScript
Raw Blame History

import{E as xo,f as Q,j as Zr,p as ii,q as su,r as ou,h as au}from"./index-uonIXzgQ.js";import{r as Ws,i as vt}from"./inherits_browser-Bb3-ajt6.js";import{p as cu,a as lu}from"./hooks.module-D0gf0yJl.js";import{e as si}from"./events-xQ4utD7e.js";const uu=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:xo,default:xo},Symbol.toStringTag,{value:"Module"}));var ac={},hn={},oi={};Object.defineProperty(oi,"__esModule",{value:!0});oi.walletLogo=void 0;const hu=(e,t)=>{let r;switch(e){case"standard":return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};oi.walletLogo=hu;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});ai.LINK_API_URL=void 0;ai.LINK_API_URL="https://www.walletlink.org";var q={},Vs={exports:{}};Vs.exports;(function(e){(function(t,r){function n(S,o){if(!S)throw new Error(o||"Assertion failed")}function i(S,o){S.super_=o;var u=function(){};u.prototype=o.prototype,S.prototype=new u,S.prototype.constructor=S}function s(S,o,u){if(s.isBN(S))return S;this.negative=0,this.words=null,this.length=0,this.red=null,S!==null&&((o==="le"||o==="be")&&(u=o,o=10),this._init(S||0,o||10,u||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=Ws.Buffer}catch{}s.isBN=function(o){return o instanceof s?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===s.wordSize&&Array.isArray(o.words)},s.max=function(o,u){return o.cmp(u)>0?o:u},s.min=function(o,u){return o.cmp(u)<0?o:u},s.prototype._init=function(o,u,f){if(typeof o=="number")return this._initNumber(o,u,f);if(typeof o=="object")return this._initArray(o,u,f);u==="hex"&&(u=16),n(u===(u|0)&&u>=2&&u<=36),o=o.toString().replace(/\s+/g,"");var p=0;o[0]==="-"&&(p++,this.negative=1),p<o.length&&(u===16?this._parseHex(o,p,f):(this._parseBase(o,u,p),f==="le"&&this._initArray(this.toArray(),u,f)))},s.prototype._initNumber=function(o,u,f){o<0&&(this.negative=1,o=-o),o<67108864?(this.words=[o&67108863],this.length=1):o<4503599627370496?(this.words=[o&67108863,o/67108864&67108863],this.length=2):(n(o<9007199254740992),this.words=[o&67108863,o/67108864&67108863,1],this.length=3),f==="le"&&this._initArray(this.toArray(),u,f)},s.prototype._initArray=function(o,u,f){if(n(typeof o.length=="number"),o.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(o.length/3),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var v,E,k=0;if(f==="be")for(p=o.length-1,v=0;p>=0;p-=3)E=o[p]|o[p-1]<<8|o[p-2]<<16,this.words[v]|=E<<k&67108863,this.words[v+1]=E>>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);else if(f==="le")for(p=0,v=0;p<o.length;p+=3)E=o[p]|o[p+1]<<8|o[p+2]<<16,this.words[v]|=E<<k&67108863,this.words[v+1]=E>>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);return this._strip()};function l(S,o){var u=S.charCodeAt(o);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;n(!1,"Invalid character in "+S)}function d(S,o,u){var f=l(S,u);return u-1>=o&&(f|=l(S,u-1)<<4),f}s.prototype._parseHex=function(o,u,f){this.length=Math.ceil((o.length-u)/6),this.words=new Array(this.length);for(var p=0;p<this.length;p++)this.words[p]=0;var v=0,E=0,k;if(f==="be")for(p=o.length-1;p>=u;p-=2)k=d(o,u,p)<<v,this.words[E]|=k&67108863,v>=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8;else{var g=o.length-u;for(p=g%2===0?u+1:u;p<o.length;p+=2)k=d(o,u,p)<<v,this.words[E]|=k&67108863,v>=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8}this._strip()};function h(S,o,u,f){for(var p=0,v=0,E=Math.min(S.length,u),k=o;k<E;k++){var g=S.charCodeAt(k)-48;p*=f,g>=49?v=g-49+10:g>=17?v=g-17+10:v=g,n(g>=0&&v<f,"Invalid character"),p+=v}return p}s.prototype._parseBase=function(o,u,f){this.words=[0],this.length=1;for(var p=0,v=1;v<=67108863;v*=u)p++;p--,v=v/u|0;for(var E=o.length-f,k=E%p,g=Math.min(E,E-k)+f,c=0,w=f;w<g;w+=p)c=h(o,w,w+p,u),this.imuln(v),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(k!==0){var U=1;for(c=h(o,w,o.length,u),w=0;w<k;w++)U*=u;this.imuln(U),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},s.prototype.copy=function(o){o.words=new Array(this.length);for(var u=0;u<this.length;u++)o.words[u]=this.words[u];o.length=this.length,o.negative=this.negative,o.red=this.red};function m(S,o){S.words=o.words,S.length=o.length,S.negative=o.negative,S.red=o.red}if(s.prototype._move=function(o){m(o,this)},s.prototype.clone=function(){var o=new s(null);return this.copy(o),o},s.prototype._expand=function(o){for(;this.length<o;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=R}catch{s.prototype.inspect=R}else s.prototype.inspect=R;function R(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var y=["","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"],C=[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],x=[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];s.prototype.toString=function(o,u){o=o||10,u=u|0||1;var f;if(o===16||o==="hex"){f="";for(var p=0,v=0,E=0;E<this.length;E++){var k=this.words[E],g=((k<<p|v)&16777215).toString(16);v=k>>>24-p&16777215,p+=2,p>=26&&(p-=26,E--),v!==0||E!==this.length-1?f=y[6-g.length]+g+f:f=g+f}for(v!==0&&(f=v.toString(16)+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var c=C[o],w=x[o];f="";var U=this.clone();for(U.negative=0;!U.isZero();){var H=U.modrn(w).toString(o);U=U.idivn(w),U.isZero()?f=H+f:f=y[c-H.length]+H+f}for(this.isZero()&&(f="0"+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(o,u){return this.toArrayLike(a,o,u)}),s.prototype.toArray=function(o,u){return this.toArrayLike(Array,o,u)};var B=function(o,u){return o.allocUnsafe?o.allocUnsafe(u):new o(u)};s.prototype.toArrayLike=function(o,u,f){this._strip();var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0");var E=B(o,v),k=u==="le"?"LE":"BE";return this["_toArrayLike"+k](E,p),E},s.prototype._toArrayLikeLE=function(o,u){for(var f=0,p=0,v=0,E=0;v<this.length;v++){var k=this.words[v]<<E|p;o[f++]=k&255,f<o.length&&(o[f++]=k>>8&255),f<o.length&&(o[f++]=k>>16&255),E===6?(f<o.length&&(o[f++]=k>>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f<o.length)for(o[f++]=p;f<o.length;)o[f++]=0},s.prototype._toArrayLikeBE=function(o,u){for(var f=o.length-1,p=0,v=0,E=0;v<this.length;v++){var k=this.words[v]<<E|p;o[f--]=k&255,f>=0&&(o[f--]=k>>8&255),f>=0&&(o[f--]=k>>16&255),E===6?(f>=0&&(o[f--]=k>>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f>=0)for(o[f--]=p;f>=0;)o[f--]=0},Math.clz32?s.prototype._countBits=function(o){return 32-Math.clz32(o)}:s.prototype._countBits=function(o){var u=o,f=0;return u>=4096&&(f+=13,u>>>=13),u>=64&&(f+=7,u>>>=7),u>=8&&(f+=4,u>>>=4),u>=2&&(f+=2,u>>>=2),f+u},s.prototype._zeroBits=function(o){if(o===0)return 26;var u=o,f=0;return u&8191||(f+=13,u>>>=13),u&127||(f+=7,u>>>=7),u&15||(f+=4,u>>>=4),u&3||(f+=2,u>>>=2),u&1||f++,f},s.prototype.bitLength=function(){var o=this.words[this.length-1],u=this._countBits(o);return(this.length-1)*26+u};function O(S){for(var o=new Array(S.bitLength()),u=0;u<o.length;u++){var f=u/26|0,p=u%26;o[u]=S.words[f]>>>p&1}return o}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,u=0;u<this.length;u++){var f=this._zeroBits(this.words[u]);if(o+=f,f!==26)break}return o},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(o){return this.negative!==0?this.abs().inotn(o).iaddn(1):this.clone()},s.prototype.fromTwos=function(o){return this.testn(o-1)?this.notn(o).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(o){for(;this.length<o.length;)this.words[this.length++]=0;for(var u=0;u<o.length;u++)this.words[u]=this.words[u]|o.words[u];return this._strip()},s.prototype.ior=function(o){return n((this.negative|o.negative)===0),this.iuor(o)},s.prototype.or=function(o){return this.length>o.length?this.clone().ior(o):o.clone().ior(this)},s.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},s.prototype.iuand=function(o){var u;this.length>o.length?u=o:u=this;for(var f=0;f<u.length;f++)this.words[f]=this.words[f]&o.words[f];return this.length=u.length,this._strip()},s.prototype.iand=function(o){return n((this.negative|o.negative)===0),this.iuand(o)},s.prototype.and=function(o){return this.length>o.length?this.clone().iand(o):o.clone().iand(this)},s.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},s.prototype.iuxor=function(o){var u,f;this.length>o.length?(u=this,f=o):(u=o,f=this);for(var p=0;p<f.length;p++)this.words[p]=u.words[p]^f.words[p];if(this!==u)for(;p<u.length;p++)this.words[p]=u.words[p];return this.length=u.length,this._strip()},s.prototype.ixor=function(o){return n((this.negative|o.negative)===0),this.iuxor(o)},s.prototype.xor=function(o){return this.length>o.length?this.clone().ixor(o):o.clone().ixor(this)},s.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},s.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var u=Math.ceil(o/26)|0,f=o%26;this._expand(u),f>0&&u--;for(var p=0;p<u;p++)this.words[p]=~this.words[p]&67108863;return f>0&&(this.words[p]=~this.words[p]&67108863>>26-f),this._strip()},s.prototype.notn=function(o){return this.clone().inotn(o)},s.prototype.setn=function(o,u){n(typeof o=="number"&&o>=0);var f=o/26|0,p=o%26;return this._expand(f+1),u?this.words[f]=this.words[f]|1<<p:this.words[f]=this.words[f]&~(1<<p),this._strip()},s.prototype.iadd=function(o){var u;if(this.negative!==0&&o.negative===0)return this.negative=0,u=this.isub(o),this.negative^=1,this._normSign();if(this.negative===0&&o.negative!==0)return o.negative=0,u=this.isub(o),o.negative=1,u._normSign();var f,p;this.length>o.length?(f=this,p=o):(f=o,p=this);for(var v=0,E=0;E<p.length;E++)u=(f.words[E]|0)+(p.words[E]|0)+v,this.words[E]=u&67108863,v=u>>>26;for(;v!==0&&E<f.length;E++)u=(f.words[E]|0)+v,this.words[E]=u&67108863,v=u>>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;E<f.length;E++)this.words[E]=f.words[E];return this},s.prototype.add=function(o){var u;return o.negative!==0&&this.negative===0?(o.negative=0,u=this.sub(o),o.negative^=1,u):o.negative===0&&this.negative!==0?(this.negative=0,u=o.sub(this),this.negative=1,u):this.length>o.length?this.clone().iadd(o):o.clone().iadd(this)},s.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var u=this.iadd(o);return o.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=o):(p=o,v=this);for(var E=0,k=0;k<v.length;k++)u=(p.words[k]|0)-(v.words[k]|0)+E,E=u>>26,this.words[k]=u&67108863;for(;E!==0&&k<p.length;k++)u=(p.words[k]|0)+E,E=u>>26,this.words[k]=u&67108863;if(E===0&&k<p.length&&p!==this)for(;k<p.length;k++)this.words[k]=p.words[k];return this.length=Math.max(this.length,k),p!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(o){return this.clone().isub(o)};function M(S,o,u){u.negative=o.negative^S.negative;var f=S.length+o.length|0;u.length=f,f=f-1|0;var p=S.words[0]|0,v=o.words[0]|0,E=p*v,k=E&67108863,g=E/67108864|0;u.words[0]=k;for(var c=1;c<f;c++){for(var w=g>>>26,U=g&67108863,H=Math.min(c,o.length-1),V=Math.max(0,c-S.length+1);V<=H;V++){var A=c-V|0;p=S.words[A]|0,v=o.words[V]|0,E=p*v+U,w+=E/67108864|0,U=E&67108863}u.words[c]=U|0,g=w|0}return g!==0?u.words[c]=g|0:u.length--,u._strip()}var T=function(o,u,f){var p=o.words,v=u.words,E=f.words,k=0,g,c,w,U=p[0]|0,H=U&8191,V=U>>>13,A=p[1]|0,I=A&8191,$=A>>>13,K=p[2]|0,G=K&8191,b=K>>>13,_=p[3]|0,P=_&8191,j=_>>>13,ue=p[4]|0,J=ue&8191,Y=ue>>>13,at=p[5]|0,he=at&8191,pe=at>>>13,Ht=p[6]|0,ge=Ht&8191,de=Ht>>>13,xt=p[7]|0,fe=xt&8191,le=xt>>>13,nt=p[8]|0,ce=nt&8191,me=nt>>>13,wr=p[9]|0,ve=wr&8191,be=wr>>>13,_r=v[0]|0,we=_r&8191,_e=_r>>>13,yr=v[1]|0,ye=yr&8191,Ee=yr>>>13,Er=v[2]|0,Se=Er&8191,Re=Er>>>13,Sr=v[3]|0,Me=Sr&8191,ke=Sr>>>13,Rr=v[4]|0,Ce=Rr&8191,Ie=Rr>>>13,Mr=v[5]|0,xe=Mr&8191,Ae=Mr>>>13,kr=v[6]|0,Te=kr&8191,Ne=kr>>>13,Cr=v[7]|0,Le=Cr&8191,Oe=Cr>>>13,Ir=v[8]|0,Pe=Ir&8191,$e=Ir>>>13,xr=v[9]|0,Be=xr&8191,De=xr>>>13;f.negative=o.negative^u.negative,f.length=19,g=Math.imul(H,we),c=Math.imul(H,_e),c=c+Math.imul(V,we)|0,w=Math.imul(V,_e);var Ut=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(I,we),c=Math.imul(I,_e),c=c+Math.imul($,we)|0,w=Math.imul($,_e),g=g+Math.imul(H,ye)|0,c=c+Math.imul(H,Ee)|0,c=c+Math.imul(V,ye)|0,w=w+Math.imul(V,Ee)|0;var Wt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,g=Math.imul(G,we),c=Math.imul(G,_e),c=c+Math.imul(b,we)|0,w=Math.imul(b,_e),g=g+Math.imul(I,ye)|0,c=c+Math.imul(I,Ee)|0,c=c+Math.imul($,ye)|0,w=w+Math.imul($,Ee)|0,g=g+Math.imul(H,Se)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(V,Se)|0,w=w+Math.imul(V,Re)|0;var Vt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,g=Math.imul(P,we),c=Math.imul(P,_e),c=c+Math.imul(j,we)|0,w=Math.imul(j,_e),g=g+Math.imul(G,ye)|0,c=c+Math.imul(G,Ee)|0,c=c+Math.imul(b,ye)|0,w=w+Math.imul(b,Ee)|0,g=g+Math.imul(I,Se)|0,c=c+Math.imul(I,Re)|0,c=c+Math.imul($,Se)|0,w=w+Math.imul($,Re)|0,g=g+Math.imul(H,Me)|0,c=c+Math.imul(H,ke)|0,c=c+Math.imul(V,Me)|0,w=w+Math.imul(V,ke)|0;var zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(zt>>>26)|0,zt&=67108863,g=Math.imul(J,we),c=Math.imul(J,_e),c=c+Math.imul(Y,we)|0,w=Math.imul(Y,_e),g=g+Math.imul(P,ye)|0,c=c+Math.imul(P,Ee)|0,c=c+Math.imul(j,ye)|0,w=w+Math.imul(j,Ee)|0,g=g+Math.imul(G,Se)|0,c=c+Math.imul(G,Re)|0,c=c+Math.imul(b,Se)|0,w=w+Math.imul(b,Re)|0,g=g+Math.imul(I,Me)|0,c=c+Math.imul(I,ke)|0,c=c+Math.imul($,Me)|0,w=w+Math.imul($,ke)|0,g=g+Math.imul(H,Ce)|0,c=c+Math.imul(H,Ie)|0,c=c+Math.imul(V,Ce)|0,w=w+Math.imul(V,Ie)|0;var qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(qt>>>26)|0,qt&=67108863,g=Math.imul(he,we),c=Math.imul(he,_e),c=c+Math.imul(pe,we)|0,w=Math.imul(pe,_e),g=g+Math.imul(J,ye)|0,c=c+Math.imul(J,Ee)|0,c=c+Math.imul(Y,ye)|0,w=w+Math.imul(Y,Ee)|0,g=g+Math.imul(P,Se)|0,c=c+Math.imul(P,Re)|0,c=c+Math.imul(j,Se)|0,w=w+Math.imul(j,Re)|0,g=g+Math.imul(G,Me)|0,c=c+Math.imul(G,ke)|0,c=c+Math.imul(b,Me)|0,w=w+Math.imul(b,ke)|0,g=g+Math.imul(I,Ce)|0,c=c+Math.imul(I,Ie)|0,c=c+Math.imul($,Ce)|0,w=w+Math.imul($,Ie)|0,g=g+Math.imul(H,xe)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(V,xe)|0,w=w+Math.imul(V,Ae)|0;var Jt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(ge,we),c=Math.imul(ge,_e),c=c+Math.imul(de,we)|0,w=Math.imul(de,_e),g=g+Math.imul(he,ye)|0,c=c+Math.imul(he,Ee)|0,c=c+Math.imul(pe,ye)|0,w=w+Math.imul(pe,Ee)|0,g=g+Math.imul(J,Se)|0,c=c+Math.imul(J,Re)|0,c=c+Math.imul(Y,Se)|0,w=w+Math.imul(Y,Re)|0,g=g+Math.imul(P,Me)|0,c=c+Math.imul(P,ke)|0,c=c+Math.imul(j,Me)|0,w=w+Math.imul(j,ke)|0,g=g+Math.imul(G,Ce)|0,c=c+Math.imul(G,Ie)|0,c=c+Math.imul(b,Ce)|0,w=w+Math.imul(b,Ie)|0,g=g+Math.imul(I,xe)|0,c=c+Math.imul(I,Ae)|0,c=c+Math.imul($,xe)|0,w=w+Math.imul($,Ae)|0,g=g+Math.imul(H,Te)|0,c=c+Math.imul(H,Ne)|0,c=c+Math.imul(V,Te)|0,w=w+Math.imul(V,Ne)|0;var Gt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,g=Math.imul(fe,we),c=Math.imul(fe,_e),c=c+Math.imul(le,we)|0,w=Math.imul(le,_e),g=g+Math.imul(ge,ye)|0,c=c+Math.imul(ge,Ee)|0,c=c+Math.imul(de,ye)|0,w=w+Math.imul(de,Ee)|0,g=g+Math.imul(he,Se)|0,c=c+Math.imul(he,Re)|0,c=c+Math.imul(pe,Se)|0,w=w+Math.imul(pe,Re)|0,g=g+Math.imul(J,Me)|0,c=c+Math.imul(J,ke)|0,c=c+Math.imul(Y,Me)|0,w=w+Math.imul(Y,ke)|0,g=g+Math.imul(P,Ce)|0,c=c+Math.imul(P,Ie)|0,c=c+Math.imul(j,Ce)|0,w=w+Math.imul(j,Ie)|0,g=g+Math.imul(G,xe)|0,c=c+Math.imul(G,Ae)|0,c=c+Math.imul(b,xe)|0,w=w+Math.imul(b,Ae)|0,g=g+Math.imul(I,Te)|0,c=c+Math.imul(I,Ne)|0,c=c+Math.imul($,Te)|0,w=w+Math.imul($,Ne)|0,g=g+Math.imul(H,Le)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(V,Le)|0,w=w+Math.imul(V,Oe)|0;var Zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,g=Math.imul(ce,we),c=Math.imul(ce,_e),c=c+Math.imul(me,we)|0,w=Math.imul(me,_e),g=g+Math.imul(fe,ye)|0,c=c+Math.imul(fe,Ee)|0,c=c+Math.imul(le,ye)|0,w=w+Math.imul(le,Ee)|0,g=g+Math.imul(ge,Se)|0,c=c+Math.imul(ge,Re)|0,c=c+Math.imul(de,Se)|0,w=w+Math.imul(de,Re)|0,g=g+Math.imul(he,Me)|0,c=c+Math.imul(he,ke)|0,c=c+Math.imul(pe,Me)|0,w=w+Math.imul(pe,ke)|0,g=g+Math.imul(J,Ce)|0,c=c+Math.imul(J,Ie)|0,c=c+Math.imul(Y,Ce)|0,w=w+Math.imul(Y,Ie)|0,g=g+Math.imul(P,xe)|0,c=c+Math.imul(P,Ae)|0,c=c+Math.imul(j,xe)|0,w=w+Math.imul(j,Ae)|0,g=g+Math.imul(G,Te)|0,c=c+Math.imul(G,Ne)|0,c=c+Math.imul(b,Te)|0,w=w+Math.imul(b,Ne)|0,g=g+Math.imul(I,Le)|0,c=c+Math.imul(I,Oe)|0,c=c+Math.imul($,Le)|0,w=w+Math.imul($,Oe)|0,g=g+Math.imul(H,Pe)|0,c=c+Math.imul(H,$e)|0,c=c+Math.imul(V,Pe)|0,w=w+Math.imul(V,$e)|0;var Kt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(ve,we),c=Math.imul(ve,_e),c=c+Math.imul(be,we)|0,w=Math.imul(be,_e),g=g+Math.imul(ce,ye)|0,c=c+Math.imul(ce,Ee)|0,c=c+Math.imul(me,ye)|0,w=w+Math.imul(me,Ee)|0,g=g+Math.imul(fe,Se)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(le,Se)|0,w=w+Math.imul(le,Re)|0,g=g+Math.imul(ge,Me)|0,c=c+Math.imul(ge,ke)|0,c=c+Math.imul(de,Me)|0,w=w+Math.imul(de,ke)|0,g=g+Math.imul(he,Ce)|0,c=c+Math.imul(he,Ie)|0,c=c+Math.imul(pe,Ce)|0,w=w+Math.imul(pe,Ie)|0,g=g+Math.imul(J,xe)|0,c=c+Math.imul(J,Ae)|0,c=c+Math.imul(Y,xe)|0,w=w+Math.imul(Y,Ae)|0,g=g+Math.imul(P,Te)|0,c=c+Math.imul(P,Ne)|0,c=c+Math.imul(j,Te)|0,w=w+Math.imul(j,Ne)|0,g=g+Math.imul(G,Le)|0,c=c+Math.imul(G,Oe)|0,c=c+Math.imul(b,Le)|0,w=w+Math.imul(b,Oe)|0,g=g+Math.imul(I,Pe)|0,c=c+Math.imul(I,$e)|0,c=c+Math.imul($,Pe)|0,w=w+Math.imul($,$e)|0,g=g+Math.imul(H,Be)|0,c=c+Math.imul(H,De)|0,c=c+Math.imul(V,Be)|0,w=w+Math.imul(V,De)|0;var Qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(ve,ye),c=Math.imul(ve,Ee),c=c+Math.imul(be,ye)|0,w=Math.imul(be,Ee),g=g+Math.imul(ce,Se)|0,c=c+Math.imul(ce,Re)|0,c=c+Math.imul(me,Se)|0,w=w+Math.imul(me,Re)|0,g=g+Math.imul(fe,Me)|0,c=c+Math.imul(fe,ke)|0,c=c+Math.imul(le,Me)|0,w=w+Math.imul(le,ke)|0,g=g+Math.imul(ge,Ce)|0,c=c+Math.imul(ge,Ie)|0,c=c+Math.imul(de,Ce)|0,w=w+Math.imul(de,Ie)|0,g=g+Math.imul(he,xe)|0,c=c+Math.imul(he,Ae)|0,c=c+Math.imul(pe,xe)|0,w=w+Math.imul(pe,Ae)|0,g=g+Math.imul(J,Te)|0,c=c+Math.imul(J,Ne)|0,c=c+Math.imul(Y,Te)|0,w=w+Math.imul(Y,Ne)|0,g=g+Math.imul(P,Le)|0,c=c+Math.imul(P,Oe)|0,c=c+Math.imul(j,Le)|0,w=w+Math.imul(j,Oe)|0,g=g+Math.imul(G,Pe)|0,c=c+Math.imul(G,$e)|0,c=c+Math.imul(b,Pe)|0,w=w+Math.imul(b,$e)|0,g=g+Math.imul(I,Be)|0,c=c+Math.imul(I,De)|0,c=c+Math.imul($,Be)|0,w=w+Math.imul($,De)|0;var Yt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(ve,Se),c=Math.imul(ve,Re),c=c+Math.imul(be,Se)|0,w=Math.imul(be,Re),g=g+Math.imul(ce,Me)|0,c=c+Math.imul(ce,ke)|0,c=c+Math.imul(me,Me)|0,w=w+Math.imul(me,ke)|0,g=g+Math.imul(fe,Ce)|0,c=c+Math.imul(fe,Ie)|0,c=c+Math.imul(le,Ce)|0,w=w+Math.imul(le,Ie)|0,g=g+Math.imul(ge,xe)|0,c=c+Math.imul(ge,Ae)|0,c=c+Math.imul(de,xe)|0,w=w+Math.imul(de,Ae)|0,g=g+Math.imul(he,Te)|0,c=c+Math.imul(he,Ne)|0,c=c+Math.imul(pe,Te)|0,w=w+Math.imul(pe,Ne)|0,g=g+Math.imul(J,Le)|0,c=c+Math.imul(J,Oe)|0,c=c+Math.imul(Y,Le)|0,w=w+Math.imul(Y,Oe)|0,g=g+Math.imul(P,Pe)|0,c=c+Math.imul(P,$e)|0,c=c+Math.imul(j,Pe)|0,w=w+Math.imul(j,$e)|0,g=g+Math.imul(G,Be)|0,c=c+Math.imul(G,De)|0,c=c+Math.imul(b,Be)|0,w=w+Math.imul(b,De)|0;var Xt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,g=Math.imul(ve,Me),c=Math.imul(ve,ke),c=c+Math.imul(be,Me)|0,w=Math.imul(be,ke),g=g+Math.imul(ce,Ce)|0,c=c+Math.imul(ce,Ie)|0,c=c+Math.imul(me,Ce)|0,w=w+Math.imul(me,Ie)|0,g=g+Math.imul(fe,xe)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(le,xe)|0,w=w+Math.imul(le,Ae)|0,g=g+Math.imul(ge,Te)|0,c=c+Math.imul(ge,Ne)|0,c=c+Math.imul(de,Te)|0,w=w+Math.imul(de,Ne)|0,g=g+Math.imul(he,Le)|0,c=c+Math.imul(he,Oe)|0,c=c+Math.imul(pe,Le)|0,w=w+Math.imul(pe,Oe)|0,g=g+Math.imul(J,Pe)|0,c=c+Math.imul(J,$e)|0,c=c+Math.imul(Y,Pe)|0,w=w+Math.imul(Y,$e)|0,g=g+Math.imul(P,Be)|0,c=c+Math.imul(P,De)|0,c=c+Math.imul(j,Be)|0,w=w+Math.imul(j,De)|0;var er=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(er>>>26)|0,er&=67108863,g=Math.imul(ve,Ce),c=Math.imul(ve,Ie),c=c+Math.imul(be,Ce)|0,w=Math.imul(be,Ie),g=g+Math.imul(ce,xe)|0,c=c+Math.imul(ce,Ae)|0,c=c+Math.imul(me,xe)|0,w=w+Math.imul(me,Ae)|0,g=g+Math.imul(fe,Te)|0,c=c+Math.imul(fe,Ne)|0,c=c+Math.imul(le,Te)|0,w=w+Math.imul(le,Ne)|0,g=g+Math.imul(ge,Le)|0,c=c+Math.imul(ge,Oe)|0,c=c+Math.imul(de,Le)|0,w=w+Math.imul(de,Oe)|0,g=g+Math.imul(he,Pe)|0,c=c+Math.imul(he,$e)|0,c=c+Math.imul(pe,Pe)|0,w=w+Math.imul(pe,$e)|0,g=g+Math.imul(J,Be)|0,c=c+Math.imul(J,De)|0,c=c+Math.imul(Y,Be)|0,w=w+Math.imul(Y,De)|0;var tr=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(tr>>>26)|0,tr&=67108863,g=Math.imul(ve,xe),c=Math.imul(ve,Ae),c=c+Math.imul(be,xe)|0,w=Math.imul(be,Ae),g=g+Math.imul(ce,Te)|0,c=c+Math.imul(ce,Ne)|0,c=c+Math.imul(me,Te)|0,w=w+Math.imul(me,Ne)|0,g=g+Math.imul(fe,Le)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(le,Le)|0,w=w+Math.imul(le,Oe)|0,g=g+Math.imul(ge,Pe)|0,c=c+Math.imul(ge,$e)|0,c=c+Math.imul(de,Pe)|0,w=w+Math.imul(de,$e)|0,g=g+Math.imul(he,Be)|0,c=c+Math.imul(he,De)|0,c=c+Math.imul(pe,Be)|0,w=w+Math.imul(pe,De)|0;var rs=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(rs>>>26)|0,rs&=67108863,g=Math.imul(ve,Te),c=Math.imul(ve,Ne),c=c+Math.imul(be,Te)|0,w=Math.imul(be,Ne),g=g+Math.imul(ce,Le)|0,c=c+Math.imul(ce,Oe)|0,c=c+Math.imul(me,Le)|0,w=w+Math.imul(me,Oe)|0,g=g+Math.imul(fe,Pe)|0,c=c+Math.imul(fe,$e)|0,c=c+Math.imul(le,Pe)|0,w=w+Math.imul(le,$e)|0,g=g+Math.imul(ge,Be)|0,c=c+Math.imul(ge,De)|0,c=c+Math.imul(de,Be)|0,w=w+Math.imul(de,De)|0;var ns=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ns>>>26)|0,ns&=67108863,g=Math.imul(ve,Le),c=Math.imul(ve,Oe),c=c+Math.imul(be,Le)|0,w=Math.imul(be,Oe),g=g+Math.imul(ce,Pe)|0,c=c+Math.imul(ce,$e)|0,c=c+Math.imul(me,Pe)|0,w=w+Math.imul(me,$e)|0,g=g+Math.imul(fe,Be)|0,c=c+Math.imul(fe,De)|0,c=c+Math.imul(le,Be)|0,w=w+Math.imul(le,De)|0;var is=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(is>>>26)|0,is&=67108863,g=Math.imul(ve,Pe),c=Math.imul(ve,$e),c=c+Math.imul(be,Pe)|0,w=Math.imul(be,$e),g=g+Math.imul(ce,Be)|0,c=c+Math.imul(ce,De)|0,c=c+Math.imul(me,Be)|0,w=w+Math.imul(me,De)|0;var ss=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ss>>>26)|0,ss&=67108863,g=Math.imul(ve,Be),c=Math.imul(ve,De),c=c+Math.imul(be,Be)|0,w=Math.imul(be,De);var os=(k+g|0)+((c&8191)<<13)|0;return k=(w+(c>>>13)|0)+(os>>>26)|0,os&=67108863,E[0]=Ut,E[1]=Wt,E[2]=Vt,E[3]=zt,E[4]=qt,E[5]=Jt,E[6]=Gt,E[7]=Zt,E[8]=Kt,E[9]=Qt,E[10]=Yt,E[11]=Xt,E[12]=er,E[13]=tr,E[14]=rs,E[15]=ns,E[16]=is,E[17]=ss,E[18]=os,k!==0&&(E[19]=k,f.length++),f};Math.imul||(T=M);function N(S,o,u){u.negative=o.negative^S.negative,u.length=S.length+o.length;for(var f=0,p=0,v=0;v<u.length-1;v++){var E=p;p=0;for(var k=f&67108863,g=Math.min(v,o.length-1),c=Math.max(0,v-S.length+1);c<=g;c++){var w=v-c,U=S.words[w]|0,H=o.words[c]|0,V=U*H,A=V&67108863;E=E+(V/67108864|0)|0,A=A+k|0,k=A&67108863,E=E+(A>>>26)|0,p+=E>>>26,E&=67108863}u.words[v]=k,f=E,E=p}return f!==0?u.words[v]=f:u.length--,u._strip()}function D(S,o,u){return N(S,o,u)}s.prototype.mulTo=function(o,u){var f,p=this.length+o.length;return this.length===10&&o.length===10?f=T(this,o,u):p<63?f=M(this,o,u):p<1024?f=N(this,o,u):f=D(this,o,u),f},s.prototype.mul=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),this.mulTo(o,u)},s.prototype.mulf=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),D(this,o,u)},s.prototype.imul=function(o){return this.clone().mulTo(o,this)},s.prototype.imuln=function(o){var u=o<0;u&&(o=-o),n(typeof o=="number"),n(o<67108864);for(var f=0,p=0;p<this.length;p++){var v=(this.words[p]|0)*o,E=(v&67108863)+(f&67108863);f>>=26,f+=v/67108864|0,f+=E>>>26,this.words[p]=E&67108863}return f!==0&&(this.words[p]=f,this.length++),u?this.ineg():this},s.prototype.muln=function(o){return this.clone().imuln(o)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(o){var u=O(o);if(u.length===0)return new s(1);for(var f=this,p=0;p<u.length&&u[p]===0;p++,f=f.sqr());if(++p<u.length)for(var v=f.sqr();p<u.length;p++,v=v.sqr())u[p]!==0&&(f=f.mul(v));return f},s.prototype.iushln=function(o){n(typeof o=="number"&&o>=0);var u=o%26,f=(o-u)/26,p=67108863>>>26-u<<26-u,v;if(u!==0){var E=0;for(v=0;v<this.length;v++){var k=this.words[v]&p,g=(this.words[v]|0)-k<<u;this.words[v]=g|E,E=k>>>26-u}E&&(this.words[v]=E,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v<f;v++)this.words[v]=0;this.length+=f}return this._strip()},s.prototype.ishln=function(o){return n(this.negative===0),this.iushln(o)},s.prototype.iushrn=function(o,u,f){n(typeof o=="number"&&o>=0);var p;u?p=(u-u%26)/26:p=0;var v=o%26,E=Math.min((o-v)/26,this.length),k=67108863^67108863>>>v<<v,g=f;if(p-=E,p=Math.max(0,p),g){for(var c=0;c<E;c++)g.words[c]=this.words[c];g.length=E}if(E!==0)if(this.length>E)for(this.length-=E,c=0;c<this.length;c++)this.words[c]=this.words[c+E];else this.words[0]=0,this.length=1;var w=0;for(c=this.length-1;c>=0&&(w!==0||c>=p);c--){var U=this.words[c]|0;this.words[c]=w<<26-v|U>>>v,w=U&k}return g&&w!==0&&(g.words[g.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(o,u,f){return n(this.negative===0),this.iushrn(o,u,f)},s.prototype.shln=function(o){return this.clone().ishln(o)},s.prototype.ushln=function(o){return this.clone().iushln(o)},s.prototype.shrn=function(o){return this.clone().ishrn(o)},s.prototype.ushrn=function(o){return this.clone().iushrn(o)},s.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var u=o%26,f=(o-u)/26,p=1<<u;if(this.length<=f)return!1;var v=this.words[f];return!!(v&p)},s.prototype.imaskn=function(o){n(typeof o=="number"&&o>=0);var u=o%26,f=(o-u)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(u!==0&&f++,this.length=Math.min(f,this.length),u!==0){var p=67108863^67108863>>>u<<u;this.words[this.length-1]&=p}return this._strip()},s.prototype.maskn=function(o){return this.clone().imaskn(o)},s.prototype.iaddn=function(o){return n(typeof o=="number"),n(o<67108864),o<0?this.isubn(-o):this.negative!==0?this.length===1&&(this.words[0]|0)<=o?(this.words[0]=o-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(o),this.negative=1,this):this._iaddn(o)},s.prototype._iaddn=function(o){this.words[0]+=o;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},s.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this._strip()},s.prototype.addn=function(o){return this.clone().iaddn(o)},s.prototype.subn=function(o){return this.clone().isubn(o)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(o,u,f){var p=o.length+f,v;this._expand(p);var E,k=0;for(v=0;v<o.length;v++){E=(this.words[v+f]|0)+k;var g=(o.words[v]|0)*u;E-=g&67108863,k=(E>>26)-(g/67108864|0),this.words[v+f]=E&67108863}for(;v<this.length-f;v++)E=(this.words[v+f]|0)+k,k=E>>26,this.words[v+f]=E&67108863;if(k===0)return this._strip();for(n(k===-1),k=0,v=0;v<this.length;v++)E=-(this.words[v]|0)+k,k=E>>26,this.words[v]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(o,u){var f=this.length-o.length,p=this.clone(),v=o,E=v.words[v.length-1]|0,k=this._countBits(E);f=26-k,f!==0&&(v=v.ushln(f),p.iushln(f),E=v.words[v.length-1]|0);var g=p.length-v.length,c;if(u!=="mod"){c=new s(null),c.length=g+1,c.words=new Array(c.length);for(var w=0;w<c.length;w++)c.words[w]=0}var U=p.clone()._ishlnsubmul(v,1,g);U.negative===0&&(p=U,c&&(c.words[g]=1));for(var H=g-1;H>=0;H--){var V=(p.words[v.length+H]|0)*67108864+(p.words[v.length+H-1]|0);for(V=Math.min(V/E|0,67108863),p._ishlnsubmul(v,V,H);p.negative!==0;)V--,p.negative=0,p._ishlnsubmul(v,1,H),p.isZero()||(p.negative^=1);c&&(c.words[H]=V)}return c&&c._strip(),p._strip(),u!=="div"&&f!==0&&p.iushrn(f),{div:c||null,mod:p}},s.prototype.divmod=function(o,u,f){if(n(!o.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,E;return this.negative!==0&&o.negative===0?(E=this.neg().divmod(o,u),u!=="mod"&&(p=E.div.neg()),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.iadd(o)),{div:p,mod:v}):this.negative===0&&o.negative!==0?(E=this.divmod(o.neg(),u),u!=="mod"&&(p=E.div.neg()),{div:p,mod:E.mod}):this.negative&o.negative?(E=this.neg().divmod(o.neg(),u),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.isub(o)),{div:E.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new s(0),mod:this}:o.length===1?u==="div"?{div:this.divn(o.words[0]),mod:null}:u==="mod"?{div:null,mod:new s(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new s(this.modrn(o.words[0]))}:this._wordDiv(o,u)},s.prototype.div=function(o){return this.divmod(o,"div",!1).div},s.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},s.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},s.prototype.divRound=function(o){var u=this.divmod(o);if(u.mod.isZero())return u.div;var f=u.div.negative!==0?u.mod.isub(o):u.mod,p=o.ushrn(1),v=o.andln(1),E=f.cmp(p);return E<0||v===1&&E===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},s.prototype.modrn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=(1<<26)%o,p=0,v=this.length-1;v>=0;v--)p=(f*p+(this.words[v]|0))%o;return u?-p:p},s.prototype.modn=function(o){return this.modrn(o)},s.prototype.idivn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=0,p=this.length-1;p>=0;p--){var v=(this.words[p]|0)+f*67108864;this.words[p]=v/o|0,f=v%o}return this._strip(),u?this.ineg():this},s.prototype.divn=function(o){return this.clone().idivn(o)},s.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=new s(0),k=new s(1),g=0;u.isEven()&&f.isEven();)u.iushrn(1),f.iushrn(1),++g;for(var c=f.clone(),w=u.clone();!u.isZero();){for(var U=0,H=1;!(u.words[0]&H)&&U<26;++U,H<<=1);if(U>0)for(u.iushrn(U);U-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(c),v.isub(w)),p.iushrn(1),v.iushrn(1);for(var V=0,A=1;!(f.words[0]&A)&&V<26;++V,A<<=1);if(V>0)for(f.iushrn(V);V-- >0;)(E.isOdd()||k.isOdd())&&(E.iadd(c),k.isub(w)),E.iushrn(1),k.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(E),v.isub(k)):(f.isub(u),E.isub(p),k.isub(v))}return{a:E,b:k,gcd:f.iushln(g)}},s.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=f.clone();u.cmpn(1)>0&&f.cmpn(1)>0;){for(var k=0,g=1;!(u.words[0]&g)&&k<26;++k,g<<=1);if(k>0)for(u.iushrn(k);k-- >0;)p.isOdd()&&p.iadd(E),p.iushrn(1);for(var c=0,w=1;!(f.words[0]&w)&&c<26;++c,w<<=1);if(c>0)for(f.iushrn(c);c-- >0;)v.isOdd()&&v.iadd(E),v.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(v)):(f.isub(u),v.isub(p))}var U;return u.cmpn(1)===0?U=p:U=v,U.cmpn(0)<0&&U.iadd(o),U},s.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var u=this.clone(),f=o.clone();u.negative=0,f.negative=0;for(var p=0;u.isEven()&&f.isEven();p++)u.iushrn(1),f.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=u.cmp(f);if(v<0){var E=u;u=f,f=E}else if(v===0||f.cmpn(1)===0)break;u.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(o){return this.egcd(o).a.umod(o)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(o){return this.words[0]&o},s.prototype.bincn=function(o){n(typeof o=="number");var u=o%26,f=(o-u)/26,p=1<<u;if(this.length<=f)return this._expand(f+1),this.words[f]|=p,this;for(var v=p,E=f;v!==0&&E<this.length;E++){var k=this.words[E]|0;k+=v,v=k>>>26,k&=67108863,this.words[E]=k}return v!==0&&(this.words[E]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(o){var u=o<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var f;if(this.length>1)f=1;else{u&&(o=-o),n(o<=67108863,"Number is too big");var p=this.words[0]|0;f=p===o?0:p<o?-1:1}return this.negative!==0?-f|0:f},s.prototype.cmp=function(o){if(this.negative!==0&&o.negative===0)return-1;if(this.negative===0&&o.negative!==0)return 1;var u=this.ucmp(o);return this.negative!==0?-u|0:u},s.prototype.ucmp=function(o){if(this.length>o.length)return 1;if(this.length<o.length)return-1;for(var u=0,f=this.length-1;f>=0;f--){var p=this.words[f]|0,v=o.words[f]|0;if(p!==v){p<v?u=-1:p>v&&(u=1);break}}return u},s.prototype.gtn=function(o){return this.cmpn(o)===1},s.prototype.gt=function(o){return this.cmp(o)===1},s.prototype.gten=function(o){return this.cmpn(o)>=0},s.prototype.gte=function(o){return this.cmp(o)>=0},s.prototype.ltn=function(o){return this.cmpn(o)===-1},s.prototype.lt=function(o){return this.cmp(o)===-1},s.prototype.lten=function(o){return this.cmpn(o)<=0},s.prototype.lte=function(o){return this.cmp(o)<=0},s.prototype.eqn=function(o){return this.cmpn(o)===0},s.prototype.eq=function(o){return this.cmp(o)===0},s.red=function(o){return new X(o)},s.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(o){return this.red=o,this},s.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},s.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},s.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},s.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},s.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},s.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},s.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},s.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var L={k256:null,p224:null,p192:null,p25519:null};function F(S,o){this.name=S,this.p=new s(o,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var o=new s(null);return o.words=new Array(Math.ceil(this.n/13)),o},F.prototype.ireduce=function(o){var u=o,f;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),f=u.bitLength();while(f>this.n);var p=f<this.n?-1:u.ucmp(this.p);return p===0?(u.words[0]=0,u.length=1):p>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},F.prototype.split=function(o,u){o.iushrn(this.n,0,u)},F.prototype.imulK=function(o){return o.imul(this.k)};function W(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(W,F),W.prototype.split=function(o,u){for(var f=4194303,p=Math.min(o.length,9),v=0;v<p;v++)u.words[v]=o.words[v];if(u.length=p,o.length<=9){o.words[0]=0,o.length=1;return}var E=o.words[9];for(u.words[u.length++]=E&f,v=10;v<o.length;v++){var k=o.words[v]|0;o.words[v-10]=(k&f)<<4|E>>>22,E=k}E>>>=22,o.words[v-10]=E,E===0&&o.length>10?o.length-=10:o.length-=9},W.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var u=0,f=0;f<o.length;f++){var p=o.words[f]|0;u+=p*977,o.words[f]=u&67108863,u=p*64+(u/67108864|0)}return o.words[o.length-1]===0&&(o.length--,o.words[o.length-1]===0&&o.length--),o};function te(){F.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(te,F);function Z(){F.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(Z,F);function z(){F.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(z,F),z.prototype.imulK=function(o){for(var u=0,f=0;f<o.length;f++){var p=(o.words[f]|0)*19+u,v=p&67108863;p>>>=26,o.words[f]=v,u=p}return u!==0&&(o.words[o.length++]=u),o},s._prime=function(o){if(L[o])return L[o];var u;if(o==="k256")u=new W;else if(o==="p224")u=new te;else if(o==="p192")u=new Z;else if(o==="p25519")u=new z;else throw new Error("Unknown prime "+o);return L[o]=u,u};function X(S){if(typeof S=="string"){var o=s._prime(S);this.m=o.p,this.prime=o}else n(S.gtn(1),"modulus must be greater than 1"),this.m=S,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,u){n((o.negative|u.negative)===0,"red works only with positives"),n(o.red&&o.red===u.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(m(o,o.umod(this.m)._forceRed(this)),o)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,u){this._verify2(o,u);var f=o.add(u);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},X.prototype.iadd=function(o,u){this._verify2(o,u);var f=o.iadd(u);return f.cmp(this.m)>=0&&f.isub(this.m),f},X.prototype.sub=function(o,u){this._verify2(o,u);var f=o.sub(u);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},X.prototype.isub=function(o,u){this._verify2(o,u);var f=o.isub(u);return f.cmpn(0)<0&&f.iadd(this.m),f},X.prototype.shl=function(o,u){return this._verify1(o),this.imod(o.ushln(u))},X.prototype.imul=function(o,u){return this._verify2(o,u),this.imod(o.imul(u))},X.prototype.mul=function(o,u){return this._verify2(o,u),this.imod(o.mul(u))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var u=this.m.andln(3);if(n(u%2===1),u===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(o,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var E=new s(1).toRed(this),k=E.redNeg(),g=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);this.pow(c,g).cmp(k)!==0;)c.redIAdd(k);for(var w=this.pow(c,p),U=this.pow(o,p.addn(1).iushrn(1)),H=this.pow(o,p),V=v;H.cmp(E)!==0;){for(var A=H,I=0;A.cmp(E)!==0;I++)A=A.redSqr();n(I<V);var $=this.pow(w,new s(1).iushln(V-I-1));U=U.redMul($),w=$.redSqr(),H=H.redMul(w),V=I}return U},X.prototype.invm=function(o){var u=o._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},X.prototype.pow=function(o,u){if(u.isZero())return new s(1).toRed(this);if(u.cmpn(1)===0)return o.clone();var f=4,p=new Array(1<<f);p[0]=new s(1).toRed(this),p[1]=o;for(var v=2;v<p.length;v++)p[v]=this.mul(p[v-1],o);var E=p[0],k=0,g=0,c=u.bitLength()%26;for(c===0&&(c=26),v=u.length-1;v>=0;v--){for(var w=u.words[v],U=c-1;U>=0;U--){var H=w>>U&1;if(E!==p[0]&&(E=this.sqr(E)),H===0&&k===0){g=0;continue}k<<=1,k|=H,g++,!(g!==f&&(v!==0||U!==0))&&(E=this.mul(E,p[k]),g=0,k=0)}c=26}return E},X.prototype.convertTo=function(o){var u=o.umod(this.m);return u===o?u.clone():u},X.prototype.convertFrom=function(o){var u=o.clone();return u.red=null,u},s.mont=function(o){return new ne(o)};function ne(S){X.call(this,S),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i(ne,X),ne.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ne.prototype.convertFrom=function(o){var u=this.imod(o.mul(this.rinv));return u.red=null,u},ne.prototype.imul=function(o,u){if(o.isZero()||u.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.mul=function(o,u){if(o.isZero()||u.isZero())return new s(0)._forceRed(this);var f=o.mul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.invm=function(o){var u=this.imod(o._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(e,Q)})(Vs);var ci=Vs.exports,gn={},Nt={};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.errorValues=Nt.standardErrorCodes=void 0;Nt.standardErrorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}};Nt.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var li={},ui={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Nt,r="Unspecified error message.";e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(y,C=r){if(y&&Number.isInteger(y)){const x=y.toString();if(m(t.errorValues,x))return t.errorValues[x].message;if(d(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=n;function i(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||d(y))}e.isValidCode=i;function s(y){var C;if(typeof y=="number")return y;if(a(y))return(C=y.code)!==null&&C!==void 0?C:y.errorCode}e.getErrorCode=s;function a(y){return typeof y=="object"&&y!==null&&(typeof y.code=="number"||typeof y.errorCode=="number")}function l(y,{shouldIncludeStack:C=!1}={}){const x={};if(y&&typeof y=="object"&&!Array.isArray(y)&&m(y,"code")&&i(y.code)){const B=y;x.code=B.code,B.message&&typeof B.message=="string"?(x.message=B.message,m(B,"data")&&(x.data=B.data)):(x.message=n(x.code),x.data={originalError:h(y)})}else x.code=t.standardErrorCodes.rpc.internal,x.message=R(y,"message")?y.message:r,x.data={originalError:h(y)};return C&&(x.stack=R(y,"stack")?y.stack:void 0),x}e.serialize=l;function d(y){return y>=-32099&&y<=-32e3}function h(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function m(y,C){return Object.prototype.hasOwnProperty.call(y,C)}function R(y,C){return typeof y=="object"&&y!==null&&C in y&&typeof y[C]=="string"}})(ui);Object.defineProperty(li,"__esModule",{value:!0});li.standardErrors=void 0;const Ge=Nt,cc=ui;li.standardErrors={rpc:{parse:e=>ct(Ge.standardErrorCodes.rpc.parse,e),invalidRequest:e=>ct(Ge.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>ct(Ge.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>ct(Ge.standardErrorCodes.rpc.methodNotFound,e),internal:e=>ct(Ge.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ct(t,e)},invalidInput:e=>ct(Ge.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>ct(Ge.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>ct(Ge.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>ct(Ge.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>ct(Ge.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>ct(Ge.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Ar(Ge.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>Ar(Ge.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>Ar(Ge.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>Ar(Ge.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>Ar(Ge.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>Ar(Ge.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new hc(t,r,n)}}};function ct(e,t){const[r,n]=lc(t);return new uc(e,r||(0,cc.getMessageFromCode)(e),n)}function Ar(e,t){const[r,n]=lc(t);return new hc(e,r||(0,cc.getMessageFromCode)(e),n)}function lc(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}let uc=class extends Error{constructor(t,r,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=t,n!==void 0&&(this.data=n)}},hc=class extends uc{constructor(t,r,n){if(!du(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,n)}};function du(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}var hi={},Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isErrorResponse=void 0;function fu(e){return e.errorMessage!==void 0}Kr.isErrorResponse=fu;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.LIB_VERSION=void 0;Qr.LIB_VERSION="3.9.3";Object.defineProperty(hi,"__esModule",{value:!0});hi.serializeError=void 0;const pu=Kr,gu=Qr,mu=Nt,vu=ui;function bu(e,t){const r=(0,vu.serialize)(wu(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",gu.LIB_VERSION),n.searchParams.set("code",r.code.toString());const i=_u(r.data,t);return i&&n.searchParams.set("method",i),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}hi.serializeError=bu;function wu(e){return typeof e=="string"?{message:e,code:mu.standardErrorCodes.rpc.internal}:(0,pu.isErrorResponse)(e)?Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}}):e}function _u(e,t){const r=e==null?void 0:e.method;if(r)return r;if(t!==void 0){if(typeof t=="string")return t;if(Array.isArray(t)){if(t.length>0)return t[0].method}else return t.method}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=Nt;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const r=li;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=hi;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const i=ui;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(gn);var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ProviderType=Ve.RegExpString=Ve.IntNumber=Ve.BigIntString=Ve.AddressString=Ve.HexString=Ve.OpaqueType=void 0;function mn(){return e=>e}Ve.OpaqueType=mn;Ve.HexString=mn();Ve.AddressString=mn();Ve.BigIntString=mn();function yu(e){return Math.floor(e)}Ve.IntNumber=yu;Ve.RegExpString=mn();var Ao;(function(e){e.CoinbaseWallet="CoinbaseWallet",e.MetaMask="MetaMask",e.Unselected=""})(Ao||(Ve.ProviderType=Ao={}));var Eu=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(q,"__esModule",{value:!0});q.isMobileWeb=q.getLocation=q.isInIFrame=q.createQrUrl=q.getFavicon=q.range=q.isBigNumber=q.ensureParsedJSONObject=q.ensureBN=q.ensureRegExpString=q.ensureIntNumber=q.ensureBuffer=q.ensureAddressString=q.ensureEvenLengthHexString=q.ensureHexString=q.isHexString=q.prepend0x=q.strip0x=q.has0xPrefix=q.hexStringFromIntNumber=q.intNumberFromHexString=q.bigIntStringFromBN=q.hexStringFromBuffer=q.hexStringToUint8Array=q.uint8ArrayToHex=q.randomBytesHex=void 0;const $t=Eu(ci),pr=gn,dt=Ve,dc=/^[0-9]*$/,fc=/^[a-f0-9]*$/;function Su(e){return pc(crypto.getRandomValues(new Uint8Array(e)))}q.randomBytesHex=Su;function pc(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}q.uint8ArrayToHex=pc;function Ru(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}q.hexStringToUint8Array=Ru;function Mu(e,t=!1){const r=e.toString("hex");return(0,dt.HexString)(t?`0x${r}`:r)}q.hexStringFromBuffer=Mu;function ku(e){return(0,dt.BigIntString)(e.toString(10))}q.bigIntStringFromBN=ku;function Cu(e){return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}q.intNumberFromHexString=Cu;function Iu(e){return(0,dt.HexString)(`0x${new $t.default(e).toString(16)}`)}q.hexStringFromIntNumber=Iu;function zs(e){return e.startsWith("0x")||e.startsWith("0X")}q.has0xPrefix=zs;function di(e){return zs(e)?e.slice(2):e}q.strip0x=di;function gc(e){return zs(e)?`0x${e.slice(2)}`:`0x${e}`}q.prepend0x=gc;function vn(e){if(typeof e!="string")return!1;const t=di(e).toLowerCase();return fc.test(t)}q.isHexString=vn;function mc(e,t=!1){if(typeof e=="string"){const r=di(e).toLowerCase();if(fc.test(r))return(0,dt.HexString)(t?`0x${r}`:r)}throw pr.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}q.ensureHexString=mc;function bn(e,t=!1){let r=mc(e,!1);return r.length%2===1&&(r=(0,dt.HexString)(`0${r}`)),t?(0,dt.HexString)(`0x${r}`):r}q.ensureEvenLengthHexString=bn;function xu(e){if(typeof e=="string"){const t=di(e).toLowerCase();if(vn(t)&&t.length===40)return(0,dt.AddressString)(gc(t))}throw pr.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}q.ensureAddressString=xu;function Au(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(vn(e)){const t=bn(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw pr.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)}q.ensureBuffer=Au;function vc(e){if(typeof e=="number"&&Number.isInteger(e))return(0,dt.IntNumber)(e);if(typeof e=="string"){if(dc.test(e))return(0,dt.IntNumber)(Number(e));if(vn(e))return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureIntNumber=vc;function Tu(e){if(e instanceof RegExp)return(0,dt.RegExpString)(e.toString());throw pr.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)}q.ensureRegExpString=Tu;function Nu(e){if(e!==null&&($t.default.isBN(e)||bc(e)))return new $t.default(e.toString(10),10);if(typeof e=="number")return new $t.default(vc(e));if(typeof e=="string"){if(dc.test(e))return new $t.default(e,10);if(vn(e))return new $t.default(bn(e,!1),16)}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureBN=Nu;function Lu(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw pr.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}q.ensureParsedJSONObject=Lu;function bc(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}q.isBigNumber=bc;function Ou(e,t){return Array.from({length:t-e},(r,n)=>e+n)}q.range=Ou;function Pu(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`}q.getFavicon=Pu;function $u(e,t,r,n,i,s){const a=n?"parent-id":"id",l=new URLSearchParams({[a]:e,secret:t,server:r,v:i,chainId:s.toString()}).toString();return`${r}/#/link?${l}`}q.createQrUrl=$u;function wc(){try{return window.frameElement!==null}catch{return!1}}q.isInIFrame=wc;function Bu(){try{return wc()&&window.top?window.top.location:window.location}catch{return window.location}}q.getLocation=Bu;function Du(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}q.isMobileWeb=Du;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});fi.ScopedLocalStorage=void 0;class Fu{constructor(t){this.scope=t}setItem(t,r){localStorage.setItem(this.scopedKey(t),r)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),r=[];for(let n=0;n<localStorage.length;n++){const i=localStorage.key(n);typeof i=="string"&&i.startsWith(t)&&r.push(i)}r.forEach(n=>localStorage.removeItem(n))}scopedKey(t){return`${this.scope}:${t}`}}fi.ScopedLocalStorage=Fu;var Ur={};const ju=Zr(uu);var wn={},_n={},Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.EVENTS=void 0;Yr.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.RelayAbstract=ht.APP_VERSION_KEY=ht.LOCAL_STORAGE_ADDRESSES_KEY=ht.WALLET_USER_NAME_KEY=void 0;const To=gn;ht.WALLET_USER_NAME_KEY="walletUsername";ht.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";ht.APP_VERSION_KEY="AppVersion";class Hu{async makeEthereumJSONRPCRequest(t,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw To.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,To.serializeError)(s,t.method);return i})}}ht.RelayAbstract=Hu;var Xr={},_c={exports:{}},Ps={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(e,t){var r=ii,n=r.Buffer;function i(a,l){for(var d in a)l[d]=a[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(a,l,d){return n(a,l,d)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,l,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,l,d)},s.alloc=function(a,l,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var h=n(a);return l!==void 0?typeof d=="string"?h.fill(l,d):h.fill(l):h.fill(0),h},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}})(Ps,Ps.exports);var jt=Ps.exports,yc=jt.Buffer;function pi(e,t){this._block=yc.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}pi.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=yc.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,a=0;a<i;){for(var l=s%n,d=Math.min(i-a,n-l),h=0;h<d;h++)r[l+h]=e[a+h];s+=d,a+=d,s%n===0&&this._update(r)}return this._len+=i,this};pi.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s};pi.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var en=pi,Uu=vt,Ec=en,Wu=jt.Buffer,Vu=[1518500249,1859775393,-1894007588,-899497514],zu=new Array(80);function yn(){this.init(),this._w=zu,Ec.call(this,64,56)}Uu(yn,Ec);yn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function qu(e){return e<<5|e>>>27}function Ju(e){return e<<30|e>>>2}function Gu(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}yn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var d=0;d<80;++d){var h=~~(d/20),m=qu(r)+Gu(h,n,i,s)+a+t[d]+Vu[h]|0;a=s,s=i,i=Ju(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};yn.prototype._hash=function(){var e=Wu.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Zu=yn,Ku=vt,Sc=en,Qu=jt.Buffer,Yu=[1518500249,1859775393,-1894007588,-899497514],Xu=new Array(80);function En(){this.init(),this._w=Xu,Sc.call(this,64,56)}Ku(En,Sc);En.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function eh(e){return e<<1|e>>>31}function th(e){return e<<5|e>>>27}function rh(e){return e<<30|e>>>2}function nh(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}En.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=eh(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var d=0;d<80;++d){var h=~~(d/20),m=th(r)+nh(h,n,i,s)+a+t[d]+Yu[h]|0;a=s,s=i,i=rh(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};En.prototype._hash=function(){var e=Qu.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var ih=En,sh=vt,Rc=en,oh=jt.Buffer,ah=[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],ch=new Array(64);function Sn(){this.init(),this._w=ch,Rc.call(this,64,56)}sh(Sn,Rc);Sn.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function lh(e,t,r){return r^e&(t^r)}function uh(e,t,r){return e&t|r&(e|t)}function hh(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function dh(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function fh(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function ph(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Sn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=this._f|0,d=this._g|0,h=this._h|0,m=0;m<16;++m)t[m]=e.readInt32BE(m*4);for(;m<64;++m)t[m]=ph(t[m-2])+t[m-7]+fh(t[m-15])+t[m-16]|0;for(var R=0;R<64;++R){var y=h+dh(a)+lh(a,l,d)+ah[R]+t[R]|0,C=hh(r)+uh(r,n,i)|0;h=d,d=l,l=a,a=s+y|0,s=i,i=n,n=r,r=y+C|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=l+this._f|0,this._g=d+this._g|0,this._h=h+this._h|0};Sn.prototype._hash=function(){var e=oh.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var Mc=Sn,gh=vt,mh=Mc,vh=en,bh=jt.Buffer,wh=new Array(64);function gi(){this.init(),this._w=wh,vh.call(this,64,56)}gh(gi,mh);gi.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};gi.prototype._hash=function(){var e=bh.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var _h=gi,yh=vt,kc=en,Eh=jt.Buffer,No=[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],Sh=new Array(160);function Rn(){this.init(),this._w=Sh,kc.call(this,128,112)}yh(Rn,kc);Rn.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Lo(e,t,r){return r^e&(t^r)}function Oo(e,t,r){return e&t|r&(e|t)}function Po(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function $o(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Rh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Mh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function kh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Ch(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function qe(e,t){return e>>>0<t>>>0?1:0}Rn.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,a=this._eh|0,l=this._fh|0,d=this._gh|0,h=this._hh|0,m=this._al|0,R=this._bl|0,y=this._cl|0,C=this._dl|0,x=this._el|0,B=this._fl|0,O=this._gl|0,M=this._hl|0,T=0;T<32;T+=2)t[T]=e.readInt32BE(T*4),t[T+1]=e.readInt32BE(T*4+4);for(;T<160;T+=2){var N=t[T-30],D=t[T-15*2+1],L=Rh(N,D),F=Mh(D,N);N=t[T-2*2],D=t[T-2*2+1];var W=kh(N,D),te=Ch(D,N),Z=t[T-7*2],z=t[T-7*2+1],X=t[T-16*2],ne=t[T-16*2+1],S=F+z|0,o=L+Z+qe(S,F)|0;S=S+te|0,o=o+W+qe(S,te)|0,S=S+ne|0,o=o+X+qe(S,ne)|0,t[T]=o,t[T+1]=S}for(var u=0;u<160;u+=2){o=t[u],S=t[u+1];var f=Oo(r,n,i),p=Oo(m,R,y),v=Po(r,m),E=Po(m,r),k=$o(a,x),g=$o(x,a),c=No[u],w=No[u+1],U=Lo(a,l,d),H=Lo(x,B,O),V=M+g|0,A=h+k+qe(V,M)|0;V=V+H|0,A=A+U+qe(V,H)|0,V=V+w|0,A=A+c+qe(V,w)|0,V=V+S|0,A=A+o+qe(V,S)|0;var I=E+p|0,$=v+f+qe(I,E)|0;h=d,M=O,d=l,O=B,l=a,B=x,x=C+V|0,a=s+A+qe(x,C)|0,s=i,C=y,i=n,y=R,n=r,R=m,m=V+I|0,r=A+$+qe(m,V)|0}this._al=this._al+m|0,this._bl=this._bl+R|0,this._cl=this._cl+y|0,this._dl=this._dl+C|0,this._el=this._el+x|0,this._fl=this._fl+B|0,this._gl=this._gl+O|0,this._hl=this._hl+M|0,this._ah=this._ah+r+qe(this._al,m)|0,this._bh=this._bh+n+qe(this._bl,R)|0,this._ch=this._ch+i+qe(this._cl,y)|0,this._dh=this._dh+s+qe(this._dl,C)|0,this._eh=this._eh+a+qe(this._el,x)|0,this._fh=this._fh+l+qe(this._fl,B)|0,this._gh=this._gh+d+qe(this._gl,O)|0,this._hh=this._hh+h+qe(this._hl,M)|0};Rn.prototype._hash=function(){var e=Eh.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Cc=Rn,Ih=vt,xh=Cc,Ah=en,Th=jt.Buffer,Nh=new Array(160);function mi(){this.init(),this._w=Nh,Ah.call(this,128,112)}Ih(mi,xh);mi.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};mi.prototype._hash=function(){var e=Th.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Lh=mi,gr=_c.exports=function(t){t=t.toLowerCase();var r=gr[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};gr.sha=Zu;gr.sha1=ih;gr.sha224=_h;gr.sha256=Mc;gr.sha384=Lh;gr.sha512=Cc;var Oh=_c.exports;Object.defineProperty(Xr,"__esModule",{value:!0});Xr.Session=void 0;const Bo=Oh,Do=q,Fo="session:id",jo="session:secret",Ho="session:linked";class qs{constructor(t,r,n,i){this._storage=t,this._id=r||(0,Do.randomBytesHex)(16),this._secret=n||(0,Do.randomBytesHex)(32),this._key=new Bo.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(t){const r=t.getItem(Fo),n=t.getItem(Ho),i=t.getItem(jo);return r&&i?new qs(t,r,i,n==="1"):null}static hash(t){return new Bo.sha256().update(t).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this._storage.setItem(Fo,this._id),this._storage.setItem(jo,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Ho,this._linked?"1":"0")}}Xr.Session=qs;var vi={},bi={};Object.defineProperty(bi,"__esModule",{value:!0});bi.Cipher=void 0;const jn=q;class Ph{constructor(t){this.secret=t}async encrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(t)),l=16,d=a.slice(a.byteLength-l),h=a.slice(0,a.byteLength-l),m=new Uint8Array(d),R=new Uint8Array(h),y=new Uint8Array([...n,...m,...R]);return(0,jn.uint8ArrayToHex)(y)}async decrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,jn.hexStringToUint8Array)(t),l=a.slice(0,12),d=a.slice(12,28),h=a.slice(28),m=new Uint8Array([...h,...d]),R={name:"AES-GCM",iv:new Uint8Array(l)};try{const y=await window.crypto.subtle.decrypt(R,s,m),C=new TextDecoder;n(C.decode(y))}catch(y){i(y)}})()})}}bi.Cipher=Ph;var wi={};Object.defineProperty(wi,"__esModule",{value:!0});wi.WalletLinkHTTP=void 0;class $h{constructor(t,r,n){this.linkAPIUrl=t,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var t;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}wi.WalletLinkHTTP=$h;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.WalletLinkWebSocket=Wr.ConnectionState=void 0;var Br;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(Br||(Wr.ConnectionState=Br={}));class Bh{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=t.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((t,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Br.CONNECTING),i.onclose=s=>{var a;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.DISCONNECTED)},i.onopen=s=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(d=>this.sendData(d)),this.pendingData=[])},i.onmessage=s=>{var a,l;if(s.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const d=JSON.parse(s.data);(l=this.incomingDataListener)===null||l===void 0||l.call(this,d)}catch{}}})}disconnect(){var t;const{webSocket:r}=this;if(r){this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,Br.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(t){const{webSocket:r}=this;if(!r){this.pendingData.push(t),this.connect();return}r.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}}Wr.WalletLinkWebSocket=Bh;Object.defineProperty(vi,"__esModule",{value:!0});vi.WalletLinkConnection=void 0;const Tr=Ve,Dh=bi,_t=Yr,Uo=ht,Nr=Xr,Fh=wi,Hn=Wr,Wo=1e4,jh=6e4;class Hh{constructor({session:t,linkAPIUrl:r,listener:n,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,Tr.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=l=>{if(!l)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",h=>l.JsonRpcUrl&&this.handleChainUpdated(h,l.JsonRpcUrl)]]).forEach((h,m)=>{const R=l[m];R!==void 0&&h(R)})},this.handleDestroyed=l=>{var d,h;l==="1"&&((d=this.listener)===null||d===void 0||d.resetAndReload(),(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:Nr.Session.hash(this.session.id)}))},this.handleAccountUpdated=async l=>{var d,h;try{const m=await this.cipher.decrypt(l);(d=this.listener)===null||d===void 0||d.accountUpdated(m)}catch{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.metadataUpdated(l,R)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:l})}},this.handleWalletUsernameUpdated=async l=>{this.handleMetadataUpdated(Uo.WALLET_USER_NAME_KEY,l)},this.handleAppVersionUpdated=async l=>{this.handleMetadataUpdated(Uo.APP_VERSION_KEY,l)},this.handleChainUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(l),y=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.chainUpdated(R,y)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=t,this.cipher=new Dh.Cipher(t.secret),this.diagnostic=i,this.listener=n;const a=new Hn.WalletLinkWebSocket(`${r}/rpc`,s);a.setConnectionStateListener(async l=>{var d;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.CONNECTED_STATE_CHANGE,{state:l,sessionIdHash:Nr.Session.hash(t.id)});let h=!1;switch(l){case Hn.ConnectionState.DISCONNECTED:if(!this.destroyed){const m=async()=>{await new Promise(R=>setTimeout(R,5e3)),this.destroyed||a.connect().catch(()=>{m()})};m()}break;case Hn.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),h=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Wo),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Hn.ConnectionState.CONNECTING:break}this.connected!==h&&(this.connected=h)}),a.setIncomingDataListener(l=>{var d,h,m;switch(l.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const R=l.type==="IsLinkedOK"?l.linked:void 0;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.LINKED,{sessionIdHash:Nr.Session.hash(t.id),linked:R,type:l.type,onlineGuests:l.onlineGuests}),this.linked=R||l.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:Nr.Session.hash(t.id),metadata_keys:l&&l.metadata?Object.keys(l.metadata):void 0}),this.handleSessionMetadataUpdated(l.metadata);break}case"Event":{this.handleIncomingEvent(l);break}}l.id!==void 0&&((m=this.requestResolutions.get(l.id))===null||m===void 0||m(l))}),this.ws=a,this.http=new Fh.WalletLinkHTTP(r,t.id,t.key)}connect(){var t;if(this.destroyed)throw new Error("instance is destroyed");(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.STARTED_CONNECTING,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var t;this.destroyed=!0,this.ws.disconnect(),(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.DISCONNECTED,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(t){var r,n;this._connected=t,t&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(t)}setOnceConnected(t){return new Promise(r=>{this.connected?t().then(r):this.onceConnected=()=>{t().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(t){var r,n;this._linked=t,t&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(t)}setOnceLinked(t){return new Promise(r=>{this.linked?t().then(r):this.onceLinked=()=>{t().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(t){var r,n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const i=await this.cipher.decrypt(t.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s)}catch{(n=this.diagnostic)===null||n===void 0||n.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(t,r){const n={type:"SetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[t]:r}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(n);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(t,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(s);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Wo*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(t,r=jh){const n=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},r)}),new Promise(s=>{this.requestResolutions.set(n,a=>{clearTimeout(i),s(a),this.requestResolutions.delete(n)})})])}async authenticate(){const t={type:"HostSession",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(t);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const t={type:"IsLinked",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}sendGetSessionConfig(){const t={type:"GetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}}vi.WalletLinkConnection=Hh;var Mn={},kn={},Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var Uh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kn,"__esModule",{value:!0});kn.injectCssReset=void 0;const Wh=Uh(Js);function Vh(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Wh.default)),document.documentElement.appendChild(e)}kn.injectCssReset=Vh;var _i={};const tt=Zr(cu);var yi={};function Ic(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Ic(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Vo(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Ic(e))&&(n&&(n+=" "),n+=t);return n}const zh=Object.freeze(Object.defineProperty({__proto__:null,clsx:Vo,default:Vo},Symbol.toStringTag,{value:"Module"})),Cn=Zr(zh),Ei=Zr(lu);var Vr={},Si={};Object.defineProperty(Si,"__esModule",{value:!0});Si.CloseIcon=void 0;const zo=tt;function qh(e){return(0,zo.h)("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),(0,zo.h)("path",{d:"M13.7677 13L12.3535 14.4142L18.3535 20.4142L12.3535 26.4142L13.7677 27.8284L19.7677 21.8284L25.7677 27.8284L27.1819 26.4142L21.1819 20.4142L27.1819 14.4142L25.7677 13L19.7677 19L13.7677 13Z"}))}Si.CloseIcon=qh;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.CoinbaseWalletRound=void 0;const Un=tt;function Jh(e){return(0,Un.h)("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),(0,Un.h)("circle",{cx:"14",cy:"14",r:"14",fill:"#0052FF"}),(0,Un.h)("path",{d:"M23.8521 14.0003C23.8521 19.455 19.455 23.8521 14.0003 23.8521C8.54559 23.8521 4.14844 19.455 4.14844 14.0003C4.14844 8.54559 8.54559 4.14844 14.0003 4.14844C19.455 4.14844 23.8521 8.54559 23.8521 14.0003Z",fill:"white"}),(0,Un.h)("path",{d:"M11.1855 12.5042C11.1855 12.0477 11.1855 11.7942 11.2835 11.642C11.3814 11.4899 11.4793 11.3377 11.6261 11.287C11.8219 11.1855 12.0178 11.1855 12.5073 11.1855H15.4934C15.983 11.1855 16.1788 11.1855 16.3746 11.287C16.5215 11.3884 16.6683 11.4899 16.7173 11.642C16.8152 11.8449 16.8152 12.0477 16.8152 12.5042V15.4965C16.8152 15.953 16.8152 16.2066 16.7173 16.3587C16.6194 16.5109 16.5215 16.663 16.3746 16.7137C16.1788 16.8152 15.983 16.8152 15.4934 16.8152H12.5073C12.0178 16.8152 11.8219 16.8152 11.6261 16.7137C11.4793 16.6123 11.3324 16.5109 11.2835 16.3587C11.1855 16.1558 11.1855 15.953 11.1855 15.4965V12.5042Z",fill:"#0052FF"}))}Ri.CoinbaseWalletRound=Jh;var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.QRCodeIcon=void 0;const on=tt;function Gh(e){return(0,on.h)("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),(0,on.h)("path",{d:"M3 3V8.99939L5 8.99996V5H9V3H3Z"}),(0,on.h)("path",{d:"M15 21L21 21V15.0006L19 15V19L15 19V21Z"}),(0,on.h)("path",{d:"M21 9H19V5H15.0006L15 3H21V9Z"}),(0,on.h)("path",{d:"M3 15V21H8.99939L8.99996 19H5L5 15H3Z"}))}Mi.QRCodeIcon=Gh;var ki={};function xc(e){this.mode=st.MODE_8BIT_BYTE,this.data=e,this.parsedData=[];for(var t=0,r=this.data.length;t<r;t++){var n=[],i=this.data.charCodeAt(t);i>65536?(n[0]=240|(i&1835008)>>>18,n[1]=128|(i&258048)>>>12,n[2]=128|(i&4032)>>>6,n[3]=128|i&63):i>2048?(n[0]=224|(i&61440)>>>12,n[1]=128|(i&4032)>>>6,n[2]=128|i&63):i>128?(n[0]=192|(i&1984)>>>6,n[1]=128|i&63):n[0]=i,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}xc.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t<r;t++)e.put(this.parsedData[t],8)}};function kt(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}kt.prototype={addData:function(e){var t=new xc(e);this.dataList.push(t),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[r][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=kt.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[e+r][t+n]=!0:this.modules[e+r][t+n]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=je.getLostPoint(this);(r==0||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r),i=1;this.make();for(var s=0;s<this.modules.length;s++)for(var a=s*i,l=0;l<this.modules[s].length;l++){var d=l*i,h=this.modules[s][l];h&&(n.beginFill(0,100),n.moveTo(d,a),n.lineTo(d+i,a),n.lineTo(d+i,a+i),n.lineTo(d,a+i),n.endFill())}return n},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]==null&&(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)},setupPositionAdjustPattern:function(){for(var e=je.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var n=e[t],i=e[r];if(this.modules[n][i]==null)for(var s=-2;s<=2;s++)for(var a=-2;a<=2;a++)s==-2||s==2||a==-2||a==2||s==0&&a==0?this.modules[n+s][i+a]=!0:this.modules[n+s][i+a]=!1}},setupTypeNumber:function(e){for(var t=je.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var n=!e&&(t>>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!e&&(t>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=je.getBCHTypeInfo(r),i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,s=0,a=this.moduleCount-1;a>0;a-=2)for(a==6&&a--;;){for(var l=0;l<2;l++)if(this.modules[n][a-l]==null){var d=!1;s<e.length&&(d=(e[s]>>>i&1)==1);var h=je.getMask(t,n,a-l);h&&(d=!d),this.modules[n][a-l]=d,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};kt.PAD0=236;kt.PAD1=17;kt.createData=function(e,t,r){for(var n=Mt.getRSBlocks(e,t),i=new Ac,s=0;s<r.length;s++){var a=r[s];i.put(a.mode,4),i.put(a.getLength(),je.getLengthInBits(a.mode,e)),a.write(i)}for(var l=0,s=0;s<n.length;s++)l+=n[s].dataCount;if(i.getLengthInBits()>l*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+l*8+")");for(i.getLengthInBits()+4<=l*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=l*8||(i.put(kt.PAD0,8),i.getLengthInBits()>=l*8));)i.put(kt.PAD1,8);return kt.createBytes(i,n)};kt.createBytes=function(e,t){for(var r=0,n=0,i=0,s=new Array(t.length),a=new Array(t.length),l=0;l<t.length;l++){var d=t[l].dataCount,h=t[l].totalCount-d;n=Math.max(n,d),i=Math.max(i,h),s[l]=new Array(d);for(var m=0;m<s[l].length;m++)s[l][m]=255&e.buffer[m+r];r+=d;var R=je.getErrorCorrectPolynomial(h),y=new Dr(s[l],R.getLength()-1),C=y.mod(R);a[l]=new Array(R.getLength()-1);for(var m=0;m<a[l].length;m++){var x=m+C.getLength()-a[l].length;a[l][m]=x>=0?C.get(x):0}}for(var B=0,m=0;m<t.length;m++)B+=t[m].totalCount;for(var O=new Array(B),M=0,m=0;m<n;m++)for(var l=0;l<t.length;l++)m<s[l].length&&(O[M++]=s[l][m]);for(var m=0;m<i;m++)for(var l=0;l<t.length;l++)m<a[l].length&&(O[M++]=a[l][m]);return O};var st={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Bt={L:1,M:0,Q:3,H:2},Ot={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},je={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;je.getBCHDigit(t)-je.getBCHDigit(je.G15)>=0;)t^=je.G15<<je.getBCHDigit(t)-je.getBCHDigit(je.G15);return(e<<10|t)^je.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;je.getBCHDigit(t)-je.getBCHDigit(je.G18)>=0;)t^=je.G18<<je.getBCHDigit(t)-je.getBCHDigit(je.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;e!=0;)t++,e>>>=1;return t},getPatternPosition:function(e){return je.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case Ot.PATTERN000:return(t+r)%2==0;case Ot.PATTERN001:return t%2==0;case Ot.PATTERN010:return r%3==0;case Ot.PATTERN011:return(t+r)%3==0;case Ot.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case Ot.PATTERN101:return t*r%2+t*r%3==0;case Ot.PATTERN110:return(t*r%2+t*r%3)%2==0;case Ot.PATTERN111:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new Dr([1],0),r=0;r<e;r++)t=t.multiply(new Dr([1,Je.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case st.MODE_NUMBER:return 10;case st.MODE_ALPHA_NUM:return 9;case st.MODE_8BIT_BYTE:return 8;case st.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case st.MODE_NUMBER:return 12;case st.MODE_ALPHA_NUM:return 11;case st.MODE_8BIT_BYTE:return 16;case st.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else if(t<41)switch(e){case st.MODE_NUMBER:return 14;case st.MODE_ALPHA_NUM:return 13;case st.MODE_8BIT_BYTE:return 16;case st.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}else throw new Error("type:"+t)},getLostPoint:function(e){for(var t=e.getModuleCount(),r=0,n=0;n<t;n++)for(var i=0;i<t;i++){for(var s=0,a=e.isDark(n,i),l=-1;l<=1;l++)if(!(n+l<0||t<=n+l))for(var d=-1;d<=1;d++)i+d<0||t<=i+d||l==0&&d==0||a==e.isDark(n+l,i+d)&&s++;s>5&&(r+=3+s-5)}for(var n=0;n<t-1;n++)for(var i=0;i<t-1;i++){var h=0;e.isDark(n,i)&&h++,e.isDark(n+1,i)&&h++,e.isDark(n,i+1)&&h++,e.isDark(n+1,i+1)&&h++,(h==0||h==4)&&(r+=3)}for(var n=0;n<t;n++)for(var i=0;i<t-6;i++)e.isDark(n,i)&&!e.isDark(n,i+1)&&e.isDark(n,i+2)&&e.isDark(n,i+3)&&e.isDark(n,i+4)&&!e.isDark(n,i+5)&&e.isDark(n,i+6)&&(r+=40);for(var i=0;i<t;i++)for(var n=0;n<t-6;n++)e.isDark(n,i)&&!e.isDark(n+1,i)&&e.isDark(n+2,i)&&e.isDark(n+3,i)&&e.isDark(n+4,i)&&!e.isDark(n+5,i)&&e.isDark(n+6,i)&&(r+=40);for(var m=0,i=0;i<t;i++)for(var n=0;n<t;n++)e.isDark(n,i)&&m++;var R=Math.abs(100*m/t/t-50)/5;return r+=R*10,r}},Je={glog:function(e){if(e<1)throw new Error("glog("+e+")");return Je.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return Je.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var Ze=0;Ze<8;Ze++)Je.EXP_TABLE[Ze]=1<<Ze;for(var Ze=8;Ze<256;Ze++)Je.EXP_TABLE[Ze]=Je.EXP_TABLE[Ze-4]^Je.EXP_TABLE[Ze-5]^Je.EXP_TABLE[Ze-6]^Je.EXP_TABLE[Ze-8];for(var Ze=0;Ze<255;Ze++)Je.LOG_TABLE[Je.EXP_TABLE[Ze]]=Ze;function Dr(e,t){if(e.length==null)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&e[r]==0;)r++;this.num=new Array(e.length-r+t);for(var n=0;n<e.length-r;n++)this.num[n]=e[n+r]}Dr.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<e.getLength();n++)t[r+n]^=Je.gexp(Je.glog(this.get(r))+Je.glog(e.get(n)));return new Dr(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=Je.glog(this.get(0))-Je.glog(e.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(var n=0;n<e.getLength();n++)r[n]^=Je.gexp(Je.glog(e.get(n))+t);return new Dr(r,0).mod(e)}};function Mt(e,t){this.totalCount=e,this.dataCount=t}Mt.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];Mt.getRSBlocks=function(e,t){var r=Mt.getRsBlockTable(e,t);if(r==null)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var n=r.length/3,i=[],s=0;s<n;s++)for(var a=r[s*3+0],l=r[s*3+1],d=r[s*3+2],h=0;h<a;h++)i.push(new Mt(l,d));return i};Mt.getRsBlockTable=function(e,t){switch(t){case Bt.L:return Mt.RS_BLOCK_TABLE[(e-1)*4+0];case Bt.M:return Mt.RS_BLOCK_TABLE[(e-1)*4+1];case Bt.Q:return Mt.RS_BLOCK_TABLE[(e-1)*4+2];case Bt.H:return Mt.RS_BLOCK_TABLE[(e-1)*4+3];default:return}};function Ac(){this.buffer=[],this.length=0}Ac.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var r=0;r<t;r++)this.putBit((e>>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var as=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function Tc(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof e=="string"&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(d){switch(d){case"L":return Bt.L;case"M":return Bt.M;case"Q":return Bt.Q;case"H":return Bt.H;default:throw new Error("Unknwon error correction level: "+d)}}function n(d,h){for(var m=i(d),R=1,y=0,C=0,x=as.length;C<=x;C++){var B=as[C];if(!B)throw new Error("Content too long: expected "+y+" but got "+m);switch(h){case"L":y=B[0];break;case"M":y=B[1];break;case"Q":y=B[2];break;case"H":y=B[3];break;default:throw new Error("Unknwon error correction level: "+h)}if(m<=y)break;R++}if(R>as.length)throw new Error("Content too long");return R}function i(d){var h=encodeURI(d).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return h.length+(h.length!=d?3:0)}var s=this.options.content,a=n(s,this.options.ecl),l=r(this.options.ecl);this.qrcode=new kt(a,l),this.qrcode.addData(s),this.qrcode.make()}Tc.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;typeof e>"u"&&(e={container:t.container||"svg"});for(var n=typeof t.pretty<"u"?!!t.pretty:!0,i=n?" ":"",s=n?`\r
`:"",a=t.width,l=t.height,d=r.length,h=a/(d+2*t.padding),m=l/(d+2*t.padding),R=typeof t.join<"u"?!!t.join:!1,y=typeof t.swap<"u"?!!t.swap:!1,C=typeof t.xmlDeclaration<"u"?!!t.xmlDeclaration:!0,x=typeof t.predefined<"u"?!!t.predefined:!1,B=x?i+'<defs><path id="qrmodule" d="M0 0 h'+m+" v"+h+' H0 z" style="fill:'+t.color+';shape-rendering:crispEdges;" /></defs>'+s:"",O=i+'<rect x="0" y="0" width="'+a+'" height="'+l+'" style="fill:'+t.background+';shape-rendering:crispEdges;"/>'+s,M="",T="",N=0;N<d;N++)for(var D=0;D<d;D++){var L=r[D][N];if(L){var F=D*h+t.padding*h,W=N*m+t.padding*m;if(y){var te=F;F=W,W=te}if(R){var Z=h+F,z=m+W;F=Number.isInteger(F)?Number(F):F.toFixed(2),W=Number.isInteger(W)?Number(W):W.toFixed(2),Z=Number.isInteger(Z)?Number(Z):Z.toFixed(2),z=Number.isInteger(z)?Number(z):z.toFixed(2),T+="M"+F+","+W+" V"+z+" H"+Z+" V"+W+" H"+F+" Z "}else x?M+=i+'<use x="'+F.toString()+'" y="'+W.toString()+'" href="#qrmodule" />'+s:M+=i+'<rect x="'+F.toString()+'" y="'+W.toString()+'" width="'+h+'" height="'+m+'" style="fill:'+t.color+';shape-rendering:crispEdges;"/>'+s}}R&&(M=i+'<path x="0" y="0" style="fill:'+t.color+';shape-rendering:crispEdges;" d="'+T+'" />');let X="";if(this.options.image!==void 0&&this.options.image.svg){const S=a*this.options.image.width/100,o=l*this.options.image.height/100,u=a/2-S/2,f=l/2-o/2;X+=`<svg x="${u}" y="${f}" width="${S}" height="${o}" viewBox="0 0 100 100" preserveAspectRatio="xMinYMin meet">`,X+=this.options.image.svg+s,X+="</svg>"}var ne="";switch(e.container){case"svg":C&&(ne+='<?xml version="1.0" standalone="yes"?>'+s),ne+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+a+'" height="'+l+'">'+s,ne+=B+O+M,ne+=X,ne+="</svg>";break;case"svg-viewbox":C&&(ne+='<?xml version="1.0" standalone="yes"?>'+s),ne+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 '+a+" "+l+'">'+s,ne+=B+O+M,ne+=X,ne+="</svg>";break;case"g":ne+='<g width="'+a+'" height="'+l+'">'+s,ne+=B+O+M,ne+=X,ne+="</g>";break;default:ne+=(B+O+M+X).replace(/^\s+/,"");break}return ne};var Zh=Tc,Kh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ki,"__esModule",{value:!0});ki.QRCode=void 0;const Qh=tt,qo=Ei,Yh=Kh(Zh),Xh=e=>{const[t,r]=(0,qo.useState)("");return(0,qo.useEffect)(()=>{var n,i;const s=new Yh.default({content:e.content,background:e.bgColor||"#ffffff",color:e.fgColor||"#000000",container:"svg",ecl:"M",width:(n=e.width)!==null&&n!==void 0?n:256,height:(i=e.height)!==null&&i!==void 0?i:256,padding:0,image:e.image}),a=Buffer.from(s.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${a}`)},[e.bgColor,e.content,e.fgColor,e.height,e.image,e.width]),t?(0,Qh.h)("img",{src:t,alt:"QR Code"}):null};ki.QRCode=Xh;var Ci={},Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.default=".-cbwsdk-css-reset .-cbwsdk-spinner{display:inline-block}.-cbwsdk-css-reset .-cbwsdk-spinner svg{display:inline-block;animation:2s linear infinite -cbwsdk-spinner-svg}.-cbwsdk-css-reset .-cbwsdk-spinner svg circle{animation:1.9s ease-in-out infinite both -cbwsdk-spinner-circle;display:block;fill:rgba(0,0,0,0);stroke-dasharray:283;stroke-dashoffset:280;stroke-linecap:round;stroke-width:10px;transform-origin:50% 50%}@keyframes -cbwsdk-spinner-svg{0%{transform:rotateZ(0deg)}100%{transform:rotateZ(360deg)}}@keyframes -cbwsdk-spinner-circle{0%,25%{stroke-dashoffset:280;transform:rotate(0)}50%,75%{stroke-dashoffset:75;transform:rotate(45deg)}100%{stroke-dashoffset:280;transform:rotate(360deg)}}";var ed=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.Spinner=void 0;const Wn=tt,td=ed(Gs),rd=e=>{var t;const r=(t=e.size)!==null&&t!==void 0?t:64,n=e.color||"#000";return(0,Wn.h)("div",{class:"-cbwsdk-spinner"},(0,Wn.h)("style",null,td.default),(0,Wn.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,Wn.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};Ci.Spinner=rd;var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.default=".-cbwsdk-css-reset .-cbwsdk-connect-content{height:430px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-connect-content.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-header{display:flex;align-items:center;justify-content:space-between;margin:0 0 30px}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading{font-style:normal;font-weight:500;font-size:28px;line-height:36px;margin:0}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-layout{display:flex;flex-direction:row}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-left{margin-right:30px;display:flex;flex-direction:column;justify-content:space-between}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-right{flex:25%;margin-right:34px}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-wrapper{width:220px;height:220px;border-radius:12px;display:flex;justify-content:center;align-items:center;background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light{background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light>p{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark{background-color:rgba(10,11,13,.9)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark>p{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting>p{font-size:12px;font-weight:bold;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app{border-radius:8px;font-size:14px;line-height:20px;padding:12px;width:339px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.light{background:#eef0f3;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.dark{background:#1e2025;color:#8a919e}.-cbwsdk-css-reset .-cbwsdk-cancel-button{-webkit-appearance:none;border:none;background:none;cursor:pointer;padding:0;margin:0}.-cbwsdk-css-reset .-cbwsdk-cancel-button-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-wallet-steps{padding:0 0 0 16px;margin:0;width:100%;list-style:decimal}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item{list-style-type:decimal;display:list-item;font-style:normal;font-weight:400;font-size:16px;line-height:24px;margin-top:20px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item-wrapper{display:flex;align-items:center}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-pad-left{margin-left:6px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon{display:flex;border-radius:50%;height:24px;width:24px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.light{background:#0052ff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.dark{background:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item{align-items:center;display:flex;flex-direction:row;padding:16px 24px;gap:12px;cursor:pointer;border-radius:100px;font-weight:600}.-cbwsdk-css-reset .-cbwsdk-connect-item.light{background:#f5f8ff;color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-connect-item.dark{background:#001033;color:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item-copy-wrapper{margin:0 4px 0 8px}.-cbwsdk-css-reset .-cbwsdk-connect-item-title{margin:0 0 0;font-size:16px;line-height:24px;font-weight:500}.-cbwsdk-css-reset .-cbwsdk-connect-item-description{font-weight:400;font-size:14px;line-height:20px;margin:0}";var Nc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.CoinbaseWalletSteps=Vr.ConnectContent=void 0;const hr=Nc(Cn),oe=tt,nd=q,id=Qr,sd=Si,od=Ri,ad=Mi,cd=ki,ld=Ci,ud=Nc(Zs),cs={title:"Coinbase Wallet app",description:"Connect with your self-custody wallet",steps:Lc},hd=e=>e==="light"?"#FFFFFF":"#0A0B0D";function dd(e){const{theme:t}=e,r=(0,nd.createQrUrl)(e.sessionId,e.sessionSecret,e.linkAPIUrl,e.isParentConnection,e.version,e.chainId),n=cs.steps;return(0,oe.h)("div",{"data-testid":"connect-content",className:(0,hr.default)("-cbwsdk-connect-content",t)},(0,oe.h)("style",null,ud.default),(0,oe.h)("div",{className:"-cbwsdk-connect-content-header"},(0,oe.h)("h2",{className:(0,hr.default)("-cbwsdk-connect-content-heading",t)},"Scan to connect with our mobile app"),e.onCancel&&(0,oe.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:e.onCancel},(0,oe.h)(sd.CloseIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,oe.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,oe.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,oe.h)(fd,{title:cs.title,description:cs.description,theme:t})),(0,oe.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,oe.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,oe.h)(cd.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,oe.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:id.LIB_VERSION}),(0,oe.h)("input",{type:"hidden",value:r})),(0,oe.h)(n,{theme:t}),!e.isConnected&&(0,oe.h)("div",{"data-testid":"connecting-spinner",className:(0,hr.default)("-cbwsdk-connect-content-qr-connecting",t)},(0,oe.h)(ld.Spinner,{size:36,color:t==="dark"?"#FFF":"#000"}),(0,oe.h)("p",null,"Connecting...")))))}Vr.ConnectContent=dd;function fd({title:e,description:t,theme:r}){return(0,oe.h)("div",{className:(0,hr.default)("-cbwsdk-connect-item",r)},(0,oe.h)("div",null,(0,oe.h)(od.CoinbaseWalletRound,null)),(0,oe.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,oe.h)("h3",{className:"-cbwsdk-connect-item-title"},e),(0,oe.h)("p",{className:"-cbwsdk-connect-item-description"},t)))}function Lc({theme:e}){return(0,oe.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,oe.h)("li",{className:(0,hr.default)("-cbwsdk-wallet-steps-item",e)},(0,oe.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,oe.h)("li",{className:(0,hr.default)("-cbwsdk-wallet-steps-item",e)},(0,oe.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,oe.h)("span",null,"Tap ",(0,oe.h)("strong",null,"Scan")," "),(0,oe.h)("span",{className:(0,hr.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",e)},(0,oe.h)(ad.QRCodeIcon,{fill:hd(e)})))))}Vr.CoinbaseWalletSteps=Lc;var Ii={},xi={};Object.defineProperty(xi,"__esModule",{value:!0});xi.ArrowLeftIcon=void 0;const Jo=tt;function pd(e){return(0,Jo.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},e),(0,Jo.h)("path",{d:"M8.60675 0.155884L7.37816 1.28209L12.7723 7.16662H0V8.83328H12.6548L6.82149 14.6666L8 15.8451L15.8201 8.02501L8.60675 0.155884Z"}))}xi.ArrowLeftIcon=pd;var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.LaptopIcon=void 0;const ls=tt;function gd(e){return(0,ls.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,ls.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,ls.h)("path",{d:"M13.4001 10.2002H0.600098C0.600098 11.0838 1.31644 11.8002 2.2001 11.8002H11.8001C12.6838 11.8002 13.4001 11.0838 13.4001 10.2002Z"}))}Ai.LaptopIcon=gd;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.SafeIcon=void 0;const Go=tt;function md(e){return(0,Go.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,Go.h)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.600098 0.600098V11.8001H13.4001V0.600098H0.600098ZM7.0001 9.2001C5.3441 9.2001 4.0001 7.8561 4.0001 6.2001C4.0001 4.5441 5.3441 3.2001 7.0001 3.2001C8.6561 3.2001 10.0001 4.5441 10.0001 6.2001C10.0001 7.8561 8.6561 9.2001 7.0001 9.2001ZM0.600098 12.6001H3.8001V13.4001H0.600098V12.6001ZM10.2001 12.6001H13.4001V13.4001H10.2001V12.6001ZM8.8001 6.2001C8.8001 7.19421 7.99421 8.0001 7.0001 8.0001C6.00598 8.0001 5.2001 7.19421 5.2001 6.2001C5.2001 5.20598 6.00598 4.4001 7.0001 4.4001C7.99421 4.4001 8.8001 5.20598 8.8001 6.2001Z"}))}Ti.SafeIcon=md;var Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.default=".-cbwsdk-css-reset .-cbwsdk-try-extension{display:flex;margin-top:12px;height:202px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-try-extension.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-column-half{flex:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading{font-style:normal;font-weight:500;font-size:25px;line-height:32px;margin:0;max-width:204px}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta{appearance:none;border:none;background:none;color:#0052ff;cursor:pointer;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.light{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.dark{color:#588af5}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-wrapper{display:flex;align-items:center;margin-top:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-icon{display:block;margin-left:4px;height:14px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list{display:flex;flex-direction:column;justify-content:center;align-items:center;margin:0;padding:0;list-style:none;height:100%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item{display:flex;align-items:center;flex-flow:nowrap;margin-top:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item:first-of-type{margin-top:0}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon-wrapper{display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon{display:flex;height:32px;width:32px;border-radius:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.light{background:#eef0f3}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.dark{background:#1e2025}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy{display:block;font-weight:400;font-size:14px;line-height:20px;padding-left:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.light{color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.dark{color:#8a919e}";var Oc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.TryExtensionContent=void 0;const rr=Oc(Cn),We=tt,us=Ei,vd=xi,bd=Ai,wd=Ti,_d=Oc(Ks);function yd({theme:e}){const[t,r]=(0,us.useState)(!1),n=(0,us.useCallback)(()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")},[]),i=(0,us.useCallback)(()=>{t?window.location.reload():(n(),r(!0))},[n,t]);return(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension",e)},(0,We.h)("style",null,_d.default),(0,We.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,We.h)("h3",{class:(0,rr.default)("-cbwsdk-try-extension-heading",e)},"Or try the Coinbase Wallet browser extension"),(0,We.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,We.h)("button",{class:(0,rr.default)("-cbwsdk-try-extension-cta",e),onClick:i},t?"Refresh":"Install"),(0,We.h)("div",null,!t&&(0,We.h)(vd.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:e==="light"?"#0052FF":"#588AF5"})))),(0,We.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,We.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,We.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,We.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,We.h)("span",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,We.h)(bd.LaptopIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-copy",e)},"Connect with dapps with just one click on your desktop browser")),(0,We.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,We.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,We.h)("span",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,We.h)(wd.SafeIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-copy",e)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))}Ii.TryExtensionContent=yd;var Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.default=".-cbwsdk-css-reset .-cbwsdk-connect-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.light{background-color:rgba(0,0,0,.5)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.dark{background-color:rgba(50,53,61,.4)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box{display:flex;position:relative;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container-hidden{display:none}";var Pc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yi,"__esModule",{value:!0});yi.ConnectDialog=void 0;const hs=Pc(Cn),nr=tt,ds=Ei,Ed=Vr,Sd=Ii,Rd=Pc(Qs),Md=e=>{const{isOpen:t,darkMode:r}=e,[n,i]=(0,ds.useState)(!t),[s,a]=(0,ds.useState)(!t);(0,ds.useEffect)(()=>{const d=[window.setTimeout(()=>{a(!t)},10)];return t?i(!1):d.push(window.setTimeout(()=>{i(!0)},360)),()=>{d.forEach(window.clearTimeout)}},[t]);const l=r?"dark":"light";return(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,nr.h)("style",null,Rd.default),(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-backdrop",l,s&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,nr.h)("div",{class:"-cbwsdk-connect-dialog"},(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-box",s&&"-cbwsdk-connect-dialog-box-hidden")},e.connectDisabled?null:(0,nr.h)(Ed.ConnectContent,{theme:l,version:e.version,sessionId:e.sessionId,sessionSecret:e.sessionSecret,linkAPIUrl:e.linkAPIUrl,isConnected:e.isConnected,isParentConnection:e.isParentConnection,chainId:e.chainId,onCancel:e.onCancel}),(0,nr.h)(Sd.TryExtensionContent,{theme:l}))))};yi.ConnectDialog=Md;Object.defineProperty(_i,"__esModule",{value:!0});_i.LinkFlow=void 0;const fs=tt,kd=yi;class Cd{constructor(t){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=t.darkMode,this.version=t.version,this.sessionId=t.sessionId,this.sessionSecret=t.sessionSecret,this.linkAPIUrl=t.linkAPIUrl,this.isParentConnection=t.isParentConnection}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",t.appendChild(this.root),this.render()}setConnected(t){this.connected!==t&&(this.connected=t,this.render())}setChainId(t){this.chainId!==t&&(this.chainId=t,this.render())}detach(){var t;this.root&&((0,fs.render)(null,this.root),(t=this.root.parentElement)===null||t===void 0||t.removeChild(this.root))}setConnectDisabled(t){this.connectDisabled=t}open(t){this.isOpen=!0,this.onCancel=t.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,fs.render)((0,fs.h)(kd.ConnectDialog,{darkMode:this.darkMode,version:this.version,sessionId:this.sessionId,sessionSecret:this.sessionSecret,linkAPIUrl:this.linkAPIUrl,isOpen:this.isOpen,isConnected:this.connected,isParentConnection:this.isParentConnection,chainId:this.chainId,onCancel:this.onCancel,connectDisabled:this.connectDisabled}),this.root)}}_i.LinkFlow=Cd;var Ys={},Xs={};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(e){var t=Q&&Q.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(e,"__esModule",{value:!0}),e.SnackbarInstance=e.SnackbarContainer=e.Snackbar=void 0;const r=t(Cn),n=tt,i=Ei,s=t(Xs),a="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",l="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class d{constructor(y){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=y.darkMode}attach(y){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",y.appendChild(this.root),this.render()}presentItem(y){const C=this.nextItemKey++;return this.items.set(C,y),this.render(),()=>{this.items.delete(C),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,n.render)((0,n.h)("div",null,(0,n.h)(e.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([y,C])=>(0,n.h)(e.SnackbarInstance,Object.assign({},C,{key:y}))))),this.root)}}e.Snackbar=d;const h=R=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,n.h)("style",null,s.default),(0,n.h)("div",{class:"-cbwsdk-snackbar"},R.children));e.SnackbarContainer=h;const m=({autoExpand:R,message:y,menuItems:C})=>{const[x,B]=(0,i.useState)(!0),[O,M]=(0,i.useState)(R??!1);(0,i.useEffect)(()=>{const N=[window.setTimeout(()=>{B(!1)},1),window.setTimeout(()=>{M(!0)},1e4)];return()=>{N.forEach(window.clearTimeout)}});const T=()=>{M(!O)};return(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",x&&"-cbwsdk-snackbar-instance-hidden",O&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:T},(0,n.h)("img",{src:a,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},y),(0,n.h)("div",{class:"-gear-container"},!O&&(0,n.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,n.h)("img",{src:l,class:"-gear-icon",title:"Expand"}))),C&&C.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},C.map((N,D)=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",N.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:N.onClick,key:D},(0,n.h)("svg",{width:N.svgWidth,height:N.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":N.defaultFillRule,"clip-rule":N.defaultClipRule,d:N.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",N.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},N.info)))))};e.SnackbarInstance=m})(Ys);Object.defineProperty(Mn,"__esModule",{value:!0});Mn.WalletLinkRelayUI=void 0;const Id=kn,xd=_i,Ad=Ys;class Td{constructor(t){this.standalone=null,this.attached=!1,this.snackbar=new Ad.Snackbar({darkMode:t.darkMode}),this.linkFlow=new xd.LinkFlow({darkMode:t.darkMode,version:t.version,sessionId:t.session.id,sessionSecret:t.session.secret,linkAPIUrl:t.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",t.appendChild(r),this.linkFlow.attach(r),this.snackbar.attach(r),this.attached=!0,(0,Id.injectCssReset)()}setConnected(t){this.linkFlow.setConnected(t)}setChainId(t){this.linkFlow.setChainId(t)}setConnectDisabled(t){this.linkFlow.setConnectDisabled(t)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(t){this.linkFlow.open({onCancel:t.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(t){let r;return t.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:t.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:t.onResetConnection}]},this.snackbar.presentItem(r)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(t){this.standalone=t}isStandalone(){var t;return(t=this.standalone)!==null&&t!==void 0?t:!1}}Mn.WalletLinkRelayUI=Td;Object.defineProperty(_n,"__esModule",{value:!0});_n.WalletLinkRelay=void 0;const Lr=gn,Nd=Ve,Fe=q,ir=Yr,Zo=ht,Pt=Xr,Ld=vi,sr=Kr,Od=Mn;class Tt extends Zo.RelayAbstract{constructor(t){var r;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=a=>{var l;this.isLinked=a;const d=this.storage.getItem(Zo.LOCAL_STORAGE_ADDRESSES_KEY);if(a&&(this.session.linked=a),this.isUnlinkedErrorState=!1,d){const h=d.split(" "),m=this.storage.getItem("IsStandaloneSigning")==="true";if(h[0]!==""&&!a&&this.session.linked&&!m){this.isUnlinkedErrorState=!0;const R=this.getSessionIdHash();(l=this.diagnostic)===null||l===void 0||l.log(ir.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:R})}}},this.metadataUpdated=(a,l)=>{this.storage.setItem(a,l)},this.chainUpdated=(a,l)=>{this.chainCallbackParams.chainId===a&&this.chainCallbackParams.jsonRpcUrl===l||(this.chainCallbackParams={chainId:a,jsonRpcUrl:l},this.chainCallback&&this.chainCallback(a,l))},this.accountUpdated=a=>{this.accountsCallback&&this.accountsCallback([a]),Tt.accountRequestCallbackIds.size>0&&(Array.from(Tt.accountRequestCallbackIds.values()).forEach(l=>{const d={type:"WEB3_RESPONSE",id:l,response:{method:"requestEthereumAccounts",result:[a]}};this.invokeCallback(Object.assign(Object.assign({},d),{id:l}))}),Tt.accountRequestCallbackIds.clear())},this.connectedUpdated=a=>{this.ui.setConnected(a)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.options=t;const{session:n,ui:i,connection:s}=this.subscribe();this._session=n,this.connection=s,this.relayEventManager=t.relayEventManager,this.diagnostic=t.diagnosticLogger,this._reloadOnDisconnect=(r=t.reloadOnDisconnect)!==null&&r!==void 0?r:!0,this.ui=i}subscribe(){const t=Pt.Session.load(this.storage)||new Pt.Session(this.storage).save(),{linkAPIUrl:r,diagnostic:n}=this,i=new Ld.WalletLinkConnection({session:t,linkAPIUrl:r,diagnostic:n,listener:this}),{version:s,darkMode:a}=this.options,l=this.options.uiConstructor({linkAPIUrl:r,version:s,darkMode:a,session:t});return i.connect(),{session:t,ui:l,connection:i}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(t=>setTimeout(()=>t(null),1e3))]).then(()=>{var t,r;const n=this.ui.isStandalone();(t=this.diagnostic)===null||t===void 0||t.log(ir.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const i=Pt.Session.load(this.storage);if((i==null?void 0:i.id)===this._session.id?this.storage.clear():i&&((r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:Pt.Session.hash(i.id)})),this._reloadOnDisconnect){this.ui.reloadUI();return}this.accountsCallback&&this.accountsCallback([],!0);const{session:s,ui:a,connection:l}=this.subscribe();this._session=s,this.connection=l,this.ui=a,n&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()}).catch(t=>{var r;(r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${t}`,sessionIdHash:this.getSessionIdHash()})})}setAppInfo(t,r){this.appName=t,this.appLogoUrl=r}getStorageItem(t){return this.storage.getItem(t)}get session(){return this._session}setStorageItem(t,r){this.storage.setItem(t,r)}signEthereumMessage(t,r,n,i){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,Fe.hexStringFromBuffer)(t,!0),address:r,addPrefix:n,typedDataJson:i||null}})}ethereumAddressFromSignedMessage(t,r,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,Fe.hexStringFromBuffer)(t,!0),signature:(0,Fe.hexStringFromBuffer)(r,!0),addPrefix:n}})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,Fe.bigIntStringFromBN)(t.weiValue),data:(0,Fe.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,gasLimit:t.gasLimit?(0,Fe.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,Fe.bigIntStringFromBN)(t.weiValue),data:(0,Fe.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?(0,Fe.bigIntStringFromBN)(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?(0,Fe.bigIntStringFromBN)(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?(0,Fe.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,Fe.hexStringFromBuffer)(t,!0),chainId:r}})}scanQRCode(t){return this.sendRequest({method:"scanQRCode",params:{regExp:t}})}getQRCodeUrl(){return(0,Fe.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(t,r){return this.sendRequest({method:"generic",params:{action:r,data:t}})}sendGenericMessage(t){return this.sendRequest(t)}sendRequest(t){let r=null;const n=(0,Fe.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,t.method,a),r==null||r()};return{promise:new Promise((a,l)=>{this.ui.isStandalone()||(r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(n,d=>{if(r==null||r(),(0,sr.isErrorResponse)(d))return l(new Error(d.errorMessage));a(d)}),this.ui.isStandalone()?this.sendRequestStandalone(n,t):this.publishWeb3RequestEvent(n,t)}),cancel:i}}setConnectDisabled(t){this.ui.setConnectDisabled(t)}setAccountsCallback(t){this.accountsCallback=t}setChainCallback(t){this.chainCallback=t}setDappDefaultChainCallback(t){this.dappDefaultChain=t,this.ui instanceof Od.WalletLinkRelayUI&&this.ui.setChainId(t)}publishWeb3RequestEvent(t,r){var n;const i={type:"WEB3_REQUEST",id:t,request:r},s=Pt.Session.load(this.storage);(n=this.diagnostic)===null||n===void 0||n.log(ir.EVENTS.WEB3_REQUEST,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Pt.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",i,!0).then(a=>{var l;(l=this.diagnostic)===null||l===void 0||l.log(ir.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Pt.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()})}).catch(a=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i.id,response:{method:r.method,errorMessage:a.message}})})}publishWeb3RequestCanceledEvent(t){const r={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(t,r,n){return this.connection.publishEvent(t,r,n)}handleWeb3ResponseMessage(t){var r;const{response:n}=t;if((r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.WEB3_RESPONSE,{eventId:t.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash()}),n.method==="requestEthereumAccounts"){Tt.accountRequestCallbackIds.forEach(i=>this.invokeCallback(Object.assign(Object.assign({},t),{id:i}))),Tt.accountRequestCallbackIds.clear();return}this.invokeCallback(t)}handleErrorResponse(t,r,n,i){var s;const a=(s=n==null?void 0:n.message)!==null&&s!==void 0?s:(0,Lr.getMessageFromCode)(i);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:{method:r,errorMessage:a,errorCode:i}})}invokeCallback(t){const r=this.relayEventManager.callbacks.get(t.id);r&&(r(t.response),this.relayEventManager.callbacks.delete(t.id))}requestEthereumAccounts(){const t={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},r=(0,Fe.randomBytesHex)(8),n=s=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,s)};return{promise:new Promise((s,a)=>{if(this.relayEventManager.callbacks.set(r,l=>{if(this.ui.hideRequestEthereumAccounts(),(0,sr.isErrorResponse)(l))return a(new Error(l.errorMessage));s(l)}),this.ui.inlineAccountsResponse()){const l=d=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"requestEthereumAccounts",result:d}})};this.ui.requestEthereumAccounts({onCancel:n,onAccounts:l})}else{const l=Lr.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>n(l)})}Tt.accountRequestCallbackIds.add(r),!this.ui.inlineAccountsResponse()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(r,t)}),cancel:n}}selectProvider(t){const r={method:"selectProvider",params:{providerOptions:t}},n=(0,Fe.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,a)},s=new Promise((a,l)=>{this.relayEventManager.callbacks.set(n,m=>{if((0,sr.isErrorResponse)(m))return l(new Error(m.errorMessage));a(m)});const d=m=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:Nd.ProviderType.Unselected}})},h=m=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:m}})};this.ui.selectProvider&&this.ui.selectProvider({onApprove:h,onCancel:d,providerOptions:t})});return{cancel:i,promise:s}}watchAsset(t,r,n,i,s,a){const l={method:"watchAsset",params:{type:t,options:{address:r,symbol:n,decimals:i,image:s},chainId:a}};let d=null;const h=(0,Fe.randomBytesHex)(8),m=y=>{this.publishWeb3RequestCanceledEvent(h),this.handleErrorResponse(h,l.method,y),d==null||d()};this.ui.inlineWatchAsset()||(d=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:m,onResetConnection:this.resetAndReload}));const R=new Promise((y,C)=>{this.relayEventManager.callbacks.set(h,O=>{if(d==null||d(),(0,sr.isErrorResponse)(O))return C(new Error(O.errorMessage));y(O)});const x=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!1}})},B=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:B,onCancel:x,type:t,address:r,symbol:n,decimals:i,image:s,chainId:a}),!this.ui.inlineWatchAsset()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(h,l)});return{cancel:m,promise:R}}addEthereumChain(t,r,n,i,s,a){const l={method:"addEthereumChain",params:{chainId:t,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:a}};let d=null;const h=(0,Fe.randomBytesHex)(8),m=y=>{this.publishWeb3RequestCanceledEvent(h),this.handleErrorResponse(h,l.method,y),d==null||d()};return this.ui.inlineAddEthereumChain(t)||(d=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:m,onResetConnection:this.resetAndReload})),{promise:new Promise((y,C)=>{this.relayEventManager.callbacks.set(h,O=>{if(d==null||d(),(0,sr.isErrorResponse)(O))return C(new Error(O.errorMessage));y(O)});const x=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},B=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:O}}})};this.ui.inlineAddEthereumChain(t)&&this.ui.addEthereumChain({onCancel:x,onApprove:B,chainId:l.params.chainId,rpcUrls:l.params.rpcUrls,blockExplorerUrls:l.params.blockExplorerUrls,chainName:l.params.chainName,iconUrls:l.params.iconUrls,nativeCurrency:l.params.nativeCurrency}),!this.ui.inlineAddEthereumChain(t)&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(h,l)}),cancel:m}}switchEthereumChain(t,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:r})},i=(0,Fe.randomBytesHex)(8),s=l=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,n.method,l)};return{promise:new Promise((l,d)=>{this.relayEventManager.callbacks.set(i,R=>{if((0,sr.isErrorResponse)(R)&&R.errorCode)return d(Lr.standardErrors.provider.custom({code:R.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,sr.isErrorResponse)(R))return d(new Error(R.errorMessage));l(R)});const h=R=>{var y;if(R){const C=(y=(0,Lr.getErrorCode)(R))!==null&&y!==void 0?y:Lr.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(i,"switchEthereumChain",R instanceof Error?R:Lr.standardErrors.provider.unsupportedChain(t),C)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},m=R=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:R}}})};this.ui.switchEthereumChain({onCancel:h,onApprove:m,chainId:n.params.chainId,address:n.params.address}),!this.ui.inlineSwitchEthereumChain()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(i,n)}),cancel:s}}inlineAddEthereumChain(t){return this.ui.inlineAddEthereumChain(t)}getSessionIdHash(){return Pt.Session.hash(this._session.id)}sendRequestStandalone(t,r){const n=s=>{this.handleErrorResponse(t,r.method,s)},i=s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:s})};switch(r.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:r,onSuccess:i,onCancel:n});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:r,onSuccess:i});break;default:n();break}}}_n.WalletLinkRelay=Tt;Tt.accountRequestCallbackIds=new Set;var In={},Ni={},$c={};(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(i,s);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,l)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ys,e)})($c);var eo={};Object.defineProperty(eo,"__esModule",{value:!0});eo.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var Bc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ni,"__esModule",{value:!0});Ni.RedirectDialog=void 0;const Pd=Bc(Cn),Rt=tt,$d=kn,Bd=$c,Dd=Bc(eo);class Fd{constructor(){this.root=null}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),(0,$d.injectCssReset)()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&((0,Rt.render)(null,this.root),t&&(0,Rt.render)((0,Rt.h)(jd,Object.assign({},t,{onDismiss:()=>{this.clear()}})),this.root))}}Ni.RedirectDialog=Fd;const jd=({title:e,buttonText:t,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return(0,Rt.h)(Bd.SnackbarContainer,{darkMode:r},(0,Rt.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Rt.h)("style",null,Dd.default),(0,Rt.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),(0,Rt.h)("div",{class:(0,Pd.default)("-cbwsdk-redirect-dialog-box",s)},(0,Rt.h)("p",null,e),(0,Rt.h)("button",{onClick:n},t))))};Object.defineProperty(In,"__esModule",{value:!0});In.MobileRelayUI=void 0;const Hd=Ni;class Ud{constructor(t){this.attached=!1,this.darkMode=!1,this.redirectDialog=new Hd.RedirectDialog,this.darkMode=t.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(t){}redirectToCoinbaseWallet(t){const r=new URL("https://go.cb-w.com/walletlink");r.searchParams.append("redirect_url",window.location.href),t&&r.searchParams.append("wl_url",t);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(t){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(t)},99)}showConnecting(t){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}}In.MobileRelayUI=Ud;Object.defineProperty(wn,"__esModule",{value:!0});wn.MobileRelay=void 0;const Wd=q,Vd=_n,zd=In;class qd extends Vd.WalletLinkRelay{constructor(t){var r;super(t),this._enableMobileWalletLink=(r=t.enableMobileWalletLink)!==null&&r!==void 0?r:!1}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise(()=>{const t=(0,Wd.getLocation)();t.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(t.href)}`}),cancel:()=>{}}}publishWeb3RequestEvent(t,r){if(super.publishWeb3RequestEvent(t,r),!(this._enableMobileWalletLink&&this.ui instanceof zd.MobileRelayUI))return;let n=!1;switch(r.method){case"requestEthereumAccounts":case"connectAndSignIn":n=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:n=!0,this.ui.openCoinbaseWalletDeeplink();break}n&&window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0})}handleWeb3ResponseMessage(t){super.handleWeb3ResponseMessage(t)}connectAndSignIn(t){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:t.nonce,iat:new Date().toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:t.statement,resources:t.resources}})}}wn.MobileRelay=qd;var $s={exports:{}},Dc=si.EventEmitter,ps,Ko;function Jd(){if(Ko)return ps;Ko=1;function e(x,B){var O=Object.keys(x);if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(x);B&&(M=M.filter(function(T){return Object.getOwnPropertyDescriptor(x,T).enumerable})),O.push.apply(O,M)}return O}function t(x){for(var B=1;B<arguments.length;B++){var O=arguments[B]!=null?arguments[B]:{};B%2?e(Object(O),!0).forEach(function(M){r(x,M,O[M])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(O)):e(Object(O)).forEach(function(M){Object.defineProperty(x,M,Object.getOwnPropertyDescriptor(O,M))})}return x}function r(x,B,O){return B=a(B),B in x?Object.defineProperty(x,B,{value:O,enumerable:!0,configurable:!0,writable:!0}):x[B]=O,x}function n(x,B){if(!(x instanceof B))throw new TypeError("Cannot call a class as a function")}function i(x,B){for(var O=0;O<B.length;O++){var M=B[O];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(x,a(M.key),M)}}function s(x,B,O){return B&&i(x.prototype,B),Object.defineProperty(x,"prototype",{writable:!1}),x}function a(x){var B=l(x,"string");return typeof B=="symbol"?B:String(B)}function l(x,B){if(typeof x!="object"||x===null)return x;var O=x[Symbol.toPrimitive];if(O!==void 0){var M=O.call(x,B||"default");if(typeof M!="object")return M;throw new TypeError("@@toPrimitive must return a primitive value.")}return(B==="string"?String:Number)(x)}var d=ii,h=d.Buffer,m=Ws,R=m.inspect,y=R&&R.custom||"inspect";function C(x,B,O){h.prototype.copy.call(x,B,O)}return ps=function(){function x(){n(this,x),this.head=null,this.tail=null,this.length=0}return s(x,[{key:"push",value:function(O){var M={data:O,next:null};this.length>0?this.tail.next=M:this.head=M,this.tail=M,++this.length}},{key:"unshift",value:function(O){var M={data:O,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length}},{key:"shift",value:function(){if(this.length!==0){var O=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,O}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(O){if(this.length===0)return"";for(var M=this.head,T=""+M.data;M=M.next;)T+=O+M.data;return T}},{key:"concat",value:function(O){if(this.length===0)return h.alloc(0);for(var M=h.allocUnsafe(O>>>0),T=this.head,N=0;T;)C(T.data,M,N),N+=T.data.length,T=T.next;return M}},{key:"consume",value:function(O,M){var T;return O<this.head.data.length?(T=this.head.data.slice(0,O),this.head.data=this.head.data.slice(O)):O===this.head.data.length?T=this.shift():T=M?this._getString(O):this._getBuffer(O),T}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(O){var M=this.head,T=1,N=M.data;for(O-=N.length;M=M.next;){var D=M.data,L=O>D.length?D.length:O;if(L===D.length?N+=D:N+=D.slice(0,O),O-=L,O===0){L===D.length?(++T,M.next?this.head=M.next:this.head=this.tail=null):(this.head=M,M.data=D.slice(L));break}++T}return this.length-=T,N}},{key:"_getBuffer",value:function(O){var M=h.allocUnsafe(O),T=this.head,N=1;for(T.data.copy(M),O-=T.data.length;T=T.next;){var D=T.data,L=O>D.length?D.length:O;if(D.copy(M,M.length-O,0,L),O-=L,O===0){L===D.length?(++N,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=D.slice(L));break}++N}return this.length-=N,M}},{key:y,value:function(O,M){return R(this,t(t({},M),{},{depth:0,customInspect:!1}))}}]),x}(),ps}var or={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};function Gd(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,or.nextTick(Bs,this,e)):or.nextTick(Bs,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?or.nextTick(Xn,r):(r._writableState.errorEmitted=!0,or.nextTick(Qo,r,s)):or.nextTick(Qo,r,s):t?(or.nextTick(Xn,r),t(s)):or.nextTick(Xn,r)}),this)}function Qo(e,t){Bs(e,t),Xn(e)}function Xn(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Zd(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Bs(e,t){e.emit("error",t)}function Kd(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var Fc={destroy:Gd,undestroy:Zd,errorOrDestroy:Kd},mr={};function Qd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var jc={};function pt(e,t,r){r||(r=Error);function n(s,a,l){return typeof t=="string"?t:t(s,a,l)}var i=function(s){Qd(a,s);function a(l,d,h){return s.call(this,n(l,d,h))||this}return a}(r);i.prototype.name=r.name,i.prototype.code=e,jc[e]=i}function Yo(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function Yd(e,t,r){return e.substr(0,t.length)===t}function Xd(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function ef(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}pt("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);pt("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&Yd(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(Xd(e," argument"))i="The ".concat(e," ").concat(n," ").concat(Yo(t,"type"));else{var s=ef(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(Yo(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);pt("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");pt("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});pt("ERR_STREAM_PREMATURE_CLOSE","Premature close");pt("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});pt("ERR_MULTIPLE_CALLBACK","Callback called multiple times");pt("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");pt("ERR_STREAM_WRITE_AFTER_END","write after end");pt("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);pt("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);pt("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");mr.codes=jc;var tf=mr.codes.ERR_INVALID_OPT_VALUE;function rf(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function nf(e,t,r,n){var i=rf(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new tf(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var Hc={getHighWaterMark:nf},sf=of;function of(e,t){if(gs("noDeprecation"))return e;var r=!1;function n(){if(!r){if(gs("throwDeprecation"))throw new Error(t);gs("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function gs(e){try{if(!globalThis.localStorage)return!1}catch{return!1}var t=globalThis.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var ms,Xo;function Uc(){if(Xo)return ms;Xo=1;var e={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};ms=Z;function t(A){var I=this;this.next=null,this.entry=null,this.finish=function(){V(I,A)}}var r;Z.WritableState=W;var n={deprecate:sf},i=Dc,s=ii.Buffer,a=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function l(A){return s.from(A)}function d(A){return s.isBuffer(A)||A instanceof a}var h=Fc,m=Hc,R=m.getHighWaterMark,y=mr.codes,C=y.ERR_INVALID_ARG_TYPE,x=y.ERR_METHOD_NOT_IMPLEMENTED,B=y.ERR_MULTIPLE_CALLBACK,O=y.ERR_STREAM_CANNOT_PIPE,M=y.ERR_STREAM_DESTROYED,T=y.ERR_STREAM_NULL_VALUES,N=y.ERR_STREAM_WRITE_AFTER_END,D=y.ERR_UNKNOWN_ENCODING,L=h.errorOrDestroy;vt(Z,i);function F(){}function W(A,I,$){r=r||zr(),A=A||{},typeof $!="boolean"&&($=I instanceof r),this.objectMode=!!A.objectMode,$&&(this.objectMode=this.objectMode||!!A.writableObjectMode),this.highWaterMark=R(this,A,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var K=A.decodeStrings===!1;this.decodeStrings=!K,this.defaultEncoding=A.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){p(I,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=A.emitClose!==!1,this.autoDestroy=!!A.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}W.prototype.getBuffer=function(){for(var I=this.bufferedRequest,$=[];I;)$.push(I),I=I.next;return $},function(){try{Object.defineProperty(W.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var te;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(te=Function.prototype[Symbol.hasInstance],Object.defineProperty(Z,Symbol.hasInstance,{value:function(I){return te.call(this,I)?!0:this!==Z?!1:I&&I._writableState instanceof W}})):te=function(I){return I instanceof this};function Z(A){r=r||zr();var I=this instanceof r;if(!I&&!te.call(Z,this))return new Z(A);this._writableState=new W(A,this,I),this.writable=!0,A&&(typeof A.write=="function"&&(this._write=A.write),typeof A.writev=="function"&&(this._writev=A.writev),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.final=="function"&&(this._final=A.final)),i.call(this)}Z.prototype.pipe=function(){L(this,new O)};function z(A,I){var $=new N;L(A,$),e.nextTick(I,$)}function X(A,I,$,K){var G;return $===null?G=new T:typeof $!="string"&&!I.objectMode&&(G=new C("chunk",["string","Buffer"],$)),G?(L(A,G),e.nextTick(K,G),!1):!0}Z.prototype.write=function(A,I,$){var K=this._writableState,G=!1,b=!K.objectMode&&d(A);return b&&!s.isBuffer(A)&&(A=l(A)),typeof I=="function"&&($=I,I=null),b?I="buffer":I||(I=K.defaultEncoding),typeof $!="function"&&($=F),K.ending?z(this,$):(b||X(this,K,A,$))&&(K.pendingcb++,G=S(this,K,b,A,I,$)),G},Z.prototype.cork=function(){this._writableState.corked++},Z.prototype.uncork=function(){var A=this._writableState;A.corked&&(A.corked--,!A.writing&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&k(this,A))},Z.prototype.setDefaultEncoding=function(I){if(typeof I=="string"&&(I=I.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((I+"").toLowerCase())>-1))throw new D(I);return this._writableState.defaultEncoding=I,this},Object.defineProperty(Z.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ne(A,I,$){return!A.objectMode&&A.decodeStrings!==!1&&typeof I=="string"&&(I=s.from(I,$)),I}Object.defineProperty(Z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function S(A,I,$,K,G,b){if(!$){var _=ne(I,K,G);K!==_&&($=!0,G="buffer",K=_)}var P=I.objectMode?1:K.length;I.length+=P;var j=I.length<I.highWaterMark;if(j||(I.needDrain=!0),I.writing||I.corked){var ue=I.lastBufferedRequest;I.lastBufferedRequest={chunk:K,encoding:G,isBuf:$,callback:b,next:null},ue?ue.next=I.lastBufferedRequest:I.bufferedRequest=I.lastBufferedRequest,I.bufferedRequestCount+=1}else o(A,I,!1,P,K,G,b);return j}function o(A,I,$,K,G,b,_){I.writelen=K,I.writecb=_,I.writing=!0,I.sync=!0,I.destroyed?I.onwrite(new M("write")):$?A._writev(G,I.onwrite):A._write(G,b,I.onwrite),I.sync=!1}function u(A,I,$,K,G){--I.pendingcb,$?(e.nextTick(G,K),e.nextTick(U,A,I),A._writableState.errorEmitted=!0,L(A,K)):(G(K),A._writableState.errorEmitted=!0,L(A,K),U(A,I))}function f(A){A.writing=!1,A.writecb=null,A.length-=A.writelen,A.writelen=0}function p(A,I){var $=A._writableState,K=$.sync,G=$.writecb;if(typeof G!="function")throw new B;if(f($),I)u(A,$,K,I,G);else{var b=g($)||A.destroyed;!b&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest&&k(A,$),K?e.nextTick(v,A,$,b,G):v(A,$,b,G)}}function v(A,I,$,K){$||E(A,I),I.pendingcb--,K(),U(A,I)}function E(A,I){I.length===0&&I.needDrain&&(I.needDrain=!1,A.emit("drain"))}function k(A,I){I.bufferProcessing=!0;var $=I.bufferedRequest;if(A._writev&&$&&$.next){var K=I.bufferedRequestCount,G=new Array(K),b=I.corkedRequestsFree;b.entry=$;for(var _=0,P=!0;$;)G[_]=$,$.isBuf||(P=!1),$=$.next,_+=1;G.allBuffers=P,o(A,I,!0,I.length,G,"",b.finish),I.pendingcb++,I.lastBufferedRequest=null,b.next?(I.corkedRequestsFree=b.next,b.next=null):I.corkedRequestsFree=new t(I),I.bufferedRequestCount=0}else{for(;$;){var j=$.chunk,ue=$.encoding,J=$.callback,Y=I.objectMode?1:j.length;if(o(A,I,!1,Y,j,ue,J),$=$.next,I.bufferedRequestCount--,I.writing)break}$===null&&(I.lastBufferedRequest=null)}I.bufferedRequest=$,I.bufferProcessing=!1}Z.prototype._write=function(A,I,$){$(new x("_write()"))},Z.prototype._writev=null,Z.prototype.end=function(A,I,$){var K=this._writableState;return typeof A=="function"?($=A,A=null,I=null):typeof I=="function"&&($=I,I=null),A!=null&&this.write(A,I),K.corked&&(K.corked=1,this.uncork()),K.ending||H(this,K,$),this},Object.defineProperty(Z.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function g(A){return A.ending&&A.length===0&&A.bufferedRequest===null&&!A.finished&&!A.writing}function c(A,I){A._final(function($){I.pendingcb--,$&&L(A,$),I.prefinished=!0,A.emit("prefinish"),U(A,I)})}function w(A,I){!I.prefinished&&!I.finalCalled&&(typeof A._final=="function"&&!I.destroyed?(I.pendingcb++,I.finalCalled=!0,e.nextTick(c,A,I)):(I.prefinished=!0,A.emit("prefinish")))}function U(A,I){var $=g(I);if($&&(w(A,I),I.pendingcb===0&&(I.finished=!0,A.emit("finish"),I.autoDestroy))){var K=A._readableState;(!K||K.autoDestroy&&K.endEmitted)&&A.destroy()}return $}function H(A,I,$){I.ending=!0,U(A,I),$&&(I.finished?e.nextTick($):A.once("finish",$)),I.ended=!0,A.writable=!1}function V(A,I,$){var K=A.entry;for(A.entry=null;K;){var G=K.callback;I.pendingcb--,G($),K=K.next}I.corkedRequestsFree.next=A}return Object.defineProperty(Z.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(I){this._writableState&&(this._writableState.destroyed=I)}}),Z.prototype.destroy=h.destroy,Z.prototype._undestroy=h.undestroy,Z.prototype._destroy=function(A,I){I(A)},ms}var vs,ea;function zr(){if(ea)return vs;ea=1;var e={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},t=Object.keys||function(m){var R=[];for(var y in m)R.push(y);return R};vs=l;var r=Vc(),n=Uc();vt(l,r);for(var i=t(n.prototype),s=0;s<i.length;s++){var a=i[s];l.prototype[a]||(l.prototype[a]=n.prototype[a])}function l(m){if(!(this instanceof l))return new l(m);r.call(this,m),n.call(this,m),this.allowHalfOpen=!0,m&&(m.readable===!1&&(this.readable=!1),m.writable===!1&&(this.writable=!1),m.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",d)))}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function d(){this._writableState.ended||e.nextTick(h,this)}function h(m){m.end()}return Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(R){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=R,this._writableState.destroyed=R)}}),vs}var bs={},ta;function ra(){if(ta)return bs;ta=1;var e=jt.Buffer,t=e.isEncoding||function(M){switch(M=""+M,M&&M.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(M){if(!M)return"utf8";for(var T;;)switch(M){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return M;default:if(T)return;M=(""+M).toLowerCase(),T=!0}}function n(M){var T=r(M);if(typeof T!="string"&&(e.isEncoding===t||!t(M)))throw new Error("Unknown encoding: "+M);return T||M}bs.StringDecoder=i;function i(M){this.encoding=n(M);var T;switch(this.encoding){case"utf16le":this.text=R,this.end=y,T=4;break;case"utf8":this.fillLast=d,T=4;break;case"base64":this.text=C,this.end=x,T=3;break;default:this.write=B,this.end=O;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(T)}i.prototype.write=function(M){if(M.length===0)return"";var T,N;if(this.lastNeed){if(T=this.fillLast(M),T===void 0)return"";N=this.lastNeed,this.lastNeed=0}else N=0;return N<M.length?T?T+this.text(M,N):this.text(M,N):T||""},i.prototype.end=m,i.prototype.text=h,i.prototype.fillLast=function(M){if(this.lastNeed<=M.length)return M.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);M.copy(this.lastChar,this.lastTotal-this.lastNeed,0,M.length),this.lastNeed-=M.length};function s(M){return M<=127?0:M>>5===6?2:M>>4===14?3:M>>3===30?4:M>>6===2?-1:-2}function a(M,T,N){var D=T.length-1;if(D<N)return 0;var L=s(T[D]);return L>=0?(L>0&&(M.lastNeed=L-1),L):--D<N||L===-2?0:(L=s(T[D]),L>=0?(L>0&&(M.lastNeed=L-2),L):--D<N||L===-2?0:(L=s(T[D]),L>=0?(L>0&&(L===2?L=0:M.lastNeed=L-3),L):0))}function l(M,T,N){if((T[0]&192)!==128)return M.lastNeed=0,"<22>";if(M.lastNeed>1&&T.length>1){if((T[1]&192)!==128)return M.lastNeed=1,"<22>";if(M.lastNeed>2&&T.length>2&&(T[2]&192)!==128)return M.lastNeed=2,"<22>"}}function d(M){var T=this.lastTotal-this.lastNeed,N=l(this,M);if(N!==void 0)return N;if(this.lastNeed<=M.length)return M.copy(this.lastChar,T,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);M.copy(this.lastChar,T,0,M.length),this.lastNeed-=M.length}function h(M,T){var N=a(this,M,T);if(!this.lastNeed)return M.toString("utf8",T);this.lastTotal=N;var D=M.length-(N-this.lastNeed);return M.copy(this.lastChar,0,D),M.toString("utf8",T,D)}function m(M){var T=M&&M.length?this.write(M):"";return this.lastNeed?T+"<22>":T}function R(M,T){if((M.length-T)%2===0){var N=M.toString("utf16le",T);if(N){var D=N.charCodeAt(N.length-1);if(D>=55296&&D<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1],N.slice(0,-1)}return N}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=M[M.length-1],M.toString("utf16le",T,M.length-1)}function y(M){var T=M&&M.length?this.write(M):"";if(this.lastNeed){var N=this.lastTotal-this.lastNeed;return T+this.lastChar.toString("utf16le",0,N)}return T}function C(M,T){var N=(M.length-T)%3;return N===0?M.toString("base64",T):(this.lastNeed=3-N,this.lastTotal=3,N===1?this.lastChar[0]=M[M.length-1]:(this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1]),M.toString("base64",T,M.length-N))}function x(M){var T=M&&M.length?this.write(M):"";return this.lastNeed?T+this.lastChar.toString("base64",0,3-this.lastNeed):T}function B(M){return M.toString(this.encoding)}function O(M){return M&&M.length?this.write(M):""}return bs}var na=mr.codes.ERR_STREAM_PREMATURE_CLOSE;function af(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}function cf(){}function lf(e){return e.setHeader&&typeof e.abort=="function"}function Wc(e,t,r){if(typeof t=="function")return Wc(e,null,t);t||(t={}),r=af(r||cf);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=function(){e.writable||l()},a=e._writableState&&e._writableState.finished,l=function(){i=!1,a=!0,n||r.call(e)},d=e._readableState&&e._readableState.endEmitted,h=function(){n=!1,d=!0,i||r.call(e)},m=function(x){r.call(e,x)},R=function(){var x;if(n&&!d)return(!e._readableState||!e._readableState.ended)&&(x=new na),r.call(e,x);if(i&&!a)return(!e._writableState||!e._writableState.ended)&&(x=new na),r.call(e,x)},y=function(){e.req.on("finish",l)};return lf(e)?(e.on("complete",l),e.on("abort",R),e.req?y():e.on("request",y)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",h),e.on("finish",l),t.error!==!1&&e.on("error",m),e.on("close",R),function(){e.removeListener("complete",l),e.removeListener("abort",R),e.removeListener("request",y),e.req&&e.req.removeListener("finish",l),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",l),e.removeListener("end",h),e.removeListener("error",m),e.removeListener("close",R)}}var to=Wc,ws,ia;function uf(){if(ia)return ws;ia=1;var e={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},t;function r(D,L,F){return L=n(L),L in D?Object.defineProperty(D,L,{value:F,enumerable:!0,configurable:!0,writable:!0}):D[L]=F,D}function n(D){var L=i(D,"string");return typeof L=="symbol"?L:String(L)}function i(D,L){if(typeof D!="object"||D===null)return D;var F=D[Symbol.toPrimitive];if(F!==void 0){var W=F.call(D,L||"default");if(typeof W!="object")return W;throw new TypeError("@@toPrimitive must return a primitive value.")}return(L==="string"?String:Number)(D)}var s=to,a=Symbol("lastResolve"),l=Symbol("lastReject"),d=Symbol("error"),h=Symbol("ended"),m=Symbol("lastPromise"),R=Symbol("handlePromise"),y=Symbol("stream");function C(D,L){return{value:D,done:L}}function x(D){var L=D[a];if(L!==null){var F=D[y].read();F!==null&&(D[m]=null,D[a]=null,D[l]=null,L(C(F,!1)))}}function B(D){e.nextTick(x,D)}function O(D,L){return function(F,W){D.then(function(){if(L[h]){F(C(void 0,!0));return}L[R](F,W)},W)}}var M=Object.getPrototypeOf(function(){}),T=Object.setPrototypeOf((t={get stream(){return this[y]},next:function(){var L=this,F=this[d];if(F!==null)return Promise.reject(F);if(this[h])return Promise.resolve(C(void 0,!0));if(this[y].destroyed)return new Promise(function(z,X){e.nextTick(function(){L[d]?X(L[d]):z(C(void 0,!0))})});var W=this[m],te;if(W)te=new Promise(O(W,this));else{var Z=this[y].read();if(Z!==null)return Promise.resolve(C(Z,!1));te=new Promise(this[R])}return this[m]=te,te}},r(t,Symbol.asyncIterator,function(){return this}),r(t,"return",function(){var L=this;return new Promise(function(F,W){L[y].destroy(null,function(te){if(te){W(te);return}F(C(void 0,!0))})})}),t),M),N=function(L){var F,W=Object.create(T,(F={},r(F,y,{value:L,writable:!0}),r(F,a,{value:null,writable:!0}),r(F,l,{value:null,writable:!0}),r(F,d,{value:null,writable:!0}),r(F,h,{value:L._readableState.endEmitted,writable:!0}),r(F,R,{value:function(Z,z){var X=W[y].read();X?(W[m]=null,W[a]=null,W[l]=null,Z(C(X,!1))):(W[a]=Z,W[l]=z)},writable:!0}),F));return W[m]=null,s(L,function(te){if(te&&te.code!=="ERR_STREAM_PREMATURE_CLOSE"){var Z=W[l];Z!==null&&(W[m]=null,W[a]=null,W[l]=null,Z(te)),W[d]=te;return}var z=W[a];z!==null&&(W[m]=null,W[a]=null,W[l]=null,z(C(void 0,!0))),W[h]=!0}),L.on("readable",B.bind(null,W)),W};return ws=N,ws}var _s,sa;function hf(){return sa||(sa=1,_s=function(){throw new Error("Readable.from is not available in the browser")}),_s}var ys,oa;function Vc(){if(oa)return ys;oa=1;var e={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};ys=z;var t;z.ReadableState=Z,si.EventEmitter;var r=function(_,P){return _.listeners(P).length},n=Dc,i=ii.Buffer,s=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(b){return i.from(b)}function l(b){return i.isBuffer(b)||b instanceof s}var d=Ws,h;d&&d.debuglog?h=d.debuglog("stream"):h=function(){};var m=Jd(),R=Fc,y=Hc,C=y.getHighWaterMark,x=mr.codes,B=x.ERR_INVALID_ARG_TYPE,O=x.ERR_STREAM_PUSH_AFTER_EOF,M=x.ERR_METHOD_NOT_IMPLEMENTED,T=x.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,N,D,L;vt(z,n);var F=R.errorOrDestroy,W=["error","close","destroy","pause","resume"];function te(b,_,P){if(typeof b.prependListener=="function")return b.prependListener(_,P);!b._events||!b._events[_]?b.on(_,P):Array.isArray(b._events[_])?b._events[_].unshift(P):b._events[_]=[P,b._events[_]]}function Z(b,_,P){t=t||zr(),b=b||{},typeof P!="boolean"&&(P=_ instanceof t),this.objectMode=!!b.objectMode,P&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=C(this,b,"readableHighWaterMark",P),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(N||(N=ra().StringDecoder),this.decoder=new N(b.encoding),this.encoding=b.encoding)}function z(b){if(t=t||zr(),!(this instanceof z))return new z(b);var _=this instanceof t;this._readableState=new Z(b,this,_),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),n.call(this)}Object.defineProperty(z.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(_){this._readableState&&(this._readableState.destroyed=_)}}),z.prototype.destroy=R.destroy,z.prototype._undestroy=R.undestroy,z.prototype._destroy=function(b,_){_(b)},z.prototype.push=function(b,_){var P=this._readableState,j;return P.objectMode?j=!0:typeof b=="string"&&(_=_||P.defaultEncoding,_!==P.encoding&&(b=i.from(b,_),_=""),j=!0),X(this,b,_,!1,j)},z.prototype.unshift=function(b){return X(this,b,null,!0,!1)};function X(b,_,P,j,ue){h("readableAddChunk",_);var J=b._readableState;if(_===null)J.reading=!1,p(b,J);else{var Y;if(ue||(Y=S(J,_)),Y)F(b,Y);else if(J.objectMode||_&&_.length>0)if(typeof _!="string"&&!J.objectMode&&Object.getPrototypeOf(_)!==i.prototype&&(_=a(_)),j)J.endEmitted?F(b,new T):ne(b,J,_,!0);else if(J.ended)F(b,new O);else{if(J.destroyed)return!1;J.reading=!1,J.decoder&&!P?(_=J.decoder.write(_),J.objectMode||_.length!==0?ne(b,J,_,!1):k(b,J)):ne(b,J,_,!1)}else j||(J.reading=!1,k(b,J))}return!J.ended&&(J.length<J.highWaterMark||J.length===0)}function ne(b,_,P,j){_.flowing&&_.length===0&&!_.sync?(_.awaitDrain=0,b.emit("data",P)):(_.length+=_.objectMode?1:P.length,j?_.buffer.unshift(P):_.buffer.push(P),_.needReadable&&v(b)),k(b,_)}function S(b,_){var P;return!l(_)&&typeof _!="string"&&_!==void 0&&!b.objectMode&&(P=new B("chunk",["string","Buffer","Uint8Array"],_)),P}z.prototype.isPaused=function(){return this._readableState.flowing===!1},z.prototype.setEncoding=function(b){N||(N=ra().StringDecoder);var _=new N(b);this._readableState.decoder=_,this._readableState.encoding=this._readableState.decoder.encoding;for(var P=this._readableState.buffer.head,j="";P!==null;)j+=_.write(P.data),P=P.next;return this._readableState.buffer.clear(),j!==""&&this._readableState.buffer.push(j),this._readableState.length=j.length,this};var o=1073741824;function u(b){return b>=o?b=o:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function f(b,_){return b<=0||_.length===0&&_.ended?0:_.objectMode?1:b!==b?_.flowing&&_.length?_.buffer.head.data.length:_.length:(b>_.highWaterMark&&(_.highWaterMark=u(b)),b<=_.length?b:_.ended?_.length:(_.needReadable=!0,0))}z.prototype.read=function(b){h("read",b),b=parseInt(b,10);var _=this._readableState,P=b;if(b!==0&&(_.emittedReadable=!1),b===0&&_.needReadable&&((_.highWaterMark!==0?_.length>=_.highWaterMark:_.length>0)||_.ended))return h("read: emitReadable",_.length,_.ended),_.length===0&&_.ended?$(this):v(this),null;if(b=f(b,_),b===0&&_.ended)return _.length===0&&$(this),null;var j=_.needReadable;h("need readable",j),(_.length===0||_.length-b<_.highWaterMark)&&(j=!0,h("length less than watermark",j)),_.ended||_.reading?(j=!1,h("reading or ended",j)):j&&(h("do read"),_.reading=!0,_.sync=!0,_.length===0&&(_.needReadable=!0),this._read(_.highWaterMark),_.sync=!1,_.reading||(b=f(P,_)));var ue;return b>0?ue=I(b,_):ue=null,ue===null?(_.needReadable=_.length<=_.highWaterMark,b=0):(_.length-=b,_.awaitDrain=0),_.length===0&&(_.ended||(_.needReadable=!0),P!==b&&_.ended&&$(this)),ue!==null&&this.emit("data",ue),ue};function p(b,_){if(h("onEofChunk"),!_.ended){if(_.decoder){var P=_.decoder.end();P&&P.length&&(_.buffer.push(P),_.length+=_.objectMode?1:P.length)}_.ended=!0,_.sync?v(b):(_.needReadable=!1,_.emittedReadable||(_.emittedReadable=!0,E(b)))}}function v(b){var _=b._readableState;h("emitReadable",_.needReadable,_.emittedReadable),_.needReadable=!1,_.emittedReadable||(h("emitReadable",_.flowing),_.emittedReadable=!0,e.nextTick(E,b))}function E(b){var _=b._readableState;h("emitReadable_",_.destroyed,_.length,_.ended),!_.destroyed&&(_.length||_.ended)&&(b.emit("readable"),_.emittedReadable=!1),_.needReadable=!_.flowing&&!_.ended&&_.length<=_.highWaterMark,A(b)}function k(b,_){_.readingMore||(_.readingMore=!0,e.nextTick(g,b,_))}function g(b,_){for(;!_.reading&&!_.ended&&(_.length<_.highWaterMark||_.flowing&&_.length===0);){var P=_.length;if(h("maybeReadMore read 0"),b.read(0),P===_.length)break}_.readingMore=!1}z.prototype._read=function(b){F(this,new M("_read()"))},z.prototype.pipe=function(b,_){var P=this,j=this._readableState;switch(j.pipesCount){case 0:j.pipes=b;break;case 1:j.pipes=[j.pipes,b];break;default:j.pipes.push(b);break}j.pipesCount+=1,h("pipe count=%d opts=%j",j.pipesCount,_);var ue=(!_||_.end!==!1)&&b!==e.stdout&&b!==e.stderr,J=ue?at:le;j.endEmitted?e.nextTick(J):P.once("end",J),b.on("unpipe",Y);function Y(nt,ce){h("onunpipe"),nt===P&&ce&&ce.hasUnpiped===!1&&(ce.hasUnpiped=!0,Ht())}function at(){h("onend"),b.end()}var he=c(P);b.on("drain",he);var pe=!1;function Ht(){h("cleanup"),b.removeListener("close",xt),b.removeListener("finish",fe),b.removeListener("drain",he),b.removeListener("error",de),b.removeListener("unpipe",Y),P.removeListener("end",at),P.removeListener("end",le),P.removeListener("data",ge),pe=!0,j.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&he()}P.on("data",ge);function ge(nt){h("ondata");var ce=b.write(nt);h("dest.write",ce),ce===!1&&((j.pipesCount===1&&j.pipes===b||j.pipesCount>1&&G(j.pipes,b)!==-1)&&!pe&&(h("false write response, pause",j.awaitDrain),j.awaitDrain++),P.pause())}function de(nt){h("onerror",nt),le(),b.removeListener("error",de),r(b,"error")===0&&F(b,nt)}te(b,"error",de);function xt(){b.removeListener("finish",fe),le()}b.once("close",xt);function fe(){h("onfinish"),b.removeListener("close",xt),le()}b.once("finish",fe);function le(){h("unpipe"),P.unpipe(b)}return b.emit("pipe",P),j.flowing||(h("pipe resume"),P.resume()),b};function c(b){return function(){var P=b._readableState;h("pipeOnDrain",P.awaitDrain),P.awaitDrain&&P.awaitDrain--,P.awaitDrain===0&&r(b,"data")&&(P.flowing=!0,A(b))}}z.prototype.unpipe=function(b){var _=this._readableState,P={hasUnpiped:!1};if(_.pipesCount===0)return this;if(_.pipesCount===1)return b&&b!==_.pipes?this:(b||(b=_.pipes),_.pipes=null,_.pipesCount=0,_.flowing=!1,b&&b.emit("unpipe",this,P),this);if(!b){var j=_.pipes,ue=_.pipesCount;_.pipes=null,_.pipesCount=0,_.flowing=!1;for(var J=0;J<ue;J++)j[J].emit("unpipe",this,{hasUnpiped:!1});return this}var Y=G(_.pipes,b);return Y===-1?this:(_.pipes.splice(Y,1),_.pipesCount-=1,_.pipesCount===1&&(_.pipes=_.pipes[0]),b.emit("unpipe",this,P),this)},z.prototype.on=function(b,_){var P=n.prototype.on.call(this,b,_),j=this._readableState;return b==="data"?(j.readableListening=this.listenerCount("readable")>0,j.flowing!==!1&&this.resume()):b==="readable"&&!j.endEmitted&&!j.readableListening&&(j.readableListening=j.needReadable=!0,j.flowing=!1,j.emittedReadable=!1,h("on readable",j.length,j.reading),j.length?v(this):j.reading||e.nextTick(U,this)),P},z.prototype.addListener=z.prototype.on,z.prototype.removeListener=function(b,_){var P=n.prototype.removeListener.call(this,b,_);return b==="readable"&&e.nextTick(w,this),P},z.prototype.removeAllListeners=function(b){var _=n.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&e.nextTick(w,this),_};function w(b){var _=b._readableState;_.readableListening=b.listenerCount("readable")>0,_.resumeScheduled&&!_.paused?_.flowing=!0:b.listenerCount("data")>0&&b.resume()}function U(b){h("readable nexttick read 0"),b.read(0)}z.prototype.resume=function(){var b=this._readableState;return b.flowing||(h("resume"),b.flowing=!b.readableListening,H(this,b)),b.paused=!1,this};function H(b,_){_.resumeScheduled||(_.resumeScheduled=!0,e.nextTick(V,b,_))}function V(b,_){h("resume",_.reading),_.reading||b.read(0),_.resumeScheduled=!1,b.emit("resume"),A(b),_.flowing&&!_.reading&&b.read(0)}z.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function A(b){var _=b._readableState;for(h("flow",_.flowing);_.flowing&&b.read()!==null;);}z.prototype.wrap=function(b){var _=this,P=this._readableState,j=!1;b.on("end",function(){if(h("wrapped end"),P.decoder&&!P.ended){var Y=P.decoder.end();Y&&Y.length&&_.push(Y)}_.push(null)}),b.on("data",function(Y){if(h("wrapped data"),P.decoder&&(Y=P.decoder.write(Y)),!(P.objectMode&&Y==null)&&!(!P.objectMode&&(!Y||!Y.length))){var at=_.push(Y);at||(j=!0,b.pause())}});for(var ue in b)this[ue]===void 0&&typeof b[ue]=="function"&&(this[ue]=function(at){return function(){return b[at].apply(b,arguments)}}(ue));for(var J=0;J<W.length;J++)b.on(W[J],this.emit.bind(this,W[J]));return this._read=function(Y){h("wrapped _read",Y),j&&(j=!1,b.resume())},this},typeof Symbol=="function"&&(z.prototype[Symbol.asyncIterator]=function(){return D===void 0&&(D=uf()),D(this)}),Object.defineProperty(z.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(z.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(z.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(_){this._readableState&&(this._readableState.flowing=_)}}),z._fromList=I,Object.defineProperty(z.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function I(b,_){if(_.length===0)return null;var P;return _.objectMode?P=_.buffer.shift():!b||b>=_.length?(_.decoder?P=_.buffer.join(""):_.buffer.length===1?P=_.buffer.first():P=_.buffer.concat(_.length),_.buffer.clear()):P=_.buffer.consume(b,_.decoder),P}function $(b){var _=b._readableState;h("endReadable",_.endEmitted),_.endEmitted||(_.ended=!0,e.nextTick(K,_,b))}function K(b,_){if(h("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,_.readable=!1,_.emit("end"),b.autoDestroy)){var P=_._writableState;(!P||P.autoDestroy&&P.finished)&&_.destroy()}}typeof Symbol=="function"&&(z.from=function(b,_){return L===void 0&&(L=hf()),L(z,b,_)});function G(b,_){for(var P=0,j=b.length;P<j;P++)if(b[P]===_)return P;return-1}return ys}var zc=Lt,Li=mr.codes,df=Li.ERR_METHOD_NOT_IMPLEMENTED,ff=Li.ERR_MULTIPLE_CALLBACK,pf=Li.ERR_TRANSFORM_ALREADY_TRANSFORMING,gf=Li.ERR_TRANSFORM_WITH_LENGTH_0,Oi=zr();vt(Lt,Oi);function mf(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new ff);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Lt(e){if(!(this instanceof Lt))return new Lt(e);Oi.call(this,e),this._transformState={afterTransform:mf.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",vf)}function vf(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){aa(e,t,r)}):aa(this,null,null)}Lt.prototype.push=function(e,t){return this._transformState.needTransform=!1,Oi.prototype.push.call(this,e,t)};Lt.prototype._transform=function(e,t,r){r(new df("_transform()"))};Lt.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};Lt.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Lt.prototype._destroy=function(e,t){Oi.prototype._destroy.call(this,e,function(r){t(r)})};function aa(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new gf;if(e._transformState.transforming)throw new pf;return e.push(null)}var bf=dn,qc=zc;vt(dn,qc);function dn(e){if(!(this instanceof dn))return new dn(e);qc.call(this,e)}dn.prototype._transform=function(e,t,r){r(null,e)};var Es;function wf(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var Jc=mr.codes,_f=Jc.ERR_MISSING_ARGS,yf=Jc.ERR_STREAM_DESTROYED;function ca(e){if(e)throw e}function Ef(e){return e.setHeader&&typeof e.abort=="function"}function Sf(e,t,r,n){n=wf(n);var i=!1;e.on("close",function(){i=!0}),Es===void 0&&(Es=to),Es(e,{readable:t,writable:r},function(a){if(a)return n(a);i=!0,n()});var s=!1;return function(a){if(!i&&!s){if(s=!0,Ef(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(a||new yf("pipe"))}}}function la(e){e()}function Rf(e,t){return e.pipe(t)}function Mf(e){return!e.length||typeof e[e.length-1]!="function"?ca:e.pop()}function kf(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=Mf(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new _f("streams");var i,s=t.map(function(a,l){var d=l<t.length-1,h=l>0;return Sf(a,d,h,function(m){i||(i=m),m&&s.forEach(la),!d&&(s.forEach(la),n(i))})});return t.reduce(Rf)}var Cf=kf;(function(e,t){t=e.exports=Vc(),t.Stream=t,t.Readable=t,t.Writable=Uc(),t.Duplex=zr(),t.Transform=zc,t.PassThrough=bf,t.finished=to,t.pipeline=Cf})($s,$s.exports);var Gc=$s.exports;const{Transform:If}=Gc;var xf=e=>class Zc extends If{constructor(r,n,i,s,a){super(a),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=a,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(a){s=a}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new Zc(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:Af}=Gc;var Tf=e=>class Kc extends Af{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(a){s=a}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new Kc(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const Nf=xf,Lf=Tf;var Of=function(e){const t=Nf(e),r=Lf(e);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}},Qc={};const ua=[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];Qc.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],m=e[8]^e[18]^e[28]^e[38]^e[48],R=e[9]^e[19]^e[29]^e[39]^e[49];let y=m^(i<<1|s>>>31),C=R^(s<<1|i>>>31);const x=e[0]^y,B=e[1]^C,O=e[10]^y,M=e[11]^C,T=e[20]^y,N=e[21]^C,D=e[30]^y,L=e[31]^C,F=e[40]^y,W=e[41]^C;y=r^(a<<1|l>>>31),C=n^(l<<1|a>>>31);const te=e[2]^y,Z=e[3]^C,z=e[12]^y,X=e[13]^C,ne=e[22]^y,S=e[23]^C,o=e[32]^y,u=e[33]^C,f=e[42]^y,p=e[43]^C;y=i^(d<<1|h>>>31),C=s^(h<<1|d>>>31);const v=e[4]^y,E=e[5]^C,k=e[14]^y,g=e[15]^C,c=e[24]^y,w=e[25]^C,U=e[34]^y,H=e[35]^C,V=e[44]^y,A=e[45]^C;y=a^(m<<1|R>>>31),C=l^(R<<1|m>>>31);const I=e[6]^y,$=e[7]^C,K=e[16]^y,G=e[17]^C,b=e[26]^y,_=e[27]^C,P=e[36]^y,j=e[37]^C,ue=e[46]^y,J=e[47]^C;y=d^(r<<1|n>>>31),C=h^(n<<1|r>>>31);const Y=e[8]^y,at=e[9]^C,he=e[18]^y,pe=e[19]^C,Ht=e[28]^y,ge=e[29]^C,de=e[38]^y,xt=e[39]^C,fe=e[48]^y,le=e[49]^C,nt=x,ce=B,me=M<<4|O>>>28,wr=O<<4|M>>>28,ve=T<<3|N>>>29,be=N<<3|T>>>29,_r=L<<9|D>>>23,we=D<<9|L>>>23,_e=F<<18|W>>>14,yr=W<<18|F>>>14,ye=te<<1|Z>>>31,Ee=Z<<1|te>>>31,Er=X<<12|z>>>20,Se=z<<12|X>>>20,Re=ne<<10|S>>>22,Sr=S<<10|ne>>>22,Me=u<<13|o>>>19,ke=o<<13|u>>>19,Rr=f<<2|p>>>30,Ce=p<<2|f>>>30,Ie=E<<30|v>>>2,Mr=v<<30|E>>>2,xe=k<<6|g>>>26,Ae=g<<6|k>>>26,kr=w<<11|c>>>21,Te=c<<11|w>>>21,Ne=U<<15|H>>>17,Cr=H<<15|U>>>17,Le=A<<29|V>>>3,Oe=V<<29|A>>>3,Ir=I<<28|$>>>4,Pe=$<<28|I>>>4,$e=G<<23|K>>>9,xr=K<<23|G>>>9,Be=b<<25|_>>>7,De=_<<25|b>>>7,Ut=P<<21|j>>>11,Wt=j<<21|P>>>11,Vt=J<<24|ue>>>8,zt=ue<<24|J>>>8,qt=Y<<27|at>>>5,Jt=at<<27|Y>>>5,Gt=he<<20|pe>>>12,Zt=pe<<20|he>>>12,Kt=ge<<7|Ht>>>25,Qt=Ht<<7|ge>>>25,Yt=de<<8|xt>>>24,Xt=xt<<8|de>>>24,er=fe<<14|le>>>18,tr=le<<14|fe>>>18;e[0]=nt^~Er&kr,e[1]=ce^~Se&Te,e[10]=Ir^~Gt&ve,e[11]=Pe^~Zt&be,e[20]=ye^~xe&Be,e[21]=Ee^~Ae&De,e[30]=qt^~me&Re,e[31]=Jt^~wr&Sr,e[40]=Ie^~$e&Kt,e[41]=Mr^~xr&Qt,e[2]=Er^~kr&Ut,e[3]=Se^~Te&Wt,e[12]=Gt^~ve&Me,e[13]=Zt^~be&ke,e[22]=xe^~Be&Yt,e[23]=Ae^~De&Xt,e[32]=me^~Re&Ne,e[33]=wr^~Sr&Cr,e[42]=$e^~Kt&_r,e[43]=xr^~Qt&we,e[4]=kr^~Ut&er,e[5]=Te^~Wt&tr,e[14]=ve^~Me&Le,e[15]=be^~ke&Oe,e[24]=Be^~Yt&_e,e[25]=De^~Xt&yr,e[34]=Re^~Ne&Vt,e[35]=Sr^~Cr&zt,e[44]=Kt^~_r&Rr,e[45]=Qt^~we&Ce,e[6]=Ut^~er&nt,e[7]=Wt^~tr&ce,e[16]=Me^~Le&Ir,e[17]=ke^~Oe&Pe,e[26]=Yt^~_e&ye,e[27]=Xt^~yr&Ee,e[36]=Ne^~Vt&qt,e[37]=Cr^~zt&Jt,e[46]=_r^~Rr&Ie,e[47]=we^~Ce&Mr,e[8]=er^~nt&Er,e[9]=tr^~ce&Se,e[18]=Le^~Ir&Gt,e[19]=Oe^~Pe&Zt,e[28]=_e^~ye&xe,e[29]=yr^~Ee&Ae,e[38]=Vt^~qt&me,e[39]=zt^~Jt&wr,e[48]=Rr^~Ie&$e,e[49]=Ce^~Mr&xr,e[0]^=ua[t*2],e[1]^=ua[t*2+1]}};const ti=Qc;function tn(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}tn.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};tn.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<8*(this.count%4),this.count+=1,this.count===this.blockSize&&(ti.p1600(this.state),this.count=0)};tn.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<8*(this.count%4),e&128&&this.count===this.blockSize-1&&ti.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<8*((this.blockSize-1)%4),ti.p1600(this.state),this.count=0,this.squeezing=!0};tn.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);const t=Buffer.alloc(e);for(let r=0;r<e;++r)t[r]=this.state[~~(this.count/4)]>>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(ti.p1600(this.state),this.count=0);return t};tn.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var Pf=tn,$f=Of(Pf);const Bf=$f,Df=ci;function Yc(e){return Buffer.allocUnsafe(e).fill(0)}function Xc(e,t,r){const n=Yc(t);return e=Pi(e),r?e.length<t?(e.copy(n),n):e.slice(0,t):e.length<t?(e.copy(n,t-e.length),n):e.slice(-t)}function Ff(e,t){return Xc(e,t,!0)}function Pi(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);else if(typeof e=="string")el(e)?e=Buffer.from(Uf(tl(e)),"hex"):e=Buffer.from(e);else if(typeof e=="number")e=intToBuffer(e);else if(e==null)e=Buffer.allocUnsafe(0);else if(Df.isBN(e))e=e.toArrayLike(Buffer);else if(e.toArray)e=Buffer.from(e.toArray());else throw new Error("invalid type");return e}function jf(e){return e=Pi(e),"0x"+e.toString("hex")}function Hf(e,t){return e=Pi(e),t||(t=256),Bf("keccak"+t).update(e).digest()}function Uf(e){return e.length%2?"0"+e:e}function el(e){return typeof e=="string"&&e.match(/^0x[0-9A-Fa-f]*$/)}function tl(e){return typeof e=="string"&&e.startsWith("0x")?e.slice(2):e}var rl={zeros:Yc,setLength:Xc,setLengthRight:Ff,isHexString:el,stripHexPrefix:tl,toBuffer:Pi,bufferToHex:jf,keccak:Hf};const dr=rl,lr=ci;function nl(e){return e.startsWith("int[")?"int256"+e.slice(3):e==="int"?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):e==="uint"?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):e==="fixed"?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):e==="ufixed"?"ufixed128x128":e}function Fr(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function ha(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function il(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?t[2]===""?"dynamic":parseInt(t[2],10):null}function ar(e){var t=typeof e;if(t==="string")return dr.isHexString(e)?new lr(dr.stripHexPrefix(e),16):new lr(e,10);if(t==="number")return new lr(e);if(e.toArray)return e;throw new Error("Argument is not a number")}function St(e,t){var r,n,i,s;if(e==="address")return St("uint160",ar(t));if(e==="bool")return St("uint8",t?1:0);if(e==="string")return St("bytes",new Buffer(t,"utf8"));if(Vf(e)){if(typeof t.length>"u")throw new Error("Not an array?");if(r=il(e),r!=="dynamic"&&r!==0&&t.length>r)throw new Error("Elements exceed array size: "+r);i=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(s in t)i.push(St(e,t[s]));if(r==="dynamic"){var a=St("uint256",t.length);i.unshift(a)}return Buffer.concat(i)}else{if(e==="bytes")return t=new Buffer(t),i=Buffer.concat([St("uint256",t.length),t]),t.length%32!==0&&(i=Buffer.concat([i,dr.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if(r=Fr(e),r<1||r>32)throw new Error("Invalid bytes<N> width: "+r);return dr.setLengthRight(t,32)}else if(e.startsWith("uint")){if(r=Fr(e),r%8||r<8||r>256)throw new Error("Invalid uint<N> width: "+r);if(n=ar(t),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(Buffer,"be",32)}else if(e.startsWith("int")){if(r=Fr(e),r%8||r<8||r>256)throw new Error("Invalid int<N> width: "+r);if(n=ar(t),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(Buffer,"be",32)}else if(e.startsWith("ufixed")){if(r=ha(e),n=ar(t),n<0)throw new Error("Supplied ufixed is negative");return St("uint256",n.mul(new lr(2).pow(new lr(r[1]))))}else if(e.startsWith("fixed"))return r=ha(e),St("int256",ar(t).mul(new lr(2).pow(new lr(r[1]))))}throw new Error("Unsupported or invalid type: "+e)}function Wf(e){return e==="string"||e==="bytes"||il(e)==="dynamic"}function Vf(e){return e.lastIndexOf("]")===e.length-1}function zf(e,t){var r=[],n=[],i=32*e.length;for(var s in e){var a=nl(e[s]),l=t[s],d=St(a,l);Wf(a)?(r.push(St("uint256",i)),n.push(d),i+=d.length):r.push(d)}return Buffer.concat(r.concat(n))}function sl(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s<e.length;s++){var a=nl(e[s]),l=t[s];if(a==="bytes")i.push(l);else if(a==="string")i.push(new Buffer(l,"utf8"));else if(a==="bool")i.push(new Buffer(l?"01":"00","hex"));else if(a==="address")i.push(dr.setLength(l,20));else if(a.startsWith("bytes")){if(r=Fr(a),r<1||r>32)throw new Error("Invalid bytes<N> width: "+r);i.push(dr.setLengthRight(l,r))}else if(a.startsWith("uint")){if(r=Fr(a),r%8||r<8||r>256)throw new Error("Invalid uint<N> width: "+r);if(n=ar(l),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());i.push(n.toArrayLike(Buffer,"be",r/8))}else if(a.startsWith("int")){if(r=Fr(a),r%8||r<8||r>256)throw new Error("Invalid int<N> width: "+r);if(n=ar(l),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());i.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function qf(e,t){return dr.keccak(sl(e,t))}var Jf={rawEncode:zf,solidityPack:sl,soliditySHA3:qf};const mt=rl,un=Jf,ol={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},Ss={encodeData(e,t,r,n=!0){const i=["bytes32"],s=[this.hashType(e,r)];if(n){const a=(l,d,h)=>{if(r[d]!==void 0)return["bytes32",h==null?"0x0000000000000000000000000000000000000000000000000000000000000000":mt.keccak(this.encodeData(d,h,r,n))];if(h===void 0)throw new Error(`missing value for field ${l} of type ${d}`);if(d==="bytes")return["bytes32",mt.keccak(h)];if(d==="string")return typeof h=="string"&&(h=Buffer.from(h,"utf8")),["bytes32",mt.keccak(h)];if(d.lastIndexOf("]")===d.length-1){const m=d.slice(0,d.lastIndexOf("[")),R=h.map(y=>a(l,m,y));return["bytes32",mt.keccak(un.rawEncode(R.map(([y])=>y),R.map(([,y])=>y)))]}return[d,h]};for(const l of r[e]){const[d,h]=a(l.name,l.type,t[l.name]);i.push(d),s.push(h)}}else for(const a of r[e]){let l=t[a.name];if(l!==void 0)if(a.type==="bytes")i.push("bytes32"),l=mt.keccak(l),s.push(l);else if(a.type==="string")i.push("bytes32"),typeof l=="string"&&(l=Buffer.from(l,"utf8")),l=mt.keccak(l),s.push(l);else if(r[a.type]!==void 0)i.push("bytes32"),l=mt.keccak(this.encodeData(a.type,l,r,n)),s.push(l);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),s.push(l)}}return un.rawEncode(i,s)},encodeType(e,t){let r="",n=this.findTypeDependencies(e,t).filter(i=>i!==e);n=[e].concat(n.sort());for(const i of n){if(!t[i])throw new Error("No type definition specified: "+i);r+=i+"("+t[i].map(({name:a,type:l})=>l+" "+a).join(",")+")"}return r},findTypeDependencies(e,t,r=[]){if(e=e.match(/^\w*/)[0],r.includes(e)||t[e]===void 0)return r;r.push(e);for(const n of t[e])for(const i of this.findTypeDependencies(n.type,t,r))!r.includes(i)&&r.push(i);return r},hashStruct(e,t,r,n=!0){return mt.keccak(this.encodeData(e,t,r,n))},hashType(e,t){return mt.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const r in ol.properties)e[r]&&(t[r]=e[r]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const r=this.sanitizeData(e),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,t)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,t)),mt.keccak(Buffer.concat(n))}};var Gf={TYPED_MESSAGE_SCHEMA:ol,TypedDataUtils:Ss,hashForSignTypedDataLegacy:function(e){return Zf(e.data)},hashForSignTypedData_v3:function(e){return Ss.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Ss.hash(e.data)}};function Zf(e){const t=new Error("Expect argument to be non-empty array");if(typeof e!="object"||!e.length)throw t;const r=e.map(function(s){return s.type==="bytes"?mt.toBuffer(s.value):s.value}),n=e.map(function(s){return s.type}),i=e.map(function(s){if(!s.name)throw t;return s.type+" "+s.name});return un.soliditySHA3(["bytes32","bytes32"],[un.soliditySHA3(new Array(e.length).fill("string"),i),un.soliditySHA3(n,r)])}var qr={};Object.defineProperty(qr,"__esModule",{value:!0});qr.filterFromParam=qr.FilterPolyfill=void 0;const $r=Ve,Ye=q,Kf=5*60*1e3,cr={jsonrpc:"2.0",id:0};class Qf{constructor(t){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,$r.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=t}async newFilter(t){const r=al(t),n=this.makeFilterId(),i=await this.setInitialCursorPosition(n,r.fromBlock);return console.info(`Installing new log filter(${n}):`,r,"initial cursor position:",i),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,Ye.hexStringFromIntNumber)(n)}async newBlockFilter(){const t=this.makeFilterId(),r=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,r),this.blockFilters.add(t),this.setFilterTimeout(t),(0,Ye.hexStringFromIntNumber)(t)}async newPendingTransactionFilter(){const t=this.makeFilterId(),r=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,r),this.pendingTransactionFilters.add(t),this.setFilterTimeout(t),(0,Ye.hexStringFromIntNumber)(t)}uninstallFilter(t){const r=(0,Ye.intNumberFromHexString)(t);return console.info(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(t){const r=(0,Ye.intNumberFromHexString)(t);return this.timeouts.has(r)&&this.setFilterTimeout(r),this.logFilters.has(r)?this.getLogFilterChanges(r):this.blockFilters.has(r)?this.getBlockFilterChanges(r):this.pendingTransactionFilters.has(r)?this.getPendingTransactionFilterChanges(r):Promise.resolve(Vn())}async getFilterLogs(t){const r=(0,Ye.intNumberFromHexString)(t),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getLogs",params:[da(n)]})):Vn()}makeFilterId(){return(0,$r.IntNumber)(++this.nextFilterId)}sendAsyncPromise(t){return new Promise((r,n)=>{this.provider.sendAsync(t,(i,s)=>{if(i)return n(i);if(Array.isArray(s)||s==null)return n(new Error(`unexpected response received: ${JSON.stringify(s)}`));r(s)})})}deleteFilter(t){console.info(`Deleting filter (${t})`),this.logFilters.delete(t),this.blockFilters.delete(t),this.pendingTransactionFilters.delete(t),this.cursors.delete(t),this.timeouts.delete(t)}async getLogFilterChanges(t){const r=this.logFilters.get(t),n=this.cursors.get(t);if(!n||!r)return Vn();const i=await this.getCurrentBlockHeight(),s=r.toBlock==="latest"?i:r.toBlock;if(n>i||n>Number(r.toBlock))return zn();console.info(`Fetching logs from ${n} to ${s} for filter ${t}`);const a=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getLogs",params:[da(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:s}))]}));if(Array.isArray(a.result)){const l=a.result.map(h=>(0,Ye.intNumberFromHexString)(h.blockNumber||"0x0")),d=Math.max(...l);if(d&&d>n){const h=(0,$r.IntNumber)(d+1);console.info(`Moving cursor position for filter (${t}) from ${n} to ${h}`),this.cursors.set(t,h)}}return a}async getBlockFilterChanges(t){const r=this.cursors.get(t);if(!r)return Vn();const n=await this.getCurrentBlockHeight();if(r>n)return zn();console.info(`Fetching blocks from ${r} to ${n} for filter (${t})`);const i=(await Promise.all((0,Ye.range)(r,n+1).map(a=>this.getBlockHashByNumber((0,$r.IntNumber)(a))))).filter(a=>!!a),s=(0,$r.IntNumber)(r+i.length);return console.info(`Moving cursor position for filter (${t}) from ${r} to ${s}`),this.cursors.set(t,s),Object.assign(Object.assign({},cr),{result:i})}async getPendingTransactionFilterChanges(t){return Promise.resolve(zn())}async setInitialCursorPosition(t,r){const n=await this.getCurrentBlockHeight(),i=typeof r=="number"&&r>n?r:n;return this.cursors.set(t,i),i}setFilterTimeout(t){const r=this.timeouts.get(t);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.info(`Filter (${t}) timed out`),this.deleteFilter(t)},Kf);this.timeouts.set(t,n)}async getCurrentBlockHeight(){const t=new Date;if(t.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=t;const r=await this._getCurrentBlockHeight();this.currentBlockHeight=r,this.resolvers.forEach(n=>n(r)),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise(r=>this.resolvers.push(r))}async _getCurrentBlockHeight(){const{result:t}=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_blockNumber",params:[]}));return(0,Ye.intNumberFromHexString)((0,Ye.ensureHexString)(t))}async getBlockHashByNumber(t){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getBlockByNumber",params:[(0,Ye.hexStringFromIntNumber)(t),!1]}));return r.result&&typeof r.result.hash=="string"?(0,Ye.ensureHexString)(r.result.hash):null}}qr.FilterPolyfill=Qf;function al(e){return{fromBlock:fa(e.fromBlock),toBlock:fa(e.toBlock),addresses:e.address===void 0?null:Array.isArray(e.address)?e.address:[e.address],topics:e.topics||[]}}qr.filterFromParam=al;function da(e){const t={fromBlock:pa(e.fromBlock),toBlock:pa(e.toBlock),topics:e.topics};return e.addresses!==null&&(t.address=e.addresses),t}function fa(e){if(e===void 0||e==="latest"||e==="pending")return"latest";if(e==="earliest")return(0,$r.IntNumber)(0);if((0,Ye.isHexString)(e))return(0,Ye.intNumberFromHexString)(e);throw new Error(`Invalid block option: ${String(e)}`)}function pa(e){return e==="latest"?e:(0,Ye.hexStringFromIntNumber)(e)}function Vn(){return Object.assign(Object.assign({},cr),{error:{code:-32e3,message:"filter not found"}})}function zn(){return Object.assign(Object.assign({},cr),{result:[]})}var $i={},cl={},Bi={},ro=Yf;function Yf(e){e=e||{};var t=e.max||Number.MAX_SAFE_INTEGER,r=typeof e.start<"u"?e.start:Math.floor(Math.random()*t);return function(){return r=r%t,r++}}const ga=(e,t)=>function(){const r=t.promiseModule,n=new Array(arguments.length);for(let i=0;i<arguments.length;i++)n[i]=arguments[i];return new r((i,s)=>{t.errorFirst?n.push(function(a,l){if(t.multiArgs){const d=new Array(arguments.length-1);for(let h=1;h<arguments.length;h++)d[h-1]=arguments[h];a?(d.unshift(a),s(d)):i(d)}else a?s(a):i(l)}):n.push(function(a){if(t.multiArgs){const l=new Array(arguments.length-1);for(let d=0;d<arguments.length;d++)l[d]=arguments[d];i(l)}else i(a)}),e.apply(this,n)})};var Xf=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=i=>{const s=a=>typeof a=="string"?i===a:a.test(i);return t.include?t.include.some(s):!t.exclude.some(s)};let n;typeof e=="function"?n=function(){return t.excludeMain?e.apply(this,arguments):ga(e,t).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(e));for(const i in e){const s=e[i];n[i]=typeof s=="function"&&r(i)?ga(s,t):s}return n},xn={},An={};Object.defineProperty(An,"__esModule",{value:!0});const e0=si;function ma(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function t0(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}let r0=class extends e0.EventEmitter{emit(t,...r){let n=t==="error";const i=this._events;if(i!==void 0)n=n&&i.error===void 0;else if(!n)return!1;if(n){let a;if(r.length>0&&([a]=r),a instanceof Error)throw a;const l=new Error(`Unhandled error.${a?` (${a.message})`:""}`);throw l.context=a,l}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")ma(s,this,r);else{const a=s.length,l=t0(s);for(let d=0;d<a;d+=1)ma(l[d],this,r)}return!0}};An.default=r0;var n0=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xn,"__esModule",{value:!0});xn.BaseBlockTracker=void 0;const i0=n0(An),s0=1e3,o0=(e,t)=>e+t,va=["sync","latest"];class a0 extends i0.default{constructor(t){super(),this._blockResetDuration=t.blockResetDuration||20*s0,this._usePastBlocks=t.usePastBlocks||!1,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(r=>this.once("latest",r))}removeAllListeners(t){return t?super.removeAllListeners(t):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(t){va.includes(t)&&this._maybeStart()}_onRemoveListener(){this._getBlockTrackerEventCount()>0||this._maybeEnd()}async _maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),await this._start(),this.emit("_started"))}async _maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),await this._end(),this.emit("_ended"))}_getBlockTrackerEventCount(){return va.map(t=>this.listenerCount(t)).reduce(o0)}_shouldUseNewBlock(t){const r=this._currentBlock;if(!r)return!0;const n=ba(t),i=ba(r);return this._usePastBlocks&&n<i||n>i}_newPotentialLatest(t){this._shouldUseNewBlock(t)&&this._setCurrentBlock(t)}_setCurrentBlock(t){const r=this._currentBlock;this._currentBlock=t,this.emit("latest",t),this.emit("sync",{oldBlock:r,newBlock:t})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}xn.BaseBlockTracker=a0;function ba(e){return Number.parseInt(e,16)}var ll={},ul={},Ke={};class hl extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...a}=t,{path:l}=t,d=l.length===0?i:`At path: ${l.join(".")} -- ${i}`;super(s??d),s!=null&&(this.cause=d),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function c0(e){return ft(e)&&typeof e[Symbol.iterator]=="function"}function ft(e){return typeof e=="object"&&e!=null}function wa(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function ze(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function l0(e){const{done:t,value:r}=e.next();return t?void 0:r}function u0(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:a}=r,{refinement:l,message:d=`Expected a value of type \`${a}\`${l?` with refinement \`${l}\``:""}, but received: \`${ze(n)}\``}=e;return{value:n,type:a,refinement:l,key:i[i.length-1],path:i,branch:s,...e,message:d}}function*Ds(e,t,r,n){c0(e)||(e=[e]);for(const i of e){const s=u0(i,t,r,n);s&&(yield s)}}function*no(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:a=!1}=r,l={path:n,branch:i};if(s&&(e=t.coercer(e,l),a&&t.type!=="type"&&ft(t.schema)&&ft(e)&&!Array.isArray(e)))for(const h in e)t.schema[h]===void 0&&delete e[h];let d="valid";for(const h of t.validator(e,l))h.explanation=r.message,d="not_valid",yield[h,void 0];for(let[h,m,R]of t.entries(e,l)){const y=no(m,R,{path:h===void 0?n:[...n,h],branch:h===void 0?i:[...i,m],coerce:s,mask:a,message:r.message});for(const C of y)C[0]?(d=C[0].refinement!=null?"not_refined":"not_valid",yield[C[0],void 0]):s&&(m=C[1],h===void 0?e=m:e instanceof Map?e.set(h,m):e instanceof Set?e.add(m):ft(e)&&(m!==void 0||h in e)&&(e[h]=m))}if(d!=="not_valid")for(const h of t.refiner(e,l))h.explanation=r.message,d="not_refined",yield[h,void 0];d==="valid"&&(yield[void 0,e])}class Ue{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:a=d=>d,entries:l=function*(){}}=t;this.type=r,this.schema=n,this.entries=l,this.coercer=a,i?this.validator=(d,h)=>{const m=i(d,h);return Ds(m,h,this,d)}:this.validator=()=>[],s?this.refiner=(d,h)=>{const m=s(d,h);return Ds(m,h,this,d)}:this.refiner=()=>[]}assert(t,r){return dl(t,this,r)}create(t,r){return fl(t,this,r)}is(t){return io(t,this)}mask(t,r){return pl(t,this,r)}validate(t,r={}){return rn(t,this,r)}}function dl(e,t,r){const n=rn(e,t,{message:r});if(n[0])throw n[0]}function fl(e,t,r){const n=rn(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function pl(e,t,r){const n=rn(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function io(e,t){return!rn(e,t)[0]}function rn(e,t,r={}){const n=no(e,t,r),i=l0(n);return i[0]?[new hl(i[0],function*(){for(const a of n)a[0]&&(yield a[0])}),void 0]:[void 0,i[1]]}function h0(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?Nn(n):Tn(n)}function rt(e,t){return new Ue({type:e,schema:null,validator:t})}function d0(e,t){return new Ue({...e,refiner:(r,n)=>r===void 0||e.refiner(r,n),validator(r,n){return r===void 0?!0:(t(r,n),e.validator(r,n))}})}function f0(e){return new Ue({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function p0(e){let t;return new Ue({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator(r,n){return t??(t=e()),t.validator(r,n)},coercer(r,n){return t??(t=e()),t.coercer(r,n)},refiner(r,n){return t??(t=e()),t.refiner(r,n)}})}function g0(e,t){const{schema:r}=e,n={...r};for(const i of t)delete n[i];switch(e.type){case"type":return Nn(n);default:return Tn(n)}}function m0(e){const t=e instanceof Ue,r=t?{...e.schema}:{...e};for(const n in r)r[n]=gl(r[n]);return t&&e.type==="type"?Nn(r):Tn(r)}function v0(e,t){const{schema:r}=e,n={};for(const i of t)n[i]=r[i];switch(e.type){case"type":return Nn(n);default:return Tn(n)}}function b0(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),rt(e,t)}function w0(){return rt("any",()=>!0)}function _0(e){return new Ue({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${ze(t)}`}})}function y0(){return rt("bigint",e=>typeof e=="bigint")}function E0(){return rt("boolean",e=>typeof e=="boolean")}function S0(){return rt("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${ze(e)}`)}function R0(e){const t={},r=e.map(n=>ze(n)).join();for(const n of e)t[n]=n;return new Ue({type:"enums",schema:t,validator(n){return e.includes(n)||`Expected one of \`${r}\`, but received: ${ze(n)}`}})}function M0(){return rt("func",e=>typeof e=="function"||`Expected a function, but received: ${ze(e)}`)}function k0(e){return rt("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${ze(t)}`)}function C0(){return rt("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${ze(e)}`)}function I0(e){return new Ue({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})}function x0(e){const t=ze(e),r=typeof e;return new Ue({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${ze(n)}`}})}function A0(e,t){return new Ue({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${ze(r)}`}})}function so(){return rt("never",()=>!1)}function T0(e){return new Ue({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function N0(){return rt("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${ze(e)}`)}function Tn(e){const t=e?Object.keys(e):[],r=so();return new Ue({type:"object",schema:e||null,*entries(n){if(e&&ft(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return ft(n)||`Expected an object, but received: ${ze(n)}`},coercer(n){return ft(n)?{...n}:n}})}function gl(e){return new Ue({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function L0(e,t){return new Ue({type:"record",schema:null,*entries(r){if(ft(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return ft(r)||`Expected an object, but received: ${ze(r)}`}})}function O0(){return rt("regexp",e=>e instanceof RegExp)}function P0(e){return new Ue({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${ze(t)}`}})}function ml(){return rt("string",e=>typeof e=="string"||`Expected a string, but received: ${ze(e)}`)}function $0(e){const t=so();return new Ue({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${ze(r)}`}})}function Nn(e){const t=Object.keys(e);return new Ue({type:"type",schema:e,*entries(r){if(ft(r))for(const n of t)yield[n,r[n],e[n]]},validator(r){return ft(r)||`Expected an object, but received: ${ze(r)}`},coercer(r){return ft(r)?{...r}:r}})}function B0(e){const t=e.map(r=>r.type).join(" | ");return new Ue({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...a]=no(r,s,n),[l]=a;if(l[0])for(const[d]of a)d&&i.push(d);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ze(r)}`,...i]}})}function vl(){return rt("unknown",()=>!0)}function oo(e,t,r){return new Ue({...e,coercer:(n,i)=>io(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function D0(e,t,r={}){return oo(e,vl(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&wa(n)&&wa(i)){const s={...n};let a=!1;for(const l in i)s[l]===void 0&&(s[l]=i[l],a=!0);if(a)return s}return n})}function F0(e){return oo(e,ml(),t=>t.trim())}function j0(e){return vr(e,"empty",t=>{const r=bl(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function bl(e){return e instanceof Map||e instanceof Set?e.size:e.length}function H0(e,t,r={}){const{exclusive:n}=r;return vr(e,"max",i=>n?i<t:i<=t||`Expected a ${e.type} less than ${n?"":"or equal to "}${t} but received \`${i}\``)}function U0(e,t,r={}){const{exclusive:n}=r;return vr(e,"min",i=>n?i>t:i>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${i}\``)}function W0(e){return vr(e,"nonempty",t=>bl(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function V0(e,t){return vr(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function z0(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return vr(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:a}=s;return t<=a&&a<=r||`${n} with a size ${i} but received one with a size of \`${a}\``}else{const{length:a}=s;return t<=a&&a<=r||`${n} with a length ${i} but received one with a length of \`${a}\``}})}function vr(e,t,r){return new Ue({...e,*refiner(n,i){yield*e.refiner(n,i);const s=r(n,i),a=Ds(s,i,e,n);for(const l of a)yield{...l,refinement:t}}})}const q0=Object.freeze(Object.defineProperty({__proto__:null,Struct:Ue,StructError:hl,any:w0,array:_0,assert:dl,assign:h0,bigint:y0,boolean:E0,coerce:oo,create:fl,date:S0,defaulted:D0,define:rt,deprecated:d0,dynamic:f0,empty:j0,enums:R0,func:M0,instance:k0,integer:C0,intersection:I0,is:io,lazy:p0,literal:x0,map:A0,mask:pl,max:H0,min:U0,never:so,nonempty:W0,nullable:T0,number:N0,object:Tn,omit:g0,optional:gl,partial:m0,pattern:V0,pick:v0,record:L0,refine:vr,regexp:O0,set:P0,size:z0,string:ml,struct:b0,trimmed:F0,tuple:$0,type:Nn,union:B0,unknown:vl,validate:rn},Symbol.toStringTag,{value:"Module"})),br=Zr(q0);Object.defineProperty(Ke,"__esModule",{value:!0});Ke.assertExhaustive=Ke.assertStruct=Ke.assert=Ke.AssertionError=void 0;const J0=br;function G0(e){return typeof e=="object"&&e!==null&&"message"in e}function Z0(e){var t,r;return typeof((r=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||r===void 0?void 0:r.name)=="string"}function K0(e){const t=G0(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}function wl(e,t){return Z0(e)?new e({message:t}):e({message:t})}class ao extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}}Ke.AssertionError=ao;function Q0(e,t="Assertion failed.",r=ao){if(!e)throw t instanceof Error?t:wl(r,t)}Ke.assert=Q0;function Y0(e,t,r="Assertion failed",n=ao){try{(0,J0.assert)(e,t)}catch(i){throw wl(n,`${r}: ${K0(i)}.`)}}Ke.assertStruct=Y0;function X0(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}Ke.assertExhaustive=X0;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.base64=void 0;const e1=br,t1=Ke,r1=(e,t={})=>{var r,n;const i=(r=t.paddingRequired)!==null&&r!==void 0?r:!1,s=(n=t.characterSet)!==null&&n!==void 0?n:"base64";let a;s==="base64"?a=String.raw`[A-Za-z0-9+\/]`:((0,t1.assert)(s==="base64url"),a=String.raw`[-_A-Za-z0-9]`);let l;return i?l=new RegExp(`^(?:${a}{4})*(?:${a}{3}=|${a}{2}==)?$`,"u"):l=new RegExp(`^(?:${a}{4})*(?:${a}{2,3}|${a}{3}=|${a}{2}==)?$`,"u"),(0,e1.pattern)(e,l)};Ln.base64=r1;var ae={},On={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.StrictHexStruct=e.HexStruct=void 0;const t=br,r=Ke;e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu);function n(h){return(0,t.is)(h,e.HexStruct)}e.isHexString=n;function i(h){return(0,t.is)(h,e.StrictHexStruct)}e.isStrictHexString=i;function s(h){(0,r.assert)(n(h),"Value must be a hexadecimal string.")}e.assertIsHexString=s;function a(h){(0,r.assert)(i(h),'Value must be a hexadecimal string, starting with "0x".')}e.assertIsStrictHexString=a;function l(h){return h.startsWith("0x")?h:h.startsWith("0X")?`0x${h.substring(2)}`:`0x${h}`}e.add0x=l;function d(h){return h.startsWith("0x")||h.startsWith("0X")?h.substring(2):h}e.remove0x=d})(On);Object.defineProperty(ae,"__esModule",{value:!0});ae.createDataView=ae.concatBytes=ae.valueToBytes=ae.stringToBytes=ae.numberToBytes=ae.signedBigIntToBytes=ae.bigIntToBytes=ae.hexToBytes=ae.bytesToString=ae.bytesToNumber=ae.bytesToSignedBigInt=ae.bytesToBigInt=ae.bytesToHex=ae.assertIsBytes=ae.isBytes=void 0;const ot=Ke,Fs=On,_a=48,ya=58,Ea=87;function n1(){const e=[];return()=>{if(e.length===0)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}const i1=n1();function co(e){return e instanceof Uint8Array}ae.isBytes=co;function nn(e){(0,ot.assert)(co(e),"Value must be a Uint8Array.")}ae.assertIsBytes=nn;function _l(e){if(nn(e),e.length===0)return"0x";const t=i1(),r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=t[e[n]];return(0,Fs.add0x)(r.join(""))}ae.bytesToHex=_l;function yl(e){nn(e);const t=_l(e);return BigInt(t)}ae.bytesToBigInt=yl;function s1(e){nn(e);let t=BigInt(0);for(const r of e)t=(t<<BigInt(8))+BigInt(r);return BigInt.asIntN(e.length*8,t)}ae.bytesToSignedBigInt=s1;function o1(e){nn(e);const t=yl(e);return(0,ot.assert)(t<=BigInt(Number.MAX_SAFE_INTEGER),"Number is not a safe integer. Use `bytesToBigInt` instead."),Number(t)}ae.bytesToNumber=o1;function a1(e){return nn(e),new TextDecoder().decode(e)}ae.bytesToString=a1;function Di(e){var t;if(((t=e==null?void 0:e.toLowerCase)===null||t===void 0?void 0:t.call(e))==="0x")return new Uint8Array;(0,Fs.assertIsHexString)(e);const r=(0,Fs.remove0x)(e).toLowerCase(),n=r.length%2===0?r:`0${r}`,i=new Uint8Array(n.length/2);for(let s=0;s<i.length;s++){const a=n.charCodeAt(s*2),l=n.charCodeAt(s*2+1),d=a-(a<ya?_a:Ea),h=l-(l<ya?_a:Ea);i[s]=d*16+h}return i}ae.hexToBytes=Di;function El(e){(0,ot.assert)(typeof e=="bigint","Value must be a bigint."),(0,ot.assert)(e>=BigInt(0),"Value must be a non-negative bigint.");const t=e.toString(16);return Di(t)}ae.bigIntToBytes=El;function c1(e,t){(0,ot.assert)(t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(t*8+-1))}function l1(e,t){(0,ot.assert)(typeof e=="bigint","Value must be a bigint."),(0,ot.assert)(typeof t=="number","Byte length must be a number."),(0,ot.assert)(t>0,"Byte length must be greater than 0."),(0,ot.assert)(c1(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let i=0;i<n.length;i++)n[i]=Number(BigInt.asUintN(8,r)),r>>=BigInt(8);return n.reverse()}ae.signedBigIntToBytes=l1;function Sl(e){(0,ot.assert)(typeof e=="number","Value must be a number."),(0,ot.assert)(e>=0,"Value must be a non-negative number."),(0,ot.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");const t=e.toString(16);return Di(t)}ae.numberToBytes=Sl;function Rl(e){return(0,ot.assert)(typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}ae.stringToBytes=Rl;function Ml(e){if(typeof e=="bigint")return El(e);if(typeof e=="number")return Sl(e);if(typeof e=="string")return e.startsWith("0x")?Di(e):Rl(e);if(co(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}ae.valueToBytes=Ml;function u1(e){const t=new Array(e.length);let r=0;for(let i=0;i<e.length;i++){const s=Ml(e[i]);t[i]=s,r+=s.length}const n=new Uint8Array(r);for(let i=0,s=0;i<t.length;i++)n.set(t[i],s),s+=t[i].length;return n}ae.concatBytes=u1;function h1(e){if(typeof Buffer<"u"&&e instanceof Buffer){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new DataView(t)}return new DataView(e.buffer,e.byteOffset,e.byteLength)}ae.createDataView=h1;var Fi={};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.ChecksumStruct=void 0;const Sa=br,d1=Ln;Fi.ChecksumStruct=(0,Sa.size)((0,d1.base64)((0,Sa.string)(),{paddingRequired:!0}),44,44);var Ct={};Object.defineProperty(Ct,"__esModule",{value:!0});Ct.createHex=Ct.createBytes=Ct.createBigInt=Ct.createNumber=void 0;const He=br,f1=Ke,kl=ae,ji=On,Cl=(0,He.union)([(0,He.number)(),(0,He.bigint)(),(0,He.string)(),ji.StrictHexStruct]),p1=(0,He.coerce)((0,He.number)(),Cl,Number),g1=(0,He.coerce)((0,He.bigint)(),Cl,BigInt);(0,He.union)([ji.StrictHexStruct,(0,He.instance)(Uint8Array)]);const m1=(0,He.coerce)((0,He.instance)(Uint8Array),(0,He.union)([ji.StrictHexStruct]),kl.hexToBytes),v1=(0,He.coerce)(ji.StrictHexStruct,(0,He.instance)(Uint8Array),kl.bytesToHex);function b1(e){try{const t=(0,He.create)(e,p1);return(0,f1.assert)(Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){throw t instanceof He.StructError?new Error(`Expected a number-like value, got "${e}".`):t}}Ct.createNumber=b1;function w1(e){try{return(0,He.create)(e,g1)}catch(t){throw t instanceof He.StructError?new Error(`Expected a number-like value, got "${String(t.value)}".`):t}}Ct.createBigInt=w1;function _1(e){if(typeof e=="string"&&e.toLowerCase()==="0x")return new Uint8Array;try{return(0,He.create)(e,m1)}catch(t){throw t instanceof He.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}Ct.createBytes=_1;function y1(e){if(e instanceof Uint8Array&&e.length===0||typeof e=="string"&&e.toLowerCase()==="0x")return"0x";try{return(0,He.create)(e,v1)}catch(t){throw t instanceof He.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}Ct.createHex=y1;var Jr={},Il=Q&&Q.__classPrivateFieldSet||function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},Xe=Q&&Q.__classPrivateFieldGet||function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},gt,yt;Object.defineProperty(Jr,"__esModule",{value:!0});Jr.FrozenSet=Jr.FrozenMap=void 0;class lo{constructor(t){gt.set(this,void 0),Il(this,gt,new Map(t),"f"),Object.freeze(this)}get size(){return Xe(this,gt,"f").size}[(gt=new WeakMap,Symbol.iterator)](){return Xe(this,gt,"f")[Symbol.iterator]()}entries(){return Xe(this,gt,"f").entries()}forEach(t,r){return Xe(this,gt,"f").forEach((n,i,s)=>t.call(r,n,i,this))}get(t){return Xe(this,gt,"f").get(t)}has(t){return Xe(this,gt,"f").has(t)}keys(){return Xe(this,gt,"f").keys()}values(){return Xe(this,gt,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([t,r])=>`${String(t)} => ${String(r)}`).join(", ")} `:""}}`}}Jr.FrozenMap=lo;class uo{constructor(t){yt.set(this,void 0),Il(this,yt,new Set(t),"f"),Object.freeze(this)}get size(){return Xe(this,yt,"f").size}[(yt=new WeakMap,Symbol.iterator)](){return Xe(this,yt,"f")[Symbol.iterator]()}entries(){return Xe(this,yt,"f").entries()}forEach(t,r){return Xe(this,yt,"f").forEach((n,i,s)=>t.call(r,n,i,this))}has(t){return Xe(this,yt,"f").has(t)}keys(){return Xe(this,yt,"f").keys()}values(){return Xe(this,yt,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(t=>String(t)).join(", ")} `:""}}`}}Jr.FrozenSet=uo;Object.freeze(lo);Object.freeze(lo.prototype);Object.freeze(uo);Object.freeze(uo.prototype);var xl={};Object.defineProperty(xl,"__esModule",{value:!0});var Al={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=void 0;const t=br,r=Ke,n=()=>(0,t.define)("finite number",L=>(0,t.is)(L,(0,t.number)())&&Number.isFinite(L));e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),n(),(0,t.string)(),(0,t.array)((0,t.lazy)(()=>e.UnsafeJsonStruct)),(0,t.record)((0,t.string)(),(0,t.lazy)(()=>e.UnsafeJsonStruct))]),e.JsonStruct=(0,t.define)("Json",(L,F)=>{function W(te,Z){const X=[...Z.validator(te,F)];return X.length>0?X:!0}try{const te=W(L,e.UnsafeJsonStruct);return te!==!0?te:W(JSON.parse(JSON.stringify(L)),e.UnsafeJsonStruct)}catch(te){return te instanceof RangeError?"Circular reference detected":!1}});function i(L){return(0,t.is)(L,e.JsonStruct)}e.isValidJson=i;function s(L){(0,r.assertStruct)(L,e.JsonStruct,"Invalid JSON value");const F=JSON.stringify(L);return new TextEncoder().encode(F).byteLength}e.getJsonSize=s,e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]);function a(L){return(0,t.is)(L,e.JsonRpcNotificationStruct)}e.isJsonRpcNotification=a;function l(L,F){(0,r.assertStruct)(L,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",F)}e.assertIsJsonRpcNotification=l;function d(L){return(0,t.is)(L,e.JsonRpcRequestStruct)}e.isJsonRpcRequest=d;function h(L,F){(0,r.assertStruct)(L,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",F)}e.assertIsJsonRpcRequest=h,e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]);function m(L){return(0,t.is)(L,e.PendingJsonRpcResponseStruct)}e.isPendingJsonRpcResponse=m;function R(L,F){(0,r.assertStruct)(L,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",F)}e.assertIsPendingJsonRpcResponse=R;function y(L){return(0,t.is)(L,e.JsonRpcResponseStruct)}e.isJsonRpcResponse=y;function C(L,F){(0,r.assertStruct)(L,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",F)}e.assertIsJsonRpcResponse=C;function x(L){return(0,t.is)(L,e.JsonRpcSuccessStruct)}e.isJsonRpcSuccess=x;function B(L,F){(0,r.assertStruct)(L,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",F)}e.assertIsJsonRpcSuccess=B;function O(L){return(0,t.is)(L,e.JsonRpcFailureStruct)}e.isJsonRpcFailure=O;function M(L,F){(0,r.assertStruct)(L,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",F)}e.assertIsJsonRpcFailure=M;function T(L){return(0,t.is)(L,e.JsonRpcErrorStruct)}e.isJsonRpcError=T;function N(L,F){(0,r.assertStruct)(L,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",F)}e.assertIsJsonRpcError=N;function D(L){const{permitEmptyString:F,permitFractions:W,permitNull:te}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},L);return z=>!!(typeof z=="number"&&(W||Number.isInteger(z))||typeof z=="string"&&(F||z.length>0)||te&&z===null)}e.getJsonRpcIdValidator=D})(Al);var Tl={};Object.defineProperty(Tl,"__esModule",{value:!0});var Gr={},E1=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.createModuleLogger=Gr.createProjectLogger=void 0;const S1=E1(su),R1=(0,S1.default)("metamask");function M1(e){return R1.extend(e)}Gr.createProjectLogger=M1;function k1(e,t){return e.extend(t)}Gr.createModuleLogger=k1;var Nl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0;function t(h){return Array.isArray(h)&&h.length>0}e.isNonEmptyArray=t;function r(h){return h==null}e.isNullOrUndefined=r;function n(h){return!!h&&typeof h=="object"&&!Array.isArray(h)}e.isObject=n;const i=(h,m)=>Object.hasOwnProperty.call(h,m);e.hasProperty=i,function(h){h[h.Null=4]="Null",h[h.Comma=1]="Comma",h[h.Wrapper=1]="Wrapper",h[h.True=4]="True",h[h.False=5]="False",h[h.Quote=1]="Quote",h[h.Colon=1]="Colon",h[h.Date=24]="Date"}(e.JsonSize||(e.JsonSize={})),e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function s(h){if(typeof h!="object"||h===null)return!1;try{let m=h;for(;Object.getPrototypeOf(m)!==null;)m=Object.getPrototypeOf(m);return Object.getPrototypeOf(h)===m}catch{return!1}}e.isPlainObject=s;function a(h){return h.charCodeAt(0)<=127}e.isASCII=a;function l(h){var m;return h.split("").reduce((y,C)=>a(C)?y+1:y+2,0)+((m=h.match(e.ESCAPE_CHARACTERS_REGEXP))!==null&&m!==void 0?m:[]).length}e.calculateStringSize=l;function d(h){return h.toString().length}e.calculateNumberSize=d})(Nl);var It={};Object.defineProperty(It,"__esModule",{value:!0});It.hexToBigInt=It.hexToNumber=It.bigIntToHex=It.numberToHex=void 0;const jr=Ke,fn=On,C1=e=>((0,jr.assert)(typeof e=="number","Value must be a number."),(0,jr.assert)(e>=0,"Value must be a non-negative number."),(0,jr.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,fn.add0x)(e.toString(16)));It.numberToHex=C1;const I1=e=>((0,jr.assert)(typeof e=="bigint","Value must be a bigint."),(0,jr.assert)(e>=0,"Value must be a non-negative bigint."),(0,fn.add0x)(e.toString(16)));It.bigIntToHex=I1;const x1=e=>{(0,fn.assertIsHexString)(e);const t=parseInt(e,16);return(0,jr.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};It.hexToNumber=x1;const A1=e=>((0,fn.assertIsHexString)(e),BigInt((0,fn.add0x)(e)));It.hexToBigInt=A1;var Ll={};Object.defineProperty(Ll,"__esModule",{value:!0});var Ol={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,function(s){s[s.Millisecond=1]="Millisecond",s[s.Second=1e3]="Second",s[s.Minute=6e4]="Minute",s[s.Hour=36e5]="Hour",s[s.Day=864e5]="Day",s[s.Week=6048e5]="Week",s[s.Year=31536e6]="Year"}(e.Duration||(e.Duration={}));const t=s=>Number.isInteger(s)&&s>=0,r=(s,a)=>{if(!t(s))throw new Error(`"${a}" must be a non-negative integer. Received: "${s}".`)};function n(s,a){return r(s,"count"),s*a}e.inMilliseconds=n;function i(s){return r(s,"timestamp"),Date.now()-s}e.timeSince=i})(Ol);var Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});var $l={},js={exports:{}};const T1="2.0.0",Bl=256,N1=Number.MAX_SAFE_INTEGER||9007199254740991,L1=16,O1=Bl-6,P1=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Hi={MAX_LENGTH:Bl,MAX_SAFE_COMPONENT_LENGTH:L1,MAX_SAFE_BUILD_LENGTH:O1,MAX_SAFE_INTEGER:N1,RELEASE_TYPES:P1,SEMVER_SPEC_VERSION:T1,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},$1={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},Rs={};const B1=typeof $1=="object"&&Rs&&Rs.NODE_DEBUG&&/\bsemver\b/i.test(Rs.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var Ui=B1;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Hi,s=Ui;t=e.exports={};const a=t.re=[],l=t.safeRe=[],d=t.src=[],h=t.t={};let m=0;const R="[a-zA-Z0-9-]",y=[["\\s",1],["\\d",i],[R,n]],C=B=>{for(const[O,M]of y)B=B.split(`${O}*`).join(`${O}{0,${M}}`).split(`${O}+`).join(`${O}{1,${M}}`);return B},x=(B,O,M)=>{const T=C(O),N=m++;s(B,N,O),h[B]=N,d[N]=O,a[N]=new RegExp(O,M?"g":void 0),l[N]=new RegExp(T,M?"g":void 0)};x("NUMERICIDENTIFIER","0|[1-9]\\d*"),x("NUMERICIDENTIFIERLOOSE","\\d+"),x("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${R}*`),x("MAINVERSION",`(${d[h.NUMERICIDENTIFIER]})\\.(${d[h.NUMERICIDENTIFIER]})\\.(${d[h.NUMERICIDENTIFIER]})`),x("MAINVERSIONLOOSE",`(${d[h.NUMERICIDENTIFIERLOOSE]})\\.(${d[h.NUMERICIDENTIFIERLOOSE]})\\.(${d[h.NUMERICIDENTIFIERLOOSE]})`),x("PRERELEASEIDENTIFIER",`(?:${d[h.NUMERICIDENTIFIER]}|${d[h.NONNUMERICIDENTIFIER]})`),x("PRERELEASEIDENTIFIERLOOSE",`(?:${d[h.NUMERICIDENTIFIERLOOSE]}|${d[h.NONNUMERICIDENTIFIER]})`),x("PRERELEASE",`(?:-(${d[h.PRERELEASEIDENTIFIER]}(?:\\.${d[h.PRERELEASEIDENTIFIER]})*))`),x("PRERELEASELOOSE",`(?:-?(${d[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[h.PRERELEASEIDENTIFIERLOOSE]})*))`),x("BUILDIDENTIFIER",`${R}+`),x("BUILD",`(?:\\+(${d[h.BUILDIDENTIFIER]}(?:\\.${d[h.BUILDIDENTIFIER]})*))`),x("FULLPLAIN",`v?${d[h.MAINVERSION]}${d[h.PRERELEASE]}?${d[h.BUILD]}?`),x("FULL",`^${d[h.FULLPLAIN]}$`),x("LOOSEPLAIN",`[v=\\s]*${d[h.MAINVERSIONLOOSE]}${d[h.PRERELEASELOOSE]}?${d[h.BUILD]}?`),x("LOOSE",`^${d[h.LOOSEPLAIN]}$`),x("GTLT","((?:<|>)?=?)"),x("XRANGEIDENTIFIERLOOSE",`${d[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),x("XRANGEIDENTIFIER",`${d[h.NUMERICIDENTIFIER]}|x|X|\\*`),x("XRANGEPLAIN",`[v=\\s]*(${d[h.XRANGEIDENTIFIER]})(?:\\.(${d[h.XRANGEIDENTIFIER]})(?:\\.(${d[h.XRANGEIDENTIFIER]})(?:${d[h.PRERELEASE]})?${d[h.BUILD]}?)?)?`),x("XRANGEPLAINLOOSE",`[v=\\s]*(${d[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[h.XRANGEIDENTIFIERLOOSE]})(?:${d[h.PRERELEASELOOSE]})?${d[h.BUILD]}?)?)?`),x("XRANGE",`^${d[h.GTLT]}\\s*${d[h.XRANGEPLAIN]}$`),x("XRANGELOOSE",`^${d[h.GTLT]}\\s*${d[h.XRANGEPLAINLOOSE]}$`),x("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),x("COERCE",`${d[h.COERCEPLAIN]}(?:$|[^\\d])`),x("COERCEFULL",d[h.COERCEPLAIN]+`(?:${d[h.PRERELEASE]})?(?:${d[h.BUILD]})?(?:$|[^\\d])`),x("COERCERTL",d[h.COERCE],!0),x("COERCERTLFULL",d[h.COERCEFULL],!0),x("LONETILDE","(?:~>?)"),x("TILDETRIM",`(\\s*)${d[h.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",x("TILDE",`^${d[h.LONETILDE]}${d[h.XRANGEPLAIN]}$`),x("TILDELOOSE",`^${d[h.LONETILDE]}${d[h.XRANGEPLAINLOOSE]}$`),x("LONECARET","(?:\\^)"),x("CARETTRIM",`(\\s*)${d[h.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",x("CARET",`^${d[h.LONECARET]}${d[h.XRANGEPLAIN]}$`),x("CARETLOOSE",`^${d[h.LONECARET]}${d[h.XRANGEPLAINLOOSE]}$`),x("COMPARATORLOOSE",`^${d[h.GTLT]}\\s*(${d[h.LOOSEPLAIN]})$|^$`),x("COMPARATOR",`^${d[h.GTLT]}\\s*(${d[h.FULLPLAIN]})$|^$`),x("COMPARATORTRIM",`(\\s*)${d[h.GTLT]}\\s*(${d[h.LOOSEPLAIN]}|${d[h.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",x("HYPHENRANGE",`^\\s*(${d[h.XRANGEPLAIN]})\\s+-\\s+(${d[h.XRANGEPLAIN]})\\s*$`),x("HYPHENRANGELOOSE",`^\\s*(${d[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[h.XRANGEPLAINLOOSE]})\\s*$`),x("STAR","(<|>)?=?\\s*\\*"),x("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),x("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(js,js.exports);var Pn=js.exports;const D1=Object.freeze({loose:!0}),F1=Object.freeze({}),j1=e=>e?typeof e!="object"?D1:e:F1;var ho=j1;const Ra=/^[0-9]+$/,Dl=(e,t)=>{const r=Ra.test(e),n=Ra.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},H1=(e,t)=>Dl(t,e);var Fl={compareIdentifiers:Dl,rcompareIdentifiers:H1};const qn=Ui,{MAX_LENGTH:Ma,MAX_SAFE_INTEGER:Jn}=Hi,{safeRe:ka,t:Ca}=Pn,U1=ho,{compareIdentifiers:Or}=Fl;let W1=class Et{constructor(t,r){if(r=U1(r),t instanceof Et){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Ma)throw new TypeError(`version is longer than ${Ma} characters`);qn("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?ka[Ca.LOOSE]:ka[Ca.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Jn||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Jn||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Jn||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s<Jn)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(qn("SemVer.compare",this.version,this.options,t),!(t instanceof Et)){if(typeof t=="string"&&t===this.version)return 0;t=new Et(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof Et||(t=new Et(t,this.options)),Or(this.major,t.major)||Or(this.minor,t.minor)||Or(this.patch,t.patch)}comparePre(t){if(t instanceof Et||(t=new Et(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],i=t.prerelease[r];if(qn("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Or(n,i)}while(++r)}compareBuild(t){t instanceof Et||(t=new Et(t,this.options));let r=0;do{const n=this.build[r],i=t.build[r];if(qn("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Or(n,i)}while(++r)}inc(t,r,n){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const i=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),Or(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var et=W1;const Ia=et,V1=(e,t,r=!1)=>{if(e instanceof Ia)return e;try{return new Ia(e,t)}catch(n){if(!r)return null;throw n}};var sn=V1;const z1=sn,q1=(e,t)=>{const r=z1(e,t);return r?r.version:null};var J1=q1;const G1=sn,Z1=(e,t)=>{const r=G1(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var K1=Z1;const xa=et,Q1=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new xa(e instanceof xa?e.version:e,r).inc(t,n,i).version}catch{return null}};var Y1=Q1;const Aa=sn,X1=(e,t)=>{const r=Aa(e,null,!0),n=Aa(t,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,a=s?r:n,l=s?n:r,d=!!a.prerelease.length;if(!!l.prerelease.length&&!d)return!l.patch&&!l.minor?"major":a.patch?"patch":a.minor?"minor":"major";const m=d?"pre":"";return r.major!==n.major?m+"major":r.minor!==n.minor?m+"minor":r.patch!==n.patch?m+"patch":"prerelease"};var ep=X1;const tp=et,rp=(e,t)=>new tp(e,t).major;var np=rp;const ip=et,sp=(e,t)=>new ip(e,t).minor;var op=sp;const ap=et,cp=(e,t)=>new ap(e,t).patch;var lp=cp;const up=sn,hp=(e,t)=>{const r=up(e,t);return r&&r.prerelease.length?r.prerelease:null};var dp=hp;const Ta=et,fp=(e,t,r)=>new Ta(e,r).compare(new Ta(t,r));var bt=fp;const pp=bt,gp=(e,t,r)=>pp(t,e,r);var mp=gp;const vp=bt,bp=(e,t)=>vp(e,t,!0);var wp=bp;const Na=et,_p=(e,t,r)=>{const n=new Na(e,r),i=new Na(t,r);return n.compare(i)||n.compareBuild(i)};var fo=_p;const yp=fo,Ep=(e,t)=>e.sort((r,n)=>yp(r,n,t));var Sp=Ep;const Rp=fo,Mp=(e,t)=>e.sort((r,n)=>Rp(n,r,t));var kp=Mp;const Cp=bt,Ip=(e,t,r)=>Cp(e,t,r)>0;var Wi=Ip;const xp=bt,Ap=(e,t,r)=>xp(e,t,r)<0;var po=Ap;const Tp=bt,Np=(e,t,r)=>Tp(e,t,r)===0;var jl=Np;const Lp=bt,Op=(e,t,r)=>Lp(e,t,r)!==0;var Hl=Op;const Pp=bt,$p=(e,t,r)=>Pp(e,t,r)>=0;var go=$p;const Bp=bt,Dp=(e,t,r)=>Bp(e,t,r)<=0;var mo=Dp;const Fp=jl,jp=Hl,Hp=Wi,Up=go,Wp=po,Vp=mo,zp=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Fp(e,r,n);case"!=":return jp(e,r,n);case">":return Hp(e,r,n);case">=":return Up(e,r,n);case"<":return Wp(e,r,n);case"<=":return Vp(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};var Ul=zp;const qp=et,Jp=sn,{safeRe:Gn,t:Zn}=Pn,Gp=(e,t)=>{if(e instanceof qp)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Gn[Zn.COERCEFULL]:Gn[Zn.COERCE]);else{const d=t.includePrerelease?Gn[Zn.COERCERTLFULL]:Gn[Zn.COERCERTL];let h;for(;(h=d.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||h.index+h[0].length!==r.index+r[0].length)&&(r=h),d.lastIndex=h.index+h[1].length+h[2].length;d.lastIndex=-1}if(r===null)return null;const n=r[2],i=r[3]||"0",s=r[4]||"0",a=t.includePrerelease&&r[5]?`-${r[5]}`:"",l=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Jp(`${n}.${i}.${s}${a}${l}`,t)};var Zp=Gp;class Kp{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}}var Qp=Kp,Ms,La;function wt(){if(La)return Ms;La=1;const e=/\s+/g;class t{constructor(u,f){if(f=i(f),u instanceof t)return u.loose===!!f.loose&&u.includePrerelease===!!f.includePrerelease?u:new t(u.raw,f);if(u instanceof s)return this.raw=u.value,this.set=[[u]],this.formatted=void 0,this;if(this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease,this.raw=u.trim().replace(e," "),this.set=this.raw.split("||").map(p=>this.parseRange(p.trim())).filter(p=>p.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const p=this.set[0];if(this.set=this.set.filter(v=>!B(v[0])),this.set.length===0)this.set=[p];else if(this.set.length>1){for(const v of this.set)if(v.length===1&&O(v[0])){this.set=[v];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let u=0;u<this.set.length;u++){u>0&&(this.formatted+="||");const f=this.set[u];for(let p=0;p<f.length;p++)p>0&&(this.formatted+=" "),this.formatted+=f[p].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(u){const p=((this.options.includePrerelease&&C)|(this.options.loose&&x))+":"+u,v=n.get(p);if(v)return v;const E=this.options.loose,k=E?d[h.HYPHENRANGELOOSE]:d[h.HYPHENRANGE];u=u.replace(k,ne(this.options.includePrerelease)),a("hyphen replace",u),u=u.replace(d[h.COMPARATORTRIM],m),a("comparator trim",u),u=u.replace(d[h.TILDETRIM],R),a("tilde trim",u),u=u.replace(d[h.CARETTRIM],y),a("caret trim",u);let g=u.split(" ").map(H=>T(H,this.options)).join(" ").split(/\s+/).map(H=>X(H,this.options));E&&(g=g.filter(H=>(a("loose invalid filter",H,this.options),!!H.match(d[h.COMPARATORLOOSE])))),a("range list",g);const c=new Map,w=g.map(H=>new s(H,this.options));for(const H of w){if(B(H))return[H];c.set(H.value,H)}c.size>1&&c.has("")&&c.delete("");const U=[...c.values()];return n.set(p,U),U}intersects(u,f){if(!(u instanceof t))throw new TypeError("a Range is required");return this.set.some(p=>M(p,f)&&u.set.some(v=>M(v,f)&&p.every(E=>v.every(k=>E.intersects(k,f)))))}test(u){if(!u)return!1;if(typeof u=="string")try{u=new l(u,this.options)}catch{return!1}for(let f=0;f<this.set.length;f++)if(S(this.set[f],u,this.options))return!0;return!1}}Ms=t;const r=Qp,n=new r,i=ho,s=Vi(),a=Ui,l=et,{safeRe:d,t:h,comparatorTrimReplace:m,tildeTrimReplace:R,caretTrimReplace:y}=Pn,{FLAG_INCLUDE_PRERELEASE:C,FLAG_LOOSE:x}=Hi,B=o=>o.value==="<0.0.0-0",O=o=>o.value==="",M=(o,u)=>{let f=!0;const p=o.slice();let v=p.pop();for(;f&&p.length;)f=p.every(E=>v.intersects(E,u)),v=p.pop();return f},T=(o,u)=>(a("comp",o,u),o=F(o,u),a("caret",o),o=D(o,u),a("tildes",o),o=te(o,u),a("xrange",o),o=z(o,u),a("stars",o),o),N=o=>!o||o.toLowerCase()==="x"||o==="*",D=(o,u)=>o.trim().split(/\s+/).map(f=>L(f,u)).join(" "),L=(o,u)=>{const f=u.loose?d[h.TILDELOOSE]:d[h.TILDE];return o.replace(f,(p,v,E,k,g)=>{a("tilde",o,p,v,E,k,g);let c;return N(v)?c="":N(E)?c=`>=${v}.0.0 <${+v+1}.0.0-0`:N(k)?c=`>=${v}.${E}.0 <${v}.${+E+1}.0-0`:g?(a("replaceTilde pr",g),c=`>=${v}.${E}.${k}-${g} <${v}.${+E+1}.0-0`):c=`>=${v}.${E}.${k} <${v}.${+E+1}.0-0`,a("tilde return",c),c})},F=(o,u)=>o.trim().split(/\s+/).map(f=>W(f,u)).join(" "),W=(o,u)=>{a("caret",o,u);const f=u.loose?d[h.CARETLOOSE]:d[h.CARET],p=u.includePrerelease?"-0":"";return o.replace(f,(v,E,k,g,c)=>{a("caret",o,v,E,k,g,c);let w;return N(E)?w="":N(k)?w=`>=${E}.0.0${p} <${+E+1}.0.0-0`:N(g)?E==="0"?w=`>=${E}.${k}.0${p} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.0${p} <${+E+1}.0.0-0`:c?(a("replaceCaret pr",c),E==="0"?k==="0"?w=`>=${E}.${k}.${g}-${c} <${E}.${k}.${+g+1}-0`:w=`>=${E}.${k}.${g}-${c} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.${g}-${c} <${+E+1}.0.0-0`):(a("no pr"),E==="0"?k==="0"?w=`>=${E}.${k}.${g}${p} <${E}.${k}.${+g+1}-0`:w=`>=${E}.${k}.${g}${p} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.${g} <${+E+1}.0.0-0`),a("caret return",w),w})},te=(o,u)=>(a("replaceXRanges",o,u),o.split(/\s+/).map(f=>Z(f,u)).join(" ")),Z=(o,u)=>{o=o.trim();const f=u.loose?d[h.XRANGELOOSE]:d[h.XRANGE];return o.replace(f,(p,v,E,k,g,c)=>{a("xRange",o,p,v,E,k,g,c);const w=N(E),U=w||N(k),H=U||N(g),V=H;return v==="="&&V&&(v=""),c=u.includePrerelease?"-0":"",w?v===">"||v==="<"?p="<0.0.0-0":p="*":v&&V?(U&&(k=0),g=0,v===">"?(v=">=",U?(E=+E+1,k=0,g=0):(k=+k+1,g=0)):v==="<="&&(v="<",U?E=+E+1:k=+k+1),v==="<"&&(c="-0"),p=`${v+E}.${k}.${g}${c}`):U?p=`>=${E}.0.0${c} <${+E+1}.0.0-0`:H&&(p=`>=${E}.${k}.0${c} <${E}.${+k+1}.0-0`),a("xRange return",p),p})},z=(o,u)=>(a("replaceStars",o,u),o.trim().replace(d[h.STAR],"")),X=(o,u)=>(a("replaceGTE0",o,u),o.trim().replace(d[u.includePrerelease?h.GTE0PRE:h.GTE0],"")),ne=o=>(u,f,p,v,E,k,g,c,w,U,H,V)=>(N(p)?f="":N(v)?f=`>=${p}.0.0${o?"-0":""}`:N(E)?f=`>=${p}.${v}.0${o?"-0":""}`:k?f=`>=${f}`:f=`>=${f}${o?"-0":""}`,N(w)?c="":N(U)?c=`<${+w+1}.0.0-0`:N(H)?c=`<${w}.${+U+1}.0-0`:V?c=`<=${w}.${U}.${H}-${V}`:o?c=`<${w}.${U}.${+H+1}-0`:c=`<=${c}`,`${f} ${c}`.trim()),S=(o,u,f)=>{for(let p=0;p<o.length;p++)if(!o[p].test(u))return!1;if(u.prerelease.length&&!f.includePrerelease){for(let p=0;p<o.length;p++)if(a(o[p].semver),o[p].semver!==s.ANY&&o[p].semver.prerelease.length>0){const v=o[p].semver;if(v.major===u.major&&v.minor===u.minor&&v.patch===u.patch)return!0}return!1}return!0};return Ms}var ks,Oa;function Vi(){if(Oa)return ks;Oa=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(m,R){if(R=r(R),m instanceof t){if(m.loose===!!R.loose)return m;m=m.value}m=m.trim().split(/\s+/).join(" "),a("comparator",m,R),this.options=R,this.loose=!!R.loose,this.parse(m),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(m){const R=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],y=m.match(R);if(!y)throw new TypeError(`Invalid comparator: ${m}`);this.operator=y[1]!==void 0?y[1]:"",this.operator==="="&&(this.operator=""),y[2]?this.semver=new l(y[2],this.options.loose):this.semver=e}toString(){return this.value}test(m){if(a("Comparator.test",m,this.options.loose),this.semver===e||m===e)return!0;if(typeof m=="string")try{m=new l(m,this.options)}catch{return!1}return s(m,this.operator,this.semver,this.options)}intersects(m,R){if(!(m instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new d(m.value,R).test(this.value):m.operator===""?m.value===""?!0:new d(this.value,R).test(m.semver):(R=r(R),R.includePrerelease&&(this.value==="<0.0.0-0"||m.value==="<0.0.0-0")||!R.includePrerelease&&(this.value.startsWith("<0.0.0")||m.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&m.operator.startsWith(">")||this.operator.startsWith("<")&&m.operator.startsWith("<")||this.semver.version===m.semver.version&&this.operator.includes("=")&&m.operator.includes("=")||s(this.semver,"<",m.semver,R)&&this.operator.startsWith(">")&&m.operator.startsWith("<")||s(this.semver,">",m.semver,R)&&this.operator.startsWith("<")&&m.operator.startsWith(">")))}}ks=t;const r=ho,{safeRe:n,t:i}=Pn,s=Ul,a=Ui,l=et,d=wt();return ks}const Yp=wt(),Xp=(e,t,r)=>{try{t=new Yp(t,r)}catch{return!1}return t.test(e)};var zi=Xp;const eg=wt(),tg=(e,t)=>new eg(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var rg=tg;const ng=et,ig=wt(),sg=(e,t,r)=>{let n=null,i=null,s=null;try{s=new ig(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!n||i.compare(a)===-1)&&(n=a,i=new ng(n,r))}),n};var og=sg;const ag=et,cg=wt(),lg=(e,t,r)=>{let n=null,i=null,s=null;try{s=new cg(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!n||i.compare(a)===1)&&(n=a,i=new ag(n,r))}),n};var ug=lg;const Cs=et,hg=wt(),Pa=Wi,dg=(e,t)=>{e=new hg(e,t);let r=new Cs("0.0.0");if(e.test(r)||(r=new Cs("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n<e.set.length;++n){const i=e.set[n];let s=null;i.forEach(a=>{const l=new Cs(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!s||Pa(l,s))&&(s=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!r||Pa(r,s))&&(r=s)}return r&&e.test(r)?r:null};var fg=dg;const pg=wt(),gg=(e,t)=>{try{return new pg(e,t).range||"*"}catch{return null}};var mg=gg;const vg=et,Wl=Vi(),{ANY:bg}=Wl,wg=wt(),_g=zi,$a=Wi,Ba=po,yg=mo,Eg=go,Sg=(e,t,r,n)=>{e=new vg(e,n),t=new wg(t,n);let i,s,a,l,d;switch(r){case">":i=$a,s=yg,a=Ba,l=">",d=">=";break;case"<":i=Ba,s=Eg,a=$a,l="<",d="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(_g(e,t,n))return!1;for(let h=0;h<t.set.length;++h){const m=t.set[h];let R=null,y=null;if(m.forEach(C=>{C.semver===bg&&(C=new Wl(">=0.0.0")),R=R||C,y=y||C,i(C.semver,R.semver,n)?R=C:a(C.semver,y.semver,n)&&(y=C)}),R.operator===l||R.operator===d||(!y.operator||y.operator===l)&&s(e,y.semver))return!1;if(y.operator===d&&a(e,y.semver))return!1}return!0};var vo=Sg;const Rg=vo,Mg=(e,t,r)=>Rg(e,t,">",r);var kg=Mg;const Cg=vo,Ig=(e,t,r)=>Cg(e,t,"<",r);var xg=Ig;const Da=wt(),Ag=(e,t,r)=>(e=new Da(e,r),t=new Da(t,r),e.intersects(t,r));var Tg=Ag;const Ng=zi,Lg=bt;var Og=(e,t,r)=>{const n=[];let i=null,s=null;const a=e.sort((m,R)=>Lg(m,R,r));for(const m of a)Ng(m,t,r)?(s=m,i||(i=m)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const l=[];for(const[m,R]of n)m===R?l.push(m):!R&&m===a[0]?l.push("*"):R?m===a[0]?l.push(`<=${R}`):l.push(`${m} - ${R}`):l.push(`>=${m}`);const d=l.join(" || "),h=typeof t.raw=="string"?t.raw:String(t);return d.length<h.length?d:t};const Fa=wt(),bo=Vi(),{ANY:Is}=bo,an=zi,wo=bt,Pg=(e,t,r={})=>{if(e===t)return!0;e=new Fa(e,r),t=new Fa(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const a=Bg(i,s,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},$g=[new bo(">=0.0.0-0")],ja=[new bo(">=0.0.0")],Bg=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Is){if(t.length===1&&t[0].semver===Is)return!0;r.includePrerelease?e=$g:e=ja}if(t.length===1&&t[0].semver===Is){if(r.includePrerelease)return!0;t=ja}const n=new Set;let i,s;for(const C of e)C.operator===">"||C.operator===">="?i=Ha(i,C,r):C.operator==="<"||C.operator==="<="?s=Ua(s,C,r):n.add(C.semver);if(n.size>1)return null;let a;if(i&&s){if(a=wo(i.semver,s.semver,r),a>0)return null;if(a===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const C of n){if(i&&!an(C,String(i),r)||s&&!an(C,String(s),r))return null;for(const x of t)if(!an(C,String(x),r))return!1;return!0}let l,d,h,m,R=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,y=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;R&&R.prerelease.length===1&&s.operator==="<"&&R.prerelease[0]===0&&(R=!1);for(const C of t){if(m=m||C.operator===">"||C.operator===">=",h=h||C.operator==="<"||C.operator==="<=",i){if(y&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===y.major&&C.semver.minor===y.minor&&C.semver.patch===y.patch&&(y=!1),C.operator===">"||C.operator===">="){if(l=Ha(i,C,r),l===C&&l!==i)return!1}else if(i.operator===">="&&!an(i.semver,String(C),r))return!1}if(s){if(R&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===R.major&&C.semver.minor===R.minor&&C.semver.patch===R.patch&&(R=!1),C.operator==="<"||C.operator==="<="){if(d=Ua(s,C,r),d===C&&d!==s)return!1}else if(s.operator==="<="&&!an(s.semver,String(C),r))return!1}if(!C.operator&&(s||i)&&a!==0)return!1}return!(i&&h&&!s&&a!==0||s&&m&&!i&&a!==0||y||R)},Ha=(e,t,r)=>{if(!e)return t;const n=wo(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Ua=(e,t,r)=>{if(!e)return t;const n=wo(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var Dg=Pg;const xs=Pn,Wa=Hi,Fg=et,Va=Fl,jg=sn,Hg=J1,Ug=K1,Wg=Y1,Vg=ep,zg=np,qg=op,Jg=lp,Gg=dp,Zg=bt,Kg=mp,Qg=wp,Yg=fo,Xg=Sp,em=kp,tm=Wi,rm=po,nm=jl,im=Hl,sm=go,om=mo,am=Ul,cm=Zp,lm=Vi(),um=wt(),hm=zi,dm=rg,fm=og,pm=ug,gm=fg,mm=mg,vm=vo,bm=kg,wm=xg,_m=Tg,ym=Og,Em=Dg;var Sm={parse:jg,valid:Hg,clean:Ug,inc:Wg,diff:Vg,major:zg,minor:qg,patch:Jg,prerelease:Gg,compare:Zg,rcompare:Kg,compareLoose:Qg,compareBuild:Yg,sort:Xg,rsort:em,gt:tm,lt:rm,eq:nm,neq:im,gte:sm,lte:om,cmp:am,coerce:cm,Comparator:lm,Range:um,satisfies:hm,toComparators:dm,maxSatisfying:fm,minSatisfying:pm,minVersion:gm,validRange:mm,outside:vm,gtr:bm,ltr:wm,intersects:_m,simplifyRange:ym,subset:Em,SemVer:Fg,re:xs.re,src:xs.src,tokens:xs.t,SEMVER_SPEC_VERSION:Wa.SEMVER_SPEC_VERSION,RELEASE_TYPES:Wa.RELEASE_TYPES,compareIdentifiers:Va.compareIdentifiers,rcompareIdentifiers:Va.rcompareIdentifiers};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.satisfiesVersionRange=e.gtRange=e.gtVersion=e.assertIsSemVerRange=e.assertIsSemVerVersion=e.isValidSemVerRange=e.isValidSemVerVersion=e.VersionRangeStruct=e.VersionStruct=void 0;const t=Sm,r=br,n=Ke;e.VersionStruct=(0,r.refine)((0,r.string)(),"Version",R=>(0,t.valid)(R)===null?`Expected SemVer version, got "${R}"`:!0),e.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",R=>(0,t.validRange)(R)===null?`Expected SemVer range, got "${R}"`:!0);function i(R){return(0,r.is)(R,e.VersionStruct)}e.isValidSemVerVersion=i;function s(R){return(0,r.is)(R,e.VersionRangeStruct)}e.isValidSemVerRange=s;function a(R){(0,n.assertStruct)(R,e.VersionStruct)}e.assertIsSemVerVersion=a;function l(R){(0,n.assertStruct)(R,e.VersionRangeStruct)}e.assertIsSemVerRange=l;function d(R,y){return(0,t.gt)(R,y)}e.gtVersion=d;function h(R,y){return(0,t.gtr)(R,y)}e.gtRange=h;function m(R,y){return(0,t.satisfies)(R,y,{includePrerelease:!0})}e.satisfiesVersionRange=m})($l);(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(i,s);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,l)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ke,e),r(Ln,e),r(ae,e),r(Fi,e),r(Ct,e),r(Jr,e),r(xl,e),r(On,e),r(Al,e),r(Tl,e),r(Gr,e),r(Nl,e),r(It,e),r(Ll,e),r(Ol,e),r(Pl,e),r($l,e)})(ul);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createModuleLogger=e.projectLogger=void 0;const t=ul;Object.defineProperty(e,"createModuleLogger",{enumerable:!0,get:function(){return t.createModuleLogger}}),e.projectLogger=(0,t.createProjectLogger)("eth-block-tracker")})(ll);var Vl=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.PollingBlockTracker=void 0;const Rm=Vl(ro),Mm=Vl(Xf),km=xn,za=ll,qa=(0,za.createModuleLogger)(za.projectLogger,"polling-block-tracker"),Cm=(0,Rm.default)(),Im=1e3;class xm extends km.BaseBlockTracker{constructor(t={}){var r;if(!t.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},t),{blockResetDuration:(r=t.blockResetDuration)!==null&&r!==void 0?r:t.pollingInterval})),this._provider=t.provider,this._pollingInterval=t.pollingInterval||20*Im,this._retryTimeout=t.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=t.keepEventLoopActive===void 0?!0:t.keepEventLoopActive,this._setSkipCacheFlag=t.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var t;this._isRunning;)try{await this._updateLatestBlock();const r=Ja(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await r}catch(r){const n=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:
${(t=r.stack)!==null&&t!==void 0?t:r}`);try{this.emit("error",n)}catch{console.error(n)}const i=Ja(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await i}}async _updateLatestBlock(){const t=await this._fetchLatestBlock();this._newPotentialLatest(t)}async _fetchLatestBlock(){const t={jsonrpc:"2.0",id:Cm(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(t.skipCache=!0),qa("Making request",t);const r=await(0,Mm.default)(n=>this._provider.sendAsync(t,n))();if(qa("Got response",r),r.error)throw new Error(`PollingBlockTracker - encountered error fetching block:
${r.error.message}`);return r.result}}Bi.PollingBlockTracker=xm;function Ja(e,t){return new Promise(r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()})}var qi={},Am=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qi,"__esModule",{value:!0});qi.SubscribeBlockTracker=void 0;const Tm=Am(ro),Nm=xn,Lm=(0,Tm.default)();class Om extends Nm.BaseBlockTracker{constructor(t={}){if(!t.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(t),this._provider=t.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(this._subscriptionId===void 0||this._subscriptionId===null)try{const t=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(t)}catch(t){this.emit("error",t)}}async _end(){if(this._subscriptionId!==null&&this._subscriptionId!==void 0)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(t){this.emit("error",t)}}_call(t,...r){return new Promise((n,i)=>{this._provider.sendAsync({id:Lm(),method:t,params:r,jsonrpc:"2.0"},(s,a)=>{s?i(s):n(a.result)})})}_handleSubData(t,r){var n;r.method==="eth_subscription"&&((n=r.params)===null||n===void 0?void 0:n.subscription)===this._subscriptionId&&this._newPotentialLatest(r.params.result.number)}}qi.SubscribeBlockTracker=Om;(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Bi,e),r(qi,e)})(cl);var _o={},Ji={},$n={};Object.defineProperty($n,"__esModule",{value:!0});$n.getUniqueId=void 0;const zl=4294967295;let As=Math.floor(Math.random()*zl);function Pm(){return As=(As+1)%zl,As}$n.getUniqueId=Pm;Object.defineProperty(Ji,"__esModule",{value:!0});Ji.createIdRemapMiddleware=void 0;const $m=$n;function Bm(){return(e,t,r,n)=>{const i=e.id,s=$m.getUniqueId();e.id=s,t.id=s,r(a=>{e.id=i,t.id=i,a()})}}Ji.createIdRemapMiddleware=Bm;var Gi={};Object.defineProperty(Gi,"__esModule",{value:!0});Gi.createAsyncMiddleware=void 0;function Dm(e){return async(t,r,n,i)=>{let s;const a=new Promise(m=>{s=m});let l=null,d=!1;const h=async()=>{d=!0,n(m=>{l=m,s()}),await a};try{await e(t,r,h),d?(await a,l(null)):i(null)}catch(m){l?l(m):i(m)}}}Gi.createAsyncMiddleware=Dm;var Zi={};Object.defineProperty(Zi,"__esModule",{value:!0});Zi.createScaffoldMiddleware=void 0;function Fm(e){return(t,r,n,i)=>{const s=e[t.method];return s===void 0?n():typeof s=="function"?s(t,r,n,i):(r.result=s,i())}}Zi.createScaffoldMiddleware=Fm;var Bn={},yo={};Object.defineProperty(yo,"__esModule",{value:!0});const jm=si;function Ga(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function Hm(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}let Um=class extends jm.EventEmitter{emit(t,...r){let n=t==="error";const i=this._events;if(i!==void 0)n=n&&i.error===void 0;else if(!n)return!1;if(n){let a;if(r.length>0&&([a]=r),a instanceof Error)throw a;const l=new Error(`Unhandled error.${a?` (${a.message})`:""}`);throw l.context=a,l}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")Ga(s,this,r);else{const a=s.length,l=Hm(s);for(let d=0;d<a;d+=1)Ga(l[d],this,r)}return!0}};yo.default=Um;var ql={},Dt={},Wm=pn;pn.default=pn;pn.stable=Zl;pn.stableStringify=Zl;var ri="[...]",Jl="[Circular]",fr=[],ur=[];function Gl(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function pn(e,t,r,n){typeof n>"u"&&(n=Gl()),Hs(e,"",0,[],void 0,0,n);var i;try{ur.length===0?i=JSON.stringify(e,t,r):i=JSON.stringify(e,Kl(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;fr.length!==0;){var s=fr.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Hr(e,t,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:e}),fr.push([n,r,t,i])):ur.push([t,r,e]):(n[r]=e,fr.push([n,r,t]))}function Hs(e,t,r,n,i,s,a){s+=1;var l;if(typeof e=="object"&&e!==null){for(l=0;l<n.length;l++)if(n[l]===e){Hr(Jl,e,t,i);return}if(typeof a.depthLimit<"u"&&s>a.depthLimit){Hr(ri,e,t,i);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Hr(ri,e,t,i);return}if(n.push(e),Array.isArray(e))for(l=0;l<e.length;l++)Hs(e[l],l,l,n,e,s,a);else{var d=Object.keys(e);for(l=0;l<d.length;l++){var h=d[l];Hs(e[h],h,l,n,e,s,a)}}n.pop()}}function Vm(e,t){return e<t?-1:e>t?1:0}function Zl(e,t,r,n){typeof n>"u"&&(n=Gl());var i=Us(e,"",0,[],void 0,0,n)||e,s;try{ur.length===0?s=JSON.stringify(i,t,r):s=JSON.stringify(i,Kl(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;fr.length!==0;){var a=fr.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return s}function Us(e,t,r,n,i,s,a){s+=1;var l;if(typeof e=="object"&&e!==null){for(l=0;l<n.length;l++)if(n[l]===e){Hr(Jl,e,t,i);return}try{if(typeof e.toJSON=="function")return}catch{return}if(typeof a.depthLimit<"u"&&s>a.depthLimit){Hr(ri,e,t,i);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Hr(ri,e,t,i);return}if(n.push(e),Array.isArray(e))for(l=0;l<e.length;l++)Us(e[l],l,l,n,e,s,a);else{var d={},h=Object.keys(e).sort(Vm);for(l=0;l<h.length;l++){var m=h[l];Us(e[m],m,l,n,e,s,a),d[m]=e[m]}if(typeof i<"u")fr.push([i,t,e]),i[t]=d;else return d}n.pop()}}function Kl(e){return e=typeof e<"u"?e:function(t,r){return r},function(t,r){if(ur.length>0)for(var n=0;n<ur.length;n++){var i=ur[n];if(i[1]===t&&i[0]===r){r=i[2],ur.splice(n,1);break}}return e.call(this,t,r)}}Object.defineProperty(Dt,"__esModule",{value:!0});Dt.EthereumProviderError=Dt.EthereumRpcError=void 0;const zm=Wm;class Ql extends Error{constructor(t,r,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=t,n!==void 0&&(this.data=n)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),this.stack&&(t.stack=this.stack),t}toString(){return zm.default(this.serialize(),Gm,2)}}Dt.EthereumRpcError=Ql;class qm extends Ql{constructor(t,r,n){if(!Jm(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,n)}}Dt.EthereumProviderError=qm;function Jm(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function Gm(e,t){if(t!=="[Circular]")return t}var Eo={},Ft={};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.errorValues=Ft.errorCodes=void 0;Ft.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}};Ft.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Ft,r=Dt,n=t.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:a(n)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function a(y,C=i){if(Number.isInteger(y)){const x=y.toString();if(R(t.errorValues,x))return t.errorValues[x].message;if(h(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=a;function l(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||h(y))}e.isValidCode=l;function d(y,{fallbackError:C=s,shouldIncludeStack:x=!1}={}){var B,O;if(!C||!Number.isInteger(C.code)||typeof C.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(y instanceof r.EthereumRpcError)return y.serialize();const M={};if(y&&typeof y=="object"&&!Array.isArray(y)&&R(y,"code")&&l(y.code)){const N=y;M.code=N.code,N.message&&typeof N.message=="string"?(M.message=N.message,R(N,"data")&&(M.data=N.data)):(M.message=a(M.code),M.data={originalError:m(y)})}else{M.code=C.code;const N=(B=y)===null||B===void 0?void 0:B.message;M.message=N&&typeof N=="string"?N:C.message,M.data={originalError:m(y)}}const T=(O=y)===null||O===void 0?void 0:O.stack;return x&&y&&T&&typeof T=="string"&&(M.stack=T),M}e.serializeError=d;function h(y){return y>=-32099&&y<=-32e3}function m(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function R(y,C){return Object.prototype.hasOwnProperty.call(y,C)}})(Eo);var Ki={};Object.defineProperty(Ki,"__esModule",{value:!0});Ki.ethErrors=void 0;const So=Dt,Yl=Eo,Qe=Ft;Ki.ethErrors={rpc:{parse:e=>lt(Qe.errorCodes.rpc.parse,e),invalidRequest:e=>lt(Qe.errorCodes.rpc.invalidRequest,e),invalidParams:e=>lt(Qe.errorCodes.rpc.invalidParams,e),methodNotFound:e=>lt(Qe.errorCodes.rpc.methodNotFound,e),internal:e=>lt(Qe.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return lt(t,e)},invalidInput:e=>lt(Qe.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>lt(Qe.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>lt(Qe.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>lt(Qe.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>lt(Qe.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>lt(Qe.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>cn(Qe.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>cn(Qe.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>cn(Qe.errorCodes.provider.unsupportedMethod,e),disconnected:e=>cn(Qe.errorCodes.provider.disconnected,e),chainDisconnected:e=>cn(Qe.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new So.EthereumProviderError(t,r,n)}}};function lt(e,t){const[r,n]=Xl(t);return new So.EthereumRpcError(e,r||Yl.getMessageFromCode(e),n)}function cn(e,t){const[r,n]=Xl(t);return new So.EthereumProviderError(e,r||Yl.getMessageFromCode(e),n)}function Xl(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=Dt;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const r=Eo;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=Ki;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=Ft;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(ql);var Zm=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.JsonRpcEngine=void 0;const Km=Zm(yo),ut=ql;class At extends Km.default{constructor(){super(),this._middleware=[]}push(t){this._middleware.push(t)}handle(t,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?r?this._handleBatch(t,r):this._handleBatch(t):r?this._handle(t,r):this._promiseHandle(t)}asMiddleware(){return async(t,r,n,i)=>{try{const[s,a,l]=await At._runAllMiddleware(t,r,this._middleware);return a?(await At._runReturnHandlers(l),i(s)):n(async d=>{try{await At._runReturnHandlers(l)}catch(h){return d(h)}return d()})}catch(s){return i(s)}}}async _handleBatch(t,r){try{const n=await Promise.all(t.map(this._promiseHandle.bind(this)));return r?r(null,n):n}catch(n){if(r)return r(n);throw n}}_promiseHandle(t){return new Promise(r=>{this._handle(t,(n,i)=>{r(i)})})}async _handle(t,r){if(!t||Array.isArray(t)||typeof t!="object"){const a=new ut.EthereumRpcError(ut.errorCodes.rpc.invalidRequest,`Requests must be plain objects. Received: ${typeof t}`,{request:t});return r(a,{id:void 0,jsonrpc:"2.0",error:a})}if(typeof t.method!="string"){const a=new ut.EthereumRpcError(ut.errorCodes.rpc.invalidRequest,`Must specify a string method. Received: ${typeof t.method}`,{request:t});return r(a,{id:t.id,jsonrpc:"2.0",error:a})}const n=Object.assign({},t),i={id:n.id,jsonrpc:n.jsonrpc};let s=null;try{await this._processRequest(n,i)}catch(a){s=a}return s&&(delete i.result,i.error||(i.error=ut.serializeError(s))),r(s,i)}async _processRequest(t,r){const[n,i,s]=await At._runAllMiddleware(t,r,this._middleware);if(At._checkForCompletion(t,r,i),await At._runReturnHandlers(s),n)throw n}static async _runAllMiddleware(t,r,n){const i=[];let s=null,a=!1;for(const l of n)if([s,a]=await At._runMiddleware(t,r,l,i),a)break;return[s,a,i.reverse()]}static _runMiddleware(t,r,n,i){return new Promise(s=>{const a=d=>{const h=d||r.error;h&&(r.error=ut.serializeError(h)),s([h,!0])},l=d=>{r.error?a(r.error):(d&&(typeof d!="function"&&a(new ut.EthereumRpcError(ut.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof d}" for request:
${Ts(t)}`,{request:t})),i.push(d)),s([null,!1]))};try{n(t,r,l,a)}catch(d){a(d)}})}static async _runReturnHandlers(t){for(const r of t)await new Promise((n,i)=>{r(s=>s?i(s):n())})}static _checkForCompletion(t,r,n){if(!("result"in r)&&!("error"in r))throw new ut.EthereumRpcError(ut.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:
${Ts(t)}`,{request:t});if(!n)throw new ut.EthereumRpcError(ut.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:
${Ts(t)}`,{request:t})}}Bn.JsonRpcEngine=At;function Ts(e){return JSON.stringify(e,null,2)}var Qi={};Object.defineProperty(Qi,"__esModule",{value:!0});Qi.mergeMiddleware=void 0;const Qm=Bn;function Ym(e){const t=new Qm.JsonRpcEngine;return e.forEach(r=>t.push(r)),t.asMiddleware()}Qi.mergeMiddleware=Ym;(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ji,e),r(Gi,e),r(Zi,e),r($n,e),r(Bn,e),r(Qi,e)})(_o);var eu={},Ro={};const Mo=Zr(ou);var Yi={};Object.defineProperty(Yi,"__esModule",{value:!0});var Za=Mo,Xm=function(){function e(t){if(this._maxConcurrency=t,this._queue=[],t<=0)throw new Error("semaphore must be initialized to a positive value");this._value=t}return e.prototype.acquire=function(){var t=this,r=this.isLocked(),n=new Promise(function(i){return t._queue.push(i)});return r||this._dispatch(),n},e.prototype.runExclusive=function(t){return Za.__awaiter(this,void 0,void 0,function(){var r,n,i;return Za.__generator(this,function(s){switch(s.label){case 0:return[4,this.acquire()];case 1:r=s.sent(),n=r[0],i=r[1],s.label=2;case 2:return s.trys.push([2,,4,5]),[4,t(n)];case 3:return[2,s.sent()];case 4:return i(),[7];case 5:return[2]}})})},e.prototype.isLocked=function(){return this._value<=0},e.prototype.release=function(){if(this._maxConcurrency>1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var t=this._currentReleaser;this._currentReleaser=void 0,t()}},e.prototype._dispatch=function(){var t=this,r=this._queue.shift();if(r){var n=!1;this._currentReleaser=function(){n||(n=!0,t._value++,t._dispatch())},r([this._value--,this._currentReleaser])}},e}();Yi.default=Xm;Object.defineProperty(Ro,"__esModule",{value:!0});var Ka=Mo,ev=Yi,tv=function(){function e(){this._semaphore=new ev.default(1)}return e.prototype.acquire=function(){return Ka.__awaiter(this,void 0,void 0,function(){var t,r;return Ka.__generator(this,function(n){switch(n.label){case 0:return[4,this._semaphore.acquire()];case 1:return t=n.sent(),r=t[1],[2,r]}})})},e.prototype.runExclusive=function(t){return this._semaphore.runExclusive(function(){return t()})},e.prototype.isLocked=function(){return this._semaphore.isLocked()},e.prototype.release=function(){this._semaphore.release()},e}();Ro.default=tv;var Xi={};Object.defineProperty(Xi,"__esModule",{value:!0});Xi.withTimeout=void 0;var Kn=Mo;function rv(e,t,r){var n=this;return r===void 0&&(r=new Error("timeout")),{acquire:function(){return new Promise(function(i,s){return Kn.__awaiter(n,void 0,void 0,function(){var a,l,d;return Kn.__generator(this,function(h){switch(h.label){case 0:return a=!1,setTimeout(function(){a=!0,s(r)},t),[4,e.acquire()];case 1:return l=h.sent(),a?(d=Array.isArray(l)?l[1]:l,d()):i(l),[2]}})})})},runExclusive:function(i){return Kn.__awaiter(this,void 0,void 0,function(){var s,a;return Kn.__generator(this,function(l){switch(l.label){case 0:s=function(){},l.label=1;case 1:return l.trys.push([1,,7,8]),[4,this.acquire()];case 2:return a=l.sent(),Array.isArray(a)?(s=a[1],[4,i(a[0])]):[3,4];case 3:return[2,l.sent()];case 4:return s=a,[4,i()];case 5:return[2,l.sent()];case 6:return[3,8];case 7:return s(),[7];case 8:return[2]}})})},release:function(){e.release()},isLocked:function(){return e.isLocked()}}}Xi.withTimeout=rv;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.withTimeout=e.Semaphore=e.Mutex=void 0;var t=Ro;Object.defineProperty(e,"Mutex",{enumerable:!0,get:function(){return t.default}});var r=Yi;Object.defineProperty(e,"Semaphore",{enumerable:!0,get:function(){return r.default}});var n=Xi;Object.defineProperty(e,"withTimeout",{enumerable:!0,get:function(){return n.withTimeout}})})(eu);var nv=sv,iv=Object.prototype.hasOwnProperty;function sv(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var n in r)iv.call(r,n)&&(e[n]=r[n])}return e}const ov=nv,av=ro();var cv=ee;function ee(e){const t=this;t.currentProvider=e}ee.prototype.getBalance=Dn(2,"eth_getBalance");ee.prototype.getCode=Dn(2,"eth_getCode");ee.prototype.getTransactionCount=Dn(2,"eth_getTransactionCount");ee.prototype.getStorageAt=Dn(3,"eth_getStorageAt");ee.prototype.call=Dn(2,"eth_call");ee.prototype.protocolVersion=ie("eth_protocolVersion");ee.prototype.syncing=ie("eth_syncing");ee.prototype.coinbase=ie("eth_coinbase");ee.prototype.mining=ie("eth_mining");ee.prototype.hashrate=ie("eth_hashrate");ee.prototype.gasPrice=ie("eth_gasPrice");ee.prototype.accounts=ie("eth_accounts");ee.prototype.blockNumber=ie("eth_blockNumber");ee.prototype.getBlockTransactionCountByHash=ie("eth_getBlockTransactionCountByHash");ee.prototype.getBlockTransactionCountByNumber=ie("eth_getBlockTransactionCountByNumber");ee.prototype.getUncleCountByBlockHash=ie("eth_getUncleCountByBlockHash");ee.prototype.getUncleCountByBlockNumber=ie("eth_getUncleCountByBlockNumber");ee.prototype.sign=ie("eth_sign");ee.prototype.sendTransaction=ie("eth_sendTransaction");ee.prototype.sendRawTransaction=ie("eth_sendRawTransaction");ee.prototype.estimateGas=ie("eth_estimateGas");ee.prototype.getBlockByHash=ie("eth_getBlockByHash");ee.prototype.getBlockByNumber=ie("eth_getBlockByNumber");ee.prototype.getTransactionByHash=ie("eth_getTransactionByHash");ee.prototype.getTransactionByBlockHashAndIndex=ie("eth_getTransactionByBlockHashAndIndex");ee.prototype.getTransactionByBlockNumberAndIndex=ie("eth_getTransactionByBlockNumberAndIndex");ee.prototype.getTransactionReceipt=ie("eth_getTransactionReceipt");ee.prototype.getUncleByBlockHashAndIndex=ie("eth_getUncleByBlockHashAndIndex");ee.prototype.getUncleByBlockNumberAndIndex=ie("eth_getUncleByBlockNumberAndIndex");ee.prototype.getCompilers=ie("eth_getCompilers");ee.prototype.compileLLL=ie("eth_compileLLL");ee.prototype.compileSolidity=ie("eth_compileSolidity");ee.prototype.compileSerpent=ie("eth_compileSerpent");ee.prototype.newFilter=ie("eth_newFilter");ee.prototype.newBlockFilter=ie("eth_newBlockFilter");ee.prototype.newPendingTransactionFilter=ie("eth_newPendingTransactionFilter");ee.prototype.uninstallFilter=ie("eth_uninstallFilter");ee.prototype.getFilterChanges=ie("eth_getFilterChanges");ee.prototype.getFilterLogs=ie("eth_getFilterLogs");ee.prototype.getLogs=ie("eth_getLogs");ee.prototype.getWork=ie("eth_getWork");ee.prototype.submitWork=ie("eth_submitWork");ee.prototype.submitHashrate=ie("eth_submitHashrate");ee.prototype.sendAsync=function(e,t){this.currentProvider.sendAsync(lv(e),function(n,i){if(!n&&i.error&&(n=new Error("EthQuery - RPC Error - "+i.error.message)),n)return t(n);t(null,i.result)})};function ie(e){return function(){const t=this;var r=[].slice.call(arguments),n=r.pop();t.sendAsync({method:e,params:r},n)}}function Dn(e,t){return function(){const r=this;var n=[].slice.call(arguments),i=n.pop();n.length<e&&n.push("latest"),r.sendAsync({method:t,params:n},i)}}function lv(e){return ov({id:av(),jsonrpc:"2.0",params:[]},e)}const Qa=(e,t,r,n)=>function(...i){const s=t.promiseModule;return new s((a,l)=>{t.multiArgs?i.push((...h)=>{t.errorFirst?h[0]?l(h):(h.shift(),a(h)):a(h)}):t.errorFirst?i.push((h,m)=>{h?l(h):a(m)}):i.push(a),Reflect.apply(e,this===r?n:this,i)})},Ya=new WeakMap;var uv=(e,t)=>{t={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...t};const r=typeof e;if(!(e!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${e===null?"null":r}\``);const n=(a,l)=>{let d=Ya.get(a);if(d||(d={},Ya.set(a,d)),l in d)return d[l];const h=x=>typeof x=="string"||typeof l=="symbol"?l===x:x.test(l),m=Reflect.getOwnPropertyDescriptor(a,l),R=m===void 0||m.writable||m.configurable,C=(t.include?t.include.some(h):!t.exclude.some(h))&&R;return d[l]=C,C},i=new WeakMap,s=new Proxy(e,{apply(a,l,d){const h=i.get(a);if(h)return Reflect.apply(h,l,d);const m=t.excludeMain?a:Qa(a,t,s,a);return i.set(a,m),Reflect.apply(m,l,d)},get(a,l){const d=a[l];if(!n(a,l)||d===Function.prototype[l])return d;const h=i.get(d);if(h)return h;if(typeof d=="function"){const m=Qa(d,t,s,a);return i.set(d,m),m}return d}});return s};const hv=An.default;let dv=class extends hv{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(t){this.updates=this.updates.concat(t),t.forEach(r=>this.emit("update",r))}addInitialResults(t){}getChangesAndClear(){const t=this.updates;return this.updates=[],t}};var ko=dv;const fv=ko;let pv=class extends fv{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(t){this.allResults=this.allResults.concat(t),super.addResults(t)}addInitialResults(t){this.allResults=this.allResults.concat(t),super.addInitialResults(t)}getAllResults(){return this.allResults}};var gv=pv,Fn={minBlockRef:mv,maxBlockRef:vv,sortBlockRefs:Co,bnToHex:bv,blockRefIsNumber:wv,hexToInt:ni,incrementHexInt:_v,intToHex:tu,unsafeRandomBytes:yv};function mv(...e){return Co(e)[0]}function vv(...e){const t=Co(e);return t[t.length-1]}function Co(e){return e.sort((t,r)=>t==="latest"||r==="earliest"?1:r==="latest"||t==="earliest"?-1:ni(t)-ni(r))}function bv(e){return"0x"+e.toString(16)}function wv(e){return e&&!["earliest","latest","pending"].includes(e)}function ni(e){return e==null?e:Number.parseInt(e,16)}function _v(e){if(e==null)return e;const t=ni(e);return tu(t+1)}function tu(e){if(e==null)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function yv(e){let t="0x";for(let r=0;r<e;r++)t+=Xa(),t+=Xa();return t}function Xa(){return Math.floor(Math.random()*16).toString(16)}const Ev=cv,Sv=uv,Rv=gv,{bnToHex:Fb,hexToInt:Qn,incrementHexInt:Mv,minBlockRef:kv,blockRefIsNumber:Cv}=Fn;let Iv=class extends Rv{constructor({provider:t,params:r}){super(),this.type="log",this.ethQuery=new Ev(t),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},r),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map(n=>n.toLowerCase()))}async initialize({currentBlock:t}){let r=this.params.fromBlock;["latest","pending"].includes(r)&&(r=t),r==="earliest"&&(r="0x0"),this.params.fromBlock=r;const n=kv(this.params.toBlock,t),i=Object.assign({},this.params,{toBlock:n}),s=await this._fetchLogs(i);this.addInitialResults(s)}async update({oldBlock:t,newBlock:r}){const n=r;let i;t?i=Mv(t):i=r;const s=Object.assign({},this.params,{fromBlock:i,toBlock:n}),l=(await this._fetchLogs(s)).filter(d=>this.matchLog(d));this.addResults(l)}async _fetchLogs(t){return await Sv(n=>this.ethQuery.getLogs(t,n))()}matchLog(t){if(Qn(this.params.fromBlock)>=Qn(t.blockNumber)||Cv(this.params.toBlock)&&Qn(this.params.toBlock)<=Qn(t.blockNumber))return!1;const r=t.address&&t.address.toLowerCase();return this.params.address&&r&&!this.params.address.includes(r)?!1:this.params.topics.every((i,s)=>{let a=t.topics[s];if(!a)return!1;a=a.toLowerCase();let l=Array.isArray(i)?i:[i];return l.includes(null)?!0:(l=l.map(m=>m.toLowerCase()),l.includes(a))})}};var xv=Iv,Io=Av;async function Av({provider:e,fromBlock:t,toBlock:r}){t||(t=r);const n=ec(t),s=ec(r)-n+1,a=Array(s).fill().map((d,h)=>n+h).map(Tv);let l=await Promise.all(a.map(d=>Lv(e,"eth_getBlockByNumber",[d,!1])));return l=l.filter(d=>d!==null),l}function ec(e){return e==null?e:Number.parseInt(e,16)}function Tv(e){return e==null?e:"0x"+e.toString(16)}function Nv(e,t){return new Promise((r,n)=>{e.sendAsync(t,(i,s)=>{i?n(i):s.error?n(s.error):s.result?r(s.result):n(new Error("Result was empty"))})})}async function Lv(e,t,r){for(let n=0;n<3;n++)try{return await Nv(e,{id:1,jsonrpc:"2.0",method:t,params:r})}catch(i){console.error(`provider.sendAsync failed: ${i.stack||i.message||i}`)}return null}const Ov=ko,Pv=Io,{incrementHexInt:$v}=Fn;let Bv=class extends Ov{constructor({provider:t,params:r}){super(),this.type="block",this.provider=t}async update({oldBlock:t,newBlock:r}){const n=r,i=$v(t),a=(await Pv({provider:this.provider,fromBlock:i,toBlock:n})).map(l=>l.hash);this.addResults(a)}};var Dv=Bv;const Fv=ko,jv=Io,{incrementHexInt:Hv}=Fn;let Uv=class extends Fv{constructor({provider:t}){super(),this.type="tx",this.provider=t}async update({oldBlock:t}){const r=t,n=Hv(t),i=await jv({provider:this.provider,fromBlock:n,toBlock:r}),s=[];for(const a of i)s.push(...a.transactions);this.addResults(s)}};var Wv=Uv;const Vv=eu.Mutex,{createAsyncMiddleware:zv,createScaffoldMiddleware:qv}=_o,Jv=xv,Gv=Dv,Zv=Wv,{intToHex:ru,hexToInt:Ns}=Fn;var Kv=Qv;function Qv({blockTracker:e,provider:t}){let r=0,n={};const i=new Vv,s=Yv({mutex:i}),a=qv({eth_newFilter:s(Ls(d)),eth_newBlockFilter:s(Ls(h)),eth_newPendingTransactionFilter:s(Ls(m)),eth_uninstallFilter:s(ei(C)),eth_getFilterChanges:s(ei(R)),eth_getFilterLogs:s(ei(y))}),l=async({oldBlock:T,newBlock:N})=>{if(n.length===0)return;const D=await i.acquire();try{await Promise.all(Pr(n).map(async L=>{try{await L.update({oldBlock:T,newBlock:N})}catch(F){console.error(F)}}))}catch(L){console.error(L)}D()};return a.newLogFilter=d,a.newBlockFilter=h,a.newPendingTransactionFilter=m,a.uninstallFilter=C,a.getFilterChanges=R,a.getFilterLogs=y,a.destroy=()=>{O()},a;async function d(T){const N=new Jv({provider:t,params:T});return await x(N),N}async function h(){const T=new Gv({provider:t});return await x(T),T}async function m(){const T=new Zv({provider:t});return await x(T),T}async function R(T){const N=Ns(T),D=n[N];if(!D)throw new Error(`No filter for index "${N}"`);return D.getChangesAndClear()}async function y(T){const N=Ns(T),D=n[N];if(!D)throw new Error(`No filter for index "${N}"`);let L=[];return D.type==="log"&&(L=D.getAllResults()),L}async function C(T){const N=Ns(T),L=!!n[N];return L&&await B(N),L}async function x(T){const N=Pr(n).length,D=await e.getLatestBlock();await T.initialize({currentBlock:D}),r++,n[r]=T,T.id=r,T.idHex=ru(r);const L=Pr(n).length;return M({prevFilterCount:N,newFilterCount:L}),r}async function B(T){const N=Pr(n).length;delete n[T];const D=Pr(n).length;M({prevFilterCount:N,newFilterCount:D})}async function O(){const T=Pr(n).length;n={},M({prevFilterCount:T,newFilterCount:0})}function M({prevFilterCount:T,newFilterCount:N}){if(T===0&&N>0){e.on("sync",l);return}if(T>0&&N===0){e.removeListener("sync",l);return}}}function Ls(e){return ei(async(...t)=>{const r=await e(...t);return ru(r.id)})}function ei(e){return zv(async(t,r)=>{const n=await e.apply(null,t.params);r.result=n})}function Yv({mutex:e}){return t=>async(r,n,i,s)=>{(await e.acquire())(),t(r,n,i,s)}}function Pr(e,t){const r=[];for(let n in e)r.push(e[n]);return r}const Xv=An.default,{createAsyncMiddleware:tc,createScaffoldMiddleware:eb}=_o,tb=Kv,{unsafeRandomBytes:rb,incrementHexInt:nb}=Fn,ib=Io;var sb=ob;function ob({blockTracker:e,provider:t}){const r={},n=tb({blockTracker:e,provider:t});let i=!1;const s=new Xv,a=eb({eth_subscribe:tc(l),eth_unsubscribe:tc(d)});return a.destroy=m,{events:s,middleware:a};async function l(R,y){if(i)throw new Error("SubscriptionManager - attempting to use after destroying");const C=R.params[0],x=rb(16);let B;switch(C){case"newHeads":B=O({subId:x});break;case"logs":const T=R.params[1],N=await n.newLogFilter(T);B=M({subId:x,filter:N});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${C}"`)}r[x]=B,y.result=x;return;function O({subId:T}){const N={type:C,destroy:async()=>{e.removeListener("sync",N.update)},update:async({oldBlock:D,newBlock:L})=>{const F=L,W=nb(D);(await ib({provider:t,fromBlock:W,toBlock:F})).map(ab).filter(z=>z!==null).forEach(z=>{h(T,z)})}};return e.on("sync",N.update),N}function M({subId:T,filter:N}){return N.on("update",L=>h(T,L)),{type:C,destroy:async()=>await n.uninstallFilter(N.idHex)}}}async function d(R,y){if(i)throw new Error("SubscriptionManager - attempting to use after destroying");const C=R.params[0],x=r[C];if(!x){y.result=!1;return}delete r[C],await x.destroy(),y.result=!0}function h(R,y){s.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:R,result:y}})}function m(){s.removeAllListeners();for(const R in r)r[R].destroy(),delete r[R];i=!0}}function ab(e){return e==null?null:{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}Object.defineProperty($i,"__esModule",{value:!0});$i.SubscriptionManager=void 0;const cb=cl,lb=sb,rc=()=>{};class ub{constructor(t){const r=new cb.PollingBlockTracker({provider:t,pollingInterval:15e3,setSkipCacheFlag:!0}),{events:n,middleware:i}=lb({blockTracker:r,provider:t});this.events=n,this.subscriptionMiddleware=i}async handleRequest(t){const r={};return await this.subscriptionMiddleware(t,r,rc,rc),r}destroy(){this.subscriptionMiddleware.destroy()}}$i.SubscriptionManager=ub;var nu=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.CoinbaseWalletProvider=void 0;const hb=nu(ci),db=ju,se=gn,re=q,fb=wn,nc=ht,Yn=Xr,it=Kr,Os=nu(Gf),ln=Yr,pb=qr,gb=$i,ic="DefaultChainId",sc="DefaultJsonRpcUrl";class mb extends db.EventEmitter{constructor(t){var r,n;super(),this._filterPolyfill=new pb.FilterPolyfill(this),this._subscriptionManager=new gb.SubscriptionManager(this),this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1,this.setProviderInfo=this.setProviderInfo.bind(this),this.updateProviderInfo=this.updateProviderInfo.bind(this),this.getChainId=this.getChainId.bind(this),this.setAppInfo=this.setAppInfo.bind(this),this.enable=this.enable.bind(this),this.close=this.close.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this.request=this.request.bind(this),this._setAddresses=this._setAddresses.bind(this),this.scanQRCode=this.scanQRCode.bind(this),this.genericRequest=this.genericRequest.bind(this),this._chainIdFromOpts=t.chainId,this._jsonRpcUrlFromOpts=t.jsonRpcUrl,this._overrideIsMetaMask=t.overrideIsMetaMask,this._relayProvider=t.relayProvider,this._storage=t.storage,this._relayEventManager=t.relayEventManager,this.diagnostic=t.diagnosticLogger,this.reloadOnDisconnect=!0,this.isCoinbaseWallet=(r=t.overrideIsCoinbaseWallet)!==null&&r!==void 0?r:!0,this.isCoinbaseBrowser=(n=t.overrideIsCoinbaseBrowser)!==null&&n!==void 0?n:!1,this.qrUrl=t.qrUrl;const i=this.getChainId(),s=(0,re.prepend0x)(i.toString(16));this.emit("connect",{chainIdStr:s});const a=this._storage.getItem(nc.LOCAL_STORAGE_ADDRESSES_KEY);if(a){const l=a.split(" ");l[0]!==""&&(this._addresses=l.map(d=>(0,re.ensureAddressString)(d)),this.emit("accountsChanged",l))}this._subscriptionManager.events.on("notification",l=>{this.emit("message",{type:l.method,data:l.params})}),this._isAuthorized()&&this.initializeRelay(),window.addEventListener("message",l=>{var d;if(!(l.origin!==location.origin||l.source!==window)&&l.data.type==="walletLinkMessage"&&l.data.data.action==="dappChainSwitched"){const h=l.data.data.chainId,m=(d=l.data.data.jsonRpcUrl)!==null&&d!==void 0?d:this.jsonRpcUrl;this.updateProviderInfo(m,Number(h))}})}get selectedAddress(){return this._addresses[0]||void 0}get networkVersion(){return this.getChainId().toString(10)}get chainId(){return(0,re.prepend0x)(this.getChainId().toString(16))}get isWalletLink(){return!0}get isMetaMask(){return this._overrideIsMetaMask}get host(){return this.jsonRpcUrl}get connected(){return!0}isConnected(){return!0}get jsonRpcUrl(){var t;return(t=this._storage.getItem(sc))!==null&&t!==void 0?t:this._jsonRpcUrlFromOpts}set jsonRpcUrl(t){this._storage.setItem(sc,t)}disableReloadOnDisconnect(){this.reloadOnDisconnect=!1}setProviderInfo(t,r){this.isCoinbaseBrowser||(this._chainIdFromOpts=r,this._jsonRpcUrlFromOpts=t),this.updateProviderInfo(this.jsonRpcUrl,this.getChainId())}updateProviderInfo(t,r){this.jsonRpcUrl=t;const n=this.getChainId();this._storage.setItem(ic,r.toString(10)),((0,re.ensureIntNumber)(r)!==n||!this.hasMadeFirstChainChangedEmission)&&(this.emit("chainChanged",this.getChainId()),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(t,r,n,i,s,a){const d=await(await this.initializeRelay()).watchAsset(t,r,n,i,s,a==null?void 0:a.toString()).promise;return(0,it.isErrorResponse)(d)?!1:!!d.result}async addEthereumChain(t,r,n,i,s,a){var l,d;if((0,re.ensureIntNumber)(t)===this.getChainId())return!1;const h=await this.initializeRelay(),m=h.inlineAddEthereumChain(t.toString());!this._isAuthorized()&&!m&&await h.requestEthereumAccounts().promise;const R=await h.addEthereumChain(t.toString(),r,s,n,i,a).promise;return(0,it.isErrorResponse)(R)?!1:(((l=R.result)===null||l===void 0?void 0:l.isApproved)===!0&&this.updateProviderInfo(r[0],t),((d=R.result)===null||d===void 0?void 0:d.isApproved)===!0)}async switchEthereumChain(t){const n=await(await this.initializeRelay()).switchEthereumChain(t.toString(10),this.selectedAddress||void 0).promise;if((0,it.isErrorResponse)(n)){if(!n.errorCode)return;throw n.errorCode===se.standardErrorCodes.provider.unsupportedChain?se.standardErrors.provider.unsupportedChain():se.standardErrors.provider.custom({message:n.errorMessage,code:n.errorCode})}const i=n.result;i.isApproved&&i.rpcUrl.length>0&&this.updateProviderInfo(i.rpcUrl,t)}setAppInfo(t,r){this.initializeRelay().then(n=>n.setAppInfo(t,r))}async enable(){var t;return(t=this.diagnostic)===null||t===void 0||t.log(ln.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::enable",addresses_length:this._addresses.length,sessionIdHash:this._relay?Yn.Session.hash(this._relay.session.id):void 0}),this._isAuthorized()?[...this._addresses]:await this.send("eth_requestAccounts")}async close(){(await this.initializeRelay()).resetAndReload()}send(t,r){try{const n=this._send(t,r);if(n instanceof Promise)return n.catch(i=>{throw(0,se.serializeError)(i,t)})}catch(n){throw(0,se.serializeError)(n,t)}}_send(t,r){if(typeof t=="string"){const i=t,s=Array.isArray(r)?r:r!==void 0?[r]:[],a={jsonrpc:"2.0",id:0,method:i,params:s};return this._sendRequestAsync(a).then(l=>l.result)}if(typeof r=="function"){const i=t,s=r;return this._sendAsync(i,s)}if(Array.isArray(t))return t.map(s=>this._sendRequest(s));const n=t;return this._sendRequest(n)}async sendAsync(t,r){try{return this._sendAsync(t,r).catch(n=>{throw(0,se.serializeError)(n,t)})}catch(n){return Promise.reject((0,se.serializeError)(n,t))}}async _sendAsync(t,r){if(typeof r!="function")throw new Error("callback is required");if(Array.isArray(t)){const i=r;this._sendMultipleRequestsAsync(t).then(s=>i(null,s)).catch(s=>i(s,null));return}const n=r;return this._sendRequestAsync(t).then(i=>n(null,i)).catch(i=>n(i,null))}async request(t){try{return this._request(t).catch(r=>{throw(0,se.serializeError)(r,t.method)})}catch(r){return Promise.reject((0,se.serializeError)(r,t.method))}}async _request(t){if(!t||typeof t!="object"||Array.isArray(t))throw se.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:t});const{method:r,params:n}=t;if(typeof r!="string"||r.length===0)throw se.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:t});if(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw se.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:t});const i=n===void 0?[]:n,s=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:r,params:i,jsonrpc:"2.0",id:s})).result}async scanQRCode(t){const n=await(await this.initializeRelay()).scanQRCode((0,re.ensureRegExpString)(t)).promise;if((0,it.isErrorResponse)(n))throw(0,se.serializeError)(n.errorMessage,"scanQRCode");if(typeof n.result!="string")throw(0,se.serializeError)("result was not a string","scanQRCode");return n.result}async genericRequest(t,r){const i=await(await this.initializeRelay()).genericRequest(t,r).promise;if((0,it.isErrorResponse)(i))throw(0,se.serializeError)(i.errorMessage,"generic");if(typeof i.result!="string")throw(0,se.serializeError)("result was not a string","generic");return i.result}async connectAndSignIn(t){var r;(r=this.diagnostic)===null||r===void 0||r.log(ln.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::connectAndSignIn",sessionIdHash:this._relay?Yn.Session.hash(this._relay.session.id):void 0});let n;try{const s=await this.initializeRelay();if(!(s instanceof fb.MobileRelay))throw new Error("connectAndSignIn is only supported on mobile");if(n=await s.connectAndSignIn(t).promise,(0,it.isErrorResponse)(n))throw new Error(n.errorMessage)}catch(s){throw typeof s.message=="string"&&s.message.match(/(denied|rejected)/i)?se.standardErrors.provider.userRejectedRequest("User denied account authorization"):s}if(!n.result)throw new Error("accounts received is empty");const{accounts:i}=n.result;return this._setAddresses(i),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),n.result}async selectProvider(t){const n=await(await this.initializeRelay()).selectProvider(t).promise;if((0,it.isErrorResponse)(n))throw(0,se.serializeError)(n.errorMessage,"selectProvider");if(typeof n.result!="string")throw(0,se.serializeError)("result was not a string","selectProvider");return n.result}supportsSubscriptions(){return!1}subscribe(){throw new Error("Subscriptions are not supported")}unsubscribe(){throw new Error("Subscriptions are not supported")}disconnect(){return!0}_sendRequest(t){const r={jsonrpc:"2.0",id:t.id},{method:n}=t;if(r.result=this._handleSynchronousMethods(t),r.result===void 0)throw new Error(`Coinbase Wallet does not support calling ${n} synchronously without a callback. Please provide a callback parameter to call ${n} asynchronously.`);return r}_setAddresses(t,r){if(!Array.isArray(t))throw new Error("addresses is not an array");const n=t.map(i=>(0,re.ensureAddressString)(i));JSON.stringify(n)!==JSON.stringify(this._addresses)&&(this._addresses=n,this.emit("accountsChanged",this._addresses),this._storage.setItem(nc.LOCAL_STORAGE_ADDRESSES_KEY,n.join(" ")))}_sendRequestAsync(t){return new Promise((r,n)=>{try{const i=this._handleSynchronousMethods(t);if(i!==void 0)return r({jsonrpc:"2.0",id:t.id,result:i});const s=this._handleAsynchronousFilterMethods(t);if(s!==void 0){s.then(l=>r(Object.assign(Object.assign({},l),{id:t.id}))).catch(l=>n(l));return}const a=this._handleSubscriptionMethods(t);if(a!==void 0){a.then(l=>r({jsonrpc:"2.0",id:t.id,result:l.result})).catch(l=>n(l));return}}catch(i){return n(i)}this._handleAsynchronousMethods(t).then(i=>i&&r(Object.assign(Object.assign({},i),{id:t.id}))).catch(i=>n(i))})}_sendMultipleRequestsAsync(t){return Promise.all(t.map(r=>this._sendRequestAsync(r)))}_handleSynchronousMethods(t){const{method:r}=t,n=t.params||[];switch(r){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"eth_uninstallFilter":return this._eth_uninstallFilter(n);case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(t){const{method:r}=t,n=t.params||[];switch(r){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(n);case"eth_ecRecover":return this._eth_ecRecover(n);case"personal_sign":return this._personal_sign(n);case"personal_ecRecover":return this._personal_ecRecover(n);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(n);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(n);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(n);case"cbWallet_arbitrary":return this._cbwallet_arbitrary(n);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(n);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(n);case"wallet_watchAsset":return this._wallet_watchAsset(n)}return(await this.initializeRelay()).makeEthereumJSONRPCRequest(t,this.jsonRpcUrl).catch(s=>{var a;throw(s.code===se.standardErrorCodes.rpc.methodNotFound||s.code===se.standardErrorCodes.rpc.methodNotSupported)&&((a=this.diagnostic)===null||a===void 0||a.log(ln.EVENTS.METHOD_NOT_IMPLEMENTED,{method:t.method,sessionIdHash:this._relay?Yn.Session.hash(this._relay.session.id):void 0})),s})}_handleAsynchronousFilterMethods(t){const{method:r}=t,n=t.params||[];switch(r){case"eth_newFilter":return this._eth_newFilter(n);case"eth_newBlockFilter":return this._eth_newBlockFilter();case"eth_newPendingTransactionFilter":return this._eth_newPendingTransactionFilter();case"eth_getFilterChanges":return this._eth_getFilterChanges(n);case"eth_getFilterLogs":return this._eth_getFilterLogs(n)}}_handleSubscriptionMethods(t){switch(t.method){case"eth_subscribe":case"eth_unsubscribe":return this._subscriptionManager.handleRequest(t)}}_isKnownAddress(t){try{const r=(0,re.ensureAddressString)(t);return this._addresses.map(i=>(0,re.ensureAddressString)(i)).includes(r)}catch{}return!1}_ensureKnownAddress(t){var r;if(!this._isKnownAddress(t))throw(r=this.diagnostic)===null||r===void 0||r.log(ln.EVENTS.UNKNOWN_ADDRESS_ENCOUNTERED),new Error("Unknown Ethereum address")}_prepareTransactionParams(t){const r=t.from?(0,re.ensureAddressString)(t.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=t.to?(0,re.ensureAddressString)(t.to):null,i=t.value!=null?(0,re.ensureBN)(t.value):new hb.default(0),s=t.data?(0,re.ensureBuffer)(t.data):Buffer.alloc(0),a=t.nonce!=null?(0,re.ensureIntNumber)(t.nonce):null,l=t.gasPrice!=null?(0,re.ensureBN)(t.gasPrice):null,d=t.maxFeePerGas!=null?(0,re.ensureBN)(t.maxFeePerGas):null,h=t.maxPriorityFeePerGas!=null?(0,re.ensureBN)(t.maxPriorityFeePerGas):null,m=t.gas!=null?(0,re.ensureBN)(t.gas):null,R=t.chainId?(0,re.ensureIntNumber)(t.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:a,gasPriceInWei:l,maxFeePerGas:d,maxPriorityFeePerGas:h,gasLimit:m,chainId:R}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw se.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw se.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(t,r,n,i){this._ensureKnownAddress(r);try{const a=await(await this.initializeRelay()).signEthereumMessage(t,r,n,i).promise;if((0,it.isErrorResponse)(a))throw new Error(a.errorMessage);return{jsonrpc:"2.0",id:0,result:a.result}}catch(s){throw typeof s.message=="string"&&s.message.match(/(denied|rejected)/i)?se.standardErrors.provider.userRejectedRequest("User denied message signature"):s}}async _ethereumAddressFromSignedMessage(t,r,n){const s=await(await this.initializeRelay()).ethereumAddressFromSignedMessage(t,r,n).promise;if((0,it.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,re.hexStringFromIntNumber)(this.getChainId())}getChainId(){const t=this._storage.getItem(ic);if(!t)return(0,re.ensureIntNumber)(this._chainIdFromOpts);const r=parseInt(t,10);return(0,re.ensureIntNumber)(r)}async _eth_requestAccounts(){var t;if((t=this.diagnostic)===null||t===void 0||t.log(ln.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::_eth_requestAccounts",addresses_length:this._addresses.length,sessionIdHash:this._relay?Yn.Session.hash(this._relay.session.id):void 0}),this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let r;try{if(r=await(await this.initializeRelay()).requestEthereumAccounts().promise,(0,it.isErrorResponse)(r))throw new Error(r.errorMessage)}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?se.standardErrors.provider.userRejectedRequest("User denied account authorization"):n}if(!r.result)throw new Error("accounts received is empty");return this._setAddresses(r.result),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(t){this._requireAuthorization();const r=(0,re.ensureAddressString)(t[0]),n=(0,re.ensureBuffer)(t[1]);return this._signEthereumMessage(n,r,!1)}_eth_ecRecover(t){const r=(0,re.ensureBuffer)(t[0]),n=(0,re.ensureBuffer)(t[1]);return this._ethereumAddressFromSignedMessage(r,n,!1)}_personal_sign(t){this._requireAuthorization();const r=(0,re.ensureBuffer)(t[0]),n=(0,re.ensureAddressString)(t[1]);return this._signEthereumMessage(r,n,!0)}_personal_ecRecover(t){const r=(0,re.ensureBuffer)(t[0]),n=(0,re.ensureBuffer)(t[1]);return this._ethereumAddressFromSignedMessage(r,n,!0)}async _eth_signTransaction(t){this._requireAuthorization();const r=this._prepareTransactionParams(t[0]||{});try{const i=await(await this.initializeRelay()).signEthereumTransaction(r).promise;if((0,it.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?se.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}async _eth_sendRawTransaction(t){const r=(0,re.ensureBuffer)(t[0]),i=await(await this.initializeRelay()).submitEthereumTransaction(r,this.getChainId()).promise;if((0,it.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}async _eth_sendTransaction(t){this._requireAuthorization();const r=this._prepareTransactionParams(t[0]||{});try{const i=await(await this.initializeRelay()).signAndSubmitEthereumTransaction(r).promise;if((0,it.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?se.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}async _eth_signTypedData_v1(t){this._requireAuthorization();const r=(0,re.ensureParsedJSONObject)(t[0]),n=(0,re.ensureAddressString)(t[1]);this._ensureKnownAddress(n);const i=Os.default.hashForSignTypedDataLegacy({data:r}),s=JSON.stringify(r,null,2);return this._signEthereumMessage(i,n,!1,s)}async _eth_signTypedData_v3(t){this._requireAuthorization();const r=(0,re.ensureAddressString)(t[0]),n=(0,re.ensureParsedJSONObject)(t[1]);this._ensureKnownAddress(r);const i=Os.default.hashForSignTypedData_v3({data:n}),s=JSON.stringify(n,null,2);return this._signEthereumMessage(i,r,!1,s)}async _eth_signTypedData_v4(t){this._requireAuthorization();const r=(0,re.ensureAddressString)(t[0]),n=(0,re.ensureParsedJSONObject)(t[1]);this._ensureKnownAddress(r);const i=Os.default.hashForSignTypedData_v4({data:n}),s=JSON.stringify(n,null,2);return this._signEthereumMessage(i,r,!1,s)}async _cbwallet_arbitrary(t){const r=t[0],n=t[1];if(typeof n!="string")throw new Error("parameter must be a string");if(typeof r!="object"||r===null)throw new Error("parameter must be an object");return{jsonrpc:"2.0",id:0,result:await this.genericRequest(r,n)}}async _wallet_addEthereumChain(t){var r,n,i,s;const a=t[0];if(((r=a.rpcUrls)===null||r===void 0?void 0:r.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!a.chainName||a.chainName.trim()==="")throw se.standardErrors.rpc.invalidParams("chainName is a required field");if(!a.nativeCurrency)throw se.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const l=parseInt(a.chainId,16);return await this.addEthereumChain(l,(n=a.rpcUrls)!==null&&n!==void 0?n:[],(i=a.blockExplorerUrls)!==null&&i!==void 0?i:[],a.chainName,(s=a.iconUrls)!==null&&s!==void 0?s:[],a.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(t){const r=t[0];return await this.switchEthereumChain(parseInt(r.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(t){const r=Array.isArray(t)?t[0]:t;if(!r.type)throw se.standardErrors.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw se.standardErrors.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw se.standardErrors.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw se.standardErrors.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:a,decimals:l}=r.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(r.type,i,s,l,a,n)}}_eth_uninstallFilter(t){const r=(0,re.ensureHexString)(t[0]);return this._filterPolyfill.uninstallFilter(r)}async _eth_newFilter(t){const r=t[0];return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newFilter(r)}}async _eth_newBlockFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newBlockFilter()}}async _eth_newPendingTransactionFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newPendingTransactionFilter()}}_eth_getFilterChanges(t){const r=(0,re.ensureHexString)(t[0]);return this._filterPolyfill.getFilterChanges(r)}_eth_getFilterLogs(t){const r=(0,re.ensureHexString)(t[0]);return this._filterPolyfill.getFilterLogs(r)}initializeRelay(){return this._relay?Promise.resolve(this._relay):this._relayProvider().then(t=>(t.setAccountsCallback((r,n)=>this._setAddresses(r,n)),t.setChainCallback((r,n)=>{this.updateProviderInfo(n,parseInt(r,10))}),t.setDappDefaultChainCallback(this._chainIdFromOpts),this._relay=t,t))}}Ur.CoinbaseWalletProvider=mb;var es={};Object.defineProperty(es,"__esModule",{value:!0});es.RelayEventManager=void 0;const vb=q;class bb{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const t=this._nextRequestId,r=(0,vb.prepend0x)(t.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),t}}es.RelayEventManager=bb;Object.defineProperty(hn,"__esModule",{value:!0});hn.CoinbaseWalletSDK=void 0;const wb=oi,_b=ai,oc=q,yb=fi,Eb=Ur,Sb=wn,Rb=In,Mb=es,kb=Mn,Cb=_n,iu=Qr;class ts{constructor(t){var r,n,i;this._appName="",this._appLogoUrl=null,this._relay=null,this._relayEventManager=null;const s=t.linkAPIUrl||_b.LINK_API_URL;typeof t.overrideIsMetaMask>"u"?this._overrideIsMetaMask=!1:this._overrideIsMetaMask=t.overrideIsMetaMask,this._overrideIsCoinbaseWallet=(r=t.overrideIsCoinbaseWallet)!==null&&r!==void 0?r:!0,this._overrideIsCoinbaseBrowser=(n=t.overrideIsCoinbaseBrowser)!==null&&n!==void 0?n:!1,this._diagnosticLogger=t.diagnosticLogger,this._reloadOnDisconnect=(i=t.reloadOnDisconnect)!==null&&i!==void 0?i:!0;const a=new URL(s),l=`${a.protocol}//${a.host}`;if(this._storage=new yb.ScopedLocalStorage(`-walletlink:${l}`),this._storage.setItem("version",ts.VERSION),this.walletExtension||this.coinbaseBrowser)return;this._relayEventManager=new Mb.RelayEventManager;const d=(0,oc.isMobileWeb)(),h=t.uiConstructor||(R=>d?new Rb.MobileRelayUI(R):new kb.WalletLinkRelayUI(R)),m={linkAPIUrl:s,version:iu.LIB_VERSION,darkMode:!!t.darkMode,headlessMode:!!t.headlessMode,uiConstructor:h,storage:this._storage,relayEventManager:this._relayEventManager,diagnosticLogger:this._diagnosticLogger,reloadOnDisconnect:this._reloadOnDisconnect,enableMobileWalletLink:t.enableMobileWalletLink};this._relay=d?new Sb.MobileRelay(m):new Cb.WalletLinkRelay(m),this.setAppInfo(t.appName,t.appLogoUrl),!t.headlessMode&&this._relay.attachUI()}makeWeb3Provider(t="",r=1){const n=this.walletExtension;if(n)return this.isCipherProvider(n)||n.setProviderInfo(t,r),this._reloadOnDisconnect===!1&&typeof n.disableReloadOnDisconnect=="function"&&n.disableReloadOnDisconnect(),n;const i=this.coinbaseBrowser;if(i)return i;const s=this._relay;if(!s||!this._relayEventManager||!this._storage)throw new Error("Relay not initialized, should never happen");return t||s.setConnectDisabled(!0),new Eb.CoinbaseWalletProvider({relayProvider:()=>Promise.resolve(s),relayEventManager:this._relayEventManager,storage:this._storage,jsonRpcUrl:t,chainId:r,qrUrl:this.getQrUrl(),diagnosticLogger:this._diagnosticLogger,overrideIsMetaMask:this._overrideIsMetaMask,overrideIsCoinbaseWallet:this._overrideIsCoinbaseWallet,overrideIsCoinbaseBrowser:this._overrideIsCoinbaseBrowser})}setAppInfo(t,r){var n;this._appName=t||"DApp",this._appLogoUrl=r||(0,oc.getFavicon)();const i=this.walletExtension;i?this.isCipherProvider(i)||i.setAppInfo(this._appName,this._appLogoUrl):(n=this._relay)===null||n===void 0||n.setAppInfo(this._appName,this._appLogoUrl)}disconnect(){var t;const r=this===null||this===void 0?void 0:this.walletExtension;r?r.close():(t=this._relay)===null||t===void 0||t.resetAndReload()}getQrUrl(){var t,r;return(r=(t=this._relay)===null||t===void 0?void 0:t.getQRCodeUrl())!==null&&r!==void 0?r:null}getCoinbaseWalletLogo(t,r=240){return(0,wb.walletLogo)(t,r)}get walletExtension(){var t;return(t=window.coinbaseWalletExtension)!==null&&t!==void 0?t:window.walletLinkExtension}get coinbaseBrowser(){var t,r;try{const n=(t=window.ethereum)!==null&&t!==void 0?t:(r=window.top)===null||r===void 0?void 0:r.ethereum;return n&&"isCoinbaseBrowser"in n&&n.isCoinbaseBrowser?n:void 0}catch{return}}isCipherProvider(t){return typeof t.isCipher=="boolean"&&t.isCipher}}hn.CoinbaseWalletSDK=ts;ts.VERSION=iu.LIB_VERSION;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CoinbaseWalletProvider=e.CoinbaseWalletSDK=void 0;const t=hn,r=Ur;var n=hn;Object.defineProperty(e,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}});var i=Ur;Object.defineProperty(e,"CoinbaseWalletProvider",{enumerable:!0,get:function(){return i.CoinbaseWalletProvider}}),e.default=t.CoinbaseWalletSDK,typeof window<"u"&&(window.CoinbaseWalletSDK=t.CoinbaseWalletSDK,window.CoinbaseWalletProvider=r.CoinbaseWalletProvider,window.WalletLink=t.CoinbaseWalletSDK,window.WalletLinkProvider=r.CoinbaseWalletProvider)})(ac);const Ib=au(ac),Wb=Object.freeze(Object.defineProperty({__proto__:null,default:Ib},Symbol.toStringTag,{value:"Module"}));export{Wb as i};