@sentio/sdk-bundle 2.41.4 → 2.41.5
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/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-SDJOH3KH.js → chunk-3C4YSA42.js} +2 -2
- package/lib/{chunk-QRNQPRH4.js → chunk-3KK6D6YO.js} +2 -2
- package/lib/{chunk-7IA5RTOB.js → chunk-4ACVSPIF.js} +2 -2
- package/lib/{chunk-GPETITBA.js → chunk-4QS3NUUW.js} +2 -2
- package/lib/{chunk-WL4SNWT6.js → chunk-BVDLKPY7.js} +2 -2
- package/lib/{chunk-63HPJECU.js → chunk-CJVPUD6U.js} +2 -2
- package/lib/{chunk-5WEQ4PSE.js → chunk-CSVBDVD7.js} +2 -2
- package/lib/{chunk-JGYBNJHX.js → chunk-JTQMVYTS.js} +9 -9
- package/lib/{chunk-JGYBNJHX.js.map → chunk-JTQMVYTS.js.map} +1 -1
- package/lib/{chunk-KY7NG4ER.js → chunk-KY5AFKV5.js} +2 -2
- package/lib/{chunk-RYFT36S5.js → chunk-LCUGDGMN.js} +2 -2
- package/lib/{chunk-5WM5D6EI.js → chunk-MGIOFRXM.js} +2 -2
- package/lib/{chunk-R7S4ZNCQ.js → chunk-PSYYSAEX.js} +2 -2
- package/lib/{chunk-EL6CQHDY.js → chunk-RDBX2EIJ.js} +2 -2
- package/lib/{chunk-SPZVAGFS.js → chunk-VEVTWG5S.js} +2 -2
- package/lib/{chunk-G6D6EDWO.js → chunk-VM5J6G66.js} +2 -2
- package/lib/{chunk-T5A3YPP2.js → chunk-X7K74U6O.js} +2 -2
- package/lib/{chunk-WGFT7DSU.js → chunk-XYISSQEU.js} +2 -2
- package/lib/{chunk-IQNZE4RM.js → chunk-XZRRBRMQ.js} +2 -2
- 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/codegen/index.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-SDJOH3KH.js.map → chunk-3C4YSA42.js.map} +0 -0
- /package/lib/{chunk-QRNQPRH4.js.map → chunk-3KK6D6YO.js.map} +0 -0
- /package/lib/{chunk-7IA5RTOB.js.map → chunk-4ACVSPIF.js.map} +0 -0
- /package/lib/{chunk-GPETITBA.js.map → chunk-4QS3NUUW.js.map} +0 -0
- /package/lib/{chunk-WL4SNWT6.js.map → chunk-BVDLKPY7.js.map} +0 -0
- /package/lib/{chunk-63HPJECU.js.map → chunk-CJVPUD6U.js.map} +0 -0
- /package/lib/{chunk-5WEQ4PSE.js.map → chunk-CSVBDVD7.js.map} +0 -0
- /package/lib/{chunk-KY7NG4ER.js.map → chunk-KY5AFKV5.js.map} +0 -0
- /package/lib/{chunk-RYFT36S5.js.map → chunk-LCUGDGMN.js.map} +0 -0
- /package/lib/{chunk-5WM5D6EI.js.map → chunk-MGIOFRXM.js.map} +0 -0
- /package/lib/{chunk-R7S4ZNCQ.js.map → chunk-PSYYSAEX.js.map} +0 -0
- /package/lib/{chunk-EL6CQHDY.js.map → chunk-RDBX2EIJ.js.map} +0 -0
- /package/lib/{chunk-SPZVAGFS.js.map → chunk-VEVTWG5S.js.map} +0 -0
- /package/lib/{chunk-G6D6EDWO.js.map → chunk-VM5J6G66.js.map} +0 -0
- /package/lib/{chunk-T5A3YPP2.js.map → chunk-X7K74U6O.js.map} +0 -0
- /package/lib/{chunk-WGFT7DSU.js.map → chunk-XYISSQEU.js.map} +0 -0
- /package/lib/{chunk-IQNZE4RM.js.map → chunk-XZRRBRMQ.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 va}from"./chunk-2GOCSOX5.js";import{a as Se}from"./chunk-7HVQTJAO.js";import{A as zn,Ab as jt,D as ot,Hc as Xn,W as Jn,bd as $r,fa as Gr,gd as dn,oa as it,pc as Fe,xb as fe}from"./chunk-JGYBNJHX.js";import{d as Mr,e as vt,g as M}from"./chunk-LLHU72AA.js";var Zo={};Mr(Zo,{ERC721BoundContractView:()=>un,ERC721ContractView:()=>jn,ERC721Processor:()=>kt,ERC721ProcessorTemplate:()=>Hr,ERC721__factory:()=>bt,getERC721Contract:()=>de,getERC721ContractOnContext:()=>jo,mockApprovalForAllLog:()=>Jo,mockApprovalLog:()=>zo,mockTransferLog:()=>Xo});var Wr="6.13.1";function Pa(s,t,e){let n=t.split("|").map(a=>a.trim());for(let a=0;a<n.length;a++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof s===t)return}let r=new Error(`invalid value for type ${t}`);throw r.code="INVALID_ARGUMENT",r.argument=`value.${e}`,r.value=s,r}async function he(s){let t=Object.keys(s);return(await Promise.all(t.map(n=>Promise.resolve(s[n])))).reduce((n,r,a)=>(n[t[a]]=r,n),{})}function C(s,t,e){for(let n in t){let r=t[n],a=e?e[n]:null;a&&Pa(r,a,n),Object.defineProperty(s,n,{enumerable:!0,value:r,writable:!1})}}function me(s){if(s==null)return"null";if(Array.isArray(s))return"[ "+s.map(me).join(", ")+" ]";if(s instanceof Uint8Array){let t="0123456789abcdef",e="0x";for(let n=0;n<s.length;n++)e+=t[s[n]>>4],e+=t[s[n]&15];return e}if(typeof s=="object"&&typeof s.toJSON=="function")return me(s.toJSON());switch(typeof s){case"boolean":case"symbol":return s.toString();case"bigint":return BigInt(s).toString();case"number":return s.toString();case"string":return JSON.stringify(s);case"object":{let t=Object.keys(s);return t.sort(),"{ "+t.map(e=>`${me(e)}: ${me(s[e])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function xt(s,t){return s&&s.code===t}function pn(s){return xt(s,"CALL_EXCEPTION")}function Pt(s,t,e){let n=s;{let a=[];if(e){if("message"in e||"code"in e||"name"in e)throw new Error(`value will overwrite populated values: ${me(e)}`);for(let o in e){if(o==="shortMessage")continue;let i=e[o];a.push(o+"="+me(i))}}a.push(`code=${t}`),a.push(`version=${Wr}`),a.length&&(s+=" ("+a.join(", ")+")")}let r;switch(t){case"INVALID_ARGUMENT":r=new TypeError(s);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(s);break;default:r=new Error(s)}return C(r,{code:t}),e&&Object.assign(r,e),r.shortMessage==null&&C(r,{shortMessage:n}),r}function y(s,t,e,n){if(!s)throw Pt(t,e,n)}function f(s,t,e,n){y(s,t,"INVALID_ARGUMENT",{argument:e,value:n})}function Le(s,t,e){e==null&&(e=""),e&&(e=": "+e),y(s>=t,"missing arguemnt"+e,"MISSING_ARGUMENT",{count:s,expectedCount:t}),y(s<=t,"too many arguments"+e,"UNEXPECTED_ARGUMENT",{count:s,expectedCount:t})}var Ra=["NFD","NFC","NFKD","NFKC"].reduce((s,t)=>{try{if("test".normalize(t)!=="test")throw new Error("bad");if(t==="NFD"){let e=String.fromCharCode(233).normalize("NFD"),n=String.fromCharCode(101,769);if(e!==n)throw new Error("broken")}s.push(t)}catch{}return s},[]);function Zn(s){y(Ra.indexOf(s)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:s}})}function _t(s,t,e){if(e==null&&(e=""),s!==t){let n=e,r="new";e&&(n+=".",r+=" "+e),y(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:r})}}function jr(s,t,e){if(s instanceof Uint8Array)return e?new Uint8Array(s):s;if(typeof s=="string"&&s.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){let n=new Uint8Array((s.length-2)/2),r=2;for(let a=0;a<n.length;a++)n[a]=parseInt(s.substring(r,r+2),16),r+=2;return n}f(!1,"invalid BytesLike value",t||"value",s)}function V(s,t){return jr(s,t,!1)}function q(s,t){return jr(s,t,!0)}function $(s,t){return!(typeof s!="string"||!s.match(/^0x[0-9A-Fa-f]*$/)||typeof t=="number"&&s.length!==2+2*t||t===!0&&s.length%2!==0)}function Yn(s){return $(s,!0)||s instanceof Uint8Array}var Kr="0123456789abcdef";function P(s){let t=V(s),e="0x";for(let n=0;n<t.length;n++){let r=t[n];e+=Kr[(r&240)>>4]+Kr[r&15]}return e}function ct(s){return"0x"+s.map(t=>P(t).substring(2)).join("")}function fn(s){return $(s,!0)?(s.length-2)/2:V(s).length}function Ct(s,t,e){let n=V(s);return e!=null&&e>n.length&&y(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:e}),P(n.slice(t??0,e??n.length))}function zr(s,t,e){let n=V(s);y(t>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:t,offset:t+1});let r=new Uint8Array(t);return r.fill(0),e?r.set(n,t-n.length):r.set(n,0),P(r)}function ge(s,t){return zr(s,t,!0)}function hn(s,t){return zr(s,t,!1)}var mn=BigInt(0),pt=BigInt(1),ye=9007199254740991;function Qn(s,t){let e=De(s,"value"),n=BigInt(R(t,"width"));if(y(e>>n===mn,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:s}),e>>n-pt){let r=(pt<<n)-pt;return-((~e&r)+pt)}return e}function qn(s,t){let e=T(s,"value"),n=BigInt(R(t,"width")),r=pt<<n-pt;if(e<mn){e=-e,y(e<=r,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:s});let a=(pt<<n)-pt;return(~e&a)+pt}else y(e<r,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:s});return e}function be(s,t){let e=De(s,"value"),n=BigInt(R(t,"bits"));return e&(pt<<n)-pt}function T(s,t){switch(typeof s){case"bigint":return s;case"number":return f(Number.isInteger(s),"underflow",t||"value",s),f(s>=-ye&&s<=ye,"overflow",t||"value",s),BigInt(s);case"string":try{if(s==="")throw new Error("empty string");return s[0]==="-"&&s[1]!=="-"?-BigInt(s.substring(1)):BigInt(s)}catch(e){f(!1,`invalid BigNumberish string: ${e.message}`,t||"value",s)}}f(!1,"invalid BigNumberish value",t||"value",s)}function De(s,t){let e=T(s,t);return y(e>=mn,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:s}),e}var Jr="0123456789abcdef";function gn(s){if(s instanceof Uint8Array){let t="0x0";for(let e of s)t+=Jr[e>>4],t+=Jr[e&15];return BigInt(t)}return T(s)}function R(s,t){switch(typeof s){case"bigint":return f(s>=-ye&&s<=ye,"overflow",t||"value",s),Number(s);case"number":return f(Number.isInteger(s),"underflow",t||"value",s),f(s>=-ye&&s<=ye,"overflow",t||"value",s),s;case"string":try{if(s==="")throw new Error("empty string");return R(BigInt(s),t)}catch(e){f(!1,`invalid numeric string: ${e.message}`,t||"value",s)}}f(!1,"invalid numeric value",t||"value",s)}function tr(s){return R(gn(s))}function _e(s,t){let n=De(s,"value").toString(16);if(t==null)n.length%2&&(n="0"+n);else{let r=R(t,"width");for(y(r*2>=n.length,`value exceeds width (${r} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:s});n.length<r*2;)n="0"+n}return"0x"+n}function He(s){let t=De(s,"value");if(t===mn)return new Uint8Array([]);let e=t.toString(16);e.length%2&&(e="0"+e);let n=new Uint8Array(e.length/2);for(let r=0;r<n.length;r++){let a=r*2;n[r]=parseInt(e.substring(a,a+2),16)}return n}var Ue=class{filter;emitter;#t;constructor(t,e,n){this.#t=e,C(this,{emitter:t,filter:n})}async removeListener(){this.#t!=null&&await this.emitter.off(this.filter,this.#t)}};function Aa(s,t,e,n,r){f(!1,`invalid codepoint at offset ${t}; ${s}`,"bytes",e)}function Xr(s,t,e,n,r){if(s==="BAD_PREFIX"||s==="UNEXPECTED_CONTINUE"){let a=0;for(let o=t+1;o<e.length&&e[o]>>6===2;o++)a++;return a}return s==="OVERRUN"?e.length-t-1:0}function Ia(s,t,e,n,r){return s==="OVERLONG"?(f(typeof r=="number","invalid bad code point for replacement","badCodepoint",r),n.push(r),0):(n.push(65533),Xr(s,t,e,n,r))}var Zr=Object.freeze({error:Aa,ignore:Xr,replace:Ia});function Oa(s,t){t==null&&(t=Zr.error);let e=V(s,"bytes"),n=[],r=0;for(;r<e.length;){let a=e[r++];if(!(a>>7)){n.push(a);continue}let o=null,i=null;if((a&224)===192)o=1,i=127;else if((a&240)===224)o=2,i=2047;else if((a&248)===240)o=3,i=65535;else{(a&192)===128?r+=t("UNEXPECTED_CONTINUE",r-1,e,n):r+=t("BAD_PREFIX",r-1,e,n);continue}if(r-1+o>=e.length){r+=t("OVERRUN",r-1,e,n);continue}let c=a&(1<<8-o-1)-1;for(let l=0;l<o;l++){let u=e[r];if((u&192)!=128){r+=t("MISSING_CONTINUE",r,e,n),c=null;break}c=c<<6|u&63,r++}if(c!==null){if(c>1114111){r+=t("OUT_OF_RANGE",r-1-o,e,n,c);continue}if(c>=55296&&c<=57343){r+=t("UTF16_SURROGATE",r-1-o,e,n,c);continue}if(c<=i){r+=t("OVERLONG",r-1-o,e,n,c);continue}n.push(c)}}return n}function xe(s,t){f(typeof s=="string","invalid string value","str",s),t!=null&&(Zn(t),s=s.normalize(t));let e=[];for(let n=0;n<s.length;n++){let r=s.charCodeAt(n);if(r<128)e.push(r);else if(r<2048)e.push(r>>6|192),e.push(r&63|128);else if((r&64512)==55296){n++;let a=s.charCodeAt(n);f(n<s.length&&(a&64512)===56320,"invalid surrogate pair","str",s);let o=65536+((r&1023)<<10)+(a&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(r>>12|224),e.push(r>>6&63|128),e.push(r&63|128)}return new Uint8Array(e)}function Na(s){return s.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function Ve(s,t){return Na(Oa(s,t))}function Yr(s){let t=[];for(;s;)t.unshift(s&255),s>>=8;return t}function qr(s){if(Array.isArray(s)){let n=[];if(s.forEach(function(a){n=n.concat(qr(a))}),n.length<=55)return n.unshift(192+n.length),n;let r=Yr(n.length);return r.unshift(247+r.length),r.concat(n)}let t=Array.prototype.slice.call(V(s,"object"));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;let e=Yr(t.length);return e.unshift(183+e.length),e.concat(t)}var Qr="0123456789abcdef";function er(s){let t="0x";for(let e of qr(s))t+=Qr[e>>4],t+=Qr[e&15];return t}var J=32,nr=new Uint8Array(J),Ba=["then"],yn={},ns=new WeakMap;function zt(s){return ns.get(s)}function ts(s,t){ns.set(s,t)}function Me(s,t){let e=new Error(`deferred error during ABI decoding triggered accessing ${s}`);throw e.error=t,e}function rr(s,t,e){return s.indexOf(null)>=0?t.map((n,r)=>n instanceof X?rr(zt(n),n,e):n):s.reduce((n,r,a)=>{let o=t.getValue(r);return r in n||(e&&o instanceof X&&(o=rr(zt(o),o,e)),n[r]=o),n},{})}var X=class extends Array{#t;constructor(...t){let e=t[0],n=t[1],r=(t[2]||[]).slice(),a=!0;e!==yn&&(n=t,r=[],a=!1),super(n.length),n.forEach((c,l)=>{this[l]=c});let o=r.reduce((c,l)=>(typeof l=="string"&&c.set(l,(c.get(l)||0)+1),c),new Map);if(ts(this,Object.freeze(n.map((c,l)=>{let u=r[l];return u!=null&&o.get(u)===1?u:null}))),this.#t=[],this.#t==null&&this.#t,!a)return;Object.freeze(this);let i=new Proxy(this,{get:(c,l,u)=>{if(typeof l=="string"){if(l.match(/^[0-9]+$/)){let p=R(l,"%index");if(p<0||p>=this.length)throw new RangeError("out of result range");let h=c[p];return h instanceof Error&&Me(`index ${p}`,h),h}if(Ba.indexOf(l)>=0)return Reflect.get(c,l,u);let d=c[l];if(d instanceof Function)return function(...p){return d.apply(this===u?c:this,p)};if(!(l in c))return c.getValue.apply(this===u?c:this,[l])}return Reflect.get(c,l,u)}});return ts(i,zt(this)),i}toArray(t){let e=[];return this.forEach((n,r)=>{n instanceof Error&&Me(`index ${r}`,n),t&&n instanceof X&&(n=n.toArray(t)),e.push(n)}),e}toObject(t){let e=zt(this);return e.reduce((n,r,a)=>(y(r!=null,`value at index ${a} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),rr(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 n=zt(this),r=[],a=[];for(let o=t;o<e;o++)r.push(this[o]),a.push(n[o]);return new X(yn,r,a)}filter(t,e){let n=zt(this),r=[],a=[];for(let o=0;o<this.length;o++){let i=this[o];i instanceof Error&&Me(`index ${o}`,i),t.call(e,i,o,this)&&(r.push(i),a.push(n[o]))}return new X(yn,r,a)}map(t,e){let n=[];for(let r=0;r<this.length;r++){let a=this[r];a instanceof Error&&Me(`index ${r}`,a),n.push(t.call(e,a,r,this))}return n}getValue(t){let e=zt(this).indexOf(t);if(e===-1)return;let n=this[e];return n instanceof Error&&Me(`property ${JSON.stringify(t)}`,n.error),n}static fromItems(t,e){return new X(yn,t,e)}};function es(s){let t=He(s);return y(t.length<=J,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:J,offset:t.length}),t.length!==J&&(t=q(ct([nr.slice(t.length%J),t]))),t}var W=class{name;type;localName;dynamic;constructor(t,e,n,r){C(this,{name:t,type:e,localName:n,dynamic:r},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){f(!1,t,this.localName,e)}},Jt=class{#t;#e;constructor(){this.#t=[],this.#e=0}get data(){return ct(this.#t)}get length(){return this.#e}#n(t){return this.#t.push(t),this.#e+=t.length,t.length}appendWriter(t){return this.#n(q(t.data))}writeBytes(t){let e=q(t),n=e.length%J;return n&&(e=q(ct([e,nr.slice(n)]))),this.#n(e)}writeValue(t){return this.#n(es(t))}writeUpdatableValue(){let t=this.#t.length;return this.#t.push(nr),this.#e+=J,e=>{this.#t[t]=es(e)}}},Ce=class{allowLoose;#t;#e;#n;#r;#s;constructor(t,e,n){C(this,{allowLoose:!!e}),this.#t=q(t),this.#n=0,this.#r=null,this.#s=n??1024,this.#e=0}get data(){return P(this.#t)}get dataLength(){return this.#t.length}get consumed(){return this.#e}get bytes(){return new Uint8Array(this.#t)}#a(t){if(this.#r)return this.#r.#a(t);this.#n+=t,y(this.#s<1||this.#n<=this.#s*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#s} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:q(this.#t),offset:this.#e,length:t,info:{bytesRead:this.#n,dataLength:this.dataLength}})}#o(t,e,n){let r=Math.ceil(e/J)*J;return this.#e+r>this.#t.length&&(this.allowLoose&&n&&this.#e+e<=this.#t.length?r=e:y(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:q(this.#t),length:this.#t.length,offset:this.#e+r})),this.#t.slice(this.#e,this.#e+r)}subReader(t){let e=new Ce(this.#t.slice(this.#e+t),this.allowLoose,this.#s);return e.#r=this,e}readBytes(t,e){let n=this.#o(0,t,!!e);return this.#a(t),this.#e+=n.length,n.slice(0,t)}readValue(){return gn(this.readBytes(J))}readIndex(){return tr(this.readBytes(J))}};function sr(s){if(!Number.isSafeInteger(s)||s<0)throw new Error(`Wrong positive integer: ${s}`)}function ar(s,...t){if(!(s instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(s.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${s.length}`)}function or(s,t=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(t&&s.finished)throw new Error("Hash#digest() has already been called")}function rs(s,t){ar(s);let e=t.outputLen;if(s.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var bn=BigInt(4294967295),ss=BigInt(32);function Fa(s,t=!1){return t?{h:Number(s&bn),l:Number(s>>ss&bn)}:{h:Number(s>>ss&bn)|0,l:Number(s&bn)|0}}function as(s,t=!1){let e=new Uint32Array(s.length),n=new Uint32Array(s.length);for(let r=0;r<s.length;r++){let{h:a,l:o}=Fa(s[r],t);[e[r],n[r]]=[a,o]}return[e,n]}var os=(s,t,e)=>s<<e|t>>>32-e,is=(s,t,e)=>t<<e|s>>>32-e,cs=(s,t,e)=>t<<e-32|s>>>64-e,ls=(s,t,e)=>s<<e-32|t>>>64-e;var Sa=s=>s instanceof Uint8Array;var us=s=>new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4));var La=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!La)throw new Error("Non little-endian hardware is not supported");function Da(s){if(typeof s!="string")throw new Error(`utf8ToBytes expected string, got ${typeof s}`);return new Uint8Array(new TextEncoder().encode(s))}function Cn(s){if(typeof s=="string"&&(s=Da(s)),!Sa(s))throw new Error(`expected Uint8Array, got ${typeof s}`);return s}var xn=class{clone(){return this._cloneInto()}},Ai={}.toString;function ds(s){let t=n=>s().update(Cn(n)).digest(),e=s();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>s(),t}function ps(s){let t=(n,r)=>s(r).update(Cn(n)).digest(),e=s({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>s(n),t}var[ms,gs,ys]=[[],[],[]],_a=BigInt(0),Ge=BigInt(1),Ha=BigInt(2),Ua=BigInt(7),Va=BigInt(256),Ma=BigInt(113);for(let s=0,t=Ge,e=1,n=0;s<24;s++){[e,n]=[n,(2*e+3*n)%5],ms.push(2*(5*n+e)),gs.push((s+1)*(s+2)/2%64);let r=_a;for(let a=0;a<7;a++)t=(t<<Ge^(t>>Ua)*Ma)%Va,t&Ha&&(r^=Ge<<(Ge<<BigInt(a))-Ge);ys.push(r)}var[Ga,$a]=as(ys,!0),fs=(s,t,e)=>e>32?cs(s,t,e):os(s,t,e),hs=(s,t,e)=>e>32?ls(s,t,e):is(s,t,e);function Wa(s,t=24){let e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=s[o]^s[o+10]^s[o+20]^s[o+30]^s[o+40];for(let o=0;o<10;o+=2){let i=(o+8)%10,c=(o+2)%10,l=e[c],u=e[c+1],d=fs(l,u,1)^e[i],p=hs(l,u,1)^e[i+1];for(let h=0;h<50;h+=10)s[o+h]^=d,s[o+h+1]^=p}let r=s[2],a=s[3];for(let o=0;o<24;o++){let i=gs[o],c=fs(r,a,i),l=hs(r,a,i),u=ms[o];r=s[u],a=s[u+1],s[u]=c,s[u+1]=l}for(let o=0;o<50;o+=10){for(let i=0;i<10;i++)e[i]=s[o+i];for(let i=0;i<10;i++)s[o+i]^=~e[(i+2)%10]&e[(i+4)%10]}s[0]^=Ga[n],s[1]^=$a[n]}e.fill(0)}var we=class extends xn{constructor(t,e,n,r=!1,a=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=a,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,sr(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=us(this.state)}keccak(){Wa(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){or(this);let{blockLen:e,state:n}=this;t=Cn(t);let r=t.length;for(let a=0;a<r;){let o=Math.min(e-this.pos,r-a);for(let i=0;i<o;i++)n[this.pos++]^=t[a++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:n,blockLen:r}=this;t[n]^=e,e&128&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){or(this,!1),ar(t),this.finish();let e=this.state,{blockLen:n}=this;for(let r=0,a=t.length;r<a;){this.posOut>=n&&this.keccak();let o=Math.min(n-this.posOut,a-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=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 sr(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:n,outputLen:r,rounds:a,enableXOF:o}=this;return t||(t=new we(e,n,r,o,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}},Ht=(s,t,e)=>ds(()=>new we(t,s,e)),Fi=Ht(6,144,224/8),Si=Ht(6,136,256/8),Li=Ht(6,104,384/8),Di=Ht(6,72,512/8),_i=Ht(1,144,224/8),bs=Ht(1,136,256/8),Hi=Ht(1,104,384/8),Ui=Ht(1,72,512/8),xs=(s,t,e)=>ps((n={})=>new we(t,s,n.dkLen===void 0?e:n.dkLen,!0)),Vi=xs(31,168,128/8),Mi=xs(31,136,256/8);var Cs=!1,ws=function(s){return bs(s)},Ts=ws;function et(s){let t=V(s,"data");return P(Ts(t))}et._=ws;et.lock=function(){Cs=!0};et.register=function(s){if(Cs)throw new TypeError("keccak256 is locked");Ts=s};Object.freeze(et);var wn="0x0000000000000000000000000000000000000000000000000000000000000000";var Es=BigInt(0),ks=BigInt(1),vs=BigInt(2),Ps=BigInt(27),Rs=BigInt(28),Tn=BigInt(35),Te={};function As(s){return ge(He(s),32)}var Z=class{#t;#e;#n;#r;get r(){return this.#t}set r(t){f(fn(t)===32,"invalid r","value",t),this.#t=P(t)}get s(){return this.#e}set s(t){f(fn(t)===32,"invalid s","value",t);let e=P(t);f(parseInt(e.substring(0,3))<8,"non-canonical s","value",e),this.#e=e}get v(){return this.#n}set v(t){let e=R(t,"value");f(e===27||e===28,"invalid v","v",t),this.#n=e}get networkV(){return this.#r}get legacyChainId(){let t=this.networkV;return t==null?null:Z.getChainId(t)}get yParity(){return this.v===27?0:1}get yParityAndS(){let t=V(this.s);return this.yParity&&(t[0]|=128),P(t)}get compactSerialized(){return ct([this.r,this.yParityAndS])}get serialized(){return ct([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(t,e,n,r){_t(t,Te,"Signature"),this.#t=e,this.#e=n,this.#n=r,this.#r=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 Z(Te,this.r,this.s,this.v);return this.networkV&&(t.#r=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=T(t,"v");return e==Ps||e==Rs?Es:(f(e>=Tn,"invalid EIP-155 v","v",t),(e-Tn)/vs)}static getChainIdV(t,e){return T(t)*vs+BigInt(35+e-27)}static getNormalizedV(t){let e=T(t);return e===Es||e===Ps?27:e===ks||e===Rs?28:(f(e>=Tn,"invalid v","v",t),e&ks?27:28)}static from(t){function e(l,u){f(l,u,"signature",t)}if(t==null)return new Z(Te,wn,wn,27);if(typeof t=="string"){let l=V(t,"signature");if(l.length===64){let u=P(l.slice(0,32)),d=l.slice(32,64),p=d[0]&128?28:27;return d[0]&=127,new Z(Te,u,P(d),p)}if(l.length===65){let u=P(l.slice(0,32)),d=l.slice(32,64);e((d[0]&128)===0,"non-canonical s");let p=Z.getNormalizedV(l[64]);return new Z(Te,u,P(d),p)}e(!1,"invalid raw signature length")}if(t instanceof Z)return t.clone();let n=t.r;e(n!=null,"missing r");let r=As(n),a=function(l,u){if(l!=null)return As(l);if(u!=null){e($(u,32),"invalid yParityAndS");let d=V(u);return d[0]&=127,P(d)}e(!1,"missing s")}(t.s,t.yParityAndS);e((V(a)[0]&128)==0,"non-canonical s");let{networkV:o,v:i}=function(l,u,d){if(l!=null){let p=T(l);return{networkV:p>=Tn?p:void 0,v:Z.getNormalizedV(p)}}if(u!=null)return e($(u,32),"invalid yParityAndS"),{v:V(u)[0]&128?28:27};if(d!=null){switch(R(d,"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),c=new Z(Te,r,a,i);return o&&(c.#r=o),e(t.yParity==null||R(t.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),e(t.yParityAndS==null||t.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};var Ka=BigInt(0),ja=BigInt(36);function Is(s){s=s.toLowerCase();let t=s.substring(2).split(""),e=new Uint8Array(40);for(let r=0;r<40;r++)e[r]=t[r].charCodeAt(0);let n=V(et(e));for(let r=0;r<40;r+=2)n[r>>1]>>4>=8&&(t[r]=t[r].toUpperCase()),(n[r>>1]&15)>=8&&(t[r+1]=t[r+1].toUpperCase());return"0x"+t.join("")}var ir={};for(let s=0;s<10;s++)ir[String(s)]=String(s);for(let s=0;s<26;s++)ir[String.fromCharCode(65+s)]=String(10+s);var Os=15;function za(s){s=s.toUpperCase(),s=s.substring(4)+s.substring(0,2)+"00";let t=s.split("").map(n=>ir[n]).join("");for(;t.length>=Os;){let n=t.substring(0,Os);t=parseInt(n,10)%97+t.substring(n.length)}let e=String(98-parseInt(t,10)%97);for(;e.length<2;)e="0"+e;return e}var Ja=function(){let s={};for(let t=0;t<36;t++){let e="0123456789abcdefghijklmnopqrstuvwxyz"[t];s[e]=BigInt(t)}return s}();function Xa(s){s=s.toLowerCase();let t=Ka;for(let e=0;e<s.length;e++)t=t*ja+Ja[s[e]];return t}function L(s){if(f(typeof s=="string","invalid address","address",s),s.match(/^(0x)?[0-9a-fA-F]{40}$/)){s.startsWith("0x")||(s="0x"+s);let t=Is(s);return f(!s.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===s,"bad address checksum","address",s),t}if(s.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){f(s.substring(2,4)===za(s),"bad icap checksum","address",s);let t=Xa(s.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return Is("0x"+t)}f(!1,"invalid address","address",s)}function cr(s){let t=L(s.from),n=T(s.nonce,"tx.nonce").toString(16);return n==="0"?n="0x":n.length%2?n="0x0"+n:n="0x"+n,L(Ct(et(er([t,n])),12))}function En(s){return s&&typeof s.getAddress=="function"}async function lr(s,t){let e=await t;return(e==null||e==="0x0000000000000000000000000000000000000000")&&(y(typeof s!="string","unconfigured name","UNCONFIGURED_NAME",{value:s}),f(!1,"invalid AddressLike value; did not resolve to a value address","target",s)),L(e)}function Xt(s,t){if(typeof s=="string")return s.match(/^0x[0-9a-f]{40}$/i)?L(s):(y(t!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),lr(s,t.resolveName(s)));if(En(s))return lr(s,s.getAddress());if(s&&typeof s.then=="function")return lr(s,s);f(!1,"unsupported addressable value","target",s)}var ft={};function m(s,t){let e=!1;return t<0&&(e=!0,t*=-1),new O(ft,`${e?"":"u"}int${t}`,s,{signed:e,width:t})}function S(s,t){return new O(ft,`bytes${t||""}`,s,{size:t})}var Ns=Symbol.for("_ethers_typed"),O=class{type;value;#t;_typedSymbol;constructor(t,e,n,r){r==null&&(r=null),_t(ft,t,"Typed"),C(this,{_typedSymbol:Ns,type:e,value:n}),this.#t=r,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 O(ft,t,e)}static uint8(t){return m(t,8)}static uint16(t){return m(t,16)}static uint24(t){return m(t,24)}static uint32(t){return m(t,32)}static uint40(t){return m(t,40)}static uint48(t){return m(t,48)}static uint56(t){return m(t,56)}static uint64(t){return m(t,64)}static uint72(t){return m(t,72)}static uint80(t){return m(t,80)}static uint88(t){return m(t,88)}static uint96(t){return m(t,96)}static uint104(t){return m(t,104)}static uint112(t){return m(t,112)}static uint120(t){return m(t,120)}static uint128(t){return m(t,128)}static uint136(t){return m(t,136)}static uint144(t){return m(t,144)}static uint152(t){return m(t,152)}static uint160(t){return m(t,160)}static uint168(t){return m(t,168)}static uint176(t){return m(t,176)}static uint184(t){return m(t,184)}static uint192(t){return m(t,192)}static uint200(t){return m(t,200)}static uint208(t){return m(t,208)}static uint216(t){return m(t,216)}static uint224(t){return m(t,224)}static uint232(t){return m(t,232)}static uint240(t){return m(t,240)}static uint248(t){return m(t,248)}static uint256(t){return m(t,256)}static uint(t){return m(t,256)}static int8(t){return m(t,-8)}static int16(t){return m(t,-16)}static int24(t){return m(t,-24)}static int32(t){return m(t,-32)}static int40(t){return m(t,-40)}static int48(t){return m(t,-48)}static int56(t){return m(t,-56)}static int64(t){return m(t,-64)}static int72(t){return m(t,-72)}static int80(t){return m(t,-80)}static int88(t){return m(t,-88)}static int96(t){return m(t,-96)}static int104(t){return m(t,-104)}static int112(t){return m(t,-112)}static int120(t){return m(t,-120)}static int128(t){return m(t,-128)}static int136(t){return m(t,-136)}static int144(t){return m(t,-144)}static int152(t){return m(t,-152)}static int160(t){return m(t,-160)}static int168(t){return m(t,-168)}static int176(t){return m(t,-176)}static int184(t){return m(t,-184)}static int192(t){return m(t,-192)}static int200(t){return m(t,-200)}static int208(t){return m(t,-208)}static int216(t){return m(t,-216)}static int224(t){return m(t,-224)}static int232(t){return m(t,-232)}static int240(t){return m(t,-240)}static int248(t){return m(t,-248)}static int256(t){return m(t,-256)}static int(t){return m(t,-256)}static bytes1(t){return S(t,1)}static bytes2(t){return S(t,2)}static bytes3(t){return S(t,3)}static bytes4(t){return S(t,4)}static bytes5(t){return S(t,5)}static bytes6(t){return S(t,6)}static bytes7(t){return S(t,7)}static bytes8(t){return S(t,8)}static bytes9(t){return S(t,9)}static bytes10(t){return S(t,10)}static bytes11(t){return S(t,11)}static bytes12(t){return S(t,12)}static bytes13(t){return S(t,13)}static bytes14(t){return S(t,14)}static bytes15(t){return S(t,15)}static bytes16(t){return S(t,16)}static bytes17(t){return S(t,17)}static bytes18(t){return S(t,18)}static bytes19(t){return S(t,19)}static bytes20(t){return S(t,20)}static bytes21(t){return S(t,21)}static bytes22(t){return S(t,22)}static bytes23(t){return S(t,23)}static bytes24(t){return S(t,24)}static bytes25(t){return S(t,25)}static bytes26(t){return S(t,26)}static bytes27(t){return S(t,27)}static bytes28(t){return S(t,28)}static bytes29(t){return S(t,29)}static bytes30(t){return S(t,30)}static bytes31(t){return S(t,31)}static bytes32(t){return S(t,32)}static address(t){return new O(ft,"address",t)}static bool(t){return new O(ft,"bool",!!t)}static bytes(t){return new O(ft,"bytes",t)}static string(t){return new O(ft,"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 O(ft,"overrides",Object.assign({},t))}static isTyped(t){return t&&typeof t=="object"&&"_typedSymbol"in t&&t._typedSymbol===Ns}static dereference(t,e){if(O.isTyped(t)){if(t.type!==e)throw new Error(`invalid type: expecetd ${e}, got ${t.type}`);return t.value}return t}};var kn=class extends W{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let n=O.dereference(e,"string");try{n=L(n)}catch(r){return this._throwError(r.message,e)}return t.writeValue(n)}decode(t){return L(_e(t.readValue(),20))}};var vn=class extends W{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 ur(s,t,e){let n=[];if(Array.isArray(e))n=e;else if(e&&typeof e=="object"){let c={};n=t.map(l=>{let u=l.localName;return y(u,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:e}),y(!c[u],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:e}),c[u]=!0,e[u]})}else f(!1,"invalid tuple value","tuple",e);f(t.length===n.length,"types/value length mismatch","tuple",e);let r=new Jt,a=new Jt,o=[];t.forEach((c,l)=>{let u=n[l];if(c.dynamic){let d=a.length;c.encode(a,u);let p=r.writeUpdatableValue();o.push(h=>{p(h+d)})}else c.encode(r,u)}),o.forEach(c=>{c(r.length)});let i=s.appendWriter(r);return i+=s.appendWriter(a),i}function dr(s,t){let e=[],n=[],r=s.subReader(0);return t.forEach(a=>{let o=null;if(a.dynamic){let i=s.readIndex(),c=r.subReader(i);try{o=a.decode(c)}catch(l){if(xt(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=a.name,o.name=a.localName,o.type=a.type}}else try{o=a.decode(s)}catch(i){if(xt(i,"BUFFER_OVERRUN"))throw i;o=i,o.baseType=a.name,o.name=a.localName,o.type=a.type}if(o==null)throw new Error("investigate");e.push(o),n.push(a.localName||null)}),X.fromItems(e,n)}var Pn=class extends W{coder;length;constructor(t,e,n){let r=t.type+"["+(e>=0?e:"")+"]",a=e===-1||t.dynamic;super("array",r,n,a),C(this,{coder:t,length:e})}defaultValue(){let t=this.coder.defaultValue(),e=[];for(let n=0;n<this.length;n++)e.push(t);return e}encode(t,e){let n=O.dereference(e,"array");Array.isArray(n)||this._throwError("expected array value",n);let r=this.length;r===-1&&(r=n.length,t.writeValue(n.length)),Le(n.length,r,"coder array"+(this.localName?" "+this.localName:""));let a=[];for(let o=0;o<n.length;o++)a.push(this.coder);return ur(t,a,n)}decode(t){let e=this.length;e===-1&&(e=t.readIndex(),y(e*J<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*J,length:t.dataLength}));let n=[];for(let r=0;r<e;r++)n.push(new vn(this.coder));return dr(t,n)}};var Rn=class extends W{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){let n=O.dereference(e,"bool");return t.writeValue(n?1:0)}decode(t){return!!t.readValue()}};var $e=class extends W{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=q(e);let n=t.writeValue(e.length);return n+=t.writeBytes(e),n}decode(t){return t.readBytes(t.readIndex(),!0)}},An=class extends $e{constructor(t){super("bytes",t)}decode(t){return P(super.decode(t))}};var In=class extends W{size;constructor(t,e){let n="bytes"+String(t);super(n,n,e,!1),C(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,e){let n=q(O.dereference(e,this.type));return n.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(n)}decode(t){return P(t.readBytes(this.size))}};var Za=new Uint8Array([]),On=class extends W{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return e!=null&&this._throwError("not null",e),t.writeBytes(Za)}decode(t){return t.readBytes(0),null}};var Ya=BigInt(0),Qa=BigInt(1),qa=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Nn=class extends W{size;signed;constructor(t,e,n){let r=(e?"int":"uint")+t*8;super(r,r,n,!1),C(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let n=T(O.dereference(e,this.type)),r=be(qa,J*8);if(this.signed){let a=be(r,this.size*8-1);(n>a||n<-(a+Qa))&&this._throwError("value out-of-bounds",e),n=qn(n,8*J)}else(n<Ya||n>be(r,this.size*8))&&this._throwError("value out-of-bounds",e);return t.writeValue(n)}decode(t){let e=be(t.readValue(),this.size*8);return this.signed&&(e=Qn(e,this.size*8)),e}};var Bn=class extends $e{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,xe(O.dereference(e,"string")))}decode(t){return Ve(super.decode(t))}};var Zt=class extends W{coders;constructor(t,e){let n=!1,r=[];t.forEach(o=>{o.dynamic&&(n=!0),r.push(o.type)});let a="tuple("+r.join(",")+")";super("tuple",a,e,n),C(this,{coders:Object.freeze(t.slice())})}defaultValue(){let t=[];this.coders.forEach(n=>{t.push(n.defaultValue())});let e=this.coders.reduce((n,r)=>{let a=r.localName;return a&&(n[a]||(n[a]=0),n[a]++),n},{});return this.coders.forEach((n,r)=>{let a=n.localName;!a||e[a]!==1||(a==="length"&&(a="_length"),t[a]==null&&(t[a]=t[r]))}),Object.freeze(t)}encode(t,e){let n=O.dereference(e,"tuple");return ur(t,this.coders,n)}decode(t){return dr(t,this.coders)}};function Ut(s){return et(xe(s))}function pr(s,t){return{address:L(s),storageKeys:t.map((e,n)=>(f($(e,32),"invalid slot",`storageKeys[${n}]`,e),e.toLowerCase()))}}function We(s){if(Array.isArray(s))return s.map((e,n)=>Array.isArray(e)?(f(e.length===2,"invalid slot set",`value[${n}]`,e),pr(e[0],e[1])):(f(e!=null&&typeof e=="object","invalid address-slot set","value",s),pr(e.address,e.storageKeys)));f(s!=null&&typeof s=="object","invalid access list","value",s);let t=Object.keys(s).map(e=>{let n=s[e].reduce((r,a)=>(r[a]=!0,r),{});return pr(e,Object.keys(n).sort())});return t.sort((e,n)=>e.address.localeCompare(n.address)),t}function tt(s){let t=new Set;return s.forEach(e=>t.add(e)),Object.freeze(t)}var to="external public payable override",eo=tt(to.split(" ")),Ms="constant external internal payable private public pure view override",no=tt(Ms.split(" ")),Gs="constructor error event fallback function receive struct",$s=tt(Gs.split(" ")),Ws="calldata memory storage payable indexed",ro=tt(Ws.split(" ")),so="tuple returns",ao=[Gs,Ws,so,Ms].join(" "),oo=tt(ao.split(" ")),io={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},co=new RegExp("^(\\s*)"),lo=new RegExp("^([0-9]+)"),uo=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),Ks=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),js=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),st=class{#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 st(this.#e)}reset(){this.#t=0}#n(t=0,e=0){return new st(this.#e.slice(t,e).map(n=>Object.freeze(Object.assign({},n,{match:n.match-t,linkBack:n.linkBack-t,linkNext:n.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.#n(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 n=this.peek().linkNext;e.push(this.#n(this.#t+1,n)),this.#t=n}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 n=this.#e[e];t.push(`${n.type}:${n.text}`)}return`<TokenString ${t.join(" ")}>`}};function Vt(s){let t=[],e=o=>{let i=a<s.length?JSON.stringify(s[a]):"$EOI";throw new Error(`invalid token ${i} at ${a}: ${o}`)},n=[],r=[],a=0;for(;a<s.length;){let o=s.substring(a),i=o.match(co);i&&(a+=i[1].length,o=s.substring(a));let c={depth:n.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:a,value:-1};t.push(c);let l=io[o[0]]||"";if(l){if(c.type=l,c.text=o[0],a++,l==="OPEN_PAREN")n.push(t.length-1),r.push(t.length-1);else if(l=="CLOSE_PAREN")n.length===0&&e("no matching open bracket"),c.match=n.pop(),t[c.match].match=t.length-1,c.depth--,c.linkBack=r.pop(),t[c.linkBack].linkNext=t.length-1;else if(l==="COMMA")c.linkBack=r.pop(),t[c.linkBack].linkNext=t.length-1,r.push(t.length-1);else if(l==="OPEN_BRACKET")c.type="BRACKET";else if(l==="CLOSE_BRACKET"){let u=t.pop().text;if(t.length>0&&t[t.length-1].type==="NUMBER"){let d=t.pop().text;u=d+u,t[t.length-1].value=R(d)}if(t.length===0||t[t.length-1].type!=="BRACKET")throw new Error("missing opening bracket");t[t.length-1].text+=u}continue}if(i=o.match(uo),i){if(c.text=i[1],a+=c.text.length,oo.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(js)){c.type="TYPE";continue}c.type="ID";continue}if(i=o.match(lo),i){c.text=i[1],c.type="NUMBER",a+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${a}`)}return new st(t.map(o=>Object.freeze(o)))}function Bs(s,t){let e=[];for(let n in t.keys())s.has(n)&&e.push(n);if(e.length>1)throw new Error(`conflicting types: ${e.join(", ")}`)}function Fn(s,t){if(t.peekKeyword($s)){let e=t.pop().text;if(e!==s)throw new Error(`expected ${s}, got ${e}`)}return t.popType("ID")}function At(s,t){let e=new Set;for(;;){let n=s.peekType("KEYWORD");if(n==null||t&&!t.has(n))break;if(s.pop(),e.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);e.add(n)}return Object.freeze(e)}function zs(s){let t=At(s,no);return Bs(t,tt("constant payable nonpayable".split(" "))),Bs(t,tt("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"}function Rt(s,t){return s.popParams().map(e=>D.from(e,t))}function Js(s){if(s.peekType("AT")){if(s.pop(),s.peekType("NUMBER"))return T(s.pop().text);throw new Error("invalid gas")}return null}function Yt(s){if(s.length)throw new Error(`unexpected tokens at offset ${s.offset}: ${s.toString()}`)}var po=new RegExp(/^(.*)\[([0-9]*)\]$/);function Fs(s){let t=s.match(js);if(f(t,"invalid type","type",s),s==="uint")return"uint256";if(s==="int")return"int256";if(t[2]){let e=parseInt(t[2]);f(e!==0&&e<=32,"invalid bytes length","type",s)}else if(t[3]){let e=parseInt(t[3]);f(e!==0&&e<=256&&e%8===0,"invalid numeric width","type",s)}return s}var G={},at=Symbol.for("_ethers_internal"),Ss="_ParamTypeInternal",Ls="_ErrorInternal",Ds="_EventInternal",_s="_ConstructorInternal",Hs="_FallbackInternal",Us="_FunctionInternal",Vs="_StructInternal",D=class{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(t,e,n,r,a,o,i,c){if(_t(t,G,"ParamType"),Object.defineProperty(this,at,{value:Ss}),o&&(o=Object.freeze(o.slice())),r==="array"){if(i==null||c==null)throw new Error("")}else if(i!=null||c!=null)throw new Error("");if(r==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");C(this,{name:e,type:n,baseType:r,indexed:a,components:o,arrayLength:i,arrayChildren:c})}format(t){if(t==null&&(t="sighash"),t==="json"){let n=this.name||"";if(this.isArray()){let a=JSON.parse(this.arrayChildren.format("json"));return a.name=n,a.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(a)}let r={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(r.indexed=this.indexed),this.isTuple()&&(r.components=this.components.map(a=>JSON.parse(a.format(t)))),JSON.stringify(r)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?e+="("+this.components.map(n=>n.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 n=this;return t.map(r=>n.arrayChildren.walk(r,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 n=this;return t.map((r,a)=>n.components[a].walk(r,e))}return e(this.type,t)}#t(t,e,n,r){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,i=e.slice();i.forEach((c,l)=>{o.#t(t,c,n,u=>{i[l]=u})}),r(i);return}if(this.isTuple()){let o=this.components,i;if(Array.isArray(e))i=e.slice();else{if(e==null||typeof e!="object")throw new Error("invalid tuple value");i=o.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in e))throw new Error(`missing value for component ${c.name}`);return e[c.name]})}if(i.length!==this.components.length)throw new Error("array is wrong length");i.forEach((c,l)=>{o[l].#t(t,c,n,u=>{i[l]=u})}),r(i);return}let a=n(this.type,e);a.then?t.push(async function(){r(await a)}()):r(a)}async walkAsync(t,e){let n=[],r=[t];return this.#t(n,t,e,a=>{r[0]=a}),n.length&&await Promise.all(n),r[0]}static from(t,e){if(D.isParamType(t))return t;if(typeof t=="string")try{return D.from(Vt(t),e)}catch{f(!1,"invalid param type","obj",t)}else if(t instanceof st){let i="",c="",l=null;At(t,tt(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(c="tuple",l=t.popParams().map(w=>D.from(w)),i=`tuple(${l.map(w=>w.format()).join(",")})`):(i=Fs(t.popType("TYPE")),c=i);let u=null,d=null;for(;t.length&&t.peekType("BRACKET");){let w=t.pop();u=new D(G,"",i,c,null,l,d,u),d=w.value,i+=w.text,c="array",l=null}let p=null;if(At(t,ro).has("indexed")){if(!e)throw new Error("");p=!0}let x=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new D(G,x,i,c,p,l,d,u)}let n=t.name;f(!n||typeof n=="string"&&n.match(Ks),"invalid name","obj.name",n);let r=t.indexed;r==!0?(f(e,"parameter cannot be indexed","obj.indexed",t.indexed),r=!0):r=!1;let a=t.type,o=a.match(po);if(o){let i=parseInt(o[2]||"-1"),c=D.from({type:o[1],components:t.components});return new D(G,n||"",a,"array",r,null,i,c)}if(a==="tuple"||a.startsWith("tuple(")||a.startsWith("(")){let i=t.components!=null?t.components.map(l=>D.from(l)):null;return new D(G,n||"",a,"tuple",r,i,null,null)}return a=Fs(t.type),new D(G,n||"",a,a,r,null,null,null)}static isParamType(t){return t&&t[at]===Ss}},ht=class{type;inputs;constructor(t,e,n){_t(t,G,"Fragment"),n=Object.freeze(n.slice()),C(this,{type:e,inputs:n})}static from(t){if(typeof t=="string"){try{ht.from(JSON.parse(t))}catch{}return ht.from(Vt(t))}if(t instanceof st)switch(t.peekKeyword($s)){case"constructor":return lt.from(t);case"error":return j.from(t);case"event":return nt.from(t);case"fallback":case"receive":return dt.from(t);case"function":return rt.from(t);case"struct":return wt.from(t)}else if(typeof t=="object"){switch(t.type){case"constructor":return lt.from(t);case"error":return j.from(t);case"event":return nt.from(t);case"fallback":case"receive":return dt.from(t);case"function":return rt.from(t);case"struct":return wt.from(t)}y(!1,`unsupported type: ${t.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}f(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return lt.isFragment(t)}static isError(t){return j.isFragment(t)}static isEvent(t){return nt.isFragment(t)}static isFunction(t){return rt.isFragment(t)}static isStruct(t){return wt.isFragment(t)}},Qt=class extends ht{name;constructor(t,e,n,r){super(t,e,r),f(typeof n=="string"&&n.match(Ks),"invalid identifier","name",n),r=Object.freeze(r.slice()),C(this,{name:n})}};function Ke(s,t){return"("+t.map(e=>e.format(s)).join(s==="full"?", ":",")+")"}var j=class extends Qt{constructor(t,e,n){super(t,"error",e,n),Object.defineProperty(this,at,{value:Ls})}get selector(){return Ut(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(n=>JSON.parse(n.format(t)))});let e=[];return t!=="sighash"&&e.push("error"),e.push(this.name+Ke(t,this.inputs)),e.join(" ")}static from(t){if(j.isFragment(t))return t;if(typeof t=="string")return j.from(Vt(t));if(t instanceof st){let e=Fn("error",t),n=Rt(t);return Yt(t),new j(G,e,n)}return new j(G,t.name,t.inputs?t.inputs.map(D.from):[])}static isFragment(t){return t&&t[at]===Ls}},nt=class extends Qt{anonymous;constructor(t,e,n,r){super(t,"event",e,n),Object.defineProperty(this,at,{value:Ds}),C(this,{anonymous:r})}get topicHash(){return Ut(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(n=>JSON.parse(n.format(t)))});let e=[];return t!=="sighash"&&e.push("event"),e.push(this.name+Ke(t,this.inputs)),t!=="sighash"&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){return e=(e||[]).map(r=>D.from(r)),new nt(G,t,e,!1).topicHash}static from(t){if(nt.isFragment(t))return t;if(typeof t=="string")try{return nt.from(Vt(t))}catch{f(!1,"invalid event fragment","obj",t)}else if(t instanceof st){let e=Fn("event",t),n=Rt(t,!0),r=!!At(t,tt(["anonymous"])).has("anonymous");return Yt(t),new nt(G,e,n,r)}return new nt(G,t.name,t.inputs?t.inputs.map(e=>D.from(e,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[at]===Ds}},lt=class extends ht{payable;gas;constructor(t,e,n,r,a){super(t,e,n),Object.defineProperty(this,at,{value:_s}),C(this,{payable:r,gas:a})}format(t){if(y(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(n=>JSON.parse(n.format(t)))});let e=[`constructor${Ke(t,this.inputs)}`];return this.payable&&e.push("payable"),this.gas!=null&&e.push(`@${this.gas.toString()}`),e.join(" ")}static from(t){if(lt.isFragment(t))return t;if(typeof t=="string")try{return lt.from(Vt(t))}catch{f(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof st){At(t,tt(["constructor"]));let e=Rt(t),n=!!At(t,eo).has("payable"),r=Js(t);return Yt(t),new lt(G,"constructor",e,n,r)}return new lt(G,"constructor",t.inputs?t.inputs.map(D.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[at]===_s}},dt=class extends ht{payable;constructor(t,e,n){super(t,"fallback",e),Object.defineProperty(this,at,{value:Hs}),C(this,{payable:n})}format(t){let e=this.inputs.length===0?"receive":"fallback";if(t==="json"){let n=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:n})}return`${e}()${this.payable?" payable":""}`}static from(t){if(dt.isFragment(t))return t;if(typeof t=="string")try{return dt.from(Vt(t))}catch{f(!1,"invalid fallback fragment","obj",t)}else if(t instanceof st){let e=t.toString(),n=t.peekKeyword(tt(["fallback","receive"]));if(f(n,"type must be fallback or receive","obj",e),t.popKeyword(tt(["fallback","receive"]))==="receive"){let i=Rt(t);return f(i.length===0,"receive cannot have arguments","obj.inputs",i),At(t,tt(["payable"])),Yt(t),new dt(G,[],!0)}let a=Rt(t);a.length?f(a.length===1&&a[0].type==="bytes","invalid fallback inputs","obj.inputs",a.map(i=>i.format("minimal")).join(", ")):a=[D.from("bytes")];let o=zs(t);if(f(o==="nonpayable"||o==="payable","fallback cannot be constants","obj.stateMutability",o),At(t,tt(["returns"])).has("returns")){let i=Rt(t);f(i.length===1&&i[0].type==="bytes","invalid fallback outputs","obj.outputs",i.map(c=>c.format("minimal")).join(", "))}return Yt(t),new dt(G,a,o==="payable")}if(t.type==="receive")return new dt(G,[],!0);if(t.type==="fallback"){let e=[D.from("bytes")],n=t.stateMutability==="payable";return new dt(G,e,n)}f(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[at]===Hs}},rt=class extends Qt{constant;outputs;stateMutability;payable;gas;constructor(t,e,n,r,a,o){super(t,"function",e,r),Object.defineProperty(this,at,{value:Us}),a=Object.freeze(a.slice()),C(this,{constant:n==="view"||n==="pure",gas:o,outputs:a,payable:n==="payable",stateMutability:n})}get selector(){return Ut(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(n=>JSON.parse(n.format(t))),outputs:this.outputs.map(n=>JSON.parse(n.format(t)))});let e=[];return t!=="sighash"&&e.push("function"),e.push(this.name+Ke(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push(Ke(t,this.outputs))),this.gas!=null&&e.push(`@${this.gas.toString()}`)),e.join(" ")}static getSelector(t,e){return e=(e||[]).map(r=>D.from(r)),new rt(G,t,"view",e,[],null).selector}static from(t){if(rt.isFragment(t))return t;if(typeof t=="string")try{return rt.from(Vt(t))}catch{f(!1,"invalid function fragment","obj",t)}else if(t instanceof st){let n=Fn("function",t),r=Rt(t),a=zs(t),o=[];At(t,tt(["returns"])).has("returns")&&(o=Rt(t));let i=Js(t);return Yt(t),new rt(G,n,a,r,o,i)}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 rt(G,t.name,e,t.inputs?t.inputs.map(D.from):[],t.outputs?t.outputs.map(D.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[at]===Us}},wt=class extends Qt{constructor(t,e,n){super(t,"struct",e,n),Object.defineProperty(this,at,{value:Vs})}format(){throw new Error("@TODO")}static from(t){if(typeof t=="string")try{return wt.from(Vt(t))}catch{f(!1,"invalid struct fragment","obj",t)}else if(t instanceof st){let e=Fn("struct",t),n=Rt(t);return Yt(t),new wt(G,e,n)}return new wt(G,t.name,t.inputs?t.inputs.map(D.from):[])}static isFragment(t){return t&&t[at]===Vs}};var mt=new Map;mt.set(0,"GENERIC_PANIC");mt.set(1,"ASSERT_FALSE");mt.set(17,"OVERFLOW");mt.set(18,"DIVIDE_BY_ZERO");mt.set(33,"ENUM_RANGE_ERROR");mt.set(34,"BAD_STORAGE_DATA");mt.set(49,"STACK_UNDERFLOW");mt.set(50,"ARRAY_RANGE_ERROR");mt.set(65,"OUT_OF_MEMORY");mt.set(81,"UNINITIALIZED_FUNCTION_CALL");var fo=new RegExp(/^bytes([0-9]*)$/),ho=new RegExp(/^(u?int)([0-9]*)$/),fr=null,Xs=1024;function mo(s,t,e,n){let r="missing revert data",a=null,o=null,i=null;if(e){r="execution reverted";let l=V(e);if(e=P(e),l.length===0)r+=" (no data present; likely require(false) occurred",a="require(false)";else if(l.length%32!==4)r+=" (could not decode reason; invalid data length)";else if(P(l.slice(0,4))==="0x08c379a0")try{a=n.decode(["string"],l.slice(4))[0],i={signature:"Error(string)",name:"Error",args:[a]},r+=`: ${JSON.stringify(a)}`}catch{r+=" (could not decode reason; invalid string data)"}else if(P(l.slice(0,4))==="0x4e487b71")try{let u=Number(n.decode(["uint256"],l.slice(4))[0]);i={signature:"Panic(uint256)",name:"Panic",args:[u]},a=`Panic due to ${mt.get(u)||"UNKNOWN"}(${u})`,r+=`: ${a}`}catch{r+=" (could not decode panic code)"}else r+=" (unknown custom error)"}let c={to:t.to?L(t.to):null,data:t.data||"0x"};return t.from&&(c.from=L(t.from)),Pt(r,"CALL_EXCEPTION",{action:s,data:e,reason:a,transaction:c,invocation:o,revert:i})}var It=class{#t(t){if(t.isArray())return new Pn(this.#t(t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new Zt(t.components.map(n=>this.#t(n)),t.name);switch(t.baseType){case"address":return new kn(t.name);case"bool":return new Rn(t.name);case"string":return new Bn(t.name);case"bytes":return new An(t.name);case"":return new On(t.name)}let e=t.type.match(ho);if(e){let n=parseInt(e[2]||"256");return f(n!==0&&n<=256&&n%8===0,"invalid "+e[1]+" bit length","param",t),new Nn(n/8,e[1]==="int",t.name)}if(e=t.type.match(fo),e){let n=parseInt(e[1]);return f(n!==0&&n<=32,"invalid bytes length","param",t),new In(n,t.name)}f(!1,"invalid type","type",t.type)}getDefaultValue(t){let e=t.map(r=>this.#t(D.from(r)));return new Zt(e,"_").defaultValue()}encode(t,e){Le(e.length,t.length,"types/values length mismatch");let n=t.map(o=>this.#t(D.from(o))),r=new Zt(n,"_"),a=new Jt;return r.encode(a,e),a.data}decode(t,e,n){let r=t.map(o=>this.#t(D.from(o)));return new Zt(r,"_").decode(new Ce(e,n,Xs))}static _setDefaultMaxInflation(t){f(typeof t=="number"&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),Xs=t}static defaultAbiCoder(){return fr==null&&(fr=new It),fr}static getBuiltinCallException(t,e,n){return mo(t,e,n,It.defaultAbiCoder())}};function Zs(s){let t=V(s,"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 Ve(t.slice(0,e))}var je=class{fragment;name;signature;topic;args;constructor(t,e,n){let r=t.name,a=t.format();C(this,{fragment:t,name:r,signature:a,topic:e,args:n})}},ze=class{fragment;name;args;signature;selector;value;constructor(t,e,n,r){let a=t.name,o=t.format();C(this,{fragment:t,name:a,args:n,signature:o,selector:e,value:r})}},Je=class{fragment;name;args;signature;selector;constructor(t,e,n){let r=t.name,a=t.format();C(this,{fragment:t,name:r,args:n,signature:a,selector:e})}},Ee=class{hash;_isIndexed;static isIndexed(t){return!!(t&&t._isIndexed)}constructor(t){C(this,{hash:t,_isIndexed:!0})}},Ys={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"},Qs={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:s=>`reverted with reason string ${JSON.stringify(s)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:s=>{let t="unknown panic code";return s>=0&&s<=255&&Ys[s.toString()]&&(t=Ys[s.toString()]),`reverted with panic code 0x${s.toString(16)} (${t})`}}},b=class{fragments;deploy;fallback;receive;#t;#e;#n;#r;constructor(t){let e=[];typeof t=="string"?e=JSON.parse(t):e=t,this.#n=new Map,this.#t=new Map,this.#e=new Map;let n=[];for(let o of e)try{n.push(ht.from(o))}catch(i){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,i.message)}C(this,{fragments:Object.freeze(n)});let r=null,a=!1;this.#r=this.getAbiCoder(),this.fragments.forEach((o,i)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}C(this,{deploy:o});return;case"fallback":o.inputs.length===0?a=!0:(f(!r||o.payable!==r.payable,"conflicting fallback fragments",`fragments[${i}]`,o),r=o,a=r.payable);return;case"function":c=this.#n;break;case"event":c=this.#e;break;case"error":c=this.#t;break;default:return}let l=o.format();c.has(l)||c.set(l,o)}),this.deploy||C(this,{deploy:lt.from("constructor()")}),C(this,{fallback:r,receive:a})}format(t){let e=t?"minimal":"full";return this.fragments.map(r=>r.format(e))}formatJson(){let t=this.fragments.map(e=>e.format("json"));return JSON.stringify(t.map(e=>JSON.parse(e)))}getAbiCoder(){return It.defaultAbiCoder()}#s(t,e,n){if($(t)){let a=t.toLowerCase();for(let o of this.#n.values())if(a===o.selector)return o;return null}if(t.indexOf("(")===-1){let a=[];for(let[o,i]of this.#n)o.split("(")[0]===t&&a.push(i);if(e){let o=e.length>0?e[e.length-1]:null,i=e.length,c=!0;O.isTyped(o)&&o.type==="overrides"&&(c=!1,i--);for(let l=a.length-1;l>=0;l--){let u=a[l].inputs.length;u!==i&&(!c||u!==i-1)&&a.splice(l,1)}for(let l=a.length-1;l>=0;l--){let u=a[l].inputs;for(let d=0;d<e.length;d++)if(O.isTyped(e[d])){if(d>=u.length){if(e[d].type==="overrides")continue;a.splice(l,1);break}if(e[d].type!==u[d].baseType){a.splice(l,1);break}}}}if(a.length===1&&e&&e.length!==a[0].inputs.length){let o=e[e.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&a.splice(0,1)}if(a.length===0)return null;if(a.length>1&&n){let o=a.map(i=>JSON.stringify(i.format())).join(", ");f(!1,`ambiguous function description (i.e. matches ${o})`,"key",t)}return a[0]}let r=this.#n.get(rt.from(t).format());return r||null}getFunctionName(t){let e=this.#s(t,null,!1);return f(e,"no matching function","key",t),e.name}hasFunction(t){return!!this.#s(t,null,!1)}getFunction(t,e){return this.#s(t,e||null,!0)}forEachFunction(t){let e=Array.from(this.#n.keys());e.sort((n,r)=>n.localeCompare(r));for(let n=0;n<e.length;n++){let r=e[n];t(this.#n.get(r),n)}}#a(t,e,n){if($(t)){let a=t.toLowerCase();for(let o of this.#e.values())if(a===o.topicHash)return o;return null}if(t.indexOf("(")===-1){let a=[];for(let[o,i]of this.#e)o.split("(")[0]===t&&a.push(i);if(e){for(let o=a.length-1;o>=0;o--)a[o].inputs.length<e.length&&a.splice(o,1);for(let o=a.length-1;o>=0;o--){let i=a[o].inputs;for(let c=0;c<e.length;c++)if(O.isTyped(e[c])&&e[c].type!==i[c].baseType){a.splice(o,1);break}}}if(a.length===0)return null;if(a.length>1&&n){let o=a.map(i=>JSON.stringify(i.format())).join(", ");f(!1,`ambiguous event description (i.e. matches ${o})`,"key",t)}return a[0]}let r=this.#e.get(nt.from(t).format());return r||null}getEventName(t){let e=this.#a(t,null,!1);return f(e,"no matching event","key",t),e.name}hasEvent(t){return!!this.#a(t,null,!1)}getEvent(t,e){return this.#a(t,e||null,!0)}forEachEvent(t){let e=Array.from(this.#e.keys());e.sort((n,r)=>n.localeCompare(r));for(let n=0;n<e.length;n++){let r=e[n];t(this.#e.get(r),n)}}getError(t,e){if($(t)){let r=t.toLowerCase();if(Qs[r])return j.from(Qs[r].signature);for(let a of this.#t.values())if(r===a.selector)return a;return null}if(t.indexOf("(")===-1){let r=[];for(let[a,o]of this.#t)a.split("(")[0]===t&&r.push(o);if(r.length===0)return t==="Error"?j.from("error Error(string)"):t==="Panic"?j.from("error Panic(uint256)"):null;if(r.length>1){let a=r.map(o=>JSON.stringify(o.format())).join(", ");f(!1,`ambiguous error description (i.e. ${a})`,"name",t)}return r[0]}if(t=j.from(t).format(),t==="Error(string)")return j.from("error Error(string)");if(t==="Panic(uint256)")return j.from("error Panic(uint256)");let n=this.#t.get(t);return n||null}forEachError(t){let e=Array.from(this.#t.keys());e.sort((n,r)=>n.localeCompare(r));for(let n=0;n<e.length;n++){let r=e[n];t(this.#t.get(r),n)}}_decodeParams(t,e){return this.#r.decode(t,e)}_encodeParams(t,e){return this.#r.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if(typeof t=="string"){let n=this.getError(t);f(n,"unknown error","fragment",t),t=n}return f(Ct(e,0,4)===t.selector,`data signature does not match error ${t.name}.`,"data",e),this._decodeParams(t.inputs,Ct(e,4))}encodeErrorResult(t,e){if(typeof t=="string"){let n=this.getError(t);f(n,"unknown error","fragment",t),t=n}return ct([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if(typeof t=="string"){let n=this.getFunction(t);f(n,"unknown function","fragment",t),t=n}return f(Ct(e,0,4)===t.selector,`data signature does not match function ${t.name}.`,"data",e),this._decodeParams(t.inputs,Ct(e,4))}encodeFunctionData(t,e){if(typeof t=="string"){let n=this.getFunction(t);f(n,"unknown function","fragment",t),t=n}return ct([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if(typeof t=="string"){let a=this.getFunction(t);f(a,"unknown function","fragment",t),t=a}let n="invalid length for result data",r=q(e);if(r.length%32===0)try{return this.#r.decode(t.outputs,r)}catch{n="could not decode result data"}y(!1,n,"BAD_DATA",{value:P(r),info:{method:t.name,signature:t.format()}})}makeError(t,e){let n=V(t,"data"),r=It.getBuiltinCallException("call",e,n),a="execution reverted (unknown custom error)";if(r.message.startsWith(a)){let i=P(n.slice(0,4)),c=this.getError(i);if(c)try{let l=this.#r.decode(c.inputs,n.slice(4));r.revert={name:c.name,signature:c.format(),args:l},r.reason=r.revert.signature,r.message=`execution reverted: ${r.reason}`}catch{r.message="execution reverted (coult not decode custom error)"}}let o=this.parseTransaction(e);return o&&(r.invocation={method:o.name,signature:o.signature,args:o.args}),r}encodeFunctionResult(t,e){if(typeof t=="string"){let n=this.getFunction(t);f(n,"unknown function","fragment",t),t=n}return P(this.#r.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if(typeof t=="string"){let a=this.getEvent(t);f(a,"unknown event","eventFragment",t),t=a}y(e.length<=t.inputs.length,`too many arguments for ${t.format()}`,"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});let n=[];t.anonymous||n.push(t.topicHash);let r=(a,o)=>a.type==="string"?Ut(o):a.type==="bytes"?et(P(o)):(a.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":a.type.match(/^u?int/)?o=_e(o):a.type.match(/^bytes/)?o=hn(o,32):a.type==="address"&&this.#r.encode(["address"],[o]),ge(P(o),32));for(e.forEach((a,o)=>{let i=t.inputs[o];if(!i.indexed){f(a==null,"cannot filter non-indexed parameters; must be null","contract."+i.name,a);return}a==null?n.push(null):i.baseType==="array"||i.baseType==="tuple"?f(!1,"filtering with tuples or arrays not supported","contract."+i.name,a):Array.isArray(a)?n.push(a.map(c=>r(i,c))):n.push(r(i,a))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(t,e){if(typeof t=="string"){let o=this.getEvent(t);f(o,"unknown event","eventFragment",t),t=o}let n=[],r=[],a=[];return t.anonymous||n.push(t.topicHash),f(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach((o,i)=>{let c=e[i];if(o.indexed)if(o.type==="string")n.push(Ut(c));else if(o.type==="bytes")n.push(et(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(this.#r.encode([o.type],[c]))}else r.push(o),a.push(c)}),{data:this.#r.encode(r,a),topics:n}}decodeEventLog(t,e,n){if(typeof t=="string"){let h=this.getEvent(t);f(h,"unknown event","eventFragment",t),t=h}if(n!=null&&!t.anonymous){let h=t.topicHash;f($(n[0],32)&&n[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}let r=[],a=[],o=[];t.inputs.forEach((h,x)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(r.push(D.from({type:"bytes32",name:h.name})),o.push(!0)):(r.push(h),o.push(!1)):(a.push(h),o.push(!1))});let i=n!=null?this.#r.decode(r,ct(n)):null,c=this.#r.decode(a,e,!0),l=[],u=[],d=0,p=0;return t.inputs.forEach((h,x)=>{let w=null;if(h.indexed)if(i==null)w=new Ee(null);else if(o[x])w=new Ee(i[p++]);else try{w=i[p++]}catch(A){w=A}else try{w=c[d++]}catch(A){w=A}l.push(w),u.push(h.name||null)}),X.fromItems(l,u)}parseTransaction(t){let e=V(t.data,"tx.data"),n=T(t.value!=null?t.value:0,"tx.value"),r=this.getFunction(P(e.slice(0,4)));if(!r)return null;let a=this.#r.decode(r.inputs,e.slice(4));return new ze(r,r.selector,a,n)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new je(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){let e=P(t),n=this.getError(Ct(e,0,4));if(!n)return null;let r=this.#r.decode(n.inputs,Ct(e,4));return new Je(n,n.selector,r)}static from(t){return t instanceof b?t:typeof t=="string"?new b(JSON.parse(t)):typeof t.formatJson=="function"?new b(t.formatJson()):typeof t.format=="function"?new b(t.format("json")):new b(t)}};var ea=BigInt(0);function hr(s){return s??null}function z(s){return s==null?null:s.toString()}function na(s){let t={};s.to&&(t.to=s.to),s.from&&(t.from=s.from),s.data&&(t.data=P(s.data));let e="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(let r of e)!(r in s)||s[r]==null||(t[r]=T(s[r],`request.${r}`));let n="type,nonce".split(/,/);for(let r of n)!(r in s)||s[r]==null||(t[r]=R(s[r],`request.${r}`));return s.accessList&&(t.accessList=We(s.accessList)),"blockTag"in s&&(t.blockTag=s.blockTag),"enableCcipRead"in s&&(t.enableCcipRead=!!s.enableCcipRead),"customData"in s&&(t.customData=s.customData),"blobVersionedHashes"in s&&s.blobVersionedHashes&&(t.blobVersionedHashes=s.blobVersionedHashes.slice()),"kzg"in s&&(t.kzg=s.kzg),"blobs"in s&&s.blobs&&(t.blobs=s.blobs.map(r=>Yn(r)?P(r):Object.assign({},r))),t}var ta=class{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#t;constructor(t,e){this.#t=t.transactions.map(n=>typeof n!="string"?new qt(n,e):n),C(this,{provider:e,hash:hr(t.hash),number:t.number,timestamp:t.timestamp,parentHash:t.parentHash,parentBeaconBlockRoot:t.parentBeaconBlockRoot,nonce:t.nonce,difficulty:t.difficulty,gasLimit:t.gasLimit,gasUsed:t.gasUsed,blobGasUsed:t.blobGasUsed,excessBlobGas:t.excessBlobGas,miner:t.miner,prevRandao:hr(t.prevRandao),extraData:t.extraData,baseFeePerGas:hr(t.baseFeePerGas),stateRoot:t.stateRoot,receiptsRoot:t.receiptsRoot})}get transactions(){return this.#t.map(t=>typeof t=="string"?t:t.hash)}get prefetchedTransactions(){let t=this.#t.slice();return t.length===0?[]:(y(typeof t[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),t)}toJSON(){let{baseFeePerGas:t,difficulty:e,extraData:n,gasLimit:r,gasUsed:a,hash:o,miner:i,prevRandao:c,nonce:l,number:u,parentHash:d,parentBeaconBlockRoot:p,stateRoot:h,receiptsRoot:x,timestamp:w,transactions:A}=this;return{_type:"Block",baseFeePerGas:z(t),difficulty:z(e),extraData:n,gasLimit:z(r),gasUsed:z(a),blobGasUsed:z(this.blobGasUsed),excessBlobGas:z(this.excessBlobGas),hash:o,miner:i,prevRandao:c,nonce:l,number:u,parentHash:d,timestamp:w,parentBeaconBlockRoot:p,stateRoot:h,receiptsRoot:x,transactions:A}}[Symbol.iterator](){let t=0,e=this.transactions;return{next:()=>t<this.length?{value:e[t++],done:!1}:{value:void 0,done:!0}}}get length(){return this.#t.length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(t){let e;if(typeof t=="number")e=this.#t[t];else{let n=t.toLowerCase();for(let r of this.#t)if(typeof r=="string"){if(r!==n)continue;e=r;break}else{if(r.hash===n)continue;e=r;break}}if(e==null)throw new Error("no such tx");return typeof e=="string"?await this.provider.getTransaction(e):e}getPrefetchedTransaction(t){let e=this.prefetchedTransactions;if(typeof t=="number")return e[t];t=t.toLowerCase();for(let n of e)if(n.hash===t)return n;f(!1,"no matching transaction","indexOrHash",t)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return yo(this)}},Mt=class{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(t,e){this.provider=e;let n=Object.freeze(t.topics.slice());C(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:n,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){let{address:t,blockHash:e,blockNumber:n,data:r,index:a,removed:o,topics:i,transactionHash:c,transactionIndex:l}=this;return{_type:"log",address:t,blockHash:e,blockNumber:n,data:r,index:a,removed:o,topics:i,transactionHash:c,transactionIndex:l}}async getBlock(){let t=await this.provider.getBlock(this.blockHash);return y(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){let t=await this.provider.getTransaction(this.transactionHash);return y(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){let t=await this.provider.getTransactionReceipt(this.transactionHash);return y(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return bo(this)}},Sn=class{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(r=>new Mt(r,e)));let n=ea;t.effectiveGasPrice!=null?n=t.effectiveGasPrice:t.gasPrice!=null&&(n=t.gasPrice),C(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:n,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return this.#t}toJSON(){let{to:t,from:e,contractAddress:n,hash:r,index:a,blockHash:o,blockNumber:i,logsBloom:c,logs:l,status:u,root:d}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:i,contractAddress:n,cumulativeGasUsed:z(this.cumulativeGasUsed),from:e,gasPrice:z(this.gasPrice),blobGasUsed:z(this.blobGasUsed),blobGasPrice:z(this.blobGasPrice),gasUsed:z(this.gasUsed),hash:r,index:a,logs:l,logsBloom:c,root:d,status:u,to:t}}get length(){return this.logs.length}[Symbol.iterator](){let t=0;return{next:()=>t<this.length?{value:this.logs[t++],done:!1}:{value:void 0,done:!0}}}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 sa(this)}reorderedEvent(t){return y(!t||t.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),ra(this,t)}},qt=class{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:n,hash:r,type:a,to:o,from:i,nonce:c,data:l,signature:u,accessList:d,blobVersionedHashes:p}=this;return{_type:"TransactionResponse",accessList:d,blockNumber:t,blockHash:e,blobVersionedHashes:p,chainId:z(this.chainId),data:l,from:i,gasLimit:z(this.gasLimit),gasPrice:z(this.gasPrice),hash:r,maxFeePerGas:z(this.maxFeePerGas),maxPriorityFeePerGas:z(this.maxPriorityFeePerGas),maxFeePerBlobGas:z(this.maxFeePerBlobGas),nonce:c,signature:u,to:o,index:n,type:a,value:z(this.value)}}async getBlock(){let t=this.blockNumber;if(t==null){let n=await this.getTransaction();n&&(t=n.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:n}=await he({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return e==null||e.blockNumber==null?0:n-e.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){let n=t??1,r=e??0,a=this.#t,o=-1,i=a===-1,c=async()=>{if(i)return null;let{blockNumber:p,nonce:h}=await he({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(h<this.nonce){a=p;return}if(i)return null;let x=await this.getTransaction();if(!(x&&x.blockNumber!=null))for(o===-1&&(o=a-3,o<this.#t&&(o=this.#t));o<=p;){if(i)return null;let w=await this.provider.getBlock(o,!0);if(w==null)return;for(let A of w)if(A===this.hash)return;for(let A=0;A<w.length;A++){let k=await w.getTransaction(A);if(k.from===this.from&&k.nonce===this.nonce){if(i)return null;let F=await this.provider.getTransactionReceipt(k.hash);if(F==null||p-F.blockNumber+1<n)return;let H="replaced";k.data===this.data&&k.to===this.to&&k.value===this.value?H="repriced":k.data==="0x"&&k.from===k.to&&k.value===ea&&(H="cancelled"),y(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:H==="replaced"||H==="cancelled",reason:H,replacement:k.replaceableTransaction(a),hash:k.hash,receipt:F})}}o++}},l=p=>{if(p==null||p.status!==0)return p;y(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:p.to,from:p.from,data:""},receipt:p})},u=await this.provider.getTransactionReceipt(this.hash);if(n===0)return l(u);if(u){if(await u.confirmations()>=n)return l(u)}else if(await c(),n===0)return null;return await new Promise((p,h)=>{let x=[],w=()=>{x.forEach(k=>k())};if(x.push(()=>{i=!0}),r>0){let k=setTimeout(()=>{w(),h(Pt("wait for transaction timeout","TIMEOUT"))},r);x.push(()=>{clearTimeout(k)})}let A=async k=>{if(await k.confirmations()>=n){w();try{p(l(k))}catch(F){h(F)}}};if(x.push(()=>{this.provider.off(this.hash,A)}),this.provider.on(this.hash,A),a>=0){let k=async()=>{try{await c()}catch(F){if(xt(F,"TRANSACTION_REPLACED")){w(),h(F);return}}i||this.provider.once("block",k)};x.push(()=>{this.provider.off("block",k)}),this.provider.once("block",k)}})}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 y(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),sa(this)}reorderedEvent(t){return y(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),y(!t||t.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),ra(this,t)}replaceableTransaction(t){f(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);let e=new qt(this,this.provider);return e.#t=t,e}};function yo(s){return{orphan:"drop-block",hash:s.hash,number:s.number}}function ra(s,t){return{orphan:"reorder-transaction",tx:s,other:t}}function sa(s){return{orphan:"drop-transaction",tx:s}}function bo(s){return{orphan:"drop-log",log:{transactionHash:s.transactionHash,blockHash:s.blockHash,blockNumber:s.blockNumber,address:s.address,data:s.data,topics:Object.freeze(s.topics.slice()),index:s.index}}}var te=class extends Mt{interface;fragment;args;constructor(t,e,n){super(t,t.provider);let r=e.decodeEventLog(n,t.data,t.topics);C(this,{args:r,fragment:n,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}},ke=class extends Mt{error;constructor(t,e){super(t,t.provider),C(this,{error:e})}},Ln=class extends Sn{#t;constructor(t,e,n){super(n,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 te(t,this.#t,e)}catch(n){return new ke(t,n)}return t})}},ee=class extends qt{#t;constructor(t,e,n){super(n,e),this.#t=t}async wait(t,e){let n=await super.wait(t,e);return n==null?null:new Ln(this.#t,this.provider,n)}},ve=class extends Ue{log;constructor(t,e,n,r){super(t,e,n),C(this,{log:r})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}},Xe=class extends ve{constructor(t,e,n,r,a){super(t,e,n,new te(a,t.interface,r));let o=t.interface.decodeEventLog(r,this.log.data,this.log.topics);C(this,{args:o,fragment:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}};var aa=BigInt(0);function ia(s){return s&&typeof s.call=="function"}function ca(s){return s&&typeof s.estimateGas=="function"}function Hn(s){return s&&typeof s.resolveName=="function"}function la(s){return s&&typeof s.sendTransaction=="function"}function ua(s){if(s!=null){if(Hn(s))return s;if(s.provider)return s.provider}}var mr=class{#t;fragment;constructor(t,e,n){if(C(this,{fragment:e}),e.inputs.length<n.length)throw new Error("too many arguments");let r=re(t.runner,"resolveName"),a=Hn(r)?r:null;this.#t=async function(){let o=await Promise.all(e.inputs.map((i,c)=>n[c]==null?null:i.walkAsync(n[c],(u,d)=>u==="address"?Array.isArray(d)?Promise.all(d.map(p=>Xt(p,a))):Xt(d,a):d)));return t.interface.encodeFilterTopics(e,o)}()}getTopicFilter(){return this.#t}};function re(s,t){return s==null?null:typeof s[t]=="function"?s:s.provider&&typeof s.provider[t]=="function"?s.provider:null}function ne(s){return s==null?null:s.provider||null}async function da(s,t){let e=O.dereference(s,"overrides");f(typeof e=="object","invalid overrides parameter","overrides",s);let n=na(e);return f(n.to==null||(t||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),f(n.data==null||(t||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function xo(s,t,e){let n=re(s,"resolveName"),r=Hn(n)?n:null;return await Promise.all(t.map((a,o)=>a.walkAsync(e[o],(i,c)=>(c=O.dereference(c,i),i==="address"?Xt(c,r):c))))}function Co(s){let t=async function(o){let i=await da(o,["data"]);i.to=await s.getAddress(),i.from&&(i.from=await Xt(i.from,ua(s.runner)));let c=s.interface,l=T(i.value||aa,"overrides.value")===aa,u=(i.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!u&&!l&&f(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),f(c.fallback||u,"cannot send data to receive-only contract","overrides.data",i.data);let d=c.receive||c.fallback&&c.fallback.payable;return f(d||l,"cannot send value to non-payable fallback","overrides.value",i.value),f(c.fallback||u,"cannot send data to receive-only contract","overrides.data",i.data),i},e=async function(o){let i=re(s.runner,"call");y(ia(i),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let c=await t(o);try{return await i.call(c)}catch(l){throw pn(l)&&l.data?s.interface.makeError(l.data,c):l}},n=async function(o){let i=s.runner;y(la(i),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let c=await i.sendTransaction(await t(o)),l=ne(s.runner);return new ee(s.interface,l,c)},r=async function(o){let i=re(s.runner,"estimateGas");return y(ca(i),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await i.estimateGas(await t(o))},a=async o=>await n(o);return C(a,{_contract:s,estimateGas:r,populateTransaction:t,send:n,staticCall:e}),a}function wo(s,t){let e=function(...l){let u=s.interface.getFunction(t,l);return y(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:l}}),u},n=async function(...l){let u=e(...l),d={};if(u.inputs.length+1===l.length&&(d=await da(l.pop()),d.from&&(d.from=await Xt(d.from,ua(s.runner)))),u.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");let p=await xo(s.runner,u.inputs,l);return Object.assign({},d,await he({to:s.getAddress(),data:s.interface.encodeFunctionData(u,p)}))},r=async function(...l){let u=await i(...l);return u.length===1?u[0]:u},a=async function(...l){let u=s.runner;y(la(u),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let d=await u.sendTransaction(await n(...l)),p=ne(s.runner);return new ee(s.interface,p,d)},o=async function(...l){let u=re(s.runner,"estimateGas");return y(ca(u),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await u.estimateGas(await n(...l))},i=async function(...l){let u=re(s.runner,"call");y(ia(u),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let d;try{d=await n(...l)}catch(x){let w=l.at(-1).blockTag;throw w&&(x.blockNumber=w),x}let p="0x";try{p=await u.call(d)}catch(x){throw pn(x)&&x.data?s.interface.makeError(x.data,d):x}let h=e(...l);return s.interface.decodeFunctionResult(h,p)},c=async(...l)=>e(...l).constant?await r(...l):await a(...l);return C(c,{name:s.interface.getFunctionName(t),_contract:s,_key:t,getFragment:e,estimateGas:o,populateTransaction:n,send:a,staticCall:r,staticCallResult:i}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{let l=s.interface.getFunction(t);return y(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),l}}),c}function To(s,t){let e=function(...r){let a=s.interface.getEvent(t,r);return y(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:r}}),a},n=function(...r){return new mr(s,e(...r),r)};return C(n,{name:s.interface.getEventName(t),_contract:s,_key:t,getFragment:e}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{let r=s.interface.getEvent(t);return y(r,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),r}}),n}var _n=Symbol.for("_ethersInternal_contract"),pa=new WeakMap;function Eo(s,t){pa.set(s[_n],t)}function ut(s){return pa.get(s[_n])}function ko(s){return s&&typeof s=="object"&&"getTopicFilter"in s&&typeof s.getTopicFilter=="function"&&s.fragment}async function br(s,t){let e,n=null;if(Array.isArray(t)){let a=function(o){if($(o,32))return o;let i=s.interface.getEvent(o);return f(i,"unknown fragment","name",o),i.topicHash};e=t.map(o=>o==null?null:Array.isArray(o)?o.map(a):a(o))}else t==="*"?e=[null]:typeof t=="string"?$(t,32)?e=[t]:(n=s.interface.getEvent(t),f(n,"unknown fragment","event",t),e=[n.topicHash]):ko(t)?e=await t.getTopicFilter():"fragment"in t?(n=t.fragment,e=[n.topicHash]):f(!1,"unknown event name","event",t);e=e.map(a=>{if(a==null)return null;if(Array.isArray(a)){let o=Array.from(new Set(a.map(i=>i.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return a.toLowerCase()});let r=e.map(a=>a==null?"null":Array.isArray(a)?a.join("|"):a).join("&");return{fragment:n,tag:r,topics:e}}async function Ze(s,t){let{subs:e}=ut(s);return e.get((await br(s,t)).tag)||null}async function oa(s,t,e){let n=ne(s.runner);y(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:t});let{fragment:r,tag:a,topics:o}=await br(s,e),{addr:i,subs:c}=ut(s),l=c.get(a);if(!l){let d={address:i||s,topics:o},p=A=>{let k=r;if(k==null)try{k=s.interface.getEvent(A.topics[0])}catch{}if(k){let F=k,H=r?s.interface.decodeEventLog(r,A.data,A.topics):[];yr(s,e,H,pe=>new Xe(s,pe,e,F,A))}else yr(s,e,[],F=>new ve(s,F,e,A))},h=[];l={tag:a,listeners:[],start:()=>{h.length||h.push(n.on(d,p))},stop:async()=>{if(h.length==0)return;let A=h;h=[],await Promise.all(A),n.off(d,p)}},c.set(a,l)}return l}var gr=Promise.resolve();async function vo(s,t,e,n){await gr;let r=await Ze(s,t);if(!r)return!1;let a=r.listeners.length;return r.listeners=r.listeners.filter(({listener:o,once:i})=>{let c=Array.from(e);n&&c.push(n(i?null:o));try{o.call(s,...c)}catch{}return!i}),r.listeners.length===0&&(r.stop(),ut(s).subs.delete(r.tag)),a>0}async function yr(s,t,e,n){try{await gr}catch{}let r=vo(s,t,e,n);return gr=r,await r}var Dn=["then"],gt=class{target;interface;runner;filters;[_n];fallback;constructor(t,e,n,r){f(typeof t=="string"||En(t),"invalid value for Contract target","target",t),n==null&&(n=null);let a=b.from(e);C(this,{target:t,runner:n,interface:a}),Object.defineProperty(this,_n,{value:{}});let o,i=null,c=null;if(r){let d=ne(n);c=new ee(this.interface,d,r)}let l=new Map;if(typeof t=="string")if($(t))i=t,o=Promise.resolve(t);else{let d=re(n,"resolveName");if(!Hn(d))throw Pt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=d.resolveName(t).then(p=>{if(p==null)throw Pt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return ut(this).addr=p,p})}else o=t.getAddress().then(d=>{if(d==null)throw new Error("TODO");return ut(this).addr=d,d});Eo(this,{addrPromise:o,addr:i,deployTx:c,subs:l});let u=new Proxy({},{get:(d,p,h)=>{if(typeof p=="symbol"||Dn.indexOf(p)>=0)return Reflect.get(d,p,h);try{return this.getEvent(p)}catch(x){if(!xt(x,"INVALID_ARGUMENT")||x.argument!=="key")throw x}},has:(d,p)=>Dn.indexOf(p)>=0?Reflect.has(d,p):Reflect.has(d,p)||this.interface.hasEvent(String(p))});return C(this,{filters:u}),C(this,{fallback:a.receive||a.fallback?Co(this):null}),new Proxy(this,{get:(d,p,h)=>{if(typeof p=="symbol"||p in d||Dn.indexOf(p)>=0)return Reflect.get(d,p,h);try{return d.getFunction(p)}catch(x){if(!xt(x,"INVALID_ARGUMENT")||x.argument!=="key")throw x}},has:(d,p)=>typeof p=="symbol"||p in d||Dn.indexOf(p)>=0?Reflect.has(d,p):d.interface.hasFunction(p)})}connect(t){return new gt(this.target,this.interface,t)}attach(t){return new gt(t,this.interface,this.runner)}async getAddress(){return await ut(this).addrPromise}async getDeployedCode(){let t=ne(this.runner);y(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 n=ne(this.runner);return y(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((r,a)=>{let o=async()=>{try{if(await this.getDeployedCode()!=null)return r(this);n.once("block",o)}catch(i){a(i)}};o()})}deploymentTransaction(){return ut(this).deployTx}getFunction(t){return typeof t!="string"&&(t=t.format()),wo(this,t)}getEvent(t){return typeof t!="string"&&(t=t.format()),To(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,n){e==null&&(e=0),n==null&&(n="latest");let{addr:r,addrPromise:a}=ut(this),o=r||await a,{fragment:i,topics:c}=await br(this,t),l={address:o,topics:c,fromBlock:e,toBlock:n},u=ne(this.runner);return y(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(l)).map(d=>{let p=i;if(p==null)try{p=this.interface.getEvent(d.topics[0])}catch{}if(p)try{return new te(d,this.interface,p)}catch(h){return new ke(d,h)}return new Mt(d,u)})}async on(t,e){let n=await oa(this,"on",t);return n.listeners.push({listener:e,once:!1}),n.start(),this}async once(t,e){let n=await oa(this,"once",t);return n.listeners.push({listener:e,once:!0}),n.start(),this}async emit(t,...e){return await yr(this,t,e,null)}async listenerCount(t){if(t){let r=await Ze(this,t);return r?r.listeners.length:0}let{subs:e}=ut(this),n=0;for(let{listeners:r}of e.values())n+=r.length;return n}async listeners(t){if(t){let r=await Ze(this,t);return r?r.listeners.map(({listener:a})=>a):[]}let{subs:e}=ut(this),n=[];for(let{listeners:r}of e.values())n=n.concat(r.map(({listener:a})=>a));return n}async off(t,e){let n=await Ze(this,t);if(!n)return this;if(e){let r=n.listeners.map(({listener:a})=>a).indexOf(e);r>=0&&n.listeners.splice(r,1)}return(e==null||n.listeners.length===0)&&(n.stop(),ut(this).subs.delete(n.tag)),this}async removeAllListeners(t){if(t){let e=await Ze(this,t);if(!e)return this;e.stop(),ut(this).subs.delete(e.tag)}else{let{subs:e}=ut(this);for(let{tag:n,stop:r}of e.values())r(),e.delete(n)}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 gt{constructor(r,a=null){super(r,t,a)}}return e}static from(t,e,n){return n==null&&(n=null),new this(t,e,n)}};function Po(){return gt}var Y=class extends Po(){};var fa=BigInt(0);function E(s,t){return function(e){return e==null?t:s(e)}}function Pe(s,t){return e=>{if(t&&e==null)return null;if(!Array.isArray(e))throw new Error("not an array");return e.map(n=>s(n))}}function se(s,t){return e=>{let n={};for(let r in s){let a=r;if(t&&r in t&&!(a in e)){for(let o of t[r])if(o in e){a=o;break}}try{let o=s[r](e[a]);o!==void 0&&(n[r]=o)}catch(o){let i=o instanceof Error?o.message:"not-an-error";y(!1,`invalid value for value.${r} (${i})`,"BAD_DATA",{value:e})}}return n}}function Ro(s){switch(s){case!0:case"true":return!0;case!1:case"false":return!1}f(!1,`invalid boolean; ${JSON.stringify(s)}`,"value",s)}function Gt(s){return f($(s,!0),"invalid data","value",s),s}function K(s){return f($(s,32),"invalid hash","value",s),s}var Ao=se({address:L,blockHash:K,blockNumber:R,data:Gt,index:R,removed:E(Ro,!1),topics:Pe(K),transactionHash:K,transactionIndex:R},{index:["logIndex"]});function ha(s){return Ao(s)}var Io=se({hash:E(K),parentHash:K,parentBeaconBlockRoot:E(K,null),number:R,timestamp:R,nonce:E(Gt),difficulty:T,gasLimit:T,gasUsed:T,stateRoot:E(K,null),receiptsRoot:E(K,null),blobGasUsed:E(T,null),excessBlobGas:E(T,null),miner:E(L),prevRandao:E(K,null),extraData:Gt,baseFeePerGas:E(T)},{prevRandao:["mixHash"]});function ma(s){let t=Io(s);return t.transactions=s.transactions.map(e=>typeof e=="string"?e:Cr(e)),t}var Oo=se({transactionIndex:R,blockNumber:R,transactionHash:K,address:L,topics:Pe(K),data:Gt,index:R,blockHash:K},{index:["logIndex"]});function xr(s){return Oo(s)}var lu=se({to:E(L,null),from:E(L,null),contractAddress:E(L,null),index:R,root:E(P),gasUsed:T,blobGasUsed:E(T,null),logsBloom:E(Gt),blockHash:K,hash:K,logs:Pe(xr),blockNumber:R,cumulativeGasUsed:T,effectiveGasPrice:E(T),blobGasPrice:E(T,null),status:E(R),type:E(R,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function Cr(s){s.to&&T(s.to)===fa&&(s.to="0x0000000000000000000000000000000000000000");let t=se({hash:K,index:E(R,void 0),type:e=>e==="0x"||e==null?0:R(e),accessList:E(We,null),blobVersionedHashes:E(Pe(K,!0),null),blockHash:E(K,null),blockNumber:E(R,null),transactionIndex:E(R,null),from:L,gasPrice:E(T),maxPriorityFeePerGas:E(T),maxFeePerGas:E(T),maxFeePerBlobGas:E(T,null),gasLimit:T,to:E(L,null),value:T,nonce:R,data:Gt,creates:E(L,null),chainId:E(T,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(s);if(t.to==null&&t.creates==null&&(t.creates=cr(t)),(s.type===1||s.type===2)&&s.accessList==null&&(t.accessList=[]),s.signature?t.signature=Z.from(s.signature):t.signature=Z.from(s),t.chainId==null){let e=t.signature.legacyChainId;e!=null&&(t.chainId=e)}return t.blockHash&&T(t.blockHash)===fa&&(t.blockHash=null),t}var $t=class extends $r{chainId;address;log;block;trace;blockNumber;transactionHash;transaction;transactionReceipt;timestamp;preparedData;constructor(t,e,n,r,a,o,i,c,l,u){super(l),this.chainId=t,this.log=a,this.block=r,this.trace=o,this.address=e.toLowerCase(),this.transaction=i,this.transactionReceipt=c,this.timestamp=n||new Date(0),this.preparedData=u,a?(this.blockNumber=a.blockNumber,this.transactionHash=a.transactionHash):r?this.blockNumber=r.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:Fe(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:Fe(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:Fe(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:Fe(e)};throw new Error("Invaid ctx argument can't happen")}},Re=class extends $t{getContractName(){return"account"}},Tt=class extends $t{constructor(t,e,n,r,a,o,i,c,l,u){super(t,e,n,r,a,o,i,c,l,u)}getContractName(){return"*"}getMetaDataInternal(t,e){let n=this.address;this.address="*";let r=super.getMetaDataInternal(t,e);return this.address=n,r}},Et=class extends $t{contract;contractName;constructor(t,e,n,r,a,o,i,c,l,u,d){super(n,e.address,r,a,o,i,c,l,u,d),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}},Ot=class{contract;constructor(t){this.contract=t}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())}},Nt=class{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}};var _=vt(Xn(),1);var Ye=class extends Error{e;constructor(t,e,n){super(t),this.stack=n}toString(){return this.message+`
|
|
2
|
+
import{a as va}from"./chunk-2GOCSOX5.js";import{a as Se}from"./chunk-7HVQTJAO.js";import{A as zn,Ab as jt,D as ot,Hc as Xn,W as Jn,bd as $r,fa as Gr,gd as dn,oa as it,pc as Fe,xb as fe}from"./chunk-JTQMVYTS.js";import{d as Mr,e as vt,g as M}from"./chunk-LLHU72AA.js";var Zo={};Mr(Zo,{ERC721BoundContractView:()=>un,ERC721ContractView:()=>jn,ERC721Processor:()=>kt,ERC721ProcessorTemplate:()=>Hr,ERC721__factory:()=>bt,getERC721Contract:()=>de,getERC721ContractOnContext:()=>jo,mockApprovalForAllLog:()=>Jo,mockApprovalLog:()=>zo,mockTransferLog:()=>Xo});var Wr="6.13.1";function Pa(s,t,e){let n=t.split("|").map(a=>a.trim());for(let a=0;a<n.length;a++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof s===t)return}let r=new Error(`invalid value for type ${t}`);throw r.code="INVALID_ARGUMENT",r.argument=`value.${e}`,r.value=s,r}async function he(s){let t=Object.keys(s);return(await Promise.all(t.map(n=>Promise.resolve(s[n])))).reduce((n,r,a)=>(n[t[a]]=r,n),{})}function C(s,t,e){for(let n in t){let r=t[n],a=e?e[n]:null;a&&Pa(r,a,n),Object.defineProperty(s,n,{enumerable:!0,value:r,writable:!1})}}function me(s){if(s==null)return"null";if(Array.isArray(s))return"[ "+s.map(me).join(", ")+" ]";if(s instanceof Uint8Array){let t="0123456789abcdef",e="0x";for(let n=0;n<s.length;n++)e+=t[s[n]>>4],e+=t[s[n]&15];return e}if(typeof s=="object"&&typeof s.toJSON=="function")return me(s.toJSON());switch(typeof s){case"boolean":case"symbol":return s.toString();case"bigint":return BigInt(s).toString();case"number":return s.toString();case"string":return JSON.stringify(s);case"object":{let t=Object.keys(s);return t.sort(),"{ "+t.map(e=>`${me(e)}: ${me(s[e])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function xt(s,t){return s&&s.code===t}function pn(s){return xt(s,"CALL_EXCEPTION")}function Pt(s,t,e){let n=s;{let a=[];if(e){if("message"in e||"code"in e||"name"in e)throw new Error(`value will overwrite populated values: ${me(e)}`);for(let o in e){if(o==="shortMessage")continue;let i=e[o];a.push(o+"="+me(i))}}a.push(`code=${t}`),a.push(`version=${Wr}`),a.length&&(s+=" ("+a.join(", ")+")")}let r;switch(t){case"INVALID_ARGUMENT":r=new TypeError(s);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(s);break;default:r=new Error(s)}return C(r,{code:t}),e&&Object.assign(r,e),r.shortMessage==null&&C(r,{shortMessage:n}),r}function y(s,t,e,n){if(!s)throw Pt(t,e,n)}function f(s,t,e,n){y(s,t,"INVALID_ARGUMENT",{argument:e,value:n})}function Le(s,t,e){e==null&&(e=""),e&&(e=": "+e),y(s>=t,"missing arguemnt"+e,"MISSING_ARGUMENT",{count:s,expectedCount:t}),y(s<=t,"too many arguments"+e,"UNEXPECTED_ARGUMENT",{count:s,expectedCount:t})}var Ra=["NFD","NFC","NFKD","NFKC"].reduce((s,t)=>{try{if("test".normalize(t)!=="test")throw new Error("bad");if(t==="NFD"){let e=String.fromCharCode(233).normalize("NFD"),n=String.fromCharCode(101,769);if(e!==n)throw new Error("broken")}s.push(t)}catch{}return s},[]);function Zn(s){y(Ra.indexOf(s)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:s}})}function _t(s,t,e){if(e==null&&(e=""),s!==t){let n=e,r="new";e&&(n+=".",r+=" "+e),y(!1,`private constructor; use ${n}from* methods`,"UNSUPPORTED_OPERATION",{operation:r})}}function jr(s,t,e){if(s instanceof Uint8Array)return e?new Uint8Array(s):s;if(typeof s=="string"&&s.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){let n=new Uint8Array((s.length-2)/2),r=2;for(let a=0;a<n.length;a++)n[a]=parseInt(s.substring(r,r+2),16),r+=2;return n}f(!1,"invalid BytesLike value",t||"value",s)}function V(s,t){return jr(s,t,!1)}function q(s,t){return jr(s,t,!0)}function $(s,t){return!(typeof s!="string"||!s.match(/^0x[0-9A-Fa-f]*$/)||typeof t=="number"&&s.length!==2+2*t||t===!0&&s.length%2!==0)}function Yn(s){return $(s,!0)||s instanceof Uint8Array}var Kr="0123456789abcdef";function P(s){let t=V(s),e="0x";for(let n=0;n<t.length;n++){let r=t[n];e+=Kr[(r&240)>>4]+Kr[r&15]}return e}function ct(s){return"0x"+s.map(t=>P(t).substring(2)).join("")}function fn(s){return $(s,!0)?(s.length-2)/2:V(s).length}function Ct(s,t,e){let n=V(s);return e!=null&&e>n.length&&y(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:e}),P(n.slice(t??0,e??n.length))}function zr(s,t,e){let n=V(s);y(t>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:t,offset:t+1});let r=new Uint8Array(t);return r.fill(0),e?r.set(n,t-n.length):r.set(n,0),P(r)}function ge(s,t){return zr(s,t,!0)}function hn(s,t){return zr(s,t,!1)}var mn=BigInt(0),pt=BigInt(1),ye=9007199254740991;function Qn(s,t){let e=De(s,"value"),n=BigInt(R(t,"width"));if(y(e>>n===mn,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:s}),e>>n-pt){let r=(pt<<n)-pt;return-((~e&r)+pt)}return e}function qn(s,t){let e=T(s,"value"),n=BigInt(R(t,"width")),r=pt<<n-pt;if(e<mn){e=-e,y(e<=r,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:s});let a=(pt<<n)-pt;return(~e&a)+pt}else y(e<r,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:s});return e}function be(s,t){let e=De(s,"value"),n=BigInt(R(t,"bits"));return e&(pt<<n)-pt}function T(s,t){switch(typeof s){case"bigint":return s;case"number":return f(Number.isInteger(s),"underflow",t||"value",s),f(s>=-ye&&s<=ye,"overflow",t||"value",s),BigInt(s);case"string":try{if(s==="")throw new Error("empty string");return s[0]==="-"&&s[1]!=="-"?-BigInt(s.substring(1)):BigInt(s)}catch(e){f(!1,`invalid BigNumberish string: ${e.message}`,t||"value",s)}}f(!1,"invalid BigNumberish value",t||"value",s)}function De(s,t){let e=T(s,t);return y(e>=mn,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:s}),e}var Jr="0123456789abcdef";function gn(s){if(s instanceof Uint8Array){let t="0x0";for(let e of s)t+=Jr[e>>4],t+=Jr[e&15];return BigInt(t)}return T(s)}function R(s,t){switch(typeof s){case"bigint":return f(s>=-ye&&s<=ye,"overflow",t||"value",s),Number(s);case"number":return f(Number.isInteger(s),"underflow",t||"value",s),f(s>=-ye&&s<=ye,"overflow",t||"value",s),s;case"string":try{if(s==="")throw new Error("empty string");return R(BigInt(s),t)}catch(e){f(!1,`invalid numeric string: ${e.message}`,t||"value",s)}}f(!1,"invalid numeric value",t||"value",s)}function tr(s){return R(gn(s))}function _e(s,t){let n=De(s,"value").toString(16);if(t==null)n.length%2&&(n="0"+n);else{let r=R(t,"width");for(y(r*2>=n.length,`value exceeds width (${r} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:s});n.length<r*2;)n="0"+n}return"0x"+n}function He(s){let t=De(s,"value");if(t===mn)return new Uint8Array([]);let e=t.toString(16);e.length%2&&(e="0"+e);let n=new Uint8Array(e.length/2);for(let r=0;r<n.length;r++){let a=r*2;n[r]=parseInt(e.substring(a,a+2),16)}return n}var Ue=class{filter;emitter;#t;constructor(t,e,n){this.#t=e,C(this,{emitter:t,filter:n})}async removeListener(){this.#t!=null&&await this.emitter.off(this.filter,this.#t)}};function Aa(s,t,e,n,r){f(!1,`invalid codepoint at offset ${t}; ${s}`,"bytes",e)}function Xr(s,t,e,n,r){if(s==="BAD_PREFIX"||s==="UNEXPECTED_CONTINUE"){let a=0;for(let o=t+1;o<e.length&&e[o]>>6===2;o++)a++;return a}return s==="OVERRUN"?e.length-t-1:0}function Ia(s,t,e,n,r){return s==="OVERLONG"?(f(typeof r=="number","invalid bad code point for replacement","badCodepoint",r),n.push(r),0):(n.push(65533),Xr(s,t,e,n,r))}var Zr=Object.freeze({error:Aa,ignore:Xr,replace:Ia});function Oa(s,t){t==null&&(t=Zr.error);let e=V(s,"bytes"),n=[],r=0;for(;r<e.length;){let a=e[r++];if(!(a>>7)){n.push(a);continue}let o=null,i=null;if((a&224)===192)o=1,i=127;else if((a&240)===224)o=2,i=2047;else if((a&248)===240)o=3,i=65535;else{(a&192)===128?r+=t("UNEXPECTED_CONTINUE",r-1,e,n):r+=t("BAD_PREFIX",r-1,e,n);continue}if(r-1+o>=e.length){r+=t("OVERRUN",r-1,e,n);continue}let c=a&(1<<8-o-1)-1;for(let l=0;l<o;l++){let u=e[r];if((u&192)!=128){r+=t("MISSING_CONTINUE",r,e,n),c=null;break}c=c<<6|u&63,r++}if(c!==null){if(c>1114111){r+=t("OUT_OF_RANGE",r-1-o,e,n,c);continue}if(c>=55296&&c<=57343){r+=t("UTF16_SURROGATE",r-1-o,e,n,c);continue}if(c<=i){r+=t("OVERLONG",r-1-o,e,n,c);continue}n.push(c)}}return n}function xe(s,t){f(typeof s=="string","invalid string value","str",s),t!=null&&(Zn(t),s=s.normalize(t));let e=[];for(let n=0;n<s.length;n++){let r=s.charCodeAt(n);if(r<128)e.push(r);else if(r<2048)e.push(r>>6|192),e.push(r&63|128);else if((r&64512)==55296){n++;let a=s.charCodeAt(n);f(n<s.length&&(a&64512)===56320,"invalid surrogate pair","str",s);let o=65536+((r&1023)<<10)+(a&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(r>>12|224),e.push(r>>6&63|128),e.push(r&63|128)}return new Uint8Array(e)}function Na(s){return s.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function Ve(s,t){return Na(Oa(s,t))}function Yr(s){let t=[];for(;s;)t.unshift(s&255),s>>=8;return t}function qr(s){if(Array.isArray(s)){let n=[];if(s.forEach(function(a){n=n.concat(qr(a))}),n.length<=55)return n.unshift(192+n.length),n;let r=Yr(n.length);return r.unshift(247+r.length),r.concat(n)}let t=Array.prototype.slice.call(V(s,"object"));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;let e=Yr(t.length);return e.unshift(183+e.length),e.concat(t)}var Qr="0123456789abcdef";function er(s){let t="0x";for(let e of qr(s))t+=Qr[e>>4],t+=Qr[e&15];return t}var J=32,nr=new Uint8Array(J),Ba=["then"],yn={},ns=new WeakMap;function zt(s){return ns.get(s)}function ts(s,t){ns.set(s,t)}function Me(s,t){let e=new Error(`deferred error during ABI decoding triggered accessing ${s}`);throw e.error=t,e}function rr(s,t,e){return s.indexOf(null)>=0?t.map((n,r)=>n instanceof X?rr(zt(n),n,e):n):s.reduce((n,r,a)=>{let o=t.getValue(r);return r in n||(e&&o instanceof X&&(o=rr(zt(o),o,e)),n[r]=o),n},{})}var X=class extends Array{#t;constructor(...t){let e=t[0],n=t[1],r=(t[2]||[]).slice(),a=!0;e!==yn&&(n=t,r=[],a=!1),super(n.length),n.forEach((c,l)=>{this[l]=c});let o=r.reduce((c,l)=>(typeof l=="string"&&c.set(l,(c.get(l)||0)+1),c),new Map);if(ts(this,Object.freeze(n.map((c,l)=>{let u=r[l];return u!=null&&o.get(u)===1?u:null}))),this.#t=[],this.#t==null&&this.#t,!a)return;Object.freeze(this);let i=new Proxy(this,{get:(c,l,u)=>{if(typeof l=="string"){if(l.match(/^[0-9]+$/)){let p=R(l,"%index");if(p<0||p>=this.length)throw new RangeError("out of result range");let h=c[p];return h instanceof Error&&Me(`index ${p}`,h),h}if(Ba.indexOf(l)>=0)return Reflect.get(c,l,u);let d=c[l];if(d instanceof Function)return function(...p){return d.apply(this===u?c:this,p)};if(!(l in c))return c.getValue.apply(this===u?c:this,[l])}return Reflect.get(c,l,u)}});return ts(i,zt(this)),i}toArray(t){let e=[];return this.forEach((n,r)=>{n instanceof Error&&Me(`index ${r}`,n),t&&n instanceof X&&(n=n.toArray(t)),e.push(n)}),e}toObject(t){let e=zt(this);return e.reduce((n,r,a)=>(y(r!=null,`value at index ${a} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),rr(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 n=zt(this),r=[],a=[];for(let o=t;o<e;o++)r.push(this[o]),a.push(n[o]);return new X(yn,r,a)}filter(t,e){let n=zt(this),r=[],a=[];for(let o=0;o<this.length;o++){let i=this[o];i instanceof Error&&Me(`index ${o}`,i),t.call(e,i,o,this)&&(r.push(i),a.push(n[o]))}return new X(yn,r,a)}map(t,e){let n=[];for(let r=0;r<this.length;r++){let a=this[r];a instanceof Error&&Me(`index ${r}`,a),n.push(t.call(e,a,r,this))}return n}getValue(t){let e=zt(this).indexOf(t);if(e===-1)return;let n=this[e];return n instanceof Error&&Me(`property ${JSON.stringify(t)}`,n.error),n}static fromItems(t,e){return new X(yn,t,e)}};function es(s){let t=He(s);return y(t.length<=J,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:J,offset:t.length}),t.length!==J&&(t=q(ct([nr.slice(t.length%J),t]))),t}var W=class{name;type;localName;dynamic;constructor(t,e,n,r){C(this,{name:t,type:e,localName:n,dynamic:r},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(t,e){f(!1,t,this.localName,e)}},Jt=class{#t;#e;constructor(){this.#t=[],this.#e=0}get data(){return ct(this.#t)}get length(){return this.#e}#n(t){return this.#t.push(t),this.#e+=t.length,t.length}appendWriter(t){return this.#n(q(t.data))}writeBytes(t){let e=q(t),n=e.length%J;return n&&(e=q(ct([e,nr.slice(n)]))),this.#n(e)}writeValue(t){return this.#n(es(t))}writeUpdatableValue(){let t=this.#t.length;return this.#t.push(nr),this.#e+=J,e=>{this.#t[t]=es(e)}}},Ce=class{allowLoose;#t;#e;#n;#r;#s;constructor(t,e,n){C(this,{allowLoose:!!e}),this.#t=q(t),this.#n=0,this.#r=null,this.#s=n??1024,this.#e=0}get data(){return P(this.#t)}get dataLength(){return this.#t.length}get consumed(){return this.#e}get bytes(){return new Uint8Array(this.#t)}#a(t){if(this.#r)return this.#r.#a(t);this.#n+=t,y(this.#s<1||this.#n<=this.#s*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#s} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:q(this.#t),offset:this.#e,length:t,info:{bytesRead:this.#n,dataLength:this.dataLength}})}#o(t,e,n){let r=Math.ceil(e/J)*J;return this.#e+r>this.#t.length&&(this.allowLoose&&n&&this.#e+e<=this.#t.length?r=e:y(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:q(this.#t),length:this.#t.length,offset:this.#e+r})),this.#t.slice(this.#e,this.#e+r)}subReader(t){let e=new Ce(this.#t.slice(this.#e+t),this.allowLoose,this.#s);return e.#r=this,e}readBytes(t,e){let n=this.#o(0,t,!!e);return this.#a(t),this.#e+=n.length,n.slice(0,t)}readValue(){return gn(this.readBytes(J))}readIndex(){return tr(this.readBytes(J))}};function sr(s){if(!Number.isSafeInteger(s)||s<0)throw new Error(`Wrong positive integer: ${s}`)}function ar(s,...t){if(!(s instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(s.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${s.length}`)}function or(s,t=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(t&&s.finished)throw new Error("Hash#digest() has already been called")}function rs(s,t){ar(s);let e=t.outputLen;if(s.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var bn=BigInt(4294967295),ss=BigInt(32);function Fa(s,t=!1){return t?{h:Number(s&bn),l:Number(s>>ss&bn)}:{h:Number(s>>ss&bn)|0,l:Number(s&bn)|0}}function as(s,t=!1){let e=new Uint32Array(s.length),n=new Uint32Array(s.length);for(let r=0;r<s.length;r++){let{h:a,l:o}=Fa(s[r],t);[e[r],n[r]]=[a,o]}return[e,n]}var os=(s,t,e)=>s<<e|t>>>32-e,is=(s,t,e)=>t<<e|s>>>32-e,cs=(s,t,e)=>t<<e-32|s>>>64-e,ls=(s,t,e)=>s<<e-32|t>>>64-e;var Sa=s=>s instanceof Uint8Array;var us=s=>new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4));var La=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!La)throw new Error("Non little-endian hardware is not supported");function Da(s){if(typeof s!="string")throw new Error(`utf8ToBytes expected string, got ${typeof s}`);return new Uint8Array(new TextEncoder().encode(s))}function Cn(s){if(typeof s=="string"&&(s=Da(s)),!Sa(s))throw new Error(`expected Uint8Array, got ${typeof s}`);return s}var xn=class{clone(){return this._cloneInto()}},Ai={}.toString;function ds(s){let t=n=>s().update(Cn(n)).digest(),e=s();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>s(),t}function ps(s){let t=(n,r)=>s(r).update(Cn(n)).digest(),e=s({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>s(n),t}var[ms,gs,ys]=[[],[],[]],_a=BigInt(0),Ge=BigInt(1),Ha=BigInt(2),Ua=BigInt(7),Va=BigInt(256),Ma=BigInt(113);for(let s=0,t=Ge,e=1,n=0;s<24;s++){[e,n]=[n,(2*e+3*n)%5],ms.push(2*(5*n+e)),gs.push((s+1)*(s+2)/2%64);let r=_a;for(let a=0;a<7;a++)t=(t<<Ge^(t>>Ua)*Ma)%Va,t&Ha&&(r^=Ge<<(Ge<<BigInt(a))-Ge);ys.push(r)}var[Ga,$a]=as(ys,!0),fs=(s,t,e)=>e>32?cs(s,t,e):os(s,t,e),hs=(s,t,e)=>e>32?ls(s,t,e):is(s,t,e);function Wa(s,t=24){let e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=s[o]^s[o+10]^s[o+20]^s[o+30]^s[o+40];for(let o=0;o<10;o+=2){let i=(o+8)%10,c=(o+2)%10,l=e[c],u=e[c+1],d=fs(l,u,1)^e[i],p=hs(l,u,1)^e[i+1];for(let h=0;h<50;h+=10)s[o+h]^=d,s[o+h+1]^=p}let r=s[2],a=s[3];for(let o=0;o<24;o++){let i=gs[o],c=fs(r,a,i),l=hs(r,a,i),u=ms[o];r=s[u],a=s[u+1],s[u]=c,s[u+1]=l}for(let o=0;o<50;o+=10){for(let i=0;i<10;i++)e[i]=s[o+i];for(let i=0;i<10;i++)s[o+i]^=~e[(i+2)%10]&e[(i+4)%10]}s[0]^=Ga[n],s[1]^=$a[n]}e.fill(0)}var we=class extends xn{constructor(t,e,n,r=!1,a=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=a,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,sr(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=us(this.state)}keccak(){Wa(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){or(this);let{blockLen:e,state:n}=this;t=Cn(t);let r=t.length;for(let a=0;a<r;){let o=Math.min(e-this.pos,r-a);for(let i=0;i<o;i++)n[this.pos++]^=t[a++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:n,blockLen:r}=this;t[n]^=e,e&128&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){or(this,!1),ar(t),this.finish();let e=this.state,{blockLen:n}=this;for(let r=0,a=t.length;r<a;){this.posOut>=n&&this.keccak();let o=Math.min(n-this.posOut,a-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=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 sr(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:n,outputLen:r,rounds:a,enableXOF:o}=this;return t||(t=new we(e,n,r,o,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}},Ht=(s,t,e)=>ds(()=>new we(t,s,e)),Fi=Ht(6,144,224/8),Si=Ht(6,136,256/8),Li=Ht(6,104,384/8),Di=Ht(6,72,512/8),_i=Ht(1,144,224/8),bs=Ht(1,136,256/8),Hi=Ht(1,104,384/8),Ui=Ht(1,72,512/8),xs=(s,t,e)=>ps((n={})=>new we(t,s,n.dkLen===void 0?e:n.dkLen,!0)),Vi=xs(31,168,128/8),Mi=xs(31,136,256/8);var Cs=!1,ws=function(s){return bs(s)},Ts=ws;function et(s){let t=V(s,"data");return P(Ts(t))}et._=ws;et.lock=function(){Cs=!0};et.register=function(s){if(Cs)throw new TypeError("keccak256 is locked");Ts=s};Object.freeze(et);var wn="0x0000000000000000000000000000000000000000000000000000000000000000";var Es=BigInt(0),ks=BigInt(1),vs=BigInt(2),Ps=BigInt(27),Rs=BigInt(28),Tn=BigInt(35),Te={};function As(s){return ge(He(s),32)}var Z=class{#t;#e;#n;#r;get r(){return this.#t}set r(t){f(fn(t)===32,"invalid r","value",t),this.#t=P(t)}get s(){return this.#e}set s(t){f(fn(t)===32,"invalid s","value",t);let e=P(t);f(parseInt(e.substring(0,3))<8,"non-canonical s","value",e),this.#e=e}get v(){return this.#n}set v(t){let e=R(t,"value");f(e===27||e===28,"invalid v","v",t),this.#n=e}get networkV(){return this.#r}get legacyChainId(){let t=this.networkV;return t==null?null:Z.getChainId(t)}get yParity(){return this.v===27?0:1}get yParityAndS(){let t=V(this.s);return this.yParity&&(t[0]|=128),P(t)}get compactSerialized(){return ct([this.r,this.yParityAndS])}get serialized(){return ct([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(t,e,n,r){_t(t,Te,"Signature"),this.#t=e,this.#e=n,this.#n=r,this.#r=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 Z(Te,this.r,this.s,this.v);return this.networkV&&(t.#r=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=T(t,"v");return e==Ps||e==Rs?Es:(f(e>=Tn,"invalid EIP-155 v","v",t),(e-Tn)/vs)}static getChainIdV(t,e){return T(t)*vs+BigInt(35+e-27)}static getNormalizedV(t){let e=T(t);return e===Es||e===Ps?27:e===ks||e===Rs?28:(f(e>=Tn,"invalid v","v",t),e&ks?27:28)}static from(t){function e(l,u){f(l,u,"signature",t)}if(t==null)return new Z(Te,wn,wn,27);if(typeof t=="string"){let l=V(t,"signature");if(l.length===64){let u=P(l.slice(0,32)),d=l.slice(32,64),p=d[0]&128?28:27;return d[0]&=127,new Z(Te,u,P(d),p)}if(l.length===65){let u=P(l.slice(0,32)),d=l.slice(32,64);e((d[0]&128)===0,"non-canonical s");let p=Z.getNormalizedV(l[64]);return new Z(Te,u,P(d),p)}e(!1,"invalid raw signature length")}if(t instanceof Z)return t.clone();let n=t.r;e(n!=null,"missing r");let r=As(n),a=function(l,u){if(l!=null)return As(l);if(u!=null){e($(u,32),"invalid yParityAndS");let d=V(u);return d[0]&=127,P(d)}e(!1,"missing s")}(t.s,t.yParityAndS);e((V(a)[0]&128)==0,"non-canonical s");let{networkV:o,v:i}=function(l,u,d){if(l!=null){let p=T(l);return{networkV:p>=Tn?p:void 0,v:Z.getNormalizedV(p)}}if(u!=null)return e($(u,32),"invalid yParityAndS"),{v:V(u)[0]&128?28:27};if(d!=null){switch(R(d,"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),c=new Z(Te,r,a,i);return o&&(c.#r=o),e(t.yParity==null||R(t.yParity,"sig.yParity")===c.yParity,"yParity mismatch"),e(t.yParityAndS==null||t.yParityAndS===c.yParityAndS,"yParityAndS mismatch"),c}};var Ka=BigInt(0),ja=BigInt(36);function Is(s){s=s.toLowerCase();let t=s.substring(2).split(""),e=new Uint8Array(40);for(let r=0;r<40;r++)e[r]=t[r].charCodeAt(0);let n=V(et(e));for(let r=0;r<40;r+=2)n[r>>1]>>4>=8&&(t[r]=t[r].toUpperCase()),(n[r>>1]&15)>=8&&(t[r+1]=t[r+1].toUpperCase());return"0x"+t.join("")}var ir={};for(let s=0;s<10;s++)ir[String(s)]=String(s);for(let s=0;s<26;s++)ir[String.fromCharCode(65+s)]=String(10+s);var Os=15;function za(s){s=s.toUpperCase(),s=s.substring(4)+s.substring(0,2)+"00";let t=s.split("").map(n=>ir[n]).join("");for(;t.length>=Os;){let n=t.substring(0,Os);t=parseInt(n,10)%97+t.substring(n.length)}let e=String(98-parseInt(t,10)%97);for(;e.length<2;)e="0"+e;return e}var Ja=function(){let s={};for(let t=0;t<36;t++){let e="0123456789abcdefghijklmnopqrstuvwxyz"[t];s[e]=BigInt(t)}return s}();function Xa(s){s=s.toLowerCase();let t=Ka;for(let e=0;e<s.length;e++)t=t*ja+Ja[s[e]];return t}function L(s){if(f(typeof s=="string","invalid address","address",s),s.match(/^(0x)?[0-9a-fA-F]{40}$/)){s.startsWith("0x")||(s="0x"+s);let t=Is(s);return f(!s.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===s,"bad address checksum","address",s),t}if(s.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){f(s.substring(2,4)===za(s),"bad icap checksum","address",s);let t=Xa(s.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return Is("0x"+t)}f(!1,"invalid address","address",s)}function cr(s){let t=L(s.from),n=T(s.nonce,"tx.nonce").toString(16);return n==="0"?n="0x":n.length%2?n="0x0"+n:n="0x"+n,L(Ct(et(er([t,n])),12))}function En(s){return s&&typeof s.getAddress=="function"}async function lr(s,t){let e=await t;return(e==null||e==="0x0000000000000000000000000000000000000000")&&(y(typeof s!="string","unconfigured name","UNCONFIGURED_NAME",{value:s}),f(!1,"invalid AddressLike value; did not resolve to a value address","target",s)),L(e)}function Xt(s,t){if(typeof s=="string")return s.match(/^0x[0-9a-f]{40}$/i)?L(s):(y(t!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),lr(s,t.resolveName(s)));if(En(s))return lr(s,s.getAddress());if(s&&typeof s.then=="function")return lr(s,s);f(!1,"unsupported addressable value","target",s)}var ft={};function m(s,t){let e=!1;return t<0&&(e=!0,t*=-1),new O(ft,`${e?"":"u"}int${t}`,s,{signed:e,width:t})}function S(s,t){return new O(ft,`bytes${t||""}`,s,{size:t})}var Ns=Symbol.for("_ethers_typed"),O=class{type;value;#t;_typedSymbol;constructor(t,e,n,r){r==null&&(r=null),_t(ft,t,"Typed"),C(this,{_typedSymbol:Ns,type:e,value:n}),this.#t=r,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 O(ft,t,e)}static uint8(t){return m(t,8)}static uint16(t){return m(t,16)}static uint24(t){return m(t,24)}static uint32(t){return m(t,32)}static uint40(t){return m(t,40)}static uint48(t){return m(t,48)}static uint56(t){return m(t,56)}static uint64(t){return m(t,64)}static uint72(t){return m(t,72)}static uint80(t){return m(t,80)}static uint88(t){return m(t,88)}static uint96(t){return m(t,96)}static uint104(t){return m(t,104)}static uint112(t){return m(t,112)}static uint120(t){return m(t,120)}static uint128(t){return m(t,128)}static uint136(t){return m(t,136)}static uint144(t){return m(t,144)}static uint152(t){return m(t,152)}static uint160(t){return m(t,160)}static uint168(t){return m(t,168)}static uint176(t){return m(t,176)}static uint184(t){return m(t,184)}static uint192(t){return m(t,192)}static uint200(t){return m(t,200)}static uint208(t){return m(t,208)}static uint216(t){return m(t,216)}static uint224(t){return m(t,224)}static uint232(t){return m(t,232)}static uint240(t){return m(t,240)}static uint248(t){return m(t,248)}static uint256(t){return m(t,256)}static uint(t){return m(t,256)}static int8(t){return m(t,-8)}static int16(t){return m(t,-16)}static int24(t){return m(t,-24)}static int32(t){return m(t,-32)}static int40(t){return m(t,-40)}static int48(t){return m(t,-48)}static int56(t){return m(t,-56)}static int64(t){return m(t,-64)}static int72(t){return m(t,-72)}static int80(t){return m(t,-80)}static int88(t){return m(t,-88)}static int96(t){return m(t,-96)}static int104(t){return m(t,-104)}static int112(t){return m(t,-112)}static int120(t){return m(t,-120)}static int128(t){return m(t,-128)}static int136(t){return m(t,-136)}static int144(t){return m(t,-144)}static int152(t){return m(t,-152)}static int160(t){return m(t,-160)}static int168(t){return m(t,-168)}static int176(t){return m(t,-176)}static int184(t){return m(t,-184)}static int192(t){return m(t,-192)}static int200(t){return m(t,-200)}static int208(t){return m(t,-208)}static int216(t){return m(t,-216)}static int224(t){return m(t,-224)}static int232(t){return m(t,-232)}static int240(t){return m(t,-240)}static int248(t){return m(t,-248)}static int256(t){return m(t,-256)}static int(t){return m(t,-256)}static bytes1(t){return S(t,1)}static bytes2(t){return S(t,2)}static bytes3(t){return S(t,3)}static bytes4(t){return S(t,4)}static bytes5(t){return S(t,5)}static bytes6(t){return S(t,6)}static bytes7(t){return S(t,7)}static bytes8(t){return S(t,8)}static bytes9(t){return S(t,9)}static bytes10(t){return S(t,10)}static bytes11(t){return S(t,11)}static bytes12(t){return S(t,12)}static bytes13(t){return S(t,13)}static bytes14(t){return S(t,14)}static bytes15(t){return S(t,15)}static bytes16(t){return S(t,16)}static bytes17(t){return S(t,17)}static bytes18(t){return S(t,18)}static bytes19(t){return S(t,19)}static bytes20(t){return S(t,20)}static bytes21(t){return S(t,21)}static bytes22(t){return S(t,22)}static bytes23(t){return S(t,23)}static bytes24(t){return S(t,24)}static bytes25(t){return S(t,25)}static bytes26(t){return S(t,26)}static bytes27(t){return S(t,27)}static bytes28(t){return S(t,28)}static bytes29(t){return S(t,29)}static bytes30(t){return S(t,30)}static bytes31(t){return S(t,31)}static bytes32(t){return S(t,32)}static address(t){return new O(ft,"address",t)}static bool(t){return new O(ft,"bool",!!t)}static bytes(t){return new O(ft,"bytes",t)}static string(t){return new O(ft,"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 O(ft,"overrides",Object.assign({},t))}static isTyped(t){return t&&typeof t=="object"&&"_typedSymbol"in t&&t._typedSymbol===Ns}static dereference(t,e){if(O.isTyped(t)){if(t.type!==e)throw new Error(`invalid type: expecetd ${e}, got ${t.type}`);return t.value}return t}};var kn=class extends W{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){let n=O.dereference(e,"string");try{n=L(n)}catch(r){return this._throwError(r.message,e)}return t.writeValue(n)}decode(t){return L(_e(t.readValue(),20))}};var vn=class extends W{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 ur(s,t,e){let n=[];if(Array.isArray(e))n=e;else if(e&&typeof e=="object"){let c={};n=t.map(l=>{let u=l.localName;return y(u,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:e}),y(!c[u],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:l},value:e}),c[u]=!0,e[u]})}else f(!1,"invalid tuple value","tuple",e);f(t.length===n.length,"types/value length mismatch","tuple",e);let r=new Jt,a=new Jt,o=[];t.forEach((c,l)=>{let u=n[l];if(c.dynamic){let d=a.length;c.encode(a,u);let p=r.writeUpdatableValue();o.push(h=>{p(h+d)})}else c.encode(r,u)}),o.forEach(c=>{c(r.length)});let i=s.appendWriter(r);return i+=s.appendWriter(a),i}function dr(s,t){let e=[],n=[],r=s.subReader(0);return t.forEach(a=>{let o=null;if(a.dynamic){let i=s.readIndex(),c=r.subReader(i);try{o=a.decode(c)}catch(l){if(xt(l,"BUFFER_OVERRUN"))throw l;o=l,o.baseType=a.name,o.name=a.localName,o.type=a.type}}else try{o=a.decode(s)}catch(i){if(xt(i,"BUFFER_OVERRUN"))throw i;o=i,o.baseType=a.name,o.name=a.localName,o.type=a.type}if(o==null)throw new Error("investigate");e.push(o),n.push(a.localName||null)}),X.fromItems(e,n)}var Pn=class extends W{coder;length;constructor(t,e,n){let r=t.type+"["+(e>=0?e:"")+"]",a=e===-1||t.dynamic;super("array",r,n,a),C(this,{coder:t,length:e})}defaultValue(){let t=this.coder.defaultValue(),e=[];for(let n=0;n<this.length;n++)e.push(t);return e}encode(t,e){let n=O.dereference(e,"array");Array.isArray(n)||this._throwError("expected array value",n);let r=this.length;r===-1&&(r=n.length,t.writeValue(n.length)),Le(n.length,r,"coder array"+(this.localName?" "+this.localName:""));let a=[];for(let o=0;o<n.length;o++)a.push(this.coder);return ur(t,a,n)}decode(t){let e=this.length;e===-1&&(e=t.readIndex(),y(e*J<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:e*J,length:t.dataLength}));let n=[];for(let r=0;r<e;r++)n.push(new vn(this.coder));return dr(t,n)}};var Rn=class extends W{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){let n=O.dereference(e,"bool");return t.writeValue(n?1:0)}decode(t){return!!t.readValue()}};var $e=class extends W{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=q(e);let n=t.writeValue(e.length);return n+=t.writeBytes(e),n}decode(t){return t.readBytes(t.readIndex(),!0)}},An=class extends $e{constructor(t){super("bytes",t)}decode(t){return P(super.decode(t))}};var In=class extends W{size;constructor(t,e){let n="bytes"+String(t);super(n,n,e,!1),C(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,e){let n=q(O.dereference(e,this.type));return n.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(n)}decode(t){return P(t.readBytes(this.size))}};var Za=new Uint8Array([]),On=class extends W{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return e!=null&&this._throwError("not null",e),t.writeBytes(Za)}decode(t){return t.readBytes(0),null}};var Ya=BigInt(0),Qa=BigInt(1),qa=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Nn=class extends W{size;signed;constructor(t,e,n){let r=(e?"int":"uint")+t*8;super(r,r,n,!1),C(this,{size:t,signed:e},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,e){let n=T(O.dereference(e,this.type)),r=be(qa,J*8);if(this.signed){let a=be(r,this.size*8-1);(n>a||n<-(a+Qa))&&this._throwError("value out-of-bounds",e),n=qn(n,8*J)}else(n<Ya||n>be(r,this.size*8))&&this._throwError("value out-of-bounds",e);return t.writeValue(n)}decode(t){let e=be(t.readValue(),this.size*8);return this.signed&&(e=Qn(e,this.size*8)),e}};var Bn=class extends $e{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,xe(O.dereference(e,"string")))}decode(t){return Ve(super.decode(t))}};var Zt=class extends W{coders;constructor(t,e){let n=!1,r=[];t.forEach(o=>{o.dynamic&&(n=!0),r.push(o.type)});let a="tuple("+r.join(",")+")";super("tuple",a,e,n),C(this,{coders:Object.freeze(t.slice())})}defaultValue(){let t=[];this.coders.forEach(n=>{t.push(n.defaultValue())});let e=this.coders.reduce((n,r)=>{let a=r.localName;return a&&(n[a]||(n[a]=0),n[a]++),n},{});return this.coders.forEach((n,r)=>{let a=n.localName;!a||e[a]!==1||(a==="length"&&(a="_length"),t[a]==null&&(t[a]=t[r]))}),Object.freeze(t)}encode(t,e){let n=O.dereference(e,"tuple");return ur(t,this.coders,n)}decode(t){return dr(t,this.coders)}};function Ut(s){return et(xe(s))}function pr(s,t){return{address:L(s),storageKeys:t.map((e,n)=>(f($(e,32),"invalid slot",`storageKeys[${n}]`,e),e.toLowerCase()))}}function We(s){if(Array.isArray(s))return s.map((e,n)=>Array.isArray(e)?(f(e.length===2,"invalid slot set",`value[${n}]`,e),pr(e[0],e[1])):(f(e!=null&&typeof e=="object","invalid address-slot set","value",s),pr(e.address,e.storageKeys)));f(s!=null&&typeof s=="object","invalid access list","value",s);let t=Object.keys(s).map(e=>{let n=s[e].reduce((r,a)=>(r[a]=!0,r),{});return pr(e,Object.keys(n).sort())});return t.sort((e,n)=>e.address.localeCompare(n.address)),t}function tt(s){let t=new Set;return s.forEach(e=>t.add(e)),Object.freeze(t)}var to="external public payable override",eo=tt(to.split(" ")),Ms="constant external internal payable private public pure view override",no=tt(Ms.split(" ")),Gs="constructor error event fallback function receive struct",$s=tt(Gs.split(" ")),Ws="calldata memory storage payable indexed",ro=tt(Ws.split(" ")),so="tuple returns",ao=[Gs,Ws,so,Ms].join(" "),oo=tt(ao.split(" ")),io={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},co=new RegExp("^(\\s*)"),lo=new RegExp("^([0-9]+)"),uo=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),Ks=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),js=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),st=class{#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 st(this.#e)}reset(){this.#t=0}#n(t=0,e=0){return new st(this.#e.slice(t,e).map(n=>Object.freeze(Object.assign({},n,{match:n.match-t,linkBack:n.linkBack-t,linkNext:n.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.#n(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 n=this.peek().linkNext;e.push(this.#n(this.#t+1,n)),this.#t=n}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 n=this.#e[e];t.push(`${n.type}:${n.text}`)}return`<TokenString ${t.join(" ")}>`}};function Vt(s){let t=[],e=o=>{let i=a<s.length?JSON.stringify(s[a]):"$EOI";throw new Error(`invalid token ${i} at ${a}: ${o}`)},n=[],r=[],a=0;for(;a<s.length;){let o=s.substring(a),i=o.match(co);i&&(a+=i[1].length,o=s.substring(a));let c={depth:n.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:a,value:-1};t.push(c);let l=io[o[0]]||"";if(l){if(c.type=l,c.text=o[0],a++,l==="OPEN_PAREN")n.push(t.length-1),r.push(t.length-1);else if(l=="CLOSE_PAREN")n.length===0&&e("no matching open bracket"),c.match=n.pop(),t[c.match].match=t.length-1,c.depth--,c.linkBack=r.pop(),t[c.linkBack].linkNext=t.length-1;else if(l==="COMMA")c.linkBack=r.pop(),t[c.linkBack].linkNext=t.length-1,r.push(t.length-1);else if(l==="OPEN_BRACKET")c.type="BRACKET";else if(l==="CLOSE_BRACKET"){let u=t.pop().text;if(t.length>0&&t[t.length-1].type==="NUMBER"){let d=t.pop().text;u=d+u,t[t.length-1].value=R(d)}if(t.length===0||t[t.length-1].type!=="BRACKET")throw new Error("missing opening bracket");t[t.length-1].text+=u}continue}if(i=o.match(uo),i){if(c.text=i[1],a+=c.text.length,oo.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(js)){c.type="TYPE";continue}c.type="ID";continue}if(i=o.match(lo),i){c.text=i[1],c.type="NUMBER",a+=c.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${a}`)}return new st(t.map(o=>Object.freeze(o)))}function Bs(s,t){let e=[];for(let n in t.keys())s.has(n)&&e.push(n);if(e.length>1)throw new Error(`conflicting types: ${e.join(", ")}`)}function Fn(s,t){if(t.peekKeyword($s)){let e=t.pop().text;if(e!==s)throw new Error(`expected ${s}, got ${e}`)}return t.popType("ID")}function At(s,t){let e=new Set;for(;;){let n=s.peekType("KEYWORD");if(n==null||t&&!t.has(n))break;if(s.pop(),e.has(n))throw new Error(`duplicate keywords: ${JSON.stringify(n)}`);e.add(n)}return Object.freeze(e)}function zs(s){let t=At(s,no);return Bs(t,tt("constant payable nonpayable".split(" "))),Bs(t,tt("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"}function Rt(s,t){return s.popParams().map(e=>D.from(e,t))}function Js(s){if(s.peekType("AT")){if(s.pop(),s.peekType("NUMBER"))return T(s.pop().text);throw new Error("invalid gas")}return null}function Yt(s){if(s.length)throw new Error(`unexpected tokens at offset ${s.offset}: ${s.toString()}`)}var po=new RegExp(/^(.*)\[([0-9]*)\]$/);function Fs(s){let t=s.match(js);if(f(t,"invalid type","type",s),s==="uint")return"uint256";if(s==="int")return"int256";if(t[2]){let e=parseInt(t[2]);f(e!==0&&e<=32,"invalid bytes length","type",s)}else if(t[3]){let e=parseInt(t[3]);f(e!==0&&e<=256&&e%8===0,"invalid numeric width","type",s)}return s}var G={},at=Symbol.for("_ethers_internal"),Ss="_ParamTypeInternal",Ls="_ErrorInternal",Ds="_EventInternal",_s="_ConstructorInternal",Hs="_FallbackInternal",Us="_FunctionInternal",Vs="_StructInternal",D=class{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(t,e,n,r,a,o,i,c){if(_t(t,G,"ParamType"),Object.defineProperty(this,at,{value:Ss}),o&&(o=Object.freeze(o.slice())),r==="array"){if(i==null||c==null)throw new Error("")}else if(i!=null||c!=null)throw new Error("");if(r==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");C(this,{name:e,type:n,baseType:r,indexed:a,components:o,arrayLength:i,arrayChildren:c})}format(t){if(t==null&&(t="sighash"),t==="json"){let n=this.name||"";if(this.isArray()){let a=JSON.parse(this.arrayChildren.format("json"));return a.name=n,a.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(a)}let r={type:this.baseType==="tuple"?"tuple":this.type,name:n};return typeof this.indexed=="boolean"&&(r.indexed=this.indexed),this.isTuple()&&(r.components=this.components.map(a=>JSON.parse(a.format(t)))),JSON.stringify(r)}let e="";return this.isArray()?(e+=this.arrayChildren.format(t),e+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?e+="("+this.components.map(n=>n.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 n=this;return t.map(r=>n.arrayChildren.walk(r,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 n=this;return t.map((r,a)=>n.components[a].walk(r,e))}return e(this.type,t)}#t(t,e,n,r){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,i=e.slice();i.forEach((c,l)=>{o.#t(t,c,n,u=>{i[l]=u})}),r(i);return}if(this.isTuple()){let o=this.components,i;if(Array.isArray(e))i=e.slice();else{if(e==null||typeof e!="object")throw new Error("invalid tuple value");i=o.map(c=>{if(!c.name)throw new Error("cannot use object value with unnamed components");if(!(c.name in e))throw new Error(`missing value for component ${c.name}`);return e[c.name]})}if(i.length!==this.components.length)throw new Error("array is wrong length");i.forEach((c,l)=>{o[l].#t(t,c,n,u=>{i[l]=u})}),r(i);return}let a=n(this.type,e);a.then?t.push(async function(){r(await a)}()):r(a)}async walkAsync(t,e){let n=[],r=[t];return this.#t(n,t,e,a=>{r[0]=a}),n.length&&await Promise.all(n),r[0]}static from(t,e){if(D.isParamType(t))return t;if(typeof t=="string")try{return D.from(Vt(t),e)}catch{f(!1,"invalid param type","obj",t)}else if(t instanceof st){let i="",c="",l=null;At(t,tt(["tuple"])).has("tuple")||t.peekType("OPEN_PAREN")?(c="tuple",l=t.popParams().map(w=>D.from(w)),i=`tuple(${l.map(w=>w.format()).join(",")})`):(i=Fs(t.popType("TYPE")),c=i);let u=null,d=null;for(;t.length&&t.peekType("BRACKET");){let w=t.pop();u=new D(G,"",i,c,null,l,d,u),d=w.value,i+=w.text,c="array",l=null}let p=null;if(At(t,ro).has("indexed")){if(!e)throw new Error("");p=!0}let x=t.peekType("ID")?t.pop().text:"";if(t.length)throw new Error("leftover tokens");return new D(G,x,i,c,p,l,d,u)}let n=t.name;f(!n||typeof n=="string"&&n.match(Ks),"invalid name","obj.name",n);let r=t.indexed;r==!0?(f(e,"parameter cannot be indexed","obj.indexed",t.indexed),r=!0):r=!1;let a=t.type,o=a.match(po);if(o){let i=parseInt(o[2]||"-1"),c=D.from({type:o[1],components:t.components});return new D(G,n||"",a,"array",r,null,i,c)}if(a==="tuple"||a.startsWith("tuple(")||a.startsWith("(")){let i=t.components!=null?t.components.map(l=>D.from(l)):null;return new D(G,n||"",a,"tuple",r,i,null,null)}return a=Fs(t.type),new D(G,n||"",a,a,r,null,null,null)}static isParamType(t){return t&&t[at]===Ss}},ht=class{type;inputs;constructor(t,e,n){_t(t,G,"Fragment"),n=Object.freeze(n.slice()),C(this,{type:e,inputs:n})}static from(t){if(typeof t=="string"){try{ht.from(JSON.parse(t))}catch{}return ht.from(Vt(t))}if(t instanceof st)switch(t.peekKeyword($s)){case"constructor":return lt.from(t);case"error":return j.from(t);case"event":return nt.from(t);case"fallback":case"receive":return dt.from(t);case"function":return rt.from(t);case"struct":return wt.from(t)}else if(typeof t=="object"){switch(t.type){case"constructor":return lt.from(t);case"error":return j.from(t);case"event":return nt.from(t);case"fallback":case"receive":return dt.from(t);case"function":return rt.from(t);case"struct":return wt.from(t)}y(!1,`unsupported type: ${t.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}f(!1,"unsupported frgament object","obj",t)}static isConstructor(t){return lt.isFragment(t)}static isError(t){return j.isFragment(t)}static isEvent(t){return nt.isFragment(t)}static isFunction(t){return rt.isFragment(t)}static isStruct(t){return wt.isFragment(t)}},Qt=class extends ht{name;constructor(t,e,n,r){super(t,e,r),f(typeof n=="string"&&n.match(Ks),"invalid identifier","name",n),r=Object.freeze(r.slice()),C(this,{name:n})}};function Ke(s,t){return"("+t.map(e=>e.format(s)).join(s==="full"?", ":",")+")"}var j=class extends Qt{constructor(t,e,n){super(t,"error",e,n),Object.defineProperty(this,at,{value:Ls})}get selector(){return Ut(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(n=>JSON.parse(n.format(t)))});let e=[];return t!=="sighash"&&e.push("error"),e.push(this.name+Ke(t,this.inputs)),e.join(" ")}static from(t){if(j.isFragment(t))return t;if(typeof t=="string")return j.from(Vt(t));if(t instanceof st){let e=Fn("error",t),n=Rt(t);return Yt(t),new j(G,e,n)}return new j(G,t.name,t.inputs?t.inputs.map(D.from):[])}static isFragment(t){return t&&t[at]===Ls}},nt=class extends Qt{anonymous;constructor(t,e,n,r){super(t,"event",e,n),Object.defineProperty(this,at,{value:Ds}),C(this,{anonymous:r})}get topicHash(){return Ut(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(n=>JSON.parse(n.format(t)))});let e=[];return t!=="sighash"&&e.push("event"),e.push(this.name+Ke(t,this.inputs)),t!=="sighash"&&this.anonymous&&e.push("anonymous"),e.join(" ")}static getTopicHash(t,e){return e=(e||[]).map(r=>D.from(r)),new nt(G,t,e,!1).topicHash}static from(t){if(nt.isFragment(t))return t;if(typeof t=="string")try{return nt.from(Vt(t))}catch{f(!1,"invalid event fragment","obj",t)}else if(t instanceof st){let e=Fn("event",t),n=Rt(t,!0),r=!!At(t,tt(["anonymous"])).has("anonymous");return Yt(t),new nt(G,e,n,r)}return new nt(G,t.name,t.inputs?t.inputs.map(e=>D.from(e,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[at]===Ds}},lt=class extends ht{payable;gas;constructor(t,e,n,r,a){super(t,e,n),Object.defineProperty(this,at,{value:_s}),C(this,{payable:r,gas:a})}format(t){if(y(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(n=>JSON.parse(n.format(t)))});let e=[`constructor${Ke(t,this.inputs)}`];return this.payable&&e.push("payable"),this.gas!=null&&e.push(`@${this.gas.toString()}`),e.join(" ")}static from(t){if(lt.isFragment(t))return t;if(typeof t=="string")try{return lt.from(Vt(t))}catch{f(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof st){At(t,tt(["constructor"]));let e=Rt(t),n=!!At(t,eo).has("payable"),r=Js(t);return Yt(t),new lt(G,"constructor",e,n,r)}return new lt(G,"constructor",t.inputs?t.inputs.map(D.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[at]===_s}},dt=class extends ht{payable;constructor(t,e,n){super(t,"fallback",e),Object.defineProperty(this,at,{value:Hs}),C(this,{payable:n})}format(t){let e=this.inputs.length===0?"receive":"fallback";if(t==="json"){let n=this.payable?"payable":"nonpayable";return JSON.stringify({type:e,stateMutability:n})}return`${e}()${this.payable?" payable":""}`}static from(t){if(dt.isFragment(t))return t;if(typeof t=="string")try{return dt.from(Vt(t))}catch{f(!1,"invalid fallback fragment","obj",t)}else if(t instanceof st){let e=t.toString(),n=t.peekKeyword(tt(["fallback","receive"]));if(f(n,"type must be fallback or receive","obj",e),t.popKeyword(tt(["fallback","receive"]))==="receive"){let i=Rt(t);return f(i.length===0,"receive cannot have arguments","obj.inputs",i),At(t,tt(["payable"])),Yt(t),new dt(G,[],!0)}let a=Rt(t);a.length?f(a.length===1&&a[0].type==="bytes","invalid fallback inputs","obj.inputs",a.map(i=>i.format("minimal")).join(", ")):a=[D.from("bytes")];let o=zs(t);if(f(o==="nonpayable"||o==="payable","fallback cannot be constants","obj.stateMutability",o),At(t,tt(["returns"])).has("returns")){let i=Rt(t);f(i.length===1&&i[0].type==="bytes","invalid fallback outputs","obj.outputs",i.map(c=>c.format("minimal")).join(", "))}return Yt(t),new dt(G,a,o==="payable")}if(t.type==="receive")return new dt(G,[],!0);if(t.type==="fallback"){let e=[D.from("bytes")],n=t.stateMutability==="payable";return new dt(G,e,n)}f(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[at]===Hs}},rt=class extends Qt{constant;outputs;stateMutability;payable;gas;constructor(t,e,n,r,a,o){super(t,"function",e,r),Object.defineProperty(this,at,{value:Us}),a=Object.freeze(a.slice()),C(this,{constant:n==="view"||n==="pure",gas:o,outputs:a,payable:n==="payable",stateMutability:n})}get selector(){return Ut(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(n=>JSON.parse(n.format(t))),outputs:this.outputs.map(n=>JSON.parse(n.format(t)))});let e=[];return t!=="sighash"&&e.push("function"),e.push(this.name+Ke(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&e.push(this.stateMutability),this.outputs&&this.outputs.length&&(e.push("returns"),e.push(Ke(t,this.outputs))),this.gas!=null&&e.push(`@${this.gas.toString()}`)),e.join(" ")}static getSelector(t,e){return e=(e||[]).map(r=>D.from(r)),new rt(G,t,"view",e,[],null).selector}static from(t){if(rt.isFragment(t))return t;if(typeof t=="string")try{return rt.from(Vt(t))}catch{f(!1,"invalid function fragment","obj",t)}else if(t instanceof st){let n=Fn("function",t),r=Rt(t),a=zs(t),o=[];At(t,tt(["returns"])).has("returns")&&(o=Rt(t));let i=Js(t);return Yt(t),new rt(G,n,a,r,o,i)}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 rt(G,t.name,e,t.inputs?t.inputs.map(D.from):[],t.outputs?t.outputs.map(D.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[at]===Us}},wt=class extends Qt{constructor(t,e,n){super(t,"struct",e,n),Object.defineProperty(this,at,{value:Vs})}format(){throw new Error("@TODO")}static from(t){if(typeof t=="string")try{return wt.from(Vt(t))}catch{f(!1,"invalid struct fragment","obj",t)}else if(t instanceof st){let e=Fn("struct",t),n=Rt(t);return Yt(t),new wt(G,e,n)}return new wt(G,t.name,t.inputs?t.inputs.map(D.from):[])}static isFragment(t){return t&&t[at]===Vs}};var mt=new Map;mt.set(0,"GENERIC_PANIC");mt.set(1,"ASSERT_FALSE");mt.set(17,"OVERFLOW");mt.set(18,"DIVIDE_BY_ZERO");mt.set(33,"ENUM_RANGE_ERROR");mt.set(34,"BAD_STORAGE_DATA");mt.set(49,"STACK_UNDERFLOW");mt.set(50,"ARRAY_RANGE_ERROR");mt.set(65,"OUT_OF_MEMORY");mt.set(81,"UNINITIALIZED_FUNCTION_CALL");var fo=new RegExp(/^bytes([0-9]*)$/),ho=new RegExp(/^(u?int)([0-9]*)$/),fr=null,Xs=1024;function mo(s,t,e,n){let r="missing revert data",a=null,o=null,i=null;if(e){r="execution reverted";let l=V(e);if(e=P(e),l.length===0)r+=" (no data present; likely require(false) occurred",a="require(false)";else if(l.length%32!==4)r+=" (could not decode reason; invalid data length)";else if(P(l.slice(0,4))==="0x08c379a0")try{a=n.decode(["string"],l.slice(4))[0],i={signature:"Error(string)",name:"Error",args:[a]},r+=`: ${JSON.stringify(a)}`}catch{r+=" (could not decode reason; invalid string data)"}else if(P(l.slice(0,4))==="0x4e487b71")try{let u=Number(n.decode(["uint256"],l.slice(4))[0]);i={signature:"Panic(uint256)",name:"Panic",args:[u]},a=`Panic due to ${mt.get(u)||"UNKNOWN"}(${u})`,r+=`: ${a}`}catch{r+=" (could not decode panic code)"}else r+=" (unknown custom error)"}let c={to:t.to?L(t.to):null,data:t.data||"0x"};return t.from&&(c.from=L(t.from)),Pt(r,"CALL_EXCEPTION",{action:s,data:e,reason:a,transaction:c,invocation:o,revert:i})}var It=class{#t(t){if(t.isArray())return new Pn(this.#t(t.arrayChildren),t.arrayLength,t.name);if(t.isTuple())return new Zt(t.components.map(n=>this.#t(n)),t.name);switch(t.baseType){case"address":return new kn(t.name);case"bool":return new Rn(t.name);case"string":return new Bn(t.name);case"bytes":return new An(t.name);case"":return new On(t.name)}let e=t.type.match(ho);if(e){let n=parseInt(e[2]||"256");return f(n!==0&&n<=256&&n%8===0,"invalid "+e[1]+" bit length","param",t),new Nn(n/8,e[1]==="int",t.name)}if(e=t.type.match(fo),e){let n=parseInt(e[1]);return f(n!==0&&n<=32,"invalid bytes length","param",t),new In(n,t.name)}f(!1,"invalid type","type",t.type)}getDefaultValue(t){let e=t.map(r=>this.#t(D.from(r)));return new Zt(e,"_").defaultValue()}encode(t,e){Le(e.length,t.length,"types/values length mismatch");let n=t.map(o=>this.#t(D.from(o))),r=new Zt(n,"_"),a=new Jt;return r.encode(a,e),a.data}decode(t,e,n){let r=t.map(o=>this.#t(D.from(o)));return new Zt(r,"_").decode(new Ce(e,n,Xs))}static _setDefaultMaxInflation(t){f(typeof t=="number"&&Number.isInteger(t),"invalid defaultMaxInflation factor","value",t),Xs=t}static defaultAbiCoder(){return fr==null&&(fr=new It),fr}static getBuiltinCallException(t,e,n){return mo(t,e,n,It.defaultAbiCoder())}};function Zs(s){let t=V(s,"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 Ve(t.slice(0,e))}var je=class{fragment;name;signature;topic;args;constructor(t,e,n){let r=t.name,a=t.format();C(this,{fragment:t,name:r,signature:a,topic:e,args:n})}},ze=class{fragment;name;args;signature;selector;value;constructor(t,e,n,r){let a=t.name,o=t.format();C(this,{fragment:t,name:a,args:n,signature:o,selector:e,value:r})}},Je=class{fragment;name;args;signature;selector;constructor(t,e,n){let r=t.name,a=t.format();C(this,{fragment:t,name:r,args:n,signature:a,selector:e})}},Ee=class{hash;_isIndexed;static isIndexed(t){return!!(t&&t._isIndexed)}constructor(t){C(this,{hash:t,_isIndexed:!0})}},Ys={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"},Qs={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:s=>`reverted with reason string ${JSON.stringify(s)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:s=>{let t="unknown panic code";return s>=0&&s<=255&&Ys[s.toString()]&&(t=Ys[s.toString()]),`reverted with panic code 0x${s.toString(16)} (${t})`}}},b=class{fragments;deploy;fallback;receive;#t;#e;#n;#r;constructor(t){let e=[];typeof t=="string"?e=JSON.parse(t):e=t,this.#n=new Map,this.#t=new Map,this.#e=new Map;let n=[];for(let o of e)try{n.push(ht.from(o))}catch(i){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,i.message)}C(this,{fragments:Object.freeze(n)});let r=null,a=!1;this.#r=this.getAbiCoder(),this.fragments.forEach((o,i)=>{let c;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}C(this,{deploy:o});return;case"fallback":o.inputs.length===0?a=!0:(f(!r||o.payable!==r.payable,"conflicting fallback fragments",`fragments[${i}]`,o),r=o,a=r.payable);return;case"function":c=this.#n;break;case"event":c=this.#e;break;case"error":c=this.#t;break;default:return}let l=o.format();c.has(l)||c.set(l,o)}),this.deploy||C(this,{deploy:lt.from("constructor()")}),C(this,{fallback:r,receive:a})}format(t){let e=t?"minimal":"full";return this.fragments.map(r=>r.format(e))}formatJson(){let t=this.fragments.map(e=>e.format("json"));return JSON.stringify(t.map(e=>JSON.parse(e)))}getAbiCoder(){return It.defaultAbiCoder()}#s(t,e,n){if($(t)){let a=t.toLowerCase();for(let o of this.#n.values())if(a===o.selector)return o;return null}if(t.indexOf("(")===-1){let a=[];for(let[o,i]of this.#n)o.split("(")[0]===t&&a.push(i);if(e){let o=e.length>0?e[e.length-1]:null,i=e.length,c=!0;O.isTyped(o)&&o.type==="overrides"&&(c=!1,i--);for(let l=a.length-1;l>=0;l--){let u=a[l].inputs.length;u!==i&&(!c||u!==i-1)&&a.splice(l,1)}for(let l=a.length-1;l>=0;l--){let u=a[l].inputs;for(let d=0;d<e.length;d++)if(O.isTyped(e[d])){if(d>=u.length){if(e[d].type==="overrides")continue;a.splice(l,1);break}if(e[d].type!==u[d].baseType){a.splice(l,1);break}}}}if(a.length===1&&e&&e.length!==a[0].inputs.length){let o=e[e.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&a.splice(0,1)}if(a.length===0)return null;if(a.length>1&&n){let o=a.map(i=>JSON.stringify(i.format())).join(", ");f(!1,`ambiguous function description (i.e. matches ${o})`,"key",t)}return a[0]}let r=this.#n.get(rt.from(t).format());return r||null}getFunctionName(t){let e=this.#s(t,null,!1);return f(e,"no matching function","key",t),e.name}hasFunction(t){return!!this.#s(t,null,!1)}getFunction(t,e){return this.#s(t,e||null,!0)}forEachFunction(t){let e=Array.from(this.#n.keys());e.sort((n,r)=>n.localeCompare(r));for(let n=0;n<e.length;n++){let r=e[n];t(this.#n.get(r),n)}}#a(t,e,n){if($(t)){let a=t.toLowerCase();for(let o of this.#e.values())if(a===o.topicHash)return o;return null}if(t.indexOf("(")===-1){let a=[];for(let[o,i]of this.#e)o.split("(")[0]===t&&a.push(i);if(e){for(let o=a.length-1;o>=0;o--)a[o].inputs.length<e.length&&a.splice(o,1);for(let o=a.length-1;o>=0;o--){let i=a[o].inputs;for(let c=0;c<e.length;c++)if(O.isTyped(e[c])&&e[c].type!==i[c].baseType){a.splice(o,1);break}}}if(a.length===0)return null;if(a.length>1&&n){let o=a.map(i=>JSON.stringify(i.format())).join(", ");f(!1,`ambiguous event description (i.e. matches ${o})`,"key",t)}return a[0]}let r=this.#e.get(nt.from(t).format());return r||null}getEventName(t){let e=this.#a(t,null,!1);return f(e,"no matching event","key",t),e.name}hasEvent(t){return!!this.#a(t,null,!1)}getEvent(t,e){return this.#a(t,e||null,!0)}forEachEvent(t){let e=Array.from(this.#e.keys());e.sort((n,r)=>n.localeCompare(r));for(let n=0;n<e.length;n++){let r=e[n];t(this.#e.get(r),n)}}getError(t,e){if($(t)){let r=t.toLowerCase();if(Qs[r])return j.from(Qs[r].signature);for(let a of this.#t.values())if(r===a.selector)return a;return null}if(t.indexOf("(")===-1){let r=[];for(let[a,o]of this.#t)a.split("(")[0]===t&&r.push(o);if(r.length===0)return t==="Error"?j.from("error Error(string)"):t==="Panic"?j.from("error Panic(uint256)"):null;if(r.length>1){let a=r.map(o=>JSON.stringify(o.format())).join(", ");f(!1,`ambiguous error description (i.e. ${a})`,"name",t)}return r[0]}if(t=j.from(t).format(),t==="Error(string)")return j.from("error Error(string)");if(t==="Panic(uint256)")return j.from("error Panic(uint256)");let n=this.#t.get(t);return n||null}forEachError(t){let e=Array.from(this.#t.keys());e.sort((n,r)=>n.localeCompare(r));for(let n=0;n<e.length;n++){let r=e[n];t(this.#t.get(r),n)}}_decodeParams(t,e){return this.#r.decode(t,e)}_encodeParams(t,e){return this.#r.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){if(typeof t=="string"){let n=this.getError(t);f(n,"unknown error","fragment",t),t=n}return f(Ct(e,0,4)===t.selector,`data signature does not match error ${t.name}.`,"data",e),this._decodeParams(t.inputs,Ct(e,4))}encodeErrorResult(t,e){if(typeof t=="string"){let n=this.getError(t);f(n,"unknown error","fragment",t),t=n}return ct([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionData(t,e){if(typeof t=="string"){let n=this.getFunction(t);f(n,"unknown function","fragment",t),t=n}return f(Ct(e,0,4)===t.selector,`data signature does not match function ${t.name}.`,"data",e),this._decodeParams(t.inputs,Ct(e,4))}encodeFunctionData(t,e){if(typeof t=="string"){let n=this.getFunction(t);f(n,"unknown function","fragment",t),t=n}return ct([t.selector,this._encodeParams(t.inputs,e||[])])}decodeFunctionResult(t,e){if(typeof t=="string"){let a=this.getFunction(t);f(a,"unknown function","fragment",t),t=a}let n="invalid length for result data",r=q(e);if(r.length%32===0)try{return this.#r.decode(t.outputs,r)}catch{n="could not decode result data"}y(!1,n,"BAD_DATA",{value:P(r),info:{method:t.name,signature:t.format()}})}makeError(t,e){let n=V(t,"data"),r=It.getBuiltinCallException("call",e,n),a="execution reverted (unknown custom error)";if(r.message.startsWith(a)){let i=P(n.slice(0,4)),c=this.getError(i);if(c)try{let l=this.#r.decode(c.inputs,n.slice(4));r.revert={name:c.name,signature:c.format(),args:l},r.reason=r.revert.signature,r.message=`execution reverted: ${r.reason}`}catch{r.message="execution reverted (coult not decode custom error)"}}let o=this.parseTransaction(e);return o&&(r.invocation={method:o.name,signature:o.signature,args:o.args}),r}encodeFunctionResult(t,e){if(typeof t=="string"){let n=this.getFunction(t);f(n,"unknown function","fragment",t),t=n}return P(this.#r.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){if(typeof t=="string"){let a=this.getEvent(t);f(a,"unknown event","eventFragment",t),t=a}y(e.length<=t.inputs.length,`too many arguments for ${t.format()}`,"UNEXPECTED_ARGUMENT",{count:e.length,expectedCount:t.inputs.length});let n=[];t.anonymous||n.push(t.topicHash);let r=(a,o)=>a.type==="string"?Ut(o):a.type==="bytes"?et(P(o)):(a.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":a.type.match(/^u?int/)?o=_e(o):a.type.match(/^bytes/)?o=hn(o,32):a.type==="address"&&this.#r.encode(["address"],[o]),ge(P(o),32));for(e.forEach((a,o)=>{let i=t.inputs[o];if(!i.indexed){f(a==null,"cannot filter non-indexed parameters; must be null","contract."+i.name,a);return}a==null?n.push(null):i.baseType==="array"||i.baseType==="tuple"?f(!1,"filtering with tuples or arrays not supported","contract."+i.name,a):Array.isArray(a)?n.push(a.map(c=>r(i,c))):n.push(r(i,a))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(t,e){if(typeof t=="string"){let o=this.getEvent(t);f(o,"unknown event","eventFragment",t),t=o}let n=[],r=[],a=[];return t.anonymous||n.push(t.topicHash),f(e.length===t.inputs.length,"event arguments/values mismatch","values",e),t.inputs.forEach((o,i)=>{let c=e[i];if(o.indexed)if(o.type==="string")n.push(Ut(c));else if(o.type==="bytes")n.push(et(c));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");n.push(this.#r.encode([o.type],[c]))}else r.push(o),a.push(c)}),{data:this.#r.encode(r,a),topics:n}}decodeEventLog(t,e,n){if(typeof t=="string"){let h=this.getEvent(t);f(h,"unknown event","eventFragment",t),t=h}if(n!=null&&!t.anonymous){let h=t.topicHash;f($(n[0],32)&&n[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",n[0]),n=n.slice(1)}let r=[],a=[],o=[];t.inputs.forEach((h,x)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(r.push(D.from({type:"bytes32",name:h.name})),o.push(!0)):(r.push(h),o.push(!1)):(a.push(h),o.push(!1))});let i=n!=null?this.#r.decode(r,ct(n)):null,c=this.#r.decode(a,e,!0),l=[],u=[],d=0,p=0;return t.inputs.forEach((h,x)=>{let w=null;if(h.indexed)if(i==null)w=new Ee(null);else if(o[x])w=new Ee(i[p++]);else try{w=i[p++]}catch(A){w=A}else try{w=c[d++]}catch(A){w=A}l.push(w),u.push(h.name||null)}),X.fromItems(l,u)}parseTransaction(t){let e=V(t.data,"tx.data"),n=T(t.value!=null?t.value:0,"tx.value"),r=this.getFunction(P(e.slice(0,4)));if(!r)return null;let a=this.#r.decode(r.inputs,e.slice(4));return new ze(r,r.selector,a,n)}parseCallResult(t){throw new Error("@TODO")}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new je(e,e.topicHash,this.decodeEventLog(e,t.data,t.topics))}parseError(t){let e=P(t),n=this.getError(Ct(e,0,4));if(!n)return null;let r=this.#r.decode(n.inputs,Ct(e,4));return new Je(n,n.selector,r)}static from(t){return t instanceof b?t:typeof t=="string"?new b(JSON.parse(t)):typeof t.formatJson=="function"?new b(t.formatJson()):typeof t.format=="function"?new b(t.format("json")):new b(t)}};var ea=BigInt(0);function hr(s){return s??null}function z(s){return s==null?null:s.toString()}function na(s){let t={};s.to&&(t.to=s.to),s.from&&(t.from=s.from),s.data&&(t.data=P(s.data));let e="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(let r of e)!(r in s)||s[r]==null||(t[r]=T(s[r],`request.${r}`));let n="type,nonce".split(/,/);for(let r of n)!(r in s)||s[r]==null||(t[r]=R(s[r],`request.${r}`));return s.accessList&&(t.accessList=We(s.accessList)),"blockTag"in s&&(t.blockTag=s.blockTag),"enableCcipRead"in s&&(t.enableCcipRead=!!s.enableCcipRead),"customData"in s&&(t.customData=s.customData),"blobVersionedHashes"in s&&s.blobVersionedHashes&&(t.blobVersionedHashes=s.blobVersionedHashes.slice()),"kzg"in s&&(t.kzg=s.kzg),"blobs"in s&&s.blobs&&(t.blobs=s.blobs.map(r=>Yn(r)?P(r):Object.assign({},r))),t}var ta=class{provider;number;hash;timestamp;parentHash;parentBeaconBlockRoot;nonce;difficulty;gasLimit;gasUsed;stateRoot;receiptsRoot;blobGasUsed;excessBlobGas;miner;prevRandao;extraData;baseFeePerGas;#t;constructor(t,e){this.#t=t.transactions.map(n=>typeof n!="string"?new qt(n,e):n),C(this,{provider:e,hash:hr(t.hash),number:t.number,timestamp:t.timestamp,parentHash:t.parentHash,parentBeaconBlockRoot:t.parentBeaconBlockRoot,nonce:t.nonce,difficulty:t.difficulty,gasLimit:t.gasLimit,gasUsed:t.gasUsed,blobGasUsed:t.blobGasUsed,excessBlobGas:t.excessBlobGas,miner:t.miner,prevRandao:hr(t.prevRandao),extraData:t.extraData,baseFeePerGas:hr(t.baseFeePerGas),stateRoot:t.stateRoot,receiptsRoot:t.receiptsRoot})}get transactions(){return this.#t.map(t=>typeof t=="string"?t:t.hash)}get prefetchedTransactions(){let t=this.#t.slice();return t.length===0?[]:(y(typeof t[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),t)}toJSON(){let{baseFeePerGas:t,difficulty:e,extraData:n,gasLimit:r,gasUsed:a,hash:o,miner:i,prevRandao:c,nonce:l,number:u,parentHash:d,parentBeaconBlockRoot:p,stateRoot:h,receiptsRoot:x,timestamp:w,transactions:A}=this;return{_type:"Block",baseFeePerGas:z(t),difficulty:z(e),extraData:n,gasLimit:z(r),gasUsed:z(a),blobGasUsed:z(this.blobGasUsed),excessBlobGas:z(this.excessBlobGas),hash:o,miner:i,prevRandao:c,nonce:l,number:u,parentHash:d,timestamp:w,parentBeaconBlockRoot:p,stateRoot:h,receiptsRoot:x,transactions:A}}[Symbol.iterator](){let t=0,e=this.transactions;return{next:()=>t<this.length?{value:e[t++],done:!1}:{value:void 0,done:!0}}}get length(){return this.#t.length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(t){let e;if(typeof t=="number")e=this.#t[t];else{let n=t.toLowerCase();for(let r of this.#t)if(typeof r=="string"){if(r!==n)continue;e=r;break}else{if(r.hash===n)continue;e=r;break}}if(e==null)throw new Error("no such tx");return typeof e=="string"?await this.provider.getTransaction(e):e}getPrefetchedTransaction(t){let e=this.prefetchedTransactions;if(typeof t=="number")return e[t];t=t.toLowerCase();for(let n of e)if(n.hash===t)return n;f(!1,"no matching transaction","indexOrHash",t)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return yo(this)}},Mt=class{provider;transactionHash;blockHash;blockNumber;removed;address;data;topics;index;transactionIndex;constructor(t,e){this.provider=e;let n=Object.freeze(t.topics.slice());C(this,{transactionHash:t.transactionHash,blockHash:t.blockHash,blockNumber:t.blockNumber,removed:t.removed,address:t.address,data:t.data,topics:n,index:t.index,transactionIndex:t.transactionIndex})}toJSON(){let{address:t,blockHash:e,blockNumber:n,data:r,index:a,removed:o,topics:i,transactionHash:c,transactionIndex:l}=this;return{_type:"log",address:t,blockHash:e,blockNumber:n,data:r,index:a,removed:o,topics:i,transactionHash:c,transactionIndex:l}}async getBlock(){let t=await this.provider.getBlock(this.blockHash);return y(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransaction(){let t=await this.provider.getTransaction(this.transactionHash);return y(!!t,"failed to find transaction","UNKNOWN_ERROR",{}),t}async getTransactionReceipt(){let t=await this.provider.getTransactionReceipt(this.transactionHash);return y(!!t,"failed to find transaction receipt","UNKNOWN_ERROR",{}),t}removedEvent(){return bo(this)}},Sn=class{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(r=>new Mt(r,e)));let n=ea;t.effectiveGasPrice!=null?n=t.effectiveGasPrice:t.gasPrice!=null&&(n=t.gasPrice),C(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:n,blobGasPrice:t.blobGasPrice,type:t.type,status:t.status,root:t.root})}get logs(){return this.#t}toJSON(){let{to:t,from:e,contractAddress:n,hash:r,index:a,blockHash:o,blockNumber:i,logsBloom:c,logs:l,status:u,root:d}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:i,contractAddress:n,cumulativeGasUsed:z(this.cumulativeGasUsed),from:e,gasPrice:z(this.gasPrice),blobGasUsed:z(this.blobGasUsed),blobGasPrice:z(this.blobGasPrice),gasUsed:z(this.gasUsed),hash:r,index:a,logs:l,logsBloom:c,root:d,status:u,to:t}}get length(){return this.logs.length}[Symbol.iterator](){let t=0;return{next:()=>t<this.length?{value:this.logs[t++],done:!1}:{value:void 0,done:!0}}}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 sa(this)}reorderedEvent(t){return y(!t||t.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),ra(this,t)}},qt=class{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:n,hash:r,type:a,to:o,from:i,nonce:c,data:l,signature:u,accessList:d,blobVersionedHashes:p}=this;return{_type:"TransactionResponse",accessList:d,blockNumber:t,blockHash:e,blobVersionedHashes:p,chainId:z(this.chainId),data:l,from:i,gasLimit:z(this.gasLimit),gasPrice:z(this.gasPrice),hash:r,maxFeePerGas:z(this.maxFeePerGas),maxPriorityFeePerGas:z(this.maxPriorityFeePerGas),maxFeePerBlobGas:z(this.maxFeePerBlobGas),nonce:c,signature:u,to:o,index:n,type:a,value:z(this.value)}}async getBlock(){let t=this.blockNumber;if(t==null){let n=await this.getTransaction();n&&(t=n.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:n}=await he({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return e==null||e.blockNumber==null?0:n-e.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(t,e){let n=t??1,r=e??0,a=this.#t,o=-1,i=a===-1,c=async()=>{if(i)return null;let{blockNumber:p,nonce:h}=await he({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(h<this.nonce){a=p;return}if(i)return null;let x=await this.getTransaction();if(!(x&&x.blockNumber!=null))for(o===-1&&(o=a-3,o<this.#t&&(o=this.#t));o<=p;){if(i)return null;let w=await this.provider.getBlock(o,!0);if(w==null)return;for(let A of w)if(A===this.hash)return;for(let A=0;A<w.length;A++){let k=await w.getTransaction(A);if(k.from===this.from&&k.nonce===this.nonce){if(i)return null;let F=await this.provider.getTransactionReceipt(k.hash);if(F==null||p-F.blockNumber+1<n)return;let H="replaced";k.data===this.data&&k.to===this.to&&k.value===this.value?H="repriced":k.data==="0x"&&k.from===k.to&&k.value===ea&&(H="cancelled"),y(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:H==="replaced"||H==="cancelled",reason:H,replacement:k.replaceableTransaction(a),hash:k.hash,receipt:F})}}o++}},l=p=>{if(p==null||p.status!==0)return p;y(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:p.to,from:p.from,data:""},receipt:p})},u=await this.provider.getTransactionReceipt(this.hash);if(n===0)return l(u);if(u){if(await u.confirmations()>=n)return l(u)}else if(await c(),n===0)return null;return await new Promise((p,h)=>{let x=[],w=()=>{x.forEach(k=>k())};if(x.push(()=>{i=!0}),r>0){let k=setTimeout(()=>{w(),h(Pt("wait for transaction timeout","TIMEOUT"))},r);x.push(()=>{clearTimeout(k)})}let A=async k=>{if(await k.confirmations()>=n){w();try{p(l(k))}catch(F){h(F)}}};if(x.push(()=>{this.provider.off(this.hash,A)}),this.provider.on(this.hash,A),a>=0){let k=async()=>{try{await c()}catch(F){if(xt(F,"TRANSACTION_REPLACED")){w(),h(F);return}}i||this.provider.once("block",k)};x.push(()=>{this.provider.off("block",k)}),this.provider.once("block",k)}})}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 y(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),sa(this)}reorderedEvent(t){return y(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),y(!t||t.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),ra(this,t)}replaceableTransaction(t){f(Number.isInteger(t)&&t>=0,"invalid startBlock","startBlock",t);let e=new qt(this,this.provider);return e.#t=t,e}};function yo(s){return{orphan:"drop-block",hash:s.hash,number:s.number}}function ra(s,t){return{orphan:"reorder-transaction",tx:s,other:t}}function sa(s){return{orphan:"drop-transaction",tx:s}}function bo(s){return{orphan:"drop-log",log:{transactionHash:s.transactionHash,blockHash:s.blockHash,blockNumber:s.blockNumber,address:s.address,data:s.data,topics:Object.freeze(s.topics.slice()),index:s.index}}}var te=class extends Mt{interface;fragment;args;constructor(t,e,n){super(t,t.provider);let r=e.decodeEventLog(n,t.data,t.topics);C(this,{args:r,fragment:n,interface:e})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}},ke=class extends Mt{error;constructor(t,e){super(t,t.provider),C(this,{error:e})}},Ln=class extends Sn{#t;constructor(t,e,n){super(n,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 te(t,this.#t,e)}catch(n){return new ke(t,n)}return t})}},ee=class extends qt{#t;constructor(t,e,n){super(n,e),this.#t=t}async wait(t,e){let n=await super.wait(t,e);return n==null?null:new Ln(this.#t,this.provider,n)}},ve=class extends Ue{log;constructor(t,e,n,r){super(t,e,n),C(this,{log:r})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}},Xe=class extends ve{constructor(t,e,n,r,a){super(t,e,n,new te(a,t.interface,r));let o=t.interface.decodeEventLog(r,this.log.data,this.log.topics);C(this,{args:o,fragment:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}};var aa=BigInt(0);function ia(s){return s&&typeof s.call=="function"}function ca(s){return s&&typeof s.estimateGas=="function"}function Hn(s){return s&&typeof s.resolveName=="function"}function la(s){return s&&typeof s.sendTransaction=="function"}function ua(s){if(s!=null){if(Hn(s))return s;if(s.provider)return s.provider}}var mr=class{#t;fragment;constructor(t,e,n){if(C(this,{fragment:e}),e.inputs.length<n.length)throw new Error("too many arguments");let r=re(t.runner,"resolveName"),a=Hn(r)?r:null;this.#t=async function(){let o=await Promise.all(e.inputs.map((i,c)=>n[c]==null?null:i.walkAsync(n[c],(u,d)=>u==="address"?Array.isArray(d)?Promise.all(d.map(p=>Xt(p,a))):Xt(d,a):d)));return t.interface.encodeFilterTopics(e,o)}()}getTopicFilter(){return this.#t}};function re(s,t){return s==null?null:typeof s[t]=="function"?s:s.provider&&typeof s.provider[t]=="function"?s.provider:null}function ne(s){return s==null?null:s.provider||null}async function da(s,t){let e=O.dereference(s,"overrides");f(typeof e=="object","invalid overrides parameter","overrides",s);let n=na(e);return f(n.to==null||(t||[]).indexOf("to")>=0,"cannot override to","overrides.to",n.to),f(n.data==null||(t||[]).indexOf("data")>=0,"cannot override data","overrides.data",n.data),n.from&&(n.from=n.from),n}async function xo(s,t,e){let n=re(s,"resolveName"),r=Hn(n)?n:null;return await Promise.all(t.map((a,o)=>a.walkAsync(e[o],(i,c)=>(c=O.dereference(c,i),i==="address"?Xt(c,r):c))))}function Co(s){let t=async function(o){let i=await da(o,["data"]);i.to=await s.getAddress(),i.from&&(i.from=await Xt(i.from,ua(s.runner)));let c=s.interface,l=T(i.value||aa,"overrides.value")===aa,u=(i.data||"0x")==="0x";c.fallback&&!c.fallback.payable&&c.receive&&!u&&!l&&f(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),f(c.fallback||u,"cannot send data to receive-only contract","overrides.data",i.data);let d=c.receive||c.fallback&&c.fallback.payable;return f(d||l,"cannot send value to non-payable fallback","overrides.value",i.value),f(c.fallback||u,"cannot send data to receive-only contract","overrides.data",i.data),i},e=async function(o){let i=re(s.runner,"call");y(ia(i),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let c=await t(o);try{return await i.call(c)}catch(l){throw pn(l)&&l.data?s.interface.makeError(l.data,c):l}},n=async function(o){let i=s.runner;y(la(i),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let c=await i.sendTransaction(await t(o)),l=ne(s.runner);return new ee(s.interface,l,c)},r=async function(o){let i=re(s.runner,"estimateGas");return y(ca(i),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await i.estimateGas(await t(o))},a=async o=>await n(o);return C(a,{_contract:s,estimateGas:r,populateTransaction:t,send:n,staticCall:e}),a}function wo(s,t){let e=function(...l){let u=s.interface.getFunction(t,l);return y(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:l}}),u},n=async function(...l){let u=e(...l),d={};if(u.inputs.length+1===l.length&&(d=await da(l.pop()),d.from&&(d.from=await Xt(d.from,ua(s.runner)))),u.inputs.length!==l.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");let p=await xo(s.runner,u.inputs,l);return Object.assign({},d,await he({to:s.getAddress(),data:s.interface.encodeFunctionData(u,p)}))},r=async function(...l){let u=await i(...l);return u.length===1?u[0]:u},a=async function(...l){let u=s.runner;y(la(u),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});let d=await u.sendTransaction(await n(...l)),p=ne(s.runner);return new ee(s.interface,p,d)},o=async function(...l){let u=re(s.runner,"estimateGas");return y(ca(u),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await u.estimateGas(await n(...l))},i=async function(...l){let u=re(s.runner,"call");y(ia(u),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});let d;try{d=await n(...l)}catch(x){let w=l.at(-1).blockTag;throw w&&(x.blockNumber=w),x}let p="0x";try{p=await u.call(d)}catch(x){throw pn(x)&&x.data?s.interface.makeError(x.data,d):x}let h=e(...l);return s.interface.decodeFunctionResult(h,p)},c=async(...l)=>e(...l).constant?await r(...l):await a(...l);return C(c,{name:s.interface.getFunctionName(t),_contract:s,_key:t,getFragment:e,estimateGas:o,populateTransaction:n,send:a,staticCall:r,staticCallResult:i}),Object.defineProperty(c,"fragment",{configurable:!1,enumerable:!0,get:()=>{let l=s.interface.getFunction(t);return y(l,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),l}}),c}function To(s,t){let e=function(...r){let a=s.interface.getEvent(t,r);return y(a,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t,args:r}}),a},n=function(...r){return new mr(s,e(...r),r)};return C(n,{name:s.interface.getEventName(t),_contract:s,_key:t,getFragment:e}),Object.defineProperty(n,"fragment",{configurable:!1,enumerable:!0,get:()=>{let r=s.interface.getEvent(t);return y(r,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:t}}),r}}),n}var _n=Symbol.for("_ethersInternal_contract"),pa=new WeakMap;function Eo(s,t){pa.set(s[_n],t)}function ut(s){return pa.get(s[_n])}function ko(s){return s&&typeof s=="object"&&"getTopicFilter"in s&&typeof s.getTopicFilter=="function"&&s.fragment}async function br(s,t){let e,n=null;if(Array.isArray(t)){let a=function(o){if($(o,32))return o;let i=s.interface.getEvent(o);return f(i,"unknown fragment","name",o),i.topicHash};e=t.map(o=>o==null?null:Array.isArray(o)?o.map(a):a(o))}else t==="*"?e=[null]:typeof t=="string"?$(t,32)?e=[t]:(n=s.interface.getEvent(t),f(n,"unknown fragment","event",t),e=[n.topicHash]):ko(t)?e=await t.getTopicFilter():"fragment"in t?(n=t.fragment,e=[n.topicHash]):f(!1,"unknown event name","event",t);e=e.map(a=>{if(a==null)return null;if(Array.isArray(a)){let o=Array.from(new Set(a.map(i=>i.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return a.toLowerCase()});let r=e.map(a=>a==null?"null":Array.isArray(a)?a.join("|"):a).join("&");return{fragment:n,tag:r,topics:e}}async function Ze(s,t){let{subs:e}=ut(s);return e.get((await br(s,t)).tag)||null}async function oa(s,t,e){let n=ne(s.runner);y(n,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:t});let{fragment:r,tag:a,topics:o}=await br(s,e),{addr:i,subs:c}=ut(s),l=c.get(a);if(!l){let d={address:i||s,topics:o},p=A=>{let k=r;if(k==null)try{k=s.interface.getEvent(A.topics[0])}catch{}if(k){let F=k,H=r?s.interface.decodeEventLog(r,A.data,A.topics):[];yr(s,e,H,pe=>new Xe(s,pe,e,F,A))}else yr(s,e,[],F=>new ve(s,F,e,A))},h=[];l={tag:a,listeners:[],start:()=>{h.length||h.push(n.on(d,p))},stop:async()=>{if(h.length==0)return;let A=h;h=[],await Promise.all(A),n.off(d,p)}},c.set(a,l)}return l}var gr=Promise.resolve();async function vo(s,t,e,n){await gr;let r=await Ze(s,t);if(!r)return!1;let a=r.listeners.length;return r.listeners=r.listeners.filter(({listener:o,once:i})=>{let c=Array.from(e);n&&c.push(n(i?null:o));try{o.call(s,...c)}catch{}return!i}),r.listeners.length===0&&(r.stop(),ut(s).subs.delete(r.tag)),a>0}async function yr(s,t,e,n){try{await gr}catch{}let r=vo(s,t,e,n);return gr=r,await r}var Dn=["then"],gt=class{target;interface;runner;filters;[_n];fallback;constructor(t,e,n,r){f(typeof t=="string"||En(t),"invalid value for Contract target","target",t),n==null&&(n=null);let a=b.from(e);C(this,{target:t,runner:n,interface:a}),Object.defineProperty(this,_n,{value:{}});let o,i=null,c=null;if(r){let d=ne(n);c=new ee(this.interface,d,r)}let l=new Map;if(typeof t=="string")if($(t))i=t,o=Promise.resolve(t);else{let d=re(n,"resolveName");if(!Hn(d))throw Pt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=d.resolveName(t).then(p=>{if(p==null)throw Pt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:t});return ut(this).addr=p,p})}else o=t.getAddress().then(d=>{if(d==null)throw new Error("TODO");return ut(this).addr=d,d});Eo(this,{addrPromise:o,addr:i,deployTx:c,subs:l});let u=new Proxy({},{get:(d,p,h)=>{if(typeof p=="symbol"||Dn.indexOf(p)>=0)return Reflect.get(d,p,h);try{return this.getEvent(p)}catch(x){if(!xt(x,"INVALID_ARGUMENT")||x.argument!=="key")throw x}},has:(d,p)=>Dn.indexOf(p)>=0?Reflect.has(d,p):Reflect.has(d,p)||this.interface.hasEvent(String(p))});return C(this,{filters:u}),C(this,{fallback:a.receive||a.fallback?Co(this):null}),new Proxy(this,{get:(d,p,h)=>{if(typeof p=="symbol"||p in d||Dn.indexOf(p)>=0)return Reflect.get(d,p,h);try{return d.getFunction(p)}catch(x){if(!xt(x,"INVALID_ARGUMENT")||x.argument!=="key")throw x}},has:(d,p)=>typeof p=="symbol"||p in d||Dn.indexOf(p)>=0?Reflect.has(d,p):d.interface.hasFunction(p)})}connect(t){return new gt(this.target,this.interface,t)}attach(t){return new gt(t,this.interface,this.runner)}async getAddress(){return await ut(this).addrPromise}async getDeployedCode(){let t=ne(this.runner);y(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 n=ne(this.runner);return y(n!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((r,a)=>{let o=async()=>{try{if(await this.getDeployedCode()!=null)return r(this);n.once("block",o)}catch(i){a(i)}};o()})}deploymentTransaction(){return ut(this).deployTx}getFunction(t){return typeof t!="string"&&(t=t.format()),wo(this,t)}getEvent(t){return typeof t!="string"&&(t=t.format()),To(this,t)}async queryTransaction(t){throw new Error("@TODO")}async queryFilter(t,e,n){e==null&&(e=0),n==null&&(n="latest");let{addr:r,addrPromise:a}=ut(this),o=r||await a,{fragment:i,topics:c}=await br(this,t),l={address:o,topics:c,fromBlock:e,toBlock:n},u=ne(this.runner);return y(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(l)).map(d=>{let p=i;if(p==null)try{p=this.interface.getEvent(d.topics[0])}catch{}if(p)try{return new te(d,this.interface,p)}catch(h){return new ke(d,h)}return new Mt(d,u)})}async on(t,e){let n=await oa(this,"on",t);return n.listeners.push({listener:e,once:!1}),n.start(),this}async once(t,e){let n=await oa(this,"once",t);return n.listeners.push({listener:e,once:!0}),n.start(),this}async emit(t,...e){return await yr(this,t,e,null)}async listenerCount(t){if(t){let r=await Ze(this,t);return r?r.listeners.length:0}let{subs:e}=ut(this),n=0;for(let{listeners:r}of e.values())n+=r.length;return n}async listeners(t){if(t){let r=await Ze(this,t);return r?r.listeners.map(({listener:a})=>a):[]}let{subs:e}=ut(this),n=[];for(let{listeners:r}of e.values())n=n.concat(r.map(({listener:a})=>a));return n}async off(t,e){let n=await Ze(this,t);if(!n)return this;if(e){let r=n.listeners.map(({listener:a})=>a).indexOf(e);r>=0&&n.listeners.splice(r,1)}return(e==null||n.listeners.length===0)&&(n.stop(),ut(this).subs.delete(n.tag)),this}async removeAllListeners(t){if(t){let e=await Ze(this,t);if(!e)return this;e.stop(),ut(this).subs.delete(e.tag)}else{let{subs:e}=ut(this);for(let{tag:n,stop:r}of e.values())r(),e.delete(n)}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 gt{constructor(r,a=null){super(r,t,a)}}return e}static from(t,e,n){return n==null&&(n=null),new this(t,e,n)}};function Po(){return gt}var Y=class extends Po(){};var fa=BigInt(0);function E(s,t){return function(e){return e==null?t:s(e)}}function Pe(s,t){return e=>{if(t&&e==null)return null;if(!Array.isArray(e))throw new Error("not an array");return e.map(n=>s(n))}}function se(s,t){return e=>{let n={};for(let r in s){let a=r;if(t&&r in t&&!(a in e)){for(let o of t[r])if(o in e){a=o;break}}try{let o=s[r](e[a]);o!==void 0&&(n[r]=o)}catch(o){let i=o instanceof Error?o.message:"not-an-error";y(!1,`invalid value for value.${r} (${i})`,"BAD_DATA",{value:e})}}return n}}function Ro(s){switch(s){case!0:case"true":return!0;case!1:case"false":return!1}f(!1,`invalid boolean; ${JSON.stringify(s)}`,"value",s)}function Gt(s){return f($(s,!0),"invalid data","value",s),s}function K(s){return f($(s,32),"invalid hash","value",s),s}var Ao=se({address:L,blockHash:K,blockNumber:R,data:Gt,index:R,removed:E(Ro,!1),topics:Pe(K),transactionHash:K,transactionIndex:R},{index:["logIndex"]});function ha(s){return Ao(s)}var Io=se({hash:E(K),parentHash:K,parentBeaconBlockRoot:E(K,null),number:R,timestamp:R,nonce:E(Gt),difficulty:T,gasLimit:T,gasUsed:T,stateRoot:E(K,null),receiptsRoot:E(K,null),blobGasUsed:E(T,null),excessBlobGas:E(T,null),miner:E(L),prevRandao:E(K,null),extraData:Gt,baseFeePerGas:E(T)},{prevRandao:["mixHash"]});function ma(s){let t=Io(s);return t.transactions=s.transactions.map(e=>typeof e=="string"?e:Cr(e)),t}var Oo=se({transactionIndex:R,blockNumber:R,transactionHash:K,address:L,topics:Pe(K),data:Gt,index:R,blockHash:K},{index:["logIndex"]});function xr(s){return Oo(s)}var lu=se({to:E(L,null),from:E(L,null),contractAddress:E(L,null),index:R,root:E(P),gasUsed:T,blobGasUsed:E(T,null),logsBloom:E(Gt),blockHash:K,hash:K,logs:Pe(xr),blockNumber:R,cumulativeGasUsed:T,effectiveGasPrice:E(T),blobGasPrice:E(T,null),status:E(R),type:E(R,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function Cr(s){s.to&&T(s.to)===fa&&(s.to="0x0000000000000000000000000000000000000000");let t=se({hash:K,index:E(R,void 0),type:e=>e==="0x"||e==null?0:R(e),accessList:E(We,null),blobVersionedHashes:E(Pe(K,!0),null),blockHash:E(K,null),blockNumber:E(R,null),transactionIndex:E(R,null),from:L,gasPrice:E(T),maxPriorityFeePerGas:E(T),maxFeePerGas:E(T),maxFeePerBlobGas:E(T,null),gasLimit:T,to:E(L,null),value:T,nonce:R,data:Gt,creates:E(L,null),chainId:E(T,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(s);if(t.to==null&&t.creates==null&&(t.creates=cr(t)),(s.type===1||s.type===2)&&s.accessList==null&&(t.accessList=[]),s.signature?t.signature=Z.from(s.signature):t.signature=Z.from(s),t.chainId==null){let e=t.signature.legacyChainId;e!=null&&(t.chainId=e)}return t.blockHash&&T(t.blockHash)===fa&&(t.blockHash=null),t}var $t=class extends $r{chainId;address;log;block;trace;blockNumber;transactionHash;transaction;transactionReceipt;timestamp;preparedData;constructor(t,e,n,r,a,o,i,c,l,u){super(l),this.chainId=t,this.log=a,this.block=r,this.trace=o,this.address=e.toLowerCase(),this.transaction=i,this.transactionReceipt=c,this.timestamp=n||new Date(0),this.preparedData=u,a?(this.blockNumber=a.blockNumber,this.transactionHash=a.transactionHash):r?this.blockNumber=r.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:Fe(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:Fe(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:Fe(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:Fe(e)};throw new Error("Invaid ctx argument can't happen")}},Re=class extends $t{getContractName(){return"account"}},Tt=class extends $t{constructor(t,e,n,r,a,o,i,c,l,u){super(t,e,n,r,a,o,i,c,l,u)}getContractName(){return"*"}getMetaDataInternal(t,e){let n=this.address;this.address="*";let r=super.getMetaDataInternal(t,e);return this.address=n,r}},Et=class extends $t{contract;contractName;constructor(t,e,n,r,a,o,i,c,l,u,d){super(n,e.address,r,a,o,i,c,l,u,d),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}},Ot=class{contract;constructor(t){this.contract=t}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())}},Nt=class{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}};var _=vt(Xn(),1);var Ye=class extends Error{e;constructor(t,e,n){super(t),this.stack=n}toString(){return this.message+`
|
|
3
3
|
`+this.stack?.toString()}};function g(s,t,e){if(s instanceof Ye)return s;let n="Check here for possible cause and fix: https://docs.sentio.xyz/docs/handling-errors#ethers-error",r="",a=s;return a.code==="CALL_EXCEPTION"||a.code==="BAD_DATA"?a.data==="0x"?(t?r=`jsonrpc eth_call return '0x' (likely contract not existed) at chain ${t.chainId}, ${n}:
|
|
4
4
|
${s.message}`:r=`jsonrpc eth_call return '0x' (likely contract not existed), ${n}:
|
|
5
5
|
${s.message}`,new Ye(r,a,e)):new Ye(`eth call error, ${n}:
|
|
@@ -20,4 +20,4 @@ ${JSON.stringify(a)}`,a,e):(r=`other error during call error
|
|
|
20
20
|
@noble/hashes/esm/utils.js:
|
|
21
21
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
22
22
|
*/
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-4QS3NUUW.js.map
|