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