@boostxyz/cli 5.0.7 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ccip-5qPuVSlX.cjs → ccip-BKtQCYbq.cjs} +1 -1
- package/dist/{ccip-BmAT9pAw.js → ccip-CS9Qngig.js} +1 -1
- package/dist/cli.cjs +2 -2
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +55 -55
- package/dist/commands/deploy.cjs +14 -14
- package/dist/commands/deploy.d.ts +23 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +158 -158
- package/dist/commands/seed.cjs +1 -1
- package/dist/commands/seed.d.ts +1251 -0
- package/dist/commands/seed.d.ts.map +1 -0
- package/dist/commands/seed.js +19 -15
- package/dist/help.d.ts +3 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/seed-BtP-9KaP.cjs +35 -0
- package/dist/{seed-D3rLsa0v.js → seed-DyYeHsUg.js} +7377 -7272
- package/dist/utils.d.ts +67 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/seed-BsgCaY_s.cjs +0 -35
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";const ya=require("node:fs/promises"),ba=require("node:path"),N=require("@boostxyz/sdk"),G=require("./utils-dz3mUqTs.cjs");function Pn(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let n,r;if(Array.isArray(t)&&Array.isArray(e)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Pn(t[r],e[r]))return!1;return!0}if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const s=Object.keys(t);if(n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(a&&!Pn(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}class ga extends G.BaseError$1{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function va(t,e){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(t))throw new ga({value:t});let[n,r="0"]=t.split(".");const s=n.startsWith("-");if(s&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),e===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>e){const[a,i,o]=[r.slice(0,e-1),r.slice(e-1,e),r.slice(e)],u=Math.round(+`${i}.${o}`);u>9?r=`${BigInt(a)+BigInt(1)}0`.padStart(a.length+1,"0"):r=`${a}${u}`,r.length>e&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,e)}else r=r.padEnd(e,"0");return BigInt(`${s?"-":""}${n}${r}`)}function Dr(t,e="wei"){return va(t,G.etherUnits[e])}const _r="0x0000000000000000000000000000000000000000";var $;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})($||($={}));var En;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(En||(En={}));const g=$.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),me=t=>{switch(typeof t){case"undefined":return g.undefined;case"string":return g.string;case"number":return isNaN(t)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(t)?g.array:t===null?g.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?g.promise:typeof Map<"u"&&t instanceof Map?g.map:typeof Set<"u"&&t instanceof Set?g.set:typeof Date<"u"&&t instanceof Date?g.date:g.object;default:return g.unknown}},h=$.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),wa=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class K extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return s(this),r}static assert(e){if(!(e instanceof K))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,$.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}K.create=t=>new K(t);const He=(t,e)=>{let n;switch(t.code){case h.invalid_type:t.received===g.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case h.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,$.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:n=`Unrecognized key(s) in object: ${$.joinValues(t.keys,", ")}`;break;case h.invalid_union:n="Invalid input";break;case h.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${$.joinValues(t.options)}`;break;case h.invalid_enum_value:n=`Invalid enum value. Expected ${$.joinValues(t.options)}, received '${t.received}'`;break;case h.invalid_arguments:n="Invalid function arguments";break;case h.invalid_return_type:n="Invalid function return type";break;case h.invalid_date:n="Invalid date";break;case h.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:$.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case h.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case h.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case h.custom:n="Invalid input";break;case h.invalid_intersection_types:n="Intersection results could not be merged";break;case h.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case h.not_finite:n="Number must be finite";break;default:n=e.defaultError,$.assertNever(t)}return{message:n}};let Zr=He;function xa(t){Zr=t}function Ut(){return Zr}const Gt=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const u=r.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},_a=[];function b(t,e){const n=Ut(),r=Gt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===He?void 0:He].filter(s=>!!s)});t.common.issues.push(r)}class L{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return _;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const a=await s.key,i=await s.value;r.push({key:a,value:i})}return L.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return _;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const _=Object.freeze({status:"aborted"}),De=t=>({status:"dirty",value:t}),Z=t=>({status:"valid",value:t}),An=t=>t.status==="aborted",Cn=t=>t.status==="dirty",Re=t=>t.status==="valid",ot=t=>typeof Promise<"u"&&t instanceof Promise;function Ht(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Vr(t,e,n,r,s){if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var w;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(w||(w={}));var st,at;class ce{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Pr=(t,e)=>{if(Re(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new K(t.common.issues);return this._error=n,this._error}}};function E(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{var u,c;const{message:d}=t;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:(u=d??r)!==null&&u!==void 0?u:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(c=d??n)!==null&&c!==void 0?c:o.defaultError}},description:s}}class T{get description(){return this._def.description}_getType(e){return me(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new L,ctx:{common:e.parent.common,data:e.data,parsedType:me(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(ot(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Pr(s,a)}"~validate"(e){var n,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return Re(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((r=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>Re(a)?{value:a.value}:{issues:s.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:me(e)},s=this._parse({data:e,path:r.path,parent:r}),a=await(ot(s)?s:Promise.resolve(s));return Pr(r,a)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:h.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new se({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return oe.create(this,this._def)}nullable(){return Ce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this)}promise(){return We.create(this,this._def)}or(e){return lt.create([this,e],this._def)}and(e){return ft.create(this,e,this._def)}transform(e){return new se({...E(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new bt({...E(this._def),innerType:this,defaultValue:n,typeName:x.ZodDefault})}brand(){return new Gn({typeName:x.ZodBranded,type:this,...E(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new gt({...E(this._def),innerType:this,catchValue:n,typeName:x.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Nt.create(this,e)}readonly(){return vt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Pa=/^c[^\s-]{8,}$/i,Ea=/^[0-9a-z]+$/,Aa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ca=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ta=/^[a-z0-9_-]{21}$/i,ka=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$a=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Sa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ia="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let pn;const Ra=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Oa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ma=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ja=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ba=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Na=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ur="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Fa=new RegExp(`^${Ur}$`);function Gr(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function za(t){return new RegExp(`^${Gr(t)}$`)}function Hr(t){let e=`${Ur}T${Gr(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function La(t,e){return!!((e==="v4"||!e)&&Ra.test(t)||(e==="v6"||!e)&&Ma.test(t))}function Da(t,e){if(!ka.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function Za(t,e){return!!((e==="v4"||!e)&&Oa.test(t)||(e==="v6"||!e)&&ja.test(t))}class ne extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const a=this._getOrReturnCtx(e);return b(a,{code:h.invalid_type,expected:g.string,received:a.parsedType}),_}const r=new L;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:h.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:h.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?b(s,{code:h.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&b(s,{code:h.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Sa.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"email",code:h.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")pn||(pn=new RegExp(Ia,"u")),pn.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"emoji",code:h.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Ca.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"uuid",code:h.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Ta.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"nanoid",code:h.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Pa.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"cuid",code:h.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Ea.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"cuid2",code:h.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Aa.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"ulid",code:h.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),b(s,{validation:"url",code:h.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"regex",code:h.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),b(s,{code:h.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),b(s,{code:h.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),b(s,{code:h.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Hr(a).test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:h.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Fa.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:h.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?za(a).test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{code:h.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?$a.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"duration",code:h.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?La(e.data,a.version)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"ip",code:h.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?Da(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"jwt",code:h.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Za(e.data,a.version)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"cidr",code:h.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?Ba.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"base64",code:h.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?Na.test(e.data)||(s=this._getOrReturnCtx(e,s),b(s,{validation:"base64url",code:h.invalid_string,message:a.message}),r.dirty()):$.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:h.invalid_string,...w.errToObj(r)})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...w.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...w.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...w.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...w.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...w.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...w.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...w.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...w.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...w.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...w.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...w.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...w.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...w.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...w.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...w.errToObj(n)})}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new ne({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ne({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ne({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}ne.create=t=>{var e;return new ne({checks:[],typeName:x.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...E(t)})};function Va(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=parseInt(t.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class Pe extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const a=this._getOrReturnCtx(e);return b(a,{code:h.invalid_type,expected:g.number,received:a.parsedType}),_}let r;const s=new L;for(const a of this._def.checks)a.kind==="int"?$.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),b(r,{code:h.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:h.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:h.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Va(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),b(r,{code:h.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),b(r,{code:h.not_finite,message:a.message}),s.dirty()):$.assertNever(a);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new Pe({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]})}_addCheck(e){return new Pe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&$.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Pe.create=t=>new Pe({checks:[],typeName:x.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...E(t)});class Ee extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let r;const s=new L;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:h.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),b(r,{code:h.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),b(r,{code:h.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):$.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return b(n,{code:h.invalid_type,expected:g.bigint,received:n.parsedType}),_}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new Ee({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]})}_addCheck(e){return new Ee({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Ee.create=t=>{var e;return new Ee({checks:[],typeName:x.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...E(t)})};class ct extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const r=this._getOrReturnCtx(e);return b(r,{code:h.invalid_type,expected:g.boolean,received:r.parsedType}),_}return Z(e.data)}}ct.create=t=>new ct({typeName:x.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...E(t)});class Oe extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const a=this._getOrReturnCtx(e);return b(a,{code:h.invalid_type,expected:g.date,received:a.parsedType}),_}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return b(a,{code:h.invalid_date}),_}const r=new L;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:h.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),b(s,{code:h.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):$.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Oe({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Oe.create=t=>new Oe({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:x.ZodDate,...E(t)});class qt extends T{_parse(e){if(this._getType(e)!==g.symbol){const r=this._getOrReturnCtx(e);return b(r,{code:h.invalid_type,expected:g.symbol,received:r.parsedType}),_}return Z(e.data)}}qt.create=t=>new qt({typeName:x.ZodSymbol,...E(t)});class ut extends T{_parse(e){if(this._getType(e)!==g.undefined){const r=this._getOrReturnCtx(e);return b(r,{code:h.invalid_type,expected:g.undefined,received:r.parsedType}),_}return Z(e.data)}}ut.create=t=>new ut({typeName:x.ZodUndefined,...E(t)});class dt extends T{_parse(e){if(this._getType(e)!==g.null){const r=this._getOrReturnCtx(e);return b(r,{code:h.invalid_type,expected:g.null,received:r.parsedType}),_}return Z(e.data)}}dt.create=t=>new dt({typeName:x.ZodNull,...E(t)});class qe extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}qe.create=t=>new qe({typeName:x.ZodAny,...E(t)});class Ie extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}Ie.create=t=>new Ie({typeName:x.ZodUnknown,...E(t)});class be extends T{_parse(e){const n=this._getOrReturnCtx(e);return b(n,{code:h.invalid_type,expected:g.never,received:n.parsedType}),_}}be.create=t=>new be({typeName:x.ZodNever,...E(t)});class Wt extends T{_parse(e){if(this._getType(e)!==g.undefined){const r=this._getOrReturnCtx(e);return b(r,{code:h.invalid_type,expected:g.void,received:r.parsedType}),_}return Z(e.data)}}Wt.create=t=>new Wt({typeName:x.ZodVoid,...E(t)});class re extends T{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==g.array)return b(n,{code:h.invalid_type,expected:g.array,received:n.parsedType}),_;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,o=n.data.length<s.exactLength.value;(i||o)&&(b(n,{code:i?h.too_big:h.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(b(n,{code:h.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(b(n,{code:h.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>s.type._parseAsync(new ce(n,i,n.path,o)))).then(i=>L.mergeArray(r,i));const a=[...n.data].map((i,o)=>s.type._parseSync(new ce(n,i,n.path,o)));return L.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new re({...this._def,minLength:{value:e,message:w.toString(n)}})}max(e,n){return new re({...this._def,maxLength:{value:e,message:w.toString(n)}})}length(e,n){return new re({...this._def,exactLength:{value:e,message:w.toString(n)}})}nonempty(e){return this.min(1,e)}}re.create=(t,e)=>new re({type:t,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...E(e)});function Le(t){if(t instanceof j){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=oe.create(Le(r))}return new j({...t._def,shape:()=>e})}else return t instanceof re?new re({...t._def,type:Le(t.element)}):t instanceof oe?oe.create(Le(t.unwrap())):t instanceof Ce?Ce.create(Le(t.unwrap())):t instanceof ue?ue.create(t.items.map(e=>Le(e))):t}class j extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=$.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==g.object){const c=this._getOrReturnCtx(e);return b(c,{code:h.invalid_type,expected:g.object,received:c.parsedType}),_}const{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof be&&this._def.unknownKeys==="strip"))for(const c in s.data)i.includes(c)||o.push(c);const u=[];for(const c of i){const d=a[c],l=s.data[c];u.push({key:{status:"valid",value:c},value:d._parse(new ce(s,l,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof be){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of o)u.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(c==="strict")o.length>0&&(b(s,{code:h.unrecognized_keys,keys:o}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of o){const l=s.data[d];u.push({key:{status:"valid",value:d},value:c._parse(new ce(s,l,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of u){const l=await d.key,f=await d.value;c.push({key:l,value:f,alwaysSet:d.alwaysSet})}return c}).then(c=>L.mergeObjectSync(r,c)):L.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new j({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=w.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new j({...this._def,unknownKeys:"strip"})}passthrough(){return new j({...this._def,unknownKeys:"passthrough"})}extend(e){return new j({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new j({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new j({...this._def,catchall:e})}pick(e){const n={};return $.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new j({...this._def,shape:()=>n})}omit(e){const n={};return $.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new j({...this._def,shape:()=>n})}deepPartial(){return Le(this)}partial(e){const n={};return $.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}),new j({...this._def,shape:()=>n})}required(e){const n={};return $.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof oe;)a=a._def.innerType;n[r]=a}}),new j({...this._def,shape:()=>n})}keyof(){return qr($.objectKeys(this.shape))}}j.create=(t,e)=>new j({shape:()=>t,unknownKeys:"strip",catchall:be.create(),typeName:x.ZodObject,...E(e)});j.strictCreate=(t,e)=>new j({shape:()=>t,unknownKeys:"strict",catchall:be.create(),typeName:x.ZodObject,...E(e)});j.lazycreate=(t,e)=>new j({shape:t,unknownKeys:"strip",catchall:be.create(),typeName:x.ZodObject,...E(e)});class lt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new K(o.ctx.common.issues));return b(n,{code:h.invalid_union,unionErrors:i}),_}if(n.common.async)return Promise.all(r.map(async a=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const u of r){const c={...n,common:{...n.common,issues:[]},parent:null},d=u._parseSync({data:n.data,path:n.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new K(u));return b(n,{code:h.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}lt.create=(t,e)=>new lt({options:t,typeName:x.ZodUnion,...E(e)});const pe=t=>t instanceof pt?pe(t.schema):t instanceof se?pe(t.innerType()):t instanceof mt?[t.value]:t instanceof Ae?t.options:t instanceof yt?$.objectValues(t.enum):t instanceof bt?pe(t._def.innerType):t instanceof ut?[void 0]:t instanceof dt?[null]:t instanceof oe?[void 0,...pe(t.unwrap())]:t instanceof Ce?[null,...pe(t.unwrap())]:t instanceof Gn||t instanceof vt?pe(t.unwrap()):t instanceof gt?pe(t._def.innerType):[];class rn extends T{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==g.object)return b(n,{code:h.invalid_type,expected:g.object,received:n.parsedType}),_;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(b(n,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){const i=pe(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new rn({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...E(r)})}}function Tn(t,e){const n=me(t),r=me(e);if(t===e)return{valid:!0,data:t};if(n===g.object&&r===g.object){const s=$.objectKeys(e),a=$.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i={...t,...e};for(const o of a){const u=Tn(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(n===g.array&&r===g.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],u=Tn(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===g.date&&r===g.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ft extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,i)=>{if(An(a)||An(i))return _;const o=Tn(a.value,i.value);return o.valid?((Cn(a)||Cn(i))&&n.dirty(),{status:n.value,value:o.data}):(b(r,{code:h.invalid_intersection_types}),_)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ft.create=(t,e,n)=>new ft({left:t,right:e,typeName:x.ZodIntersection,...E(n)});class ue extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.array)return b(r,{code:h.invalid_type,expected:g.array,received:r.parsedType}),_;if(r.data.length<this._def.items.length)return b(r,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&r.data.length>this._def.items.length&&(b(r,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...r.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new ce(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>L.mergeArray(n,i)):L.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new ue({...this._def,rest:e})}}ue.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ue({items:t,typeName:x.ZodTuple,rest:null,...E(e)})};class ht extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.object)return b(r,{code:h.invalid_type,expected:g.object,received:r.parsedType}),_;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)s.push({key:a._parse(new ce(r,o,r.path,o)),value:i._parse(new ce(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?L.mergeObjectAsync(n,s):L.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof T?new ht({keyType:e,valueType:n,typeName:x.ZodRecord,...E(r)}):new ht({keyType:ne.create(),valueType:e,typeName:x.ZodRecord,...E(n)})}}class Kt extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.map)return b(r,{code:h.invalid_type,expected:g.map,received:r.parsedType}),_;const s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,u],c)=>({key:s._parse(new ce(r,o,r.path,[c,"key"])),value:a._parse(new ce(r,u,r.path,[c,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const c=await u.key,d=await u.value;if(c.status==="aborted"||d.status==="aborted")return _;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),o.set(c.value,d.value)}return{status:n.value,value:o}})}else{const o=new Map;for(const u of i){const c=u.key,d=u.value;if(c.status==="aborted"||d.status==="aborted")return _;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),o.set(c.value,d.value)}return{status:n.value,value:o}}}}Kt.create=(t,e,n)=>new Kt({valueType:e,keyType:t,typeName:x.ZodMap,...E(n)});class Me extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.set)return b(r,{code:h.invalid_type,expected:g.set,received:r.parsedType}),_;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(b(r,{code:h.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(b(r,{code:h.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const d of u){if(d.status==="aborted")return _;d.status==="dirty"&&n.dirty(),c.add(d.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((u,c)=>a._parse(new ce(r,u,r.path,c)));return r.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,n){return new Me({...this._def,minSize:{value:e,message:w.toString(n)}})}max(e,n){return new Me({...this._def,maxSize:{value:e,message:w.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Me.create=(t,e)=>new Me({valueType:t,minSize:null,maxSize:null,typeName:x.ZodSet,...E(e)});class Ve extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==g.function)return b(n,{code:h.invalid_type,expected:g.function,received:n.parsedType}),_;function r(o,u){return Gt({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ut(),He].filter(c=>!!c),issueData:{code:h.invalid_arguments,argumentsError:u}})}function s(o,u){return Gt({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ut(),He].filter(c=>!!c),issueData:{code:h.invalid_return_type,returnTypeError:u}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof We){const o=this;return Z(async function(...u){const c=new K([]),d=await o._def.args.parseAsync(u,a).catch(m=>{throw c.addIssue(r(u,m)),c}),l=await Reflect.apply(i,this,d);return await o._def.returns._def.type.parseAsync(l,a).catch(m=>{throw c.addIssue(s(l,m)),c})})}else{const o=this;return Z(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new K([r(u,c.error)]);const d=Reflect.apply(i,this,c.data),l=o._def.returns.safeParse(d,a);if(!l.success)throw new K([s(d,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ve({...this._def,args:ue.create(e).rest(Ie.create())})}returns(e){return new Ve({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Ve({args:e||ue.create([]).rest(Ie.create()),returns:n||Ie.create(),typeName:x.ZodFunction,...E(r)})}}class pt extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}pt.create=(t,e)=>new pt({getter:t,typeName:x.ZodLazy,...E(e)});class mt extends T{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return b(n,{received:n.data,code:h.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}mt.create=(t,e)=>new mt({value:t,typeName:x.ZodLiteral,...E(e)});function qr(t,e){return new Ae({values:t,typeName:x.ZodEnum,...E(e)})}class Ae extends T{constructor(){super(...arguments),st.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return b(n,{expected:$.joinValues(r),received:n.parsedType,code:h.invalid_type}),_}if(Ht(this,st)||Vr(this,st,new Set(this._def.values)),!Ht(this,st).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return b(n,{received:n.data,code:h.invalid_enum_value,options:r}),_}return Z(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Ae.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ae.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}st=new WeakMap;Ae.create=qr;class yt extends T{constructor(){super(...arguments),at.set(this,void 0)}_parse(e){const n=$.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==g.string&&r.parsedType!==g.number){const s=$.objectValues(n);return b(r,{expected:$.joinValues(s),received:r.parsedType,code:h.invalid_type}),_}if(Ht(this,at)||Vr(this,at,new Set($.getValidEnumValues(this._def.values))),!Ht(this,at).has(e.data)){const s=$.objectValues(n);return b(r,{received:r.data,code:h.invalid_enum_value,options:s}),_}return Z(e.data)}get enum(){return this._def.values}}at=new WeakMap;yt.create=(t,e)=>new yt({values:t,typeName:x.ZodNativeEnum,...E(e)});class We extends T{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==g.promise&&n.common.async===!1)return b(n,{code:h.invalid_type,expected:g.promise,received:n.parsedType}),_;const r=n.parsedType===g.promise?n.data:Promise.resolve(n.data);return Z(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}We.create=(t,e)=>new We({type:t,typeName:x.ZodPromise,...E(e)});class se extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{b(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async o=>{if(n.value==="aborted")return _;const u=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return u.status==="aborted"?_:u.status==="dirty"||n.value==="dirty"?De(u.value):u});{if(n.value==="aborted")return _;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?_:o.status==="dirty"||n.value==="dirty"?De(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?_:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Re(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Re(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);$.assertNever(s)}}se.create=(t,e,n)=>new se({schema:t,typeName:x.ZodEffects,effect:e,...E(n)});se.createWithPreprocess=(t,e,n)=>new se({schema:e,effect:{type:"preprocess",transform:t},typeName:x.ZodEffects,...E(n)});class oe extends T{_parse(e){return this._getType(e)===g.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}oe.create=(t,e)=>new oe({innerType:t,typeName:x.ZodOptional,...E(e)});class Ce extends T{_parse(e){return this._getType(e)===g.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ce.create=(t,e)=>new Ce({innerType:t,typeName:x.ZodNullable,...E(e)});class bt extends T{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===g.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}bt.create=(t,e)=>new bt({innerType:t,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...E(e)});class gt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ot(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new K(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new K(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}gt.create=(t,e)=>new gt({innerType:t,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...E(e)});class Jt extends T{_parse(e){if(this._getType(e)!==g.nan){const r=this._getOrReturnCtx(e);return b(r,{code:h.invalid_type,expected:g.nan,received:r.parsedType}),_}return{status:"valid",value:e.data}}}Jt.create=t=>new Jt({typeName:x.ZodNaN,...E(t)});const Ua=Symbol("zod_brand");class Gn extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Nt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?_:a.status==="dirty"?(n.dirty(),De(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?_:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Nt({in:e,out:n,typeName:x.ZodPipeline})}}class vt extends T{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Re(s)&&(s.value=Object.freeze(s.value)),s);return ot(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}vt.create=(t,e)=>new vt({innerType:t,typeName:x.ZodReadonly,...E(e)});function Wr(t,e={},n){return t?qe.create().superRefine((r,s)=>{var a,i;if(!t(r)){const o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0,c=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...c,fatal:u})}}):qe.create()}const Ga={object:j.lazycreate};var x;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(x||(x={}));const Ha=(t,e={message:`Input not instance of ${t.name}`})=>Wr(n=>n instanceof t,e),Kr=ne.create,Jr=Pe.create,qa=Jt.create,Wa=Ee.create,Yr=ct.create,Ka=Oe.create,Ja=qt.create,Ya=ut.create,Xa=dt.create,Qa=qe.create,ei=Ie.create,ti=be.create,ni=Wt.create,ri=re.create,si=j.create,ai=j.strictCreate,ii=lt.create,oi=rn.create,ci=ft.create,ui=ue.create,di=ht.create,li=Kt.create,fi=Me.create,hi=Ve.create,pi=pt.create,mi=mt.create,yi=Ae.create,bi=yt.create,gi=We.create,Er=se.create,vi=oe.create,wi=Ce.create,xi=se.createWithPreprocess,_i=Nt.create,Pi=()=>Kr().optional(),Ei=()=>Jr().optional(),Ai=()=>Yr().optional(),Ci={string:t=>ne.create({...t,coerce:!0}),number:t=>Pe.create({...t,coerce:!0}),boolean:t=>ct.create({...t,coerce:!0}),bigint:t=>Ee.create({...t,coerce:!0}),date:t=>Oe.create({...t,coerce:!0})},Ti=_;var p=Object.freeze({__proto__:null,defaultErrorMap:He,setErrorMap:xa,getErrorMap:Ut,makeIssue:Gt,EMPTY_PATH:_a,addIssueToContext:b,ParseStatus:L,INVALID:_,DIRTY:De,OK:Z,isAborted:An,isDirty:Cn,isValid:Re,isAsync:ot,get util(){return $},get objectUtil(){return En},ZodParsedType:g,getParsedType:me,ZodType:T,datetimeRegex:Hr,ZodString:ne,ZodNumber:Pe,ZodBigInt:Ee,ZodBoolean:ct,ZodDate:Oe,ZodSymbol:qt,ZodUndefined:ut,ZodNull:dt,ZodAny:qe,ZodUnknown:Ie,ZodNever:be,ZodVoid:Wt,ZodArray:re,ZodObject:j,ZodUnion:lt,ZodDiscriminatedUnion:rn,ZodIntersection:ft,ZodTuple:ue,ZodRecord:ht,ZodMap:Kt,ZodSet:Me,ZodFunction:Ve,ZodLazy:pt,ZodLiteral:mt,ZodEnum:Ae,ZodNativeEnum:yt,ZodPromise:We,ZodEffects:se,ZodTransformer:se,ZodOptional:oe,ZodNullable:Ce,ZodDefault:bt,ZodCatch:gt,ZodNaN:Jt,BRAND:Ua,ZodBranded:Gn,ZodPipeline:Nt,ZodReadonly:vt,custom:Wr,Schema:T,ZodSchema:T,late:Ga,get ZodFirstPartyTypeKind(){return x},coerce:Ci,any:Qa,array:ri,bigint:Wa,boolean:Yr,date:Ka,discriminatedUnion:oi,effect:Er,enum:yi,function:hi,instanceof:Ha,intersection:ci,lazy:pi,literal:mi,map:li,nan:qa,nativeEnum:bi,never:ti,null:Xa,nullable:wi,number:Jr,object:si,oboolean:Ai,onumber:Ei,optional:vi,ostring:Pi,pipeline:_i,preprocess:xi,promise:gi,record:di,set:fi,strictObject:ai,string:Kr,symbol:Ja,transformer:Er,tuple:ui,undefined:Ya,union:ii,unknown:ei,void:ni,NEVER:Ti,ZodIssueCode:h,quotelessJson:wa,ZodError:K});const Xr="2.22.1";let tt={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:n})=>e?`${t??"https://viem.sh"}${e}${n?`#${n}`:""}`:void 0,version:`viem@${Xr}`},y=class kn extends Error{constructor(e,n={}){var o;const r=(()=>{var u;return n.cause instanceof kn?n.cause.details:(u=n.cause)!=null&&u.message?n.cause.message:n.details})(),s=n.cause instanceof kn&&n.cause.docsPath||n.docsPath,a=(o=tt.getDocsUrl)==null?void 0:o.call(tt,{...n,docsPath:s}),i=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...tt.version?[`Version: ${tt.version}`]:[]].join(`
|
|
2
|
+
`);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=e,this.version=Xr}walk(e){return Qr(this,e)}};function Qr(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?Qr(t.cause,e):e?null:t}class es extends y{constructor({max:e,min:n,signed:r,size:s,value:a}){super(`Number "${a}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class ki extends y{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class $i extends y{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}class ts extends y{constructor({offset:e,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class ns extends y{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}class Ar extends y{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${e} ${r} long.`,{name:"InvalidBytesLengthError"})}}function Qe(t,{dir:e,size:n=32}={}){return typeof t=="string"?_e(t,{dir:e,size:n}):Si(t,{dir:e,size:n})}function _e(t,{dir:e,size:n=32}={}){if(n===null)return t;const r=t.replace("0x","");if(r.length>n*2)throw new ns({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function Si(t,{dir:e,size:n=32}={}){if(n===null)return t;if(t.length>n)throw new ns({size:t.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const a=e==="right";r[a?s:n-s-1]=t[a?s:t.length-s-1]}return r}function ge(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function F(t){return ge(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}function Hn(t,{dir:e="left"}={}){let n=typeof t=="string"?t.replace("0x",""):t,r=0;for(let s=0;s<n.length-1&&n[e==="left"?s:n.length-s-1].toString()==="0";s++)r++;return n=e==="left"?n.slice(r):n.slice(0,n.length-r),typeof t=="string"?(n.length===1&&e==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}const Ii=new TextEncoder;function qn(t,e={}){return typeof t=="number"||typeof t=="bigint"?Oi(t,e):typeof t=="boolean"?Ri(t,e):ge(t)?ve(t,e):rs(t,e)}function Ri(t,e={}){const n=new Uint8Array(1);return n[0]=Number(t),typeof e.size=="number"?(de(n,{size:e.size}),Qe(n,{size:e.size})):n}const he={zero:48,nine:57,A:65,F:70,a:97,f:102};function Cr(t){if(t>=he.zero&&t<=he.nine)return t-he.zero;if(t>=he.A&&t<=he.F)return t-(he.A-10);if(t>=he.a&&t<=he.f)return t-(he.a-10)}function ve(t,e={}){let n=t;e.size&&(de(n,{size:e.size}),n=Qe(n,{dir:"right",size:e.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,a=new Uint8Array(s);for(let i=0,o=0;i<s;i++){const u=Cr(r.charCodeAt(o++)),c=Cr(r.charCodeAt(o++));if(u===void 0||c===void 0)throw new y(`Invalid byte sequence ("${r[o-2]}${r[o-1]}" in "${r}").`);a[i]=u*16+c}return a}function Oi(t,e){const n=O(t,e);return ve(n)}function rs(t,e={}){const n=Ii.encode(t);return typeof e.size=="number"?(de(n,{size:e.size}),Qe(n,{dir:"right",size:e.size})):n}function de(t,{size:e}){if(F(t)>e)throw new $i({givenSize:F(t),maxSize:e})}function wt(t,e={}){const{signed:n}=e;e.size&&de(t,{size:e.size});const r=BigInt(t);if(!n)return r;const s=(t.length-2)/2,a=(1n<<BigInt(s)*8n-1n)-1n;return r<=a?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function Ke(t,e={}){return Number(wt(t,e))}const Mi=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function $n(t,e={}){return typeof t=="number"||typeof t=="bigint"?O(t,e):typeof t=="string"?Wn(t,e):typeof t=="boolean"?ss(t,e):q(t,e)}function ss(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(de(n,{size:e.size}),Qe(n,{size:e.size})):n}function q(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=Mi[t[s]];const r=`0x${n}`;return typeof e.size=="number"?(de(r,{size:e.size}),Qe(r,{dir:"right",size:e.size})):r}function O(t,e={}){const{signed:n,size:r}=e,s=BigInt(t);let a;r?n?a=(1n<<BigInt(r)*8n-1n)-1n:a=2n**(BigInt(r)*8n)-1n:typeof t=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof a=="bigint"&&n?-a-1n:0;if(a&&s>a||s<i){const u=typeof t=="bigint"?"n":"";throw new es({max:a?`${a}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${t}${u}`})}const o=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?Qe(o,{size:r}):o}const ji=new TextEncoder;function Wn(t,e={}){const n=ji.encode(t);return q(n,e)}function Je(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new qi(t.type);return`${t.name}(${Kn(t.inputs,{includeName:e})})`}function Kn(t,{includeName:e=!1}={}){return t?t.map(n=>Bi(n,{includeName:e})).join(e?", ":","):""}function Bi(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Kn(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}class Ni extends y{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
3
|
+
`),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class Tr extends y{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|
|
4
|
+
`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class Fi extends y{constructor({data:e,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
5
|
+
`),{metaMessages:[`Params: (${Kn(n,{includeName:!0})})`,`Data: ${e} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=n,this.size=r}}class Jn extends y{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class zi extends y{constructor({expectedLength:e,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${n}`].join(`
|
|
6
|
+
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class Li extends y{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${F(n)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Di extends y{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${n}`].join(`
|
|
7
|
+
`),{name:"AbiEncodingLengthMismatchError"})}}class as extends y{constructor(e,{docsPath:n}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join(`
|
|
8
|
+
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Yt extends y{constructor(e,{docsPath:n}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
9
|
+
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Zi extends y{constructor(e,{docsPath:n}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
10
|
+
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Vi extends y{constructor(e,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Je(e.abiItem)}\`, and`,`\`${n.type}\` in \`${Je(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class Ui extends y{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
11
|
+
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Gi extends y{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
12
|
+
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}class Hi extends y{constructor(e){super([`Value "${e}" is not a valid array.`].join(`
|
|
13
|
+
`),{name:"InvalidArrayError"})}}class qi extends y{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
14
|
+
`),{name:"InvalidDefinitionTypeError"})}}function je(t){return typeof t[0]=="string"?sn(t):Wi(t)}function Wi(t){let e=0;for(const s of t)e+=s.length;const n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function sn(t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}class Ye extends y{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class an extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}function Ft(t,e){const n=e||"hex",r=G.keccak_256(ge(t,{strict:!1})?qn(t):t);return n==="bytes"?r:$n(r)}const mn=new an(8192);function on(t,e){if(mn.has(`${t}.${e}`))return mn.get(`${t}.${e}`);const n=t.substring(2).toLowerCase(),r=Ft(rs(n),"bytes"),s=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&s[i]&&(s[i]=s[i].toUpperCase()),(r[i>>1]&15)>=8&&s[i+1]&&(s[i+1]=s[i+1].toUpperCase());const a=`0x${s.join("")}`;return mn.set(`${t}.${e}`,a),a}function Ki(t,e){if(!we(t,{strict:!1}))throw new Ye({address:t});return on(t,e)}const Ji=/^0x[a-fA-F0-9]{40}$/,yn=new an(8192);function we(t,e){const{strict:n=!0}=e??{},r=`${t}.${n}`;if(yn.has(r))return yn.get(r);const s=Ji.test(t)?t.toLowerCase()===t?!0:n?on(t)===t:!0:!1;return yn.set(r,s),s}function Xt(t,e,n,{strict:r}={}){return ge(t,{strict:!1})?Yi(t,e,n,{strict:r}):cs(t,e,n,{strict:r})}function is(t,e){if(typeof e=="number"&&e>0&&e>F(t)-1)throw new ts({offset:e,position:"start",size:F(t)})}function os(t,e,n){if(typeof e=="number"&&typeof n=="number"&&F(t)!==n-e)throw new ts({offset:n,position:"end",size:F(t)})}function cs(t,e,n,{strict:r}={}){is(t,e);const s=t.slice(e,n);return r&&os(s,e,n),s}function Yi(t,e,n,{strict:r}={}){is(t,e);const s=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return r&&os(s,e,n),s}const Xi=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Yn(t,e){if(t.length!==e.length)throw new Di({expectedLength:t.length,givenLength:e.length});const n=Qi({params:t,values:e}),r=Qn(n);return r.length===0?"0x":r}function Qi({params:t,values:e}){const n=[];for(let r=0;r<t.length;r++)n.push(Xn({param:t[r],value:e[r]}));return n}function Xn({param:t,value:e}){const n=er(t.type);if(n){const[r,s]=n;return to(e,{length:r,param:{...t,type:s}})}if(t.type==="tuple")return io(e,{param:t});if(t.type==="address")return eo(e);if(t.type==="bool")return ro(e);if(t.type.startsWith("uint")||t.type.startsWith("int")){const r=t.type.startsWith("int"),[,,s="256"]=Xi.exec(t.type)??[];return so(e,{signed:r,size:Number(s)})}if(t.type.startsWith("bytes"))return no(e,{param:t});if(t.type==="string")return ao(e);throw new Ui(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Qn(t){let e=0;for(let a=0;a<t.length;a++){const{dynamic:i,encoded:o}=t[a];i?e+=32:e+=F(o)}const n=[],r=[];let s=0;for(let a=0;a<t.length;a++){const{dynamic:i,encoded:o}=t[a];i?(n.push(O(e+s,{size:32})),r.push(o),s+=F(o)):n.push(o)}return je([...n,...r])}function eo(t){if(!we(t))throw new Ye({address:t});return{dynamic:!1,encoded:_e(t.toLowerCase())}}function to(t,{length:e,param:n}){const r=e===null;if(!Array.isArray(t))throw new Hi(t);if(!r&&t.length!==e)throw new zi({expectedLength:e,givenLength:t.length,type:`${n.type}[${e}]`});let s=!1;const a=[];for(let i=0;i<t.length;i++){const o=Xn({param:n,value:t[i]});o.dynamic&&(s=!0),a.push(o)}if(r||s){const i=Qn(a);if(r){const o=O(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?je([o,i]):o}}if(s)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:je(a.map(({encoded:i})=>i))}}function no(t,{param:e}){const[,n]=e.type.split("bytes"),r=F(t);if(!n){let s=t;return r%32!==0&&(s=_e(s,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:je([_e(O(r,{size:32})),s])}}if(r!==Number.parseInt(n))throw new Li({expectedSize:Number.parseInt(n),value:t});return{dynamic:!1,encoded:_e(t,{dir:"right"})}}function ro(t){if(typeof t!="boolean")throw new y(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:_e(ss(t))}}function so(t,{signed:e,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(e?1n:0n))-1n,s=e?-r-1n:0n;if(t>r||t<s)throw new es({max:r.toString(),min:s.toString(),signed:e,size:n/8,value:t.toString()})}return{dynamic:!1,encoded:O(t,{size:32,signed:e})}}function ao(t){const e=Wn(t),n=Math.ceil(F(e)/32),r=[];for(let s=0;s<n;s++)r.push(_e(Xt(e,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:je([_e(O(F(e),{size:32})),...r])}}function io(t,{param:e}){let n=!1;const r=[];for(let s=0;s<e.components.length;s++){const a=e.components[s],i=Array.isArray(t)?s:a.name,o=Xn({param:a,value:t[i]});r.push(o),o.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Qn(r):je(r.map(({encoded:s})=>s))}}function er(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const bn="/docs/contract/encodeDeployData";function us(t){const{abi:e,args:n,bytecode:r}=t;if(!n||n.length===0)return r;const s=e.find(i=>"type"in i&&i.type==="constructor");if(!s)throw new Ni({docsPath:bn});if(!("inputs"in s))throw new Tr({docsPath:bn});if(!s.inputs||s.inputs.length===0)throw new Tr({docsPath:bn});const a=Yn(s.inputs,n);return sn([r,a])}function le(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}class ds extends y{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
|
|
15
|
+
`),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class gn extends y{constructor({docsPath:e,metaMessages:n,type:r}){super(`Account type "${r}" is not supported.`,{docsPath:e,metaMessages:n,name:"AccountTypeNotSupportedError"})}}function oo(t){const e=Ft(`0x${t.substring(4)}`).substring(26);return on(`0x${e}`)}async function co({hash:t,signature:e}){const n=ge(t)?t:$n(t),{secp256k1:r}=await Promise.resolve().then(()=>require("./utils-dz3mUqTs.cjs")).then(i=>i.secp256k1);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:c,s:d,v:l,yParity:f}=e,m=Number(f??l),v=kr(m);return new r.Signature(wt(c),wt(d)).addRecoveryBit(v)}const i=ge(e)?e:$n(e),o=Ke(`0x${i.slice(130)}`),u=kr(o);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function kr(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function uo({hash:t,signature:e}){return oo(await co({hash:t,signature:e}))}class $r extends y{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class lo extends y{constructor({length:e,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class fo extends y{constructor({count:e,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const ho={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new fo({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new lo({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new $r({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new $r({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const n=e??this.position;return this.assertPosition(n+t-1),this.bytes.subarray(n,n+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const n=this.inspectBytes(t);return this.position+=e??t,n},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function tr(t,{recursiveReadLimit:e=8192}={}){const n=Object.create(ho);return n.bytes=t,n.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=e,n}function po(t,e="hex"){const n=ls(t),r=tr(new Uint8Array(n.length));return n.encode(r),e==="hex"?q(r.bytes):r.bytes}function ls(t){return Array.isArray(t)?mo(t.map(e=>ls(e))):yo(t)}function mo(t){const e=t.reduce((s,a)=>s+a.length,0),n=fs(e);return{length:e<=55?1+e:1+n+e,encode(s){e<=55?s.pushByte(192+e):(s.pushByte(247+n),n===1?s.pushUint8(e):n===2?s.pushUint16(e):n===3?s.pushUint24(e):s.pushUint32(e));for(const{encode:a}of t)a(s)}}}function yo(t){const e=typeof t=="string"?ve(t):t,n=fs(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+n+e.length,encode(s){e.length===1&&e[0]<128?s.pushBytes(e):e.length<=55?(s.pushByte(128+e.length),s.pushBytes(e)):(s.pushByte(183+n),n===1?s.pushUint8(e.length):n===2?s.pushUint16(e.length):n===3?s.pushUint24(e.length):s.pushUint32(e.length),s.pushBytes(e))}}}function fs(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new y("Length is too large.")}function bo(t){const{chainId:e,contractAddress:n,nonce:r,to:s}=t,a=Ft(sn(["0x05",po([e?O(e):"0x",n,r?O(r):"0x"])]));return s==="bytes"?ve(a):a}async function hs(t){const{authorization:e,signature:n}=t;return uo({hash:bo(e),signature:n??e})}class Sn extends y{constructor({blockNumber:e,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class go extends y{constructor({chain:e,currentChainId:n}){super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class vo extends y{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
|
|
16
|
+
`),{name:"ChainNotFoundError"})}}class ps extends y{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}function wo({chain:t,currentChainId:e}){if(!t)throw new vo;if(e!==t.id)throw new go({chain:t,currentChainId:e})}const xo={gwei:9,wei:18},_o={ether:-9,wei:9};function ms(t,e){let n=t.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(e,"0");let[s,a]=[n.slice(0,n.length-e),n.slice(n.length-e)];return a=a.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${a?`.${a}`:""}`}function H(t,e="wei"){return ms(t,_o[e])}class Ze extends y{constructor({cause:e,message:n}={}){var s;const r=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Ze,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(Ze,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Qt extends y{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${H(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Qt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class In extends y{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${H(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(In,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Rn extends y{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(Rn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class On extends y{constructor({cause:e,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
|
|
17
|
+
`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(On,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Mn extends y{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(Mn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class jn extends y{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
18
|
+
`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(jn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Bn extends y{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Bn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Nn extends y{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Nn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Fn extends y{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Fn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class en extends y{constructor({cause:e,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${H(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${H(r)} gwei`:""}).`].join(`
|
|
19
|
+
`),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(en,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class cn extends y{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function nr(t,e="wei"){return ms(t,xo[e])}function zt(t){const e=Object.entries(t).map(([r,s])=>s===void 0||s===!1?null:[r,s]).filter(Boolean),n=e.reduce((r,[s])=>Math.max(r,s.length),0);return e.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(`
|
|
20
|
+
`)}class Po extends y{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
|
|
21
|
+
`),{name:"FeeConflictError"})}}class Eo extends y{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",zt(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class Ao extends y{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:d,to:l,value:f}){var v;const m=zt({chain:s&&`${s==null?void 0:s.name} (id: ${s==null?void 0:s.id})`,from:n==null?void 0:n.address,to:l,value:typeof f<"u"&&`${nr(f)} ${((v=s==null?void 0:s.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:a,gas:i,gasPrice:typeof o<"u"&&`${H(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${H(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${H(c)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",m].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const Lt=(t,e,n)=>JSON.stringify(t,(r,s)=>typeof s=="bigint"?s.toString():s,n),Co=t=>t,rr=t=>t;class sr extends y{constructor({body:e,cause:n,details:r,headers:s,status:a,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[a&&`Status: ${a}`,`URL: ${rr(i)}`,e&&`Request body: ${Lt(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=s,this.status=a,this.url=i}}class ys extends y{constructor({body:e,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${rr(r)}`,`Request body: ${Lt(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code,this.data=n.data}}const To=-1;class W extends y{constructor(e,{code:n,docsPath:r,metaMessages:s,name:a,shortMessage:i}){super(i,{cause:e,docsPath:r,metaMessages:s||(e==null?void 0:e.metaMessages),name:a||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=a||e.name,this.code=e instanceof ys?e.code:n??To}}class et extends W{constructor(e,n){super(e,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class xt extends W{constructor(e){super(e,{code:xt.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(xt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class _t extends W{constructor(e){super(e,{code:_t.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(_t,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Pt extends W{constructor(e,{method:n}={}){super(e,{code:Pt.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(Pt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Et extends W{constructor(e){super(e,{code:Et.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
22
|
+
`)})}}Object.defineProperty(Et,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class Be extends W{constructor(e){super(e,{code:Be.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(Be,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class At extends W{constructor(e){super(e,{code:At.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
23
|
+
`)})}}Object.defineProperty(At,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Ct extends W{constructor(e){super(e,{code:Ct.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Ct,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Tt extends W{constructor(e){super(e,{code:Tt.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Tt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class kt extends W{constructor(e){super(e,{code:kt.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(kt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class $t extends W{constructor(e,{method:n}={}){super(e,{code:$t.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not implemented.`})}}Object.defineProperty($t,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Xe extends W{constructor(e){super(e,{code:Xe.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Xe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class St extends W{constructor(e){super(e,{code:St.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(St,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Ue extends et{constructor(e){super(e,{code:Ue.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Ue,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class It extends et{constructor(e){super(e,{code:It.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(It,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Rt extends et{constructor(e,{method:n}={}){super(e,{code:Rt.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(Rt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Ot extends et{constructor(e){super(e,{code:Ot.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Ot,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Mt extends et{constructor(e){super(e,{code:Mt.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Mt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class jt extends et{constructor(e){super(e,{code:jt.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(jt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ko extends W{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function ar(t,e){const n=(t.details||"").toLowerCase(),r=t instanceof y?t.walk(s=>(s==null?void 0:s.code)===Ze.code):t;return r instanceof y?new Ze({cause:t,message:r.details}):Ze.nodeMessage.test(n)?new Ze({cause:t,message:t.details}):Qt.nodeMessage.test(n)?new Qt({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):In.nodeMessage.test(n)?new In({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):Rn.nodeMessage.test(n)?new Rn({cause:t,nonce:e==null?void 0:e.nonce}):On.nodeMessage.test(n)?new On({cause:t,nonce:e==null?void 0:e.nonce}):Mn.nodeMessage.test(n)?new Mn({cause:t,nonce:e==null?void 0:e.nonce}):jn.nodeMessage.test(n)?new jn({cause:t}):Bn.nodeMessage.test(n)?new Bn({cause:t,gas:e==null?void 0:e.gas}):Nn.nodeMessage.test(n)?new Nn({cause:t,gas:e==null?void 0:e.gas}):Fn.nodeMessage.test(n)?new Fn({cause:t}):en.nodeMessage.test(n)?new en({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new cn({cause:t})}function $o(t,{docsPath:e,...n}){const r=(()=>{const s=ar(t,n);return s instanceof cn?t:s})();return new Ao(r,{docsPath:e,...n})}function ir(t,{format:e}){if(!e)return{};const n={};function r(a){const i=Object.keys(a);for(const o of i)o in t&&(n[o]=t[o]),a[o]&&typeof a[o]=="object"&&!Array.isArray(a[o])&&r(a[o])}const s=e(t||{});return r(s),n}const So={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function or(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=Io(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(n=>q(n)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=O(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=O(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=O(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=O(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=O(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=O(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=So[t.type]),typeof t.value<"u"&&(e.value=O(t.value)),e}function Io(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:O(e.chainId),nonce:O(e.nonce),...typeof e.yParity<"u"?{yParity:O(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:O(e.v)}:{}}))}function D(t,e,n){const r=t[e.name];if(typeof r=="function")return r;const s=t[n];return typeof s=="function"?s:a=>e(t,a)}const Ro=2n**256n-1n;function un(t){const{account:e,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:s,to:a}=t,i=e?le(e):void 0;if(i&&!we(i.address))throw new Ye({address:i.address});if(a&&!we(a))throw new Ye({address:a});if(typeof n<"u"&&(typeof r<"u"||typeof s<"u"))throw new Po;if(r&&r>Ro)throw new Qt({maxFeePerGas:r});if(s&&r&&s>r)throw new en({maxFeePerGas:r,maxPriorityFeePerGas:s})}async function bs(t){const e=await t.request({method:"eth_chainId"},{dedupe:!0});return Ke(e)}class Oo extends y{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class cr extends y{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Mo extends y{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${H(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class jo extends y{constructor({blockHash:e,blockNumber:n}){let r="Block";e&&(r=`Block at hash "${e}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const Bo={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function No(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?Ke(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?Ke(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?Bo[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=Fo(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function Fo(t){return t.map(e=>({contractAddress:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))}function zo(t){const e=(t.transactions??[]).map(n=>typeof n=="string"?n:No(n));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function tn(t,{blockHash:e,blockNumber:n,blockTag:r,includeTransactions:s}={}){var d,l,f;const a=r??"latest",i=s??!1,o=n!==void 0?O(n):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,i]},{dedupe:!0}):u=await t.request({method:"eth_getBlockByNumber",params:[o||a,i]},{dedupe:!!o}),!u)throw new jo({blockHash:e,blockNumber:n});return(((f=(l=(d=t.chain)==null?void 0:d.formatters)==null?void 0:l.block)==null?void 0:f.format)||zo)(u)}async function gs(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function Lo(t,e){var a,i;const{block:n,chain:r=t.chain,request:s}=e||{};try{const o=((a=r==null?void 0:r.fees)==null?void 0:a.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof o=="function"){const c=n||await D(t,tn,"getBlock")({}),d=await o({block:c,client:t,request:s});if(d===null)throw new Error;return d}if(typeof o<"u")return o;const u=await t.request({method:"eth_maxPriorityFeePerGas"});return wt(u)}catch{const[o,u]=await Promise.all([n?Promise.resolve(n):D(t,tn,"getBlock")({}),D(t,gs,"getGasPrice")({})]);if(typeof o.baseFeePerGas!="bigint")throw new cr;const c=u-o.baseFeePerGas;return c<0n?0n:c}}async function Sr(t,e){var f,m;const{block:n,chain:r=t.chain,request:s,type:a="eip1559"}=e||{},i=await(async()=>{var v,k;return typeof((v=r==null?void 0:r.fees)==null?void 0:v.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:t,request:s}):((k=r==null?void 0:r.fees)==null?void 0:k.baseFeeMultiplier)??1.2})();if(i<1)throw new Oo;const u=10**(((f=i.toString().split(".")[1])==null?void 0:f.length)??0),c=v=>v*BigInt(Math.ceil(i*u))/BigInt(u),d=n||await D(t,tn,"getBlock")({});if(typeof((m=r==null?void 0:r.fees)==null?void 0:m.estimateFeesPerGas)=="function"){const v=await r.fees.estimateFeesPerGas({block:n,client:t,multiply:c,request:s,type:a});if(v!==null)return v}if(a==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new cr;const v=typeof(s==null?void 0:s.maxPriorityFeePerGas)=="bigint"?s.maxPriorityFeePerGas:await Lo(t,{block:d,chain:r,request:s}),k=c(d.baseFeePerGas);return{maxFeePerGas:(s==null?void 0:s.maxFeePerGas)??k+v,maxPriorityFeePerGas:v}}return{gasPrice:(s==null?void 0:s.gasPrice)??c(await D(t,gs,"getGasPrice")({}))}}class Do extends y{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:d,to:l,value:f}){var v;const m=zt({from:n==null?void 0:n.address,to:l,value:typeof f<"u"&&`${nr(f)} ${((v=s==null?void 0:s.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:a,gas:i,gasPrice:typeof o<"u"&&`${H(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${H(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${H(c)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",m].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}function Zo(t,{docsPath:e,...n}){const r=(()=>{const s=ar(t,n);return s instanceof cn?t:s})();return new Do(r,{docsPath:e,...n})}class Vo extends y{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Uo extends y{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Ir(t){return t.reduce((e,{slot:n,value:r})=>`${e} ${n}: ${r}
|
|
24
|
+
`,"")}function Go(t){return t.reduce((e,{address:n,...r})=>{let s=`${e} ${n}:
|
|
25
|
+
`;return r.nonce&&(s+=` nonce: ${r.nonce}
|
|
26
|
+
`),r.balance&&(s+=` balance: ${r.balance}
|
|
27
|
+
`),r.code&&(s+=` code: ${r.code}
|
|
28
|
+
`),r.state&&(s+=` state:
|
|
29
|
+
`,s+=Ir(r.state)),r.stateDiff&&(s+=` stateDiff:
|
|
30
|
+
`,s+=Ir(r.stateDiff)),s},` State Override:
|
|
31
|
+
`).slice(0,-1)}function Rr(t){if(!(!t||t.length===0))return t.reduce((e,{slot:n,value:r})=>{if(n.length!==66)throw new Ar({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Ar({size:r.length,targetSize:66,type:"hex"});return e[n]=r,e},{})}function Ho(t){const{balance:e,nonce:n,state:r,stateDiff:s,code:a}=t,i={};if(a!==void 0&&(i.code=a),e!==void 0&&(i.balance=O(e)),n!==void 0&&(i.nonce=O(n)),r!==void 0&&(i.state=Rr(r)),s!==void 0){if(i.state)throw new Uo;i.stateDiff=Rr(s)}return i}function vs(t){if(!t)return;const e={};for(const{address:n,...r}of t){if(!we(n,{strict:!1}))throw new Ye({address:n});if(e[n])throw new Vo({address:n});e[n]=Ho(r)}return e}async function qo(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n?O(n):void 0,a=await t.request({method:"eth_getBalance",params:[e,s||r]});return BigInt(a)}async function Wo(t,e){var s,a,i;const{account:n=t.account}=e,r=n?le(n):void 0;try{let fe=function(U){const{block:ee,request:X,rpcStateOverride:$e}=U;return t.request({method:"eth_estimateGas",params:$e?[X,ee??"latest",$e]:ee?[X,ee]:[X]})};const{accessList:o,authorizationList:u,blobs:c,blobVersionedHashes:d,blockNumber:l,blockTag:f,data:m,gas:v,gasPrice:k,maxFeePerBlobGas:P,maxFeePerGas:I,maxPriorityFeePerGas:R,nonce:A,value:M,stateOverride:J,...z}=await As(t,{...e,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),ae=(l?O(l):void 0)||f,C=vs(J),B=await(async()=>{if(z.to)return z.to;if(u&&u.length>0)return await hs({authorization:u[0]}).catch(()=>{throw new y("`to` is required. Could not infer from `authorizationList`")})})();un(e);const ke=(i=(a=(s=t.chain)==null?void 0:s.formatters)==null?void 0:a.transactionRequest)==null?void 0:i.format,Y=(ke||or)({...ir(z,{format:ke}),from:r==null?void 0:r.address,accessList:o,authorizationList:u,blobs:c,blobVersionedHashes:d,data:m,gas:v,gasPrice:k,maxFeePerBlobGas:P,maxFeePerGas:I,maxPriorityFeePerGas:R,nonce:A,to:B,value:M});let ie=BigInt(await fe({block:ae,request:Y,rpcStateOverride:C}));if(u){const U=await qo(t,{address:Y.from}),ee=await Promise.all(u.map(async X=>{const{contractAddress:$e}=X,ze=await fe({block:ae,request:{authorizationList:void 0,data:m,from:r==null?void 0:r.address,to:$e,value:O(U)},rpcStateOverride:C}).catch(()=>100000n);return 2n*BigInt(ze)}));ie+=ee.reduce((X,$e)=>X+$e,0n)}return ie}catch(o){throw Zo(o,{...e,account:r,chain:t.chain})}}async function Ko(t,{address:e,blockTag:n="latest",blockNumber:r}){const s=await t.request({method:"eth_getTransactionCount",params:[e,r?O(r):n]},{dedupe:!!r});return Ke(s)}function ws(t){const{kzg:e}=t,n=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),r=typeof t.blobs[0]=="string"?t.blobs.map(a=>ve(a)):t.blobs,s=[];for(const a of r)s.push(Uint8Array.from(e.blobToKzgCommitment(a)));return n==="bytes"?s:s.map(a=>q(a))}function xs(t){const{kzg:e}=t,n=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),r=typeof t.blobs[0]=="string"?t.blobs.map(i=>ve(i)):t.blobs,s=typeof t.commitments[0]=="string"?t.commitments.map(i=>ve(i)):t.commitments,a=[];for(let i=0;i<r.length;i++){const o=r[i],u=s[i];a.push(Uint8Array.from(e.computeBlobKzgProof(o,u)))}return n==="bytes"?a:a.map(i=>q(i))}function Jo(t,e){return G.sha256(ge(t,{strict:!1})?qn(t):t)}function Yo(t){const{commitment:e,version:n=1}=t,r=t.to??(typeof e=="string"?"hex":"bytes"),s=Jo(e);return s.set([n],0),r==="bytes"?s:q(s)}function Xo(t){const{commitments:e,version:n}=t,r=t.to??(typeof e[0]=="string"?"hex":"bytes"),s=[];for(const a of e)s.push(Yo({commitment:a,to:r,version:n}));return s}const Or=6,_s=32,ur=4096,Ps=_s*ur,Mr=Ps*Or-1-1*ur*Or;class Qo extends y{constructor({maxSize:e,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class ec extends y{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function tc(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),n=typeof t.data=="string"?ve(t.data):t.data,r=F(n);if(!r)throw new ec;if(r>Mr)throw new Qo({maxSize:Mr,size:r});const s=[];let a=!0,i=0;for(;a;){const o=tr(new Uint8Array(Ps));let u=0;for(;u<ur;){const c=n.slice(i,i+(_s-1));if(o.pushByte(0),o.pushBytes(c),c.length<31){o.pushByte(128),a=!1;break}u++,i+=31}s.push(o)}return e==="bytes"?s.map(o=>o.bytes):s.map(o=>q(o.bytes))}function nc(t){const{data:e,kzg:n,to:r}=t,s=t.blobs??tc({data:e,to:r}),a=t.commitments??ws({blobs:s,kzg:n,to:r}),i=t.proofs??xs({blobs:s,commitments:a,kzg:n,to:r}),o=[];for(let u=0;u<s.length;u++)o.push({blob:s[u],commitment:a[u],proof:i[u]});return o}function rc(t){if(t.type)return t.type;if(typeof t.authorizationList<"u")return"eip7702";if(typeof t.blobs<"u"||typeof t.blobVersionedHashes<"u"||typeof t.maxFeePerBlobGas<"u"||typeof t.sidecars<"u")return"eip4844";if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")return"eip1559";if(typeof t.gasPrice<"u")return typeof t.accessList<"u"?"eip2930":"legacy";throw new Eo({transaction:t})}const Es=["blobVersionedHashes","chainId","fees","gas","nonce","type"];async function As(t,e){const{account:n=t.account,blobs:r,chain:s,gas:a,kzg:i,nonce:o,nonceManager:u,parameters:c=Es,type:d}=e,l=n&&le(n),f={...e,...l?{from:l==null?void 0:l.address}:{}};let m;async function v(){return m||(m=await D(t,tn,"getBlock")({blockTag:"latest"}),m)}let k;async function P(){return k||(s?s.id:typeof e.chainId<"u"?e.chainId:(k=await D(t,bs,"getChainId")({}),k))}if((c.includes("blobVersionedHashes")||c.includes("sidecars"))&&r&&i){const I=ws({blobs:r,kzg:i});if(c.includes("blobVersionedHashes")){const R=Xo({commitments:I,to:"hex"});f.blobVersionedHashes=R}if(c.includes("sidecars")){const R=xs({blobs:r,commitments:I,kzg:i}),A=nc({blobs:r,commitments:I,proofs:R,to:"hex"});f.sidecars=A}}if(c.includes("chainId")&&(f.chainId=await P()),c.includes("nonce")&&typeof o>"u"&&l)if(u){const I=await P();f.nonce=await u.consume({address:l.address,chainId:I,client:t})}else f.nonce=await D(t,Ko,"getTransactionCount")({address:l.address,blockTag:"pending"});if((c.includes("fees")||c.includes("type"))&&typeof d>"u")try{f.type=rc(f)}catch{const I=await v();f.type=typeof(I==null?void 0:I.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(c.includes("fees"))if(f.type!=="legacy"&&f.type!=="eip2930"){if(typeof f.maxFeePerGas>"u"||typeof f.maxPriorityFeePerGas>"u"){const I=await v(),{maxFeePerGas:R,maxPriorityFeePerGas:A}=await Sr(t,{block:I,chain:s,request:f});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas<A)throw new Mo({maxPriorityFeePerGas:A});f.maxPriorityFeePerGas=A,f.maxFeePerGas=R}}else{if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")throw new cr;const I=await v(),{gasPrice:R}=await Sr(t,{block:I,chain:s,request:f,type:"legacy"});f.gasPrice=R}return c.includes("gas")&&typeof a>"u"&&(f.gas=await D(t,Wo,"estimateGas")({...f,account:l&&{address:l.address,type:"json-rpc"}})),un(f),delete f.parameters,f}async function sc(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}const vn=new an(128);async function ac(t,e){var I,R,A,M;const{account:n=t.account,chain:r=t.chain,accessList:s,authorizationList:a,blobs:i,data:o,gas:u,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:m,value:v,...k}=e;if(typeof n>"u")throw new ds({docsPath:"/docs/actions/wallet/sendTransaction"});const P=n?le(n):null;try{un(e);const J=await(async()=>{if(e.to)return e.to;if(a&&a.length>0)return await hs({authorization:a[0]}).catch(()=>{throw new y("`to` is required. Could not infer from `authorizationList`.")})})();if((P==null?void 0:P.type)==="json-rpc"||P===null){let z;r!==null&&(z=await D(t,bs,"getChainId")({}),wo({currentChainId:z,chain:r}));const Q=(A=(R=(I=t.chain)==null?void 0:I.formatters)==null?void 0:R.transactionRequest)==null?void 0:A.format,C=(Q||or)({...ir(k,{format:Q}),accessList:s,authorizationList:a,blobs:i,chainId:z,data:o,from:P==null?void 0:P.address,gas:u,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:m,to:J,value:v}),B=vn.get(t.uid),ke=B?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:ke,params:[C]},{retryCount:0})}catch(Fe){if(B===!1)throw Fe;const Y=Fe;if(Y.name==="InvalidInputRpcError"||Y.name==="InvalidParamsRpcError"||Y.name==="MethodNotFoundRpcError"||Y.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[C]},{retryCount:0}).then(fe=>(vn.set(t.uid,!0),fe)).catch(fe=>{const ie=fe;throw ie.name==="MethodNotFoundRpcError"||ie.name==="MethodNotSupportedRpcError"?(vn.set(t.uid,!1),Y):ie});throw Y}}if((P==null?void 0:P.type)==="local"){const z=await D(t,As,"prepareTransactionRequest")({account:P,accessList:s,authorizationList:a,blobs:i,chain:r,data:o,gas:u,gasPrice:c,maxFeePerBlobGas:d,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:m,nonceManager:P.nonceManager,parameters:[...Es,"sidecars"],value:v,...k,to:J}),Q=(M=r==null?void 0:r.serializers)==null?void 0:M.transaction,ae=await P.signTransaction(z,{serializer:Q});return await D(t,sc,"sendRawTransaction")({serializedTransaction:ae})}throw(P==null?void 0:P.type)==="smart"?new gn({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new gn({docsPath:"/docs/actions/wallet/sendTransaction",type:P==null?void 0:P.type})}catch(J){throw J instanceof gn?J:$o(J,{...e,account:P,chain:e.chain||void 0})}}const jr=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}];function ic(t,e={}){typeof e.size<"u"&&de(t,{size:e.size});const n=q(t,e);return wt(n,e)}function oc(t,e={}){let n=t;if(typeof e.size<"u"&&(de(n,{size:e.size}),n=Hn(n)),n.length>1||n[0]>1)throw new ki(n);return!!n[0]}function ye(t,e={}){typeof e.size<"u"&&de(t,{size:e.size});const n=q(t,e);return Ke(n,e)}function cc(t,e={}){let n=t;return typeof e.size<"u"&&(de(n,{size:e.size}),n=Hn(n,{dir:"right"})),new TextDecoder().decode(n)}function Cs(t,e){const n=typeof e=="string"?ve(e):e,r=tr(n);if(F(n)===0&&t.length>0)throw new Jn;if(F(e)&&F(e)<32)throw new Fi({data:typeof e=="string"?e:q(e),params:t,size:F(e)});let s=0;const a=[];for(let i=0;i<t.length;++i){const o=t[i];r.setPosition(s);const[u,c]=Ge(r,o,{staticPosition:0});s+=c,a.push(u)}return a}function Ge(t,e,{staticPosition:n}){const r=er(e.type);if(r){const[s,a]=r;return dc(t,{...e,type:a},{length:s,staticPosition:n})}if(e.type==="tuple")return pc(t,e,{staticPosition:n});if(e.type==="address")return uc(t);if(e.type==="bool")return lc(t);if(e.type.startsWith("bytes"))return fc(t,e,{staticPosition:n});if(e.type.startsWith("uint")||e.type.startsWith("int"))return hc(t,e);if(e.type==="string")return mc(t,{staticPosition:n});throw new Gi(e.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Br=32,zn=32;function uc(t){const e=t.readBytes(32);return[on(q(cs(e,-20))),32]}function dc(t,e,{length:n,staticPosition:r}){if(!n){const i=ye(t.readBytes(zn)),o=r+i,u=o+Br;t.setPosition(o);const c=ye(t.readBytes(Br)),d=Bt(e);let l=0;const f=[];for(let m=0;m<c;++m){t.setPosition(u+(d?m*32:l));const[v,k]=Ge(t,e,{staticPosition:u});l+=k,f.push(v)}return t.setPosition(r+32),[f,32]}if(Bt(e)){const i=ye(t.readBytes(zn)),o=r+i,u=[];for(let c=0;c<n;++c){t.setPosition(o+c*32);const[d]=Ge(t,e,{staticPosition:o});u.push(d)}return t.setPosition(r+32),[u,32]}let s=0;const a=[];for(let i=0;i<n;++i){const[o,u]=Ge(t,e,{staticPosition:r+s});s+=u,a.push(o)}return[a,s]}function lc(t){return[oc(t.readBytes(32),{size:32}),32]}function fc(t,e,{staticPosition:n}){const[r,s]=e.type.split("bytes");if(!s){const i=ye(t.readBytes(32));t.setPosition(n+i);const o=ye(t.readBytes(32));if(o===0)return t.setPosition(n+32),["0x",32];const u=t.readBytes(o);return t.setPosition(n+32),[q(u),32]}return[q(t.readBytes(Number.parseInt(s),32)),32]}function hc(t,e){const n=e.type.startsWith("int"),r=Number.parseInt(e.type.split("int")[1]||"256"),s=t.readBytes(32);return[r>48?ic(s,{signed:n}):ye(s,{signed:n}),32]}function pc(t,e,{staticPosition:n}){const r=e.components.length===0||e.components.some(({name:i})=>!i),s=r?[]:{};let a=0;if(Bt(e)){const i=ye(t.readBytes(zn)),o=n+i;for(let u=0;u<e.components.length;++u){const c=e.components[u];t.setPosition(o+a);const[d,l]=Ge(t,c,{staticPosition:o});a+=l,s[r?u:c==null?void 0:c.name]=d}return t.setPosition(n+32),[s,32]}for(let i=0;i<e.components.length;++i){const o=e.components[i],[u,c]=Ge(t,o,{staticPosition:n});s[r?i:o==null?void 0:o.name]=u,a+=c}return[s,a]}function mc(t,{staticPosition:e}){const n=ye(t.readBytes(32)),r=e+n;t.setPosition(r);const s=ye(t.readBytes(32));if(s===0)return t.setPosition(e+32),["",32];const a=t.readBytes(s,32),i=cc(Hn(a));return t.setPosition(e+32),[i,32]}function Bt(t){var r;const{type:e}=t;if(e==="string"||e==="bytes"||e.endsWith("[]"))return!0;if(e==="tuple")return(r=t.components)==null?void 0:r.some(Bt);const n=er(t.type);return!!(n&&Bt({...t,type:n[1]}))}const yc=t=>Ft(qn(t));function bc(t){return yc(t)}const gc="1.0.7";class V extends Error{constructor(e,n={}){var i;const r=n.cause instanceof V?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,s=n.cause instanceof V&&n.cause.docsPath||n.docsPath,a=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${gc}`].join(`
|
|
32
|
+
`);super(a),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=e}}function Te(t,e){const n=t.exec(e);return n==null?void 0:n.groups}const Ts=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ks=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,$s=/^\(.+?\).*?$/,Nr=/^tuple(?<array>(\[(\d*)\])*)$/;function Ln(t){let e=t.type;if(Nr.test(t.type)&&"components"in t){e="(";const n=t.components.length;for(let s=0;s<n;s++){const a=t.components[s];e+=Ln(a),s<n-1&&(e+=", ")}const r=Te(Nr,t.type);return e+=`)${(r==null?void 0:r.array)??""}`,Ln({...t,type:e})}return"indexed"in t&&t.indexed&&(e=`${e} indexed`),t.name?`${e} ${t.name}`:e}function nt(t){let e="";const n=t.length;for(let r=0;r<n;r++){const s=t[r];e+=Ln(s),r!==n-1&&(e+=", ")}return e}function vc(t){var e;return t.type==="function"?`function ${t.name}(${nt(t.inputs)})${t.stateMutability&&t.stateMutability!=="nonpayable"?` ${t.stateMutability}`:""}${(e=t.outputs)!=null&&e.length?` returns (${nt(t.outputs)})`:""}`:t.type==="event"?`event ${t.name}(${nt(t.inputs)})`:t.type==="error"?`error ${t.name}(${nt(t.inputs)})`:t.type==="constructor"?`constructor(${nt(t.inputs)})${t.stateMutability==="payable"?" payable":""}`:t.type==="fallback"?`fallback() external${t.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Ss=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function wc(t){return Ss.test(t)}function xc(t){return Te(Ss,t)}const Is=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function _c(t){return Is.test(t)}function Pc(t){return Te(Is,t)}const Rs=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Ec(t){return Rs.test(t)}function Ac(t){return Te(Rs,t)}const Os=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Ms(t){return Os.test(t)}function Cc(t){return Te(Os,t)}const js=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Tc(t){return js.test(t)}function kc(t){return Te(js,t)}const $c=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Sc(t){return $c.test(t)}const Ic=/^receive\(\) external payable$/;function Rc(t){return Ic.test(t)}const Oc=new Set(["indexed"]),Dn=new Set(["calldata","memory","storage"]);class Mc extends V{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class jc extends V{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Bc extends V{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Nc extends V{constructor({param:e,name:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Fc extends V{constructor({param:e,type:n,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class zc extends V{constructor({param:e,type:n,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Lc extends V{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class it extends V{constructor({signature:e,type:n}){super(`Invalid ${n} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Dc extends V{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Zc extends V{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Vc extends V{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Uc extends V{constructor({current:e,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Gc(t,e,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let a="";for(const i of s[1])a+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${s[0]}{${a}})`}return e?`${e}:${t}${r}`:t}const wn=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Hc(t,e={}){if(Ec(t)){const n=Ac(t);if(!n)throw new it({signature:t,type:"function"});const r=te(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(Se(r[o],{modifiers:Dn,structs:e,type:"function"}));const i=[];if(n.returns){const o=te(n.returns),u=o.length;for(let c=0;c<u;c++)i.push(Se(o[c],{modifiers:Dn,structs:e,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:i}}if(_c(t)){const n=Pc(t);if(!n)throw new it({signature:t,type:"event"});const r=te(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Se(r[i],{modifiers:Oc,structs:e,type:"event"}));return{name:n.name,type:"event",inputs:s}}if(wc(t)){const n=xc(t);if(!n)throw new it({signature:t,type:"error"});const r=te(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Se(r[i],{structs:e,type:"error"}));return{name:n.name,type:"error",inputs:s}}if(Tc(t)){const n=kc(t);if(!n)throw new it({signature:t,type:"constructor"});const r=te(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Se(r[i],{structs:e,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}if(Sc(t))return{type:"fallback"};if(Rc(t))return{type:"receive",stateMutability:"payable"};throw new Dc({signature:t})}const qc=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Wc=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Kc=/^u?int$/;function Se(t,e){var l,f;const n=Gc(t,e==null?void 0:e.type,e==null?void 0:e.structs);if(wn.has(n))return wn.get(n);const r=$s.test(t),s=Te(r?Wc:qc,t);if(!s)throw new Bc({param:t});if(s.name&&Yc(s.name))throw new Nc({param:t,name:s.name});const a=s.name?{name:s.name}:{},i=s.modifier==="indexed"?{indexed:!0}:{},o=(e==null?void 0:e.structs)??{};let u,c={};if(r){u="tuple";const m=te(s.type),v=[],k=m.length;for(let P=0;P<k;P++)v.push(Se(m[P],{structs:o}));c={components:v}}else if(s.type in o)u="tuple",c={components:o[s.type]};else if(Kc.test(s.type))u=`${s.type}256`;else if(u=s.type,(e==null?void 0:e.type)!=="struct"&&!Bs(u))throw new jc({type:u});if(s.modifier){if(!((f=(l=e==null?void 0:e.modifiers)==null?void 0:l.has)!=null&&f.call(l,s.modifier)))throw new Fc({param:t,type:e==null?void 0:e.type,modifier:s.modifier});if(Dn.has(s.modifier)&&!Xc(u,!!s.array))throw new zc({param:t,type:e==null?void 0:e.type,modifier:s.modifier})}const d={type:`${u}${s.array??""}`,...a,...i,...c};return wn.set(n,d),d}function te(t,e=[],n="",r=0){const s=t.trim().length;for(let a=0;a<s;a++){const i=t[a],o=t.slice(a+1);switch(i){case",":return r===0?te(o,[...e,n.trim()]):te(o,e,`${n}${i}`,r);case"(":return te(o,e,`${n}${i}`,r+1);case")":return te(o,e,`${n}${i}`,r-1);default:return te(o,e,`${n}${i}`,r)}}if(n==="")return e;if(r!==0)throw new Uc({current:n,depth:r});return e.push(n.trim()),e}function Bs(t){return t==="address"||t==="bool"||t==="function"||t==="string"||Ts.test(t)||ks.test(t)}const Jc=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function Yc(t){return t==="address"||t==="bool"||t==="function"||t==="string"||t==="tuple"||Ts.test(t)||ks.test(t)||Jc.test(t)}function Xc(t,e){return e||t==="bytes"||t==="string"||t==="tuple"}function Qc(t){const e={},n=t.length;for(let i=0;i<n;i++){const o=t[i];if(!Ms(o))continue;const u=Cc(o);if(!u)throw new it({signature:o,type:"struct"});const c=u.properties.split(";"),d=[],l=c.length;for(let f=0;f<l;f++){const v=c[f].trim();if(!v)continue;const k=Se(v,{type:"struct"});d.push(k)}if(!d.length)throw new Zc({signature:o});e[u.name]=d}const r={},s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[o,u]=s[i];r[o]=Ns(u,e)}return r}const eu=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Ns(t,e,n=new Set){const r=[],s=t.length;for(let a=0;a<s;a++){const i=t[a];if($s.test(i.type))r.push(i);else{const u=Te(eu,i.type);if(!(u!=null&&u.type))throw new Lc({abiParameter:i});const{array:c,type:d}=u;if(d in e){if(n.has(d))throw new Vc({type:d});r.push({...i,type:`tuple${c??""}`,components:Ns(e[d]??[],e,new Set([...n,d]))})}else if(Bs(d))r.push(i);else throw new Mc({type:d})}}return r}function Fs(t){const e=Qc(t),n=[],r=t.length;for(let s=0;s<r;s++){const a=t[s];Ms(a)||n.push(Hc(a,e))}return n}function tu(t){let e=!0,n="",r=0,s="",a=!1;for(let i=0;i<t.length;i++){const o=t[i];if(["(",")",","].includes(o)&&(e=!0),o==="("&&r++,o===")"&&r--,!!e){if(r===0){if(o===" "&&["event","function",""].includes(s))s="";else if(s+=o,o===")"){a=!0;break}continue}if(o===" "){t[i-1]!==","&&n!==","&&n!==",("&&(n="",e=!1);continue}s+=o,n+=o}}if(!a)throw new y("Unable to normalize signature.");return s}const nu=t=>{const e=typeof t=="string"?t:vc(t);return tu(e)};function zs(t){return bc(nu(t))}const ru=zs,dr=t=>Xt(zs(t),0,4);function lr(t){const{abi:e,args:n=[],name:r}=t,s=ge(r,{strict:!1}),a=e.filter(o=>s?o.type==="function"?dr(o)===r:o.type==="event"?ru(o)===r:!1:"name"in o&&o.name===r);if(a.length===0)return;if(a.length===1)return a[0];let i;for(const o of a){if(!("inputs"in o))continue;if(!n||n.length===0){if(!o.inputs||o.inputs.length===0)return o;continue}if(!o.inputs||o.inputs.length===0||o.inputs.length!==n.length)continue;if(n.every((c,d)=>{const l="inputs"in o&&o.inputs[d];return l?Zn(c,l):!1})){if(i&&"inputs"in i&&i.inputs){const c=Ls(o.inputs,i.inputs,n);if(c)throw new Vi({abiItem:o,type:c[0]},{abiItem:i,type:c[1]})}i=o}}return i||a[0]}function Zn(t,e){const n=typeof t,r=e.type;switch(r){case"address":return we(t,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in e?Object.values(e.components).every((s,a)=>Zn(Object.values(t)[a],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(t)&&t.every(s=>Zn(s,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Ls(t,e,n){for(const r in t){const s=t[r],a=e[r];if(s.type==="tuple"&&a.type==="tuple"&&"components"in s&&"components"in a)return Ls(s.components,a.components,n[r]);const i=[s.type,a.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?we(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?we(n[r],{strict:!1}):!1)return i}}const xn="/docs/contract/decodeFunctionResult";function fr(t){const{abi:e,args:n,functionName:r,data:s}=t;let a=e[0];if(r){const o=lr({abi:e,args:n,name:r});if(!o)throw new Yt(r,{docsPath:xn});a=o}if(a.type!=="function")throw new Yt(void 0,{docsPath:xn});if(!a.outputs)throw new Zi(a.name,{docsPath:xn});const i=Cs(a.outputs,s);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}const Fr="/docs/contract/encodeFunctionData";function su(t){const{abi:e,args:n,functionName:r}=t;let s=e[0];if(r){const a=lr({abi:e,args:n,name:r});if(!a)throw new Yt(r,{docsPath:Fr});s=a}if(s.type!=="function")throw new Yt(void 0,{docsPath:Fr});return{abi:[s],functionName:dr(Je(s))}}function dn(t){const{args:e}=t,{abi:n,functionName:r}=(()=>{var o;return t.abi.length===1&&((o=t.functionName)!=null&&o.startsWith("0x"))?t:su(t)})(),s=n[0],a=r,i="inputs"in s&&s.inputs?Yn(s.inputs,e??[]):void 0;return sn([a,i??"0x"])}function au({blockNumber:t,chain:e,contract:n}){var s;const r=(s=e==null?void 0:e.contracts)==null?void 0:s[n];if(!r)throw new Sn({chain:e,contract:{name:n}});if(t&&r.blockCreated&&r.blockCreated>t)throw new Sn({blockNumber:t,chain:e,contract:{name:n,blockCreated:r.blockCreated}});return r.address}const iu={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},ou={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},cu={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function Ds(t){const{abi:e,data:n}=t,r=Xt(n,0,4);if(r==="0x")throw new Jn;const a=[...e||[],ou,cu].find(i=>i.type==="error"&&r===dr(Je(i)));if(!a)throw new as(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:a,args:"inputs"in a&&a.inputs&&a.inputs.length>0?Cs(a.inputs,Xt(n,4)):void 0,errorName:a.name}}function Zs({abiItem:t,args:e,includeFunctionName:n=!0,includeName:r=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${n?t.name:""}(${t.inputs.map((s,a)=>`${r&&s.name?`${s.name}: `:""}${typeof e[a]=="object"?Lt(e[a]):e[a]}`).join(", ")})`}class uu extends y{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:d,to:l,value:f,stateOverride:m}){var P;const v=n?le(n):void 0;let k=zt({from:v==null?void 0:v.address,to:l,value:typeof f<"u"&&`${nr(f)} ${((P=s==null?void 0:s.nativeCurrency)==null?void 0:P.symbol)||"ETH"}`,data:a,gas:i,gasPrice:typeof o<"u"&&`${H(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${H(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${H(c)} gwei`,nonce:d});m&&(k+=`
|
|
33
|
+
${Go(m)}`),super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",k].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class du extends y{constructor(e,{abi:n,args:r,contractAddress:s,docsPath:a,functionName:i,sender:o}){const u=lr({abi:n,args:r,name:i}),c=u?Zs({abiItem:u,args:r,includeFunctionName:!1,includeName:!1}):void 0,d=u?Je(u,{includeName:!0}):void 0,l=zt({address:s&&Co(s),function:d,args:c&&c!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${c}`,sender:o});super(e.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:e,docsPath:a,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],l&&"Contract Call:",l].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=n,this.args=r,this.cause=e,this.contractAddress=s,this.functionName=i,this.sender=o}}class lu extends y{constructor({abi:e,data:n,functionName:r,message:s}){let a,i,o,u;if(n&&n!=="0x")try{i=Ds({abi:e,data:n});const{abiItem:d,errorName:l,args:f}=i;if(l==="Error")u=f[0];else if(l==="Panic"){const[m]=f;u=iu[m]}else{const m=d?Je(d,{includeName:!0}):void 0,v=d&&f?Zs({abiItem:d,args:f,includeFunctionName:!1,includeName:!1}):void 0;o=[m?`Error: ${m}`:"",v&&v!=="()"?` ${[...Array((l==null?void 0:l.length)??0).keys()].map(()=>" ").join("")}${v}`:""]}}catch(d){a=d}else s&&(u=s);let c;a instanceof as&&(c=a.signature,o=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(u&&u!=="execution reverted"||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,u||c].join(`
|
|
34
|
+
`):`The contract function "${r}" reverted.`,{cause:a,metaMessages:o,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=i,this.reason=u,this.signature=c}}class fu extends y{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class hu extends y{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class Vs extends y{constructor({data:e,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}const pu=3;function hr(t,{abi:e,address:n,args:r,docsPath:s,functionName:a,sender:i}){const o=t instanceof Vs?t:t instanceof y?t.walk(v=>"data"in v)||t.walk():{},{code:u,data:c,details:d,message:l,shortMessage:f}=o,m=t instanceof Jn?new fu({functionName:a}):[pu,Be.code].includes(u)&&(c||d||l||f)?new lu({abi:e,data:typeof c=="object"?c.data:c,functionName:a,message:o instanceof ys?d:f??l}):t;return new du(m,{abi:e,args:r,contractAddress:n,docsPath:s,functionName:a,sender:i})}const mu="0x82ad56cb",yu="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",bu="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function gu(t,{docsPath:e,...n}){const r=(()=>{const s=ar(t,n);return s instanceof cn?t:s})();return new uu(r,{docsPath:e,...n})}function vu(){let t=()=>{},e=()=>{};return{promise:new Promise((r,s)=>{t=r,e=s}),resolve:t,reject:e}}const _n=new Map;function wu({fn:t,id:e,shouldSplitBatch:n,wait:r=0,sort:s}){const a=async()=>{const d=u();i();const l=d.map(({args:f})=>f);l.length!==0&&t(l).then(f=>{s&&Array.isArray(f)&&f.sort(s);for(let m=0;m<d.length;m++){const{resolve:v}=d[m];v==null||v([f[m],f])}}).catch(f=>{for(let m=0;m<d.length;m++){const{reject:v}=d[m];v==null||v(f)}})},i=()=>_n.delete(e),o=()=>u().map(({args:d})=>d),u=()=>_n.get(e)||[],c=d=>_n.set(e,[...u(),d]);return{flush:i,async schedule(d){const{promise:l,resolve:f,reject:m}=vu();return(n==null?void 0:n([...o(),d]))&&a(),u().length>0?(c({args:d,resolve:f,reject:m}),l):(c({args:d,resolve:f,reject:m}),setTimeout(a,r),l)}}}async function pr(t,e){var ke,Fe,Y,fe;const{account:n=t.account,batch:r=!!((ke=t.batch)!=null&&ke.multicall),blockNumber:s,blockTag:a="latest",accessList:i,blobs:o,code:u,data:c,factory:d,factoryData:l,gas:f,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:k,maxPriorityFeePerGas:P,nonce:I,to:R,value:A,stateOverride:M,...J}=e,z=n?le(n):void 0;if(u&&(d||l))throw new y("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&R)throw new y("Cannot provide both `code` & `to` as parameters.");const Q=u&&c,ae=d&&l&&R&&c,C=Q||ae,B=Q?Pu({code:u,data:c}):ae?Eu({data:c,factory:d,factoryData:l,to:R}):c;try{un(e);const U=(s?O(s):void 0)||a,ee=vs(M),X=(fe=(Y=(Fe=t.chain)==null?void 0:Fe.formatters)==null?void 0:Y.transactionRequest)==null?void 0:fe.format,ze=(X||or)({...ir(J,{format:X}),from:z==null?void 0:z.address,accessList:i,blobs:o,data:B,gas:f,gasPrice:m,maxFeePerBlobGas:v,maxFeePerGas:k,maxPriorityFeePerGas:P,nonce:I,to:C?void 0:R,value:A});if(r&&xu({request:ze})&&!ee)try{return await _u(t,{...ze,blockNumber:s,blockTag:a})}catch(hn){if(!(hn instanceof ps)&&!(hn instanceof Sn))throw hn}const xr=await t.request({method:"eth_call",params:ee?[ze,U,ee]:[ze,U]});return xr==="0x"?{data:void 0}:{data:xr}}catch(ie){const U=Au(ie),{offchainLookup:ee,offchainLookupSignature:X}=await Promise.resolve().then(()=>require("./ccip-BKtQCYbq.cjs"));if(t.ccipRead!==!1&&(U==null?void 0:U.slice(0,10))===X&&R)return{data:await ee(t,{data:U,to:R})};throw C&&(U==null?void 0:U.slice(0,10))==="0x101bb98d"?new hu({factory:d}):gu(ie,{...e,account:z,chain:t.chain})}}function xu({request:t}){const{data:e,to:n,...r}=t;return!(!e||e.startsWith(mu)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function _u(t,e){var k;const{batchSize:n=1024,wait:r=0}=typeof((k=t.batch)==null?void 0:k.multicall)=="object"?t.batch.multicall:{},{blockNumber:s,blockTag:a="latest",data:i,multicallAddress:o,to:u}=e;let c=o;if(!c){if(!t.chain)throw new ps;c=au({blockNumber:s,chain:t.chain,contract:"multicall3"})}const l=(s?O(s):void 0)||a,{schedule:f}=wu({id:`${t.uid}.${l}`,wait:r,shouldSplitBatch(P){return P.reduce((R,{data:A})=>R+(A.length-2),0)>n*2},fn:async P=>{const I=P.map(M=>({allowFailure:!0,callData:M.data,target:M.to})),R=dn({abi:jr,args:[I],functionName:"aggregate3"}),A=await t.request({method:"eth_call",params:[{data:R,to:c},l]});return fr({abi:jr,args:[I],functionName:"aggregate3",data:A||"0x"})}}),[{returnData:m,success:v}]=await f({data:i,to:u});if(!v)throw new Vs({data:m});return m==="0x"?{data:void 0}:{data:m}}function Pu(t){const{code:e,data:n}=t;return us({abi:Fs(["constructor(bytes, bytes)"]),bytecode:yu,args:[e,n]})}function Eu(t){const{data:e,factory:n,factoryData:r,to:s}=t;return us({abi:Fs(["constructor(address, bytes, address, bytes)"]),bytecode:bu,args:[s,e,n,r]})}function Au(t){var n;if(!(t instanceof y))return;const e=t.walk();return typeof(e==null?void 0:e.data)=="object"?(n=e.data)==null?void 0:n.data:e.data}async function Cu(t,e){const{abi:n,address:r,args:s,functionName:a,...i}=e,o=dn({abi:n,args:s,functionName:a});try{const{data:u}=await D(t,pr,"call")({...i,data:o,to:r});return fr({abi:n,args:s,functionName:a,data:u||"0x"})}catch(u){throw hr(u,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:a})}}async function Tu(t){return new Promise(e=>setTimeout(e,t))}const Dt=new an(8192);function ku(t,{enabled:e=!0,id:n}){if(!e||!n)return t();if(Dt.get(n))return Dt.get(n);const r=t().finally(()=>Dt.delete(n));return Dt.set(n,r),r}function $u(t,{delay:e=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,a)=>{const i=async({count:o=0}={})=>{const u=async({error:c})=>{const d=typeof e=="function"?e({count:o,error:c}):e;d&&await Tu(d),i({count:o+1})};try{const c=await t();s(c)}catch(c){if(o<n&&await r({count:o,error:c}))return u({error:c});a(c)}};i()})}function Su(t,e={}){return async(n,r={})=>{const{dedupe:s=!1,retryDelay:a=150,retryCount:i=3,uid:o}={...e,...r},u=s?Ft(Wn(`${o}.${Lt(n)}`)):void 0;return ku(()=>$u(async()=>{try{return await t(n)}catch(c){const d=c;switch(d.code){case xt.code:throw new xt(d);case _t.code:throw new _t(d);case Pt.code:throw new Pt(d,{method:n.method});case Et.code:throw new Et(d);case Be.code:throw new Be(d);case At.code:throw new At(d);case Ct.code:throw new Ct(d);case Tt.code:throw new Tt(d);case kt.code:throw new kt(d);case $t.code:throw new $t(d,{method:n.method});case Xe.code:throw new Xe(d);case St.code:throw new St(d);case Ue.code:throw new Ue(d);case It.code:throw new It(d);case Rt.code:throw new Rt(d);case Ot.code:throw new Ot(d);case Mt.code:throw new Mt(d);case jt.code:throw new jt(d);case 5e3:throw new Ue(d);default:throw c instanceof y?c:new ko(d)}}},{delay:({count:c,error:d})=>{var l;if(d&&d instanceof sr){const f=(l=d==null?void 0:d.headers)==null?void 0:l.get("Retry-After");if(f!=null&&f.match(/\d/))return Number.parseInt(f)*1e3}return~~(1<<c)*a},retryCount:i,shouldRetry:({error:c})=>Iu(c)}),{enabled:s,id:u})}}function Iu(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Xe.code||t.code===Be.code:t instanceof sr&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}async function Ru(t,e){const{abi:n,address:r,args:s,dataSuffix:a,functionName:i,...o}=e,u=o.account?le(o.account):t.account,c=dn({abi:n,args:s,functionName:i});try{const{data:d}=await D(t,pr,"call")({batch:!1,data:`${c}${a?a.replace("0x",""):""}`,to:r,...o,account:u}),l=fr({abi:n,args:s,functionName:i,data:d||"0x"}),f=n.filter(m=>"name"in m&&m.name===e.functionName);return{result:l,request:{abi:f,address:r,args:s,dataSuffix:a,functionName:i,...o,account:u}}}catch(d){throw hr(d,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:i,sender:u==null?void 0:u.address})}}async function Ou(t,e){const{abi:n,account:r=t.account,address:s,args:a,dataSuffix:i,functionName:o,...u}=e;if(typeof r>"u")throw new ds({docsPath:"/docs/contract/writeContract"});const c=r?le(r):null,d=dn({abi:n,args:a,functionName:o});try{return await D(t,ac,"sendTransaction")({data:`${d}${i?i.replace("0x",""):""}`,to:s,account:c,...u})}catch(l){throw hr(l,{abi:n,address:s,args:a,docsPath:"/docs/contract/writeContract",functionName:o,sender:c==null?void 0:c.address})}}const Vn=256;let Zt=Vn,Vt;function Us(t=11){if(!Vt||Zt+t>Vn*2){Vt="",Zt=0;for(let e=0;e<Vn;e++)Vt+=(256+Math.random()*256|0).toString(16).substring(1)}return Vt.substring(Zt,Zt+++t)}function Mu(t){const{batch:e,cacheTime:n=t.pollingInterval??4e3,ccipRead:r,key:s="base",name:a="Base Client",pollingInterval:i=4e3,type:o="base"}=t,u=t.chain,c=t.account?le(t.account):void 0,{config:d,request:l,value:f}=t.transport({chain:u,pollingInterval:i}),m={...d,...f},v={account:c,batch:e,cacheTime:n,ccipRead:r,chain:u,key:s,name:a,pollingInterval:i,request:l,transport:m,type:o,uid:Us()};function k(P){return I=>{const R=I(P);for(const M in v)delete R[M];const A={...P,...R};return Object.assign(A,{extend:k(A)})}}return Object.assign(v,{extend:k(v)})}function ju({key:t,name:e,request:n,retryCount:r=3,retryDelay:s=150,timeout:a,type:i},o){const u=Us();return{config:{key:t,name:e,request:n,retryCount:r,retryDelay:s,timeout:a,type:i},request:Su(n,{retryCount:r,retryDelay:s,uid:u}),value:o}}function Bu(t,e={}){const{key:n="custom",name:r="Custom Provider",retryDelay:s}=e;return({retryCount:a})=>ju({key:n,name:r,request:t.request.bind(t),retryCount:e.retryCount??a,retryDelay:s,type:"custom"})}function ln(t){const e=t.state.current,n=t.state.connections.get(e),r=n==null?void 0:n.accounts,s=r==null?void 0:r[0],a=t.chains.find(o=>o.id===(n==null?void 0:n.chainId)),i=t.state.status;switch(i){case"connected":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:i};case"reconnecting":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!!s,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:i};case"connecting":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:i};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:i}}}function mr(t){return t.state.chainId}function yr(t,e,n){const r=t[e.name];if(typeof r=="function")return r;const s=t[n];return typeof s=="function"?s:a=>e(t,a)}const Nu="2.13.8",Fu=()=>`@wagmi/core@${Nu}`;var Gs=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},nn,Hs;class Ne extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Fu()}constructor(e,n={}){var r;super(),nn.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const s=n.cause instanceof Ne?n.cause.details:(r=n.cause)!=null&&r.message?n.cause.message:n.details,a=n.cause instanceof Ne&&n.cause.docsPath||n.docsPath;this.message=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${this.docsBaseUrl}${a}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...s?[`Details: ${s}`]:[],`Version: ${this.version}`].join(`
|
|
35
|
+
`),n.cause&&(this.cause=n.cause),this.details=s,this.docsPath=a,this.metaMessages=n.metaMessages,this.shortMessage=e}walk(e){return Gs(this,nn,"m",Hs).call(this,this,e)}}nn=new WeakSet,Hs=function t(e,n){return n!=null&&n(e)?e:e.cause?Gs(this,nn,"m",t).call(this,e.cause,n):e};class zu extends Ne{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class Lu extends Ne{constructor({address:e,connector:n}){super(`Account "${e}" not found for connector "${n.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class Du extends Ne{constructor({connectionChainId:e,connectorChainId:n}){super(`The current chain of the connector (id: ${n}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class Zu extends Ne{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function qs(t,e={}){let n;if(e.connector){const{connector:c}=e;if(t.state.status==="reconnecting"&&!c.getAccounts&&!c.getChainId)throw new Zu({connector:c});const[d,l]=await Promise.all([c.getAccounts(),c.getChainId()]);n={accounts:d,chainId:l,connector:c}}else n=t.state.connections.get(t.state.current);if(!n)throw new zu;const r=e.chainId??n.chainId,s=await n.connector.getChainId();if(s!==n.chainId)throw new Du({connectionChainId:n.chainId,connectorChainId:s});const a=n.connector;if(a.getClient)return a.getClient({chainId:r});const i=le(e.account??n.accounts[0]);if(i.address=Ki(i.address),e.account&&!n.accounts.some(c=>c.toLowerCase()===i.address.toLowerCase()))throw new Lu({address:i.address,connector:a});const o=t.chains.find(c=>c.id===r),u=await n.connector.getProvider({chainId:r});return Mu({account:i,chain:o,name:"Connector Client",transport:c=>Bu(u)({...c,retryCount:0})})}async function Un(t,e){const{abi:n,chainId:r,connector:s,...a}=e;let i;e.account?i=e.account:i=(await qs(t,{chainId:r,connector:s})).account;const o=t.getClient({chainId:r}),u=yr(o,Ru,"simulateContract"),{result:c,request:d}=await u({...a,abi:n,account:i});return{chainId:o.chain.id,result:c,request:{__mode:"prepared",...d,chainId:r}}}function br(t){return t.address!==void 0&&typeof t.address=="object"?(e,n)=>{var r;const s=mr(e),a=ln(e),i=(n==null?void 0:n.chainId)??a.chainId??s;return Un(e,{...n,...t.functionName?{functionName:t.functionName}:{},address:(r=t.address)==null?void 0:r[i],abi:t.abi})}:(e,n)=>Un(e,{...n,...t.address?{address:t.address}:{},...t.functionName?{functionName:t.functionName}:{},abi:t.abi})}function zr(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return yr(s,Cu,"readContract")(r)}function Ws(t){return t.address!==void 0&&typeof t.address=="object"?(e,n)=>{var r;const s=mr(e),a=ln(e),i=(n==null?void 0:n.chainId)??a.chainId??s;return zr(e,{...n,...t.functionName?{functionName:t.functionName}:{},address:(r=t.address)==null?void 0:r[i],abi:t.abi})}:(e,n)=>zr(e,{...n,...t.address?{address:t.address}:{},...t.functionName?{functionName:t.functionName}:{},abi:t.abi})}async function Lr(t,e){const{account:n,chainId:r,connector:s,__mode:a,...i}=e;let o;typeof n=="object"&&n.type==="local"?o=t.getClient({chainId:r}):o=await qs(t,{account:n,chainId:r,connector:s});const{connector:u}=ln(t);let c;if(a==="prepared"||u!=null&&u.supportsSimulation)c=i;else{const{request:d}=await Un(t,{...i,account:n,chainId:r});c=d}return await yr(o,Ou,"writeContract")({...c,...n?{account:n}:{},chain:r?{id:r}:null})}function gr(t){return t.address!==void 0&&typeof t.address=="object"?(e,n)=>{var r;const s=mr(e),a=ln(e);let i;return n.chainId?i=n.chainId:n.account&&n.account===a.address||n.account===void 0?i=a.chainId:i=s,Lr(e,{...n,...t.functionName?{functionName:t.functionName}:{},address:i?(r=t.address)==null?void 0:r[i]:void 0,abi:t.abi})}:(e,n)=>Lr(e,{...n,...t.address?{address:t.address}:{},...t.functionName?{functionName:t.functionName}:{},abi:t.abi})}const xe=[{type:"error",inputs:[],name:"AllowanceOverflow"},{type:"error",inputs:[],name:"AllowanceUnderflow"},{type:"error",inputs:[],name:"InsufficientAllowance"},{type:"error",inputs:[],name:"InsufficientBalance"},{type:"error",inputs:[],name:"InvalidPermit"},{type:"error",inputs:[],name:"PermitExpired"},{type:"error",inputs:[],name:"TotalSupplyOverflow"},{type:"event",anonymous:!1,inputs:[{name:"owner",internalType:"address",type:"address",indexed:!0},{name:"spender",internalType:"address",type:"address",indexed:!0},{name:"amount",internalType:"uint256",type:"uint256",indexed:!1}],name:"Approval"},{type:"event",anonymous:!1,inputs:[{name:"from",internalType:"address",type:"address",indexed:!0},{name:"to",internalType:"address",type:"address",indexed:!0},{name:"amount",internalType:"uint256",type:"uint256",indexed:!1}],name:"Transfer"},{type:"function",inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{name:"result",internalType:"bytes32",type:"bytes32"}],stateMutability:"view"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"},{name:"spender",internalType:"address",type:"address"}],name:"allowance",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[{name:"spender",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"approve",outputs:[{name:"",internalType:"bool",type:"bool"}],stateMutability:"nonpayable"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"}],name:"balanceOf",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[],name:"decimals",outputs:[{name:"",internalType:"uint8",type:"uint8"}],stateMutability:"view"},{type:"function",inputs:[{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable"},{type:"function",inputs:[{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"mintPayable",outputs:[],stateMutability:"payable"},{type:"function",inputs:[],name:"name",outputs:[{name:"",internalType:"string",type:"string"}],stateMutability:"pure"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"}],name:"nonces",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"},{name:"spender",internalType:"address",type:"address"},{name:"value",internalType:"uint256",type:"uint256"},{name:"deadline",internalType:"uint256",type:"uint256"},{name:"v",internalType:"uint8",type:"uint8"},{name:"r",internalType:"bytes32",type:"bytes32"},{name:"s",internalType:"bytes32",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable"},{type:"function",inputs:[],name:"symbol",outputs:[{name:"",internalType:"string",type:"string"}],stateMutability:"pure"},{type:"function",inputs:[],name:"totalSupply",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"transfer",outputs:[{name:"",internalType:"bool",type:"bool"}],stateMutability:"nonpayable"},{type:"function",inputs:[{name:"from",internalType:"address",type:"address"},{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"transferFrom",outputs:[{name:"",internalType:"bool",type:"bool"}],stateMutability:"nonpayable"}],Vu=Ws({abi:xe,functionName:"allowance"}),Uu=Ws({abi:xe,functionName:"balanceOf"}),Gu=gr({abi:xe,functionName:"approve"}),Hu=gr({abi:xe,functionName:"mint"}),qu=gr({abi:xe,functionName:"mintPayable"}),Wu=br({abi:xe,functionName:"approve"}),Ku=br({abi:xe,functionName:"mint"}),Ju=br({abi:xe,functionName:"mintPayable"}),Yu="0x6080604052348015600e575f80fd5b50610a3c8061001c5f395ff3fe6080604052600436106100d9575f3560e01c806340c10f191161007c57806395d89b411161005757806395d89b4114610323578063a9059cbb14610368578063d505accf14610387578063dd62ed3e146103a6575f80fd5b806340c10f19146102a257806370a08231146102c15780637ecebe00146102f2575f80fd5b806318160ddd116100b757806318160ddd1461017857806323b872dd1461019e578063313ce567146101bd5780633644e515146101d8575f80fd5b806306fdde03146100dd578063095ea7b31461013457806317d304b014610163575b5f80fd5b3480156100e8575f80fd5b5060408051808201909152600a81527f4d6f636b2045524332300000000000000000000000000000000000000000000060208201525b60405161012b9190610833565b60405180910390f35b34801561013f575f80fd5b5061015361014e3660046108ae565b6103da565b604051901515815260200161012b565b6101766101713660046108ae565b610429565b005b348015610183575f80fd5b506805345cdf77eb68f44c545b60405190815260200161012b565b3480156101a9575f80fd5b506101536101b83660046108d6565b6104af565b3480156101c8575f80fd5b506040516012815260200161012b565b3480156101e3575f80fd5b50604080518082018252600a81527f4d6f636b2045524332300000000000000000000000000000000000000000000060209182015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81527fa5c9260bf133e670eeaf4d41f5c4289fc23bb146bf11ba8fa70a2ea91ba1a330918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc69181019190915246606082015230608082015260a09020610190565b3480156102ad575f80fd5b506101766102bc3660046108ae565b6104a1565b3480156102cc575f80fd5b506101906102db366004610910565b6387a211a2600c9081525f91909152602090205490565b3480156102fd575f80fd5b5061019061030c366004610910565b6338377508600c9081525f91909152602090205490565b34801561032e575f80fd5b5060408051808201909152600481527f4d4f434b00000000000000000000000000000000000000000000000000000000602082015261011e565b348015610373575f80fd5b506101536103823660046108ae565b610569565b348015610392575f80fd5b506101766103a1366004610930565b6105e0565b3480156103b1575f80fd5b506101906103c036600461099d565b602052637f5e9f20600c9081525f91909152603490205490565b5f82602052637f5e9f20600c52335f52816034600c2055815f52602c5160601c337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560205fa350600192915050565b6104346064826109ce565b3410156104a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4d6f636b45524332303a2067696d6d65206d6f7265206d6f6e65792100000000604482015260640160405180910390fd5b6104ab82826107b7565b5050565b5f8360601b33602052637f5e9f208117600c526034600c20805460018101156104ed57808511156104e7576313be252b5f526004601cfd5b84810382555b50506387a211a28117600c526020600c208054808511156105155763f4d678b85f526004601cfd5b84810382555050835f526020600c208381540181555082602052600c5160601c8160601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a3505060019392505050565b5f6387a211a2600c52335f526020600c208054808411156105915763f4d678b85f526004601cfd5b83810382555050825f526020600c208281540181555081602052600c5160601c337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a350600192915050565b60408051808201909152600a81527f4d6f636b204552433230000000000000000000000000000000000000000000006020909101527fa5c9260bf133e670eeaf4d41f5c4289fc23bb146bf11ba8fa70a2ea91ba1a3308442111561064b57631a15a3cc5f526004601cfd5b6040518860601b60601c98508760601b60601c975065383775081901600e52885f526020600c2080547f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f83528360208401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604084015246606084015230608084015260a08320602e527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983528a60208401528960408401528860608401528060808401528760a084015260c08320604e526042602c205f528660ff16602052856040528460605260208060805f60015afa8b3d51146107535763ddafbaef5f526004601cfd5b019055777f5e9f20000000000000000000000000000000000000000088176040526034602c2087905587897f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925602060608501a360405250505f606052505050505050565b6805345cdf77eb68f44c54818101818110156107da5763e5cfe9575f526004601cfd5b806805345cdf77eb68f44c5550506387a211a2600c52815f526020600c208181540181555080602052600c5160601c5f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a35050565b602081525f82518060208401528060208501604085015e5f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146108a9575f80fd5b919050565b5f80604083850312156108bf575f80fd5b6108c883610886565b946020939093013593505050565b5f805f606084860312156108e8575f80fd5b6108f184610886565b92506108ff60208501610886565b929592945050506040919091013590565b5f60208284031215610920575f80fd5b61092982610886565b9392505050565b5f805f805f805f60e0888a031215610946575f80fd5b61094f88610886565b965061095d60208901610886565b95506040880135945060608801359350608088013560ff81168114610980575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f80604083850312156109ae575f80fd5b6109b783610886565b91506109c560208401610886565b90509250929050565b5f82610a01577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea2646970667358221220e9f2a6c8a0f6903aa66381a940f90d1a4bd641eefee9027e191158343e018f4b64736f6c634300081a0033";class Ks extends N.Deployable{async balanceOf(e,n){return await Uu(this._config,{address:this.assertValidAddress(),args:[e],...n})}async allowance(e,n,r){return await Vu(this._config,{address:this.assertValidAddress(),args:[e,n],...r})}async approve(e,n,r){return await this.awaitResult(this.approveRaw(e,n,r))}async approveRaw(e,n,r){const{request:s,result:a}=await Wu(this._config,{address:this.assertValidAddress(),args:[e,n],...this.optionallyAttachAccount(),...r});return{hash:await Gu(this._config,s),result:a}}async mint(e,n,r){return await this.awaitResult(this.mintRaw(e,n,r))}async mintRaw(e,n,r){const{request:s,result:a}=await Ku(this._config,{address:this.assertValidAddress(),args:[e,n],...this.optionallyAttachAccount(),...r});return{hash:await Hu(this._config,s),result:a}}async mintPayable(e,n,r){return await this.awaitResult(this.mintPayableRaw(e,n,r))}async mintPayableRaw(e,n,r){const{request:s,result:a}=await Ju(this._config,{address:this.assertValidAddress(),args:[e,n],...this.optionallyAttachAccount(),...r});return{hash:await qu(this._config,s),result:a}}buildParameters(e={},n){const[,r]=this.validateDeploymentConfig(e,n);return{abi:xe,bytecode:Yu,...this.optionallyAttachAccount(r.account)}}}const Xu=[{account:"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",key:"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",key:"0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"},{account:"0x90F79bf6EB2c4f870365E785982E1f101E93b906",key:"0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6"},{account:"0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",key:"0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a"},{account:"0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",key:"0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"}].map(t=>({...t,privateKey:G.privateKeyToAccount(t.key)})),Qu="test test test test test test test test test test test junk",ed=async function(e,n){const r=n.privateKey,s=n.mnemonic??Qu,a=n.chain||"anvil",[{config:i,account:o},u]=G.getDeployableOptions({chain:a,rpcUrl:n.rpcUrl,privateKey:r,mnemonic:s}),c=u.id;if(e.at(0)==="generate")return ma({account:o==null?void 0:o.address,chainId:c});if(e.at(0)==="erc20"){let A=new Ks({config:i,account:o},{});return await A.deploy(),{erc20:A.assertValidAddress()}}const d=N.BOOST_REGISTRY_ADDRESSES[c];if(!d)throw new Error(`Unable to select a deployed BoostRegistry with chain ID ${c}`);const l=new N.BoostRegistry({config:i,account:o,address:d}),f=N.BOOST_CORE_ADDRESSES[c];if(!f)throw new Error(`Unable to select a deployed BoostCore with chain ID ${c}`);const m=new N.BoostCore({config:i,account:o,address:f});if(!e.length)throw new Error("No seed provided");const v=await Promise.all(e.map(td));let k,P;const I=[];let R;for(const A of v){let M;if(typeof A.budget=="string"&&G.isAddress$1(A.budget))M=m.ManagedBudget(A.budget);else if(Pn(P,A.budget)&&k)M=k;else{let C=A.budget;switch(C.type){case"ManagedBudget":{const B={...C,authorized:[...A.budget.authorized,f],roles:[...A.budget.roles,N.Roles.MANAGER]};M=await l.initialize(crypto.randomUUID(),m.ManagedBudget(B))}case"ManagedBudgetWithFeesV2":{const B={managementFee:0n,...C,authorized:[...A.budget.authorized,f],roles:[...A.budget.roles,N.Roles.MANAGER]};M=await l.initialize(crypto.randomUUID(),m.ManagedBudgetWithFeesV2(B))}}k=M,P=A.budget,R=M.assertValidAddress()}const J=A.incentives.map(async C=>{let B=0n;switch(C.type){case"AllowListIncentive":return m.AllowListIncentive(C);case"PointsIncentive":return m.PointsIncentive(C);case"ERC20Incentive":return C.strategy===N.StrategyType.RAFFLE&&(B+=C.reward),C.strategy===N.StrategyType.POOL&&(B+=C.reward*C.limit),C.shouldMintAndAllocate&&await rt(M,B,C.asset,{config:i,account:o}),m.ERC20Incentive(C);case"ERC20VariableCriteriaIncentive":return B+=C.limit,C.shouldMintAndAllocate&&await rt(M,B,C.asset,{config:i,account:o}),m.ERC20VariableCriteriaIncentive(C);case"ERC20PeggedVariableCriteriaIncentive":return B+=C.limit,C.shouldMintAndAllocate&&await rt(M,B,C.asset,{config:i,account:o}),m.ERC20PeggedVariableCriteriaIncentive(C);case"ERC20VariableIncentive":return B+=C.limit,C.shouldMintAndAllocate&&await rt(M,B,C.asset,{config:i,account:o}),m.ERC20VariableIncentive(C);case"CGDAIncentive":return B+=C.totalBudget,C.shouldMintAndAllocate&&await rt(M,B,C.asset,{config:i,account:o}),m.CGDAIncentive(C)}}),z=await Promise.all(J),Q={protocolFee:A.protocolFee,maxParticipants:A.maxParticipants,budget:M,action:m.EventAction(A.action),allowList:await pa(A,{core:m}),incentives:z};A.validator&&(Q.validator=m.SignerValidator(A.validator));const ae=await m.createBoost(Q);I.push(ae.id.toString())}return{boostIds:I,budget:R}};async function rt(t,e,n,r){if(n&&e){let s=new Ks(r,n);await rd(r,s,t,Dr(e.toString()))}}async function td(t){const e=await ya.readFile(ba.normalize(t),{encoding:"utf8"});return wr.parse(JSON.parse(e))}const nd=p.custom(G.isHex$1,"invalid Hex payload"),S=p.string().transform((t,e)=>(/^0x[a-fA-F0-9]{40}$/.test(t)||e.addIssue({code:p.ZodIssueCode.custom,message:`Invalid Address ${t}`}),t)).pipe(p.custom(G.isAddress$1,"invalid eth address")),Js=p.coerce.number().min(1).max(2).transform(BigInt).pipe(p.custom()),Ys=p.object({type:p.literal("ManagedBudgetWithFeesV2"),owner:S,authorized:p.array(S),managementFee:p.coerce.bigint().nonnegative().lt(10000n),roles:p.array(Js)}).refine(t=>t.authorized.length===t.roles.length,"length mismatch authorized and roles"),Xs=p.object({type:p.literal("ManagedBudget"),owner:S,authorized:p.array(S),roles:p.array(Js)}).refine(t=>t.authorized.length===t.roles.length,"length mismatch authorized and roles"),fn=p.custom().pipe(p.string().regex(/^(event|function) .*/,{message:"signature must start with `event` or function`"}).transform(t=>{if(t.startsWith("function"))return G.pad(G.toFunctionSelector(t));if(t.startsWith("event"))return G.toEventSelector(t);throw new Error("unreachable")})),Qs=p.object({signatureType:p.nativeEnum(N.SignatureType),signature:fn,fieldIndex:p.number().nonnegative(),targetContract:S,chainid:p.number().nonnegative()}),ea=p.object({filterType:p.nativeEnum(N.FilterType),fieldType:p.nativeEnum(N.PrimitiveType),fieldIndex:p.number().nonnegative(),filterData:nd}),ta=p.object({signature:fn,signatureType:p.nativeEnum(N.SignatureType),actionType:p.number().optional(),targetContract:S,chainid:p.number().nonnegative(),actionParameter:ea}),na=p.object({type:p.literal("EventAction"),actionClaimant:Qs,actionSteps:p.array(ta).max(4)}),ra=p.object({type:p.literal("LimitedSignerValidator"),signers:p.array(S),validatorCaller:S,maxClaimCount:p.coerce.number()}),sa=p.object({type:p.literal("SignerValidator"),signers:p.array(S),validatorCaller:S}),aa=p.object({type:p.literal("SimpleDenyList"),owner:S,denied:p.array(S)}),ia=p.object({type:p.literal("SimpleAllowList"),owner:S,allowed:p.array(S)}),oa=p.object({type:p.literal("AllowListIncentive"),allowList:S,limit:p.coerce.bigint()}),ca=p.object({type:p.literal("ERC20Incentive"),asset:S,shouldMintAndAllocate:p.boolean().optional().default(!1),strategy:p.nativeEnum(N.StrategyType),reward:p.coerce.bigint(),limit:p.coerce.bigint(),manager:S.optional()}),ua=p.object({type:p.literal("ERC20VariableIncentive"),asset:S,shouldMintAndAllocate:p.boolean().optional().default(!1),reward:p.coerce.bigint(),limit:p.coerce.bigint(),manager:S}),vr=p.object({criteriaType:p.nativeEnum(N.SignatureType),signature:fn,fieldIndex:p.number().nonnegative(),targetContract:S}),da=p.object({type:p.literal("ERC20VariableCriteriaIncentive"),asset:S,shouldMintAndAllocate:p.boolean().optional().default(!1),reward:p.coerce.bigint(),limit:p.coerce.bigint(),manager:S.optional(),criteria:vr}),la=p.object({type:p.literal("ERC20PeggedVariableCriteriaIncentive"),asset:S,shouldMintAndAllocate:p.boolean().optional().default(!1),maxReward:p.coerce.bigint(),peg:S,reward:p.coerce.bigint(),limit:p.coerce.bigint(),manager:S.optional(),criteria:vr}),fa=p.object({type:p.literal("CGDAIncentive"),asset:S,shouldMintAndAllocate:p.boolean().optional().default(!1),initialReward:p.coerce.bigint(),rewardDecay:p.coerce.bigint(),rewardBoost:p.coerce.bigint(),totalBudget:p.coerce.bigint(),manager:S}),ha=p.object({type:p.literal("PointsIncentive"),venue:S,selector:fn,reward:p.coerce.bigint(),limit:p.coerce.bigint()}),wr=p.object({protocolFee:p.coerce.bigint(),maxParticipants:p.coerce.bigint(),budget:p.union([S,Xs,Ys]),action:p.union([S,na]),validator:p.union([S,sa,ra]).optional(),allowList:p.union([S,aa,ia]).optional(),incentives:p.array(p.union([oa,ca,da,la,ua,fa,ha]))});async function pa({allowList:t},{core:e}){if(!t)return e.OpenAllowList();if(typeof t=="string"&&G.isAddress$1(t))return await N.allowListFromAddress({config:e._config,account:e._account},t);switch(t.type){case"SimpleAllowList":return e.SimpleAllowList(t);case"SimpleDenyList":return e.SimpleDenyList(t);default:throw new Error("unusupported AllowList: "+t)}}async function rd(t,e,n,r=Dr("110")){return await e.mint(t.account.address,r),await e.approve(n.assertValidAddress(),r),await n.allocate({amount:r,asset:e.assertValidAddress(),target:t.account.address}),{budget:n,erc20:e}}function ma({asset:t="0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D",account:e=Xu[0].account,chainId:n}){return{protocolFee:0n,maxParticipants:10n,budget:{type:"ManagedBudgetWithFeesV2",owner:e,authorized:[e],roles:[N.Roles.MANAGER],managementFee:500n},action:{type:"EventAction",actionClaimant:{signatureType:N.SignatureType.FUNC,signature:"function mint(address to, uint256 amount)",fieldIndex:0,targetContract:_r,chainid:n},actionSteps:[{signature:"event Minted(address to, uint256 amount)",signatureType:N.SignatureType.FUNC,actionType:0,targetContract:_r,chainid:n,actionParameter:{filterType:N.FilterType.EQUAL,fieldType:N.PrimitiveType.ADDRESS,fieldIndex:0,filterData:e}}]},validator:{type:"SignerValidator",signers:[e],validatorCaller:e},allowList:{type:"SimpleDenyList",owner:e,denied:[]},incentives:[{type:"ERC20Incentive",asset:t,shouldMintAndAllocate:!1,strategy:0,reward:1n,limit:1n,manager:e}]}}async function sd(t,e){const n=wr.parse(t);let r;if(typeof n.budget=="string"&&G.isAddress$1(n.budget))r=e.ManagedBudgetWithFeesV2(n.budget);else throw new Error("budget missing");const s=n.incentives.map(i=>{switch(i.type){case"AllowListIncentive":return e.AllowListIncentive(i);case"PointsIncentive":return e.PointsIncentive(i);case"ERC20Incentive":return e.ERC20Incentive(i);case"ERC20VariableCriteriaIncentive":return e.ERC20VariableCriteriaIncentive(i);case"ERC20PeggedVariableCriteriaIncentive":return e.ERC20PeggedVariableCriteriaIncentive(i);case"ERC20VariableIncentive":return e.ERC20VariableIncentive(i);case"CGDAIncentive":return e.CGDAIncentive(i)}}),a={protocolFee:n.protocolFee,maxParticipants:n.maxParticipants,budget:r,action:e.EventAction(n.action),allowList:await pa(n,{core:e}),incentives:s};if(n.validator&&typeof n.validator=="object")switch(n.validator.type){case"SignerValidator":a.validator=e.SignerValidator(n.validator);break;case"LimitedSignerValidator":a.validator=e.LimitedSignerValidator(n.validator);default:throw new Error("unsupported Validator: "+n.validator)}return a}exports.ActionClaimantSchema=Qs;exports.ActionStepCriteriaSchema=ea;exports.ActionStepSchema=ta;exports.AllowListIncentiveSchema=oa;exports.BaseError=y;exports.BoostSeedConfigSchema=wr;exports.CGDAIncentiveSchema=fa;exports.ERC20IncentiveSchema=ca;exports.ERC20PeggedVariableCriteriaIncentiveSchema=la;exports.ERC20VariableCriteriaIncentiveSchema=da;exports.ERC20VariableIncentiveSchema=ua;exports.EventActionSchema=na;exports.HttpRequestError=sr;exports.IncentiveCriteriaSchema=vr;exports.InvalidAddressError=Ye;exports.LimitedSignerValidatorSchema=ra;exports.ManagedBudgetSchema=Xs;exports.ManagedBudgetWithFeesV2Schema=Ys;exports.PointsIncentiveSchema=ha;exports.SignerValidatorSchema=sa;exports.SimpleAllowListSchema=ia;exports.SimpleDenyListSchema=aa;exports.call=pr;exports.concat=je;exports.decodeErrorResult=Ds;exports.encodeAbiParameters=Yn;exports.getCreateBoostPayloadFromBoostConfig=sd;exports.getUrl=rr;exports.isAddress=we;exports.isHex=ge;exports.makeSeed=ma;exports.seed=ed;exports.stringify=Lt;
|