@boostxyz/cli 1.1.0-alpha.34 → 1.1.0-alpha.36

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.
@@ -1,23 +1,80 @@
1
- import X from "node:fs/promises";
2
- import e0 from "node:path";
3
- import { Deployable as t0, SignatureType as v, FilterType as $, PrimitiveType as k, StrategyType as E, BOOST_REGISTRY_ADDRESSES as a0, BoostRegistry as n0, BOOST_CORE_ADDRESSES as c0, BoostCore as i0, Roles as U, allowListFromAddress as r0 } from "@boostxyz/sdk";
4
- import { simulateContract as o0, readContract as s0, writeContract as d0 } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/viem@2.21.16_bufferutil@4.0.8_typescript@5.6.2_utf-8-validate@6.0.4_zod@3.23.8/node_modules/viem/_esm/actions/index.js";
5
- import { createClient as f0, custom as b0, isHex as u0, isAddress as R, pad as l0, toFunctionSelector as p0, toEventSelector as m0, parseEther as H, zeroAddress as L } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/viem@2.21.16_bufferutil@4.0.8_typescript@5.6.2_utf-8-validate@6.0.4_zod@3.23.8/node_modules/viem/_esm/index.js";
6
- import { parseAccount as y0, getAddress as h0 } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/viem@2.21.16_bufferutil@4.0.8_typescript@5.6.2_utf-8-validate@6.0.4_zod@3.23.8/node_modules/viem/_esm/utils/index.js";
7
- import { privateKeyToAccount as g0 } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/viem@2.21.16_bufferutil@4.0.8_typescript@5.6.2_utf-8-validate@6.0.4_zod@3.23.8/node_modules/viem/_esm/accounts/index.js";
8
- import { deepEqual as w0 } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/@wagmi+core@2.13.8_@tanstack+query-core@5.32.0_@types+react@18.3.0_immer@10.0.2_react@18.3.0__rf4knvbttxkigkqzlfrm4rcvsi/node_modules/@wagmi/core/dist/esm/exports/index.js";
9
- import { z as c } from "/home/runner/work/boost-protocol/boost-protocol/node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs";
10
- import { g as v0 } from "../utils-D0bdHF2y.js";
11
- function A(a) {
12
- const t = a.state.current, e = a.state.connections.get(t), n = e == null ? void 0 : e.accounts, r = n == null ? void 0 : n[0], o = a.chains.find((f) => f.id === (e == null ? void 0 : e.chainId)), i = a.state.status;
1
+ import Tt from "node:fs/promises";
2
+ import Ct from "node:path";
3
+ import { Deployable as St, SignatureType as se, FilterType as tt, PrimitiveType as nt, StrategyType as je, BOOST_REGISTRY_ADDRESSES as It, BoostRegistry as Et, BOOST_CORE_ADDRESSES as At, BoostCore as Nt, Roles as at, allowListFromAddress as Ot } from "@boostxyz/sdk";
4
+ import { B as Rt, l as Zt, p as jt, c as Mt, f as $t, h as Pt, s as Dt, r as Vt, w as Bt, m as Lt, n as zt, q as Le, t as Ut, u as Wt, x as qt, k as Ht } from "../utils-CX1JpbvX.js";
5
+ class Ft extends Rt {
6
+ constructor({ value: e }) {
7
+ super(`Number \`${e}\` is not a valid decimal number.`, {
8
+ name: "InvalidDecimalNumberError"
9
+ });
10
+ }
11
+ }
12
+ function Jt(n, e) {
13
+ if (!/^(-?)([0-9]*)\.?([0-9]*)$/.test(n))
14
+ throw new Ft({ value: n });
15
+ let [t, a = "0"] = n.split(".");
16
+ const r = t.startsWith("-");
17
+ if (r && (t = t.slice(1)), a = a.replace(/(0+)$/, ""), e === 0)
18
+ Math.round(+`.${a}`) === 1 && (t = `${BigInt(t) + 1n}`), a = "";
19
+ else if (a.length > e) {
20
+ const [s, i, o] = [
21
+ a.slice(0, e - 1),
22
+ a.slice(e - 1, e),
23
+ a.slice(e)
24
+ ], u = Math.round(+`${i}.${o}`);
25
+ u > 9 ? a = `${BigInt(s) + BigInt(1)}0`.padStart(s.length + 1, "0") : a = `${s}${u}`, a.length > e && (a = a.slice(1), t = `${BigInt(t) + 1n}`), a = a.slice(0, e);
26
+ } else
27
+ a = a.padEnd(e, "0");
28
+ return BigInt(`${r ? "-" : ""}${t}${a}`);
29
+ }
30
+ function rt(n, e = "wei") {
31
+ return Jt(n, Zt[e]);
32
+ }
33
+ const Ge = "0x0000000000000000000000000000000000000000";
34
+ function Me(n, e) {
35
+ if (n === e)
36
+ return !0;
37
+ if (n && e && typeof n == "object" && typeof e == "object") {
38
+ if (n.constructor !== e.constructor)
39
+ return !1;
40
+ let t, a;
41
+ if (Array.isArray(n) && Array.isArray(e)) {
42
+ if (t = n.length, t !== e.length)
43
+ return !1;
44
+ for (a = t; a-- !== 0; )
45
+ if (!Me(n[a], e[a]))
46
+ return !1;
47
+ return !0;
48
+ }
49
+ if (n.valueOf !== Object.prototype.valueOf)
50
+ return n.valueOf() === e.valueOf();
51
+ if (n.toString !== Object.prototype.toString)
52
+ return n.toString() === e.toString();
53
+ const r = Object.keys(n);
54
+ if (t = r.length, t !== Object.keys(e).length)
55
+ return !1;
56
+ for (a = t; a-- !== 0; )
57
+ if (!Object.prototype.hasOwnProperty.call(e, r[a]))
58
+ return !1;
59
+ for (a = t; a-- !== 0; ) {
60
+ const s = r[a];
61
+ if (s && !Me(n[s], e[s]))
62
+ return !1;
63
+ }
64
+ return !0;
65
+ }
66
+ return n !== n && e !== e;
67
+ }
68
+ function Ae(n) {
69
+ const e = n.state.current, t = n.state.connections.get(e), a = t == null ? void 0 : t.accounts, r = a == null ? void 0 : a[0], s = n.chains.find((o) => o.id === (t == null ? void 0 : t.chainId)), i = n.state.status;
13
70
  switch (i) {
14
71
  case "connected":
15
72
  return {
16
73
  address: r,
17
- addresses: n,
18
- chain: o,
19
- chainId: e == null ? void 0 : e.chainId,
20
- connector: e == null ? void 0 : e.connector,
74
+ addresses: a,
75
+ chain: s,
76
+ chainId: t == null ? void 0 : t.chainId,
77
+ connector: t == null ? void 0 : t.connector,
21
78
  isConnected: !0,
22
79
  isConnecting: !1,
23
80
  isDisconnected: !1,
@@ -27,10 +84,10 @@ function A(a) {
27
84
  case "reconnecting":
28
85
  return {
29
86
  address: r,
30
- addresses: n,
31
- chain: o,
32
- chainId: e == null ? void 0 : e.chainId,
33
- connector: e == null ? void 0 : e.connector,
87
+ addresses: a,
88
+ chain: s,
89
+ chainId: t == null ? void 0 : t.chainId,
90
+ connector: t == null ? void 0 : t.connector,
34
91
  isConnected: !!r,
35
92
  isConnecting: !1,
36
93
  isDisconnected: !1,
@@ -40,10 +97,10 @@ function A(a) {
40
97
  case "connecting":
41
98
  return {
42
99
  address: r,
43
- addresses: n,
44
- chain: o,
45
- chainId: e == null ? void 0 : e.chainId,
46
- connector: e == null ? void 0 : e.connector,
100
+ addresses: a,
101
+ chain: s,
102
+ chainId: t == null ? void 0 : t.chainId,
103
+ connector: t == null ? void 0 : t.connector,
47
104
  isConnected: !1,
48
105
  isConnecting: !0,
49
106
  isDisconnected: !1,
@@ -65,32 +122,32 @@ function A(a) {
65
122
  };
66
123
  }
67
124
  }
68
- function B(a) {
69
- return a.state.chainId;
125
+ function ze(n) {
126
+ return n.state.chainId;
70
127
  }
71
- function P(a, t, e) {
72
- const n = a[t.name];
73
- if (typeof n == "function")
74
- return n;
75
- const r = a[e];
76
- return typeof r == "function" ? r : (o) => t(a, o);
128
+ function Ue(n, e, t) {
129
+ const a = n[e.name];
130
+ if (typeof a == "function")
131
+ return a;
132
+ const r = n[t];
133
+ return typeof r == "function" ? r : (s) => e(n, s);
77
134
  }
78
- const C0 = "2.13.8", A0 = () => `@wagmi/core@${C0}`;
79
- var z = function(a, t, e, n) {
80
- if (e === "a" && !n) throw new TypeError("Private accessor was defined without a getter");
81
- if (typeof t == "function" ? a !== t || !n : !t.has(a)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
82
- return e === "m" ? n : e === "a" ? n.call(a) : n ? n.value : t.get(a);
83
- }, C, q;
84
- class w extends Error {
135
+ const Yt = "2.13.8", Gt = () => `@wagmi/core@${Yt}`;
136
+ var st = function(n, e, t, a) {
137
+ if (t === "a" && !a) throw new TypeError("Private accessor was defined without a getter");
138
+ if (typeof e == "function" ? n !== e || !a : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
139
+ return t === "m" ? a : t === "a" ? a.call(n) : a ? a.value : e.get(n);
140
+ }, xe, it;
141
+ class F extends Error {
85
142
  get docsBaseUrl() {
86
143
  return "https://wagmi.sh/core";
87
144
  }
88
145
  get version() {
89
- return A0();
146
+ return Gt();
90
147
  }
91
- constructor(t, e = {}) {
92
- var n;
93
- super(), C.add(this), Object.defineProperty(this, "details", {
148
+ constructor(e, t = {}) {
149
+ var a;
150
+ super(), xe.add(this), Object.defineProperty(this, "details", {
94
151
  enumerable: !0,
95
152
  configurable: !0,
96
153
  writable: !0,
@@ -116,27 +173,27 @@ class w extends Error {
116
173
  writable: !0,
117
174
  value: "WagmiCoreError"
118
175
  });
119
- const r = e.cause instanceof w ? e.cause.details : (n = e.cause) != null && n.message ? e.cause.message : e.details, o = e.cause instanceof w && e.cause.docsPath || e.docsPath;
176
+ const r = t.cause instanceof F ? t.cause.details : (a = t.cause) != null && a.message ? t.cause.message : t.details, s = t.cause instanceof F && t.cause.docsPath || t.docsPath;
120
177
  this.message = [
121
- t || "An error occurred.",
178
+ e || "An error occurred.",
122
179
  "",
123
- ...e.metaMessages ? [...e.metaMessages, ""] : [],
124
- ...o ? [
125
- `Docs: ${this.docsBaseUrl}${o}.html${e.docsSlug ? `#${e.docsSlug}` : ""}`
180
+ ...t.metaMessages ? [...t.metaMessages, ""] : [],
181
+ ...s ? [
182
+ `Docs: ${this.docsBaseUrl}${s}.html${t.docsSlug ? `#${t.docsSlug}` : ""}`
126
183
  ] : [],
127
184
  ...r ? [`Details: ${r}`] : [],
128
185
  `Version: ${this.version}`
129
186
  ].join(`
130
- `), e.cause && (this.cause = e.cause), this.details = r, this.docsPath = o, this.metaMessages = e.metaMessages, this.shortMessage = t;
187
+ `), t.cause && (this.cause = t.cause), this.details = r, this.docsPath = s, this.metaMessages = t.metaMessages, this.shortMessage = e;
131
188
  }
132
- walk(t) {
133
- return z(this, C, "m", q).call(this, this, t);
189
+ walk(e) {
190
+ return st(this, xe, "m", it).call(this, this, e);
134
191
  }
135
192
  }
136
- C = /* @__PURE__ */ new WeakSet(), q = function a(t, e) {
137
- return e != null && e(t) ? t : t.cause ? z(this, C, "m", a).call(this, t.cause, e) : t;
193
+ xe = /* @__PURE__ */ new WeakSet(), it = function n(e, t) {
194
+ return t != null && t(e) ? e : e.cause ? st(this, xe, "m", n).call(this, e.cause, t) : e;
138
195
  };
139
- class I0 extends w {
196
+ class Qt extends F {
140
197
  constructor() {
141
198
  super("Connector not connected."), Object.defineProperty(this, "name", {
142
199
  enumerable: !0,
@@ -146,9 +203,9 @@ class I0 extends w {
146
203
  });
147
204
  }
148
205
  }
149
- class T0 extends w {
150
- constructor({ address: t, connector: e }) {
151
- super(`Account "${t}" not found for connector "${e.name}".`), Object.defineProperty(this, "name", {
206
+ class Kt extends F {
207
+ constructor({ address: e, connector: t }) {
208
+ super(`Account "${e}" not found for connector "${t.name}".`), Object.defineProperty(this, "name", {
152
209
  enumerable: !0,
153
210
  configurable: !0,
154
211
  writable: !0,
@@ -156,12 +213,12 @@ class T0 extends w {
156
213
  });
157
214
  }
158
215
  }
159
- class S0 extends w {
160
- constructor({ connectionChainId: t, connectorChainId: e }) {
161
- super(`The current chain of the connector (id: ${e}) does not match the connection's chain (id: ${t}).`, {
216
+ class Xt extends F {
217
+ constructor({ connectionChainId: e, connectorChainId: t }) {
218
+ super(`The current chain of the connector (id: ${t}) does not match the connection's chain (id: ${e}).`, {
162
219
  metaMessages: [
163
- `Current Chain ID: ${e}`,
164
- `Expected Chain ID: ${t}`
220
+ `Current Chain ID: ${t}`,
221
+ `Expected Chain ID: ${e}`
165
222
  ]
166
223
  }), Object.defineProperty(this, "name", {
167
224
  enumerable: !0,
@@ -171,9 +228,9 @@ class S0 extends w {
171
228
  });
172
229
  }
173
230
  }
174
- class x0 extends w {
175
- constructor({ connector: t }) {
176
- super(`Connector "${t.name}" unavailable while reconnecting.`, {
231
+ class en extends F {
232
+ constructor({ connector: e }) {
233
+ super(`Connector "${e.name}" unavailable while reconnecting.`, {
177
234
  details: [
178
235
  "During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.",
179
236
  "All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.",
@@ -187,141 +244,141 @@ class x0 extends w {
187
244
  });
188
245
  }
189
246
  }
190
- async function W(a, t = {}) {
191
- let e;
192
- if (t.connector) {
193
- const { connector: s } = t;
194
- if (a.state.status === "reconnecting" && !s.getAccounts && !s.getChainId)
195
- throw new x0({ connector: s });
196
- const [y, I] = await Promise.all([
197
- s.getAccounts(),
198
- s.getChainId()
247
+ async function ot(n, e = {}) {
248
+ let t;
249
+ if (e.connector) {
250
+ const { connector: c } = e;
251
+ if (n.state.status === "reconnecting" && !c.getAccounts && !c.getChainId)
252
+ throw new en({ connector: c });
253
+ const [m, C] = await Promise.all([
254
+ c.getAccounts(),
255
+ c.getChainId()
199
256
  ]);
200
- e = {
201
- accounts: y,
202
- chainId: I,
203
- connector: s
257
+ t = {
258
+ accounts: m,
259
+ chainId: C,
260
+ connector: c
204
261
  };
205
262
  } else
206
- e = a.state.connections.get(a.state.current);
207
- if (!e)
208
- throw new I0();
209
- const n = t.chainId ?? e.chainId, r = await e.connector.getChainId();
210
- if (r !== e.chainId)
211
- throw new S0({
212
- connectionChainId: e.chainId,
263
+ t = n.state.connections.get(n.state.current);
264
+ if (!t)
265
+ throw new Qt();
266
+ const a = e.chainId ?? t.chainId, r = await t.connector.getChainId();
267
+ if (r !== t.chainId)
268
+ throw new Xt({
269
+ connectionChainId: t.chainId,
213
270
  connectorChainId: r
214
271
  });
215
- const o = e.connector;
216
- if (o.getClient)
217
- return o.getClient({ chainId: n });
218
- const i = y0(t.account ?? e.accounts[0]);
219
- if (i.address = h0(i.address), t.account && !e.accounts.some((s) => s.toLowerCase() === i.address.toLowerCase()))
220
- throw new T0({
272
+ const s = t.connector;
273
+ if (s.getClient)
274
+ return s.getClient({ chainId: a });
275
+ const i = jt(e.account ?? t.accounts[0]);
276
+ if (i.address = Mt(i.address), e.account && !t.accounts.some((c) => c.toLowerCase() === i.address.toLowerCase()))
277
+ throw new Kt({
221
278
  address: i.address,
222
- connector: o
279
+ connector: s
223
280
  });
224
- const f = a.chains.find((s) => s.id === n), m = await e.connector.getProvider({ chainId: n });
225
- return f0({
281
+ const o = n.chains.find((c) => c.id === a), u = await t.connector.getProvider({ chainId: a });
282
+ return $t({
226
283
  account: i,
227
- chain: f,
284
+ chain: o,
228
285
  name: "Connector Client",
229
- transport: (s) => b0(m)({ ...s, retryCount: 0 })
286
+ transport: (c) => Pt(u)({ ...c, retryCount: 0 })
230
287
  });
231
288
  }
232
- async function M(a, t) {
233
- const { abi: e, chainId: n, connector: r, ...o } = t;
289
+ async function $e(n, e) {
290
+ const { abi: t, chainId: a, connector: r, ...s } = e;
234
291
  let i;
235
- t.account ? i = t.account : i = (await W(a, {
236
- chainId: n,
292
+ e.account ? i = e.account : i = (await ot(n, {
293
+ chainId: a,
237
294
  connector: r
238
295
  })).account;
239
- const f = a.getClient({ chainId: n }), m = P(f, o0, "simulateContract"), { result: s, request: y } = await m({ ...o, abi: e, account: i });
296
+ const o = n.getClient({ chainId: a }), u = Ue(o, Dt, "simulateContract"), { result: c, request: m } = await u({ ...s, abi: t, account: i });
240
297
  return {
241
- chainId: f.chain.id,
242
- result: s,
243
- request: { __mode: "prepared", ...y, chainId: n }
298
+ chainId: o.chain.id,
299
+ result: c,
300
+ request: { __mode: "prepared", ...m, chainId: a }
244
301
  };
245
302
  }
246
- function N(a) {
247
- return a.address !== void 0 && typeof a.address == "object" ? (t, e) => {
248
- var n;
249
- const r = B(t), o = A(t), i = (e == null ? void 0 : e.chainId) ?? o.chainId ?? r;
250
- return M(t, {
251
- ...e,
252
- ...a.functionName ? { functionName: a.functionName } : {},
253
- address: (n = a.address) == null ? void 0 : n[i],
254
- abi: a.abi
255
- });
256
- } : (t, e) => M(t, {
257
- ...e,
258
- ...a.address ? { address: a.address } : {},
259
- ...a.functionName ? { functionName: a.functionName } : {},
260
- abi: a.abi
303
+ function We(n) {
304
+ return n.address !== void 0 && typeof n.address == "object" ? (e, t) => {
305
+ var a;
306
+ const r = ze(e), s = Ae(e), i = (t == null ? void 0 : t.chainId) ?? s.chainId ?? r;
307
+ return $e(e, {
308
+ ...t,
309
+ ...n.functionName ? { functionName: n.functionName } : {},
310
+ address: (a = n.address) == null ? void 0 : a[i],
311
+ abi: n.abi
312
+ });
313
+ } : (e, t) => $e(e, {
314
+ ...t,
315
+ ...n.address ? { address: n.address } : {},
316
+ ...n.functionName ? { functionName: n.functionName } : {},
317
+ abi: n.abi
261
318
  });
262
319
  }
263
- function V(a, t) {
264
- const { chainId: e, ...n } = t, r = a.getClient({ chainId: e });
265
- return P(r, s0, "readContract")(n);
266
- }
267
- function K(a) {
268
- return a.address !== void 0 && typeof a.address == "object" ? (t, e) => {
269
- var n;
270
- const r = B(t), o = A(t), i = (e == null ? void 0 : e.chainId) ?? o.chainId ?? r;
271
- return V(t, {
272
- ...e,
273
- ...a.functionName ? { functionName: a.functionName } : {},
274
- address: (n = a.address) == null ? void 0 : n[i],
275
- abi: a.abi
276
- });
277
- } : (t, e) => V(t, {
278
- ...e,
279
- ...a.address ? { address: a.address } : {},
280
- ...a.functionName ? { functionName: a.functionName } : {},
281
- abi: a.abi
320
+ function Qe(n, e) {
321
+ const { chainId: t, ...a } = e, r = n.getClient({ chainId: t });
322
+ return Ue(r, Vt, "readContract")(a);
323
+ }
324
+ function ct(n) {
325
+ return n.address !== void 0 && typeof n.address == "object" ? (e, t) => {
326
+ var a;
327
+ const r = ze(e), s = Ae(e), i = (t == null ? void 0 : t.chainId) ?? s.chainId ?? r;
328
+ return Qe(e, {
329
+ ...t,
330
+ ...n.functionName ? { functionName: n.functionName } : {},
331
+ address: (a = n.address) == null ? void 0 : a[i],
332
+ abi: n.abi
333
+ });
334
+ } : (e, t) => Qe(e, {
335
+ ...t,
336
+ ...n.address ? { address: n.address } : {},
337
+ ...n.functionName ? { functionName: n.functionName } : {},
338
+ abi: n.abi
282
339
  });
283
340
  }
284
- async function _(a, t) {
285
- const { account: e, chainId: n, connector: r, __mode: o, ...i } = t;
286
- let f;
287
- typeof e == "object" && e.type === "local" ? f = a.getClient({ chainId: n }) : f = await W(a, { account: e, chainId: n, connector: r });
288
- const { connector: m } = A(a);
289
- let s;
290
- if (o === "prepared" || m != null && m.supportsSimulation)
291
- s = i;
341
+ async function Ke(n, e) {
342
+ const { account: t, chainId: a, connector: r, __mode: s, ...i } = e;
343
+ let o;
344
+ typeof t == "object" && t.type === "local" ? o = n.getClient({ chainId: a }) : o = await ot(n, { account: t, chainId: a, connector: r });
345
+ const { connector: u } = Ae(n);
346
+ let c;
347
+ if (s === "prepared" || u != null && u.supportsSimulation)
348
+ c = i;
292
349
  else {
293
- const { request: y } = await M(a, {
350
+ const { request: m } = await $e(n, {
294
351
  ...i,
295
- account: e,
296
- chainId: n
352
+ account: t,
353
+ chainId: a
297
354
  });
298
- s = y;
355
+ c = m;
299
356
  }
300
- return await P(f, d0, "writeContract")({
301
- ...s,
302
- ...e ? { account: e } : {},
303
- chain: n ? { id: n } : null
357
+ return await Ue(o, Bt, "writeContract")({
358
+ ...c,
359
+ ...t ? { account: t } : {},
360
+ chain: a ? { id: a } : null
304
361
  });
305
362
  }
306
- function D(a) {
307
- return a.address !== void 0 && typeof a.address == "object" ? (t, e) => {
308
- var n;
309
- const r = B(t), o = A(t);
363
+ function qe(n) {
364
+ return n.address !== void 0 && typeof n.address == "object" ? (e, t) => {
365
+ var a;
366
+ const r = ze(e), s = Ae(e);
310
367
  let i;
311
- return e.chainId ? i = e.chainId : e.account && e.account === o.address || e.account === void 0 ? i = o.chainId : i = r, _(t, {
312
- ...e,
313
- ...a.functionName ? { functionName: a.functionName } : {},
314
- address: i ? (n = a.address) == null ? void 0 : n[i] : void 0,
315
- abi: a.abi
368
+ return t.chainId ? i = t.chainId : t.account && t.account === s.address || t.account === void 0 ? i = s.chainId : i = r, Ke(e, {
369
+ ...t,
370
+ ...n.functionName ? { functionName: n.functionName } : {},
371
+ address: i ? (a = n.address) == null ? void 0 : a[i] : void 0,
372
+ abi: n.abi
316
373
  });
317
- } : (t, e) => _(t, {
318
- ...e,
319
- ...a.address ? { address: a.address } : {},
320
- ...a.functionName ? { functionName: a.functionName } : {},
321
- abi: a.abi
374
+ } : (e, t) => Ke(e, {
375
+ ...t,
376
+ ...n.address ? { address: n.address } : {},
377
+ ...n.functionName ? { functionName: n.functionName } : {},
378
+ abi: n.abi
322
379
  });
323
380
  }
324
- const p = [
381
+ const D = [
325
382
  { type: "error", inputs: [], name: "AllowanceOverflow" },
326
383
  { type: "error", inputs: [], name: "AllowanceUnderflow" },
327
384
  { type: "error", inputs: [], name: "InsufficientAllowance" },
@@ -494,103 +551,103 @@ const p = [
494
551
  outputs: [{ name: "", internalType: "bool", type: "bool" }],
495
552
  stateMutability: "nonpayable"
496
553
  }
497
- ], E0 = /* @__PURE__ */ K({
498
- abi: p,
554
+ ], tn = /* @__PURE__ */ ct({
555
+ abi: D,
499
556
  functionName: "allowance"
500
- }), M0 = /* @__PURE__ */ K({
501
- abi: p,
557
+ }), nn = /* @__PURE__ */ ct({
558
+ abi: D,
502
559
  functionName: "balanceOf"
503
- }), R0 = /* @__PURE__ */ D({
504
- abi: p,
560
+ }), an = /* @__PURE__ */ qe({
561
+ abi: D,
505
562
  functionName: "approve"
506
- }), B0 = /* @__PURE__ */ D({
507
- abi: p,
563
+ }), rn = /* @__PURE__ */ qe({
564
+ abi: D,
508
565
  functionName: "mint"
509
- }), P0 = /* @__PURE__ */ D({
510
- abi: p,
566
+ }), sn = /* @__PURE__ */ qe({
567
+ abi: D,
511
568
  functionName: "mintPayable"
512
- }), N0 = /* @__PURE__ */ N({
513
- abi: p,
569
+ }), on = /* @__PURE__ */ We({
570
+ abi: D,
514
571
  functionName: "approve"
515
- }), D0 = /* @__PURE__ */ N({
516
- abi: p,
572
+ }), cn = /* @__PURE__ */ We({
573
+ abi: D,
517
574
  functionName: "mint"
518
- }), j0 = /* @__PURE__ */ N({
519
- abi: p,
575
+ }), dn = /* @__PURE__ */ We({
576
+ abi: D,
520
577
  functionName: "mintPayable"
521
- }), O0 = "0x6080604052348015600e575f80fd5b50610e138061001c5f395ff3fe6080604052600436106100dc575f3560e01c806340c10f191161007e57806395d89b411161005857806395d89b41146102bc578063a9059cbb146102e6578063d505accf14610322578063dd62ed3e1461034a576100dc565b806340c10f191461021c57806370a08231146102445780637ecebe0014610280576100dc565b806318160ddd116100ba57806318160ddd1461016257806323b872dd1461018c578063313ce567146101c85780633644e515146101f2576100dc565b806306fdde03146100e0578063095ea7b31461010a57806317d304b014610146575b5f80fd5b3480156100eb575f80fd5b506100f4610386565b60405161010191906109bf565b60405180910390f35b348015610115575f80fd5b50610130600480360381019061012b9190610a70565b6103c3565b60405161013d9190610ac8565b60405180910390f35b610160600480360381019061015b9190610a70565b610413565b005b34801561016d575f80fd5b50610176610470565b6040516101839190610af0565b60405180910390f35b348015610197575f80fd5b506101b260048036038101906101ad9190610b09565b610481565b6040516101bf9190610ac8565b60405180910390f35b3480156101d3575f80fd5b506101dc610552565b6040516101e99190610b74565b60405180910390f35b3480156101fd575f80fd5b5061020661055a565b6040516102139190610ba5565b60405180910390f35b348015610227575f80fd5b50610242600480360381019061023d9190610a70565b6105ea565b005b34801561024f575f80fd5b5061026a60048036038101906102659190610bbe565b6105f8565b6040516102779190610af0565b60405180910390f35b34801561028b575f80fd5b506102a660048036038101906102a19190610bbe565b610611565b6040516102b39190610af0565b60405180910390f35b3480156102c7575f80fd5b506102d061062a565b6040516102dd91906109bf565b60405180910390f35b3480156102f1575f80fd5b5061030c60048036038101906103079190610a70565b610667565b6040516103199190610ac8565b60405180910390f35b34801561032d575f80fd5b5061034860048036038101906103439190610c3d565b6106f5565b005b348015610355575f80fd5b50610370600480360381019061036b9190610cda565b610891565b60405161037d9190610af0565b60405180910390f35b60606040518060400160405280600a81526020017f4d6f636b20455243323000000000000000000000000000000000000000000000815250905090565b5f82602052637f5e9f20600c52335f52816034600c2055815f52602c5160601c337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560205fa36001905092915050565b6064816104209190610d45565b341015610462576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045990610dbf565b60405180910390fd5b61046c82826108af565b5050565b5f6805345cdf77eb68f44c54905090565b5f61048d848484610941565b8360601b33602052637f5e9f208117600c526034600c20805460018101156104ca57808511156104c4576313be252b5f526004601cfd5b84810382555b6387a211a28317600c526020600c208054808711156104f05763f4d678b85f526004601cfd5b8681038255875f526020600c2087815401815587602052600c5160601c8660601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a3505050505050610547848484610946565b600190509392505050565b5f6012905090565b5f8061056461094b565b90505f801b810361058157610577610386565b8051906020012090505b6040517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81528160208201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604082015246606082015230608082015260a081209250505090565b6105f482826108af565b5050565b5f6387a211a2600c52815f526020600c20549050919050565b5f6338377508600c52815f526020600c20549050919050565b60606040518060400160405280600481526020017f4d4f434b00000000000000000000000000000000000000000000000000000000815250905090565b5f610673338484610941565b6387a211a2600c52335f526020600c2080548084111561069a5763f4d678b85f526004601cfd5b8381038255845f526020600c2084815401815584602052600c5160601c337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a35050506106eb338484610946565b6001905092915050565b5f6106fe61094b565b90505f801b810361071b57610711610386565b8051906020012090505b8442111561073057631a15a3cc5f526004601cfd5b6040518860601b60601c98508760601b60601c975065383775081901600e52885f526020600c2080547f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f83528360208401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604084015246606084015230608084015260a08320602e527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983528a60208401528960408401528860608401528060808401528760a084015260c08320604e526042602c205f528660ff16602052856040528460605260208060805f60015afa8b3d51146108385763ddafbaef5f526004601cfd5b80820183558a637f5e9f2060a01b17604052896034602c20558a8c7f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925602060608801a3836040525f606052505050505050505050505050565b5f81602052637f5e9f20600c52825f526034600c2054905092915050565b6108ba5f8383610941565b6805345cdf77eb68f44c54818101818110156108dd5763e5cfe9575f526004601cfd5b806805345cdf77eb68f44c556387a211a2600c52835f526020600c2083815401815583602052600c5160601c5f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a350505061093d5f8383610946565b5050565b505050565b505050565b5f90565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6109918261094f565b61099b8185610959565b93506109ab818560208601610969565b6109b481610977565b840191505092915050565b5f6020820190508181035f8301526109d78184610987565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610a0c826109e3565b9050919050565b610a1c81610a02565b8114610a26575f80fd5b50565b5f81359050610a3781610a13565b92915050565b5f819050919050565b610a4f81610a3d565b8114610a59575f80fd5b50565b5f81359050610a6a81610a46565b92915050565b5f8060408385031215610a8657610a856109df565b5b5f610a9385828601610a29565b9250506020610aa485828601610a5c565b9150509250929050565b5f8115159050919050565b610ac281610aae565b82525050565b5f602082019050610adb5f830184610ab9565b92915050565b610aea81610a3d565b82525050565b5f602082019050610b035f830184610ae1565b92915050565b5f805f60608486031215610b2057610b1f6109df565b5b5f610b2d86828701610a29565b9350506020610b3e86828701610a29565b9250506040610b4f86828701610a5c565b9150509250925092565b5f60ff82169050919050565b610b6e81610b59565b82525050565b5f602082019050610b875f830184610b65565b92915050565b5f819050919050565b610b9f81610b8d565b82525050565b5f602082019050610bb85f830184610b96565b92915050565b5f60208284031215610bd357610bd26109df565b5b5f610be084828501610a29565b91505092915050565b610bf281610b59565b8114610bfc575f80fd5b50565b5f81359050610c0d81610be9565b92915050565b610c1c81610b8d565b8114610c26575f80fd5b50565b5f81359050610c3781610c13565b92915050565b5f805f805f805f60e0888a031215610c5857610c576109df565b5b5f610c658a828b01610a29565b9750506020610c768a828b01610a29565b9650506040610c878a828b01610a5c565b9550506060610c988a828b01610a5c565b9450506080610ca98a828b01610bff565b93505060a0610cba8a828b01610c29565b92505060c0610ccb8a828b01610c29565b91505092959891949750929550565b5f8060408385031215610cf057610cef6109df565b5b5f610cfd85828601610a29565b9250506020610d0e85828601610a29565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f610d4f82610a3d565b9150610d5a83610a3d565b925082610d6a57610d69610d18565b5b828204905092915050565b7f4d6f636b45524332303a2067696d6d65206d6f7265206d6f6e657921000000005f82015250565b5f610da9601c83610959565b9150610db482610d75565b602082019050919050565b5f6020820190508181035f830152610dd681610d9d565b905091905056fea2646970667358221220a588f9f821e157f856641e8171dc78ec959e3c73080238aa8696355fc5d4a5d064736f6c634300081a0033";
522
- class Q extends t0 {
523
- async balanceOf(t, e) {
524
- return await M0(this._config, {
578
+ }), un = "0x6080604052348015600e575f80fd5b50610e138061001c5f395ff3fe6080604052600436106100dc575f3560e01c806340c10f191161007e57806395d89b411161005857806395d89b41146102bc578063a9059cbb146102e6578063d505accf14610322578063dd62ed3e1461034a576100dc565b806340c10f191461021c57806370a08231146102445780637ecebe0014610280576100dc565b806318160ddd116100ba57806318160ddd1461016257806323b872dd1461018c578063313ce567146101c85780633644e515146101f2576100dc565b806306fdde03146100e0578063095ea7b31461010a57806317d304b014610146575b5f80fd5b3480156100eb575f80fd5b506100f4610386565b60405161010191906109bf565b60405180910390f35b348015610115575f80fd5b50610130600480360381019061012b9190610a70565b6103c3565b60405161013d9190610ac8565b60405180910390f35b610160600480360381019061015b9190610a70565b610413565b005b34801561016d575f80fd5b50610176610470565b6040516101839190610af0565b60405180910390f35b348015610197575f80fd5b506101b260048036038101906101ad9190610b09565b610481565b6040516101bf9190610ac8565b60405180910390f35b3480156101d3575f80fd5b506101dc610552565b6040516101e99190610b74565b60405180910390f35b3480156101fd575f80fd5b5061020661055a565b6040516102139190610ba5565b60405180910390f35b348015610227575f80fd5b50610242600480360381019061023d9190610a70565b6105ea565b005b34801561024f575f80fd5b5061026a60048036038101906102659190610bbe565b6105f8565b6040516102779190610af0565b60405180910390f35b34801561028b575f80fd5b506102a660048036038101906102a19190610bbe565b610611565b6040516102b39190610af0565b60405180910390f35b3480156102c7575f80fd5b506102d061062a565b6040516102dd91906109bf565b60405180910390f35b3480156102f1575f80fd5b5061030c60048036038101906103079190610a70565b610667565b6040516103199190610ac8565b60405180910390f35b34801561032d575f80fd5b5061034860048036038101906103439190610c3d565b6106f5565b005b348015610355575f80fd5b50610370600480360381019061036b9190610cda565b610891565b60405161037d9190610af0565b60405180910390f35b60606040518060400160405280600a81526020017f4d6f636b20455243323000000000000000000000000000000000000000000000815250905090565b5f82602052637f5e9f20600c52335f52816034600c2055815f52602c5160601c337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560205fa36001905092915050565b6064816104209190610d45565b341015610462576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045990610dbf565b60405180910390fd5b61046c82826108af565b5050565b5f6805345cdf77eb68f44c54905090565b5f61048d848484610941565b8360601b33602052637f5e9f208117600c526034600c20805460018101156104ca57808511156104c4576313be252b5f526004601cfd5b84810382555b6387a211a28317600c526020600c208054808711156104f05763f4d678b85f526004601cfd5b8681038255875f526020600c2087815401815587602052600c5160601c8660601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a3505050505050610547848484610946565b600190509392505050565b5f6012905090565b5f8061056461094b565b90505f801b810361058157610577610386565b8051906020012090505b6040517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81528160208201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604082015246606082015230608082015260a081209250505090565b6105f482826108af565b5050565b5f6387a211a2600c52815f526020600c20549050919050565b5f6338377508600c52815f526020600c20549050919050565b60606040518060400160405280600481526020017f4d4f434b00000000000000000000000000000000000000000000000000000000815250905090565b5f610673338484610941565b6387a211a2600c52335f526020600c2080548084111561069a5763f4d678b85f526004601cfd5b8381038255845f526020600c2084815401815584602052600c5160601c337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a35050506106eb338484610946565b6001905092915050565b5f6106fe61094b565b90505f801b810361071b57610711610386565b8051906020012090505b8442111561073057631a15a3cc5f526004601cfd5b6040518860601b60601c98508760601b60601c975065383775081901600e52885f526020600c2080547f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f83528360208401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604084015246606084015230608084015260a08320602e527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983528a60208401528960408401528860608401528060808401528760a084015260c08320604e526042602c205f528660ff16602052856040528460605260208060805f60015afa8b3d51146108385763ddafbaef5f526004601cfd5b80820183558a637f5e9f2060a01b17604052896034602c20558a8c7f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925602060608801a3836040525f606052505050505050505050505050565b5f81602052637f5e9f20600c52825f526034600c2054905092915050565b6108ba5f8383610941565b6805345cdf77eb68f44c54818101818110156108dd5763e5cfe9575f526004601cfd5b806805345cdf77eb68f44c556387a211a2600c52835f526020600c2083815401815583602052600c5160601c5f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a350505061093d5f8383610946565b5050565b505050565b505050565b5f90565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6109918261094f565b61099b8185610959565b93506109ab818560208601610969565b6109b481610977565b840191505092915050565b5f6020820190508181035f8301526109d78184610987565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610a0c826109e3565b9050919050565b610a1c81610a02565b8114610a26575f80fd5b50565b5f81359050610a3781610a13565b92915050565b5f819050919050565b610a4f81610a3d565b8114610a59575f80fd5b50565b5f81359050610a6a81610a46565b92915050565b5f8060408385031215610a8657610a856109df565b5b5f610a9385828601610a29565b9250506020610aa485828601610a5c565b9150509250929050565b5f8115159050919050565b610ac281610aae565b82525050565b5f602082019050610adb5f830184610ab9565b92915050565b610aea81610a3d565b82525050565b5f602082019050610b035f830184610ae1565b92915050565b5f805f60608486031215610b2057610b1f6109df565b5b5f610b2d86828701610a29565b9350506020610b3e86828701610a29565b9250506040610b4f86828701610a5c565b9150509250925092565b5f60ff82169050919050565b610b6e81610b59565b82525050565b5f602082019050610b875f830184610b65565b92915050565b5f819050919050565b610b9f81610b8d565b82525050565b5f602082019050610bb85f830184610b96565b92915050565b5f60208284031215610bd357610bd26109df565b5b5f610be084828501610a29565b91505092915050565b610bf281610b59565b8114610bfc575f80fd5b50565b5f81359050610c0d81610be9565b92915050565b610c1c81610b8d565b8114610c26575f80fd5b50565b5f81359050610c3781610c13565b92915050565b5f805f805f805f60e0888a031215610c5857610c576109df565b5b5f610c658a828b01610a29565b9750506020610c768a828b01610a29565b9650506040610c878a828b01610a5c565b9550506060610c988a828b01610a5c565b9450506080610ca98a828b01610bff565b93505060a0610cba8a828b01610c29565b92505060c0610ccb8a828b01610c29565b91505092959891949750929550565b5f8060408385031215610cf057610cef6109df565b5b5f610cfd85828601610a29565b9250506020610d0e85828601610a29565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f610d4f82610a3d565b9150610d5a83610a3d565b925082610d6a57610d69610d18565b5b828204905092915050565b7f4d6f636b45524332303a2067696d6d65206d6f7265206d6f6e657921000000005f82015250565b5f610da9601c83610959565b9150610db482610d75565b602082019050919050565b5f6020820190508181035f830152610dd681610d9d565b905091905056fea2646970667358221220a588f9f821e157f856641e8171dc78ec959e3c73080238aa8696355fc5d4a5d064736f6c634300081a0033";
579
+ class dt extends St {
580
+ async balanceOf(e, t) {
581
+ return await nn(this._config, {
525
582
  address: this.assertValidAddress(),
526
- args: [t],
583
+ args: [e],
527
584
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
528
- ...e
585
+ ...t
529
586
  });
530
587
  }
531
- async allowance(t, e, n) {
532
- return await E0(this._config, {
588
+ async allowance(e, t, a) {
589
+ return await tn(this._config, {
533
590
  address: this.assertValidAddress(),
534
- args: [t, e],
591
+ args: [e, t],
535
592
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
536
- ...n
593
+ ...a
537
594
  });
538
595
  }
539
- async approve(t, e, n) {
540
- return await this.awaitResult(this.approveRaw(t, e, n));
596
+ async approve(e, t, a) {
597
+ return await this.awaitResult(this.approveRaw(e, t, a));
541
598
  }
542
- async approveRaw(t, e, n) {
543
- const { request: r, result: o } = await N0(this._config, {
599
+ async approveRaw(e, t, a) {
600
+ const { request: r, result: s } = await on(this._config, {
544
601
  address: this.assertValidAddress(),
545
- args: [t, e],
602
+ args: [e, t],
546
603
  ...this.optionallyAttachAccount(),
547
604
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
548
- ...n
605
+ ...a
549
606
  });
550
- return { hash: await R0(this._config, r), result: o };
607
+ return { hash: await an(this._config, r), result: s };
551
608
  }
552
- async mint(t, e, n) {
553
- return await this.awaitResult(this.mintRaw(t, e, n));
609
+ async mint(e, t, a) {
610
+ return await this.awaitResult(this.mintRaw(e, t, a));
554
611
  }
555
- async mintRaw(t, e, n) {
556
- const { request: r, result: o } = await D0(this._config, {
612
+ async mintRaw(e, t, a) {
613
+ const { request: r, result: s } = await cn(this._config, {
557
614
  address: this.assertValidAddress(),
558
- args: [t, e],
615
+ args: [e, t],
559
616
  ...this.optionallyAttachAccount(),
560
617
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
561
- ...n
618
+ ...a
562
619
  });
563
- return { hash: await B0(this._config, r), result: o };
620
+ return { hash: await rn(this._config, r), result: s };
564
621
  }
565
- async mintPayable(t, e, n) {
622
+ async mintPayable(e, t, a) {
566
623
  return await this.awaitResult(
567
624
  // biome-ignore lint/suspicious/noExplicitAny: this is a mock contract, it's fine
568
- this.mintPayableRaw(t, e, n)
625
+ this.mintPayableRaw(e, t, a)
569
626
  );
570
627
  }
571
- async mintPayableRaw(t, e, n) {
572
- const { request: r, result: o } = await j0(
628
+ async mintPayableRaw(e, t, a) {
629
+ const { request: r, result: s } = await dn(
573
630
  this._config,
574
631
  {
575
632
  address: this.assertValidAddress(),
576
- args: [t, e],
633
+ args: [e, t],
577
634
  ...this.optionallyAttachAccount(),
578
635
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
579
- ...n
636
+ ...a
580
637
  }
581
638
  );
582
- return { hash: await P0(this._config, r), result: o };
639
+ return { hash: await sn(this._config, r), result: s };
583
640
  }
584
- buildParameters(t = {}, e) {
585
- const [, n] = this.validateDeploymentConfig(t, e);
641
+ buildParameters(e = {}, t) {
642
+ const [, a] = this.validateDeploymentConfig(e, t);
586
643
  return {
587
- abi: p,
588
- bytecode: O0,
589
- ...this.optionallyAttachAccount(n.account)
644
+ abi: D,
645
+ bytecode: un,
646
+ ...this.optionallyAttachAccount(a.account)
590
647
  };
591
648
  }
592
649
  }
593
- const F0 = [
650
+ const ln = [
594
651
  {
595
652
  account: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
596
653
  key: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
@@ -631,317 +688,3184 @@ const F0 = [
631
688
  account: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
632
689
  key: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
633
690
  }
634
- ].map((a) => ({
635
- ...a,
636
- privateKey: g0(a.key)
637
- })), L0 = "test test test test test test test test test test test junk", pe = async function(t, e) {
638
- const n = e.privateKey, r = e.mnemonic ?? L0, o = e.chain || "anvil", [{ config: i, account: f }, m] = v0({
639
- chain: o,
640
- rpcUrl: e.rpcUrl,
641
- privateKey: n,
642
- mnemonic: r
643
- }), s = m.id;
644
- if (t.at(0) === "generate")
645
- return ne({ account: f == null ? void 0 : f.address, chainId: s });
646
- if (t.at(0) === "erc20") {
647
- let u = new Q({ config: i, account: f }, {});
648
- return await u.deploy(), {
649
- erc20: u.assertValidAddress()
691
+ ].map((n) => ({
692
+ ...n,
693
+ privateKey: Lt(n.key)
694
+ }));
695
+ var _;
696
+ (function(n) {
697
+ n.assertEqual = (r) => r;
698
+ function e(r) {
699
+ }
700
+ n.assertIs = e;
701
+ function t(r) {
702
+ throw new Error();
703
+ }
704
+ n.assertNever = t, n.arrayToEnum = (r) => {
705
+ const s = {};
706
+ for (const i of r)
707
+ s[i] = i;
708
+ return s;
709
+ }, n.getValidEnumValues = (r) => {
710
+ const s = n.objectKeys(r).filter((o) => typeof r[r[o]] != "number"), i = {};
711
+ for (const o of s)
712
+ i[o] = r[o];
713
+ return n.objectValues(i);
714
+ }, n.objectValues = (r) => n.objectKeys(r).map(function(s) {
715
+ return r[s];
716
+ }), n.objectKeys = typeof Object.keys == "function" ? (r) => Object.keys(r) : (r) => {
717
+ const s = [];
718
+ for (const i in r)
719
+ Object.prototype.hasOwnProperty.call(r, i) && s.push(i);
720
+ return s;
721
+ }, n.find = (r, s) => {
722
+ for (const i of r)
723
+ if (s(i))
724
+ return i;
725
+ }, n.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && isFinite(r) && Math.floor(r) === r;
726
+ function a(r, s = " | ") {
727
+ return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(s);
728
+ }
729
+ n.joinValues = a, n.jsonStringifyReplacer = (r, s) => typeof s == "bigint" ? s.toString() : s;
730
+ })(_ || (_ = {}));
731
+ var Pe;
732
+ (function(n) {
733
+ n.mergeShapes = (e, t) => ({
734
+ ...e,
735
+ ...t
736
+ // second overwrites first
737
+ });
738
+ })(Pe || (Pe = {}));
739
+ const f = _.arrayToEnum([
740
+ "string",
741
+ "nan",
742
+ "number",
743
+ "integer",
744
+ "float",
745
+ "boolean",
746
+ "date",
747
+ "bigint",
748
+ "symbol",
749
+ "function",
750
+ "undefined",
751
+ "null",
752
+ "array",
753
+ "object",
754
+ "unknown",
755
+ "promise",
756
+ "void",
757
+ "never",
758
+ "map",
759
+ "set"
760
+ ]), B = (n) => {
761
+ switch (typeof n) {
762
+ case "undefined":
763
+ return f.undefined;
764
+ case "string":
765
+ return f.string;
766
+ case "number":
767
+ return isNaN(n) ? f.nan : f.number;
768
+ case "boolean":
769
+ return f.boolean;
770
+ case "function":
771
+ return f.function;
772
+ case "bigint":
773
+ return f.bigint;
774
+ case "symbol":
775
+ return f.symbol;
776
+ case "object":
777
+ return Array.isArray(n) ? f.array : n === null ? f.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? f.promise : typeof Map < "u" && n instanceof Map ? f.map : typeof Set < "u" && n instanceof Set ? f.set : typeof Date < "u" && n instanceof Date ? f.date : f.object;
778
+ default:
779
+ return f.unknown;
780
+ }
781
+ }, d = _.arrayToEnum([
782
+ "invalid_type",
783
+ "invalid_literal",
784
+ "custom",
785
+ "invalid_union",
786
+ "invalid_union_discriminator",
787
+ "invalid_enum_value",
788
+ "unrecognized_keys",
789
+ "invalid_arguments",
790
+ "invalid_return_type",
791
+ "invalid_date",
792
+ "invalid_string",
793
+ "too_small",
794
+ "too_big",
795
+ "invalid_intersection_types",
796
+ "not_multiple_of",
797
+ "not_finite"
798
+ ]), fn = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
799
+ class A extends Error {
800
+ constructor(e) {
801
+ super(), this.issues = [], this.addIssue = (a) => {
802
+ this.issues = [...this.issues, a];
803
+ }, this.addIssues = (a = []) => {
804
+ this.issues = [...this.issues, ...a];
650
805
  };
806
+ const t = new.target.prototype;
807
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
651
808
  }
652
- const y = a0[s];
653
- if (!y)
654
- throw new Error(
655
- `Unable to select a deployed BoostRegistry with chain ID ${s}`
656
- );
657
- const I = new n0({
658
- config: i,
659
- account: f,
660
- address: y
661
- }), T = c0[s];
662
- if (!T)
663
- throw new Error(
664
- `Unable to select a deployed BoostCore with chain ID ${s}`
665
- );
666
- const l = new i0({
667
- config: i,
668
- account: f,
669
- address: T
809
+ get errors() {
810
+ return this.issues;
811
+ }
812
+ format(e) {
813
+ const t = e || function(s) {
814
+ return s.message;
815
+ }, a = { _errors: [] }, r = (s) => {
816
+ for (const i of s.issues)
817
+ if (i.code === "invalid_union")
818
+ i.unionErrors.map(r);
819
+ else if (i.code === "invalid_return_type")
820
+ r(i.returnTypeError);
821
+ else if (i.code === "invalid_arguments")
822
+ r(i.argumentsError);
823
+ else if (i.path.length === 0)
824
+ a._errors.push(t(i));
825
+ else {
826
+ let o = a, u = 0;
827
+ for (; u < i.path.length; ) {
828
+ const c = i.path[u];
829
+ u === i.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(t(i))) : o[c] = o[c] || { _errors: [] }, o = o[c], u++;
830
+ }
831
+ }
832
+ };
833
+ return r(this), a;
834
+ }
835
+ static assert(e) {
836
+ if (!(e instanceof A))
837
+ throw new Error(`Not a ZodError: ${e}`);
838
+ }
839
+ toString() {
840
+ return this.message;
841
+ }
842
+ get message() {
843
+ return JSON.stringify(this.issues, _.jsonStringifyReplacer, 2);
844
+ }
845
+ get isEmpty() {
846
+ return this.issues.length === 0;
847
+ }
848
+ flatten(e = (t) => t.message) {
849
+ const t = {}, a = [];
850
+ for (const r of this.issues)
851
+ r.path.length > 0 ? (t[r.path[0]] = t[r.path[0]] || [], t[r.path[0]].push(e(r))) : a.push(e(r));
852
+ return { formErrors: a, fieldErrors: t };
853
+ }
854
+ get formErrors() {
855
+ return this.flatten();
856
+ }
857
+ }
858
+ A.create = (n) => new A(n);
859
+ const ee = (n, e) => {
860
+ let t;
861
+ switch (n.code) {
862
+ case d.invalid_type:
863
+ n.received === f.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
864
+ break;
865
+ case d.invalid_literal:
866
+ t = `Invalid literal value, expected ${JSON.stringify(n.expected, _.jsonStringifyReplacer)}`;
867
+ break;
868
+ case d.unrecognized_keys:
869
+ t = `Unrecognized key(s) in object: ${_.joinValues(n.keys, ", ")}`;
870
+ break;
871
+ case d.invalid_union:
872
+ t = "Invalid input";
873
+ break;
874
+ case d.invalid_union_discriminator:
875
+ t = `Invalid discriminator value. Expected ${_.joinValues(n.options)}`;
876
+ break;
877
+ case d.invalid_enum_value:
878
+ t = `Invalid enum value. Expected ${_.joinValues(n.options)}, received '${n.received}'`;
879
+ break;
880
+ case d.invalid_arguments:
881
+ t = "Invalid function arguments";
882
+ break;
883
+ case d.invalid_return_type:
884
+ t = "Invalid function return type";
885
+ break;
886
+ case d.invalid_date:
887
+ t = "Invalid date";
888
+ break;
889
+ case d.invalid_string:
890
+ typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : _.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
891
+ break;
892
+ case d.too_small:
893
+ n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
894
+ break;
895
+ case d.too_big:
896
+ n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
897
+ break;
898
+ case d.custom:
899
+ t = "Invalid input";
900
+ break;
901
+ case d.invalid_intersection_types:
902
+ t = "Intersection results could not be merged";
903
+ break;
904
+ case d.not_multiple_of:
905
+ t = `Number must be a multiple of ${n.multipleOf}`;
906
+ break;
907
+ case d.not_finite:
908
+ t = "Number must be finite";
909
+ break;
910
+ default:
911
+ t = e.defaultError, _.assertNever(n);
912
+ }
913
+ return { message: t };
914
+ };
915
+ let ut = ee;
916
+ function hn(n) {
917
+ ut = n;
918
+ }
919
+ function we() {
920
+ return ut;
921
+ }
922
+ const ke = (n) => {
923
+ const { data: e, path: t, errorMaps: a, issueData: r } = n, s = [...t, ...r.path || []], i = {
924
+ ...r,
925
+ path: s
926
+ };
927
+ if (r.message !== void 0)
928
+ return {
929
+ ...r,
930
+ path: s,
931
+ message: r.message
932
+ };
933
+ let o = "";
934
+ const u = a.filter((c) => !!c).slice().reverse();
935
+ for (const c of u)
936
+ o = c(i, { data: e, defaultError: o }).message;
937
+ return {
938
+ ...r,
939
+ path: s,
940
+ message: o
941
+ };
942
+ }, pn = [];
943
+ function l(n, e) {
944
+ const t = we(), a = ke({
945
+ issueData: e,
946
+ data: n.data,
947
+ path: n.path,
948
+ errorMaps: [
949
+ n.common.contextualErrorMap,
950
+ n.schemaErrorMap,
951
+ t,
952
+ t === ee ? void 0 : ee
953
+ // then global default map
954
+ ].filter((r) => !!r)
670
955
  });
671
- if (!t.length) throw new Error("No seed provided");
672
- const G = await Promise.all(t.map(V0));
673
- let S, O;
674
- const F = [];
675
- for (const u of G) {
676
- let h;
677
- if (typeof u.budget == "string" && R(u.budget))
678
- h = l.ManagedBudget(u.budget);
679
- else if (w0(O, u.budget) && S)
680
- h = S;
681
- else {
682
- const b = {
683
- ...u.budget,
684
- authorized: [...u.budget.authorized, T],
685
- roles: [...u.budget.roles, U.MANAGER]
686
- };
687
- h = await I.initialize(
688
- crypto.randomUUID(),
689
- l.ManagedBudget(b)
690
- ), S = h, O = u.budget;
956
+ n.common.issues.push(a);
957
+ }
958
+ class S {
959
+ constructor() {
960
+ this.value = "valid";
961
+ }
962
+ dirty() {
963
+ this.value === "valid" && (this.value = "dirty");
964
+ }
965
+ abort() {
966
+ this.value !== "aborted" && (this.value = "aborted");
967
+ }
968
+ static mergeArray(e, t) {
969
+ const a = [];
970
+ for (const r of t) {
971
+ if (r.status === "aborted")
972
+ return b;
973
+ r.status === "dirty" && e.dirty(), a.push(r.value);
691
974
  }
692
- const J = u.incentives.map(async (b) => {
693
- let g = 0n;
694
- switch (b.type) {
695
- case "AllowListIncentive":
696
- return l.AllowListIncentive(b);
697
- case "ERC20Incentive":
698
- return b.strategy === E.RAFFLE && (g += b.reward), b.strategy === E.POOL && (g += b.reward * b.limit), b.shouldMintAndAllocate && await x(h, g, b.asset, {
699
- config: i,
700
- account: f
701
- }), l.ERC20Incentive(b);
702
- case "ERC20VariableCriteriaIncentive":
703
- return g += b.limit, b.shouldMintAndAllocate && await x(h, g, b.asset, {
704
- config: i,
705
- account: f
706
- }), l.ERC20VariableCriteriaIncentive(b);
707
- case "ERC20VariableIncentive":
708
- return g += b.limit, b.shouldMintAndAllocate && await x(h, g, b.asset, {
709
- config: i,
710
- account: f
711
- }), l.ERC20VariableIncentive(b);
712
- }
713
- }), Z = await Promise.all(J), Y = await l.createBoost({
714
- protocolFee: u.protocolFee,
715
- maxParticipants: u.maxParticipants,
716
- budget: h,
717
- action: l.EventAction(u.action),
718
- validator: l.SignerValidator(u.validator),
719
- allowList: await te(u, { core: l }),
720
- incentives: Z
721
- });
722
- F.push(Y.id.toString());
975
+ return { status: e.value, value: a };
976
+ }
977
+ static async mergeObjectAsync(e, t) {
978
+ const a = [];
979
+ for (const r of t) {
980
+ const s = await r.key, i = await r.value;
981
+ a.push({
982
+ key: s,
983
+ value: i
984
+ });
985
+ }
986
+ return S.mergeObjectSync(e, a);
987
+ }
988
+ static mergeObjectSync(e, t) {
989
+ const a = {};
990
+ for (const r of t) {
991
+ const { key: s, value: i } = r;
992
+ if (s.status === "aborted" || i.status === "aborted")
993
+ return b;
994
+ s.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), s.value !== "__proto__" && (typeof i.value < "u" || r.alwaysSet) && (a[s.value] = i.value);
995
+ }
996
+ return { status: e.value, value: a };
997
+ }
998
+ }
999
+ const b = Object.freeze({
1000
+ status: "aborted"
1001
+ }), K = (n) => ({ status: "dirty", value: n }), I = (n) => ({ status: "valid", value: n }), De = (n) => n.status === "aborted", Ve = (n) => n.status === "dirty", ie = (n) => n.status === "valid", oe = (n) => typeof Promise < "u" && n instanceof Promise;
1002
+ function Te(n, e, t, a) {
1003
+ if (typeof e == "function" ? n !== e || !a : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1004
+ return e.get(n);
1005
+ }
1006
+ function lt(n, e, t, a, r) {
1007
+ if (typeof e == "function" ? n !== e || !r : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1008
+ return e.set(n, t), t;
1009
+ }
1010
+ var p;
1011
+ (function(n) {
1012
+ n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
1013
+ })(p || (p = {}));
1014
+ var ae, re;
1015
+ class j {
1016
+ constructor(e, t, a, r) {
1017
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = a, this._key = r;
1018
+ }
1019
+ get path() {
1020
+ return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
723
1021
  }
1022
+ }
1023
+ const Xe = (n, e) => {
1024
+ if (ie(e))
1025
+ return { success: !0, data: e.value };
1026
+ if (!n.common.issues.length)
1027
+ throw new Error("Validation failed but no issues detected.");
724
1028
  return {
725
- boostIds: F
1029
+ success: !1,
1030
+ get error() {
1031
+ if (this._error)
1032
+ return this._error;
1033
+ const t = new A(n.common.issues);
1034
+ return this._error = t, this._error;
1035
+ }
726
1036
  };
727
1037
  };
728
- async function x(a, t, e, n) {
729
- if (e && t) {
730
- let r = new Q(n, e);
731
- await ae(n, r, a, H(t.toString()));
1038
+ function g(n) {
1039
+ if (!n)
1040
+ return {};
1041
+ const { errorMap: e, invalid_type_error: t, required_error: a, description: r } = n;
1042
+ if (e && (t || a))
1043
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
1044
+ return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
1045
+ var u, c;
1046
+ const { message: m } = n;
1047
+ return i.code === "invalid_enum_value" ? { message: m ?? o.defaultError } : typeof o.data > "u" ? { message: (u = m ?? a) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = m ?? t) !== null && c !== void 0 ? c : o.defaultError };
1048
+ }, description: r };
1049
+ }
1050
+ class v {
1051
+ constructor(e) {
1052
+ 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);
1053
+ }
1054
+ get description() {
1055
+ return this._def.description;
1056
+ }
1057
+ _getType(e) {
1058
+ return B(e.data);
1059
+ }
1060
+ _getOrReturnCtx(e, t) {
1061
+ return t || {
1062
+ common: e.parent.common,
1063
+ data: e.data,
1064
+ parsedType: B(e.data),
1065
+ schemaErrorMap: this._def.errorMap,
1066
+ path: e.path,
1067
+ parent: e.parent
1068
+ };
1069
+ }
1070
+ _processInputParams(e) {
1071
+ return {
1072
+ status: new S(),
1073
+ ctx: {
1074
+ common: e.parent.common,
1075
+ data: e.data,
1076
+ parsedType: B(e.data),
1077
+ schemaErrorMap: this._def.errorMap,
1078
+ path: e.path,
1079
+ parent: e.parent
1080
+ }
1081
+ };
1082
+ }
1083
+ _parseSync(e) {
1084
+ const t = this._parse(e);
1085
+ if (oe(t))
1086
+ throw new Error("Synchronous parse encountered promise.");
1087
+ return t;
1088
+ }
1089
+ _parseAsync(e) {
1090
+ const t = this._parse(e);
1091
+ return Promise.resolve(t);
1092
+ }
1093
+ parse(e, t) {
1094
+ const a = this.safeParse(e, t);
1095
+ if (a.success)
1096
+ return a.data;
1097
+ throw a.error;
1098
+ }
1099
+ safeParse(e, t) {
1100
+ var a;
1101
+ const r = {
1102
+ common: {
1103
+ issues: [],
1104
+ async: (a = t == null ? void 0 : t.async) !== null && a !== void 0 ? a : !1,
1105
+ contextualErrorMap: t == null ? void 0 : t.errorMap
1106
+ },
1107
+ path: (t == null ? void 0 : t.path) || [],
1108
+ schemaErrorMap: this._def.errorMap,
1109
+ parent: null,
1110
+ data: e,
1111
+ parsedType: B(e)
1112
+ }, s = this._parseSync({ data: e, path: r.path, parent: r });
1113
+ return Xe(r, s);
1114
+ }
1115
+ async parseAsync(e, t) {
1116
+ const a = await this.safeParseAsync(e, t);
1117
+ if (a.success)
1118
+ return a.data;
1119
+ throw a.error;
1120
+ }
1121
+ async safeParseAsync(e, t) {
1122
+ const a = {
1123
+ common: {
1124
+ issues: [],
1125
+ contextualErrorMap: t == null ? void 0 : t.errorMap,
1126
+ async: !0
1127
+ },
1128
+ path: (t == null ? void 0 : t.path) || [],
1129
+ schemaErrorMap: this._def.errorMap,
1130
+ parent: null,
1131
+ data: e,
1132
+ parsedType: B(e)
1133
+ }, r = this._parse({ data: e, path: a.path, parent: a }), s = await (oe(r) ? r : Promise.resolve(r));
1134
+ return Xe(a, s);
1135
+ }
1136
+ refine(e, t) {
1137
+ const a = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
1138
+ return this._refinement((r, s) => {
1139
+ const i = e(r), o = () => s.addIssue({
1140
+ code: d.custom,
1141
+ ...a(r)
1142
+ });
1143
+ return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
1144
+ });
1145
+ }
1146
+ refinement(e, t) {
1147
+ return this._refinement((a, r) => e(a) ? !0 : (r.addIssue(typeof t == "function" ? t(a, r) : t), !1));
1148
+ }
1149
+ _refinement(e) {
1150
+ return new R({
1151
+ schema: this,
1152
+ typeName: y.ZodEffects,
1153
+ effect: { type: "refinement", refinement: e }
1154
+ });
1155
+ }
1156
+ superRefine(e) {
1157
+ return this._refinement(e);
1158
+ }
1159
+ optional() {
1160
+ return Z.create(this, this._def);
1161
+ }
1162
+ nullable() {
1163
+ return W.create(this, this._def);
1164
+ }
1165
+ nullish() {
1166
+ return this.nullable().optional();
1167
+ }
1168
+ array() {
1169
+ return O.create(this, this._def);
1170
+ }
1171
+ promise() {
1172
+ return ne.create(this, this._def);
1173
+ }
1174
+ or(e) {
1175
+ return le.create([this, e], this._def);
1176
+ }
1177
+ and(e) {
1178
+ return fe.create(this, e, this._def);
1179
+ }
1180
+ transform(e) {
1181
+ return new R({
1182
+ ...g(this._def),
1183
+ schema: this,
1184
+ typeName: y.ZodEffects,
1185
+ effect: { type: "transform", transform: e }
1186
+ });
1187
+ }
1188
+ default(e) {
1189
+ const t = typeof e == "function" ? e : () => e;
1190
+ return new be({
1191
+ ...g(this._def),
1192
+ innerType: this,
1193
+ defaultValue: t,
1194
+ typeName: y.ZodDefault
1195
+ });
1196
+ }
1197
+ brand() {
1198
+ return new He({
1199
+ typeName: y.ZodBranded,
1200
+ type: this,
1201
+ ...g(this._def)
1202
+ });
1203
+ }
1204
+ catch(e) {
1205
+ const t = typeof e == "function" ? e : () => e;
1206
+ return new ge({
1207
+ ...g(this._def),
1208
+ innerType: this,
1209
+ catchValue: t,
1210
+ typeName: y.ZodCatch
1211
+ });
1212
+ }
1213
+ describe(e) {
1214
+ const t = this.constructor;
1215
+ return new t({
1216
+ ...this._def,
1217
+ description: e
1218
+ });
1219
+ }
1220
+ pipe(e) {
1221
+ return _e.create(this, e);
1222
+ }
1223
+ readonly() {
1224
+ return ve.create(this);
1225
+ }
1226
+ isOptional() {
1227
+ return this.safeParse(void 0).success;
1228
+ }
1229
+ isNullable() {
1230
+ return this.safeParse(null).success;
732
1231
  }
733
1232
  }
734
- async function V0(a) {
735
- const t = await X.readFile(e0.normalize(a), {
736
- encoding: "utf8"
1233
+ const mn = /^c[^\s-]{8,}$/i, yn = /^[0-9a-z]+$/, bn = /^[0-9A-HJKMNP-TV-Z]{26}$/, gn = /^[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, vn = /^[a-z0-9_-]{21}$/i, _n = /^[-+]?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)?)??$/, xn = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, wn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
1234
+ let Re;
1235
+ const kn = /^(?:(?: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])$/, Tn = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, Cn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ft = "((\\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])))", Sn = new RegExp(`^${ft}$`);
1236
+ function ht(n) {
1237
+ let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
1238
+ return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
1239
+ }
1240
+ function In(n) {
1241
+ return new RegExp(`^${ht(n)}$`);
1242
+ }
1243
+ function pt(n) {
1244
+ let e = `${ft}T${ht(n)}`;
1245
+ const t = [];
1246
+ return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
1247
+ }
1248
+ function En(n, e) {
1249
+ return !!((e === "v4" || !e) && kn.test(n) || (e === "v6" || !e) && Tn.test(n));
1250
+ }
1251
+ class N extends v {
1252
+ _parse(e) {
1253
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
1254
+ const s = this._getOrReturnCtx(e);
1255
+ return l(s, {
1256
+ code: d.invalid_type,
1257
+ expected: f.string,
1258
+ received: s.parsedType
1259
+ }), b;
1260
+ }
1261
+ const a = new S();
1262
+ let r;
1263
+ for (const s of this._def.checks)
1264
+ if (s.kind === "min")
1265
+ e.data.length < s.value && (r = this._getOrReturnCtx(e, r), l(r, {
1266
+ code: d.too_small,
1267
+ minimum: s.value,
1268
+ type: "string",
1269
+ inclusive: !0,
1270
+ exact: !1,
1271
+ message: s.message
1272
+ }), a.dirty());
1273
+ else if (s.kind === "max")
1274
+ e.data.length > s.value && (r = this._getOrReturnCtx(e, r), l(r, {
1275
+ code: d.too_big,
1276
+ maximum: s.value,
1277
+ type: "string",
1278
+ inclusive: !0,
1279
+ exact: !1,
1280
+ message: s.message
1281
+ }), a.dirty());
1282
+ else if (s.kind === "length") {
1283
+ const i = e.data.length > s.value, o = e.data.length < s.value;
1284
+ (i || o) && (r = this._getOrReturnCtx(e, r), i ? l(r, {
1285
+ code: d.too_big,
1286
+ maximum: s.value,
1287
+ type: "string",
1288
+ inclusive: !0,
1289
+ exact: !0,
1290
+ message: s.message
1291
+ }) : o && l(r, {
1292
+ code: d.too_small,
1293
+ minimum: s.value,
1294
+ type: "string",
1295
+ inclusive: !0,
1296
+ exact: !0,
1297
+ message: s.message
1298
+ }), a.dirty());
1299
+ } else if (s.kind === "email")
1300
+ xn.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1301
+ validation: "email",
1302
+ code: d.invalid_string,
1303
+ message: s.message
1304
+ }), a.dirty());
1305
+ else if (s.kind === "emoji")
1306
+ Re || (Re = new RegExp(wn, "u")), Re.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1307
+ validation: "emoji",
1308
+ code: d.invalid_string,
1309
+ message: s.message
1310
+ }), a.dirty());
1311
+ else if (s.kind === "uuid")
1312
+ gn.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1313
+ validation: "uuid",
1314
+ code: d.invalid_string,
1315
+ message: s.message
1316
+ }), a.dirty());
1317
+ else if (s.kind === "nanoid")
1318
+ vn.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1319
+ validation: "nanoid",
1320
+ code: d.invalid_string,
1321
+ message: s.message
1322
+ }), a.dirty());
1323
+ else if (s.kind === "cuid")
1324
+ mn.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1325
+ validation: "cuid",
1326
+ code: d.invalid_string,
1327
+ message: s.message
1328
+ }), a.dirty());
1329
+ else if (s.kind === "cuid2")
1330
+ yn.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1331
+ validation: "cuid2",
1332
+ code: d.invalid_string,
1333
+ message: s.message
1334
+ }), a.dirty());
1335
+ else if (s.kind === "ulid")
1336
+ bn.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1337
+ validation: "ulid",
1338
+ code: d.invalid_string,
1339
+ message: s.message
1340
+ }), a.dirty());
1341
+ else if (s.kind === "url")
1342
+ try {
1343
+ new URL(e.data);
1344
+ } catch {
1345
+ r = this._getOrReturnCtx(e, r), l(r, {
1346
+ validation: "url",
1347
+ code: d.invalid_string,
1348
+ message: s.message
1349
+ }), a.dirty();
1350
+ }
1351
+ else s.kind === "regex" ? (s.regex.lastIndex = 0, s.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1352
+ validation: "regex",
1353
+ code: d.invalid_string,
1354
+ message: s.message
1355
+ }), a.dirty())) : s.kind === "trim" ? e.data = e.data.trim() : s.kind === "includes" ? e.data.includes(s.value, s.position) || (r = this._getOrReturnCtx(e, r), l(r, {
1356
+ code: d.invalid_string,
1357
+ validation: { includes: s.value, position: s.position },
1358
+ message: s.message
1359
+ }), a.dirty()) : s.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : s.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : s.kind === "startsWith" ? e.data.startsWith(s.value) || (r = this._getOrReturnCtx(e, r), l(r, {
1360
+ code: d.invalid_string,
1361
+ validation: { startsWith: s.value },
1362
+ message: s.message
1363
+ }), a.dirty()) : s.kind === "endsWith" ? e.data.endsWith(s.value) || (r = this._getOrReturnCtx(e, r), l(r, {
1364
+ code: d.invalid_string,
1365
+ validation: { endsWith: s.value },
1366
+ message: s.message
1367
+ }), a.dirty()) : s.kind === "datetime" ? pt(s).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1368
+ code: d.invalid_string,
1369
+ validation: "datetime",
1370
+ message: s.message
1371
+ }), a.dirty()) : s.kind === "date" ? Sn.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1372
+ code: d.invalid_string,
1373
+ validation: "date",
1374
+ message: s.message
1375
+ }), a.dirty()) : s.kind === "time" ? In(s).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1376
+ code: d.invalid_string,
1377
+ validation: "time",
1378
+ message: s.message
1379
+ }), a.dirty()) : s.kind === "duration" ? _n.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1380
+ validation: "duration",
1381
+ code: d.invalid_string,
1382
+ message: s.message
1383
+ }), a.dirty()) : s.kind === "ip" ? En(e.data, s.version) || (r = this._getOrReturnCtx(e, r), l(r, {
1384
+ validation: "ip",
1385
+ code: d.invalid_string,
1386
+ message: s.message
1387
+ }), a.dirty()) : s.kind === "base64" ? Cn.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1388
+ validation: "base64",
1389
+ code: d.invalid_string,
1390
+ message: s.message
1391
+ }), a.dirty()) : _.assertNever(s);
1392
+ return { status: a.value, value: e.data };
1393
+ }
1394
+ _regex(e, t, a) {
1395
+ return this.refinement((r) => e.test(r), {
1396
+ validation: t,
1397
+ code: d.invalid_string,
1398
+ ...p.errToObj(a)
1399
+ });
1400
+ }
1401
+ _addCheck(e) {
1402
+ return new N({
1403
+ ...this._def,
1404
+ checks: [...this._def.checks, e]
1405
+ });
1406
+ }
1407
+ email(e) {
1408
+ return this._addCheck({ kind: "email", ...p.errToObj(e) });
1409
+ }
1410
+ url(e) {
1411
+ return this._addCheck({ kind: "url", ...p.errToObj(e) });
1412
+ }
1413
+ emoji(e) {
1414
+ return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
1415
+ }
1416
+ uuid(e) {
1417
+ return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
1418
+ }
1419
+ nanoid(e) {
1420
+ return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
1421
+ }
1422
+ cuid(e) {
1423
+ return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
1424
+ }
1425
+ cuid2(e) {
1426
+ return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
1427
+ }
1428
+ ulid(e) {
1429
+ return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
1430
+ }
1431
+ base64(e) {
1432
+ return this._addCheck({ kind: "base64", ...p.errToObj(e) });
1433
+ }
1434
+ ip(e) {
1435
+ return this._addCheck({ kind: "ip", ...p.errToObj(e) });
1436
+ }
1437
+ datetime(e) {
1438
+ var t, a;
1439
+ return typeof e == "string" ? this._addCheck({
1440
+ kind: "datetime",
1441
+ precision: null,
1442
+ offset: !1,
1443
+ local: !1,
1444
+ message: e
1445
+ }) : this._addCheck({
1446
+ kind: "datetime",
1447
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
1448
+ offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
1449
+ local: (a = e == null ? void 0 : e.local) !== null && a !== void 0 ? a : !1,
1450
+ ...p.errToObj(e == null ? void 0 : e.message)
1451
+ });
1452
+ }
1453
+ date(e) {
1454
+ return this._addCheck({ kind: "date", message: e });
1455
+ }
1456
+ time(e) {
1457
+ return typeof e == "string" ? this._addCheck({
1458
+ kind: "time",
1459
+ precision: null,
1460
+ message: e
1461
+ }) : this._addCheck({
1462
+ kind: "time",
1463
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
1464
+ ...p.errToObj(e == null ? void 0 : e.message)
1465
+ });
1466
+ }
1467
+ duration(e) {
1468
+ return this._addCheck({ kind: "duration", ...p.errToObj(e) });
1469
+ }
1470
+ regex(e, t) {
1471
+ return this._addCheck({
1472
+ kind: "regex",
1473
+ regex: e,
1474
+ ...p.errToObj(t)
1475
+ });
1476
+ }
1477
+ includes(e, t) {
1478
+ return this._addCheck({
1479
+ kind: "includes",
1480
+ value: e,
1481
+ position: t == null ? void 0 : t.position,
1482
+ ...p.errToObj(t == null ? void 0 : t.message)
1483
+ });
1484
+ }
1485
+ startsWith(e, t) {
1486
+ return this._addCheck({
1487
+ kind: "startsWith",
1488
+ value: e,
1489
+ ...p.errToObj(t)
1490
+ });
1491
+ }
1492
+ endsWith(e, t) {
1493
+ return this._addCheck({
1494
+ kind: "endsWith",
1495
+ value: e,
1496
+ ...p.errToObj(t)
1497
+ });
1498
+ }
1499
+ min(e, t) {
1500
+ return this._addCheck({
1501
+ kind: "min",
1502
+ value: e,
1503
+ ...p.errToObj(t)
1504
+ });
1505
+ }
1506
+ max(e, t) {
1507
+ return this._addCheck({
1508
+ kind: "max",
1509
+ value: e,
1510
+ ...p.errToObj(t)
1511
+ });
1512
+ }
1513
+ length(e, t) {
1514
+ return this._addCheck({
1515
+ kind: "length",
1516
+ value: e,
1517
+ ...p.errToObj(t)
1518
+ });
1519
+ }
1520
+ /**
1521
+ * @deprecated Use z.string().min(1) instead.
1522
+ * @see {@link ZodString.min}
1523
+ */
1524
+ nonempty(e) {
1525
+ return this.min(1, p.errToObj(e));
1526
+ }
1527
+ trim() {
1528
+ return new N({
1529
+ ...this._def,
1530
+ checks: [...this._def.checks, { kind: "trim" }]
1531
+ });
1532
+ }
1533
+ toLowerCase() {
1534
+ return new N({
1535
+ ...this._def,
1536
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1537
+ });
1538
+ }
1539
+ toUpperCase() {
1540
+ return new N({
1541
+ ...this._def,
1542
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1543
+ });
1544
+ }
1545
+ get isDatetime() {
1546
+ return !!this._def.checks.find((e) => e.kind === "datetime");
1547
+ }
1548
+ get isDate() {
1549
+ return !!this._def.checks.find((e) => e.kind === "date");
1550
+ }
1551
+ get isTime() {
1552
+ return !!this._def.checks.find((e) => e.kind === "time");
1553
+ }
1554
+ get isDuration() {
1555
+ return !!this._def.checks.find((e) => e.kind === "duration");
1556
+ }
1557
+ get isEmail() {
1558
+ return !!this._def.checks.find((e) => e.kind === "email");
1559
+ }
1560
+ get isURL() {
1561
+ return !!this._def.checks.find((e) => e.kind === "url");
1562
+ }
1563
+ get isEmoji() {
1564
+ return !!this._def.checks.find((e) => e.kind === "emoji");
1565
+ }
1566
+ get isUUID() {
1567
+ return !!this._def.checks.find((e) => e.kind === "uuid");
1568
+ }
1569
+ get isNANOID() {
1570
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
1571
+ }
1572
+ get isCUID() {
1573
+ return !!this._def.checks.find((e) => e.kind === "cuid");
1574
+ }
1575
+ get isCUID2() {
1576
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
1577
+ }
1578
+ get isULID() {
1579
+ return !!this._def.checks.find((e) => e.kind === "ulid");
1580
+ }
1581
+ get isIP() {
1582
+ return !!this._def.checks.find((e) => e.kind === "ip");
1583
+ }
1584
+ get isBase64() {
1585
+ return !!this._def.checks.find((e) => e.kind === "base64");
1586
+ }
1587
+ get minLength() {
1588
+ let e = null;
1589
+ for (const t of this._def.checks)
1590
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1591
+ return e;
1592
+ }
1593
+ get maxLength() {
1594
+ let e = null;
1595
+ for (const t of this._def.checks)
1596
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1597
+ return e;
1598
+ }
1599
+ }
1600
+ N.create = (n) => {
1601
+ var e;
1602
+ return new N({
1603
+ checks: [],
1604
+ typeName: y.ZodString,
1605
+ coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
1606
+ ...g(n)
737
1607
  });
738
- return ee.parse(JSON.parse(t));
739
- }
740
- const _0 = c.custom(u0, "invalid Hex payload"), d = c.string().transform((a, t) => (/^0x[a-fA-F0-9]{40}$/.test(a) || t.addIssue({
741
- code: c.ZodIssueCode.custom,
742
- message: `Invalid Address ${a}`
743
- }), a)).pipe(c.custom(R, "invalid eth address")), $0 = c.coerce.number().min(1).max(2).transform(BigInt).pipe(c.custom()), k0 = c.object({
744
- type: c.literal("ManagedBudget"),
745
- owner: d,
746
- authorized: c.array(d),
747
- roles: c.array($0)
1608
+ };
1609
+ function An(n, e) {
1610
+ const t = (n.toString().split(".")[1] || "").length, a = (e.toString().split(".")[1] || "").length, r = t > a ? t : a, s = parseInt(n.toFixed(r).replace(".", "")), i = parseInt(e.toFixed(r).replace(".", ""));
1611
+ return s % i / Math.pow(10, r);
1612
+ }
1613
+ class L extends v {
1614
+ constructor() {
1615
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1616
+ }
1617
+ _parse(e) {
1618
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
1619
+ const s = this._getOrReturnCtx(e);
1620
+ return l(s, {
1621
+ code: d.invalid_type,
1622
+ expected: f.number,
1623
+ received: s.parsedType
1624
+ }), b;
1625
+ }
1626
+ let a;
1627
+ const r = new S();
1628
+ for (const s of this._def.checks)
1629
+ s.kind === "int" ? _.isInteger(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
1630
+ code: d.invalid_type,
1631
+ expected: "integer",
1632
+ received: "float",
1633
+ message: s.message
1634
+ }), r.dirty()) : s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (a = this._getOrReturnCtx(e, a), l(a, {
1635
+ code: d.too_small,
1636
+ minimum: s.value,
1637
+ type: "number",
1638
+ inclusive: s.inclusive,
1639
+ exact: !1,
1640
+ message: s.message
1641
+ }), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (a = this._getOrReturnCtx(e, a), l(a, {
1642
+ code: d.too_big,
1643
+ maximum: s.value,
1644
+ type: "number",
1645
+ inclusive: s.inclusive,
1646
+ exact: !1,
1647
+ message: s.message
1648
+ }), r.dirty()) : s.kind === "multipleOf" ? An(e.data, s.value) !== 0 && (a = this._getOrReturnCtx(e, a), l(a, {
1649
+ code: d.not_multiple_of,
1650
+ multipleOf: s.value,
1651
+ message: s.message
1652
+ }), r.dirty()) : s.kind === "finite" ? Number.isFinite(e.data) || (a = this._getOrReturnCtx(e, a), l(a, {
1653
+ code: d.not_finite,
1654
+ message: s.message
1655
+ }), r.dirty()) : _.assertNever(s);
1656
+ return { status: r.value, value: e.data };
1657
+ }
1658
+ gte(e, t) {
1659
+ return this.setLimit("min", e, !0, p.toString(t));
1660
+ }
1661
+ gt(e, t) {
1662
+ return this.setLimit("min", e, !1, p.toString(t));
1663
+ }
1664
+ lte(e, t) {
1665
+ return this.setLimit("max", e, !0, p.toString(t));
1666
+ }
1667
+ lt(e, t) {
1668
+ return this.setLimit("max", e, !1, p.toString(t));
1669
+ }
1670
+ setLimit(e, t, a, r) {
1671
+ return new L({
1672
+ ...this._def,
1673
+ checks: [
1674
+ ...this._def.checks,
1675
+ {
1676
+ kind: e,
1677
+ value: t,
1678
+ inclusive: a,
1679
+ message: p.toString(r)
1680
+ }
1681
+ ]
1682
+ });
1683
+ }
1684
+ _addCheck(e) {
1685
+ return new L({
1686
+ ...this._def,
1687
+ checks: [...this._def.checks, e]
1688
+ });
1689
+ }
1690
+ int(e) {
1691
+ return this._addCheck({
1692
+ kind: "int",
1693
+ message: p.toString(e)
1694
+ });
1695
+ }
1696
+ positive(e) {
1697
+ return this._addCheck({
1698
+ kind: "min",
1699
+ value: 0,
1700
+ inclusive: !1,
1701
+ message: p.toString(e)
1702
+ });
1703
+ }
1704
+ negative(e) {
1705
+ return this._addCheck({
1706
+ kind: "max",
1707
+ value: 0,
1708
+ inclusive: !1,
1709
+ message: p.toString(e)
1710
+ });
1711
+ }
1712
+ nonpositive(e) {
1713
+ return this._addCheck({
1714
+ kind: "max",
1715
+ value: 0,
1716
+ inclusive: !0,
1717
+ message: p.toString(e)
1718
+ });
1719
+ }
1720
+ nonnegative(e) {
1721
+ return this._addCheck({
1722
+ kind: "min",
1723
+ value: 0,
1724
+ inclusive: !0,
1725
+ message: p.toString(e)
1726
+ });
1727
+ }
1728
+ multipleOf(e, t) {
1729
+ return this._addCheck({
1730
+ kind: "multipleOf",
1731
+ value: e,
1732
+ message: p.toString(t)
1733
+ });
1734
+ }
1735
+ finite(e) {
1736
+ return this._addCheck({
1737
+ kind: "finite",
1738
+ message: p.toString(e)
1739
+ });
1740
+ }
1741
+ safe(e) {
1742
+ return this._addCheck({
1743
+ kind: "min",
1744
+ inclusive: !0,
1745
+ value: Number.MIN_SAFE_INTEGER,
1746
+ message: p.toString(e)
1747
+ })._addCheck({
1748
+ kind: "max",
1749
+ inclusive: !0,
1750
+ value: Number.MAX_SAFE_INTEGER,
1751
+ message: p.toString(e)
1752
+ });
1753
+ }
1754
+ get minValue() {
1755
+ let e = null;
1756
+ for (const t of this._def.checks)
1757
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1758
+ return e;
1759
+ }
1760
+ get maxValue() {
1761
+ let e = null;
1762
+ for (const t of this._def.checks)
1763
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1764
+ return e;
1765
+ }
1766
+ get isInt() {
1767
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && _.isInteger(e.value));
1768
+ }
1769
+ get isFinite() {
1770
+ let e = null, t = null;
1771
+ for (const a of this._def.checks) {
1772
+ if (a.kind === "finite" || a.kind === "int" || a.kind === "multipleOf")
1773
+ return !0;
1774
+ a.kind === "min" ? (t === null || a.value > t) && (t = a.value) : a.kind === "max" && (e === null || a.value < e) && (e = a.value);
1775
+ }
1776
+ return Number.isFinite(t) && Number.isFinite(e);
1777
+ }
1778
+ }
1779
+ L.create = (n) => new L({
1780
+ checks: [],
1781
+ typeName: y.ZodNumber,
1782
+ coerce: (n == null ? void 0 : n.coerce) || !1,
1783
+ ...g(n)
1784
+ });
1785
+ class z extends v {
1786
+ constructor() {
1787
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1788
+ }
1789
+ _parse(e) {
1790
+ if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
1791
+ const s = this._getOrReturnCtx(e);
1792
+ return l(s, {
1793
+ code: d.invalid_type,
1794
+ expected: f.bigint,
1795
+ received: s.parsedType
1796
+ }), b;
1797
+ }
1798
+ let a;
1799
+ const r = new S();
1800
+ for (const s of this._def.checks)
1801
+ s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (a = this._getOrReturnCtx(e, a), l(a, {
1802
+ code: d.too_small,
1803
+ type: "bigint",
1804
+ minimum: s.value,
1805
+ inclusive: s.inclusive,
1806
+ message: s.message
1807
+ }), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (a = this._getOrReturnCtx(e, a), l(a, {
1808
+ code: d.too_big,
1809
+ type: "bigint",
1810
+ maximum: s.value,
1811
+ inclusive: s.inclusive,
1812
+ message: s.message
1813
+ }), r.dirty()) : s.kind === "multipleOf" ? e.data % s.value !== BigInt(0) && (a = this._getOrReturnCtx(e, a), l(a, {
1814
+ code: d.not_multiple_of,
1815
+ multipleOf: s.value,
1816
+ message: s.message
1817
+ }), r.dirty()) : _.assertNever(s);
1818
+ return { status: r.value, value: e.data };
1819
+ }
1820
+ gte(e, t) {
1821
+ return this.setLimit("min", e, !0, p.toString(t));
1822
+ }
1823
+ gt(e, t) {
1824
+ return this.setLimit("min", e, !1, p.toString(t));
1825
+ }
1826
+ lte(e, t) {
1827
+ return this.setLimit("max", e, !0, p.toString(t));
1828
+ }
1829
+ lt(e, t) {
1830
+ return this.setLimit("max", e, !1, p.toString(t));
1831
+ }
1832
+ setLimit(e, t, a, r) {
1833
+ return new z({
1834
+ ...this._def,
1835
+ checks: [
1836
+ ...this._def.checks,
1837
+ {
1838
+ kind: e,
1839
+ value: t,
1840
+ inclusive: a,
1841
+ message: p.toString(r)
1842
+ }
1843
+ ]
1844
+ });
1845
+ }
1846
+ _addCheck(e) {
1847
+ return new z({
1848
+ ...this._def,
1849
+ checks: [...this._def.checks, e]
1850
+ });
1851
+ }
1852
+ positive(e) {
1853
+ return this._addCheck({
1854
+ kind: "min",
1855
+ value: BigInt(0),
1856
+ inclusive: !1,
1857
+ message: p.toString(e)
1858
+ });
1859
+ }
1860
+ negative(e) {
1861
+ return this._addCheck({
1862
+ kind: "max",
1863
+ value: BigInt(0),
1864
+ inclusive: !1,
1865
+ message: p.toString(e)
1866
+ });
1867
+ }
1868
+ nonpositive(e) {
1869
+ return this._addCheck({
1870
+ kind: "max",
1871
+ value: BigInt(0),
1872
+ inclusive: !0,
1873
+ message: p.toString(e)
1874
+ });
1875
+ }
1876
+ nonnegative(e) {
1877
+ return this._addCheck({
1878
+ kind: "min",
1879
+ value: BigInt(0),
1880
+ inclusive: !0,
1881
+ message: p.toString(e)
1882
+ });
1883
+ }
1884
+ multipleOf(e, t) {
1885
+ return this._addCheck({
1886
+ kind: "multipleOf",
1887
+ value: e,
1888
+ message: p.toString(t)
1889
+ });
1890
+ }
1891
+ get minValue() {
1892
+ let e = null;
1893
+ for (const t of this._def.checks)
1894
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1895
+ return e;
1896
+ }
1897
+ get maxValue() {
1898
+ let e = null;
1899
+ for (const t of this._def.checks)
1900
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1901
+ return e;
1902
+ }
1903
+ }
1904
+ z.create = (n) => {
1905
+ var e;
1906
+ return new z({
1907
+ checks: [],
1908
+ typeName: y.ZodBigInt,
1909
+ coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
1910
+ ...g(n)
1911
+ });
1912
+ };
1913
+ class ce extends v {
1914
+ _parse(e) {
1915
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
1916
+ const a = this._getOrReturnCtx(e);
1917
+ return l(a, {
1918
+ code: d.invalid_type,
1919
+ expected: f.boolean,
1920
+ received: a.parsedType
1921
+ }), b;
1922
+ }
1923
+ return I(e.data);
1924
+ }
1925
+ }
1926
+ ce.create = (n) => new ce({
1927
+ typeName: y.ZodBoolean,
1928
+ coerce: (n == null ? void 0 : n.coerce) || !1,
1929
+ ...g(n)
1930
+ });
1931
+ class J extends v {
1932
+ _parse(e) {
1933
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1934
+ const s = this._getOrReturnCtx(e);
1935
+ return l(s, {
1936
+ code: d.invalid_type,
1937
+ expected: f.date,
1938
+ received: s.parsedType
1939
+ }), b;
1940
+ }
1941
+ if (isNaN(e.data.getTime())) {
1942
+ const s = this._getOrReturnCtx(e);
1943
+ return l(s, {
1944
+ code: d.invalid_date
1945
+ }), b;
1946
+ }
1947
+ const a = new S();
1948
+ let r;
1949
+ for (const s of this._def.checks)
1950
+ s.kind === "min" ? e.data.getTime() < s.value && (r = this._getOrReturnCtx(e, r), l(r, {
1951
+ code: d.too_small,
1952
+ message: s.message,
1953
+ inclusive: !0,
1954
+ exact: !1,
1955
+ minimum: s.value,
1956
+ type: "date"
1957
+ }), a.dirty()) : s.kind === "max" ? e.data.getTime() > s.value && (r = this._getOrReturnCtx(e, r), l(r, {
1958
+ code: d.too_big,
1959
+ message: s.message,
1960
+ inclusive: !0,
1961
+ exact: !1,
1962
+ maximum: s.value,
1963
+ type: "date"
1964
+ }), a.dirty()) : _.assertNever(s);
1965
+ return {
1966
+ status: a.value,
1967
+ value: new Date(e.data.getTime())
1968
+ };
1969
+ }
1970
+ _addCheck(e) {
1971
+ return new J({
1972
+ ...this._def,
1973
+ checks: [...this._def.checks, e]
1974
+ });
1975
+ }
1976
+ min(e, t) {
1977
+ return this._addCheck({
1978
+ kind: "min",
1979
+ value: e.getTime(),
1980
+ message: p.toString(t)
1981
+ });
1982
+ }
1983
+ max(e, t) {
1984
+ return this._addCheck({
1985
+ kind: "max",
1986
+ value: e.getTime(),
1987
+ message: p.toString(t)
1988
+ });
1989
+ }
1990
+ get minDate() {
1991
+ let e = null;
1992
+ for (const t of this._def.checks)
1993
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1994
+ return e != null ? new Date(e) : null;
1995
+ }
1996
+ get maxDate() {
1997
+ let e = null;
1998
+ for (const t of this._def.checks)
1999
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
2000
+ return e != null ? new Date(e) : null;
2001
+ }
2002
+ }
2003
+ J.create = (n) => new J({
2004
+ checks: [],
2005
+ coerce: (n == null ? void 0 : n.coerce) || !1,
2006
+ typeName: y.ZodDate,
2007
+ ...g(n)
2008
+ });
2009
+ class Ce extends v {
2010
+ _parse(e) {
2011
+ if (this._getType(e) !== f.symbol) {
2012
+ const a = this._getOrReturnCtx(e);
2013
+ return l(a, {
2014
+ code: d.invalid_type,
2015
+ expected: f.symbol,
2016
+ received: a.parsedType
2017
+ }), b;
2018
+ }
2019
+ return I(e.data);
2020
+ }
2021
+ }
2022
+ Ce.create = (n) => new Ce({
2023
+ typeName: y.ZodSymbol,
2024
+ ...g(n)
2025
+ });
2026
+ class de extends v {
2027
+ _parse(e) {
2028
+ if (this._getType(e) !== f.undefined) {
2029
+ const a = this._getOrReturnCtx(e);
2030
+ return l(a, {
2031
+ code: d.invalid_type,
2032
+ expected: f.undefined,
2033
+ received: a.parsedType
2034
+ }), b;
2035
+ }
2036
+ return I(e.data);
2037
+ }
2038
+ }
2039
+ de.create = (n) => new de({
2040
+ typeName: y.ZodUndefined,
2041
+ ...g(n)
2042
+ });
2043
+ class ue extends v {
2044
+ _parse(e) {
2045
+ if (this._getType(e) !== f.null) {
2046
+ const a = this._getOrReturnCtx(e);
2047
+ return l(a, {
2048
+ code: d.invalid_type,
2049
+ expected: f.null,
2050
+ received: a.parsedType
2051
+ }), b;
2052
+ }
2053
+ return I(e.data);
2054
+ }
2055
+ }
2056
+ ue.create = (n) => new ue({
2057
+ typeName: y.ZodNull,
2058
+ ...g(n)
2059
+ });
2060
+ class te extends v {
2061
+ constructor() {
2062
+ super(...arguments), this._any = !0;
2063
+ }
2064
+ _parse(e) {
2065
+ return I(e.data);
2066
+ }
2067
+ }
2068
+ te.create = (n) => new te({
2069
+ typeName: y.ZodAny,
2070
+ ...g(n)
2071
+ });
2072
+ class H extends v {
2073
+ constructor() {
2074
+ super(...arguments), this._unknown = !0;
2075
+ }
2076
+ _parse(e) {
2077
+ return I(e.data);
2078
+ }
2079
+ }
2080
+ H.create = (n) => new H({
2081
+ typeName: y.ZodUnknown,
2082
+ ...g(n)
2083
+ });
2084
+ class P extends v {
2085
+ _parse(e) {
2086
+ const t = this._getOrReturnCtx(e);
2087
+ return l(t, {
2088
+ code: d.invalid_type,
2089
+ expected: f.never,
2090
+ received: t.parsedType
2091
+ }), b;
2092
+ }
2093
+ }
2094
+ P.create = (n) => new P({
2095
+ typeName: y.ZodNever,
2096
+ ...g(n)
2097
+ });
2098
+ class Se extends v {
2099
+ _parse(e) {
2100
+ if (this._getType(e) !== f.undefined) {
2101
+ const a = this._getOrReturnCtx(e);
2102
+ return l(a, {
2103
+ code: d.invalid_type,
2104
+ expected: f.void,
2105
+ received: a.parsedType
2106
+ }), b;
2107
+ }
2108
+ return I(e.data);
2109
+ }
2110
+ }
2111
+ Se.create = (n) => new Se({
2112
+ typeName: y.ZodVoid,
2113
+ ...g(n)
2114
+ });
2115
+ class O extends v {
2116
+ _parse(e) {
2117
+ const { ctx: t, status: a } = this._processInputParams(e), r = this._def;
2118
+ if (t.parsedType !== f.array)
2119
+ return l(t, {
2120
+ code: d.invalid_type,
2121
+ expected: f.array,
2122
+ received: t.parsedType
2123
+ }), b;
2124
+ if (r.exactLength !== null) {
2125
+ const i = t.data.length > r.exactLength.value, o = t.data.length < r.exactLength.value;
2126
+ (i || o) && (l(t, {
2127
+ code: i ? d.too_big : d.too_small,
2128
+ minimum: o ? r.exactLength.value : void 0,
2129
+ maximum: i ? r.exactLength.value : void 0,
2130
+ type: "array",
2131
+ inclusive: !0,
2132
+ exact: !0,
2133
+ message: r.exactLength.message
2134
+ }), a.dirty());
2135
+ }
2136
+ if (r.minLength !== null && t.data.length < r.minLength.value && (l(t, {
2137
+ code: d.too_small,
2138
+ minimum: r.minLength.value,
2139
+ type: "array",
2140
+ inclusive: !0,
2141
+ exact: !1,
2142
+ message: r.minLength.message
2143
+ }), a.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (l(t, {
2144
+ code: d.too_big,
2145
+ maximum: r.maxLength.value,
2146
+ type: "array",
2147
+ inclusive: !0,
2148
+ exact: !1,
2149
+ message: r.maxLength.message
2150
+ }), a.dirty()), t.common.async)
2151
+ return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new j(t, i, t.path, o)))).then((i) => S.mergeArray(a, i));
2152
+ const s = [...t.data].map((i, o) => r.type._parseSync(new j(t, i, t.path, o)));
2153
+ return S.mergeArray(a, s);
2154
+ }
2155
+ get element() {
2156
+ return this._def.type;
2157
+ }
2158
+ min(e, t) {
2159
+ return new O({
2160
+ ...this._def,
2161
+ minLength: { value: e, message: p.toString(t) }
2162
+ });
2163
+ }
2164
+ max(e, t) {
2165
+ return new O({
2166
+ ...this._def,
2167
+ maxLength: { value: e, message: p.toString(t) }
2168
+ });
2169
+ }
2170
+ length(e, t) {
2171
+ return new O({
2172
+ ...this._def,
2173
+ exactLength: { value: e, message: p.toString(t) }
2174
+ });
2175
+ }
2176
+ nonempty(e) {
2177
+ return this.min(1, e);
2178
+ }
2179
+ }
2180
+ O.create = (n, e) => new O({
2181
+ type: n,
2182
+ minLength: null,
2183
+ maxLength: null,
2184
+ exactLength: null,
2185
+ typeName: y.ZodArray,
2186
+ ...g(e)
2187
+ });
2188
+ function Q(n) {
2189
+ if (n instanceof x) {
2190
+ const e = {};
2191
+ for (const t in n.shape) {
2192
+ const a = n.shape[t];
2193
+ e[t] = Z.create(Q(a));
2194
+ }
2195
+ return new x({
2196
+ ...n._def,
2197
+ shape: () => e
2198
+ });
2199
+ } else return n instanceof O ? new O({
2200
+ ...n._def,
2201
+ type: Q(n.element)
2202
+ }) : n instanceof Z ? Z.create(Q(n.unwrap())) : n instanceof W ? W.create(Q(n.unwrap())) : n instanceof M ? M.create(n.items.map((e) => Q(e))) : n;
2203
+ }
2204
+ class x extends v {
2205
+ constructor() {
2206
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
2207
+ }
2208
+ _getCached() {
2209
+ if (this._cached !== null)
2210
+ return this._cached;
2211
+ const e = this._def.shape(), t = _.objectKeys(e);
2212
+ return this._cached = { shape: e, keys: t };
2213
+ }
2214
+ _parse(e) {
2215
+ if (this._getType(e) !== f.object) {
2216
+ const c = this._getOrReturnCtx(e);
2217
+ return l(c, {
2218
+ code: d.invalid_type,
2219
+ expected: f.object,
2220
+ received: c.parsedType
2221
+ }), b;
2222
+ }
2223
+ const { status: a, ctx: r } = this._processInputParams(e), { shape: s, keys: i } = this._getCached(), o = [];
2224
+ if (!(this._def.catchall instanceof P && this._def.unknownKeys === "strip"))
2225
+ for (const c in r.data)
2226
+ i.includes(c) || o.push(c);
2227
+ const u = [];
2228
+ for (const c of i) {
2229
+ const m = s[c], C = r.data[c];
2230
+ u.push({
2231
+ key: { status: "valid", value: c },
2232
+ value: m._parse(new j(r, C, r.path, c)),
2233
+ alwaysSet: c in r.data
2234
+ });
2235
+ }
2236
+ if (this._def.catchall instanceof P) {
2237
+ const c = this._def.unknownKeys;
2238
+ if (c === "passthrough")
2239
+ for (const m of o)
2240
+ u.push({
2241
+ key: { status: "valid", value: m },
2242
+ value: { status: "valid", value: r.data[m] }
2243
+ });
2244
+ else if (c === "strict")
2245
+ o.length > 0 && (l(r, {
2246
+ code: d.unrecognized_keys,
2247
+ keys: o
2248
+ }), a.dirty());
2249
+ else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
2250
+ } else {
2251
+ const c = this._def.catchall;
2252
+ for (const m of o) {
2253
+ const C = r.data[m];
2254
+ u.push({
2255
+ key: { status: "valid", value: m },
2256
+ value: c._parse(
2257
+ new j(r, C, r.path, m)
2258
+ //, ctx.child(key), value, getParsedType(value)
2259
+ ),
2260
+ alwaysSet: m in r.data
2261
+ });
2262
+ }
2263
+ }
2264
+ return r.common.async ? Promise.resolve().then(async () => {
2265
+ const c = [];
2266
+ for (const m of u) {
2267
+ const C = await m.key, G = await m.value;
2268
+ c.push({
2269
+ key: C,
2270
+ value: G,
2271
+ alwaysSet: m.alwaysSet
2272
+ });
2273
+ }
2274
+ return c;
2275
+ }).then((c) => S.mergeObjectSync(a, c)) : S.mergeObjectSync(a, u);
2276
+ }
2277
+ get shape() {
2278
+ return this._def.shape();
2279
+ }
2280
+ strict(e) {
2281
+ return p.errToObj, new x({
2282
+ ...this._def,
2283
+ unknownKeys: "strict",
2284
+ ...e !== void 0 ? {
2285
+ errorMap: (t, a) => {
2286
+ var r, s, i, o;
2287
+ const u = (i = (s = (r = this._def).errorMap) === null || s === void 0 ? void 0 : s.call(r, t, a).message) !== null && i !== void 0 ? i : a.defaultError;
2288
+ return t.code === "unrecognized_keys" ? {
2289
+ message: (o = p.errToObj(e).message) !== null && o !== void 0 ? o : u
2290
+ } : {
2291
+ message: u
2292
+ };
2293
+ }
2294
+ } : {}
2295
+ });
2296
+ }
2297
+ strip() {
2298
+ return new x({
2299
+ ...this._def,
2300
+ unknownKeys: "strip"
2301
+ });
2302
+ }
2303
+ passthrough() {
2304
+ return new x({
2305
+ ...this._def,
2306
+ unknownKeys: "passthrough"
2307
+ });
2308
+ }
2309
+ // const AugmentFactory =
2310
+ // <Def extends ZodObjectDef>(def: Def) =>
2311
+ // <Augmentation extends ZodRawShape>(
2312
+ // augmentation: Augmentation
2313
+ // ): ZodObject<
2314
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2315
+ // Def["unknownKeys"],
2316
+ // Def["catchall"]
2317
+ // > => {
2318
+ // return new ZodObject({
2319
+ // ...def,
2320
+ // shape: () => ({
2321
+ // ...def.shape(),
2322
+ // ...augmentation,
2323
+ // }),
2324
+ // }) as any;
2325
+ // };
2326
+ extend(e) {
2327
+ return new x({
2328
+ ...this._def,
2329
+ shape: () => ({
2330
+ ...this._def.shape(),
2331
+ ...e
2332
+ })
2333
+ });
2334
+ }
2335
+ /**
2336
+ * Prior to zod@1.0.12 there was a bug in the
2337
+ * inferred type of merged objects. Please
2338
+ * upgrade if you are experiencing issues.
2339
+ */
2340
+ merge(e) {
2341
+ return new x({
2342
+ unknownKeys: e._def.unknownKeys,
2343
+ catchall: e._def.catchall,
2344
+ shape: () => ({
2345
+ ...this._def.shape(),
2346
+ ...e._def.shape()
2347
+ }),
2348
+ typeName: y.ZodObject
2349
+ });
2350
+ }
2351
+ // merge<
2352
+ // Incoming extends AnyZodObject,
2353
+ // Augmentation extends Incoming["shape"],
2354
+ // NewOutput extends {
2355
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2356
+ // ? Augmentation[k]["_output"]
2357
+ // : k extends keyof Output
2358
+ // ? Output[k]
2359
+ // : never;
2360
+ // },
2361
+ // NewInput extends {
2362
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2363
+ // ? Augmentation[k]["_input"]
2364
+ // : k extends keyof Input
2365
+ // ? Input[k]
2366
+ // : never;
2367
+ // }
2368
+ // >(
2369
+ // merging: Incoming
2370
+ // ): ZodObject<
2371
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2372
+ // Incoming["_def"]["unknownKeys"],
2373
+ // Incoming["_def"]["catchall"],
2374
+ // NewOutput,
2375
+ // NewInput
2376
+ // > {
2377
+ // const merged: any = new ZodObject({
2378
+ // unknownKeys: merging._def.unknownKeys,
2379
+ // catchall: merging._def.catchall,
2380
+ // shape: () =>
2381
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2382
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2383
+ // }) as any;
2384
+ // return merged;
2385
+ // }
2386
+ setKey(e, t) {
2387
+ return this.augment({ [e]: t });
2388
+ }
2389
+ // merge<Incoming extends AnyZodObject>(
2390
+ // merging: Incoming
2391
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2392
+ // ZodObject<
2393
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2394
+ // Incoming["_def"]["unknownKeys"],
2395
+ // Incoming["_def"]["catchall"]
2396
+ // > {
2397
+ // // const mergedShape = objectUtil.mergeShapes(
2398
+ // // this._def.shape(),
2399
+ // // merging._def.shape()
2400
+ // // );
2401
+ // const merged: any = new ZodObject({
2402
+ // unknownKeys: merging._def.unknownKeys,
2403
+ // catchall: merging._def.catchall,
2404
+ // shape: () =>
2405
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2406
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2407
+ // }) as any;
2408
+ // return merged;
2409
+ // }
2410
+ catchall(e) {
2411
+ return new x({
2412
+ ...this._def,
2413
+ catchall: e
2414
+ });
2415
+ }
2416
+ pick(e) {
2417
+ const t = {};
2418
+ return _.objectKeys(e).forEach((a) => {
2419
+ e[a] && this.shape[a] && (t[a] = this.shape[a]);
2420
+ }), new x({
2421
+ ...this._def,
2422
+ shape: () => t
2423
+ });
2424
+ }
2425
+ omit(e) {
2426
+ const t = {};
2427
+ return _.objectKeys(this.shape).forEach((a) => {
2428
+ e[a] || (t[a] = this.shape[a]);
2429
+ }), new x({
2430
+ ...this._def,
2431
+ shape: () => t
2432
+ });
2433
+ }
2434
+ /**
2435
+ * @deprecated
2436
+ */
2437
+ deepPartial() {
2438
+ return Q(this);
2439
+ }
2440
+ partial(e) {
2441
+ const t = {};
2442
+ return _.objectKeys(this.shape).forEach((a) => {
2443
+ const r = this.shape[a];
2444
+ e && !e[a] ? t[a] = r : t[a] = r.optional();
2445
+ }), new x({
2446
+ ...this._def,
2447
+ shape: () => t
2448
+ });
2449
+ }
2450
+ required(e) {
2451
+ const t = {};
2452
+ return _.objectKeys(this.shape).forEach((a) => {
2453
+ if (e && !e[a])
2454
+ t[a] = this.shape[a];
2455
+ else {
2456
+ let s = this.shape[a];
2457
+ for (; s instanceof Z; )
2458
+ s = s._def.innerType;
2459
+ t[a] = s;
2460
+ }
2461
+ }), new x({
2462
+ ...this._def,
2463
+ shape: () => t
2464
+ });
2465
+ }
2466
+ keyof() {
2467
+ return mt(_.objectKeys(this.shape));
2468
+ }
2469
+ }
2470
+ x.create = (n, e) => new x({
2471
+ shape: () => n,
2472
+ unknownKeys: "strip",
2473
+ catchall: P.create(),
2474
+ typeName: y.ZodObject,
2475
+ ...g(e)
2476
+ });
2477
+ x.strictCreate = (n, e) => new x({
2478
+ shape: () => n,
2479
+ unknownKeys: "strict",
2480
+ catchall: P.create(),
2481
+ typeName: y.ZodObject,
2482
+ ...g(e)
2483
+ });
2484
+ x.lazycreate = (n, e) => new x({
2485
+ shape: n,
2486
+ unknownKeys: "strip",
2487
+ catchall: P.create(),
2488
+ typeName: y.ZodObject,
2489
+ ...g(e)
2490
+ });
2491
+ class le extends v {
2492
+ _parse(e) {
2493
+ const { ctx: t } = this._processInputParams(e), a = this._def.options;
2494
+ function r(s) {
2495
+ for (const o of s)
2496
+ if (o.result.status === "valid")
2497
+ return o.result;
2498
+ for (const o of s)
2499
+ if (o.result.status === "dirty")
2500
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
2501
+ const i = s.map((o) => new A(o.ctx.common.issues));
2502
+ return l(t, {
2503
+ code: d.invalid_union,
2504
+ unionErrors: i
2505
+ }), b;
2506
+ }
2507
+ if (t.common.async)
2508
+ return Promise.all(a.map(async (s) => {
2509
+ const i = {
2510
+ ...t,
2511
+ common: {
2512
+ ...t.common,
2513
+ issues: []
2514
+ },
2515
+ parent: null
2516
+ };
2517
+ return {
2518
+ result: await s._parseAsync({
2519
+ data: t.data,
2520
+ path: t.path,
2521
+ parent: i
2522
+ }),
2523
+ ctx: i
2524
+ };
2525
+ })).then(r);
2526
+ {
2527
+ let s;
2528
+ const i = [];
2529
+ for (const u of a) {
2530
+ const c = {
2531
+ ...t,
2532
+ common: {
2533
+ ...t.common,
2534
+ issues: []
2535
+ },
2536
+ parent: null
2537
+ }, m = u._parseSync({
2538
+ data: t.data,
2539
+ path: t.path,
2540
+ parent: c
2541
+ });
2542
+ if (m.status === "valid")
2543
+ return m;
2544
+ m.status === "dirty" && !s && (s = { result: m, ctx: c }), c.common.issues.length && i.push(c.common.issues);
2545
+ }
2546
+ if (s)
2547
+ return t.common.issues.push(...s.ctx.common.issues), s.result;
2548
+ const o = i.map((u) => new A(u));
2549
+ return l(t, {
2550
+ code: d.invalid_union,
2551
+ unionErrors: o
2552
+ }), b;
2553
+ }
2554
+ }
2555
+ get options() {
2556
+ return this._def.options;
2557
+ }
2558
+ }
2559
+ le.create = (n, e) => new le({
2560
+ options: n,
2561
+ typeName: y.ZodUnion,
2562
+ ...g(e)
2563
+ });
2564
+ const $ = (n) => n instanceof pe ? $(n.schema) : n instanceof R ? $(n.innerType()) : n instanceof me ? [n.value] : n instanceof U ? n.options : n instanceof ye ? _.objectValues(n.enum) : n instanceof be ? $(n._def.innerType) : n instanceof de ? [void 0] : n instanceof ue ? [null] : n instanceof Z ? [void 0, ...$(n.unwrap())] : n instanceof W ? [null, ...$(n.unwrap())] : n instanceof He || n instanceof ve ? $(n.unwrap()) : n instanceof ge ? $(n._def.innerType) : [];
2565
+ class Ne extends v {
2566
+ _parse(e) {
2567
+ const { ctx: t } = this._processInputParams(e);
2568
+ if (t.parsedType !== f.object)
2569
+ return l(t, {
2570
+ code: d.invalid_type,
2571
+ expected: f.object,
2572
+ received: t.parsedType
2573
+ }), b;
2574
+ const a = this.discriminator, r = t.data[a], s = this.optionsMap.get(r);
2575
+ return s ? t.common.async ? s._parseAsync({
2576
+ data: t.data,
2577
+ path: t.path,
2578
+ parent: t
2579
+ }) : s._parseSync({
2580
+ data: t.data,
2581
+ path: t.path,
2582
+ parent: t
2583
+ }) : (l(t, {
2584
+ code: d.invalid_union_discriminator,
2585
+ options: Array.from(this.optionsMap.keys()),
2586
+ path: [a]
2587
+ }), b);
2588
+ }
2589
+ get discriminator() {
2590
+ return this._def.discriminator;
2591
+ }
2592
+ get options() {
2593
+ return this._def.options;
2594
+ }
2595
+ get optionsMap() {
2596
+ return this._def.optionsMap;
2597
+ }
2598
+ /**
2599
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2600
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2601
+ * have a different value for each object in the union.
2602
+ * @param discriminator the name of the discriminator property
2603
+ * @param types an array of object schemas
2604
+ * @param params
2605
+ */
2606
+ static create(e, t, a) {
2607
+ const r = /* @__PURE__ */ new Map();
2608
+ for (const s of t) {
2609
+ const i = $(s.shape[e]);
2610
+ if (!i.length)
2611
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
2612
+ for (const o of i) {
2613
+ if (r.has(o))
2614
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
2615
+ r.set(o, s);
2616
+ }
2617
+ }
2618
+ return new Ne({
2619
+ typeName: y.ZodDiscriminatedUnion,
2620
+ discriminator: e,
2621
+ options: t,
2622
+ optionsMap: r,
2623
+ ...g(a)
2624
+ });
2625
+ }
2626
+ }
2627
+ function Be(n, e) {
2628
+ const t = B(n), a = B(e);
2629
+ if (n === e)
2630
+ return { valid: !0, data: n };
2631
+ if (t === f.object && a === f.object) {
2632
+ const r = _.objectKeys(e), s = _.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i = { ...n, ...e };
2633
+ for (const o of s) {
2634
+ const u = Be(n[o], e[o]);
2635
+ if (!u.valid)
2636
+ return { valid: !1 };
2637
+ i[o] = u.data;
2638
+ }
2639
+ return { valid: !0, data: i };
2640
+ } else if (t === f.array && a === f.array) {
2641
+ if (n.length !== e.length)
2642
+ return { valid: !1 };
2643
+ const r = [];
2644
+ for (let s = 0; s < n.length; s++) {
2645
+ const i = n[s], o = e[s], u = Be(i, o);
2646
+ if (!u.valid)
2647
+ return { valid: !1 };
2648
+ r.push(u.data);
2649
+ }
2650
+ return { valid: !0, data: r };
2651
+ } else return t === f.date && a === f.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
2652
+ }
2653
+ class fe extends v {
2654
+ _parse(e) {
2655
+ const { status: t, ctx: a } = this._processInputParams(e), r = (s, i) => {
2656
+ if (De(s) || De(i))
2657
+ return b;
2658
+ const o = Be(s.value, i.value);
2659
+ return o.valid ? ((Ve(s) || Ve(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(a, {
2660
+ code: d.invalid_intersection_types
2661
+ }), b);
2662
+ };
2663
+ return a.common.async ? Promise.all([
2664
+ this._def.left._parseAsync({
2665
+ data: a.data,
2666
+ path: a.path,
2667
+ parent: a
2668
+ }),
2669
+ this._def.right._parseAsync({
2670
+ data: a.data,
2671
+ path: a.path,
2672
+ parent: a
2673
+ })
2674
+ ]).then(([s, i]) => r(s, i)) : r(this._def.left._parseSync({
2675
+ data: a.data,
2676
+ path: a.path,
2677
+ parent: a
2678
+ }), this._def.right._parseSync({
2679
+ data: a.data,
2680
+ path: a.path,
2681
+ parent: a
2682
+ }));
2683
+ }
2684
+ }
2685
+ fe.create = (n, e, t) => new fe({
2686
+ left: n,
2687
+ right: e,
2688
+ typeName: y.ZodIntersection,
2689
+ ...g(t)
2690
+ });
2691
+ class M extends v {
2692
+ _parse(e) {
2693
+ const { status: t, ctx: a } = this._processInputParams(e);
2694
+ if (a.parsedType !== f.array)
2695
+ return l(a, {
2696
+ code: d.invalid_type,
2697
+ expected: f.array,
2698
+ received: a.parsedType
2699
+ }), b;
2700
+ if (a.data.length < this._def.items.length)
2701
+ return l(a, {
2702
+ code: d.too_small,
2703
+ minimum: this._def.items.length,
2704
+ inclusive: !0,
2705
+ exact: !1,
2706
+ type: "array"
2707
+ }), b;
2708
+ !this._def.rest && a.data.length > this._def.items.length && (l(a, {
2709
+ code: d.too_big,
2710
+ maximum: this._def.items.length,
2711
+ inclusive: !0,
2712
+ exact: !1,
2713
+ type: "array"
2714
+ }), t.dirty());
2715
+ const s = [...a.data].map((i, o) => {
2716
+ const u = this._def.items[o] || this._def.rest;
2717
+ return u ? u._parse(new j(a, i, a.path, o)) : null;
2718
+ }).filter((i) => !!i);
2719
+ return a.common.async ? Promise.all(s).then((i) => S.mergeArray(t, i)) : S.mergeArray(t, s);
2720
+ }
2721
+ get items() {
2722
+ return this._def.items;
2723
+ }
2724
+ rest(e) {
2725
+ return new M({
2726
+ ...this._def,
2727
+ rest: e
2728
+ });
2729
+ }
2730
+ }
2731
+ M.create = (n, e) => {
2732
+ if (!Array.isArray(n))
2733
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2734
+ return new M({
2735
+ items: n,
2736
+ typeName: y.ZodTuple,
2737
+ rest: null,
2738
+ ...g(e)
2739
+ });
2740
+ };
2741
+ class he extends v {
2742
+ get keySchema() {
2743
+ return this._def.keyType;
2744
+ }
2745
+ get valueSchema() {
2746
+ return this._def.valueType;
2747
+ }
2748
+ _parse(e) {
2749
+ const { status: t, ctx: a } = this._processInputParams(e);
2750
+ if (a.parsedType !== f.object)
2751
+ return l(a, {
2752
+ code: d.invalid_type,
2753
+ expected: f.object,
2754
+ received: a.parsedType
2755
+ }), b;
2756
+ const r = [], s = this._def.keyType, i = this._def.valueType;
2757
+ for (const o in a.data)
2758
+ r.push({
2759
+ key: s._parse(new j(a, o, a.path, o)),
2760
+ value: i._parse(new j(a, a.data[o], a.path, o)),
2761
+ alwaysSet: o in a.data
2762
+ });
2763
+ return a.common.async ? S.mergeObjectAsync(t, r) : S.mergeObjectSync(t, r);
2764
+ }
2765
+ get element() {
2766
+ return this._def.valueType;
2767
+ }
2768
+ static create(e, t, a) {
2769
+ return t instanceof v ? new he({
2770
+ keyType: e,
2771
+ valueType: t,
2772
+ typeName: y.ZodRecord,
2773
+ ...g(a)
2774
+ }) : new he({
2775
+ keyType: N.create(),
2776
+ valueType: e,
2777
+ typeName: y.ZodRecord,
2778
+ ...g(t)
2779
+ });
2780
+ }
2781
+ }
2782
+ class Ie extends v {
2783
+ get keySchema() {
2784
+ return this._def.keyType;
2785
+ }
2786
+ get valueSchema() {
2787
+ return this._def.valueType;
2788
+ }
2789
+ _parse(e) {
2790
+ const { status: t, ctx: a } = this._processInputParams(e);
2791
+ if (a.parsedType !== f.map)
2792
+ return l(a, {
2793
+ code: d.invalid_type,
2794
+ expected: f.map,
2795
+ received: a.parsedType
2796
+ }), b;
2797
+ const r = this._def.keyType, s = this._def.valueType, i = [...a.data.entries()].map(([o, u], c) => ({
2798
+ key: r._parse(new j(a, o, a.path, [c, "key"])),
2799
+ value: s._parse(new j(a, u, a.path, [c, "value"]))
2800
+ }));
2801
+ if (a.common.async) {
2802
+ const o = /* @__PURE__ */ new Map();
2803
+ return Promise.resolve().then(async () => {
2804
+ for (const u of i) {
2805
+ const c = await u.key, m = await u.value;
2806
+ if (c.status === "aborted" || m.status === "aborted")
2807
+ return b;
2808
+ (c.status === "dirty" || m.status === "dirty") && t.dirty(), o.set(c.value, m.value);
2809
+ }
2810
+ return { status: t.value, value: o };
2811
+ });
2812
+ } else {
2813
+ const o = /* @__PURE__ */ new Map();
2814
+ for (const u of i) {
2815
+ const c = u.key, m = u.value;
2816
+ if (c.status === "aborted" || m.status === "aborted")
2817
+ return b;
2818
+ (c.status === "dirty" || m.status === "dirty") && t.dirty(), o.set(c.value, m.value);
2819
+ }
2820
+ return { status: t.value, value: o };
2821
+ }
2822
+ }
2823
+ }
2824
+ Ie.create = (n, e, t) => new Ie({
2825
+ valueType: e,
2826
+ keyType: n,
2827
+ typeName: y.ZodMap,
2828
+ ...g(t)
2829
+ });
2830
+ class Y extends v {
2831
+ _parse(e) {
2832
+ const { status: t, ctx: a } = this._processInputParams(e);
2833
+ if (a.parsedType !== f.set)
2834
+ return l(a, {
2835
+ code: d.invalid_type,
2836
+ expected: f.set,
2837
+ received: a.parsedType
2838
+ }), b;
2839
+ const r = this._def;
2840
+ r.minSize !== null && a.data.size < r.minSize.value && (l(a, {
2841
+ code: d.too_small,
2842
+ minimum: r.minSize.value,
2843
+ type: "set",
2844
+ inclusive: !0,
2845
+ exact: !1,
2846
+ message: r.minSize.message
2847
+ }), t.dirty()), r.maxSize !== null && a.data.size > r.maxSize.value && (l(a, {
2848
+ code: d.too_big,
2849
+ maximum: r.maxSize.value,
2850
+ type: "set",
2851
+ inclusive: !0,
2852
+ exact: !1,
2853
+ message: r.maxSize.message
2854
+ }), t.dirty());
2855
+ const s = this._def.valueType;
2856
+ function i(u) {
2857
+ const c = /* @__PURE__ */ new Set();
2858
+ for (const m of u) {
2859
+ if (m.status === "aborted")
2860
+ return b;
2861
+ m.status === "dirty" && t.dirty(), c.add(m.value);
2862
+ }
2863
+ return { status: t.value, value: c };
2864
+ }
2865
+ const o = [...a.data.values()].map((u, c) => s._parse(new j(a, u, a.path, c)));
2866
+ return a.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
2867
+ }
2868
+ min(e, t) {
2869
+ return new Y({
2870
+ ...this._def,
2871
+ minSize: { value: e, message: p.toString(t) }
2872
+ });
2873
+ }
2874
+ max(e, t) {
2875
+ return new Y({
2876
+ ...this._def,
2877
+ maxSize: { value: e, message: p.toString(t) }
2878
+ });
2879
+ }
2880
+ size(e, t) {
2881
+ return this.min(e, t).max(e, t);
2882
+ }
2883
+ nonempty(e) {
2884
+ return this.min(1, e);
2885
+ }
2886
+ }
2887
+ Y.create = (n, e) => new Y({
2888
+ valueType: n,
2889
+ minSize: null,
2890
+ maxSize: null,
2891
+ typeName: y.ZodSet,
2892
+ ...g(e)
2893
+ });
2894
+ class X extends v {
2895
+ constructor() {
2896
+ super(...arguments), this.validate = this.implement;
2897
+ }
2898
+ _parse(e) {
2899
+ const { ctx: t } = this._processInputParams(e);
2900
+ if (t.parsedType !== f.function)
2901
+ return l(t, {
2902
+ code: d.invalid_type,
2903
+ expected: f.function,
2904
+ received: t.parsedType
2905
+ }), b;
2906
+ function a(o, u) {
2907
+ return ke({
2908
+ data: o,
2909
+ path: t.path,
2910
+ errorMaps: [
2911
+ t.common.contextualErrorMap,
2912
+ t.schemaErrorMap,
2913
+ we(),
2914
+ ee
2915
+ ].filter((c) => !!c),
2916
+ issueData: {
2917
+ code: d.invalid_arguments,
2918
+ argumentsError: u
2919
+ }
2920
+ });
2921
+ }
2922
+ function r(o, u) {
2923
+ return ke({
2924
+ data: o,
2925
+ path: t.path,
2926
+ errorMaps: [
2927
+ t.common.contextualErrorMap,
2928
+ t.schemaErrorMap,
2929
+ we(),
2930
+ ee
2931
+ ].filter((c) => !!c),
2932
+ issueData: {
2933
+ code: d.invalid_return_type,
2934
+ returnTypeError: u
2935
+ }
2936
+ });
2937
+ }
2938
+ const s = { errorMap: t.common.contextualErrorMap }, i = t.data;
2939
+ if (this._def.returns instanceof ne) {
2940
+ const o = this;
2941
+ return I(async function(...u) {
2942
+ const c = new A([]), m = await o._def.args.parseAsync(u, s).catch((E) => {
2943
+ throw c.addIssue(a(u, E)), c;
2944
+ }), C = await Reflect.apply(i, this, m);
2945
+ return await o._def.returns._def.type.parseAsync(C, s).catch((E) => {
2946
+ throw c.addIssue(r(C, E)), c;
2947
+ });
2948
+ });
2949
+ } else {
2950
+ const o = this;
2951
+ return I(function(...u) {
2952
+ const c = o._def.args.safeParse(u, s);
2953
+ if (!c.success)
2954
+ throw new A([a(u, c.error)]);
2955
+ const m = Reflect.apply(i, this, c.data), C = o._def.returns.safeParse(m, s);
2956
+ if (!C.success)
2957
+ throw new A([r(m, C.error)]);
2958
+ return C.data;
2959
+ });
2960
+ }
2961
+ }
2962
+ parameters() {
2963
+ return this._def.args;
2964
+ }
2965
+ returnType() {
2966
+ return this._def.returns;
2967
+ }
2968
+ args(...e) {
2969
+ return new X({
2970
+ ...this._def,
2971
+ args: M.create(e).rest(H.create())
2972
+ });
2973
+ }
2974
+ returns(e) {
2975
+ return new X({
2976
+ ...this._def,
2977
+ returns: e
2978
+ });
2979
+ }
2980
+ implement(e) {
2981
+ return this.parse(e);
2982
+ }
2983
+ strictImplement(e) {
2984
+ return this.parse(e);
2985
+ }
2986
+ static create(e, t, a) {
2987
+ return new X({
2988
+ args: e || M.create([]).rest(H.create()),
2989
+ returns: t || H.create(),
2990
+ typeName: y.ZodFunction,
2991
+ ...g(a)
2992
+ });
2993
+ }
2994
+ }
2995
+ class pe extends v {
2996
+ get schema() {
2997
+ return this._def.getter();
2998
+ }
2999
+ _parse(e) {
3000
+ const { ctx: t } = this._processInputParams(e);
3001
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
3002
+ }
3003
+ }
3004
+ pe.create = (n, e) => new pe({
3005
+ getter: n,
3006
+ typeName: y.ZodLazy,
3007
+ ...g(e)
3008
+ });
3009
+ class me extends v {
3010
+ _parse(e) {
3011
+ if (e.data !== this._def.value) {
3012
+ const t = this._getOrReturnCtx(e);
3013
+ return l(t, {
3014
+ received: t.data,
3015
+ code: d.invalid_literal,
3016
+ expected: this._def.value
3017
+ }), b;
3018
+ }
3019
+ return { status: "valid", value: e.data };
3020
+ }
3021
+ get value() {
3022
+ return this._def.value;
3023
+ }
3024
+ }
3025
+ me.create = (n, e) => new me({
3026
+ value: n,
3027
+ typeName: y.ZodLiteral,
3028
+ ...g(e)
3029
+ });
3030
+ function mt(n, e) {
3031
+ return new U({
3032
+ values: n,
3033
+ typeName: y.ZodEnum,
3034
+ ...g(e)
3035
+ });
3036
+ }
3037
+ class U extends v {
3038
+ constructor() {
3039
+ super(...arguments), ae.set(this, void 0);
3040
+ }
3041
+ _parse(e) {
3042
+ if (typeof e.data != "string") {
3043
+ const t = this._getOrReturnCtx(e), a = this._def.values;
3044
+ return l(t, {
3045
+ expected: _.joinValues(a),
3046
+ received: t.parsedType,
3047
+ code: d.invalid_type
3048
+ }), b;
3049
+ }
3050
+ if (Te(this, ae) || lt(this, ae, new Set(this._def.values)), !Te(this, ae).has(e.data)) {
3051
+ const t = this._getOrReturnCtx(e), a = this._def.values;
3052
+ return l(t, {
3053
+ received: t.data,
3054
+ code: d.invalid_enum_value,
3055
+ options: a
3056
+ }), b;
3057
+ }
3058
+ return I(e.data);
3059
+ }
3060
+ get options() {
3061
+ return this._def.values;
3062
+ }
3063
+ get enum() {
3064
+ const e = {};
3065
+ for (const t of this._def.values)
3066
+ e[t] = t;
3067
+ return e;
3068
+ }
3069
+ get Values() {
3070
+ const e = {};
3071
+ for (const t of this._def.values)
3072
+ e[t] = t;
3073
+ return e;
3074
+ }
3075
+ get Enum() {
3076
+ const e = {};
3077
+ for (const t of this._def.values)
3078
+ e[t] = t;
3079
+ return e;
3080
+ }
3081
+ extract(e, t = this._def) {
3082
+ return U.create(e, {
3083
+ ...this._def,
3084
+ ...t
3085
+ });
3086
+ }
3087
+ exclude(e, t = this._def) {
3088
+ return U.create(this.options.filter((a) => !e.includes(a)), {
3089
+ ...this._def,
3090
+ ...t
3091
+ });
3092
+ }
3093
+ }
3094
+ ae = /* @__PURE__ */ new WeakMap();
3095
+ U.create = mt;
3096
+ class ye extends v {
3097
+ constructor() {
3098
+ super(...arguments), re.set(this, void 0);
3099
+ }
3100
+ _parse(e) {
3101
+ const t = _.getValidEnumValues(this._def.values), a = this._getOrReturnCtx(e);
3102
+ if (a.parsedType !== f.string && a.parsedType !== f.number) {
3103
+ const r = _.objectValues(t);
3104
+ return l(a, {
3105
+ expected: _.joinValues(r),
3106
+ received: a.parsedType,
3107
+ code: d.invalid_type
3108
+ }), b;
3109
+ }
3110
+ if (Te(this, re) || lt(this, re, new Set(_.getValidEnumValues(this._def.values))), !Te(this, re).has(e.data)) {
3111
+ const r = _.objectValues(t);
3112
+ return l(a, {
3113
+ received: a.data,
3114
+ code: d.invalid_enum_value,
3115
+ options: r
3116
+ }), b;
3117
+ }
3118
+ return I(e.data);
3119
+ }
3120
+ get enum() {
3121
+ return this._def.values;
3122
+ }
3123
+ }
3124
+ re = /* @__PURE__ */ new WeakMap();
3125
+ ye.create = (n, e) => new ye({
3126
+ values: n,
3127
+ typeName: y.ZodNativeEnum,
3128
+ ...g(e)
3129
+ });
3130
+ class ne extends v {
3131
+ unwrap() {
3132
+ return this._def.type;
3133
+ }
3134
+ _parse(e) {
3135
+ const { ctx: t } = this._processInputParams(e);
3136
+ if (t.parsedType !== f.promise && t.common.async === !1)
3137
+ return l(t, {
3138
+ code: d.invalid_type,
3139
+ expected: f.promise,
3140
+ received: t.parsedType
3141
+ }), b;
3142
+ const a = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
3143
+ return I(a.then((r) => this._def.type.parseAsync(r, {
3144
+ path: t.path,
3145
+ errorMap: t.common.contextualErrorMap
3146
+ })));
3147
+ }
3148
+ }
3149
+ ne.create = (n, e) => new ne({
3150
+ type: n,
3151
+ typeName: y.ZodPromise,
3152
+ ...g(e)
3153
+ });
3154
+ class R extends v {
3155
+ innerType() {
3156
+ return this._def.schema;
3157
+ }
3158
+ sourceType() {
3159
+ return this._def.schema._def.typeName === y.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
3160
+ }
3161
+ _parse(e) {
3162
+ const { status: t, ctx: a } = this._processInputParams(e), r = this._def.effect || null, s = {
3163
+ addIssue: (i) => {
3164
+ l(a, i), i.fatal ? t.abort() : t.dirty();
3165
+ },
3166
+ get path() {
3167
+ return a.path;
3168
+ }
3169
+ };
3170
+ if (s.addIssue = s.addIssue.bind(s), r.type === "preprocess") {
3171
+ const i = r.transform(a.data, s);
3172
+ if (a.common.async)
3173
+ return Promise.resolve(i).then(async (o) => {
3174
+ if (t.value === "aborted")
3175
+ return b;
3176
+ const u = await this._def.schema._parseAsync({
3177
+ data: o,
3178
+ path: a.path,
3179
+ parent: a
3180
+ });
3181
+ return u.status === "aborted" ? b : u.status === "dirty" || t.value === "dirty" ? K(u.value) : u;
3182
+ });
3183
+ {
3184
+ if (t.value === "aborted")
3185
+ return b;
3186
+ const o = this._def.schema._parseSync({
3187
+ data: i,
3188
+ path: a.path,
3189
+ parent: a
3190
+ });
3191
+ return o.status === "aborted" ? b : o.status === "dirty" || t.value === "dirty" ? K(o.value) : o;
3192
+ }
3193
+ }
3194
+ if (r.type === "refinement") {
3195
+ const i = (o) => {
3196
+ const u = r.refinement(o, s);
3197
+ if (a.common.async)
3198
+ return Promise.resolve(u);
3199
+ if (u instanceof Promise)
3200
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3201
+ return o;
3202
+ };
3203
+ if (a.common.async === !1) {
3204
+ const o = this._def.schema._parseSync({
3205
+ data: a.data,
3206
+ path: a.path,
3207
+ parent: a
3208
+ });
3209
+ return o.status === "aborted" ? b : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
3210
+ } else
3211
+ return this._def.schema._parseAsync({ data: a.data, path: a.path, parent: a }).then((o) => o.status === "aborted" ? b : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
3212
+ }
3213
+ if (r.type === "transform")
3214
+ if (a.common.async === !1) {
3215
+ const i = this._def.schema._parseSync({
3216
+ data: a.data,
3217
+ path: a.path,
3218
+ parent: a
3219
+ });
3220
+ if (!ie(i))
3221
+ return i;
3222
+ const o = r.transform(i.value, s);
3223
+ if (o instanceof Promise)
3224
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
3225
+ return { status: t.value, value: o };
3226
+ } else
3227
+ return this._def.schema._parseAsync({ data: a.data, path: a.path, parent: a }).then((i) => ie(i) ? Promise.resolve(r.transform(i.value, s)).then((o) => ({ status: t.value, value: o })) : i);
3228
+ _.assertNever(r);
3229
+ }
3230
+ }
3231
+ R.create = (n, e, t) => new R({
3232
+ schema: n,
3233
+ typeName: y.ZodEffects,
3234
+ effect: e,
3235
+ ...g(t)
3236
+ });
3237
+ R.createWithPreprocess = (n, e, t) => new R({
3238
+ schema: e,
3239
+ effect: { type: "preprocess", transform: n },
3240
+ typeName: y.ZodEffects,
3241
+ ...g(t)
3242
+ });
3243
+ class Z extends v {
3244
+ _parse(e) {
3245
+ return this._getType(e) === f.undefined ? I(void 0) : this._def.innerType._parse(e);
3246
+ }
3247
+ unwrap() {
3248
+ return this._def.innerType;
3249
+ }
3250
+ }
3251
+ Z.create = (n, e) => new Z({
3252
+ innerType: n,
3253
+ typeName: y.ZodOptional,
3254
+ ...g(e)
3255
+ });
3256
+ class W extends v {
3257
+ _parse(e) {
3258
+ return this._getType(e) === f.null ? I(null) : this._def.innerType._parse(e);
3259
+ }
3260
+ unwrap() {
3261
+ return this._def.innerType;
3262
+ }
3263
+ }
3264
+ W.create = (n, e) => new W({
3265
+ innerType: n,
3266
+ typeName: y.ZodNullable,
3267
+ ...g(e)
3268
+ });
3269
+ class be extends v {
3270
+ _parse(e) {
3271
+ const { ctx: t } = this._processInputParams(e);
3272
+ let a = t.data;
3273
+ return t.parsedType === f.undefined && (a = this._def.defaultValue()), this._def.innerType._parse({
3274
+ data: a,
3275
+ path: t.path,
3276
+ parent: t
3277
+ });
3278
+ }
3279
+ removeDefault() {
3280
+ return this._def.innerType;
3281
+ }
3282
+ }
3283
+ be.create = (n, e) => new be({
3284
+ innerType: n,
3285
+ typeName: y.ZodDefault,
3286
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
3287
+ ...g(e)
3288
+ });
3289
+ class ge extends v {
3290
+ _parse(e) {
3291
+ const { ctx: t } = this._processInputParams(e), a = {
3292
+ ...t,
3293
+ common: {
3294
+ ...t.common,
3295
+ issues: []
3296
+ }
3297
+ }, r = this._def.innerType._parse({
3298
+ data: a.data,
3299
+ path: a.path,
3300
+ parent: {
3301
+ ...a
3302
+ }
3303
+ });
3304
+ return oe(r) ? r.then((s) => ({
3305
+ status: "valid",
3306
+ value: s.status === "valid" ? s.value : this._def.catchValue({
3307
+ get error() {
3308
+ return new A(a.common.issues);
3309
+ },
3310
+ input: a.data
3311
+ })
3312
+ })) : {
3313
+ status: "valid",
3314
+ value: r.status === "valid" ? r.value : this._def.catchValue({
3315
+ get error() {
3316
+ return new A(a.common.issues);
3317
+ },
3318
+ input: a.data
3319
+ })
3320
+ };
3321
+ }
3322
+ removeCatch() {
3323
+ return this._def.innerType;
3324
+ }
3325
+ }
3326
+ ge.create = (n, e) => new ge({
3327
+ innerType: n,
3328
+ typeName: y.ZodCatch,
3329
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
3330
+ ...g(e)
3331
+ });
3332
+ class Ee extends v {
3333
+ _parse(e) {
3334
+ if (this._getType(e) !== f.nan) {
3335
+ const a = this._getOrReturnCtx(e);
3336
+ return l(a, {
3337
+ code: d.invalid_type,
3338
+ expected: f.nan,
3339
+ received: a.parsedType
3340
+ }), b;
3341
+ }
3342
+ return { status: "valid", value: e.data };
3343
+ }
3344
+ }
3345
+ Ee.create = (n) => new Ee({
3346
+ typeName: y.ZodNaN,
3347
+ ...g(n)
3348
+ });
3349
+ const Nn = Symbol("zod_brand");
3350
+ class He extends v {
3351
+ _parse(e) {
3352
+ const { ctx: t } = this._processInputParams(e), a = t.data;
3353
+ return this._def.type._parse({
3354
+ data: a,
3355
+ path: t.path,
3356
+ parent: t
3357
+ });
3358
+ }
3359
+ unwrap() {
3360
+ return this._def.type;
3361
+ }
3362
+ }
3363
+ class _e extends v {
3364
+ _parse(e) {
3365
+ const { status: t, ctx: a } = this._processInputParams(e);
3366
+ if (a.common.async)
3367
+ return (async () => {
3368
+ const s = await this._def.in._parseAsync({
3369
+ data: a.data,
3370
+ path: a.path,
3371
+ parent: a
3372
+ });
3373
+ return s.status === "aborted" ? b : s.status === "dirty" ? (t.dirty(), K(s.value)) : this._def.out._parseAsync({
3374
+ data: s.value,
3375
+ path: a.path,
3376
+ parent: a
3377
+ });
3378
+ })();
3379
+ {
3380
+ const r = this._def.in._parseSync({
3381
+ data: a.data,
3382
+ path: a.path,
3383
+ parent: a
3384
+ });
3385
+ return r.status === "aborted" ? b : r.status === "dirty" ? (t.dirty(), {
3386
+ status: "dirty",
3387
+ value: r.value
3388
+ }) : this._def.out._parseSync({
3389
+ data: r.value,
3390
+ path: a.path,
3391
+ parent: a
3392
+ });
3393
+ }
3394
+ }
3395
+ static create(e, t) {
3396
+ return new _e({
3397
+ in: e,
3398
+ out: t,
3399
+ typeName: y.ZodPipeline
3400
+ });
3401
+ }
3402
+ }
3403
+ class ve extends v {
3404
+ _parse(e) {
3405
+ const t = this._def.innerType._parse(e), a = (r) => (ie(r) && (r.value = Object.freeze(r.value)), r);
3406
+ return oe(t) ? t.then((r) => a(r)) : a(t);
3407
+ }
3408
+ unwrap() {
3409
+ return this._def.innerType;
3410
+ }
3411
+ }
3412
+ ve.create = (n, e) => new ve({
3413
+ innerType: n,
3414
+ typeName: y.ZodReadonly,
3415
+ ...g(e)
3416
+ });
3417
+ function yt(n, e = {}, t) {
3418
+ return n ? te.create().superRefine((a, r) => {
3419
+ var s, i;
3420
+ if (!n(a)) {
3421
+ const o = typeof e == "function" ? e(a) : typeof e == "string" ? { message: e } : e, u = (i = (s = o.fatal) !== null && s !== void 0 ? s : t) !== null && i !== void 0 ? i : !0, c = typeof o == "string" ? { message: o } : o;
3422
+ r.addIssue({ code: "custom", ...c, fatal: u });
3423
+ }
3424
+ }) : te.create();
3425
+ }
3426
+ const On = {
3427
+ object: x.lazycreate
3428
+ };
3429
+ var y;
3430
+ (function(n) {
3431
+ n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
3432
+ })(y || (y = {}));
3433
+ const Rn = (n, e = {
3434
+ message: `Input not instance of ${n.name}`
3435
+ }) => yt((t) => t instanceof n, e), bt = N.create, gt = L.create, Zn = Ee.create, jn = z.create, vt = ce.create, Mn = J.create, $n = Ce.create, Pn = de.create, Dn = ue.create, Vn = te.create, Bn = H.create, Ln = P.create, zn = Se.create, Un = O.create, Wn = x.create, qn = x.strictCreate, Hn = le.create, Fn = Ne.create, Jn = fe.create, Yn = M.create, Gn = he.create, Qn = Ie.create, Kn = Y.create, Xn = X.create, ea = pe.create, ta = me.create, na = U.create, aa = ye.create, ra = ne.create, et = R.create, sa = Z.create, ia = W.create, oa = R.createWithPreprocess, ca = _e.create, da = () => bt().optional(), ua = () => gt().optional(), la = () => vt().optional(), fa = {
3436
+ string: (n) => N.create({ ...n, coerce: !0 }),
3437
+ number: (n) => L.create({ ...n, coerce: !0 }),
3438
+ boolean: (n) => ce.create({
3439
+ ...n,
3440
+ coerce: !0
3441
+ }),
3442
+ bigint: (n) => z.create({ ...n, coerce: !0 }),
3443
+ date: (n) => J.create({ ...n, coerce: !0 })
3444
+ }, ha = b;
3445
+ var h = /* @__PURE__ */ Object.freeze({
3446
+ __proto__: null,
3447
+ defaultErrorMap: ee,
3448
+ setErrorMap: hn,
3449
+ getErrorMap: we,
3450
+ makeIssue: ke,
3451
+ EMPTY_PATH: pn,
3452
+ addIssueToContext: l,
3453
+ ParseStatus: S,
3454
+ INVALID: b,
3455
+ DIRTY: K,
3456
+ OK: I,
3457
+ isAborted: De,
3458
+ isDirty: Ve,
3459
+ isValid: ie,
3460
+ isAsync: oe,
3461
+ get util() {
3462
+ return _;
3463
+ },
3464
+ get objectUtil() {
3465
+ return Pe;
3466
+ },
3467
+ ZodParsedType: f,
3468
+ getParsedType: B,
3469
+ ZodType: v,
3470
+ datetimeRegex: pt,
3471
+ ZodString: N,
3472
+ ZodNumber: L,
3473
+ ZodBigInt: z,
3474
+ ZodBoolean: ce,
3475
+ ZodDate: J,
3476
+ ZodSymbol: Ce,
3477
+ ZodUndefined: de,
3478
+ ZodNull: ue,
3479
+ ZodAny: te,
3480
+ ZodUnknown: H,
3481
+ ZodNever: P,
3482
+ ZodVoid: Se,
3483
+ ZodArray: O,
3484
+ ZodObject: x,
3485
+ ZodUnion: le,
3486
+ ZodDiscriminatedUnion: Ne,
3487
+ ZodIntersection: fe,
3488
+ ZodTuple: M,
3489
+ ZodRecord: he,
3490
+ ZodMap: Ie,
3491
+ ZodSet: Y,
3492
+ ZodFunction: X,
3493
+ ZodLazy: pe,
3494
+ ZodLiteral: me,
3495
+ ZodEnum: U,
3496
+ ZodNativeEnum: ye,
3497
+ ZodPromise: ne,
3498
+ ZodEffects: R,
3499
+ ZodTransformer: R,
3500
+ ZodOptional: Z,
3501
+ ZodNullable: W,
3502
+ ZodDefault: be,
3503
+ ZodCatch: ge,
3504
+ ZodNaN: Ee,
3505
+ BRAND: Nn,
3506
+ ZodBranded: He,
3507
+ ZodPipeline: _e,
3508
+ ZodReadonly: ve,
3509
+ custom: yt,
3510
+ Schema: v,
3511
+ ZodSchema: v,
3512
+ late: On,
3513
+ get ZodFirstPartyTypeKind() {
3514
+ return y;
3515
+ },
3516
+ coerce: fa,
3517
+ any: Vn,
3518
+ array: Un,
3519
+ bigint: jn,
3520
+ boolean: vt,
3521
+ date: Mn,
3522
+ discriminatedUnion: Fn,
3523
+ effect: et,
3524
+ enum: na,
3525
+ function: Xn,
3526
+ instanceof: Rn,
3527
+ intersection: Jn,
3528
+ lazy: ea,
3529
+ literal: ta,
3530
+ map: Qn,
3531
+ nan: Zn,
3532
+ nativeEnum: aa,
3533
+ never: Ln,
3534
+ null: Dn,
3535
+ nullable: ia,
3536
+ number: gt,
3537
+ object: Wn,
3538
+ oboolean: la,
3539
+ onumber: ua,
3540
+ optional: sa,
3541
+ ostring: da,
3542
+ pipeline: ca,
3543
+ preprocess: oa,
3544
+ promise: ra,
3545
+ record: Gn,
3546
+ set: Kn,
3547
+ strictObject: qn,
3548
+ string: bt,
3549
+ symbol: $n,
3550
+ transformer: et,
3551
+ tuple: Yn,
3552
+ undefined: Pn,
3553
+ union: Hn,
3554
+ unknown: Bn,
3555
+ void: zn,
3556
+ NEVER: ha,
3557
+ ZodIssueCode: d,
3558
+ quotelessJson: fn,
3559
+ ZodError: A
3560
+ });
3561
+ const pa = "test test test test test test test test test test test junk", Va = async function(e, t) {
3562
+ const a = t.privateKey, r = t.mnemonic ?? pa, s = t.chain || "anvil", [{ config: i, account: o }, u] = Ht({
3563
+ chain: s,
3564
+ rpcUrl: t.rpcUrl,
3565
+ privateKey: a,
3566
+ mnemonic: r
3567
+ }), c = u.id;
3568
+ if (e.at(0) === "generate")
3569
+ return ja({ account: o == null ? void 0 : o.address, chainId: c });
3570
+ if (e.at(0) === "erc20") {
3571
+ let T = new dt({ config: i, account: o }, {});
3572
+ return await T.deploy(), {
3573
+ erc20: T.assertValidAddress()
3574
+ };
3575
+ }
3576
+ const m = It[c];
3577
+ if (!m)
3578
+ throw new Error(
3579
+ `Unable to select a deployed BoostRegistry with chain ID ${c}`
3580
+ );
3581
+ const C = new Et({
3582
+ config: i,
3583
+ account: o,
3584
+ address: m
3585
+ }), G = At[c];
3586
+ if (!G)
3587
+ throw new Error(
3588
+ `Unable to select a deployed BoostCore with chain ID ${c}`
3589
+ );
3590
+ const E = new Nt({
3591
+ config: i,
3592
+ account: o,
3593
+ address: G
3594
+ });
3595
+ if (!e.length) throw new Error("No seed provided");
3596
+ const _t = await Promise.all(e.map(ma));
3597
+ let Oe, Je;
3598
+ const Ye = [];
3599
+ for (const T of _t) {
3600
+ let V;
3601
+ if (typeof T.budget == "string" && Le(T.budget))
3602
+ V = E.ManagedBudget(T.budget);
3603
+ else if (Me(Je, T.budget) && Oe)
3604
+ V = Oe;
3605
+ else {
3606
+ const k = {
3607
+ ...T.budget,
3608
+ authorized: [...T.budget.authorized, G],
3609
+ roles: [...T.budget.roles, at.MANAGER]
3610
+ };
3611
+ V = await C.initialize(
3612
+ crypto.randomUUID(),
3613
+ E.ManagedBudget(k)
3614
+ ), Oe = V, Je = T.budget;
3615
+ }
3616
+ const xt = T.incentives.map(async (k) => {
3617
+ let q = 0n;
3618
+ switch (k.type) {
3619
+ case "AllowListIncentive":
3620
+ return E.AllowListIncentive(k);
3621
+ case "ERC20Incentive":
3622
+ return k.strategy === je.RAFFLE && (q += k.reward), k.strategy === je.POOL && (q += k.reward * k.limit), k.shouldMintAndAllocate && await Ze(V, q, k.asset, {
3623
+ config: i,
3624
+ account: o
3625
+ }), E.ERC20Incentive(k);
3626
+ case "ERC20VariableCriteriaIncentive":
3627
+ return q += k.limit, k.shouldMintAndAllocate && await Ze(V, q, k.asset, {
3628
+ config: i,
3629
+ account: o
3630
+ }), E.ERC20VariableCriteriaIncentive(k);
3631
+ case "ERC20VariableIncentive":
3632
+ return q += k.limit, k.shouldMintAndAllocate && await Ze(V, q, k.asset, {
3633
+ config: i,
3634
+ account: o
3635
+ }), E.ERC20VariableIncentive(k);
3636
+ }
3637
+ }), wt = await Promise.all(xt), kt = await E.createBoost({
3638
+ protocolFee: T.protocolFee,
3639
+ maxParticipants: T.maxParticipants,
3640
+ budget: V,
3641
+ action: E.EventAction(T.action),
3642
+ validator: E.SignerValidator(T.validator),
3643
+ allowList: await Ra(T, { core: E }),
3644
+ incentives: wt
3645
+ });
3646
+ Ye.push(kt.id.toString());
3647
+ }
3648
+ return {
3649
+ boostIds: Ye
3650
+ };
3651
+ };
3652
+ async function Ze(n, e, t, a) {
3653
+ if (t && e) {
3654
+ let r = new dt(a, t);
3655
+ await Za(a, r, n, rt(e.toString()));
3656
+ }
3657
+ }
3658
+ async function ma(n) {
3659
+ const e = await Tt.readFile(Ct.normalize(n), {
3660
+ encoding: "utf8"
3661
+ });
3662
+ return Oa.parse(JSON.parse(e));
3663
+ }
3664
+ const ya = h.custom(zt, "invalid Hex payload"), w = h.string().transform((n, e) => (/^0x[a-fA-F0-9]{40}$/.test(n) || e.addIssue({
3665
+ code: h.ZodIssueCode.custom,
3666
+ message: `Invalid Address ${n}`
3667
+ }), n)).pipe(h.custom(Le, "invalid eth address")), ba = h.coerce.number().min(1).max(2).transform(BigInt).pipe(h.custom()), ga = h.object({
3668
+ type: h.literal("ManagedBudget"),
3669
+ owner: w,
3670
+ authorized: h.array(w),
3671
+ roles: h.array(ba)
748
3672
  }).refine(
749
- (a) => a.authorized.length === a.roles.length,
3673
+ (n) => n.authorized.length === n.roles.length,
750
3674
  "length mismatch authorized and roles"
751
- ), j = c.custom().pipe(
752
- c.string().regex(/^(event|function) .*/, {
3675
+ ), Fe = h.custom().pipe(
3676
+ h.string().regex(/^(event|function) .*/, {
753
3677
  message: "signature must start with `event` or function`"
754
- }).transform((a) => {
755
- if (a.startsWith("event")) return l0(p0(a));
756
- if (a.startsWith("function")) return m0(a);
3678
+ }).transform((n) => {
3679
+ if (n.startsWith("event")) return Ut(Wt(n));
3680
+ if (n.startsWith("function")) return qt(n);
757
3681
  throw new Error("unreachable");
758
3682
  })
759
- ), U0 = c.object({
760
- signatureType: c.nativeEnum(v),
761
- signature: j,
762
- fieldIndex: c.number().nonnegative(),
763
- targetContract: d,
764
- chainid: c.number().nonnegative()
765
- }), H0 = c.object({
766
- filterType: c.nativeEnum($),
767
- fieldType: c.nativeEnum(k),
768
- fieldIndex: c.number().nonnegative(),
769
- filterData: _0
770
- }), z0 = c.object({
771
- signature: j,
772
- signatureType: c.nativeEnum(v),
773
- actionType: c.number().optional(),
774
- targetContract: d,
775
- chainid: c.number().nonnegative(),
776
- actionParameter: H0
777
- }), q0 = c.object({
778
- type: c.literal("EventAction"),
779
- actionClaimant: U0,
780
- actionSteps: c.array(z0).max(4)
781
- }), W0 = c.object({
782
- type: c.literal("SignerValidator"),
783
- signers: c.array(d),
784
- validatorCaller: d
785
- }), K0 = c.object({
786
- type: c.literal("SimpleDenyList"),
787
- owner: d,
788
- denied: c.array(d)
789
- }), Q0 = c.object({
790
- type: c.literal("SimpleAllowList"),
791
- owner: d,
792
- allowed: c.array(d)
793
- }), G0 = c.object({
794
- type: c.literal("AllowListIncentive"),
795
- allowList: d,
796
- limit: c.coerce.bigint()
797
- }), J0 = c.object({
798
- type: c.literal("ERC20Incentive"),
799
- asset: d,
800
- shouldMintAndAllocate: c.boolean().optional().default(!1),
801
- strategy: c.nativeEnum(E),
802
- reward: c.coerce.bigint(),
803
- limit: c.coerce.bigint(),
804
- manager: d.optional()
805
- }), Z0 = c.object({
806
- type: c.literal("ERC20VariableIncentive"),
807
- asset: d,
808
- shouldMintAndAllocate: c.boolean().optional().default(!1),
809
- reward: c.coerce.bigint(),
810
- limit: c.coerce.bigint(),
811
- manager: d
812
- }), Y0 = c.object({
813
- criteriaType: c.nativeEnum(v),
814
- signature: j,
815
- fieldIndex: c.number().nonnegative(),
816
- targetContract: d
817
- }), X0 = c.object({
818
- type: c.literal("ERC20VariableCriteriaIncentive"),
819
- asset: d,
820
- shouldMintAndAllocate: c.boolean().optional().default(!1),
821
- reward: c.coerce.bigint(),
822
- limit: c.coerce.bigint(),
823
- manager: d.optional(),
824
- criteria: Y0
825
- }), ee = c.object({
826
- protocolFee: c.coerce.bigint(),
827
- maxParticipants: c.coerce.bigint(),
828
- budget: c.union([d, k0]),
829
- action: c.union([d, q0]),
830
- validator: c.union([d, W0]),
831
- allowList: c.union([
832
- d,
833
- K0,
834
- Q0
3683
+ ), va = h.object({
3684
+ signatureType: h.nativeEnum(se),
3685
+ signature: Fe,
3686
+ fieldIndex: h.number().nonnegative(),
3687
+ targetContract: w,
3688
+ chainid: h.number().nonnegative()
3689
+ }), _a = h.object({
3690
+ filterType: h.nativeEnum(tt),
3691
+ fieldType: h.nativeEnum(nt),
3692
+ fieldIndex: h.number().nonnegative(),
3693
+ filterData: ya
3694
+ }), xa = h.object({
3695
+ signature: Fe,
3696
+ signatureType: h.nativeEnum(se),
3697
+ actionType: h.number().optional(),
3698
+ targetContract: w,
3699
+ chainid: h.number().nonnegative(),
3700
+ actionParameter: _a
3701
+ }), wa = h.object({
3702
+ type: h.literal("EventAction"),
3703
+ actionClaimant: va,
3704
+ actionSteps: h.array(xa).max(4)
3705
+ }), ka = h.object({
3706
+ type: h.literal("SignerValidator"),
3707
+ signers: h.array(w),
3708
+ validatorCaller: w
3709
+ }), Ta = h.object({
3710
+ type: h.literal("SimpleDenyList"),
3711
+ owner: w,
3712
+ denied: h.array(w)
3713
+ }), Ca = h.object({
3714
+ type: h.literal("SimpleAllowList"),
3715
+ owner: w,
3716
+ allowed: h.array(w)
3717
+ }), Sa = h.object({
3718
+ type: h.literal("AllowListIncentive"),
3719
+ allowList: w,
3720
+ limit: h.coerce.bigint()
3721
+ }), Ia = h.object({
3722
+ type: h.literal("ERC20Incentive"),
3723
+ asset: w,
3724
+ shouldMintAndAllocate: h.boolean().optional().default(!1),
3725
+ strategy: h.nativeEnum(je),
3726
+ reward: h.coerce.bigint(),
3727
+ limit: h.coerce.bigint(),
3728
+ manager: w.optional()
3729
+ }), Ea = h.object({
3730
+ type: h.literal("ERC20VariableIncentive"),
3731
+ asset: w,
3732
+ shouldMintAndAllocate: h.boolean().optional().default(!1),
3733
+ reward: h.coerce.bigint(),
3734
+ limit: h.coerce.bigint(),
3735
+ manager: w
3736
+ }), Aa = h.object({
3737
+ criteriaType: h.nativeEnum(se),
3738
+ signature: Fe,
3739
+ fieldIndex: h.number().nonnegative(),
3740
+ targetContract: w
3741
+ }), Na = h.object({
3742
+ type: h.literal("ERC20VariableCriteriaIncentive"),
3743
+ asset: w,
3744
+ shouldMintAndAllocate: h.boolean().optional().default(!1),
3745
+ reward: h.coerce.bigint(),
3746
+ limit: h.coerce.bigint(),
3747
+ manager: w.optional(),
3748
+ criteria: Aa
3749
+ }), Oa = h.object({
3750
+ protocolFee: h.coerce.bigint(),
3751
+ maxParticipants: h.coerce.bigint(),
3752
+ budget: h.union([w, ga]),
3753
+ action: h.union([w, wa]),
3754
+ validator: h.union([w, ka]),
3755
+ allowList: h.union([
3756
+ w,
3757
+ Ta,
3758
+ Ca
835
3759
  ]),
836
- incentives: c.array(
837
- c.union([
838
- G0,
839
- J0,
840
- X0,
841
- Z0
3760
+ incentives: h.array(
3761
+ h.union([
3762
+ Sa,
3763
+ Ia,
3764
+ Na,
3765
+ Ea
842
3766
  ])
843
3767
  )
844
3768
  });
845
- async function te({ allowList: a }, { core: t }) {
846
- if (typeof a == "string" && R(a))
847
- return await r0(
3769
+ async function Ra({ allowList: n }, { core: e }) {
3770
+ if (typeof n == "string" && Le(n))
3771
+ return await Ot(
848
3772
  //@ts-expect-error i do what i want
849
- { config: t._config, account: t._account },
850
- a
3773
+ { config: e._config, account: e._account },
3774
+ n
851
3775
  );
852
- switch (a.type) {
3776
+ switch (n.type) {
853
3777
  case "SimpleAllowList":
854
- return t.SimpleAllowList(a);
3778
+ return e.SimpleAllowList(n);
855
3779
  case "SimpleDenyList":
856
- return t.SimpleDenyList(a);
3780
+ return e.SimpleDenyList(n);
857
3781
  default:
858
- throw new Error("unusupported AllowList: " + a);
3782
+ throw new Error("unusupported AllowList: " + n);
859
3783
  }
860
3784
  }
861
- async function ae(a, t, e, n = H("110")) {
862
- return await t.mint(a.account.address, n), await t.approve(e.assertValidAddress(), n), await e.allocate({
863
- amount: n,
864
- asset: t.assertValidAddress(),
865
- target: a.account.address
866
- }), { budget: e, erc20: t };
3785
+ async function Za(n, e, t, a = rt("110")) {
3786
+ return await e.mint(n.account.address, a), await e.approve(t.assertValidAddress(), a), await t.allocate({
3787
+ amount: a,
3788
+ asset: e.assertValidAddress(),
3789
+ target: n.account.address
3790
+ }), { budget: t, erc20: e };
867
3791
  }
868
- function ne({
869
- asset: a = "0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D",
870
- account: t = F0[0].account,
871
- chainId: e
3792
+ function ja({
3793
+ asset: n = "0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D",
3794
+ account: e = ln[0].account,
3795
+ chainId: t
872
3796
  }) {
873
3797
  return {
874
3798
  protocolFee: 0n,
875
3799
  maxParticipants: 10n,
876
3800
  budget: {
877
3801
  type: "ManagedBudget",
878
- owner: t,
879
- authorized: [t],
880
- roles: [U.MANAGER]
3802
+ owner: e,
3803
+ authorized: [e],
3804
+ roles: [at.MANAGER]
881
3805
  },
882
3806
  action: {
883
3807
  type: "EventAction",
884
3808
  actionClaimant: {
885
- signatureType: v.FUNC,
3809
+ signatureType: se.FUNC,
886
3810
  signature: "function mint(address to, uint256 amount)",
887
3811
  fieldIndex: 0,
888
- targetContract: L,
889
- chainid: e
3812
+ targetContract: Ge,
3813
+ chainid: t
890
3814
  },
891
3815
  actionSteps: [
892
3816
  {
893
3817
  signature: "event Minted(address to, uint256 amount)",
894
- signatureType: v.FUNC,
3818
+ signatureType: se.FUNC,
895
3819
  actionType: 0,
896
- targetContract: L,
897
- chainid: e,
3820
+ targetContract: Ge,
3821
+ chainid: t,
898
3822
  actionParameter: {
899
- filterType: $.EQUAL,
900
- fieldType: k.ADDRESS,
3823
+ filterType: tt.EQUAL,
3824
+ fieldType: nt.ADDRESS,
901
3825
  fieldIndex: 0,
902
- filterData: t
3826
+ filterData: e
903
3827
  }
904
3828
  }
905
3829
  ]
906
3830
  },
907
3831
  validator: {
908
3832
  type: "SignerValidator",
909
- signers: [t],
910
- validatorCaller: t
3833
+ signers: [e],
3834
+ validatorCaller: e
911
3835
  },
912
3836
  allowList: {
913
3837
  type: "SimpleDenyList",
914
- owner: t,
3838
+ owner: e,
915
3839
  denied: []
916
3840
  },
917
3841
  incentives: [
918
3842
  {
919
3843
  type: "ERC20Incentive",
920
- asset: a,
3844
+ asset: n,
921
3845
  shouldMintAndAllocate: !1,
922
3846
  strategy: 0,
923
3847
  reward: 1n,
924
3848
  limit: 1n,
925
- manager: t
3849
+ manager: e
926
3850
  }
927
3851
  ]
928
3852
  };
929
3853
  }
930
3854
  export {
931
- U0 as ActionClaimantSchema,
932
- H0 as ActionStepCriteriaSchema,
933
- z0 as ActionStepSchema,
934
- G0 as AllowListIncentiveSchema,
935
- ee as BoostSeedConfigSchema,
936
- J0 as ERC20IncentiveSchema,
937
- X0 as ERC20VariableCriteriaIncentiveSchema,
938
- Z0 as ERC20VariableIncentiveSchema,
939
- q0 as EventActionSchema,
940
- Y0 as IncentiveCriteriaSchema,
941
- k0 as ManagedBudgetSchema,
942
- W0 as SignerValidatorSchema,
943
- Q0 as SimpleAllowListSchema,
944
- K0 as SimpleDenyListSchema,
945
- ne as makeSeed,
946
- pe as seed
3855
+ va as ActionClaimantSchema,
3856
+ _a as ActionStepCriteriaSchema,
3857
+ xa as ActionStepSchema,
3858
+ Sa as AllowListIncentiveSchema,
3859
+ Oa as BoostSeedConfigSchema,
3860
+ Ia as ERC20IncentiveSchema,
3861
+ Na as ERC20VariableCriteriaIncentiveSchema,
3862
+ Ea as ERC20VariableIncentiveSchema,
3863
+ wa as EventActionSchema,
3864
+ Aa as IncentiveCriteriaSchema,
3865
+ ga as ManagedBudgetSchema,
3866
+ ka as SignerValidatorSchema,
3867
+ Ca as SimpleAllowListSchema,
3868
+ Ta as SimpleDenyListSchema,
3869
+ ja as makeSeed,
3870
+ Va as seed
947
3871
  };