@sentio/sdk-bundle 2.55.0 → 2.55.1
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/lib/aptos/builtin/0x1.js +1 -1
- package/lib/aptos/builtin/0x3.js +1 -1
- package/lib/aptos/builtin/0x4.js +1 -1
- package/lib/aptos/builtin/index.js +1 -1
- package/lib/aptos/ext/index.js +1 -1
- package/lib/aptos/index.js +1 -1
- package/lib/btc/index.js +1 -1
- package/lib/{chunk-I7TWNRII.js → chunk-24TKIKAC.js} +2 -2
- package/lib/{chunk-ECZHCPDZ.js → chunk-26VKFV5Y.js} +2 -2
- package/lib/{chunk-F3FKHNF5.js → chunk-4ZKROMHQ.js} +2 -2
- package/lib/{chunk-D2L7KWZ2.js → chunk-5NXOOGVA.js} +2 -2
- package/lib/{chunk-MD3T4H6B.js → chunk-6P4HU4KH.js} +2 -2
- package/lib/{chunk-4VKVPYSL.js → chunk-A3BBP3JY.js} +2 -2
- package/lib/{chunk-JL6D6MPI.js → chunk-CQUL5GH2.js} +2 -2
- package/lib/{chunk-P2KJHIUL.js → chunk-EJ3LB3BV.js} +2 -2
- package/lib/{chunk-KV6ZVB7D.js → chunk-HWODJFVJ.js} +2 -2
- package/lib/{chunk-B3UDK7W6.js → chunk-JUDV27KS.js} +2 -2
- package/lib/{chunk-YQ55FG72.js → chunk-NEZRMKYM.js} +2 -2
- package/lib/{chunk-UQPDY6MT.js → chunk-QR7CH6SO.js} +2 -2
- package/lib/{chunk-BS7I2ZMW.js → chunk-RIHABKWB.js} +2 -2
- package/lib/{chunk-WR6FD24P.js → chunk-RZTTP64K.js} +2 -2
- package/lib/{chunk-QHT2WN3B.js → chunk-SQBMMGFT.js} +2 -2
- package/lib/{chunk-JVCO6QTF.js → chunk-SXK7O76Y.js} +2 -2
- package/lib/{chunk-N2VKAC4J.js → chunk-VA46M7OL.js} +2 -2
- package/lib/{chunk-CX3O4KA4.js → chunk-VLD3QNSH.js} +105 -105
- package/lib/{chunk-CX3O4KA4.js.map → chunk-VLD3QNSH.js.map} +1 -1
- package/lib/{chunk-MO32SIXZ.js → chunk-YQ346IMF.js} +2 -2
- package/lib/chunk-ZSDI5U4B.js +6 -0
- package/lib/chunk-ZSDI5U4B.js.map +1 -0
- package/lib/core/index.js +1 -1
- package/lib/eth/builtin/eacaggregatorproxy.js +1 -1
- package/lib/eth/builtin/erc1155.js +1 -1
- package/lib/eth/builtin/erc20.js +1 -1
- package/lib/eth/builtin/erc721.js +1 -1
- package/lib/eth/builtin/index.js +1 -1
- package/lib/eth/builtin/weth9.js +1 -1
- package/lib/eth/index.js +1 -1
- package/lib/fuel/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/move/index.js +1 -1
- package/lib/solana/builtin/index.js +1 -1
- package/lib/solana/index.js +1 -1
- package/lib/stark/index.js +1 -1
- package/lib/store/index.js +1 -1
- package/lib/sui/builtin/0x1.js +1 -1
- package/lib/sui/builtin/0x2.js +1 -1
- package/lib/sui/builtin/0x3.js +1 -1
- package/lib/sui/builtin/index.js +1 -1
- package/lib/sui/ext/index.js +1 -1
- package/lib/sui/index.js +1 -1
- package/lib/testing/index.js +1 -1
- package/lib/utils/index.js +1 -1
- package/package.json +2 -2
- package/lib/chunk-SUNKPJCY.js +0 -6
- package/lib/chunk-SUNKPJCY.js.map +0 -1
- /package/lib/{chunk-I7TWNRII.js.map → chunk-24TKIKAC.js.map} +0 -0
- /package/lib/{chunk-ECZHCPDZ.js.map → chunk-26VKFV5Y.js.map} +0 -0
- /package/lib/{chunk-F3FKHNF5.js.map → chunk-4ZKROMHQ.js.map} +0 -0
- /package/lib/{chunk-D2L7KWZ2.js.map → chunk-5NXOOGVA.js.map} +0 -0
- /package/lib/{chunk-MD3T4H6B.js.map → chunk-6P4HU4KH.js.map} +0 -0
- /package/lib/{chunk-4VKVPYSL.js.map → chunk-A3BBP3JY.js.map} +0 -0
- /package/lib/{chunk-JL6D6MPI.js.map → chunk-CQUL5GH2.js.map} +0 -0
- /package/lib/{chunk-P2KJHIUL.js.map → chunk-EJ3LB3BV.js.map} +0 -0
- /package/lib/{chunk-KV6ZVB7D.js.map → chunk-HWODJFVJ.js.map} +0 -0
- /package/lib/{chunk-B3UDK7W6.js.map → chunk-JUDV27KS.js.map} +0 -0
- /package/lib/{chunk-YQ55FG72.js.map → chunk-NEZRMKYM.js.map} +0 -0
- /package/lib/{chunk-UQPDY6MT.js.map → chunk-QR7CH6SO.js.map} +0 -0
- /package/lib/{chunk-BS7I2ZMW.js.map → chunk-RIHABKWB.js.map} +0 -0
- /package/lib/{chunk-WR6FD24P.js.map → chunk-RZTTP64K.js.map} +0 -0
- /package/lib/{chunk-QHT2WN3B.js.map → chunk-SQBMMGFT.js.map} +0 -0
- /package/lib/{chunk-JVCO6QTF.js.map → chunk-SXK7O76Y.js.map} +0 -0
- /package/lib/{chunk-N2VKAC4J.js.map → chunk-VA46M7OL.js.map} +0 -0
- /package/lib/{chunk-MO32SIXZ.js.map → chunk-YQ346IMF.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
|
2
|
-
import{a as Rt,b as Ze}from"./chunk-4WNGQ3EZ.js";import{a as Xe}from"./chunk-IVMOWPFA.js";import{B as it,Eb as Ee,Ed as Ke,Hb as re,U as Ca,Ud as xa,da as gs,ma as ct,oe as ys,te as Tn,ve as we,y as ya}from"./chunk-CX3O4KA4.js";import{a as i,d as ni,e as ms,f as At}from"./chunk-G5BIPHMS.js";var zo=ni((qd,ta)=>{"use strict";(function(){"use strict";var n="input is invalid type",t="finalize already called",e=typeof window=="object",r=e?window:{};r.JS_SHA3_NO_WINDOW&&(e=!1);var a=!e&&typeof self=="object",s=!r.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?r=global:a&&(r=self);for(var o=!r.JS_SHA3_NO_COMMON_JS&&typeof ta=="object"&&ta.exports,l=typeof define=="function"&&define.amd,u=!r.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],f=[4,1024,262144,67108864],h=[1,256,65536,16777216],C=[6,1536,393216,100663296],E=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],S=[224,256,384,512],R=[128,256],H=["hex","buffer","arrayBuffer","array","digest"],M={128:168,256:136},Mt=r.JS_SHA3_NO_NODE_JS||!Array.isArray?function(c){return Object.prototype.toString.call(c)==="[object Array]"}:Array.isArray,ee=u&&(r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(c){return typeof c=="object"&&c.buffer&&c.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,fa=i(function(c){var g=typeof c;if(g==="string")return[c,!0];if(g!=="object"||c===null)throw new Error(n);if(u&&c.constructor===ArrayBuffer)return[new Uint8Array(c),!1];if(!Mt(c)&&!ee(c))throw new Error(n);return[c,!1]},"formatMessage"),is=i(function(c){return fa(c)[0].length===0},"empty"),ha=i(function(c){for(var g=[],y=0;y<c.length;++y)g[y]=c[y];return g},"cloneArray"),cs=i(function(c,g,y){return function(x){return new X(c,g,c).update(x)[y]()}},"createOutputMethod"),ls=i(function(c,g,y){return function(x,T){return new X(c,g,T).update(x)[y]()}},"createShakeOutputMethod"),us=i(function(c,g,y){return function(x,T,P,O){return kt["cshake"+c].update(x,T,P,O)[y]()}},"createCshakeOutputMethod"),ps=i(function(c,g,y){return function(x,T,P,O){return kt["kmac"+c].update(x,T,P,O)[y]()}},"createKmacOutputMethod"),Er=i(function(c,g,y,x){for(var T=0;T<H.length;++T){var P=H[T];c[P]=g(y,x,P)}return c},"createOutputMethods"),ds=i(function(c,g){var y=cs(c,g,"hex");return y.create=function(){return new X(c,g,c)},y.update=function(x){return y.create().update(x)},Er(y,cs,c,g)},"createMethod"),ti=i(function(c,g){var y=ls(c,g,"hex");return y.create=function(x){return new X(c,g,x)},y.update=function(x,T){return y.create(T).update(x)},Er(y,ls,c,g)},"createShakeMethod"),ei=i(function(c,g){var y=M[c],x=us(c,g,"hex");return x.create=function(T,P,O){return is(P)&&is(O)?kt["shake"+c].create(T):new X(c,g,T).bytepad([P,O],y)},x.update=function(T,P,O,k){return x.create(P,O,k).update(T)},Er(x,us,c,g)},"createCshakeMethod"),ri=i(function(c,g){var y=M[c],x=ps(c,g,"hex");return x.create=function(T,P,O){return new ga(c,g,P).bytepad(["KMAC",O],y).bytepad([T],y)},x.update=function(T,P,O,k){return x.create(T,O,k).update(P)},Er(x,ps,c,g)},"createKmacMethod"),fs=[{name:"keccak",padding:h,bits:S,createMethod:ds},{name:"sha3",padding:C,bits:S,createMethod:ds},{name:"shake",padding:d,bits:R,createMethod:ti},{name:"cshake",padding:f,bits:R,createMethod:ei},{name:"kmac",padding:f,bits:R,createMethod:ri}],kt={},ze=[],Gt=0;Gt<fs.length;++Gt)for(var be=fs[Gt],wr=be.bits,Je=0;Je<wr.length;++Je){var ma=be.name+"_"+wr[Je];if(ze.push(ma),kt[ma]=be.createMethod(wr[Je],be.padding),be.name!=="sha3"){var hs=be.name+wr[Je];ze.push(hs),kt[hs]=kt[ma]}}function X(c,g,y){this.blocks=[],this.s=[],this.padding=g,this.outputBits=y,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(c<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=y>>5,this.extraBytes=(y&31)>>3;for(var x=0;x<50;++x)this.s[x]=0}i(X,"Keccak"),X.prototype.update=function(c){if(this.finalized)throw new Error(t);var g=fa(c);c=g[0];for(var y=g[1],x=this.blocks,T=this.byteCount,P=c.length,O=this.blockCount,k=0,Z=this.s,N,K;k<P;){if(this.reset)for(this.reset=!1,x[0]=this.block,N=1;N<O+1;++N)x[N]=0;if(y)for(N=this.start;k<P&&N<T;++k)K=c.charCodeAt(k),K<128?x[N>>2]|=K<<E[N++&3]:K<2048?(x[N>>2]|=(192|K>>6)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]):K<55296||K>=57344?(x[N>>2]|=(224|K>>12)<<E[N++&3],x[N>>2]|=(128|K>>6&63)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]):(K=65536+((K&1023)<<10|c.charCodeAt(++k)&1023),x[N>>2]|=(240|K>>18)<<E[N++&3],x[N>>2]|=(128|K>>12&63)<<E[N++&3],x[N>>2]|=(128|K>>6&63)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]);else for(N=this.start;k<P&&N<T;++k)x[N>>2]|=c[k]<<E[N++&3];if(this.lastByteIndex=N,N>=T){for(this.start=N-T,this.block=x[O],N=0;N<O;++N)Z[N]^=x[N];We(Z),this.reset=!0}else this.start=N}return this},X.prototype.encode=function(c,g){var y=c&255,x=1,T=[y];for(c=c>>8,y=c&255;y>0;)T.unshift(y),c=c>>8,y=c&255,++x;return g?T.push(x):T.unshift(x),this.update(T),T.length},X.prototype.encodeString=function(c){var g=fa(c);c=g[0];var y=g[1],x=0,T=c.length;if(y)for(var P=0;P<c.length;++P){var O=c.charCodeAt(P);O<128?x+=1:O<2048?x+=2:O<55296||O>=57344?x+=3:(O=65536+((O&1023)<<10|c.charCodeAt(++P)&1023),x+=4)}else x=T;return x+=this.encode(x*8),this.update(c),x},X.prototype.bytepad=function(c,g){for(var y=this.encode(g),x=0;x<c.length;++x)y+=this.encodeString(c[x]);var T=(g-y%g)%g,P=[];return P.length=T,this.update(P),this},X.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var c=this.blocks,g=this.lastByteIndex,y=this.blockCount,x=this.s;if(c[g>>2]|=this.padding[g&3],this.lastByteIndex===this.byteCount)for(c[0]=c[y],g=1;g<y+1;++g)c[g]=0;for(c[y-1]|=2147483648,g=0;g<y;++g)x[g]^=c[g];We(x)}},X.prototype.toString=X.prototype.hex=function(){this.finalize();for(var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O="",k;P<y;){for(T=0;T<c&&P<y;++T,++P)k=g[T],O+=p[k>>4&15]+p[k&15]+p[k>>12&15]+p[k>>8&15]+p[k>>20&15]+p[k>>16&15]+p[k>>28&15]+p[k>>24&15];P%c===0&&(g=ha(g),We(g),T=0)}return x&&(k=g[T],O+=p[k>>4&15]+p[k&15],x>1&&(O+=p[k>>12&15]+p[k>>8&15]),x>2&&(O+=p[k>>20&15]+p[k>>16&15])),O},X.prototype.arrayBuffer=function(){this.finalize();var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O=this.outputBits>>3,k;x?k=new ArrayBuffer(y+1<<2):k=new ArrayBuffer(O);for(var Z=new Uint32Array(k);P<y;){for(T=0;T<c&&P<y;++T,++P)Z[P]=g[T];P%c===0&&(g=ha(g),We(g))}return x&&(Z[P]=g[T],k=k.slice(0,O)),k},X.prototype.buffer=X.prototype.arrayBuffer,X.prototype.digest=X.prototype.array=function(){this.finalize();for(var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O=[],k,Z;P<y;){for(T=0;T<c&&P<y;++T,++P)k=P<<2,Z=g[T],O[k]=Z&255,O[k+1]=Z>>8&255,O[k+2]=Z>>16&255,O[k+3]=Z>>24&255;P%c===0&&(g=ha(g),We(g))}return x&&(k=P<<2,Z=g[T],O[k]=Z&255,x>1&&(O[k+1]=Z>>8&255),x>2&&(O[k+2]=Z>>16&255)),O};function ga(c,g,y){X.call(this,c,g,y)}i(ga,"Kmac"),ga.prototype=new X,ga.prototype.finalize=function(){return this.encode(this.outputBits,!0),X.prototype.finalize.call(this)};var We=i(function(c){var g,y,x,T,P,O,k,Z,N,K,Tr,vr,Pr,kr,Ar,Rr,Ir,Or,Br,Nr,Fr,Sr,Dr,_r,Lr,Hr,Ur,Vr,Mr,Gr,$r,jr,zr,Jr,Wr,Kr,Xr,Zr,Yr,Qr,qr,tn,en,rn,nn,an,sn,on,cn,ln,un,pn,dn,fn,hn,mn,gn,yn,Cn,xn,bn,En,wn;for(x=0;x<48;x+=2)T=c[0]^c[10]^c[20]^c[30]^c[40],P=c[1]^c[11]^c[21]^c[31]^c[41],O=c[2]^c[12]^c[22]^c[32]^c[42],k=c[3]^c[13]^c[23]^c[33]^c[43],Z=c[4]^c[14]^c[24]^c[34]^c[44],N=c[5]^c[15]^c[25]^c[35]^c[45],K=c[6]^c[16]^c[26]^c[36]^c[46],Tr=c[7]^c[17]^c[27]^c[37]^c[47],vr=c[8]^c[18]^c[28]^c[38]^c[48],Pr=c[9]^c[19]^c[29]^c[39]^c[49],g=vr^(O<<1|k>>>31),y=Pr^(k<<1|O>>>31),c[0]^=g,c[1]^=y,c[10]^=g,c[11]^=y,c[20]^=g,c[21]^=y,c[30]^=g,c[31]^=y,c[40]^=g,c[41]^=y,g=T^(Z<<1|N>>>31),y=P^(N<<1|Z>>>31),c[2]^=g,c[3]^=y,c[12]^=g,c[13]^=y,c[22]^=g,c[23]^=y,c[32]^=g,c[33]^=y,c[42]^=g,c[43]^=y,g=O^(K<<1|Tr>>>31),y=k^(Tr<<1|K>>>31),c[4]^=g,c[5]^=y,c[14]^=g,c[15]^=y,c[24]^=g,c[25]^=y,c[34]^=g,c[35]^=y,c[44]^=g,c[45]^=y,g=Z^(vr<<1|Pr>>>31),y=N^(Pr<<1|vr>>>31),c[6]^=g,c[7]^=y,c[16]^=g,c[17]^=y,c[26]^=g,c[27]^=y,c[36]^=g,c[37]^=y,c[46]^=g,c[47]^=y,g=K^(T<<1|P>>>31),y=Tr^(P<<1|T>>>31),c[8]^=g,c[9]^=y,c[18]^=g,c[19]^=y,c[28]^=g,c[29]^=y,c[38]^=g,c[39]^=y,c[48]^=g,c[49]^=y,kr=c[0],Ar=c[1],an=c[11]<<4|c[10]>>>28,sn=c[10]<<4|c[11]>>>28,Vr=c[20]<<3|c[21]>>>29,Mr=c[21]<<3|c[20]>>>29,xn=c[31]<<9|c[30]>>>23,bn=c[30]<<9|c[31]>>>23,tn=c[40]<<18|c[41]>>>14,en=c[41]<<18|c[40]>>>14,Jr=c[2]<<1|c[3]>>>31,Wr=c[3]<<1|c[2]>>>31,Rr=c[13]<<12|c[12]>>>20,Ir=c[12]<<12|c[13]>>>20,on=c[22]<<10|c[23]>>>22,cn=c[23]<<10|c[22]>>>22,Gr=c[33]<<13|c[32]>>>19,$r=c[32]<<13|c[33]>>>19,En=c[42]<<2|c[43]>>>30,wn=c[43]<<2|c[42]>>>30,fn=c[5]<<30|c[4]>>>2,hn=c[4]<<30|c[5]>>>2,Kr=c[14]<<6|c[15]>>>26,Xr=c[15]<<6|c[14]>>>26,Or=c[25]<<11|c[24]>>>21,Br=c[24]<<11|c[25]>>>21,ln=c[34]<<15|c[35]>>>17,un=c[35]<<15|c[34]>>>17,jr=c[45]<<29|c[44]>>>3,zr=c[44]<<29|c[45]>>>3,_r=c[6]<<28|c[7]>>>4,Lr=c[7]<<28|c[6]>>>4,mn=c[17]<<23|c[16]>>>9,gn=c[16]<<23|c[17]>>>9,Zr=c[26]<<25|c[27]>>>7,Yr=c[27]<<25|c[26]>>>7,Nr=c[36]<<21|c[37]>>>11,Fr=c[37]<<21|c[36]>>>11,pn=c[47]<<24|c[46]>>>8,dn=c[46]<<24|c[47]>>>8,rn=c[8]<<27|c[9]>>>5,nn=c[9]<<27|c[8]>>>5,Hr=c[18]<<20|c[19]>>>12,Ur=c[19]<<20|c[18]>>>12,yn=c[29]<<7|c[28]>>>25,Cn=c[28]<<7|c[29]>>>25,Qr=c[38]<<8|c[39]>>>24,qr=c[39]<<8|c[38]>>>24,Sr=c[48]<<14|c[49]>>>18,Dr=c[49]<<14|c[48]>>>18,c[0]=kr^~Rr&Or,c[1]=Ar^~Ir&Br,c[10]=_r^~Hr&Vr,c[11]=Lr^~Ur&Mr,c[20]=Jr^~Kr&Zr,c[21]=Wr^~Xr&Yr,c[30]=rn^~an&on,c[31]=nn^~sn&cn,c[40]=fn^~mn&yn,c[41]=hn^~gn&Cn,c[2]=Rr^~Or&Nr,c[3]=Ir^~Br&Fr,c[12]=Hr^~Vr&Gr,c[13]=Ur^~Mr&$r,c[22]=Kr^~Zr&Qr,c[23]=Xr^~Yr&qr,c[32]=an^~on&ln,c[33]=sn^~cn&un,c[42]=mn^~yn&xn,c[43]=gn^~Cn&bn,c[4]=Or^~Nr&Sr,c[5]=Br^~Fr&Dr,c[14]=Vr^~Gr&jr,c[15]=Mr^~$r&zr,c[24]=Zr^~Qr&tn,c[25]=Yr^~qr&en,c[34]=on^~ln&pn,c[35]=cn^~un&dn,c[44]=yn^~xn&En,c[45]=Cn^~bn&wn,c[6]=Nr^~Sr&kr,c[7]=Fr^~Dr&Ar,c[16]=Gr^~jr&_r,c[17]=$r^~zr&Lr,c[26]=Qr^~tn&Jr,c[27]=qr^~en&Wr,c[36]=ln^~pn&rn,c[37]=un^~dn&nn,c[46]=xn^~En&fn,c[47]=bn^~wn&hn,c[8]=Sr^~kr&Rr,c[9]=Dr^~Ar&Ir,c[18]=jr^~_r&Hr,c[19]=zr^~Lr&Ur,c[28]=tn^~Jr&Kr,c[29]=en^~Wr&Xr,c[38]=pn^~rn&an,c[39]=dn^~nn&sn,c[48]=En^~fn&mn,c[49]=wn^~hn&gn,c[0]^=A[x],c[1]^=A[x+1]},"f");if(o)ta.exports=kt;else{for(Gt=0;Gt<ze.length;++Gt)r[ze[Gt]]=kt[ze[Gt]];l&&define(function(){return kt})}})()});var Ac={};ms(Ac,{ERC721BoundContractView:()=>br,ERC721ContractView:()=>da,ERC721Processor:()=>Ut,ERC721ProcessorTemplate:()=>ss,ERC721__factory:()=>Pt,getERC721Contract:()=>xe,getERC721ContractOnContext:()=>Tc,mockApprovalForAllLog:()=>Pc,mockApprovalLog:()=>vc,mockTransferLog:()=>kc});var $t=class extends ys{static{i(this,"EthContext")}chainId;address;log;block;trace;blockNumber;transactionHash;transaction;transactionReceipt;timestamp;preparedData;constructor(t,e,r,a,s,o,l,u,p,d){super(p),this.chainId=t,this.log=s,this.block=a,this.trace=o,this.address=e.toLowerCase(),this.transaction=l,this.transactionReceipt=u,this.timestamp=r||new Date(0),this.preparedData=d,s?(this.blockNumber=s.blockNumber,this.transactionHash=s.transactionHash):a?this.blockNumber=a.number:o&&(this.blockNumber=o.blockNumber,this.transactionHash=o.transactionHash)}getChainId(){return this.chainId}getMetaDataInternal(t,e){if(this.log)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.log.transactionIndex,transactionHash:this.transactionHash||"",logIndex:this.log.index,chainId:this.chainId,name:t,labels:Ke(e)};if(this.trace)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.trace.transactionPosition,transactionHash:this.transactionHash||"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};if(this.transaction)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.transaction.index||0,transactionHash:this.transaction.hash||"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};if(this.block)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:-1,transactionHash:"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};throw new Error("Invaid ctx argument can't happen")}getBlockTag(t){let e="0x"+this.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),e}getEthCallContext(){return{chainId:this.chainId,blockTag:"0x"+this.blockNumber.toString(16),address:this.address}}},Te=class extends $t{static{i(this,"AccountContext")}getContractName(){return"account"}},bt=class extends $t{static{i(this,"GlobalContext")}constructor(t,e,r,a,s,o,l,u,p,d){super(t,e,r,a,s,o,l,u,p,d)}getContractName(){return"*"}getMetaDataInternal(t,e){let r=this.address;this.address="*";let a=super.getMetaDataInternal(t,e);return this.address=r,a}},Et=class extends $t{static{i(this,"ContractContext")}contract;contractName;constructor(t,e,r,a,s,o,l,u,p,d,f){super(r,e.address,a,s,o,l,u,p,d,f),e.context=this,e.callStatic&&(e.callStatic.context=this),e.encodeCall&&(e.encodeCall.context=this),this.contractName=t,this.contract=e}getContractName(){return this.contractName}},It=class{constructor(t){this.contract=t}static{i(this,"ContractView")}get rawContract(){return this.contract}get provider(){if(this.contract.runner?.provider)return this.contract.runner.provider;throw Error("Can't find provider for contract"+this.contract.toString())}},Ot=class{static{i(this,"BoundContractView")}view;address;context;callStatic;encodeCall;constructor(t,e){this.address=t,this.view=e}get rawContract(){return this.view.rawContract}get provider(){return this.view.provider}get filters(){return this.view.rawContract.filters}};import("node:process").then(n=>n.stdout.write(""));var j=At(xa(),1);var Cs="6.13.1";function ai(n,t,e){let r=t.split("|").map(s=>s.trim());for(let s=0;s<r.length;s++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof n===t)return}let a=new Error(`invalid value for type ${t}`);throw a.code="INVALID_ARGUMENT",a.argument=`value.${e}`,a.value=n,a}i(ai,"checkType");async function ve(n){let t=Object.keys(n);return(await Promise.all(t.map(r=>Promise.resolve(n[r])))).reduce((r,a,s)=>(r[t[s]]=a,r),{})}i(ve,"resolveProperties");function v(n,t,e){for(let r in t){let a=t[r],s=e?e[r]:null;s&&ai(a,s,r),Object.defineProperty(n,r,{enumerable:!0,value:a,writable:!1})}}i(v,"defineProperties");function Pe(n){if(n==null)return"null";if(Array.isArray(n))return"[ "+n.map(Pe).join(", ")+" ]";if(n instanceof Uint8Array){let t="0123456789abcdef",e="0x";for(let r=0;r<n.length;r++)e+=t[n[r]>>4],e+=t[n[r]&15];return e}if(typeof n=="object"&&typeof n.toJSON=="function")return Pe(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"number":return n.toString();case"string":return JSON.stringify(n);case"object":{let t=Object.keys(n);return t.sort(),"{ "+t.map(e=>`${Pe(e)}: ${Pe(n[e])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}i(Pe,"stringify");function wt(n,t){return n&&n.code===t}i(wt,"isError");function vn(n){return wt(n,"CALL_EXCEPTION")}i(vn,"isCallException");function Bt(n,t,e){let r=n;{let s=[];if(e){if("message"in e||"code"in e||"name"in e)throw new Error(`value will overwrite populated values: ${Pe(e)}`);for(let o in e){if(o==="shortMessage")continue;let l=e[o];s.push(o+"="+Pe(l))}}s.push(`code=${t}`),s.push(`version=${Cs}`),s.length&&(n+=" ("+s.join(", ")+")")}let a;switch(t){case"INVALID_ARGUMENT":a=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":a=new RangeError(n);break;default:a=new Error(n)}return v(a,{code:t}),e&&Object.assign(a,e),a.shortMessage==null&&v(a,{shortMessage:r}),a}i(Bt,"makeError");function w(n,t,e,r){if(!n)throw Bt(t,e,r)}i(w,"assert");function m(n,t,e,r){w(n,t,"INVALID_ARGUMENT",{argument:e,value:r})}i(m,"assertArgument");function Ye(n,t,e){e==null&&(e=""),e&&(e=": "+e),w(n>=t,"missing arguemnt"+e,"MISSING_ARGUMENT",{count:n,expectedCount:t}),w(n<=t,"too many arguments"+e,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:t})}i(Ye,"assertArgumentCount");var si=["NFD","NFC","NFKD","NFKC"].reduce((n,t)=>{try{if("test".normalize(t)!=="test")throw new Error("bad");if(t==="NFD"&&"\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken");n.push(t)}catch{}return n},[]);function ba(n){w(si.indexOf(n)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:n}})}i(ba,"assertNormalize");function jt(n,t,e){if(e==null&&(e=""),n!==t){let r=e,a="new";e&&(r+=".",a+=" "+e),w(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:a})}}i(jt,"assertPrivate");function bs(n,t,e){if(n instanceof Uint8Array)return e?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){let r=new Uint8Array((n.length-2)/2),a=2;for(let s=0;s<r.length;s++)r[s]=parseInt(n.substring(a,a+2),16),a+=2;return r}m(!1,"invalid BytesLike value",t||"value",n)}i(bs,"_getBytes");function z(n,t){return bs(n,t,!1)}i(z,"getBytes");function nt(n,t){return bs(n,t,!0)}i(nt,"getBytesCopy");function Y(n,t){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof t=="number"&&n.length!==2+2*t||t===!0&&n.length%2!==0)}i(Y,"isHexString");function Ea(n){return Y(n,!0)||n instanceof Uint8Array}i(Ea,"isBytesLike");var xs="0123456789abcdef";function D(n){let t=z(n),e="0x";for(let r=0;r<t.length;r++){let a=t[r];e+=xs[(a&240)>>4]+xs[a&15]}return e}i(D,"hexlify");function lt(n){return"0x"+n.map(t=>D(t).substring(2)).join("")}i(lt,"concat");function Pn(n){return Y(n,!0)?(n.length-2)/2:z(n).length}i(Pn,"dataLength");function Tt(n,t,e){let r=z(n);return e!=null&&e>r.length&&w(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:e}),D(r.slice(t??0,e??r.length))}i(Tt,"dataSlice");function Es(n,t,e){let r=z(n);w(t>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:t,offset:t+1});let a=new Uint8Array(t);return a.fill(0),e?a.set(r,t-r.length):a.set(r,0),D(a)}i(Es,"zeroPad");function ke(n,t){return Es(n,t,!0)}i(ke,"zeroPadValue");function kn(n,t){return Es(n,t,!1)}i(kn,"zeroPadBytes");var An=BigInt(0),gt=BigInt(1),Ae=9007199254740991;function wa(n,t){let e=Qe(n,"value"),r=BigInt(_(t,"width"));if(w(e>>r===An,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),e>>r-gt){let a=(gt<<r)-gt;return-((~e&a)+gt)}return e}i(wa,"fromTwos");function Ta(n,t){let e=I(n,"value"),r=BigInt(_(t,"width")),a=gt<<r-gt;if(e<An){e=-e,w(e<=a,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});let s=(gt<<r)-gt;return(~e&s)+gt}else w(e<a,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return e}i(Ta,"toTwos");function Re(n,t){let e=Qe(n,"value"),r=BigInt(_(t,"bits"));return e&(gt<<r)-gt}i(Re,"mask");function I(n,t){switch(typeof n){case"bigint":return n;case"number":return m(Number.isInteger(n),"underflow",t||"value",n),m(n>=-Ae&&n<=Ae,"overflow",t||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(e){m(!1,`invalid BigNumberish string: ${e.message}`,t||"value",n)}}m(!1,"invalid BigNumberish value",t||"value",n)}i(I,"getBigInt");function Qe(n,t){let e=I(n,t);return w(e>=An,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),e}i(Qe,"getUint");var ws="0123456789abcdef";function Rn(n){if(n instanceof Uint8Array){let t="0x0";for(let e of n)t+=ws[e>>4],t+=ws[e&15];return BigInt(t)}return I(n)}i(Rn,"toBigInt");function _(n,t){switch(typeof n){case"bigint":return m(n>=-Ae&&n<=Ae,"overflow",t||"value",n),Number(n);case"number":return m(Number.isInteger(n),"underflow",t||"value",n),m(n>=-Ae&&n<=Ae,"overflow",t||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return _(BigInt(n),t)}catch(e){m(!1,`invalid numeric string: ${e.message}`,t||"value",n)}}m(!1,"invalid numeric value",t||"value",n)}i(_,"getNumber");function va(n){return _(Rn(n))}i(va,"toNumber");function qe(n,t){let r=Qe(n,"value").toString(16);if(t==null)r.length%2&&(r="0"+r);else{let a=_(t,"width");for(w(a*2>=r.length,`value exceeds width (${a} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});r.length<a*2;)r="0"+r}return"0x"+r}i(qe,"toBeHex");function tr(n){let t=Qe(n,"value");if(t===An)return new Uint8Array([]);let e=t.toString(16);e.length%2&&(e="0"+e);let r=new Uint8Array(e.length/2);for(let a=0;a<r.length;a++){let s=a*2;r[a]=parseInt(e.substring(s,s+2),16)}return r}i(tr,"toBeArray");var er=class{static{i(this,"EventPayload")}filter;emitter;#t;constructor(t,e,r){this.#t=e,v(this,{emitter:t,filter:r})}async removeListener(){this.#t!=null&&await this.emitter.off(this.filter,this.#t)}};function oi(n,t,e,r,a){m(!1,`invalid codepoint at offset ${t}; ${n}`,"bytes",e)}i(oi,"errorFunc");function Ts(n,t,e,r,a){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let s=0;for(let o=t+1;o<e.length&&e[o]>>6===2;o++)s++;return s}return n==="OVERRUN"?e.length-t-1:0}i(Ts,"ignoreFunc");function ii(n,t,e,r,a){return n==="OVERLONG"?(m(typeof a=="number","invalid bad code point for replacement","badCodepoint",a),r.push(a),0):(r.push(65533),Ts(n,t,e,r,a))}i(ii,"replaceFunc");var vs=Object.freeze({error:oi,ignore:Ts,replace:ii});function ci(n,t){t==null&&(t=vs.error);let e=z(n,"bytes"),r=[],a=0;for(;a<e.length;){let s=e[a++];if(!(s>>7)){r.push(s);continue}let o=null,l=null;if((s&224)===192)o=1,l=127;else if((s&240)===224)o=2,l=2047;else if((s&248)===240)o=3,l=65535;else{(s&192)===128?a+=t("UNEXPECTED_CONTINUE",a-1,e,r):a+=t("BAD_PREFIX",a-1,e,r);continue}if(a-1+o>=e.length){a+=t("OVERRUN",a-1,e,r);continue}let u=s&(1<<8-o-1)-1;for(let p=0;p<o;p++){let d=e[a];if((d&192)!=128){a+=t("MISSING_CONTINUE",a,e,r),u=null;break}u=u<<6|d&63,a++}if(u!==null){if(u>1114111){a+=t("OUT_OF_RANGE",a-1-o,e,r,u);continue}if(u>=55296&&u<=57343){a+=t("UTF16_SURROGATE",a-1-o,e,r,u);continue}if(u<=l){a+=t("OVERLONG",a-1-o,e,r,u);continue}r.push(u)}}return r}i(ci,"getUtf8CodePoints");function Ie(n,t){m(typeof n=="string","invalid string value","str",n),t!=null&&(ba(t),n=n.normalize(t));let e=[];for(let r=0;r<n.length;r++){let a=n.charCodeAt(r);if(a<128)e.push(a);else if(a<2048)e.push(a>>6|192),e.push(a&63|128);else if((a&64512)==55296){r++;let s=n.charCodeAt(r);m(r<n.length&&(s&64512)===56320,"invalid surrogate pair","str",n);let o=65536+((a&1023)<<10)+(s&1023);e.push(o>>18|240),e.push(o>>12&63|128),e.push(o>>6&63|128),e.push(o&63|128)}else e.push(a>>12|224),e.push(a>>6&63|128),e.push(a&63|128)}return new Uint8Array(e)}i(Ie,"toUtf8Bytes");function li(n){return n.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}i(li,"_toUtf8String");function rr(n,t){return li(ci(n,t))}i(rr,"toUtf8String");function Ps(n){let t=[];for(;n;)t.unshift(n&255),n>>=8;return t}i(Ps,"arrayifyInteger");function As(n){if(Array.isArray(n)){let r=[];if(n.forEach(function(s){r=r.concat(As(s))}),r.length<=55)return r.unshift(192+r.length),r;let a=Ps(r.length);return a.unshift(247+a.length),a.concat(r)}let t=Array.prototype.slice.call(z(n,"object"));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;let e=Ps(t.length);return e.unshift(183+e.length),e.concat(t)}i(As,"_encode");var ks="0123456789abcdef";function Pa(n){let t="0x";for(let e of As(n))t+=ks[e>>4],t+=ks[e&15];return t}i(Pa,"encodeRlp");function ka(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}i(ka,"number");function Aa(n,...t){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}i(Aa,"bytes");function Ra(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}i(Ra,"exists");function Rs(n,t){Aa(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}i(Rs,"output");var In=BigInt(4294967295),Is=BigInt(32);function ui(n,t=!1){return t?{h:Number(n&In),l:Number(n>>Is&In)}:{h:Number(n>>Is&In)|0,l:Number(n&In)|0}}i(ui,"fromBig");function Os(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let a=0;a<n.length;a++){let{h:s,l:o}=ui(n[a],t);[e[a],r[a]]=[s,o]}return[e,r]}i(Os,"split");var Bs=i((n,t,e)=>n<<e|t>>>32-e,"rotlSH"),Ns=i((n,t,e)=>t<<e|n>>>32-e,"rotlSL"),Fs=i((n,t,e)=>t<<e-32|n>>>64-e,"rotlBH"),Ss=i((n,t,e)=>n<<e-32|t>>>64-e,"rotlBL");var pi=i(n=>n instanceof Uint8Array,"u8a");var Ds=i(n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),"u32");var di=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!di)throw new Error("Non little-endian hardware is not supported");function fi(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}i(fi,"utf8ToBytes");function Bn(n){if(typeof n=="string"&&(n=fi(n)),!pi(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}i(Bn,"toBytes");var On=class{static{i(this,"Hash")}clone(){return this._cloneInto()}},yl={}.toString;function _s(n){let t=i(r=>n().update(Bn(r)).digest(),"hashC"),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}i(_s,"wrapConstructor");function Ls(n){let t=i((r,a)=>n(a).update(Bn(r)).digest(),"hashC"),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}i(Ls,"wrapXOFConstructorWithOpts");var[Vs,Ms,Gs]=[[],[],[]],hi=BigInt(0),nr=BigInt(1),mi=BigInt(2),gi=BigInt(7),yi=BigInt(256),Ci=BigInt(113);for(let n=0,t=nr,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],Vs.push(2*(5*r+e)),Ms.push((n+1)*(n+2)/2%64);let a=hi;for(let s=0;s<7;s++)t=(t<<nr^(t>>gi)*Ci)%yi,t&mi&&(a^=nr<<(nr<<BigInt(s))-nr);Gs.push(a)}var[xi,bi]=Os(Gs,!0),Hs=i((n,t,e)=>e>32?Fs(n,t,e):Bs(n,t,e),"rotlH"),Us=i((n,t,e)=>e>32?Ss(n,t,e):Ns(n,t,e),"rotlL");function Ei(n,t=24){let e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){let l=(o+8)%10,u=(o+2)%10,p=e[u],d=e[u+1],f=Hs(p,d,1)^e[l],h=Us(p,d,1)^e[l+1];for(let C=0;C<50;C+=10)n[o+C]^=f,n[o+C+1]^=h}let a=n[2],s=n[3];for(let o=0;o<24;o++){let l=Ms[o],u=Hs(a,s,l),p=Us(a,s,l),d=Vs[o];a=n[d],s=n[d+1],n[d]=u,n[d+1]=p}for(let o=0;o<50;o+=10){for(let l=0;l<10;l++)e[l]=n[o+l];for(let l=0;l<10;l++)n[o+l]^=~e[(l+2)%10]&e[(l+4)%10]}n[0]^=xi[r],n[1]^=bi[r]}e.fill(0)}i(Ei,"keccakP");var Nn=class n extends On{static{i(this,"Keccak")}constructor(t,e,r,a=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=a,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ka(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Ds(this.state)}keccak(){Ei(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){Ra(this);let{blockLen:e,state:r}=this;t=Bn(t);let a=t.length;for(let s=0;s<a;){let o=Math.min(e-this.pos,a-s);for(let l=0;l<o;l++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:r,blockLen:a}=this;t[r]^=e,e&128&&r===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){Ra(this,!1),Aa(t),this.finish();let e=this.state,{blockLen:r}=this;for(let a=0,s=t.length;a<s;){this.posOut>=r&&this.keccak();let o=Math.min(r-this.posOut,s-a);t.set(e.subarray(this.posOut,this.posOut+o),a),this.posOut+=o,a+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ka(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Rs(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:r,outputLen:a,rounds:s,enableXOF:o}=this;return t||(t=new n(e,r,a,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=a,t.enableXOF=o,t.destroyed=this.destroyed,t}},zt=i((n,t,e)=>_s(()=>new Nn(t,n,e)),"gen"),Tl=zt(6,144,224/8),vl=zt(6,136,256/8),Pl=zt(6,104,384/8),kl=zt(6,72,512/8),Al=zt(1,144,224/8),$s=zt(1,136,256/8),Rl=zt(1,104,384/8),Il=zt(1,72,512/8),js=i((n,t,e)=>Ls((r={})=>new Nn(t,n,r.dkLen===void 0?e:r.dkLen,!0)),"genShake"),Ol=js(31,168,128/8),Bl=js(31,136,256/8);var zs=!1,Js=i(function(n){return $s(n)},"_keccak256"),Ws=Js;function st(n){let t=z(n,"data");return D(Ws(t))}i(st,"keccak256");st._=Js;st.lock=function(){zs=!0};st.register=function(n){if(zs)throw new TypeError("keccak256 is locked");Ws=n};Object.freeze(st);var Fn="0x0000000000000000000000000000000000000000000000000000000000000000";var Ks=BigInt(0),Xs=BigInt(1),Zs=BigInt(2),Ys=BigInt(27),Qs=BigInt(28),Sn=BigInt(35),Oe={};function qs(n){return ke(tr(n),32)}i(qs,"toUint256");var Be=class n{static{i(this,"Signature")}#t;#e;#r;#n;get r(){return this.#t}set r(t){m(Pn(t)===32,"invalid r","value",t),this.#t=D(t)}get s(){return this.#e}set s(t){m(Pn(t)===32,"invalid s","value",t);let e=D(t);m(parseInt(e.substring(0,3))<8,"non-canonical s","value",e),this.#e=e}get v(){return this.#r}set v(t){let e=_(t,"value");m(e===27||e===28,"invalid v","v",t),this.#r=e}get networkV(){return this.#n}get legacyChainId(){let t=this.networkV;return t==null?null:n.getChainId(t)}get yParity(){return this.v===27?0:1}get yParityAndS(){let t=z(this.s);return this.yParity&&(t[0]|=128),D(t)}get compactSerialized(){return lt([this.r,this.yParityAndS])}get serialized(){return lt([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(t,e,r,a){jt(t,Oe,"Signature"),this.#t=e,this.#e=r,this.#r=a,this.#n=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){let t=new n(Oe,this.r,this.s,this.v);return this.networkV&&(t.#n=this.networkV),t}toJSON(){let t=this.networkV;return{_type:"signature",networkV:t!=null?t.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(t){let e=I(t,"v");return e==Ys||e==Qs?Ks:(m(e>=Sn,"invalid EIP-155 v","v",t),(e-Sn)/Zs)}static getChainIdV(t,e){return I(t)*Zs+BigInt(35+e-27)}static getNormalizedV(t){let e=I(t);return e===Ks||e===Ys?27:e===Xs||e===Qs?28:(m(e>=Sn,"invalid v","v",t),e&Xs?27:28)}static from(t){function e(p,d){m(p,d,"signature",t)}if(i(e,"assertError"),t==null)return new n(Oe,Fn,Fn,27);if(typeof t=="string"){let p=z(t,"signature");if(p.length===64){let d=D(p.slice(0,32)),f=p.slice(32,64),h=f[0]&128?28:27;return f[0]&=127,new n(Oe,d,D(f),h)}if(p.length===65){let d=D(p.slice(0,32)),f=p.slice(32,64);e((f[0]&128)===0,"non-canonical s");let h=n.getNormalizedV(p[64]);return new n(Oe,d,D(f),h)}e(!1,"invalid raw signature length")}if(t instanceof n)return t.clone();let r=t.r;e(r!=null,"missing r");let a=qs(r),s=function(p,d){if(p!=null)return qs(p);if(d!=null){e(Y(d,32),"invalid yParityAndS");let f=z(d);return f[0]&=127,D(f)}e(!1,"missing s")}(t.s,t.yParityAndS);e((z(s)[0]&128)==0,"non-canonical s");let{networkV:o,v:l}=function(p,d,f){if(p!=null){let h=I(p);return{networkV:h>=Sn?h:void 0,v:n.getNormalizedV(h)}}if(d!=null)return e(Y(d,32),"invalid yParityAndS"),{v:z(d)[0]&128?28:27};if(f!=null){switch(_(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}e(!1,"invalid yParity")}e(!1,"missing v")}(t.v,t.yParityAndS,t.yParity),u=new n(Oe,a,s,l);return o&&(u.#n=o),e(t.yParity==null||_(t.yParity,"sig.yParity")===u.yParity,"yParity mismatch"),e(t.yParityAndS==null||t.yParityAndS===u.yParityAndS,"yParityAndS mismatch"),u}};var wi=BigInt(0),Ti=BigInt(36);function to(n){n=n.toLowerCase();let t=n.substring(2).split(""),e=new Uint8Array(40);for(let a=0;a<40;a++)e[a]=t[a].charCodeAt(0);let r=z(st(e));for(let a=0;a<40;a+=2)r[a>>1]>>4>=8&&(t[a]=t[a].toUpperCase()),(r[a>>1]&15)>=8&&(t[a+1]=t[a+1].toUpperCase());return"0x"+t.join("")}i(to,"getChecksumAddress");var Ia={};for(let n=0;n<10;n++)Ia[String(n)]=String(n);for(let n=0;n<26;n++)Ia[String.fromCharCode(65+n)]=String(10+n);var eo=15;function vi(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let t=n.split("").map(r=>Ia[r]).join("");for(;t.length>=eo;){let r=t.substring(0,eo);t=parseInt(r,10)%97+t.substring(r.length)}let e=String(98-parseInt(t,10)%97);for(;e.length<2;)e="0"+e;return e}i(vi,"ibanChecksum");var Pi=function(){let n={};for(let t=0;t<36;t++){let e="0123456789abcdefghijklmnopqrstuvwxyz"[t];n[e]=BigInt(t)}return n}();function ki(n){n=n.toLowerCase();let t=wi;for(let e=0;e<n.length;e++)t=t*Ti+Pi[n[e]];return t}i(ki,"fromBase36");function $(n){if(m(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);let t=to(n);return m(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===n,"bad address checksum","address",n),t}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){m(n.substring(2,4)===vi(n),"bad icap checksum","address",n);let t=ki(n.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return to("0x"+t)}m(!1,"invalid address","address",n)}i($,"getAddress");function Oa(n){let t=$(n.from),r=I(n.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,$(Tt(st(Pa([t,r])),12))}i(Oa,"getCreateAddress");function Dn(n){return n&&typeof n.getAddress=="function"}i(Dn,"isAddressable");async function Ba(n,t){let e=await t;return(e==null||e==="0x0000000000000000000000000000000000000000")&&(w(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),m(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),$(e)}i(Ba,"checkAddress");function ne(n,t){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?$(n):(w(t!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Ba(n,t.resolveName(n)));if(Dn(n))return Ba(n,n.getAddress());if(n&&typeof n.then=="function")return Ba(n,n);m(!1,"unsupported addressable value","target",n)}i(ne,"resolveAddress");var et=32,Na=new Uint8Array(et),Ai=["then"],_n={},ao=new WeakMap;function ae(n){return ao.get(n)}i(ae,"getNames");function ro(n,t){ao.set(n,t)}i(ro,"setNames");function ar(n,t){let e=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw e.error=t,e}i(ar,"throwError");function Fa(n,t,e){return n.indexOf(null)>=0?t.map((r,a)=>r instanceof dt?Fa(ae(r),r,e):r):n.reduce((r,a,s)=>{let o=t.getValue(a);return a in r||(e&&o instanceof dt&&(o=Fa(ae(o),o,e)),r[a]=o),r},{})}i(Fa,"toObject");var dt=class n extends Array{static{i(this,"Result")}#t;constructor(...t){let e=t[0],r=t[1],a=(t[2]||[]).slice(),s=!0;e!==_n&&(r=t,a=[],s=!1),super(r.length),r.forEach((u,p)=>{this[p]=u});let o=a.reduce((u,p)=>(typeof p=="string"&&u.set(p,(u.get(p)||0)+1),u),new Map);if(ro(this,Object.freeze(r.map((u,p)=>{let d=a[p];return d!=null&&o.get(d)===1?d:null}))),this.#t=[],this.#t==null&&this.#t,!s)return;Object.freeze(this);let l=new Proxy(this,{get:i((u,p,d)=>{if(typeof p=="string"){if(p.match(/^[0-9]+$/)){let h=_(p,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");let C=u[h];return C instanceof Error&&ar(`index ${h}`,C),C}if(Ai.indexOf(p)>=0)return Reflect.get(u,p,d);let f=u[p];if(f instanceof Function)return function(...h){return f.apply(this===d?u:this,h)};if(!(p in u))return u.getValue.apply(this===d?u:this,[p])}return Reflect.get(u,p,d)},"get")});return ro(l,ae(this)),l}toArray(t){let e=[];return this.forEach((r,a)=>{r instanceof Error&&ar(`index ${a}`,r),t&&r instanceof n&&(r=r.toArray(t)),e.push(r)}),e}toObject(t){let e=ae(this);return e.reduce((r,a,s)=>(w(a!=null,`value at index ${s} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Fa(e,this,t)),{})}slice(t,e){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),e==null&&(e=this.length),e<0&&(e+=this.length,e<0&&(e=0)),e>this.length&&(e=this.length);let r=ae(this),a=[],s=[];for(let o=t;o<e;o++)a.push(this[o]),s.push(r[o]);return new n(_n,a,s)}filter(t,e){let r=ae(this),a=[],s=[];for(let o=0;o<this.length;o++){let l=this[o];l instanceof Error&&ar(`index ${o}`,l),t.call(e,l,o,this)&&(a.push(l),s.push(r[o]))}return new n(_n,a,s)}map(t,e){let r=[];for(let a=0;a<this.length;a++){let s=this[a];s instanceof Error&&ar(`index ${a}`,s),r.push(t.call(e,s,a,this))}return r}getValue(t){let e=ae(this).indexOf(t);if(e===-1)return;let r=this[e];return r instanceof Error&&ar(`property ${JSON.stringify(t)}`,r.error),r}static fromItems(t,e){return new n(_n,t,e)}};function no(n){let t=tr(n);return w(t.length<=et,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:et,offset:t.length}),t.length!==et&&(t=nt(lt([Na.slice(t.length%et),t]))),t}i(no,"getValue");var Q=class{static{i(this,"Coder")}name;type;localName;dynamic;constructor(t,e,r,a){v(this,{name:t,type:e,localName:r,dynamic:a},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){m(!1,t,this.localName,e)}},se=class{static{i(this,"Writer")}#t;#e;constructor(){this.#t=[],this.#e=0}get data(){return lt(this.#t)}get length(){return this.#e}#r(t){return this.#t.push(t),this.#e+=t.length,t.length}appendWriter(t){return this.#r(nt(t.data))}writeBytes(t){let e=nt(t),r=e.length%et;return r&&(e=nt(lt([e,Na.slice(r)]))),this.#r(e)}writeValue(t){return this.#r(no(t))}writeUpdatableValue(){let t=this.#t.length;return this.#t.push(Na),this.#e+=et,e=>{this.#t[t]=no(e)}}},Ln=class n{static{i(this,"Reader")}allowLoose;#t;#e;#r;#n;#a;constructor(t,e,r){v(this,{allowLoose:!!e}),this.#t=nt(t),this.#r=0,this.#n=null,this.#a=r??1024,this.#e=0}get data(){return D(this.#t)}get dataLength(){return this.#t.length}get consumed(){return this.#e}get bytes(){return new Uint8Array(this.#t)}#s(t){if(this.#n)return this.#n.#s(t);this.#r+=t,w(this.#a<1||this.#r<=this.#a*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#a} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:nt(this.#t),offset:this.#e,length:t,info:{bytesRead:this.#r,dataLength:this.dataLength}})}#o(t,e,r){let a=Math.ceil(e/et)*et;return this.#e+a>this.#t.length&&(this.allowLoose&&r&&this.#e+e<=this.#t.length?a=e:w(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:nt(this.#t),length:this.#t.length,offset:this.#e+a})),this.#t.slice(this.#e,this.#e+a)}subReader(t){let e=new n(this.#t.slice(this.#e+t),this.allowLoose,this.#a);return e.#n=this,e}readBytes(t,e){let r=this.#o(0,t,!!e);return this.#s(t),this.#e+=r.length,r.slice(0,t)}readValue(){return Rn(this.readBytes(et))}readIndex(){return va(this.readBytes(et))}};var yt={};function b(n,t){let e=!1;return t<0&&(e=!0,t*=-1),new J(yt,`${e?"":"u"}int${t}`,n,{signed:e,width:t})}i(b,"n");function G(n,t){return new J(yt,`bytes${t||""}`,n,{size:t})}i(G,"b");var so=Symbol.for("_ethers_typed"),J=class n{static{i(this,"Typed")}type;value;#t;_typedSymbol;constructor(t,e,r,a){a==null&&(a=null),jt(yt,t,"Typed"),v(this,{_typedSymbol:so,type:e,value:r}),this.#t=a,this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(t=>t.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return this.#t}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return this.#t===!0?-1:this.#t===!1?this.value.length:null}static from(t,e){return new n(yt,t,e)}static uint8(t){return b(t,8)}static uint16(t){return b(t,16)}static uint24(t){return b(t,24)}static uint32(t){return b(t,32)}static uint40(t){return b(t,40)}static uint48(t){return b(t,48)}static uint56(t){return b(t,56)}static uint64(t){return b(t,64)}static uint72(t){return b(t,72)}static uint80(t){return b(t,80)}static uint88(t){return b(t,88)}static uint96(t){return b(t,96)}static uint104(t){return b(t,104)}static uint112(t){return b(t,112)}static uint120(t){return b(t,120)}static uint128(t){return b(t,128)}static uint136(t){return b(t,136)}static uint144(t){return b(t,144)}static uint152(t){return b(t,152)}static uint160(t){return b(t,160)}static uint168(t){return b(t,168)}static uint176(t){return b(t,176)}static uint184(t){return b(t,184)}static uint192(t){return b(t,192)}static uint200(t){return b(t,200)}static uint208(t){return b(t,208)}static uint216(t){return b(t,216)}static uint224(t){return b(t,224)}static uint232(t){return b(t,232)}static uint240(t){return b(t,240)}static uint248(t){return b(t,248)}static uint256(t){return b(t,256)}static uint(t){return b(t,256)}static int8(t){return b(t,-8)}static int16(t){return b(t,-16)}static int24(t){return b(t,-24)}static int32(t){return b(t,-32)}static int40(t){return b(t,-40)}static int48(t){return b(t,-48)}static int56(t){return b(t,-56)}static int64(t){return b(t,-64)}static int72(t){return b(t,-72)}static int80(t){return b(t,-80)}static int88(t){return b(t,-88)}static int96(t){return b(t,-96)}static int104(t){return b(t,-104)}static int112(t){return b(t,-112)}static int120(t){return b(t,-120)}static int128(t){return b(t,-128)}static int136(t){return b(t,-136)}static int144(t){return b(t,-144)}static int152(t){return b(t,-152)}static int160(t){return b(t,-160)}static int168(t){return b(t,-168)}static int176(t){return b(t,-176)}static int184(t){return b(t,-184)}static int192(t){return b(t,-192)}static int200(t){return b(t,-200)}static int208(t){return b(t,-208)}static int216(t){return b(t,-216)}static int224(t){return b(t,-224)}static int232(t){return b(t,-232)}static int240(t){return b(t,-240)}static int248(t){return b(t,-248)}static int256(t){return b(t,-256)}static int(t){return b(t,-256)}static bytes1(t){return G(t,1)}static bytes2(t){return G(t,2)}static bytes3(t){return G(t,3)}static bytes4(t){return G(t,4)}static bytes5(t){return G(t,5)}static bytes6(t){return G(t,6)}static bytes7(t){return G(t,7)}static bytes8(t){return G(t,8)}static bytes9(t){return G(t,9)}static bytes10(t){return G(t,10)}static bytes11(t){return G(t,11)}static bytes12(t){return G(t,12)}static bytes13(t){return G(t,13)}static bytes14(t){return G(t,14)}static bytes15(t){return G(t,15)}static bytes16(t){return G(t,16)}static bytes17(t){return G(t,17)}static bytes18(t){return G(t,18)}static bytes19(t){return G(t,19)}static bytes20(t){return G(t,20)}static bytes21(t){return G(t,21)}static bytes22(t){return G(t,22)}static bytes23(t){return G(t,23)}static bytes24(t){return G(t,24)}static bytes25(t){return G(t,25)}static bytes26(t){return G(t,26)}static bytes27(t){return G(t,27)}static bytes28(t){return G(t,28)}static bytes29(t){return G(t,29)}static bytes30(t){return G(t,30)}static bytes31(t){return G(t,31)}static bytes32(t){return G(t,32)}static address(t){return new n(yt,"address",t)}static bool(t){return new n(yt,"bool",!!t)}static bytes(t){return new n(yt,"bytes",t)}static string(t){return new n(yt,"string",t)}static array(t,e){throw new Error("not implemented yet")}static tuple(t,e){throw new Error("not implemented yet")}static overrides(t){return new n(yt,"overrides",Object.assign({},t))}static isTyped(t){return t&&typeof t=="object"&&"_typedSymbol"in t&&t._typedSymbol===so}static dereference(t,e){if(n.isTyped(t)){if(t.type!==e)throw new Error(`invalid type: expecetd ${e}, got ${t.type}`);return t.value}return t}};var Hn=class extends Q{static{i(this,"AddressCoder")}constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let r=J.dereference(e,"string");try{r=$(r)}catch(a){return this._throwError(a.message,e)}return t.writeValue(r)}decode(t){return $(qe(t.readValue(),20))}};var Un=class extends Q{static{i(this,"AnonymousCoder")}coder;constructor(t){super(t.name,t.type,"_",t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}};function Sa(n,t,e){let r=[];if(Array.isArray(e))r=e;else if(e&&typeof e=="object"){let u={};r=t.map(p=>{let d=p.localName;return w(d,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:p},value:e}),w(!u[d],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:p},value:e}),u[d]=!0,e[d]})}else m(!1,"invalid tuple value","tuple",e);m(t.length===r.length,"types/value length mismatch","tuple",e);let a=new se,s=new se,o=[];t.forEach((u,p)=>{let d=r[p];if(u.dynamic){let f=s.length;u.encode(s,d);let h=a.writeUpdatableValue();o.push(C=>{h(C+f)})}else u.encode(a,d)}),o.forEach(u=>{u(a.length)});let l=n.appendWriter(a);return l+=n.appendWriter(s),l}i(Sa,"pack");function Da(n,t){let e=[],r=[],a=n.subReader(0);return t.forEach(s=>{let o=null;if(s.dynamic){let l=n.readIndex(),u=a.subReader(l);try{o=s.decode(u)}catch(p){if(wt(p,"BUFFER_OVERRUN"))throw p;o=p,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(l){if(wt(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=s.name,o.name=s.localName,o.type=s.type}if(o==null)throw new Error("investigate");e.push(o),r.push(s.localName||null)}),dt.fromItems(e,r)}i(Da,"unpack");var Vn=class extends Q{static{i(this,"ArrayCoder")}coder;length;constructor(t,e,r){let a=t.type+"["+(e>=0?e:"")+"]",s=e===-1||t.dynamic;super("array",a,r,s),v(this,{coder:t,length:e})}defaultValue(){let t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){let r=J.dereference(e,"array");Array.isArray(r)||this._throwError("expected array value",r);let a=this.length;a===-1&&(a=r.length,t.writeValue(r.length)),Ye(r.length,a,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let o=0;o<r.length;o++)s.push(this.coder);return Sa(t,s,r)}decode(t){let e=this.length;e===-1&&(e=t.readIndex(),w(e*et<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*et,length:t.dataLength}));let r=[];for(let a=0;a<e;a++)r.push(new Un(this.coder));return Da(t,r)}};var Mn=class extends Q{static{i(this,"BooleanCoder")}constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){let r=J.dereference(e,"bool");return t.writeValue(r?1:0)}decode(t){return!!t.readValue()}};var sr=class extends Q{static{i(this,"DynamicBytesCoder")}constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=nt(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readIndex(),!0)}},Gn=class extends sr{static{i(this,"BytesCoder")}constructor(t){super("bytes",t)}decode(t){return D(super.decode(t))}};var $n=class extends Q{static{i(this,"FixedBytesCoder")}size;constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),v(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,e){let r=nt(J.dereference(e,this.type));return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return D(t.readBytes(this.size))}};var Ri=new Uint8Array([]),jn=class extends Q{static{i(this,"NullCoder")}constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return e!=null&&this._throwError("not null",e),t.writeBytes(Ri)}decode(t){return t.readBytes(0),null}};var Ii=BigInt(0),Oi=BigInt(1),Bi=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),zn=class extends Q{static{i(this,"NumberCoder")}size;signed;constructor(t,e,r){let a=(e?"int":"uint")+t*8;super(a,a,r,!1),v(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let r=I(J.dereference(e,this.type)),a=Re(Bi,et*8);if(this.signed){let s=Re(a,this.size*8-1);(r>s||r<-(s+Oi))&&this._throwError("value out-of-bounds",e),r=Ta(r,8*et)}else(r<Ii||r>Re(a,this.size*8))&&this._throwError("value out-of-bounds",e);return t.writeValue(r)}decode(t){let e=Re(t.readValue(),this.size*8);return this.signed&&(e=wa(e,this.size*8)),e}};var Jn=class extends sr{static{i(this,"StringCoder")}constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Ie(J.dereference(e,"string")))}decode(t){return rr(super.decode(t))}};var oe=class extends Q{static{i(this,"TupleCoder")}coders;constructor(t,e){let r=!1,a=[];t.forEach(o=>{o.dynamic&&(r=!0),a.push(o.type)});let s="tuple("+a.join(",")+")";super("tuple",s,e,r),v(this,{coders:Object.freeze(t.slice())})}defaultValue(){let t=[];this.coders.forEach(r=>{t.push(r.defaultValue())});let e=this.coders.reduce((r,a)=>{let s=a.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,a)=>{let s=r.localName;!s||e[s]!==1||(s==="length"&&(s="_length"),t[s]==null&&(t[s]=t[a]))}),Object.freeze(t)}encode(t,e){let r=J.dereference(e,"tuple");return Sa(t,this.coders,r)}decode(t){return Da(t,this.coders)}};function Jt(n){return st(Ie(n))}i(Jt,"id");function _a(n,t){return{address:$(n),storageKeys:t.map((e,r)=>(m(Y(e,32),"invalid slot",`storageKeys[${r}]`,e),e.toLowerCase()))}}i(_a,"accessSetify");function or(n){if(Array.isArray(n))return n.map((e,r)=>Array.isArray(e)?(m(e.length===2,"invalid slot set",`value[${r}]`,e),_a(e[0],e[1])):(m(e!=null&&typeof e=="object","invalid address-slot set","value",n),_a(e.address,e.storageKeys)));m(n!=null&&typeof n=="object","invalid access list","value",n);let t=Object.keys(n).map(e=>{let r=n[e].reduce((a,s)=>(a[s]=!0,a),{});return _a(e,Object.keys(r).sort())});return t.sort((e,r)=>e.address.localeCompare(r.address)),t}i(or,"accessListify");function at(n){let t=new Set;return n.forEach(e=>t.add(e)),Object.freeze(t)}i(at,"setify");var Ni="external public payable override",Fi=at(Ni.split(" ")),go="constant external internal payable private public pure view override",Si=at(go.split(" ")),yo="constructor error event fallback function receive struct",Co=at(yo.split(" ")),xo="calldata memory storage payable indexed",Di=at(xo.split(" ")),_i="tuple returns",Li=[yo,xo,_i,go].join(" "),Hi=at(Li.split(" ")),Ui={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Vi=new RegExp("^(\\s*)"),Mi=new RegExp("^([0-9]+)"),Gi=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),bo=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),Eo=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),Ct=class n{static{i(this,"TokenString")}#t;#e;get offset(){return this.#t}get length(){return this.#e.length-this.#t}constructor(t){this.#t=0,this.#e=t.slice()}clone(){return new n(this.#e)}reset(){this.#t=0}#r(t=0,e=0){return new n(this.#e.slice(t,e).map(r=>Object.freeze(Object.assign({},r,{match:r.match-t,linkBack:r.linkBack-t,linkNext:r.linkNext-t}))))}popKeyword(t){let e=this.peek();if(e.type!=="KEYWORD"||!t.has(e.text))throw new Error(`expected keyword ${e.text}`);return this.pop().text}popType(t){if(this.peek().type!==t){let e=this.peek();throw new Error(`expected ${t}; got ${e.type} ${JSON.stringify(e.text)}`)}return this.pop().text}popParen(){let t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");let e=this.#r(this.#t+1,t.match+1);return this.#t=t.match+1,e}popParams(){let t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");let e=[];for(;this.#t<t.match-1;){let r=this.peek().linkNext;e.push(this.#r(this.#t+1,r)),this.#t=r}return this.#t=t.match+1,e}peek(){if(this.#t>=this.#e.length)throw new Error("out-of-bounds");return this.#e[this.#t]}peekKeyword(t){let e=this.peekType("KEYWORD");return e!=null&&t.has(e)?e:null}peekType(t){if(this.length===0)return null;let e=this.peek();return e.type===t?e.text:null}pop(){let t=this.peek();return this.#t++,t}toString(){let t=[];for(let e=this.#t;e<this.#e.length;e++){let r=this.#e[e];t.push(`${r.type}:${r.text}`)}return`<TokenString ${t.join(" ")}>`}};function Yt(n){let t=[],e=i(o=>{let l=s<n.length?JSON.stringify(n[s]):"$EOI";throw new Error(`invalid token ${l} at ${s}: ${o}`)},"throwError"),r=[],a=[],s=0;for(;s<n.length;){let o=n.substring(s),l=o.match(Vi);l&&(s+=l[1].length,o=n.substring(s));let u={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:s,value:-1};t.push(u);let p=Ui[o[0]]||"";if(p){if(u.type=p,u.text=o[0],s++,p==="OPEN_PAREN")r.push(t.length-1),a.push(t.length-1);else if(p=="CLOSE_PAREN")r.length===0&&e("no matching open bracket"),u.match=r.pop(),t[u.match].match=t.length-1,u.depth--,u.linkBack=a.pop(),t[u.linkBack].linkNext=t.length-1;else if(p==="COMMA")u.linkBack=a.pop(),t[u.linkBack].linkNext=t.length-1,a.push(t.length-1);else if(p==="OPEN_BRACKET")u.type="BRACKET";else if(p==="CLOSE_BRACKET"){let d=t.pop().text;if(t.length>0&&t[t.length-1].type==="NUMBER"){let f=t.pop().text;d=f+d,t[t.length-1].value=_(f)}if(t.length===0||t[t.length-1].type!=="BRACKET")throw new Error("missing opening bracket");t[t.length-1].text+=d}continue}if(l=o.match(Gi),l){if(u.text=l[1],s+=u.text.length,Hi.has(u.text)){u.type="KEYWORD";continue}if(u.text.match(Eo)){u.type="TYPE";continue}u.type="ID";continue}if(l=o.match(Mi),l){u.text=l[1],u.type="NUMBER",s+=u.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${s}`)}return new Ct(t.map(o=>Object.freeze(o)))}i(Yt,"lex");function oo(n,t){let e=[];for(let r in t.keys())n.has(r)&&e.push(r);if(e.length>1)throw new Error(`conflicting types: ${e.join(", ")}`)}i(oo,"allowSingle");function Wn(n,t){if(t.peekKeyword(Co)){let e=t.pop().text;if(e!==n)throw new Error(`expected ${n}, got ${e}`)}return t.popType("ID")}i(Wn,"consumeName");function Ft(n,t){let e=new Set;for(;;){let r=n.peekType("KEYWORD");if(r==null||t&&!t.has(r))break;if(n.pop(),e.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);e.add(r)}return Object.freeze(e)}i(Ft,"consumeKeywords");function wo(n){let t=Ft(n,Si);return oo(t,at("constant payable nonpayable".split(" "))),oo(t,at("pure view payable nonpayable".split(" "))),t.has("view")?"view":t.has("pure")?"pure":t.has("payable")?"payable":t.has("nonpayable")?"nonpayable":t.has("constant")?"view":"nonpayable"}i(wo,"consumeMutability");function Nt(n,t){return n.popParams().map(e=>q.from(e,t))}i(Nt,"consumeParams");function To(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return I(n.pop().text);throw new Error("invalid gas")}return null}i(To,"consumeGas");function ie(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}i(ie,"consumeEoi");var $i=new RegExp(/^(.*)\[([0-9]*)\]$/);function io(n){let t=n.match(Eo);if(m(t,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(t[2]){let e=parseInt(t[2]);m(e!==0&&e<=32,"invalid bytes length","type",n)}else if(t[3]){let e=parseInt(t[3]);m(e!==0&&e<=256&&e%8===0,"invalid numeric width","type",n)}return n}i(io,"verifyBasicType");var W={},ot=Symbol.for("_ethers_internal"),co="_ParamTypeInternal",lo="_ErrorInternal",uo="_EventInternal",po="_ConstructorInternal",fo="_FallbackInternal",ho="_FunctionInternal",mo="_StructInternal",q=class n{static{i(this,"ParamType")}name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(t,e,r,a,s,o,l,u){if(jt(t,W,"ParamType"),Object.defineProperty(this,ot,{value:co}),o&&(o=Object.freeze(o.slice())),a==="array"){if(l==null||u==null)throw new Error("")}else if(l!=null||u!=null)throw new Error("");if(a==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");v(this,{name:e,type:r,baseType:a,indexed:s,components:o,arrayLength:l,arrayChildren:u})}format(t){if(t==null&&(t="sighash"),t==="json"){let r=this.name||"";if(this.isArray()){let s=JSON.parse(this.arrayChildren.format("json"));return s.name=r,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}let a={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(a.indexed=this.indexed),this.isTuple()&&(a.components=this.components.map(s=>JSON.parse(s.format(t)))),JSON.stringify(a)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?e+="("+this.components.map(r=>r.format(t)).join(t==="full"?", ":",")+")":e+=this.type,t!=="sighash"&&(this.indexed===!0&&(e+=" indexed"),t==="full"&&this.name&&(e+=" "+this.name)),e}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(t,e){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");let r=this;return t.map(a=>r.arrayChildren.walk(a,e))}if(this.isTuple()){if(!Array.isArray(t))throw new Error("invalid tuple value");if(t.length!==this.components.length)throw new Error("array is wrong length");let r=this;return t.map((a,s)=>r.components[s].walk(a,e))}return e(this.type,t)}#t(t,e,r,a){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");let o=this.arrayChildren,l=e.slice();l.forEach((u,p)=>{o.#t(t,u,r,d=>{l[p]=d})}),a(l);return}if(this.isTuple()){let o=this.components,l;if(Array.isArray(e))l=e.slice();else{if(e==null||typeof e!="object")throw new Error("invalid tuple value");l=o.map(u=>{if(!u.name)throw new Error("cannot use object value with unnamed components");if(!(u.name in e))throw new Error(`missing value for component ${u.name}`);return e[u.name]})}if(l.length!==this.components.length)throw new Error("array is wrong length");l.forEach((u,p)=>{o[p].#t(t,u,r,d=>{l[p]=d})}),a(l);return}let s=r(this.type,e);s.then?t.push(async function(){a(await s)}()):a(s)}async walkAsync(t,e){let r=[],a=[t];return this.#t(r,t,e,s=>{a[0]=s}),r.length&&await Promise.all(r),a[0]}static from(t,e){if(n.isParamType(t))return t;if(typeof t=="string")try{return n.from(Yt(t),e)}catch{m(!1,"invalid param type","obj",t)}else if(t instanceof Ct){let l="",u="",p=null;Ft(t,at(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(u="tuple",p=t.popParams().map(A=>n.from(A)),l=`tuple(${p.map(A=>A.format()).join(",")})`):(l=io(t.popType("TYPE")),u=l);let d=null,f=null;for(;t.length&&t.peekType("BRACKET");){let A=t.pop();d=new n(W,"",l,u,null,p,f,d),f=A.value,l+=A.text,u="array",p=null}let h=null;if(Ft(t,Di).has("indexed")){if(!e)throw new Error("");h=!0}let E=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new n(W,E,l,u,h,p,f,d)}let r=t.name;m(!r||typeof r=="string"&&r.match(bo),"invalid name","obj.name",r);let a=t.indexed;a==!0?(m(e,"parameter cannot be indexed","obj.indexed",t.indexed),a=!0):a=!1;let s=t.type,o=s.match($i);if(o){let l=parseInt(o[2]||"-1"),u=n.from({type:o[1],components:t.components});return new n(W,r||"",s,"array",a,null,l,u)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){let l=t.components!=null?t.components.map(p=>n.from(p)):null;return new n(W,r||"",s,"tuple",a,l,null,null)}return s=io(t.type),new n(W,r||"",s,s,a,null,null,null)}static isParamType(t){return t&&t[ot]===co}},Zt=class n{static{i(this,"Fragment")}type;inputs;constructor(t,e,r){jt(t,W,"Fragment"),r=Object.freeze(r.slice()),v(this,{type:e,inputs:r})}static from(t){if(typeof t=="string"){try{n.from(JSON.parse(t))}catch{}return n.from(Yt(t))}if(t instanceof Ct)switch(t.peekKeyword(Co)){case"constructor":return Kt.from(t);case"error":return ut.from(t);case"event":return Wt.from(t);case"fallback":case"receive":return cr.from(t);case"function":return Xt.from(t);case"struct":return Ne.from(t)}else if(typeof t=="object"){switch(t.type){case"constructor":return Kt.from(t);case"error":return ut.from(t);case"event":return Wt.from(t);case"fallback":case"receive":return cr.from(t);case"function":return Xt.from(t);case"struct":return Ne.from(t)}w(!1,`unsupported type: ${t.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}m(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return Kt.isFragment(t)}static isError(t){return ut.isFragment(t)}static isEvent(t){return Wt.isFragment(t)}static isFunction(t){return Xt.isFragment(t)}static isStruct(t){return Ne.isFragment(t)}},ce=class extends Zt{static{i(this,"NamedFragment")}name;constructor(t,e,r,a){super(t,e,a),m(typeof r=="string"&&r.match(bo),"invalid identifier","name",r),a=Object.freeze(a.slice()),v(this,{name:r})}};function ir(n,t){return"("+t.map(e=>e.format(n)).join(n==="full"?", ":",")+")"}i(ir,"joinParams");var ut=class n extends ce{static{i(this,"ErrorFragment")}constructor(t,e,r){super(t,"error",e,r),Object.defineProperty(this,ot,{value:lo})}get selector(){return Jt(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("error"),e.push(this.name+ir(t,this.inputs)),e.join(" ")}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")return n.from(Yt(t));if(t instanceof Ct){let e=Wn("error",t),r=Nt(t);return ie(t),new n(W,e,r)}return new n(W,t.name,t.inputs?t.inputs.map(q.from):[])}static isFragment(t){return t&&t[ot]===lo}},Wt=class n extends ce{static{i(this,"EventFragment")}anonymous;constructor(t,e,r,a){super(t,"event",e,r),Object.defineProperty(this,ot,{value:uo}),v(this,{anonymous:a})}get topicHash(){return Jt(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("event"),e.push(this.name+ir(t,this.inputs)),t!=="sighash"&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){return e=(e||[]).map(a=>q.from(a)),new n(W,t,e,!1).topicHash}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Yt(t))}catch{m(!1,"invalid event fragment","obj",t)}else if(t instanceof Ct){let e=Wn("event",t),r=Nt(t,!0),a=!!Ft(t,at(["anonymous"])).has("anonymous");return ie(t),new n(W,e,r,a)}return new n(W,t.name,t.inputs?t.inputs.map(e=>q.from(e,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[ot]===uo}},Kt=class n extends Zt{static{i(this,"ConstructorFragment")}payable;gas;constructor(t,e,r,a,s){super(t,e,r),Object.defineProperty(this,ot,{value:po}),v(this,{payable:a,gas:s})}format(t){if(w(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[`constructor${ir(t,this.inputs)}`];return this.payable&&e.push("payable"),this.gas!=null&&e.push(`@${this.gas.toString()}`),e.join(" ")}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Yt(t))}catch{m(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof Ct){Ft(t,at(["constructor"]));let e=Nt(t),r=!!Ft(t,Fi).has("payable"),a=To(t);return ie(t),new n(W,"constructor",e,r,a)}return new n(W,"constructor",t.inputs?t.inputs.map(q.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ot]===po}},cr=class n extends Zt{static{i(this,"FallbackFragment")}payable;constructor(t,e,r){super(t,"fallback",e),Object.defineProperty(this,ot,{value:fo}),v(this,{payable:r})}format(t){let e=this.inputs.length===0?"receive":"fallback";if(t==="json"){let r=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:r})}return`${e}()${this.payable?" payable":""}`}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Yt(t))}catch{m(!1,"invalid fallback fragment","obj",t)}else if(t instanceof Ct){let e=t.toString(),r=t.peekKeyword(at(["fallback","receive"]));if(m(r,"type must be fallback or receive","obj",e),t.popKeyword(at(["fallback","receive"]))==="receive"){let l=Nt(t);return m(l.length===0,"receive cannot have arguments","obj.inputs",l),Ft(t,at(["payable"])),ie(t),new n(W,[],!0)}let s=Nt(t);s.length?m(s.length===1&&s[0].type==="bytes","invalid fallback inputs","obj.inputs",s.map(l=>l.format("minimal")).join(", ")):s=[q.from("bytes")];let o=wo(t);if(m(o==="nonpayable"||o==="payable","fallback cannot be constants","obj.stateMutability",o),Ft(t,at(["returns"])).has("returns")){let l=Nt(t);m(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(u=>u.format("minimal")).join(", "))}return ie(t),new n(W,s,o==="payable")}if(t.type==="receive")return new n(W,[],!0);if(t.type==="fallback"){let e=[q.from("bytes")],r=t.stateMutability==="payable";return new n(W,e,r)}m(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[ot]===fo}},Xt=class n extends ce{static{i(this,"FunctionFragment")}constant;outputs;stateMutability;payable;gas;constructor(t,e,r,a,s,o){super(t,"function",e,a),Object.defineProperty(this,ot,{value:ho}),s=Object.freeze(s.slice()),v(this,{constant:r==="view"||r==="pure",gas:o,outputs:s,payable:r==="payable",stateMutability:r})}get selector(){return Jt(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="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!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t))),outputs:this.outputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("function"),e.push(this.name+ir(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push(ir(t,this.outputs))),this.gas!=null&&e.push(`@${this.gas.toString()}`)),e.join(" ")}static getSelector(t,e){return e=(e||[]).map(a=>q.from(a)),new n(W,t,"view",e,[],null).selector}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Yt(t))}catch{m(!1,"invalid function fragment","obj",t)}else if(t instanceof Ct){let r=Wn("function",t),a=Nt(t),s=wo(t),o=[];Ft(t,at(["returns"])).has("returns")&&(o=Nt(t));let l=To(t);return ie(t),new n(W,r,s,a,o,l)}let e=t.stateMutability;return e==null&&(e="payable",typeof t.constant=="boolean"?(e="view",t.constant||(e="payable",typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable")),new n(W,t.name,e,t.inputs?t.inputs.map(q.from):[],t.outputs?t.outputs.map(q.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ot]===ho}},Ne=class n extends ce{static{i(this,"StructFragment")}constructor(t,e,r){super(t,"struct",e,r),Object.defineProperty(this,ot,{value:mo})}format(){throw new Error("@TODO")}static from(t){if(typeof t=="string")try{return n.from(Yt(t))}catch{m(!1,"invalid struct fragment","obj",t)}else if(t instanceof Ct){let e=Wn("struct",t),r=Nt(t);return ie(t),new n(W,e,r)}return new n(W,t.name,t.inputs?t.inputs.map(q.from):[])}static isFragment(t){return t&&t[ot]===mo}};var xt=new Map;xt.set(0,"GENERIC_PANIC");xt.set(1,"ASSERT_FALSE");xt.set(17,"OVERFLOW");xt.set(18,"DIVIDE_BY_ZERO");xt.set(33,"ENUM_RANGE_ERROR");xt.set(34,"BAD_STORAGE_DATA");xt.set(49,"STACK_UNDERFLOW");xt.set(50,"ARRAY_RANGE_ERROR");xt.set(65,"OUT_OF_MEMORY");xt.set(81,"UNINITIALIZED_FUNCTION_CALL");var ji=new RegExp(/^bytes([0-9]*)$/),zi=new RegExp(/^(u?int)([0-9]*)$/),La=null,vo=1024;function Ji(n,t,e,r){let a="missing revert data",s=null,o=null,l=null;if(e){a="execution reverted";let p=z(e);if(e=D(e),p.length===0)a+=" (no data present; likely require(false) occurred",s="require(false)";else if(p.length%32!==4)a+=" (could not decode reason; invalid data length)";else if(D(p.slice(0,4))==="0x08c379a0")try{s=r.decode(["string"],p.slice(4))[0],l={signature:"Error(string)",name:"Error",args:[s]},a+=`: ${JSON.stringify(s)}`}catch{a+=" (could not decode reason; invalid string data)"}else if(D(p.slice(0,4))==="0x4e487b71")try{let d=Number(r.decode(["uint256"],p.slice(4))[0]);l={signature:"Panic(uint256)",name:"Panic",args:[d]},s=`Panic due to ${xt.get(d)||"UNKNOWN"}(${d})`,a+=`: ${s}`}catch{a+=" (could not decode panic code)"}else a+=" (unknown custom error)"}let u={to:t.to?$(t.to):null,data:t.data||"0x"};return t.from&&(u.from=$(t.from)),Bt(a,"CALL_EXCEPTION",{action:n,data:e,reason:s,transaction:u,invocation:o,revert:l})}i(Ji,"getBuiltinCallException");var Fe=class n{static{i(this,"AbiCoder")}#t(t){if(t.isArray())return new Vn(this.#t(t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new oe(t.components.map(r=>this.#t(r)),t.name);switch(t.baseType){case"address":return new Hn(t.name);case"bool":return new Mn(t.name);case"string":return new Jn(t.name);case"bytes":return new Gn(t.name);case"":return new jn(t.name)}let e=t.type.match(zi);if(e){let r=parseInt(e[2]||"256");return m(r!==0&&r<=256&&r%8===0,"invalid "+e[1]+" bit length","param",t),new zn(r/8,e[1]==="int",t.name)}if(e=t.type.match(ji),e){let r=parseInt(e[1]);return m(r!==0&&r<=32,"invalid bytes length","param",t),new $n(r,t.name)}m(!1,"invalid type","type",t.type)}getDefaultValue(t){let e=t.map(a=>this.#t(q.from(a)));return new oe(e,"_").defaultValue()}encode(t,e){Ye(e.length,t.length,"types/values length mismatch");let r=t.map(o=>this.#t(q.from(o))),a=new oe(r,"_"),s=new se;return a.encode(s,e),s.data}decode(t,e,r){let a=t.map(o=>this.#t(q.from(o)));return new oe(a,"_").decode(new Ln(e,r,vo))}static _setDefaultMaxInflation(t){m(typeof t=="number"&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),vo=t}static defaultAbiCoder(){return La==null&&(La=new n),La}static getBuiltinCallException(t,e,r){return Ji(t,e,r,n.defaultAbiCoder())}};function Po(n){let t=z(n,"bytes");if(t.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(t[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let e=31;for(;t[e-1]===0;)e--;return rr(t.slice(0,e))}i(Po,"decodeBytes32String");var lr=class{static{i(this,"LogDescription")}fragment;name;signature;topic;args;constructor(t,e,r){let a=t.name,s=t.format();v(this,{fragment:t,name:a,signature:s,topic:e,args:r})}},ur=class{static{i(this,"TransactionDescription")}fragment;name;args;signature;selector;value;constructor(t,e,r,a){let s=t.name,o=t.format();v(this,{fragment:t,name:s,args:r,signature:o,selector:e,value:a})}},pr=class{static{i(this,"ErrorDescription")}fragment;name;args;signature;selector;constructor(t,e,r){let a=t.name,s=t.format();v(this,{fragment:t,name:a,args:r,signature:s,selector:e})}},Se=class{static{i(this,"Indexed")}hash;_isIndexed;static isIndexed(t){return!!(t&&t._isIndexed)}constructor(t){v(this,{hash:t,_isIndexed:!0})}},ko={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},Ao={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:i(n=>`reverted with reason string ${JSON.stringify(n)}`,"reason")},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:i(n=>{let t="unknown panic code";return n>=0&&n<=255&&ko[n.toString()]&&(t=ko[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${t})`},"reason")}},St=class n{static{i(this,"Interface")}fragments;deploy;fallback;receive;#t;#e;#r;#n;constructor(t){let e=[];typeof t=="string"?e=JSON.parse(t):e=t,this.#r=new Map,this.#t=new Map,this.#e=new Map;let r=[];for(let o of e)try{r.push(Zt.from(o))}catch(l){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,l.message)}v(this,{fragments:Object.freeze(r)});let a=null,s=!1;this.#n=this.getAbiCoder(),this.fragments.forEach((o,l)=>{let u;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}v(this,{deploy:o});return;case"fallback":o.inputs.length===0?s=!0:(m(!a||o.payable!==a.payable,"conflicting fallback fragments",`fragments[${l}]`,o),a=o,s=a.payable);return;case"function":u=this.#r;break;case"event":u=this.#e;break;case"error":u=this.#t;break;default:return}let p=o.format();u.has(p)||u.set(p,o)}),this.deploy||v(this,{deploy:Kt.from("constructor()")}),v(this,{fallback:a,receive:s})}format(t){let e=t?"minimal":"full";return this.fragments.map(a=>a.format(e))}formatJson(){let t=this.fragments.map(e=>e.format("json"));return JSON.stringify(t.map(e=>JSON.parse(e)))}getAbiCoder(){return Fe.defaultAbiCoder()}#a(t,e,r){if(Y(t)){let s=t.toLowerCase();for(let o of this.#r.values())if(s===o.selector)return o;return null}if(t.indexOf("(")===-1){let s=[];for(let[o,l]of this.#r)o.split("(")[0]===t&&s.push(l);if(e){let o=e.length>0?e[e.length-1]:null,l=e.length,u=!0;J.isTyped(o)&&o.type==="overrides"&&(u=!1,l--);for(let p=s.length-1;p>=0;p--){let d=s[p].inputs.length;d!==l&&(!u||d!==l-1)&&s.splice(p,1)}for(let p=s.length-1;p>=0;p--){let d=s[p].inputs;for(let f=0;f<e.length;f++)if(J.isTyped(e[f])){if(f>=d.length){if(e[f].type==="overrides")continue;s.splice(p,1);break}if(e[f].type!==d[f].baseType){s.splice(p,1);break}}}}if(s.length===1&&e&&e.length!==s[0].inputs.length){let o=e[e.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&r){let o=s.map(l=>JSON.stringify(l.format())).join(", ");m(!1,`ambiguous function description (i.e. matches ${o})`,"key",t)}return s[0]}let a=this.#r.get(Xt.from(t).format());return a||null}getFunctionName(t){let e=this.#a(t,null,!1);return m(e,"no matching function","key",t),e.name}hasFunction(t){return!!this.#a(t,null,!1)}getFunction(t,e){return this.#a(t,e||null,!0)}forEachFunction(t){let e=Array.from(this.#r.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#r.get(a),r)}}#s(t,e,r){if(Y(t)){let s=t.toLowerCase();for(let o of this.#e.values())if(s===o.topicHash)return o;return null}if(t.indexOf("(")===-1){let s=[];for(let[o,l]of this.#e)o.split("(")[0]===t&&s.push(l);if(e){for(let o=s.length-1;o>=0;o--)s[o].inputs.length<e.length&&s.splice(o,1);for(let o=s.length-1;o>=0;o--){let l=s[o].inputs;for(let u=0;u<e.length;u++)if(J.isTyped(e[u])&&e[u].type!==l[u].baseType){s.splice(o,1);break}}}if(s.length===0)return null;if(s.length>1&&r){let o=s.map(l=>JSON.stringify(l.format())).join(", ");m(!1,`ambiguous event description (i.e. matches ${o})`,"key",t)}return s[0]}let a=this.#e.get(Wt.from(t).format());return a||null}getEventName(t){let e=this.#s(t,null,!1);return m(e,"no matching event","key",t),e.name}hasEvent(t){return!!this.#s(t,null,!1)}getEvent(t,e){return this.#s(t,e||null,!0)}forEachEvent(t){let e=Array.from(this.#e.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#e.get(a),r)}}getError(t,e){if(Y(t)){let a=t.toLowerCase();if(Ao[a])return ut.from(Ao[a].signature);for(let s of this.#t.values())if(a===s.selector)return s;return null}if(t.indexOf("(")===-1){let a=[];for(let[s,o]of this.#t)s.split("(")[0]===t&&a.push(o);if(a.length===0)return t==="Error"?ut.from("error Error(string)"):t==="Panic"?ut.from("error Panic(uint256)"):null;if(a.length>1){let s=a.map(o=>JSON.stringify(o.format())).join(", ");m(!1,`ambiguous error description (i.e. ${s})`,"name",t)}return a[0]}if(t=ut.from(t).format(),t==="Error(string)")return ut.from("error Error(string)");if(t==="Panic(uint256)")return ut.from("error Panic(uint256)");let r=this.#t.get(t);return r||null}forEachError(t){let e=Array.from(this.#t.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#t.get(a),r)}}_decodeParams(t,e){return this.#n.decode(t,e)}_encodeParams(t,e){return this.#n.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if(typeof t=="string"){let r=this.getError(t);m(r,"unknown error","fragment",t),t=r}return m(Tt(e,0,4)===t.selector,`data signature does not match error ${t.name}.`,"data",e),this._decodeParams(t.inputs,Tt(e,4))}encodeErrorResult(t,e){if(typeof t=="string"){let r=this.getError(t);m(r,"unknown error","fragment",t),t=r}return lt([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return m(Tt(e,0,4)===t.selector,`data signature does not match function ${t.name}.`,"data",e),this._decodeParams(t.inputs,Tt(e,4))}encodeFunctionData(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return lt([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if(typeof t=="string"){let s=this.getFunction(t);m(s,"unknown function","fragment",t),t=s}let r="invalid length for result data",a=nt(e);if(a.length%32===0)try{return this.#n.decode(t.outputs,a)}catch{r="could not decode result data"}w(!1,r,"BAD_DATA",{value:D(a),info:{method:t.name,signature:t.format()}})}makeError(t,e){let r=z(t,"data"),a=Fe.getBuiltinCallException("call",e,r);if(a.message.startsWith("execution reverted (unknown custom error)")){let l=D(r.slice(0,4)),u=this.getError(l);if(u)try{let p=this.#n.decode(u.inputs,r.slice(4));a.revert={name:u.name,signature:u.format(),args:p},a.reason=a.revert.signature,a.message=`execution reverted: ${a.reason}`}catch{a.message="execution reverted (coult not decode custom error)"}}let o=this.parseTransaction(e);return o&&(a.invocation={method:o.name,signature:o.signature,args:o.args}),a}encodeFunctionResult(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return D(this.#n.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if(typeof t=="string"){let s=this.getEvent(t);m(s,"unknown event","eventFragment",t),t=s}w(e.length<=t.inputs.length,`too many arguments for ${t.format()}`,"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});let r=[];t.anonymous||r.push(t.topicHash);let a=i((s,o)=>s.type==="string"?Jt(o):s.type==="bytes"?st(D(o)):(s.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":s.type.match(/^u?int/)?o=qe(o):s.type.match(/^bytes/)?o=kn(o,32):s.type==="address"&&this.#n.encode(["address"],[o]),ke(D(o),32)),"encodeTopic");for(e.forEach((s,o)=>{let l=t.inputs[o];if(!l.indexed){m(s==null,"cannot filter non-indexed parameters; must be null","contract."+l.name,s);return}s==null?r.push(null):l.baseType==="array"||l.baseType==="tuple"?m(!1,"filtering with tuples or arrays not supported","contract."+l.name,s):Array.isArray(s)?r.push(s.map(u=>a(l,u))):r.push(a(l,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(t,e){if(typeof t=="string"){let o=this.getEvent(t);m(o,"unknown event","eventFragment",t),t=o}let r=[],a=[],s=[];return t.anonymous||r.push(t.topicHash),m(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach((o,l)=>{let u=e[l];if(o.indexed)if(o.type==="string")r.push(Jt(u));else if(o.type==="bytes")r.push(st(u));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(this.#n.encode([o.type],[u]))}else a.push(o),s.push(u)}),{data:this.#n.encode(a,s),topics:r}}decodeEventLog(t,e,r){if(typeof t=="string"){let C=this.getEvent(t);m(C,"unknown event","eventFragment",t),t=C}if(r!=null&&!t.anonymous){let C=t.topicHash;m(Y(r[0],32)&&r[0].toLowerCase()===C,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}let a=[],s=[],o=[];t.inputs.forEach((C,E)=>{C.indexed?C.type==="string"||C.type==="bytes"||C.baseType==="tuple"||C.baseType==="array"?(a.push(q.from({type:"bytes32",name:C.name})),o.push(!0)):(a.push(C),o.push(!1)):(s.push(C),o.push(!1))});let l=r!=null?this.#n.decode(a,lt(r)):null,u=this.#n.decode(s,e,!0),p=[],d=[],f=0,h=0;return t.inputs.forEach((C,E)=>{let A=null;if(C.indexed)if(l==null)A=new Se(null);else if(o[E])A=new Se(l[h++]);else try{A=l[h++]}catch(S){A=S}else try{A=u[f++]}catch(S){A=S}p.push(A),d.push(C.name||null)}),dt.fromItems(p,d)}parseTransaction(t){let e=z(t.data,"tx.data"),r=I(t.value!=null?t.value:0,"tx.value"),a=this.getFunction(D(e.slice(0,4)));if(!a)return null;let s=this.#n.decode(a.inputs,e.slice(4));return new ur(a,a.selector,s,r)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new lr(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){let e=D(t),r=this.getError(Tt(e,0,4));if(!r)return null;let a=this.#n.decode(r.inputs,Tt(e,4));return new pr(r,r.selector,a)}static from(t){return t instanceof n?t:typeof t=="string"?new n(JSON.parse(t)):typeof t.formatJson=="function"?new n(t.formatJson()):typeof t.format=="function"?new n(t.format("json")):new n(t)}};var Io=BigInt(0);function ft(n){return n==null?null:n.toString()}i(ft,"toJson");function Oo(n){let t={};n.to&&(t.to=n.to),n.from&&(t.from=n.from),n.data&&(t.data=D(n.data));let e="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(let a of e)!(a in n)||n[a]==null||(t[a]=I(n[a],`request.${a}`));let r="type,nonce".split(/,/);for(let a of r)!(a in n)||n[a]==null||(t[a]=_(n[a],`request.${a}`));return n.accessList&&(t.accessList=or(n.accessList)),"blockTag"in n&&(t.blockTag=n.blockTag),"enableCcipRead"in n&&(t.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(t.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(t.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(t.kzg=n.kzg),"blobs"in n&&n.blobs&&(t.blobs=n.blobs.map(a=>Ea(a)?D(a):Object.assign({},a))),t}i(Oo,"copyRequest");var Qt=class{static{i(this,"Log")}provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(t,e){this.provider=e;let r=Object.freeze(t.topics.slice());v(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:r,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){let{address:t,blockHash:e,blockNumber:r,data:a,index:s,removed:o,topics:l,transactionHash:u,transactionIndex:p}=this;return{_type:"log",address:t,blockHash:e,blockNumber:r,data:a,index:s,removed:o,topics:l,transactionHash:u,transactionIndex:p}}async getBlock(){let t=await this.provider.getBlock(this.blockHash);return w(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){let t=await this.provider.getTransaction(this.transactionHash);return w(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){let t=await this.provider.getTransactionReceipt(this.transactionHash);return w(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return Ki(this)}},Kn=class{static{i(this,"TransactionReceipt")}provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#t;constructor(t,e){this.#t=Object.freeze(t.logs.map(a=>new Qt(a,e)));let r=Io;t.effectiveGasPrice!=null?r=t.effectiveGasPrice:t.gasPrice!=null&&(r=t.gasPrice),v(this,{provider:e,to:t.to,from:t.from,contractAddress:t.contractAddress,hash:t.hash,index:t.index,blockHash:t.blockHash,blockNumber:t.blockNumber,logsBloom:t.logsBloom,gasUsed:t.gasUsed,cumulativeGasUsed:t.cumulativeGasUsed,blobGasUsed:t.blobGasUsed,gasPrice:r,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return this.#t}toJSON(){let{to:t,from:e,contractAddress:r,hash:a,index:s,blockHash:o,blockNumber:l,logsBloom:u,logs:p,status:d,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:l,contractAddress:r,cumulativeGasUsed:ft(this.cumulativeGasUsed),from:e,gasPrice:ft(this.gasPrice),blobGasUsed:ft(this.blobGasUsed),blobGasPrice:ft(this.blobGasPrice),gasUsed:ft(this.gasUsed),hash:a,index:s,logs:p,logsBloom:u,root:f,status:d,to:t}}get length(){return this.logs.length}[Symbol.iterator](){let t=0;return{next:i(()=>t<this.length?{value:this.logs[t++],done:!1}:{value:void 0,done:!0},"next")}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){let t=await this.provider.getBlock(this.blockHash);if(t==null)throw new Error("TODO");return t}async getTransaction(){let t=await this.provider.getTransaction(this.hash);if(t==null)throw new Error("TODO");return t}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return No(this)}reorderedEvent(t){return w(!t||t.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),Bo(this,t)}},Xn=class n{static{i(this,"TransactionResponse")}provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;#t;constructor(t,e){this.provider=e,this.blockNumber=t.blockNumber!=null?t.blockNumber:null,this.blockHash=t.blockHash!=null?t.blockHash:null,this.hash=t.hash,this.index=t.index,this.type=t.type,this.from=t.from,this.to=t.to||null,this.gasLimit=t.gasLimit,this.nonce=t.nonce,this.data=t.data,this.value=t.value,this.gasPrice=t.gasPrice,this.maxPriorityFeePerGas=t.maxPriorityFeePerGas!=null?t.maxPriorityFeePerGas:null,this.maxFeePerGas=t.maxFeePerGas!=null?t.maxFeePerGas:null,this.maxFeePerBlobGas=t.maxFeePerBlobGas!=null?t.maxFeePerBlobGas:null,this.chainId=t.chainId,this.signature=t.signature,this.accessList=t.accessList!=null?t.accessList:null,this.blobVersionedHashes=t.blobVersionedHashes!=null?t.blobVersionedHashes:null,this.#t=-1}toJSON(){let{blockNumber:t,blockHash:e,index:r,hash:a,type:s,to:o,from:l,nonce:u,data:p,signature:d,accessList:f,blobVersionedHashes:h}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:t,blockHash:e,blobVersionedHashes:h,chainId:ft(this.chainId),data:p,from:l,gasLimit:ft(this.gasLimit),gasPrice:ft(this.gasPrice),hash:a,maxFeePerGas:ft(this.maxFeePerGas),maxPriorityFeePerGas:ft(this.maxPriorityFeePerGas),maxFeePerBlobGas:ft(this.maxFeePerBlobGas),nonce:u,signature:d,to:o,index:r,type:s,value:ft(this.value)}}async getBlock(){let t=this.blockNumber;if(t==null){let r=await this.getTransaction();r&&(t=r.blockNumber)}if(t==null)return null;let e=this.provider.getBlock(t);if(e==null)throw new Error("TODO");return e}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){let{tx:e,blockNumber:r}=await ve({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return e==null||e.blockNumber==null?0:r-e.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){let r=t??1,a=e??0,s=this.#t,o=-1,l=s===-1,u=i(async()=>{if(l)return null;let{blockNumber:h,nonce:C}=await ve({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(C<this.nonce){s=h;return}if(l)return null;let E=await this.getTransaction();if(!(E&&E.blockNumber!=null))for(o===-1&&(o=s-3,o<this.#t&&(o=this.#t));o<=h;){if(l)return null;let A=await this.provider.getBlock(o,!0);if(A==null)return;for(let S of A)if(S===this.hash)return;for(let S=0;S<A.length;S++){let R=await A.getTransaction(S);if(R.from===this.from&&R.nonce===this.nonce){if(l)return null;let H=await this.provider.getTransactionReceipt(R.hash);if(H==null||h-H.blockNumber+1<r)return;let M="replaced";R.data===this.data&&R.to===this.to&&R.value===this.value?M="repriced":R.data==="0x"&&R.from===R.to&&R.value===Io&&(M="cancelled"),w(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:M==="replaced"||M==="cancelled",reason:M,replacement:R.replaceableTransaction(s),hash:R.hash,receipt:H})}}o++}},"checkReplacement"),p=i(h=>{if(h==null||h.status!==0)return h;w(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:h.to,from:h.from,data:""},receipt:h})},"checkReceipt"),d=await this.provider.getTransactionReceipt(this.hash);if(r===0)return p(d);if(d){if(await d.confirmations()>=r)return p(d)}else if(await u(),r===0)return null;return await new Promise((h,C)=>{let E=[],A=i(()=>{E.forEach(R=>R())},"cancel");if(E.push(()=>{l=!0}),a>0){let R=setTimeout(()=>{A(),C(Bt("wait for transaction timeout","TIMEOUT"))},a);E.push(()=>{clearTimeout(R)})}let S=i(async R=>{if(await R.confirmations()>=r){A();try{h(p(R))}catch(H){C(H)}}},"txListener");if(E.push(()=>{this.provider.off(this.hash,S)}),this.provider.on(this.hash,S),s>=0){let R=i(async()=>{try{await u()}catch(H){if(wt(H,"TRANSACTION_REPLACED")){A(),C(H);return}}l||this.provider.once("block",R)},"replaceListener");E.push(()=>{this.provider.off("block",R)}),this.provider.once("block",R)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return w(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),No(this)}reorderedEvent(t){return w(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),w(!t||t.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Bo(this,t)}replaceableTransaction(t){m(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);let e=new n(this,this.provider);return e.#t=t,e}};function Bo(n,t){return{orphan:"reorder-transaction",tx:n,other:t}}i(Bo,"createReorderedTransactionFilter");function No(n){return{orphan:"drop-transaction",tx:n}}i(No,"createRemovedTransactionFilter");function Ki(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}i(Ki,"createRemovedLogFilter");var le=class extends Qt{static{i(this,"EventLog")}interface;fragment;args;constructor(t,e,r){super(t,t.provider);let a=e.decodeEventLog(r,t.data,t.topics);v(this,{args:a,fragment:r,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}},De=class extends Qt{static{i(this,"UndecodedEventLog")}error;constructor(t,e){super(t,t.provider),v(this,{error:e})}},Zn=class extends Kn{static{i(this,"ContractTransactionReceipt")}#t;constructor(t,e,r){super(r,e),this.#t=t}get logs(){return super.logs.map(t=>{let e=t.topics.length?this.#t.getEvent(t.topics[0]):null;if(e)try{return new le(t,this.#t,e)}catch(r){return new De(t,r)}return t})}},ue=class extends Xn{static{i(this,"ContractTransactionResponse")}#t;constructor(t,e,r){super(r,e),this.#t=t}async wait(t,e){let r=await super.wait(t,e);return r==null?null:new Zn(this.#t,this.provider,r)}},_e=class extends er{static{i(this,"ContractUnknownEventPayload")}log;constructor(t,e,r,a){super(t,e,r),v(this,{log:a})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}},dr=class extends _e{static{i(this,"ContractEventPayload")}constructor(t,e,r,a,s){super(t,e,r,new le(s,t.interface,a));let o=t.interface.decodeEventLog(a,this.log.data,this.log.topics);v(this,{args:o,fragment:a})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}};var Fo=BigInt(0);function Do(n){return n&&typeof n.call=="function"}i(Do,"canCall");function _o(n){return n&&typeof n.estimateGas=="function"}i(_o,"canEstimate");function qn(n){return n&&typeof n.resolveName=="function"}i(qn,"canResolve");function Lo(n){return n&&typeof n.sendTransaction=="function"}i(Lo,"canSend");function Ho(n){if(n!=null){if(qn(n))return n;if(n.provider)return n.provider}}i(Ho,"getResolver");var Ha=class{static{i(this,"PreparedTopicFilter")}#t;fragment;constructor(t,e,r){if(v(this,{fragment:e}),e.inputs.length<r.length)throw new Error("too many arguments");let a=de(t.runner,"resolveName"),s=qn(a)?a:null;this.#t=async function(){let o=await Promise.all(e.inputs.map((l,u)=>r[u]==null?null:l.walkAsync(r[u],(d,f)=>d==="address"?Array.isArray(f)?Promise.all(f.map(h=>ne(h,s))):ne(f,s):f)));return t.interface.encodeFilterTopics(e,o)}()}getTopicFilter(){return this.#t}};function de(n,t){return n==null?null:typeof n[t]=="function"?n:n.provider&&typeof n.provider[t]=="function"?n.provider:null}i(de,"getRunner");function pe(n){return n==null?null:n.provider||null}i(pe,"getProvider");async function Uo(n,t){let e=J.dereference(n,"overrides");m(typeof e=="object","invalid overrides parameter","overrides",n);let r=Oo(e);return m(r.to==null||(t||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),m(r.data==null||(t||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}i(Uo,"copyOverrides");async function Xi(n,t,e){let r=de(n,"resolveName"),a=qn(r)?r:null;return await Promise.all(t.map((s,o)=>s.walkAsync(e[o],(l,u)=>(u=J.dereference(u,l),l==="address"?ne(u,a):u))))}i(Xi,"resolveArgs");function Zi(n){let t=i(async function(o){let l=await Uo(o,["data"]);l.to=await n.getAddress(),l.from&&(l.from=await ne(l.from,Ho(n.runner)));let u=n.interface,p=I(l.value||Fo,"overrides.value")===Fo,d=(l.data||"0x")==="0x";u.fallback&&!u.fallback.payable&&u.receive&&!d&&!p&&m(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),m(u.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data);let f=u.receive||u.fallback&&u.fallback.payable;return m(f||p,"cannot send value to non-payable fallback","overrides.value",l.value),m(u.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data),l},"populateTransaction"),e=i(async function(o){let l=de(n.runner,"call");w(Do(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let u=await t(o);try{return await l.call(u)}catch(p){throw vn(p)&&p.data?n.interface.makeError(p.data,u):p}},"staticCall"),r=i(async function(o){let l=n.runner;w(Lo(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let u=await l.sendTransaction(await t(o)),p=pe(n.runner);return new ue(n.interface,p,u)},"send"),a=i(async function(o){let l=de(n.runner,"estimateGas");return w(_o(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await t(o))},"estimateGas"),s=i(async o=>await r(o),"method");return v(s,{_contract:n,estimateGas:a,populateTransaction:t,send:r,staticCall:e}),s}i(Zi,"buildWrappedFallback");function Yi(n,t){let e=i(function(...p){let d=n.interface.getFunction(t,p);return w(d,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:p}}),d},"getFragment"),r=i(async function(...p){let d=e(...p),f={};if(d.inputs.length+1===p.length&&(f=await Uo(p.pop()),f.from&&(f.from=await ne(f.from,Ho(n.runner)))),d.inputs.length!==p.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");let h=await Xi(n.runner,d.inputs,p);return Object.assign({},f,await ve({to:n.getAddress(),data:n.interface.encodeFunctionData(d,h)}))},"populateTransaction"),a=i(async function(...p){let d=await l(...p);return d.length===1?d[0]:d},"staticCall"),s=i(async function(...p){let d=n.runner;w(Lo(d),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let f=await d.sendTransaction(await r(...p)),h=pe(n.runner);return new ue(n.interface,h,f)},"send"),o=i(async function(...p){let d=de(n.runner,"estimateGas");return w(_o(d),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await d.estimateGas(await r(...p))},"estimateGas"),l=i(async function(...p){let d=de(n.runner,"call");w(Do(d),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let f;try{f=await r(...p)}catch(E){let A=p.at(-1).blockTag;throw A&&(E.blockNumber=A),E}let h="0x";try{h=await d.call(f)}catch(E){throw vn(E)&&E.data?n.interface.makeError(E.data,f):E}let C=e(...p);return n.interface.decodeFunctionResult(C,h)},"staticCallResult"),u=i(async(...p)=>e(...p).constant?await a(...p):await s(...p),"method");return v(u,{name:n.interface.getFunctionName(t),_contract:n,_key:t,getFragment:e,estimateGas:o,populateTransaction:r,send:s,staticCall:a,staticCallResult:l}),Object.defineProperty(u,"fragment",{configurable:!1,enumerable:!0,get:i(()=>{let p=n.interface.getFunction(t);return w(p,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),p},"get")}),u}i(Yi,"buildWrappedMethod");function Qi(n,t){let e=i(function(...a){let s=n.interface.getEvent(t,a);return w(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:a}}),s},"getFragment"),r=i(function(...a){return new Ha(n,e(...a),a)},"method");return v(r,{name:n.interface.getEventName(t),_contract:n,_key:t,getFragment:e}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:i(()=>{let a=n.interface.getEvent(t);return w(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),a},"get")}),r}i(Qi,"buildWrappedEvent");var Qn=Symbol.for("_ethersInternal_contract"),Vo=new WeakMap;function qi(n,t){Vo.set(n[Qn],t)}i(qi,"setInternal");function pt(n){return Vo.get(n[Qn])}i(pt,"getInternal");function tc(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}i(tc,"isDeferred");async function Ma(n,t){let e,r=null;if(Array.isArray(t)){let s=i(function(o){if(Y(o,32))return o;let l=n.interface.getEvent(o);return m(l,"unknown fragment","name",o),l.topicHash},"topicHashify");e=t.map(o=>o==null?null:Array.isArray(o)?o.map(s):s(o))}else t==="*"?e=[null]:typeof t=="string"?Y(t,32)?e=[t]:(r=n.interface.getEvent(t),m(r,"unknown fragment","event",t),e=[r.topicHash]):tc(t)?e=await t.getTopicFilter():"fragment"in t?(r=t.fragment,e=[r.topicHash]):m(!1,"unknown event name","event",t);e=e.map(s=>{if(s==null)return null;if(Array.isArray(s)){let o=Array.from(new Set(s.map(l=>l.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return s.toLowerCase()});let a=e.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:r,tag:a,topics:e}}i(Ma,"getSubInfo");async function fr(n,t){let{subs:e}=pt(n);return e.get((await Ma(n,t)).tag)||null}i(fr,"hasSub");async function So(n,t,e){let r=pe(n.runner);w(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:t});let{fragment:a,tag:s,topics:o}=await Ma(n,e),{addr:l,subs:u}=pt(n),p=u.get(s);if(!p){let f={address:l||n,topics:o},h=i(S=>{let R=a;if(R==null)try{R=n.interface.getEvent(S.topics[0])}catch{}if(R){let H=R,M=a?n.interface.decodeEventLog(a,S.data,S.topics):[];Va(n,e,M,Mt=>new dr(n,Mt,e,H,S))}else Va(n,e,[],H=>new _e(n,H,e,S))},"listener"),C=[];p={tag:s,listeners:[],start:i(()=>{C.length||C.push(r.on(f,h))},"start"),stop:i(async()=>{if(C.length==0)return;let S=C;C=[],await Promise.all(S),r.off(f,h)},"stop")},u.set(s,p)}return p}i(So,"getSub");var Ua=Promise.resolve();async function ec(n,t,e,r){await Ua;let a=await fr(n,t);if(!a)return!1;let s=a.listeners.length;return a.listeners=a.listeners.filter(({listener:o,once:l})=>{let u=Array.from(e);r&&u.push(r(l?null:o));try{o.call(n,...u)}catch{}return!l}),a.listeners.length===0&&(a.stop(),pt(n).subs.delete(a.tag)),s>0}i(ec,"_emit");async function Va(n,t,e,r){try{await Ua}catch{}let a=ec(n,t,e,r);return Ua=a,await a}i(Va,"emit");var Yn=["then"],fe=class n{static{i(this,"BaseContract")}target;interface;runner;filters;[Qn];fallback;constructor(t,e,r,a){m(typeof t=="string"||Dn(t),"invalid value for Contract target","target",t),r==null&&(r=null);let s=St.from(e);v(this,{target:t,runner:r,interface:s}),Object.defineProperty(this,Qn,{value:{}});let o,l=null,u=null;if(a){let f=pe(r);u=new ue(this.interface,f,a)}let p=new Map;if(typeof t=="string")if(Y(t))l=t,o=Promise.resolve(t);else{let f=de(r,"resolveName");if(!qn(f))throw Bt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(t).then(h=>{if(h==null)throw Bt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return pt(this).addr=h,h})}else o=t.getAddress().then(f=>{if(f==null)throw new Error("TODO");return pt(this).addr=f,f});qi(this,{addrPromise:o,addr:l,deployTx:u,subs:p});let d=new Proxy({},{get:i((f,h,C)=>{if(typeof h=="symbol"||Yn.indexOf(h)>=0)return Reflect.get(f,h,C);try{return this.getEvent(h)}catch(E){if(!wt(E,"INVALID_ARGUMENT")||E.argument!=="key")throw E}},"get"),has:i((f,h)=>Yn.indexOf(h)>=0?Reflect.has(f,h):Reflect.has(f,h)||this.interface.hasEvent(String(h)),"has")});return v(this,{filters:d}),v(this,{fallback:s.receive||s.fallback?Zi(this):null}),new Proxy(this,{get:i((f,h,C)=>{if(typeof h=="symbol"||h in f||Yn.indexOf(h)>=0)return Reflect.get(f,h,C);try{return f.getFunction(h)}catch(E){if(!wt(E,"INVALID_ARGUMENT")||E.argument!=="key")throw E}},"get"),has:i((f,h)=>typeof h=="symbol"||h in f||Yn.indexOf(h)>=0?Reflect.has(f,h):f.interface.hasFunction(h),"has")})}connect(t){return new n(this.target,this.interface,t)}attach(t){return new n(t,this.interface,this.runner)}async getAddress(){return await pt(this).addrPromise}async getDeployedCode(){let t=pe(this.runner);w(t,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});let e=await t.getCode(await this.getAddress());return e==="0x"?null:e}async waitForDeployment(){let t=this.deploymentTransaction();if(t)return await t.wait(),this;if(await this.getDeployedCode()!=null)return this;let r=pe(this.runner);return w(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((a,s)=>{let o=i(async()=>{try{if(await this.getDeployedCode()!=null)return a(this);r.once("block",o)}catch(l){s(l)}},"checkCode");o()})}deploymentTransaction(){return pt(this).deployTx}getFunction(t){return typeof t!="string"&&(t=t.format()),Yi(this,t)}getEvent(t){return typeof t!="string"&&(t=t.format()),Qi(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,r){e==null&&(e=0),r==null&&(r="latest");let{addr:a,addrPromise:s}=pt(this),o=a||await s,{fragment:l,topics:u}=await Ma(this,t),p={address:o,topics:u,fromBlock:e,toBlock:r},d=pe(this.runner);return w(d,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await d.getLogs(p)).map(f=>{let h=l;if(h==null)try{h=this.interface.getEvent(f.topics[0])}catch{}if(h)try{return new le(f,this.interface,h)}catch(C){return new De(f,C)}return new Qt(f,d)})}async on(t,e){let r=await So(this,"on",t);return r.listeners.push({listener:e,once:!1}),r.start(),this}async once(t,e){let r=await So(this,"once",t);return r.listeners.push({listener:e,once:!0}),r.start(),this}async emit(t,...e){return await Va(this,t,e,null)}async listenerCount(t){if(t){let a=await fr(this,t);return a?a.listeners.length:0}let{subs:e}=pt(this),r=0;for(let{listeners:a}of e.values())r+=a.length;return r}async listeners(t){if(t){let a=await fr(this,t);return a?a.listeners.map(({listener:s})=>s):[]}let{subs:e}=pt(this),r=[];for(let{listeners:a}of e.values())r=r.concat(a.map(({listener:s})=>s));return r}async off(t,e){let r=await fr(this,t);if(!r)return this;if(e){let a=r.listeners.map(({listener:s})=>s).indexOf(e);a>=0&&r.listeners.splice(a,1)}return(e==null||r.listeners.length===0)&&(r.stop(),pt(this).subs.delete(r.tag)),this}async removeAllListeners(t){if(t){let e=await fr(this,t);if(!e)return this;e.stop(),pt(this).subs.delete(e.tag)}else{let{subs:e}=pt(this);for(let{tag:r,stop:a}of e.values())a(),e.delete(r)}return this}async addListener(t,e){return await this.on(t,e)}async removeListener(t,e){return await this.off(t,e)}static buildClass(t){class e extends n{static{i(this,"CustomContract")}constructor(a,s=null){super(a,t,s)}}return e}static from(t,e,r){return r==null&&(r=null),new this(t,e,r)}};function rc(){return fe}i(rc,"_ContractBase");var Le=class extends rc(){static{i(this,"Contract")}};var Mo=BigInt(0);function B(n,t){return function(e){return e==null?t:n(e)}}i(B,"allowNull");function He(n,t){return e=>{if(t&&e==null)return null;if(!Array.isArray(e))throw new Error("not an array");return e.map(r=>n(r))}}i(He,"arrayOf");function he(n,t){return e=>{let r={};for(let a in n){let s=a;if(t&&a in t&&!(s in e)){for(let o of t[a])if(o in e){s=o;break}}try{let o=n[a](e[s]);o!==void 0&&(r[a]=o)}catch(o){let l=o instanceof Error?o.message:"not-an-error";w(!1,`invalid value for value.${a} (${l})`,"BAD_DATA",{value:e})}}return r}}i(he,"object");function nc(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}m(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}i(nc,"formatBoolean");function qt(n){return m(Y(n,!0),"invalid data","value",n),n}i(qt,"formatData");function tt(n){return m(Y(n,32),"invalid hash","value",n),n}i(tt,"formatHash");var ac=he({address:$,blockHash:tt,blockNumber:_,data:qt,index:_,removed:B(nc,!1),topics:He(tt),transactionHash:tt,transactionIndex:_},{index:["logIndex"]});function Go(n){return ac(n)}i(Go,"formatLog");var sc=he({hash:B(tt),parentHash:tt,parentBeaconBlockRoot:B(tt,null),number:_,timestamp:_,nonce:B(qt),difficulty:I,gasLimit:I,gasUsed:I,stateRoot:B(tt,null),receiptsRoot:B(tt,null),blobGasUsed:B(I,null),excessBlobGas:B(I,null),miner:B($),prevRandao:B(tt,null),extraData:qt,baseFeePerGas:B(I)},{prevRandao:["mixHash"]});function $o(n){let t=sc(n);return t.transactions=n.transactions.map(e=>typeof e=="string"?e:$a(e)),t}i($o,"formatBlock");var oc=he({transactionIndex:_,blockNumber:_,transactionHash:tt,address:$,topics:He(tt),data:qt,index:_,blockHash:tt},{index:["logIndex"]});function Ga(n){return oc(n)}i(Ga,"formatReceiptLog");var Id=he({to:B($,null),from:B($,null),contractAddress:B($,null),index:_,root:B(D),gasUsed:I,blobGasUsed:B(I,null),logsBloom:B(qt),blockHash:tt,hash:tt,logs:He(Ga),blockNumber:_,cumulativeGasUsed:I,effectiveGasPrice:B(I),blobGasPrice:B(I,null),status:B(_),type:B(_,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function $a(n){n.to&&I(n.to)===Mo&&(n.to="0x0000000000000000000000000000000000000000");let t=he({hash:tt,index:B(_,void 0),type:i(e=>e==="0x"||e==null?0:_(e),"type"),accessList:B(or,null),blobVersionedHashes:B(He(tt,!0),null),blockHash:B(tt,null),blockNumber:B(_,null),transactionIndex:B(_,null),from:$,gasPrice:B(I),maxPriorityFeePerGas:B(I),maxFeePerGas:B(I),maxFeePerBlobGas:B(I,null),gasLimit:I,to:B($,null),value:I,nonce:_,data:qt,creates:B($,null),chainId:B(I,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(t.to==null&&t.creates==null&&(t.creates=Oa(t)),(n.type===1||n.type===2)&&n.accessList==null&&(t.accessList=[]),n.signature?t.signature=Be.from(n.signature):t.signature=Be.from(n),t.chainId==null){let e=t.signature.legacyChainId;e!=null&&(t.chainId=e)}return t.blockHash&&I(t.blockHash)===Mo&&(t.blockHash=null),t}i($a,"formatTransactionResponse");var hr=class extends Error{static{i(this,"SimpleEthersError")}e;constructor(t,e,r){super(t),this.stack=r}toString(){return this.message+`
|
|
2
|
+
import{a as Rt,b as Ze}from"./chunk-4WNGQ3EZ.js";import{a as Xe}from"./chunk-IVMOWPFA.js";import{B as it,Db as Ee,Dd as Ke,Gb as re,Td as xa,U as Ca,da as gs,ma as ct,ne as ys,se as Tn,ue as we,y as ya}from"./chunk-VLD3QNSH.js";import{a as i,d as ni,e as ms,f as At}from"./chunk-G5BIPHMS.js";var zo=ni((qd,ta)=>{"use strict";(function(){"use strict";var n="input is invalid type",t="finalize already called",e=typeof window=="object",r=e?window:{};r.JS_SHA3_NO_WINDOW&&(e=!1);var a=!e&&typeof self=="object",s=!r.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?r=global:a&&(r=self);for(var o=!r.JS_SHA3_NO_COMMON_JS&&typeof ta=="object"&&ta.exports,l=typeof define=="function"&&define.amd,u=!r.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",p="0123456789abcdef".split(""),d=[31,7936,2031616,520093696],f=[4,1024,262144,67108864],h=[1,256,65536,16777216],C=[6,1536,393216,100663296],E=[0,8,16,24],A=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],S=[224,256,384,512],R=[128,256],H=["hex","buffer","arrayBuffer","array","digest"],M={128:168,256:136},Mt=r.JS_SHA3_NO_NODE_JS||!Array.isArray?function(c){return Object.prototype.toString.call(c)==="[object Array]"}:Array.isArray,ee=u&&(r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(c){return typeof c=="object"&&c.buffer&&c.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,fa=i(function(c){var g=typeof c;if(g==="string")return[c,!0];if(g!=="object"||c===null)throw new Error(n);if(u&&c.constructor===ArrayBuffer)return[new Uint8Array(c),!1];if(!Mt(c)&&!ee(c))throw new Error(n);return[c,!1]},"formatMessage"),is=i(function(c){return fa(c)[0].length===0},"empty"),ha=i(function(c){for(var g=[],y=0;y<c.length;++y)g[y]=c[y];return g},"cloneArray"),cs=i(function(c,g,y){return function(x){return new X(c,g,c).update(x)[y]()}},"createOutputMethod"),ls=i(function(c,g,y){return function(x,T){return new X(c,g,T).update(x)[y]()}},"createShakeOutputMethod"),us=i(function(c,g,y){return function(x,T,P,O){return kt["cshake"+c].update(x,T,P,O)[y]()}},"createCshakeOutputMethod"),ps=i(function(c,g,y){return function(x,T,P,O){return kt["kmac"+c].update(x,T,P,O)[y]()}},"createKmacOutputMethod"),Er=i(function(c,g,y,x){for(var T=0;T<H.length;++T){var P=H[T];c[P]=g(y,x,P)}return c},"createOutputMethods"),ds=i(function(c,g){var y=cs(c,g,"hex");return y.create=function(){return new X(c,g,c)},y.update=function(x){return y.create().update(x)},Er(y,cs,c,g)},"createMethod"),ti=i(function(c,g){var y=ls(c,g,"hex");return y.create=function(x){return new X(c,g,x)},y.update=function(x,T){return y.create(T).update(x)},Er(y,ls,c,g)},"createShakeMethod"),ei=i(function(c,g){var y=M[c],x=us(c,g,"hex");return x.create=function(T,P,O){return is(P)&&is(O)?kt["shake"+c].create(T):new X(c,g,T).bytepad([P,O],y)},x.update=function(T,P,O,k){return x.create(P,O,k).update(T)},Er(x,us,c,g)},"createCshakeMethod"),ri=i(function(c,g){var y=M[c],x=ps(c,g,"hex");return x.create=function(T,P,O){return new ga(c,g,P).bytepad(["KMAC",O],y).bytepad([T],y)},x.update=function(T,P,O,k){return x.create(T,O,k).update(P)},Er(x,ps,c,g)},"createKmacMethod"),fs=[{name:"keccak",padding:h,bits:S,createMethod:ds},{name:"sha3",padding:C,bits:S,createMethod:ds},{name:"shake",padding:d,bits:R,createMethod:ti},{name:"cshake",padding:f,bits:R,createMethod:ei},{name:"kmac",padding:f,bits:R,createMethod:ri}],kt={},ze=[],Gt=0;Gt<fs.length;++Gt)for(var be=fs[Gt],wr=be.bits,Je=0;Je<wr.length;++Je){var ma=be.name+"_"+wr[Je];if(ze.push(ma),kt[ma]=be.createMethod(wr[Je],be.padding),be.name!=="sha3"){var hs=be.name+wr[Je];ze.push(hs),kt[hs]=kt[ma]}}function X(c,g,y){this.blocks=[],this.s=[],this.padding=g,this.outputBits=y,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(c<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=y>>5,this.extraBytes=(y&31)>>3;for(var x=0;x<50;++x)this.s[x]=0}i(X,"Keccak"),X.prototype.update=function(c){if(this.finalized)throw new Error(t);var g=fa(c);c=g[0];for(var y=g[1],x=this.blocks,T=this.byteCount,P=c.length,O=this.blockCount,k=0,Z=this.s,N,K;k<P;){if(this.reset)for(this.reset=!1,x[0]=this.block,N=1;N<O+1;++N)x[N]=0;if(y)for(N=this.start;k<P&&N<T;++k)K=c.charCodeAt(k),K<128?x[N>>2]|=K<<E[N++&3]:K<2048?(x[N>>2]|=(192|K>>6)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]):K<55296||K>=57344?(x[N>>2]|=(224|K>>12)<<E[N++&3],x[N>>2]|=(128|K>>6&63)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]):(K=65536+((K&1023)<<10|c.charCodeAt(++k)&1023),x[N>>2]|=(240|K>>18)<<E[N++&3],x[N>>2]|=(128|K>>12&63)<<E[N++&3],x[N>>2]|=(128|K>>6&63)<<E[N++&3],x[N>>2]|=(128|K&63)<<E[N++&3]);else for(N=this.start;k<P&&N<T;++k)x[N>>2]|=c[k]<<E[N++&3];if(this.lastByteIndex=N,N>=T){for(this.start=N-T,this.block=x[O],N=0;N<O;++N)Z[N]^=x[N];We(Z),this.reset=!0}else this.start=N}return this},X.prototype.encode=function(c,g){var y=c&255,x=1,T=[y];for(c=c>>8,y=c&255;y>0;)T.unshift(y),c=c>>8,y=c&255,++x;return g?T.push(x):T.unshift(x),this.update(T),T.length},X.prototype.encodeString=function(c){var g=fa(c);c=g[0];var y=g[1],x=0,T=c.length;if(y)for(var P=0;P<c.length;++P){var O=c.charCodeAt(P);O<128?x+=1:O<2048?x+=2:O<55296||O>=57344?x+=3:(O=65536+((O&1023)<<10|c.charCodeAt(++P)&1023),x+=4)}else x=T;return x+=this.encode(x*8),this.update(c),x},X.prototype.bytepad=function(c,g){for(var y=this.encode(g),x=0;x<c.length;++x)y+=this.encodeString(c[x]);var T=(g-y%g)%g,P=[];return P.length=T,this.update(P),this},X.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var c=this.blocks,g=this.lastByteIndex,y=this.blockCount,x=this.s;if(c[g>>2]|=this.padding[g&3],this.lastByteIndex===this.byteCount)for(c[0]=c[y],g=1;g<y+1;++g)c[g]=0;for(c[y-1]|=2147483648,g=0;g<y;++g)x[g]^=c[g];We(x)}},X.prototype.toString=X.prototype.hex=function(){this.finalize();for(var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O="",k;P<y;){for(T=0;T<c&&P<y;++T,++P)k=g[T],O+=p[k>>4&15]+p[k&15]+p[k>>12&15]+p[k>>8&15]+p[k>>20&15]+p[k>>16&15]+p[k>>28&15]+p[k>>24&15];P%c===0&&(g=ha(g),We(g),T=0)}return x&&(k=g[T],O+=p[k>>4&15]+p[k&15],x>1&&(O+=p[k>>12&15]+p[k>>8&15]),x>2&&(O+=p[k>>20&15]+p[k>>16&15])),O},X.prototype.arrayBuffer=function(){this.finalize();var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O=this.outputBits>>3,k;x?k=new ArrayBuffer(y+1<<2):k=new ArrayBuffer(O);for(var Z=new Uint32Array(k);P<y;){for(T=0;T<c&&P<y;++T,++P)Z[P]=g[T];P%c===0&&(g=ha(g),We(g))}return x&&(Z[P]=g[T],k=k.slice(0,O)),k},X.prototype.buffer=X.prototype.arrayBuffer,X.prototype.digest=X.prototype.array=function(){this.finalize();for(var c=this.blockCount,g=this.s,y=this.outputBlocks,x=this.extraBytes,T=0,P=0,O=[],k,Z;P<y;){for(T=0;T<c&&P<y;++T,++P)k=P<<2,Z=g[T],O[k]=Z&255,O[k+1]=Z>>8&255,O[k+2]=Z>>16&255,O[k+3]=Z>>24&255;P%c===0&&(g=ha(g),We(g))}return x&&(k=P<<2,Z=g[T],O[k]=Z&255,x>1&&(O[k+1]=Z>>8&255),x>2&&(O[k+2]=Z>>16&255)),O};function ga(c,g,y){X.call(this,c,g,y)}i(ga,"Kmac"),ga.prototype=new X,ga.prototype.finalize=function(){return this.encode(this.outputBits,!0),X.prototype.finalize.call(this)};var We=i(function(c){var g,y,x,T,P,O,k,Z,N,K,Tr,vr,Pr,kr,Ar,Rr,Ir,Or,Br,Nr,Fr,Sr,Dr,_r,Lr,Hr,Ur,Vr,Mr,Gr,$r,jr,zr,Jr,Wr,Kr,Xr,Zr,Yr,Qr,qr,tn,en,rn,nn,an,sn,on,cn,ln,un,pn,dn,fn,hn,mn,gn,yn,Cn,xn,bn,En,wn;for(x=0;x<48;x+=2)T=c[0]^c[10]^c[20]^c[30]^c[40],P=c[1]^c[11]^c[21]^c[31]^c[41],O=c[2]^c[12]^c[22]^c[32]^c[42],k=c[3]^c[13]^c[23]^c[33]^c[43],Z=c[4]^c[14]^c[24]^c[34]^c[44],N=c[5]^c[15]^c[25]^c[35]^c[45],K=c[6]^c[16]^c[26]^c[36]^c[46],Tr=c[7]^c[17]^c[27]^c[37]^c[47],vr=c[8]^c[18]^c[28]^c[38]^c[48],Pr=c[9]^c[19]^c[29]^c[39]^c[49],g=vr^(O<<1|k>>>31),y=Pr^(k<<1|O>>>31),c[0]^=g,c[1]^=y,c[10]^=g,c[11]^=y,c[20]^=g,c[21]^=y,c[30]^=g,c[31]^=y,c[40]^=g,c[41]^=y,g=T^(Z<<1|N>>>31),y=P^(N<<1|Z>>>31),c[2]^=g,c[3]^=y,c[12]^=g,c[13]^=y,c[22]^=g,c[23]^=y,c[32]^=g,c[33]^=y,c[42]^=g,c[43]^=y,g=O^(K<<1|Tr>>>31),y=k^(Tr<<1|K>>>31),c[4]^=g,c[5]^=y,c[14]^=g,c[15]^=y,c[24]^=g,c[25]^=y,c[34]^=g,c[35]^=y,c[44]^=g,c[45]^=y,g=Z^(vr<<1|Pr>>>31),y=N^(Pr<<1|vr>>>31),c[6]^=g,c[7]^=y,c[16]^=g,c[17]^=y,c[26]^=g,c[27]^=y,c[36]^=g,c[37]^=y,c[46]^=g,c[47]^=y,g=K^(T<<1|P>>>31),y=Tr^(P<<1|T>>>31),c[8]^=g,c[9]^=y,c[18]^=g,c[19]^=y,c[28]^=g,c[29]^=y,c[38]^=g,c[39]^=y,c[48]^=g,c[49]^=y,kr=c[0],Ar=c[1],an=c[11]<<4|c[10]>>>28,sn=c[10]<<4|c[11]>>>28,Vr=c[20]<<3|c[21]>>>29,Mr=c[21]<<3|c[20]>>>29,xn=c[31]<<9|c[30]>>>23,bn=c[30]<<9|c[31]>>>23,tn=c[40]<<18|c[41]>>>14,en=c[41]<<18|c[40]>>>14,Jr=c[2]<<1|c[3]>>>31,Wr=c[3]<<1|c[2]>>>31,Rr=c[13]<<12|c[12]>>>20,Ir=c[12]<<12|c[13]>>>20,on=c[22]<<10|c[23]>>>22,cn=c[23]<<10|c[22]>>>22,Gr=c[33]<<13|c[32]>>>19,$r=c[32]<<13|c[33]>>>19,En=c[42]<<2|c[43]>>>30,wn=c[43]<<2|c[42]>>>30,fn=c[5]<<30|c[4]>>>2,hn=c[4]<<30|c[5]>>>2,Kr=c[14]<<6|c[15]>>>26,Xr=c[15]<<6|c[14]>>>26,Or=c[25]<<11|c[24]>>>21,Br=c[24]<<11|c[25]>>>21,ln=c[34]<<15|c[35]>>>17,un=c[35]<<15|c[34]>>>17,jr=c[45]<<29|c[44]>>>3,zr=c[44]<<29|c[45]>>>3,_r=c[6]<<28|c[7]>>>4,Lr=c[7]<<28|c[6]>>>4,mn=c[17]<<23|c[16]>>>9,gn=c[16]<<23|c[17]>>>9,Zr=c[26]<<25|c[27]>>>7,Yr=c[27]<<25|c[26]>>>7,Nr=c[36]<<21|c[37]>>>11,Fr=c[37]<<21|c[36]>>>11,pn=c[47]<<24|c[46]>>>8,dn=c[46]<<24|c[47]>>>8,rn=c[8]<<27|c[9]>>>5,nn=c[9]<<27|c[8]>>>5,Hr=c[18]<<20|c[19]>>>12,Ur=c[19]<<20|c[18]>>>12,yn=c[29]<<7|c[28]>>>25,Cn=c[28]<<7|c[29]>>>25,Qr=c[38]<<8|c[39]>>>24,qr=c[39]<<8|c[38]>>>24,Sr=c[48]<<14|c[49]>>>18,Dr=c[49]<<14|c[48]>>>18,c[0]=kr^~Rr&Or,c[1]=Ar^~Ir&Br,c[10]=_r^~Hr&Vr,c[11]=Lr^~Ur&Mr,c[20]=Jr^~Kr&Zr,c[21]=Wr^~Xr&Yr,c[30]=rn^~an&on,c[31]=nn^~sn&cn,c[40]=fn^~mn&yn,c[41]=hn^~gn&Cn,c[2]=Rr^~Or&Nr,c[3]=Ir^~Br&Fr,c[12]=Hr^~Vr&Gr,c[13]=Ur^~Mr&$r,c[22]=Kr^~Zr&Qr,c[23]=Xr^~Yr&qr,c[32]=an^~on&ln,c[33]=sn^~cn&un,c[42]=mn^~yn&xn,c[43]=gn^~Cn&bn,c[4]=Or^~Nr&Sr,c[5]=Br^~Fr&Dr,c[14]=Vr^~Gr&jr,c[15]=Mr^~$r&zr,c[24]=Zr^~Qr&tn,c[25]=Yr^~qr&en,c[34]=on^~ln&pn,c[35]=cn^~un&dn,c[44]=yn^~xn&En,c[45]=Cn^~bn&wn,c[6]=Nr^~Sr&kr,c[7]=Fr^~Dr&Ar,c[16]=Gr^~jr&_r,c[17]=$r^~zr&Lr,c[26]=Qr^~tn&Jr,c[27]=qr^~en&Wr,c[36]=ln^~pn&rn,c[37]=un^~dn&nn,c[46]=xn^~En&fn,c[47]=bn^~wn&hn,c[8]=Sr^~kr&Rr,c[9]=Dr^~Ar&Ir,c[18]=jr^~_r&Hr,c[19]=zr^~Lr&Ur,c[28]=tn^~Jr&Kr,c[29]=en^~Wr&Xr,c[38]=pn^~rn&an,c[39]=dn^~nn&sn,c[48]=En^~fn&mn,c[49]=wn^~hn&gn,c[0]^=A[x],c[1]^=A[x+1]},"f");if(o)ta.exports=kt;else{for(Gt=0;Gt<ze.length;++Gt)r[ze[Gt]]=kt[ze[Gt]];l&&define(function(){return kt})}})()});var Ac={};ms(Ac,{ERC721BoundContractView:()=>br,ERC721ContractView:()=>da,ERC721Processor:()=>Ut,ERC721ProcessorTemplate:()=>ss,ERC721__factory:()=>Pt,getERC721Contract:()=>xe,getERC721ContractOnContext:()=>Tc,mockApprovalForAllLog:()=>Pc,mockApprovalLog:()=>vc,mockTransferLog:()=>kc});var $t=class extends ys{static{i(this,"EthContext")}chainId;address;log;block;trace;blockNumber;transactionHash;transaction;transactionReceipt;timestamp;preparedData;constructor(t,e,r,a,s,o,l,u,p,d){super(p),this.chainId=t,this.log=s,this.block=a,this.trace=o,this.address=e.toLowerCase(),this.transaction=l,this.transactionReceipt=u,this.timestamp=r||new Date(0),this.preparedData=d,s?(this.blockNumber=s.blockNumber,this.transactionHash=s.transactionHash):a?this.blockNumber=a.number:o&&(this.blockNumber=o.blockNumber,this.transactionHash=o.transactionHash)}getChainId(){return this.chainId}getMetaDataInternal(t,e){if(this.log)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.log.transactionIndex,transactionHash:this.transactionHash||"",logIndex:this.log.index,chainId:this.chainId,name:t,labels:Ke(e)};if(this.trace)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.trace.transactionPosition,transactionHash:this.transactionHash||"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};if(this.transaction)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:this.transaction.index||0,transactionHash:this.transaction.hash||"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};if(this.block)return{address:this.address,contractName:this.getContractName(),blockNumber:BigInt(this.blockNumber),transactionIndex:-1,transactionHash:"",logIndex:-1,chainId:this.chainId.toString(),name:t,labels:Ke(e)};throw new Error("Invaid ctx argument can't happen")}getBlockTag(t){let e="0x"+this.blockNumber.toString(16);return t?.blockTag&&(e=typeof t.blockTag=="string"?t.blockTag:"0x"+t.blockTag.toString(16)),e}getEthCallContext(){return{chainId:this.chainId,blockTag:"0x"+this.blockNumber.toString(16),address:this.address}}},Te=class extends $t{static{i(this,"AccountContext")}getContractName(){return"account"}},bt=class extends $t{static{i(this,"GlobalContext")}constructor(t,e,r,a,s,o,l,u,p,d){super(t,e,r,a,s,o,l,u,p,d)}getContractName(){return"*"}getMetaDataInternal(t,e){let r=this.address;this.address="*";let a=super.getMetaDataInternal(t,e);return this.address=r,a}},Et=class extends $t{static{i(this,"ContractContext")}contract;contractName;constructor(t,e,r,a,s,o,l,u,p,d,f){super(r,e.address,a,s,o,l,u,p,d,f),e.context=this,e.callStatic&&(e.callStatic.context=this),e.encodeCall&&(e.encodeCall.context=this),this.contractName=t,this.contract=e}getContractName(){return this.contractName}},It=class{constructor(t){this.contract=t}static{i(this,"ContractView")}get rawContract(){return this.contract}get provider(){if(this.contract.runner?.provider)return this.contract.runner.provider;throw Error("Can't find provider for contract"+this.contract.toString())}},Ot=class{static{i(this,"BoundContractView")}view;address;context;callStatic;encodeCall;constructor(t,e){this.address=t,this.view=e}get rawContract(){return this.view.rawContract}get provider(){return this.view.provider}get filters(){return this.view.rawContract.filters}};import("node:process").then(n=>n.stdout.write(""));var j=At(xa(),1);var Cs="6.13.1";function ai(n,t,e){let r=t.split("|").map(s=>s.trim());for(let s=0;s<r.length;s++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof n===t)return}let a=new Error(`invalid value for type ${t}`);throw a.code="INVALID_ARGUMENT",a.argument=`value.${e}`,a.value=n,a}i(ai,"checkType");async function ve(n){let t=Object.keys(n);return(await Promise.all(t.map(r=>Promise.resolve(n[r])))).reduce((r,a,s)=>(r[t[s]]=a,r),{})}i(ve,"resolveProperties");function v(n,t,e){for(let r in t){let a=t[r],s=e?e[r]:null;s&&ai(a,s,r),Object.defineProperty(n,r,{enumerable:!0,value:a,writable:!1})}}i(v,"defineProperties");function Pe(n){if(n==null)return"null";if(Array.isArray(n))return"[ "+n.map(Pe).join(", ")+" ]";if(n instanceof Uint8Array){let t="0123456789abcdef",e="0x";for(let r=0;r<n.length;r++)e+=t[n[r]>>4],e+=t[n[r]&15];return e}if(typeof n=="object"&&typeof n.toJSON=="function")return Pe(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"number":return n.toString();case"string":return JSON.stringify(n);case"object":{let t=Object.keys(n);return t.sort(),"{ "+t.map(e=>`${Pe(e)}: ${Pe(n[e])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}i(Pe,"stringify");function wt(n,t){return n&&n.code===t}i(wt,"isError");function vn(n){return wt(n,"CALL_EXCEPTION")}i(vn,"isCallException");function Bt(n,t,e){let r=n;{let s=[];if(e){if("message"in e||"code"in e||"name"in e)throw new Error(`value will overwrite populated values: ${Pe(e)}`);for(let o in e){if(o==="shortMessage")continue;let l=e[o];s.push(o+"="+Pe(l))}}s.push(`code=${t}`),s.push(`version=${Cs}`),s.length&&(n+=" ("+s.join(", ")+")")}let a;switch(t){case"INVALID_ARGUMENT":a=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":a=new RangeError(n);break;default:a=new Error(n)}return v(a,{code:t}),e&&Object.assign(a,e),a.shortMessage==null&&v(a,{shortMessage:r}),a}i(Bt,"makeError");function w(n,t,e,r){if(!n)throw Bt(t,e,r)}i(w,"assert");function m(n,t,e,r){w(n,t,"INVALID_ARGUMENT",{argument:e,value:r})}i(m,"assertArgument");function Ye(n,t,e){e==null&&(e=""),e&&(e=": "+e),w(n>=t,"missing arguemnt"+e,"MISSING_ARGUMENT",{count:n,expectedCount:t}),w(n<=t,"too many arguments"+e,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:t})}i(Ye,"assertArgumentCount");var si=["NFD","NFC","NFKD","NFKC"].reduce((n,t)=>{try{if("test".normalize(t)!=="test")throw new Error("bad");if(t==="NFD"&&"\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken");n.push(t)}catch{}return n},[]);function ba(n){w(si.indexOf(n)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:n}})}i(ba,"assertNormalize");function jt(n,t,e){if(e==null&&(e=""),n!==t){let r=e,a="new";e&&(r+=".",a+=" "+e),w(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:a})}}i(jt,"assertPrivate");function bs(n,t,e){if(n instanceof Uint8Array)return e?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){let r=new Uint8Array((n.length-2)/2),a=2;for(let s=0;s<r.length;s++)r[s]=parseInt(n.substring(a,a+2),16),a+=2;return r}m(!1,"invalid BytesLike value",t||"value",n)}i(bs,"_getBytes");function z(n,t){return bs(n,t,!1)}i(z,"getBytes");function nt(n,t){return bs(n,t,!0)}i(nt,"getBytesCopy");function Y(n,t){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof t=="number"&&n.length!==2+2*t||t===!0&&n.length%2!==0)}i(Y,"isHexString");function Ea(n){return Y(n,!0)||n instanceof Uint8Array}i(Ea,"isBytesLike");var xs="0123456789abcdef";function D(n){let t=z(n),e="0x";for(let r=0;r<t.length;r++){let a=t[r];e+=xs[(a&240)>>4]+xs[a&15]}return e}i(D,"hexlify");function lt(n){return"0x"+n.map(t=>D(t).substring(2)).join("")}i(lt,"concat");function Pn(n){return Y(n,!0)?(n.length-2)/2:z(n).length}i(Pn,"dataLength");function Tt(n,t,e){let r=z(n);return e!=null&&e>r.length&&w(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:e}),D(r.slice(t??0,e??r.length))}i(Tt,"dataSlice");function Es(n,t,e){let r=z(n);w(t>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:t,offset:t+1});let a=new Uint8Array(t);return a.fill(0),e?a.set(r,t-r.length):a.set(r,0),D(a)}i(Es,"zeroPad");function ke(n,t){return Es(n,t,!0)}i(ke,"zeroPadValue");function kn(n,t){return Es(n,t,!1)}i(kn,"zeroPadBytes");var An=BigInt(0),gt=BigInt(1),Ae=9007199254740991;function wa(n,t){let e=Qe(n,"value"),r=BigInt(_(t,"width"));if(w(e>>r===An,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),e>>r-gt){let a=(gt<<r)-gt;return-((~e&a)+gt)}return e}i(wa,"fromTwos");function Ta(n,t){let e=I(n,"value"),r=BigInt(_(t,"width")),a=gt<<r-gt;if(e<An){e=-e,w(e<=a,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});let s=(gt<<r)-gt;return(~e&s)+gt}else w(e<a,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return e}i(Ta,"toTwos");function Re(n,t){let e=Qe(n,"value"),r=BigInt(_(t,"bits"));return e&(gt<<r)-gt}i(Re,"mask");function I(n,t){switch(typeof n){case"bigint":return n;case"number":return m(Number.isInteger(n),"underflow",t||"value",n),m(n>=-Ae&&n<=Ae,"overflow",t||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(e){m(!1,`invalid BigNumberish string: ${e.message}`,t||"value",n)}}m(!1,"invalid BigNumberish value",t||"value",n)}i(I,"getBigInt");function Qe(n,t){let e=I(n,t);return w(e>=An,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),e}i(Qe,"getUint");var ws="0123456789abcdef";function Rn(n){if(n instanceof Uint8Array){let t="0x0";for(let e of n)t+=ws[e>>4],t+=ws[e&15];return BigInt(t)}return I(n)}i(Rn,"toBigInt");function _(n,t){switch(typeof n){case"bigint":return m(n>=-Ae&&n<=Ae,"overflow",t||"value",n),Number(n);case"number":return m(Number.isInteger(n),"underflow",t||"value",n),m(n>=-Ae&&n<=Ae,"overflow",t||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return _(BigInt(n),t)}catch(e){m(!1,`invalid numeric string: ${e.message}`,t||"value",n)}}m(!1,"invalid numeric value",t||"value",n)}i(_,"getNumber");function va(n){return _(Rn(n))}i(va,"toNumber");function qe(n,t){let r=Qe(n,"value").toString(16);if(t==null)r.length%2&&(r="0"+r);else{let a=_(t,"width");for(w(a*2>=r.length,`value exceeds width (${a} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});r.length<a*2;)r="0"+r}return"0x"+r}i(qe,"toBeHex");function tr(n){let t=Qe(n,"value");if(t===An)return new Uint8Array([]);let e=t.toString(16);e.length%2&&(e="0"+e);let r=new Uint8Array(e.length/2);for(let a=0;a<r.length;a++){let s=a*2;r[a]=parseInt(e.substring(s,s+2),16)}return r}i(tr,"toBeArray");var er=class{static{i(this,"EventPayload")}filter;emitter;#t;constructor(t,e,r){this.#t=e,v(this,{emitter:t,filter:r})}async removeListener(){this.#t!=null&&await this.emitter.off(this.filter,this.#t)}};function oi(n,t,e,r,a){m(!1,`invalid codepoint at offset ${t}; ${n}`,"bytes",e)}i(oi,"errorFunc");function Ts(n,t,e,r,a){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let s=0;for(let o=t+1;o<e.length&&e[o]>>6===2;o++)s++;return s}return n==="OVERRUN"?e.length-t-1:0}i(Ts,"ignoreFunc");function ii(n,t,e,r,a){return n==="OVERLONG"?(m(typeof a=="number","invalid bad code point for replacement","badCodepoint",a),r.push(a),0):(r.push(65533),Ts(n,t,e,r,a))}i(ii,"replaceFunc");var vs=Object.freeze({error:oi,ignore:Ts,replace:ii});function ci(n,t){t==null&&(t=vs.error);let e=z(n,"bytes"),r=[],a=0;for(;a<e.length;){let s=e[a++];if(!(s>>7)){r.push(s);continue}let o=null,l=null;if((s&224)===192)o=1,l=127;else if((s&240)===224)o=2,l=2047;else if((s&248)===240)o=3,l=65535;else{(s&192)===128?a+=t("UNEXPECTED_CONTINUE",a-1,e,r):a+=t("BAD_PREFIX",a-1,e,r);continue}if(a-1+o>=e.length){a+=t("OVERRUN",a-1,e,r);continue}let u=s&(1<<8-o-1)-1;for(let p=0;p<o;p++){let d=e[a];if((d&192)!=128){a+=t("MISSING_CONTINUE",a,e,r),u=null;break}u=u<<6|d&63,a++}if(u!==null){if(u>1114111){a+=t("OUT_OF_RANGE",a-1-o,e,r,u);continue}if(u>=55296&&u<=57343){a+=t("UTF16_SURROGATE",a-1-o,e,r,u);continue}if(u<=l){a+=t("OVERLONG",a-1-o,e,r,u);continue}r.push(u)}}return r}i(ci,"getUtf8CodePoints");function Ie(n,t){m(typeof n=="string","invalid string value","str",n),t!=null&&(ba(t),n=n.normalize(t));let e=[];for(let r=0;r<n.length;r++){let a=n.charCodeAt(r);if(a<128)e.push(a);else if(a<2048)e.push(a>>6|192),e.push(a&63|128);else if((a&64512)==55296){r++;let s=n.charCodeAt(r);m(r<n.length&&(s&64512)===56320,"invalid surrogate pair","str",n);let o=65536+((a&1023)<<10)+(s&1023);e.push(o>>18|240),e.push(o>>12&63|128),e.push(o>>6&63|128),e.push(o&63|128)}else e.push(a>>12|224),e.push(a>>6&63|128),e.push(a&63|128)}return new Uint8Array(e)}i(Ie,"toUtf8Bytes");function li(n){return n.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}i(li,"_toUtf8String");function rr(n,t){return li(ci(n,t))}i(rr,"toUtf8String");function Ps(n){let t=[];for(;n;)t.unshift(n&255),n>>=8;return t}i(Ps,"arrayifyInteger");function As(n){if(Array.isArray(n)){let r=[];if(n.forEach(function(s){r=r.concat(As(s))}),r.length<=55)return r.unshift(192+r.length),r;let a=Ps(r.length);return a.unshift(247+a.length),a.concat(r)}let t=Array.prototype.slice.call(z(n,"object"));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;let e=Ps(t.length);return e.unshift(183+e.length),e.concat(t)}i(As,"_encode");var ks="0123456789abcdef";function Pa(n){let t="0x";for(let e of As(n))t+=ks[e>>4],t+=ks[e&15];return t}i(Pa,"encodeRlp");function ka(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}i(ka,"number");function Aa(n,...t){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(n.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${n.length}`)}i(Aa,"bytes");function Ra(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}i(Ra,"exists");function Rs(n,t){Aa(n);let e=t.outputLen;if(n.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}i(Rs,"output");var In=BigInt(4294967295),Is=BigInt(32);function ui(n,t=!1){return t?{h:Number(n&In),l:Number(n>>Is&In)}:{h:Number(n>>Is&In)|0,l:Number(n&In)|0}}i(ui,"fromBig");function Os(n,t=!1){let e=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let a=0;a<n.length;a++){let{h:s,l:o}=ui(n[a],t);[e[a],r[a]]=[s,o]}return[e,r]}i(Os,"split");var Bs=i((n,t,e)=>n<<e|t>>>32-e,"rotlSH"),Ns=i((n,t,e)=>t<<e|n>>>32-e,"rotlSL"),Fs=i((n,t,e)=>t<<e-32|n>>>64-e,"rotlBH"),Ss=i((n,t,e)=>n<<e-32|t>>>64-e,"rotlBL");var pi=i(n=>n instanceof Uint8Array,"u8a");var Ds=i(n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),"u32");var di=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!di)throw new Error("Non little-endian hardware is not supported");function fi(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}i(fi,"utf8ToBytes");function Bn(n){if(typeof n=="string"&&(n=fi(n)),!pi(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}i(Bn,"toBytes");var On=class{static{i(this,"Hash")}clone(){return this._cloneInto()}},yl={}.toString;function _s(n){let t=i(r=>n().update(Bn(r)).digest(),"hashC"),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}i(_s,"wrapConstructor");function Ls(n){let t=i((r,a)=>n(a).update(Bn(r)).digest(),"hashC"),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}i(Ls,"wrapXOFConstructorWithOpts");var[Vs,Ms,Gs]=[[],[],[]],hi=BigInt(0),nr=BigInt(1),mi=BigInt(2),gi=BigInt(7),yi=BigInt(256),Ci=BigInt(113);for(let n=0,t=nr,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],Vs.push(2*(5*r+e)),Ms.push((n+1)*(n+2)/2%64);let a=hi;for(let s=0;s<7;s++)t=(t<<nr^(t>>gi)*Ci)%yi,t&mi&&(a^=nr<<(nr<<BigInt(s))-nr);Gs.push(a)}var[xi,bi]=Os(Gs,!0),Hs=i((n,t,e)=>e>32?Fs(n,t,e):Bs(n,t,e),"rotlH"),Us=i((n,t,e)=>e>32?Ss(n,t,e):Ns(n,t,e),"rotlL");function Ei(n,t=24){let e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){let l=(o+8)%10,u=(o+2)%10,p=e[u],d=e[u+1],f=Hs(p,d,1)^e[l],h=Us(p,d,1)^e[l+1];for(let C=0;C<50;C+=10)n[o+C]^=f,n[o+C+1]^=h}let a=n[2],s=n[3];for(let o=0;o<24;o++){let l=Ms[o],u=Hs(a,s,l),p=Us(a,s,l),d=Vs[o];a=n[d],s=n[d+1],n[d]=u,n[d+1]=p}for(let o=0;o<50;o+=10){for(let l=0;l<10;l++)e[l]=n[o+l];for(let l=0;l<10;l++)n[o+l]^=~e[(l+2)%10]&e[(l+4)%10]}n[0]^=xi[r],n[1]^=bi[r]}e.fill(0)}i(Ei,"keccakP");var Nn=class n extends On{static{i(this,"Keccak")}constructor(t,e,r,a=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=a,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ka(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Ds(this.state)}keccak(){Ei(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){Ra(this);let{blockLen:e,state:r}=this;t=Bn(t);let a=t.length;for(let s=0;s<a;){let o=Math.min(e-this.pos,a-s);for(let l=0;l<o;l++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:r,blockLen:a}=this;t[r]^=e,e&128&&r===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){Ra(this,!1),Aa(t),this.finish();let e=this.state,{blockLen:r}=this;for(let a=0,s=t.length;a<s;){this.posOut>=r&&this.keccak();let o=Math.min(r-this.posOut,s-a);t.set(e.subarray(this.posOut,this.posOut+o),a),this.posOut+=o,a+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ka(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Rs(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:r,outputLen:a,rounds:s,enableXOF:o}=this;return t||(t=new n(e,r,a,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=a,t.enableXOF=o,t.destroyed=this.destroyed,t}},zt=i((n,t,e)=>_s(()=>new Nn(t,n,e)),"gen"),Tl=zt(6,144,224/8),vl=zt(6,136,256/8),Pl=zt(6,104,384/8),kl=zt(6,72,512/8),Al=zt(1,144,224/8),$s=zt(1,136,256/8),Rl=zt(1,104,384/8),Il=zt(1,72,512/8),js=i((n,t,e)=>Ls((r={})=>new Nn(t,n,r.dkLen===void 0?e:r.dkLen,!0)),"genShake"),Ol=js(31,168,128/8),Bl=js(31,136,256/8);var zs=!1,Js=i(function(n){return $s(n)},"_keccak256"),Ws=Js;function st(n){let t=z(n,"data");return D(Ws(t))}i(st,"keccak256");st._=Js;st.lock=function(){zs=!0};st.register=function(n){if(zs)throw new TypeError("keccak256 is locked");Ws=n};Object.freeze(st);var Fn="0x0000000000000000000000000000000000000000000000000000000000000000";var Ks=BigInt(0),Xs=BigInt(1),Zs=BigInt(2),Ys=BigInt(27),Qs=BigInt(28),Sn=BigInt(35),Oe={};function qs(n){return ke(tr(n),32)}i(qs,"toUint256");var Be=class n{static{i(this,"Signature")}#t;#e;#r;#n;get r(){return this.#t}set r(t){m(Pn(t)===32,"invalid r","value",t),this.#t=D(t)}get s(){return this.#e}set s(t){m(Pn(t)===32,"invalid s","value",t);let e=D(t);m(parseInt(e.substring(0,3))<8,"non-canonical s","value",e),this.#e=e}get v(){return this.#r}set v(t){let e=_(t,"value");m(e===27||e===28,"invalid v","v",t),this.#r=e}get networkV(){return this.#n}get legacyChainId(){let t=this.networkV;return t==null?null:n.getChainId(t)}get yParity(){return this.v===27?0:1}get yParityAndS(){let t=z(this.s);return this.yParity&&(t[0]|=128),D(t)}get compactSerialized(){return lt([this.r,this.yParityAndS])}get serialized(){return lt([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(t,e,r,a){jt(t,Oe,"Signature"),this.#t=e,this.#e=r,this.#r=a,this.#n=null}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){let t=new n(Oe,this.r,this.s,this.v);return this.networkV&&(t.#n=this.networkV),t}toJSON(){let t=this.networkV;return{_type:"signature",networkV:t!=null?t.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(t){let e=I(t,"v");return e==Ys||e==Qs?Ks:(m(e>=Sn,"invalid EIP-155 v","v",t),(e-Sn)/Zs)}static getChainIdV(t,e){return I(t)*Zs+BigInt(35+e-27)}static getNormalizedV(t){let e=I(t);return e===Ks||e===Ys?27:e===Xs||e===Qs?28:(m(e>=Sn,"invalid v","v",t),e&Xs?27:28)}static from(t){function e(p,d){m(p,d,"signature",t)}if(i(e,"assertError"),t==null)return new n(Oe,Fn,Fn,27);if(typeof t=="string"){let p=z(t,"signature");if(p.length===64){let d=D(p.slice(0,32)),f=p.slice(32,64),h=f[0]&128?28:27;return f[0]&=127,new n(Oe,d,D(f),h)}if(p.length===65){let d=D(p.slice(0,32)),f=p.slice(32,64);e((f[0]&128)===0,"non-canonical s");let h=n.getNormalizedV(p[64]);return new n(Oe,d,D(f),h)}e(!1,"invalid raw signature length")}if(t instanceof n)return t.clone();let r=t.r;e(r!=null,"missing r");let a=qs(r),s=function(p,d){if(p!=null)return qs(p);if(d!=null){e(Y(d,32),"invalid yParityAndS");let f=z(d);return f[0]&=127,D(f)}e(!1,"missing s")}(t.s,t.yParityAndS);e((z(s)[0]&128)==0,"non-canonical s");let{networkV:o,v:l}=function(p,d,f){if(p!=null){let h=I(p);return{networkV:h>=Sn?h:void 0,v:n.getNormalizedV(h)}}if(d!=null)return e(Y(d,32),"invalid yParityAndS"),{v:z(d)[0]&128?28:27};if(f!=null){switch(_(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}e(!1,"invalid yParity")}e(!1,"missing v")}(t.v,t.yParityAndS,t.yParity),u=new n(Oe,a,s,l);return o&&(u.#n=o),e(t.yParity==null||_(t.yParity,"sig.yParity")===u.yParity,"yParity mismatch"),e(t.yParityAndS==null||t.yParityAndS===u.yParityAndS,"yParityAndS mismatch"),u}};var wi=BigInt(0),Ti=BigInt(36);function to(n){n=n.toLowerCase();let t=n.substring(2).split(""),e=new Uint8Array(40);for(let a=0;a<40;a++)e[a]=t[a].charCodeAt(0);let r=z(st(e));for(let a=0;a<40;a+=2)r[a>>1]>>4>=8&&(t[a]=t[a].toUpperCase()),(r[a>>1]&15)>=8&&(t[a+1]=t[a+1].toUpperCase());return"0x"+t.join("")}i(to,"getChecksumAddress");var Ia={};for(let n=0;n<10;n++)Ia[String(n)]=String(n);for(let n=0;n<26;n++)Ia[String.fromCharCode(65+n)]=String(10+n);var eo=15;function vi(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let t=n.split("").map(r=>Ia[r]).join("");for(;t.length>=eo;){let r=t.substring(0,eo);t=parseInt(r,10)%97+t.substring(r.length)}let e=String(98-parseInt(t,10)%97);for(;e.length<2;)e="0"+e;return e}i(vi,"ibanChecksum");var Pi=function(){let n={};for(let t=0;t<36;t++){let e="0123456789abcdefghijklmnopqrstuvwxyz"[t];n[e]=BigInt(t)}return n}();function ki(n){n=n.toLowerCase();let t=wi;for(let e=0;e<n.length;e++)t=t*Ti+Pi[n[e]];return t}i(ki,"fromBase36");function $(n){if(m(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);let t=to(n);return m(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===n,"bad address checksum","address",n),t}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){m(n.substring(2,4)===vi(n),"bad icap checksum","address",n);let t=ki(n.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return to("0x"+t)}m(!1,"invalid address","address",n)}i($,"getAddress");function Oa(n){let t=$(n.from),r=I(n.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,$(Tt(st(Pa([t,r])),12))}i(Oa,"getCreateAddress");function Dn(n){return n&&typeof n.getAddress=="function"}i(Dn,"isAddressable");async function Ba(n,t){let e=await t;return(e==null||e==="0x0000000000000000000000000000000000000000")&&(w(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),m(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),$(e)}i(Ba,"checkAddress");function ne(n,t){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?$(n):(w(t!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),Ba(n,t.resolveName(n)));if(Dn(n))return Ba(n,n.getAddress());if(n&&typeof n.then=="function")return Ba(n,n);m(!1,"unsupported addressable value","target",n)}i(ne,"resolveAddress");var et=32,Na=new Uint8Array(et),Ai=["then"],_n={},ao=new WeakMap;function ae(n){return ao.get(n)}i(ae,"getNames");function ro(n,t){ao.set(n,t)}i(ro,"setNames");function ar(n,t){let e=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw e.error=t,e}i(ar,"throwError");function Fa(n,t,e){return n.indexOf(null)>=0?t.map((r,a)=>r instanceof dt?Fa(ae(r),r,e):r):n.reduce((r,a,s)=>{let o=t.getValue(a);return a in r||(e&&o instanceof dt&&(o=Fa(ae(o),o,e)),r[a]=o),r},{})}i(Fa,"toObject");var dt=class n extends Array{static{i(this,"Result")}#t;constructor(...t){let e=t[0],r=t[1],a=(t[2]||[]).slice(),s=!0;e!==_n&&(r=t,a=[],s=!1),super(r.length),r.forEach((u,p)=>{this[p]=u});let o=a.reduce((u,p)=>(typeof p=="string"&&u.set(p,(u.get(p)||0)+1),u),new Map);if(ro(this,Object.freeze(r.map((u,p)=>{let d=a[p];return d!=null&&o.get(d)===1?d:null}))),this.#t=[],this.#t==null&&this.#t,!s)return;Object.freeze(this);let l=new Proxy(this,{get:i((u,p,d)=>{if(typeof p=="string"){if(p.match(/^[0-9]+$/)){let h=_(p,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");let C=u[h];return C instanceof Error&&ar(`index ${h}`,C),C}if(Ai.indexOf(p)>=0)return Reflect.get(u,p,d);let f=u[p];if(f instanceof Function)return function(...h){return f.apply(this===d?u:this,h)};if(!(p in u))return u.getValue.apply(this===d?u:this,[p])}return Reflect.get(u,p,d)},"get")});return ro(l,ae(this)),l}toArray(t){let e=[];return this.forEach((r,a)=>{r instanceof Error&&ar(`index ${a}`,r),t&&r instanceof n&&(r=r.toArray(t)),e.push(r)}),e}toObject(t){let e=ae(this);return e.reduce((r,a,s)=>(w(a!=null,`value at index ${s} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),Fa(e,this,t)),{})}slice(t,e){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),e==null&&(e=this.length),e<0&&(e+=this.length,e<0&&(e=0)),e>this.length&&(e=this.length);let r=ae(this),a=[],s=[];for(let o=t;o<e;o++)a.push(this[o]),s.push(r[o]);return new n(_n,a,s)}filter(t,e){let r=ae(this),a=[],s=[];for(let o=0;o<this.length;o++){let l=this[o];l instanceof Error&&ar(`index ${o}`,l),t.call(e,l,o,this)&&(a.push(l),s.push(r[o]))}return new n(_n,a,s)}map(t,e){let r=[];for(let a=0;a<this.length;a++){let s=this[a];s instanceof Error&&ar(`index ${a}`,s),r.push(t.call(e,s,a,this))}return r}getValue(t){let e=ae(this).indexOf(t);if(e===-1)return;let r=this[e];return r instanceof Error&&ar(`property ${JSON.stringify(t)}`,r.error),r}static fromItems(t,e){return new n(_n,t,e)}};function no(n){let t=tr(n);return w(t.length<=et,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:et,offset:t.length}),t.length!==et&&(t=nt(lt([Na.slice(t.length%et),t]))),t}i(no,"getValue");var Q=class{static{i(this,"Coder")}name;type;localName;dynamic;constructor(t,e,r,a){v(this,{name:t,type:e,localName:r,dynamic:a},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){m(!1,t,this.localName,e)}},se=class{static{i(this,"Writer")}#t;#e;constructor(){this.#t=[],this.#e=0}get data(){return lt(this.#t)}get length(){return this.#e}#r(t){return this.#t.push(t),this.#e+=t.length,t.length}appendWriter(t){return this.#r(nt(t.data))}writeBytes(t){let e=nt(t),r=e.length%et;return r&&(e=nt(lt([e,Na.slice(r)]))),this.#r(e)}writeValue(t){return this.#r(no(t))}writeUpdatableValue(){let t=this.#t.length;return this.#t.push(Na),this.#e+=et,e=>{this.#t[t]=no(e)}}},Ln=class n{static{i(this,"Reader")}allowLoose;#t;#e;#r;#n;#a;constructor(t,e,r){v(this,{allowLoose:!!e}),this.#t=nt(t),this.#r=0,this.#n=null,this.#a=r??1024,this.#e=0}get data(){return D(this.#t)}get dataLength(){return this.#t.length}get consumed(){return this.#e}get bytes(){return new Uint8Array(this.#t)}#s(t){if(this.#n)return this.#n.#s(t);this.#r+=t,w(this.#a<1||this.#r<=this.#a*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#a} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:nt(this.#t),offset:this.#e,length:t,info:{bytesRead:this.#r,dataLength:this.dataLength}})}#o(t,e,r){let a=Math.ceil(e/et)*et;return this.#e+a>this.#t.length&&(this.allowLoose&&r&&this.#e+e<=this.#t.length?a=e:w(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:nt(this.#t),length:this.#t.length,offset:this.#e+a})),this.#t.slice(this.#e,this.#e+a)}subReader(t){let e=new n(this.#t.slice(this.#e+t),this.allowLoose,this.#a);return e.#n=this,e}readBytes(t,e){let r=this.#o(0,t,!!e);return this.#s(t),this.#e+=r.length,r.slice(0,t)}readValue(){return Rn(this.readBytes(et))}readIndex(){return va(this.readBytes(et))}};var yt={};function b(n,t){let e=!1;return t<0&&(e=!0,t*=-1),new J(yt,`${e?"":"u"}int${t}`,n,{signed:e,width:t})}i(b,"n");function G(n,t){return new J(yt,`bytes${t||""}`,n,{size:t})}i(G,"b");var so=Symbol.for("_ethers_typed"),J=class n{static{i(this,"Typed")}type;value;#t;_typedSymbol;constructor(t,e,r,a){a==null&&(a=null),jt(yt,t,"Typed"),v(this,{_typedSymbol:so,type:e,value:r}),this.#t=a,this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(t=>t.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return this.#t}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return this.#t===!0?-1:this.#t===!1?this.value.length:null}static from(t,e){return new n(yt,t,e)}static uint8(t){return b(t,8)}static uint16(t){return b(t,16)}static uint24(t){return b(t,24)}static uint32(t){return b(t,32)}static uint40(t){return b(t,40)}static uint48(t){return b(t,48)}static uint56(t){return b(t,56)}static uint64(t){return b(t,64)}static uint72(t){return b(t,72)}static uint80(t){return b(t,80)}static uint88(t){return b(t,88)}static uint96(t){return b(t,96)}static uint104(t){return b(t,104)}static uint112(t){return b(t,112)}static uint120(t){return b(t,120)}static uint128(t){return b(t,128)}static uint136(t){return b(t,136)}static uint144(t){return b(t,144)}static uint152(t){return b(t,152)}static uint160(t){return b(t,160)}static uint168(t){return b(t,168)}static uint176(t){return b(t,176)}static uint184(t){return b(t,184)}static uint192(t){return b(t,192)}static uint200(t){return b(t,200)}static uint208(t){return b(t,208)}static uint216(t){return b(t,216)}static uint224(t){return b(t,224)}static uint232(t){return b(t,232)}static uint240(t){return b(t,240)}static uint248(t){return b(t,248)}static uint256(t){return b(t,256)}static uint(t){return b(t,256)}static int8(t){return b(t,-8)}static int16(t){return b(t,-16)}static int24(t){return b(t,-24)}static int32(t){return b(t,-32)}static int40(t){return b(t,-40)}static int48(t){return b(t,-48)}static int56(t){return b(t,-56)}static int64(t){return b(t,-64)}static int72(t){return b(t,-72)}static int80(t){return b(t,-80)}static int88(t){return b(t,-88)}static int96(t){return b(t,-96)}static int104(t){return b(t,-104)}static int112(t){return b(t,-112)}static int120(t){return b(t,-120)}static int128(t){return b(t,-128)}static int136(t){return b(t,-136)}static int144(t){return b(t,-144)}static int152(t){return b(t,-152)}static int160(t){return b(t,-160)}static int168(t){return b(t,-168)}static int176(t){return b(t,-176)}static int184(t){return b(t,-184)}static int192(t){return b(t,-192)}static int200(t){return b(t,-200)}static int208(t){return b(t,-208)}static int216(t){return b(t,-216)}static int224(t){return b(t,-224)}static int232(t){return b(t,-232)}static int240(t){return b(t,-240)}static int248(t){return b(t,-248)}static int256(t){return b(t,-256)}static int(t){return b(t,-256)}static bytes1(t){return G(t,1)}static bytes2(t){return G(t,2)}static bytes3(t){return G(t,3)}static bytes4(t){return G(t,4)}static bytes5(t){return G(t,5)}static bytes6(t){return G(t,6)}static bytes7(t){return G(t,7)}static bytes8(t){return G(t,8)}static bytes9(t){return G(t,9)}static bytes10(t){return G(t,10)}static bytes11(t){return G(t,11)}static bytes12(t){return G(t,12)}static bytes13(t){return G(t,13)}static bytes14(t){return G(t,14)}static bytes15(t){return G(t,15)}static bytes16(t){return G(t,16)}static bytes17(t){return G(t,17)}static bytes18(t){return G(t,18)}static bytes19(t){return G(t,19)}static bytes20(t){return G(t,20)}static bytes21(t){return G(t,21)}static bytes22(t){return G(t,22)}static bytes23(t){return G(t,23)}static bytes24(t){return G(t,24)}static bytes25(t){return G(t,25)}static bytes26(t){return G(t,26)}static bytes27(t){return G(t,27)}static bytes28(t){return G(t,28)}static bytes29(t){return G(t,29)}static bytes30(t){return G(t,30)}static bytes31(t){return G(t,31)}static bytes32(t){return G(t,32)}static address(t){return new n(yt,"address",t)}static bool(t){return new n(yt,"bool",!!t)}static bytes(t){return new n(yt,"bytes",t)}static string(t){return new n(yt,"string",t)}static array(t,e){throw new Error("not implemented yet")}static tuple(t,e){throw new Error("not implemented yet")}static overrides(t){return new n(yt,"overrides",Object.assign({},t))}static isTyped(t){return t&&typeof t=="object"&&"_typedSymbol"in t&&t._typedSymbol===so}static dereference(t,e){if(n.isTyped(t)){if(t.type!==e)throw new Error(`invalid type: expecetd ${e}, got ${t.type}`);return t.value}return t}};var Hn=class extends Q{static{i(this,"AddressCoder")}constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let r=J.dereference(e,"string");try{r=$(r)}catch(a){return this._throwError(a.message,e)}return t.writeValue(r)}decode(t){return $(qe(t.readValue(),20))}};var Un=class extends Q{static{i(this,"AnonymousCoder")}coder;constructor(t){super(t.name,t.type,"_",t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}};function Sa(n,t,e){let r=[];if(Array.isArray(e))r=e;else if(e&&typeof e=="object"){let u={};r=t.map(p=>{let d=p.localName;return w(d,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:p},value:e}),w(!u[d],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:p},value:e}),u[d]=!0,e[d]})}else m(!1,"invalid tuple value","tuple",e);m(t.length===r.length,"types/value length mismatch","tuple",e);let a=new se,s=new se,o=[];t.forEach((u,p)=>{let d=r[p];if(u.dynamic){let f=s.length;u.encode(s,d);let h=a.writeUpdatableValue();o.push(C=>{h(C+f)})}else u.encode(a,d)}),o.forEach(u=>{u(a.length)});let l=n.appendWriter(a);return l+=n.appendWriter(s),l}i(Sa,"pack");function Da(n,t){let e=[],r=[],a=n.subReader(0);return t.forEach(s=>{let o=null;if(s.dynamic){let l=n.readIndex(),u=a.subReader(l);try{o=s.decode(u)}catch(p){if(wt(p,"BUFFER_OVERRUN"))throw p;o=p,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(l){if(wt(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=s.name,o.name=s.localName,o.type=s.type}if(o==null)throw new Error("investigate");e.push(o),r.push(s.localName||null)}),dt.fromItems(e,r)}i(Da,"unpack");var Vn=class extends Q{static{i(this,"ArrayCoder")}coder;length;constructor(t,e,r){let a=t.type+"["+(e>=0?e:"")+"]",s=e===-1||t.dynamic;super("array",a,r,s),v(this,{coder:t,length:e})}defaultValue(){let t=this.coder.defaultValue(),e=[];for(let r=0;r<this.length;r++)e.push(t);return e}encode(t,e){let r=J.dereference(e,"array");Array.isArray(r)||this._throwError("expected array value",r);let a=this.length;a===-1&&(a=r.length,t.writeValue(r.length)),Ye(r.length,a,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let o=0;o<r.length;o++)s.push(this.coder);return Sa(t,s,r)}decode(t){let e=this.length;e===-1&&(e=t.readIndex(),w(e*et<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*et,length:t.dataLength}));let r=[];for(let a=0;a<e;a++)r.push(new Un(this.coder));return Da(t,r)}};var Mn=class extends Q{static{i(this,"BooleanCoder")}constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){let r=J.dereference(e,"bool");return t.writeValue(r?1:0)}decode(t){return!!t.readValue()}};var sr=class extends Q{static{i(this,"DynamicBytesCoder")}constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=nt(e);let r=t.writeValue(e.length);return r+=t.writeBytes(e),r}decode(t){return t.readBytes(t.readIndex(),!0)}},Gn=class extends sr{static{i(this,"BytesCoder")}constructor(t){super("bytes",t)}decode(t){return D(super.decode(t))}};var $n=class extends Q{static{i(this,"FixedBytesCoder")}size;constructor(t,e){let r="bytes"+String(t);super(r,r,e,!1),v(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,e){let r=nt(J.dereference(e,this.type));return r.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(r)}decode(t){return D(t.readBytes(this.size))}};var Ri=new Uint8Array([]),jn=class extends Q{static{i(this,"NullCoder")}constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return e!=null&&this._throwError("not null",e),t.writeBytes(Ri)}decode(t){return t.readBytes(0),null}};var Ii=BigInt(0),Oi=BigInt(1),Bi=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),zn=class extends Q{static{i(this,"NumberCoder")}size;signed;constructor(t,e,r){let a=(e?"int":"uint")+t*8;super(a,a,r,!1),v(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let r=I(J.dereference(e,this.type)),a=Re(Bi,et*8);if(this.signed){let s=Re(a,this.size*8-1);(r>s||r<-(s+Oi))&&this._throwError("value out-of-bounds",e),r=Ta(r,8*et)}else(r<Ii||r>Re(a,this.size*8))&&this._throwError("value out-of-bounds",e);return t.writeValue(r)}decode(t){let e=Re(t.readValue(),this.size*8);return this.signed&&(e=wa(e,this.size*8)),e}};var Jn=class extends sr{static{i(this,"StringCoder")}constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Ie(J.dereference(e,"string")))}decode(t){return rr(super.decode(t))}};var oe=class extends Q{static{i(this,"TupleCoder")}coders;constructor(t,e){let r=!1,a=[];t.forEach(o=>{o.dynamic&&(r=!0),a.push(o.type)});let s="tuple("+a.join(",")+")";super("tuple",s,e,r),v(this,{coders:Object.freeze(t.slice())})}defaultValue(){let t=[];this.coders.forEach(r=>{t.push(r.defaultValue())});let e=this.coders.reduce((r,a)=>{let s=a.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,a)=>{let s=r.localName;!s||e[s]!==1||(s==="length"&&(s="_length"),t[s]==null&&(t[s]=t[a]))}),Object.freeze(t)}encode(t,e){let r=J.dereference(e,"tuple");return Sa(t,this.coders,r)}decode(t){return Da(t,this.coders)}};function Jt(n){return st(Ie(n))}i(Jt,"id");function _a(n,t){return{address:$(n),storageKeys:t.map((e,r)=>(m(Y(e,32),"invalid slot",`storageKeys[${r}]`,e),e.toLowerCase()))}}i(_a,"accessSetify");function or(n){if(Array.isArray(n))return n.map((e,r)=>Array.isArray(e)?(m(e.length===2,"invalid slot set",`value[${r}]`,e),_a(e[0],e[1])):(m(e!=null&&typeof e=="object","invalid address-slot set","value",n),_a(e.address,e.storageKeys)));m(n!=null&&typeof n=="object","invalid access list","value",n);let t=Object.keys(n).map(e=>{let r=n[e].reduce((a,s)=>(a[s]=!0,a),{});return _a(e,Object.keys(r).sort())});return t.sort((e,r)=>e.address.localeCompare(r.address)),t}i(or,"accessListify");function at(n){let t=new Set;return n.forEach(e=>t.add(e)),Object.freeze(t)}i(at,"setify");var Ni="external public payable override",Fi=at(Ni.split(" ")),go="constant external internal payable private public pure view override",Si=at(go.split(" ")),yo="constructor error event fallback function receive struct",Co=at(yo.split(" ")),xo="calldata memory storage payable indexed",Di=at(xo.split(" ")),_i="tuple returns",Li=[yo,xo,_i,go].join(" "),Hi=at(Li.split(" ")),Ui={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},Vi=new RegExp("^(\\s*)"),Mi=new RegExp("^([0-9]+)"),Gi=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),bo=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),Eo=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),Ct=class n{static{i(this,"TokenString")}#t;#e;get offset(){return this.#t}get length(){return this.#e.length-this.#t}constructor(t){this.#t=0,this.#e=t.slice()}clone(){return new n(this.#e)}reset(){this.#t=0}#r(t=0,e=0){return new n(this.#e.slice(t,e).map(r=>Object.freeze(Object.assign({},r,{match:r.match-t,linkBack:r.linkBack-t,linkNext:r.linkNext-t}))))}popKeyword(t){let e=this.peek();if(e.type!=="KEYWORD"||!t.has(e.text))throw new Error(`expected keyword ${e.text}`);return this.pop().text}popType(t){if(this.peek().type!==t){let e=this.peek();throw new Error(`expected ${t}; got ${e.type} ${JSON.stringify(e.text)}`)}return this.pop().text}popParen(){let t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");let e=this.#r(this.#t+1,t.match+1);return this.#t=t.match+1,e}popParams(){let t=this.peek();if(t.type!=="OPEN_PAREN")throw new Error("bad start");let e=[];for(;this.#t<t.match-1;){let r=this.peek().linkNext;e.push(this.#r(this.#t+1,r)),this.#t=r}return this.#t=t.match+1,e}peek(){if(this.#t>=this.#e.length)throw new Error("out-of-bounds");return this.#e[this.#t]}peekKeyword(t){let e=this.peekType("KEYWORD");return e!=null&&t.has(e)?e:null}peekType(t){if(this.length===0)return null;let e=this.peek();return e.type===t?e.text:null}pop(){let t=this.peek();return this.#t++,t}toString(){let t=[];for(let e=this.#t;e<this.#e.length;e++){let r=this.#e[e];t.push(`${r.type}:${r.text}`)}return`<TokenString ${t.join(" ")}>`}};function Yt(n){let t=[],e=i(o=>{let l=s<n.length?JSON.stringify(n[s]):"$EOI";throw new Error(`invalid token ${l} at ${s}: ${o}`)},"throwError"),r=[],a=[],s=0;for(;s<n.length;){let o=n.substring(s),l=o.match(Vi);l&&(s+=l[1].length,o=n.substring(s));let u={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:s,value:-1};t.push(u);let p=Ui[o[0]]||"";if(p){if(u.type=p,u.text=o[0],s++,p==="OPEN_PAREN")r.push(t.length-1),a.push(t.length-1);else if(p=="CLOSE_PAREN")r.length===0&&e("no matching open bracket"),u.match=r.pop(),t[u.match].match=t.length-1,u.depth--,u.linkBack=a.pop(),t[u.linkBack].linkNext=t.length-1;else if(p==="COMMA")u.linkBack=a.pop(),t[u.linkBack].linkNext=t.length-1,a.push(t.length-1);else if(p==="OPEN_BRACKET")u.type="BRACKET";else if(p==="CLOSE_BRACKET"){let d=t.pop().text;if(t.length>0&&t[t.length-1].type==="NUMBER"){let f=t.pop().text;d=f+d,t[t.length-1].value=_(f)}if(t.length===0||t[t.length-1].type!=="BRACKET")throw new Error("missing opening bracket");t[t.length-1].text+=d}continue}if(l=o.match(Gi),l){if(u.text=l[1],s+=u.text.length,Hi.has(u.text)){u.type="KEYWORD";continue}if(u.text.match(Eo)){u.type="TYPE";continue}u.type="ID";continue}if(l=o.match(Mi),l){u.text=l[1],u.type="NUMBER",s+=u.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${s}`)}return new Ct(t.map(o=>Object.freeze(o)))}i(Yt,"lex");function oo(n,t){let e=[];for(let r in t.keys())n.has(r)&&e.push(r);if(e.length>1)throw new Error(`conflicting types: ${e.join(", ")}`)}i(oo,"allowSingle");function Wn(n,t){if(t.peekKeyword(Co)){let e=t.pop().text;if(e!==n)throw new Error(`expected ${n}, got ${e}`)}return t.popType("ID")}i(Wn,"consumeName");function Ft(n,t){let e=new Set;for(;;){let r=n.peekType("KEYWORD");if(r==null||t&&!t.has(r))break;if(n.pop(),e.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);e.add(r)}return Object.freeze(e)}i(Ft,"consumeKeywords");function wo(n){let t=Ft(n,Si);return oo(t,at("constant payable nonpayable".split(" "))),oo(t,at("pure view payable nonpayable".split(" "))),t.has("view")?"view":t.has("pure")?"pure":t.has("payable")?"payable":t.has("nonpayable")?"nonpayable":t.has("constant")?"view":"nonpayable"}i(wo,"consumeMutability");function Nt(n,t){return n.popParams().map(e=>q.from(e,t))}i(Nt,"consumeParams");function To(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return I(n.pop().text);throw new Error("invalid gas")}return null}i(To,"consumeGas");function ie(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}i(ie,"consumeEoi");var $i=new RegExp(/^(.*)\[([0-9]*)\]$/);function io(n){let t=n.match(Eo);if(m(t,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(t[2]){let e=parseInt(t[2]);m(e!==0&&e<=32,"invalid bytes length","type",n)}else if(t[3]){let e=parseInt(t[3]);m(e!==0&&e<=256&&e%8===0,"invalid numeric width","type",n)}return n}i(io,"verifyBasicType");var W={},ot=Symbol.for("_ethers_internal"),co="_ParamTypeInternal",lo="_ErrorInternal",uo="_EventInternal",po="_ConstructorInternal",fo="_FallbackInternal",ho="_FunctionInternal",mo="_StructInternal",q=class n{static{i(this,"ParamType")}name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(t,e,r,a,s,o,l,u){if(jt(t,W,"ParamType"),Object.defineProperty(this,ot,{value:co}),o&&(o=Object.freeze(o.slice())),a==="array"){if(l==null||u==null)throw new Error("")}else if(l!=null||u!=null)throw new Error("");if(a==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");v(this,{name:e,type:r,baseType:a,indexed:s,components:o,arrayLength:l,arrayChildren:u})}format(t){if(t==null&&(t="sighash"),t==="json"){let r=this.name||"";if(this.isArray()){let s=JSON.parse(this.arrayChildren.format("json"));return s.name=r,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}let a={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(a.indexed=this.indexed),this.isTuple()&&(a.components=this.components.map(s=>JSON.parse(s.format(t)))),JSON.stringify(a)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?e+="("+this.components.map(r=>r.format(t)).join(t==="full"?", ":",")+")":e+=this.type,t!=="sighash"&&(this.indexed===!0&&(e+=" indexed"),t==="full"&&this.name&&(e+=" "+this.name)),e}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(t,e){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");let r=this;return t.map(a=>r.arrayChildren.walk(a,e))}if(this.isTuple()){if(!Array.isArray(t))throw new Error("invalid tuple value");if(t.length!==this.components.length)throw new Error("array is wrong length");let r=this;return t.map((a,s)=>r.components[s].walk(a,e))}return e(this.type,t)}#t(t,e,r,a){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");let o=this.arrayChildren,l=e.slice();l.forEach((u,p)=>{o.#t(t,u,r,d=>{l[p]=d})}),a(l);return}if(this.isTuple()){let o=this.components,l;if(Array.isArray(e))l=e.slice();else{if(e==null||typeof e!="object")throw new Error("invalid tuple value");l=o.map(u=>{if(!u.name)throw new Error("cannot use object value with unnamed components");if(!(u.name in e))throw new Error(`missing value for component ${u.name}`);return e[u.name]})}if(l.length!==this.components.length)throw new Error("array is wrong length");l.forEach((u,p)=>{o[p].#t(t,u,r,d=>{l[p]=d})}),a(l);return}let s=r(this.type,e);s.then?t.push(async function(){a(await s)}()):a(s)}async walkAsync(t,e){let r=[],a=[t];return this.#t(r,t,e,s=>{a[0]=s}),r.length&&await Promise.all(r),a[0]}static from(t,e){if(n.isParamType(t))return t;if(typeof t=="string")try{return n.from(Yt(t),e)}catch{m(!1,"invalid param type","obj",t)}else if(t instanceof Ct){let l="",u="",p=null;Ft(t,at(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(u="tuple",p=t.popParams().map(A=>n.from(A)),l=`tuple(${p.map(A=>A.format()).join(",")})`):(l=io(t.popType("TYPE")),u=l);let d=null,f=null;for(;t.length&&t.peekType("BRACKET");){let A=t.pop();d=new n(W,"",l,u,null,p,f,d),f=A.value,l+=A.text,u="array",p=null}let h=null;if(Ft(t,Di).has("indexed")){if(!e)throw new Error("");h=!0}let E=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new n(W,E,l,u,h,p,f,d)}let r=t.name;m(!r||typeof r=="string"&&r.match(bo),"invalid name","obj.name",r);let a=t.indexed;a==!0?(m(e,"parameter cannot be indexed","obj.indexed",t.indexed),a=!0):a=!1;let s=t.type,o=s.match($i);if(o){let l=parseInt(o[2]||"-1"),u=n.from({type:o[1],components:t.components});return new n(W,r||"",s,"array",a,null,l,u)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){let l=t.components!=null?t.components.map(p=>n.from(p)):null;return new n(W,r||"",s,"tuple",a,l,null,null)}return s=io(t.type),new n(W,r||"",s,s,a,null,null,null)}static isParamType(t){return t&&t[ot]===co}},Zt=class n{static{i(this,"Fragment")}type;inputs;constructor(t,e,r){jt(t,W,"Fragment"),r=Object.freeze(r.slice()),v(this,{type:e,inputs:r})}static from(t){if(typeof t=="string"){try{n.from(JSON.parse(t))}catch{}return n.from(Yt(t))}if(t instanceof Ct)switch(t.peekKeyword(Co)){case"constructor":return Kt.from(t);case"error":return ut.from(t);case"event":return Wt.from(t);case"fallback":case"receive":return cr.from(t);case"function":return Xt.from(t);case"struct":return Ne.from(t)}else if(typeof t=="object"){switch(t.type){case"constructor":return Kt.from(t);case"error":return ut.from(t);case"event":return Wt.from(t);case"fallback":case"receive":return cr.from(t);case"function":return Xt.from(t);case"struct":return Ne.from(t)}w(!1,`unsupported type: ${t.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}m(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return Kt.isFragment(t)}static isError(t){return ut.isFragment(t)}static isEvent(t){return Wt.isFragment(t)}static isFunction(t){return Xt.isFragment(t)}static isStruct(t){return Ne.isFragment(t)}},ce=class extends Zt{static{i(this,"NamedFragment")}name;constructor(t,e,r,a){super(t,e,a),m(typeof r=="string"&&r.match(bo),"invalid identifier","name",r),a=Object.freeze(a.slice()),v(this,{name:r})}};function ir(n,t){return"("+t.map(e=>e.format(n)).join(n==="full"?", ":",")+")"}i(ir,"joinParams");var ut=class n extends ce{static{i(this,"ErrorFragment")}constructor(t,e,r){super(t,"error",e,r),Object.defineProperty(this,ot,{value:lo})}get selector(){return Jt(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("error"),e.push(this.name+ir(t,this.inputs)),e.join(" ")}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")return n.from(Yt(t));if(t instanceof Ct){let e=Wn("error",t),r=Nt(t);return ie(t),new n(W,e,r)}return new n(W,t.name,t.inputs?t.inputs.map(q.from):[])}static isFragment(t){return t&&t[ot]===lo}},Wt=class n extends ce{static{i(this,"EventFragment")}anonymous;constructor(t,e,r,a){super(t,"event",e,r),Object.defineProperty(this,ot,{value:uo}),v(this,{anonymous:a})}get topicHash(){return Jt(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("event"),e.push(this.name+ir(t,this.inputs)),t!=="sighash"&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){return e=(e||[]).map(a=>q.from(a)),new n(W,t,e,!1).topicHash}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Yt(t))}catch{m(!1,"invalid event fragment","obj",t)}else if(t instanceof Ct){let e=Wn("event",t),r=Nt(t,!0),a=!!Ft(t,at(["anonymous"])).has("anonymous");return ie(t),new n(W,e,r,a)}return new n(W,t.name,t.inputs?t.inputs.map(e=>q.from(e,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[ot]===uo}},Kt=class n extends Zt{static{i(this,"ConstructorFragment")}payable;gas;constructor(t,e,r,a,s){super(t,e,r),Object.defineProperty(this,ot,{value:po}),v(this,{payable:a,gas:s})}format(t){if(w(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});let e=[`constructor${ir(t,this.inputs)}`];return this.payable&&e.push("payable"),this.gas!=null&&e.push(`@${this.gas.toString()}`),e.join(" ")}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Yt(t))}catch{m(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof Ct){Ft(t,at(["constructor"]));let e=Nt(t),r=!!Ft(t,Fi).has("payable"),a=To(t);return ie(t),new n(W,"constructor",e,r,a)}return new n(W,"constructor",t.inputs?t.inputs.map(q.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ot]===po}},cr=class n extends Zt{static{i(this,"FallbackFragment")}payable;constructor(t,e,r){super(t,"fallback",e),Object.defineProperty(this,ot,{value:fo}),v(this,{payable:r})}format(t){let e=this.inputs.length===0?"receive":"fallback";if(t==="json"){let r=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:r})}return`${e}()${this.payable?" payable":""}`}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Yt(t))}catch{m(!1,"invalid fallback fragment","obj",t)}else if(t instanceof Ct){let e=t.toString(),r=t.peekKeyword(at(["fallback","receive"]));if(m(r,"type must be fallback or receive","obj",e),t.popKeyword(at(["fallback","receive"]))==="receive"){let l=Nt(t);return m(l.length===0,"receive cannot have arguments","obj.inputs",l),Ft(t,at(["payable"])),ie(t),new n(W,[],!0)}let s=Nt(t);s.length?m(s.length===1&&s[0].type==="bytes","invalid fallback inputs","obj.inputs",s.map(l=>l.format("minimal")).join(", ")):s=[q.from("bytes")];let o=wo(t);if(m(o==="nonpayable"||o==="payable","fallback cannot be constants","obj.stateMutability",o),Ft(t,at(["returns"])).has("returns")){let l=Nt(t);m(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(u=>u.format("minimal")).join(", "))}return ie(t),new n(W,s,o==="payable")}if(t.type==="receive")return new n(W,[],!0);if(t.type==="fallback"){let e=[q.from("bytes")],r=t.stateMutability==="payable";return new n(W,e,r)}m(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[ot]===fo}},Xt=class n extends ce{static{i(this,"FunctionFragment")}constant;outputs;stateMutability;payable;gas;constructor(t,e,r,a,s,o){super(t,"function",e,a),Object.defineProperty(this,ot,{value:ho}),s=Object.freeze(s.slice()),v(this,{constant:r==="view"||r==="pure",gas:o,outputs:s,payable:r==="payable",stateMutability:r})}get selector(){return Jt(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="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!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t))),outputs:this.outputs.map(r=>JSON.parse(r.format(t)))});let e=[];return t!=="sighash"&&e.push("function"),e.push(this.name+ir(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push(ir(t,this.outputs))),this.gas!=null&&e.push(`@${this.gas.toString()}`)),e.join(" ")}static getSelector(t,e){return e=(e||[]).map(a=>q.from(a)),new n(W,t,"view",e,[],null).selector}static from(t){if(n.isFragment(t))return t;if(typeof t=="string")try{return n.from(Yt(t))}catch{m(!1,"invalid function fragment","obj",t)}else if(t instanceof Ct){let r=Wn("function",t),a=Nt(t),s=wo(t),o=[];Ft(t,at(["returns"])).has("returns")&&(o=Nt(t));let l=To(t);return ie(t),new n(W,r,s,a,o,l)}let e=t.stateMutability;return e==null&&(e="payable",typeof t.constant=="boolean"?(e="view",t.constant||(e="payable",typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(e="nonpayable")),new n(W,t.name,e,t.inputs?t.inputs.map(q.from):[],t.outputs?t.outputs.map(q.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ot]===ho}},Ne=class n extends ce{static{i(this,"StructFragment")}constructor(t,e,r){super(t,"struct",e,r),Object.defineProperty(this,ot,{value:mo})}format(){throw new Error("@TODO")}static from(t){if(typeof t=="string")try{return n.from(Yt(t))}catch{m(!1,"invalid struct fragment","obj",t)}else if(t instanceof Ct){let e=Wn("struct",t),r=Nt(t);return ie(t),new n(W,e,r)}return new n(W,t.name,t.inputs?t.inputs.map(q.from):[])}static isFragment(t){return t&&t[ot]===mo}};var xt=new Map;xt.set(0,"GENERIC_PANIC");xt.set(1,"ASSERT_FALSE");xt.set(17,"OVERFLOW");xt.set(18,"DIVIDE_BY_ZERO");xt.set(33,"ENUM_RANGE_ERROR");xt.set(34,"BAD_STORAGE_DATA");xt.set(49,"STACK_UNDERFLOW");xt.set(50,"ARRAY_RANGE_ERROR");xt.set(65,"OUT_OF_MEMORY");xt.set(81,"UNINITIALIZED_FUNCTION_CALL");var ji=new RegExp(/^bytes([0-9]*)$/),zi=new RegExp(/^(u?int)([0-9]*)$/),La=null,vo=1024;function Ji(n,t,e,r){let a="missing revert data",s=null,o=null,l=null;if(e){a="execution reverted";let p=z(e);if(e=D(e),p.length===0)a+=" (no data present; likely require(false) occurred",s="require(false)";else if(p.length%32!==4)a+=" (could not decode reason; invalid data length)";else if(D(p.slice(0,4))==="0x08c379a0")try{s=r.decode(["string"],p.slice(4))[0],l={signature:"Error(string)",name:"Error",args:[s]},a+=`: ${JSON.stringify(s)}`}catch{a+=" (could not decode reason; invalid string data)"}else if(D(p.slice(0,4))==="0x4e487b71")try{let d=Number(r.decode(["uint256"],p.slice(4))[0]);l={signature:"Panic(uint256)",name:"Panic",args:[d]},s=`Panic due to ${xt.get(d)||"UNKNOWN"}(${d})`,a+=`: ${s}`}catch{a+=" (could not decode panic code)"}else a+=" (unknown custom error)"}let u={to:t.to?$(t.to):null,data:t.data||"0x"};return t.from&&(u.from=$(t.from)),Bt(a,"CALL_EXCEPTION",{action:n,data:e,reason:s,transaction:u,invocation:o,revert:l})}i(Ji,"getBuiltinCallException");var Fe=class n{static{i(this,"AbiCoder")}#t(t){if(t.isArray())return new Vn(this.#t(t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new oe(t.components.map(r=>this.#t(r)),t.name);switch(t.baseType){case"address":return new Hn(t.name);case"bool":return new Mn(t.name);case"string":return new Jn(t.name);case"bytes":return new Gn(t.name);case"":return new jn(t.name)}let e=t.type.match(zi);if(e){let r=parseInt(e[2]||"256");return m(r!==0&&r<=256&&r%8===0,"invalid "+e[1]+" bit length","param",t),new zn(r/8,e[1]==="int",t.name)}if(e=t.type.match(ji),e){let r=parseInt(e[1]);return m(r!==0&&r<=32,"invalid bytes length","param",t),new $n(r,t.name)}m(!1,"invalid type","type",t.type)}getDefaultValue(t){let e=t.map(a=>this.#t(q.from(a)));return new oe(e,"_").defaultValue()}encode(t,e){Ye(e.length,t.length,"types/values length mismatch");let r=t.map(o=>this.#t(q.from(o))),a=new oe(r,"_"),s=new se;return a.encode(s,e),s.data}decode(t,e,r){let a=t.map(o=>this.#t(q.from(o)));return new oe(a,"_").decode(new Ln(e,r,vo))}static _setDefaultMaxInflation(t){m(typeof t=="number"&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),vo=t}static defaultAbiCoder(){return La==null&&(La=new n),La}static getBuiltinCallException(t,e,r){return Ji(t,e,r,n.defaultAbiCoder())}};function Po(n){let t=z(n,"bytes");if(t.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(t[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let e=31;for(;t[e-1]===0;)e--;return rr(t.slice(0,e))}i(Po,"decodeBytes32String");var lr=class{static{i(this,"LogDescription")}fragment;name;signature;topic;args;constructor(t,e,r){let a=t.name,s=t.format();v(this,{fragment:t,name:a,signature:s,topic:e,args:r})}},ur=class{static{i(this,"TransactionDescription")}fragment;name;args;signature;selector;value;constructor(t,e,r,a){let s=t.name,o=t.format();v(this,{fragment:t,name:s,args:r,signature:o,selector:e,value:a})}},pr=class{static{i(this,"ErrorDescription")}fragment;name;args;signature;selector;constructor(t,e,r){let a=t.name,s=t.format();v(this,{fragment:t,name:a,args:r,signature:s,selector:e})}},Se=class{static{i(this,"Indexed")}hash;_isIndexed;static isIndexed(t){return!!(t&&t._isIndexed)}constructor(t){v(this,{hash:t,_isIndexed:!0})}},ko={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},Ao={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:i(n=>`reverted with reason string ${JSON.stringify(n)}`,"reason")},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:i(n=>{let t="unknown panic code";return n>=0&&n<=255&&ko[n.toString()]&&(t=ko[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${t})`},"reason")}},St=class n{static{i(this,"Interface")}fragments;deploy;fallback;receive;#t;#e;#r;#n;constructor(t){let e=[];typeof t=="string"?e=JSON.parse(t):e=t,this.#r=new Map,this.#t=new Map,this.#e=new Map;let r=[];for(let o of e)try{r.push(Zt.from(o))}catch(l){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,l.message)}v(this,{fragments:Object.freeze(r)});let a=null,s=!1;this.#n=this.getAbiCoder(),this.fragments.forEach((o,l)=>{let u;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}v(this,{deploy:o});return;case"fallback":o.inputs.length===0?s=!0:(m(!a||o.payable!==a.payable,"conflicting fallback fragments",`fragments[${l}]`,o),a=o,s=a.payable);return;case"function":u=this.#r;break;case"event":u=this.#e;break;case"error":u=this.#t;break;default:return}let p=o.format();u.has(p)||u.set(p,o)}),this.deploy||v(this,{deploy:Kt.from("constructor()")}),v(this,{fallback:a,receive:s})}format(t){let e=t?"minimal":"full";return this.fragments.map(a=>a.format(e))}formatJson(){let t=this.fragments.map(e=>e.format("json"));return JSON.stringify(t.map(e=>JSON.parse(e)))}getAbiCoder(){return Fe.defaultAbiCoder()}#a(t,e,r){if(Y(t)){let s=t.toLowerCase();for(let o of this.#r.values())if(s===o.selector)return o;return null}if(t.indexOf("(")===-1){let s=[];for(let[o,l]of this.#r)o.split("(")[0]===t&&s.push(l);if(e){let o=e.length>0?e[e.length-1]:null,l=e.length,u=!0;J.isTyped(o)&&o.type==="overrides"&&(u=!1,l--);for(let p=s.length-1;p>=0;p--){let d=s[p].inputs.length;d!==l&&(!u||d!==l-1)&&s.splice(p,1)}for(let p=s.length-1;p>=0;p--){let d=s[p].inputs;for(let f=0;f<e.length;f++)if(J.isTyped(e[f])){if(f>=d.length){if(e[f].type==="overrides")continue;s.splice(p,1);break}if(e[f].type!==d[f].baseType){s.splice(p,1);break}}}}if(s.length===1&&e&&e.length!==s[0].inputs.length){let o=e[e.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&r){let o=s.map(l=>JSON.stringify(l.format())).join(", ");m(!1,`ambiguous function description (i.e. matches ${o})`,"key",t)}return s[0]}let a=this.#r.get(Xt.from(t).format());return a||null}getFunctionName(t){let e=this.#a(t,null,!1);return m(e,"no matching function","key",t),e.name}hasFunction(t){return!!this.#a(t,null,!1)}getFunction(t,e){return this.#a(t,e||null,!0)}forEachFunction(t){let e=Array.from(this.#r.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#r.get(a),r)}}#s(t,e,r){if(Y(t)){let s=t.toLowerCase();for(let o of this.#e.values())if(s===o.topicHash)return o;return null}if(t.indexOf("(")===-1){let s=[];for(let[o,l]of this.#e)o.split("(")[0]===t&&s.push(l);if(e){for(let o=s.length-1;o>=0;o--)s[o].inputs.length<e.length&&s.splice(o,1);for(let o=s.length-1;o>=0;o--){let l=s[o].inputs;for(let u=0;u<e.length;u++)if(J.isTyped(e[u])&&e[u].type!==l[u].baseType){s.splice(o,1);break}}}if(s.length===0)return null;if(s.length>1&&r){let o=s.map(l=>JSON.stringify(l.format())).join(", ");m(!1,`ambiguous event description (i.e. matches ${o})`,"key",t)}return s[0]}let a=this.#e.get(Wt.from(t).format());return a||null}getEventName(t){let e=this.#s(t,null,!1);return m(e,"no matching event","key",t),e.name}hasEvent(t){return!!this.#s(t,null,!1)}getEvent(t,e){return this.#s(t,e||null,!0)}forEachEvent(t){let e=Array.from(this.#e.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#e.get(a),r)}}getError(t,e){if(Y(t)){let a=t.toLowerCase();if(Ao[a])return ut.from(Ao[a].signature);for(let s of this.#t.values())if(a===s.selector)return s;return null}if(t.indexOf("(")===-1){let a=[];for(let[s,o]of this.#t)s.split("(")[0]===t&&a.push(o);if(a.length===0)return t==="Error"?ut.from("error Error(string)"):t==="Panic"?ut.from("error Panic(uint256)"):null;if(a.length>1){let s=a.map(o=>JSON.stringify(o.format())).join(", ");m(!1,`ambiguous error description (i.e. ${s})`,"name",t)}return a[0]}if(t=ut.from(t).format(),t==="Error(string)")return ut.from("error Error(string)");if(t==="Panic(uint256)")return ut.from("error Panic(uint256)");let r=this.#t.get(t);return r||null}forEachError(t){let e=Array.from(this.#t.keys());e.sort((r,a)=>r.localeCompare(a));for(let r=0;r<e.length;r++){let a=e[r];t(this.#t.get(a),r)}}_decodeParams(t,e){return this.#n.decode(t,e)}_encodeParams(t,e){return this.#n.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if(typeof t=="string"){let r=this.getError(t);m(r,"unknown error","fragment",t),t=r}return m(Tt(e,0,4)===t.selector,`data signature does not match error ${t.name}.`,"data",e),this._decodeParams(t.inputs,Tt(e,4))}encodeErrorResult(t,e){if(typeof t=="string"){let r=this.getError(t);m(r,"unknown error","fragment",t),t=r}return lt([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return m(Tt(e,0,4)===t.selector,`data signature does not match function ${t.name}.`,"data",e),this._decodeParams(t.inputs,Tt(e,4))}encodeFunctionData(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return lt([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if(typeof t=="string"){let s=this.getFunction(t);m(s,"unknown function","fragment",t),t=s}let r="invalid length for result data",a=nt(e);if(a.length%32===0)try{return this.#n.decode(t.outputs,a)}catch{r="could not decode result data"}w(!1,r,"BAD_DATA",{value:D(a),info:{method:t.name,signature:t.format()}})}makeError(t,e){let r=z(t,"data"),a=Fe.getBuiltinCallException("call",e,r);if(a.message.startsWith("execution reverted (unknown custom error)")){let l=D(r.slice(0,4)),u=this.getError(l);if(u)try{let p=this.#n.decode(u.inputs,r.slice(4));a.revert={name:u.name,signature:u.format(),args:p},a.reason=a.revert.signature,a.message=`execution reverted: ${a.reason}`}catch{a.message="execution reverted (coult not decode custom error)"}}let o=this.parseTransaction(e);return o&&(a.invocation={method:o.name,signature:o.signature,args:o.args}),a}encodeFunctionResult(t,e){if(typeof t=="string"){let r=this.getFunction(t);m(r,"unknown function","fragment",t),t=r}return D(this.#n.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if(typeof t=="string"){let s=this.getEvent(t);m(s,"unknown event","eventFragment",t),t=s}w(e.length<=t.inputs.length,`too many arguments for ${t.format()}`,"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});let r=[];t.anonymous||r.push(t.topicHash);let a=i((s,o)=>s.type==="string"?Jt(o):s.type==="bytes"?st(D(o)):(s.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":s.type.match(/^u?int/)?o=qe(o):s.type.match(/^bytes/)?o=kn(o,32):s.type==="address"&&this.#n.encode(["address"],[o]),ke(D(o),32)),"encodeTopic");for(e.forEach((s,o)=>{let l=t.inputs[o];if(!l.indexed){m(s==null,"cannot filter non-indexed parameters; must be null","contract."+l.name,s);return}s==null?r.push(null):l.baseType==="array"||l.baseType==="tuple"?m(!1,"filtering with tuples or arrays not supported","contract."+l.name,s):Array.isArray(s)?r.push(s.map(u=>a(l,u))):r.push(a(l,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(t,e){if(typeof t=="string"){let o=this.getEvent(t);m(o,"unknown event","eventFragment",t),t=o}let r=[],a=[],s=[];return t.anonymous||r.push(t.topicHash),m(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach((o,l)=>{let u=e[l];if(o.indexed)if(o.type==="string")r.push(Jt(u));else if(o.type==="bytes")r.push(st(u));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(this.#n.encode([o.type],[u]))}else a.push(o),s.push(u)}),{data:this.#n.encode(a,s),topics:r}}decodeEventLog(t,e,r){if(typeof t=="string"){let C=this.getEvent(t);m(C,"unknown event","eventFragment",t),t=C}if(r!=null&&!t.anonymous){let C=t.topicHash;m(Y(r[0],32)&&r[0].toLowerCase()===C,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}let a=[],s=[],o=[];t.inputs.forEach((C,E)=>{C.indexed?C.type==="string"||C.type==="bytes"||C.baseType==="tuple"||C.baseType==="array"?(a.push(q.from({type:"bytes32",name:C.name})),o.push(!0)):(a.push(C),o.push(!1)):(s.push(C),o.push(!1))});let l=r!=null?this.#n.decode(a,lt(r)):null,u=this.#n.decode(s,e,!0),p=[],d=[],f=0,h=0;return t.inputs.forEach((C,E)=>{let A=null;if(C.indexed)if(l==null)A=new Se(null);else if(o[E])A=new Se(l[h++]);else try{A=l[h++]}catch(S){A=S}else try{A=u[f++]}catch(S){A=S}p.push(A),d.push(C.name||null)}),dt.fromItems(p,d)}parseTransaction(t){let e=z(t.data,"tx.data"),r=I(t.value!=null?t.value:0,"tx.value"),a=this.getFunction(D(e.slice(0,4)));if(!a)return null;let s=this.#n.decode(a.inputs,e.slice(4));return new ur(a,a.selector,s,r)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new lr(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){let e=D(t),r=this.getError(Tt(e,0,4));if(!r)return null;let a=this.#n.decode(r.inputs,Tt(e,4));return new pr(r,r.selector,a)}static from(t){return t instanceof n?t:typeof t=="string"?new n(JSON.parse(t)):typeof t.formatJson=="function"?new n(t.formatJson()):typeof t.format=="function"?new n(t.format("json")):new n(t)}};var Io=BigInt(0);function ft(n){return n==null?null:n.toString()}i(ft,"toJson");function Oo(n){let t={};n.to&&(t.to=n.to),n.from&&(t.from=n.from),n.data&&(t.data=D(n.data));let e="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(let a of e)!(a in n)||n[a]==null||(t[a]=I(n[a],`request.${a}`));let r="type,nonce".split(/,/);for(let a of r)!(a in n)||n[a]==null||(t[a]=_(n[a],`request.${a}`));return n.accessList&&(t.accessList=or(n.accessList)),"blockTag"in n&&(t.blockTag=n.blockTag),"enableCcipRead"in n&&(t.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(t.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(t.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(t.kzg=n.kzg),"blobs"in n&&n.blobs&&(t.blobs=n.blobs.map(a=>Ea(a)?D(a):Object.assign({},a))),t}i(Oo,"copyRequest");var Qt=class{static{i(this,"Log")}provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(t,e){this.provider=e;let r=Object.freeze(t.topics.slice());v(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:r,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){let{address:t,blockHash:e,blockNumber:r,data:a,index:s,removed:o,topics:l,transactionHash:u,transactionIndex:p}=this;return{_type:"log",address:t,blockHash:e,blockNumber:r,data:a,index:s,removed:o,topics:l,transactionHash:u,transactionIndex:p}}async getBlock(){let t=await this.provider.getBlock(this.blockHash);return w(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){let t=await this.provider.getTransaction(this.transactionHash);return w(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){let t=await this.provider.getTransactionReceipt(this.transactionHash);return w(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return Ki(this)}},Kn=class{static{i(this,"TransactionReceipt")}provider;to;from;contractAddress;hash;index;blockHash;blockNumber;logsBloom;gasUsed;blobGasUsed;cumulativeGasUsed;gasPrice;blobGasPrice;type;status;root;#t;constructor(t,e){this.#t=Object.freeze(t.logs.map(a=>new Qt(a,e)));let r=Io;t.effectiveGasPrice!=null?r=t.effectiveGasPrice:t.gasPrice!=null&&(r=t.gasPrice),v(this,{provider:e,to:t.to,from:t.from,contractAddress:t.contractAddress,hash:t.hash,index:t.index,blockHash:t.blockHash,blockNumber:t.blockNumber,logsBloom:t.logsBloom,gasUsed:t.gasUsed,cumulativeGasUsed:t.cumulativeGasUsed,blobGasUsed:t.blobGasUsed,gasPrice:r,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return this.#t}toJSON(){let{to:t,from:e,contractAddress:r,hash:a,index:s,blockHash:o,blockNumber:l,logsBloom:u,logs:p,status:d,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:l,contractAddress:r,cumulativeGasUsed:ft(this.cumulativeGasUsed),from:e,gasPrice:ft(this.gasPrice),blobGasUsed:ft(this.blobGasUsed),blobGasPrice:ft(this.blobGasPrice),gasUsed:ft(this.gasUsed),hash:a,index:s,logs:p,logsBloom:u,root:f,status:d,to:t}}get length(){return this.logs.length}[Symbol.iterator](){let t=0;return{next:i(()=>t<this.length?{value:this.logs[t++],done:!1}:{value:void 0,done:!0},"next")}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){let t=await this.provider.getBlock(this.blockHash);if(t==null)throw new Error("TODO");return t}async getTransaction(){let t=await this.provider.getTransaction(this.hash);if(t==null)throw new Error("TODO");return t}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return No(this)}reorderedEvent(t){return w(!t||t.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),Bo(this,t)}},Xn=class n{static{i(this,"TransactionResponse")}provider;blockNumber;blockHash;index;hash;type;to;from;nonce;gasLimit;gasPrice;maxPriorityFeePerGas;maxFeePerGas;maxFeePerBlobGas;data;value;chainId;signature;accessList;blobVersionedHashes;#t;constructor(t,e){this.provider=e,this.blockNumber=t.blockNumber!=null?t.blockNumber:null,this.blockHash=t.blockHash!=null?t.blockHash:null,this.hash=t.hash,this.index=t.index,this.type=t.type,this.from=t.from,this.to=t.to||null,this.gasLimit=t.gasLimit,this.nonce=t.nonce,this.data=t.data,this.value=t.value,this.gasPrice=t.gasPrice,this.maxPriorityFeePerGas=t.maxPriorityFeePerGas!=null?t.maxPriorityFeePerGas:null,this.maxFeePerGas=t.maxFeePerGas!=null?t.maxFeePerGas:null,this.maxFeePerBlobGas=t.maxFeePerBlobGas!=null?t.maxFeePerBlobGas:null,this.chainId=t.chainId,this.signature=t.signature,this.accessList=t.accessList!=null?t.accessList:null,this.blobVersionedHashes=t.blobVersionedHashes!=null?t.blobVersionedHashes:null,this.#t=-1}toJSON(){let{blockNumber:t,blockHash:e,index:r,hash:a,type:s,to:o,from:l,nonce:u,data:p,signature:d,accessList:f,blobVersionedHashes:h}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:t,blockHash:e,blobVersionedHashes:h,chainId:ft(this.chainId),data:p,from:l,gasLimit:ft(this.gasLimit),gasPrice:ft(this.gasPrice),hash:a,maxFeePerGas:ft(this.maxFeePerGas),maxPriorityFeePerGas:ft(this.maxPriorityFeePerGas),maxFeePerBlobGas:ft(this.maxFeePerBlobGas),nonce:u,signature:d,to:o,index:r,type:s,value:ft(this.value)}}async getBlock(){let t=this.blockNumber;if(t==null){let r=await this.getTransaction();r&&(t=r.blockNumber)}if(t==null)return null;let e=this.provider.getBlock(t);if(e==null)throw new Error("TODO");return e}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){let{tx:e,blockNumber:r}=await ve({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return e==null||e.blockNumber==null?0:r-e.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){let r=t??1,a=e??0,s=this.#t,o=-1,l=s===-1,u=i(async()=>{if(l)return null;let{blockNumber:h,nonce:C}=await ve({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(C<this.nonce){s=h;return}if(l)return null;let E=await this.getTransaction();if(!(E&&E.blockNumber!=null))for(o===-1&&(o=s-3,o<this.#t&&(o=this.#t));o<=h;){if(l)return null;let A=await this.provider.getBlock(o,!0);if(A==null)return;for(let S of A)if(S===this.hash)return;for(let S=0;S<A.length;S++){let R=await A.getTransaction(S);if(R.from===this.from&&R.nonce===this.nonce){if(l)return null;let H=await this.provider.getTransactionReceipt(R.hash);if(H==null||h-H.blockNumber+1<r)return;let M="replaced";R.data===this.data&&R.to===this.to&&R.value===this.value?M="repriced":R.data==="0x"&&R.from===R.to&&R.value===Io&&(M="cancelled"),w(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:M==="replaced"||M==="cancelled",reason:M,replacement:R.replaceableTransaction(s),hash:R.hash,receipt:H})}}o++}},"checkReplacement"),p=i(h=>{if(h==null||h.status!==0)return h;w(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:h.to,from:h.from,data:""},receipt:h})},"checkReceipt"),d=await this.provider.getTransactionReceipt(this.hash);if(r===0)return p(d);if(d){if(await d.confirmations()>=r)return p(d)}else if(await u(),r===0)return null;return await new Promise((h,C)=>{let E=[],A=i(()=>{E.forEach(R=>R())},"cancel");if(E.push(()=>{l=!0}),a>0){let R=setTimeout(()=>{A(),C(Bt("wait for transaction timeout","TIMEOUT"))},a);E.push(()=>{clearTimeout(R)})}let S=i(async R=>{if(await R.confirmations()>=r){A();try{h(p(R))}catch(H){C(H)}}},"txListener");if(E.push(()=>{this.provider.off(this.hash,S)}),this.provider.on(this.hash,S),s>=0){let R=i(async()=>{try{await u()}catch(H){if(wt(H,"TRANSACTION_REPLACED")){A(),C(H);return}}l||this.provider.once("block",R)},"replaceListener");E.push(()=>{this.provider.off("block",R)}),this.provider.once("block",R)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return w(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),No(this)}reorderedEvent(t){return w(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),w(!t||t.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Bo(this,t)}replaceableTransaction(t){m(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);let e=new n(this,this.provider);return e.#t=t,e}};function Bo(n,t){return{orphan:"reorder-transaction",tx:n,other:t}}i(Bo,"createReorderedTransactionFilter");function No(n){return{orphan:"drop-transaction",tx:n}}i(No,"createRemovedTransactionFilter");function Ki(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}i(Ki,"createRemovedLogFilter");var le=class extends Qt{static{i(this,"EventLog")}interface;fragment;args;constructor(t,e,r){super(t,t.provider);let a=e.decodeEventLog(r,t.data,t.topics);v(this,{args:a,fragment:r,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}},De=class extends Qt{static{i(this,"UndecodedEventLog")}error;constructor(t,e){super(t,t.provider),v(this,{error:e})}},Zn=class extends Kn{static{i(this,"ContractTransactionReceipt")}#t;constructor(t,e,r){super(r,e),this.#t=t}get logs(){return super.logs.map(t=>{let e=t.topics.length?this.#t.getEvent(t.topics[0]):null;if(e)try{return new le(t,this.#t,e)}catch(r){return new De(t,r)}return t})}},ue=class extends Xn{static{i(this,"ContractTransactionResponse")}#t;constructor(t,e,r){super(r,e),this.#t=t}async wait(t,e){let r=await super.wait(t,e);return r==null?null:new Zn(this.#t,this.provider,r)}},_e=class extends er{static{i(this,"ContractUnknownEventPayload")}log;constructor(t,e,r,a){super(t,e,r),v(this,{log:a})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}},dr=class extends _e{static{i(this,"ContractEventPayload")}constructor(t,e,r,a,s){super(t,e,r,new le(s,t.interface,a));let o=t.interface.decodeEventLog(a,this.log.data,this.log.topics);v(this,{args:o,fragment:a})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}};var Fo=BigInt(0);function Do(n){return n&&typeof n.call=="function"}i(Do,"canCall");function _o(n){return n&&typeof n.estimateGas=="function"}i(_o,"canEstimate");function qn(n){return n&&typeof n.resolveName=="function"}i(qn,"canResolve");function Lo(n){return n&&typeof n.sendTransaction=="function"}i(Lo,"canSend");function Ho(n){if(n!=null){if(qn(n))return n;if(n.provider)return n.provider}}i(Ho,"getResolver");var Ha=class{static{i(this,"PreparedTopicFilter")}#t;fragment;constructor(t,e,r){if(v(this,{fragment:e}),e.inputs.length<r.length)throw new Error("too many arguments");let a=de(t.runner,"resolveName"),s=qn(a)?a:null;this.#t=async function(){let o=await Promise.all(e.inputs.map((l,u)=>r[u]==null?null:l.walkAsync(r[u],(d,f)=>d==="address"?Array.isArray(f)?Promise.all(f.map(h=>ne(h,s))):ne(f,s):f)));return t.interface.encodeFilterTopics(e,o)}()}getTopicFilter(){return this.#t}};function de(n,t){return n==null?null:typeof n[t]=="function"?n:n.provider&&typeof n.provider[t]=="function"?n.provider:null}i(de,"getRunner");function pe(n){return n==null?null:n.provider||null}i(pe,"getProvider");async function Uo(n,t){let e=J.dereference(n,"overrides");m(typeof e=="object","invalid overrides parameter","overrides",n);let r=Oo(e);return m(r.to==null||(t||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),m(r.data==null||(t||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}i(Uo,"copyOverrides");async function Xi(n,t,e){let r=de(n,"resolveName"),a=qn(r)?r:null;return await Promise.all(t.map((s,o)=>s.walkAsync(e[o],(l,u)=>(u=J.dereference(u,l),l==="address"?ne(u,a):u))))}i(Xi,"resolveArgs");function Zi(n){let t=i(async function(o){let l=await Uo(o,["data"]);l.to=await n.getAddress(),l.from&&(l.from=await ne(l.from,Ho(n.runner)));let u=n.interface,p=I(l.value||Fo,"overrides.value")===Fo,d=(l.data||"0x")==="0x";u.fallback&&!u.fallback.payable&&u.receive&&!d&&!p&&m(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),m(u.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data);let f=u.receive||u.fallback&&u.fallback.payable;return m(f||p,"cannot send value to non-payable fallback","overrides.value",l.value),m(u.fallback||d,"cannot send data to receive-only contract","overrides.data",l.data),l},"populateTransaction"),e=i(async function(o){let l=de(n.runner,"call");w(Do(l),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let u=await t(o);try{return await l.call(u)}catch(p){throw vn(p)&&p.data?n.interface.makeError(p.data,u):p}},"staticCall"),r=i(async function(o){let l=n.runner;w(Lo(l),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let u=await l.sendTransaction(await t(o)),p=pe(n.runner);return new ue(n.interface,p,u)},"send"),a=i(async function(o){let l=de(n.runner,"estimateGas");return w(_o(l),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await l.estimateGas(await t(o))},"estimateGas"),s=i(async o=>await r(o),"method");return v(s,{_contract:n,estimateGas:a,populateTransaction:t,send:r,staticCall:e}),s}i(Zi,"buildWrappedFallback");function Yi(n,t){let e=i(function(...p){let d=n.interface.getFunction(t,p);return w(d,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:p}}),d},"getFragment"),r=i(async function(...p){let d=e(...p),f={};if(d.inputs.length+1===p.length&&(f=await Uo(p.pop()),f.from&&(f.from=await ne(f.from,Ho(n.runner)))),d.inputs.length!==p.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");let h=await Xi(n.runner,d.inputs,p);return Object.assign({},f,await ve({to:n.getAddress(),data:n.interface.encodeFunctionData(d,h)}))},"populateTransaction"),a=i(async function(...p){let d=await l(...p);return d.length===1?d[0]:d},"staticCall"),s=i(async function(...p){let d=n.runner;w(Lo(d),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let f=await d.sendTransaction(await r(...p)),h=pe(n.runner);return new ue(n.interface,h,f)},"send"),o=i(async function(...p){let d=de(n.runner,"estimateGas");return w(_o(d),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await d.estimateGas(await r(...p))},"estimateGas"),l=i(async function(...p){let d=de(n.runner,"call");w(Do(d),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let f;try{f=await r(...p)}catch(E){let A=p.at(-1).blockTag;throw A&&(E.blockNumber=A),E}let h="0x";try{h=await d.call(f)}catch(E){throw vn(E)&&E.data?n.interface.makeError(E.data,f):E}let C=e(...p);return n.interface.decodeFunctionResult(C,h)},"staticCallResult"),u=i(async(...p)=>e(...p).constant?await a(...p):await s(...p),"method");return v(u,{name:n.interface.getFunctionName(t),_contract:n,_key:t,getFragment:e,estimateGas:o,populateTransaction:r,send:s,staticCall:a,staticCallResult:l}),Object.defineProperty(u,"fragment",{configurable:!1,enumerable:!0,get:i(()=>{let p=n.interface.getFunction(t);return w(p,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),p},"get")}),u}i(Yi,"buildWrappedMethod");function Qi(n,t){let e=i(function(...a){let s=n.interface.getEvent(t,a);return w(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:a}}),s},"getFragment"),r=i(function(...a){return new Ha(n,e(...a),a)},"method");return v(r,{name:n.interface.getEventName(t),_contract:n,_key:t,getFragment:e}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:i(()=>{let a=n.interface.getEvent(t);return w(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),a},"get")}),r}i(Qi,"buildWrappedEvent");var Qn=Symbol.for("_ethersInternal_contract"),Vo=new WeakMap;function qi(n,t){Vo.set(n[Qn],t)}i(qi,"setInternal");function pt(n){return Vo.get(n[Qn])}i(pt,"getInternal");function tc(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}i(tc,"isDeferred");async function Ma(n,t){let e,r=null;if(Array.isArray(t)){let s=i(function(o){if(Y(o,32))return o;let l=n.interface.getEvent(o);return m(l,"unknown fragment","name",o),l.topicHash},"topicHashify");e=t.map(o=>o==null?null:Array.isArray(o)?o.map(s):s(o))}else t==="*"?e=[null]:typeof t=="string"?Y(t,32)?e=[t]:(r=n.interface.getEvent(t),m(r,"unknown fragment","event",t),e=[r.topicHash]):tc(t)?e=await t.getTopicFilter():"fragment"in t?(r=t.fragment,e=[r.topicHash]):m(!1,"unknown event name","event",t);e=e.map(s=>{if(s==null)return null;if(Array.isArray(s)){let o=Array.from(new Set(s.map(l=>l.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return s.toLowerCase()});let a=e.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:r,tag:a,topics:e}}i(Ma,"getSubInfo");async function fr(n,t){let{subs:e}=pt(n);return e.get((await Ma(n,t)).tag)||null}i(fr,"hasSub");async function So(n,t,e){let r=pe(n.runner);w(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:t});let{fragment:a,tag:s,topics:o}=await Ma(n,e),{addr:l,subs:u}=pt(n),p=u.get(s);if(!p){let f={address:l||n,topics:o},h=i(S=>{let R=a;if(R==null)try{R=n.interface.getEvent(S.topics[0])}catch{}if(R){let H=R,M=a?n.interface.decodeEventLog(a,S.data,S.topics):[];Va(n,e,M,Mt=>new dr(n,Mt,e,H,S))}else Va(n,e,[],H=>new _e(n,H,e,S))},"listener"),C=[];p={tag:s,listeners:[],start:i(()=>{C.length||C.push(r.on(f,h))},"start"),stop:i(async()=>{if(C.length==0)return;let S=C;C=[],await Promise.all(S),r.off(f,h)},"stop")},u.set(s,p)}return p}i(So,"getSub");var Ua=Promise.resolve();async function ec(n,t,e,r){await Ua;let a=await fr(n,t);if(!a)return!1;let s=a.listeners.length;return a.listeners=a.listeners.filter(({listener:o,once:l})=>{let u=Array.from(e);r&&u.push(r(l?null:o));try{o.call(n,...u)}catch{}return!l}),a.listeners.length===0&&(a.stop(),pt(n).subs.delete(a.tag)),s>0}i(ec,"_emit");async function Va(n,t,e,r){try{await Ua}catch{}let a=ec(n,t,e,r);return Ua=a,await a}i(Va,"emit");var Yn=["then"],fe=class n{static{i(this,"BaseContract")}target;interface;runner;filters;[Qn];fallback;constructor(t,e,r,a){m(typeof t=="string"||Dn(t),"invalid value for Contract target","target",t),r==null&&(r=null);let s=St.from(e);v(this,{target:t,runner:r,interface:s}),Object.defineProperty(this,Qn,{value:{}});let o,l=null,u=null;if(a){let f=pe(r);u=new ue(this.interface,f,a)}let p=new Map;if(typeof t=="string")if(Y(t))l=t,o=Promise.resolve(t);else{let f=de(r,"resolveName");if(!qn(f))throw Bt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(t).then(h=>{if(h==null)throw Bt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return pt(this).addr=h,h})}else o=t.getAddress().then(f=>{if(f==null)throw new Error("TODO");return pt(this).addr=f,f});qi(this,{addrPromise:o,addr:l,deployTx:u,subs:p});let d=new Proxy({},{get:i((f,h,C)=>{if(typeof h=="symbol"||Yn.indexOf(h)>=0)return Reflect.get(f,h,C);try{return this.getEvent(h)}catch(E){if(!wt(E,"INVALID_ARGUMENT")||E.argument!=="key")throw E}},"get"),has:i((f,h)=>Yn.indexOf(h)>=0?Reflect.has(f,h):Reflect.has(f,h)||this.interface.hasEvent(String(h)),"has")});return v(this,{filters:d}),v(this,{fallback:s.receive||s.fallback?Zi(this):null}),new Proxy(this,{get:i((f,h,C)=>{if(typeof h=="symbol"||h in f||Yn.indexOf(h)>=0)return Reflect.get(f,h,C);try{return f.getFunction(h)}catch(E){if(!wt(E,"INVALID_ARGUMENT")||E.argument!=="key")throw E}},"get"),has:i((f,h)=>typeof h=="symbol"||h in f||Yn.indexOf(h)>=0?Reflect.has(f,h):f.interface.hasFunction(h),"has")})}connect(t){return new n(this.target,this.interface,t)}attach(t){return new n(t,this.interface,this.runner)}async getAddress(){return await pt(this).addrPromise}async getDeployedCode(){let t=pe(this.runner);w(t,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});let e=await t.getCode(await this.getAddress());return e==="0x"?null:e}async waitForDeployment(){let t=this.deploymentTransaction();if(t)return await t.wait(),this;if(await this.getDeployedCode()!=null)return this;let r=pe(this.runner);return w(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((a,s)=>{let o=i(async()=>{try{if(await this.getDeployedCode()!=null)return a(this);r.once("block",o)}catch(l){s(l)}},"checkCode");o()})}deploymentTransaction(){return pt(this).deployTx}getFunction(t){return typeof t!="string"&&(t=t.format()),Yi(this,t)}getEvent(t){return typeof t!="string"&&(t=t.format()),Qi(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,r){e==null&&(e=0),r==null&&(r="latest");let{addr:a,addrPromise:s}=pt(this),o=a||await s,{fragment:l,topics:u}=await Ma(this,t),p={address:o,topics:u,fromBlock:e,toBlock:r},d=pe(this.runner);return w(d,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await d.getLogs(p)).map(f=>{let h=l;if(h==null)try{h=this.interface.getEvent(f.topics[0])}catch{}if(h)try{return new le(f,this.interface,h)}catch(C){return new De(f,C)}return new Qt(f,d)})}async on(t,e){let r=await So(this,"on",t);return r.listeners.push({listener:e,once:!1}),r.start(),this}async once(t,e){let r=await So(this,"once",t);return r.listeners.push({listener:e,once:!0}),r.start(),this}async emit(t,...e){return await Va(this,t,e,null)}async listenerCount(t){if(t){let a=await fr(this,t);return a?a.listeners.length:0}let{subs:e}=pt(this),r=0;for(let{listeners:a}of e.values())r+=a.length;return r}async listeners(t){if(t){let a=await fr(this,t);return a?a.listeners.map(({listener:s})=>s):[]}let{subs:e}=pt(this),r=[];for(let{listeners:a}of e.values())r=r.concat(a.map(({listener:s})=>s));return r}async off(t,e){let r=await fr(this,t);if(!r)return this;if(e){let a=r.listeners.map(({listener:s})=>s).indexOf(e);a>=0&&r.listeners.splice(a,1)}return(e==null||r.listeners.length===0)&&(r.stop(),pt(this).subs.delete(r.tag)),this}async removeAllListeners(t){if(t){let e=await fr(this,t);if(!e)return this;e.stop(),pt(this).subs.delete(e.tag)}else{let{subs:e}=pt(this);for(let{tag:r,stop:a}of e.values())a(),e.delete(r)}return this}async addListener(t,e){return await this.on(t,e)}async removeListener(t,e){return await this.off(t,e)}static buildClass(t){class e extends n{static{i(this,"CustomContract")}constructor(a,s=null){super(a,t,s)}}return e}static from(t,e,r){return r==null&&(r=null),new this(t,e,r)}};function rc(){return fe}i(rc,"_ContractBase");var Le=class extends rc(){static{i(this,"Contract")}};var Mo=BigInt(0);function B(n,t){return function(e){return e==null?t:n(e)}}i(B,"allowNull");function He(n,t){return e=>{if(t&&e==null)return null;if(!Array.isArray(e))throw new Error("not an array");return e.map(r=>n(r))}}i(He,"arrayOf");function he(n,t){return e=>{let r={};for(let a in n){let s=a;if(t&&a in t&&!(s in e)){for(let o of t[a])if(o in e){s=o;break}}try{let o=n[a](e[s]);o!==void 0&&(r[a]=o)}catch(o){let l=o instanceof Error?o.message:"not-an-error";w(!1,`invalid value for value.${a} (${l})`,"BAD_DATA",{value:e})}}return r}}i(he,"object");function nc(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}m(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}i(nc,"formatBoolean");function qt(n){return m(Y(n,!0),"invalid data","value",n),n}i(qt,"formatData");function tt(n){return m(Y(n,32),"invalid hash","value",n),n}i(tt,"formatHash");var ac=he({address:$,blockHash:tt,blockNumber:_,data:qt,index:_,removed:B(nc,!1),topics:He(tt),transactionHash:tt,transactionIndex:_},{index:["logIndex"]});function Go(n){return ac(n)}i(Go,"formatLog");var sc=he({hash:B(tt),parentHash:tt,parentBeaconBlockRoot:B(tt,null),number:_,timestamp:_,nonce:B(qt),difficulty:I,gasLimit:I,gasUsed:I,stateRoot:B(tt,null),receiptsRoot:B(tt,null),blobGasUsed:B(I,null),excessBlobGas:B(I,null),miner:B($),prevRandao:B(tt,null),extraData:qt,baseFeePerGas:B(I)},{prevRandao:["mixHash"]});function $o(n){let t=sc(n);return t.transactions=n.transactions.map(e=>typeof e=="string"?e:$a(e)),t}i($o,"formatBlock");var oc=he({transactionIndex:_,blockNumber:_,transactionHash:tt,address:$,topics:He(tt),data:qt,index:_,blockHash:tt},{index:["logIndex"]});function Ga(n){return oc(n)}i(Ga,"formatReceiptLog");var Id=he({to:B($,null),from:B($,null),contractAddress:B($,null),index:_,root:B(D),gasUsed:I,blobGasUsed:B(I,null),logsBloom:B(qt),blockHash:tt,hash:tt,logs:He(Ga),blockNumber:_,cumulativeGasUsed:I,effectiveGasPrice:B(I),blobGasPrice:B(I,null),status:B(_),type:B(_,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function $a(n){n.to&&I(n.to)===Mo&&(n.to="0x0000000000000000000000000000000000000000");let t=he({hash:tt,index:B(_,void 0),type:i(e=>e==="0x"||e==null?0:_(e),"type"),accessList:B(or,null),blobVersionedHashes:B(He(tt,!0),null),blockHash:B(tt,null),blockNumber:B(_,null),transactionIndex:B(_,null),from:$,gasPrice:B(I),maxPriorityFeePerGas:B(I),maxFeePerGas:B(I),maxFeePerBlobGas:B(I,null),gasLimit:I,to:B($,null),value:I,nonce:_,data:qt,creates:B($,null),chainId:B(I,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(t.to==null&&t.creates==null&&(t.creates=Oa(t)),(n.type===1||n.type===2)&&n.accessList==null&&(t.accessList=[]),n.signature?t.signature=Be.from(n.signature):t.signature=Be.from(n),t.chainId==null){let e=t.signature.legacyChainId;e!=null&&(t.chainId=e)}return t.blockHash&&I(t.blockHash)===Mo&&(t.blockHash=null),t}i($a,"formatTransactionResponse");var hr=class extends Error{static{i(this,"SimpleEthersError")}e;constructor(t,e,r){super(t),this.stack=r}toString(){return this.message+`
|
|
3
3
|
`+this.stack?.toString()}};function U(n,t,e){if(n instanceof hr)return n;let r="Check here for possible cause and fix: https://docs.sentio.xyz/docs/handling-errors#ethers-error",a="",s=n;return s.code==="CALL_EXCEPTION"||s.code==="BAD_DATA"?s.data==="0x"?(t?a=`jsonrpc eth_call return '0x' (likely contract not existed) at chain ${t.chainId}, ${r}:
|
|
4
4
|
${n.message}`:a=`jsonrpc eth_call return '0x' (likely contract not existed), ${r}:
|
|
5
5
|
${n.message}`,new hr(a,s,e)):new hr(`eth call error ${s.message}, ${r}:
|
|
@@ -29,4 +29,4 @@ js-sha3/src/sha3.js:
|
|
|
29
29
|
@noble/hashes/esm/utils.js:
|
|
30
30
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
31
31
|
*/
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-SQBMMGFT.js.map
|