@snapshot-labs/snapshot.js 0.14.3 → 0.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -229,4 +229,4 @@ const{fromCallback:RA}=HE,PA=VE.Store,BA=ZE.permuteDomain,DA=KE.pathMatch,{getCu
229
229
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
230
230
  * POSSIBILITY OF SUCH DAMAGE.
231
231
  */
232
- const tj=VE.Store,ej=qA.MemoryCookieStore,rj=KE.pathMatch,{fromCallback:ij}=HE,{getCustomInspectSymbol:nj}=OA,oj=/^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/,aj=/[\x00-\x1F]/,sj=["\n","\r","\0"],hj=/[\x20-\x3A\x3C-\x7E]+/,uj=/[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/,lj={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},cj=2147483647e3,dj='Invalid sameSiteContext option for getCookies(); expected one of "strict", "lax", or "none"';function fj(t){YA.validate(YA.isNonEmptyString(t),t);const e=String(t).toLowerCase();return"none"===e||"lax"===e||"strict"===e?e:null}const mj=Object.freeze({SILENT:"silent",STRICT:"strict",DISABLED:"unsafe-disabled"}),pj=/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-f\d]{1,4}:){7}(?:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,2}|:)|(?:[a-f\d]{1,4}:){4}(?:(?::[a-f\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,3}|:)|(?:[a-f\d]{1,4}:){3}(?:(?::[a-f\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,4}|:)|(?:[a-f\d]{1,4}:){2}(?:(?::[a-f\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,5}|:)|(?:[a-f\d]{1,4}:){1}(?:(?::[a-f\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,6}|:)|(?::(?:(?::[a-f\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,7}|:)))$)/,gj="\n\\[?(?:\n(?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|:[a-fA-F\\d]{1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,2}|:)|\n(?:[a-fA-F\\d]{1,4}:){4}(?:(?::[a-fA-F\\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,3}|:)|\n(?:[a-fA-F\\d]{1,4}:){3}(?:(?::[a-fA-F\\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){2}(?:(?::[a-fA-F\\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,5}|:)|\n(?:[a-fA-F\\d]{1,4}:){1}(?:(?::[a-fA-F\\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,6}|:)|\n(?::(?:(?::[a-fA-F\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,7}|:))\n)(?:%[0-9a-zA-Z]{1,})?\\]?\n".replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),yj=new RegExp(`^${gj}$`);function wj(t,e,r,i){let n=0;for(;n<t.length;){const e=t.charCodeAt(n);if(e<=47||e>=58)break;n++}return n<e||n>r?null:i||n==t.length?parseInt(t.substr(0,n),10):null}function vj(t){const e=t.split(":"),r=[0,0,0];if(3!==e.length)return null;for(let t=0;t<3;t++){const i=2==t,n=wj(e[t],1,2,i);if(null===n)return null;r[t]=n}return r}function bj(t){t=String(t).substr(0,3).toLowerCase();const e=lj[t];return e>=0?e:null}function kj(t){if(!t)return;const e=t.split(uj);if(!e)return;let r=null,i=null,n=null,o=null,a=null,s=null;for(let t=0;t<e.length;t++){const h=e[t].trim();if(!h.length)continue;let u;null===n&&(u=vj(h),u)?(r=u[0],i=u[1],n=u[2]):null!==o||(u=wj(h,1,2,!0),null===u)?null!==a||(u=bj(h),null===u)?null===s&&(u=wj(h,2,4,!0),null!==u&&(s=u,s>=70&&s<=99?s+=1900:s>=0&&s<=69&&(s+=2e3))):a=u:o=u}return null===o||null===a||null===s||null===n||o<1||o>31||s<1601||r>23||i>59||n>59?void 0:new Date(Date.UTC(s,a,o,r,i,n))}function Mj(t){return YA.validate(YA.isDate(t),t),t.toUTCString()}function _j(t){return null==t?null:(t=t.trim().replace(/^\./,""),yj.test(t)&&(t=t.replace("[","").replace("]","")),XA&&/[^\u0001-\u007f]/.test(t)&&(t=XA.toASCII(t)),t.toLowerCase())}function Ej(t,e,r){if(null==t||null==e)return null;if(!1!==r&&(t=_j(t),e=_j(e)),t==e)return!0;const i=t.lastIndexOf(e);return!(i<=0)&&(t.length===e.length+i&&("."===t.substr(i-1,1)&&!pj.test(t)))}function Aj(t){if(!t||"/"!==t.substr(0,1))return"/";if("/"===t)return t;const e=t.lastIndexOf("/");return 0===e?"/":t.slice(0,e)}function jj(t,e){t=function(t){if(YA.isEmptyString(t))return t;for(let e=0;e<sj.length;e++){const r=t.indexOf(sj[e]);-1!==r&&(t=t.substr(0,r))}return t}(t),YA.validate(YA.isString(t),t);let r,i,n=t.indexOf("=");if(e)0===n&&(n=(t=t.substr(1)).indexOf("="));else if(n<=0)return;if(n<=0?(r="",i=t.trim()):(r=t.substr(0,n).trim(),i=t.substr(n+1).trim()),aj.test(r)||aj.test(i))return;const o=new zj;return o.key=r,o.value=i,o}function xj(t,e){if(e&&"object"==typeof e||(e={}),YA.isEmptyString(t)||!YA.isString(t))return null;const r=(t=t.trim()).indexOf(";"),i=jj(-1===r?t:t.substr(0,r),!!e.loose);if(!i)return;if(-1===r)return i;const n=t.slice(r+1).trim();if(0===n.length)return i;const o=n.split(";");for(;o.length;){const t=o.shift().trim();if(0===t.length)continue;const e=t.indexOf("=");let r,n;switch(-1===e?(r=t,n=null):(r=t.substr(0,e),n=t.substr(e+1)),r=r.trim().toLowerCase(),n&&(n=n.trim()),r){case"expires":if(n){const t=kj(n);t&&(i.expires=t)}break;case"max-age":if(n&&/^-?[0-9]+$/.test(n)){const t=parseInt(n,10);i.setMaxAge(t)}break;case"domain":if(n){const t=n.trim().replace(/^\./,"");t&&(i.domain=t.toLowerCase())}break;case"path":i.path=n&&"/"===n[0]?n:null;break;case"secure":i.secure=!0;break;case"httponly":i.httpOnly=!0;break;case"samesite":switch(n?n.toLowerCase():""){case"strict":i.sameSite="strict";break;case"lax":i.sameSite="lax";break;case"none":i.sameSite="none";break;default:i.sameSite=void 0}break;default:i.extensions=i.extensions||[],i.extensions.push(t)}}return i}function Sj(t){let e;try{e=JSON.parse(t)}catch(t){return t}return e}function Nj(t){if(!t||YA.isEmptyString(t))return null;let e;if("string"==typeof t){if(e=Sj(t),e instanceof Error)return null}else e=t;const r=new zj;for(let t=0;t<zj.serializableProperties.length;t++){const i=zj.serializableProperties[t];void 0!==e[i]&&e[i]!==Cj[i]&&("expires"===i||"creation"===i||"lastAccessed"===i?null===e[i]?r[i]=null:r[i]="Infinity"==e[i]?"Infinity":new Date(e[i]):r[i]=e[i])}return r}function Ij(t,e){YA.validate(YA.isObject(t),t),YA.validate(YA.isObject(e),e);let r=0;const i=t.path?t.path.length:0;if(r=(e.path?e.path.length:0)-i,0!==r)return r;return r=(t.creation?t.creation.getTime():cj)-(e.creation?e.creation.getTime():cj),0!==r||(r=t.creationIndex-e.creationIndex),r}function Tj(t){if(t instanceof Object)return t;try{t=decodeURI(t)}catch(t){}return DE(t)}const Cj={key:"",value:"",expires:"Infinity",maxAge:null,domain:null,path:null,secure:!1,httpOnly:!1,extensions:null,hostOnly:null,pathIsDefault:null,creation:null,lastAccessed:null,sameSite:void 0};class zj{constructor(t={}){const e=nj();e&&(this[e]=this.inspect),Object.assign(this,Cj,t),this.creation=this.creation||new Date,Object.defineProperty(this,"creationIndex",{configurable:!1,enumerable:!1,writable:!0,value:++zj.cookiesCreated})}inspect(){const t=Date.now(),e=null!=this.hostOnly?this.hostOnly:"?",r=this.creation?t-this.creation.getTime()+"ms":"?",i=this.lastAccessed?t-this.lastAccessed.getTime()+"ms":"?";return`Cookie="${this.toString()}; hostOnly=${e}; aAge=${i}; cAge=${r}"`}toJSON(){const t={};for(const e of zj.serializableProperties)this[e]!==Cj[e]&&("expires"===e||"creation"===e||"lastAccessed"===e?null===this[e]?t[e]=null:t[e]="Infinity"==this[e]?"Infinity":this[e].toISOString():"maxAge"===e?null!==this[e]&&(t[e]=this[e]==1/0||this[e]==-1/0?this[e].toString():this[e]):this[e]!==Cj[e]&&(t[e]=this[e]));return t}clone(){return Nj(this.toJSON())}validate(){if(!oj.test(this.value))return!1;if(!(this.expires==1/0||this.expires instanceof Date||kj(this.expires)))return!1;if(null!=this.maxAge&&this.maxAge<=0)return!1;if(null!=this.path&&!hj.test(this.path))return!1;const t=this.cdomain();if(t){if(t.match(/\.$/))return!1;if(null==qE.getPublicSuffix(t))return!1}return!0}setExpires(t){t instanceof Date?this.expires=t:this.expires=kj(t)||"Infinity"}setMaxAge(t){this.maxAge=t===1/0||t===-1/0?t.toString():t}cookieString(){let t=this.value;return null==t&&(t=""),""===this.key?t:`${this.key}=${t}`}toString(){let t=this.cookieString();if(this.expires!=1/0&&(this.expires instanceof Date?t+=`; Expires=${Mj(this.expires)}`:t+=`; Expires=${this.expires}`),null!=this.maxAge&&this.maxAge!=1/0&&(t+=`; Max-Age=${this.maxAge}`),this.domain&&!this.hostOnly&&(t+=`; Domain=${this.domain}`),this.path&&(t+=`; Path=${this.path}`),this.secure&&(t+="; Secure"),this.httpOnly&&(t+="; HttpOnly"),this.sameSite&&"none"!==this.sameSite){const e=zj.sameSiteCanonical[this.sameSite.toLowerCase()];t+=`; SameSite=${e||this.sameSite}`}return this.extensions&&this.extensions.forEach((e=>{t+=`; ${e}`})),t}TTL(t){if(null!=this.maxAge)return this.maxAge<=0?0:1e3*this.maxAge;let e=this.expires;return e!=1/0?(e instanceof Date||(e=kj(e)||1/0),e==1/0?1/0:e.getTime()-(t||Date.now())):1/0}expiryTime(t){if(null!=this.maxAge){const e=t||this.creation||new Date,r=this.maxAge<=0?-1/0:1e3*this.maxAge;return e.getTime()+r}return this.expires==1/0?1/0:this.expires.getTime()}expiryDate(t){const e=this.expiryTime(t);return e==1/0?new Date(cj):e==-1/0?new Date(0):new Date(e)}isPersistent(){return null!=this.maxAge||this.expires!=1/0}canonicalizedDomain(){return null==this.domain?null:_j(this.domain)}cdomain(){return this.canonicalizedDomain()}}function Oj(t){if(null!=t){const e=t.toLowerCase();switch(e){case mj.STRICT:case mj.SILENT:case mj.DISABLED:return e}}return mj.SILENT}zj.cookiesCreated=0,zj.parse=xj,zj.fromJSON=Nj,zj.serializableProperties=Object.keys(Cj),zj.sameSiteLevel={strict:3,lax:2,none:1},zj.sameSiteCanonical={strict:"Strict",lax:"Lax"};class Rj{constructor(t,e={rejectPublicSuffixes:!0}){"boolean"==typeof e&&(e={rejectPublicSuffixes:e}),YA.validate(YA.isObject(e),e),this.rejectPublicSuffixes=e.rejectPublicSuffixes,this.enableLooseMode=!!e.looseMode,this.allowSpecialUseDomain="boolean"!=typeof e.allowSpecialUseDomain||e.allowSpecialUseDomain,this.store=t||new ej,this.prefixSecurity=Oj(e.prefixSecurity),this._cloneSync=Pj("clone"),this._importCookiesSync=Pj("_importCookies"),this.getCookiesSync=Pj("getCookies"),this.getCookieStringSync=Pj("getCookieString"),this.getSetCookieStringsSync=Pj("getSetCookieStrings"),this.removeAllCookiesSync=Pj("removeAllCookies"),this.setCookieSync=Pj("setCookie"),this.serializeSync=Pj("serialize")}setCookie(t,e,r,i){let n;if(YA.validate(YA.isUrlStringOrObject(e),i,r),YA.isFunction(e))return(i=e)(new Error("No URL was specified"));const o=Tj(e);if(YA.isFunction(r)&&(i=r,r={}),YA.validate(YA.isFunction(i),i),!YA.isNonEmptyString(t)&&!YA.isObject(t)&&t instanceof String&&0==t.length)return i(null);const a=_j(o.hostname),s=r.loose||this.enableLooseMode;let h=null;if(r.sameSiteContext&&(h=fj(r.sameSiteContext),!h))return i(new Error(dj));if("string"==typeof t||t instanceof String){if(!(t=zj.parse(t,{loose:s})))return n=new Error("Cookie failed to parse"),i(r.ignoreError?null:n)}else if(!(t instanceof zj))return n=new Error("First argument to setCookie must be a Cookie object or string"),i(r.ignoreError?null:n);const u=r.now||new Date;if(this.rejectPublicSuffixes&&t.domain){if(null==qE.getPublicSuffix(t.cdomain(),{allowSpecialUseDomain:this.allowSpecialUseDomain,ignoreError:r.ignoreError})&&!yj.test(t.domain))return n=new Error("Cookie has domain set to a public suffix"),i(r.ignoreError?null:n)}if(t.domain){if(!Ej(a,t.cdomain(),!1))return n=new Error(`Cookie not in this host's domain. Cookie:${t.cdomain()} Request:${a}`),i(r.ignoreError?null:n);null==t.hostOnly&&(t.hostOnly=!1)}else t.hostOnly=!0,t.domain=a;if(t.path&&"/"===t.path[0]||(t.path=Aj(o.pathname),t.pathIsDefault=!0),!1===r.http&&t.httpOnly)return n=new Error("Cookie is HttpOnly and this isn't an HTTP API"),i(r.ignoreError?null:n);if("none"!==t.sameSite&&void 0!==t.sameSite&&h&&"none"===h)return n=new Error("Cookie is SameSite but this is a cross-origin request"),i(r.ignoreError?null:n);const l=this.prefixSecurity===mj.SILENT;if(!(this.prefixSecurity===mj.DISABLED)){let e,n=!1;if(!function(t){return YA.validate(YA.isObject(t),t),!t.key.startsWith("__Secure-")||t.secure}(t)?(n=!0,e="Cookie has __Secure prefix but Secure attribute is not set"):function(t){return YA.validate(YA.isObject(t)),!t.key.startsWith("__Host-")||t.secure&&t.hostOnly&&null!=t.path&&"/"===t.path}(t)||(n=!0,e="Cookie has __Host prefix but either Secure or HostOnly attribute is not set or Path is not '/'"),n)return i(r.ignoreError||l?null:new Error(e))}const c=this.store;c.updateCookie||(c.updateCookie=function(t,e,r){this.putCookie(e,r)}),c.findCookie(t.domain,t.path,t.key,(function(e,n){if(e)return i(e);const o=function(e){if(e)return i(e);i(null,t)};if(n){if(!1===r.http&&n.httpOnly)return e=new Error("old Cookie is HttpOnly and this isn't an HTTP API"),i(r.ignoreError?null:e);t.creation=n.creation,t.creationIndex=n.creationIndex,t.lastAccessed=u,c.updateCookie(n,t,o)}else t.creation=t.lastAccessed=u,c.putCookie(t,o)}))}getCookies(t,e,r){YA.validate(YA.isUrlStringOrObject(t),r,t);const i=Tj(t);YA.isFunction(e)&&(r=e,e={}),YA.validate(YA.isObject(e),r,e),YA.validate(YA.isFunction(r),r);const n=_j(i.hostname),o=i.pathname||"/";let a=e.secure;null!=a||!i.protocol||"https:"!=i.protocol&&"wss:"!=i.protocol||(a=!0);let s=0;if(e.sameSiteContext){const t=fj(e.sameSiteContext);if(s=zj.sameSiteLevel[t],!s)return r(new Error(dj))}let h=e.http;null==h&&(h=!0);const u=e.now||Date.now(),l=!1!==e.expire,c=!!e.allPaths,d=this.store;function f(t){if(t.hostOnly){if(t.domain!=n)return!1}else if(!Ej(n,t.domain,!1))return!1;if(!c&&!rj(o,t.path))return!1;if(t.secure&&!a)return!1;if(t.httpOnly&&!h)return!1;if(s){if(zj.sameSiteLevel[t.sameSite||"none"]>s)return!1}return!(l&&t.expiryTime()<=u)||(d.removeCookie(t.domain,t.path,t.key,(()=>{})),!1)}d.findCookies(n,c?null:o,this.allowSpecialUseDomain,((t,i)=>{if(t)return r(t);i=i.filter(f),!1!==e.sort&&(i=i.sort(Ij));const n=new Date;for(const t of i)t.lastAccessed=n;r(null,i)}))}getCookieString(...t){const e=t.pop();YA.validate(YA.isFunction(e),e);t.push((function(t,r){t?e(t):e(null,r.sort(Ij).map((t=>t.cookieString())).join("; "))})),this.getCookies.apply(this,t)}getSetCookieStrings(...t){const e=t.pop();YA.validate(YA.isFunction(e),e);t.push((function(t,r){t?e(t):e(null,r.map((t=>t.toString())))})),this.getCookies.apply(this,t)}serialize(t){YA.validate(YA.isFunction(t),t);let e=this.store.constructor.name;YA.isObject(e)&&(e=null);const r={version:"tough-cookie@4.1.4",storeType:e,rejectPublicSuffixes:!!this.rejectPublicSuffixes,enableLooseMode:!!this.enableLooseMode,allowSpecialUseDomain:!!this.allowSpecialUseDomain,prefixSecurity:Oj(this.prefixSecurity),cookies:[]};if(!this.store.getAllCookies||"function"!=typeof this.store.getAllCookies)return t(new Error("store does not support getAllCookies and cannot be serialized"));this.store.getAllCookies(((e,i)=>e?t(e):(r.cookies=i.map((t=>(delete(t=t instanceof zj?t.toJSON():t).creationIndex,t))),t(null,r))))}toJSON(){return this.serializeSync()}_importCookies(t,e){let r=t.cookies;if(!r||!Array.isArray(r))return e(new Error("serialized jar has no cookies array"));r=r.slice();const i=t=>{if(t)return e(t);if(!r.length)return e(t,this);let n;try{n=Nj(r.shift())}catch(t){return e(t)}if(null===n)return i(null);this.store.putCookie(n,i)};i()}clone(t,e){1===arguments.length&&(e=t,t=null),this.serialize(((r,i)=>{if(r)return e(r);Rj.deserialize(i,t,e)}))}cloneSync(t){if(0===arguments.length)return this._cloneSync();if(!t.synchronous)throw new Error("CookieJar clone destination store is not synchronous; use async API instead.");return this._cloneSync(t)}removeAllCookies(t){YA.validate(YA.isFunction(t),t);const e=this.store;if("function"==typeof e.removeAllCookies&&e.removeAllCookies!==tj.prototype.removeAllCookies)return e.removeAllCookies(t);e.getAllCookies(((r,i)=>{if(r)return t(r);if(0===i.length)return t(null);let n=0;const o=[];function a(e){if(e&&o.push(e),n++,n===i.length)return t(o.length?o[0]:null)}i.forEach((t=>{e.removeCookie(t.domain,t.path,t.key,a)}))}))}static deserialize(t,e,r){let i;if(3!==arguments.length&&(r=e,e=null),YA.validate(YA.isFunction(r),r),"string"==typeof t){if(i=Sj(t),i instanceof Error)return r(i)}else i=t;const n=new Rj(e,{rejectPublicSuffixes:i.rejectPublicSuffixes,looseMode:i.enableLooseMode,allowSpecialUseDomain:i.allowSpecialUseDomain,prefixSecurity:i.prefixSecurity});n._importCookies(i,(t=>{if(t)return r(t);r(null,n)}))}static deserializeSync(t,e){const r="string"==typeof t?JSON.parse(t):t,i=new Rj(e,{rejectPublicSuffixes:r.rejectPublicSuffixes,looseMode:r.enableLooseMode});if(!i.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");return i._importCookiesSync(r),i}}function Pj(t){return function(...e){if(!this.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");let r,i;if(this[t](...e,((t,e)=>{r=t,i=e})),r)throw r;return i}}Rj.fromJSON=Rj.deserializeSync,["_importCookies","clone","getCookies","getCookieString","getSetCookieStrings","removeAllCookies","serialize","setCookie"].forEach((t=>{Rj.prototype[t]=ij(Rj.prototype[t])})),Rj.deserialize=ij(Rj.deserialize);var Bj=QA,Dj=Rj,$j=zj,Lj=tj,Uj=ej,Fj=kj,qj=Mj,Vj=xj,Hj=Nj,Gj=Ej,Zj=Aj,Kj=rj,Jj=qE.getPublicSuffix,Wj=Ij,Yj=ZE.permuteDomain,Qj=function(t){if(YA.validate(YA.isString(t)),"/"===t)return["/"];const e=[t];for(;t.length>1;){const r=t.lastIndexOf("/");if(0===r)break;t=t.substr(0,r),e.push(t)}return e.push("/"),e},Xj=_j,tx=mj,ex=YA.ParameterError,rx={version:Bj,CookieJar:Dj,Cookie:$j,Store:Lj,MemoryCookieStore:Uj,parseDate:Fj,formatDate:qj,parse:Vj,fromJSON:Hj,domainMatch:Gj,defaultPath:Zj,pathMatch:Kj,getPublicSuffix:Jj,cookieCompare:Wj,permuteDomain:Yj,permutePath:Qj,canonicalDomain:Xj,PrefixSecurityEnum:tx,ParameterError:ex},ix=Object.freeze(Object.assign(Object.create(null),rx,{default:rx,version:Bj,CookieJar:Dj,Cookie:$j,Store:Lj,MemoryCookieStore:Uj,parseDate:Fj,formatDate:qj,parse:Vj,fromJSON:Hj,domainMatch:Gj,defaultPath:Zj,pathMatch:Kj,getPublicSuffix:Jj,cookieCompare:Wj,permuteDomain:Yj,permutePath:Qj,canonicalDomain:Xj,PrefixSecurityEnum:tx,ParameterError:ex}));var nx=function(t){if(Array.isArray(t))return t;if("string"!=typeof t)return[];var e,r,i,n,o,a=[],s=0;function h(){for(;s<t.length&&/\s/.test(t.charAt(s));)s+=1;return s<t.length}for(;s<t.length;){for(e=s,o=!1;h();)if(","===(r=t.charAt(s))){for(i=s,s+=1,h(),n=s;s<t.length&&"="!==(r=t.charAt(s))&&";"!==r&&","!==r;)s+=1;s<t.length&&"="===t.charAt(s)?(o=!0,s=n,a.push(t.substring(e,i)),e=s):s=i+1}else s+=1;(!o||s>=t.length)&&a.push(t.substring(e,t.length))}return a};const ox=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]);function ax(t,e){}function sx(t,e){t.headers.delete(e)}function hx(t,e){const r=t.headers;for(const t of Object.keys(r))t.toLowerCase()===e&&delete r[t]}const ux=new Set([301,302,303,307,308]);async function lx(t,e,r){switch(e.redirect??"follow"){case"error":throw new TypeError(`URI requested responded with a redirect and redirect mode is set to error: ${r.url}`);case"manual":return r;case"follow":break;default:throw new TypeError(`Invalid redirect option: ${e.redirect}`)}const i=r.headers.get("location");if(null===i)return r;const n=r.url,o=new URL(i,n).toString(),a=e.redirectCount??0,s=e.maxRedirect??20;if(a>=s)throw new TypeError(`Reached maximum redirect of ${s} for URL: ${n}`);const h=function(t){return null==t.headers?ax:"function"==typeof t.headers.delete?sx:hx}(e={...e,redirectCount:a+1});if(!function(t,e){const r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)}(n,o))for(const t of["authorization","www-authenticate","cookie","cookie2"])h(e,t);const u=e.body,l=e.body;if(303!==r.status&&null!=e.body&&("function"==typeof u.pipe||"function"==typeof l.pipeTo))throw new TypeError("Cannot follow redirect with body being a readable stream");return 303!==r.status&&(301!==r.status&&302!==r.status||"POST"!==e.method)||(e.method="GET",e.body=void 0,h(e,"content-length")),r.headers.has("referrer-policy")&&(e.referrerPolicy=function(t){const e=t.split(/[,\s]+/);let r="";for(const t of e)""!==t&&ox.has(t)&&(r=t);return r}(r.headers.get("referrer-policy"))),await t(o,e)}function cx(t,e,r=!0){const i=t,n=e??new Dj;async function o(t,e){const a=e??{};e={...e,redirect:"manual"};const s="string"==typeof t?t:t.url??t.href;e=function(t,e,r){if(""===r)return e;const i=t,n=e.headers;return i.headers&&"function"==typeof i.headers.append?i.headers.append("cookie",r):n&&"function"==typeof n.append?n.append("cookie",r):e={...e,headers:{...e.headers,cookie:r}},e}(t,e,await n.getCookieString(s));const h=await i(t,e),u=function(t){const e=t.headers;if("function"==typeof e.getAll)return e.getAll("set-cookie");if("function"==typeof e.raw){const t=e.raw();return Array.isArray(t["set-cookie"])?t["set-cookie"]:[]}const r=t.headers.get("set-cookie");return null!==r?nx(r):[]}(h);return await Promise.all(u.map((async t=>await n.setCookie(t,h.url,{ignoreError:r})))),(e.redirectCount??0)>0&&Object.defineProperty(h,"redirected",{value:!0}),l=h.status,ux.has(l)?await lx(o,a,h):h;var l}return o.toughCookie=ix,o}cx.toughCookie=ix;var dx="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==t&&t||{},fx="URLSearchParams"in dx,mx="Symbol"in dx&&"iterator"in Symbol,px="FileReader"in dx&&"Blob"in dx&&function(){try{return new Blob,!0}catch(t){return!1}}(),gx="FormData"in dx,yx="ArrayBuffer"in dx;if(yx)var wx=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],vx=ArrayBuffer.isView||function(t){return t&&wx.indexOf(Object.prototype.toString.call(t))>-1};function bx(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function kx(t){return"string"!=typeof t&&(t=String(t)),t}function Mx(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return mx&&(e[Symbol.iterator]=function(){return e}),e}function _x(t){this.map={},t instanceof _x?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function Ex(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function Ax(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function jx(t){var e=new FileReader,r=Ax(e);return e.readAsArrayBuffer(t),r}function xx(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function Sx(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:px&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:gx&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:fx&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():yx&&px&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=xx(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):yx&&(ArrayBuffer.prototype.isPrototypeOf(t)||vx(t))?this._bodyArrayBuffer=xx(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):fx&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},px&&(this.blob=function(){var t=Ex(this);if(t)return t;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 t=Ex(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(px)return this.blob().then(jx);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,i,n,o=Ex(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=Ax(e),i=/charset=([A-Za-z0-9_-]+)/.exec(t.type),n=i?i[1]:"utf-8",e.readAsText(t,n),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},gx&&(this.formData=function(){return this.text().then(Tx)}),this.json=function(){return this.text().then(JSON.parse)},this}_x.prototype.append=function(t,e){t=bx(t),e=kx(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},_x.prototype.delete=function(t){delete this.map[bx(t)]},_x.prototype.get=function(t){return t=bx(t),this.has(t)?this.map[t]:null},_x.prototype.has=function(t){return this.map.hasOwnProperty(bx(t))},_x.prototype.set=function(t,e){this.map[bx(t)]=kx(e)},_x.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},_x.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),Mx(t)},_x.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),Mx(t)},_x.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),Mx(t)},mx&&(_x.prototype[Symbol.iterator]=_x.prototype.entries);var Nx=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function Ix(t,e){if(!(this instanceof Ix))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,i,n=(e=e||{}).body;if(t instanceof Ix){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new _x(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new _x(e.headers)),this.method=(r=e.method||this.method||"GET",i=r.toUpperCase(),Nx.indexOf(i)>-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in dx)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function Tx(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function Cx(t,e){if(!(this instanceof Cx))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.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=void 0===e.statusText?"":""+e.statusText,this.headers=new _x(e.headers),this.url=e.url||"",this._initBody(t)}Ix.prototype.clone=function(){return new Ix(this,{body:this._bodyInit})},Sx.call(Ix.prototype),Sx.call(Cx.prototype),Cx.prototype.clone=function(){return new Cx(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new _x(this.headers),url:this.url})},Cx.error=function(){var t=new Cx(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var zx=[301,302,303,307,308];Cx.redirect=function(t,e){if(-1===zx.indexOf(e))throw new RangeError("Invalid status code");return new Cx(null,{status:e,headers:{location:t}})};var Ox=dx.DOMException;try{new Ox}catch(Uk){Ox=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},Ox.prototype=Object.create(Error.prototype),Ox.prototype.constructor=Ox}function Rx(t,e){return new Promise((function(r,i){var n=new Ix(t,e);if(n.signal&&n.signal.aborted)return i(new Ox("Aborted","AbortError"));var o=new XMLHttpRequest;function a(){o.abort()}if(o.onload=function(){var t,e,i={statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new _x,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();try{e.append(i,n)}catch(t){console.warn("Response "+t.message)}}})),e)};0===n.url.indexOf("file://")&&(o.status<200||o.status>599)?i.status=200:i.status=o.status,i.url="responseURL"in o?o.responseURL:i.headers.get("X-Request-URL");var a="response"in o?o.response:o.responseText;setTimeout((function(){r(new Cx(a,i))}),0)},o.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request timed out"))}),0)},o.onabort=function(){setTimeout((function(){i(new Ox("Aborted","AbortError"))}),0)},o.open(n.method,function(t){try{return""===t&&dx.location.href?dx.location.href:t}catch(e){return t}}(n.url),!0),"include"===n.credentials?o.withCredentials=!0:"omit"===n.credentials&&(o.withCredentials=!1),"responseType"in o&&(px?o.responseType="blob":yx&&(o.responseType="arraybuffer")),e&&"object"==typeof e.headers&&!(e.headers instanceof _x||dx.Headers&&e.headers instanceof dx.Headers)){var s=[];Object.getOwnPropertyNames(e.headers).forEach((function(t){s.push(bx(t)),o.setRequestHeader(t,kx(e.headers[t]))})),n.headers.forEach((function(t,e){-1===s.indexOf(e)&&o.setRequestHeader(e,t)}))}else n.headers.forEach((function(t,e){o.setRequestHeader(e,t)}));n.signal&&(n.signal.addEventListener("abort",a),o.onreadystatechange=function(){4===o.readyState&&n.signal.removeEventListener("abort",a)}),o.send(void 0===n._bodyInit?null:n._bodyInit)}))}Rx.polyfill=!0,dx.fetch||(dx.fetch=Rx,dx.Headers=_x,dx.Request=Ix,dx.Response=Cx);var Px=self.fetch.bind(self);const Bx=(t,e,r=[])=>{const i=Object.getOwnPropertyDescriptors(e);for(let t of r)delete i[t];Object.defineProperties(t,i)},Dx=(t,e=[t])=>{const r=Object.getPrototypeOf(t);return null===r?e:Dx(r,[...e,r])},$x=(t,e,r=[])=>{var i;const n=null!==(i=((...t)=>{if(0===t.length)return;let e;const r=t.map((t=>Dx(t)));for(;r.every((t=>t.length>0));){const t=r.map((t=>t.pop())),i=t[0];if(!t.every((t=>t===i)))break;e=i}return e})(...t))&&void 0!==i?i:Object.prototype,o=Object.create(n),a=Dx(n);for(let e of t){let t=Dx(e);for(let e=t.length-1;e>=0;e--){let i=t[e];-1===a.indexOf(i)&&(Bx(o,i,["constructor",...r]),a.push(i))}}return o.constructor=e,o},Lx=t=>t.filter(((e,r)=>t.indexOf(e)==r)),Ux=new WeakMap,Fx=t=>Ux.get(t),qx=(t,e)=>{var r,i;const n=Lx([...Object.getOwnPropertyNames(t),...Object.getOwnPropertyNames(e)]),o={};for(let a of n)o[a]=Lx([...null!==(r=null==t?void 0:t[a])&&void 0!==r?r:[],...null!==(i=null==e?void 0:e[a])&&void 0!==i?i:[]]);return o},Vx=(t,e)=>{var r,i,n,o;return{property:qx(null!==(r=null==t?void 0:t.property)&&void 0!==r?r:{},null!==(i=null==e?void 0:e.property)&&void 0!==i?i:{}),method:qx(null!==(n=null==t?void 0:t.method)&&void 0!==n?n:{},null!==(o=null==e?void 0:e.method)&&void 0!==o?o:{})}},Hx=new Map,Gx=(...t)=>{const e=((...t)=>{var e;const r=new Set,i=new Set([...t]);for(;i.size>0;)for(let t of i){const n=[...Dx(t.prototype).map((t=>t.constructor)),...null!==(e=Fx(t))&&void 0!==e?e:[]].filter((t=>!r.has(t)));for(let t of n)i.add(t);r.add(t),i.delete(t)}return[...r]})(...t).map((t=>Hx.get(t))).filter((t=>!!t));return 0==e.length?{}:1==e.length?e[0]:e.reduce(((t,e)=>((t,e)=>{var r,i,n,o,a,s;return{class:Lx([...null!==(r=null==t?void 0:t.class)&&void 0!==r?r:[],...null!==(i=null==e?void 0:e.class)&&void 0!==i?i:[]]),static:Vx(null!==(n=null==t?void 0:t.static)&&void 0!==n?n:{},null!==(o=null==e?void 0:e.static)&&void 0!==o?o:{}),instance:Vx(null!==(a=null==t?void 0:t.instance)&&void 0!==a?a:{},null!==(s=null==e?void 0:e.instance)&&void 0!==s?s:{})}})(t,e)))};function Zx(...t){var e,r,i;const n=t.map((t=>t.prototype));function o(...e){for(const r of t)Bx(this,new r(...e))}o.prototype=$x(n,o),Object.setPrototypeOf(o,$x(t,null,["prototype"]));let a=o;{const n=Gx(...t);for(let t of null!==(e=null==n?void 0:n.class)&&void 0!==e?e:[]){const e=t(a);e&&(a=e)}Kx(null!==(r=null==n?void 0:n.static)&&void 0!==r?r:{},a),Kx(null!==(i=null==n?void 0:n.instance)&&void 0!==i?i:{},a.prototype)}var s,h;return s=a,h=t,Ux.set(s,h),a}const Kx=(t,e)=>{const r=t.property,i=t.method;if(r)for(let t in r)for(let i of r[t])i(e,t);if(i)for(let t in i)for(let r of i[t])r(e,t,Object.getOwnPropertyDescriptor(e,t))};var Jx=Object.defineProperty,Wx=Object.getOwnPropertyDescriptor,Yx=Object.getOwnPropertyNames,Qx=Object.prototype.hasOwnProperty,Xx=(t,e)=>{for(var r in e)Jx(t,r,{get:e[r],enumerable:!0})},tS=(t,e,r,i)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let n of Yx(e))Qx.call(t,n)||n===r||Jx(t,n,{get:()=>e[n],enumerable:!(i=Wx(e,n))||i.enumerable});return t},eS={};Xx(eS,{ADDR_BOUND:()=>LS,API_VERSION:()=>BS,BaseUrl:()=>HS,DEFAULT_GLOBAL_CONFIG:()=>nN,FeeMarginPercentage:()=>JS,HARDENING_4BYTES:()=>iN,HARDENING_BYTE:()=>rN,IS_BROWSER:()=>wS,MASK_250:()=>RS,MASK_31:()=>PS,MAX_STORAGE_ITEM_SIZE:()=>$S,NetworkName:()=>GS,OutsideExecutionCallerAny:()=>XS,PRIME:()=>DS,RANGE_FELT:()=>FS,RANGE_I128:()=>qS,RANGE_U128:()=>VS,RPC_DEFAULT_VERSION:()=>YS,RPC_NODES:()=>QS,SNIP9_V1_INTERFACE_ID:()=>tN,SNIP9_V2_INTERFACE_ID:()=>eN,SYSTEM_MESSAGES:()=>oN,StarknetChainId:()=>ZS,TEXT_TO_FELT_MAX_LEN:()=>zS,TRANSACTION_VERSION:()=>rS.ETransactionVersion,TransactionHashPrefix:()=>KS,UDC:()=>WS,ZERO:()=>OS});var rS={};Xx(rS,{JRPC:()=>iS,RPCSPEC06:()=>nS,RPCSPEC07:()=>dp});var iS={},nS={};Xx(nS,{EBlockTag:()=>dS,EDAMode:()=>mS,EDataAvailabilityMode:()=>fS,ESimulationFlag:()=>hS,ETransactionExecutionStatus:()=>cS,ETransactionFinalityStatus:()=>lS,ETransactionStatus:()=>uS,ETransactionType:()=>sS,ETransactionVersion:()=>pS,ETransactionVersion2:()=>gS,ETransactionVersion3:()=>yS,Errors:()=>oS,SPEC:()=>aS});var oS={},aS={},sS={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE",L1_HANDLER:"L1_HANDLER"},hS={SKIP_VALIDATE:"SKIP_VALIDATE",SKIP_FEE_CHARGE:"SKIP_FEE_CHARGE"},uS={RECEIVED:"RECEIVED",REJECTED:"REJECTED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},lS={ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},cS={SUCCEEDED:"SUCCEEDED",REVERTED:"REVERTED"},dS={PENDING:"pending",LATEST:"latest"},fS={L1:"L1",L2:"L2"},mS={L1:0,L2:1},pS={V0:"0x0",V1:"0x1",V2:"0x2",V3:"0x3",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002",F3:"0x100000000000000000000000000000003"},gS={V0:"0x0",V1:"0x1",V2:"0x2",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002"},yS={V3:"0x3",F3:"0x100000000000000000000000000000003"};((t,e,r)=>{tS(t,e,"default"),r&&tS(r,e,"default")})(rS,dp);Xx({},{IS_BROWSER:()=>wS,addHexPrefix:()=>jS,arrayBufferToString:()=>vS,atobUniversal:()=>MS,btoaUniversal:()=>_S,buf2hex:()=>ES,calcByteLength:()=>SS,concatenateArrayBuffer:()=>CS,padLeft:()=>xS,pascalToSnake:()=>TS,removeHexPrefix:()=>AS,sanitizeBytes:()=>NS,sanitizeHex:()=>IS,stringToArrayBuffer:()=>kS,utf8ToArray:()=>bS});var wS="undefined"!=typeof window;function vS(t){return new Uint8Array(t).reduce(((t,e)=>t+String.fromCharCode(e)),"")}function bS(t){return(new TextEncoder).encode(t)}function kS(t){return bS(t)}function MS(t){return zp.decode(t)}function _S(t){return zp.encode(new Uint8Array(t))}function ES(t){return t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),"")}function AS(t){return t.replace(/^0x/i,"")}function jS(t){return`0x${AS(t)}`}function xS(t,e,r="0"){return function(t,e,r,i="0"){const n=e-t.length;let o=t;if(n>0){const e=i.repeat(n);o=r?e+t:t+e}return o}(t,e,!0,r)}function SS(t,e=8){const{length:r}=t,i=r%e;return i?(r-i)/e*e+e:r}function NS(t,e=8,r="0"){return xS(t,SS(t,e),r)}function IS(t){const e=NS(AS(t),2);return e?jS(e):e}var TS=t=>/[a-z]/.test(t)?t.split(/(?=[A-Z])/).join("_").toUpperCase():t;function CS(t){const e=t.reduce(((t,e)=>t+e.byteLength),0),r=new Uint8Array(e);let i=0;return t.forEach((t=>{r.set(t,i),i+=t.byteLength})),r}var zS=31,OS=0n,RS=2n**250n-1n,PS=2n**31n-1n,BS=OS,DS=2n**251n+17n*2n**192n+1n,$S=256n,LS=2n**251n-$S,US=(t,e)=>({min:t,max:e}),FS=US(OS,DS-1n),qS=US(-(2n**127n),2n**127n-1n),VS=US(OS,2n**128n-1n),HS=(t=>(t.SN_MAIN="https://alpha-mainnet.starknet.io",t.SN_SEPOLIA="https://alpha-sepolia.starknet.io",t))(HS||{}),GS=(t=>(t.SN_MAIN="SN_MAIN",t.SN_SEPOLIA="SN_SEPOLIA",t))(GS||{}),ZS=(t=>(t.SN_MAIN="0x534e5f4d41494e",t.SN_SEPOLIA="0x534e5f5345504f4c4941",t))(ZS||{}),KS=(t=>(t.DECLARE="0x6465636c617265",t.DEPLOY="0x6465706c6f79",t.DEPLOY_ACCOUNT="0x6465706c6f795f6163636f756e74",t.INVOKE="0x696e766f6b65",t.L1_HANDLER="0x6c315f68616e646c6572",t))(KS||{}),JS=(t=>(t[t.L1_BOUND_MAX_AMOUNT=50]="L1_BOUND_MAX_AMOUNT",t[t.L1_BOUND_MAX_PRICE_PER_UNIT=50]="L1_BOUND_MAX_PRICE_PER_UNIT",t[t.MAX_FEE=50]="MAX_FEE",t))(JS||{}),WS={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},YS="v0_7",QS={SN_MAIN:[`https://starknet-mainnet.public.blastapi.io/rpc/${YS}`,`https://free-rpc.nethermind.io/mainnet-juno/${YS}`],SN_SEPOLIA:[`https://starknet-sepolia.public.blastapi.io/rpc/${YS}`,`https://free-rpc.nethermind.io/sepolia-juno/${YS}`]},XS="0x414e595f43414c4c4552",tN="0x68cfd18b92d1907b8ba3cc324900277f5a3622099431ea85dd8089255e4181",eN="0x1d1144bb2138366ff28d8e9ab57456b1d332ac42196230c3a602003c89872",rN=128,iN=2147483648n,nN={legacyMode:!1,logLevel:"INFO",accountTxVersion:rS.ETransactionVersion.V2},oN={legacyTxWarningMessage:"You are using a deprecated transaction version (V0,V1,V2)!\nUpdate to the latest V3 transactions!"},aN={};Xx(aN,{RpcChannel:()=>mz});Xx({},{parse:()=>hN,parseAlwaysAsBig:()=>uN,stringify:()=>lN,stringifyAlwaysAsBig:()=>cN});var sN=t=>{if(!Lp(t))return parseFloat(t);const e=parseInt(t,10);return Number.isSafeInteger(e)?e:BigInt(t)},hN=t=>rg(String(t),void 0,sN),uN=t=>rg(String(t),void 0,Xp),lN=(t,e,r,i)=>Rg(t,e,r,i),cN=lN,dN={FAILED_TO_RECEIVE_TXN:1,NO_TRACE_AVAILABLE:10,CONTRACT_NOT_FOUND:20,BLOCK_NOT_FOUND:24,INVALID_TXN_INDEX:27,CLASS_HASH_NOT_FOUND:28,TXN_HASH_NOT_FOUND:29,PAGE_SIZE_TOO_BIG:31,NO_BLOCKS:32,INVALID_CONTINUATION_TOKEN:33,TOO_MANY_KEYS_IN_FILTER:34,CONTRACT_ERROR:40,TRANSACTION_EXECUTION_ERROR:41,CLASS_ALREADY_DECLARED:51,INVALID_TRANSACTION_NONCE:52,INSUFFICIENT_MAX_FEE:53,INSUFFICIENT_ACCOUNT_BALANCE:54,VALIDATION_FAILURE:55,COMPILATION_FAILED:56,CONTRACT_CLASS_SIZE_IS_TOO_LARGE:57,NON_ACCOUNT:58,DUPLICATE_TX:59,COMPILED_CLASS_HASH_MISMATCH:60,UNSUPPORTED_TX_VERSION:61,UNSUPPORTED_CONTRACT_CLASS_VERSION:62,UNEXPECTED_ERROR:63};var fN=class extends Error{name;constructor(t){super(t),Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0}),function(t,e){const{setPrototypeOf:r}=Object;r?r(t,e):t.__proto__=e}(this,new.target.prototype),function(t,e=t.constructor){const{captureStackTrace:r}=Error;r&&r(t,e)}(this)}},mN=class extends fN{},pN=class extends mN{constructor(t,e,r){super(`RPC: ${e} with params ${lN(r,null,2)}\n\n ${t.code}: ${t.message}: ${lN(t.data)}`),this.baseError=t,this.request={method:e,params:r}}request;get code(){return this.baseError.code}isType(t){return dN[t]===this.code}};Xx({},{BlockStatus:()=>kN,BlockTag:()=>MN,ETH_ADDRESS:()=>jN,EntryPointType:()=>gN,Literal:()=>AN,NON_ZERO_PREFIX:()=>xN,OutsideExecutionTypesV1:()=>SN,OutsideExecutionTypesV2:()=>NN,OutsideExecutionVersion:()=>IN,RPC:()=>rS,TransactionExecutionStatus:()=>bN,TransactionFinalityStatus:()=>vN,TransactionStatus:()=>wN,TransactionType:()=>yN,TypedDataRevision:()=>lp,Uint:()=>EN,ValidateType:()=>_N});var gN={EXTERNAL:"EXTERNAL",L1_HANDLER:"L1_HANDLER",CONSTRUCTOR:"CONSTRUCTOR"},yN={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE_FUNCTION"},wN={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",REJECTED:"REJECTED",REVERTED:"REVERTED"},vN={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},bN={REJECTED:"REJECTED",REVERTED:"REVERTED",SUCCEEDED:"SUCCEEDED"},kN={PENDING:"PENDING",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",REJECTED:"REJECTED"},MN={PENDING:"pending",LATEST:"latest"},_N={DEPLOY:"DEPLOY",CALL:"CALL",INVOKE:"INVOKE"},EN={u8:"core::integer::u8",u16:"core::integer::u16",u32:"core::integer::u32",u64:"core::integer::u64",u128:"core::integer::u128",u256:"core::integer::u256",u512:"core::integer::u512"},AN={ClassHash:"core::starknet::class_hash::ClassHash",ContractAddress:"core::starknet::contract_address::ContractAddress",Secp256k1Point:"core::starknet::secp256k1::Secp256k1Point",U96:"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"},jN="core::starknet::eth_address::EthAddress",xN="core::zeroable::NonZero::",SN={StarkNetDomain:[{name:"name",type:"felt"},{name:"version",type:"felt"},{name:"chainId",type:"felt"}],OutsideExecution:[{name:"caller",type:"felt"},{name:"nonce",type:"felt"},{name:"execute_after",type:"felt"},{name:"execute_before",type:"felt"},{name:"calls_len",type:"felt"},{name:"calls",type:"OutsideCall*"}],OutsideCall:[{name:"to",type:"felt"},{name:"selector",type:"felt"},{name:"calldata_len",type:"felt"},{name:"calldata",type:"felt*"}]},NN={StarknetDomain:[{name:"name",type:"shortstring"},{name:"version",type:"shortstring"},{name:"chainId",type:"shortstring"},{name:"revision",type:"shortstring"}],OutsideExecution:[{name:"Caller",type:"ContractAddress"},{name:"Nonce",type:"felt"},{name:"Execute After",type:"u128"},{name:"Execute Before",type:"u128"},{name:"Calls",type:"Call*"}],Call:[{name:"To",type:"ContractAddress"},{name:"Selector",type:"selector"},{name:"Calldata",type:"felt*"}]},IN=(t=>(t.UNSUPPORTED="0",t.V1="1",t.V2="2",t))(IN||{}),TN=class{nodeUrl;headers;interval;requestId=0;pendingRequests={};batchPromises={};delayTimer;delayPromise;delayPromiseResolve;baseFetch;constructor(t){this.nodeUrl=t.nodeUrl,this.headers=t.headers,this.interval=t.interval,this.baseFetch=t.baseFetch}async wait(){return this.delayPromise&&this.delayPromiseResolve||(this.delayPromise=new Promise((t=>{this.delayPromiseResolve=t}))),this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=void 0),this.delayTimer=setTimeout((()=>{this.delayPromiseResolve&&(this.delayPromiseResolve(),this.delayPromise=void 0,this.delayPromiseResolve=void 0)}),this.interval),this.delayPromise}addPendingRequest(t,e,r){const i={id:r??`batched_${this.requestId+=1}`,jsonrpc:"2.0",method:t,params:e??void 0};return this.pendingRequests[i.id]=i,i.id}async sendBatch(t){return(await this.baseFetch(this.nodeUrl,{method:"POST",body:lN(t),headers:this.headers})).json()}async fetch(t,e,r){const i=this.addPendingRequest(t,e,r);await this.wait();const n=this.pendingRequests;if(this.pendingRequests={},!this.batchPromises[i]){const t=this.sendBatch(Object.values(n));Object.keys(n).forEach((e=>{this.batchPromises[e]=t}))}const o=await this.batchPromises[i];delete this.batchPromises[i];const a=o.find((t=>t.id===i));if(!a)throw new Error(`Couldn't find the result for the request. Method: ${t}`);return a}};function CN(t,e){if(!t)throw new Error(e||"Assertion failure")}var zN={};Xx(zN,{addPercent:()=>iI,assertInRange:()=>KN,bigNumberishArrayToDecimalStringArray:()=>JN,bigNumberishArrayToHexadecimalStringArray:()=>WN,cleanHex:()=>ZN,getDecimalString:()=>QN,getHexString:()=>XN,getHexStringArray:()=>tI,hexToBytes:()=>rI,hexToDecimalString:()=>GN,isBigNumberish:()=>oI,isHex:()=>LN,isStringWholeNumber:()=>YN,stringToSha256ToArrayBuff4:()=>nI,toBigInt:()=>UN,toCairoBool:()=>eI,toHex:()=>FN,toHex64:()=>HN,toHexString:()=>qN,toStorageKey:()=>VN});var ON=t=>void 0===t||void 0===t;function RN(t){return"number"==typeof t}function PN(t){return"boolean"==typeof t}function BN(t){return"bigint"==typeof t}function DN(t){return"string"==typeof t}function $N(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function LN(t){return/^0x[0-9a-f]*$/i.test(t)}function UN(t){return BigInt(t)}function FN(t){return jS(UN(t).toString(16))}var qN=FN;function VN(t){return jS(UN(t).toString(16).padStart(64,"0"))}function HN(t){const e=jS(UN(t).toString(16).padStart(64,"0"));if(66!==e.length)throw TypeError("number is too big for hex 0x(64) representation");return e}function GN(t){return BigInt(jS(t)).toString(10)}function ZN(t){return t.toLowerCase().replace(/^(0x)0+/,"$1")}function KN(t,e,r,i=""){const n=""===i?"invalid length":`invalid ${i} length`,o=BigInt(t),a=BigInt(e),s=BigInt(r);CN(o>=a&&o<=s,`Message not signable, ${n}.`)}function JN(t){return t.map((t=>UN(t).toString(10)))}function WN(t){return t.map((t=>FN(t)))}function YN(t){return/^\d+$/.test(t)}function QN(t){if(LN(t))return GN(t);if(YN(t))return t;throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function XN(t){if(LN(t))return t;if(YN(t))return qN(t);throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function tI(t){return t.map(XN)}function eI(t){return(+t).toString()}function rI(t){if(!LN(t))throw new Error(`${t} needs to be a hex-string`);let e=AS(t);return e.length%2!=0&&(e=`0${e}`),Xg(e)}function iI(t,e){const r=BigInt(t);return r+r*BigInt(e)/100n}function nI(t){var e;return rI(FN((e=BigInt(jS(ES(Dy(t)))),Number(e&PS))))}function oI(t){return RN(t)||BN(t)||DN(t)&&(LN(t)||YN(t))}function aI(t){const e=AS(FN(BigInt(t))),r=e.length%2==0?e:`0${e}`;return jS(Gv(rI(jS(r))).toString(16))}function sI(t){const e=BigInt(function(t){return jS(Gv(bS(t)).toString(16))}(t));return e&RS}function hI(t){return FN(sI(t))}function uI(t){return RN(t)||BN(t)?FN(t):LN(t)?t:YN(t)?FN(t):hI(t)}function lI(t){const e=jS(t.reduce(((t,e)=>t+AS(FN(e)).padStart(64,"0")),""));return jS(qg(bb(rI(e))))}function cI(t,e,r,i,n){return lI([t,e,n,r,i.length,...i])}Xx({},{getL2MessageHash:()=>cI,getSelector:()=>uI,getSelectorFromName:()=>hI,keccakBn:()=>aI,solidityUint256PackedKeccak256:()=>lI,starknetKeccak:()=>sI});var dI={};function fI(t){return/^[\x00-\x7F]*$/.test(t)}function mI(t){return t.length<=zS}function pI(t){return/^[0-9]*$/i.test(t)}function gI(t){return DN(t)&&!LN(t)&&!YN(t)}Xx(dI,{decodeShortString:()=>kI,encodeShortString:()=>bI,isASCII:()=>fI,isDecimalString:()=>pI,isLongText:()=>wI,isShortString:()=>mI,isShortText:()=>yI,isText:()=>gI,splitLongString:()=>vI});var yI=t=>gI(t)&&mI(t),wI=t=>gI(t)&&!mI(t);function vI(t){const e=RegExp(`[^]{1,${zS}}`,"g");return t.match(e)||[]}function bI(t){if(!fI(t))throw new Error(`${t} is not an ASCII string`);if(!mI(t))throw new Error(`${t} is too long`);return jS(t.replace(/./g,(t=>t.charCodeAt(0).toString(16))))}function kI(t){if(!fI(t))throw new Error(`${t} is not an ASCII string`);if(LN(t))return AS(t).replace(/.{2}/g,(t=>String.fromCharCode(parseInt(t,16))));if(pI(t))return kI("0X".concat(BigInt(t).toString(16)));throw new Error(`${t} is not Hex or decimal`)}function MI(t){const e=0n===BigInt(t.pending_word)?"":kI(FN(t.pending_word));return t.data.reduce(((t,e)=>t+(0n===BigInt(e)?"":kI(FN(e)))),"")+e}function _I(t){const e=vI(t),r=e[e.length-1],i=e.map(bI),[n,o]=void 0===r||31===r.length?["0x00",0]:[i.pop(),r.length];return{data:0===i.length?[]:i,pending_word:n,pending_word_len:o}}Xx({},{byteArrayFromString:()=>_I,stringFromByteArray:()=>MI});var EI={};function AI(t){if(BN(t)||Number.isInteger(t))return t.toString();if(DN(t)){if(LN(t))return BigInt(t).toString();if(gI(t)){if(!mI(t))throw new Error(`${t} is a long string > 31 chars. Please split it into an array of short strings.`);return BigInt(bI(t)).toString()}if(YN(t))return t}if(PN(t))return""+ +t;throw new Error(`${t} can't be computed by felt()`)}Xx(EI,{felt:()=>cT,getAbiContractVersion:()=>sT,getArrayType:()=>nT,isCairo1Abi:()=>oT,isCairo1Type:()=>iT,isLen:()=>DI,isTypeArray:()=>LI,isTypeBool:()=>WI,isTypeByteArray:()=>tT,isTypeBytes31:()=>XI,isTypeContractAddress:()=>YI,isTypeEnum:()=>VI,isTypeEthAddress:()=>QI,isTypeFelt:()=>$I,isTypeLiteral:()=>JI,isTypeNamedTuple:()=>FI,isTypeNonZero:()=>aT,isTypeOption:()=>HI,isTypeResult:()=>GI,isTypeSecp256k1Point:()=>rT,isTypeStruct:()=>qI,isTypeTuple:()=>UI,isTypeU96:()=>eT,isTypeUint:()=>ZI,isTypeUint256:()=>KI,tuple:()=>lT,uint256:()=>hT,uint512:()=>uT});var jI=(1n<<128n)-1n,xI=(1n<<256n)-1n,SI=0n,NI=340282366920938463463374607431768211455n,II=340282366920938463463374607431768211455n,TI=0n,CI=0n,zI=class t{low;high;static abiSelector="core::integer::u256";constructor(...e){if("object"==typeof e[0]&&1===e.length&&"low"in e[0]&&"high"in e[0]){const r=t.validateProps(e[0].low,e[0].high);this.low=r.low,this.high=r.high}else if(1===e.length){const r=t.validate(e[0]);this.low=r&jI,this.high=r>>128n}else{if(2!==e.length)throw Error("Incorrect constructor parameters");{const r=t.validateProps(e[0],e[1]);this.low=r.low,this.high=r.high}}}static validate(t){const e=BigInt(t);if(e<SI)throw Error("bigNumberish is smaller than UINT_256_MIN");if(e>xI)throw new Error("bigNumberish is bigger than UINT_256_MAX");return e}static validateProps(t,e){const r=BigInt(t),i=BigInt(e);if(r<TI||r>NI)throw new Error("low is out of range UINT_256_LOW_MIN - UINT_256_LOW_MAX");if(i<CI||i>II)throw new Error("high is out of range UINT_256_HIGH_MIN - UINT_256_HIGH_MAX");return{low:r,high:i}}static is(e){try{t.validate(e)}catch(t){return!1}return!0}static isAbiType(e){return e===t.abiSelector}toBigInt(){return(this.high<<128n)+this.low}toUint256HexString(){return{low:jS(this.low.toString(16)),high:jS(this.high.toString(16))}}toUint256DecimalString(){return{low:this.low.toString(10),high:this.high.toString(10)}}toApiRequest(){return[AI(this.low),AI(this.high)]}},OI=(1n<<512n)-1n,RI=0n,PI=0n,BI=class t{limb0;limb1;limb2;limb3;static abiSelector="core::integer::u512";constructor(...e){if("object"==typeof e[0]&&1===e.length&&"limb0"in e[0]&&"limb1"in e[0]&&"limb2"in e[0]&&"limb3"in e[0]){const r=t.validateProps(e[0].limb0,e[0].limb1,e[0].limb2,e[0].limb3);this.limb0=r.limb0,this.limb1=r.limb1,this.limb2=r.limb2,this.limb3=r.limb3}else if(1===e.length){const r=t.validate(e[0]);this.limb0=r&jI,this.limb1=(r&jI<<128n)>>128n,this.limb2=(r&jI<<256n)>>256n,this.limb3=r>>384n}else{if(4!==e.length)throw Error("Incorrect Uint512 constructor parameters");{const r=t.validateProps(e[0],e[1],e[2],e[3]);this.limb0=r.limb0,this.limb1=r.limb1,this.limb2=r.limb2,this.limb3=r.limb3}}}static validate(t){const e=BigInt(t);if(e<RI)throw Error("bigNumberish is smaller than UINT_512_MIN.");if(e>OI)throw Error("bigNumberish is bigger than UINT_512_MAX.");return e}static validateProps(t,e,r,i){const n=BigInt(t),o=BigInt(e),a=BigInt(r),s=BigInt(i);return[n,o,a,s].forEach(((t,e)=>{if(t<PI||t>jI)throw Error(`limb${e} is not in the range of a u128 number`)})),{limb0:n,limb1:o,limb2:a,limb3:s}}static is(e){try{t.validate(e)}catch(t){return!1}return!0}static isAbiType(e){return e===t.abiSelector}toBigInt(){return(this.limb3<<384n)+(this.limb2<<256n)+(this.limb1<<128n)+this.limb0}toUint512HexString(){return{limb0:jS(this.limb0.toString(16)),limb1:jS(this.limb1.toString(16)),limb2:jS(this.limb2.toString(16)),limb3:jS(this.limb3.toString(16))}}toUint512DecimalString(){return{limb0:this.limb0.toString(10),limb1:this.limb1.toString(10),limb2:this.limb2.toString(10),limb3:this.limb3.toString(10)}}toApiRequest(){return[AI(this.limb0),AI(this.limb1),AI(this.limb2),AI(this.limb3)]}},DI=t=>/_len$/.test(t),$I=t=>"felt"===t||"core::felt252"===t,LI=t=>/\*/.test(t)||t.startsWith("core::array::Array::")||t.startsWith("core::array::Span::"),UI=t=>/^\(.*\)$/i.test(t),FI=t=>/\(.*\)/i.test(t)&&t.includes(":"),qI=(t,e)=>t in e,VI=(t,e)=>t in e,HI=t=>t.startsWith("core::option::Option::"),GI=t=>t.startsWith("core::result::Result::"),ZI=t=>Object.values(EN).includes(t),KI=t=>zI.isAbiType(t),JI=t=>Object.values(AN).includes(t),WI=t=>"core::bool"===t,YI=t=>t===AN.ContractAddress,QI=t=>t===jN,XI=t=>"core::bytes_31::bytes31"===t,tT=t=>"core::byte_array::ByteArray"===t,eT=t=>"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"===t,rT=t=>t===AN.Secp256k1Point,iT=t=>t.includes("::"),nT=t=>iT(t)?t.substring(t.indexOf("<")+1,t.lastIndexOf(">")):t.replace("*","");function oT(t){const{cairo:e}=sT(t);if(void 0===e)throw Error("Unable to determine Cairo version");return"1"===e}function aT(t){return t.startsWith(xN)}function sT(t){if(t.find((t=>"interface"===t.type)))return{cairo:"1",compiler:"2"};const e=t.find((t=>("function"===t.type||"constructor"===t.type)&&(t.inputs.length||t.outputs.length)));if(!e)return{cairo:void 0,compiler:void 0};const r=e.inputs.length?e.inputs:e.outputs;return iT(r[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}}var hT=t=>new zI(t).toUint256DecimalString(),uT=t=>new BI(t).toUint512DecimalString(),lT=(...t)=>({...t});function cT(t){return AI(t)}var dT=class{variant;constructor(t){const e=Object.values(t);if(0===e.length)throw new Error("This Enum must have at least 1 variant");if(1!==e.filter((t=>!ON(t))).length)throw new Error("This Enum must have exactly one active variant");this.variant=t}unwrap(){return Object.values(this.variant).find((t=>!ON(t)))}activeVariant(){const t=Object.entries(this.variant).find((t=>!ON(t[1])));return ON(t)?"":t[0]}},fT={Some:0,None:1},mT=class{Some;None;constructor(t,e){if(!(t in Object.values(fT)))throw new Error("Wrong variant! It should be CairoOptionVariant.Some or .None.");if(t===fT.Some){if(ON(e))throw new Error('The creation of a Cairo Option with "Some" variant needs a content as input.');this.Some=e,this.None=void 0}else this.Some=void 0,this.None=!0}unwrap(){return this.None?void 0:this.Some}isSome(){return!ON(this.Some)}isNone(){return!0===this.None}},pT={Ok:0,Err:1},gT=class{Ok;Err;constructor(t,e){if(!(t in Object.values(pT)))throw new Error("Wrong variant! It should be CairoResultVariant.Ok or .Err.");t===pT.Ok?(this.Ok=e,this.Err=void 0):(this.Ok=void 0,this.Err=e)}unwrap(){if(!ON(this.Ok))return this.Ok;if(!ON(this.Err))return this.Err;throw new Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!ON(this.Ok)}isErr(){return!ON(this.Err)}},yT=(t,e,r)=>{if(!BN(t[r]))throw new Error(`Data and formatter mismatch on ${r}:${e[r]}, expected response data ${r}:${t[r]} to be BN instead it is ${typeof t[r]}`)},wT=(t,e,r)=>{throw new Error(`Unhandled formatter type on ${r}:${e[r]} for data ${r}:${t[r]}`)};function vT(t,e,r){return Object.entries(t).reduce(((i,[n,o])=>{const a=r??e[n];if(!(n in e)&&!r)return i[n]=o,i;if("string"===a){if(Array.isArray(t[n])){const e=vT(t[n],t[n].map((t=>a)));return i[n]=Object.values(e).join(""),i}return yT(t,e,n),i[n]=kI(o),i}if("number"===a)return yT(t,e,n),i[n]=Number(o),i;if("function"==typeof a)return i[n]=a(o),i;if(Array.isArray(a)){const e=vT(t[n],a,a[0]);return i[n]=Object.values(e),i}return $N(a)?(i[n]=vT(t[n],a),i):(wT(t,e,n),i)}),{})}function bT(t){const e=function(t){return t.find((t=>"interface"===t.type))?2:oT(t)?1:0}(t);if(0===e||1===e)return new class{abi;constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.reduce(((t,e)=>DI(e.name)?t:t+1),0)}getMethod(t){return this.abi.find((e=>e.name===t))}getLegacyFormat(){return this.abi}}(t);if(2===e)return new class{abi;constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.length}getMethod(t){return this.abi.find((t=>"interface"===t.type))?.items?.find((e=>e.name===t))}getLegacyFormat(){return this.abi.flatMap((t=>"interface"===t.type?t.items:t))}}(t);throw Error(`Unsupported ABI version ${e}`)}function kT(t,e,r){return"constructor"===t&&!r&&!e.length}function MT(t,e,r){for(let i=0,n=0;i<t.length;i++)if(t[i]===e)n++;else if(t[i]===r&&0==--n)return i;return Number.POSITIVE_INFINITY}function _T(t){return iT(t)?function(t){const e=t.slice(1,-1),r=[];let i,n=0;for(;n<e.length;){switch(!0){case"("===e[n]:i=n+MT(e.slice(n),"(",")")+1;break;case e.startsWith("core::result::Result::<",n)||e.startsWith("core::array::Array::<",n)||e.startsWith("core::option::Option::<",n):i=n+MT(e.slice(n),"<",">")+1;break;default:{const t=e.indexOf(",",n);i=-1!==t?t:Number.POSITIVE_INFINITY}}r.push(e.slice(n,i)),n=i+2}return r}(t):function(t){const e=t.replace(/\s/g,"").slice(1,-1),{subTuple:r,result:i}=function(t){if(!t.includes("("))return{subTuple:[],result:t};const e=[];let r="",i=0;for(;i<t.length;){if("("===t[i]){let n=1;const o=i;for(i++;n;)")"===t[i]&&n--,"("===t[i]&&n++,i++;e.push(t.substring(o,i)),r+=" ",i--}else r+=t[i];i++}return{subTuple:e,result:r}}(e);let n=i.split(",").map((t=>r.length?t.replace(" ",r.shift()):t));return FI(t)&&(n=n.reduce(((t,e)=>t.concat(function(t){const e=t.substring(0,t.indexOf(":"));return{name:e,type:t.substring(e.length+":".length)}}(e))),[])),n}(t)}var ET=class t{content;arrayType;constructor(e,r){CN(t.isTypeFixedArray(r),`The type ${r} is not a Cairo fixed array. Needs [type; length].`);try{t.getFixedArrayType(r)}catch{throw new Error(`The type ${r} do not includes any content type. Needs [type; length].`)}try{t.getFixedArraySize(r)}catch{throw new Error(`The type ${r} type do not includes any length. Needs [type; length].`)}CN(t.getFixedArraySize(r)===e.length,`The ABI type ${r} is expecting ${t.getFixedArraySize(r)} items. ${e.length} items provided.`),this.content=e,this.arrayType=r}static getFixedArraySize(t){const e=t.match(/(?<=; )\d+(?=\])/);if(null===e)throw new Error(`ABI type ${t} do not includes a valid number after ';' character.`);return Number(e[0])}getFixedArraySize(){return t.getFixedArraySize(this.arrayType)}static getFixedArrayType=t=>{const e=t.match(/(?<=\[).+(?=;)/);if(null===e)throw new Error(`ABI type ${t} do not includes a valid type of data.`);return e[0]};getFixedArrayType(){return t.getFixedArrayType(this.arrayType)}static compile(t){return t.reduce(((t,e,r)=>(t[r]=e,t)),{})}compile(){return t.compile(this.content)}static isTypeFixedArray(t){return/^\[.*;\s.*\]$/.test(t)&&/(?<=\[).+(?=;)/.test(t)&&/(?<=; )\d+(?=\])/.test(t)}};function AT(t,e,r,i){const n=(t,e)=>{if(ET.isTypeFixedArray(e))return function(t,e){const r=ET.getFixedArrayType(e),i=ET.getFixedArraySize(e);if(Array.isArray(t)){if(i!==t.length)throw new Error(`ABI type ${e}: array provided do not includes ${i} items. ${t.length} items provided.`);return t.map((t=>n(t,r)))}if(i!==Object.keys(t).length)throw new Error(`ABI type ${e}: object provided do not includes ${i} properties. ${Object.keys(t).length} items provided.`);return n(t,r)}(t,e);if(LI(e))return function(t,e){const r=nT(e);if(DN(t))return t;return t.map((t=>n(t,r)))}(t,e);if(VI(e,i)){const r=i[e];return a(t,r)}if(UI(e))return function(t,e){const r=_T(e).reduce(((e,r,i)=>{const o=Object.keys(t),a=r=>Object.defineProperty(e,i.toString(),{enumerable:!0,value:r??t[o[i]]}),s=r?.type?r.type:r;return a(n(t[o[i]],s)),e}),{});return r}(t,e);if(QI(e))return t;if(aT(e))return t;if(tT(e))return t;if(eT(e))return t;if(rT(e))return t;if(zI.isAbiType(e)){const r=t;if("object"!=typeof r)return r;if(!("low"in r)||!("high"in r))throw function(t){return Error(`Your object includes the property : ${t}, containing an Uint256 object without the 'low' and 'high' keys.`)}(e);return{low:r.low,high:r.high}}if(BI.isAbiType(e)){const r=t;if("object"!=typeof r)return r;if(!["limb0","limb1","limb2","limb3"].every((t=>t in r)))throw function(t){return Error(`Your object includes the property : ${t}, containing an Uint512 object without the 'limb0' to 'limb3' keys.`)}(e);return{limb0:r.limb0,limb1:r.limb1,limb2:r.limb2,limb3:r.limb3}}if(qI(e,r)){const i=r[e].members;return o(t,i)}return t},o=(t,e)=>e.reduce(((e,r)=>{if("undefined"===t[r.name]&&(iT(r.type)||!DI(r.name)))throw Error(`Your object needs a property with key : ${r.name} .`);var i;return i=n(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:i??t[r.name]}),e}),{});const a=(t,e)=>{if(GI(e.name)){const r=t,i=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(",")),o=e.name.substring(e.name.indexOf(",")+1,e.name.lastIndexOf(">"));return r.isOk()?new gT(pT.Ok,n(t.unwrap(),i)):new gT(pT.Err,n(t.unwrap(),o))}if(HI(e.name)){const r=t,i=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(">"));return r.isSome()?new mT(fT.Some,n(r.unwrap(),i)):new mT(fT.None,{})}const r=t,i=Object.entries(r.variant).map((t=>{if(ON(t[1]))return t;const i=e.type.substring(e.type.lastIndexOf("<")+1,e.type.lastIndexOf(">"));return"()"===i?t:[t[0],n(r.unwrap(),i)]}));return new dT(Object.fromEntries(i))};return e.reduce(((e,r)=>{return DI(r.name)&&!iT(r.type)||(i=n(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:i})),e;var i}),{})}function jT(t,e){switch(!0){case zI.isAbiType(t):return new zI(e).toApiRequest();case BI.isAbiType(t):return new BI(e).toApiRequest();case XI(t):return bI(e.toString());case rT(t):{const t=AS(FN(e)).padStart(128,"0"),r=hT(jS(t.slice(-64))),i=hT(jS(t.slice(0,-64)));return[cT(i.low),cT(i.high),cT(r.low),cT(r.high)]}default:return cT(e)}}function xT(t,e,r,i){if(void 0===t)throw Error(`Missing parameter for type ${e}`);if(ET.isTypeFixedArray(e)){const n=ET.getFixedArrayType(e);let o=[];if(Array.isArray(t)){o=new ET(t,e).content}else{if("object"!=typeof t)throw new Error(`ABI type ${e}: not an Array representing a cairo.fixedArray() provided.`);o=Object.values(t),CN(o.length===ET.getFixedArraySize(e),`ABI type ${e}: object provided do not includes ${ET.getFixedArraySize(e)} items. ${o.length} items provided.`)}return o.reduce(((t,e)=>t.concat(xT(e,n,r,i))),[])}if(Array.isArray(t)){const n=[];n.push(cT(t.length));const o=nT(e);return t.reduce(((t,e)=>t.concat(xT(e,o,r,i))),n)}if(r[e]&&r[e].members.length){if(zI.isAbiType(e))return new zI(t).toApiRequest();if(BI.isAbiType(e))return new BI(t).toApiRequest();if(QI(e))return jT(e,t);if(tT(e))return function(t){const e=_I(t);return[e.data.length.toString(),...e.data.map((t=>t.toString())),e.pending_word.toString(),e.pending_word_len.toString()]}(t);const{members:n}=r[e],o=t;return n.reduce(((t,e)=>t.concat(xT(o[e.name],e.type,r,i))),[])}if(UI(e)){const n=function(t,e){const r=_T(e),i=Object.values(t);if(i.length!==r.length)throw Error(`ParseTuple: provided and expected abi tuple size do not match.\n provided: ${i}\n expected: ${r}`);return r.map(((t,e)=>({element:i[e],type:t.type??t})))}(t,e);return n.reduce(((t,e)=>{const n=xT(e.element,e.type,r,i);return t.concat(n)}),[])}if(zI.isAbiType(e))return new zI(t).toApiRequest();if(BI.isAbiType(e))return new BI(t).toApiRequest();if(VI(e,i)){const{variants:n}=i[e];if(HI(e)){const e=t;if(e.isSome()){const t=n.find((t=>"Some"===t.name));if(ON(t))throw Error("Error in abi : Option has no 'Some' variant.");const o=t.type;if("()"===o)return fT.Some.toString();const a=xT(e.unwrap(),o,r,i);return Array.isArray(a)?[fT.Some.toString(),...a]:[fT.Some.toString(),a]}return fT.None.toString()}if(GI(e)){const e=t;if(e.isOk()){const t=n.find((t=>"Ok"===t.name));if(ON(t))throw Error("Error in abi : Result has no 'Ok' variant.");const o=t.type;if("()"===o)return pT.Ok.toString();const a=xT(e.unwrap(),o,r,i);return Array.isArray(a)?[pT.Ok.toString(),...a]:[pT.Ok.toString(),a]}const o=n.find((t=>"Err"===t.name));if(ON(o))throw Error("Error in abi : Result has no 'Err' variant.");const a=o.type;if("()"===a)return pT.Err.toString();const s=xT(e.unwrap(),a,r,i);return Array.isArray(s)?[pT.Err.toString(),...s]:[pT.Err.toString(),s]}const o=t,a=o.activeVariant(),s=n.find((t=>t.name===a));if(ON(s))throw Error(`Not find in abi : Enum has no '${a}' variant.`);const h=s.type,u=n.findIndex((t=>t.name===a));if("()"===h)return u.toString();const l=xT(o.unwrap(),h,r,i);return Array.isArray(l)?[u.toString(),...l]:[u.toString(),l]}if(aT(e))return jT(nT(e),t);if("object"==typeof t)throw Error(`Parameter ${t} do not align with abi parameter ${e}`);return jT(e,t)}function ST(t,e){let r;switch(!0){case WI(t):return r=e.next().value,Boolean(BigInt(r));case zI.isAbiType(t):const i=e.next().value,n=e.next().value;return new zI(i,n).toBigInt();case BI.isAbiType(t):const o=e.next().value,a=e.next().value,s=e.next().value,h=e.next().value;return new BI(o,a,s,h).toBigInt();case QI(t):return r=e.next().value,BigInt(r);case XI(t):return r=e.next().value,kI(r);case rT(t):const u=AS(e.next().value).padStart(32,"0"),l=AS(e.next().value).padStart(32,"0"),c=AS(e.next().value).padStart(32,"0"),d=AS(e.next().value).padStart(32,"0");return BigInt(jS(l+u+d+c));default:return r=e.next().value,BigInt(r)}}function NT(t,e,r,i){if("()"===e.type)return{};if(zI.isAbiType(e.type)){const e=t.next().value,r=t.next().value;return new zI(e,r).toBigInt()}if(BI.isAbiType(e.type)){const e=t.next().value,r=t.next().value,i=t.next().value,n=t.next().value;return new BI(e,r,i,n).toBigInt()}if(tT(e.type)){const e=[],r=BigInt(t.next().value);for(;e.length<r;)e.push(FN(t.next().value));return MI({data:e,pending_word:FN(t.next().value),pending_word_len:BigInt(t.next().value)})}if(ET.isTypeFixedArray(e.type)){const n=[],o={name:"",type:ET.getFixedArrayType(e.type)},a=ET.getFixedArraySize(e.type);for(;n.length<a;)n.push(NT(t,o,r,i));return n}if(LI(e.type)){const n=[],o={name:"",type:nT(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(NT(t,o,r,i));return n}if(aT(e.type)){const n={name:"",type:nT(e.type)};return NT(t,n,r,i)}if(r&&e.type in r&&r[e.type])return QI(e.type)?ST(e.type,t):r[e.type].members.reduce(((e,n)=>(e[n.name]=NT(t,n,r,i),e)),{});if(i&&e.type in i&&i[e.type]){const n=Number(t.next().value),o=i[e.type].variants.reduce(((e,o,a)=>a===n?(e[o.name]=NT(t,{name:"",type:o.type},r,i),e):(e[o.name]=void 0,e)),{});if(e.type.startsWith("core::option::Option")){const t=n===fT.Some?o.Some:void 0;return new mT(n,t)}if(e.type.startsWith("core::result::Result")){let t;return t=n===pT.Ok?o.Ok:o.Err,new gT(n,t)}return new dT(o)}if(UI(e.type)){return _T(e.type).reduce(((e,n,o)=>{const a=n?.name?n.name:o,s={name:a,type:n?.type?n.type:n};return e[a]=NT(t,s,r,i),e}),{})}if(LI(e.type)){const n=[],o={name:"",type:nT(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(NT(t,o,r,i));return n}return ST(e.type,t)}function IT(t,e,r,i,n){const{name:o,type:a}=e;let s;switch(!0){case DI(o):return s=t.next().value,BigInt(s);case r&&a in r||UI(a):case i&&VI(a,i):case ET.isTypeFixedArray(a):return NT(t,e,r,i);case LI(a):if(iT(a))return NT(t,e,r,i);const h=[];if(n&&n[`${o}_len`]){const a=n[`${o}_len`];for(;h.length<a;)h.push(NT(t,{name:o,type:e.type.replace("*","")},r,i))}return h;case aT(a):return NT(t,e,r,i);default:return ST(a,t)}}var TT=(t,e)=>{if(CN(DN(t)||RN(t)||BN(t),`Validate: arg ${e.name} should be a felt typed as (String, Number or BigInt)`),DN(t)&&!LN(t))return;const r=BigInt(t.toString(10));CN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)},CT=(t,e)=>{let r;switch(RN(t)&&CN(t<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is too large to be typed as Number use (BigInt or String)"),CN(DN(t)||RN(t)||BN(t)||$N(t)&&"low"in t&&"high"in t||$N(t)&&["limb0","limb1","limb2","limb3"].every((e=>e in t)),`Validate: arg ${e.name} of cairo type ${e.type} should be type (String, Number or BigInt), but is ${typeof t} ${t}.`),e.type){case EN.u256:r=new zI(t).toBigInt();break;case EN.u512:r=new BI(t).toBigInt();break;default:r=UN(t)}switch(e.type){case EN.u8:CN(r>=0n&&r<=255n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0 - 255]`);break;case EN.u16:CN(r>=0n&&r<=65535n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 65535]`);break;case EN.u32:CN(r>=0n&&r<=4294967295n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 4294967295]`);break;case EN.u64:CN(r>=0n&&r<=2n**64n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^64-1]`);break;case EN.u128:CN(r>=0n&&r<=2n**128n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^128-1]`);break;case EN.u256:CN(r>=0n&&r<=2n**256n-1n,`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^256-1`);break;case EN.u512:CN(BI.is(r),`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^512-1`);break;case AN.ClassHash:case AN.ContractAddress:CN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`);break;case AN.Secp256k1Point:CN(r>=0n&&r<=2n**512n-1n,`Validate: arg ${e.name} must be ${e.type} : a 512 bits number.`);break;case AN.U96:CN(r>=0n&&r<=2n**96n-1n,`Validate: arg ${e.name} must be ${e.type} : a 96 bits number.`)}},zT=(t,e)=>{CN(PN(t),`Validate: arg ${e.name} of cairo type ${e.type} should be type (Boolean)`)},OT=(t,e,r)=>{if(e.type!==EN.u256&&e.type!==EN.u512)if(QI(e.type)){CN(!$N(t),`EthAddress type is waiting a BigNumberish. Got "${t}"`);const r=BigInt(t.toString(10));CN(r>=0n&&r<=2n**160n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^160-1]`)}else CN($N(t),`Validate: arg ${e.name} is cairo type struct (${e.type}), and should be defined as a js object (not array)`),r[e.type].members.forEach((({name:r})=>{CN(Object.keys(t).includes(r),`Validate: arg ${e.name} should have a property ${r}`)}));else CT(t,e)},RT=(t,e)=>{CN($N(t),`Validate: arg ${e.name} is cairo type Enum (${e.type}), and should be defined as a js object (not array)`);const r=Object.getOwnPropertyNames(Object.getPrototypeOf(t)),i=[...Object.getOwnPropertyNames(t),...r];if(!(HI(e.type)&&i.includes("isSome")&&i.includes("isNone")||GI(e.type)&&i.includes("isOk")&&i.includes("isErr")||i.includes("variant")&&i.includes("activeVariant")))throw new Error(`Validate Enum: argument ${e.name}, type ${e.type}, value received "${t}", is not an Enum.`)},PT=(t,e)=>{CN($N(t),`Validate: arg ${e.name} should be a tuple (defined as object)`)},BT=(t,e,r,i)=>{const n=LI(e.type),o=n?nT(e.type):ET.getFixedArrayType(e.type);if(n&&$I(o)&&wI(t))return;let a=[];if(n)CN(Array.isArray(t),`Validate: arg ${e.name} should be an Array`),a=t;else switch(!0){case Array.isArray(t):a=t;break;case"object"==typeof t:a=Object.values(t);break;default:throw new Error(`Validate: arg ${e.name} should be an Array or an object.`)}switch(!0){case $I(o):a.forEach((t=>TT(t,e)));break;case UI(o):a.forEach((t=>PT(t,{name:e.name,type:o})));break;case LI(o):a.forEach((t=>BT(t,{name:"",type:o},r,i)));break;case qI(o,r):a.forEach((t=>OT(t,{name:e.name,type:o},r)));break;case VI(o,i):a.forEach((t=>RT(t,{name:e.name,type:o})));break;case ZI(o)||JI(o):a.forEach((t=>CT(t,{name:"",type:o})));break;case WI(o):a.forEach((t=>zT(t,e)));break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value ${a}`)}};function DT(t,e,r,i){t.inputs.reduce(((t,n)=>{const o=e[t];switch(!0){case DI(n.name):return t;case $I(n.type):TT(o,n);break;case XI(n.type):((t,e)=>{CN(DN(t),`Validate: arg ${e.name} should be a string.`),CN(t.length<32,`Validate: arg ${e.name} cairo typed ${e.type} should be a string of less than 32 characters.`)})(o,n);break;case ZI(n.type)||JI(n.type):CT(o,n);break;case WI(n.type):zT(o,n);break;case tT(n.type):((t,e)=>{CN(DN(t),`Validate: arg ${e.name} should be a string.`)})(o,n);break;case LI(n.type)||ET.isTypeFixedArray(n.type):BT(o,n,r,i);break;case qI(n.type,r):OT(o,n,r);break;case VI(n.type,i):RT(o,n);break;case UI(n.type):PT(o,n);break;case aT(n.type):((t,e)=>{const r=nT(e.type);switch(CN(ZI(r)&&r!==BI.abiSelector||$I(r),`Validate: ${e.name} type is not authorized for NonZero type.`),!0){case $I(r):TT(t,e),CN(BigInt(t.toString(10))>0,"Validate: value 0 is not authorized in NonZero felt252 type.");break;case ZI(r):CT(t,{name:"",type:r}),r===EN.u256?CN(new zI(t).toBigInt()>0,"Validate: value 0 is not authorized in NonZero uint256 type."):CN(UN(t)>0,"Validate: value 0 is not authorized in NonZero uint type.");break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value "${t}"`)}})(o,n);break;default:throw new Error(`Validate Unhandled: argument ${n.name}, type ${n.type}, value ${o}`)}return t+1}),0)}var $T=class t{abi;parser;structs;enums;constructor(e){this.structs=t.getAbiStruct(e),this.enums=t.getAbiEnum(e),this.parser=bT(e),this.abi=this.parser.getLegacyFormat()}validate(t,e,r=[]){if(t!==_N.DEPLOY){CN(this.abi.filter((e=>{if("function"!==e.type)return!1;const r="view"===e.stateMutability||"view"===e.state_mutability;return t===_N.INVOKE?!r:r})).map((t=>t.name)).includes(e),(t===_N.INVOKE?"invocable":"viewable")+" method not found in abi")}const i=this.abi.find((r=>t===_N.DEPLOY?r.name===e&&"constructor"===r.type:r.name===e&&"function"===r.type));if(kT(e,r,i))return;const n=this.parser.methodInputsLength(i);if(r.length!==n)throw Error(`Invalid number of arguments, expected ${n} arguments, but got ${r.length}`);DT(i,r,this.structs,this.enums)}compile(t,e){const r=this.abi.find((e=>e.name===t));if(kT(t,e,r))return[];let i;if(Array.isArray(e))i=e;else{const t=AT(e,r.inputs,this.structs,this.enums);i=Object.values(t),DT(r,i,this.structs,this.enums)}const n=i[Symbol.iterator](),o=r.inputs.reduce(((t,e)=>DI(e.name)&&!iT(e.type)?t:t.concat(function(t,e,r,i){const{name:n,type:o}=e;let{value:a}=t.next();switch(!0){case ET.isTypeFixedArray(o):if(!Array.isArray(a)&&"object"!=typeof a)throw Error(`ABI expected parameter ${n} to be an array or an object, got ${a}`);return xT(a,e.type,r,i);case LI(o):if(!Array.isArray(a)&&!gI(a))throw Error(`ABI expected parameter ${n} to be array or long string, got ${a}`);return DN(a)&&(a=vI(a)),xT(a,e.type,r,i);case aT(o):return jT(nT(o),a);case QI(o):return jT(o,a);case qI(o,r)||UI(o)||zI.isAbiType(o):case VI(o,i):return xT(a,o,r,i);default:return jT(o,a)}}(n,e,this.structs,this.enums))),[]);return Object.defineProperty(o,"__compiled__",{enumerable:!1,writable:!1,value:!0}),o}static compile(t){const e=t=>{const e=(t,r=".")=>{const i=Array.isArray(t)?[t.length.toString(),...t]:t;return Object.entries(i).flatMap((([t,n])=>{let o=n;"entrypoint"===t?o=hI(o):wI(o)&&(o=_I(o));const a=Array.isArray(i)&&"0"===t?"$$len":t;if(BN(o))return[[`${r}${a}`,cT(o)]];if(Object(o)===o){const t=Object.getOwnPropertyNames(Object.getPrototypeOf(o)),i=[...Object.getOwnPropertyNames(o),...t];if(i.includes("isSome")&&i.includes("isNone")){const t=o,i=t.isSome()?fT.Some:fT.None;return t.isSome()?e({0:i,1:t.unwrap()},`${r}${a}.`):[[`${r}${a}`,cT(i)]]}if(i.includes("isOk")&&i.includes("isErr")){const t=o,i=t.isOk()?pT.Ok:pT.Err;return e({0:i,1:t.unwrap()},`${r}${a}.`)}if(i.includes("variant")&&i.includes("activeVariant")){const t=o,i=t.activeVariant(),n=Object.keys(t.variant).findIndex((t=>t===i));return"object"==typeof t.unwrap()&&0===Object.keys(t.unwrap()).length?[[`${r}${a}`,cT(n)]]:e({0:n,1:t.unwrap()},`${r}${a}.`)}return e(o,`${r}${a}.`)}return[[`${r}${a}`,cT(o)]]}))};return Object.fromEntries(e(t))};let r;if(Array.isArray(t)){const i=e({...t});r=Object.values(i)}else{const i=e(t);r=Object.values(i)}return Object.defineProperty(r,"__compiled__",{enumerable:!1,writable:!1,value:!0}),r}parse(t,e){const{outputs:r}=this.abi.find((e=>e.name===t)),i=e.flat()[Symbol.iterator](),n=r.flat().reduce(((t,e,r)=>{const n=e.name??r;return t[n]=IT(i,e,this.structs,this.enums,t),t[n]&&t[`${n}_len`]&&delete t[`${n}_len`],t}),{});return 1===Object.keys(n).length&&0 in n?n[0]:n}format(t,e,r){return vT(this.parse(t,e),r)}static getAbiStruct(t){return t.filter((t=>"struct"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{})}static getAbiEnum(t){const e=t.filter((t=>"enum"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{});return delete e["core::bool"],e}static toCalldata(e=[]){return t.compile(e)}static toHex(e=[]){return t.compile(e).map((t=>FN(t)))}decodeParameters(t,e){const r=Array.isArray(t)?t:[t],i=e.flat()[Symbol.iterator](),n=r.map((t=>IT(i,{name:"",type:t},this.structs,this.enums)));return 1===n.length?n[0]:n}};Xx({},{calculateContractAddressFromHash:()=>mC,calculateDeclareTransactionHash:()=>sC,calculateDeployAccountTransactionHash:()=>hC,calculateInvokeTransactionHash:()=>aC,calculateL2MessageTxHash:()=>HT,computeCompiledClassHash:()=>kC,computeContractClassHash:()=>EC,computeHashOnElements:()=>cC,computeHintedClassHash:()=>yC,computeLegacyContractClassHash:()=>wC,computePedersenHash:()=>uC,computePedersenHashOnElements:()=>dC,computePoseidonHash:()=>lC,computePoseidonHashOnElements:()=>fC,computeSierraContractClassHash:()=>_C,formatSpaces:()=>gC,getL2MessageHash:()=>cI,getSelector:()=>uI,getSelectorFromName:()=>hI,hashByteCodeSegments:()=>bC,keccakBn:()=>aI,poseidon:()=>Vw,solidityUint256PackedKeccak256:()=>lI,starknetKeccak:()=>sI});Xx({},{calculateDeclareTransactionHash:()=>FT,calculateDeployAccountTransactionHash:()=>qT,calculateL2MessageTxHash:()=>HT,calculateTransactionHash:()=>VT,calculateTransactionHashCommon:()=>UT,computeHashOnElements:()=>LT});function LT(t){return[...t,t.length].reduce(((t,e)=>Vv(UN(t),UN(e))),0).toString()}function UT(t,e,r,i,n,o,a,s=[]){const h=LT(n);return LT([t,e,r,i,h,o,a,...s])}function FT(t,e,r,i,n,o,a){return UT("0x6465636c617265",r,e,0,[t],i,n,[o,...a?[a]:[]])}function qT(t,e,r,i,n,o,a,s){return UT("0x6465706c6f795f6163636f756e74",n,t,0,[e,i,...r],o,a,[s])}function VT(t,e,r,i,n,o){return UT("0x696e766f6b65",e,t,0,r,i,n,[o])}function HT(t,e,r,i,n,o){const a=[t,...i];return UT("0x6c315f68616e646c6572",0,e,uI(r),a,0,n,[o])}Xx({},{starkCurve:()=>eb,weierstrass:()=>fv});Xx({},{calculateDeclareTransactionHash:()=>nC,calculateDeployAccountTransactionHash:()=>iC,calculateInvokeTransactionHash:()=>oC,calculateTransactionHashCommon:()=>rC,encodeResourceBoundsL1:()=>XT,encodeResourceBoundsL2:()=>tC,hashDAMode:()=>QT,hashFeeField:()=>eC});var GT=t=>t.map((t=>BigInt(t))),ZT=32n,KT=128n,JT=64n+KT,WT=BigInt(bI("L1_GAS")),YT=BigInt(bI("L2_GAS"));function QT(t,e){return(BigInt(t)<<ZT)+BigInt(e)}function XT(t){return(WT<<JT)+(BigInt(t.l1_gas.max_amount)<<KT)+BigInt(t.l1_gas.max_price_per_unit)}function tC(t){return(YT<<JT)+(BigInt(t.l2_gas.max_amount)<<KT)+BigInt(t.l2_gas.max_price_per_unit)}function eC(t,e){const r=XT(e),i=tC(e);return tb([BigInt(t),r,i])}function rC(t,e,r,i,n,o,a,s,h,u,l=[]){const c=eC(o,u),d=QT(s,h),f=GT([t,e,r,c,tb(GT(a)),i,n,d,...GT(l)]);return FN(tb(f))}function iC(t,e,r,i,n,o,a,s,h,u,l,c){return rC("0x6465706c6f795f6163636f756e74",n,t,o,a,l,c,s,h,u,[tb(GT(r)),e,i])}function nC(t,e,r,i,n,o,a,s,h,u,l,c){return rC("0x6465636c617265",i,r,n,o,l,GT(c),s,h,u,[tb(GT(a)),t,e])}function oC(t,e,r,i,n,o,a,s,h,u,l){return rC("0x696e766f6b65",e,t,i,n,u,l,a,s,h,[tb(GT(o)),tb(GT(r))])}function aC(t){return function(t){return[rS.ETransactionVersion.V3,rS.ETransactionVersion.F3].includes(t.version)}(t)?oC(t.senderAddress,t.version,t.compiledCalldata,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):VT(t.senderAddress,t.version,t.compiledCalldata,t.maxFee,t.chainId,t.nonce)}function sC(t){return function(t){return[rS.ETransactionVersion.V3,rS.ETransactionVersion.F3].includes(t.version)}(t)?nC(t.classHash,t.compiledClassHash,t.senderAddress,t.version,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):FT(t.classHash,t.senderAddress,t.version,t.maxFee,t.chainId,t.nonce,t.compiledClassHash)}function hC(t){return function(t){return[rS.ETransactionVersion.V3,rS.ETransactionVersion.F3].includes(t.version)}(t)?iC(t.contractAddress,t.classHash,t.compiledConstructorCalldata,t.salt,t.version,t.chainId,t.nonce,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):qT(t.contractAddress,t.classHash,t.constructorCalldata,t.salt,t.version,t.maxFee,t.chainId,t.nonce)}function uC(t,e){return Vv(BigInt(t),BigInt(e))}function lC(t,e){return FN(Xv(BigInt(t),BigInt(e)))}function cC(t){return[...t,t.length].reduce(((t,e)=>Vv(BigInt(t),BigInt(e))),0).toString()}var dC=cC;function fC(t){return FN(tb(t.map((t=>BigInt(t)))))}function mC(t,e,r,i){const n=cC($T.compile(r)),o=cC([cT("0x535441524b4e45545f434f4e54524143545f41444452455353"),i,t,e,n]);return FN(BigInt(o)%LS)}function pC(t,e){return"attributes"===t||"accessible_scopes"===t?Array.isArray(e)&&0===e.length?void 0:e:"debug_info"===t?null:null===e?void 0:e}function gC(t){let e=!1;const r=[];for(const i of t)'"'===i&&!1==(r.length>0&&"\\"===r.slice(-1)[0])&&(e=!e),e?r.push(i):r.push(":"===i?": ":","===i?", ":i);return r.join("")}function yC(t){const{abi:e,program:r}=t,i=gC(lN({abi:e,program:r},pC));return jS(Gv(bS(i)).toString(16))}function wC(t){const e=DN(t)?hN(t):t,r=FN(BS),i=cC(e.entry_points_by_type.EXTERNAL.flatMap((t=>[t.selector,t.offset]))),n=cC(e.entry_points_by_type.L1_HANDLER.flatMap((t=>[t.selector,t.offset]))),o=cC(e.entry_points_by_type.CONSTRUCTOR.flatMap((t=>[t.selector,t.offset]))),a=cC(e.program.builtins.map((t=>bI(t)))),s=yC(e),h=cC(e.program.data);return cC([r,i,n,o,a,s,h])}function vC(t){const e=t.flatMap((t=>{return[BigInt(t.selector),BigInt(t.offset),(e=t.builtins,tb(e.flatMap((t=>BigInt(bI(t))))))];var e}));return tb(e)}function bC(t){const e=t.bytecode.map((t=>BigInt(t))),r=t.bytecode_segment_lengths??[];let i=0;const n=r.flatMap((t=>{const r=e.slice(i,i+=t);return[BigInt(t),tb(r)]}));return 1n+tb(n)}function kC(t){const e=BigInt(bI("COMPILED_CLASS_V1")),r=vC(t.entry_points_by_type.EXTERNAL),i=vC(t.entry_points_by_type.L1_HANDLER),n=vC(t.entry_points_by_type.CONSTRUCTOR),o=t.bytecode_segment_lengths?bC(t):tb(t.bytecode.map((t=>BigInt(t))));return FN(tb([e,r,i,n,o]))}function MC(t){return tb(t.flatMap((t=>[BigInt(t.selector),BigInt(t.function_idx)])))}function _C(t){const e=BigInt(bI("CONTRACT_CLASS_V0.1.0")),r=MC(t.entry_points_by_type.EXTERNAL),i=MC(t.entry_points_by_type.L1_HANDLER),n=MC(t.entry_points_by_type.CONSTRUCTOR),o=function(t){const e=gC(lN(t.abi,null));return BigInt(jS(Gv(bS(e)).toString(16)))}(t),a=tb(t.sierra_program.map((t=>BigInt(t))));return FN(tb([e,r,i,n,o,a]))}function EC(t){const e=DN(t)?hN(t):t;return"sierra_program"in e?_C(e):wC(e)}function AC(t){const e=DN(t)?t:lN(t);return _S(q_(e))}function jC(t){if(Array.isArray(t))return t;const e=vS(V_(MS(t)));return hN(e)}function xC(){return Pv(Cv.randomPrivateKey())}function SC(t){return jS(t).toLowerCase()}function NC(t){if(!t)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(t))return t.map((t=>FN(t)));try{const{r:e,s:r}=t;return[FN(e),FN(r)]}catch(t){throw new Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function IC(t){return JN(NC(t))}function TC(t){return WN(NC(t))}function CC(t,e=50){return iI(t,e)}function zC(t,e=50,r=50){if(BN(t))return{l2_gas:{max_amount:"0x0",max_price_per_unit:"0x0"},l1_gas:{max_amount:"0x0",max_price_per_unit:"0x0"}};if(ON(t.gas_consumed)||ON(t.gas_price))throw Error("estimateFeeToBounds: estimate is undefined");return{l2_gas:{max_amount:"0x0",max_price_per_unit:"0x0"},l1_gas:{max_amount:void 0!==t.data_gas_consumed&&void 0!==t.data_gas_price?FN(iI(BigInt(t.overall_fee)/BigInt(t.gas_price),e)):FN(iI(t.gas_consumed,e)),max_price_per_unit:FN(iI(t.gas_price,r))}}}function OC(t){if(t===rS.EDataAvailabilityMode.L1)return rS.EDAMode.L1;if(t===rS.EDataAvailabilityMode.L2)return rS.EDAMode.L2;throw Error("EDAM conversion")}function RC(t,e){const r=e?FN(e):void 0,i=FN(t);if(e&&!Object.values(rS.ETransactionVersion).includes(r))throw Error(`providedVersion ${e} is not ETransactionVersion`);if(!Object.values(rS.ETransactionVersion).includes(i))throw Error(`defaultVersion ${t} is not ETransactionVersion`);return e?r:i}function PC(t){if(!t)return;const e=FN(t);if(e===rS.ETransactionVersion.V0)return rS.ETransactionVersion.F0;if(e===rS.ETransactionVersion.V1)return rS.ETransactionVersion.F1;if(e===rS.ETransactionVersion.V2)return rS.ETransactionVersion.F2;if(e===rS.ETransactionVersion.V3)return rS.ETransactionVersion.F3;throw Error(`toFeeVersion: ${e} is not supported`)}function BC(t){return{tip:t.tip||0,paymasterData:t.paymasterData||[],accountDeploymentData:t.accountDeploymentData||[],nonceDataAvailabilityMode:t.nonceDataAvailabilityMode||rS.EDataAvailabilityMode.L1,feeDataAvailabilityMode:t.feeDataAvailabilityMode||rS.EDataAvailabilityMode.L1,resourceBounds:t.resourceBounds??zC(OS)}}function DC(t){return t===rS.ETransactionVersion.F2?rS.ETransactionVersion.F1:t===rS.ETransactionVersion.V2?rS.ETransactionVersion.V1:t}function $C(t){return jS(ES(Av(FN(t),!1)))}function LC(t){return"sierra_program"in(DN(t)?hN(t):t)}Xx({},{compressProgram:()=>AC,decompressProgram:()=>jC,estimateFeeToBounds:()=>zC,estimatedFeeToMaxFee:()=>CC,formatSignature:()=>NC,getFullPublicKey:()=>$C,intDAM:()=>OC,makeAddress:()=>SC,randomAddress:()=>xC,reduceV2:()=>DC,signatureToDecimalArray:()=>IC,signatureToHexArray:()=>TC,toFeeVersion:()=>PC,toTransactionVersion:()=>RC,v3Details:()=>BC});function UC(){return IS(ES(Y_.utils.randomPrivateKey()))}function FC(t){KN(t,OS,2n**160n-1n,"Ethereum Address ");const e=jS(AS(FN(t)).padStart(40,"0"));return CN(Boolean(e.match(/^(0x)?[0-9a-f]{40}$/)),"Invalid Ethereum Address Format"),e}Xx({},{ethRandomPrivateKey:()=>UC,validateAndParseEthAddress:()=>FC});var qC=wS&&window.fetch.bind(window)||!ON(t)&&cx(t.fetch)||Px;Xx({},{Block:()=>QC,createSierraContractClass:()=>KC,getDefaultNodeUrl:()=>WC,isPendingBlock:()=>ez,isPendingStateUpdate:()=>iz,isPendingTransaction:()=>rz,isV3Tx:()=>XC,isVersion:()=>tz,parseContract:()=>JC,validBlockTags:()=>YC,wait:()=>ZC});var VC=class t{static instance;config;constructor(){this.initialize()}initialize(){this.config={...nN}}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(t,e){return this.config[t]??e}set(t,e){this.config[t]=e}update(t){this.config={...this.config,...t}}getAll(){return{...this.config}}reset(){this.initialize()}delete(t){delete this.config[t]}hasKey(t){return t in this.config}}.getInstance(),HC={DEBUG:5,INFO:4,WARN:3,ERROR:2,FATAL:1,OFF:0},GC=class t{static instance;config;constructor(){this.config=VC}static getInstance(){return t.instance||(t.instance=new t),t.instance}getTimestamp(){return(new Date).toISOString()}shouldLog(t){const e=this.config.get("logLevel","INFO");return t<=HC[e]}formatMessage(t){const{level:e,message:r,timestamp:i,data:n}=t;let o=`[${i}] ${e}: ${r}`;if(n)try{o+=`\n${JSON.stringify(n,null,2)}`}catch(t){o+=`\n[JSON.stringify Error/Circular]: ${t}`}return o}log(t,e,r){if(!this.shouldLog(HC[t]))return;const i={level:t,message:e,timestamp:this.getTimestamp(),data:r},n=this.formatMessage(i);switch(t){case"DEBUG":console.debug(n);break;case"INFO":console.info(n);break;case"WARN":console.warn(n);break;case"ERROR":case"FATAL":console.error(n);break;case"OFF":break;default:console.log(n)}}debug(t,e){this.log("DEBUG",t,e)}info(t,e){this.log("INFO",t,e)}warn(t,e){this.log("WARN",t,e)}error(t,e){this.log("ERROR",t,e)}fatal(t,e){this.log("FATAL",t,e)}setLogLevel(t){this.config.set("logLevel",t)}getLogLevel(){return this.config.get("logLevel","INFO")}getEnabledLogLevels(){return Object.keys(HC).filter((t=>this.shouldLog(HC[t])&&"OFF"!==t))}}.getInstance();function ZC(t){return new Promise((e=>{setTimeout(e,t)}))}function KC(t){const e={...t};return delete e.sierra_program_debug_info,e.abi=gC(lN(t.abi)),e.sierra_program=gC(lN(t.sierra_program)),e.sierra_program=AC(e.sierra_program),e}function JC(t){const e=DN(t)?hN(t):t;return LC(t)?KC(e):{...e,..."program"in e&&{program:AC(e.program)}}}var WC=(t,e=!1)=>{e||GC.info("Using default public node url, please provide nodeUrl in provider options!");const r=QS[t??"SN_SEPOLIA"];return r[Math.floor(Math.random()*r.length)]},YC=Object.values(MN),QC=class{hash=null;number=null;tag=null;setIdentifier(t){if(DN(t))if(pI(t))this.number=parseInt(t,10);else if(LN(t))this.hash=t;else{if(!YC.includes(t))throw TypeError(`Block identifier unmanaged: ${t}`);this.tag=t}else BN(t)?this.hash=FN(t):RN(t)?this.number=t:this.tag=MN.PENDING;if(RN(this.number)&&this.number<0)throw TypeError(`Block number (${this.number}) can't be negative`)}constructor(t){this.setIdentifier(t)}get queryIdentifier(){return null!==this.number?`blockNumber=${this.number}`:null!==this.hash?`blockHash=${this.hash}`:`blockNumber=${this.tag}`}get identifier(){return null!==this.number?{block_number:this.number}:null!==this.hash?{block_hash:this.hash}:this.tag}set identifier(t){this.setIdentifier(t)}valueOf=()=>this.number;toString=()=>this.hash};function XC(t){const e=t.version?FN(t.version):rS.ETransactionVersion.V3;return e===rS.ETransactionVersion.V3||e===rS.ETransactionVersion.F3}function tz(t,e){const[r,i]=t.split("."),[n,o]=e.split(".");return r===n&&i===o}function ez(t){return"PENDING"===t.status}function rz(t){return!("block_hash"in t)}function iz(t){return!("block_hash"in t)}var nz={};Xx(nz,{buildUDCCall:()=>cz,fromCallsToExecuteCalldata:()=>az,fromCallsToExecuteCalldataWithNonce:()=>sz,fromCallsToExecuteCalldata_cairo1:()=>uz,getExecuteCalldata:()=>lz,getVersionsByType:()=>dz,transformCallsToMulticallArrays:()=>oz,transformCallsToMulticallArrays_cairo1:()=>hz});var oz=t=>{const e=[],r=[];return t.forEach((t=>{const i=$T.compile(t.calldata||[]);e.push({to:UN(t.contractAddress).toString(10),selector:UN(hI(t.entrypoint)).toString(10),data_offset:r.length.toString(),data_len:i.length.toString()}),r.push(...i)})),{callArray:e,calldata:$T.compile({calldata:r})}},az=t=>{const{callArray:e,calldata:r}=oz(t);return[...$T.compile({callArray:e}),...r]},sz=(t,e)=>[...az(t),UN(e).toString()],hz=t=>{const e=t.map((t=>({to:UN(t.contractAddress).toString(10),selector:UN(hI(t.entrypoint)).toString(10),calldata:$T.compile(t.calldata||[])})));return e},uz=t=>{const e=t.map((t=>({contractAddress:t.contractAddress,entrypoint:t.entrypoint,calldata:Array.isArray(t.calldata)&&"__compiled__"in t.calldata?t.calldata:$T.compile(t.calldata)})));return $T.compile({orderCalls:e})},lz=(t,e="0")=>"1"===e?uz(t):az(t);function cz(t,e){const r=[].concat(t).map((t=>{const{classHash:r,salt:i,unique:n=!0,constructorCalldata:o=[]}=t,a=$T.compile(o),s=i??xC();return{call:{contractAddress:WS.ADDRESS,entrypoint:WS.ENTRYPOINT,calldata:[r,s,eI(n),a.length,...a]},address:mC(n?Vv(e,s):s,r,a,n?WS.ADDRESS:0)}}));return{calls:r.map((t=>t.call)),addresses:r.map((t=>t.address))}}function dz(t){return"fee"===t?{v1:rS.ETransactionVersion.F1,v2:rS.ETransactionVersion.F2,v3:rS.ETransactionVersion.F3}:{v1:rS.ETransactionVersion.V1,v2:rS.ETransactionVersion.V2,v3:rS.ETransactionVersion.V3}}var fz={headers:{"Content-Type":"application/json"},blockIdentifier:MN.PENDING,retries:200},mz=class{nodeUrl;headers;requestId;blockIdentifier;retries;waitMode;chainId;specVersion;transactionRetryIntervalFallback;batchClient;baseFetch;constructor(t){const{baseFetch:e,batch:r,blockIdentifier:i,chainId:n,headers:o,nodeUrl:a,retries:s,specVersion:h,transactionRetryIntervalFallback:u,waitMode:l}=t||{};Object.values(GS).includes(a)?this.nodeUrl=WC(a,t?.default):this.nodeUrl=a||WC(void 0,t?.default),this.baseFetch=e??qC,this.blockIdentifier=i??fz.blockIdentifier,this.chainId=n,this.headers={...fz.headers,...o},this.retries=s??fz.retries,this.specVersion=h,this.transactionRetryIntervalFallback=u,this.waitMode=l??!1,this.requestId=0,"number"==typeof r&&(this.batchClient=new TN({nodeUrl:this.nodeUrl,headers:this.headers,interval:r,baseFetch:this.baseFetch}))}get transactionRetryIntervalDefault(){return this.transactionRetryIntervalFallback??5e3}setChainId(t){this.chainId=t}fetch(t,e,r=0){const i={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:lN(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new pN(r,t,e);if(i instanceof mN)throw i;if(i)throw Error(i.message)}async fetchEndpoint(t,e){try{if(this.batchClient){const{error:r,result:i}=await this.batchClient.fetch(t,e,this.requestId+=1);return this.errorHandler(t,e,r),i}const r=await this.fetch(t,e,this.requestId+=1),{error:i,result:n}=await r.json();return this.errorHandler(t,e,i),n}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??=await this.fetchEndpoint("starknet_chainId"),this.chainId}async getSpecVersion(){return this.specVersion??=await this.fetchEndpoint("starknet_specVersion"),this.specVersion}getNonceForAddress(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:i})}getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}getBlockWithTxHashes(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new QC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=FN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}simulateTransaction(t,e={}){const{blockIdentifier:r=this.blockIdentifier,skipValidate:i=!0,skipFeeCharge:n=!0}=e,o=new QC(r).identifier,a=[];return i&&a.push(nS.ESimulationFlag.SKIP_VALIDATE),n&&a.push(nS.ESimulationFlag.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:o,transactions:t.map((t=>this.buildTransaction(t))),simulation_flags:a})}async waitForTransaction(t,e){const r=FN(t);let{retries:i}=this,n=!1,o=!1;const a=e?.retryInterval??this.transactionRetryIntervalDefault,s=e?.errorStates??[nS.ETransactionStatus.REJECTED],h=e?.successStates??[nS.ETransactionExecutionStatus.SUCCEEDED,nS.ETransactionStatus.ACCEPTED_ON_L2,nS.ETransactionStatus.ACCEPTED_ON_L1];let u;for(;!n;){await ZC(a);try{u=await this.getTransactionStatus(r);const t=u.execution_status,e=u.finality_status;if(!e){throw new Error("waiting for transaction status")}if(s.includes(t)||s.includes(e)){const r=`${t}: ${e}`,i=new Error(r);throw i.response=u,o=!0,i}(h.includes(t)||h.includes(e))&&(n=!0)}catch(t){if(t instanceof Error&&o)throw t;if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1}let l=null;for(;null===l;){try{l=await this.getTransactionReceipt(r)}catch(t){if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1,await ZC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=FN(t),n=VN(e),o=new QC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:i,contract_address:r})}async getEstimateFee(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!0}){const i=new QC(e).identifier;let n={};return tz("0.5",await this.getSpecVersion())||(n={simulation_flags:r?[nS.ESimulationFlag.SKIP_VALIDATE]:[]}),this.fetchEndpoint("starknet_estimateFee",{request:t.map((t=>this.buildTransaction(t,"fee"))),block_id:i,...n})}async invoke(t,e){let r;return XC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:nS.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),version:nS.ETransactionVersion.V3,signature:TC(t.signature),nonce:FN(e.nonce),resource_bounds:e.resourceBounds,tip:FN(e.tip),paymaster_data:e.paymasterData.map((t=>FN(t))),account_deployment_data:e.accountDeploymentData.map((t=>FN(t))),nonce_data_availability_mode:e.nonceDataAvailabilityMode,fee_data_availability_mode:e.feeDataAvailabilityMode}}):(r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),type:nS.ETransactionType.INVOKE,max_fee:FN(e.maxFee||0),version:nS.ETransactionVersion.V1,signature:TC(t.signature),nonce:FN(e.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:nS.ETransactionVersion.V1,type:nS.ETransactionType.INVOKE})),this.waitMode?this.waitForTransaction((await r).transaction_hash):r}async declare({contract:t,signature:e,senderAddress:r,compiledClassHash:i},n){let o;if(LC(t)||XC(n))if(LC(t)&&!XC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:nS.ETransactionType.DECLARE,contract_class:{sierra_program:jC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},compiled_class_hash:i||"",version:nS.ETransactionVersion.V2,max_fee:FN(n.maxFee||0),signature:TC(e),sender_address:r,nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:nS.ETransactionVersion.V2,type:nS.ETransactionType.DECLARE});else{if(!LC(t)||!XC(n))throw Error("declare unspotted parameters");o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:nS.ETransactionType.DECLARE,sender_address:r,compiled_class_hash:i||"",version:nS.ETransactionVersion.V3,signature:TC(e),nonce:FN(n.nonce),contract_class:{sierra_program:jC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},resource_bounds:n.resourceBounds,tip:FN(n.tip),paymaster_data:n.paymasterData.map((t=>FN(t))),account_deployment_data:n.accountDeploymentData.map((t=>FN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}})}else o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:nS.ETransactionType.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:nS.ETransactionVersion.V1,max_fee:FN(n.maxFee||0),signature:TC(e),sender_address:r,nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:nS.ETransactionVersion.V1,type:nS.ETransactionType.DECLARE});return this.waitMode?this.waitForTransaction((await o).transaction_hash):o}async deployAccount({classHash:t,constructorCalldata:e,addressSalt:r,signature:i},n){let o;return XC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:nS.ETransactionType.DEPLOY_ACCOUNT,version:nS.ETransactionVersion.V3,signature:TC(i),nonce:FN(n.nonce),contract_address_salt:FN(r||0),constructor_calldata:$T.toHex(e||[]),class_hash:FN(t),resource_bounds:n.resourceBounds,tip:FN(n.tip),paymaster_data:n.paymasterData.map((t=>FN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:$T.toHex(e||[]),class_hash:FN(t),contract_address_salt:FN(r||0),type:nS.ETransactionType.DEPLOY_ACCOUNT,max_fee:FN(n.maxFee||0),version:nS.ETransactionVersion.V1,signature:TC(i),nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:nS.ETransactionVersion.V1,type:nS.ETransactionType.DEPLOY_ACCOUNT})),this.waitMode?this.waitForTransaction((await o).transaction_hash):o}callContract(t,e=this.blockIdentifier){const r=new QC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:hI(t.entrypoint),calldata:$T.toHex(t.calldata)},block_id:r})}estimateMessageFee(t,e=this.blockIdentifier){const{from_address:r,to_address:i,entry_point_selector:n,payload:o}=t,a={from_address:FC(r),to_address:FN(i),entry_point_selector:uI(n),payload:tI(o)},s=new QC(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:a,block_id:s})}getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}buildTransaction(t,e){const r=dz(e);let i;if(XC(t)?i={signature:TC(t.signature),nonce:FN(t.nonce),resource_bounds:t.resourceBounds,tip:FN(t.tip),paymaster_data:t.paymasterData.map((t=>FN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>FN(t)))}:(i={signature:TC(t.signature),nonce:FN(t.nonce),max_fee:FN(t.maxFee||0)},GC.warn(oN.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===yN.INVOKE)return{type:nS.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),version:FN(t.version||r.v3),...i};if(t.type===yN.DECLARE)return LC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:jC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:FN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:FN(t.version||r.v1),...i};if(t.type===yN.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:$T.toHex(t.constructorCalldata||[]),class_hash:FN(t.classHash),contract_address_salt:FN(t.addressSalt||0),version:FN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}};Xx({},{RpcChannel:()=>gz});var pz={headers:{"Content-Type":"application/json"},blockIdentifier:MN.PENDING,retries:200},gz=class{nodeUrl;headers;requestId;blockIdentifier;retries;waitMode;chainId;specVersion;transactionRetryIntervalFallback;batchClient;baseFetch;constructor(t){const{baseFetch:e,batch:r,blockIdentifier:i,chainId:n,headers:o,nodeUrl:a,retries:s,specVersion:h,transactionRetryIntervalFallback:u,waitMode:l}=t||{};Object.values(GS).includes(a)?this.nodeUrl=WC(a,t?.default):this.nodeUrl=a||WC(void 0,t?.default),this.baseFetch=e??qC,this.blockIdentifier=i??pz.blockIdentifier,this.chainId=n,this.headers={...pz.headers,...o},this.retries=s??pz.retries,this.specVersion=h,this.transactionRetryIntervalFallback=u,this.waitMode=l??!1,this.requestId=0,"number"==typeof r&&(this.batchClient=new TN({nodeUrl:this.nodeUrl,headers:this.headers,interval:r,baseFetch:this.baseFetch}))}get transactionRetryIntervalDefault(){return this.transactionRetryIntervalFallback??5e3}setChainId(t){this.chainId=t}fetch(t,e,r=0){const i={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:lN(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new pN(r,t,e);if(i instanceof mN)throw i;if(i)throw Error(i.message)}async fetchEndpoint(t,e){try{if(this.batchClient){const{error:r,result:i}=await this.batchClient.fetch(t,e,this.requestId+=1);return this.errorHandler(t,e,r),i}const r=await this.fetch(t,e,this.requestId+=1),{error:i,result:n}=await r.json();return this.errorHandler(t,e,i),n}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??=await this.fetchEndpoint("starknet_chainId"),this.chainId}async getSpecVersion(){return this.specVersion??=await this.fetchEndpoint("starknet_specVersion"),this.specVersion}getNonceForAddress(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:i})}getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}getBlockWithTxHashes(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockWithReceipts(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithReceipts",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new QC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=FN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}simulateTransaction(t,e={}){const{blockIdentifier:r=this.blockIdentifier,skipValidate:i=!0,skipFeeCharge:n=!0}=e,o=new QC(r).identifier,a=[];return i&&a.push(Qm.SKIP_VALIDATE),n&&a.push(Qm.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:o,transactions:t.map((t=>this.buildTransaction(t))),simulation_flags:a})}async waitForTransaction(t,e){const r=FN(t);let{retries:i}=this,n=!1,o=!1;const a=e?.retryInterval??this.transactionRetryIntervalDefault,s=e?.errorStates??[Xm.REJECTED],h=e?.successStates??[ep.SUCCEEDED,Xm.ACCEPTED_ON_L2,Xm.ACCEPTED_ON_L1];let u;for(;!n;){await ZC(a);try{u=await this.getTransactionStatus(r);const t=u.execution_status,e=u.finality_status;if(!e){throw new Error("waiting for transaction status")}if(s.includes(t)||s.includes(e)){const r=`${t}: ${e}`,i=new Error(r);throw i.response=u,o=!0,i}(h.includes(t)||h.includes(e))&&(n=!0)}catch(t){if(t instanceof Error&&o)throw t;if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1}let l=null;for(;null===l;){try{l=await this.getTransactionReceipt(r)}catch(t){if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1,await ZC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=FN(t),n=VN(e),o=new QC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:i,contract_address:r})}async getEstimateFee(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!0}){const i=new QC(e).identifier;let n={};return tz("0.5",await this.getSpecVersion())||(n={simulation_flags:r?[Qm.SKIP_VALIDATE]:[]}),this.fetchEndpoint("starknet_estimateFee",{request:t.map((t=>this.buildTransaction(t,"fee"))),block_id:i,...n})}async invoke(t,e){let r;return XC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:Ym.INVOKE,sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),version:op.V3,signature:TC(t.signature),nonce:FN(e.nonce),resource_bounds:e.resourceBounds,tip:FN(e.tip),paymaster_data:e.paymasterData.map((t=>FN(t))),account_deployment_data:e.accountDeploymentData.map((t=>FN(t))),nonce_data_availability_mode:e.nonceDataAvailabilityMode,fee_data_availability_mode:e.feeDataAvailabilityMode}}):(r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),type:Ym.INVOKE,max_fee:FN(e.maxFee||0),version:op.V1,signature:TC(t.signature),nonce:FN(e.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:op.V1,type:Ym.INVOKE})),this.waitMode?this.waitForTransaction((await r).transaction_hash):r}async declare({contract:t,signature:e,senderAddress:r,compiledClassHash:i},n){let o;if(LC(t)||XC(n))if(LC(t)&&!XC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ym.DECLARE,contract_class:{sierra_program:jC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},compiled_class_hash:i||"",version:op.V2,max_fee:FN(n.maxFee||0),signature:TC(e),sender_address:r,nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:op.V2,type:Ym.DECLARE});else{if(!LC(t)||!XC(n))throw Error("declare unspotted parameters");o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ym.DECLARE,sender_address:r,compiled_class_hash:i||"",version:op.V3,signature:TC(e),nonce:FN(n.nonce),contract_class:{sierra_program:jC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},resource_bounds:n.resourceBounds,tip:FN(n.tip),paymaster_data:n.paymasterData.map((t=>FN(t))),account_deployment_data:n.accountDeploymentData.map((t=>FN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}})}else o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ym.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:op.V1,max_fee:FN(n.maxFee||0),signature:TC(e),sender_address:r,nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:op.V1,type:Ym.DECLARE});return this.waitMode?this.waitForTransaction((await o).transaction_hash):o}async deployAccount({classHash:t,constructorCalldata:e,addressSalt:r,signature:i},n){let o;return XC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:Ym.DEPLOY_ACCOUNT,version:op.V3,signature:TC(i),nonce:FN(n.nonce),contract_address_salt:FN(r||0),constructor_calldata:$T.toHex(e||[]),class_hash:FN(t),resource_bounds:n.resourceBounds,tip:FN(n.tip),paymaster_data:n.paymasterData.map((t=>FN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:$T.toHex(e||[]),class_hash:FN(t),contract_address_salt:FN(r||0),type:Ym.DEPLOY_ACCOUNT,max_fee:FN(n.maxFee||0),version:op.V1,signature:TC(i),nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:op.V1,type:Ym.DEPLOY_ACCOUNT})),this.waitMode?this.waitForTransaction((await o).transaction_hash):o}callContract(t,e=this.blockIdentifier){const r=new QC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:hI(t.entrypoint),calldata:$T.toHex(t.calldata)},block_id:r})}estimateMessageFee(t,e=this.blockIdentifier){const{from_address:r,to_address:i,entry_point_selector:n,payload:o}=t,a={from_address:FC(r),to_address:FN(i),entry_point_selector:uI(n),payload:tI(o)},s=new QC(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:a,block_id:s})}getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}buildTransaction(t,e){const r=dz(e);let i;if(XC(t)?i={signature:TC(t.signature),nonce:FN(t.nonce),resource_bounds:t.resourceBounds,tip:FN(t.tip),paymaster_data:t.paymasterData.map((t=>FN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>FN(t)))}:(i={signature:TC(t.signature),nonce:FN(t.nonce),max_fee:FN(t.maxFee||0)},GC.warn(oN.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===yN.INVOKE)return{type:Ym.INVOKE,sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),version:FN(t.version||r.v3),...i};if(t.type===yN.DECLARE)return LC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:jC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:FN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:FN(t.version||r.v1),...i};if(t.type===yN.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:$T.toHex(t.constructorCalldata||[]),class_hash:FN(t.classHash),contract_address_salt:FN(t.addressSalt||0),version:FN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}},yz=class{margin;constructor(t){this.margin=t}estimatedFeeToMaxFee(t){return CC(t,this.margin?.maxFee)}estimateFeeToBounds(t){return zC(t,this.margin?.l1BoundMaxAmount,this.margin?.l1BoundMaxPricePerUnit)}parseGetBlockResponse(t){return{status:"PENDING",...t}}parseTransactionReceipt(t){return"actual_fee"in t&&DN(t.actual_fee)?{...t,actual_fee:{amount:t.actual_fee,unit:"FRI"}}:t}parseFeeEstimateResponse(t){const e=t[0];return{overall_fee:UN(e.overall_fee),gas_consumed:UN(e.gas_consumed),gas_price:UN(e.gas_price),unit:e.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(e.overall_fee),resourceBounds:this.estimateFeeToBounds(e),data_gas_consumed:e.data_gas_consumed?UN(e.data_gas_consumed):0n,data_gas_price:e.data_gas_price?UN(e.data_gas_price):0n}}parseFeeEstimateBulkResponse(t){return t.map((t=>({overall_fee:UN(t.overall_fee),gas_consumed:UN(t.gas_consumed),gas_price:UN(t.gas_price),unit:t.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(t.overall_fee),resourceBounds:this.estimateFeeToBounds(t),data_gas_consumed:t.data_gas_consumed?UN(t.data_gas_consumed):0n,data_gas_price:t.data_gas_price?UN(t.data_gas_price):0n})))}parseSimulateTransactionResponse(t){return t.map((t=>({...t,suggestedMaxFee:this.estimatedFeeToMaxFee(t.fee_estimation.overall_fee),resourceBounds:this.estimateFeeToBounds(t.fee_estimation)})))}parseContractClassResponse(t){return{...t,abi:DN(t.abi)?JSON.parse(t.abi):t.abi}}parseL1GasPriceResponse(t){return t.l1_gas_price.price_in_wei}},wz=class t{statusReceipt;value;constructor(e){[this.statusReceipt,this.value]=t.isSuccess(e)?["success",e]:t.isReverted(e)?["reverted",e]:t.isRejected(e)?["rejected",e]:["error",new Error("Unknown response type")];for(const[t]of Object.entries(this))Object.defineProperty(this,t,{enumerable:!1});for(const[t,r]of Object.entries(e))Object.defineProperty(this,t,{enumerable:!0,writable:!1,value:r})}match(t){return this.statusReceipt in t?t[this.statusReceipt](this.value):t._()}isSuccess(){return"success"===this.statusReceipt}isReverted(){return"reverted"===this.statusReceipt}isRejected(){return"rejected"===this.statusReceipt}isError(){return"error"===this.statusReceipt}static isSuccess(t){return t.execution_status===bN.SUCCEEDED}static isReverted(t){return t.execution_status===bN.REVERTED}static isRejected(t){return t.status===bN.REJECTED}},vz={};Xx(vz,{TypedDataRevision:()=>lp,encodeData:()=>Oz,encodeType:()=>Tz,encodeValue:()=>zz,getDependencies:()=>Iz,getMessageHash:()=>Pz,getStructHash:()=>Rz,getTypeHash:()=>Cz,isMerkleTreeType:()=>Nz,prepareSelector:()=>Sz,validateTypedData:()=>xz,verifyMessage:()=>Bz});Xx({},{MerkleTree:()=>bz,proofMerklePath:()=>kz});var bz=class t{leaves;branches=[];root;hashMethod;constructor(t,e=uC){this.hashMethod=e,this.leaves=t,this.root=this.build(t)}build(e){if(1===e.length)return e[0];e.length!==this.leaves.length&&this.branches.push(e);const r=[];for(let i=0;i<e.length;i+=2)i+1===e.length?r.push(t.hash(e[i],"0x0",this.hashMethod)):r.push(t.hash(e[i],e[i+1],this.hashMethod));return this.build(r)}static hash(t,e,r=uC){const[i,n]=[BigInt(t),BigInt(e)].sort(((t,e)=>t>=e?1:-1));return r(i,n)}getProof(e,r=this.leaves,i=[]){const n=r.indexOf(e);if(-1===n)throw new Error("leaf not found");if(1===r.length)return i;const o=n%2==0,a=(o?r[n+1]:r[n-1])??"0x0",s=[...i,a],h=this.leaves.length===r.length?-1:this.branches.findIndex((t=>t.length===r.length)),u=this.branches[h+1]??[this.root];return this.getProof(t.hash(o?e:a,o?a:e,this.hashMethod),u,s)}};function kz(t,e,r,i=uC){if(0===r.length)return t===e;const[n,...o]=r;return kz(t,bz.hash(e,n,i),o,i)}var Mz={u256:JSON.parse('[{ "name": "low", "type": "u128" }, { "name": "high", "type": "u128" }]'),TokenAmount:JSON.parse('[{ "name": "token_address", "type": "ContractAddress" }, { "name": "amount", "type": "u256" }]'),NftId:JSON.parse('[{ "name": "collection_address", "type": "ContractAddress" }, { "name": "token_id", "type": "u256" }]')},_z={[lp.ACTIVE]:{domain:"StarknetDomain",hashMethod:fC,hashMerkleMethod:lC,escapeTypeString:t=>`"${t}"`,presetTypes:Mz},[lp.LEGACY]:{domain:"StarkNetDomain",hashMethod:dC,hashMerkleMethod:uC,escapeTypeString:t=>t,presetTypes:{}}};function Ez(t,e,{min:r,max:i}){const n=BigInt(t);CN(n>=r&&n<=i,`${n} (${e}) is out of bounds [${r}, ${i}]`)}function Az({types:t,domain:e}){return _z[lp.ACTIVE].domain in t&&e.revision===lp.ACTIVE?lp.ACTIVE:_z[lp.LEGACY].domain in t&&(e.revision??lp.LEGACY)===lp.LEGACY?lp.LEGACY:void 0}function jz(t){try{return FN(t)}catch(e){if(DN(t))return FN(bI(t));throw new Error(`Invalid BigNumberish: ${t}`)}}function xz(t){const e=t;return Boolean(e.message&&e.primaryType&&e.types&&Az(e))}function Sz(t){return LN(t)?t:hI(t)}function Nz(t){return"merkletree"===t.type}function Iz(t,e,r=[],i="",n=lp.LEGACY){let o=[e];return"*"===e[e.length-1]?o=[e.slice(0,-1)]:n===lp.ACTIVE&&("enum"===e?o=[i]:e.match(/^\(.*\)$/)&&(o=e.slice(1,-1).split(",").map((t=>"*"===t[t.length-1]?t.slice(0,-1):t)))),o.filter((e=>!r.includes(e)&&t[e])).reduce(((e,r)=>[...e,...[r,...t[r].reduce(((e,r)=>[...e,...Iz(t,r.type,e,r.contains,n).filter((t=>!e.includes(t)))]),[])].filter((t=>!e.includes(t)))]),[])}function Tz(t,e,r=lp.LEGACY){const i=r===lp.ACTIVE?{...t,..._z[r].presetTypes}:t,[n,...o]=Iz(i,e,void 0,void 0,r),a=n?[n,...o.sort()]:[],s=_z[r].escapeTypeString;return a.map((t=>{const e=i[t].map((t=>{const e="enum"===t.type&&r===lp.ACTIVE?t.contains:t.type,i=e.match(/^\(.*\)$/)?`(${e.slice(1,-1).split(",").map((t=>t?s(t):t)).join(",")})`:s(e);return`${s(t.name)}:${i}`}));return`${s(t)}(${e})`})).join("")}function Cz(t,e,r=lp.LEGACY){return hI(Tz(t,e,r))}function zz(t,e,r,i={},n=lp.LEGACY){if(t[e])return[e,Rz(t,e,r,n)];if(_z[n].presetTypes[e])return[e,Rz(_z[n].presetTypes,e,r,n)];if(e.endsWith("*")){const i=r.map((r=>zz(t,e.slice(0,-1),r,void 0,n)[1]));return[e,_z[n].hashMethod(i)]}switch(e){case"enum":if(n===lp.ACTIVE){const[o,a]=Object.entries(r)[0],s=t[i.parent].find((t=>t.name===i.key)),h=t[s.contains],u=h.find((t=>t.name===o)),l=h.indexOf(u),c=u.type.slice(1,-1).split(",").map(((e,r)=>{if(!e)return e;const i=a[r];return zz(t,e,i,void 0,n)[1]}));return[e,_z[n].hashMethod([l,...c])]}return[e,jz(r)];case"merkletree":{const e=function(t,e){if(e.parent&&e.key){const r=t[e.parent].find((t=>t.name===e.key));if(!Nz(r))throw new Error(`${e.key} is not a merkle tree`);if(r.contains.endsWith("*"))throw new Error(`Merkle tree contain property must not be an array but was given ${e.key}`);return r.contains}return"raw"}(t,i),o=r.map((r=>zz(t,e,r,void 0,n)[1])),{root:a}=new bz(o,_z[n].hashMerkleMethod);return["felt",a]}case"selector":return["felt",Sz(r)];case"string":if(n===lp.ACTIVE){const t=_I(r),i=[t.data.length,...t.data,t.pending_word,t.pending_word_len];return[e,_z[n].hashMethod(i)]}return[e,jz(r)];case"i128":if(n===lp.ACTIVE){const t=BigInt(r);return Ez(t,e,qS),[e,jz(t<0n?DS+t:t)]}return[e,jz(r)];case"timestamp":case"u128":return n===lp.ACTIVE&&Ez(r,e,VS),[e,jz(r)];case"felt":case"shortstring":return n===lp.ACTIVE&&Ez(jz(r),e,FS),[e,jz(r)];case"ClassHash":case"ContractAddress":return n===lp.ACTIVE&&Ez(r,e,FS),[e,jz(r)];case"bool":return n===lp.ACTIVE&&CN(PN(r),`Type mismatch for ${e} ${r}`),[e,jz(r)];default:if(n===lp.ACTIVE)throw new Error(`Unsupported type: ${e}`);return[e,jz(r)]}}function Oz(t,e,r,i=lp.LEGACY){const n=t[e]??_z[i].presetTypes[e],[o,a]=n.reduce((([n,o],a)=>{if(void 0===r[a.name]||null===r[a.name]&&"enum"!==a.type)throw new Error(`Cannot encode data: missing data for '${a.name}'`);const s=r[a.name],h={parent:e,key:a.name},[u,l]=zz(t,a.type,s,h,i);return[[...n,u],[...o,l]]}),[["felt"],[Cz(t,e,i)]]);return[o,a]}function Rz(t,e,r,i=lp.LEGACY){return _z[i].hashMethod(Oz(t,e,r,i)[1])}function Pz(t,e){if(!xz(t))throw new Error("Typed data does not match JSON schema");const r=Az(t),{domain:i,hashMethod:n}=_z[r];return n([bI("StarkNet Message"),Rz(t.types,i,t.domain,r),e,Rz(t.types,t.primaryType,t.message,r)])}function Bz(t,e,r,i){const n=xz(t);if(!oI(t)&&!n)throw new Error("message has a wrong format.");if(n&&void 0===i)throw new Error("When providing a TypedData in message parameter, the accountAddress parameter has to be provided.");if(n&&!oI(i))throw new Error("accountAddress shall be a BigNumberish");const o=n?Pz(t,i):FN(t);return Sv(Array.isArray(e)?new Tv(BigInt(e[0]),BigInt(e[1])):e,o,FN(r))}var Dz=class{responseParser;channel;constructor(t){t&&"channel"in t?(this.channel=t.channel,this.responseParser="responseParser"in t?t.responseParser:new yz):(this.channel=new gz({...t,waitMode:!1}),this.responseParser=new yz(t?.feeMarginPercentage))}fetch(t,e,r=0){return this.channel.fetch(t,e,r)}async getChainId(){return this.channel.getChainId()}async getSpecVersion(){return this.channel.getSpecVersion()}async getNonceForAddress(t,e){return this.channel.getNonceForAddress(t,e)}async getBlock(t){return this.channel.getBlockWithTxHashes(t).then(this.responseParser.parseGetBlockResponse)}async getBlockLatestAccepted(){return this.channel.getBlockLatestAccepted()}async getBlockNumber(){return this.channel.getBlockNumber()}async getBlockWithTxHashes(t){return this.channel.getBlockWithTxHashes(t)}async getBlockWithTxs(t){return this.channel.getBlockWithTxs(t)}async waitForBlock(t="pending",e=5e3){if(t===MN.LATEST)return;const r=await this.getBlockNumber(),i=t===MN.PENDING?r+1:Number(FN(t));if(i<=r)return;const{retries:n}=this.channel;let o=n,a=!1;for(;!a;){if(await this.getBlockNumber()===i?a=!0:await ZC(e),o-=1,o<=0)throw new Error(`waitForBlock() timed-out after ${n} tries.`)}}async getL1GasPrice(t){return this.channel.getBlockWithTxHashes(t).then(this.responseParser.parseL1GasPriceResponse)}async getL1MessageHash(t){const e=await this.channel.getTransactionByHash(t);CN("L1_HANDLER"===e.type,"This L2 transaction is not a L1 message.");const{calldata:r,contract_address:i,entry_point_selector:n,nonce:o}=e;return lI([r[0],i,o,n,r.length-1,...r.slice(1)])}async getBlockWithReceipts(t){if(this.channel instanceof aN.RpcChannel)throw new mN("Unsupported method for RPC version");return this.channel.getBlockWithReceipts(t)}getStateUpdate=this.getBlockStateUpdate;async getBlockStateUpdate(t){return this.channel.getBlockStateUpdate(t)}async getBlockTransactionsTraces(t){return this.channel.getBlockTransactionsTraces(t)}async getBlockTransactionCount(t){return this.channel.getBlockTransactionCount(t)}async getPendingTransactions(){const{transactions:t}=await this.getBlockWithTxHashes(MN.PENDING).then(this.responseParser.parseGetBlockResponse);return Promise.all(t.map((t=>this.getTransactionByHash(t))))}async getTransaction(t){return this.channel.getTransactionByHash(t)}async getTransactionByHash(t){return this.channel.getTransactionByHash(t)}async getTransactionByBlockIdAndIndex(t,e){return this.channel.getTransactionByBlockIdAndIndex(t,e)}async getTransactionReceipt(t){const e=await this.channel.getTransactionReceipt(t),r=this.responseParser.parseTransactionReceipt(e);return new wz(r)}async getTransactionTrace(t){return this.channel.getTransactionTrace(t)}async getTransactionStatus(t){return this.channel.getTransactionStatus(t)}async getSimulateTransaction(t,e){return this.channel.simulateTransaction(t,e).then((t=>this.responseParser.parseSimulateTransactionResponse(t)))}async waitForTransaction(t,e){const r=await this.channel.waitForTransaction(t,e);return new wz(r)}async getStorageAt(t,e,r){return this.channel.getStorageAt(t,e,r)}async getClassHashAt(t,e){return this.channel.getClassHashAt(t,e)}async getClassByHash(t){return this.getClass(t)}async getClass(t,e){return this.channel.getClass(t,e).then(this.responseParser.parseContractClassResponse)}async getClassAt(t,e){return this.channel.getClassAt(t,e).then(this.responseParser.parseContractClassResponse)}async getContractVersion(t,e,{blockIdentifier:r=this.channel.blockIdentifier,compiler:i=!0}={}){let n;if(t)n=await this.getClassAt(t,r);else{if(!e)throw Error("getContractVersion require contractAddress or classHash");n=await this.getClass(e,r)}if(LC(n)){if(i){return{cairo:"1",compiler:sT(n.abi).compiler}}return{cairo:"1",compiler:void 0}}return{cairo:"0",compiler:"0"}}async getEstimateFee(t,e,r,i){return this.getInvokeEstimateFee(t,e,r,i)}async getInvokeEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:yN.INVOKE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeclareEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:yN.DECLARE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeployAccountEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:yN.DEPLOY_ACCOUNT,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getEstimateFeeBulk(t,e){return this.channel.getEstimateFee(t,e).then((t=>this.responseParser.parseFeeEstimateBulkResponse(t)))}async invokeFunction(t,e){return this.channel.invoke(t,e)}async declareContract(t,e){return this.channel.declare(t,e)}async deployAccountContract(t,e){return this.channel.deployAccount(t,e)}async callContract(t,e){return this.channel.callContract(t,e)}async estimateMessageFee(t,e){return this.channel.estimateMessageFee(t,e)}async getSyncingStats(){return this.channel.getSyncingStats()}async getEvents(t){return this.channel.getEvents(t)}async verifyMessageInStarknet(t,e,r,i,n){const o=xz(t);if(!oI(t)&&!o)throw new Error("message has a wrong format.");if(!oI(r))throw new Error("accountAddress shall be a BigNumberish");const a=o?Pz(t,r):FN(t),s=i?[i]:["isValidSignature","is_valid_signature"],h=n||{okResponse:[],nokResponse:["0x0","0x00"],error:["argent/invalid-signature","is invalid, with respect to the public key","INVALID_SIG"]};let u;for(const t of s)try{const i=await this.callContract({contractAddress:FN(r),entrypoint:t,calldata:$T.compile({hash:UN(a).toString(),signature:NC(e)})});if(h.nokResponse.includes(i[0].toString()))return!1;if(0===h.okResponse.length||h.okResponse.includes(i[0].toString()))return!0;throw Error("signatureVerificationResponse Error: response is not part of known responses")}catch(t){if(h.error.some((e=>t.message.includes(e))))return!1;u=t}throw Error(`Signature verification Error: ${u}`)}async isClassDeclared(t,e){let r;if(!t.classHash&&"contract"in t){r=function(t){const e={...t};if(LC(t.contract)&&(!t.compiledClassHash&&t.casm&&(e.compiledClassHash=kC(t.casm)),!e.compiledClassHash))throw new Error("Extract compiledClassHash failed, provide (CairoAssembly).casm file or compiledClassHash");if(e.classHash=t.classHash??EC(t.contract),!e.classHash)throw new Error("Extract classHash failed, provide (CompiledContract).json file or classHash");return e}(t).classHash}else{if(!t.classHash)throw Error("contractClassIdentifier type not satisfied");r=t.classHash}try{return await this.getClass(r,e)instanceof Object}catch(t){if(t instanceof mN)return!1;throw t}}async prepareInvocations(t){const e=[];for(const r of t)if(r.type===yN.DECLARE){await this.isClassDeclared("payload"in r?r.payload:r)||e.unshift(r)}else e.push(r);return e}};Xx({},{StarknetIdContract:()=>Kz,StarknetIdIdentityContract:()=>Wz,StarknetIdMulticallContract:()=>Qz,StarknetIdPfpContract:()=>rO,StarknetIdPopContract:()=>nO,StarknetIdVerifierContract:()=>tO,dynamicCallData:()=>hO,dynamicFelt:()=>sO,execution:()=>aO,getStarknetIdContract:()=>Jz,getStarknetIdIdentityContract:()=>Yz,getStarknetIdMulticallContract:()=>Xz,getStarknetIdPfpContract:()=>iO,getStarknetIdPopContract:()=>oO,getStarknetIdVerifierContract:()=>eO,isStarkDomain:()=>uO,useDecoded:()=>Gz,useEncoded:()=>Zz});var $z="abcdefghijklmnopqrstuvwxyz0123456789-",Lz=BigInt($z.length+1),Uz="这来",Fz=BigInt($z.length),qz=BigInt(Uz.length),Vz=BigInt(Uz.length+1);function Hz(t){let e=0;for(;t.endsWith(Uz[Uz.length-1]);)t=t.substring(0,t.length-1),e+=1;return[t,e]}function Gz(t){let e="";return t.forEach((t=>{for(;t!==OS;){const r=t%Lz;if(t/=Lz,r===BigInt($z.length)){const r=t/Vz;if(r===OS){const i=t%Vz;t=r,e+=i===OS?$z[0]:Uz[Number(i)-1]}else{e+=Uz[Number(t%qz)],t/=qz}}else e+=$z[Number(r)]}const[r,i]=Hz(e);i&&(e=r+(i%2==0?Uz[Uz.length-1].repeat(i/2-1)+Uz[0]+$z[1]:Uz[Uz.length-1].repeat((i-1)/2+1))),e+="."})),e?e.concat("stark"):e}function Zz(t){let e=BigInt(0),r=BigInt(1);if(t.endsWith(Uz[0]+$z[1])){const[e,r]=Hz(t.substring(0,t.length-2));t=e+Uz[Uz.length-1].repeat(2*(r+1))}else{const[e,r]=Hz(t);r&&(t=e+Uz[Uz.length-1].repeat(1+2*(r-1)))}for(let i=0;i<t.length;i+=1){const n=t[i],o=$z.indexOf(n),a=BigInt($z.indexOf(n));if(-1!==o)i===t.length-1&&t[i]===$z[0]?(e+=r*Fz,r*=Lz,r*=Lz):(e+=r*a,r*=Lz);else if(-1!==Uz.indexOf(n)){e+=r*Fz,r*=Lz;const o=(i===t.length-1?1:0)+Uz.indexOf(n);e+=r*BigInt(o),r*=qz}}return e}var Kz={MAINNET:"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",TESTNET_SEPOLIA:"0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474"};function Jz(t){switch(t){case"0x534e5f4d41494e":return Kz.MAINNET;case"0x534e5f5345504f4c4941":return Kz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id is not yet deployed on this network")}}var Wz={MAINNET:"0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af",TESTNET_SEPOLIA:"0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda"};function Yz(t){switch(t){case"0x534e5f4d41494e":return Wz.MAINNET;case"0x534e5f5345504f4c4941":return Wz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var Qz="0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970";function Xz(t){switch(t){case"0x534e5f4d41494e":case"0x534e5f5345504f4c4941":return Qz;default:throw new Error("Starknet.id multicall contract is not yet deployed on this network")}}var tO={MAINNET:"0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf",TESTNET_SEPOLIA:"0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566"};function eO(t){switch(t){case"0x534e5f4d41494e":return tO.MAINNET;case"0x534e5f5345504f4c4941":return tO.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var rO={MAINNET:"0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7",TESTNET_SEPOLIA:"0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02"};function iO(t){switch(t){case"0x534e5f4d41494e":return rO.MAINNET;case"0x534e5f5345504f4c4941":return rO.TESTNET_SEPOLIA;default:throw new Error("Starknet.id profile picture verifier contract is not yet deployed on this network")}}var nO={MAINNET:"0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4",TESTNET_SEPOLIA:"0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a"};function oO(t){switch(t){case"0x534e5f4d41494e":return nO.MAINNET;case"0x534e5f5345504f4c4941":return nO.TESTNET_SEPOLIA;default:throw new Error("Starknet.id proof of personhood verifier contract is not yet deployed on this network")}}function aO(t,e,r){return new dT({Static:t,IfEqual:e?lT(e[0],e[1],e[2]):void 0,IfNotEqual:r?lT(r[0],r[1],r[2]):void 0})}function sO(t,e){return new dT({Hardcoded:t,Reference:e?lT(e[0],e[1]):void 0})}function hO(t,e,r){return new dT({Hardcoded:t,Reference:e?lT(e[0],e[1]):void 0,ArrayReference:r?lT(r[0],r[1]):void 0})}function uO(t){return/^(?:[a-z0-9-]{1,48}(?:[a-z0-9-]{1,48}[a-z0-9-])?\.)*[a-z0-9-]{1,48}\.stark$/.test(t)}var lO=class extends(Zx(Dz,class t{async getStarkName(e,r){return t.getStarkName(this,e,r)}async getAddressFromStarkName(e,r){return t.getAddressFromStarkName(this,e,r)}async getStarkProfile(e,r,i,n,o,a,s){return t.getStarkProfile(this,e,r,i,n,o,a,s)}static async getStarkName(t,e,r){const i=await t.getChainId(),n=r??Jz(i);try{const r=await t.callContract({contractAddress:n,entrypoint:"address_to_domain",calldata:$T.compile({address:e,hint:[]})}),i=Gz(r.map((t=>BigInt(t))).slice(1));if(!i)throw Error("Starkname not found");return i}catch(t){if(t instanceof Error&&"Starkname not found"===t.message)throw t;throw Error("Could not get stark name")}}static async getAddressFromStarkName(t,e,r){const i=e.endsWith(".stark")?e:`${e}.stark`;if(!uO(i))throw new Error("Invalid domain, must be a valid .stark domain");const n=await t.getChainId(),o=r??Jz(n);try{const e=i.replace(".stark","").split(".").map((t=>Zz(t).toString(10)));return(await t.callContract({contractAddress:o,entrypoint:"domain_to_address",calldata:$T.compile({domain:e,hint:[]})}))[0]}catch{throw Error("Could not get address from stark name")}}static async getStarkProfile(t,e,r,i,n,o,a,s){const h=await t.getChainId(),u=r??Jz(h),l=i??Yz(h),c=n??eO(h),d=o??iO(h),f=a??oO(h),m=s??Xz(h);try{const r=[{execution:aO({}),to:hO(u),selector:hO(hI("address_to_domain")),calldata:[hO(e),hO("0")]},{execution:aO({}),to:sO(u),selector:sO(hI("domain_to_id")),calldata:[hO(void 0,void 0,[0,0])]},{execution:aO({}),to:sO(l),selector:sO(hI("get_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("twitter")),hO(c),hO("0")]},{execution:aO({}),to:sO(l),selector:sO(hI("get_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("github")),hO(c),hO("0")]},{execution:aO({}),to:sO(l),selector:sO(hI("get_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("discord")),hO(c),hO("0")]},{execution:aO({}),to:sO(l),selector:sO(hI("get_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("proof_of_personhood")),hO(f),hO("0")]},{execution:aO({}),to:sO(l),selector:sO(hI("get_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("nft_pp_contract")),hO(d),hO("0")]},{execution:aO({}),to:sO(l),selector:sO(hI("get_extended_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("nft_pp_id")),hO("2"),hO(d),hO("0")]},{execution:aO(void 0,void 0,[6,0,0]),to:sO(void 0,[6,0]),selector:sO(hI("tokenURI")),calldata:[hO(void 0,[7,1]),hO(void 0,[7,2])]}],i=await t.callContract({contractAddress:m,entrypoint:"aggregate",calldata:$T.compile({calls:r})});if(Array.isArray(i)){const t=parseInt(i[0],16),e=[];let r=1;for(let n=0;n<t&&r<i.length;n+=1){const t=parseInt(i[r],16);r+=1;const n=i.slice(r,r+t);e.push(n),r+=t}const n=Gz(e[0].slice(1).map((t=>BigInt(t)))),o="0x0"!==e[2][0]?BigInt(e[2][0]).toString():void 0,a="0x0"!==e[3][0]?BigInt(e[3][0]).toString():void 0,s="0x0"!==e[4][0]?BigInt(e[4][0]).toString():void 0,h="0x1"===e[5][0],u="0x9"===i[0]?e[8].slice(1).map((t=>kI(t))).join(""):void 0;return{name:n,twitter:o,github:a,discord:s,proofOfPersonhood:h,profilePicture:u||`https://starknet.id/api/identicons/${BigInt(e[1][0]).toString()}`}}throw Error("Error while calling aggregate function")}catch(t){if(t instanceof Error)throw t;throw Error("Could not get user stark profile data from address")}}})){},cO=new Dz({default:!0}),dO={};function fO(t){return new zI(t).toBigInt()}function mO(t){return zI.is(t)}function pO(t){return new zI(t).toUint256HexString()}function gO(t){const e=function(t){const e=FN(jS(t.toString()));return jS(AS(e).padStart(64,"0"))}(t);if(!e.match(/^(0x)?[0-9a-fA-F]{64}$/))throw new Error("Invalid Address Format");return KN(e,OS,LS-1n,"Starknet Address"),e}Xx(dO,{UINT_128_MAX:()=>jI,UINT_256_MAX:()=>xI,bnToUint256:()=>pO,isUint256:()=>mO,uint256ToBN:()=>fO});function yO(t){return"event"===t.type}function wO(t){const e=t.filter((t=>yO(t)&&"struct"===t.kind)),r=t.filter((t=>yO(t)&&"enum"===t.kind)),i=e.reduce(((t,e)=>{let i=[],{name:n}=e,o=!1;const a=t=>t.type===n;for(;;){const t=r.find((t=>t.variants.some(a)));if(ON(t))break;const e=t.variants.find(a);i.unshift(e.name),"flat"===e.kind&&(o=!0),n=t.name}if(0===i.length)throw new Error("inconsistency in ABI events definition.");o&&(i=[i[i.length-1]]);const s=i.pop();let h={[jS(Gv(bS(s)).toString(16))]:e};for(;i.length>0;)h={[jS(Gv(bS(i.pop())).toString(16))]:h};return h={...h},bO(t,h)}),{});return i}function vO(t){return oT(t)?wO(t):function(t){return t.filter((t=>"event"===t.type)).reduce(((t,e)=>{const r=e.name,i={...e};return i.name=r,{...t,[jS(Gv(bS(r)).toString(16))]:i}}),{})}(t)}function bO(t,e){const r={...t};return $N(t)&&$N(e)&&Object.keys(e).forEach((i=>{$N(e[i])?i in t?r[i]=bO(t[i],e[i]):Object.assign(r,{[i]:e[i]}):Object.assign(r,{[i]:e[i]})})),r}function kO(t,e,r,i){const n=t.flat().reduce(((t,n)=>{let o=e[n.keys.shift()??0];if(!o)return t;for(;!o.name;){const t=n.keys.shift();CN(!!t,'Not enough data in "keys" property of this event.'),o=o[t]}const a={};a[o.name]={};const s=n.keys[Symbol.iterator](),h=n.data[Symbol.iterator](),u=o.members?.filter((t=>"key"===t.kind))||o.keys,l=o.members?.filter((t=>"data"===t.kind))||o.data;return u.forEach((t=>{a[o.name][t.name]=IT(s,t,r,i,a[o.name])})),l.forEach((t=>{a[o.name][t.name]=IT(h,t,r,i,a[o.name])})),"block_hash"in n&&(a.block_hash=n.block_hash),"block_number"in n&&(a.block_number=n.block_number),"transaction_hash"in n&&(a.transaction_hash=n.transaction_hash),t.push(a),t}),[]);return n}function MO(t){if(!t.events?.length)throw new Error("UDC emitted event is empty");const e=t.events.find((t=>ZN(t.from_address)===ZN(WS.ADDRESS)))||{data:[]};return{transaction_hash:t.transaction_hash,contract_address:e.data[0],address:e.data[0],deployer:e.data[1],unique:e.data[2],classHash:e.data[3],calldata_len:e.data[4],calldata:e.data.slice(5,5+parseInt(e.data[4],16)),salt:e.data[e.data.length-1]}}Xx({},{getAbiEvents:()=>vO,isAbiEvent:()=>yO,parseEvents:()=>kO,parseUDCEvent:()=>MO});function _O(t){const e=t.calldata??[],r=Array.isArray(e)?e:$T.compile(e);return{to:t.contractAddress,selector:hI(t.entrypoint),calldata:r}}function EO(t,e){const r=_O(t);return"1"===e?{...r,calldata_len:r.calldata.length,calldata:r.calldata}:{To:r.to,Selector:r.selector,Calldata:r.calldata}}function AO(t,e){return{name:"Account.execute_from_outside",version:e,chainId:t,..."2"===e?{revision:"1"}:{}}}function jO(t,e,r,i,n){return"1"===n?{types:SN,primaryType:"OutsideExecution",domain:AO(t,n),message:{...e,nonce:r,calls_len:i.length,calls:i.map((t=>EO(t,n)))}}:{types:NN,primaryType:"OutsideExecution",domain:AO(t,n),message:{Caller:e.caller,Nonce:r,"Execute After":e.execute_after,"Execute Before":e.execute_before,Calls:i.map((t=>EO(t,n)))}}}function xO(t){const e=t.outsideExecution,r=NC(t.signature);return $T.compile({outside_execution:e,signature:r})}function SO(t){return(Array.isArray(t)?t:[t]).map((t=>{let e;if("1"===t.version)e="execute_from_outside";else{if("2"!==t.version)throw new Error("Unsupported OutsideExecution version");e="execute_from_outside_v2"}return{contractAddress:FN(t.signerAddress),entrypoint:e,calldata:xO(t)}}))}Xx({},{buildExecuteFromOutsideCall:()=>SO,buildExecuteFromOutsideCallData:()=>xO,getOutsideCall:()=>_O,getTypedData:()=>jO});async function NO(t,e,r){const i={contractAddress:FN(e),entrypoint:"supports_interface",calldata:[FN(r)]};try{const e=await t.callContract(i);return 0n!==BigInt(e[0])}catch{return!1}}Xx({},{supportsInterface:()=>NO});function IO(t,e=!1){return t.request({type:"wallet_requestAccounts",params:{silent_mode:e}})}function TO(t){return t.request({type:"wallet_getPermissions"})}function CO(t,e){return t.request({type:"wallet_watchAsset",params:e})}function zO(t,e){return t.request({type:"wallet_addStarknetChain",params:e})}function OO(t,e){return t.request({type:"wallet_switchStarknetChain",params:{chainId:e}})}function RO(t){return t.request({type:"wallet_requestChainId"})}function PO(t){return t.request({type:"wallet_deploymentData"})}function BO(t,e){return t.request({type:"wallet_addInvokeTransaction",params:e})}function DO(t,e){return t.request({type:"wallet_addDeclareTransaction",params:e})}function $O(t,e){return t.request({type:"wallet_signTypedData",params:e})}function LO(t){return t.request({type:"wallet_supportedSpecs"})}function UO(t,e){t.on("accountsChanged",e)}function FO(t,e){t.on("networkChanged",e)}Xx({},{addDeclareTransaction:()=>DO,addInvokeTransaction:()=>BO,addStarknetChain:()=>zO,deploymentData:()=>PO,getPermissions:()=>TO,onAccountChange:()=>UO,onNetworkChanged:()=>FO,requestAccounts:()=>IO,requestChainId:()=>RO,signMessage:()=>$O,supportedSpecs:()=>LO,switchStarknetChain:()=>OO,watchAsset:()=>CO});var qO=t=>{const e=t[t.length-1];return"object"==typeof e&&["blockIdentifier","parseRequest","parseResponse","formatResponse","maxFee","nonce","signature","addressSalt"].some((t=>t in e))?{args:t,options:t.pop()}:{args:t}};function VO(t,e){return async function(...r){const i=qO(r);return t.call(e.name,i.args,{parseRequest:!0,parseResponse:!0,...i.options})}}function HO(t,e){return"view"===e.stateMutability||"view"===e.state_mutability?VO(t,e):function(t,e){return async function(...r){const i=qO(r);return t.invoke(e.name,i.args,{parseRequest:!0,...i.options})}}(t,e)}function GO(t,e){return function(...r){return t.estimate(e.name,r)}}function ZO(t,e){return Array.isArray(t)&&"__compiled__"in t?t:Array.isArray(t)&&Array.isArray(t[0])&&"__compiled__"in t[0]?t[0]:e()}var KO=class{abi;address;providerOrAccount;deployTransactionHash;structs;events;functions;callStatic;populateTransaction;estimateFee;callData;constructor(t,e,r=cO){this.address=e&&e.toLowerCase(),this.providerOrAccount=r,this.callData=new $T(t),this.structs=$T.getAbiStruct(t),this.events=vO(t);const i=bT(t);this.abi=i.getLegacyFormat();const n={enumerable:!0,value:{},writable:!1};Object.defineProperties(this,{functions:{enumerable:!0,value:{},writable:!1},callStatic:{enumerable:!0,value:{},writable:!1},populateTransaction:{enumerable:!0,value:{},writable:!1},estimateFee:{enumerable:!0,value:{},writable:!1}}),this.abi.forEach((t=>{if("function"!==t.type)return;const e=t.name;var r,i;this[e]||Object.defineProperty(this,e,{...n,value:HO(this,t)}),this.functions[e]||Object.defineProperty(this.functions,e,{...n,value:HO(this,t)}),this.callStatic[e]||Object.defineProperty(this.callStatic,e,{...n,value:VO(this,t)}),this.populateTransaction[e]||Object.defineProperty(this.populateTransaction,e,{...n,value:(r=this,i=t,function(...t){return r.populate(i.name,t)})}),this.estimateFee[e]||Object.defineProperty(this.estimateFee,e,{...n,value:GO(this,t)})}))}attach(t){this.address=t}connect(t){this.providerOrAccount=t}async deployed(){return this.deployTransactionHash&&(await this.providerOrAccount.waitForTransaction(this.deployTransactionHash),this.deployTransactionHash=void 0),this}async call(t,e=[],{parseRequest:r=!0,parseResponse:i=!0,formatResponse:n,blockIdentifier:o}={}){CN(null!==this.address,"contract is not connected to an address");const a=ZO(e,(()=>r?(this.callData.validate(_N.CALL,t,e),this.callData.compile(t,e)):(GC.warn("Call skipped parsing but provided rawArgs, possible malfunction request"),e)));return this.providerOrAccount.callContract({contractAddress:this.address,calldata:a,entrypoint:t},o).then((e=>i?n?this.callData.format(t,e,n):this.callData.parse(t,e):e))}invoke(t,e=[],{parseRequest:r=!0,maxFee:i,nonce:n,signature:o}={}){CN(null!==this.address,"contract is not connected to an address");const a=ZO(e,(()=>r?(this.callData.validate(_N.INVOKE,t,e),this.callData.compile(t,e)):(GC.warn("Invoke skipped parsing but provided rawArgs, possible malfunction request"),e))),s={contractAddress:this.address,calldata:a,entrypoint:t};if("execute"in this.providerOrAccount)return this.providerOrAccount.execute(s,void 0,{maxFee:i,nonce:n});if(!n)throw new Error("Nonce is required when invoking a function without an account");return GC.warn(`Invoking ${t} without an account. This will not work on a public node.`),this.providerOrAccount.invokeFunction({...s,signature:o},{nonce:n})}async estimate(t,e=[]){CN(null!==this.address,"contract is not connected to an address"),ZO(e,(()=>!1))||this.callData.validate(_N.INVOKE,t,e);const r=this.populate(t,e);if("estimateInvokeFee"in this.providerOrAccount)return this.providerOrAccount.estimateInvokeFee(r);throw Error("Contract must be connected to the account contract to estimate")}populate(t,e=[]){const r=ZO(e,(()=>this.callData.compile(t,e)));return{contractAddress:this.address,entrypoint:t,calldata:r}}parseEvents(t){let e;return t.match({success:t=>{const r=t.events?.map((e=>({block_hash:t.block_hash,block_number:t.block_number,transaction_hash:t.transaction_hash,...e}))).filter((t=>ZN(t.from_address)===ZN(this.address)),[])||[];e=kO(r,this.events,this.structs,$T.getAbiEnum(this.abi))},_:()=>{throw Error("This transaction was not successful.")}}),e}isCairo1(){return EI.isCairo1Abi(this.abi)}async getVersion(){return this.providerOrAccount.getContractVersion(this.address)}typedv2(t){return this}},JO={1:{key:"1",name:"Ethereum",chainId:1,network:"homestead",multicall:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",ensResolvers:["0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63","0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"],ensNameWrapper:"0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",ensSubgraph:"https://subgrapher.snapshot.org/subgraph/arbitrum/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH",rpc:["https://rpc.ankr.com/eth",{url:"https://api-geth-archive.ankr.com",user:"balancer_user",password:"balancerAnkr20201015"},"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive","https://apis.ankr.com/e62bc219f9c9462b8749defe472d2dc5/6106d4a3ec1d1bcc87ec72158f8fd089/eth/archive/main","https://eth-archival.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://eth-mainnet.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],light:["https://cloudflare-eth.com"],ws:["wss://eth-mainnet.ws.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],explorer:{url:"https://etherscan.io",apiUrl:"https://api.etherscan.io"},start:7929876,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},8:{key:"8",name:"Ubiq",chainId:8,network:"Ubiq",multicall:"0x6668750957e4083725926B71C41bDF1434C73262",rpc:["https://rpc.octano.dev"],ws:["wss://ws.octano.dev"],explorer:{url:"https://ubiqscan.io"},start:1,logo:"ipfs://Qmec3HLoN4QhwZAhw4XTi2aN8Wwmcko5hHN22sHARzb9tw"},10:{key:"10",name:"OP Mainnet",chainId:10,network:"OP Mainnet",multicall:"0x35A6Cdb2C9AD4a45112df4a04147EB07dFA01aB7",rpc:["https://opt-mainnet.g.alchemy.com/v2/JzmIL4Q3jBj7it2duxLFeuCa9Wobmm7D"],explorer:{url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io"},start:657806,logo:"ipfs://bafkreifu2remiqfpsb4hgisbwb3qxedrzpwsea7ik4el45znjcf56xf2ku"},19:{key:"19",name:"Songbird Canary-Network",shortName:"Songbird",chainId:19,network:"songbird",multicall:"0x17032Ea9c3a13Ed337665145364c0d2aD1108c91",rpc:["https://songbird-api.flare.network/ext/C/rpc"],explorer:{url:"https://songbird-explorer.flare.network"},start:21807126,logo:"ipfs://QmXyvnrZY8FUxSULfnKKA99sAEkjAHtvhRx5WeHixgaEdu"},24:{key:"24",name:"KardiaChain Mainnet",shortName:"KAI",chainId:24,network:"mainnet",multicall:"0xd9c92F2287B7802A37eC9BEce96Aa65fb5f31E1b",rpc:["https://kai-internal.kardiachain.io"],explorer:{url:"https://explorer.kardiachain.io"},start:8260245,logo:"ipfs://bafkreig73yfyqzbxydv6e3dbj5nks3f57px2iez7tywayey4rilfhhrr34"},25:{key:"25",name:"Cronos",shortName:"Cronos",chainId:25,network:"mainnet",multicall:"0x6F522a3982e8F9A50A2EDc9E46ed1A3aE2B3FD3a",rpc:["https://evm-cronos.crypto.org"],explorer:{url:"https://cronos.crypto.org/explorer"},start:4067,logo:"ipfs://QmfSJbtirJoa3Pt7o5Fdm85wbyw9V1hpzqLr5PQbdnfsAj"},30:{key:"30",name:"RSK",chainId:30,network:"rsk mainnet",multicall:"0x4eeebb5580769ba6d26bfd07be636300076d1831",rpc:["https://public-node.rsk.co"],explorer:{url:"https://explorer.rsk.co"},start:2516442,logo:"ipfs://QmXTwpE1SqoNZmyY4c3fYWy6qUgQELsyWKbgJo2Pg6K6V9"},46:{key:"46",name:"Darwinia Network",shortName:"Darwinia",chainId:46,network:"mainnet",multicall:"0x67f9ae42EaA9a8aBf065D60ec6Ab3C1A11370607",rpc:["https://rpc.darwinia.network"],explorer:{url:"https://darwinia.subscan.io"},start:141853,logo:"ipfs://bafkreicf55maidhx46pyu3mwsshlr43xbewr6tkckkonh4nesbkp7krwkm"},56:{key:"56",name:"BNB Smart Chain",shortName:"BSC",chainId:56,network:"mainnet",multicall:"0x1ee38d535d541c55c9dae27b12edf090c608e6fb",rpc:["https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive","https://rpc.ankr.com/bsc","https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7","https://bsc-private-dataseed1.nariox.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed1.binance.org"],explorer:{url:"https://bscscan.com"},start:461230,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},61:{key:"61",name:"Ethereum Classic",shortName:"Ethereum Classic",chainId:61,network:"mainnet",multicall:"0x51be3a92C56ae7E207C5b5Fd87F7798Ce82C1AC2",rpc:["https://www.ethercluster.com/etc"],explorer:{url:"https://blockscout.com/etc/mainnet"},start:13307544,logo:"ipfs://QmVegc28DvA7LjKUFysab81c9BSuN4wQVDQkRXyAtuEBis"},66:{key:"66",name:"OKExChain",shortName:"OEC Mainnet",chainId:66,network:"oec mainnet",multicall:"0x6EB187d8197Ac265c945b69f3c3064A6f3831866",rpc:["https://exchainrpc.okex.org"],ws:["wss://exchainws.okex.org:8443"],explorer:{url:"https://www.oklink.com/okexchain"},start:5076543,logo:"ipfs://Qmd7dKnNwHRZ4HRCbCXUbkNV7gP28fGqPdjbHtjRtT9sQF"},75:{key:"75",name:"Decimal",shortName:"mainnet",chainId:75,network:"mainnet",multicall:"0x949d1A0757803C51F2EfFFEb5472C861A898B8E8",rpc:[],explorer:{url:"https://explorer.decimalchain.com"},start:16031065,logo:"ipfs://bafkreihkdhbce5rkogl63xegaarlirjrvbfarxbtbf5mqme3s5grvbjyxm"},81:{key:"81",name:"Shibuya Network",shortName:"Shibuya",chainId:81,network:"testnet",testnet:!0,multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shibuya.astar.network:8545"],explorer:{url:"https://blockscout.com/shibuya"},start:856303,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},82:{key:"82",name:"Meter",shortName:"Meter",chainId:82,network:"mainnet",multicall:"0x579De77CAEd0614e3b158cb738fcD5131B9719Ae",rpc:["https://rpc.meter.io"],explorer:{url:"https://scan.meter.io"},start:4992871,logo:"ipfs://QmSZvT9w9eUDvV1YVaq3BKKEbubtNVqu1Rin44FuN4wz11"},97:{key:"97",name:"BNB Smart Chain Testnet",shortName:"BSC Testnet",chainId:97,network:"testnet",testnet:!0,multicall:"0x8b54247c6BAe96A6ccAFa468ebae96c4D7445e46",rpc:["https://data-seed-prebsc-1-s1.binance.org:8545","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/bsc/testnet/archive"],explorer:{url:"https://testnet.bscscan.com"},start:3599656,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},100:{key:"100",name:"Gnosis Chain",shortName:"xDAI",chainId:100,network:"mainnet",multicall:"0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a",rpc:["https://gno.getblock.io/mainnet/6c1d1e6e-75d9-452f-a863-a694bff93d5c/","https://xdai-archive.blockscout.com","https://poa-xdai.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://rpc.gnosischain.com"],light:["https://rpc.gnosischain.com"],ws:["wss://rpc.xdaichain.com/wss"],explorer:{url:"https://gnosis.blockscout.com"},start:4108192,logo:"ipfs://QmZeiy8Ax4133wzxUQM9ky8z5XFVf6YLFjJMmTWbWVniZR"},108:{key:"108",name:"Thundercore",chainId:108,network:"mainnet",multicall:"0x3017086deef56679e267f67f66c4415109b7a97f",rpc:["https://mainnet-rpc.thundercore.com/archived/SNAPSHOTEuR82a75fLYA"],explorer:{url:"https://viewblock.io/thundercore"},start:94425385,logo:"ipfs://bafkreifc5z5vtvqx2luzgateyvoocwpd2ifv2hwufxdnyl2a767wa6icli"},109:{key:"109",name:"Shibarium",shortName:"mainnet",chainId:109,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://shibariumscan.io"},start:3485946,logo:"ipfs://bafkreig57igai5phg4icywc5yoockd52jo3hlvbkyi6wiufrmu4p2lmenm"},122:{key:"122",name:"Fuse",shortName:"Fuse",chainId:122,network:"mainnet",multicall:"0x7a59441fb06666F6d2D766393d876945D06a169c",rpc:["https://explorer-node.fuse.io/","https://oefusefull1.liquify.info/"],explorer:{url:"https://explorer.fuse.io"},start:11923459,logo:"ipfs://QmXjWb64nako7voaVEifgdjAbDbswpTY8bghsiHpv8yWtb"},137:{key:"137",name:"Polygon PoS",shortName:"Polygon",chainId:137,network:"mainnet",multicall:"0xCBca837161be50EfA5925bB9Cc77406468e76751",rpc:["https://rpc.ankr.com/polygon","https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/polygon/mainnet/archive","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mainnet/archive","https://rpc-mainnet.maticvigil.com/v1/1cfd7598e5ba6dcf0b4db58e8be484badc6ea08e"],ws:["wss://ws-mainnet.matic.network"],explorer:{url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com"},start:9834491,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},144:{key:"144",name:"PHI Network",shortName:"PHI",chainId:144,network:"mainnet",multicall:"0xc2f41B404a6757863AAeF49ff93039421acCd630",rpc:["https://connect.phi.network"],explorer:{url:"https://phiscan.com"},start:360030,logo:"ipfs://bafkreid6pm3mic7izp3a6zlfwhhe7etd276bjfsq2xash6a4s2vmcdf65a"},146:{key:"146",name:"Sonic",shortName:"mainnet",chainId:146,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.soniclabs.com"},start:60,logo:"ipfs://bafkreic5fffatwy2gzf6y5iymje6ijii43tz4wlxl35da36guurhibjx44"},148:{key:"148",name:"ShimmerEVM",shortName:"ShimmerEVM",chainId:148,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.evm.shimmer.network"},start:1290,logo:"ipfs://bafkreib4xhbgbhrwkmizp4d4nz3wzbpyhdm6wpz2v2pbkk7jxsgg3hdt74"},157:{key:"157",name:"Shibarium Puppynet Testnet",shortName:"testnet",chainId:157,network:"testnet",multicall:"0xA4029b74FBA366c926eDFA7Dd10B21C621170a4c",rpc:[],explorer:{url:"https://puppyscan.shib.io"},start:3035769,logo:"ipfs://bafkreig57igai5phg4icywc5yoockd52jo3hlvbkyi6wiufrmu4p2lmenm",testnet:!0},169:{key:"169",name:"Manta Pacific",shortName:"Manta",chainId:169,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://www.oklink.com/manta"},start:332890,logo:"ipfs://bafkreibbrwgwdcfh755dqh4ndta6tja77qbaa36bfv4pstub6prhhore7a"},204:{key:"204",name:"opBNB",shortName:"mainnet",chainId:204,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"http://opbnbscan.com"},start:512881,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},246:{key:"246",name:"Energy Web Chain",shortName:"EWC",chainId:246,network:"mainnet",multicall:"0x0767F26d0D568aB61A98b279C0b28a4164A6f05e",rpc:["https://voting-rpc.carbonswap.exchange"],explorer:{url:"https://explorer.energyweb.org"},start:12086501,logo:"ipfs://Qmai7AGHgs8NpeGeXgbMZz7pS2i4kw44qubCJYGrZW2f3a"},250:{key:"250",name:"Fantom Opera",shortName:"fantom",chainId:250,network:"Mainnet",multicall:"0x7f6A10218264a22B4309F3896745687E712962a0",rpc:["https://rpc.ankr.com/fantom","https://rpc.ftm.tools","https://rpcapi.fantom.network"],explorer:{url:"https://ftmscan.com"},start:2497732,logo:"ipfs://QmVEgNeQDKnXygeGxfY9FywZpNGQu98ktZtRJ9bToYF6g7"},252:{key:"252",name:"Fraxtal",shortName:"mainnet",chainId:252,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://fraxscan.com"},start:1,logo:"ipfs://bafkreieflj4wq6tx7k5kq47z3xnsrdrn2xgm4bxa3uovrnndcb2vqqwlyu"},269:{key:"269",name:"High Performance Blockchain",shortName:"HPB",chainId:269,network:"mainnet",multicall:"0x67D0f263aef2F6167FA77353695D75b582Ff4Bca",rpc:["https://hpbnode.com"],ws:["wss://ws.hpbnode.com"],explorer:{url:"https://hscan.org"},start:13960096,logo:"ipfs://QmU7f1MyRz8rLELFfypnWZQjGbDGYgZtC9rjw47jYMYrnu"},296:{key:"296",name:"Hedera Testnet",shortName:"testnet",chainId:296,network:"testnet",multicall:"0xADE3166b0afA89b2CDB64870D70ADeD330Eab015",rpc:[],explorer:{url:"https://hashscan.io/testnet"},start:17561901,logo:"ipfs://bafkreia5gpitwgo4sspvvtwqcxosq2krrqo5dbrnvylgibvmypzotfmbuu",testnet:!0},300:{key:"300",name:"zkSync Sepolia Testnet",shortName:"testnet",chainId:300,network:"testnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:[],explorer:{url:"https://sepolia.explorer.zksync.dev"},start:2292,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy",testnet:!0},314:{key:"314",name:"Filecoin",shortName:"mainnet",chainId:314,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://filfox.io"},start:3328594,logo:"ipfs://bafybeibyvjfmk6aqlfdrczvth55jkmnoadtrch7ht3rdmvqmy2bfxynecm"},321:{key:"321",name:"KCC",shortName:"KCC",chainId:321,network:"mainnet",multicall:"0xa64D6AFb48225BDA3259246cfb418c0b91de6D7a",rpc:["https://rpc-mainnet.kcc.network"],ws:["wss://rpc-ws-mainnet.kcc.network"],explorer:{url:"https://explorer.kcc.io"},start:1487453,logo:"ipfs://QmRdzYGhFRG8QLzMJahHrw3vETE2YZ9sywQbEkenSjKEvb"},324:{key:"324",name:"zkSync Era",shortName:"zkSync-era",chainId:324,network:"zkSync Era Mainnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:["https://mainnet.era.zksync.io"],explorer:{url:"https://explorer.zksync.io"},start:3908235,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy"},336:{key:"336",name:"Shiden Network",shortName:"Shiden",chainId:336,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shiden.astar.network:8545","https://shiden.api.onfinality.io/public"],explorer:{url:"https://blockscout.com/shiden"},start:1170016,logo:"ipfs://QmcqGQE4Sk73zXc3e91TUFFefKBVeaNgbxV141XkSNE4xj"},369:{key:"369",name:"Pulsechain",shortName:"Pulsechain",chainId:369,network:"mainnet",multicall:"0xdbdd0FD8B16F0092f306392b699D7fbddaA9011B",rpc:["https://rpc.pulsechain.com"],explorer:{url:"https://scan.pulsechain.com"},start:17657774,logo:"ipfs://QmWUsiEWdejtHZ9B9981TYXn7Ds8C7fkB1S4h5rP3kCCZR"},416:{key:"416",name:"SX Network",shortName:"SX",chainId:416,network:"mainnet",multicall:"0x834a005DDCF990Ba1a79f259e840e58F2D14F49a",rpc:["https://rpc.sx.technology"],ws:["wss://rpc.sx.technology/ws"],explorer:{url:"https://explorer.sx.technology"},start:2680605,logo:"ipfs://QmSXLXqyr2H6Ja5XrmznXbWTEvF2gFaL8RXNXgyLmDHjAF"},592:{key:"592",name:"Astar Network",shortName:"Astar",chainId:592,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://astar.api.onfinality.io/public","https://rpc.astar.network:8545"],explorer:{url:"https://blockscout.com/astar"},start:366482,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},813:{key:"813",name:"Qitmeer",shortName:"MEER",chainId:813,network:"mainnet",multicall:"0x55034b2cF530ae3A8fC1e2e4523F58496796610F",rpc:["https://evm-dataseed1.meerscan.io","https://evm-dataseed.meerscan.com","https://evm-dataseed2.meerscan.io","https://evm-dataseed3.meerscan.io"],explorer:{url:"https://evm.meerscan.io"},start:43317,logo:"ipfs://QmXvum7SNVaAqAc2jNzR1NpNZN1GGvNaKWydg8a1GEDQ7y"},841:{key:"841",name:"Taraxa",shortName:"841",chainId:841,network:"mainnet",multicall:"0xFCe7a3121B42664AaD145712e1c2Bf2e38f60AA1",rpc:["https://rpc.mainnet.taraxa.io"],ws:["wss://ws.mainnet.taraxa.io"],explorer:{url:"https://mainnet.explorer.taraxa.io"},start:1515906,logo:"ipfs://Qmcc6ZCAGESMzZzoj5LsTVcCo2E35x3Ydk71uPJyov6Mwx"},888:{key:"888",name:"Wanchain",chainId:888,network:"mainnet",multicall:"0xba5934ab3056fca1fa458d30fbb3810c3eb5145f",rpc:["https://gwan-ssl.wandevs.org:56891"],ws:["wss://api.wanchain.org:8443/ws/v3/ddd16770c68f30350a21114802d5418eafe039b722de52b488e7eee1ee2cd73f"],explorer:{url:"https://www.wanscan.org"},start:11302663,logo:"ipfs://QmewFFN44rkxESFsHG8edaLt1znr62hjvZhGynfXqruzX3"},1001:{key:"1001",name:"Kaia Kairos Testnet",shortName:"kaia-kairos",chainId:1001,network:"testnet",testnet:!0,multicall:"0x40643B8Aeaaca0b87Ea1A1E596e64a0e14B1d244",rpc:["https://archive-en-kairos.node.kaia.io"],ws:["wss://archive-en-kairos.node.kaia.io/ws"],explorer:{url:"https://kairos.kaiascan.com"},start:87232478,logo:"ipfs://bafkreifm6l67f4blcv7qwuszalwoxzptt5ad2f3t472lytr3d2hmi626ju"},1072:{key:"1072",name:"Shimmer EVM Testnet",shortName:"ShimmerEVM",chainId:1072,network:"testnet",testnet:!0,multicall:"0x751d21047C116413895c259f3f305e38C10B7cF6",rpc:["https://archive.evm.testnet.shimmer.network/v1/chains/rms1pr75wa5xuepg2hew44vnr28wz5h6n6x99zptk2g68sp2wuu2karywgrztx3/evm"],explorer:{url:"https://explorer.evm.testnet.shimmer.network"},start:10614,logo:"ipfs://bafkreihtwfwrue7klzedwx4rqlk6agklz4lbbk7owsyw6xzn6c2m4t5tgy"},1088:{key:"1088",name:"Metis",shortName:"metis",chainId:1088,network:"mainnet",multicall:"0xc39aBB6c4451089dE48Cffb013c39d3110530e5C",rpc:["https://andromeda.metis.io/?owner=1088"],explorer:{url:"https://andromeda-explorer.metis.io"},start:451,logo:"ipfs://bafkreiaqr4atnjpdnk3c4vu4377ai7bzqpgaefefbl5j5imfsvr4puimtu"},1101:{key:"1101",name:"Polygon zkEVM",shortName:"mainnet",chainId:1101,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://zkevm.polygonscan.com"},start:57746,logo:"ipfs://bafkreibfiyvhqnme2vbxxfcku7qkxgjpkg6ywdkplxh4oxlkqsbznyorfm"},1116:{key:"1116",name:"Core Chain",shortName:"Core",chainId:1116,network:"mainnet",multicall:"0x024f0041b76B598c2A0a75004F8447FaF67BD004",rpc:["https://rpcar.coredao.org/"],explorer:{url:"https://scan.coredao.org"},start:853908,logo:"ipfs://bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu"},1284:{key:"1284",name:"Moonbeam",shortName:"GLMR",chainId:1284,network:"mainnet",multicall:"0x83e3b61886770de2F64AAcaD2724ED4f08F7f36B",rpc:["https://rpc.api.moonbeam.network"],explorer:{url:"https://moonscan.io"},start:171135,logo:"ipfs://QmWKTEK2pj5sBBbHnMHQbWgw6euVdBrk2Ligpi2chrWASk"},1285:{key:"1285",name:"Moonriver (Kusama)",shortName:"Moonriver",chainId:1285,network:"mainnet",multicall:"0x537004440ffFE1D4AE9F009031Fc2b0385FCA9F1",rpc:["https://rpc.api.moonriver.moonbeam.network"],explorer:{url:"https://blockscout.moonriver.moonbeam.network"},start:413539,logo:"ipfs://QmXtgPesL87Ejhq2Y7yxsaPYpf4RcnoTYPJWPcv6iiYhoi"},1287:{key:"1287",name:"Moonbase Alpha TestNet",shortName:"Moonbase",chainId:1287,network:"testnet",testnet:!0,multicall:"0xf09FD6B6FF3f41614b9d6be2166A0D07045A3A97",rpc:["https://rpc.testnet.moonbeam.network"],explorer:{url:"https://moonbase-blockscout.testnet.moonbeam.network"},start:859041,logo:"ipfs://QmeGbNTU2Jqwg8qLTMGW8n8HSi2VdgCncAaeGzLx6gYnD7"},1315:{key:"1315",name:"Story Aeneid Testnet",shortName:"testnet",chainId:1315,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://aeneid.storyscan.io"},start:1792,logo:"ipfs://bafkreiaicdywqkmej6htv4e4lnq5fzajb3qfoxslkrbf5byvqc2aalxcne",testnet:!0},1328:{key:"1328",name:"Sei atlantic testnet",shortName:"testnet",chainId:1328,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://seitrace.com"},start:96978658,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},1329:{key:"1329",name:"Sei",shortName:"mainnet",chainId:1329,network:"mainnet",multicall:"0xe033Bed7cae4114Af84Be1e9F1CA7DEa07Dfe1Cf",rpc:[],explorer:{url:"https://seitrace.com"},start:79164574,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq"},1480:{key:"1480",name:"Vana",shortName:"mainnet",chainId:1480,network:"mainnet",multicall:"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E",rpc:[],explorer:{url:"https://islander.vanascan.io"},start:716763,logo:"ipfs://bafkreibotel3dmc5og5rf3tpt7l74awkene7x6q3oxtwhptt4y4rpa7vsa"},1514:{key:"1514",name:"Story",shortName:"mainnet",chainId:1514,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://www.storyscan.io"},start:340998,logo:"ipfs://bafkreiaicdywqkmej6htv4e4lnq5fzajb3qfoxslkrbf5byvqc2aalxcne"},1559:{key:"1559",name:"Tenet",shortName:"tenet",chainId:1559,network:"mainnet",multicall:"0xcCB3F00bE353950E4C08501ac8Af48765EAAa738",rpc:[],explorer:{url:"https://tenetscan.io"},start:944415,logo:"ipfs://Qmc1gqjWTzNo4pyFSGtQuCu7kRSZZBUVybtTjHn2nNEEPA"},1663:{key:"1663",name:"Horizen Gobi Testnet",shortName:"Gobi",chainId:1663,network:"testnet",testnet:!0,multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:["https://gobi-testnet.horizenlabs.io/ethv1"],explorer:{url:"https://gobi-explorer.horizen.io"},start:1,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},2e3:{key:"2000",name:"Doge Chain",shortName:"dogechain",chainId:2e3,network:"mainnet",multicall:"0x6f9D3f3932B417bd4957585D236Cbc32b32C0BDc",rpc:["https://rpc.dogechain.dog"],explorer:{url:"https://explorer.dogechain.dog"},start:877115,logo:"ipfs://bafkreigovfh3pinsdih777issfgaflwu2yjzroljs2642gbvwikcd3nm4i"},2109:{key:"2109",name:"Exosama Network",shortName:"EXN",chainId:2109,network:"mainnet",multicall:"0x2feFC828e2fEfdE0C9f7740919c6A9139F886067",rpc:["https://rpc.exosama.com"],explorer:{url:"https://explorer.exosama.com"},start:94085,logo:"ipfs://QmaQxfwpXYTomUd24PMx5tKjosupXcm99z1jL1XLq9LWBS"},2152:{key:"2152",name:"Findora",shortName:"Findora",chainId:2152,network:"mainnet",multicall:"0xCF7D1e21CBe9bdEF235aef06C5d8051B3d4DF0f5",rpc:["https://archive.prod.findora.org:8545/"],explorer:{url:"https://evm.findorascan.io"},start:4219343,logo:"ipfs://QmXkneyRB6HbHTHRLCZpZqSsawiyJY7b2kZ2V8ydvKYAgv"},2192:{key:"2192",name:"SnaxChain",shortName:"mainnet",chainId:2192,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.snaxchain.io"},start:1554893,logo:"ipfs://bafkreibzz757piho2llzkbiszpvalf5k5hpmxcwhvrmgp7vpz2vp4vj7ly"},2221:{key:"2221",name:"Kava Testnet",shortName:"testnet",chainId:2221,network:"testnet",multicall:"0xc7193EFE367DF0C9349a1149F4E95A2A35604262",rpc:[],explorer:{url:"https://testnet.kavascan.com"},start:6193104,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4",testnet:!0},2222:{key:"2222",name:"Kava",shortName:"mainnet",chainId:2222,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://kavascan.com"},start:3661165,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4"},2400:{key:"2400",name:"TCG Verse",shortName:"TCGV",chainId:2400,network:"mainnet",multicall:"0xceC65DEE0b5012F1b7321b2647681F997c7204FC",rpc:["https://rpc.tcgverse.xyz"],explorer:{url:"https://explorer.tcgverse.xyz"},start:57500,logo:"ipfs://bafkreidg4wpewve5mdxrofneqblydkrjl3oevtgpdf3fk3z3vjqam6ocoe"},2522:{key:"2522",name:"Fraxtal Testnet",shortName:"testnet",chainId:2522,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://holesky.fraxscan.com"},start:1,logo:"ipfs://bafkreieflj4wq6tx7k5kq47z3xnsrdrn2xgm4bxa3uovrnndcb2vqqwlyu",testnet:!0},3338:{key:"3338",name:"peaq",shortName:"mainnet",chainId:3338,network:"mainnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://peaq.subscan.io"},start:3525964,logo:"ipfs://bafkreidqkleori7pmilesz4t52iebebaqf3oflzmoz646qfuaznanb3sgm"},4162:{key:"4162",name:"SX Rollup",shortName:"mainnet",chainId:4162,network:"mainnet",multicall:"0x46997eb05F6A6A0bD5C140ABed09Cb02CA36b98c",rpc:[],explorer:{url:"https://explorerl2.sx.technology"},start:1847483,logo:"ipfs://bafkreibjkjx7evbw74e3sx65dtmcdr4g2rrbcorb2ivd6jz6yh6on6ozw4"},4200:{key:"4200",name:"Merlin",shortName:"merlin",chainId:4200,network:"mainnet",multicall:"0x830E7E548F4D80947a40A7Cf3a2a53166a0C3980",rpc:[],explorer:{url:"https://scan.merlinchain.io"},start:589494,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe"},4337:{key:"4337",name:"Beam",shortName:"Beam",chainId:4337,network:"mainnet",multicall:"0x4956F15eFdc3dC16645e90Cc356eAFA65fFC65Ec",rpc:[],explorer:{url:"https://subnets.avax.network/beam"},start:1,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF"},4689:{key:"4689",name:"IoTeX",shortName:"IoTeX",chainId:4689,network:"mainnet",multicall:"0x9c8B105c94282CDB0F3ecF27e3cfA96A35c07be6",rpc:["https://babel-api.mainnet.iotex.io"],explorer:{url:"https://iotexscan.io"},start:11533283,logo:"ipfs://QmNkr1UPcBYbvLp7d7Pk4eF3YCsHpaNkfusKZNtykL2EQC"},5e3:{key:"5000",name:"Mantle",chainId:5e3,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.mantle.xyz"],explorer:{url:"https://mantlescan.xyz"},start:304717,logo:"ipfs://bafkreidkucwfn4mzo2gtydrt2wogk3je5xpugom67vhi4h4comaxxjzoz4"},5555:{key:"5555",name:"Chain Verse",shortName:"ChainVerse",chainId:5555,network:"ChainVerse",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.chainverse.info"],explorer:{url:"https://explorer.chainverse.info"},start:6334180,logo:"ipfs://QmQyJt28h4wN3QHPXUQJQYQqGiFUD77han3zibZPzHbitk"},5611:{key:"5611",name:"opBNB Testnet",shortName:"testnet",chainId:5611,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://opbnb-testnet.bscscan.com"},start:3705108,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64",testnet:!0},6102:{key:"6102",name:"Cascadia Testnet",shortName:"Cascadia",chainId:6102,network:"testnet",multicall:"0x728989819bAD588F193563008E0a03E8cD6a3e4a",rpc:["https://testnet.cascadia.foundation"],explorer:{url:"https://explorer.cascadia.foundation"},testnet:!0,start:370457,logo:"ipfs://QmWkhZYhReYyaa5pQXj32hEGxoRcBqarFMcfQScELmjYQj"},6900:{key:"6900",name:"Animechain Testnet",shortName:"testnet",chainId:6900,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-animechain-testnet-i8yja6a1a0.t.conduit.xyz"},start:1666749,logo:"ipfs://bafkreihm7dy6jzkd3nh6mokq4vshuzwkoeyjmbb3qkskn77rt5iufn7egi",testnet:!0},7332:{key:"7332",name:"Horizen EON",shortName:"EON",chainId:7332,network:"mainnet",multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:[],explorer:{url:"https://eon-explorer.horizenlabs.io"},start:85108,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},7341:{key:"7341",name:"Shyft",shortName:"Shyft",chainId:7341,network:"mainnet",multicall:"0xceb10e9133D771cA93c8002Be527A465E85381a2",rpc:["https://rpc.shyft.network"],explorer:{url:"https://bx.shyft.network"},start:3673983,logo:"ipfs://bafkreifwxnnfk6koabzmxgcxcwlrwt6b5gijdain2gyqee77q4ajfb7fu4"},7560:{key:"7560",name:"Cyber",shortName:"mainnet",chainId:7560,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://cyberscan.co"},start:1731707,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm"},8217:{key:"8217",name:"Kaia Mainnet",shortName:"kaia-mainnet",chainId:8217,network:"mainnet",multicall:"0x5f5f0d1b9ff8b3dcace308e39b13b203354906e9",rpc:["https://archive-en.node.kaia.io"],ws:["wss://archive-en.node.kaia.io/ws"],explorer:{url:"https://kaiascan.com"},start:91582357,logo:"ipfs://bafkreifm6l67f4blcv7qwuszalwoxzptt5ad2f3t472lytr3d2hmi626ju"},8453:{key:"8453",name:"Base",shortName:"mainnet",chainId:8453,network:"mainnet",multicall:"0xca11bde05977b3631167028862be2a173976ca11",rpc:[],explorer:{url:"https://basescan.org"},start:5022,logo:"ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv"},9001:{key:"9001",name:"Evmos Network",shortName:"Evmos",chainId:9001,network:"mainnet",multicall:"0x37763d16f8dBf6F185368E0f256350cAb7E24b26",rpc:["https://eth.bd.evmos.org:8545"],ws:["wss://eth.bd.evmos.org:8546"],explorer:{url:"https://escan.live"},start:13959539,logo:"ipfs://bafkreif4obrdoiretpozdd56seziywc6clha7wwkbldng3ovry2bpzly34"},9990:{key:"9990",name:"Agung testnet",shortName:"testnet",chainId:9990,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://agung-testnet.subscan.io"},start:2031789,logo:"ipfs://bafkreidqkleori7pmilesz4t52iebebaqf3oflzmoz646qfuaznanb3sgm",testnet:!0},1e4:{key:"10000",name:"smartBCH",shortName:"BCH",chainId:1e4,network:"mainnet",multicall:"0x1b38EBAd553f218e2962Cb1C0539Abb5d6A37774",rpc:["https://smartbch.greyh.at/"],explorer:{url:"https://smartbch-explorer.web.app"},start:268248,logo:"ipfs://QmWG1p7om4hZ4Yi4uQvDpxg4si7qVYhtppGbcDGrhVFvMd"},10243:{key:"10243",name:"Arthera Testnet",shortName:"Arthera_",chainId:10243,network:"testnet",testnet:!0,multicall:"0x27c7FC597aD2E81C4c1cA1769972f79DaF042Da7",rpc:["https://rpc-test.arthera.net"],explorer:{url:"https://explorer-test.arthera.net"},start:10523,logo:"ipfs://QmYQp3e52KjkT4bYdAvB6ACEEpXs2D8DozsDitaADRY2Ak"},13337:{key:"13337",name:"Beam Testnet",shortName:"testnet",chainId:13337,network:"testnet",multicall:"0x9BF49b704EE2A095b95c1f2D4EB9010510c41C9E",rpc:[],explorer:{url:"https://subnets-test.avax.network/beam"},start:3,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF",testnet:!0},13371:{key:"13371",name:"Immutable zkEVM",shortName:"mainnet",chainId:13371,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.immutable.com"},start:3680945,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi"},13473:{key:"13473",name:"Immutable zkEVM Testnet",shortName:"testnet",chainId:13473,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.testnet.immutable.com"},start:5307209,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi",testnet:!0},14800:{key:"14800",name:"Vana Moksha Testnet",shortName:"testnet",chainId:14800,network:"testnet",multicall:"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E",rpc:[],explorer:{url:"https://moksha.vanascan.io"},start:732283,logo:"ipfs://bafkreibotel3dmc5og5rf3tpt7l74awkene7x6q3oxtwhptt4y4rpa7vsa",testnet:!0},16718:{key:"16718",name:"AirDAO",chainId:16718,network:"mainnet",multicall:"0x25e81aC81A8B03389D78CB45faB78353aB528574",rpc:["https://network-archive.ambrosus.io"],ws:["wss://network-archive.ambrosus.io/ws"],explorer:{url:"https://airdao.io/explorer"},start:22922566,logo:"ipfs://QmSxXjvWng3Diz4YwXDV2VqSPgMyzLYBNfkjJcr7rzkxom"},29548:{key:"29548",name:"MCH Verse",shortName:"mainnet",chainId:29548,network:"mainnet",multicall:"0x1d39652386488CE1fE4254E105F5A42a04d43dB2",rpc:[],explorer:{url:"https://explorer.oasys.mycryptoheroes.net"},start:27458402,logo:"ipfs://QmZZnwR1y6cU1sare2TQmwqkNDLXQxD4GdPrmHLmUoPtbU"},33111:{key:"33111",name:"Curtis",shortName:"apechain",chainId:33111,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://curtis.apescan.io"},start:6661339,logo:"ipfs://bafkreicljxttjq2xkgfwwpii5xegirgq2ctrnsjnzelxudjj33qzq65apu",testnet:!0},33139:{key:"33139",name:"ApeChain",shortName:"mainnet",chainId:33139,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://apescan.io"},start:20889,logo:"ipfs://bafkreielbgcox2jsw3g6pqulqb7pyjgx7czjt6ahnibihaij6lozoy53w4"},42161:{key:"42161",name:"Arbitrum One",chainId:42161,network:"Arbitrum mainnet",multicall:"0x7A7443F8c577d537f1d8cD4a629d40a3148Dd7ee",rpc:["https://rpc.ankr.com/arbitrum","https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/arbitrum/mainnet","https://arb-mainnet.g.alchemy.com/v2/JDvtNGwnHhTltIwfnxQocKwKkCTKA1DL"],explorer:{url:"https://arbiscan.io"},start:256508,logo:"ipfs://QmWZ5SMRfvcK8tycsDqojQaSiKedgtVkS7CkZdxPgeCVsZ"},42170:{key:"42170",name:"Arbitrum Nova",chainId:42170,network:"Arbitrum Nova",multicall:"0x4E74EBd9CABff51cE9a43EFe059bA8c5A28E4A14",rpc:["https://nova.arbitrum.io/rpc","https://arbitrum-nova.public.blastapi.io"],explorer:{url:"https://nova.arbiscan.io"},start:6006607,logo:"ipfs://bafkreie5xsqt3mrrwu7v32qpmmctibhzhgxf4emfzzddsdhdlfsa7fmplu"},42220:{key:"42220",name:"Celo",shortName:"Celo",chainId:42220,network:"mainnet",multicall:"0xb8d0d2C1391eeB350d2Cd39EfABBaaEC297368D9",rpc:["https://celo.snapshot.org","https://forno.celo.org","https://celo-mainnet--rpc.datahub.figment.io/apikey/e892a66dc36e4d2d98a5d6406d609796/"],explorer:{url:"https://explorer.celo.org"},start:6599803,logo:"ipfs://QmS2tVJ7rdJRe1NHXAi2L86yCbUwVVrmB2mHQeNdJxvQti"},43113:{key:"43113",name:"Avalanche FUJI Testnet",chainId:43113,network:"testnet",testnet:!0,multicall:"0x984476ea55e32e785A9D8FF14329f99D74E3d2A2",rpc:["https://api.avax-test.network/ext/bc/C/rpc"],explorer:{url:"https://testnet.snowtrace.io"},start:10528153,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},43114:{key:"43114",name:"Avalanche",chainId:43114,network:"mainnet",multicall:"0x7E9985aE4C8248fdB07607648406a48C76e9e7eD",rpc:["https://nd-784-543-849.p2pify.com/aa7b29fc5fed65b34f0ee6b8de33f8c0/ext/bc/C/rpc","https://rpc.ankr.com/avalanche","https://api.avax.network/ext/bc/C/rpc"],explorer:{url:"https://snowtrace.io"},start:536483,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},47805:{key:"47805",name:"REI Mainnet",chainId:47805,network:"mainnet",multicall:"0x9eE9904815B80C39C1a27294E69a8626EAa7952d",rpc:["https://rpc.rei.network"],explorer:{url:"https://scan.rei.network"},start:1715902,logo:"ipfs://QmTogMDLmDgJjDjUKDHDuc2KVTVDbXf8bXJLFiVe8PRxgo"},53935:{key:"53935",name:"DFK Chain",chainId:53935,network:"mainnet",multicall:"0x5b24224dC16508DAD755756639E420817DD4c99E",rpc:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"],explorer:{url:"https://subnets.avax.network/defi-kingdoms"},start:62,logo:"ipfs://QmZNkpVgPbuVbDcsi6arwH1om3456FGnwfDqYQJWUfHDEx"},57054:{key:"57054",name:"Sonic Blaze Testnet",shortName:"testnet",chainId:57054,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://testnet.sonicscan.org"},start:60,logo:"ipfs://bafkreic5fffatwy2gzf6y5iymje6ijii43tz4wlxl35da36guurhibjx44",testnet:!0},57073:{key:"57073",name:"Ink",shortName:"mainnet",chainId:57073,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.inkonchain.com"},start:6659154,logo:"ipfs://bafkreics2duafru4mw36wftcmklgrsgq6fz4lgcjctzmov34bxjzuuypju"},59141:{key:"59141",name:"Linea Sepolia",shortName:"testnet",chainId:59141,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.lineascan.build"},start:227427,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce",testnet:!0},59144:{key:"59144",name:"Linea",shortName:"linea",chainId:59144,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://lineascan.build"},start:42,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce"},69e3:{key:"69000",name:"Animechain",shortName:"mainnet",chainId:69e3,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-animechain-39xf6m45e3.t.conduit.xyz"},start:23482,logo:"ipfs://bafkreihm7dy6jzkd3nh6mokq4vshuzwkoeyjmbb3qkskn77rt5iufn7egi"},80001:{key:"80001",name:"Polygon Mumbai",chainId:80001,network:"testnet",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/polygon/mumbai/archive","https://rpc-mumbai.matic.today"],ws:["wss://ws-mumbai.matic.today"],explorer:{url:"https://mumbai.polygonscan.com",apiUrl:"https://api-mumbai.polygonscan.com"},start:12011090,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},80002:{key:"80002",name:"Polygon Amoy Testnet",shortName:"testnet",chainId:80002,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://amoy.polygonscan.com"},start:3127388,logo:"ipfs://bafkreibfiyvhqnme2vbxxfcku7qkxgjpkg6ywdkplxh4oxlkqsbznyorfm",testnet:!0},81457:{key:"81457",name:"Blast",shortName:"mainnet",chainId:81457,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://blastscan.io"},start:88189,logo:"ipfs://bafkreicqhrimt2zyp2kvhmbpvffxlmxovkg5vw6zkissyzibcfy45kbvrm"},84532:{key:"84532",name:"Base Sepolia",shortName:"testnet",chainId:84532,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://base-sepolia.blockscout.com"},start:1059647,logo:"ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv",testnet:!0},314159:{key:"314159",name:"Filecoin Calibration Testnet",shortName:"testnet",chainId:314159,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://calibration.filscan.io/en"},start:1446201,logo:"ipfs://bafkreiffbopdjior7li3nlemzko7rjua6wd2hfh2vhdbenqbv4tfsbnzwu",testnet:!0},686868:{key:"686868",name:"Merlin Testnet",shortName:"merlin",chainId:686868,network:"testnet",multicall:"0x758BC6321b7c68F4986d62a4D46E83A2DCb58c80",rpc:[],explorer:{url:"https://testnet-scan.merlinchain.io"},start:3562021,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe",testnet:!0},713715:{key:"713715",name:"Sei EVM Devnet",shortName:"devnet",chainId:713715,network:"testnet",multicall:"0xEe8d287B844959ADe40d718Dc23077ba920e2f07",rpc:[],explorer:{url:"https://seitrace.com"},start:1463669,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},763373:{key:"763373",name:"Ink Sepolia",shortName:"testnet",chainId:763373,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-sepolia.inkonchain.com"},start:9701940,logo:"ipfs://bafkreics2duafru4mw36wftcmklgrsgq6fz4lgcjctzmov34bxjzuuypju",testnet:!0},810180:{key:"810180",name:"zkLink Nova",shortName:"zlink",chainId:810180,network:"mainnet",multicall:"0x825267E0fA5CAe92F98540828a54198dcB3Eaeb5",rpc:[],explorer:{url:"https://explorer.zklink.io"},start:146055,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74"},810181:{key:"810181",name:"zkLink Nova Sepolia",shortName:"testnet",chainId:810181,network:"testnet",multicall:"0x97148F8fDdd9A1620f72EC1Bb2932916623d9da5",rpc:[],explorer:{url:"https://sepolia.explorer.zklink.io"},start:43723,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74",testnet:!0},11155111:{key:"11155111",name:"Sepolia testnet",shortName:"Sepolia",chainId:11155111,network:"sepolia",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://sepolia.infura.io/v3/d26b4fd748814fe994b05899fd89e667"],ensResolvers:["0x8FADE66B79cC9f707aB26799354482EB93a5B7dD"],ensNameWrapper:"0x0635513f179D50A207757E05759CbD106d7dFcE8",ensSubgraph:"https://subgrapher.snapshot.org/subgraph/arbitrum/DmMXLtMZnGbQXASJ7p1jfzLUbBYnYUD9zNBTxpkjHYXV",explorer:{url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io"},start:751532,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},11155420:{key:"11155420",name:"OP Sepolia",shortName:"testnet",chainId:11155420,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia-optimism.etherscan.io"},start:1620204,logo:"ipfs://QmfF4kwhGL8QosUXvgq2KWCmavhKBvwD6kbhs7L4p5ZAWb",testnet:!0},111557560:{key:"111557560",name:"Cyber Testnet",shortName:"testnet",chainId:111557560,network:"testnet",multicall:"0xffc391F0018269d4758AEA1a144772E8FB99545E",rpc:[],explorer:{url:"https://testnet.cyberscan.co"},start:304545,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm",testnet:!0},168587773:{key:"168587773",name:"Blast Sepolia",shortName:"testnet",chainId:168587773,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.blastexplorer.io"},start:756690,logo:"ipfs://bafkreibfmkjg22cozxppzcoxswj45clvh2rqhxzax57cmmgudbtkf4dkce",testnet:!0},245022926:{key:"245022926",name:"Neon Devnet",shortName:"devnet",chainId:245022926,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://devnet.neonscan.org"},start:205206112,logo:"ipfs://QmecRPQGa4bU7tybg1sUQY48Md9rWnmhrT6WW5ueqvhg6P",testnet:!0},1313161554:{key:"1313161554",name:"Aurora",shortName:"Aurora",chainId:1313161554,network:"mainnet",multicall:"0x32b50c286DEFd2932a0247b8bb940b78c063F16c",rpc:["https://mainnet.aurora.dev"],explorer:{url:"https://explorer.mainnet.aurora.dev"},start:57190533,logo:"ipfs://QmeRhsR1UPRTQCizdhmgr2XxphXebVKU5di97uCV2UMFpa"},16666e5:{key:"1666600000",name:"Harmony",shortName:"HarmonyMainnet",chainId:16666e5,network:"mainnet",multicall:"0x9c31392D2e0229dC4Aa250F043d46B9E82074BF8",rpc:["https://a.api.s0.t.hmny.io"],ws:["wss://ws.s0.t.hmny.io"],explorer:{url:"https://explorer.harmony.one"},start:10911984,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"},16667e5:{key:"1666700000",name:"Harmony Testnet",shortName:"HarmonyTestnet",chainId:16667e5,network:"testnet",testnet:!0,multicall:"0x9923589503Fd205feE3d367DDFF2378f0F7dD2d4",rpc:["https://api.s0.b.hmny.io"],ws:["wss://ws.s0.b.hmny.io"],explorer:{url:"https://explorer.pops.one"},start:7521509,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"},"0x534e5f4d41494e":{key:"0x534e5f4d41494e",name:"Starknet",shortName:"Starknet",chainId:"0x534e5f4d41494e",network:"mainnet",starknet:!0,broviderId:"sn",multicall:"0x05754af3760f3356da99aea5c3ec39ccac7783d925a19666ebbeca58ff0087f4",explorer:{url:"https://starkscan.co"},rpc:["https://starknet-mainnet.public.blastapi.io"],start:8446,logo:"ipfs://bafkreihbjafyh7eud7r6e5743esaamifcttsvbspfwcrfoc5ykodjdi67m"},"0x534e5f5345504f4c4941":{key:"0x534e5f5345504f4c4941",name:"Starknet Sepolia",shortName:"testnet",chainId:"0x534e5f5345504f4c4941",network:"testnet",starknet:!0,broviderId:"sn-sep",testnet:!0,multicall:"0x05754af3760f3356da99aea5c3ec39ccac7783d925a19666ebbeca58ff0087f4",explorer:{url:"https://sepolia.starkscan.co"},rpc:["https://starknet-sepolia.public.blastapi.io"],start:7,logo:"ipfs://bafkreihbjafyh7eud7r6e5743esaamifcttsvbspfwcrfoc5ykodjdi67m"}};const WO=new Map,YO={evm:function(t,e){return new Km({url:`${e.broviderUrl}/${t}`,timeout:e.timeout,allowGzip:!0},Number(t))},starknet:function(t,e){return new lO({nodeUrl:`${e.broviderUrl}/${t}`})}};function QO(t,e={}){const r=function(t){const e=JO[t];if(!e)throw new Error(`Network '${t}' is not supported`);return e.broviderId||String(t)}(t),i=function(t={}){var e;return{broviderUrl:t.broviderUrl||"https://rpc.snapshot.org",timeout:null!==(e=t.timeout)&&void 0!==e?e:25e3}}(e),n=function(t,e){return`${t}:${e.broviderUrl}:${e.timeout}`}(r,i),o=WO.get(n);if(o)return o;const a=function(t){var e;return(null===(e=JO[t])||void 0===e?void 0:e.starknet)?"starknet":"evm"}(t),s=YO[a](r,i);return WO.set(n,s),s}var XO,tR,eR,rR;const iR={SN_MAIN:null===(tR=null===(XO=JO[eS.StarknetChainId.SN_MAIN])||void 0===XO?void 0:XO.rpc)||void 0===tR?void 0:tR[0],SN_SEPOLIA:null===(rR=null===(eR=JO[eS.StarknetChainId.SN_SEPOLIA])||void 0===eR?void 0:eR.rpc)||void 0===rR?void 0:rR[0]},nR=[{name:"argent::common::account::IAccount",type:"interface",items:[{name:"is_valid_signature",type:"function",inputs:[{name:"hash",type:"core::felt252"},{name:"signature",type:"core::array::Array::<core::felt252>"}],outputs:[{type:"core::felt252"}],state_mutability:"view"}]}];function oR(t,e){var r;if(!iR[t])throw new Error("Invalid network");return new lO({nodeUrl:null!==(r=null==e?void 0:e.broviderUrl)&&void 0!==r?r:iR[t]})}function aR(t){return!!t.primaryType&&!!t.types.StarkNetDomain}function sR(t,e){const{domain:r,types:i,primaryType:n,message:o}=t;return vz.getMessageHash({types:i,primaryType:n,domain:r,message:o},e)}var hR=Object.freeze({__proto__:null,isStarknetMessage:aR,getHash:sR,default:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="SN_MAIN",n={}){try{const o=new KO(nR,t,oR(i,n));if(e.length<2)throw new Error("Invalid signature format");const a=yield o.is_valid_signature(sR(r,t),e.slice(-2));return eh.from(a).eq(eh.from("370462705988"))}catch(t){if(t.message.includes("Contract not found"))throw new Error("Contract not deployed");throw t}}))}});function uR(t){return mr(ui(t))}var lR=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Tt.Buffer}catch(t){}function a(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,a=0,s=Math.min(t.length,i),h=e;h<s;h++){var u=t.charCodeAt(h)-48;o*=n,a=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a<n,"Invalid character"),o+=a}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)a=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)a=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var c=1;for(u=h(t,l,t.length,e),l=0;l<a;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],h=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),i=0!==o||a!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],l=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,h=a/67108864|0;r.words[0]=s;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,d=Math.min(u,e.length-1),f=Math.max(0,u-t.length+1);f<=d;f++){var m=u-f|0;l+=(a=(n=0|t.words[m])*(o=0|e.words[f])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,n),a},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a<i.length;a++)o=(e=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,a=t.words,s=e.words,h=r.words,u=0,l=0|a[0],c=8191&l,d=l>>>13,f=0|a[1],m=8191&f,p=f>>>13,g=0|a[2],y=8191&g,w=g>>>13,v=0|a[3],b=8191&v,k=v>>>13,M=0|a[4],_=8191&M,E=M>>>13,A=0|a[5],j=8191&A,x=A>>>13,S=0|a[6],N=8191&S,I=S>>>13,T=0|a[7],C=8191&T,z=T>>>13,O=0|a[8],R=8191&O,P=O>>>13,B=0|a[9],D=8191&B,$=B>>>13,L=0|s[0],U=8191&L,F=L>>>13,q=0|s[1],V=8191&q,H=q>>>13,G=0|s[2],Z=8191&G,K=G>>>13,J=0|s[3],W=8191&J,Y=J>>>13,Q=0|s[4],X=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,lt=0|s[8],ct=8191&lt,dt=lt>>>13,ft=0|s[9],mt=8191&ft,pt=ft>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,F))+Math.imul(d,U)|0))<<13)|0;u=((o=Math.imul(d,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,U),n=(n=Math.imul(m,F))+Math.imul(p,U)|0,o=Math.imul(p,F);var yt=(u+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,U),n=(n=Math.imul(y,F))+Math.imul(w,U)|0,o=Math.imul(w,F),i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(b,U),n=(n=Math.imul(b,F))+Math.imul(k,U)|0,o=Math.imul(k,F),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,H)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,K)|0;var vt=(u+(i=i+Math.imul(c,W)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(d,W)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,F))+Math.imul(E,U)|0,o=Math.imul(E,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(m,W)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,W)|0,o=o+Math.imul(p,Y)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(j,U),n=(n=Math.imul(j,F))+Math.imul(x,U)|0,o=Math.imul(x,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,K)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var kt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,it)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,U),n=(n=Math.imul(N,F))+Math.imul(I,U)|0,o=Math.imul(I,F),i=i+Math.imul(j,V)|0,n=(n=n+Math.imul(j,H)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,H)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,U),n=(n=Math.imul(C,F))+Math.imul(z,U)|0,o=Math.imul(z,F),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,H)|0,i=i+Math.imul(j,Z)|0,n=(n=n+Math.imul(j,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,i=i+Math.imul(_,W)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var _t=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(R,U),n=(n=Math.imul(R,F))+Math.imul(P,U)|0,o=Math.imul(P,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(z,V)|0,o=o+Math.imul(z,H)|0,i=i+Math.imul(N,Z)|0,n=(n=n+Math.imul(N,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(j,W)|0,n=(n=n+Math.imul(j,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Et=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,U),n=(n=Math.imul(D,F))+Math.imul($,U)|0,o=Math.imul($,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,K)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(j,X)|0,n=(n=n+Math.imul(j,tt)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,dt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,dt)|0;var At=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(d,mt)|0))<<13)|0;u=((o=o+Math.imul(d,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,V),n=(n=Math.imul(D,H))+Math.imul($,V)|0,o=Math.imul($,H),i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(z,W)|0,o=o+Math.imul(z,Y)|0,i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(j,rt)|0,n=(n=n+Math.imul(j,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,dt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,dt)|0;var jt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(D,Z),n=(n=Math.imul(D,K))+Math.imul($,Z)|0,o=Math.imul($,K),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(z,X)|0,o=o+Math.imul(z,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(j,ot)|0,n=(n=n+Math.imul(j,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,dt)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,dt)|0;var xt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,mt)|0))<<13)|0;u=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,Y))+Math.imul($,W)|0,o=Math.imul($,Y),i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(z,rt)|0,o=o+Math.imul(z,it)|0,i=i+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(j,ht)|0,n=(n=n+Math.imul(j,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(_,ct)|0,n=(n=n+Math.imul(_,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul($,X)|0,o=Math.imul($,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,ut)|0,i=i+Math.imul(j,ct)|0,n=(n=n+Math.imul(j,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var Nt=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(E,mt)|0))<<13)|0;u=((o=o+Math.imul(E,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul($,rt)|0,o=Math.imul($,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,ut)|0,i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,dt)|0;var It=(u+(i=i+Math.imul(j,mt)|0)|0)+((8191&(n=(n=n+Math.imul(j,pt)|0)+Math.imul(x,mt)|0))<<13)|0;u=((o=o+Math.imul(x,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul($,ot)|0,o=Math.imul($,at),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(z,ct)|0,o=o+Math.imul(z,dt)|0;var Tt=(u+(i=i+Math.imul(N,mt)|0)|0)+((8191&(n=(n=n+Math.imul(N,pt)|0)+Math.imul(I,mt)|0))<<13)|0;u=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul($,ht)|0,o=Math.imul($,ut),i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,dt)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,dt)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(z,mt)|0))<<13)|0;u=((o=o+Math.imul(z,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,dt))+Math.imul($,ct)|0,o=Math.imul($,dt);var zt=(u+(i=i+Math.imul(R,mt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul($,mt)|0))<<13)|0;return u=((o=Math.imul($,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=wt,h[3]=vt,h[4]=bt,h[5]=kt,h[6]=Mt,h[7]=_t,h[8]=Et,h[9]=At,h[10]=jt,h[11]=xt,h[12]=St,h[13]=Nt,h[14]=It,h[15]=Tt,h[16]=Ct,h[17]=zt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),d=67108863&c;s=67108863&(d=d+s|0),n+=(a=(a=a+(c/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,a=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=a>>>26,this.words[n]=67108863&a}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,h=(0|this.words[e])-s<<i;this.words[e]=h|a,a=s>>>26-i}a&&(this.words[e]=a,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,h=i;if(n-=a,n=Math.max(0,n),h){for(var u=0;u<a;u++)h.words[u]=this.words[u];h.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&s}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,a=t.length+i;this._expand(a);var s=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+s;var h=(0|t.words[n])*e;s=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)s=(o=(0|this.words[n+i])+s)>>26,this.words[n+i]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,h=i.length-o.length;if("mod"!==e){(s=new n(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,s&&(s.words[h]=1));for(var c=h-1;c>=0;c--){var d=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(o,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),a=new n(0),s=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(l),h.isub(c)),s.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(s),a.isub(h)):(i.isub(e),s.isub(o),h.isub(a))}return{a:s,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new n(1),s=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);for(var c=0,d=1;0==(i.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(i.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(i)>=0?(e.isub(i),a.isub(s)):(i.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,a=i;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(b,v),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(k,v),i(M,v),i(_,v),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new k;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return w[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new n(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),m=a;0!==f.cmp(s);){for(var p=f,g=0;0!==p.cmp(s);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));d=d.redMul(y),c=y.redSqr(),f=f.redMul(c),m=g}return d},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],a=0,s=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===i&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new A(t)},i(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,i)}));var cR=lR.BN;const dR=new Ft("bignumber/5.6.2"),fR={},mR=9007199254740991;let pR=!1;class gR{constructor(t,e){t!==fR&&dR.throwError("cannot call constructor directly; use BigNumber.from",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return wR(vR(this).fromTwos(t))}toTwos(t){return wR(vR(this).toTwos(t))}abs(){return"-"===this._hex[0]?gR.from(this._hex.substring(1)):this}add(t){return wR(vR(this).add(vR(t)))}sub(t){return wR(vR(this).sub(vR(t)))}div(t){return gR.from(t).isZero()&&bR("division-by-zero","div"),wR(vR(this).div(vR(t)))}mul(t){return wR(vR(this).mul(vR(t)))}mod(t){const e=vR(t);return e.isNeg()&&bR("division-by-zero","mod"),wR(vR(this).umod(e))}pow(t){const e=vR(t);return e.isNeg()&&bR("negative-power","pow"),wR(vR(this).pow(e))}and(t){const e=vR(t);return(this.isNegative()||e.isNeg())&&bR("unbound-bitwise-result","and"),wR(vR(this).and(e))}or(t){const e=vR(t);return(this.isNegative()||e.isNeg())&&bR("unbound-bitwise-result","or"),wR(vR(this).or(e))}xor(t){const e=vR(t);return(this.isNegative()||e.isNeg())&&bR("unbound-bitwise-result","xor"),wR(vR(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&bR("negative-width","mask"),wR(vR(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&bR("negative-width","shl"),wR(vR(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&bR("negative-width","shr"),wR(vR(this).shrn(t))}eq(t){return vR(this).eq(vR(t))}lt(t){return vR(this).lt(vR(t))}lte(t){return vR(this).lte(vR(t))}gt(t){return vR(this).gt(vR(t))}gte(t){return vR(this).gte(vR(t))}isNegative(){return"-"===this._hex[0]}isZero(){return vR(this).isZero()}toNumber(){try{return vR(this).toNumber()}catch(t){bR("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return dR.throwError("this platform does not support BigInt",Ft.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?pR||(pR=!0,dR.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?dR.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ft.errors.UNEXPECTED_ARGUMENT,{}):dR.throwError("BigNumber.toString does not accept parameters",Ft.errors.UNEXPECTED_ARGUMENT,{})),vR(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof gR)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new gR(fR,yR(t)):t.match(/^-?[0-9]+$/)?new gR(fR,yR(new cR(t))):dR.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&bR("underflow","BigNumber.from",t),(t>=mR||t<=-mR)&&bR("overflow","BigNumber.from",t),gR.from(String(t));const e=t;if("bigint"==typeof e)return gR.from(e.toString());if(Kt(e))return gR.from(te(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return gR.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Qt(t)||"-"===t[0]&&Qt(t.substring(1))))return gR.from(t)}return dR.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function yR(t){if("string"!=typeof t)return yR(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&dR.throwArgumentError("invalid hex","value",t),"0x00"===(t=yR(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function wR(t){return gR.from(yR(t))}function vR(t){const e=gR.from(t).toHexString();return"-"===e[0]?new cR("-"+e.substring(3),16):new cR(e.substring(2),16)}function bR(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),dR.throwError(t,Ft.errors.NUMERIC_FAULT,i)}var kR=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))};const MR=new Ft("hash/5.6.1"),_R=new Uint8Array(32);_R.fill(0);const ER=gR.from(-1),AR=gR.from(0),jR=gR.from(1),xR=gR.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const SR=oe(jR.toHexString(),32),NR=oe(AR.toHexString(),32),IR={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},TR=["name","version","chainId","verifyingContract","salt"];function CR(t){return function(e){return"string"!=typeof e&&MR.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const zR={name:CR("name"),version:CR("version"),chainId:function(t){try{return gR.from(t).toString()}catch(t){}return MR.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return xr(t).toLowerCase()}catch(t){}return MR.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=Jt(t);if(32!==e.length)throw new Error("bad length");return te(e)}catch(t){}return MR.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function OR(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&MR.throwArgumentError("invalid numeric width","type",t);const n=xR.mask(r?i-1:i),o=r?n.add(jR).mul(ER):AR;return function(e){const r=gR.from(e);return(r.lt(o)||r.gt(n))&&MR.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),oe(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&MR.throwArgumentError("invalid bytes width","type",t),function(e){return Jt(e).length!==r&&MR.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=Jt(t),r=e.length%32;return r?ie([e,_R.slice(r)]):te(e)}(e)}}}switch(t){case"address":return function(t){return oe(xr(t),32)};case"bool":return function(t){return t?SR:NR};case"bytes":return function(t){return mr(t)};case"string":return function(t){return uR(t)}}return null}function RR(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class PR{constructor(t){ve(this,"types",Object.freeze(je(t))),ve(this,"_encoderCache",{}),ve(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],i[t]={}}));for(const i in t){const n={};t[i].forEach((o=>{n[o.name]&&MR.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===i&&MR.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);OR(a)||(r[a]||MR.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),r[a].push(i),e[i][a]=!0)}))}const n=Object.keys(r).filter((t=>0===r[t].length));0===n.length?MR.throwArgumentError("missing primary type","types",t):n.length>1&&MR.throwArgumentError(`ambiguous primary types or unused types: ${n.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),ve(this,"primaryType",n[0]),function n(o,a){a[o]&&MR.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(n(t,a),Object.keys(a).forEach((e=>{i[e][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=RR(e,t[e])+r.map((e=>RR(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=OR(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&MR.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(mr)),mr(ie(n))}}const r=this.types[t];if(r){const e=uR(this._types[t]);return t=>{const i=r.map((({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?mr(i):i}));return i.unshift(e),ie(i)}}return MR.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||MR.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return mr(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(OR(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&MR.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const n=this.types[t];return n?n.reduce(((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t)),{}):MR.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new PR(t)}static getPrimaryType(t){return PR.from(t).primaryType}static hashStruct(t,e,r){return PR.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=IR[r];i||MR.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort(((t,e)=>TR.indexOf(t.name)-TR.indexOf(e.name))),PR.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return ie(["0x1901",PR.hashDomain(t),PR.from(e).hash(r)])}static hash(t,e,r){return mr(PR.encode(t,e,r))}static resolveNames(t,e,r,i){return kR(this,void 0,void 0,(function*(){t=Me(t);const n={};t.verifyingContract&&!Qt(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=PR.from(e);o.visit(r,((t,e)=>("address"!==t||Qt(e,20)||(n[e]="0x"),e)));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&n[e]?n[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){PR.hashDomain(t);const i={},n=[];TR.forEach((e=>{const r=t[e];null!=r&&(i[e]=zR[e](r),n.push({name:e,type:IR[e]}))}));const o=PR.from(e),a=Me(e);return a.EIP712Domain?MR.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):a.EIP712Domain=n,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return te(Jt(e));if(t.match(/^u?int/))return gR.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&MR.throwArgumentError("invalid string","value",e),e}return MR.throwArgumentError("unsupported type","type",t)}))}}}window&&window.__awaiter;new Ft("wallet/5.6.2");function BR(t,e,r,i){return as(PR.hash(t,e,r),i)}const DR="6492649264926492649264926492649264926492649264926492649264926492";function $R(t,e){return t.toLowerCase()===e.toLowerCase()}function LR(t){const{domain:e,types:r,message:i}=t;return hl.hash(e,r,i)}function UR(t,e,i,n){return r(this,void 0,void 0,(function*(){let r;try{r=yield _B(n,["function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[Jt(i),e]])}catch(t){if(t.message.startsWith("missing revert data in call exception"))return!1;throw t}return $R(r,"0x1626ba7e")}))}function FR(t,e,i,n){return r(this,void 0,void 0,(function*(){return $R(yield _B(n,["function isValidSignature(bytes _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[Jt(i),e]]),"0x20c13b0b")}))}var qR=Object.freeze({__proto__:null,getHash:LR,default:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="1",n={}){const{domain:o,types:a,message:s}=r;try{if($R(t,BR(o,a,s,e)))return!0}catch(t){}const h=QO(i,n),u=LR(r);if(e.endsWith(DR))try{return"0x01"===(yield h.call({data:Wt(["0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",(new Ni).encode(["address","bytes32","bytes"],[t,Jt(u),e])])}))}catch(t){return!1}return!!(yield UR(t,e,u,h))||(yield FR(t,e,u,h))}))}});var VR=["ipfs.snapshot.box","snapshot.4everland.link","ipfs.io","ipfs.fleek.co","gateway.pinata.cloud","dweb.link","ipfs.infura.io"];class HR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"number"==typeof t&&void 0!==(null==e?void 0:e[t-1])}getValidVotes(){return this.votes.filter((t=>HR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>{const r=this.getValidVotes().filter((t=>t.choice===e+1));return r.reduce(((t,e)=>t+e.balance),0)}))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>{const r=this.strategies.map(((t,r)=>{const i=this.getValidVotes().filter((t=>t.choice===e+1));return i.reduce(((t,e)=>t+e.scores[r]),0)}));return r}))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices[this.selected-1]}}class GR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size}getValidVotes(){return this.votes.filter((t=>GR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.balance),0)))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.scores[r]),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected?this.proposal.choices.filter(((t,e)=>this.selected.includes(e+1))).join(", "):""}}function ZR(t,e){const r=t/e.reduce(((t,e)=>t+e),0);return isNaN(r)?0:r}function KR(t,e){return Math.sqrt(t*e)}function JR(t){return t*t}function WR(t,e){return t.map((t=>e*t))}class YR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>YR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>{const i=t.map((t=>KR(ZR(t.choice[r+1],Object.values(t.choice)),t.balance))).reduce(((t,e)=>t+e),0);return JR(i)}));return WR(r.map(((t,e)=>ZR(r[e],r))),e)}getScoresByStrategy(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>this.strategies.map(((e,i)=>t.map((t=>KR(ZR(t.choice[r+1],Object.values(t.choice)),t.scores[i]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[JR(t)]))));return r.map(((t,i)=>WR(this.strategies.map(((t,e)=>ZR(r[i][e][0],r.flat(2)))),e)))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1]){const r=ZR(this.selected[e+1],Object.values(this.selected));return`${Math.round(1e3*r)/10}% for ${t}`}})).filter((t=>null!=t)).join(", ")}}function QR(t,e){const r=[...new Set(t.map((t=>t[0])).flat())],i=Object.entries(t.reduce(((t,[e],r,i)=>{const n=i[r][1];t[e[0]][0]+=n;const o=i[r][2];return o.length>1?t[e[0]][1]=o.map(((r,i)=>r+t[e[0]][1][i]||r)):t[e[0]][1]=[t[e[0]][1].concat(o).reduce(((t,e)=>t+e),0)],t}),Object.assign({},...r.map((t=>({[t]:[0,[]]})))))),n=i.map((t=>[t[0],t[1][0]])),[o,a]=n.reduce((([t,e],[r,i])=>i>e?[r,i]:[t,e]),["?",-1/0]),[s,h]=n.reduce((([t,e],[r,i])=>i<e?[r,i]:[t,e]),["?",1/0]),u=i.sort(((t,e)=>e[1][0]-t[1][0])),l=t.map((t=>t[1])).reduce(((t,e)=>t+e),0);return e.push({round:e.length+1,sortedByHighest:u}),a>l/2||u.length<3?e:QR(t.map((t=>[t[0].filter((t=>t!=s)),t[1],t[2]])).filter((t=>t[0].length>0)),e)}function XR(t){const e=QR(t.map((t=>[t.choice,t.balance,t.scores])),[]);return e[e.length-1].sortedByHighest}class tP{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size&&t.length>0&&t.length===e.length}getValidVotes(){return this.votes.filter((t=>tP.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return function(t,e){const r=XR(t);return e.choices.map(((t,e)=>r.filter((t=>Number(t[0])===e+1)).reduce(((t,e)=>t+e[1][0]),0)))}(this.getValidVotes(),this.proposal)}getScoresByStrategy(){const t=XR(this.getValidVotes());return this.proposal.choices.map(((e,r)=>this.strategies.map(((e,i)=>t.filter((t=>Number(t[0])===r+1)).reduce(((t,e)=>t+e[1][1][i]),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected.map((t=>{if(this.proposal.choices[t-1])return this.proposal.choices[t-1]})).map(((t,e)=>`(${TB(e+1)}) ${t}`)).join(", ")}}class eP{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return!(!Array.isArray(t)||0===t.length||t.length>e.length||new Set(t).size!==t.length)&&t.every((t=>Number.isInteger(t)&&t>=1&&t<=e.length))}getValidVotes(){return this.votes.filter((t=>eP.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.getValidVotes(),e=this.proposal.choices.length,r=Array.from({length:e},(()=>Array(e).fill(0))),i=this.getScoresTotal();for(const e of t)for(let t=0;t<e.choice.length;t++)for(let i=t+1;i<e.choice.length;i++){const n=e.choice[t]-1,o=e.choice[i]-1;r[n][o]+=e.balance,r[o][n]-=e.balance}const n=Array(e).fill(0);let o=0;for(let t=0;t<e;t++)for(let i=0;i<e;i++)if(t!==i){const e=r[t][i];e>0?n[t]++:e<0?n[i]++:(n[t]+=.5,n[i]+=.5)}return o=n.reduce(((t,e)=>t+e),0),o>0?n.map((t=>t/o*i)):n.map((()=>i/e))}getScoresByStrategy(){const t=this.getValidVotes(),e=this.proposal.choices.length,r=this.strategies.length,i=Array.from({length:e},(()=>Array.from({length:e},(()=>Array(r).fill(0))))),n=Array(r).fill(0);for(const e of t)for(let t=0;t<r;t++)n[t]+=e.scores[t];for(const e of t)for(let t=0;t<e.choice.length;t++)for(let n=t+1;n<e.choice.length;n++){const o=e.choice[t]-1,a=e.choice[n]-1;for(let t=0;t<r;t++)i[o][a][t]+=e.scores[t],i[a][o][t]-=e.scores[t]}const o=Array.from({length:e},(()=>Array(r).fill(0)));for(let t=0;t<e;t++)for(let n=0;n<e;n++)if(t!==n)for(let e=0;e<r;e++){const r=i[t][n][e];r>0?o[t][e]++:r<0?o[n][e]++:(o[t][e]+=.5,o[n][e]+=.5)}const a=Array.from({length:e},(()=>Array(r).fill(0)));for(let t=0;t<r;t++){let r=0;for(let i=0;i<e;i++)r+=o[i][t];if(r>0)for(let i=0;i<e;i++)a[i][t]=o[i][t]/r*n[t];else if(n[t]>0)for(let r=0;r<e;r++)a[r][t]=n[t]/e}return a}getScoresTotal(){return this.getValidVotes().reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected.map((t=>this.proposal.choices[t-1])).join(", ")}}function rP(t,e,r){const i=r.reduce(((t,e)=>t+e),0),n=e[t]/i*100;return isNaN(n)?0:n}function iP(t,e,r){return rP(t+1,e,Object.values(e))/100*r}class nP{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>nP.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.proposal.choices.map(((t,e)=>this.getValidVotes().map((t=>iP(e,t.choice,t.balance))).reduce(((t,e)=>t+e),0))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((e,r)=>rP(r,t,t))).map((t=>e/100*t))}getScoresByStrategy(){const t=this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().map((t=>iP(e,t.choice,t.scores[r]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[t])))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((r,i)=>this.strategies.map(((e,r)=>rP(0,t[i][r],t.flat(2)))).map((t=>[e/100*t])).flat()))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1])return`${Math.round(10*rP(e+1,this.selected,Object.values(this.selected)))/10}% for ${t}`})).filter((t=>null!=t)).join(", ")}}var oP={"single-choice":HR,approval:GR,quadratic:YR,"ranked-choice":tP,copeland:eP,weighted:nP,basic:HR};const aP={1:"https://subgrapher.snapshot.org/delegation/1",10:"https://subgrapher.snapshot.org/delegation/10",56:"https://subgrapher.snapshot.org/delegation/56",100:"https://subgrapher.snapshot.org/delegation/100",137:"https://subgrapher.snapshot.org/delegation/137",146:"https://subgrapher.snapshot.org/delegation/146",250:"https://subgrapher.snapshot.org/delegation/250",5e3:"https://subgrapher.snapshot.org/delegation/5000",8453:"https://subgrapher.snapshot.org/delegation/8453",42161:"https://subgrapher.snapshot.org/delegation/42161",59144:"https://subgrapher.snapshot.org/delegation/59144",81457:"https://subgrapher.snapshot.org/delegation/81457",84532:"https://subgrapher.snapshot.org/delegation/84532",11155111:"https://subgrapher.snapshot.org/delegation/11155111"},sP=1e3;function hP(t){return t.length===sP&&t[0].timestamp===t[t.length-1].timestamp}function uP(t,e){const r=function(t){return`${t.delegator}-${t.delegate}-${t.space}`}(e);t.has(r)||t.set(r,e)}function lP(t){const e=["",t];return t.includes(".eth")&&e.push(t.replace(".eth","")),e}function cP(t){return r(this,arguments,void 0,(function*({url:t,spaces:e,pivot:r,snapshot:i}){const n={delegations:{__args:{where:{timestamp_gte:r},first:sP,skip:0,orderBy:"timestamp",orderDirection:"asc"},delegator:!0,space:!0,delegate:!0,timestamp:!0}};return"latest"!==i&&(n.delegations.__args.block={number:i}),null!==e&&(n.delegations.__args.where.space_in=e),(yield EB(t,n)).delegations||[]}))}const dP=["function aggregate(tuple(address target, bytes callData)[] calls) view returns (uint256 blockNumber, bytes[] returnData)"];function fP(t,e){if(!e||!e.outputs||!Array.isArray(t)||0===t.length)return t;const r=e.outputs[0],i=t[0];try{switch(r.type){case"core::felt252":try{return dI.decodeShortString(i)}catch(t){return i}case"core::integer::u8":case"core::integer::u16":case"core::integer::u32":case"core::integer::u64":return parseInt(i,16);case"core::integer::u128":case"core::integer::usize":return BigInt(i).toString();case"core::integer::u256":return dO.uint256ToBN({low:i,high:t[1]||"0x0"});case"core::integer::i8":case"core::integer::i16":case"core::integer::i32":case"core::integer::i64":return parseInt(i,16);case"core::integer::i128":return BigInt(i).toString();case"core::bool":return"0x1"===i||"0x01"===i;default:return i}}catch(e){return t}}const mP=t=>{if(0===t.length)return[];const[e,...r]=t,i=Number(zN.toBigInt(e)),n=r.slice(0,i),o=r.slice(i);return[n,...mP(o)]};var pP="__lodash_hash_undefined__",gP="[object Function]",yP="[object GeneratorFunction]",wP=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,vP=/^\w*$/,bP=/^\./,kP=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,MP=/\\(\\)?/g,_P=/^\[object .+?Constructor\]$/,EP=/^(?:0|[1-9]\d*)$/,AP="object"==typeof i&&i&&i.Object===Object&&i,jP="object"==typeof self&&self&&self.Object===Object&&self,xP=AP||jP||Function("return this")();var SP,NP=Array.prototype,IP=Function.prototype,TP=Object.prototype,CP=xP["__core-js_shared__"],zP=(SP=/[^.]+$/.exec(CP&&CP.keys&&CP.keys.IE_PROTO||""))?"Symbol(src)_1."+SP:"",OP=IP.toString,RP=TP.hasOwnProperty,PP=TP.toString,BP=RegExp("^"+OP.call(RP).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),DP=xP.Symbol,$P=NP.splice,LP=QP(xP,"Map"),UP=QP(Object,"create"),FP=DP?DP.prototype:void 0,qP=FP?FP.toString:void 0;function VP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function HP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function GP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function ZP(t,e,r){var i=t[e];RP.call(t,e)&&iB(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function KP(t,e){for(var r=t.length;r--;)if(iB(t[r][0],e))return r;return-1}function JP(t){if(!oB(t)||(e=t,zP&&zP in e))return!1;var e,r=function(t){var e=oB(t)?PP.call(t):"";return e==gP||e==yP}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?BP:_P;return r.test(function(t){if(null!=t){try{return OP.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function WP(t,e,r,i){if(!oB(t))return t;e=function(t,e){if(nB(t))return!1;var r=typeof t;if("number"==r||"symbol"==r||"boolean"==r||null==t||aB(t))return!0;return vP.test(t)||!wP.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return nB(t)?t:tB(t)}(e);for(var n=-1,o=e.length,a=o-1,s=t;null!=s&&++n<o;){var h=eB(e[n]),u=r;if(n!=a){var l=s[h];void 0===(u=i?i(l,h,s):void 0)&&(u=oB(l)?l:XP(e[n+1])?[]:{})}ZP(s,h,u),s=s[h]}return t}function YP(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function QP(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return JP(r)?r:void 0}function XP(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||EP.test(t))&&t>-1&&t%1==0&&t<e}VP.prototype.clear=function(){this.__data__=UP?UP(null):{}},VP.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},VP.prototype.get=function(t){var e=this.__data__;if(UP){var r=e[t];return r===pP?void 0:r}return RP.call(e,t)?e[t]:void 0},VP.prototype.has=function(t){var e=this.__data__;return UP?void 0!==e[t]:RP.call(e,t)},VP.prototype.set=function(t,e){return this.__data__[t]=UP&&void 0===e?pP:e,this},HP.prototype.clear=function(){this.__data__=[]},HP.prototype.delete=function(t){var e=this.__data__,r=KP(e,t);return!(r<0)&&(r==e.length-1?e.pop():$P.call(e,r,1),!0)},HP.prototype.get=function(t){var e=this.__data__,r=KP(e,t);return r<0?void 0:e[r][1]},HP.prototype.has=function(t){return KP(this.__data__,t)>-1},HP.prototype.set=function(t,e){var r=this.__data__,i=KP(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},GP.prototype.clear=function(){this.__data__={hash:new VP,map:new(LP||HP),string:new VP}},GP.prototype.delete=function(t){return YP(this,t).delete(t)},GP.prototype.get=function(t){return YP(this,t).get(t)},GP.prototype.has=function(t){return YP(this,t).has(t)},GP.prototype.set=function(t,e){return YP(this,t).set(t,e),this};var tB=rB((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(aB(t))return qP?qP.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var r=[];return bP.test(t)&&r.push(""),t.replace(kP,(function(t,e,i,n){r.push(i?n.replace(MP,"$1"):e||t)})),r}));function eB(t){if("string"==typeof t||aB(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function rB(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var a=t.apply(this,i);return r.cache=o.set(n,a),a};return r.cache=new(rB.Cache||GP),r}function iB(t,e){return t===e||t!=t&&e!=e}rB.Cache=GP;var nB=Array.isArray;function oB(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function aB(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==PP.call(t)}var sB=function(t,e,r){return null==t?t:WP(t,e,r)};const hB={evm:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=new Ss(t,dP,e),s=new $i(r);try{const t=Math.ceil(i.length/n),e=[];Array.from(Array(t)).forEach(((t,r)=>{const h=i.slice(n*r,n*(r+1));e.push(a.aggregate(h.map((t=>[t[0].toLowerCase(),s.encodeFunctionData(t[1],t[2])])),o))}));let r=yield Promise.all(e);return r=r.reduce(((t,[,e])=>t.concat(e)),[]),r.map(((t,e)=>s.decodeFunctionResult(i[e][1],t)))}catch(t){return Promise.reject(t)}}))},starknet:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=i.map((t=>({contractAddress:t[0],entrypoint:t[1],calldata:t[2]||[]}))),s=[];for(let t=0;t<a.length;t+=n)s.push(a.slice(t,t+n));const h=yield Promise.all(s.map((r=>{var i;return e.callContract({contractAddress:t,entrypoint:"aggregate",calldata:nz.fromCallsToExecuteCalldata(r)},null!==(i=o.blockTag)&&void 0!==i?i:"latest")})));return h.map((t=>{const[e,r,...i]=t;return mP(i)})).flat().map(((t,e)=>{const[,n]=i[e];return[fP(t,r.find((t=>t.name===n)))]}))}))}};function uB(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n={}){var o;const a=(null==n?void 0:n.multicallAddress)||JO[t].multicall;if(!a)throw new Error("missing multicall address");const s=Object.assign({},n),h=(null==s?void 0:s.limit)||500;delete s.limit,delete s.multicallAddress;const u=(null===(o=JO[t])||void 0===o?void 0:o.starknet)?"starknet":"evm";return hB[u](a,e,r,i,h,s)}))}const lB=["response not found during CCIP fetch","UNSUPPORTED_OPERATION"],cB="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",dB=["function text(bytes32 node, string calldata key) external view returns (string memory)","function resolver(bytes32 node) view returns (address)"],fB="0x0000000000000000000000000000000000000000",mB={Accept:"application/json","Content-Type":"application/json"},pB="https://score.snapshot.org";function gB(t=pB,e={path:""}){const r=new URL(t);e.path&&(r.pathname=e.path);const i=r.searchParams.get("apiKey");let n=Object.assign({},mB);return i&&(r.searchParams.delete("apiKey"),n=Object.assign(Object.assign({},mB),{"X-API-KEY":i})),{url:r.toString(),headers:n}}function yB(t){return r(this,void 0,void 0,(function*(){let e=yield t.text();try{e=JSON.parse(e)}catch(r){return Promise.reject({code:t.status||500,message:"Failed to parse response from score API",data:e})}return e.error?Promise.reject(e.error):e}))}const wB=new Fd({allErrors:!0,allowUnionTypes:!0,$data:!0,passContext:!0});Gd(wB),Kd(wB),wB.addFormat("address",{validate:t=>{try{return t===xr(t)}catch(t){return!1}}}),wB.addFormat("evmAddress",{validate:t=>{try{return xr(t),!0}catch(t){return!1}}}),wB.addFormat("starknetAddress",{validate:t=>{try{return gO(t).toLowerCase()===t.toLowerCase()}catch(t){return!1}}}),wB.addFormat("long",{validate:()=>!0}),wB.addFormat("lowercase",{validate:t=>t===t.toLowerCase()}),wB.addFormat("color",{validate:t=>!!t&&!!t.match(/^#[0-9A-F]{6}$/)}),wB.addFormat("ethValue",{validate:t=>{if(!t.match(/^([0-9]|[1-9][0-9]+)(\.[0-9]+)?$/))return!1;try{return function(t,e){if("string"!=typeof t&&Nh.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=Ih.indexOf(e);-1!==t&&(e=3*t)}mh(t,null!=e?e:18)}(t,18),!0}catch(t){return!1}}});const vB=Object.keys(JO),bB=Object.keys(JO).filter((t=>!JO[t].testnet));function kB(t){const e=t.endsWith(".eth"),r=t.split(".");if(1===r.length)return"tld";if(2!==r.length||e){if(r.length>2)return"subdomain";if(e)return"ens";throw new Error("Invalid domain")}return"other-tld"}function MB(t){return r(this,void 0,void 0,(function*(){var e;const r=yield h(`https://cloudflare-dns.com/dns-query?name=${t}&type=TXT`,{headers:{accept:"application/dns-json"}}),i=yield r.json();if(3===i.Status)return fB;if(0!==i.Status)throw new Error("Failed to fetch DNS Owner");const n=null===(e=i.Answer)||void 0===e?void 0:e.find((t=>t.data.includes("ENS1")));return n?xr(n.data.replace(new RegExp('"',"g"),"").split(" ").pop()):fB}))}function _B(t,e,i,n){return r(this,void 0,void 0,(function*(){const r=new Ss(i[0],e,t);try{const t=i[2]||[];return yield r[i[1]](...t,n||{})}catch(t){return Promise.reject(t)}}))}function EB(t,e){return r(this,arguments,void 0,(function*(t,e,r={}){const i={query:ml.jsonToGraphQLQuery({query:e})};r.variables&&(i.variables=r.variables);const n=yield h(t,{method:"POST",headers:Object.assign({Accept:"application/json","Content-Type":"application/json"},null==r?void 0:r.headers),body:JSON.stringify(i)});let o=yield n.text();try{o=JSON.parse(o)}catch(e){throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${o.substring(0,400)}`)}if(o.errors)throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${JSON.stringify(o.errors).substring(0,400)}`);const{data:a}=o;return a||{}}))}function AB(t,e=VR[0]){const r=`https://${e}`;if(!t)return null;if(!(t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("https://")||t.startsWith("http://")))return`${r}/ipfs/${t}`;const i=t.split("://")[0];return"ipfs"===i?t.replace("ipfs://",`${r}/ipfs/`):"ipns"===i?t.replace("ipns://",`${r}/ipns/`):t}function jB(t,i){return r(this,arguments,void 0,(function*(t,r,i="1",n={}){var o,a;const{ensResolvers:s=(null===(o=JO[i])||void 0===o?void 0:o.ensResolvers)||JO[1].ensResolvers,broviderUrl:h}=n,u=e(n,["ensResolvers","broviderUrl"]);let l;try{l=Ou(zu(t))}catch(t){return null}const c=QO(i,{broviderUrl:h}),d=[[cB,"resolver",[l]],...s.map((t=>[t,"text",[l,r]]))],[[f],...m]=yield uB(i,c,dB,d,u),p=s.indexOf(f);return-1!==p?null===(a=m[p])||void 0===a?void 0:a[0]:null}))}function xB(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){try{return yield jB(t,"snapshot",e,r)}catch(t){return console.log(t),null}}))}function SB(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){var i,n;if(!(null===(n=null===(i=JO[e])||void 0===i?void 0:i.ensResolvers)||void 0===n?void 0:n.length))throw new Error("Network not supported");const o=kB(t),a=QO(e,r),s=new Ss(cB,["function owner(bytes32) view returns (address)"],a);let h;try{h=Ou(zu(t))}catch(t){return fB}const u=r.ensNameWrapper||JO[e].ensNameWrapper;let l=yield s.owner(h);if(l===u){const t=new Ss(u,["function ownerOf(uint256) view returns (address)"],a);l=yield t.ownerOf(h)}if(l===fB&&"other-tld"===o){(yield a.resolveName(t))&&(l=yield MB(t))}if(l===fB&&"subdomain"===o)try{l=yield a.resolveName(t)}catch(t){if(lB.every((e=>!t.message.includes(e))))throw t;l=fB}return l||fB}))}function NB(t,e){return r(this,arguments,void 0,(function*(t,e,r={}){const i=yield xB(t,e,r);if(i){let t=Sr(i);if(t)return i;const e=i.split("/"),r=e.includes("testnet")?5:4,n=e[r];if(t=Sr(n),t)return n}return yield SB(t,e,r)}))}function IB(t,e){return r(this,void 0,void 0,(function*(){if(!t.endsWith(".shib"))return fB;const r=yield h("https://stamp.fyi",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"get_owner",params:t,network:e})});return(yield r.json()).result}))}function TB(t){const e=["th","st","nd","rd"],r=t%100;return t+(e[(r-20)%10]||e[r]||e[0])}function CB(t){return!!JO[t]}function zB(t){return t!==fB&&(Sr(t)||RB(t))}function OB(t,e){return"latest"===t||"number"==typeof t&&t>=JO[e].start}function RB(t){if(!t)return!1;try{return gO(t),!0}catch(t){return!1}}function PB(t){return Sr(t)}function BB(t,e){if("string"!=typeof t||!/^0[xX]/.test(t))throw new Error(`Invalid address: ${t}`);const r=null!=e?e:42===t.length?"evm":"starknet";if("evm"===r&&PB(t))return xr(t);if("starknet"===r&&RB(t))return gO(t);throw new Error(`Invalid ${r} address: ${t}`)}function DB(t){return Promise.reject(new Error(t))}wB.addKeyword({keyword:"snapshotNetwork",validate:function(t,e){return"mainnet"===(this.snapshotEnv||"default")?bB.includes(e):vB.includes(e)},error:{message:"network not allowed"}}),wB.addFormat("customUrl",{type:"string",validate:t=>!t.length||(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("snapshot://"))}),wB.addFormat("domain",{validate:t=>!!t&&!!t.match(/^(https:\/\/)?([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}(\/)?$/)});var $B={call:_B,multicall:uB,subgraphRequest:EB,ipfsGet:function(t,e){return r(this,arguments,void 0,(function*(t,e,r="ipfs"){return h(`https://${t}/${r}/${e}`).then((t=>t.json()))}))},getUrl:AB,getJSON:function(t){return r(this,arguments,void 0,(function*(t,e={}){const r=AB(t,e.gateways);return h(r).then((t=>t.json()))}))},sendTransaction:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=t.getSigner(),s=new Ss(e,r,t).connect(a);return yield s[i](...n,o)}))},getScores:function(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n="latest",o=pB,a={}){if(!Array.isArray(i))return DB("addresses should be an array of addresses");if(0===i.length)return DB("addresses can not be empty");const s=i.find((t=>!zB(t)));if(s)return DB(`Invalid address: ${s}`);if(!CB(r))return DB(`Invalid network: ${r}`);const u=e.find((t=>t.network&&!CB(t.network)));if(u)return DB(`Invalid network (${u.network}) in strategy ${u.name}`);if(!OB(n,r))return DB(`Snapshot (${n}) must be 'latest' or greater than network start block (${JO[r].start})`);new URL(o).pathname="/api/scores";const{url:l,headers:c}=gB(o,{path:"/api/scores"});try{const o={space:t,network:r,snapshot:n,strategies:e,addresses:i},s=yield h(l,{method:"POST",headers:c,body:JSON.stringify({params:o})}),u=yield yB(s);return"all"===a.returnValue?u.result:u.result[a.returnValue||"scores"]}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},getVp:function(t,e,i,n,o,a,s){return r(this,void 0,void 0,(function*(){const{url:r,headers:u}=gB(null==s?void 0:s.url);if(!zB(t))return DB(`Invalid voter address: ${t}`);if(!CB(e))return DB(`Invalid network: ${e}`);const l=i.find((t=>t.network&&!CB(t.network)));if(l)return DB(`Invalid network (${l.network}) in strategy ${l.name}`);if(!OB(n,e))return DB(`Snapshot (${n}) must be 'latest' or greater than network start block (${JO[e].start})`);const c={method:"POST",headers:u,body:JSON.stringify({jsonrpc:"2.0",method:"get_vp",params:{address:t,network:e,strategies:i,snapshot:n,space:o,delegation:a}})};try{const t=yield h(r,c);return(yield yB(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},validateSchema:function(t,e,r={snapshotEnv:"default",spaceType:"default"}){const i=wB.compile(t),n=i.call(r,e);return n||i.errors},getEnsTextRecord:jB,getSpaceUri:xB,getEnsOwner:SB,getSpaceController:function(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){if(["1","11155111"].includes(e))return NB(t,e,r);if(["109","157"].includes(e))return IB(t,e);throw new Error(`Network not supported: ${e}`)}))},getDelegatesBySpace:function(t,e){return r(this,arguments,void 0,(function*(t,e,r="latest",i={}){const n=i.subgraphUrl||aP[t];if(!n)return Promise.reject(`Delegation subgraph not available for network ${t}`);let o=0;const a=new Map,s=e?lP(e):null;for(;;){const t=yield cP({url:n,spaces:s,pivot:o,snapshot:r});if(hP(t))throw new Error("Unable to paginate delegation");if(t.forEach((t=>{uP(a,t),o=t.timestamp})),t.length<sP)break}return[...a.values()]}))},clone:function(t){return JSON.parse(JSON.stringify(t))},sleep:function(t){return r(this,void 0,void 0,(function*(){return new Promise((e=>{setTimeout(e,t)}))}))},getNumberWithOrdinal:TB,voting:oP,getProvider:QO,signMessage:function(t,e,i){return r(this,void 0,void 0,(function*(){return e=te(new G(e,"utf8")),yield t.send("personal_sign",[e,i])}))},getBlockNumber:function(t){return r(this,void 0,void 0,(function*(){try{const e=yield t.getBlockNumber();return parseInt(e)}catch(t){return Promise.reject()}}))},Multicaller:class{constructor(t,e,r,i={}){this.options={},this.calls=[],this.paths=[],this.network=t,this.provider=e,this.abi=r,this.options=i}call(t,e,r,i){return this.calls.push([e,r,i]),this.paths.push(t),this}execute(t){return r(this,void 0,void 0,(function*(){const e=t||{};return(yield uB(this.network,this.provider,this.abi,this.calls,this.options)).forEach(((t,r)=>sB(e,this.paths[r],t.length>1?t:t[0]))),this.calls=[],this.paths=[],e}))}},getSnapshots:function(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n={}){const o={};if(i.forEach((t=>o[t]="latest")),"latest"===e)return o;const a=`${t}-${e}-${i.join("-")}`,s=Jd[a],h=Date.now();if(s&&Wd>h)return s;Wd<h&&(Jd={},Wd=h+36e5-h%36e5),o[t]=e;const u=Object.keys(o).filter((e=>t!==e));if(0===u.length)return o;const l={blocks:{__args:{where:{ts:(yield r.getBlock(e)).timestamp,network_in:u}},network:!0,number:!0}},c=n.blockFinderUrl||"https://blockfinder.snapshot.org";return(yield EB(c,l)).blocks.forEach((t=>o[t.network]=t.number)),Jd[a]=o,o}))},getHash:function(t,e){return(aR(t)?hR:qR).getHash(t,e)},verify:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="1",n={}){if(!RB(t)&&!PB(t))throw new Error("Invalid address");const o=aR(r)?hR:qR;return yield o.default(t,e,r,i,n)}))},validate:function(t,e,i,n,o,a,s){return r(this,void 0,void 0,(function*(){if(!zB(e))return DB(`Invalid author: ${e}`);if(!CB(n))return DB(`Invalid network: ${n}`);if(!OB(o,n))return DB(`Snapshot (${o}) must be 'latest' or greater than network start block (${JO[n].start})`);s||(s={});const{url:r,headers:u}=gB(s.url),l={method:"POST",headers:u,body:JSON.stringify({jsonrpc:"2.0",method:"validate",params:{validation:t,author:e,space:i,network:n,snapshot:o,params:a}})};try{const t=yield h(r,l);return(yield yB(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},isStarknetAddress:RB,isEvmAddress:PB,getFormattedAddress:BB,SNAPSHOT_SUBGRAPH_URL:aP};const LB={name:"snapshot",version:"0.1.4"};class UB{constructor(t=N.sequencer,e={}){t=(t=(t=t.replace(N.hub,N.sequencer)).replace(I.hub,I.sequencer)).replace(T.hub,T.sequencer),this.address=t,this.options=e}sign(t,e,i,n){return r(this,void 0,void 0,(function*(){var r;const o=(null==t?void 0:t.getSigner)?t.getSigner():t,a=BB(e,"evm");i.from=i.from?BB(i.from):a,i.timestamp||(i.timestamp=parseInt((Date.now()/1e3).toFixed()));const s=Object.assign({},LB);"undefined"!=typeof window&&(null===(r=window.ethereum)||void 0===r?void 0:r.isTrust)&&(s.chainId=(yield o.provider.getNetwork()).chainId);const h={domain:s,types:n,message:i},u=yield o._signTypedData(s,h.types,i);return yield this.send({address:a,sig:u,data:h})}))}send(t){return r(this,void 0,void 0,(function*(){let e=this.address;"0x"===t.sig&&this.options.relayerURL&&(e=this.options.relayerURL);const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)};return new Promise(((t,i)=>{h(e,r).then((e=>{var r;if(e.ok)return t(e.json());if(null===(r=e.headers.get("content-type"))||void 0===r?void 0:r.includes("application/json"))return e.json().then(i).catch(i);throw e})).catch(i)}))}))}space(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,u)}))}proposal(t,e,i){return r(this,void 0,void 0,(function*(){return i.labels||(i.labels=[]),i.discussion||(i.discussion=""),i.app||(i.app=""),i.privacy||(i.privacy=""),yield this.sign(t,e,i,l)}))}updateProposal(t,e,i){return r(this,void 0,void 0,(function*(){return i.privacy||(i.privacy=""),yield this.sign(t,e,i,c)}))}flagProposal(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,d)}))}cancelProposal(t,e,i){return r(this,void 0,void 0,(function*(){const r=i.proposal.startsWith("0x");return yield this.sign(t,e,i,r?m:f)}))}vote(t,e,i){return r(this,void 0,void 0,(function*(){const r="shutter"===(null==i?void 0:i.privacy);i.reason||(i.reason=""),i.app||(i.app=""),i.metadata||(i.metadata="{}");const n=i.proposal.startsWith("0x");let o=n?w:p;return["approval","ranked-choice"].includes(i.type)&&(o=n?v:g),!r&&["quadratic","weighted"].includes(i.type)&&(o=n?b:y,i.choice=JSON.stringify(i.choice)),r&&(o=n?b:y),delete i.privacy,delete i.type,yield this.sign(t,e,i,o)}))}follow(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,k)}))}unfollow(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,M)}))}subscribe(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,_)}))}unsubscribe(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,E)}))}profile(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,A)}))}statement(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,j)}))}alias(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,x)}))}deleteSpace(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,S)}))}}var FB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Proposal",definitions:{Proposal:{title:"Proposal",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{type:"string",enum:["single-choice","approval","ranked-choice","quadratic","copeland","weighted","custom","basic"]},snapshot:{type:"number",title:"snapshot"},start:{type:"number",title:"start",minimum:1e9,maximum:2e9},end:{type:"number",title:"end",minimum:1e9,maximum:2e9},metadata:{type:"object",title:"metadata"},app:{type:"string",title:"app",maxLength:24},privacy:{type:"string",enum:["","shutter"]}},required:["name","body","choices","snapshot","start","end"],additionalProperties:!1}}},qB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateProposal",definitions:{UpdateProposal:{title:"Update Proposal",type:"object",properties:{proposal:{type:"string",title:"proposal id"},name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},metadata:{type:"object",title:"metadata"},privacy:{type:"string",enum:["","shutter"]}},required:["proposal","name","body","discussion","choices","type","metadata"],additionalProperties:!1}}},VB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Vote",definitions:{Vote:{title:"Vote",type:"object",properties:{proposal:{type:"string",title:"proposal"},choice:{type:["number","array","object","boolean","string"],title:"choice"},metadata:{type:"object",title:"metadata"},reason:{type:"string",title:"reason",maxLength:5e3},app:{type:"string",title:"app",maxLength:24}},required:["proposal","choice"],additionalProperties:!1}}},HB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Profile",definitions:{Profile:{title:"Profile",type:"object",properties:{name:{type:"string",title:"name",maxLength:32},about:{type:"string",title:"about",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},lens:{type:"string",title:"lens",pattern:"^[A-Za-z0-9_]*$",maxLength:26},farcaster:{type:"string",title:"farcaster",pattern:"^[a-z0-9-]*$",maxLength:17}},required:[],additionalProperties:!1}}},GB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Statement",definitions:{Statement:{title:"Statement",type:"object",properties:{about:{type:"string",format:"long",title:"About",maxLength:140},statement:{type:"string",format:"long",title:"Statement",maxLength:1e4},discourse:{type:"string",title:"discourse",pattern:"^[A-Za-z0-9-_.]*$",maxLength:30},network:{type:"string",title:"network",pattern:"^[a-z0-9-]*$",maxLength:24},status:{enum:["ACTIVE","INACTIVE"],title:"status"}},required:[],additionalProperties:!1}}},ZB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Zodiac",definitions:{Zodiac:{title:"Zodiac",type:"object",properties:{safes:{title:"Safe(s)",type:"array",maxItems:8,items:{type:"object",properties:{network:{title:"Network",type:"string",snapshotNetwork:!0},multisend:{title:"Multisend contract address",type:"string"},realityAddress:{title:"Reality module address",type:"string"},umaAddress:{title:"UMA module address",type:"string"}},additionalProperties:!1}},additionalProperties:!1}}}},KB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Alias",definitions:{Alias:{title:"Alias",type:"object",properties:{alias:{type:"string",format:"address"}},required:["alias"],additionalProperties:!1}}};return{Client:UB,Client712:UB,schemas:{space:{$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Space",definitions:{Space:{title:"Space",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:32},private:{type:"boolean"},about:{type:"string",title:"about",maxLength:160},guidelines:{type:"string",format:"customUrl",title:"guidelines",maxLength:256},template:{type:"string",title:"template",maxLength:1024},terms:{type:"string",title:"terms",format:"customUrl",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},location:{type:"string",title:"location",maxLength:24},website:{type:"string",title:"website",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},coingecko:{type:"string",title:"coingecko",pattern:"^[a-z0-9-]*$",maxLength:32},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},farcaster:{type:"string",title:"farcaster"},email:{type:"string",title:"email",maxLength:32},network:{type:"string",snapshotNetwork:!0,title:"network",minLength:1},symbol:{type:"string",title:"symbol",maxLength:16},skin:{type:"string",title:"skin",maxLength:32},domain:{type:"string",title:"domain",maxLength:64,format:"domain"},discussions:{type:"string",format:"uri",title:"Discussions link",maxLength:256},discourseCategory:{type:"integer",minimum:1,title:"Discourse category"},strategies:{type:"array",minItems:1,uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},network:{type:"string",title:"network",snapshotNetwork:!0},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},title:"strategies"},members:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"members",uniqueItems:!0},admins:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"admins",uniqueItems:!0},moderators:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"moderators",uniqueItems:!0},filters:{type:"object",properties:{defaultTab:{type:"string"},minScore:{type:"number",minimum:0},onlyMembers:{type:"boolean"},invalids:{type:"array",items:{type:"string",maxLength:64},title:"invalids"}},additionalProperties:!1},validation:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},voteValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},followValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},delegationPortal:{type:"object",properties:{delegationType:{type:"string",title:"Delegation type",description:"Specify the type of delegation that you are using",anyOf:[{const:"compound-governor",title:"Compound governor"},{const:"split-delegation",title:"Split Delegation"},{const:"apechain-delegate-registry",title:"ApeChain Delegate Registry"}]},delegationContract:{type:"string",title:"Contract address",description:"The address of your delegation contract",examples:["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"],anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},delegationNetwork:{type:"string",title:"Delegation network",description:"The network of your delegation contract",snapshotNetwork:!0},delegationApi:{type:"string",format:"uri",title:"Delegation API",description:"The URL of your delegation API (e.g a subgraph)",examples:["https://subgrapher.snapshot.org/subgraph/arbitrum/FTzC6VrZd8JhJgWfTJnwWgH1Z1dS3GxaosKkRbCqkZAZ"]}},required:["delegationType","delegationApi","delegationContract"],additionalProperties:!1},allowAlias:{type:"boolean"},plugins:{type:"object"},voting:{type:"object",properties:{delay:{type:"integer",minimum:0,maximum:2592e3,errorMessage:{maximum:"Delay must be less than 30 days"}},period:{type:"integer",minimum:0,maximum:31622400,errorMessage:{maximum:"Delay must be less than a year"}},type:{type:"string",title:"type"},quorum:{type:"number",minimum:0},quorumType:{type:"string",enum:["rejection"]},blind:{type:"boolean"},hideAbstain:{type:"boolean"},aliased:{type:"boolean"},privacy:{type:"string",enum:["","shutter","any"]}},additionalProperties:!1},categories:{type:"array",maxItems:2,items:{type:"string",enum:["protocol","social","investment","grant","service","media","creator","collector","ai-agent","gaming","wallet","music","layer-2","defai","defi","rwa","depin","meme"]}},treasuries:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",title:"Name",examples:["e.g. Balancer DAO 1"],minLength:1,maxLength:64},address:{type:"string",title:"Contract address",examples:["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},network:{type:"string",title:"Network",snapshotNetwork:!0}},required:["name","address","network"],additionalProperties:!1}},labels:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{id:{type:"string",title:"Id",minLength:1,maxLength:8},name:{type:"string",title:"Name",minLength:1,maxLength:32},description:{type:"string",title:"Description",maxLength:100},color:{type:"string",title:"Color",format:"color"}},required:["id","name","color"],additionalProperties:!1}},parent:{type:"string",title:"parent"},children:{type:"array",maxItems:16,title:"children",items:{type:"string"},uniqueItems:!0},boost:{type:"object",properties:{enabled:{type:"boolean"},bribeEnabled:{type:"boolean"}},required:["enabled","bribeEnabled"],additionalProperties:!1},skinSettings:{type:"object",properties:{bg_color:{type:"string",format:"color"},link_color:{type:"string",format:"color"},text_color:{type:"string",format:"color"},content_color:{type:"string",format:"color"},border_color:{type:"string",format:"color"},heading_color:{type:"string",format:"color"},primary_color:{type:"string",format:"color"},header_color:{type:"string",format:"color"},theme:{type:"string",enum:["light","dark"]},logo:{type:"string",title:"logo",format:"customUrl",maxLength:256}},additionalProperties:!1}},required:["name","network","strategies"],additionalProperties:!1}}}.definitions.Space,proposal:FB.definitions.Proposal,updateProposal:qB.definitions.UpdateProposal,vote:VB.definitions.Vote,profile:HB.definitions.Profile,statement:GB.definitions.Statement,zodiac:ZB.definitions.Zodiac,alias:KB.definitions.Alias},utils:$B}}));
232
+ const tj=VE.Store,ej=qA.MemoryCookieStore,rj=KE.pathMatch,{fromCallback:ij}=HE,{getCustomInspectSymbol:nj}=OA,oj=/^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/,aj=/[\x00-\x1F]/,sj=["\n","\r","\0"],hj=/[\x20-\x3A\x3C-\x7E]+/,uj=/[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/,lj={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},cj=2147483647e3,dj='Invalid sameSiteContext option for getCookies(); expected one of "strict", "lax", or "none"';function fj(t){YA.validate(YA.isNonEmptyString(t),t);const e=String(t).toLowerCase();return"none"===e||"lax"===e||"strict"===e?e:null}const mj=Object.freeze({SILENT:"silent",STRICT:"strict",DISABLED:"unsafe-disabled"}),pj=/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-f\d]{1,4}:){7}(?:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,2}|:)|(?:[a-f\d]{1,4}:){4}(?:(?::[a-f\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,3}|:)|(?:[a-f\d]{1,4}:){3}(?:(?::[a-f\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,4}|:)|(?:[a-f\d]{1,4}:){2}(?:(?::[a-f\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,5}|:)|(?:[a-f\d]{1,4}:){1}(?:(?::[a-f\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,6}|:)|(?::(?:(?::[a-f\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,7}|:)))$)/,gj="\n\\[?(?:\n(?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|:[a-fA-F\\d]{1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,2}|:)|\n(?:[a-fA-F\\d]{1,4}:){4}(?:(?::[a-fA-F\\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,3}|:)|\n(?:[a-fA-F\\d]{1,4}:){3}(?:(?::[a-fA-F\\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,4}|:)|\n(?:[a-fA-F\\d]{1,4}:){2}(?:(?::[a-fA-F\\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,5}|:)|\n(?:[a-fA-F\\d]{1,4}:){1}(?:(?::[a-fA-F\\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,6}|:)|\n(?::(?:(?::[a-fA-F\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,7}|:))\n)(?:%[0-9a-zA-Z]{1,})?\\]?\n".replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),yj=new RegExp(`^${gj}$`);function wj(t,e,r,i){let n=0;for(;n<t.length;){const e=t.charCodeAt(n);if(e<=47||e>=58)break;n++}return n<e||n>r?null:i||n==t.length?parseInt(t.substr(0,n),10):null}function vj(t){const e=t.split(":"),r=[0,0,0];if(3!==e.length)return null;for(let t=0;t<3;t++){const i=2==t,n=wj(e[t],1,2,i);if(null===n)return null;r[t]=n}return r}function bj(t){t=String(t).substr(0,3).toLowerCase();const e=lj[t];return e>=0?e:null}function kj(t){if(!t)return;const e=t.split(uj);if(!e)return;let r=null,i=null,n=null,o=null,a=null,s=null;for(let t=0;t<e.length;t++){const h=e[t].trim();if(!h.length)continue;let u;null===n&&(u=vj(h),u)?(r=u[0],i=u[1],n=u[2]):null!==o||(u=wj(h,1,2,!0),null===u)?null!==a||(u=bj(h),null===u)?null===s&&(u=wj(h,2,4,!0),null!==u&&(s=u,s>=70&&s<=99?s+=1900:s>=0&&s<=69&&(s+=2e3))):a=u:o=u}return null===o||null===a||null===s||null===n||o<1||o>31||s<1601||r>23||i>59||n>59?void 0:new Date(Date.UTC(s,a,o,r,i,n))}function Mj(t){return YA.validate(YA.isDate(t),t),t.toUTCString()}function _j(t){return null==t?null:(t=t.trim().replace(/^\./,""),yj.test(t)&&(t=t.replace("[","").replace("]","")),XA&&/[^\u0001-\u007f]/.test(t)&&(t=XA.toASCII(t)),t.toLowerCase())}function Ej(t,e,r){if(null==t||null==e)return null;if(!1!==r&&(t=_j(t),e=_j(e)),t==e)return!0;const i=t.lastIndexOf(e);return!(i<=0)&&(t.length===e.length+i&&("."===t.substr(i-1,1)&&!pj.test(t)))}function Aj(t){if(!t||"/"!==t.substr(0,1))return"/";if("/"===t)return t;const e=t.lastIndexOf("/");return 0===e?"/":t.slice(0,e)}function jj(t,e){t=function(t){if(YA.isEmptyString(t))return t;for(let e=0;e<sj.length;e++){const r=t.indexOf(sj[e]);-1!==r&&(t=t.substr(0,r))}return t}(t),YA.validate(YA.isString(t),t);let r,i,n=t.indexOf("=");if(e)0===n&&(n=(t=t.substr(1)).indexOf("="));else if(n<=0)return;if(n<=0?(r="",i=t.trim()):(r=t.substr(0,n).trim(),i=t.substr(n+1).trim()),aj.test(r)||aj.test(i))return;const o=new zj;return o.key=r,o.value=i,o}function xj(t,e){if(e&&"object"==typeof e||(e={}),YA.isEmptyString(t)||!YA.isString(t))return null;const r=(t=t.trim()).indexOf(";"),i=jj(-1===r?t:t.substr(0,r),!!e.loose);if(!i)return;if(-1===r)return i;const n=t.slice(r+1).trim();if(0===n.length)return i;const o=n.split(";");for(;o.length;){const t=o.shift().trim();if(0===t.length)continue;const e=t.indexOf("=");let r,n;switch(-1===e?(r=t,n=null):(r=t.substr(0,e),n=t.substr(e+1)),r=r.trim().toLowerCase(),n&&(n=n.trim()),r){case"expires":if(n){const t=kj(n);t&&(i.expires=t)}break;case"max-age":if(n&&/^-?[0-9]+$/.test(n)){const t=parseInt(n,10);i.setMaxAge(t)}break;case"domain":if(n){const t=n.trim().replace(/^\./,"");t&&(i.domain=t.toLowerCase())}break;case"path":i.path=n&&"/"===n[0]?n:null;break;case"secure":i.secure=!0;break;case"httponly":i.httpOnly=!0;break;case"samesite":switch(n?n.toLowerCase():""){case"strict":i.sameSite="strict";break;case"lax":i.sameSite="lax";break;case"none":i.sameSite="none";break;default:i.sameSite=void 0}break;default:i.extensions=i.extensions||[],i.extensions.push(t)}}return i}function Sj(t){let e;try{e=JSON.parse(t)}catch(t){return t}return e}function Nj(t){if(!t||YA.isEmptyString(t))return null;let e;if("string"==typeof t){if(e=Sj(t),e instanceof Error)return null}else e=t;const r=new zj;for(let t=0;t<zj.serializableProperties.length;t++){const i=zj.serializableProperties[t];void 0!==e[i]&&e[i]!==Cj[i]&&("expires"===i||"creation"===i||"lastAccessed"===i?null===e[i]?r[i]=null:r[i]="Infinity"==e[i]?"Infinity":new Date(e[i]):r[i]=e[i])}return r}function Ij(t,e){YA.validate(YA.isObject(t),t),YA.validate(YA.isObject(e),e);let r=0;const i=t.path?t.path.length:0;if(r=(e.path?e.path.length:0)-i,0!==r)return r;return r=(t.creation?t.creation.getTime():cj)-(e.creation?e.creation.getTime():cj),0!==r||(r=t.creationIndex-e.creationIndex),r}function Tj(t){if(t instanceof Object)return t;try{t=decodeURI(t)}catch(t){}return DE(t)}const Cj={key:"",value:"",expires:"Infinity",maxAge:null,domain:null,path:null,secure:!1,httpOnly:!1,extensions:null,hostOnly:null,pathIsDefault:null,creation:null,lastAccessed:null,sameSite:void 0};class zj{constructor(t={}){const e=nj();e&&(this[e]=this.inspect),Object.assign(this,Cj,t),this.creation=this.creation||new Date,Object.defineProperty(this,"creationIndex",{configurable:!1,enumerable:!1,writable:!0,value:++zj.cookiesCreated})}inspect(){const t=Date.now(),e=null!=this.hostOnly?this.hostOnly:"?",r=this.creation?t-this.creation.getTime()+"ms":"?",i=this.lastAccessed?t-this.lastAccessed.getTime()+"ms":"?";return`Cookie="${this.toString()}; hostOnly=${e}; aAge=${i}; cAge=${r}"`}toJSON(){const t={};for(const e of zj.serializableProperties)this[e]!==Cj[e]&&("expires"===e||"creation"===e||"lastAccessed"===e?null===this[e]?t[e]=null:t[e]="Infinity"==this[e]?"Infinity":this[e].toISOString():"maxAge"===e?null!==this[e]&&(t[e]=this[e]==1/0||this[e]==-1/0?this[e].toString():this[e]):this[e]!==Cj[e]&&(t[e]=this[e]));return t}clone(){return Nj(this.toJSON())}validate(){if(!oj.test(this.value))return!1;if(!(this.expires==1/0||this.expires instanceof Date||kj(this.expires)))return!1;if(null!=this.maxAge&&this.maxAge<=0)return!1;if(null!=this.path&&!hj.test(this.path))return!1;const t=this.cdomain();if(t){if(t.match(/\.$/))return!1;if(null==qE.getPublicSuffix(t))return!1}return!0}setExpires(t){t instanceof Date?this.expires=t:this.expires=kj(t)||"Infinity"}setMaxAge(t){this.maxAge=t===1/0||t===-1/0?t.toString():t}cookieString(){let t=this.value;return null==t&&(t=""),""===this.key?t:`${this.key}=${t}`}toString(){let t=this.cookieString();if(this.expires!=1/0&&(this.expires instanceof Date?t+=`; Expires=${Mj(this.expires)}`:t+=`; Expires=${this.expires}`),null!=this.maxAge&&this.maxAge!=1/0&&(t+=`; Max-Age=${this.maxAge}`),this.domain&&!this.hostOnly&&(t+=`; Domain=${this.domain}`),this.path&&(t+=`; Path=${this.path}`),this.secure&&(t+="; Secure"),this.httpOnly&&(t+="; HttpOnly"),this.sameSite&&"none"!==this.sameSite){const e=zj.sameSiteCanonical[this.sameSite.toLowerCase()];t+=`; SameSite=${e||this.sameSite}`}return this.extensions&&this.extensions.forEach((e=>{t+=`; ${e}`})),t}TTL(t){if(null!=this.maxAge)return this.maxAge<=0?0:1e3*this.maxAge;let e=this.expires;return e!=1/0?(e instanceof Date||(e=kj(e)||1/0),e==1/0?1/0:e.getTime()-(t||Date.now())):1/0}expiryTime(t){if(null!=this.maxAge){const e=t||this.creation||new Date,r=this.maxAge<=0?-1/0:1e3*this.maxAge;return e.getTime()+r}return this.expires==1/0?1/0:this.expires.getTime()}expiryDate(t){const e=this.expiryTime(t);return e==1/0?new Date(cj):e==-1/0?new Date(0):new Date(e)}isPersistent(){return null!=this.maxAge||this.expires!=1/0}canonicalizedDomain(){return null==this.domain?null:_j(this.domain)}cdomain(){return this.canonicalizedDomain()}}function Oj(t){if(null!=t){const e=t.toLowerCase();switch(e){case mj.STRICT:case mj.SILENT:case mj.DISABLED:return e}}return mj.SILENT}zj.cookiesCreated=0,zj.parse=xj,zj.fromJSON=Nj,zj.serializableProperties=Object.keys(Cj),zj.sameSiteLevel={strict:3,lax:2,none:1},zj.sameSiteCanonical={strict:"Strict",lax:"Lax"};class Rj{constructor(t,e={rejectPublicSuffixes:!0}){"boolean"==typeof e&&(e={rejectPublicSuffixes:e}),YA.validate(YA.isObject(e),e),this.rejectPublicSuffixes=e.rejectPublicSuffixes,this.enableLooseMode=!!e.looseMode,this.allowSpecialUseDomain="boolean"!=typeof e.allowSpecialUseDomain||e.allowSpecialUseDomain,this.store=t||new ej,this.prefixSecurity=Oj(e.prefixSecurity),this._cloneSync=Pj("clone"),this._importCookiesSync=Pj("_importCookies"),this.getCookiesSync=Pj("getCookies"),this.getCookieStringSync=Pj("getCookieString"),this.getSetCookieStringsSync=Pj("getSetCookieStrings"),this.removeAllCookiesSync=Pj("removeAllCookies"),this.setCookieSync=Pj("setCookie"),this.serializeSync=Pj("serialize")}setCookie(t,e,r,i){let n;if(YA.validate(YA.isUrlStringOrObject(e),i,r),YA.isFunction(e))return(i=e)(new Error("No URL was specified"));const o=Tj(e);if(YA.isFunction(r)&&(i=r,r={}),YA.validate(YA.isFunction(i),i),!YA.isNonEmptyString(t)&&!YA.isObject(t)&&t instanceof String&&0==t.length)return i(null);const a=_j(o.hostname),s=r.loose||this.enableLooseMode;let h=null;if(r.sameSiteContext&&(h=fj(r.sameSiteContext),!h))return i(new Error(dj));if("string"==typeof t||t instanceof String){if(!(t=zj.parse(t,{loose:s})))return n=new Error("Cookie failed to parse"),i(r.ignoreError?null:n)}else if(!(t instanceof zj))return n=new Error("First argument to setCookie must be a Cookie object or string"),i(r.ignoreError?null:n);const u=r.now||new Date;if(this.rejectPublicSuffixes&&t.domain){if(null==qE.getPublicSuffix(t.cdomain(),{allowSpecialUseDomain:this.allowSpecialUseDomain,ignoreError:r.ignoreError})&&!yj.test(t.domain))return n=new Error("Cookie has domain set to a public suffix"),i(r.ignoreError?null:n)}if(t.domain){if(!Ej(a,t.cdomain(),!1))return n=new Error(`Cookie not in this host's domain. Cookie:${t.cdomain()} Request:${a}`),i(r.ignoreError?null:n);null==t.hostOnly&&(t.hostOnly=!1)}else t.hostOnly=!0,t.domain=a;if(t.path&&"/"===t.path[0]||(t.path=Aj(o.pathname),t.pathIsDefault=!0),!1===r.http&&t.httpOnly)return n=new Error("Cookie is HttpOnly and this isn't an HTTP API"),i(r.ignoreError?null:n);if("none"!==t.sameSite&&void 0!==t.sameSite&&h&&"none"===h)return n=new Error("Cookie is SameSite but this is a cross-origin request"),i(r.ignoreError?null:n);const l=this.prefixSecurity===mj.SILENT;if(!(this.prefixSecurity===mj.DISABLED)){let e,n=!1;if(!function(t){return YA.validate(YA.isObject(t),t),!t.key.startsWith("__Secure-")||t.secure}(t)?(n=!0,e="Cookie has __Secure prefix but Secure attribute is not set"):function(t){return YA.validate(YA.isObject(t)),!t.key.startsWith("__Host-")||t.secure&&t.hostOnly&&null!=t.path&&"/"===t.path}(t)||(n=!0,e="Cookie has __Host prefix but either Secure or HostOnly attribute is not set or Path is not '/'"),n)return i(r.ignoreError||l?null:new Error(e))}const c=this.store;c.updateCookie||(c.updateCookie=function(t,e,r){this.putCookie(e,r)}),c.findCookie(t.domain,t.path,t.key,(function(e,n){if(e)return i(e);const o=function(e){if(e)return i(e);i(null,t)};if(n){if(!1===r.http&&n.httpOnly)return e=new Error("old Cookie is HttpOnly and this isn't an HTTP API"),i(r.ignoreError?null:e);t.creation=n.creation,t.creationIndex=n.creationIndex,t.lastAccessed=u,c.updateCookie(n,t,o)}else t.creation=t.lastAccessed=u,c.putCookie(t,o)}))}getCookies(t,e,r){YA.validate(YA.isUrlStringOrObject(t),r,t);const i=Tj(t);YA.isFunction(e)&&(r=e,e={}),YA.validate(YA.isObject(e),r,e),YA.validate(YA.isFunction(r),r);const n=_j(i.hostname),o=i.pathname||"/";let a=e.secure;null!=a||!i.protocol||"https:"!=i.protocol&&"wss:"!=i.protocol||(a=!0);let s=0;if(e.sameSiteContext){const t=fj(e.sameSiteContext);if(s=zj.sameSiteLevel[t],!s)return r(new Error(dj))}let h=e.http;null==h&&(h=!0);const u=e.now||Date.now(),l=!1!==e.expire,c=!!e.allPaths,d=this.store;function f(t){if(t.hostOnly){if(t.domain!=n)return!1}else if(!Ej(n,t.domain,!1))return!1;if(!c&&!rj(o,t.path))return!1;if(t.secure&&!a)return!1;if(t.httpOnly&&!h)return!1;if(s){if(zj.sameSiteLevel[t.sameSite||"none"]>s)return!1}return!(l&&t.expiryTime()<=u)||(d.removeCookie(t.domain,t.path,t.key,(()=>{})),!1)}d.findCookies(n,c?null:o,this.allowSpecialUseDomain,((t,i)=>{if(t)return r(t);i=i.filter(f),!1!==e.sort&&(i=i.sort(Ij));const n=new Date;for(const t of i)t.lastAccessed=n;r(null,i)}))}getCookieString(...t){const e=t.pop();YA.validate(YA.isFunction(e),e);t.push((function(t,r){t?e(t):e(null,r.sort(Ij).map((t=>t.cookieString())).join("; "))})),this.getCookies.apply(this,t)}getSetCookieStrings(...t){const e=t.pop();YA.validate(YA.isFunction(e),e);t.push((function(t,r){t?e(t):e(null,r.map((t=>t.toString())))})),this.getCookies.apply(this,t)}serialize(t){YA.validate(YA.isFunction(t),t);let e=this.store.constructor.name;YA.isObject(e)&&(e=null);const r={version:"tough-cookie@4.1.4",storeType:e,rejectPublicSuffixes:!!this.rejectPublicSuffixes,enableLooseMode:!!this.enableLooseMode,allowSpecialUseDomain:!!this.allowSpecialUseDomain,prefixSecurity:Oj(this.prefixSecurity),cookies:[]};if(!this.store.getAllCookies||"function"!=typeof this.store.getAllCookies)return t(new Error("store does not support getAllCookies and cannot be serialized"));this.store.getAllCookies(((e,i)=>e?t(e):(r.cookies=i.map((t=>(delete(t=t instanceof zj?t.toJSON():t).creationIndex,t))),t(null,r))))}toJSON(){return this.serializeSync()}_importCookies(t,e){let r=t.cookies;if(!r||!Array.isArray(r))return e(new Error("serialized jar has no cookies array"));r=r.slice();const i=t=>{if(t)return e(t);if(!r.length)return e(t,this);let n;try{n=Nj(r.shift())}catch(t){return e(t)}if(null===n)return i(null);this.store.putCookie(n,i)};i()}clone(t,e){1===arguments.length&&(e=t,t=null),this.serialize(((r,i)=>{if(r)return e(r);Rj.deserialize(i,t,e)}))}cloneSync(t){if(0===arguments.length)return this._cloneSync();if(!t.synchronous)throw new Error("CookieJar clone destination store is not synchronous; use async API instead.");return this._cloneSync(t)}removeAllCookies(t){YA.validate(YA.isFunction(t),t);const e=this.store;if("function"==typeof e.removeAllCookies&&e.removeAllCookies!==tj.prototype.removeAllCookies)return e.removeAllCookies(t);e.getAllCookies(((r,i)=>{if(r)return t(r);if(0===i.length)return t(null);let n=0;const o=[];function a(e){if(e&&o.push(e),n++,n===i.length)return t(o.length?o[0]:null)}i.forEach((t=>{e.removeCookie(t.domain,t.path,t.key,a)}))}))}static deserialize(t,e,r){let i;if(3!==arguments.length&&(r=e,e=null),YA.validate(YA.isFunction(r),r),"string"==typeof t){if(i=Sj(t),i instanceof Error)return r(i)}else i=t;const n=new Rj(e,{rejectPublicSuffixes:i.rejectPublicSuffixes,looseMode:i.enableLooseMode,allowSpecialUseDomain:i.allowSpecialUseDomain,prefixSecurity:i.prefixSecurity});n._importCookies(i,(t=>{if(t)return r(t);r(null,n)}))}static deserializeSync(t,e){const r="string"==typeof t?JSON.parse(t):t,i=new Rj(e,{rejectPublicSuffixes:r.rejectPublicSuffixes,looseMode:r.enableLooseMode});if(!i.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");return i._importCookiesSync(r),i}}function Pj(t){return function(...e){if(!this.store.synchronous)throw new Error("CookieJar store is not synchronous; use async API instead.");let r,i;if(this[t](...e,((t,e)=>{r=t,i=e})),r)throw r;return i}}Rj.fromJSON=Rj.deserializeSync,["_importCookies","clone","getCookies","getCookieString","getSetCookieStrings","removeAllCookies","serialize","setCookie"].forEach((t=>{Rj.prototype[t]=ij(Rj.prototype[t])})),Rj.deserialize=ij(Rj.deserialize);var Bj=QA,Dj=Rj,$j=zj,Lj=tj,Uj=ej,Fj=kj,qj=Mj,Vj=xj,Hj=Nj,Gj=Ej,Zj=Aj,Kj=rj,Jj=qE.getPublicSuffix,Wj=Ij,Yj=ZE.permuteDomain,Qj=function(t){if(YA.validate(YA.isString(t)),"/"===t)return["/"];const e=[t];for(;t.length>1;){const r=t.lastIndexOf("/");if(0===r)break;t=t.substr(0,r),e.push(t)}return e.push("/"),e},Xj=_j,tx=mj,ex=YA.ParameterError,rx={version:Bj,CookieJar:Dj,Cookie:$j,Store:Lj,MemoryCookieStore:Uj,parseDate:Fj,formatDate:qj,parse:Vj,fromJSON:Hj,domainMatch:Gj,defaultPath:Zj,pathMatch:Kj,getPublicSuffix:Jj,cookieCompare:Wj,permuteDomain:Yj,permutePath:Qj,canonicalDomain:Xj,PrefixSecurityEnum:tx,ParameterError:ex},ix=Object.freeze(Object.assign(Object.create(null),rx,{default:rx,version:Bj,CookieJar:Dj,Cookie:$j,Store:Lj,MemoryCookieStore:Uj,parseDate:Fj,formatDate:qj,parse:Vj,fromJSON:Hj,domainMatch:Gj,defaultPath:Zj,pathMatch:Kj,getPublicSuffix:Jj,cookieCompare:Wj,permuteDomain:Yj,permutePath:Qj,canonicalDomain:Xj,PrefixSecurityEnum:tx,ParameterError:ex}));var nx=function(t){if(Array.isArray(t))return t;if("string"!=typeof t)return[];var e,r,i,n,o,a=[],s=0;function h(){for(;s<t.length&&/\s/.test(t.charAt(s));)s+=1;return s<t.length}for(;s<t.length;){for(e=s,o=!1;h();)if(","===(r=t.charAt(s))){for(i=s,s+=1,h(),n=s;s<t.length&&"="!==(r=t.charAt(s))&&";"!==r&&","!==r;)s+=1;s<t.length&&"="===t.charAt(s)?(o=!0,s=n,a.push(t.substring(e,i)),e=s):s=i+1}else s+=1;(!o||s>=t.length)&&a.push(t.substring(e,t.length))}return a};const ox=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]);function ax(t,e){}function sx(t,e){t.headers.delete(e)}function hx(t,e){const r=t.headers;for(const t of Object.keys(r))t.toLowerCase()===e&&delete r[t]}const ux=new Set([301,302,303,307,308]);async function lx(t,e,r){switch(e.redirect??"follow"){case"error":throw new TypeError(`URI requested responded with a redirect and redirect mode is set to error: ${r.url}`);case"manual":return r;case"follow":break;default:throw new TypeError(`Invalid redirect option: ${e.redirect}`)}const i=r.headers.get("location");if(null===i)return r;const n=r.url,o=new URL(i,n).toString(),a=e.redirectCount??0,s=e.maxRedirect??20;if(a>=s)throw new TypeError(`Reached maximum redirect of ${s} for URL: ${n}`);const h=function(t){return null==t.headers?ax:"function"==typeof t.headers.delete?sx:hx}(e={...e,redirectCount:a+1});if(!function(t,e){const r=new URL(e).hostname,i=new URL(t).hostname;return r===i||r.endsWith(`.${i}`)}(n,o))for(const t of["authorization","www-authenticate","cookie","cookie2"])h(e,t);const u=e.body,l=e.body;if(303!==r.status&&null!=e.body&&("function"==typeof u.pipe||"function"==typeof l.pipeTo))throw new TypeError("Cannot follow redirect with body being a readable stream");return 303!==r.status&&(301!==r.status&&302!==r.status||"POST"!==e.method)||(e.method="GET",e.body=void 0,h(e,"content-length")),r.headers.has("referrer-policy")&&(e.referrerPolicy=function(t){const e=t.split(/[,\s]+/);let r="";for(const t of e)""!==t&&ox.has(t)&&(r=t);return r}(r.headers.get("referrer-policy"))),await t(o,e)}function cx(t,e,r=!0){const i=t,n=e??new Dj;async function o(t,e){const a=e??{};e={...e,redirect:"manual"};const s="string"==typeof t?t:t.url??t.href;e=function(t,e,r){if(""===r)return e;const i=t,n=e.headers;return i.headers&&"function"==typeof i.headers.append?i.headers.append("cookie",r):n&&"function"==typeof n.append?n.append("cookie",r):e={...e,headers:{...e.headers,cookie:r}},e}(t,e,await n.getCookieString(s));const h=await i(t,e),u=function(t){const e=t.headers;if("function"==typeof e.getAll)return e.getAll("set-cookie");if("function"==typeof e.raw){const t=e.raw();return Array.isArray(t["set-cookie"])?t["set-cookie"]:[]}const r=t.headers.get("set-cookie");return null!==r?nx(r):[]}(h);return await Promise.all(u.map((async t=>await n.setCookie(t,h.url,{ignoreError:r})))),(e.redirectCount??0)>0&&Object.defineProperty(h,"redirected",{value:!0}),l=h.status,ux.has(l)?await lx(o,a,h):h;var l}return o.toughCookie=ix,o}cx.toughCookie=ix;var dx="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==t&&t||{},fx="URLSearchParams"in dx,mx="Symbol"in dx&&"iterator"in Symbol,px="FileReader"in dx&&"Blob"in dx&&function(){try{return new Blob,!0}catch(t){return!1}}(),gx="FormData"in dx,yx="ArrayBuffer"in dx;if(yx)var wx=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],vx=ArrayBuffer.isView||function(t){return t&&wx.indexOf(Object.prototype.toString.call(t))>-1};function bx(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function kx(t){return"string"!=typeof t&&(t=String(t)),t}function Mx(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return mx&&(e[Symbol.iterator]=function(){return e}),e}function _x(t){this.map={},t instanceof _x?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){if(2!=t.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+t.length);this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function Ex(t){if(!t._noBody)return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function Ax(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function jx(t){var e=new FileReader,r=Ax(e);return e.readAsArrayBuffer(t),r}function xx(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function Sx(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:px&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:gx&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:fx&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():yx&&px&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=xx(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):yx&&(ArrayBuffer.prototype.isPrototypeOf(t)||vx(t))?this._bodyArrayBuffer=xx(t):this._bodyText=t=Object.prototype.toString.call(t):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):fx&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},px&&(this.blob=function(){var t=Ex(this);if(t)return t;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 t=Ex(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(px)return this.blob().then(jx);throw new Error("could not read as ArrayBuffer")},this.text=function(){var t,e,r,i,n,o=Ex(this);if(o)return o;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=Ax(e),i=/charset=([A-Za-z0-9_-]+)/.exec(t.type),n=i?i[1]:"utf-8",e.readAsText(t,n),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i<e.length;i++)r[i]=String.fromCharCode(e[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},gx&&(this.formData=function(){return this.text().then(Tx)}),this.json=function(){return this.text().then(JSON.parse)},this}_x.prototype.append=function(t,e){t=bx(t),e=kx(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},_x.prototype.delete=function(t){delete this.map[bx(t)]},_x.prototype.get=function(t){return t=bx(t),this.has(t)?this.map[t]:null},_x.prototype.has=function(t){return this.map.hasOwnProperty(bx(t))},_x.prototype.set=function(t,e){this.map[bx(t)]=kx(e)},_x.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},_x.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),Mx(t)},_x.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),Mx(t)},_x.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),Mx(t)},mx&&(_x.prototype[Symbol.iterator]=_x.prototype.entries);var Nx=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function Ix(t,e){if(!(this instanceof Ix))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,i,n=(e=e||{}).body;if(t instanceof Ix){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new _x(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new _x(e.headers)),this.method=(r=e.method||this.method||"GET",i=r.toUpperCase(),Nx.indexOf(i)>-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal||function(){if("AbortController"in dx)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function Tx(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function Cx(t,e){if(!(this instanceof Cx))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(e||(e={}),this.type="default",this.status=void 0===e.status?200:e.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=void 0===e.statusText?"":""+e.statusText,this.headers=new _x(e.headers),this.url=e.url||"",this._initBody(t)}Ix.prototype.clone=function(){return new Ix(this,{body:this._bodyInit})},Sx.call(Ix.prototype),Sx.call(Cx.prototype),Cx.prototype.clone=function(){return new Cx(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new _x(this.headers),url:this.url})},Cx.error=function(){var t=new Cx(null,{status:200,statusText:""});return t.ok=!1,t.status=0,t.type="error",t};var zx=[301,302,303,307,308];Cx.redirect=function(t,e){if(-1===zx.indexOf(e))throw new RangeError("Invalid status code");return new Cx(null,{status:e,headers:{location:t}})};var Ox=dx.DOMException;try{new Ox}catch(Uk){Ox=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},Ox.prototype=Object.create(Error.prototype),Ox.prototype.constructor=Ox}function Rx(t,e){return new Promise((function(r,i){var n=new Ix(t,e);if(n.signal&&n.signal.aborted)return i(new Ox("Aborted","AbortError"));var o=new XMLHttpRequest;function a(){o.abort()}if(o.onload=function(){var t,e,i={statusText:o.statusText,headers:(t=o.getAllResponseHeaders()||"",e=new _x,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();try{e.append(i,n)}catch(t){console.warn("Response "+t.message)}}})),e)};0===n.url.indexOf("file://")&&(o.status<200||o.status>599)?i.status=200:i.status=o.status,i.url="responseURL"in o?o.responseURL:i.headers.get("X-Request-URL");var a="response"in o?o.response:o.responseText;setTimeout((function(){r(new Cx(a,i))}),0)},o.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},o.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request timed out"))}),0)},o.onabort=function(){setTimeout((function(){i(new Ox("Aborted","AbortError"))}),0)},o.open(n.method,function(t){try{return""===t&&dx.location.href?dx.location.href:t}catch(e){return t}}(n.url),!0),"include"===n.credentials?o.withCredentials=!0:"omit"===n.credentials&&(o.withCredentials=!1),"responseType"in o&&(px?o.responseType="blob":yx&&(o.responseType="arraybuffer")),e&&"object"==typeof e.headers&&!(e.headers instanceof _x||dx.Headers&&e.headers instanceof dx.Headers)){var s=[];Object.getOwnPropertyNames(e.headers).forEach((function(t){s.push(bx(t)),o.setRequestHeader(t,kx(e.headers[t]))})),n.headers.forEach((function(t,e){-1===s.indexOf(e)&&o.setRequestHeader(e,t)}))}else n.headers.forEach((function(t,e){o.setRequestHeader(e,t)}));n.signal&&(n.signal.addEventListener("abort",a),o.onreadystatechange=function(){4===o.readyState&&n.signal.removeEventListener("abort",a)}),o.send(void 0===n._bodyInit?null:n._bodyInit)}))}Rx.polyfill=!0,dx.fetch||(dx.fetch=Rx,dx.Headers=_x,dx.Request=Ix,dx.Response=Cx);var Px=self.fetch.bind(self);const Bx=(t,e,r=[])=>{const i=Object.getOwnPropertyDescriptors(e);for(let t of r)delete i[t];Object.defineProperties(t,i)},Dx=(t,e=[t])=>{const r=Object.getPrototypeOf(t);return null===r?e:Dx(r,[...e,r])},$x=(t,e,r=[])=>{var i;const n=null!==(i=((...t)=>{if(0===t.length)return;let e;const r=t.map((t=>Dx(t)));for(;r.every((t=>t.length>0));){const t=r.map((t=>t.pop())),i=t[0];if(!t.every((t=>t===i)))break;e=i}return e})(...t))&&void 0!==i?i:Object.prototype,o=Object.create(n),a=Dx(n);for(let e of t){let t=Dx(e);for(let e=t.length-1;e>=0;e--){let i=t[e];-1===a.indexOf(i)&&(Bx(o,i,["constructor",...r]),a.push(i))}}return o.constructor=e,o},Lx=t=>t.filter(((e,r)=>t.indexOf(e)==r)),Ux=new WeakMap,Fx=t=>Ux.get(t),qx=(t,e)=>{var r,i;const n=Lx([...Object.getOwnPropertyNames(t),...Object.getOwnPropertyNames(e)]),o={};for(let a of n)o[a]=Lx([...null!==(r=null==t?void 0:t[a])&&void 0!==r?r:[],...null!==(i=null==e?void 0:e[a])&&void 0!==i?i:[]]);return o},Vx=(t,e)=>{var r,i,n,o;return{property:qx(null!==(r=null==t?void 0:t.property)&&void 0!==r?r:{},null!==(i=null==e?void 0:e.property)&&void 0!==i?i:{}),method:qx(null!==(n=null==t?void 0:t.method)&&void 0!==n?n:{},null!==(o=null==e?void 0:e.method)&&void 0!==o?o:{})}},Hx=new Map,Gx=(...t)=>{const e=((...t)=>{var e;const r=new Set,i=new Set([...t]);for(;i.size>0;)for(let t of i){const n=[...Dx(t.prototype).map((t=>t.constructor)),...null!==(e=Fx(t))&&void 0!==e?e:[]].filter((t=>!r.has(t)));for(let t of n)i.add(t);r.add(t),i.delete(t)}return[...r]})(...t).map((t=>Hx.get(t))).filter((t=>!!t));return 0==e.length?{}:1==e.length?e[0]:e.reduce(((t,e)=>((t,e)=>{var r,i,n,o,a,s;return{class:Lx([...null!==(r=null==t?void 0:t.class)&&void 0!==r?r:[],...null!==(i=null==e?void 0:e.class)&&void 0!==i?i:[]]),static:Vx(null!==(n=null==t?void 0:t.static)&&void 0!==n?n:{},null!==(o=null==e?void 0:e.static)&&void 0!==o?o:{}),instance:Vx(null!==(a=null==t?void 0:t.instance)&&void 0!==a?a:{},null!==(s=null==e?void 0:e.instance)&&void 0!==s?s:{})}})(t,e)))};function Zx(...t){var e,r,i;const n=t.map((t=>t.prototype));function o(...e){for(const r of t)Bx(this,new r(...e))}o.prototype=$x(n,o),Object.setPrototypeOf(o,$x(t,null,["prototype"]));let a=o;{const n=Gx(...t);for(let t of null!==(e=null==n?void 0:n.class)&&void 0!==e?e:[]){const e=t(a);e&&(a=e)}Kx(null!==(r=null==n?void 0:n.static)&&void 0!==r?r:{},a),Kx(null!==(i=null==n?void 0:n.instance)&&void 0!==i?i:{},a.prototype)}var s,h;return s=a,h=t,Ux.set(s,h),a}const Kx=(t,e)=>{const r=t.property,i=t.method;if(r)for(let t in r)for(let i of r[t])i(e,t);if(i)for(let t in i)for(let r of i[t])r(e,t,Object.getOwnPropertyDescriptor(e,t))};var Jx=Object.defineProperty,Wx=Object.getOwnPropertyDescriptor,Yx=Object.getOwnPropertyNames,Qx=Object.prototype.hasOwnProperty,Xx=(t,e)=>{for(var r in e)Jx(t,r,{get:e[r],enumerable:!0})},tS=(t,e,r,i)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let n of Yx(e))Qx.call(t,n)||n===r||Jx(t,n,{get:()=>e[n],enumerable:!(i=Wx(e,n))||i.enumerable});return t},eS={};Xx(eS,{ADDR_BOUND:()=>LS,API_VERSION:()=>BS,BaseUrl:()=>HS,DEFAULT_GLOBAL_CONFIG:()=>nN,FeeMarginPercentage:()=>JS,HARDENING_4BYTES:()=>iN,HARDENING_BYTE:()=>rN,IS_BROWSER:()=>wS,MASK_250:()=>RS,MASK_31:()=>PS,MAX_STORAGE_ITEM_SIZE:()=>$S,NetworkName:()=>GS,OutsideExecutionCallerAny:()=>XS,PRIME:()=>DS,RANGE_FELT:()=>FS,RANGE_I128:()=>qS,RANGE_U128:()=>VS,RPC_DEFAULT_VERSION:()=>YS,RPC_NODES:()=>QS,SNIP9_V1_INTERFACE_ID:()=>tN,SNIP9_V2_INTERFACE_ID:()=>eN,SYSTEM_MESSAGES:()=>oN,StarknetChainId:()=>ZS,TEXT_TO_FELT_MAX_LEN:()=>zS,TRANSACTION_VERSION:()=>rS.ETransactionVersion,TransactionHashPrefix:()=>KS,UDC:()=>WS,ZERO:()=>OS});var rS={};Xx(rS,{JRPC:()=>iS,RPCSPEC06:()=>nS,RPCSPEC07:()=>dp});var iS={},nS={};Xx(nS,{EBlockTag:()=>dS,EDAMode:()=>mS,EDataAvailabilityMode:()=>fS,ESimulationFlag:()=>hS,ETransactionExecutionStatus:()=>cS,ETransactionFinalityStatus:()=>lS,ETransactionStatus:()=>uS,ETransactionType:()=>sS,ETransactionVersion:()=>pS,ETransactionVersion2:()=>gS,ETransactionVersion3:()=>yS,Errors:()=>oS,SPEC:()=>aS});var oS={},aS={},sS={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE",L1_HANDLER:"L1_HANDLER"},hS={SKIP_VALIDATE:"SKIP_VALIDATE",SKIP_FEE_CHARGE:"SKIP_FEE_CHARGE"},uS={RECEIVED:"RECEIVED",REJECTED:"REJECTED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},lS={ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},cS={SUCCEEDED:"SUCCEEDED",REVERTED:"REVERTED"},dS={PENDING:"pending",LATEST:"latest"},fS={L1:"L1",L2:"L2"},mS={L1:0,L2:1},pS={V0:"0x0",V1:"0x1",V2:"0x2",V3:"0x3",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002",F3:"0x100000000000000000000000000000003"},gS={V0:"0x0",V1:"0x1",V2:"0x2",F0:"0x100000000000000000000000000000000",F1:"0x100000000000000000000000000000001",F2:"0x100000000000000000000000000000002"},yS={V3:"0x3",F3:"0x100000000000000000000000000000003"};((t,e,r)=>{tS(t,e,"default"),r&&tS(r,e,"default")})(rS,dp);Xx({},{IS_BROWSER:()=>wS,addHexPrefix:()=>jS,arrayBufferToString:()=>vS,atobUniversal:()=>MS,btoaUniversal:()=>_S,buf2hex:()=>ES,calcByteLength:()=>SS,concatenateArrayBuffer:()=>CS,padLeft:()=>xS,pascalToSnake:()=>TS,removeHexPrefix:()=>AS,sanitizeBytes:()=>NS,sanitizeHex:()=>IS,stringToArrayBuffer:()=>kS,utf8ToArray:()=>bS});var wS="undefined"!=typeof window;function vS(t){return new Uint8Array(t).reduce(((t,e)=>t+String.fromCharCode(e)),"")}function bS(t){return(new TextEncoder).encode(t)}function kS(t){return bS(t)}function MS(t){return zp.decode(t)}function _S(t){return zp.encode(new Uint8Array(t))}function ES(t){return t.reduce(((t,e)=>t+e.toString(16).padStart(2,"0")),"")}function AS(t){return t.replace(/^0x/i,"")}function jS(t){return`0x${AS(t)}`}function xS(t,e,r="0"){return function(t,e,r,i="0"){const n=e-t.length;let o=t;if(n>0){const e=i.repeat(n);o=r?e+t:t+e}return o}(t,e,!0,r)}function SS(t,e=8){const{length:r}=t,i=r%e;return i?(r-i)/e*e+e:r}function NS(t,e=8,r="0"){return xS(t,SS(t,e),r)}function IS(t){const e=NS(AS(t),2);return e?jS(e):e}var TS=t=>/[a-z]/.test(t)?t.split(/(?=[A-Z])/).join("_").toUpperCase():t;function CS(t){const e=t.reduce(((t,e)=>t+e.byteLength),0),r=new Uint8Array(e);let i=0;return t.forEach((t=>{r.set(t,i),i+=t.byteLength})),r}var zS=31,OS=0n,RS=2n**250n-1n,PS=2n**31n-1n,BS=OS,DS=2n**251n+17n*2n**192n+1n,$S=256n,LS=2n**251n-$S,US=(t,e)=>({min:t,max:e}),FS=US(OS,DS-1n),qS=US(-(2n**127n),2n**127n-1n),VS=US(OS,2n**128n-1n),HS=(t=>(t.SN_MAIN="https://alpha-mainnet.starknet.io",t.SN_SEPOLIA="https://alpha-sepolia.starknet.io",t))(HS||{}),GS=(t=>(t.SN_MAIN="SN_MAIN",t.SN_SEPOLIA="SN_SEPOLIA",t))(GS||{}),ZS=(t=>(t.SN_MAIN="0x534e5f4d41494e",t.SN_SEPOLIA="0x534e5f5345504f4c4941",t))(ZS||{}),KS=(t=>(t.DECLARE="0x6465636c617265",t.DEPLOY="0x6465706c6f79",t.DEPLOY_ACCOUNT="0x6465706c6f795f6163636f756e74",t.INVOKE="0x696e766f6b65",t.L1_HANDLER="0x6c315f68616e646c6572",t))(KS||{}),JS=(t=>(t[t.L1_BOUND_MAX_AMOUNT=50]="L1_BOUND_MAX_AMOUNT",t[t.L1_BOUND_MAX_PRICE_PER_UNIT=50]="L1_BOUND_MAX_PRICE_PER_UNIT",t[t.MAX_FEE=50]="MAX_FEE",t))(JS||{}),WS={ADDRESS:"0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",ENTRYPOINT:"deployContract"},YS="v0_7",QS={SN_MAIN:[`https://starknet-mainnet.public.blastapi.io/rpc/${YS}`,`https://free-rpc.nethermind.io/mainnet-juno/${YS}`],SN_SEPOLIA:[`https://starknet-sepolia.public.blastapi.io/rpc/${YS}`,`https://free-rpc.nethermind.io/sepolia-juno/${YS}`]},XS="0x414e595f43414c4c4552",tN="0x68cfd18b92d1907b8ba3cc324900277f5a3622099431ea85dd8089255e4181",eN="0x1d1144bb2138366ff28d8e9ab57456b1d332ac42196230c3a602003c89872",rN=128,iN=2147483648n,nN={legacyMode:!1,logLevel:"INFO",accountTxVersion:rS.ETransactionVersion.V2},oN={legacyTxWarningMessage:"You are using a deprecated transaction version (V0,V1,V2)!\nUpdate to the latest V3 transactions!"},aN={};Xx(aN,{RpcChannel:()=>mz});Xx({},{parse:()=>hN,parseAlwaysAsBig:()=>uN,stringify:()=>lN,stringifyAlwaysAsBig:()=>cN});var sN=t=>{if(!Lp(t))return parseFloat(t);const e=parseInt(t,10);return Number.isSafeInteger(e)?e:BigInt(t)},hN=t=>rg(String(t),void 0,sN),uN=t=>rg(String(t),void 0,Xp),lN=(t,e,r,i)=>Rg(t,e,r,i),cN=lN,dN={FAILED_TO_RECEIVE_TXN:1,NO_TRACE_AVAILABLE:10,CONTRACT_NOT_FOUND:20,BLOCK_NOT_FOUND:24,INVALID_TXN_INDEX:27,CLASS_HASH_NOT_FOUND:28,TXN_HASH_NOT_FOUND:29,PAGE_SIZE_TOO_BIG:31,NO_BLOCKS:32,INVALID_CONTINUATION_TOKEN:33,TOO_MANY_KEYS_IN_FILTER:34,CONTRACT_ERROR:40,TRANSACTION_EXECUTION_ERROR:41,CLASS_ALREADY_DECLARED:51,INVALID_TRANSACTION_NONCE:52,INSUFFICIENT_MAX_FEE:53,INSUFFICIENT_ACCOUNT_BALANCE:54,VALIDATION_FAILURE:55,COMPILATION_FAILED:56,CONTRACT_CLASS_SIZE_IS_TOO_LARGE:57,NON_ACCOUNT:58,DUPLICATE_TX:59,COMPILED_CLASS_HASH_MISMATCH:60,UNSUPPORTED_TX_VERSION:61,UNSUPPORTED_CONTRACT_CLASS_VERSION:62,UNEXPECTED_ERROR:63};var fN=class extends Error{name;constructor(t){super(t),Object.defineProperty(this,"name",{value:new.target.name,enumerable:!1,configurable:!0}),function(t,e){const{setPrototypeOf:r}=Object;r?r(t,e):t.__proto__=e}(this,new.target.prototype),function(t,e=t.constructor){const{captureStackTrace:r}=Error;r&&r(t,e)}(this)}},mN=class extends fN{},pN=class extends mN{constructor(t,e,r){super(`RPC: ${e} with params ${lN(r,null,2)}\n\n ${t.code}: ${t.message}: ${lN(t.data)}`),this.baseError=t,this.request={method:e,params:r}}request;get code(){return this.baseError.code}isType(t){return dN[t]===this.code}};Xx({},{BlockStatus:()=>kN,BlockTag:()=>MN,ETH_ADDRESS:()=>jN,EntryPointType:()=>gN,Literal:()=>AN,NON_ZERO_PREFIX:()=>xN,OutsideExecutionTypesV1:()=>SN,OutsideExecutionTypesV2:()=>NN,OutsideExecutionVersion:()=>IN,RPC:()=>rS,TransactionExecutionStatus:()=>bN,TransactionFinalityStatus:()=>vN,TransactionStatus:()=>wN,TransactionType:()=>yN,TypedDataRevision:()=>lp,Uint:()=>EN,ValidateType:()=>_N});var gN={EXTERNAL:"EXTERNAL",L1_HANDLER:"L1_HANDLER",CONSTRUCTOR:"CONSTRUCTOR"},yN={DECLARE:"DECLARE",DEPLOY:"DEPLOY",DEPLOY_ACCOUNT:"DEPLOY_ACCOUNT",INVOKE:"INVOKE_FUNCTION"},wN={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",REJECTED:"REJECTED",REVERTED:"REVERTED"},vN={NOT_RECEIVED:"NOT_RECEIVED",RECEIVED:"RECEIVED",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",ACCEPTED_ON_L1:"ACCEPTED_ON_L1"},bN={REJECTED:"REJECTED",REVERTED:"REVERTED",SUCCEEDED:"SUCCEEDED"},kN={PENDING:"PENDING",ACCEPTED_ON_L1:"ACCEPTED_ON_L1",ACCEPTED_ON_L2:"ACCEPTED_ON_L2",REJECTED:"REJECTED"},MN={PENDING:"pending",LATEST:"latest"},_N={DEPLOY:"DEPLOY",CALL:"CALL",INVOKE:"INVOKE"},EN={u8:"core::integer::u8",u16:"core::integer::u16",u32:"core::integer::u32",u64:"core::integer::u64",u128:"core::integer::u128",u256:"core::integer::u256",u512:"core::integer::u512"},AN={ClassHash:"core::starknet::class_hash::ClassHash",ContractAddress:"core::starknet::contract_address::ContractAddress",Secp256k1Point:"core::starknet::secp256k1::Secp256k1Point",U96:"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"},jN="core::starknet::eth_address::EthAddress",xN="core::zeroable::NonZero::",SN={StarkNetDomain:[{name:"name",type:"felt"},{name:"version",type:"felt"},{name:"chainId",type:"felt"}],OutsideExecution:[{name:"caller",type:"felt"},{name:"nonce",type:"felt"},{name:"execute_after",type:"felt"},{name:"execute_before",type:"felt"},{name:"calls_len",type:"felt"},{name:"calls",type:"OutsideCall*"}],OutsideCall:[{name:"to",type:"felt"},{name:"selector",type:"felt"},{name:"calldata_len",type:"felt"},{name:"calldata",type:"felt*"}]},NN={StarknetDomain:[{name:"name",type:"shortstring"},{name:"version",type:"shortstring"},{name:"chainId",type:"shortstring"},{name:"revision",type:"shortstring"}],OutsideExecution:[{name:"Caller",type:"ContractAddress"},{name:"Nonce",type:"felt"},{name:"Execute After",type:"u128"},{name:"Execute Before",type:"u128"},{name:"Calls",type:"Call*"}],Call:[{name:"To",type:"ContractAddress"},{name:"Selector",type:"selector"},{name:"Calldata",type:"felt*"}]},IN=(t=>(t.UNSUPPORTED="0",t.V1="1",t.V2="2",t))(IN||{}),TN=class{nodeUrl;headers;interval;requestId=0;pendingRequests={};batchPromises={};delayTimer;delayPromise;delayPromiseResolve;baseFetch;constructor(t){this.nodeUrl=t.nodeUrl,this.headers=t.headers,this.interval=t.interval,this.baseFetch=t.baseFetch}async wait(){return this.delayPromise&&this.delayPromiseResolve||(this.delayPromise=new Promise((t=>{this.delayPromiseResolve=t}))),this.delayTimer&&(clearTimeout(this.delayTimer),this.delayTimer=void 0),this.delayTimer=setTimeout((()=>{this.delayPromiseResolve&&(this.delayPromiseResolve(),this.delayPromise=void 0,this.delayPromiseResolve=void 0)}),this.interval),this.delayPromise}addPendingRequest(t,e,r){const i={id:r??`batched_${this.requestId+=1}`,jsonrpc:"2.0",method:t,params:e??void 0};return this.pendingRequests[i.id]=i,i.id}async sendBatch(t){return(await this.baseFetch(this.nodeUrl,{method:"POST",body:lN(t),headers:this.headers})).json()}async fetch(t,e,r){const i=this.addPendingRequest(t,e,r);await this.wait();const n=this.pendingRequests;if(this.pendingRequests={},!this.batchPromises[i]){const t=this.sendBatch(Object.values(n));Object.keys(n).forEach((e=>{this.batchPromises[e]=t}))}const o=await this.batchPromises[i];delete this.batchPromises[i];const a=o.find((t=>t.id===i));if(!a)throw new Error(`Couldn't find the result for the request. Method: ${t}`);return a}};function CN(t,e){if(!t)throw new Error(e||"Assertion failure")}var zN={};Xx(zN,{addPercent:()=>iI,assertInRange:()=>KN,bigNumberishArrayToDecimalStringArray:()=>JN,bigNumberishArrayToHexadecimalStringArray:()=>WN,cleanHex:()=>ZN,getDecimalString:()=>QN,getHexString:()=>XN,getHexStringArray:()=>tI,hexToBytes:()=>rI,hexToDecimalString:()=>GN,isBigNumberish:()=>oI,isHex:()=>LN,isStringWholeNumber:()=>YN,stringToSha256ToArrayBuff4:()=>nI,toBigInt:()=>UN,toCairoBool:()=>eI,toHex:()=>FN,toHex64:()=>HN,toHexString:()=>qN,toStorageKey:()=>VN});var ON=t=>void 0===t||void 0===t;function RN(t){return"number"==typeof t}function PN(t){return"boolean"==typeof t}function BN(t){return"bigint"==typeof t}function DN(t){return"string"==typeof t}function $N(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function LN(t){return/^0x[0-9a-f]*$/i.test(t)}function UN(t){return BigInt(t)}function FN(t){return jS(UN(t).toString(16))}var qN=FN;function VN(t){return jS(UN(t).toString(16).padStart(64,"0"))}function HN(t){const e=jS(UN(t).toString(16).padStart(64,"0"));if(66!==e.length)throw TypeError("number is too big for hex 0x(64) representation");return e}function GN(t){return BigInt(jS(t)).toString(10)}function ZN(t){return t.toLowerCase().replace(/^(0x)0+/,"$1")}function KN(t,e,r,i=""){const n=""===i?"invalid length":`invalid ${i} length`,o=BigInt(t),a=BigInt(e),s=BigInt(r);CN(o>=a&&o<=s,`Message not signable, ${n}.`)}function JN(t){return t.map((t=>UN(t).toString(10)))}function WN(t){return t.map((t=>FN(t)))}function YN(t){return/^\d+$/.test(t)}function QN(t){if(LN(t))return GN(t);if(YN(t))return t;throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function XN(t){if(LN(t))return t;if(YN(t))return qN(t);throw new Error(`${t} needs to be a hex-string or whole-number-string`)}function tI(t){return t.map(XN)}function eI(t){return(+t).toString()}function rI(t){if(!LN(t))throw new Error(`${t} needs to be a hex-string`);let e=AS(t);return e.length%2!=0&&(e=`0${e}`),Xg(e)}function iI(t,e){const r=BigInt(t);return r+r*BigInt(e)/100n}function nI(t){var e;return rI(FN((e=BigInt(jS(ES(Dy(t)))),Number(e&PS))))}function oI(t){return RN(t)||BN(t)||DN(t)&&(LN(t)||YN(t))}function aI(t){const e=AS(FN(BigInt(t))),r=e.length%2==0?e:`0${e}`;return jS(Gv(rI(jS(r))).toString(16))}function sI(t){const e=BigInt(function(t){return jS(Gv(bS(t)).toString(16))}(t));return e&RS}function hI(t){return FN(sI(t))}function uI(t){return RN(t)||BN(t)?FN(t):LN(t)?t:YN(t)?FN(t):hI(t)}function lI(t){const e=jS(t.reduce(((t,e)=>t+AS(FN(e)).padStart(64,"0")),""));return jS(qg(bb(rI(e))))}function cI(t,e,r,i,n){return lI([t,e,n,r,i.length,...i])}Xx({},{getL2MessageHash:()=>cI,getSelector:()=>uI,getSelectorFromName:()=>hI,keccakBn:()=>aI,solidityUint256PackedKeccak256:()=>lI,starknetKeccak:()=>sI});var dI={};function fI(t){return/^[\x00-\x7F]*$/.test(t)}function mI(t){return t.length<=zS}function pI(t){return/^[0-9]*$/i.test(t)}function gI(t){return DN(t)&&!LN(t)&&!YN(t)}Xx(dI,{decodeShortString:()=>kI,encodeShortString:()=>bI,isASCII:()=>fI,isDecimalString:()=>pI,isLongText:()=>wI,isShortString:()=>mI,isShortText:()=>yI,isText:()=>gI,splitLongString:()=>vI});var yI=t=>gI(t)&&mI(t),wI=t=>gI(t)&&!mI(t);function vI(t){const e=RegExp(`[^]{1,${zS}}`,"g");return t.match(e)||[]}function bI(t){if(!fI(t))throw new Error(`${t} is not an ASCII string`);if(!mI(t))throw new Error(`${t} is too long`);return jS(t.replace(/./g,(t=>t.charCodeAt(0).toString(16))))}function kI(t){if(!fI(t))throw new Error(`${t} is not an ASCII string`);if(LN(t))return AS(t).replace(/.{2}/g,(t=>String.fromCharCode(parseInt(t,16))));if(pI(t))return kI("0X".concat(BigInt(t).toString(16)));throw new Error(`${t} is not Hex or decimal`)}function MI(t){const e=0n===BigInt(t.pending_word)?"":kI(FN(t.pending_word));return t.data.reduce(((t,e)=>t+(0n===BigInt(e)?"":kI(FN(e)))),"")+e}function _I(t){const e=vI(t),r=e[e.length-1],i=e.map(bI),[n,o]=void 0===r||31===r.length?["0x00",0]:[i.pop(),r.length];return{data:0===i.length?[]:i,pending_word:n,pending_word_len:o}}Xx({},{byteArrayFromString:()=>_I,stringFromByteArray:()=>MI});var EI={};function AI(t){if(BN(t)||Number.isInteger(t))return t.toString();if(DN(t)){if(LN(t))return BigInt(t).toString();if(gI(t)){if(!mI(t))throw new Error(`${t} is a long string > 31 chars. Please split it into an array of short strings.`);return BigInt(bI(t)).toString()}if(YN(t))return t}if(PN(t))return""+ +t;throw new Error(`${t} can't be computed by felt()`)}Xx(EI,{felt:()=>cT,getAbiContractVersion:()=>sT,getArrayType:()=>nT,isCairo1Abi:()=>oT,isCairo1Type:()=>iT,isLen:()=>DI,isTypeArray:()=>LI,isTypeBool:()=>WI,isTypeByteArray:()=>tT,isTypeBytes31:()=>XI,isTypeContractAddress:()=>YI,isTypeEnum:()=>VI,isTypeEthAddress:()=>QI,isTypeFelt:()=>$I,isTypeLiteral:()=>JI,isTypeNamedTuple:()=>FI,isTypeNonZero:()=>aT,isTypeOption:()=>HI,isTypeResult:()=>GI,isTypeSecp256k1Point:()=>rT,isTypeStruct:()=>qI,isTypeTuple:()=>UI,isTypeU96:()=>eT,isTypeUint:()=>ZI,isTypeUint256:()=>KI,tuple:()=>lT,uint256:()=>hT,uint512:()=>uT});var jI=(1n<<128n)-1n,xI=(1n<<256n)-1n,SI=0n,NI=340282366920938463463374607431768211455n,II=340282366920938463463374607431768211455n,TI=0n,CI=0n,zI=class t{low;high;static abiSelector="core::integer::u256";constructor(...e){if("object"==typeof e[0]&&1===e.length&&"low"in e[0]&&"high"in e[0]){const r=t.validateProps(e[0].low,e[0].high);this.low=r.low,this.high=r.high}else if(1===e.length){const r=t.validate(e[0]);this.low=r&jI,this.high=r>>128n}else{if(2!==e.length)throw Error("Incorrect constructor parameters");{const r=t.validateProps(e[0],e[1]);this.low=r.low,this.high=r.high}}}static validate(t){const e=BigInt(t);if(e<SI)throw Error("bigNumberish is smaller than UINT_256_MIN");if(e>xI)throw new Error("bigNumberish is bigger than UINT_256_MAX");return e}static validateProps(t,e){const r=BigInt(t),i=BigInt(e);if(r<TI||r>NI)throw new Error("low is out of range UINT_256_LOW_MIN - UINT_256_LOW_MAX");if(i<CI||i>II)throw new Error("high is out of range UINT_256_HIGH_MIN - UINT_256_HIGH_MAX");return{low:r,high:i}}static is(e){try{t.validate(e)}catch(t){return!1}return!0}static isAbiType(e){return e===t.abiSelector}toBigInt(){return(this.high<<128n)+this.low}toUint256HexString(){return{low:jS(this.low.toString(16)),high:jS(this.high.toString(16))}}toUint256DecimalString(){return{low:this.low.toString(10),high:this.high.toString(10)}}toApiRequest(){return[AI(this.low),AI(this.high)]}},OI=(1n<<512n)-1n,RI=0n,PI=0n,BI=class t{limb0;limb1;limb2;limb3;static abiSelector="core::integer::u512";constructor(...e){if("object"==typeof e[0]&&1===e.length&&"limb0"in e[0]&&"limb1"in e[0]&&"limb2"in e[0]&&"limb3"in e[0]){const r=t.validateProps(e[0].limb0,e[0].limb1,e[0].limb2,e[0].limb3);this.limb0=r.limb0,this.limb1=r.limb1,this.limb2=r.limb2,this.limb3=r.limb3}else if(1===e.length){const r=t.validate(e[0]);this.limb0=r&jI,this.limb1=(r&jI<<128n)>>128n,this.limb2=(r&jI<<256n)>>256n,this.limb3=r>>384n}else{if(4!==e.length)throw Error("Incorrect Uint512 constructor parameters");{const r=t.validateProps(e[0],e[1],e[2],e[3]);this.limb0=r.limb0,this.limb1=r.limb1,this.limb2=r.limb2,this.limb3=r.limb3}}}static validate(t){const e=BigInt(t);if(e<RI)throw Error("bigNumberish is smaller than UINT_512_MIN.");if(e>OI)throw Error("bigNumberish is bigger than UINT_512_MAX.");return e}static validateProps(t,e,r,i){const n=BigInt(t),o=BigInt(e),a=BigInt(r),s=BigInt(i);return[n,o,a,s].forEach(((t,e)=>{if(t<PI||t>jI)throw Error(`limb${e} is not in the range of a u128 number`)})),{limb0:n,limb1:o,limb2:a,limb3:s}}static is(e){try{t.validate(e)}catch(t){return!1}return!0}static isAbiType(e){return e===t.abiSelector}toBigInt(){return(this.limb3<<384n)+(this.limb2<<256n)+(this.limb1<<128n)+this.limb0}toUint512HexString(){return{limb0:jS(this.limb0.toString(16)),limb1:jS(this.limb1.toString(16)),limb2:jS(this.limb2.toString(16)),limb3:jS(this.limb3.toString(16))}}toUint512DecimalString(){return{limb0:this.limb0.toString(10),limb1:this.limb1.toString(10),limb2:this.limb2.toString(10),limb3:this.limb3.toString(10)}}toApiRequest(){return[AI(this.limb0),AI(this.limb1),AI(this.limb2),AI(this.limb3)]}},DI=t=>/_len$/.test(t),$I=t=>"felt"===t||"core::felt252"===t,LI=t=>/\*/.test(t)||t.startsWith("core::array::Array::")||t.startsWith("core::array::Span::"),UI=t=>/^\(.*\)$/i.test(t),FI=t=>/\(.*\)/i.test(t)&&t.includes(":"),qI=(t,e)=>t in e,VI=(t,e)=>t in e,HI=t=>t.startsWith("core::option::Option::"),GI=t=>t.startsWith("core::result::Result::"),ZI=t=>Object.values(EN).includes(t),KI=t=>zI.isAbiType(t),JI=t=>Object.values(AN).includes(t),WI=t=>"core::bool"===t,YI=t=>t===AN.ContractAddress,QI=t=>t===jN,XI=t=>"core::bytes_31::bytes31"===t,tT=t=>"core::byte_array::ByteArray"===t,eT=t=>"core::internal::bounded_int::BoundedInt::<0, 79228162514264337593543950335>"===t,rT=t=>t===AN.Secp256k1Point,iT=t=>t.includes("::"),nT=t=>iT(t)?t.substring(t.indexOf("<")+1,t.lastIndexOf(">")):t.replace("*","");function oT(t){const{cairo:e}=sT(t);if(void 0===e)throw Error("Unable to determine Cairo version");return"1"===e}function aT(t){return t.startsWith(xN)}function sT(t){if(t.find((t=>"interface"===t.type)))return{cairo:"1",compiler:"2"};const e=t.find((t=>("function"===t.type||"constructor"===t.type)&&(t.inputs.length||t.outputs.length)));if(!e)return{cairo:void 0,compiler:void 0};const r=e.inputs.length?e.inputs:e.outputs;return iT(r[0].type)?{cairo:"1",compiler:"1"}:{cairo:"0",compiler:"0"}}var hT=t=>new zI(t).toUint256DecimalString(),uT=t=>new BI(t).toUint512DecimalString(),lT=(...t)=>({...t});function cT(t){return AI(t)}var dT=class{variant;constructor(t){const e=Object.values(t);if(0===e.length)throw new Error("This Enum must have at least 1 variant");if(1!==e.filter((t=>!ON(t))).length)throw new Error("This Enum must have exactly one active variant");this.variant=t}unwrap(){return Object.values(this.variant).find((t=>!ON(t)))}activeVariant(){const t=Object.entries(this.variant).find((t=>!ON(t[1])));return ON(t)?"":t[0]}},fT={Some:0,None:1},mT=class{Some;None;constructor(t,e){if(!(t in Object.values(fT)))throw new Error("Wrong variant! It should be CairoOptionVariant.Some or .None.");if(t===fT.Some){if(ON(e))throw new Error('The creation of a Cairo Option with "Some" variant needs a content as input.');this.Some=e,this.None=void 0}else this.Some=void 0,this.None=!0}unwrap(){return this.None?void 0:this.Some}isSome(){return!ON(this.Some)}isNone(){return!0===this.None}},pT={Ok:0,Err:1},gT=class{Ok;Err;constructor(t,e){if(!(t in Object.values(pT)))throw new Error("Wrong variant! It should be CairoResultVariant.Ok or .Err.");t===pT.Ok?(this.Ok=e,this.Err=void 0):(this.Ok=void 0,this.Err=e)}unwrap(){if(!ON(this.Ok))return this.Ok;if(!ON(this.Err))return this.Err;throw new Error("Both Result.Ok and .Err are undefined. Not authorized.")}isOk(){return!ON(this.Ok)}isErr(){return!ON(this.Err)}},yT=(t,e,r)=>{if(!BN(t[r]))throw new Error(`Data and formatter mismatch on ${r}:${e[r]}, expected response data ${r}:${t[r]} to be BN instead it is ${typeof t[r]}`)},wT=(t,e,r)=>{throw new Error(`Unhandled formatter type on ${r}:${e[r]} for data ${r}:${t[r]}`)};function vT(t,e,r){return Object.entries(t).reduce(((i,[n,o])=>{const a=r??e[n];if(!(n in e)&&!r)return i[n]=o,i;if("string"===a){if(Array.isArray(t[n])){const e=vT(t[n],t[n].map((t=>a)));return i[n]=Object.values(e).join(""),i}return yT(t,e,n),i[n]=kI(o),i}if("number"===a)return yT(t,e,n),i[n]=Number(o),i;if("function"==typeof a)return i[n]=a(o),i;if(Array.isArray(a)){const e=vT(t[n],a,a[0]);return i[n]=Object.values(e),i}return $N(a)?(i[n]=vT(t[n],a),i):(wT(t,e,n),i)}),{})}function bT(t){const e=function(t){return t.find((t=>"interface"===t.type))?2:oT(t)?1:0}(t);if(0===e||1===e)return new class{abi;constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.reduce(((t,e)=>DI(e.name)?t:t+1),0)}getMethod(t){return this.abi.find((e=>e.name===t))}getLegacyFormat(){return this.abi}}(t);if(2===e)return new class{abi;constructor(t){this.abi=t}methodInputsLength(t){return t.inputs.length}getMethod(t){return this.abi.find((t=>"interface"===t.type))?.items?.find((e=>e.name===t))}getLegacyFormat(){return this.abi.flatMap((t=>"interface"===t.type?t.items:t))}}(t);throw Error(`Unsupported ABI version ${e}`)}function kT(t,e,r){return"constructor"===t&&!r&&!e.length}function MT(t,e,r){for(let i=0,n=0;i<t.length;i++)if(t[i]===e)n++;else if(t[i]===r&&0==--n)return i;return Number.POSITIVE_INFINITY}function _T(t){return iT(t)?function(t){const e=t.slice(1,-1),r=[];let i,n=0;for(;n<e.length;){switch(!0){case"("===e[n]:i=n+MT(e.slice(n),"(",")")+1;break;case e.startsWith("core::result::Result::<",n)||e.startsWith("core::array::Array::<",n)||e.startsWith("core::option::Option::<",n):i=n+MT(e.slice(n),"<",">")+1;break;default:{const t=e.indexOf(",",n);i=-1!==t?t:Number.POSITIVE_INFINITY}}r.push(e.slice(n,i)),n=i+2}return r}(t):function(t){const e=t.replace(/\s/g,"").slice(1,-1),{subTuple:r,result:i}=function(t){if(!t.includes("("))return{subTuple:[],result:t};const e=[];let r="",i=0;for(;i<t.length;){if("("===t[i]){let n=1;const o=i;for(i++;n;)")"===t[i]&&n--,"("===t[i]&&n++,i++;e.push(t.substring(o,i)),r+=" ",i--}else r+=t[i];i++}return{subTuple:e,result:r}}(e);let n=i.split(",").map((t=>r.length?t.replace(" ",r.shift()):t));return FI(t)&&(n=n.reduce(((t,e)=>t.concat(function(t){const e=t.substring(0,t.indexOf(":"));return{name:e,type:t.substring(e.length+":".length)}}(e))),[])),n}(t)}var ET=class t{content;arrayType;constructor(e,r){CN(t.isTypeFixedArray(r),`The type ${r} is not a Cairo fixed array. Needs [type; length].`);try{t.getFixedArrayType(r)}catch{throw new Error(`The type ${r} do not includes any content type. Needs [type; length].`)}try{t.getFixedArraySize(r)}catch{throw new Error(`The type ${r} type do not includes any length. Needs [type; length].`)}CN(t.getFixedArraySize(r)===e.length,`The ABI type ${r} is expecting ${t.getFixedArraySize(r)} items. ${e.length} items provided.`),this.content=e,this.arrayType=r}static getFixedArraySize(t){const e=t.match(/(?<=; )\d+(?=\])/);if(null===e)throw new Error(`ABI type ${t} do not includes a valid number after ';' character.`);return Number(e[0])}getFixedArraySize(){return t.getFixedArraySize(this.arrayType)}static getFixedArrayType=t=>{const e=t.match(/(?<=\[).+(?=;)/);if(null===e)throw new Error(`ABI type ${t} do not includes a valid type of data.`);return e[0]};getFixedArrayType(){return t.getFixedArrayType(this.arrayType)}static compile(t){return t.reduce(((t,e,r)=>(t[r]=e,t)),{})}compile(){return t.compile(this.content)}static isTypeFixedArray(t){return/^\[.*;\s.*\]$/.test(t)&&/(?<=\[).+(?=;)/.test(t)&&/(?<=; )\d+(?=\])/.test(t)}};function AT(t,e,r,i){const n=(t,e)=>{if(ET.isTypeFixedArray(e))return function(t,e){const r=ET.getFixedArrayType(e),i=ET.getFixedArraySize(e);if(Array.isArray(t)){if(i!==t.length)throw new Error(`ABI type ${e}: array provided do not includes ${i} items. ${t.length} items provided.`);return t.map((t=>n(t,r)))}if(i!==Object.keys(t).length)throw new Error(`ABI type ${e}: object provided do not includes ${i} properties. ${Object.keys(t).length} items provided.`);return n(t,r)}(t,e);if(LI(e))return function(t,e){const r=nT(e);if(DN(t))return t;return t.map((t=>n(t,r)))}(t,e);if(VI(e,i)){const r=i[e];return a(t,r)}if(UI(e))return function(t,e){const r=_T(e).reduce(((e,r,i)=>{const o=Object.keys(t),a=r=>Object.defineProperty(e,i.toString(),{enumerable:!0,value:r??t[o[i]]}),s=r?.type?r.type:r;return a(n(t[o[i]],s)),e}),{});return r}(t,e);if(QI(e))return t;if(aT(e))return t;if(tT(e))return t;if(eT(e))return t;if(rT(e))return t;if(zI.isAbiType(e)){const r=t;if("object"!=typeof r)return r;if(!("low"in r)||!("high"in r))throw function(t){return Error(`Your object includes the property : ${t}, containing an Uint256 object without the 'low' and 'high' keys.`)}(e);return{low:r.low,high:r.high}}if(BI.isAbiType(e)){const r=t;if("object"!=typeof r)return r;if(!["limb0","limb1","limb2","limb3"].every((t=>t in r)))throw function(t){return Error(`Your object includes the property : ${t}, containing an Uint512 object without the 'limb0' to 'limb3' keys.`)}(e);return{limb0:r.limb0,limb1:r.limb1,limb2:r.limb2,limb3:r.limb3}}if(qI(e,r)){const i=r[e].members;return o(t,i)}return t},o=(t,e)=>e.reduce(((e,r)=>{if("undefined"===t[r.name]&&(iT(r.type)||!DI(r.name)))throw Error(`Your object needs a property with key : ${r.name} .`);var i;return i=n(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:i??t[r.name]}),e}),{});const a=(t,e)=>{if(GI(e.name)){const r=t,i=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(",")),o=e.name.substring(e.name.indexOf(",")+1,e.name.lastIndexOf(">"));return r.isOk()?new gT(pT.Ok,n(t.unwrap(),i)):new gT(pT.Err,n(t.unwrap(),o))}if(HI(e.name)){const r=t,i=e.name.substring(e.name.indexOf("<")+1,e.name.lastIndexOf(">"));return r.isSome()?new mT(fT.Some,n(r.unwrap(),i)):new mT(fT.None,{})}const r=t,i=Object.entries(r.variant).map((t=>{if(ON(t[1]))return t;const i=e.type.substring(e.type.lastIndexOf("<")+1,e.type.lastIndexOf(">"));return"()"===i?t:[t[0],n(r.unwrap(),i)]}));return new dT(Object.fromEntries(i))};return e.reduce(((e,r)=>{return DI(r.name)&&!iT(r.type)||(i=n(t[r.name],r.type),Object.defineProperty(e,r.name,{enumerable:!0,value:i})),e;var i}),{})}function jT(t,e){switch(!0){case zI.isAbiType(t):return new zI(e).toApiRequest();case BI.isAbiType(t):return new BI(e).toApiRequest();case XI(t):return bI(e.toString());case rT(t):{const t=AS(FN(e)).padStart(128,"0"),r=hT(jS(t.slice(-64))),i=hT(jS(t.slice(0,-64)));return[cT(i.low),cT(i.high),cT(r.low),cT(r.high)]}default:return cT(e)}}function xT(t,e,r,i){if(void 0===t)throw Error(`Missing parameter for type ${e}`);if(ET.isTypeFixedArray(e)){const n=ET.getFixedArrayType(e);let o=[];if(Array.isArray(t)){o=new ET(t,e).content}else{if("object"!=typeof t)throw new Error(`ABI type ${e}: not an Array representing a cairo.fixedArray() provided.`);o=Object.values(t),CN(o.length===ET.getFixedArraySize(e),`ABI type ${e}: object provided do not includes ${ET.getFixedArraySize(e)} items. ${o.length} items provided.`)}return o.reduce(((t,e)=>t.concat(xT(e,n,r,i))),[])}if(Array.isArray(t)){const n=[];n.push(cT(t.length));const o=nT(e);return t.reduce(((t,e)=>t.concat(xT(e,o,r,i))),n)}if(r[e]&&r[e].members.length){if(zI.isAbiType(e))return new zI(t).toApiRequest();if(BI.isAbiType(e))return new BI(t).toApiRequest();if(QI(e))return jT(e,t);if(tT(e))return function(t){const e=_I(t);return[e.data.length.toString(),...e.data.map((t=>t.toString())),e.pending_word.toString(),e.pending_word_len.toString()]}(t);const{members:n}=r[e],o=t;return n.reduce(((t,e)=>t.concat(xT(o[e.name],e.type,r,i))),[])}if(UI(e)){const n=function(t,e){const r=_T(e),i=Object.values(t);if(i.length!==r.length)throw Error(`ParseTuple: provided and expected abi tuple size do not match.\n provided: ${i}\n expected: ${r}`);return r.map(((t,e)=>({element:i[e],type:t.type??t})))}(t,e);return n.reduce(((t,e)=>{const n=xT(e.element,e.type,r,i);return t.concat(n)}),[])}if(zI.isAbiType(e))return new zI(t).toApiRequest();if(BI.isAbiType(e))return new BI(t).toApiRequest();if(VI(e,i)){const{variants:n}=i[e];if(HI(e)){const e=t;if(e.isSome()){const t=n.find((t=>"Some"===t.name));if(ON(t))throw Error("Error in abi : Option has no 'Some' variant.");const o=t.type;if("()"===o)return fT.Some.toString();const a=xT(e.unwrap(),o,r,i);return Array.isArray(a)?[fT.Some.toString(),...a]:[fT.Some.toString(),a]}return fT.None.toString()}if(GI(e)){const e=t;if(e.isOk()){const t=n.find((t=>"Ok"===t.name));if(ON(t))throw Error("Error in abi : Result has no 'Ok' variant.");const o=t.type;if("()"===o)return pT.Ok.toString();const a=xT(e.unwrap(),o,r,i);return Array.isArray(a)?[pT.Ok.toString(),...a]:[pT.Ok.toString(),a]}const o=n.find((t=>"Err"===t.name));if(ON(o))throw Error("Error in abi : Result has no 'Err' variant.");const a=o.type;if("()"===a)return pT.Err.toString();const s=xT(e.unwrap(),a,r,i);return Array.isArray(s)?[pT.Err.toString(),...s]:[pT.Err.toString(),s]}const o=t,a=o.activeVariant(),s=n.find((t=>t.name===a));if(ON(s))throw Error(`Not find in abi : Enum has no '${a}' variant.`);const h=s.type,u=n.findIndex((t=>t.name===a));if("()"===h)return u.toString();const l=xT(o.unwrap(),h,r,i);return Array.isArray(l)?[u.toString(),...l]:[u.toString(),l]}if(aT(e))return jT(nT(e),t);if("object"==typeof t)throw Error(`Parameter ${t} do not align with abi parameter ${e}`);return jT(e,t)}function ST(t,e){let r;switch(!0){case WI(t):return r=e.next().value,Boolean(BigInt(r));case zI.isAbiType(t):const i=e.next().value,n=e.next().value;return new zI(i,n).toBigInt();case BI.isAbiType(t):const o=e.next().value,a=e.next().value,s=e.next().value,h=e.next().value;return new BI(o,a,s,h).toBigInt();case QI(t):return r=e.next().value,BigInt(r);case XI(t):return r=e.next().value,kI(r);case rT(t):const u=AS(e.next().value).padStart(32,"0"),l=AS(e.next().value).padStart(32,"0"),c=AS(e.next().value).padStart(32,"0"),d=AS(e.next().value).padStart(32,"0");return BigInt(jS(l+u+d+c));default:return r=e.next().value,BigInt(r)}}function NT(t,e,r,i){if("()"===e.type)return{};if(zI.isAbiType(e.type)){const e=t.next().value,r=t.next().value;return new zI(e,r).toBigInt()}if(BI.isAbiType(e.type)){const e=t.next().value,r=t.next().value,i=t.next().value,n=t.next().value;return new BI(e,r,i,n).toBigInt()}if(tT(e.type)){const e=[],r=BigInt(t.next().value);for(;e.length<r;)e.push(FN(t.next().value));return MI({data:e,pending_word:FN(t.next().value),pending_word_len:BigInt(t.next().value)})}if(ET.isTypeFixedArray(e.type)){const n=[],o={name:"",type:ET.getFixedArrayType(e.type)},a=ET.getFixedArraySize(e.type);for(;n.length<a;)n.push(NT(t,o,r,i));return n}if(LI(e.type)){const n=[],o={name:"",type:nT(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(NT(t,o,r,i));return n}if(aT(e.type)){const n={name:"",type:nT(e.type)};return NT(t,n,r,i)}if(r&&e.type in r&&r[e.type])return QI(e.type)?ST(e.type,t):r[e.type].members.reduce(((e,n)=>(e[n.name]=NT(t,n,r,i),e)),{});if(i&&e.type in i&&i[e.type]){const n=Number(t.next().value),o=i[e.type].variants.reduce(((e,o,a)=>a===n?(e[o.name]=NT(t,{name:"",type:o.type},r,i),e):(e[o.name]=void 0,e)),{});if(e.type.startsWith("core::option::Option")){const t=n===fT.Some?o.Some:void 0;return new mT(n,t)}if(e.type.startsWith("core::result::Result")){let t;return t=n===pT.Ok?o.Ok:o.Err,new gT(n,t)}return new dT(o)}if(UI(e.type)){return _T(e.type).reduce(((e,n,o)=>{const a=n?.name?n.name:o,s={name:a,type:n?.type?n.type:n};return e[a]=NT(t,s,r,i),e}),{})}if(LI(e.type)){const n=[],o={name:"",type:nT(e.type)},a=BigInt(t.next().value);for(;n.length<a;)n.push(NT(t,o,r,i));return n}return ST(e.type,t)}function IT(t,e,r,i,n){const{name:o,type:a}=e;let s;switch(!0){case DI(o):return s=t.next().value,BigInt(s);case r&&a in r||UI(a):case i&&VI(a,i):case ET.isTypeFixedArray(a):return NT(t,e,r,i);case LI(a):if(iT(a))return NT(t,e,r,i);const h=[];if(n&&n[`${o}_len`]){const a=n[`${o}_len`];for(;h.length<a;)h.push(NT(t,{name:o,type:e.type.replace("*","")},r,i))}return h;case aT(a):return NT(t,e,r,i);default:return ST(a,t)}}var TT=(t,e)=>{if(CN(DN(t)||RN(t)||BN(t),`Validate: arg ${e.name} should be a felt typed as (String, Number or BigInt)`),DN(t)&&!LN(t))return;const r=BigInt(t.toString(10));CN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`)},CT=(t,e)=>{let r;switch(RN(t)&&CN(t<=Number.MAX_SAFE_INTEGER,"Validation: Parameter is too large to be typed as Number use (BigInt or String)"),CN(DN(t)||RN(t)||BN(t)||$N(t)&&"low"in t&&"high"in t||$N(t)&&["limb0","limb1","limb2","limb3"].every((e=>e in t)),`Validate: arg ${e.name} of cairo type ${e.type} should be type (String, Number or BigInt), but is ${typeof t} ${t}.`),e.type){case EN.u256:r=new zI(t).toBigInt();break;case EN.u512:r=new BI(t).toBigInt();break;default:r=UN(t)}switch(e.type){case EN.u8:CN(r>=0n&&r<=255n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0 - 255]`);break;case EN.u16:CN(r>=0n&&r<=65535n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 65535]`);break;case EN.u32:CN(r>=0n&&r<=4294967295n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 4294967295]`);break;case EN.u64:CN(r>=0n&&r<=2n**64n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^64-1]`);break;case EN.u128:CN(r>=0n&&r<=2n**128n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^128-1]`);break;case EN.u256:CN(r>=0n&&r<=2n**256n-1n,`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^256-1`);break;case EN.u512:CN(BI.is(r),`Validate: arg ${e.name} is ${e.type} should be in range 0 - 2^512-1`);break;case AN.ClassHash:case AN.ContractAddress:CN(r>=0n&&r<=2n**252n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^252-1]`);break;case AN.Secp256k1Point:CN(r>=0n&&r<=2n**512n-1n,`Validate: arg ${e.name} must be ${e.type} : a 512 bits number.`);break;case AN.U96:CN(r>=0n&&r<=2n**96n-1n,`Validate: arg ${e.name} must be ${e.type} : a 96 bits number.`)}},zT=(t,e)=>{CN(PN(t),`Validate: arg ${e.name} of cairo type ${e.type} should be type (Boolean)`)},OT=(t,e,r)=>{if(e.type!==EN.u256&&e.type!==EN.u512)if(QI(e.type)){CN(!$N(t),`EthAddress type is waiting a BigNumberish. Got "${t}"`);const r=BigInt(t.toString(10));CN(r>=0n&&r<=2n**160n-1n,`Validate: arg ${e.name} cairo typed ${e.type} should be in range [0, 2^160-1]`)}else CN($N(t),`Validate: arg ${e.name} is cairo type struct (${e.type}), and should be defined as a js object (not array)`),r[e.type].members.forEach((({name:r})=>{CN(Object.keys(t).includes(r),`Validate: arg ${e.name} should have a property ${r}`)}));else CT(t,e)},RT=(t,e)=>{CN($N(t),`Validate: arg ${e.name} is cairo type Enum (${e.type}), and should be defined as a js object (not array)`);const r=Object.getOwnPropertyNames(Object.getPrototypeOf(t)),i=[...Object.getOwnPropertyNames(t),...r];if(!(HI(e.type)&&i.includes("isSome")&&i.includes("isNone")||GI(e.type)&&i.includes("isOk")&&i.includes("isErr")||i.includes("variant")&&i.includes("activeVariant")))throw new Error(`Validate Enum: argument ${e.name}, type ${e.type}, value received "${t}", is not an Enum.`)},PT=(t,e)=>{CN($N(t),`Validate: arg ${e.name} should be a tuple (defined as object)`)},BT=(t,e,r,i)=>{const n=LI(e.type),o=n?nT(e.type):ET.getFixedArrayType(e.type);if(n&&$I(o)&&wI(t))return;let a=[];if(n)CN(Array.isArray(t),`Validate: arg ${e.name} should be an Array`),a=t;else switch(!0){case Array.isArray(t):a=t;break;case"object"==typeof t:a=Object.values(t);break;default:throw new Error(`Validate: arg ${e.name} should be an Array or an object.`)}switch(!0){case $I(o):a.forEach((t=>TT(t,e)));break;case UI(o):a.forEach((t=>PT(t,{name:e.name,type:o})));break;case LI(o):a.forEach((t=>BT(t,{name:"",type:o},r,i)));break;case qI(o,r):a.forEach((t=>OT(t,{name:e.name,type:o},r)));break;case VI(o,i):a.forEach((t=>RT(t,{name:e.name,type:o})));break;case ZI(o)||JI(o):a.forEach((t=>CT(t,{name:"",type:o})));break;case WI(o):a.forEach((t=>zT(t,e)));break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value ${a}`)}};function DT(t,e,r,i){t.inputs.reduce(((t,n)=>{const o=e[t];switch(!0){case DI(n.name):return t;case $I(n.type):TT(o,n);break;case XI(n.type):((t,e)=>{CN(DN(t),`Validate: arg ${e.name} should be a string.`),CN(t.length<32,`Validate: arg ${e.name} cairo typed ${e.type} should be a string of less than 32 characters.`)})(o,n);break;case ZI(n.type)||JI(n.type):CT(o,n);break;case WI(n.type):zT(o,n);break;case tT(n.type):((t,e)=>{CN(DN(t),`Validate: arg ${e.name} should be a string.`)})(o,n);break;case LI(n.type)||ET.isTypeFixedArray(n.type):BT(o,n,r,i);break;case qI(n.type,r):OT(o,n,r);break;case VI(n.type,i):RT(o,n);break;case UI(n.type):PT(o,n);break;case aT(n.type):((t,e)=>{const r=nT(e.type);switch(CN(ZI(r)&&r!==BI.abiSelector||$I(r),`Validate: ${e.name} type is not authorized for NonZero type.`),!0){case $I(r):TT(t,e),CN(BigInt(t.toString(10))>0,"Validate: value 0 is not authorized in NonZero felt252 type.");break;case ZI(r):CT(t,{name:"",type:r}),r===EN.u256?CN(new zI(t).toBigInt()>0,"Validate: value 0 is not authorized in NonZero uint256 type."):CN(UN(t)>0,"Validate: value 0 is not authorized in NonZero uint type.");break;default:throw new Error(`Validate Unhandled: argument ${e.name}, type ${e.type}, value "${t}"`)}})(o,n);break;default:throw new Error(`Validate Unhandled: argument ${n.name}, type ${n.type}, value ${o}`)}return t+1}),0)}var $T=class t{abi;parser;structs;enums;constructor(e){this.structs=t.getAbiStruct(e),this.enums=t.getAbiEnum(e),this.parser=bT(e),this.abi=this.parser.getLegacyFormat()}validate(t,e,r=[]){if(t!==_N.DEPLOY){CN(this.abi.filter((e=>{if("function"!==e.type)return!1;const r="view"===e.stateMutability||"view"===e.state_mutability;return t===_N.INVOKE?!r:r})).map((t=>t.name)).includes(e),(t===_N.INVOKE?"invocable":"viewable")+" method not found in abi")}const i=this.abi.find((r=>t===_N.DEPLOY?r.name===e&&"constructor"===r.type:r.name===e&&"function"===r.type));if(kT(e,r,i))return;const n=this.parser.methodInputsLength(i);if(r.length!==n)throw Error(`Invalid number of arguments, expected ${n} arguments, but got ${r.length}`);DT(i,r,this.structs,this.enums)}compile(t,e){const r=this.abi.find((e=>e.name===t));if(kT(t,e,r))return[];let i;if(Array.isArray(e))i=e;else{const t=AT(e,r.inputs,this.structs,this.enums);i=Object.values(t),DT(r,i,this.structs,this.enums)}const n=i[Symbol.iterator](),o=r.inputs.reduce(((t,e)=>DI(e.name)&&!iT(e.type)?t:t.concat(function(t,e,r,i){const{name:n,type:o}=e;let{value:a}=t.next();switch(!0){case ET.isTypeFixedArray(o):if(!Array.isArray(a)&&"object"!=typeof a)throw Error(`ABI expected parameter ${n} to be an array or an object, got ${a}`);return xT(a,e.type,r,i);case LI(o):if(!Array.isArray(a)&&!gI(a))throw Error(`ABI expected parameter ${n} to be array or long string, got ${a}`);return DN(a)&&(a=vI(a)),xT(a,e.type,r,i);case aT(o):return jT(nT(o),a);case QI(o):return jT(o,a);case qI(o,r)||UI(o)||zI.isAbiType(o):case VI(o,i):return xT(a,o,r,i);default:return jT(o,a)}}(n,e,this.structs,this.enums))),[]);return Object.defineProperty(o,"__compiled__",{enumerable:!1,writable:!1,value:!0}),o}static compile(t){const e=t=>{const e=(t,r=".")=>{const i=Array.isArray(t)?[t.length.toString(),...t]:t;return Object.entries(i).flatMap((([t,n])=>{let o=n;"entrypoint"===t?o=hI(o):wI(o)&&(o=_I(o));const a=Array.isArray(i)&&"0"===t?"$$len":t;if(BN(o))return[[`${r}${a}`,cT(o)]];if(Object(o)===o){const t=Object.getOwnPropertyNames(Object.getPrototypeOf(o)),i=[...Object.getOwnPropertyNames(o),...t];if(i.includes("isSome")&&i.includes("isNone")){const t=o,i=t.isSome()?fT.Some:fT.None;return t.isSome()?e({0:i,1:t.unwrap()},`${r}${a}.`):[[`${r}${a}`,cT(i)]]}if(i.includes("isOk")&&i.includes("isErr")){const t=o,i=t.isOk()?pT.Ok:pT.Err;return e({0:i,1:t.unwrap()},`${r}${a}.`)}if(i.includes("variant")&&i.includes("activeVariant")){const t=o,i=t.activeVariant(),n=Object.keys(t.variant).findIndex((t=>t===i));return"object"==typeof t.unwrap()&&0===Object.keys(t.unwrap()).length?[[`${r}${a}`,cT(n)]]:e({0:n,1:t.unwrap()},`${r}${a}.`)}return e(o,`${r}${a}.`)}return[[`${r}${a}`,cT(o)]]}))};return Object.fromEntries(e(t))};let r;if(Array.isArray(t)){const i=e({...t});r=Object.values(i)}else{const i=e(t);r=Object.values(i)}return Object.defineProperty(r,"__compiled__",{enumerable:!1,writable:!1,value:!0}),r}parse(t,e){const{outputs:r}=this.abi.find((e=>e.name===t)),i=e.flat()[Symbol.iterator](),n=r.flat().reduce(((t,e,r)=>{const n=e.name??r;return t[n]=IT(i,e,this.structs,this.enums,t),t[n]&&t[`${n}_len`]&&delete t[`${n}_len`],t}),{});return 1===Object.keys(n).length&&0 in n?n[0]:n}format(t,e,r){return vT(this.parse(t,e),r)}static getAbiStruct(t){return t.filter((t=>"struct"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{})}static getAbiEnum(t){const e=t.filter((t=>"enum"===t.type)).reduce(((t,e)=>({...t,[e.name]:e})),{});return delete e["core::bool"],e}static toCalldata(e=[]){return t.compile(e)}static toHex(e=[]){return t.compile(e).map((t=>FN(t)))}decodeParameters(t,e){const r=Array.isArray(t)?t:[t],i=e.flat()[Symbol.iterator](),n=r.map((t=>IT(i,{name:"",type:t},this.structs,this.enums)));return 1===n.length?n[0]:n}};Xx({},{calculateContractAddressFromHash:()=>mC,calculateDeclareTransactionHash:()=>sC,calculateDeployAccountTransactionHash:()=>hC,calculateInvokeTransactionHash:()=>aC,calculateL2MessageTxHash:()=>HT,computeCompiledClassHash:()=>kC,computeContractClassHash:()=>EC,computeHashOnElements:()=>cC,computeHintedClassHash:()=>yC,computeLegacyContractClassHash:()=>wC,computePedersenHash:()=>uC,computePedersenHashOnElements:()=>dC,computePoseidonHash:()=>lC,computePoseidonHashOnElements:()=>fC,computeSierraContractClassHash:()=>_C,formatSpaces:()=>gC,getL2MessageHash:()=>cI,getSelector:()=>uI,getSelectorFromName:()=>hI,hashByteCodeSegments:()=>bC,keccakBn:()=>aI,poseidon:()=>Vw,solidityUint256PackedKeccak256:()=>lI,starknetKeccak:()=>sI});Xx({},{calculateDeclareTransactionHash:()=>FT,calculateDeployAccountTransactionHash:()=>qT,calculateL2MessageTxHash:()=>HT,calculateTransactionHash:()=>VT,calculateTransactionHashCommon:()=>UT,computeHashOnElements:()=>LT});function LT(t){return[...t,t.length].reduce(((t,e)=>Vv(UN(t),UN(e))),0).toString()}function UT(t,e,r,i,n,o,a,s=[]){const h=LT(n);return LT([t,e,r,i,h,o,a,...s])}function FT(t,e,r,i,n,o,a){return UT("0x6465636c617265",r,e,0,[t],i,n,[o,...a?[a]:[]])}function qT(t,e,r,i,n,o,a,s){return UT("0x6465706c6f795f6163636f756e74",n,t,0,[e,i,...r],o,a,[s])}function VT(t,e,r,i,n,o){return UT("0x696e766f6b65",e,t,0,r,i,n,[o])}function HT(t,e,r,i,n,o){const a=[t,...i];return UT("0x6c315f68616e646c6572",0,e,uI(r),a,0,n,[o])}Xx({},{starkCurve:()=>eb,weierstrass:()=>fv});Xx({},{calculateDeclareTransactionHash:()=>nC,calculateDeployAccountTransactionHash:()=>iC,calculateInvokeTransactionHash:()=>oC,calculateTransactionHashCommon:()=>rC,encodeResourceBoundsL1:()=>XT,encodeResourceBoundsL2:()=>tC,hashDAMode:()=>QT,hashFeeField:()=>eC});var GT=t=>t.map((t=>BigInt(t))),ZT=32n,KT=128n,JT=64n+KT,WT=BigInt(bI("L1_GAS")),YT=BigInt(bI("L2_GAS"));function QT(t,e){return(BigInt(t)<<ZT)+BigInt(e)}function XT(t){return(WT<<JT)+(BigInt(t.l1_gas.max_amount)<<KT)+BigInt(t.l1_gas.max_price_per_unit)}function tC(t){return(YT<<JT)+(BigInt(t.l2_gas.max_amount)<<KT)+BigInt(t.l2_gas.max_price_per_unit)}function eC(t,e){const r=XT(e),i=tC(e);return tb([BigInt(t),r,i])}function rC(t,e,r,i,n,o,a,s,h,u,l=[]){const c=eC(o,u),d=QT(s,h),f=GT([t,e,r,c,tb(GT(a)),i,n,d,...GT(l)]);return FN(tb(f))}function iC(t,e,r,i,n,o,a,s,h,u,l,c){return rC("0x6465706c6f795f6163636f756e74",n,t,o,a,l,c,s,h,u,[tb(GT(r)),e,i])}function nC(t,e,r,i,n,o,a,s,h,u,l,c){return rC("0x6465636c617265",i,r,n,o,l,GT(c),s,h,u,[tb(GT(a)),t,e])}function oC(t,e,r,i,n,o,a,s,h,u,l){return rC("0x696e766f6b65",e,t,i,n,u,l,a,s,h,[tb(GT(o)),tb(GT(r))])}function aC(t){return function(t){return[rS.ETransactionVersion.V3,rS.ETransactionVersion.F3].includes(t.version)}(t)?oC(t.senderAddress,t.version,t.compiledCalldata,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):VT(t.senderAddress,t.version,t.compiledCalldata,t.maxFee,t.chainId,t.nonce)}function sC(t){return function(t){return[rS.ETransactionVersion.V3,rS.ETransactionVersion.F3].includes(t.version)}(t)?nC(t.classHash,t.compiledClassHash,t.senderAddress,t.version,t.chainId,t.nonce,t.accountDeploymentData,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):FT(t.classHash,t.senderAddress,t.version,t.maxFee,t.chainId,t.nonce,t.compiledClassHash)}function hC(t){return function(t){return[rS.ETransactionVersion.V3,rS.ETransactionVersion.F3].includes(t.version)}(t)?iC(t.contractAddress,t.classHash,t.compiledConstructorCalldata,t.salt,t.version,t.chainId,t.nonce,t.nonceDataAvailabilityMode,t.feeDataAvailabilityMode,t.resourceBounds,t.tip,t.paymasterData):qT(t.contractAddress,t.classHash,t.constructorCalldata,t.salt,t.version,t.maxFee,t.chainId,t.nonce)}function uC(t,e){return Vv(BigInt(t),BigInt(e))}function lC(t,e){return FN(Xv(BigInt(t),BigInt(e)))}function cC(t){return[...t,t.length].reduce(((t,e)=>Vv(BigInt(t),BigInt(e))),0).toString()}var dC=cC;function fC(t){return FN(tb(t.map((t=>BigInt(t)))))}function mC(t,e,r,i){const n=cC($T.compile(r)),o=cC([cT("0x535441524b4e45545f434f4e54524143545f41444452455353"),i,t,e,n]);return FN(BigInt(o)%LS)}function pC(t,e){return"attributes"===t||"accessible_scopes"===t?Array.isArray(e)&&0===e.length?void 0:e:"debug_info"===t?null:null===e?void 0:e}function gC(t){let e=!1;const r=[];for(const i of t)'"'===i&&!1==(r.length>0&&"\\"===r.slice(-1)[0])&&(e=!e),e?r.push(i):r.push(":"===i?": ":","===i?", ":i);return r.join("")}function yC(t){const{abi:e,program:r}=t,i=gC(lN({abi:e,program:r},pC));return jS(Gv(bS(i)).toString(16))}function wC(t){const e=DN(t)?hN(t):t,r=FN(BS),i=cC(e.entry_points_by_type.EXTERNAL.flatMap((t=>[t.selector,t.offset]))),n=cC(e.entry_points_by_type.L1_HANDLER.flatMap((t=>[t.selector,t.offset]))),o=cC(e.entry_points_by_type.CONSTRUCTOR.flatMap((t=>[t.selector,t.offset]))),a=cC(e.program.builtins.map((t=>bI(t)))),s=yC(e),h=cC(e.program.data);return cC([r,i,n,o,a,s,h])}function vC(t){const e=t.flatMap((t=>{return[BigInt(t.selector),BigInt(t.offset),(e=t.builtins,tb(e.flatMap((t=>BigInt(bI(t))))))];var e}));return tb(e)}function bC(t){const e=t.bytecode.map((t=>BigInt(t))),r=t.bytecode_segment_lengths??[];let i=0;const n=r.flatMap((t=>{const r=e.slice(i,i+=t);return[BigInt(t),tb(r)]}));return 1n+tb(n)}function kC(t){const e=BigInt(bI("COMPILED_CLASS_V1")),r=vC(t.entry_points_by_type.EXTERNAL),i=vC(t.entry_points_by_type.L1_HANDLER),n=vC(t.entry_points_by_type.CONSTRUCTOR),o=t.bytecode_segment_lengths?bC(t):tb(t.bytecode.map((t=>BigInt(t))));return FN(tb([e,r,i,n,o]))}function MC(t){return tb(t.flatMap((t=>[BigInt(t.selector),BigInt(t.function_idx)])))}function _C(t){const e=BigInt(bI("CONTRACT_CLASS_V0.1.0")),r=MC(t.entry_points_by_type.EXTERNAL),i=MC(t.entry_points_by_type.L1_HANDLER),n=MC(t.entry_points_by_type.CONSTRUCTOR),o=function(t){const e=gC(lN(t.abi,null));return BigInt(jS(Gv(bS(e)).toString(16)))}(t),a=tb(t.sierra_program.map((t=>BigInt(t))));return FN(tb([e,r,i,n,o,a]))}function EC(t){const e=DN(t)?hN(t):t;return"sierra_program"in e?_C(e):wC(e)}function AC(t){const e=DN(t)?t:lN(t);return _S(q_(e))}function jC(t){if(Array.isArray(t))return t;const e=vS(V_(MS(t)));return hN(e)}function xC(){return Pv(Cv.randomPrivateKey())}function SC(t){return jS(t).toLowerCase()}function NC(t){if(!t)throw Error("formatSignature: provided signature is undefined");if(Array.isArray(t))return t.map((t=>FN(t)));try{const{r:e,s:r}=t;return[FN(e),FN(r)]}catch(t){throw new Error("Signature need to be weierstrass.SignatureType or an array for custom")}}function IC(t){return JN(NC(t))}function TC(t){return WN(NC(t))}function CC(t,e=50){return iI(t,e)}function zC(t,e=50,r=50){if(BN(t))return{l2_gas:{max_amount:"0x0",max_price_per_unit:"0x0"},l1_gas:{max_amount:"0x0",max_price_per_unit:"0x0"}};if(ON(t.gas_consumed)||ON(t.gas_price))throw Error("estimateFeeToBounds: estimate is undefined");return{l2_gas:{max_amount:"0x0",max_price_per_unit:"0x0"},l1_gas:{max_amount:void 0!==t.data_gas_consumed&&void 0!==t.data_gas_price?FN(iI(BigInt(t.overall_fee)/BigInt(t.gas_price),e)):FN(iI(t.gas_consumed,e)),max_price_per_unit:FN(iI(t.gas_price,r))}}}function OC(t){if(t===rS.EDataAvailabilityMode.L1)return rS.EDAMode.L1;if(t===rS.EDataAvailabilityMode.L2)return rS.EDAMode.L2;throw Error("EDAM conversion")}function RC(t,e){const r=e?FN(e):void 0,i=FN(t);if(e&&!Object.values(rS.ETransactionVersion).includes(r))throw Error(`providedVersion ${e} is not ETransactionVersion`);if(!Object.values(rS.ETransactionVersion).includes(i))throw Error(`defaultVersion ${t} is not ETransactionVersion`);return e?r:i}function PC(t){if(!t)return;const e=FN(t);if(e===rS.ETransactionVersion.V0)return rS.ETransactionVersion.F0;if(e===rS.ETransactionVersion.V1)return rS.ETransactionVersion.F1;if(e===rS.ETransactionVersion.V2)return rS.ETransactionVersion.F2;if(e===rS.ETransactionVersion.V3)return rS.ETransactionVersion.F3;throw Error(`toFeeVersion: ${e} is not supported`)}function BC(t){return{tip:t.tip||0,paymasterData:t.paymasterData||[],accountDeploymentData:t.accountDeploymentData||[],nonceDataAvailabilityMode:t.nonceDataAvailabilityMode||rS.EDataAvailabilityMode.L1,feeDataAvailabilityMode:t.feeDataAvailabilityMode||rS.EDataAvailabilityMode.L1,resourceBounds:t.resourceBounds??zC(OS)}}function DC(t){return t===rS.ETransactionVersion.F2?rS.ETransactionVersion.F1:t===rS.ETransactionVersion.V2?rS.ETransactionVersion.V1:t}function $C(t){return jS(ES(Av(FN(t),!1)))}function LC(t){return"sierra_program"in(DN(t)?hN(t):t)}Xx({},{compressProgram:()=>AC,decompressProgram:()=>jC,estimateFeeToBounds:()=>zC,estimatedFeeToMaxFee:()=>CC,formatSignature:()=>NC,getFullPublicKey:()=>$C,intDAM:()=>OC,makeAddress:()=>SC,randomAddress:()=>xC,reduceV2:()=>DC,signatureToDecimalArray:()=>IC,signatureToHexArray:()=>TC,toFeeVersion:()=>PC,toTransactionVersion:()=>RC,v3Details:()=>BC});function UC(){return IS(ES(Y_.utils.randomPrivateKey()))}function FC(t){KN(t,OS,2n**160n-1n,"Ethereum Address ");const e=jS(AS(FN(t)).padStart(40,"0"));return CN(Boolean(e.match(/^(0x)?[0-9a-f]{40}$/)),"Invalid Ethereum Address Format"),e}Xx({},{ethRandomPrivateKey:()=>UC,validateAndParseEthAddress:()=>FC});var qC=wS&&window.fetch.bind(window)||!ON(t)&&cx(t.fetch)||Px;Xx({},{Block:()=>QC,createSierraContractClass:()=>KC,getDefaultNodeUrl:()=>WC,isPendingBlock:()=>ez,isPendingStateUpdate:()=>iz,isPendingTransaction:()=>rz,isV3Tx:()=>XC,isVersion:()=>tz,parseContract:()=>JC,validBlockTags:()=>YC,wait:()=>ZC});var VC=class t{static instance;config;constructor(){this.initialize()}initialize(){this.config={...nN}}static getInstance(){return t.instance||(t.instance=new t),t.instance}get(t,e){return this.config[t]??e}set(t,e){this.config[t]=e}update(t){this.config={...this.config,...t}}getAll(){return{...this.config}}reset(){this.initialize()}delete(t){delete this.config[t]}hasKey(t){return t in this.config}}.getInstance(),HC={DEBUG:5,INFO:4,WARN:3,ERROR:2,FATAL:1,OFF:0},GC=class t{static instance;config;constructor(){this.config=VC}static getInstance(){return t.instance||(t.instance=new t),t.instance}getTimestamp(){return(new Date).toISOString()}shouldLog(t){const e=this.config.get("logLevel","INFO");return t<=HC[e]}formatMessage(t){const{level:e,message:r,timestamp:i,data:n}=t;let o=`[${i}] ${e}: ${r}`;if(n)try{o+=`\n${JSON.stringify(n,null,2)}`}catch(t){o+=`\n[JSON.stringify Error/Circular]: ${t}`}return o}log(t,e,r){if(!this.shouldLog(HC[t]))return;const i={level:t,message:e,timestamp:this.getTimestamp(),data:r},n=this.formatMessage(i);switch(t){case"DEBUG":console.debug(n);break;case"INFO":console.info(n);break;case"WARN":console.warn(n);break;case"ERROR":case"FATAL":console.error(n);break;case"OFF":break;default:console.log(n)}}debug(t,e){this.log("DEBUG",t,e)}info(t,e){this.log("INFO",t,e)}warn(t,e){this.log("WARN",t,e)}error(t,e){this.log("ERROR",t,e)}fatal(t,e){this.log("FATAL",t,e)}setLogLevel(t){this.config.set("logLevel",t)}getLogLevel(){return this.config.get("logLevel","INFO")}getEnabledLogLevels(){return Object.keys(HC).filter((t=>this.shouldLog(HC[t])&&"OFF"!==t))}}.getInstance();function ZC(t){return new Promise((e=>{setTimeout(e,t)}))}function KC(t){const e={...t};return delete e.sierra_program_debug_info,e.abi=gC(lN(t.abi)),e.sierra_program=gC(lN(t.sierra_program)),e.sierra_program=AC(e.sierra_program),e}function JC(t){const e=DN(t)?hN(t):t;return LC(t)?KC(e):{...e,..."program"in e&&{program:AC(e.program)}}}var WC=(t,e=!1)=>{e||GC.info("Using default public node url, please provide nodeUrl in provider options!");const r=QS[t??"SN_SEPOLIA"];return r[Math.floor(Math.random()*r.length)]},YC=Object.values(MN),QC=class{hash=null;number=null;tag=null;setIdentifier(t){if(DN(t))if(pI(t))this.number=parseInt(t,10);else if(LN(t))this.hash=t;else{if(!YC.includes(t))throw TypeError(`Block identifier unmanaged: ${t}`);this.tag=t}else BN(t)?this.hash=FN(t):RN(t)?this.number=t:this.tag=MN.PENDING;if(RN(this.number)&&this.number<0)throw TypeError(`Block number (${this.number}) can't be negative`)}constructor(t){this.setIdentifier(t)}get queryIdentifier(){return null!==this.number?`blockNumber=${this.number}`:null!==this.hash?`blockHash=${this.hash}`:`blockNumber=${this.tag}`}get identifier(){return null!==this.number?{block_number:this.number}:null!==this.hash?{block_hash:this.hash}:this.tag}set identifier(t){this.setIdentifier(t)}valueOf=()=>this.number;toString=()=>this.hash};function XC(t){const e=t.version?FN(t.version):rS.ETransactionVersion.V3;return e===rS.ETransactionVersion.V3||e===rS.ETransactionVersion.F3}function tz(t,e){const[r,i]=t.split("."),[n,o]=e.split(".");return r===n&&i===o}function ez(t){return"PENDING"===t.status}function rz(t){return!("block_hash"in t)}function iz(t){return!("block_hash"in t)}var nz={};Xx(nz,{buildUDCCall:()=>cz,fromCallsToExecuteCalldata:()=>az,fromCallsToExecuteCalldataWithNonce:()=>sz,fromCallsToExecuteCalldata_cairo1:()=>uz,getExecuteCalldata:()=>lz,getVersionsByType:()=>dz,transformCallsToMulticallArrays:()=>oz,transformCallsToMulticallArrays_cairo1:()=>hz});var oz=t=>{const e=[],r=[];return t.forEach((t=>{const i=$T.compile(t.calldata||[]);e.push({to:UN(t.contractAddress).toString(10),selector:UN(hI(t.entrypoint)).toString(10),data_offset:r.length.toString(),data_len:i.length.toString()}),r.push(...i)})),{callArray:e,calldata:$T.compile({calldata:r})}},az=t=>{const{callArray:e,calldata:r}=oz(t);return[...$T.compile({callArray:e}),...r]},sz=(t,e)=>[...az(t),UN(e).toString()],hz=t=>{const e=t.map((t=>({to:UN(t.contractAddress).toString(10),selector:UN(hI(t.entrypoint)).toString(10),calldata:$T.compile(t.calldata||[])})));return e},uz=t=>{const e=t.map((t=>({contractAddress:t.contractAddress,entrypoint:t.entrypoint,calldata:Array.isArray(t.calldata)&&"__compiled__"in t.calldata?t.calldata:$T.compile(t.calldata)})));return $T.compile({orderCalls:e})},lz=(t,e="0")=>"1"===e?uz(t):az(t);function cz(t,e){const r=[].concat(t).map((t=>{const{classHash:r,salt:i,unique:n=!0,constructorCalldata:o=[]}=t,a=$T.compile(o),s=i??xC();return{call:{contractAddress:WS.ADDRESS,entrypoint:WS.ENTRYPOINT,calldata:[r,s,eI(n),a.length,...a]},address:mC(n?Vv(e,s):s,r,a,n?WS.ADDRESS:0)}}));return{calls:r.map((t=>t.call)),addresses:r.map((t=>t.address))}}function dz(t){return"fee"===t?{v1:rS.ETransactionVersion.F1,v2:rS.ETransactionVersion.F2,v3:rS.ETransactionVersion.F3}:{v1:rS.ETransactionVersion.V1,v2:rS.ETransactionVersion.V2,v3:rS.ETransactionVersion.V3}}var fz={headers:{"Content-Type":"application/json"},blockIdentifier:MN.PENDING,retries:200},mz=class{nodeUrl;headers;requestId;blockIdentifier;retries;waitMode;chainId;specVersion;transactionRetryIntervalFallback;batchClient;baseFetch;constructor(t){const{baseFetch:e,batch:r,blockIdentifier:i,chainId:n,headers:o,nodeUrl:a,retries:s,specVersion:h,transactionRetryIntervalFallback:u,waitMode:l}=t||{};Object.values(GS).includes(a)?this.nodeUrl=WC(a,t?.default):this.nodeUrl=a||WC(void 0,t?.default),this.baseFetch=e??qC,this.blockIdentifier=i??fz.blockIdentifier,this.chainId=n,this.headers={...fz.headers,...o},this.retries=s??fz.retries,this.specVersion=h,this.transactionRetryIntervalFallback=u,this.waitMode=l??!1,this.requestId=0,"number"==typeof r&&(this.batchClient=new TN({nodeUrl:this.nodeUrl,headers:this.headers,interval:r,baseFetch:this.baseFetch}))}get transactionRetryIntervalDefault(){return this.transactionRetryIntervalFallback??5e3}setChainId(t){this.chainId=t}fetch(t,e,r=0){const i={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:lN(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new pN(r,t,e);if(i instanceof mN)throw i;if(i)throw Error(i.message)}async fetchEndpoint(t,e){try{if(this.batchClient){const{error:r,result:i}=await this.batchClient.fetch(t,e,this.requestId+=1);return this.errorHandler(t,e,r),i}const r=await this.fetch(t,e,this.requestId+=1),{error:i,result:n}=await r.json();return this.errorHandler(t,e,i),n}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??=await this.fetchEndpoint("starknet_chainId"),this.chainId}async getSpecVersion(){return this.specVersion??=await this.fetchEndpoint("starknet_specVersion"),this.specVersion}getNonceForAddress(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:i})}getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}getBlockWithTxHashes(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new QC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=FN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}simulateTransaction(t,e={}){const{blockIdentifier:r=this.blockIdentifier,skipValidate:i=!0,skipFeeCharge:n=!0}=e,o=new QC(r).identifier,a=[];return i&&a.push(nS.ESimulationFlag.SKIP_VALIDATE),n&&a.push(nS.ESimulationFlag.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:o,transactions:t.map((t=>this.buildTransaction(t))),simulation_flags:a})}async waitForTransaction(t,e){const r=FN(t);let{retries:i}=this,n=!1,o=!1;const a=e?.retryInterval??this.transactionRetryIntervalDefault,s=e?.errorStates??[nS.ETransactionStatus.REJECTED],h=e?.successStates??[nS.ETransactionExecutionStatus.SUCCEEDED,nS.ETransactionStatus.ACCEPTED_ON_L2,nS.ETransactionStatus.ACCEPTED_ON_L1];let u;for(;!n;){await ZC(a);try{u=await this.getTransactionStatus(r);const t=u.execution_status,e=u.finality_status;if(!e){throw new Error("waiting for transaction status")}if(s.includes(t)||s.includes(e)){const r=`${t}: ${e}`,i=new Error(r);throw i.response=u,o=!0,i}(h.includes(t)||h.includes(e))&&(n=!0)}catch(t){if(t instanceof Error&&o)throw t;if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1}let l=null;for(;null===l;){try{l=await this.getTransactionReceipt(r)}catch(t){if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1,await ZC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=FN(t),n=VN(e),o=new QC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:i,contract_address:r})}async getEstimateFee(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!0}){const i=new QC(e).identifier;let n={};return tz("0.5",await this.getSpecVersion())||(n={simulation_flags:r?[nS.ESimulationFlag.SKIP_VALIDATE]:[]}),this.fetchEndpoint("starknet_estimateFee",{request:t.map((t=>this.buildTransaction(t,"fee"))),block_id:i,...n})}async invoke(t,e){let r;return XC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:nS.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),version:nS.ETransactionVersion.V3,signature:TC(t.signature),nonce:FN(e.nonce),resource_bounds:e.resourceBounds,tip:FN(e.tip),paymaster_data:e.paymasterData.map((t=>FN(t))),account_deployment_data:e.accountDeploymentData.map((t=>FN(t))),nonce_data_availability_mode:e.nonceDataAvailabilityMode,fee_data_availability_mode:e.feeDataAvailabilityMode}}):(r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),type:nS.ETransactionType.INVOKE,max_fee:FN(e.maxFee||0),version:nS.ETransactionVersion.V1,signature:TC(t.signature),nonce:FN(e.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:nS.ETransactionVersion.V1,type:nS.ETransactionType.INVOKE})),this.waitMode?this.waitForTransaction((await r).transaction_hash):r}async declare({contract:t,signature:e,senderAddress:r,compiledClassHash:i},n){let o;if(LC(t)||XC(n))if(LC(t)&&!XC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:nS.ETransactionType.DECLARE,contract_class:{sierra_program:jC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},compiled_class_hash:i||"",version:nS.ETransactionVersion.V2,max_fee:FN(n.maxFee||0),signature:TC(e),sender_address:r,nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:nS.ETransactionVersion.V2,type:nS.ETransactionType.DECLARE});else{if(!LC(t)||!XC(n))throw Error("declare unspotted parameters");o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:nS.ETransactionType.DECLARE,sender_address:r,compiled_class_hash:i||"",version:nS.ETransactionVersion.V3,signature:TC(e),nonce:FN(n.nonce),contract_class:{sierra_program:jC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},resource_bounds:n.resourceBounds,tip:FN(n.tip),paymaster_data:n.paymasterData.map((t=>FN(t))),account_deployment_data:n.accountDeploymentData.map((t=>FN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}})}else o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:nS.ETransactionType.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:nS.ETransactionVersion.V1,max_fee:FN(n.maxFee||0),signature:TC(e),sender_address:r,nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:nS.ETransactionVersion.V1,type:nS.ETransactionType.DECLARE});return this.waitMode?this.waitForTransaction((await o).transaction_hash):o}async deployAccount({classHash:t,constructorCalldata:e,addressSalt:r,signature:i},n){let o;return XC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:nS.ETransactionType.DEPLOY_ACCOUNT,version:nS.ETransactionVersion.V3,signature:TC(i),nonce:FN(n.nonce),contract_address_salt:FN(r||0),constructor_calldata:$T.toHex(e||[]),class_hash:FN(t),resource_bounds:n.resourceBounds,tip:FN(n.tip),paymaster_data:n.paymasterData.map((t=>FN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:$T.toHex(e||[]),class_hash:FN(t),contract_address_salt:FN(r||0),type:nS.ETransactionType.DEPLOY_ACCOUNT,max_fee:FN(n.maxFee||0),version:nS.ETransactionVersion.V1,signature:TC(i),nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:nS.ETransactionVersion.V1,type:nS.ETransactionType.DEPLOY_ACCOUNT})),this.waitMode?this.waitForTransaction((await o).transaction_hash):o}callContract(t,e=this.blockIdentifier){const r=new QC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:hI(t.entrypoint),calldata:$T.toHex(t.calldata)},block_id:r})}estimateMessageFee(t,e=this.blockIdentifier){const{from_address:r,to_address:i,entry_point_selector:n,payload:o}=t,a={from_address:FC(r),to_address:FN(i),entry_point_selector:uI(n),payload:tI(o)},s=new QC(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:a,block_id:s})}getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}buildTransaction(t,e){const r=dz(e);let i;if(XC(t)?i={signature:TC(t.signature),nonce:FN(t.nonce),resource_bounds:t.resourceBounds,tip:FN(t.tip),paymaster_data:t.paymasterData.map((t=>FN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>FN(t)))}:(i={signature:TC(t.signature),nonce:FN(t.nonce),max_fee:FN(t.maxFee||0)},GC.warn(oN.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===yN.INVOKE)return{type:nS.ETransactionType.INVOKE,sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),version:FN(t.version||r.v3),...i};if(t.type===yN.DECLARE)return LC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:jC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:FN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:FN(t.version||r.v1),...i};if(t.type===yN.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:$T.toHex(t.constructorCalldata||[]),class_hash:FN(t.classHash),contract_address_salt:FN(t.addressSalt||0),version:FN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}};Xx({},{RpcChannel:()=>gz});var pz={headers:{"Content-Type":"application/json"},blockIdentifier:MN.PENDING,retries:200},gz=class{nodeUrl;headers;requestId;blockIdentifier;retries;waitMode;chainId;specVersion;transactionRetryIntervalFallback;batchClient;baseFetch;constructor(t){const{baseFetch:e,batch:r,blockIdentifier:i,chainId:n,headers:o,nodeUrl:a,retries:s,specVersion:h,transactionRetryIntervalFallback:u,waitMode:l}=t||{};Object.values(GS).includes(a)?this.nodeUrl=WC(a,t?.default):this.nodeUrl=a||WC(void 0,t?.default),this.baseFetch=e??qC,this.blockIdentifier=i??pz.blockIdentifier,this.chainId=n,this.headers={...pz.headers,...o},this.retries=s??pz.retries,this.specVersion=h,this.transactionRetryIntervalFallback=u,this.waitMode=l??!1,this.requestId=0,"number"==typeof r&&(this.batchClient=new TN({nodeUrl:this.nodeUrl,headers:this.headers,interval:r,baseFetch:this.baseFetch}))}get transactionRetryIntervalDefault(){return this.transactionRetryIntervalFallback??5e3}setChainId(t){this.chainId=t}fetch(t,e,r=0){const i={id:r,jsonrpc:"2.0",method:t,...e&&{params:e}};return this.baseFetch(this.nodeUrl,{method:"POST",body:lN(i),headers:this.headers})}errorHandler(t,e,r,i){if(r)throw new pN(r,t,e);if(i instanceof mN)throw i;if(i)throw Error(i.message)}async fetchEndpoint(t,e){try{if(this.batchClient){const{error:r,result:i}=await this.batchClient.fetch(t,e,this.requestId+=1);return this.errorHandler(t,e,r),i}const r=await this.fetch(t,e,this.requestId+=1),{error:i,result:n}=await r.json();return this.errorHandler(t,e,i),n}catch(r){throw this.errorHandler(t,e,r?.response?.data,r),r}}async getChainId(){return this.chainId??=await this.fetchEndpoint("starknet_chainId"),this.chainId}async getSpecVersion(){return this.specVersion??=await this.fetchEndpoint("starknet_specVersion"),this.specVersion}getNonceForAddress(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getNonce",{contract_address:r,block_id:i})}getBlockLatestAccepted(){return this.fetchEndpoint("starknet_blockHashAndNumber")}getBlockNumber(){return this.fetchEndpoint("starknet_blockNumber")}getBlockWithTxHashes(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxHashes",{block_id:e})}getBlockWithTxs(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithTxs",{block_id:e})}getBlockWithReceipts(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockWithReceipts",{block_id:e})}getBlockStateUpdate(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getStateUpdate",{block_id:e})}getBlockTransactionsTraces(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_traceBlockTransactions",{block_id:e})}getBlockTransactionCount(t=this.blockIdentifier){const e=new QC(t).identifier;return this.fetchEndpoint("starknet_getBlockTransactionCount",{block_id:e})}getTransactionByHash(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionByHash",{transaction_hash:e})}getTransactionByBlockIdAndIndex(t,e){const r=new QC(t).identifier;return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex",{block_id:r,index:e})}getTransactionReceipt(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionReceipt",{transaction_hash:e})}getTransactionTrace(t){const e=FN(t);return this.fetchEndpoint("starknet_traceTransaction",{transaction_hash:e})}getTransactionStatus(t){const e=FN(t);return this.fetchEndpoint("starknet_getTransactionStatus",{transaction_hash:e})}simulateTransaction(t,e={}){const{blockIdentifier:r=this.blockIdentifier,skipValidate:i=!0,skipFeeCharge:n=!0}=e,o=new QC(r).identifier,a=[];return i&&a.push(Qm.SKIP_VALIDATE),n&&a.push(Qm.SKIP_FEE_CHARGE),this.fetchEndpoint("starknet_simulateTransactions",{block_id:o,transactions:t.map((t=>this.buildTransaction(t))),simulation_flags:a})}async waitForTransaction(t,e){const r=FN(t);let{retries:i}=this,n=!1,o=!1;const a=e?.retryInterval??this.transactionRetryIntervalDefault,s=e?.errorStates??[Xm.REJECTED],h=e?.successStates??[ep.SUCCEEDED,Xm.ACCEPTED_ON_L2,Xm.ACCEPTED_ON_L1];let u;for(;!n;){await ZC(a);try{u=await this.getTransactionStatus(r);const t=u.execution_status,e=u.finality_status;if(!e){throw new Error("waiting for transaction status")}if(s.includes(t)||s.includes(e)){const r=`${t}: ${e}`,i=new Error(r);throw i.response=u,o=!0,i}(h.includes(t)||h.includes(e))&&(n=!0)}catch(t){if(t instanceof Error&&o)throw t;if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1}let l=null;for(;null===l;){try{l=await this.getTransactionReceipt(r)}catch(t){if(i<=0)throw new Error(`waitForTransaction timed-out with retries ${this.retries}`)}i-=1,await ZC(a)}return l}getStorageAt(t,e,r=this.blockIdentifier){const i=FN(t),n=VN(e),o=new QC(r).identifier;return this.fetchEndpoint("starknet_getStorageAt",{contract_address:i,key:n,block_id:o})}getClassHashAt(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClassHashAt",{block_id:i,contract_address:r})}getClass(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClass",{class_hash:r,block_id:i})}getClassAt(t,e=this.blockIdentifier){const r=FN(t),i=new QC(e).identifier;return this.fetchEndpoint("starknet_getClassAt",{block_id:i,contract_address:r})}async getEstimateFee(t,{blockIdentifier:e=this.blockIdentifier,skipValidate:r=!0}){const i=new QC(e).identifier;let n={};return tz("0.5",await this.getSpecVersion())||(n={simulation_flags:r?[Qm.SKIP_VALIDATE]:[]}),this.fetchEndpoint("starknet_estimateFee",{request:t.map((t=>this.buildTransaction(t,"fee"))),block_id:i,...n})}async invoke(t,e){let r;return XC(e)?r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{type:Ym.INVOKE,sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),version:op.V3,signature:TC(t.signature),nonce:FN(e.nonce),resource_bounds:e.resourceBounds,tip:FN(e.tip),paymaster_data:e.paymasterData.map((t=>FN(t))),account_deployment_data:e.accountDeploymentData.map((t=>FN(t))),nonce_data_availability_mode:e.nonceDataAvailabilityMode,fee_data_availability_mode:e.feeDataAvailabilityMode}}):(r=this.fetchEndpoint("starknet_addInvokeTransaction",{invoke_transaction:{sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),type:Ym.INVOKE,max_fee:FN(e.maxFee||0),version:op.V1,signature:TC(t.signature),nonce:FN(e.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:op.V1,type:Ym.INVOKE})),this.waitMode?this.waitForTransaction((await r).transaction_hash):r}async declare({contract:t,signature:e,senderAddress:r,compiledClassHash:i},n){let o;if(LC(t)||XC(n))if(LC(t)&&!XC(n))o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ym.DECLARE,contract_class:{sierra_program:jC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},compiled_class_hash:i||"",version:op.V2,max_fee:FN(n.maxFee||0),signature:TC(e),sender_address:r,nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:op.V2,type:Ym.DECLARE});else{if(!LC(t)||!XC(n))throw Error("declare unspotted parameters");o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ym.DECLARE,sender_address:r,compiled_class_hash:i||"",version:op.V3,signature:TC(e),nonce:FN(n.nonce),contract_class:{sierra_program:jC(t.sierra_program),contract_class_version:t.contract_class_version,entry_points_by_type:t.entry_points_by_type,abi:t.abi},resource_bounds:n.resourceBounds,tip:FN(n.tip),paymaster_data:n.paymasterData.map((t=>FN(t))),account_deployment_data:n.accountDeploymentData.map((t=>FN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}})}else o=this.fetchEndpoint("starknet_addDeclareTransaction",{declare_transaction:{type:Ym.DECLARE,contract_class:{program:t.program,entry_points_by_type:t.entry_points_by_type,abi:t.abi},version:op.V1,max_fee:FN(n.maxFee||0),signature:TC(e),sender_address:r,nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:op.V1,type:Ym.DECLARE});return this.waitMode?this.waitForTransaction((await o).transaction_hash):o}async deployAccount({classHash:t,constructorCalldata:e,addressSalt:r,signature:i},n){let o;return XC(n)?o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{type:Ym.DEPLOY_ACCOUNT,version:op.V3,signature:TC(i),nonce:FN(n.nonce),contract_address_salt:FN(r||0),constructor_calldata:$T.toHex(e||[]),class_hash:FN(t),resource_bounds:n.resourceBounds,tip:FN(n.tip),paymaster_data:n.paymasterData.map((t=>FN(t))),nonce_data_availability_mode:n.nonceDataAvailabilityMode,fee_data_availability_mode:n.feeDataAvailabilityMode}}):(o=this.fetchEndpoint("starknet_addDeployAccountTransaction",{deploy_account_transaction:{constructor_calldata:$T.toHex(e||[]),class_hash:FN(t),contract_address_salt:FN(r||0),type:Ym.DEPLOY_ACCOUNT,max_fee:FN(n.maxFee||0),version:op.V1,signature:TC(i),nonce:FN(n.nonce)}}),GC.warn(oN.legacyTxWarningMessage,{version:op.V1,type:Ym.DEPLOY_ACCOUNT})),this.waitMode?this.waitForTransaction((await o).transaction_hash):o}callContract(t,e=this.blockIdentifier){const r=new QC(e).identifier;return this.fetchEndpoint("starknet_call",{request:{contract_address:t.contractAddress,entry_point_selector:hI(t.entrypoint),calldata:$T.toHex(t.calldata)},block_id:r})}estimateMessageFee(t,e=this.blockIdentifier){const{from_address:r,to_address:i,entry_point_selector:n,payload:o}=t,a={from_address:FC(r),to_address:FN(i),entry_point_selector:uI(n),payload:tI(o)},s=new QC(e).identifier;return this.fetchEndpoint("starknet_estimateMessageFee",{message:a,block_id:s})}getSyncingStats(){return this.fetchEndpoint("starknet_syncing")}getEvents(t){return this.fetchEndpoint("starknet_getEvents",{filter:t})}buildTransaction(t,e){const r=dz(e);let i;if(XC(t)?i={signature:TC(t.signature),nonce:FN(t.nonce),resource_bounds:t.resourceBounds,tip:FN(t.tip),paymaster_data:t.paymasterData.map((t=>FN(t))),nonce_data_availability_mode:t.nonceDataAvailabilityMode,fee_data_availability_mode:t.feeDataAvailabilityMode,account_deployment_data:t.accountDeploymentData.map((t=>FN(t)))}:(i={signature:TC(t.signature),nonce:FN(t.nonce),max_fee:FN(t.maxFee||0)},GC.warn(oN.legacyTxWarningMessage,{version:t.version,type:t.type})),t.type===yN.INVOKE)return{type:Ym.INVOKE,sender_address:t.contractAddress,calldata:$T.toHex(t.calldata),version:FN(t.version||r.v3),...i};if(t.type===yN.DECLARE)return LC(t.contract)?{type:t.type,contract_class:{...t.contract,sierra_program:jC(t.contract.sierra_program)},compiled_class_hash:t.compiledClassHash||"",sender_address:t.senderAddress,version:FN(t.version||r.v3),...i}:{type:t.type,contract_class:t.contract,sender_address:t.senderAddress,version:FN(t.version||r.v1),...i};if(t.type===yN.DEPLOY_ACCOUNT){const{account_deployment_data:e,...n}=i;return{type:t.type,constructor_calldata:$T.toHex(t.constructorCalldata||[]),class_hash:FN(t.classHash),contract_address_salt:FN(t.addressSalt||0),version:FN(t.version||r.v3),...n}}throw Error("RPC buildTransaction received unknown TransactionType")}},yz=class{margin;constructor(t){this.margin=t}estimatedFeeToMaxFee(t){return CC(t,this.margin?.maxFee)}estimateFeeToBounds(t){return zC(t,this.margin?.l1BoundMaxAmount,this.margin?.l1BoundMaxPricePerUnit)}parseGetBlockResponse(t){return{status:"PENDING",...t}}parseTransactionReceipt(t){return"actual_fee"in t&&DN(t.actual_fee)?{...t,actual_fee:{amount:t.actual_fee,unit:"FRI"}}:t}parseFeeEstimateResponse(t){const e=t[0];return{overall_fee:UN(e.overall_fee),gas_consumed:UN(e.gas_consumed),gas_price:UN(e.gas_price),unit:e.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(e.overall_fee),resourceBounds:this.estimateFeeToBounds(e),data_gas_consumed:e.data_gas_consumed?UN(e.data_gas_consumed):0n,data_gas_price:e.data_gas_price?UN(e.data_gas_price):0n}}parseFeeEstimateBulkResponse(t){return t.map((t=>({overall_fee:UN(t.overall_fee),gas_consumed:UN(t.gas_consumed),gas_price:UN(t.gas_price),unit:t.unit,suggestedMaxFee:this.estimatedFeeToMaxFee(t.overall_fee),resourceBounds:this.estimateFeeToBounds(t),data_gas_consumed:t.data_gas_consumed?UN(t.data_gas_consumed):0n,data_gas_price:t.data_gas_price?UN(t.data_gas_price):0n})))}parseSimulateTransactionResponse(t){return t.map((t=>({...t,suggestedMaxFee:this.estimatedFeeToMaxFee(t.fee_estimation.overall_fee),resourceBounds:this.estimateFeeToBounds(t.fee_estimation)})))}parseContractClassResponse(t){return{...t,abi:DN(t.abi)?JSON.parse(t.abi):t.abi}}parseL1GasPriceResponse(t){return t.l1_gas_price.price_in_wei}},wz=class t{statusReceipt;value;constructor(e){[this.statusReceipt,this.value]=t.isSuccess(e)?["success",e]:t.isReverted(e)?["reverted",e]:t.isRejected(e)?["rejected",e]:["error",new Error("Unknown response type")];for(const[t]of Object.entries(this))Object.defineProperty(this,t,{enumerable:!1});for(const[t,r]of Object.entries(e))Object.defineProperty(this,t,{enumerable:!0,writable:!1,value:r})}match(t){return this.statusReceipt in t?t[this.statusReceipt](this.value):t._()}isSuccess(){return"success"===this.statusReceipt}isReverted(){return"reverted"===this.statusReceipt}isRejected(){return"rejected"===this.statusReceipt}isError(){return"error"===this.statusReceipt}static isSuccess(t){return t.execution_status===bN.SUCCEEDED}static isReverted(t){return t.execution_status===bN.REVERTED}static isRejected(t){return t.status===bN.REJECTED}},vz={};Xx(vz,{TypedDataRevision:()=>lp,encodeData:()=>Oz,encodeType:()=>Tz,encodeValue:()=>zz,getDependencies:()=>Iz,getMessageHash:()=>Pz,getStructHash:()=>Rz,getTypeHash:()=>Cz,isMerkleTreeType:()=>Nz,prepareSelector:()=>Sz,validateTypedData:()=>xz,verifyMessage:()=>Bz});Xx({},{MerkleTree:()=>bz,proofMerklePath:()=>kz});var bz=class t{leaves;branches=[];root;hashMethod;constructor(t,e=uC){this.hashMethod=e,this.leaves=t,this.root=this.build(t)}build(e){if(1===e.length)return e[0];e.length!==this.leaves.length&&this.branches.push(e);const r=[];for(let i=0;i<e.length;i+=2)i+1===e.length?r.push(t.hash(e[i],"0x0",this.hashMethod)):r.push(t.hash(e[i],e[i+1],this.hashMethod));return this.build(r)}static hash(t,e,r=uC){const[i,n]=[BigInt(t),BigInt(e)].sort(((t,e)=>t>=e?1:-1));return r(i,n)}getProof(e,r=this.leaves,i=[]){const n=r.indexOf(e);if(-1===n)throw new Error("leaf not found");if(1===r.length)return i;const o=n%2==0,a=(o?r[n+1]:r[n-1])??"0x0",s=[...i,a],h=this.leaves.length===r.length?-1:this.branches.findIndex((t=>t.length===r.length)),u=this.branches[h+1]??[this.root];return this.getProof(t.hash(o?e:a,o?a:e,this.hashMethod),u,s)}};function kz(t,e,r,i=uC){if(0===r.length)return t===e;const[n,...o]=r;return kz(t,bz.hash(e,n,i),o,i)}var Mz={u256:JSON.parse('[{ "name": "low", "type": "u128" }, { "name": "high", "type": "u128" }]'),TokenAmount:JSON.parse('[{ "name": "token_address", "type": "ContractAddress" }, { "name": "amount", "type": "u256" }]'),NftId:JSON.parse('[{ "name": "collection_address", "type": "ContractAddress" }, { "name": "token_id", "type": "u256" }]')},_z={[lp.ACTIVE]:{domain:"StarknetDomain",hashMethod:fC,hashMerkleMethod:lC,escapeTypeString:t=>`"${t}"`,presetTypes:Mz},[lp.LEGACY]:{domain:"StarkNetDomain",hashMethod:dC,hashMerkleMethod:uC,escapeTypeString:t=>t,presetTypes:{}}};function Ez(t,e,{min:r,max:i}){const n=BigInt(t);CN(n>=r&&n<=i,`${n} (${e}) is out of bounds [${r}, ${i}]`)}function Az({types:t,domain:e}){return _z[lp.ACTIVE].domain in t&&e.revision===lp.ACTIVE?lp.ACTIVE:_z[lp.LEGACY].domain in t&&(e.revision??lp.LEGACY)===lp.LEGACY?lp.LEGACY:void 0}function jz(t){try{return FN(t)}catch(e){if(DN(t))return FN(bI(t));throw new Error(`Invalid BigNumberish: ${t}`)}}function xz(t){const e=t;return Boolean(e.message&&e.primaryType&&e.types&&Az(e))}function Sz(t){return LN(t)?t:hI(t)}function Nz(t){return"merkletree"===t.type}function Iz(t,e,r=[],i="",n=lp.LEGACY){let o=[e];return"*"===e[e.length-1]?o=[e.slice(0,-1)]:n===lp.ACTIVE&&("enum"===e?o=[i]:e.match(/^\(.*\)$/)&&(o=e.slice(1,-1).split(",").map((t=>"*"===t[t.length-1]?t.slice(0,-1):t)))),o.filter((e=>!r.includes(e)&&t[e])).reduce(((e,r)=>[...e,...[r,...t[r].reduce(((e,r)=>[...e,...Iz(t,r.type,e,r.contains,n).filter((t=>!e.includes(t)))]),[])].filter((t=>!e.includes(t)))]),[])}function Tz(t,e,r=lp.LEGACY){const i=r===lp.ACTIVE?{...t,..._z[r].presetTypes}:t,[n,...o]=Iz(i,e,void 0,void 0,r),a=n?[n,...o.sort()]:[],s=_z[r].escapeTypeString;return a.map((t=>{const e=i[t].map((t=>{const e="enum"===t.type&&r===lp.ACTIVE?t.contains:t.type,i=e.match(/^\(.*\)$/)?`(${e.slice(1,-1).split(",").map((t=>t?s(t):t)).join(",")})`:s(e);return`${s(t.name)}:${i}`}));return`${s(t)}(${e})`})).join("")}function Cz(t,e,r=lp.LEGACY){return hI(Tz(t,e,r))}function zz(t,e,r,i={},n=lp.LEGACY){if(t[e])return[e,Rz(t,e,r,n)];if(_z[n].presetTypes[e])return[e,Rz(_z[n].presetTypes,e,r,n)];if(e.endsWith("*")){const i=r.map((r=>zz(t,e.slice(0,-1),r,void 0,n)[1]));return[e,_z[n].hashMethod(i)]}switch(e){case"enum":if(n===lp.ACTIVE){const[o,a]=Object.entries(r)[0],s=t[i.parent].find((t=>t.name===i.key)),h=t[s.contains],u=h.find((t=>t.name===o)),l=h.indexOf(u),c=u.type.slice(1,-1).split(",").map(((e,r)=>{if(!e)return e;const i=a[r];return zz(t,e,i,void 0,n)[1]}));return[e,_z[n].hashMethod([l,...c])]}return[e,jz(r)];case"merkletree":{const e=function(t,e){if(e.parent&&e.key){const r=t[e.parent].find((t=>t.name===e.key));if(!Nz(r))throw new Error(`${e.key} is not a merkle tree`);if(r.contains.endsWith("*"))throw new Error(`Merkle tree contain property must not be an array but was given ${e.key}`);return r.contains}return"raw"}(t,i),o=r.map((r=>zz(t,e,r,void 0,n)[1])),{root:a}=new bz(o,_z[n].hashMerkleMethod);return["felt",a]}case"selector":return["felt",Sz(r)];case"string":if(n===lp.ACTIVE){const t=_I(r),i=[t.data.length,...t.data,t.pending_word,t.pending_word_len];return[e,_z[n].hashMethod(i)]}return[e,jz(r)];case"i128":if(n===lp.ACTIVE){const t=BigInt(r);return Ez(t,e,qS),[e,jz(t<0n?DS+t:t)]}return[e,jz(r)];case"timestamp":case"u128":return n===lp.ACTIVE&&Ez(r,e,VS),[e,jz(r)];case"felt":case"shortstring":return n===lp.ACTIVE&&Ez(jz(r),e,FS),[e,jz(r)];case"ClassHash":case"ContractAddress":return n===lp.ACTIVE&&Ez(r,e,FS),[e,jz(r)];case"bool":return n===lp.ACTIVE&&CN(PN(r),`Type mismatch for ${e} ${r}`),[e,jz(r)];default:if(n===lp.ACTIVE)throw new Error(`Unsupported type: ${e}`);return[e,jz(r)]}}function Oz(t,e,r,i=lp.LEGACY){const n=t[e]??_z[i].presetTypes[e],[o,a]=n.reduce((([n,o],a)=>{if(void 0===r[a.name]||null===r[a.name]&&"enum"!==a.type)throw new Error(`Cannot encode data: missing data for '${a.name}'`);const s=r[a.name],h={parent:e,key:a.name},[u,l]=zz(t,a.type,s,h,i);return[[...n,u],[...o,l]]}),[["felt"],[Cz(t,e,i)]]);return[o,a]}function Rz(t,e,r,i=lp.LEGACY){return _z[i].hashMethod(Oz(t,e,r,i)[1])}function Pz(t,e){if(!xz(t))throw new Error("Typed data does not match JSON schema");const r=Az(t),{domain:i,hashMethod:n}=_z[r];return n([bI("StarkNet Message"),Rz(t.types,i,t.domain,r),e,Rz(t.types,t.primaryType,t.message,r)])}function Bz(t,e,r,i){const n=xz(t);if(!oI(t)&&!n)throw new Error("message has a wrong format.");if(n&&void 0===i)throw new Error("When providing a TypedData in message parameter, the accountAddress parameter has to be provided.");if(n&&!oI(i))throw new Error("accountAddress shall be a BigNumberish");const o=n?Pz(t,i):FN(t);return Sv(Array.isArray(e)?new Tv(BigInt(e[0]),BigInt(e[1])):e,o,FN(r))}var Dz=class{responseParser;channel;constructor(t){t&&"channel"in t?(this.channel=t.channel,this.responseParser="responseParser"in t?t.responseParser:new yz):(this.channel=new gz({...t,waitMode:!1}),this.responseParser=new yz(t?.feeMarginPercentage))}fetch(t,e,r=0){return this.channel.fetch(t,e,r)}async getChainId(){return this.channel.getChainId()}async getSpecVersion(){return this.channel.getSpecVersion()}async getNonceForAddress(t,e){return this.channel.getNonceForAddress(t,e)}async getBlock(t){return this.channel.getBlockWithTxHashes(t).then(this.responseParser.parseGetBlockResponse)}async getBlockLatestAccepted(){return this.channel.getBlockLatestAccepted()}async getBlockNumber(){return this.channel.getBlockNumber()}async getBlockWithTxHashes(t){return this.channel.getBlockWithTxHashes(t)}async getBlockWithTxs(t){return this.channel.getBlockWithTxs(t)}async waitForBlock(t="pending",e=5e3){if(t===MN.LATEST)return;const r=await this.getBlockNumber(),i=t===MN.PENDING?r+1:Number(FN(t));if(i<=r)return;const{retries:n}=this.channel;let o=n,a=!1;for(;!a;){if(await this.getBlockNumber()===i?a=!0:await ZC(e),o-=1,o<=0)throw new Error(`waitForBlock() timed-out after ${n} tries.`)}}async getL1GasPrice(t){return this.channel.getBlockWithTxHashes(t).then(this.responseParser.parseL1GasPriceResponse)}async getL1MessageHash(t){const e=await this.channel.getTransactionByHash(t);CN("L1_HANDLER"===e.type,"This L2 transaction is not a L1 message.");const{calldata:r,contract_address:i,entry_point_selector:n,nonce:o}=e;return lI([r[0],i,o,n,r.length-1,...r.slice(1)])}async getBlockWithReceipts(t){if(this.channel instanceof aN.RpcChannel)throw new mN("Unsupported method for RPC version");return this.channel.getBlockWithReceipts(t)}getStateUpdate=this.getBlockStateUpdate;async getBlockStateUpdate(t){return this.channel.getBlockStateUpdate(t)}async getBlockTransactionsTraces(t){return this.channel.getBlockTransactionsTraces(t)}async getBlockTransactionCount(t){return this.channel.getBlockTransactionCount(t)}async getPendingTransactions(){const{transactions:t}=await this.getBlockWithTxHashes(MN.PENDING).then(this.responseParser.parseGetBlockResponse);return Promise.all(t.map((t=>this.getTransactionByHash(t))))}async getTransaction(t){return this.channel.getTransactionByHash(t)}async getTransactionByHash(t){return this.channel.getTransactionByHash(t)}async getTransactionByBlockIdAndIndex(t,e){return this.channel.getTransactionByBlockIdAndIndex(t,e)}async getTransactionReceipt(t){const e=await this.channel.getTransactionReceipt(t),r=this.responseParser.parseTransactionReceipt(e);return new wz(r)}async getTransactionTrace(t){return this.channel.getTransactionTrace(t)}async getTransactionStatus(t){return this.channel.getTransactionStatus(t)}async getSimulateTransaction(t,e){return this.channel.simulateTransaction(t,e).then((t=>this.responseParser.parseSimulateTransactionResponse(t)))}async waitForTransaction(t,e){const r=await this.channel.waitForTransaction(t,e);return new wz(r)}async getStorageAt(t,e,r){return this.channel.getStorageAt(t,e,r)}async getClassHashAt(t,e){return this.channel.getClassHashAt(t,e)}async getClassByHash(t){return this.getClass(t)}async getClass(t,e){return this.channel.getClass(t,e).then(this.responseParser.parseContractClassResponse)}async getClassAt(t,e){return this.channel.getClassAt(t,e).then(this.responseParser.parseContractClassResponse)}async getContractVersion(t,e,{blockIdentifier:r=this.channel.blockIdentifier,compiler:i=!0}={}){let n;if(t)n=await this.getClassAt(t,r);else{if(!e)throw Error("getContractVersion require contractAddress or classHash");n=await this.getClass(e,r)}if(LC(n)){if(i){return{cairo:"1",compiler:sT(n.abi).compiler}}return{cairo:"1",compiler:void 0}}return{cairo:"0",compiler:"0"}}async getEstimateFee(t,e,r,i){return this.getInvokeEstimateFee(t,e,r,i)}async getInvokeEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:yN.INVOKE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeclareEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:yN.DECLARE,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getDeployAccountEstimateFee(t,e,r,i){return this.channel.getEstimateFee([{type:yN.DEPLOY_ACCOUNT,...t,...e}],{blockIdentifier:r,skipValidate:i}).then((t=>this.responseParser.parseFeeEstimateResponse(t)))}async getEstimateFeeBulk(t,e){return this.channel.getEstimateFee(t,e).then((t=>this.responseParser.parseFeeEstimateBulkResponse(t)))}async invokeFunction(t,e){return this.channel.invoke(t,e)}async declareContract(t,e){return this.channel.declare(t,e)}async deployAccountContract(t,e){return this.channel.deployAccount(t,e)}async callContract(t,e){return this.channel.callContract(t,e)}async estimateMessageFee(t,e){return this.channel.estimateMessageFee(t,e)}async getSyncingStats(){return this.channel.getSyncingStats()}async getEvents(t){return this.channel.getEvents(t)}async verifyMessageInStarknet(t,e,r,i,n){const o=xz(t);if(!oI(t)&&!o)throw new Error("message has a wrong format.");if(!oI(r))throw new Error("accountAddress shall be a BigNumberish");const a=o?Pz(t,r):FN(t),s=i?[i]:["isValidSignature","is_valid_signature"],h=n||{okResponse:[],nokResponse:["0x0","0x00"],error:["argent/invalid-signature","is invalid, with respect to the public key","INVALID_SIG"]};let u;for(const t of s)try{const i=await this.callContract({contractAddress:FN(r),entrypoint:t,calldata:$T.compile({hash:UN(a).toString(),signature:NC(e)})});if(h.nokResponse.includes(i[0].toString()))return!1;if(0===h.okResponse.length||h.okResponse.includes(i[0].toString()))return!0;throw Error("signatureVerificationResponse Error: response is not part of known responses")}catch(t){if(h.error.some((e=>t.message.includes(e))))return!1;u=t}throw Error(`Signature verification Error: ${u}`)}async isClassDeclared(t,e){let r;if(!t.classHash&&"contract"in t){r=function(t){const e={...t};if(LC(t.contract)&&(!t.compiledClassHash&&t.casm&&(e.compiledClassHash=kC(t.casm)),!e.compiledClassHash))throw new Error("Extract compiledClassHash failed, provide (CairoAssembly).casm file or compiledClassHash");if(e.classHash=t.classHash??EC(t.contract),!e.classHash)throw new Error("Extract classHash failed, provide (CompiledContract).json file or classHash");return e}(t).classHash}else{if(!t.classHash)throw Error("contractClassIdentifier type not satisfied");r=t.classHash}try{return await this.getClass(r,e)instanceof Object}catch(t){if(t instanceof mN)return!1;throw t}}async prepareInvocations(t){const e=[];for(const r of t)if(r.type===yN.DECLARE){await this.isClassDeclared("payload"in r?r.payload:r)||e.unshift(r)}else e.push(r);return e}};Xx({},{StarknetIdContract:()=>Kz,StarknetIdIdentityContract:()=>Wz,StarknetIdMulticallContract:()=>Qz,StarknetIdPfpContract:()=>rO,StarknetIdPopContract:()=>nO,StarknetIdVerifierContract:()=>tO,dynamicCallData:()=>hO,dynamicFelt:()=>sO,execution:()=>aO,getStarknetIdContract:()=>Jz,getStarknetIdIdentityContract:()=>Yz,getStarknetIdMulticallContract:()=>Xz,getStarknetIdPfpContract:()=>iO,getStarknetIdPopContract:()=>oO,getStarknetIdVerifierContract:()=>eO,isStarkDomain:()=>uO,useDecoded:()=>Gz,useEncoded:()=>Zz});var $z="abcdefghijklmnopqrstuvwxyz0123456789-",Lz=BigInt($z.length+1),Uz="这来",Fz=BigInt($z.length),qz=BigInt(Uz.length),Vz=BigInt(Uz.length+1);function Hz(t){let e=0;for(;t.endsWith(Uz[Uz.length-1]);)t=t.substring(0,t.length-1),e+=1;return[t,e]}function Gz(t){let e="";return t.forEach((t=>{for(;t!==OS;){const r=t%Lz;if(t/=Lz,r===BigInt($z.length)){const r=t/Vz;if(r===OS){const i=t%Vz;t=r,e+=i===OS?$z[0]:Uz[Number(i)-1]}else{e+=Uz[Number(t%qz)],t/=qz}}else e+=$z[Number(r)]}const[r,i]=Hz(e);i&&(e=r+(i%2==0?Uz[Uz.length-1].repeat(i/2-1)+Uz[0]+$z[1]:Uz[Uz.length-1].repeat((i-1)/2+1))),e+="."})),e?e.concat("stark"):e}function Zz(t){let e=BigInt(0),r=BigInt(1);if(t.endsWith(Uz[0]+$z[1])){const[e,r]=Hz(t.substring(0,t.length-2));t=e+Uz[Uz.length-1].repeat(2*(r+1))}else{const[e,r]=Hz(t);r&&(t=e+Uz[Uz.length-1].repeat(1+2*(r-1)))}for(let i=0;i<t.length;i+=1){const n=t[i],o=$z.indexOf(n),a=BigInt($z.indexOf(n));if(-1!==o)i===t.length-1&&t[i]===$z[0]?(e+=r*Fz,r*=Lz,r*=Lz):(e+=r*a,r*=Lz);else if(-1!==Uz.indexOf(n)){e+=r*Fz,r*=Lz;const o=(i===t.length-1?1:0)+Uz.indexOf(n);e+=r*BigInt(o),r*=qz}}return e}var Kz={MAINNET:"0x6ac597f8116f886fa1c97a23fa4e08299975ecaf6b598873ca6792b9bbfb678",TESTNET_SEPOLIA:"0x154bc2e1af9260b9e66af0e9c46fc757ff893b3ff6a85718a810baf1474"};function Jz(t){switch(t){case"0x534e5f4d41494e":return Kz.MAINNET;case"0x534e5f5345504f4c4941":return Kz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id is not yet deployed on this network")}}var Wz={MAINNET:"0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af",TESTNET_SEPOLIA:"0x3697660a0981d734780731949ecb2b4a38d6a58fc41629ed611e8defda"};function Yz(t){switch(t){case"0x534e5f4d41494e":return Wz.MAINNET;case"0x534e5f5345504f4c4941":return Wz.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var Qz="0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970";function Xz(t){switch(t){case"0x534e5f4d41494e":case"0x534e5f5345504f4c4941":return Qz;default:throw new Error("Starknet.id multicall contract is not yet deployed on this network")}}var tO={MAINNET:"0x07d14dfd8ee95b41fce179170d88ba1f0d5a512e13aeb232f19cfeec0a88f8bf",TESTNET_SEPOLIA:"0x60B94fEDe525f815AE5E8377A463e121C787cCCf3a36358Aa9B18c12c4D566"};function eO(t){switch(t){case"0x534e5f4d41494e":return tO.MAINNET;case"0x534e5f5345504f4c4941":return tO.TESTNET_SEPOLIA;default:throw new Error("Starknet.id verifier contract is not yet deployed on this network")}}var rO={MAINNET:"0x070aaa20ec4a46da57c932d9fd89ca5e6bb9ca3188d3df361a32306aff7d59c7",TESTNET_SEPOLIA:"0x9e7bdb8dabd02ea8cfc23b1d1c5278e46490f193f87516ed5ff2dfec02"};function iO(t){switch(t){case"0x534e5f4d41494e":return rO.MAINNET;case"0x534e5f5345504f4c4941":return rO.TESTNET_SEPOLIA;default:throw new Error("Starknet.id profile picture verifier contract is not yet deployed on this network")}}var nO={MAINNET:"0x0293eb2ba9862f762bd3036586d5755a782bd22e6f5028320f1d0405fd47bff4",TESTNET_SEPOLIA:"0x15ae88ae054caa74090b89025c1595683f12edf7a4ed2ad0274de3e1d4a"};function oO(t){switch(t){case"0x534e5f4d41494e":return nO.MAINNET;case"0x534e5f5345504f4c4941":return nO.TESTNET_SEPOLIA;default:throw new Error("Starknet.id proof of personhood verifier contract is not yet deployed on this network")}}function aO(t,e,r){return new dT({Static:t,IfEqual:e?lT(e[0],e[1],e[2]):void 0,IfNotEqual:r?lT(r[0],r[1],r[2]):void 0})}function sO(t,e){return new dT({Hardcoded:t,Reference:e?lT(e[0],e[1]):void 0})}function hO(t,e,r){return new dT({Hardcoded:t,Reference:e?lT(e[0],e[1]):void 0,ArrayReference:r?lT(r[0],r[1]):void 0})}function uO(t){return/^(?:[a-z0-9-]{1,48}(?:[a-z0-9-]{1,48}[a-z0-9-])?\.)*[a-z0-9-]{1,48}\.stark$/.test(t)}var lO=class extends(Zx(Dz,class t{async getStarkName(e,r){return t.getStarkName(this,e,r)}async getAddressFromStarkName(e,r){return t.getAddressFromStarkName(this,e,r)}async getStarkProfile(e,r,i,n,o,a,s){return t.getStarkProfile(this,e,r,i,n,o,a,s)}static async getStarkName(t,e,r){const i=await t.getChainId(),n=r??Jz(i);try{const r=await t.callContract({contractAddress:n,entrypoint:"address_to_domain",calldata:$T.compile({address:e,hint:[]})}),i=Gz(r.map((t=>BigInt(t))).slice(1));if(!i)throw Error("Starkname not found");return i}catch(t){if(t instanceof Error&&"Starkname not found"===t.message)throw t;throw Error("Could not get stark name")}}static async getAddressFromStarkName(t,e,r){const i=e.endsWith(".stark")?e:`${e}.stark`;if(!uO(i))throw new Error("Invalid domain, must be a valid .stark domain");const n=await t.getChainId(),o=r??Jz(n);try{const e=i.replace(".stark","").split(".").map((t=>Zz(t).toString(10)));return(await t.callContract({contractAddress:o,entrypoint:"domain_to_address",calldata:$T.compile({domain:e,hint:[]})}))[0]}catch{throw Error("Could not get address from stark name")}}static async getStarkProfile(t,e,r,i,n,o,a,s){const h=await t.getChainId(),u=r??Jz(h),l=i??Yz(h),c=n??eO(h),d=o??iO(h),f=a??oO(h),m=s??Xz(h);try{const r=[{execution:aO({}),to:hO(u),selector:hO(hI("address_to_domain")),calldata:[hO(e),hO("0")]},{execution:aO({}),to:sO(u),selector:sO(hI("domain_to_id")),calldata:[hO(void 0,void 0,[0,0])]},{execution:aO({}),to:sO(l),selector:sO(hI("get_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("twitter")),hO(c),hO("0")]},{execution:aO({}),to:sO(l),selector:sO(hI("get_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("github")),hO(c),hO("0")]},{execution:aO({}),to:sO(l),selector:sO(hI("get_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("discord")),hO(c),hO("0")]},{execution:aO({}),to:sO(l),selector:sO(hI("get_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("proof_of_personhood")),hO(f),hO("0")]},{execution:aO({}),to:sO(l),selector:sO(hI("get_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("nft_pp_contract")),hO(d),hO("0")]},{execution:aO({}),to:sO(l),selector:sO(hI("get_extended_verifier_data")),calldata:[hO(void 0,[1,0]),hO(bI("nft_pp_id")),hO("2"),hO(d),hO("0")]},{execution:aO(void 0,void 0,[6,0,0]),to:sO(void 0,[6,0]),selector:sO(hI("tokenURI")),calldata:[hO(void 0,[7,1]),hO(void 0,[7,2])]}],i=await t.callContract({contractAddress:m,entrypoint:"aggregate",calldata:$T.compile({calls:r})});if(Array.isArray(i)){const t=parseInt(i[0],16),e=[];let r=1;for(let n=0;n<t&&r<i.length;n+=1){const t=parseInt(i[r],16);r+=1;const n=i.slice(r,r+t);e.push(n),r+=t}const n=Gz(e[0].slice(1).map((t=>BigInt(t)))),o="0x0"!==e[2][0]?BigInt(e[2][0]).toString():void 0,a="0x0"!==e[3][0]?BigInt(e[3][0]).toString():void 0,s="0x0"!==e[4][0]?BigInt(e[4][0]).toString():void 0,h="0x1"===e[5][0],u="0x9"===i[0]?e[8].slice(1).map((t=>kI(t))).join(""):void 0;return{name:n,twitter:o,github:a,discord:s,proofOfPersonhood:h,profilePicture:u||`https://starknet.id/api/identicons/${BigInt(e[1][0]).toString()}`}}throw Error("Error while calling aggregate function")}catch(t){if(t instanceof Error)throw t;throw Error("Could not get user stark profile data from address")}}})){},cO=new Dz({default:!0}),dO={};function fO(t){return new zI(t).toBigInt()}function mO(t){return zI.is(t)}function pO(t){return new zI(t).toUint256HexString()}function gO(t){const e=function(t){const e=FN(jS(t.toString()));return jS(AS(e).padStart(64,"0"))}(t);if(!e.match(/^(0x)?[0-9a-fA-F]{64}$/))throw new Error("Invalid Address Format");return KN(e,OS,LS-1n,"Starknet Address"),e}Xx(dO,{UINT_128_MAX:()=>jI,UINT_256_MAX:()=>xI,bnToUint256:()=>pO,isUint256:()=>mO,uint256ToBN:()=>fO});function yO(t){return"event"===t.type}function wO(t){const e=t.filter((t=>yO(t)&&"struct"===t.kind)),r=t.filter((t=>yO(t)&&"enum"===t.kind)),i=e.reduce(((t,e)=>{let i=[],{name:n}=e,o=!1;const a=t=>t.type===n;for(;;){const t=r.find((t=>t.variants.some(a)));if(ON(t))break;const e=t.variants.find(a);i.unshift(e.name),"flat"===e.kind&&(o=!0),n=t.name}if(0===i.length)throw new Error("inconsistency in ABI events definition.");o&&(i=[i[i.length-1]]);const s=i.pop();let h={[jS(Gv(bS(s)).toString(16))]:e};for(;i.length>0;)h={[jS(Gv(bS(i.pop())).toString(16))]:h};return h={...h},bO(t,h)}),{});return i}function vO(t){return oT(t)?wO(t):function(t){return t.filter((t=>"event"===t.type)).reduce(((t,e)=>{const r=e.name,i={...e};return i.name=r,{...t,[jS(Gv(bS(r)).toString(16))]:i}}),{})}(t)}function bO(t,e){const r={...t};return $N(t)&&$N(e)&&Object.keys(e).forEach((i=>{$N(e[i])?i in t?r[i]=bO(t[i],e[i]):Object.assign(r,{[i]:e[i]}):Object.assign(r,{[i]:e[i]})})),r}function kO(t,e,r,i){const n=t.flat().reduce(((t,n)=>{let o=e[n.keys.shift()??0];if(!o)return t;for(;!o.name;){const t=n.keys.shift();CN(!!t,'Not enough data in "keys" property of this event.'),o=o[t]}const a={};a[o.name]={};const s=n.keys[Symbol.iterator](),h=n.data[Symbol.iterator](),u=o.members?.filter((t=>"key"===t.kind))||o.keys,l=o.members?.filter((t=>"data"===t.kind))||o.data;return u.forEach((t=>{a[o.name][t.name]=IT(s,t,r,i,a[o.name])})),l.forEach((t=>{a[o.name][t.name]=IT(h,t,r,i,a[o.name])})),"block_hash"in n&&(a.block_hash=n.block_hash),"block_number"in n&&(a.block_number=n.block_number),"transaction_hash"in n&&(a.transaction_hash=n.transaction_hash),t.push(a),t}),[]);return n}function MO(t){if(!t.events?.length)throw new Error("UDC emitted event is empty");const e=t.events.find((t=>ZN(t.from_address)===ZN(WS.ADDRESS)))||{data:[]};return{transaction_hash:t.transaction_hash,contract_address:e.data[0],address:e.data[0],deployer:e.data[1],unique:e.data[2],classHash:e.data[3],calldata_len:e.data[4],calldata:e.data.slice(5,5+parseInt(e.data[4],16)),salt:e.data[e.data.length-1]}}Xx({},{getAbiEvents:()=>vO,isAbiEvent:()=>yO,parseEvents:()=>kO,parseUDCEvent:()=>MO});function _O(t){const e=t.calldata??[],r=Array.isArray(e)?e:$T.compile(e);return{to:t.contractAddress,selector:hI(t.entrypoint),calldata:r}}function EO(t,e){const r=_O(t);return"1"===e?{...r,calldata_len:r.calldata.length,calldata:r.calldata}:{To:r.to,Selector:r.selector,Calldata:r.calldata}}function AO(t,e){return{name:"Account.execute_from_outside",version:e,chainId:t,..."2"===e?{revision:"1"}:{}}}function jO(t,e,r,i,n){return"1"===n?{types:SN,primaryType:"OutsideExecution",domain:AO(t,n),message:{...e,nonce:r,calls_len:i.length,calls:i.map((t=>EO(t,n)))}}:{types:NN,primaryType:"OutsideExecution",domain:AO(t,n),message:{Caller:e.caller,Nonce:r,"Execute After":e.execute_after,"Execute Before":e.execute_before,Calls:i.map((t=>EO(t,n)))}}}function xO(t){const e=t.outsideExecution,r=NC(t.signature);return $T.compile({outside_execution:e,signature:r})}function SO(t){return(Array.isArray(t)?t:[t]).map((t=>{let e;if("1"===t.version)e="execute_from_outside";else{if("2"!==t.version)throw new Error("Unsupported OutsideExecution version");e="execute_from_outside_v2"}return{contractAddress:FN(t.signerAddress),entrypoint:e,calldata:xO(t)}}))}Xx({},{buildExecuteFromOutsideCall:()=>SO,buildExecuteFromOutsideCallData:()=>xO,getOutsideCall:()=>_O,getTypedData:()=>jO});async function NO(t,e,r){const i={contractAddress:FN(e),entrypoint:"supports_interface",calldata:[FN(r)]};try{const e=await t.callContract(i);return 0n!==BigInt(e[0])}catch{return!1}}Xx({},{supportsInterface:()=>NO});function IO(t,e=!1){return t.request({type:"wallet_requestAccounts",params:{silent_mode:e}})}function TO(t){return t.request({type:"wallet_getPermissions"})}function CO(t,e){return t.request({type:"wallet_watchAsset",params:e})}function zO(t,e){return t.request({type:"wallet_addStarknetChain",params:e})}function OO(t,e){return t.request({type:"wallet_switchStarknetChain",params:{chainId:e}})}function RO(t){return t.request({type:"wallet_requestChainId"})}function PO(t){return t.request({type:"wallet_deploymentData"})}function BO(t,e){return t.request({type:"wallet_addInvokeTransaction",params:e})}function DO(t,e){return t.request({type:"wallet_addDeclareTransaction",params:e})}function $O(t,e){return t.request({type:"wallet_signTypedData",params:e})}function LO(t){return t.request({type:"wallet_supportedSpecs"})}function UO(t,e){t.on("accountsChanged",e)}function FO(t,e){t.on("networkChanged",e)}Xx({},{addDeclareTransaction:()=>DO,addInvokeTransaction:()=>BO,addStarknetChain:()=>zO,deploymentData:()=>PO,getPermissions:()=>TO,onAccountChange:()=>UO,onNetworkChanged:()=>FO,requestAccounts:()=>IO,requestChainId:()=>RO,signMessage:()=>$O,supportedSpecs:()=>LO,switchStarknetChain:()=>OO,watchAsset:()=>CO});var qO=t=>{const e=t[t.length-1];return"object"==typeof e&&["blockIdentifier","parseRequest","parseResponse","formatResponse","maxFee","nonce","signature","addressSalt"].some((t=>t in e))?{args:t,options:t.pop()}:{args:t}};function VO(t,e){return async function(...r){const i=qO(r);return t.call(e.name,i.args,{parseRequest:!0,parseResponse:!0,...i.options})}}function HO(t,e){return"view"===e.stateMutability||"view"===e.state_mutability?VO(t,e):function(t,e){return async function(...r){const i=qO(r);return t.invoke(e.name,i.args,{parseRequest:!0,...i.options})}}(t,e)}function GO(t,e){return function(...r){return t.estimate(e.name,r)}}function ZO(t,e){return Array.isArray(t)&&"__compiled__"in t?t:Array.isArray(t)&&Array.isArray(t[0])&&"__compiled__"in t[0]?t[0]:e()}var KO=class{abi;address;providerOrAccount;deployTransactionHash;structs;events;functions;callStatic;populateTransaction;estimateFee;callData;constructor(t,e,r=cO){this.address=e&&e.toLowerCase(),this.providerOrAccount=r,this.callData=new $T(t),this.structs=$T.getAbiStruct(t),this.events=vO(t);const i=bT(t);this.abi=i.getLegacyFormat();const n={enumerable:!0,value:{},writable:!1};Object.defineProperties(this,{functions:{enumerable:!0,value:{},writable:!1},callStatic:{enumerable:!0,value:{},writable:!1},populateTransaction:{enumerable:!0,value:{},writable:!1},estimateFee:{enumerable:!0,value:{},writable:!1}}),this.abi.forEach((t=>{if("function"!==t.type)return;const e=t.name;var r,i;this[e]||Object.defineProperty(this,e,{...n,value:HO(this,t)}),this.functions[e]||Object.defineProperty(this.functions,e,{...n,value:HO(this,t)}),this.callStatic[e]||Object.defineProperty(this.callStatic,e,{...n,value:VO(this,t)}),this.populateTransaction[e]||Object.defineProperty(this.populateTransaction,e,{...n,value:(r=this,i=t,function(...t){return r.populate(i.name,t)})}),this.estimateFee[e]||Object.defineProperty(this.estimateFee,e,{...n,value:GO(this,t)})}))}attach(t){this.address=t}connect(t){this.providerOrAccount=t}async deployed(){return this.deployTransactionHash&&(await this.providerOrAccount.waitForTransaction(this.deployTransactionHash),this.deployTransactionHash=void 0),this}async call(t,e=[],{parseRequest:r=!0,parseResponse:i=!0,formatResponse:n,blockIdentifier:o}={}){CN(null!==this.address,"contract is not connected to an address");const a=ZO(e,(()=>r?(this.callData.validate(_N.CALL,t,e),this.callData.compile(t,e)):(GC.warn("Call skipped parsing but provided rawArgs, possible malfunction request"),e)));return this.providerOrAccount.callContract({contractAddress:this.address,calldata:a,entrypoint:t},o).then((e=>i?n?this.callData.format(t,e,n):this.callData.parse(t,e):e))}invoke(t,e=[],{parseRequest:r=!0,maxFee:i,nonce:n,signature:o}={}){CN(null!==this.address,"contract is not connected to an address");const a=ZO(e,(()=>r?(this.callData.validate(_N.INVOKE,t,e),this.callData.compile(t,e)):(GC.warn("Invoke skipped parsing but provided rawArgs, possible malfunction request"),e))),s={contractAddress:this.address,calldata:a,entrypoint:t};if("execute"in this.providerOrAccount)return this.providerOrAccount.execute(s,void 0,{maxFee:i,nonce:n});if(!n)throw new Error("Nonce is required when invoking a function without an account");return GC.warn(`Invoking ${t} without an account. This will not work on a public node.`),this.providerOrAccount.invokeFunction({...s,signature:o},{nonce:n})}async estimate(t,e=[]){CN(null!==this.address,"contract is not connected to an address"),ZO(e,(()=>!1))||this.callData.validate(_N.INVOKE,t,e);const r=this.populate(t,e);if("estimateInvokeFee"in this.providerOrAccount)return this.providerOrAccount.estimateInvokeFee(r);throw Error("Contract must be connected to the account contract to estimate")}populate(t,e=[]){const r=ZO(e,(()=>this.callData.compile(t,e)));return{contractAddress:this.address,entrypoint:t,calldata:r}}parseEvents(t){let e;return t.match({success:t=>{const r=t.events?.map((e=>({block_hash:t.block_hash,block_number:t.block_number,transaction_hash:t.transaction_hash,...e}))).filter((t=>ZN(t.from_address)===ZN(this.address)),[])||[];e=kO(r,this.events,this.structs,$T.getAbiEnum(this.abi))},_:()=>{throw Error("This transaction was not successful.")}}),e}isCairo1(){return EI.isCairo1Abi(this.abi)}async getVersion(){return this.providerOrAccount.getContractVersion(this.address)}typedv2(t){return this}},JO={1:{key:"1",name:"Ethereum",chainId:1,network:"homestead",multicall:"0xeefba1e63905ef1d7acba5a8513c70307c1ce441",ensResolvers:["0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63","0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"],ensNameWrapper:"0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401",ensSubgraph:"https://subgrapher.snapshot.org/subgraph/arbitrum/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH",rpc:["https://rpc.ankr.com/eth",{url:"https://api-geth-archive.ankr.com",user:"balancer_user",password:"balancerAnkr20201015"},"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive","https://apis.ankr.com/e62bc219f9c9462b8749defe472d2dc5/6106d4a3ec1d1bcc87ec72158f8fd089/eth/archive/main","https://eth-archival.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://eth-mainnet.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],light:["https://cloudflare-eth.com"],ws:["wss://eth-mainnet.ws.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv"],explorer:{url:"https://etherscan.io",apiUrl:"https://api.etherscan.io"},start:7929876,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},8:{key:"8",name:"Ubiq",chainId:8,network:"Ubiq",multicall:"0x6668750957e4083725926B71C41bDF1434C73262",rpc:["https://rpc.octano.dev"],ws:["wss://ws.octano.dev"],explorer:{url:"https://ubiqscan.io"},start:1,logo:"ipfs://Qmec3HLoN4QhwZAhw4XTi2aN8Wwmcko5hHN22sHARzb9tw"},10:{key:"10",name:"OP Mainnet",chainId:10,network:"OP Mainnet",multicall:"0x35A6Cdb2C9AD4a45112df4a04147EB07dFA01aB7",rpc:["https://opt-mainnet.g.alchemy.com/v2/JzmIL4Q3jBj7it2duxLFeuCa9Wobmm7D"],explorer:{url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io"},start:657806,logo:"ipfs://bafkreifu2remiqfpsb4hgisbwb3qxedrzpwsea7ik4el45znjcf56xf2ku"},19:{key:"19",name:"Songbird Canary-Network",shortName:"Songbird",chainId:19,network:"songbird",multicall:"0x17032Ea9c3a13Ed337665145364c0d2aD1108c91",rpc:["https://songbird-api.flare.network/ext/C/rpc"],explorer:{url:"https://songbird-explorer.flare.network"},start:21807126,logo:"ipfs://QmXyvnrZY8FUxSULfnKKA99sAEkjAHtvhRx5WeHixgaEdu"},24:{key:"24",name:"KardiaChain Mainnet",shortName:"KAI",chainId:24,network:"mainnet",multicall:"0xd9c92F2287B7802A37eC9BEce96Aa65fb5f31E1b",rpc:["https://kai-internal.kardiachain.io"],explorer:{url:"https://explorer.kardiachain.io"},start:8260245,logo:"ipfs://bafkreig73yfyqzbxydv6e3dbj5nks3f57px2iez7tywayey4rilfhhrr34"},25:{key:"25",name:"Cronos",shortName:"Cronos",chainId:25,network:"mainnet",multicall:"0x6F522a3982e8F9A50A2EDc9E46ed1A3aE2B3FD3a",rpc:["https://evm-cronos.crypto.org"],explorer:{url:"https://cronos.crypto.org/explorer"},start:4067,logo:"ipfs://QmfSJbtirJoa3Pt7o5Fdm85wbyw9V1hpzqLr5PQbdnfsAj"},30:{key:"30",name:"RSK",chainId:30,network:"rsk mainnet",multicall:"0x4eeebb5580769ba6d26bfd07be636300076d1831",rpc:["https://public-node.rsk.co"],explorer:{url:"https://explorer.rsk.co"},start:2516442,logo:"ipfs://QmXTwpE1SqoNZmyY4c3fYWy6qUgQELsyWKbgJo2Pg6K6V9"},46:{key:"46",name:"Darwinia Network",shortName:"Darwinia",chainId:46,network:"mainnet",multicall:"0x67f9ae42EaA9a8aBf065D60ec6Ab3C1A11370607",rpc:["https://rpc.darwinia.network"],explorer:{url:"https://darwinia.subscan.io"},start:141853,logo:"ipfs://bafkreicf55maidhx46pyu3mwsshlr43xbewr6tkckkonh4nesbkp7krwkm"},56:{key:"56",name:"BNB Smart Chain",shortName:"BSC",chainId:56,network:"mainnet",multicall:"0x1ee38d535d541c55c9dae27b12edf090c608e6fb",rpc:["https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive","https://rpc.ankr.com/bsc","https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7","https://bsc-private-dataseed1.nariox.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed1.binance.org"],explorer:{url:"https://bscscan.com"},start:461230,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},61:{key:"61",name:"Ethereum Classic",shortName:"Ethereum Classic",chainId:61,network:"mainnet",multicall:"0x51be3a92C56ae7E207C5b5Fd87F7798Ce82C1AC2",rpc:["https://www.ethercluster.com/etc"],explorer:{url:"https://blockscout.com/etc/mainnet"},start:13307544,logo:"ipfs://QmVegc28DvA7LjKUFysab81c9BSuN4wQVDQkRXyAtuEBis"},66:{key:"66",name:"OKExChain",shortName:"OEC Mainnet",chainId:66,network:"oec mainnet",multicall:"0x6EB187d8197Ac265c945b69f3c3064A6f3831866",rpc:["https://exchainrpc.okex.org"],ws:["wss://exchainws.okex.org:8443"],explorer:{url:"https://www.oklink.com/okexchain"},start:5076543,logo:"ipfs://Qmd7dKnNwHRZ4HRCbCXUbkNV7gP28fGqPdjbHtjRtT9sQF"},75:{key:"75",name:"Decimal",shortName:"mainnet",chainId:75,network:"mainnet",multicall:"0x949d1A0757803C51F2EfFFEb5472C861A898B8E8",rpc:[],explorer:{url:"https://explorer.decimalchain.com"},start:16031065,logo:"ipfs://bafkreihkdhbce5rkogl63xegaarlirjrvbfarxbtbf5mqme3s5grvbjyxm"},81:{key:"81",name:"Shibuya Network",shortName:"Shibuya",chainId:81,network:"testnet",testnet:!0,multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shibuya.astar.network:8545"],explorer:{url:"https://blockscout.com/shibuya"},start:856303,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},82:{key:"82",name:"Meter",shortName:"Meter",chainId:82,network:"mainnet",multicall:"0x579De77CAEd0614e3b158cb738fcD5131B9719Ae",rpc:["https://rpc.meter.io"],explorer:{url:"https://scan.meter.io"},start:4992871,logo:"ipfs://QmSZvT9w9eUDvV1YVaq3BKKEbubtNVqu1Rin44FuN4wz11"},97:{key:"97",name:"BNB Smart Chain Testnet",shortName:"BSC Testnet",chainId:97,network:"testnet",testnet:!0,multicall:"0x8b54247c6BAe96A6ccAFa468ebae96c4D7445e46",rpc:["https://data-seed-prebsc-1-s1.binance.org:8545","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/bsc/testnet/archive"],explorer:{url:"https://testnet.bscscan.com"},start:3599656,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},100:{key:"100",name:"Gnosis Chain",shortName:"xDAI",chainId:100,network:"mainnet",multicall:"0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a",rpc:["https://gno.getblock.io/mainnet/6c1d1e6e-75d9-452f-a863-a694bff93d5c/","https://xdai-archive.blockscout.com","https://poa-xdai.gateway.pokt.network/v1/5f76124fb90218002e9ce985","https://rpc.gnosischain.com"],light:["https://rpc.gnosischain.com"],ws:["wss://rpc.xdaichain.com/wss"],explorer:{url:"https://gnosis.blockscout.com"},start:4108192,logo:"ipfs://QmZeiy8Ax4133wzxUQM9ky8z5XFVf6YLFjJMmTWbWVniZR"},108:{key:"108",name:"Thundercore",chainId:108,network:"mainnet",multicall:"0x3017086deef56679e267f67f66c4415109b7a97f",rpc:["https://mainnet-rpc.thundercore.com/archived/SNAPSHOTEuR82a75fLYA"],explorer:{url:"https://viewblock.io/thundercore"},start:94425385,logo:"ipfs://bafkreifc5z5vtvqx2luzgateyvoocwpd2ifv2hwufxdnyl2a767wa6icli"},109:{key:"109",name:"Shibarium",shortName:"mainnet",chainId:109,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://shibariumscan.io"},start:3485946,logo:"ipfs://bafkreig57igai5phg4icywc5yoockd52jo3hlvbkyi6wiufrmu4p2lmenm"},122:{key:"122",name:"Fuse",shortName:"Fuse",chainId:122,network:"mainnet",multicall:"0x7a59441fb06666F6d2D766393d876945D06a169c",rpc:["https://explorer-node.fuse.io/","https://oefusefull1.liquify.info/"],explorer:{url:"https://explorer.fuse.io"},start:11923459,logo:"ipfs://QmXjWb64nako7voaVEifgdjAbDbswpTY8bghsiHpv8yWtb"},137:{key:"137",name:"Polygon PoS",shortName:"Polygon",chainId:137,network:"mainnet",multicall:"0xCBca837161be50EfA5925bB9Cc77406468e76751",rpc:["https://rpc.ankr.com/polygon","https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/polygon/mainnet/archive","https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mainnet/archive","https://rpc-mainnet.maticvigil.com/v1/1cfd7598e5ba6dcf0b4db58e8be484badc6ea08e"],ws:["wss://ws-mainnet.matic.network"],explorer:{url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com"},start:9834491,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},144:{key:"144",name:"PHI Network",shortName:"PHI",chainId:144,network:"mainnet",multicall:"0xc2f41B404a6757863AAeF49ff93039421acCd630",rpc:["https://connect.phi.network"],explorer:{url:"https://phiscan.com"},start:360030,logo:"ipfs://bafkreid6pm3mic7izp3a6zlfwhhe7etd276bjfsq2xash6a4s2vmcdf65a"},146:{key:"146",name:"Sonic",shortName:"mainnet",chainId:146,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.soniclabs.com"},start:60,logo:"ipfs://bafkreic5fffatwy2gzf6y5iymje6ijii43tz4wlxl35da36guurhibjx44"},148:{key:"148",name:"ShimmerEVM",shortName:"ShimmerEVM",chainId:148,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.evm.shimmer.network"},start:1290,logo:"ipfs://bafkreib4xhbgbhrwkmizp4d4nz3wzbpyhdm6wpz2v2pbkk7jxsgg3hdt74"},157:{key:"157",name:"Shibarium Puppynet Testnet",shortName:"testnet",chainId:157,network:"testnet",multicall:"0xA4029b74FBA366c926eDFA7Dd10B21C621170a4c",rpc:[],explorer:{url:"https://puppyscan.shib.io"},start:3035769,logo:"ipfs://bafkreig57igai5phg4icywc5yoockd52jo3hlvbkyi6wiufrmu4p2lmenm",testnet:!0},169:{key:"169",name:"Manta Pacific",shortName:"Manta",chainId:169,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://www.oklink.com/manta"},start:332890,logo:"ipfs://bafkreibbrwgwdcfh755dqh4ndta6tja77qbaa36bfv4pstub6prhhore7a"},204:{key:"204",name:"opBNB",shortName:"mainnet",chainId:204,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"http://opbnbscan.com"},start:512881,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64"},246:{key:"246",name:"Energy Web Chain",shortName:"EWC",chainId:246,network:"mainnet",multicall:"0x0767F26d0D568aB61A98b279C0b28a4164A6f05e",rpc:["https://voting-rpc.carbonswap.exchange"],explorer:{url:"https://explorer.energyweb.org"},start:12086501,logo:"ipfs://Qmai7AGHgs8NpeGeXgbMZz7pS2i4kw44qubCJYGrZW2f3a"},250:{key:"250",name:"Fantom Opera",shortName:"fantom",chainId:250,network:"Mainnet",multicall:"0x7f6A10218264a22B4309F3896745687E712962a0",rpc:["https://rpc.ankr.com/fantom","https://rpc.ftm.tools","https://rpcapi.fantom.network"],explorer:{url:"https://ftmscan.com"},start:2497732,logo:"ipfs://QmVEgNeQDKnXygeGxfY9FywZpNGQu98ktZtRJ9bToYF6g7"},252:{key:"252",name:"Fraxtal",shortName:"mainnet",chainId:252,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://fraxscan.com"},start:1,logo:"ipfs://bafkreieflj4wq6tx7k5kq47z3xnsrdrn2xgm4bxa3uovrnndcb2vqqwlyu"},269:{key:"269",name:"High Performance Blockchain",shortName:"HPB",chainId:269,network:"mainnet",multicall:"0x67D0f263aef2F6167FA77353695D75b582Ff4Bca",rpc:["https://hpbnode.com"],ws:["wss://ws.hpbnode.com"],explorer:{url:"https://hscan.org"},start:13960096,logo:"ipfs://QmU7f1MyRz8rLELFfypnWZQjGbDGYgZtC9rjw47jYMYrnu"},291:{key:"291",name:"Orderly",shortName:"mainnet",chainId:291,network:"mainnet",multicall:"0x73e524d811263a145026113219F13f9133966b6b",rpc:[],explorer:{url:"https://explorer.orderly.network"},start:22457562,logo:"ipfs://bafkreibo62xtgkpam6nm34mau26gn65jlw6npb5odw4ylcd6dkwocea5ni"},296:{key:"296",name:"Hedera Testnet",shortName:"testnet",chainId:296,network:"testnet",multicall:"0xADE3166b0afA89b2CDB64870D70ADeD330Eab015",rpc:[],explorer:{url:"https://hashscan.io/testnet"},start:17561901,logo:"ipfs://bafkreia5gpitwgo4sspvvtwqcxosq2krrqo5dbrnvylgibvmypzotfmbuu",testnet:!0},300:{key:"300",name:"zkSync Sepolia Testnet",shortName:"testnet",chainId:300,network:"testnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:[],explorer:{url:"https://sepolia.explorer.zksync.dev"},start:2292,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy",testnet:!0},314:{key:"314",name:"Filecoin",shortName:"mainnet",chainId:314,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://filfox.io"},start:3328594,logo:"ipfs://bafybeibyvjfmk6aqlfdrczvth55jkmnoadtrch7ht3rdmvqmy2bfxynecm"},321:{key:"321",name:"KCC",shortName:"KCC",chainId:321,network:"mainnet",multicall:"0xa64D6AFb48225BDA3259246cfb418c0b91de6D7a",rpc:["https://rpc-mainnet.kcc.network"],ws:["wss://rpc-ws-mainnet.kcc.network"],explorer:{url:"https://explorer.kcc.io"},start:1487453,logo:"ipfs://QmRdzYGhFRG8QLzMJahHrw3vETE2YZ9sywQbEkenSjKEvb"},324:{key:"324",name:"zkSync Era",shortName:"zkSync-era",chainId:324,network:"zkSync Era Mainnet",multicall:"0xF9cda624FBC7e059355ce98a31693d299FACd963",rpc:["https://mainnet.era.zksync.io"],explorer:{url:"https://explorer.zksync.io"},start:3908235,logo:"ipfs://bafkreih6y7ri7h667cwxe5miisxghfheiidtbw2747y75stoxt3gp3a2yy"},336:{key:"336",name:"Shiden Network",shortName:"Shiden",chainId:336,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://rpc.shiden.astar.network:8545","https://shiden.api.onfinality.io/public"],explorer:{url:"https://blockscout.com/shiden"},start:1170016,logo:"ipfs://QmcqGQE4Sk73zXc3e91TUFFefKBVeaNgbxV141XkSNE4xj"},369:{key:"369",name:"Pulsechain",shortName:"Pulsechain",chainId:369,network:"mainnet",multicall:"0xdbdd0FD8B16F0092f306392b699D7fbddaA9011B",rpc:["https://rpc.pulsechain.com"],explorer:{url:"https://scan.pulsechain.com"},start:17657774,logo:"ipfs://QmWUsiEWdejtHZ9B9981TYXn7Ds8C7fkB1S4h5rP3kCCZR"},416:{key:"416",name:"SX Network",shortName:"SX",chainId:416,network:"mainnet",multicall:"0x834a005DDCF990Ba1a79f259e840e58F2D14F49a",rpc:["https://rpc.sx.technology"],ws:["wss://rpc.sx.technology/ws"],explorer:{url:"https://explorer.sx.technology"},start:2680605,logo:"ipfs://QmSXLXqyr2H6Ja5XrmznXbWTEvF2gFaL8RXNXgyLmDHjAF"},592:{key:"592",name:"Astar Network",shortName:"Astar",chainId:592,network:"mainnet",multicall:"0x3E90A35839ff0Aa32992d33d861f24dC95BBf74d",rpc:["https://astar.api.onfinality.io/public","https://rpc.astar.network:8545"],explorer:{url:"https://blockscout.com/astar"},start:366482,logo:"ipfs://QmZLQVsUqHBDXutu6ywTvcYXDZG2xBstMfHkfJSzUNpZsc"},813:{key:"813",name:"Qitmeer",shortName:"MEER",chainId:813,network:"mainnet",multicall:"0x55034b2cF530ae3A8fC1e2e4523F58496796610F",rpc:["https://evm-dataseed1.meerscan.io","https://evm-dataseed.meerscan.com","https://evm-dataseed2.meerscan.io","https://evm-dataseed3.meerscan.io"],explorer:{url:"https://evm.meerscan.io"},start:43317,logo:"ipfs://QmXvum7SNVaAqAc2jNzR1NpNZN1GGvNaKWydg8a1GEDQ7y"},841:{key:"841",name:"Taraxa",shortName:"841",chainId:841,network:"mainnet",multicall:"0xFCe7a3121B42664AaD145712e1c2Bf2e38f60AA1",rpc:["https://rpc.mainnet.taraxa.io"],ws:["wss://ws.mainnet.taraxa.io"],explorer:{url:"https://mainnet.explorer.taraxa.io"},start:1515906,logo:"ipfs://Qmcc6ZCAGESMzZzoj5LsTVcCo2E35x3Ydk71uPJyov6Mwx"},888:{key:"888",name:"Wanchain",chainId:888,network:"mainnet",multicall:"0xba5934ab3056fca1fa458d30fbb3810c3eb5145f",rpc:["https://gwan-ssl.wandevs.org:56891"],ws:["wss://api.wanchain.org:8443/ws/v3/ddd16770c68f30350a21114802d5418eafe039b722de52b488e7eee1ee2cd73f"],explorer:{url:"https://www.wanscan.org"},start:11302663,logo:"ipfs://QmewFFN44rkxESFsHG8edaLt1znr62hjvZhGynfXqruzX3"},1001:{key:"1001",name:"Kaia Kairos Testnet",shortName:"kaia-kairos",chainId:1001,network:"testnet",testnet:!0,multicall:"0x40643B8Aeaaca0b87Ea1A1E596e64a0e14B1d244",rpc:["https://archive-en-kairos.node.kaia.io"],ws:["wss://archive-en-kairos.node.kaia.io/ws"],explorer:{url:"https://kairos.kaiascan.com"},start:87232478,logo:"ipfs://bafkreifm6l67f4blcv7qwuszalwoxzptt5ad2f3t472lytr3d2hmi626ju"},1072:{key:"1072",name:"Shimmer EVM Testnet",shortName:"ShimmerEVM",chainId:1072,network:"testnet",testnet:!0,multicall:"0x751d21047C116413895c259f3f305e38C10B7cF6",rpc:["https://archive.evm.testnet.shimmer.network/v1/chains/rms1pr75wa5xuepg2hew44vnr28wz5h6n6x99zptk2g68sp2wuu2karywgrztx3/evm"],explorer:{url:"https://explorer.evm.testnet.shimmer.network"},start:10614,logo:"ipfs://bafkreihtwfwrue7klzedwx4rqlk6agklz4lbbk7owsyw6xzn6c2m4t5tgy"},1088:{key:"1088",name:"Metis",shortName:"metis",chainId:1088,network:"mainnet",multicall:"0xc39aBB6c4451089dE48Cffb013c39d3110530e5C",rpc:["https://andromeda.metis.io/?owner=1088"],explorer:{url:"https://andromeda-explorer.metis.io"},start:451,logo:"ipfs://bafkreiaqr4atnjpdnk3c4vu4377ai7bzqpgaefefbl5j5imfsvr4puimtu"},1101:{key:"1101",name:"Polygon zkEVM",shortName:"mainnet",chainId:1101,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://zkevm.polygonscan.com"},start:57746,logo:"ipfs://bafkreibfiyvhqnme2vbxxfcku7qkxgjpkg6ywdkplxh4oxlkqsbznyorfm"},1116:{key:"1116",name:"Core Chain",shortName:"Core",chainId:1116,network:"mainnet",multicall:"0x024f0041b76B598c2A0a75004F8447FaF67BD004",rpc:["https://rpcar.coredao.org/"],explorer:{url:"https://scan.coredao.org"},start:853908,logo:"ipfs://bafkreigjv5yb7uhlrryzib7j2f73nnwqan2tmfnwjdu26vkk365fyesoiu"},1284:{key:"1284",name:"Moonbeam",shortName:"GLMR",chainId:1284,network:"mainnet",multicall:"0x83e3b61886770de2F64AAcaD2724ED4f08F7f36B",rpc:["https://rpc.api.moonbeam.network"],explorer:{url:"https://moonscan.io"},start:171135,logo:"ipfs://QmWKTEK2pj5sBBbHnMHQbWgw6euVdBrk2Ligpi2chrWASk"},1285:{key:"1285",name:"Moonriver (Kusama)",shortName:"Moonriver",chainId:1285,network:"mainnet",multicall:"0x537004440ffFE1D4AE9F009031Fc2b0385FCA9F1",rpc:["https://rpc.api.moonriver.moonbeam.network"],explorer:{url:"https://blockscout.moonriver.moonbeam.network"},start:413539,logo:"ipfs://QmXtgPesL87Ejhq2Y7yxsaPYpf4RcnoTYPJWPcv6iiYhoi"},1287:{key:"1287",name:"Moonbase Alpha TestNet",shortName:"Moonbase",chainId:1287,network:"testnet",testnet:!0,multicall:"0xf09FD6B6FF3f41614b9d6be2166A0D07045A3A97",rpc:["https://rpc.testnet.moonbeam.network"],explorer:{url:"https://moonbase-blockscout.testnet.moonbeam.network"},start:859041,logo:"ipfs://QmeGbNTU2Jqwg8qLTMGW8n8HSi2VdgCncAaeGzLx6gYnD7"},1315:{key:"1315",name:"Story Aeneid Testnet",shortName:"testnet",chainId:1315,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://aeneid.storyscan.io"},start:1792,logo:"ipfs://bafkreiaicdywqkmej6htv4e4lnq5fzajb3qfoxslkrbf5byvqc2aalxcne",testnet:!0},1328:{key:"1328",name:"Sei atlantic testnet",shortName:"testnet",chainId:1328,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://seitrace.com"},start:96978658,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},1329:{key:"1329",name:"Sei",shortName:"mainnet",chainId:1329,network:"mainnet",multicall:"0xe033Bed7cae4114Af84Be1e9F1CA7DEa07Dfe1Cf",rpc:[],explorer:{url:"https://seitrace.com"},start:79164574,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq"},1480:{key:"1480",name:"Vana",shortName:"mainnet",chainId:1480,network:"mainnet",multicall:"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E",rpc:[],explorer:{url:"https://islander.vanascan.io"},start:716763,logo:"ipfs://bafkreibotel3dmc5og5rf3tpt7l74awkene7x6q3oxtwhptt4y4rpa7vsa"},1514:{key:"1514",name:"Story",shortName:"mainnet",chainId:1514,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://www.storyscan.io"},start:340998,logo:"ipfs://bafkreiaicdywqkmej6htv4e4lnq5fzajb3qfoxslkrbf5byvqc2aalxcne"},1559:{key:"1559",name:"Tenet",shortName:"tenet",chainId:1559,network:"mainnet",multicall:"0xcCB3F00bE353950E4C08501ac8Af48765EAAa738",rpc:[],explorer:{url:"https://tenetscan.io"},start:944415,logo:"ipfs://Qmc1gqjWTzNo4pyFSGtQuCu7kRSZZBUVybtTjHn2nNEEPA"},1663:{key:"1663",name:"Horizen Gobi Testnet",shortName:"Gobi",chainId:1663,network:"testnet",testnet:!0,multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:["https://gobi-testnet.horizenlabs.io/ethv1"],explorer:{url:"https://gobi-explorer.horizen.io"},start:1,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},2e3:{key:"2000",name:"Doge Chain",shortName:"dogechain",chainId:2e3,network:"mainnet",multicall:"0x6f9D3f3932B417bd4957585D236Cbc32b32C0BDc",rpc:["https://rpc.dogechain.dog"],explorer:{url:"https://explorer.dogechain.dog"},start:877115,logo:"ipfs://bafkreigovfh3pinsdih777issfgaflwu2yjzroljs2642gbvwikcd3nm4i"},2109:{key:"2109",name:"Exosama Network",shortName:"EXN",chainId:2109,network:"mainnet",multicall:"0x2feFC828e2fEfdE0C9f7740919c6A9139F886067",rpc:["https://rpc.exosama.com"],explorer:{url:"https://explorer.exosama.com"},start:94085,logo:"ipfs://QmaQxfwpXYTomUd24PMx5tKjosupXcm99z1jL1XLq9LWBS"},2152:{key:"2152",name:"Findora",shortName:"Findora",chainId:2152,network:"mainnet",multicall:"0xCF7D1e21CBe9bdEF235aef06C5d8051B3d4DF0f5",rpc:["https://archive.prod.findora.org:8545/"],explorer:{url:"https://evm.findorascan.io"},start:4219343,logo:"ipfs://QmXkneyRB6HbHTHRLCZpZqSsawiyJY7b2kZ2V8ydvKYAgv"},2192:{key:"2192",name:"SnaxChain",shortName:"mainnet",chainId:2192,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.snaxchain.io"},start:1554893,logo:"ipfs://bafkreibzz757piho2llzkbiszpvalf5k5hpmxcwhvrmgp7vpz2vp4vj7ly"},2221:{key:"2221",name:"Kava Testnet",shortName:"testnet",chainId:2221,network:"testnet",multicall:"0xc7193EFE367DF0C9349a1149F4E95A2A35604262",rpc:[],explorer:{url:"https://testnet.kavascan.com"},start:6193104,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4",testnet:!0},2222:{key:"2222",name:"Kava",shortName:"mainnet",chainId:2222,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://kavascan.com"},start:3661165,logo:"ipfs://bafkreibpfubharx32fjqkqbfdhygwdjb2khxdg6meaasrcxsgvowos26f4"},2400:{key:"2400",name:"TCG Verse",shortName:"TCGV",chainId:2400,network:"mainnet",multicall:"0xceC65DEE0b5012F1b7321b2647681F997c7204FC",rpc:["https://rpc.tcgverse.xyz"],explorer:{url:"https://explorer.tcgverse.xyz"},start:57500,logo:"ipfs://bafkreidg4wpewve5mdxrofneqblydkrjl3oevtgpdf3fk3z3vjqam6ocoe"},2522:{key:"2522",name:"Fraxtal Testnet",shortName:"testnet",chainId:2522,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://holesky.fraxscan.com"},start:1,logo:"ipfs://bafkreieflj4wq6tx7k5kq47z3xnsrdrn2xgm4bxa3uovrnndcb2vqqwlyu",testnet:!0},3338:{key:"3338",name:"peaq",shortName:"mainnet",chainId:3338,network:"mainnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://peaq.subscan.io"},start:3525964,logo:"ipfs://bafkreidqkleori7pmilesz4t52iebebaqf3oflzmoz646qfuaznanb3sgm"},4162:{key:"4162",name:"SX Rollup",shortName:"mainnet",chainId:4162,network:"mainnet",multicall:"0x46997eb05F6A6A0bD5C140ABed09Cb02CA36b98c",rpc:[],explorer:{url:"https://explorerl2.sx.technology"},start:1847483,logo:"ipfs://bafkreibjkjx7evbw74e3sx65dtmcdr4g2rrbcorb2ivd6jz6yh6on6ozw4"},4200:{key:"4200",name:"Merlin",shortName:"merlin",chainId:4200,network:"mainnet",multicall:"0x830E7E548F4D80947a40A7Cf3a2a53166a0C3980",rpc:[],explorer:{url:"https://scan.merlinchain.io"},start:589494,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe"},4337:{key:"4337",name:"Beam",shortName:"Beam",chainId:4337,network:"mainnet",multicall:"0x4956F15eFdc3dC16645e90Cc356eAFA65fFC65Ec",rpc:[],explorer:{url:"https://subnets.avax.network/beam"},start:1,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF"},4689:{key:"4689",name:"IoTeX",shortName:"IoTeX",chainId:4689,network:"mainnet",multicall:"0x9c8B105c94282CDB0F3ecF27e3cfA96A35c07be6",rpc:["https://babel-api.mainnet.iotex.io"],explorer:{url:"https://iotexscan.io"},start:11533283,logo:"ipfs://QmNkr1UPcBYbvLp7d7Pk4eF3YCsHpaNkfusKZNtykL2EQC"},5e3:{key:"5000",name:"Mantle",chainId:5e3,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.mantle.xyz"],explorer:{url:"https://mantlescan.xyz"},start:304717,logo:"ipfs://bafkreidkucwfn4mzo2gtydrt2wogk3je5xpugom67vhi4h4comaxxjzoz4"},5555:{key:"5555",name:"Chain Verse",shortName:"ChainVerse",chainId:5555,network:"ChainVerse",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://rpc.chainverse.info"],explorer:{url:"https://explorer.chainverse.info"},start:6334180,logo:"ipfs://QmQyJt28h4wN3QHPXUQJQYQqGiFUD77han3zibZPzHbitk"},5611:{key:"5611",name:"opBNB Testnet",shortName:"testnet",chainId:5611,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://opbnb-testnet.bscscan.com"},start:3705108,logo:"ipfs://bafkreibll4la7wqerzs7zwxjne2j7ayynbg2wlenemssoahxxj5rbt6c64",testnet:!0},6102:{key:"6102",name:"Cascadia Testnet",shortName:"Cascadia",chainId:6102,network:"testnet",multicall:"0x728989819bAD588F193563008E0a03E8cD6a3e4a",rpc:["https://testnet.cascadia.foundation"],explorer:{url:"https://explorer.cascadia.foundation"},testnet:!0,start:370457,logo:"ipfs://QmWkhZYhReYyaa5pQXj32hEGxoRcBqarFMcfQScELmjYQj"},6900:{key:"6900",name:"Animechain Testnet",shortName:"testnet",chainId:6900,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-animechain-testnet-i8yja6a1a0.t.conduit.xyz"},start:1666749,logo:"ipfs://bafkreihm7dy6jzkd3nh6mokq4vshuzwkoeyjmbb3qkskn77rt5iufn7egi",testnet:!0},7332:{key:"7332",name:"Horizen EON",shortName:"EON",chainId:7332,network:"mainnet",multicall:"0xC743e4910Bdd4e5aBacCA38F74cdA270281C5eef",rpc:[],explorer:{url:"https://eon-explorer.horizenlabs.io"},start:85108,logo:"ipfs://QmUYQdsnkUoiDiQ3WaWrtH7fsc5yQDC7kZJCHmC2qWPTPt"},7341:{key:"7341",name:"Shyft",shortName:"Shyft",chainId:7341,network:"mainnet",multicall:"0xceb10e9133D771cA93c8002Be527A465E85381a2",rpc:["https://rpc.shyft.network"],explorer:{url:"https://bx.shyft.network"},start:3673983,logo:"ipfs://bafkreifwxnnfk6koabzmxgcxcwlrwt6b5gijdain2gyqee77q4ajfb7fu4"},7560:{key:"7560",name:"Cyber",shortName:"mainnet",chainId:7560,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://cyberscan.co"},start:1731707,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm"},8217:{key:"8217",name:"Kaia Mainnet",shortName:"kaia-mainnet",chainId:8217,network:"mainnet",multicall:"0x5f5f0d1b9ff8b3dcace308e39b13b203354906e9",rpc:["https://archive-en.node.kaia.io"],ws:["wss://archive-en.node.kaia.io/ws"],explorer:{url:"https://kaiascan.com"},start:91582357,logo:"ipfs://bafkreifm6l67f4blcv7qwuszalwoxzptt5ad2f3t472lytr3d2hmi626ju"},8453:{key:"8453",name:"Base",shortName:"mainnet",chainId:8453,network:"mainnet",multicall:"0xca11bde05977b3631167028862be2a173976ca11",rpc:[],explorer:{url:"https://basescan.org"},start:5022,logo:"ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv"},9001:{key:"9001",name:"Evmos Network",shortName:"Evmos",chainId:9001,network:"mainnet",multicall:"0x37763d16f8dBf6F185368E0f256350cAb7E24b26",rpc:["https://eth.bd.evmos.org:8545"],ws:["wss://eth.bd.evmos.org:8546"],explorer:{url:"https://escan.live"},start:13959539,logo:"ipfs://bafkreif4obrdoiretpozdd56seziywc6clha7wwkbldng3ovry2bpzly34"},9990:{key:"9990",name:"Agung testnet",shortName:"testnet",chainId:9990,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://agung-testnet.subscan.io"},start:2031789,logo:"ipfs://bafkreidqkleori7pmilesz4t52iebebaqf3oflzmoz646qfuaznanb3sgm",testnet:!0},1e4:{key:"10000",name:"smartBCH",shortName:"BCH",chainId:1e4,network:"mainnet",multicall:"0x1b38EBAd553f218e2962Cb1C0539Abb5d6A37774",rpc:["https://smartbch.greyh.at/"],explorer:{url:"https://smartbch-explorer.web.app"},start:268248,logo:"ipfs://QmWG1p7om4hZ4Yi4uQvDpxg4si7qVYhtppGbcDGrhVFvMd"},10243:{key:"10243",name:"Arthera Testnet",shortName:"Arthera_",chainId:10243,network:"testnet",testnet:!0,multicall:"0x27c7FC597aD2E81C4c1cA1769972f79DaF042Da7",rpc:["https://rpc-test.arthera.net"],explorer:{url:"https://explorer-test.arthera.net"},start:10523,logo:"ipfs://QmYQp3e52KjkT4bYdAvB6ACEEpXs2D8DozsDitaADRY2Ak"},13337:{key:"13337",name:"Beam Testnet",shortName:"testnet",chainId:13337,network:"testnet",multicall:"0x9BF49b704EE2A095b95c1f2D4EB9010510c41C9E",rpc:[],explorer:{url:"https://subnets-test.avax.network/beam"},start:3,logo:"ipfs://QmaKRLxXPdeTsLx7MFLS3CJbhpSbResgoeL4fCgHB1mTsF",testnet:!0},13371:{key:"13371",name:"Immutable zkEVM",shortName:"mainnet",chainId:13371,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.immutable.com"},start:3680945,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi"},13473:{key:"13473",name:"Immutable zkEVM Testnet",shortName:"testnet",chainId:13473,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.testnet.immutable.com"},start:5307209,logo:"ipfs://bafkreiepnhfv3hgexddjpyaeemxo3byhtxxit6t4zsponyczee6ddjqxwi",testnet:!0},14800:{key:"14800",name:"Vana Moksha Testnet",shortName:"testnet",chainId:14800,network:"testnet",multicall:"0xD8d2dFca27E8797fd779F8547166A2d3B29d360E",rpc:[],explorer:{url:"https://moksha.vanascan.io"},start:732283,logo:"ipfs://bafkreibotel3dmc5og5rf3tpt7l74awkene7x6q3oxtwhptt4y4rpa7vsa",testnet:!0},16718:{key:"16718",name:"AirDAO",chainId:16718,network:"mainnet",multicall:"0x25e81aC81A8B03389D78CB45faB78353aB528574",rpc:["https://network-archive.ambrosus.io"],ws:["wss://network-archive.ambrosus.io/ws"],explorer:{url:"https://airdao.io/explorer"},start:22922566,logo:"ipfs://QmSxXjvWng3Diz4YwXDV2VqSPgMyzLYBNfkjJcr7rzkxom"},29548:{key:"29548",name:"MCH Verse",shortName:"mainnet",chainId:29548,network:"mainnet",multicall:"0x1d39652386488CE1fE4254E105F5A42a04d43dB2",rpc:[],explorer:{url:"https://explorer.oasys.mycryptoheroes.net"},start:27458402,logo:"ipfs://QmZZnwR1y6cU1sare2TQmwqkNDLXQxD4GdPrmHLmUoPtbU"},33111:{key:"33111",name:"Curtis",shortName:"apechain",chainId:33111,network:"testnet",multicall:"0xc454132B017b55b427f45078E335549A7124f5f7",rpc:[],explorer:{url:"https://curtis.apescan.io"},start:6661339,logo:"ipfs://bafkreicljxttjq2xkgfwwpii5xegirgq2ctrnsjnzelxudjj33qzq65apu",testnet:!0},33139:{key:"33139",name:"ApeChain",shortName:"mainnet",chainId:33139,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://apescan.io"},start:20889,logo:"ipfs://bafkreielbgcox2jsw3g6pqulqb7pyjgx7czjt6ahnibihaij6lozoy53w4"},42161:{key:"42161",name:"Arbitrum One",chainId:42161,network:"Arbitrum mainnet",multicall:"0x7A7443F8c577d537f1d8cD4a629d40a3148Dd7ee",rpc:["https://rpc.ankr.com/arbitrum","https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/arbitrum/mainnet","https://arb-mainnet.g.alchemy.com/v2/JDvtNGwnHhTltIwfnxQocKwKkCTKA1DL"],explorer:{url:"https://arbiscan.io"},start:256508,logo:"ipfs://QmWZ5SMRfvcK8tycsDqojQaSiKedgtVkS7CkZdxPgeCVsZ"},42170:{key:"42170",name:"Arbitrum Nova",chainId:42170,network:"Arbitrum Nova",multicall:"0x4E74EBd9CABff51cE9a43EFe059bA8c5A28E4A14",rpc:["https://nova.arbitrum.io/rpc","https://arbitrum-nova.public.blastapi.io"],explorer:{url:"https://nova.arbiscan.io"},start:6006607,logo:"ipfs://bafkreie5xsqt3mrrwu7v32qpmmctibhzhgxf4emfzzddsdhdlfsa7fmplu"},42220:{key:"42220",name:"Celo",shortName:"Celo",chainId:42220,network:"mainnet",multicall:"0xb8d0d2C1391eeB350d2Cd39EfABBaaEC297368D9",rpc:["https://celo.snapshot.org","https://forno.celo.org","https://celo-mainnet--rpc.datahub.figment.io/apikey/e892a66dc36e4d2d98a5d6406d609796/"],explorer:{url:"https://explorer.celo.org"},start:6599803,logo:"ipfs://QmS2tVJ7rdJRe1NHXAi2L86yCbUwVVrmB2mHQeNdJxvQti"},43113:{key:"43113",name:"Avalanche FUJI Testnet",chainId:43113,network:"testnet",testnet:!0,multicall:"0x984476ea55e32e785A9D8FF14329f99D74E3d2A2",rpc:["https://api.avax-test.network/ext/bc/C/rpc"],explorer:{url:"https://testnet.snowtrace.io"},start:10528153,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},43114:{key:"43114",name:"Avalanche",chainId:43114,network:"mainnet",multicall:"0x7E9985aE4C8248fdB07607648406a48C76e9e7eD",rpc:["https://nd-784-543-849.p2pify.com/aa7b29fc5fed65b34f0ee6b8de33f8c0/ext/bc/C/rpc","https://rpc.ankr.com/avalanche","https://api.avax.network/ext/bc/C/rpc"],explorer:{url:"https://snowtrace.io"},start:536483,logo:"ipfs://QmeS75uS7XLR8o8uUzhLRVYPX9vMFf4DXgKxQeCzyy7vM2"},47805:{key:"47805",name:"REI Mainnet",chainId:47805,network:"mainnet",multicall:"0x9eE9904815B80C39C1a27294E69a8626EAa7952d",rpc:["https://rpc.rei.network"],explorer:{url:"https://scan.rei.network"},start:1715902,logo:"ipfs://QmTogMDLmDgJjDjUKDHDuc2KVTVDbXf8bXJLFiVe8PRxgo"},53935:{key:"53935",name:"DFK Chain",chainId:53935,network:"mainnet",multicall:"0x5b24224dC16508DAD755756639E420817DD4c99E",rpc:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"],explorer:{url:"https://subnets.avax.network/defi-kingdoms"},start:62,logo:"ipfs://QmZNkpVgPbuVbDcsi6arwH1om3456FGnwfDqYQJWUfHDEx"},57054:{key:"57054",name:"Sonic Blaze Testnet",shortName:"testnet",chainId:57054,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://testnet.sonicscan.org"},start:60,logo:"ipfs://bafkreic5fffatwy2gzf6y5iymje6ijii43tz4wlxl35da36guurhibjx44",testnet:!0},57073:{key:"57073",name:"Ink",shortName:"mainnet",chainId:57073,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer.inkonchain.com"},start:6659154,logo:"ipfs://bafkreics2duafru4mw36wftcmklgrsgq6fz4lgcjctzmov34bxjzuuypju"},59141:{key:"59141",name:"Linea Sepolia",shortName:"testnet",chainId:59141,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.lineascan.build"},start:227427,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce",testnet:!0},59144:{key:"59144",name:"Linea",shortName:"linea",chainId:59144,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://lineascan.build"},start:42,logo:"ipfs://bafkreihtyzolub3sejuwc32hpdpjnt7ksowaguni2yuho3kyihhcqrtqce"},69e3:{key:"69000",name:"Animechain",shortName:"mainnet",chainId:69e3,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-animechain-39xf6m45e3.t.conduit.xyz"},start:23482,logo:"ipfs://bafkreihm7dy6jzkd3nh6mokq4vshuzwkoeyjmbb3qkskn77rt5iufn7egi"},80001:{key:"80001",name:"Polygon Mumbai",chainId:80001,network:"testnet",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/polygon/mumbai/archive","https://rpc-mumbai.matic.today"],ws:["wss://ws-mumbai.matic.today"],explorer:{url:"https://mumbai.polygonscan.com",apiUrl:"https://api-mumbai.polygonscan.com"},start:12011090,logo:"ipfs://bafkreihgr7zy7vi5kqddybfaezwuhvssg57qluwmyan4qq7l57nr7w7wey"},80002:{key:"80002",name:"Polygon Amoy Testnet",shortName:"testnet",chainId:80002,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://amoy.polygonscan.com"},start:3127388,logo:"ipfs://bafkreibfiyvhqnme2vbxxfcku7qkxgjpkg6ywdkplxh4oxlkqsbznyorfm",testnet:!0},81457:{key:"81457",name:"Blast",shortName:"mainnet",chainId:81457,network:"mainnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://blastscan.io"},start:88189,logo:"ipfs://bafkreicqhrimt2zyp2kvhmbpvffxlmxovkg5vw6zkissyzibcfy45kbvrm"},84532:{key:"84532",name:"Base Sepolia",shortName:"testnet",chainId:84532,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://base-sepolia.blockscout.com"},start:1059647,logo:"ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv",testnet:!0},314159:{key:"314159",name:"Filecoin Calibration Testnet",shortName:"testnet",chainId:314159,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://calibration.filscan.io/en"},start:1446201,logo:"ipfs://bafkreiffbopdjior7li3nlemzko7rjua6wd2hfh2vhdbenqbv4tfsbnzwu",testnet:!0},686868:{key:"686868",name:"Merlin Testnet",shortName:"merlin",chainId:686868,network:"testnet",multicall:"0x758BC6321b7c68F4986d62a4D46E83A2DCb58c80",rpc:[],explorer:{url:"https://testnet-scan.merlinchain.io"},start:3562021,logo:"ipfs://bafkreicew2qv3m756m7xs2nrjezinghps7rlessrqjqetvox74w4hov2xe",testnet:!0},713715:{key:"713715",name:"Sei EVM Devnet",shortName:"devnet",chainId:713715,network:"testnet",multicall:"0xEe8d287B844959ADe40d718Dc23077ba920e2f07",rpc:[],explorer:{url:"https://seitrace.com"},start:1463669,logo:"ipfs://bafkreiammyt7uztbztqbcqv4bydnczsh2fqmnjf6jxj4xnskzzl6sjrigq",testnet:!0},763373:{key:"763373",name:"Ink Sepolia",shortName:"testnet",chainId:763373,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://explorer-sepolia.inkonchain.com"},start:9701940,logo:"ipfs://bafkreics2duafru4mw36wftcmklgrsgq6fz4lgcjctzmov34bxjzuuypju",testnet:!0},810180:{key:"810180",name:"zkLink Nova",shortName:"zlink",chainId:810180,network:"mainnet",multicall:"0x825267E0fA5CAe92F98540828a54198dcB3Eaeb5",rpc:[],explorer:{url:"https://explorer.zklink.io"},start:146055,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74"},810181:{key:"810181",name:"zkLink Nova Sepolia",shortName:"testnet",chainId:810181,network:"testnet",multicall:"0x97148F8fDdd9A1620f72EC1Bb2932916623d9da5",rpc:[],explorer:{url:"https://sepolia.explorer.zklink.io"},start:43723,logo:"ipfs://bafkreic6c3iems5235qapyhyrygha7akqrsfact2nok3y2uhljpzxrdu74",testnet:!0},11155111:{key:"11155111",name:"Sepolia testnet",shortName:"Sepolia",chainId:11155111,network:"sepolia",testnet:!0,multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:["https://sepolia.infura.io/v3/d26b4fd748814fe994b05899fd89e667"],ensResolvers:["0x8FADE66B79cC9f707aB26799354482EB93a5B7dD"],ensNameWrapper:"0x0635513f179D50A207757E05759CbD106d7dFcE8",ensSubgraph:"https://subgrapher.snapshot.org/subgraph/arbitrum/DmMXLtMZnGbQXASJ7p1jfzLUbBYnYUD9zNBTxpkjHYXV",explorer:{url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io"},start:751532,logo:"ipfs://bafkreid7ndxh6y2ljw2jhbisodiyrhcy2udvnwqgon5wgells3kh4si5z4"},11155420:{key:"11155420",name:"OP Sepolia",shortName:"testnet",chainId:11155420,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia-optimism.etherscan.io"},start:1620204,logo:"ipfs://QmfF4kwhGL8QosUXvgq2KWCmavhKBvwD6kbhs7L4p5ZAWb",testnet:!0},111557560:{key:"111557560",name:"Cyber Testnet",shortName:"testnet",chainId:111557560,network:"testnet",multicall:"0xffc391F0018269d4758AEA1a144772E8FB99545E",rpc:[],explorer:{url:"https://testnet.cyberscan.co"},start:304545,logo:"ipfs://bafkreifm2bbehoqpz4454o7gixnxfi6cgvqlxigqr3f6ipj7l2omtgfgnm",testnet:!0},168587773:{key:"168587773",name:"Blast Sepolia",shortName:"testnet",chainId:168587773,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://sepolia.blastexplorer.io"},start:756690,logo:"ipfs://bafkreibfmkjg22cozxppzcoxswj45clvh2rqhxzax57cmmgudbtkf4dkce",testnet:!0},245022926:{key:"245022926",name:"Neon Devnet",shortName:"devnet",chainId:245022926,network:"testnet",multicall:"0xcA11bde05977b3631167028862bE2a173976CA11",rpc:[],explorer:{url:"https://devnet.neonscan.org"},start:205206112,logo:"ipfs://QmecRPQGa4bU7tybg1sUQY48Md9rWnmhrT6WW5ueqvhg6P",testnet:!0},1313161554:{key:"1313161554",name:"Aurora",shortName:"Aurora",chainId:1313161554,network:"mainnet",multicall:"0x32b50c286DEFd2932a0247b8bb940b78c063F16c",rpc:["https://mainnet.aurora.dev"],explorer:{url:"https://explorer.mainnet.aurora.dev"},start:57190533,logo:"ipfs://QmeRhsR1UPRTQCizdhmgr2XxphXebVKU5di97uCV2UMFpa"},16666e5:{key:"1666600000",name:"Harmony",shortName:"HarmonyMainnet",chainId:16666e5,network:"mainnet",multicall:"0x9c31392D2e0229dC4Aa250F043d46B9E82074BF8",rpc:["https://a.api.s0.t.hmny.io"],ws:["wss://ws.s0.t.hmny.io"],explorer:{url:"https://explorer.harmony.one"},start:10911984,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"},16667e5:{key:"1666700000",name:"Harmony Testnet",shortName:"HarmonyTestnet",chainId:16667e5,network:"testnet",testnet:!0,multicall:"0x9923589503Fd205feE3d367DDFF2378f0F7dD2d4",rpc:["https://api.s0.b.hmny.io"],ws:["wss://ws.s0.b.hmny.io"],explorer:{url:"https://explorer.pops.one"},start:7521509,logo:"ipfs://QmNnGPr1CNvj12SSGzKARtUHv9FyEfE5nES73U4vBWQSJL"},"0x534e5f4d41494e":{key:"0x534e5f4d41494e",name:"Starknet",shortName:"Starknet",chainId:"0x534e5f4d41494e",network:"mainnet",starknet:!0,broviderId:"sn",multicall:"0x05754af3760f3356da99aea5c3ec39ccac7783d925a19666ebbeca58ff0087f4",explorer:{url:"https://starkscan.co"},rpc:["https://starknet-mainnet.public.blastapi.io"],start:8446,logo:"ipfs://bafkreihbjafyh7eud7r6e5743esaamifcttsvbspfwcrfoc5ykodjdi67m"},"0x534e5f5345504f4c4941":{key:"0x534e5f5345504f4c4941",name:"Starknet Sepolia",shortName:"testnet",chainId:"0x534e5f5345504f4c4941",network:"testnet",starknet:!0,broviderId:"sn-sep",testnet:!0,multicall:"0x05754af3760f3356da99aea5c3ec39ccac7783d925a19666ebbeca58ff0087f4",explorer:{url:"https://sepolia.starkscan.co"},rpc:["https://starknet-sepolia.public.blastapi.io"],start:7,logo:"ipfs://bafkreihbjafyh7eud7r6e5743esaamifcttsvbspfwcrfoc5ykodjdi67m"}};const WO=new Map,YO={evm:function(t,e){return new Km({url:`${e.broviderUrl}/${t}`,timeout:e.timeout,allowGzip:!0},Number(t))},starknet:function(t,e){return new lO({nodeUrl:`${e.broviderUrl}/${t}`})}};function QO(t,e={}){const r=function(t){const e=JO[t];if(!e)throw new Error(`Network '${t}' is not supported`);return e.broviderId||String(t)}(t),i=function(t={}){var e;return{broviderUrl:t.broviderUrl||"https://rpc.snapshot.org",timeout:null!==(e=t.timeout)&&void 0!==e?e:25e3}}(e),n=function(t,e){return`${t}:${e.broviderUrl}:${e.timeout}`}(r,i),o=WO.get(n);if(o)return o;const a=function(t){var e;return(null===(e=JO[t])||void 0===e?void 0:e.starknet)?"starknet":"evm"}(t),s=YO[a](r,i);return WO.set(n,s),s}var XO,tR,eR,rR;const iR={SN_MAIN:null===(tR=null===(XO=JO[eS.StarknetChainId.SN_MAIN])||void 0===XO?void 0:XO.rpc)||void 0===tR?void 0:tR[0],SN_SEPOLIA:null===(rR=null===(eR=JO[eS.StarknetChainId.SN_SEPOLIA])||void 0===eR?void 0:eR.rpc)||void 0===rR?void 0:rR[0]},nR=[{name:"argent::common::account::IAccount",type:"interface",items:[{name:"is_valid_signature",type:"function",inputs:[{name:"hash",type:"core::felt252"},{name:"signature",type:"core::array::Array::<core::felt252>"}],outputs:[{type:"core::felt252"}],state_mutability:"view"}]}];function oR(t,e){var r;if(!iR[t])throw new Error("Invalid network");return new lO({nodeUrl:null!==(r=null==e?void 0:e.broviderUrl)&&void 0!==r?r:iR[t]})}function aR(t){return!!t.primaryType&&!!t.types.StarkNetDomain}function sR(t,e){const{domain:r,types:i,primaryType:n,message:o}=t;return vz.getMessageHash({types:i,primaryType:n,domain:r,message:o},e)}var hR=Object.freeze({__proto__:null,isStarknetMessage:aR,getHash:sR,default:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="SN_MAIN",n={}){try{const o=new KO(nR,t,oR(i,n));if(e.length<2)throw new Error("Invalid signature format");const a=yield o.is_valid_signature(sR(r,t),e.slice(-2));return eh.from(a).eq(eh.from("370462705988"))}catch(t){if(t.message.includes("Contract not found"))throw new Error("Contract not deployed");throw t}}))}});function uR(t){return mr(ui(t))}var lR=a((function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function n(t,e,r){if(n.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var o;"object"==typeof t?t.exports=n:e.BN=n,n.BN=n,n.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Tt.Buffer}catch(t){}function a(t,e){var i=t.charCodeAt(e);return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:void r(!1,"Invalid character in "+t)}function s(t,e,r){var i=a(t,r);return r-1>=e&&(i|=a(t,r-1)<<4),i}function h(t,e,i,n){for(var o=0,a=0,s=Math.min(t.length,i),h=e;h<s;h++){var u=t.charCodeAt(h)-48;o*=n,a=u>=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a<n,"Invalid character"),o+=a}return o}function u(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(n.isBN=function(t){return t instanceof n||null!==t&&"object"==typeof t&&t.constructor.wordSize===n.wordSize&&Array.isArray(t.words)},n.max=function(t,e){return t.cmp(e)>0?t:e},n.min=function(t,e){return t.cmp(e)<0?t:e},n.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},n.prototype._initNumber=function(t,e,i){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),e,i)},n.prototype._initArray=function(t,e,i){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,a,s=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)a=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)a=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},n.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,o=0,a=0;if("be"===r)for(i=t.length-1;i>=e;i-=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;else for(i=(t.length-e)%2==0?e+1:e;i<t.length;i+=2)n=s(t,e,i)<<o,this.words[a]|=67108863&n,o>=18?(o-=18,a+=1,this.words[a]|=n>>>26):o+=8;this._strip()},n.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,a=o%i,s=Math.min(o,o-a)+r,u=0,l=r;l<s;l+=i)u=h(t,l,l+i,e),this.imuln(n),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var c=1;for(u=h(t,l,t.length,e),l=0;l<a;l++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},n.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},n.prototype._move=function(t){u(t,this)},n.prototype.clone=function(){var t=new n(null);return this.copy(t),t},n.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},n.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){n.prototype.inspect=l}else n.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,a=0;a<this.length;a++){var s=this.words[a],h=(16777215&(s<<n|o)).toString(16);o=s>>>24-n&16777215,(n+=2)>=26&&(n-=26,a--),i=0!==o||a!==this.length-1?c[6-h.length]+h+i:h+i}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=d[t],l=f[t];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var p=m.modrn(l).toString(t);i=(m=m.idivn(l)).isZero()?p+i:c[u-p.length]+p+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),n.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],a=n*o,s=67108863&a,h=a/67108864|0;r.words[0]=s;for(var u=1;u<i;u++){for(var l=h>>>26,c=67108863&h,d=Math.min(u,e.length-1),f=Math.max(0,u-t.length+1);f<=d;f++){var m=u-f|0;l+=(a=(n=0|t.words[m])*(o=0|e.words[f])+c)/67108864|0,c=67108863&a}r.words[u]=0|c,h=0|l}return 0!==h?r.words[u]=0|h:r.length--,r._strip()}n.prototype.toArrayLike=function(t,e,i){this._strip();var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,n),a},n.prototype._toArrayLikeLE=function(t,e){for(var r=0,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r++]=255&a,r<t.length&&(t[r++]=a>>8&255),r<t.length&&(t[r++]=a>>16&255),6===o?(r<t.length&&(t[r++]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r<t.length)for(t[r++]=i;r<t.length;)t[r++]=0},n.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,i=0,n=0,o=0;n<this.length;n++){var a=this.words[n]<<o|i;t[r--]=255&a,r>=0&&(t[r--]=a>>8&255),r>=0&&(t[r--]=a>>16&255),6===o?(r>=0&&(t[r--]=a>>24&255),i=0,o=0):(i=a>>>24,o+=2)}if(r>=0)for(t[r--]=i;r>=0;)t[r--]=0},Math.clz32?n.prototype._countBits=function(t){return 32-Math.clz32(t)}:n.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},n.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},n.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},n.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return 0!==this.negative},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},n.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},n.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},n.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},n.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},n.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},n.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},n.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},n.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this._strip()},n.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},n.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},n.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},n.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this._strip()},n.prototype.notn=function(t){return this.clone().inotn(t)},n.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this._strip()},n.prototype.iadd=function(t){var e,r,i;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},n.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},n.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,a=0;a<i.length;a++)o=(e=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<r.length;a++)o=(e=(0|r.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,r){var i,n,o,a=t.words,s=e.words,h=r.words,u=0,l=0|a[0],c=8191&l,d=l>>>13,f=0|a[1],m=8191&f,p=f>>>13,g=0|a[2],y=8191&g,w=g>>>13,v=0|a[3],b=8191&v,k=v>>>13,M=0|a[4],_=8191&M,E=M>>>13,A=0|a[5],j=8191&A,x=A>>>13,S=0|a[6],N=8191&S,I=S>>>13,T=0|a[7],C=8191&T,z=T>>>13,O=0|a[8],R=8191&O,P=O>>>13,B=0|a[9],D=8191&B,$=B>>>13,L=0|s[0],U=8191&L,F=L>>>13,q=0|s[1],V=8191&q,H=q>>>13,G=0|s[2],Z=8191&G,K=G>>>13,J=0|s[3],W=8191&J,Y=J>>>13,Q=0|s[4],X=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,it=et>>>13,nt=0|s[6],ot=8191&nt,at=nt>>>13,st=0|s[7],ht=8191&st,ut=st>>>13,lt=0|s[8],ct=8191&lt,dt=lt>>>13,ft=0|s[9],mt=8191&ft,pt=ft>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(u+(i=Math.imul(c,U))|0)+((8191&(n=(n=Math.imul(c,F))+Math.imul(d,U)|0))<<13)|0;u=((o=Math.imul(d,F))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(m,U),n=(n=Math.imul(m,F))+Math.imul(p,U)|0,o=Math.imul(p,F);var yt=(u+(i=i+Math.imul(c,V)|0)|0)+((8191&(n=(n=n+Math.imul(c,H)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(y,U),n=(n=Math.imul(y,F))+Math.imul(w,U)|0,o=Math.imul(w,F),i=i+Math.imul(m,V)|0,n=(n=n+Math.imul(m,H)|0)+Math.imul(p,V)|0,o=o+Math.imul(p,H)|0;var wt=(u+(i=i+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,K)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(b,U),n=(n=Math.imul(b,F))+Math.imul(k,U)|0,o=Math.imul(k,F),i=i+Math.imul(y,V)|0,n=(n=n+Math.imul(y,H)|0)+Math.imul(w,V)|0,o=o+Math.imul(w,H)|0,i=i+Math.imul(m,Z)|0,n=(n=n+Math.imul(m,K)|0)+Math.imul(p,Z)|0,o=o+Math.imul(p,K)|0;var vt=(u+(i=i+Math.imul(c,W)|0)|0)+((8191&(n=(n=n+Math.imul(c,Y)|0)+Math.imul(d,W)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(_,U),n=(n=Math.imul(_,F))+Math.imul(E,U)|0,o=Math.imul(E,F),i=i+Math.imul(b,V)|0,n=(n=n+Math.imul(b,H)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(w,Z)|0,o=o+Math.imul(w,K)|0,i=i+Math.imul(m,W)|0,n=(n=n+Math.imul(m,Y)|0)+Math.imul(p,W)|0,o=o+Math.imul(p,Y)|0;var bt=(u+(i=i+Math.imul(c,X)|0)|0)+((8191&(n=(n=n+Math.imul(c,tt)|0)+Math.imul(d,X)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(j,U),n=(n=Math.imul(j,F))+Math.imul(x,U)|0,o=Math.imul(x,F),i=i+Math.imul(_,V)|0,n=(n=n+Math.imul(_,H)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,H)|0,i=i+Math.imul(b,Z)|0,n=(n=n+Math.imul(b,K)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,K)|0,i=i+Math.imul(y,W)|0,n=(n=n+Math.imul(y,Y)|0)+Math.imul(w,W)|0,o=o+Math.imul(w,Y)|0,i=i+Math.imul(m,X)|0,n=(n=n+Math.imul(m,tt)|0)+Math.imul(p,X)|0,o=o+Math.imul(p,tt)|0;var kt=(u+(i=i+Math.imul(c,rt)|0)|0)+((8191&(n=(n=n+Math.imul(c,it)|0)+Math.imul(d,rt)|0))<<13)|0;u=((o=o+Math.imul(d,it)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(N,U),n=(n=Math.imul(N,F))+Math.imul(I,U)|0,o=Math.imul(I,F),i=i+Math.imul(j,V)|0,n=(n=n+Math.imul(j,H)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,H)|0,i=i+Math.imul(_,Z)|0,n=(n=n+Math.imul(_,K)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,K)|0,i=i+Math.imul(b,W)|0,n=(n=n+Math.imul(b,Y)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,Y)|0,i=i+Math.imul(y,X)|0,n=(n=n+Math.imul(y,tt)|0)+Math.imul(w,X)|0,o=o+Math.imul(w,tt)|0,i=i+Math.imul(m,rt)|0,n=(n=n+Math.imul(m,it)|0)+Math.imul(p,rt)|0,o=o+Math.imul(p,it)|0;var Mt=(u+(i=i+Math.imul(c,ot)|0)|0)+((8191&(n=(n=n+Math.imul(c,at)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,at)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(C,U),n=(n=Math.imul(C,F))+Math.imul(z,U)|0,o=Math.imul(z,F),i=i+Math.imul(N,V)|0,n=(n=n+Math.imul(N,H)|0)+Math.imul(I,V)|0,o=o+Math.imul(I,H)|0,i=i+Math.imul(j,Z)|0,n=(n=n+Math.imul(j,K)|0)+Math.imul(x,Z)|0,o=o+Math.imul(x,K)|0,i=i+Math.imul(_,W)|0,n=(n=n+Math.imul(_,Y)|0)+Math.imul(E,W)|0,o=o+Math.imul(E,Y)|0,i=i+Math.imul(b,X)|0,n=(n=n+Math.imul(b,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(y,rt)|0,n=(n=n+Math.imul(y,it)|0)+Math.imul(w,rt)|0,o=o+Math.imul(w,it)|0,i=i+Math.imul(m,ot)|0,n=(n=n+Math.imul(m,at)|0)+Math.imul(p,ot)|0,o=o+Math.imul(p,at)|0;var _t=(u+(i=i+Math.imul(c,ht)|0)|0)+((8191&(n=(n=n+Math.imul(c,ut)|0)+Math.imul(d,ht)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(R,U),n=(n=Math.imul(R,F))+Math.imul(P,U)|0,o=Math.imul(P,F),i=i+Math.imul(C,V)|0,n=(n=n+Math.imul(C,H)|0)+Math.imul(z,V)|0,o=o+Math.imul(z,H)|0,i=i+Math.imul(N,Z)|0,n=(n=n+Math.imul(N,K)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,K)|0,i=i+Math.imul(j,W)|0,n=(n=n+Math.imul(j,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,i=i+Math.imul(_,X)|0,n=(n=n+Math.imul(_,tt)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,tt)|0,i=i+Math.imul(b,rt)|0,n=(n=n+Math.imul(b,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(y,ot)|0,n=(n=n+Math.imul(y,at)|0)+Math.imul(w,ot)|0,o=o+Math.imul(w,at)|0,i=i+Math.imul(m,ht)|0,n=(n=n+Math.imul(m,ut)|0)+Math.imul(p,ht)|0,o=o+Math.imul(p,ut)|0;var Et=(u+(i=i+Math.imul(c,ct)|0)|0)+((8191&(n=(n=n+Math.imul(c,dt)|0)+Math.imul(d,ct)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(D,U),n=(n=Math.imul(D,F))+Math.imul($,U)|0,o=Math.imul($,F),i=i+Math.imul(R,V)|0,n=(n=n+Math.imul(R,H)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,H)|0,i=i+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(z,Z)|0,o=o+Math.imul(z,K)|0,i=i+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,i=i+Math.imul(j,X)|0,n=(n=n+Math.imul(j,tt)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,tt)|0,i=i+Math.imul(_,rt)|0,n=(n=n+Math.imul(_,it)|0)+Math.imul(E,rt)|0,o=o+Math.imul(E,it)|0,i=i+Math.imul(b,ot)|0,n=(n=n+Math.imul(b,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,i=i+Math.imul(y,ht)|0,n=(n=n+Math.imul(y,ut)|0)+Math.imul(w,ht)|0,o=o+Math.imul(w,ut)|0,i=i+Math.imul(m,ct)|0,n=(n=n+Math.imul(m,dt)|0)+Math.imul(p,ct)|0,o=o+Math.imul(p,dt)|0;var At=(u+(i=i+Math.imul(c,mt)|0)|0)+((8191&(n=(n=n+Math.imul(c,pt)|0)+Math.imul(d,mt)|0))<<13)|0;u=((o=o+Math.imul(d,pt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(D,V),n=(n=Math.imul(D,H))+Math.imul($,V)|0,o=Math.imul($,H),i=i+Math.imul(R,Z)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,K)|0,i=i+Math.imul(C,W)|0,n=(n=n+Math.imul(C,Y)|0)+Math.imul(z,W)|0,o=o+Math.imul(z,Y)|0,i=i+Math.imul(N,X)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(I,X)|0,o=o+Math.imul(I,tt)|0,i=i+Math.imul(j,rt)|0,n=(n=n+Math.imul(j,it)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,it)|0,i=i+Math.imul(_,ot)|0,n=(n=n+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,i=i+Math.imul(b,ht)|0,n=(n=n+Math.imul(b,ut)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,ut)|0,i=i+Math.imul(y,ct)|0,n=(n=n+Math.imul(y,dt)|0)+Math.imul(w,ct)|0,o=o+Math.imul(w,dt)|0;var jt=(u+(i=i+Math.imul(m,mt)|0)|0)+((8191&(n=(n=n+Math.imul(m,pt)|0)+Math.imul(p,mt)|0))<<13)|0;u=((o=o+Math.imul(p,pt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(D,Z),n=(n=Math.imul(D,K))+Math.imul($,Z)|0,o=Math.imul($,K),i=i+Math.imul(R,W)|0,n=(n=n+Math.imul(R,Y)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,Y)|0,i=i+Math.imul(C,X)|0,n=(n=n+Math.imul(C,tt)|0)+Math.imul(z,X)|0,o=o+Math.imul(z,tt)|0,i=i+Math.imul(N,rt)|0,n=(n=n+Math.imul(N,it)|0)+Math.imul(I,rt)|0,o=o+Math.imul(I,it)|0,i=i+Math.imul(j,ot)|0,n=(n=n+Math.imul(j,at)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,at)|0,i=i+Math.imul(_,ht)|0,n=(n=n+Math.imul(_,ut)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,ut)|0,i=i+Math.imul(b,ct)|0,n=(n=n+Math.imul(b,dt)|0)+Math.imul(k,ct)|0,o=o+Math.imul(k,dt)|0;var xt=(u+(i=i+Math.imul(y,mt)|0)|0)+((8191&(n=(n=n+Math.imul(y,pt)|0)+Math.imul(w,mt)|0))<<13)|0;u=((o=o+Math.imul(w,pt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(D,W),n=(n=Math.imul(D,Y))+Math.imul($,W)|0,o=Math.imul($,Y),i=i+Math.imul(R,X)|0,n=(n=n+Math.imul(R,tt)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,tt)|0,i=i+Math.imul(C,rt)|0,n=(n=n+Math.imul(C,it)|0)+Math.imul(z,rt)|0,o=o+Math.imul(z,it)|0,i=i+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,i=i+Math.imul(j,ht)|0,n=(n=n+Math.imul(j,ut)|0)+Math.imul(x,ht)|0,o=o+Math.imul(x,ut)|0,i=i+Math.imul(_,ct)|0,n=(n=n+Math.imul(_,dt)|0)+Math.imul(E,ct)|0,o=o+Math.imul(E,dt)|0;var St=(u+(i=i+Math.imul(b,mt)|0)|0)+((8191&(n=(n=n+Math.imul(b,pt)|0)+Math.imul(k,mt)|0))<<13)|0;u=((o=o+Math.imul(k,pt)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(D,X),n=(n=Math.imul(D,tt))+Math.imul($,X)|0,o=Math.imul($,tt),i=i+Math.imul(R,rt)|0,n=(n=n+Math.imul(R,it)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,it)|0,i=i+Math.imul(C,ot)|0,n=(n=n+Math.imul(C,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,i=i+Math.imul(N,ht)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,ut)|0,i=i+Math.imul(j,ct)|0,n=(n=n+Math.imul(j,dt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,dt)|0;var Nt=(u+(i=i+Math.imul(_,mt)|0)|0)+((8191&(n=(n=n+Math.imul(_,pt)|0)+Math.imul(E,mt)|0))<<13)|0;u=((o=o+Math.imul(E,pt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(D,rt),n=(n=Math.imul(D,it))+Math.imul($,rt)|0,o=Math.imul($,it),i=i+Math.imul(R,ot)|0,n=(n=n+Math.imul(R,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,i=i+Math.imul(C,ht)|0,n=(n=n+Math.imul(C,ut)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,ut)|0,i=i+Math.imul(N,ct)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(I,ct)|0,o=o+Math.imul(I,dt)|0;var It=(u+(i=i+Math.imul(j,mt)|0)|0)+((8191&(n=(n=n+Math.imul(j,pt)|0)+Math.imul(x,mt)|0))<<13)|0;u=((o=o+Math.imul(x,pt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,i=Math.imul(D,ot),n=(n=Math.imul(D,at))+Math.imul($,ot)|0,o=Math.imul($,at),i=i+Math.imul(R,ht)|0,n=(n=n+Math.imul(R,ut)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,ut)|0,i=i+Math.imul(C,ct)|0,n=(n=n+Math.imul(C,dt)|0)+Math.imul(z,ct)|0,o=o+Math.imul(z,dt)|0;var Tt=(u+(i=i+Math.imul(N,mt)|0)|0)+((8191&(n=(n=n+Math.imul(N,pt)|0)+Math.imul(I,mt)|0))<<13)|0;u=((o=o+Math.imul(I,pt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(D,ht),n=(n=Math.imul(D,ut))+Math.imul($,ht)|0,o=Math.imul($,ut),i=i+Math.imul(R,ct)|0,n=(n=n+Math.imul(R,dt)|0)+Math.imul(P,ct)|0,o=o+Math.imul(P,dt)|0;var Ct=(u+(i=i+Math.imul(C,mt)|0)|0)+((8191&(n=(n=n+Math.imul(C,pt)|0)+Math.imul(z,mt)|0))<<13)|0;u=((o=o+Math.imul(z,pt)|0)+(n>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,i=Math.imul(D,ct),n=(n=Math.imul(D,dt))+Math.imul($,ct)|0,o=Math.imul($,dt);var zt=(u+(i=i+Math.imul(R,mt)|0)|0)+((8191&(n=(n=n+Math.imul(R,pt)|0)+Math.imul(P,mt)|0))<<13)|0;u=((o=o+Math.imul(P,pt)|0)+(n>>>13)|0)+(zt>>>26)|0,zt&=67108863;var Ot=(u+(i=Math.imul(D,mt))|0)+((8191&(n=(n=Math.imul(D,pt))+Math.imul($,mt)|0))<<13)|0;return u=((o=Math.imul($,pt))+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=yt,h[2]=wt,h[3]=vt,h[4]=bt,h[5]=kt,h[6]=Mt,h[7]=_t,h[8]=Et,h[9]=At,h[10]=jt,h[11]=xt,h[12]=St,h[13]=Nt,h[14]=It,h[15]=Tt,h[16]=Ct,h[17]=zt,h[18]=Ot,0!==u&&(h[19]=u,r.length++),r};function g(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var a=n;n=0;for(var s=67108863&i,h=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=h;u++){var l=o-u,c=(0|t.words[l])*(0|e.words[u]),d=67108863&c;s=67108863&(d=d+s|0),n+=(a=(a=a+(c/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}r.words[o]=s,i=a,a=n}return 0!==i?r.words[o]=i:r.length--,r._strip()}function y(t,e,r){return g(t,e,r)}Math.imul||(p=m),n.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?m(this,t,e):r<1024?g(this,t,e):y(this,t,e)},n.prototype.mul=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},n.prototype.mulf=function(t){var e=new n(null);return e.words=new Array(this.length+t.length),y(this,t,e)},n.prototype.imul=function(t){return this.clone().mulTo(t,this)},n.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,a=(67108863&o)+(67108863&i);i>>=26,i+=o/67108864|0,i+=a>>>26,this.words[n]=67108863&a}return 0!==i&&(this.words[n]=i,this.length++),e?this.ineg():this},n.prototype.muln=function(t){return this.clone().imuln(t)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=t.words[i]>>>n&1}return e}(t);if(0===e.length)return new n(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var o=r.sqr();i<e.length;i++,o=o.sqr())0!==e[i]&&(r=r.mul(o));return r},n.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,h=(0|this.words[e])-s<<i;this.words[e]=h|a,a=s>>>26-i}a&&(this.words[e]=a,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},n.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},n.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,h=i;if(n-=a,n=Math.max(0,n),h){for(var u=0;u<a;u++)h.words[u]=this.words[u];h.length=a}if(0===a);else if(this.length>a)for(this.length-=a,u=0;u<this.length;u++)this.words[u]=this.words[u+a];else this.words[0]=0,this.length=1;var l=0;for(u=this.length-1;u>=0&&(0!==l||u>=n);u--){var c=0|this.words[u];this.words[u]=l<<26-o|c>>>o,l=c&s}return h&&0!==l&&(h.words[h.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(t,e,i){return r(0===this.negative),this.iushrn(t,e,i)},n.prototype.shln=function(t){return this.clone().ishln(t)},n.prototype.ushln=function(t){return this.clone().iushln(t)},n.prototype.shrn=function(t){return this.clone().ishrn(t)},n.prototype.ushrn=function(t){return this.clone().iushrn(t)},n.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26,n=1<<e;return!(this.length<=i)&&!!(this.words[i]&n)},n.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,i=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==e&&i++,this.length=Math.min(i,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},n.prototype.maskn=function(t){return this.clone().imaskn(t)},n.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},n.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},n.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},n.prototype.addn=function(t){return this.clone().iaddn(t)},n.prototype.subn=function(t){return this.clone().isubn(t)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(t,e,i){var n,o,a=t.length+i;this._expand(a);var s=0;for(n=0;n<t.length;n++){o=(0|this.words[n+i])+s;var h=(0|t.words[n])*e;s=((o-=67108863&h)>>26)-(h/67108864|0),this.words[n+i]=67108863&o}for(;n<this.length-i;n++)s=(o=(0|this.words[n+i])+s)>>26,this.words[n+i]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,n=0;n<this.length;n++)s=(o=-(0|this.words[n])+s)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},n.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),o=t,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),i.iushln(r),a=0|o.words[o.length-1]);var s,h=i.length-o.length;if("mod"!==e){(s=new n(null)).length=h+1,s.words=new Array(s.length);for(var u=0;u<s.length;u++)s.words[u]=0}var l=i.clone()._ishlnsubmul(o,1,h);0===l.negative&&(i=l,s&&(s.words[h]=1));for(var c=h-1;c>=0;c--){var d=67108864*(0|i.words[o.length+c])+(0|i.words[o.length+c-1]);for(d=Math.min(d/a|0,67108863),i._ishlnsubmul(o,d,c);0!==i.negative;)d--,i.negative=0,i._ishlnsubmul(o,1,c),i.isZero()||(i.negative^=1);s&&(s.words[c]=d)}return s&&s._strip(),i._strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:s||null,mod:i}},n.prototype.divmod=function(t,e,i){return r(!t.isZero()),this.isZero()?{div:new n(0),mod:new n(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),i&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new n(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new n(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new n(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},n.prototype.div=function(t){return this.divmod(t,"div",!1).div},n.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},n.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},n.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},n.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(i*n+(0|this.words[o]))%t;return e?-n:n},n.prototype.modn=function(t){return this.modrn(t)},n.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*i;this.words[n]=o/t|0,i=o%t}return this._strip(),e?this.ineg():this},n.prototype.divn=function(t){return this.clone().idivn(t)},n.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new n(1),a=new n(0),s=new n(0),h=new n(1),u=0;e.isEven()&&i.isEven();)e.iushrn(1),i.iushrn(1),++u;for(var l=i.clone(),c=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(c)),o.iushrn(1),a.iushrn(1);for(var m=0,p=1;0==(i.words[0]&p)&&m<26;++m,p<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(l),h.isub(c)),s.iushrn(1),h.iushrn(1);e.cmp(i)>=0?(e.isub(i),o.isub(s),a.isub(h)):(i.isub(e),s.isub(o),h.isub(a))}return{a:s,b:h,gcd:i.iushln(u)}},n.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,i=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new n(1),s=new n(0),h=i.clone();e.cmpn(1)>0&&i.cmpn(1)>0;){for(var u=0,l=1;0==(e.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(e.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(h),a.iushrn(1);for(var c=0,d=1;0==(i.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(i.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(h),s.iushrn(1);e.cmp(i)>=0?(e.isub(i),a.isub(s)):(i.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},n.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},n.prototype.invm=function(t){return this.egcd(t).a.umod(t)},n.prototype.isEven=function(){return 0==(1&this.words[0])},n.prototype.isOdd=function(){return 1==(1&this.words[0])},n.prototype.andln=function(t){return this.words[0]&t},n.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,i=(t-e)/26,n=1<<e;if(this.length<=i)return this._expand(i+1),this.words[i]|=n,this;for(var o=n,a=i;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},n.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},n.prototype.cmpn=function(t){var e,i=t<0;if(0!==this.negative&&!i)return-1;if(0===this.negative&&i)return 1;if(this._strip(),this.length>1)e=1;else{i&&(t=-t),r(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},n.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},n.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},n.prototype.gtn=function(t){return 1===this.cmpn(t)},n.prototype.gt=function(t){return 1===this.cmp(t)},n.prototype.gten=function(t){return this.cmpn(t)>=0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.ltn=function(t){return-1===this.cmpn(t)},n.prototype.lt=function(t){return-1===this.cmp(t)},n.prototype.lten=function(t){return this.cmpn(t)<=0},n.prototype.lte=function(t){return this.cmp(t)<=0},n.prototype.eqn=function(t){return 0===this.cmpn(t)},n.prototype.eq=function(t){return 0===this.cmp(t)},n.red=function(t){return new E(t)},n.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(t){return this.red=t,this},n.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},n.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},n.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},n.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},n.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},n.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},n.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},n.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var w={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function k(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(t){if("string"==typeof t){var e=n._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){E.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new n(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(b,v),b.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(a&r)<<4|o>>>22,o=a}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(k,v),i(M,v),i(_,v),_.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},n._prime=function(t){if(w[t])return w[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new k;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return w[t]=e,e},E.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},E.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},E.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(u(t,t.umod(this.m)._forceRed(this)),t)},E.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},E.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},E.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},E.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},E.prototype.isqr=function(t){return this.imul(t,t.clone())},E.prototype.sqr=function(t){return this.mul(t,t)},E.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var i=this.m.add(new n(1)).iushrn(2);return this.pow(t,i)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new n(1).toRed(this),h=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);0!==this.pow(l,u).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),m=a;0!==f.cmp(s);){for(var p=f,g=0;0!==p.cmp(s);g++)p=p.redSqr();r(g<m);var y=this.pow(c,new n(1).iushln(m-g-1));d=d.redMul(y),c=y.redSqr(),f=f.redMul(c),m=g}return d},E.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},E.prototype.pow=function(t,e){if(e.isZero())return new n(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new n(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var o=r[0],a=0,s=0,h=e.bitLength()%26;for(0===h&&(h=26),i=e.length-1;i>=0;i--){for(var u=e.words[i],l=h-1;l>=0;l--){var c=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==c||0!==a?(a<<=1,a|=c,(4===++s||0===i&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}h=26}return o},E.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},E.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},n.mont=function(t){return new A(t)},i(A,E),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new n(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(i).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,i)}));var cR=lR.BN;const dR=new Ft("bignumber/5.6.2"),fR={},mR=9007199254740991;let pR=!1;class gR{constructor(t,e){t!==fR&&dR.throwError("cannot call constructor directly; use BigNumber.from",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return wR(vR(this).fromTwos(t))}toTwos(t){return wR(vR(this).toTwos(t))}abs(){return"-"===this._hex[0]?gR.from(this._hex.substring(1)):this}add(t){return wR(vR(this).add(vR(t)))}sub(t){return wR(vR(this).sub(vR(t)))}div(t){return gR.from(t).isZero()&&bR("division-by-zero","div"),wR(vR(this).div(vR(t)))}mul(t){return wR(vR(this).mul(vR(t)))}mod(t){const e=vR(t);return e.isNeg()&&bR("division-by-zero","mod"),wR(vR(this).umod(e))}pow(t){const e=vR(t);return e.isNeg()&&bR("negative-power","pow"),wR(vR(this).pow(e))}and(t){const e=vR(t);return(this.isNegative()||e.isNeg())&&bR("unbound-bitwise-result","and"),wR(vR(this).and(e))}or(t){const e=vR(t);return(this.isNegative()||e.isNeg())&&bR("unbound-bitwise-result","or"),wR(vR(this).or(e))}xor(t){const e=vR(t);return(this.isNegative()||e.isNeg())&&bR("unbound-bitwise-result","xor"),wR(vR(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&bR("negative-width","mask"),wR(vR(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&bR("negative-width","shl"),wR(vR(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&bR("negative-width","shr"),wR(vR(this).shrn(t))}eq(t){return vR(this).eq(vR(t))}lt(t){return vR(this).lt(vR(t))}lte(t){return vR(this).lte(vR(t))}gt(t){return vR(this).gt(vR(t))}gte(t){return vR(this).gte(vR(t))}isNegative(){return"-"===this._hex[0]}isZero(){return vR(this).isZero()}toNumber(){try{return vR(this).toNumber()}catch(t){bR("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return dR.throwError("this platform does not support BigInt",Ft.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?pR||(pR=!0,dR.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?dR.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ft.errors.UNEXPECTED_ARGUMENT,{}):dR.throwError("BigNumber.toString does not accept parameters",Ft.errors.UNEXPECTED_ARGUMENT,{})),vR(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof gR)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new gR(fR,yR(t)):t.match(/^-?[0-9]+$/)?new gR(fR,yR(new cR(t))):dR.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&bR("underflow","BigNumber.from",t),(t>=mR||t<=-mR)&&bR("overflow","BigNumber.from",t),gR.from(String(t));const e=t;if("bigint"==typeof e)return gR.from(e.toString());if(Kt(e))return gR.from(te(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return gR.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Qt(t)||"-"===t[0]&&Qt(t.substring(1))))return gR.from(t)}return dR.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function yR(t){if("string"!=typeof t)return yR(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&dR.throwArgumentError("invalid hex","value",t),"0x00"===(t=yR(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function wR(t){return gR.from(yR(t))}function vR(t){const e=gR.from(t).toHexString();return"-"===e[0]?new cR("-"+e.substring(3),16):new cR(e.substring(2),16)}function bR(t,e,r){const i={fault:t,operation:e};return null!=r&&(i.value=r),dR.throwError(t,Ft.errors.NUMERIC_FAULT,i)}var kR=window&&window.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{h(i.next(t))}catch(t){o(t)}}function s(t){try{h(i.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}h((i=i.apply(t,e||[])).next())}))};const MR=new Ft("hash/5.6.1"),_R=new Uint8Array(32);_R.fill(0);const ER=gR.from(-1),AR=gR.from(0),jR=gR.from(1),xR=gR.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const SR=oe(jR.toHexString(),32),NR=oe(AR.toHexString(),32),IR={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},TR=["name","version","chainId","verifyingContract","salt"];function CR(t){return function(e){return"string"!=typeof e&&MR.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const zR={name:CR("name"),version:CR("version"),chainId:function(t){try{return gR.from(t).toString()}catch(t){}return MR.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return xr(t).toLowerCase()}catch(t){}return MR.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=Jt(t);if(32!==e.length)throw new Error("bad length");return te(e)}catch(t){}return MR.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function OR(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=""===e[1],i=parseInt(e[2]||"256");(i%8!=0||i>256||e[2]&&e[2]!==String(i))&&MR.throwArgumentError("invalid numeric width","type",t);const n=xR.mask(r?i-1:i),o=r?n.add(jR).mul(ER):AR;return function(e){const r=gR.from(e);return(r.lt(o)||r.gt(n))&&MR.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),oe(r.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(0===r||r>32||e[1]!==String(r))&&MR.throwArgumentError("invalid bytes width","type",t),function(e){return Jt(e).length!==r&&MR.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=Jt(t),r=e.length%32;return r?ie([e,_R.slice(r)]):te(e)}(e)}}}switch(t){case"address":return function(t){return oe(xr(t),32)};case"bool":return function(t){return t?SR:NR};case"bytes":return function(t){return mr(t)};case"string":return function(t){return uR(t)}}return null}function RR(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class PR{constructor(t){ve(this,"types",Object.freeze(je(t))),ve(this,"_encoderCache",{}),ve(this,"_types",{});const e={},r={},i={};Object.keys(t).forEach((t=>{e[t]={},r[t]=[],i[t]={}}));for(const i in t){const n={};t[i].forEach((o=>{n[o.name]&&MR.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(i)}`,"types",t),n[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===i&&MR.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);OR(a)||(r[a]||MR.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),r[a].push(i),e[i][a]=!0)}))}const n=Object.keys(r).filter((t=>0===r[t].length));0===n.length?MR.throwArgumentError("missing primary type","types",t):n.length>1&&MR.throwArgumentError(`ambiguous primary types or unused types: ${n.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),ve(this,"primaryType",n[0]),function n(o,a){a[o]&&MR.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(e[o]).forEach((t=>{r[t]&&(n(t,a),Object.keys(a).forEach((e=>{i[e][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const e in i){const r=Object.keys(i[e]);r.sort(),this._types[e]=RR(e,t[e])+r.map((e=>RR(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=OR(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],r=this.getEncoder(t),i=parseInt(e[3]);return e=>{i>=0&&e.length!==i&&MR.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let n=e.map(r);return this._types[t]&&(n=n.map(mr)),mr(ie(n))}}const r=this.types[t];if(r){const e=uR(this._types[t]);return t=>{const i=r.map((({name:e,type:r})=>{const i=this.getEncoder(r)(t[e]);return this._types[r]?mr(i):i}));return i.unshift(e),ie(i)}}return MR.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||MR.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return mr(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,r){if(OR(t))return r(t,e);const i=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const t=i[1],n=parseInt(i[3]);return n>=0&&e.length!==n&&MR.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,r)))}const n=this.types[t];return n?n.reduce(((t,{name:i,type:n})=>(t[i]=this._visit(n,e[i],r),t)),{}):MR.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new PR(t)}static getPrimaryType(t){return PR.from(t).primaryType}static hashStruct(t,e,r){return PR.from(e).hashStruct(t,r)}static hashDomain(t){const e=[];for(const r in t){const i=IR[r];i||MR.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",t),e.push({name:r,type:i})}return e.sort(((t,e)=>TR.indexOf(t.name)-TR.indexOf(e.name))),PR.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,r){return ie(["0x1901",PR.hashDomain(t),PR.from(e).hash(r)])}static hash(t,e,r){return mr(PR.encode(t,e,r))}static resolveNames(t,e,r,i){return kR(this,void 0,void 0,(function*(){t=Me(t);const n={};t.verifyingContract&&!Qt(t.verifyingContract,20)&&(n[t.verifyingContract]="0x");const o=PR.from(e);o.visit(r,((t,e)=>("address"!==t||Qt(e,20)||(n[e]="0x"),e)));for(const t in n)n[t]=yield i(t);return t.verifyingContract&&n[t.verifyingContract]&&(t.verifyingContract=n[t.verifyingContract]),r=o.visit(r,((t,e)=>"address"===t&&n[e]?n[e]:e)),{domain:t,value:r}}))}static getPayload(t,e,r){PR.hashDomain(t);const i={},n=[];TR.forEach((e=>{const r=t[e];null!=r&&(i[e]=zR[e](r),n.push({name:e,type:IR[e]}))}));const o=PR.from(e),a=Me(e);return a.EIP712Domain?MR.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):a.EIP712Domain=n,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,((t,e)=>{if(t.match(/^bytes(\d*)/))return te(Jt(e));if(t.match(/^u?int/))return gR.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&MR.throwArgumentError("invalid string","value",e),e}return MR.throwArgumentError("unsupported type","type",t)}))}}}window&&window.__awaiter;new Ft("wallet/5.6.2");function BR(t,e,r,i){return as(PR.hash(t,e,r),i)}const DR="6492649264926492649264926492649264926492649264926492649264926492";function $R(t,e){return t.toLowerCase()===e.toLowerCase()}function LR(t){const{domain:e,types:r,message:i}=t;return hl.hash(e,r,i)}function UR(t,e,i,n){return r(this,void 0,void 0,(function*(){let r;try{r=yield xB(n,["function isValidSignature(bytes32 _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[Jt(i),e]])}catch(t){if(t.message.startsWith("missing revert data in call exception"))return!1;throw t}return $R(r,"0x1626ba7e")}))}function FR(t,e,i,n){return r(this,void 0,void 0,(function*(){return $R(yield xB(n,["function isValidSignature(bytes _hash, bytes memory _signature) public view returns (bytes4 magicValue)"],[t,"isValidSignature",[Jt(i),e]]),"0x20c13b0b")}))}var qR=Object.freeze({__proto__:null,getHash:LR,default:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="1",n={}){const{domain:o,types:a,message:s}=r;try{if($R(t,BR(o,a,s,e)))return!0}catch(t){}const h=QO(i,n),u=LR(r);if(e.endsWith(DR))try{return"0x01"===(yield h.call({data:Wt(["0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",(new Ni).encode(["address","bytes32","bytes"],[t,Jt(u),e])])}))}catch(t){return!1}return!!(yield UR(t,e,u,h))||(yield FR(t,e,u,h))}))}});var VR=["ipfs.snapshot.box","snapshot.4everland.link","ipfs.io","ipfs.fleek.co","gateway.pinata.cloud","dweb.link","ipfs.infura.io"];class HR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"number"==typeof t&&void 0!==(null==e?void 0:e[t-1])}getValidVotes(){return this.votes.filter((t=>HR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>{const r=this.getValidVotes().filter((t=>t.choice===e+1));return r.reduce(((t,e)=>t+e.balance),0)}))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>{const r=this.strategies.map(((t,r)=>{const i=this.getValidVotes().filter((t=>t.choice===e+1));return i.reduce(((t,e)=>t+e.scores[r]),0)}));return r}))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices[this.selected-1]}}class GR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size}getValidVotes(){return this.votes.filter((t=>GR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return this.proposal.choices.map(((t,e)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.balance),0)))}getScoresByStrategy(){return this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().filter((t=>t.choice.includes(e+1))).reduce(((t,e)=>t+e.scores[r]),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected?this.proposal.choices.filter(((t,e)=>this.selected.includes(e+1))).join(", "):""}}function ZR(t,e){const r=t/e.reduce(((t,e)=>t+e),0);return isNaN(r)?0:r}function KR(t,e){return Math.sqrt(t*e)}function JR(t){return t*t}function WR(t,e){return t.map((t=>e*t))}class YR{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>YR.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>{const i=t.map((t=>KR(ZR(t.choice[r+1],Object.values(t.choice)),t.balance))).reduce(((t,e)=>t+e),0);return JR(i)}));return WR(r.map(((t,e)=>ZR(r[e],r))),e)}getScoresByStrategy(){const t=this.getValidVotes(),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0),r=this.proposal.choices.map(((e,r)=>this.strategies.map(((e,i)=>t.map((t=>KR(ZR(t.choice[r+1],Object.values(t.choice)),t.scores[i]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[JR(t)]))));return r.map(((t,i)=>WR(this.strategies.map(((t,e)=>ZR(r[i][e][0],r.flat(2)))),e)))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1]){const r=ZR(this.selected[e+1],Object.values(this.selected));return`${Math.round(1e3*r)/10}% for ${t}`}})).filter((t=>null!=t)).join(", ")}}function QR(t,e){const r=[...new Set(t.map((t=>t[0])).flat())],i=Object.entries(t.reduce(((t,[e],r,i)=>{const n=i[r][1];t[e[0]][0]+=n;const o=i[r][2];return o.length>1?t[e[0]][1]=o.map(((r,i)=>r+t[e[0]][1][i]||r)):t[e[0]][1]=[t[e[0]][1].concat(o).reduce(((t,e)=>t+e),0)],t}),Object.assign({},...r.map((t=>({[t]:[0,[]]})))))),n=i.map((t=>[t[0],t[1][0]])),[o,a]=n.reduce((([t,e],[r,i])=>i>e?[r,i]:[t,e]),["?",-1/0]),[s,h]=n.reduce((([t,e],[r,i])=>i<e?[r,i]:[t,e]),["?",1/0]),u=i.sort(((t,e)=>e[1][0]-t[1][0])),l=t.map((t=>t[1])).reduce(((t,e)=>t+e),0);return e.push({round:e.length+1,sortedByHighest:u}),a>l/2||u.length<3?e:QR(t.map((t=>[t[0].filter((t=>t!=s)),t[1],t[2]])).filter((t=>t[0].length>0)),e)}function XR(t){const e=QR(t.map((t=>[t.choice,t.balance,t.scores])),[]);return e[e.length-1].sortedByHighest}class tP{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return Array.isArray(t)&&t.every((t=>void 0!==(null==e?void 0:e[t-1])))&&t.length===new Set(t).size&&t.length>0&&t.length===e.length}getValidVotes(){return this.votes.filter((t=>tP.isValidChoice(t.choice,this.proposal.choices)))}getScores(){return function(t,e){const r=XR(t);return e.choices.map(((t,e)=>r.filter((t=>Number(t[0])===e+1)).reduce(((t,e)=>t+e[1][0]),0)))}(this.getValidVotes(),this.proposal)}getScoresByStrategy(){const t=XR(this.getValidVotes());return this.proposal.choices.map(((e,r)=>this.strategies.map(((e,i)=>t.filter((t=>Number(t[0])===r+1)).reduce(((t,e)=>t+e[1][1][i]),0)))))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected.map((t=>{if(this.proposal.choices[t-1])return this.proposal.choices[t-1]})).map(((t,e)=>`(${PB(e+1)}) ${t}`)).join(", ")}}class eP{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return!(!Array.isArray(t)||0===t.length||t.length>e.length||new Set(t).size!==t.length)&&t.every((t=>Number.isInteger(t)&&t>=1&&t<=e.length))}getValidVotes(){return this.votes.filter((t=>eP.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.getValidVotes(),e=this.proposal.choices.length,r=Array.from({length:e},(()=>Array(e).fill(0))),i=this.getScoresTotal();for(const e of t)for(let t=0;t<e.choice.length;t++)for(let i=t+1;i<e.choice.length;i++){const n=e.choice[t]-1,o=e.choice[i]-1;r[n][o]+=e.balance,r[o][n]-=e.balance}const n=Array(e).fill(0);let o=0;for(let t=0;t<e;t++)for(let i=0;i<e;i++)if(t!==i){const e=r[t][i];e>0?n[t]++:e<0?n[i]++:(n[t]+=.5,n[i]+=.5)}return o=n.reduce(((t,e)=>t+e),0),o>0?n.map((t=>t/o*i)):n.map((()=>i/e))}getScoresByStrategy(){const t=this.getValidVotes(),e=this.proposal.choices.length,r=this.strategies.length,i=Array.from({length:e},(()=>Array.from({length:e},(()=>Array(r).fill(0))))),n=Array(r).fill(0);for(const e of t)for(let t=0;t<r;t++)n[t]+=e.scores[t];for(const e of t)for(let t=0;t<e.choice.length;t++)for(let n=t+1;n<e.choice.length;n++){const o=e.choice[t]-1,a=e.choice[n]-1;for(let t=0;t<r;t++)i[o][a][t]+=e.scores[t],i[a][o][t]-=e.scores[t]}const o=Array.from({length:e},(()=>Array(r).fill(0)));for(let t=0;t<e;t++)for(let n=0;n<e;n++)if(t!==n)for(let e=0;e<r;e++){const r=i[t][n][e];r>0?o[t][e]++:r<0?o[n][e]++:(o[t][e]+=.5,o[n][e]+=.5)}const a=Array.from({length:e},(()=>Array(r).fill(0)));for(let t=0;t<r;t++){let r=0;for(let i=0;i<e;i++)r+=o[i][t];if(r>0)for(let i=0;i<e;i++)a[i][t]=o[i][t]/r*n[t];else if(n[t]>0)for(let r=0;r<e;r++)a[r][t]=n[t]/e}return a}getScoresTotal(){return this.getValidVotes().reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.selected.map((t=>this.proposal.choices[t-1])).join(", ")}}function rP(t,e,r){const i=r.reduce(((t,e)=>t+e),0),n=e[t]/i*100;return isNaN(n)?0:n}function iP(t,e,r){return rP(t+1,e,Object.values(e))/100*r}class nP{constructor(t,e,r,i){this.proposal=t,this.votes=e,this.strategies=r,this.selected=i}static isValidChoice(t,e){return"object"==typeof t&&!Array.isArray(t)&&null!==t&&Object.keys(t).every((t=>void 0!==(null==e?void 0:e[Number(t)-1])))&&Object.keys(t).length>0&&Object.values(t).every((t=>"number"==typeof t&&t>=0))&&Object.values(t).some((t=>"number"==typeof t&&t>0))}getValidVotes(){return this.votes.filter((t=>nP.isValidChoice(t.choice,this.proposal.choices)))}getScores(){const t=this.proposal.choices.map(((t,e)=>this.getValidVotes().map((t=>iP(e,t.choice,t.balance))).reduce(((t,e)=>t+e),0))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((e,r)=>rP(r,t,t))).map((t=>e/100*t))}getScoresByStrategy(){const t=this.proposal.choices.map(((t,e)=>this.strategies.map(((t,r)=>this.getValidVotes().map((t=>iP(e,t.choice,t.scores[r]))).reduce(((t,e)=>t+e),0))))).map((t=>t.map((t=>[t])))),e=this.getValidVotes().reduce(((t,e)=>t+e.balance),0);return t.map(((r,i)=>this.strategies.map(((e,r)=>rP(0,t[i][r],t.flat(2)))).map((t=>[e/100*t])).flat()))}getScoresTotal(){return this.votes.reduce(((t,e)=>t+e.balance),0)}getChoiceString(){return this.proposal.choices.map(((t,e)=>{if(this.selected[e+1])return`${Math.round(10*rP(e+1,this.selected,Object.values(this.selected)))/10}% for ${t}`})).filter((t=>null!=t)).join(", ")}}var oP={"single-choice":HR,approval:GR,quadratic:YR,"ranked-choice":tP,copeland:eP,weighted:nP,basic:HR};const aP={1:"https://subgrapher.snapshot.org/delegation/1",10:"https://subgrapher.snapshot.org/delegation/10",56:"https://subgrapher.snapshot.org/delegation/56",100:"https://subgrapher.snapshot.org/delegation/100",137:"https://subgrapher.snapshot.org/delegation/137",146:"https://subgrapher.snapshot.org/delegation/146",250:"https://subgrapher.snapshot.org/delegation/250",5e3:"https://subgrapher.snapshot.org/delegation/5000",8453:"https://subgrapher.snapshot.org/delegation/8453",42161:"https://subgrapher.snapshot.org/delegation/42161",59144:"https://subgrapher.snapshot.org/delegation/59144",81457:"https://subgrapher.snapshot.org/delegation/81457",84532:"https://subgrapher.snapshot.org/delegation/84532",11155111:"https://subgrapher.snapshot.org/delegation/11155111"},sP=1e3;function hP(t){return t.length===sP&&t[0].timestamp===t[t.length-1].timestamp}function uP(t,e){const r=function(t){return`${t.delegator}-${t.delegate}-${t.space}`}(e);t.has(r)||t.set(r,e)}function lP(t){const e=["",t];return t.includes(".eth")&&e.push(t.replace(".eth","")),e}function cP(t){return r(this,arguments,void 0,(function*({url:t,spaces:e,pivot:r,snapshot:i}){const n={delegations:{__args:{where:{timestamp_gte:r},first:sP,skip:0,orderBy:"timestamp",orderDirection:"asc"},delegator:!0,space:!0,delegate:!0,timestamp:!0}};return"latest"!==i&&(n.delegations.__args.block={number:i}),null!==e&&(n.delegations.__args.where.space_in=e),(yield SB(t,n)).delegations||[]}))}const dP=["function aggregate(tuple(address target, bytes callData)[] calls) view returns (uint256 blockNumber, bytes[] returnData)"];function fP(t,e){if(!e||!e.outputs||!Array.isArray(t)||0===t.length)return t;const r=e.outputs[0],i=t[0];try{switch(r.type){case"core::felt252":try{return dI.decodeShortString(i)}catch(t){return i}case"core::integer::u8":case"core::integer::u16":case"core::integer::u32":case"core::integer::u64":return parseInt(i,16);case"core::integer::u128":case"core::integer::usize":return BigInt(i).toString();case"core::integer::u256":return dO.uint256ToBN({low:i,high:t[1]||"0x0"});case"core::integer::i8":case"core::integer::i16":case"core::integer::i32":case"core::integer::i64":return parseInt(i,16);case"core::integer::i128":return BigInt(i).toString();case"core::bool":return"0x1"===i||"0x01"===i;default:return i}}catch(e){return t}}const mP=t=>{if(0===t.length)return[];const[e,...r]=t,i=Number(zN.toBigInt(e)),n=r.slice(0,i),o=r.slice(i);return[n,...mP(o)]};var pP="__lodash_hash_undefined__",gP="[object Function]",yP="[object GeneratorFunction]",wP=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,vP=/^\w*$/,bP=/^\./,kP=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,MP=/\\(\\)?/g,_P=/^\[object .+?Constructor\]$/,EP=/^(?:0|[1-9]\d*)$/,AP="object"==typeof i&&i&&i.Object===Object&&i,jP="object"==typeof self&&self&&self.Object===Object&&self,xP=AP||jP||Function("return this")();var SP,NP=Array.prototype,IP=Function.prototype,TP=Object.prototype,CP=xP["__core-js_shared__"],zP=(SP=/[^.]+$/.exec(CP&&CP.keys&&CP.keys.IE_PROTO||""))?"Symbol(src)_1."+SP:"",OP=IP.toString,RP=TP.hasOwnProperty,PP=TP.toString,BP=RegExp("^"+OP.call(RP).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),DP=xP.Symbol,$P=NP.splice,LP=QP(xP,"Map"),UP=QP(Object,"create"),FP=DP?DP.prototype:void 0,qP=FP?FP.toString:void 0;function VP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function HP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function GP(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function ZP(t,e,r){var i=t[e];RP.call(t,e)&&iB(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function KP(t,e){for(var r=t.length;r--;)if(iB(t[r][0],e))return r;return-1}function JP(t){if(!oB(t)||(e=t,zP&&zP in e))return!1;var e,r=function(t){var e=oB(t)?PP.call(t):"";return e==gP||e==yP}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?BP:_P;return r.test(function(t){if(null!=t){try{return OP.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function WP(t,e,r,i){if(!oB(t))return t;e=function(t,e){if(nB(t))return!1;var r=typeof t;if("number"==r||"symbol"==r||"boolean"==r||null==t||aB(t))return!0;return vP.test(t)||!wP.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return nB(t)?t:tB(t)}(e);for(var n=-1,o=e.length,a=o-1,s=t;null!=s&&++n<o;){var h=eB(e[n]),u=r;if(n!=a){var l=s[h];void 0===(u=i?i(l,h,s):void 0)&&(u=oB(l)?l:XP(e[n+1])?[]:{})}ZP(s,h,u),s=s[h]}return t}function YP(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function QP(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return JP(r)?r:void 0}function XP(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||EP.test(t))&&t>-1&&t%1==0&&t<e}VP.prototype.clear=function(){this.__data__=UP?UP(null):{}},VP.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},VP.prototype.get=function(t){var e=this.__data__;if(UP){var r=e[t];return r===pP?void 0:r}return RP.call(e,t)?e[t]:void 0},VP.prototype.has=function(t){var e=this.__data__;return UP?void 0!==e[t]:RP.call(e,t)},VP.prototype.set=function(t,e){return this.__data__[t]=UP&&void 0===e?pP:e,this},HP.prototype.clear=function(){this.__data__=[]},HP.prototype.delete=function(t){var e=this.__data__,r=KP(e,t);return!(r<0)&&(r==e.length-1?e.pop():$P.call(e,r,1),!0)},HP.prototype.get=function(t){var e=this.__data__,r=KP(e,t);return r<0?void 0:e[r][1]},HP.prototype.has=function(t){return KP(this.__data__,t)>-1},HP.prototype.set=function(t,e){var r=this.__data__,i=KP(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},GP.prototype.clear=function(){this.__data__={hash:new VP,map:new(LP||HP),string:new VP}},GP.prototype.delete=function(t){return YP(this,t).delete(t)},GP.prototype.get=function(t){return YP(this,t).get(t)},GP.prototype.has=function(t){return YP(this,t).has(t)},GP.prototype.set=function(t,e){return YP(this,t).set(t,e),this};var tB=rB((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(aB(t))return qP?qP.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var r=[];return bP.test(t)&&r.push(""),t.replace(kP,(function(t,e,i,n){r.push(i?n.replace(MP,"$1"):e||t)})),r}));function eB(t){if("string"==typeof t||aB(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function rB(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var a=t.apply(this,i);return r.cache=o.set(n,a),a};return r.cache=new(rB.Cache||GP),r}function iB(t,e){return t===e||t!=t&&e!=e}rB.Cache=GP;var nB=Array.isArray;function oB(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function aB(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==PP.call(t)}var sB=function(t,e,r){return null==t?t:WP(t,e,r)};const hB={evm:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=new Ss(t,dP,e),s=new $i(r);try{const t=Math.ceil(i.length/n),e=[];Array.from(Array(t)).forEach(((t,r)=>{const h=i.slice(n*r,n*(r+1));e.push(a.aggregate(h.map((t=>[t[0].toLowerCase(),s.encodeFunctionData(t[1],t[2])])),o))}));let r=yield Promise.all(e);return r=r.reduce(((t,[,e])=>t.concat(e)),[]),r.map(((t,e)=>s.decodeFunctionResult(i[e][1],t)))}catch(t){return Promise.reject(t)}}))},starknet:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=i.map((t=>({contractAddress:t[0],entrypoint:t[1],calldata:t[2]||[]}))),s=[];for(let t=0;t<a.length;t+=n)s.push(a.slice(t,t+n));const h=yield Promise.all(s.map((r=>{var i;return e.callContract({contractAddress:t,entrypoint:"aggregate",calldata:nz.fromCallsToExecuteCalldata(r)},null!==(i=o.blockTag)&&void 0!==i?i:"latest")})));return h.map((t=>{const[e,r,...i]=t;return mP(i)})).flat().map(((t,e)=>{const[,n]=i[e];return[fP(t,r.find((t=>t.name===n)))]}))}))}};function uB(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n={}){var o;const a=(null==n?void 0:n.multicallAddress)||JO[t].multicall;if(!a)throw new Error("missing multicall address");const s=Object.assign({},n),h=(null==s?void 0:s.limit)||500;delete s.limit,delete s.multicallAddress;const u=(null===(o=JO[t])||void 0===o?void 0:o.starknet)?"starknet":"evm";return hB[u](a,e,r,i,h,s)}))}const lB=["response not found during CCIP fetch","UNSUPPORTED_OPERATION"],cB="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",dB=["function text(bytes32 node, string calldata key) external view returns (string memory)","function resolver(bytes32 node) view returns (address)"],fB={146:{tlds:[".sonic"],registryContract:"0xde1dadcf11a7447c3d093e97fdbd513f488ce3b4"}},mB=["function ownerOf(uint256 tokenId) view returns (address owner)"],pB=["1","11155111"],gB=["109","157"],yB="0x0000000000000000000000000000000000000000",wB={Accept:"application/json","Content-Type":"application/json"},vB="https://score.snapshot.org";function bB(t=vB,e={path:""}){const r=new URL(t);e.path&&(r.pathname=e.path);const i=r.searchParams.get("apiKey");let n=Object.assign({},wB);return i&&(r.searchParams.delete("apiKey"),n=Object.assign(Object.assign({},wB),{"X-API-KEY":i})),{url:r.toString(),headers:n}}function kB(t){return r(this,void 0,void 0,(function*(){let e=yield t.text();try{e=JSON.parse(e)}catch(r){return Promise.reject({code:t.status||500,message:"Failed to parse response from score API",data:e})}return e.error?Promise.reject(e.error):e}))}const MB=new Fd({allErrors:!0,allowUnionTypes:!0,$data:!0,passContext:!0});Gd(MB),Kd(MB),MB.addFormat("address",{validate:t=>{try{return t===xr(t)}catch(t){return!1}}}),MB.addFormat("evmAddress",{validate:t=>{try{return xr(t),!0}catch(t){return!1}}}),MB.addFormat("starknetAddress",{validate:t=>{try{return gO(t).toLowerCase()===t.toLowerCase()}catch(t){return!1}}}),MB.addFormat("long",{validate:()=>!0}),MB.addFormat("lowercase",{validate:t=>t===t.toLowerCase()}),MB.addFormat("color",{validate:t=>!!t&&!!t.match(/^#[0-9A-F]{6}$/)}),MB.addFormat("ethValue",{validate:t=>{if(!t.match(/^([0-9]|[1-9][0-9]+)(\.[0-9]+)?$/))return!1;try{return function(t,e){if("string"!=typeof t&&Nh.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=Ih.indexOf(e);-1!==t&&(e=3*t)}mh(t,null!=e?e:18)}(t,18),!0}catch(t){return!1}}});const _B=Object.keys(JO),EB=Object.keys(JO).filter((t=>!JO[t].testnet));function AB(t){const e=t.endsWith(".eth"),r=t.split(".");if(1===r.length)return"tld";if(2!==r.length||e){if(r.length>2)return"subdomain";if(e)return"ens";throw new Error("Invalid domain")}return"other-tld"}function jB(t){return r(this,void 0,void 0,(function*(){var e;const r=yield h(`https://cloudflare-dns.com/dns-query?name=${t}&type=TXT`,{headers:{accept:"application/dns-json"}}),i=yield r.json();if(3===i.Status)return yB;if(0!==i.Status)throw new Error("Failed to fetch DNS Owner");const n=null===(e=i.Answer)||void 0===e?void 0:e.find((t=>t.data.includes("ENS1")));return n?xr(n.data.replace(new RegExp('"',"g"),"").split(" ").pop()):yB}))}function xB(t,e,i,n){return r(this,void 0,void 0,(function*(){const r=new Ss(i[0],e,t);try{const t=i[2]||[];return yield r[i[1]](...t,n||{})}catch(t){return Promise.reject(t)}}))}function SB(t,e){return r(this,arguments,void 0,(function*(t,e,r={}){const i={query:ml.jsonToGraphQLQuery({query:e})};r.variables&&(i.variables=r.variables);const n=yield h(t,{method:"POST",headers:Object.assign({Accept:"application/json","Content-Type":"application/json"},null==r?void 0:r.headers),body:JSON.stringify(i)});let o=yield n.text();try{o=JSON.parse(o)}catch(e){throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${o.substring(0,400)}`)}if(o.errors)throw new Error(`Errors found in subgraphRequest: URL: ${t}, Status: ${n.status}, Response: ${JSON.stringify(o.errors).substring(0,400)}`);const{data:a}=o;return a||{}}))}function NB(t,e=VR[0]){const r=`https://${e}`;if(!t)return null;if(!(t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("https://")||t.startsWith("http://")))return`${r}/ipfs/${t}`;const i=t.split("://")[0];return"ipfs"===i?t.replace("ipfs://",`${r}/ipfs/`):"ipns"===i?t.replace("ipns://",`${r}/ipns/`):t}function IB(t,i){return r(this,arguments,void 0,(function*(t,r,i="1",n={}){var o,a;const{ensResolvers:s=(null===(o=JO[i])||void 0===o?void 0:o.ensResolvers)||JO[1].ensResolvers,broviderUrl:h}=n,u=e(n,["ensResolvers","broviderUrl"]);let l;try{l=Ou(zu(t))}catch(t){return null}const c=QO(i,{broviderUrl:h}),d=[[cB,"resolver",[l]],...s.map((t=>[t,"text",[l,r]]))],[[f],...m]=yield uB(i,c,dB,d,u),p=s.indexOf(f);return-1!==p?null===(a=m[p])||void 0===a?void 0:a[0]:null}))}function TB(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){try{return yield IB(t,"snapshot",e,r)}catch(t){return console.log(t),null}}))}function CB(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){var i,n;if(!(null===(n=null===(i=JO[e])||void 0===i?void 0:i.ensResolvers)||void 0===n?void 0:n.length))throw new Error("Network not supported");const o=AB(t),a=QO(e,r),s=new Ss(cB,["function owner(bytes32) view returns (address)"],a);let h;try{h=Ou(zu(t))}catch(t){return yB}const u=r.ensNameWrapper||JO[e].ensNameWrapper;let l=yield s.owner(h);if(l===u){const t=new Ss(u,["function ownerOf(uint256) view returns (address)"],a);l=yield t.ownerOf(h)}if(l===yB&&"other-tld"===o){(yield a.resolveName(t))&&(l=yield jB(t))}if(l===yB&&"subdomain"===o)try{l=yield a.resolveName(t)}catch(t){if(lB.every((e=>!t.message.includes(e))))throw t;l=yB}return l||yB}))}function zB(t,e){return r(this,arguments,void 0,(function*(t,e,r={}){const i=yield TB(t,e,r);if(i){let t=Sr(i);if(t)return i;const e=i.split("/"),r=e.includes("testnet")?5:4,n=e[r];if(t=Sr(n),t)return n}return yield CB(t,e,r)}))}function OB(t,e){return r(this,void 0,void 0,(function*(){if(!t.endsWith(".shib"))return yB;const r=yield h("https://stamp.fyi",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"get_owner",params:t,network:e})});return(yield r.json()).result}))}function RB(t,e){return r(this,void 0,void 0,(function*(){var r;if(!((null===(r=fB[e])||void 0===r?void 0:r.tlds)||[]).some((e=>t.endsWith(e))))return Promise.resolve(yB);try{const r=Ou(zu(t)),i=BigInt(r),n=QO(e);return yield xB(n,mB,[fB[e].registryContract,"ownerOf",[i]],{blockTag:"latest"})}catch(t){return yB}}))}function PB(t){const e=["th","st","nd","rd"],r=t%100;return t+(e[(r-20)%10]||e[r]||e[0])}function BB(t){return!!JO[t]}function DB(t){return t!==yB&&(Sr(t)||LB(t))}function $B(t,e){return"latest"===t||"number"==typeof t&&t>=JO[e].start}function LB(t){if(!t)return!1;try{return gO(t),!0}catch(t){return!1}}function UB(t){return Sr(t)}function FB(t,e){if("string"!=typeof t||!/^0[xX]/.test(t))throw new Error(`Invalid address: ${t}`);const r=null!=e?e:42===t.length?"evm":"starknet";if("evm"===r&&UB(t))return xr(t);if("starknet"===r&&LB(t))return gO(t);throw new Error(`Invalid ${r} address: ${t}`)}function qB(t){return Promise.reject(new Error(t))}MB.addKeyword({keyword:"snapshotNetwork",validate:function(t,e){return"mainnet"===(this.snapshotEnv||"default")?EB.includes(e):_B.includes(e)},error:{message:"network not allowed"}}),MB.addFormat("customUrl",{type:"string",validate:t=>!t.length||(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("ipfs://")||t.startsWith("ipns://")||t.startsWith("snapshot://"))}),MB.addFormat("domain",{validate:t=>!!t&&!!t.match(/^(https:\/\/)?([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}(\/)?$/)});var VB={call:xB,multicall:uB,subgraphRequest:SB,ipfsGet:function(t,e){return r(this,arguments,void 0,(function*(t,e,r="ipfs"){return h(`https://${t}/${r}/${e}`).then((t=>t.json()))}))},getUrl:NB,getJSON:function(t){return r(this,arguments,void 0,(function*(t,e={}){const r=NB(t,e.gateways);return h(r).then((t=>t.json()))}))},sendTransaction:function(t,e,i,n,o){return r(this,arguments,void 0,(function*(t,e,r,i,n,o={}){const a=t.getSigner(),s=new Ss(e,r,t).connect(a);return yield s[i](...n,o)}))},getScores:function(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n="latest",o=vB,a={}){if(!Array.isArray(i))return qB("addresses should be an array of addresses");if(0===i.length)return qB("addresses can not be empty");const s=i.find((t=>!DB(t)));if(s)return qB(`Invalid address: ${s}`);if(!BB(r))return qB(`Invalid network: ${r}`);const u=e.find((t=>t.network&&!BB(t.network)));if(u)return qB(`Invalid network (${u.network}) in strategy ${u.name}`);if(!$B(n,r))return qB(`Snapshot (${n}) must be 'latest' or greater than network start block (${JO[r].start})`);new URL(o).pathname="/api/scores";const{url:l,headers:c}=bB(o,{path:"/api/scores"});try{const o={space:t,network:r,snapshot:n,strategies:e,addresses:i},s=yield h(l,{method:"POST",headers:c,body:JSON.stringify({params:o})}),u=yield kB(s);return"all"===a.returnValue?u.result:u.result[a.returnValue||"scores"]}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},getVp:function(t,e,i,n,o,a,s){return r(this,void 0,void 0,(function*(){const{url:r,headers:u}=bB(null==s?void 0:s.url);if(!DB(t))return qB(`Invalid voter address: ${t}`);if(!BB(e))return qB(`Invalid network: ${e}`);const l=i.find((t=>t.network&&!BB(t.network)));if(l)return qB(`Invalid network (${l.network}) in strategy ${l.name}`);if(!$B(n,e))return qB(`Snapshot (${n}) must be 'latest' or greater than network start block (${JO[e].start})`);const c={method:"POST",headers:u,body:JSON.stringify({jsonrpc:"2.0",method:"get_vp",params:{address:t,network:e,strategies:i,snapshot:n,space:o,delegation:a}})};try{const t=yield h(r,c);return(yield kB(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},validateSchema:function(t,e,r={snapshotEnv:"default",spaceType:"default"}){const i=MB.compile(t),n=i.call(r,e);return n||i.errors},getEnsTextRecord:IB,getSpaceUri:TB,getEnsOwner:CB,getSpaceController:function(t){return r(this,arguments,void 0,(function*(t,e="1",r={}){if(pB.includes(e))return zB(t,e,r);if(gB.includes(e))return OB(t,e);if(fB[String(e)])return RB(t,e);throw new Error(`Network not supported: ${e}`)}))},getDelegatesBySpace:function(t,e){return r(this,arguments,void 0,(function*(t,e,r="latest",i={}){const n=i.subgraphUrl||aP[t];if(!n)return Promise.reject(`Delegation subgraph not available for network ${t}`);let o=0;const a=new Map,s=e?lP(e):null;for(;;){const t=yield cP({url:n,spaces:s,pivot:o,snapshot:r});if(hP(t))throw new Error("Unable to paginate delegation");if(t.forEach((t=>{uP(a,t),o=t.timestamp})),t.length<sP)break}return[...a.values()]}))},clone:function(t){return JSON.parse(JSON.stringify(t))},sleep:function(t){return r(this,void 0,void 0,(function*(){return new Promise((e=>{setTimeout(e,t)}))}))},getNumberWithOrdinal:PB,voting:oP,getProvider:QO,signMessage:function(t,e,i){return r(this,void 0,void 0,(function*(){return e=te(new G(e,"utf8")),yield t.send("personal_sign",[e,i])}))},getBlockNumber:function(t){return r(this,void 0,void 0,(function*(){try{const e=yield t.getBlockNumber();return parseInt(e)}catch(t){return Promise.reject()}}))},Multicaller:class{constructor(t,e,r,i={}){this.options={},this.calls=[],this.paths=[],this.network=t,this.provider=e,this.abi=r,this.options=i}call(t,e,r,i){return this.calls.push([e,r,i]),this.paths.push(t),this}execute(t){return r(this,void 0,void 0,(function*(){const e=t||{};return(yield uB(this.network,this.provider,this.abi,this.calls,this.options)).forEach(((t,r)=>sB(e,this.paths[r],t.length>1?t:t[0]))),this.calls=[],this.paths=[],e}))}},getSnapshots:function(t,e,i,n){return r(this,arguments,void 0,(function*(t,e,r,i,n={}){const o={};if(i.forEach((t=>o[t]="latest")),"latest"===e)return o;const a=`${t}-${e}-${i.join("-")}`,s=Jd[a],h=Date.now();if(s&&Wd>h)return s;Wd<h&&(Jd={},Wd=h+36e5-h%36e5),o[t]=e;const u=Object.keys(o).filter((e=>t!==e));if(0===u.length)return o;const l={blocks:{__args:{where:{ts:(yield r.getBlock(e)).timestamp,network_in:u}},network:!0,number:!0}},c=n.blockFinderUrl||"https://blockfinder.snapshot.org";return(yield SB(c,l)).blocks.forEach((t=>o[t.network]=t.number)),Jd[a]=o,o}))},getHash:function(t,e){return(aR(t)?hR:qR).getHash(t,e)},verify:function(t,e,i){return r(this,arguments,void 0,(function*(t,e,r,i="1",n={}){if(!LB(t)&&!UB(t))throw new Error("Invalid address");const o=aR(r)?hR:qR;return yield o.default(t,e,r,i,n)}))},validate:function(t,e,i,n,o,a,s){return r(this,void 0,void 0,(function*(){if(!DB(e))return qB(`Invalid author: ${e}`);if(!BB(n))return qB(`Invalid network: ${n}`);if(!$B(o,n))return qB(`Snapshot (${o}) must be 'latest' or greater than network start block (${JO[n].start})`);s||(s={});const{url:r,headers:u}=bB(s.url),l={method:"POST",headers:u,body:JSON.stringify({jsonrpc:"2.0",method:"validate",params:{validation:t,author:e,space:i,network:n,snapshot:o,params:a}})};try{const t=yield h(r,l);return(yield kB(t)).result}catch(t){return t.errno?Promise.reject({code:t.errno,message:t.toString(),data:""}):Promise.reject(t)}}))},isStarknetAddress:LB,isEvmAddress:UB,getFormattedAddress:FB,SNAPSHOT_SUBGRAPH_URL:aP};const HB={name:"snapshot",version:"0.1.4"};class GB{constructor(t=N.sequencer,e={}){t=(t=(t=t.replace(N.hub,N.sequencer)).replace(I.hub,I.sequencer)).replace(T.hub,T.sequencer),this.address=t,this.options=e}sign(t,e,i,n){return r(this,void 0,void 0,(function*(){var r;const o=(null==t?void 0:t.getSigner)?t.getSigner():t,a=FB(e,"evm");i.from=i.from?FB(i.from):a,i.timestamp||(i.timestamp=parseInt((Date.now()/1e3).toFixed()));const s=Object.assign({},HB);"undefined"!=typeof window&&(null===(r=window.ethereum)||void 0===r?void 0:r.isTrust)&&(s.chainId=(yield o.provider.getNetwork()).chainId);const h={domain:s,types:n,message:i},u=yield o._signTypedData(s,h.types,i);return yield this.send({address:a,sig:u,data:h})}))}send(t){return r(this,void 0,void 0,(function*(){let e=this.address;"0x"===t.sig&&this.options.relayerURL&&(e=this.options.relayerURL);const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)};return new Promise(((t,i)=>{h(e,r).then((e=>{var r;if(e.ok)return t(e.json());if(null===(r=e.headers.get("content-type"))||void 0===r?void 0:r.includes("application/json"))return e.json().then(i).catch(i);throw e})).catch(i)}))}))}space(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,u)}))}proposal(t,e,i){return r(this,void 0,void 0,(function*(){return i.labels||(i.labels=[]),i.discussion||(i.discussion=""),i.app||(i.app=""),i.privacy||(i.privacy=""),yield this.sign(t,e,i,l)}))}updateProposal(t,e,i){return r(this,void 0,void 0,(function*(){return i.privacy||(i.privacy=""),yield this.sign(t,e,i,c)}))}flagProposal(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,d)}))}cancelProposal(t,e,i){return r(this,void 0,void 0,(function*(){const r=i.proposal.startsWith("0x");return yield this.sign(t,e,i,r?m:f)}))}vote(t,e,i){return r(this,void 0,void 0,(function*(){const r="shutter"===(null==i?void 0:i.privacy);i.reason||(i.reason=""),i.app||(i.app=""),i.metadata||(i.metadata="{}");const n=i.proposal.startsWith("0x");let o=n?w:p;return["approval","ranked-choice"].includes(i.type)&&(o=n?v:g),!r&&["quadratic","weighted"].includes(i.type)&&(o=n?b:y,i.choice=JSON.stringify(i.choice)),r&&(o=n?b:y),delete i.privacy,delete i.type,yield this.sign(t,e,i,o)}))}follow(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,k)}))}unfollow(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,M)}))}subscribe(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,_)}))}unsubscribe(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,E)}))}profile(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,A)}))}statement(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,j)}))}alias(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,x)}))}deleteSpace(t,e,i){return r(this,void 0,void 0,(function*(){return yield this.sign(t,e,i,S)}))}}var ZB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Proposal",definitions:{Proposal:{title:"Proposal",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{type:"string",enum:["single-choice","approval","ranked-choice","quadratic","copeland","weighted","custom","basic"]},snapshot:{type:"number",title:"snapshot"},start:{type:"number",title:"start",minimum:1e9,maximum:2e9},end:{type:"number",title:"end",minimum:1e9,maximum:2e9},metadata:{type:"object",title:"metadata"},app:{type:"string",title:"app",maxLength:24},privacy:{type:"string",enum:["","shutter"]}},required:["name","body","choices","snapshot","start","end"],additionalProperties:!1}}},KB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/UpdateProposal",definitions:{UpdateProposal:{title:"Update Proposal",type:"object",properties:{proposal:{type:"string",title:"proposal id"},name:{type:"string",title:"name",minLength:1,maxLength:256},body:{type:"string",title:"body",minLength:0},discussion:{type:"string",format:"customUrl",title:"discussion",maxLength:256},choices:{type:"array",title:"choices",minItems:1},labels:{type:"array",title:"labels",maxItems:10,uniqueItems:!0,items:{type:"string",minLength:1,maxLength:8,pattern:"^[a-zA-Z0-9]+$"}},type:{enum:["single-choice","approval","ranked-choice","quadratic","weighted","custom","basic"]},metadata:{type:"object",title:"metadata"},privacy:{type:"string",enum:["","shutter"]}},required:["proposal","name","body","discussion","choices","type","metadata"],additionalProperties:!1}}},JB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Vote",definitions:{Vote:{title:"Vote",type:"object",properties:{proposal:{type:"string",title:"proposal"},choice:{type:["number","array","object","boolean","string"],title:"choice"},metadata:{type:"object",title:"metadata"},reason:{type:"string",title:"reason",maxLength:5e3},app:{type:"string",title:"app",maxLength:24}},required:["proposal","choice"],additionalProperties:!1}}},WB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Profile",definitions:{Profile:{title:"Profile",type:"object",properties:{name:{type:"string",title:"name",maxLength:32},about:{type:"string",title:"about",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},lens:{type:"string",title:"lens",pattern:"^[A-Za-z0-9_]*$",maxLength:26},farcaster:{type:"string",title:"farcaster",pattern:"^[a-z0-9-]*$",maxLength:17}},required:[],additionalProperties:!1}}},YB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Statement",definitions:{Statement:{title:"Statement",type:"object",properties:{about:{type:"string",format:"long",title:"About",maxLength:140},statement:{type:"string",format:"long",title:"Statement",maxLength:1e4},discourse:{type:"string",title:"discourse",pattern:"^[A-Za-z0-9-_.]*$",maxLength:30},network:{type:"string",title:"network",pattern:"^[a-z0-9-]*$",maxLength:24},status:{enum:["ACTIVE","INACTIVE"],title:"status"}},required:[],additionalProperties:!1}}},QB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Zodiac",definitions:{Zodiac:{title:"Zodiac",type:"object",properties:{safes:{title:"Safe(s)",type:"array",maxItems:8,items:{type:"object",properties:{network:{title:"Network",type:"string",snapshotNetwork:!0},multisend:{title:"Multisend contract address",type:"string"},realityAddress:{title:"Reality module address",type:"string"},umaAddress:{title:"UMA module address",type:"string"}},additionalProperties:!1}},additionalProperties:!1}}}},XB={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Alias",definitions:{Alias:{title:"Alias",type:"object",properties:{alias:{type:"string",format:"address"}},required:["alias"],additionalProperties:!1}}};return{Client:GB,Client712:GB,schemas:{space:{$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/Space",definitions:{Space:{title:"Space",type:"object",properties:{name:{type:"string",title:"name",minLength:1,maxLength:32},private:{type:"boolean"},about:{type:"string",title:"about",maxLength:160},guidelines:{type:"string",format:"customUrl",title:"guidelines",maxLength:256},template:{type:"string",title:"template",maxLength:1024},terms:{type:"string",title:"terms",format:"customUrl",maxLength:256},avatar:{type:"string",title:"avatar",format:"customUrl",maxLength:256},cover:{type:"string",title:"avatar",format:"customUrl",maxLength:256},location:{type:"string",title:"location",maxLength:24},website:{type:"string",title:"website",format:"customUrl",maxLength:256},twitter:{type:"string",title:"twitter",pattern:"^[A-Za-z0-9_]*$",maxLength:15},coingecko:{type:"string",title:"coingecko",pattern:"^[a-z0-9-]*$",maxLength:32},github:{type:"string",title:"github",pattern:"^[A-Za-z0-9_-]*$",maxLength:39},farcaster:{type:"string",title:"farcaster"},email:{type:"string",title:"email",maxLength:32},network:{type:"string",snapshotNetwork:!0,title:"network",minLength:1},symbol:{type:"string",title:"symbol",maxLength:16},skin:{type:"string",title:"skin",maxLength:32},domain:{type:"string",title:"domain",maxLength:64,format:"domain"},discussions:{type:"string",format:"uri",title:"Discussions link",maxLength:256},discourseCategory:{type:"integer",minimum:1,title:"Discourse category"},strategies:{type:"array",minItems:1,uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},network:{type:"string",title:"network",snapshotNetwork:!0},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},title:"strategies"},members:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"members",uniqueItems:!0},admins:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"admins",uniqueItems:!0},moderators:{type:"array",maxItems:100,items:{type:"string",anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid address"},title:"moderators",uniqueItems:!0},filters:{type:"object",properties:{defaultTab:{type:"string"},minScore:{type:"number",minimum:0},onlyMembers:{type:"boolean"},invalids:{type:"array",items:{type:"string",maxLength:64},title:"invalids"}},additionalProperties:!1},validation:{type:"object",properties:{name:{type:"string",maxLength:64,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},voteValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},followValidation:{type:"object",properties:{name:{type:"string",maxLength:32,title:"name"},params:{type:"object",title:"params"}},required:["name"],additionalProperties:!1},delegationPortal:{type:"object",properties:{delegationType:{type:"string",title:"Delegation type",description:"Specify the type of delegation that you are using",anyOf:[{const:"compound-governor",title:"Compound governor"},{const:"split-delegation",title:"Split Delegation"},{const:"apechain-delegate-registry",title:"ApeChain Delegate Registry"}]},delegationContract:{type:"string",title:"Contract address",description:"The address of your delegation contract",examples:["0x3901D0fDe202aF1427216b79f5243f8A022d68cf"],anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},delegationNetwork:{type:"string",title:"Delegation network",description:"The network of your delegation contract",snapshotNetwork:!0},delegationApi:{type:"string",format:"uri",title:"Delegation API",description:"The URL of your delegation API (e.g a subgraph)",examples:["https://subgrapher.snapshot.org/subgraph/arbitrum/FTzC6VrZd8JhJgWfTJnwWgH1Z1dS3GxaosKkRbCqkZAZ"]}},required:["delegationType","delegationApi","delegationContract"],additionalProperties:!1},allowAlias:{type:"boolean"},plugins:{type:"object"},voting:{type:"object",properties:{delay:{type:"integer",minimum:0,maximum:2592e3,errorMessage:{maximum:"Delay must be less than 30 days"}},period:{type:"integer",minimum:0,maximum:31622400,errorMessage:{maximum:"Delay must be less than a year"}},type:{type:"string",title:"type"},quorum:{type:"number",minimum:0},quorumType:{type:"string",enum:["rejection"]},blind:{type:"boolean"},hideAbstain:{type:"boolean"},aliased:{type:"boolean"},privacy:{type:"string",enum:["","shutter","any"]}},additionalProperties:!1},categories:{type:"array",maxItems:2,items:{type:"string",enum:["protocol","social","investment","grant","service","media","creator","collector","ai-agent","gaming","wallet","music","layer-2","defai","defi","rwa","depin","meme"]}},treasuries:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{name:{type:"string",title:"Name",examples:["e.g. Balancer DAO 1"],minLength:1,maxLength:64},address:{type:"string",title:"Contract address",examples:["e.g. 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],anyOf:[{type:"string",format:"evmAddress"},{type:"string",format:"starknetAddress"}],errorMessage:"Must be a valid EVM of Starknet address"},network:{type:"string",title:"Network",snapshotNetwork:!0}},required:["name","address","network"],additionalProperties:!1}},labels:{type:"array",maxItems:10,uniqueItems:!0,items:{type:"object",properties:{id:{type:"string",title:"Id",minLength:1,maxLength:8},name:{type:"string",title:"Name",minLength:1,maxLength:32},description:{type:"string",title:"Description",maxLength:100},color:{type:"string",title:"Color",format:"color"}},required:["id","name","color"],additionalProperties:!1}},parent:{type:"string",title:"parent"},children:{type:"array",maxItems:16,title:"children",items:{type:"string"},uniqueItems:!0},boost:{type:"object",properties:{enabled:{type:"boolean"},bribeEnabled:{type:"boolean"}},required:["enabled","bribeEnabled"],additionalProperties:!1},skinSettings:{type:"object",properties:{bg_color:{type:"string",format:"color"},link_color:{type:"string",format:"color"},text_color:{type:"string",format:"color"},content_color:{type:"string",format:"color"},border_color:{type:"string",format:"color"},heading_color:{type:"string",format:"color"},primary_color:{type:"string",format:"color"},header_color:{type:"string",format:"color"},theme:{type:"string",enum:["light","dark"]},logo:{type:"string",title:"logo",format:"customUrl",maxLength:256}},additionalProperties:!1}},required:["name","network","strategies"],additionalProperties:!1}}}.definitions.Space,proposal:ZB.definitions.Proposal,updateProposal:KB.definitions.UpdateProposal,vote:JB.definitions.Vote,profile:WB.definitions.Profile,statement:YB.definitions.Statement,zodiac:QB.definitions.Zodiac,alias:XB.definitions.Alias},utils:VB}}));