@getopenpay/openpay-js-react 0.0.1-alpha.e54f3b1 → 0.0.2-alpha.6c3bbd9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1384 -2054
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,710 +1,87 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { createContext as Jt, useContext as Gt, useState as R, useMemo as Pe, useRef as _t, useCallback as Ae, useEffect as De } from "react";
|
|
2
|
+
import { jsx as W } from "react/jsx-runtime";
|
|
3
|
+
const xt = Jt({
|
|
3
4
|
formId: "",
|
|
4
5
|
formHeight: "",
|
|
5
6
|
referer: void 0,
|
|
6
7
|
checkoutSecureToken: void 0,
|
|
7
8
|
registerIframe: () => {
|
|
8
9
|
}
|
|
9
|
-
}),
|
|
10
|
-
const r =
|
|
10
|
+
}), Ft = () => {
|
|
11
|
+
const r = Gt(xt);
|
|
11
12
|
if (!r)
|
|
12
13
|
throw new Error("useOpenPayElements must be used within an OpenPayElementsProvider");
|
|
13
14
|
return r;
|
|
14
15
|
};
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the MIT license found in the
|
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*/
|
|
25
|
-
var dr;
|
|
26
|
-
function an() {
|
|
27
|
-
if (dr) return xt;
|
|
28
|
-
dr = 1;
|
|
29
|
-
var r = Symbol.for("react.fragment");
|
|
30
|
-
return xt.Fragment = r, xt.jsxDEV = void 0, xt;
|
|
16
|
+
var w = [];
|
|
17
|
+
for (var Xe = 0; Xe < 256; ++Xe)
|
|
18
|
+
w.push((Xe + 256).toString(16).slice(1));
|
|
19
|
+
function Xt(r, e = 0) {
|
|
20
|
+
return (w[r[e + 0]] + w[r[e + 1]] + w[r[e + 2]] + w[r[e + 3]] + "-" + w[r[e + 4]] + w[r[e + 5]] + "-" + w[r[e + 6]] + w[r[e + 7]] + "-" + w[r[e + 8]] + w[r[e + 9]] + "-" + w[r[e + 10]] + w[r[e + 11]] + w[r[e + 12]] + w[r[e + 13]] + w[r[e + 14]] + w[r[e + 15]]).toLowerCase();
|
|
31
21
|
}
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* react-jsx-dev-runtime.development.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/
|
|
42
|
-
var lr;
|
|
43
|
-
function sn() {
|
|
44
|
-
return lr || (lr = 1, process.env.NODE_ENV !== "production" && function() {
|
|
45
|
-
var r = en, e = Symbol.for("react.element"), t = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), c = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), O = Symbol.for("react.memo"), K = Symbol.for("react.lazy"), ae = Symbol.for("react.offscreen"), Q = Symbol.iterator, ft = "@@iterator";
|
|
46
|
-
function Pt(i) {
|
|
47
|
-
if (i === null || typeof i != "object")
|
|
48
|
-
return null;
|
|
49
|
-
var u = Q && i[Q] || i[ft];
|
|
50
|
-
return typeof u == "function" ? u : null;
|
|
51
|
-
}
|
|
52
|
-
var fe = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
53
|
-
function $(i) {
|
|
54
|
-
{
|
|
55
|
-
for (var u = arguments.length, m = new Array(u > 1 ? u - 1 : 0), b = 1; b < u; b++)
|
|
56
|
-
m[b - 1] = arguments[b];
|
|
57
|
-
ht("error", i, m);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function ht(i, u, m) {
|
|
61
|
-
{
|
|
62
|
-
var b = fe.ReactDebugCurrentFrame, R = b.getStackAddendum();
|
|
63
|
-
R !== "" && (u += "%s", m = m.concat([R]));
|
|
64
|
-
var C = m.map(function(T) {
|
|
65
|
-
return String(T);
|
|
66
|
-
});
|
|
67
|
-
C.unshift("Warning: " + u), Function.prototype.apply.call(console[i], console, C);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
var Dt = !1, ze = !1, mt = !1, pt = !1, je = !1, se;
|
|
71
|
-
se = Symbol.for("react.module.reference");
|
|
72
|
-
function $t(i) {
|
|
73
|
-
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || je || i === a || i === l || i === v || pt || i === ae || Dt || ze || mt || typeof i == "object" && i !== null && (i.$$typeof === K || i.$$typeof === O || i.$$typeof === o || i.$$typeof === c || i.$$typeof === f || // This needs to include all possible module reference object
|
|
74
|
-
// types supported by any Flight configuration anywhere since
|
|
75
|
-
// we don't know which Flight build this will end up being used
|
|
76
|
-
// with.
|
|
77
|
-
i.$$typeof === se || i.getModuleId !== void 0));
|
|
78
|
-
}
|
|
79
|
-
function he(i, u, m) {
|
|
80
|
-
var b = i.displayName;
|
|
81
|
-
if (b)
|
|
82
|
-
return b;
|
|
83
|
-
var R = u.displayName || u.name || "";
|
|
84
|
-
return R !== "" ? m + "(" + R + ")" : m;
|
|
85
|
-
}
|
|
86
|
-
function vt(i) {
|
|
87
|
-
return i.displayName || "Context";
|
|
88
|
-
}
|
|
89
|
-
function F(i) {
|
|
90
|
-
if (i == null)
|
|
91
|
-
return null;
|
|
92
|
-
if (typeof i.tag == "number" && $("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof i == "function")
|
|
93
|
-
return i.displayName || i.name || null;
|
|
94
|
-
if (typeof i == "string")
|
|
95
|
-
return i;
|
|
96
|
-
switch (i) {
|
|
97
|
-
case n:
|
|
98
|
-
return "Fragment";
|
|
99
|
-
case t:
|
|
100
|
-
return "Portal";
|
|
101
|
-
case s:
|
|
102
|
-
return "Profiler";
|
|
103
|
-
case a:
|
|
104
|
-
return "StrictMode";
|
|
105
|
-
case l:
|
|
106
|
-
return "Suspense";
|
|
107
|
-
case v:
|
|
108
|
-
return "SuspenseList";
|
|
109
|
-
}
|
|
110
|
-
if (typeof i == "object")
|
|
111
|
-
switch (i.$$typeof) {
|
|
112
|
-
case c:
|
|
113
|
-
var u = i;
|
|
114
|
-
return vt(u) + ".Consumer";
|
|
115
|
-
case o:
|
|
116
|
-
var m = i;
|
|
117
|
-
return vt(m._context) + ".Provider";
|
|
118
|
-
case f:
|
|
119
|
-
return he(i, i.render, "ForwardRef");
|
|
120
|
-
case O:
|
|
121
|
-
var b = i.displayName || null;
|
|
122
|
-
return b !== null ? b : F(i.type) || "Memo";
|
|
123
|
-
case K: {
|
|
124
|
-
var R = i, C = R._payload, T = R._init;
|
|
125
|
-
try {
|
|
126
|
-
return F(T(C));
|
|
127
|
-
} catch {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
var ee = Object.assign, me = 0, Be, ie, yt, We, gt, Ie, _t;
|
|
135
|
-
function oe() {
|
|
136
|
-
}
|
|
137
|
-
oe.__reactDisabledLog = !0;
|
|
138
|
-
function Te() {
|
|
139
|
-
{
|
|
140
|
-
if (me === 0) {
|
|
141
|
-
Be = console.log, ie = console.info, yt = console.warn, We = console.error, gt = console.group, Ie = console.groupCollapsed, _t = console.groupEnd;
|
|
142
|
-
var i = {
|
|
143
|
-
configurable: !0,
|
|
144
|
-
enumerable: !0,
|
|
145
|
-
value: oe,
|
|
146
|
-
writable: !0
|
|
147
|
-
};
|
|
148
|
-
Object.defineProperties(console, {
|
|
149
|
-
info: i,
|
|
150
|
-
log: i,
|
|
151
|
-
warn: i,
|
|
152
|
-
error: i,
|
|
153
|
-
group: i,
|
|
154
|
-
groupCollapsed: i,
|
|
155
|
-
groupEnd: i
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
me++;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
function Fe() {
|
|
162
|
-
{
|
|
163
|
-
if (me--, me === 0) {
|
|
164
|
-
var i = {
|
|
165
|
-
configurable: !0,
|
|
166
|
-
enumerable: !0,
|
|
167
|
-
writable: !0
|
|
168
|
-
};
|
|
169
|
-
Object.defineProperties(console, {
|
|
170
|
-
log: ee({}, i, {
|
|
171
|
-
value: Be
|
|
172
|
-
}),
|
|
173
|
-
info: ee({}, i, {
|
|
174
|
-
value: ie
|
|
175
|
-
}),
|
|
176
|
-
warn: ee({}, i, {
|
|
177
|
-
value: yt
|
|
178
|
-
}),
|
|
179
|
-
error: ee({}, i, {
|
|
180
|
-
value: We
|
|
181
|
-
}),
|
|
182
|
-
group: ee({}, i, {
|
|
183
|
-
value: gt
|
|
184
|
-
}),
|
|
185
|
-
groupCollapsed: ee({}, i, {
|
|
186
|
-
value: Ie
|
|
187
|
-
}),
|
|
188
|
-
groupEnd: ee({}, i, {
|
|
189
|
-
value: _t
|
|
190
|
-
})
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
me < 0 && $("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
var Ye = fe.ReactCurrentDispatcher, we;
|
|
197
|
-
function Ae(i, u, m) {
|
|
198
|
-
{
|
|
199
|
-
if (we === void 0)
|
|
200
|
-
try {
|
|
201
|
-
throw Error();
|
|
202
|
-
} catch (R) {
|
|
203
|
-
var b = R.stack.trim().match(/\n( *(at )?)/);
|
|
204
|
-
we = b && b[1] || "";
|
|
205
|
-
}
|
|
206
|
-
return `
|
|
207
|
-
` + we + i;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
var Ke = !1, A;
|
|
211
|
-
{
|
|
212
|
-
var pe = typeof WeakMap == "function" ? WeakMap : Map;
|
|
213
|
-
A = new pe();
|
|
214
|
-
}
|
|
215
|
-
function j(i, u) {
|
|
216
|
-
if (!i || Ke)
|
|
217
|
-
return "";
|
|
218
|
-
{
|
|
219
|
-
var m = A.get(i);
|
|
220
|
-
if (m !== void 0)
|
|
221
|
-
return m;
|
|
222
|
-
}
|
|
223
|
-
var b;
|
|
224
|
-
Ke = !0;
|
|
225
|
-
var R = Error.prepareStackTrace;
|
|
226
|
-
Error.prepareStackTrace = void 0;
|
|
227
|
-
var C;
|
|
228
|
-
C = Ye.current, Ye.current = null, Te();
|
|
229
|
-
try {
|
|
230
|
-
if (u) {
|
|
231
|
-
var T = function() {
|
|
232
|
-
throw Error();
|
|
233
|
-
};
|
|
234
|
-
if (Object.defineProperty(T.prototype, "props", {
|
|
235
|
-
set: function() {
|
|
236
|
-
throw Error();
|
|
237
|
-
}
|
|
238
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
239
|
-
try {
|
|
240
|
-
Reflect.construct(T, []);
|
|
241
|
-
} catch (B) {
|
|
242
|
-
b = B;
|
|
243
|
-
}
|
|
244
|
-
Reflect.construct(i, [], T);
|
|
245
|
-
} else {
|
|
246
|
-
try {
|
|
247
|
-
T.call();
|
|
248
|
-
} catch (B) {
|
|
249
|
-
b = B;
|
|
250
|
-
}
|
|
251
|
-
i.call(T.prototype);
|
|
252
|
-
}
|
|
253
|
-
} else {
|
|
254
|
-
try {
|
|
255
|
-
throw Error();
|
|
256
|
-
} catch (B) {
|
|
257
|
-
b = B;
|
|
258
|
-
}
|
|
259
|
-
i();
|
|
260
|
-
}
|
|
261
|
-
} catch (B) {
|
|
262
|
-
if (B && b && typeof B.stack == "string") {
|
|
263
|
-
for (var E = B.stack.split(`
|
|
264
|
-
`), L = b.stack.split(`
|
|
265
|
-
`), Z = E.length - 1, D = L.length - 1; Z >= 1 && D >= 0 && E[Z] !== L[D]; )
|
|
266
|
-
D--;
|
|
267
|
-
for (; Z >= 1 && D >= 0; Z--, D--)
|
|
268
|
-
if (E[Z] !== L[D]) {
|
|
269
|
-
if (Z !== 1 || D !== 1)
|
|
270
|
-
do
|
|
271
|
-
if (Z--, D--, D < 0 || E[Z] !== L[D]) {
|
|
272
|
-
var H = `
|
|
273
|
-
` + E[Z].replace(" at new ", " at ");
|
|
274
|
-
return i.displayName && H.includes("<anonymous>") && (H = H.replace("<anonymous>", i.displayName)), typeof i == "function" && A.set(i, H), H;
|
|
275
|
-
}
|
|
276
|
-
while (Z >= 1 && D >= 0);
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
} finally {
|
|
281
|
-
Ke = !1, Ye.current = C, Fe(), Error.prepareStackTrace = R;
|
|
282
|
-
}
|
|
283
|
-
var Pe = i ? i.displayName || i.name : "", Ce = Pe ? Ae(Pe) : "";
|
|
284
|
-
return typeof i == "function" && A.set(i, Ce), Ce;
|
|
285
|
-
}
|
|
286
|
-
function ce(i, u, m) {
|
|
287
|
-
return j(i, !1);
|
|
288
|
-
}
|
|
289
|
-
function Qt(i) {
|
|
290
|
-
var u = i.prototype;
|
|
291
|
-
return !!(u && u.isReactComponent);
|
|
292
|
-
}
|
|
293
|
-
function I(i, u, m) {
|
|
294
|
-
if (i == null)
|
|
295
|
-
return "";
|
|
296
|
-
if (typeof i == "function")
|
|
297
|
-
return j(i, Qt(i));
|
|
298
|
-
if (typeof i == "string")
|
|
299
|
-
return Ae(i);
|
|
300
|
-
switch (i) {
|
|
301
|
-
case l:
|
|
302
|
-
return Ae("Suspense");
|
|
303
|
-
case v:
|
|
304
|
-
return Ae("SuspenseList");
|
|
305
|
-
}
|
|
306
|
-
if (typeof i == "object")
|
|
307
|
-
switch (i.$$typeof) {
|
|
308
|
-
case f:
|
|
309
|
-
return ce(i.render);
|
|
310
|
-
case O:
|
|
311
|
-
return I(i.type, u, m);
|
|
312
|
-
case K: {
|
|
313
|
-
var b = i, R = b._payload, C = b._init;
|
|
314
|
-
try {
|
|
315
|
-
return I(C(R), u, m);
|
|
316
|
-
} catch {
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
return "";
|
|
321
|
-
}
|
|
322
|
-
var V = Object.prototype.hasOwnProperty, ue = {}, Re = fe.ReactDebugCurrentFrame;
|
|
323
|
-
function ve(i) {
|
|
324
|
-
if (i) {
|
|
325
|
-
var u = i._owner, m = I(i.type, i._source, u ? u.type : null);
|
|
326
|
-
Re.setExtraStackFrame(m);
|
|
327
|
-
} else
|
|
328
|
-
Re.setExtraStackFrame(null);
|
|
329
|
-
}
|
|
330
|
-
function Zr(i, u, m, b, R) {
|
|
331
|
-
{
|
|
332
|
-
var C = Function.call.bind(V);
|
|
333
|
-
for (var T in i)
|
|
334
|
-
if (C(i, T)) {
|
|
335
|
-
var E = void 0;
|
|
336
|
-
try {
|
|
337
|
-
if (typeof i[T] != "function") {
|
|
338
|
-
var L = Error((b || "React class") + ": " + m + " type `" + T + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof i[T] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
339
|
-
throw L.name = "Invariant Violation", L;
|
|
340
|
-
}
|
|
341
|
-
E = i[T](u, T, b, m, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
342
|
-
} catch (Z) {
|
|
343
|
-
E = Z;
|
|
344
|
-
}
|
|
345
|
-
E && !(E instanceof Error) && (ve(R), $("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", b || "React class", m, T, typeof E), ve(null)), E instanceof Error && !(E.message in ue) && (ue[E.message] = !0, ve(R), $("Failed %s type: %s", m, E.message), ve(null));
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
var Pr = Array.isArray;
|
|
350
|
-
function Vt(i) {
|
|
351
|
-
return Pr(i);
|
|
352
|
-
}
|
|
353
|
-
function Dr(i) {
|
|
354
|
-
{
|
|
355
|
-
var u = typeof Symbol == "function" && Symbol.toStringTag, m = u && i[Symbol.toStringTag] || i.constructor.name || "Object";
|
|
356
|
-
return m;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
function $r(i) {
|
|
360
|
-
try {
|
|
361
|
-
return er(i), !1;
|
|
362
|
-
} catch {
|
|
363
|
-
return !0;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
function er(i) {
|
|
367
|
-
return "" + i;
|
|
368
|
-
}
|
|
369
|
-
function tr(i) {
|
|
370
|
-
if ($r(i))
|
|
371
|
-
return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Dr(i)), er(i);
|
|
372
|
-
}
|
|
373
|
-
var He = fe.ReactCurrentOwner, Vr = {
|
|
374
|
-
key: !0,
|
|
375
|
-
ref: !0,
|
|
376
|
-
__self: !0,
|
|
377
|
-
__source: !0
|
|
378
|
-
}, rr, nr, Mt;
|
|
379
|
-
Mt = {};
|
|
380
|
-
function Mr(i) {
|
|
381
|
-
if (V.call(i, "ref")) {
|
|
382
|
-
var u = Object.getOwnPropertyDescriptor(i, "ref").get;
|
|
383
|
-
if (u && u.isReactWarning)
|
|
384
|
-
return !1;
|
|
385
|
-
}
|
|
386
|
-
return i.ref !== void 0;
|
|
387
|
-
}
|
|
388
|
-
function Ur(i) {
|
|
389
|
-
if (V.call(i, "key")) {
|
|
390
|
-
var u = Object.getOwnPropertyDescriptor(i, "key").get;
|
|
391
|
-
if (u && u.isReactWarning)
|
|
392
|
-
return !1;
|
|
393
|
-
}
|
|
394
|
-
return i.key !== void 0;
|
|
395
|
-
}
|
|
396
|
-
function Lr(i, u) {
|
|
397
|
-
if (typeof i.ref == "string" && He.current && u && He.current.stateNode !== u) {
|
|
398
|
-
var m = F(He.current.type);
|
|
399
|
-
Mt[m] || ($('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', F(He.current.type), i.ref), Mt[m] = !0);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
function zr(i, u) {
|
|
403
|
-
{
|
|
404
|
-
var m = function() {
|
|
405
|
-
rr || (rr = !0, $("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", u));
|
|
406
|
-
};
|
|
407
|
-
m.isReactWarning = !0, Object.defineProperty(i, "key", {
|
|
408
|
-
get: m,
|
|
409
|
-
configurable: !0
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
function Br(i, u) {
|
|
414
|
-
{
|
|
415
|
-
var m = function() {
|
|
416
|
-
nr || (nr = !0, $("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", u));
|
|
417
|
-
};
|
|
418
|
-
m.isReactWarning = !0, Object.defineProperty(i, "ref", {
|
|
419
|
-
get: m,
|
|
420
|
-
configurable: !0
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
var Wr = function(i, u, m, b, R, C, T) {
|
|
425
|
-
var E = {
|
|
426
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
427
|
-
$$typeof: e,
|
|
428
|
-
// Built-in properties that belong on the element
|
|
429
|
-
type: i,
|
|
430
|
-
key: u,
|
|
431
|
-
ref: m,
|
|
432
|
-
props: T,
|
|
433
|
-
// Record the component responsible for creating this element.
|
|
434
|
-
_owner: C
|
|
435
|
-
};
|
|
436
|
-
return E._store = {}, Object.defineProperty(E._store, "validated", {
|
|
437
|
-
configurable: !1,
|
|
438
|
-
enumerable: !1,
|
|
439
|
-
writable: !0,
|
|
440
|
-
value: !1
|
|
441
|
-
}), Object.defineProperty(E, "_self", {
|
|
442
|
-
configurable: !1,
|
|
443
|
-
enumerable: !1,
|
|
444
|
-
writable: !1,
|
|
445
|
-
value: b
|
|
446
|
-
}), Object.defineProperty(E, "_source", {
|
|
447
|
-
configurable: !1,
|
|
448
|
-
enumerable: !1,
|
|
449
|
-
writable: !1,
|
|
450
|
-
value: R
|
|
451
|
-
}), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
|
|
452
|
-
};
|
|
453
|
-
function Fr(i, u, m, b, R) {
|
|
454
|
-
{
|
|
455
|
-
var C, T = {}, E = null, L = null;
|
|
456
|
-
m !== void 0 && (tr(m), E = "" + m), Ur(u) && (tr(u.key), E = "" + u.key), Mr(u) && (L = u.ref, Lr(u, R));
|
|
457
|
-
for (C in u)
|
|
458
|
-
V.call(u, C) && !Vr.hasOwnProperty(C) && (T[C] = u[C]);
|
|
459
|
-
if (i && i.defaultProps) {
|
|
460
|
-
var Z = i.defaultProps;
|
|
461
|
-
for (C in Z)
|
|
462
|
-
T[C] === void 0 && (T[C] = Z[C]);
|
|
463
|
-
}
|
|
464
|
-
if (E || L) {
|
|
465
|
-
var D = typeof i == "function" ? i.displayName || i.name || "Unknown" : i;
|
|
466
|
-
E && zr(T, D), L && Br(T, D);
|
|
467
|
-
}
|
|
468
|
-
return Wr(i, E, L, R, b, He.current, T);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
var Ut = fe.ReactCurrentOwner, ar = fe.ReactDebugCurrentFrame;
|
|
472
|
-
function Ze(i) {
|
|
473
|
-
if (i) {
|
|
474
|
-
var u = i._owner, m = I(i.type, i._source, u ? u.type : null);
|
|
475
|
-
ar.setExtraStackFrame(m);
|
|
476
|
-
} else
|
|
477
|
-
ar.setExtraStackFrame(null);
|
|
478
|
-
}
|
|
479
|
-
var Lt;
|
|
480
|
-
Lt = !1;
|
|
481
|
-
function zt(i) {
|
|
482
|
-
return typeof i == "object" && i !== null && i.$$typeof === e;
|
|
483
|
-
}
|
|
484
|
-
function sr() {
|
|
485
|
-
{
|
|
486
|
-
if (Ut.current) {
|
|
487
|
-
var i = F(Ut.current.type);
|
|
488
|
-
if (i)
|
|
489
|
-
return `
|
|
490
|
-
|
|
491
|
-
Check the render method of \`` + i + "`.";
|
|
492
|
-
}
|
|
493
|
-
return "";
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
function Yr(i) {
|
|
497
|
-
{
|
|
498
|
-
if (i !== void 0) {
|
|
499
|
-
var u = i.fileName.replace(/^.*[\\\/]/, ""), m = i.lineNumber;
|
|
500
|
-
return `
|
|
501
|
-
|
|
502
|
-
Check your code at ` + u + ":" + m + ".";
|
|
503
|
-
}
|
|
504
|
-
return "";
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
var ir = {};
|
|
508
|
-
function Kr(i) {
|
|
509
|
-
{
|
|
510
|
-
var u = sr();
|
|
511
|
-
if (!u) {
|
|
512
|
-
var m = typeof i == "string" ? i : i.displayName || i.name;
|
|
513
|
-
m && (u = `
|
|
514
|
-
|
|
515
|
-
Check the top-level render call using <` + m + ">.");
|
|
516
|
-
}
|
|
517
|
-
return u;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
function or(i, u) {
|
|
521
|
-
{
|
|
522
|
-
if (!i._store || i._store.validated || i.key != null)
|
|
523
|
-
return;
|
|
524
|
-
i._store.validated = !0;
|
|
525
|
-
var m = Kr(u);
|
|
526
|
-
if (ir[m])
|
|
527
|
-
return;
|
|
528
|
-
ir[m] = !0;
|
|
529
|
-
var b = "";
|
|
530
|
-
i && i._owner && i._owner !== Ut.current && (b = " It was passed a child from " + F(i._owner.type) + "."), Ze(i), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', m, b), Ze(null);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
function cr(i, u) {
|
|
534
|
-
{
|
|
535
|
-
if (typeof i != "object")
|
|
536
|
-
return;
|
|
537
|
-
if (Vt(i))
|
|
538
|
-
for (var m = 0; m < i.length; m++) {
|
|
539
|
-
var b = i[m];
|
|
540
|
-
zt(b) && or(b, u);
|
|
541
|
-
}
|
|
542
|
-
else if (zt(i))
|
|
543
|
-
i._store && (i._store.validated = !0);
|
|
544
|
-
else if (i) {
|
|
545
|
-
var R = Pt(i);
|
|
546
|
-
if (typeof R == "function" && R !== i.entries)
|
|
547
|
-
for (var C = R.call(i), T; !(T = C.next()).done; )
|
|
548
|
-
zt(T.value) && or(T.value, u);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
function Hr(i) {
|
|
553
|
-
{
|
|
554
|
-
var u = i.type;
|
|
555
|
-
if (u == null || typeof u == "string")
|
|
556
|
-
return;
|
|
557
|
-
var m;
|
|
558
|
-
if (typeof u == "function")
|
|
559
|
-
m = u.propTypes;
|
|
560
|
-
else if (typeof u == "object" && (u.$$typeof === f || // Note: Memo only checks outer props here.
|
|
561
|
-
// Inner props are checked in the reconciler.
|
|
562
|
-
u.$$typeof === O))
|
|
563
|
-
m = u.propTypes;
|
|
564
|
-
else
|
|
565
|
-
return;
|
|
566
|
-
if (m) {
|
|
567
|
-
var b = F(u);
|
|
568
|
-
Zr(m, i.props, "prop", b, i);
|
|
569
|
-
} else if (u.PropTypes !== void 0 && !Lt) {
|
|
570
|
-
Lt = !0;
|
|
571
|
-
var R = F(u);
|
|
572
|
-
$("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", R || "Unknown");
|
|
573
|
-
}
|
|
574
|
-
typeof u.getDefaultProps == "function" && !u.getDefaultProps.isReactClassApproved && $("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
function qr(i) {
|
|
578
|
-
{
|
|
579
|
-
for (var u = Object.keys(i.props), m = 0; m < u.length; m++) {
|
|
580
|
-
var b = u[m];
|
|
581
|
-
if (b !== "children" && b !== "key") {
|
|
582
|
-
Ze(i), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", b), Ze(null);
|
|
583
|
-
break;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
i.ref !== null && (Ze(i), $("Invalid attribute `ref` supplied to `React.Fragment`."), Ze(null));
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
var ur = {};
|
|
590
|
-
function Jr(i, u, m, b, R, C) {
|
|
591
|
-
{
|
|
592
|
-
var T = $t(i);
|
|
593
|
-
if (!T) {
|
|
594
|
-
var E = "";
|
|
595
|
-
(i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
596
|
-
var L = Yr(R);
|
|
597
|
-
L ? E += L : E += sr();
|
|
598
|
-
var Z;
|
|
599
|
-
i === null ? Z = "null" : Vt(i) ? Z = "array" : i !== void 0 && i.$$typeof === e ? (Z = "<" + (F(i.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : Z = typeof i, $("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Z, E);
|
|
600
|
-
}
|
|
601
|
-
var D = Fr(i, u, m, R, C);
|
|
602
|
-
if (D == null)
|
|
603
|
-
return D;
|
|
604
|
-
if (T) {
|
|
605
|
-
var H = u.children;
|
|
606
|
-
if (H !== void 0)
|
|
607
|
-
if (b)
|
|
608
|
-
if (Vt(H)) {
|
|
609
|
-
for (var Pe = 0; Pe < H.length; Pe++)
|
|
610
|
-
cr(H[Pe], i);
|
|
611
|
-
Object.freeze && Object.freeze(H);
|
|
612
|
-
} else
|
|
613
|
-
$("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
614
|
-
else
|
|
615
|
-
cr(H, i);
|
|
616
|
-
}
|
|
617
|
-
if (V.call(u, "key")) {
|
|
618
|
-
var Ce = F(i), B = Object.keys(u).filter(function(Qr) {
|
|
619
|
-
return Qr !== "key";
|
|
620
|
-
}), Bt = B.length > 0 ? "{key: someKey, " + B.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
621
|
-
if (!ur[Ce + Bt]) {
|
|
622
|
-
var Xr = B.length > 0 ? "{" + B.join(": ..., ") + ": ...}" : "{}";
|
|
623
|
-
$(`A props object containing a "key" prop is being spread into JSX:
|
|
624
|
-
let props = %s;
|
|
625
|
-
<%s {...props} />
|
|
626
|
-
React keys must be passed directly to JSX without using spread:
|
|
627
|
-
let props = %s;
|
|
628
|
-
<%s key={someKey} {...props} />`, Bt, Ce, Xr, Ce), ur[Ce + Bt] = !0;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
return i === n ? qr(D) : Hr(D), D;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
var Gr = Jr;
|
|
635
|
-
kt.Fragment = n, kt.jsxDEV = Gr;
|
|
636
|
-
}()), kt;
|
|
637
|
-
}
|
|
638
|
-
process.env.NODE_ENV === "production" ? Yt.exports = an() : Yt.exports = sn();
|
|
639
|
-
var _e = Yt.exports, M = [];
|
|
640
|
-
for (var Wt = 0; Wt < 256; ++Wt)
|
|
641
|
-
M.push((Wt + 256).toString(16).slice(1));
|
|
642
|
-
function on(r, e = 0) {
|
|
643
|
-
return (M[r[e + 0]] + M[r[e + 1]] + M[r[e + 2]] + M[r[e + 3]] + "-" + M[r[e + 4]] + M[r[e + 5]] + "-" + M[r[e + 6]] + M[r[e + 7]] + "-" + M[r[e + 8]] + M[r[e + 9]] + "-" + M[r[e + 10]] + M[r[e + 11]] + M[r[e + 12]] + M[r[e + 13]] + M[r[e + 14]] + M[r[e + 15]]).toLowerCase();
|
|
644
|
-
}
|
|
645
|
-
var Et, cn = new Uint8Array(16);
|
|
646
|
-
function un() {
|
|
647
|
-
if (!Et && (Et = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Et))
|
|
22
|
+
var je, Qt = new Uint8Array(16);
|
|
23
|
+
function er() {
|
|
24
|
+
if (!je && (je = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !je))
|
|
648
25
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
649
|
-
return
|
|
26
|
+
return je(Qt);
|
|
650
27
|
}
|
|
651
|
-
var
|
|
652
|
-
const
|
|
653
|
-
randomUUID:
|
|
28
|
+
var tr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
29
|
+
const pt = {
|
|
30
|
+
randomUUID: tr
|
|
654
31
|
};
|
|
655
|
-
function
|
|
656
|
-
if (
|
|
657
|
-
return
|
|
32
|
+
function kt(r, e, t) {
|
|
33
|
+
if (pt.randomUUID && !e && !r)
|
|
34
|
+
return pt.randomUUID();
|
|
658
35
|
r = r || {};
|
|
659
|
-
var n = r.random || (r.rng ||
|
|
660
|
-
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128,
|
|
36
|
+
var n = r.random || (r.rng || er)();
|
|
37
|
+
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Xt(n);
|
|
661
38
|
}
|
|
662
|
-
const
|
|
663
|
-
var
|
|
39
|
+
const st = "https://cde.openpaystaging.com";
|
|
40
|
+
var _;
|
|
664
41
|
(function(r) {
|
|
665
|
-
r.assertEqual = (
|
|
666
|
-
function e(
|
|
42
|
+
r.assertEqual = (s) => s;
|
|
43
|
+
function e(s) {
|
|
667
44
|
}
|
|
668
45
|
r.assertIs = e;
|
|
669
|
-
function t(
|
|
46
|
+
function t(s) {
|
|
670
47
|
throw new Error();
|
|
671
48
|
}
|
|
672
|
-
r.assertNever = t, r.arrayToEnum = (
|
|
673
|
-
const
|
|
49
|
+
r.assertNever = t, r.arrayToEnum = (s) => {
|
|
50
|
+
const a = {};
|
|
51
|
+
for (const i of s)
|
|
52
|
+
a[i] = i;
|
|
53
|
+
return a;
|
|
54
|
+
}, r.getValidEnumValues = (s) => {
|
|
55
|
+
const a = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
|
|
674
56
|
for (const o of a)
|
|
675
|
-
|
|
676
|
-
return
|
|
677
|
-
}, r.
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
return a
|
|
684
|
-
}
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
if (s(o))
|
|
692
|
-
return o;
|
|
693
|
-
}, r.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && isFinite(a) && Math.floor(a) === a;
|
|
694
|
-
function n(a, s = " | ") {
|
|
695
|
-
return a.map((o) => typeof o == "string" ? `'${o}'` : o).join(s);
|
|
57
|
+
i[o] = s[o];
|
|
58
|
+
return r.objectValues(i);
|
|
59
|
+
}, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
|
|
60
|
+
return s[a];
|
|
61
|
+
}), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
62
|
+
const a = [];
|
|
63
|
+
for (const i in s)
|
|
64
|
+
Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
|
|
65
|
+
return a;
|
|
66
|
+
}, r.find = (s, a) => {
|
|
67
|
+
for (const i of s)
|
|
68
|
+
if (a(i))
|
|
69
|
+
return i;
|
|
70
|
+
}, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
71
|
+
function n(s, a = " | ") {
|
|
72
|
+
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
696
73
|
}
|
|
697
|
-
r.joinValues = n, r.jsonStringifyReplacer = (
|
|
698
|
-
})(
|
|
699
|
-
var
|
|
74
|
+
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
75
|
+
})(_ || (_ = {}));
|
|
76
|
+
var et;
|
|
700
77
|
(function(r) {
|
|
701
78
|
r.mergeShapes = (e, t) => ({
|
|
702
79
|
...e,
|
|
703
80
|
...t
|
|
704
81
|
// second overwrites first
|
|
705
82
|
});
|
|
706
|
-
})(
|
|
707
|
-
const
|
|
83
|
+
})(et || (et = {}));
|
|
84
|
+
const f = _.arrayToEnum([
|
|
708
85
|
"string",
|
|
709
86
|
"nan",
|
|
710
87
|
"number",
|
|
@@ -725,28 +102,28 @@ const p = w.arrayToEnum([
|
|
|
725
102
|
"never",
|
|
726
103
|
"map",
|
|
727
104
|
"set"
|
|
728
|
-
]),
|
|
105
|
+
]), H = (r) => {
|
|
729
106
|
switch (typeof r) {
|
|
730
107
|
case "undefined":
|
|
731
|
-
return
|
|
108
|
+
return f.undefined;
|
|
732
109
|
case "string":
|
|
733
|
-
return
|
|
110
|
+
return f.string;
|
|
734
111
|
case "number":
|
|
735
|
-
return isNaN(r) ?
|
|
112
|
+
return isNaN(r) ? f.nan : f.number;
|
|
736
113
|
case "boolean":
|
|
737
|
-
return
|
|
114
|
+
return f.boolean;
|
|
738
115
|
case "function":
|
|
739
|
-
return
|
|
116
|
+
return f.function;
|
|
740
117
|
case "bigint":
|
|
741
|
-
return
|
|
118
|
+
return f.bigint;
|
|
742
119
|
case "symbol":
|
|
743
|
-
return
|
|
120
|
+
return f.symbol;
|
|
744
121
|
case "object":
|
|
745
|
-
return Array.isArray(r) ?
|
|
122
|
+
return Array.isArray(r) ? f.array : r === null ? f.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? f.promise : typeof Map < "u" && r instanceof Map ? f.map : typeof Set < "u" && r instanceof Set ? f.set : typeof Date < "u" && r instanceof Date ? f.date : f.object;
|
|
746
123
|
default:
|
|
747
|
-
return
|
|
124
|
+
return f.unknown;
|
|
748
125
|
}
|
|
749
|
-
},
|
|
126
|
+
}, c = _.arrayToEnum([
|
|
750
127
|
"invalid_type",
|
|
751
128
|
"invalid_literal",
|
|
752
129
|
"custom",
|
|
@@ -763,8 +140,8 @@ const p = w.arrayToEnum([
|
|
|
763
140
|
"invalid_intersection_types",
|
|
764
141
|
"not_multiple_of",
|
|
765
142
|
"not_finite"
|
|
766
|
-
]),
|
|
767
|
-
class
|
|
143
|
+
]), rr = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
144
|
+
class I extends Error {
|
|
768
145
|
constructor(e) {
|
|
769
146
|
super(), this.issues = [], this.addIssue = (n) => {
|
|
770
147
|
this.issues = [...this.issues, n];
|
|
@@ -778,138 +155,138 @@ class Y extends Error {
|
|
|
778
155
|
return this.issues;
|
|
779
156
|
}
|
|
780
157
|
format(e) {
|
|
781
|
-
const t = e || function(
|
|
782
|
-
return
|
|
783
|
-
}, n = { _errors: [] },
|
|
784
|
-
for (const
|
|
785
|
-
if (
|
|
786
|
-
|
|
787
|
-
else if (
|
|
788
|
-
|
|
789
|
-
else if (
|
|
790
|
-
|
|
791
|
-
else if (
|
|
792
|
-
n._errors.push(t(
|
|
158
|
+
const t = e || function(a) {
|
|
159
|
+
return a.message;
|
|
160
|
+
}, n = { _errors: [] }, s = (a) => {
|
|
161
|
+
for (const i of a.issues)
|
|
162
|
+
if (i.code === "invalid_union")
|
|
163
|
+
i.unionErrors.map(s);
|
|
164
|
+
else if (i.code === "invalid_return_type")
|
|
165
|
+
s(i.returnTypeError);
|
|
166
|
+
else if (i.code === "invalid_arguments")
|
|
167
|
+
s(i.argumentsError);
|
|
168
|
+
else if (i.path.length === 0)
|
|
169
|
+
n._errors.push(t(i));
|
|
793
170
|
else {
|
|
794
|
-
let
|
|
795
|
-
for (;
|
|
796
|
-
const
|
|
797
|
-
|
|
171
|
+
let o = n, u = 0;
|
|
172
|
+
for (; u < i.path.length; ) {
|
|
173
|
+
const d = i.path[u];
|
|
174
|
+
u === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], u++;
|
|
798
175
|
}
|
|
799
176
|
}
|
|
800
177
|
};
|
|
801
|
-
return
|
|
178
|
+
return s(this), n;
|
|
802
179
|
}
|
|
803
180
|
static assert(e) {
|
|
804
|
-
if (!(e instanceof
|
|
181
|
+
if (!(e instanceof I))
|
|
805
182
|
throw new Error(`Not a ZodError: ${e}`);
|
|
806
183
|
}
|
|
807
184
|
toString() {
|
|
808
185
|
return this.message;
|
|
809
186
|
}
|
|
810
187
|
get message() {
|
|
811
|
-
return JSON.stringify(this.issues,
|
|
188
|
+
return JSON.stringify(this.issues, _.jsonStringifyReplacer, 2);
|
|
812
189
|
}
|
|
813
190
|
get isEmpty() {
|
|
814
191
|
return this.issues.length === 0;
|
|
815
192
|
}
|
|
816
193
|
flatten(e = (t) => t.message) {
|
|
817
194
|
const t = {}, n = [];
|
|
818
|
-
for (const
|
|
819
|
-
|
|
195
|
+
for (const s of this.issues)
|
|
196
|
+
s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : n.push(e(s));
|
|
820
197
|
return { formErrors: n, fieldErrors: t };
|
|
821
198
|
}
|
|
822
199
|
get formErrors() {
|
|
823
200
|
return this.flatten();
|
|
824
201
|
}
|
|
825
202
|
}
|
|
826
|
-
|
|
827
|
-
const
|
|
203
|
+
I.create = (r) => new I(r);
|
|
204
|
+
const ue = (r, e) => {
|
|
828
205
|
let t;
|
|
829
206
|
switch (r.code) {
|
|
830
|
-
case
|
|
831
|
-
r.received ===
|
|
207
|
+
case c.invalid_type:
|
|
208
|
+
r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
|
|
832
209
|
break;
|
|
833
|
-
case
|
|
834
|
-
t = `Invalid literal value, expected ${JSON.stringify(r.expected,
|
|
210
|
+
case c.invalid_literal:
|
|
211
|
+
t = `Invalid literal value, expected ${JSON.stringify(r.expected, _.jsonStringifyReplacer)}`;
|
|
835
212
|
break;
|
|
836
|
-
case
|
|
837
|
-
t = `Unrecognized key(s) in object: ${
|
|
213
|
+
case c.unrecognized_keys:
|
|
214
|
+
t = `Unrecognized key(s) in object: ${_.joinValues(r.keys, ", ")}`;
|
|
838
215
|
break;
|
|
839
|
-
case
|
|
216
|
+
case c.invalid_union:
|
|
840
217
|
t = "Invalid input";
|
|
841
218
|
break;
|
|
842
|
-
case
|
|
843
|
-
t = `Invalid discriminator value. Expected ${
|
|
219
|
+
case c.invalid_union_discriminator:
|
|
220
|
+
t = `Invalid discriminator value. Expected ${_.joinValues(r.options)}`;
|
|
844
221
|
break;
|
|
845
|
-
case
|
|
846
|
-
t = `Invalid enum value. Expected ${
|
|
222
|
+
case c.invalid_enum_value:
|
|
223
|
+
t = `Invalid enum value. Expected ${_.joinValues(r.options)}, received '${r.received}'`;
|
|
847
224
|
break;
|
|
848
|
-
case
|
|
225
|
+
case c.invalid_arguments:
|
|
849
226
|
t = "Invalid function arguments";
|
|
850
227
|
break;
|
|
851
|
-
case
|
|
228
|
+
case c.invalid_return_type:
|
|
852
229
|
t = "Invalid function return type";
|
|
853
230
|
break;
|
|
854
|
-
case
|
|
231
|
+
case c.invalid_date:
|
|
855
232
|
t = "Invalid date";
|
|
856
233
|
break;
|
|
857
|
-
case
|
|
858
|
-
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}"` :
|
|
234
|
+
case c.invalid_string:
|
|
235
|
+
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}"` : _.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
|
|
859
236
|
break;
|
|
860
|
-
case
|
|
237
|
+
case c.too_small:
|
|
861
238
|
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";
|
|
862
239
|
break;
|
|
863
|
-
case
|
|
240
|
+
case c.too_big:
|
|
864
241
|
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";
|
|
865
242
|
break;
|
|
866
|
-
case
|
|
243
|
+
case c.custom:
|
|
867
244
|
t = "Invalid input";
|
|
868
245
|
break;
|
|
869
|
-
case
|
|
246
|
+
case c.invalid_intersection_types:
|
|
870
247
|
t = "Intersection results could not be merged";
|
|
871
248
|
break;
|
|
872
|
-
case
|
|
249
|
+
case c.not_multiple_of:
|
|
873
250
|
t = `Number must be a multiple of ${r.multipleOf}`;
|
|
874
251
|
break;
|
|
875
|
-
case
|
|
252
|
+
case c.not_finite:
|
|
876
253
|
t = "Number must be finite";
|
|
877
254
|
break;
|
|
878
255
|
default:
|
|
879
|
-
t = e.defaultError,
|
|
256
|
+
t = e.defaultError, _.assertNever(r);
|
|
880
257
|
}
|
|
881
258
|
return { message: t };
|
|
882
259
|
};
|
|
883
|
-
let
|
|
884
|
-
function
|
|
885
|
-
|
|
260
|
+
let bt = ue;
|
|
261
|
+
function nr(r) {
|
|
262
|
+
bt = r;
|
|
886
263
|
}
|
|
887
|
-
function
|
|
888
|
-
return
|
|
264
|
+
function Me() {
|
|
265
|
+
return bt;
|
|
889
266
|
}
|
|
890
|
-
const
|
|
891
|
-
const { data: e, path: t, errorMaps: n, issueData:
|
|
892
|
-
...
|
|
893
|
-
path:
|
|
267
|
+
const Ue = (r) => {
|
|
268
|
+
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
|
|
269
|
+
...s,
|
|
270
|
+
path: a
|
|
894
271
|
};
|
|
895
|
-
if (
|
|
272
|
+
if (s.message !== void 0)
|
|
896
273
|
return {
|
|
897
|
-
...
|
|
898
|
-
path:
|
|
899
|
-
message:
|
|
274
|
+
...s,
|
|
275
|
+
path: a,
|
|
276
|
+
message: s.message
|
|
900
277
|
};
|
|
901
|
-
let
|
|
902
|
-
const
|
|
903
|
-
for (const
|
|
904
|
-
|
|
278
|
+
let o = "";
|
|
279
|
+
const u = n.filter((d) => !!d).slice().reverse();
|
|
280
|
+
for (const d of u)
|
|
281
|
+
o = d(i, { data: e, defaultError: o }).message;
|
|
905
282
|
return {
|
|
906
|
-
...
|
|
907
|
-
path:
|
|
908
|
-
message:
|
|
283
|
+
...s,
|
|
284
|
+
path: a,
|
|
285
|
+
message: o
|
|
909
286
|
};
|
|
910
|
-
},
|
|
911
|
-
function
|
|
912
|
-
const t =
|
|
287
|
+
}, sr = [];
|
|
288
|
+
function l(r, e) {
|
|
289
|
+
const t = Me(), n = Ue({
|
|
913
290
|
issueData: e,
|
|
914
291
|
data: r.data,
|
|
915
292
|
path: r.path,
|
|
@@ -917,13 +294,13 @@ function h(r, e) {
|
|
|
917
294
|
r.common.contextualErrorMap,
|
|
918
295
|
r.schemaErrorMap,
|
|
919
296
|
t,
|
|
920
|
-
t ===
|
|
297
|
+
t === ue ? void 0 : ue
|
|
921
298
|
// then global default map
|
|
922
|
-
].filter((
|
|
299
|
+
].filter((s) => !!s)
|
|
923
300
|
});
|
|
924
301
|
r.common.issues.push(n);
|
|
925
302
|
}
|
|
926
|
-
class
|
|
303
|
+
class E {
|
|
927
304
|
constructor() {
|
|
928
305
|
this.value = "valid";
|
|
929
306
|
}
|
|
@@ -935,61 +312,61 @@ class U {
|
|
|
935
312
|
}
|
|
936
313
|
static mergeArray(e, t) {
|
|
937
314
|
const n = [];
|
|
938
|
-
for (const
|
|
939
|
-
if (
|
|
940
|
-
return
|
|
941
|
-
|
|
315
|
+
for (const s of t) {
|
|
316
|
+
if (s.status === "aborted")
|
|
317
|
+
return y;
|
|
318
|
+
s.status === "dirty" && e.dirty(), n.push(s.value);
|
|
942
319
|
}
|
|
943
320
|
return { status: e.value, value: n };
|
|
944
321
|
}
|
|
945
322
|
static async mergeObjectAsync(e, t) {
|
|
946
323
|
const n = [];
|
|
947
|
-
for (const
|
|
948
|
-
const
|
|
324
|
+
for (const s of t) {
|
|
325
|
+
const a = await s.key, i = await s.value;
|
|
949
326
|
n.push({
|
|
950
|
-
key:
|
|
951
|
-
value:
|
|
327
|
+
key: a,
|
|
328
|
+
value: i
|
|
952
329
|
});
|
|
953
330
|
}
|
|
954
|
-
return
|
|
331
|
+
return E.mergeObjectSync(e, n);
|
|
955
332
|
}
|
|
956
333
|
static mergeObjectSync(e, t) {
|
|
957
334
|
const n = {};
|
|
958
|
-
for (const
|
|
959
|
-
const { key:
|
|
960
|
-
if (
|
|
961
|
-
return
|
|
962
|
-
|
|
335
|
+
for (const s of t) {
|
|
336
|
+
const { key: a, value: i } = s;
|
|
337
|
+
if (a.status === "aborted" || i.status === "aborted")
|
|
338
|
+
return y;
|
|
339
|
+
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
|
|
963
340
|
}
|
|
964
341
|
return { status: e.value, value: n };
|
|
965
342
|
}
|
|
966
343
|
}
|
|
967
|
-
const
|
|
344
|
+
const y = Object.freeze({
|
|
968
345
|
status: "aborted"
|
|
969
|
-
}),
|
|
970
|
-
function
|
|
346
|
+
}), ce = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), tt = (r) => r.status === "aborted", rt = (r) => r.status === "dirty", ye = (r) => r.status === "valid", ve = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
347
|
+
function Le(r, e, t, n) {
|
|
971
348
|
if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
972
349
|
return e.get(r);
|
|
973
350
|
}
|
|
974
|
-
function
|
|
975
|
-
if (typeof e == "function" ? r !== e || !
|
|
351
|
+
function Tt(r, e, t, n, s) {
|
|
352
|
+
if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
976
353
|
return e.set(r, t), t;
|
|
977
354
|
}
|
|
978
|
-
var
|
|
355
|
+
var h;
|
|
979
356
|
(function(r) {
|
|
980
357
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
981
|
-
})(
|
|
982
|
-
var
|
|
983
|
-
class
|
|
984
|
-
constructor(e, t, n,
|
|
985
|
-
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key =
|
|
358
|
+
})(h || (h = {}));
|
|
359
|
+
var me, pe;
|
|
360
|
+
class U {
|
|
361
|
+
constructor(e, t, n, s) {
|
|
362
|
+
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
|
|
986
363
|
}
|
|
987
364
|
get path() {
|
|
988
365
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
989
366
|
}
|
|
990
367
|
}
|
|
991
|
-
const
|
|
992
|
-
if (
|
|
368
|
+
const yt = (r, e) => {
|
|
369
|
+
if (ye(e))
|
|
993
370
|
return { success: !0, data: e.value };
|
|
994
371
|
if (!r.common.issues.length)
|
|
995
372
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -998,24 +375,24 @@ const hr = (r, e) => {
|
|
|
998
375
|
get error() {
|
|
999
376
|
if (this._error)
|
|
1000
377
|
return this._error;
|
|
1001
|
-
const t = new
|
|
378
|
+
const t = new I(r.common.issues);
|
|
1002
379
|
return this._error = t, this._error;
|
|
1003
380
|
}
|
|
1004
381
|
};
|
|
1005
382
|
};
|
|
1006
|
-
function
|
|
383
|
+
function v(r) {
|
|
1007
384
|
if (!r)
|
|
1008
385
|
return {};
|
|
1009
|
-
const { errorMap: e, invalid_type_error: t, required_error: n, description:
|
|
386
|
+
const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
|
|
1010
387
|
if (e && (t || n))
|
|
1011
388
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1012
|
-
return e ? { errorMap: e, description:
|
|
1013
|
-
var
|
|
1014
|
-
const { message:
|
|
1015
|
-
return
|
|
1016
|
-
}, description:
|
|
389
|
+
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
390
|
+
var u, d;
|
|
391
|
+
const { message: m } = r;
|
|
392
|
+
return i.code === "invalid_enum_value" ? { message: m ?? o.defaultError } : typeof o.data > "u" ? { message: (u = m ?? n) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = m ?? t) !== null && d !== void 0 ? d : o.defaultError };
|
|
393
|
+
}, description: s };
|
|
1017
394
|
}
|
|
1018
|
-
class
|
|
395
|
+
class g {
|
|
1019
396
|
constructor(e) {
|
|
1020
397
|
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);
|
|
1021
398
|
}
|
|
@@ -1023,13 +400,13 @@ class k {
|
|
|
1023
400
|
return this._def.description;
|
|
1024
401
|
}
|
|
1025
402
|
_getType(e) {
|
|
1026
|
-
return
|
|
403
|
+
return H(e.data);
|
|
1027
404
|
}
|
|
1028
405
|
_getOrReturnCtx(e, t) {
|
|
1029
406
|
return t || {
|
|
1030
407
|
common: e.parent.common,
|
|
1031
408
|
data: e.data,
|
|
1032
|
-
parsedType:
|
|
409
|
+
parsedType: H(e.data),
|
|
1033
410
|
schemaErrorMap: this._def.errorMap,
|
|
1034
411
|
path: e.path,
|
|
1035
412
|
parent: e.parent
|
|
@@ -1037,11 +414,11 @@ class k {
|
|
|
1037
414
|
}
|
|
1038
415
|
_processInputParams(e) {
|
|
1039
416
|
return {
|
|
1040
|
-
status: new
|
|
417
|
+
status: new E(),
|
|
1041
418
|
ctx: {
|
|
1042
419
|
common: e.parent.common,
|
|
1043
420
|
data: e.data,
|
|
1044
|
-
parsedType:
|
|
421
|
+
parsedType: H(e.data),
|
|
1045
422
|
schemaErrorMap: this._def.errorMap,
|
|
1046
423
|
path: e.path,
|
|
1047
424
|
parent: e.parent
|
|
@@ -1050,7 +427,7 @@ class k {
|
|
|
1050
427
|
}
|
|
1051
428
|
_parseSync(e) {
|
|
1052
429
|
const t = this._parse(e);
|
|
1053
|
-
if (
|
|
430
|
+
if (ve(t))
|
|
1054
431
|
throw new Error("Synchronous parse encountered promise.");
|
|
1055
432
|
return t;
|
|
1056
433
|
}
|
|
@@ -1066,7 +443,7 @@ class k {
|
|
|
1066
443
|
}
|
|
1067
444
|
safeParse(e, t) {
|
|
1068
445
|
var n;
|
|
1069
|
-
const
|
|
446
|
+
const s = {
|
|
1070
447
|
common: {
|
|
1071
448
|
issues: [],
|
|
1072
449
|
async: (n = t == null ? void 0 : t.async) !== null && n !== void 0 ? n : !1,
|
|
@@ -1076,9 +453,9 @@ class k {
|
|
|
1076
453
|
schemaErrorMap: this._def.errorMap,
|
|
1077
454
|
parent: null,
|
|
1078
455
|
data: e,
|
|
1079
|
-
parsedType:
|
|
1080
|
-
},
|
|
1081
|
-
return
|
|
456
|
+
parsedType: H(e)
|
|
457
|
+
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
458
|
+
return yt(s, a);
|
|
1082
459
|
}
|
|
1083
460
|
async parseAsync(e, t) {
|
|
1084
461
|
const n = await this.safeParseAsync(e, t);
|
|
@@ -1097,27 +474,27 @@ class k {
|
|
|
1097
474
|
schemaErrorMap: this._def.errorMap,
|
|
1098
475
|
parent: null,
|
|
1099
476
|
data: e,
|
|
1100
|
-
parsedType:
|
|
1101
|
-
},
|
|
1102
|
-
return
|
|
477
|
+
parsedType: H(e)
|
|
478
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ve(s) ? s : Promise.resolve(s));
|
|
479
|
+
return yt(n, a);
|
|
1103
480
|
}
|
|
1104
481
|
refine(e, t) {
|
|
1105
|
-
const n = (
|
|
1106
|
-
return this._refinement((
|
|
1107
|
-
const
|
|
1108
|
-
code:
|
|
1109
|
-
...n(
|
|
482
|
+
const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
|
|
483
|
+
return this._refinement((s, a) => {
|
|
484
|
+
const i = e(s), o = () => a.addIssue({
|
|
485
|
+
code: c.custom,
|
|
486
|
+
...n(s)
|
|
1110
487
|
});
|
|
1111
|
-
return typeof Promise < "u" &&
|
|
488
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
|
|
1112
489
|
});
|
|
1113
490
|
}
|
|
1114
491
|
refinement(e, t) {
|
|
1115
|
-
return this._refinement((n,
|
|
492
|
+
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
|
|
1116
493
|
}
|
|
1117
494
|
_refinement(e) {
|
|
1118
|
-
return new
|
|
495
|
+
return new D({
|
|
1119
496
|
schema: this,
|
|
1120
|
-
typeName:
|
|
497
|
+
typeName: p.ZodEffects,
|
|
1121
498
|
effect: { type: "refinement", refinement: e }
|
|
1122
499
|
});
|
|
1123
500
|
}
|
|
@@ -1125,57 +502,57 @@ class k {
|
|
|
1125
502
|
return this._refinement(e);
|
|
1126
503
|
}
|
|
1127
504
|
optional() {
|
|
1128
|
-
return
|
|
505
|
+
return M.create(this, this._def);
|
|
1129
506
|
}
|
|
1130
507
|
nullable() {
|
|
1131
|
-
return
|
|
508
|
+
return J.create(this, this._def);
|
|
1132
509
|
}
|
|
1133
510
|
nullish() {
|
|
1134
511
|
return this.nullable().optional();
|
|
1135
512
|
}
|
|
1136
513
|
array() {
|
|
1137
|
-
return
|
|
514
|
+
return P.create(this, this._def);
|
|
1138
515
|
}
|
|
1139
516
|
promise() {
|
|
1140
|
-
return
|
|
517
|
+
return fe.create(this, this._def);
|
|
1141
518
|
}
|
|
1142
519
|
or(e) {
|
|
1143
|
-
return
|
|
520
|
+
return ke.create([this, e], this._def);
|
|
1144
521
|
}
|
|
1145
522
|
and(e) {
|
|
1146
|
-
return
|
|
523
|
+
return be.create(this, e, this._def);
|
|
1147
524
|
}
|
|
1148
525
|
transform(e) {
|
|
1149
|
-
return new
|
|
1150
|
-
...
|
|
526
|
+
return new D({
|
|
527
|
+
...v(this._def),
|
|
1151
528
|
schema: this,
|
|
1152
|
-
typeName:
|
|
529
|
+
typeName: p.ZodEffects,
|
|
1153
530
|
effect: { type: "transform", transform: e }
|
|
1154
531
|
});
|
|
1155
532
|
}
|
|
1156
533
|
default(e) {
|
|
1157
534
|
const t = typeof e == "function" ? e : () => e;
|
|
1158
|
-
return new
|
|
1159
|
-
...
|
|
535
|
+
return new Se({
|
|
536
|
+
...v(this._def),
|
|
1160
537
|
innerType: this,
|
|
1161
538
|
defaultValue: t,
|
|
1162
|
-
typeName:
|
|
539
|
+
typeName: p.ZodDefault
|
|
1163
540
|
});
|
|
1164
541
|
}
|
|
1165
542
|
brand() {
|
|
1166
|
-
return new
|
|
1167
|
-
typeName:
|
|
543
|
+
return new at({
|
|
544
|
+
typeName: p.ZodBranded,
|
|
1168
545
|
type: this,
|
|
1169
|
-
...
|
|
546
|
+
...v(this._def)
|
|
1170
547
|
});
|
|
1171
548
|
}
|
|
1172
549
|
catch(e) {
|
|
1173
550
|
const t = typeof e == "function" ? e : () => e;
|
|
1174
|
-
return new
|
|
1175
|
-
...
|
|
551
|
+
return new Oe({
|
|
552
|
+
...v(this._def),
|
|
1176
553
|
innerType: this,
|
|
1177
554
|
catchValue: t,
|
|
1178
|
-
typeName:
|
|
555
|
+
typeName: p.ZodCatch
|
|
1179
556
|
});
|
|
1180
557
|
}
|
|
1181
558
|
describe(e) {
|
|
@@ -1186,10 +563,10 @@ class k {
|
|
|
1186
563
|
});
|
|
1187
564
|
}
|
|
1188
565
|
pipe(e) {
|
|
1189
|
-
return
|
|
566
|
+
return Ie.create(this, e);
|
|
1190
567
|
}
|
|
1191
568
|
readonly() {
|
|
1192
|
-
return
|
|
569
|
+
return Re.create(this);
|
|
1193
570
|
}
|
|
1194
571
|
isOptional() {
|
|
1195
572
|
return this.safeParse(void 0).success;
|
|
@@ -1198,209 +575,209 @@ class k {
|
|
|
1198
575
|
return this.safeParse(null).success;
|
|
1199
576
|
}
|
|
1200
577
|
}
|
|
1201
|
-
const
|
|
1202
|
-
let
|
|
1203
|
-
const
|
|
1204
|
-
function
|
|
578
|
+
const ar = /^c[^\s-]{8,}$/i, ir = /^[0-9a-z]+$/, or = /^[0-9A-HJKMNP-TV-Z]{26}$/, cr = /^[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, dr = /^[a-z0-9_-]{21}$/i, ur = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, lr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, fr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
579
|
+
let Qe;
|
|
580
|
+
const hr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, mr = /^(([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})))$/, pr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, wt = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", yr = new RegExp(`^${wt}$`);
|
|
581
|
+
function Et(r) {
|
|
1205
582
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1206
583
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1207
584
|
}
|
|
1208
|
-
function
|
|
1209
|
-
return new RegExp(`^${
|
|
585
|
+
function vr(r) {
|
|
586
|
+
return new RegExp(`^${Et(r)}$`);
|
|
1210
587
|
}
|
|
1211
|
-
function
|
|
1212
|
-
let e = `${
|
|
588
|
+
function Ct(r) {
|
|
589
|
+
let e = `${wt}T${Et(r)}`;
|
|
1213
590
|
const t = [];
|
|
1214
591
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1215
592
|
}
|
|
1216
|
-
function
|
|
1217
|
-
return !!((e === "v4" || !e) &&
|
|
593
|
+
function gr(r, e) {
|
|
594
|
+
return !!((e === "v4" || !e) && hr.test(r) || (e === "v6" || !e) && mr.test(r));
|
|
1218
595
|
}
|
|
1219
|
-
class
|
|
596
|
+
class j extends g {
|
|
1220
597
|
_parse(e) {
|
|
1221
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
1222
|
-
const
|
|
1223
|
-
return
|
|
1224
|
-
code:
|
|
1225
|
-
expected:
|
|
1226
|
-
received:
|
|
1227
|
-
}),
|
|
1228
|
-
}
|
|
1229
|
-
const n = new
|
|
1230
|
-
let
|
|
1231
|
-
for (const
|
|
1232
|
-
if (
|
|
1233
|
-
e.data.length <
|
|
1234
|
-
code:
|
|
1235
|
-
minimum:
|
|
598
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
|
|
599
|
+
const a = this._getOrReturnCtx(e);
|
|
600
|
+
return l(a, {
|
|
601
|
+
code: c.invalid_type,
|
|
602
|
+
expected: f.string,
|
|
603
|
+
received: a.parsedType
|
|
604
|
+
}), y;
|
|
605
|
+
}
|
|
606
|
+
const n = new E();
|
|
607
|
+
let s;
|
|
608
|
+
for (const a of this._def.checks)
|
|
609
|
+
if (a.kind === "min")
|
|
610
|
+
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
611
|
+
code: c.too_small,
|
|
612
|
+
minimum: a.value,
|
|
1236
613
|
type: "string",
|
|
1237
614
|
inclusive: !0,
|
|
1238
615
|
exact: !1,
|
|
1239
|
-
message:
|
|
616
|
+
message: a.message
|
|
1240
617
|
}), n.dirty());
|
|
1241
|
-
else if (
|
|
1242
|
-
e.data.length >
|
|
1243
|
-
code:
|
|
1244
|
-
maximum:
|
|
618
|
+
else if (a.kind === "max")
|
|
619
|
+
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
620
|
+
code: c.too_big,
|
|
621
|
+
maximum: a.value,
|
|
1245
622
|
type: "string",
|
|
1246
623
|
inclusive: !0,
|
|
1247
624
|
exact: !1,
|
|
1248
|
-
message:
|
|
625
|
+
message: a.message
|
|
1249
626
|
}), n.dirty());
|
|
1250
|
-
else if (
|
|
1251
|
-
const
|
|
1252
|
-
(
|
|
1253
|
-
code:
|
|
1254
|
-
maximum:
|
|
627
|
+
else if (a.kind === "length") {
|
|
628
|
+
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
629
|
+
(i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
|
|
630
|
+
code: c.too_big,
|
|
631
|
+
maximum: a.value,
|
|
1255
632
|
type: "string",
|
|
1256
633
|
inclusive: !0,
|
|
1257
634
|
exact: !0,
|
|
1258
|
-
message:
|
|
1259
|
-
}) :
|
|
1260
|
-
code:
|
|
1261
|
-
minimum:
|
|
635
|
+
message: a.message
|
|
636
|
+
}) : o && l(s, {
|
|
637
|
+
code: c.too_small,
|
|
638
|
+
minimum: a.value,
|
|
1262
639
|
type: "string",
|
|
1263
640
|
inclusive: !0,
|
|
1264
641
|
exact: !0,
|
|
1265
|
-
message:
|
|
642
|
+
message: a.message
|
|
1266
643
|
}), n.dirty());
|
|
1267
|
-
} else if (
|
|
1268
|
-
|
|
644
|
+
} else if (a.kind === "email")
|
|
645
|
+
lr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1269
646
|
validation: "email",
|
|
1270
|
-
code:
|
|
1271
|
-
message:
|
|
647
|
+
code: c.invalid_string,
|
|
648
|
+
message: a.message
|
|
1272
649
|
}), n.dirty());
|
|
1273
|
-
else if (
|
|
1274
|
-
|
|
650
|
+
else if (a.kind === "emoji")
|
|
651
|
+
Qe || (Qe = new RegExp(fr, "u")), Qe.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1275
652
|
validation: "emoji",
|
|
1276
|
-
code:
|
|
1277
|
-
message:
|
|
653
|
+
code: c.invalid_string,
|
|
654
|
+
message: a.message
|
|
1278
655
|
}), n.dirty());
|
|
1279
|
-
else if (
|
|
1280
|
-
|
|
656
|
+
else if (a.kind === "uuid")
|
|
657
|
+
cr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1281
658
|
validation: "uuid",
|
|
1282
|
-
code:
|
|
1283
|
-
message:
|
|
659
|
+
code: c.invalid_string,
|
|
660
|
+
message: a.message
|
|
1284
661
|
}), n.dirty());
|
|
1285
|
-
else if (
|
|
1286
|
-
|
|
662
|
+
else if (a.kind === "nanoid")
|
|
663
|
+
dr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1287
664
|
validation: "nanoid",
|
|
1288
|
-
code:
|
|
1289
|
-
message:
|
|
665
|
+
code: c.invalid_string,
|
|
666
|
+
message: a.message
|
|
1290
667
|
}), n.dirty());
|
|
1291
|
-
else if (
|
|
1292
|
-
|
|
668
|
+
else if (a.kind === "cuid")
|
|
669
|
+
ar.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1293
670
|
validation: "cuid",
|
|
1294
|
-
code:
|
|
1295
|
-
message:
|
|
671
|
+
code: c.invalid_string,
|
|
672
|
+
message: a.message
|
|
1296
673
|
}), n.dirty());
|
|
1297
|
-
else if (
|
|
1298
|
-
|
|
674
|
+
else if (a.kind === "cuid2")
|
|
675
|
+
ir.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1299
676
|
validation: "cuid2",
|
|
1300
|
-
code:
|
|
1301
|
-
message:
|
|
677
|
+
code: c.invalid_string,
|
|
678
|
+
message: a.message
|
|
1302
679
|
}), n.dirty());
|
|
1303
|
-
else if (
|
|
1304
|
-
|
|
680
|
+
else if (a.kind === "ulid")
|
|
681
|
+
or.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1305
682
|
validation: "ulid",
|
|
1306
|
-
code:
|
|
1307
|
-
message:
|
|
683
|
+
code: c.invalid_string,
|
|
684
|
+
message: a.message
|
|
1308
685
|
}), n.dirty());
|
|
1309
|
-
else if (
|
|
686
|
+
else if (a.kind === "url")
|
|
1310
687
|
try {
|
|
1311
688
|
new URL(e.data);
|
|
1312
689
|
} catch {
|
|
1313
|
-
|
|
690
|
+
s = this._getOrReturnCtx(e, s), l(s, {
|
|
1314
691
|
validation: "url",
|
|
1315
|
-
code:
|
|
1316
|
-
message:
|
|
692
|
+
code: c.invalid_string,
|
|
693
|
+
message: a.message
|
|
1317
694
|
}), n.dirty();
|
|
1318
695
|
}
|
|
1319
|
-
else
|
|
696
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1320
697
|
validation: "regex",
|
|
1321
|
-
code:
|
|
1322
|
-
message:
|
|
1323
|
-
}), n.dirty())) :
|
|
1324
|
-
code:
|
|
1325
|
-
validation: { includes:
|
|
1326
|
-
message:
|
|
1327
|
-
}), n.dirty()) :
|
|
1328
|
-
code:
|
|
1329
|
-
validation: { startsWith:
|
|
1330
|
-
message:
|
|
1331
|
-
}), n.dirty()) :
|
|
1332
|
-
code:
|
|
1333
|
-
validation: { endsWith:
|
|
1334
|
-
message:
|
|
1335
|
-
}), n.dirty()) :
|
|
1336
|
-
code:
|
|
698
|
+
code: c.invalid_string,
|
|
699
|
+
message: a.message
|
|
700
|
+
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
701
|
+
code: c.invalid_string,
|
|
702
|
+
validation: { includes: a.value, position: a.position },
|
|
703
|
+
message: a.message
|
|
704
|
+
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
705
|
+
code: c.invalid_string,
|
|
706
|
+
validation: { startsWith: a.value },
|
|
707
|
+
message: a.message
|
|
708
|
+
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
709
|
+
code: c.invalid_string,
|
|
710
|
+
validation: { endsWith: a.value },
|
|
711
|
+
message: a.message
|
|
712
|
+
}), n.dirty()) : a.kind === "datetime" ? Ct(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
713
|
+
code: c.invalid_string,
|
|
1337
714
|
validation: "datetime",
|
|
1338
|
-
message:
|
|
1339
|
-
}), n.dirty()) :
|
|
1340
|
-
code:
|
|
715
|
+
message: a.message
|
|
716
|
+
}), n.dirty()) : a.kind === "date" ? yr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
717
|
+
code: c.invalid_string,
|
|
1341
718
|
validation: "date",
|
|
1342
|
-
message:
|
|
1343
|
-
}), n.dirty()) :
|
|
1344
|
-
code:
|
|
719
|
+
message: a.message
|
|
720
|
+
}), n.dirty()) : a.kind === "time" ? vr(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
721
|
+
code: c.invalid_string,
|
|
1345
722
|
validation: "time",
|
|
1346
|
-
message:
|
|
1347
|
-
}), n.dirty()) :
|
|
723
|
+
message: a.message
|
|
724
|
+
}), n.dirty()) : a.kind === "duration" ? ur.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1348
725
|
validation: "duration",
|
|
1349
|
-
code:
|
|
1350
|
-
message:
|
|
1351
|
-
}), n.dirty()) :
|
|
726
|
+
code: c.invalid_string,
|
|
727
|
+
message: a.message
|
|
728
|
+
}), n.dirty()) : a.kind === "ip" ? gr(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1352
729
|
validation: "ip",
|
|
1353
|
-
code:
|
|
1354
|
-
message:
|
|
1355
|
-
}), n.dirty()) :
|
|
730
|
+
code: c.invalid_string,
|
|
731
|
+
message: a.message
|
|
732
|
+
}), n.dirty()) : a.kind === "base64" ? pr.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1356
733
|
validation: "base64",
|
|
1357
|
-
code:
|
|
1358
|
-
message:
|
|
1359
|
-
}), n.dirty()) :
|
|
734
|
+
code: c.invalid_string,
|
|
735
|
+
message: a.message
|
|
736
|
+
}), n.dirty()) : _.assertNever(a);
|
|
1360
737
|
return { status: n.value, value: e.data };
|
|
1361
738
|
}
|
|
1362
739
|
_regex(e, t, n) {
|
|
1363
|
-
return this.refinement((
|
|
740
|
+
return this.refinement((s) => e.test(s), {
|
|
1364
741
|
validation: t,
|
|
1365
|
-
code:
|
|
1366
|
-
...
|
|
742
|
+
code: c.invalid_string,
|
|
743
|
+
...h.errToObj(n)
|
|
1367
744
|
});
|
|
1368
745
|
}
|
|
1369
746
|
_addCheck(e) {
|
|
1370
|
-
return new
|
|
747
|
+
return new j({
|
|
1371
748
|
...this._def,
|
|
1372
749
|
checks: [...this._def.checks, e]
|
|
1373
750
|
});
|
|
1374
751
|
}
|
|
1375
752
|
email(e) {
|
|
1376
|
-
return this._addCheck({ kind: "email", ...
|
|
753
|
+
return this._addCheck({ kind: "email", ...h.errToObj(e) });
|
|
1377
754
|
}
|
|
1378
755
|
url(e) {
|
|
1379
|
-
return this._addCheck({ kind: "url", ...
|
|
756
|
+
return this._addCheck({ kind: "url", ...h.errToObj(e) });
|
|
1380
757
|
}
|
|
1381
758
|
emoji(e) {
|
|
1382
|
-
return this._addCheck({ kind: "emoji", ...
|
|
759
|
+
return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
|
|
1383
760
|
}
|
|
1384
761
|
uuid(e) {
|
|
1385
|
-
return this._addCheck({ kind: "uuid", ...
|
|
762
|
+
return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
|
|
1386
763
|
}
|
|
1387
764
|
nanoid(e) {
|
|
1388
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
765
|
+
return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
|
|
1389
766
|
}
|
|
1390
767
|
cuid(e) {
|
|
1391
|
-
return this._addCheck({ kind: "cuid", ...
|
|
768
|
+
return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
|
|
1392
769
|
}
|
|
1393
770
|
cuid2(e) {
|
|
1394
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
771
|
+
return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
|
|
1395
772
|
}
|
|
1396
773
|
ulid(e) {
|
|
1397
|
-
return this._addCheck({ kind: "ulid", ...
|
|
774
|
+
return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
|
|
1398
775
|
}
|
|
1399
776
|
base64(e) {
|
|
1400
|
-
return this._addCheck({ kind: "base64", ...
|
|
777
|
+
return this._addCheck({ kind: "base64", ...h.errToObj(e) });
|
|
1401
778
|
}
|
|
1402
779
|
ip(e) {
|
|
1403
|
-
return this._addCheck({ kind: "ip", ...
|
|
780
|
+
return this._addCheck({ kind: "ip", ...h.errToObj(e) });
|
|
1404
781
|
}
|
|
1405
782
|
datetime(e) {
|
|
1406
783
|
var t, n;
|
|
@@ -1415,7 +792,7 @@ class J extends k {
|
|
|
1415
792
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
1416
793
|
offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
|
|
1417
794
|
local: (n = e == null ? void 0 : e.local) !== null && n !== void 0 ? n : !1,
|
|
1418
|
-
...
|
|
795
|
+
...h.errToObj(e == null ? void 0 : e.message)
|
|
1419
796
|
});
|
|
1420
797
|
}
|
|
1421
798
|
date(e) {
|
|
@@ -1429,17 +806,17 @@ class J extends k {
|
|
|
1429
806
|
}) : this._addCheck({
|
|
1430
807
|
kind: "time",
|
|
1431
808
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
1432
|
-
...
|
|
809
|
+
...h.errToObj(e == null ? void 0 : e.message)
|
|
1433
810
|
});
|
|
1434
811
|
}
|
|
1435
812
|
duration(e) {
|
|
1436
|
-
return this._addCheck({ kind: "duration", ...
|
|
813
|
+
return this._addCheck({ kind: "duration", ...h.errToObj(e) });
|
|
1437
814
|
}
|
|
1438
815
|
regex(e, t) {
|
|
1439
816
|
return this._addCheck({
|
|
1440
817
|
kind: "regex",
|
|
1441
818
|
regex: e,
|
|
1442
|
-
...
|
|
819
|
+
...h.errToObj(t)
|
|
1443
820
|
});
|
|
1444
821
|
}
|
|
1445
822
|
includes(e, t) {
|
|
@@ -1447,42 +824,42 @@ class J extends k {
|
|
|
1447
824
|
kind: "includes",
|
|
1448
825
|
value: e,
|
|
1449
826
|
position: t == null ? void 0 : t.position,
|
|
1450
|
-
...
|
|
827
|
+
...h.errToObj(t == null ? void 0 : t.message)
|
|
1451
828
|
});
|
|
1452
829
|
}
|
|
1453
830
|
startsWith(e, t) {
|
|
1454
831
|
return this._addCheck({
|
|
1455
832
|
kind: "startsWith",
|
|
1456
833
|
value: e,
|
|
1457
|
-
...
|
|
834
|
+
...h.errToObj(t)
|
|
1458
835
|
});
|
|
1459
836
|
}
|
|
1460
837
|
endsWith(e, t) {
|
|
1461
838
|
return this._addCheck({
|
|
1462
839
|
kind: "endsWith",
|
|
1463
840
|
value: e,
|
|
1464
|
-
...
|
|
841
|
+
...h.errToObj(t)
|
|
1465
842
|
});
|
|
1466
843
|
}
|
|
1467
844
|
min(e, t) {
|
|
1468
845
|
return this._addCheck({
|
|
1469
846
|
kind: "min",
|
|
1470
847
|
value: e,
|
|
1471
|
-
...
|
|
848
|
+
...h.errToObj(t)
|
|
1472
849
|
});
|
|
1473
850
|
}
|
|
1474
851
|
max(e, t) {
|
|
1475
852
|
return this._addCheck({
|
|
1476
853
|
kind: "max",
|
|
1477
854
|
value: e,
|
|
1478
|
-
...
|
|
855
|
+
...h.errToObj(t)
|
|
1479
856
|
});
|
|
1480
857
|
}
|
|
1481
858
|
length(e, t) {
|
|
1482
859
|
return this._addCheck({
|
|
1483
860
|
kind: "length",
|
|
1484
861
|
value: e,
|
|
1485
|
-
...
|
|
862
|
+
...h.errToObj(t)
|
|
1486
863
|
});
|
|
1487
864
|
}
|
|
1488
865
|
/**
|
|
@@ -1490,22 +867,22 @@ class J extends k {
|
|
|
1490
867
|
* @see {@link ZodString.min}
|
|
1491
868
|
*/
|
|
1492
869
|
nonempty(e) {
|
|
1493
|
-
return this.min(1,
|
|
870
|
+
return this.min(1, h.errToObj(e));
|
|
1494
871
|
}
|
|
1495
872
|
trim() {
|
|
1496
|
-
return new
|
|
873
|
+
return new j({
|
|
1497
874
|
...this._def,
|
|
1498
875
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1499
876
|
});
|
|
1500
877
|
}
|
|
1501
878
|
toLowerCase() {
|
|
1502
|
-
return new
|
|
879
|
+
return new j({
|
|
1503
880
|
...this._def,
|
|
1504
881
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1505
882
|
});
|
|
1506
883
|
}
|
|
1507
884
|
toUpperCase() {
|
|
1508
|
-
return new
|
|
885
|
+
return new j({
|
|
1509
886
|
...this._def,
|
|
1510
887
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1511
888
|
});
|
|
@@ -1565,78 +942,78 @@ class J extends k {
|
|
|
1565
942
|
return e;
|
|
1566
943
|
}
|
|
1567
944
|
}
|
|
1568
|
-
|
|
945
|
+
j.create = (r) => {
|
|
1569
946
|
var e;
|
|
1570
|
-
return new
|
|
947
|
+
return new j({
|
|
1571
948
|
checks: [],
|
|
1572
|
-
typeName:
|
|
949
|
+
typeName: p.ZodString,
|
|
1573
950
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1574
|
-
...
|
|
951
|
+
...v(r)
|
|
1575
952
|
});
|
|
1576
953
|
};
|
|
1577
|
-
function
|
|
1578
|
-
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length,
|
|
1579
|
-
return
|
|
954
|
+
function _r(r, e) {
|
|
955
|
+
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
956
|
+
return a % i / Math.pow(10, s);
|
|
1580
957
|
}
|
|
1581
|
-
class
|
|
958
|
+
class K extends g {
|
|
1582
959
|
constructor() {
|
|
1583
960
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1584
961
|
}
|
|
1585
962
|
_parse(e) {
|
|
1586
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1587
|
-
const
|
|
1588
|
-
return
|
|
1589
|
-
code:
|
|
1590
|
-
expected:
|
|
1591
|
-
received:
|
|
1592
|
-
}),
|
|
963
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
|
|
964
|
+
const a = this._getOrReturnCtx(e);
|
|
965
|
+
return l(a, {
|
|
966
|
+
code: c.invalid_type,
|
|
967
|
+
expected: f.number,
|
|
968
|
+
received: a.parsedType
|
|
969
|
+
}), y;
|
|
1593
970
|
}
|
|
1594
971
|
let n;
|
|
1595
|
-
const
|
|
1596
|
-
for (const
|
|
1597
|
-
|
|
1598
|
-
code:
|
|
972
|
+
const s = new E();
|
|
973
|
+
for (const a of this._def.checks)
|
|
974
|
+
a.kind === "int" ? _.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
975
|
+
code: c.invalid_type,
|
|
1599
976
|
expected: "integer",
|
|
1600
977
|
received: "float",
|
|
1601
|
-
message:
|
|
1602
|
-
}),
|
|
1603
|
-
code:
|
|
1604
|
-
minimum:
|
|
978
|
+
message: a.message
|
|
979
|
+
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
980
|
+
code: c.too_small,
|
|
981
|
+
minimum: a.value,
|
|
1605
982
|
type: "number",
|
|
1606
|
-
inclusive:
|
|
983
|
+
inclusive: a.inclusive,
|
|
1607
984
|
exact: !1,
|
|
1608
|
-
message:
|
|
1609
|
-
}),
|
|
1610
|
-
code:
|
|
1611
|
-
maximum:
|
|
985
|
+
message: a.message
|
|
986
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
987
|
+
code: c.too_big,
|
|
988
|
+
maximum: a.value,
|
|
1612
989
|
type: "number",
|
|
1613
|
-
inclusive:
|
|
990
|
+
inclusive: a.inclusive,
|
|
1614
991
|
exact: !1,
|
|
1615
|
-
message:
|
|
1616
|
-
}),
|
|
1617
|
-
code:
|
|
1618
|
-
multipleOf:
|
|
1619
|
-
message:
|
|
1620
|
-
}),
|
|
1621
|
-
code:
|
|
1622
|
-
message:
|
|
1623
|
-
}),
|
|
1624
|
-
return { status:
|
|
992
|
+
message: a.message
|
|
993
|
+
}), s.dirty()) : a.kind === "multipleOf" ? _r(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
994
|
+
code: c.not_multiple_of,
|
|
995
|
+
multipleOf: a.value,
|
|
996
|
+
message: a.message
|
|
997
|
+
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
|
|
998
|
+
code: c.not_finite,
|
|
999
|
+
message: a.message
|
|
1000
|
+
}), s.dirty()) : _.assertNever(a);
|
|
1001
|
+
return { status: s.value, value: e.data };
|
|
1625
1002
|
}
|
|
1626
1003
|
gte(e, t) {
|
|
1627
|
-
return this.setLimit("min", e, !0,
|
|
1004
|
+
return this.setLimit("min", e, !0, h.toString(t));
|
|
1628
1005
|
}
|
|
1629
1006
|
gt(e, t) {
|
|
1630
|
-
return this.setLimit("min", e, !1,
|
|
1007
|
+
return this.setLimit("min", e, !1, h.toString(t));
|
|
1631
1008
|
}
|
|
1632
1009
|
lte(e, t) {
|
|
1633
|
-
return this.setLimit("max", e, !0,
|
|
1010
|
+
return this.setLimit("max", e, !0, h.toString(t));
|
|
1634
1011
|
}
|
|
1635
1012
|
lt(e, t) {
|
|
1636
|
-
return this.setLimit("max", e, !1,
|
|
1013
|
+
return this.setLimit("max", e, !1, h.toString(t));
|
|
1637
1014
|
}
|
|
1638
|
-
setLimit(e, t, n,
|
|
1639
|
-
return new
|
|
1015
|
+
setLimit(e, t, n, s) {
|
|
1016
|
+
return new K({
|
|
1640
1017
|
...this._def,
|
|
1641
1018
|
checks: [
|
|
1642
1019
|
...this._def.checks,
|
|
@@ -1644,13 +1021,13 @@ class be extends k {
|
|
|
1644
1021
|
kind: e,
|
|
1645
1022
|
value: t,
|
|
1646
1023
|
inclusive: n,
|
|
1647
|
-
message:
|
|
1024
|
+
message: h.toString(s)
|
|
1648
1025
|
}
|
|
1649
1026
|
]
|
|
1650
1027
|
});
|
|
1651
1028
|
}
|
|
1652
1029
|
_addCheck(e) {
|
|
1653
|
-
return new
|
|
1030
|
+
return new K({
|
|
1654
1031
|
...this._def,
|
|
1655
1032
|
checks: [...this._def.checks, e]
|
|
1656
1033
|
});
|
|
@@ -1658,7 +1035,7 @@ class be extends k {
|
|
|
1658
1035
|
int(e) {
|
|
1659
1036
|
return this._addCheck({
|
|
1660
1037
|
kind: "int",
|
|
1661
|
-
message:
|
|
1038
|
+
message: h.toString(e)
|
|
1662
1039
|
});
|
|
1663
1040
|
}
|
|
1664
1041
|
positive(e) {
|
|
@@ -1666,7 +1043,7 @@ class be extends k {
|
|
|
1666
1043
|
kind: "min",
|
|
1667
1044
|
value: 0,
|
|
1668
1045
|
inclusive: !1,
|
|
1669
|
-
message:
|
|
1046
|
+
message: h.toString(e)
|
|
1670
1047
|
});
|
|
1671
1048
|
}
|
|
1672
1049
|
negative(e) {
|
|
@@ -1674,7 +1051,7 @@ class be extends k {
|
|
|
1674
1051
|
kind: "max",
|
|
1675
1052
|
value: 0,
|
|
1676
1053
|
inclusive: !1,
|
|
1677
|
-
message:
|
|
1054
|
+
message: h.toString(e)
|
|
1678
1055
|
});
|
|
1679
1056
|
}
|
|
1680
1057
|
nonpositive(e) {
|
|
@@ -1682,7 +1059,7 @@ class be extends k {
|
|
|
1682
1059
|
kind: "max",
|
|
1683
1060
|
value: 0,
|
|
1684
1061
|
inclusive: !0,
|
|
1685
|
-
message:
|
|
1062
|
+
message: h.toString(e)
|
|
1686
1063
|
});
|
|
1687
1064
|
}
|
|
1688
1065
|
nonnegative(e) {
|
|
@@ -1690,20 +1067,20 @@ class be extends k {
|
|
|
1690
1067
|
kind: "min",
|
|
1691
1068
|
value: 0,
|
|
1692
1069
|
inclusive: !0,
|
|
1693
|
-
message:
|
|
1070
|
+
message: h.toString(e)
|
|
1694
1071
|
});
|
|
1695
1072
|
}
|
|
1696
1073
|
multipleOf(e, t) {
|
|
1697
1074
|
return this._addCheck({
|
|
1698
1075
|
kind: "multipleOf",
|
|
1699
1076
|
value: e,
|
|
1700
|
-
message:
|
|
1077
|
+
message: h.toString(t)
|
|
1701
1078
|
});
|
|
1702
1079
|
}
|
|
1703
1080
|
finite(e) {
|
|
1704
1081
|
return this._addCheck({
|
|
1705
1082
|
kind: "finite",
|
|
1706
|
-
message:
|
|
1083
|
+
message: h.toString(e)
|
|
1707
1084
|
});
|
|
1708
1085
|
}
|
|
1709
1086
|
safe(e) {
|
|
@@ -1711,12 +1088,12 @@ class be extends k {
|
|
|
1711
1088
|
kind: "min",
|
|
1712
1089
|
inclusive: !0,
|
|
1713
1090
|
value: Number.MIN_SAFE_INTEGER,
|
|
1714
|
-
message:
|
|
1091
|
+
message: h.toString(e)
|
|
1715
1092
|
})._addCheck({
|
|
1716
1093
|
kind: "max",
|
|
1717
1094
|
inclusive: !0,
|
|
1718
1095
|
value: Number.MAX_SAFE_INTEGER,
|
|
1719
|
-
message:
|
|
1096
|
+
message: h.toString(e)
|
|
1720
1097
|
});
|
|
1721
1098
|
}
|
|
1722
1099
|
get minValue() {
|
|
@@ -1732,7 +1109,7 @@ class be extends k {
|
|
|
1732
1109
|
return e;
|
|
1733
1110
|
}
|
|
1734
1111
|
get isInt() {
|
|
1735
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1112
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && _.isInteger(e.value));
|
|
1736
1113
|
}
|
|
1737
1114
|
get isFinite() {
|
|
1738
1115
|
let e = null, t = null;
|
|
@@ -1744,61 +1121,61 @@ class be extends k {
|
|
|
1744
1121
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1745
1122
|
}
|
|
1746
1123
|
}
|
|
1747
|
-
|
|
1124
|
+
K.create = (r) => new K({
|
|
1748
1125
|
checks: [],
|
|
1749
|
-
typeName:
|
|
1126
|
+
typeName: p.ZodNumber,
|
|
1750
1127
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1751
|
-
...
|
|
1128
|
+
...v(r)
|
|
1752
1129
|
});
|
|
1753
|
-
class
|
|
1130
|
+
class q extends g {
|
|
1754
1131
|
constructor() {
|
|
1755
1132
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1756
1133
|
}
|
|
1757
1134
|
_parse(e) {
|
|
1758
|
-
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !==
|
|
1759
|
-
const
|
|
1760
|
-
return
|
|
1761
|
-
code:
|
|
1762
|
-
expected:
|
|
1763
|
-
received:
|
|
1764
|
-
}),
|
|
1135
|
+
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
|
|
1136
|
+
const a = this._getOrReturnCtx(e);
|
|
1137
|
+
return l(a, {
|
|
1138
|
+
code: c.invalid_type,
|
|
1139
|
+
expected: f.bigint,
|
|
1140
|
+
received: a.parsedType
|
|
1141
|
+
}), y;
|
|
1765
1142
|
}
|
|
1766
1143
|
let n;
|
|
1767
|
-
const
|
|
1768
|
-
for (const
|
|
1769
|
-
|
|
1770
|
-
code:
|
|
1144
|
+
const s = new E();
|
|
1145
|
+
for (const a of this._def.checks)
|
|
1146
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1147
|
+
code: c.too_small,
|
|
1771
1148
|
type: "bigint",
|
|
1772
|
-
minimum:
|
|
1773
|
-
inclusive:
|
|
1774
|
-
message:
|
|
1775
|
-
}),
|
|
1776
|
-
code:
|
|
1149
|
+
minimum: a.value,
|
|
1150
|
+
inclusive: a.inclusive,
|
|
1151
|
+
message: a.message
|
|
1152
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1153
|
+
code: c.too_big,
|
|
1777
1154
|
type: "bigint",
|
|
1778
|
-
maximum:
|
|
1779
|
-
inclusive:
|
|
1780
|
-
message:
|
|
1781
|
-
}),
|
|
1782
|
-
code:
|
|
1783
|
-
multipleOf:
|
|
1784
|
-
message:
|
|
1785
|
-
}),
|
|
1786
|
-
return { status:
|
|
1155
|
+
maximum: a.value,
|
|
1156
|
+
inclusive: a.inclusive,
|
|
1157
|
+
message: a.message
|
|
1158
|
+
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
|
|
1159
|
+
code: c.not_multiple_of,
|
|
1160
|
+
multipleOf: a.value,
|
|
1161
|
+
message: a.message
|
|
1162
|
+
}), s.dirty()) : _.assertNever(a);
|
|
1163
|
+
return { status: s.value, value: e.data };
|
|
1787
1164
|
}
|
|
1788
1165
|
gte(e, t) {
|
|
1789
|
-
return this.setLimit("min", e, !0,
|
|
1166
|
+
return this.setLimit("min", e, !0, h.toString(t));
|
|
1790
1167
|
}
|
|
1791
1168
|
gt(e, t) {
|
|
1792
|
-
return this.setLimit("min", e, !1,
|
|
1169
|
+
return this.setLimit("min", e, !1, h.toString(t));
|
|
1793
1170
|
}
|
|
1794
1171
|
lte(e, t) {
|
|
1795
|
-
return this.setLimit("max", e, !0,
|
|
1172
|
+
return this.setLimit("max", e, !0, h.toString(t));
|
|
1796
1173
|
}
|
|
1797
1174
|
lt(e, t) {
|
|
1798
|
-
return this.setLimit("max", e, !1,
|
|
1175
|
+
return this.setLimit("max", e, !1, h.toString(t));
|
|
1799
1176
|
}
|
|
1800
|
-
setLimit(e, t, n,
|
|
1801
|
-
return new
|
|
1177
|
+
setLimit(e, t, n, s) {
|
|
1178
|
+
return new q({
|
|
1802
1179
|
...this._def,
|
|
1803
1180
|
checks: [
|
|
1804
1181
|
...this._def.checks,
|
|
@@ -1806,13 +1183,13 @@ class xe extends k {
|
|
|
1806
1183
|
kind: e,
|
|
1807
1184
|
value: t,
|
|
1808
1185
|
inclusive: n,
|
|
1809
|
-
message:
|
|
1186
|
+
message: h.toString(s)
|
|
1810
1187
|
}
|
|
1811
1188
|
]
|
|
1812
1189
|
});
|
|
1813
1190
|
}
|
|
1814
1191
|
_addCheck(e) {
|
|
1815
|
-
return new
|
|
1192
|
+
return new q({
|
|
1816
1193
|
...this._def,
|
|
1817
1194
|
checks: [...this._def.checks, e]
|
|
1818
1195
|
});
|
|
@@ -1822,7 +1199,7 @@ class xe extends k {
|
|
|
1822
1199
|
kind: "min",
|
|
1823
1200
|
value: BigInt(0),
|
|
1824
1201
|
inclusive: !1,
|
|
1825
|
-
message:
|
|
1202
|
+
message: h.toString(e)
|
|
1826
1203
|
});
|
|
1827
1204
|
}
|
|
1828
1205
|
negative(e) {
|
|
@@ -1830,7 +1207,7 @@ class xe extends k {
|
|
|
1830
1207
|
kind: "max",
|
|
1831
1208
|
value: BigInt(0),
|
|
1832
1209
|
inclusive: !1,
|
|
1833
|
-
message:
|
|
1210
|
+
message: h.toString(e)
|
|
1834
1211
|
});
|
|
1835
1212
|
}
|
|
1836
1213
|
nonpositive(e) {
|
|
@@ -1838,7 +1215,7 @@ class xe extends k {
|
|
|
1838
1215
|
kind: "max",
|
|
1839
1216
|
value: BigInt(0),
|
|
1840
1217
|
inclusive: !0,
|
|
1841
|
-
message:
|
|
1218
|
+
message: h.toString(e)
|
|
1842
1219
|
});
|
|
1843
1220
|
}
|
|
1844
1221
|
nonnegative(e) {
|
|
@@ -1846,14 +1223,14 @@ class xe extends k {
|
|
|
1846
1223
|
kind: "min",
|
|
1847
1224
|
value: BigInt(0),
|
|
1848
1225
|
inclusive: !0,
|
|
1849
|
-
message:
|
|
1226
|
+
message: h.toString(e)
|
|
1850
1227
|
});
|
|
1851
1228
|
}
|
|
1852
1229
|
multipleOf(e, t) {
|
|
1853
1230
|
return this._addCheck({
|
|
1854
1231
|
kind: "multipleOf",
|
|
1855
1232
|
value: e,
|
|
1856
|
-
message:
|
|
1233
|
+
message: h.toString(t)
|
|
1857
1234
|
});
|
|
1858
1235
|
}
|
|
1859
1236
|
get minValue() {
|
|
@@ -1869,74 +1246,74 @@ class xe extends k {
|
|
|
1869
1246
|
return e;
|
|
1870
1247
|
}
|
|
1871
1248
|
}
|
|
1872
|
-
|
|
1249
|
+
q.create = (r) => {
|
|
1873
1250
|
var e;
|
|
1874
|
-
return new
|
|
1251
|
+
return new q({
|
|
1875
1252
|
checks: [],
|
|
1876
|
-
typeName:
|
|
1253
|
+
typeName: p.ZodBigInt,
|
|
1877
1254
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1878
|
-
...
|
|
1255
|
+
...v(r)
|
|
1879
1256
|
});
|
|
1880
1257
|
};
|
|
1881
|
-
class
|
|
1258
|
+
class ge extends g {
|
|
1882
1259
|
_parse(e) {
|
|
1883
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1260
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
|
|
1884
1261
|
const n = this._getOrReturnCtx(e);
|
|
1885
|
-
return
|
|
1886
|
-
code:
|
|
1887
|
-
expected:
|
|
1262
|
+
return l(n, {
|
|
1263
|
+
code: c.invalid_type,
|
|
1264
|
+
expected: f.boolean,
|
|
1888
1265
|
received: n.parsedType
|
|
1889
|
-
}),
|
|
1266
|
+
}), y;
|
|
1890
1267
|
}
|
|
1891
|
-
return
|
|
1268
|
+
return S(e.data);
|
|
1892
1269
|
}
|
|
1893
1270
|
}
|
|
1894
|
-
|
|
1895
|
-
typeName:
|
|
1271
|
+
ge.create = (r) => new ge({
|
|
1272
|
+
typeName: p.ZodBoolean,
|
|
1896
1273
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1897
|
-
...
|
|
1274
|
+
...v(r)
|
|
1898
1275
|
});
|
|
1899
|
-
class
|
|
1276
|
+
class Q extends g {
|
|
1900
1277
|
_parse(e) {
|
|
1901
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1902
|
-
const
|
|
1903
|
-
return
|
|
1904
|
-
code:
|
|
1905
|
-
expected:
|
|
1906
|
-
received:
|
|
1907
|
-
}),
|
|
1278
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
|
|
1279
|
+
const a = this._getOrReturnCtx(e);
|
|
1280
|
+
return l(a, {
|
|
1281
|
+
code: c.invalid_type,
|
|
1282
|
+
expected: f.date,
|
|
1283
|
+
received: a.parsedType
|
|
1284
|
+
}), y;
|
|
1908
1285
|
}
|
|
1909
1286
|
if (isNaN(e.data.getTime())) {
|
|
1910
|
-
const
|
|
1911
|
-
return
|
|
1912
|
-
code:
|
|
1913
|
-
}),
|
|
1914
|
-
}
|
|
1915
|
-
const n = new
|
|
1916
|
-
let
|
|
1917
|
-
for (const
|
|
1918
|
-
|
|
1919
|
-
code:
|
|
1920
|
-
message:
|
|
1287
|
+
const a = this._getOrReturnCtx(e);
|
|
1288
|
+
return l(a, {
|
|
1289
|
+
code: c.invalid_date
|
|
1290
|
+
}), y;
|
|
1291
|
+
}
|
|
1292
|
+
const n = new E();
|
|
1293
|
+
let s;
|
|
1294
|
+
for (const a of this._def.checks)
|
|
1295
|
+
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1296
|
+
code: c.too_small,
|
|
1297
|
+
message: a.message,
|
|
1921
1298
|
inclusive: !0,
|
|
1922
1299
|
exact: !1,
|
|
1923
|
-
minimum:
|
|
1300
|
+
minimum: a.value,
|
|
1924
1301
|
type: "date"
|
|
1925
|
-
}), n.dirty()) :
|
|
1926
|
-
code:
|
|
1927
|
-
message:
|
|
1302
|
+
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
|
|
1303
|
+
code: c.too_big,
|
|
1304
|
+
message: a.message,
|
|
1928
1305
|
inclusive: !0,
|
|
1929
1306
|
exact: !1,
|
|
1930
|
-
maximum:
|
|
1307
|
+
maximum: a.value,
|
|
1931
1308
|
type: "date"
|
|
1932
|
-
}), n.dirty()) :
|
|
1309
|
+
}), n.dirty()) : _.assertNever(a);
|
|
1933
1310
|
return {
|
|
1934
1311
|
status: n.value,
|
|
1935
1312
|
value: new Date(e.data.getTime())
|
|
1936
1313
|
};
|
|
1937
1314
|
}
|
|
1938
1315
|
_addCheck(e) {
|
|
1939
|
-
return new
|
|
1316
|
+
return new Q({
|
|
1940
1317
|
...this._def,
|
|
1941
1318
|
checks: [...this._def.checks, e]
|
|
1942
1319
|
});
|
|
@@ -1945,14 +1322,14 @@ class Oe extends k {
|
|
|
1945
1322
|
return this._addCheck({
|
|
1946
1323
|
kind: "min",
|
|
1947
1324
|
value: e.getTime(),
|
|
1948
|
-
message:
|
|
1325
|
+
message: h.toString(t)
|
|
1949
1326
|
});
|
|
1950
1327
|
}
|
|
1951
1328
|
max(e, t) {
|
|
1952
1329
|
return this._addCheck({
|
|
1953
1330
|
kind: "max",
|
|
1954
1331
|
value: e.getTime(),
|
|
1955
|
-
message:
|
|
1332
|
+
message: h.toString(t)
|
|
1956
1333
|
});
|
|
1957
1334
|
}
|
|
1958
1335
|
get minDate() {
|
|
@@ -1968,308 +1345,308 @@ class Oe extends k {
|
|
|
1968
1345
|
return e != null ? new Date(e) : null;
|
|
1969
1346
|
}
|
|
1970
1347
|
}
|
|
1971
|
-
|
|
1348
|
+
Q.create = (r) => new Q({
|
|
1972
1349
|
checks: [],
|
|
1973
1350
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1974
|
-
typeName:
|
|
1975
|
-
...
|
|
1351
|
+
typeName: p.ZodDate,
|
|
1352
|
+
...v(r)
|
|
1976
1353
|
});
|
|
1977
|
-
class
|
|
1354
|
+
class $e extends g {
|
|
1978
1355
|
_parse(e) {
|
|
1979
|
-
if (this._getType(e) !==
|
|
1356
|
+
if (this._getType(e) !== f.symbol) {
|
|
1980
1357
|
const n = this._getOrReturnCtx(e);
|
|
1981
|
-
return
|
|
1982
|
-
code:
|
|
1983
|
-
expected:
|
|
1358
|
+
return l(n, {
|
|
1359
|
+
code: c.invalid_type,
|
|
1360
|
+
expected: f.symbol,
|
|
1984
1361
|
received: n.parsedType
|
|
1985
|
-
}),
|
|
1362
|
+
}), y;
|
|
1986
1363
|
}
|
|
1987
|
-
return
|
|
1364
|
+
return S(e.data);
|
|
1988
1365
|
}
|
|
1989
1366
|
}
|
|
1990
|
-
|
|
1991
|
-
typeName:
|
|
1992
|
-
...
|
|
1367
|
+
$e.create = (r) => new $e({
|
|
1368
|
+
typeName: p.ZodSymbol,
|
|
1369
|
+
...v(r)
|
|
1993
1370
|
});
|
|
1994
|
-
class
|
|
1371
|
+
class _e extends g {
|
|
1995
1372
|
_parse(e) {
|
|
1996
|
-
if (this._getType(e) !==
|
|
1373
|
+
if (this._getType(e) !== f.undefined) {
|
|
1997
1374
|
const n = this._getOrReturnCtx(e);
|
|
1998
|
-
return
|
|
1999
|
-
code:
|
|
2000
|
-
expected:
|
|
1375
|
+
return l(n, {
|
|
1376
|
+
code: c.invalid_type,
|
|
1377
|
+
expected: f.undefined,
|
|
2001
1378
|
received: n.parsedType
|
|
2002
|
-
}),
|
|
1379
|
+
}), y;
|
|
2003
1380
|
}
|
|
2004
|
-
return
|
|
1381
|
+
return S(e.data);
|
|
2005
1382
|
}
|
|
2006
1383
|
}
|
|
2007
|
-
|
|
2008
|
-
typeName:
|
|
2009
|
-
...
|
|
1384
|
+
_e.create = (r) => new _e({
|
|
1385
|
+
typeName: p.ZodUndefined,
|
|
1386
|
+
...v(r)
|
|
2010
1387
|
});
|
|
2011
|
-
class
|
|
1388
|
+
class xe extends g {
|
|
2012
1389
|
_parse(e) {
|
|
2013
|
-
if (this._getType(e) !==
|
|
1390
|
+
if (this._getType(e) !== f.null) {
|
|
2014
1391
|
const n = this._getOrReturnCtx(e);
|
|
2015
|
-
return
|
|
2016
|
-
code:
|
|
2017
|
-
expected:
|
|
1392
|
+
return l(n, {
|
|
1393
|
+
code: c.invalid_type,
|
|
1394
|
+
expected: f.null,
|
|
2018
1395
|
received: n.parsedType
|
|
2019
|
-
}),
|
|
1396
|
+
}), y;
|
|
2020
1397
|
}
|
|
2021
|
-
return
|
|
1398
|
+
return S(e.data);
|
|
2022
1399
|
}
|
|
2023
1400
|
}
|
|
2024
|
-
|
|
2025
|
-
typeName:
|
|
2026
|
-
...
|
|
1401
|
+
xe.create = (r) => new xe({
|
|
1402
|
+
typeName: p.ZodNull,
|
|
1403
|
+
...v(r)
|
|
2027
1404
|
});
|
|
2028
|
-
class
|
|
1405
|
+
class le extends g {
|
|
2029
1406
|
constructor() {
|
|
2030
1407
|
super(...arguments), this._any = !0;
|
|
2031
1408
|
}
|
|
2032
1409
|
_parse(e) {
|
|
2033
|
-
return
|
|
1410
|
+
return S(e.data);
|
|
2034
1411
|
}
|
|
2035
1412
|
}
|
|
2036
|
-
|
|
2037
|
-
typeName:
|
|
2038
|
-
...
|
|
1413
|
+
le.create = (r) => new le({
|
|
1414
|
+
typeName: p.ZodAny,
|
|
1415
|
+
...v(r)
|
|
2039
1416
|
});
|
|
2040
|
-
class
|
|
1417
|
+
class X extends g {
|
|
2041
1418
|
constructor() {
|
|
2042
1419
|
super(...arguments), this._unknown = !0;
|
|
2043
1420
|
}
|
|
2044
1421
|
_parse(e) {
|
|
2045
|
-
return
|
|
1422
|
+
return S(e.data);
|
|
2046
1423
|
}
|
|
2047
1424
|
}
|
|
2048
|
-
|
|
2049
|
-
typeName:
|
|
2050
|
-
...
|
|
1425
|
+
X.create = (r) => new X({
|
|
1426
|
+
typeName: p.ZodUnknown,
|
|
1427
|
+
...v(r)
|
|
2051
1428
|
});
|
|
2052
|
-
class
|
|
1429
|
+
class V extends g {
|
|
2053
1430
|
_parse(e) {
|
|
2054
1431
|
const t = this._getOrReturnCtx(e);
|
|
2055
|
-
return
|
|
2056
|
-
code:
|
|
2057
|
-
expected:
|
|
1432
|
+
return l(t, {
|
|
1433
|
+
code: c.invalid_type,
|
|
1434
|
+
expected: f.never,
|
|
2058
1435
|
received: t.parsedType
|
|
2059
|
-
}),
|
|
1436
|
+
}), y;
|
|
2060
1437
|
}
|
|
2061
1438
|
}
|
|
2062
|
-
|
|
2063
|
-
typeName:
|
|
2064
|
-
...
|
|
1439
|
+
V.create = (r) => new V({
|
|
1440
|
+
typeName: p.ZodNever,
|
|
1441
|
+
...v(r)
|
|
2065
1442
|
});
|
|
2066
|
-
class
|
|
1443
|
+
class Ve extends g {
|
|
2067
1444
|
_parse(e) {
|
|
2068
|
-
if (this._getType(e) !==
|
|
1445
|
+
if (this._getType(e) !== f.undefined) {
|
|
2069
1446
|
const n = this._getOrReturnCtx(e);
|
|
2070
|
-
return
|
|
2071
|
-
code:
|
|
2072
|
-
expected:
|
|
1447
|
+
return l(n, {
|
|
1448
|
+
code: c.invalid_type,
|
|
1449
|
+
expected: f.void,
|
|
2073
1450
|
received: n.parsedType
|
|
2074
|
-
}),
|
|
1451
|
+
}), y;
|
|
2075
1452
|
}
|
|
2076
|
-
return
|
|
1453
|
+
return S(e.data);
|
|
2077
1454
|
}
|
|
2078
1455
|
}
|
|
2079
|
-
|
|
2080
|
-
typeName:
|
|
2081
|
-
...
|
|
1456
|
+
Ve.create = (r) => new Ve({
|
|
1457
|
+
typeName: p.ZodVoid,
|
|
1458
|
+
...v(r)
|
|
2082
1459
|
});
|
|
2083
|
-
class
|
|
1460
|
+
class P extends g {
|
|
2084
1461
|
_parse(e) {
|
|
2085
|
-
const { ctx: t, status: n } = this._processInputParams(e),
|
|
2086
|
-
if (t.parsedType !==
|
|
2087
|
-
return
|
|
2088
|
-
code:
|
|
2089
|
-
expected:
|
|
1462
|
+
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1463
|
+
if (t.parsedType !== f.array)
|
|
1464
|
+
return l(t, {
|
|
1465
|
+
code: c.invalid_type,
|
|
1466
|
+
expected: f.array,
|
|
2090
1467
|
received: t.parsedType
|
|
2091
|
-
}),
|
|
2092
|
-
if (
|
|
2093
|
-
const
|
|
2094
|
-
(
|
|
2095
|
-
code:
|
|
2096
|
-
minimum:
|
|
2097
|
-
maximum:
|
|
1468
|
+
}), y;
|
|
1469
|
+
if (s.exactLength !== null) {
|
|
1470
|
+
const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1471
|
+
(i || o) && (l(t, {
|
|
1472
|
+
code: i ? c.too_big : c.too_small,
|
|
1473
|
+
minimum: o ? s.exactLength.value : void 0,
|
|
1474
|
+
maximum: i ? s.exactLength.value : void 0,
|
|
2098
1475
|
type: "array",
|
|
2099
1476
|
inclusive: !0,
|
|
2100
1477
|
exact: !0,
|
|
2101
|
-
message:
|
|
1478
|
+
message: s.exactLength.message
|
|
2102
1479
|
}), n.dirty());
|
|
2103
1480
|
}
|
|
2104
|
-
if (
|
|
2105
|
-
code:
|
|
2106
|
-
minimum:
|
|
1481
|
+
if (s.minLength !== null && t.data.length < s.minLength.value && (l(t, {
|
|
1482
|
+
code: c.too_small,
|
|
1483
|
+
minimum: s.minLength.value,
|
|
2107
1484
|
type: "array",
|
|
2108
1485
|
inclusive: !0,
|
|
2109
1486
|
exact: !1,
|
|
2110
|
-
message:
|
|
2111
|
-
}), n.dirty()),
|
|
2112
|
-
code:
|
|
2113
|
-
maximum:
|
|
1487
|
+
message: s.minLength.message
|
|
1488
|
+
}), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (l(t, {
|
|
1489
|
+
code: c.too_big,
|
|
1490
|
+
maximum: s.maxLength.value,
|
|
2114
1491
|
type: "array",
|
|
2115
1492
|
inclusive: !0,
|
|
2116
1493
|
exact: !1,
|
|
2117
|
-
message:
|
|
1494
|
+
message: s.maxLength.message
|
|
2118
1495
|
}), n.dirty()), t.common.async)
|
|
2119
|
-
return Promise.all([...t.data].map((
|
|
2120
|
-
const
|
|
2121
|
-
return
|
|
1496
|
+
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new U(t, i, t.path, o)))).then((i) => E.mergeArray(n, i));
|
|
1497
|
+
const a = [...t.data].map((i, o) => s.type._parseSync(new U(t, i, t.path, o)));
|
|
1498
|
+
return E.mergeArray(n, a);
|
|
2122
1499
|
}
|
|
2123
1500
|
get element() {
|
|
2124
1501
|
return this._def.type;
|
|
2125
1502
|
}
|
|
2126
1503
|
min(e, t) {
|
|
2127
|
-
return new
|
|
1504
|
+
return new P({
|
|
2128
1505
|
...this._def,
|
|
2129
|
-
minLength: { value: e, message:
|
|
1506
|
+
minLength: { value: e, message: h.toString(t) }
|
|
2130
1507
|
});
|
|
2131
1508
|
}
|
|
2132
1509
|
max(e, t) {
|
|
2133
|
-
return new
|
|
1510
|
+
return new P({
|
|
2134
1511
|
...this._def,
|
|
2135
|
-
maxLength: { value: e, message:
|
|
1512
|
+
maxLength: { value: e, message: h.toString(t) }
|
|
2136
1513
|
});
|
|
2137
1514
|
}
|
|
2138
1515
|
length(e, t) {
|
|
2139
|
-
return new
|
|
1516
|
+
return new P({
|
|
2140
1517
|
...this._def,
|
|
2141
|
-
exactLength: { value: e, message:
|
|
1518
|
+
exactLength: { value: e, message: h.toString(t) }
|
|
2142
1519
|
});
|
|
2143
1520
|
}
|
|
2144
1521
|
nonempty(e) {
|
|
2145
1522
|
return this.min(1, e);
|
|
2146
1523
|
}
|
|
2147
1524
|
}
|
|
2148
|
-
|
|
1525
|
+
P.create = (r, e) => new P({
|
|
2149
1526
|
type: r,
|
|
2150
1527
|
minLength: null,
|
|
2151
1528
|
maxLength: null,
|
|
2152
1529
|
exactLength: null,
|
|
2153
|
-
typeName:
|
|
2154
|
-
...
|
|
1530
|
+
typeName: p.ZodArray,
|
|
1531
|
+
...v(e)
|
|
2155
1532
|
});
|
|
2156
|
-
function
|
|
2157
|
-
if (r instanceof
|
|
1533
|
+
function oe(r) {
|
|
1534
|
+
if (r instanceof k) {
|
|
2158
1535
|
const e = {};
|
|
2159
1536
|
for (const t in r.shape) {
|
|
2160
1537
|
const n = r.shape[t];
|
|
2161
|
-
e[t] =
|
|
1538
|
+
e[t] = M.create(oe(n));
|
|
2162
1539
|
}
|
|
2163
|
-
return new
|
|
1540
|
+
return new k({
|
|
2164
1541
|
...r._def,
|
|
2165
1542
|
shape: () => e
|
|
2166
1543
|
});
|
|
2167
|
-
} else return r instanceof
|
|
1544
|
+
} else return r instanceof P ? new P({
|
|
2168
1545
|
...r._def,
|
|
2169
|
-
type:
|
|
2170
|
-
}) : r instanceof
|
|
1546
|
+
type: oe(r.element)
|
|
1547
|
+
}) : r instanceof M ? M.create(oe(r.unwrap())) : r instanceof J ? J.create(oe(r.unwrap())) : r instanceof L ? L.create(r.items.map((e) => oe(e))) : r;
|
|
2171
1548
|
}
|
|
2172
|
-
class
|
|
1549
|
+
class k extends g {
|
|
2173
1550
|
constructor() {
|
|
2174
1551
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2175
1552
|
}
|
|
2176
1553
|
_getCached() {
|
|
2177
1554
|
if (this._cached !== null)
|
|
2178
1555
|
return this._cached;
|
|
2179
|
-
const e = this._def.shape(), t =
|
|
1556
|
+
const e = this._def.shape(), t = _.objectKeys(e);
|
|
2180
1557
|
return this._cached = { shape: e, keys: t };
|
|
2181
1558
|
}
|
|
2182
1559
|
_parse(e) {
|
|
2183
|
-
if (this._getType(e) !==
|
|
2184
|
-
const
|
|
2185
|
-
return
|
|
2186
|
-
code:
|
|
2187
|
-
expected:
|
|
2188
|
-
received:
|
|
2189
|
-
}),
|
|
2190
|
-
}
|
|
2191
|
-
const { status: n, ctx:
|
|
2192
|
-
if (!(this._def.catchall instanceof
|
|
2193
|
-
for (const
|
|
2194
|
-
|
|
2195
|
-
const
|
|
2196
|
-
for (const
|
|
2197
|
-
const
|
|
2198
|
-
|
|
2199
|
-
key: { status: "valid", value:
|
|
2200
|
-
value:
|
|
2201
|
-
alwaysSet:
|
|
1560
|
+
if (this._getType(e) !== f.object) {
|
|
1561
|
+
const d = this._getOrReturnCtx(e);
|
|
1562
|
+
return l(d, {
|
|
1563
|
+
code: c.invalid_type,
|
|
1564
|
+
expected: f.object,
|
|
1565
|
+
received: d.parsedType
|
|
1566
|
+
}), y;
|
|
1567
|
+
}
|
|
1568
|
+
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1569
|
+
if (!(this._def.catchall instanceof V && this._def.unknownKeys === "strip"))
|
|
1570
|
+
for (const d in s.data)
|
|
1571
|
+
i.includes(d) || o.push(d);
|
|
1572
|
+
const u = [];
|
|
1573
|
+
for (const d of i) {
|
|
1574
|
+
const m = a[d], T = s.data[d];
|
|
1575
|
+
u.push({
|
|
1576
|
+
key: { status: "valid", value: d },
|
|
1577
|
+
value: m._parse(new U(s, T, s.path, d)),
|
|
1578
|
+
alwaysSet: d in s.data
|
|
2202
1579
|
});
|
|
2203
1580
|
}
|
|
2204
|
-
if (this._def.catchall instanceof
|
|
2205
|
-
const
|
|
2206
|
-
if (
|
|
2207
|
-
for (const
|
|
2208
|
-
|
|
2209
|
-
key: { status: "valid", value:
|
|
2210
|
-
value: { status: "valid", value:
|
|
1581
|
+
if (this._def.catchall instanceof V) {
|
|
1582
|
+
const d = this._def.unknownKeys;
|
|
1583
|
+
if (d === "passthrough")
|
|
1584
|
+
for (const m of o)
|
|
1585
|
+
u.push({
|
|
1586
|
+
key: { status: "valid", value: m },
|
|
1587
|
+
value: { status: "valid", value: s.data[m] }
|
|
2211
1588
|
});
|
|
2212
|
-
else if (
|
|
2213
|
-
|
|
2214
|
-
code:
|
|
2215
|
-
keys:
|
|
1589
|
+
else if (d === "strict")
|
|
1590
|
+
o.length > 0 && (l(s, {
|
|
1591
|
+
code: c.unrecognized_keys,
|
|
1592
|
+
keys: o
|
|
2216
1593
|
}), n.dirty());
|
|
2217
|
-
else if (
|
|
1594
|
+
else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2218
1595
|
} else {
|
|
2219
|
-
const
|
|
2220
|
-
for (const
|
|
2221
|
-
const
|
|
2222
|
-
|
|
2223
|
-
key: { status: "valid", value:
|
|
2224
|
-
value:
|
|
2225
|
-
new
|
|
1596
|
+
const d = this._def.catchall;
|
|
1597
|
+
for (const m of o) {
|
|
1598
|
+
const T = s.data[m];
|
|
1599
|
+
u.push({
|
|
1600
|
+
key: { status: "valid", value: m },
|
|
1601
|
+
value: d._parse(
|
|
1602
|
+
new U(s, T, s.path, m)
|
|
2226
1603
|
//, ctx.child(key), value, getParsedType(value)
|
|
2227
1604
|
),
|
|
2228
|
-
alwaysSet:
|
|
1605
|
+
alwaysSet: m in s.data
|
|
2229
1606
|
});
|
|
2230
1607
|
}
|
|
2231
1608
|
}
|
|
2232
|
-
return
|
|
2233
|
-
const
|
|
2234
|
-
for (const
|
|
2235
|
-
const
|
|
2236
|
-
|
|
2237
|
-
key:
|
|
2238
|
-
value:
|
|
2239
|
-
alwaysSet:
|
|
1609
|
+
return s.common.async ? Promise.resolve().then(async () => {
|
|
1610
|
+
const d = [];
|
|
1611
|
+
for (const m of u) {
|
|
1612
|
+
const T = await m.key, z = await m.value;
|
|
1613
|
+
d.push({
|
|
1614
|
+
key: T,
|
|
1615
|
+
value: z,
|
|
1616
|
+
alwaysSet: m.alwaysSet
|
|
2240
1617
|
});
|
|
2241
1618
|
}
|
|
2242
|
-
return
|
|
2243
|
-
}).then((
|
|
1619
|
+
return d;
|
|
1620
|
+
}).then((d) => E.mergeObjectSync(n, d)) : E.mergeObjectSync(n, u);
|
|
2244
1621
|
}
|
|
2245
1622
|
get shape() {
|
|
2246
1623
|
return this._def.shape();
|
|
2247
1624
|
}
|
|
2248
1625
|
strict(e) {
|
|
2249
|
-
return
|
|
1626
|
+
return h.errToObj, new k({
|
|
2250
1627
|
...this._def,
|
|
2251
1628
|
unknownKeys: "strict",
|
|
2252
1629
|
...e !== void 0 ? {
|
|
2253
1630
|
errorMap: (t, n) => {
|
|
2254
|
-
var a,
|
|
2255
|
-
const
|
|
1631
|
+
var s, a, i, o;
|
|
1632
|
+
const u = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && i !== void 0 ? i : n.defaultError;
|
|
2256
1633
|
return t.code === "unrecognized_keys" ? {
|
|
2257
|
-
message: (
|
|
1634
|
+
message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o : u
|
|
2258
1635
|
} : {
|
|
2259
|
-
message:
|
|
1636
|
+
message: u
|
|
2260
1637
|
};
|
|
2261
1638
|
}
|
|
2262
1639
|
} : {}
|
|
2263
1640
|
});
|
|
2264
1641
|
}
|
|
2265
1642
|
strip() {
|
|
2266
|
-
return new
|
|
1643
|
+
return new k({
|
|
2267
1644
|
...this._def,
|
|
2268
1645
|
unknownKeys: "strip"
|
|
2269
1646
|
});
|
|
2270
1647
|
}
|
|
2271
1648
|
passthrough() {
|
|
2272
|
-
return new
|
|
1649
|
+
return new k({
|
|
2273
1650
|
...this._def,
|
|
2274
1651
|
unknownKeys: "passthrough"
|
|
2275
1652
|
});
|
|
@@ -2292,7 +1669,7 @@ class N extends k {
|
|
|
2292
1669
|
// }) as any;
|
|
2293
1670
|
// };
|
|
2294
1671
|
extend(e) {
|
|
2295
|
-
return new
|
|
1672
|
+
return new k({
|
|
2296
1673
|
...this._def,
|
|
2297
1674
|
shape: () => ({
|
|
2298
1675
|
...this._def.shape(),
|
|
@@ -2306,14 +1683,14 @@ class N extends k {
|
|
|
2306
1683
|
* upgrade if you are experiencing issues.
|
|
2307
1684
|
*/
|
|
2308
1685
|
merge(e) {
|
|
2309
|
-
return new
|
|
1686
|
+
return new k({
|
|
2310
1687
|
unknownKeys: e._def.unknownKeys,
|
|
2311
1688
|
catchall: e._def.catchall,
|
|
2312
1689
|
shape: () => ({
|
|
2313
1690
|
...this._def.shape(),
|
|
2314
1691
|
...e._def.shape()
|
|
2315
1692
|
}),
|
|
2316
|
-
typeName:
|
|
1693
|
+
typeName: p.ZodObject
|
|
2317
1694
|
});
|
|
2318
1695
|
}
|
|
2319
1696
|
// merge<
|
|
@@ -2376,25 +1753,25 @@ class N extends k {
|
|
|
2376
1753
|
// return merged;
|
|
2377
1754
|
// }
|
|
2378
1755
|
catchall(e) {
|
|
2379
|
-
return new
|
|
1756
|
+
return new k({
|
|
2380
1757
|
...this._def,
|
|
2381
1758
|
catchall: e
|
|
2382
1759
|
});
|
|
2383
1760
|
}
|
|
2384
1761
|
pick(e) {
|
|
2385
1762
|
const t = {};
|
|
2386
|
-
return
|
|
1763
|
+
return _.objectKeys(e).forEach((n) => {
|
|
2387
1764
|
e[n] && this.shape[n] && (t[n] = this.shape[n]);
|
|
2388
|
-
}), new
|
|
1765
|
+
}), new k({
|
|
2389
1766
|
...this._def,
|
|
2390
1767
|
shape: () => t
|
|
2391
1768
|
});
|
|
2392
1769
|
}
|
|
2393
1770
|
omit(e) {
|
|
2394
1771
|
const t = {};
|
|
2395
|
-
return
|
|
1772
|
+
return _.objectKeys(this.shape).forEach((n) => {
|
|
2396
1773
|
e[n] || (t[n] = this.shape[n]);
|
|
2397
|
-
}), new
|
|
1774
|
+
}), new k({
|
|
2398
1775
|
...this._def,
|
|
2399
1776
|
shape: () => t
|
|
2400
1777
|
});
|
|
@@ -2403,78 +1780,78 @@ class N extends k {
|
|
|
2403
1780
|
* @deprecated
|
|
2404
1781
|
*/
|
|
2405
1782
|
deepPartial() {
|
|
2406
|
-
return
|
|
1783
|
+
return oe(this);
|
|
2407
1784
|
}
|
|
2408
1785
|
partial(e) {
|
|
2409
1786
|
const t = {};
|
|
2410
|
-
return
|
|
2411
|
-
const
|
|
2412
|
-
e && !e[n] ? t[n] =
|
|
2413
|
-
}), new
|
|
1787
|
+
return _.objectKeys(this.shape).forEach((n) => {
|
|
1788
|
+
const s = this.shape[n];
|
|
1789
|
+
e && !e[n] ? t[n] = s : t[n] = s.optional();
|
|
1790
|
+
}), new k({
|
|
2414
1791
|
...this._def,
|
|
2415
1792
|
shape: () => t
|
|
2416
1793
|
});
|
|
2417
1794
|
}
|
|
2418
1795
|
required(e) {
|
|
2419
1796
|
const t = {};
|
|
2420
|
-
return
|
|
1797
|
+
return _.objectKeys(this.shape).forEach((n) => {
|
|
2421
1798
|
if (e && !e[n])
|
|
2422
1799
|
t[n] = this.shape[n];
|
|
2423
1800
|
else {
|
|
2424
|
-
let
|
|
2425
|
-
for (;
|
|
2426
|
-
|
|
2427
|
-
t[n] =
|
|
1801
|
+
let a = this.shape[n];
|
|
1802
|
+
for (; a instanceof M; )
|
|
1803
|
+
a = a._def.innerType;
|
|
1804
|
+
t[n] = a;
|
|
2428
1805
|
}
|
|
2429
|
-
}), new
|
|
1806
|
+
}), new k({
|
|
2430
1807
|
...this._def,
|
|
2431
1808
|
shape: () => t
|
|
2432
1809
|
});
|
|
2433
1810
|
}
|
|
2434
1811
|
keyof() {
|
|
2435
|
-
return
|
|
1812
|
+
return St(_.objectKeys(this.shape));
|
|
2436
1813
|
}
|
|
2437
1814
|
}
|
|
2438
|
-
|
|
1815
|
+
k.create = (r, e) => new k({
|
|
2439
1816
|
shape: () => r,
|
|
2440
1817
|
unknownKeys: "strip",
|
|
2441
|
-
catchall:
|
|
2442
|
-
typeName:
|
|
2443
|
-
...
|
|
1818
|
+
catchall: V.create(),
|
|
1819
|
+
typeName: p.ZodObject,
|
|
1820
|
+
...v(e)
|
|
2444
1821
|
});
|
|
2445
|
-
|
|
1822
|
+
k.strictCreate = (r, e) => new k({
|
|
2446
1823
|
shape: () => r,
|
|
2447
1824
|
unknownKeys: "strict",
|
|
2448
|
-
catchall:
|
|
2449
|
-
typeName:
|
|
2450
|
-
...
|
|
1825
|
+
catchall: V.create(),
|
|
1826
|
+
typeName: p.ZodObject,
|
|
1827
|
+
...v(e)
|
|
2451
1828
|
});
|
|
2452
|
-
|
|
1829
|
+
k.lazycreate = (r, e) => new k({
|
|
2453
1830
|
shape: r,
|
|
2454
1831
|
unknownKeys: "strip",
|
|
2455
|
-
catchall:
|
|
2456
|
-
typeName:
|
|
2457
|
-
...
|
|
1832
|
+
catchall: V.create(),
|
|
1833
|
+
typeName: p.ZodObject,
|
|
1834
|
+
...v(e)
|
|
2458
1835
|
});
|
|
2459
|
-
class
|
|
1836
|
+
class ke extends g {
|
|
2460
1837
|
_parse(e) {
|
|
2461
1838
|
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
2462
|
-
function a
|
|
2463
|
-
for (const
|
|
2464
|
-
if (
|
|
2465
|
-
return
|
|
2466
|
-
for (const
|
|
2467
|
-
if (
|
|
2468
|
-
return t.common.issues.push(...
|
|
2469
|
-
const
|
|
2470
|
-
return
|
|
2471
|
-
code:
|
|
2472
|
-
unionErrors:
|
|
2473
|
-
}),
|
|
1839
|
+
function s(a) {
|
|
1840
|
+
for (const o of a)
|
|
1841
|
+
if (o.result.status === "valid")
|
|
1842
|
+
return o.result;
|
|
1843
|
+
for (const o of a)
|
|
1844
|
+
if (o.result.status === "dirty")
|
|
1845
|
+
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1846
|
+
const i = a.map((o) => new I(o.ctx.common.issues));
|
|
1847
|
+
return l(t, {
|
|
1848
|
+
code: c.invalid_union,
|
|
1849
|
+
unionErrors: i
|
|
1850
|
+
}), y;
|
|
2474
1851
|
}
|
|
2475
1852
|
if (t.common.async)
|
|
2476
|
-
return Promise.all(n.map(async (
|
|
2477
|
-
const
|
|
1853
|
+
return Promise.all(n.map(async (a) => {
|
|
1854
|
+
const i = {
|
|
2478
1855
|
...t,
|
|
2479
1856
|
common: {
|
|
2480
1857
|
...t.common,
|
|
@@ -2483,76 +1860,76 @@ class rt extends k {
|
|
|
2483
1860
|
parent: null
|
|
2484
1861
|
};
|
|
2485
1862
|
return {
|
|
2486
|
-
result: await
|
|
1863
|
+
result: await a._parseAsync({
|
|
2487
1864
|
data: t.data,
|
|
2488
1865
|
path: t.path,
|
|
2489
|
-
parent:
|
|
1866
|
+
parent: i
|
|
2490
1867
|
}),
|
|
2491
|
-
ctx:
|
|
1868
|
+
ctx: i
|
|
2492
1869
|
};
|
|
2493
|
-
})).then(
|
|
1870
|
+
})).then(s);
|
|
2494
1871
|
{
|
|
2495
|
-
let
|
|
2496
|
-
const
|
|
2497
|
-
for (const
|
|
2498
|
-
const
|
|
1872
|
+
let a;
|
|
1873
|
+
const i = [];
|
|
1874
|
+
for (const u of n) {
|
|
1875
|
+
const d = {
|
|
2499
1876
|
...t,
|
|
2500
1877
|
common: {
|
|
2501
1878
|
...t.common,
|
|
2502
1879
|
issues: []
|
|
2503
1880
|
},
|
|
2504
1881
|
parent: null
|
|
2505
|
-
},
|
|
1882
|
+
}, m = u._parseSync({
|
|
2506
1883
|
data: t.data,
|
|
2507
1884
|
path: t.path,
|
|
2508
|
-
parent:
|
|
1885
|
+
parent: d
|
|
2509
1886
|
});
|
|
2510
|
-
if (
|
|
2511
|
-
return
|
|
2512
|
-
|
|
1887
|
+
if (m.status === "valid")
|
|
1888
|
+
return m;
|
|
1889
|
+
m.status === "dirty" && !a && (a = { result: m, ctx: d }), d.common.issues.length && i.push(d.common.issues);
|
|
2513
1890
|
}
|
|
2514
|
-
if (
|
|
2515
|
-
return t.common.issues.push(...
|
|
2516
|
-
const
|
|
2517
|
-
return
|
|
2518
|
-
code:
|
|
2519
|
-
unionErrors:
|
|
2520
|
-
}),
|
|
1891
|
+
if (a)
|
|
1892
|
+
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1893
|
+
const o = i.map((u) => new I(u));
|
|
1894
|
+
return l(t, {
|
|
1895
|
+
code: c.invalid_union,
|
|
1896
|
+
unionErrors: o
|
|
1897
|
+
}), y;
|
|
2521
1898
|
}
|
|
2522
1899
|
}
|
|
2523
1900
|
get options() {
|
|
2524
1901
|
return this._def.options;
|
|
2525
1902
|
}
|
|
2526
1903
|
}
|
|
2527
|
-
|
|
1904
|
+
ke.create = (r, e) => new ke({
|
|
2528
1905
|
options: r,
|
|
2529
|
-
typeName:
|
|
2530
|
-
...
|
|
1906
|
+
typeName: p.ZodUnion,
|
|
1907
|
+
...v(e)
|
|
2531
1908
|
});
|
|
2532
|
-
const
|
|
2533
|
-
class
|
|
1909
|
+
const $ = (r) => r instanceof we ? $(r.schema) : r instanceof D ? $(r.innerType()) : r instanceof Ee ? [r.value] : r instanceof Y ? r.options : r instanceof Ce ? _.objectValues(r.enum) : r instanceof Se ? $(r._def.innerType) : r instanceof _e ? [void 0] : r instanceof xe ? [null] : r instanceof M ? [void 0, ...$(r.unwrap())] : r instanceof J ? [null, ...$(r.unwrap())] : r instanceof at || r instanceof Re ? $(r.unwrap()) : r instanceof Oe ? $(r._def.innerType) : [];
|
|
1910
|
+
class He extends g {
|
|
2534
1911
|
_parse(e) {
|
|
2535
1912
|
const { ctx: t } = this._processInputParams(e);
|
|
2536
|
-
if (t.parsedType !==
|
|
2537
|
-
return
|
|
2538
|
-
code:
|
|
2539
|
-
expected:
|
|
1913
|
+
if (t.parsedType !== f.object)
|
|
1914
|
+
return l(t, {
|
|
1915
|
+
code: c.invalid_type,
|
|
1916
|
+
expected: f.object,
|
|
2540
1917
|
received: t.parsedType
|
|
2541
|
-
}),
|
|
2542
|
-
const n = this.discriminator,
|
|
2543
|
-
return
|
|
1918
|
+
}), y;
|
|
1919
|
+
const n = this.discriminator, s = t.data[n], a = this.optionsMap.get(s);
|
|
1920
|
+
return a ? t.common.async ? a._parseAsync({
|
|
2544
1921
|
data: t.data,
|
|
2545
1922
|
path: t.path,
|
|
2546
1923
|
parent: t
|
|
2547
|
-
}) :
|
|
1924
|
+
}) : a._parseSync({
|
|
2548
1925
|
data: t.data,
|
|
2549
1926
|
path: t.path,
|
|
2550
1927
|
parent: t
|
|
2551
|
-
}) : (
|
|
2552
|
-
code:
|
|
1928
|
+
}) : (l(t, {
|
|
1929
|
+
code: c.invalid_union_discriminator,
|
|
2553
1930
|
options: Array.from(this.optionsMap.keys()),
|
|
2554
1931
|
path: [n]
|
|
2555
|
-
}),
|
|
1932
|
+
}), y);
|
|
2556
1933
|
}
|
|
2557
1934
|
get discriminator() {
|
|
2558
1935
|
return this._def.discriminator;
|
|
@@ -2572,61 +1949,61 @@ class At extends k {
|
|
|
2572
1949
|
* @param params
|
|
2573
1950
|
*/
|
|
2574
1951
|
static create(e, t, n) {
|
|
2575
|
-
const
|
|
2576
|
-
for (const
|
|
2577
|
-
const
|
|
2578
|
-
if (!
|
|
1952
|
+
const s = /* @__PURE__ */ new Map();
|
|
1953
|
+
for (const a of t) {
|
|
1954
|
+
const i = $(a.shape[e]);
|
|
1955
|
+
if (!i.length)
|
|
2579
1956
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2580
|
-
for (const
|
|
2581
|
-
if (
|
|
2582
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(
|
|
2583
|
-
|
|
1957
|
+
for (const o of i) {
|
|
1958
|
+
if (s.has(o))
|
|
1959
|
+
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
|
|
1960
|
+
s.set(o, a);
|
|
2584
1961
|
}
|
|
2585
1962
|
}
|
|
2586
|
-
return new
|
|
2587
|
-
typeName:
|
|
1963
|
+
return new He({
|
|
1964
|
+
typeName: p.ZodDiscriminatedUnion,
|
|
2588
1965
|
discriminator: e,
|
|
2589
1966
|
options: t,
|
|
2590
|
-
optionsMap:
|
|
2591
|
-
...
|
|
1967
|
+
optionsMap: s,
|
|
1968
|
+
...v(n)
|
|
2592
1969
|
});
|
|
2593
1970
|
}
|
|
2594
1971
|
}
|
|
2595
|
-
function
|
|
2596
|
-
const t =
|
|
1972
|
+
function nt(r, e) {
|
|
1973
|
+
const t = H(r), n = H(e);
|
|
2597
1974
|
if (r === e)
|
|
2598
1975
|
return { valid: !0, data: r };
|
|
2599
|
-
if (t ===
|
|
2600
|
-
const
|
|
2601
|
-
for (const
|
|
2602
|
-
const
|
|
2603
|
-
if (!
|
|
1976
|
+
if (t === f.object && n === f.object) {
|
|
1977
|
+
const s = _.objectKeys(e), a = _.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
|
|
1978
|
+
for (const o of a) {
|
|
1979
|
+
const u = nt(r[o], e[o]);
|
|
1980
|
+
if (!u.valid)
|
|
2604
1981
|
return { valid: !1 };
|
|
2605
|
-
o
|
|
1982
|
+
i[o] = u.data;
|
|
2606
1983
|
}
|
|
2607
|
-
return { valid: !0, data:
|
|
2608
|
-
} else if (t ===
|
|
1984
|
+
return { valid: !0, data: i };
|
|
1985
|
+
} else if (t === f.array && n === f.array) {
|
|
2609
1986
|
if (r.length !== e.length)
|
|
2610
1987
|
return { valid: !1 };
|
|
2611
|
-
const
|
|
2612
|
-
for (let
|
|
2613
|
-
const
|
|
2614
|
-
if (!
|
|
1988
|
+
const s = [];
|
|
1989
|
+
for (let a = 0; a < r.length; a++) {
|
|
1990
|
+
const i = r[a], o = e[a], u = nt(i, o);
|
|
1991
|
+
if (!u.valid)
|
|
2615
1992
|
return { valid: !1 };
|
|
2616
|
-
|
|
1993
|
+
s.push(u.data);
|
|
2617
1994
|
}
|
|
2618
|
-
return { valid: !0, data:
|
|
2619
|
-
} else return t ===
|
|
1995
|
+
return { valid: !0, data: s };
|
|
1996
|
+
} else return t === f.date && n === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2620
1997
|
}
|
|
2621
|
-
class
|
|
1998
|
+
class be extends g {
|
|
2622
1999
|
_parse(e) {
|
|
2623
|
-
const { status: t, ctx: n } = this._processInputParams(e),
|
|
2624
|
-
if (
|
|
2625
|
-
return
|
|
2626
|
-
const
|
|
2627
|
-
return
|
|
2628
|
-
code:
|
|
2629
|
-
}),
|
|
2000
|
+
const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2001
|
+
if (tt(a) || tt(i))
|
|
2002
|
+
return y;
|
|
2003
|
+
const o = nt(a.value, i.value);
|
|
2004
|
+
return o.valid ? ((rt(a) || rt(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
|
|
2005
|
+
code: c.invalid_intersection_types
|
|
2006
|
+
}), y);
|
|
2630
2007
|
};
|
|
2631
2008
|
return n.common.async ? Promise.all([
|
|
2632
2009
|
this._def.left._parseAsync({
|
|
@@ -2639,7 +2016,7 @@ class nt extends k {
|
|
|
2639
2016
|
path: n.path,
|
|
2640
2017
|
parent: n
|
|
2641
2018
|
})
|
|
2642
|
-
]).then(([
|
|
2019
|
+
]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
|
|
2643
2020
|
data: n.data,
|
|
2644
2021
|
path: n.path,
|
|
2645
2022
|
parent: n
|
|
@@ -2650,63 +2027,63 @@ class nt extends k {
|
|
|
2650
2027
|
}));
|
|
2651
2028
|
}
|
|
2652
2029
|
}
|
|
2653
|
-
|
|
2030
|
+
be.create = (r, e, t) => new be({
|
|
2654
2031
|
left: r,
|
|
2655
2032
|
right: e,
|
|
2656
|
-
typeName:
|
|
2657
|
-
...
|
|
2033
|
+
typeName: p.ZodIntersection,
|
|
2034
|
+
...v(t)
|
|
2658
2035
|
});
|
|
2659
|
-
class
|
|
2036
|
+
class L extends g {
|
|
2660
2037
|
_parse(e) {
|
|
2661
2038
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2662
|
-
if (n.parsedType !==
|
|
2663
|
-
return
|
|
2664
|
-
code:
|
|
2665
|
-
expected:
|
|
2039
|
+
if (n.parsedType !== f.array)
|
|
2040
|
+
return l(n, {
|
|
2041
|
+
code: c.invalid_type,
|
|
2042
|
+
expected: f.array,
|
|
2666
2043
|
received: n.parsedType
|
|
2667
|
-
}),
|
|
2044
|
+
}), y;
|
|
2668
2045
|
if (n.data.length < this._def.items.length)
|
|
2669
|
-
return
|
|
2670
|
-
code:
|
|
2046
|
+
return l(n, {
|
|
2047
|
+
code: c.too_small,
|
|
2671
2048
|
minimum: this._def.items.length,
|
|
2672
2049
|
inclusive: !0,
|
|
2673
2050
|
exact: !1,
|
|
2674
2051
|
type: "array"
|
|
2675
|
-
}),
|
|
2676
|
-
!this._def.rest && n.data.length > this._def.items.length && (
|
|
2677
|
-
code:
|
|
2052
|
+
}), y;
|
|
2053
|
+
!this._def.rest && n.data.length > this._def.items.length && (l(n, {
|
|
2054
|
+
code: c.too_big,
|
|
2678
2055
|
maximum: this._def.items.length,
|
|
2679
2056
|
inclusive: !0,
|
|
2680
2057
|
exact: !1,
|
|
2681
2058
|
type: "array"
|
|
2682
2059
|
}), t.dirty());
|
|
2683
|
-
const
|
|
2684
|
-
const
|
|
2685
|
-
return
|
|
2686
|
-
}).filter((
|
|
2687
|
-
return n.common.async ? Promise.all(
|
|
2060
|
+
const a = [...n.data].map((i, o) => {
|
|
2061
|
+
const u = this._def.items[o] || this._def.rest;
|
|
2062
|
+
return u ? u._parse(new U(n, i, n.path, o)) : null;
|
|
2063
|
+
}).filter((i) => !!i);
|
|
2064
|
+
return n.common.async ? Promise.all(a).then((i) => E.mergeArray(t, i)) : E.mergeArray(t, a);
|
|
2688
2065
|
}
|
|
2689
2066
|
get items() {
|
|
2690
2067
|
return this._def.items;
|
|
2691
2068
|
}
|
|
2692
2069
|
rest(e) {
|
|
2693
|
-
return new
|
|
2070
|
+
return new L({
|
|
2694
2071
|
...this._def,
|
|
2695
2072
|
rest: e
|
|
2696
2073
|
});
|
|
2697
2074
|
}
|
|
2698
2075
|
}
|
|
2699
|
-
|
|
2076
|
+
L.create = (r, e) => {
|
|
2700
2077
|
if (!Array.isArray(r))
|
|
2701
2078
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2702
|
-
return new
|
|
2079
|
+
return new L({
|
|
2703
2080
|
items: r,
|
|
2704
|
-
typeName:
|
|
2081
|
+
typeName: p.ZodTuple,
|
|
2705
2082
|
rest: null,
|
|
2706
|
-
...
|
|
2083
|
+
...v(e)
|
|
2707
2084
|
});
|
|
2708
2085
|
};
|
|
2709
|
-
class
|
|
2086
|
+
class Te extends g {
|
|
2710
2087
|
get keySchema() {
|
|
2711
2088
|
return this._def.keyType;
|
|
2712
2089
|
}
|
|
@@ -2715,39 +2092,39 @@ class at extends k {
|
|
|
2715
2092
|
}
|
|
2716
2093
|
_parse(e) {
|
|
2717
2094
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2718
|
-
if (n.parsedType !==
|
|
2719
|
-
return
|
|
2720
|
-
code:
|
|
2721
|
-
expected:
|
|
2095
|
+
if (n.parsedType !== f.object)
|
|
2096
|
+
return l(n, {
|
|
2097
|
+
code: c.invalid_type,
|
|
2098
|
+
expected: f.object,
|
|
2722
2099
|
received: n.parsedType
|
|
2723
|
-
}),
|
|
2724
|
-
const
|
|
2725
|
-
for (const
|
|
2726
|
-
|
|
2727
|
-
key:
|
|
2728
|
-
value:
|
|
2729
|
-
alwaysSet:
|
|
2100
|
+
}), y;
|
|
2101
|
+
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2102
|
+
for (const o in n.data)
|
|
2103
|
+
s.push({
|
|
2104
|
+
key: a._parse(new U(n, o, n.path, o)),
|
|
2105
|
+
value: i._parse(new U(n, n.data[o], n.path, o)),
|
|
2106
|
+
alwaysSet: o in n.data
|
|
2730
2107
|
});
|
|
2731
|
-
return n.common.async ?
|
|
2108
|
+
return n.common.async ? E.mergeObjectAsync(t, s) : E.mergeObjectSync(t, s);
|
|
2732
2109
|
}
|
|
2733
2110
|
get element() {
|
|
2734
2111
|
return this._def.valueType;
|
|
2735
2112
|
}
|
|
2736
2113
|
static create(e, t, n) {
|
|
2737
|
-
return t instanceof
|
|
2114
|
+
return t instanceof g ? new Te({
|
|
2738
2115
|
keyType: e,
|
|
2739
2116
|
valueType: t,
|
|
2740
|
-
typeName:
|
|
2741
|
-
...
|
|
2742
|
-
}) : new
|
|
2743
|
-
keyType:
|
|
2117
|
+
typeName: p.ZodRecord,
|
|
2118
|
+
...v(n)
|
|
2119
|
+
}) : new Te({
|
|
2120
|
+
keyType: j.create(),
|
|
2744
2121
|
valueType: e,
|
|
2745
|
-
typeName:
|
|
2746
|
-
...
|
|
2122
|
+
typeName: p.ZodRecord,
|
|
2123
|
+
...v(t)
|
|
2747
2124
|
});
|
|
2748
2125
|
}
|
|
2749
2126
|
}
|
|
2750
|
-
class
|
|
2127
|
+
class ze extends g {
|
|
2751
2128
|
get keySchema() {
|
|
2752
2129
|
return this._def.keyType;
|
|
2753
2130
|
}
|
|
@@ -2756,93 +2133,93 @@ class jt extends k {
|
|
|
2756
2133
|
}
|
|
2757
2134
|
_parse(e) {
|
|
2758
2135
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2759
|
-
if (n.parsedType !==
|
|
2760
|
-
return
|
|
2761
|
-
code:
|
|
2762
|
-
expected:
|
|
2136
|
+
if (n.parsedType !== f.map)
|
|
2137
|
+
return l(n, {
|
|
2138
|
+
code: c.invalid_type,
|
|
2139
|
+
expected: f.map,
|
|
2763
2140
|
received: n.parsedType
|
|
2764
|
-
}),
|
|
2765
|
-
const
|
|
2766
|
-
key:
|
|
2767
|
-
value:
|
|
2141
|
+
}), y;
|
|
2142
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], d) => ({
|
|
2143
|
+
key: s._parse(new U(n, o, n.path, [d, "key"])),
|
|
2144
|
+
value: a._parse(new U(n, u, n.path, [d, "value"]))
|
|
2768
2145
|
}));
|
|
2769
2146
|
if (n.common.async) {
|
|
2770
|
-
const
|
|
2147
|
+
const o = /* @__PURE__ */ new Map();
|
|
2771
2148
|
return Promise.resolve().then(async () => {
|
|
2772
|
-
for (const
|
|
2773
|
-
const
|
|
2774
|
-
if (
|
|
2775
|
-
return
|
|
2776
|
-
(
|
|
2149
|
+
for (const u of i) {
|
|
2150
|
+
const d = await u.key, m = await u.value;
|
|
2151
|
+
if (d.status === "aborted" || m.status === "aborted")
|
|
2152
|
+
return y;
|
|
2153
|
+
(d.status === "dirty" || m.status === "dirty") && t.dirty(), o.set(d.value, m.value);
|
|
2777
2154
|
}
|
|
2778
|
-
return { status: t.value, value:
|
|
2155
|
+
return { status: t.value, value: o };
|
|
2779
2156
|
});
|
|
2780
2157
|
} else {
|
|
2781
|
-
const
|
|
2782
|
-
for (const
|
|
2783
|
-
const
|
|
2784
|
-
if (
|
|
2785
|
-
return
|
|
2786
|
-
(
|
|
2158
|
+
const o = /* @__PURE__ */ new Map();
|
|
2159
|
+
for (const u of i) {
|
|
2160
|
+
const d = u.key, m = u.value;
|
|
2161
|
+
if (d.status === "aborted" || m.status === "aborted")
|
|
2162
|
+
return y;
|
|
2163
|
+
(d.status === "dirty" || m.status === "dirty") && t.dirty(), o.set(d.value, m.value);
|
|
2787
2164
|
}
|
|
2788
|
-
return { status: t.value, value:
|
|
2165
|
+
return { status: t.value, value: o };
|
|
2789
2166
|
}
|
|
2790
2167
|
}
|
|
2791
2168
|
}
|
|
2792
|
-
|
|
2169
|
+
ze.create = (r, e, t) => new ze({
|
|
2793
2170
|
valueType: e,
|
|
2794
2171
|
keyType: r,
|
|
2795
|
-
typeName:
|
|
2796
|
-
...
|
|
2172
|
+
typeName: p.ZodMap,
|
|
2173
|
+
...v(t)
|
|
2797
2174
|
});
|
|
2798
|
-
class
|
|
2175
|
+
class ee extends g {
|
|
2799
2176
|
_parse(e) {
|
|
2800
2177
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2801
|
-
if (n.parsedType !==
|
|
2802
|
-
return
|
|
2803
|
-
code:
|
|
2804
|
-
expected:
|
|
2178
|
+
if (n.parsedType !== f.set)
|
|
2179
|
+
return l(n, {
|
|
2180
|
+
code: c.invalid_type,
|
|
2181
|
+
expected: f.set,
|
|
2805
2182
|
received: n.parsedType
|
|
2806
|
-
}),
|
|
2807
|
-
const
|
|
2808
|
-
|
|
2809
|
-
code:
|
|
2810
|
-
minimum:
|
|
2183
|
+
}), y;
|
|
2184
|
+
const s = this._def;
|
|
2185
|
+
s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
|
|
2186
|
+
code: c.too_small,
|
|
2187
|
+
minimum: s.minSize.value,
|
|
2811
2188
|
type: "set",
|
|
2812
2189
|
inclusive: !0,
|
|
2813
2190
|
exact: !1,
|
|
2814
|
-
message:
|
|
2815
|
-
}), t.dirty()),
|
|
2816
|
-
code:
|
|
2817
|
-
maximum:
|
|
2191
|
+
message: s.minSize.message
|
|
2192
|
+
}), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (l(n, {
|
|
2193
|
+
code: c.too_big,
|
|
2194
|
+
maximum: s.maxSize.value,
|
|
2818
2195
|
type: "set",
|
|
2819
2196
|
inclusive: !0,
|
|
2820
2197
|
exact: !1,
|
|
2821
|
-
message:
|
|
2198
|
+
message: s.maxSize.message
|
|
2822
2199
|
}), t.dirty());
|
|
2823
|
-
const
|
|
2824
|
-
function
|
|
2825
|
-
const
|
|
2826
|
-
for (const
|
|
2827
|
-
if (
|
|
2828
|
-
return
|
|
2829
|
-
|
|
2200
|
+
const a = this._def.valueType;
|
|
2201
|
+
function i(u) {
|
|
2202
|
+
const d = /* @__PURE__ */ new Set();
|
|
2203
|
+
for (const m of u) {
|
|
2204
|
+
if (m.status === "aborted")
|
|
2205
|
+
return y;
|
|
2206
|
+
m.status === "dirty" && t.dirty(), d.add(m.value);
|
|
2830
2207
|
}
|
|
2831
|
-
return { status: t.value, value:
|
|
2208
|
+
return { status: t.value, value: d };
|
|
2832
2209
|
}
|
|
2833
|
-
const
|
|
2834
|
-
return n.common.async ? Promise.all(
|
|
2210
|
+
const o = [...n.data.values()].map((u, d) => a._parse(new U(n, u, n.path, d)));
|
|
2211
|
+
return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2835
2212
|
}
|
|
2836
2213
|
min(e, t) {
|
|
2837
|
-
return new
|
|
2214
|
+
return new ee({
|
|
2838
2215
|
...this._def,
|
|
2839
|
-
minSize: { value: e, message:
|
|
2216
|
+
minSize: { value: e, message: h.toString(t) }
|
|
2840
2217
|
});
|
|
2841
2218
|
}
|
|
2842
2219
|
max(e, t) {
|
|
2843
|
-
return new
|
|
2220
|
+
return new ee({
|
|
2844
2221
|
...this._def,
|
|
2845
|
-
maxSize: { value: e, message:
|
|
2222
|
+
maxSize: { value: e, message: h.toString(t) }
|
|
2846
2223
|
});
|
|
2847
2224
|
}
|
|
2848
2225
|
size(e, t) {
|
|
@@ -2852,78 +2229,78 @@ class Ne extends k {
|
|
|
2852
2229
|
return this.min(1, e);
|
|
2853
2230
|
}
|
|
2854
2231
|
}
|
|
2855
|
-
|
|
2232
|
+
ee.create = (r, e) => new ee({
|
|
2856
2233
|
valueType: r,
|
|
2857
2234
|
minSize: null,
|
|
2858
2235
|
maxSize: null,
|
|
2859
|
-
typeName:
|
|
2860
|
-
...
|
|
2236
|
+
typeName: p.ZodSet,
|
|
2237
|
+
...v(e)
|
|
2861
2238
|
});
|
|
2862
|
-
class
|
|
2239
|
+
class de extends g {
|
|
2863
2240
|
constructor() {
|
|
2864
2241
|
super(...arguments), this.validate = this.implement;
|
|
2865
2242
|
}
|
|
2866
2243
|
_parse(e) {
|
|
2867
2244
|
const { ctx: t } = this._processInputParams(e);
|
|
2868
|
-
if (t.parsedType !==
|
|
2869
|
-
return
|
|
2870
|
-
code:
|
|
2871
|
-
expected:
|
|
2245
|
+
if (t.parsedType !== f.function)
|
|
2246
|
+
return l(t, {
|
|
2247
|
+
code: c.invalid_type,
|
|
2248
|
+
expected: f.function,
|
|
2872
2249
|
received: t.parsedType
|
|
2873
|
-
}),
|
|
2874
|
-
function n(
|
|
2875
|
-
return
|
|
2876
|
-
data:
|
|
2250
|
+
}), y;
|
|
2251
|
+
function n(o, u) {
|
|
2252
|
+
return Ue({
|
|
2253
|
+
data: o,
|
|
2877
2254
|
path: t.path,
|
|
2878
2255
|
errorMaps: [
|
|
2879
2256
|
t.common.contextualErrorMap,
|
|
2880
2257
|
t.schemaErrorMap,
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
].filter((
|
|
2258
|
+
Me(),
|
|
2259
|
+
ue
|
|
2260
|
+
].filter((d) => !!d),
|
|
2884
2261
|
issueData: {
|
|
2885
|
-
code:
|
|
2886
|
-
argumentsError:
|
|
2262
|
+
code: c.invalid_arguments,
|
|
2263
|
+
argumentsError: u
|
|
2887
2264
|
}
|
|
2888
2265
|
});
|
|
2889
2266
|
}
|
|
2890
|
-
function
|
|
2891
|
-
return
|
|
2892
|
-
data:
|
|
2267
|
+
function s(o, u) {
|
|
2268
|
+
return Ue({
|
|
2269
|
+
data: o,
|
|
2893
2270
|
path: t.path,
|
|
2894
2271
|
errorMaps: [
|
|
2895
2272
|
t.common.contextualErrorMap,
|
|
2896
2273
|
t.schemaErrorMap,
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
].filter((
|
|
2274
|
+
Me(),
|
|
2275
|
+
ue
|
|
2276
|
+
].filter((d) => !!d),
|
|
2900
2277
|
issueData: {
|
|
2901
|
-
code:
|
|
2902
|
-
returnTypeError:
|
|
2278
|
+
code: c.invalid_return_type,
|
|
2279
|
+
returnTypeError: u
|
|
2903
2280
|
}
|
|
2904
2281
|
});
|
|
2905
2282
|
}
|
|
2906
|
-
const
|
|
2907
|
-
if (this._def.returns instanceof
|
|
2908
|
-
const
|
|
2909
|
-
return
|
|
2910
|
-
const
|
|
2911
|
-
throw
|
|
2912
|
-
}),
|
|
2913
|
-
return await
|
|
2914
|
-
throw
|
|
2283
|
+
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2284
|
+
if (this._def.returns instanceof fe) {
|
|
2285
|
+
const o = this;
|
|
2286
|
+
return S(async function(...u) {
|
|
2287
|
+
const d = new I([]), m = await o._def.args.parseAsync(u, a).catch((G) => {
|
|
2288
|
+
throw d.addIssue(n(u, G)), d;
|
|
2289
|
+
}), T = await Reflect.apply(i, this, m);
|
|
2290
|
+
return await o._def.returns._def.type.parseAsync(T, a).catch((G) => {
|
|
2291
|
+
throw d.addIssue(s(T, G)), d;
|
|
2915
2292
|
});
|
|
2916
2293
|
});
|
|
2917
2294
|
} else {
|
|
2918
|
-
const
|
|
2919
|
-
return
|
|
2920
|
-
const
|
|
2921
|
-
if (!
|
|
2922
|
-
throw new
|
|
2923
|
-
const
|
|
2924
|
-
if (!
|
|
2925
|
-
throw new
|
|
2926
|
-
return
|
|
2295
|
+
const o = this;
|
|
2296
|
+
return S(function(...u) {
|
|
2297
|
+
const d = o._def.args.safeParse(u, a);
|
|
2298
|
+
if (!d.success)
|
|
2299
|
+
throw new I([n(u, d.error)]);
|
|
2300
|
+
const m = Reflect.apply(i, this, d.data), T = o._def.returns.safeParse(m, a);
|
|
2301
|
+
if (!T.success)
|
|
2302
|
+
throw new I([s(m, T.error)]);
|
|
2303
|
+
return T.data;
|
|
2927
2304
|
});
|
|
2928
2305
|
}
|
|
2929
2306
|
}
|
|
@@ -2934,13 +2311,13 @@ class Ve extends k {
|
|
|
2934
2311
|
return this._def.returns;
|
|
2935
2312
|
}
|
|
2936
2313
|
args(...e) {
|
|
2937
|
-
return new
|
|
2314
|
+
return new de({
|
|
2938
2315
|
...this._def,
|
|
2939
|
-
args:
|
|
2316
|
+
args: L.create(e).rest(X.create())
|
|
2940
2317
|
});
|
|
2941
2318
|
}
|
|
2942
2319
|
returns(e) {
|
|
2943
|
-
return new
|
|
2320
|
+
return new de({
|
|
2944
2321
|
...this._def,
|
|
2945
2322
|
returns: e
|
|
2946
2323
|
});
|
|
@@ -2952,15 +2329,15 @@ class Ve extends k {
|
|
|
2952
2329
|
return this.parse(e);
|
|
2953
2330
|
}
|
|
2954
2331
|
static create(e, t, n) {
|
|
2955
|
-
return new
|
|
2956
|
-
args: e ||
|
|
2957
|
-
returns: t ||
|
|
2958
|
-
typeName:
|
|
2959
|
-
...
|
|
2332
|
+
return new de({
|
|
2333
|
+
args: e || L.create([]).rest(X.create()),
|
|
2334
|
+
returns: t || X.create(),
|
|
2335
|
+
typeName: p.ZodFunction,
|
|
2336
|
+
...v(n)
|
|
2960
2337
|
});
|
|
2961
2338
|
}
|
|
2962
2339
|
}
|
|
2963
|
-
class
|
|
2340
|
+
class we extends g {
|
|
2964
2341
|
get schema() {
|
|
2965
2342
|
return this._def.getter();
|
|
2966
2343
|
}
|
|
@@ -2969,20 +2346,20 @@ class st extends k {
|
|
|
2969
2346
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2970
2347
|
}
|
|
2971
2348
|
}
|
|
2972
|
-
|
|
2349
|
+
we.create = (r, e) => new we({
|
|
2973
2350
|
getter: r,
|
|
2974
|
-
typeName:
|
|
2975
|
-
...
|
|
2351
|
+
typeName: p.ZodLazy,
|
|
2352
|
+
...v(e)
|
|
2976
2353
|
});
|
|
2977
|
-
class
|
|
2354
|
+
class Ee extends g {
|
|
2978
2355
|
_parse(e) {
|
|
2979
2356
|
if (e.data !== this._def.value) {
|
|
2980
2357
|
const t = this._getOrReturnCtx(e);
|
|
2981
|
-
return
|
|
2358
|
+
return l(t, {
|
|
2982
2359
|
received: t.data,
|
|
2983
|
-
code:
|
|
2360
|
+
code: c.invalid_literal,
|
|
2984
2361
|
expected: this._def.value
|
|
2985
|
-
}),
|
|
2362
|
+
}), y;
|
|
2986
2363
|
}
|
|
2987
2364
|
return { status: "valid", value: e.data };
|
|
2988
2365
|
}
|
|
@@ -2990,40 +2367,40 @@ class it extends k {
|
|
|
2990
2367
|
return this._def.value;
|
|
2991
2368
|
}
|
|
2992
2369
|
}
|
|
2993
|
-
|
|
2370
|
+
Ee.create = (r, e) => new Ee({
|
|
2994
2371
|
value: r,
|
|
2995
|
-
typeName:
|
|
2996
|
-
...
|
|
2372
|
+
typeName: p.ZodLiteral,
|
|
2373
|
+
...v(e)
|
|
2997
2374
|
});
|
|
2998
|
-
function
|
|
2999
|
-
return new
|
|
2375
|
+
function St(r, e) {
|
|
2376
|
+
return new Y({
|
|
3000
2377
|
values: r,
|
|
3001
|
-
typeName:
|
|
3002
|
-
...
|
|
2378
|
+
typeName: p.ZodEnum,
|
|
2379
|
+
...v(e)
|
|
3003
2380
|
});
|
|
3004
2381
|
}
|
|
3005
|
-
class
|
|
2382
|
+
class Y extends g {
|
|
3006
2383
|
constructor() {
|
|
3007
|
-
super(...arguments),
|
|
2384
|
+
super(...arguments), me.set(this, void 0);
|
|
3008
2385
|
}
|
|
3009
2386
|
_parse(e) {
|
|
3010
2387
|
if (typeof e.data != "string") {
|
|
3011
2388
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
3012
|
-
return
|
|
3013
|
-
expected:
|
|
2389
|
+
return l(t, {
|
|
2390
|
+
expected: _.joinValues(n),
|
|
3014
2391
|
received: t.parsedType,
|
|
3015
|
-
code:
|
|
3016
|
-
}),
|
|
2392
|
+
code: c.invalid_type
|
|
2393
|
+
}), y;
|
|
3017
2394
|
}
|
|
3018
|
-
if (
|
|
2395
|
+
if (Le(this, me) || Tt(this, me, new Set(this._def.values)), !Le(this, me).has(e.data)) {
|
|
3019
2396
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
3020
|
-
return
|
|
2397
|
+
return l(t, {
|
|
3021
2398
|
received: t.data,
|
|
3022
|
-
code:
|
|
2399
|
+
code: c.invalid_enum_value,
|
|
3023
2400
|
options: n
|
|
3024
|
-
}),
|
|
2401
|
+
}), y;
|
|
3025
2402
|
}
|
|
3026
|
-
return
|
|
2403
|
+
return S(e.data);
|
|
3027
2404
|
}
|
|
3028
2405
|
get options() {
|
|
3029
2406
|
return this._def.values;
|
|
@@ -3047,198 +2424,198 @@ class ke extends k {
|
|
|
3047
2424
|
return e;
|
|
3048
2425
|
}
|
|
3049
2426
|
extract(e, t = this._def) {
|
|
3050
|
-
return
|
|
2427
|
+
return Y.create(e, {
|
|
3051
2428
|
...this._def,
|
|
3052
2429
|
...t
|
|
3053
2430
|
});
|
|
3054
2431
|
}
|
|
3055
2432
|
exclude(e, t = this._def) {
|
|
3056
|
-
return
|
|
2433
|
+
return Y.create(this.options.filter((n) => !e.includes(n)), {
|
|
3057
2434
|
...this._def,
|
|
3058
2435
|
...t
|
|
3059
2436
|
});
|
|
3060
2437
|
}
|
|
3061
2438
|
}
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
class
|
|
2439
|
+
me = /* @__PURE__ */ new WeakMap();
|
|
2440
|
+
Y.create = St;
|
|
2441
|
+
class Ce extends g {
|
|
3065
2442
|
constructor() {
|
|
3066
|
-
super(...arguments),
|
|
2443
|
+
super(...arguments), pe.set(this, void 0);
|
|
3067
2444
|
}
|
|
3068
2445
|
_parse(e) {
|
|
3069
|
-
const t =
|
|
3070
|
-
if (n.parsedType !==
|
|
3071
|
-
const
|
|
3072
|
-
return
|
|
3073
|
-
expected:
|
|
2446
|
+
const t = _.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2447
|
+
if (n.parsedType !== f.string && n.parsedType !== f.number) {
|
|
2448
|
+
const s = _.objectValues(t);
|
|
2449
|
+
return l(n, {
|
|
2450
|
+
expected: _.joinValues(s),
|
|
3074
2451
|
received: n.parsedType,
|
|
3075
|
-
code:
|
|
3076
|
-
}),
|
|
2452
|
+
code: c.invalid_type
|
|
2453
|
+
}), y;
|
|
3077
2454
|
}
|
|
3078
|
-
if (
|
|
3079
|
-
const
|
|
3080
|
-
return
|
|
2455
|
+
if (Le(this, pe) || Tt(this, pe, new Set(_.getValidEnumValues(this._def.values))), !Le(this, pe).has(e.data)) {
|
|
2456
|
+
const s = _.objectValues(t);
|
|
2457
|
+
return l(n, {
|
|
3081
2458
|
received: n.data,
|
|
3082
|
-
code:
|
|
3083
|
-
options:
|
|
3084
|
-
}),
|
|
2459
|
+
code: c.invalid_enum_value,
|
|
2460
|
+
options: s
|
|
2461
|
+
}), y;
|
|
3085
2462
|
}
|
|
3086
|
-
return
|
|
2463
|
+
return S(e.data);
|
|
3087
2464
|
}
|
|
3088
2465
|
get enum() {
|
|
3089
2466
|
return this._def.values;
|
|
3090
2467
|
}
|
|
3091
2468
|
}
|
|
3092
|
-
|
|
3093
|
-
|
|
2469
|
+
pe = /* @__PURE__ */ new WeakMap();
|
|
2470
|
+
Ce.create = (r, e) => new Ce({
|
|
3094
2471
|
values: r,
|
|
3095
|
-
typeName:
|
|
3096
|
-
...
|
|
2472
|
+
typeName: p.ZodNativeEnum,
|
|
2473
|
+
...v(e)
|
|
3097
2474
|
});
|
|
3098
|
-
class
|
|
2475
|
+
class fe extends g {
|
|
3099
2476
|
unwrap() {
|
|
3100
2477
|
return this._def.type;
|
|
3101
2478
|
}
|
|
3102
2479
|
_parse(e) {
|
|
3103
2480
|
const { ctx: t } = this._processInputParams(e);
|
|
3104
|
-
if (t.parsedType !==
|
|
3105
|
-
return
|
|
3106
|
-
code:
|
|
3107
|
-
expected:
|
|
2481
|
+
if (t.parsedType !== f.promise && t.common.async === !1)
|
|
2482
|
+
return l(t, {
|
|
2483
|
+
code: c.invalid_type,
|
|
2484
|
+
expected: f.promise,
|
|
3108
2485
|
received: t.parsedType
|
|
3109
|
-
}),
|
|
3110
|
-
const n = t.parsedType ===
|
|
3111
|
-
return
|
|
2486
|
+
}), y;
|
|
2487
|
+
const n = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
|
|
2488
|
+
return S(n.then((s) => this._def.type.parseAsync(s, {
|
|
3112
2489
|
path: t.path,
|
|
3113
2490
|
errorMap: t.common.contextualErrorMap
|
|
3114
2491
|
})));
|
|
3115
2492
|
}
|
|
3116
2493
|
}
|
|
3117
|
-
|
|
2494
|
+
fe.create = (r, e) => new fe({
|
|
3118
2495
|
type: r,
|
|
3119
|
-
typeName:
|
|
3120
|
-
...
|
|
2496
|
+
typeName: p.ZodPromise,
|
|
2497
|
+
...v(e)
|
|
3121
2498
|
});
|
|
3122
|
-
class
|
|
2499
|
+
class D extends g {
|
|
3123
2500
|
innerType() {
|
|
3124
2501
|
return this._def.schema;
|
|
3125
2502
|
}
|
|
3126
2503
|
sourceType() {
|
|
3127
|
-
return this._def.schema._def.typeName ===
|
|
2504
|
+
return this._def.schema._def.typeName === p.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
3128
2505
|
}
|
|
3129
2506
|
_parse(e) {
|
|
3130
|
-
const { status: t, ctx: n } = this._processInputParams(e),
|
|
3131
|
-
addIssue: (
|
|
3132
|
-
|
|
2507
|
+
const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
2508
|
+
addIssue: (i) => {
|
|
2509
|
+
l(n, i), i.fatal ? t.abort() : t.dirty();
|
|
3133
2510
|
},
|
|
3134
2511
|
get path() {
|
|
3135
2512
|
return n.path;
|
|
3136
2513
|
}
|
|
3137
2514
|
};
|
|
3138
|
-
if (
|
|
3139
|
-
const
|
|
2515
|
+
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
2516
|
+
const i = s.transform(n.data, a);
|
|
3140
2517
|
if (n.common.async)
|
|
3141
|
-
return Promise.resolve(
|
|
2518
|
+
return Promise.resolve(i).then(async (o) => {
|
|
3142
2519
|
if (t.value === "aborted")
|
|
3143
|
-
return
|
|
3144
|
-
const
|
|
3145
|
-
data:
|
|
2520
|
+
return y;
|
|
2521
|
+
const u = await this._def.schema._parseAsync({
|
|
2522
|
+
data: o,
|
|
3146
2523
|
path: n.path,
|
|
3147
2524
|
parent: n
|
|
3148
2525
|
});
|
|
3149
|
-
return
|
|
2526
|
+
return u.status === "aborted" ? y : u.status === "dirty" || t.value === "dirty" ? ce(u.value) : u;
|
|
3150
2527
|
});
|
|
3151
2528
|
{
|
|
3152
2529
|
if (t.value === "aborted")
|
|
3153
|
-
return
|
|
3154
|
-
const
|
|
3155
|
-
data:
|
|
2530
|
+
return y;
|
|
2531
|
+
const o = this._def.schema._parseSync({
|
|
2532
|
+
data: i,
|
|
3156
2533
|
path: n.path,
|
|
3157
2534
|
parent: n
|
|
3158
2535
|
});
|
|
3159
|
-
return
|
|
2536
|
+
return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? ce(o.value) : o;
|
|
3160
2537
|
}
|
|
3161
2538
|
}
|
|
3162
|
-
if (
|
|
3163
|
-
const
|
|
3164
|
-
const
|
|
2539
|
+
if (s.type === "refinement") {
|
|
2540
|
+
const i = (o) => {
|
|
2541
|
+
const u = s.refinement(o, a);
|
|
3165
2542
|
if (n.common.async)
|
|
3166
|
-
return Promise.resolve(
|
|
3167
|
-
if (
|
|
2543
|
+
return Promise.resolve(u);
|
|
2544
|
+
if (u instanceof Promise)
|
|
3168
2545
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3169
|
-
return
|
|
2546
|
+
return o;
|
|
3170
2547
|
};
|
|
3171
2548
|
if (n.common.async === !1) {
|
|
3172
|
-
const
|
|
2549
|
+
const o = this._def.schema._parseSync({
|
|
3173
2550
|
data: n.data,
|
|
3174
2551
|
path: n.path,
|
|
3175
2552
|
parent: n
|
|
3176
2553
|
});
|
|
3177
|
-
return
|
|
2554
|
+
return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
3178
2555
|
} else
|
|
3179
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
2556
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
3180
2557
|
}
|
|
3181
|
-
if (
|
|
2558
|
+
if (s.type === "transform")
|
|
3182
2559
|
if (n.common.async === !1) {
|
|
3183
|
-
const
|
|
2560
|
+
const i = this._def.schema._parseSync({
|
|
3184
2561
|
data: n.data,
|
|
3185
2562
|
path: n.path,
|
|
3186
2563
|
parent: n
|
|
3187
2564
|
});
|
|
3188
|
-
if (!
|
|
3189
|
-
return
|
|
3190
|
-
const
|
|
3191
|
-
if (
|
|
2565
|
+
if (!ye(i))
|
|
2566
|
+
return i;
|
|
2567
|
+
const o = s.transform(i.value, a);
|
|
2568
|
+
if (o instanceof Promise)
|
|
3192
2569
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3193
|
-
return { status: t.value, value:
|
|
2570
|
+
return { status: t.value, value: o };
|
|
3194
2571
|
} else
|
|
3195
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
3196
|
-
|
|
2572
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => ye(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
|
|
2573
|
+
_.assertNever(s);
|
|
3197
2574
|
}
|
|
3198
2575
|
}
|
|
3199
|
-
|
|
2576
|
+
D.create = (r, e, t) => new D({
|
|
3200
2577
|
schema: r,
|
|
3201
|
-
typeName:
|
|
2578
|
+
typeName: p.ZodEffects,
|
|
3202
2579
|
effect: e,
|
|
3203
|
-
...
|
|
2580
|
+
...v(t)
|
|
3204
2581
|
});
|
|
3205
|
-
|
|
2582
|
+
D.createWithPreprocess = (r, e, t) => new D({
|
|
3206
2583
|
schema: e,
|
|
3207
2584
|
effect: { type: "preprocess", transform: r },
|
|
3208
|
-
typeName:
|
|
3209
|
-
...
|
|
2585
|
+
typeName: p.ZodEffects,
|
|
2586
|
+
...v(t)
|
|
3210
2587
|
});
|
|
3211
|
-
class
|
|
2588
|
+
class M extends g {
|
|
3212
2589
|
_parse(e) {
|
|
3213
|
-
return this._getType(e) ===
|
|
2590
|
+
return this._getType(e) === f.undefined ? S(void 0) : this._def.innerType._parse(e);
|
|
3214
2591
|
}
|
|
3215
2592
|
unwrap() {
|
|
3216
2593
|
return this._def.innerType;
|
|
3217
2594
|
}
|
|
3218
2595
|
}
|
|
3219
|
-
|
|
2596
|
+
M.create = (r, e) => new M({
|
|
3220
2597
|
innerType: r,
|
|
3221
|
-
typeName:
|
|
3222
|
-
...
|
|
2598
|
+
typeName: p.ZodOptional,
|
|
2599
|
+
...v(e)
|
|
3223
2600
|
});
|
|
3224
|
-
class
|
|
2601
|
+
class J extends g {
|
|
3225
2602
|
_parse(e) {
|
|
3226
|
-
return this._getType(e) ===
|
|
2603
|
+
return this._getType(e) === f.null ? S(null) : this._def.innerType._parse(e);
|
|
3227
2604
|
}
|
|
3228
2605
|
unwrap() {
|
|
3229
2606
|
return this._def.innerType;
|
|
3230
2607
|
}
|
|
3231
2608
|
}
|
|
3232
|
-
|
|
2609
|
+
J.create = (r, e) => new J({
|
|
3233
2610
|
innerType: r,
|
|
3234
|
-
typeName:
|
|
3235
|
-
...
|
|
2611
|
+
typeName: p.ZodNullable,
|
|
2612
|
+
...v(e)
|
|
3236
2613
|
});
|
|
3237
|
-
class
|
|
2614
|
+
class Se extends g {
|
|
3238
2615
|
_parse(e) {
|
|
3239
2616
|
const { ctx: t } = this._processInputParams(e);
|
|
3240
2617
|
let n = t.data;
|
|
3241
|
-
return t.parsedType ===
|
|
2618
|
+
return t.parsedType === f.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
3242
2619
|
data: n,
|
|
3243
2620
|
path: t.path,
|
|
3244
2621
|
parent: t
|
|
@@ -3248,13 +2625,13 @@ class ct extends k {
|
|
|
3248
2625
|
return this._def.innerType;
|
|
3249
2626
|
}
|
|
3250
2627
|
}
|
|
3251
|
-
|
|
2628
|
+
Se.create = (r, e) => new Se({
|
|
3252
2629
|
innerType: r,
|
|
3253
|
-
typeName:
|
|
2630
|
+
typeName: p.ZodDefault,
|
|
3254
2631
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
3255
|
-
...
|
|
2632
|
+
...v(e)
|
|
3256
2633
|
});
|
|
3257
|
-
class
|
|
2634
|
+
class Oe extends g {
|
|
3258
2635
|
_parse(e) {
|
|
3259
2636
|
const { ctx: t } = this._processInputParams(e), n = {
|
|
3260
2637
|
...t,
|
|
@@ -3262,26 +2639,26 @@ class ut extends k {
|
|
|
3262
2639
|
...t.common,
|
|
3263
2640
|
issues: []
|
|
3264
2641
|
}
|
|
3265
|
-
},
|
|
2642
|
+
}, s = this._def.innerType._parse({
|
|
3266
2643
|
data: n.data,
|
|
3267
2644
|
path: n.path,
|
|
3268
2645
|
parent: {
|
|
3269
2646
|
...n
|
|
3270
2647
|
}
|
|
3271
2648
|
});
|
|
3272
|
-
return
|
|
2649
|
+
return ve(s) ? s.then((a) => ({
|
|
3273
2650
|
status: "valid",
|
|
3274
|
-
value:
|
|
2651
|
+
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3275
2652
|
get error() {
|
|
3276
|
-
return new
|
|
2653
|
+
return new I(n.common.issues);
|
|
3277
2654
|
},
|
|
3278
2655
|
input: n.data
|
|
3279
2656
|
})
|
|
3280
2657
|
})) : {
|
|
3281
2658
|
status: "valid",
|
|
3282
|
-
value:
|
|
2659
|
+
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
3283
2660
|
get error() {
|
|
3284
|
-
return new
|
|
2661
|
+
return new I(n.common.issues);
|
|
3285
2662
|
},
|
|
3286
2663
|
input: n.data
|
|
3287
2664
|
})
|
|
@@ -3291,31 +2668,31 @@ class ut extends k {
|
|
|
3291
2668
|
return this._def.innerType;
|
|
3292
2669
|
}
|
|
3293
2670
|
}
|
|
3294
|
-
|
|
2671
|
+
Oe.create = (r, e) => new Oe({
|
|
3295
2672
|
innerType: r,
|
|
3296
|
-
typeName:
|
|
2673
|
+
typeName: p.ZodCatch,
|
|
3297
2674
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
3298
|
-
...
|
|
2675
|
+
...v(e)
|
|
3299
2676
|
});
|
|
3300
|
-
class
|
|
2677
|
+
class Be extends g {
|
|
3301
2678
|
_parse(e) {
|
|
3302
|
-
if (this._getType(e) !==
|
|
2679
|
+
if (this._getType(e) !== f.nan) {
|
|
3303
2680
|
const n = this._getOrReturnCtx(e);
|
|
3304
|
-
return
|
|
3305
|
-
code:
|
|
3306
|
-
expected:
|
|
2681
|
+
return l(n, {
|
|
2682
|
+
code: c.invalid_type,
|
|
2683
|
+
expected: f.nan,
|
|
3307
2684
|
received: n.parsedType
|
|
3308
|
-
}),
|
|
2685
|
+
}), y;
|
|
3309
2686
|
}
|
|
3310
2687
|
return { status: "valid", value: e.data };
|
|
3311
2688
|
}
|
|
3312
2689
|
}
|
|
3313
|
-
|
|
3314
|
-
typeName:
|
|
3315
|
-
...
|
|
2690
|
+
Be.create = (r) => new Be({
|
|
2691
|
+
typeName: p.ZodNaN,
|
|
2692
|
+
...v(r)
|
|
3316
2693
|
});
|
|
3317
|
-
const
|
|
3318
|
-
class
|
|
2694
|
+
const xr = Symbol("zod_brand");
|
|
2695
|
+
class at extends g {
|
|
3319
2696
|
_parse(e) {
|
|
3320
2697
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
3321
2698
|
return this._def.type._parse({
|
|
@@ -3328,219 +2705,219 @@ class Xt extends k {
|
|
|
3328
2705
|
return this._def.type;
|
|
3329
2706
|
}
|
|
3330
2707
|
}
|
|
3331
|
-
class
|
|
2708
|
+
class Ie extends g {
|
|
3332
2709
|
_parse(e) {
|
|
3333
2710
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
3334
2711
|
if (n.common.async)
|
|
3335
2712
|
return (async () => {
|
|
3336
|
-
const
|
|
2713
|
+
const a = await this._def.in._parseAsync({
|
|
3337
2714
|
data: n.data,
|
|
3338
2715
|
path: n.path,
|
|
3339
2716
|
parent: n
|
|
3340
2717
|
});
|
|
3341
|
-
return
|
|
3342
|
-
data:
|
|
2718
|
+
return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), ce(a.value)) : this._def.out._parseAsync({
|
|
2719
|
+
data: a.value,
|
|
3343
2720
|
path: n.path,
|
|
3344
2721
|
parent: n
|
|
3345
2722
|
});
|
|
3346
2723
|
})();
|
|
3347
2724
|
{
|
|
3348
|
-
const
|
|
2725
|
+
const s = this._def.in._parseSync({
|
|
3349
2726
|
data: n.data,
|
|
3350
2727
|
path: n.path,
|
|
3351
2728
|
parent: n
|
|
3352
2729
|
});
|
|
3353
|
-
return
|
|
2730
|
+
return s.status === "aborted" ? y : s.status === "dirty" ? (t.dirty(), {
|
|
3354
2731
|
status: "dirty",
|
|
3355
|
-
value:
|
|
2732
|
+
value: s.value
|
|
3356
2733
|
}) : this._def.out._parseSync({
|
|
3357
|
-
data:
|
|
2734
|
+
data: s.value,
|
|
3358
2735
|
path: n.path,
|
|
3359
2736
|
parent: n
|
|
3360
2737
|
});
|
|
3361
2738
|
}
|
|
3362
2739
|
}
|
|
3363
2740
|
static create(e, t) {
|
|
3364
|
-
return new
|
|
2741
|
+
return new Ie({
|
|
3365
2742
|
in: e,
|
|
3366
2743
|
out: t,
|
|
3367
|
-
typeName:
|
|
2744
|
+
typeName: p.ZodPipeline
|
|
3368
2745
|
});
|
|
3369
2746
|
}
|
|
3370
2747
|
}
|
|
3371
|
-
class
|
|
2748
|
+
class Re extends g {
|
|
3372
2749
|
_parse(e) {
|
|
3373
|
-
const t = this._def.innerType._parse(e), n = (
|
|
3374
|
-
return
|
|
2750
|
+
const t = this._def.innerType._parse(e), n = (s) => (ye(s) && (s.value = Object.freeze(s.value)), s);
|
|
2751
|
+
return ve(t) ? t.then((s) => n(s)) : n(t);
|
|
3375
2752
|
}
|
|
3376
2753
|
unwrap() {
|
|
3377
2754
|
return this._def.innerType;
|
|
3378
2755
|
}
|
|
3379
2756
|
}
|
|
3380
|
-
|
|
2757
|
+
Re.create = (r, e) => new Re({
|
|
3381
2758
|
innerType: r,
|
|
3382
|
-
typeName:
|
|
3383
|
-
...
|
|
2759
|
+
typeName: p.ZodReadonly,
|
|
2760
|
+
...v(e)
|
|
3384
2761
|
});
|
|
3385
|
-
function
|
|
3386
|
-
return r ?
|
|
3387
|
-
var
|
|
2762
|
+
function Ot(r, e = {}, t) {
|
|
2763
|
+
return r ? le.create().superRefine((n, s) => {
|
|
2764
|
+
var a, i;
|
|
3388
2765
|
if (!r(n)) {
|
|
3389
|
-
const
|
|
3390
|
-
|
|
2766
|
+
const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, u = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, d = typeof o == "string" ? { message: o } : o;
|
|
2767
|
+
s.addIssue({ code: "custom", ...d, fatal: u });
|
|
3391
2768
|
}
|
|
3392
|
-
}) :
|
|
2769
|
+
}) : le.create();
|
|
3393
2770
|
}
|
|
3394
|
-
const
|
|
3395
|
-
object:
|
|
2771
|
+
const kr = {
|
|
2772
|
+
object: k.lazycreate
|
|
3396
2773
|
};
|
|
3397
|
-
var
|
|
2774
|
+
var p;
|
|
3398
2775
|
(function(r) {
|
|
3399
2776
|
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";
|
|
3400
|
-
})(
|
|
3401
|
-
const
|
|
2777
|
+
})(p || (p = {}));
|
|
2778
|
+
const br = (r, e = {
|
|
3402
2779
|
message: `Input not instance of ${r.name}`
|
|
3403
|
-
}) =>
|
|
3404
|
-
string: (r) =>
|
|
3405
|
-
number: (r) =>
|
|
3406
|
-
boolean: (r) =>
|
|
2780
|
+
}) => Ot((t) => t instanceof r, e), Rt = j.create, It = K.create, Tr = Be.create, wr = q.create, Zt = ge.create, Er = Q.create, Cr = $e.create, Sr = _e.create, Or = xe.create, Rr = le.create, Ir = X.create, Zr = V.create, Nr = Ve.create, Ar = P.create, jr = k.create, Pr = k.strictCreate, Dr = ke.create, Mr = He.create, Ur = be.create, Lr = L.create, $r = Te.create, Vr = ze.create, zr = ee.create, Br = de.create, Hr = we.create, Wr = Ee.create, Kr = Y.create, qr = Ce.create, Yr = fe.create, vt = D.create, Jr = M.create, Gr = J.create, Fr = D.createWithPreprocess, Xr = Ie.create, Qr = () => Rt().optional(), en = () => It().optional(), tn = () => Zt().optional(), rn = {
|
|
2781
|
+
string: (r) => j.create({ ...r, coerce: !0 }),
|
|
2782
|
+
number: (r) => K.create({ ...r, coerce: !0 }),
|
|
2783
|
+
boolean: (r) => ge.create({
|
|
3407
2784
|
...r,
|
|
3408
2785
|
coerce: !0
|
|
3409
2786
|
}),
|
|
3410
|
-
bigint: (r) =>
|
|
3411
|
-
date: (r) =>
|
|
3412
|
-
},
|
|
3413
|
-
var
|
|
2787
|
+
bigint: (r) => q.create({ ...r, coerce: !0 }),
|
|
2788
|
+
date: (r) => Q.create({ ...r, coerce: !0 })
|
|
2789
|
+
}, nn = y;
|
|
2790
|
+
var x = /* @__PURE__ */ Object.freeze({
|
|
3414
2791
|
__proto__: null,
|
|
3415
|
-
defaultErrorMap:
|
|
3416
|
-
setErrorMap:
|
|
3417
|
-
getErrorMap:
|
|
3418
|
-
makeIssue:
|
|
3419
|
-
EMPTY_PATH:
|
|
3420
|
-
addIssueToContext:
|
|
3421
|
-
ParseStatus:
|
|
3422
|
-
INVALID:
|
|
3423
|
-
DIRTY:
|
|
3424
|
-
OK:
|
|
3425
|
-
isAborted:
|
|
3426
|
-
isDirty:
|
|
3427
|
-
isValid:
|
|
3428
|
-
isAsync:
|
|
2792
|
+
defaultErrorMap: ue,
|
|
2793
|
+
setErrorMap: nr,
|
|
2794
|
+
getErrorMap: Me,
|
|
2795
|
+
makeIssue: Ue,
|
|
2796
|
+
EMPTY_PATH: sr,
|
|
2797
|
+
addIssueToContext: l,
|
|
2798
|
+
ParseStatus: E,
|
|
2799
|
+
INVALID: y,
|
|
2800
|
+
DIRTY: ce,
|
|
2801
|
+
OK: S,
|
|
2802
|
+
isAborted: tt,
|
|
2803
|
+
isDirty: rt,
|
|
2804
|
+
isValid: ye,
|
|
2805
|
+
isAsync: ve,
|
|
3429
2806
|
get util() {
|
|
3430
|
-
return
|
|
2807
|
+
return _;
|
|
3431
2808
|
},
|
|
3432
2809
|
get objectUtil() {
|
|
3433
|
-
return
|
|
2810
|
+
return et;
|
|
3434
2811
|
},
|
|
3435
|
-
ZodParsedType:
|
|
3436
|
-
getParsedType:
|
|
3437
|
-
ZodType:
|
|
3438
|
-
datetimeRegex:
|
|
3439
|
-
ZodString:
|
|
3440
|
-
ZodNumber:
|
|
3441
|
-
ZodBigInt:
|
|
3442
|
-
ZodBoolean:
|
|
3443
|
-
ZodDate:
|
|
3444
|
-
ZodSymbol:
|
|
3445
|
-
ZodUndefined:
|
|
3446
|
-
ZodNull:
|
|
3447
|
-
ZodAny:
|
|
3448
|
-
ZodUnknown:
|
|
3449
|
-
ZodNever:
|
|
3450
|
-
ZodVoid:
|
|
3451
|
-
ZodArray:
|
|
3452
|
-
ZodObject:
|
|
3453
|
-
ZodUnion:
|
|
3454
|
-
ZodDiscriminatedUnion:
|
|
3455
|
-
ZodIntersection:
|
|
3456
|
-
ZodTuple:
|
|
3457
|
-
ZodRecord:
|
|
3458
|
-
ZodMap:
|
|
3459
|
-
ZodSet:
|
|
3460
|
-
ZodFunction:
|
|
3461
|
-
ZodLazy:
|
|
3462
|
-
ZodLiteral:
|
|
3463
|
-
ZodEnum:
|
|
3464
|
-
ZodNativeEnum:
|
|
3465
|
-
ZodPromise:
|
|
3466
|
-
ZodEffects:
|
|
3467
|
-
ZodTransformer:
|
|
3468
|
-
ZodOptional:
|
|
3469
|
-
ZodNullable:
|
|
3470
|
-
ZodDefault:
|
|
3471
|
-
ZodCatch:
|
|
3472
|
-
ZodNaN:
|
|
3473
|
-
BRAND:
|
|
3474
|
-
ZodBranded:
|
|
3475
|
-
ZodPipeline:
|
|
3476
|
-
ZodReadonly:
|
|
3477
|
-
custom:
|
|
3478
|
-
Schema:
|
|
3479
|
-
ZodSchema:
|
|
3480
|
-
late:
|
|
2812
|
+
ZodParsedType: f,
|
|
2813
|
+
getParsedType: H,
|
|
2814
|
+
ZodType: g,
|
|
2815
|
+
datetimeRegex: Ct,
|
|
2816
|
+
ZodString: j,
|
|
2817
|
+
ZodNumber: K,
|
|
2818
|
+
ZodBigInt: q,
|
|
2819
|
+
ZodBoolean: ge,
|
|
2820
|
+
ZodDate: Q,
|
|
2821
|
+
ZodSymbol: $e,
|
|
2822
|
+
ZodUndefined: _e,
|
|
2823
|
+
ZodNull: xe,
|
|
2824
|
+
ZodAny: le,
|
|
2825
|
+
ZodUnknown: X,
|
|
2826
|
+
ZodNever: V,
|
|
2827
|
+
ZodVoid: Ve,
|
|
2828
|
+
ZodArray: P,
|
|
2829
|
+
ZodObject: k,
|
|
2830
|
+
ZodUnion: ke,
|
|
2831
|
+
ZodDiscriminatedUnion: He,
|
|
2832
|
+
ZodIntersection: be,
|
|
2833
|
+
ZodTuple: L,
|
|
2834
|
+
ZodRecord: Te,
|
|
2835
|
+
ZodMap: ze,
|
|
2836
|
+
ZodSet: ee,
|
|
2837
|
+
ZodFunction: de,
|
|
2838
|
+
ZodLazy: we,
|
|
2839
|
+
ZodLiteral: Ee,
|
|
2840
|
+
ZodEnum: Y,
|
|
2841
|
+
ZodNativeEnum: Ce,
|
|
2842
|
+
ZodPromise: fe,
|
|
2843
|
+
ZodEffects: D,
|
|
2844
|
+
ZodTransformer: D,
|
|
2845
|
+
ZodOptional: M,
|
|
2846
|
+
ZodNullable: J,
|
|
2847
|
+
ZodDefault: Se,
|
|
2848
|
+
ZodCatch: Oe,
|
|
2849
|
+
ZodNaN: Be,
|
|
2850
|
+
BRAND: xr,
|
|
2851
|
+
ZodBranded: at,
|
|
2852
|
+
ZodPipeline: Ie,
|
|
2853
|
+
ZodReadonly: Re,
|
|
2854
|
+
custom: Ot,
|
|
2855
|
+
Schema: g,
|
|
2856
|
+
ZodSchema: g,
|
|
2857
|
+
late: kr,
|
|
3481
2858
|
get ZodFirstPartyTypeKind() {
|
|
3482
|
-
return
|
|
2859
|
+
return p;
|
|
3483
2860
|
},
|
|
3484
|
-
coerce:
|
|
3485
|
-
any:
|
|
3486
|
-
array:
|
|
3487
|
-
bigint:
|
|
3488
|
-
boolean:
|
|
3489
|
-
date:
|
|
3490
|
-
discriminatedUnion:
|
|
3491
|
-
effect:
|
|
3492
|
-
enum:
|
|
3493
|
-
function:
|
|
3494
|
-
instanceof:
|
|
3495
|
-
intersection:
|
|
3496
|
-
lazy:
|
|
3497
|
-
literal:
|
|
3498
|
-
map:
|
|
3499
|
-
nan:
|
|
3500
|
-
nativeEnum:
|
|
3501
|
-
never:
|
|
3502
|
-
null:
|
|
3503
|
-
nullable:
|
|
3504
|
-
number:
|
|
3505
|
-
object:
|
|
3506
|
-
oboolean:
|
|
3507
|
-
onumber:
|
|
3508
|
-
optional:
|
|
3509
|
-
ostring:
|
|
3510
|
-
pipeline:
|
|
3511
|
-
preprocess:
|
|
3512
|
-
promise:
|
|
3513
|
-
record:
|
|
3514
|
-
set:
|
|
3515
|
-
strictObject:
|
|
3516
|
-
string:
|
|
3517
|
-
symbol:
|
|
3518
|
-
transformer:
|
|
3519
|
-
tuple:
|
|
3520
|
-
undefined:
|
|
3521
|
-
union:
|
|
3522
|
-
unknown:
|
|
3523
|
-
void:
|
|
3524
|
-
NEVER:
|
|
3525
|
-
ZodIssueCode:
|
|
3526
|
-
quotelessJson:
|
|
3527
|
-
ZodError:
|
|
2861
|
+
coerce: rn,
|
|
2862
|
+
any: Rr,
|
|
2863
|
+
array: Ar,
|
|
2864
|
+
bigint: wr,
|
|
2865
|
+
boolean: Zt,
|
|
2866
|
+
date: Er,
|
|
2867
|
+
discriminatedUnion: Mr,
|
|
2868
|
+
effect: vt,
|
|
2869
|
+
enum: Kr,
|
|
2870
|
+
function: Br,
|
|
2871
|
+
instanceof: br,
|
|
2872
|
+
intersection: Ur,
|
|
2873
|
+
lazy: Hr,
|
|
2874
|
+
literal: Wr,
|
|
2875
|
+
map: Vr,
|
|
2876
|
+
nan: Tr,
|
|
2877
|
+
nativeEnum: qr,
|
|
2878
|
+
never: Zr,
|
|
2879
|
+
null: Or,
|
|
2880
|
+
nullable: Gr,
|
|
2881
|
+
number: It,
|
|
2882
|
+
object: jr,
|
|
2883
|
+
oboolean: tn,
|
|
2884
|
+
onumber: en,
|
|
2885
|
+
optional: Jr,
|
|
2886
|
+
ostring: Qr,
|
|
2887
|
+
pipeline: Xr,
|
|
2888
|
+
preprocess: Fr,
|
|
2889
|
+
promise: Yr,
|
|
2890
|
+
record: $r,
|
|
2891
|
+
set: zr,
|
|
2892
|
+
strictObject: Pr,
|
|
2893
|
+
string: Rt,
|
|
2894
|
+
symbol: Cr,
|
|
2895
|
+
transformer: vt,
|
|
2896
|
+
tuple: Lr,
|
|
2897
|
+
undefined: Sr,
|
|
2898
|
+
union: Dr,
|
|
2899
|
+
unknown: Ir,
|
|
2900
|
+
void: Nr,
|
|
2901
|
+
NEVER: nn,
|
|
2902
|
+
ZodIssueCode: c,
|
|
2903
|
+
quotelessJson: rr,
|
|
2904
|
+
ZodError: I
|
|
3528
2905
|
});
|
|
3529
|
-
const
|
|
3530
|
-
var
|
|
3531
|
-
const
|
|
3532
|
-
var
|
|
3533
|
-
const
|
|
3534
|
-
|
|
3535
|
-
backgroundColor:
|
|
3536
|
-
color:
|
|
3537
|
-
fontFamily:
|
|
3538
|
-
fontSize:
|
|
3539
|
-
fontWeight:
|
|
3540
|
-
margin:
|
|
3541
|
-
padding:
|
|
2906
|
+
const N = x.string().trim().min(1, { message: "Cannot be blank" }), B = x.string().trim().optional();
|
|
2907
|
+
var Nt = /* @__PURE__ */ ((r) => (r.FIRST_NAME = "firstName", r.LAST_NAME = "lastName", r.EMAIL = "email", r.ZIP_CODE = "zipCode", r.CITY = "city", r.STATE = "state", r.COUNTRY = "country", r.ADDRESS = "address", r.PHONE = "phone", r))(Nt || {});
|
|
2908
|
+
const At = x.nativeEnum(Nt);
|
|
2909
|
+
var jt = /* @__PURE__ */ ((r) => (r.CARD_NUMBER = "cardNumber", r.CARD_EXPIRY = "cardExpiry", r.CARD_CVC = "cardCvc", r))(jt || {});
|
|
2910
|
+
const Pt = x.nativeEnum(jt), sn = x.union([At, Pt]);
|
|
2911
|
+
x.object({
|
|
2912
|
+
backgroundColor: B,
|
|
2913
|
+
color: B,
|
|
2914
|
+
fontFamily: B,
|
|
2915
|
+
fontSize: B,
|
|
2916
|
+
fontWeight: B,
|
|
2917
|
+
margin: B,
|
|
2918
|
+
padding: B
|
|
3542
2919
|
});
|
|
3543
|
-
const
|
|
2920
|
+
const b = x.enum([
|
|
3544
2921
|
// Element -> Form
|
|
3545
2922
|
"LOADED",
|
|
3546
2923
|
"BLUR",
|
|
@@ -3557,259 +2934,212 @@ const P = S.enum([
|
|
|
3557
2934
|
// Form -> Element
|
|
3558
2935
|
"TOKENIZE",
|
|
3559
2936
|
"CHECKOUT"
|
|
3560
|
-
]),
|
|
3561
|
-
type:
|
|
3562
|
-
elementType:
|
|
3563
|
-
}),
|
|
3564
|
-
type:
|
|
3565
|
-
message:
|
|
3566
|
-
}),
|
|
3567
|
-
type:
|
|
3568
|
-
elementType:
|
|
3569
|
-
errors:
|
|
3570
|
-
}),
|
|
3571
|
-
type:
|
|
3572
|
-
sessionId:
|
|
3573
|
-
height:
|
|
3574
|
-
totalAmountAtoms:
|
|
3575
|
-
currency:
|
|
3576
|
-
}),
|
|
3577
|
-
type:
|
|
3578
|
-
sessionId:
|
|
3579
|
-
firstName:
|
|
3580
|
-
lastName:
|
|
3581
|
-
email:
|
|
3582
|
-
zipCode:
|
|
3583
|
-
country:
|
|
3584
|
-
}),
|
|
3585
|
-
type:
|
|
3586
|
-
isReadyForCheckout:
|
|
3587
|
-
}),
|
|
3588
|
-
type:
|
|
3589
|
-
invoiceUrls:
|
|
3590
|
-
}),
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
]),
|
|
3600
|
-
payload:
|
|
3601
|
-
nonce:
|
|
3602
|
-
formId:
|
|
3603
|
-
elementId:
|
|
3604
|
-
}),
|
|
2937
|
+
]), an = b.extract(["TOKENIZE_STARTED", "CHECKOUT_STARTED"]), on = x.object({ type: an }), cn = b.extract(["BLUR", "FOCUS", "CHANGE"]), dn = x.object({
|
|
2938
|
+
type: cn,
|
|
2939
|
+
elementType: Pt
|
|
2940
|
+
}), un = b.extract(["LOAD_ERROR", "TOKENIZE_ERROR", "CHECKOUT_ERROR"]), ln = x.object({
|
|
2941
|
+
type: un,
|
|
2942
|
+
message: N
|
|
2943
|
+
}), fn = b.extract(["VALIDATION_ERROR"]), hn = x.object({
|
|
2944
|
+
type: fn,
|
|
2945
|
+
elementType: sn,
|
|
2946
|
+
errors: x.array(x.string())
|
|
2947
|
+
}), mn = x.object({
|
|
2948
|
+
type: x.literal(b.enum.LOADED),
|
|
2949
|
+
sessionId: N,
|
|
2950
|
+
height: N,
|
|
2951
|
+
totalAmountAtoms: x.number(),
|
|
2952
|
+
currency: B
|
|
2953
|
+
}), pn = b.extract(["TOKENIZE", "CHECKOUT"]), Dt = x.object({
|
|
2954
|
+
type: pn,
|
|
2955
|
+
sessionId: N,
|
|
2956
|
+
firstName: N,
|
|
2957
|
+
lastName: N,
|
|
2958
|
+
email: N,
|
|
2959
|
+
zipCode: N,
|
|
2960
|
+
country: N
|
|
2961
|
+
}), yn = x.object({
|
|
2962
|
+
type: x.literal(b.enum.TOKENIZE_SUCCESS),
|
|
2963
|
+
isReadyForCheckout: x.boolean()
|
|
2964
|
+
}), vn = x.object({
|
|
2965
|
+
type: x.literal(b.enum.CHECKOUT_SUCCESS),
|
|
2966
|
+
invoiceUrls: x.array(x.string())
|
|
2967
|
+
}), gn = x.discriminatedUnion("type", [
|
|
2968
|
+
on,
|
|
2969
|
+
dn,
|
|
2970
|
+
ln,
|
|
2971
|
+
hn,
|
|
2972
|
+
mn,
|
|
2973
|
+
Dt,
|
|
2974
|
+
yn,
|
|
2975
|
+
vn
|
|
2976
|
+
]), _n = x.object({
|
|
2977
|
+
payload: gn,
|
|
2978
|
+
nonce: N,
|
|
2979
|
+
formId: N,
|
|
2980
|
+
elementId: N
|
|
2981
|
+
}), xn = (r) => {
|
|
3605
2982
|
const e = {};
|
|
3606
2983
|
return Object.entries(r).forEach(([t, n]) => {
|
|
3607
2984
|
try {
|
|
3608
|
-
const
|
|
3609
|
-
Array.isArray(n) ? e[
|
|
2985
|
+
const s = At.parse(t);
|
|
2986
|
+
Array.isArray(n) ? e[s] = n : Array.isArray(n._errors) && (e[s] = n._errors);
|
|
3610
2987
|
} catch {
|
|
3611
2988
|
return;
|
|
3612
2989
|
}
|
|
3613
2990
|
}), e;
|
|
3614
|
-
},
|
|
3615
|
-
const
|
|
3616
|
-
(
|
|
3617
|
-
const
|
|
3618
|
-
return
|
|
2991
|
+
}, kn = (r, e, t) => {
|
|
2992
|
+
const s = Array.from(e.querySelectorAll("input[data-opid]") ?? []).reduce(
|
|
2993
|
+
(i, o) => {
|
|
2994
|
+
const u = o.getAttribute("data-opid");
|
|
2995
|
+
return u ? { ...i, [u]: o.value } : i;
|
|
3619
2996
|
},
|
|
3620
2997
|
{
|
|
3621
|
-
type:
|
|
2998
|
+
type: b.enum.TOKENIZE,
|
|
3622
2999
|
sessionId: r
|
|
3623
3000
|
}
|
|
3624
|
-
);
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
if (s.success)
|
|
3628
|
-
return s.data;
|
|
3001
|
+
), a = Dt.safeParse(s);
|
|
3002
|
+
if (a.success)
|
|
3003
|
+
return a.data;
|
|
3629
3004
|
{
|
|
3630
|
-
const
|
|
3631
|
-
for (const [
|
|
3632
|
-
t(
|
|
3005
|
+
const i = a.error.format(), o = xn(i);
|
|
3006
|
+
for (const [u, d] of Object.entries(o))
|
|
3007
|
+
t(u, d, u);
|
|
3633
3008
|
}
|
|
3634
|
-
},
|
|
3009
|
+
}, bn = (r) => {
|
|
3635
3010
|
try {
|
|
3636
|
-
return
|
|
3011
|
+
return _n.parse(r);
|
|
3637
3012
|
} catch (e) {
|
|
3638
|
-
throw
|
|
3013
|
+
throw e;
|
|
3639
3014
|
}
|
|
3640
|
-
},
|
|
3641
|
-
const
|
|
3015
|
+
}, gt = (r, e, t, n) => {
|
|
3016
|
+
const s = {
|
|
3642
3017
|
payload: n,
|
|
3643
|
-
nonce:
|
|
3018
|
+
nonce: kt(),
|
|
3644
3019
|
formId: e,
|
|
3645
3020
|
elementId: t
|
|
3646
3021
|
};
|
|
3647
|
-
|
|
3648
|
-
},
|
|
3022
|
+
r.postMessage(JSON.stringify(s), st);
|
|
3023
|
+
}, Sn = (r) => {
|
|
3649
3024
|
const {
|
|
3650
3025
|
children: e,
|
|
3651
3026
|
checkoutSecureToken: t,
|
|
3652
3027
|
className: n,
|
|
3653
|
-
onFocus:
|
|
3654
|
-
onBlur:
|
|
3655
|
-
onChange:
|
|
3656
|
-
onLoad:
|
|
3657
|
-
onLoadError:
|
|
3658
|
-
onValidationError:
|
|
3659
|
-
onCheckoutStarted:
|
|
3660
|
-
onCheckoutSuccess:
|
|
3661
|
-
onCheckoutError:
|
|
3662
|
-
} = r, [
|
|
3663
|
-
(
|
|
3664
|
-
if (
|
|
3665
|
-
const
|
|
3666
|
-
if (
|
|
3667
|
-
console.warn("[form] Ignoring unknown event:", j);
|
|
3668
|
-
return;
|
|
3669
|
-
}
|
|
3670
|
-
if (j.nonce in ft) {
|
|
3671
|
-
console.warn("[form] Ignoring duplicate event:", j);
|
|
3028
|
+
onFocus: s,
|
|
3029
|
+
onBlur: a,
|
|
3030
|
+
onChange: i,
|
|
3031
|
+
onLoad: o,
|
|
3032
|
+
onLoadError: u,
|
|
3033
|
+
onValidationError: d,
|
|
3034
|
+
onCheckoutStarted: m,
|
|
3035
|
+
onCheckoutSuccess: T,
|
|
3036
|
+
onCheckoutError: z
|
|
3037
|
+
} = r, [G, F] = R(void 0), [it, Mt] = R([]), [Ut, Lt] = R("1px"), [ot, $t] = R(!1), [Ke, ct] = R(void 0), [dt, Ze] = R(!1), [te, Vt] = R([]), [re, zt] = R({}), [ut, lt] = R(0), [ft, ht] = R(!1), [ne, Bt] = R(void 0), [mt, Ht] = R(void 0), [qe, Wt] = R(void 0), se = Pe(() => `opjs-form-${kt()}`, []), he = _t(null), Ye = Ae(
|
|
3038
|
+
(O) => {
|
|
3039
|
+
if (O.origin !== st || !O.source) return;
|
|
3040
|
+
const ae = O.source, C = bn(JSON.parse(O.data)), Ne = C.elementId;
|
|
3041
|
+
if (C.formId !== se || !Ne || C.nonce in it)
|
|
3672
3042
|
return;
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
if (je(!1), !ue) {
|
|
3685
|
-
console.warn("[form] Ignoring LOADED event from unregistered iframe:", j);
|
|
3043
|
+
Mt((ie) => [...ie, C.nonce]);
|
|
3044
|
+
const Z = C.payload, A = Z.type;
|
|
3045
|
+
if (A === b.enum.FOCUS && s)
|
|
3046
|
+
s(C.elementId);
|
|
3047
|
+
else if (A === b.enum.BLUR && a)
|
|
3048
|
+
a(C.elementId);
|
|
3049
|
+
else if (A === b.enum.CHANGE && i)
|
|
3050
|
+
i(C.elementId);
|
|
3051
|
+
else if (A === b.enum.LOADED) {
|
|
3052
|
+
const ie = te.find((Fe) => Fe.contentWindow === ae);
|
|
3053
|
+
if (Ze(!1), !ie)
|
|
3686
3054
|
return;
|
|
3687
|
-
}
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
} else V === P.enum.CHECKOUT_SUCCESS ? (console.log("[form] Checkout complete:", I.invoiceUrls), je(!1), ee(0), Be(!1), O && O(I.invoiceUrls)) : V === P.enum.LOAD_ERROR ? (console.error("[form] Error loading iframe:", I.message), f && f(I.message)) : V === P.enum.VALIDATION_ERROR ? (console.error(`[form] Validation error for ${I.elementType}:`, I.errors), l && l(I.elementType, I.errors, ce)) : (V === P.enum.TOKENIZE_ERROR || V === P.enum.CHECKOUT_ERROR) && (console.error("[form] API error from element:", I.message), je(!1), K && K(I.message));
|
|
3055
|
+
zt((Fe) => ({ ...Fe, [Ne]: ae }));
|
|
3056
|
+
const Ge = Z.height ? `${Z.height}px` : "100%";
|
|
3057
|
+
Lt(Ge), Wt(Z.totalAmountAtoms), Ht(Z.currency), ne || Bt(Z.sessionId);
|
|
3058
|
+
} else if (A === b.enum.TOKENIZE_STARTED)
|
|
3059
|
+
Ze(!0), m && m();
|
|
3060
|
+
else if (A === b.enum.TOKENIZE_SUCCESS && Ke) {
|
|
3061
|
+
const ie = ut + 1, Ge = ie === Object.keys(re).length;
|
|
3062
|
+
!ft && (Ge || Z.isReadyForCheckout) ? (gt(ae, se, Ne, Ke), ht(!0), ct(void 0)) : lt(ie);
|
|
3063
|
+
} else A === b.enum.CHECKOUT_SUCCESS ? (Ze(!1), lt(0), ht(!1), T && T(Z.invoiceUrls)) : A === b.enum.LOAD_ERROR ? u && u(Z.message) : A === b.enum.VALIDATION_ERROR ? d && d(Z.elementType, Z.errors, Ne) : (A === b.enum.TOKENIZE_ERROR || A === b.enum.CHECKOUT_ERROR) && (Ze(!1), z && z(Z.message));
|
|
3697
3064
|
},
|
|
3698
3065
|
[
|
|
3699
|
-
oe,
|
|
3700
|
-
ie,
|
|
3701
|
-
ft,
|
|
3702
|
-
ze,
|
|
3703
3066
|
se,
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3067
|
+
ne,
|
|
3068
|
+
it,
|
|
3069
|
+
Ke,
|
|
3070
|
+
te,
|
|
3071
|
+
re,
|
|
3072
|
+
ut,
|
|
3073
|
+
ft,
|
|
3709
3074
|
a,
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3075
|
+
i,
|
|
3076
|
+
s,
|
|
3077
|
+
u,
|
|
3078
|
+
m,
|
|
3079
|
+
T,
|
|
3080
|
+
z,
|
|
3081
|
+
d
|
|
3715
3082
|
]
|
|
3716
|
-
),
|
|
3717
|
-
if (!
|
|
3718
|
-
const
|
|
3719
|
-
if (
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
pt && A.preventDefault();
|
|
3083
|
+
), Kt = Ae(() => {
|
|
3084
|
+
if (!he.current || !d || !ne) return;
|
|
3085
|
+
const O = kn(ne, he.current, d);
|
|
3086
|
+
if (O) {
|
|
3087
|
+
for (const [ae, C] of Object.entries(re))
|
|
3088
|
+
C && gt(C, se, ae, O);
|
|
3089
|
+
O.type = b.enum.CHECKOUT, ct(O);
|
|
3090
|
+
}
|
|
3091
|
+
}, [he, re, se, d, ne]), Je = Ae(
|
|
3092
|
+
(O) => {
|
|
3093
|
+
dt && O.preventDefault();
|
|
3728
3094
|
},
|
|
3729
|
-
[
|
|
3095
|
+
[dt]
|
|
3730
3096
|
);
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
}, [
|
|
3734
|
-
window.removeEventListener("beforeunload",
|
|
3735
|
-
}), [
|
|
3736
|
-
const
|
|
3737
|
-
(
|
|
3738
|
-
|
|
3097
|
+
De(() => {
|
|
3098
|
+
ot || !he.current || !qe || te.length === Object.keys(re).length && ($t(!0), o && o(qe, mt));
|
|
3099
|
+
}, [te, re, ot, o, qe, mt]), De(() => (F(window.location.origin), window.addEventListener("message", Ye), window.addEventListener("beforeunload", Je), () => {
|
|
3100
|
+
window.removeEventListener("beforeunload", Je), window.removeEventListener("message", Ye);
|
|
3101
|
+
}), [ne, Ye, Je]);
|
|
3102
|
+
const qt = Ae(
|
|
3103
|
+
(O) => {
|
|
3104
|
+
te.find((C) => C.contentWindow === O.contentWindow) || Vt((C) => [...C, O]);
|
|
3739
3105
|
},
|
|
3740
|
-
[
|
|
3741
|
-
),
|
|
3742
|
-
formId:
|
|
3743
|
-
formHeight:
|
|
3744
|
-
referer:
|
|
3106
|
+
[te]
|
|
3107
|
+
), Yt = {
|
|
3108
|
+
formId: se,
|
|
3109
|
+
formHeight: Ut,
|
|
3110
|
+
referer: G,
|
|
3745
3111
|
checkoutSecureToken: t,
|
|
3746
|
-
registerIframe:
|
|
3112
|
+
registerIframe: qt
|
|
3747
3113
|
};
|
|
3748
|
-
return /* @__PURE__ */
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
columnNumber: 7
|
|
3752
|
-
}, void 0) }, void 0, !1, {
|
|
3753
|
-
fileName: "/home/runner/work/openpay-js-react/openpay-js-react/lib/components/form.tsx",
|
|
3754
|
-
lineNumber: 240,
|
|
3755
|
-
columnNumber: 5
|
|
3756
|
-
}, void 0);
|
|
3757
|
-
}, ja = (r) => `styles=${encodeURIComponent(JSON.stringify(r))}`, Zt = (r) => {
|
|
3758
|
-
const { subPath: e, styles: t } = r, { formId: n, referer: a, formHeight: s, checkoutSecureToken: o, registerIframe: c } = nn(), [f, l] = W(!1), v = vr(null), O = Tt(() => t ? ja(t) : "", [t]), K = Tt(() => ({
|
|
3114
|
+
return /* @__PURE__ */ W(xt.Provider, { value: Yt, children: /* @__PURE__ */ W("div", { className: n, ref: he, children: e({ submit: Kt }) }) });
|
|
3115
|
+
}, Tn = (r) => `styles=${encodeURIComponent(JSON.stringify(r))}`, We = (r) => {
|
|
3116
|
+
const { subPath: e, styles: t } = r, { formId: n, referer: s, formHeight: a, checkoutSecureToken: i, registerIframe: o } = Ft(), [u, d] = R(!1), m = _t(null), T = Pe(() => t ? Tn(t) : "", [t]), z = Pe(() => ({
|
|
3759
3117
|
border: "none",
|
|
3760
3118
|
width: "100%",
|
|
3761
|
-
height:
|
|
3762
|
-
}), [
|
|
3763
|
-
if (!
|
|
3764
|
-
const
|
|
3765
|
-
return
|
|
3766
|
-
}, [
|
|
3767
|
-
return
|
|
3768
|
-
!
|
|
3769
|
-
}, [
|
|
3119
|
+
height: a
|
|
3120
|
+
}), [a]), G = Pe(() => {
|
|
3121
|
+
if (!i || !s) return "";
|
|
3122
|
+
const F = new URLSearchParams();
|
|
3123
|
+
return F.append("referer", s), F.append("styles", T), F.append("formId", n), F.append("secureToken", i), F.toString();
|
|
3124
|
+
}, [T, n, s, i]);
|
|
3125
|
+
return De(() => d(!0), []), De(() => {
|
|
3126
|
+
!m.current || !u || o(m.current);
|
|
3127
|
+
}, [u]), i ? /* @__PURE__ */ W(
|
|
3770
3128
|
"iframe",
|
|
3771
3129
|
{
|
|
3772
3130
|
name: `${e}-element`,
|
|
3773
|
-
src: `${
|
|
3774
|
-
style:
|
|
3775
|
-
ref:
|
|
3776
|
-
}
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
{
|
|
3780
|
-
fileName: "/home/runner/work/openpay-js-react/openpay-js-react/lib/components/_common/frame.tsx",
|
|
3781
|
-
lineNumber: 58,
|
|
3782
|
-
columnNumber: 5
|
|
3783
|
-
},
|
|
3784
|
-
void 0
|
|
3785
|
-
) : (console.error("[form] Cannot render partially initialized frame"), /* @__PURE__ */ _e.jsxDEV("div", {}, void 0, !1, {
|
|
3786
|
-
fileName: "/home/runner/work/openpay-js-react/openpay-js-react/lib/components/_common/frame.tsx",
|
|
3787
|
-
lineNumber: 54,
|
|
3788
|
-
columnNumber: 12
|
|
3789
|
-
}, void 0));
|
|
3790
|
-
}, Za = ({ styles: r }) => /* @__PURE__ */ _e.jsxDEV(Zt, { styles: r, subPath: "card-cvc" }, void 0, !1, {
|
|
3791
|
-
fileName: "/home/runner/work/openpay-js-react/openpay-js-react/lib/components/card-cvc.tsx",
|
|
3792
|
-
lineNumber: 6,
|
|
3793
|
-
columnNumber: 10
|
|
3794
|
-
}, void 0), Pa = ({ styles: r }) => /* @__PURE__ */ _e.jsxDEV(Zt, { styles: r, subPath: "card" }, void 0, !1, {
|
|
3795
|
-
fileName: "/home/runner/work/openpay-js-react/openpay-js-react/lib/components/card.tsx",
|
|
3796
|
-
lineNumber: 6,
|
|
3797
|
-
columnNumber: 10
|
|
3798
|
-
}, void 0), Da = ({ styles: r }) => /* @__PURE__ */ _e.jsxDEV(Zt, { styles: r, subPath: "card-expiry" }, void 0, !1, {
|
|
3799
|
-
fileName: "/home/runner/work/openpay-js-react/openpay-js-react/lib/components/card-expiry.tsx",
|
|
3800
|
-
lineNumber: 6,
|
|
3801
|
-
columnNumber: 10
|
|
3802
|
-
}, void 0), $a = ({ styles: r }) => /* @__PURE__ */ _e.jsxDEV(Zt, { styles: r, subPath: "card-number" }, void 0, !1, {
|
|
3803
|
-
fileName: "/home/runner/work/openpay-js-react/openpay-js-react/lib/components/card-number.tsx",
|
|
3804
|
-
lineNumber: 6,
|
|
3805
|
-
columnNumber: 10
|
|
3806
|
-
}, void 0);
|
|
3131
|
+
src: `${st}/app/v1/${e}-element?${G}`,
|
|
3132
|
+
style: z,
|
|
3133
|
+
ref: m
|
|
3134
|
+
}
|
|
3135
|
+
) : /* @__PURE__ */ W("div", {});
|
|
3136
|
+
}, On = ({ styles: r }) => /* @__PURE__ */ W(We, { styles: r, subPath: "card-cvc" }), Rn = ({ styles: r }) => /* @__PURE__ */ W(We, { styles: r, subPath: "card" }), In = ({ styles: r }) => /* @__PURE__ */ W(We, { styles: r, subPath: "card-expiry" }), Zn = ({ styles: r }) => /* @__PURE__ */ W(We, { styles: r, subPath: "card-number" });
|
|
3807
3137
|
export {
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3138
|
+
On as CardCvcElement,
|
|
3139
|
+
Rn as CardElement,
|
|
3140
|
+
In as CardExpiryElement,
|
|
3141
|
+
Zn as CardNumberElement,
|
|
3142
|
+
Sn as ElementsForm,
|
|
3143
|
+
Nt as FieldName,
|
|
3144
|
+
Ft as useOpenPayElements
|
|
3815
3145
|
};
|