@intlayer/design-system 5.5.7 → 5.5.8

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 (116) hide show
  1. package/README.md +2 -2
  2. package/dist/.vite/manifest.json +33 -14
  3. package/dist/components/Auth/AuthModal/index.cjs +0 -1
  4. package/dist/components/Auth/AuthModal/index.cjs.map +1 -1
  5. package/dist/components/Auth/AuthModal/index.mjs +0 -1
  6. package/dist/components/Auth/AuthModal/index.mjs.map +1 -1
  7. package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.cjs +11 -14
  8. package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.cjs.map +1 -1
  9. package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.d.ts +3 -19
  10. package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.d.ts.map +1 -1
  11. package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.mjs +11 -14
  12. package/dist/components/Auth/ChangePasswordForm/useChangePasswordSchema.mjs.map +1 -1
  13. package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.cjs +8 -10
  14. package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.cjs.map +1 -1
  15. package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.d.ts +3 -15
  16. package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.d.ts.map +1 -1
  17. package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.mjs +8 -10
  18. package/dist/components/Auth/DefineNewPasswordForm/useDefineNewPasswordSchema.mjs.map +1 -1
  19. package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.cjs +5 -6
  20. package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.cjs.map +1 -1
  21. package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.d.ts +3 -7
  22. package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.d.ts.map +1 -1
  23. package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.mjs +5 -6
  24. package/dist/components/Auth/ResetPasswordForm/useResetPasswordSchema.mjs.map +1 -1
  25. package/dist/components/Auth/SignInForm/SignInForm.cjs +5 -4
  26. package/dist/components/Auth/SignInForm/SignInForm.cjs.map +1 -1
  27. package/dist/components/Auth/SignInForm/SignInForm.d.ts.map +1 -1
  28. package/dist/components/Auth/SignInForm/SignInForm.mjs +5 -4
  29. package/dist/components/Auth/SignInForm/SignInForm.mjs.map +1 -1
  30. package/dist/components/Auth/SignInForm/useSignInSchema.cjs +8 -10
  31. package/dist/components/Auth/SignInForm/useSignInSchema.cjs.map +1 -1
  32. package/dist/components/Auth/SignInForm/useSignInSchema.d.ts +3 -9
  33. package/dist/components/Auth/SignInForm/useSignInSchema.d.ts.map +1 -1
  34. package/dist/components/Auth/SignInForm/useSignInSchema.mjs +8 -10
  35. package/dist/components/Auth/SignInForm/useSignInSchema.mjs.map +1 -1
  36. package/dist/components/Auth/SignUpForm/SignUpForm.cjs +1 -0
  37. package/dist/components/Auth/SignUpForm/SignUpForm.cjs.map +1 -1
  38. package/dist/components/Auth/SignUpForm/SignUpForm.d.ts.map +1 -1
  39. package/dist/components/Auth/SignUpForm/SignUpForm.mjs +1 -0
  40. package/dist/components/Auth/SignUpForm/SignUpForm.mjs.map +1 -1
  41. package/dist/components/Auth/SignUpForm/useSignUpSchema.cjs +11 -14
  42. package/dist/components/Auth/SignUpForm/useSignUpSchema.cjs.map +1 -1
  43. package/dist/components/Auth/SignUpForm/useSignUpSchema.d.ts +4 -20
  44. package/dist/components/Auth/SignUpForm/useSignUpSchema.d.ts.map +1 -1
  45. package/dist/components/Auth/SignUpForm/useSignUpSchema.mjs +11 -14
  46. package/dist/components/Auth/SignUpForm/useSignUpSchema.mjs.map +1 -1
  47. package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.cjs +2 -2
  48. package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.cjs.map +1 -1
  49. package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.d.ts +2 -2
  50. package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.d.ts.map +1 -1
  51. package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.mjs +2 -2
  52. package/dist/components/Auth/VerifyEmailForm/VerifyEmailSchema.mjs.map +1 -1
  53. package/dist/components/ContentEditor/ContentEditorTextArea.cjs +0 -1
  54. package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
  55. package/dist/components/ContentEditor/ContentEditorTextArea.mjs +0 -1
  56. package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
  57. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +0 -1
  58. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
  59. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +0 -1
  60. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
  61. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs +8 -10
  62. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.cjs.map +1 -1
  63. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts +3 -9
  64. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts.map +1 -1
  65. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +8 -10
  66. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs.map +1 -1
  67. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +0 -1
  68. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
  69. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +0 -1
  70. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  71. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +16 -20
  72. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
  73. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts +5 -17
  74. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
  75. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +16 -20
  76. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
  77. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +0 -1
  78. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  79. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +0 -1
  80. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  81. package/dist/components/Form/FormBase.cjs +4 -3
  82. package/dist/components/Form/FormBase.cjs.map +1 -1
  83. package/dist/components/Form/FormBase.d.ts +5 -5
  84. package/dist/components/Form/FormBase.d.ts.map +1 -1
  85. package/dist/components/Form/FormBase.mjs +4 -3
  86. package/dist/components/Form/FormBase.mjs.map +1 -1
  87. package/dist/components/Form/elements/FormElementWrapper.cjs +5 -5
  88. package/dist/components/Form/elements/FormElementWrapper.cjs.map +1 -1
  89. package/dist/components/Form/elements/FormElementWrapper.d.ts +3 -3
  90. package/dist/components/Form/elements/FormElementWrapper.d.ts.map +1 -1
  91. package/dist/components/Form/elements/FormElementWrapper.mjs +5 -5
  92. package/dist/components/Form/elements/FormElementWrapper.mjs.map +1 -1
  93. package/dist/hooks/index.cjs +3 -0
  94. package/dist/hooks/index.cjs.map +1 -1
  95. package/dist/hooks/index.mjs +4 -1
  96. package/dist/hooks/intlayerAPIHooks.cjs +24 -1
  97. package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
  98. package/dist/hooks/intlayerAPIHooks.d.ts +6 -0
  99. package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
  100. package/dist/hooks/intlayerAPIHooks.mjs +24 -1
  101. package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
  102. package/dist/hooks/useIntlayerAPI.d.ts +5 -0
  103. package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
  104. package/dist/schemas-7jC6hy_u.js +2725 -0
  105. package/dist/schemas-7jC6hy_u.js.map +1 -0
  106. package/dist/schemas-DJhUvjsx.cjs +2724 -0
  107. package/dist/schemas-DJhUvjsx.cjs.map +1 -0
  108. package/dist/{zod-BV4nCGJE.js → zod-DIGMabE8.js} +16 -15
  109. package/dist/zod-DIGMabE8.js.map +1 -0
  110. package/dist/{zod-DSrtTSD_.cjs → zod-DpajDxlG.cjs} +16 -15
  111. package/dist/zod-DpajDxlG.cjs.map +1 -0
  112. package/package.json +33 -33
  113. package/dist/components/Command/index.d.ts +0 -83
  114. package/dist/components/Command/index.d.ts.map +0 -1
  115. package/dist/zod-BV4nCGJE.js.map +0 -1
  116. package/dist/zod-DSrtTSD_.cjs.map +0 -1
