@feedmepos/mf-connect 0.1.98-beta.21 → 0.1.98-beta.22

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