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