@@ -0,0 +1,2725 @@
1
+ function $constructor(name, initializer2, params) {
2
+ function init(inst, def) {
3
+ var _a;
4
+ Object.defineProperty(inst, "_zod", {
5
+ value: inst._zod ?? {},
6
+ enumerable: false
7
+ });
8
+ (_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
9
+ inst._zod.traits.add(name);
10
+ initializer2(inst, def);
11
+ for (const k in _.prototype) {
12
+ if (!(k in inst))
13
+ Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) });
14
+ }
15
+ inst._zod.constr = _;
16
+ inst._zod.def = def;
17
+ }
18
+ const Parent = params?.Parent ?? Object;
19
+ class Definition extends Parent {
20
+ }
21
+ Object.defineProperty(Definition, "name", { value: name });
22
+ function _(def) {
23
+ var _a;
24
+ const inst = params?.Parent ? new Definition() : this;
25
+ init(inst, def);
26
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
27
+ for (const fn of inst._zod.deferred) {
28
+ fn();
29
+ }
30
+ return inst;
31
+ }
32
+ Object.defineProperty(_, "init", { value: init });
33
+ Object.defineProperty(_, Symbol.hasInstance, {
34
+ value: (inst) => {
35
+ if (params?.Parent && inst instanceof params.Parent)
36
+ return true;
37
+ return inst?._zod?.traits?.has(name);
38
+ }
39
+ });
40
+ Object.defineProperty(_, "name", { value: name });
41
+ return _;
42
+ }
43
+ class $ZodAsyncError extends Error {
44
+ constructor() {
45
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
46
+ }
47
+ }
48
+ const globalConfig = {};
49
+ function config(newConfig) {
50
+ return globalConfig;
51
+ }
52
+ function getEnumValues(entries) {
53
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
54
+ const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
55
+ return values;
56
+ }
57
+ function jsonStringifyReplacer(_, value) {
58
+ if (typeof value === "bigint")
59
+ return value.toString();
60
+ return value;
61
+ }
62
+ function cached(getter) {
63
+ return {
64
+ get value() {
65
+ {
66
+ const value = getter();
67
+ Object.defineProperty(this, "value", { value });
68
+ return value;
69
+ }
70
+ }
71
+ };
72
+ }
73
+ function nullish(input) {
74
+ return input === null || input === void 0;
75
+ }
76
+ function cleanRegex(source) {
77
+ const start = source.startsWith("^") ? 1 : 0;
78
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
79
+ return source.slice(start, end);
80
+ }
81
+ function defineLazy(object2, key, getter) {
82
+ Object.defineProperty(object2, key, {
83
+ get() {
84
+ {
85
+ const value = getter();
86
+ object2[key] = value;
87
+ return value;
88
+ }
89
+ },
90
+ set(v) {
91
+ Object.defineProperty(object2, key, {
92
+ value: v
93
+ // configurable: true,
94
+ });
95
+ },
96
+ configurable: true
97
+ });
98
+ }
99
+ function assignProp(target, prop, value) {
100
+ Object.defineProperty(target, prop, {
101
+ value,
102
+ writable: true,
103
+ enumerable: true,
104
+ configurable: true
105
+ });
106
+ }
107
+ function randomString(length = 10) {
108
+ const chars = "abcdefghijklmnopqrstuvwxyz";
109
+ let str = "";
110
+ for (let i = 0; i < length; i++) {
111
+ str += chars[Math.floor(Math.random() * chars.length)];
112
+ }
113
+ return str;
114
+ }
115
+ function esc(str) {
116
+ return JSON.stringify(str);
117
+ }
118
+ function isObject(data) {
119
+ return typeof data === "object" && data !== null && !Array.isArray(data);
120
+ }
121
+ const allowsEval = cached(() => {
122
+ try {
123
+ const F = Function;
124
+ new F("");
125
+ return true;
126
+ } catch (_) {
127
+ return false;
128
+ }
129
+ });
130
+ function isPlainObject(o) {
131
+ if (isObject(o) === false)
132
+ return false;
133
+ const ctor = o.constructor;
134
+ if (ctor === void 0)
135
+ return true;
136
+ const prot = ctor.prototype;
137
+ if (isObject(prot) === false)
138
+ return false;
139
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
140
+ return false;
141
+ }
142
+ return true;
143
+ }
144
+ const propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
145
+ function escapeRegex(str) {
146
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
147
+ }
148
+ function clone(inst, def, params) {
149
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
150
+ if (!def || params?.parent)
151
+ cl._zod.parent = inst;
152
+ return cl;
153
+ }
154
+ function normalizeParams(_params) {
155
+ const params = _params;
156
+ if (!params)
157
+ return {};
158
+ if (typeof params === "string")
159
+ return { error: () => params };
160
+ if (params?.message !== void 0) {
161
+ if (params?.error !== void 0)
162
+ throw new Error("Cannot specify both `message` and `error` params");
163
+ params.error = params.message;
164
+ }
165
+ delete params.message;
166
+ if (typeof params.error === "string")
167
+ return { ...params, error: () => params.error };
168
+ return params;
169
+ }
170
+ function optionalKeys(shape) {
171
+ return Object.keys(shape).filter((k) => {
172
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
173
+ });
174
+ }
175
+ function pick(schema, mask) {
176
+ const newShape = {};
177
+ const currDef = schema._zod.def;
178
+ for (const key in mask) {
179
+ if (!(key in currDef.shape)) {
180
+ throw new Error(`Unrecognized key: "${key}"`);
181
+ }
182
+ if (!mask[key])
183
+ continue;
184
+ newShape[key] = currDef.shape[key];
185
+ }
186
+ return clone(schema, {
187
+ ...schema._zod.def,
188
+ shape: newShape,
189
+ checks: []
190
+ });
191
+ }
192
+ function omit(schema, mask) {
193
+ const newShape = { ...schema._zod.def.shape };
194
+ const currDef = schema._zod.def;
195
+ for (const key in mask) {
196
+ if (!(key in currDef.shape)) {
197
+ throw new Error(`Unrecognized key: "${key}"`);
198
+ }
199
+ if (!mask[key])
200
+ continue;
201
+ delete newShape[key];
202
+ }
203
+ return clone(schema, {
204
+ ...schema._zod.def,
205
+ shape: newShape,
206
+ checks: []
207
+ });
208
+ }
209
+ function extend(schema, shape) {
210
+ const def = {
211
+ ...schema._zod.def,
212
+ get shape() {
213
+ const _shape = { ...schema._zod.def.shape, ...shape };
214
+ assignProp(this, "shape", _shape);
215
+ return _shape;
216
+ },
217
+ checks: []
218
+ // delete existing checks
219
+ };
220
+ return clone(schema, def);
221
+ }
222
+ function merge(a, b) {
223
+ return clone(a, {
224
+ ...a._zod.def,
225
+ get shape() {
226
+ const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
227
+ assignProp(this, "shape", _shape);
228
+ return _shape;
229
+ },
230
+ catchall: b._zod.def.catchall,
231
+ checks: []
232
+ // delete existing checks
233
+ });
234
+ }
235
+ function partial(Class, schema, mask) {
236
+ const oldShape = schema._zod.def.shape;
237
+ const shape = { ...oldShape };
238
+ if (mask) {
239
+ for (const key in mask) {
240
+ if (!(key in oldShape)) {
241
+ throw new Error(`Unrecognized key: "${key}"`);
242
+ }
243
+ if (!mask[key])
244
+ continue;
245
+ shape[key] = Class ? new Class({
246
+ type: "optional",
247
+ innerType: oldShape[key]
248
+ }) : oldShape[key];
249
+ }
250
+ } else {
251
+ for (const key in oldShape) {
252
+ shape[key] = Class ? new Class({
253
+ type: "optional",
254
+ innerType: oldShape[key]
255
+ }) : oldShape[key];
256
+ }
257
+ }
258
+ return clone(schema, {
259
+ ...schema._zod.def,
260
+ shape,
261
+ checks: []
262
+ });
263
+ }
264
+ function required(Class, schema, mask) {
265
+ const oldShape = schema._zod.def.shape;
266
+ const shape = { ...oldShape };
267
+ if (mask) {
268
+ for (const key in mask) {
269
+ if (!(key in shape)) {
270
+ throw new Error(`Unrecognized key: "${key}"`);
271
+ }
272
+ if (!mask[key])
273
+ continue;
274
+ shape[key] = new Class({
275
+ type: "nonoptional",
276
+ innerType: oldShape[key]
277
+ });
278
+ }
279
+ } else {
280
+ for (const key in oldShape) {
281
+ shape[key] = new Class({
282
+ type: "nonoptional",
283
+ innerType: oldShape[key]
284
+ });
285
+ }
286
+ }
287
+ return clone(schema, {
288
+ ...schema._zod.def,
289
+ shape,
290
+ // optional: [],
291
+ checks: []
292
+ });
293
+ }
294
+ function aborted(x, startIndex = 0) {
295
+ for (let i = startIndex; i < x.issues.length; i++) {
296
+ if (x.issues[i].continue !== true)
297
+ return true;
298
+ }
299
+ return false;
300
+ }
301
+ function prefixIssues(path, issues) {
302
+ return issues.map((iss) => {
303
+ var _a;
304
+ (_a = iss).path ?? (_a.path = []);
305
+ iss.path.unshift(path);
306
+ return iss;
307
+ });
308
+ }
309
+ function unwrapMessage(message) {
310
+ return typeof message === "string" ? message : message?.message;
311
+ }
312
+ function finalizeIssue(iss, ctx, config2) {
313
+ const full = { ...iss, path: iss.path ?? [] };
314
+ if (!iss.message) {
315
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
316
+ full.message = message;
317
+ }
318
+ delete full.inst;
319
+ delete full.continue;
320
+ if (!ctx?.reportInput) {
321
+ delete full.input;
322
+ }
323
+ return full;
324
+ }
325
+ function getLengthableOrigin(input) {
326
+ if (Array.isArray(input))
327
+ return "array";
328
+ if (typeof input === "string")
329
+ return "string";
330
+ return "unknown";
331
+ }
332
+ function issue(...args) {
333
+ const [iss, input, inst] = args;
334
+ if (typeof iss === "string") {
335
+ return {
336
+ message: iss,
337
+ code: "custom",
338
+ input,
339
+ inst
340
+ };
341
+ }
342
+ return { ...iss };
343
+ }
344
+ const initializer$1 = (inst, def) => {
345
+ inst.name = "$ZodError";
346
+ Object.defineProperty(inst, "_zod", {
347
+ value: inst._zod,
348
+ enumerable: false
349
+ });
350
+ Object.defineProperty(inst, "issues", {
351
+ value: def,
352
+ enumerable: false
353
+ });
354
+ Object.defineProperty(inst, "message", {
355
+ get() {
356
+ return JSON.stringify(def, jsonStringifyReplacer, 2);
357
+ },
358
+ enumerable: true
359
+ // configurable: false,
360
+ });
361
+ };
362
+ const $ZodError = $constructor("$ZodError", initializer$1);
363
+ const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
364
+ function flattenError(error, mapper = (issue2) => issue2.message) {
365
+ const fieldErrors = {};
366
+ const formErrors = [];
367
+ for (const sub of error.issues) {
368
+ if (sub.path.length > 0) {
369
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
370
+ fieldErrors[sub.path[0]].push(mapper(sub));
371
+ } else {
372
+ formErrors.push(mapper(sub));
373
+ }
374
+ }
375
+ return { formErrors, fieldErrors };
376
+ }
377
+ function formatError(error, _mapper) {
378
+ const mapper = _mapper || function(issue2) {
379
+ return issue2.message;
380
+ };
381
+ const fieldErrors = { _errors: [] };
382
+ const processError = (error2) => {
383
+ for (const issue2 of error2.issues) {
384
+ if (issue2.code === "invalid_union" && issue2.errors.length) {
385
+ issue2.errors.map((issues) => processError({ issues }));
386
+ } else if (issue2.code === "invalid_key") {
387
+ processError({ issues: issue2.issues });
388
+ } else if (issue2.code === "invalid_element") {
389
+ processError({ issues: issue2.issues });
390
+ } else if (issue2.path.length === 0) {
391
+ fieldErrors._errors.push(mapper(issue2));
392
+ } else {
393
+ let curr = fieldErrors;
394
+ let i = 0;
395
+ while (i < issue2.path.length) {
396
+ const el = issue2.path[i];
397
+ const terminal = i === issue2.path.length - 1;
398
+ if (!terminal) {
399
+ curr[el] = curr[el] || { _errors: [] };
400
+ } else {
401
+ curr[el] = curr[el] || { _errors: [] };
402
+ curr[el]._errors.push(mapper(issue2));
403
+ }
404
+ curr = curr[el];
405
+ i++;
406
+ }
407
+ }
408
+ }
409
+ };
410
+ processError(error);
411
+ return fieldErrors;
412
+ }
413
+ const _parse = (_Err) => (schema, value, _ctx, _params) => {
414
+ const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
415
+ const result = schema._zod.run({ value, issues: [] }, ctx);
416
+ if (result instanceof Promise) {
417
+ throw new $ZodAsyncError();
418
+ }
419
+ if (result.issues.length) {
420
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
421
+ Error.captureStackTrace(e, _params?.callee);
422
+ throw e;
423
+ }
424
+ return result.value;
425
+ };
426
+ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
427
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
428
+ let result = schema._zod.run({ value, issues: [] }, ctx);
429
+ if (result instanceof Promise)
430
+ result = await result;
431
+ if (result.issues.length) {
432
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
433
+ Error.captureStackTrace(e, params?.callee);
434
+ throw e;
435
+ }
436
+ return result.value;
437
+ };
438
+ const _safeParse = (_Err) => (schema, value, _ctx) => {
439
+ const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
440
+ const result = schema._zod.run({ value, issues: [] }, ctx);
441
+ if (result instanceof Promise) {
442
+ throw new $ZodAsyncError();
443
+ }
444
+ return result.issues.length ? {
445
+ success: false,
446
+ error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
447
+ } : { success: true, data: result.value };
448
+ };
449
+ const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
450
+ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
451
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
452
+ let result = schema._zod.run({ value, issues: [] }, ctx);
453
+ if (result instanceof Promise)
454
+ result = await result;
455
+ return result.issues.length ? {
456
+ success: false,
457
+ error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
458
+ } : { success: true, data: result.value };
459
+ };
460
+ const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
461
+ const cuid = /^[cC][^\s-]{8,}$/;
462
+ const cuid2 = /^[0-9a-z]+$/;
463
+ const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
464
+ const xid = /^[0-9a-vA-V]{20}$/;
465
+ const ksuid = /^[A-Za-z0-9]{27}$/;
466
+ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
467
+ const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
468
+ const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
469
+ const uuid = (version2) => {
470
+ if (!version2)
471
+ return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;
472
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
473
+ };
474
+ const email$1 = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
475
+ const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
476
+ function emoji() {
477
+ return new RegExp(_emoji$1, "u");
478
+ }
479
+ const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
480
+ const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/;
481
+ const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
482
+ const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
483
+ const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
484
+ const base64url = /^[A-Za-z0-9_-]*$/;
485
+ const hostname = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
486
+ const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
487
+ const dateSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
488
+ const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
489
+ function timeSource(args) {
490
+ let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
491
+ if (args.precision) {
492
+ regex = `${regex}\\.\\d{${args.precision}}`;
493
+ } else if (args.precision == null) {
494
+ regex = `${regex}(\\.\\d+)?`;
495
+ }
496
+ return regex;
497
+ }
498
+ function time$1(args) {
499
+ return new RegExp(`^${timeSource(args)}$`);
500
+ }
501
+ function datetime$1(args) {
502
+ let regex = `${dateSource}T${timeSource(args)}`;
503
+ const opts = [];
504
+ opts.push(args.local ? `Z?` : `Z`);
505
+ if (args.offset)
506
+ opts.push(`([+-]\\d{2}:?\\d{2})`);
507
+ regex = `${regex}(${opts.join("|")})`;
508
+ return new RegExp(`^${regex}$`);
509
+ }
510
+ const string$1 = (params) => {
511
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
512
+ return new RegExp(`^${regex}$`);
513
+ };
514
+ const lowercase = /^[^A-Z]*$/;
515
+ const uppercase = /^[^a-z]*$/;
516
+ const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
517
+ var _a;
518
+ inst._zod ?? (inst._zod = {});
519
+ inst._zod.def = def;
520
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
521
+ });
522
+ const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
523
+ $ZodCheck.init(inst, def);
524
+ inst._zod.when = (payload) => {
525
+ const val = payload.value;
526
+ return !nullish(val) && val.length !== void 0;
527
+ };
528
+ inst._zod.onattach.push((inst2) => {
529
+ const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
530
+ if (def.maximum < curr)
531
+ inst2._zod.bag.maximum = def.maximum;
532
+ });
533
+ inst._zod.check = (payload) => {
534
+ const input = payload.value;
535
+ const length = input.length;
536
+ if (length <= def.maximum)
537
+ return;
538
+ const origin = getLengthableOrigin(input);
539
+ payload.issues.push({
540
+ origin,
541
+ code: "too_big",
542
+ maximum: def.maximum,
543
+ inclusive: true,
544
+ input,
545
+ inst,
546
+ continue: !def.abort
547
+ });
548
+ };
549
+ });
550
+ const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
551
+ $ZodCheck.init(inst, def);
552
+ inst._zod.when = (payload) => {
553
+ const val = payload.value;
554
+ return !nullish(val) && val.length !== void 0;
555
+ };
556
+ inst._zod.onattach.push((inst2) => {
557
+ const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
558
+ if (def.minimum > curr)
559
+ inst2._zod.bag.minimum = def.minimum;
560
+ });
561
+ inst._zod.check = (payload) => {
562
+ const input = payload.value;
563
+ const length = input.length;
564
+ if (length >= def.minimum)
565
+ return;
566
+ const origin = getLengthableOrigin(input);
567
+ payload.issues.push({
568
+ origin,
569
+ code: "too_small",
570
+ minimum: def.minimum,
571
+ inclusive: true,
572
+ input,
573
+ inst,
574
+ continue: !def.abort
575
+ });
576
+ };
577
+ });
578
+ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
579
+ $ZodCheck.init(inst, def);
580
+ inst._zod.when = (payload) => {
581
+ const val = payload.value;
582
+ return !nullish(val) && val.length !== void 0;
583
+ };
584
+ inst._zod.onattach.push((inst2) => {
585
+ const bag = inst2._zod.bag;
586
+ bag.minimum = def.length;
587
+ bag.maximum = def.length;
588
+ bag.length = def.length;
589
+ });
590
+ inst._zod.check = (payload) => {
591
+ const input = payload.value;
592
+ const length = input.length;
593
+ if (length === def.length)
594
+ return;
595
+ const origin = getLengthableOrigin(input);
596
+ const tooBig = length > def.length;
597
+ payload.issues.push({
598
+ origin,
599
+ ...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
600
+ input: payload.value,
601
+ inst,
602
+ continue: !def.abort
603
+ });
604
+ };
605
+ });
606
+ const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
607
+ var _a;
608
+ $ZodCheck.init(inst, def);
609
+ inst._zod.onattach.push((inst2) => {
610
+ const bag = inst2._zod.bag;
611
+ bag.format = def.format;
612
+ if (def.pattern) {
613
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
614
+ bag.patterns.add(def.pattern);
615
+ }
616
+ });
617
+ (_a = inst._zod).check ?? (_a.check = (payload) => {
618
+ if (!def.pattern)
619
+ throw new Error("Not implemented.");
620
+ def.pattern.lastIndex = 0;
621
+ if (def.pattern.test(payload.value))
622
+ return;
623
+ payload.issues.push({
624
+ origin: "string",
625
+ code: "invalid_format",
626
+ format: def.format,
627
+ input: payload.value,
628
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
629
+ inst,
630
+ continue: !def.abort
631
+ });
632
+ });
633
+ });
634
+ const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
635
+ $ZodCheckStringFormat.init(inst, def);
636
+ inst._zod.check = (payload) => {
637
+ def.pattern.lastIndex = 0;
638
+ if (def.pattern.test(payload.value))
639
+ return;
640
+ payload.issues.push({
641
+ origin: "string",
642
+ code: "invalid_format",
643
+ format: "regex",
644
+ input: payload.value,
645
+ pattern: def.pattern.toString(),
646
+ inst,
647
+ continue: !def.abort
648
+ });
649
+ };
650
+ });
651
+ const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
652
+ def.pattern ?? (def.pattern = lowercase);
653
+ $ZodCheckStringFormat.init(inst, def);
654
+ });
655
+ const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
656
+ def.pattern ?? (def.pattern = uppercase);
657
+ $ZodCheckStringFormat.init(inst, def);
658
+ });
659
+ const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
660
+ $ZodCheck.init(inst, def);
661
+ const escapedRegex = escapeRegex(def.includes);
662
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
663
+ def.pattern = pattern;
664
+ inst._zod.onattach.push((inst2) => {
665
+ const bag = inst2._zod.bag;
666
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
667
+ bag.patterns.add(pattern);
668
+ });
669
+ inst._zod.check = (payload) => {
670
+ if (payload.value.includes(def.includes, def.position))
671
+ return;
672
+ payload.issues.push({
673
+ origin: "string",
674
+ code: "invalid_format",
675
+ format: "includes",
676
+ includes: def.includes,
677
+ input: payload.value,
678
+ inst,
679
+ continue: !def.abort
680
+ });
681
+ };
682
+ });
683
+ const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
684
+ $ZodCheck.init(inst, def);
685
+ const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
686
+ def.pattern ?? (def.pattern = pattern);
687
+ inst._zod.onattach.push((inst2) => {
688
+ const bag = inst2._zod.bag;
689
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
690
+ bag.patterns.add(pattern);
691
+ });
692
+ inst._zod.check = (payload) => {
693
+ if (payload.value.startsWith(def.prefix))
694
+ return;
695
+ payload.issues.push({
696
+ origin: "string",
697
+ code: "invalid_format",
698
+ format: "starts_with",
699
+ prefix: def.prefix,
700
+ input: payload.value,
701
+ inst,
702
+ continue: !def.abort
703
+ });
704
+ };
705
+ });
706
+ const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
707
+ $ZodCheck.init(inst, def);
708
+ const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
709
+ def.pattern ?? (def.pattern = pattern);
710
+ inst._zod.onattach.push((inst2) => {
711
+ const bag = inst2._zod.bag;
712
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
713
+ bag.patterns.add(pattern);
714
+ });
715
+ inst._zod.check = (payload) => {
716
+ if (payload.value.endsWith(def.suffix))
717
+ return;
718
+ payload.issues.push({
719
+ origin: "string",
720
+ code: "invalid_format",
721
+ format: "ends_with",
722
+ suffix: def.suffix,
723
+ input: payload.value,
724
+ inst,
725
+ continue: !def.abort
726
+ });
727
+ };
728
+ });
729
+ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
730
+ $ZodCheck.init(inst, def);
731
+ inst._zod.check = (payload) => {
732
+ payload.value = def.tx(payload.value);
733
+ };
734
+ });
735
+ class Doc {
736
+ constructor(args = []) {
737
+ this.content = [];
738
+ this.indent = 0;
739
+ if (this)
740
+ this.args = args;
741
+ }
742
+ indented(fn) {
743
+ this.indent += 1;
744
+ fn(this);
745
+ this.indent -= 1;
746
+ }
747
+ write(arg) {
748
+ if (typeof arg === "function") {
749
+ arg(this, { execution: "sync" });
750
+ arg(this, { execution: "async" });
751
+ return;
752
+ }
753
+ const content = arg;
754
+ const lines = content.split("\n").filter((x) => x);
755
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
756
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
757
+ for (const line of dedented) {
758
+ this.content.push(line);
759
+ }
760
+ }
761
+ compile() {
762
+ const F = Function;
763
+ const args = this?.args;
764
+ const content = this?.content ?? [``];
765
+ const lines = [...content.map((x) => ` ${x}`)];
766
+ return new F(...args, lines.join("\n"));
767
+ }
768
+ }
769
+ const version = {
770
+ major: 4,
771
+ minor: 0,
772
+ patch: 0
773
+ };
774
+ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
775
+ var _a;
776
+ inst ?? (inst = {});
777
+ inst._zod.id = def.type + "_" + randomString(10);
778
+ inst._zod.def = def;
779
+ inst._zod.bag = inst._zod.bag || {};
780
+ inst._zod.version = version;
781
+ const checks = [...inst._zod.def.checks ?? []];
782
+ if (inst._zod.traits.has("$ZodCheck")) {
783
+ checks.unshift(inst);
784
+ }
785
+ for (const ch of checks) {
786
+ for (const fn of ch._zod.onattach) {
787
+ fn(inst);
788
+ }
789
+ }
790
+ if (checks.length === 0) {
791
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
792
+ inst._zod.deferred?.push(() => {
793
+ inst._zod.run = inst._zod.parse;
794
+ });
795
+ } else {
796
+ const runChecks = (payload, checks2, ctx) => {
797
+ let isAborted = aborted(payload);
798
+ let asyncResult;
799
+ for (const ch of checks2) {
800
+ if (ch._zod.when) {
801
+ const shouldRun = ch._zod.when(payload);
802
+ if (!shouldRun)
803
+ continue;
804
+ } else {
805
+ if (isAborted) {
806
+ continue;
807
+ }
808
+ }
809
+ const currLen = payload.issues.length;
810
+ const _ = ch._zod.check(payload);
811
+ if (_ instanceof Promise && ctx?.async === false) {
812
+ throw new $ZodAsyncError();
813
+ }
814
+ if (asyncResult || _ instanceof Promise) {
815
+ asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
816
+ await _;
817
+ const nextLen = payload.issues.length;
818
+ if (nextLen === currLen)
819
+ return;
820
+ if (!isAborted)
821
+ isAborted = aborted(payload, currLen);
822
+ });
823
+ } else {
824
+ const nextLen = payload.issues.length;
825
+ if (nextLen === currLen)
826
+ continue;
827
+ if (!isAborted)
828
+ isAborted = aborted(payload, currLen);
829
+ }
830
+ }
831
+ if (asyncResult) {
832
+ return asyncResult.then(() => {
833
+ return payload;
834
+ });
835
+ }
836
+ return payload;
837
+ };
838
+ inst._zod.run = (payload, ctx) => {
839
+ const result = inst._zod.parse(payload, ctx);
840
+ if (result instanceof Promise) {
841
+ if (ctx.async === false)
842
+ throw new $ZodAsyncError();
843
+ return result.then((result2) => runChecks(result2, checks, ctx));
844
+ }
845
+ return runChecks(result, checks, ctx);
846
+ };
847
+ }
848
+ inst["~standard"] = {
849
+ validate: (value) => {
850
+ try {
851
+ const r = safeParse$1(inst, value);
852
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
853
+ } catch (_) {
854
+ return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
855
+ }
856
+ },
857
+ vendor: "zod",
858
+ version: 1
859
+ };
860
+ });
861
+ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
862
+ $ZodType.init(inst, def);
863
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
864
+ inst._zod.parse = (payload, _) => {
865
+ if (def.coerce)
866
+ try {
867
+ payload.value = String(payload.value);
868
+ } catch (_2) {
869
+ }
870
+ if (typeof payload.value === "string")
871
+ return payload;
872
+ payload.issues.push({
873
+ expected: "string",
874
+ code: "invalid_type",
875
+ input: payload.value,
876
+ inst
877
+ });
878
+ return payload;
879
+ };
880
+ });
881
+ const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
882
+ $ZodCheckStringFormat.init(inst, def);
883
+ $ZodString.init(inst, def);
884
+ });
885
+ const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
886
+ def.pattern ?? (def.pattern = guid);
887
+ $ZodStringFormat.init(inst, def);
888
+ });
889
+ const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
890
+ if (def.version) {
891
+ const versionMap = {
892
+ v1: 1,
893
+ v2: 2,
894
+ v3: 3,
895
+ v4: 4,
896
+ v5: 5,
897
+ v6: 6,
898
+ v7: 7,
899
+ v8: 8
900
+ };
901
+ const v = versionMap[def.version];
902
+ if (v === void 0)
903
+ throw new Error(`Invalid UUID version: "${def.version}"`);
904
+ def.pattern ?? (def.pattern = uuid(v));
905
+ } else
906
+ def.pattern ?? (def.pattern = uuid());
907
+ $ZodStringFormat.init(inst, def);
908
+ });
909
+ const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
910
+ def.pattern ?? (def.pattern = email$1);
911
+ $ZodStringFormat.init(inst, def);
912
+ });
913
+ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
914
+ $ZodStringFormat.init(inst, def);
915
+ inst._zod.check = (payload) => {
916
+ try {
917
+ const url = new URL(payload.value);
918
+ if (def.hostname) {
919
+ def.hostname.lastIndex = 0;
920
+ if (!def.hostname.test(url.hostname)) {
921
+ payload.issues.push({
922
+ code: "invalid_format",
923
+ format: "url",
924
+ note: "Invalid hostname",
925
+ pattern: hostname.source,
926
+ input: payload.value,
927
+ inst,
928
+ continue: !def.abort
929
+ });
930
+ }
931
+ }
932
+ if (def.protocol) {
933
+ def.protocol.lastIndex = 0;
934
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
935
+ payload.issues.push({
936
+ code: "invalid_format",
937
+ format: "url",
938
+ note: "Invalid protocol",
939
+ pattern: def.protocol.source,
940
+ input: payload.value,
941
+ inst,
942
+ continue: !def.abort
943
+ });
944
+ }
945
+ }
946
+ return;
947
+ } catch (_) {
948
+ payload.issues.push({
949
+ code: "invalid_format",
950
+ format: "url",
951
+ input: payload.value,
952
+ inst,
953
+ continue: !def.abort
954
+ });
955
+ }
956
+ };
957
+ });
958
+ const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
959
+ def.pattern ?? (def.pattern = emoji());
960
+ $ZodStringFormat.init(inst, def);
961
+ });
962
+ const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
963
+ def.pattern ?? (def.pattern = nanoid);
964
+ $ZodStringFormat.init(inst, def);
965
+ });
966
+ const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
967
+ def.pattern ?? (def.pattern = cuid);
968
+ $ZodStringFormat.init(inst, def);
969
+ });
970
+ const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
971
+ def.pattern ?? (def.pattern = cuid2);
972
+ $ZodStringFormat.init(inst, def);
973
+ });
974
+ const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
975
+ def.pattern ?? (def.pattern = ulid);
976
+ $ZodStringFormat.init(inst, def);
977
+ });
978
+ const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
979
+ def.pattern ?? (def.pattern = xid);
980
+ $ZodStringFormat.init(inst, def);
981
+ });
982
+ const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
983
+ def.pattern ?? (def.pattern = ksuid);
984
+ $ZodStringFormat.init(inst, def);
985
+ });
986
+ const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
987
+ def.pattern ?? (def.pattern = datetime$1(def));
988
+ $ZodStringFormat.init(inst, def);
989
+ });
990
+ const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
991
+ def.pattern ?? (def.pattern = date$1);
992
+ $ZodStringFormat.init(inst, def);
993
+ });
994
+ const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
995
+ def.pattern ?? (def.pattern = time$1(def));
996
+ $ZodStringFormat.init(inst, def);
997
+ });
998
+ const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
999
+ def.pattern ?? (def.pattern = duration$1);
1000
+ $ZodStringFormat.init(inst, def);
1001
+ });
1002
+ const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
1003
+ def.pattern ?? (def.pattern = ipv4);
1004
+ $ZodStringFormat.init(inst, def);
1005
+ inst._zod.onattach.push((inst2) => {
1006
+ const bag = inst2._zod.bag;
1007
+ bag.format = `ipv4`;
1008
+ });
1009
+ });
1010
+ const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
1011
+ def.pattern ?? (def.pattern = ipv6);
1012
+ $ZodStringFormat.init(inst, def);
1013
+ inst._zod.onattach.push((inst2) => {
1014
+ const bag = inst2._zod.bag;
1015
+ bag.format = `ipv6`;
1016
+ });
1017
+ inst._zod.check = (payload) => {
1018
+ try {
1019
+ new URL(`http://[${payload.value}]`);
1020
+ } catch {
1021
+ payload.issues.push({
1022
+ code: "invalid_format",
1023
+ format: "ipv6",
1024
+ input: payload.value,
1025
+ inst,
1026
+ continue: !def.abort
1027
+ });
1028
+ }
1029
+ };
1030
+ });
1031
+ const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
1032
+ def.pattern ?? (def.pattern = cidrv4);
1033
+ $ZodStringFormat.init(inst, def);
1034
+ });
1035
+ const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
1036
+ def.pattern ?? (def.pattern = cidrv6);
1037
+ $ZodStringFormat.init(inst, def);
1038
+ inst._zod.check = (payload) => {
1039
+ const [address, prefix] = payload.value.split("/");
1040
+ try {
1041
+ if (!prefix)
1042
+ throw new Error();
1043
+ const prefixNum = Number(prefix);
1044
+ if (`${prefixNum}` !== prefix)
1045
+ throw new Error();
1046
+ if (prefixNum < 0 || prefixNum > 128)
1047
+ throw new Error();
1048
+ new URL(`http://[${address}]`);
1049
+ } catch {
1050
+ payload.issues.push({
1051
+ code: "invalid_format",
1052
+ format: "cidrv6",
1053
+ input: payload.value,
1054
+ inst,
1055
+ continue: !def.abort
1056
+ });
1057
+ }
1058
+ };
1059
+ });
1060
+ function isValidBase64(data) {
1061
+ if (data === "")
1062
+ return true;
1063
+ if (data.length % 4 !== 0)
1064
+ return false;
1065
+ try {
1066
+ atob(data);
1067
+ return true;
1068
+ } catch {
1069
+ return false;
1070
+ }
1071
+ }
1072
+ const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
1073
+ def.pattern ?? (def.pattern = base64);
1074
+ $ZodStringFormat.init(inst, def);
1075
+ inst._zod.onattach.push((inst2) => {
1076
+ inst2._zod.bag.contentEncoding = "base64";
1077
+ });
1078
+ inst._zod.check = (payload) => {
1079
+ if (isValidBase64(payload.value))
1080
+ return;
1081
+ payload.issues.push({
1082
+ code: "invalid_format",
1083
+ format: "base64",
1084
+ input: payload.value,
1085
+ inst,
1086
+ continue: !def.abort
1087
+ });
1088
+ };
1089
+ });
1090
+ function isValidBase64URL(data) {
1091
+ if (!base64url.test(data))
1092
+ return false;
1093
+ const base642 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1094
+ const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
1095
+ return isValidBase64(padded);
1096
+ }
1097
+ const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
1098
+ def.pattern ?? (def.pattern = base64url);
1099
+ $ZodStringFormat.init(inst, def);
1100
+ inst._zod.onattach.push((inst2) => {
1101
+ inst2._zod.bag.contentEncoding = "base64url";
1102
+ });
1103
+ inst._zod.check = (payload) => {
1104
+ if (isValidBase64URL(payload.value))
1105
+ return;
1106
+ payload.issues.push({
1107
+ code: "invalid_format",
1108
+ format: "base64url",
1109
+ input: payload.value,
1110
+ inst,
1111
+ continue: !def.abort
1112
+ });
1113
+ };
1114
+ });
1115
+ const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
1116
+ def.pattern ?? (def.pattern = e164);
1117
+ $ZodStringFormat.init(inst, def);
1118
+ });
1119
+ function isValidJWT(token, algorithm = null) {
1120
+ try {
1121
+ const tokensParts = token.split(".");
1122
+ if (tokensParts.length !== 3)
1123
+ return false;
1124
+ const [header] = tokensParts;
1125
+ const parsedHeader = JSON.parse(atob(header));
1126
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
1127
+ return false;
1128
+ if (!parsedHeader.alg)
1129
+ return false;
1130
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
1131
+ return false;
1132
+ return true;
1133
+ } catch {
1134
+ return false;
1135
+ }
1136
+ }
1137
+ const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
1138
+ $ZodStringFormat.init(inst, def);
1139
+ inst._zod.check = (payload) => {
1140
+ if (isValidJWT(payload.value, def.alg))
1141
+ return;
1142
+ payload.issues.push({
1143
+ code: "invalid_format",
1144
+ format: "jwt",
1145
+ input: payload.value,
1146
+ inst,
1147
+ continue: !def.abort
1148
+ });
1149
+ };
1150
+ });
1151
+ const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
1152
+ $ZodType.init(inst, def);
1153
+ inst._zod.parse = (payload) => payload;
1154
+ });
1155
+ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
1156
+ $ZodType.init(inst, def);
1157
+ inst._zod.parse = (payload, _ctx) => {
1158
+ payload.issues.push({
1159
+ expected: "never",
1160
+ code: "invalid_type",
1161
+ input: payload.value,
1162
+ inst
1163
+ });
1164
+ return payload;
1165
+ };
1166
+ });
1167
+ function handleArrayResult(result, final, index) {
1168
+ if (result.issues.length) {
1169
+ final.issues.push(...prefixIssues(index, result.issues));
1170
+ }
1171
+ final.value[index] = result.value;
1172
+ }
1173
+ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1174
+ $ZodType.init(inst, def);
1175
+ inst._zod.parse = (payload, ctx) => {
1176
+ const input = payload.value;
1177
+ if (!Array.isArray(input)) {
1178
+ payload.issues.push({
1179
+ expected: "array",
1180
+ code: "invalid_type",
1181
+ input,
1182
+ inst
1183
+ });
1184
+ return payload;
1185
+ }
1186
+ payload.value = Array(input.length);
1187
+ const proms = [];
1188
+ for (let i = 0; i < input.length; i++) {
1189
+ const item = input[i];
1190
+ const result = def.element._zod.run({
1191
+ value: item,
1192
+ issues: []
1193
+ }, ctx);
1194
+ if (result instanceof Promise) {
1195
+ proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
1196
+ } else {
1197
+ handleArrayResult(result, payload, i);
1198
+ }
1199
+ }
1200
+ if (proms.length) {
1201
+ return Promise.all(proms).then(() => payload);
1202
+ }
1203
+ return payload;
1204
+ };
1205
+ });
1206
+ function handleObjectResult(result, final, key) {
1207
+ if (result.issues.length) {
1208
+ final.issues.push(...prefixIssues(key, result.issues));
1209
+ }
1210
+ final.value[key] = result.value;
1211
+ }
1212
+ function handleOptionalObjectResult(result, final, key, input) {
1213
+ if (result.issues.length) {
1214
+ if (input[key] === void 0) {
1215
+ if (key in input) {
1216
+ final.value[key] = void 0;
1217
+ } else {
1218
+ final.value[key] = result.value;
1219
+ }
1220
+ } else {
1221
+ final.issues.push(...prefixIssues(key, result.issues));
1222
+ }
1223
+ } else if (result.value === void 0) {
1224
+ if (key in input)
1225
+ final.value[key] = void 0;
1226
+ } else {
1227
+ final.value[key] = result.value;
1228
+ }
1229
+ }
1230
+ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1231
+ $ZodType.init(inst, def);
1232
+ const _normalized = cached(() => {
1233
+ const keys = Object.keys(def.shape);
1234
+ for (const k of keys) {
1235
+ if (!(def.shape[k] instanceof $ZodType)) {
1236
+ throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1237
+ }
1238
+ }
1239
+ const okeys = optionalKeys(def.shape);
1240
+ return {
1241
+ shape: def.shape,
1242
+ keys,
1243
+ keySet: new Set(keys),
1244
+ numKeys: keys.length,
1245
+ optionalKeys: new Set(okeys)
1246
+ };
1247
+ });
1248
+ defineLazy(inst._zod, "propValues", () => {
1249
+ const shape = def.shape;
1250
+ const propValues = {};
1251
+ for (const key in shape) {
1252
+ const field = shape[key]._zod;
1253
+ if (field.values) {
1254
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1255
+ for (const v of field.values)
1256
+ propValues[key].add(v);
1257
+ }
1258
+ }
1259
+ return propValues;
1260
+ });
1261
+ const generateFastpass = (shape) => {
1262
+ const doc = new Doc(["shape", "payload", "ctx"]);
1263
+ const { keys, optionalKeys: optionalKeys2 } = _normalized.value;
1264
+ const parseStr = (key) => {
1265
+ const k = esc(key);
1266
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1267
+ };
1268
+ doc.write(`const input = payload.value;`);
1269
+ const ids = /* @__PURE__ */ Object.create(null);
1270
+ for (const key of keys) {
1271
+ ids[key] = randomString(15);
1272
+ }
1273
+ doc.write(`const newResult = {}`);
1274
+ for (const key of keys) {
1275
+ if (optionalKeys2.has(key)) {
1276
+ const id = ids[key];
1277
+ doc.write(`const ${id} = ${parseStr(key)};`);
1278
+ const k = esc(key);
1279
+ doc.write(`
1280
+ if (${id}.issues.length) {
1281
+ if (input[${k}] === undefined) {
1282
+ if (${k} in input) {
1283
+ newResult[${k}] = undefined;
1284
+ }
1285
+ } else {
1286
+ payload.issues = payload.issues.concat(
1287
+ ${id}.issues.map((iss) => ({
1288
+ ...iss,
1289
+ path: iss.path ? [${k}, ...iss.path] : [${k}],
1290
+ }))
1291
+ );
1292
+ }
1293
+ } else if (${id}.value === undefined) {
1294
+ if (${k} in input) newResult[${k}] = undefined;
1295
+ } else {
1296
+ newResult[${k}] = ${id}.value;
1297
+ }
1298
+ `);
1299
+ } else {
1300
+ const id = ids[key];
1301
+ doc.write(`const ${id} = ${parseStr(key)};`);
1302
+ doc.write(`
1303
+ if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1304
+ ...iss,
1305
+ path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
1306
+ })));`);
1307
+ doc.write(`newResult[${esc(key)}] = ${id}.value`);
1308
+ }
1309
+ }
1310
+ doc.write(`payload.value = newResult;`);
1311
+ doc.write(`return payload;`);
1312
+ const fn = doc.compile();
1313
+ return (payload, ctx) => fn(shape, payload, ctx);
1314
+ };
1315
+ let fastpass;
1316
+ const isObject$1 = isObject;
1317
+ const jit = !globalConfig.jitless;
1318
+ const allowsEval$1 = allowsEval;
1319
+ const fastEnabled = jit && allowsEval$1.value;
1320
+ const { catchall } = def;
1321
+ let value;
1322
+ inst._zod.parse = (payload, ctx) => {
1323
+ value ?? (value = _normalized.value);
1324
+ const input = payload.value;
1325
+ if (!isObject$1(input)) {
1326
+ payload.issues.push({
1327
+ expected: "object",
1328
+ code: "invalid_type",
1329
+ input,
1330
+ inst
1331
+ });
1332
+ return payload;
1333
+ }
1334
+ const proms = [];
1335
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1336
+ if (!fastpass)
1337
+ fastpass = generateFastpass(def.shape);
1338
+ payload = fastpass(payload, ctx);
1339
+ } else {
1340
+ payload.value = {};
1341
+ const shape = value.shape;
1342
+ for (const key of value.keys) {
1343
+ const el = shape[key];
1344
+ const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1345
+ const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
1346
+ if (r instanceof Promise) {
1347
+ proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
1348
+ } else {
1349
+ if (isOptional) {
1350
+ handleOptionalObjectResult(r, payload, key, input);
1351
+ } else {
1352
+ handleObjectResult(r, payload, key);
1353
+ }
1354
+ }
1355
+ }
1356
+ }
1357
+ if (!catchall) {
1358
+ return proms.length ? Promise.all(proms).then(() => payload) : payload;
1359
+ }
1360
+ const unrecognized = [];
1361
+ const keySet = value.keySet;
1362
+ const _catchall = catchall._zod;
1363
+ const t = _catchall.def.type;
1364
+ for (const key of Object.keys(input)) {
1365
+ if (keySet.has(key))
1366
+ continue;
1367
+ if (t === "never") {
1368
+ unrecognized.push(key);
1369
+ continue;
1370
+ }
1371
+ const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1372
+ if (r instanceof Promise) {
1373
+ proms.push(r.then((r2) => handleObjectResult(r2, payload, key)));
1374
+ } else {
1375
+ handleObjectResult(r, payload, key);
1376
+ }
1377
+ }
1378
+ if (unrecognized.length) {
1379
+ payload.issues.push({
1380
+ code: "unrecognized_keys",
1381
+ keys: unrecognized,
1382
+ input,
1383
+ inst
1384
+ });
1385
+ }
1386
+ if (!proms.length)
1387
+ return payload;
1388
+ return Promise.all(proms).then(() => {
1389
+ return payload;
1390
+ });
1391
+ };
1392
+ });
1393
+ function handleUnionResults(results, final, inst, ctx) {
1394
+ for (const result of results) {
1395
+ if (result.issues.length === 0) {
1396
+ final.value = result.value;
1397
+ return final;
1398
+ }
1399
+ }
1400
+ final.issues.push({
1401
+ code: "invalid_union",
1402
+ input: final.value,
1403
+ inst,
1404
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1405
+ });
1406
+ return final;
1407
+ }
1408
+ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1409
+ $ZodType.init(inst, def);
1410
+ defineLazy(inst._zod, "values", () => {
1411
+ if (def.options.every((o) => o._zod.values)) {
1412
+ return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1413
+ }
1414
+ return void 0;
1415
+ });
1416
+ defineLazy(inst._zod, "pattern", () => {
1417
+ if (def.options.every((o) => o._zod.pattern)) {
1418
+ const patterns = def.options.map((o) => o._zod.pattern);
1419
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1420
+ }
1421
+ return void 0;
1422
+ });
1423
+ inst._zod.parse = (payload, ctx) => {
1424
+ let async = false;
1425
+ const results = [];
1426
+ for (const option of def.options) {
1427
+ const result = option._zod.run({
1428
+ value: payload.value,
1429
+ issues: []
1430
+ }, ctx);
1431
+ if (result instanceof Promise) {
1432
+ results.push(result);
1433
+ async = true;
1434
+ } else {
1435
+ if (result.issues.length === 0)
1436
+ return result;
1437
+ results.push(result);
1438
+ }
1439
+ }
1440
+ if (!async)
1441
+ return handleUnionResults(results, payload, inst, ctx);
1442
+ return Promise.all(results).then((results2) => {
1443
+ return handleUnionResults(results2, payload, inst, ctx);
1444
+ });
1445
+ };
1446
+ });
1447
+ const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
1448
+ $ZodType.init(inst, def);
1449
+ inst._zod.parse = (payload, ctx) => {
1450
+ const { value: input } = payload;
1451
+ const left = def.left._zod.run({ value: input, issues: [] }, ctx);
1452
+ const right = def.right._zod.run({ value: input, issues: [] }, ctx);
1453
+ const async = left instanceof Promise || right instanceof Promise;
1454
+ if (async) {
1455
+ return Promise.all([left, right]).then(([left2, right2]) => {
1456
+ return handleIntersectionResults(payload, left2, right2);
1457
+ });
1458
+ }
1459
+ return handleIntersectionResults(payload, left, right);
1460
+ };
1461
+ });
1462
+ function mergeValues(a, b) {
1463
+ if (a === b) {
1464
+ return { valid: true, data: a };
1465
+ }
1466
+ if (a instanceof Date && b instanceof Date && +a === +b) {
1467
+ return { valid: true, data: a };
1468
+ }
1469
+ if (isPlainObject(a) && isPlainObject(b)) {
1470
+ const bKeys = Object.keys(b);
1471
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1472
+ const newObj = { ...a, ...b };
1473
+ for (const key of sharedKeys) {
1474
+ const sharedValue = mergeValues(a[key], b[key]);
1475
+ if (!sharedValue.valid) {
1476
+ return {
1477
+ valid: false,
1478
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
1479
+ };
1480
+ }
1481
+ newObj[key] = sharedValue.data;
1482
+ }
1483
+ return { valid: true, data: newObj };
1484
+ }
1485
+ if (Array.isArray(a) && Array.isArray(b)) {
1486
+ if (a.length !== b.length) {
1487
+ return { valid: false, mergeErrorPath: [] };
1488
+ }
1489
+ const newArray = [];
1490
+ for (let index = 0; index < a.length; index++) {
1491
+ const itemA = a[index];
1492
+ const itemB = b[index];
1493
+ const sharedValue = mergeValues(itemA, itemB);
1494
+ if (!sharedValue.valid) {
1495
+ return {
1496
+ valid: false,
1497
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
1498
+ };
1499
+ }
1500
+ newArray.push(sharedValue.data);
1501
+ }
1502
+ return { valid: true, data: newArray };
1503
+ }
1504
+ return { valid: false, mergeErrorPath: [] };
1505
+ }
1506
+ function handleIntersectionResults(result, left, right) {
1507
+ if (left.issues.length) {
1508
+ result.issues.push(...left.issues);
1509
+ }
1510
+ if (right.issues.length) {
1511
+ result.issues.push(...right.issues);
1512
+ }
1513
+ if (aborted(result))
1514
+ return result;
1515
+ const merged = mergeValues(left.value, right.value);
1516
+ if (!merged.valid) {
1517
+ throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
1518
+ }
1519
+ result.value = merged.data;
1520
+ return result;
1521
+ }
1522
+ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1523
+ $ZodType.init(inst, def);
1524
+ const values = getEnumValues(def.entries);
1525
+ inst._zod.values = new Set(values);
1526
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
1527
+ inst._zod.parse = (payload, _ctx) => {
1528
+ const input = payload.value;
1529
+ if (inst._zod.values.has(input)) {
1530
+ return payload;
1531
+ }
1532
+ payload.issues.push({
1533
+ code: "invalid_value",
1534
+ values,
1535
+ input,
1536
+ inst
1537
+ });
1538
+ return payload;
1539
+ };
1540
+ });
1541
+ const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
1542
+ $ZodType.init(inst, def);
1543
+ inst._zod.parse = (payload, _ctx) => {
1544
+ const _out = def.transform(payload.value, payload);
1545
+ if (_ctx.async) {
1546
+ const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1547
+ return output.then((output2) => {
1548
+ payload.value = output2;
1549
+ return payload;
1550
+ });
1551
+ }
1552
+ if (_out instanceof Promise) {
1553
+ throw new $ZodAsyncError();
1554
+ }
1555
+ payload.value = _out;
1556
+ return payload;
1557
+ };
1558
+ });
1559
+ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
1560
+ $ZodType.init(inst, def);
1561
+ inst._zod.optin = "optional";
1562
+ inst._zod.optout = "optional";
1563
+ defineLazy(inst._zod, "values", () => {
1564
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
1565
+ });
1566
+ defineLazy(inst._zod, "pattern", () => {
1567
+ const pattern = def.innerType._zod.pattern;
1568
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1569
+ });
1570
+ inst._zod.parse = (payload, ctx) => {
1571
+ if (payload.value === void 0) {
1572
+ return payload;
1573
+ }
1574
+ return def.innerType._zod.run(payload, ctx);
1575
+ };
1576
+ });
1577
+ const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
1578
+ $ZodType.init(inst, def);
1579
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1580
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1581
+ defineLazy(inst._zod, "pattern", () => {
1582
+ const pattern = def.innerType._zod.pattern;
1583
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1584
+ });
1585
+ defineLazy(inst._zod, "values", () => {
1586
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
1587
+ });
1588
+ inst._zod.parse = (payload, ctx) => {
1589
+ if (payload.value === null)
1590
+ return payload;
1591
+ return def.innerType._zod.run(payload, ctx);
1592
+ };
1593
+ });
1594
+ const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
1595
+ $ZodType.init(inst, def);
1596
+ inst._zod.optin = "optional";
1597
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1598
+ inst._zod.parse = (payload, ctx) => {
1599
+ if (payload.value === void 0) {
1600
+ payload.value = def.defaultValue;
1601
+ return payload;
1602
+ }
1603
+ const result = def.innerType._zod.run(payload, ctx);
1604
+ if (result instanceof Promise) {
1605
+ return result.then((result2) => handleDefaultResult(result2, def));
1606
+ }
1607
+ return handleDefaultResult(result, def);
1608
+ };
1609
+ });
1610
+ function handleDefaultResult(payload, def) {
1611
+ if (payload.value === void 0) {
1612
+ payload.value = def.defaultValue;
1613
+ }
1614
+ return payload;
1615
+ }
1616
+ const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
1617
+ $ZodType.init(inst, def);
1618
+ inst._zod.optin = "optional";
1619
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1620
+ inst._zod.parse = (payload, ctx) => {
1621
+ if (payload.value === void 0) {
1622
+ payload.value = def.defaultValue;
1623
+ }
1624
+ return def.innerType._zod.run(payload, ctx);
1625
+ };
1626
+ });
1627
+ const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
1628
+ $ZodType.init(inst, def);
1629
+ defineLazy(inst._zod, "values", () => {
1630
+ const v = def.innerType._zod.values;
1631
+ return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
1632
+ });
1633
+ inst._zod.parse = (payload, ctx) => {
1634
+ const result = def.innerType._zod.run(payload, ctx);
1635
+ if (result instanceof Promise) {
1636
+ return result.then((result2) => handleNonOptionalResult(result2, inst));
1637
+ }
1638
+ return handleNonOptionalResult(result, inst);
1639
+ };
1640
+ });
1641
+ function handleNonOptionalResult(payload, inst) {
1642
+ if (!payload.issues.length && payload.value === void 0) {
1643
+ payload.issues.push({
1644
+ code: "invalid_type",
1645
+ expected: "nonoptional",
1646
+ input: payload.value,
1647
+ inst
1648
+ });
1649
+ }
1650
+ return payload;
1651
+ }
1652
+ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
1653
+ $ZodType.init(inst, def);
1654
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1655
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1656
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1657
+ inst._zod.parse = (payload, ctx) => {
1658
+ const result = def.innerType._zod.run(payload, ctx);
1659
+ if (result instanceof Promise) {
1660
+ return result.then((result2) => {
1661
+ payload.value = result2.value;
1662
+ if (result2.issues.length) {
1663
+ payload.value = def.catchValue({
1664
+ ...payload,
1665
+ error: {
1666
+ issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
1667
+ },
1668
+ input: payload.value
1669
+ });
1670
+ payload.issues = [];
1671
+ }
1672
+ return payload;
1673
+ });
1674
+ }
1675
+ payload.value = result.value;
1676
+ if (result.issues.length) {
1677
+ payload.value = def.catchValue({
1678
+ ...payload,
1679
+ error: {
1680
+ issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
1681
+ },
1682
+ input: payload.value
1683
+ });
1684
+ payload.issues = [];
1685
+ }
1686
+ return payload;
1687
+ };
1688
+ });
1689
+ const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
1690
+ $ZodType.init(inst, def);
1691
+ defineLazy(inst._zod, "values", () => def.in._zod.values);
1692
+ defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1693
+ defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1694
+ inst._zod.parse = (payload, ctx) => {
1695
+ const left = def.in._zod.run(payload, ctx);
1696
+ if (left instanceof Promise) {
1697
+ return left.then((left2) => handlePipeResult(left2, def, ctx));
1698
+ }
1699
+ return handlePipeResult(left, def, ctx);
1700
+ };
1701
+ });
1702
+ function handlePipeResult(left, def, ctx) {
1703
+ if (aborted(left)) {
1704
+ return left;
1705
+ }
1706
+ return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
1707
+ }
1708
+ const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
1709
+ $ZodType.init(inst, def);
1710
+ defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1711
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1712
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1713
+ inst._zod.parse = (payload, ctx) => {
1714
+ const result = def.innerType._zod.run(payload, ctx);
1715
+ if (result instanceof Promise) {
1716
+ return result.then(handleReadonlyResult);
1717
+ }
1718
+ return handleReadonlyResult(result);
1719
+ };
1720
+ });
1721
+ function handleReadonlyResult(payload) {
1722
+ payload.value = Object.freeze(payload.value);
1723
+ return payload;
1724
+ }
1725
+ const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
1726
+ $ZodCheck.init(inst, def);
1727
+ $ZodType.init(inst, def);
1728
+ inst._zod.parse = (payload, _) => {
1729
+ return payload;
1730
+ };
1731
+ inst._zod.check = (payload) => {
1732
+ const input = payload.value;
1733
+ const r = def.fn(input);
1734
+ if (r instanceof Promise) {
1735
+ return r.then((r2) => handleRefineResult(r2, payload, input, inst));
1736
+ }
1737
+ handleRefineResult(r, payload, input, inst);
1738
+ return;
1739
+ };
1740
+ });
1741
+ function handleRefineResult(result, payload, input, inst) {
1742
+ if (!result) {
1743
+ const _iss = {
1744
+ code: "custom",
1745
+ input,
1746
+ inst,
1747
+ // incorporates params.error into issue reporting
1748
+ path: [...inst._zod.def.path ?? []],
1749
+ // incorporates params.error into issue reporting
1750
+ continue: !inst._zod.def.abort
1751
+ // params: inst._zod.def.params,
1752
+ };
1753
+ if (inst._zod.def.params)
1754
+ _iss.params = inst._zod.def.params;
1755
+ payload.issues.push(issue(_iss));
1756
+ }
1757
+ }
1758
+ class $ZodRegistry {
1759
+ constructor() {
1760
+ this._map = /* @__PURE__ */ new WeakMap();
1761
+ this._idmap = /* @__PURE__ */ new Map();
1762
+ }
1763
+ add(schema, ..._meta) {
1764
+ const meta = _meta[0];
1765
+ this._map.set(schema, meta);
1766
+ if (meta && typeof meta === "object" && "id" in meta) {
1767
+ if (this._idmap.has(meta.id)) {
1768
+ throw new Error(`ID ${meta.id} already exists in the registry`);
1769
+ }
1770
+ this._idmap.set(meta.id, schema);
1771
+ }
1772
+ return this;
1773
+ }
1774
+ remove(schema) {
1775
+ this._map.delete(schema);
1776
+ return this;
1777
+ }
1778
+ get(schema) {
1779
+ const p = schema._zod.parent;
1780
+ if (p) {
1781
+ const pm = { ...this.get(p) ?? {} };
1782
+ delete pm.id;
1783
+ return { ...pm, ...this._map.get(schema) };
1784
+ }
1785
+ return this._map.get(schema);
1786
+ }
1787
+ has(schema) {
1788
+ return this._map.has(schema);
1789
+ }
1790
+ }
1791
+ function registry() {
1792
+ return new $ZodRegistry();
1793
+ }
1794
+ const globalRegistry = /* @__PURE__ */ registry();
1795
+ function _string(Class, params) {
1796
+ return new Class({
1797
+ type: "string",
1798
+ ...normalizeParams(params)
1799
+ });
1800
+ }
1801
+ function _email(Class, params) {
1802
+ return new Class({
1803
+ type: "string",
1804
+ format: "email",
1805
+ check: "string_format",
1806
+ abort: false,
1807
+ ...normalizeParams(params)
1808
+ });
1809
+ }
1810
+ function _guid(Class, params) {
1811
+ return new Class({
1812
+ type: "string",
1813
+ format: "guid",
1814
+ check: "string_format",
1815
+ abort: false,
1816
+ ...normalizeParams(params)
1817
+ });
1818
+ }
1819
+ function _uuid(Class, params) {
1820
+ return new Class({
1821
+ type: "string",
1822
+ format: "uuid",
1823
+ check: "string_format",
1824
+ abort: false,
1825
+ ...normalizeParams(params)
1826
+ });
1827
+ }
1828
+ function _uuidv4(Class, params) {
1829
+ return new Class({
1830
+ type: "string",
1831
+ format: "uuid",
1832
+ check: "string_format",
1833
+ abort: false,
1834
+ version: "v4",
1835
+ ...normalizeParams(params)
1836
+ });
1837
+ }
1838
+ function _uuidv6(Class, params) {
1839
+ return new Class({
1840
+ type: "string",
1841
+ format: "uuid",
1842
+ check: "string_format",
1843
+ abort: false,
1844
+ version: "v6",
1845
+ ...normalizeParams(params)
1846
+ });
1847
+ }
1848
+ function _uuidv7(Class, params) {
1849
+ return new Class({
1850
+ type: "string",
1851
+ format: "uuid",
1852
+ check: "string_format",
1853
+ abort: false,
1854
+ version: "v7",
1855
+ ...normalizeParams(params)
1856
+ });
1857
+ }
1858
+ function _url(Class, params) {
1859
+ return new Class({
1860
+ type: "string",
1861
+ format: "url",
1862
+ check: "string_format",
1863
+ abort: false,
1864
+ ...normalizeParams(params)
1865
+ });
1866
+ }
1867
+ function _emoji(Class, params) {
1868
+ return new Class({
1869
+ type: "string",
1870
+ format: "emoji",
1871
+ check: "string_format",
1872
+ abort: false,
1873
+ ...normalizeParams(params)
1874
+ });
1875
+ }
1876
+ function _nanoid(Class, params) {
1877
+ return new Class({
1878
+ type: "string",
1879
+ format: "nanoid",
1880
+ check: "string_format",
1881
+ abort: false,
1882
+ ...normalizeParams(params)
1883
+ });
1884
+ }
1885
+ function _cuid(Class, params) {
1886
+ return new Class({
1887
+ type: "string",
1888
+ format: "cuid",
1889
+ check: "string_format",
1890
+ abort: false,
1891
+ ...normalizeParams(params)
1892
+ });
1893
+ }
1894
+ function _cuid2(Class, params) {
1895
+ return new Class({
1896
+ type: "string",
1897
+ format: "cuid2",
1898
+ check: "string_format",
1899
+ abort: false,
1900
+ ...normalizeParams(params)
1901
+ });
1902
+ }
1903
+ function _ulid(Class, params) {
1904
+ return new Class({
1905
+ type: "string",
1906
+ format: "ulid",
1907
+ check: "string_format",
1908
+ abort: false,
1909
+ ...normalizeParams(params)
1910
+ });
1911
+ }
1912
+ function _xid(Class, params) {
1913
+ return new Class({
1914
+ type: "string",
1915
+ format: "xid",
1916
+ check: "string_format",
1917
+ abort: false,
1918
+ ...normalizeParams(params)
1919
+ });
1920
+ }
1921
+ function _ksuid(Class, params) {
1922
+ return new Class({
1923
+ type: "string",
1924
+ format: "ksuid",
1925
+ check: "string_format",
1926
+ abort: false,
1927
+ ...normalizeParams(params)
1928
+ });
1929
+ }
1930
+ function _ipv4(Class, params) {
1931
+ return new Class({
1932
+ type: "string",
1933
+ format: "ipv4",
1934
+ check: "string_format",
1935
+ abort: false,
1936
+ ...normalizeParams(params)
1937
+ });
1938
+ }
1939
+ function _ipv6(Class, params) {
1940
+ return new Class({
1941
+ type: "string",
1942
+ format: "ipv6",
1943
+ check: "string_format",
1944
+ abort: false,
1945
+ ...normalizeParams(params)
1946
+ });
1947
+ }
1948
+ function _cidrv4(Class, params) {
1949
+ return new Class({
1950
+ type: "string",
1951
+ format: "cidrv4",
1952
+ check: "string_format",
1953
+ abort: false,
1954
+ ...normalizeParams(params)
1955
+ });
1956
+ }
1957
+ function _cidrv6(Class, params) {
1958
+ return new Class({
1959
+ type: "string",
1960
+ format: "cidrv6",
1961
+ check: "string_format",
1962
+ abort: false,
1963
+ ...normalizeParams(params)
1964
+ });
1965
+ }
1966
+ function _base64(Class, params) {
1967
+ return new Class({
1968
+ type: "string",
1969
+ format: "base64",
1970
+ check: "string_format",
1971
+ abort: false,
1972
+ ...normalizeParams(params)
1973
+ });
1974
+ }
1975
+ function _base64url(Class, params) {
1976
+ return new Class({
1977
+ type: "string",
1978
+ format: "base64url",
1979
+ check: "string_format",
1980
+ abort: false,
1981
+ ...normalizeParams(params)
1982
+ });
1983
+ }
1984
+ function _e164(Class, params) {
1985
+ return new Class({
1986
+ type: "string",
1987
+ format: "e164",
1988
+ check: "string_format",
1989
+ abort: false,
1990
+ ...normalizeParams(params)
1991
+ });
1992
+ }
1993
+ function _jwt(Class, params) {
1994
+ return new Class({
1995
+ type: "string",
1996
+ format: "jwt",
1997
+ check: "string_format",
1998
+ abort: false,
1999
+ ...normalizeParams(params)
2000
+ });
2001
+ }
2002
+ function _isoDateTime(Class, params) {
2003
+ return new Class({
2004
+ type: "string",
2005
+ format: "datetime",
2006
+ check: "string_format",
2007
+ offset: false,
2008
+ local: false,
2009
+ precision: null,
2010
+ ...normalizeParams(params)
2011
+ });
2012
+ }
2013
+ function _isoDate(Class, params) {
2014
+ return new Class({
2015
+ type: "string",
2016
+ format: "date",
2017
+ check: "string_format",
2018
+ ...normalizeParams(params)
2019
+ });
2020
+ }
2021
+ function _isoTime(Class, params) {
2022
+ return new Class({
2023
+ type: "string",
2024
+ format: "time",
2025
+ check: "string_format",
2026
+ precision: null,
2027
+ ...normalizeParams(params)
2028
+ });
2029
+ }
2030
+ function _isoDuration(Class, params) {
2031
+ return new Class({
2032
+ type: "string",
2033
+ format: "duration",
2034
+ check: "string_format",
2035
+ ...normalizeParams(params)
2036
+ });
2037
+ }
2038
+ function _unknown(Class) {
2039
+ return new Class({
2040
+ type: "unknown"
2041
+ });
2042
+ }
2043
+ function _never(Class, params) {
2044
+ return new Class({
2045
+ type: "never",
2046
+ ...normalizeParams(params)
2047
+ });
2048
+ }
2049
+ function _maxLength(maximum, params) {
2050
+ const ch = new $ZodCheckMaxLength({
2051
+ check: "max_length",
2052
+ ...normalizeParams(params),
2053
+ maximum
2054
+ });
2055
+ return ch;
2056
+ }
2057
+ function _minLength(minimum, params) {
2058
+ return new $ZodCheckMinLength({
2059
+ check: "min_length",
2060
+ ...normalizeParams(params),
2061
+ minimum
2062
+ });
2063
+ }
2064
+ function _length(length, params) {
2065
+ return new $ZodCheckLengthEquals({
2066
+ check: "length_equals",
2067
+ ...normalizeParams(params),
2068
+ length
2069
+ });
2070
+ }
2071
+ function _regex(pattern, params) {
2072
+ return new $ZodCheckRegex({
2073
+ check: "string_format",
2074
+ format: "regex",
2075
+ ...normalizeParams(params),
2076
+ pattern
2077
+ });
2078
+ }
2079
+ function _lowercase(params) {
2080
+ return new $ZodCheckLowerCase({
2081
+ check: "string_format",
2082
+ format: "lowercase",
2083
+ ...normalizeParams(params)
2084
+ });
2085
+ }
2086
+ function _uppercase(params) {
2087
+ return new $ZodCheckUpperCase({
2088
+ check: "string_format",
2089
+ format: "uppercase",
2090
+ ...normalizeParams(params)
2091
+ });
2092
+ }
2093
+ function _includes(includes, params) {
2094
+ return new $ZodCheckIncludes({
2095
+ check: "string_format",
2096
+ format: "includes",
2097
+ ...normalizeParams(params),
2098
+ includes
2099
+ });
2100
+ }
2101
+ function _startsWith(prefix, params) {
2102
+ return new $ZodCheckStartsWith({
2103
+ check: "string_format",
2104
+ format: "starts_with",
2105
+ ...normalizeParams(params),
2106
+ prefix
2107
+ });
2108
+ }
2109
+ function _endsWith(suffix, params) {
2110
+ return new $ZodCheckEndsWith({
2111
+ check: "string_format",
2112
+ format: "ends_with",
2113
+ ...normalizeParams(params),
2114
+ suffix
2115
+ });
2116
+ }
2117
+ function _overwrite(tx) {
2118
+ return new $ZodCheckOverwrite({
2119
+ check: "overwrite",
2120
+ tx
2121
+ });
2122
+ }
2123
+ function _normalize(form) {
2124
+ return _overwrite((input) => input.normalize(form));
2125
+ }
2126
+ function _trim() {
2127
+ return _overwrite((input) => input.trim());
2128
+ }
2129
+ function _toLowerCase() {
2130
+ return _overwrite((input) => input.toLowerCase());
2131
+ }
2132
+ function _toUpperCase() {
2133
+ return _overwrite((input) => input.toUpperCase());
2134
+ }
2135
+ function _array(Class, element, params) {
2136
+ return new Class({
2137
+ type: "array",
2138
+ element,
2139
+ // get element() {
2140
+ // return element;
2141
+ // },
2142
+ ...normalizeParams(params)
2143
+ });
2144
+ }
2145
+ function _refine(Class, fn, _params) {
2146
+ const schema = new Class({
2147
+ type: "custom",
2148
+ check: "custom",
2149
+ fn,
2150
+ ...normalizeParams(_params)
2151
+ });
2152
+ return schema;
2153
+ }
2154
+ const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
2155
+ $ZodISODateTime.init(inst, def);
2156
+ ZodStringFormat.init(inst, def);
2157
+ });
2158
+ function datetime(params) {
2159
+ return _isoDateTime(ZodISODateTime, params);
2160
+ }
2161
+ const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
2162
+ $ZodISODate.init(inst, def);
2163
+ ZodStringFormat.init(inst, def);
2164
+ });
2165
+ function date(params) {
2166
+ return _isoDate(ZodISODate, params);
2167
+ }
2168
+ const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
2169
+ $ZodISOTime.init(inst, def);
2170
+ ZodStringFormat.init(inst, def);
2171
+ });
2172
+ function time(params) {
2173
+ return _isoTime(ZodISOTime, params);
2174
+ }
2175
+ const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
2176
+ $ZodISODuration.init(inst, def);
2177
+ ZodStringFormat.init(inst, def);
2178
+ });
2179
+ function duration(params) {
2180
+ return _isoDuration(ZodISODuration, params);
2181
+ }
2182
+ const initializer = (inst, issues) => {
2183
+ $ZodError.init(inst, issues);
2184
+ inst.name = "ZodError";
2185
+ Object.defineProperties(inst, {
2186
+ format: {
2187
+ value: (mapper) => formatError(inst, mapper)
2188
+ // enumerable: false,
2189
+ },
2190
+ flatten: {
2191
+ value: (mapper) => flattenError(inst, mapper)
2192
+ // enumerable: false,
2193
+ },
2194
+ addIssue: {
2195
+ value: (issue2) => inst.issues.push(issue2)
2196
+ // enumerable: false,
2197
+ },
2198
+ addIssues: {
2199
+ value: (issues2) => inst.issues.push(...issues2)
2200
+ // enumerable: false,
2201
+ },
2202
+ isEmpty: {
2203
+ get() {
2204
+ return inst.issues.length === 0;
2205
+ }
2206
+ // enumerable: false,
2207
+ }
2208
+ });
2209
+ };
2210
+ const ZodRealError = $constructor("ZodError", initializer, {
2211
+ Parent: Error
2212
+ });
2213
+ const parse = /* @__PURE__ */ _parse(ZodRealError);
2214
+ const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
2215
+ const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
2216
+ const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
2217
+ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
2218
+ $ZodType.init(inst, def);
2219
+ inst.def = def;
2220
+ Object.defineProperty(inst, "_def", { value: def });
2221
+ inst.check = (...checks) => {
2222
+ return inst.clone(
2223
+ {
2224
+ ...def,
2225
+ checks: [
2226
+ ...def.checks ?? [],
2227
+ ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
2228
+ ]
2229
+ }
2230
+ // { parent: true }
2231
+ );
2232
+ };
2233
+ inst.clone = (def2, params) => clone(inst, def2, params);
2234
+ inst.brand = () => inst;
2235
+ inst.register = (reg, meta) => {
2236
+ reg.add(inst, meta);
2237
+ return inst;
2238
+ };
2239
+ inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
2240
+ inst.safeParse = (data, params) => safeParse(inst, data, params);
2241
+ inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
2242
+ inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
2243
+ inst.spa = inst.safeParseAsync;
2244
+ inst.refine = (check2, params) => inst.check(refine(check2, params));
2245
+ inst.superRefine = (refinement) => inst.check(superRefine(refinement));
2246
+ inst.overwrite = (fn) => inst.check(_overwrite(fn));
2247
+ inst.optional = () => optional(inst);
2248
+ inst.nullable = () => nullable(inst);
2249
+ inst.nullish = () => optional(nullable(inst));
2250
+ inst.nonoptional = (params) => nonoptional(inst, params);
2251
+ inst.array = () => array(inst);
2252
+ inst.or = (arg) => union([inst, arg]);
2253
+ inst.and = (arg) => intersection(inst, arg);
2254
+ inst.transform = (tx) => pipe(inst, transform(tx));
2255
+ inst.default = (def2) => _default(inst, def2);
2256
+ inst.prefault = (def2) => prefault(inst, def2);
2257
+ inst.catch = (params) => _catch(inst, params);
2258
+ inst.pipe = (target) => pipe(inst, target);
2259
+ inst.readonly = () => readonly(inst);
2260
+ inst.describe = (description) => {
2261
+ const cl = inst.clone();
2262
+ globalRegistry.add(cl, { description });
2263
+ return cl;
2264
+ };
2265
+ Object.defineProperty(inst, "description", {
2266
+ get() {
2267
+ return globalRegistry.get(inst)?.description;
2268
+ },
2269
+ configurable: true
2270
+ });
2271
+ inst.meta = (...args) => {
2272
+ if (args.length === 0) {
2273
+ return globalRegistry.get(inst);
2274
+ }
2275
+ const cl = inst.clone();
2276
+ globalRegistry.add(cl, args[0]);
2277
+ return cl;
2278
+ };
2279
+ inst.isOptional = () => inst.safeParse(void 0).success;
2280
+ inst.isNullable = () => inst.safeParse(null).success;
2281
+ return inst;
2282
+ });
2283
+ const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
2284
+ $ZodString.init(inst, def);
2285
+ ZodType.init(inst, def);
2286
+ const bag = inst._zod.bag;
2287
+ inst.format = bag.format ?? null;
2288
+ inst.minLength = bag.minimum ?? null;
2289
+ inst.maxLength = bag.maximum ?? null;
2290
+ inst.regex = (...args) => inst.check(_regex(...args));
2291
+ inst.includes = (...args) => inst.check(_includes(...args));
2292
+ inst.startsWith = (...args) => inst.check(_startsWith(...args));
2293
+ inst.endsWith = (...args) => inst.check(_endsWith(...args));
2294
+ inst.min = (...args) => inst.check(_minLength(...args));
2295
+ inst.max = (...args) => inst.check(_maxLength(...args));
2296
+ inst.length = (...args) => inst.check(_length(...args));
2297
+ inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
2298
+ inst.lowercase = (params) => inst.check(_lowercase(params));
2299
+ inst.uppercase = (params) => inst.check(_uppercase(params));
2300
+ inst.trim = () => inst.check(_trim());
2301
+ inst.normalize = (...args) => inst.check(_normalize(...args));
2302
+ inst.toLowerCase = () => inst.check(_toLowerCase());
2303
+ inst.toUpperCase = () => inst.check(_toUpperCase());
2304
+ });
2305
+ const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
2306
+ $ZodString.init(inst, def);
2307
+ _ZodString.init(inst, def);
2308
+ inst.email = (params) => inst.check(_email(ZodEmail, params));
2309
+ inst.url = (params) => inst.check(_url(ZodURL, params));
2310
+ inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
2311
+ inst.emoji = (params) => inst.check(_emoji(ZodEmoji, params));
2312
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
2313
+ inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
2314
+ inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
2315
+ inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
2316
+ inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
2317
+ inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
2318
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
2319
+ inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
2320
+ inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
2321
+ inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
2322
+ inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
2323
+ inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
2324
+ inst.xid = (params) => inst.check(_xid(ZodXID, params));
2325
+ inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
2326
+ inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
2327
+ inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
2328
+ inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
2329
+ inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
2330
+ inst.e164 = (params) => inst.check(_e164(ZodE164, params));
2331
+ inst.datetime = (params) => inst.check(datetime(params));
2332
+ inst.date = (params) => inst.check(date(params));
2333
+ inst.time = (params) => inst.check(time(params));
2334
+ inst.duration = (params) => inst.check(duration(params));
2335
+ });
2336
+ function string(params) {
2337
+ return _string(ZodString, params);
2338
+ }
2339
+ const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
2340
+ $ZodStringFormat.init(inst, def);
2341
+ _ZodString.init(inst, def);
2342
+ });
2343
+ const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
2344
+ $ZodEmail.init(inst, def);
2345
+ ZodStringFormat.init(inst, def);
2346
+ });
2347
+ function email(params) {
2348
+ return _email(ZodEmail, params);
2349
+ }
2350
+ const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
2351
+ $ZodGUID.init(inst, def);
2352
+ ZodStringFormat.init(inst, def);
2353
+ });
2354
+ const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
2355
+ $ZodUUID.init(inst, def);
2356
+ ZodStringFormat.init(inst, def);
2357
+ });
2358
+ const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
2359
+ $ZodURL.init(inst, def);
2360
+ ZodStringFormat.init(inst, def);
2361
+ });
2362
+ const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
2363
+ $ZodEmoji.init(inst, def);
2364
+ ZodStringFormat.init(inst, def);
2365
+ });
2366
+ const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
2367
+ $ZodNanoID.init(inst, def);
2368
+ ZodStringFormat.init(inst, def);
2369
+ });
2370
+ const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
2371
+ $ZodCUID.init(inst, def);
2372
+ ZodStringFormat.init(inst, def);
2373
+ });
2374
+ const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
2375
+ $ZodCUID2.init(inst, def);
2376
+ ZodStringFormat.init(inst, def);
2377
+ });
2378
+ const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
2379
+ $ZodULID.init(inst, def);
2380
+ ZodStringFormat.init(inst, def);
2381
+ });
2382
+ const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
2383
+ $ZodXID.init(inst, def);
2384
+ ZodStringFormat.init(inst, def);
2385
+ });
2386
+ const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
2387
+ $ZodKSUID.init(inst, def);
2388
+ ZodStringFormat.init(inst, def);
2389
+ });
2390
+ const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
2391
+ $ZodIPv4.init(inst, def);
2392
+ ZodStringFormat.init(inst, def);
2393
+ });
2394
+ const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
2395
+ $ZodIPv6.init(inst, def);
2396
+ ZodStringFormat.init(inst, def);
2397
+ });
2398
+ const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
2399
+ $ZodCIDRv4.init(inst, def);
2400
+ ZodStringFormat.init(inst, def);
2401
+ });
2402
+ const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
2403
+ $ZodCIDRv6.init(inst, def);
2404
+ ZodStringFormat.init(inst, def);
2405
+ });
2406
+ const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
2407
+ $ZodBase64.init(inst, def);
2408
+ ZodStringFormat.init(inst, def);
2409
+ });
2410
+ const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
2411
+ $ZodBase64URL.init(inst, def);
2412
+ ZodStringFormat.init(inst, def);
2413
+ });
2414
+ const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
2415
+ $ZodE164.init(inst, def);
2416
+ ZodStringFormat.init(inst, def);
2417
+ });
2418
+ const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
2419
+ $ZodJWT.init(inst, def);
2420
+ ZodStringFormat.init(inst, def);
2421
+ });
2422
+ const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
2423
+ $ZodUnknown.init(inst, def);
2424
+ ZodType.init(inst, def);
2425
+ });
2426
+ function unknown() {
2427
+ return _unknown(ZodUnknown);
2428
+ }
2429
+ const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
2430
+ $ZodNever.init(inst, def);
2431
+ ZodType.init(inst, def);
2432
+ });
2433
+ function never(params) {
2434
+ return _never(ZodNever, params);
2435
+ }
2436
+ const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
2437
+ $ZodArray.init(inst, def);
2438
+ ZodType.init(inst, def);
2439
+ inst.element = def.element;
2440
+ inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
2441
+ inst.nonempty = (params) => inst.check(_minLength(1, params));
2442
+ inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
2443
+ inst.length = (len, params) => inst.check(_length(len, params));
2444
+ inst.unwrap = () => inst.element;
2445
+ });
2446
+ function array(element, params) {
2447
+ return _array(ZodArray, element, params);
2448
+ }
2449
+ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
2450
+ $ZodObject.init(inst, def);
2451
+ ZodType.init(inst, def);
2452
+ defineLazy(inst, "shape", () => {
2453
+ return Object.fromEntries(Object.entries(inst._zod.def.shape));
2454
+ });
2455
+ inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
2456
+ inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
2457
+ inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
2458
+ inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
2459
+ inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
2460
+ inst.strip = () => inst.clone({ ...inst._zod.def, catchall: void 0 });
2461
+ inst.extend = (incoming) => {
2462
+ return extend(inst, incoming);
2463
+ };
2464
+ inst.merge = (other) => merge(inst, other);
2465
+ inst.pick = (mask) => pick(inst, mask);
2466
+ inst.omit = (mask) => omit(inst, mask);
2467
+ inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
2468
+ inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
2469
+ });
2470
+ function object(shape, params) {
2471
+ const def = {
2472
+ type: "object",
2473
+ get shape() {
2474
+ assignProp(this, "shape", { ...shape });
2475
+ return this.shape;
2476
+ },
2477
+ ...normalizeParams(params)
2478
+ };
2479
+ return new ZodObject(def);
2480
+ }
2481
+ const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
2482
+ $ZodUnion.init(inst, def);
2483
+ ZodType.init(inst, def);
2484
+ inst.options = def.options;
2485
+ });
2486
+ function union(options, params) {
2487
+ return new ZodUnion({
2488
+ type: "union",
2489
+ options,
2490
+ ...normalizeParams(params)
2491
+ });
2492
+ }
2493
+ const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
2494
+ $ZodIntersection.init(inst, def);
2495
+ ZodType.init(inst, def);
2496
+ });
2497
+ function intersection(left, right) {
2498
+ return new ZodIntersection({
2499
+ type: "intersection",
2500
+ left,
2501
+ right
2502
+ });
2503
+ }
2504
+ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
2505
+ $ZodEnum.init(inst, def);
2506
+ ZodType.init(inst, def);
2507
+ inst.enum = def.entries;
2508
+ inst.options = Object.values(def.entries);
2509
+ const keys = new Set(Object.keys(def.entries));
2510
+ inst.extract = (values, params) => {
2511
+ const newEntries = {};
2512
+ for (const value of values) {
2513
+ if (keys.has(value)) {
2514
+ newEntries[value] = def.entries[value];
2515
+ } else
2516
+ throw new Error(`Key ${value} not found in enum`);
2517
+ }
2518
+ return new ZodEnum({
2519
+ ...def,
2520
+ checks: [],
2521
+ ...normalizeParams(params),
2522
+ entries: newEntries
2523
+ });
2524
+ };
2525
+ inst.exclude = (values, params) => {
2526
+ const newEntries = { ...def.entries };
2527
+ for (const value of values) {
2528
+ if (keys.has(value)) {
2529
+ delete newEntries[value];
2530
+ } else
2531
+ throw new Error(`Key ${value} not found in enum`);
2532
+ }
2533
+ return new ZodEnum({
2534
+ ...def,
2535
+ checks: [],
2536
+ ...normalizeParams(params),
2537
+ entries: newEntries
2538
+ });
2539
+ };
2540
+ });
2541
+ function _enum(values, params) {
2542
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
2543
+ return new ZodEnum({
2544
+ type: "enum",
2545
+ entries,
2546
+ ...normalizeParams(params)
2547
+ });
2548
+ }
2549
+ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
2550
+ $ZodTransform.init(inst, def);
2551
+ ZodType.init(inst, def);
2552
+ inst._zod.parse = (payload, _ctx) => {
2553
+ payload.addIssue = (issue$1) => {
2554
+ if (typeof issue$1 === "string") {
2555
+ payload.issues.push(issue(issue$1, payload.value, def));
2556
+ } else {
2557
+ const _issue = issue$1;
2558
+ if (_issue.fatal)
2559
+ _issue.continue = false;
2560
+ _issue.code ?? (_issue.code = "custom");
2561
+ _issue.input ?? (_issue.input = payload.value);
2562
+ _issue.inst ?? (_issue.inst = inst);
2563
+ _issue.continue ?? (_issue.continue = true);
2564
+ payload.issues.push(issue(_issue));
2565
+ }
2566
+ };
2567
+ const output = def.transform(payload.value, payload);
2568
+ if (output instanceof Promise) {
2569
+ return output.then((output2) => {
2570
+ payload.value = output2;
2571
+ return payload;
2572
+ });
2573
+ }
2574
+ payload.value = output;
2575
+ return payload;
2576
+ };
2577
+ });
2578
+ function transform(fn) {
2579
+ return new ZodTransform({
2580
+ type: "transform",
2581
+ transform: fn
2582
+ });
2583
+ }
2584
+ const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
2585
+ $ZodOptional.init(inst, def);
2586
+ ZodType.init(inst, def);
2587
+ inst.unwrap = () => inst._zod.def.innerType;
2588
+ });
2589
+ function optional(innerType) {
2590
+ return new ZodOptional({
2591
+ type: "optional",
2592
+ innerType
2593
+ });
2594
+ }
2595
+ const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
2596
+ $ZodNullable.init(inst, def);
2597
+ ZodType.init(inst, def);
2598
+ inst.unwrap = () => inst._zod.def.innerType;
2599
+ });
2600
+ function nullable(innerType) {
2601
+ return new ZodNullable({
2602
+ type: "nullable",
2603
+ innerType
2604
+ });
2605
+ }
2606
+ const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
2607
+ $ZodDefault.init(inst, def);
2608
+ ZodType.init(inst, def);
2609
+ inst.unwrap = () => inst._zod.def.innerType;
2610
+ inst.removeDefault = inst.unwrap;
2611
+ });
2612
+ function _default(innerType, defaultValue) {
2613
+ return new ZodDefault({
2614
+ type: "default",
2615
+ innerType,
2616
+ get defaultValue() {
2617
+ return typeof defaultValue === "function" ? defaultValue() : defaultValue;
2618
+ }
2619
+ });
2620
+ }
2621
+ const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
2622
+ $ZodPrefault.init(inst, def);
2623
+ ZodType.init(inst, def);
2624
+ inst.unwrap = () => inst._zod.def.innerType;
2625
+ });
2626
+ function prefault(innerType, defaultValue) {
2627
+ return new ZodPrefault({
2628
+ type: "prefault",
2629
+ innerType,
2630
+ get defaultValue() {
2631
+ return typeof defaultValue === "function" ? defaultValue() : defaultValue;
2632
+ }
2633
+ });
2634
+ }
2635
+ const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
2636
+ $ZodNonOptional.init(inst, def);
2637
+ ZodType.init(inst, def);
2638
+ inst.unwrap = () => inst._zod.def.innerType;
2639
+ });
2640
+ function nonoptional(innerType, params) {
2641
+ return new ZodNonOptional({
2642
+ type: "nonoptional",
2643
+ innerType,
2644
+ ...normalizeParams(params)
2645
+ });
2646
+ }
2647
+ const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
2648
+ $ZodCatch.init(inst, def);
2649
+ ZodType.init(inst, def);
2650
+ inst.unwrap = () => inst._zod.def.innerType;
2651
+ inst.removeCatch = inst.unwrap;
2652
+ });
2653
+ function _catch(innerType, catchValue) {
2654
+ return new ZodCatch({
2655
+ type: "catch",
2656
+ innerType,
2657
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
2658
+ });
2659
+ }
2660
+ const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
2661
+ $ZodPipe.init(inst, def);
2662
+ ZodType.init(inst, def);
2663
+ inst.in = def.in;
2664
+ inst.out = def.out;
2665
+ });
2666
+ function pipe(in_, out) {
2667
+ return new ZodPipe({
2668
+ type: "pipe",
2669
+ in: in_,
2670
+ out
2671
+ // ...util.normalizeParams(params),
2672
+ });
2673
+ }
2674
+ const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
2675
+ $ZodReadonly.init(inst, def);
2676
+ ZodType.init(inst, def);
2677
+ });
2678
+ function readonly(innerType) {
2679
+ return new ZodReadonly({
2680
+ type: "readonly",
2681
+ innerType
2682
+ });
2683
+ }
2684
+ const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
2685
+ $ZodCustom.init(inst, def);
2686
+ ZodType.init(inst, def);
2687
+ });
2688
+ function check(fn, params) {
2689
+ const ch = new $ZodCheck({
2690
+ check: "custom",
2691
+ ...normalizeParams(params)
2692
+ });
2693
+ ch._zod.check = fn;
2694
+ return ch;
2695
+ }
2696
+ function refine(fn, _params = {}) {
2697
+ return _refine(ZodCustom, fn, _params);
2698
+ }
2699
+ function superRefine(fn, params) {
2700
+ const ch = check((payload) => {
2701
+ payload.addIssue = (issue$1) => {
2702
+ if (typeof issue$1 === "string") {
2703
+ payload.issues.push(issue(issue$1, payload.value, ch._zod.def));
2704
+ } else {
2705
+ const _issue = issue$1;
2706
+ if (_issue.fatal)
2707
+ _issue.continue = false;
2708
+ _issue.code ?? (_issue.code = "custom");
2709
+ _issue.input ?? (_issue.input = payload.value);
2710
+ _issue.inst ?? (_issue.inst = ch);
2711
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2712
+ payload.issues.push(issue(_issue));
2713
+ }
2714
+ };
2715
+ return fn(payload.value, payload);
2716
+ }, params);
2717
+ return ch;
2718
+ }
2719
+ export {
2720
+ array as a,
2721
+ email as e,
2722
+ object as o,
2723
+ string as s
2724
+ };
2725
+ //# sourceMappingURL=schemas-7jC6hy_u.js.map