@feedmepos/mf-connect 0.1.2-prod → 0.1.4-prod

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.
Files changed (87) hide show
  1. package/dist/Analytic-07T9poLx.js +423 -0
  2. package/dist/{App-CRTD0U-N.js → App-C6MukSCT.js} +276 -275
  3. package/dist/Broadcast-CzsgeZNO.js +223 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C5zUv0Zx.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BirunpzI.js} +8 -8
  5. package/dist/Card-DQnyWZZf.js +824 -0
  6. package/dist/{Collections-BgbWoLWI.js → Collections-BV7CSqRw.js} +4 -4
  7. package/dist/Credit-CxsbYGLZ.js +220 -0
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-C137bE1q.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BKSZYxvb.js} +918 -901
  9. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-DpsrI-Z3.js +345 -0
  10. package/dist/Experience-eMUbhq7h.js +221 -0
  11. package/dist/Game-CxAG2ViS.js +255 -0
  12. package/dist/Marketing-CozMj2Y5.js +316 -0
  13. package/dist/Member-DM1dj3F5.js +69 -0
  14. package/dist/{MemberList-ISy05wGZ.js → MemberList-DNjK9BbG.js} +14 -14
  15. package/dist/{MemberTransactions-CXvhJngX.js → MemberTransactions-CsjN3LZA.js} +1 -1
  16. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Ca1LO__F.js → MessageInput.vue_vue_type_script_setup_true_lang-DVQE9v2R.js} +2 -2
  17. package/dist/Mission-BugvTPPH.js +261 -0
  18. package/dist/Point-D8BjGtqT.js +222 -0
  19. package/dist/Promotion-mc9KBzoJ.js +253 -0
  20. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-D1eQ3i5D.js → RuleGroup.vue_vue_type_script_setup_true_lang-B2H3D_kZ.js} +15 -15
  21. package/dist/Segment-DZRFA-Pb.js +565 -0
  22. package/dist/Setting-DxNhR44e.js +1871 -0
  23. package/dist/Store-CdkJWpjV.js +1530 -0
  24. package/dist/StoreRewards-Cdturia8.js +400 -0
  25. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-nhS5Dhhk.js → StoreTransactions.vue_vue_type_script_setup_true_lang-D7GcOiUM.js} +10 -10
  26. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DWlpmE56.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-nuCOrrLE.js} +1 -1
  27. package/dist/{Tier-DLrOmrnK.js → Tier-I_MMd39Y.js} +470 -445
  28. package/dist/{Title-MHQuel7h.js → Title-DK5gmUvo.js} +298 -282
  29. package/dist/Transaction-BXpTIMS_.js +39 -0
  30. package/dist/Voucher-BQ5h2G0I.js +490 -0
  31. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-eAP99wyg.js +141 -0
  32. package/dist/app-CL2Wxzv5.js +5639 -0
  33. package/dist/{app-BjOpRVdv.js → app-DTAyCT-G.js} +1 -1
  34. package/dist/app.js +4 -3
  35. package/dist/{business-DveMDDHY.js → business-B9OUlaFZ.js} +1 -1
  36. package/dist/{campaign-CMb05XLt.js → campaign-CNbUA51l.js} +2 -2
  37. package/dist/{collection.fn-BjaBPYMU.js → collection.fn-D_i45T4Q.js} +2 -2
  38. package/dist/dto-B4208_es.js +2770 -0
  39. package/dist/{effect-CxAdSlyD.js → effect-Ye_yr8et.js} +1 -1
  40. package/dist/{email-addresses-Dtr5OALQ.js → email-addresses-Gm7Dyaxy.js} +1 -1
  41. package/dist/{export-DuBekrcg.js → export-Buee5oUV.js} +3 -3
  42. package/dist/{helper-DL6hnmtJ.js → helper-BBlHhMFc.js} +1 -1
  43. package/dist/{index-raYm7Ew2.js → index-BxJgFvym.js} +2 -2
  44. package/dist/{index-gcsOy_cD.js → index-ByaM-yoc.js} +91 -86
  45. package/dist/{index-DISwCnfH.js → index-C0QHb5SL.js} +2 -2
  46. package/dist/{index-Cibwzgac.js → index-C363BG5A.js} +3 -3
  47. package/dist/{index-BZAlqAaJ.js → index-CLL3no-v.js} +1 -1
  48. package/dist/{index-CAQpU5Rv.js → index-ChSVaFk3.js} +1 -1
  49. package/dist/{index-BSIUoSG3.js → index-Co9n8I_5.js} +3 -3
  50. package/dist/index-CoGNKU8v.js +3 -0
  51. package/dist/{index-Dx4pkNRc.js → index-DHGcUMVN.js} +1 -1
  52. package/dist/{index-CgPlJqkX.js → index-DWWtZSrm.js} +1 -1
  53. package/dist/{index-CGHNWhkM.js → index-DdVZgYE4.js} +258 -256
  54. package/dist/{index-BBBytzpn.js → index-Dx3HwWcb.js} +1 -1
  55. package/dist/{index.esm2017-Bs9CWbrs.js → index.esm2017-Dd02dg_O.js} +38 -38
  56. package/dist/{loading-Dj5bx8fg.js → loading-Or1ZDzDS.js} +11 -11
  57. package/dist/{membership-B2avlZoN.js → membership-B8h5ku-v.js} +3 -3
  58. package/dist/{money-CNSWtAf-.js → money-CmsKAJBT.js} +1 -1
  59. package/dist/{number-BA58pjU6.js → number-iEhp7Uai.js} +1 -1
  60. package/dist/{rule-BWazFYuZ.js → rule-BORkgSMK.js} +3 -3
  61. package/dist/{rule-builder-RIloDQBn.js → rule-builder-DEfkSr68.js} +1 -1
  62. package/dist/{template-u01r84LY.js → template-C_Y7bhlI.js} +4 -4
  63. package/dist/{usePagination--B6Wt7C1.js → usePagination-Ci8-uZvb.js} +1 -1
  64. package/dist/vue-i18n-BXzrZRP6.js +2365 -0
  65. package/package.json +7 -4
  66. package/dist/Analytic-AqWU_lJy.js +0 -620
  67. package/dist/Broadcast-utWSrzP9.js +0 -216
  68. package/dist/Card-x6qnEaIt.js +0 -823
  69. package/dist/Credit-CojzmUnh.js +0 -214
  70. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-8l3Dt_Lo.js +0 -344
  71. package/dist/Experience-CPjovKWF.js +0 -211
  72. package/dist/Game-DWcjPfZP.js +0 -250
  73. package/dist/Marketing-CwoI0pFF.js +0 -309
  74. package/dist/Member-oRcVGr20.js +0 -92
  75. package/dist/Mission-Y8s5MQIC.js +0 -248
  76. package/dist/Point-0Fw3qLIW.js +0 -220
  77. package/dist/Promotion-vqM23NPX.js +0 -244
  78. package/dist/Segment-lgzMRCyd.js +0 -564
  79. package/dist/Setting-CFGB53S0.js +0 -1870
  80. package/dist/Store-fJlew3HJ.js +0 -1533
  81. package/dist/StoreRewards-DWq34E4p.js +0 -429
  82. package/dist/Transaction-CYqMFEzc.js +0 -36
  83. package/dist/Voucher-B0QCX_nG.js +0 -485
  84. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +0 -140
  85. package/dist/app-SOHUUM08.js +0 -2974
  86. package/dist/dto-CY7JrHkZ.js +0 -1145
  87. package/dist/index-BMxu_XL-.js +0 -11
