@magic-ext/web3modal-ethers5 1.1.0 → 1.2.0-canary.0163d67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/extension.js CHANGED
@@ -9975,5 +9975,5 @@ function print() { __p += __j.call(arguments, '') }
9975
9975
  }`;var Br=SF(function(){return Ii(re,$t+"return "+$e).apply(r,he)});if(Br.source=$e,dC(Br))throw Br;return Br}function obe(l){return Pi(l).toLowerCase()}function sbe(l){return Pi(l).toUpperCase()}function abe(l,p,S){if(l=Pi(l),l&&(S||p===r))return DB(l);if(!l||!(p=xa(p)))return l;var N=ll(l),z=ll(p),re=LB(N,z),he=BB(N,z)+1;return kh(N,re,he).join("")}function cbe(l,p,S){if(l=Pi(l),l&&(S||p===r))return l.slice(0,FB(l)+1);if(!l||!(p=xa(p)))return l;var N=ll(l),z=BB(N,ll(p))+1;return kh(N,0,z).join("")}function lbe(l,p,S){if(l=Pi(l),l&&(S||p===r))return l.replace(Xe,"");if(!l||!(p=xa(p)))return l;var N=ll(l),z=LB(N,ll(p));return kh(N,z).join("")}function ube(l,p){var S=V,N=M;if(hn(p)){var z="separator"in p?p.separator:z;S="length"in p?Mr(p.length):S,N="omission"in p?xa(p.omission):N}l=Pi(l);var re=l.length;if(Xm(l)){var he=ll(l);re=he.length}if(S>=re)return l;var me=S-eg(N);if(me<1)return N;var be=he?kh(he,0,me).join(""):l.slice(0,me);if(z===r)return be+N;if(he&&(me+=be.length-me),pC(z)){if(l.slice(me).search(z)){var Oe,Me=be;for(z.global||(z=kA(z.source,Pi(rt.exec(z))+"g")),z.lastIndex=0;Oe=z.exec(Me);)var $e=Oe.index;be=be.slice(0,$e===r?me:$e)}}else if(l.indexOf(xa(z),me)!=me){var gt=be.lastIndexOf(z);gt>-1&&(be=be.slice(0,gt))}return be+N}function fbe(l){return l=Pi(l),l&&Pt.test(l)?l.replace(et,jme):l}var hbe=ag(function(l,p,S){return l+(S?" ":"")+p.toUpperCase()}),wC=IU("toUpperCase");function CF(l,p,S){return l=Pi(l),p=S?r:p,p===r?Dme(l)?Hme(l):Sme(l):l.match(p)||[]}var SF=Wr(function(l,p){try{return ba(l,r,p)}catch(S){return dC(S)?S:new br(S)}}),dbe=zf(function(l,p){return cc(p,function(S){S=tu(S),Wf(l,S,fC(l[S],l))}),l});function pbe(l){var p=l==null?0:l.length,S=Qt();return l=p?rn(l,function(N){if(typeof N[1]!="function")throw new lc(s);return[S(N[0]),N[1]]}):[],Wr(function(N){for(var z=-1;++z<p;){var re=l[z];if(ba(re[0],this,N))return ba(re[1],this,N)}})}function mbe(l){return jge(fc(l,b))}function vC(l){return function(){return l}}function gbe(l,p){return l==null||l!==l?p:l}var wbe=RU(),vbe=RU(!0);function Ks(l){return l}function bC(l){return oU(typeof l=="function"?l:fc(l,b))}function bbe(l){return aU(fc(l,b))}function ybe(l,p){return cU(l,fc(p,b))}var xbe=Wr(function(l,p){return function(S){return H3(S,l,p)}}),_be=Wr(function(l,p){return function(S){return H3(l,S,p)}});function yC(l,p,S){var N=lo(p),z=Tx(p,N);S==null&&!(hn(p)&&(z.length||!N.length))&&(S=p,p=l,l=this,z=Tx(p,lo(p)));var re=!(hn(S)&&"chain"in S)||!!S.chain,he=Vf(l);return cc(z,function(me){var be=p[me];l[me]=be,he&&(l.prototype[me]=function(){var Oe=this.__chain__;if(re||Oe){var Me=l(this.__wrapped__),$e=Me.__actions__=zs(this.__actions__);return $e.push({func:be,args:arguments,thisArg:l}),Me.__chain__=Oe,Me}return be.apply(l,Ah([this.value()],arguments))})}),l}function Ebe(){return ko._===this&&(ko._=Zme),this}function xC(){}function Abe(l){return l=Mr(l),Wr(function(p){return lU(p,l)})}var Cbe=QA(rn),Sbe=QA(kB),Ibe=QA(EA);function IF(l){return oC(l)?AA(tu(l)):i2e(l)}function Tbe(l){return function(p){return l==null?r:xp(l,p)}}var Rbe=NU(),kbe=NU(!0);function _C(){return[]}function EC(){return!1}function Nbe(){return{}}function Pbe(){return""}function Obe(){return!0}function Mbe(l,p){if(l=Mr(l),l<1||l>C)return[];var S=d,N=Go(l,d);p=Qt(p),l-=d;for(var z=IA(N,p);++S<l;)p(S);return z}function Dbe(l){return Ar(l)?rn(l,tu):_a(l)?[l]:zs(KU(Pi(l)))}function Lbe(l){var p=++Kme;return Pi(l)+p}var Bbe=Mx(function(l,p){return l+p},0),Ube=XA("ceil"),Fbe=Mx(function(l,p){return l/p},1),jbe=XA("floor");function $be(l){return l&&l.length?Ix(l,Ks,UA):r}function Wbe(l,p){return l&&l.length?Ix(l,Qt(p,2),UA):r}function Hbe(l){return OB(l,Ks)}function zbe(l,p){return OB(l,Qt(p,2))}function qbe(l){return l&&l.length?Ix(l,Ks,WA):r}function Vbe(l,p){return l&&l.length?Ix(l,Qt(p,2),WA):r}var Kbe=Mx(function(l,p){return l*p},1),Gbe=XA("round"),Zbe=Mx(function(l,p){return l-p},0);function Ybe(l){return l&&l.length?SA(l,Ks):0}function Jbe(l,p){return l&&l.length?SA(l,Qt(p,2)):0}return Y.after=b3e,Y.ary=nF,Y.assign=sve,Y.assignIn=vF,Y.assignInWith=Kx,Y.assignWith=ave,Y.at=cve,Y.before=oF,Y.bind=fC,Y.bindAll=dbe,Y.bindKey=sF,Y.castArray=N3e,Y.chain=tF,Y.chunk=j2e,Y.compact=$2e,Y.concat=W2e,Y.cond=pbe,Y.conforms=mbe,Y.constant=vC,Y.countBy=Ywe,Y.create=lve,Y.curry=aF,Y.curryRight=cF,Y.debounce=lF,Y.defaults=uve,Y.defaultsDeep=fve,Y.defer=y3e,Y.delay=x3e,Y.difference=H2e,Y.differenceBy=z2e,Y.differenceWith=q2e,Y.drop=V2e,Y.dropRight=K2e,Y.dropRightWhile=G2e,Y.dropWhile=Z2e,Y.fill=Y2e,Y.filter=Qwe,Y.flatMap=t3e,Y.flatMapDeep=r3e,Y.flatMapDepth=i3e,Y.flatten=JU,Y.flattenDeep=J2e,Y.flattenDepth=Q2e,Y.flip=_3e,Y.flow=wbe,Y.flowRight=vbe,Y.fromPairs=X2e,Y.functions=vve,Y.functionsIn=bve,Y.groupBy=n3e,Y.initial=twe,Y.intersection=rwe,Y.intersectionBy=iwe,Y.intersectionWith=nwe,Y.invert=xve,Y.invertBy=_ve,Y.invokeMap=s3e,Y.iteratee=bC,Y.keyBy=a3e,Y.keys=lo,Y.keysIn=Vs,Y.map=$x,Y.mapKeys=Ave,Y.mapValues=Cve,Y.matches=bbe,Y.matchesProperty=ybe,Y.memoize=Hx,Y.merge=Sve,Y.mergeWith=bF,Y.method=xbe,Y.methodOf=_be,Y.mixin=yC,Y.negate=zx,Y.nthArg=Abe,Y.omit=Ive,Y.omitBy=Tve,Y.once=E3e,Y.orderBy=c3e,Y.over=Cbe,Y.overArgs=A3e,Y.overEvery=Sbe,Y.overSome=Ibe,Y.partial=hC,Y.partialRight=uF,Y.partition=l3e,Y.pick=Rve,Y.pickBy=yF,Y.property=IF,Y.propertyOf=Tbe,Y.pull=cwe,Y.pullAll=XU,Y.pullAllBy=lwe,Y.pullAllWith=uwe,Y.pullAt=fwe,Y.range=Rbe,Y.rangeRight=kbe,Y.rearg=C3e,Y.reject=h3e,Y.remove=hwe,Y.rest=S3e,Y.reverse=lC,Y.sampleSize=p3e,Y.set=Nve,Y.setWith=Pve,Y.shuffle=m3e,Y.slice=dwe,Y.sortBy=v3e,Y.sortedUniq=ywe,Y.sortedUniqBy=xwe,Y.split=tbe,Y.spread=I3e,Y.tail=_we,Y.take=Ewe,Y.takeRight=Awe,Y.takeRightWhile=Cwe,Y.takeWhile=Swe,Y.tap=$we,Y.throttle=T3e,Y.thru=jx,Y.toArray=mF,Y.toPairs=xF,Y.toPairsIn=_F,Y.toPath=Dbe,Y.toPlainObject=wF,Y.transform=Ove,Y.unary=R3e,Y.union=Iwe,Y.unionBy=Twe,Y.unionWith=Rwe,Y.uniq=kwe,Y.uniqBy=Nwe,Y.uniqWith=Pwe,Y.unset=Mve,Y.unzip=uC,Y.unzipWith=eF,Y.update=Dve,Y.updateWith=Lve,Y.values=ug,Y.valuesIn=Bve,Y.without=Owe,Y.words=CF,Y.wrap=k3e,Y.xor=Mwe,Y.xorBy=Dwe,Y.xorWith=Lwe,Y.zip=Bwe,Y.zipObject=Uwe,Y.zipObjectDeep=Fwe,Y.zipWith=jwe,Y.entries=xF,Y.entriesIn=_F,Y.extend=vF,Y.extendWith=Kx,yC(Y,Y),Y.add=Bbe,Y.attempt=SF,Y.camelCase=$ve,Y.capitalize=EF,Y.ceil=Ube,Y.clamp=Uve,Y.clone=P3e,Y.cloneDeep=M3e,Y.cloneDeepWith=D3e,Y.cloneWith=O3e,Y.conformsTo=L3e,Y.deburr=AF,Y.defaultTo=gbe,Y.divide=Fbe,Y.endsWith=Wve,Y.eq=fl,Y.escape=Hve,Y.escapeRegExp=zve,Y.every=Jwe,Y.find=Xwe,Y.findIndex=ZU,Y.findKey=hve,Y.findLast=e3e,Y.findLastIndex=YU,Y.findLastKey=dve,Y.floor=jbe,Y.forEach=rF,Y.forEachRight=iF,Y.forIn=pve,Y.forInRight=mve,Y.forOwn=gve,Y.forOwnRight=wve,Y.get=mC,Y.gt=B3e,Y.gte=U3e,Y.has=yve,Y.hasIn=gC,Y.head=QU,Y.identity=Ks,Y.includes=o3e,Y.indexOf=ewe,Y.inRange=Fve,Y.invoke=Eve,Y.isArguments=Ap,Y.isArray=Ar,Y.isArrayBuffer=F3e,Y.isArrayLike=qs,Y.isArrayLikeObject=Pn,Y.isBoolean=j3e,Y.isBuffer=Nh,Y.isDate=$3e,Y.isElement=W3e,Y.isEmpty=H3e,Y.isEqual=z3e,Y.isEqualWith=q3e,Y.isError=dC,Y.isFinite=V3e,Y.isFunction=Vf,Y.isInteger=fF,Y.isLength=qx,Y.isMap=hF,Y.isMatch=K3e,Y.isMatchWith=G3e,Y.isNaN=Z3e,Y.isNative=Y3e,Y.isNil=Q3e,Y.isNull=J3e,Y.isNumber=dF,Y.isObject=hn,Y.isObjectLike=En,Y.isPlainObject=Z3,Y.isRegExp=pC,Y.isSafeInteger=X3e,Y.isSet=pF,Y.isString=Vx,Y.isSymbol=_a,Y.isTypedArray=lg,Y.isUndefined=eve,Y.isWeakMap=tve,Y.isWeakSet=rve,Y.join=owe,Y.kebabCase=qve,Y.last=dc,Y.lastIndexOf=swe,Y.lowerCase=Vve,Y.lowerFirst=Kve,Y.lt=ive,Y.lte=nve,Y.max=$be,Y.maxBy=Wbe,Y.mean=Hbe,Y.meanBy=zbe,Y.min=qbe,Y.minBy=Vbe,Y.stubArray=_C,Y.stubFalse=EC,Y.stubObject=Nbe,Y.stubString=Pbe,Y.stubTrue=Obe,Y.multiply=Kbe,Y.nth=awe,Y.noConflict=Ebe,Y.noop=xC,Y.now=Wx,Y.pad=Gve,Y.padEnd=Zve,Y.padStart=Yve,Y.parseInt=Jve,Y.random=jve,Y.reduce=u3e,Y.reduceRight=f3e,Y.repeat=Qve,Y.replace=Xve,Y.result=kve,Y.round=Gbe,Y.runInContext=ve,Y.sample=d3e,Y.size=g3e,Y.snakeCase=ebe,Y.some=w3e,Y.sortedIndex=pwe,Y.sortedIndexBy=mwe,Y.sortedIndexOf=gwe,Y.sortedLastIndex=wwe,Y.sortedLastIndexBy=vwe,Y.sortedLastIndexOf=bwe,Y.startCase=rbe,Y.startsWith=ibe,Y.subtract=Zbe,Y.sum=Ybe,Y.sumBy=Jbe,Y.template=nbe,Y.times=Mbe,Y.toFinite=Kf,Y.toInteger=Mr,Y.toLength=gF,Y.toLower=obe,Y.toNumber=pc,Y.toSafeInteger=ove,Y.toString=Pi,Y.toUpper=sbe,Y.trim=abe,Y.trimEnd=cbe,Y.trimStart=lbe,Y.truncate=ube,Y.unescape=fbe,Y.uniqueId=Lbe,Y.upperCase=hbe,Y.upperFirst=wC,Y.each=rF,Y.eachRight=iF,Y.first=QU,yC(Y,function(){var l={};return Xl(Y,function(p,S){Ui.call(Y.prototype,S)||(l[S]=p)}),l}(),{chain:!1}),Y.VERSION=i,cc(["bind","bindKey","curry","curryRight","partial","partialRight"],function(l){Y[l].placeholder=Y}),cc(["drop","take"],function(l,p){Qr.prototype[l]=function(S){S=S===r?1:Jn(Mr(S),0);var N=this.__filtered__&&!p?new Qr(this):this.clone();return N.__filtered__?N.__takeCount__=Go(S,N.__takeCount__):N.__views__.push({size:Go(S,d),type:l+(N.__dir__<0?"Right":"")}),N},Qr.prototype[l+"Right"]=function(S){return this.reverse()[l](S).reverse()}}),cc(["filter","map","takeWhile"],function(l,p){var S=p+1,N=S==f||S==y;Qr.prototype[l]=function(z){var re=this.clone();return re.__iteratees__.push({iteratee:Qt(z,3),type:S}),re.__filtered__=re.__filtered__||N,re}}),cc(["head","last"],function(l,p){var S="take"+(p?"Right":"");Qr.prototype[l]=function(){return this[S](1).value()[0]}}),cc(["initial","tail"],function(l,p){var S="drop"+(p?"":"Right");Qr.prototype[l]=function(){return this.__filtered__?new Qr(this):this[S](1)}}),Qr.prototype.compact=function(){return this.filter(Ks)},Qr.prototype.find=function(l){return this.filter(l).head()},Qr.prototype.findLast=function(l){return this.reverse().find(l)},Qr.prototype.invokeMap=Wr(function(l,p){return typeof l=="function"?new Qr(this):this.map(function(S){return H3(S,l,p)})}),Qr.prototype.reject=function(l){return this.filter(zx(Qt(l)))},Qr.prototype.slice=function(l,p){l=Mr(l);var S=this;return S.__filtered__&&(l>0||p<0)?new Qr(S):(l<0?S=S.takeRight(-l):l&&(S=S.drop(l)),p!==r&&(p=Mr(p),S=p<0?S.dropRight(-p):S.take(p-l)),S)},Qr.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},Qr.prototype.toArray=function(){return this.take(d)},Xl(Qr.prototype,function(l,p){var S=/^(?:filter|find|map|reject)|While$/.test(p),N=/^(?:head|last)$/.test(p),z=Y[N?"take"+(p=="last"?"Right":""):p],re=N||/^find/.test(p);z&&(Y.prototype[p]=function(){var he=this.__wrapped__,me=N?[1]:arguments,be=he instanceof Qr,Oe=me[0],Me=be||Ar(he),$e=function(Yr){var si=z.apply(Y,Ah([Yr],me));return N&&gt?si[0]:si};Me&&S&&typeof Oe=="function"&&Oe.length!=1&&(be=Me=!1);var gt=this.__chain__,$t=!!this.__actions__.length,tr=re&&!gt,Br=be&&!$t;if(!re&&Me){he=Br?he:new Qr(this);var rr=l.apply(he,me);return rr.__actions__.push({func:jx,args:[$e],thisArg:r}),new uc(rr,gt)}return tr&&Br?l.apply(this,me):(rr=this.thru($e),tr?N?rr.value()[0]:rr.value():rr)})}),cc(["pop","push","shift","sort","splice","unshift"],function(l){var p=hx[l],S=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",N=/^(?:pop|shift)$/.test(l);Y.prototype[l]=function(){var z=arguments;if(N&&!this.__chain__){var re=this.value();return p.apply(Ar(re)?re:[],z)}return this[S](function(he){return p.apply(Ar(he)?he:[],z)})}}),Xl(Qr.prototype,function(l,p){var S=Y[p];if(S){var N=S.name+"";Ui.call(ng,N)||(ng[N]=[]),ng[N].push({name:p,func:S})}}),ng[Ox(r,j).name]=[{name:"wrapper",func:r}],Qr.prototype.clone=fge,Qr.prototype.reverse=hge,Qr.prototype.value=dge,Y.prototype.at=Wwe,Y.prototype.chain=Hwe,Y.prototype.commit=zwe,Y.prototype.next=qwe,Y.prototype.plant=Kwe,Y.prototype.reverse=Gwe,Y.prototype.toJSON=Y.prototype.valueOf=Y.prototype.value=Zwe,Y.prototype.first=Y.prototype.head,L3&&(Y.prototype[L3]=Vwe),Y},tg=zme();gp?((gp.exports=tg)._=tg,bA._=tg):ko._=tg}).call(by)})(EP,EP.exports);var HDe=Object.defineProperty,zDe=Object.defineProperties,qDe=Object.getOwnPropertyDescriptors,Xse=Object.getOwnPropertySymbols,VDe=Object.prototype.hasOwnProperty,KDe=Object.prototype.propertyIsEnumerable,eae=(t,e,r)=>e in t?HDe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f9=(t,e)=>{for(var r in e||(e={}))VDe.call(e,r)&&eae(t,r,e[r]);if(Xse)for(var r of Xse(e))KDe.call(e,r)&&eae(t,r,e[r]);return t},GDe=(t,e)=>zDe(t,qDe(e));function Wd(t,e,r){var i;let n=Z2(t);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${WDe}?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function cm(t){return t.includes(":")?t.split(":")[1]:t}function sae(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function ZDe(t,e){let r=Object.keys(e.namespaces).filter(n=>n.includes(t));if(!r.length)return[];let i=[];return r.forEach(n=>{let o=e.namespaces[n].accounts;i.push(...o)}),i}function bP(t={},e={}){let r=tae(t),i=tae(e);return EP.exports.merge(r,i)}function tae(t){var e,r,i,n;let o={};if(!Y1(t))return o;for(let[s,a]of Object.entries(t)){let c=p7(s)?[s]:a.chains,h=a.methods||[],g=a.events||[],b=a.rpcMap||{},E=ow(s);o[E]=GDe(f9(f9({},o[E]),a),{chains:Kb(c,(e=o[E])==null?void 0:e.chains),methods:Kb(h,(r=o[E])==null?void 0:r.methods),events:Kb(g,(i=o[E])==null?void 0:i.events),rpcMap:f9(f9({},b),(n=o[E])==null?void 0:n.rpcMap)})}return o}function YDe(t){return t.includes(":")?t.split(":")[2]:t}function rae(t){let e={};for(let[r,i]of Object.entries(t)){let n=i.methods||[],o=i.events||[],s=i.accounts||[],a=p7(r)?[r]:i.chains?i.chains:sae(i.accounts);e[r]={chains:a,methods:n,events:o,accounts:s}}return e}function yP(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}var aae={},ln=t=>aae[t],xP=(t,e)=>{aae[t]=e},AP=class{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=ln("events"),this.client=ln("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(q0.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){let e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=cm(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||Wd(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ga(new zc(i,ln("disableProviderPing")))}},CP=class{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=ln("events"),this.client=ln("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(q0.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){let i=r||Wd(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ga(new zc(i,ln("disableProviderPing")))}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=parseInt(cm(r));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){let e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,i;let n=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;let o=parseInt(n,16);if(this.isChainApproved(o))this.setDefaultChain(`${o}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${o}`);else throw new Error(`Failed to switch to chain 'eip155:${o}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}},SP=class{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=ln("events"),this.client=ln("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(q0.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=cm(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||Wd(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ga(new zc(i,ln("disableProviderPing")))}},IP=class{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=ln("events"),this.client=ln("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(q0.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=cm(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||Wd(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ga(new zc(i,ln("disableProviderPing")))}},TP=class{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=ln("events"),this.client=ln("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(q0.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{let i=this.getCardanoRPCUrl(r),n=cm(r);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){let r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ga(new zc(i,ln("disableProviderPing")))}},RP=class{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=ln("events"),this.client=ln("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(q0.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=cm(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||Wd(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ga(new zc(i,ln("disableProviderPing")))}},kP=class{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=ln("events"),this.client=ln("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(q0.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;let n=cm(r);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||Wd(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new Ga(new zc(i,ln("disableProviderPing")))}},NP=class{constructor(e){this.name="near",this.namespace=e.namespace,this.events=ln("events"),this.client=ln("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){let i=r||Wd(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(q0.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(r=>{var i;e[r]=this.createHttpProvider(r,(i=this.namespace.rpcMap)==null?void 0:i[r])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){let i=this.createHttpProvider(e,r);i&&(this.httpProviders[e]=i)}createHttpProvider(e,r){let i=r||Wd(e,this.namespace);return typeof i>"u"?void 0:new Ga(new zc(i,ln("disableProviderPing")))}},JDe=Object.defineProperty,QDe=Object.defineProperties,XDe=Object.getOwnPropertyDescriptors,iae=Object.getOwnPropertySymbols,eLe=Object.prototype.hasOwnProperty,tLe=Object.prototype.propertyIsEnumerable,nae=(t,e,r)=>e in t?JDe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,h9=(t,e)=>{for(var r in e||(e={}))eLe.call(e,r)&&nae(t,r,e[r]);if(iae)for(var r of iae(e))tLe.call(e,r)&&nae(t,r,e[r]);return t},_P=(t,e)=>QDe(t,XDe(e)),PP=class t{constructor(e){this.events=new oae.default,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:(0,Kp.default)(zh({level:e?.logger||Jse})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){let r=new t(e);return await r.initialize(),r}async request(e,r,i){let[n,o]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:h9({},e),chainId:`${n}:${o}`,topic:this.session.topic,expiry:i})}sendAsync(e,r,i,n){let o=new Date().getTime();this.request(e,i,n).then(s=>r(null,Ld(o,s))).catch(s=>r(s,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:mi("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();let{uri:r,response:i}=await this.client.authenticate(e);r&&(this.uri=r,this.events.emit("display_uri",r));let n=await i();if(this.session=n.session,this.session){let o=rae(this.session.namespaces);this.namespaces=bP(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return n}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");let{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(o=>{this.session=o;let s=rae(o.namespaces);this.namespaces=bP(this.namespaces,s),this.persist("namespaces",this.namespaces)}).catch(o=>{if(o.message!==wP)throw o;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;let[i,n]=this.validateChain(e);this.getProvider(i).setDefaultChain(n,r)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");let r=this.client.pairing.getAll();if(Va(r)){for(let i of r)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){let e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await s9.init({logger:this.providerOpts.logger||Jse,relayUrl:this.providerOpts.relayUrl||FDe,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");let e=[...new Set(Object.keys(this.session.namespaces).map(r=>ow(r)))];xP("client",this.client),xP("events",this.events),xP("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;let i=ZDe(r,this.session),n=sae(i),o=bP(this.namespaces,this.optionalNamespaces),s=_P(h9({},o[r]),{accounts:i,chains:n});switch(r){case"eip155":this.rpcProviders[r]=new CP({namespace:s});break;case"solana":this.rpcProviders[r]=new SP({namespace:s});break;case"cosmos":this.rpcProviders[r]=new IP({namespace:s});break;case"polkadot":this.rpcProviders[r]=new AP({namespace:s});break;case"cip34":this.rpcProviders[r]=new TP({namespace:s});break;case"elrond":this.rpcProviders[r]=new RP({namespace:s});break;case"multiversx":this.rpcProviders[r]=new kP({namespace:s});break;case"near":this.rpcProviders[r]=new NP({namespace:s});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{let{params:r}=e,{event:i}=r;if(i.name==="accountsChanged"){let n=i.data;n&&Va(n)&&this.events.emit("accountsChanged",n.map(YDe))}else if(i.name==="chainChanged"){let n=r.chainId,o=r.event.data,s=ow(n),a=yP(n)!==yP(o)?`${s}:${yP(o)}`:n;this.onChainChanged(a)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var i;let{namespaces:n}=r,o=(i=this.client)==null?void 0:i.session.get(e);this.session=_P(h9({},o),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",_P(h9({},mi("USER_DISCONNECTED")),{data:e.topic}))}),this.on(q0.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){let{namespaces:r,optionalNamespaces:i,sessionProperties:n}=e;r&&Object.keys(r).length&&(this.namespaces=r),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",r),this.persist("optionalNamespaces",i)}validateChain(e){let[r,i]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,i];if(r&&!Object.keys(this.namespaces||{}).map(s=>ow(s)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&i)return[r,i];let n=ow(Object.keys(this.namespaces)[0]),o=this.rpcProviders[n].getDefaultChain();return[n,o]}async requestAccounts(){let[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;let[i,n]=this.validateChain(e);n&&(r||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${Qse}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${Qse}/${e}`)}},cae=PP;var rFe="wc",iFe="ethereum_provider",nFe=`${rFe}@2:${iFe}:`,oFe="https://rpc.walletconnect.com/v1/",XO=["eth_sendTransaction","personal_sign"],tM=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],eM=["chainChanged","accountsChanged"],sFe=["chainChanged","accountsChanged","message","disconnect","connect"],aFe=Object.defineProperty,cFe=Object.defineProperties,lFe=Object.getOwnPropertyDescriptors,lle=Object.getOwnPropertySymbols,uFe=Object.prototype.hasOwnProperty,fFe=Object.prototype.propertyIsEnumerable,ule=(t,e,r)=>e in t?aFe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Tw=(t,e)=>{for(var r in e||(e={}))uFe.call(e,r)&&ule(t,r,e[r]);if(lle)for(var r of lle(e))fFe.call(e,r)&&ule(t,r,e[r]);return t},QO=(t,e)=>cFe(t,lFe(e));function U9(t){return Number(t[0].split(":")[1])}function B9(t){return`0x${t.toString(16)}`}function hFe(t){let{chains:e,optionalChains:r,methods:i,optionalMethods:n,events:o,optionalEvents:s,rpcMap:a}=t;if(!Va(e))throw new Error("Invalid chains");let c={chains:e,methods:i||XO,events:o||eM,rpcMap:Tw({},e.length?{[U9(e)]:a[U9(e)]}:{})},h=o?.filter(A=>!eM.includes(A)),g=i?.filter(A=>!XO.includes(A));if(!r&&!s&&!n&&!(h!=null&&h.length)&&!(g!=null&&g.length))return{required:e.length?c:void 0};let b=h?.length&&g?.length||!r,E={chains:[...new Set(b?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(n!=null&&n.length?n:tM))],events:[...new Set(c.events.concat(s!=null&&s.length?s:sFe))],rpcMap:a};return{required:e.length?c:void 0,optional:r.length?E:void 0}}var F9=class t{constructor(){this.events=new fle.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=nFe,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){let r=new t;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,i){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);let{required:r,optional:i}=hFe(this.rpc);try{let n=await new Promise(async(s,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(h=>{!h.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(QO(Tw({namespaces:Tw({},r&&{[this.namespace]:r})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e?.pairingTopic})).then(h=>{s(h)}).catch(h=>{a(new Error(h.message))})});if(!n)return;let o=vk(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:B9(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e?.chains});try{let r=await new Promise(async(n,o)=>{var s;this.rpc.showQrModal&&((s=this.modal)==null||s.subscribeModal(a=>{!a.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(QO(Tw({},e),{chains:this.rpc.chains})).then(a=>{n(a)}).catch(a=>{o(new Error(a.message))})}),i=r.session;if(i){let n=vk(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:n),this.setAccounts(n),this.events.emit("connect",{chainId:B9(this.chainId)})}return r}catch(r){throw this.signer.logger.error(r),r}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{let{params:r}=e,{event:i}=r;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{let r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",B9(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",QO(Tw({},mi("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,i;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){let r=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",B9(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){let r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){let[r,i,n]=e.split(":");return{chainId:`${r}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,i;let n=(r=e?.chains)!=null?r:[],o=(i=e?.optionalChains)!=null?i:[],s=n.concat(o);if(!s.length)throw new Error("No chains specified in either `chains` or `optionalChains`");let a=n.length?e?.methods||XO:[],c=n.length?e?.events||eM:[],h=e?.optionalMethods||[],g=e?.optionalEvents||[],b=e?.rpcMap||this.buildRpcMap(s,e.projectId),E=e?.qrModalOptions||void 0;return{chains:n?.map(A=>this.formatChainId(A)),optionalChains:o.map(A=>this.formatChainId(A)),methods:a,events:c,optionalMethods:h,optionalEvents:g,rpcMap:b,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:E,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){let i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,r)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?U9(this.rpc.chains):U9(this.rpc.optionalChains),this.signer=await cae.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{let{WalletConnectModal:i}=await Promise.resolve().then(()=>(cle(),ale));r=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(Tw({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;let{chains:r,optionalChains:i,rpcMap:n}=e;r&&Va(r)&&(this.rpc.chains=r.map(o=>this.formatChainId(o)),r.forEach(o=>{this.rpc.rpcMap[o]=n?.[o]||this.getRpcUrl(o)})),i&&Va(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i?.map(o=>this.formatChainId(o)),i.forEach(o=>{this.rpc.rpcMap[o]=n?.[o]||this.getRpcUrl(o)}))}getRpcUrl(e,r){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${oFe}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{let e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r?.accounts),this.setAccounts(r?.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}};var gh={};Oi(gh,{BaseContract:()=>Qw,BigNumber:()=>Ue,Contract:()=>Om,ContractFactory:()=>c5,FixedNumber:()=>Jd,Signer:()=>ec,VoidSigner:()=>Tm,Wallet:()=>p5,Wordlist:()=>Sf,constants:()=>o_,errors:()=>ca,getDefaultProvider:()=>J_,logger:()=>G0e,providers:()=>Q_,utils:()=>oc,version:()=>eE,wordlists:()=>Dm});var Cle=Wt(iM());var ple="logger/5.7.0";var mle=!1,gle=!1,j9={debug:1,default:2,info:2,warning:3,error:4,off:5},wle=j9.default,nM=null;function dFe(){try{let t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var vle=dFe(),oM;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(oM||(oM={}));var ca;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(ca||(ca={}));var ble="0123456789abcdef",fe=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){let i=e.toLowerCase();j9[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(wle>j9[i])&&console.log.apply(console,r)}debug(...e){this._log(t.levels.DEBUG,e)}info(...e){this._log(t.levels.INFO,e)}warn(...e){this._log(t.levels.WARNING,e)}makeError(e,r,i){if(gle)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),i||(i={});let n=[];Object.keys(i).forEach(c=>{let h=i[c];try{if(h instanceof Uint8Array){let g="";for(let b=0;b<h.length;b++)g+=ble[h[b]>>4],g+=ble[h[b]&15];n.push(c+"=Uint8Array(0x"+g+")")}else n.push(c+"="+JSON.stringify(h))}catch{n.push(c+"="+JSON.stringify(i[c].toString()))}}),n.push(`code=${r}`),n.push(`version=${this.version}`);let o=e,s="";switch(r){case ca.NUMERIC_FAULT:{s="NUMERIC_FAULT";let c=e;switch(c){case"overflow":case"underflow":case"division-by-zero":s+="-"+c;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result";break}break}case ca.CALL_EXCEPTION:case ca.INSUFFICIENT_FUNDS:case ca.MISSING_NEW:case ca.NONCE_EXPIRED:case ca.REPLACEMENT_UNDERPRICED:case ca.TRANSACTION_REPLACED:case ca.UNPREDICTABLE_GAS_LIMIT:s=r;break}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),n.length&&(e+=" ("+n.join(", ")+")");let a=new Error(e);return a.reason=o,a.code=r,Object.keys(i).forEach(function(c){a[c]=i[c]}),a}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,n){e||this.throwError(r,i,n)}assertArgument(e,r,i,n){e||this.throwArgumentError(r,i,n)}checkNormalize(e){e==null&&(e="platform missing String.prototype.normalize"),vle&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:vle})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,t.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return nM||(nM=new t(ple)),nM}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),mle){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}gle=!!e,mle=!!r}static setLogLevel(e){let r=j9[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}wle=r}static from(e){return new t(e)}};fe.errors=ca;fe.levels=oM;var yle="bytes/5.7.0";var kn=new fe(yle);function _le(t){return!!t.toHexString}function Rw(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return Rw(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function eh(t){return Zt(t)&&!(t.length%2)||Kc(t)}function xle(t){return typeof t=="number"&&t==t&&t%1===0}function Kc(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!xle(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){let r=t[e];if(!xle(r)||r<0||r>=256)return!1}return!0}function ke(t,e){if(e||(e={}),typeof t=="number"){kn.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Rw(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),_le(t)&&(t=t.toHexString()),Zt(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":kn.throwArgumentError("hex data is odd-length","value",t));let i=[];for(let n=0;n<r.length;n+=2)i.push(parseInt(r.substring(n,n+2),16));return Rw(new Uint8Array(i))}return Kc(t)?Rw(new Uint8Array(t)):kn.throwArgumentError("invalid arrayify value","value",t)}function Fr(t){let e=t.map(n=>ke(n)),r=e.reduce((n,o)=>n+o.length,0),i=new Uint8Array(r);return e.reduce((n,o)=>(i.set(o,n),n+o.length),0),Rw(i)}function Ja(t){let e=ke(t);if(e.length===0)return e;let r=0;for(;r<e.length&&e[r]===0;)r++;return r&&(e=e.slice(r)),e}function _m(t,e){t=ke(t),t.length>e&&kn.throwArgumentError("value out of range","value",arguments[0]);let r=new Uint8Array(e);return r.set(t,e-t.length),Rw(r)}function Zt(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var sM="0123456789abcdef";function De(t,e){if(e||(e={}),typeof t=="number"){kn.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=sM[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),_le(t))return t.toHexString();if(Zt(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":kn.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Kc(t)){let r="0x";for(let i=0;i<t.length;i++){let n=t[i];r+=sM[(n&240)>>4]+sM[n&15]}return r}return kn.throwArgumentError("invalid hexlify value","value",t)}function hs(t){if(typeof t!="string")t=De(t);else if(!Zt(t)||t.length%2)return null;return(t.length-2)/2}function Fi(t,e,r){return typeof t!="string"?t=De(t):(!Zt(t)||t.length%2)&&kn.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function qn(t){let e="0x";return t.forEach(r=>{e+=De(r).substring(2)}),e}function uf(t){let e=aM(De(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function aM(t){typeof t!="string"&&(t=De(t)),Zt(t)||kn.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e<t.length&&t[e]==="0";)e++;return"0x"+t.substring(e)}function Kr(t,e){for(typeof t!="string"?t=De(t):Zt(t)||kn.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&kn.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function ff(t){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(eh(t)){let r=ke(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=De(r.slice(0,32)),e.s=De(r.slice(32,64))):r.length===65?(e.r=De(r.slice(0,32)),e.s=De(r.slice(32,64)),e.v=r[64]):kn.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:kn.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=De(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){let n=_m(ke(e._vs),32);e._vs=De(n);let o=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&kn.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;let s=De(n);e.s==null?e.s=s:e.s!==s&&kn.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?kn.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&kn.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!Zt(e.r)?kn.throwArgumentError("signature missing or invalid r","signature",t):e.r=Kr(e.r,32),e.s==null||!Zt(e.s)?kn.throwArgumentError("signature missing or invalid s","signature",t):e.s=Kr(e.s,32);let r=ke(e.s);r[0]>=128&&kn.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);let i=De(r);e._vs&&(Zt(e._vs)||kn.throwArgumentError("signature invalid _vs","signature",t),e._vs=Kr(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&kn.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function zy(t){return t=ff(t),De(Fr([t.r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}var $9="bignumber/5.7.0";var qy=Cle.default.BN,th=new fe($9),cM={},Ele=9007199254740991;function Sle(t){return t!=null&&(Ue.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||Zt(t)||typeof t=="bigint"||Kc(t))}var Ale=!1,Ue=class t{constructor(e,r){e!==cM&&th.throwError("cannot call constructor directly; use BigNumber.from",fe.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return la(ni(this).fromTwos(e))}toTwos(e){return la(ni(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return la(ni(this).add(ni(e)))}sub(e){return la(ni(this).sub(ni(e)))}div(e){return t.from(e).isZero()&&Gc("division-by-zero","div"),la(ni(this).div(ni(e)))}mul(e){return la(ni(this).mul(ni(e)))}mod(e){let r=ni(e);return r.isNeg()&&Gc("division-by-zero","mod"),la(ni(this).umod(r))}pow(e){let r=ni(e);return r.isNeg()&&Gc("negative-power","pow"),la(ni(this).pow(r))}and(e){let r=ni(e);return(this.isNegative()||r.isNeg())&&Gc("unbound-bitwise-result","and"),la(ni(this).and(r))}or(e){let r=ni(e);return(this.isNegative()||r.isNeg())&&Gc("unbound-bitwise-result","or"),la(ni(this).or(r))}xor(e){let r=ni(e);return(this.isNegative()||r.isNeg())&&Gc("unbound-bitwise-result","xor"),la(ni(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Gc("negative-width","mask"),la(ni(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Gc("negative-width","shl"),la(ni(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Gc("negative-width","shr"),la(ni(this).shrn(e))}eq(e){return ni(this).eq(ni(e))}lt(e){return ni(this).lt(ni(e))}lte(e){return ni(this).lte(ni(e))}gt(e){return ni(this).gt(ni(e))}gte(e){return ni(this).gte(ni(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ni(this).isZero()}toNumber(){try{return ni(this).toNumber()}catch{Gc("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return th.throwError("this platform does not support BigInt",fe.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Ale||(Ale=!0,th.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?th.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",fe.errors.UNEXPECTED_ARGUMENT,{}):th.throwError("BigNumber.toString does not accept parameters",fe.errors.UNEXPECTED_ARGUMENT,{})),ni(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(cM,Vy(e)):e.match(/^-?[0-9]+$/)?new t(cM,Vy(new qy(e))):th.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Gc("underflow","BigNumber.from",e),(e>=Ele||e<=-Ele)&&Gc("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(Kc(r))return t.from(De(r));if(r)if(r.toHexString){let i=r.toHexString();if(typeof i=="string")return t.from(i)}else{let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(Zt(i)||i[0]==="-"&&Zt(i.substring(1))))return t.from(i)}return th.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function Vy(t){if(typeof t!="string")return Vy(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&th.throwArgumentError("invalid hex","value",t),t=Vy(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function la(t){return Ue.from(Vy(t))}function ni(t){let e=Ue.from(t).toHexString();return e[0]==="-"?new qy("-"+e.substring(3),16):new qy(e.substring(2),16)}function Gc(t,e,r){let i={fault:t,operation:e};return r!=null&&(i.value=r),th.throwError(t,fe.errors.NUMERIC_FAULT,i)}function lM(t){return new qy(t,36).toString(16)}function uM(t){return new qy(t,16).toString(36)}var js=new fe($9),Ky={},Tle=Ue.from(0),Rle=Ue.from(-1);function kle(t,e,r,i){let n={fault:e,operation:r};return i!==void 0&&(n.value=i),js.throwError(t,fe.errors.NUMERIC_FAULT,n)}var Gy="0";for(;Gy.length<256;)Gy+=Gy;function fM(t){if(typeof t!="number")try{t=Ue.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Gy.substring(0,t):js.throwArgumentError("invalid decimal size","decimals",t)}function kw(t,e){e==null&&(e=0);let r=fM(e);t=Ue.from(t);let i=t.lt(Tle);i&&(t=t.mul(Rle));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];let o=t.div(r).toString();return r.length===1?t=o:t=o+"."+n,i&&(t="-"+t),t}function Zc(t,e){e==null&&(e=0);let r=fM(e);(typeof t!="string"||!t.match(/^-?[0-9.]+$/))&&js.throwArgumentError("invalid decimal value","value",t);let i=t.substring(0,1)==="-";i&&(t=t.substring(1)),t==="."&&js.throwArgumentError("missing value","value",t);let n=t.split(".");n.length>2&&js.throwArgumentError("too many decimal points","value",t);let o=n[0],s=n[1];for(o||(o="0"),s||(s="0");s[s.length-1]==="0";)s=s.substring(0,s.length-1);for(s.length>r.length-1&&kle("fractional component exceeds decimals","underflow","parseFixed"),s===""&&(s="0");s.length<r.length-1;)s+="0";let a=Ue.from(o),c=Ue.from(s),h=a.mul(r).add(c);return i&&(h=h.mul(Rle)),h}var Nw=class t{constructor(e,r,i,n){e!==Ky&&js.throwError("cannot use FixedFormat constructor; use FixedFormat.from",fe.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=i,this.decimals=n,this.name=(r?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=fM(n),Object.freeze(this)}static from(e){if(e instanceof t)return e;typeof e=="number"&&(e=`fixed128x${e}`);let r=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")r=!1;else{let o=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);o||js.throwArgumentError("invalid fixed format","format",e),r=o[1]!=="u",i=parseInt(o[2]),n=parseInt(o[3])}}else if(e){let o=(s,a,c)=>e[s]==null?c:(typeof e[s]!==a&&js.throwArgumentError("invalid fixed format ("+s+" not "+a+")","format."+s,e[s]),e[s]);r=o("signed","boolean",r),i=o("width","number",i),n=o("decimals","number",n)}return i%8&&js.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&js.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new t(Ky,r,i,n)}},Jd=class t{constructor(e,r,i,n){e!==Ky&&js.throwError("cannot use FixedNumber constructor; use FixedNumber.from",fe.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=r,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&js.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);let r=Zc(this._value,this.format.decimals),i=Zc(e._value,e.format.decimals);return t.fromValue(r.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);let r=Zc(this._value,this.format.decimals),i=Zc(e._value,e.format.decimals);return t.fromValue(r.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);let r=Zc(this._value,this.format.decimals),i=Zc(e._value,e.format.decimals);return t.fromValue(r.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);let r=Zc(this._value,this.format.decimals),i=Zc(e._value,e.format.decimals);return t.fromValue(r.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(r=r.subUnsafe(Ile.toFormat(r.format))),r}ceiling(){let e=this.toString().split(".");e.length===1&&e.push("0");let r=t.from(e[0],this.format),i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(r=r.addUnsafe(Ile.toFormat(r.format))),r}round(e){e==null&&(e=0);let r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&js.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;let i=t.from("1"+Gy.substring(0,e),this.format),n=pFe.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&js.throwArgumentError("invalid byte width","width",e);let r=Ue.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return Kr(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return t.fromString(this._value,e)}static fromValue(e,r,i){return i==null&&r!=null&&!Sle(r)&&(i=r,r=null),r==null&&(r=0),i==null&&(i="fixed"),t.fromString(kw(e,r),Nw.from(i))}static fromString(e,r){r==null&&(r="fixed");let i=Nw.from(r),n=Zc(e,i.decimals);!i.signed&&n.lt(Tle)&&kle("unsigned value cannot be negative","overflow","value",e);let o=null;i.signed?o=n.toTwos(i.width).toHexString():(o=n.toHexString(),o=Kr(o,i.width/8));let s=kw(n,i.decimals);return new t(Ky,o,s,i)}static fromBytes(e,r){r==null&&(r="fixed");let i=Nw.from(r);if(ke(e).length>i.width/8)throw new Error("overflow");let n=Ue.from(e);i.signed&&(n=n.fromTwos(i.width));let o=n.toTwos((i.signed?0:1)+i.width).toHexString(),s=kw(n,i.decimals);return new t(Ky,o,s,i)}static from(e,r){if(typeof e=="string")return t.fromString(e,r);if(Kc(e))return t.fromBytes(e,r);try{return t.fromValue(e,0,r)}catch(i){if(i.code!==fe.errors.INVALID_ARGUMENT)throw i}return js.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}},Ile=Jd.from(1),pFe=Jd.from("0.5");var Nle="properties/5.7.0";var mFe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},W9=new fe(Nle);function ye(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function vn(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function ji(t){return mFe(this,void 0,void 0,function*(){let e=Object.keys(t).map(i=>{let n=t[i];return Promise.resolve(n).then(o=>({key:i,value:o}))});return(yield Promise.all(e)).reduce((i,n)=>(i[n.key]=n.value,i),{})})}function Pw(t,e){(!t||typeof t!="object")&&W9.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||W9.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function di(t){let e={};for(let r in t)e[r]=t[r];return e}var gFe={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Ple(t){if(t==null||gFe[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]]}catch{continue}if(!Ple(i))return!1}return!0}return W9.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function wFe(t){if(Ple(t))return t;if(Array.isArray(t))return Object.freeze(t.map(e=>wn(e)));if(typeof t=="object"){let e={};for(let r in t){let i=t[r];i!==void 0&&ye(e,r,wn(i))}return e}return W9.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function wn(t){return wFe(t)}var Qa=class{constructor(e){for(let r in e)this[r]=wn(e[r])}};var hf="abi/5.7.0";var li=new fe(hf),Em={},Ole={calldata:!0,memory:!0,storage:!0},vFe={calldata:!0,memory:!0};function H9(t,e){if(t==="bytes"||t==="string"){if(Ole[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&vFe[e])return!0;return(Ole[e]||e==="payable")&&li.throwArgumentError("invalid modifier","name",e),!1}function bFe(t,e){let r=t;function i(a){li.throwArgumentError(`unexpected character at position ${a}`,"param",t)}t=t.replace(/\s/g," ");function n(a){let c={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(c.indexed=!1),c}let o={type:"",name:"",state:{allowType:!0}},s=o;for(let a=0;a<t.length;a++){let c=t[a];switch(c){case"(":s.state.allowType&&s.type===""?s.type="tuple":s.state.allowParams||i(a),s.state.allowType=!1,s.type=Ow(s.type),s.components=[n(s)],s=s.components[0];break;case")":delete s.state,s.name==="indexed"&&(e||i(a),s.indexed=!0,s.name=""),H9(s.type,s.name)&&(s.name=""),s.type=Ow(s.type);let h=s;s=s.parent,s||i(a),delete h.parent,s.state.allowParams=!1,s.state.allowName=!0,s.state.allowArray=!0;break;case",":delete s.state,s.name==="indexed"&&(e||i(a),s.indexed=!0,s.name=""),H9(s.type,s.name)&&(s.name=""),s.type=Ow(s.type);let g=n(s.parent);s.parent.components.push(g),delete s.parent,s=g;break;case" ":s.state.allowType&&s.type!==""&&(s.type=Ow(s.type),delete s.state.allowType,s.state.allowName=!0,s.state.allowParams=!0),s.state.allowName&&s.name!==""&&(s.name==="indexed"?(e||i(a),s.indexed&&i(a),s.indexed=!0,s.name=""):H9(s.type,s.name)?s.name="":s.state.allowName=!1);break;case"[":s.state.allowArray||i(a),s.type+=c,s.state.allowArray=!1,s.state.allowName=!1,s.state.readArray=!0;break;case"]":s.state.readArray||i(a),s.type+=c,s.state.readArray=!1,s.state.allowArray=!0,s.state.allowName=!0;break;default:s.state.allowType?(s.type+=c,s.state.allowParams=!0,s.state.allowArray=!0):s.state.allowName?(s.name+=c,delete s.state.allowArray):s.state.readArray?s.type+=c:i(a)}}return s.parent&&li.throwArgumentError("unexpected eof","param",t),delete o.state,s.name==="indexed"?(e||i(r.length-7),s.indexed&&i(r.length-7),s.indexed=!0,s.name=""):H9(s.type,s.name)&&(s.name=""),o.type=Ow(o.type),o}function z9(t,e){for(let r in e)ye(t,r,e[r])}var oi=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),yFe=new RegExp(/^(.*)\[([0-9]*)\]$/),zo=class t{constructor(e,r){e!==Em&&li.throwError("use fromString",fe.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),z9(this,r);let i=this.type.match(yFe);i?z9(this,{arrayLength:parseInt(i[2]||"-1"),arrayChildren:t.fromObject({type:i[1],components:this.components}),baseType:"array"}):z9(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=oi.sighash),oi[e]||li.throwArgumentError("invalid format type","format",e),e===oi.json){let i={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.components&&(i.components=this.components.map(n=>JSON.parse(n.format(e)))),JSON.stringify(i)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==oi.sighash&&(r+=this.type),r+="("+this.components.map(i=>i.format(e)).join(e===oi.full?", ":",")+")"):r+=this.type,e!==oi.sighash&&(this.indexed===!0&&(r+=" indexed"),e===oi.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?t.fromString(e,r):t.fromObject(e)}static fromObject(e){return t.isParamType(e)?e:new t(Em,{name:e.name||null,type:Ow(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(t.fromObject):null})}static fromString(e,r){function i(n){return t.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components})}return i(bFe(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}};function Zy(t,e){return _Fe(t).map(r=>zo.fromString(r,e))}var df=class t{constructor(e,r){e!==Em&&li.throwError("use a static from method",fe.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),z9(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return t.isFragment(e)?e:typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFragment(e))return e;switch(e.type){case"function":return mf.fromObject(e);case"event":return rh.fromObject(e);case"constructor":return pf.fromObject(e);case"error":return Am.fromObject(e);case"fallback":case"receive":return null}return li.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?rh.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?mf.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?pf.fromString(e.trim()):e.split(" ")[0]==="error"?Am.fromString(e.substring(5).trim()):li.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}},rh=class t extends df{format(e){if(e||(e=oi.sighash),oi[e]||li.throwArgumentError("invalid format type","format",e),e===oi.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==oi.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===oi.full?", ":",")+") ",e!==oi.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isEventFragment(e))return e;e.type!=="event"&&li.throwArgumentError("invalid event object","value",e);let r={name:Yy(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(zo.fromObject):[],type:"event"};return new t(Em,r)}static fromString(e){let r=e.match(Jy);r||li.throwArgumentError("invalid event string","value",e);let i=!1;return r[3].split(" ").forEach(n=>{switch(n.trim()){case"anonymous":i=!0;break;case"":break;default:li.warn("unknown modifier: "+n)}}),t.fromObject({name:r[1].trim(),anonymous:i,inputs:Zy(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}};function Dle(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&li.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||li.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Ue.from(r[1]),r[0]):t}function Lle(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function Ble(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&li.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&li.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&li.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&li.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&li.throwArgumentError("unable to determine stateMutability","value",t),e}var pf=class t extends df{format(e){if(e||(e=oi.sighash),oi[e]||li.throwArgumentError("invalid format type","format",e),e===oi.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});e===oi.sighash&&li.throwError("cannot format a constructor for sighash",fe.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(i=>i.format(e)).join(e===oi.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isConstructorFragment(e))return e;e.type!=="constructor"&&li.throwArgumentError("invalid constructor object","value",e);let r=Ble(e);r.constant&&li.throwArgumentError("constructor cannot be constant","value",e);let i={name:null,type:e.type,inputs:e.inputs?e.inputs.map(zo.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Ue.from(e.gas):null};return new t(Em,i)}static fromString(e){let r={type:"constructor"};e=Dle(e,r);let i=e.match(Jy);return(!i||i[1].trim()!=="constructor")&&li.throwArgumentError("invalid constructor string","value",e),r.inputs=Zy(i[2].trim(),!1),Lle(i[3].trim(),r),t.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}},mf=class t extends pf{format(e){if(e||(e=oi.sighash),oi[e]||li.throwArgumentError("invalid format type","format",e),e===oi.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e))),outputs:this.outputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==oi.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===oi.full?", ":",")+") ",e!==oi.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(i=>i.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFunctionFragment(e))return e;e.type!=="function"&&li.throwArgumentError("invalid function object","value",e);let r=Ble(e),i={type:e.type,name:Yy(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(zo.fromObject):[],outputs:e.outputs?e.outputs.map(zo.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Ue.from(e.gas):null};return new t(Em,i)}static fromString(e){let r={type:"function"};e=Dle(e,r);let i=e.split(" returns ");i.length>2&&li.throwArgumentError("invalid function string","value",e);let n=i[0].match(Jy);if(n||li.throwArgumentError("invalid function signature","value",e),r.name=n[1].trim(),r.name&&Yy(r.name),r.inputs=Zy(n[2],!1),Lle(n[3].trim(),r),i.length>1){let o=i[1].match(Jy);(o[1].trim()!=""||o[3].trim()!="")&&li.throwArgumentError("unexpected tokens","value",e),r.outputs=Zy(o[2],!1)}else r.outputs=[];return t.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}};function Mle(t){let e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&li.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}var Am=class t extends df{format(e){if(e||(e=oi.sighash),oi[e]||li.throwArgumentError("invalid format type","format",e),e===oi.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==oi.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===oi.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isErrorFragment(e))return e;e.type!=="error"&&li.throwArgumentError("invalid error object","value",e);let r={type:e.type,name:Yy(e.name),inputs:e.inputs?e.inputs.map(zo.fromObject):[]};return Mle(new t(Em,r))}static fromString(e){let r={type:"error"},i=e.match(Jy);return i||li.throwArgumentError("invalid error signature","value",e),r.name=i[1].trim(),r.name&&Yy(r.name),r.inputs=Zy(i[2],!1),Mle(t.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}};function Ow(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}var xFe=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Yy(t){return(!t||!t.match(xFe))&&li.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}var Jy=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function _Fe(t){t=t.trim();let e=[],r="",i=0;for(let n=0;n<t.length;n++){let o=t[n];o===","&&i===0?(e.push(r),r=""):(r+=o,o==="("?i++:o===")"&&(i--,i===-1&&li.throwArgumentError("unbalanced parenthesis","value",t)))}return r&&e.push(r),e}var hM=new fe(hf);function Mw(t){let e=[],r=function(i,n){if(Array.isArray(n))for(let o in n){let s=i.slice();s.push(o);try{r(s,n[o])}catch(a){e.push({path:s,error:a})}}};return r([],t),e}var Vn=class{constructor(e,r,i,n){this.name=e,this.type=r,this.localName=i,this.dynamic=n}_throwError(e,r){hM.throwArgumentError(e,this.localName,r)}},Cm=class{constructor(e){ye(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return qn(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(Fr(e._data))}writeBytes(e){let r=ke(e),i=r.length%this.wordSize;return i&&(r=Fr([r,this._padding.slice(i)])),this._writeData(r)}_getValue(e){let r=ke(Ue.from(e));return r.length>this.wordSize&&hM.throwError("value out-of-bounds",fe.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Fr([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){let e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}},q9=class t{constructor(e,r,i,n){ye(this,"_data",ke(e)),ye(this,"wordSize",r||32),ye(this,"_coerceFunc",i),ye(this,"allowLoose",n),this._offset=0}get data(){return De(this._data)}get consumed(){return this._offset}static coerce(e,r){let i=e.match("^u?int([0-9]+)$");return i&&parseInt(i[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):t.coerce(e,r)}_peekBytes(e,r,i){let n=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&i&&this._offset+r<=this._data.length?n=r:hM.throwError("data out-of-bounds",fe.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new t(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let i=this._peekBytes(0,e,!!r);return this._offset+=i.length,i.slice(0,e)}readValue(){return Ue.from(this.readBytes(this.wordSize))}};var Fle=Wt(Ule());function jr(t){return"0x"+Fle.default.keccak_256(ke(t))}var K9={};Oi(K9,{decode:()=>Qy,encode:()=>ih});var jle="rlp/5.7.0";var gf=new fe(jle);function $le(t){let e=[];for(;t;)e.unshift(t&255),t>>=8;return e}function Wle(t,e,r){let i=0;for(let n=0;n<r;n++)i=i*256+t[e+n];return i}function zle(t){if(Array.isArray(t)){let i=[];if(t.forEach(function(o){i=i.concat(zle(o))}),i.length<=55)return i.unshift(192+i.length),i;let n=$le(i.length);return n.unshift(247+n.length),n.concat(i)}eh(t)||gf.throwArgumentError("RLP object must be BytesLike","object",t);let e=Array.prototype.slice.call(ke(t));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;let r=$le(e.length);return r.unshift(183+r.length),r.concat(e)}function ih(t){return De(zle(t))}function Hle(t,e,r,i){let n=[];for(;r<e+1+i;){let o=qle(t,r);n.push(o.result),r+=o.consumed,r>e+1+i&&gf.throwError("child data too short",fe.errors.BUFFER_OVERRUN,{})}return{consumed:1+i,result:n}}function qle(t,e){if(t.length===0&&gf.throwError("data too short",fe.errors.BUFFER_OVERRUN,{}),t[e]>=248){let r=t[e]-247;e+1+r>t.length&&gf.throwError("data short segment too short",fe.errors.BUFFER_OVERRUN,{});let i=Wle(t,e+1,r);return e+1+r+i>t.length&&gf.throwError("data long segment too short",fe.errors.BUFFER_OVERRUN,{}),Hle(t,e,e+1+r,r+i)}else if(t[e]>=192){let r=t[e]-192;return e+1+r>t.length&&gf.throwError("data array too short",fe.errors.BUFFER_OVERRUN,{}),Hle(t,e,e+1,r)}else if(t[e]>=184){let r=t[e]-183;e+1+r>t.length&&gf.throwError("data array too short",fe.errors.BUFFER_OVERRUN,{});let i=Wle(t,e+1,r);e+1+r+i>t.length&&gf.throwError("data array too short",fe.errors.BUFFER_OVERRUN,{});let n=De(t.slice(e+1+r,e+1+r+i));return{consumed:1+r+i,result:n}}else if(t[e]>=128){let r=t[e]-128;e+1+r>t.length&&gf.throwError("data too short",fe.errors.BUFFER_OVERRUN,{});let i=De(t.slice(e+1,e+1+r));return{consumed:1+r,result:i}}return{consumed:1,result:De(t[e])}}function Qy(t){let e=ke(t),r=qle(e,0);return r.consumed!==e.length&&gf.throwArgumentError("invalid rlp data","data",t),r.result}var Vle="address/5.7.0";var Qd=new fe(Vle);function Kle(t){Zt(t,20)||Qd.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let n=0;n<40;n++)r[n]=e[n].charCodeAt(0);let i=ke(jr(r));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}var EFe=9007199254740991;function AFe(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var dM={};for(let t=0;t<10;t++)dM[String(t)]=String(t);for(let t=0;t<26;t++)dM[String.fromCharCode(65+t)]=String(10+t);var Gle=Math.floor(AFe(EFe));function Zle(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>dM[i]).join("");for(;e.length>=Gle;){let i=e.substring(0,Gle);e=parseInt(i,10)%97+e.substring(i.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function $r(t){let e=null;if(typeof t!="string"&&Qd.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Kle(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Qd.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==Zle(t)&&Qd.throwArgumentError("bad icap checksum","address",t),e=lM(t.substring(4));e.length<40;)e="0"+e;e=Kle("0x"+e)}else Qd.throwArgumentError("invalid address","address",t);return e}function Yle(t){try{return $r(t),!0}catch{}return!1}function Jle(t){let e=uM($r(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+Zle("XE00"+e)+e}function Sm(t){let e=null;try{e=$r(t.from)}catch{Qd.throwArgumentError("missing from address","transaction",t)}let r=Ja(ke(Ue.from(t.nonce).toHexString()));return $r(Fi(jr(ih([e,r])),12))}function Qle(t,e,r){return hs(e)!==32&&Qd.throwArgumentError("salt must be 32 bytes","salt",e),hs(r)!==32&&Qd.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),$r(Fi(jr(Fr(["0xff",$r(t),e,r])),12))}var G9=class extends Vn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=$r(r)}catch(i){this._throwError(i.message,r)}return e.writeValue(r)}decode(e){return $r(Kr(e.readValue().toHexString(),20))}};var Z9=class extends Vn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}};var Dw=new fe(hf);function pM(t,e,r){let i=null;if(Array.isArray(r))i=r;else if(r&&typeof r=="object"){let c={};i=e.map(h=>{let g=h.localName;return g||Dw.throwError("cannot encode object for signature with missing names",fe.errors.INVALID_ARGUMENT,{argument:"values",coder:h,value:r}),c[g]&&Dw.throwError("cannot encode object for signature with duplicate names",fe.errors.INVALID_ARGUMENT,{argument:"values",coder:h,value:r}),c[g]=!0,r[g]})}else Dw.throwArgumentError("invalid tuple value","tuple",r);e.length!==i.length&&Dw.throwArgumentError("types/value length mismatch","tuple",r);let n=new Cm(t.wordSize),o=new Cm(t.wordSize),s=[];e.forEach((c,h)=>{let g=i[h];if(c.dynamic){let b=o.length;c.encode(o,g);let E=n.writeUpdatableValue();s.push(A=>{E(A+b)})}else c.encode(n,g)}),s.forEach(c=>{c(n.length)});let a=t.appendWriter(n);return a+=t.appendWriter(o),a}function mM(t,e){let r=[],i=t.subReader(0);e.forEach(o=>{let s=null;if(o.dynamic){let a=t.readValue(),c=i.subReader(a.toNumber());try{s=o.decode(c)}catch(h){if(h.code===fe.errors.BUFFER_OVERRUN)throw h;s=h,s.baseType=o.name,s.name=o.localName,s.type=o.type}}else try{s=o.decode(t)}catch(a){if(a.code===fe.errors.BUFFER_OVERRUN)throw a;s=a,s.baseType=o.name,s.name=o.localName,s.type=o.type}s!=null&&r.push(s)});let n=e.reduce((o,s)=>{let a=s.localName;return a&&(o[a]||(o[a]=0),o[a]++),o},{});e.forEach((o,s)=>{let a=o.localName;if(!a||n[a]!==1||(a==="length"&&(a="_length"),r[a]!=null))return;let c=r[s];c instanceof Error?Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw c}}):r[a]=c});for(let o=0;o<r.length;o++){let s=r[o];s instanceof Error&&Object.defineProperty(r,o,{enumerable:!0,get:()=>{throw s}})}return Object.freeze(r)}var Y9=class extends Vn{constructor(e,r,i){let n=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",n,i,o),this.coder=e,this.length=r}defaultValue(){let e=this.coder.defaultValue(),r=[];for(let i=0;i<this.length;i++)r.push(e);return r}encode(e,r){Array.isArray(r)||this._throwError("expected array value",r);let i=this.length;i===-1&&(i=r.length,e.writeValue(r.length)),Dw.checkArgumentCount(r.length,i,"coder array"+(this.localName?" "+this.localName:""));let n=[];for(let o=0;o<r.length;o++)n.push(this.coder);return pM(e,n,r)}decode(e){let r=this.length;r===-1&&(r=e.readValue().toNumber(),r*32>e._data.length&&Dw.throwError("insufficient data length",fe.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let i=[];for(let n=0;n<r;n++)i.push(new Z9(this.coder));return e.coerce(this.name,mM(e,i))}};var J9=class extends Vn{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,r){return e.writeValue(r?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}};var Xy=class extends Vn{constructor(e,r){super(e,e,r,!0)}defaultValue(){return"0x"}encode(e,r){r=ke(r);let i=e.writeValue(r.length);return i+=e.writeBytes(r),i}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}},Q9=class extends Xy{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,De(super.decode(e)))}};var X9=class extends Vn{constructor(e,r){let i="bytes"+String(e);super(i,i,r,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,r){let i=ke(r);return i.length!==this.size&&this._throwError("incorrect data length",r),e.writeBytes(i)}decode(e){return e.coerce(this.name,De(e.readBytes(this.size)))}};var e_=class extends Vn{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,r){return r!=null&&this._throwError("not null",r),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}};var o_={};Oi(o_,{AddressZero:()=>t_,EtherSymbol:()=>iue,HashZero:()=>Bw,MaxInt256:()=>rue,MaxUint256:()=>n_,MinInt256:()=>tue,NegativeOne:()=>r_,One:()=>i_,Two:()=>Xle,WeiPerEther:()=>eue,Zero:()=>Lw});var t_="0x0000000000000000000000000000000000000000";var r_=Ue.from(-1),Lw=Ue.from(0),i_=Ue.from(1),Xle=Ue.from(2),eue=Ue.from("1000000000000000000"),n_=Ue.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),tue=Ue.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),rue=Ue.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Bw="0x0000000000000000000000000000000000000000000000000000000000000000";var iue="\u039E";var s_=class extends Vn{constructor(e,r,i){let n=(r?"int":"uint")+e*8;super(n,n,i,!1),this.size=e,this.signed=r}defaultValue(){return 0}encode(e,r){let i=Ue.from(r),n=n_.mask(e.wordSize*8);if(this.signed){let o=n.mask(this.size*8-1);(i.gt(o)||i.lt(o.add(i_).mul(r_)))&&this._throwError("value out-of-bounds",r)}else(i.lt(Lw)||i.gt(n.mask(this.size*8)))&&this._throwError("value out-of-bounds",r);return i=i.toTwos(this.size*8).mask(this.size*8),this.signed&&(i=i.fromTwos(this.size*8).toTwos(8*e.wordSize)),e.writeValue(i)}decode(e){let r=e.readValue().mask(this.size*8);return this.signed&&(r=r.fromTwos(this.size*8)),e.coerce(this.name,r)}};var nue="strings/5.7.0";var oue=new fe(nue),$s;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})($s||($s={}));var ds;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(ds||(ds={}));function CFe(t,e,r,i,n){return oue.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function sue(t,e,r,i,n){if(t===ds.BAD_PREFIX||t===ds.UNEXPECTED_CONTINUE){let o=0;for(let s=e+1;s<r.length&&r[s]>>6===2;s++)o++;return o}return t===ds.OVERRUN?r.length-e-1:0}function SFe(t,e,r,i,n){return t===ds.OVERLONG?(i.push(n),0):(i.push(65533),sue(t,e,r,i,n))}var a_=Object.freeze({error:CFe,ignore:sue,replace:SFe});function wM(t,e){e==null&&(e=a_.error),t=ke(t);let r=[],i=0;for(;i<t.length;){let n=t[i++];if(n>>7===0){r.push(n);continue}let o=null,s=null;if((n&224)===192)o=1,s=127;else if((n&240)===224)o=2,s=2047;else if((n&248)===240)o=3,s=65535;else{(n&192)===128?i+=e(ds.UNEXPECTED_CONTINUE,i-1,t,r):i+=e(ds.BAD_PREFIX,i-1,t,r);continue}if(i-1+o>=t.length){i+=e(ds.OVERRUN,i-1,t,r);continue}let a=n&(1<<8-o-1)-1;for(let c=0;c<o;c++){let h=t[i];if((h&192)!=128){i+=e(ds.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|h&63,i++}if(a!==null){if(a>1114111){i+=e(ds.OUT_OF_RANGE,i-1-o,t,r,a);continue}if(a>=55296&&a<=57343){i+=e(ds.UTF16_SURROGATE,i-1-o,t,r,a);continue}if(a<=s){i+=e(ds.OVERLONG,i-1-o,t,r,a);continue}r.push(a)}}return r}function ui(t,e=$s.current){e!=$s.current&&(oue.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){let n=t.charCodeAt(i);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(n&63|128);else if((n&64512)==55296){i++;let o=t.charCodeAt(i);if(i>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");let s=65536+((n&1023)<<10)+(o&1023);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(n&63|128)}return ke(r)}function gM(t){let e="0000"+t.toString(16);return"\\u"+e.substring(e.length-4)}function vM(t,e){return'"'+wM(t,e).map(r=>{if(r<256){switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(r>=32&&r<127)return String.fromCharCode(r)}return r<=65535?gM(r):(r-=65536,gM((r>>10&1023)+55296)+gM((r&1023)+56320))}).join("")+'"'}function c_(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function ua(t,e){return c_(wM(t,e))}function Xd(t,e=$s.current){return wM(ui(t,e))}function bM(t){let e=ui(t);if(e.length>31)throw new Error("bytes32 string must be less than 32 bytes");return De(Fr([e,Bw]).slice(0,32))}function yM(t){let e=ke(t);if(e.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(e[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;e[r-1]===0;)r--;return ua(e.slice(0,r))}function IFe(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}function xM(t,e){e||(e=function(n){return[parseInt(n,16)]});let r=0,i={};return t.split(",").forEach(n=>{let o=n.split(":");r+=parseInt(o[0],16),i[r]=e(o[1])}),i}function aue(t){let e=0;return t.split(",").map(r=>{let i=r.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}function _M(t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];if(r+=n.l,t>=r&&t<=r+n.h&&(t-r)%(n.d||1)===0){if(n.e&&n.e.indexOf(t-r)!==-1)continue;return n}}return null}var TFe=aue("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),RFe="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),kFe=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],NFe=xM("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),PFe=xM("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),OFe=xM("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",IFe),MFe=aue("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function DFe(t){return t.reduce((e,r)=>(r.forEach(i=>{e.push(i)}),e),[])}function LFe(t){return!!_M(t,TFe)}function BFe(t){let e=_M(t,kFe);if(e)return[t+e.s];let r=NFe[t];if(r)return r;let i=PFe[t];if(i)return[t+i[0]];let n=OFe[t];return n||null}function UFe(t){return!!_M(t,MFe)}function EM(t){if(t.match(/^[a-z0-9-]*$/i)&&t.length<=59)return t.toLowerCase();let e=Xd(t);e=DFe(e.map(i=>{if(RFe.indexOf(i)>=0)return[];if(i>=65024&&i<=65039)return[];let n=BFe(i);return n||[i]})),e=Xd(c_(e),$s.NFKC),e.forEach(i=>{if(UFe(i))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),e.forEach(i=>{if(LFe(i))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let r=c_(e);if(r.substring(0,1)==="-"||r.substring(2,4)==="--"||r.substring(r.length-1)==="-")throw new Error("invalid hyphen");return r}var l_=class extends Xy{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,ui(r))}decode(e){return ua(super.decode(e))}};var Im=class extends Vn{constructor(e,r){let i=!1,n=[];e.forEach(s=>{s.dynamic&&(i=!0),n.push(s.type)});let o="tuple("+n.join(",")+")";super("tuple",o,r,i),this.coders=e}defaultValue(){let e=[];this.coders.forEach(i=>{e.push(i.defaultValue())});let r=this.coders.reduce((i,n)=>{let o=n.localName;return o&&(i[o]||(i[o]=0),i[o]++),i},{});return this.coders.forEach((i,n)=>{let o=i.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[n]))}),Object.freeze(e)}encode(e,r){return pM(e,this.coders,r)}decode(e){return e.coerce(this.name,mM(e,this.coders))}};var u_=new fe(hf),FFe=new RegExp(/^bytes([0-9]*)$/),jFe=new RegExp(/^(u?int)([0-9]*)$/),Uw=class{constructor(e){ye(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new G9(e.name);case"bool":return new J9(e.name);case"string":return new l_(e.name);case"bytes":return new Q9(e.name);case"array":return new Y9(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Im((e.components||[]).map(i=>this._getCoder(i)),e.name);case"":return new e_(e.name)}let r=e.type.match(jFe);if(r){let i=parseInt(r[2]||"256");return(i===0||i>256||i%8!==0)&&u_.throwArgumentError("invalid "+r[1]+" bit length","param",e),new s_(i/8,r[1]==="int",e.name)}if(r=e.type.match(FFe),r){let i=parseInt(r[1]);return(i===0||i>32)&&u_.throwArgumentError("invalid bytes length","param",e),new X9(i,e.name)}return u_.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new q9(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new Cm(this._getWordSize())}getDefaultValue(e){let r=e.map(n=>this._getCoder(zo.from(n)));return new Im(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&u_.throwError("types/values length mismatch",fe.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});let i=e.map(s=>this._getCoder(zo.from(s))),n=new Im(i,"_"),o=this._getWriter();return n.encode(o,r),o.data}decode(e,r,i){let n=e.map(s=>this._getCoder(zo.from(s)));return new Im(n,"_").decode(this._getReader(ke(r),i))}},e5=new Uw;function Xa(t){return jr(ui(t))}var f_="hash/5.7.0";var AM={};Oi(AM,{decode:()=>Fw,encode:()=>jw});function Fw(t){t=atob(t);let e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return ke(e)}function jw(t){t=ke(t);let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function lue(t,e){e==null&&(e=1);let r=[],i=r.forEach,n=function(o,s){i.call(o,function(a){s>0&&Array.isArray(a)?n(a,s-1):r.push(a)})};return n(t,e),r}function $Fe(t){let e={};for(let r=0;r<t.length;r++){let i=t[r];e[i[0]]=i[1]}return e}function WFe(t){let e=0;function r(){return t[e++]<<8|t[e++]}let i=r(),n=1,o=[0,1];for(let te=1;te<i;te++)o.push(n+=r());let s=r(),a=e;e+=s;let c=0,h=0;function g(){return c==0&&(h=h<<8|t[e++],c=8),h>>--c&1}let b=31,E=Math.pow(2,b),A=E>>>1,T=A>>1,P=E-1,L=0;for(let te=0;te<b;te++)L=L<<1|g();let j=[],$=0,G=E;for(;;){let te=Math.floor(((L-$+1)*n-1)/G),se=0,X=i;for(;X-se>1;){let V=se+X>>>1;te<o[V]?X=V:se=V}if(se==0)break;j.push(se);let k=$+Math.floor(G*o[se]/n),F=$+Math.floor(G*o[se+1]/n)-1;for(;((k^F)&A)==0;)L=L<<1&P|g(),k=k<<1&P,F=F<<1&P|1;for(;k&~F&T;)L=L&A|L<<1&P>>>1|g(),k=k<<1^A,F=(F^A)<<1|A|1;$=k,G=1+F-k}let Z=i-4;return j.map(te=>{switch(te-Z){case 3:return Z+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return Z+256+(t[a++]<<8|t[a++]);case 1:return Z+t[a++];default:return te-1}})}function HFe(t){let e=0;return()=>t[e++]}function uue(t){return HFe(WFe(t))}function zFe(t){return t&1?~t>>1:t>>1}function qFe(t,e){let r=Array(t);for(let i=0;i<t;i++)r[i]=1+e();return r}function cue(t,e){let r=Array(t);for(let i=0,n=-1;i<t;i++)r[i]=n+=1+e();return r}function VFe(t,e){let r=Array(t);for(let i=0,n=0;i<t;i++)r[i]=n+=zFe(e());return r}function t5(t,e){let r=cue(t(),t),i=t(),n=cue(i,t),o=qFe(i,t);for(let s=0;s<i;s++)for(let a=0;a<o[s];a++)r.push(n[s]+a);return e?r.map(s=>e[s]):r}function fue(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(GFe(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(ZFe(r,t))}return $Fe(lue(e))}function KFe(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function hue(t,e,r){let i=Array(t).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)VFe(t,r).forEach((o,s)=>i[s].push(o));return i}function GFe(t,e){let r=1+e(),i=e(),n=KFe(e),o=hue(n.length,1+t,e);return lue(o.map((s,a)=>{let c=s[0],h=s.slice(1);return Array(n[a]).fill(void 0).map((g,b)=>{let E=b*i;return[c+b*r,h.map(A=>A+E)]})}))}function ZFe(t,e){let r=1+e();return hue(r,1+t,e).map(n=>[n[0],n.slice(1)])}function due(t){let e=t5(t).sort((i,n)=>i-n);return r();function r(){let i=[];for(;;){let h=t5(t,e);if(h.length==0)break;i.push({set:new Set(h),node:r()})}i.sort((h,g)=>g.set.size-h.set.size);let n=t(),o=n%3;n=n/3|0;let s=!!(n&1);n>>=1;let a=n==1,c=n==2;return{branches:i,valid:o,fe0f:s,save:a,check:c}}}function pue(){return uue(Fw("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}var h_=pue(),YFe=new Set(t5(h_)),JFe=new Set(t5(h_)),QFe=fue(h_),XFe=due(h_),mue=45,gue=95;function wue(t){return Xd(t)}function eje(t){return t.filter(e=>e!=65039)}function vue(t){for(let e of t.split(".")){let r=wue(e);try{for(let i=r.lastIndexOf(gue)-1;i>=0;i--)if(r[i]!==gue)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(i=>i<128)&&r[2]===mue&&r[3]===mue)throw new Error("invalid label extension")}catch(i){throw new Error(`Invalid label "${e}": ${i.message}`)}}return t}function bue(t){return vue(tje(t,eje))}function tje(t,e){let r=wue(t).reverse(),i=[];for(;r.length;){let n=ije(r);if(n){i.push(...e(n));continue}let o=r.pop();if(YFe.has(o)){i.push(o);continue}if(JFe.has(o))continue;let s=QFe[o];if(s){i.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return vue(rje(String.fromCodePoint(...i)))}function rje(t){return t.normalize("NFC")}function ije(t,e){var r;let i=XFe,n,o,s=[],a=t.length;for(e&&(e.length=0);a;){let c=t[--a];if(i=(r=i.branches.find(h=>h.set.has(c)))===null||r===void 0?void 0:r.node,!i)break;if(i.save)o=c;else if(i.check&&c===o)break;s.push(c),i.fe0f&&(s.push(65039),a>0&&t[a-1]==65039&&a--),i.valid&&(n=s.slice(),i.valid==2&&n.splice(1,1),e&&e.push(...t.slice(a).reverse()),t.length=a)}return n}var nje=new fe(f_),xue=new Uint8Array(32);xue.fill(0);function yue(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function CM(t){let e=ui(bue(t)),r=[];if(t.length===0)return r;let i=0;for(let n=0;n<e.length;n++)e[n]===46&&(r.push(yue(e.slice(i,n))),i=n+1);if(i>=e.length)throw new Error("invalid ENS name; empty component");return r.push(yue(e.slice(i))),r}function SM(t){try{return CM(t).length!==0}catch{}return!1}function ep(t){typeof t!="string"&&nje.throwArgumentError("invalid ENS name; not a string","name",t);let e=xue,r=CM(t);for(;r.length;)e=jr(Fr([e,jr(r.pop())]));return De(e)}function r5(t){return De(Fr(CM(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");let r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var _ue=`Ethereum Signed Message:
9976
9976
  `;function $w(t){return typeof t=="string"&&(t=ui(t)),jr(Fr([ui(_ue),ui(String(t.length)),t]))}var oje=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},bn=new fe(f_),Sue=new Uint8Array(32);Sue.fill(0);var sje=Ue.from(-1),Iue=Ue.from(0),Tue=Ue.from(1),aje=Ue.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function cje(t){let e=ke(t),r=e.length%32;return r?qn([e,Sue.slice(r)]):De(e)}var lje=Kr(Tue.toHexString(),32),uje=Kr(Iue.toHexString(),32),Eue={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},IM=["name","version","chainId","verifyingContract","salt"];function Aue(t){return function(e){return typeof e!="string"&&bn.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}var fje={name:Aue("name"),version:Aue("version"),chainId:function(t){try{return Ue.from(t).toString()}catch{}return bn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return $r(t).toLowerCase()}catch{}return bn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{let e=ke(t);if(e.length!==32)throw new Error("bad length");return De(e)}catch{}return bn.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function TM(t){{let e=t.match(/^(u?)int(\d*)$/);if(e){let r=e[1]==="",i=parseInt(e[2]||"256");(i%8!==0||i>256||e[2]&&e[2]!==String(i))&&bn.throwArgumentError("invalid numeric width","type",t);let n=aje.mask(r?i-1:i),o=r?n.add(Tue).mul(sje):Iue;return function(s){let a=Ue.from(s);return(a.lt(o)||a.gt(n))&&bn.throwArgumentError(`value out-of-bounds for ${t}`,"value",s),Kr(a.toTwos(256).toHexString(),32)}}}{let e=t.match(/^bytes(\d+)$/);if(e){let r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&&bn.throwArgumentError("invalid bytes width","type",t),function(i){return ke(i).length!==r&&bn.throwArgumentError(`invalid length for ${t}`,"value",i),cje(i)}}}switch(t){case"address":return function(e){return Kr($r(e),32)};case"bool":return function(e){return e?lje:uje};case"bytes":return function(e){return jr(e)};case"string":return function(e){return Xa(e)}}return null}function Cue(t,e){return`${t}(${e.map(({name:r,type:i})=>i+" "+r).join(",")})`}var Yc=class t{constructor(e){ye(this,"types",Object.freeze(wn(e))),ye(this,"_encoderCache",{}),ye(this,"_types",{});let r={},i={},n={};Object.keys(e).forEach(a=>{r[a]={},i[a]=[],n[a]={}});for(let a in e){let c={};e[a].forEach(h=>{c[h.name]&&bn.throwArgumentError(`duplicate variable name ${JSON.stringify(h.name)} in ${JSON.stringify(a)}`,"types",e),c[h.name]=!0;let g=h.type.match(/^([^\x5b]*)(\x5b|$)/)[1];g===a&&bn.throwArgumentError(`circular type reference to ${JSON.stringify(g)}`,"types",e),!TM(g)&&(i[g]||bn.throwArgumentError(`unknown type ${JSON.stringify(g)}`,"types",e),i[g].push(a),r[a][g]=!0)})}let o=Object.keys(i).filter(a=>i[a].length===0);o.length===0?bn.throwArgumentError("missing primary type","types",e):o.length>1&&bn.throwArgumentError(`ambiguous primary types or unused types: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),ye(this,"primaryType",o[0]);function s(a,c){c[a]&&bn.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),c[a]=!0,Object.keys(r[a]).forEach(h=>{i[h]&&(s(h,c),Object.keys(c).forEach(g=>{n[g][h]=!0}))}),delete c[a]}s(this.primaryType,{});for(let a in n){let c=Object.keys(n[a]);c.sort(),this._types[a]=Cue(a,e[a])+c.map(h=>Cue(h,e[h])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{let n=TM(e);if(n)return n}let r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){let n=r[1],o=this.getEncoder(n),s=parseInt(r[3]);return a=>{s>=0&&a.length!==s&&bn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let c=a.map(o);return this._types[n]&&(c=c.map(jr)),jr(qn(c))}}let i=this.types[e];if(i){let n=Xa(this._types[e]);return o=>{let s=i.map(({name:a,type:c})=>{let h=this.getEncoder(c)(o[a]);return this._types[c]?jr(h):h});return s.unshift(n),qn(s)}}return bn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){let r=this._types[e];return r||bn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return jr(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,i){if(TM(e))return i(e,r);let n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){let s=n[1],a=parseInt(n[3]);return a>=0&&r.length!==a&&bn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(c=>this._visit(s,c,i))}let o=this.types[e];return o?o.reduce((s,{name:a,type:c})=>(s[a]=this._visit(c,r[a],i),s),{}):bn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new t(e)}static getPrimaryType(e){return t.from(e).primaryType}static hashStruct(e,r,i){return t.from(r).hashStruct(e,i)}static hashDomain(e){let r=[];for(let i in e){let n=Eue[i];n||bn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(i)}`,"domain",e),r.push({name:i,type:n})}return r.sort((i,n)=>IM.indexOf(i.name)-IM.indexOf(n.name)),t.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,i){return qn(["0x1901",t.hashDomain(e),t.from(r).hash(i)])}static hash(e,r,i){return jr(t.encode(e,r,i))}static resolveNames(e,r,i,n){return oje(this,void 0,void 0,function*(){e=di(e);let o={};e.verifyingContract&&!Zt(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");let s=t.from(r);s.visit(i,(a,c)=>(a==="address"&&!Zt(c,20)&&(o[c]="0x"),c));for(let a in o)o[a]=yield n(a);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),i=s.visit(i,(a,c)=>a==="address"&&o[c]?o[c]:c),{domain:e,value:i}})}static getPayload(e,r,i){t.hashDomain(e);let n={},o=[];IM.forEach(c=>{let h=e[c];h!=null&&(n[c]=fje[c](h),o.push({name:c,type:Eue[c]}))});let s=t.from(r),a=di(r);return a.EIP712Domain?bn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):a.EIP712Domain=o,s.encode(i),{types:a,domain:n,primaryType:s.primaryType,message:s.visit(i,(c,h)=>{if(c.match(/^bytes(\d*)/))return De(ke(h));if(c.match(/^u?int/))return Ue.from(h).toString();switch(c){case"address":return h.toLowerCase();case"bool":return!!h;case"string":return typeof h!="string"&&bn.throwArgumentError("invalid string","value",h),h}return bn.throwArgumentError("unsupported type","type",c)})}}};var yn=new fe(hf);var Ww=class extends Qa{},Hw=class extends Qa{},RM=class extends Qa{},nh=class extends Qa{static isIndexed(e){return!!(e&&e._isIndexed)}},hje={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Rue(t,e){let r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}var tp=class{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,ye(this,"fragments",r.map(i=>df.from(i)).filter(i=>i!=null)),ye(this,"_abiCoder",vn(new.target,"getAbiCoder")()),ye(this,"functions",{}),ye(this,"errors",{}),ye(this,"events",{}),ye(this,"structs",{}),this.fragments.forEach(i=>{let n=null;switch(i.type){case"constructor":if(this.deploy){yn.warn("duplicate definition - constructor");return}ye(this,"deploy",i);return;case"function":n=this.functions;break;case"event":n=this.events;break;case"error":n=this.errors;break;default:return}let o=i.format();if(n[o]){yn.warn("duplicate definition - "+o);return}n[o]=i}),this.deploy||ye(this,"deploy",pf.from({payable:!1,type:"constructor"})),ye(this,"_isInterface",!0)}format(e){e||(e=oi.full),e===oi.sighash&&yn.throwArgumentError("interface does not support formatting sighash","format",e);let r=this.fragments.map(i=>i.format(e));return e===oi.json?JSON.stringify(r.map(i=>JSON.parse(i))):r}static getAbiCoder(){return e5}static getAddress(e){return $r(e)}static getSighash(e){return Fi(Xa(e.format()),0,4)}static getEventTopic(e){return Xa(e.format())}getFunction(e){if(Zt(e)){for(let i in this.functions)if(e===this.getSighash(i))return this.functions[i];yn.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){let i=e.trim(),n=Object.keys(this.functions).filter(o=>o.split("(")[0]===i);return n.length===0?yn.throwArgumentError("no matching function","name",i):n.length>1&&yn.throwArgumentError("multiple matching functions","name",i),this.functions[n[0]]}let r=this.functions[mf.fromString(e).format()];return r||yn.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(Zt(e)){let i=e.toLowerCase();for(let n in this.events)if(i===this.getEventTopic(n))return this.events[n];yn.throwArgumentError("no matching event","topichash",i)}if(e.indexOf("(")===-1){let i=e.trim(),n=Object.keys(this.events).filter(o=>o.split("(")[0]===i);return n.length===0?yn.throwArgumentError("no matching event","name",i):n.length>1&&yn.throwArgumentError("multiple matching events","name",i),this.events[n[0]]}let r=this.events[rh.fromString(e).format()];return r||yn.throwArgumentError("no matching event","signature",e),r}getError(e){if(Zt(e)){let i=vn(this.constructor,"getSighash");for(let n in this.errors){let o=this.errors[n];if(e===i(o))return this.errors[n]}yn.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){let i=e.trim(),n=Object.keys(this.errors).filter(o=>o.split("(")[0]===i);return n.length===0?yn.throwArgumentError("no matching error","name",i):n.length>1&&yn.throwArgumentError("multiple matching errors","name",i),this.errors[n[0]]}let r=this.errors[mf.fromString(e).format()];return r||yn.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return vn(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),vn(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));let i=ke(r);return De(i.slice(0,4))!==this.getSighash(e)&&yn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",De(i)),this._decodeParams(e.inputs,i.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),De(Fr([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=ke(r);return De(i.slice(0,4))!==this.getSighash(e)&&yn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",De(i)),this._decodeParams(e.inputs,i.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),De(Fr([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=ke(r),n=null,o="",s=null,a=null,c=null;switch(i.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,i)}catch{}break;case 4:{let h=De(i.slice(0,4)),g=hje[h];if(g)s=this._abiCoder.decode(g.inputs,i.slice(4)),a=g.name,c=g.signature,g.reason&&(n=s[0]),a==="Error"?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:a==="Panic"&&(o=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{let b=this.getError(h);s=this._abiCoder.decode(b.inputs,i.slice(4)),a=b.name,c=b.format()}catch{}break}}return yn.throwError("call revert exception"+o,fe.errors.CALL_EXCEPTION,{method:e.format(),data:De(r),errorArgs:s,errorName:a,errorSignature:c,reason:n})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),De(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&yn.throwError("too many arguments for "+e.format(),fe.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let i=[];e.anonymous||i.push(this.getEventTopic(e));let n=(o,s)=>o.type==="string"?Xa(s):o.type==="bytes"?jr(De(s)):(o.type==="bool"&&typeof s=="boolean"&&(s=s?"0x01":"0x00"),o.type.match(/^u?int/)&&(s=Ue.from(s).toHexString()),o.type==="address"&&this._abiCoder.encode(["address"],[s]),Kr(De(s),32));for(r.forEach((o,s)=>{let a=e.inputs[s];if(!a.indexed){o!=null&&yn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,o);return}o==null?i.push(null):a.baseType==="array"||a.baseType==="tuple"?yn.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,o):Array.isArray(o)?i.push(o.map(c=>n(a,c))):i.push(n(a,o))});i.length&&i[i.length-1]===null;)i.pop();return i}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));let i=[],n=[],o=[];return e.anonymous||i.push(this.getEventTopic(e)),r.length!==e.inputs.length&&yn.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((s,a)=>{let c=r[a];if(s.indexed)if(s.type==="string")i.push(Xa(c));else if(s.type==="bytes")i.push(jr(c));else{if(s.baseType==="tuple"||s.baseType==="array")throw new Error("not implemented");i.push(this._abiCoder.encode([s.type],[c]))}else n.push(s),o.push(c)}),{data:this._abiCoder.encode(n,o),topics:i}}decodeEventLog(e,r,i){if(typeof e=="string"&&(e=this.getEvent(e)),i!=null&&!e.anonymous){let E=this.getEventTopic(e);(!Zt(i[0],32)||i[0].toLowerCase()!==E)&&yn.throwError("fragment/topic mismatch",fe.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:E,value:i[0]}),i=i.slice(1)}let n=[],o=[],s=[];e.inputs.forEach((E,A)=>{E.indexed?E.type==="string"||E.type==="bytes"||E.baseType==="tuple"||E.baseType==="array"?(n.push(zo.fromObject({type:"bytes32",name:E.name})),s.push(!0)):(n.push(E),s.push(!1)):(o.push(E),s.push(!1))});let a=i!=null?this._abiCoder.decode(n,Fr(i)):null,c=this._abiCoder.decode(o,r,!0),h=[],g=0,b=0;e.inputs.forEach((E,A)=>{if(E.indexed)if(a==null)h[A]=new nh({_isIndexed:!0,hash:null});else if(s[A])h[A]=new nh({_isIndexed:!0,hash:a[b++]});else try{h[A]=a[b++]}catch(T){h[A]=T}else try{h[A]=c[g++]}catch(T){h[A]=T}if(E.name&&h[E.name]==null){let T=h[A];T instanceof Error?Object.defineProperty(h,E.name,{enumerable:!0,get:()=>{throw Rue(`property ${JSON.stringify(E.name)}`,T)}}):h[E.name]=T}});for(let E=0;E<h.length;E++){let A=h[E];A instanceof Error&&Object.defineProperty(h,E,{enumerable:!0,get:()=>{throw Rue(`index ${E}`,A)}})}return Object.freeze(h)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new Hw({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:Ue.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new Ww({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){let r=De(e),i=this.getError(r.substring(0,10).toLowerCase());return i?new RM({args:this._abiCoder.decode(i.inputs,"0x"+r.substring(10)),errorFragment:i,name:i.name,signature:i.format(),sighash:this.getSighash(i)}):null}static isInterface(e){return!!(e&&e._isInterface)}};var kue="abstract-provider/5.7.0";var dje=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},pje=new fe(kue),d_=class extends Qa{static isForkEvent(e){return!!(e&&e._isForkEvent)}};var Jc=class t{constructor(){pje.checkAbstract(new.target,t),ye(this,"_isProvider",!0)}getFeeData(){return dje(this,void 0,void 0,function*(){let{block:e,gasPrice:r}=yield ji({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(s=>null)}),i=null,n=null,o=null;return e&&e.baseFeePerGas&&(i=e.baseFeePerGas,o=Ue.from("1500000000"),n=e.baseFeePerGas.mul(2).add(o)),{lastBaseFeePerGas:i,maxFeePerGas:n,maxPriorityFeePerGas:o,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}};var Nue="abstract-signer/5.7.0";var Hl=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Qc=new fe(Nue),mje=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],gje=[fe.errors.INSUFFICIENT_FUNDS,fe.errors.NONCE_EXPIRED,fe.errors.REPLACEMENT_UNDERPRICED],ec=class t{constructor(){Qc.checkAbstract(new.target,t),ye(this,"_isSigner",!0)}getBalance(e){return Hl(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Hl(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Hl(this,void 0,void 0,function*(){this._checkProvider("estimateGas");let r=yield ji(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Hl(this,void 0,void 0,function*(){this._checkProvider("call");let i=yield ji(this.checkTransaction(e));return yield this.provider.call(i,r)})}sendTransaction(e){return Hl(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");let r=yield this.populateTransaction(e),i=yield this.signTransaction(r);return yield this.provider.sendTransaction(i)})}getChainId(){return Hl(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Hl(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Hl(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Hl(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(let i in e)mje.indexOf(i)===-1&&Qc.throwArgumentError("invalid transaction key: "+i,"transaction",e);let r=di(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(i=>(i[0].toLowerCase()!==i[1].toLowerCase()&&Qc.throwArgumentError("from address mismatch","transaction",e),i[0])),r}populateTransaction(e){return Hl(this,void 0,void 0,function*(){let r=yield ji(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(n=>Hl(this,void 0,void 0,function*(){if(n==null)return null;let o=yield this.resolveName(n);return o==null&&Qc.throwArgumentError("provided ENS name resolves to null","tx.to",n),o})),r.to.catch(n=>{}));let i=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||i)?Qc.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&i&&Qc.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{let n=yield this.getFeeData();if(r.type==null)if(n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){let o=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=o,r.maxPriorityFeePerGas=o}else r.maxFeePerGas==null&&(r.maxFeePerGas=n.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=n.maxPriorityFeePerGas);else n.gasPrice!=null?(i&&Qc.throwError("network does not support EIP-1559",fe.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=n.gasPrice),r.type=0):Qc.throwError("failed to get consistent fee data",fe.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=n.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=n.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(n=>{if(gje.indexOf(n.code)>=0)throw n;return Qc.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{error:n,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(n=>(n[1]!==0&&n[0]!==n[1]&&Qc.throwArgumentError("chainId address mismatch","transaction",e),n[0])),yield ji(r)})}_checkProvider(e){this.provider||Qc.throwError("missing provider",fe.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}},Tm=class t extends ec{constructor(e,r){super(),ye(this,"address",e),ye(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Qc.throwError(e,fe.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,i){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new t(this.address,e)}};var kr=Wt(iM()),Ef=Wt(FM());function Jw(t,e,r){return r={path:e,exports:{},require:function(i,n){return F$e(i,n??r.path)}},t(r,r.exports),r.exports}function F$e(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var HM=pfe;function pfe(t,e){if(!t)throw new Error(e||"Assertion failed")}pfe.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)};var Kl=Jw(function(t,e){"use strict";var r=e;function i(s,a){if(Array.isArray(s))return s.slice();if(!s)return[];var c=[];if(typeof s!="string"){for(var h=0;h<s.length;h++)c[h]=s[h]|0;return c}if(a==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var h=0;h<s.length;h+=2)c.push(parseInt(s[h]+s[h+1],16))}else for(var h=0;h<s.length;h++){var g=s.charCodeAt(h),b=g>>8,E=g&255;b?c.push(b,E):c.push(E)}return c}r.toArray=i;function n(s){return s.length===1?"0"+s:s}r.zero2=n;function o(s){for(var a="",c=0;c<s.length;c++)a+=n(s[c].toString(16));return a}r.toHex=o,r.encode=function(a,c){return c==="hex"?o(a):a}}),rc=Jw(function(t,e){"use strict";var r=e;r.assert=HM,r.toArray=Kl.toArray,r.zero2=Kl.zero2,r.toHex=Kl.toHex,r.encode=Kl.encode;function i(c,h,g){var b=new Array(Math.max(c.bitLength(),g)+1);b.fill(0);for(var E=1<<h+1,A=c.clone(),T=0;T<b.length;T++){var P,L=A.andln(E-1);A.isOdd()?(L>(E>>1)-1?P=(E>>1)-L:P=L,A.isubn(P)):P=0,b[T]=P,A.iushrn(1)}return b}r.getNAF=i;function n(c,h){var g=[[],[]];c=c.clone(),h=h.clone();for(var b=0,E=0,A;c.cmpn(-b)>0||h.cmpn(-E)>0;){var T=c.andln(3)+b&3,P=h.andln(3)+E&3;T===3&&(T=-1),P===3&&(P=-1);var L;(T&1)===0?L=0:(A=c.andln(7)+b&7,(A===3||A===5)&&P===2?L=-T:L=T),g[0].push(L);var j;(P&1)===0?j=0:(A=h.andln(7)+E&7,(A===3||A===5)&&T===2?j=-P:j=P),g[1].push(j),2*b===L+1&&(b=1-b),2*E===j+1&&(E=1-E),c.iushrn(1),h.iushrn(1)}return g}r.getJSF=n;function o(c,h,g){var b="_"+h;c.prototype[h]=function(){return this[b]!==void 0?this[b]:this[b]=g.call(this)}}r.cachedProperty=o;function s(c){return typeof c=="string"?r.toArray(c,"hex"):c}r.parseBytes=s;function a(c){return new kr.default(c,"hex","le")}r.intFromLE=a}),v_=rc.getNAF,j$e=rc.getJSF,b_=rc.assert;function np(t,e){this.type=t,this.p=new kr.default(e.p,16),this.red=e.prime?kr.default.red(e.prime):kr.default.mont(this.p),this.zero=new kr.default(0).toRed(this.red),this.one=new kr.default(1).toRed(this.red),this.two=new kr.default(2).toRed(this.red),this.n=e.n&&new kr.default(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var km=np;np.prototype.point=function(){throw new Error("Not implemented")};np.prototype.validate=function(){throw new Error("Not implemented")};np.prototype._fixedNafMul=function(e,r){b_(e.precomputed);var i=e._getDoubles(),n=v_(r,1,this._bitLength),o=(1<<i.step+1)-(i.step%2===0?2:1);o/=3;var s=[],a,c;for(a=0;a<n.length;a+=i.step){c=0;for(var h=a+i.step-1;h>=a;h--)c=(c<<1)+n[h];s.push(c)}for(var g=this.jpoint(null,null,null),b=this.jpoint(null,null,null),E=o;E>0;E--){for(a=0;a<s.length;a++)c=s[a],c===E?b=b.mixedAdd(i.points[a]):c===-E&&(b=b.mixedAdd(i.points[a].neg()));g=g.add(b)}return g.toP()};np.prototype._wnafMul=function(e,r){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var o=n.points,s=v_(r,i,this._bitLength),a=this.jpoint(null,null,null),c=s.length-1;c>=0;c--){for(var h=0;c>=0&&s[c]===0;c--)h++;if(c>=0&&h++,a=a.dblp(h),c<0)break;var g=s[c];b_(g!==0),e.type==="affine"?g>0?a=a.mixedAdd(o[g-1>>1]):a=a.mixedAdd(o[-g-1>>1].neg()):g>0?a=a.add(o[g-1>>1]):a=a.add(o[-g-1>>1].neg())}return e.type==="affine"?a.toP():a};np.prototype._wnafMulAdd=function(e,r,i,n,o){var s=this._wnafT1,a=this._wnafT2,c=this._wnafT3,h=0,g,b,E;for(g=0;g<n;g++){E=r[g];var A=E._getNAFPoints(e);s[g]=A.wnd,a[g]=A.points}for(g=n-1;g>=1;g-=2){var T=g-1,P=g;if(s[T]!==1||s[P]!==1){c[T]=v_(i[T],s[T],this._bitLength),c[P]=v_(i[P],s[P],this._bitLength),h=Math.max(c[T].length,h),h=Math.max(c[P].length,h);continue}var L=[r[T],null,null,r[P]];r[T].y.cmp(r[P].y)===0?(L[1]=r[T].add(r[P]),L[2]=r[T].toJ().mixedAdd(r[P].neg())):r[T].y.cmp(r[P].y.redNeg())===0?(L[1]=r[T].toJ().mixedAdd(r[P]),L[2]=r[T].add(r[P].neg())):(L[1]=r[T].toJ().mixedAdd(r[P]),L[2]=r[T].toJ().mixedAdd(r[P].neg()));var j=[-3,-1,-5,-7,0,7,5,1,3],$=j$e(i[T],i[P]);for(h=Math.max($[0].length,h),c[T]=new Array(h),c[P]=new Array(h),b=0;b<h;b++){var G=$[0][b]|0,Z=$[1][b]|0;c[T][b]=j[(G+1)*3+(Z+1)],c[P][b]=0,a[T]=L}}var te=this.jpoint(null,null,null),se=this._wnafT4;for(g=h;g>=0;g--){for(var X=0;g>=0;){var k=!0;for(b=0;b<n;b++)se[b]=c[b][g]|0,se[b]!==0&&(k=!1);if(!k)break;X++,g--}if(g>=0&&X++,te=te.dblp(X),g<0)break;for(b=0;b<n;b++){var F=se[b];F!==0&&(F>0?E=a[b][F-1>>1]:F<0&&(E=a[b][-F-1>>1].neg()),E.type==="affine"?te=te.mixedAdd(E):te=te.add(E))}}for(g=0;g<n;g++)a[g]=null;return o?te:te.toP()};function el(t,e){this.curve=t,this.type=e,this.precomputed=null}np.BasePoint=el;el.prototype.eq=function(){throw new Error("Not implemented")};el.prototype.validate=function(){return this.curve.validate(this)};np.prototype.decodePoint=function(e,r){e=rc.toArray(e,r);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?b_(e[e.length-1]%2===0):e[0]===7&&b_(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")};el.prototype.encodeCompressed=function(e){return this.encode(e,!0)};el.prototype._encode=function(e){var r=this.curve.p.byteLength(),i=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",r))};el.prototype.encode=function(e,r){return rc.encode(this._encode(r),e)};el.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this};el.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1};el.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,o=0;o<r;o+=e){for(var s=0;s<e;s++)n=n.dbl();i.push(n)}return{step:e,points:i}};el.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),o=1;o<i;o++)r[o]=r[o-1].add(n);return{wnd:e,points:r}};el.prototype._getBeta=function(){return null};el.prototype.dblp=function(e){for(var r=this,i=0;i<e;i++)r=r.dbl();return r};var zM=Jw(function(t){typeof Object.create=="function"?t.exports=function(r,i){i&&(r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(r,i){if(i){r.super_=i;var n=function(){};n.prototype=i.prototype,r.prototype=new n,r.prototype.constructor=r}}}),$$e=rc.assert;function tl(t){km.call(this,"short",t),this.a=new kr.default(t.a,16).toRed(this.red),this.b=new kr.default(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}zM(tl,km);var W$e=tl;tl.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new kr.default(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new kr.default(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(r))===0?i=o[0]:(i=o[1],$$e(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var s;return e.basis?s=e.basis.map(function(a){return{a:new kr.default(a.a,16),b:new kr.default(a.b,16)}}):s=this._getEndoBasis(i),{beta:r,lambda:i,basis:s}}};tl.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:kr.default.mont(e),i=new kr.default(2).toRed(r).redInvm(),n=i.redNeg(),o=new kr.default(3).toRed(r).redNeg().redSqrt().redMul(i),s=n.redAdd(o).fromRed(),a=n.redSub(o).fromRed();return[s,a]};tl.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),o=new kr.default(1),s=new kr.default(0),a=new kr.default(0),c=new kr.default(1),h,g,b,E,A,T,P,L=0,j,$;i.cmpn(0)!==0;){var G=n.div(i);j=n.sub(G.mul(i)),$=a.sub(G.mul(o));var Z=c.sub(G.mul(s));if(!b&&j.cmp(r)<0)h=P.neg(),g=o,b=j.neg(),E=$;else if(b&&++L===2)break;P=j,n=i,i=j,a=o,o=$,c=s,s=Z}A=j.neg(),T=$;var te=b.sqr().add(E.sqr()),se=A.sqr().add(T.sqr());return se.cmp(te)>=0&&(A=h,T=g),b.negative&&(b=b.neg(),E=E.neg()),A.negative&&(A=A.neg(),T=T.neg()),[{a:b,b:E},{a:A,b:T}]};tl.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],o=n.b.mul(e).divRound(this.n),s=i.b.neg().mul(e).divRound(this.n),a=o.mul(i.a),c=s.mul(n.a),h=o.mul(i.b),g=s.mul(n.b),b=e.sub(a).sub(c),E=h.add(g).neg();return{k1:b,k2:E}};tl.prototype.pointFromX=function(e,r){e=new kr.default(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var o=n.fromRed().isOdd();return(r&&!o||!r&&o)&&(n=n.redNeg()),this.point(e,n)};tl.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(o).cmpn(0)===0};tl.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,o=this._endoWnafT2,s=0;s<e.length;s++){var a=this._endoSplit(r[s]),c=e[s],h=c._getBeta();a.k1.negative&&(a.k1.ineg(),c=c.neg(!0)),a.k2.negative&&(a.k2.ineg(),h=h.neg(!0)),n[s*2]=c,n[s*2+1]=h,o[s*2]=a.k1,o[s*2+1]=a.k2}for(var g=this._wnafMulAdd(1,n,o,s*2,i),b=0;b<s*2;b++)n[b]=null,o[b]=null;return g};function xo(t,e,r,i){km.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new kr.default(e,16),this.y=new kr.default(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}zM(xo,km.BasePoint);tl.prototype.point=function(e,r,i){return new xo(this,e,r,i)};tl.prototype.pointFromJSON=function(e,r){return xo.fromJSON(this,e,r)};xo.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(o){return i.point(o.x.redMul(i.endo.beta),o.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return r}};xo.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};xo.fromJSON=function(e,r,i){typeof r=="string"&&(r=JSON.parse(r));var n=e.point(r[0],r[1],i);if(!r[2])return n;function o(a){return e.point(a[0],a[1],i)}var s=r[2];return n.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[n].concat(s.doubles.points.map(o))},naf:s.naf&&{wnd:s.naf.wnd,points:[n].concat(s.naf.points.map(o))}},n};xo.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};xo.prototype.isInfinity=function(){return this.inf};xo.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)};xo.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),o=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),s=o.redSqr().redISub(this.x.redAdd(this.x)),a=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)};xo.prototype.getX=function(){return this.x.fromRed()};xo.prototype.getY=function(){return this.y.fromRed()};xo.prototype.mul=function(e){return e=new kr.default(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};xo.prototype.mulAdd=function(e,r,i){var n=[this,r],o=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,o):this.curve._wnafMulAdd(1,n,o,2)};xo.prototype.jmulAdd=function(e,r,i){var n=[this,r],o=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,o,!0):this.curve._wnafMulAdd(1,n,o,2,!0)};xo.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};xo.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(o){return o.neg()};r.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return r};xo.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Vo(t,e,r,i){km.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new kr.default(0)):(this.x=new kr.default(e,16),this.y=new kr.default(r,16),this.z=new kr.default(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}zM(Vo,km.BasePoint);tl.prototype.jpoint=function(e,r,i){return new Vo(this,e,r,i)};Vo.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)};Vo.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Vo.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),o=e.x.redMul(i),s=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(i.redMul(this.z)),c=n.redSub(o),h=s.redSub(a);if(c.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=c.redSqr(),b=g.redMul(c),E=n.redMul(g),A=h.redSqr().redIAdd(b).redISub(E).redISub(E),T=h.redMul(E.redISub(A)).redISub(s.redMul(b)),P=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(A,T,P)};Vo.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),a=i.redSub(n),c=o.redSub(s);if(a.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=a.redSqr(),g=h.redMul(a),b=i.redMul(h),E=c.redSqr().redIAdd(g).redISub(b).redISub(b),A=c.redMul(b.redISub(E)).redISub(o.redMul(g)),T=this.z.redMul(a);return this.curve.jpoint(E,A,T)};Vo.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r<e;r++)i=i.dbl();return i}var n=this.curve.a,o=this.curve.tinv,s=this.x,a=this.y,c=this.z,h=c.redSqr().redSqr(),g=a.redAdd(a);for(r=0;r<e;r++){var b=s.redSqr(),E=g.redSqr(),A=E.redSqr(),T=b.redAdd(b).redIAdd(b).redIAdd(n.redMul(h)),P=s.redMul(E),L=T.redSqr().redISub(P.redAdd(P)),j=P.redISub(L),$=T.redMul(j);$=$.redIAdd($).redISub(A);var G=g.redMul(c);r+1<e&&(h=h.redMul(A)),s=L,c=G,g=$}return this.curve.jpoint(s,g.redMul(o),c)};Vo.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};Vo.prototype._zeroDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(s);a=a.redIAdd(a);var c=n.redAdd(n).redIAdd(n),h=c.redSqr().redISub(a).redISub(a),g=s.redIAdd(s);g=g.redIAdd(g),g=g.redIAdd(g),e=h,r=c.redMul(a.redISub(h)).redISub(g),i=this.y.redAdd(this.y)}else{var b=this.x.redSqr(),E=this.y.redSqr(),A=E.redSqr(),T=this.x.redAdd(E).redSqr().redISub(b).redISub(A);T=T.redIAdd(T);var P=b.redAdd(b).redIAdd(b),L=P.redSqr(),j=A.redIAdd(A);j=j.redIAdd(j),j=j.redIAdd(j),e=L.redISub(T).redISub(T),r=P.redMul(T.redISub(e)).redISub(j),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,r,i)};Vo.prototype._threeDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),o=this.y.redSqr(),s=o.redSqr(),a=this.x.redAdd(o).redSqr().redISub(n).redISub(s);a=a.redIAdd(a);var c=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),h=c.redSqr().redISub(a).redISub(a);e=h;var g=s.redIAdd(s);g=g.redIAdd(g),g=g.redIAdd(g),r=c.redMul(a.redISub(h)).redISub(g),i=this.y.redAdd(this.y)}else{var b=this.z.redSqr(),E=this.y.redSqr(),A=this.x.redMul(E),T=this.x.redSub(b).redMul(this.x.redAdd(b));T=T.redAdd(T).redIAdd(T);var P=A.redIAdd(A);P=P.redIAdd(P);var L=P.redAdd(P);e=T.redSqr().redISub(L),i=this.y.redAdd(this.z).redSqr().redISub(E).redISub(b);var j=E.redSqr();j=j.redIAdd(j),j=j.redIAdd(j),j=j.redIAdd(j),r=T.redMul(P.redISub(e)).redISub(j)}return this.curve.jpoint(e,r,i)};Vo.prototype._dbl=function(){var e=this.curve.a,r=this.x,i=this.y,n=this.z,o=n.redSqr().redSqr(),s=r.redSqr(),a=i.redSqr(),c=s.redAdd(s).redIAdd(s).redIAdd(e.redMul(o)),h=r.redAdd(r);h=h.redIAdd(h);var g=h.redMul(a),b=c.redSqr().redISub(g.redAdd(g)),E=g.redISub(b),A=a.redSqr();A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A);var T=c.redMul(E).redISub(A),P=i.redAdd(i).redMul(n);return this.curve.jpoint(b,T,P)};Vo.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr(),n=r.redSqr(),o=e.redAdd(e).redIAdd(e),s=o.redSqr(),a=this.x.redAdd(r).redSqr().redISub(e).redISub(n);a=a.redIAdd(a),a=a.redAdd(a).redIAdd(a),a=a.redISub(s);var c=a.redSqr(),h=n.redIAdd(n);h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var g=o.redIAdd(a).redSqr().redISub(s).redISub(c).redISub(h),b=r.redMul(g);b=b.redIAdd(b),b=b.redIAdd(b);var E=this.x.redMul(c).redISub(b);E=E.redIAdd(E),E=E.redIAdd(E);var A=this.y.redMul(g.redMul(h.redISub(g)).redISub(a.redMul(c)));A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A);var T=this.z.redAdd(a).redSqr().redISub(i).redISub(c);return this.curve.jpoint(E,A,T)};Vo.prototype.mul=function(e,r){return e=new kr.default(e,r),this.curve._wnafMul(this,e)};Vo.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var n=r.redMul(this.z),o=i.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(n)).cmpn(0)===0};Vo.prototype.eqXToP=function(e){var r=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),o=this.curve.redN.redMul(r);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(o),this.x.cmp(i)===0)return!0}};Vo.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};Vo.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var g_=Jw(function(t,e){"use strict";var r=e;r.base=km,r.short=W$e,r.mont=null,r.edwards=null}),w_=Jw(function(t,e){"use strict";var r=e,i=rc.assert;function n(a){a.type==="short"?this.curve=new g_.short(a):a.type==="edwards"?this.curve=new g_.edwards(a):this.curve=new g_.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=n;function o(a,c){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var h=new n(c);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:h}),h}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ef.default.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ef.default.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ef.default.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ef.default.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ef.default.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ef.default.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ef.default.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var s;try{s=null.crash()}catch{s=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ef.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})});function ip(t){if(!(this instanceof ip))return new ip(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Kl.toArray(t.entropy,t.entropyEnc||"hex"),r=Kl.toArray(t.nonce,t.nonceEnc||"hex"),i=Kl.toArray(t.pers,t.persEnc||"hex");HM(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var mfe=ip;ip.prototype._init=function(e,r,i){var n=e.concat(r).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656};ip.prototype._hmac=function(){return new Ef.default.hmac(this.hash,this.K)};ip.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())};ip.prototype.reseed=function(e,r,i,n){typeof r!="string"&&(n=i,i=r,r=null),e=Kl.toArray(e,r),i=Kl.toArray(i,n),HM(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1};ip.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=Kl.toArray(i,n||"hex"),this._update(i));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var s=o.slice(0,e);return this._update(i),this._reseed++,Kl.encode(s,r)};var WM=rc.assert;function ps(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var qM=ps;ps.fromPublic=function(e,r,i){return r instanceof ps?r:new ps(e,{pub:r,pubEnc:i})};ps.fromPrivate=function(e,r,i){return r instanceof ps?r:new ps(e,{priv:r,privEnc:i})};ps.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};ps.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};ps.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};ps.prototype._importPrivate=function(e,r){this.priv=new kr.default(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};ps.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?WM(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&WM(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};ps.prototype.derive=function(e){return e.validate()||WM(e.validate(),"public point not validated"),e.mul(this.priv).getX()};ps.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)};ps.prototype.verify=function(e,r){return this.ec.verify(e,r,this)};ps.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var H$e=rc.assert;function y_(t,e){if(t instanceof y_)return t;this._importDER(t,e)||(H$e(t.r&&t.s,"Signature without r or s"),this.r=new kr.default(t.r,16),this.s=new kr.default(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var x_=y_;function z$e(){this.place=0}function jM(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4)return!1;for(var n=0,o=0,s=e.place;o<i;o++,s++)n<<=8,n|=t[s],n>>>=0;return n<=127?!1:(e.place=s,n)}function dfe(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}y_.prototype._importDER=function(e,r){e=rc.toArray(e,r);var i=new z$e;if(e[i.place++]!==48)return!1;var n=jM(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var o=jM(e,i);if(o===!1)return!1;var s=e.slice(i.place,o+i.place);if(i.place+=o,e[i.place++]!==2)return!1;var a=jM(e,i);if(a===!1||e.length!==a+i.place)return!1;var c=e.slice(i.place,a+i.place);if(s[0]===0)if(s[1]&128)s=s.slice(1);else return!1;if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;return this.r=new kr.default(s),this.s=new kr.default(c),this.recoveryParam=null,!0};function $M(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}y_.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=dfe(r),i=dfe(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];$M(n,r.length),n=n.concat(r),n.push(2),$M(n,i.length);var o=n.concat(i),s=[48];return $M(s,o.length),s=s.concat(o),rc.encode(s,e)};var q$e=function(){throw new Error("unsupported")},gfe=rc.assert;function Xc(t){if(!(this instanceof Xc))return new Xc(t);typeof t=="string"&&(gfe(Object.prototype.hasOwnProperty.call(w_,t),"Unknown curve "+t),t=w_[t]),t instanceof w_.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var V$e=Xc;Xc.prototype.keyPair=function(e){return new qM(this,e)};Xc.prototype.keyFromPrivate=function(e,r){return qM.fromPrivate(this,e,r)};Xc.prototype.keyFromPublic=function(e,r){return qM.fromPublic(this,e,r)};Xc.prototype.genKeyPair=function(e){e||(e={});for(var r=new mfe({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||q$e(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new kr.default(2));;){var o=new kr.default(r.generate(i));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Xc.prototype._truncateToN=function(e,r){var i=e.byteLength()*8-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Xc.prototype.sign=function(e,r,i,n){typeof i=="object"&&(n=i,i=null),n||(n={}),r=this.keyFromPrivate(r,i),e=this._truncateToN(new kr.default(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),a=e.toArray("be",o),c=new mfe({hash:this.hash,entropy:s,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),h=this.n.sub(new kr.default(1)),g=0;;g++){var b=n.k?n.k(g):new kr.default(c.generate(this.n.byteLength()));if(b=this._truncateToN(b,!0),!(b.cmpn(1)<=0||b.cmp(h)>=0)){var E=this.g.mul(b);if(!E.isInfinity()){var A=E.getX(),T=A.umod(this.n);if(T.cmpn(0)!==0){var P=b.invm(this.n).mul(T.mul(r.getPrivate()).iadd(e));if(P=P.umod(this.n),P.cmpn(0)!==0){var L=(E.getY().isOdd()?1:0)|(A.cmp(T)!==0?2:0);return n.canonical&&P.cmp(this.nh)>0&&(P=this.n.sub(P),L^=1),new x_({r:T,s:P,recoveryParam:L})}}}}}};Xc.prototype.verify=function(e,r,i,n){e=this._truncateToN(new kr.default(e,16)),i=this.keyFromPublic(i,n),r=new x_(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a=s.invm(this.n),c=a.mul(e).umod(this.n),h=a.mul(o).umod(this.n),g;return this.curve._maxwellTrick?(g=this.g.jmulAdd(c,i.getPublic(),h),g.isInfinity()?!1:g.eqXToP(o)):(g=this.g.mulAdd(c,i.getPublic(),h),g.isInfinity()?!1:g.getX().umod(this.n).cmp(o)===0)};Xc.prototype.recoverPubKey=function(t,e,r,i){gfe((3&r)===r,"The recovery param is more than two bits"),e=new x_(e,i);var n=this.n,o=new kr.default(t),s=e.r,a=e.s,c=r&1,h=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");h?s=this.curve.pointFromX(s.add(this.curve.n),c):s=this.curve.pointFromX(s,c);var g=e.r.invm(n),b=n.sub(o).mul(g).umod(n),E=a.mul(g).umod(n);return this.g.mulAdd(b,s,E)};Xc.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new x_(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var o;try{o=this.recoverPubKey(t,e,n)}catch{continue}if(o.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var K$e=Jw(function(t,e){"use strict";var r=e;r.version="6.5.4",r.utils=rc,r.rand=function(){throw new Error("unsupported")},r.curve=g_,r.curves=w_,r.ec=V$e,r.eddsa=null}),wfe=K$e.ec;var vfe="signing-key/5.7.0";var KM=new fe(vfe),VM=null;function Af(){return VM||(VM=new wfe("secp256k1")),VM}var rl=class{constructor(e){ye(this,"curve","secp256k1"),ye(this,"privateKey",De(e)),hs(this.privateKey)!==32&&KM.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let r=Af().keyFromPrivate(ke(this.privateKey));ye(this,"publicKey","0x"+r.getPublic(!1,"hex")),ye(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),ye(this,"_isSigningKey",!0)}_addPoint(e){let r=Af().keyFromPublic(ke(this.publicKey)),i=Af().keyFromPublic(ke(e));return"0x"+r.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){let r=Af().keyFromPrivate(ke(this.privateKey)),i=ke(e);i.length!==32&&KM.throwArgumentError("bad digest length","digest",e);let n=r.sign(i,{canonical:!0});return ff({recoveryParam:n.recoveryParam,r:Kr("0x"+n.r.toString(16),32),s:Kr("0x"+n.s.toString(16),32)})}computeSharedSecret(e){let r=Af().keyFromPrivate(ke(this.privateKey)),i=Af().keyFromPublic(ke(o5(e)));return Kr("0x"+r.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}};function __(t,e){let r=ff(e),i={r:ke(r.r),s:ke(r.s)};return"0x"+Af().recoverPubKey(ke(t),i,r.recoveryParam).encode("hex",!1)}function o5(t,e){let r=ke(t);if(r.length===32){let i=new rl(r);return e?"0x"+Af().keyFromPrivate(r).getPublic(!0,"hex"):i.publicKey}else{if(r.length===33)return e?De(r):"0x"+Af().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+Af().keyFromPublic(r).getPublic(!0,"hex"):De(r)}return KM.throwArgumentError("invalid public or private key","key","[REDACTED]")}var bfe="transactions/5.7.0";var gs=new fe(bfe),E_;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(E_||(E_={}));function ZM(t){return t==="0x"?null:$r(t)}function ms(t){return t==="0x"?Lw:Ue.from(t)}var G$e=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],Z$e={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function il(t){let e=o5(t);return $r(Fi(jr(Fi(e,1)),12))}function Nm(t,e){return il(__(ke(t),e))}function ic(t,e){let r=Ja(Ue.from(t).toHexString());return r.length>32&&gs.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function GM(t,e){return{address:$r(t),storageKeys:(e||[]).map((r,i)=>(hs(r)!==32&&gs.throwArgumentError("invalid access list storageKey",`accessList[${t}:${i}]`,r),r.toLowerCase()))}}function nc(t){if(Array.isArray(t))return t.map((r,i)=>Array.isArray(r)?(r.length>2&&gs.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${i}]`,r),GM(r[0],r[1])):GM(r.address,r.storageKeys));let e=Object.keys(t).map(r=>{let i=t[r].reduce((n,o)=>(n[o]=!0,n),{});return GM(r,Object.keys(i).sort())});return e.sort((r,i)=>r.address.localeCompare(i.address)),e}function yfe(t){return nc(t).map(e=>[e.address,e.storageKeys])}function xfe(t,e){if(t.gasPrice!=null){let i=Ue.from(t.gasPrice),n=Ue.from(t.maxFeePerGas||0);i.eq(n)||gs.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:i,maxFeePerGas:n})}let r=[ic(t.chainId||0,"chainId"),ic(t.nonce||0,"nonce"),ic(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ic(t.maxFeePerGas||0,"maxFeePerGas"),ic(t.gasLimit||0,"gasLimit"),t.to!=null?$r(t.to):"0x",ic(t.value||0,"value"),t.data||"0x",yfe(t.accessList||[])];if(e){let i=ff(e);r.push(ic(i.recoveryParam,"recoveryParam")),r.push(Ja(i.r)),r.push(Ja(i.s))}return qn(["0x02",ih(r)])}function _fe(t,e){let r=[ic(t.chainId||0,"chainId"),ic(t.nonce||0,"nonce"),ic(t.gasPrice||0,"gasPrice"),ic(t.gasLimit||0,"gasLimit"),t.to!=null?$r(t.to):"0x",ic(t.value||0,"value"),t.data||"0x",yfe(t.accessList||[])];if(e){let i=ff(e);r.push(ic(i.recoveryParam,"recoveryParam")),r.push(Ja(i.r)),r.push(Ja(i.s))}return qn(["0x01",ih(r)])}function Y$e(t,e){Pw(t,Z$e);let r=[];G$e.forEach(function(s){let a=t[s.name]||[],c={};s.numeric&&(c.hexPad="left"),a=ke(De(a,c)),s.length&&a.length!==s.length&&a.length>0&&gs.throwArgumentError("invalid length for "+s.name,"transaction:"+s.name,a),s.maxLength&&(a=Ja(a),a.length>s.maxLength&&gs.throwArgumentError("invalid length for "+s.name,"transaction:"+s.name,a)),r.push(De(a))});let i=0;if(t.chainId!=null?(i=t.chainId,typeof i!="number"&&gs.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!eh(e)&&e.v>28&&(i=Math.floor((e.v-35)/2)),i!==0&&(r.push(De(i)),r.push("0x"),r.push("0x")),!e)return ih(r);let n=ff(e),o=27+n.recoveryParam;return i!==0?(r.pop(),r.pop(),r.pop(),o+=i*2+8,n.v>28&&n.v!==o&&gs.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):n.v!==o&&gs.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),r.push(De(o)),r.push(Ja(ke(n.r))),r.push(Ja(ke(n.s))),ih(r)}function s5(t,e){if(t.type==null||t.type===0)return t.accessList!=null&&gs.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),Y$e(t,e);switch(t.type){case 1:return _fe(t,e);case 2:return xfe(t,e);default:break}return gs.throwError(`unsupported transaction type: ${t.type}`,fe.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}function Efe(t,e,r){try{let i=ms(e[0]).toNumber();if(i!==0&&i!==1)throw new Error("bad recid");t.v=i}catch{gs.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=Kr(e[1],32),t.s=Kr(e[2],32);try{let i=jr(r(t));t.from=Nm(i,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function J$e(t){let e=Qy(t.slice(1));e.length!==9&&e.length!==12&&gs.throwArgumentError("invalid component count for transaction type: 2","payload",De(t));let r=ms(e[2]),i=ms(e[3]),n={type:2,chainId:ms(e[0]).toNumber(),nonce:ms(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:i,gasPrice:null,gasLimit:ms(e[4]),to:ZM(e[5]),value:ms(e[6]),data:e[7],accessList:nc(e[8])};return e.length===9||(n.hash=jr(t),Efe(n,e.slice(9),xfe)),n}function Q$e(t){let e=Qy(t.slice(1));e.length!==8&&e.length!==11&&gs.throwArgumentError("invalid component count for transaction type: 1","payload",De(t));let r={type:1,chainId:ms(e[0]).toNumber(),nonce:ms(e[1]).toNumber(),gasPrice:ms(e[2]),gasLimit:ms(e[3]),to:ZM(e[4]),value:ms(e[5]),data:e[6],accessList:nc(e[7])};return e.length===8||(r.hash=jr(t),Efe(r,e.slice(8),_fe)),r}function X$e(t){let e=Qy(t);e.length!==9&&e.length!==6&&gs.throwArgumentError("invalid raw transaction","rawTransaction",t);let r={nonce:ms(e[0]).toNumber(),gasPrice:ms(e[1]),gasLimit:ms(e[2]),to:ZM(e[3]),value:ms(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=Ue.from(e[6]).toNumber()}catch{return r}if(r.r=Kr(e[7],32),r.s=Kr(e[8],32),Ue.from(r.r).isZero()&&Ue.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let i=r.v-27,n=e.slice(0,6);r.chainId!==0&&(n.push(De(r.chainId)),n.push("0x"),n.push("0x"),i-=r.chainId*2+8);let o=jr(ih(n));try{r.from=Nm(o,{r:De(r.r),s:De(r.s),recoveryParam:i})}catch{}r.hash=jr(t)}return r.type=null,r}function A_(t){let e=ke(t);if(e[0]>127)return X$e(e);switch(e[0]){case 1:return Q$e(e);case 2:return J$e(e);default:break}return gs.throwError(`unsupported transaction type: ${e[0]}`,fe.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}var Afe="contracts/5.7.0";var op=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},zi=new fe(Afe),eWe={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function C_(t,e){return op(this,void 0,void 0,function*(){let r=yield e;typeof r!="string"&&zi.throwArgumentError("invalid address or ENS name","name",r);try{return $r(r)}catch{}t||zi.throwError("a provider or signer is needed to resolve ENS names",fe.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});let i=yield t.resolveName(r);return i==null&&zi.throwArgumentError("resolver or addr is not configured for ENS name","name",r),i})}function a5(t,e,r){return op(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((i,n)=>a5(t,Array.isArray(e)?e[n]:e[i.name],i))):r.type==="address"?yield C_(t,e):r.type==="tuple"?yield a5(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(i=>a5(t,i,r.arrayChildren))):Promise.reject(zi.makeError("invalid value for array",fe.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function T_(t,e,r){return op(this,void 0,void 0,function*(){let i={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(i=di(r.pop())),zi.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?i.from?i.from=ji({override:C_(t.signer,i.from),signer:t.signer.getAddress()}).then(h=>op(this,void 0,void 0,function*(){return $r(h.signer)!==h.override&&zi.throwError("Contract with a Signer cannot override from",fe.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),h.override})):i.from=t.signer.getAddress():i.from&&(i.from=C_(t.provider,i.from));let n=yield ji({args:a5(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:ji(i)||{}}),o=t.interface.encodeFunctionData(e,n.args),s={data:o,to:n.address},a=n.overrides;if(a.nonce!=null&&(s.nonce=Ue.from(a.nonce).toNumber()),a.gasLimit!=null&&(s.gasLimit=Ue.from(a.gasLimit)),a.gasPrice!=null&&(s.gasPrice=Ue.from(a.gasPrice)),a.maxFeePerGas!=null&&(s.maxFeePerGas=Ue.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(s.maxPriorityFeePerGas=Ue.from(a.maxPriorityFeePerGas)),a.from!=null&&(s.from=a.from),a.type!=null&&(s.type=a.type),a.accessList!=null&&(s.accessList=nc(a.accessList)),s.gasLimit==null&&e.gas!=null){let h=21e3,g=ke(o);for(let b=0;b<g.length;b++)h+=4,g[b]&&(h+=64);s.gasLimit=Ue.from(e.gas).add(h)}if(a.value){let h=Ue.from(a.value);!h.isZero()&&!e.payable&&zi.throwError("non-payable method cannot override value",fe.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:i.value}),s.value=h}a.customData&&(s.customData=di(a.customData)),a.ccipReadEnabled&&(s.ccipReadEnabled=!!a.ccipReadEnabled),delete i.nonce,delete i.gasLimit,delete i.gasPrice,delete i.from,delete i.value,delete i.type,delete i.accessList,delete i.maxFeePerGas,delete i.maxPriorityFeePerGas,delete i.customData,delete i.ccipReadEnabled;let c=Object.keys(i).filter(h=>i[h]!=null);return c.length&&zi.throwError(`cannot override ${c.map(h=>JSON.stringify(h)).join(",")}`,fe.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:c}),s})}function tWe(t,e){return function(...r){return T_(t,e,r)}}function rWe(t,e){let r=t.signer||t.provider;return function(...i){return op(this,void 0,void 0,function*(){r||zi.throwError("estimate require a provider or signer",fe.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});let n=yield T_(t,e,i);return yield r.estimateGas(n)})}}function Sfe(t,e){let r=e.wait.bind(e);e.wait=i=>r(i).then(n=>(n.events=n.logs.map(o=>{let s=wn(o),a=null;try{a=t.interface.parseLog(o)}catch{}return a&&(s.args=a.args,s.decode=(c,h)=>t.interface.decodeEventLog(a.eventFragment,c,h),s.event=a.name,s.eventSignature=a.signature),s.removeListener=()=>t.provider,s.getBlock=()=>t.provider.getBlock(n.blockHash),s.getTransaction=()=>t.provider.getTransaction(n.transactionHash),s.getTransactionReceipt=()=>Promise.resolve(n),s}),n))}function Ife(t,e,r){let i=t.signer||t.provider;return function(...n){return op(this,void 0,void 0,function*(){let o;if(n.length===e.inputs.length+1&&typeof n[n.length-1]=="object"){let c=di(n.pop());c.blockTag!=null&&(o=yield c.blockTag),delete c.blockTag,n.push(c)}t.deployTransaction!=null&&(yield t._deployed(o));let s=yield T_(t,e,n),a=yield i.call(s,o);try{let c=t.interface.decodeFunctionResult(e,a);return r&&e.outputs.length===1&&(c=c[0]),c}catch(c){throw c.code===fe.errors.CALL_EXCEPTION&&(c.address=t.address,c.args=n,c.transaction=s),c}})}}function iWe(t,e){return function(...r){return op(this,void 0,void 0,function*(){t.signer||zi.throwError("sending a transaction requires a signer",fe.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());let i=yield T_(t,e,r),n=yield t.signer.sendTransaction(i);return Sfe(t,n),n})}}function Cfe(t,e,r){return e.constant?Ife(t,e,r):iWe(t,e)}function Tfe(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}var Pm=class{constructor(e,r){ye(this,"tag",e),ye(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(i=>r||i.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){let r=this.listenerCount();return this._listeners=this._listeners.filter(i=>{let n=e.slice();return setTimeout(()=>{i.listener.apply(this,n)},0),!i.once}),r}prepareEvent(e){}getEmit(e){return[e]}},YM=class extends Pm{constructor(){super("error",null)}},S_=class extends Pm{constructor(e,r,i,n){let o={address:e},s=r.getEventTopic(i);n?(s!==n[0]&&zi.throwArgumentError("topic mismatch","topics",n),o.topics=n.slice()):o.topics=[s],super(Tfe(o),o),ye(this,"address",e),ye(this,"interface",r),ye(this,"fragment",i)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,i)=>this.interface.decodeEventLog(this.fragment,r,i);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){let r=Mw(e.args);if(r.length)throw r[0].error;let i=(e.args||[]).slice();return i.push(e),i}},I_=class extends Pm{constructor(e,r){super("*",{address:e}),ye(this,"address",e),ye(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{let r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(i,n)=>this.interface.decodeEventLog(r.eventFragment,i,n),e.args=r.args}catch{}}},Qw=class{constructor(e,r,i){ye(this,"interface",vn(new.target,"getInterface")(r)),i==null?(ye(this,"provider",null),ye(this,"signer",null)):ec.isSigner(i)?(ye(this,"provider",i.provider||null),ye(this,"signer",i)):Jc.isProvider(i)?(ye(this,"provider",i),ye(this,"signer",null)):zi.throwArgumentError("invalid signer or provider","signerOrProvider",i),ye(this,"callStatic",{}),ye(this,"estimateGas",{}),ye(this,"functions",{}),ye(this,"populateTransaction",{}),ye(this,"filters",{});{let s={};Object.keys(this.interface.events).forEach(a=>{let c=this.interface.events[a];ye(this.filters,a,(...h)=>({address:this.address,topics:this.interface.encodeFilterTopics(c,h)})),s[c.name]||(s[c.name]=[]),s[c.name].push(a)}),Object.keys(s).forEach(a=>{let c=s[a];c.length===1?ye(this.filters,a,this.filters[c[0]]):zi.warn(`Duplicate definition of ${a} (${c.join(", ")})`)})}if(ye(this,"_runningEvents",{}),ye(this,"_wrappedEmits",{}),e==null&&zi.throwArgumentError("invalid contract address or ENS name","addressOrName",e),ye(this,"address",e),this.provider)ye(this,"resolvedAddress",C_(this.provider,e));else try{ye(this,"resolvedAddress",Promise.resolve($r(e)))}catch{zi.throwError("provider is required to use ENS name as contract address",fe.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(s=>{});let n={},o={};Object.keys(this.interface.functions).forEach(s=>{let a=this.interface.functions[s];if(o[s]){zi.warn(`Duplicate ABI entry for ${JSON.stringify(s)}`);return}o[s]=!0;{let c=a.name;n[`%${c}`]||(n[`%${c}`]=[]),n[`%${c}`].push(s)}this[s]==null&&ye(this,s,Cfe(this,a,!0)),this.functions[s]==null&&ye(this.functions,s,Cfe(this,a,!1)),this.callStatic[s]==null&&ye(this.callStatic,s,Ife(this,a,!0)),this.populateTransaction[s]==null&&ye(this.populateTransaction,s,tWe(this,a)),this.estimateGas[s]==null&&ye(this.estimateGas,s,rWe(this,a))}),Object.keys(n).forEach(s=>{let a=n[s];if(a.length>1)return;s=s.substring(1);let c=a[0];try{this[s]==null&&ye(this,s,this[c])}catch{}this.functions[s]==null&&ye(this.functions,s,this.functions[c]),this.callStatic[s]==null&&ye(this.callStatic,s,this.callStatic[c]),this.populateTransaction[s]==null&&ye(this.populateTransaction,s,this.populateTransaction[c]),this.estimateGas[s]==null&&ye(this.estimateGas,s,this.estimateGas[c])})}static getContractAddress(e){return Sm(e)}static getInterface(e){return tp.isInterface(e)?e:new tp(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&&zi.throwError("contract not deployed",fe.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||zi.throwError("sending a transactions require a signer",fe.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});let r=di(e||{});return["from","to"].forEach(function(i){r[i]!=null&&zi.throwError("cannot override "+i,fe.errors.UNSUPPORTED_OPERATION,{operation:i})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Tm(e,this.provider));let r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&ye(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return nh.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new YM);if(e==="event")return this._normalizeRunningEvent(new Pm("event",null));if(e==="*")return this._normalizeRunningEvent(new I_(this.address,this.interface));let r=this.interface.getEvent(e);return this._normalizeRunningEvent(new S_(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{let i=e.topics[0];if(typeof i!="string")throw new Error("invalid topic");let n=this.interface.getEvent(i);return this._normalizeRunningEvent(new S_(this.address,this.interface,n,e.topics))}catch{}let r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new Pm(Tfe(r),r))}return this._normalizeRunningEvent(new I_(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];let r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,i){let n=wn(r);return n.removeListener=()=>{i&&(e.removeListener(i),this._checkRunningEvents(e))},n.getBlock=()=>this.provider.getBlock(r.blockHash),n.getTransaction=()=>this.provider.getTransaction(r.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(n),n}_addEventListener(e,r,i){if(this.provider||zi.throwError("events require a provider or a signer with a provider",fe.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,i),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){let n=o=>{let s=this._wrapEvent(e,o,r);if(s.decodeError==null)try{let a=e.getEmit(s);this.emit(e.filter,...a)}catch(a){s.decodeError=a.error}e.filter!=null&&this.emit("event",s),s.decodeError!=null&&this.emit("error",s.decodeError,s)};this._wrappedEmits[e.tag]=n,e.filter!=null&&this.provider.on(e.filter,n)}}queryFilter(e,r,i){let n=this._getRunningEvent(e),o=di(n.filter);return typeof r=="string"&&Zt(r,32)?(i!=null&&zi.throwArgumentError("cannot specify toBlock with blockhash","toBlock",i),o.blockHash=r):(o.fromBlock=r??0,o.toBlock=i??"latest"),this.provider.getLogs(o).then(s=>s.map(a=>this._wrapEvent(n,a,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;let i=this._getRunningEvent(e),n=i.run(r)>0;return this._checkRunningEvents(i),n}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,i)=>r+this._runningEvents[i].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){let r=[];for(let i in this._runningEvents)this._runningEvents[i].listeners().forEach(n=>{r.push(n)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(let i in this._runningEvents){let n=this._runningEvents[i];n.removeAllListeners(),this._checkRunningEvents(n)}return this}let r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;let i=this._getRunningEvent(e);return i.removeListener(r),this._checkRunningEvents(i),this}removeListener(e,r){return this.off(e,r)}},Om=class extends Qw{},c5=class{constructor(e,r,i){let n=null;typeof r=="string"?n=r:Kc(r)?n=De(r):r&&typeof r.object=="string"?n=r.object:n="!",n.substring(0,2)!=="0x"&&(n="0x"+n),(!Zt(n)||n.length%2)&&zi.throwArgumentError("invalid bytecode","bytecode",r),i&&!ec.isSigner(i)&&zi.throwArgumentError("invalid signer","signer",i),ye(this,"bytecode",n),ye(this,"interface",vn(new.target,"getInterface")(e)),ye(this,"signer",i||null)}getDeployTransaction(...e){let r={};if(e.length===this.interface.deploy.inputs.length+1&&typeof e[e.length-1]=="object"){r=di(e.pop());for(let i in r)if(!eWe[i])throw new Error("unknown transaction override "+i)}return["data","from","to"].forEach(i=>{r[i]!=null&&zi.throwError("cannot override "+i,fe.errors.UNSUPPORTED_OPERATION,{operation:i})}),r.value&&!Ue.from(r.value).isZero()&&!this.interface.deploy.payable&&zi.throwError("non-payable constructor cannot override value",fe.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:r.value}),zi.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor"),r.data=De(Fr([this.bytecode,this.interface.encodeDeploy(e)])),r}deploy(...e){return op(this,void 0,void 0,function*(){let r={};e.length===this.interface.deploy.inputs.length+1&&(r=e.pop()),zi.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor");let i=yield a5(this.signer,e,this.interface.deploy.inputs);i.push(r);let n=this.getDeployTransaction(...i),o=yield this.signer.sendTransaction(n),s=vn(this.constructor,"getContractAddress")(o),a=vn(this.constructor,"getContract")(s,this.interface,this.signer);return Sfe(a,o),ye(a,"deployTransaction",o),a})}attach(e){return this.constructor.getContract(e,this.interface,this.signer)}connect(e){return new this.constructor(this.interface,this.bytecode,e)}static fromSolidity(e,r){e==null&&zi.throwError("missing compiler output",fe.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),typeof e=="string"&&(e=JSON.parse(e));let i=e.abi,n=null;return e.bytecode?n=e.bytecode:e.evm&&e.evm.bytecode&&(n=e.evm.bytecode),new this(i,n,r)}static getInterface(e){return Om.getInterface(e)}static getContractAddress(e){return Sm(e)}static getContract(e,r,i){return new Om(e,r,i)}};var R_=class{constructor(e){ye(this,"alphabet",e),ye(this,"base",e.length),ye(this,"_alphabetMap",{}),ye(this,"_leader",e.charAt(0));for(let r=0;r<e.length;r++)this._alphabetMap[e.charAt(r)]=r}encode(e){let r=ke(e);if(r.length===0)return"";let i=[0];for(let o=0;o<r.length;++o){let s=r[o];for(let a=0;a<i.length;++a)s+=i[a]<<8,i[a]=s%this.base,s=s/this.base|0;for(;s>0;)i.push(s%this.base),s=s/this.base|0}let n="";for(let o=0;r[o]===0&&o<r.length-1;++o)n+=this._leader;for(let o=i.length-1;o>=0;--o)n+=this.alphabet[i[o]];return n}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let i=0;i<e.length;i++){let n=this._alphabetMap[e[i]];if(n===void 0)throw new Error("Non-base"+this.base+" character");let o=n;for(let s=0;s<r.length;++s)o+=r[s]*this.base,r[s]=o&255,o>>=8;for(;o>0;)r.push(o&255),o>>=8}for(let i=0;e[i]===this._leader&&i<e.length-1;++i)r.push(0);return ke(new Uint8Array(r.reverse()))}},nqt=new R_("abcdefghijklmnopqrstuvwxyz234567"),ch=new R_("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Xw=Wt(FM());var Cf;(function(t){t.sha256="sha256",t.sha512="sha512"})(Cf||(Cf={}));var Rfe="sha2/5.7.0";var nWe=new fe(Rfe);function l5(t){return"0x"+Xw.default.ripemd160().update(ke(t)).digest("hex")}function ha(t){return"0x"+Xw.default.sha256().update(ke(t)).digest("hex")}function JM(t){return"0x"+Xw.default.sha512().update(ke(t)).digest("hex")}function lh(t,e,r){return Cf[t]||nWe.throwError("unsupported algorithm "+t,fe.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+Xw.default.hmac(Xw.default[t],ke(e)).update(ke(r)).digest("hex")}function Mm(t,e,r,i,n){t=ke(t),e=ke(e);let o,s=1,a=new Uint8Array(i),c=new Uint8Array(e.length+4);c.set(e);let h,g;for(let b=1;b<=s;b++){c[e.length]=b>>24&255,c[e.length+1]=b>>16&255,c[e.length+2]=b>>8&255,c[e.length+3]=b&255;let E=ke(lh(n,t,c));o||(o=E.length,g=new Uint8Array(o),s=Math.ceil(i/o),h=i-(s-1)*o),g.set(E);for(let P=1;P<r;P++){E=ke(lh(n,t,E));for(let L=0;L<o;L++)g[L]^=E[L]}let A=(b-1)*o,T=b===s?h:o;a.set(ke(g).slice(0,T),A)}return De(a)}var kfe="wordlists/5.7.0";var oWe=!1,Nfe=new fe(kfe),Sf=class t{constructor(e){Nfe.checkAbstract(new.target,t),ye(this,"locale",e)}split(e){return e.toLowerCase().split(/ +/g)}join(e){return e.join(" ")}static check(e){let r=[];for(let i=0;i<2048;i++){let n=e.getWord(i);if(i!==e.getWordIndex(n))return"0x";r.push(n)}return Xa(r.join(`
9977
9977
  `)+`
9978
- `)}static register(e,r){if(r||(r=e.locale),oWe)try{let i=window;i._ethers&&i._ethers.wordlists&&(i._ethers.wordlists[r]||ye(i._ethers.wordlists,r,e))}catch{}}};var sWe="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo",u5=null;function Pfe(t){if(u5==null&&(u5=sWe.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Sf.check(t)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw u5=null,new Error("BIP39 Wordlist for en (English) FAILED")}var QM=class extends Sf{constructor(){super("en")}getWord(e){return Pfe(this),u5[e]}getWordIndex(e){return Pfe(this),u5.indexOf(e)}},XM=new QM;Sf.register(XM);var Dm={en:XM};var Ofe="hdnode/5.7.0";var f5=new fe(Ofe),aWe=Ue.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),cWe=ui("Bitcoin seed"),t3=2147483648;function Dfe(t){return(1<<t)-1<<8-t}function lWe(t){return(1<<t)-1}function k_(t){return Kr(De(t),32)}function Mfe(t){return ch.encode(Fr([t,Fi(ha(ha(t)),0,4)]))}function eD(t){if(t==null)return Dm.en;if(typeof t=="string"){let e=Dm[t];return e==null&&f5.throwArgumentError("unknown locale","wordlist",t),e}return t}var e3={},uh="m/44'/60'/0'/0/0",If=class t{constructor(e,r,i,n,o,s,a,c){if(e!==e3)throw new Error("HDNode constructor cannot be called directly");if(r){let h=new rl(r);ye(this,"privateKey",h.privateKey),ye(this,"publicKey",h.compressedPublicKey)}else ye(this,"privateKey",null),ye(this,"publicKey",De(i));ye(this,"parentFingerprint",n),ye(this,"fingerprint",Fi(l5(ha(this.publicKey)),0,4)),ye(this,"address",il(this.publicKey)),ye(this,"chainCode",o),ye(this,"index",s),ye(this,"depth",a),c==null?(ye(this,"mnemonic",null),ye(this,"path",null)):typeof c=="string"?(ye(this,"mnemonic",null),ye(this,"path",c)):(ye(this,"mnemonic",c),ye(this,"path",c.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return Mfe(Fr([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",De(this.depth),this.parentFingerprint,Kr(De(this.index),4),this.chainCode,this.privateKey!=null?Fr(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new t(e3,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let r=this.path;r&&(r+="/"+(e&~t3));let i=new Uint8Array(37);if(e&t3){if(!this.privateKey)throw new Error("cannot derive child of neutered node");i.set(ke(this.privateKey),1),r&&(r+="'")}else i.set(ke(this.publicKey));for(let b=24;b>=0;b-=8)i[33+(b>>3)]=e>>24-b&255;let n=ke(lh(Cf.sha512,this.chainCode,i)),o=n.slice(0,32),s=n.slice(32),a=null,c=null;this.privateKey?a=k_(Ue.from(o).add(this.privateKey).mod(aWe)):c=new rl(De(o))._addPoint(this.publicKey);let h=r,g=this.mnemonic;return g&&(h=Object.freeze({phrase:g.phrase,path:r,locale:g.locale||"en"})),new t(e3,a,c,this.fingerprint,k_(s),e,this.depth+1,h)}derivePath(e){let r=e.split("/");if(r.length===0||r[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+e);r[0]==="m"&&r.shift();let i=this;for(let n=0;n<r.length;n++){let o=r[n];if(o.match(/^[0-9]+'$/)){let s=parseInt(o.substring(0,o.length-1));if(s>=t3)throw new Error("invalid path index - "+o);i=i._derive(t3+s)}else if(o.match(/^[0-9]+$/)){let s=parseInt(o);if(s>=t3)throw new Error("invalid path index - "+o);i=i._derive(s)}else throw new Error("invalid path component - "+o)}return i}static _fromSeed(e,r){let i=ke(e);if(i.length<16||i.length>64)throw new Error("invalid seed");let n=ke(lh(Cf.sha512,cWe,i));return new t(e3,k_(n.slice(0,32)),null,"0x00000000",k_(n.slice(32)),0,0,r)}static fromMnemonic(e,r,i){return i=eD(i),e=Lm(r3(e,i),i),t._fromSeed(tD(e,r),{phrase:e,path:"m",locale:i.locale})}static fromSeed(e){return t._fromSeed(e,null)}static fromExtendedKey(e){let r=ch.decode(e);(r.length!==82||Mfe(r.slice(0,78))!==e)&&f5.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");let i=r[4],n=De(r.slice(5,9)),o=parseInt(De(r.slice(9,13)).substring(2),16),s=De(r.slice(13,45)),a=r.slice(45,78);switch(De(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new t(e3,null,De(a),n,s,o,i,null);case"0x0488ade4":case"0x04358394 ":if(a[0]!==0)break;return new t(e3,De(a.slice(1)),null,n,s,o,i,null)}return f5.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}};function tD(t,e){e||(e="");let r=ui("mnemonic"+e,$s.NFKD);return Mm(ui(t,$s.NFKD),r,2048,64,"sha512")}function r3(t,e){e=eD(e),f5.checkNormalize();let r=e.split(t);if(r.length%3!==0)throw new Error("invalid mnemonic");let i=ke(new Uint8Array(Math.ceil(11*r.length/8))),n=0;for(let h=0;h<r.length;h++){let g=e.getWordIndex(r[h].normalize("NFKD"));if(g===-1)throw new Error("invalid mnemonic");for(let b=0;b<11;b++)g&1<<10-b&&(i[n>>3]|=1<<7-n%8),n++}let o=32*r.length/3,s=r.length/3,a=Dfe(s);if((ke(ha(i.slice(0,o/8)))[0]&a)!==(i[i.length-1]&a))throw new Error("invalid checksum");return De(i.slice(0,o/8))}function Lm(t,e){if(e=eD(e),t=ke(t),t.length%4!==0||t.length<16||t.length>32)throw new Error("invalid entropy");let r=[0],i=11;for(let s=0;s<t.length;s++)i>8?(r[r.length-1]<<=8,r[r.length-1]|=t[s],i-=8):(r[r.length-1]<<=i,r[r.length-1]|=t[s]>>8-i,r.push(t[s]&lWe(8-i)),i+=3);let n=t.length/4,o=ke(ha(t))[0]&Dfe(n);return r[r.length-1]<<=n,r[r.length-1]|=o>>8-n,e.join(r.map(s=>e.getWord(s)))}function Lfe(t,e){try{return r3(t,e),!0}catch{}return!1}function Bfe(t){return(typeof t!="number"||t<0||t>=t3||t%1)&&f5.throwArgumentError("invalid account index","index",t),`m/44'/60'/${t}'/0/0`}var Ufe="random/5.7.0";var rD=new fe(Ufe);function uWe(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}var Ffe=uWe(),N_=Ffe.crypto||Ffe.msCrypto;(!N_||!N_.getRandomValues)&&(rD.warn("WARNING: Missing strong random number source"),N_={getRandomValues:function(t){return rD.throwError("no secure random source avaialble",fe.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function Tf(t){(t<=0||t>1024||t%1||t!=t)&&rD.throwArgumentError("invalid length","length",t);let e=new Uint8Array(t);return N_.getRandomValues(e),ke(e)}function h5(t){t=t.slice();for(let e=t.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1)),i=t[e];t[e]=t[r],t[r]=i}return t}var oD=Wt(nD());var P_="json-wallets/5.7.0";function fh(t){return typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),ke(t)}function i3(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function d5(t){return typeof t=="string"?ui(t,$s.NFKC):ke(t)}function xn(t,e){let r=t,i=e.toLowerCase().split("/");for(let n=0;n<i.length;n++){let o=null;for(let s in r)if(s.toLowerCase()===i[n]){o=r[s];break}if(o===null)return null;r=o}return r}function $fe(t){let e=ke(t);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let r=De(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}var fWe=new fe(P_),sD=class extends Qa{isCrowdsaleAccount(e){return!!(e&&e._isCrowdsaleAccount)}};function aD(t,e){let r=JSON.parse(t);e=d5(e);let i=$r(xn(r,"ethaddr")),n=fh(xn(r,"encseed"));(!n||n.length%16!==0)&&fWe.throwArgumentError("invalid encseed","json",t);let o=ke(Mm(e,e,2e3,32,"sha256")).slice(0,16),s=n.slice(0,16),a=n.slice(16),c=new oD.default.ModeOfOperation.cbc(o,s),h=oD.default.padding.pkcs7.strip(ke(c.decrypt(a))),g="";for(let A=0;A<h.length;A++)g+=String.fromCharCode(h[A]);let b=ui(g),E=jr(b);return new sD({_isCrowdsaleAccount:!0,address:i,privateKey:E})}function O_(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return e.encseed&&e.ethaddr}function M_(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return!(!e.version||parseInt(e.version)!==e.version||parseInt(e.version)!==3)}function cD(t){if(O_(t))try{return $r(JSON.parse(t).ethaddr)}catch{return null}if(M_(t))try{return $r(JSON.parse(t).address)}catch{return null}return null}var hh=Wt(nD()),D_=Wt(Hfe());var hWe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},uD=new fe(P_);function zfe(t){return t!=null&&t.mnemonic&&t.mnemonic.phrase}var fD=class extends Qa{isKeystoreAccount(e){return!!(e&&e._isKeystoreAccount)}};function dWe(t,e,r){if(xn(t,"crypto/cipher")==="aes-128-ctr"){let n=fh(xn(t,"crypto/cipherparams/iv")),o=new hh.default.Counter(n),s=new hh.default.ModeOfOperation.ctr(e,o);return ke(s.decrypt(r))}return null}function qfe(t,e){let r=fh(xn(t,"crypto/ciphertext"));if(De(jr(Fr([e.slice(16,32),r]))).substring(2)!==xn(t,"crypto/mac").toLowerCase())throw new Error("invalid password");let n=dWe(t,e.slice(0,16),r);n||uD.throwError("unsupported cipher",fe.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});let o=e.slice(32,64),s=il(n);if(t.address){let c=t.address.toLowerCase();if(c.substring(0,2)!=="0x"&&(c="0x"+c),$r(c)!==s)throw new Error("address mismatch")}let a={_isKeystoreAccount:!0,address:s,privateKey:De(n)};if(xn(t,"x-ethers/version")==="0.1"){let c=fh(xn(t,"x-ethers/mnemonicCiphertext")),h=fh(xn(t,"x-ethers/mnemonicCounter")),g=new hh.default.Counter(h),b=new hh.default.ModeOfOperation.ctr(o,g),E=xn(t,"x-ethers/path")||uh,A=xn(t,"x-ethers/locale")||"en",T=ke(b.decrypt(c));try{let P=Lm(T,A),L=If.fromMnemonic(P,null,A).derivePath(E);if(L.privateKey!=a.privateKey)throw new Error("mnemonic mismatch");a.mnemonic=L.mnemonic}catch(P){if(P.code!==fe.errors.INVALID_ARGUMENT||P.argument!=="wordlist")throw P}}return new fD(a)}function Vfe(t,e,r,i,n){return ke(Mm(t,e,r,i,n))}function pWe(t,e,r,i,n){return Promise.resolve(Vfe(t,e,r,i,n))}function Kfe(t,e,r,i,n){let o=d5(e),s=xn(t,"crypto/kdf");if(s&&typeof s=="string"){let a=function(c,h){return uD.throwArgumentError("invalid key-derivation function parameters",c,h)};if(s.toLowerCase()==="scrypt"){let c=fh(xn(t,"crypto/kdfparams/salt")),h=parseInt(xn(t,"crypto/kdfparams/n")),g=parseInt(xn(t,"crypto/kdfparams/r")),b=parseInt(xn(t,"crypto/kdfparams/p"));(!h||!g||!b)&&a("kdf",s),(h&h-1)!==0&&a("N",h);let E=parseInt(xn(t,"crypto/kdfparams/dklen"));return E!==32&&a("dklen",E),i(o,c,h,g,b,64,n)}else if(s.toLowerCase()==="pbkdf2"){let c=fh(xn(t,"crypto/kdfparams/salt")),h=null,g=xn(t,"crypto/kdfparams/prf");g==="hmac-sha256"?h="sha256":g==="hmac-sha512"?h="sha512":a("prf",g);let b=parseInt(xn(t,"crypto/kdfparams/c")),E=parseInt(xn(t,"crypto/kdfparams/dklen"));return E!==32&&a("dklen",E),r(o,c,b,E,h)}}return uD.throwArgumentError("unsupported key-derivation function","kdf",s)}function Gfe(t,e){let r=JSON.parse(t),i=Kfe(r,e,Vfe,D_.default.syncScrypt);return qfe(r,i)}function Zfe(t,e,r){return hWe(this,void 0,void 0,function*(){let i=JSON.parse(t),n=yield Kfe(i,e,pWe,D_.default.scrypt,r);return qfe(i,n)})}function hD(t,e,r,i){try{if($r(t.address)!==il(t.privateKey))throw new Error("address/privateKey mismatch");if(zfe(t)){let L=t.mnemonic;if(If.fromMnemonic(L.phrase,null,L.locale).derivePath(L.path||uh).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(L){return Promise.reject(L)}typeof r=="function"&&!i&&(i=r,r={}),r||(r={});let n=ke(t.privateKey),o=d5(e),s=null,a=null,c=null;if(zfe(t)){let L=t.mnemonic;s=ke(r3(L.phrase,L.locale||"en")),a=L.path||uh,c=L.locale||"en"}let h=r.client;h||(h="ethers.js");let g=null;r.salt?g=ke(r.salt):g=Tf(32);let b=null;if(r.iv){if(b=ke(r.iv),b.length!==16)throw new Error("invalid iv")}else b=Tf(16);let E=null;if(r.uuid){if(E=ke(r.uuid),E.length!==16)throw new Error("invalid uuid")}else E=Tf(16);let A=1<<17,T=8,P=1;return r.scrypt&&(r.scrypt.N&&(A=r.scrypt.N),r.scrypt.r&&(T=r.scrypt.r),r.scrypt.p&&(P=r.scrypt.p)),D_.default.scrypt(o,g,A,T,P,64,i).then(L=>{L=ke(L);let j=L.slice(0,16),$=L.slice(16,32),G=L.slice(32,64),Z=new hh.default.Counter(b),te=new hh.default.ModeOfOperation.ctr(j,Z),se=ke(te.encrypt(n)),X=jr(Fr([$,se])),k={address:t.address.substring(2).toLowerCase(),id:$fe(E),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:De(b).substring(2)},ciphertext:De(se).substring(2),kdf:"scrypt",kdfparams:{salt:De(g).substring(2),n:A,dklen:32,p:P,r:T},mac:X.substring(2)}};if(s){let F=Tf(16),V=new hh.default.Counter(F),M=new hh.default.ModeOfOperation.ctr(G,V),B=ke(M.encrypt(s)),u=new Date,f=u.getUTCFullYear()+"-"+i3(u.getUTCMonth()+1,2)+"-"+i3(u.getUTCDate(),2)+"T"+i3(u.getUTCHours(),2)+"-"+i3(u.getUTCMinutes(),2)+"-"+i3(u.getUTCSeconds(),2)+".0Z";k["x-ethers"]={client:h,gethFilename:"UTC--"+f+"--"+k.address,mnemonicCounter:De(F).substring(2),mnemonicCiphertext:De(B).substring(2),path:a,locale:c,version:"0.1"}}return JSON.stringify(k)})}function Yfe(t,e,r){if(O_(t)){r&&r(0);let i=aD(t,e);return r&&r(1),Promise.resolve(i)}return M_(t)?Zfe(t,e,r):Promise.reject(new Error("invalid JSON wallet"))}function Jfe(t,e){if(O_(t))return aD(t,e);if(M_(t))return Gfe(t,e);throw new Error("invalid JSON wallet")}var Qfe="wallet/5.7.0";var Xfe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},n3=new fe(Qfe);function mWe(t){return t!=null&&Zt(t.privateKey,32)&&t.address!=null}function gWe(t){let e=t.mnemonic;return e&&e.phrase}var p5=class t extends ec{constructor(e,r){if(super(),mWe(e)){let i=new rl(e.privateKey);if(ye(this,"_signingKey",()=>i),ye(this,"address",il(this.publicKey)),this.address!==$r(e.address)&&n3.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),gWe(e)){let n=e.mnemonic;ye(this,"_mnemonic",()=>({phrase:n.phrase,path:n.path||uh,locale:n.locale||"en"}));let o=this.mnemonic,s=If.fromMnemonic(o.phrase,null,o.locale).derivePath(o.path);il(s.privateKey)!==this.address&&n3.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else ye(this,"_mnemonic",()=>null)}else{if(rl.isSigningKey(e))e.curve!=="secp256k1"&&n3.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),ye(this,"_signingKey",()=>e);else{typeof e=="string"&&e.match(/^[0-9a-f]*$/i)&&e.length===64&&(e="0x"+e);let i=new rl(e);ye(this,"_signingKey",()=>i)}ye(this,"_mnemonic",()=>null),ye(this,"address",il(this.publicKey))}r&&!Jc.isProvider(r)&&n3.throwArgumentError("invalid provider","provider",r),ye(this,"provider",r||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new t(this,e)}signTransaction(e){return ji(e).then(r=>{r.from!=null&&($r(r.from)!==this.address&&n3.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete r.from);let i=this._signingKey().signDigest(jr(s5(r)));return s5(r,i)})}signMessage(e){return Xfe(this,void 0,void 0,function*(){return zy(this._signingKey().signDigest($w(e)))})}_signTypedData(e,r,i){return Xfe(this,void 0,void 0,function*(){let n=yield Yc.resolveNames(e,r,i,o=>(this.provider==null&&n3.throwError("cannot resolve ENS names without a provider",fe.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:o}),this.provider.resolveName(o)));return zy(this._signingKey().signDigest(Yc.hash(n.domain,r,n.value)))})}encrypt(e,r,i){if(typeof r=="function"&&!i&&(i=r,r={}),i&&typeof i!="function")throw new Error("invalid callback");return r||(r={}),hD(this,e,r,i)}static createRandom(e){let r=Tf(16);e||(e={}),e.extraEntropy&&(r=ke(Fi(jr(Fr([r,e.extraEntropy])),0,16)));let i=Lm(r,e.locale);return t.fromMnemonic(i,e.path,e.locale)}static fromEncryptedJson(e,r,i){return Yfe(e,r,i).then(n=>new t(n))}static fromEncryptedJsonSync(e,r){return new t(Jfe(e,r))}static fromMnemonic(e,r,i){return r||(r=uh),new t(If.fromMnemonic(e,null,i).derivePath(r))}};function e0e(t,e){return Nm($w(t),e)}function t0e(t,e,r,i){return Nm(Yc.hash(t,e,r),i)}var Q_={};Oi(Q_,{AlchemyProvider:()=>u3,AlchemyWebSocketProvider:()=>C5,AnkrProvider:()=>S5,BaseProvider:()=>kf,CloudflareProvider:()=>I5,EtherscanProvider:()=>T5,FallbackProvider:()=>k5,Formatter:()=>Bm,InfuraProvider:()=>h3,InfuraWebSocketProvider:()=>P5,IpcProvider:()=>CD,JsonRpcBatchProvider:()=>Y_,JsonRpcProvider:()=>da,JsonRpcSigner:()=>c3,NodesmithProvider:()=>O5,PocketProvider:()=>M5,Provider:()=>Jc,Resolver:()=>a3,StaticJsonRpcProvider:()=>A5,UrlJsonRpcProvider:()=>ws,Web3Provider:()=>D5,WebSocketProvider:()=>mh,getDefaultProvider:()=>J_,getNetwork:()=>m5,isCommunityResourcable:()=>mD,isCommunityResource:()=>v5,showThrottleMessage:()=>Rf});var r0e="networks/5.7.1";var i0e=new fe(r0e);function wWe(t){return t&&typeof t.renetwork=="function"}function dh(t){let e=function(r,i){i==null&&(i={});let n=[];if(r.InfuraProvider&&i.infura!=="-")try{n.push(new r.InfuraProvider(t,i.infura))}catch{}if(r.EtherscanProvider&&i.etherscan!=="-")try{n.push(new r.EtherscanProvider(t,i.etherscan))}catch{}if(r.AlchemyProvider&&i.alchemy!=="-")try{n.push(new r.AlchemyProvider(t,i.alchemy))}catch{}if(r.PocketProvider&&i.pocket!=="-"){let o=["goerli","ropsten","rinkeby","sepolia"];try{let s=new r.PocketProvider(t,i.pocket);s.network&&o.indexOf(s.network.name)===-1&&n.push(s)}catch{}}if(r.CloudflareProvider&&i.cloudflare!=="-")try{n.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&i.ankr!=="-")try{let o=["ropsten"],s=new r.AnkrProvider(t,i.ankr);s.network&&o.indexOf(s.network.name)===-1&&n.push(s)}catch{}if(n.length===0)return null;if(r.FallbackProvider){let o=1;return i.quorum!=null?o=i.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(n,o)}return n[0]};return e.renetwork=function(r){return dh(r)},e}function B_(t,e){let r=function(i,n){return i.JsonRpcProvider?new i.JsonRpcProvider(t,e):null};return r.renetwork=function(i){return B_(t,i)},r}var n0e={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:dh("homestead")},o0e={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:dh("ropsten")},s0e={chainId:63,name:"classicMordor",_defaultProvider:B_("https://www.ethercluster.com/mordor","classicMordor")},L_={unspecified:{chainId:0,name:"unspecified"},homestead:n0e,mainnet:n0e,morden:{chainId:2,name:"morden"},ropsten:o0e,testnet:o0e,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:dh("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:dh("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:dh("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:dh("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:B_("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:s0e,classicTestnet:s0e,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:B_("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:dh("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:dh("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function m5(t){if(t==null)return null;if(typeof t=="number"){for(let i in L_){let n=L_[i];if(n.chainId===t)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){let i=L_[t];return i==null?null:{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress,_defaultProvider:i._defaultProvider||null}}let e=L_[t.name];if(!e)return typeof t.chainId!="number"&&i0e.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&i0e.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(wWe(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}var a0e="web/5.7.1";var vWe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})};function c0e(t,e){return vWe(this,void 0,void 0,function*(){e==null&&(e={});let r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){let s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}let i=yield fetch(t,r),n=yield i.arrayBuffer(),o={};return i.headers.forEach?i.headers.forEach((s,a)=>{o[a.toLowerCase()]=s}):i.headers.keys().forEach(s=>{o[s.toLowerCase()]=i.headers.get(s)}),{headers:o,statusCode:i.status,statusMessage:i.statusText,body:ke(new Uint8Array(n))}})}var bWe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Gl=new fe(a0e);function l0e(t){return new Promise(e=>{setTimeout(e,t)})}function sp(t,e){if(t==null)return null;if(typeof t=="string")return t;if(eh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return ua(t)}catch{}return De(t)}return t}function yWe(t){return ui(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function dD(t,e,r){let i=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Gl.assertArgument(i>0&&i%1===0,"invalid connection throttle limit","connection.throttleLimit",i);let n=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Gl.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);let s=typeof t=="object"?!!t.errorPassThrough:!1,a={},c=null,h={method:"GET"},g=!1,b=2*60*1e3;if(typeof t=="string")c=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Gl.throwArgumentError("missing URL","connection.url",t),c=t.url,typeof t.timeout=="number"&&t.timeout>0&&(b=t.timeout),t.headers)for(let j in t.headers)a[j.toLowerCase()]={key:j,value:String(t.headers[j])},["if-none-match","if-modified-since"].indexOf(j.toLowerCase())>=0&&(g=!0);if(h.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){c.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Gl.throwError("basic authentication requires a secure https url",fe.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:t.user,password:"[REDACTED]"});let j=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+jw(ui(j))}}t.skipFetchSetup!=null&&(h.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(h.fetchOptions=di(t.fetchOptions))}let E=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),A=c?c.match(E):null;if(A)try{let j={statusCode:200,statusMessage:"OK",headers:{"content-type":A[1]||"text/plain"},body:A[2]?Fw(A[3]):yWe(A[3])},$=j.body;return r&&($=r(j.body,j)),Promise.resolve($)}catch(j){Gl.throwError("processing response error",fe.errors.SERVER_ERROR,{body:sp(A[1],A[2]),error:j,requestBody:null,requestMethod:"GET",url:c})}e&&(h.method="POST",h.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));let T={};Object.keys(a).forEach(j=>{let $=a[j];T[$.key]=$.value}),h.headers=T;let P=function(){let j=null;return{promise:new Promise(function(Z,te){b&&(j=setTimeout(()=>{j!=null&&(j=null,te(Gl.makeError("timeout",fe.errors.TIMEOUT,{requestBody:sp(h.body,T["content-type"]),requestMethod:h.method,timeout:b,url:c})))},b))}),cancel:function(){j!=null&&(clearTimeout(j),j=null)}}}(),L=function(){return bWe(this,void 0,void 0,function*(){for(let j=0;j<i;j++){let $=null;try{if($=yield c0e(c,h),j<i){if($.statusCode===301||$.statusCode===302){let Z=$.headers.location||"";if(h.method==="GET"&&Z.match(/^https:/)){c=$.headers.location;continue}}else if($.statusCode===429){let Z=!0;if(n&&(Z=yield n(j,c)),Z){let te=0,se=$.headers["retry-after"];typeof se=="string"&&se.match(/^[1-9][0-9]*$/)?te=parseInt(se)*1e3:te=o*parseInt(String(Math.random()*Math.pow(2,j))),yield l0e(te);continue}}}}catch(Z){$=Z.response,$==null&&(P.cancel(),Gl.throwError("missing response",fe.errors.SERVER_ERROR,{requestBody:sp(h.body,T["content-type"]),requestMethod:h.method,serverError:Z,url:c}))}let G=$.body;if(g&&$.statusCode===304?G=null:!s&&($.statusCode<200||$.statusCode>=300)&&(P.cancel(),Gl.throwError("bad response",fe.errors.SERVER_ERROR,{status:$.statusCode,headers:$.headers,body:sp(G,$.headers?$.headers["content-type"]:null),requestBody:sp(h.body,T["content-type"]),requestMethod:h.method,url:c})),r)try{let Z=yield r(G,$);return P.cancel(),Z}catch(Z){if(Z.throttleRetry&&j<i){let te=!0;if(n&&(te=yield n(j,c)),te){let se=o*parseInt(String(Math.random()*Math.pow(2,j)));yield l0e(se);continue}}P.cancel(),Gl.throwError("processing response error",fe.errors.SERVER_ERROR,{body:sp(G,$.headers?$.headers["content-type"]:null),error:Z,requestBody:sp(h.body,T["content-type"]),requestMethod:h.method,url:c})}return P.cancel(),G}return Gl.throwError("failed response",fe.errors.SERVER_ERROR,{requestBody:sp(h.body,T["content-type"]),requestMethod:h.method,url:c})})}();return Promise.race([P.promise,L])}function Zl(t,e,r){let i=(o,s)=>{let a=null;if(o!=null)try{a=JSON.parse(ua(o))}catch(c){Gl.throwError("invalid JSON",fe.errors.SERVER_ERROR,{body:o,error:c})}return r&&(a=r(a,s)),a},n=null;if(e!=null){n=ui(e);let o=typeof t=="string"?{url:t}:di(t);o.headers?Object.keys(o.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(o.headers=di(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return dD(t,n,i)}function Yl(t,e){return e||(e={}),e=di(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,i){let n=null,o=!1,s=()=>o?!1:(o=!0,n&&clearTimeout(n),!0);e.timeout&&(n=setTimeout(()=>{s()&&i(new Error("timeout"))},e.timeout));let a=e.retryLimit,c=0;function h(){return t().then(function(g){if(g!==void 0)s()&&r(g);else if(e.oncePoll)e.oncePoll.once("poll",h);else if(e.onceBlock)e.onceBlock.once("block",h);else if(!o){if(c++,c>a){s()&&i(new Error("retry limit reached"));return}let b=e.interval*parseInt(String(Math.random()*Math.pow(2,c)));b<e.floor&&(b=e.floor),b>e.ceiling&&(b=e.ceiling),setTimeout(h,b)}return null},function(g){s()&&i(g)})}h()})}var bD=Wt(d0e());var Ci="providers/5.7.2";var w5=new fe(Ci),Bm=class t{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){let e={},r=this.address.bind(this),i=this.bigNumber.bind(this),n=this.blockTag.bind(this),o=this.data.bind(this),s=this.hash.bind(this),a=this.hex.bind(this),c=this.number.bind(this),h=this.type.bind(this),g=b=>this.data(b,!0);return e.transaction={hash:s,type:h,accessList:t.allowNull(this.accessList.bind(this),null),blockHash:t.allowNull(s,null),blockNumber:t.allowNull(c,null),transactionIndex:t.allowNull(c,null),confirmations:t.allowNull(c,null),from:r,gasPrice:t.allowNull(i),maxPriorityFeePerGas:t.allowNull(i),maxFeePerGas:t.allowNull(i),gasLimit:i,to:t.allowNull(r,null),value:i,nonce:c,data:o,r:t.allowNull(this.uint256),s:t.allowNull(this.uint256),v:t.allowNull(c),creates:t.allowNull(r,null),raw:t.allowNull(o)},e.transactionRequest={from:t.allowNull(r),nonce:t.allowNull(c),gasLimit:t.allowNull(i),gasPrice:t.allowNull(i),maxPriorityFeePerGas:t.allowNull(i),maxFeePerGas:t.allowNull(i),to:t.allowNull(r),value:t.allowNull(i),data:t.allowNull(g),type:t.allowNull(c),accessList:t.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:c,blockNumber:c,transactionHash:s,address:r,topics:t.arrayOf(s),data:o,logIndex:c,blockHash:s},e.receipt={to:t.allowNull(this.address,null),from:t.allowNull(this.address,null),contractAddress:t.allowNull(r,null),transactionIndex:c,root:t.allowNull(a),gasUsed:i,logsBloom:t.allowNull(o),blockHash:s,transactionHash:s,logs:t.arrayOf(this.receiptLog.bind(this)),blockNumber:c,confirmations:t.allowNull(c,null),cumulativeGasUsed:i,effectiveGasPrice:t.allowNull(i),status:t.allowNull(c),type:h},e.block={hash:t.allowNull(s),parentHash:s,number:c,timestamp:c,nonce:t.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:i,gasUsed:i,miner:t.allowNull(r),extraData:o,transactions:t.allowNull(t.arrayOf(s)),baseFeePerGas:t.allowNull(i)},e.blockWithTransactions=di(e.block),e.blockWithTransactions.transactions=t.allowNull(t.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:t.allowNull(n,void 0),toBlock:t.allowNull(n,void 0),blockHash:t.allowNull(s,void 0),address:t.allowNull(r,void 0),topics:t.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:t.allowNull(c),blockHash:t.allowNull(s),transactionIndex:c,removed:t.allowNull(this.boolean.bind(this)),address:r,data:t.allowFalsish(o,"0x"),topics:t.arrayOf(s),transactionHash:s,logIndex:c},e}accessList(e){return nc(e||[])}number(e){return e==="0x"?0:Ue.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ue.from(e).toNumber()}bigNumber(e){return Ue.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),Zt(e))?e.toLowerCase():w5.throwArgumentError("invalid hash","value",e)}data(e,r){let i=this.hex(e,r);if(i.length%2!==0)throw new Error("invalid data; odd-length - "+e);return i}address(e){return $r(e)}callAddress(e){if(!Zt(e,32))return null;let r=$r(Fi(e,12));return r===t_?null:r}contractAddress(e){return Sm(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||Zt(e))return uf(e);throw new Error("invalid blockTag")}hash(e,r){let i=this.hex(e,r);return hs(i)!==32?w5.throwArgumentError("invalid hash","value",e):i}difficulty(e){if(e==null)return null;let r=Ue.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!Zt(e))throw new Error("invalid uint256");return Kr(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);let i=e._difficulty!=null?e._difficulty:e.difficulty,n=t.check(r,e);return n._difficulty=i==null?null:Ue.from(i),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return t.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ue.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);let r=t.check(this.formats.transaction,e);if(e.chainId!=null){let i=e.chainId;Zt(i)&&(i=Ue.from(i).toNumber()),r.chainId=i}else{let i=e.networkId;i==null&&r.v==null&&(i=e.chainId),Zt(i)&&(i=Ue.from(i).toNumber()),typeof i!="number"&&r.v!=null&&(i=(r.v-35)/2,i<0&&(i=0),i=parseInt(i)),typeof i!="number"&&(i=0),r.chainId=i}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return A_(e)}receiptLog(e){return t.check(this.formats.receiptLog,e)}receipt(e){let r=t.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){let i=Ue.from(r.root).toNumber();i===0||i===1?(r.status!=null&&r.status!==i&&w5.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=i,delete r.root):w5.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&w5.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return t.check(this.formats.filter,e)}filterLog(e){return t.check(this.formats.filterLog,e)}static check(e,r){let i={};for(let n in e)try{let o=e[n](r[n]);o!==void 0&&(i[n]=o)}catch(o){throw o.checkKey=n,o.checkValue=r[n],o}return i}static allowNull(e,r){return function(i){return i==null?r:e(i)}}static allowFalsish(e,r){return function(i){return i?e(i):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");let i=[];return r.forEach(function(n){i.push(e(n))}),i}}};function mD(t){return t&&typeof t.isCommunityResource=="function"}function v5(t){return mD(t)&&t.isCommunityResource()}var p0e=!1;function Rf(){p0e||(p0e=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var Er=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Gr=new fe(Ci),TWe=10;function m0e(t){return t==null?"null":(hs(t)!==32&&Gr.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function g0e(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){let r={};e.forEach(n=>{r[m0e(n)]=!0});let i=Object.keys(r);return i.sort(),i.join("|")}else return m0e(e)}).join("&")}function RWe(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];let r=e.split("|").map(i=>i==="null"?null:i);return r.length===1?r[0]:r})}function s3(t){if(typeof t=="string"){if(t=t.toLowerCase(),hs(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+g0e(t);if(d_.isForkEvent(t))throw Gr.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+g0e(t.topics||[])}throw new Error("invalid event - "+t)}function b5(){return new Date().getTime()}function w0e(t){return new Promise(e=>{setTimeout(e,t)})}var kWe=["block","network","pending","poll"],yD=class{constructor(e,r,i){ye(this,"tag",e),ye(this,"listener",r),ye(this,"once",i),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){let e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){let e=this.tag.split(":");if(e[0]!=="filter")return null;let r=e[1],i=RWe(e[2]),n={};return i.length>0&&(n.topics=i),r&&r!=="*"&&(n.address=r),n}pollable(){return this.tag.indexOf(":")>=0||kWe.indexOf(this.tag)>=0}},NWe={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function gD(t){return Kr(Ue.from(t).toHexString(),32)}function v0e(t){return ch.encode(Fr([t,Fi(ha(ha(t)),0,4)]))}var x0e=new RegExp("^(ipfs)://(.*)$","i"),b0e=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),x0e,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function $_(t,e){try{return ua(y5(t,e))}catch{}return null}function y5(t,e){if(t==="0x")return null;let r=Ue.from(Fi(t,e,e+32)).toNumber(),i=Ue.from(Fi(t,r,r+32)).toNumber();return Fi(t,r+32,r+32+i)}function wD(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):Gr.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function y0e(t){let e=ke(t);if(e.length>32)throw new Error("internal; should not happen");let r=new Uint8Array(32);return r.set(e,32-e.length),r}function PWe(t){if(t.length%32===0)return t;let e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function _0e(t){let e=[],r=0;for(let i=0;i<t.length;i++)e.push(null),r+=32;for(let i=0;i<t.length;i++){let n=ke(t[i]);e[i]=y0e(r),e.push(y0e(n.length)),e.push(PWe(n)),r+=32+Math.ceil(n.length/32)*32}return qn(e)}var a3=class{constructor(e,r,i,n){ye(this,"provider",e),ye(this,"name",i),ye(this,"address",e.formatter.address(r)),ye(this,"_resolvedAddress",n)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(e=>Ue.from(e).eq(1)).catch(e=>{if(e.code===fe.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return Er(this,void 0,void 0,function*(){let i={to:this.address,ccipReadEnabled:!0,data:qn([e,ep(this.name),r||"0x"])},n=!1;(yield this.supportsWildcard())&&(n=!0,i.data=qn(["0x9061b923",_0e([r5(this.name),i.data])]));try{let o=yield this.provider.call(i);return ke(o).length%32===4&&Gr.throwError("resolver threw error",fe.errors.CALL_EXCEPTION,{transaction:i,data:o}),n&&(o=y5(o,0)),o}catch(o){if(o.code===fe.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return Er(this,void 0,void 0,function*(){let i=yield this._fetch(e,r);return i!=null?y5(i,0):null})}_getAddress(e,r){let i=NWe[String(e)];if(i==null&&Gr.throwError(`unsupported coin type: ${e}`,fe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),i.ilk==="eth")return this.provider.formatter.address(r);let n=ke(r);if(i.p2pkh!=null){let o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){let s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return v0e(Fr([[i.p2pkh],"0x"+o[2]]))}}if(i.p2sh!=null){let o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){let s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return v0e(Fr([[i.p2sh],"0x"+o[2]]))}}if(i.prefix!=null){let o=n[1],s=n[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&n.length===2+o&&o>=1&&o<=75){let a=bD.default.toWords(n.slice(2));return a.unshift(s),bD.default.encode(i.prefix,a)}}return null}getAddress(e){return Er(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{let n=yield this._fetch("0x3b3b57de");return n==="0x"||n===Bw?null:this.provider.formatter.callAddress(n)}catch(n){if(n.code===fe.errors.CALL_EXCEPTION)return null;throw n}let r=yield this._fetchBytes("0xf1cb7e06",gD(e));if(r==null||r==="0x")return null;let i=this._getAddress(e,r);return i==null&&Gr.throwError("invalid or unsupported coin data",fe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),i})}getAvatar(){return Er(this,void 0,void 0,function*(){let e=[{type:"name",content:this.name}];try{let r=yield this.getText("avatar");if(r==null)return null;for(let i=0;i<b0e.length;i++){let n=r.match(b0e[i]);if(n==null)continue;let o=n[1].toLowerCase();switch(o){case"https":return e.push({type:"url",content:r}),{linkage:e,url:r};case"data":return e.push({type:"data",content:r}),{linkage:e,url:r};case"ipfs":return e.push({type:"ipfs",content:r}),{linkage:e,url:wD(r)};case"erc721":case"erc1155":{let s=o==="erc721"?"0xc87b56dd":"0x0e89341c";e.push({type:o,content:r});let a=this._resolvedAddress||(yield this.getAddress()),c=(n[2]||"").split("/");if(c.length!==2)return null;let h=yield this.provider.formatter.address(c[0]),g=Kr(Ue.from(c[1]).toHexString(),32);if(o==="erc721"){let P=this.provider.formatter.callAddress(yield this.provider.call({to:h,data:qn(["0x6352211e",g])}));if(a!==P)return null;e.push({type:"owner",content:P})}else if(o==="erc1155"){let P=Ue.from(yield this.provider.call({to:h,data:qn(["0x00fdd58e",Kr(a,32),g])}));if(P.isZero())return null;e.push({type:"balance",content:P.toString()})}let b={to:this.provider.formatter.address(c[0]),data:qn([s,g])},E=$_(yield this.provider.call(b),0);if(E==null)return null;e.push({type:"metadata-url-base",content:E}),o==="erc1155"&&(E=E.replace("{id}",g.substring(2)),e.push({type:"metadata-url-expanded",content:E})),E.match(/^ipfs:/i)&&(E=wD(E)),e.push({type:"metadata-url",content:E});let A=yield Zl(E);if(!A)return null;e.push({type:"metadata",content:JSON.stringify(A)});let T=A.image;if(typeof T!="string")return null;if(!T.match(/^(https:\/\/|data:)/i)){if(T.match(x0e)==null)return null;e.push({type:"url-ipfs",content:T}),T=wD(T)}return e.push({type:"url",content:T}),{linkage:e,url:T}}}}}catch{}return null})}getContentHash(){return Er(this,void 0,void 0,function*(){let e=yield this._fetchBytes("0xbc1c58d1");if(e==null||e==="0x")return null;let r=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){let s=parseInt(r[3],16);if(r[4].length===s*2)return"ipfs://"+ch.encode("0x"+r[1])}let i=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(i){let s=parseInt(i[3],16);if(i[4].length===s*2)return"ipns://"+ch.encode("0x"+i[1])}let n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===32*2)return"bzz://"+n[1];let o=e.match(/^0x90b2c605([0-9a-f]*)$/);if(o&&o[1].length===34*2){let s={"=":"","+":"-","/":"_"};return"sia://"+jw("0x"+o[1]).replace(/[=+\/]/g,c=>s[c])}return Gr.throwError("invalid or unsupported content hash data",fe.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return Er(this,void 0,void 0,function*(){let r=ui(e);r=Fr([gD(64),gD(r.length),r]),r.length%32!==0&&(r=Fr([r,Kr("0x",32-e.length%32)]));let i=yield this._fetchBytes("0x59d1d43c",De(r));return i==null||i==="0x"?null:ua(i)})}},vD=null,OWe=1,kf=class extends Jc{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ye(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{let r=vn(new.target,"getNetwork")(e);r?(ye(this,"_network",r),this.emit("network",r,null)):Gr.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Er(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||Gr.throwError("no network detected",fe.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:ye(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return Yl(()=>this._ready().then(e=>e,e=>{if(!(e.code===fe.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return vD==null&&(vD=new Bm),vD}static getNetwork(e){return m5(e??"homestead")}ccipReadFetch(e,r,i){return Er(this,void 0,void 0,function*(){if(this.disableCcipRead||i.length===0)return null;let n=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let a=0;a<i.length;a++){let c=i[a],h=c.replace("{sender}",n).replace("{data}",o),g=c.indexOf("{data}")>=0?null:JSON.stringify({data:o,sender:n}),b=yield Zl({url:h,errorPassThrough:!0},g,(A,T)=>(A.status=T.statusCode,A));if(b.data)return b.data;let E=b.message||"unknown error";if(b.status>=400&&b.status<500)return Gr.throwError(`response not found during CCIP fetch: ${E}`,fe.errors.SERVER_ERROR,{url:c,errorMessage:E});s.push(E)}return Gr.throwError(`error encountered during CCIP fetch: ${s.map(a=>JSON.stringify(a)).join(", ")}`,fe.errors.SERVER_ERROR,{urls:i,errorMessages:s})})}_getInternalBlockNumber(e){return Er(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){let n=this._internalBlockNumber;try{let o=yield n;if(b5()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===n)break}}let r=b5(),i=ji({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(n=>null,n=>n)}).then(({blockNumber:n,networkError:o})=>{if(o)throw this._internalBlockNumber===i&&(this._internalBlockNumber=null),o;let s=b5();return n=Ue.from(n).toNumber(),n<this._maxInternalBlockNumber&&(n=this._maxInternalBlockNumber),this._maxInternalBlockNumber=n,this._setFastBlockNumber(n),{blockNumber:n,reqTime:r,respTime:s}});return this._internalBlockNumber=i,i.catch(n=>{this._internalBlockNumber===i&&(this._internalBlockNumber=null)}),(yield i).blockNumber})}poll(){return Er(this,void 0,void 0,function*(){let e=OWe++,r=[],i=null;try{i=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(n){this.emit("error",n);return}if(this._setFastBlockNumber(i),this.emit("poll",e,i),i===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=i-1),Math.abs(this._emitted.block-i)>1e3)Gr.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${i})`),this.emit("error",Gr.makeError("network block skew detected",fe.errors.NETWORK_ERROR,{blockNumber:i,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",i);else for(let n=this._emitted.block+1;n<=i;n++)this.emit("block",n);this._emitted.block!==i&&(this._emitted.block=i,Object.keys(this._emitted).forEach(n=>{if(n==="block")return;let o=this._emitted[n];o!=="pending"&&i-o>12&&delete this._emitted[n]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=i-1),this._events.forEach(n=>{switch(n.type){case"tx":{let o=n.hash,s=this.getTransactionReceipt(o).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+o]=a.blockNumber,this.emit(o,a)),null)).catch(a=>{this.emit("error",a)});r.push(s);break}case"filter":{if(!n._inflight){n._inflight=!0,n._lastBlockNumber===-2&&(n._lastBlockNumber=i-1);let o=n.filter;o.fromBlock=n._lastBlockNumber+1,o.toBlock=i;let s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);let a=this.getLogs(o).then(c=>{n._inflight=!1,c.length!==0&&c.forEach(h=>{h.blockNumber>n._lastBlockNumber&&(n._lastBlockNumber=h.blockNumber),this._emitted["b:"+h.blockHash]=h.blockNumber,this._emitted["t:"+h.transactionHash]=h.blockNumber,this.emit(o,h)})}).catch(c=>{this.emit("error",c),n._inflight=!1});r.push(a)}break}}}),this._lastBlockNumber=i,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(n=>{this.emit("error",n)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return Er(this,void 0,void 0,function*(){return Gr.throwError("provider does not support network detection",fe.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return Er(this,void 0,void 0,function*(){let e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield w0e(0),this._network;let i=Gr.makeError("underlying network changed",fe.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",i),i}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){let e=b5();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&e<this._fastBlockNumber||(this._fastQueryDate=b5(),(this._fastBlockNumber==null||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,i){return Er(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,i||0,null)})}_waitForTransaction(e,r,i,n){return Er(this,void 0,void 0,function*(){let o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,a)=>{let c=[],h=!1,g=function(){return h?!0:(h=!0,c.forEach(E=>{E()}),!1)},b=E=>{E.confirmations<r||g()||s(E)};if(this.on(e,b),c.push(()=>{this.removeListener(e,b)}),n){let E=n.startBlock,A=null,T=P=>Er(this,void 0,void 0,function*(){h||(yield w0e(1e3),this.getTransactionCount(n.from).then(L=>Er(this,void 0,void 0,function*(){if(!h){if(L<=n.nonce)E=P;else{{let j=yield this.getTransaction(e);if(j&&j.blockNumber!=null)return}for(A==null&&(A=E-3,A<n.startBlock&&(A=n.startBlock));A<=P;){if(h)return;let j=yield this.getBlockWithTransactions(A);for(let $=0;$<j.transactions.length;$++){let G=j.transactions[$];if(G.hash===e)return;if(G.from===n.from&&G.nonce===n.nonce){if(h)return;let Z=yield this.waitForTransaction(G.hash,r);if(g())return;let te="replaced";G.data===n.data&&G.to===n.to&&G.value.eq(n.value)?te="repriced":G.data==="0x"&&G.from===G.to&&G.value.isZero()&&(te="cancelled"),a(Gr.makeError("transaction was replaced",fe.errors.TRANSACTION_REPLACED,{cancelled:te==="replaced"||te==="cancelled",reason:te,replacement:this._wrapTransaction(G),hash:e,receipt:Z}));return}}A++}}h||this.once("block",T)}}),L=>{h||this.once("block",T)}))});if(h)return;this.once("block",T),c.push(()=>{this.removeListener("block",T)})}if(typeof i=="number"&&i>0){let E=setTimeout(()=>{g()||a(Gr.makeError("timeout exceeded",fe.errors.TIMEOUT,{timeout:i}))},i);E.unref&&E.unref(),c.push(()=>{clearTimeout(E)})}})})}getBlockNumber(){return Er(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let e=yield this.perform("getGasPrice",{});try{return Ue.from(e)}catch(r){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield ji({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getBalance",i);try{return Ue.from(n)}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getBalance",params:i,result:n,error:o})}})}getTransactionCount(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield ji({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getTransactionCount",i);try{return Ue.from(n).toNumber()}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getTransactionCount",params:i,result:n,error:o})}})}getCode(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield ji({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getCode",i);try{return De(n)}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getCode",params:i,result:n,error:o})}})}getStorageAt(e,r,i){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let n=yield ji({address:this._getAddress(e),blockTag:this._getBlockTag(i),position:Promise.resolve(r).then(s=>uf(s))}),o=yield this.perform("getStorageAt",n);try{return De(o)}catch(s){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:o,error:s})}})}_wrapTransaction(e,r,i){if(r!=null&&hs(r)!==32)throw new Error("invalid response - sendTransaction");let n=e;return r!=null&&e.hash!==r&&Gr.throwError("Transaction hash mismatch from Provider.sendTransaction.",fe.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),n.wait=(o,s)=>Er(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let a;o!==0&&i!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:i});let c=yield this._waitForTransaction(e.hash,o,s,a);return c==null&&o===0?null:(this._emitted["t:"+e.hash]=c.blockNumber,c.status===0&&Gr.throwError("transaction failed",fe.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:c}),c)}),n}sendTransaction(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield Promise.resolve(e).then(o=>De(o)),i=this.formatter.transaction(e);i.confirmations==null&&(i.confirmations=0);let n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{let o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(i,o,n)}catch(o){throw o.transaction=i,o.transactionHash=i.hash,o}})}_getTransactionRequest(e){return Er(this,void 0,void 0,function*(){let r=yield e,i={};return["from","to"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?Ue.from(o):null))}),["type"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o??null))}),r.accessList&&(i.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?De(o):null))}),this.formatter.transactionRequest(yield ji(i))})}_getFilter(e){return Er(this,void 0,void 0,function*(){e=yield e;let r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(i=>{e[i]!=null&&(r[i]=e[i])}),["fromBlock","toBlock"].forEach(i=>{e[i]!=null&&(r[i]=this._getBlockTag(e[i]))}),this.formatter.filter(yield ji(r))})}_call(e,r,i){return Er(this,void 0,void 0,function*(){i>=TWe&&Gr.throwError("CCIP read exceeded maximum redirections",fe.errors.SERVER_ERROR,{redirects:i,transaction:e});let n=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(i>=0&&r==="latest"&&n!=null&&o.substring(0,10)==="0x556f1830"&&hs(o)%32===4)try{let s=Fi(o,4),a=Fi(s,0,32);Ue.from(a).eq(n)||Gr.throwError("CCIP Read sender did not match",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let c=[],h=Ue.from(Fi(s,32,64)).toNumber(),g=Ue.from(Fi(s,h,h+32)).toNumber(),b=Fi(s,h+32);for(let j=0;j<g;j++){let $=$_(b,j*32);$==null&&Gr.throwError("CCIP Read contained corrupt URL string",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o}),c.push($)}let E=y5(s,64);Ue.from(Fi(s,100,128)).isZero()||Gr.throwError("CCIP Read callback selector included junk",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let A=Fi(s,96,100),T=y5(s,128),P=yield this.ccipReadFetch(e,E,c);P==null&&Gr.throwError("CCIP Read disabled or provided no URLs",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let L={to:n,data:qn([A,_0e([P,T])])};return this._call(L,r,i+1)}catch(s){if(s.code===fe.errors.SERVER_ERROR)throw s}try{return De(o)}catch(s){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:r},result:o,error:s})}})}call(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield ji({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(r),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(i.transaction,i.blockTag,i.ccipReadEnabled?0:-1)})}estimateGas(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield ji({transaction:this._getTransactionRequest(e)}),i=yield this.perform("estimateGas",r);try{return Ue.from(i)}catch(n){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"estimateGas",params:r,result:i,error:n})}})}_getAddress(e){return Er(this,void 0,void 0,function*(){e=yield e,typeof e!="string"&&Gr.throwArgumentError("invalid address or ENS name","name",e);let r=yield this.resolveName(e);return r==null&&Gr.throwError("ENS name not configured",fe.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),r})}_getBlock(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let i=-128,n={includeTransactions:!!r};if(Zt(e,32))n.blockHash=e;else try{n.blockTag=yield this._getBlockTag(e),Zt(n.blockTag)&&(i=parseInt(n.blockTag.substring(2),16))}catch{Gr.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return Yl(()=>Er(this,void 0,void 0,function*(){let o=yield this.perform("getBlock",n);if(o==null)return n.blockHash!=null&&this._emitted["b:"+n.blockHash]==null||n.blockTag!=null&&i>this._emitted.block?null:void 0;if(r){let s=null;for(let c=0;c<o.transactions.length;c++){let h=o.transactions[c];if(h.blockNumber==null)h.confirmations=0;else if(h.confirmations==null){s==null&&(s=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let g=s-h.blockNumber+1;g<=0&&(g=1),h.confirmations=g}}let a=this.formatter.blockWithTransactions(o);return a.transactions=a.transactions.map(c=>this._wrapTransaction(c)),a}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let r={transactionHash:this.formatter.hash(e,!0)};return Yl(()=>Er(this,void 0,void 0,function*(){let i=yield this.perform("getTransaction",r);if(i==null)return this._emitted["t:"+e]==null?null:void 0;let n=this.formatter.transactionResponse(i);if(n.blockNumber==null)n.confirmations=0;else if(n.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;s<=0&&(s=1),n.confirmations=s}return this._wrapTransaction(n)}),{oncePoll:this})})}getTransactionReceipt(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let r={transactionHash:this.formatter.hash(e,!0)};return Yl(()=>Er(this,void 0,void 0,function*(){let i=yield this.perform("getTransactionReceipt",r);if(i==null)return this._emitted["t:"+e]==null?null:void 0;if(i.blockHash==null)return;let n=this.formatter.receipt(i);if(n.blockNumber==null)n.confirmations=0;else if(n.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;s<=0&&(s=1),n.confirmations=s}return n}),{oncePoll:this})})}getLogs(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield ji({filter:this._getFilter(e)}),i=yield this.perform("getLogs",r);return i.forEach(n=>{n.removed==null&&(n.removed=!1)}),Bm.arrayOf(this.formatter.filterLog.bind(this.formatter))(i)})}getEtherPrice(){return Er(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return Er(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Gr.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return Er(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;let i=yield this._getResolver(r,"getResolver");if(i!=null){let n=new a3(this,i,e);return r!==e&&!(yield n.supportsWildcard())?null:n}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return Er(this,void 0,void 0,function*(){r==null&&(r="ENS");let i=yield this.getNetwork();i.ensAddress||Gr.throwError("network does not support ENS",fe.errors.UNSUPPORTED_OPERATION,{operation:r,network:i.name});try{let n=yield this.call({to:i.ensAddress,data:"0x0178b8bf"+ep(e).substring(2)});return this.formatter.callAddress(n)}catch{}return null})}resolveName(e){return Er(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(i){if(Zt(e))throw i}typeof e!="string"&&Gr.throwArgumentError("invalid ENS name","name",e);let r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return Er(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);let r=e.substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(r,"lookupAddress");if(i==null)return null;let n=$_(yield this.call({to:i,data:"0x691f3431"+ep(r).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n})}getAvatar(e){return Er(this,void 0,void 0,function*(){let r=null;if(Zt(e)){let o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new a3(this,s,o);try{let a=yield r.getAvatar();if(a)return a.url}catch(a){if(a.code!==fe.errors.CALL_EXCEPTION)throw a}try{let a=$_(yield this.call({to:s,data:"0x691f3431"+ep(o).substring(2)}),0);r=yield this.getResolver(a)}catch(a){if(a.code!==fe.errors.CALL_EXCEPTION)throw a;return null}}else if(r=yield this.getResolver(e),!r)return null;let i=yield r.getAvatar();return i==null?null:i.url})}perform(e,r){return Gr.throwError(e+" not implemented",fe.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,i){let n=new yD(s3(e),r,i);return this._events.push(n),this._startEvent(n),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let i=!1,n=[],o=s3(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),i=!0,s.once?(n.push(s),!1):!0)),n.forEach(s=>{this._stopEvent(s)}),i}listenerCount(e){if(!e)return this._events.length;let r=s3(e);return this._events.filter(i=>i.tag===r).length}listeners(e){if(e==null)return this._events.map(i=>i.listener);let r=s3(e);return this._events.filter(i=>i.tag===r).map(i=>i.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);let i=[],n=!1,o=s3(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||n?!0:(n=!0,i.push(s),!1)),i.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{let i=s3(e);this._events=this._events.filter(n=>n.tag!==i?!0:(r.push(n),!1))}return r.forEach(i=>{this._stopEvent(i)}),this}};var ph=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Kn=new fe(Ci),MWe=["call","estimateGas"];function _5(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){let r=Zt(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(let r in t){let i=_5(t[r],e);if(i)return i}return null}if(typeof t=="string")try{return _5(JSON.parse(t),e)}catch{}return null}function A0e(t,e,r){let i=r.transaction||r.signedTransaction;if(t==="call"){let o=_5(e,!0);if(o)return o.data;Kn.throwError("missing revert data in call exception; Transaction reverted without a reason string",fe.errors.CALL_EXCEPTION,{data:"0x",transaction:i,error:e})}if(t==="estimateGas"){let o=_5(e.body,!1);o==null&&(o=_5(e,!1)),o&&Kn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:i,error:e})}let n=e.message;throw e.code===fe.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText),n=(n||"").toLowerCase(),n.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Kn.throwError("insufficient funds for intrinsic transaction cost",fe.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:i}),n.match(/nonce (is )?too low/i)&&Kn.throwError("nonce has already been used",fe.errors.NONCE_EXPIRED,{error:e,method:t,transaction:i}),n.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Kn.throwError("replacement fee too low",fe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:i}),n.match(/only replay-protected/i)&&Kn.throwError("legacy pre-eip-155 transactions not supported",fe.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:i}),MWe.indexOf(t)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Kn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:i}),e}function E0e(t){return new Promise(function(e){setTimeout(e,t)})}function DWe(t){if(t.error){let e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function x5(t){return t&&t.toLowerCase()}var xD={},c3=class extends ec{constructor(e,r,i){if(super(),e!==xD)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ye(this,"provider",r),i==null&&(i=0),typeof i=="string"?(ye(this,"_address",this.provider.formatter.address(i)),ye(this,"_index",null)):typeof i=="number"?(ye(this,"_index",i),ye(this,"_address",null)):Kn.throwArgumentError("invalid address or index","addressOrIndex",i)}connect(e){return Kn.throwError("cannot alter JSON-RPC Signer connection",fe.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new _D(xD,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&Kn.throwError("unknown account #"+this._index,fe.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=di(e);let r=this.getAddress().then(i=>(i&&(i=i.toLowerCase()),i));if(e.gasLimit==null){let i=di(e);i.from=r,e.gasLimit=this.provider.estimateGas(i)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(i=>ph(this,void 0,void 0,function*(){if(i==null)return null;let n=yield this.provider.resolveName(i);return n==null&&Kn.throwArgumentError("provided ENS name resolves to null","tx.to",i),n}))),ji({tx:ji(e),sender:r}).then(({tx:i,sender:n})=>{i.from!=null?i.from.toLowerCase()!==n&&Kn.throwArgumentError("from address mismatch","transaction",e):i.from=n;let o=this.provider.constructor.hexlifyTransaction(i,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&Kn.throwError("user rejected transaction",fe.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:i}),A0e("sendTransaction",s,o)))})}signTransaction(e){return Kn.throwError("signing transactions is unsupported",fe.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return ph(this,void 0,void 0,function*(){let r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),i=yield this.sendUncheckedTransaction(e);try{return yield Yl(()=>ph(this,void 0,void 0,function*(){let n=yield this.provider.getTransaction(i);if(n!==null)return this.provider._wrapTransaction(n,i,r)}),{oncePoll:this.provider})}catch(n){throw n.transactionHash=i,n}})}signMessage(e){return ph(this,void 0,void 0,function*(){let r=typeof e=="string"?ui(e):e,i=yield this.getAddress();try{return yield this.provider.send("personal_sign",[De(r),i.toLowerCase()])}catch(n){throw typeof n.message=="string"&&n.message.match(/user denied/i)&&Kn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"signMessage",from:i,messageData:e}),n}})}_legacySignMessage(e){return ph(this,void 0,void 0,function*(){let r=typeof e=="string"?ui(e):e,i=yield this.getAddress();try{return yield this.provider.send("eth_sign",[i.toLowerCase(),De(r)])}catch(n){throw typeof n.message=="string"&&n.message.match(/user denied/i)&&Kn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:i,messageData:e}),n}})}_signTypedData(e,r,i){return ph(this,void 0,void 0,function*(){let n=yield Yc.resolveNames(e,r,i,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(Yc.getPayload(n.domain,r,n.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&Kn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:n.domain,types:r,value:n.value}}),s}})}unlock(e){return ph(this,void 0,void 0,function*(){let r=this.provider,i=yield this.getAddress();return r.send("personal_unlockAccount",[i.toLowerCase(),e,null])})}},_D=class extends c3{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:i=>this.provider.waitForTransaction(r,i)}))}},LWe={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0},da=class extends kf{constructor(e,r){let i=r;i==null&&(i=new Promise((n,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{n(s)},s=>{o(s)})},0)})),super(i),e||(e=vn(this.constructor,"defaultUrl")()),typeof e=="string"?ye(this,"connection",Object.freeze({url:e})):ye(this,"connection",Object.freeze(di(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return ph(this,void 0,void 0,function*(){yield E0e(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){let r=vn(this.constructor,"getNetwork");try{return r(Ue.from(e).toNumber())}catch(i){return Kn.throwError("could not detect network",fe.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:i})}}return Kn.throwError("could not detect network",fe.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new c3(xD,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){let i={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:wn(i),provider:this});let n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];let o=Zl(this.connection,JSON.stringify(i),DWe).then(s=>(this.emit("debug",{action:"response",request:i,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:i,provider:this}),s});return n&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[x5(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[x5(r.address),r.blockTag]];case"getCode":return["eth_getCode",[x5(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[x5(r.address),Kr(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[vn(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[vn(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=x5(r.filter.address)),["eth_getLogs",[r.filter]];default:break}return null}perform(e,r){return ph(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){let n=r.transaction;if(n&&n.type!=null&&Ue.from(n.type).isZero()&&n.maxFeePerGas==null&&n.maxPriorityFeePerGas==null){let o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=di(r),r.transaction=di(n),delete r.transaction.type)}}let i=this.prepareRequest(e,r);i==null&&Kn.throwError(e+" not implemented",fe.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(i[0],i[1])}catch(n){return A0e(e,n,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;let e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(i){function n(){e.send("eth_getFilterChanges",[i]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(a).then(function(c){return e.emit("pending",c),null})})}),s.then(function(){return E0e(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[i]);return}return setTimeout(function(){n()},0),null}).catch(o=>{})}return n(),i}).catch(i=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){let i=di(LWe);if(r)for(let o in r)r[o]&&(i[o]=!0);Pw(e,i);let n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;let s=uf(Ue.from(e[o]));o==="gasLimit"&&(o="gas"),n[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(n[o]=De(e[o]))}),e.accessList&&(n.accessList=nc(e.accessList)),n}};var l3=null;try{if(l3=WebSocket,l3==null)throw new Error("inject please")}catch{let e=new fe(Ci);l3=function(){e.throwError("WebSockets not supported in this environment",fe.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ED=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},W_=new fe(Ci),BWe=1,mh=class extends da{constructor(e,r){r==="any"&&W_.throwError("WebSocketProvider does not support 'any' network yet",fe.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?ye(this,"_websocket",new l3(this.connection.url)):ye(this,"_websocket",e),ye(this,"_requests",{}),ye(this,"_subs",{}),ye(this,"_subIds",{}),ye(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(n=>{this.websocket.send(this._requests[n].payload)})},this.websocket.onmessage=n=>{let o=n.data,s=JSON.parse(o);if(s.id!=null){let a=String(s.id),c=this._requests[a];if(delete this._requests[a],s.result!==void 0)c.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(c.payload),response:s.result,provider:this});else{let h=null;s.error?(h=new Error(s.error.message||"unknown error"),ye(h,"code",s.error.code||null),ye(h,"response",o)):h=new Error("unknown error"),c.callback(h,void 0),this.emit("debug",{action:"response",error:h,request:JSON.parse(c.payload),provider:this})}}else if(s.method==="eth_subscription"){let a=this._subs[s.params.subscription];a&&a.processFunc(s.params.result)}else console.warn("this should not happen")};let i=setInterval(()=>{this.emit("poll")},1e3);i.unref&&i.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){W_.throwError("cannot reset events block on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){W_.throwError("cannot set polling interval on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return ED(this,void 0,void 0,function*(){return null})}set polling(e){e&&W_.throwError("cannot set polling on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){let i=BWe++;return new Promise((n,o)=>{function s(c,h){return c?o(c):n(h)}let a=JSON.stringify({method:e,params:r,id:i,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(i)]={callback:s,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,i){return ED(this,void 0,void 0,function*(){let n=this._subIds[e];n==null&&(n=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=n);let o=yield n;this._subs[o]={tag:e,processFunc:i}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{let i=Ue.from(r.number).toNumber();this._emitted.block=i,this.emit("block",i)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{let r=i=>{let n=i.hash;this.getTransactionReceipt(n).then(o=>{o&&this.emit(n,o)})};r(e),this._subscribe("tx",["newHeads"],i=>{this._events.filter(n=>n.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(n=>n.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;let i=this._subIds[r];i&&(delete this._subIds[r],i.then(n=>{this._subs[n]&&(delete this._subs[n],this.send("eth_unsubscribe",[n]))}))}destroy(){return ED(this,void 0,void 0,function*(){this.websocket.readyState===l3.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}};var UWe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},E5=new fe(Ci),A5=class extends da{detectNetwork(){let e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return UWe(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||E5.throwError("no network detected",fe.errors.UNKNOWN_ERROR,{}),this._network==null&&(ye(this,"_network",r),this.emit("network",r,null))),r})}},ws=class t extends A5{constructor(e,r){E5.checkAbstract(new.target,t),e=vn(new.target,"getNetwork")(e),r=vn(new.target,"getApiKey")(r);let i=vn(new.target,"getUrl")(e,r);super(i,e),typeof r=="string"?ye(this,"apiKey",r):r!=null&&Object.keys(r).forEach(n=>{ye(this,n,r[n])})}_startPending(){E5.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return E5.throwError("API provider does not support signing",fe.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return E5.throwError("not implemented; sub-classes must override getUrl",fe.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}};var C0e=new fe(Ci),H_="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",C5=class extends mh{constructor(e,r){let i=new u3(e,r),n=i.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(n,i.network),ye(this,"apiKey",i.apiKey)}isCommunityResource(){return this.apiKey===H_}},u3=class extends ws{static getWebSocketProvider(e,r){return new C5(e,r)}static getApiKey(e){return e==null?H_:(e&&typeof e!="string"&&C0e.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let i=null;switch(e.name){case"homestead":i="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":i="eth-goerli.g.alchemy.com/v2/";break;case"matic":i="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":i="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":i="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":i="arb-goerli.g.alchemy.com/v2/";break;case"optimism":i="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":i="opt-goerli.g.alchemy.com/v2/";break;default:C0e.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+i+r,throttleCallback:(n,o)=>(r===H_&&Rf(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===H_}};var FWe=new fe(Ci),z_="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function jWe(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return FWe.throwArgumentError("unsupported network","name",t)}var S5=class extends ws{isCommunityResource(){return this.apiKey===z_}static getApiKey(e){return e??z_}static getUrl(e,r){r==null&&(r=z_);let i={allowGzip:!0,url:"https://"+jWe(e.name)+r,throttleCallback:(n,o)=>(r.apiKey===z_&&Rf(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}};var $We=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},S0e=new fe(Ci),I5=class extends ws{static getApiKey(e){return e!=null&&S0e.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let i=null;switch(e.name){case"homestead":i="https://cloudflare-eth.com/";break;default:S0e.throwArgumentError("unsupported network","network",arguments[0])}return i}perform(e,r){let i=Object.create(null,{perform:{get:()=>super.perform}});return $We(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield i.perform.call(this,"getBlock",{blockTag:"latest"})).number:i.perform.call(this,e,r)})}};var q_=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},ap=new fe(Ci);function I0e(t){let e={};for(let r in t){if(t[r]==null)continue;let i=t[r];r==="type"&&i===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?i=uf(De(i)):r==="accessList"?i="["+nc(i).map(n=>`{address:"${n.address}",storageKeys:["${n.storageKeys.join('","')}"]}`).join(",")+"]":i=De(i),e[r]=i)}return e}function WWe(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){let e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function T0e(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){let e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){let e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){let e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function R0e(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function AD(t,e,r){if(t==="call"&&e.code===fe.errors.SERVER_ERROR){let n=e.error;if(n&&(n.message.match(/reverted/i)||n.message.match(/VM execution error/i))){let o=n.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),Zt(o))return o;ap.throwError("missing revert data in call exception",fe.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let i=e.message;throw e.code===fe.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText)),i=(i||"").toLowerCase(),i.match(/insufficient funds/)&&ap.throwError("insufficient funds for intrinsic transaction cost",fe.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),i.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ap.throwError("nonce has already been used",fe.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),i.match(/another transaction with same nonce/)&&ap.throwError("replacement fee too low",fe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),i.match(/execution failed due to an exception|execution reverted/)&&ap.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}var T5=class extends kf{constructor(e,r){super(e),ye(this,"baseUrl",this.getBaseUrl()),ye(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io";default:}return ap.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){let i=Object.keys(r).reduce((o,s)=>{let a=r[s];return a!=null&&(o+=`&${s}=${a}`),o},""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${i}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,i){return q_(this,void 0,void 0,function*(){let n=i?this.getPostUrl():this.getUrl(e,r),o=i?this.getPostData(e,r):null,s=e==="proxy"?T0e:WWe;this.emit("debug",{action:"request",request:n,provider:this});let a={url:n,throttleSlotInterval:1e3,throttleCallback:(g,b)=>(this.isCommunityResource()&&Rf(),Promise.resolve(!0))},c=null;o&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},c=Object.keys(o).map(g=>`${g}=${o[g]}`).join("&"));let h=yield Zl(a,c,s||T0e);return this.emit("debug",{action:"response",request:n,response:wn(h),provider:this}),h})}detectNetwork(){return q_(this,void 0,void 0,function*(){return this.network})}perform(e,r){let i=Object.create(null,{perform:{get:()=>super.perform}});return q_(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(n=>AD("sendTransaction",n,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");let n=I0e(r.transaction);n.module="proxy",n.action="eth_call";try{return yield this.fetch("proxy",n,!0)}catch(o){return AD("call",o,r.transaction)}}case"estimateGas":{let n=I0e(r.transaction);n.module="proxy",n.action="eth_estimateGas";try{return yield this.fetch("proxy",n,!0)}catch(o){return AD("estimateGas",o,r.transaction)}}case"getLogs":{let n={action:"getLogs"};if(r.filter.fromBlock&&(n.fromBlock=R0e(r.filter.fromBlock)),r.filter.toBlock&&(n.toBlock=R0e(r.filter.toBlock)),r.filter.address&&(n.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ap.throwError("unsupported topic count",fe.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){let a=r.filter.topics[0];(typeof a!="string"||a.length!==66)&&ap.throwError("unsupported topic format",fe.errors.UNSUPPORTED_OPERATION,{topic0:a}),n.topic0=a}let o=yield this.fetch("logs",n),s={};for(let a=0;a<o.length;a++){let c=o[a];if(c.blockHash==null){if(s[c.blockNumber]==null){let h=yield this.getBlock(c.blockNumber);h&&(s[c.blockNumber]=h.hash)}c.blockHash=s[c.blockNumber]}}return o}case"getEtherPrice":return this.network.name!=="homestead"?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd);default:break}return i.perform.call(this,e,r)})}getHistory(e,r,i){return q_(this,void 0,void 0,function*(){let n={action:"txlist",address:yield this.resolveName(e),startblock:r??0,endblock:i??99999999,sort:"asc"};return(yield this.fetch("account",n)).map(s=>{["contractAddress","to"].forEach(function(c){s[c]==""&&delete s[c]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);let a=this.formatter.transactionResponse(s);return s.timeStamp&&(a.timestamp=parseInt(s.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}};var G_=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Um=new fe(Ci);function V_(){return new Date().getTime()}function k0e(t){let e=null;for(let r=0;r<t.length;r++){let i=t[r];if(i==null)return null;e?e.name===i.name&&e.chainId===i.chainId&&(e.ensAddress===i.ensAddress||e.ensAddress==null&&i.ensAddress==null)||Um.throwArgumentError("provider mismatch","networks",t):e=i}return e}function N0e(t,e){t=t.slice().sort();let r=Math.floor(t.length/2);if(t.length%2)return t[r];let i=t[r-1],n=t[r];return e!=null&&Math.abs(i-n)>e?null:(i+n)/2}function f3(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(Ue.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>f3(e)));if(typeof t=="object"){let e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let i=t[r];return typeof i=="function"?i="[function]":i=f3(i),JSON.stringify(r)+":"+i}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}var HWe=1;function P0e(t){let e=null,r=null,i=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)}),n=s=>(i=i.then(s),i);function o(){return i}return{cancel:e,getPromise:o,wait:n}}var zWe=[fe.errors.CALL_EXCEPTION,fe.errors.INSUFFICIENT_FUNDS,fe.errors.NONCE_EXPIRED,fe.errors.REPLACEMENT_UNDERPRICED,fe.errors.UNPREDICTABLE_GAS_LIMIT],qWe=["address","args","errorArgs","errorSignature","method","transaction"];function K_(t,e){let r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function VWe(t,e){return function(r){let i={};r.forEach(o=>{let s=t(o.result);i[s]||(i[s]={count:0,result:o.result}),i[s].count++});let n=Object.keys(i);for(let o=0;o<n.length;o++){let s=i[n[o]];if(s.count>=e)return s.result}}}function KWe(t,e,r){let i=f3;switch(e){case"getBlockNumber":return function(n){let o=n.map(a=>a.result),s=N0e(n.map(a=>a.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(n){let o=n.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(n){return N0e(n.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":i=function(n){return n==null?null:(n=di(n),n.confirmations=-1,f3(n))};break;case"getBlock":r.includeTransactions?i=function(n){return n==null?null:(n=di(n),n.transactions=n.transactions.map(o=>(o=di(o),o.confirmations=-1,o)),f3(n))}:i=function(n){return n==null?null:f3(n)};break;default:throw new Error("unknown method: "+e)}return VWe(i,t.quorum)}function R5(t,e){return G_(this,void 0,void 0,function*(){let r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:Yl(()=>new Promise((i,n)=>{setTimeout(function(){return r.blockNumber>=e?i(r):t.cancelled?i(null):i(void 0)},0)}),{oncePoll:r})})}function GWe(t,e,r,i){return G_(this,void 0,void 0,function*(){let n=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return n[r]();case"getEtherPrice":if(n.getEtherPrice)return n.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return i.blockTag&&Zt(i.blockTag)&&(n=yield R5(t,e)),n[r](i.address,i.blockTag||"latest");case"getStorageAt":return i.blockTag&&Zt(i.blockTag)&&(n=yield R5(t,e)),n.getStorageAt(i.address,i.position,i.blockTag||"latest");case"getBlock":return i.blockTag&&Zt(i.blockTag)&&(n=yield R5(t,e)),n[i.includeTransactions?"getBlockWithTransactions":"getBlock"](i.blockTag||i.blockHash);case"call":case"estimateGas":return i.blockTag&&Zt(i.blockTag)&&(n=yield R5(t,e)),r==="call"&&i.blockTag?n[r](i.transaction,i.blockTag):n[r](i.transaction);case"getTransaction":case"getTransactionReceipt":return n[r](i.transactionHash);case"getLogs":{let o=i.filter;return(o.fromBlock&&Zt(o.fromBlock)||o.toBlock&&Zt(o.toBlock))&&(n=yield R5(t,e)),n.getLogs(o)}}return Um.throwError("unknown method error",fe.errors.UNKNOWN_ERROR,{method:r,params:i})})}var k5=class extends kf{constructor(e,r){e.length===0&&Um.throwArgumentError("missing providers","providers",e);let i=e.map((s,a)=>{if(Jc.isProvider(s)){let g=v5(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:g,priority:1})}let c=di(s);c.priority==null&&(c.priority=1),c.stallTimeout==null&&(c.stallTimeout=v5(s)?2e3:750),c.weight==null&&(c.weight=1);let h=c.weight;return(h%1||h>512||h<1)&&Um.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,h),Object.freeze(c)}),n=i.reduce((s,a)=>s+a.weight,0);r==null?r=n/2:r>n&&Um.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=k0e(i.map(s=>s.provider.network));o==null&&(o=new Promise((s,a)=>{setTimeout(()=>{this.detectNetwork().then(s,a)},0)})),super(o),ye(this,"providerConfigs",Object.freeze(i)),ye(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return G_(this,void 0,void 0,function*(){let e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return k0e(e)})}perform(e,r){return G_(this,void 0,void 0,function*(){if(e==="sendTransaction"){let c=yield Promise.all(this.providerConfigs.map(h=>h.provider.sendTransaction(r.signedTransaction).then(g=>g.hash,g=>g)));for(let h=0;h<c.length;h++){let g=c[h];if(typeof g=="string")return g}throw c[0]}this._highestBlockNumber===-1&&e!=="getBlockNumber"&&(yield this.getBlockNumber());let i=KWe(this,e,r),n=h5(this.providerConfigs.map(di));n.sort((c,h)=>c.priority-h.priority);let o=this._highestBlockNumber,s=0,a=!0;for(;;){let c=V_(),h=n.filter(A=>A.runner&&c-A.start<A.stallTimeout).reduce((A,T)=>A+T.weight,0);for(;h<this.quorum&&s<n.length;){let A=n[s++],T=HWe++;A.start=V_(),A.staller=P0e(A.stallTimeout),A.staller.wait(()=>{A.staller=null}),A.runner=GWe(A,o,e,r).then(P=>{A.done=!0,A.result=P,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:K_(A,V_()),request:{method:e,params:wn(r)},provider:this})},P=>{A.done=!0,A.error=P,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:K_(A,V_()),request:{method:e,params:wn(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:K_(A,null),request:{method:e,params:wn(r)},provider:this}),h+=A.weight}let g=[];n.forEach(A=>{A.done||!A.runner||(g.push(A.runner),A.staller&&g.push(A.staller.getPromise()))}),g.length&&(yield Promise.race(g));let b=n.filter(A=>A.done&&A.error==null);if(b.length>=this.quorum){let A=i(b);if(A!==void 0)return n.forEach(T=>{T.staller&&T.staller.cancel(),T.cancelled=!0}),A;a||(yield P0e(100).getPromise()),a=!1}let E=n.reduce((A,T)=>{if(!T.done||T.error==null)return A;let P=T.error.code;return zWe.indexOf(P)>=0&&(A[P]||(A[P]={error:T.error,weight:0}),A[P].weight+=T.weight),A},{});if(Object.keys(E).forEach(A=>{let T=E[A];if(T.weight<this.quorum)return;n.forEach(j=>{j.staller&&j.staller.cancel(),j.cancelled=!0});let P=T.error,L={};qWe.forEach(j=>{P[j]!=null&&(L[j]=P[j])}),Um.throwError(P.reason||P.message,A,L)}),n.filter(A=>!A.done).length===0)break}return n.forEach(c=>{c.staller&&c.staller.cancel(),c.cancelled=!0}),Um.throwError("failed to meet quorum",fe.errors.SERVER_ERROR,{method:e,params:r,results:n.map(c=>K_(c)),provider:this})})}};var CD=null;var Z_=new fe(Ci),N5="84842078b09946638c03157f83405213",P5=class extends mh{constructor(e,r){let i=new h3(e,r),n=i.connection;n.password&&Z_.throwError("INFURA WebSocket project secrets unsupported",fe.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});let o=n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),ye(this,"apiKey",i.projectId),ye(this,"projectId",i.projectId),ye(this,"projectSecret",i.projectSecret)}isCommunityResource(){return this.projectId===N5}},h3=class extends ws{static getWebSocketProvider(e,r){return new P5(e,r)}static getApiKey(e){let r={apiKey:N5,projectId:N5,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(Z_.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),Z_.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let i=null;switch(e?e.name:"unknown"){case"homestead":i="mainnet.infura.io";break;case"goerli":i="goerli.infura.io";break;case"sepolia":i="sepolia.infura.io";break;case"matic":i="polygon-mainnet.infura.io";break;case"maticmum":i="polygon-mumbai.infura.io";break;case"optimism":i="optimism-mainnet.infura.io";break;case"optimism-goerli":i="optimism-goerli.infura.io";break;case"arbitrum":i="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":i="arbitrum-goerli.infura.io";break;default:Z_.throwError("unsupported network",fe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}let n={allowGzip:!0,url:"https://"+i+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===N5&&Rf(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}isCommunityResource(){return this.projectId===N5}};var Y_=class extends da{send(e,r){let i={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);let n={request:i,resolve:null,reject:null},o=new Promise((s,a)=>{n.resolve=s,n.reject=a});return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{let s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;let a=s.map(c=>c.request);return this.emit("debug",{action:"requestBatch",request:wn(a),provider:this}),Zl(this.connection,JSON.stringify(a)).then(c=>{this.emit("debug",{action:"response",request:a,response:c,provider:this}),s.forEach((h,g)=>{let b=c[g];if(b.error){let E=new Error(b.error.message);E.code=b.error.code,E.data=b.error.data,h.reject(E)}else h.resolve(b.result)})},c=>{this.emit("debug",{action:"response",error:c,request:a,provider:this}),s.forEach(h=>{h.reject(c)})})},10)),o}};var SD=new fe(Ci),ZWe="ETHERS_JS_SHARED",O5=class extends ws{static getApiKey(e){return e&&typeof e!="string"&&SD.throwArgumentError("invalid apiKey","apiKey",e),e||ZWe}static getUrl(e,r){SD.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let i=null;switch(e.name){case"homestead":i="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":i="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":i="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":i="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":i="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:SD.throwArgumentError("unsupported network","network",arguments[0])}return i+"?apiKey="+r}};var O0e=new fe(Ci),M0e="62e1ad51b37b8e00394bda3b",M5=class extends ws{static getApiKey(e){let r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=M0e:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:O0e.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let i=null;switch(e?e.name:"unknown"){case"goerli":i="eth-goerli.gateway.pokt.network";break;case"homestead":i="eth-mainnet.gateway.pokt.network";break;case"kovan":i="poa-kovan.gateway.pokt.network";break;case"matic":i="poly-mainnet.gateway.pokt.network";break;case"maticmum":i="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":i="eth-rinkeby.gateway.pokt.network";break;case"ropsten":i="eth-ropsten.gateway.pokt.network";break;default:O0e.throwError("unsupported network",fe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}let n=`https://${i}/v1/lb/${r.applicationId}`,o={headers:{},url:n};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===M0e}};var D0e=new fe(Ci),YWe=1;function L0e(t,e){let r="Web3LegacyFetcher";return function(i,n){let o={method:i,params:n,id:YWe++,jsonrpc:"2.0"};return new Promise((s,a)=>{this.emit("debug",{action:"request",fetcher:r,request:wn(o),provider:this}),e(o,(c,h)=>{if(c)return this.emit("debug",{action:"response",fetcher:r,error:c,request:o,provider:this}),a(c);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:h,provider:this}),h.error){let g=new Error(h.error.message);return g.code=h.error.code,g.data=h.error.data,a(g)}s(h.result)})})}}function JWe(t){return function(e,r){r==null&&(r=[]);let i={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:wn(i),provider:this}),t.request(i).then(n=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,response:n,provider:this}),n),n=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,error:n,provider:this}),n})}}var D5=class extends da{constructor(e,r){e==null&&D0e.throwArgumentError("missing provider","provider",e);let i=null,n=null,o=null;typeof e=="function"?(i="unknown:",n=e):(i=e.host||e.path||"",!i&&e.isMetaMask&&(i="metamask"),o=e,e.request?(i===""&&(i="eip-1193:"),n=JWe(e)):e.sendAsync?n=L0e(e,e.sendAsync.bind(e)):e.send?n=L0e(e,e.send.bind(e)):D0e.throwArgumentError("unsupported provider","provider",e),i||(i="unknown:")),super(i,r),ye(this,"jsonRpcFetchFunc",n),ye(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}};var B0e=new fe(Ci);function J_(t,e){if(t==null&&(t="homestead"),typeof t=="string"){let i=t.match(/^(ws|http)s?:/i);if(i)switch(i[1].toLowerCase()){case"http":case"https":return new da(t);case"ws":case"wss":return new mh(t);default:B0e.throwArgumentError("unsupported URL scheme","network",t)}}let r=m5(t);return(!r||!r._defaultProvider)&&B0e.throwError("unsupported getDefaultProvider network",fe.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:k5,AlchemyProvider:u3,AnkrProvider:S5,CloudflareProvider:I5,EtherscanProvider:T5,InfuraProvider:h3,JsonRpcProvider:da,NodesmithProvider:O5,PocketProvider:M5,Web3Provider:D5,IpcProvider:null},e)}var oc={};Oi(oc,{AbiCoder:()=>Uw,ConstructorFragment:()=>pf,ErrorFragment:()=>Am,EventFragment:()=>rh,FormatTypes:()=>oi,Fragment:()=>df,FunctionFragment:()=>mf,HDNode:()=>If,Indexed:()=>nh,Interface:()=>tp,LogDescription:()=>Ww,Logger:()=>fe,ParamType:()=>zo,RLP:()=>K9,SigningKey:()=>rl,SupportedAlgorithm:()=>Cf,TransactionDescription:()=>Hw,TransactionTypes:()=>E_,UnicodeNormalizationForm:()=>$s,Utf8ErrorFuncs:()=>a_,Utf8ErrorReason:()=>ds,_TypedDataEncoder:()=>Yc,_fetchData:()=>dD,_toEscapedUtf8String:()=>vM,accessListify:()=>nc,arrayify:()=>ke,base58:()=>ch,base64:()=>AM,checkProperties:()=>Pw,checkResultErrors:()=>Mw,commify:()=>q0e,computeAddress:()=>il,computeHmac:()=>lh,computePublicKey:()=>o5,concat:()=>Fr,deepCopy:()=>wn,defaultAbiCoder:()=>e5,defaultPath:()=>uh,defineReadOnly:()=>ye,dnsEncode:()=>r5,entropyToMnemonic:()=>Lm,fetchJson:()=>Zl,formatBytes32String:()=>bM,formatEther:()=>V0e,formatUnits:()=>ID,getAccountPath:()=>Bfe,getAddress:()=>$r,getContractAddress:()=>Sm,getCreate2Address:()=>Qle,getIcapAddress:()=>Jle,getJsonWalletAddress:()=>cD,getStatic:()=>vn,hashMessage:()=>$w,hexConcat:()=>qn,hexDataLength:()=>hs,hexDataSlice:()=>Fi,hexStripZeros:()=>aM,hexValue:()=>uf,hexZeroPad:()=>Kr,hexlify:()=>De,id:()=>Xa,isAddress:()=>Yle,isBytes:()=>Kc,isBytesLike:()=>eh,isHexString:()=>Zt,isValidMnemonic:()=>Lfe,isValidName:()=>SM,joinSignature:()=>zy,keccak256:()=>jr,mnemonicToEntropy:()=>r3,mnemonicToSeed:()=>tD,namehash:()=>ep,nameprep:()=>EM,parseBytes32String:()=>yM,parseEther:()=>K0e,parseTransaction:()=>A_,parseUnits:()=>TD,poll:()=>Yl,randomBytes:()=>Tf,recoverAddress:()=>Nm,recoverPublicKey:()=>__,resolveProperties:()=>ji,ripemd160:()=>l5,serializeTransaction:()=>s5,sha256:()=>ha,sha512:()=>JM,shallowCopy:()=>di,shuffled:()=>h5,solidityKeccak256:()=>j0e,solidityPack:()=>X_,soliditySha256:()=>$0e,splitSignature:()=>ff,stripZeros:()=>Ja,toUtf8Bytes:()=>ui,toUtf8CodePoints:()=>Xd,toUtf8String:()=>ua,verifyMessage:()=>e0e,verifyTypedData:()=>t0e,zeroPad:()=>_m});var U0e="solidity/5.7.0";var QWe=new RegExp("^bytes([0-9]+)$"),XWe=new RegExp("^(u?int)([0-9]*)$"),eHe=new RegExp("^(.*)\\[([0-9]*)\\]$"),tHe="0000000000000000000000000000000000000000000000000000000000000000",d3=new fe(U0e);function F0e(t,e,r){switch(t){case"address":return r?_m(e,32):ke(e);case"string":return ui(e);case"bytes":return ke(e);case"bool":return e=e?"0x01":"0x00",r?_m(e,32):ke(e)}let i=t.match(XWe);if(i){let n=parseInt(i[2]||"256");return(i[2]&&String(n)!==i[2]||n%8!==0||n===0||n>256)&&d3.throwArgumentError("invalid number type","type",t),r&&(n=256),e=Ue.from(e).toTwos(n),_m(e,n/8)}if(i=t.match(QWe),i){let n=parseInt(i[1]);return(String(n)!==i[1]||n===0||n>32)&&d3.throwArgumentError("invalid bytes type","type",t),ke(e).byteLength!==n&&d3.throwArgumentError(`invalid value for ${t}`,"value",e),r?ke((e+tHe).substring(0,66)):e}if(i=t.match(eHe),i&&Array.isArray(e)){let n=i[1];parseInt(i[2]||String(e.length))!=e.length&&d3.throwArgumentError(`invalid array length for ${t}`,"value",e);let s=[];return e.forEach(function(a){s.push(F0e(n,a,!0))}),Fr(s)}return d3.throwArgumentError("invalid type","type",t)}function X_(t,e){t.length!=e.length&&d3.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);let r=[];return t.forEach(function(i,n){r.push(F0e(i,e[n]))}),De(Fr(r))}function j0e(t,e){return jr(X_(t,e))}function $0e(t,e){return ha(X_(t,e))}var W0e="units/5.7.0";var H0e=new fe(W0e),z0e=["wei","kwei","mwei","gwei","szabo","finney","ether"];function q0e(t){let e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||t==="."||t==="-.")&&H0e.throwArgumentError("invalid value","value",t);let r=e[0],i="";for(r.substring(0,1)==="-"&&(i="-",r=r.substring(1));r.substring(0,1)==="0";)r=r.substring(1);r===""&&(r="0");let n="";for(e.length===2&&(n="."+(e[1]||"0"));n.length>2&&n[n.length-1]==="0";)n=n.substring(0,n.length-1);let o=[];for(;r.length;)if(r.length<=3){o.unshift(r);break}else{let s=r.length-3;o.unshift(r.substring(s)),r=r.substring(0,s)}return i+o.join(",")+n}function ID(t,e){if(typeof e=="string"){let r=z0e.indexOf(e);r!==-1&&(e=3*r)}return kw(t,e??18)}function TD(t,e){if(typeof t!="string"&&H0e.throwArgumentError("value must be a string","value",t),typeof e=="string"){let r=z0e.indexOf(e);r!==-1&&(e=3*r)}return Zc(t,e??18)}function V0e(t){return ID(t,18)}function K0e(t){return TD(t,18)}var eE="ethers/5.7.2";var G0e=new fe(eE);try{let t=window;t._ethers==null&&(t._ethers=gh)}catch{}var Si={WALLET_ID:"@w3m/wallet_id",ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3};var _o={getCaipDefaultChain(t){if(t)return{id:`${Ge.EIP155}:${t.chainId}`,name:t.name,imageId:eo.EIP155NetworkImageIds[t.chainId]}},hexStringToNumber(t){let e=t.startsWith("0x")?t.slice(2):t;return parseInt(e,16)},numberToHexString(t){return`0x${t.toString(16)}`},async getUserInfo(t){let[e,r]=await Promise.all([_o.getAddress(t),_o.getChainId(t)]);return{chainId:r,address:e}},async getChainId(t){let e=await t.request({method:"eth_chainId"});return Number(e)},async getAddress(t){let[e]=await t.request({method:"eth_accounts"});return e},async addEthereumChain(t,e){await t.request({method:"wallet_addEthereumChain",params:[{chainId:_o.numberToHexString(e.chainId),rpcUrls:[e.rpcUrl],chainName:e.name,nativeCurrency:{name:e.currency,decimals:18,symbol:e.currency},blockExplorerUrls:[e.explorerUrl],iconUrls:[eo.EIP155NetworkImageIds[e.chainId]]}]})}};Yo();nn();var Gn=Jt({provider:void 0,providerType:void 0,address:void 0,chainId:void 0,status:"reconnecting",isConnected:!1}),ut={state:Gn,subscribeKey(t,e){return fi(Gn,t,e)},subscribe(t){return Dr(Gn,()=>t(Gn))},setProvider(t){t&&(Gn.provider=Po(t))},setProviderType(t){Gn.providerType=t},setAddress(t){Gn.address=t},setPreferredAccountType(t){Gn.preferredAccountType=t},setChainId(t){Gn.chainId=t},setStatus(t){Gn.status=t},setIsConnected(t){Gn.isConnected=t},setError(t){Gn.error=t},reset(){Gn.provider=void 0,Gn.address=void 0,Gn.chainId=void 0,Gn.providerType=void 0,Gn.status="disconnected",Gn.isConnected=!1,Gn.error=void 0,Gn.preferredAccountType=void 0}};Mi();var tE=class extends Mb{constructor(e){let{ethersConfig:r,siweConfig:i,chains:n,defaultChain:o,tokens:s,chainImages:a,_sdkVersion:c,...h}=e;if(!r)throw new Error("web3modal:constructor - ethersConfig is undefined");if(!h.projectId)throw new Error("web3modal:constructor - projectId is undefined");let g={switchCaipNetwork:async E=>{let A=dl.caipNetworkIdToNumber(E?.id);if(A)try{ut.setError(void 0),await this.switchNetwork(A)}catch(T){throw ut.setError(T),new Error("networkControllerClient:switchCaipNetwork - unable to switch chain")}},getApprovedCaipNetworksData:async()=>new Promise(async E=>{if(localStorage.getItem(Si.WALLET_ID)?.includes(Ge.WALLET_CONNECT_CONNECTOR_ID)){let T=await this.getWalletConnectProvider();if(!T)throw new Error("networkControllerClient:getApprovedCaipNetworks - provider is undefined");let P=T.signer?.session?.namespaces,L=P?.[Ge.EIP155]?.methods,j=P?.[Ge.EIP155]?.chains,$={supportsAllNetworks:L?.includes(Ge.ADD_CHAIN_METHOD)??!1,approvedCaipNetworkIds:j};E($)}else E({approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})})},b={connectWalletConnect:async E=>{let A=await this.getWalletConnectProvider();if(!A)throw new Error("connectionControllerClient:getWalletConnectUri - provider is undefined");if(A.on("display_uri",T=>{E(T)}),i?.options?.enabled){let{SIWEController:T,getDidChainId:P,getDidAddress:L}=await Promise.resolve().then(()=>(S0(),C0)),$=(await A.authenticate({nonce:await i.getNonce(),methods:tM,...await i.getMessageParams()}))?.auths?.[0];if($){let{p:G,s:Z}=$,te=P(G.iss),se=L(G.iss);se&&te&&T.setSession({address:se,chainId:parseInt(te,10)});try{let X=A.signer.client.formatAuthMessage({request:G,iss:G.iss});await T.verifyMessage({message:X,signature:Z.s,cacao:$})}catch(X){throw console.error("Error verifying message",X),await A.disconnect().catch(console.error),await T.signOut().catch(console.error),X}}}else await A.connect();await this.setWalletConnectProvider()},connectExternal:async({id:E,info:A,provider:T})=>{if(E===Ge.INJECTED_CONNECTOR_ID){let P=r.injected;if(!P)throw new Error("connectionControllerClient:connectInjected - provider is undefined");try{ut.setError(void 0),await P.request({method:"eth_requestAccounts"}),this.setInjectedProvider(r)}catch(L){ut.setError(L)}}else if(E===Ge.EIP6963_CONNECTOR_ID&&A&&T){try{ut.setError(void 0),await T.request({method:"eth_requestAccounts"})}catch(P){ut.setError(P)}this.setEIP6963Provider(T,A.name)}else if(E===Ge.COINBASE_SDK_CONNECTOR_ID){let P=r.coinbase;if(!P)throw new Error("connectionControllerClient:connectCoinbase - connector is undefined");try{ut.setError(void 0),await P.request({method:"eth_requestAccounts"}),this.setCoinbaseProvider(r)}catch(L){throw ut.setError(L),new Error(L.message)}}},checkInstalled:E=>E?r.injected&&!window?.ethereum?!1:E.some(A=>!!window.ethereum?.[String(A)]):!!window.ethereum,disconnect:async()=>{let E=ut.state.provider,A=ut.state.providerType;if(localStorage.removeItem(Si.WALLET_ID),ut.reset(),i?.options?.signOutOnDisconnect){let{SIWEController:T}=await Promise.resolve().then(()=>(S0(),C0));await T.signOut()}A===Ge.WALLET_CONNECT_CONNECTOR_ID?await E.disconnect():E&&E.emit("disconnect")},signMessage:async E=>{let A=ut.state.provider;if(!A)throw new Error("connectionControllerClient:signMessage - provider is undefined");let T=oc.isHexString(E)?E:oc.hexlify(oc.toUtf8Bytes(E));return await A.request({method:"personal_sign",params:[T,this.getAddress()]})},parseUnits:(E,A)=>gh.utils.parseUnits(E,A).toBigInt(),formatUnits:(E,A)=>gh.utils.formatUnits(E,A),sendTransaction:async E=>{let A=ut.state.provider,T=ut.state.address;if(!A)throw new Error("connectionControllerClient:sendTransaction - provider is undefined");if(!T)throw new Error("connectionControllerClient:sendTransaction - address is undefined");let P={to:E.to,value:E.value,gasLimit:E.gas,gasPrice:E.gasPrice,data:E.data,type:0};return(await(await new gh.providers.Web3Provider(A).getSigner().sendTransaction(P)).wait())?.blockHash||null}};super({networkControllerClient:g,connectionControllerClient:b,siweControllerClient:i,defaultChain:_o.getCaipDefaultChain(o),tokens:LI.getCaipTokens(s),_sdkVersion:c??`html-ethers5-${Ge.VERSION}`,...h}),this.hasSyncedConnectedAccount=!1,this.EIP6963Providers=[],this.options=void 0,this.options=e,this.metadata=r.metadata,this.projectId=h.projectId,this.chains=n,this.createProvider(),ut.subscribeKey("address",()=>{this.syncAccount()}),ut.subscribeKey("chainId",()=>{this.syncNetwork(a)}),this.syncRequestedNetworks(n,a),this.syncConnectors(r),r.injected&&this.checkActiveInjectedProvider(r),r.coinbase&&this.checkActiveCoinbaseProvider(r),typeof window<"u"&&(this.listenConnectors(!0),this.checkActive6963Provider()),this.setEIP6963Enabled(r.EIP6963)}getState(){let e=super.getState();return{...e,selectedNetworkId:dl.caipNetworkIdToNumber(e.selectedNetworkId)}}subscribeState(e){return super.subscribeState(r=>e({...r,selectedNetworkId:dl.caipNetworkIdToNumber(r.selectedNetworkId)}))}setAddress(e){let r=e?oc.getAddress(e):void 0;ut.setAddress(r)}getAddress(){let{address:e}=ut.state;return e&&oc.getAddress(e)}getError(){return ut.state.error}getChainId(){return ut.state.chainId}getStatus(){return ut.state.status}getIsConnected(){return ut.state.isConnected}getWalletProvider(){return ut.state.provider}getWalletProviderType(){return ut.state.providerType}subscribeProvider(e){return ut.subscribe(e)}async disconnect(){let{provider:e,providerType:r}=ut.state;localStorage.removeItem(Si.WALLET_ID),ut.reset(),r==="injected"||r==="eip6963"?e?.emit("disconnect"):await e.disconnect()}createProvider(){return!this.walletConnectProviderInitPromise&&typeof window<"u"&&(this.walletConnectProviderInitPromise=this.initWalletConnectProvider()),this.walletConnectProviderInitPromise}async initWalletConnectProvider(){let e={projectId:this.projectId,showQrModal:!1,rpcMap:this.chains?this.chains.reduce((r,i)=>(r[i.chainId]=i.rpcUrl,r),{}):{},optionalChains:[...this.chains.map(r=>r.chainId)],metadata:{name:this.metadata?this.metadata.name:"",description:this.metadata?this.metadata.description:"",url:this.metadata?this.metadata.url:"",icons:this.metadata?this.metadata.icons:[""]}};this.walletConnectProvider=await F9.init(e),await this.checkActiveWalletConnectProvider()}async getWalletConnectProvider(){if(!this.walletConnectProvider)try{ut.setError(void 0),await this.createProvider()}catch(e){ut.setError(e)}return this.walletConnectProvider}syncRequestedNetworks(e,r){let i=e?.map(n=>({id:`${Ge.EIP155}:${n.chainId}`,name:n.name,imageId:eo.EIP155NetworkImageIds[n.chainId],imageUrl:r?.[n.chainId]}));this.setRequestedCaipNetworks(i??[])}async checkActiveWalletConnectProvider(){let e=await this.getWalletConnectProvider(),r=localStorage.getItem(Si.WALLET_ID);e&&r===Ge.WALLET_CONNECT_CONNECTOR_ID&&await this.setWalletConnectProvider();let i=ut.state.isConnected;ut.setStatus(i?"connected":"disconnected")}checkActiveInjectedProvider(e){let r=e.injected,i=localStorage.getItem(Si.WALLET_ID);r&&i===Ge.INJECTED_CONNECTOR_ID&&(this.setInjectedProvider(e),this.watchInjected(e))}checkActiveCoinbaseProvider(e){let r=e.coinbase,i=localStorage.getItem(Si.WALLET_ID);r&&i===Ge.COINBASE_SDK_CONNECTOR_ID&&(r._addresses&&r._addresses?.length>0?(this.setCoinbaseProvider(e),this.watchCoinbase(e)):(localStorage.removeItem(Si.WALLET_ID),ut.reset()))}checkActive6963Provider(){let e=window?.localStorage.getItem(Si.WALLET_ID);if(e){let r=this.EIP6963Providers.find(i=>i.info.name===e);r&&this.setEIP6963Provider(r.provider,r.info.name)}}async setWalletConnectProvider(){window?.localStorage.setItem(Si.WALLET_ID,Ge.WALLET_CONNECT_CONNECTOR_ID);let e=await this.getWalletConnectProvider();e&&(ut.setChainId(e.chainId),ut.setProviderType("walletConnect"),ut.setProvider(e),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(e.accounts?.[0]),this.watchWalletConnect())}async setEIP6963Provider(e,r){if(window?.localStorage.setItem(Si.WALLET_ID,r),e){let{address:i,chainId:n}=await _o.getUserInfo(e);i&&n&&(ut.setChainId(n),ut.setProviderType("eip6963"),ut.setProvider(e),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchEIP6963(e))}}async setInjectedProvider(e){window?.localStorage.setItem(Si.WALLET_ID,Ge.INJECTED_CONNECTOR_ID);let r=e.injected;if(r){let{address:i,chainId:n}=await _o.getUserInfo(r);i&&n&&(ut.setChainId(n),ut.setProviderType("injected"),ut.setProvider(e.injected),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchCoinbase(e))}}async setCoinbaseProvider(e){window?.localStorage.setItem(Si.WALLET_ID,Ge.COINBASE_SDK_CONNECTOR_ID);let r=e.coinbase;if(r){let{address:i,chainId:n}=await _o.getUserInfo(r);i&&n&&(ut.setChainId(n),ut.setProviderType("coinbaseWalletSDK"),ut.setProvider(e.coinbase),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchCoinbase(e))}}async watchWalletConnect(){let e=await this.getWalletConnectProvider();function r(){localStorage.removeItem(Si.WALLET_ID),ut.reset(),e?.removeListener("disconnect",r),e?.removeListener("accountsChanged",n),e?.removeListener("chainChanged",i)}function i(o){if(o){let s=_o.hexStringToNumber(o);ut.setChainId(s)}}let n=async o=>{o.length>0&&await this.setWalletConnectProvider()};e&&(e.on("disconnect",r),e.on("accountsChanged",n),e.on("chainChanged",i))}watchInjected(e){let r=e.injected;function i(){localStorage.removeItem(Si.WALLET_ID),ut.reset(),r?.removeListener("disconnect",i),r?.removeListener("accountsChanged",n),r?.removeListener("chainChanged",o)}function n(s){let a=s?.[0];a?ut.setAddress(oc.getAddress(a)):(localStorage.removeItem(Si.WALLET_ID),ut.reset())}function o(s){if(s){let a=typeof s=="string"?_o.hexStringToNumber(s):Number(s);ut.setChainId(a)}}r&&(r.on("disconnect",i),r.on("accountsChanged",n),r.on("chainChanged",o))}watchEIP6963(e){function r(){localStorage.removeItem(Si.WALLET_ID),ut.reset(),e.removeListener("disconnect",r),e.removeListener("accountsChanged",i),e.removeListener("chainChanged",n)}function i(o){let s=o?.[0];s?ut.setAddress(oc.getAddress(s)):(localStorage.removeItem(Si.WALLET_ID),ut.reset())}function n(o){if(o){let s=typeof o=="string"?_o.hexStringToNumber(o):Number(o);ut.setChainId(s)}}e.on("disconnect",r),e.on("accountsChanged",i),e.on("chainChanged",n)}watchCoinbase(e){let r=e.coinbase,i=localStorage.getItem(Si.WALLET_ID);function n(){localStorage.removeItem(Si.WALLET_ID),ut.reset(),r?.removeListener("disconnect",n),r?.removeListener("accountsChanged",o),r?.removeListener("chainChanged",s)}function o(a){a.length===0?(localStorage.removeItem(Si.WALLET_ID),ut.reset()):ut.setAddress(a[0])}function s(a){if(a&&i===Ge.COINBASE_SDK_CONNECTOR_ID){let c=Number(a);ut.setChainId(c)}}r&&(r.on("disconnect",n),r.on("accountsChanged",o),r.on("chainChanged",s))}async syncAccount(){let e=ut.state.address,r=ut.state.chainId,i=ut.state.isConnected;if(this.resetAccount(),i&&e&&r){let n=`${Ge.EIP155}:${r}:${e}`;this.setIsConnected(i),this.setCaipAddress(n),this.syncConnectedWalletInfo(),await Promise.all([this.syncProfile(e),this.syncBalance(e),this.getApprovedCaipNetworksData()]),this.hasSyncedConnectedAccount=!0}else!i&&this.hasSyncedConnectedAccount&&(this.resetWcConnection(),this.resetNetwork())}async syncNetwork(e){let r=ut.state.address,i=ut.state.chainId,n=ut.state.isConnected;if(this.chains){let o=this.chains.find(s=>s.chainId===i);if(o){let s=`${Ge.EIP155}:${o.chainId}`;if(this.setCaipNetwork({id:s,name:o.name,imageId:eo.EIP155NetworkImageIds[o.chainId],imageUrl:e?.[o.chainId]}),n&&r){let a=`${Ge.EIP155}:${i}:${r}`;if(this.setCaipAddress(a),o.explorerUrl){let c=`${o.explorerUrl}/address/${r}`;this.setAddressExplorerUrl(c)}else this.setAddressExplorerUrl(void 0);this.hasSyncedConnectedAccount&&await this.syncBalance(r)}}else n&&this.setCaipNetwork({id:`${Ge.EIP155}:${i}`})}}async syncProfile(e){let r=ut.state.chainId;try{let{name:i,avatar:n}=await this.fetchIdentity({address:e});this.setProfileName(i),this.setProfileImage(n)}catch{if(r===1){let i=new gh.providers.InfuraProvider("mainnet"),n=await i.lookupAddress(e),o=await i.getAvatar(e);n&&this.setProfileName(n),o&&this.setProfileImage(o)}else this.setProfileName(null),this.setProfileImage(null)}}async syncBalance(e){let r=ut.state.chainId;if(r&&this.chains){let i=this.chains.find(n=>n.chainId===r);if(i){let n=new gh.providers.JsonRpcProvider(i.rpcUrl,{chainId:r,name:i.name});if(n){let o=await n.getBalance(e),s=oc.formatEther(o);this.setBalance(s,i.currency)}}}}syncConnectedWalletInfo(){let e=window?.localStorage.getItem(Si.WALLET_ID),r=ut.state.providerType;if(r===Ge.EIP6963_CONNECTOR_ID){if(e){let i=this.EIP6963Providers.find(n=>n.info.name===e);i&&this.setConnectedWalletInfo({...i.info})}}else if(r===Ge.WALLET_CONNECT_CONNECTOR_ID){let i=ut.state.provider;i.session&&this.setConnectedWalletInfo({...i.session.peer.metadata,name:i.session.peer.metadata.name,icon:i.session.peer.metadata.icons?.[0]})}else e&&this.setConnectedWalletInfo({name:e})}async switchNetwork(e){let r=ut.state.provider,i=ut.state.providerType;if(this.chains){let n=this.chains.find(o=>o.chainId===e);if(i===Ge.WALLET_CONNECT_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:_o.numberToHexString(n.chainId)}]}),ut.setChainId(e)}catch(s){if(s.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Si.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await _o.addEthereumChain(o,n);else throw new Error("Chain is not supported")}}else if(i===Ge.EIP6963_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:_o.numberToHexString(n.chainId)}]}),ut.setChainId(n.chainId)}catch(s){if(s.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Si.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await _o.addEthereumChain(o,n);else throw new Error("Chain is not supported")}}else if(i===Ge.COINBASE_SDK_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:_o.numberToHexString(n.chainId)}]}),ut.setChainId(n.chainId)}catch(s){(s.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Si.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)&&await _o.addEthereumChain(o,n)}}}}syncConnectors(e){let r=[],i=eo.ConnectorTypesMap[Ge.WALLET_CONNECT_CONNECTOR_ID];if(i&&r.push({id:Ge.WALLET_CONNECT_CONNECTOR_ID,explorerId:eo.ConnectorExplorerIds[Ge.WALLET_CONNECT_CONNECTOR_ID],imageId:eo.ConnectorImageIds[Ge.WALLET_CONNECT_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.WALLET_CONNECT_CONNECTOR_ID],name:eo.ConnectorNamesMap[Ge.WALLET_CONNECT_CONNECTOR_ID],type:i}),e.injected){let n=eo.ConnectorTypesMap[Ge.INJECTED_CONNECTOR_ID];n&&r.push({id:Ge.INJECTED_CONNECTOR_ID,explorerId:eo.ConnectorExplorerIds[Ge.INJECTED_CONNECTOR_ID],imageId:eo.ConnectorImageIds[Ge.INJECTED_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.INJECTED_CONNECTOR_ID],name:eo.ConnectorNamesMap[Ge.INJECTED_CONNECTOR_ID],type:n})}e.coinbase&&r.push({id:Ge.COINBASE_SDK_CONNECTOR_ID,explorerId:eo.ConnectorExplorerIds[Ge.COINBASE_SDK_CONNECTOR_ID],imageId:eo.ConnectorImageIds[Ge.COINBASE_SDK_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.COINBASE_SDK_CONNECTOR_ID],name:eo.ConnectorNamesMap[Ge.COINBASE_SDK_CONNECTOR_ID],type:"EXTERNAL"}),this.setConnectors(r)}eip6963EventHandler(e){if(e.detail){let{info:r,provider:i}=e.detail,n=this.getConnectors(),o=n.find(c=>c.name===r.name),a=n.find(c=>c.id===Ge.COINBASE_SDK_CONNECTOR_ID)&&e.detail.info.rdns===Ge.CONNECTOR_RDNS_MAP[Ge.COINBASE_SDK_CONNECTOR_ID];if(!o&&!a){let c=eo.ConnectorTypesMap[Ge.EIP6963_CONNECTOR_ID];if(c){this.addConnector({id:Ge.EIP6963_CONNECTOR_ID,type:c,imageUrl:r.icon??this.options?.connectorImages?.[Ge.EIP6963_CONNECTOR_ID],name:r.name,provider:i,info:r});let h={provider:i,info:r};this.EIP6963Providers.push(h)}}}}listenConnectors(e){if(typeof window<"u"&&e){let r=this.eip6963EventHandler.bind(this);window.addEventListener(Ge.EIP6963_ANNOUNCE_EVENT,r),window.dispatchEvent(new Event(Ge.EIP6963_REQUEST_EVENT))}}};aS();var Z1e=Wt(G1e(),1);function aB(t){let{enableEIP6963:e=!0,enableInjected:r=!0,enableCoinbase:i=!0,metadata:n}=t,o,s,a={metadata:n};function c(){if(o)return o;if(!(typeof window>"u")&&window.ethereum)return o=window.ethereum,o}function h(){return s||(typeof window>"u"?void 0:(s=new Z1e.CoinbaseWalletSDK({appName:n.name,appLogoUrl:n.icons[0],appChainIds:t.chains?.map(b=>b.chainId)||[1,84532]}).makeWeb3Provider({options:t.coinbasePreference||"all"}),s))}return i&&(a.coinbase=h()),r&&(a.injected=c()),e&&(a.EIP6963=!0),a}function Y1e(t){return new tE({...t,_sdkVersion:`html-ethers5-${Ge.VERSION}`})}var OGe=(t=>(t.MissingApiKey="MISSING_API_KEY",t.ModalNotReady="MODAL_NOT_READY",t.ConnectionLost="CONNECTION_WAS_LOST",t.MalformedResponse="MALFORMED_RESPONSE",t.InvalidArgument="INVALID_ARGUMENT",t.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",t.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",t))(OGe||{}),MGe=(t=>(t.SyncWeb3Method="SYNC_WEB3_METHOD",t.DuplicateIframe="DUPLICATE_IFRAME",t.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",t.DeprecationNotice="DEPRECATION_NOTICE",t.ProductAnnouncement="ANNOUNCEMENT",t))(MGe||{}),DGe=(t=>(t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",t[t.MagicLinkExpired=-10001]="MagicLinkExpired",t[t.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",t[t.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",t[t.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",t[t.UpdateEmailFailed=-10004]="UpdateEmailFailed",t[t.UserRequestEditEmail=-10005]="UserRequestEditEmail",t[t.InactiveRecipient=-10010]="InactiveRecipient",t[t.AccessDeniedToUser=-10011]="AccessDeniedToUser",t[t.RedirectLoginComplete=-10015]="RedirectLoginComplete",t[t.DpopInvalidated=-10019]="DpopInvalidated",t))(DGe||{}),Ql=(t=>(t.PROVIDER="magic_3pw_provider",t.ADDRESS="magic_3pw_address",t.CHAIN_ID="magic_3pw_chainId",t))(Ql||{}),M3=(t=>(t.WalletConnected="wallet_connected",t.WalletRejected="wallet_rejected",t.Web3ModalSelected="web3modal_selected",t))(M3||{}),LGe=(t=>(t.LoginWithSms="magic_auth_login_with_sms",t.LoginWithEmailOTP="magic_auth_login_with_email_otp",t.LoginWithMagicLink="magic_auth_login_with_magic_link",t.LoginWithCredential="magic_auth_login_with_credential",t.SetAuthorizationToken="magic_auth_set_authorization_token",t.GetIdToken="magic_auth_get_id_token",t.GenerateIdToken="magic_auth_generate_id_token",t.GetMetadata="magic_auth_get_metadata",t.IsLoggedIn="magic_is_logged_in",t.Logout="magic_auth_logout",t.UpdateEmail="magic_auth_update_email",t.UserSettings="magic_auth_settings",t.UserSettingsTestMode="magic_auth_settings_testing_mode",t.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",t.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",t.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",t.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",t.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",t.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",t.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",t.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",t.LogoutTestMode="magic_auth_logout_testing_mode",t.UpdateEmailTestMode="magic_auth_update_email_testing_mode",t.IntermediaryEvent="magic_intermediary_event",t.RequestAccounts="eth_requestAccounts",t.GetInfo="magic_get_info",t.ShowUI="magic_wallet",t.NFTPurchase="magic_nft_purchase",t.NFTCheckout="magic_nft_checkout",t.NFTTransfer="magic_nft_transfer",t.RequestUserInfoWithUI="mc_request_user_info",t.Disconnect="mc_disconnect",t.RecoverAccount="magic_auth_recover_account",t.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",t.MagicBoxHeartBeat="magic_box_heart_beat",t.AutoConnect="mc_auto_connect",t.Login="mc_login",t.EncryptV1="magic_auth_encrypt_v1",t.DecryptV1="magic_auth_decrypt_v1",t.ShowNFTs="magic_show_nfts",t.ShowOnRamp="magic_show_fiat_onramp",t.ShowSendTokensUI="magic_show_send_tokens_ui",t.ShowAddress="magic_show_address",t.ShowBalances="magic_show_balances",t.SendGaslessTransaction="eth_sendGaslessTransaction",t.RevealPK="magic_reveal_key",t.EnableMFA="magic_auth_enable_mfa_flow",t.DisableMFA="magic_auth_disable_mfa_flow",t))(LGe||{});var BGe=(t=>(t.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",t.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",t.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",t.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",t.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",t.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",t.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",t.MAGIC_PONG="MAGIC_PONG",t.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",t.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",t))(BGe||{}),UGe=(t=>(t.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",t.MAGIC_PING="MAGIC_PING",t))(UGe||{}),FGe=(t=>(t.UpdateEmail="update-email",t.MFA="mfa",t.Recovery="recovery",t))(FGe||{}),jGe=(t=>(t.Retry="retry",t))(jGe||{}),$Ge=(t=>(t.EmailSent="email-sent",t.EmailNotDeliverable="email-not-deliverable",t))($Ge||{}),WGe=(t=>(t.VerifyEmailOtp="verify-email-otp",t.VerifyMFACode="verify-mfa-code",t.LostDevice="lost-device",t.VerifyRecoveryCode="verify-recovery-code",t.Cancel="cancel",t))(WGe||{}),HGe=(t=>(t.VerifySmsOtp="verify-sms-otp",t.Cancel="cancel",t.Retry="retry",t))(HGe||{}),zGe=(t=>(t.SmsOTPSent="sms-otp-sent",t.InvalidSmsOtp="invalid-sms-otp",t.ExpiredSmsOtp="expired-sms-otp",t))(zGe||{}),qGe=(t=>(t.EmailOTPSent="email-otp-sent",t.InvalidEmailOtp="invalid-email-otp",t.InvalidMfaOtp="invalid-mfa-otp",t.ExpiredEmailOtp="expired-email-otp",t.MfaSentHandle="mfa-sent-handle",t.RecoveryCodeSentHandle="recovery-code-sent-handle",t.InvalidRecoveryCode="invalid-recovery-code",t.RecoveryCodeSuccess="recovery-code-success",t.LoginThrottled="login-throttled",t))(qGe||{}),VGe=(t=>(t.Retry="device-retry",t))(VGe||{}),KGe=(t=>(t.DeviceApproved="device-approved",t.DeviceNeedsApproval="device-needs-approval",t.DeviceVerificationLinkExpired="device-verification-link-expired",t.DeviceVerificationEmailSent="device-verification-email-sent",t))(KGe||{}),GGe=(t=>(t.Retry="Recency/auth-factor-retry",t.Cancel="Recency/auth-factor-verification-cancel",t.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",t.VerifyMFACode="Recency/verify-mfa-code",t))(GGe||{}),ZGe=(t=>(t.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",t.PrimaryAuthFactorVerified="Recency/auth-factor-verified",t.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",t.EmailExpired="Recency/auth-factor-verification-email-expired",t.EmailSent="Recency/auth-factor-verification-email-sent",t.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",t))(ZGe||{}),YGe=(t=>(t.RetryWithNewEmail="UpdateEmail/retry-with-new-email",t.Cancel="UpdateEmail/new-email-verification-cancel",t.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",t))(YGe||{}),JGe=(t=>(t.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",t.EmailUpdated="UpdateEmail/email-updated",t.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",t.EmailExpired="UpdateEmail/new-email-verification-email-expired",t.EmailSent="UpdateEmail/new-email-verification-email-sent",t.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",t.InvalidEmail="UpdateEmail/new-email-invalid",t.EmailAlreadyExists="UpdateEmail/new-email-already-exists",t))(JGe||{}),QGe=(t=>(t.IDTokenCreated="Auth/id-token-created",t))(QGe||{}),XGe=(t=>(t.Cancel="Farcaster/cancel",t))(XGe||{}),eZe=(t=>(t.MFASecretGenerated="mfa-secret-generated",t.InvalidMFAOtp="invalid-mfa-otp",t.MFARecoveryCodes="mfa-recovery-codes",t))(eZe||{}),tZe=(t=>(t.VerifyMFACode="verify-mfa-code",t.Cancel="cancel-mfa-setup",t))(tZe||{}),rZe=(t=>(t.MFACodeRequested="mfa-code-requested",t.InvalidMFAOtp="invalid-mfa-otp",t.InvalidRecoveryCode="invalid-recovery-code",t))(rZe||{}),iZe=(t=>(t.VerifyMFACode="verify-mfa-code",t.LostDevice="lost-device",t.Cancel="cancel-mfa-disable",t))(iZe||{}),nZe=(t=>(t.Harmony="HARMONY",t))(nZe||{}),oZe=(t=>(t.ClosedByUser="closed-by-user",t))(oZe||{}),sZe=(t=>(t.ClosedByUser="closed-by-user-on-received",t))(sZe||{}),aZe=(t=>(t.EnterNewPhoneNumber="enter-new-phone-number",t.EnterOtpCode="enter-otp-code",t.RecoveryFactorAlreadyExists="recovery-factor-already-exists",t.MalformedPhoneNumber="malformed-phone-number",t.InvalidOtpCode="invalid-otp-code",t))(aZe||{}),cZe=(t=>(t.SendNewPhoneNumber="send-new-phone-number",t.SendOtpCode="send-otp-code",t.Cancel="cancel",t.StartEditPhoneNumber="start-edit-phone-number",t))(cZe||{}),lZe=(t=>(t.PhoneNumber="phone_number",t))(lZe||{}),uZe=(t=>(t.SmsOtpSent="sms-otp-sent",t.LoginThrottled="login-throttled",t.InvalidSmsOtp="invalid-sms-otp",t.SmsVerified="sms-verified",t.AccountRecovered="account-recovered",t.UpdateEmailRequired="update-email-required",t))(uZe||{}),fZe=(t=>(t.Cancel="cancel",t.VerifyOtp="verify-otp-code",t.ResendSms="resend-sms-otp",t.UpdateEmail="update-email",t))(fZe||{}),hZe=(t=>(t.Success="nft-checkout-success",t.Failure="nft-checkout-failure",t.Initiated="nft-checkout-initiated",t.Disconnect="disconnect",t))(hZe||{}),dZe=(t=>(t.WalletInfoFetched="Wallet/wallet-info-fetched",t))(dZe||{}),pZe=(t=>(t.CloseMagicWindow="close-magic-window",t))(pZe||{});var dA=class t extends J1e.Extension.Internal{name="web3modal";config={};modal;static eventsListenerAdded=!1;constructor({configOptions:e,modalOptions:r}){super(),this.modal=Y1e({...r,themeVariables:{...r.themeVariables||{},"--w3m-z-index":3e9},ethersConfig:aB(e)});let i=this.modal.subscribeProvider(({status:n})=>{n==="connected"&&(i(),this.setIsConnected(),this.setEip1193EventListeners()),n==="disconnected"&&i()})}setIsConnected(){localStorage.setItem(Ql.PROVIDER,"web3modal"),localStorage.setItem(Ql.ADDRESS,this.modal.getAddress()),localStorage.setItem(Ql.CHAIN_ID,this.modal.getChainId().toString()),this.sdk.thirdPartyWallets.isConnected=!0}initialize(){this.sdk.thirdPartyWallets.enabledWallets.web3modal=!0,this.sdk.thirdPartyWallets.isConnected=!!localStorage.getItem(Ql.ADDRESS),this.sdk.thirdPartyWallets.eventListeners.push({event:M3.Web3ModalSelected,callback:async e=>{await this.connectToWeb3modal(e)}})}setEip1193EventListeners(){t.eventsListenerAdded||(t.eventsListenerAdded=!0,this.modal.subscribeProvider(({address:e,chainId:r})=>!e&&localStorage.getItem(Ql.ADDRESS)?(this.sdk.thirdPartyWallets.resetThirdPartyWalletState(),this.sdk.rpcProvider.emit("accountsChanged",[])):e&&e!==localStorage.getItem(Ql.ADDRESS)?(localStorage.setItem(Ql.ADDRESS,e),this.sdk.rpcProvider.emit("accountsChanged",[e])):r&&r!==Number(localStorage.getItem(Ql.CHAIN_ID))?(localStorage.setItem(Ql.CHAIN_ID,r.toString()),this.sdk.rpcProvider.emit("chainChanged",r)):null))}handleUserConnected(e,r=this.modal.getAddress()){this.setIsConnected(),this.createIntermediaryEvent(M3.WalletConnected,e)(r),this.setEip1193EventListeners()}connectToWeb3modal(e){let{modal:r}=this;return this.utils.createPromiEvent(async()=>{try{r.getIsConnected()&&await r.disconnect()}catch(s){console.error(s)}let n=r.subscribeProvider(({address:s,error:a})=>{a&&(console.error("Provider event error:",a),n(),this.createIntermediaryEvent(M3.WalletRejected,e)()),s&&(this.handleUserConnected(e),n())}),o=r.subscribeEvents(s=>{s.data.event==="MODAL_CLOSE"&&(o(),n(),this.createIntermediaryEvent(M3.WalletRejected,e)())});r.open()})}};var mZe=dA;return Zf(gZe);})();
9978
+ `)}static register(e,r){if(r||(r=e.locale),oWe)try{let i=window;i._ethers&&i._ethers.wordlists&&(i._ethers.wordlists[r]||ye(i._ethers.wordlists,r,e))}catch{}}};var sWe="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo",u5=null;function Pfe(t){if(u5==null&&(u5=sWe.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Sf.check(t)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw u5=null,new Error("BIP39 Wordlist for en (English) FAILED")}var QM=class extends Sf{constructor(){super("en")}getWord(e){return Pfe(this),u5[e]}getWordIndex(e){return Pfe(this),u5.indexOf(e)}},XM=new QM;Sf.register(XM);var Dm={en:XM};var Ofe="hdnode/5.7.0";var f5=new fe(Ofe),aWe=Ue.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),cWe=ui("Bitcoin seed"),t3=2147483648;function Dfe(t){return(1<<t)-1<<8-t}function lWe(t){return(1<<t)-1}function k_(t){return Kr(De(t),32)}function Mfe(t){return ch.encode(Fr([t,Fi(ha(ha(t)),0,4)]))}function eD(t){if(t==null)return Dm.en;if(typeof t=="string"){let e=Dm[t];return e==null&&f5.throwArgumentError("unknown locale","wordlist",t),e}return t}var e3={},uh="m/44'/60'/0'/0/0",If=class t{constructor(e,r,i,n,o,s,a,c){if(e!==e3)throw new Error("HDNode constructor cannot be called directly");if(r){let h=new rl(r);ye(this,"privateKey",h.privateKey),ye(this,"publicKey",h.compressedPublicKey)}else ye(this,"privateKey",null),ye(this,"publicKey",De(i));ye(this,"parentFingerprint",n),ye(this,"fingerprint",Fi(l5(ha(this.publicKey)),0,4)),ye(this,"address",il(this.publicKey)),ye(this,"chainCode",o),ye(this,"index",s),ye(this,"depth",a),c==null?(ye(this,"mnemonic",null),ye(this,"path",null)):typeof c=="string"?(ye(this,"mnemonic",null),ye(this,"path",c)):(ye(this,"mnemonic",c),ye(this,"path",c.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return Mfe(Fr([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",De(this.depth),this.parentFingerprint,Kr(De(this.index),4),this.chainCode,this.privateKey!=null?Fr(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new t(e3,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let r=this.path;r&&(r+="/"+(e&~t3));let i=new Uint8Array(37);if(e&t3){if(!this.privateKey)throw new Error("cannot derive child of neutered node");i.set(ke(this.privateKey),1),r&&(r+="'")}else i.set(ke(this.publicKey));for(let b=24;b>=0;b-=8)i[33+(b>>3)]=e>>24-b&255;let n=ke(lh(Cf.sha512,this.chainCode,i)),o=n.slice(0,32),s=n.slice(32),a=null,c=null;this.privateKey?a=k_(Ue.from(o).add(this.privateKey).mod(aWe)):c=new rl(De(o))._addPoint(this.publicKey);let h=r,g=this.mnemonic;return g&&(h=Object.freeze({phrase:g.phrase,path:r,locale:g.locale||"en"})),new t(e3,a,c,this.fingerprint,k_(s),e,this.depth+1,h)}derivePath(e){let r=e.split("/");if(r.length===0||r[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+e);r[0]==="m"&&r.shift();let i=this;for(let n=0;n<r.length;n++){let o=r[n];if(o.match(/^[0-9]+'$/)){let s=parseInt(o.substring(0,o.length-1));if(s>=t3)throw new Error("invalid path index - "+o);i=i._derive(t3+s)}else if(o.match(/^[0-9]+$/)){let s=parseInt(o);if(s>=t3)throw new Error("invalid path index - "+o);i=i._derive(s)}else throw new Error("invalid path component - "+o)}return i}static _fromSeed(e,r){let i=ke(e);if(i.length<16||i.length>64)throw new Error("invalid seed");let n=ke(lh(Cf.sha512,cWe,i));return new t(e3,k_(n.slice(0,32)),null,"0x00000000",k_(n.slice(32)),0,0,r)}static fromMnemonic(e,r,i){return i=eD(i),e=Lm(r3(e,i),i),t._fromSeed(tD(e,r),{phrase:e,path:"m",locale:i.locale})}static fromSeed(e){return t._fromSeed(e,null)}static fromExtendedKey(e){let r=ch.decode(e);(r.length!==82||Mfe(r.slice(0,78))!==e)&&f5.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");let i=r[4],n=De(r.slice(5,9)),o=parseInt(De(r.slice(9,13)).substring(2),16),s=De(r.slice(13,45)),a=r.slice(45,78);switch(De(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new t(e3,null,De(a),n,s,o,i,null);case"0x0488ade4":case"0x04358394 ":if(a[0]!==0)break;return new t(e3,De(a.slice(1)),null,n,s,o,i,null)}return f5.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}};function tD(t,e){e||(e="");let r=ui("mnemonic"+e,$s.NFKD);return Mm(ui(t,$s.NFKD),r,2048,64,"sha512")}function r3(t,e){e=eD(e),f5.checkNormalize();let r=e.split(t);if(r.length%3!==0)throw new Error("invalid mnemonic");let i=ke(new Uint8Array(Math.ceil(11*r.length/8))),n=0;for(let h=0;h<r.length;h++){let g=e.getWordIndex(r[h].normalize("NFKD"));if(g===-1)throw new Error("invalid mnemonic");for(let b=0;b<11;b++)g&1<<10-b&&(i[n>>3]|=1<<7-n%8),n++}let o=32*r.length/3,s=r.length/3,a=Dfe(s);if((ke(ha(i.slice(0,o/8)))[0]&a)!==(i[i.length-1]&a))throw new Error("invalid checksum");return De(i.slice(0,o/8))}function Lm(t,e){if(e=eD(e),t=ke(t),t.length%4!==0||t.length<16||t.length>32)throw new Error("invalid entropy");let r=[0],i=11;for(let s=0;s<t.length;s++)i>8?(r[r.length-1]<<=8,r[r.length-1]|=t[s],i-=8):(r[r.length-1]<<=i,r[r.length-1]|=t[s]>>8-i,r.push(t[s]&lWe(8-i)),i+=3);let n=t.length/4,o=ke(ha(t))[0]&Dfe(n);return r[r.length-1]<<=n,r[r.length-1]|=o>>8-n,e.join(r.map(s=>e.getWord(s)))}function Lfe(t,e){try{return r3(t,e),!0}catch{}return!1}function Bfe(t){return(typeof t!="number"||t<0||t>=t3||t%1)&&f5.throwArgumentError("invalid account index","index",t),`m/44'/60'/${t}'/0/0`}var Ufe="random/5.7.0";var rD=new fe(Ufe);function uWe(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}var Ffe=uWe(),N_=Ffe.crypto||Ffe.msCrypto;(!N_||!N_.getRandomValues)&&(rD.warn("WARNING: Missing strong random number source"),N_={getRandomValues:function(t){return rD.throwError("no secure random source avaialble",fe.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function Tf(t){(t<=0||t>1024||t%1||t!=t)&&rD.throwArgumentError("invalid length","length",t);let e=new Uint8Array(t);return N_.getRandomValues(e),ke(e)}function h5(t){t=t.slice();for(let e=t.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1)),i=t[e];t[e]=t[r],t[r]=i}return t}var oD=Wt(nD());var P_="json-wallets/5.7.0";function fh(t){return typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),ke(t)}function i3(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function d5(t){return typeof t=="string"?ui(t,$s.NFKC):ke(t)}function xn(t,e){let r=t,i=e.toLowerCase().split("/");for(let n=0;n<i.length;n++){let o=null;for(let s in r)if(s.toLowerCase()===i[n]){o=r[s];break}if(o===null)return null;r=o}return r}function $fe(t){let e=ke(t);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let r=De(e);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}var fWe=new fe(P_),sD=class extends Qa{isCrowdsaleAccount(e){return!!(e&&e._isCrowdsaleAccount)}};function aD(t,e){let r=JSON.parse(t);e=d5(e);let i=$r(xn(r,"ethaddr")),n=fh(xn(r,"encseed"));(!n||n.length%16!==0)&&fWe.throwArgumentError("invalid encseed","json",t);let o=ke(Mm(e,e,2e3,32,"sha256")).slice(0,16),s=n.slice(0,16),a=n.slice(16),c=new oD.default.ModeOfOperation.cbc(o,s),h=oD.default.padding.pkcs7.strip(ke(c.decrypt(a))),g="";for(let A=0;A<h.length;A++)g+=String.fromCharCode(h[A]);let b=ui(g),E=jr(b);return new sD({_isCrowdsaleAccount:!0,address:i,privateKey:E})}function O_(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return e.encseed&&e.ethaddr}function M_(t){let e=null;try{e=JSON.parse(t)}catch{return!1}return!(!e.version||parseInt(e.version)!==e.version||parseInt(e.version)!==3)}function cD(t){if(O_(t))try{return $r(JSON.parse(t).ethaddr)}catch{return null}if(M_(t))try{return $r(JSON.parse(t).address)}catch{return null}return null}var hh=Wt(nD()),D_=Wt(Hfe());var hWe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},uD=new fe(P_);function zfe(t){return t!=null&&t.mnemonic&&t.mnemonic.phrase}var fD=class extends Qa{isKeystoreAccount(e){return!!(e&&e._isKeystoreAccount)}};function dWe(t,e,r){if(xn(t,"crypto/cipher")==="aes-128-ctr"){let n=fh(xn(t,"crypto/cipherparams/iv")),o=new hh.default.Counter(n),s=new hh.default.ModeOfOperation.ctr(e,o);return ke(s.decrypt(r))}return null}function qfe(t,e){let r=fh(xn(t,"crypto/ciphertext"));if(De(jr(Fr([e.slice(16,32),r]))).substring(2)!==xn(t,"crypto/mac").toLowerCase())throw new Error("invalid password");let n=dWe(t,e.slice(0,16),r);n||uD.throwError("unsupported cipher",fe.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});let o=e.slice(32,64),s=il(n);if(t.address){let c=t.address.toLowerCase();if(c.substring(0,2)!=="0x"&&(c="0x"+c),$r(c)!==s)throw new Error("address mismatch")}let a={_isKeystoreAccount:!0,address:s,privateKey:De(n)};if(xn(t,"x-ethers/version")==="0.1"){let c=fh(xn(t,"x-ethers/mnemonicCiphertext")),h=fh(xn(t,"x-ethers/mnemonicCounter")),g=new hh.default.Counter(h),b=new hh.default.ModeOfOperation.ctr(o,g),E=xn(t,"x-ethers/path")||uh,A=xn(t,"x-ethers/locale")||"en",T=ke(b.decrypt(c));try{let P=Lm(T,A),L=If.fromMnemonic(P,null,A).derivePath(E);if(L.privateKey!=a.privateKey)throw new Error("mnemonic mismatch");a.mnemonic=L.mnemonic}catch(P){if(P.code!==fe.errors.INVALID_ARGUMENT||P.argument!=="wordlist")throw P}}return new fD(a)}function Vfe(t,e,r,i,n){return ke(Mm(t,e,r,i,n))}function pWe(t,e,r,i,n){return Promise.resolve(Vfe(t,e,r,i,n))}function Kfe(t,e,r,i,n){let o=d5(e),s=xn(t,"crypto/kdf");if(s&&typeof s=="string"){let a=function(c,h){return uD.throwArgumentError("invalid key-derivation function parameters",c,h)};if(s.toLowerCase()==="scrypt"){let c=fh(xn(t,"crypto/kdfparams/salt")),h=parseInt(xn(t,"crypto/kdfparams/n")),g=parseInt(xn(t,"crypto/kdfparams/r")),b=parseInt(xn(t,"crypto/kdfparams/p"));(!h||!g||!b)&&a("kdf",s),(h&h-1)!==0&&a("N",h);let E=parseInt(xn(t,"crypto/kdfparams/dklen"));return E!==32&&a("dklen",E),i(o,c,h,g,b,64,n)}else if(s.toLowerCase()==="pbkdf2"){let c=fh(xn(t,"crypto/kdfparams/salt")),h=null,g=xn(t,"crypto/kdfparams/prf");g==="hmac-sha256"?h="sha256":g==="hmac-sha512"?h="sha512":a("prf",g);let b=parseInt(xn(t,"crypto/kdfparams/c")),E=parseInt(xn(t,"crypto/kdfparams/dklen"));return E!==32&&a("dklen",E),r(o,c,b,E,h)}}return uD.throwArgumentError("unsupported key-derivation function","kdf",s)}function Gfe(t,e){let r=JSON.parse(t),i=Kfe(r,e,Vfe,D_.default.syncScrypt);return qfe(r,i)}function Zfe(t,e,r){return hWe(this,void 0,void 0,function*(){let i=JSON.parse(t),n=yield Kfe(i,e,pWe,D_.default.scrypt,r);return qfe(i,n)})}function hD(t,e,r,i){try{if($r(t.address)!==il(t.privateKey))throw new Error("address/privateKey mismatch");if(zfe(t)){let L=t.mnemonic;if(If.fromMnemonic(L.phrase,null,L.locale).derivePath(L.path||uh).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(L){return Promise.reject(L)}typeof r=="function"&&!i&&(i=r,r={}),r||(r={});let n=ke(t.privateKey),o=d5(e),s=null,a=null,c=null;if(zfe(t)){let L=t.mnemonic;s=ke(r3(L.phrase,L.locale||"en")),a=L.path||uh,c=L.locale||"en"}let h=r.client;h||(h="ethers.js");let g=null;r.salt?g=ke(r.salt):g=Tf(32);let b=null;if(r.iv){if(b=ke(r.iv),b.length!==16)throw new Error("invalid iv")}else b=Tf(16);let E=null;if(r.uuid){if(E=ke(r.uuid),E.length!==16)throw new Error("invalid uuid")}else E=Tf(16);let A=1<<17,T=8,P=1;return r.scrypt&&(r.scrypt.N&&(A=r.scrypt.N),r.scrypt.r&&(T=r.scrypt.r),r.scrypt.p&&(P=r.scrypt.p)),D_.default.scrypt(o,g,A,T,P,64,i).then(L=>{L=ke(L);let j=L.slice(0,16),$=L.slice(16,32),G=L.slice(32,64),Z=new hh.default.Counter(b),te=new hh.default.ModeOfOperation.ctr(j,Z),se=ke(te.encrypt(n)),X=jr(Fr([$,se])),k={address:t.address.substring(2).toLowerCase(),id:$fe(E),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:De(b).substring(2)},ciphertext:De(se).substring(2),kdf:"scrypt",kdfparams:{salt:De(g).substring(2),n:A,dklen:32,p:P,r:T},mac:X.substring(2)}};if(s){let F=Tf(16),V=new hh.default.Counter(F),M=new hh.default.ModeOfOperation.ctr(G,V),B=ke(M.encrypt(s)),u=new Date,f=u.getUTCFullYear()+"-"+i3(u.getUTCMonth()+1,2)+"-"+i3(u.getUTCDate(),2)+"T"+i3(u.getUTCHours(),2)+"-"+i3(u.getUTCMinutes(),2)+"-"+i3(u.getUTCSeconds(),2)+".0Z";k["x-ethers"]={client:h,gethFilename:"UTC--"+f+"--"+k.address,mnemonicCounter:De(F).substring(2),mnemonicCiphertext:De(B).substring(2),path:a,locale:c,version:"0.1"}}return JSON.stringify(k)})}function Yfe(t,e,r){if(O_(t)){r&&r(0);let i=aD(t,e);return r&&r(1),Promise.resolve(i)}return M_(t)?Zfe(t,e,r):Promise.reject(new Error("invalid JSON wallet"))}function Jfe(t,e){if(O_(t))return aD(t,e);if(M_(t))return Gfe(t,e);throw new Error("invalid JSON wallet")}var Qfe="wallet/5.7.0";var Xfe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},n3=new fe(Qfe);function mWe(t){return t!=null&&Zt(t.privateKey,32)&&t.address!=null}function gWe(t){let e=t.mnemonic;return e&&e.phrase}var p5=class t extends ec{constructor(e,r){if(super(),mWe(e)){let i=new rl(e.privateKey);if(ye(this,"_signingKey",()=>i),ye(this,"address",il(this.publicKey)),this.address!==$r(e.address)&&n3.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),gWe(e)){let n=e.mnemonic;ye(this,"_mnemonic",()=>({phrase:n.phrase,path:n.path||uh,locale:n.locale||"en"}));let o=this.mnemonic,s=If.fromMnemonic(o.phrase,null,o.locale).derivePath(o.path);il(s.privateKey)!==this.address&&n3.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else ye(this,"_mnemonic",()=>null)}else{if(rl.isSigningKey(e))e.curve!=="secp256k1"&&n3.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),ye(this,"_signingKey",()=>e);else{typeof e=="string"&&e.match(/^[0-9a-f]*$/i)&&e.length===64&&(e="0x"+e);let i=new rl(e);ye(this,"_signingKey",()=>i)}ye(this,"_mnemonic",()=>null),ye(this,"address",il(this.publicKey))}r&&!Jc.isProvider(r)&&n3.throwArgumentError("invalid provider","provider",r),ye(this,"provider",r||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new t(this,e)}signTransaction(e){return ji(e).then(r=>{r.from!=null&&($r(r.from)!==this.address&&n3.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete r.from);let i=this._signingKey().signDigest(jr(s5(r)));return s5(r,i)})}signMessage(e){return Xfe(this,void 0,void 0,function*(){return zy(this._signingKey().signDigest($w(e)))})}_signTypedData(e,r,i){return Xfe(this,void 0,void 0,function*(){let n=yield Yc.resolveNames(e,r,i,o=>(this.provider==null&&n3.throwError("cannot resolve ENS names without a provider",fe.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:o}),this.provider.resolveName(o)));return zy(this._signingKey().signDigest(Yc.hash(n.domain,r,n.value)))})}encrypt(e,r,i){if(typeof r=="function"&&!i&&(i=r,r={}),i&&typeof i!="function")throw new Error("invalid callback");return r||(r={}),hD(this,e,r,i)}static createRandom(e){let r=Tf(16);e||(e={}),e.extraEntropy&&(r=ke(Fi(jr(Fr([r,e.extraEntropy])),0,16)));let i=Lm(r,e.locale);return t.fromMnemonic(i,e.path,e.locale)}static fromEncryptedJson(e,r,i){return Yfe(e,r,i).then(n=>new t(n))}static fromEncryptedJsonSync(e,r){return new t(Jfe(e,r))}static fromMnemonic(e,r,i){return r||(r=uh),new t(If.fromMnemonic(e,null,i).derivePath(r))}};function e0e(t,e){return Nm($w(t),e)}function t0e(t,e,r,i){return Nm(Yc.hash(t,e,r),i)}var Q_={};Oi(Q_,{AlchemyProvider:()=>u3,AlchemyWebSocketProvider:()=>C5,AnkrProvider:()=>S5,BaseProvider:()=>kf,CloudflareProvider:()=>I5,EtherscanProvider:()=>T5,FallbackProvider:()=>k5,Formatter:()=>Bm,InfuraProvider:()=>h3,InfuraWebSocketProvider:()=>P5,IpcProvider:()=>CD,JsonRpcBatchProvider:()=>Y_,JsonRpcProvider:()=>da,JsonRpcSigner:()=>c3,NodesmithProvider:()=>O5,PocketProvider:()=>M5,Provider:()=>Jc,Resolver:()=>a3,StaticJsonRpcProvider:()=>A5,UrlJsonRpcProvider:()=>ws,Web3Provider:()=>D5,WebSocketProvider:()=>mh,getDefaultProvider:()=>J_,getNetwork:()=>m5,isCommunityResourcable:()=>mD,isCommunityResource:()=>v5,showThrottleMessage:()=>Rf});var r0e="networks/5.7.1";var i0e=new fe(r0e);function wWe(t){return t&&typeof t.renetwork=="function"}function dh(t){let e=function(r,i){i==null&&(i={});let n=[];if(r.InfuraProvider&&i.infura!=="-")try{n.push(new r.InfuraProvider(t,i.infura))}catch{}if(r.EtherscanProvider&&i.etherscan!=="-")try{n.push(new r.EtherscanProvider(t,i.etherscan))}catch{}if(r.AlchemyProvider&&i.alchemy!=="-")try{n.push(new r.AlchemyProvider(t,i.alchemy))}catch{}if(r.PocketProvider&&i.pocket!=="-"){let o=["goerli","ropsten","rinkeby","sepolia"];try{let s=new r.PocketProvider(t,i.pocket);s.network&&o.indexOf(s.network.name)===-1&&n.push(s)}catch{}}if(r.CloudflareProvider&&i.cloudflare!=="-")try{n.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&i.ankr!=="-")try{let o=["ropsten"],s=new r.AnkrProvider(t,i.ankr);s.network&&o.indexOf(s.network.name)===-1&&n.push(s)}catch{}if(n.length===0)return null;if(r.FallbackProvider){let o=1;return i.quorum!=null?o=i.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(n,o)}return n[0]};return e.renetwork=function(r){return dh(r)},e}function B_(t,e){let r=function(i,n){return i.JsonRpcProvider?new i.JsonRpcProvider(t,e):null};return r.renetwork=function(i){return B_(t,i)},r}var n0e={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:dh("homestead")},o0e={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:dh("ropsten")},s0e={chainId:63,name:"classicMordor",_defaultProvider:B_("https://www.ethercluster.com/mordor","classicMordor")},L_={unspecified:{chainId:0,name:"unspecified"},homestead:n0e,mainnet:n0e,morden:{chainId:2,name:"morden"},ropsten:o0e,testnet:o0e,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:dh("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:dh("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:dh("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:dh("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:B_("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:s0e,classicTestnet:s0e,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:B_("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:dh("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:dh("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function m5(t){if(t==null)return null;if(typeof t=="number"){for(let i in L_){let n=L_[i];if(n.chainId===t)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){let i=L_[t];return i==null?null:{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress,_defaultProvider:i._defaultProvider||null}}let e=L_[t.name];if(!e)return typeof t.chainId!="number"&&i0e.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&i0e.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(wWe(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}var a0e="web/5.7.1";var vWe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})};function c0e(t,e){return vWe(this,void 0,void 0,function*(){e==null&&(e={});let r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){let s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}let i=yield fetch(t,r),n=yield i.arrayBuffer(),o={};return i.headers.forEach?i.headers.forEach((s,a)=>{o[a.toLowerCase()]=s}):i.headers.keys().forEach(s=>{o[s.toLowerCase()]=i.headers.get(s)}),{headers:o,statusCode:i.status,statusMessage:i.statusText,body:ke(new Uint8Array(n))}})}var bWe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Gl=new fe(a0e);function l0e(t){return new Promise(e=>{setTimeout(e,t)})}function sp(t,e){if(t==null)return null;if(typeof t=="string")return t;if(eh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return ua(t)}catch{}return De(t)}return t}function yWe(t){return ui(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function dD(t,e,r){let i=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Gl.assertArgument(i>0&&i%1===0,"invalid connection throttle limit","connection.throttleLimit",i);let n=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Gl.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);let s=typeof t=="object"?!!t.errorPassThrough:!1,a={},c=null,h={method:"GET"},g=!1,b=2*60*1e3;if(typeof t=="string")c=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Gl.throwArgumentError("missing URL","connection.url",t),c=t.url,typeof t.timeout=="number"&&t.timeout>0&&(b=t.timeout),t.headers)for(let j in t.headers)a[j.toLowerCase()]={key:j,value:String(t.headers[j])},["if-none-match","if-modified-since"].indexOf(j.toLowerCase())>=0&&(g=!0);if(h.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){c.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Gl.throwError("basic authentication requires a secure https url",fe.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:t.user,password:"[REDACTED]"});let j=t.user+":"+t.password;a.authorization={key:"Authorization",value:"Basic "+jw(ui(j))}}t.skipFetchSetup!=null&&(h.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(h.fetchOptions=di(t.fetchOptions))}let E=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),A=c?c.match(E):null;if(A)try{let j={statusCode:200,statusMessage:"OK",headers:{"content-type":A[1]||"text/plain"},body:A[2]?Fw(A[3]):yWe(A[3])},$=j.body;return r&&($=r(j.body,j)),Promise.resolve($)}catch(j){Gl.throwError("processing response error",fe.errors.SERVER_ERROR,{body:sp(A[1],A[2]),error:j,requestBody:null,requestMethod:"GET",url:c})}e&&(h.method="POST",h.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));let T={};Object.keys(a).forEach(j=>{let $=a[j];T[$.key]=$.value}),h.headers=T;let P=function(){let j=null;return{promise:new Promise(function(Z,te){b&&(j=setTimeout(()=>{j!=null&&(j=null,te(Gl.makeError("timeout",fe.errors.TIMEOUT,{requestBody:sp(h.body,T["content-type"]),requestMethod:h.method,timeout:b,url:c})))},b))}),cancel:function(){j!=null&&(clearTimeout(j),j=null)}}}(),L=function(){return bWe(this,void 0,void 0,function*(){for(let j=0;j<i;j++){let $=null;try{if($=yield c0e(c,h),j<i){if($.statusCode===301||$.statusCode===302){let Z=$.headers.location||"";if(h.method==="GET"&&Z.match(/^https:/)){c=$.headers.location;continue}}else if($.statusCode===429){let Z=!0;if(n&&(Z=yield n(j,c)),Z){let te=0,se=$.headers["retry-after"];typeof se=="string"&&se.match(/^[1-9][0-9]*$/)?te=parseInt(se)*1e3:te=o*parseInt(String(Math.random()*Math.pow(2,j))),yield l0e(te);continue}}}}catch(Z){$=Z.response,$==null&&(P.cancel(),Gl.throwError("missing response",fe.errors.SERVER_ERROR,{requestBody:sp(h.body,T["content-type"]),requestMethod:h.method,serverError:Z,url:c}))}let G=$.body;if(g&&$.statusCode===304?G=null:!s&&($.statusCode<200||$.statusCode>=300)&&(P.cancel(),Gl.throwError("bad response",fe.errors.SERVER_ERROR,{status:$.statusCode,headers:$.headers,body:sp(G,$.headers?$.headers["content-type"]:null),requestBody:sp(h.body,T["content-type"]),requestMethod:h.method,url:c})),r)try{let Z=yield r(G,$);return P.cancel(),Z}catch(Z){if(Z.throttleRetry&&j<i){let te=!0;if(n&&(te=yield n(j,c)),te){let se=o*parseInt(String(Math.random()*Math.pow(2,j)));yield l0e(se);continue}}P.cancel(),Gl.throwError("processing response error",fe.errors.SERVER_ERROR,{body:sp(G,$.headers?$.headers["content-type"]:null),error:Z,requestBody:sp(h.body,T["content-type"]),requestMethod:h.method,url:c})}return P.cancel(),G}return Gl.throwError("failed response",fe.errors.SERVER_ERROR,{requestBody:sp(h.body,T["content-type"]),requestMethod:h.method,url:c})})}();return Promise.race([P.promise,L])}function Zl(t,e,r){let i=(o,s)=>{let a=null;if(o!=null)try{a=JSON.parse(ua(o))}catch(c){Gl.throwError("invalid JSON",fe.errors.SERVER_ERROR,{body:o,error:c})}return r&&(a=r(a,s)),a},n=null;if(e!=null){n=ui(e);let o=typeof t=="string"?{url:t}:di(t);o.headers?Object.keys(o.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(o.headers=di(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return dD(t,n,i)}function Yl(t,e){return e||(e={}),e=di(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,i){let n=null,o=!1,s=()=>o?!1:(o=!0,n&&clearTimeout(n),!0);e.timeout&&(n=setTimeout(()=>{s()&&i(new Error("timeout"))},e.timeout));let a=e.retryLimit,c=0;function h(){return t().then(function(g){if(g!==void 0)s()&&r(g);else if(e.oncePoll)e.oncePoll.once("poll",h);else if(e.onceBlock)e.onceBlock.once("block",h);else if(!o){if(c++,c>a){s()&&i(new Error("retry limit reached"));return}let b=e.interval*parseInt(String(Math.random()*Math.pow(2,c)));b<e.floor&&(b=e.floor),b>e.ceiling&&(b=e.ceiling),setTimeout(h,b)}return null},function(g){s()&&i(g)})}h()})}var bD=Wt(d0e());var Ci="providers/5.7.2";var w5=new fe(Ci),Bm=class t{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){let e={},r=this.address.bind(this),i=this.bigNumber.bind(this),n=this.blockTag.bind(this),o=this.data.bind(this),s=this.hash.bind(this),a=this.hex.bind(this),c=this.number.bind(this),h=this.type.bind(this),g=b=>this.data(b,!0);return e.transaction={hash:s,type:h,accessList:t.allowNull(this.accessList.bind(this),null),blockHash:t.allowNull(s,null),blockNumber:t.allowNull(c,null),transactionIndex:t.allowNull(c,null),confirmations:t.allowNull(c,null),from:r,gasPrice:t.allowNull(i),maxPriorityFeePerGas:t.allowNull(i),maxFeePerGas:t.allowNull(i),gasLimit:i,to:t.allowNull(r,null),value:i,nonce:c,data:o,r:t.allowNull(this.uint256),s:t.allowNull(this.uint256),v:t.allowNull(c),creates:t.allowNull(r,null),raw:t.allowNull(o)},e.transactionRequest={from:t.allowNull(r),nonce:t.allowNull(c),gasLimit:t.allowNull(i),gasPrice:t.allowNull(i),maxPriorityFeePerGas:t.allowNull(i),maxFeePerGas:t.allowNull(i),to:t.allowNull(r),value:t.allowNull(i),data:t.allowNull(g),type:t.allowNull(c),accessList:t.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:c,blockNumber:c,transactionHash:s,address:r,topics:t.arrayOf(s),data:o,logIndex:c,blockHash:s},e.receipt={to:t.allowNull(this.address,null),from:t.allowNull(this.address,null),contractAddress:t.allowNull(r,null),transactionIndex:c,root:t.allowNull(a),gasUsed:i,logsBloom:t.allowNull(o),blockHash:s,transactionHash:s,logs:t.arrayOf(this.receiptLog.bind(this)),blockNumber:c,confirmations:t.allowNull(c,null),cumulativeGasUsed:i,effectiveGasPrice:t.allowNull(i),status:t.allowNull(c),type:h},e.block={hash:t.allowNull(s),parentHash:s,number:c,timestamp:c,nonce:t.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:i,gasUsed:i,miner:t.allowNull(r),extraData:o,transactions:t.allowNull(t.arrayOf(s)),baseFeePerGas:t.allowNull(i)},e.blockWithTransactions=di(e.block),e.blockWithTransactions.transactions=t.allowNull(t.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:t.allowNull(n,void 0),toBlock:t.allowNull(n,void 0),blockHash:t.allowNull(s,void 0),address:t.allowNull(r,void 0),topics:t.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:t.allowNull(c),blockHash:t.allowNull(s),transactionIndex:c,removed:t.allowNull(this.boolean.bind(this)),address:r,data:t.allowFalsish(o,"0x"),topics:t.arrayOf(s),transactionHash:s,logIndex:c},e}accessList(e){return nc(e||[])}number(e){return e==="0x"?0:Ue.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ue.from(e).toNumber()}bigNumber(e){return Ue.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),Zt(e))?e.toLowerCase():w5.throwArgumentError("invalid hash","value",e)}data(e,r){let i=this.hex(e,r);if(i.length%2!==0)throw new Error("invalid data; odd-length - "+e);return i}address(e){return $r(e)}callAddress(e){if(!Zt(e,32))return null;let r=$r(Fi(e,12));return r===t_?null:r}contractAddress(e){return Sm(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||Zt(e))return uf(e);throw new Error("invalid blockTag")}hash(e,r){let i=this.hex(e,r);return hs(i)!==32?w5.throwArgumentError("invalid hash","value",e):i}difficulty(e){if(e==null)return null;let r=Ue.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!Zt(e))throw new Error("invalid uint256");return Kr(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);let i=e._difficulty!=null?e._difficulty:e.difficulty,n=t.check(r,e);return n._difficulty=i==null?null:Ue.from(i),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return t.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ue.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);let r=t.check(this.formats.transaction,e);if(e.chainId!=null){let i=e.chainId;Zt(i)&&(i=Ue.from(i).toNumber()),r.chainId=i}else{let i=e.networkId;i==null&&r.v==null&&(i=e.chainId),Zt(i)&&(i=Ue.from(i).toNumber()),typeof i!="number"&&r.v!=null&&(i=(r.v-35)/2,i<0&&(i=0),i=parseInt(i)),typeof i!="number"&&(i=0),r.chainId=i}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return A_(e)}receiptLog(e){return t.check(this.formats.receiptLog,e)}receipt(e){let r=t.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){let i=Ue.from(r.root).toNumber();i===0||i===1?(r.status!=null&&r.status!==i&&w5.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=i,delete r.root):w5.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&w5.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return t.check(this.formats.filter,e)}filterLog(e){return t.check(this.formats.filterLog,e)}static check(e,r){let i={};for(let n in e)try{let o=e[n](r[n]);o!==void 0&&(i[n]=o)}catch(o){throw o.checkKey=n,o.checkValue=r[n],o}return i}static allowNull(e,r){return function(i){return i==null?r:e(i)}}static allowFalsish(e,r){return function(i){return i?e(i):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");let i=[];return r.forEach(function(n){i.push(e(n))}),i}}};function mD(t){return t&&typeof t.isCommunityResource=="function"}function v5(t){return mD(t)&&t.isCommunityResource()}var p0e=!1;function Rf(){p0e||(p0e=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var Er=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Gr=new fe(Ci),TWe=10;function m0e(t){return t==null?"null":(hs(t)!==32&&Gr.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function g0e(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){let r={};e.forEach(n=>{r[m0e(n)]=!0});let i=Object.keys(r);return i.sort(),i.join("|")}else return m0e(e)}).join("&")}function RWe(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];let r=e.split("|").map(i=>i==="null"?null:i);return r.length===1?r[0]:r})}function s3(t){if(typeof t=="string"){if(t=t.toLowerCase(),hs(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+g0e(t);if(d_.isForkEvent(t))throw Gr.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+g0e(t.topics||[])}throw new Error("invalid event - "+t)}function b5(){return new Date().getTime()}function w0e(t){return new Promise(e=>{setTimeout(e,t)})}var kWe=["block","network","pending","poll"],yD=class{constructor(e,r,i){ye(this,"tag",e),ye(this,"listener",r),ye(this,"once",i),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){let e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){let e=this.tag.split(":");if(e[0]!=="filter")return null;let r=e[1],i=RWe(e[2]),n={};return i.length>0&&(n.topics=i),r&&r!=="*"&&(n.address=r),n}pollable(){return this.tag.indexOf(":")>=0||kWe.indexOf(this.tag)>=0}},NWe={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function gD(t){return Kr(Ue.from(t).toHexString(),32)}function v0e(t){return ch.encode(Fr([t,Fi(ha(ha(t)),0,4)]))}var x0e=new RegExp("^(ipfs)://(.*)$","i"),b0e=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),x0e,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function $_(t,e){try{return ua(y5(t,e))}catch{}return null}function y5(t,e){if(t==="0x")return null;let r=Ue.from(Fi(t,e,e+32)).toNumber(),i=Ue.from(Fi(t,r,r+32)).toNumber();return Fi(t,r+32,r+32+i)}function wD(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):Gr.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function y0e(t){let e=ke(t);if(e.length>32)throw new Error("internal; should not happen");let r=new Uint8Array(32);return r.set(e,32-e.length),r}function PWe(t){if(t.length%32===0)return t;let e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function _0e(t){let e=[],r=0;for(let i=0;i<t.length;i++)e.push(null),r+=32;for(let i=0;i<t.length;i++){let n=ke(t[i]);e[i]=y0e(r),e.push(y0e(n.length)),e.push(PWe(n)),r+=32+Math.ceil(n.length/32)*32}return qn(e)}var a3=class{constructor(e,r,i,n){ye(this,"provider",e),ye(this,"name",i),ye(this,"address",e.formatter.address(r)),ye(this,"_resolvedAddress",n)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(e=>Ue.from(e).eq(1)).catch(e=>{if(e.code===fe.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return Er(this,void 0,void 0,function*(){let i={to:this.address,ccipReadEnabled:!0,data:qn([e,ep(this.name),r||"0x"])},n=!1;(yield this.supportsWildcard())&&(n=!0,i.data=qn(["0x9061b923",_0e([r5(this.name),i.data])]));try{let o=yield this.provider.call(i);return ke(o).length%32===4&&Gr.throwError("resolver threw error",fe.errors.CALL_EXCEPTION,{transaction:i,data:o}),n&&(o=y5(o,0)),o}catch(o){if(o.code===fe.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return Er(this,void 0,void 0,function*(){let i=yield this._fetch(e,r);return i!=null?y5(i,0):null})}_getAddress(e,r){let i=NWe[String(e)];if(i==null&&Gr.throwError(`unsupported coin type: ${e}`,fe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),i.ilk==="eth")return this.provider.formatter.address(r);let n=ke(r);if(i.p2pkh!=null){let o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){let s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return v0e(Fr([[i.p2pkh],"0x"+o[2]]))}}if(i.p2sh!=null){let o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){let s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return v0e(Fr([[i.p2sh],"0x"+o[2]]))}}if(i.prefix!=null){let o=n[1],s=n[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&n.length===2+o&&o>=1&&o<=75){let a=bD.default.toWords(n.slice(2));return a.unshift(s),bD.default.encode(i.prefix,a)}}return null}getAddress(e){return Er(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{let n=yield this._fetch("0x3b3b57de");return n==="0x"||n===Bw?null:this.provider.formatter.callAddress(n)}catch(n){if(n.code===fe.errors.CALL_EXCEPTION)return null;throw n}let r=yield this._fetchBytes("0xf1cb7e06",gD(e));if(r==null||r==="0x")return null;let i=this._getAddress(e,r);return i==null&&Gr.throwError("invalid or unsupported coin data",fe.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),i})}getAvatar(){return Er(this,void 0,void 0,function*(){let e=[{type:"name",content:this.name}];try{let r=yield this.getText("avatar");if(r==null)return null;for(let i=0;i<b0e.length;i++){let n=r.match(b0e[i]);if(n==null)continue;let o=n[1].toLowerCase();switch(o){case"https":return e.push({type:"url",content:r}),{linkage:e,url:r};case"data":return e.push({type:"data",content:r}),{linkage:e,url:r};case"ipfs":return e.push({type:"ipfs",content:r}),{linkage:e,url:wD(r)};case"erc721":case"erc1155":{let s=o==="erc721"?"0xc87b56dd":"0x0e89341c";e.push({type:o,content:r});let a=this._resolvedAddress||(yield this.getAddress()),c=(n[2]||"").split("/");if(c.length!==2)return null;let h=yield this.provider.formatter.address(c[0]),g=Kr(Ue.from(c[1]).toHexString(),32);if(o==="erc721"){let P=this.provider.formatter.callAddress(yield this.provider.call({to:h,data:qn(["0x6352211e",g])}));if(a!==P)return null;e.push({type:"owner",content:P})}else if(o==="erc1155"){let P=Ue.from(yield this.provider.call({to:h,data:qn(["0x00fdd58e",Kr(a,32),g])}));if(P.isZero())return null;e.push({type:"balance",content:P.toString()})}let b={to:this.provider.formatter.address(c[0]),data:qn([s,g])},E=$_(yield this.provider.call(b),0);if(E==null)return null;e.push({type:"metadata-url-base",content:E}),o==="erc1155"&&(E=E.replace("{id}",g.substring(2)),e.push({type:"metadata-url-expanded",content:E})),E.match(/^ipfs:/i)&&(E=wD(E)),e.push({type:"metadata-url",content:E});let A=yield Zl(E);if(!A)return null;e.push({type:"metadata",content:JSON.stringify(A)});let T=A.image;if(typeof T!="string")return null;if(!T.match(/^(https:\/\/|data:)/i)){if(T.match(x0e)==null)return null;e.push({type:"url-ipfs",content:T}),T=wD(T)}return e.push({type:"url",content:T}),{linkage:e,url:T}}}}}catch{}return null})}getContentHash(){return Er(this,void 0,void 0,function*(){let e=yield this._fetchBytes("0xbc1c58d1");if(e==null||e==="0x")return null;let r=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(r){let s=parseInt(r[3],16);if(r[4].length===s*2)return"ipfs://"+ch.encode("0x"+r[1])}let i=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(i){let s=parseInt(i[3],16);if(i[4].length===s*2)return"ipns://"+ch.encode("0x"+i[1])}let n=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(n&&n[1].length===32*2)return"bzz://"+n[1];let o=e.match(/^0x90b2c605([0-9a-f]*)$/);if(o&&o[1].length===34*2){let s={"=":"","+":"-","/":"_"};return"sia://"+jw("0x"+o[1]).replace(/[=+\/]/g,c=>s[c])}return Gr.throwError("invalid or unsupported content hash data",fe.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return Er(this,void 0,void 0,function*(){let r=ui(e);r=Fr([gD(64),gD(r.length),r]),r.length%32!==0&&(r=Fr([r,Kr("0x",32-e.length%32)]));let i=yield this._fetchBytes("0x59d1d43c",De(r));return i==null||i==="0x"?null:ua(i)})}},vD=null,OWe=1,kf=class extends Jc{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),ye(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{let r=vn(new.target,"getNetwork")(e);r?(ye(this,"_network",r),this.emit("network",r,null)):Gr.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return Er(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||Gr.throwError("no network detected",fe.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:ye(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return Yl(()=>this._ready().then(e=>e,e=>{if(!(e.code===fe.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return vD==null&&(vD=new Bm),vD}static getNetwork(e){return m5(e??"homestead")}ccipReadFetch(e,r,i){return Er(this,void 0,void 0,function*(){if(this.disableCcipRead||i.length===0)return null;let n=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let a=0;a<i.length;a++){let c=i[a],h=c.replace("{sender}",n).replace("{data}",o),g=c.indexOf("{data}")>=0?null:JSON.stringify({data:o,sender:n}),b=yield Zl({url:h,errorPassThrough:!0},g,(A,T)=>(A.status=T.statusCode,A));if(b.data)return b.data;let E=b.message||"unknown error";if(b.status>=400&&b.status<500)return Gr.throwError(`response not found during CCIP fetch: ${E}`,fe.errors.SERVER_ERROR,{url:c,errorMessage:E});s.push(E)}return Gr.throwError(`error encountered during CCIP fetch: ${s.map(a=>JSON.stringify(a)).join(", ")}`,fe.errors.SERVER_ERROR,{urls:i,errorMessages:s})})}_getInternalBlockNumber(e){return Er(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){let n=this._internalBlockNumber;try{let o=yield n;if(b5()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===n)break}}let r=b5(),i=ji({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(n=>null,n=>n)}).then(({blockNumber:n,networkError:o})=>{if(o)throw this._internalBlockNumber===i&&(this._internalBlockNumber=null),o;let s=b5();return n=Ue.from(n).toNumber(),n<this._maxInternalBlockNumber&&(n=this._maxInternalBlockNumber),this._maxInternalBlockNumber=n,this._setFastBlockNumber(n),{blockNumber:n,reqTime:r,respTime:s}});return this._internalBlockNumber=i,i.catch(n=>{this._internalBlockNumber===i&&(this._internalBlockNumber=null)}),(yield i).blockNumber})}poll(){return Er(this,void 0,void 0,function*(){let e=OWe++,r=[],i=null;try{i=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(n){this.emit("error",n);return}if(this._setFastBlockNumber(i),this.emit("poll",e,i),i===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=i-1),Math.abs(this._emitted.block-i)>1e3)Gr.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${i})`),this.emit("error",Gr.makeError("network block skew detected",fe.errors.NETWORK_ERROR,{blockNumber:i,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",i);else for(let n=this._emitted.block+1;n<=i;n++)this.emit("block",n);this._emitted.block!==i&&(this._emitted.block=i,Object.keys(this._emitted).forEach(n=>{if(n==="block")return;let o=this._emitted[n];o!=="pending"&&i-o>12&&delete this._emitted[n]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=i-1),this._events.forEach(n=>{switch(n.type){case"tx":{let o=n.hash,s=this.getTransactionReceipt(o).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+o]=a.blockNumber,this.emit(o,a)),null)).catch(a=>{this.emit("error",a)});r.push(s);break}case"filter":{if(!n._inflight){n._inflight=!0,n._lastBlockNumber===-2&&(n._lastBlockNumber=i-1);let o=n.filter;o.fromBlock=n._lastBlockNumber+1,o.toBlock=i;let s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);let a=this.getLogs(o).then(c=>{n._inflight=!1,c.length!==0&&c.forEach(h=>{h.blockNumber>n._lastBlockNumber&&(n._lastBlockNumber=h.blockNumber),this._emitted["b:"+h.blockHash]=h.blockNumber,this._emitted["t:"+h.transactionHash]=h.blockNumber,this.emit(o,h)})}).catch(c=>{this.emit("error",c),n._inflight=!1});r.push(a)}break}}}),this._lastBlockNumber=i,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(n=>{this.emit("error",n)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return Er(this,void 0,void 0,function*(){return Gr.throwError("provider does not support network detection",fe.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return Er(this,void 0,void 0,function*(){let e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield w0e(0),this._network;let i=Gr.makeError("underlying network changed",fe.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",i),i}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){let e=b5();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&e<this._fastBlockNumber||(this._fastQueryDate=b5(),(this._fastBlockNumber==null||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,i){return Er(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,i||0,null)})}_waitForTransaction(e,r,i,n){return Er(this,void 0,void 0,function*(){let o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,a)=>{let c=[],h=!1,g=function(){return h?!0:(h=!0,c.forEach(E=>{E()}),!1)},b=E=>{E.confirmations<r||g()||s(E)};if(this.on(e,b),c.push(()=>{this.removeListener(e,b)}),n){let E=n.startBlock,A=null,T=P=>Er(this,void 0,void 0,function*(){h||(yield w0e(1e3),this.getTransactionCount(n.from).then(L=>Er(this,void 0,void 0,function*(){if(!h){if(L<=n.nonce)E=P;else{{let j=yield this.getTransaction(e);if(j&&j.blockNumber!=null)return}for(A==null&&(A=E-3,A<n.startBlock&&(A=n.startBlock));A<=P;){if(h)return;let j=yield this.getBlockWithTransactions(A);for(let $=0;$<j.transactions.length;$++){let G=j.transactions[$];if(G.hash===e)return;if(G.from===n.from&&G.nonce===n.nonce){if(h)return;let Z=yield this.waitForTransaction(G.hash,r);if(g())return;let te="replaced";G.data===n.data&&G.to===n.to&&G.value.eq(n.value)?te="repriced":G.data==="0x"&&G.from===G.to&&G.value.isZero()&&(te="cancelled"),a(Gr.makeError("transaction was replaced",fe.errors.TRANSACTION_REPLACED,{cancelled:te==="replaced"||te==="cancelled",reason:te,replacement:this._wrapTransaction(G),hash:e,receipt:Z}));return}}A++}}h||this.once("block",T)}}),L=>{h||this.once("block",T)}))});if(h)return;this.once("block",T),c.push(()=>{this.removeListener("block",T)})}if(typeof i=="number"&&i>0){let E=setTimeout(()=>{g()||a(Gr.makeError("timeout exceeded",fe.errors.TIMEOUT,{timeout:i}))},i);E.unref&&E.unref(),c.push(()=>{clearTimeout(E)})}})})}getBlockNumber(){return Er(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let e=yield this.perform("getGasPrice",{});try{return Ue.from(e)}catch(r){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield ji({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getBalance",i);try{return Ue.from(n)}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getBalance",params:i,result:n,error:o})}})}getTransactionCount(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield ji({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getTransactionCount",i);try{return Ue.from(n).toNumber()}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getTransactionCount",params:i,result:n,error:o})}})}getCode(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield ji({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),n=yield this.perform("getCode",i);try{return De(n)}catch(o){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getCode",params:i,result:n,error:o})}})}getStorageAt(e,r,i){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let n=yield ji({address:this._getAddress(e),blockTag:this._getBlockTag(i),position:Promise.resolve(r).then(s=>uf(s))}),o=yield this.perform("getStorageAt",n);try{return De(o)}catch(s){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:o,error:s})}})}_wrapTransaction(e,r,i){if(r!=null&&hs(r)!==32)throw new Error("invalid response - sendTransaction");let n=e;return r!=null&&e.hash!==r&&Gr.throwError("Transaction hash mismatch from Provider.sendTransaction.",fe.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),n.wait=(o,s)=>Er(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let a;o!==0&&i!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:i});let c=yield this._waitForTransaction(e.hash,o,s,a);return c==null&&o===0?null:(this._emitted["t:"+e.hash]=c.blockNumber,c.status===0&&Gr.throwError("transaction failed",fe.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:c}),c)}),n}sendTransaction(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield Promise.resolve(e).then(o=>De(o)),i=this.formatter.transaction(e);i.confirmations==null&&(i.confirmations=0);let n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{let o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(i,o,n)}catch(o){throw o.transaction=i,o.transactionHash=i.hash,o}})}_getTransactionRequest(e){return Er(this,void 0,void 0,function*(){let r=yield e,i={};return["from","to"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?Ue.from(o):null))}),["type"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o??null))}),r.accessList&&(i.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(n=>{r[n]!=null&&(i[n]=Promise.resolve(r[n]).then(o=>o?De(o):null))}),this.formatter.transactionRequest(yield ji(i))})}_getFilter(e){return Er(this,void 0,void 0,function*(){e=yield e;let r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(i=>{e[i]!=null&&(r[i]=e[i])}),["fromBlock","toBlock"].forEach(i=>{e[i]!=null&&(r[i]=this._getBlockTag(e[i]))}),this.formatter.filter(yield ji(r))})}_call(e,r,i){return Er(this,void 0,void 0,function*(){i>=TWe&&Gr.throwError("CCIP read exceeded maximum redirections",fe.errors.SERVER_ERROR,{redirects:i,transaction:e});let n=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(i>=0&&r==="latest"&&n!=null&&o.substring(0,10)==="0x556f1830"&&hs(o)%32===4)try{let s=Fi(o,4),a=Fi(s,0,32);Ue.from(a).eq(n)||Gr.throwError("CCIP Read sender did not match",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let c=[],h=Ue.from(Fi(s,32,64)).toNumber(),g=Ue.from(Fi(s,h,h+32)).toNumber(),b=Fi(s,h+32);for(let j=0;j<g;j++){let $=$_(b,j*32);$==null&&Gr.throwError("CCIP Read contained corrupt URL string",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o}),c.push($)}let E=y5(s,64);Ue.from(Fi(s,100,128)).isZero()||Gr.throwError("CCIP Read callback selector included junk",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let A=Fi(s,96,100),T=y5(s,128),P=yield this.ccipReadFetch(e,E,c);P==null&&Gr.throwError("CCIP Read disabled or provided no URLs",fe.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});let L={to:n,data:qn([A,_0e([P,T])])};return this._call(L,r,i+1)}catch(s){if(s.code===fe.errors.SERVER_ERROR)throw s}try{return De(o)}catch(s){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:r},result:o,error:s})}})}call(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let i=yield ji({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(r),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(i.transaction,i.blockTag,i.ccipReadEnabled?0:-1)})}estimateGas(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield ji({transaction:this._getTransactionRequest(e)}),i=yield this.perform("estimateGas",r);try{return Ue.from(i)}catch(n){return Gr.throwError("bad result from backend",fe.errors.SERVER_ERROR,{method:"estimateGas",params:r,result:i,error:n})}})}_getAddress(e){return Er(this,void 0,void 0,function*(){e=yield e,typeof e!="string"&&Gr.throwArgumentError("invalid address or ENS name","name",e);let r=yield this.resolveName(e);return r==null&&Gr.throwError("ENS name not configured",fe.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),r})}_getBlock(e,r){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let i=-128,n={includeTransactions:!!r};if(Zt(e,32))n.blockHash=e;else try{n.blockTag=yield this._getBlockTag(e),Zt(n.blockTag)&&(i=parseInt(n.blockTag.substring(2),16))}catch{Gr.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return Yl(()=>Er(this,void 0,void 0,function*(){let o=yield this.perform("getBlock",n);if(o==null)return n.blockHash!=null&&this._emitted["b:"+n.blockHash]==null||n.blockTag!=null&&i>this._emitted.block?null:void 0;if(r){let s=null;for(let c=0;c<o.transactions.length;c++){let h=o.transactions[c];if(h.blockNumber==null)h.confirmations=0;else if(h.confirmations==null){s==null&&(s=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let g=s-h.blockNumber+1;g<=0&&(g=1),h.confirmations=g}}let a=this.formatter.blockWithTransactions(o);return a.transactions=a.transactions.map(c=>this._wrapTransaction(c)),a}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let r={transactionHash:this.formatter.hash(e,!0)};return Yl(()=>Er(this,void 0,void 0,function*(){let i=yield this.perform("getTransaction",r);if(i==null)return this._emitted["t:"+e]==null?null:void 0;let n=this.formatter.transactionResponse(i);if(n.blockNumber==null)n.confirmations=0;else if(n.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;s<=0&&(s=1),n.confirmations=s}return this._wrapTransaction(n)}),{oncePoll:this})})}getTransactionReceipt(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;let r={transactionHash:this.formatter.hash(e,!0)};return Yl(()=>Er(this,void 0,void 0,function*(){let i=yield this.perform("getTransactionReceipt",r);if(i==null)return this._emitted["t:"+e]==null?null:void 0;if(i.blockHash==null)return;let n=this.formatter.receipt(i);if(n.blockNumber==null)n.confirmations=0;else if(n.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;s<=0&&(s=1),n.confirmations=s}return n}),{oncePoll:this})})}getLogs(e){return Er(this,void 0,void 0,function*(){yield this.getNetwork();let r=yield ji({filter:this._getFilter(e)}),i=yield this.perform("getLogs",r);return i.forEach(n=>{n.removed==null&&(n.removed=!1)}),Bm.arrayOf(this.formatter.filterLog.bind(this.formatter))(i)})}getEtherPrice(){return Er(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return Er(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Gr.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return Er(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;let i=yield this._getResolver(r,"getResolver");if(i!=null){let n=new a3(this,i,e);return r!==e&&!(yield n.supportsWildcard())?null:n}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return Er(this,void 0,void 0,function*(){r==null&&(r="ENS");let i=yield this.getNetwork();i.ensAddress||Gr.throwError("network does not support ENS",fe.errors.UNSUPPORTED_OPERATION,{operation:r,network:i.name});try{let n=yield this.call({to:i.ensAddress,data:"0x0178b8bf"+ep(e).substring(2)});return this.formatter.callAddress(n)}catch{}return null})}resolveName(e){return Er(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(i){if(Zt(e))throw i}typeof e!="string"&&Gr.throwArgumentError("invalid ENS name","name",e);let r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return Er(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);let r=e.substring(2).toLowerCase()+".addr.reverse",i=yield this._getResolver(r,"lookupAddress");if(i==null)return null;let n=$_(yield this.call({to:i,data:"0x691f3431"+ep(r).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n})}getAvatar(e){return Er(this,void 0,void 0,function*(){let r=null;if(Zt(e)){let o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new a3(this,s,o);try{let a=yield r.getAvatar();if(a)return a.url}catch(a){if(a.code!==fe.errors.CALL_EXCEPTION)throw a}try{let a=$_(yield this.call({to:s,data:"0x691f3431"+ep(o).substring(2)}),0);r=yield this.getResolver(a)}catch(a){if(a.code!==fe.errors.CALL_EXCEPTION)throw a;return null}}else if(r=yield this.getResolver(e),!r)return null;let i=yield r.getAvatar();return i==null?null:i.url})}perform(e,r){return Gr.throwError(e+" not implemented",fe.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,i){let n=new yD(s3(e),r,i);return this._events.push(n),this._startEvent(n),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let i=!1,n=[],o=s3(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),i=!0,s.once?(n.push(s),!1):!0)),n.forEach(s=>{this._stopEvent(s)}),i}listenerCount(e){if(!e)return this._events.length;let r=s3(e);return this._events.filter(i=>i.tag===r).length}listeners(e){if(e==null)return this._events.map(i=>i.listener);let r=s3(e);return this._events.filter(i=>i.tag===r).map(i=>i.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);let i=[],n=!1,o=s3(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||n?!0:(n=!0,i.push(s),!1)),i.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{let i=s3(e);this._events=this._events.filter(n=>n.tag!==i?!0:(r.push(n),!1))}return r.forEach(i=>{this._stopEvent(i)}),this}};var ph=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Kn=new fe(Ci),MWe=["call","estimateGas"];function _5(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){let r=Zt(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(let r in t){let i=_5(t[r],e);if(i)return i}return null}if(typeof t=="string")try{return _5(JSON.parse(t),e)}catch{}return null}function A0e(t,e,r){let i=r.transaction||r.signedTransaction;if(t==="call"){let o=_5(e,!0);if(o)return o.data;Kn.throwError("missing revert data in call exception; Transaction reverted without a reason string",fe.errors.CALL_EXCEPTION,{data:"0x",transaction:i,error:e})}if(t==="estimateGas"){let o=_5(e.body,!1);o==null&&(o=_5(e,!1)),o&&Kn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:i,error:e})}let n=e.message;throw e.code===fe.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText),n=(n||"").toLowerCase(),n.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&Kn.throwError("insufficient funds for intrinsic transaction cost",fe.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:i}),n.match(/nonce (is )?too low/i)&&Kn.throwError("nonce has already been used",fe.errors.NONCE_EXPIRED,{error:e,method:t,transaction:i}),n.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&Kn.throwError("replacement fee too low",fe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:i}),n.match(/only replay-protected/i)&&Kn.throwError("legacy pre-eip-155 transactions not supported",fe.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:i}),MWe.indexOf(t)>=0&&n.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&Kn.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:i}),e}function E0e(t){return new Promise(function(e){setTimeout(e,t)})}function DWe(t){if(t.error){let e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function x5(t){return t&&t.toLowerCase()}var xD={},c3=class extends ec{constructor(e,r,i){if(super(),e!==xD)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");ye(this,"provider",r),i==null&&(i=0),typeof i=="string"?(ye(this,"_address",this.provider.formatter.address(i)),ye(this,"_index",null)):typeof i=="number"?(ye(this,"_index",i),ye(this,"_address",null)):Kn.throwArgumentError("invalid address or index","addressOrIndex",i)}connect(e){return Kn.throwError("cannot alter JSON-RPC Signer connection",fe.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new _D(xD,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&Kn.throwError("unknown account #"+this._index,fe.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=di(e);let r=this.getAddress().then(i=>(i&&(i=i.toLowerCase()),i));if(e.gasLimit==null){let i=di(e);i.from=r,e.gasLimit=this.provider.estimateGas(i)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(i=>ph(this,void 0,void 0,function*(){if(i==null)return null;let n=yield this.provider.resolveName(i);return n==null&&Kn.throwArgumentError("provided ENS name resolves to null","tx.to",i),n}))),ji({tx:ji(e),sender:r}).then(({tx:i,sender:n})=>{i.from!=null?i.from.toLowerCase()!==n&&Kn.throwArgumentError("from address mismatch","transaction",e):i.from=n;let o=this.provider.constructor.hexlifyTransaction(i,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&Kn.throwError("user rejected transaction",fe.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:i}),A0e("sendTransaction",s,o)))})}signTransaction(e){return Kn.throwError("signing transactions is unsupported",fe.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return ph(this,void 0,void 0,function*(){let r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),i=yield this.sendUncheckedTransaction(e);try{return yield Yl(()=>ph(this,void 0,void 0,function*(){let n=yield this.provider.getTransaction(i);if(n!==null)return this.provider._wrapTransaction(n,i,r)}),{oncePoll:this.provider})}catch(n){throw n.transactionHash=i,n}})}signMessage(e){return ph(this,void 0,void 0,function*(){let r=typeof e=="string"?ui(e):e,i=yield this.getAddress();try{return yield this.provider.send("personal_sign",[De(r),i.toLowerCase()])}catch(n){throw typeof n.message=="string"&&n.message.match(/user denied/i)&&Kn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"signMessage",from:i,messageData:e}),n}})}_legacySignMessage(e){return ph(this,void 0,void 0,function*(){let r=typeof e=="string"?ui(e):e,i=yield this.getAddress();try{return yield this.provider.send("eth_sign",[i.toLowerCase(),De(r)])}catch(n){throw typeof n.message=="string"&&n.message.match(/user denied/i)&&Kn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:i,messageData:e}),n}})}_signTypedData(e,r,i){return ph(this,void 0,void 0,function*(){let n=yield Yc.resolveNames(e,r,i,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(Yc.getPayload(n.domain,r,n.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&Kn.throwError("user rejected signing",fe.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:n.domain,types:r,value:n.value}}),s}})}unlock(e){return ph(this,void 0,void 0,function*(){let r=this.provider,i=yield this.getAddress();return r.send("personal_unlockAccount",[i.toLowerCase(),e,null])})}},_D=class extends c3{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:i=>this.provider.waitForTransaction(r,i)}))}},LWe={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0},da=class extends kf{constructor(e,r){let i=r;i==null&&(i=new Promise((n,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{n(s)},s=>{o(s)})},0)})),super(i),e||(e=vn(this.constructor,"defaultUrl")()),typeof e=="string"?ye(this,"connection",Object.freeze({url:e})):ye(this,"connection",Object.freeze(di(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return ph(this,void 0,void 0,function*(){yield E0e(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){let r=vn(this.constructor,"getNetwork");try{return r(Ue.from(e).toNumber())}catch(i){return Kn.throwError("could not detect network",fe.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:i})}}return Kn.throwError("could not detect network",fe.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new c3(xD,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){let i={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:wn(i),provider:this});let n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];let o=Zl(this.connection,JSON.stringify(i),DWe).then(s=>(this.emit("debug",{action:"response",request:i,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:i,provider:this}),s});return n&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[x5(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[x5(r.address),r.blockTag]];case"getCode":return["eth_getCode",[x5(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[x5(r.address),Kr(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[vn(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[vn(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=x5(r.filter.address)),["eth_getLogs",[r.filter]];default:break}return null}perform(e,r){return ph(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){let n=r.transaction;if(n&&n.type!=null&&Ue.from(n.type).isZero()&&n.maxFeePerGas==null&&n.maxPriorityFeePerGas==null){let o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=di(r),r.transaction=di(n),delete r.transaction.type)}}let i=this.prepareRequest(e,r);i==null&&Kn.throwError(e+" not implemented",fe.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(i[0],i[1])}catch(n){return A0e(e,n,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;let e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(i){function n(){e.send("eth_getFilterChanges",[i]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(a).then(function(c){return e.emit("pending",c),null})})}),s.then(function(){return E0e(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[i]);return}return setTimeout(function(){n()},0),null}).catch(o=>{})}return n(),i}).catch(i=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){let i=di(LWe);if(r)for(let o in r)r[o]&&(i[o]=!0);Pw(e,i);let n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;let s=uf(Ue.from(e[o]));o==="gasLimit"&&(o="gas"),n[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(n[o]=De(e[o]))}),e.accessList&&(n.accessList=nc(e.accessList)),n}};var l3=null;try{if(l3=WebSocket,l3==null)throw new Error("inject please")}catch{let e=new fe(Ci);l3=function(){e.throwError("WebSockets not supported in this environment",fe.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ED=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},W_=new fe(Ci),BWe=1,mh=class extends da{constructor(e,r){r==="any"&&W_.throwError("WebSocketProvider does not support 'any' network yet",fe.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?ye(this,"_websocket",new l3(this.connection.url)):ye(this,"_websocket",e),ye(this,"_requests",{}),ye(this,"_subs",{}),ye(this,"_subIds",{}),ye(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(n=>{this.websocket.send(this._requests[n].payload)})},this.websocket.onmessage=n=>{let o=n.data,s=JSON.parse(o);if(s.id!=null){let a=String(s.id),c=this._requests[a];if(delete this._requests[a],s.result!==void 0)c.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(c.payload),response:s.result,provider:this});else{let h=null;s.error?(h=new Error(s.error.message||"unknown error"),ye(h,"code",s.error.code||null),ye(h,"response",o)):h=new Error("unknown error"),c.callback(h,void 0),this.emit("debug",{action:"response",error:h,request:JSON.parse(c.payload),provider:this})}}else if(s.method==="eth_subscription"){let a=this._subs[s.params.subscription];a&&a.processFunc(s.params.result)}else console.warn("this should not happen")};let i=setInterval(()=>{this.emit("poll")},1e3);i.unref&&i.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){W_.throwError("cannot reset events block on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){W_.throwError("cannot set polling interval on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return ED(this,void 0,void 0,function*(){return null})}set polling(e){e&&W_.throwError("cannot set polling on WebSocketProvider",fe.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){let i=BWe++;return new Promise((n,o)=>{function s(c,h){return c?o(c):n(h)}let a=JSON.stringify({method:e,params:r,id:i,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(i)]={callback:s,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,i){return ED(this,void 0,void 0,function*(){let n=this._subIds[e];n==null&&(n=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=n);let o=yield n;this._subs[o]={tag:e,processFunc:i}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{let i=Ue.from(r.number).toNumber();this._emitted.block=i,this.emit("block",i)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{let r=i=>{let n=i.hash;this.getTransactionReceipt(n).then(o=>{o&&this.emit(n,o)})};r(e),this._subscribe("tx",["newHeads"],i=>{this._events.filter(n=>n.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(n=>n.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;let i=this._subIds[r];i&&(delete this._subIds[r],i.then(n=>{this._subs[n]&&(delete this._subs[n],this.send("eth_unsubscribe",[n]))}))}destroy(){return ED(this,void 0,void 0,function*(){this.websocket.readyState===l3.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}};var UWe=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},E5=new fe(Ci),A5=class extends da{detectNetwork(){let e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return UWe(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||E5.throwError("no network detected",fe.errors.UNKNOWN_ERROR,{}),this._network==null&&(ye(this,"_network",r),this.emit("network",r,null))),r})}},ws=class t extends A5{constructor(e,r){E5.checkAbstract(new.target,t),e=vn(new.target,"getNetwork")(e),r=vn(new.target,"getApiKey")(r);let i=vn(new.target,"getUrl")(e,r);super(i,e),typeof r=="string"?ye(this,"apiKey",r):r!=null&&Object.keys(r).forEach(n=>{ye(this,n,r[n])})}_startPending(){E5.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return E5.throwError("API provider does not support signing",fe.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return E5.throwError("not implemented; sub-classes must override getUrl",fe.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}};var C0e=new fe(Ci),H_="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC",C5=class extends mh{constructor(e,r){let i=new u3(e,r),n=i.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(n,i.network),ye(this,"apiKey",i.apiKey)}isCommunityResource(){return this.apiKey===H_}},u3=class extends ws{static getWebSocketProvider(e,r){return new C5(e,r)}static getApiKey(e){return e==null?H_:(e&&typeof e!="string"&&C0e.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let i=null;switch(e.name){case"homestead":i="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":i="eth-goerli.g.alchemy.com/v2/";break;case"matic":i="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":i="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":i="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":i="arb-goerli.g.alchemy.com/v2/";break;case"optimism":i="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":i="opt-goerli.g.alchemy.com/v2/";break;default:C0e.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+i+r,throttleCallback:(n,o)=>(r===H_&&Rf(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===H_}};var FWe=new fe(Ci),z_="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function jWe(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return FWe.throwArgumentError("unsupported network","name",t)}var S5=class extends ws{isCommunityResource(){return this.apiKey===z_}static getApiKey(e){return e??z_}static getUrl(e,r){r==null&&(r=z_);let i={allowGzip:!0,url:"https://"+jWe(e.name)+r,throttleCallback:(n,o)=>(r.apiKey===z_&&Rf(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}};var $We=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},S0e=new fe(Ci),I5=class extends ws{static getApiKey(e){return e!=null&&S0e.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let i=null;switch(e.name){case"homestead":i="https://cloudflare-eth.com/";break;default:S0e.throwArgumentError("unsupported network","network",arguments[0])}return i}perform(e,r){let i=Object.create(null,{perform:{get:()=>super.perform}});return $We(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield i.perform.call(this,"getBlock",{blockTag:"latest"})).number:i.perform.call(this,e,r)})}};var q_=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},ap=new fe(Ci);function I0e(t){let e={};for(let r in t){if(t[r]==null)continue;let i=t[r];r==="type"&&i===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?i=uf(De(i)):r==="accessList"?i="["+nc(i).map(n=>`{address:"${n.address}",storageKeys:["${n.storageKeys.join('","')}"]}`).join(",")+"]":i=De(i),e[r]=i)}return e}function WWe(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){let e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function T0e(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){let e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){let e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){let e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function R0e(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function AD(t,e,r){if(t==="call"&&e.code===fe.errors.SERVER_ERROR){let n=e.error;if(n&&(n.message.match(/reverted/i)||n.message.match(/VM execution error/i))){let o=n.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),Zt(o))return o;ap.throwError("missing revert data in call exception",fe.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let i=e.message;throw e.code===fe.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText)),i=(i||"").toLowerCase(),i.match(/insufficient funds/)&&ap.throwError("insufficient funds for intrinsic transaction cost",fe.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),i.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ap.throwError("nonce has already been used",fe.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),i.match(/another transaction with same nonce/)&&ap.throwError("replacement fee too low",fe.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),i.match(/execution failed due to an exception|execution reverted/)&&ap.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",fe.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}var T5=class extends kf{constructor(e,r){super(e),ye(this,"baseUrl",this.getBaseUrl()),ye(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io";default:}return ap.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){let i=Object.keys(r).reduce((o,s)=>{let a=r[s];return a!=null&&(o+=`&${s}=${a}`),o},""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${i}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,i){return q_(this,void 0,void 0,function*(){let n=i?this.getPostUrl():this.getUrl(e,r),o=i?this.getPostData(e,r):null,s=e==="proxy"?T0e:WWe;this.emit("debug",{action:"request",request:n,provider:this});let a={url:n,throttleSlotInterval:1e3,throttleCallback:(g,b)=>(this.isCommunityResource()&&Rf(),Promise.resolve(!0))},c=null;o&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},c=Object.keys(o).map(g=>`${g}=${o[g]}`).join("&"));let h=yield Zl(a,c,s||T0e);return this.emit("debug",{action:"response",request:n,response:wn(h),provider:this}),h})}detectNetwork(){return q_(this,void 0,void 0,function*(){return this.network})}perform(e,r){let i=Object.create(null,{perform:{get:()=>super.perform}});return q_(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(n=>AD("sendTransaction",n,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");let n=I0e(r.transaction);n.module="proxy",n.action="eth_call";try{return yield this.fetch("proxy",n,!0)}catch(o){return AD("call",o,r.transaction)}}case"estimateGas":{let n=I0e(r.transaction);n.module="proxy",n.action="eth_estimateGas";try{return yield this.fetch("proxy",n,!0)}catch(o){return AD("estimateGas",o,r.transaction)}}case"getLogs":{let n={action:"getLogs"};if(r.filter.fromBlock&&(n.fromBlock=R0e(r.filter.fromBlock)),r.filter.toBlock&&(n.toBlock=R0e(r.filter.toBlock)),r.filter.address&&(n.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ap.throwError("unsupported topic count",fe.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){let a=r.filter.topics[0];(typeof a!="string"||a.length!==66)&&ap.throwError("unsupported topic format",fe.errors.UNSUPPORTED_OPERATION,{topic0:a}),n.topic0=a}let o=yield this.fetch("logs",n),s={};for(let a=0;a<o.length;a++){let c=o[a];if(c.blockHash==null){if(s[c.blockNumber]==null){let h=yield this.getBlock(c.blockNumber);h&&(s[c.blockNumber]=h.hash)}c.blockHash=s[c.blockNumber]}}return o}case"getEtherPrice":return this.network.name!=="homestead"?0:parseFloat((yield this.fetch("stats",{action:"ethprice"})).ethusd);default:break}return i.perform.call(this,e,r)})}getHistory(e,r,i){return q_(this,void 0,void 0,function*(){let n={action:"txlist",address:yield this.resolveName(e),startblock:r??0,endblock:i??99999999,sort:"asc"};return(yield this.fetch("account",n)).map(s=>{["contractAddress","to"].forEach(function(c){s[c]==""&&delete s[c]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);let a=this.formatter.transactionResponse(s);return s.timeStamp&&(a.timestamp=parseInt(s.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}};var G_=function(t,e,r,i){function n(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(g){try{h(i.next(g))}catch(b){s(b)}}function c(g){try{h(i.throw(g))}catch(b){s(b)}}function h(g){g.done?o(g.value):n(g.value).then(a,c)}h((i=i.apply(t,e||[])).next())})},Um=new fe(Ci);function V_(){return new Date().getTime()}function k0e(t){let e=null;for(let r=0;r<t.length;r++){let i=t[r];if(i==null)return null;e?e.name===i.name&&e.chainId===i.chainId&&(e.ensAddress===i.ensAddress||e.ensAddress==null&&i.ensAddress==null)||Um.throwArgumentError("provider mismatch","networks",t):e=i}return e}function N0e(t,e){t=t.slice().sort();let r=Math.floor(t.length/2);if(t.length%2)return t[r];let i=t[r-1],n=t[r];return e!=null&&Math.abs(i-n)>e?null:(i+n)/2}function f3(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(Ue.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>f3(e)));if(typeof t=="object"){let e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let i=t[r];return typeof i=="function"?i="[function]":i=f3(i),JSON.stringify(r)+":"+i}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}var HWe=1;function P0e(t){let e=null,r=null,i=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)}),n=s=>(i=i.then(s),i);function o(){return i}return{cancel:e,getPromise:o,wait:n}}var zWe=[fe.errors.CALL_EXCEPTION,fe.errors.INSUFFICIENT_FUNDS,fe.errors.NONCE_EXPIRED,fe.errors.REPLACEMENT_UNDERPRICED,fe.errors.UNPREDICTABLE_GAS_LIMIT],qWe=["address","args","errorArgs","errorSignature","method","transaction"];function K_(t,e){let r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function VWe(t,e){return function(r){let i={};r.forEach(o=>{let s=t(o.result);i[s]||(i[s]={count:0,result:o.result}),i[s].count++});let n=Object.keys(i);for(let o=0;o<n.length;o++){let s=i[n[o]];if(s.count>=e)return s.result}}}function KWe(t,e,r){let i=f3;switch(e){case"getBlockNumber":return function(n){let o=n.map(a=>a.result),s=N0e(n.map(a=>a.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(n){let o=n.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(n){return N0e(n.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":i=function(n){return n==null?null:(n=di(n),n.confirmations=-1,f3(n))};break;case"getBlock":r.includeTransactions?i=function(n){return n==null?null:(n=di(n),n.transactions=n.transactions.map(o=>(o=di(o),o.confirmations=-1,o)),f3(n))}:i=function(n){return n==null?null:f3(n)};break;default:throw new Error("unknown method: "+e)}return VWe(i,t.quorum)}function R5(t,e){return G_(this,void 0,void 0,function*(){let r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:Yl(()=>new Promise((i,n)=>{setTimeout(function(){return r.blockNumber>=e?i(r):t.cancelled?i(null):i(void 0)},0)}),{oncePoll:r})})}function GWe(t,e,r,i){return G_(this,void 0,void 0,function*(){let n=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return n[r]();case"getEtherPrice":if(n.getEtherPrice)return n.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return i.blockTag&&Zt(i.blockTag)&&(n=yield R5(t,e)),n[r](i.address,i.blockTag||"latest");case"getStorageAt":return i.blockTag&&Zt(i.blockTag)&&(n=yield R5(t,e)),n.getStorageAt(i.address,i.position,i.blockTag||"latest");case"getBlock":return i.blockTag&&Zt(i.blockTag)&&(n=yield R5(t,e)),n[i.includeTransactions?"getBlockWithTransactions":"getBlock"](i.blockTag||i.blockHash);case"call":case"estimateGas":return i.blockTag&&Zt(i.blockTag)&&(n=yield R5(t,e)),r==="call"&&i.blockTag?n[r](i.transaction,i.blockTag):n[r](i.transaction);case"getTransaction":case"getTransactionReceipt":return n[r](i.transactionHash);case"getLogs":{let o=i.filter;return(o.fromBlock&&Zt(o.fromBlock)||o.toBlock&&Zt(o.toBlock))&&(n=yield R5(t,e)),n.getLogs(o)}}return Um.throwError("unknown method error",fe.errors.UNKNOWN_ERROR,{method:r,params:i})})}var k5=class extends kf{constructor(e,r){e.length===0&&Um.throwArgumentError("missing providers","providers",e);let i=e.map((s,a)=>{if(Jc.isProvider(s)){let g=v5(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:g,priority:1})}let c=di(s);c.priority==null&&(c.priority=1),c.stallTimeout==null&&(c.stallTimeout=v5(s)?2e3:750),c.weight==null&&(c.weight=1);let h=c.weight;return(h%1||h>512||h<1)&&Um.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,h),Object.freeze(c)}),n=i.reduce((s,a)=>s+a.weight,0);r==null?r=n/2:r>n&&Um.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=k0e(i.map(s=>s.provider.network));o==null&&(o=new Promise((s,a)=>{setTimeout(()=>{this.detectNetwork().then(s,a)},0)})),super(o),ye(this,"providerConfigs",Object.freeze(i)),ye(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return G_(this,void 0,void 0,function*(){let e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return k0e(e)})}perform(e,r){return G_(this,void 0,void 0,function*(){if(e==="sendTransaction"){let c=yield Promise.all(this.providerConfigs.map(h=>h.provider.sendTransaction(r.signedTransaction).then(g=>g.hash,g=>g)));for(let h=0;h<c.length;h++){let g=c[h];if(typeof g=="string")return g}throw c[0]}this._highestBlockNumber===-1&&e!=="getBlockNumber"&&(yield this.getBlockNumber());let i=KWe(this,e,r),n=h5(this.providerConfigs.map(di));n.sort((c,h)=>c.priority-h.priority);let o=this._highestBlockNumber,s=0,a=!0;for(;;){let c=V_(),h=n.filter(A=>A.runner&&c-A.start<A.stallTimeout).reduce((A,T)=>A+T.weight,0);for(;h<this.quorum&&s<n.length;){let A=n[s++],T=HWe++;A.start=V_(),A.staller=P0e(A.stallTimeout),A.staller.wait(()=>{A.staller=null}),A.runner=GWe(A,o,e,r).then(P=>{A.done=!0,A.result=P,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:K_(A,V_()),request:{method:e,params:wn(r)},provider:this})},P=>{A.done=!0,A.error=P,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:K_(A,V_()),request:{method:e,params:wn(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:T,backend:K_(A,null),request:{method:e,params:wn(r)},provider:this}),h+=A.weight}let g=[];n.forEach(A=>{A.done||!A.runner||(g.push(A.runner),A.staller&&g.push(A.staller.getPromise()))}),g.length&&(yield Promise.race(g));let b=n.filter(A=>A.done&&A.error==null);if(b.length>=this.quorum){let A=i(b);if(A!==void 0)return n.forEach(T=>{T.staller&&T.staller.cancel(),T.cancelled=!0}),A;a||(yield P0e(100).getPromise()),a=!1}let E=n.reduce((A,T)=>{if(!T.done||T.error==null)return A;let P=T.error.code;return zWe.indexOf(P)>=0&&(A[P]||(A[P]={error:T.error,weight:0}),A[P].weight+=T.weight),A},{});if(Object.keys(E).forEach(A=>{let T=E[A];if(T.weight<this.quorum)return;n.forEach(j=>{j.staller&&j.staller.cancel(),j.cancelled=!0});let P=T.error,L={};qWe.forEach(j=>{P[j]!=null&&(L[j]=P[j])}),Um.throwError(P.reason||P.message,A,L)}),n.filter(A=>!A.done).length===0)break}return n.forEach(c=>{c.staller&&c.staller.cancel(),c.cancelled=!0}),Um.throwError("failed to meet quorum",fe.errors.SERVER_ERROR,{method:e,params:r,results:n.map(c=>K_(c)),provider:this})})}};var CD=null;var Z_=new fe(Ci),N5="84842078b09946638c03157f83405213",P5=class extends mh{constructor(e,r){let i=new h3(e,r),n=i.connection;n.password&&Z_.throwError("INFURA WebSocket project secrets unsupported",fe.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});let o=n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),ye(this,"apiKey",i.projectId),ye(this,"projectId",i.projectId),ye(this,"projectSecret",i.projectSecret)}isCommunityResource(){return this.projectId===N5}},h3=class extends ws{static getWebSocketProvider(e,r){return new P5(e,r)}static getApiKey(e){let r={apiKey:N5,projectId:N5,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(Z_.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),Z_.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let i=null;switch(e?e.name:"unknown"){case"homestead":i="mainnet.infura.io";break;case"goerli":i="goerli.infura.io";break;case"sepolia":i="sepolia.infura.io";break;case"matic":i="polygon-mainnet.infura.io";break;case"maticmum":i="polygon-mumbai.infura.io";break;case"optimism":i="optimism-mainnet.infura.io";break;case"optimism-goerli":i="optimism-goerli.infura.io";break;case"arbitrum":i="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":i="arbitrum-goerli.infura.io";break;default:Z_.throwError("unsupported network",fe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}let n={allowGzip:!0,url:"https://"+i+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===N5&&Rf(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}isCommunityResource(){return this.projectId===N5}};var Y_=class extends da{send(e,r){let i={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);let n={request:i,resolve:null,reject:null},o=new Promise((s,a)=>{n.resolve=s,n.reject=a});return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{let s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;let a=s.map(c=>c.request);return this.emit("debug",{action:"requestBatch",request:wn(a),provider:this}),Zl(this.connection,JSON.stringify(a)).then(c=>{this.emit("debug",{action:"response",request:a,response:c,provider:this}),s.forEach((h,g)=>{let b=c[g];if(b.error){let E=new Error(b.error.message);E.code=b.error.code,E.data=b.error.data,h.reject(E)}else h.resolve(b.result)})},c=>{this.emit("debug",{action:"response",error:c,request:a,provider:this}),s.forEach(h=>{h.reject(c)})})},10)),o}};var SD=new fe(Ci),ZWe="ETHERS_JS_SHARED",O5=class extends ws{static getApiKey(e){return e&&typeof e!="string"&&SD.throwArgumentError("invalid apiKey","apiKey",e),e||ZWe}static getUrl(e,r){SD.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let i=null;switch(e.name){case"homestead":i="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":i="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":i="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":i="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":i="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:SD.throwArgumentError("unsupported network","network",arguments[0])}return i+"?apiKey="+r}};var O0e=new fe(Ci),M0e="62e1ad51b37b8e00394bda3b",M5=class extends ws{static getApiKey(e){let r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=M0e:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:O0e.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let i=null;switch(e?e.name:"unknown"){case"goerli":i="eth-goerli.gateway.pokt.network";break;case"homestead":i="eth-mainnet.gateway.pokt.network";break;case"kovan":i="poa-kovan.gateway.pokt.network";break;case"matic":i="poly-mainnet.gateway.pokt.network";break;case"maticmum":i="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":i="eth-rinkeby.gateway.pokt.network";break;case"ropsten":i="eth-ropsten.gateway.pokt.network";break;default:O0e.throwError("unsupported network",fe.errors.INVALID_ARGUMENT,{argument:"network",value:e})}let n=`https://${i}/v1/lb/${r.applicationId}`,o={headers:{},url:n};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===M0e}};var D0e=new fe(Ci),YWe=1;function L0e(t,e){let r="Web3LegacyFetcher";return function(i,n){let o={method:i,params:n,id:YWe++,jsonrpc:"2.0"};return new Promise((s,a)=>{this.emit("debug",{action:"request",fetcher:r,request:wn(o),provider:this}),e(o,(c,h)=>{if(c)return this.emit("debug",{action:"response",fetcher:r,error:c,request:o,provider:this}),a(c);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:h,provider:this}),h.error){let g=new Error(h.error.message);return g.code=h.error.code,g.data=h.error.data,a(g)}s(h.result)})})}}function JWe(t){return function(e,r){r==null&&(r=[]);let i={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:wn(i),provider:this}),t.request(i).then(n=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,response:n,provider:this}),n),n=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:i,error:n,provider:this}),n})}}var D5=class extends da{constructor(e,r){e==null&&D0e.throwArgumentError("missing provider","provider",e);let i=null,n=null,o=null;typeof e=="function"?(i="unknown:",n=e):(i=e.host||e.path||"",!i&&e.isMetaMask&&(i="metamask"),o=e,e.request?(i===""&&(i="eip-1193:"),n=JWe(e)):e.sendAsync?n=L0e(e,e.sendAsync.bind(e)):e.send?n=L0e(e,e.send.bind(e)):D0e.throwArgumentError("unsupported provider","provider",e),i||(i="unknown:")),super(i,r),ye(this,"jsonRpcFetchFunc",n),ye(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}};var B0e=new fe(Ci);function J_(t,e){if(t==null&&(t="homestead"),typeof t=="string"){let i=t.match(/^(ws|http)s?:/i);if(i)switch(i[1].toLowerCase()){case"http":case"https":return new da(t);case"ws":case"wss":return new mh(t);default:B0e.throwArgumentError("unsupported URL scheme","network",t)}}let r=m5(t);return(!r||!r._defaultProvider)&&B0e.throwError("unsupported getDefaultProvider network",fe.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:k5,AlchemyProvider:u3,AnkrProvider:S5,CloudflareProvider:I5,EtherscanProvider:T5,InfuraProvider:h3,JsonRpcProvider:da,NodesmithProvider:O5,PocketProvider:M5,Web3Provider:D5,IpcProvider:null},e)}var oc={};Oi(oc,{AbiCoder:()=>Uw,ConstructorFragment:()=>pf,ErrorFragment:()=>Am,EventFragment:()=>rh,FormatTypes:()=>oi,Fragment:()=>df,FunctionFragment:()=>mf,HDNode:()=>If,Indexed:()=>nh,Interface:()=>tp,LogDescription:()=>Ww,Logger:()=>fe,ParamType:()=>zo,RLP:()=>K9,SigningKey:()=>rl,SupportedAlgorithm:()=>Cf,TransactionDescription:()=>Hw,TransactionTypes:()=>E_,UnicodeNormalizationForm:()=>$s,Utf8ErrorFuncs:()=>a_,Utf8ErrorReason:()=>ds,_TypedDataEncoder:()=>Yc,_fetchData:()=>dD,_toEscapedUtf8String:()=>vM,accessListify:()=>nc,arrayify:()=>ke,base58:()=>ch,base64:()=>AM,checkProperties:()=>Pw,checkResultErrors:()=>Mw,commify:()=>q0e,computeAddress:()=>il,computeHmac:()=>lh,computePublicKey:()=>o5,concat:()=>Fr,deepCopy:()=>wn,defaultAbiCoder:()=>e5,defaultPath:()=>uh,defineReadOnly:()=>ye,dnsEncode:()=>r5,entropyToMnemonic:()=>Lm,fetchJson:()=>Zl,formatBytes32String:()=>bM,formatEther:()=>V0e,formatUnits:()=>ID,getAccountPath:()=>Bfe,getAddress:()=>$r,getContractAddress:()=>Sm,getCreate2Address:()=>Qle,getIcapAddress:()=>Jle,getJsonWalletAddress:()=>cD,getStatic:()=>vn,hashMessage:()=>$w,hexConcat:()=>qn,hexDataLength:()=>hs,hexDataSlice:()=>Fi,hexStripZeros:()=>aM,hexValue:()=>uf,hexZeroPad:()=>Kr,hexlify:()=>De,id:()=>Xa,isAddress:()=>Yle,isBytes:()=>Kc,isBytesLike:()=>eh,isHexString:()=>Zt,isValidMnemonic:()=>Lfe,isValidName:()=>SM,joinSignature:()=>zy,keccak256:()=>jr,mnemonicToEntropy:()=>r3,mnemonicToSeed:()=>tD,namehash:()=>ep,nameprep:()=>EM,parseBytes32String:()=>yM,parseEther:()=>K0e,parseTransaction:()=>A_,parseUnits:()=>TD,poll:()=>Yl,randomBytes:()=>Tf,recoverAddress:()=>Nm,recoverPublicKey:()=>__,resolveProperties:()=>ji,ripemd160:()=>l5,serializeTransaction:()=>s5,sha256:()=>ha,sha512:()=>JM,shallowCopy:()=>di,shuffled:()=>h5,solidityKeccak256:()=>j0e,solidityPack:()=>X_,soliditySha256:()=>$0e,splitSignature:()=>ff,stripZeros:()=>Ja,toUtf8Bytes:()=>ui,toUtf8CodePoints:()=>Xd,toUtf8String:()=>ua,verifyMessage:()=>e0e,verifyTypedData:()=>t0e,zeroPad:()=>_m});var U0e="solidity/5.7.0";var QWe=new RegExp("^bytes([0-9]+)$"),XWe=new RegExp("^(u?int)([0-9]*)$"),eHe=new RegExp("^(.*)\\[([0-9]*)\\]$"),tHe="0000000000000000000000000000000000000000000000000000000000000000",d3=new fe(U0e);function F0e(t,e,r){switch(t){case"address":return r?_m(e,32):ke(e);case"string":return ui(e);case"bytes":return ke(e);case"bool":return e=e?"0x01":"0x00",r?_m(e,32):ke(e)}let i=t.match(XWe);if(i){let n=parseInt(i[2]||"256");return(i[2]&&String(n)!==i[2]||n%8!==0||n===0||n>256)&&d3.throwArgumentError("invalid number type","type",t),r&&(n=256),e=Ue.from(e).toTwos(n),_m(e,n/8)}if(i=t.match(QWe),i){let n=parseInt(i[1]);return(String(n)!==i[1]||n===0||n>32)&&d3.throwArgumentError("invalid bytes type","type",t),ke(e).byteLength!==n&&d3.throwArgumentError(`invalid value for ${t}`,"value",e),r?ke((e+tHe).substring(0,66)):e}if(i=t.match(eHe),i&&Array.isArray(e)){let n=i[1];parseInt(i[2]||String(e.length))!=e.length&&d3.throwArgumentError(`invalid array length for ${t}`,"value",e);let s=[];return e.forEach(function(a){s.push(F0e(n,a,!0))}),Fr(s)}return d3.throwArgumentError("invalid type","type",t)}function X_(t,e){t.length!=e.length&&d3.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);let r=[];return t.forEach(function(i,n){r.push(F0e(i,e[n]))}),De(Fr(r))}function j0e(t,e){return jr(X_(t,e))}function $0e(t,e){return ha(X_(t,e))}var W0e="units/5.7.0";var H0e=new fe(W0e),z0e=["wei","kwei","mwei","gwei","szabo","finney","ether"];function q0e(t){let e=String(t).split(".");(e.length>2||!e[0].match(/^-?[0-9]*$/)||e[1]&&!e[1].match(/^[0-9]*$/)||t==="."||t==="-.")&&H0e.throwArgumentError("invalid value","value",t);let r=e[0],i="";for(r.substring(0,1)==="-"&&(i="-",r=r.substring(1));r.substring(0,1)==="0";)r=r.substring(1);r===""&&(r="0");let n="";for(e.length===2&&(n="."+(e[1]||"0"));n.length>2&&n[n.length-1]==="0";)n=n.substring(0,n.length-1);let o=[];for(;r.length;)if(r.length<=3){o.unshift(r);break}else{let s=r.length-3;o.unshift(r.substring(s)),r=r.substring(0,s)}return i+o.join(",")+n}function ID(t,e){if(typeof e=="string"){let r=z0e.indexOf(e);r!==-1&&(e=3*r)}return kw(t,e??18)}function TD(t,e){if(typeof t!="string"&&H0e.throwArgumentError("value must be a string","value",t),typeof e=="string"){let r=z0e.indexOf(e);r!==-1&&(e=3*r)}return Zc(t,e??18)}function V0e(t){return ID(t,18)}function K0e(t){return TD(t,18)}var eE="ethers/5.7.2";var G0e=new fe(eE);try{let t=window;t._ethers==null&&(t._ethers=gh)}catch{}var Si={WALLET_ID:"@w3m/wallet_id",ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3};var _o={getCaipDefaultChain(t){if(t)return{id:`${Ge.EIP155}:${t.chainId}`,name:t.name,imageId:eo.EIP155NetworkImageIds[t.chainId]}},hexStringToNumber(t){let e=t.startsWith("0x")?t.slice(2):t;return parseInt(e,16)},numberToHexString(t){return`0x${t.toString(16)}`},async getUserInfo(t){let[e,r]=await Promise.all([_o.getAddress(t),_o.getChainId(t)]);return{chainId:r,address:e}},async getChainId(t){let e=await t.request({method:"eth_chainId"});return Number(e)},async getAddress(t){let[e]=await t.request({method:"eth_accounts"});return e},async addEthereumChain(t,e){await t.request({method:"wallet_addEthereumChain",params:[{chainId:_o.numberToHexString(e.chainId),rpcUrls:[e.rpcUrl],chainName:e.name,nativeCurrency:{name:e.currency,decimals:18,symbol:e.currency},blockExplorerUrls:[e.explorerUrl],iconUrls:[eo.EIP155NetworkImageIds[e.chainId]]}]})}};Yo();nn();var Gn=Jt({provider:void 0,providerType:void 0,address:void 0,chainId:void 0,status:"reconnecting",isConnected:!1}),ut={state:Gn,subscribeKey(t,e){return fi(Gn,t,e)},subscribe(t){return Dr(Gn,()=>t(Gn))},setProvider(t){t&&(Gn.provider=Po(t))},setProviderType(t){Gn.providerType=t},setAddress(t){Gn.address=t},setPreferredAccountType(t){Gn.preferredAccountType=t},setChainId(t){Gn.chainId=t},setStatus(t){Gn.status=t},setIsConnected(t){Gn.isConnected=t},setError(t){Gn.error=t},reset(){Gn.provider=void 0,Gn.address=void 0,Gn.chainId=void 0,Gn.providerType=void 0,Gn.status="disconnected",Gn.isConnected=!1,Gn.error=void 0,Gn.preferredAccountType=void 0}};Mi();var tE=class extends Mb{constructor(e){let{ethersConfig:r,siweConfig:i,chains:n,defaultChain:o,tokens:s,chainImages:a,_sdkVersion:c,...h}=e;if(!r)throw new Error("web3modal:constructor - ethersConfig is undefined");if(!h.projectId)throw new Error("web3modal:constructor - projectId is undefined");let g={switchCaipNetwork:async E=>{let A=dl.caipNetworkIdToNumber(E?.id);if(A)try{ut.setError(void 0),await this.switchNetwork(A)}catch(T){throw ut.setError(T),new Error("networkControllerClient:switchCaipNetwork - unable to switch chain")}},getApprovedCaipNetworksData:async()=>new Promise(async E=>{if(localStorage.getItem(Si.WALLET_ID)?.includes(Ge.WALLET_CONNECT_CONNECTOR_ID)){let T=await this.getWalletConnectProvider();if(!T)throw new Error("networkControllerClient:getApprovedCaipNetworks - provider is undefined");let P=T.signer?.session?.namespaces,L=P?.[Ge.EIP155]?.methods,j=P?.[Ge.EIP155]?.chains,$={supportsAllNetworks:L?.includes(Ge.ADD_CHAIN_METHOD)??!1,approvedCaipNetworkIds:j};E($)}else E({approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})})},b={connectWalletConnect:async E=>{let A=await this.getWalletConnectProvider();if(!A)throw new Error("connectionControllerClient:getWalletConnectUri - provider is undefined");if(A.on("display_uri",T=>{E(T)}),i?.options?.enabled){let{SIWEController:T,getDidChainId:P,getDidAddress:L}=await Promise.resolve().then(()=>(S0(),C0)),$=(await A.authenticate({nonce:await i.getNonce(),methods:tM,...await i.getMessageParams()}))?.auths?.[0];if($){let{p:G,s:Z}=$,te=P(G.iss),se=L(G.iss);se&&te&&T.setSession({address:se,chainId:parseInt(te,10)});try{let X=A.signer.client.formatAuthMessage({request:G,iss:G.iss});await T.verifyMessage({message:X,signature:Z.s,cacao:$})}catch(X){throw console.error("Error verifying message",X),await A.disconnect().catch(console.error),await T.signOut().catch(console.error),X}}}else await A.connect();await this.setWalletConnectProvider()},connectExternal:async({id:E,info:A,provider:T})=>{if(E===Ge.INJECTED_CONNECTOR_ID){let P=r.injected;if(!P)throw new Error("connectionControllerClient:connectInjected - provider is undefined");try{ut.setError(void 0),await P.request({method:"eth_requestAccounts"}),this.setInjectedProvider(r)}catch(L){ut.setError(L)}}else if(E===Ge.EIP6963_CONNECTOR_ID&&A&&T){try{ut.setError(void 0),await T.request({method:"eth_requestAccounts"})}catch(P){ut.setError(P)}this.setEIP6963Provider(T,A.name)}else if(E===Ge.COINBASE_SDK_CONNECTOR_ID){let P=r.coinbase;if(!P)throw new Error("connectionControllerClient:connectCoinbase - connector is undefined");try{ut.setError(void 0),await P.request({method:"eth_requestAccounts"}),this.setCoinbaseProvider(r)}catch(L){throw ut.setError(L),new Error(L.message)}}},checkInstalled:E=>E?r.injected&&!window?.ethereum?!1:E.some(A=>!!window.ethereum?.[String(A)]):!!window.ethereum,disconnect:async()=>{let E=ut.state.provider,A=ut.state.providerType;if(localStorage.removeItem(Si.WALLET_ID),ut.reset(),i?.options?.signOutOnDisconnect){let{SIWEController:T}=await Promise.resolve().then(()=>(S0(),C0));await T.signOut()}A===Ge.WALLET_CONNECT_CONNECTOR_ID?await E.disconnect():E&&E.emit("disconnect")},signMessage:async E=>{let A=ut.state.provider;if(!A)throw new Error("connectionControllerClient:signMessage - provider is undefined");let T=oc.isHexString(E)?E:oc.hexlify(oc.toUtf8Bytes(E));return await A.request({method:"personal_sign",params:[T,this.getAddress()]})},parseUnits:(E,A)=>gh.utils.parseUnits(E,A).toBigInt(),formatUnits:(E,A)=>gh.utils.formatUnits(E,A),sendTransaction:async E=>{let A=ut.state.provider,T=ut.state.address;if(!A)throw new Error("connectionControllerClient:sendTransaction - provider is undefined");if(!T)throw new Error("connectionControllerClient:sendTransaction - address is undefined");let P={to:E.to,value:E.value,gasLimit:E.gas,gasPrice:E.gasPrice,data:E.data,type:0};return(await(await new gh.providers.Web3Provider(A).getSigner().sendTransaction(P)).wait())?.blockHash||null}};super({networkControllerClient:g,connectionControllerClient:b,siweControllerClient:i,defaultChain:_o.getCaipDefaultChain(o),tokens:LI.getCaipTokens(s),_sdkVersion:c??`html-ethers5-${Ge.VERSION}`,...h}),this.hasSyncedConnectedAccount=!1,this.EIP6963Providers=[],this.options=void 0,this.options=e,this.metadata=r.metadata,this.projectId=h.projectId,this.chains=n,this.createProvider(),ut.subscribeKey("address",()=>{this.syncAccount()}),ut.subscribeKey("chainId",()=>{this.syncNetwork(a)}),this.syncRequestedNetworks(n,a),this.syncConnectors(r),r.injected&&this.checkActiveInjectedProvider(r),r.coinbase&&this.checkActiveCoinbaseProvider(r),typeof window<"u"&&(this.listenConnectors(!0),this.checkActive6963Provider()),this.setEIP6963Enabled(r.EIP6963)}getState(){let e=super.getState();return{...e,selectedNetworkId:dl.caipNetworkIdToNumber(e.selectedNetworkId)}}subscribeState(e){return super.subscribeState(r=>e({...r,selectedNetworkId:dl.caipNetworkIdToNumber(r.selectedNetworkId)}))}setAddress(e){let r=e?oc.getAddress(e):void 0;ut.setAddress(r)}getAddress(){let{address:e}=ut.state;return e&&oc.getAddress(e)}getError(){return ut.state.error}getChainId(){return ut.state.chainId}getStatus(){return ut.state.status}getIsConnected(){return ut.state.isConnected}getWalletProvider(){return ut.state.provider}getWalletProviderType(){return ut.state.providerType}subscribeProvider(e){return ut.subscribe(e)}async disconnect(){let{provider:e,providerType:r}=ut.state;localStorage.removeItem(Si.WALLET_ID),ut.reset(),r==="injected"||r==="eip6963"?e?.emit("disconnect"):await e.disconnect()}createProvider(){return!this.walletConnectProviderInitPromise&&typeof window<"u"&&(this.walletConnectProviderInitPromise=this.initWalletConnectProvider()),this.walletConnectProviderInitPromise}async initWalletConnectProvider(){let e={projectId:this.projectId,showQrModal:!1,rpcMap:this.chains?this.chains.reduce((r,i)=>(r[i.chainId]=i.rpcUrl,r),{}):{},optionalChains:[...this.chains.map(r=>r.chainId)],metadata:{name:this.metadata?this.metadata.name:"",description:this.metadata?this.metadata.description:"",url:this.metadata?this.metadata.url:"",icons:this.metadata?this.metadata.icons:[""]}};this.walletConnectProvider=await F9.init(e),await this.checkActiveWalletConnectProvider()}async getWalletConnectProvider(){if(!this.walletConnectProvider)try{ut.setError(void 0),await this.createProvider()}catch(e){ut.setError(e)}return this.walletConnectProvider}syncRequestedNetworks(e,r){let i=e?.map(n=>({id:`${Ge.EIP155}:${n.chainId}`,name:n.name,imageId:eo.EIP155NetworkImageIds[n.chainId],imageUrl:r?.[n.chainId]}));this.setRequestedCaipNetworks(i??[])}async checkActiveWalletConnectProvider(){let e=await this.getWalletConnectProvider(),r=localStorage.getItem(Si.WALLET_ID);e&&r===Ge.WALLET_CONNECT_CONNECTOR_ID&&await this.setWalletConnectProvider();let i=ut.state.isConnected;ut.setStatus(i?"connected":"disconnected")}checkActiveInjectedProvider(e){let r=e.injected,i=localStorage.getItem(Si.WALLET_ID);r&&i===Ge.INJECTED_CONNECTOR_ID&&(this.setInjectedProvider(e),this.watchInjected(e))}checkActiveCoinbaseProvider(e){let r=e.coinbase,i=localStorage.getItem(Si.WALLET_ID);r&&i===Ge.COINBASE_SDK_CONNECTOR_ID&&(r._addresses&&r._addresses?.length>0?(this.setCoinbaseProvider(e),this.watchCoinbase(e)):(localStorage.removeItem(Si.WALLET_ID),ut.reset()))}checkActive6963Provider(){let e=window?.localStorage.getItem(Si.WALLET_ID);if(e){let r=this.EIP6963Providers.find(i=>i.info.name===e);r&&this.setEIP6963Provider(r.provider,r.info.name)}}async setWalletConnectProvider(){window?.localStorage.setItem(Si.WALLET_ID,Ge.WALLET_CONNECT_CONNECTOR_ID);let e=await this.getWalletConnectProvider();e&&(ut.setChainId(e.chainId),ut.setProviderType("walletConnect"),ut.setProvider(e),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(e.accounts?.[0]),this.watchWalletConnect())}async setEIP6963Provider(e,r){if(window?.localStorage.setItem(Si.WALLET_ID,r),e){let{address:i,chainId:n}=await _o.getUserInfo(e);i&&n&&(ut.setChainId(n),ut.setProviderType("eip6963"),ut.setProvider(e),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchEIP6963(e))}}async setInjectedProvider(e){window?.localStorage.setItem(Si.WALLET_ID,Ge.INJECTED_CONNECTOR_ID);let r=e.injected;if(r){let{address:i,chainId:n}=await _o.getUserInfo(r);i&&n&&(ut.setChainId(n),ut.setProviderType("injected"),ut.setProvider(e.injected),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchCoinbase(e))}}async setCoinbaseProvider(e){window?.localStorage.setItem(Si.WALLET_ID,Ge.COINBASE_SDK_CONNECTOR_ID);let r=e.coinbase;if(r){let{address:i,chainId:n}=await _o.getUserInfo(r);i&&n&&(ut.setChainId(n),ut.setProviderType("coinbaseWalletSDK"),ut.setProvider(e.coinbase),ut.setStatus("connected"),ut.setIsConnected(!0),this.setAddress(i),this.watchCoinbase(e))}}async watchWalletConnect(){let e=await this.getWalletConnectProvider();function r(){localStorage.removeItem(Si.WALLET_ID),ut.reset(),e?.removeListener("disconnect",r),e?.removeListener("accountsChanged",n),e?.removeListener("chainChanged",i)}function i(o){if(o){let s=_o.hexStringToNumber(o);ut.setChainId(s)}}let n=async o=>{o.length>0&&await this.setWalletConnectProvider()};e&&(e.on("disconnect",r),e.on("accountsChanged",n),e.on("chainChanged",i))}watchInjected(e){let r=e.injected;function i(){localStorage.removeItem(Si.WALLET_ID),ut.reset(),r?.removeListener("disconnect",i),r?.removeListener("accountsChanged",n),r?.removeListener("chainChanged",o)}function n(s){let a=s?.[0];a?ut.setAddress(oc.getAddress(a)):(localStorage.removeItem(Si.WALLET_ID),ut.reset())}function o(s){if(s){let a=typeof s=="string"?_o.hexStringToNumber(s):Number(s);ut.setChainId(a)}}r&&(r.on("disconnect",i),r.on("accountsChanged",n),r.on("chainChanged",o))}watchEIP6963(e){function r(){localStorage.removeItem(Si.WALLET_ID),ut.reset(),e.removeListener("disconnect",r),e.removeListener("accountsChanged",i),e.removeListener("chainChanged",n)}function i(o){let s=o?.[0];s?ut.setAddress(oc.getAddress(s)):(localStorage.removeItem(Si.WALLET_ID),ut.reset())}function n(o){if(o){let s=typeof o=="string"?_o.hexStringToNumber(o):Number(o);ut.setChainId(s)}}e.on("disconnect",r),e.on("accountsChanged",i),e.on("chainChanged",n)}watchCoinbase(e){let r=e.coinbase,i=localStorage.getItem(Si.WALLET_ID);function n(){localStorage.removeItem(Si.WALLET_ID),ut.reset(),r?.removeListener("disconnect",n),r?.removeListener("accountsChanged",o),r?.removeListener("chainChanged",s)}function o(a){a.length===0?(localStorage.removeItem(Si.WALLET_ID),ut.reset()):ut.setAddress(a[0])}function s(a){if(a&&i===Ge.COINBASE_SDK_CONNECTOR_ID){let c=Number(a);ut.setChainId(c)}}r&&(r.on("disconnect",n),r.on("accountsChanged",o),r.on("chainChanged",s))}async syncAccount(){let e=ut.state.address,r=ut.state.chainId,i=ut.state.isConnected;if(this.resetAccount(),i&&e&&r){let n=`${Ge.EIP155}:${r}:${e}`;this.setIsConnected(i),this.setCaipAddress(n),this.syncConnectedWalletInfo(),await Promise.all([this.syncProfile(e),this.syncBalance(e),this.getApprovedCaipNetworksData()]),this.hasSyncedConnectedAccount=!0}else!i&&this.hasSyncedConnectedAccount&&(this.resetWcConnection(),this.resetNetwork())}async syncNetwork(e){let r=ut.state.address,i=ut.state.chainId,n=ut.state.isConnected;if(this.chains){let o=this.chains.find(s=>s.chainId===i);if(o){let s=`${Ge.EIP155}:${o.chainId}`;if(this.setCaipNetwork({id:s,name:o.name,imageId:eo.EIP155NetworkImageIds[o.chainId],imageUrl:e?.[o.chainId]}),n&&r){let a=`${Ge.EIP155}:${i}:${r}`;if(this.setCaipAddress(a),o.explorerUrl){let c=`${o.explorerUrl}/address/${r}`;this.setAddressExplorerUrl(c)}else this.setAddressExplorerUrl(void 0);this.hasSyncedConnectedAccount&&await this.syncBalance(r)}}else n&&this.setCaipNetwork({id:`${Ge.EIP155}:${i}`})}}async syncProfile(e){let r=ut.state.chainId;try{let{name:i,avatar:n}=await this.fetchIdentity({address:e});this.setProfileName(i),this.setProfileImage(n)}catch{if(r===1){let i=new gh.providers.InfuraProvider("mainnet"),n=await i.lookupAddress(e),o=await i.getAvatar(e);n&&this.setProfileName(n),o&&this.setProfileImage(o)}else this.setProfileName(null),this.setProfileImage(null)}}async syncBalance(e){let r=ut.state.chainId;if(r&&this.chains){let i=this.chains.find(n=>n.chainId===r);if(i){let n=new gh.providers.JsonRpcProvider(i.rpcUrl,{chainId:r,name:i.name});if(n){let o=await n.getBalance(e),s=oc.formatEther(o);this.setBalance(s,i.currency)}}}}syncConnectedWalletInfo(){let e=window?.localStorage.getItem(Si.WALLET_ID),r=ut.state.providerType;if(r===Ge.EIP6963_CONNECTOR_ID){if(e){let i=this.EIP6963Providers.find(n=>n.info.name===e);i&&this.setConnectedWalletInfo({...i.info})}}else if(r===Ge.WALLET_CONNECT_CONNECTOR_ID){let i=ut.state.provider;i.session&&this.setConnectedWalletInfo({...i.session.peer.metadata,name:i.session.peer.metadata.name,icon:i.session.peer.metadata.icons?.[0]})}else e&&this.setConnectedWalletInfo({name:e})}async switchNetwork(e){let r=ut.state.provider,i=ut.state.providerType;if(this.chains){let n=this.chains.find(o=>o.chainId===e);if(i===Ge.WALLET_CONNECT_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:_o.numberToHexString(n.chainId)}]}),ut.setChainId(e)}catch(s){if(s.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Si.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await _o.addEthereumChain(o,n);else throw new Error("Chain is not supported")}}else if(i===Ge.EIP6963_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:_o.numberToHexString(n.chainId)}]}),ut.setChainId(n.chainId)}catch(s){if(s.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Si.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)await _o.addEthereumChain(o,n);else throw new Error("Chain is not supported")}}else if(i===Ge.COINBASE_SDK_CONNECTOR_ID&&n){let o=r;if(o)try{await o.request({method:"wallet_switchEthereumChain",params:[{chainId:_o.numberToHexString(n.chainId)}]}),ut.setChainId(n.chainId)}catch(s){(s.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||s.code===Si.ERROR_CODE_DEFAULT||s?.data?.originalError?.code===Si.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)&&await _o.addEthereumChain(o,n)}}}}syncConnectors(e){let r=[],i=eo.ConnectorTypesMap[Ge.WALLET_CONNECT_CONNECTOR_ID];if(i&&r.push({id:Ge.WALLET_CONNECT_CONNECTOR_ID,explorerId:eo.ConnectorExplorerIds[Ge.WALLET_CONNECT_CONNECTOR_ID],imageId:eo.ConnectorImageIds[Ge.WALLET_CONNECT_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.WALLET_CONNECT_CONNECTOR_ID],name:eo.ConnectorNamesMap[Ge.WALLET_CONNECT_CONNECTOR_ID],type:i}),e.injected){let n=eo.ConnectorTypesMap[Ge.INJECTED_CONNECTOR_ID];n&&r.push({id:Ge.INJECTED_CONNECTOR_ID,explorerId:eo.ConnectorExplorerIds[Ge.INJECTED_CONNECTOR_ID],imageId:eo.ConnectorImageIds[Ge.INJECTED_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.INJECTED_CONNECTOR_ID],name:eo.ConnectorNamesMap[Ge.INJECTED_CONNECTOR_ID],type:n})}e.coinbase&&r.push({id:Ge.COINBASE_SDK_CONNECTOR_ID,explorerId:eo.ConnectorExplorerIds[Ge.COINBASE_SDK_CONNECTOR_ID],imageId:eo.ConnectorImageIds[Ge.COINBASE_SDK_CONNECTOR_ID],imageUrl:this.options?.connectorImages?.[Ge.COINBASE_SDK_CONNECTOR_ID],name:eo.ConnectorNamesMap[Ge.COINBASE_SDK_CONNECTOR_ID],type:"EXTERNAL"}),this.setConnectors(r)}eip6963EventHandler(e){if(e.detail){let{info:r,provider:i}=e.detail,n=this.getConnectors(),o=n.find(c=>c.name===r.name),a=n.find(c=>c.id===Ge.COINBASE_SDK_CONNECTOR_ID)&&e.detail.info.rdns===Ge.CONNECTOR_RDNS_MAP[Ge.COINBASE_SDK_CONNECTOR_ID];if(!o&&!a){let c=eo.ConnectorTypesMap[Ge.EIP6963_CONNECTOR_ID];if(c){this.addConnector({id:Ge.EIP6963_CONNECTOR_ID,type:c,imageUrl:r.icon??this.options?.connectorImages?.[Ge.EIP6963_CONNECTOR_ID],name:r.name,provider:i,info:r});let h={provider:i,info:r};this.EIP6963Providers.push(h)}}}}listenConnectors(e){if(typeof window<"u"&&e){let r=this.eip6963EventHandler.bind(this);window.addEventListener(Ge.EIP6963_ANNOUNCE_EVENT,r),window.dispatchEvent(new Event(Ge.EIP6963_REQUEST_EVENT))}}};aS();var Z1e=Wt(G1e(),1);function aB(t){let{enableEIP6963:e=!0,enableInjected:r=!0,enableCoinbase:i=!0,metadata:n}=t,o,s,a={metadata:n};function c(){if(o)return o;if(!(typeof window>"u")&&window.ethereum)return o=window.ethereum,o}function h(){return s||(typeof window>"u"?void 0:(s=new Z1e.CoinbaseWalletSDK({appName:n.name,appLogoUrl:n.icons[0],appChainIds:t.chains?.map(b=>b.chainId)||[1,84532]}).makeWeb3Provider({options:t.coinbasePreference||"all"}),s))}return i&&(a.coinbase=h()),r&&(a.injected=c()),e&&(a.EIP6963=!0),a}function Y1e(t){return new tE({...t,_sdkVersion:`html-ethers5-${Ge.VERSION}`})}var OGe=(t=>(t.MissingApiKey="MISSING_API_KEY",t.ModalNotReady="MODAL_NOT_READY",t.ConnectionLost="CONNECTION_WAS_LOST",t.MalformedResponse="MALFORMED_RESPONSE",t.InvalidArgument="INVALID_ARGUMENT",t.ExtensionNotInitialized="EXTENSION_NOT_INITIALIZED",t.IncompatibleExtensions="INCOMPATIBLE_EXTENSIONS",t))(OGe||{}),MGe=(t=>(t.SyncWeb3Method="SYNC_WEB3_METHOD",t.DuplicateIframe="DUPLICATE_IFRAME",t.ReactNativeEndpointConfiguration="REACT_NATIVE_ENDPOINT_CONFIGURATION",t.DeprecationNotice="DEPRECATION_NOTICE",t.ProductAnnouncement="ANNOUNCEMENT",t))(MGe||{}),DGe=(t=>(t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.MagicLinkFailedVerification=-1e4]="MagicLinkFailedVerification",t[t.MagicLinkExpired=-10001]="MagicLinkExpired",t[t.MagicLinkRateLimited=-10002]="MagicLinkRateLimited",t[t.MagicLinkInvalidRedirectURL=-10006]="MagicLinkInvalidRedirectURL",t[t.UserAlreadyLoggedIn=-10003]="UserAlreadyLoggedIn",t[t.UpdateEmailFailed=-10004]="UpdateEmailFailed",t[t.UserRequestEditEmail=-10005]="UserRequestEditEmail",t[t.InactiveRecipient=-10010]="InactiveRecipient",t[t.AccessDeniedToUser=-10011]="AccessDeniedToUser",t[t.RedirectLoginComplete=-10015]="RedirectLoginComplete",t[t.DpopInvalidated=-10019]="DpopInvalidated",t))(DGe||{}),Ql=(t=>(t.PROVIDER="magic_3pw_provider",t.ADDRESS="magic_3pw_address",t.CHAIN_ID="magic_3pw_chainId",t))(Ql||{}),M3=(t=>(t.WalletConnected="wallet_connected",t.WalletRejected="wallet_rejected",t.Web3ModalSelected="web3modal_selected",t))(M3||{}),LGe=(t=>(t.LoginWithSms="magic_auth_login_with_sms",t.LoginWithEmailOTP="magic_auth_login_with_email_otp",t.LoginWithMagicLink="magic_auth_login_with_magic_link",t.LoginWithCredential="magic_auth_login_with_credential",t.SetAuthorizationToken="magic_auth_set_authorization_token",t.GetIdToken="magic_auth_get_id_token",t.GenerateIdToken="magic_auth_generate_id_token",t.GetMetadata="magic_auth_get_metadata",t.IsLoggedIn="magic_is_logged_in",t.Logout="magic_auth_logout",t.UpdateEmail="magic_auth_update_email",t.UserSettings="magic_auth_settings",t.UserSettingsTestMode="magic_auth_settings_testing_mode",t.LoginWithSmsTestMode="magic_auth_login_with_sms_testing_mode",t.LoginWithEmailOTPTestMode="magic_auth_login_with_email_otp_testing_mode",t.LoginWithMagicLinkTestMode="magic_login_with_magic_link_testing_mode",t.LoginWithCredentialTestMode="magic_auth_login_with_credential_testing_mode",t.GetIdTokenTestMode="magic_auth_get_id_token_testing_mode",t.GenerateIdTokenTestMode="magic_auth_generate_id_token_testing_mode",t.GetMetadataTestMode="magic_auth_get_metadata_testing_mode",t.IsLoggedInTestMode="magic_auth_is_logged_in_testing_mode",t.LogoutTestMode="magic_auth_logout_testing_mode",t.UpdateEmailTestMode="magic_auth_update_email_testing_mode",t.IntermediaryEvent="magic_intermediary_event",t.RequestAccounts="eth_requestAccounts",t.GetInfo="magic_get_info",t.ShowUI="magic_wallet",t.NFTPurchase="magic_nft_purchase",t.NFTCheckout="magic_nft_checkout",t.NFTTransfer="magic_nft_transfer",t.RequestUserInfoWithUI="mc_request_user_info",t.Disconnect="mc_disconnect",t.RecoverAccount="magic_auth_recover_account",t.RecoverAccountTestMode="magic_auth_recover_account_testing_mode",t.MagicBoxHeartBeat="magic_box_heart_beat",t.AutoConnect="mc_auto_connect",t.Login="mc_login",t.EncryptV1="magic_auth_encrypt_v1",t.DecryptV1="magic_auth_decrypt_v1",t.ShowNFTs="magic_show_nfts",t.ShowOnRamp="magic_show_fiat_onramp",t.ShowSendTokensUI="magic_show_send_tokens_ui",t.ShowAddress="magic_show_address",t.ShowBalances="magic_show_balances",t.SendGaslessTransaction="eth_sendGaslessTransaction",t.RevealPK="magic_reveal_key",t.EnableMFA="magic_auth_enable_mfa_flow",t.DisableMFA="magic_auth_disable_mfa_flow",t))(LGe||{});var BGe=(t=>(t.MAGIC_HANDLE_RESPONSE="MAGIC_HANDLE_RESPONSE",t.MAGIC_OVERLAY_READY="MAGIC_OVERLAY_READY",t.MAGIC_SHOW_OVERLAY="MAGIC_SHOW_OVERLAY",t.MAGIC_HIDE_OVERLAY="MAGIC_HIDE_OVERLAY",t.MAGIC_HANDLE_EVENT="MAGIC_HANDLE_EVENT",t.MAGIC_MG_BOX_SEND_RECEIPT="MAGIC_MG_BOX_SEND_RECEIPT",t.MAGIC_SEND_PRODUCT_ANNOUNCEMENT="MAGIC_SEND_PRODUCT_ANNOUNCEMENT",t.MAGIC_PONG="MAGIC_PONG",t.MAGIC_POPUP_RESPONSE="MAGIC_POPUP_RESPONSE",t.MAGIC_POPUP_OAUTH_VERIFY_RESPONSE="MAGIC_POPUP_OAUTH_VERIFY_RESPONSE",t))(BGe||{}),UGe=(t=>(t.MAGIC_HANDLE_REQUEST="MAGIC_HANDLE_REQUEST",t.MAGIC_PING="MAGIC_PING",t))(UGe||{}),FGe=(t=>(t.UpdateEmail="update-email",t.MFA="mfa",t.Recovery="recovery",t))(FGe||{}),jGe=(t=>(t.Retry="retry",t))(jGe||{}),$Ge=(t=>(t.EmailSent="email-sent",t.EmailNotDeliverable="email-not-deliverable",t))($Ge||{}),WGe=(t=>(t.VerifyEmailOtp="verify-email-otp",t.VerifyMFACode="verify-mfa-code",t.LostDevice="lost-device",t.VerifyRecoveryCode="verify-recovery-code",t.Cancel="cancel",t))(WGe||{}),HGe=(t=>(t.VerifySmsOtp="verify-sms-otp",t.Cancel="cancel",t.Retry="retry",t))(HGe||{}),zGe=(t=>(t.SmsOTPSent="sms-otp-sent",t.InvalidSmsOtp="invalid-sms-otp",t.ExpiredSmsOtp="expired-sms-otp",t))(zGe||{}),qGe=(t=>(t.EmailOTPSent="email-otp-sent",t.InvalidEmailOtp="invalid-email-otp",t.InvalidMfaOtp="invalid-mfa-otp",t.ExpiredEmailOtp="expired-email-otp",t.MfaSentHandle="mfa-sent-handle",t.RecoveryCodeSentHandle="recovery-code-sent-handle",t.InvalidRecoveryCode="invalid-recovery-code",t.RecoveryCodeSuccess="recovery-code-success",t.LoginThrottled="login-throttled",t))(qGe||{}),VGe=(t=>(t.Retry="device-retry",t))(VGe||{}),KGe=(t=>(t.DeviceApproved="device-approved",t.DeviceNeedsApproval="device-needs-approval",t.DeviceVerificationLinkExpired="device-verification-link-expired",t.DeviceVerificationEmailSent="device-verification-email-sent",t))(KGe||{}),GGe=(t=>(t.Retry="Recency/auth-factor-retry",t.Cancel="Recency/auth-factor-verification-cancel",t.VerifyEmailOtp="Recency/auth-factor-verify-email-otp",t.VerifyMFACode="Recency/verify-mfa-code",t))(GGe||{}),ZGe=(t=>(t.PrimaryAuthFactorNeedsVerification="Recency/auth-factor-needs-verification",t.PrimaryAuthFactorVerified="Recency/auth-factor-verified",t.InvalidEmailOtp="Recency/auth-factor-invalid-email-otp",t.EmailExpired="Recency/auth-factor-verification-email-expired",t.EmailSent="Recency/auth-factor-verification-email-sent",t.EmailNotDeliverable="Recency/auth-factor-verification-email-not-deliverable",t))(ZGe||{}),YGe=(t=>(t.RetryWithNewEmail="UpdateEmail/retry-with-new-email",t.Cancel="UpdateEmail/new-email-verification-cancel",t.VerifyEmailOtp="UpdateEmail/new-email-verify-otp",t))(YGe||{}),JGe=(t=>(t.NewAuthFactorNeedsVerification="UpdateEmail/new-email-needs-verification",t.EmailUpdated="UpdateEmail/email-updated",t.InvalidEmailOtp="UpdateEmail/new-email-invalid-email-otp",t.EmailExpired="UpdateEmail/new-email-verification-email-expired",t.EmailSent="UpdateEmail/new-email-verification-email-sent",t.EmailNotDeliverable="UpdateEmail/new-email-verification-email-not-deliverable",t.InvalidEmail="UpdateEmail/new-email-invalid",t.EmailAlreadyExists="UpdateEmail/new-email-already-exists",t))(JGe||{}),QGe=(t=>(t.IDTokenCreated="Auth/id-token-created",t))(QGe||{}),XGe=(t=>(t.Cancel="Farcaster/cancel",t))(XGe||{}),eZe=(t=>(t.MFASecretGenerated="mfa-secret-generated",t.InvalidMFAOtp="invalid-mfa-otp",t.MFARecoveryCodes="mfa-recovery-codes",t))(eZe||{}),tZe=(t=>(t.VerifyMFACode="verify-mfa-code",t.Cancel="cancel-mfa-setup",t))(tZe||{}),rZe=(t=>(t.MFACodeRequested="mfa-code-requested",t.InvalidMFAOtp="invalid-mfa-otp",t.InvalidRecoveryCode="invalid-recovery-code",t))(rZe||{}),iZe=(t=>(t.VerifyMFACode="verify-mfa-code",t.LostDevice="lost-device",t.Cancel="cancel-mfa-disable",t))(iZe||{}),nZe=(t=>(t.Harmony="HARMONY",t))(nZe||{}),oZe=(t=>(t.ClosedByUser="closed-by-user",t))(oZe||{}),sZe=(t=>(t.ClosedByUser="closed-by-user-on-received",t))(sZe||{}),aZe=(t=>(t.EnterNewPhoneNumber="enter-new-phone-number",t.EnterOtpCode="enter-otp-code",t.RecoveryFactorAlreadyExists="recovery-factor-already-exists",t.MalformedPhoneNumber="malformed-phone-number",t.InvalidOtpCode="invalid-otp-code",t.RecoveryFactorUpdated="recovery-factor-updated",t.RecoveryFactorDeleted="recovery-factor-deleted",t))(aZe||{}),cZe=(t=>(t.SendNewPhoneNumber="send-new-phone-number",t.SendOtpCode="send-otp-code",t.Cancel="cancel",t.StartEditPhoneNumber="start-edit-phone-number",t))(cZe||{}),lZe=(t=>(t.PhoneNumber="phone_number",t))(lZe||{}),uZe=(t=>(t.SmsOtpSent="sms-otp-sent",t.LoginThrottled="login-throttled",t.InvalidSmsOtp="invalid-sms-otp",t.SmsVerified="sms-verified",t.AccountRecovered="account-recovered",t.UpdateEmailRequired="update-email-required",t))(uZe||{}),fZe=(t=>(t.Cancel="cancel",t.VerifyOtp="verify-otp-code",t.ResendSms="resend-sms-otp",t.UpdateEmail="update-email",t))(fZe||{}),hZe=(t=>(t.Success="nft-checkout-success",t.Failure="nft-checkout-failure",t.Initiated="nft-checkout-initiated",t.Disconnect="disconnect",t))(hZe||{}),dZe=(t=>(t.WalletInfoFetched="Wallet/wallet-info-fetched",t))(dZe||{}),pZe=(t=>(t.CloseMagicWindow="close-magic-window",t))(pZe||{});var dA=class t extends J1e.Extension.Internal{name="web3modal";config={};modal;static eventsListenerAdded=!1;constructor({configOptions:e,modalOptions:r}){super(),this.modal=Y1e({...r,themeVariables:{...r.themeVariables||{},"--w3m-z-index":3e9},ethersConfig:aB(e)});let i=this.modal.subscribeProvider(({status:n})=>{n==="connected"&&(i(),this.setIsConnected(),this.setEip1193EventListeners()),n==="disconnected"&&i()})}setIsConnected(){localStorage.setItem(Ql.PROVIDER,"web3modal"),localStorage.setItem(Ql.ADDRESS,this.modal.getAddress()),localStorage.setItem(Ql.CHAIN_ID,this.modal.getChainId().toString()),this.sdk.thirdPartyWallets.isConnected=!0}initialize(){this.sdk.thirdPartyWallets.enabledWallets.web3modal=!0,this.sdk.thirdPartyWallets.isConnected=!!localStorage.getItem(Ql.ADDRESS),this.sdk.thirdPartyWallets.eventListeners.push({event:M3.Web3ModalSelected,callback:async e=>{await this.connectToWeb3modal(e)}})}setEip1193EventListeners(){t.eventsListenerAdded||(t.eventsListenerAdded=!0,this.modal.subscribeProvider(({address:e,chainId:r})=>!e&&localStorage.getItem(Ql.ADDRESS)?(this.sdk.thirdPartyWallets.resetThirdPartyWalletState(),this.sdk.rpcProvider.emit("accountsChanged",[])):e&&e!==localStorage.getItem(Ql.ADDRESS)?(localStorage.setItem(Ql.ADDRESS,e),this.sdk.rpcProvider.emit("accountsChanged",[e])):r&&r!==Number(localStorage.getItem(Ql.CHAIN_ID))?(localStorage.setItem(Ql.CHAIN_ID,r.toString()),this.sdk.rpcProvider.emit("chainChanged",r)):null))}handleUserConnected(e,r=this.modal.getAddress()){this.setIsConnected(),this.createIntermediaryEvent(M3.WalletConnected,e)(r),this.setEip1193EventListeners()}connectToWeb3modal(e){let{modal:r}=this;return this.utils.createPromiEvent(async()=>{try{r.getIsConnected()&&await r.disconnect()}catch(s){console.error(s)}let n=r.subscribeProvider(({address:s,error:a})=>{a&&(console.error("Provider event error:",a),n(),this.createIntermediaryEvent(M3.WalletRejected,e)()),s&&(this.handleUserConnected(e),n())}),o=r.subscribeEvents(s=>{s.data.event==="MODAL_CLOSE"&&(o(),n(),this.createIntermediaryEvent(M3.WalletRejected,e)())});r.open()})}};var mZe=dA;return Zf(gZe);})();
9979
9979
  if (MagicWeb3ModalExtension && MagicWeb3ModalExtension.default != null) { MagicWeb3ModalExtension = Object.assign(MagicWeb3ModalExtension.default, MagicWeb3ModalExtension); delete MagicWeb3ModalExtension.default; }