vendor: 6,250 bytes, line 1
1import{a as jl,b as Gl,d as ql,f as ra,h as na}from"./chunk-3YZXA4UO.js";import{a as $l}from"./chunk-G5AOPHH7.js";import{b as Ul}from"./chunk-5LBC4W6B.js";import"./chunk-UUF4B4TA.js";import"./chunk-XNLL2NPR.js";import{b as Fl}from"./chunk-AH7NKML5.js";import"./chunk-5IWNYZX4.js";import"./chunk-PH5V2GR4.js";import"./chunk-YWKLH7S7.js";import"./chunk-DX6OTLFN.js";import"./chunk-KHUU7CUW.js";import"./chunk-FPPZ4BUR.js";import{B as bi,g as no,jc as Hl,l as vi,uc as ta}from"./chunk-E6XDDTAT.js";import{Da as Qs,I as Or,J as Cr,Ub as Vu,W as Ml,Ya as ea,_b as ro,ka as Ll,la as Dl}from"./chunk-PKOFAN4X.js";import{a as B,b as Z,d as Ys,e as fr,f as to,l as _e}from"./chunk-GTAS2RK2.js";var Pp=Ys((en,kp)=>{"use strict";var Gc=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,qc=(function(){function e(){this.fetch=!1,this.DOMException=Gc.DOMException}return e.prototype=Gc,new e})();(function(e){var t=(function(r){var n=typeof e<"u"&&e||typeof self<"u"&&self||typeof global<"u"&&global||{},o={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function i(h){return h&&DataView.prototype.isPrototypeOf(h)}if(o.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(h){return h&&s.indexOf(Object.prototype.toString.call(h))>-1};function u(h){if(typeof h!="string"&&(h=String(h)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(h)||h==="")throw new TypeError('Invalid character in header field name: "'+h+'"');return h.toLowerCase()}function d(h){return typeof h!="string"&&(h=String(h)),h}function c(h){var m={next:function(){var v=h.shift();return{done:v===void 0,value:v}}};return o.iterable&&(m[Symbol.iterator]=function(){return m}),m}function f(h){this.map={},h instanceof f?h.forEach(function(m,v){this.append(v,m)},this):Array.isArray(h)?h.forEach(function(m){if(m.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+m.length);this.append(m[0],m[1])},this):h&&Object.getOwnPropertyNames(h).forEach(function(m){this.append(m,h[m])},this)}f.prototype.append=function(h,m){h=u(h),m=d(m);var v=this.map[h];this.map[h]=v?v+", "+m:m},f.prototype.delete=function(h){delete this.map[u(h)]},f.prototype.get=function(h){return h=u(h),this.has(h)?this.map[h]:null},f.prototype.has=function(h){return this.map.hasOwnProperty(u(h))},f.prototype.set=function(h,m){this.map[u(h)]=d(m)},f.prototype.forEach=function(h,m){for(var v in this.map)this.map.hasOwnProperty(v)&&h.call(m,this.map[v],v,this)},f.prototype.keys=function(){var h=[];return this.forEach(function(m,v){h.push(v)}),c(h)},f.prototype.values=function(){var h=[];return this.forEach(function(m){h.push(m)}),c(h)},f.prototype.entries=function(){var h=[];return this.forEach(function(m,v){h.push([v,m])}),c(h)},o.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function _(h){if(!h._noBody){if(h.bodyUsed)return Promise.reject(new TypeError("Already read"));h.bodyUsed=!0}}function w(h){return new Promise(function(m,v){h.onload=function(){m(h.result)},h.onerror=function(){v(h.error)}})}function k(h){var m=new FileReader,v=w(m);return m.readAsArrayBuffer(h),v}function T(h){var m=new FileReader,v=w(m),I=/charset=([A-Za-z0-9_-]+)/.exec(h.type),g=I?I[1]:"utf-8";return m.readAsText(h,g),v}function R(h){for(var m=new Uint8Array(h),v=new Array(m.length),I=0;I<m.length;I++)v[I]=String.fromCharCode(m[I]);return v.join("")}function P(h){if(h.slice)return h.slice(0);var m=new Uint8Array(h.byteLength);return m.set(new Uint8Array(h)),m.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(h){this.bodyUsed=this.bodyUsed,this._bodyInit=h,h?typeof h=="string"?this._bodyText=h:o.blob&&Blob.prototype.isPrototypeOf(h)?this._bodyBlob=h:o.formData&&FormData.prototype.isPrototypeOf(h)?this._bodyFormData=h:o.searchParams&&URLSearchParams.prototype.isPrototypeOf(h)?this._bodyText=h.toString():o.arrayBuffer&&o.blob&&i(h)?(this._bodyArrayBuffer=P(h.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(h)||a(h))?this._bodyArrayBuffer=P(h):this._bodyText=h=Object.prototype.toString.call(h):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof h=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o.searchParams&&URLSearchParams.prototype.isPrototypeOf(h)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o.blob&&(this.blob=function(){var h=_(this);if(h)return h;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var h=_(this);return h||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(o.blob)return this.blob().then(k);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var h=_(this);if(h)return h;if(this._bodyBlob)return T(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(R(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o.formData&&(this.formData=function(){return this.text().then(U)}),this.json=function(){return this.text().then(JSON.parse)},this}var C=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function F(h){var m=h.toUpperCase();return C.indexOf(m)>-1?m:h}function L(h,m){if(!(this instanceof L))throw new TypeError('Please use the "new" operator, this DOM object c
1onstructor cannot be called as a function.');m=m||{};var v=m.body;if(h instanceof L){if(h.bodyUsed)throw new TypeError("Already read");this.url=h.url,this.credentials=h.credentials,m.headers||(this.headers=new f(h.headers)),this.method=h.method,this.mode=h.mode,this.signal=h.signal,!v&&h._bodyInit!=null&&(v=h._bodyInit,h.bodyUsed=!0)}else this.url=String(h);if(this.credentials=m.credentials||this.credentials||"same-origin",(m.headers||!this.headers)&&(this.headers=new f(m.headers)),this.method=F(m.method||this.method||"GET"),this.mode=m.mode||this.mode||null,this.signal=m.signal||this.signal||(function(){if("AbortController"in n){var x=new AbortController;return x.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&v)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(v),(this.method==="GET"||this.method==="HEAD")&&(m.cache==="no-store"||m.cache==="no-cache")){var I=/([?&])_=[^&]*/;if(I.test(this.url))this.url=this.url.replace(I,"$1_="+new Date().getTime());else{var g=/\?/;this.url+=(g.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}L.prototype.clone=function(){return new L(this,{body:this._bodyInit})};function U(h){var m=new FormData;return h.trim().split("&").forEach(function(v){if(v){var I=v.split("="),g=I.shift().replace(/\+/g," "),x=I.join("=").replace(/\+/g," ");m.append(decodeURIComponent(g),decodeURIComponent(x))}}),m}function N(h){var m=new f,v=h.replace(/\r?\n[\t ]+/g," ");return v.split("\r").map(function(I){return I.indexOf(` 2`)===0?I.substr(1,I.length):I}).forEach(function(I){var g=I.split(":"),x=g.shift().trim();if(x){var E=g.join(":").trim();try{m.append(x,E)}catch(A){console.warn("Response "+A.message)}}}),m}b.call(L.prototype);function l(h,m){if(!(this instanceof l))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(m||(m={}),this.type="default",this.status=m.status===void 0?200:m.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=m.statusText===void 0?"":""+m.statusText,this.headers=new f(m.headers),this.url=m.url||"",this._initBody(h)}b.call(l.prototype),l.prototype.clone=function(){return new l(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},l.error=function(){var h=new l(null,{status:200,statusText:""});return h.ok=!1,h.status=0,h.type="error",h};var p=[301,302,303,307,308];l.redirect=function(h,m){if(p.indexOf(m)===-1)throw new RangeError("Invalid status code");return new l(null,{status:m,headers:{location:h}})},r.DOMException=n.DOMException;try{new r.DOMException}catch{r.DOMException=function(m,v){this.message=m,this.name=v;var I=Error(m);this.stack=I.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function y(h,m){return new Promise(function(v,I){var g=new L(h,m);if(g.signal&&g.signal.aborted)return I(new r.DOMException("Aborted","AbortError"));var x=new XMLHttpRequest;function E(){x.abort()}x.onload=function(){var H={statusText:x.statusText,headers:N(x.getAllResponseHeaders()||"")};g.url.indexOf("file://")===0&&(x.status<200||x.status>599)?H.status=200:H.status=x.status,H.url="responseURL"in x?x.responseURL:H.headers.get("X-Request-URL");var $="response"in x?x.response:x.responseText;setTimeout(function(){v(new l($,H))},0)},x.onerror=function(){setTimeout(function(){I(new TypeError("Network request failed"))},0)},x.ontimeout=function(){setTimeout(function(){I(new TypeError("Network request timed out"))},0)},x.onabort=function(){setTimeout(function(){I(new r.DOMException("Aborted","AbortError"))},0)};function A(H){try{return H===""&&n.location.href?n.location.href:H}catch{return H}}if(x.open(g.method,A(g.url),!0),g.credentials==="include"?x.withCredentials=!0:g.credentials==="omit"&&(x.withCredentials=!1),"responseType"in x&&(o.blob?x.responseType="blob":o.arrayBuffer&&(x.responseType="arraybuffer")),m&&typeof m.headers=="object"&&!(m.headers instanceof f||n.Headers&&m.headers instanceof n.Headers)){var O=[];
2Object.getOwnPropertyNames(m.headers).forEach(function(H){O.push(u(H)),x.setRequestHeader(H,d(m.headers[H]))}),g.headers.forEach(function(H,$){O.indexOf($)===-1&&x.setRequestHeader($,H)})}else g.headers.forEach(function(H,$){x.setRequestHeader($,H)});g.signal&&(g.signal.addEventListener("abort",E),x.onreadystatechange=function(){x.readyState===4&&g.signal.removeEventListener("abort",E)}),x.send(typeof g._bodyInit>"u"?null:g._bodyInit)})}return y.polyfill=!0,n.fetch||(n.fetch=y,n.Headers=f,n.Request=L,n.Response=l),r.Headers=f,r.Request=L,r.Response=l,r.fetch=y,r})({})})(qc);qc.fetch.ponyfill=!0;delete qc.fetch.polyfill;var No=Gc.fetch?Gc:qc;en=No.fetch;en.default=No.fetch;en.fetch=No.fetch;en.Headers=No.Headers;en.Request=No.Request;en.Response=No.Response;kp.exports=en});var ou=Ys(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.RLP=sr.utils=sr.decode=sr.encode=void 0;function jf(e){if(Array.isArray(e)){let r=[],n=0;for(let o=0;o<e.length;o++){let i=jf(e[o]);r.push(i),n+=i.length}return Uf(Rm(n,192),...r)}let t=Om(e);return t.length===1&&t[0]<128?t:Uf(Rm(t.length,128),t)}sr.encode=jf;function zo(e,t,r){if(r>e.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function Im(e){if(e[0]===0)throw new Error("invalid RLP: extra zeros");return Pm(km(e))}function Rm(e,t){if(e<56)return Uint8Array.from([e+t]);let r=$f(e),n=r.length/2,o=$f(t+55+n);return Uint8Array.from(nu(o+r))}function Sm(e,t=!1){if(typeof e>"u"||e===null||e.length===0)return Uint8Array.from([]);let r=Om(e),n=Ff(r);if(t)return n;if(n.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return n.data}sr.decode=Sm;function Ff(e){let t,r,n,o,i,s=[],a=e[0];if(a<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(a<=183){if(t=a-127,a===128?n=Uint8Array.from([]):n=zo(e,1,t),t===2&&n[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:n,remainder:e.slice(t)}}else if(a<=191){if(r=a-182,e.length-1<r)throw new Error("invalid RLP: not enough bytes for string length");if(t=Im(zo(e,1,r)),t<=55)throw new Error("invalid RLP: expected string length to be greater than 55");return n=zo(e,r,t+r),{data:n,remainder:e.slice(t+r)}}else if(a<=247){for(t=a-191,o=zo(e,1,t);o.length;)i=Ff(o),s.push(i.data),o=i.remainder;return{data:s,remainder:e.slice(t)}}else{if(r=a-246,t=Im(zo(e,1,r)),t<56)throw new Error("invalid RLP: encoded list too short");let u=r+t;if(u>e.length)throw new Error("invalid RLP: total length is larger than the data");for(o=zo(e,r,u);o.length;)i=Ff(o),s.push(i.data),o=i.remainder;return{data:s,remainder:e.slice(u)}}}var oE=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function km(e){let t="";for(let r=0;r<e.length;r++)t+=oE[e[r]];return t}function Pm(e){let t=Number.parseInt(e,16);if(Number.isNaN(t))throw new Error("Invalid byte sequence");return t}function nu(e){if(typeof e!="string")throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){let n=r*2;t[r]=Pm(e.slice(n,n+2))}return t}function Uf(...e){if(e.length===1)return e[0];let t=e.reduce((n,o)=>n+o.length,0),r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let i=e[n];r.set(i,o),o+=i.length}return r}function Bm(e){return new TextEncoder().encode(e)}function $f(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");let t=e.toString(16);return t.length%2?`0${t}`:t}function iE(e){return e.length%2?`0${e}`:e}function Nm(e){return e.length>=2&&e[0]==="0"&&e[1]==="x"}function sE(e){return typeof e!="string"?e:Nm(e)?e.slice(2):e}function Om(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")return Nm(e)?nu(iE(sE(e))):Bm(e);if(typeof e=="number"||typeof e=="bigint")return e?nu($f(e)):Uint8Array.from([]);if(e==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}sr.utils={bytesToHex:km,concatBytes:Uf,hexToBytes:nu,utf8ToBytes:Bm};sr.RLP={encode:jf,decode:Sm}});var Mm=Ys(Gf=>{"use strict";var Cm;(function(e){typeof DO_NOT_EXPORT_CRC>"u"?typeof Gf=="object"?e(Gf):typeof define=="function"&&define.amd?define(function(){var t={};return e(t),t}):e(Cm={}):e(Cm={})})(function(e){e.version="1.2.2";function t(){for(var N=0,l=new Array(256),p=0;p!=256;++p)N=p,N=N&1?-306674912^N>>>1:N>>>1,N=N&1?-306674912^N>>>1:N>>>1,N=N&1?-306674912^N>>>1:N>>>1,N=N&1?-306674912^N>>>1:N>>>1,N=N&1?-306674912^N>>>1:N>>>1,N=N&1?-306674912^N>>>1:N>>>1,N=N&1?-306674912^N>>>1:N>>>1,N=N&1?-306674912^N>>>1:N>>>1,l[p]=N;return typeof Int32Array<"u"?new Int32Array(l):l}var r=t();function n(N){var l=0,p=0,y=0,h=typeof Int32Array<"u"?new Int32Array(4096):new Array(4096);for(y=0;y!=256;++y)h[y]=N[y];for(y=0;y!=256;++y)for(p=N[y],l=256+y;l<4096;l+=256)p=h[l]=p>>>8^N[p&255];var m=[];for(y=1;y!=16;++y)m[y-1]=typeof Int32Array<"u"?h.subarray(y*256,y*256+256):h.slice(y*256,y*256+256);return m}var o=n(r),i=o[0],s=o[1],a=o[2],u=o[3],d=o[4],c=o[5],f=o[6],_=o[7],w=o[8],k=o[9],T=o[10],R=o[11],P=o[12],b=o[13],C=o[14];function F(N,l){for(var p=l^-1,y=0,h=N.length;y<h;)p=p>>>
28^r[(p^N.charCodeAt(y++))&255];return~p}function L(N,l){for(var p=l^-1,y=N.length-15,h=0;h<y;)p=C[N[h++]^p&255]^b[N[h++]^p>>8&255]^P[N[h++]^p>>16&255]^R[N[h++]^p>>>24]^T[N[h++]]^k[N[h++]]^w[N[h++]]^_[N[h++]]^f[N[h++]]^c[N[h++]]^d[N[h++]]^u[N[h++]]^a[N[h++]]^s[N[h++]]^i[N[h++]]^r[N[h++]];for(y+=15;h<y;)p=p>>>8^r[(p^N[h++])&255];return~p}function U(N,l){for(var p=l^-1,y=0,h=N.length,m=0,v=0;y<h;)m=N.charCodeAt(y++),m<128?p=p>>>8^r[(p^m)&255]:m<2048?(p=p>>>8^r[(p^(192|m>>6&31))&255],p=p>>>8^r[(p^(128|m&63))&255]):m>=55296&&m<57344?(m=(m&1023)+64,v=N.charCodeAt(y++)&1023,p=p>>>8^r[(p^(240|m>>8&7))&255],p=p>>>8^r[(p^(128|m>>2&63))&255],p=p>>>8^r[(p^(128|v>>6&15|(m&3)<<4))&255],p=p>>>8^r[(p^(128|v&63))&255]):(p=p>>>8^r[(p^(224|m>>12&15))&255],p=p>>>8^r[(p^(128|m>>6&63))&255],p=p>>>8^r[(p^(128|m&63))&255]);return~p}e.table=r,e.bstr=F,e.buf=L,e.str=U})});var D0=Ys(L0=>{"use strict";(function(e,t){"use strict";if(e.setImmediate)return;var r=1,n={},o=!1,i=e.document,s;function a(b){typeof b!="function"&&(b=new Function(""+b));for(var C=new Array(arguments.length-1),F=0;F<C.length;F++)C[F]=arguments[F+1];var L={callback:b,args:C};return n[r]=L,s(r),r++}function u(b){delete n[b]}function d(b){var C=b.callback,F=b.args;switch(F.length){case 0:C();break;case 1:C(F[0]);break;case 2:C(F[0],F[1]);break;case 3:C(F[0],F[1],F[2]);break;default:C.apply(t,F);break}}function c(b){if(o)setTimeout(c,0,b);else{var C=n[b];if(C){o=!0;try{d(C)}finally{u(b),o=!1}}}}function f(){s=function(b){process.nextTick(function(){c(b)})}}function _(){if(e.postMessage&&!e.importScripts){var b=!0,C=e.onmessage;return e.onmessage=function(){b=!1},e.postMessage("","*"),e.onmessage=C,b}}function w(){var b="setImmediate$"+Math.random()+"$",C=function(F){F.source===e&&typeof F.data=="string"&&F.data.indexOf(b)===0&&c(+F.data.slice(b.length))};e.addEventListener?e.addEventListener("message",C,!1):e.attachEvent("onmessage",C),s=function(F){e.postMessage(b+F,"*")}}function k(){var b=new MessageChannel;b.port1.onmessage=function(C){var F=C.data;c(F)},s=function(C){b.port2.postMessage(C)}}function T(){var b=i.documentElement;s=function(C){var F=i.createElement("script");F.onreadystatechange=function(){c(C),F.onreadystatechange=null,b.removeChild(F),F=null},b.appendChild(F)}}function R(){s=function(b){setTimeout(c,0,b)}}var P=Object.getPrototypeOf&&Object.getPrototypeOf(e);P=P&&P.setTimeout?P:e,{}.toString.call(e.process)==="[object process]"?f():_()?w():e.MessageChannel?k():i&&"onreadystatechange"in i.createElement("script")?T():R(),P.setImmediate=a,P.clearImmediate=u})(typeof self>"u"?typeof global>"u"?L0:global:self)});var Vl=(()=>{class e{DEFAULT_CACHE_TIME=15e3;$cache=bi(new Map);get(r,n=this.DEFAULT_CACHE_TIME){let i=this.$cache().get(r),s=Date.now(),a=i?s-i.timestamp:1/0;return i&&a<=n?(ta()&&console.debug(`[Web3Cache] Cache hit for key: ${r} (age: ${Math.round(a/1e3)}s)`),i.value):null}set(r,n){this.$cache.update(o=>{let i=new Map(o);return i.set(r,{value:n,timestamp:Date.now()}),i})}getOrFetch(r,n,o=this.DEFAULT_CACHE_TIME){let i=this.get(r,o);return i?Cr(i):n().pipe(ro(s=>{s&&this.set(r,s)}))}clearAll(){this.$cache.set(new Map)}clearByPrefix(r){this.$cache.update(n=>{let o=new Map(n);for(let[i]of o.entries())i.startsWith(r)&&o.delete(i);return o}
2)}buildBalanceCacheKey(r,n,o,i=null){return`balance-${r}-${o}-${i??"null"}-${n}`}buildCollectionCacheKey(r,n,o,i){return`collection-${n}-${o}-${i??"all"}-${r}`}static \u0275fac=function(n){return new(n||e)};static \u0275prov=no({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var zl=(()=>{class e{persSDK=vi($l);get web3Manager(){return this.persSDK.web3}getTokenBalance(r){return Or(this.web3Manager.getTokenBalance(r))}getTokenMetadata(r){return Or(this.web3Manager.getTokenMetadata(r))}getTokenCollection(r){return Or(this.web3Manager.getTokenCollection(r))}resolveIPFSUrl(r,n){return Or(this.web3Manager.resolveIPFSUrl(r,n))}fetchAndProcessMetadata(r,n){return Or(this.web3Manager.fetchAndProcessMetadata(r,n))}getChainDataById(r){return Or(this.web3Manager.getChainDataById(r))}getExplorerUrl(r,n,o){return Or(this.web3Manager.getExplorerUrl(r,n,o))}getWeb3Manager(){return this.web3Manager}static \u0275fac=function(n){return new(n||e)};static \u0275prov=no({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var Kl="https://gateway.pinata.cloud",X1=ra.create({baseURL:"https://api.nftport.xyz/v0",timeout:3e4,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"076beebb-1d9d-4def-b7da-26746ed80d8e"}}),J1=ra.create({baseURL:"https://api.nftport.xyz/v0",timeout:5e4,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:"6fb16347-9468-4ff8-862a-f3cc9e635b8d"}}),Y1=ra.create({baseURL:Kl,timeout:3e4,headers:{Accept:"application/json","Content-Type":"application/json"}});var xy=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,zu=Math.ceil,Tt=Math.floor,dt="[BigNumber Error] ",Zl=dt+"Number primitive has more than 15 significant digits: ",Ft=1e14,ae=14,Ku=9007199254740991,Zu=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Mr=1e7,qe=1e9;function Xl(e){var t,r,n,o=b.prototype={constructor:b,toString:null,valueOf:null},i=new b(1),s=20,a=4,u=-7,d=21,c=-1e7,f=1e7,_=!1,w=1,k=0,T={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},R="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function b(l,p){var y,h,m,v,I,g,x,E,A=this;if(!(A instanceof b))return new b(l,p);if(p==null){if(l&&l._isBigNumber===!0){A.s=l.s,!l.c||l.e>f?A.c=A.e=null:l.e<c?A.c=[A.e=0]:(A.e=l.e,A.c=l.c.slice());return}if((g=typeof l=="number")&&l*0==0){if(A.s=1/l<0?(l=-l,-1):1,l===~~l){for(v=0,I=l;I>=10;I/=10,v++);v>f?A.c=A.e=null:(A.e=v,A.c=[l]);return}E=String(l)}else{if(!xy.test(E=String(l)))return n(A,E,g);A.s=E.charCodeAt(0)==45?(E=E.slice(1),-1):1}(v=E.indexOf("."))>-1&&(E=E.replace(".","")),(I=E.search(/e/i))>0?(v<0&&(v=I),v+=+E.slice(I+1),E=E.substring(0,I)):v<0&&(v=E.length)}else{if(Oe(p,2,R.length,"Base"),p==10&&P)return A=new b(l),U(A,s+A.e+1,a);if(E=String(l),g=typeof l=="number"){if(l*0!=0)return n(A,E,g,p);if(A.s=1/l<0?(E=E.slice(1),-1):1,b.DEBUG&&E.replace(/^0\.0*|\./,"").length>15)throw Error(Zl+l)}else A.s=E.charCodeAt(0)===45?(E=E.slice(1),-1):1;for(y=R.slice(0,p),v=I=0,x=E.length;I<x;I++)if(y.indexOf(h=E.charAt(I))<0){if(h=="."){if(I>v){v=x;continue}}else if(!m&&(E==E.toUpperCase()&&(E=E.toLowerCase())||E==E.toLowerCase()&&(E=E.toUpperCase()))){m=!0,I=-1,v=0;continue}return n(A,String(l),g,p)}g=!1,E=r(E,p,10,A.s),(v=E.indexOf("."))>-1?E=E.replace(".",""):v=E.length}for(I=0;E.charCodeAt(I)===48;I++);for(x=E.length;E.charCodeAt(--x)===48;);if(E=E.slice(I,++x)){if(x-=I,g&&b.DEBUG&&x>15&&(l>Ku||l!==Tt(l)))throw Error(Zl+A.s*l);if((v=v-I-1)>f)A.c=A.e=null;else if(v<c)A.c=[A.e=0];else{if(A.e=v,A.c=[],I=(v+1)%ae,v<0&&(I+=ae),I<x){for(I&&A.c.push(+E.slice(0,I)),x-=ae;I<x;)A.c.push(+E.slice(I,I+=ae));I=ae-(E=E.slice(I)).length}else I-=x;for(;I--;E+="0");A.c.push(+E)}}else A.c=[A.e=0]}b.clone=Xl,b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.EUCLI
vendor: 14,585 bytes, line 2
2D=9,b.config=b.set=function(l){var p,y;if(l!=null)if(typeof l=="object"){if(l.hasOwnProperty(p="DECIMAL_PLACES")&&(y=l[p],Oe(y,0,qe,p),s=y),l.hasOwnProperty(p="ROUNDING_MODE")&&(y=l[p],Oe(y,0,8,p),a=y),l.hasOwnProperty(p="EXPONENTIAL_AT")&&(y=l[p],y&&y.pop?(Oe(y[0],-qe,0,p),Oe(y[1],0,qe,p),u=y[0],d=y[1]):(Oe(y,-qe,qe,p),u=-(d=y<0?-y:y))),l.hasOwnProperty(p="RANGE"))if(y=l[p],y&&y.pop)Oe(y[0],-qe,-1,p),Oe(y[1],1,qe,p),c=y[0],f=y[1];else if(Oe(y,-qe,qe,p),y)c=-(f=y<0?-y:y);else throw Error(dt+p+" cannot be zero: "+y);if(l.hasOwnProperty(p="CRYPTO"))if(y=l[p],y===!!y)if(y)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))_=y;else throw _=!y,Error(dt+"crypto unavailable");else _=y;else throw Error(dt+p+" not true or false: "+y);if(l.hasOwnProperty(p="MODULO_MODE")&&(y=l[p],Oe(y,0,9,p),w=y),l.hasOwnProperty(p="POW_PRECISION")&&(y=l[p],Oe(y,0,qe,p),k=y),l.hasOwnProperty(p="FORMAT"))if(y=l[p],typeof y=="object")T=y;else throw Error(dt+p+" not an object: "+y);if(l.hasOwnProperty(p="ALPHABET"))if(y=l[p],typeof y=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(y))P=y.slice(0,10)=="0123456789",R=y;else throw Error(dt+p+" invalid: "+y)}else throw Error(dt+"Object expected: "+l);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[u,d],RANGE:[c,f],CRYPTO:_,MODULO_MODE:w,POW_PRECISION:k,FORMAT:T,ALPHABET:R}},b.isBigNumber=function(l){if(!l||l._isBigNumber!==!0)return!1;if(!b.DEBUG)return!0;var p,y,h=l.c,m=l.e,v=l.s;e:if({}.toString.call(h)=="[object Array]"){if((v===1||v===-1)&&m>=-qe&&m<=qe&&m===Tt(m)){if(h[0]===0){if(m===0&&h.length===1)return!0;break e}if(p=(m+1)%ae,p<1&&(p+=ae),String(h[0]).length==p){for(p=0;p<h.length;p++)if(y=h[p],y<0||y>=Ft||y!==Tt(y))break e;if(y!==0)return!0}}}else if(h===null&&m===null&&(v===null||v===1||v===-1))return!0;throw Error(dt+"Invalid BigNumber: "+l)},b.maximum=b.max=function(){return F(arguments,-1)},b.minimum=b.min=function(){return F(arguments,1)},b.random=(function(){var l=9007199254740992,p=Math.random()*l&2097151?function(){return Tt(Math.random()*l)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(y){var h,m,v,I,g,x=0,E=[],A=new b(i);if(y==null?y=s:Oe(y,0,qe),I=zu(y/ae),_)if(crypto.getRandomValues){for(h=crypto.getRandomValues(new Uint32Array(I*=2));x<I;)g=h[x]*131072+(h[x+1]>>>11),g>=9e15?(m=crypto.getRandomValues(new Uint32Array(2)),h[x]=m[0],h[x+1]=m[1]):(E.push(g%1e14),x+=2);x=I/2}else if(crypto.randomBytes){for(h=crypto.randomBytes(I*=7);x<I;)g=(h[x]&31)*281474976710656+h[x+1]*1099511627776+h[x+2]*4294967296+h[x+3]*16777216+(h[x+4]<<16)+(h[x+5]<<8)+h[x+6],g>=9e15?crypto.randomBytes(7).copy(h,x):(E.push(g%1e14),x+=7);x=I/7}else throw _=!1,Error(dt+"crypto unavailable");if(!_)for(;x<I;)g=p(),g<9e15&&(E[x++]=g%1e14);for(I=E[--x],y%=ae,I&&y&&(g=Zu[ae-y],E[x]=Tt(I/g)*g);E[x]===0;E.pop(),x--);if(x<0)E=[v=0];else{for(v=-1;E[0]===0;E.splice(0,1),v-=ae);for(x=1,g=E[0];g>=10;g/=10,x++);x<ae&&(v-=ae-x)}return A.e=v,A.c=E,A}})(),b.sum=function(){for(var l=1,p=arguments,y=new b(p[0]);l<p.length;)y=y.plus(p[l++]);return y},r=(function(){var l="0123456789";function p(y,h,m,v){for(var I,g=[0],x,E=0,A=y.length;E<A;){for(x=g.length;x--;g[x]*=h);for(g[0]+=v.indexOf(y.charAt(E++)),I=0;I<g.length;I++)g[I]>m-1&&(g[I+1]==null&&(g[I+1]=0),g[I+1]+=g[I]/m|0,g[I]%=m)}return g.reverse()}return function(y,h,m,v,I){var g,x,E,A,O,H,$,re,xe=y.indexOf("."),ve=s,ce=a;for(xe>=0&&(A=k,k=0,y=y.replace(".",""),re=new b(h),H=re.pow(y.length-xe),k=A,re.c=p(lr(Et(H.c),H.e,"0"),10,m,l),re.e=re.c.length),$=p(y,h,m,I?(g=R,l):(g=l,R)),E=A=$.length;$[--A]==0;$.pop());if(!$[0])return g.charAt(0);if(xe<0?--E:(H.c=$,H.e=E,H.s=v,H=t(H,re,ve,ce,m),$=H.c,O=H.r,E=H.e),x=E+ve+1,xe=$[x],A=m/2,O=O||x<0||$[x+1]!=null,O=ce<4?(xe!=null||O)&&(ce==0||ce==(H.s<0?3:2)):xe>A||xe==A&&(ce==4||O||ce==6&&$[x-1]&1||ce==(H.s<0?8:7)),x<1||!$[0])y=O?lr(g.charAt(1),-ve,g.charAt(0)):g.charAt(0);else{if($.length=x,O)for(--m;++$[--x]>m;)$[x]=0,x||(++E,$=[1].concat($));for(A=$.length;!$[--A];);for(xe=0,y="";xe<=A;y+=g.charAt($[xe++]));y=lr(y,E,g.charAt(0))}return y}})(),t=(function(){function l(h,m,v){var I,g,x,E,A=0,O=h.length,H=m%Mr,$=m/Mr|0;for(h=h.slice();O--;)x=h[O]%Mr,E=h[O]/Mr|0,I=$*x+E*H,g=H*x+I%Mr*Mr+A,A=(g/v|0)+(I/Mr|0)+$*E,h[O]=g%v;return A&&(h=[A].concat(h)),h}function p(h,m,v,I){var g,x;if(v!=I)x=v>I?1:-1;else for(g=x=0;g<v;g++)if(h[g]!=m[g]){x=h[g]>m[g]?1:-1;break}return x}function y(h,m,v,I){for(var g=0;v--;)h[v]-=g,g=h[v]<m[v]?1:0,h[v]=g*I+h[v]-m[v];for(;!h[0]&&h.length>1;h.splice(0,1));}return function(h,m,v,I,g){var x,E,A,O,H,$,re,xe,ve,ce,pe,ke,Nr,Ht,Xt,ht,Ye,Ue=h.s==m.s?1:-1,Fe=h.c,Pe=m.c;if(!Fe||!Fe[0]||!Pe||!Pe[0])return new b(!h.s||!m.s||(Fe?Pe&&Fe[0]==Pe[0]:!Pe)?NaN:Fe&&Fe[0]==0||!Pe?Ue*0:Ue/0);for(xe=new b(Ue),ve=xe.c=[],E=h.e-m.e,Ue=v+E+1,g||(g=Ft,E=At(h.e/ae)-At(m.e/ae),Ue=Ue/ae|0),A=0;Pe[A]==(Fe[A]||0);A++);if(Pe[A]>(Fe[A]||0)&&E--,Ue<0)ve.push(1),O=!0;else{for(Ht=Fe.length,ht=Pe.length,A=0,Ue+=2,H=Tt(g/(Pe[0]+1)),H>1&&(Pe=l(Pe,H,g),Fe=l(Fe,H,g),ht=Pe.length,Ht=Fe.length),Nr=ht,ce=Fe.slice(0,ht),pe=ce.length;pe<ht;ce[pe++]=0);Ye=Pe.slice(),Ye=[0].concat(Ye),Xt=Pe[0],Pe[1]>=g/2&&Xt++;do{if(H=0,x=p(Pe,ce,ht,pe),x<0){if(ke=ce[0],ht!=pe&&(ke=ke*g+(ce[1]||0)),H=Tt(ke/Xt),H>1)for(H>=g&&(H=g-1),$=l(Pe,H,g),re=$.length,pe=ce.length;p($,ce,re,pe)==1;)H--,y($,ht<re?Ye:Pe,re,g),re=$.length,x=1;else H==0&&(x=H=1),$=Pe.slice(),re=$.length;if(re<pe&&($=[0].concat($)),y(ce,$,pe,g),pe=ce.length,x==-1)for(;p(Pe,ce,ht,pe)<1;)H++,y(ce,ht<pe?Ye:Pe,pe,g),pe=ce.length}else x===0&&(H++,ce=[0]);ve[A++]=H,ce[0]?ce[pe++]=Fe[Nr]||0:(ce=[Fe[Nr]],pe=1)}while((Nr++<Ht||ce[0]!=null)&&Ue--);O=ce[0]!=null,ve[0]||ve.splice(0,1)}if(g==Ft){for(A=1,Ue=ve[0];Ue>=10;Ue/=10,A++);U(xe,v+(xe.e=A+E*ae-1)+1,I,O)}else xe.e=E,xe.r=+O;return xe}})();function C(l,p,y,h){var m,v,I,g,x;if(y==null?y=a:Oe(y,0,8),!l.c)return l.toString();if(m=l.c[0],I=l.e,p==null)x=Et(l.c),x=h==1||h==2&&(I<=u||I>=d)?ia(x,I):lr(x,I,"0");else if(l=U(new b(l),p,y),v=l.e,x=Et(l.c),g=x.length,h==1||h==2&&(p<=v||v<=u)){for(;g<p;x+="0",g++);x=ia(x,v)}else if(p-=I+(h===2&&v>I),x=lr(x,v,"0"),v+1>g){if(--p>0)for(x+=".";p--;x+="0");}else if(p+=v-g,p>0)for(v+1==g&&(x+=".");p--;x+="0");return l.s<0&&m?"-"+x:x}function F(l,p){for(var y,h,m=1,v=new b(l[0]);m<l.length;m++)h=new b(l[m]),(!h.s||(y=xn(v,h))===p||y===0&&v.s===p)&&(v=h);return v}function L(l,p,y){for(var h=1,m=p.length;!p[--m];p.pop());for(m=p[0];m>=10;m/=10,h++);return(y=h+y*ae-1)>f?l.c=l.e=null:y<c?l.c=[l.e=0]:(l.e=y,l.c=p),l}n=(function(){var l=/^(-?)0([xbo])(?=\w[\w.]*$)/i,p=/^([^.]+)\.$/,y=/^\.([^.]+)$/,h=/^-?(Infinity|NaN)$/,m=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(v,I,g,x){var E,A=g?I:I.replace(m,"");if(h.test(A))v.s=isNaN(A)?null:A<0?-1:1;else{if(!g&&(A=A.replace(l,function(O,H,$){return E=($=$.toLowerCase())=="x"?16:$=="b"?2:8,!x||x==E?H:O}),x&&(E=x,A=A.replace(p,"$1").replace(y,"0.$1")),I!=A))return new b(A,E);if(b.DEBUG)throw Error(dt+"Not a"+(x?" base "+x:"")+" number: "+I);v.s=null}v.c=v.e=null}})();function U(l,p,y,h){var m,v,I,g,x,E,A,O=l.c,H=Zu;if(O){e:{for(m=1,g=O[0];g>=10;g/=10,m++);if(v=p-m,v<0)v+=ae,I=p,x=O[E=0],A=Tt(x/H[m-I-1]%10);else if(E=zu((v+1)/ae),E>=O.length)if(h){for(;O.length<=E;O.push(0));x=A=0,m=1,v%=ae,I=v-ae+1}else break e;else{for(x=g=O[E],m=1;g>=10;g/=10,m++);v%=ae,I=v-ae+m,A=I<0?0:Tt(x/H[m-I-1]%10)}if(h=h||p<0||O[E+1]!=null||(I<0?x:x%H[m-I-1]),h=y<4?(A||h)&&(y==0||y==(l.s<0?3:2)):A>5||A==5&&(y==4||h||y==6&&(v>0?I>0?x/H[m-I]:0:O[E-1])%10&1||y==(l.s<0?8:7)),p<1||!O[0])return O.length=0,h?(p-=l.e+1,O[0]=H[(ae-p%ae)%ae],l.e=-p||0):O[0]=l.e=0,l;if(v==0?(O.length=E,g=1,E--):(O.length=E+1,g=H[ae-v],O[E]=I>0?Tt(x/H[m-I]%H[I])*g:0),h)for(;;)if(E==0){for(v=1,I=O[0];I>=10;I/=10,v++);for(I=O[0]+=g,g=1;I>=10;I/=10,g++);v!=g&&(l.e++,O[0]==Ft&&(O[0]=1));break}else{if(O[E]+=g,O[E]!=Ft)break;O[E--]=0,g=1}for(v=O.length;O[--v]===0;O.pop());}l.e>f?l.c=l.e=null:l.e<c&&(l.c=[l.e=0])}return l}function N(l){var p,y=l.e;return y===null?l.toString():(p=Et(l.c),p=y<=u||y>=d?ia(p,y):lr(p,y,"0"),l.s<0?"-"+p:p)}return o.absoluteValue=o.abs=function(){var l=new b(this);return l.s<0&&(l.s=1),l},o.comparedTo=function(l,p){return xn(this,new b(l,p))},o.decimalPlaces=o.dp=function(l,p){var y,h,m,v=this;if(l!=null)return Oe(l,0,qe),p==null?p=a:Oe(p,0,8),U(new b(v),l+v.e+1,p);if(!(y=v.c))return null;if(h=((m=y.length-1)-At(this.e/ae))*ae,m=y[m])for(;m%10==0;m/=10,h--);return h<0&&(h=0),h},o.dividedBy=o.div=function(l,p){return t(this,new b(l,p),s,a)},o.dividedToIntegerBy=o.idiv=function(l,p){return t(this,new b(l,p),0,1)},o.exponentiatedBy=o.pow=function(l,p){var y,h,m,v,I,g,x,E,A,O=this;if(l=new b(l),l.c&&!l.isInteger())throw Error(dt+"Exponent not an integer: "+N(l));if(p!=null&&(p=new b(p)),g=l.e>14,!O.c||!O.c[0]||O.c[0]==1&&!O.e&&O.c.length==1||!l.c||!l.c[0])return A=new b(Math.pow(+N(O),g?l.s*(2-oa(l)):+N(l))),p?A.mod(p):A;if(x=l.s<0,p){if(p.c?!p.c[0]:!p.s)return new b(NaN);h=!x&&O.isInteger()&&p.isInteger(),h&&(O=O.mod(p))}else{if(l.e>9&&(O.e>0||O.e<-1||(O.e==0?O.c[0]>1||g&&O.c[1]>=24e7:O.c[0]<8e13||g&&O.c[0]<=9999975e7)))return v=O.s<0&&oa(l)?-0:0,O.e>-1&&(v=1/v),new b(x?1/v:v);k&&(v=zu(k/ae+2))}for(g?(y=new b(.5),x&&(l.s=1),E=oa(l)):(m=Math.abs(+N(l)),E=m%2),A=new b(i);;){if(E){if(A=A.times(O),!A.c)break;v?A.c.length>v&&(A.c.length=v):h&&(A=A.mod(p))}if(m){if(m=Tt(m/2),m===0)break;E=m%2}else if(l=l.times(y),U(l,l.e+1,1),l.e>14)E=oa(l);else{if(m=+N(l),m===0)break;E=m%2}O=O.times(O),v?O.c&&O.c.length>v&&(O.c.length=v):h&&(O=O.mod(p))}return h?A:(x&&(A=i.div(A)),p?A.mod(p):v?U(A,k,a,I):A)},o.integerValue=function(l){var p=new b(this);return l==null?l=a:Oe(l,0,8),U(p,p.e+1,l)},o.isEqualTo=o.eq=function(l,p){return xn(this,new b(l,p))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(l,p){return xn(this,new b(l,p))>0},o.isGreaterThanOrEqualTo=o.gte=function(l,p){return(p=xn(this,new b(l,p)))===1||p===0},o.isInteger=function(){return!!this.c&&At(this.e/ae)>this.c.length-2},o.isLessThan=o.lt=function(l,p){return xn(this,new b(l,p))<0},o.isLessThanOrEqualTo=o.lte=function(l,p){return(p=xn(this,new b(l,p)))===-1||p===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(l,p){var y,h,m,v,I=this,g=I.s;if(l=new b(l,p),p=l.s,!g||!p)return new b(NaN);if(g!=p)return l.s=-p,I.plus(l);var x=I.e/ae,E=l.e/ae,A=I.c,O=l.c;if(!x||!E){if(!A||!O)return A?(l.s=-p,l):new b(O?I:NaN);if(!A[0]||!O[0])return O[0]?(l.s=-p,l):new b(A[0]?I:a==3?-0:0)}if(x=At(x),E=At(E),A=A.slice(),g=x-E){for((v=g<0)?(g=-g,m=A):(E=x,m=O),m.reverse(),p=g;p--;m.push(0));m.reverse()}else for(h=(v=(g=A.length)<(p=O.length))?g:p,g=p=0;p<h;p++)if(A[p]!=O[p]){v=A[p]<O[p];break}if(v&&(m=A,A=O,O=m,l.s=-l.s),p=(h=O.length)-(y=A.length),p>0)for(;p--;A[y++]=0);for(p=Ft-1;h>g;){if(A[--h]<O[h]){for(y=h;y&&!A[--y];A[y]=p);--A[y],A[h]+=Ft}A[h]-=O[h]}for(;A[0]==0;A.splice(0,1),--E);return A[0]?L(l,A,E):(l.s=a==3?-1:1,l.c=[l.e=0],l)},o.modulo=o.mod=function(l,p){var y,h,m=this;return l=new b(l,p),!m.c||!l.s||l.c&&!l.c[0]?new b(NaN):!l.c||m.c&&!m.c[0]?new b(m):(w==9?(h=l.s,l.s=1,y=t(m,l,0,3),l.s=h,y.s*=h):y=t(m,l,0,w),l=m.minus(y.times(l)),!l.c[0]&&w==1&&(l.s=m.s),l)},o.multipliedBy=o.times=function(l,p){var y,h,m,v,I,g,x,E,A,O,H,$,re,xe,ve,ce=this,pe=ce.c,ke=(l=new b(l,p)).c;if(!pe||!ke||!pe[0]||!ke[0])return!ce.s||!l.s||pe&&!pe[0]&&!ke||ke&&!ke[0]&&!pe?l.c=l.e=l.s=null:(l.s*=ce.s,!pe||!ke?l.c=l.e=null:(l.c=[0],l.e=0)),l;for(h=At(ce.e/ae)+At(l.e/ae),l.s*=ce.s,x=pe.length,O=ke.length,x<O&&(re=pe,pe=ke,ke=re,m=x,x=O,O=m),m=x+O,re=[];m--;re.push(0));for(xe=Ft,ve=Mr,m=O;--m>=0;){for(y=0,H=ke[m]%ve,$=ke[m]/ve|0,I=x,v=m+I;v>m;)E=pe[--I]%ve,A=pe[I]/ve|0,g=$*E+A*H,E=H*E+g%ve*ve+re[v]+y,y=(E/xe|0)+(g/ve|0)+$*A,re[v--]=E%xe;re[v]=y}return y?++h:re.splice(0,1),L(l,re,h)},o.negated=function(){var l=new b(this);return l.s=-l.s||null,l},o.plus=function(l,p){var y,h=this,m=h.s;if(l=new b(l,p),p=l.s,!m||!p)return new b(NaN);if(m!=p)return l.s=-p,h.minus(l);var v=h.e/ae,I=l.e/ae,g=h.c,x=l.c;if(!v||!I){if(!g||!x)return new b(m/0);if(!g[0]||!x[0])return x[0]?l:new b(g[0]?h:m*0)}if(v=At(v),I=At(I),g=g.slice(),m=v-I){for(m>0?(I=v,y=x):(m=-m,y=g),y.reverse();m--;y.push(0));y.reverse()}for(m=g.length,p=x.length,m-p<0&&(y=x,x=g,g=y,p=m),m=0;p;)m=(g[--p]=g[p]+x[p]+m)/Ft|0,g[p]=Ft===g[p]?0:g[p]%Ft;return m&&(g=[m].concat(g),++I),L(l,g,I)},o.precision=o.sd=function(l,p){var y,h,m,v=this;if(l!=null&&l!==!!l)return Oe(l,1,qe),p==null?p=a:Oe(p,0,8),U(new b(v),l,p);if(!(y=v.c))return null;if(m=y.length-1,h=m*ae+1,m=y[m]){for(;m%10==0;m/=10,h--);for(m=y[0];m>=10;m/=10,h++);}return l&&v.e+1>h&&(h=v.e+1),h},o.shiftedBy=function(l){return Oe(l,-Ku,Ku),this.times("1e"+l)},o.squareRoot=o.sqrt=function(){var l,p,y,h,m,v=this,I=v.c,g=v.s,x=v.e,E=s+4,A=new b("0.5");if(g!==1||!I||!I[0])return new b(!g||g<0&&(!I||I[0])?NaN:I?v:1/0);if(g=Math.sqrt(+N(v)),g==0||g==1/0?(p=Et(I),(p.length+x)%2==0&&(p+="0"),g=Math.sqrt(+p),x=At((x+1)/2)-(x<0||x%2),g==1/0?p="5e"+x:(p=g.toExponential(),p=p.slice(0,p.indexOf("e")+1)+x),y=new b(p)):y=new b(g+""),y.c[0]){for(x=y.e,g=x+E,g<3&&(g=0);;)if(m=y,y=A.times(m.plus(t(v,m,E,1))),Et(m.c).slice(0,g)===(p=Et(y.c)).slice(0,g))if(y.e<x&&--g,p=p.slice(g-3,g+1),p=="9999"||!h&&p=="4999"){if(!h&&(U(m,m.e+s+2,0),m.times(m).eq(v))){y=m;break}E+=4,g+=4,h=1}else{(!+p||!+p.slice(1)&&p.charAt(0)=="5")&&(U(y,y.e+s+2,1),l=!y.times(y).eq(v));break}}return U(y,y.e+s+1,a,l)},o.toExponential=function(l,p){return l!=null&&(Oe(l,0,qe),l++),C(this,l,p,1)},o.toFixed=function(l,p){return l!=null&&(Oe(l,0,qe),l=l+this.e+1),C(this,l,p)},o.toFormat=function(l,p,y){var h,m=this;if(y==null)l!=null&&p&&typeof p=="object"?(y=p,p=null):l&&typeof l=="object"?(y=l,l=p=null):y=T;else if(typeof y!="object")throw Error(dt+"Argument not an object: "+y);if(h=m.toFixed(l,p),m.c){var v,I=h.split("."),g=+y.groupSize,x=+y.secondaryGroupSize,E=y.groupSeparator||"",A=I[0],O=I[1],H=m.s<0,$=H?A.slice(1):A,re=$.length;if(x&&(v=g,g=x,x=v,re-=v),g>0&&re>0){for(v=re%g||g,A=$.substr(0,v);v<re;v+=g)A+=E+$.substr(v,g);x>0&&(A+=E+$.slice(v)),H&&(A="-"+A)}h=O?A+(y.decimalSeparator||"")+((x=+y.fractionGroupSize)?O.replace(new RegExp("\\d{"+x+"}\\B","g"),"$&"+(y.fractionGroupSeparator||"")):O):A}return(y.prefix||"")+h+(y.suffix||"")},o.toFraction=function(l){var p,y,h,m,v,I,g,x,E,A,O,H,$=this,re=$.c;if(l!=null&&(g=new b(l),!g.isInteger()&&(g.c||g.s!==1)||g.lt(i)))throw Error(dt+"Argument "+(g.isInteger()?"out of range: ":"not an integer: ")+N(g));if(!re)return new b($);for(p=new b(i),E=y=new b(i),h=x=new b(i),H=Et(re),v=p.e=H.length-$.e-1,p.
2c[0]=Zu[(I=v%ae)<0?ae+I:I],l=!l||g.comparedTo(p)>0?v>0?p:E:g,I=f,f=1/0,g=new b(H),x.c[0]=0;A=t(g,p,0,1),m=y.plus(A.times(h)),m.comparedTo(l)!=1;)y=h,h=m,E=x.plus(A.times(m=E)),x=m,p=g.minus(A.times(m=p)),g=m;return m=t(l.minus(y),h,0,1),x=x.plus(m.times(E)),y=y.plus(m.times(h)),x.s=E.s=$.s,v=v*2,O=t(E,h,v,a).minus($).abs().comparedTo(t(x,y,v,a).minus($).abs())<1?[E,h]:[x,y],f=I,O},o.toNumber=function(){return+N(this)},o.toPrecision=function(l,p){return l!=null&&Oe(l,1,qe),C(this,l,p,2)},o.toString=function(l){var p,y=this,h=y.s,m=y.e;return m===null?h?(p="Infinity",h<0&&(p="-"+p)):p="NaN":(l==null?p=m<=u||m>=d?ia(Et(y.c),m):lr(Et(y.c),m,"0"):l===10&&P?(y=U(new b(y),s+m+1,a),p=lr(Et(y.c),y.e,"0")):(Oe(l,2,R.length,"Base"),p=r(lr(Et(y.c),m,"0"),10,l,h,!0)),h<0&&y.c[0]&&(p="-"+p)),p},o.valueOf=o.toJSON=function(){return N(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&b.set(e),b}function At(e){var t=e|0;return e>0||e===t?t:t-1}function Et(e){for(var t,r,n=1,o=e.length,i=e[0]+"";n<o;){for(t=e[n++]+"",r=ae-t.length;r--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function xn(e,t){var r,n,o=e.c,i=t.c,s=e.s,a=t.s,u=e.e,d=t.e;if(!s||!a)return null;if(r=o&&!o[0],n=i&&!i[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=u==d,!o||!i)return n?0:!o^r?1:-1;if(!n)return u>d^r?1:-1;for(a=(u=o.length)<(d=i.length)?u:d,s=0;s<a;s++)if(o[s]!=i[s])return o[s]>i[s]^r?1:-1;return u==d?0:u>d^r?1:-1}function Oe(e,t,r,n){if(e<t||e>r||e!==Tt(e))throw Error(dt+(n||"Argument")+(typeof e=="number"?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function oa(e){var t=e.c.length-1;return At(e.e/ae)==t&&e.c[t]%2!=0}function ia(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function lr(e,t,r){var n,o;if(t<0){for(o=r+".";++t;o+=r);e=o+e}else if(n=e.length,++t>n){for(o=r,t-=n;--t;o+=r);e+=o}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var tA=Xl();var it=(function(e){return e.NUMBER="NUMBER_NUMBER",e.HEX="NUMBER_HEX",e.STR="NUMBER_STR",e.BIGINT="NUMBER_BIGINT",e})(it||{}),Ut=(function(e){return e.HEX="BYTES_HEX",e.UINT8ARRAY="BYTES_UINT8ARRAY",e})(Ut||{}),Be={number:it.BIGINT,bytes:Ut.HEX},J={number:it.HEX,bytes:Ut.HEX};var It=(function(e){return e.EARLIEST="earliest",e.LATEST="latest",e.PENDING="pending",e.SAFE="safe",e.FINALIZED="finalized",e.COMMITTED="committed",e})(It||{}),_i=(function(e){return e.chainstart="chainstart",e.frontier="frontier",e.homestead="homestead",e.dao="dao",e.tangerineWhistle="tangerineWhistle",e.spuriousDragon="spuriousDragon",e.byzantium="byzantium",e.constantinople="constantinople",e.petersburg="petersburg",e.istanbul="istanbul",e.muirGlacier="muirGlacier",e.berlin="berlin",e.london="london",e.altair="altair",e.arrowGlacier="arrowGlacier",e.grayGlacier="grayGlacier",e.bellatrix="bellatrix",e.merge="merge",e.capella="capella",e.shanghai="shanghai",e})(_i||{});var wi=Object.getPrototypeOf(Uint8Array);var Jl=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Yl=Symbol.for("web3/base-provider"),Lr=class e{static isWeb3Provider(t){return t instanceof e||!!(t&&t[Yl])}get[Yl](){return!0}send(t,r){this.request(t).then(n=>{r(null,n)}).catch(n=>{r(n)})}sendAsync(t){return Jl(this,void 0,void 0,function*(){return this.request(t)})}asEIP1193Provider(){let t=Object.create(this),r=t.request;return t.request=function(o){return Jl(this,void 0,void 0,function*(){return(yield r(o)).result})},t.asEIP1193Provider=void 0,t}};var sa=class extends Array{constructor(t){super(),this._accountProvider=t}};var z=class extends Error{get innerError(){return this.cause instanceof Dr?this.cause.errors:this.cause}set innerError(t){Array.isArray(t)?this.cause=new Dr(t):this.cause=t}constructor(t,r){super(t),Array.isArray(r)?this.cause=new Dr(r):this.cause=r,this.name=this.constructor.name,typeof Error.captureStackTrace=="function"?Error.captureStackTrace(new.target.constructor):this.stack=new Error().stack}static convertToString(t,r=!1){if(t==null)return"undefined";let n=JSON.stringify(t,(o,i)=>typeof i=="bigint"?i.toString():i);return r&&["bigint","string"].includes(typeof t)?n.replace(/['\\"]+/g,""):n}toJSON(){return{name:this.name,code:this.code,message:this.message,cause:this.cause,innerError:this.cause}}},Dr=class extends z{constructor(t){super(`Multiple errors occurred: [${t.map(r=>r.message).join("], [")}]`),this.code=208,this.errors=t}},ie=class extends z{constructor(t,r){super(`Invalid value given "${z.convertToString(t,!0)}". Error: ${r}.`),this.name=this.constructor.name}};var Ei=class extends z{constructor(){super("Private key must be 32 bytes."),this.code=701}},aa=class extends z{constructor(){super("Invalid Private Key, Not a valid string or uint8Array"),this.code=702}},ca=class extends z{constructor(t){super(`"${t}"`),this.code=802}},Ti=class extends z{constructor(){super("Invalid key derivation function"),this.code=703}},ua=class extends z{constructor(){super("Key derivation failed - possibly wrong password"),this.code=704}},da=class extends z{constructor(){super("Unsupported key store version"),this.code=705}},fa=class extends z{constructor(){super("Password cannot be empty"),this.code=706}},la=class extends z{constructor(){super("Initialization vector must be 16 bytes"),this.code=707}},ha=class extends z{constructor(){super("c > 1000, pbkdf2 is less secure with less iterations"),this.code=709}};var Hr=class extends z{constructor(t,r){super(t),this.code=500,r&&(this.errorCode=r.code,this.errorReason=r.reason)}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{errorCode:this.errorCode,errorReason:this.errorReason})}};var vn=class extends Hr{constructor(t){super("Connection not open",t),this.code=503}};var pa=class extends Hr{constructor(t){super(`Maximum number of reconnect attempts reached! (${t})`),this.code=505}},ma=class extends Hr{constructor(){super("CONNECTION ERROR: Provider started to reconnect before the response got received!"),this.code=506}},ga=class extends Hr{constructor(t){super(`Request already sent with following id: ${t}`),this.code=507}};var Me=class extends z{constructor(t,r){super(t),this.code=300,this.receipt=r}},Ai=class extends z{constructor(t,r){super(`The resolver at ${t} does not implement requested method: "${r}
2".`),this.address=t,this.name=r,this.code=301}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{address:this.address,name:this.name})}};var Ii=class e extends Me{constructor(t){if(super(t.message||"Error"),this.name="name"in t&&t.name||this.constructor.name,this.stack="stack"in t&&t.stack||void 0,this.code=t.code,typeof t.data=="object"){let r;t.data&&"originalError"in t.data?r=t.data.originalError:r=t.data,this.data=r.data,this.cause=new e(r)}else this.data=t.data}setDecodedProperties(t,r,n){this.errorName=t,this.errorSignature=r,this.errorArgs=n}toJSON(){let t=Object.assign(Object.assign({},super.toJSON()),{data:this.data});return this.errorName&&(t=Object.assign(Object.assign({},t),{errorName:this.errorName,errorSignature:this.errorSignature,errorArgs:this.errorArgs})),t}},pt=class extends Me{constructor(t){super("Error happened while trying to execute a function inside a smart contract"),this.code=310,this.cause=new Ii(t)}},ya=class extends ie{constructor(t){var r,n;super(`data: ${(r=t.data)!==null&&r!==void 0?r:"undefined"}, input: ${(n=t.input)!==null&&n!==void 0?n:"undefined"}`,`You can't have "data" and "input" as properties of a contract at the same time, please use either "data" or "input" instead.`),this.code=311}};var xa=class extends z{constructor(t){super(`ENS is not supported on network ${t}`),this.code=902}},va=class extends z{constructor(){super("Network not synced"),this.code=903}};var oo=class extends z{constructor(t){super(`Invalid parameters passed. "${typeof t<"u"?t:""}"`),this.hint=t,this.code=207}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{hint:this.hint})}},bn=class extends z{constructor(){super(...arguments),this.code=201}},Rt=class extends z{constructor(){super("The method you're trying to call is not implemented."),this.code=202}},io=class extends z{constructor(){super(...arguments),this.code=203}},ba=class extends z{constructor(){super(...arguments),this.code=204}},Q=class extends z{constructor(t,r){super(t),this.code=205,this.props=r??{}}},_a=class extends z{constructor(t){super(`A plugin with the namespace: ${t} has already been registered.`),this.code=206}};var Fr=class extends z{constructor(){super(...arguments),this.code=600}};var _n=class extends z{constructor(t){super(`Client URL "${t}" is invalid.`),this.code=602}},mt=class extends z{constructor(){super(...arguments),this.code=603}},wa=class extends z{constructor(){super(...arguments),this.code=604}};var Ea=class extends ie{constructor(){super(...arguments),this.code=801}};var Ri=class extends z{constructor(t,r){super(t),this.receipt=r,this.code=400}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{receipt:this.receipt})}};var Ur=class extends z{constructor(t,r,n,o){super(`Transaction has been reverted by the EVM${n===void 0?"":`: 3 ${z.convertToString(n)}`}`),this.reason=t,this.signature=r,this.receipt=n,this.data=o,this.code=402}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reason:this.reason,signature:this.signature,receipt:this.receipt,data:this.data})}},so=class extends Ur{constructor(t,r,n,o,i,s,a){super(t),this.reason=t,this.customErrorName=r,this.customErrorDecodedSignature=n,this.customErrorArguments=o,this.signature=i,this.receipt=s,this.data=a,this.code=438}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reason:this.reason,customErrorName:this.customErrorName,customErrorDecodedSignature:this.customErrorDecodedSignature,customErrorArguments:this.customErrorArguments,signature:this.signature,receipt:this.receipt,data:this.data})}};var ao=class extends Ri{constructor(t){super(`Transaction has been reverted by the EVM${t===void 0?"":`: 4 ${z.convertToString(t)}`}`,t),this.code=405}};var Ta=class extends Ri{constructor(){super("Raw transaction undefined"),this.code=407}},Si=class extends Ri{constructor(){super("Transaction not found"),this.code=430}},ki=class extends ie{constructor(t){super(t,"invalid transaction with invalid sender"),this.code=408}},Aa=class extends ie{constructor(t){super(t,"invalid transaction with invalid receiver"),this.code=437}};var Ia=class extends ie{constructor(){super("MissingCustomChainError","If tx.common is provided it must have tx.common.customChain"),this.code=410}},Ra=class extends ie{constructor(){super("MissingCustomChainIdError","If tx.common is provided it must have tx.common.customChain and tx.common.customChain.chainId"),this.code=411}},Sa=class extends ie{constructor(t){super(JSON.stringify(t),"Chain Id doesnt match in tx.chainId tx.common.customChain.chainId"),this.code=412}},ka=class extends ie{constructor(t){super(JSON.stringify(t),"Chain doesnt match in tx.chain tx.common.basechain"),this.code=435}},Pa=class extends ie{constructor(t){super(JSON.stringify(t),"hardfork doesnt match in tx.hardfork tx.common.hardfork"),this.code=436}},Ba=class extends ie{constructor(){super("CommonOrChainAndHardforkError","Please provide the common object or the chain and hardfork property but not all together."),this.code=413}},Na=class extends ie{constructor(t){var r,n;super("MissingChainOrHardforkError",`When specifying chain and hardfork, both values must be defined. Received "chain": ${(r=t.chain)!==null&&r!==void 0?r:"undefined"}, "hardfork": ${(n=t.hardfork)!==null&&n!==void 0?n:"undefined"}`),this.code=414}},Xu=class extends z{constructor(){super('Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions'),this.code=440}},Oa=class extends ie{constructor(t){var r,n,o,i;super(`gas: ${(r=t.gas)!==null&&r!==void 0?r:"undefined"}, gasPrice: ${(n=t.gasPrice)!==null&&n!==void 0?n:"undefined"}, maxPriorityFeePerGas: ${(o=t.maxPriorityFeePerGas)!==null&&o!==void 0?o:"undefined"}, maxFeePerGas: ${(i=t.maxFeePerGas)!==null&&i!==void 0?i:"undefined"}`,'"gas" is missing'),this.code=415,this.cause=new Xu}},Ju=class extends z{constructor(){super('Missing properties in transaction, either define "gas" and "gasPrice" for type 0 transactions or "gas", "maxPriorityFeePerGas" and "maxFeePerGas" for type 2 transactions, not both'),this.code=441}},Ca=class extends ie{constructor(t){var r,n,o,i;super(`gas: ${(r=t.gas)!==null&&r!==void 0?r:"undefined"}, gasPrice: ${(n=t.gasPrice)!==null&&n!==void 0?n:"undefined"}, maxPriorityFeePerGas: ${(o=t.maxPriorityFeePerGas)!==null&&o!==void 0?o:"undefined"}, maxFeePerGas: ${(i=t.maxFeePerGas)!==null&&i!==void 0?i:"undefined"}`,"transaction must specify legacy or fee market gas properties, not both"),this.code=434,this.cause=new Ju}},Ma=class extends ie{constructor(t){var r,n;super(`gas: ${(r=t.gas)!==null&&r!==void 0?r:"undefined"}, gasPrice: ${(n=t.gasPrice)!==null&&n!==void 0?n:"undefined"}`,"Gas or gasPrice is lower than 0"),this.code=416}},La=class extends ie{constructor(t){var r,n;super(`maxPriorityFeePerGas: ${(r=t.maxPriorityFeePerGas)!==null&&r!==void 0?r:"undefined"}, maxFeePerGas: ${(n=t.maxFeePerGas)!==null&&n!==void 0?n:"undefined"}`,"maxPriorityFeePerGas or maxFeePerGas is lower than 0"),this.code=417}},Da=class extends ie{constructor(t){super(t,"eip-1559 transactions don't support gasPrice"),this.code=418}},Pi=class extends ie{constructor(t){var r,n;super(`maxPriorityFeePerGas: ${(r=t.maxPriorityFeePerGas)!==null&&r!==void 0?r:"undefined"}, maxFeePerGas: ${(n=t.maxFeePerGas)!==null&&n!==void 0?n:"undefined"}
4`,"pre-eip-1559 transaction don't support maxFeePerGas/maxPriorityFeePerGas"),this.code=419}},Ha=class extends ie{constructor(t){super(t,"invalid transaction object"),this.code=420}},Fa=class extends ie{constructor(t){var r,n;super(`nonce: ${(r=t.nonce)!==null&&r!==void 0?r:"undefined"}, chainId: ${(n=t.chainId)!==null&&n!==void 0?n:"undefined"}`,"Nonce or chainId is lower than 0"),this.code=421}},Ua=class extends ie{constructor(){super("UnableToPopulateNonceError","unable to populate nonce, no from address available"),this.code=422}},$a=class extends ie{constructor(){super("Eip1559NotSupportedError","Network doesn't support eip-1559"),this.code=423}},Bi=class extends ie{constructor(t){super(t,"unsupported transaction type"),this.code=424}},co=class extends ie{constructor(t){var r,n;super(`data: ${(r=t.data)!==null&&r!==void 0?r:"undefined"}, input: ${(n=t.input)!==null&&n!==void 0?n:"undefined"}`,`You can't have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.`),this.code=425}},ja=class extends z{constructor(t){super(`The connected Ethereum Node did not respond within ${t.numberOfSeconds} seconds, please make sure your transaction was properly sent and you are connected to a healthy Node. Be aware that transaction might still be pending or mined! 5 Transaction Hash: ${t.transactionHash?t.transactionHash.toString():"not available"}`),this.code=431}};function Ql(e){return`Please make sure your transaction was properly sent and there are no previous pending transaction for the same account. However, be aware that it might still be mined! 6 Transaction Hash: ${e?e.toString():"not available"}`}var uo=class extends z{constructor(t){super(`Transaction was not mined within ${t.numberOfSeconds} seconds. ${Ql(t.transactionHash)}`),this.code=426}},Ni=class extends z{constructor(t){super(`Transaction started at ${t.starterBlockNumber} but was not mined within ${t.numberOfBlocks} blocks. ${Ql(t.transactionHash)}`),this.code=432}},Ga=class extends ie{constructor(t){var r,n;super(`receipt: ${JSON.stringify(t.receipt)}, blockHash: ${(r=t.blockHash)===null||r===void 0?void 0:r.toString()}, transactionHash: ${(n=t.transactionHash)===null||n===void 0?void 0:n.toString()}`,"Receipt missing or blockHash null"),this.code=427}},qa=class extends ie{constructor(t){super(`receipt: ${JSON.stringify(t.receipt)}`,"Receipt missing block number"),this.code=428}},fo=class extends z{constructor(t){super(`Invalid signature. "${t}"`),this.code=433}},Oi=class extends ie{constructor(){super("LocalWalletNotAvailableError","Attempted to index account in local wallet, but no wallet is available"),this.code=429}},Wa=class extends z{constructor(t,r){let n=[];t.forEach(o=>n.push(o.keyword)),super(`The following properties are invalid for the transaction type ${r}: ${n.join(", ")}`),this.code=439}};var $t=class extends ie{constructor(t){super(t,"can not parse as byte data"),this.code=1002}},$r=class extends ie{constructor(t){super(t,"can not parse as number data"),this.code=1003}},hr=class extends ie{constructor(t){super(t,"invalid ethereum address"),this.code=1005}},Va=class extends ie{constructor(t){super(t,"not a valid string"),this.code=1001}},Ci=class extends ie{constructor(t){super(t,"invalid unit"),this.code=1004}},Mi=class extends ie{constructor(t){super(t,"not a valid unit. Must be a positive integer"),this.code=1015}},za=class extends ie{constructor(t){super(t,"can not be converted to hex"),this.code=1006}},Li=class extends ie{constructor(t){super(t,"value greater than the nibble width"),this.code=1014}};var jr=class extends ie{constructor(t){super(t,"not a valid boolean."),this.code=1008}},Ka=class extends ie{constructor(t){super(t,"not a valid unsigned integer."),this.code=1009}},Di=class extends ie{constructor(t){super(t,"invalid size given."),this.code=1010}},Hi=class extends ie{constructor(t){super(t,"value is larger than size."),this.code=1011}},Za=class extends ie{constructor(t){super(t,"invalid string given"),this.code=1012}};var ov=e=>!Array.isArray(e)&&e.jsonrpc==="2.0"&&!!e&&(e.result===void 0||e.result===null)&&"error"in e&&(typeof e.id=="number"||typeof e.id=="string"),eh=e=>ov(e)?e.error.message:"",Qe=class extends z{constructor(t,r,n,o){var i;super(r??`Returned error: ${Array.isArray(t)?t.map(a=>eh(a)).join(","):eh(t)}`),this.code=100,r||(this.data=Array.isArray(t)?t.map(a=>{var u;return(u=a.error)===null||u===void 0?void 0:u.data}):(i=t?.error)===null||i===void 0?void 0:i.data),this.statusCode=o,this.request=n;let s;"error"in t?s=t.error:t instanceof Array&&(s=t.filter(a=>a.error).map(a=>a.error)),Array.isArray(s)&&s.length>0?this.cause=new Dr(s):this.cause=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{data:this.data,request:this.request,statusCode:this.statusCode})}},Jt=class extends Qe{constructor(t,r){super(t,void 0,r),this.code=101;let n;"error"in t?n=t.error:t instanceof Array&&(n=t.map(o=>o.error)),Array.isArray(n)?this.cause=new Dr(n):this.cause=n}};var Fi=class extends z{constructor(t,r){super(`Web3Config hardfork doesnt match in defaultHardfork ${t} and common.hardfork ${r}`),this.code=1101}},Ui=class extends z{constructor(t,r){super(`Web3Config chain doesnt match in defaultHardfork ${t} and common.hardfork ${r}`),this.code=1101}};var Yu="An Rpc error has occured with a code of *code*",Ke={[-32700]:{message:"Parse error",description:"Invalid JSON"},[-32600]:{message:"Invalid request",description:"JSON is not a valid request object "},[-32601]:{message:"Method not found",description:"Method does not exist "},[-32602]:{message:"Invalid params",description:"Invalid method parameters"},[-32603]:{message:"Internal error",description:"Internal JSON-RPC error"},[-32e3]:{message:"Invalid input",description:"Missing or invalid parameters"},[-32001]:{message:"Resource not found",description:"Requested resource not found"},[-32002]:{message:"Resource unavailable",description:"Requested resource not available"},[-32003]:{message:"Transaction rejected",description:"Transaction creation failed"},[-32004]:{message:"Method not supported",description:"Method is not implemented"},[-32005]:{message:"Limit exceeded",description:"Request exceeds defined limit"},[-32006]:{message:"JSON-RPC version not supported",description:"Version of JSON-RPC protocol is not supported"},4001:{name:"User Rejected Request",message:"The user rejected the request."},4100:{name:"Unauthorized",message:"The requested method and/or account has not been authorized by the user."},4200:{name:"Unsupported Method",message:"The Provider does not support the requested method."},4900:{name:"Disconnected",message:"The Provider is disconnected from all chains."},4901:{name:"Chain Disconnected",message:"The Provider is not connected to the requested chain."},"0-999":{name:"",message:"Not used."},1e3:{name:"Normal Closure",message:"The connection successfully completed the purpose for which it was created."},1001:{name:"Going Away",message:"The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."},1002:{name:"Protocol error",message:"The endpoint is terminating the connection due to a protocol error."},1003:{name:"Unsupported Data",message:"The connection is being terminated because the endpoint received data of a type it cannot accept. (For example, a text-only endpoint received binary data.)"},1004:{name:"Reserved",message:"Reserved. A meaning might be defined in the future."},1005:{name:"No Status Rcvd",message:"Reserved. Indicates that no status code was provided even though one was expected."},1006:{name:"Abnormal Closure",message:"Reserved. Indicates that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."},1007:{name:"Invalid frame payload data",message:"The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."},1008:{name:"Policy Violation",message:"The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."},1009:{name:"Message Too Big",message:"The endpoint is terminating the connection because a data frame was received that is too large."},1010:{name:"Mandatory Ext.",message:"The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."},1011:{name:"Internal Error",message:"The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."},1012:{name:"Service Restart",message:"The server is terminating the connection because it is restarting."},1013:{name:"Try Again Later",message:"The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."},1014:{name:"Bad Gateway",message:"The server was acting as a gateway or proxy and received an invali
6d response from the upstream server. This is similar to 502 HTTP Status Code."},1015:{name:"TLS handshake",message:"Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."},"1016-2999":{name:"",message:"For definition by future revisions of the WebSocket Protocol specification, and for definition by extension specifications."},"3000-3999":{name:"",message:"For use by libraries, frameworks, and applications. These status codes are registered directly with IANA. The interpretation of these codes is undefined by the WebSocket protocol."},"4000-4999":{name:"",message:"For private use, and thus can't be registered. Such codes can be used by prior agreements between WebSocket applications. The interpretation of these codes is undefined by the WebSocket protocol."}};var et=class extends z{constructor(t,r){super(r??Yu.replace("*code*",t.error.code.toString())),this.code=t.error.code,this.id=t.id,this.jsonrpc=t.jsonrpc,this.jsonRpcError=t.error}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{error:this.jsonRpcError,id:this.id,jsonRpc:this.jsonrpc})}},Xa=class extends z{constructor(t,r){var n,o,i,s;if(!t)super();else if(!((n=Ke[t])===null||n===void 0)&&n.message)super(Ke[t].message);else{let a=Object.keys(Ke).find(u=>typeof u=="string"&&t>=parseInt(u.split("-")[0],10)&&t<=parseInt(u.split("-")[1],10));super((i=(o=Ke[a??""])===null||o===void 0?void 0:o.message)!==null&&i!==void 0?i:Yu.replace("*code*",(s=t?.toString())!==null&&s!==void 0?s:'""'))}this.code=t,this.data=r}},Qu=class extends et{constructor(t){super(t,Ke[-32700].message),this.code=-32700}},ed=class extends et{constructor(t){super(t,Ke[-32600].message),this.code=-32600}},td=class extends et{constructor(t){super(t,Ke[-32601].message),this.code=-32601}},rd=class extends et{constructor(t){super(t,Ke[-32602].message),this.code=-32602}},nd=class extends et{constructor(t){super(t,Ke[-32603].message),this.code=-32603}},od=class extends et{constructor(t){super(t,Ke[-32e3].message),this.code=-32e3}},id=class extends et{constructor(t){super(t,Ke[-32004].message),this.code=-32004}},sd=class extends et{constructor(t){super(t,Ke[-32002].message),this.code=-32002}},ad=class extends et{constructor(t){super(t,Ke[-32001].message),this.code=-32001}},cd=class extends et{constructor(t){super(t,Ke[-32006].message),this.code=-32006}},ud=class extends et{constructor(t){super(t,Ke[-32003].message),this.code=-32003}},dd=class extends et{constructor(t){super(t,Ke[-32005].message),this.code=-32005}}
6,Ze=new Map;Ze.set(-32700,{error:Qu});Ze.set(-32600,{error:ed});Ze.set(-32601,{error:td});Ze.set(-32602,{error:rd});Ze.set(-32603,{error:nd});Ze.set(-32e3,{error:od});Ze.set(-32004,{error:id});Ze.set(-32002,{error:sd});Ze.set(-32003,{error:ud});Ze.set(-32001,{error:ad});Ze.set(-32006,{error:cd});Ze.set(-32005,{error:dd});var Ja=class extends z{constructor(t){super(`Format for the type ${t} is unsupported`),this.type=t,this.code=1200}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type})}};var _s={};fr(_s,{ChunkResponseParser:()=>bs,Eip1193Provider:()=>Yr,EventEmitter:()=>Sn,SocketProvider:()=>Bo,Web3DeferredPromise:()=>Jr,asciiToHex:()=>fp,bytesToHex:()=>Y,bytesToUint8Array:()=>st,checkAddressCheckSum:()=>l_,compareBlockNumbers:()=>v_,convert:()=>Cc,convertScalarValue:()=>ps,encodePacked:()=>Jd,ethUnitMap:()=>ls,format:()=>M,fromAscii:()=>a_,fromDecimal:()=>o_,fromTwosComplement:()=>b_,fromUtf8:()=>Bc,fromWei:()=>u_,getStorageSlotNumForLongString:()=>R_,hexToAscii:()=>lp,hexToBytes:()=>me,hexToNumber:()=>Kr,hexToNumberString:()=>up,hexToString:()=>s_,hexToUtf8:()=>hs,isAddress:()=>pp,isBatchRequest:()=>$c,isBatchResponse:()=>vs,isBloom:()=>h_,isContractAddressInBloom:()=>g_,isContractInitOptions:()=>Gt,isDataFormat:()=>qt,isHex:()=>f_,isHexStrict:()=>hp,isInBloom:()=>p_,isNullish:()=>V,isPromise:()=>Yd,isResponseRpcError:()=>Fc,isResponseWithError:()=>xs,isResponseWithNotification:()=>Uc,isResponseWithResult:()=>ys,isSubscriptionResult:()=>Tp,isTopic:()=>y_,isTopicInBloom:()=>x_,isUint8Array:()=>ft,isUserEthereumAddressInBloom:()=>m_,isValidResponse:()=>ef,jsonRpc:()=>Re,keccak256:()=>rr,keccak256Wrapper:()=>rr,leftPad:()=>Xr,mergeDeep:()=>kt,numberToHex:()=>Ie,padLeft:()=>Zr,padRight:()=>gp,pollTillDefined:()=>k_,pollTillDefinedAndReturnIntervalId:()=>Lc,processSolidityEncodePackedArgs:()=>_p,randomBytes:()=>kn,randomHex:()=>S_,rejectIfConditionAtInterval:()=>Qd,rejectIfTimeout:()=>ms,rightPad:()=>Oc,setRequestIdStart:()=>Ap,sha3:()=>ko,sha3Raw:()=>$e,soliditySha3:()=>A_,soliditySha3Raw:()=>I_,stringToHex:()=>i_,toAscii:()=>c_,toBatchPayload:()=>Ip,toBigInt:()=>tr,toBool:()=>Kd,toChecksumAddress:()=>Ve,toDecimal:()=>n_,toHex:()=>rt,toNumber:()=>We,toPayload:()=>Po,toTwosComplement:()=>Zd,toUtf8:()=>dp,toWei:()=>d_,uint8ArrayConcat:()=>Ce,uint8ArrayEquals:()=>Rn,utf8ToBytes:()=>Nc,utf8ToHex:()=>at,uuidV4:()=>gs,validateResponse:()=>Hc,waitWithTimeout:()=>Ep});function lo(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function lv(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function hv(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function ho(e,...t){if(!hv(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function pv(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");lo(e.outputLen),lo(e.blockLen)}function Ya(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function fd(e,t){ho(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var mv={number:lo,bool:lv,bytes:ho,hash:pv,exists:Ya,output:fd},Qa=mv;var ec=BigInt(4294967295),rh=BigInt(32);function gv(e,t=!1){return t?{h:Number(e&ec),l:Number(e>>rh&ec)}:{h:Number(e>>rh&ec)|0,l:Number(e&ec)|0}}function nh(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){let{h:i,l:s}=gv(e[o],t);[r[o],n[o]]=[i,s]}return[r,n]}var oh=(e,t,r)=>e<<r|t>>>32-r,ih=(e,t,r)=>t<<r|e>>>32-r,sh=(e,t,r)=>t<<r-32|e>>>64-r,ah=(e,t,r)=>e<<r-32|t>>>64-r;var tc=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var ch=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));var ld=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,yv=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;function hd(e){for(let t=0;t<e.length;t++)e[t]=yv(e[t])}function Gr(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function nc(e){return typeof e=="string"&&(e=Gr(e)),ho(e),e}var rc=class{clone(){return this._cloneInto()}},QR={}.toString;function uh(e){let t=n=>e().update(nc(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function dh(e){let t=(n,o)=>e(o).update(nc(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}function fh(e=32){if(tc&&typeof tc.getRandomValues=="function")return tc.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}var ph=[],mh=[],gh=[],xv=BigInt(0),Qi=BigInt(1),vv=BigInt(2),bv=BigInt(7),_v=BigInt(256),wv=BigInt(113);for(let e=0,t=Qi,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],ph.push(2*(5*n+r)),mh.push((e+1)*(e+2)/2%64);let o=xv;for(let i=0;i<7;i++)t=(t<<Qi^(t>>bv)*wv)%_v,t&vv&&(o^=Qi<<(Qi<<BigInt(i))-Qi);gh.push(o)}var[Ev,Tv]=nh(gh,!0),lh=(e,t,r)=>r>32?sh(e,t,r):oh(e,t,r),hh=(e,t,r)=>r>32?ah(e,t,r):ih(e,t,r);function Av(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,u=(s+2)%10,d=r[u],c=r[u+1],f=lh(d,c,1)^r[a],_=hh(d,c,1)^r[a+1];for(let w=0;w<50;w+=10)e[s+w]^=f,e[s+w+1]^=_}let o=e[2],i=e[3];for(let s=0;s<24;s++){let a=mh[s],u=lh(o,i,a),d=hh(o,i,a),c=ph[s];o=e[c],i=e[c+1],e[c]=u,e[c+1]=d}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)r[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=Ev[n],e[1]^=Tv[n]}r.fill(0)}var oc=class e extends rc{constructor(t,r,n,o=!1,i=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,lo(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ch(this.state)}keccak(){ld||hd(this.state32),Av(this.state32,this.rounds),ld||hd(this.state32),this.posOut=0,this.pos=0}update(t){Ya(this);let{blockLen:r,state:n}=this;t=nc(t);let o=t.length;for(let i=0;i<o;){let s=Math.min(r-this.pos,o-i);for(let a=0;a<s;a++)n[this.pos++]^=t[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:o}=this;t[n]^=r,(r&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Ya(this,!1),ho(t),this.finish();let r=this.state,{blockLen:n}=this;for(let o=0,i=t.length;o<i;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,i-o);t.set(r.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return lo(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(fd(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:r,suffix:n,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new e(r,n,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}},qr=(e,t,r)=>uh(()=>new oc(t,e,r)),iS=qr(6,144,224/8),sS=qr(6,136,256/8),aS=qr(6,104,384/8),cS=qr(6,72,512/8),yh=qr(1,144,224/8),pd=qr(1,136,256/8),xh=qr(1,104,384/8),vh=qr(1,72,512/8),bh=(e,t,r)=>dh((n={})=>new oc(t,e,n.dkLen===void 0?r:n.dkLen,!0)),uS=bh(31,168,128/8),dS=bh(31,136,256/8);var mS=Qa.bool,gS=Qa.bytes;function md(e){if(!(e instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof e}`);return new TextDecoder().decode(e)}function es(e){return t=>(Qa.bytes(t),e(t))}var yS=(()=>{let e=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,t=typeof module<"u"&&typeof module.require=="function"&&module.require.bind(module);return{node:t&&!e?t("crypto"):void 0,web:e}})();var wS=es(yh),ic=(()=>{let e=es(pd);return e.create=pd.create,e})(),ES=es(xh),TS=es(vh);var gt={};fr(gt,{BRAND:()=>Yv,DIRTY:()=>wn,EMPTY_PATH:()=>Pv,INVALID:()=>te,NEVER:()=>Lb,OK:()=>tt,ParseStatus:()=>Xe,Schema:()=>fe,ZodAny:()=>cc,ZodArray:()=>ns,ZodBigInt:()=>vd,ZodBoolean:()=>bd,ZodBranded:()=>os,ZodCatch:()=>Pd,ZodDate:()=>_d,ZodDefault:()=>kd,ZodDiscriminatedUnion:()=>uc,ZodEffects:()=>vo,ZodEnum:()=>hc,ZodError:()=>Qt,ZodFirstPartyTypeKind:()=>ne,ZodFunction:()=>fc,ZodIntersection:()=>Ad,ZodIssueCode:()=>D,ZodLazy:()=>Id,ZodLiteral:()=>
6Rd,ZodMap:()=>Ph,ZodNaN:()=>Oh,ZodNativeEnum:()=>Sd,ZodNever:()=>En,ZodNull:()=>Ed,ZodNullable:()=>bo,ZodNumber:()=>xd,ZodObject:()=>yo,ZodOptional:()=>Vr,ZodParsedType:()=>G,ZodPipeline:()=>is,ZodPromise:()=>pc,ZodReadonly:()=>Bd,ZodRecord:()=>dc,ZodSchema:()=>fe,ZodSet:()=>Bh,ZodString:()=>lc,ZodSymbol:()=>Sh,ZodTransformer:()=>vo,ZodTuple:()=>xo,ZodType:()=>fe,ZodUndefined:()=>wd,ZodUnion:()=>Td,ZodUnknown:()=>rs,ZodVoid:()=>kh,addIssueToContext:()=>j,any:()=>ab,array:()=>fb,bigint:()=>rb,boolean:()=>Dh,coerce:()=>Mb,custom:()=>Ch,date:()=>nb,datetimeRegex:()=>Rh,defaultErrorMap:()=>pr,discriminatedUnion:()=>mb,effect:()=>Rb,enum:()=>Tb,function:()=>_b,getErrorMap:()=>po,getParsedType:()=>Yt,instanceof:()=>eb,intersection:()=>gb,isAborted:()=>sc,isAsync:()=>mo,isDirty:()=>ac,isValid:()=>Wr,late:()=>Qv,lazy:()=>wb,literal:()=>Eb,makeIssue:()=>ts,map:()=>vb,nan:()=>tb,nativeEnum:()=>Ab,never:()=>ub,null:()=>sb,nullable:()=>kb,number:()=>Lh,object:()=>lb,objectUtil:()=>_h,oboolean:()=>Cb,onumber:()=>Ob,optional:()=>Sb,ostring:()=>Nb,pipeline:()=>Bb,preprocess:()=>Pb,promise:()=>Ib,quotelessJson:()=>Rv,record:()=>xb,set:()=>bb,setErrorMap:()=>kv,strictObject:()=>hb,string:()=>Mh,symbol:()=>ob,transformer:()=>Rb,tuple:()=>yb,undefined:()=>ib,union:()=>pb,unknown:()=>cb,util:()=>le,void:()=>db});var le;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(le||(le={}));var _h=(function(e){return e.mergeShapes=(t,r)=>B(B({},t),r),e})(_h||{}),G=le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yt=e=>{switch(typeof e){case"undefined":return G.undefined;case"string":return G.string;case"number":return Number.isNaN(e)?G.nan:G.number;case"boolean":return G.boolean;case"function":return G.function;case"bigint":return G.bigint;case"symbol":return G.symbol;case"object":return Array.isArray(e)?G.array:e===null?G.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?G.promise:typeof Map<"u"&&e instanceof Map?G.map:typeof Set<"u"&&e instanceof Set?G.set:typeof Date<"u"&&e instanceof Date?G.date:G.object;default:return G.unknown}};
6var D=le.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Rv=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Qt=(()=>{class e extends Error{get errors(){return this.issues}constructor(r){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=r}format(r){let n=r||function(s){return s.message},o={_errors:[]},i=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)o._errors.push(n(a));else{let u=o,d=0;for(;d<a.path.length;){let c=a.path[d];d===a.path.length-1?(u[c]=u[c]||{_errors:[]},u[c]._errors.push(n(a))):u[c]=u[c]||{_errors:[]},u=u[c],d++}}};return i(this),o}static assert(r){if(!(r instanceof e))throw new Error(`Not a ZodError: ${r}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(r=n=>n.message){let n={},o=[];for(let i of this.issues)if(i.path.length>0){let s=i.path[0];n[s]=n[s]||[],n[s].push(r(i))}else o.push(r(i));return{formErrors:o,fieldErrors:n}}get formErrors(){return this.flatten()}}return e.create=t=>new e(t),e})();var Sv=(e,t)=>{let r;switch(e.code){case D.invalid_type:e.received===G.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case D.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,le.jsonStringifyReplacer)}`;break;case D.unrecognized_keys:r=`Unrecognized key(s) in object: ${le.joinValues(e.keys,", ")}`;break;case D.invalid_union:r="Invalid input";break;case D.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${le.joinValues(e.options)}`;break;case D.invalid_enum_value:r=`Invalid enum value. Expected ${le.joinValues(e.options)}, received '${e.received}'`;break;case D.invalid_arguments:r="Invalid function arguments";break;case D.invalid_return_type:r="Invalid function return type";break;case D.invalid_date:r="Invalid date";break;case D.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:le.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case D.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case D.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case D.custom:r="Invalid input";break;case D.invalid_intersection_types:r="Intersection results could not be merged";break;case D.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case D.not_finite:r="Number must be finite";break;default:r=t.defaultError,le.assertNever(e)}return{message:r}},pr=Sv;var wh=pr;function kv(e){wh=e}function po(){return wh}var ts=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s=Z(B({},o),{path:i});if(o.message!==void 0)return Z(B({},o),{path:i,message:o.message});let a="",u=n.filter(d=>!!d).slice().reverse();for(let d of u)a=d(s,{data:t,defaultError:a}).message;return Z(B({},o),{path:i,message:a})},Pv=[];function j(e,t){let r=po(),n=ts({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===pr?void 0:pr].filter(o=>!!o)});e.common.issues.push(n)}var Xe=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return te;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static mergeObjectAsync(t,r){return _e(this,null,function*(){let n=[];for(let o of r){let i=yield o.key,s=yield o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)})}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return te;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},te=Object.freeze({status:"aborted"}),wn=e=>({status:"dirty",value:e}),tt=e=>
6({status:"valid",value:e}),sc=e=>e.status==="aborted",ac=e=>e.status==="dirty",Wr=e=>e.status==="valid",mo=e=>typeof Promise<"u"&&e instanceof Promise;var K=(function(e){return e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message,e})(K||{});var St=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Eh=(e,t)=>{if(Wr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Qt(e.common.issues);return this._error=r,this._error}}};function ue(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:u??r??a.defaultError}},description:o}}var fe=class{get description(){return this._def.description}_getType(t){return Yt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Xe,ctx:{common:t.parent.common,data:t.data,parsedType:Yt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(mo(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Eh(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Wr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Wr(n)?{value:n.value}:{issues:r.common.issues})}parseAsync(t,r){return _e(this,null,function*(){let n=yield this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error})}safeParseAsync(t,r){return _e(this,null,function*(){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=yield mo(o)?o:Promise.resolve(o);return Eh(n,i)})}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue(B({code:D.custom},n(o)));return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new vo({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Vr.create(this,this._def)}nullable(){return bo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ns.create(this)}promise(){return pc.create(this,this._def)}or(t){return Td.create([this,t],this._def)}and(t){return Ad.create(this,t,this._def)}transform(t){return new vo(Z(B({},ue(this._def)),{schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:t}}))}default(t){let r=typeof t=="function"?t:()=>t;return new kd(Z(B({},ue(this._def)),{innerType:this,defaultValue:r,typeName:ne.ZodDefault}))}brand(){return new os(B({typeName:ne.ZodBranded,type:this},ue(this._def)))}catch(t){let r=typeof t=="function"?t:()=>t;return new Pd(Z(B({},ue(this._def)),{innerType:this,catchValue:r,typeName:ne.ZodCatch}))}describe(t){let r=this.constructor;return new r(Z(B({},this._def),{description:t}))}pipe(t){return is.create(this,t)}readonly(){return Bd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Bv=/^c[^\s-]{8,}
6$/i,Nv=/^[0-9a-z]+$/,Ov=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Cv=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Mv=/^[a-z0-9_-]{21}$/i,Lv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Dv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Hv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Fv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",gd,Uv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,$v=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,jv=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Gv=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ah="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Vv=new RegExp(`^${Ah}$`);function Ih(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function zv(e){return new RegExp(`^${Ih(e)}$`)}function Rh(e){let t=`${Ah}T${Ih(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Kv(e,t){return!!((t==="v4"||!t)&&Uv.test(e)||(t==="v6"||!t)&&jv.test(e))}function Zv(e,t){if(!Lv.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function Xv(e,t){return!!((t==="v4"||!t)&&$v.test(e)||(t==="v6"||!t)&&Gv.test(e))}var lc=(()=>{class e extends fe{_parse(r){if(this._def.coerce&&(r.data=String(r.data)),this._getType(r)!==G.string){let s=this._getOrReturnCtx(r);return j(s,{code:D.invalid_type,expected:G.string,received:s.parsedType}),te}let o=new Xe,i;for(let s of this._def.checks)if(s.kind==="min")r.data.length<s.value&&(i=this._getOrReturnCtx(r,i),j(i,{code:D.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if(s.kind==="max")r.data.length>s.value&&(i=this._getOrReturnCtx(r,i),j(i,{code:D.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if(s.kind==="length"){let a=r.data.length>s.value,u=r.data.length<s.value;(a||u)&&(i=this._getOrReturnCtx(r,i),a?j(i,{code:D.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):u&&j(i,{code:D.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),o.dirty())}else if(s.kind==="email")Hv.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"email",code:D.invalid_string,message:s.message}),o.dirty());else if(s.kind==="emoji")gd||(gd=new RegExp(Fv,"u")),gd.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"emoji",code:D.invalid_string,message:s.message}),o.dirty());else if(s.kind==="uuid")Cv.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"uuid",code:D.invalid_string,message:s.message}),o.dirty());else if(s.kind==="nanoid")Mv.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"nanoid",code:D.invalid_string,message:s.message}),o.dirty());else if(s.kind==="cuid")Bv.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"cuid",code:D.invalid_string,message:s.message}),o.dirty());else if(s.kind==="cuid2")Nv.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"cuid2",code:D.invalid_string,message:s.message}),o.dirty());else if(s.kind==="ulid")Ov.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"ulid",code:D.invalid_string,message:s.message}),o.dirty());else if(s.kind==="url")try{new URL(r.data)}catch{i=this._getOrReturnCtx(r,i),j(i,{validation:"url",code:D.invalid_string,message:s.message}),o.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"regex",code:D.invalid_string,message:s.message}),o.dirty())):s.kind==="trim"?r.data=r.data.trim():s.kind==="includes"?r.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(r,i),j(i,{code:D.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),o.dirty()):s.kind==="toLowerCase"?r.data=r.data.toLowerCase():s.kind==="toUpperCase"?r.data=r.data.toUpperCase():s.kind==="startsWith"?r.data.startsWith(s.value)||(i=this._getOrReturnCtx(r,i),j(i,{code:D.invalid_string,validation:{startsWith:s.value},message:s.message}),o.dirty()):s.kind==="endsWith"?r.data.endsWith(s.value)||(i=this._getOrReturnCtx(r,i),j(i,{code:D.invalid_string,validation:{endsWith:s.value},message:s.message}),o.dirty()):s.kind==="datetime"?Rh(s).test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{code:D.invalid_string,validation:"datetime",message:s.message}),o.dirty()):s.kind==="date"?Vv.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{code:D.invalid_string,validation:"date",message:s.message}),o.dirty()):s.kind==="time"?zv(s).test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{code:D.invalid_string,validation:"time",message:s.message}),o.dirty()):s.kind==="duration"?Dv.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"duration",code:D.invalid_string,message:s.message}),o.dirty()):s.kind==="ip"?Kv(r.data,s.version)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"ip",code:D.invalid_string,message:s.message}),o.dirty()):s.kind==="jwt"?Zv(r.data,s.alg)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"jwt",code:D.invalid_string,message:s.message}),o.dirty()):s.kind==="cidr"?Xv(r.data,s.version)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"cidr",code:D.invalid_string,message:s.message}),o.dirty()):s.kind==="base64"?qv.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"base64",code:D.invalid_string,message:s.message}),o.dirty()):s.kind==="base64url"?Wv.test(r.data)||(i=this._getOrReturnCtx(r,i),j(i,{validation:"base64url",code:D.invalid_string,message:s.message}),o.dirty()):le.assertNever(s);return{status:o.value,value:r.data}}_regex(r,n,o){return this.refinement(i=>r.test(i),B({validation:n,code:D.invalid_string},K.errToObj(o)))}_addCheck(r){return new e(Z(B({},this._def),{checks:[...this._def.checks,r]}))}email(r){return this._addCheck(B({kind:"email"},K.errToObj(r)))}url(r){return this._addCheck(B({kind:"url"},K.errToObj(r)))}emoji(r){return this._addCheck(B({kind:"emoji"},K.errToObj(r)))}uuid(r){return this._addCheck(B({kind:"uuid"},K.errToObj(r)))}nanoid(r){return this._addCheck(B({kind:"nanoid"},K.errToObj(r)))}cuid(r){return this._addCheck(B({kind:"cuid"},K.errToObj(r)))}cuid2(r){return this._addCheck(B({kind:"cuid2"},K.errToObj(r)))}ulid(r){return this._addCheck(B({kind:"ulid"},K.errToObj(r)))}base64(r){return this._addCheck(B({kind:"base64"},K.errToObj(r)))}base64url(r){return this._addCheck(B({kind:"base64url"},K.errToObj(r)))}jwt(r){return this._addCheck(B({kind:"jwt"},K.errToObj(r)))}ip(r){return this._addCheck(B({kind:"ip"},K.errToObj(r)))}cidr(r){return this._addCheck(B({kind:"cidr"},K.errToObj(r)))}datetime(r){return typeof r=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:r}):this._addCheck(B({kind:"datetime",precision:typeof r?.precision>"u"?null:r?.precision,offset:r?.offset??!1,local:r?.local??!1},K.errToObj(r?.message)))}date(r){return this._addCheck({kind:"date",message:r})}time(r){return typeof r=="string"?this._addCheck({kind:"time",precision:null,message:r}):this._addCheck(B({kind:"time",precision:typeof r?.precision>"u"?null:r?.precision},K.errToObj(r?.message)))}duration(r){return this._addCheck(B({kind:"duration"},K.errToObj(r)))}regex(r,n){return this._addCheck(B({kind:"regex",regex:r},K.errToObj(n)))}includes(r,n){return this._addCheck(B({kind:"includes",value:r,position:n?.position},K.errToObj(n?.message)))}startsWith(r,n){return this._addCheck(B({kind:"startsWith",value:r},K.errToObj(n)))}endsWith(r,n){return this._addCheck(B({kind:"endsWith",value:r},K.errToObj(n)))}min(r,n){return this._addCheck(B({kind:"min",value:r},K.errToObj(n)))}max(r,n){return this._addCheck(B({kind:"max",value:r},K.errToObj(n)))}length(r,n){return this._addCheck(B({kind:"length",value:r},K.errToObj(n)))}nonempty(r){return this.min(1,K.errToObj(r))}trim(){return new e(Z(B({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new e(Z(B({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new e(Z(B({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(r=>r.kind==="datetime")}
6get isDate(){return!!this._def.checks.find(r=>r.kind==="date")}get isTime(){return!!this._def.checks.find(r=>r.kind==="time")}get isDuration(){return!!this._def.checks.find(r=>r.kind==="duration")}get isEmail(){return!!this._def.checks.find(r=>r.kind==="email")}get isURL(){return!!this._def.checks.find(r=>r.kind==="url")}get isEmoji(){return!!this._def.checks.find(r=>r.kind==="emoji")}get isUUID(){return!!this._def.checks.find(r=>r.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(r=>r.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(r=>r.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(r=>r.kind==="cuid2")}get isULID(){return!!this._def.checks.find(r=>r.kind==="ulid")}get isIP(){return!!this._def.checks.find(r=>r.kind==="ip")}get isCIDR(){return!!this._def.checks.find(r=>r.kind==="cidr")}get isBase64(){return!!this._def.checks.find(r=>r.kind==="base64")}get isBase64url(){return!!this._def.checks.find(r=>r.kind==="base64url")}get minLength(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r}get maxLength(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r}}return e.create=t=>new e(B({checks:[],typeName:ne.ZodString,coerce:t?.coerce??!1},ue(t))),e})();function Jv(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var xd=(()=>{class e extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(r){if(this._def.coerce&&(r.data=Number(r.data)),this._getType(r)!==G.number){let s=this._getOrReturnCtx(r);return j(s,{code:D.invalid_type,expected:G.number,received:s.parsedType}),te}let o,i=new Xe;for(let s of this._def.checks)s.kind==="int"?le.isInteger(r.data)||(o=this._getOrReturnCtx(r,o),j(o,{code:D.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?r.data<s.value:r.data<=s.value)&&(o=this._getOrReturnCtx(r,o),j(o,{code:D.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?r.data>s.value:r.data>=s.value)&&(o=this._getOrReturnCtx(r,o),j(o,{code:D.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?Jv(r.data,s.value)!==0&&(o=this._getOrReturnCtx(r,o),j(o,{code:D.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(r.data)||(o=this._getOrReturnCtx(r,o),j(o,{code:D.not_finite,message:s.message}),i.dirty()):le.assertNever(s);return{status:i.value,value:r.data}}gte(r,n){return this.setLimit("min",r,!0,K.toString(n))}gt(r,n){return this.setLimit("min",r,!1,K.toString(n))}lte(r,n){return this.setLimit("max",r,!0,K.toString(n))}lt(r,n){return this.setLimit("max",r,!1,K.toString(n))}setLimit(r,n,o,i){return new e(Z(B({},this._def),{checks:[...this._def.checks,{kind:r,value:n,inclusive:o,message:K.toString(i)}]}))}_addCheck(r){return new e(Z(B({},this._def),{checks:[...this._def.checks,r]}))}int(r){return this._addCheck({kind:"int",message:K.toString(r)})}positive(r){return this._addCheck({kind:"min",value:0,inclusive:!1,message:K.toString(r)})}negative(r){return this._addCheck({kind:"max",value:0,inclusive:!1,message:K.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:0,inclusive:!0,message:K.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:0,inclusive:!0,message:K.toString(r)})}multipleOf(r,n){return this._addCheck({kind:"multipleOf",value:r,message:K.toString(n)})}finite(r){return this._addCheck({kind:"finite",message:K.toString(r)})}safe(r){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:K.toString(r)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:K.toString(r)})}get minValue(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r}get maxValue(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r}get isInt(){return!!this._def.checks.find(r=>r.kind==="int"||r.kind==="multipleOf"&&le.isInteger(r.value))}get isFinite(){let r=null,n=null;for(let o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(n===null||o.value>n)&&(n=o.value):o.kind==="max"&&(r===null||o.value<r)&&(r=o.value)}return Number.isFinite(n)&&Number.isFinite(r)}}return e.create=t=>new e(B({checks:[],typeName:ne.ZodNumber,coerce:t?.coerce||!1},ue(t))),e})(),vd=(()=>{class e extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(r){if(this._def.coerce)try{r.data=BigInt(r.data)}catch{return this._getInvalidInput(r)}if(this._getType(r)!==G.bigint)return this._getInvalidInput(r);let o,i=new Xe;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?r.data<s.value:r.data<=s.value)&&(o=this._getOrReturnCtx(r,o),j(o,{code:D.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?r.data>s.value:r.data>=s.value)&&(o=this._getOrReturnCtx(r,o),j(o,{code:D.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?r.data%s.value!==BigInt(0)&&(o=this._getOrReturnCtx(r,o),j(o,{code:D.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):le.assertNever(s);return{status:i.value,value:r.data}}_getInvalidInput(r){let n=this._getOrReturnCtx(r);return j(n,{code:D.invalid_type,expected:G.bigint,received:n.parsedType}),te}gte(r,n){return this.setLimit("min",r,!0,K.toString(n))}gt(r,n){return this.setLimit("min",r,!1,K.toString(n))}
6lte(r,n){return this.setLimit("max",r,!0,K.toString(n))}lt(r,n){return this.setLimit("max",r,!1,K.toString(n))}setLimit(r,n,o,i){return new e(Z(B({},this._def),{checks:[...this._def.checks,{kind:r,value:n,inclusive:o,message:K.toString(i)}]}))}_addCheck(r){return new e(Z(B({},this._def),{checks:[...this._def.checks,r]}))}positive(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:K.toString(r)})}negative(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:K.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:K.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:K.toString(r)})}multipleOf(r,n){return this._addCheck({kind:"multipleOf",value:r,message:K.toString(n)})}get minValue(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r}get maxValue(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r}}return e.create=t=>new e(B({checks:[],typeName:ne.ZodBigInt,coerce:t?.coerce??!1},ue(t))),e})(),bd=(()=>{class e extends fe{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==G.boolean){let o=this._getOrReturnCtx(r);return j(o,{code:D.invalid_type,expected:G.boolean,received:o.parsedType}),te}return tt(r.data)}}return e.create=t=>new e(B({typeName:ne.ZodBoolean,coerce:t?.coerce||!1},ue(t))),e})(),_d=(()=>{class e extends fe{_parse(r){if(this._def.coerce&&(r.data=new Date(r.data)),this._getType(r)!==G.date){let s=this._getOrReturnCtx(r);return j(s,{code:D.invalid_type,expected:G.date,received:s.parsedType}),te}if(Number.isNaN(r.data.getTime())){let s=this._getOrReturnCtx(r);return j(s,{code:D.invalid_date}),te}let o=new Xe,i;for(let s of this._def.checks)s.kind==="min"?r.data.getTime()<s.value&&(i=this._getOrReturnCtx(r,i),j(i,{code:D.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),o.dirty()):s.kind==="max"?r.data.getTime()>s.value&&(i=this._getOrReturnCtx(r,i),j(i,{code:D.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),o.dirty()):le.assertNever(s);return{status:o.value,value:new Date(r.data.getTime())}}_addCheck(r){return new e(Z(B({},this._def),{checks:[...this._def.checks,r]}))}min(r,n){return this._addCheck({kind:"min",value:r.getTime(),message:K.toString(n)})}max(r,n){return this._addCheck({kind:"max",value:r.getTime(),message:K.toString(n)})}get minDate(){let r=null;for(let n of this._def.checks)n.kind==="min"&&(r===null||n.value>r)&&(r=n.value);return r!=null?new Date(r):null}get maxDate(){let r=null;for(let n of this._def.checks)n.kind==="max"&&(r===null||n.value<r)&&(r=n.value);return r!=null?new Date(r):null}}return e.create=t=>new e(B({checks:[],coerce:t?.coerce||!1,typeName:ne.ZodDate},ue(t))),e})(),Sh=(()=>{class e extends fe{_parse(r){if(this._getType(r)!==G.symbol){let o=this._getOrReturnCtx(r);return j(o,{code:D.invalid_type,expected:G.symbol,received:o.parsedType}),te}return tt(r.data)}}return e.create=t=>new e(B({typeName:ne.ZodSymbol},ue(t))),e})(),wd=(()=>{class e extends fe{_parse(r){if(this._getType(r)!==G.undefined){let o=this._getOrReturnCtx(r);return j(o,{code:D.invalid_type,expected:G.undefined,received:o.parsedType}),te}return tt(r.data)}}return e.create=t=>new e(B({typeName:ne.ZodUndefined},ue(t))),e})(),Ed=(()=>{class e extends fe{_parse(r){if(this._getType(r)!==G.null){let o=this._getOrReturnCtx(r);return j(o,{code:D.invalid_type,expected:G.null,received:o.parsedType}),te}return tt(r.data)}}return e.create=t=>new e(B({typeName:ne.ZodNull},ue(t))),e})(),cc=(()=>{class e extends fe{constructor(){super(...arguments),this._any=!0}_parse(r){return tt(r.data)}}return e.create=t=>new e(B({typeName:ne.ZodAny},ue(t))),e})(),rs=(()=>{class e extends fe{constructor(){super(...arguments),this._unknown=!0}_parse(r){return tt(r.data)}}return e.create=t=>new e(B({typeName:ne.ZodUnknown},ue(t))),e})(),En=(()=>{class e extends fe{_parse(r){let n=this._getOrReturnCtx(r);return j(n,{code:D.invalid_type,expected:G.never,received:n.parsedType}),te}}return e.create=t=>new e(B({typeName:ne.ZodNever},ue(t))),e})(),kh=(()=>{class e extends fe{_parse(r){if(this._getType(r)!==G.undefined){let o=this._getOrReturnCtx(r);
6return j(o,{code:D.invalid_type,expected:G.void,received:o.parsedType}),te}return tt(r.data)}}return e.create=t=>new e(B({typeName:ne.ZodVoid},ue(t))),e})(),ns=(()=>{class e extends fe{_parse(r){let{ctx:n,status:o}=this._processInputParams(r),i=this._def;if(n.parsedType!==G.array)return j(n,{code:D.invalid_type,expected:G.array,received:n.parsedType}),te;if(i.exactLength!==null){let a=n.data.length>i.exactLength.value,u=n.data.length<i.exactLength.value;(a||u)&&(j(n,{code:a?D.too_big:D.too_small,minimum:u?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),o.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(j(n,{code:D.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),o.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(j(n,{code:D.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),o.dirty()),n.common.async)return Promise.all([...n.data].map((a,u)=>i.type._parseAsync(new St(n,a,n.path,u)))).then(a=>Xe.mergeArray(o,a));let s=[...n.data].map((a,u)=>i.type._parseSync(new St(n,a,n.path,u)));return Xe.mergeArray(o,s)}get element(){return this._def.type}min(r,n){return new e(Z(B({},this._def),{minLength:{value:r,message:K.toString(n)}}))}max(r,n){return new e(Z(B({},this._def),{maxLength:{value:r,message:K.toString(n)}}))}length(r,n){return new e(Z(B({},this._def),{exactLength:{value:r,message:K.toString(n)}}))}nonempty(r){return this.min(1,r)}}return e.create=(t,r)=>new e(B({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray},ue(r))),e})();function go(e){if(e instanceof yo){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Vr.create(go(n))}return new yo(Z(B({},e._def),{shape:()=>t}))}else return e instanceof ns?new ns(Z(B({},e._def),{type:go(e.element)})):e instanceof Vr?Vr.create(go(e.unwrap())):e instanceof bo?bo.create(go(e.unwrap())):e instanceof xo?xo.create(e.items.map(t=>go(t))):e}var yo=(()=>{class e extends fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let r=this._def.shape(),n=le.objectKeys(r);return this._cached={shape:r,keys:n},this._cached}_parse(r){if(this._getType(r)!==G.object){let c=this._getOrReturnCtx(r);return j(c,{code:D.invalid_type,expected:G.object,received:c.parsedType}),te}let{status:o,ctx:i}=this._processInputParams(r),{shape:s,keys:a}=this._getCached(),u=[];if(!(this._def.catchall instanceof En&&this._def.unknownKeys==="strip"))for(let c in i.data)a.includes(c)||u.push(c);let d=[];for(let c of a){let f=s[c],_=i.data[c];d.push({key:{status:"valid",value:c},value:f._parse(new St(i,_,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof En){let c=this._def.unknownKeys;if(c==="passthrough")for(let f of u)d.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(c==="strict")u.length>0&&(j(i,{code:D.unrecognized_keys,keys:u}),o.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let f of u){let _=i.data[f];d.push({key:{status:"valid",value:f},value:c._parse(new St(i,_,i.path,f)),alwaysSet:f in i.data})}}return i.common.async?Promise.resolve().then(()=>_e(this,null,function*(){let c=[];for(let f of d){let _=yield f.key,w=yield f.value;c.push({key:_,value:w,alwaysSet:f.alwaysSet})}return c})).then(c=>Xe.mergeObjectSync(o,c)):Xe.mergeObjectSync(o,d)}get shape(){return this._def.shape()}strict(r){return K.errToObj,new e(B(Z(B({},this._def),{unknownKeys:"strict"}),r!==void 0?{errorMap:(n,o)=>{let i=this._def.errorMap?.(n,o).message??o.defaultError;return n.code==="unrecognized_keys"?{message:K.errToObj(r).message??i}:{message:i}}}:{}))}strip(){return new e(Z(B({},this._def),{unknownKeys:"strip"}))}passthrough(){return new e(Z(B({},this._def),{unknownKeys:"passthrough"}))}extend(r){return new e(Z(B({},this._def),{shape:()=>B(B({},this._def.shape()),r)}))}merge(r){return new e({unknownKeys:r._def.unknownKeys,catchall:r._def.catchall,shape:()=>B(B({},this._def.shape()),r._def.shape()),typeName:ne.ZodObject})}setKey(r,n){return this.augment({[r]:n})}catchall(r){return new e(Z(B({},this._def),{catchall:r}))}pick(r){let n={};for(let o of le.objectKeys(r))r[o]&&this.shape[o]&&(n[o]=this.shape[o]);return new e(Z(B({},this._def),{shape:()=>n}))}omit(r){let n={};
6for(let o of le.objectKeys(this.shape))r[o]||(n[o]=this.shape[o]);return new e(Z(B({},this._def),{shape:()=>n}))}deepPartial(){return go(this)}partial(r){let n={};for(let o of le.objectKeys(this.shape)){let i=this.shape[o];r&&!r[o]?n[o]=i:n[o]=i.optional()}return new e(Z(B({},this._def),{shape:()=>n}))}required(r){let n={};for(let o of le.objectKeys(this.shape))if(r&&!r[o])n[o]=this.shape[o];else{let s=this.shape[o];for(;s instanceof Vr;)s=s._def.innerType;n[o]=s}return new e(Z(B({},this._def),{shape:()=>n}))}keyof(){return Nh(le.objectKeys(this.shape))}}return e.create=(t,r)=>new e(B({shape:()=>t,unknownKeys:"strip",catchall:En.create(),typeName:ne.ZodObject},ue(r))),e.strictCreate=(t,r)=>new e(B({shape:()=>t,unknownKeys:"strict",catchall:En.create(),typeName:ne.ZodObject},ue(r))),e.lazycreate=(t,r)=>new e(B({shape:t,unknownKeys:"strip",catchall:En.create(),typeName:ne.ZodObject},ue(r))),e})(),Td=(()=>{class e extends fe{_parse(r){let{ctx:n}=this._processInputParams(r),o=this._def.options;function i(s){for(let u of s)if(u.result.status==="valid")return u.result;for(let u of s)if(u.result.status==="dirty")return n.common.issues.push(...u.ctx.common.issues),u.result;let a=s.map(u=>new Qt(u.ctx.common.issues));return j(n,{code:D.invalid_union,unionErrors:a}),te}if(n.common.async)return Promise.all(o.map(s=>_e(this,null,function*(){let a=Z(B({},n),{common:Z(B({},n.common),{issues:[]}),parent:null});return{result:yield s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}}))).then(i);{let s,a=[];for(let d of o){let c=Z(B({},n),{common:Z(B({},n.common),{issues:[]}),parent:null}),f=d._parseSync({data:n.data,path:n.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let u=a.map(d=>new Qt(d));return j(n,{code:D.invalid_union,unionErrors:u}),te}}get options(){return this._def.options}}return e.create=(t,r)=>new e(B({options:t,typeName:ne.ZodUnion},ue(r))),e})(),mr=e=>e instanceof Id?mr(e.schema):e instanceof vo?mr(e.innerType()):e instanceof Rd?[e.value]:e instanceof hc?e.options:e instanceof Sd?le.objectValues(e.enum):e instanceof kd?mr(e._def.innerType):e instanceof wd?[void 0]:e instanceof Ed?[null]:e instanceof Vr?[void 0,...mr(e.unwrap())]:e instanceof bo?[null,...mr(e.unwrap())]:e instanceof os||e instanceof Bd?mr(e.unwrap()):e instanceof Pd?mr(e._def.innerType):[],uc=class e extends fe{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==G.object)return j(r,{code:D.invalid_type,expected:G.object,received:r.parsedType}),te;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(j(r,{code:D.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),te)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=mr(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e(B({typeName:ne.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o},ue(n)))}};function yd(e,t){let r=Yt(e),n=Yt(t);if(e===t)return{valid:!0,data:e};if(r===G.object&&n===G.object){let o=le.objectKeys(t),i=le.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s=B(B({},e),t);for(let a of i){let u=yd(e[a],t[a]);if(!u.valid)return{valid:!1};s[a]=u.data}return{valid:!0,data:s}}else if(r===G.array&&n===G.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],u=yd(s,a);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===G.date&&n===G.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ad=(()=>{class e extends fe{_parse(r){let{status:n,ctx:o}=this._processInputParams(r),i=(s,a)=>
6{if(sc(s)||sc(a))return te;let u=yd(s.value,a.value);return u.valid?((ac(s)||ac(a))&&n.dirty(),{status:n.value,value:u.data}):(j(o,{code:D.invalid_intersection_types}),te)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}}return e.create=(t,r,n)=>new e(B({left:t,right:r,typeName:ne.ZodIntersection},ue(n))),e})(),xo=(()=>{class e extends fe{_parse(r){let{status:n,ctx:o}=this._processInputParams(r);if(o.parsedType!==G.array)return j(o,{code:D.invalid_type,expected:G.array,received:o.parsedType}),te;if(o.data.length<this._def.items.length)return j(o,{code:D.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),te;!this._def.rest&&o.data.length>this._def.items.length&&(j(o,{code:D.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...o.data].map((a,u)=>{let d=this._def.items[u]||this._def.rest;return d?d._parse(new St(o,a,o.path,u)):null}).filter(a=>!!a);return o.common.async?Promise.all(s).then(a=>Xe.mergeArray(n,a)):Xe.mergeArray(n,s)}get items(){return this._def.items}rest(r){return new e(Z(B({},this._def),{rest:r}))}}return e.create=(t,r)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new e(B({items:t,typeName:ne.ZodTuple,rest:null},ue(r)))},e})(),dc=class e extends fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==G.object)return j(n,{code:D.invalid_type,expected:G.object,received:n.parsedType}),te;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new St(n,a,n.path,a)),value:s._parse(new St(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Xe.mergeObjectAsync(r,o):Xe.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof fe?new e(B({keyType:t,valueType:r,typeName:ne.ZodRecord},ue(n))):new e(B({keyType:lc.create(),valueType:t,typeName:ne.ZodRecord},ue(r)))}},Ph=(()=>{class e extends fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){let{status:n,ctx:o}=this._processInputParams(r);if(o.parsedType!==G.map)return j(o,{code:D.invalid_type,expected:G.map,received:o.parsedType}),te;let i=this._def.keyType,s=this._def.valueType,a=[...o.data.entries()].map(([u,d],c)=>({key:i._parse(new St(o,u,o.path,[c,"key"])),value:s._parse(new St(o,d,o.path,[c,"value"]))}));if(o.common.async){let u=new Map;return Promise.resolve().then(()=>_e(this,null,function*(){for(let d of a){let c=yield d.key,f=yield d.value;if(c.status==="aborted"||f.status==="aborted")return te;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),u.set(c.value,f.value)}return{status:n.value,value:u}}))}else{let u=new Map;for(let d of a){let c=d.key,f=d.value;if(c.status==="aborted"||f.status==="aborted")return te;(c.status==="dirty"||f.status==="dirty")&&n.dirty(),u.set(c.value,f.value)}return{status:n.value,value:u}}}}return e.create=(t,r,n)=>new e(B({valueType:r,keyType:t,typeName:ne.ZodMap},ue(n))),e})(),Bh=(()=>{class e extends fe{_parse(r){let{status:n,ctx:o}=this._processInputParams(r);if(o.parsedType!==G.set)return j(o,{code:D.invalid_type,expected:G.set,received:o.parsedType}),te;let i=this._def;i.minSize!==null&&o.data.size<i.minSize.value&&(j(o,{code:D.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&o.data.size>i.maxSize.value&&(j(o,{code:D.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let s=this._def.valueType;function a(d){let c=new Set;for(let f of d){if(f.status==="aborted")return te;f.status==="dirty"&&n.dirty(),c.add(f.value)}return{status:n.value,value:c}}
6let u=[...o.data.values()].map((d,c)=>s._parse(new St(o,d,o.path,c)));return o.common.async?Promise.all(u).then(d=>a(d)):a(u)}min(r,n){return new e(Z(B({},this._def),{minSize:{value:r,message:K.toString(n)}}))}max(r,n){return new e(Z(B({},this._def),{maxSize:{value:r,message:K.toString(n)}}))}size(r,n){return this.min(r,n).max(r,n)}nonempty(r){return this.min(1,r)}}return e.create=(t,r)=>new e(B({valueType:t,minSize:null,maxSize:null,typeName:ne.ZodSet},ue(r))),e})(),fc=class e extends fe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==G.function)return j(r,{code:D.invalid_type,expected:G.function,received:r.parsedType}),te;function n(a,u){return ts({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,po(),pr].filter(d=>!!d),issueData:{code:D.invalid_arguments,argumentsError:u}})}function o(a,u){return ts({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,po(),pr].filter(d=>!!d),issueData:{code:D.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof pc){let a=this;return tt(function(...u){return _e(this,null,function*(){let d=new Qt([]),c=yield a._def.args.parseAsync(u,i).catch(w=>{throw d.addIssue(n(u,w)),d}),f=yield Reflect.apply(s,this,c);return yield a._def.returns._def.type.parseAsync(f,i).catch(w=>{throw d.addIssue(o(f,w)),d})})})}else{let a=this;return tt(function(...u){let d=a._def.args.safeParse(u,i);if(!d.success)throw new Qt([n(u,d.error)]);let c=Reflect.apply(s,this,d.data),f=a._def.returns.safeParse(c,i);if(!f.success)throw new Qt([o(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e(Z(B({},this._def),{args:xo.create(t).rest(rs.create())}))}returns(t){return new e(Z(B({},this._def),{returns:t}))}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e(B({args:t||xo.create([]).rest(rs.create()),returns:r||rs.create(),typeName:ne.ZodFunction},ue(n)))}},Id=(()=>{class e extends fe{get schema(){return this._def.getter()}_parse(r){let{ctx:n}=this._processInputParams(r);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}return e.create=(t,r)=>new e(B({getter:t,typeName:ne.ZodLazy},ue(r))),e})(),Rd=(()=>{class e extends fe{_parse(r){if(r.data!==this._def.value){let n=this._getOrReturnCtx(r);return j(n,{received:n.data,code:D.invalid_literal,expected:this._def.value}),te}return{status:"valid",value:r.data}}get value(){return this._def.value}}return e.create=(t,r)=>new e(B({value:t,typeName:ne.ZodLiteral},ue(r))),e})();function Nh(e,t){return new hc(B({values:e,typeName:ne.ZodEnum},ue(t)))}var hc=(()=>{class e extends fe{_parse(r){if(typeof r.data!="string"){let n=this._getOrReturnCtx(r),o=this._def.values;return j(n,{expected:le.joinValues(o),received:n.parsedType,code:D.invalid_type}),te}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(r.data)){let n=this._getOrReturnCtx(r),o=this._def.values;return j(n,{received:n.data,code:D.invalid_enum_value,options:o}),te}return tt(r.data)}get options(){return this._def.values}get enum(){let r={};for(let n of this._def.values)r[n]=n;return r}get Values(){let r={};for(let n of this._def.values)r[n]=n;return r}get Enum(){let r={};for(let n of this._def.values)r[n]=n;return r}extract(r,n=this._def){return e.create(r,B(B({},this._def),n))}exclude(r,n=this._def){return e.create(this.options.filter(o=>!r.includes(o)),B(B({},this._def),n))}}return e.create=Nh,e})(),Sd=(()=>{class e extends fe{_parse(r){let n=le.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(r);if(o.parsedType!==G.string&&o.parsedType!==G.number){let i=le.objectValues(n);return j(o,{expected:le.joinValues(i),received:o.parsedType,code:D.invalid_type}),te}if(this._cache||(this._cache=new Set(le.getValidEnumValues(this._def.values))),!this._cache.has(r.data)){let i=le.objectValues(n);return j(o,{received:o.data,code:D.invalid_enum_value,options:i}),te}return tt(r.data)}get enum(){return this._def.values}}return e.create=(t,r)=>new e(B({values:t,typeName:ne.ZodNativeEnum},ue(r))),e})(),pc=(()=>{class e extends fe{unwrap(){return this._def.type}_parse(r){let{ctx:n}=this._processInputParams(r);if(n.parsedType!==G.promise&&n.common.async===!1)return j(n,{code:D.invalid_type,expected:G.promise,received:n.parsedType}),te;
6let o=n.parsedType===G.promise?n.data:Promise.resolve(n.data);return tt(o.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}return e.create=(t,r)=>new e(B({type:t,typeName:ne.ZodPromise},ue(r))),e})(),vo=(()=>{class e extends fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){let{status:n,ctx:o}=this._processInputParams(r),i=this._def.effect||null,s={addIssue:a=>{j(o,a),a.fatal?n.abort():n.dirty()},get path(){return o.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){let a=i.transform(o.data,s);if(o.common.async)return Promise.resolve(a).then(u=>_e(this,null,function*(){if(n.value==="aborted")return te;let d=yield this._def.schema._parseAsync({data:u,path:o.path,parent:o});return d.status==="aborted"?te:d.status==="dirty"?wn(d.value):n.value==="dirty"?wn(d.value):d}));{if(n.value==="aborted")return te;let u=this._def.schema._parseSync({data:a,path:o.path,parent:o});return u.status==="aborted"?te:u.status==="dirty"?wn(u.value):n.value==="dirty"?wn(u.value):u}}if(i.type==="refinement"){let a=u=>{let d=i.refinement(u,s);if(o.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(o.common.async===!1){let u=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return u.status==="aborted"?te:(u.status==="dirty"&&n.dirty(),a(u.value),{status:n.value,value:u.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(u=>u.status==="aborted"?te:(u.status==="dirty"&&n.dirty(),a(u.value).then(()=>({status:n.value,value:u.value}))))}if(i.type==="transform")if(o.common.async===!1){let a=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!Wr(a))return te;let u=i.transform(a.value,s);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:u}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(a=>Wr(a)?Promise.resolve(i.transform(a.value,s)).then(u=>({status:n.value,value:u})):te);le.assertNever(i)}}return e.create=(t,r,n)=>new e(B({schema:t,typeName:ne.ZodEffects,effect:r},ue(n))),e.createWithPreprocess=(t,r,n)=>new e(B({schema:r,effect:{type:"preprocess",transform:t},typeName:ne.ZodEffects},ue(n))),e})();var Vr=(()=>{class e extends fe{_parse(r){return this._getType(r)===G.undefined?tt(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}return e.create=(t,r)=>new e(B({innerType:t,typeName:ne.ZodOptional},ue(r))),e})(),bo=(()=>{class e extends fe{_parse(r){return this._getType(r)===G.null?tt(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}return e.create=(t,r)=>new e(B({innerType:t,typeName:ne.ZodNullable},ue(r))),e})(),kd=(()=>{class e extends fe{_parse(r){let{ctx:n}=this._processInputParams(r),o=n.data;return n.parsedType===G.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}return e.create=(t,r)=>new e(B({innerType:t,typeName:ne.ZodDefault,defaultValue:typeof r.default=="function"?r.default:()=>r.default},ue(r))),e})(),Pd=(()=>{class e extends fe{_parse(r){let{ctx:n}=this._processInputParams(r),o=Z(B({},n),{common:Z(B({},n.common),{issues:[]})}),i=this._def.innerType._parse({data:o.data,path:o.path,parent:B({},o)});return mo(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Qt(o.common.issues)},input:o.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Qt(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}return e.create=(t,r)=>new e(B({innerType:t,typeName:ne.ZodCatch,catchValue:typeof r.catch=="function"?r.catch:()=>r.catch},ue(r))),e})(),Oh=(()=>{class e extends fe{_parse(r){if(this._getType(r)!==G.nan){let o=this._getOrReturnCtx(r);
6return j(o,{code:D.invalid_type,expected:G.nan,received:o.parsedType}),te}return{status:"valid",value:r.data}}}return e.create=t=>new e(B({typeName:ne.ZodNaN},ue(t))),e})(),Yv=Symbol("zod_brand"),os=class extends fe{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},is=class e extends fe{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return _e(this,null,function*(){let i=yield this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?te:i.status==="dirty"?(r.dirty(),wn(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})});{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?te:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:ne.ZodPipeline})}},Bd=(()=>{class e extends fe{_parse(r){let n=this._def.innerType._parse(r),o=i=>(Wr(i)&&(i.value=Object.freeze(i.value)),i);return mo(n)?n.then(i=>o(i)):o(n)}unwrap(){return this._def.innerType}}return e.create=(t,r)=>new e(B({innerType:t,typeName:ne.ZodReadonly},ue(r))),e})();function Th(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Ch(e,t={},r){return e?cc.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Th(t,n),u=a.fatal??r??!0;o.addIssue(Z(B({code:"custom"},a),{fatal:u}))}});if(!i){let s=Th(t,n),a=s.fatal??r??!0;o.addIssue(Z(B({code:"custom"},s),{fatal:a}))}}):cc.create()}var Qv={object:yo.lazycreate},ne=(function(e){return e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly",e})(ne||{});var eb=(e,t={message:`Input not instance of ${e.name}`})=>Ch(r=>r instanceof e,t),Mh=lc.create,Lh=xd.create,tb=Oh.create,rb=vd.create,Dh=bd.create,nb=_d.create,ob=Sh.create,ib=wd.create,sb=Ed.create,ab=cc.create,cb=rs.create,ub=En.create,db=kh.create,fb=ns.create,lb=yo.create,hb=yo.strictCreate,pb=Td.create,mb=uc.create,gb=Ad.create,yb=xo.create,xb=dc.create,vb=Ph.create,bb=Bh.create,_b=fc.create,wb=Id.create,Eb=Rd.create,Tb=hc.create,Ab=Sd.create,Ib=pc.create,Rb=vo.create,Sb=Vr.create,kb=bo.create,Pb=vo.createWithPreprocess,Bb=is.create,Nb=()=>Mh().optional(),Ob=()=>Lh().optional(),Cb=()=>Dh().optional(),Mb={string:e=>lc.create(Z(B({},e),{coerce:!0})),number:e=>xd.create(Z(B({},e),{coerce:!0})),boolean:e=>bd.create(Z(B({},e),{coerce:!0})),bigint:e=>vd.create(Z(B({},e),{coerce:!0})),date:e=>_d.create(Z(B({},e),{coerce:!0}))};var Lb=te;var Hb=e=>e.message?e.message:"unspecified error",yt=class extends z{constructor(t){super(),this.code=1100,this.errors=t,super.message=`Web3 validator found ${t.length} error[s]: 7${this._compileErrors().join(` 8`)}`}_compileErrors(){return this.errors.map(Hb)}};function _o(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function Fb(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function Ub(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function wo(e,...t){if(!Ub(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function $b(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");_o(e.outputLen),_o(e.blockLen)}function mc(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Nd(e,t){wo(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var jb={number:_o,bool:Fb,bytes:wo,hash:$b,exists:mc,output:Nd},gc=jb;var yc=BigInt(4294967295),Hh=BigInt(32);function Gb(e,t=!1){return t?{h:Number(e&yc),l:Number(e>>Hh&yc)}:{h:Number(e>>Hh&yc)|0,l:Number(e&yc)|0}}function Fh(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){let{h:i,l:s}=Gb(e[o],t);[r[o],n[o]]=[i,s]}return[r,n]}var Uh=(e,t,r)=>e<<r|t>>>32-r,$h=(e,t,r)=>t<<r|e>>>32-r,jh=(e,t,r)=>t<<r-32|e>>>64-r,Gh=(e,t,r)=>e<<r-32|t>>>64-r;var qh=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));var Od=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,qb=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;function Cd(e){for(let t=0;t<e.length;t++)e[t]=qb(e[t])}function vc(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function bc(e){return typeof e=="string"&&(e=vc(e)),wo(e),e}var xc=class{clone(){return this._cloneInto()}},s2={}.toString;function Wh(e){let t=n=>e().update(bc(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Vh(e){let t=(n,o)=>e(o).update(bc(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}var Zh=[],Xh=[],Jh=[],Wb=BigInt(0),ss=BigInt(1),Vb=BigInt(2),zb=BigInt(7),Kb=BigInt(256),Zb=BigInt(113);for(let e=0,t=ss,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Zh.push(2*(5*n+r)),Xh.push((e+1)*(e+2)/2%64);let o=Wb;for(let i=0;i<7;i++)t=(t<<ss^(t>>zb)*Zb)%Kb,t&Vb&&(o^=ss<<(ss<<BigInt(i))-ss);Jh.push(o)}var[Xb,Jb]=Fh(Jh,!0),zh=(e,t,r)=>r>32?jh(e,t,r):Uh(e,t,r),Kh=(e,t,r)=>r>32?Gh(e,t,r):$h(e,t,r);function Yb(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,u=(s+2)%10,d=r[u],c=r[u+1],f=zh(d,c,1)^r[a],_=Kh(d,c,1)^r[a+1];for(let w=0;w<50;w+=10)e[s+w]^=f,e[s+w+1]^=_}let o=e[2],i=e[3];for(let s=0;s<24;s++){let a=Xh[s],u=zh(o,i,a),d=Kh(o,i,a),c=Zh[s];o=e[c],i=e[c+1],e[c]=u,e[c+1]=d}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)r[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=Xb[n],e[1]^=Jb[n]}r.fill(0)}var _c=class e extends xc{constructor(t,r,n,o=!1,i=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,_o(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=qh(this.state)}keccak(){Od||Cd(this.state32),Yb(this.state32,this.rounds),Od||Cd(this.state32),this.posOut=0,this.pos=0}update(t){mc(this);let{blockLen:r,state:n}=this;t=bc(t);let o=t.length;for(let i=0;i<o;){let s=Math.min(r-this.pos,o-i);for(let a=0;a<s;a++)n[this.pos++]^=t[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:o}=this;t[n]^=r,(r&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){mc(this,!1),wo(t),this.finish();let r=this.state,{blockLen:n}=this;for(let o=0,i=t.length;o<i;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,i-o);t.set(r.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return _o(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Nd(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:r,suffix:n,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new e(r,n,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}},zr=(e,t,r)=>Wh(()=>new _c(t,e,r)),l2=zr(6,144,224/8),h2=zr(6,136,256/8),p2=zr(6,104,384/8),m2=zr(6,72,512/8),Yh=zr(1,144,224/8),Md=zr(1,136,256/8),Qh=zr(1,104,384/8),ep=zr(1,72,512/8),tp=(e,t,r)=>Vh((n={})=>new _c(t,e,n.dkLen===void 0?r:n.dkLen,!0)),g2=tp(31,168,128/8),y2=tp(31,136,256/8);var w2=gc.bool,E2=gc.bytes;function as(e){return t=>(gc.bytes(t),e(t))}var T2=(()=>{let e=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,t=typeof module<"u"&&typeof module.require=="function"&&module.require.bind(module);return{node:t&&!e?t("crypto"):void 0,web:e}})();var k2=as(Yh),wc=(()=>{let e=as(Md);return e.create=Md.create,e})(),P2=as(Qh),B2=as(ep);var be={};fr(be,{abiSchemaToJsonSchema:()=>Ic,codePointToInt:()=>Ud,ensureIfUint8Array:()=>Gd,ethAbiToJsonSchema:()=>Hd,fetchArrayElement:()=>Fd,hexToNumber:()=>Rc,hexToUint8Array:()=>cs,numberToHex:()=>$d,padLeft:()=>jd,parseBaseType:()=>er,transformJsonDataToAbiFormat:()=>Ac,uint8ArrayToHexString:()=>Ao});var rp=["bool","int","uint","bytes","string","address","tuple"];var Ld=e=>typeof e=="object"&&"type"in e&&"name"in e;var Eo=e=>typeof e=="string",oe=e=>
8typeof e=="string"&&/^((-)?0x[0-9a-f]+|(0x))$/i.test(e);function Ec(e,t){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||typeof t<"u"&&t>0&&e.length!==2+2*t)}var Tn=e=>typeof e=="number"||typeof e=="bigint"||typeof e=="string"&&/^((-0x|0x|-)?[0-9a-f]+|(0x))$/i.test(e);function Tc(e){if(typeof e!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof e}`);return e.startsWith("0x")}var To=function(e){for(let[t,r]of Object.entries(e))if(r!==void 0&&r.length>0&&r[0]===0)throw new Error(`${t} cannot have leading zeroes, received: ${r.toString()}`)};var e_=["hex","number","blockNumber","blockNumberOrTag","filter","bloom"],er=e=>{let t=e.replace(/ /,""),r,n=!1,o=[];if(e.includes("[")&&(t=t.slice(0,t.indexOf("[")),o=[...e.matchAll(/(?:\[(\d*)\])/g)].map(i=>parseInt(i[1],10)).map(i=>Number.isNaN(i)?-1:i),n=o.length>0),rp.includes(t))return{baseType:t,isArray:n,baseTypeSize:r,arraySizes:o};if(t.startsWith("int"))r=parseInt(t.substring(3),10),t="int";else if(t.startsWith("uint"))r=parseInt(e.substring(4),10),t="uint";else if(t.startsWith("bytes"))r=parseInt(t.substring(5),10),t="bytes";else return{baseType:void 0,isArray:!1,baseTypeSize:void 0,arraySizes:o};return{baseType:t,isArray:n,baseTypeSize:r,arraySizes:o}},Dd=(e,t={})=>{if(Object.keys(t).includes("type"))throw new yt([{keyword:"eth",message:'Either "eth" or "type" can be presented in schema',params:{eth:e},instancePath:"",schemaPath:""}]);let{baseType:n,baseTypeSize:o}=er(e);if(!n&&!e_.includes(e))throw new yt([{keyword:"eth",message:`Eth data type "${e}" is not valid`,params:{eth:e},instancePath:"",schemaPath:""}]);if(n){if(n==="tuple")throw new Error('"tuple" type is not implemented directly.');return{format:`${n}${o??""}`,required:!0}}return e?{format:e,required:!0}:{}},Ic=(e,t="/0")=>{let r={type:"array",items:[],maxItems:e.length,minItems:e.length};for(let[n,o]of e.entries()){let i,s,a=[];Ld(o)?(i=o.type,s=o.name||`${t}/${n}`,a=o.components):typeof o=="string"?(i=o,s=`${t}/${n}`):Array.isArray(o)&&(o[0]&&typeof o[0]=="string"&&o[0].startsWith("tuple")&&!Array.isArray(o[0])&&o[1]&&Array.isArray(o[1])?(i=o[0],s=`${t}/${n}`,a=o[1]):(i="tuple",s=`${t}/${n}`,a=o));let{baseType:u,isArray:d,arraySizes:c}=er(i),f,_=r;for(let w=c.length-1;w>0;w-=1)f={type:"array",$id:s,items:[],maxItems:c[w],minItems:c[w]},c[w]<0&&(delete f.maxItems,delete f.minItems),Array.isArray(_.items)?_.items.length===0?_.items=[f]:_.items.push(f):_.items=[_.items,f],_=f;if(u==="tuple"&&!d){let w=Ic(a,s);w.$id=s,_.items.push(w)}else if(u==="tuple"&&d){let w=c[0],k=Object.assign({type:"array",$id:s,items:Ic(a,s)},w>=0&&{minItems:w,maxItems:w});_.items.push(k)}else if(d){let w=c[0],k=Object.assign({type:"array",$id:s,items:Dd(i)},w>=0&&{minItems:w,maxItems:w});_.items.push(k)}else Array.isArray(_.items)?_.items.push(Object.assign({$id:s},Dd(i))):_.items.push(Object.assign({$id:s},Dd(i)));_=r}return r},Hd=e=>Ic(e),Fd=(e,t)=>t===1?e:Fd(e[0],t-1),Ac=(e,t,r)=>{let n=[];for(let[o,i]of e.entries()){let s,a,u=[];Ld(i)?(s=i.type,a=i.name,u=i.components):typeof i=="string"?s=i:Array.isArray(i)&&(i[1]&&Array.isArray(i[1])?(s=i[0],u=i[1]):(s="tuple",u=i));let{baseType:d,isArray:c,arraySizes:f}=er(s),_=Array.isArray(t)?t[o]:t[a];if(d==="tuple"&&!c)n.push(Ac(u,_,r));else if(d==="tuple"&&c){let w=[];for(let k of _)if(f.length>1){let T=Fd(k,f.length-1),R=[];for(let P of T)R.push(Ac(u,P,r));w.push(R)}else w.push(Ac(u,k,r));n.push(w)}else n.push(_)}return r=r??[],r.push(...n),r},Ud=e=>{if(e>=48&&e<=57)return e-48;if(e>=65&&e<=70)return e-55;if(e>=97&&e<=102)return e-87;throw new Error(`Invalid code point: ${e}`)},Rc=e=>{if(!oe(e))throw new Error("Invalid hex string");let[t,r]=e.startsWith("-")?[!0,e.slice(1)]:[!1,e],n=BigInt(r);return n>Number.MAX_SAFE_INTEGER?t?-n:n:n<Number.MIN_SAFE_INTEGER?n:t?-1*Number(n):Number(n)},$d=e=>{if((typeof e=="number"||typeof e=="bigint")&&e<0)return`-0x${e.toString(16).slice(1)}`;if((typeof e=="number"||typeof e=="bigint")&&e>=0)return`0x${e.toString(16)}`;if(typeof e=="string"&&oe(e)){let[t,r]=e.startsWith("-")?[!0,e.slice(1)]:[!1,e],n=r.split(/^(-)?0(x|X)/).slice(-1)[0];return`${t?"-":""}0x${n.replace(/^0+/,"").toLowerCase()}`}if(typeof e=="string"&&!oe(e))return $d(BigInt(e));throw new $r(e)},jd=(e,t,r="0")=>{if(typeof e=="string"&&!oe(e))return e.padStart(t,r);let n=typeof e=="string"&&oe(e)?e:$d(e),[o,i]=n.startsWith("-")?["-0x",n.slice(3)]:["0x",n.slice(2)];return`${o}${i.padStart(t,r)}`};function Ao(e){let t="0x";for(let r of e){let n=r.toString(16);t+=n.length===1?`0${n}`:n}return t}var gr={zero:48,nine:57,A:65,F:70,a:97,f:102};function np(e){if(e>=gr.zero&&e<=gr.nine)return e-gr.zero;if(e>=gr.A&&e<=gr.F)return e-(gr.A-10);if(e>=gr.a&&e<=gr.f)return e-(gr.a-10)}function cs(e){let t=0;if(e.startsWith("0")&&(e[1]==="x"||e[1]==="X")&&(t=2),e.length%2!==0)throw new $t(`hex string has odd length: ${e}`);let r=(e.length-t)/2,n=new Uint8Array(r);for(let o=0,i=t;o<r;o+=1){let s=np(e.charCodeAt(i++)),a=np(e.charCodeAt(i++));if(s===void 0||a===void 0)throw new $t(`Invalid byte sequence ("${e[i-2]}${e[i-1]}" in "${e}").`);n[o]=s*16+a}return n}function Gd(e){var t;return!(e instanceof Uint8Array)&&((t=e?.constructor)===null||t===void 0?void 0:t.name)==="Uint8Array"?Uint8Array.from(e):e}var Sc=e=>{var t,r;return e instanceof Uint8Array||((t=e?.constructor)===null||t===void 0?void 0:t.name)==="Uint8Array"||((r=e?.constructor)===null||r===void 0?void 0:r.name)==="Buffer"},jt=(e,t={abiType:"bytes"})=>{if(typeof e!="string"&&!Array.isArray(e)&&!Sc(e)||typeof e=="string"&&oe(e)&&e.startsWith("-")||typeof e=="string"&&!oe(e))return!1;let r;if(typeof e=="string"){if(e.length%2!==0)return!1;r=cs(e)}else if(Array.isArray(e)){if(e.some(n=>n<0||n>255||!Number.isInteger(n)))return!1;r=new Uint8Array(e)}else r=e;if(t?.abiType){let{baseTypeSize:n}=er(t.abiType);return n?r.length===n:!0}return t?.size?r.length===t?.size:!0};var qd=e=>{if(!/^(0x)?[0-9a-f]{40}$/i.test(e))return!1;let t=e.slice(2),r=vc(t.toLowerCase()),n=Ao(wc(Gd(r))).slice(2);for(let o=0;o<40;o+=1)if(parseInt(n[o],16)>7&&t[o].toUpperCase()!==t[o]||parseInt(n[o],16)<=7&&t[o].toLowerCase()!==t[o])return!1;return!0},Ne=(e,t=!0)=>
8{if(typeof e!="string"&&!Sc(e))return!1;let r;return Sc(e)?r=Ao(e):typeof e=="string"&&!oe(e)?r=e.toLowerCase().startsWith("0x")?e:`0x${e}`:r=e,/^(0x)?[0-9a-f]{40}$/i.test(r)?/^(0x|0X)?[0-9a-f]{40}$/.test(r)||/^(0x|0X)?[0-9A-F]{40}$/.test(r)?!0:t?qd(r):!0:!1};var yr=(e,t)=>{if(t===BigInt(0))return BigInt(1);let r=e;for(let n=1;n<t;n+=1)r*=e;return r},xt=(e,t={abiType:"uint"})=>{if(!["number","string","bigint"].includes(typeof e)||typeof e=="string"&&e.length===0)return!1;let r;if(t?.abiType){let{baseTypeSize:o}=er(t.abiType);o&&(r=o)}else t.bitSize&&(r=t.bitSize);let n=yr(BigInt(2),BigInt(r??256))-BigInt(1);try{let o=typeof e=="string"&&oe(e)?BigInt(Rc(e)):BigInt(e);return o>=0&&o<=n}catch{return!1}},An=(e,t={abiType:"int"})=>{if(!["number","string","bigint"].includes(typeof e)||typeof e=="number"&&e>Number.MAX_SAFE_INTEGER)return!1;let r;if(t?.abiType){let{baseTypeSize:i,baseType:s}=er(t.abiType);if(s!=="int")return!1;i&&(r=i)}else t.bitSize&&(r=t.bitSize);let n=yr(BigInt(2),BigInt((r??256)-1)),o=BigInt(-1)*yr(BigInt(2),BigInt((r??256)-1));try{let i=typeof e=="string"&&oe(e)?BigInt(Rc(e)):BigInt(e);return i>=o&&i<=n}catch{return!1}},kc=e=>!!(An(e)||typeof e=="string"&&/[0-9.]/.test(e)&&e.indexOf(".")===e.lastIndexOf(".")||typeof e=="number");var Wd=e=>xt(e),Le=e=>Object.values(It).includes(e),us=e=>Le(e)||Wd(e);var xr=e=>typeof e!="string"||!/^(0x)?[0-9a-f]{512}$/i.test(e)?!1:!!(/^(0x)?[0-9a-f]{512}$/.test(e)||/^(0x)?[0-9A-F]{512}$/.test(e)),Io=(e,t)=>{if(typeof t=="string"&&!oe(t)||!xr(e))return!1;let r=typeof t=="string"?cs(t):t,n=Ao(wc(r)).slice(2);for(let o=0;o<12;o+=4){let i=(parseInt(n.slice(o,o+2),16)<<8)+parseInt(n.slice(o+2,o+4),16)&2047,s=Ud(e.charCodeAt(e.length-1-Math.floor(i/4))),a=1<<i%4;if((s&a)!==a)return!1}return!0},op=(e,t)=>{if(!xr(e)||!Ne(t))return!1;let r=jd(t,64);return Io(e,r)},ip=(e,t)=>!xr(e)||!Ne(t)?!1:Io(e,t);var sp=e=>["number","string","boolean"].includes(typeof e)?typeof e=="boolean"?!0:typeof e=="string"&&!oe(e)?e==="1"||e==="0":typeof e=="string"&&oe(e)?e==="0x1"||e==="0x0":e===1||e===0:!1;var S=e=>e==null,In=e=>typeof e=="object"&&!S(e)&&!Array.isArray(e)&&!(e instanceof wi);var Ro=e=>typeof e!="string"||!/^(0x)?[0-9a-f]{64}$/i.test(e)?!1:!!(/^(0x)?[0-9a-f]{64}$/.test(e)||/^(0x)?[0-9A-F]{64}$/.test(e)),ap=(e,t)=>!xr(e)||!Ro(t)?!1:Io(e,t);var cp=e=>{let t=["fromBlock","toBlock","address","topics","blockHash"];if(S(e)||typeof e!="object"||!Object.keys(e).every(r=>t.includes(r))||!S(e.fromBlock)&&!us(e.fromBlock)||!S(e.toBlock)&&!us(e.toBlock))return!1;if(!S(e.address)){if(Array.isArray(e.address)){if(!e.address.every(r=>Ne(r)))return!1}else if(!Ne(e.address))return!1}return!(!S(e.topics)&&!e.topics.every(r=>S(r)?!0:Array.isArray(r)?r.every(n=>Ro(n)):!!Ro(r)))};var So={address:e=>Ne(e),bloom:e=>xr(e),blockNumber:e=>Wd(e),blockTag:e=>Le(e),blockNumberOrTag:e=>us(e),bool:e=>sp(e),bytes:e=>jt(e),filter:e=>cp(e),hex:e=>oe(e),uint:e=>xt(e),int:e=>An(e),number:e=>kc(e),string:e=>Eo(e)};for(let e=8;e<=256;e+=8)So[`int${e}`]=t=>An(t,{bitSize:e}),So[`uint${e}`]=t=>xt(t,{bitSize:e});for(let e=1;e<=32;e+=1)So[`bytes${e}`]=t=>jt(t,{size:e});So.bytes256=So.bytes;var Vd=So;var ds=e=>{if((!e?.type||e?.type==="object")&&e?.properties){let t={};for(let r of Object.keys(e.properties)){let n=ds(e.properties[r]);n&&(t[r]=n)}return Array.isArray(e.required)?gt.object(t).partial().required(e.required.reduce((r,n)=>Object.assign(Object.assign({},r),{[n]:!0}),{})):gt.object(t).partial()}if(e?.type==="array"&&e?.items){if(Array.isArray(e.items)&&e.items.length>1&&e.maxItems!==void 0&&new Set(e.items.map(n=>n.$id)).size===e.items.length){let n=[];for(let o of e.items){let i=ds(o);i&&n.push(i)}return gt.tuple(n)}let t=Array.isArray(e.items)?e.items[0]:e.items,r=gt.array(ds(t));return r=e.minItems!==void 0?r.min(e.minItems):r,r=e.maxItems!==void 0?r.max(e.maxItems):r,r}if(e.oneOf&&Array.isArray(e.oneOf))return gt.union(e.oneOf.map(t=>ds(t)));if(e?.format){if(!Vd[e.format])throw new Ja(e.format);return gt.any().refine(Vd[e.format],t=>({params:{value:t,format:e.format}}))}return e?.type&&e?.type!=="object"&&typeof gt[String(e.type)]=="function"?gt[String(e.type)]():gt.object({data:gt.any()}).partial()},Pc=class e{static factory(){return e.validatorInstance||(e.validatorInstance=new e),e.validatorInstance}validate(t,r,n){var o,i;let a=ds(t).safeParse(r);if(!a.success){let u=this.convertErrors((i=(o=a.error)===null||o===void 0?void 0:o.issues)!==null&&i!==void 0?i:[]);if(u){if(n?.silent)return u;throw new yt(u)}}}convertErrors(t){if(t&&Array.isArray(t)&&t.length>0)return t.map(r=>{var n;let o,i,s,a;a=r.path.join("/");let u=String(r.path[r.path.length-1]),d=r.path.join("/");if(r.code===D.too_big)i="maxItems",a=`${d}/maxItems`,s={limit:r.maximum},o=`must NOT have more than ${r.maximum} items`;else if(r.code===D.too_small)i="minItems",a=`${d}/minItems`,s={limit:r.minimum},o=`must NOT have fewer than ${r.minimum} items`;else if(r.code===D.custom){let{value:c,format:f}=(n=r.params)!==null&&n!==void 0?n:{};typeof c>"u"?o=`value at "/${a}" is required`:o=`value "${typeof c=="object"?JSON.stringify(c):c}" at "/${a}" must pass "${f}" validation`,s={value:c}}return{keyword:i??u,instancePath:d?`/${d}`:"",schemaPath:a?`#${a}`:"#",params:s??{value:r.message},message:o??r.message}})}};
8var fs=class{constructor(){this._validator=Pc.factory()}validateJSONSchema(t,r,n){return this._validator.validate(t,r,n)}validate(t,r,n={silent:!1}){var o,i;let s=Hd(t);if(!(Array.isArray(s.items)&&((o=s.items)===null||o===void 0?void 0:o.length)===0&&r.length===0)){if(Array.isArray(s.items)&&((i=s.items)===null||i===void 0?void 0:i.length)===0&&r.length!==0)throw new yt([{instancePath:"/0",schemaPath:"/",keyword:"required",message:"empty schema against data can not be validated",params:r}]);return this._validator.validate(s,r,n)}}};var W=new fs;function ft(e){var t,r;return e instanceof Uint8Array||((t=e?.constructor)===null||t===void 0?void 0:t.name)==="Uint8Array"||((r=e?.constructor)===null||r===void 0?void 0:r.name)==="Buffer"}function Ce(...e){let t=e.reduce((o,i)=>o+i.length,0),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function Rn(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r+=1)if(e[r]!==t[r])return!1;return!0}var ls={noether:BigInt(0),wei:BigInt(1),kwei:BigInt(1e3),Kwei:BigInt(1e3),babbage:BigInt(1e3),femtoether:BigInt(1e3),mwei:BigInt(1e6),Mwei:BigInt(1e6),lovelace:BigInt(1e6),picoether:BigInt(1e6),gwei:BigInt(1e9),Gwei:BigInt(1e9),shannon:BigInt(1e9),nanoether:BigInt(1e9),nano:BigInt(1e9),szabo:BigInt(1e12),microether:BigInt(1e12),micro:BigInt(1e12),finney:BigInt(1e15),milliether:BigInt(1e15),milli:BigInt(1e15),ether:BigInt("1000000000000000000"),kether:BigInt("1000000000000000000000"),grand:BigInt("1000000000000000000000"),mether:BigInt("1000000000000000000000000"),gether:BigInt("1000000000000000000000000000"),tether:BigInt("1000000000000000000000000000000")},zd="Warning: Using type `number` with values that are large or contain many decimals may cause loss of precision, it is recommended to use type `string` or `BigInt` when using conversion methods",st=e=>{if(W.validate(["bytes"],[e]),ft(e))return e;if(Array.isArray(e))return new Uint8Array(e);if(typeof e=="string")return be.hexToUint8Array(e);throw new $t(e)},{uint8ArrayToHexString:r_}=be,Y=e=>r_(st(e)),me=e=>typeof e=="string"&&e.slice(0,2).toLowerCase()!=="0x"?st(`0x${e}`):st(e),Kr=e=>(W.validate(["hex"],[e]),be.hexToNumber(e)),n_=Kr,Ie=(e,t)=>{typeof e!="bigint"&&W.validate(["int"],[e]);let r=be.numberToHex(e);return t&&(!r.startsWith("-")&&r.length%2===1?r="0x0".concat(r.slice(2)):r.length%2===0&&r.startsWith("-")&&(r="-0x0".concat(r.slice(3)))),r},o_=Ie,up=e=>Kr(e).toString(),at=e=>{W.validate(["string"],[e]);let t=e.replace(/^(?:\u0000)/,"");return t=t.replace(/(?:\u0000)$/,""),Y(new TextEncoder().encode(t))},Bc=at,i_=at,hs=e=>md(me(e)),dp=e=>typeof e=="string"?hs(e):(W.validate(["bytes"],[e]),md(e)),Nc=Gr,s_=hs,fp=e=>{W.validate(["string"],[e]);let t="";for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r).toString(16);t+=n.length%2!==0?`0${n}`:n}return`0x${t}`},a_=fp,lp=e=>new TextDecoder("ascii").decode(me(e)),c_=lp,rt=(e,t)=>{if(typeof e=="string"&&Ne(e))return t?"address":`0x${e.toLowerCase().replace(/^0x/i,"")}`;if(typeof e=="boolean")return t?"bool":e?"0x01":"0x00";if(typeof e=="number")return t?e<0?"int256":"uint256":Ie(e);if(typeof e=="bigint")return t?"bigint":Ie(e);if(ft(e))return t?"bytes":Y(e);if(typeof e=="object"&&e)return t?"string":at(JSON.stringify(e));if(typeof e=="string"){if(e.startsWith("-0x")||e.startsWith("-0X"))return t?"int256":Ie(e);if(oe(e))return t?"bytes":e;if(Tn(e)&&!An(e)&&!xt(e))return t?"bytes":`0x${e}`;if(Tn(e)&&!An(e)&&xt(e))return t?"uint":Ie(e);if(!Number.isFinite(e))return t?"string":at(e)}throw new za(e)},We=e=>{if(typeof e=="number")return e>1e20?(console.warn(zd),BigInt(e)):e;if(typeof e=="bigint")return e>=Number.MIN_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER?Number(e):e;if(typeof e=="string"&&oe(e))return Kr(e);try{return We(BigInt(e))}catch{throw new $r(e)}},tr=e=>{if(typeof e=="number")return BigInt(e);if(typeof e=="bigint")return e;if(typeof e=="string"&&Tn(e))return e.startsWith("-")?-BigInt(e.substring(1)):BigInt(e);throw new $r(e)},u_=(e,t)=>{let r;if(typeof t=="string"){if(r=ls[t],!r)throw new Ci(t)}else{if(t<0||!Number.isInteger(t))throw new Mi(t);r=yr(BigInt(10),BigInt(t))}let n=String(We(e)),o=r.toString().length-1;if(o<=0)return n.toString();let i=n.padStart(o,"0"),s=i.slice(0,-o),a=i.slice(-o).replace(/\.?0+$/,"");return s===""?a?`0.${a}`:"0":a===""?s:`${s}.${a}`.slice(0,s.length+o+1)},d_=(e,t)=>{W.validate(["number"],[e]);let r;if(typeof t=="string"){if(r=ls[t],!r)throw new Ci(t)}
8else{if(t<0||!Number.isInteger(t))throw new Mi(t);r=yr(BigInt(10),BigInt(t))}let n=e;typeof n=="number"&&(n<1e-15&&console.warn(zd),n>1e20?(console.warn(zd),n=BigInt(n)):n=n.toLocaleString("fullwide",{useGrouping:!1,maximumFractionDigits:20}));let[o,i]=String(typeof n=="string"&&!oe(n)?n:We(n)).split(".").concat(""),a=BigInt(`${o}${i}`)*r,u=i.length;return u===0?a.toString():a.toString().slice(0,-u)},Ve=e=>{if(!Ne(e,!1))throw new hr(e);let t=e.toLowerCase().replace(/^0x/i,""),r=be.uint8ArrayToHexString(ic(be.ensureIfUint8Array(Nc(t))));if(S(r)||r==="0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")return"";let n="0x",o=r.replace(/^0x/i,"");for(let i=0;i<t.length;i+=1)parseInt(o[i],16)>7?n+=t[i].toUpperCase():n+=t[i];return n},Kd=e=>{if(typeof e=="boolean")return e;if(typeof e=="number"&&(e===0||e===1)||typeof e=="bigint"&&(e===BigInt(0)||e===BigInt(1)))return!!e;if(typeof e=="string"&&!oe(e)&&(e==="1"||e==="0"||e==="false"||e==="true"))return e==="true"?!0:e==="false"?!1:!!Number(e);if(typeof e=="string"&&oe(e)&&(e==="0x1"||e==="0x0"))return!!We(e);throw new jr(e)};var Sn=class extends Gl{constructor(){super(...arguments),this.maxListeners=Number.MAX_SAFE_INTEGER}setMaxListeners(t){return this.maxListeners=t,this}getMaxListeners(){return this.maxListeners}};var hp=oe,f_=Tn,l_=qd,pp=Ne,h_=xr,p_=Io,m_=op,g_=ip,y_=Ro,x_=ap,v_=(e,t)=>{let r=typeof e=="string"&&Le(e),n=typeof t=="string"&&Le(t);if(e===t||(e==="earliest"||e===0)&&(t==="earliest"||t===0))return 0;if(e==="earliest")return-1;if(t==="earliest")return 1;if(r&&n){let s={[It.EARLIEST]:1,[It.FINALIZED]:2,[It.SAFE]:3,[It.LATEST]:4,[It.PENDING]:5};return s[e]<s[t]?-1:1}if(r&&!n||!r&&n)throw new Za("Cannot compare blocktag with provided non-blocktag input.");let o=BigInt(e),i=BigInt(t);return o<i?-1:o===i?0:1},Gt=e=>typeof e=="object"&&!S(e)&&Object.keys(e).length!==0&&["input","data","from","gas","gasPrice","gasLimit","address","jsonInterface","syncWithContext","dataInputFill"].some(t=>t in e),V=S;var mp=e=>typeof e=="object"&&!S(e)&&!Array.isArray(e)&&!(e instanceof wi),kt=(e,...t)=>{if(!mp(e))return e;let r=Object.assign({},e);for(let n of t)for(let o in n)mp(n[o])?(r[o]||(r[o]={}),r[o]=kt(r[o],n[o])):!S(n[o])&&Object.hasOwnProperty.call(n,o)&&(Array.isArray(n[o])||n[o]instanceof wi?r[o]=n[o].slice(0):r[o]=n[o]);return r};var Zr=(e,t,r="0")=>typeof e=="string"?oe(e)?be.padLeft(e,t,r):e.padStart(t,r):(W.validate(["int"],[e]),be.padLeft(e,t,r)),gp=(e,t,r="0")=>{if(typeof e=="string"&&!oe(e))return e.padEnd(t,r);let n=typeof e=="string"&&oe(e)?e:Ie(e),o=n.startsWith("-")?3:2;return W.validate([n.startsWith("-")?"int":"uint"],[e]),n.padEnd(t+o,r)},Oc=gp,Xr=Zr,Zd=(e,t=64)=>{W.validate(["int"],[e]);let r=We(e);if(r>=0)return Zr(rt(r),t);let n=yr(BigInt(2),BigInt(t*4));if(-r>=n)throw new Li(`value: ${e}, nibbleWidth: ${t}`);let i=BigInt(r)+n;return Zr(Ie(i),t)},b_=(e,t=64)=>{W.validate(["int"],[e]);let r=We(e);if(r<0)return r;let n=Math.ceil(Math.log(Number(r))/Math.log(2));if(n>t*4)throw new Li(`value: "${e}", nibbleWidth: "${t}"`);if(t*4!==n)return r;let o=yr(BigInt(2),BigInt(t)*BigInt(4));return We(BigInt(r)-o)};var{parseBaseType:__}=be,qt=e=>typeof e=="object"&&!S(e)&&"number"in e&&"bytes"in e,w_=(e,t,r=[])=>{let n=Object.assign({},e),o;for(let i of t){if(n.oneOf&&o){let s=o,a=r.find(([u])=>u===s);a&&a[0]===o&&(n=n.oneOf[a[1]])}if(!n.properties&&!n.items)return;n.properties?n=n.properties[i]:n.items&&n.items.properties?n=n.items.properties[i]:n.items&&In(n.items)?n=n.items:n.items&&Array.isArray(n.items)&&(n=n.items[parseInt(i,10)]),n&&i&&(o=i)}return n},ps=(e,t,r)=>{try{let{baseType:n,baseTypeSize:o}=__(t);if(n==="int"||n==="uint")switch(r.number){case it.NUMBER:return Number(tr(e));case it.HEX:return Ie(tr(e));case it.STR:return tr(e).toString();case it.BIGINT:return tr(e);default:throw new bn(`Invalid format: ${String(r.number)}`)}if(n==="bytes"){let i;switch(o?typeof e=="string"?i=Zr(e,o*2):ft(e)&&(i=Ce(new Uint8Array(o-e.length),e)):i=e,r.bytes){case Ut.HEX:return Y(st(i));case Ut.UINT8ARRAY:return st(i);default:throw new bn(`Invalid format: ${String(r.bytes)}`)}}if(n==="string")return String(e)}catch{return e}return e},yp=({value:e,schemaProp:t,schema:r,object:n,key:o,dataPath:i,format:s,oneOfPath:a=[]})=>{var u,d;if(Array.isArray(e)){let c=t;if(t?.oneOf!==void 0&&t.oneOf.forEach((f,_)=>{var w,k;!Array.isArray(t?.items)&&(typeof e[0]=="object"&&((w=f?.items)===null||w===void 0?void 0:w.type)==="object"||typeof e[0]=="string"&&((k=f?.items)===null||k===void 0?void 0:k.type)!=="object")&&(c=f,a.push([o,_]))}),S(c?.items))return delete n[o],i.pop(),!0;if(In(c.items)&&!S(c.items.format)){for(let f=0;f<e.length;f+=1)n[o][f]=ps(e[f],(u=c?.items)===null||u===void 0?void 0:u.format,s);return i.pop(),!0}if(!Array.isArray(c?.items)&&((d=c?.items)===null||d===void 0?void 0:d.type)==="object"){for(let f of e)Cc(f,r,i,s,a);return i.pop(),!0}if(Array.isArray(c?.items)){for(let f=0;f<e.length;f+=1)n[o][f]=ps(e[f],c.items[f].format,s);return i.pop(),!0}}return!1},Cc=(e,t,r,n,o=[])=>{var i;if(!In(e)&&!Array.isArray(e))return ps(e,t?.format,n);let s=e;if(Array.isArray(s)&&t?.type==="array"&&((i=t?.items)===null||i===void 0?void 0:i.type)==="object")yp({value:s,schemaProp:t,schema:t,object:s,key:"",dataPath:r,format:n,oneOfPath:o});else for(let[a,u]of Object.entries(s)){r.push(a);let d=w_(t,r,o);if(S(d)){delete s[a],r.pop();continue}if(In(u)){Cc(u,t,r,n,o),r.pop();continue}if(!yp({value:u,schemaProp:d,schema:t,object:s,key:a,dataPath:r,format:n,oneOfPath:o})){if(d?.format===void 0&&d?.oneOf!==void 0){for(let[c,f]of d.oneOf.entries())if(f?.format!==void 0){d=f;break}}s[a]=ps(u,d.format,n),r.pop()}}return s},M=(e,t,r=Be)=>{let n;In(t)?n=kt({},t):Array.isArray(t)?n=[...t]:n=t;let o=In(e)?e:be.ethAbiToJsonSchema(e);if(!o.properties&&!o.items&&!o.format)throw new bn("Invalid json schema for formatting");return Cc(n,o,[],r)};var bp="0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",rr=e=>{let t;return typeof e=="bigint"||typeof e=="number"?t=Gr(e.toString()):Array.isArray(e)?t=new Uint8Array(e):typeof e=="string"&&!oe(e)?t=Gr(e):t=st(e),Y(ic(be.ensureIfUint8Array(t)))};var ko=e=>{let t;typeof e=="string"?e.startsWith("0x")&&oe(e)?t=me(e):t=Gr(e):t=e;let r=rr(t);return r===bp?void 0:r},$e=e=>{let t=ko(e);return S(t)?bp:t},E_=e=>{if(Array.isArray(e))throw new Error("Autodetection of array types is not supported.");let t,r;if(typeof e=="object"&&("t"in e||"type"in e)&&("v"in e||"value"in e))t="t"in e?e.t:e.type,r="v"in e?e.v:e.value,t=t.toLowerCase()==="bigint"?"int":t;else{if(typeof e=="bigint")return["int",e];t=rt(e,!0),r=rt(e),!t.startsWith("int")&&!t.startsWith("uint")&&(t="bytes")}return(t.startsWith("int")||t.startsWith("uint"))&&typeof r=="string"&&!/^(-)?0x/i.test(r)&&(r=tr(r)),[t,r]},T_=e=>e.startsWith("int[")?`int256${e.slice(3)}`:e==="int"?"int256":e.startsWith("uint[")?`uint256'${e.slice(4)}`:e==="uint"?"uint256":e,Xd=(e,t)=>{let r=/^(\d+).*$/.exec(e.slice(t));return r?parseInt(r[1],10):0},xp=e=>e.toString(2).length,vp=(e,t)=>{let r=t.toString();if(e==="string"){if(typeof t=="string")return at(t);throw new Va(t)}if(e==="bool"||e==="boolean"){if(typeof t=="boolean")return t?"01":"00";throw new jr(t)}if(e==="address"){if(!Ne(r))throw new hr(r);return r}let n=T_(e);
8if(e.startsWith("uint")){let o=Xd(n,4);if(o%8||o<8||o>256)throw new Di(r);let i=We(r);if(xp(i)>o)throw new Hi(r);if(i<BigInt(0))throw new Ka(r);return o?Xr(i.toString(16),o/8*2):i.toString(16)}if(e.startsWith("int")){let o=Xd(n,3);if(o%8||o<8||o>256)throw new Di(e);let i=We(r);if(xp(i)>o)throw new Hi(r);return i<BigInt(0)?Zd(i.toString(),o/8*2):o?Xr(i.toString(16),o/4):i.toString(16)}if(n==="bytes"){if(r.replace(/^0x/i,"").length%2!==0)throw new $t(r);return r}if(e.startsWith("bytes")){if(r.replace(/^0x/i,"").length%2!==0)throw new $t(r);let o=Xd(e,5);if(!o||o<1||o>64||o<r.replace(/^0x/i,"").length/2)throw new $t(r);return Oc(r,o*2)}return""},_p=e=>{let[t,r]=E_(e);return Array.isArray(r)?r.map(i=>vp(t,i).replace("0x","")).join(""):vp(t,r).replace("0x","")},Jd=(...e)=>`0x${e.map(_p).join("").toLowerCase()}`,A_=(...e)=>ko(Jd(...e)),I_=(...e)=>$e(Jd(...e)),R_=e=>ko(`0x${(typeof e=="number"?e.toString():e).padStart(64,"0")}`);function wp(e){return fh(e)}var kn=e=>wp(e),S_=e=>Y(kn(e));var Mc=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})};function Yd(e){return(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function Ep(e,t,r){return Mc(this,void 0,void 0,function*(){let n,o=yield Promise.race([e instanceof Promise?e:e(),new Promise((i,s)=>{n=setTimeout(()=>r?s(r):i(void 0),t)})]);if(n&&clearTimeout(n),o instanceof Error)throw o;return o})}function Lc(e,t){let r;return[new Promise((o,i)=>{r=setInterval((function s(){return Mc(this,void 0,void 0,function*(){try{let a=yield Ep(e,t);S(a)||(clearInterval(r),o(a))}catch(a){clearInterval(r),i(a)}}),s})(),t)}),r]}function k_(e,t){return Mc(this,void 0,void 0,function*(){return Lc(e,t)[0]})}function ms(e,t){let r,n=new Promise((o,i)=>{r=setTimeout(()=>{i(t)},e)});return[r,n]}function Qd(e,t){let r,n=new Promise((o,i)=>{r=setInterval(()=>{Mc(this,void 0,void 0,function*(){let s=yield e();s&&(clearInterval(r),i(s))})},t)});return[r,n]}var Re={};fr(Re,{isBatchRequest:()=>$c,isBatchResponse:()=>vs,isResponseRpcError:()=>Fc,isResponseWithError:()=>xs,isResponseWithNotification:()=>Uc,isResponseWithResult:()=>ys,isSubscriptionResult:()=>Tp,isValidResponse:()=>ef,setRequestIdStart:()=>Ap,toBatchPayload:()=>Ip,toPayload:()=>Po,validateResponse:()=>Hc});var gs=()=>{let e=kn(16);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Y(e);return[t.substring(2,10),t.substring(10,14),t.substring(14,18),t.substring(18,22),t.substring(22,34)].join("-")};var Fc=e=>{let t=e.error.code;return Ze.has(t)||t>=-32099&&t<=-32e3},ys=e=>!Array.isArray(e)&&!!e&&e.jsonrpc==="2.0"&&"result"in e&&S(e.error)&&(typeof e.id=="number"||typeof e.id=="string"),xs=e=>!Array.isArray(e)&&e.jsonrpc==="2.0"&&!!e&&S(e.result)&&"error"in e&&(typeof e.id=="number"||typeof e.id=="string"),Uc=e=>!Array.isArray(e)&&!!e&&e.jsonrpc==="2.0"&&!S(e.params)&&!S(e.method),Tp=e=>!Array.isArray(e)&&!!e&&e.jsonrpc==="2.0"&&"id"in e&&"result"in e,Hc=e=>ys(e)||xs(e),ef=e=>Array.isArray(e)?e.every(Hc):Hc(e),vs=e=>Array.isArray(e)&&e.length>0&&ef(e),Dc,Ap=e=>{Dc=e},Po=e=>{var t,r,n,o;return typeof Dc<"u"&&(Dc+=1),{jsonrpc:(t=e.jsonrpc)!==null&&t!==void 0?t:"2.0",id:(n=(r=e.id)!==null&&r!==void 0?r:Dc)!==null&&n!==void 0?n:gs(),method:e.method,params:(o=e.params)!==null&&o!==void 0?o:void 0}},Ip=e=>e.map(t=>Po(t)),$c=e=>Array.isArray(e)&&e.length>0;var tf=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Rp,Jr=class{constructor({timeout:t,eagerStart:r,timeoutMessage:n}={timeout:0,eagerStart:!1,timeoutMessage:"DeferredPromise timed out"}){this[Rp]="Promise",this._state="pending",this._promise=new Promise((o,i)=>{this._resolve=o,this._reject=i}),this._timeoutMessage=n,this._timeoutInterval=t,r&&this.startTimer()}get state(){return this._state}then(t,r){return tf(this,void 0,void 0,function*(){return this._promise.then(t,r)}
8)}catch(t){return tf(this,void 0,void 0,function*(){return this._promise.catch(t)})}finally(t){return tf(this,void 0,void 0,function*(){return this._promise.finally(t)})}resolve(t){this._resolve(t),this._state="fulfilled",this._clearTimeout()}reject(t){this._reject(t),this._state="rejected",this._clearTimeout()}startTimer(){this._timeoutInterval&&this._timeoutInterval>0&&(this._timeoutId=setTimeout(this._checkTimeout.bind(this),this._timeoutInterval))}_checkTimeout(){this._state==="pending"&&this._timeoutId&&this.reject(new io(this._timeoutMessage))}_clearTimeout(){this._timeoutId&&clearTimeout(this._timeoutId)}};Rp=Symbol.toStringTag;var bs=class{constructor(t,r){this.eventEmitter=t,this.autoReconnect=r,this.chunkTimeout=1e3*15}clearQueues(){typeof this._clearQueues=="function"&&this._clearQueues()}onError(t){this._clearQueues=t}parseResponse(t){let r=[];return t.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(o=>{let i=o;this.lastChunk&&(i=this.lastChunk+i);let s;try{s=JSON.parse(i)}catch{this.lastChunk=i,this.lastChunkTimeout&&clearTimeout(this.lastChunkTimeout),this.lastChunkTimeout=setTimeout(()=>{this.autoReconnect||(this.clearQueues(),this.eventEmitter.emit("error",new Jt({id:1,jsonrpc:"2.0",error:{code:2,message:"Chunk timeout"}})))},this.chunkTimeout);return}clearTimeout(this.lastChunkTimeout),this.lastChunk=void 0,s&&r.push(s)}),r}};var Sp=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Yr=class extends Lr{constructor(){super(...arguments),this._eventEmitter=new jl.default,this._chainId="",this._accounts=[]}_getChainId(){return Sp(this,void 0,void 0,function*(){var t;let r=yield this.request(Po({method:"eth_chainId",params:[]}));return(t=r?.result)!==null&&t!==void 0?t:""})}_getAccounts(){return Sp(this,void 0,void 0,function*(){var t;let r=yield this.request(Po({method:"eth_accounts",params:[]}));return(t=r?.result)!==null&&t!==void 0?t:[]})}_onConnect(){Promise.all([this._getChainId().then(t=>{t!==this._chainId&&(this._chainId=t,this._eventEmitter.emit("chainChanged",this._chainId))}).catch(t=>{console.error(t)}),this._getAccounts().then(t=>{this._accounts.length===t.length&&t.every(r=>t.includes(r))||(this._accounts=t,this._onAccountsChanged())}).catch(t=>{console.error(t)})]).then(()=>this._eventEmitter.emit("connect",{chainId:this._chainId})).catch(t=>{console.error(t)})}_onDisconnect(t,r){this._eventEmitter.emit("disconnect",new Xa(t,r))}_onAccountsChanged(){this._eventEmitter.emit("accountsChanged",this._accounts)}};var rf=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},P_={autoReconnect:!0,delay:5e3,maxAttempts:5},B_=1e3,Bo=class extends Yr{get SocketConnection(){return this._socketConnection}constructor(t,r,n){if(super(),this._connectionStatus="connecting",this._onMessageHandler=this._onMessage.bind(this),this._onOpenHandler=this._onConnect.bind(this),this._onCloseHandler=this._onCloseEvent.bind(this),this._onErrorHandler=this._onError.bind(this),!this._validateProviderPath(t))throw new _n(t);this._socketPath=t,this._socketOptions=r,this._reconnectOptions=Object.assign(Object.assign({},P_),n??{}),this._pendingRequestsQueue=new Map,this._sentRequestsQueue=new Map,this._init(),this.connect(),this.chunkResponseParser=new bs(this._eventEmitter,this._reconnectOptions.autoReconnect),this.chunkResponseParser.onError(()=>{this._clearQueues()}),this.isReconnecting=!1}_init(){this._reconnectAttempts=0}connect(){try{this._openSocketConnection(),this._connectionStatus="connecting",this._addSocketListeners()}catch(t){if(this.isReconnecting)setImmediate(()=>{this._reconnect()});else throw this._connectionStatus="disconnected",t&&t.message?new Hr(`Error while connecting to ${this._socketPath}. Reason: ${t.message}`):new _n(this._socketPath)}}_validateProviderPath(t){return!!t}getPendingRequestQueueSize(){return this._pendingRequestsQueue.size}getSentRequestsQueueSize(){return this._sentRequestsQueue.size}supportsSubscriptions(){return!0}on(t,r){this._eventEmitter.on(t,r)}once(t,r){this._eventEmitter.once(t,r)}removeListener(t,r){this._eventEmitter.removeListener(t,r)}_onDisconnect(t,r){this._connectionStatus="disconnected",super._onDisconnect(t,r)}disconnect(t,r){let n=t??B_;
8this._removeSocketListeners(),this.getStatus()!=="disconnected"&&this._closeSocketConnection(n,r),this._onDisconnect(n,r)}safeDisconnect(t,r){return rf(this,arguments,void 0,function*(n,o,i=!1,s=1e3){let a=0;yield rf(this,void 0,void 0,function*(){return new Promise(d=>{let c=setInterval(()=>{i&&a>=5&&this.clearQueues(),this.getPendingRequestQueueSize()===0&&this.getSentRequestsQueueSize()===0&&(clearInterval(c),d(!0)),a+=1},s)})}),this.disconnect(n,o)})}removeAllListeners(t){this._eventEmitter.removeAllListeners(t)}_onError(t){this.isReconnecting?this._reconnect():this._eventEmitter.emit("error",t)}reset(){this._sentRequestsQueue.clear(),this._pendingRequestsQueue.clear(),this._init(),this._removeSocketListeners(),this._addSocketListeners()}_reconnect(){this.isReconnecting||(this.isReconnecting=!0,this._sentRequestsQueue.size>0&&this._sentRequestsQueue.forEach((t,r)=>{t.deferredPromise.reject(new ma),this._sentRequestsQueue.delete(r)}),this._reconnectAttempts<this._reconnectOptions.maxAttempts?(this._reconnectAttempts+=1,setTimeout(()=>{this._removeSocketListeners(),this.connect(),this.isReconnecting=!1},this._reconnectOptions.delay)):(this.isReconnecting=!1,this._clearQueues(),this._removeSocketListeners(),this._eventEmitter.emit("error",new pa(this._reconnectOptions.maxAttempts))))}request(t){return rf(this,void 0,void 0,function*(){if(V(this._socketConnection))throw new Error("Connection is undefined");this.getStatus()==="disconnected"&&this.connect();let r=$c(t)?t[0].id:t.id;if(!r)throw new wa("Request Id not defined");if(this._sentRequestsQueue.has(r))throw new ga(r);let n=new Jr;n.catch(i=>{this._eventEmitter.emit("error",i)});let o={payload:t,deferredPromise:n};if(this.getStatus()==="connecting")return this._pendingRequestsQueue.set(r,o),o.deferredPromise;this._sentRequestsQueue.set(r,o);try{this._sendToSocket(o.payload)}catch(i){this._sentRequestsQueue.delete(r),this._eventEmitter.emit("error",i)}return n})}_onConnect(){this._connectionStatus="connected",this._reconnectAttempts=0,super._onConnect(),this._sendPendingRequests()}_sendPendingRequests(){for(let[t,r]of this._pendingRequestsQueue.entries())try{this._sendToSocket(r.payload),this._pendingRequestsQueue.delete(t),this._sentRequestsQueue.set(t,r)}catch(n){this._pendingRequestsQueue.delete(t),this._eventEmitter.emit("error",n)}}_onMessage(t){let r=this._parseResponses(t);if(!(V(r)||r.length===0))for(let n of r){if(Uc(n)&&n.method.endsWith("_subscription")){this._eventEmitter.emit("message",n);return}let o=vs(n)?n[0].id:n.id,i=this._sentRequestsQueue.get(o);if(!i)return;(vs(n)||ys(n)||xs(n))&&(this._eventEmitter.emit("message",n),i.deferredPromise.resolve(n)),this._sentRequestsQueue.delete(o)}}clearQueues(t){this._clearQueues(t)}_clearQueues(t){this._pendingRequestsQueue.size>0&&this._pendingRequestsQueue.forEach((r,n)=>{r.deferredPromise.reject(new vn(t)),this._pendingRequestsQueue.delete(n)}),this._sentRequestsQueue.size>0&&this._sentRequestsQueue.forEach((r,n)=>{r.deferredPromise.reject(new vn(t)),this._sentRequestsQueue.delete(n)}),this._removeSocketListeners()}};var nr=class{constructor(){this._emitter=new Sn}on(t,r){this._emitter.on(t,r)}once(t,r){this._emitter.once(t,r)}off(t,r){this._emitter.off(t,r)}emit(t,r){this._emitter.emit(t,r)}listenerCount(t){return this._emitter.listenerCount(t)}listeners(t){return this._emitter.listeners(t)}eventNames(){return this._emitter.eventNames()}removeAllListeners(){return this._emitter.removeAllListeners()}setMaxListenerWarningThreshold(t){this._emitter.setMaxListeners(t)}getMaxListeners(){return this._emitter.getMaxListeners()}};var Qr=(function(e){return e.CONFIG_CHANGE="CONFIG_CHANGE",e})(Qr||{}),jc=class extends nr{constructor(t){super(),this.config={handleRevert:!1,defaultAccount:void 0,defaultBlock:"latest",transactionBlockTimeout:50,transactionConfirmationBlocks:24,transactionPollingInterval:1e3,transactionPollingTimeout:750*1e3,transactionReceiptPollingInterval:void 0,transactionSendTimeout:750*1e3,transactionConfirmationPollingInterval:void 0,blockHeaderTimeout:10,maxListenersWarningThreshold:100,contractDataInputFill:"data",defaultNetworkId:void 0,defaultChain:"mainnet",defaultHardfork:"london",defaultCommon:void 0,defaultTransactionType:"0x2",defaultMaxPriorityFeePerGas:rt(25e8),enableExperimentalFeatures:{useSubscriptionWhenCheckingBlockTimeout:!1,useRpcCallSpecification:!1},transactionBuilder:void 0,transactionTypeParser:void 0,customTransactionSchema:void 0,defaultReturnFormat:Be,ignoreGasPricing:!1},this.setConfig(t??{})}setConfig(t){let r=Object.keys(t);for(let n of r)this._triggerConfigChange(n,t[n]),!V(t[n])&&typeof t[n]=="number"&&n==="maxListenersWarningThreshold"&&this.setMaxListenerWarningThreshold(Number(t[n]));Object.assign(this.config,t)}get handleRevert(){return this.config.handleRevert}set handleRevert(t){this._triggerConfigChange("handleRevert",t),this.config.handleRevert=t}get contractDataInputFill(){return this.config.contractDataInputFill}set contractDataInputFill(t){this._triggerConfigChange("contractDataInputFill",t),this.config.contractDataInputFill=t}get defaultAccount(){return this.config.defaultAccount}set defaultAccount(t){this._triggerConfigChange("defaultAccount",t),this.config.defaultAccount=t}get defaultBlock(){return this.config.defaultBlock}set defaultBlock(t){this._triggerConfigChange("defaultBlock",t),this.config.defaultBlock=t}get transactionSendTimeout(){return this.config.transactionSendTimeout}set transactionSendTimeout(t){this._triggerConfigChange("transactionSendTimeout",t),this.config.transactionSendTimeout=t}get transactionBlockTimeout(){return this.config.transactionBlockTimeout}set transactionBlockTimeout(t){this._triggerConfigChange("transactionBlockTimeout",t),this.config.transactionBlockTimeout=t}get transactionConfirmationBlocks(){return this.config.transactionConfirmationBlocks}set transactionConfirmationBlocks(t){this._triggerConfigChange("transactionConfirmationBlocks",t),this.config.transactionConfirmationBlocks=t}get transactionPollingInterval(){return this.config.transactionPollingInterval}set transactionPollingInterval(t){this._triggerConfigChange("transactionPollingInterval",t),this.config.transactionPollingInterval=t,this.transactionReceiptPollingInterval=t,this.transactionConfirmationPollingInterval=t}get transactionPollingTimeout(){return this.config.transactionPollingTimeout}set transactionPollingTimeout(t){this._triggerConfigChange("transactionPollingTimeout",t),this.config.transactionPollingTimeout=t}get transactionReceiptPollingInterval(){return this.config.transactionReceiptPollingInterval}set transactionReceiptPollingInterval(t){this._triggerConfigChange("transactionReceiptPollingInterval",t),this.config.transactionReceiptPollingInterval=t}get transactionConfirmationPollingInterval(){return this.config.transactionConfirmationPollingInterval}set transactionConfirmationPollingInterval(t){this._triggerConfigChange("transactionConfirmationPollingInterval",t),this.config.transactionConfirmationPollingInterval=t}get blockHeaderTimeout(){return this.config.blockHeaderTimeout}set blockHeaderTimeout(t){this._triggerConfigChange("blockHeaderTimeout",t),this.config.blockHeaderTimeout=t}get enableExperimentalFeatures(){return this.config.enableExperimentalFeatures}set enableExperimentalFeatures(t){this._triggerConfigChange("enableExperimentalFeatures",t),this.config.enableExperimentalFeatures=t}get maxListenersWarningThreshold(){return this.config.maxListenersWarningThreshold}set maxListenersWarningThreshold(t){this._triggerConfigChange("maxListenersWarningThreshold",t),this.setMaxListenerWarningThreshold(t),this.config.maxListenersWarningThreshold=t}get defaultReturnFormat(){return this.config.defaultReturnFormat}set defaultReturnFormat(t){this._triggerConfigChange("defaultReturnFormat",t),this.config.defaultReturnFormat=t}get defaultNetworkId(){return this.config.defaultNetworkId}set defaultNetworkId(t){this._triggerConfigChange("defaultNetworkId",t),this.config.defaultNetworkId=t}get defaultChain(){return this.config.defaultChain}set defaultChain(t){if(!V(this.config.defaultCommon)&&!V(this.config.defaultCommon.baseChain)&&t!==this.config.defaultCommon.baseChain)throw new Ui(this.config.defaultChain,t);this._triggerConfigChange("defaultChain",t),this.config.defaultChain=t}get defaultHardfork(){return this.config.defaultHardfork}set defaultHardfork(t){if(!V(this.config.defaultCommon)&&!V(this.config.defaultCommon.hardfork)&&t!==this.config.defaultCommon.hardfork)throw new Fi(this.config.defaultCommon.hardfork,t);this._triggerConfigChange("defaultHardfork",t),this.config.defaultHardfork=t}get defaultCommon(){return this.config.defaultCommon}set defaultCommon(t){if(!V(this.config.defaultHardfork)&&!V(t)&&!V(t.hardfork)&&this.config.defaultHardfork!==t.hardfork)throw new Fi(this.config.defaultHardfork,t.hardfork);if(!V(this.config.defaultChain)&&!V(t)&&!V(t.baseChain)&&this.config.defaultChain!==t.baseChain)throw new Ui(this.config.defaultChain,t.baseChain);this._triggerConfigChange("defaultCommon",t),this.config.defaultCommon=t}get ignoreGasPricing(){return this.config.ignoreGasPricing}set ignoreGasPricing(t){this._triggerConfigChange("ignoreGasPricing",t),this.config.ignoreGasPricing=t}get defaultTransactionType(){return this.config.defaultTransactionType}set defaultTransactionType(t){this._triggerConfigChange("defaultTransactionType",t),this.config.defaultTransactionType=t}get defaultMaxPriorityFeePerGas(){return this.config.defaultMaxPriorityFeePerGas}set defaultMaxPriorityFeePerGas(t){this._triggerConfigChange("defaultMaxPriorityFeePerGas",t),this.config.defaultMaxPriorityFeePerGas=t}get transactionBuilder(){return this.config.transactionBuilder}set transactionBuilder(t){this._triggerConfigChange("transactionBuilder",t),this.config.transactionBuilder=t}get transactionTypeParser(){return this.config.transactionTypeParser}set transactionTypeParser(t){this._triggerConfigChange("transactionTypeParser",t),this.config.transactionTypeParser=t}get customTransactionSchema(){return this.config.customTransactionSchema}set customTransactionSchema(t){this._triggerConfigChange("customTransactionSchema",t),this.config.customTransactionSchema=t}
8_triggerConfigChange(t,r){this.emit(Qr.CONFIG_CHANGE,{name:t,oldValue:this.config[t],newValue:r})}};var Bp=to(Pp(),1);var N_=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Pn=class e extends Lr{constructor(t,r){if(super(),!e.validateClientUrl(t))throw new _n(t);this.clientUrl=t,this.httpProviderOptions=r}static validateClientUrl(t){return typeof t=="string"?/^http(s)?:\/\//i.test(t):!1}getStatus(){throw new Rt}supportsSubscriptions(){return!1}request(t,r){var n;return N_(this,void 0,void 0,function*(){let o=Object.assign(Object.assign({},(n=this.httpProviderOptions)===null||n===void 0?void 0:n.providerOptions),r),i=yield(0,Bp.default)(this.clientUrl,Object.assign(Object.assign({},o),{method:"POST",headers:Object.assign(Object.assign({},o.headers),{"Content-Type":"application/json"}),body:JSON.stringify(t)}));if(!i.ok)throw new Qe(yield i.json(),void 0,void 0,i.status);return yield i.json()})}on(){throw new Rt}removeListener(){throw new Rt}once(){throw new Rt}removeAllListeners(){throw new Rt}connect(){throw new Rt}disconnect(){throw new Rt}reset(){throw new Rt}reconnect(){throw new Rt}};var Oo=null;typeof WebSocket<"u"?Oo=WebSocket:typeof MozWebSocket<"u"?Oo=MozWebSocket:typeof global<"u"?Oo=global.WebSocket||global.MozWebSocket:typeof window<"u"?Oo=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(Oo=self.WebSocket||self.MozWebSocket);var Np=Oo;var Bn=class extends Bo{constructor(t,r,n){super(t,r,n)}_validateProviderPath(t){return typeof t=="string"?/^ws(s)?:\/\//i.test(t):!1}getStatus(){if(this._socketConnection&&!V(this._socketConnection))switch(this._socketConnection.readyState){case this._socketConnection.CONNECTING:return"connecting";case this._socketConnection.OPEN:return"connected";default:return"disconnected"}return"disconnected"}_openSocketConnection(){this._socketConnection=new Np(this._socketPath,void 0,this._socketOptions&&Object.keys(this._socketOptions).length===0?void 0:this._socketOptions)}_closeSocketConnection(t,r){var n;(n=this._socketConnection)===null||n===void 0||n.close(t,r)}_sendToSocket(t){var r;if(this.getStatus()==="disconnected")throw new vn;(r=this._socketConnection)===null||r===void 0||r.send(JSON.stringify(t))}_parseResponses(t){return this.chunkResponseParser.parseResponse(t.data)}_addSocketListeners(){var t,r,n,o;(t=this._socketConnection)===null||t===void 0||t.addEventListener("open",this._onOpenHandler),(r=this._socketConnection)===null||r===void 0||r.addEventListener("message",this._onMessageHandler),(n=this._socketConnection)===null||n===void 0||n.addEventListener("close",i=>this._onCloseHandler(i)),(o=this._socketConnection)===null||o===void 0||o.addEventListener("error",this._onErrorHandler)}_removeSocketListeners(){var t,r,n;(t=this._socketConnection)===null||t===void 0||t.removeEventListener("message",this._onMessageHandler),(r=this._socketConnection)===null||r===void 0||r.removeEventListener("open",this._onOpenHandler),(n=this._socketConnection)===null||n===void 0||n.removeEventListener("close",this._onCloseHandler)}_onCloseEvent(t){var r;if(this._reconnectOptions.autoReconnect&&(![1e3,1001].includes(t.code)||!t.wasClean)){this._reconnect();return}this._clearQueues(t),this._removeSocketListeners(),this._onDisconnect(t.code,t.reason),(r=this._socketConnection)===null||r===void 0||r.removeEventListener("error",this._onErrorHandler)}};var nf=e=>Lr.isWeb3Provider(e);var of=e=>typeof e!="string"&&"request"in e&&e.request.constructor.name==="Function",sf=e=>typeof e!="string"&&"request"in e&&e.request.constructor.name==="AsyncFunction",af=e=>typeof e!="string"&&"send"in e,cf=e=>typeof e!="string"&&"sendAsync"in e,Nn=e=>e&&(nf(e)||sf(e)||of(e)||cf(e)||af(e)),Op=e=>e&&"supportsSubscriptions"in e?e.supportsSubscriptions():!!(e&&typeof e!="string"&&"on"in e);var uf=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Co=(function(e){return e.PROVIDER_CHANGED="PROVIDER_CHANGED",e.BEFORE_PROVIDER_CHANGE="BEFORE_PROVIDER_CHANGE",e})(Co||{}),Cp={HttpProvider:Pn,WebsocketProvider:Bn},On=class e extends nr{constructor(t,r,n){super(),V(t)||this.setProvider(t),this.useRpcCallSpecification=r,V(n)||(this.middleware=n)}static get providers(){return Cp}get provider(){return this._provider}get providers(){return Cp}setProvider(t){let r;if(t&&typeof t=="string"&&this.providers)if(/^http(s)?:\/\//i.test(t))r=new this.providers.HttpProvider(t);else if(/^ws(s)?:\/\//i.test(t))r=new this.providers.WebsocketProvider(t);else throw new Fr(`Can't autodetect provider for "${t}"`);else V(t)?r=void 0:r=t;
8return this.emit(Co.BEFORE_PROVIDER_CHANGE,this._provider),this._provider=r,this.emit(Co.PROVIDER_CHANGED,this._provider),!0}setMiddleware(t){this.middleware=t}send(t){return uf(this,void 0,void 0,function*(){let r=Object.assign({},t),n=yield this._sendRequest(r);if(V(this.middleware)||(n=yield this.middleware.processResponse(n)),Re.isResponseWithResult(n))return n.result;throw new Qe(n)})}sendBatch(t){return uf(this,void 0,void 0,function*(){return yield this._sendRequest(t)})}_sendRequest(t){return uf(this,void 0,void 0,function*(){let{provider:r}=this;if(V(r))throw new Fr("Provider not available. Use `.setProvider` or `.provider=` to initialize the provider.");let n=Re.isBatchRequest(t)?Re.toBatchPayload(t):Re.toPayload(t);if(V(this.middleware)||(n=yield this.middleware.processRequest(n)),nf(r)){let o;try{o=yield r.request(n)}catch(i){o=i}return this._processJsonRpcResponse(n,o,{legacy:!1,error:!1})}if(sf(r))return r.request(n).then(o=>this._processJsonRpcResponse(n,o,{legacy:!0,error:!1})).catch(o=>this._processJsonRpcResponse(n,o,{legacy:!0,error:!0}));if(of(r))return new Promise((o,i)=>{let s=d=>{i(this._processJsonRpcResponse(n,d,{legacy:!0,error:!0}))},a=d=>o(this._processJsonRpcResponse(n,d,{legacy:!0,error:!1})),u=r.request(n,(d,c)=>d?s(d):a(c));Yd(u)&&u.then(a).catch(c=>{try{let f=this._processJsonRpcResponse(n,c,{legacy:!0,error:!0});i(f)}catch(f){i(f)}})});if(af(r))return new Promise((o,i)=>{r.send(n,(s,a)=>{if(s)return i(this._processJsonRpcResponse(n,s,{legacy:!0,error:!0}));if(V(a))throw new Qe({},'Got a "nullish" response from provider.');return o(this._processJsonRpcResponse(n,a,{legacy:!0,error:!1}))})});if(cf(r))return r.sendAsync(n).then(o=>this._processJsonRpcResponse(n,o,{legacy:!0,error:!1})).catch(o=>this._processJsonRpcResponse(n,o,{legacy:!0,error:!0}));throw new Fr("Provider does not have a request or send method to use.")})}_processJsonRpcResponse(t,r,{legacy:n,error:o}){if(V(r))return this._buildResponse(t,null,o);if(Re.isResponseWithError(r)){if(this.useRpcCallSpecification&&Fc(r)){let i=r;if(Ze.get(i.error.code)){let s=Ze.get(i.error.code).error;throw new s(i)}else throw new et(i)}else if(!e._isReverted(r))throw new Jt(r,t)}if(Re.isResponseWithResult(r))return r;if(r instanceof Error)throw e._isReverted(r),r;if(!n&&Re.isBatchRequest(t)&&Re.isBatchResponse(r)||n&&!o&&Re.isBatchRequest(t))return r;if(n&&o&&Re.isBatchRequest(t))throw r;if(n&&!Re.isResponseWithError(r)&&!Re.isResponseWithResult(r))return this._buildResponse(t,r,o);throw Re.isBatchRequest(t)&&!Array.isArray(r)?new Qe(r,"Got normal response for a batch request."):!Re.isBatchRequest(t)&&Array.isArray(r)?new Qe(r,"Got batch response for a normal request."):new Qe(r,"Invalid response")}static _isReverted(t){let r;if(Re.isResponseWithError(t)?r=t.error:t instanceof Error&&(r=t),r?.message.includes("revert"))throw new pt(r);return!1}_buildResponse(t,r,n){let o={jsonrpc:"2.0",id:Re.isBatchRequest(t)?t[0].id:"id"in t?t.id:null};return n?Object.assign(Object.assign({},o),{error:r}):Object.assign(Object.assign({},o),{result:r})}};var ws=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},vr=class{constructor(t,r,n=!1){this.requestManager=t,this.registeredSubscriptions=r,this.tolerateUnlinkedSubscription=n,this._subscriptions=new Map,this.requestManager.on(Co.BEFORE_PROVIDER_CHANGE,()=>ws(this,void 0,void 0,function*(){yield this.unsubscribe()})),this.requestManager.on(Co.PROVIDER_CHANGED,()=>{this.clear(),this.listenToProviderEvents()}),this.listenToProviderEvents()}listenToProviderEvents(){let t=this.requestManager.provider;!this.requestManager.provider||typeof t?.supportsSubscriptions=="function"&&!t?.supportsSubscriptions()||typeof this.requestManager.provider.on=="function"&&(typeof this.requestManager.provider.request=="function"?this.requestManager.provider.on("message",r=>this.messageListener(r)):t.on("data",r=>this.messageListener(r)))}messageListener(t){var r,n,o;if(!t)throw new mt("Should not call messageListener with no data. Type was");let i=((r=t.params)===null||r===void 0?void 0:r.subscription)||((n=t.data)===null||n===void 0?void 0:n.subscription)||((o=t.id)===null||o===void 0?void 0:o.toString(16));if(i){let s=this._subscriptions.get(i);s?.processSubscriptionData(t)}}subscribe(t,r){return ws(this,arguments,void 0,function*(n,o,i=Be){let s=this.registeredSubscriptions[n];if(!s)throw new mt("Invalid subscription type");let a=new s(o??void 0,{subscriptionManager:this,returnFormat:i});return yield this.addSubscription(a),a})}get subscriptions(){return this._subscriptions}addSubscription(t){return ws(this,void 0,void 0,function*(){if(!this.requestManager.provider)throw new Fr("Provider not available");if(!this.supportsSubscriptions())throw new mt("The current provider does not support subscriptions");
8if(t.id&&this._subscriptions.has(t.id))throw new mt(`Subscription with id "${t.id}" already exists`);if(yield t.sendSubscriptionRequest(),V(t.id))throw new mt("Subscription is not subscribed yet.");return this._subscriptions.set(t.id,t),t.id})}removeSubscription(t){return ws(this,void 0,void 0,function*(){let{id:r}=t;if(V(r))throw new mt("Subscription is not subscribed yet. Or, had already been unsubscribed but not through the Subscription Manager.");if(!this._subscriptions.has(r)&&!this.tolerateUnlinkedSubscription)throw new mt(`Subscription with id "${r.toString()}" does not exists`);return yield t.sendUnsubscribeRequest(),this._subscriptions.delete(r),r})}unsubscribe(t){return ws(this,void 0,void 0,function*(){let r=[];for(let[n,o]of this.subscriptions.entries())(!t||typeof t=="function"&&t({id:n,sub:o}))&&r.push(this.removeSubscription(o));return Promise.all(r)})}clear(){this._subscriptions.clear()}supportsSubscriptions(){return V(this.requestManager.provider)?!1:Op(this.requestManager.provider)}};var Es=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},br=class extends nr{constructor(t,r){var n;super(),this.args=t;let{requestManager:o}=r,{subscriptionManager:i}=r;o?this._subscriptionManager=new vr(o,{},!0):this._subscriptionManager=i,this._returnFormat=(n=r?.returnFormat)!==null&&n!==void 0?n:Be}get id(){return this._id}get lastBlock(){return this._lastBlock}subscribe(){return Es(this,void 0,void 0,function*(){return this._subscriptionManager.addSubscription(this)})}processSubscriptionData(t){var r,n;t?.data?this._processSubscriptionResult((n=(r=t?.data)===null||r===void 0?void 0:r.result)!==null&&n!==void 0?n:t?.data):t&&Re.isResponseWithNotification(t)&&this._processSubscriptionResult(t?.params.result)}sendSubscriptionRequest(){return Es(this,void 0,void 0,function*(){return this._id=yield this._subscriptionManager.requestManager.send({method:"eth_subscribe",params:this._buildSubscriptionParams()}),this.emit("connected",this._id),this._id})}get returnFormat(){return this._returnFormat}get subscriptionManager(){return this._subscriptionManager}resubscribe(){return Es(this,void 0,void 0,function*(){yield this.unsubscribe(),yield this.subscribe()})}unsubscribe(){return Es(this,void 0,void 0,function*(){this.id&&(yield this._subscriptionManager.removeSubscription(this))})}sendUnsubscribeRequest(){return Es(this,void 0,void 0,function*(){yield this._subscriptionManager.requestManager.send({method:"eth_unsubscribe",params:[this.id]}),this._id=void 0})}formatSubscriptionResult(t){return t}_processSubscriptionResult(t){this.emit("data",this.formatSubscriptionResult(t))}_processSubscriptionError(t){this.emit("error",t)}_buildSubscriptionParams(){throw new Error("Implement in the child class")}};var Mo=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Wc=class e extends sa{constructor(){super(...arguments),this._addressMap=new Map,this._defaultKeyName="web3js_wallet"}static getStorage(){let t;try{t=window.localStorage;let r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(r){return r&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&!S(t)&&t.length!==0?t:void 0}}create(t){for(let r=0;r<t;r+=1)this.add(this._accountProvider.create());return this}add(t){var r;if(typeof t=="string")return this.add(this._accountProvider.privateKeyToAccount(t));let n=this.length;return this.get(t.address)&&(console.warn(`Account ${t.address.toLowerCase()} already exists.`),n=(r=this._addressMap.get(t.address.toLowerCase()))!==null&&r!==void 0?r:n),this._addressMap.set(t.address.toLowerCase(),n),this[n]=t,this}get(t){if(typeof t=="string"){let r=this._addressMap.get(t.toLowerCase());return S(r)?void 0:this[r]}return this[t]}remove(t){if(typeof t=="string"){let r=this._addressMap.get(t.toLowerCase());return S(r)?!1:(this._addressMap.delete(t.toLowerCase()),this.splice(r,1),!0)}return this[t]?(this.splice(t,1),!0):!1}clear(){return this._addressMap.clear(),this.length=0,this}encrypt(t,r){return Mo(this,void 0,void 0,function*(){return Promise.all(this.map(n=>
8Mo(this,void 0,void 0,function*(){return n.encrypt(t,r)})))})}decrypt(t,r,n){return Mo(this,void 0,void 0,function*(){let o=yield Promise.all(t.map(i=>Mo(this,void 0,void 0,function*(){return this._accountProvider.decrypt(i,r,n)})));for(let i of o)this.add(i);return this})}save(t,r){return Mo(this,void 0,void 0,function*(){let n=e.getStorage();if(!n)throw new Error("Local storage not available.");return n.setItem(r??this._defaultKeyName,JSON.stringify(yield this.encrypt(t))),!0})}load(t,r){return Mo(this,void 0,void 0,function*(){let n=e.getStorage();if(!n)throw new Error("Local storage not available.");let o=n.getItem(r??this._defaultKeyName);return o&&(yield this.decrypt(JSON.parse(o)||[],t)),this})}};var Lo=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Je(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function M_(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function L_(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function _r(e,...t){if(!L_(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function Ts(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Je(e.outputLen),Je(e.blockLen)}function or(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function As(e,t){_r(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var D_={number:Je,bool:M_,bytes:_r,hash:Ts,exists:or,output:As},Vc=D_;var Do=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Cn=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Wt=(e,t)=>e<<32-t|e>>>t,ge=(e,t)=>e<<t|e>>>32-t>>>0,Ho=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,H_=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;function Fo(e){for(let t=0;t<e.length;t++)e[t]=H_(e[t])}function Mp(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Vt(e){return typeof e=="string"&&(e=Mp(e)),_r(e),e}function Mn(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];_r(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let i=e[n];r.set(i,o),o+=i.length}return r}var tn=class{clone(){return this._cloneInto()}},F_={}.toString;function zc(e,t){if(t!==void 0&&F_.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(e,t)}function Uo(e){let t=n=>e().update(Vt(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Lp(e){let t=(n,o)=>e(o).update(Vt(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}function Dp(e=32){if(Lo&&typeof Lo.getRandomValues=="function")return Lo.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}var vN=Vc.bool,$o=Vc.bytes;function Hp(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function Is(e){return t=>(Vc.bytes(t),e(t))}var bN=(()=>{let e=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,t=typeof module<"u"&&typeof module.require=="function"&&module.require.bind(module);return{node:t&&!e?t("crypto"):void 0,web:e}})();var ir={web:Lo};function Fp(e,t,r){if(!r.startsWith("aes-"))throw new Error(`AES submodule doesn't support mode ${r}`);if(t.length!==16)throw new Error("AES: wrong IV length");if(r.startsWith("aes-128")&&e.length!==16||r.startsWith("aes-256")&&e.length!==32)throw new Error("AES: wrong key length")}function Up(e,t,r){return _e(this,null,function*(){if(!ir.web)throw new Error("Browser crypto not available.");let n;if(["aes-128-cbc","aes-256-cbc"].includes(e)&&(n="cbc"),["aes-128-ctr","aes-256-ctr"].includes(e)&&(n="ctr"),!n)throw new Error("AES: unsupported mode");return[yield ir.web.subtle.importKey("raw",t,{name:`AES-${n.toUpperCase()}`,length:t.length*8},!0,["encrypt","decrypt"]),{name:`aes-${n}`,iv:r,counter:r,length:128}]})}function Kc(e,t,r,n="aes-128-ctr",o=!0){return _e(this,null,function*(){if(Fp(t,r,n),ir.web){let[i,s]=yield Up(n,t,r),a=yield ir.web.subtle.encrypt(s,i,e),u=new Uint8Array(a);return!o&&s.name==="aes-cbc"&&!(e.length%16)&&(u=u.slice(0,-16)),u}else if(ir.node){let i=ir.node.createCipheriv(n,t,r);return i.setAutoPadding(o),Mn(i.update(e),i.final())}else throw new Error("The environment doesn't have AES module")})}function $_(e,t,r,n){return _e(this,null,function*(){let o=e.slice(-16);for(let s=0;s<16;s++)o[s]^=r[s]^16;return(yield Kc(o,t,r,n)).slice(0,16)})}function $p(e,t,r,n="aes-128-ctr",o=!0){return _e(this,null,function*(){if(Fp(t,r,n),ir.web){let[i,s]=yield Up(n,t,r);if(!o&&s.name==="aes-cbc"){let d=yield $_(e,t,r,n);e=Mn(e,d)}let a=yield ir.web.subtle.decrypt(s,i,e),u=new Uint8Array(a);if(s.name==="aes-cbc"){let d=yield Kc(u,t,r,n);if(!Hp(d,e))throw new Error("AES: wrong padding")}return u}else if(ir.node){let i=ir.node.createDecipheriv(n,t,r);return i.setAutoPadding(o),Mn(i.update(e),i.final())}else throw new Error("The environment doesn't have AES module")})}var Zc=class extends tn{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,Ts(t);let n=Vt(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?t.create().update(n).digest():n);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=t.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),i.fill(0)}update(t){return or(this),this.iHash.update(t),this}digestInto(t){or(this),_r(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:o,destroyed:i,blockLen:s,outputLen:a}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=s,t.outputLen=a,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Rs=(e,t,r)=>new Zc(e,t).update(r).digest();Rs.create=(e,t)=>
8new Zc(e,t);function G_(e,t,r,n){Ts(e);let o=zc({dkLen:32,asyncTick:10},n),{c:i,dkLen:s,asyncTick:a}=o;if(Je(i),Je(s),Je(a),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let u=Vt(t),d=Vt(r),c=new Uint8Array(s),f=Rs.create(e,u),_=f._cloneInto().update(d);return{c:i,dkLen:s,asyncTick:a,DK:c,PRF:f,PRFSalt:_}}function q_(e,t,r,n,o){return e.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),r}function Ss(e,t,r,n){let{c:o,dkLen:i,DK:s,PRF:a,PRFSalt:u}=G_(e,t,r,n),d,c=new Uint8Array(4),f=Cn(c),_=new Uint8Array(a.outputLen);for(let w=1,k=0;k<i;w++,k+=a.outputLen){let T=s.subarray(k,k+a.outputLen);f.setInt32(0,w,!1),(d=u._cloneInto(d)).update(c).digestInto(_),T.set(_.subarray(0,T.length));for(let R=1;R<o;R++){a._cloneInto(d).update(_).digestInto(_);for(let P=0;P<T.length;P++)T[P]^=_[P]}}return q_(a,u,s,d,_)}function W_(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),a=Number(r&i),u=n?4:0,d=n?0:4;e.setUint32(t+u,s,n),e.setUint32(t+d,a,n)}var jp=(e,t,r)=>e&t^~e&r,Gp=(e,t,r)=>e&t^e&r^t&r,jo=class extends tn{constructor(t,r,n,o){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Cn(this.buffer)}update(t){or(this);let{view:r,buffer:n,blockLen:o}=this;t=Vt(t);let i=t.length;for(let s=0;s<i;){let a=Math.min(o-this.pos,i-s);if(a===o){let u=Cn(t);for(;o<=i-s;s+=o)this.process(u,s);continue}n.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){or(this),As(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:i}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(n,0),s=0);for(let f=s;f<o;f++)r[f]=0;W_(n,o-8,BigInt(this.length*8),i),this.process(n,0);let a=Cn(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,c=this.get();if(d>c.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<d;f++)a.setUint32(4*f,c[f],i)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:i,destroyed:s,pos:a}=this;return t.length=o,t.pos=a,t.finished=i,t.destroyed=s,o%r&&t.buffer.set(n),t}};var V_=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),rn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),nn=new Uint32Array(64),df=class extends jo{constructor(){super(64,32,8,!1),this.A=rn[0]|0,this.B=rn[1]|0,this.C=rn[2]|0,this.D=rn[3]|0,this.E=rn[4]|0,this.F=rn[5]|0,this.G=rn[6]|0,this.H=rn[7]|0}get(){let{A:t,B:r,C:n,D:o,E:i,F:s,G:a,H:u}=this;return[t,r,n,o,i,s,a,u]}set(t,r,n,o,i,s,a,u){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=a|0,this.H=u|0}process(t,r){for(let f=0;f<16;f++,r+=4)nn[f]=t.getUint32(r,!1);for(let f=16;f<64;f++){let _=nn[f-15],w=nn[f-2],k=Wt(_,7)^Wt(_,18)^_>>>3,T=Wt(w,17)^Wt(w,19)^w>>>10;nn[f]=T+nn[f-7]+k+nn[f-16]|0}let{A:n,B:o,C:i,D:s,E:a,F:u,G:d,H:c}=this;for(let f=0;f<64;f++){let _=Wt(a,6)^Wt(a,11)^Wt(a,25),w=c+_+jp(a,u,d)+V_[f]+nn[f]|0,T=(Wt(n,2)^Wt(n,13)^Wt(n,22))+Gp(n,o,i)|0;c=d,d=u,u=a,a=s+w|0,s=i,i=o,o=n,n=w+T|0}n=n+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,d=d+this.G|0,c=c+this.H|0,this.set(n,o,i,s,a,u,d,c)}roundClean(){nn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Ln=Uo(()=>new df);var Xc=BigInt(4294967295),ff=BigInt(32);function qp(e,t=!1){return t?{h:Number(e&Xc),l:Number(e>>ff&Xc)}:{h:Number(e>>ff&Xc)|0,l:Number(e&Xc)|0}}function lf(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){let{h:i,l:s}=qp(e[o],t);[r[o],n[o]]=[i,s]}return[r,n]}var z_=(e,t)=>
vendor: 1,876 bytes, line 8
8BigInt(e>>>0)<<ff|BigInt(t>>>0),K_=(e,t,r)=>e>>>r,Z_=(e,t,r)=>e<<32-r|t>>>r,X_=(e,t,r)=>e>>>r|t<<32-r,J_=(e,t,r)=>e<<32-r|t>>>r,Y_=(e,t,r)=>e<<64-r|t>>>r-32,Q_=(e,t,r)=>e>>>r-32|t<<64-r,ew=(e,t)=>t,tw=(e,t)=>e,hf=(e,t,r)=>e<<r|t>>>32-r,pf=(e,t,r)=>t<<r|e>>>32-r,mf=(e,t,r)=>t<<r-32|e>>>64-r,gf=(e,t,r)=>e<<r-32|t>>>64-r;function rw(e,t,r,n){let o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:o|0}}var nw=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),ow=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,iw=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),sw=(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0,aw=(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0),cw=(e,t,r,n,o,i)=>t+r+n+o+i+(e/2**32|0)|0;var uw={fromBig:qp,split:lf,toBig:z_,shrSH:K_,shrSL:Z_,rotrSH:X_,rotrSL:J_,rotrBH:Y_,rotrBL:Q_,rotr32H:ew,rotr32L:tw,rotlSH:hf,rotlSL:pf,rotlBH:mf,rotlBL:gf,add:rw,add3L:nw,add3H:ow,add4L:iw,add4H:sw,add5H:cw,add5L:aw},de=uw;var[dw,fw]=de.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
85771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),on=new Uint32Array(80),sn=new Uint32Array(80),yf=class extends jo{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:r,Bh:n,Bl:o,Ch:i,Cl:s,Dh:a,Dl:u,Eh:d,El:c,Fh:f,Fl:_,Gh:w,Gl:k,Hh:T,Hl:R}=this;return[t,r,n,o,i,s,a,u,d,c,f,_,w,k,T,R]}set(t,r,n,o,i,s,a,u,d,c,f,_,w,k,T,R){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=o|0,this.Ch=i|0,this.Cl=s|0,this.Dh=a|0,this.Dl=u|0,this.Eh=d|0,this.El=c|0,this.Fh=f|0,this.Fl=_|0,this.Gh=w|0,this.Gl=k|0,this.Hh=T|0,this.Hl=R|0}process(t,r){for(let C=0;C<16;C++,r+=4)on[C]=t.getUint32(r),sn[C]=t.getUint32(r+=4);for(let C=16;C<80;C++){let F=on[C-15]|0,L=sn[C-15]|0,U=de.rotrSH(F,L,1)^de.rotrSH(F,L,8)^de.shrSH(F,L,7),N=de.rotrSL(F,L,1)^de.rotrSL(F,L,8)^de.shrSL(F,L,7),l=on[C-2]|0,p=sn[C-2]|0,y=de.rotrSH(l,p,19)^de.rotrBH(l,p,61)^de.shrSH(l,p,6),h=de.rotrSL(l,p,19)^de.rotrBL(l,p,61)^de.shrSL(l,p,6),m=de.add4L(N,h,sn[C-7],sn[C-16]),v=de.add4H(m,U,y,on[C-7],on[C-16]);on[C]=v|0,sn[C]=m|0}let{Ah:n,Al:o,Bh:i,Bl:s,Ch:a,Cl:u,Dh:d,Dl:c,Eh:f,El:_,Fh:w,Fl:k,Gh:T,Gl:R,Hh:P,Hl:b}=this;for(let C=0;C<80;C++){let F=de.rotrSH(f,_,14)^de.rotrSH(f,_,18)^de.rotrBH(f,_,41),L=de.rotrSL(f,_,14)^de.rotrSL(f,_,18)^de.rotrBL(f,_,41),U=f&w^~f&T,N=_&k^~_&R,l=de.add5L(b,L,N,fw[C],sn[C]),p=de.add5H(l,P,F,U,dw[C],on[C]),y=l|0,h=de.rotrSH(n,o,28)^de.rotrBH(n,o,34)^de.rotrBH(n,o,39),m=de.rotrSL(n,o,28)^de.rotrBL(n,o,34)^de.rotrBL(n,o,39),v=n&i^n&a^i&a,I=o&s^o&u^s&u;P=T|0,b=R|0,T=w|0,R=k|0,w=f|0,k=_|0,{h:f,l:_}=de.add(d|0,c|0,p|0,y|0),d=a|0,c=u|0,a=i|0,u=s|0,i=n|0,s=o|0;let g=de.add3L(y,m,I);n=de.add3H(g,p,h,v),o=g|0}({h:n,l:o}=de.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:i,l:s}=de.add(this.Bh|0,this.Bl|0,i|0,s|0),{h:a,l:u}=de.add(this.Ch|0,this.Cl|0,a|0,u|0),{h:d,l:c}=de.add(this.Dh|0,this.Dl|0,d|0,c|0),{h:f,l:_}=de.add(this.Eh|0,this.El|0,f|0,_|0),{h:w,l:k}=de.add(this.Fh|0,this.Fl|0,w|0,k|0),{h:T,l:R}=de.add(this.Gh|0,this.Gl|0,T|0,R|0),{h:P,l:b}=de.add(this.Hh|0,this.Hl|0,P|0,b|0),this.set(n,o,i,s,a,u,d,c,f,_,w,k,T,R,P,b)}roundClean(){on.fill(0),sn.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Wp=Uo(()=>new yf);function xf(e,t,r,n,o){if(!["sha256","sha512"].includes(o))throw new Error("Only sha256 and sha512 are supported");return $o(e),$o(t),Ss(o==="sha256"?Ln:Wp,e,t,{c:r,dkLen:n})}function Vp(e,t,r,n,o,i){let s=e[t++]^r[n++],a=e[t++]^r[n++],u=e[t++]^r[n++],d=e[t++]^r[n++],c=e[t++]^r[n++],f=e[t++]^r[n++],_=e[t++]^r[n++],w=e[t++]^r[n++],k=e[t++]^r[n++],T=e[t++]^r[n++],R=e[t++]^r[n++],P=e[t++]^r[n++],b=e[t++]^r[n++],C=e[t++]^r[n++],F=e[t++]^r[n++],L=e[t++]^r[n++],U=s,N=a,l=u,p=d,y=c,h=f,m=_,v=w,I=k,g=T,x=R,E=P,A=b,O=C,H=F,$=L;for(let re=0;re<8;re+=2)y^=ge(U+A|0,7),I^=ge(y+U|0,9),A^=ge(I+y|0,13),U^=ge(A+I|0,18),g^=ge(h+N|0,7),O^=ge(g+h|0,9),N^=ge(O+g|0,13),h^=ge(N+O|0,18),H^=ge(x+m|0,7),l^=ge(H+x|0,9),m^=ge(l+H|0,13),x^=ge(m+l|0,18),p^=ge($+E|0,7),v^=ge(p+$|0,9),E^=ge(v+p|0,13),$^=ge(E+v|0,18),N^=ge(U+p|0,7),l^=ge(N+U|0,9),p^=ge(l+N|0,13),U^=ge(p+l|0,18),m^=ge(h+y|0,7),v^=ge(m+h|0,9),y^=ge(v+m|0,13),h^=ge(y+v|0,18),E^=ge(x+g|0,7),I^=ge(E+x|0,9),g^=ge(I+E|0,13),x^=ge(g+I|0,18),A^=ge($+H|0,7),O^=ge(A+$|0,9),H^=ge(O+A|0,13),$^=ge(H+O|0,18);o[i++]=s+U|0,o[i++]=a+N|0,o[i++]=u+l|0,o[i++]=d+p|0,o[i++]=c+y|0,o[i++]=f+h|0,o[i++]=_+m|0,o[i++]=w+v|0,o[i++]=k+I|0,o[i++]=T+g|0,o[i++]=R+x|0,o[i++]=P+E|0,o[i++]=b+A|0,o[i++]=C+O|0,o[i++]=F+H|0,o[i++]=L+$|0}function vf(e,t,r,n,o){let i=n+0,s=n+16*o;for(let a=0;a<16;a++)r[s+a]=e[t+(2*o-1)*16+a];for(let a=0;a<o;a++,i+=16,t+=16)Vp(r,s,e,t,r,i),a>0&&(s+=16),Vp(r,i,e,t+=16,r,s)}function lw(e,t,r){let n=zc({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:o,r:i,p:s,dkLen:a,asyncTick:u,maxmem:d,onProgress:c}=n;if(Je(o),Je(i),Je(s),Je(a),Je(u),Je(d),c!==void 0&&typeof c!="function")throw new Error("progressCb should be function");let f=128*i,_=f/4;if(o<=1||(o&o-1)!==0||o>=2**(f/8)||o>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(s<0||s>(2**32-1)*32/f)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(a<0||a>(2**32-1)*32)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");let w=f*(o+s);if(w>d)throw new Error(`Scrypt: parameters too large, ${w} (128 * r * (N + p)) > ${d} (maxmem)`);let k=Ss(Ln,e,t,{c:1,dkLen:f*s}),T=Do(k),R=Do(new Uint8Array(f*o)),P=Do(new Uint8Array(f)),b=()=>{};if(c){let C=2*o*s,F=Math.max(Math.floor(C/1e4),1),L=0;b=()=>{L++,c&&(!(L%F)||L===C)&&c(L/C)}}return{N:o,r:i,p:s,dkLen:a,blockSize32:_,V:R,B32:T,B:k,tmp:P,blockMixCb:b,asyncTick:u}}function hw(e,t,r,n,o){let i=Ss(Ln,e,r,{c:1,dkLen:t});return r.fill(0),n.fill(0),o.fill(0),i}function zp(e,t,r){let{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:u,B32:d,B:c,tmp:f,blockMixCb:_}=lw(e,t,r);Ho||Fo(d);for(let w=0;w<i;w++){let k=a*w;for(let T=0;T<a;T++)u[T]=d[k+T];for(let T=0,R=0;T<n-1;T++)vf(u,R,u,R+=a,o),_();vf(u,(n-1)*a,d,k,o),_();for(let T=0;T<n;T++){let R=d[k+a-16]%n;for(let P=0;P<a;P++)f[P]=d[k+P]^u[R*a+P];vf(f,0,d,k,o),_()}}return Ho||Fo(d),hw(e,s,c,u,f)}function bf(e,t,r,n,o,i,s){return $o(e),$o(t),zp(e,t,{N:r,r:o,p:n,dkLen:i,onProgress:s})}var Of={};fr(Of,{secp256k1:()=>Ps});var Tf={};fr(Tf,{abytes:()=>Go,bitGet:()=>bw,bitLen:()=>vw,bitMask:()=>ks,bitSet:()=>_w,bytesToHex:()=>Dn,bytesToNumberBE:()=>Er,bytesToNumberLE:()=>Yc,concatBytes:()=>qo,createHmacDrbg:()=>Ef,ensureBytes:()=>vt,equalBytes:()=>yw,hexToBytes:()=>Hn,hexToNumber:()=>wf,isBytes:()=>an,numberToBytesBE:()=>cn,numberToBytesLE:()=>Qc,numberToHexUnpadded:()=>Jp,numberToVarBytesBE:()=>gw,utf8ToBytes:()=>xw,validateObject:()=>un});var Xp=BigInt(0),Jc=BigInt(1),pw=BigInt(2);function an(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Go(e){if(!an(e))throw new Error("Uint8Array expected")}var mw=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Dn(e){Go(e);let t="";for(let r=0;r<e.length;r++)t+=mw[e[r]];return t}function Jp(e){let t=e.toString(16);return t.length&1?`0${t}`:t}function wf(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}var wr={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Kp(e){if(e>=wr._0&&e<=wr._9)return e-wr._0;if(e>=wr._A&&e<=wr._F)return e-(wr._A-10);if(e>=wr._a&&e<=wr._f)return e-(wr._a-10)}function Hn(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let o=0,i=0;o<r;o++,i+=2){let s=Kp(e.charCodeAt(i)),a=Kp(e.charCodeAt(i+1));if(s===void 0||a===void 0){let u=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+i)}n[o]=s*16+a}return n}function Er(e){return wf(Dn(e))}function Yc(e){return Go(e),wf(Dn(Uint8Array.from(e).reverse()))}function cn(e,t){return Hn(e.toString(16).padStart(t*2,"0"))}function Qc(e,t){return cn(e,t).reverse()}function gw(e){return Hn(Jp(e))}function vt(e,t,r){let n;if(typeof t=="string")try{n=Hn(t)}catch(i){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${i}`)}else if(an(t))n=Uint8Array.from(t);else throw new Error(`${e} must be hex string or Uint8Array`);let o=n.length;if(typeof r=="number"&&o!==r)throw new Error(`${e} expected ${r} bytes, got ${o}`);return n}function qo(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];Go(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let i=e[n];r.set(i,o),o+=i.length}return r}function yw(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function xw(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function vw(e){let t;for(t=0;e>Xp;e>>=Jc,t+=1);return t}function bw(e,t){return e>>BigInt(t)&Jc}function _w(e,t,r){return e|(r?Jc:Xp)<<BigInt(t)}var ks=e=>(pw<<BigInt(e-1))-Jc,_f=e=>new Uint8Array(e),Zp=e=>Uint8Array.from(e);function Ef(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=_f(e),o=_f(e),i=0,s=()=>{n.fill(1),o.fill(0),i=0},a=(...f)=>r(o,n,...f),u=(f=_f())=>{o=a(Zp([0]),f),n=a(),f.length!==0&&(o=a(Zp([1]),f),n=a())},d=()=>
vendor: 5,439 bytes, line 8
8{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let f=0,_=[];for(;f<t;){n=a();let w=n.slice();_.push(w),f+=n.length}return qo(..._)};return(f,_)=>{s(),u(f);let w;for(;!(w=_(d()));)u();return s(),w}}var ww={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||an(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function un(e,t,r={}){let n=(o,i,s)=>{let a=ww[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);let u=e[o];if(!(s&&u===void 0)&&!a(u,e))throw new Error(`Invalid param ${String(o)}=${u} (${typeof u}), expected ${i}`)};for(let[o,i]of Object.entries(t))n(o,i,!1);for(let[o,i]of Object.entries(r))n(o,i,!0);return e}var je=BigInt(0),De=BigInt(1),Fn=BigInt(2),Ew=BigInt(3),Af=BigInt(4),Yp=BigInt(5),Qp=BigInt(8),Tw=BigInt(9),Aw=BigInt(16);function nt(e,t){let r=e%t;return r>=je?r:t+r}function Iw(e,t,r){if(r<=je||t<je)throw new Error("Expected power/modulo > 0");if(r===De)return je;let n=De;for(;t>je;)t&De&&(n=n*e%r),e=e*e%r,t>>=De;return n}function bt(e,t,r){let n=e;for(;t-- >je;)n*=n,n%=r;return n}function eu(e,t){if(e===je||t<=je)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=nt(e,t),n=t,o=je,i=De,s=De,a=je;for(;r!==je;){let d=n/r,c=n%r,f=o-s*d,_=i-a*d;n=r,r=c,o=s,i=a,s=f,a=_}if(n!==De)throw new Error("invert: does not exist");return nt(o,t)}function Rw(e){let t=(e-De)/Fn,r,n,o;for(r=e-De,n=0;r%Fn===je;r/=Fn,n++);for(o=Fn;o<e&&Iw(o,t,e)!==e-De;o++);if(n===1){let s=(e+De)/Af;return function(u,d){let c=u.pow(d,s);if(!u.eql(u.sqr(c),d))throw new Error("Cannot find square root");return c}}let i=(r+De)/Fn;return function(a,u){if(a.pow(u,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let d=n,c=a.pow(a.mul(a.ONE,o),r),f=a.pow(u,i),_=a.pow(u,r);for(;!a.eql(_,a.ONE);){if(a.eql(_,a.ZERO))return a.ZERO;let w=1;for(let T=a.sqr(_);w<d&&!a.eql(T,a.ONE);w++)T=a.sqr(T);let k=a.pow(c,De<<BigInt(d-w-1));c=a.sqr(k),f=a.mul(f,k),_=a.mul(_,c),d=w}return f}}function Sw(e){if(e%Af===Ew){let t=(e+De)/Af;return function(n,o){let i=n.pow(o,t);if(!n.eql(n.sqr(i),o))throw new Error("Cannot find square root");return i}}if(e%Qp===Yp){let t=(e-Yp)/Qp;return function(n,o){let i=n.mul(o,Fn),s=n.pow(i,t),a=n.mul(o,s),u=n.mul(n.mul(a,Fn),s),d=n.mul(a,n.sub(u,n.ONE));if(!n.eql(n.sqr(d),o))throw new Error("Cannot find square root");return d}}return e%Aw,Rw(e)}var kw=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function If(e){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=kw.reduce((n,o)=>(n[o]="function",n),t);return un(e,r)}function Pw(e,t,r){if(r<je)throw new Error("Expected power > 0");if(r===je)return e.ONE;if(r===De)return t;let n=e.ONE,o=t;for(;r>je;)r&De&&(n=e.mul(n,o)),o=e.sqr(o),r>>=De;return n}function Bw(e,t){let r=new Array(t.length),n=t.reduce((i,s,a)=>e.is0(s)?i:(r[a]=i,e.mul(i,s)),e.ONE),o=e.inv(n);return t.reduceRight((i,s,a)=>e.is0(s)?i:(r[a]=e.mul(i,r[a]),e.mul(i,s)),o),r}function Rf(e,t){let r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function em(e,t,r=!1,n={}){if(e<=je)throw new Error(`Expected Field ORDER > 0, got ${e}`);let{nBitLength:o,nByteLength:i}=Rf(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=Sw(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:ks(o),ZERO:je,ONE:De,create:u=>nt(u,e),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return je<=u&&u<e},is0:u=>u===je,isOdd:u=>(u&De)===De,neg:u=>nt(-u,e),eql:(u,d)=>u===d,sqr:u=>nt(u*u,e),add:(u,d)=>nt(u+d,e),sub:(u,d)=>nt(u-d,e),mul:(u,d)=>nt(u*d,e),pow:(u,d)=>Pw(a,u,d),div:(u,d)=>nt(u*eu(d,e),e),sqrN:u=>u*u,addN:(u,d)=>u+d,subN:(u,d)=>u-d,mulN:(u,d)=>u*d,inv:u=>eu(u,e),sqrt:n.sqrt||(u=>s(a,u)),invertBatch:u=>Bw(a,u),cmov:(u,d,c)=>c?d:u,toBytes:u=>r?Qc(u,i):cn(u,i),fromBytes:u=>{if(u.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${u.length}`);return r?Yc(u):Er(u)}});return Object.freeze(a)}function tm(e){if(typeof e!="bigint")throw new Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function Sf(e){let t=tm(e);return t+Math.ceil(t/2)}function rm(e,t,r=!1){let n=e.length,o=tm(t),i=Sf(t);if(n<16||n<i||n>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${n}`);let s=r?Er(e):Yc(e),a=nt(s,t-De)+De;return r?Qc(a,o):cn(a,o)}var Ow=BigInt(0),kf=BigInt(1);function nm(e,t){let r=(o,i)=>{let s=i.negate();return o?s:i},n=o=>{let i=Math.ceil(t/o)+1,s=2**(o-1);return{windows:i,windowSize:s}};return{constTimeNegate:r,unsafeLadder(o,i){let s=e.ZERO,a=o;for(;i>Ow;)i&kf&&(s=s.add(a)),a=a.double(),i>>=kf;return s},precomputeWindow(o,i){let{windows:s,windowSize:a}=n(i),u=[],d=o,c=d;for(let f=0;f<s;f++){c=d,u.push(c);for(let _=1;_<a;_++)c=c.add(d),u.push(c);d=c.double()}return u},wNAF(o,i,s){let{windows:a,windowSize:u}=n(o),d=e.ZERO,c=e.BASE,f=BigInt(2**o-1),_=2**o,w=BigInt(o);for(let k=0;k<a;k++){let T=k*u,R=Number(s&f);s>>=w,R>u&&(R-=_,s+=kf);let P=T,b=T+Math.abs(R)-1,C=k%2!==0,F=R<0;R===0?c=c.add(r(C,i[P])):d=d.add(r(F,i[b]))}return{p:d,f:c}},wNAFCached(o,i,s,a){let u=o._WINDOW_SIZE||1,d=i.get(o);
8return d||(d=this.precomputeWindow(o,u),u!==1&&i.set(o,a(d))),this.wNAF(u,d,s)}}}function Pf(e){return If(e.Fp),un(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze(Z(B(B({},Rf(e.n,e.nBitLength)),e),{p:e.Fp.ORDER}))}function Cw(e){let t=Pf(e);un(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:o}=t;if(r){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze(B({},t))}var{bytesToNumberBE:Mw,hexToBytes:Lw}=Tf,Un={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){let{Err:t}=Un;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");let r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Mw(n),l:e.subarray(r+2)}},toSig(e){let{Err:t}=Un,r=typeof e=="string"?Lw(e):e;Go(r);let n=r.length;if(n<2||r[0]!=48)throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");let{d:o,l:i}=Un._parseInt(r.subarray(2)),{d:s,l:a}=Un._parseInt(i);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s}},hexFromSig(e){let t=d=>Number.parseInt(d[0],16)&8?"00"+d:d,r=d=>{let c=d.toString(16);return c.length&1?`0${c}`:c},n=t(r(e.s)),o=t(r(e.r)),i=n.length/2,s=o.length/2,a=r(i),u=r(s);return`30${r(s+i+4)}02${u}${o}02${a}${n}`}},Tr=BigInt(0),Pt=BigInt(1),xO=BigInt(2),om=BigInt(3),vO=BigInt(4);function Dw(e){let t=Cw(e),{Fp:r}=t,n=t.toBytes||((k,T,R)=>{let P=T.toAffine();return qo(Uint8Array.from([4]),r.toBytes(P.x),r.toBytes(P.y))}),o=t.fromBytes||(k=>{let T=k.subarray(1),R=r.fromBytes(T.subarray(0,r.BYTES)),P=r.fromBytes(T.subarray(r.BYTES,2*r.BYTES));return{x:R,y:P}});function i(k){let{a:T,b:R}=t,P=r.sqr(k),b=r.mul(P,k);return r.add(r.add(b,r.mul(k,T)),R)}if(!r.eql(r.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function s(k){return typeof k=="bigint"&&Tr<k&&k<t.n}function a(k){if(!s(k))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(k){let{allowedPrivateKeyLengths:T,nByteLength:R,wrapPrivateKey:P,n:b}=t;if(T&&typeof k!="bigint"){if(an(k)&&(k=Dn(k)),typeof k!="string"||!T.includes(k.length))throw new Error("Invalid key");k=k.padStart(R*2,"0")}let C;try{C=typeof k=="bigint"?k:Er(vt("private key",k,R))}catch{throw new Error(`private key must be ${R} bytes, hex or bigint, not ${typeof k}`)}return P&&(C=nt(C,b)),a(C),C}let d=new Map;function c(k){if(!(k instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(T,R,P){if(this.px=T,this.py=R,this.pz=P,T==null||!r.isValid(T))throw new Error("x required");if(R==null||!r.isValid(R))throw new Error("y required");if(P==null||!r.isValid(P))throw new Error("z required")}static fromAffine(T){let{x:R,y:P}=T||{};if(!T||!r.isValid(R)||!r.isValid(P))throw new Error("invalid affine point");if(T instanceof f)throw new Error("projective point not allowed");let b=C=>r.eql(C,r.ZERO);return b(R)&&b(P)?f.ZERO:new f(R,P,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(T){let R=r.invertBatch(T.map(P=>P.pz));return T.map((P,b)=>P.toAffine(R[b])).map(f.fromAffine)}static fromHex(T){let R=f.fromAffine(o(vt("pointHex",T)));return R.assertValidity(),R}static fromPrivateKey(T){return f.BASE.multiply(u(T))}_setWindowSize(T){this._WINDOW_SIZE=T,d.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:T,y:R}=this.toAffine();if(!r.isValid(T)||!r.isValid(R))throw new Error("bad point: x or y not FE");let P=r.sqr(R),b=i(T);if(!r.eql(P,b))throw new Error("bad point: equation left != right");
8if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:T}=this.toAffine();if(r.isOdd)return!r.isOdd(T);throw new Error("Field doesn't support isOdd")}equals(T){c(T);let{px:R,py:P,pz:b}=this,{px:C,py:F,pz:L}=T,U=r.eql(r.mul(R,L),r.mul(C,b)),N=r.eql(r.mul(P,L),r.mul(F,b));return U&&N}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){let{a:T,b:R}=t,P=r.mul(R,om),{px:b,py:C,pz:F}=this,L=r.ZERO,U=r.ZERO,N=r.ZERO,l=r.mul(b,b),p=r.mul(C,C),y=r.mul(F,F),h=r.mul(b,C);return h=r.add(h,h),N=r.mul(b,F),N=r.add(N,N),L=r.mul(T,N),U=r.mul(P,y),U=r.add(L,U),L=r.sub(p,U),U=r.add(p,U),U=r.mul(L,U),L=r.mul(h,L),N=r.mul(P,N),y=r.mul(T,y),h=r.sub(l,y),h=r.mul(T,h),h=r.add(h,N),N=r.add(l,l),l=r.add(N,l),l=r.add(l,y),l=r.mul(l,h),U=r.add(U,l),y=r.mul(C,F),y=r.add(y,y),l=r.mul(y,h),L=r.sub(L,l),N=r.mul(y,p),N=r.add(N,N),N=r.add(N,N),new f(L,U,N)}add(T){c(T);let{px:R,py:P,pz:b}=this,{px:C,py:F,pz:L}=T,U=r.ZERO,N=r.ZERO,l=r.ZERO,p=t.a,y=r.mul(t.b,om),h=r.mul(R,C),m=r.mul(P,F),v=r.mul(b,L),I=r.add(R,P),g=r.add(C,F);I=r.mul(I,g),g=r.add(h,m),I=r.sub(I,g),g=r.add(R,b);let x=r.add(C,L);return g=r.mul(g,x),x=r.add(h,v),g=r.sub(g,x),x=r.add(P,b),U=r.add(F,L),x=r.mul(x,U),U=r.add(m,v),x=r.sub(x,U),l=r.mul(p,g),U=r.mul(y,v),l=r.add(U,l),U=r.sub(m,l),l=r.add(m,l),N=r.mul(U,l),m=r.add(h,h),m=r.add(m,h),v=r.mul(p,v),g=r.mul(y,g),m=r.add(m,v),v=r.sub(h,v),v=r.mul(p,v),g=r.add(g,v),h=r.mul(m,g),N=r.add(N,h),h=r.mul(x,g),U=r.mul(I,U),U=r.sub(U,h),h=r.mul(I,m),l=r.mul(x,l),l=r.add(l,h),new f(U,N,l)}subtract(T){return this.add(T.negate())}is0(){return this.equals(f.ZERO)}wNAF(T){return w.wNAFCached(this,d,T,R=>{let P=r.invertBatch(R.map(b=>b.pz));return R.map((b,C)=>b.toAffine(P[C])).map(f.fromAffine)})}multiplyUnsafe(T){let R=f.ZERO;if(T===Tr)return R;if(a(T),T===Pt)return this;let{endo:P}=t;if(!P)return w.unsafeLadder(this,T);let{k1neg:b,k1:C,k2neg:F,k2:L}=P.splitScalar(T),U=R,N=R,l=this;for(;C>Tr||L>Tr;)C&Pt&&(U=U.add(l)),L&Pt&&(N=N.add(l)),l=l.double(),C>>=Pt,L>>=Pt;return b&&(U=U.negate()),F&&(N=N.negate()),N=new f(r.mul(N.px,P.beta),N.py,N.pz),U.add(N)}multiply(T){a(T);let R=T,P,b,{endo:C}=t;if(C){let{k1neg:F,k1:L,k2neg:U,k2:N}=C.splitScalar(R),{p:l,f:p}=this.wNAF(L),{p:y,f:h}=this.wNAF(N);l=w.constTimeNegate(F,l),y=w.constTimeNegate(U,y),y=new f(r.mul(y.px,C.beta),y.py,y.pz),P=l.add(y),b=p.add(h)}else{let{p:F,f:L}=this.wNAF(R);P=F,b=L}return f.normalizeZ([P,b])[0]}multiplyAndAddUnsafe(T,R,P){let b=f.BASE,C=(L,U)=>U===Tr||U===Pt||!L.equals(b)?L.multiplyUnsafe(U):L.multiply(U),F=C(this,R).add(C(T,P));return F.is0()?void 0:F}toAffine(T){let{px:R,py:P,pz:b}=this,C=this.is0();T==null&&(T=C?r.ONE:r.inv(b));let F=r.mul(R,T),L=r.mul(P,T),U=r.mul(b,T);if(C)return{x:r.ZERO,y:r.ZERO};if(!r.eql(U,r.ONE))throw new Error("invZ was invalid");return{x:F,y:L}}isTorsionFree(){let{h:T,isTorsionFree:R}=t;if(T===Pt)return!0;if(R)return R(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:T,clearCofactor:R}=t;return T===Pt?this:R?R(f,this):this.multiplyUnsafe(t.h)}toRawBytes(T=!0){return this.assertValidity(),n(f,this,T)}toHex(T=!0){return Dn(this.toRawBytes(T))}}f.BASE=new f(t.Gx,t.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);let _=t.nBitLength,w=nm(f,t.endo?Math.ceil(_/2):_);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:u,weierstrassEquation:i,isWithinCurveOrder:s}}function Hw(e){let t=Pf(e);return un(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze(B({lowS:!0},t))}function im(e){let t=Hw(e),{Fp:r,n}=t,o=r.BYTES+1,i=2*r.BYTES+1;function s(g){return Tr<g&&g<r.ORDER}function a(g){return nt(g,n)}function u(g){return eu(g,n)}let{ProjectivePoint:d,normPrivateKeyToScalar:c,weierstrassEquation:f,isWithinCurveOrder:_}=Dw(Z(B({},t),{toBytes(g,x,E){let A=x.toAffine(),O=r.toBytes(A.x),H=qo;return E?H(Uint8Array.from([x.hasEvenY()?2:3]),O):H(Uint8Array.from([4]),O,r.toBytes(A.y))},fromBytes(g){let x=g.length,E=g[0],A=g.subarray(1);if(x===o&&(E===2||E===3)){let O=Er(A);if(!s(O))throw new Error("Point is not on curve");let H=f(O),$;try{$=r.sqrt(H)}catch(ve){let ce=ve instanceof Error?": "+ve.message:"";throw new Error("Point is not on curve"+ce)}let re=($&Pt)===Pt;return(E&1)===1!==re&&($=r.neg($)),{x:O,y:$}}else if(x===i&&E===4){let O=r.fromBytes(A.subarray(0,r.BYTES)),H=r.fromBytes(A.subarray(r.BYTES,2*r.BYTES));return{x:O,y:H}}else throw new Error(`Point of length ${x}
8 was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}})),w=g=>Dn(cn(g,t.nByteLength));function k(g){let x=n>>Pt;return g>x}function T(g){return k(g)?a(-g):g}let R=(g,x,E)=>Er(g.slice(x,E));class P{constructor(x,E,A){this.r=x,this.s=E,this.recovery=A,this.assertValidity()}static fromCompact(x){let E=t.nByteLength;return x=vt("compactSignature",x,E*2),new P(R(x,0,E),R(x,E,2*E))}static fromDER(x){let{r:E,s:A}=Un.toSig(vt("DER",x));return new P(E,A)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(x){return new P(this.r,this.s,x)}recoverPublicKey(x){let{r:E,s:A,recovery:O}=this,H=N(vt("msgHash",x));if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");let $=O===2||O===3?E+t.n:E;if($>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let re=(O&1)===0?"02":"03",xe=d.fromHex(re+w($)),ve=u($),ce=a(-H*ve),pe=a(A*ve),ke=d.BASE.multiplyAndAddUnsafe(xe,ce,pe);if(!ke)throw new Error("point at infinify");return ke.assertValidity(),ke}hasHighS(){return k(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Hn(this.toDERHex())}toDERHex(){return Un.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Hn(this.toCompactHex())}toCompactHex(){return w(this.r)+w(this.s)}}let b={isValidPrivateKey(g){try{return c(g),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{let g=Sf(t.n);return rm(t.randomBytes(g),t.n)},precompute(g=8,x=d.BASE){return x._setWindowSize(g),x.multiply(BigInt(3)),x}};function C(g,x=!0){return d.fromPrivateKey(g).toRawBytes(x)}function F(g){let x=an(g),E=typeof g=="string",A=(x||E)&&g.length;return x?A===o||A===i:E?A===2*o||A===2*i:g instanceof d}function L(g,x,E=!0){if(F(g))throw new Error("first arg must be private key");if(!F(x))throw new Error("second arg must be public key");return d.fromHex(x).multiply(c(g)).toRawBytes(E)}let U=t.bits2int||function(g){let x=Er(g),E=g.length*8-t.nBitLength;return E>0?x>>BigInt(E):x},N=t.bits2int_modN||function(g){return a(U(g))},l=ks(t.nBitLength);function p(g){if(typeof g!="bigint")throw new Error("bigint expected");if(!(Tr<=g&&g<l))throw new Error(`bigint expected < 2^${t.nBitLength}`);return cn(g,t.nByteLength)}function y(g,x,E=h){if(["recovered","canonical"].some(Ht=>Ht in E))throw new Error("sign() legacy options not supported");let{hash:A,randomBytes:O}=t,{lowS:H,prehash:$,extraEntropy:re}=E;H==null&&(H=!0),g=vt("msgHash",g),$&&(g=vt("prehashed msgHash",A(g)));let xe=N(g),ve=c(x),ce=[p(ve),p(xe)];if(re!=null&&re!==!1){let Ht=re===!0?O(r.BYTES):re;ce.push(vt("extraEntropy",Ht))}let pe=qo(...ce),ke=xe;function Nr(Ht){let Xt=U(Ht);if(!_(Xt))return;let ht=u(Xt),Ye=d.BASE.multiply(Xt).toAffine(),Ue=a(Ye.x);if(Ue===Tr)return;let Fe=a(ht*a(ke+Ue*ve));if(Fe===Tr)return;let Pe=(Ye.x===Ue?0:2)|Number(Ye.y&Pt),Cl=Fe;return H&&k(Fe)&&(Cl=T(Fe),Pe^=1),new P(Ue,Cl,Pe)}return{seed:pe,k2sig:Nr}}let h={lowS:t.lowS,prehash:!1},m={lowS:t.lowS,prehash:!1};function v(g,x,E=h){let{seed:A,k2sig:O}=y(g,x,E),H=t;return Ef(H.hash.outputLen,H.nByteLength,H.hmac)(A,O)}d.BASE._setWindowSize(8);function I(g,x,E,A=m){let O=g;if(x=vt("msgHash",x),E=vt("publicKey",E),"strict"in A)throw new Error("options.strict was renamed to lowS");let{lowS:H,prehash:$}=A,re,xe;try{if(typeof O=="string"||an(O))try{re=P.fromDER(O)}catch(Ye){if(!(Ye instanceof Un.Err))throw Ye;re=P.fromCompact(O)}else if(typeof O=="object"&&typeof O.r=="bigint"&&typeof O.s=="bigint"){let{r:Ye,s:Ue}=O;re=new P(Ye,Ue)}else throw new Error("PARSE");xe=d.fromHex(E)}catch(Ye){if(Ye.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(H&&re.hasHighS())return!1;$&&(x=t.hash(x));let{r:ve,s:ce}=re,pe=N(x),ke=u(ce),Nr=a(pe*ke),Ht=a(ve*ke),Xt=d.BASE.multiplyAndAddUnsafe(xe,Nr,Ht)?.toAffine();return Xt?a(Xt.x)===ve:!1}return{CURVE:t,getPublicKey:C,getSharedSecret:L,sign:v,verify:I,ProjectivePoint:d,Signature:P,utils:b}}function Fw(e){return{hash:e,hmac:(t,...r)=>Rs(e,t,Mn(...r)),randomBytes:Dp}}function sm(e,t){let r=n=>im(B(B({},e),Fw(n)));return Object.freeze(Z(B({},r(t)),{create:r}))}var um=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),am=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Uw=BigInt(1),Bf=BigInt(2),cm=(e,t)=>(e+t/Bf)/t;function $w(e){let t=um,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),d=e*e*e%t,c=d*d*e%t,f=bt(c,r,t)*c%t,_=bt(f,r,t)*c%t,w=bt(_,Bf,t)*d%t,k=bt(w,o,t)*w%t,T=bt(k,i,t)*k%t,R=bt(T,a,t)*T%t,P=bt(R,u,t)*R%t,b=bt(P,a,t)*T%t,C=bt(b,r,t)*c%t,F=bt(C,s,t)*k%t,L=bt(F,n,t)*d%t,U=bt(L,Bf,t);if(!Nf.eql(Nf.sqr(U),e))throw new Error("Cannot find square root");return U}var Nf=em(um,void 0,void 0,{sqrt:$w}),Ps=sm({a:BigInt(0),b:BigInt(7),Fp:Nf,n:am,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=am,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Uw*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,s=BigInt("0x100000000000000000000000000000000"),a=cm(i*e,t),u=cm(-n*e,t),d=nt(e-a*r-u*o,t),c=nt(-a*n-u*i,t),f=d>s,_=c>s;if(f&&(d=t-d),_&&(c=t-c),d>
8s||c>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:d,k2neg:_,k2:c}}}},Ln),PO=BigInt(0);var BO=Ps.ProjectivePoint;var Cf,_t=(Cf=Ps)!==null&&Cf!==void 0?Cf:Of,Mf=BigInt("0xffffffffffffffff"),Ar=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),jw=_t.CURVE.n,dm=jw/BigInt(2);var fm={type:"object",required:["crypto","id","version","address"],properties:{crypto:{type:"object",required:["cipher","ciphertext","cipherparams","kdf","kdfparams","mac"],properties:{cipher:{type:"string"},ciphertext:{type:"string"},cipherparams:{type:"object"},kdf:{type:"string"},kdfparams:{type:"object"},salt:{type:"string"},mac:{type:"string"}}},id:{type:"string"},version:{type:"number"},address:{type:"string"}}};var Bs=(function(e){return e[e.Mainnet=1]="Mainnet",e[e.Goerli=5]="Goerli",e[e.Sepolia=11155111]="Sepolia",e})(Bs||{}),Te=(function(e){return e.Chainstart="chainstart",e.Homestead="homestead",e.Dao="dao",e.TangerineWhistle="tangerineWhistle",e.SpuriousDragon="spuriousDragon",e.Byzantium="byzantium",e.Constantinople="constantinople",e.Petersburg="petersburg",e.Istanbul="istanbul",e.MuirGlacier="muirGlacier",e.Berlin="berlin",e.London="london",e.ArrowGlacier="arrowGlacier",e.GrayGlacier="grayGlacier",e.MergeForkIdTransition="mergeForkIdTransition",e.Merge="merge",e.Shanghai="shanghai",e.ShardingForkDev="shardingFork",e})(Te||{});var ot=(function(e){return e.PolygonMainnet="polygon-mainnet",e.PolygonMumbai="polygon-mumbai",e.ArbitrumRinkebyTestnet="arbitrum-rinkeby-testnet",e.ArbitrumOne="arbitrum-one",e.xDaiChain="x-dai-chain",e.OptimisticKovan="optimistic-kovan",e.OptimisticEthereum="optimistic-ethereum",e})(ot||{});var wt=(function(e){return e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Uint8Array=2]="Uint8Array",e[e.PrefixedHexString=3]="PrefixedHexString",e})(wt||{});var lm=e=>{if(typeof e!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof e}`);return Tc(e)?e.slice(2):e};function Gw(e){return!e||e==="0x0"?"0x0000000000000000":Tc(e)?`0x${lm(e).padStart(16,"0")}`:`0x${e.padStart(16,"0")}`}var hm=function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`};function qw(e,t=!0){var r,n;let{name:o,config:i,difficulty:s,mixHash:a,gasLimit:u,coinbase:d,baseFeePerGas:c}=e,{extraData:f,timestamp:_,nonce:w}=e,k=Number(_),{chainId:T}=i;if(f===""&&(f="0x"),Tc(_)||(_=hm(parseInt(_))),w.length!==18&&(w=Gw(w)),i.eip155Block!==i.eip158Block)throw new Error("EIP155 block number must equal EIP 158 block number since both are part of SpuriousDragon hardfork and the client only supports activating the full hardfork");let R={name:o,chainId:T,networkId:T,genesis:{timestamp:_,gasLimit:parseInt(u),difficulty:parseInt(s),nonce:w,extraData:f,mixHash:a,coinbase:d,baseFeePerGas:c},hardfork:void 0,hardforks:[],bootstrapNodes:[],consensus:i.clique!==void 0?{type:"poa",algorithm:"clique",clique:{period:(r=i.clique.period)!==null&&r!==void 0?r:i.clique.blockperiodseconds,epoch:(n=i.clique.epoch)!==null&&n!==void 0?n:i.clique.epochlength}}:{type:"pow",algorithm:"ethash",ethash:{}}},P={[Te.Homestead]:{name:"homesteadBlock"},[Te.Dao]:{name:"daoForkBlock"},[Te.TangerineWhistle]:{name:"eip150Block"},[Te.SpuriousDragon]:{name:"eip155Block"},[Te.Byzantium]:{name:"byzantiumBlock"},[Te.Constantinople]:{name:"constantinopleBlock"},[Te.Petersburg]:{name:"petersburgBlock"},[Te.Istanbul]:{name:"istanbulBlock"},[Te.MuirGlacier]:{name:"muirGlacierBlock"},[Te.Berlin]:{name:"berlinBlock"},[Te.London]:{name:"londonBlock"},[Te.MergeForkIdTransition]:{name:"mergeForkBlock",postMerge:t},[Te.Shanghai]:{name:"shanghaiTime",postMerge:!0,isTimestamp:!0},[Te.ShardingForkDev]:{name:"shardingForkTime",postMerge:!0,isTimestamp:!0}},b=Object.keys(P).reduce((L,U)=>(L[P[U].name]=U,L),{}),C=Object.keys(i).filter(L=>b[L]!==void 0&&i[L]!==void 0&&i[L]!==null);if(R.hardforks=C.map(L=>({name:b[L],block:P[b[L]].isTimestamp===!0||typeof i[L]!="number"?null:i[L],timestamp:P[b[L]].isTimestamp===!0&&typeof i[L]=="number"?i[L]:void 0})).filter(L=>L.block!==null||L.timestamp!==void 0),R.hardforks.sort((L,U)=>{var N,l;return((N=L.block)!==null&&N!==void 0?N:1/0)-((l=U.block)!==null&&l!==void 0?l:1/0)}),R.hardforks.sort((L,U)=>{var N,l;return((N=L.timestamp)!==null&&N!==void 0?N:k)-((l=U.timestamp)!==null&&l!==void 0?l:k)}),i.terminalTotalDifficulty!==void 0){let L={name:Te.Merge,ttd:i.terminalTotalDifficulty,block:null},U=R.hardforks.findIndex(N=>{var l;return((l=P[N.name])===null||l===void 0?void 0:l.postMerge)===!0});U!==-1?R.hardforks.splice(U,0,L):R.hardforks.push(L)}let F=R.hardforks.length>0?R.hardforks.slice(-1)[0]:void 0;return R.hardfork=F?.name,R.hardforks.unshift({name:Te.Chainstart,block:0}),R}function pm(e,t,r){try{if(["config","difficulty","gasLimit","alloc"].some(n=>!(n in e)))throw new Error("Invalid format, expected geth genesis fields missing");return t!==void 0&&(e.name=t),qw(e,r)}catch(n){throw new Error(`Error parsing parameters file: ${n.message}`)}}function mm(e){let t=e;if(typeof t!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof t}`);return t.length%2&&(t=`0${t}`),t}var gm=function(e){let t=hm(e);return me(`0x${mm(t.slice(2))}`)},we=function(e){var t;if(e==null)return new Uint8Array;
8if(e instanceof Uint8Array)return e;if(((t=e?.constructor)===null||t===void 0?void 0:t.name)==="Uint8Array"||Array.isArray(e))return Uint8Array.from(e);if(typeof e=="string"){if(!Ec(e))throw new Error(`Cannot convert string to Uint8Array. only supports 0x-prefixed hex strings and this string was given: ${e}`);return me(mm(lm(e)))}if(typeof e=="number")return we(Ie(e));if(typeof e=="bigint"){if(e<BigInt(0))throw new Error(`Cannot convert negative bigint to Uint8Array. Given: ${e}`);let r=e.toString(16);return r.length%2&&(r=`0${r}`),we(`0x${r}`)}if(e.toArray)return Uint8Array.from(e.toArray());throw new Error("invalid type")};function ye(e){let t=Y(e);return BigInt(t==="0x"?0:t)}function Ww(e){return we(`0x${e.toString(16)}`)}var Lf=function(e){return new Uint8Array(e).fill(0)},Vw=function(e,t,r){let n=Lf(t);return r?e.length<t?(n.set(e),n):e.subarray(0,t):e.length<t?(n.set(e,t-e.length),n):e.subarray(-t)};function tu(e){if(!ft(e)){let t=`This method only supports Uint8Array but input was: ${e}`;throw new Error(t)}}var Df=function(e,t){return tu(e),Vw(e,t,!1)};function zw(e){let t=e[0];for(;e.length>0&&t.toString()==="0";)e=e.slice(1),t=e[0];return e}var Wo=function(e){return tu(e),zw(e)},Se=e=>`0x${e.toString(16)}`;function he(e){return Wo(Ww(e))}function Kw(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===void 0?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function Zw(e){return e===BigInt(0)||e===BigInt(1)}var Vo=function(e,t,r,n,o){let i=Kw(t,o);if(!Zw(i))throw new Error("Invalid signature v value");return new _t.Signature(ye(r),ye(n)).addRecoveryBit(Number(i)).recoverPublicKey(e).toRawBytes(!1).slice(1)};function $n(e,t){if(e===null)return null;if(e===void 0)return;if(typeof e=="string"&&!Ec(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if(typeof e=="number"&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");let r=we(e);switch(t){case wt.Uint8Array:return r;case wt.BigInt:return ye(r);case wt.Number:{let n=ye(r);if(n>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(n)}case wt.PrefixedHexString:return Y(r);default:throw new Error("unknown outputType")}}var vm=[],bm=[],_m=[],Xw=BigInt(0),Ns=BigInt(1),Jw=BigInt(2),Yw=BigInt(7),Qw=BigInt(256),eE=BigInt(113);for(let e=0,t=Ns,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],vm.push(2*(5*n+r)),bm.push((e+1)*(e+2)/2%64);let o=Xw;for(let i=0;i<7;i++)t=(t<<Ns^(t>>Yw)*eE)%Qw,t&Jw&&(o^=Ns<<(Ns<<BigInt(i))-Ns);_m.push(o)}var[tE,rE]=lf(_m,!0),ym=(e,t,r)=>r>32?mf(e,t,r):hf(e,t,r),xm=(e,t,r)=>r>32?gf(e,t,r):pf(e,t,r);function nE(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,u=(s+2)%10,d=r[u],c=r[u+1],f=ym(d,c,1)^r[a],_=xm(d,c,1)^r[a+1];for(let w=0;w<50;w+=10)e[s+w]^=f,e[s+w+1]^=_}let o=e[2],i=e[3];for(let s=0;s<24;s++){let a=bm[s],u=ym(o,i,a),d=xm(o,i,a),c=vm[s];o=e[c],i=e[c+1],e[c]=u,e[c+1]=d}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)r[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=tE[n],e[1]^=rE[n]}r.fill(0)}var ru=class e extends tn{constructor(t,r,n,o=!1,i=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Je(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Do(this.state)}keccak(){Ho||Fo(this.state32),nE(this.state32,this.rounds),Ho||Fo(this.state32),this.posOut=0,this.pos=0}update(t){or(this);let{blockLen:r,state:n}=this;t=Vt(t);let o=t.length;for(let i=0;i<o;){let s=Math.min(r-this.pos,o-i);for(let a=0;a<s;a++)n[this.pos++]^=t[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:o}=this;t[n]^=r,(r&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){or(this,!1),_r(t),this.finish();let r=this.state,{blockLen:n}=this;for(let o=0,i=t.length;o<i;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,i-o);t.set(r.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Je(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(As(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:r,suffix:n,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new e(r,n,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}},dn=(e,t,r)=>Uo(()=>new ru(t,e,r)),zO=dn(6,144,224/8),KO=dn(6,136,256/8),ZO=dn(6,104,384/8),XO=dn(6,72,512/8),wm=dn(1,144,224/8),Hf=dn(1,136,256/8),Em=dn(1,104,384/8),Tm=dn(1,72,512/8),Am=(e,t,r)=>Lp((n={})=>new ru(t,e,n.dkLen===void 0?r:n.dkLen,!0)),JO=Am(31,168,128/8),YO=Am(31,136,256/8);var rC=Is(wm),ct=(()=>{let e=Is(Hf);return e.create=Hf.create,e})(),nC=Is(Em),oC=Is(Tm);var uu=to(ou(),1);var A0=to(Mm(),1);var Lm={name:"goerli",chainId:5,networkId:5,defaultHardfork:"merge",consensus:{type:"poa",algorithm:"clique",clique:{period:15,epoch:3e4}},comment:"Cross-client PoA test network",url:"https://github.com/goerli/testnet",genesis:{timestamp:"0x5c51a607",gasLimit:10485760,difficulty:1,nonce:"0x0000000000000000",extraData:"0x22466c6578692069732061207468696e6722202d204166726900000000000000e0a2bd4258d2768837baa26a28fe71dc079f84c70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"},hardforks:[{name:"chainstart",block:0,forkHash:"0xa3f5ab08"},{name:"homestead",block:0,forkHash:"0xa3f5ab08"},{name:"tangerineWhistle",block:0,forkHash:"0xa3f5ab08"},{name:"spuriousDragon",block:0,forkHash:"0xa3f5ab08"},{name:"byzantium",block:0,forkHash:"0xa3f5ab08"},{name:"constantinople",block:0,forkHash:"0xa3f5ab08"},{name:"petersburg",block:0,forkHash:"0xa3f5ab08"},{name:"istanbul",block:1561651,forkHash:"0xc25efa5c"},{name:"berlin",block:4460644,forkHash:"0x757a1c47"},{name:"london",block:5062605,forkHash:"0xb8c6299d"}
vendor: 4,652 bytes, line 8
8,{"//_comment":"The forkHash will remain same as mergeForkIdTransition is post merge, terminal block: https://goerli.etherscan.io/block/7382818",name:"merge",ttd:"10790000",block:7382819,forkHash:"0xb8c6299d"},{name:"mergeForkIdTransition",block:null,forkHash:null},{name:"shanghai",block:null,forkHash:null}],bootstrapNodes:[],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.goerli.ethdisco.net"]};var Dm={name:"mainnet",chainId:1,networkId:1,defaultHardfork:"merge",consensus:{type:"pow",algorithm:"ethash",ethash:{}},comment:"The Ethereum main chain",url:"https://ethstats.net/",genesis:{gasLimit:5e3,difficulty:17179869184,nonce:"0x0000000000000042",extraData:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"},hardforks:[{name:"chainstart",block:0,forkHash:"0xfc64ec04"},{name:"homestead",block:115e4,forkHash:"0x97c2c34c"},{name:"dao",block:192e4,forkHash:"0x91d1f948"},{name:"tangerineWhistle",block:2463e3,forkHash:"0x7a64da13"},{name:"spuriousDragon",block:2675e3,forkHash:"0x3edd5b10"},{name:"byzantium",block:437e4,forkHash:"0xa00bc324"},{name:"constantinople",block:728e4,forkHash:"0x668db0af"},{name:"petersburg",block:728e4,forkHash:"0x668db0af"},{name:"istanbul",block:9069e3,forkHash:"0x879d6e30"},{name:"muirGlacier",block:92e5,forkHash:"0xe029e991"},{name:"berlin",block:12244e3,forkHash:"0x0eb440f6"},{name:"london",block:12965e3,forkHash:"0xb715077d"},{name:"arrowGlacier",block:13773e3,forkHash:"0x20c327fc"},{name:"grayGlacier",block:1505e4,forkHash:"0xf0afd0e3"},{"//_comment":"The forkHash will remain same as mergeForkIdTransition is post merge, terminal block: https://etherscan.io/block/15537393",name:"merge",ttd:"58750000000000000000000",block:15537394,forkHash:"0xf0afd0e3"},{name:"mergeForkIdTransition",block:null,forkHash:null},{name:"shanghai",block:null,forkHash:null}],bootstrapNodes:[],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.mainnet.ethdisco.net"]};var Hm={name:"sepolia",chainId:11155111,networkId:11155111,defaultHardfork:"merge",consensus:{type:"pow",algorithm:"ethash",ethash:{}},comment:"PoW test network to replace Ropsten",url:"https://github.com/ethereum/go-ethereum/pull/23730",genesis:{timestamp:"0x6159af19",gasLimit:3e7,difficulty:131072,nonce:"0x0000000000000000",extraData:"0x5365706f6c69612c20417468656e732c204174746963612c2047726565636521"},hardforks:[{name:"chainstart",block:0,forkHash:"0xfe3366e7"},{name:"homestead",block:0,forkHash:"0xfe3366e7"},{name:"tangerineWhistle",block:0,forkHash:"0xfe3366e7"},{name:"spuriousDragon",block:0,forkHash:"0xfe3366e7"},{name:"byzantium",block:0,forkHash:"0xfe3366e7"},{name:"constantinople",block:0,forkHash:"0xfe3366e7"},{name:"petersburg",block:0,forkHash:"0xfe3366e7"},{name:"istanbul",block:0,forkHash:"0xfe3366e7"},{name:"muirGlacier",block:0,forkHash:"0xfe3366e7"},{name:"berlin",block:0,forkHash:"0xfe3366e7"},{name:"london",block:0,forkHash:"0xfe3366e7"},{"//_comment":"The forkHash will remain same as mergeForkIdTransition is post merge, terminal block: https://sepolia.etherscan.io/block/1450408",name:"merge",ttd:"17000000000000000",block:1450409,forkHash:"0xfe3366e7"},{name:"mergeForkIdTransition",block:1735371,forkHash:"0xb96cbd13"},{name:"shanghai",block:null,timestamp:"1677557088",forkHash:"0xf7f9bc08"}],bootstrapNodes:[],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.sepolia.ethdisco.net"]};var Fm={name:"EIP-1153",number:1153,comment:"Transient Storage",url:"https://eips.ethereum.org/EIPS/eip-1153",status:"Review",minimumHardfork:"chainstart",requiredEIPs:[],gasConfig:{},gasPrices:{tstore:{v:100,d:"Base fee of the TSTORE opcode"},tload:{v:100,d:"Base fee of the TLOAD opcode"}},vm:{},pow:{}};var Um={name:"EIP-1559",number:1559,comment:"Fee market change for ETH 1.0 chain",url:"https://eips.ethereum.org/EIPS/eip-1559",status:"Final",minimumHardfork:"berlin",requiredEIPs:[2930],gasConfig:{baseFeeMaxChangeDenominator:{v:8,d:"Maximum base fee change denominator"},elasticityMultiplier:{v:2,d:"Maximum block gas target elasticity"},initialBaseFee:{v:1e9,d:"Initial base fee on first EIP1559 block"}},gasPrices:{},vm:{},pow:{}};var $m={name:"EIP-2315",number:2315,comment:"Simple subroutines for the EVM",url:"https://eips.ethereum.org/EIPS/eip-2315",status:"Draft",minimumHardfork:"istanbul",gasConfig:{},gasPrices:{beginsub:{v:2,d:"Base fee of the BEGINSUB opcode"},returnsub:{v:5,d:"Base fee of the RETURNSUB opcode"},jumpsub:{v:10,d:"Base fee of the JUMPSUB opcode"}},vm:{},pow:{}};var jm={name:"EIP-2537",number:2537,comment:"BLS12-381 precompiles",url:"https://eips.ethereum.org/EIPS/eip-2537",
8status:"Draft",minimumHardfork:"chainstart",gasConfig:{},gasPrices:{Bls12381G1AddGas:{v:600,d:"Gas cost of a single BLS12-381 G1 addition precompile-call"},Bls12381G1MulGas:{v:12e3,d:"Gas cost of a single BLS12-381 G1 multiplication precompile-call"},Bls12381G2AddGas:{v:4500,d:"Gas cost of a single BLS12-381 G2 addition precompile-call"},Bls12381G2MulGas:{v:55e3,d:"Gas cost of a single BLS12-381 G2 multiplication precompile-call"},Bls12381PairingBaseGas:{v:115e3,d:"Base gas cost of BLS12-381 pairing check"},Bls12381PairingPerPairGas:{v:23e3,d:"Per-pair gas cost of BLS12-381 pairing check"},Bls12381MapG1Gas:{v:5500,d:"Gas cost of BLS12-381 map field element to G1"},Bls12381MapG2Gas:{v:11e4,d:"Gas cost of BLS12-381 map field element to G2"},Bls12381MultiExpGasDiscount:{v:[[1,1200],[2,888],[3,764],[4,641],[5,594],[6,547],[7,500],[8,453],[9,438],[10,423],[11,408],[12,394],[13,379],[14,364],[15,349],[16,334],[17,330],[18,326],[19,322],[20,318],[21,314],[22,310],[23,306],[24,302],[25,298],[26,294],[27,289],[28,285],[29,281],[30,277],[31,273],[32,269],[33,268],[34,266],[35,265],[36,263],[37,262],[38,260],[39,259],[40,257],[41,256],[42,254],[43,253],[44,251],[45,250],[46,248],[47,247],[48,245],[49,244],[50,242],[51,241],[52,239],[53,238],[54,236],[55,235],[56,233],[57,232],[58,231],[59,229],[60,228],[61,226],[62,225],[63,223],[64,222],[65,221],[66,220],[67,219],[68,219],[69,218],[70,217],[71,216],[72,216],[73,215],[74,214],[75,213],[76,213],[77,212],[78,211],[79,211],[80,210],[81,209],[82,208],[83,208],[84,207],[85,206],[86,205],[87,205],[88,204],[89,203],[90,202],[91,202],[92,201],[93,200],[94,199],[95,199],[96,198],[97,197],[98,196],[99,196],[100,195],[101,194],[102,193],[103,193],[104,192],[105,191],[106,191],[107,190],[108,189],[109,188],[110,188],[111,187],[112,186],[113,185],[114,185],[115,184],[116,183],[117,182],[118,182],[119,181],[120,180],[121,179],[122,179],[123,178],[124,177],[125,176],[126,176],[127,175],[128,174]],d:"Discount gas costs of calls to the MultiExp precompiles with `k` (point, scalar) pair"}},vm:{},pow:{}};var Gm={name:"EIP-2565",number:2565,comment:"ModExp gas cost",url:"https://eips.ethereum.org/EIPS/eip-2565",status:"Final",minimumHardfork:"byzantium",gasConfig:{},gasPrices:{modexpGquaddivisor:{v:3,d:"Gquaddivisor from modexp precompile for gas calculation"}},vm:{},pow:{}};var qm={name:"EIP-2718",comment:"Typed Transaction Envelope",url:"https://eips.ethereum.org/EIPS/eip-2718",status:"Final",minimumHardfork:"chainstart",gasConfig:{},gasPrices:{},vm:{},pow:{}};var Wm={name:"EIP-2929",comment:"Gas cost increases for state access opcodes",url:"https://eips.ethereum.org/EIPS/eip-2929",status:"Final",minimumHardfork:"chainstart",gasConfig:{},gasPrices:{coldsload:{v:2100,d:"Gas cost of the first read of storage from a given location (per transaction)"},coldaccountaccess:{v:2600,d:"Gas cost of the first read of a given address (per transaction)"},warmstorageread:{v:100,d:"Gas cost of reading storage locations which have already loaded 'cold'"},sstoreCleanGasEIP2200:{v:2900,d:"Once per SSTORE operation from clean non-zero to something else"},sstoreNoopGasEIP2200:{v:100,d:"Once per SSTORE operation if the value doesn't change"},sstoreDirtyGasEIP2200:{v:100,d:"Once per SSTORE operation if a dirty value is changed"},sstoreInitRefundEIP2200:{v:19900,d:"Once per SSTORE operation for resetting to the original zero value"},sstoreCleanRefundEIP2200:{v:4900,d:"Once per SSTORE operation for resetting to the original non-zero value"},call:{v:0,d:"Base fee of the CALL opcode"},callcode:{v:0,d:"Base fee of the CALLCODE opcode"},delegatecall:{v:0,d:"Base fee of the DELEGATECALL opcode"},staticcall:{v:0,d:"Base fee of the STATICCALL opcode"},balance:{v:0,d:"Base fee of the BALANCE opcode"},extcodesize:{v:0,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:0,d:"Base fee of the EXTCODECOPY opcode"},extcodehash:{v:0,d:"Base fee of the EXTCODEHASH opcode"},sload:{v:0,d:"Base fee of the SLOAD opcode"},sstore:{v:0,d:"Base fee of the SSTORE opcode"}},vm:{},pow:{}};var Vm={name:"EIP-2930",comment:"Optional access lists",url:"https://eips.ethereum.org/EIPS/eip-2930",status:"Final",minimumHardfork:"istanbul",requiredEIPs:[2718,2929],gasConfig:{},gasPrices:{accessListStorageKeyCost:{v:1900,d:"Gas cost per storage key in an Access List transaction"},accessListAddressCost:{v:2400,d:"Gas cost per storage key in an Access List transaction"}},vm:{},pow:{}};var zm={name:"EIP-3198",number:3198,comment:"BASEFEE opcode",url:"https://eips.ethereum.org/EIPS/eip-3198",status:"Final",minimumHardfork:"london",gasConfig:{},gasPrices:{basefee:{v:2,d:"Gas cost of the BASEFEE opcode"}},vm:{},pow:{}};var Km={name:"EIP-3529",comment:"Reduction in refunds",url:"https://eips.ethereum.org/EIPS/eip-3529",status:"Final",minimumHardfork:"berlin",requiredEIPs:[2929],gasConfig:{maxRefundQuotient:{v:5,d:"Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)"}},gasPrices:{selfdestructRefund:{v:0,d:"Refunded following a selfdestruct operation"},sstoreClearRefundEIP2200:{v:4800,d:"Once per SSTORE operation for clearing an originally existing storage slot"}},vm:{},pow:{}};var Zm={name:"EIP-3540",number:3540,comment:"EVM Object Format (EOF) v1",url:"https://eips.ethereum.org/EIPS/eip-3540",status:"Review",minimumHardfork:"london",requiredEIPs:[3541],gasConfig:{},gasPrices:{},vm:{},pow:{}};var Xm={name:"EIP-3541",comment:"Reject new contracts starting with the 0xEF byte",url:"https://eips.ethereum.org/EIPS/eip-3541",status:"Final",minimumHardfork:"berlin",requiredEIPs:[],gasConfig:{},gasPrices:{},vm:{},pow:{}};var Jm={name:"EIP-3554",comment:"Reduction in refunds",url:"Difficulty Bomb Delay to December 1st 2021",status:"Final",minimumHardfork:"muirGlacier",requiredEIPs:[],gasConfig:{},gasPrices:{},vm:{},pow:{difficultyBombDelay:{v:95e5,d:"the amount of blocks to delay the difficulty bomb with"}}};var Ym={name:"EIP-3607",number:3607,comment:"Reject transactions from senders with deployed code",url:"https://eips.ethereum.org/EIPS/eip-3607",status:"Final",minimumHardfork:"chainstart",requiredEIPs:[],gasConfig:{},gasPrices:{},vm:{},pow:{}};var Qm={name:"EIP-3651",number:3198,comment:"Warm COINBASE",url:"https://eips.ethereum.org/EIPS/eip-3651",status:"Review",minimumHardfork:"london",requiredEIPs:[2929],gasConfig:{},gasPrices:{},vm:{},pow:{}};var e0={name:"EIP-3670",number:3670,comment:"EOF - Code Validation",url:"https://eips.ethereum.org/EIPS/eip-3670",status:"Review",minimumHardfork:"london",requiredEIPs:[3540],gasConfig:{},gasPrices:{},vm:{},pow:{}};var t0={name:"EIP-3675",number:3675,comment:"Upgrade consensus to Proof-of-Stake",url:"https://eips.ethereum.org/EIPS/eip-3675",status:"Final",minimumHardfork:"london",requiredEIPs:[],gasConfig:{},gasPrices:{},vm:{},pow:{}};var r0={name:"EIP-3855",number:3855,comment:"PUSH0 instruction",url:"https://eips.ethereum.org/EIPS/eip-3855",status:"Review",minimumHardfork:"chainstart",requiredEIPs:[],gasConfig:{},gasPrices:{push0:{v:2,d:"Base fee of the PUSH0 opcode"}},vm:{},pow:{}};var n0={name:"EIP-3860",number:3860,comment:"Limit and meter initcode",url:"https://eips.ethereum.org/EIPS/eip-3860",status:"Review",minimumHardfork:"spuriousDragon",requiredEIPs:[],gasConfig:{},gasPrices:{initCodeWordCost:{v:2,d:"Gas to pay for each word (32 bytes) of initcode when creating a contract"}},vm:{maxInitCodeSize:{v:49152,d:"Maximum length of initialization code when creating a contract"}},pow:{}};var o0={name:"EIP-4345",number:4345,comment:"Difficulty Bomb Delay to June 2022",url:"https://eips.ethereum.org/EIPS/eip-4345",status:"Final",minimumHardfork:"london",gasConfig:{},gasPrices:{},vm:{},pow:{difficultyBombDelay:{v:107e5,d:"the amount of blocks to delay the difficulty bomb with"}}};var i0={name:"EIP-4399",number:4399,comment:"Supplant DIFFICULTY opcode with PREVRANDAO",url:"https://eips.ethereum.org/EIPS/eip-4399",status:"Review",minimumHardfork:"london",requiredEIPs:[],gasConfig:{},gasPrices:{},vm:{},pow:{}};var s0={name:"EIP-5133",number:5133,comment:"Delaying Difficulty Bomb to mid-September 2022",url:"https://eips.ethereum.org/EIPS/eip-5133",status:"Draft",minimumHardfork:"grayGlacier",gasConfig:{},gasPrices:{},vm:{},pow:{difficultyBombDelay:{v:114e5,d:"the amount of blocks to delay the difficulty bomb with"}}};var jn={1153:Fm,1559:Um,2315:$m,2537:jm,2565:Gm,2718:qm,2929:Wm,2930:Vm,3198:zm,3529:Km,3540:Zm,3541:Xm,3554:Jm,3607:Ym,3651:Qm,3670:e0,3675:t0,3855:r0,3860:n0,4345:o0,4399:i0,5133:s0};var a0={name:"chainstart",comment:"Start of the Ethereum main chain",url:"",status:"",gasConfig:{minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be"},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations"},maxRefundQuotient:{v:2,d:"Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)"}},gasPrices:{base:{v:2,d:"Gas base cost, used e.g. for ChainID opcode (Istanbul)"},tierStep:{v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them"},exp:{v:10,d:"Base fee of the EXP opcode"},expByte:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction"},sha3:{v:30,d:"Base fee of the SHA3 opcode"}
8,sha3Word:{v:6,d:"Once per word of the SHA3 operation's data"},sload:{v:50,d:"Base fee of the SLOAD opcode"},sstoreSet:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero"},sstoreReset:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero"},sstoreRefund:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero"},jumpdest:{v:1,d:"Base fee of the JUMPDEST opcode"},log:{v:375,d:"Base fee of the LOG opcode"},logData:{v:8,d:"Per byte in a LOG* operation's data"},logTopic:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas"},create:{v:32e3,d:"Base fee of the CREATE opcode"},call:{v:40,d:"Base fee of the CALL opcode"},callStipend:{v:2300,d:"Free gas given at beginning of call"},callValueTransfer:{v:9e3,d:"Paid for CALL when the value transfor is non-zero"},callNewAccount:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior"},selfdestructRefund:{v:24e3,d:"Refunded following a selfdestruct operation"},memory:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL"},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation"},createData:{v:200,d:""},tx:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions"},txCreation:{v:32e3,d:"The cost of creating a contract via tx"},txDataZero:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions"},txDataNonZero:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},copy:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added"},ecRecover:{v:3e3,d:""},sha256:{v:60,d:""},sha256Word:{v:12,d:""},ripemd160:{v:600,d:""},ripemd160Word:{v:120,d:""},identity:{v:15,d:""},identityWord:{v:3,d:""},stop:{v:0,d:"Base fee of the STOP opcode"},add:{v:3,d:"Base fee of the ADD opcode"},mul:{v:5,d:"Base fee of the MUL opcode"},sub:{v:3,d:"Base fee of the SUB opcode"},div:{v:5,d:"Base fee of the DIV opcode"},sdiv:{v:5,d:"Base fee of the SDIV opcode"},mod:{v:5,d:"Base fee of the MOD opcode"},smod:{v:5,d:"Base fee of the SMOD opcode"},addmod:{v:8,d:"Base fee of the ADDMOD opcode"},mulmod:{v:8,d:"Base fee of the MULMOD opcode"},signextend:{v:5,d:"Base fee of the SIGNEXTEND opcode"},lt:{v:3,d:"Base fee of the LT opcode"},gt:{v:3,d:"Base fee of the GT opcode"},slt:{v:3,d:"Base fee of the SLT opcode"},sgt:{v:3,d:"Base fee of the SGT opcode"},eq:{v:3,d:"Base fee of the EQ opcode"},iszero:{v:3,d:"Base fee of the ISZERO opcode"},and:{v:3,d:"Base fee of the AND opcode"},or:{v:3,d:"Base fee of the OR opcode"},xor:{v:3,d:"Base fee of the XOR opcode"},not:{v:3,d:"Base fee of the NOT opcode"},byte:{v:3,d:"Base fee of the BYTE opcode"},address:{v:2,d:"Base fee of the ADDRESS opcode"},balance:{v:20,d:"Base fee of the BALANCE opcode"},origin:{v:2,d:"Base fee of the ORIGIN opcode"},caller:{v:2,d:"Base fee of the CALLER opcode"},callvalue:{v:2,d:"Base fee of the CALLVALUE opcode"},calldataload:{v:3,d:"Base fee of the CALLDATALOAD opcode"},calldatasize:{v:2,d:"Base fee of the CALLDATASIZE opcode"},calldatacopy:{v:3,d:"Base fee of the CALLDATACOPY opcode"},codesize:{v:2,d:"Base fee of the CODESIZE opcode"},codecopy:{v:3,d:"Base fee of the CODECOPY opcode"},gasprice:{v:2,d:"Base fee of the GASPRICE opcode"},extcodesize:{v:20,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:20,d:"Base fee of the EXTCODECOPY opcode"},blockhash:{v:20,d:"Base fee of the BLOCKHASH opcode"},coinbase:{v:2,d:"Base fee of the COINBASE opcode"},timestamp:{v:2,d:"Base fee of the TIMESTAMP opcode"},number:{v:2,d:"Base fee of the NUMBER opcode"},difficulty:{v:2,d:"Base fee of the DIFFICULTY opcode"},gaslimit:{v:2,d:"Base fee of the GASLIMIT opcode"},pop:{v:2,d:"Base fee of the POP opcode"},mload:{v:3,d:"Base fee of the MLOAD opcode"},mstore:{v:3,d:"Base fee of the MSTORE opcode"},mstore8:{v:3,d:"Base fee of the MSTORE8 opcode"},sstore:{v:0,d:"Base fee of the SSTORE opcode"},jump:{v:8,d:"Base fee of the JUMP opcode"},jumpi:{v:10,d:"Base fee of the JUMPI opcode"},pc:{v:2,d:"Base fee of the PC opcode"},msize:{v:2,d:"Base fee of the MSIZE opcode"},gas:{v:2,d:"Base fee of the GAS opcode"},push:{v:3,d:"Base fee of the PUSH opcode"},dup:{v:3,d:"Base fee of the DUP opcode"},swap:{v:3,d:"Base fee of the SWAP opcode"},callcode:{v:40,d:"Base fee of the CALLCODE opcode"},return:{v:0,d:"Base fee of the RETURN opcode"},invalid:{v:0,d:"Base fee of the INVALID opcode"},selfdestruct:{v:0,d:"Base fee of the SELFDESTRUCT opcode"}},vm:{stackLimit:{v:1024,d:"Maximum size of VM stack allowed"},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack"},maxExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis"}},pow:{minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be"},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations"},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not"},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},minerReward:{v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},difficultyBombDelay:{v:0,d:"the amount of blocks to delay the difficulty bomb with"}}};var c0={name:"dao",comment:"DAO rescue hardfork",url:"https://eips.ethereum.org/EIPS/eip-779",status:"Final",gasConfig:{},gasPrices:{},vm:{},pow:{}};var u0={name:"homestead",comment:"Homestead hardfork with protocol and network changes",url:"https://eips.ethereum.org/EIPS/eip-606",status:"Final",gasConfig:{},gasPrices:{delegatecall:{v:40,d:"Base fee of the DELEGATECALL opcode"}},vm:{},pow:{}};var d0={name:"tangerineWhistle",comment:"Hardfork with gas cost changes for IO-heavy operations",url:"https://eips.ethereum.org/EIPS/eip-608",status:"Final",gasConfig:{},gasPrices:{sload:{v:200,d:"Once per SLOAD operation"},call:{v:700,d:"Once per CALL operation & message call transaction"},extcodesize:{v:700,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:700,d:"Base fee of the EXTCODECOPY opcode"},balance:{v:400,d:"Base fee of the BALANCE opcode"},delegatecall:{v:700,d:"Base fee of the DELEGATECALL opcode"},callcode:{v:700,d:"Base fee of the CALLCODE opcode"},selfdestruct:{v:5e3,d:"Base fee of the SELFDESTRUCT opcode"}},vm:{},pow:{}};
8var f0={name:"spuriousDragon",comment:"HF with EIPs for simple replay attack protection, EXP cost increase, state trie clearing, contract code size limit",url:"https://eips.ethereum.org/EIPS/eip-607",status:"Final",gasConfig:{},gasPrices:{expByte:{v:50,d:"Times ceil(log256(exponent)) for the EXP instruction"}},vm:{maxCodeSize:{v:24576,d:"Maximum length of contract code"}},pow:{}};var l0={name:"byzantium",comment:"Hardfork with new precompiles, instructions and other protocol changes",url:"https://eips.ethereum.org/EIPS/eip-609",status:"Final",gasConfig:{},gasPrices:{modexpGquaddivisor:{v:20,d:"Gquaddivisor from modexp precompile for gas calculation"},ecAdd:{v:500,d:"Gas costs for curve addition precompile"},ecMul:{v:4e4,d:"Gas costs for curve multiplication precompile"},ecPairing:{v:1e5,d:"Base gas costs for curve pairing precompile"},ecPairingWord:{v:8e4,d:"Gas costs regarding curve pairing precompile input length"},revert:{v:0,d:"Base fee of the REVERT opcode"},staticcall:{v:700,d:"Base fee of the STATICCALL opcode"},returndatasize:{v:2,d:"Base fee of the RETURNDATASIZE opcode"},returndatacopy:{v:3,d:"Base fee of the RETURNDATACOPY opcode"}},vm:{},pow:{minerReward:{v:"3000000000000000000",d:"the amount a miner get rewarded for mining a block"},difficultyBombDelay:{v:3e6,d:"the amount of blocks to delay the difficulty bomb with"}}};var h0={name:"constantinople",comment:"Postponed hardfork including EIP-1283 (SSTORE gas metering changes)",url:"https://eips.ethereum.org/EIPS/eip-1013",status:"Final",gasConfig:{},gasPrices:{netSstoreNoopGas:{v:200,d:"Once per SSTORE operation if the value doesn't change"},netSstoreInitGas:{v:2e4,d:"Once per SSTORE operation from clean zero"},netSstoreCleanGas:{v:5e3,d:"Once per SSTORE operation from clean non-zero"},netSstoreDirtyGas:{v:200,d:"Once per SSTORE operation from dirty"},netSstoreClearRefund:{v:15e3,d:"Once per SSTORE operation for clearing an originally existing storage slot"},netSstoreResetRefund:{v:4800,d:"Once per SSTORE operation for resetting to the original non-zero value"},netSstoreResetClearRefund:{v:19800,d:"Once per SSTORE operation for resetting to the original zero value"},shl:{v:3,d:"Base fee of the SHL opcode"},shr:{v:3,d:"Base fee of the SHR opcode"},sar:{v:3,d:"Base fee of the SAR opcode"},extcodehash:{v:400,d:"Base fee of the EXTCODEHASH opcode"},create2:{v:32e3,d:"Base fee of the CREATE2 opcode"}},vm:{},pow:{minerReward:{v:"2000000000000000000",d:"The amount a miner gets rewarded for mining a block"},difficultyBombDelay:{v:5e6,d:"the amount of blocks to delay the difficulty bomb with"}}};var p0={name:"petersburg",comment:"Aka constantinopleFix, removes EIP-1283, activate together with or after constantinople",url:"https://eips.ethereum.org/EIPS/eip-1716",status:"Final",gasConfig:{},gasPrices:{netSstoreNoopGas:{v:null,d:"Removed along EIP-1283"},netSstoreInitGas:{v:null,d:"Removed along EIP-1283"},netSstoreCleanGas:{v:null,d:"Removed along EIP-1283"},netSstoreDirtyGas:{v:null,d:"Removed along EIP-1283"},netSstoreClearRefund:{v:null,d:"Removed along EIP-1283"},netSstoreResetRefund:{v:null,d:"Removed along EIP-1283"},netSstoreResetClearRefund:{v:null,d:"Removed along EIP-1283"}},vm:{},pow:{}};var m0={name:"istanbul",comment:"HF targeted for December 2019 following the Constantinople/Petersburg HF",url:"https://eips.ethereum.org/EIPS/eip-1679",status:"Final",gasConfig:{},gasPrices:{blake2Round:{v:1,d:"Gas cost per round for the Blake2 F precompile"},ecAdd:{v:150,d:"Gas costs for curve addition precompile"},ecMul:{v:6e3,d:"Gas costs for curve multiplication precompile"},ecPairing:{v:45e3,d:"Base gas costs for curve pairing precompile"},ecPairingWord:{v:34e3,d:"Gas costs regarding curve pairing precompile input length"},txDataNonZero:{v:16,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},sstoreSentryGasEIP2200:{v:2300,d:"Minimum gas required to be present for an SSTORE call, not consumed"},sstoreNoopGasEIP2200:{v:800,d:"Once per SSTORE operation if the value doesn't change"}
8,sstoreDirtyGasEIP2200:{v:800,d:"Once per SSTORE operation if a dirty value is changed"},sstoreInitGasEIP2200:{v:2e4,d:"Once per SSTORE operation from clean zero to non-zero"},sstoreInitRefundEIP2200:{v:19200,d:"Once per SSTORE operation for resetting to the original zero value"},sstoreCleanGasEIP2200:{v:5e3,d:"Once per SSTORE operation from clean non-zero to something else"},sstoreCleanRefundEIP2200:{v:4200,d:"Once per SSTORE operation for resetting to the original non-zero value"},sstoreClearRefundEIP2200:{v:15e3,d:"Once per SSTORE operation for clearing an originally existing storage slot"},balance:{v:700,d:"Base fee of the BALANCE opcode"},extcodehash:{v:700,d:"Base fee of the EXTCODEHASH opcode"},chainid:{v:2,d:"Base fee of the CHAINID opcode"},selfbalance:{v:5,d:"Base fee of the SELFBALANCE opcode"},sload:{v:800,d:"Base fee of the SLOAD opcode"}},vm:{},pow:{}};var g0={name:"muirGlacier",comment:"HF to delay the difficulty bomb",url:"https://eips.ethereum.org/EIPS/eip-2384",status:"Final",gasConfig:{},gasPrices:{},vm:{},pow:{difficultyBombDelay:{v:9e6,d:"the amount of blocks to delay the difficulty bomb with"}}};var y0={name:"berlin",comment:"HF targeted for July 2020 following the Muir Glacier HF",url:"https://eips.ethereum.org/EIPS/eip-2070",status:"Final",eips:[2565,2929,2718,2930]};var x0={name:"london",comment:"HF targeted for July 2021 following the Berlin fork",url:"https://github.com/ethereum/eth1.0-specs/blob/master/network-upgrades/mainnet-upgrades/london.md",status:"Final",eips:[1559,3198,3529,3541]};var v0={name:"shanghai",comment:"Next feature hardfork after the merge hardfork having withdrawals, warm coinbase, push0, limit/meter initcode",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md",status:"Final",eips:[3651,3855,3860,4895]};var b0={name:"arrowGlacier",comment:"HF to delay the difficulty bomb",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md",status:"Final",eips:[4345],gasConfig:{},gasPrices:{},vm:{},pow:{}};var _0={name:"grayGlacier",comment:"Delaying the difficulty bomb to Mid September 2022",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/gray-glacier.md",status:"Draft",eips:[5133],gasConfig:{},gasPrices:{},vm:{},pow:{}};var w0={name:"mergeForkIdTransition",comment:"Pre-merge hardfork to fork off non-upgraded clients",url:"https://eips.ethereum.org/EIPS/eip-3675",status:"Draft",eips:[]};var E0={name:"merge",comment:"Hardfork to upgrade the consensus mechanism to Proof-of-Stake",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/merge.md",status:"Final",consensus:{type:"pos",algorithm:"casper",casper:{}},eips:[3675,4399]};var T0={chainstart:a0,homestead:u0,dao:c0,tangerineWhistle:d0,spuriousDragon:f0,byzantium:l0,constantinople:h0,petersburg:p0,istanbul:m0,muirGlacier:g0,berlin:y0,london:x0,shanghai:v0,arrowGlacier:b0,grayGlacier:_0,mergeForkIdTransition:w0,merge:E0};var{buf:aE}=A0.default,zt=class e extends Sn{static custom(t,r={}){var n;let o=(n=r.baseChain)!==null&&n!==void 0?n:"mainnet",i=Object.assign({},e._getChainParams(o));if(i.name="custom-chain",typeof t!="string")return new e(Object.assign({chain:Object.assign(Object.assign({},i),t)},r));if(t===ot.PolygonMainnet)return e.custom({name:ot.PolygonMainnet,chainId:137,networkId:137},r);if(t===ot.PolygonMumbai)return e.custom({name:ot.PolygonMumbai,chainId:80001,networkId:80001},r);if(t===ot.ArbitrumRinkebyTestnet)return e.custom({name:ot.ArbitrumRinkebyTestnet,chainId:421611,networkId:421611},r);if(t===ot.ArbitrumOne)return e.custom({name:ot.ArbitrumOne,chainId:42161,networkId:42161},r);if(t===ot.xDaiChain)return e.custom({name:ot.xDaiChain,chainId:100,networkId:100},r);if(t===ot.OptimisticKovan)return e.custom({name:ot.OptimisticKovan,chainId:69,networkId:69},Object.assign({hardfork:Te.Berlin},r));if(t===ot.OptimisticEthereum)return e.custom({name:ot.OptimisticEthereum,chainId:10,networkId:10},Object.assign({hardfork:Te.Berlin},r));throw new Error(`Custom chain ${t} not supported`)}static fromGethGenesis(t,{chain:r,eips:n,genesisHash:o,hardfork:i,mergeFor
8kIdPostMerge:s}){var a;let u=pm(t,r,s),d=new e({chain:(a=u.name)!==null&&a!==void 0?a:"custom",customChains:[u],eips:n,hardfork:i??u.hardfork});return o!==void 0&&d.setForkHashes(o),d}static isSupportedChainId(t){return!!this._getInitializedChains().names[t.toString()]}static _getChainParams(t,r){let n=t,o=this._getInitializedChains(r);if(typeof n=="number"||typeof n=="bigint"){if(n=n.toString(),o.names[n]){let i=o.names[n];return o[i]}throw new Error(`Chain with ID ${n} not supported`)}if(o[n]!==void 0)return o[n];throw new Error(`Chain with name ${n} not supported`)}constructor(t){var r,n;super(),this._eips=[],this._customChains=(r=t.customChains)!==null&&r!==void 0?r:[],this._chainParams=this.setChain(t.chain),this.DEFAULT_HARDFORK=(n=this._chainParams.defaultHardfork)!==null&&n!==void 0?n:Te.Merge,this.HARDFORK_CHANGES=this.hardforks().map(o=>[o.name,T0[o.name]]),this._hardfork=this.DEFAULT_HARDFORK,t.hardfork!==void 0&&this.setHardfork(t.hardfork),t.eips&&this.setEIPs(t.eips)}setChain(t){if(typeof t=="number"||typeof t=="bigint"||typeof t=="string")this._chainParams=e._getChainParams(t,this._customChains);else if(typeof t=="object"){if(this._customChains.length>0)throw new Error("Chain must be a string, number, or bigint when initialized with customChains passed in");let r=["networkId","genesis","hardforks","bootstrapNodes"];for(let n of r)if(!(n in t))throw new Error(`Missing required chain parameter: ${n}`);this._chainParams=t}else throw new Error("Wrong input format");for(let r of this.hardforks())if(r.block===void 0)throw new Error("Hardfork cannot have undefined block number");return this._chainParams}setHardfork(t){let r=!1;for(let n of this.HARDFORK_CHANGES)n[0]===t&&(this._hardfork!==t&&(this._hardfork=t,this.emit("hardforkChanged",t)),r=!0);if(!r)throw new Error(`Hardfork with name ${t} not supported`)}getHardforkByBlockNumber(t,r,n){let o=$n(t,wt.BigInt),i=$n(r,wt.BigInt),s=$n(n,wt.Number),a=this.hardforks().filter(w=>w.block!==null||w.ttd!==null&&w.ttd!==void 0||w.timestamp!==void 0),u=a.findIndex(w=>w.ttd!==null&&w.ttd!==void 0);if(a.slice(u+1).findIndex(w=>w.ttd!==null&&w.ttd!==void 0)>=0)throw Error("More than one merge hardforks found with ttd specified");let c=a.findIndex(w=>w.block!==null&&w.block>o||s!==void 0&&Number(w.timestamp)>s);if(c===-1)c=a.length;else if(c===0)throw Error("Must have at least one hardfork at block 0");if(s===void 0){let w=a.slice(0,c).reverse().findIndex(k=>k.block!==null||k.ttd!==void 0);c-=w}if(c-=1,a[c].block===null&&a[c].timestamp===void 0)(i==null||BigInt(a[c].ttd)>i)&&(c-=1);else if(u>=0&&i!==void 0&&i!==null){if(c>=u&&BigInt(a[u].ttd)>i)throw Error("Maximum HF determined by total difficulty is lower than the block number HF");if(c<u&&BigInt(a[u].ttd)<=i)throw Error("HF determined by block number is lower than the minimum total difficulty HF")}let f=c;for(;c<a.length-1&&!(a[c].block!==a[c+1].block||a[c].timestamp!==a[c+1].timestamp);c+=1);if(s){if(a.slice(0,f).reduce((T,R)=>{var P;return Math.max(Number((P=R.timestamp)!==null&&P!==void 0?P:"0"),T)},0)>s)throw Error("Maximum HF determined by timestamp is lower than the block number/ttd HF");if(a.slice(c+1).reduce((T,R)=>{var P;return Math.min(Number((P=R.timestamp)!==null&&P!==void 0?P:s),T)},s)<s)throw Error("Maximum HF determined by block number/ttd is lower than timestamp HF")}return a[c].name}setHardforkByBlockNumber(t,r,n){let o=this.getHardforkByBlockNumber(t,r,n);return this.setHardfork(o),o}_getHardfork(t){let r=this.hardforks();for(let n of r)if(n.name===t)return n;return null}setEIPs(t=[]){for(let r of t){if(!(r in jn))throw new Error(`${r} not supported`);let n=this.gteHardfork(jn[r].minimumHardfork);if(!n)throw new Error(`${r} cannot be activated on hardfork ${this.hardfork()}, minimumHardfork: ${n}`);if(jn[r].requiredEIPs!==void 0){for(let o of jn[r].requiredEIPs)if(!(t.includes(o)||this.isActivatedEIP(o)))throw new Error(`${r} requires EIP ${o}, but is not included in the EIP list`)}}this._eips=t}param(t,r){let n;for(let o of this._eips)if(n=this.paramByEIP(t,r,o),n!==void 0)return n;return this.paramByHardfork(t,r,this._hardfork)}paramByHardfork(t,r,n){let o=null;for(let i of this.HARDFORK_CHANGES){if("eips"in i[1]){let s=i[1].eips;for(let a of s){let u=this.paramByEIP(t,r,a);o=typeof u=="bigint"?u:o}}else{if(i[1][t]===void 0)throw new Error(`Topic ${t} not defined`);i[1][t][r]!==void 0&&(o=i[1][t][r].v)}if(i[0]===n)break}return BigInt(o??0)}paramByEIP(t,r,n){if(!(n in jn))throw new Error(`${n} not supported`);let o=jn[n];if(!(t in o))throw new Error(`Topic ${t} not defined`);if(o[t][r]===void 0)return;let i=o[t][r].v;return BigInt(i)}paramByBlock(t,r,n,o,i){let s=this.getHardforkByBlockNumber(n,o,i);return this.paramByHardfork(t,r,s)}isActivatedEIP(t){if(this.eips().includes(t))return!0;for(let r of this.HARDFORK_CHANGES){let n=r[1];if(this.gteHardfork(n.name)&&"eips"in n&&n.eips.includes(t))return!0}return!1}hardforkIsActiveOnBlock(t,r){let n=$n(r,wt.BigInt),o=t??this._hardfork,i=this.hardforkBlock(o);return typeof i=="bigint"&&i!==BigInt(0)&&n>=i}activeOnBlock(t){return this.hardforkIsActiveOnBlock(null,t)}hardforkGteHardfork(t,r){let n=t??this._hardfork,o=this.hardforks(),i=-1,s=-1,a=0;for(let u of o)u.name===n&&(i=a),u.name===r&&(s=a),a+=1;return i>=s&&s!==-1}gteHardfork(t){return this.hardforkGteHardfork(null,t)}hardforkBlock(t){var r;let n=t??this._hardfork,o=(r=this._getHardfork(n))===null||r===void 0?void 0:r.block;return o==null?null:BigInt(o)}hardforkTimestamp(t){var r;let n=t??this._hardfork,o=(r=this._getHardfork(n))===null||r===void 0?void 0:r.timestamp;return o==null?null:BigInt(o)}eipBlock(t){for(let r of this.HARDFORK_CHANGES){let n=r[1];if("eips"in n&&n.eips.includes(t))return this.hardforkBlock(typeof r[0]=="number"?String(r[0]):r[0])}return null}hardforkTTD(t){var r;let n=t??this._hardfork,o=(r=this._getHardfork(n))===null||r===void 0?void 0:r.ttd;return o==null?null:BigInt(o)}isHardforkBlock(t,r){let n=$n(t,wt.BigInt),o=r??this._hardfork,i=this.hardforkBlock(o);return typeof i=="bigint"&&i!==BigInt(0)?i===n:!1}
8nextHardforkBlockOrTimestamp(t){var r,n,o;let i=(r=t)!==null&&r!==void 0?r:this._hardfork,s=this.hardforks(),a=s.findIndex(f=>f.name===i);if(i===Te.Merge&&(a-=1),a<0)return null;let u=(n=s[a].timestamp)!==null&&n!==void 0?n:s[a].block;u=u!=null?Number(u):null;let d=s.slice(a+1).find(f=>{var _;let w=(_=f.timestamp)!==null&&_!==void 0?_:f.block;return w=w!=null?Number(w):null,f.name!==Te.Merge&&w!==null&&w!==void 0&&w!==u});if(d===void 0)return null;let c=(o=d.timestamp)!==null&&o!==void 0?o:d.block;return c==null?null:BigInt(c)}nextHardforkBlock(t){var r;let n=(r=t)!==null&&r!==void 0?r:this._hardfork,o=this.hardforkBlock(n);if(o===null&&n===Te.Merge){let s=this.hardforks(),a=s.findIndex(u=>u.ttd!==null&&u.ttd!==void 0);if(a<0)throw Error("Merge hardfork should have been found");o=this.hardforkBlock(s[a-1].name)}return o===null?null:this.hardforks().reduce((s,a)=>{let u=BigInt(a.block===null||a.ttd!==void 0&&a.ttd!==null?0:a.block);return u>o&&s===null?u:s},null)}isNextHardforkBlock(t,r){let n=$n(t,wt.BigInt),o=r??this._hardfork,i=this.nextHardforkBlock(o);return i===null?!1:i===n}_calcForkHash(t,r){let n=new Uint8Array,o=0;for(let a of this.hardforks()){let{block:u,timestamp:d,name:c}=a,f=d??u;if(f=f!==null?Number(f):null,typeof f=="number"&&f!==0&&f!==o&&c!==Te.Merge){let _=me(f.toString(16).padStart(16,"0"));n=Ce(n,_),o=f}if(a.name===t)break}let i=Ce(r,n);return Y(gm(aE(i)>>>0))}forkHash(t,r){let n=t??this._hardfork,o=this._getHardfork(n);if(o===null||o?.block===null&&o?.timestamp===void 0&&o?.ttd===void 0){let i="No fork hash calculation possible for future hardfork";throw new Error(i)}if(o?.forkHash!==null&&o?.forkHash!==void 0)return o.forkHash;if(!r)throw new Error("genesisHash required for forkHash calculation");return this._calcForkHash(n,r)}hardforkForForkHash(t){let r=this.hardforks().filter(n=>n.forkHash===t);return r.length>=1?r[r.length-1]:null}setForkHashes(t){var r;for(let n of this.hardforks()){let o=(r=n.timestamp)!==null&&r!==void 0?r:n.block;(n.forkHash===null||n.forkHash===void 0)&&(o!=null||typeof n.ttd<"u")&&(n.forkHash=this.forkHash(n.name,t))}}genesis(){return this._chainParams.genesis}hardforks(){return this._chainParams.hardforks}bootstrapNodes(){return this._chainParams.bootstrapNodes}dnsNetworks(){return this._chainParams.dnsNetworks}hardfork(){return this._hardfork}chainId(){return BigInt(this._chainParams.chainId)}chainName(){return this._chainParams.name}networkId(){return BigInt(this._chainParams.networkId)}eips(){return this._eips}consensusType(){let t=this.hardfork(),r;for(let n of this.HARDFORK_CHANGES)if("consensus"in n[1]&&(r=n[1].consensus.type),n[0]===t)break;return r??this._chainParams.consensus.type}consensusAlgorithm(){let t=this.hardfork(),r;for(let n of this.HARDFORK_CHANGES)if("consensus"in n[1]&&(r=n[1].consensus.algorithm),n[0]===t)break;return r??this._chainParams.consensus.algorithm}consensusConfig(){var t;let r=this.hardfork(),n;for(let o of this.HARDFORK_CHANGES)if("consensus"in o[1]&&(n=o[1].consensus[o[1].consensus.algorithm]),o[0]===r)break;return(t=n??this._chainParams.consensus[this.consensusAlgorithm()])!==null&&t!==void 0?t:{}}copy(){let t=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return t.removeAllListeners(),t}static _getInitializedChains(t){let r={};for(let[o,i]of Object.entries(Bs))r[i]=o.toLowerCase();let n={mainnet:Dm,goerli:Lm,sepolia:Hm};if(t)for(let o of t){let{name:i}=o;r[o.chainId.toString()]=i,n[i]=o}return n.names=r,n}};var Kt=(function(e){return e[e.EIP155ReplayProtection=155]="EIP155ReplayProtection",e[e.EIP1559FeeMarket=1559]="EIP1559FeeMarket",e[e.EIP2718TypedTransaction=2718]="EIP2718TypedTransaction",e[e.EIP2930AccessLists=2930]="EIP2930AccessLists",e})(Kt||{});function cE(e){if(e.length===0)return!0;let t=e[0];return!!Array.isArray(t)}function I0(e){return!cE(e)}var Ko=class e{constructor(t){if(t.length!==20)throw new Error("Invalid address length");this.buf=t}static zero(){return new e(Lf(20))}equals(t){return Rn(this.buf,t.buf)}isZero(){return this.equals(e.zero())}toString(){return Y(this.buf)}toArray(){return this.buf}static publicToAddress(t,r=!1){let n=t;if(tu(n),r&&n.length!==64&&(n=_t.ProjectivePoint.fromHex(n).toRawBytes(!1).slice(1)),n.length!==64)throw new Error("Expected pubKey to be of length 64");return ct(n).slice(-20)}};var R0=(e,t)=>{let r=e.param("vm","maxInitCodeSize");if(r&&BigInt(t)>r)throw new Error(`the initcode size of this transaction is too large: it is ${t} while the max is ${e.param("vm","maxInitCodeSize")}`)},iu=e=>{let t,r;if(I0(e)){t=e;let n=[];for(let o=0;o<e.length;o+=1){let i=e[o],s=we(i.address),a=[];for(let u=0;u<i.storageKeys.length;u+=1)a.push(we(i.storageKeys[u]));n.push([s,a])}r=n}else{r=e??[];let n=[];for(let o=0;o<r.length;o+=1){let i=r[o],s=Y(i[0]),a=[];for(let d=0;d<i[1].length;d+=1)a.push(Y(i[1][d]));let u={address:s,storageKeys:a};n.push(u)}t=n}return{AccessListJSON:t,accessList:r}},su=e=>{for(let t=0;t<e.length;t+=1){let r=e[t],n=r[0],o=r[1];if(r[2]!==void 0)throw new Error("Access list item cannot have 3 elements. It c
8an only have an address, and an array of storage slots.");if(n.length!==20)throw new Error("Invalid EIP-2930 transaction: address length should be 20 bytes");for(let i=0;i<o.length;i+=1)if(o[i].length!==32)throw new Error("Invalid EIP-2930 transaction: storage slot length should be 32 bytes")}},au=e=>{let t=[];for(let r=0;r<e.length;r+=1){let n=e[r],o={address:Y(Df(n[0],20)),storageKeys:[]},i=n&&n[1];for(let s=0;s<i.length;s+=1){let a=i[s];o.storageKeys.push(Y(Df(a,32)))}t.push(o)}return t},cu=(e,t)=>{let r=t.param("gasPrices","accessListStorageKeyCost"),n=t.param("gasPrices","accessListAddressCost"),o=0;for(let s=0;s<e.length;s+=1){let u=e[s][1];o+=u.length}return e.length*Number(n)+o*Number(r)};var Bt=class{constructor(t,r){var n,o;this.cache={hash:void 0,dataFee:void 0},this.activeCapabilities=[],this.DEFAULT_CHAIN=Bs.Mainnet,this.DEFAULT_HARDFORK=Te.Merge;let{nonce:i,gasLimit:s,to:a,value:u,data:d,v:c,r:f,s:_,type:w}=t;this._type=Number(ye(we(w))),this.txOptions=r;let k=we(a===""?"0x":a),T=we(c===""?"0x":c),R=we(f===""?"0x":f),P=we(_===""?"0x":_);this.nonce=ye(we(i===""?"0x":i)),this.gasLimit=ye(we(s===""?"0x":s)),this.to=k.length>0?new Ko(k):void 0,this.value=ye(we(u===""?"0x":u)),this.data=we(d===""?"0x":d),this.v=T.length>0?ye(T):void 0,this.r=R.length>0?ye(R):void 0,this.s=P.length>0?ye(P):void 0,this._validateCannotExceedMaxInteger({value:this.value,r:this.r,s:this.s}),this._validateCannotExceedMaxInteger({gasLimit:this.gasLimit},64),this._validateCannotExceedMaxInteger({nonce:this.nonce},64,!0);let b=this.to===void 0||this.to===null,C=(n=r.allowUnlimitedInitCodeSize)!==null&&n!==void 0?n:!1,F=(o=r.common)!==null&&o!==void 0?o:this._getCommon();b&&F.isActivatedEIP(3860)&&!C&&R0(F,this.data.length)}get type(){return this._type}supports(t){return this.activeCapabilities.includes(t)}validate(t=!1){let r=[];return this.getBaseFee()>this.gasLimit&&r.push(`gasLimit is too low. given ${this.gasLimit}, need at least ${this.getBaseFee()}`),this.isSigned()&&!this.verifySignature()&&r.push("Invalid Signature"),t?r:r.length===0}_validateYParity(){let{v:t}=this;if(t!==void 0&&t!==BigInt(0)&&t!==BigInt(1)){let r=this._errorMsg("The y-parity of the transaction should either be 0 or 1");throw new Error(r)}}_validateHighS(){let{s:t}=this;if(this.common.gteHardfork("homestead")&&t!==void 0&&t>dm){let r=this._errorMsg("Invalid Signature: s-values greater than secp256k1n/2 are considered invali
8d");throw new Error(r)}}getBaseFee(){let t=this.common.param("gasPrices","tx"),r=this.getDataFee();if(t&&(r+=t),this.common.gteHardfork("homestead")&&this.toCreationAddress()){let n=this.common.param("gasPrices","txCreation");n&&(r+=n)}return r}getDataFee(){let t=this.common.param("gasPrices","txDataZero"),r=this.common.param("gasPrices","txDataNonZero"),n=BigInt(0);for(let o=0;o<this.data.length;o+=1)this.data[o]===0?n+=t:n+=r;if((this.to===void 0||this.to===null)&&this.common.isActivatedEIP(3860)){let o=BigInt(Math.ceil(this.data.length/32)),i=this.common.param("gasPrices","initCodeWordCost")*o;n+=i}return n}toCreationAddress(){return this.to===void 0||this.to.buf.length===0}isSigned(){let{v:t,r,s:n}=this;return!(t===void 0||r===void 0||n===void 0)}verifySignature(){try{let t=this.getSenderPublicKey();return Wo(t).length!==0}catch{return!1}}getSenderAddress(){return new Ko(Ko.publicToAddress(this.getSenderPublicKey()))}sign(t){if(t.length!==32){let u=this._errorMsg("Private key must be 32 bytes in length.");throw new Error(u)}let r=!1;this.type===0&&this.common.gteHardfork("spuriousDragon")&&!this.supports(Kt.EIP155ReplayProtection)&&(this.activeCapabilities.push(Kt.EIP155ReplayProtection),r=!0);let n=this.getMessageToSign(!0),{v:o,r:i,s}=this._ecsign(n,t),a=this._processSignature(o,i,s);if(r){let u=this.activeCapabilities.indexOf(Kt.EIP155ReplayProtection);u>-1&&this.activeCapabilities.splice(u,1)}return a}_getCommon(t,r){var n,o,i,s;if(r!==void 0){let a=ye(we(r));if(t){if(t.chainId()!==a){let u=this._errorMsg("The chain ID does not match the chain ID of Common");throw new Error(u)}return t.copy()}return zt.isSupportedChainId(a)?new zt({chain:a,hardfork:this.DEFAULT_HARDFORK}):zt.custom({name:"custom-chain",networkId:a,chainId:a},{baseChain:this.DEFAULT_CHAIN,hardfork:this.DEFAULT_HARDFORK})}if(t?.copy&&typeof t?.copy=="function")return t.copy();if(t){let a=typeof t.hardfork=="function"?t.hardfork():t.hardfork;return zt.custom({name:"custom-chain",networkId:t.networkId?t.networkId():(o=BigInt((n=t.customChain)===null||n===void 0?void 0:n.networkId))!==null&&o!==void 0?o:void 0,chainId:t.chainId?t.chainId():(s=BigInt((i=t.customChain)===null||i===void 0?void 0:i.chainId))!==null&&s!==void 0?s:void 0},{baseChain:this.DEFAULT_CHAIN,hardfork:a||this.DEFAULT_HARDFORK})}return new zt({chain:this.DEFAULT_CHAIN,hardfork:this.DEFAULT_HARDFORK})}_validateCannotExceedMaxInteger(t,r=256,n=!1){for(let[o,i]of Object.entries(t))switch(r){case 64:if(n){if(i!==void 0&&i>=Mf){let s=this._errorMsg(`${o} cannot equal or exceed MAX_UINT64 (2^64-1), given ${i}`);throw new Error(s)}}else if(i!==void 0&&i>Mf){let s=this._errorMsg(`${o} cannot exceed MAX_UINT64 (2^64-1), given ${i}`);throw new Error(s)}break;case 256:if(n){if(i!==void 0&&i>=Ar){let s=this._errorMsg(`${o} cannot equal or exceed MAX_INTEGER (2^256-1), given ${i}`);throw new Error(s)}}else if(i!==void 0&&i>Ar){let s=this._errorMsg(`${o} cannot exceed MAX_INTEGER (2^256-1), given ${i}`);throw new Error(s)}break;default:{let s=this._errorMsg("unimplemented bits value");throw new Error(s)}}}static _validateNotArray(t){let r=["nonce","gasPrice","gasLimit","to","value","data","v","r","s","type","baseFee","maxFeePerGas","chainId"];for(let[n,o]of Object.entries(t))if(r.includes(n)&&Array.isArray(o))throw new Error(`${n} cannot be an array`)}_getSharedErrorPostfix(){let t="";try{t=this.isSigned()?Y(this.hash()):"not available (unsigned)"}catch{t="error"}let r="";try{r=this.isSigned().toString()}catch{t="error"}let n="";try{n=this.common.hardfork()}catch{n="error"}let o=`tx type=${this.type} hash=${t} nonce=${this.nonce} value=${this.value} `;return o+=`signed=${r} hf=${n}`,o}_ecsign(t,r,n){let o=_t.sign(t,r),i=o.toCompactRawBytes(),s=i.subarray(0,32),a=i.subarray(32,64),u=n===void 0?BigInt(o.recovery+27):BigInt(o.recovery+35)+BigInt(n)*BigInt(2);return{r:s,s:a,v:u}}static fromSerializedTx(t,r={}){}static fromTxData(t,r={}){}};var Wf=2,qf=me(Wf.toString(16).padStart(2,"0")),Zo=class e extends Bt{static fromTxData(t,r={}){return new e(t,r)}static fromSerializedTx(t,r={}){if(!Rn(t.subarray(0,1),qf))throw new Error(`Invalid serialized tx input: not an EIP-1559 transaction (wrong tx type, expected: ${Wf}, received: ${Y(t.subarray(0,1))}`);let n=uu.RLP.decode(t.subarray(1));if(!Array.isArray(n))throw new Error("Invalid serialized tx input: must be array");return e.fromValuesArray(n,r)}static fromValuesArray(t,r={}){if(t.length!==9&&t.length!==12)throw new Error("Invalid EIP-1559 transaction. Only expecting 9 values (for unsigned tx) or 12 values (for signed tx).");let[n,o,i,s,a,u,d,c,f,_,w,k]=t;
8return this._validateNotArray({chainId:n,v:_}),To({nonce:o,maxPriorityFeePerGas:i,maxFeePerGas:s,gasLimit:a,value:d,v:_,r:w,s:k}),new e({chainId:ye(n),nonce:o,maxPriorityFeePerGas:i,maxFeePerGas:s,gasLimit:a,to:u,value:d,data:c,accessList:f??[],v:_!==void 0?ye(_):void 0,r:w,s:k},r)}constructor(t,r={}){var n;super(Object.assign(Object.assign({},t),{type:Wf}),r),this.DEFAULT_HARDFORK="london";let{chainId:o,accessList:i,maxFeePerGas:s,maxPriorityFeePerGas:a}=t;if(this.common=this._getCommon(r.common,o),this.chainId=this.common.chainId(),!this.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");this.activeCapabilities=this.activeCapabilities.concat([1559,2718,2930]);let u=iu(i??[]);if(this.accessList=u.accessList,this.AccessListJSON=u.AccessListJSON,su(this.accessList),this.maxFeePerGas=ye(we(s===""?"0x":s)),this.maxPriorityFeePerGas=ye(we(a===""?"0x":a)),this._validateCannotExceedMaxInteger({maxFeePerGas:this.maxFeePerGas,maxPriorityFeePerGas:this.maxPriorityFeePerGas}),Bt._validateNotArray(t),this.gasLimit*this.maxFeePerGas>Ar){let c=this._errorMsg("gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)");throw new Error(c)}if(this.maxFeePerGas<this.maxPriorityFeePerGas){let c=this._errorMsg("maxFeePerGas cannot be less than maxPriorityFeePerGas (The total must be the larger of the two)");throw new Error(c)}this._validateYParity(),this._validateHighS(),((n=r?.freeze)!==null&&n!==void 0?n:!0)&&Object.freeze(this)}getDataFee(){if(this.cache.dataFee&&this.cache.dataFee.hardfork===this.common.hardfork())return this.cache.dataFee.value;let t=super.getDataFee();return t+=BigInt(cu(this.accessList,this.common)),Object.isFrozen(this)&&(this.cache.dataFee={value:t,hardfork:this.common.hardfork()}),t}getUpfrontCost(t=BigInt(0)){let r=this.maxPriorityFeePerGas,n=this.maxFeePerGas-t,i=(r<n?r:n)+t;return this.gasLimit*i+this.value}raw(){return[he(this.chainId),he(this.nonce),he(this.maxPriorityFeePerGas),he(this.maxFeePerGas),he(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),he(this.value),this.data,this.accessList,this.v!==void 0?he(this.v):Uint8Array.from([]),this.r!==void 0?he(this.r):Uint8Array.from([]),this.s!==void 0?he(this.s):Uint8Array.from([])]}serialize(){let t=this.raw();return Ce(qf,uu.RLP.encode(t))}getMessageToSign(t=!0){let r=this.raw().slice(0,9),n=Ce(qf,uu.RLP.encode(r));return t?ct(n):n}hash(){if(!this.isSigned()){let t=this._errorMsg("Cannot call hash method if transaction is not signed");throw new Error(t)}return Object.isFrozen(this)?(this.cache.hash||(this.cache.hash=ct(this.serialize())),this.cache.hash):ct(this.serialize())}getMessageToVerifySignature(){return this.getMessageToSign()}getSenderPublicKey(){if(!this.isSigned()){let i=this._errorMsg("Cannot call this method if transaction is not signed");throw new Error(i)}let t=this.getMessageToVerifySignature(),{v:r,r:n,s:o}=this;this._validateHighS();try{return Vo(t,r+BigInt(27),he(n),he(o))}catch{let s=this._errorMsg("Invalid Signature");throw new Error(s)}}_processSignature(t,r,n){let o=Object.assign(Object.assign({},this.txOptions),{common:this.common});return e.fromTxData({chainId:this.chainId,nonce:this.nonce,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:t-BigInt(27),r:ye(r),s:ye(n)},o)}toJSON(){let t=au(this.accessList);return{chainId:Se(this.chainId),nonce:Se(this.nonce),maxPriorityFeePerGas:Se(this.maxPriorityFeePerGas),maxFeePerGas:Se(this.maxFeePerGas),gasLimit:Se(this.gasLimit),to:this.to!==void 0?this.to.toString():void 0,value:Se(this.value),data:Y(this.data),accessList:t,v:this.v!==void 0?Se(this.v):void 0,r:this.r!==void 0?Se(this.r):void 0,s:this.s!==void 0?Se(this.s):void 0}}errorStr(){let t=this._getSharedErrorPostfix();return t+=` maxFeePerGas=${this.maxFeePerGas} maxPriorityFeePerGas=${this.maxPriorityFeePerGas}`,t}_errorMsg(t){return`${t} (${this.errorStr()})`}};var du=to(ou(),1);var zf=1,Vf=me(zf.toString(16).padStart(2,"0")),Xo=class e extends Bt{static fromTxData(t,r={}){return new e(t,r)}static fromSerializedTx(t,r={}){if(!Rn(t.subarray(0,1),Vf))throw new Error(`Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: ${zf}, received: ${Y(t.subarray(0,1))}`);let n=du.RLP.decode(Uint8Array.from(t.subarray(1)));if(!Array.isArray(n))throw new Error("Invalid serialized tx input: must be array");return e.fromValuesArray(n,r)}static fromValuesArray(t,r={}){if(t.length!==8&&t.length!==11)throw new Error("Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx).");let[n,o,i,s,a,u,d,c,f,_,w]=t;
8this._validateNotArray({chainId:n,v:f}),To({nonce:o,gasPrice:i,gasLimit:s,value:u,v:f,r:_,s:w});let k=[];return new e({chainId:ye(n),nonce:o,gasPrice:i,gasLimit:s,to:a,value:u,data:d,accessList:c??k,v:f!==void 0?ye(f):void 0,r:_,s:w},r)}constructor(t,r={}){var n;super(Object.assign(Object.assign({},t),{type:zf}),r),this.DEFAULT_HARDFORK="berlin";let{chainId:o,accessList:i,gasPrice:s}=t;if(this.common=this._getCommon(r.common,o),this.chainId=this.common.chainId(),!this.common.isActivatedEIP(2930))throw new Error("EIP-2930 not enabled on Common");this.activeCapabilities=this.activeCapabilities.concat([2718,2930]);let a=iu(i??[]);if(this.accessList=a.accessList,this.AccessListJSON=a.AccessListJSON,su(this.accessList),this.gasPrice=ye(we(s===""?"0x":s)),this._validateCannotExceedMaxInteger({gasPrice:this.gasPrice}),Bt._validateNotArray(t),this.gasPrice*this.gasLimit>Ar){let d=this._errorMsg("gasLimit * gasPrice cannot exceed MAX_INTEGER");throw new Error(d)}this._validateYParity(),this._validateHighS(),((n=r?.freeze)!==null&&n!==void 0?n:!0)&&Object.freeze(this)}getDataFee(){if(this.cache.dataFee&&this.cache.dataFee.hardfork===this.common.hardfork())return this.cache.dataFee.value;let t=super.getDataFee();return t+=BigInt(cu(this.accessList,this.common)),Object.isFrozen(this)&&(this.cache.dataFee={value:t,hardfork:this.common.hardfork()}),t}getUpfrontCost(){return this.gasLimit*this.gasPrice+this.value}raw(){return[he(this.chainId),he(this.nonce),he(this.gasPrice),he(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),he(this.value),this.data,this.accessList,this.v!==void 0?he(this.v):Uint8Array.from([]),this.r!==void 0?he(this.r):Uint8Array.from([]),this.s!==void 0?he(this.s):Uint8Array.from([])]}serialize(){let t=this.raw();return Ce(Vf,du.RLP.encode(t))}getMessageToSign(t=!0){let r=this.raw().slice(0,8),n=Ce(Vf,du.RLP.encode(r));return t?ct(n):n}hash(){if(!this.isSigned()){let t=this._errorMsg("Cannot call hash method if transaction is not signed");throw new Error(t)}return Object.isFrozen(this)?(this.cache.hash||(this.cache.hash=ct(this.serialize())),this.cache.hash):ct(this.serialize())}getMessageToVerifySignature(){return this.getMessageToSign()}getSenderPublicKey(){if(!this.isSigned()){let i=this._errorMsg("Cannot call this method if transaction is not signed");throw new Error(i)}let t=this.getMessageToVerifySignature(),{v:r,r:n,s:o}=this;this._validateHighS();try{return Vo(t,r+BigInt(27),he(n),he(o))}catch{let s=this._errorMsg("Invalid Signature");throw new Error(s)}}_processSignature(t,r,n){let o=Object.assign(Object.assign({},this.txOptions),{common:this.common});return e.fromTxData({chainId:this.chainId,nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:t-BigInt(27),r:ye(r),s:ye(n)},o)}toJSON(){let t=au(this.accessList);return{chainId:Se(this.chainId),nonce:Se(this.nonce),gasPrice:Se(this.gasPrice),gasLimit:Se(this.gasLimit),to:this.to!==void 0?this.to.toString():void 0,value:Se(this.value),data:Y(this.data),accessList:t,v:this.v!==void 0?Se(this.v):void 0,r:this.r!==void 0?Se(this.r):void 0,s:this.s!==void 0?Se(this.s):void 0}}errorStr(){var t,r;let n=this._getSharedErrorPostfix();return n+=` gasPrice=${this.gasPrice} accessListCount=${(r=(t=this.accessList)===null||t===void 0?void 0:t.length)!==null&&r!==void 0?r:0}`,n}_errorMsg(t){return`${t} (${this.errorStr()})`}};var Gn=to(ou(),1);var dE=0;function S0(e,t){let r=Number(e),n=Number(t)*2;return r===n+35||r===n+36}var fn=class e extends Bt{static fromTxData(t,r={}){return new e(t,r)}static fromSerializedTx(t,r={}){let n=Gn.RLP.decode(t);if(!Array.isArray(n))throw new Error("Invalid serialized tx input. Must be array");return this.fromValuesArray(n,r)}static fromValuesArray(t,r={}){if(t.length!==6&&t.length!==9)throw new Error("Invalid transaction. Only expecting 6 values (for unsigned tx) or 9 values (for signed tx).");let[n,o,i,s,a,u,d,c,f]=t;return To({nonce:n,gasPrice:o,gasLimit:i,value:a,v:d,r:c,s:f}),new e({nonce:n,gasPrice:o,gasLimit:i,to:s,value:a,data:u,v:d,r:c,s:f},r)}constructor(t,r={}){var n;if(super(Object.assign(Object.assign({},t),{type:dE}
8),r),this.common=this._validateTxV(this.v,r.common),this.gasPrice=ye(we(t.gasPrice===""?"0x":t.gasPrice)),this.gasPrice*this.gasLimit>Ar){let i=this._errorMsg("gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)");throw new Error(i)}this._validateCannotExceedMaxInteger({gasPrice:this.gasPrice}),Bt._validateNotArray(t),this.common.gteHardfork("spuriousDragon")&&(this.isSigned()?S0(this.v,this.common.chainId())&&this.activeCapabilities.push(Kt.EIP155ReplayProtection):this.activeCapabilities.push(Kt.EIP155ReplayProtection)),((n=r?.freeze)!==null&&n!==void 0?n:!0)&&Object.freeze(this)}raw(){return[he(this.nonce),he(this.gasPrice),he(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),he(this.value),this.data,this.v!==void 0?he(this.v):Uint8Array.from([]),this.r!==void 0?he(this.r):Uint8Array.from([]),this.s!==void 0?he(this.s):Uint8Array.from([])]}serialize(){return Gn.RLP.encode(this.raw())}_getMessageToSign(){let t=[he(this.nonce),he(this.gasPrice),he(this.gasLimit),this.to!==void 0?this.to.buf:Uint8Array.from([]),he(this.value),this.data];return this.supports(Kt.EIP155ReplayProtection)&&(t.push(we(this.common.chainId())),t.push(Wo(we(0))),t.push(Wo(we(0)))),t}getMessageToSign(t=!0){let r=this._getMessageToSign();return t?ct(Gn.RLP.encode(r)):r}getDataFee(){return this.cache.dataFee&&this.cache.dataFee.hardfork===this.common.hardfork()?this.cache.dataFee.value:(Object.isFrozen(this)&&(this.cache.dataFee={value:super.getDataFee(),hardfork:this.common.hardfork()}),super.getDataFee())}getUpfrontCost(){return this.gasLimit*this.gasPrice+this.value}hash(){if(!this.isSigned()){let t=this._errorMsg("Cannot call hash method if transaction is not signed");throw new Error(t)}return Object.isFrozen(this)?(this.cache.hash||(this.cache.hash=ct(Gn.RLP.encode(this.raw()))),this.cache.hash):ct(Gn.RLP.encode(this.raw()))}getMessageToVerifySignature(){if(!this.isSigned()){let r=this._errorMsg("This transaction is not signed");throw new Error(r)}let t=this._getMessageToSign();return ct(Gn.RLP.encode(t))}getSenderPublicKey(){let t=this.getMessageToVerifySignature(),{v:r,r:n,s:o}=this;this._validateHighS();try{return Vo(t,r,he(n),he(o),this.supports(Kt.EIP155ReplayProtection)?this.common.chainId():void 0)}catch{let s=this._errorMsg("Invalid Signature");throw new Error(s)}}_processSignature(t,r,n){let o=t;this.supports(Kt.EIP155ReplayProtection)&&(o+=this.common.chainId()*BigInt(2)+BigInt(8));let i=Object.assign(Object.assign({},this.txOptions),{common:this.common});return e.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:o,r:ye(r),s:ye(n)},i)}toJSON(){return{nonce:Se(this.nonce),gasPrice:Se(this.gasPrice),gasLimit:Se(this.gasLimit),to:this.to!==void 0?this.to.toString():void 0,value:Se(this.value),data:Y(this.data),v:this.v!==void 0?Se(this.v):void 0,r:this.r!==void 0?Se(this.r):void 0,s:this.s!==void 0?Se(this.s):void 0}}_validateTxV(t,r){let n,o=t!==void 0?Number(t):void 0;if(o!==void 0&&o<37&&o!==27&&o!==28)throw new Error(`Legacy txs need either v = 27/28 or v >= 37 (EIP-155 replay protection), got v = ${o}`);if(o!==void 0&&o!==0&&(!r||r.gteHardfork("spuriousDragon"))&&o!==27&&o!==28)if(r){if(!S0(BigInt(o),r.chainId()))throw new Error(`Incompatible EIP155-based V ${o} and chain id ${r.chainId()}. See the Common parameter of the Transaction constructor to set the chain id.`)}else{let i;(o-35)%2===0?i=35:i=36,n=BigInt(o-i)/BigInt(2)}return this._getCommon(r,n)}errorStr(){let t=this._getSharedErrorPostfix();return t+=` gasPrice=${this.gasPrice}`,t}_errorMsg(t){return`${t} (${this.errorStr()})`}};var Kf=new Map,Nt=class e{constructor(){}static typeToInt(t){return Number(ye(we(t)))}static registerTransactionType(t,r){let n=e.typeToInt(t);Kf.set(n,r)}static fromTxData(t,r={}){if(!("type"in t)||t.type===void 0)return fn.fromTxData(t,r);let n=e.typeToInt(t.type);if(n===0)return fn.fromTxData(t,r);if(n===1)return Xo.fromTxData(t,r);if(n===2)return Zo.fromTxData(t,r);let o=Kf.get(n);if(o?.fromTxData)return o.fromTxData(t,r);throw new Error(`Tx instantiation with type ${n} not supported`)}static fromSerializedData(t,r={}){if(t[0]<=127)switch(t[0]){case 1:return Xo.fromSerializedTx(t,r);case 2:return Zo.fromSerializedTx(t,r);default:{let n=Kf.get(Number(t[0]));if(n?.fromSerializedTx)return n.fromSerializedTx(t,r);throw new Error(`TypedTransaction with ID ${t[0]} unknown`)}}else return fn.fromSerializedTx(t,r)}static fromBlockBodyData(t,r={}){if(ft(t))return this.fromSerializedData(t,r);if(Array.isArray(t))return fn.fromValuesArray(t,r);throw new Error("Cannot decode transaction: unknown type input")}};var lu=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},qn=(e,t)=>{let r;if(!t&&typeof e=="string"&&oe(e)&&e.length!==66)throw new Ei;try{r=ft(e)?e:st(e)}catch{throw new aa}if(!t&&r.byteLength!==32)throw new Ei;return r},hu=(e,t=!1)=>{let r=oe(e)?e:at(e),n=me(r),o=me(Bc(`�Ethereum Signed Message: 9${n.byteLength}`)),i=t?n:Ce(o,n);return $e(i)},fE=(e,t)=>{let r=qn(t),n=_t.sign(e.substring(2),r),o=n.toCompactRawBytes(),i=n.r.toString(16).padStart(64,"0"),s=n.s.toString(16).padStart(64,"0"),a=n.recovery+27;return{messageHash:e,v:Ie(a),r:`0x${i}`,s:`0x${s}`,signature:`${Y(o)}${a.toString(16)}`}},Zf=(e,t)=>
9{let r=hu(e),{messageHash:n,v:o,r:i,s,signature:a}=fE(r,t);return{message:e,messageHash:n,v:o,r:i,s,signature:a}};var k0=(e,t)=>lu(void 0,void 0,void 0,function*(){let r=e.sign(me(t));if(S(r.v)||S(r.r)||S(r.s))throw new fo("Signer Error");let n=r.validate(!0);if(n.length>0){let s="Signer Error ";for(let a of n)s+=`${s} ${a}.`;throw new fo(s)}let o=Y(r.serialize()),i=$e(o);return{messageHash:Y(r.getMessageToSign(!0)),v:`0x${r.v.toString(16)}`,r:`0x${r.r.toString(16).padStart(64,"0")}`,s:`0x${r.s.toString(16).padStart(64,"0")}`,rawTransaction:o,transactionHash:Y(i)}}),P0=e=>{if(S(e))throw new Ta;let t=Nt.fromSerializedData(me(e));return Ve(t.getSenderAddress().toString())},fu=(e,t,r,n,o)=>{if(typeof e=="object"){let f=`${e.r}${e.s.slice(2)}${e.v.slice(2)}`;return fu(e.messageHash,f,r)}if(typeof t=="string"&&typeof r=="string"&&!S(n)){let f=`${r}${n.slice(2)}${t.slice(2)}`;return fu(e,f,o)}if(S(t))throw new ca("signature string undefined");let i=130,s=r?e:hu(e),a=parseInt(t.substring(i),16);a>26&&(a-=27);let u=_t.Signature.fromCompact(t.slice(2,i)).addRecoveryBit(a).recoverPublicKey(s.replace("0x","")).toRawBytes(!1),d=$e(u.subarray(1));return Ve(`0x${d.slice(-40)}`)},Jo=e=>{let t=qn(e),r=_t.getPublicKey(t,!1),o=$e(r.slice(1)).slice(-40);return Ve(`0x${o}`)},B0=(e,t)=>{let r=qn(e);return`0x${Y(_t.getPublicKey(r,t)).slice(4)}`},Xf=(e,t,r)=>lu(void 0,void 0,void 0,function*(){var n,o,i,s,a,u,d;let c=qn(e),f;if(r?.salt?f=typeof r.salt=="string"?me(r.salt):r.salt:f=kn(32),!(Eo(t)||ft(t)))throw new fa;let _=typeof t=="string"?me(at(t)):t,w;if(r?.iv){if(w=typeof r.iv=="string"?me(r.iv):r.iv,w.length!==16)throw new la}else w=kn(16);let k=(n=r?.kdf)!==null&&n!==void 0?n:"scrypt",T,R;if(k==="pbkdf2"){if(R={dklen:(o=r?.dklen)!==null&&o!==void 0?o:32,salt:Y(f).replace("0x",""),c:(i=r?.c)!==null&&i!==void 0?i:262144,prf:"hmac-sha256"},R.c<1e3)throw new ha;T=xf(_,f,R.c,R.dklen,"sha256")}else if(k==="scrypt")R={n:(s=r?.n)!==null&&s!==void 0?s:8192,r:(a=r?.r)!==null&&a!==void 0?a:8,p:(u=r?.p)!==null&&u!==void 0?u:1,dklen:(d=r?.dklen)!==null&&d!==void 0?d:32,salt:Y(f).replace("0x","")},T=bf(_,f,R.n,R.p,R.r,R.dklen);else throw new Ti;let P=yield Kc(c,T.slice(0,16),w,"aes-128-ctr"),b=Y(P).slice(2),C=$e(Ce(T.slice(16,32),P)).replace("0x","");return{version:3,id:gs(),address:Jo(c).toLowerCase().replace("0x",""),crypto:{ciphertext:b,cipherparams:{iv:Y(w).replace("0x","")},cipher:"aes-128-ctr",kdf:k,kdfparams:R,mac:C}}}),pu=(e,t)=>{let r=qn(e,t);return{address:Jo(r),privateKey:Y(r),signTransaction:n=>{throw new fo("Do not have network access to sign the transaction")},sign:n=>Zf(typeof n=="string"?n:JSON.stringify(n),r),encrypt:(n,o)=>lu(void 0,void 0,void 0,function*(){return Xf(r,n,o)})}},N0=()=>{let e=_t.utils.randomPrivateKey();return pu(`${Y(e)}`)},O0=(e,t,r)=>lu(void 0,void 0,void 0,function*(){let n=typeof e=="object"?e:JSON.parse(r?e.toLowerCase():e);if(W.validateJSONSchema(fm,n),n.version!==3)throw new da;let o=typeof t=="string"?me(at(t)):t;W.validate(["bytes"],[o]);let i;if(n.crypto.kdf==="scrypt"){let d=n.crypto.kdfparams,c=typeof d.salt=="string"?me(d.salt):d.salt;i=bf(o,c,d.n,d.p,d.r,d.dklen)}else if(n.crypto.kdf==="pbkdf2"){let d=n.crypto.kdfparams,c=typeof d.salt=="string"?me(d.salt):d.salt;i=xf(o,c,d.c,d.dklen,"sha256")}else throw new Ti;let s=me(n.crypto.ciphertext);if($e(Ce(i.slice(16,32),s)).replace("0x","")!==n.crypto.mac)throw new ua;let u=yield $p(me(n.crypto.ciphertext),i.slice(0,16),me(n.crypto.cipherparams.iv));return pu(u)});var C0=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},hE=1e3,mu=class{constructor(t){this._requestManager=t,this._requests=new Map}get requests(){return[...this._requests.values()].map(t=>t.payload)}add(t){let r=Re.toPayload(t),n=new Jr;return this._requests.set(r.id,{payload:r,promise:n}),n}execute(t){return C0(this,void 0,void 0,function*(){var r;if(this.requests.length===0)return Promise.resolve([]);let n=new Jr({timeout:(r=t?.timeout)!==null&&r!==void 0?r:hE,eagerStart:!0,timeoutMessage:"Batch request timeout"});return this._processBatchRequest(n).catch(o=>n.reject(o)),n.catch(o=>{o instanceof io&&this._abortAllRequests("Batch request timeout"),n.reject(o)}),n})}_processBatchRequest(t){return C0(this,void 0,void 0,function*(){var r,n;let o=yield this._requestManager.sendBatch([...this._requests.values()].map(a=>a.payload));if(o.length!==this._requests.size)throw this._abortAllRequests("Invalid batch response"),new Qe(o,`Batch request size mismatch the results size. Requests: ${this._requests.size}, Responses: ${o.length}`);let i=this.requests.map(a=>a.id).map(Number).sort((a,u)=>a-u),s=o.map(a=>a.id).map(Number).sort((a,u)=>a-u);if(JSON.stringify(i)!==JSON.stringify(s))throw this._abortAllRequests("Invalid batch response"),new Qe(o,`Batch request mismatch the results. Requests: [${i.join()}], Responses: [${s.join()}]`);for(let a of o)Re.isResponseWithResult(a)?(r=this._requests.get(a.id))===null||r===void 0||r.promise.resolve(a.result):Re.isResponseWithError(a)&&((n=this._requests.get(a.id))===null||n===void 0||n.promise.reject(a.error));t.resolve(o)})}_abortAllRequests(t){for(let{promise:r}of this._requests.values())r.reject(new ba(t))}};var pE=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},He=class e extends jc{constructor(t){var r;if(super(),this.providers=On.providers,V(t)||typeof t=="string"&&t.trim()!==""||Nn(t)){this._requestManager=new On(t),this._subscriptionManager=new vr(this._requestManager,{});return}let{config:n,provider:o,requestManager:i,subscriptionManager:s,registeredSubscriptions:a,accountProvider:u,wallet:d,requestManagerMiddleware:c}=t;this.setConfig(n??{}),this._requestManager=i??new On(o,(r=n?.enableExperimentalFeatures)===null||r===void 0?void 0:r.useSubscriptionWhenCheckingBlockTimeout,c),s?this._subscriptionManager=s:this._subscriptionManager=new vr(this.requestManager,a??{}),u&&(this._accountProvider=u),d&&(this._wallet=d)}get requestManager(){return this._requestManager}get subscriptionManager(){return this._subscriptionManager}get wallet(){return this._wallet}get accountProvider(){return this._accountProvider}static fromContextObject(...t){return new this(...t.reverse())}getContextObject(){var t;return{config:this.config,provider:this.provider,requestManager:this.requestManager,subscriptionManager:this.subscriptionManager,registeredSubscriptions:(t=this.subscriptionManager)===null||t===void 0?void 0:t.registeredSubscriptions,providers:this.providers,wallet:this.wallet,accountProvider:this.accountProvider}}use(t,...r){let n=new t(...r,this.getContextObject());
9return this.on(Qr.CONFIG_CHANGE,o=>{n.setConfig({[o.name]:o.newValue})}),this[t.name]=n,n}link(t){this.setConfig(t.config),this._requestManager=t.requestManager,this.provider=t.provider,this._subscriptionManager=t.subscriptionManager,this._wallet=t.wallet,this._accountProvider=t._accountProvider,t.on(Qr.CONFIG_CHANGE,r=>{this.setConfig({[r.name]:r.newValue})})}registerPlugin(t){if(this[t.pluginNamespace]!==void 0)throw new _a(t.pluginNamespace);let r={[t.pluginNamespace]:t};r[t.pluginNamespace].link(this),Object.assign(this,r)}get provider(){return this.currentProvider}set provider(t){this.requestManager.setProvider(t)}get currentProvider(){return this.requestManager.provider}set currentProvider(t){this.requestManager.setProvider(t)}get givenProvider(){return e.givenProvider}setProvider(t){return this.provider=t,!0}setRequestManagerMiddleware(t){this.requestManager.setMiddleware(t)}get BatchRequest(){return mu.bind(void 0,this._requestManager)}extend(t){var r;return t.property&&!this[t.property]&&(this[t.property]={}),(r=t.methods)===null||r===void 0||r.forEach(n=>{let o=(...i)=>pE(this,void 0,void 0,function*(){return this.requestManager.send({method:n.call,params:i})});t.property?this[t.property][n.name]=o:this[n.name]=o}),this}};He.providers=On.providers;var Yo=(()=>{class e{constructor(r){if(this.toAddress=()=>{if(this.isDirect()){let n=this._iban.slice(4),o=e._parseInt(n,36),i=Xr(o,40);return Ve(i)}throw new Error("Iban is indirect and cannot be converted. Must be length of 34 or 35")},e.isIndirect(r)||e.isDirect(r))this._iban=r;else throw new Error("Invalid IBAN was provided")}static isDirect(r){return r.length===34||r.length===35}isDirect(){return e.isDirect(this._iban)}static isIndirect(r){return r.length===20}isIndirect(){return e.isIndirect(this._iban)}static isValid(r){return/^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(r)&&e._mod9710(e._iso13616Prepare(r))===1}isValid(){return e.isValid(this._iban)}static fromBban(r){let i=`0${(98-this._mod9710(this._iso13616Prepare(`XE00${r}`))).toString()}`.slice(-2);return new e(`XE${i}${r}`)}static createIndirect(r){return e.fromBban(`ETH${r.institution}${r.identifier}`)}static fromAddress(r){if(!Ne(r))throw new hr(r);let o=BigInt(Kr(r)).toString(36),i=Xr(o,15);return e.fromBban(i.toUpperCase())}static toIban(r){return e.fromAddress(r).toString()}client(){return this.isIndirect()?this._iban.slice(11):""}checksum(){return this._iban.slice(2,4)}institution(){return this.isIndirect()?this._iban.slice(7,11):""}toString(){return this._iban}}return e._iso13616Prepare=t=>{let o=t.toUpperCase();return`${o.slice(4)}${o.slice(0,4)}`.split("").map(s=>{let a=s.charCodeAt(0);return a>=65&&a<=90?a-65+10:s}).join("")},e._parseInt=(t,r)=>[...t].reduce((n,o)=>BigInt(parseInt(o,r))+BigInt(r)*n,BigInt(0)),e._mod9710=t=>{let r=t,n;for(;r.length>2;)n=r.slice(0,9),r=`${(parseInt(n,10)%97).toString()}${r.slice(n.length)}`;return parseInt(r,10)%97},e.toAddress=t=>new e(t).toAddress(),e})();var Jf=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},M0,Qo=class extends nr{constructor(t){super(),this[M0]="Promise",this._promise=new Promise(t)}then(t,r){return Jf(this,void 0,void 0,function*(){return this._promise.then(t,r)})}catch(t){return Jf(this,void 0,void 0,function*(){return this._promise.catch(t)})}finally(t){return Jf(this,void 0,void 0,function*(){return this._promise.finally(t)})}on(t,r){return super.on(t,r),this}once(t,r){return super.once(t,r),this}};M0=Symbol.toStringTag;var JD=to(D0(),1);var X={};fr(X,{call:()=>FE,compileLLL:()=>JE,compileSerpent:()=>YE,compileSolidity:()=>XE,createAccessList:()=>mT,estimateGas:()=>UE,getAccounts:()=>AE,getBalance:()=>RE,getBlockByHash:()=>$E,getBlockByNumber:()=>jE,getBlockNumber:()=>IE,getBlockTransactionCountByHash:()=>PE,getBlockTransactionCountByNumber:()=>BE,getChainId:()=>lT,getCode:()=>CE,getCoinbase:()=>bE,getCompilers:()=>ZE,getFeeHistory:()=>uT,getFilterChanges:()=>nT,getFilterLogs:()=>oT,getGasPrice:()=>EE,getHashRate:()=>
9wE,getLogs:()=>iT,getMaxPriorityFeePerGas:()=>TE,getMining:()=>_E,getNodeInfo:()=>pT,getPendingTransactions:()=>dT,getProof:()=>hT,getProtocolVersion:()=>xE,getStorageAt:()=>SE,getSyncing:()=>vE,getTransactionByBlockHashAndIndex:()=>qE,getTransactionByBlockNumberAndIndex:()=>WE,getTransactionByHash:()=>GE,getTransactionCount:()=>kE,getTransactionReceipt:()=>VE,getUncleByBlockHashAndIndex:()=>zE,getUncleByBlockNumberAndIndex:()=>KE,getUncleCountByBlockHash:()=>NE,getUncleCountByBlockNumber:()=>OE,getWork:()=>sT,newBlockFilter:()=>eT,newFilter:()=>QE,newPendingTransactionFilter:()=>tT,requestAccounts:()=>fT,sendRawTransaction:()=>HE,sendTransaction:()=>DE,sign:()=>ME,signTransaction:()=>LE,signTypedData:()=>gT,submitHashrate:()=>cT,submitWork:()=>aT,uninstallFilter:()=>rT});var ee=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})};function xE(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_protocolVersion",params:[]})})}function vE(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_syncing",params:[]})})}function bE(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_coinbase",params:[]})})}function _E(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_mining",params:[]})})}function wE(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_hashrate",params:[]})})}function EE(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_gasPrice",params:[]})})}function TE(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_maxPriorityFeePerGas",params:[]})})}function AE(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_accounts",params:[]})})}function IE(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_blockNumber",params:[]})})}function RE(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["address","blockNumberOrTag"],[t,r]),e.send({method:"eth_getBalance",params:[t,r]})})}function SE(e,t,r,n){return ee(this,void 0,void 0,function*(){return W.validate(["address","hex","blockNumberOrTag"],[t,r,n]),e.send({method:"eth_getStorageAt",params:[t,r,n]})})}function kE(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["address","blockNumberOrTag"],[t,r]),e.send({method:"eth_getTransactionCount",params:[t,r]})})}function PE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["bytes32"],[t]),e.send({method:"eth_getBlockTransactionCountByHash",params:[t]})})}function BE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["blockNumberOrTag"],[t]),e.send({method:"eth_getBlockTransactionCountByNumber",params:[t]})})}function NE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["bytes32"],[t]),e.send({method:"eth_getUncleCountByBlockHash",params:[t]})})}function OE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["blockNumberOrTag"],[t]),e.send({method:"eth_getUncleCountByBlockNumber",params:[t]})})}function CE(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["address","blockNumberOrTag"],[t,r]),e.send({method:"eth_getCode",params:[t,r]})})}function ME(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["address","hex"],[t,r]),e.send({method:"eth_sign",params:[t,r]})})}function LE(e,t){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_signTransaction",params:[t]})})}function DE(e,t){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_sendTransaction",params:[t]})})}function HE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["hex"],[t]),e.send({method:"eth_sendRawTransaction",params:[t]})})}function FE(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["blockNumberOrTag"],[r]),e.send({method:"eth_call",params:[t,r]})})}function UE(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["blockNumberOrTag"],[r]),e.send({method:"eth_estimateGas",params:[t,r]})})}function $E(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["bytes32","bool"],[t,r]),e.send({method:"eth_getBlockByHash",params:[t,r]})})}function jE(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["blockNumberOrTag","bool"],[t,r]),e.send({method:"eth_getBlockByNumber",params:[t,r]})})}function GE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["bytes32"],[t]),e.send({method:"eth_getTransactionByHash",params:[t]})})}function qE(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["bytes32","hex"],[t,r]),e.send({method:"eth_getTransactionByBlockHashAndIndex",params:[t,r]})})}function WE(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["blockNumberOrTag","hex"],[t,r]),e.send({method:"eth_getTransactionByBlockNumberAndIndex",params:[t,r]})})}function VE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["bytes32"],[t]),e.send({method:"eth_getTransactionReceipt",params:[t]})})}function zE(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["bytes32","hex"],[t,r]),e.send({method:"eth_getUncleByBlockHashAndIndex",params:[t,r]})})}function KE(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["blockNumberOrTag","hex"],[t,r]),e.send({method:"eth_getUncleByBlockNumberAndIndex",params:[t,r]})})}function ZE(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_getCompilers",params:[]})})}function XE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["string"],[t]),e.send({method:"eth_compileSolidity",params:[t]})})}function JE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["string"],[t]),e.send({method:"eth_compileLLL",params:[t]})})}function YE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["string"],[t]),e.send({method:"eth_compileSerpent",params:[t]})})}function QE(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["filter"],[t]),e.send({method:"eth_newFilter",params:[t]})})}function eT(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_newBlockFilter",params:[]})})}function tT(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_newPendingTransactionFilter",params:[]})})}function rT(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["hex"],[t]),e.send({method:"eth_uninstallFilter",params:[t]})})}function nT(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["hex"],[t]),e.send({method:"eth_getFilterChanges",params:[t]})})}function oT(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["hex"],[t]),e.send({method:"eth_getFilterLogs",params:[t]})})}function iT(e,t){return ee(this,void 0,void 0,function*(){return W.validate(["filter"],[t]),e.send({method:"eth_getLogs",params:[t]})})}function sT(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_getWork",params:[]})})}function aT(e,t,r,n){return ee(this,void 0,void 0,function*(){return W.validate(["bytes8","bytes32","bytes32"],[t,r,n]),e.send({method:"eth_submitWork",params:[t,r,n]})})}function cT(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["bytes32","bytes32"],[t,r]),e.send({method:"eth_submitHashrate",params:[t,r]})})}function uT(e,t,r,n){return ee(this,void 0,void 0,function*(){W.validate(["hex","blockNumberOrTag"],[t,r]);for(let o of n)W.validate(["number"],[o]);return e.send({method:"eth_feeHistory",params:[t,r,n]})})}function dT(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_pendingTransactions",params:[]})})}function fT(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_requestAccounts",params:[]})})}function lT(e){return ee(this,void 0,void 0,function*(){return e.send({method:"eth_chainId",params:[]})})}function hT(e,t,r,n){return ee(this,void 0,void 0,function*(){return W.validate(["address","bytes32[]","blockNumberOrTag"],[t,r,n]),e.send({method:"eth_getProof",params:[t,r,n]})})}function pT(e){return ee(this,void 0,void 0,function*(){return e.send({method:"web3_clientVersion",params:[]})})}function mT(e,t,r){return ee(this,void 0,void 0,function*(){return W.validate(["blockNumberOrTag"],[r]),e.send({method:"eth_createAccessList",params:[t,r]})})}function gT(e,t,r,n=!1){return ee(this,void 0,void 0,function*(){return W.validate(["address"],[t]),e.send({method:`eth_signTypedData${n?"":"_v4"}`,params:[t,r]})})}var ei={};fr(ei,{getId:()=>yT,getPeerCount:()=>xT,isListening:()=>vT});var Yf=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})};function yT(e){return Yf(this,void 0,void 0,function*(){return e.send({method:"net_version",params:[]})})}function xT(e){return Yf(this,void 0,void 0,function*(){return e.send({method:"net_peerCount",params:[]})})}function vT(e){return Yf(this,void 0,void 0,function*(){return e.send({method:"net_listening",params:[]})})}var Ot={};fr(Ot,{ecRecover:()=>ST,getAccounts:()=>bT,importRawKey:()=>TT,lockAccount:()=>ET,newAccount:()=>_T,sendTransaction:()=>AT,sign:()=>RT,signTransaction:()=>IT,unlockAccount:()=>wT});var Ir=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},bT=e=>Ir(void 0,void 0,void 0,function*(){return e.send({method:"personal_listAccounts",params:[]})}),_T=(e,t)=>
9Ir(void 0,void 0,void 0,function*(){return e.send({method:"personal_newAccount",params:[t]})}),wT=(e,t,r,n)=>Ir(void 0,void 0,void 0,function*(){return e.send({method:"personal_unlockAccount",params:[t,r,n]})}),ET=(e,t)=>Ir(void 0,void 0,void 0,function*(){return e.send({method:"personal_lockAccount",params:[t]})}),TT=(e,t,r)=>Ir(void 0,void 0,void 0,function*(){return e.send({method:"personal_importRawKey",params:[t,r]})}),AT=(e,t,r)=>Ir(void 0,void 0,void 0,function*(){return e.send({method:"personal_sendTransaction",params:[t,r]})}),IT=(e,t,r)=>Ir(void 0,void 0,void 0,function*(){return e.send({method:"personal_signTransaction",params:[t,r]})}),RT=(e,t,r,n)=>Ir(void 0,void 0,void 0,function*(){return e.send({method:"personal_sign",params:[t,r,n]})}),ST=(e,t,r)=>Ir(void 0,void 0,void 0,function*(){return e.send({method:"personal_ecRecover",params:[t,r]})});var H0={type:"object",properties:{accessList:{type:"null"},maxFeePerGas:{type:"null"},maxPriorityFeePerGas:{type:"null"}}},F0={type:"object",properties:{maxFeePerGas:{type:"null"},maxPriorityFeePerGas:{type:"null"}}},U0={type:"object",properties:{gasPrice:{type:"null"}}},gu=(e,t,r)=>{try{W.validateJSONSchema(e,t)}catch(n){throw n instanceof yt?new Wa(n.errors,r):n}},PT=e=>{var t,r;let n=e;if(!S(n.type)){let i;switch(n.type){case"0x0":i=H0;break;case"0x1":i=F0;break;case"0x2":i=U0;break;default:return M({format:"uint"},n.type,J)}return gu(i,n,n.type),M({format:"uint"},n.type,J)}if(!S(n.maxFeePerGas)||!S(n.maxPriorityFeePerGas))return gu(U0,n,"0x2"),"0x2";if(!S(n.accessList))return gu(F0,n,"0x1"),"0x1";let o=(t=n.hardfork)!==null&&t!==void 0?t:(r=n.common)===null||r===void 0?void 0:r.hardfork;if(!S(o)){let i=Object.keys(_i).indexOf(o);if(i>=Object.keys(_i).indexOf("london"))return S(n.gasPrice)?"0x2":"0x0";if(i===Object.keys(_i).indexOf("berlin"))return"0x0"}if(!S(n.gasPrice))return gu(H0,n,"0x0"),"0x0"},Qf=(e,t)=>{var r;return((r=t?.transactionTypeParser)!==null&&r!==void 0?r:PT)(e)},$0=e=>e[0]>127?"0x0":rt(e[0]);var BT={type:"object",properties:{address:{format:"address"},storageKeys:{type:"array",items:{format:"bytes32"}}}},el={type:"array",items:Object.assign({},BT)},q0={type:"object",properties:{accessList:Object.assign({},el),gasUsed:{type:"string"}}},j0={type:"string",enum:["goerli","kovan","mainnet","rinkeby","ropsten","sepolia"]},G0={type:"string",enum:["arrowGlacier","berlin","byzantium","chainstart","constantinople","dao","homestead","istanbul","london","merge","muirGlacier","petersburg","shanghai","spuriousDragon","tangerineWhistle"]},NT={type:"object",properties:{name:{format:"string"},networkId:{format:"uint"},chainId:{format:"uint"}}},tl={type:"object",properties:{from:{format:"address"},to:{oneOf:[{format:"address"},{type:"null"}]},value:{format:"uint"},gas:{format:"uint"},gasPrice:{format:"uint"},effectiveGasPrice:{format:"uint"},type:{format:"uint"},maxFeePerGas:{format:"uint"},maxPriorityFeePerGas:{format:"uint"},accessList:Object.assign({},el),data:{format:"bytes"},input:{format:"bytes"},nonce:{format:"uint"},chain:Object.assign({},j0),hardfork:Object.assign({},G0),chainId:{format:"uint"},networkId:{format:"uint"},common:{type:"object",properties:{customChain:Object.assign({},NT),baseChain:Object.assign({},j0),hardfork:Object.assign({},G0)}},gasLimit:{format:"uint"},v:{format:"uint"},r:{format:"bytes32"},s:{format:"bytes32"}}},yu={type:"object",properties:Object.assign(Object.assign({},tl.properties),{blockHash:{format:"bytes32"},blockNumber:{format:"uint"},hash:{format:"bytes32"},transactionIndex:{format:"uint"},from:{format:"address"},to:{oneOf:[{format:"address"},{type:"null"}]},value:{format:"uint"},gas:{format:"uint"},gasPrice:{format:"uint"},effectiveGasPrice:{format:"uint"},type:{format:"uint"},maxFeePerGas:{format:"uint"},maxPriorityFeePerGas:{format:"uint"},accessList:Object.assign({},el),data:{format:"bytes"},input:{format:"bytes"},nonce:{format:"uint"},gasLimit:{format:"uint"},v:{format:"uint"},r:{format:"bytes32"},s:{format:"bytes32"}})},W0={type:"object",properties:{index:{format:"uint"},validatorIndex:{format:"uint"},address:{format:"address"},amount:{format:"uint"}}},ti={type:"object",properties:{baseFeePerGas:{format:"uint"},blobGasUsed:{format:"uint"},difficulty:{format:"uint"},excessBlobGas:{format:"uint"},extraData:{format:"bytes"},gasLimit:{format:"uint"},gasUsed:{format:"uint"},hash:{format:"bytes32"},logsBloom:{format:"bytes256"},miner:{format:"bytes"},mixHash:{format:"bytes32"},nonce:{format:"uint"},number:{format:"uint"},parentBeaconBlockRoot:{format:"bytes32"},parentHash:{format:"bytes32"},receiptsRoot:{format:"bytes32"},sha3Uncles:{format:"bytes32"},size:{format:"uint"},stateRoot:{format:"bytes32"},timestamp:{format:"uint"},totalDifficulty:{format:"uint"},transactions:{oneOf:[{type:"array",items:Object.assign({},yu)},{type:"array",items:{format:"bytes32"}}]},transactionsRoot:{format:"bytes32"},uncles:{type:"array",items:{format:"bytes32"}},withdrawals:{type:"array",items:Object.assign({},W0)},withdrawalsRoot:{format:"bytes32"}}},V0={type:"object",properties:{author:{format:"bytes32"},excessDataGas:{format:"uint"},baseFeePerGas:{format:"uint"},blobGasUsed:{format:"uint"},difficulty:{format:"uint"},excessBlobGas:{format:"uint"},extraData:{format:"bytes"},gasLimit:{format:"uint"},gasUsed:{format:"uint"},hash:{format:"bytes32"},logsBloom:{format:"bytes256"},miner:{format:"bytes"},mixHash:{format:"bytes32"},nonce:{format:"uint"},number:{format:"uint"},parentBeaconBlockRoot:{format:"bytes32"},parentHash:{format:"bytes32"},receiptsRoot:{format:"bytes32"},sha3Uncles:{format:"bytes32"},size:{format:"uint"},stateRoot:{format:"bytes32"},timestamp:{format:"uint"},totalDifficulty:{format:"uint"},transactions:{type:"array",items:{format:"bytes32"}},transactionsRoot:{format:"bytes32"},uncles:{type:"array",items:{format:"bytes32"}},withdrawals:{type:"array",items:Object.assign({},W0)},withdrawalsRoot:{format:"bytes32"}}},ar={type:"object",properties:{removed:{format:"bool"},logIndex:{format:"uint"},transactionIndex:{format:"uint"},transactionHash:{format:"bytes32"},blockHash:{format:"bytes32"},blockNumber:{format:"uint"},address:{format:"address"},data:{format:"bytes"},topics:{type:"array",items:{format:"bytes32"}}}},z0={type:"object",properties:{startingBlock:{format:"string"},currentBlock:{format:"string"},highestBlock:{format:"string"},knownStates:{format:"string"},pulledStates:{format:"string"}}},cr={type:"object",properties:{transactionHash:{format:"bytes32"},transactionIndex:{format:"uint"},blockHash:{format:"bytes32"},blockNumber:{format:"uint"},from:{format:"address"},to:{format:"address"},cumulativeGasUsed:{format:"uint"},gasUsed:{format:"uint"},effectiveGasPrice:{format:"uint"},contractAddress:{format:"address"},logs:{type:"array",items:Object.assign({},ar)},logsBloom:{format:"bytes"},root:{format:"bytes"},status:{format:"uint"},type:{format:"uint"}}},K0={type:"object",properties:{messageHash:{format:"bytes"},r:{format:"bytes32"},s:{format:"bytes32"},v:{format:"bytes"},message:{format:"bytes"},signature:{format:"bytes"}}}
9,Z0={type:"object",properties:{oldestBlock:{format:"uint"},baseFeePerGas:{type:"array",items:{format:"uint"}},reward:{type:"array",items:{type:"array",items:{format:"uint"}}},gasUsedRatio:{type:"array",items:{type:"number"}}}},OT={type:"object",properties:{key:{format:"bytes32"},value:{format:"uint"},proof:{type:"array",items:{format:"bytes32"}}}},X0={type:"object",properties:{balance:{format:"uint"},codeHash:{format:"bytes32"},nonce:{format:"uint"},storageHash:{format:"bytes32"},accountProof:{type:"array",items:{format:"bytes32"}},storageProof:{type:"array",items:Object.assign({},OT)}}};function Ge(e,t=Be,r={transactionSchema:yu,fillInputAndData:!1}){var n,o;let i=kt({},e);if(S(e?.common)||(i.common=Object.assign({},e.common),S((n=e.common)===null||n===void 0?void 0:n.customChain)||(i.common.customChain=Object.assign({},e.common.customChain))),i=M((o=r.transactionSchema)!==null&&o!==void 0?o:yu,i,t),!S(i.data)&&!S(i.input)&&rt(i.data)!==rt(i.input))throw new co({data:Y(i.data),input:Y(i.input)});return r.fillInputAndData&&(S(i.data)?S(i.input)||(i.data=i.input):i.input=i.data),S(i.gasLimit)||(i.gas=i.gasLimit,delete i.gasLimit),i}function J0(e,t,r={fillInputAndData:!1}){return{raw:M({format:"bytes"},e,t),tx:Ge(Object.assign(Object.assign({},Nt.fromSerializedData(me(e)).toJSON()),{hash:Y(rr(me(e))),type:$0(me(e))}),t,{fillInputAndData:r.fillInputAndData,transactionSchema:r.transactionSchema})}}var rl=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})};function ri(e,t){return rl(this,void 0,void 0,function*(){let r=yield ei.getId(e.requestManager);return M({format:"uint"},r,t)})}function Y0(e,t){return rl(this,void 0,void 0,function*(){let r=yield ei.getPeerCount(e.requestManager);return M({format:"uint"},r,t)})}var Q0=e=>rl(void 0,void 0,void 0,function*(){return ei.isListening(e.requestManager)});var nl=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Wn=class extends He{getId(t=this.defaultReturnFormat){return nl(this,void 0,void 0,function*(){return ri(this,t)})}getPeerCount(t=this.defaultReturnFormat){return nl(this,void 0,void 0,function*(){return Y0(this,t)})}isListening(){return nl(this,void 0,void 0,function*(){return Q0(this)})}};var Rr="ALLEVENTS",Os={name:Rr,signature:"",type:"event",inputs:[]},Vn={bytes:Ut.HEX,number:it.NUMBER};var eg=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})};function LT(e,t,r){return eg(this,void 0,void 0,function*(){var n,o,i,s;let a=yield vu(t,t.defaultBlock,!1,J);if(S(a.baseFeePerGas))throw new $a;let u;if(S(e.gasPrice)&&BigInt(a.baseFeePerGas)===BigInt(0)&&(u=yield Cs(t,r)),!S(e.gasPrice)||!S(u)){let d=M({format:"uint"},(n=e.gasPrice)!==null&&n!==void 0?n:u,r);return{maxPriorityFeePerGas:d,maxFeePerGas:d}}return{maxPriorityFeePerGas:M({format:"uint"},(o=e.maxPriorityFeePerGas)!==null&&o!==void 0?o:t.defaultMaxPriorityFeePerGas,r),maxFeePerGas:M({format:"uint"},(i=e.maxFeePerGas)!==null&&i!==void 0?i:BigInt(a.baseFeePerGas)*BigInt(2)+BigInt((s=e.maxPriorityFeePerGas)!==null&&s!==void 0?s:t.defaultMaxPriorityFeePerGas),r)}})}function xu(e,t,r){return eg(this,void 0,void 0,function*(){let n=ol(e,t);if(!S(n)){if(n.startsWith("-"))throw new Bi(n);if(Number(n)<0||Number(n)>127)throw new Bi(n);if(S(e.gasPrice)&&(n==="0x0"||n==="0x1"))return{gasPrice:yield Cs(t,r),maxPriorityFeePerGas:void 0,maxFeePerGas:void 0};if(n==="0x2")return Object.assign({gasPrice:void 0},yield LT(e,t,r))}})}var il=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Ms=(e,t,r,n)=>{if(r!==void 0&&e in r&&r[e]!==void 0){if(typeof r[e]=="string"&&Ne(r[e]))return r[e];if(!oe(r[e])&&kc(r[e])){if(t.wallet){let o=t.wallet.get(M({format:"uint"},r[e],Vn));if(!S(o))return o.address;throw new Oi}throw new Oi}else throw e==="from"?new ki(r.from):new Aa(r.to)}if(e==="from"){if(!S(n))return Jo(n);if(!S(t.defaultAccount))return t.defaultAccount}},DT=(e,t,...r)=>il(void 0,[e,t,...r],void 0,function*(n,o,i=n.defaultReturnFormat){if(S(o))throw new Ua;return bu(n,o,n.defaultBlock,i)}),ol=(e,t)=>{let r=Qf(e,t);if(!S(r))return r;if(!S(t.defaultTransactionType))return M({format:"uint"},t.defaultTransactionType,J)};function HT(e){return il(this,void 0,void 0,function*(){var t,r;let n=M(tl,e.transaction,e.web3Context.defaultReturnFormat);if(S(n.from)&&(n.from=Ms("from",e.web3Context,void 0,e.privateKey)),S(n.nonce)&&(n.nonce=yield DT(e.web3Context,n.from,J)),S(n.value)&&(n.value="
90x0"),S(n.data))S(n.input)?n.input="0x":n.input.startsWith("0x")||(n.input=`0x${n.input}`);else{if(!S(n.input)&&n.data!==n.input)throw new co({data:Y(n.data),input:Y(n.input)});n.data.startsWith("0x")||(n.data=`0x${n.data}`)}if(S(n.common)){if(e.web3Context.defaultCommon){let o=e.web3Context.defaultCommon,i=o.customChain.chainId,s=o.customChain.networkId,a=o.customChain.name;n.common=Object.assign(Object.assign({},o),{customChain:{chainId:i,networkId:s,name:a}})}S(n.chain)&&(n.chain=e.web3Context.defaultChain),S(n.hardfork)&&(n.hardfork=e.web3Context.defaultHardfork)}if(S(n.chainId)&&S((t=n.common)===null||t===void 0?void 0:t.customChain.chainId)&&(n.chainId=yield _u(e.web3Context,J)),S(n.networkId)&&(n.networkId=(r=e.web3Context.defaultNetworkId)!==null&&r!==void 0?r:yield ri(e.web3Context,J)),S(n.gasLimit)&&!S(n.gas)&&(n.gasLimit=n.gas),n.type=ol(n,e.web3Context),S(n.accessList)&&(n.type==="0x1"||n.type==="0x2")&&(n.accessList=[]),e.fillGasPrice&&(n=Object.assign(Object.assign({},n),yield xu(n,e.web3Context,J))),S(n.gas)&&S(n.gasLimit)&&e.fillGasLimit){let o=yield ni(e.web3Context,n,"latest",J);n=Object.assign(Object.assign({},n),{gas:M({format:"uint"},o,J)})}return n})}var sl=e=>il(void 0,void 0,void 0,function*(){var t;return((t=e.web3Context.transactionBuilder)!==null&&t!==void 0?t:HT)(Object.assign(Object.assign({},e),{transaction:e.transaction}))});var cl=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})};function al(e,t,r){let n=e.transactionPollingInterval,[o,i]=Qd(()=>cl(this,void 0,void 0,function*(){let a;try{a=yield Ls(e,Vn)}catch(d){console.warn("An error happen while trying to get the block number",d);return}let u=a-t;if(u>=e.transactionBlockTimeout)return new Ni({starterBlockNumber:t,numberOfBlocks:u,transactionHash:r})}),n);return[i,{clean:()=>{clearInterval(o)}}]}function FT(e,t,r){return cl(this,void 0,void 0,function*(){var n;let o=!0,i,s;function a(d,c){c&&console.warn("error happened at subscription. So revert to polling...",c),s.clean(),o=!1;let[f,_]=al(e,t,r);s.clean=_.clean,f.catch(w=>d(w))}try{i=yield(n=e.subscriptionManager)===null||n===void 0?void 0:n.subscribe("newHeads"),s={clean:()=>{var d;i.id&&((d=e.subscriptionManager)===null||d===void 0||d.removeSubscription(i).then(()=>{}).catch(()=>{}))}}}catch{return al(e,t,r)}return[new Promise((d,c)=>{try{i.on("data",f=>{if(o=!1,!f?.number)return;let _=Number(BigInt(f.number)-BigInt(t));_>=e.transactionBlockTimeout&&c(new Ni({starterBlockNumber:t,numberOfBlocks:_,transactionHash:r}))}),i.on("error",f=>{a(c,f)})}catch(f){a(c,f)}setTimeout(()=>{o&&a(c)},e.blockHeaderTimeout*1e3)}),s]})}function wu(e,t){return cl(this,void 0,void 0,function*(){var r,n;let{provider:o}=e.requestManager,i,s=yield Ls(e,Vn);return!((n=(r=o).supportsSubscriptions)===null||n===void 0)&&n.call(r)&&e.enableExperimentalFeatures.useSubscriptionWhenCheckingBlockTimeout?i=yield FT(e,s,t):i=al(e,s,t),i})}var UT=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})};function oi(e,t,r){return UT(this,void 0,void 0,function*(){let[n,o]=ms(e.transactionSendTimeout,new ja({numberOfSeconds:e.transactionSendTimeout/1e3,transactionHash:r})),[i,s]=yield wu(e,r);try{return yield Promise.race([t(),o,i])}finally{clearTimeout(n),s.clean()}})}var tg=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})};function Eu(e,t,r,n){return tg(this,void 0,void 0,function*(){var o;let i=(o=e.transactionReceiptPollingInterval)!==null&&o!==void 0?o:e.transactionPollingInterval,[s,a]=Lc(()=>tg(this,void 0,void 0,function*(){try{return(n??Tu)(e,t,r)}catch(_){console.warn("An error happen while trying to get the transaction receipt",_);return}}),i),[u,d]=ms(e.transactionPollingTimeout,new uo({numberOfSeconds:e.transactionPollingTimeout/1e3,transactionHash:t})),[c,f]=yield wu(e,t);try{return yield Promise.race([s,d,c])}finally{u&&clearTimeout(u),a&&clearInterval(a),f.clean()}})}var $T=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},ii=({web3Context:e,transactionReceipt:t,transactionPromiEvent:r,customTransactionReceiptSchema:n,returnFormat:o})=>{var i;let s=1,a=setInterval(()=>{$T(void 0,void 0,void 0,function*(){if(s>=e.transactionConfirmationBlocks){clearInterval(a);return}let u=yield X.getBlockByNumber(e.requestManager,Ie(BigInt(t.blockNumber)+BigInt(s)),!1);u?.hash&&(s+=1,r.emit("confirmation",{confirmations:M({format:"uint"},s,o),receipt:M(n??cr,t,o),latestBlockHash:M({format:"bytes32"},u.hash,o)}))})},(i=e.transactionReceiptPollingInterval)!==null&&i!==void 0?i:e.transactionPollingInterval)};var rg=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},ng=({web3Context:e,transactionReceipt:t,transactionPromiEvent:r,customTransactionReceiptSchema:n,returnFormat:o})=>{let i=!0,s;setImmediate(()=>{var a;(a=e.subscriptionManager)===null||a===void 0||a.subscribe("newHeads").then(u=>{u.on("data",d=>rg(void 0,void 0,void 0,function*(){var c;if(i=!1,!d?.number||s===d?.parentHash)return;s=d?.parentHash;let f=BigInt(d.number)-BigInt(t.blockNumber)+BigInt(1);r.emit("confirmation",{confirmations:M({format:"uint"},f,o),receipt:M(n??cr,t,o),latestBlockHash:M({format:"bytes32"},d.parentHash,o)}),f>=e.transactionConfirmationBlocks&&(yield(c=e.subscriptionManager)===null||c===void 0?void 0:c.removeSubscription(u))})),u.on("error",()=>rg(void 0,void 0,void 0,function*(){var d;yield(d=e.subscriptionManager)===null||d===void 0?void 0:d.removeSubscription(u),i=!1,ii({web3Context:e,transactionReceipt:t,transactionPromiEvent:r,customTransactionReceiptSchema:n,returnFormat:o})}))}).catch(()=>{i=!1,ii({web3Context:e,transactionReceipt:t,customTransactionReceiptSchema:n,transactionPromiEvent:r,returnFormat:o})})}),setTimeout(()=>{i&&ii({web3Context:e,transactionReceipt:t,transactionPromiEvent:r,returnFormat:o})},e.blockHeaderTimeout*1e3)};function og(e,t,r,n,o,i){if(S(r)||S(r.blockHash))throw new Ga({receipt:r,blockHash:M({format:"bytes32"},r?.blockHash,o),transactionHash:M({format:"bytes32"},n,o)});if(!r.blockNumber)throw new qa({receipt:r});t.emit("confirmation",{confirmations:M({format:"uint"},1,o),receipt:M(i??cr,r,o),latestBlockHash:M({format:"bytes32"},r.blockHash,o)});let s=e.requestManager.provider;s&&"supportsSubscriptions"in s&&s.supportsSubscriptions()?ng({web3Context:e,transactionReceipt:r,transactionPromiEvent:t,customTransactionReceiptSchema:i,returnFormat:o}):ii({web3Context:e,transactionReceipt:r,transactionPromiEvent:t,customTransactionReceiptSchema:i,returnFormat:o})}var zn=e=>!V(e)&&typeof e=="object"&&!V(e.type)&&e.type==="error",Ds=e=>!V(e)&&typeof e=="object"&&!V(e.type)&&e.type==="event",si=e=>!V(e)&&typeof e=="object"&&!V(e.type)&&e.type==="function",ig=e=>!V(e)&&typeof e=="object"&&!V(e.type)&&e.type==="constructor",sg=e=>typeof e=="object"&&typeof e.components>"u"&&typeof e.name>"u",dl=e=>e.includes("[]")?{type:"tuple[]",name:e.slice(0,-2)}:{type:"tuple",name:e},fl=e=>{let t=[];for(let r of Object.keys(e)){let n=e[r];typeof n=="object"?t.push(Object.assign(Object.assign({},dl(r)),{components:fl(n)})):t.push({name:r,type:e[r]})}return t};var ul=(e,t)=>
9{let r=[];return t.forEach(n=>{if(typeof n.components=="object"){if(!n.type.startsWith("tuple"))throw new Q(`Invalid value given "${n.type}". Error: components found but type is not tuple.`);let o=n.type.indexOf("["),i=o>=0?n.type.substring(o):"",s=ul(e,n.components);Array.isArray(s)&&e?r.push(`tuple(${s.join(",")})${i}`):e?r.push(`(${s.join()})`):r.push(`(${s.join(",")})${i}`)}else r.push(n.type)}),r},ut=e=>{var t,r,n,o;return zn(e)||Ds(e)||si(e)?!((t=e.name)===null||t===void 0)&&t.includes("(")?e.name:`${(r=e.name)!==null&&r!==void 0?r:""}(${ul(!1,(n=e.inputs)!==null&&n!==void 0?n:[]).join(",")})`:`(${ul(!1,(o=e.inputs)!==null&&o!==void 0?o:[]).join(",")})`};var ag=e=>{if(typeof e!="string"&&!zn(e))throw new Q("Invalid parameter value in encodeErrorSignature");let t;return e&&(typeof e=="function"||typeof e=="object")?t=ut(e):t=e,$e(t)};var ai=e=>{if(typeof e!="string"&&!Ds(e))throw new Q("Invalid parameter value in encodeEventSignature");let t;return e&&(typeof e=="function"||typeof e=="object")?t=ut(e):t=e,$e(t)};function Au(e,t){return e.exec(t)?.groups}var ll=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,hl=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,pl=/^\(.+?\).*?$/;var jT=Object.defineProperty,GT=(e,t,r)=>t in e?jT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ci=(e,t,r)=>(GT(e,typeof t!="symbol"?t+"":t,r),r);var qT="abitype",WT="0.7.1",lt=class extends Error{constructor(e,t={}){let r=t.cause instanceof lt?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof lt&&t.cause.docsPath||t.docsPath,o=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: https://abitype.dev${n}`]:[],...r?[`Details: ${r}`]:[],`Version: ${qT}@${WT}`].join(` 10`);super(o),ci(this,"details"),ci(this,"docsPath"),ci(this,"metaMessages"),ci(this,"shortMessage"),ci(this,"name","AbiTypeError"),t.cause&&(this.cause=t.cause),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.shortMessage=e}};var ug=/^struct (?<name>[a-zA-Z0-9_]+) \{(?<properties>.*?)\}$/;function dg(e){return ug.test(e)}function VT(e){return Au(ug,e)}var cg=new Set(["memory","indexed","storage","calldata"]);var zT=new Set(["calldata","memory","storage"]);function KT(e,t){return t?`${t}:${e}`:e}var ml=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);var ZT=/^(?<type>[a-zA-Z0-9_]+?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z0-9_]+))?$/,XT=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z0-9_]+))?$/,JT=/^u?int$/;function Iu(e,t){let r=KT(e,t?.type);if(ml.has(r))return ml.get(r);let n=pl.test(e),o=Au(n?XT:ZT,e);if(!o)throw new lt("Invalid ABI parameter.",{details:e});if(o.name&&QT(o.name))throw new lt("Invalid ABI parameter.",{details:e,metaMessages:[`"${o.name}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]});let i=o.name?{name:o.name}:{},s=o.modifier==="indexed"?{indexed:!0}:{},a=t?.structs??{},u,d={};if(n){u="tuple";let f=ui(o.type),_=[],w=f.length;for(let k=0;k<w;k++)_.push(Iu(f[k],{structs:a}));d={components:_}}else if(o.type in a)u="tuple",d={components:a[o.type]};else if(JT.test(o.type))u=`${o.type}256`;else if(u=o.type,t?.type!=="struct"&&!fg(u))throw new lt("Unknown type.",{metaMessages:[`Type "${u}" is not a valid ABI type.`]});if(o.modifier){if(!t?.modifiers?.has?.(o.modifier))throw new lt("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${o.modifier}" not allowed${t?.type?` in "${t.type}" type`:""}.`]});if(zT.has(o.modifier)&&!e1(u,!!o.array))throw new lt("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${o.modifier}" not allowed${t?.type?` in "${t.type}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${o.modifier}" was given.`]})}let c=B(B(B({type:`${u}${o.array??""}`},i),s),d);return ml.set(r,c),c}function ui(e,t=[],r="",n=0){if(e===""){if(r==="")return t;if(n!==0)throw new lt("Unbalanced parentheses.",{metaMessages:[`"${r.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`});return[...t,r.trim()]}let o=e.length;for(let i=0;i<o;i++){let s=e[i],a=e.slice(i+1);switch(s){case",":return n===0?ui(a,[...t,r.trim()]):ui(a,t,`${r}${s}`,n);case"(":return ui(a,t,`${r}${s}`,n+1);case")":return ui(a,t,`${r}${s}`,n-1);default:return ui(a,t,`${r}${s}`,n)}}return[]}function fg(e){return e==="address"||e==="bool"||e==="function"||e==="string"||ll.test(e)||hl.test(e)}var YT=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function QT(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||ll.test(e)||hl.test(e)||YT.test(e)}function e1(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function t1(e){let t={},r=e.length;for(let s=0;s<r;s++){let a=e[s];if(!dg(a))continue;let u=VT(a);if(!u)throw new lt("Invalid struct signature.",{details:a});let d=u.properties.split(";"),c=[],f=d.length;for(let _=0;_<f;_++){let k=d[_].trim();if(!k)continue;let T=Iu(k,{type:"struct"});c.push(T)}if(!c.length)throw new lt("Invalid struct signature.",{details:a,metaMessages:["No properties exist."]});t[u.name]=c}let n={},o=Object.entries(t),i=o.length;for(let s=0;s<i;s++){let[a,u]=o[s];n[a]=lg(u,t)}return n}var r1=/^(?<type>[a-zA-Z0-9_]+?)(?<array>(?:\[\d*?\])+?)?$/;function lg(e,t,r=new Set){let n=[],o=e.length;for(let i=0;i<o;i++){let s=e[i];if(pl.test(s.type))n.push(s);else{let u=Au(r1,s.type);if(!u?.type)throw new lt("Invalid ABI parameter.",{details:JSON.stringify(s,null,2),metaMessages:["ABI parameter type is invali
10d."]});let{array:d,type:c}=u;if(c in t){if(r.has(c))throw new lt("Circular reference detected.",{metaMessages:[`Struct "${c}" is a circular reference.`]});n.push(Z(B({},s),{type:`tuple${d??""}`,components:lg(t[c]??[],t,new Set([...r,c]))}))}else if(fg(c))n.push(s);else throw new lt("Unknown type.",{metaMessages:[`Type "${c}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]})}}return n}function hg(e){let t;if(typeof e=="string")t=Iu(e,{modifiers:cg});else{let r=t1(e),n=e.length;for(let o=0;o<n;o++){let i=e[o];if(!dg(i)){t=Iu(i,{modifiers:cg,structs:r});break}}}if(!t)throw new lt("Failed to parse ABI parameter.",{details:`parseAbiParameter(${JSON.stringify(e,null,2)})`,docsPath:"/api/human.html#parseabiparameter-1"});return t}var Ae=32;function Hs(e=0){var t;if(((t=globalThis.Buffer)===null||t===void 0?void 0:t.alloc)!==void 0){let r=globalThis.Buffer.alloc(e);return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}return new Uint8Array(e)}function pg(e){var t,r;return Object.assign(Object.assign({},e),{name:(t=e.name)!==null&&t!==void 0?t:"",components:(r=e.components)===null||r===void 0?void 0:r.map(n=>pg(n))})}function n1(e){return!V(e)&&typeof e=="object"&&!V(e.type)&&typeof e.type=="string"}function Ru(e){return e.map(t=>{var r;if(n1(t))return t;if(typeof t=="string")return pg(hg(t.replace(/tuple/,"")));if(sg(t)){let n=Object.keys(t)[0],o=dl(n);return o.name=(r=o.name)!==null&&r!==void 0?r:"",Object.assign(Object.assign({},o),{components:fl(t[n])})}throw new Q("Invalid abi")})}function Su(e){let t=e.type.lastIndexOf("["),r=e.type.substring(0,t),n=e.type.substring(t),o=-1;if(n!=="[]"&&(o=Number(n.slice(1,-1)),isNaN(o)))throw new Q("Invalid fixed array size",{size:n});return{param:{type:r,name:"",components:e.components},size:o}}function di(e){var t,r;return e.type==="string"||e.type==="bytes"||e.type.endsWith("[]")?!0:e.type==="tuple"?(r=(t=e.components)===null||t===void 0?void 0:t.some(di))!==null&&r!==void 0?r:!1:e.type.endsWith("]")?di(Su(e).param):!1}var mg=20,gg=Ae-mg;function gl(e,t){if(typeof t!="string")throw new Q("address type expects string as input type",{value:t,name:e.name,type:e.type});let r=t.toLowerCase();if(r.startsWith("0x")||(r=`0x${r}`),!Ne(r))throw new Q("provided input is not valid address",{value:t,name:e.name,type:e.type});let n=be.hexToUint8Array(r),o=Hs(Ae);return o.set(n,gg),{dynamic:!1,encoded:o}}function yl(e,t){let r=t.subarray(gg,Ae);if(r.length!==mg)throw new Q("Invalid decoding input, not enough bytes to decode address",{bytes:t});let n=be.uint8ArrayToHexString(r);return{result:Ve(n),encoded:t.subarray(Ae),consumed:Ae}}var Sr=new Map,ku=BigInt(256);for(let e=8;e<=256;e+=8)Sr.set(`uint${e}`,{min:BigInt(0),max:ku-BigInt(1)}),Sr.set(`int${e}`,{min:-ku/BigInt(2),max:ku/BigInt(2)-BigInt(1)}),ku*=BigInt(256);Sr.set("int",Sr.get("int256"));Sr.set("uint",Sr.get("uint256"));var yg=BigInt(1)<<BigInt(256);function o1(e,t=Ae){let r;return e<0?r=(yg+e).toString(16):r=e.toString(16),r=Zr(r,t*2),be.hexToUint8Array(r)}function i1(e,t){let r=be.uint8ArrayToHexString(e),n=BigInt(r);return n<=t?n:n-yg}function Zt(e,t){let r;try{r=tr(t)}catch{throw new Q("provided input is not number value",{type:e.type,value:t,name:e.name})}let n=Sr.get(e.type);if(!n)throw new Q("provided abi contains invalid number datatype",{type:e.type});if(r<n.min)throw new Q("provided input is less then minimum for given type",{type:e.type,value:t,name:e.name,minimum:n.min.toString()});if(r>n.max)throw new Q("provided input is greater then maximum for given type",{type:e.type,value:t,name:e.name,maximum:n.max.toString()});return{dynamic:!1,encoded:o1(r)}}function Ct(e,t){if(t.length<Ae)throw new Q("Not enough bytes left to decode",{param:e,bytesLeft:t.length});let r=t.subarray(0,Ae),n=Sr.get(e.type);if(!n)throw new Q("provided abi contains invalid number datatype",{type:e.type});let o=i1(r,n.max);if(o<n.min)throw new Q("decoded value is less then minimum for given type",{type:e.type,value:o,name:e.name,minimum:n.min.toString()});if(o>n.max)throw new Q("decoded value is greater then maximum for given type",{type:e.type,value:o,name:e.name,maximum:n.max.toString()});return{result:o,encoded:t.subarray(Ae),consumed:Ae}}function xl(e,t){let r;try{r=Kd(t)}catch(n){if(n instanceof jr)throw new Q("provided input is not val
10id boolean value",{type:e.type,value:t,name:e.name})}return Zt({type:"uint8",name:""},Number(r))}function vl(e,t){let r=Ct({type:"uint8",name:""},t);if(r.result>1||r.result<0)throw new Q("Invalid boolean value encoded",{boolBytes:t.subarray(0,Ae),numberResult:r});return{result:r.result===BigInt(1),encoded:r.encoded,consumed:Ae}}var s1=32;function Fs(e,t){if(typeof t=="string"&&t.length%2!==0&&(t+="0"),!jt(t))throw new Q("provided input is not valid bytes value",{type:e.type,value:t,name:e.name});let r=st(t),[,n]=e.type.split("bytes");if(n){if(Number(n)>s1||Number(n)<1)throw new Q("invalid bytes type. Static byte type can have between 1 and 32 bytes",{type:e.type});if(Number(n)<r.length)throw new Q("provided input size is different than type size",{type:e.type,value:t,name:e.name});let s=Hs(Ae);return s.set(r),{dynamic:!1,encoded:s}}let o=Math.ceil(r.length/Ae),i=Hs(Ae+o*Ae);return i.set(Zt({type:"uint32",name:""},r.length).encoded),i.set(r,Ae),{dynamic:!0,encoded:i}}function Us(e,t){let[,r]=e.type.split("bytes"),n=Number(r),o=t,i=1,s=0;if(!n){let a=Ct({type:"uint32",name:""},o);n=Number(a.result),s+=a.consumed,o=a.encoded,i=Math.ceil(n/Ae)}if(n>t.length)throw new Q("there is not enough data to decode",{type:e.type,encoded:t,size:n});return{result:Y(o.subarray(0,n)),encoded:o.subarray(i*Ae),consumed:s+i*Ae}}function bl(e,t){if(typeof t!="string")throw new Q("invalid input, should be string",{input:t});let r=Nc(t);return Fs({type:"bytes",name:""},r)}function _l(e,t){let r=Us({type:"bytes",name:""},t);return{result:hs(r.result),encoded:r.encoded,consumed:r.consumed}}function Pu(e){let t=0,r=0,n=[],o=[];for(let i of e)i.dynamic?t+=Ae:t+=i.encoded.length;for(let i of e)i.dynamic?(n.push(Zt({type:"uint256",name:""},t+r)),o.push(i),r+=i.encoded.length):n.push(i);return Ce(...n.map(i=>i.encoded),...o.map(i=>i.encoded))}function wl(e,t){if(!Array.isArray(t))throw new Q("Expected value to be array",{abi:e,values:t});let{size:r,param:n}=Su(e),o=t.map(a=>$s(n,a)),i=r===-1,s=o.length>0&&o[0].dynamic;if(!i&&t.length!==r)throw new Q("Given arguments count doesn't match array length",{arrayLength:r,argumentsLength:t.length});if(i||s){let a=Pu(o);if(i){let u=Zt({type:"uint256",name:""},o.length).encoded;return{dynamic:!0,encoded:o.length>0?Ce(u,a):u}}return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Ce(...o.map(a=>a.encoded))}}function El(e,t){let{size:r,param:n}=Su(e),o=r===-1,i=0,s=[],a=t;if(o){let d=Ct({type:"uint32",name:""},t);r=Number(d.result),i=d.consumed,a=d.encoded}if(di(n)){for(let d=0;d<r;d+=1){let c=Ct({type:"uint32",name:""},a.subarray(d*Ae));i+=c.consumed;let f=fi(n,a.subarray(Number(c.result)));i+=f.consumed,s.push(f.result)}return{result:s,encoded:a.subarray(i),consumed:i}}for(let d=0;d<r;d+=1){let c=fi(n,t.subarray(i));i+=c.consumed,s.push(c.result)}return{result:s,encoded:t.subarray(i),consumed:i}}function $s(e,t){if(e.type==="string")return bl(e,t);if(e.type==="bool")return xl(e,t);if(e.type==="address")return gl(e,t);if(e.type==="tuple")return li(e,t);if(e.type.endsWith("]"))return wl(e,t);if(e.type.startsWith("bytes"))return Fs(e,t);if(e.type.startsWith("uint")||e.type.startsWith("int"))return Zt(e,t);throw new Q("Unsupported",{param:e,value:t})}function fi(e,t){if(e.type==="string")return _l(e,t);if(e.type==="bool")return vl(e,t);if(e.type==="address")return yl(e,t);if(e.type==="tuple")return js(e,t);if(e.type.endsWith("]"))return El(e,t);if(e.type.startsWith("bytes"))return Us(e,t);if(e.type.startsWith("uint")||e.type.startsWith("int"))return Ct(e,t);throw new Q("Unsupported",{param:e,bytes:t})}function li(e,t){var r,n,o;let i=!1;if(!Array.isArray(t)&&typeof t!="object")throw new Q("param must be either Array or Object",{param:e,input:t});let s=t,a=[];for(let u=0;u<((n=(r=e.components)===null||r===void 0?void 0:r.length)!==null&&n!==void 0?n:0);u+=1){let d=e.components[u],c;if(Array.isArray(s)){if(u>=s.length)throw new Q("input param length missmatch",{param:e,input:t});c=$s(d,s[u])}else{let f=s[(o=d.name)!==null&&o!==void 0?o:""];if(f==null)throw new Q("missing input defined in abi",{param:e,input:t,paramName:d.name});c=$s(d,f)}c.dynamic&&(i=!0),a.push(c)}return i?{dynamic:!0,encoded:Pu(a)}:{dynamic:!1,encoded:Ce(...a.map(u=>u.encoded))}}function js(e,t){let r={__length__:0},n=0;if(!e.components)return{result:r,encoded:t,consumed:n};let o=0;for(let[i,s]of e.components.entries()){let a;if(di(s)){let u=Ct({type:"uint32",name:""},t.subarray(n));a=fi(s,t.subarray(Number(u.result))),n+=u.consumed,o+=a.consumed}else a=fi(s,t.subarray(n)),n+=a.consumed;r.__length__+=1,r[i]=a.result,s.name&&s.name!==""&&(r[s.name]=a.result)}return{encoded:t.subarray(n+o),result:r,consumed:n+o}}function xg(e,t,r){let n=Ru(e),o=be.hexToUint8Array(t);return js({type:"tuple",name:"",components:n},o).result}function vg(e){let t=[];return e.forEach(r=>{if(Array.isArray(r)){let n=vg(r);t.push({type:"tuple",components:n,name:""})}else t.push({type:rt(r,!0)})}),t}function ur(e,t){if(e?.length!==t.length)throw new Q("Invalid number of values received for given ABI",{expected:e?.length,received:t.length});let r=Ru(e);return be.uint8ArrayToHexString(li({type:"tuple",name:"",components:r},t).encoded)}function Tl(e){try{let t=vg(e);return be.uint8ArrayToHexString(li({type:"tuple",name:"",components:t},e).encoded)}catch{throw new Q("Could not infer types from given params",{params:e})}}var Gs=(e,t)=>ur([e],[t]),Al=(e,t,r)=>{try{if(e.length>0&&(!t||t==="0x"||t==="0X"))throw new Q("Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.");return xg(e,`0x${t.replace(/0x/i,"")}`,r)}catch(n){throw new Q(`Parameter decoding error: ${n.message}`,{internalErr:n})}},dr=(e,t)=>
10Al(e,t,!1),Bu=(e,t)=>dr([e],t)[0];var ln=e=>{if(typeof e!="string"&&!si(e))throw new Q("Invalid parameter value in encodeFunctionSignature");let t;return e&&(typeof e=="function"||typeof e=="object")?t=ut(e):t=e,$e(t).slice(0,10)},bg=(e,t)=>{var r;if(!si(e))throw new Q("Invalid parameter value in encodeFunctionCall");return`${ln(e)}${ur((r=e.inputs)!==null&&r!==void 0?r:[],t??[]).replace("0x","")}`},hi=(e,t,r=!0)=>{let n=r&&t&&t.length>=10&&t.startsWith("0x")?t.slice(10):t;if(!e.inputs)throw new Me("No inputs found in the ABI");let o=dr([...e.inputs],n);return Object.assign(Object.assign({},o),{__method__:ut(e)})},Il=(e,t)=>{if(e.type==="constructor")return t;if(!t)return null;let r=t.length>=2?t.slice(2):t;if(!e.outputs)return null;let n=dr([...e.outputs],r);return n.__length__===1?n[0]:n};var a1=["bool","string","int","uint","address","fixed","ufixed"],c1=(e,t)=>e==="string"?t:Bu(e,t),Nu=(e,t,r)=>{let n=Array.isArray(r)?r:[r],o={},i={};for(let[_,w]of e.entries())w.indexed?o[_]=w:i[_]=w;let s=t?Al(Object.values(i),t,!0):{__length__:0},a=n.length-Object.keys(o).length,u=Object.values(o).map((_,w)=>a1.some(k=>_.type.startsWith(k))?c1(_.type,n[w+a]):n[w+a]),d={__length__:0},c=0,f=0;for(let[_,w]of e.entries())d[_]=w.type==="string"?"":void 0,o[_]&&(d[_]=u[c],c+=1),i[_]&&(d[_]=s[String(f)],f+=1),w.name&&(d[w.name]=d[_]),d.__length__+=1;return d};var pi=(e,t)=>{if(t?.data){let r,n,o;try{let i=t.data.slice(0,10),s=e.find(a=>ag(a).startsWith(i));s?.inputs?(r=s.name,n=ut(s),o=dr([...s.inputs],t.data.substring(10))):t.data.startsWith("0x08c379a0")?(r="Error",n="Error(string)",o=dr([{name:"message",type:"string"}],t.data.substring(10))):t.data.startsWith("0x4e487b71")?(r="Panic",n="Panic(uint256)",o=dr([{name:"code",type:"uint256"}],t.data.substring(10))):console.error("No matching error abi found for error data",t.data)}catch(i){console.error(i)}r&&t.setDecodedProperties(r,n,o)}};var d1=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Rl=(e,t)=>{var r,n,o,i,s;if(e instanceof pt&&e.cause instanceof Ii){if(t!==void 0){let a=t.filter(u=>zn(u));return pi(a,e.cause),{reason:e.cause.message,signature:(r=e.cause.data)===null||r===void 0?void 0:r.slice(0,10),data:(n=e.cause.data)===null||n===void 0?void 0:n.substring(10),customErrorName:e.cause.errorName,customErrorDecodedSignature:e.cause.errorSignature,customErrorArguments:e.cause.errorArgs}}return{reason:e.cause.message,signature:(o=e.cause.data)===null||o===void 0?void 0:o.slice(0,10),data:(i=e.cause.data)===null||i===void 0?void 0:i.substring(10)}}if(e instanceof Jt&&!Array.isArray((s=e.cause)===null||s===void 0?void 0:s.errors)&&e.cause!==void 0)return e.cause.message;throw e};function Ou(e,t,r){return d1(this,arguments,void 0,function*(n,o,i,s=n.defaultReturnFormat){try{yield mi(n,o,n.defaultBlock,s);return}catch(a){return Rl(a,i)}})}var f1=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})};function Cu(e,t,r,n,o,i){return f1(this,void 0,void 0,function*(){let s=i;s===void 0&&(n!==void 0?s=Rl(n):e.handleRevert&&t!==void 0&&(s=yield Ou(e,t,o)));let a;if(s===void 0)a=new ao(r);else if(typeof s=="string")a=new Ur(s,void 0,r);else if(s.customErrorName!==void 0&&s.customErrorDecodedSignature!==void 0&&s.customErrorArguments!==void 0){let u=s;a=new so(u.reason,u.customErrorName,u.customErrorDecodedSignature,u.customErrorArguments,u.signature,r,u.data)}else a=new Ur(s.reason,s.signature,r,s.data);return a})}var Kn=(e,t,r,n=Be)=>{var o,i,s,a,u,d;let c=Object.assign({},e),f=M(ar,t,n);if([Rr,"allEvents"].includes(c.name)){let w=r.find(k=>k.signature===t.topics[0]);w?c=w:c={anonymous:!0}}if(c.inputs=(i=(o=c.inputs)!==null&&o!==void 0?o:e.inputs)!==null&&i!==void 0?i:[],!c.anonymous){let w=0;
10((s=c.inputs)!==null&&s!==void 0?s:[]).forEach(k=>{k.indexed&&(w+=1)}),w>0&&t?.topics&&t?.topics.length!==w+1&&(c=Object.assign(Object.assign({},c),{anonymous:!0,inputs:[]}))}let _=c.anonymous?t.topics:((a=t.topics)!==null&&a!==void 0?a:[]).slice(1);return Object.assign(Object.assign({},f),{returnValues:Nu([...(u=c.inputs)!==null&&u!==void 0?u:[]],t.data,_),event:c.name,signature:!c.anonymous&&((d=t.topics)===null||d===void 0?void 0:d.length)>0&&t.topics[0]?t.topics[0]:void 0,raw:{data:t.data,topics:t.topics}})};var Zn=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},gi=class{constructor({options:t,web3Context:r,promiEvent:n,returnFormat:o}){this.options={checkRevertBeforeSending:!0},this.options=t,this.web3Context=r,this.promiEvent=n,this.returnFormat=o}getReceiptWithEvents(t){var r,n;let o=Object.assign({},t??{});if(!((r=this.options)===null||r===void 0)&&r.contractAbi&&o.logs&&o.logs.length>0){o.events={};for(let i of o.logs){let s=Kn(Os,i,(n=this.options)===null||n===void 0?void 0:n.contractAbi,this.returnFormat);s.event&&(o.events[s.event]=s)}}return o}checkRevertBeforeSending(t){return Zn(this,void 0,void 0,function*(){if(this.options.checkRevertBeforeSending!==!1){let r=t;S(t.data)&&S(t.input)&&S(t.gas)&&(r=Object.assign(Object.assign({},t),{gas:21e3}));let n=yield Ou(this.web3Context,r,this.options.contractAbi);if(n!==void 0)throw yield Cu(this.web3Context,t,void 0,void 0,this.options.contractAbi,n)}})}emitSending(t){this.promiEvent.listenerCount("sending")>0&&this.promiEvent.emit("sending",t)}populateGasPrice(t){return Zn(this,arguments,void 0,function*({transactionFormatted:r,transaction:n}){var o;let i=r;return!this.web3Context.config.ignoreGasPricing&&!(!((o=this.options)===null||o===void 0)&&o.ignoreGasPricing)&&S(r.gasPrice)&&(S(n.maxPriorityFeePerGas)||S(n.maxFeePerGas))&&(i=Object.assign(Object.assign({},r),yield xu(r,this.web3Context,J))),i})}signAndSend(t){return Zn(this,arguments,void 0,function*({wallet:r,tx:n}){if(r){let o=yield r.signTransaction(n);return oi(this.web3Context,()=>Zn(this,void 0,void 0,function*(){return X.sendRawTransaction(this.web3Context.requestManager,o.rawTransaction)}),o.transactionHash)}return oi(this.web3Context,()=>Zn(this,void 0,void 0,function*(){return X.sendTransaction(this.web3Context.requestManager,n)}))})}emitSent(t){this.promiEvent.listenerCount("sent")>0&&this.promiEvent.emit("sent",t)}emitTransactionHash(t){this.promiEvent.listenerCount("transactionHash")>0&&this.promiEvent.emit("transactionHash",t)}emitReceipt(t){this.promiEvent.listenerCount("receipt")>0&&this.promiEvent.emit("receipt",t)}handleError(t){return Zn(this,arguments,void 0,function*({error:r,tx:n}){var o;let i=r;return i instanceof pt&&this.web3Context.handleRevert&&(i=yield Cu(this.web3Context,n,void 0,void 0,(o=this.options)===null||o===void 0?void 0:o.contractAbi)),(i instanceof Jt||i instanceof pt||i instanceof so||i instanceof ao||i instanceof Ur||i instanceof uo)&&this.promiEvent.listenerCount("error")>0&&this.promiEvent.emit("error",i),i})}emitConfirmation({receipt:t,transactionHash:r,customTransactionReceiptSchema:n}){this.promiEvent.listenerCount("confirmation")>0&&og(this.web3Context,this.promiEvent,t,r,this.returnFormat,n)}handleResolve(t){return Zn(this,arguments,void 0,function*({receipt:r,tx:n}){var o,i,s;if(!((o=this.options)===null||o===void 0)&&o.transactionResolver)return(i=this.options)===null||i===void 0?void 0:i.transactionResolver(r);if(r.status===BigInt(0)){let a=yield Cu(this.web3Context,n,r,void 0,(s=this.options)===null||s===void 0?void 0:s.contractAbi);throw this.promiEvent.listenerCount("error")>0&&this.promiEvent.emit("error",a),a}else return r})}};var Ee=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},l1=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};var _g=e=>Ee(void 0,void 0,void 0,function*(){return X.getSyncing(e.requestManager)});function wg(e,t){return Ee(this,void 0,void 0,function*(){let r=yield X.getHashRate(e.requestManager);return M({format:"uint"},r,t??e.defaultReturnFormat)})}function Cs(e,t){return Ee(this,void 0,void 0,function*(){let r=yield X.getGasPrice(e.requestManager);return M({format:"uint"},r,t??e.defaultReturnFormat)})}function Eg(e,t){return Ee(this,void 0,void 0,function*(){let r=yield X.getMaxPriorityFeePerGas(e.requestManager);return M({format:"uint"},r,t??e.defaultReturnFormat)})}function Ls(e,t){return Ee(this,void 0,void 0,function*(){let r=yield X.getBlockNumber(e.requestManager);return M({format:"uint"},r,t??e.defaultReturnFormat)})}function Tg(e,t){return Ee(this,arguments,void 0,function*(r,n,o=r.defaultBlock,i){let s=Le(o)?o:M({format:"uint"},o,J),a=yield X.getBalance(r.requestManager,n,s);return M({format:"uint"},a,i??r.defaultReturnFormat)})}function Ag(e,t,r){return Ee(this,arguments,void 0,function*(n,o,i,s=n.defaultBlock,a){let u=M({format:"uint"},i,J),d=Le(s)?s:M({format:"uint"},s,J),c=yield X.getStorageAt(n.requestManager,o,u,d);return M({format:"bytes"},c,a??n.defaultReturnFormat)})}function Ig(e,t){return Ee(this,arguments,void 0,function*(r,n,o=r.defaultBlock,i){let s=Le(o)?o:M({format:"uint"},o,J),a=yield X.getCode(r.requestManager,n,s);return M({format:"bytes"},a,i??r.defaultReturnFormat)})}function vu(e){return Ee(this,arguments,void 0,function*(t,r=t.defaultBlock,n=!1,o){var i;let s;if(jt(r)){let u=M({format:"bytes32"},r,J);s=yield X.getBlockByHash(t.requestManager,u,n)}else{let u=Le(r)?r:M({format:"uint"},r,J);s=yield X.getBlockByNumber(t.requestManager,u,n)}let a=M(ti,s,o??t.defaultReturnFormat);return S(a)?a:Object.assign(Object.assign({},a),{transactions:(i=a.transactions)!==null&&i!==void 0?i:[]})})}function Rg(e){return Ee(this,arguments,void 0,function*(t,r=t.defaultBlock,n){let o;if(jt(r)){let i=M({format:"bytes32"},r,J);o=yield X.getBlockTransactionCountByHash(t.requestManager,i)}else{let i=Le(r)?r:M({format:"uint"},r,J);o=yield X.getBlockTransactionCountByNumber(t.requestManager,i)}return M({format:"uint"},o,n??t.defaultReturnFormat)})}function Sg(e){return Ee(this,arguments,void 0,function*(t,r=t.defaultBlock,n){let o;if(jt(r)){let i=M({format:"bytes32"},r,J);o=yield X.getUncleCountByBlockHash(t.requestManager,i)}else{let i=Le(r)?r:M({format:"uint"},r,J);o=yield X.getUncleCountByBlockNumber(t.requestManager,i)}return M({format:"uint"},o,n??t.defaultReturnFormat)})}function kg(e){return Ee(this,arguments,void 0,function*(t,r=t.defaultBlock,n,o){let i=M({format:"uint"},n,J),s;if(jt(r)){let a=M({format:"bytes32"},r,J);s=yield X.getUncleByBlockHashAndIndex(t.requestManager,a,i)}else{let a=Le(r)?r:M({format:"uint"},r,J);s=yield X.getUncleByBlockNumberAndIndex(t.requestManager,a,i)}return M(ti,s,o??t.defaultReturnFormat)})}function Pg(e,t){return Ee(this,arguments,void 0,function*(r,n,o=r.defaultReturnFormat){let i=M({format:"bytes32"},n,Be),s=yield X.getTransactionByHash(r.requestManager,i);return S(s)?s:Ge(s,o,{transactionSchema:r.config.customTransactionSchema,fillInputAndData:!0})})}function Bg(e,t){return Ee(this,void 0,void 0,function*(){return(yield X.getPendingTransactions(e.requestManager)).map(n=>Ge(n,t??e.defaultReturnFormat,{transactionSchema:e.config.customTransactionSchema,fillInputAndData:!0}))})}function Ng(e){return Ee(this,arguments,void 0,function*(t,r=t.defaultBlock,n,o){let i=M({format:"uint"},n,J),s;if(jt(r)){let a=M({format:"bytes32"},r,J);s=yield X.getTransactionByBlockHashAndIndex(t.requestManager,a,i)}else{let a=Le(r)?r:M({format:"uint"},r,J);s=yield X.getTransactionByBlockNumberAndIndex(t.requestManager,a,i)}return S(s)?s:Ge(s,o??t.defaultReturnFormat,{transactionSchema:t.config.customTransactionSchema,fillInputAndData:!0})})}function Tu(e,t,r){return Ee(this,void 0,void 0,function*(){let n=M({format:"bytes32"},t,Be),o;try{o=yield X.getTransactionReceipt(e.requestManager,n)}catch(i){if(typeof i=="object"&&!S(i)&&"message"in i&&i.message==="transaction indexing is in progress")console.warn("Transaction indexing is in progress.");else throw i}return S(o)?o:M(cr,o,r??e.defaultReturnFormat)})}function bu(e,t){return Ee(this,arguments,void 0,function*(r,n,o=r.defaultBlock,i){let s=Le(o)?o:M({format:"uint"},o,J),a=yield X.getTransactionCount(r.requestManager,n,s);return M({format:"uint"},a,i??r.defaultReturnFormat)})}function hn(e,t,r,n={checkRevertBeforeSending:!0},o){let i=new Qo((s,a)=>{setImmediate(()=>{Ee(this,void 0,void 0,function*(){let u=new gi({web3Context:e,promiEvent:i,options:n,returnFormat:r}),d=Object.assign({},t);S(o)||(d=yield o.processTransaction(d));let c=Ge(Object.assign(Object.assign({},d),{from:Ms("from",e,d),to:Ms("to",e,d)}),J,{transactionSchema:e.config.customTransactionSchema});try{c=yield u.populateGasPrice({transaction:d,transactionFormatted:c}),yield u.checkRevertBeforeSending(c),u.emitSending(c);let f;e.wallet&&!S(c.from)&&(f=e.wallet.get(c.from));let _=yield u.signAndSend({wallet:f,tx:c}),w=M({format:"bytes32"},_,r??e.defaultReturnFormat);u.emitSent(c),u.emitTransactionHash(w);let k=yield Eu(e,_,r??e.defaultReturnFormat),T=u.getReceiptWithEvents(M(cr,k,r??e.defaultReturnFormat));u.emitReceipt(T),s(yield u.handleResolve({receipt:T,tx:c})),u.emitConfirmation({receipt:T,transactionHash:_})}catch(f){a(yield u.handleError({error:f,tx:c}))}})})});return i}function Og(e,t,r,n={checkRevertBeforeSending:!0}){let o=new Qo((i,s)=>{setImmediate(()=>{Ee(this,void 0,void 0,function*(){let a=new gi({web3Context:e,promiEvent:o,options:n,returnFormat:r}),u=M({format:"bytes"},t,J),d=Nt.fromSerializedData(st(me(u))),c=Object.assign(Object.assign({},d.toJSON()),{from:d.getSenderAddress().toString()});try{let{v:f,r:_,s:w}=c,k=l1(c,["v","r","s"]);yield a.checkRevertBeforeSending(k),a.emitSending(u);let T=yield oi(e,()=>Ee(this,void 0,void 0,function*(){return X.sendRawTransaction(e.requestManager,u)}));a.emitSent(u);let R=M({format:"bytes32"},T,r??e.defaultReturnFormat);a.emitTransactionHash(R);let P=yield Eu(e,T,r??e.defaultReturnFormat),b=a.getReceiptWithEvents(M(cr,P,r??e.defaultReturnFormat));a.emitReceipt(b),i(yield a.handleResolve({receipt:b,tx:c})),a.emitConfirmation({receipt:b,transactionHash:T})}catch(f){s(yield a.handleError({error:f,tx:c}))}})})});return o}function Cg(e,t,r){return Ee(this,arguments,void 0,function*(n,o,i,s=n.defaultReturnFormat){var a;let u=M({format:"bytes"},o,Be);if(!((a=n.wallet)===null||a===void 0)&&a.get(i)){let f=n.wallet.get(i).sign(u);return M(K0,f,s)}if(typeof i=="number")throw new Ea(o,'RPC method "eth_sign" does not support index signatures');let d=yield X.sign(n.requestManager,i,u);return M({format:"bytes"},d,s)})}function Mg(e,t){return Ee(this,arguments,void 0,function*(r,n,o=r.defaultReturnFormat){let i=yield X.signTransaction(r.requestManager,Ge(n,J,{transactionSchema:r.config.customTransactionSchema}));return Eo(i)?J0(i,o,{fillInputAndData:!0}):{raw:M({format:"bytes"},i.raw,o),tx:Ge(i.tx,o,{transactionSchema:r.config.customTransactionSchema,fillInputAndData:!0})}})}function mi(e,t){return Ee(this,arguments,void 0,function*(r,n,o=r.defaultBlock,i=r.defaultReturnFormat){let s=Le(o)?o:M({format:"uint"},o,J),a=yield X.call(r.requestManager,Ge(n,J,{transactionSchema:r.config.customTransactionSchema}),s);return M({format:"bytes"},a,i)})}function ni(e,t){return Ee(this,arguments,void 0,function*(r,n,o=r.defaultBlock,i){let s=Ge(n,J,{transactionSchema:r.config.customTransactionSchema}),a=Le(o)?o:M({format:"uint"},o,J),u=yield X.estimateGas(r.requestManager,s,a);return M({format:"uint"},u,i??r.defaultReturnFormat)})}function Mu(e,t,r){return Ee(this,void 0,void 0,function*(){let{toBlock:n,fromBlock:o}=t;S(n)||(typeof n=="number"||typeof n=="bigint")&&(n=Ie(n)),S(o)||(typeof o=="number"||typeof o=="bigint")&&(o=Ie(o));let i=Object.assign(Object.assign({},t),{fromBlock:o,toBlock:n});return(yield X.getLogs(e.requestManager,i)).map(u=>typeof u=="string"?u:M(ar,u,r??e.defaultReturnFormat))})}function _u(e,t){return Ee(this,void 0,void 0,function*(){let r=yield X.getChainId(e.requestManager);return M({format:"uint"},r,t??e.defaultReturnFormat)})}function Lg(e,t,r){return Ee(this,arguments,void 0,function*(n,o,i,s=n.defaultBlock,a){let u=i.map(f=>M({format:"bytes"},f,J)),d=Le(s)?s:M({format:"uint"},s,J),c=yield X.getProof(n.requestManager,o,u,d);return M(X0,c,a??n.defaultReturnFormat)})}function Dg(e,t){return Ee(this,arguments,void 0,function*(r,n,o=r.defaultBlock,i,s){let a=M({format:"uint"},n,J),u=Le(o)?o:M({format:"uint"},o,J),d=M({type:"array",items:{format:"uint"}},i,Vn),c=yield X.getFeeHistory(r.requestManager,a,u,d);return M(Z0,c,s??r.defaultReturnFormat)})}function Lu(e,t){return Ee(this,arguments,void 0,function*(r,n,o=r.defaultBlock,i){let s=Le(o)?o:M({format:"uint"},o,J),a=yield X.createAccessList(r.requestManager,Ge(n,J,{transactionSchema:r.config.customTransactionSchema}),s);return M(q0,a,i??r.defaultReturnFormat)})}function Hg(e,t,r,n,o){return Ee(this,void 0,void 0,function*(){let i=yield X.signTypedData(e.requestManager,t,r,n);return M({format:"bytes"},i,o??e.defaultReturnFormat)})}var yi=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})};function Fg(e,t){return yi(this,void 0,void 0,function*(){let r=yield X.newPendingTransactionFilter(e.requestManager);return M({format:"uint"},r,t??e.defaultReturnFormat)})}function Ug(e,t,r){return yi(this,void 0,void 0,function*(){let{toBlock:n,fromBlock:o}=t;S(n)||(typeof n=="number"||typeof n=="bigint")&&(n=Ie(n)),S(o)||(typeof o=="number"||typeof o=="bigint")&&(o=Ie(o));let i=Object.assign(Object.assign({},t),{fromBlock:o,toBlock:n}),s=yield X.newFilter(e.requestManager,i);return M({format:"uint"},s,r??e.defaultReturnFormat)})}function $g(e,t){return yi(this,void 0,void 0,function*(){let r=yield X.newBlockFilter(e.requestManager);return M({format:"uint"},r,t??e.defaultReturnFormat)})}function jg(e,t){return yi(this,void 0,void 0,function*(){return yield X.uninstallFilter(e.requestManager,Ie(t))})}function Gg(e,t,r){return yi(this,void 0,void 0,function*(){return(yield X.getFilterChanges(e.requestManager,Ie(t))).map(i=>typeof i=="string"?i:M(ar,i,r??e.defaultReturnFormat))})}function qg(e,t,r){return yi(this,void 0,void 0,function*(){return(yield X.getFilterLogs(e.requestManager,Ie(t))).map(i=>typeof i=="string"?i:M(ar,i,r??e.defaultReturnFormat))})}var qs=class extends br{_buildSubscriptionParams(){return["logs",this.args]}formatSubscriptionResult(t){return M(ar,t,super.returnFormat)}},Ws=class extends br{_buildSubscriptionParams(){return["newPendingTransactions"]}formatSubscriptionResult(t){return M({format:"string"},t,super.returnFormat)}},pn=class extends br{_buildSubscriptionParams(){return["newHeads"]}formatSubscriptionResult(t){return M(V0,t,super.returnFormat)}},Vs=class extends br{_buildSubscriptionParams(){return["syncing"]}
10_processSubscriptionResult(t){if(typeof t=="boolean")this.emit("changed",t);else{let r=Object.fromEntries(Object.entries(t?.status||t).map(([n,o])=>[n.charAt(0).toLowerCase()+n.substring(1),o]));this.emit("changed",t.syncing),this.emit("data",M(z0,r,super.returnFormat))}}};var se=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Du={logs:qs,newPendingTransactions:Ws,newHeads:pn,syncing:Vs,pendingTransactions:Ws,newBlockHeaders:pn},Xn=class e extends He{constructor(t){if(typeof t=="string"||Nn(t)){super({provider:t,registeredSubscriptions:Du});return}if(t.registeredSubscriptions){super(t);return}super(Object.assign(Object.assign({},t),{registeredSubscriptions:Du})),this.getFeeData=this.calculateFeeData}setTransactionMiddleware(t){this.transactionMiddleware=t}getTransactionMiddleware(){return this.transactionMiddleware}getProtocolVersion(){return se(this,void 0,void 0,function*(){return X.getProtocolVersion(this.requestManager)})}isSyncing(){return se(this,void 0,void 0,function*(){return X.getSyncing(this.requestManager)})}getCoinbase(){return se(this,void 0,void 0,function*(){return X.getCoinbase(this.requestManager)})}isMining(){return se(this,void 0,void 0,function*(){return X.getMining(this.requestManager)})}getHashrate(t){return se(this,void 0,void 0,function*(){var r;return t===void 0&&(t=(r=this.defaultReturnFormat)!==null&&r!==void 0?r:Be),this.getHashRate(t)})}getHashRate(){return se(this,arguments,void 0,function*(t=this.defaultReturnFormat){return wg(this,t)})}getGasPrice(){return se(this,arguments,void 0,function*(t=this.defaultReturnFormat){return Cs(this,t)})}getMaxPriorityFeePerGas(){return se(this,arguments,void 0,function*(t=this.defaultReturnFormat){return Eg(this,t)})}calculateFeeData(){return se(this,arguments,void 0,function*(t=BigInt(2),r=ls.Gwei){var n;let o=yield this.getBlock(void 0,!1),i=(n=o?.baseFeePerGas)!==null&&n!==void 0?n:void 0,s;try{s=yield this.getGasPrice()}catch{}let a;try{a=yield this.getMaxPriorityFeePerGas()}catch{}let u;if(i){a=a??r;let d;typeof t=="number"?d=BigInt(Math.floor(t*1e3))/BigInt(1e3):d=t,u=i*d+a}return{gasPrice:s,maxFeePerGas:u,maxPriorityFeePerGas:a,baseFeePerGas:i}})}getAccounts(){return se(this,void 0,void 0,function*(){var t;return((t=yield X.getAccounts(this.requestManager))!==null&&t!==void 0?t:[]).map(n=>Ve(n))})}getBlockNumber(){return se(this,arguments,void 0,function*(t=this.defaultReturnFormat){return Ls(this,t)})}getBalance(t){return se(this,arguments,void 0,function*(r,n=this.defaultBlock,o=this.defaultReturnFormat){return Tg(this,r,n,o)})}getStorageAt(t,r){return se(this,arguments,void 0,function*(n,o,i=this.defaultBlock,s=this.defaultReturnFormat){return Ag(this,n,o,i,s)})}getCode(t){return se(this,arguments,void 0,function*(r,n=this.defaultBlock,o=this.defaultReturnFormat){return Ig(this,r,n,o)})}getBlock(){return se(this,arguments,void 0,function*(t=this.defaultBlock,r=!1,n=this.defaultReturnFormat){return vu(this,t,r,n)})}getBlockTransactionCount(){return se(this,arguments,void 0,function*(t=this.defaultBlock,r=this.defaultReturnFormat){return Rg(this,t,r)})}getBlockUncleCount(){return se(this,arguments,void 0,function*(t=this.defaultBlock,r=this.defaultReturnFormat){return Sg(this,t,r)})}getUncle(){return se(this,arguments,void 0,function*(t=this.defaultBlock,r,n=this.defaultReturnFormat){return kg(this,t,r,n)})}getTransaction(t){return se(this,arguments,void 0,function*(r,n=this.defaultReturnFormat){let o=yield Pg(this,r,n);if(!o)throw new Si;return o})}getPendingTransactions(){return se(this,arguments,void 0,function*(t=this.defaultReturnFormat){return Bg(this,t)})}getTransactionFromBlock(){return se(this,arguments,void 0,function*(t=this.defaultBlock,r,n=this.defaultReturnFormat){return Ng(this,t,r,n)})}getTransactionReceipt(t){return se(this,arguments,void 0,function*(r,n=this.defaultReturnFormat){let o=yield Tu(this,r,n);if(!o)throw new Si;return o}
10)}getTransactionCount(t){return se(this,arguments,void 0,function*(r,n=this.defaultBlock,o=this.defaultReturnFormat){return bu(this,r,n,o)})}sendTransaction(t,r=this.defaultReturnFormat,n){return hn(this,t,r,n,this.transactionMiddleware)}sendSignedTransaction(t,r=this.defaultReturnFormat,n){return Og(this,t,r,n)}sign(t,r){return se(this,arguments,void 0,function*(n,o,i=this.defaultReturnFormat){return Cg(this,n,o,i)})}signTransaction(t){return se(this,arguments,void 0,function*(r,n=this.defaultReturnFormat){return Mg(this,r,n)})}call(t){return se(this,arguments,void 0,function*(r,n=this.defaultBlock,o=this.defaultReturnFormat){return mi(this,r,n,o)})}estimateGas(t){return se(this,arguments,void 0,function*(r,n=this.defaultBlock,o=this.defaultReturnFormat){return ni(this,r,n,o)})}getPastLogs(t){return se(this,arguments,void 0,function*(r,n=this.defaultReturnFormat){return Mu(this,r,n)})}getWork(){return se(this,void 0,void 0,function*(){return X.getWork(this.requestManager)})}submitWork(t,r,n){return se(this,void 0,void 0,function*(){return X.submitWork(this.requestManager,t,r,n)})}requestAccounts(){return se(this,void 0,void 0,function*(){return X.requestAccounts(this.requestManager)})}getChainId(){return se(this,arguments,void 0,function*(t=this.defaultReturnFormat){return _u(this,t)})}getNodeInfo(){return se(this,void 0,void 0,function*(){return X.getNodeInfo(this.requestManager)})}getProof(t,r){return se(this,arguments,void 0,function*(n,o,i=this.defaultBlock,s=this.defaultReturnFormat){return Lg(this,n,o,i,s)})}getFeeHistory(t){return se(this,arguments,void 0,function*(r,n=this.defaultBlock,o,i=this.defaultReturnFormat){return Dg(this,r,n,o,i)})}createAccessList(t){return se(this,arguments,void 0,function*(r,n=this.defaultBlock,o=this.defaultReturnFormat){return Lu(this,r,n,o)})}signTypedData(t,r,n,o){return se(this,void 0,void 0,function*(){var i;return n===void 0&&(n=!1),o===void 0&&(o=(i=this.defaultReturnFormat)!==null&&i!==void 0?i:Be),Hg(this,t,r,n,o)})}subscribe(t,r,n){return se(this,void 0,void 0,function*(){var o,i;n===void 0&&(n=(o=this.defaultReturnFormat)!==null&&o!==void 0?o:Be);let s=yield(i=this.subscriptionManager)===null||i===void 0?void 0:i.subscribe(t,r,n);return s instanceof qs&&t==="logs"&&typeof r=="object"&&!V(r.fromBlock)&&Number.isFinite(Number(r.fromBlock))&&setImmediate(()=>{this.getPastLogs(r).then(a=>{for(let u of a)s._processSubscriptionResult(u)}).catch(a=>{s._processSubscriptionError(a)})}),s})}static shouldClearSubscription({sub:t}){return!(t instanceof Vs)}clearSubscriptions(t=!1){var r;return(r=this.subscriptionManager)===null||r===void 0?void 0:r.unsubscribe(t?e.shouldClearSubscription:void 0)}createNewPendingTransactionFilter(){return se(this,arguments,void 0,function*(t=this.defaultReturnFormat){return Fg(this,t)})}createNewFilter(t){return se(this,arguments,void 0,function*(r,n=this.defaultReturnFormat){return Ug(this,r,n)})}createNewBlockFilter(){return se(this,arguments,void 0,function*(t=this.defaultReturnFormat){return $g(this,t)})}uninstallFilter(t){return se(this,void 0,void 0,function*(){return jg(this,t)})}getFilterChanges(t){return se(this,arguments,void 0,function*(r,n=this.defaultReturnFormat){return Gg(this,r,n)})}getFilterLogs(t){return se(this,arguments,void 0,function*(r,n=this.defaultReturnFormat){return qg(this,r,n)})}};var m1=e=>{if(!S(e.common)){if(S(e.common.customChain))throw new Ia;if(S(e.common.customChain.chainId))throw new Ra;if(!S(e.chainId)&&e.chainId!==e.common.customChain.chainId)throw new Sa({txChainId:e.chainId,customChainId:e.common.customChain.chainId})}},g1=e=>{if(!S(e.common)&&!S(e.chain)&&!S(e.hardfork))throw new Ba;if(!S(e.chain)&&S(e.hardfork)||!S(e.hardfork)&&S(e.chain))throw new Na({chain:e.chain,hardfork:e.hardfork})},y1=e=>{if(!S(e.common)&&!S(e.common.baseChain)&&!S(e.chain)&&e.chain!==e.common.baseChain)throw new ka({txChain:e.chain,baseChain:e.common.baseChain})},x1=e=>{if(!S(e.common)&&!S(e.common.hardfork)&&!S(e.hardfork)&&e.hardfork!==e.common.hardfork)throw new Pa({txHardfork:e.hardfork,commonHardfork:e.common.hardfork})},Wg=e=>{if(S(e.gas)||!xt(e.gas)||S(e.gasPrice)||!xt(e.gasPrice))throw new Ma({gas:e.gas,gasPrice:e.gasPrice});if(!S(e.maxFeePerGas)||!S(e.maxPriorityFeePerGas))throw new Pi({maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas})},Vg=e=>{if(!S(e.gasPrice)&&e.type==="0x2")throw new Da(e.gasPrice);if(e.type==="0x0"||e.type==="0x1")throw new Pi({maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas});if(S(e.maxFeePerGas)||!xt(e.maxFeePerGas)||S(e.maxPriorityFeePerGas)||!xt(e.maxPriorityFeePerGas))throw new La({maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas})},v1=e=>
10{let t=!S(e.gas)||!S(e.gasLimit),r=t&&!S(e.gasPrice),n=t&&!S(e.maxPriorityFeePerGas)&&!S(e.maxFeePerGas);if(!r&&!n)throw new Oa({gas:e.gas,gasPrice:e.gasPrice,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas});if(r&&n)throw new Ca({gas:e.gas,gasPrice:e.gasPrice,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas});(r?Wg:Vg)(e),(!S(e.type)&&e.type>"0x1"?Vg:Wg)(e)},zg=(e,t,r={transactionSchema:void 0})=>{if(!S(t)){t(e);return}if(typeof e!="object"||S(e))throw new Ha(e);m1(e),g1(e),y1(e),x1(e);let n=Ge(e,J,{transactionSchema:r.transactionSchema});if(v1(n),S(n.nonce)||S(n.chainId)||n.nonce.startsWith("-")||n.chainId.startsWith("-"))throw new Fa({nonce:e.nonce,chainId:e.chainId})};var b1=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},_1=e=>{var t,r;return Object.assign(Object.assign({},e),{nonce:e.nonce,gasPrice:e.gasPrice,gasLimit:(t=e.gasLimit)!==null&&t!==void 0?t:e.gas,to:e.to,value:e.value,data:(r=e.data)!==null&&r!==void 0?r:e.input,type:e.type,chainId:e.chainId,accessList:e.accessList,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas})},w1=(e,t)=>{var r,n,o,i,s,a,u,d,c,f,_,w,k,T,R,P,b,C;let F=!S(e.chain)&&!S(e.hardfork)||!S(e.common),L;if(!F)t.defaultCommon?(L=Object.assign({},t.defaultCommon),S(L.hardfork)&&(L.hardfork=(r=e.hardfork)!==null&&r!==void 0?r:t.defaultHardfork),S(L.baseChain)&&(L.baseChain=t.defaultChain)):L=zt.custom({name:"custom-network",chainId:We(e.chainId),networkId:S(e.networkId)?void 0:We(e.networkId),defaultHardfork:(n=e.hardfork)!==null&&n!==void 0?n:t.defaultHardfork},{baseChain:t.defaultChain});else{let U=(a=(s=(i=(o=e?.common)===null||o===void 0?void 0:o.customChain)===null||i===void 0?void 0:i.name)!==null&&s!==void 0?s:e.chain)!==null&&a!==void 0?a:"custom-network",N=We((c=(d=(u=e?.common)===null||u===void 0?void 0:u.customChain)===null||d===void 0?void 0:d.chainId)!==null&&c!==void 0?c:e?.chainId),l=We((w=(_=(f=e?.common)===null||f===void 0?void 0:f.customChain)===null||_===void 0?void 0:_.networkId)!==null&&w!==void 0?w:e?.networkId),p=(R=(T=(k=e?.common)===null||k===void 0?void 0:k.hardfork)!==null&&T!==void 0?T:e?.hardfork)!==null&&R!==void 0?R:t.defaultHardfork,y=(C=(b=(P=e.common)===null||P===void 0?void 0:P.baseChain)!==null&&b!==void 0?b:e.chain)!==null&&C!==void 0?C:t.defaultChain;N&&l&&U&&(L=zt.custom({name:U,chainId:N,networkId:l,defaultHardfork:p},{baseChain:y}))}return{common:L}},Kg=(e,t,r,...n)=>b1(void 0,[e,t,r,...n],void 0,function*(o,i,s,a=!1,u=!0){let d=yield sl({transaction:o,web3Context:i,privateKey:s,fillGasPrice:a,fillGasLimit:u}),c=Ge(d,J,{transactionSchema:i.config.customTransactionSchema});return zg(c,void 0,{transactionSchema:i.config.customTransactionSchema}),Nt.fromTxData(_1(c),w1(c,i))});var Sl=({address:e},t,r)=>{var n,o;let i=r?.topics,s=(n=r?.filter)!==null&&n!==void 0?n:{},a={};if(V(r?.fromBlock)||(a.fromBlock=M(ti.properties.number,r?.fromBlock,{number:it.HEX,bytes:Ut.HEX})),V(r?.toBlock)||(a.toBlock=M(ti.properties.number,r?.toBlock,{number:it.HEX,bytes:Ut.HEX})),i&&Array.isArray(i))a.topics=[...i];else if(a.topics=[],t&&!t.anonymous&&![Rr,"allEvents"].includes(t.name)&&a.topics.push((o=t.signature)!==null&&o!==void 0?o:ai(ut(t))),![Rr,"allEvents"].includes(t.name)&&t.inputs)for(let u of t.inputs){if(!u.indexed)continue;let d=s[u.name];if(!d){a.topics.push(null);continue}Array.isArray(d)?a.topics.push(d.map(c=>Gs(u.type,c))):u.type==="string"?a.topics.push(rr(d)):a.topics.push(Gs(u.type,d))}return a.topics.length||delete a.topics,e&&(a.address=e.toLowerCase()),a},mn=(e,t,r)=>{let n=Array.isArray(e.inputs)?e.inputs.length:0;if(e.inputs&&n!==t.length)throw new Me(`The number of arguments is not matching the methods required number. You need to pass ${n} arguments.`);let o;if(e.inputs?o=ur(Array.isArray(e.inputs)?e.inputs:[],t).replace("0x",""):o=Tl(t).replace("0x",""),ig(e)){if(!r)throw new Me("The contract has no contract data option set. This is necessary to append the constructor parameters.");return r.startsWith("0x")?`${r}${o}`:`0x${r}${o}`}return`${ln(e)}${o}`};var zs=class extends br{constructor(t,r){super(t,r),this.address=t.address,this.topics=t.topics,this.abi=t.abi,this.jsonInterface=t.jsonInterface}_buildSubscriptionParams(){return["logs",{address:this.address,topics:this.topics}]}formatSubscriptionResult(t){return Kn(this.abi,t,this.jsonInterface,super.returnFormat)}};var AH=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));var Hu=(e,t,r,n)=>{var o,i;let s={};return(!V(e.data)||n==="both")&&(s.data=mn(t,r,(o=e.data)!==null&&o!==void 0?o:e.input)),(!V(e.input)||n==="both")&&(s.input=mn(t,r,(i=e.input)!==null&&i!==void 0?i:e.data)),V(s.input)&&V(s.data)&&(s[n]=mn(t,r)),{data:s.data,input:s.input}},Ks=({abi:e,params:t,options:r,contractOptions:n})=>{var o,i,s;if(!((s=(i=(o=r?.input)!==null&&o!==void 0?o:r?.data)!==null&&i!==void 0?i:n.input)!==null&&s!==void 0?s:n.data)&&!r?.to&&!n.address)throw new Me("Contract address not specified");if(!r?.from&&!n.from)throw new Me('Contract "from" address not specified');let u=kt({to:n.address,gas:n.gas,gasPrice:n.gasPrice,from:n.from,input:n.input,maxPriorityFeePerGas:n.maxPriorityFeePerGas,maxFeePerGas:n.maxFeePerGas,data:n.data},r),d=Hu(u,e,t,r?.dataInputFill);return u=Object.assign(Object.assign({},u),{data:d.data,input:d.input}),u},Zg=({abi:e,params:t,options:r,contractOptions:n})=>{if(!r?.to&&!n.address)throw new Me("Contract address not specified");let o=kt({to:n.address,gas:n.gas,gasPrice:n.gasPrice,from:n.from,input:n.input,maxPriorityFeePerGas:n.maxPriorityFeePerGas,maxFeePerGas:n.maxFeePerGas,data:n.data},r),i=Hu(o,e,t,r?.dataInputFill);return o=Object.assign(Object.assign({},o),{data:i.data,input:i.input}),o},Xg=({abi:e,params:t,options:r,contractOptions:n})=>{let o=kt({to:n.address,gas:n.gas,gasPrice:n.gasPrice,from:n.from,input:n.input,data:n.data},r),i=Hu(o,e,t,r?.dataInputFill);return o=Object.assign(Object.assign({},o),{data:i.data,input:i.input}),o},kl=e=>typeof e=="object"&&!V(e)&&Object.keys(e).length!==0&&!Gt(e),Jg=({abi:e,params:t,options:r,contractOptions:n})=>{if(!r?.to&&!n.address)throw new Me("Contract address not specified");if(!r?.from&&!n.from)throw new Me('Contract "from" address not specified');let o=kt({to:n.address,gas:n.gas,gasPrice:n.gasPrice,from:n.from,input:n.input,maxPriorityFeePerGas:n.maxPriorityFeePerGas,maxFeePerGas:n.maxFeePerGas,data:n.data},r),i=Hu(o,e,t,r?.dataInputFill);return o=Object.assign(Object.assign({},o),{data:i.data,input:i.input}),o};var E1=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Fu=class{_contractMethodDeploySend(t){let r={transactionResolver:n=>
10{if(n.status===BigInt(0))throw new Me("code couldn't be stored",n);let o=this.parent.clone();return o.options.address=n.contractAddress,o},contractAbi:this.parent.options.jsonInterface,checkRevertBeforeSending:!1};return S(this.parent.getTransactionMiddleware())?hn(this.parent,t,this.parent.defaultReturnFormat,r):hn(this.parent,t,this.parent.defaultReturnFormat,r,this.parent.getTransactionMiddleware())}constructor(t,r){this.parent=t,this.deployOptions=r;let{args:n,abi:o,contractOptions:i,deployData:s}=this.calculateDeployParams();this.args=n,this.constructorAbi=o,this.contractOptions=i,this.deployData=s}send(t){let r=Object.assign({},t),n=this.populateTransaction(r);return this._contractMethodDeploySend(n)}populateTransaction(t){var r,n;let o=Object.assign(Object.assign({},this.contractOptions),{from:(n=(r=this.contractOptions.from)!==null&&r!==void 0?r:this.parent.defaultAccount)!==null&&n!==void 0?n:void 0}),i=Ks({abi:this.constructorAbi,params:this.args,options:Object.assign(Object.assign({},t),{dataInputFill:this.parent.contractDataInputFill}),contractOptions:o});return i.dataInputFill&&delete i.dataInputFill,i}calculateDeployParams(){var t,r,n,o,i,s;let a=this.parent.options.jsonInterface.find(w=>w.type==="constructor");a||(a={type:"constructor",stateMutability:""});let u=M({format:"bytes"},(r=(t=this.deployOptions)===null||t===void 0?void 0:t.input)!==null&&r!==void 0?r:this.parent.options.input,Be),d=M({format:"bytes"},(o=(n=this.deployOptions)===null||n===void 0?void 0:n.data)!==null&&o!==void 0?o:this.parent.options.data,Be);if((!u||u.trim()==="0x")&&(!d||d.trim()==="0x"))throw new Me("contract creation without any data provided.");let c=(s=(i=this.deployOptions)===null||i===void 0?void 0:i.arguments)!==null&&s!==void 0?s:[],f=Object.assign(Object.assign({},this.parent.options),{input:u,data:d});return{args:c,abi:a,contractOptions:f,deployData:u??d}}estimateGas(t){return E1(this,arguments,void 0,function*(r,n=this.parent.defaultReturnFormat){let o=Object.assign({},r);return this.parent.contractMethodEstimateGas({abi:this.constructorAbi,params:this.args,returnFormat:n,options:o,contractOptions:this.contractOptions})})}encodeABI(){return mn(this.constructorAbi,this.args,M({format:"bytes"},this.deployData,this.parent.defaultReturnFormat))}decodeData(t){return Object.assign(Object.assign({},hi(this.constructorAbi,t.replace(this.deployData,""),!1)),{__method__:this.constructorAbi.type})}};var T1=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Uu=class extends vr{constructor(t,r){super(t.requestManager,t.registeredSubscriptions),this.parentContract=r}subscribe(t,r){let n=Object.create(null,{subscribe:{get:()=>super.subscribe}});return T1(this,arguments,void 0,function*(o,i,s=Be){return n.subscribe.call(this,o,i??this.parentContract.options,s)})}};var Jn=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},A1={logs:zs,newHeads:pn,newBlockHeaders:pn},gn=class e extends He{get subscriptionManager(){return this._subscriptionManager}constructor(t,r,n,o,i){var s,a,u;let d=Gt(r)?r:Gt(n)?n:void 0,c;kl(r)?c=r:kl(n)?c=n:c=o;let f;if(typeof r=="object"&&"provider"in r?f=r.provider:typeof n=="object"&&"provider"in n?f=n.provider:typeof o=="object"&&"provider"in o?f=o.provider:f=e.givenProvider,super(Object.assign(Object.assign({},c),{provider:f,registeredSubscriptions:A1})),this.syncWithContext=!1,this._functions={},this._subscriptionManager=new Uu(super.subscriptionManager,this),c?.wallet&&(this._wallet=c.wallet),c?.accountProvider&&(this._accountProvider=c.accountProvider),!S(d)&&!S(d.data)&&!S(d.input)&&this.config.contractDataInputFill!=="both")throw new ya({data:d.data,input:d.input});this._overloadedMethodAbis=new Map;let _=qt(o)?o:qt(n)?n:i??this.defaultReturnFormat,w=typeof r=="string"?r:void 0;this.config.contractDataInputFill=(s=d?.dataInputFill)!==null&&s!==void 0?s:this.config.contractDataInputFill,this._parseAndSetJsonInterface(t,_),this.defaultReturnFormat!==_&&(this.defaultReturnFormat=_),S(w)||this._parseAndSetAddress(w,_),this.options={address:w,jsonInterface:this._jsonInterface,gas:(a=d?.gas)!==null&&a!==void 0?a:d?.gasLim
10it,gasPrice:d?.gasPrice,from:d?.from,input:d?.input,data:d?.data},this.syncWithContext=(u=d?.syncWithContext)!==null&&u!==void 0?u:!1,c instanceof He&&this.subscribeToContextEvents(c),Object.defineProperty(this.options,"address",{set:k=>this._parseAndSetAddress(k,_),get:()=>this._address}),Object.defineProperty(this.options,"jsonInterface",{set:k=>this._parseAndSetJsonInterface(k,_),get:()=>this._jsonInterface}),c instanceof He&&c.on(Qr.CONFIG_CHANGE,k=>{this.setConfig({[k.name]:k.newValue})})}setTransactionMiddleware(t){this.transactionMiddleware=t}getTransactionMiddleware(){return this.transactionMiddleware}get events(){return this._events}get methods(){return this._methods}clone(){let t;return this.options.address?t=new e([...this._jsonInterface,...this._errorsInterface],this.options.address,{gas:this.options.gas,gasPrice:this.options.gasPrice,from:this.options.from,input:this.options.input,data:this.options.data,provider:this.currentProvider,syncWithContext:this.syncWithContext,dataInputFill:this.config.contractDataInputFill},this.getContextObject()):t=new e([...this._jsonInterface,...this._errorsInterface],{gas:this.options.gas,gasPrice:this.options.gasPrice,from:this.options.from,input:this.options.input,data:this.options.data,provider:this.currentProvider,syncWithContext:this.syncWithContext,dataInputFill:this.config.contractDataInputFill},this.getContextObject()),this.context&&t.subscribeToContextEvents(this.context),t}deploy(t){return new Fu(this,t)}getPastEvents(t,r,n){return Jn(this,void 0,void 0,function*(){var o;let i=typeof t=="string"?t:Rr,s=typeof t!="string"&&!qt(t)?t:qt(r)?{}:r,a=qt(t)?t:qt(r)?r:n??this.defaultReturnFormat,u=i==="allEvents"||i===Rr?Os:this._jsonInterface.find(P=>"name"in P&&P.name===i);if(!u)throw new Me(`Event ${String(i)} not found.`);let{fromBlock:d,toBlock:c,topics:f,address:_}=Sl(this.options,u,s??{}),w=yield Mu(this,{fromBlock:d,toBlock:c,topics:f,address:_},a),k=w?w.map(P=>typeof P=="string"?P:Kn(u,P,this._jsonInterface,a)):[],T=(o=s?.filter)!==null&&o!==void 0?o:{},R=Object.keys(T);return R.length>0?k.filter(P=>typeof P=="string"?!0:R.every(b=>{var C;if(Array.isArray(T[b]))return T[b].some(L=>String(P.returnValues[b]).toUpperCase()===String(L).toUpperCase());let F=(C=u.inputs)===null||C===void 0?void 0:C.filter(L=>L.name===b)[0];return F?.indexed&&F.type==="string"&&rr(T[b])===String(P.returnValues[b])?!0:String(P.returnValues[b]).toUpperCase()===String(T[b]).toUpperCase()})):k})}_parseAndSetAddress(t,r=this.defaultReturnFormat){this._address=t&&Ve(M({format:"address"},t,r))}decodeMethodData(t){let r=t.slice(0,10),o=this._jsonInterface.filter(i=>i.type!=="error").find(i=>r===ln(ut(i)));if(!o)throw new Me(`The ABI for the provided method signature ${r} was not found.`);return hi(o,t)}_parseAndSetJsonInterface(t,r=this.defaultReturnFormat){var n,o;this._functions={},this._methods={},this._events={};let i=[],s=t.filter(u=>u.type!=="error"),a=t.filter(u=>zn(u));for(let u of s){let d=Object.assign(Object.assign({},u),{signature:""});if(si(d)){let c=ut(d),f=ln(c);d.methodNameWithInputs=c,d.signature=f,d.constant=d.stateMutability==="view"||d.stateMutability==="pure"||d.constant,d.payable=d.stateMutability==="payable"||d.payable,this._overloadedMethodAbis.set(d.name,[...(n=this._overloadedMethodAbis.get(d.name))!==null&&n!==void 0?n:[],d]);let _=(o=this._overloadedMethodAbis.get(d.name))!==null&&o!==void 0?o:[],w=this._createContractMethod(_,a),k=this._createContractMethod(_,a,!0);this._functions[c]={signature:f,method:k},this._methods[d.name]=w,this._methods[c]=k,this._methods[f]=k}else if(Ds(d)){let c=ut(d),f=ai(c),_=this._createContractEvent(d,r);d.signature=f,(!(c in this._events)||d.name==="bound")&&(this._events[c]=_),this._events[d.name]=_,this._events[f]=_}i=[...i,d]}this._events.allEvents=this._createContractEvent(Os,r),this._jsonInterface=[...i],this._errorsInterface=a}_getAbiParams(t,r){var n;try{return be.transformJsonDataToAbiFormat((n=t.inputs)!==null&&n!==void 0?n:[],r)}catch(o){throw new Me(`Invalid parameters for method ${t.name}: ${o.message}`)}}_createContractMethod(t,r,n=!1){let o=t[t.length-1];return(...i)=>{var s,a,u;let d,c=(a=n?(s=this._overloadedMethodAbis.get(o.name))===null||s===void 0?void 0:s.filter(T=>T.signature===o.signature):this._overloadedMethodAbis.get(o.name))!==null&&a!==void 0?a:[],f=c[0],_=r,w=c.filter(T=>{var R;return((R=T.inputs)!==null&&R!==void 0?R:[]).length===i.length});if(c.length===1||w.length===0)d=this._getAbiParams(f,i),W.validate((u=o.inputs)!==null&&u!==void 0?u:[],d);else{let T=[],R=[];for(let P of w)try{d=this._getAbiParams(P,i),W.validate(P.inputs,d),R.push(P)}catch(b){T.push(b)}if(R.length===1?[f]=R:R.length>1&&([f]=R,console.warn(`Multiple methods found that is compatible with the given inputs. 11 Found ${R.length} compatible methods: ${JSON.stringify(R.map(P=>`${P.methodNameWithInputs} (signature: ${P.signature})`))} 12 The first one will be used: ${f.methodNameWithInputs}`)),T.length===w.length)throw new yt(T)}let k={arguments:d,call:(T,R)=>Jn(this,void 0,void 0,function*(){return this._contractMethodCall(f,d,_,T,R)}),send:T=>this._contractMethodSend(f,d,_,T),populateTransaction:(T,R)=>{var P,b;let C=R??this.options;C=Object.assign(Object.assign({},C),{input:void 0,from:(b=(P=C?.from)!==null&&P!==void 0?P:this.defaultAccount)!==null&&b!==void 0?b:void 0});let F=Ks({abi:o,params:i,options:Object.assign(Object.assign({},T),{dataInputFill:this.config.contractDataInputFill}),contractOptions:C});return F.dataInputFill&&delete F.dataInputFill,F},estimateGas:(T,...R)=>Jn(this,[T,...R],void 0,function*(P,b=this.defaultReturnFormat){return this.contractMethodEstimateGas({abi:f,params:d,returnFormat:b,options:P})}),encodeABI:()=>mn(f,d),decodeData:T=>hi(f,T),createAccessList:(T,R)=>Jn(this,void 0,void 0,function*(){return this._contractMethodCreateAccessList(f,d,_,T,R)})};return f.stateMutability==="payable",k}}_contractMethodCall(t,r,n,o,i){return Jn(this,void 0,void 0,function*(){var s;let a=Zg({abi:t,params:r,options:Object.assign(Object.assign({},o),{dataInputFill:this.config.contractDataInputFill}),contractOptions:Object.assign(Object.assign({},this.options),{from:(s=this.options.from)!==null&&s!==void 0?s:this.config.defaultAccount})});try{let u=yield mi(this,a,i,this.defaultReturnFormat);return Il(t,u)}catch(u){throw u instanceof pt&&pi(n,u.cause),u}}
12)}_contractMethodCreateAccessList(t,r,n,o,i){return Jn(this,void 0,void 0,function*(){var s;let a=Jg({abi:t,params:r,options:Object.assign(Object.assign({},o),{dataInputFill:this.config.contractDataInputFill}),contractOptions:Object.assign(Object.assign({},this.options),{from:(s=this.options.from)!==null&&s!==void 0?s:this.config.defaultAccount})});try{return Lu(this,a,i,this.defaultReturnFormat)}catch(u){throw u instanceof pt&&pi(n,u.cause),u}})}_contractMethodSend(t,r,n,o,i){var s,a;let u=i??this.options;u=Object.assign(Object.assign({},u),{input:void 0,from:(a=(s=u.from)!==null&&s!==void 0?s:this.defaultAccount)!==null&&a!==void 0?a:void 0});let d=Ks({abi:t,params:r,options:Object.assign(Object.assign({},o),{dataInputFill:this.config.contractDataInputFill}),contractOptions:u}),c=S(this.transactionMiddleware)?hn(this,d,this.defaultReturnFormat,{checkRevertBeforeSending:!1,contractAbi:this._jsonInterface}):hn(this,d,this.defaultReturnFormat,{checkRevertBeforeSending:!1,contractAbi:this._jsonInterface},this.transactionMiddleware);return c.on("error",f=>{f instanceof pt&&pi(n,f.cause)}),c}contractMethodEstimateGas(t){return Jn(this,arguments,void 0,function*({abi:r,params:n,returnFormat:o,options:i,contractOptions:s}){let a=Xg({abi:r,params:n,options:Object.assign(Object.assign({},i),{dataInputFill:this.config.contractDataInputFill}),contractOptions:s??this.options});return ni(this,a,It.LATEST,o??this.defaultReturnFormat)})}_createContractEvent(t,r=this.defaultReturnFormat){return(...n)=>{var o;let{topics:i,fromBlock:s}=Sl(this.options,t,n[0]),a=new zs({address:this.options.address,topics:i,abi:t,jsonInterface:this._jsonInterface},{subscriptionManager:this.subscriptionManager,returnFormat:r});return S(s)||this.getPastEvents(t.name,{fromBlock:s,topics:i},r).then(u=>{u&&u.forEach(d=>a.emit("data",d))}).catch(u=>
12{a.emit("error",new mt("Failed to get past events.",u))}),(o=this.subscriptionManager)===null||o===void 0||o.addSubscription(a).catch(u=>{a.emit("error",new mt("Failed to subscribe.",u))}),a}}subscribeToContextEvents(t){let r=this;this.context=t,r.syncWithContext&&t.on(Qr.CONFIG_CHANGE,n=>{r.setConfig({[n.name]:n.newValue})})}};var Yg=gn;var Pl={addr:"0x3b3b57de",name:"0x691f3431",abi:"0x2203ab56",pubkey:"0xc8690233",text:"0x59d1d43c",contenthash:"0xbc1c58d1"},Yn={setAddr:"addr",addr:"addr",setPubkey:"pubkey",pubkey:"pubkey",setContenthash:"contenthash",contenthash:"contenthash",text:"text",name:"name"},yn={main:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",goerli:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},Qg={"0x1":"main","0x5":"goerli"};var ey=[{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"label",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"NewOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"resolver",type:"address"}],name:"NewResolver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"recordExists",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"resolver",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"ttl",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"}];var ty=[{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"coinType",type:"uint256"},{indexed:!1,internalType:"bytes",name:"newAddress",type:"bytes"}],name:"AddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"},{indexed:!1,internalType:"bytes",name:"record",type:"bytes"}],name:"DNSRecordChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"}],name:"DNSRecordDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"}],name:"DNSZoneCleared",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"lastzonehash",type:"bytes"},{indexed:!1,internalType:"bytes",name:"zonehash",type:"bytes"}],name:"DNSZonehashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes4",name:"interfaceID",type:"bytes4"},{indexed:!1,internalType:"address",name:"implementer",type:"address"}],name:"InterfaceChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"x",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"string",name:"indexedKey",type:"string"},{indexed:!1,internalType:"string",name:"key",type:"string"}],name:"TextChanged",type:"event"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address payable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"}],name:"addr",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"},{internalType:"uint16",name:"resource",type:"uint16"}],name:"dnsRecord",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"}],name:"hasDNSRecords",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"interfaceImplementer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"pubkey",outputs:[{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"zonehash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"a",type:"address"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"}];var R1=e=>ql(e),Mt=e=>{let t="";for(let r=0;r<32;r+=1)t+="00";if(e){let n=R1(e).split(".");for(let o=n.length-1;o>=0;o-=1){let i=$e(n[o]).slice(2);t=$e(`0x${t}${i}`).slice(2)}}return`0x${t}`};var $u=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},ju=class{constructor(t,r){this.contract=new gn(ey,r??yn.main,t),this.context=t}getOwner(t){return $u(this,void 0,void 0,function*(){try{return this.contract.methods.owner(Mt(t)).call()}catch{throw new Error}})}getTTL(t){return $u(this,void 0,void 0,function*(){try{return this.contract.methods.ttl(Mt(t)).call()}catch{throw new Error}})}recordExists(t){return $u(this,void 0,void 0,function*(){try{return this.contract.methods.recordExists(Mt(t)).call()}catch{throw new Error}})}getResolver(t){return $u(this,void 0,void 0,function*(){try{return this.contract.methods.resolver(Mt(t)).call().then(r=>{if(typeof r=="string")return new gn(ty,r,this.context);throw new Error})}catch{throw new Error}})}get events(){return this.contract.events}};var kr=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Gu=class{constructor(t){this.registry=t}getResolverContractAdapter(t){return kr(this,void 0,void 0,function*(){return this.registry.getResolver(t)})}checkInterfaceSupport(t,r){var n,o;return kr(this,void 0,void 0,function*(){if(V(Pl[r]))throw new Ai((n=t.options.address)!==null&&n!==void 0?n:"",r);if(!(yield t.methods.supportsInterface(Pl[r]).call()))throw new Ai((o=t.options.address)!==null&&o!==void 0?o:"",r)})}supportsInterface(t,r){var n;return kr(this,void 0,void 0,function*(){let o=yield this.getResolverContractAdapter(t),i=r;if(!oe(i)){if(i=(n=ko(r))!==null&&n!==void 0?n:"",r==="")throw new Error("Invalid interface Id");i=i.slice(0,10)}return o.methods.supportsInterface(i).call()})}getAddress(t,r=60){return kr(this,void 0,void 0,function*(){let n=yield this.getResolverContractAdapter(t);return yield this.checkInterfaceSupport(n,Yn.addr),n.methods.addr(Mt(t),r).call()})}getPubkey(t){return kr(this,void 0,void 0,function*(){let r=yield this.getResolverContractAdapter(t);return yield this.checkInterfaceSupport(r,Yn.pubkey),r.methods.pubkey(Mt(t)).call()})}getContenthash(t){return kr(this,void 0,void 0,function*(){let r=yield this.getResolverContractAdapter(t);return yield this.checkInterfaceSupport(r,Yn.contenthash),r.methods.contenthash(Mt(t)).call()})}setAddress(t,r,n){return kr(this,void 0,void 0,function*(){let o=yield this.getResolverContractAdapter(t);return yield this.checkInterfaceSupport(o,Yn.setAddr),o.methods.setAddr(Mt(t),r).send(n)})}getText(t,r){return kr(this,void 0,void 0,function*(){let n=yield this.getResolverContractAdapter(t);return yield this.checkInterfaceSupport(n,Yn.text),n.methods.text(Mt(t),r).call()})}getName(t,r=!0){return kr(this,void 0,void 0,function*(){let n=`${t.toLowerCase().substring(2)}.addr.reverse`,o=yield this.getResolverContractAdapter(n);return r&&(yield this.checkInterfaceSupport(o,Yn.name)),o.methods.name(Mt(n)).call()})}};var Lt=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Zs=class extends He{constructor(t,r){super(r??""),this.registryAddress=t??yn.main,this._registry=new ju(this.getContextObject(),t),this._resolver=new Gu(this._registry)}getResolver(t){return Lt(this,void 0,void 0,function*(){return this._registry.getResolver(t)})}recordExists(t){return Lt(this,void 0,void 0,function*(){return this._registry.recordExists(t)})}getTTL(t){return Lt(this,void 0,void 0,function*(){return this._registry.getTTL(t)})}getOwner(t){return Lt(this,void 0,void 0,function*(){return this._registry.getOwner(t)})}getAddress(t,r=60){return Lt(this,void 0,void 0,function*(){return this._resolver.getAddress(t,r)})}getText(t,r){return Lt(this,void 0,void 0,function*(){return Ne(t)?this._resolver.getText(yield this._resolver.getName(t,!1),r):this._resolver.getText(t,r)})}getName(t,r=!0){return Lt(this,void 0,void 0,function*(){return this._resolver.getName(t,r)})}getPubkey(t){return Lt(this,void 0,void 0,function*(){return this._resolver.getPubkey(t)})}getContenthash(t){return Lt(this,void 0,void 0,function*(){return this._resolver.getContenthash(t)})}checkNetwork(){return Lt(this,void 0,void 0,function*(){let t=Date.now()/1e3;if(!this._lastSyncCheck||t-this._lastSyncCheck>3600){let o=yield _g(this);if(!(typeof o=="boolean"&&!o))throw new va;this._lastSyncCheck=t}if(this._detectedAddress)return this._detectedAddress;let r=yield ri(this,Object.assign(Object.assign({},this.defaultReturnFormat),{number:it.HEX})),n=yn[Qg[r]];if(typeof n>"u")throw new xa(r);return this._detectedAddress=n,this._detectedAddress})}supportsInterface(t,r){return Lt(this,void 0,void 0,function*(){return this._resolver.supportsInterface(t,r)})}get events(){return this._registry.events}setAddress(t,r,n){return Lt(this,void 0,void 0,function*(){return this._resolver.setAddress(t,r,n)})}};var Pr=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},ry=e=>Pr(void 0,void 0,void 0,function*(){return(yield Ot.getAccounts(e)).map(Ve)}),ny=(e,t)=>Pr(void 0,void 0,void 0,function*(){W.validate(["string"],[t]);let r=yield Ot.newAccount(e,t);return Ve(r)}),oy=(e,t,r,n)=>Pr(void 0,void 0,void 0,function*(){return W.validate(["address","string","uint"],[t,r,n]),Ot.unlockAccount(e,t,r,n)}),iy=(e,t)=>Pr(void 0,void 0,void 0,function*(){return W.validate(["address"],[t]),Ot.lockAccount(e,t)}),sy=(e,t,r)=>Pr(void 0,void 0,void 0,function*(){return W.validate(["string","string"],[t,r]),Ot.importRawKey(e,t,r)}),ay=(e,t,r,n)=>Pr(void 0,void 0,void 0,function*(){let o=Ge(t,J,{transactionSchema:n?.customTransactionSchema});return Ot.sendTransaction(e,o,r)}),cy=(e,t,r,n)=>Pr(void 0,void 0,void 0,function*(){let o=Ge(t,J,{transactionSchema:n?.customTransactionSchema});return Ot.signTransaction(e,o,r)}),uy=(e,t,r,n)=>Pr(void 0,void 0,void 0,function*(){W.validate(["string","address","string"],[t,r,n]);let o=oe(t)?t:at(t);return Ot.sign(e,o,r,n)}),dy=(e,t,r)=>Pr(void 0,void 0,void 0,function*(){W.validate(["string","string"],[t,r]);let n=oe(t)?t:at(t);return Ot.ecRecover(e,n,r)});var Br=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Qn=class extends He{getAccounts(){return Br(this,void 0,void 0,function*(){return ry(this.requestManager)})}newAccount(t){return Br(this,void 0,void 0,function*(){return ny(this.requestManager,t)})}unlockAccount(t,r,n){return Br(this,void 0,void 0,function*(){return oy(this.requestManager,t,r,n)})}lockAccount(t){return Br(this,void 0,void 0,function*(){return iy(this.requestManager,t)})}importRawKey(t,r){return Br(this,void 0,void 0,function*(){return sy(this.requestManager,t,r)})}sendTransaction(t,r){return Br(this,void 0,void 0,function*(){return ay(this.requestManager,t,r,this.config)})}signTransaction(t,r){return Br(this,void 0,void 0,function*(){return cy(this.requestManager,t,r,this.config)})}sign(t,r,n){return Br(this,void 0,void 0,function*(){return uy(this.requestManager,t,r,n)})}ecRecover(t,r){return Br(this,void 0,void 0,function*(){return dy(this.requestManager,t,r)})}};var Dt=(function(e){return e.HTTPS="https",e.WebSocket="wss",e})(Dt||{}),q=(function(e){return e.ETH_MAINNET="eth_mainnet",e.ETH_SEPOLIA="eth_sepol
12ia",e.ETH_HOLESKY="eth_holesky",e.POLYGON_MAINNET="polygon_mainnet",e.POLYGON_AMOY="polygon_amoy",e.AVALANCHE_C_MAINNET="avalanche_c_mainnet",e.AVALANCHE_P_MAINNET="avalanche_p_mainnet",e.AVALANCHE_X_MAINNET="avalanche_x_mainnet",e.ARBITRUM_MAINNET="arbitrum_mainnet",e.ARBITRUM_SEPOLIA="arbitrum_sepolia",e.BASE_MAINNET="base_mainnet",e.BASE_SEPOLIA="base_sepolia",e.OPTIMISM_MAINNET="optimism_mainnet",e.OPTIMISM_SEPOLIA="optimism_sepolia",e.FANTOM_MAINNET="fantom_mainnet",e.FANTOM_TESTNET="fantom_testnet",e.DYMENSION_MAINNET="dymension_mainnet",e.DYMENSION_TESTNET="dymension_testnet",e.BNB_MAINNET="bnb_mainnet",e.BNB_TESTNET="bnb_testnet",e.BSC_MAINNET="bsc_mainnet",e.BSC_TESTNET="bsc_testnet",e.ARBITRUM_ONE="arbitrum_one",e.ARBITRUM_NOVA="arbitrum_nova",e.AVALANCHE_FUJI_C="avalanche_fuji_c",e.AVALANCHE_FUJI_P="avalanche_fuji_p",e.AVALANCHE_FUJI_X="avalanche_fuji_x",e.BLAST_MAINNET="blast_mainnet",e.OPBNB_MAINNET="opbnb_mainnet",e.OPBNB_TESTNET="opbnb_testnet",e.GNOSIS_MAINNET="gnosis_mainnet",e.GNOSIS_CHIADO="gnosis_chiado",e.PULSECHAIN_MAINNET="pulsechain_mainnet",e.PULSECHAIN_TESTNET="pulsechain_testnet",e.KAVA_MAINNET="kava_mainnet",e.CRONOS_MAINNET="cronos_mainnet",e.MANTLE_MAINNET="mantle_mainnet",e.CHILIZ_MAINNET="chiliz_mainnet",e.CHILIZ_SPICY="chiliz_spicy",e.MOONBEAM_MAINNET="moonbeam_mainnet",e.TAIKO_MAINNET="taiko_mainnet",e.TAIKO_HEKLA="taiko_hekla",e.LINEA_MAINNET="linea_mainnet",e.LINEA_SEPOLIA="linea_sepolia",e.BAHAMUT_MAINNET="bahamut_mainnet",e.SCROLL_MAINNET="scroll_mainnet",e.SCROLL_SEPOLIA="scroll_sepolia",e.TRON_MAINNET="tron_mainnet",e.SYSCOIN_MAINNET="syscoin_mainnet",e.SYSCOIN_TANENBAUM="syscoin_tanenbaum",e.MOONRIVER_MAINNET="moonriver_mainnet",e.HAQQ_MAINNET="haqq_mainnet",e.EVMOS_MAINNET="evmos_mainnet",e.EVMOS_TESTNET="evmos_testnet",e.BERACHAIN_TESTNET="berachain_testnet",e})(q||{});var B1=1300,qu=class extends z{constructor(t){super("You've reach the rate limit of free RPC calls from our Partner Quick Nodes. There are two options you can either create a paid Quick Nodes account and get 20% off for 2 months using WEB3JS referral code, or use Free public RPC endpoint.",t),this.code=B1}},N1=1301,Xs=class extends z{constructor(t){super(`Invalid provider config options given for ${t}`),this.code=N1}};var O1=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},xi=class extends Yr{constructor(t,r,n,o,i){if(super(),i!==void 0&&r===Dt.HTTPS&&!("providerOptions"in i))throw new Xs("HTTP Provider");if(i!==void 0&&r===Dt.WebSocket&&!("socketOptions"in i||"reconnectOptions"in i))throw new Xs("Websocket Provider");this.transport=r,r===Dt.HTTPS?this.provider=new Pn(this.getRPCURL(t,r,n,o),i):r===Dt.WebSocket&&(this.provider=new Bn(this.getRPCURL(t,r,n,o),i?.socketOptions,i?.reconnectOptions))}request(t,r){return O1(this,void 0,void 0,function*(){return this.transport===Dt.HTTPS?yield this.provider.request(t,r):this.provider.request(t)})}getStatus(){return this.provider.getStatus()}supportsSubscriptions(){return this.provider.supportsSubscriptions()}once(t,r){var n;!((n=this.provider)===null||n===void 0)&&n.once&&this.provider.once(t,r)}removeAllListeners(t){var r;!((r=this.provider)===null||r===void 0)&&r.removeAllListeners&&this.provider.removeAllListeners(t)}connect(){var t;!((t=this.provider)===null||t===void 0)&&t.connect&&this.provider.connect()}disconnect(t,r){var n;!((n=this.provider)===null||n===void 0)&&n.disconnect&&this.provider.disconnect(t,r)}reset(){var t;!((t=this.provider)===null||t===void 0)&&t.reset&&this.provider.reset()}on(t,r){this.provider&&this.provider.on(t,r)}removeListener(t,r){this.provider&&this.provider.removeListener(t,r)}};var C1=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},ze=e=>e!==void 0&&e.trim().length>0,Wu=class extends xi{constructor(t=q.ETH_MAINNET,r=Dt.HTTPS,n="",o="",i){super(t,r,n,o,i)}request(t,r){let n=Object.create(null,{request:{get:()=>super.request}});return C1(this,void 0,void 0,function*(){try{return yield n.request.call(this,t,r)}catch(o){throw o instanceof Qe&&o.statusCode===429?new qu(o):o}})}getRPCURL(t,r,n,o){let i="",s="";switch(t){case q.ETH_MAINNET:i=ze(o)?o:"powerful-holy-bush.quiknode.pro",
12s=ze(n)?n:"3240624a343867035925ff7561eb60dfdba2a668";break;case q.ETH_SEPOLIA:i=ze(o)?o:"dimensional-fabled-glitter.ethereum-sepolia.quiknode.pro",s=ze(n)?n:"382a3b5a4b938f2d6e8686c19af4b22921fde2cd";break;case q.ETH_HOLESKY:i=ze(o)?o:"yolo-morning-card.ethereum-holesky.quiknode.pro",s=ze(n)?n:"481ebe70638c4dcf176af617a16d02ab866b9af9";break;case q.ARBITRUM_MAINNET:i=ze(o)?o:"autumn-divine-dinghy.arbitrum-mainnet.quiknode.pro",s=ze(n)?n:"a5d7bfbf60b5ae9ce3628e53d69ef50d529e9a8c";break;case q.ARBITRUM_SEPOLIA:i=ze(o)?o:"few-patient-pond.arbitrum-sepolia.quiknode.pro",s=ze(n)?n:"3be985450970628c860b959c65cd2642dcafe53c";break;case q.BNB_MAINNET:i=ze(o)?o:"purple-empty-reel.bsc.quiknode.pro",s=ze(n)?n:"ebf6c532961e21f092ff2facce1ec4c89c540158";break;case q.BNB_TESTNET:i=ze(o)?o:"floral-rough-scion.bsc-testnet.quiknode.pro",s=ze(n)?n:"5b297e5acff5f81f4c37ebf6f235f7299b6f9d28";break;case q.POLYGON_MAINNET:i=ze(o)?o:"small-chaotic-moon.matic.quiknode.pro",s=ze(n)?n:"847569f8a017e84d985e10d0f44365d965a951f1";break;case q.POLYGON_AMOY:i=ze(o)?o:"prettiest-side-shape.matic-amoy.quiknode.pro",s=ze(n)?n:"79a9476eea661d4f82de614db1d8a895b14b881c";break;default:throw new Error("Network info not avalible.")}return`${r}://${i}/${s}`}};var M1=e=>e!==void 0&&e.trim().length>0,L1=[q.DYMENSION_MAINNET,q.DYMENSION_TESTNET,q.KAVA_MAINNET,q.CRONOS_MAINNET,q.POLYGON_MAINNET],Bl=class e extends xi{constructor(t=q.ETH_MAINNET,r=Dt.HTTPS,n="",o){super(t,r,"",n,o)}getRPCURL(t,r,n,o){if(!e.networkHostMap[t])throw new Error("Network info not avalible.");let i=`${e.networkHostMap[t]}.publicnode.com`,s=M1(o)?o:i;return L1.includes(t)&&r===Dt.WebSocket?`${r}://${s}/websocket`:`${r}://${s}`}};Bl.networkHostMap={[q.POLYGON_AMOY]:"polygon-amoy-bor-rpc",[q.DYMENSION_MAINNET]:"dymension-evm-rpc",[q.DYMENSION_TESTNET]:"dymension-testnet-evm-rpc",[q.BLAST_MAINNET]:"blast-rpc",[q.GNOSIS_MAINNET]:"gnosis-rpc",[q.PULSECHAIN_MAINNET]:"pulsechain-rpc",[q.PULSECHAIN_TESTNET]:"pulsechain-testnet-rpc",[q.KAVA_MAINNET]:"kava-evm-rpc",[q.CRONOS_MAINNET]:"cronos-evm-rpc",[q.MANTLE_MAINNET]:"mantle-rpc",[q.TAIKO_MAINNET]:"taiko-rpc",[q.TAIKO_HEKLA]:"taiko-hekla-rpc",[q.LINEA_MAINNET]:"linea-rpc",[q.LINEA_SEPOLIA]:"linea-sepolia-rpc",[q.SCROLL_MAINNET]:"scroll-rpc",[q.SCROLL_SEPOLIA]:"scroll-sepolia-rpc",[q.SYSCOIN_MAINNET]:"syscoin-evm-rpc",[q.SYSCOIN_TANENBAUM]:"syscoin-tanenbaum-evm-rpc",[q.HAQQ_MAINNET]:"haqq-evm-rpc",[q.EVMOS_MAINNET]:"evmos-evm-rpc",[q.EVMOS_TESTNET]:"evmos-testnet-evm-rpc",[q.BERACHAIN_TESTNET]:"berachain-testnet-evm-rpc",[q.ETH_MAINNET]:"ethereum-rpc",[q.ETH_SEPOLIA]:"ethereum-sepolia-rpc",[q.ETH_HOLESKY]:"ethereum-holesky-rpc",[q.BSC_MAINNET]:"bsc-rpc",[q.BSC_TESTNET]:"bsc-testnet-rpc",[q.POLYGON_MAINNET]:"polygon-bor-rpc",[q.BASE_MAINNET]:"base-rpc",[q.BASE_SEPOLIA]:"base-sepolia-rpc",[q.ARBITRUM_ONE]:"arbitrum-one-rpc",[q.ARBITRUM_NOVA]:"arbitrum-nova-rpc",[q.ARBITRUM_SEPOLIA]:"arbitrum-sepolia-rpc",[q.AVALANCHE_C_MAINNET]:"avalanche-c-chain-rpc",[q.AVALANCHE_P_MAINNET]:"avalanche-p-chain-rpc",[q.AVALANCHE_X_MAINNET]:"avalanche-x-chain-rpc",[q.AVALANCHE_FUJI_C]:"avalanche-fuji-c-chain-rpc",[q.AVALANCHE_FUJI_P]:"avalanche-fuji-p-chain-rpc",[q.AVALANCHE_FUJI_X]:"avalanche-fuji-x-chain-rpc",[q.OPTIMISM_MAINNET]:"optimism-rpc",[q.OPTIMISM_SEPOLIA]:"optimism-sepolia-rpc",[q.FANTOM_MAINNET]:"fantom-rpc",[q.FANTOM_TESTNET]:"fantom-testnet-rpc",[q.OPBNB_MAINNET]:"opbnb-rpc",[q.OPBNB_TESTNET]:"opbnb-testnet-rpc",[q.GNOSIS_CHIADO]:"gnosis-chiado-rpc",[q.CHILIZ_MAINNET]:"chiliz-rpc",[q.CHILIZ_SPICY]:"chiliz-spicy-rpc",[q.MOONBEAM_MAINNET]:"moonbeam-rpc",[q.BAHAMUT_MAINNET]:"bahamut-rpc",[q.TRON_MAINNET]:"tron-evm-rpc",[q.MOONRIVER_MAINNET]:"moonriver-rpc"};var fy=new Wu;var ly={encodeEventSignature:ai,encodeFunctionCall:bg,encodeFunctionSignature:ln,encodeParameter:Gs,encodeParameters:ur,decodeParameter:Bu,decodeParameters:dr,decodeLog:Nu};var Js=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},hy=e=>{let t=(s,a)=>Js(void 0,void 0,void 0,function*(){let u=yield Kg(s,e),d=M({format:"bytes"},a,J);return k0(u,d)}),r=s=>{let a=pu(s);return Object.assign(Object.assign({},a),{signTransaction:u=>Js(void 0,void 0,void 0,function*(){return t(u,a.privateKey)})})},n=(s,a,u)=>Js(void 0,void 0,void 0,function*(){var d;let c=yield O0(s,a,(d=u?.nonStrict)!==null&&d!==void 0?d:!0);return Object.assign(Object.assign({},c),{signTransaction:f=>Js(void 0,void 0,void 0,function*(){return t(f,c.privateKey)})})}),o=()=>{let s=N0();return Object.assign(Object.assign({},s),{signTransaction:a=>Js(void 0,void 0,void 0,function*(){return t(a,s.privateKey)})})},i=new Wc({create:o,privateKeyToAccount:r,decrypt:n});return{signTransaction:t,create:o,privateKeyToAccount:r,decrypt:n,recoverTransaction:P0,hashMessage:hu,sign:Zf,recover:fu,encrypt:Xf,wallet:i,privateKeyToAddress:Jo,parseAndValidatePrivateKey:qn,privateKeyToPublicKey:B0}};var py={version:"4.16.0"};var D1=function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(c){try{d(n.next(c))}catch(f){s(f)}}function u(c){try{d(n.throw(c))}catch(f){s(f)}}function d(c){c.done?i(c.value):o(c.value).then(a,u)}d((n=n.apply(e,t||[])).next())})},Ol=(function(e){return e.eip6963announceProvider="eip6963:announceProvider",e.eip6963requestProvider="eip6963:requestProvider",e})(Ol||{}),Nl=new Map,my="web3:providersMapUpdated",gy=()=>D1(void 0,void 0,void 0,function*(){return new Promise((e,t)=>
12{typeof window>"u"&&t(new Error("window object not available, EIP-6963 is intended to be used within a browser")),window.addEventListener(Ol.eip6963announceProvider,r=>{Nl.set(r.detail.info.uuid,r.detail);let n=new CustomEvent(my,{detail:Nl});window.dispatchEvent(n),e(Nl)}),window.dispatchEvent(new Event(Ol.eip6963requestProvider))})}),yy=e=>{if(typeof window>"u")throw new Error("window object not available, EIP-6963 is intended to be used within a browser");window.addEventListener(my,e)};var eo=class extends He{constructor(t=fy){var r;(V(t)||typeof t=="string"&&t.trim()===""||typeof t!="string"&&!Nn(t)&&!t.provider)&&console.warn("NOTE: web3.js is running without provider. You need to pass a provider in order to interact with the network!");let n={};typeof t=="string"||Nn(t)?n.provider=t:t?n=t:n={},n.registeredSubscriptions=Object.assign(Object.assign({},Du),(r=n.registeredSubscriptions)!==null&&r!==void 0?r:{}),super(n);let o=hy(this);this._wallet=o.wallet,this._accountProvider=o,this.utils=_s;let i=this;class s extends Yg{constructor(d,c,f,_,w){if(Gt(c)&&Gt(f))throw new oo("Should not provide options at both 2nd and 3rd parameters");let k,T={},R,P;if(!V(c)&&typeof c!="object"&&typeof c!="string")throw new oo;if(typeof c=="string"&&(k=c),Gt(c)?T=c:Gt(f)?T=f:T={},c instanceof He?R=c:f instanceof He?R=f:_ instanceof He?R=_:R=i.getContextObject(),w?P=w:qt(f)?P=f:qt(_)&&(P=_),super(d,k,T,R,P),super.subscribeToContextEvents(i),!V(a)){let b=a.getTransactionMiddleware();V(b)||super.setTransactionMiddleware(b)}}}let a=i.use(Xn);this.eth=Object.assign(a,{ens:i.use(Zs,yn.main),Iban:Yo,net:i.use(Wn),personal:i.use(Qn),Contract:s,abi:ly,accounts:o})}};eo.version=py.version;eo.utils=_s;eo.requestEIP6963Providers=gy;eo.onNewProviderDiscovered=yy;eo.modules={Web3Eth:Xn,Iban:Yo,Net:Wn,ENS:Zs,Personal:Qn};var z9=(()=>{class e{web3InfrastructureService=vi(zl);cacheService=vi(Vl);CACHE_TIME=15e3;$balanceReloader=Ul(this.CACHE_TIME,!0);$manualRefresh=bi(null);$loading=bi(!1);refreshBalance(){this.$manualRefresh.set(new Date)}getTokenCollection(r,n,o,i=null,s=this.CACHE_TIME){if(!r||!n)return Cr(null);let a=this.cacheService.buildCollectionCacheKey(r,n.contractAddress,n.chainId,o);return this.getRefreshTrigger(i).pipe(Vu(()=>this.cacheService.getOrFetch(a,()=>this.fetchCollectionFromSDK(r,n,o),s)),ea((u,d)=>JSON.stringify(u)===JSON.stringify(d)),Qs(u=>(console.error(`[Web3Service] getTokenCollection error for ${n.type}:`,u),this.$loading.set(!1),Cr(null))))}$refreshTrigger=Hl(()=>{let r=this.$balanceReloader(),n=this.$manualRefresh(),o=n?"manual":"auto";return{timestamp:n?.getTime()||r||Date.now(),trigger:o}});refreshTrigger$=Fl(this.$refreshTrigger).pipe(ea((r,n)=>r.timestamp===n.timestamp));getRefreshTrigger(r){return(r?Dl(Ll(r).pipe(Ml(()=>({trigger:"interval",timestamp:Date.now()}))),this.refreshTrigger$):this.refreshTrigger$).pipe(ro(({trigger:o,timestamp:i})=>{ta()&&console.debug(`[Web3Service] Refresh: ${o} at ${new Date(i).toLocaleTimeString()}`)}))}getBalance(r,n,o,i=null,s=this.CACHE_TIME){if(!r||!n)return Cr(null);let a=this.cacheService.buildBalanceCacheKey(n.type,r,n.contractAddress,o);return this.getRefreshTrigger(i).pipe(Vu(()=>this.cacheService.getOrFetch(a,()=>this.fetchFromSDK(r,n,o),s)),ea((u,d)=>JSON.stringify(u)===JSON.stringify(d)),Qs(u=>(console.error(`[Web3Service] getBalance error for ${n.type}:`,u),this.$loading.set(!1),Cr(null))))}getTokenMetadata(r,n){return this.web3InfrastructureService.getTokenMetadata({contractAddress:r.contractAddress,abi:na(r.abi),tokenId:n,chainId:r.chainId})}fetchFromSDK(r,n,o){this.$loading.set(!0);let i={accountAddress:r,contractAddress:n.contractAddress,abi:na(n.abi),tokenId:o||"",chainId:n.chainId};return this.web3InfrastructureService.getTokenBalance(i).pipe(ro(()=>this.$loading.set(!1)))}fetchCollectionFromSDK(r,n,o){this.$loading.set(!0);let i={accountAddress:r,contractAddress:n.contractAddress,abi:na(n.abi),chainId:n.chainId,maxTokens:o,tokenIds:n.type==="ERC1155"?n.metadata?.map(s=>s.tokenMetadataIncrementalId.toString()):void 0};return this.web3InfrastructureService.getTokenCollection(i).pipe(ro(()=>this.$loading.set(!1)))}
12getExplorerUrl(r,n,o){return this.web3InfrastructureService.getExplorerUrl(r,n,o).pipe(Qs(i=>(console.error(`[Web3Service] getExplorerUrl error for chainId ${r}:`,i),Cr(`https://etherscan.io/${o}/${n}`))))}static \u0275fac=function(n){return new(n||e)};static \u0275prov=no({token:e,factory:e.\u0275fac})}return e})();export{z9 as Web3Service};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.