@@ -1,2974 +0,0 @@
1
- var x;
2
- (function(n) {
3
- n.assertEqual = (s) => s;
4
- function e(s) {
5
- }
6
- n.assertIs = e;
7
- function t(s) {
8
- throw new Error();
9
- }
10
- n.assertNever = t, n.arrayToEnum = (s) => {
11
- const a = {};
12
- for (const i of s)
13
- a[i] = i;
14
- return a;
15
- }, n.getValidEnumValues = (s) => {
16
- const a = n.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
17
- for (const o of a)
18
- i[o] = s[o];
19
- return n.objectValues(i);
20
- }, n.objectValues = (s) => n.objectKeys(s).map(function(a) {
21
- return s[a];
22
- }), n.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
23
- const a = [];
24
- for (const i in s)
25
- Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
26
- return a;
27
- }, n.find = (s, a) => {
28
- for (const i of s)
29
- if (a(i))
30
- return i;
31
- }, n.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
32
- function r(s, a = " | ") {
33
- return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
34
- }
35
- n.joinValues = r, n.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
36
- })(x || (x = {}));
37
- var ye;
38
- (function(n) {
39
- n.mergeShapes = (e, t) => ({
40
- ...e,
41
- ...t
42
- // second overwrites first
43
- });
44
- })(ye || (ye = {}));
45
- const u = x.arrayToEnum([
46
- "string",
47
- "nan",
48
- "number",
49
- "integer",
50
- "float",
51
- "boolean",
52
- "date",
53
- "bigint",
54
- "symbol",
55
- "function",
56
- "undefined",
57
- "null",
58
- "array",
59
- "object",
60
- "unknown",
61
- "promise",
62
- "void",
63
- "never",
64
- "map",
65
- "set"
66
- ]), M = (n) => {
67
- switch (typeof n) {
68
- case "undefined":
69
- return u.undefined;
70
- case "string":
71
- return u.string;
72
- case "number":
73
- return isNaN(n) ? u.nan : u.number;
74
- case "boolean":
75
- return u.boolean;
76
- case "function":
77
- return u.function;
78
- case "bigint":
79
- return u.bigint;
80
- case "symbol":
81
- return u.symbol;
82
- case "object":
83
- return Array.isArray(n) ? u.array : n === null ? u.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? u.promise : typeof Map < "u" && n instanceof Map ? u.map : typeof Set < "u" && n instanceof Set ? u.set : typeof Date < "u" && n instanceof Date ? u.date : u.object;
84
- default:
85
- return u.unknown;
86
- }
87
- }, c = x.arrayToEnum([
88
- "invalid_type",
89
- "invalid_literal",
90
- "custom",
91
- "invalid_union",
92
- "invalid_union_discriminator",
93
- "invalid_enum_value",
94
- "unrecognized_keys",
95
- "invalid_arguments",
96
- "invalid_return_type",
97
- "invalid_date",
98
- "invalid_string",
99
- "too_small",
100
- "too_big",
101
- "invalid_intersection_types",
102
- "not_multiple_of",
103
- "not_finite"
104
- ]), Se = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
105
- class R extends Error {
106
- constructor(e) {
107
- super(), this.issues = [], this.addIssue = (r) => {
108
- this.issues = [...this.issues, r];
109
- }, this.addIssues = (r = []) => {
110
- this.issues = [...this.issues, ...r];
111
- };
112
- const t = new.target.prototype;
113
- Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
114
- }
115
- get errors() {
116
- return this.issues;
117
- }
118
- format(e) {
119
- const t = e || function(a) {
120
- return a.message;
121
- }, r = { _errors: [] }, s = (a) => {
122
- for (const i of a.issues)
123
- if (i.code === "invalid_union")
124
- i.unionErrors.map(s);
125
- else if (i.code === "invalid_return_type")
126
- s(i.returnTypeError);
127
- else if (i.code === "invalid_arguments")
128
- s(i.argumentsError);
129
- else if (i.path.length === 0)
130
- r._errors.push(t(i));
131
- else {
132
- let o = r, h = 0;
133
- for (; h < i.path.length; ) {
134
- const d = i.path[h];
135
- h === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], h++;
136
- }
137
- }
138
- };
139
- return s(this), r;
140
- }
141
- toString() {
142
- return this.message;
143
- }
144
- get message() {
145
- return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
146
- }
147
- get isEmpty() {
148
- return this.issues.length === 0;
149
- }
150
- flatten(e = (t) => t.message) {
151
- const t = {}, r = [];
152
- for (const s of this.issues)
153
- s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : r.push(e(s));
154
- return { formErrors: r, fieldErrors: t };
155
- }
156
- get formErrors() {
157
- return this.flatten();
158
- }
159
- }
160
- R.create = (n) => new R(n);
161
- const Y = (n, e) => {
162
- let t;
163
- switch (n.code) {
164
- case c.invalid_type:
165
- n.received === u.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
166
- break;
167
- case c.invalid_literal:
168
- t = `Invalid literal value, expected ${JSON.stringify(n.expected, x.jsonStringifyReplacer)}`;
169
- break;
170
- case c.unrecognized_keys:
171
- t = `Unrecognized key(s) in object: ${x.joinValues(n.keys, ", ")}`;
172
- break;
173
- case c.invalid_union:
174
- t = "Invalid input";
175
- break;
176
- case c.invalid_union_discriminator:
177
- t = `Invalid discriminator value. Expected ${x.joinValues(n.options)}`;
178
- break;
179
- case c.invalid_enum_value:
180
- t = `Invalid enum value. Expected ${x.joinValues(n.options)}, received '${n.received}'`;
181
- break;
182
- case c.invalid_arguments:
183
- t = "Invalid function arguments";
184
- break;
185
- case c.invalid_return_type:
186
- t = "Invalid function return type";
187
- break;
188
- case c.invalid_date:
189
- t = "Invalid date";
190
- break;
191
- case c.invalid_string:
192
- 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}"` : x.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
193
- break;
194
- case c.too_small:
195
- 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";
196
- break;
197
- case c.too_big:
198
- 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";
199
- break;
200
- case c.custom:
201
- t = "Invalid input";
202
- break;
203
- case c.invalid_intersection_types:
204
- t = "Intersection results could not be merged";
205
- break;
206
- case c.not_multiple_of:
207
- t = `Number must be a multiple of ${n.multipleOf}`;
208
- break;
209
- case c.not_finite:
210
- t = "Number must be finite";
211
- break;
212
- default:
213
- t = e.defaultError, x.assertNever(n);
214
- }
215
- return { message: t };
216
- };
217
- let be = Y;
218
- function Ie(n) {
219
- be = n;
220
- }
221
- function ae() {
222
- return be;
223
- }
224
- const ie = (n) => {
225
- const { data: e, path: t, errorMaps: r, issueData: s } = n, a = [...t, ...s.path || []], i = {
226
- ...s,
227
- path: a
228
- };
229
- let o = "";
230
- const h = r.filter((d) => !!d).slice().reverse();
231
- for (const d of h)
232
- o = d(i, { data: e, defaultError: o }).message;
233
- return {
234
- ...s,
235
- path: a,
236
- message: s.message || o
237
- };
238
- }, Me = [];
239
- function l(n, e) {
240
- const t = ie({
241
- issueData: e,
242
- data: n.data,
243
- path: n.path,
244
- errorMaps: [
245
- n.common.contextualErrorMap,
246
- n.schemaErrorMap,
247
- ae(),
248
- Y
249
- // then global default map
250
- ].filter((r) => !!r)
251
- });
252
- n.common.issues.push(t);
253
- }
254
- class T {
255
- constructor() {
256
- this.value = "valid";
257
- }
258
- dirty() {
259
- this.value === "valid" && (this.value = "dirty");
260
- }
261
- abort() {
262
- this.value !== "aborted" && (this.value = "aborted");
263
- }
264
- static mergeArray(e, t) {
265
- const r = [];
266
- for (const s of t) {
267
- if (s.status === "aborted")
268
- return m;
269
- s.status === "dirty" && e.dirty(), r.push(s.value);
270
- }
271
- return { status: e.value, value: r };
272
- }
273
- static async mergeObjectAsync(e, t) {
274
- const r = [];
275
- for (const s of t)
276
- r.push({
277
- key: await s.key,
278
- value: await s.value
279
- });
280
- return T.mergeObjectSync(e, r);
281
- }
282
- static mergeObjectSync(e, t) {
283
- const r = {};
284
- for (const s of t) {
285
- const { key: a, value: i } = s;
286
- if (a.status === "aborted" || i.status === "aborted")
287
- return m;
288
- a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (r[a.value] = i.value);
289
- }
290
- return { status: e.value, value: r };
291
- }
292
- }
293
- const m = Object.freeze({
294
- status: "aborted"
295
- }), we = (n) => ({ status: "dirty", value: n }), b = (n) => ({ status: "valid", value: n }), ve = (n) => n.status === "aborted", ge = (n) => n.status === "dirty", W = (n) => n.status === "valid", oe = (n) => typeof Promise < "u" && n instanceof Promise;
296
- var p;
297
- (function(n) {
298
- n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
299
- })(p || (p = {}));
300
- class N {
301
- constructor(e, t, r, s) {
302
- this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s;
303
- }
304
- get path() {
305
- return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
306
- }
307
- }
308
- const ke = (n, e) => {
309
- if (W(e))
310
- return { success: !0, data: e.value };
311
- if (!n.common.issues.length)
312
- throw new Error("Validation failed but no issues detected.");
313
- return {
314
- success: !1,
315
- get error() {
316
- if (this._error)
317
- return this._error;
318
- const t = new R(n.common.issues);
319
- return this._error = t, this._error;
320
- }
321
- };
322
- };
323
- function _(n) {
324
- if (!n)
325
- return {};
326
- const { errorMap: e, invalid_type_error: t, required_error: r, description: s } = n;
327
- if (e && (t || r))
328
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
329
- return e ? { errorMap: e, description: s } : { errorMap: (i, o) => i.code !== "invalid_type" ? { message: o.defaultError } : typeof o.data > "u" ? { message: r ?? o.defaultError } : { message: t ?? o.defaultError }, description: s };
330
- }
331
- class y {
332
- constructor(e) {
333
- 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);
334
- }
335
- get description() {
336
- return this._def.description;
337
- }
338
- _getType(e) {
339
- return M(e.data);
340
- }
341
- _getOrReturnCtx(e, t) {
342
- return t || {
343
- common: e.parent.common,
344
- data: e.data,
345
- parsedType: M(e.data),
346
- schemaErrorMap: this._def.errorMap,
347
- path: e.path,
348
- parent: e.parent
349
- };
350
- }
351
- _processInputParams(e) {
352
- return {
353
- status: new T(),
354
- ctx: {
355
- common: e.parent.common,
356
- data: e.data,
357
- parsedType: M(e.data),
358
- schemaErrorMap: this._def.errorMap,
359
- path: e.path,
360
- parent: e.parent
361
- }
362
- };
363
- }
364
- _parseSync(e) {
365
- const t = this._parse(e);
366
- if (oe(t))
367
- throw new Error("Synchronous parse encountered promise.");
368
- return t;
369
- }
370
- _parseAsync(e) {
371
- const t = this._parse(e);
372
- return Promise.resolve(t);
373
- }
374
- parse(e, t) {
375
- const r = this.safeParse(e, t);
376
- if (r.success)
377
- return r.data;
378
- throw r.error;
379
- }
380
- safeParse(e, t) {
381
- var r;
382
- const s = {
383
- common: {
384
- issues: [],
385
- async: (r = t == null ? void 0 : t.async) !== null && r !== void 0 ? r : !1,
386
- contextualErrorMap: t == null ? void 0 : t.errorMap
387
- },
388
- path: (t == null ? void 0 : t.path) || [],
389
- schemaErrorMap: this._def.errorMap,
390
- parent: null,
391
- data: e,
392
- parsedType: M(e)
393
- }, a = this._parseSync({ data: e, path: s.path, parent: s });
394
- return ke(s, a);
395
- }
396
- async parseAsync(e, t) {
397
- const r = await this.safeParseAsync(e, t);
398
- if (r.success)
399
- return r.data;
400
- throw r.error;
401
- }
402
- async safeParseAsync(e, t) {
403
- const r = {
404
- common: {
405
- issues: [],
406
- contextualErrorMap: t == null ? void 0 : t.errorMap,
407
- async: !0
408
- },
409
- path: (t == null ? void 0 : t.path) || [],
410
- schemaErrorMap: this._def.errorMap,
411
- parent: null,
412
- data: e,
413
- parsedType: M(e)
414
- }, s = this._parse({ data: e, path: r.path, parent: r }), a = await (oe(s) ? s : Promise.resolve(s));
415
- return ke(r, a);
416
- }
417
- refine(e, t) {
418
- const r = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
419
- return this._refinement((s, a) => {
420
- const i = e(s), o = () => a.addIssue({
421
- code: c.custom,
422
- ...r(s)
423
- });
424
- return typeof Promise < "u" && i instanceof Promise ? i.then((h) => h ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
425
- });
426
- }
427
- refinement(e, t) {
428
- return this._refinement((r, s) => e(r) ? !0 : (s.addIssue(typeof t == "function" ? t(r, s) : t), !1));
429
- }
430
- _refinement(e) {
431
- return new A({
432
- schema: this,
433
- typeName: f.ZodEffects,
434
- effect: { type: "refinement", refinement: e }
435
- });
436
- }
437
- superRefine(e) {
438
- return this._refinement(e);
439
- }
440
- optional() {
441
- return S.create(this, this._def);
442
- }
443
- nullable() {
444
- return D.create(this, this._def);
445
- }
446
- nullish() {
447
- return this.nullable().optional();
448
- }
449
- array() {
450
- return E.create(this, this._def);
451
- }
452
- promise() {
453
- return G.create(this, this._def);
454
- }
455
- or(e) {
456
- return X.create([this, e], this._def);
457
- }
458
- and(e) {
459
- return K.create(this, e, this._def);
460
- }
461
- transform(e) {
462
- return new A({
463
- ..._(this._def),
464
- schema: this,
465
- typeName: f.ZodEffects,
466
- effect: { type: "transform", transform: e }
467
- });
468
- }
469
- default(e) {
470
- const t = typeof e == "function" ? e : () => e;
471
- return new ne({
472
- ..._(this._def),
473
- innerType: this,
474
- defaultValue: t,
475
- typeName: f.ZodDefault
476
- });
477
- }
478
- brand() {
479
- return new Re({
480
- typeName: f.ZodBranded,
481
- type: this,
482
- ..._(this._def)
483
- });
484
- }
485
- catch(e) {
486
- const t = typeof e == "function" ? e : () => e;
487
- return new le({
488
- ..._(this._def),
489
- innerType: this,
490
- catchValue: t,
491
- typeName: f.ZodCatch
492
- });
493
- }
494
- describe(e) {
495
- const t = this.constructor;
496
- return new t({
497
- ...this._def,
498
- description: e
499
- });
500
- }
501
- pipe(e) {
502
- return re.create(this, e);
503
- }
504
- readonly() {
505
- return pe.create(this);
506
- }
507
- isOptional() {
508
- return this.safeParse(void 0).success;
509
- }
510
- isNullable() {
511
- return this.safeParse(null).success;
512
- }
513
- }
514
- const Ze = /^c[^\s-]{8,}$/i, Le = /^[a-z][a-z0-9]*$/, $e = /^[0-9A-HJKMNP-TV-Z]{26}$/, je = /^[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, Pe = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ve = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
515
- let _e;
516
- const De = /^(((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}))$/, Ue = /^(([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})))$/, Be = (n) => n.precision ? n.offset ? new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`) : new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}Z$`) : n.precision === 0 ? n.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$") : n.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");
517
- function ze(n, e) {
518
- return !!((e === "v4" || !e) && De.test(n) || (e === "v6" || !e) && Ue.test(n));
519
- }
520
- class O extends y {
521
- _parse(e) {
522
- if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== u.string) {
523
- const a = this._getOrReturnCtx(e);
524
- return l(
525
- a,
526
- {
527
- code: c.invalid_type,
528
- expected: u.string,
529
- received: a.parsedType
530
- }
531
- //
532
- ), m;
533
- }
534
- const r = new T();
535
- let s;
536
- for (const a of this._def.checks)
537
- if (a.kind === "min")
538
- e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
539
- code: c.too_small,
540
- minimum: a.value,
541
- type: "string",
542
- inclusive: !0,
543
- exact: !1,
544
- message: a.message
545
- }), r.dirty());
546
- else if (a.kind === "max")
547
- e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
548
- code: c.too_big,
549
- maximum: a.value,
550
- type: "string",
551
- inclusive: !0,
552
- exact: !1,
553
- message: a.message
554
- }), r.dirty());
555
- else if (a.kind === "length") {
556
- const i = e.data.length > a.value, o = e.data.length < a.value;
557
- (i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
558
- code: c.too_big,
559
- maximum: a.value,
560
- type: "string",
561
- inclusive: !0,
562
- exact: !0,
563
- message: a.message
564
- }) : o && l(s, {
565
- code: c.too_small,
566
- minimum: a.value,
567
- type: "string",
568
- inclusive: !0,
569
- exact: !0,
570
- message: a.message
571
- }), r.dirty());
572
- } else if (a.kind === "email")
573
- Pe.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
574
- validation: "email",
575
- code: c.invalid_string,
576
- message: a.message
577
- }), r.dirty());
578
- else if (a.kind === "emoji")
579
- _e || (_e = new RegExp(Ve, "u")), _e.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
580
- validation: "emoji",
581
- code: c.invalid_string,
582
- message: a.message
583
- }), r.dirty());
584
- else if (a.kind === "uuid")
585
- je.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
586
- validation: "uuid",
587
- code: c.invalid_string,
588
- message: a.message
589
- }), r.dirty());
590
- else if (a.kind === "cuid")
591
- Ze.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
592
- validation: "cuid",
593
- code: c.invalid_string,
594
- message: a.message
595
- }), r.dirty());
596
- else if (a.kind === "cuid2")
597
- Le.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
598
- validation: "cuid2",
599
- code: c.invalid_string,
600
- message: a.message
601
- }), r.dirty());
602
- else if (a.kind === "ulid")
603
- $e.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
604
- validation: "ulid",
605
- code: c.invalid_string,
606
- message: a.message
607
- }), r.dirty());
608
- else if (a.kind === "url")
609
- try {
610
- new URL(e.data);
611
- } catch {
612
- s = this._getOrReturnCtx(e, s), l(s, {
613
- validation: "url",
614
- code: c.invalid_string,
615
- message: a.message
616
- }), r.dirty();
617
- }
618
- else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
619
- validation: "regex",
620
- code: c.invalid_string,
621
- message: a.message
622
- }), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), l(s, {
623
- code: c.invalid_string,
624
- validation: { includes: a.value, position: a.position },
625
- message: a.message
626
- }), r.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
627
- code: c.invalid_string,
628
- validation: { startsWith: a.value },
629
- message: a.message
630
- }), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
631
- code: c.invalid_string,
632
- validation: { endsWith: a.value },
633
- message: a.message
634
- }), r.dirty()) : a.kind === "datetime" ? Be(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
635
- code: c.invalid_string,
636
- validation: "datetime",
637
- message: a.message
638
- }), r.dirty()) : a.kind === "ip" ? ze(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
639
- validation: "ip",
640
- code: c.invalid_string,
641
- message: a.message
642
- }), r.dirty()) : x.assertNever(a);
643
- return { status: r.value, value: e.data };
644
- }
645
- _regex(e, t, r) {
646
- return this.refinement((s) => e.test(s), {
647
- validation: t,
648
- code: c.invalid_string,
649
- ...p.errToObj(r)
650
- });
651
- }
652
- _addCheck(e) {
653
- return new O({
654
- ...this._def,
655
- checks: [...this._def.checks, e]
656
- });
657
- }
658
- email(e) {
659
- return this._addCheck({ kind: "email", ...p.errToObj(e) });
660
- }
661
- url(e) {
662
- return this._addCheck({ kind: "url", ...p.errToObj(e) });
663
- }
664
- emoji(e) {
665
- return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
666
- }
667
- uuid(e) {
668
- return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
669
- }
670
- cuid(e) {
671
- return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
672
- }
673
- cuid2(e) {
674
- return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
675
- }
676
- ulid(e) {
677
- return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
678
- }
679
- ip(e) {
680
- return this._addCheck({ kind: "ip", ...p.errToObj(e) });
681
- }
682
- datetime(e) {
683
- var t;
684
- return typeof e == "string" ? this._addCheck({
685
- kind: "datetime",
686
- precision: null,
687
- offset: !1,
688
- message: e
689
- }) : this._addCheck({
690
- kind: "datetime",
691
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
692
- offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
693
- ...p.errToObj(e == null ? void 0 : e.message)
694
- });
695
- }
696
- regex(e, t) {
697
- return this._addCheck({
698
- kind: "regex",
699
- regex: e,
700
- ...p.errToObj(t)
701
- });
702
- }
703
- includes(e, t) {
704
- return this._addCheck({
705
- kind: "includes",
706
- value: e,
707
- position: t == null ? void 0 : t.position,
708
- ...p.errToObj(t == null ? void 0 : t.message)
709
- });
710
- }
711
- startsWith(e, t) {
712
- return this._addCheck({
713
- kind: "startsWith",
714
- value: e,
715
- ...p.errToObj(t)
716
- });
717
- }
718
- endsWith(e, t) {
719
- return this._addCheck({
720
- kind: "endsWith",
721
- value: e,
722
- ...p.errToObj(t)
723
- });
724
- }
725
- min(e, t) {
726
- return this._addCheck({
727
- kind: "min",
728
- value: e,
729
- ...p.errToObj(t)
730
- });
731
- }
732
- max(e, t) {
733
- return this._addCheck({
734
- kind: "max",
735
- value: e,
736
- ...p.errToObj(t)
737
- });
738
- }
739
- length(e, t) {
740
- return this._addCheck({
741
- kind: "length",
742
- value: e,
743
- ...p.errToObj(t)
744
- });
745
- }
746
- /**
747
- * @deprecated Use z.string().min(1) instead.
748
- * @see {@link ZodString.min}
749
- */
750
- nonempty(e) {
751
- return this.min(1, p.errToObj(e));
752
- }
753
- trim() {
754
- return new O({
755
- ...this._def,
756
- checks: [...this._def.checks, { kind: "trim" }]
757
- });
758
- }
759
- toLowerCase() {
760
- return new O({
761
- ...this._def,
762
- checks: [...this._def.checks, { kind: "toLowerCase" }]
763
- });
764
- }
765
- toUpperCase() {
766
- return new O({
767
- ...this._def,
768
- checks: [...this._def.checks, { kind: "toUpperCase" }]
769
- });
770
- }
771
- get isDatetime() {
772
- return !!this._def.checks.find((e) => e.kind === "datetime");
773
- }
774
- get isEmail() {
775
- return !!this._def.checks.find((e) => e.kind === "email");
776
- }
777
- get isURL() {
778
- return !!this._def.checks.find((e) => e.kind === "url");
779
- }
780
- get isEmoji() {
781
- return !!this._def.checks.find((e) => e.kind === "emoji");
782
- }
783
- get isUUID() {
784
- return !!this._def.checks.find((e) => e.kind === "uuid");
785
- }
786
- get isCUID() {
787
- return !!this._def.checks.find((e) => e.kind === "cuid");
788
- }
789
- get isCUID2() {
790
- return !!this._def.checks.find((e) => e.kind === "cuid2");
791
- }
792
- get isULID() {
793
- return !!this._def.checks.find((e) => e.kind === "ulid");
794
- }
795
- get isIP() {
796
- return !!this._def.checks.find((e) => e.kind === "ip");
797
- }
798
- get minLength() {
799
- let e = null;
800
- for (const t of this._def.checks)
801
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
802
- return e;
803
- }
804
- get maxLength() {
805
- let e = null;
806
- for (const t of this._def.checks)
807
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
808
- return e;
809
- }
810
- }
811
- O.create = (n) => {
812
- var e;
813
- return new O({
814
- checks: [],
815
- typeName: f.ZodString,
816
- coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
817
- ..._(n)
818
- });
819
- };
820
- function Ge(n, e) {
821
- const t = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = t > r ? t : r, a = parseInt(n.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
822
- return a % i / Math.pow(10, s);
823
- }
824
- class Z extends y {
825
- constructor() {
826
- super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
827
- }
828
- _parse(e) {
829
- if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== u.number) {
830
- const a = this._getOrReturnCtx(e);
831
- return l(a, {
832
- code: c.invalid_type,
833
- expected: u.number,
834
- received: a.parsedType
835
- }), m;
836
- }
837
- let r;
838
- const s = new T();
839
- for (const a of this._def.checks)
840
- a.kind === "int" ? x.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
841
- code: c.invalid_type,
842
- expected: "integer",
843
- received: "float",
844
- message: a.message
845
- }), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
846
- code: c.too_small,
847
- minimum: a.value,
848
- type: "number",
849
- inclusive: a.inclusive,
850
- exact: !1,
851
- message: a.message
852
- }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
853
- code: c.too_big,
854
- maximum: a.value,
855
- type: "number",
856
- inclusive: a.inclusive,
857
- exact: !1,
858
- message: a.message
859
- }), s.dirty()) : a.kind === "multipleOf" ? Ge(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), l(r, {
860
- code: c.not_multiple_of,
861
- multipleOf: a.value,
862
- message: a.message
863
- }), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
864
- code: c.not_finite,
865
- message: a.message
866
- }), s.dirty()) : x.assertNever(a);
867
- return { status: s.value, value: e.data };
868
- }
869
- gte(e, t) {
870
- return this.setLimit("min", e, !0, p.toString(t));
871
- }
872
- gt(e, t) {
873
- return this.setLimit("min", e, !1, p.toString(t));
874
- }
875
- lte(e, t) {
876
- return this.setLimit("max", e, !0, p.toString(t));
877
- }
878
- lt(e, t) {
879
- return this.setLimit("max", e, !1, p.toString(t));
880
- }
881
- setLimit(e, t, r, s) {
882
- return new Z({
883
- ...this._def,
884
- checks: [
885
- ...this._def.checks,
886
- {
887
- kind: e,
888
- value: t,
889
- inclusive: r,
890
- message: p.toString(s)
891
- }
892
- ]
893
- });
894
- }
895
- _addCheck(e) {
896
- return new Z({
897
- ...this._def,
898
- checks: [...this._def.checks, e]
899
- });
900
- }
901
- int(e) {
902
- return this._addCheck({
903
- kind: "int",
904
- message: p.toString(e)
905
- });
906
- }
907
- positive(e) {
908
- return this._addCheck({
909
- kind: "min",
910
- value: 0,
911
- inclusive: !1,
912
- message: p.toString(e)
913
- });
914
- }
915
- negative(e) {
916
- return this._addCheck({
917
- kind: "max",
918
- value: 0,
919
- inclusive: !1,
920
- message: p.toString(e)
921
- });
922
- }
923
- nonpositive(e) {
924
- return this._addCheck({
925
- kind: "max",
926
- value: 0,
927
- inclusive: !0,
928
- message: p.toString(e)
929
- });
930
- }
931
- nonnegative(e) {
932
- return this._addCheck({
933
- kind: "min",
934
- value: 0,
935
- inclusive: !0,
936
- message: p.toString(e)
937
- });
938
- }
939
- multipleOf(e, t) {
940
- return this._addCheck({
941
- kind: "multipleOf",
942
- value: e,
943
- message: p.toString(t)
944
- });
945
- }
946
- finite(e) {
947
- return this._addCheck({
948
- kind: "finite",
949
- message: p.toString(e)
950
- });
951
- }
952
- safe(e) {
953
- return this._addCheck({
954
- kind: "min",
955
- inclusive: !0,
956
- value: Number.MIN_SAFE_INTEGER,
957
- message: p.toString(e)
958
- })._addCheck({
959
- kind: "max",
960
- inclusive: !0,
961
- value: Number.MAX_SAFE_INTEGER,
962
- message: p.toString(e)
963
- });
964
- }
965
- get minValue() {
966
- let e = null;
967
- for (const t of this._def.checks)
968
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
969
- return e;
970
- }
971
- get maxValue() {
972
- let e = null;
973
- for (const t of this._def.checks)
974
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
975
- return e;
976
- }
977
- get isInt() {
978
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
979
- }
980
- get isFinite() {
981
- let e = null, t = null;
982
- for (const r of this._def.checks) {
983
- if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
984
- return !0;
985
- r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
986
- }
987
- return Number.isFinite(t) && Number.isFinite(e);
988
- }
989
- }
990
- Z.create = (n) => new Z({
991
- checks: [],
992
- typeName: f.ZodNumber,
993
- coerce: (n == null ? void 0 : n.coerce) || !1,
994
- ..._(n)
995
- });
996
- class L extends y {
997
- constructor() {
998
- super(...arguments), this.min = this.gte, this.max = this.lte;
999
- }
1000
- _parse(e) {
1001
- if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== u.bigint) {
1002
- const a = this._getOrReturnCtx(e);
1003
- return l(a, {
1004
- code: c.invalid_type,
1005
- expected: u.bigint,
1006
- received: a.parsedType
1007
- }), m;
1008
- }
1009
- let r;
1010
- const s = new T();
1011
- for (const a of this._def.checks)
1012
- a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
1013
- code: c.too_small,
1014
- type: "bigint",
1015
- minimum: a.value,
1016
- inclusive: a.inclusive,
1017
- message: a.message
1018
- }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
1019
- code: c.too_big,
1020
- type: "bigint",
1021
- maximum: a.value,
1022
- inclusive: a.inclusive,
1023
- message: a.message
1024
- }), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), l(r, {
1025
- code: c.not_multiple_of,
1026
- multipleOf: a.value,
1027
- message: a.message
1028
- }), s.dirty()) : x.assertNever(a);
1029
- return { status: s.value, value: e.data };
1030
- }
1031
- gte(e, t) {
1032
- return this.setLimit("min", e, !0, p.toString(t));
1033
- }
1034
- gt(e, t) {
1035
- return this.setLimit("min", e, !1, p.toString(t));
1036
- }
1037
- lte(e, t) {
1038
- return this.setLimit("max", e, !0, p.toString(t));
1039
- }
1040
- lt(e, t) {
1041
- return this.setLimit("max", e, !1, p.toString(t));
1042
- }
1043
- setLimit(e, t, r, s) {
1044
- return new L({
1045
- ...this._def,
1046
- checks: [
1047
- ...this._def.checks,
1048
- {
1049
- kind: e,
1050
- value: t,
1051
- inclusive: r,
1052
- message: p.toString(s)
1053
- }
1054
- ]
1055
- });
1056
- }
1057
- _addCheck(e) {
1058
- return new L({
1059
- ...this._def,
1060
- checks: [...this._def.checks, e]
1061
- });
1062
- }
1063
- positive(e) {
1064
- return this._addCheck({
1065
- kind: "min",
1066
- value: BigInt(0),
1067
- inclusive: !1,
1068
- message: p.toString(e)
1069
- });
1070
- }
1071
- negative(e) {
1072
- return this._addCheck({
1073
- kind: "max",
1074
- value: BigInt(0),
1075
- inclusive: !1,
1076
- message: p.toString(e)
1077
- });
1078
- }
1079
- nonpositive(e) {
1080
- return this._addCheck({
1081
- kind: "max",
1082
- value: BigInt(0),
1083
- inclusive: !0,
1084
- message: p.toString(e)
1085
- });
1086
- }
1087
- nonnegative(e) {
1088
- return this._addCheck({
1089
- kind: "min",
1090
- value: BigInt(0),
1091
- inclusive: !0,
1092
- message: p.toString(e)
1093
- });
1094
- }
1095
- multipleOf(e, t) {
1096
- return this._addCheck({
1097
- kind: "multipleOf",
1098
- value: e,
1099
- message: p.toString(t)
1100
- });
1101
- }
1102
- get minValue() {
1103
- let e = null;
1104
- for (const t of this._def.checks)
1105
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1106
- return e;
1107
- }
1108
- get maxValue() {
1109
- let e = null;
1110
- for (const t of this._def.checks)
1111
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1112
- return e;
1113
- }
1114
- }
1115
- L.create = (n) => {
1116
- var e;
1117
- return new L({
1118
- checks: [],
1119
- typeName: f.ZodBigInt,
1120
- coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : !1,
1121
- ..._(n)
1122
- });
1123
- };
1124
- class q extends y {
1125
- _parse(e) {
1126
- if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== u.boolean) {
1127
- const r = this._getOrReturnCtx(e);
1128
- return l(r, {
1129
- code: c.invalid_type,
1130
- expected: u.boolean,
1131
- received: r.parsedType
1132
- }), m;
1133
- }
1134
- return b(e.data);
1135
- }
1136
- }
1137
- q.create = (n) => new q({
1138
- typeName: f.ZodBoolean,
1139
- coerce: (n == null ? void 0 : n.coerce) || !1,
1140
- ..._(n)
1141
- });
1142
- class P extends y {
1143
- _parse(e) {
1144
- if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== u.date) {
1145
- const a = this._getOrReturnCtx(e);
1146
- return l(a, {
1147
- code: c.invalid_type,
1148
- expected: u.date,
1149
- received: a.parsedType
1150
- }), m;
1151
- }
1152
- if (isNaN(e.data.getTime())) {
1153
- const a = this._getOrReturnCtx(e);
1154
- return l(a, {
1155
- code: c.invalid_date
1156
- }), m;
1157
- }
1158
- const r = new T();
1159
- let s;
1160
- for (const a of this._def.checks)
1161
- a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
1162
- code: c.too_small,
1163
- message: a.message,
1164
- inclusive: !0,
1165
- exact: !1,
1166
- minimum: a.value,
1167
- type: "date"
1168
- }), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
1169
- code: c.too_big,
1170
- message: a.message,
1171
- inclusive: !0,
1172
- exact: !1,
1173
- maximum: a.value,
1174
- type: "date"
1175
- }), r.dirty()) : x.assertNever(a);
1176
- return {
1177
- status: r.value,
1178
- value: new Date(e.data.getTime())
1179
- };
1180
- }
1181
- _addCheck(e) {
1182
- return new P({
1183
- ...this._def,
1184
- checks: [...this._def.checks, e]
1185
- });
1186
- }
1187
- min(e, t) {
1188
- return this._addCheck({
1189
- kind: "min",
1190
- value: e.getTime(),
1191
- message: p.toString(t)
1192
- });
1193
- }
1194
- max(e, t) {
1195
- return this._addCheck({
1196
- kind: "max",
1197
- value: e.getTime(),
1198
- message: p.toString(t)
1199
- });
1200
- }
1201
- get minDate() {
1202
- let e = null;
1203
- for (const t of this._def.checks)
1204
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1205
- return e != null ? new Date(e) : null;
1206
- }
1207
- get maxDate() {
1208
- let e = null;
1209
- for (const t of this._def.checks)
1210
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1211
- return e != null ? new Date(e) : null;
1212
- }
1213
- }
1214
- P.create = (n) => new P({
1215
- checks: [],
1216
- coerce: (n == null ? void 0 : n.coerce) || !1,
1217
- typeName: f.ZodDate,
1218
- ..._(n)
1219
- });
1220
- class ce extends y {
1221
- _parse(e) {
1222
- if (this._getType(e) !== u.symbol) {
1223
- const r = this._getOrReturnCtx(e);
1224
- return l(r, {
1225
- code: c.invalid_type,
1226
- expected: u.symbol,
1227
- received: r.parsedType
1228
- }), m;
1229
- }
1230
- return b(e.data);
1231
- }
1232
- }
1233
- ce.create = (n) => new ce({
1234
- typeName: f.ZodSymbol,
1235
- ..._(n)
1236
- });
1237
- class H extends y {
1238
- _parse(e) {
1239
- if (this._getType(e) !== u.undefined) {
1240
- const r = this._getOrReturnCtx(e);
1241
- return l(r, {
1242
- code: c.invalid_type,
1243
- expected: u.undefined,
1244
- received: r.parsedType
1245
- }), m;
1246
- }
1247
- return b(e.data);
1248
- }
1249
- }
1250
- H.create = (n) => new H({
1251
- typeName: f.ZodUndefined,
1252
- ..._(n)
1253
- });
1254
- class J extends y {
1255
- _parse(e) {
1256
- if (this._getType(e) !== u.null) {
1257
- const r = this._getOrReturnCtx(e);
1258
- return l(r, {
1259
- code: c.invalid_type,
1260
- expected: u.null,
1261
- received: r.parsedType
1262
- }), m;
1263
- }
1264
- return b(e.data);
1265
- }
1266
- }
1267
- J.create = (n) => new J({
1268
- typeName: f.ZodNull,
1269
- ..._(n)
1270
- });
1271
- class z extends y {
1272
- constructor() {
1273
- super(...arguments), this._any = !0;
1274
- }
1275
- _parse(e) {
1276
- return b(e.data);
1277
- }
1278
- }
1279
- z.create = (n) => new z({
1280
- typeName: f.ZodAny,
1281
- ..._(n)
1282
- });
1283
- class j extends y {
1284
- constructor() {
1285
- super(...arguments), this._unknown = !0;
1286
- }
1287
- _parse(e) {
1288
- return b(e.data);
1289
- }
1290
- }
1291
- j.create = (n) => new j({
1292
- typeName: f.ZodUnknown,
1293
- ..._(n)
1294
- });
1295
- class I extends y {
1296
- _parse(e) {
1297
- const t = this._getOrReturnCtx(e);
1298
- return l(t, {
1299
- code: c.invalid_type,
1300
- expected: u.never,
1301
- received: t.parsedType
1302
- }), m;
1303
- }
1304
- }
1305
- I.create = (n) => new I({
1306
- typeName: f.ZodNever,
1307
- ..._(n)
1308
- });
1309
- class de extends y {
1310
- _parse(e) {
1311
- if (this._getType(e) !== u.undefined) {
1312
- const r = this._getOrReturnCtx(e);
1313
- return l(r, {
1314
- code: c.invalid_type,
1315
- expected: u.void,
1316
- received: r.parsedType
1317
- }), m;
1318
- }
1319
- return b(e.data);
1320
- }
1321
- }
1322
- de.create = (n) => new de({
1323
- typeName: f.ZodVoid,
1324
- ..._(n)
1325
- });
1326
- class E extends y {
1327
- _parse(e) {
1328
- const { ctx: t, status: r } = this._processInputParams(e), s = this._def;
1329
- if (t.parsedType !== u.array)
1330
- return l(t, {
1331
- code: c.invalid_type,
1332
- expected: u.array,
1333
- received: t.parsedType
1334
- }), m;
1335
- if (s.exactLength !== null) {
1336
- const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
1337
- (i || o) && (l(t, {
1338
- code: i ? c.too_big : c.too_small,
1339
- minimum: o ? s.exactLength.value : void 0,
1340
- maximum: i ? s.exactLength.value : void 0,
1341
- type: "array",
1342
- inclusive: !0,
1343
- exact: !0,
1344
- message: s.exactLength.message
1345
- }), r.dirty());
1346
- }
1347
- if (s.minLength !== null && t.data.length < s.minLength.value && (l(t, {
1348
- code: c.too_small,
1349
- minimum: s.minLength.value,
1350
- type: "array",
1351
- inclusive: !0,
1352
- exact: !1,
1353
- message: s.minLength.message
1354
- }), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (l(t, {
1355
- code: c.too_big,
1356
- maximum: s.maxLength.value,
1357
- type: "array",
1358
- inclusive: !0,
1359
- exact: !1,
1360
- message: s.maxLength.message
1361
- }), r.dirty()), t.common.async)
1362
- return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new N(t, i, t.path, o)))).then((i) => T.mergeArray(r, i));
1363
- const a = [...t.data].map((i, o) => s.type._parseSync(new N(t, i, t.path, o)));
1364
- return T.mergeArray(r, a);
1365
- }
1366
- get element() {
1367
- return this._def.type;
1368
- }
1369
- min(e, t) {
1370
- return new E({
1371
- ...this._def,
1372
- minLength: { value: e, message: p.toString(t) }
1373
- });
1374
- }
1375
- max(e, t) {
1376
- return new E({
1377
- ...this._def,
1378
- maxLength: { value: e, message: p.toString(t) }
1379
- });
1380
- }
1381
- length(e, t) {
1382
- return new E({
1383
- ...this._def,
1384
- exactLength: { value: e, message: p.toString(t) }
1385
- });
1386
- }
1387
- nonempty(e) {
1388
- return this.min(1, e);
1389
- }
1390
- }
1391
- E.create = (n, e) => new E({
1392
- type: n,
1393
- minLength: null,
1394
- maxLength: null,
1395
- exactLength: null,
1396
- typeName: f.ZodArray,
1397
- ..._(e)
1398
- });
1399
- function U(n) {
1400
- if (n instanceof k) {
1401
- const e = {};
1402
- for (const t in n.shape) {
1403
- const r = n.shape[t];
1404
- e[t] = S.create(U(r));
1405
- }
1406
- return new k({
1407
- ...n._def,
1408
- shape: () => e
1409
- });
1410
- } else return n instanceof E ? new E({
1411
- ...n._def,
1412
- type: U(n.element)
1413
- }) : n instanceof S ? S.create(U(n.unwrap())) : n instanceof D ? D.create(U(n.unwrap())) : n instanceof C ? C.create(n.items.map((e) => U(e))) : n;
1414
- }
1415
- class k extends y {
1416
- constructor() {
1417
- super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1418
- }
1419
- _getCached() {
1420
- if (this._cached !== null)
1421
- return this._cached;
1422
- const e = this._def.shape(), t = x.objectKeys(e);
1423
- return this._cached = { shape: e, keys: t };
1424
- }
1425
- _parse(e) {
1426
- if (this._getType(e) !== u.object) {
1427
- const d = this._getOrReturnCtx(e);
1428
- return l(d, {
1429
- code: c.invalid_type,
1430
- expected: u.object,
1431
- received: d.parsedType
1432
- }), m;
1433
- }
1434
- const { status: r, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1435
- if (!(this._def.catchall instanceof I && this._def.unknownKeys === "strip"))
1436
- for (const d in s.data)
1437
- i.includes(d) || o.push(d);
1438
- const h = [];
1439
- for (const d of i) {
1440
- const v = a[d], w = s.data[d];
1441
- h.push({
1442
- key: { status: "valid", value: d },
1443
- value: v._parse(new N(s, w, s.path, d)),
1444
- alwaysSet: d in s.data
1445
- });
1446
- }
1447
- if (this._def.catchall instanceof I) {
1448
- const d = this._def.unknownKeys;
1449
- if (d === "passthrough")
1450
- for (const v of o)
1451
- h.push({
1452
- key: { status: "valid", value: v },
1453
- value: { status: "valid", value: s.data[v] }
1454
- });
1455
- else if (d === "strict")
1456
- o.length > 0 && (l(s, {
1457
- code: c.unrecognized_keys,
1458
- keys: o
1459
- }), r.dirty());
1460
- else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1461
- } else {
1462
- const d = this._def.catchall;
1463
- for (const v of o) {
1464
- const w = s.data[v];
1465
- h.push({
1466
- key: { status: "valid", value: v },
1467
- value: d._parse(
1468
- new N(s, w, s.path, v)
1469
- //, ctx.child(key), value, getParsedType(value)
1470
- ),
1471
- alwaysSet: v in s.data
1472
- });
1473
- }
1474
- }
1475
- return s.common.async ? Promise.resolve().then(async () => {
1476
- const d = [];
1477
- for (const v of h) {
1478
- const w = await v.key;
1479
- d.push({
1480
- key: w,
1481
- value: await v.value,
1482
- alwaysSet: v.alwaysSet
1483
- });
1484
- }
1485
- return d;
1486
- }).then((d) => T.mergeObjectSync(r, d)) : T.mergeObjectSync(r, h);
1487
- }
1488
- get shape() {
1489
- return this._def.shape();
1490
- }
1491
- strict(e) {
1492
- return p.errToObj, new k({
1493
- ...this._def,
1494
- unknownKeys: "strict",
1495
- ...e !== void 0 ? {
1496
- errorMap: (t, r) => {
1497
- var s, a, i, o;
1498
- const h = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, r).message) !== null && i !== void 0 ? i : r.defaultError;
1499
- return t.code === "unrecognized_keys" ? {
1500
- message: (o = p.errToObj(e).message) !== null && o !== void 0 ? o : h
1501
- } : {
1502
- message: h
1503
- };
1504
- }
1505
- } : {}
1506
- });
1507
- }
1508
- strip() {
1509
- return new k({
1510
- ...this._def,
1511
- unknownKeys: "strip"
1512
- });
1513
- }
1514
- passthrough() {
1515
- return new k({
1516
- ...this._def,
1517
- unknownKeys: "passthrough"
1518
- });
1519
- }
1520
- // const AugmentFactory =
1521
- // <Def extends ZodObjectDef>(def: Def) =>
1522
- // <Augmentation extends ZodRawShape>(
1523
- // augmentation: Augmentation
1524
- // ): ZodObject<
1525
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1526
- // Def["unknownKeys"],
1527
- // Def["catchall"]
1528
- // > => {
1529
- // return new ZodObject({
1530
- // ...def,
1531
- // shape: () => ({
1532
- // ...def.shape(),
1533
- // ...augmentation,
1534
- // }),
1535
- // }) as any;
1536
- // };
1537
- extend(e) {
1538
- return new k({
1539
- ...this._def,
1540
- shape: () => ({
1541
- ...this._def.shape(),
1542
- ...e
1543
- })
1544
- });
1545
- }
1546
- /**
1547
- * Prior to zod@1.0.12 there was a bug in the
1548
- * inferred type of merged objects. Please
1549
- * upgrade if you are experiencing issues.
1550
- */
1551
- merge(e) {
1552
- return new k({
1553
- unknownKeys: e._def.unknownKeys,
1554
- catchall: e._def.catchall,
1555
- shape: () => ({
1556
- ...this._def.shape(),
1557
- ...e._def.shape()
1558
- }),
1559
- typeName: f.ZodObject
1560
- });
1561
- }
1562
- // merge<
1563
- // Incoming extends AnyZodObject,
1564
- // Augmentation extends Incoming["shape"],
1565
- // NewOutput extends {
1566
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1567
- // ? Augmentation[k]["_output"]
1568
- // : k extends keyof Output
1569
- // ? Output[k]
1570
- // : never;
1571
- // },
1572
- // NewInput extends {
1573
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1574
- // ? Augmentation[k]["_input"]
1575
- // : k extends keyof Input
1576
- // ? Input[k]
1577
- // : never;
1578
- // }
1579
- // >(
1580
- // merging: Incoming
1581
- // ): ZodObject<
1582
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1583
- // Incoming["_def"]["unknownKeys"],
1584
- // Incoming["_def"]["catchall"],
1585
- // NewOutput,
1586
- // NewInput
1587
- // > {
1588
- // const merged: any = new ZodObject({
1589
- // unknownKeys: merging._def.unknownKeys,
1590
- // catchall: merging._def.catchall,
1591
- // shape: () =>
1592
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1593
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1594
- // }) as any;
1595
- // return merged;
1596
- // }
1597
- setKey(e, t) {
1598
- return this.augment({ [e]: t });
1599
- }
1600
- // merge<Incoming extends AnyZodObject>(
1601
- // merging: Incoming
1602
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1603
- // ZodObject<
1604
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1605
- // Incoming["_def"]["unknownKeys"],
1606
- // Incoming["_def"]["catchall"]
1607
- // > {
1608
- // // const mergedShape = objectUtil.mergeShapes(
1609
- // // this._def.shape(),
1610
- // // merging._def.shape()
1611
- // // );
1612
- // const merged: any = new ZodObject({
1613
- // unknownKeys: merging._def.unknownKeys,
1614
- // catchall: merging._def.catchall,
1615
- // shape: () =>
1616
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1617
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1618
- // }) as any;
1619
- // return merged;
1620
- // }
1621
- catchall(e) {
1622
- return new k({
1623
- ...this._def,
1624
- catchall: e
1625
- });
1626
- }
1627
- pick(e) {
1628
- const t = {};
1629
- return x.objectKeys(e).forEach((r) => {
1630
- e[r] && this.shape[r] && (t[r] = this.shape[r]);
1631
- }), new k({
1632
- ...this._def,
1633
- shape: () => t
1634
- });
1635
- }
1636
- omit(e) {
1637
- const t = {};
1638
- return x.objectKeys(this.shape).forEach((r) => {
1639
- e[r] || (t[r] = this.shape[r]);
1640
- }), new k({
1641
- ...this._def,
1642
- shape: () => t
1643
- });
1644
- }
1645
- /**
1646
- * @deprecated
1647
- */
1648
- deepPartial() {
1649
- return U(this);
1650
- }
1651
- partial(e) {
1652
- const t = {};
1653
- return x.objectKeys(this.shape).forEach((r) => {
1654
- const s = this.shape[r];
1655
- e && !e[r] ? t[r] = s : t[r] = s.optional();
1656
- }), new k({
1657
- ...this._def,
1658
- shape: () => t
1659
- });
1660
- }
1661
- required(e) {
1662
- const t = {};
1663
- return x.objectKeys(this.shape).forEach((r) => {
1664
- if (e && !e[r])
1665
- t[r] = this.shape[r];
1666
- else {
1667
- let a = this.shape[r];
1668
- for (; a instanceof S; )
1669
- a = a._def.innerType;
1670
- t[r] = a;
1671
- }
1672
- }), new k({
1673
- ...this._def,
1674
- shape: () => t
1675
- });
1676
- }
1677
- keyof() {
1678
- return Oe(x.objectKeys(this.shape));
1679
- }
1680
- }
1681
- k.create = (n, e) => new k({
1682
- shape: () => n,
1683
- unknownKeys: "strip",
1684
- catchall: I.create(),
1685
- typeName: f.ZodObject,
1686
- ..._(e)
1687
- });
1688
- k.strictCreate = (n, e) => new k({
1689
- shape: () => n,
1690
- unknownKeys: "strict",
1691
- catchall: I.create(),
1692
- typeName: f.ZodObject,
1693
- ..._(e)
1694
- });
1695
- k.lazycreate = (n, e) => new k({
1696
- shape: n,
1697
- unknownKeys: "strip",
1698
- catchall: I.create(),
1699
- typeName: f.ZodObject,
1700
- ..._(e)
1701
- });
1702
- class X extends y {
1703
- _parse(e) {
1704
- const { ctx: t } = this._processInputParams(e), r = this._def.options;
1705
- function s(a) {
1706
- for (const o of a)
1707
- if (o.result.status === "valid")
1708
- return o.result;
1709
- for (const o of a)
1710
- if (o.result.status === "dirty")
1711
- return t.common.issues.push(...o.ctx.common.issues), o.result;
1712
- const i = a.map((o) => new R(o.ctx.common.issues));
1713
- return l(t, {
1714
- code: c.invalid_union,
1715
- unionErrors: i
1716
- }), m;
1717
- }
1718
- if (t.common.async)
1719
- return Promise.all(r.map(async (a) => {
1720
- const i = {
1721
- ...t,
1722
- common: {
1723
- ...t.common,
1724
- issues: []
1725
- },
1726
- parent: null
1727
- };
1728
- return {
1729
- result: await a._parseAsync({
1730
- data: t.data,
1731
- path: t.path,
1732
- parent: i
1733
- }),
1734
- ctx: i
1735
- };
1736
- })).then(s);
1737
- {
1738
- let a;
1739
- const i = [];
1740
- for (const h of r) {
1741
- const d = {
1742
- ...t,
1743
- common: {
1744
- ...t.common,
1745
- issues: []
1746
- },
1747
- parent: null
1748
- }, v = h._parseSync({
1749
- data: t.data,
1750
- path: t.path,
1751
- parent: d
1752
- });
1753
- if (v.status === "valid")
1754
- return v;
1755
- v.status === "dirty" && !a && (a = { result: v, ctx: d }), d.common.issues.length && i.push(d.common.issues);
1756
- }
1757
- if (a)
1758
- return t.common.issues.push(...a.ctx.common.issues), a.result;
1759
- const o = i.map((h) => new R(h));
1760
- return l(t, {
1761
- code: c.invalid_union,
1762
- unionErrors: o
1763
- }), m;
1764
- }
1765
- }
1766
- get options() {
1767
- return this._def.options;
1768
- }
1769
- }
1770
- X.create = (n, e) => new X({
1771
- options: n,
1772
- typeName: f.ZodUnion,
1773
- ..._(e)
1774
- });
1775
- const se = (n) => n instanceof F ? se(n.schema) : n instanceof A ? se(n.innerType()) : n instanceof ee ? [n.value] : n instanceof $ ? n.options : n instanceof te ? Object.keys(n.enum) : n instanceof ne ? se(n._def.innerType) : n instanceof H ? [void 0] : n instanceof J ? [null] : null;
1776
- class fe extends y {
1777
- _parse(e) {
1778
- const { ctx: t } = this._processInputParams(e);
1779
- if (t.parsedType !== u.object)
1780
- return l(t, {
1781
- code: c.invalid_type,
1782
- expected: u.object,
1783
- received: t.parsedType
1784
- }), m;
1785
- const r = this.discriminator, s = t.data[r], a = this.optionsMap.get(s);
1786
- return a ? t.common.async ? a._parseAsync({
1787
- data: t.data,
1788
- path: t.path,
1789
- parent: t
1790
- }) : a._parseSync({
1791
- data: t.data,
1792
- path: t.path,
1793
- parent: t
1794
- }) : (l(t, {
1795
- code: c.invalid_union_discriminator,
1796
- options: Array.from(this.optionsMap.keys()),
1797
- path: [r]
1798
- }), m);
1799
- }
1800
- get discriminator() {
1801
- return this._def.discriminator;
1802
- }
1803
- get options() {
1804
- return this._def.options;
1805
- }
1806
- get optionsMap() {
1807
- return this._def.optionsMap;
1808
- }
1809
- /**
1810
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
1811
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
1812
- * have a different value for each object in the union.
1813
- * @param discriminator the name of the discriminator property
1814
- * @param types an array of object schemas
1815
- * @param params
1816
- */
1817
- static create(e, t, r) {
1818
- const s = /* @__PURE__ */ new Map();
1819
- for (const a of t) {
1820
- const i = se(a.shape[e]);
1821
- if (!i)
1822
- throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
1823
- for (const o of i) {
1824
- if (s.has(o))
1825
- throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
1826
- s.set(o, a);
1827
- }
1828
- }
1829
- return new fe({
1830
- typeName: f.ZodDiscriminatedUnion,
1831
- discriminator: e,
1832
- options: t,
1833
- optionsMap: s,
1834
- ..._(r)
1835
- });
1836
- }
1837
- }
1838
- function xe(n, e) {
1839
- const t = M(n), r = M(e);
1840
- if (n === e)
1841
- return { valid: !0, data: n };
1842
- if (t === u.object && r === u.object) {
1843
- const s = x.objectKeys(e), a = x.objectKeys(n).filter((o) => s.indexOf(o) !== -1), i = { ...n, ...e };
1844
- for (const o of a) {
1845
- const h = xe(n[o], e[o]);
1846
- if (!h.valid)
1847
- return { valid: !1 };
1848
- i[o] = h.data;
1849
- }
1850
- return { valid: !0, data: i };
1851
- } else if (t === u.array && r === u.array) {
1852
- if (n.length !== e.length)
1853
- return { valid: !1 };
1854
- const s = [];
1855
- for (let a = 0; a < n.length; a++) {
1856
- const i = n[a], o = e[a], h = xe(i, o);
1857
- if (!h.valid)
1858
- return { valid: !1 };
1859
- s.push(h.data);
1860
- }
1861
- return { valid: !0, data: s };
1862
- } else return t === u.date && r === u.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
1863
- }
1864
- class K extends y {
1865
- _parse(e) {
1866
- const { status: t, ctx: r } = this._processInputParams(e), s = (a, i) => {
1867
- if (ve(a) || ve(i))
1868
- return m;
1869
- const o = xe(a.value, i.value);
1870
- return o.valid ? ((ge(a) || ge(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(r, {
1871
- code: c.invalid_intersection_types
1872
- }), m);
1873
- };
1874
- return r.common.async ? Promise.all([
1875
- this._def.left._parseAsync({
1876
- data: r.data,
1877
- path: r.path,
1878
- parent: r
1879
- }),
1880
- this._def.right._parseAsync({
1881
- data: r.data,
1882
- path: r.path,
1883
- parent: r
1884
- })
1885
- ]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
1886
- data: r.data,
1887
- path: r.path,
1888
- parent: r
1889
- }), this._def.right._parseSync({
1890
- data: r.data,
1891
- path: r.path,
1892
- parent: r
1893
- }));
1894
- }
1895
- }
1896
- K.create = (n, e, t) => new K({
1897
- left: n,
1898
- right: e,
1899
- typeName: f.ZodIntersection,
1900
- ..._(t)
1901
- });
1902
- class C extends y {
1903
- _parse(e) {
1904
- const { status: t, ctx: r } = this._processInputParams(e);
1905
- if (r.parsedType !== u.array)
1906
- return l(r, {
1907
- code: c.invalid_type,
1908
- expected: u.array,
1909
- received: r.parsedType
1910
- }), m;
1911
- if (r.data.length < this._def.items.length)
1912
- return l(r, {
1913
- code: c.too_small,
1914
- minimum: this._def.items.length,
1915
- inclusive: !0,
1916
- exact: !1,
1917
- type: "array"
1918
- }), m;
1919
- !this._def.rest && r.data.length > this._def.items.length && (l(r, {
1920
- code: c.too_big,
1921
- maximum: this._def.items.length,
1922
- inclusive: !0,
1923
- exact: !1,
1924
- type: "array"
1925
- }), t.dirty());
1926
- const a = [...r.data].map((i, o) => {
1927
- const h = this._def.items[o] || this._def.rest;
1928
- return h ? h._parse(new N(r, i, r.path, o)) : null;
1929
- }).filter((i) => !!i);
1930
- return r.common.async ? Promise.all(a).then((i) => T.mergeArray(t, i)) : T.mergeArray(t, a);
1931
- }
1932
- get items() {
1933
- return this._def.items;
1934
- }
1935
- rest(e) {
1936
- return new C({
1937
- ...this._def,
1938
- rest: e
1939
- });
1940
- }
1941
- }
1942
- C.create = (n, e) => {
1943
- if (!Array.isArray(n))
1944
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
1945
- return new C({
1946
- items: n,
1947
- typeName: f.ZodTuple,
1948
- rest: null,
1949
- ..._(e)
1950
- });
1951
- };
1952
- class Q extends y {
1953
- get keySchema() {
1954
- return this._def.keyType;
1955
- }
1956
- get valueSchema() {
1957
- return this._def.valueType;
1958
- }
1959
- _parse(e) {
1960
- const { status: t, ctx: r } = this._processInputParams(e);
1961
- if (r.parsedType !== u.object)
1962
- return l(r, {
1963
- code: c.invalid_type,
1964
- expected: u.object,
1965
- received: r.parsedType
1966
- }), m;
1967
- const s = [], a = this._def.keyType, i = this._def.valueType;
1968
- for (const o in r.data)
1969
- s.push({
1970
- key: a._parse(new N(r, o, r.path, o)),
1971
- value: i._parse(new N(r, r.data[o], r.path, o))
1972
- });
1973
- return r.common.async ? T.mergeObjectAsync(t, s) : T.mergeObjectSync(t, s);
1974
- }
1975
- get element() {
1976
- return this._def.valueType;
1977
- }
1978
- static create(e, t, r) {
1979
- return t instanceof y ? new Q({
1980
- keyType: e,
1981
- valueType: t,
1982
- typeName: f.ZodRecord,
1983
- ..._(r)
1984
- }) : new Q({
1985
- keyType: O.create(),
1986
- valueType: e,
1987
- typeName: f.ZodRecord,
1988
- ..._(t)
1989
- });
1990
- }
1991
- }
1992
- class ue extends y {
1993
- get keySchema() {
1994
- return this._def.keyType;
1995
- }
1996
- get valueSchema() {
1997
- return this._def.valueType;
1998
- }
1999
- _parse(e) {
2000
- const { status: t, ctx: r } = this._processInputParams(e);
2001
- if (r.parsedType !== u.map)
2002
- return l(r, {
2003
- code: c.invalid_type,
2004
- expected: u.map,
2005
- received: r.parsedType
2006
- }), m;
2007
- const s = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, h], d) => ({
2008
- key: s._parse(new N(r, o, r.path, [d, "key"])),
2009
- value: a._parse(new N(r, h, r.path, [d, "value"]))
2010
- }));
2011
- if (r.common.async) {
2012
- const o = /* @__PURE__ */ new Map();
2013
- return Promise.resolve().then(async () => {
2014
- for (const h of i) {
2015
- const d = await h.key, v = await h.value;
2016
- if (d.status === "aborted" || v.status === "aborted")
2017
- return m;
2018
- (d.status === "dirty" || v.status === "dirty") && t.dirty(), o.set(d.value, v.value);
2019
- }
2020
- return { status: t.value, value: o };
2021
- });
2022
- } else {
2023
- const o = /* @__PURE__ */ new Map();
2024
- for (const h of i) {
2025
- const d = h.key, v = h.value;
2026
- if (d.status === "aborted" || v.status === "aborted")
2027
- return m;
2028
- (d.status === "dirty" || v.status === "dirty") && t.dirty(), o.set(d.value, v.value);
2029
- }
2030
- return { status: t.value, value: o };
2031
- }
2032
- }
2033
- }
2034
- ue.create = (n, e, t) => new ue({
2035
- valueType: e,
2036
- keyType: n,
2037
- typeName: f.ZodMap,
2038
- ..._(t)
2039
- });
2040
- class V extends y {
2041
- _parse(e) {
2042
- const { status: t, ctx: r } = this._processInputParams(e);
2043
- if (r.parsedType !== u.set)
2044
- return l(r, {
2045
- code: c.invalid_type,
2046
- expected: u.set,
2047
- received: r.parsedType
2048
- }), m;
2049
- const s = this._def;
2050
- s.minSize !== null && r.data.size < s.minSize.value && (l(r, {
2051
- code: c.too_small,
2052
- minimum: s.minSize.value,
2053
- type: "set",
2054
- inclusive: !0,
2055
- exact: !1,
2056
- message: s.minSize.message
2057
- }), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (l(r, {
2058
- code: c.too_big,
2059
- maximum: s.maxSize.value,
2060
- type: "set",
2061
- inclusive: !0,
2062
- exact: !1,
2063
- message: s.maxSize.message
2064
- }), t.dirty());
2065
- const a = this._def.valueType;
2066
- function i(h) {
2067
- const d = /* @__PURE__ */ new Set();
2068
- for (const v of h) {
2069
- if (v.status === "aborted")
2070
- return m;
2071
- v.status === "dirty" && t.dirty(), d.add(v.value);
2072
- }
2073
- return { status: t.value, value: d };
2074
- }
2075
- const o = [...r.data.values()].map((h, d) => a._parse(new N(r, h, r.path, d)));
2076
- return r.common.async ? Promise.all(o).then((h) => i(h)) : i(o);
2077
- }
2078
- min(e, t) {
2079
- return new V({
2080
- ...this._def,
2081
- minSize: { value: e, message: p.toString(t) }
2082
- });
2083
- }
2084
- max(e, t) {
2085
- return new V({
2086
- ...this._def,
2087
- maxSize: { value: e, message: p.toString(t) }
2088
- });
2089
- }
2090
- size(e, t) {
2091
- return this.min(e, t).max(e, t);
2092
- }
2093
- nonempty(e) {
2094
- return this.min(1, e);
2095
- }
2096
- }
2097
- V.create = (n, e) => new V({
2098
- valueType: n,
2099
- minSize: null,
2100
- maxSize: null,
2101
- typeName: f.ZodSet,
2102
- ..._(e)
2103
- });
2104
- class B extends y {
2105
- constructor() {
2106
- super(...arguments), this.validate = this.implement;
2107
- }
2108
- _parse(e) {
2109
- const { ctx: t } = this._processInputParams(e);
2110
- if (t.parsedType !== u.function)
2111
- return l(t, {
2112
- code: c.invalid_type,
2113
- expected: u.function,
2114
- received: t.parsedType
2115
- }), m;
2116
- function r(o, h) {
2117
- return ie({
2118
- data: o,
2119
- path: t.path,
2120
- errorMaps: [
2121
- t.common.contextualErrorMap,
2122
- t.schemaErrorMap,
2123
- ae(),
2124
- Y
2125
- ].filter((d) => !!d),
2126
- issueData: {
2127
- code: c.invalid_arguments,
2128
- argumentsError: h
2129
- }
2130
- });
2131
- }
2132
- function s(o, h) {
2133
- return ie({
2134
- data: o,
2135
- path: t.path,
2136
- errorMaps: [
2137
- t.common.contextualErrorMap,
2138
- t.schemaErrorMap,
2139
- ae(),
2140
- Y
2141
- ].filter((d) => !!d),
2142
- issueData: {
2143
- code: c.invalid_return_type,
2144
- returnTypeError: h
2145
- }
2146
- });
2147
- }
2148
- const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2149
- if (this._def.returns instanceof G) {
2150
- const o = this;
2151
- return b(async function(...h) {
2152
- const d = new R([]), v = await o._def.args.parseAsync(h, a).catch((me) => {
2153
- throw d.addIssue(r(h, me)), d;
2154
- }), w = await Reflect.apply(i, this, v);
2155
- return await o._def.returns._def.type.parseAsync(w, a).catch((me) => {
2156
- throw d.addIssue(s(w, me)), d;
2157
- });
2158
- });
2159
- } else {
2160
- const o = this;
2161
- return b(function(...h) {
2162
- const d = o._def.args.safeParse(h, a);
2163
- if (!d.success)
2164
- throw new R([r(h, d.error)]);
2165
- const v = Reflect.apply(i, this, d.data), w = o._def.returns.safeParse(v, a);
2166
- if (!w.success)
2167
- throw new R([s(v, w.error)]);
2168
- return w.data;
2169
- });
2170
- }
2171
- }
2172
- parameters() {
2173
- return this._def.args;
2174
- }
2175
- returnType() {
2176
- return this._def.returns;
2177
- }
2178
- args(...e) {
2179
- return new B({
2180
- ...this._def,
2181
- args: C.create(e).rest(j.create())
2182
- });
2183
- }
2184
- returns(e) {
2185
- return new B({
2186
- ...this._def,
2187
- returns: e
2188
- });
2189
- }
2190
- implement(e) {
2191
- return this.parse(e);
2192
- }
2193
- strictImplement(e) {
2194
- return this.parse(e);
2195
- }
2196
- static create(e, t, r) {
2197
- return new B({
2198
- args: e || C.create([]).rest(j.create()),
2199
- returns: t || j.create(),
2200
- typeName: f.ZodFunction,
2201
- ..._(r)
2202
- });
2203
- }
2204
- }
2205
- class F extends y {
2206
- get schema() {
2207
- return this._def.getter();
2208
- }
2209
- _parse(e) {
2210
- const { ctx: t } = this._processInputParams(e);
2211
- return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2212
- }
2213
- }
2214
- F.create = (n, e) => new F({
2215
- getter: n,
2216
- typeName: f.ZodLazy,
2217
- ..._(e)
2218
- });
2219
- class ee extends y {
2220
- _parse(e) {
2221
- if (e.data !== this._def.value) {
2222
- const t = this._getOrReturnCtx(e);
2223
- return l(t, {
2224
- received: t.data,
2225
- code: c.invalid_literal,
2226
- expected: this._def.value
2227
- }), m;
2228
- }
2229
- return { status: "valid", value: e.data };
2230
- }
2231
- get value() {
2232
- return this._def.value;
2233
- }
2234
- }
2235
- ee.create = (n, e) => new ee({
2236
- value: n,
2237
- typeName: f.ZodLiteral,
2238
- ..._(e)
2239
- });
2240
- function Oe(n, e) {
2241
- return new $({
2242
- values: n,
2243
- typeName: f.ZodEnum,
2244
- ..._(e)
2245
- });
2246
- }
2247
- class $ extends y {
2248
- _parse(e) {
2249
- if (typeof e.data != "string") {
2250
- const t = this._getOrReturnCtx(e), r = this._def.values;
2251
- return l(t, {
2252
- expected: x.joinValues(r),
2253
- received: t.parsedType,
2254
- code: c.invalid_type
2255
- }), m;
2256
- }
2257
- if (this._def.values.indexOf(e.data) === -1) {
2258
- const t = this._getOrReturnCtx(e), r = this._def.values;
2259
- return l(t, {
2260
- received: t.data,
2261
- code: c.invalid_enum_value,
2262
- options: r
2263
- }), m;
2264
- }
2265
- return b(e.data);
2266
- }
2267
- get options() {
2268
- return this._def.values;
2269
- }
2270
- get enum() {
2271
- const e = {};
2272
- for (const t of this._def.values)
2273
- e[t] = t;
2274
- return e;
2275
- }
2276
- get Values() {
2277
- const e = {};
2278
- for (const t of this._def.values)
2279
- e[t] = t;
2280
- return e;
2281
- }
2282
- get Enum() {
2283
- const e = {};
2284
- for (const t of this._def.values)
2285
- e[t] = t;
2286
- return e;
2287
- }
2288
- extract(e) {
2289
- return $.create(e);
2290
- }
2291
- exclude(e) {
2292
- return $.create(this.options.filter((t) => !e.includes(t)));
2293
- }
2294
- }
2295
- $.create = Oe;
2296
- class te extends y {
2297
- _parse(e) {
2298
- const t = x.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
2299
- if (r.parsedType !== u.string && r.parsedType !== u.number) {
2300
- const s = x.objectValues(t);
2301
- return l(r, {
2302
- expected: x.joinValues(s),
2303
- received: r.parsedType,
2304
- code: c.invalid_type
2305
- }), m;
2306
- }
2307
- if (t.indexOf(e.data) === -1) {
2308
- const s = x.objectValues(t);
2309
- return l(r, {
2310
- received: r.data,
2311
- code: c.invalid_enum_value,
2312
- options: s
2313
- }), m;
2314
- }
2315
- return b(e.data);
2316
- }
2317
- get enum() {
2318
- return this._def.values;
2319
- }
2320
- }
2321
- te.create = (n, e) => new te({
2322
- values: n,
2323
- typeName: f.ZodNativeEnum,
2324
- ..._(e)
2325
- });
2326
- class G extends y {
2327
- unwrap() {
2328
- return this._def.type;
2329
- }
2330
- _parse(e) {
2331
- const { ctx: t } = this._processInputParams(e);
2332
- if (t.parsedType !== u.promise && t.common.async === !1)
2333
- return l(t, {
2334
- code: c.invalid_type,
2335
- expected: u.promise,
2336
- received: t.parsedType
2337
- }), m;
2338
- const r = t.parsedType === u.promise ? t.data : Promise.resolve(t.data);
2339
- return b(r.then((s) => this._def.type.parseAsync(s, {
2340
- path: t.path,
2341
- errorMap: t.common.contextualErrorMap
2342
- })));
2343
- }
2344
- }
2345
- G.create = (n, e) => new G({
2346
- type: n,
2347
- typeName: f.ZodPromise,
2348
- ..._(e)
2349
- });
2350
- class A extends y {
2351
- innerType() {
2352
- return this._def.schema;
2353
- }
2354
- sourceType() {
2355
- return this._def.schema._def.typeName === f.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2356
- }
2357
- _parse(e) {
2358
- const { status: t, ctx: r } = this._processInputParams(e), s = this._def.effect || null, a = {
2359
- addIssue: (i) => {
2360
- l(r, i), i.fatal ? t.abort() : t.dirty();
2361
- },
2362
- get path() {
2363
- return r.path;
2364
- }
2365
- };
2366
- if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
2367
- const i = s.transform(r.data, a);
2368
- return r.common.issues.length ? {
2369
- status: "dirty",
2370
- value: r.data
2371
- } : r.common.async ? Promise.resolve(i).then((o) => this._def.schema._parseAsync({
2372
- data: o,
2373
- path: r.path,
2374
- parent: r
2375
- })) : this._def.schema._parseSync({
2376
- data: i,
2377
- path: r.path,
2378
- parent: r
2379
- });
2380
- }
2381
- if (s.type === "refinement") {
2382
- const i = (o) => {
2383
- const h = s.refinement(o, a);
2384
- if (r.common.async)
2385
- return Promise.resolve(h);
2386
- if (h instanceof Promise)
2387
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2388
- return o;
2389
- };
2390
- if (r.common.async === !1) {
2391
- const o = this._def.schema._parseSync({
2392
- data: r.data,
2393
- path: r.path,
2394
- parent: r
2395
- });
2396
- return o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2397
- } else
2398
- return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2399
- }
2400
- if (s.type === "transform")
2401
- if (r.common.async === !1) {
2402
- const i = this._def.schema._parseSync({
2403
- data: r.data,
2404
- path: r.path,
2405
- parent: r
2406
- });
2407
- if (!W(i))
2408
- return i;
2409
- const o = s.transform(i.value, a);
2410
- if (o instanceof Promise)
2411
- throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2412
- return { status: t.value, value: o };
2413
- } else
2414
- return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => W(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2415
- x.assertNever(s);
2416
- }
2417
- }
2418
- A.create = (n, e, t) => new A({
2419
- schema: n,
2420
- typeName: f.ZodEffects,
2421
- effect: e,
2422
- ..._(t)
2423
- });
2424
- A.createWithPreprocess = (n, e, t) => new A({
2425
- schema: e,
2426
- effect: { type: "preprocess", transform: n },
2427
- typeName: f.ZodEffects,
2428
- ..._(t)
2429
- });
2430
- class S extends y {
2431
- _parse(e) {
2432
- return this._getType(e) === u.undefined ? b(void 0) : this._def.innerType._parse(e);
2433
- }
2434
- unwrap() {
2435
- return this._def.innerType;
2436
- }
2437
- }
2438
- S.create = (n, e) => new S({
2439
- innerType: n,
2440
- typeName: f.ZodOptional,
2441
- ..._(e)
2442
- });
2443
- class D extends y {
2444
- _parse(e) {
2445
- return this._getType(e) === u.null ? b(null) : this._def.innerType._parse(e);
2446
- }
2447
- unwrap() {
2448
- return this._def.innerType;
2449
- }
2450
- }
2451
- D.create = (n, e) => new D({
2452
- innerType: n,
2453
- typeName: f.ZodNullable,
2454
- ..._(e)
2455
- });
2456
- class ne extends y {
2457
- _parse(e) {
2458
- const { ctx: t } = this._processInputParams(e);
2459
- let r = t.data;
2460
- return t.parsedType === u.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
2461
- data: r,
2462
- path: t.path,
2463
- parent: t
2464
- });
2465
- }
2466
- removeDefault() {
2467
- return this._def.innerType;
2468
- }
2469
- }
2470
- ne.create = (n, e) => new ne({
2471
- innerType: n,
2472
- typeName: f.ZodDefault,
2473
- defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2474
- ..._(e)
2475
- });
2476
- class le extends y {
2477
- _parse(e) {
2478
- const { ctx: t } = this._processInputParams(e), r = {
2479
- ...t,
2480
- common: {
2481
- ...t.common,
2482
- issues: []
2483
- }
2484
- }, s = this._def.innerType._parse({
2485
- data: r.data,
2486
- path: r.path,
2487
- parent: {
2488
- ...r
2489
- }
2490
- });
2491
- return oe(s) ? s.then((a) => ({
2492
- status: "valid",
2493
- value: a.status === "valid" ? a.value : this._def.catchValue({
2494
- get error() {
2495
- return new R(r.common.issues);
2496
- },
2497
- input: r.data
2498
- })
2499
- })) : {
2500
- status: "valid",
2501
- value: s.status === "valid" ? s.value : this._def.catchValue({
2502
- get error() {
2503
- return new R(r.common.issues);
2504
- },
2505
- input: r.data
2506
- })
2507
- };
2508
- }
2509
- removeCatch() {
2510
- return this._def.innerType;
2511
- }
2512
- }
2513
- le.create = (n, e) => new le({
2514
- innerType: n,
2515
- typeName: f.ZodCatch,
2516
- catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2517
- ..._(e)
2518
- });
2519
- class he extends y {
2520
- _parse(e) {
2521
- if (this._getType(e) !== u.nan) {
2522
- const r = this._getOrReturnCtx(e);
2523
- return l(r, {
2524
- code: c.invalid_type,
2525
- expected: u.nan,
2526
- received: r.parsedType
2527
- }), m;
2528
- }
2529
- return { status: "valid", value: e.data };
2530
- }
2531
- }
2532
- he.create = (n) => new he({
2533
- typeName: f.ZodNaN,
2534
- ..._(n)
2535
- });
2536
- const Ye = Symbol("zod_brand");
2537
- class Re extends y {
2538
- _parse(e) {
2539
- const { ctx: t } = this._processInputParams(e), r = t.data;
2540
- return this._def.type._parse({
2541
- data: r,
2542
- path: t.path,
2543
- parent: t
2544
- });
2545
- }
2546
- unwrap() {
2547
- return this._def.type;
2548
- }
2549
- }
2550
- class re extends y {
2551
- _parse(e) {
2552
- const { status: t, ctx: r } = this._processInputParams(e);
2553
- if (r.common.async)
2554
- return (async () => {
2555
- const a = await this._def.in._parseAsync({
2556
- data: r.data,
2557
- path: r.path,
2558
- parent: r
2559
- });
2560
- return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), we(a.value)) : this._def.out._parseAsync({
2561
- data: a.value,
2562
- path: r.path,
2563
- parent: r
2564
- });
2565
- })();
2566
- {
2567
- const s = this._def.in._parseSync({
2568
- data: r.data,
2569
- path: r.path,
2570
- parent: r
2571
- });
2572
- return s.status === "aborted" ? m : s.status === "dirty" ? (t.dirty(), {
2573
- status: "dirty",
2574
- value: s.value
2575
- }) : this._def.out._parseSync({
2576
- data: s.value,
2577
- path: r.path,
2578
- parent: r
2579
- });
2580
- }
2581
- }
2582
- static create(e, t) {
2583
- return new re({
2584
- in: e,
2585
- out: t,
2586
- typeName: f.ZodPipeline
2587
- });
2588
- }
2589
- }
2590
- class pe extends y {
2591
- _parse(e) {
2592
- const t = this._def.innerType._parse(e);
2593
- return W(t) && (t.value = Object.freeze(t.value)), t;
2594
- }
2595
- }
2596
- pe.create = (n, e) => new pe({
2597
- innerType: n,
2598
- typeName: f.ZodReadonly,
2599
- ..._(e)
2600
- });
2601
- const Ee = (n, e = {}, t) => n ? z.create().superRefine((r, s) => {
2602
- var a, i;
2603
- if (!n(r)) {
2604
- const o = typeof e == "function" ? e(r) : typeof e == "string" ? { message: e } : e, h = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, d = typeof o == "string" ? { message: o } : o;
2605
- s.addIssue({ code: "custom", ...d, fatal: h });
2606
- }
2607
- }) : z.create(), We = {
2608
- object: k.lazycreate
2609
- };
2610
- var f;
2611
- (function(n) {
2612
- 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";
2613
- })(f || (f = {}));
2614
- const qe = (n, e = {
2615
- message: `Input not instance of ${n.name}`
2616
- }) => Ee((t) => t instanceof n, e), Ae = O.create, Ne = Z.create, He = he.create, Je = L.create, Ce = q.create, Xe = P.create, Ke = ce.create, Qe = H.create, Fe = J.create, et = z.create, tt = j.create, nt = I.create, rt = de.create, st = E.create, at = k.create, it = k.strictCreate, ot = X.create, ct = fe.create, dt = K.create, ut = C.create, lt = Q.create, ht = ue.create, pt = V.create, ft = B.create, mt = F.create, _t = ee.create, yt = $.create, vt = te.create, gt = G.create, Te = A.create, xt = S.create, kt = D.create, Tt = A.createWithPreprocess, bt = re.create, wt = () => Ae().optional(), Ot = () => Ne().optional(), Rt = () => Ce().optional(), Et = {
2617
- string: (n) => O.create({ ...n, coerce: !0 }),
2618
- number: (n) => Z.create({ ...n, coerce: !0 }),
2619
- boolean: (n) => q.create({
2620
- ...n,
2621
- coerce: !0
2622
- }),
2623
- bigint: (n) => L.create({ ...n, coerce: !0 }),
2624
- date: (n) => P.create({ ...n, coerce: !0 })
2625
- }, At = m;
2626
- var Nt = /* @__PURE__ */ Object.freeze({
2627
- __proto__: null,
2628
- defaultErrorMap: Y,
2629
- setErrorMap: Ie,
2630
- getErrorMap: ae,
2631
- makeIssue: ie,
2632
- EMPTY_PATH: Me,
2633
- addIssueToContext: l,
2634
- ParseStatus: T,
2635
- INVALID: m,
2636
- DIRTY: we,
2637
- OK: b,
2638
- isAborted: ve,
2639
- isDirty: ge,
2640
- isValid: W,
2641
- isAsync: oe,
2642
- get util() {
2643
- return x;
2644
- },
2645
- get objectUtil() {
2646
- return ye;
2647
- },
2648
- ZodParsedType: u,
2649
- getParsedType: M,
2650
- ZodType: y,
2651
- ZodString: O,
2652
- ZodNumber: Z,
2653
- ZodBigInt: L,
2654
- ZodBoolean: q,
2655
- ZodDate: P,
2656
- ZodSymbol: ce,
2657
- ZodUndefined: H,
2658
- ZodNull: J,
2659
- ZodAny: z,
2660
- ZodUnknown: j,
2661
- ZodNever: I,
2662
- ZodVoid: de,
2663
- ZodArray: E,
2664
- ZodObject: k,
2665
- ZodUnion: X,
2666
- ZodDiscriminatedUnion: fe,
2667
- ZodIntersection: K,
2668
- ZodTuple: C,
2669
- ZodRecord: Q,
2670
- ZodMap: ue,
2671
- ZodSet: V,
2672
- ZodFunction: B,
2673
- ZodLazy: F,
2674
- ZodLiteral: ee,
2675
- ZodEnum: $,
2676
- ZodNativeEnum: te,
2677
- ZodPromise: G,
2678
- ZodEffects: A,
2679
- ZodTransformer: A,
2680
- ZodOptional: S,
2681
- ZodNullable: D,
2682
- ZodDefault: ne,
2683
- ZodCatch: le,
2684
- ZodNaN: he,
2685
- BRAND: Ye,
2686
- ZodBranded: Re,
2687
- ZodPipeline: re,
2688
- ZodReadonly: pe,
2689
- custom: Ee,
2690
- Schema: y,
2691
- ZodSchema: y,
2692
- late: We,
2693
- get ZodFirstPartyTypeKind() {
2694
- return f;
2695
- },
2696
- coerce: Et,
2697
- any: et,
2698
- array: st,
2699
- bigint: Je,
2700
- boolean: Ce,
2701
- date: Xe,
2702
- discriminatedUnion: ct,
2703
- effect: Te,
2704
- enum: yt,
2705
- function: ft,
2706
- instanceof: qe,
2707
- intersection: dt,
2708
- lazy: mt,
2709
- literal: _t,
2710
- map: ht,
2711
- nan: He,
2712
- nativeEnum: vt,
2713
- never: nt,
2714
- null: Fe,
2715
- nullable: kt,
2716
- number: Ne,
2717
- object: at,
2718
- oboolean: Rt,
2719
- onumber: Ot,
2720
- optional: xt,
2721
- ostring: wt,
2722
- pipeline: bt,
2723
- preprocess: Tt,
2724
- promise: gt,
2725
- record: lt,
2726
- set: pt,
2727
- strictObject: it,
2728
- string: Ae,
2729
- symbol: Ke,
2730
- transformer: Te,
2731
- tuple: ut,
2732
- undefined: Qe,
2733
- union: ot,
2734
- unknown: tt,
2735
- void: rt,
2736
- NEVER: At,
2737
- ZodIssueCode: c,
2738
- quotelessJson: Se,
2739
- ZodError: R
2740
- });
2741
- const Ct = [
2742
- "DASHBOARD",
2743
- "ANALYTIC",
2744
- "CAMPAIGN",
2745
- "CAMPAIGN_PROMOTION",
2746
- "CAMPAIGN_VOUCHER",
2747
- "CAMPAIGN_VOUCHER_COLLECTIONS",
2748
- "CAMPAIGN_BROADCAST",
2749
- "PROGRAM",
2750
- "PROGRAM_TIER",
2751
- "PROGRAM_TITLE",
2752
- "PROGRAM_EXPERIENCE",
2753
- "PROGRAM_POINT",
2754
- "PROGRAM_CREDIT",
2755
- "PROGRAM_GAME",
2756
- "PROGRAM_MISSION",
2757
- "LOYALTY",
2758
- "LOYALTY_CARD",
2759
- "LOYALTY_MEMBER",
2760
- "LOYALTY_MEMBER_OVERVIEW",
2761
- "LOYALTY_MEMBER_LIST",
2762
- "LOYALTY_MEMBER_TRANSACTIONS",
2763
- "LOYALTY_SEGMENT",
2764
- "STORE",
2765
- "STORE_REWARDS",
2766
- "STORE_REWARD_COLLECTIONS",
2767
- "TRANSACTION",
2768
- "MARKETING",
2769
- "SETTING"
2770
- ].map((n) => `$connect-${n}`), St = Nt.enum(Ct), g = St.Enum, Mt = [
2771
- {
2772
- path: "",
2773
- name: g["$connect-DASHBOARD"],
2774
- redirect: { name: g["$connect-ANALYTIC"] }
2775
- },
2776
- {
2777
- path: "/analytic",
2778
- component: () => import("./MainLayout-DpZC6o3R.js"),
2779
- redirect: { name: g["$connect-ANALYTIC"] },
2780
- children: [
2781
- {
2782
- path: "/analytic",
2783
- name: g["$connect-ANALYTIC"],
2784
- component: () => import("./Analytic-AqWU_lJy.js")
2785
- }
2786
- ]
2787
- },
2788
- {
2789
- path: "/campaign",
2790
- name: g["$connect-CAMPAIGN"],
2791
- redirect: g["$connect-CAMPAIGN_PROMOTION"],
2792
- component: () => import("./MainLayout-DpZC6o3R.js"),
2793
- children: [
2794
- {
2795
- path: "/campaign/promotion",
2796
- name: g["$connect-CAMPAIGN_PROMOTION"],
2797
- component: () => import("./Promotion-vqM23NPX.js")
2798
- },
2799
- {
2800
- path: "/campaign/voucher",
2801
- redirect: { name: g["$connect-CAMPAIGN_VOUCHER"] },
2802
- children: [
2803
- {
2804
- path: "/campaign/voucher",
2805
- name: g["$connect-CAMPAIGN_VOUCHER"],
2806
- component: () => import("./Voucher-B0QCX_nG.js")
2807
- },
2808
- {
2809
- path: "/campaign/voucher/:id/collections",
2810
- name: g["$connect-CAMPAIGN_VOUCHER_COLLECTIONS"],
2811
- component: () => import("./Collections-BgbWoLWI.js")
2812
- }
2813
- ]
2814
- },
2815
- {
2816
- path: "/campaign/broadcast",
2817
- name: g["$connect-CAMPAIGN_BROADCAST"],
2818
- component: () => import("./Broadcast-utWSrzP9.js")
2819
- }
2820
- ]
2821
- },
2822
- {
2823
- path: "/program",
2824
- component: () => import("./MainLayout-DpZC6o3R.js"),
2825
- name: g["$connect-PROGRAM"],
2826
- redirect: g["$connect-PROGRAM_TIER"],
2827
- children: [
2828
- {
2829
- path: "/program/tier",
2830
- name: g["$connect-PROGRAM_TIER"],
2831
- component: () => import("./Tier-DLrOmrnK.js")
2832
- },
2833
- {
2834
- path: "/program/title",
2835
- name: g["$connect-PROGRAM_TITLE"],
2836
- component: () => import("./Title-MHQuel7h.js")
2837
- },
2838
- {
2839
- path: "/program/experience",
2840
- name: g["$connect-PROGRAM_EXPERIENCE"],
2841
- component: () => import("./Experience-CPjovKWF.js")
2842
- },
2843
- {
2844
- path: "/program/point",
2845
- name: g["$connect-PROGRAM_POINT"],
2846
- component: () => import("./Point-0Fw3qLIW.js")
2847
- },
2848
- {
2849
- path: "/program/credit",
2850
- name: g["$connect-PROGRAM_CREDIT"],
2851
- component: () => import("./Credit-CojzmUnh.js")
2852
- },
2853
- {
2854
- path: "/program/game",
2855
- name: g["$connect-PROGRAM_GAME"],
2856
- component: () => import("./Game-DWcjPfZP.js")
2857
- },
2858
- {
2859
- path: "mission",
2860
- name: g["$connect-PROGRAM_MISSION"],
2861
- component: () => import("./Mission-Y8s5MQIC.js")
2862
- }
2863
- ]
2864
- },
2865
- {
2866
- path: "/loyalty",
2867
- component: () => import("./MainLayout-DpZC6o3R.js"),
2868
- name: g["$connect-LOYALTY"],
2869
- redirect: g["$connect-LOYALTY_MEMBER"],
2870
- children: [
2871
- {
2872
- path: "/loyalty/member",
2873
- name: g["$connect-LOYALTY_MEMBER"],
2874
- component: () => import("./Member-oRcVGr20.js"),
2875
- redirect: {
2876
- name: g["$connect-LOYALTY_MEMBER_OVERVIEW"]
2877
- },
2878
- children: [
2879
- {
2880
- path: "/loyalty/member",
2881
- name: g["$connect-LOYALTY_MEMBER_OVERVIEW"],
2882
- component: () => import("./MemberOverview-C2n9oJZh.js")
2883
- },
2884
- {
2885
- path: "/loyalty/member/list",
2886
- name: g["$connect-LOYALTY_MEMBER_LIST"],
2887
- component: () => import("./MemberList-ISy05wGZ.js")
2888
- },
2889
- {
2890
- path: "/loyalty/member/transactions/:id",
2891
- name: g["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
2892
- component: () => import("./MemberTransactions-CXvhJngX.js")
2893
- }
2894
- ]
2895
- },
2896
- {
2897
- path: "/loyalty/segment",
2898
- name: g["$connect-LOYALTY_SEGMENT"],
2899
- component: () => import("./Segment-lgzMRCyd.js")
2900
- },
2901
- {
2902
- path: "/loyalty/card",
2903
- name: g["$connect-LOYALTY_CARD"],
2904
- component: () => import("./Card-x6qnEaIt.js")
2905
- }
2906
- ]
2907
- },
2908
- {
2909
- path: "/store",
2910
- component: () => import("./MainLayout-DpZC6o3R.js"),
2911
- children: [
2912
- {
2913
- path: "/store",
2914
- name: g["$connect-STORE"],
2915
- component: () => import("./Store-fJlew3HJ.js")
2916
- },
2917
- {
2918
- path: "/store/rewards",
2919
- redirect: { name: g["$connect-STORE_REWARDS"] },
2920
- children: [
2921
- {
2922
- path: "/store/rewards",
2923
- name: g["$connect-STORE_REWARDS"],
2924
- component: () => import("./StoreRewards-DWq34E4p.js")
2925
- },
2926
- {
2927
- path: "/store/rewards/:id/collections",
2928
- name: g["$connect-STORE_REWARD_COLLECTIONS"],
2929
- component: () => import("./Collections-BgbWoLWI.js")
2930
- }
2931
- ]
2932
- }
2933
- ]
2934
- },
2935
- {
2936
- path: "/transaction",
2937
- component: () => import("./MainLayout-DpZC6o3R.js"),
2938
- children: [
2939
- {
2940
- path: "/transaction",
2941
- name: g["$connect-TRANSACTION"],
2942
- component: () => import("./Transaction-CYqMFEzc.js")
2943
- }
2944
- ]
2945
- },
2946
- {
2947
- path: "/marketing",
2948
- component: () => import("./MainLayout-DpZC6o3R.js"),
2949
- children: [
2950
- {
2951
- path: "/marketing",
2952
- name: g["$connect-MARKETING"],
2953
- component: () => import("./Marketing-CwoI0pFF.js")
2954
- }
2955
- ]
2956
- },
2957
- {
2958
- path: "/setting",
2959
- component: () => import("./MainLayout-DpZC6o3R.js"),
2960
- children: [
2961
- {
2962
- path: "/setting",
2963
- name: g["$connect-SETTING"],
2964
- component: () => import("./Setting-CFGB53S0.js")
2965
- }
2966
- ]
2967
- }
2968
- ], Zt = () => import("./App-CRTD0U-N.js").then((n) => n.default);
2969
- export {
2970
- Zt as F,
2971
- g as R,
2972
- Mt as r,
2973
- Nt as z
2974
- };