@invoice-sdk/widget 1.5.2 → 1.5.3

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.
@@ -0,0 +1,4998 @@
1
+ import * as vr from "react";
2
+ import P, { useRef as ys, useState as Qt, useCallback as gs, useEffect as vs, forwardRef as _s } from "react";
3
+ import { Outlet as bs, useNavigate as nr, BrowserRouter as xs, Routes as ks, Route as We, Navigate as ws } from "react-router-dom";
4
+ var Ot = { exports: {} }, ct = {};
5
+ /**
6
+ * @license React
7
+ * react-jsx-runtime.production.js
8
+ *
9
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
10
+ *
11
+ * This source code is licensed under the MIT license found in the
12
+ * LICENSE file in the root directory of this source tree.
13
+ */
14
+ var _r;
15
+ function Ts() {
16
+ if (_r) return ct;
17
+ _r = 1;
18
+ var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
19
+ function r(s, n, a) {
20
+ var i = null;
21
+ if (a !== void 0 && (i = "" + a), n.key !== void 0 && (i = "" + n.key), "key" in n) {
22
+ a = {};
23
+ for (var o in n)
24
+ o !== "key" && (a[o] = n[o]);
25
+ } else a = n;
26
+ return n = a.ref, {
27
+ $$typeof: t,
28
+ type: s,
29
+ key: i,
30
+ ref: n !== void 0 ? n : null,
31
+ props: a
32
+ };
33
+ }
34
+ return ct.Fragment = e, ct.jsx = r, ct.jsxs = r, ct;
35
+ }
36
+ var lt = {};
37
+ /**
38
+ * @license React
39
+ * react-jsx-runtime.development.js
40
+ *
41
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
42
+ *
43
+ * This source code is licensed under the MIT license found in the
44
+ * LICENSE file in the root directory of this source tree.
45
+ */
46
+ var br;
47
+ function Ss() {
48
+ return br || (br = 1, process.env.NODE_ENV !== "production" && function() {
49
+ function t(h) {
50
+ if (h == null) return null;
51
+ if (typeof h == "function")
52
+ return h.$$typeof === Ee ? null : h.displayName || h.name || null;
53
+ if (typeof h == "string") return h;
54
+ switch (h) {
55
+ case Z:
56
+ return "Fragment";
57
+ case pe:
58
+ return "Profiler";
59
+ case B:
60
+ return "StrictMode";
61
+ case q:
62
+ return "Suspense";
63
+ case Xe:
64
+ return "SuspenseList";
65
+ case le:
66
+ return "Activity";
67
+ }
68
+ if (typeof h == "object")
69
+ switch (typeof h.tag == "number" && console.error(
70
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
71
+ ), h.$$typeof) {
72
+ case te:
73
+ return "Portal";
74
+ case ce:
75
+ return (h.displayName || "Context") + ".Provider";
76
+ case R:
77
+ return (h._context.displayName || "Context") + ".Consumer";
78
+ case re:
79
+ var C = h.render;
80
+ return h = h.displayName, h || (h = C.displayName || C.name || "", h = h !== "" ? "ForwardRef(" + h + ")" : "ForwardRef"), h;
81
+ case xe:
82
+ return C = h.displayName || null, C !== null ? C : t(h.type) || "Memo";
83
+ case Qe:
84
+ C = h._payload, h = h._init;
85
+ try {
86
+ return t(h(C));
87
+ } catch {
88
+ }
89
+ }
90
+ return null;
91
+ }
92
+ function e(h) {
93
+ return "" + h;
94
+ }
95
+ function r(h) {
96
+ try {
97
+ e(h);
98
+ var C = !1;
99
+ } catch {
100
+ C = !0;
101
+ }
102
+ if (C) {
103
+ C = console;
104
+ var U = C.error, H = typeof Symbol == "function" && Symbol.toStringTag && h[Symbol.toStringTag] || h.constructor.name || "Object";
105
+ return U.call(
106
+ C,
107
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
108
+ H
109
+ ), e(h);
110
+ }
111
+ }
112
+ function s(h) {
113
+ if (h === Z) return "<>";
114
+ if (typeof h == "object" && h !== null && h.$$typeof === Qe)
115
+ return "<...>";
116
+ try {
117
+ var C = t(h);
118
+ return C ? "<" + C + ">" : "<...>";
119
+ } catch {
120
+ return "<...>";
121
+ }
122
+ }
123
+ function n() {
124
+ var h = oe.A;
125
+ return h === null ? null : h.getOwner();
126
+ }
127
+ function a() {
128
+ return Error("react-stack-top-frame");
129
+ }
130
+ function i(h) {
131
+ if (V.call(h, "key")) {
132
+ var C = Object.getOwnPropertyDescriptor(h, "key").get;
133
+ if (C && C.isReactWarning) return !1;
134
+ }
135
+ return h.key !== void 0;
136
+ }
137
+ function o(h, C) {
138
+ function U() {
139
+ Q || (Q = !0, console.error(
140
+ "%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://react.dev/link/special-props)",
141
+ C
142
+ ));
143
+ }
144
+ U.isReactWarning = !0, Object.defineProperty(h, "key", {
145
+ get: U,
146
+ configurable: !0
147
+ });
148
+ }
149
+ function d() {
150
+ var h = t(this.type);
151
+ return K[h] || (K[h] = !0, console.error(
152
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
153
+ )), h = this.props.ref, h !== void 0 ? h : null;
154
+ }
155
+ function f(h, C, U, H, ke, de, ot, Be) {
156
+ return U = de.ref, h = {
157
+ $$typeof: W,
158
+ type: h,
159
+ key: C,
160
+ props: de,
161
+ _owner: ke
162
+ }, (U !== void 0 ? U : null) !== null ? Object.defineProperty(h, "ref", {
163
+ enumerable: !1,
164
+ get: d
165
+ }) : Object.defineProperty(h, "ref", { enumerable: !1, value: null }), h._store = {}, Object.defineProperty(h._store, "validated", {
166
+ configurable: !1,
167
+ enumerable: !1,
168
+ writable: !0,
169
+ value: 0
170
+ }), Object.defineProperty(h, "_debugInfo", {
171
+ configurable: !1,
172
+ enumerable: !1,
173
+ writable: !0,
174
+ value: null
175
+ }), Object.defineProperty(h, "_debugStack", {
176
+ configurable: !1,
177
+ enumerable: !1,
178
+ writable: !0,
179
+ value: ot
180
+ }), Object.defineProperty(h, "_debugTask", {
181
+ configurable: !1,
182
+ enumerable: !1,
183
+ writable: !0,
184
+ value: Be
185
+ }), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
186
+ }
187
+ function _(h, C, U, H, ke, de, ot, Be) {
188
+ var G = C.children;
189
+ if (G !== void 0)
190
+ if (H)
191
+ if (I(G)) {
192
+ for (H = 0; H < G.length; H++)
193
+ y(G[H]);
194
+ Object.freeze && Object.freeze(G);
195
+ } else
196
+ console.error(
197
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
198
+ );
199
+ else y(G);
200
+ if (V.call(C, "key")) {
201
+ G = t(h);
202
+ var we = Object.keys(C).filter(function(Yt) {
203
+ return Yt !== "key";
204
+ });
205
+ H = 0 < we.length ? "{key: someKey, " + we.join(": ..., ") + ": ...}" : "{key: someKey}", Ne[G + H] || (we = 0 < we.length ? "{" + we.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ `A props object containing a "key" prop is being spread into JSX:
207
+ let props = %s;
208
+ <%s {...props} />
209
+ React keys must be passed directly to JSX without using spread:
210
+ let props = %s;
211
+ <%s key={someKey} {...props} />`,
212
+ H,
213
+ G,
214
+ we,
215
+ G
216
+ ), Ne[G + H] = !0);
217
+ }
218
+ if (G = null, U !== void 0 && (r(U), G = "" + U), i(C) && (r(C.key), G = "" + C.key), "key" in C) {
219
+ U = {};
220
+ for (var Ke in C)
221
+ Ke !== "key" && (U[Ke] = C[Ke]);
222
+ } else U = C;
223
+ return G && o(
224
+ U,
225
+ typeof h == "function" ? h.displayName || h.name || "Unknown" : h
226
+ ), f(
227
+ h,
228
+ G,
229
+ de,
230
+ ke,
231
+ n(),
232
+ U,
233
+ ot,
234
+ Be
235
+ );
236
+ }
237
+ function y(h) {
238
+ typeof h == "object" && h !== null && h.$$typeof === W && h._store && (h._store.validated = 1);
239
+ }
240
+ var v = P, W = Symbol.for("react.transitional.element"), te = Symbol.for("react.portal"), Z = Symbol.for("react.fragment"), B = Symbol.for("react.strict_mode"), pe = Symbol.for("react.profiler"), R = Symbol.for("react.consumer"), ce = Symbol.for("react.context"), re = Symbol.for("react.forward_ref"), q = Symbol.for("react.suspense"), Xe = Symbol.for("react.suspense_list"), xe = Symbol.for("react.memo"), Qe = Symbol.for("react.lazy"), le = Symbol.for("react.activity"), Ee = Symbol.for("react.client.reference"), oe = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, I = Array.isArray, $ = console.createTask ? console.createTask : function() {
241
+ return null;
242
+ };
243
+ v = {
244
+ "react-stack-bottom-frame": function(h) {
245
+ return h();
246
+ }
247
+ };
248
+ var Q, K = {}, ue = v["react-stack-bottom-frame"].bind(
249
+ v,
250
+ a
251
+ )(), Pe = $(s(a)), Ne = {};
252
+ lt.Fragment = Z, lt.jsx = function(h, C, U, H, ke) {
253
+ var de = 1e4 > oe.recentlyCreatedOwnerStacks++;
254
+ return _(
255
+ h,
256
+ C,
257
+ U,
258
+ !1,
259
+ H,
260
+ ke,
261
+ de ? Error("react-stack-top-frame") : ue,
262
+ de ? $(s(h)) : Pe
263
+ );
264
+ }, lt.jsxs = function(h, C, U, H, ke) {
265
+ var de = 1e4 > oe.recentlyCreatedOwnerStacks++;
266
+ return _(
267
+ h,
268
+ C,
269
+ U,
270
+ !0,
271
+ H,
272
+ ke,
273
+ de ? Error("react-stack-top-frame") : ue,
274
+ de ? $(s(h)) : Pe
275
+ );
276
+ };
277
+ }()), lt;
278
+ }
279
+ var xr;
280
+ function As() {
281
+ return xr || (xr = 1, process.env.NODE_ENV === "production" ? Ot.exports = Ts() : Ot.exports = Ss()), Ot.exports;
282
+ }
283
+ var p = As();
284
+ const kr = (t) => {
285
+ let e;
286
+ const r = /* @__PURE__ */ new Set(), s = (f, _) => {
287
+ const y = typeof f == "function" ? f(e) : f;
288
+ if (!Object.is(y, e)) {
289
+ const v = e;
290
+ e = _ ?? (typeof y != "object" || y === null) ? y : Object.assign({}, e, y), r.forEach((W) => W(e, v));
291
+ }
292
+ }, n = () => e, o = { setState: s, getState: n, getInitialState: () => d, subscribe: (f) => (r.add(f), () => r.delete(f)) }, d = e = t(s, n, o);
293
+ return o;
294
+ }, js = (t) => t ? kr(t) : kr, Es = (t) => t;
295
+ function Ns(t, e = Es) {
296
+ const r = P.useSyncExternalStore(
297
+ t.subscribe,
298
+ () => e(t.getState()),
299
+ () => e(t.getInitialState())
300
+ );
301
+ return P.useDebugValue(r), r;
302
+ }
303
+ const wr = (t) => {
304
+ const e = js(t), r = (s) => Ns(e, s);
305
+ return Object.assign(r, e), r;
306
+ }, Lr = (t) => t ? wr(t) : wr, mt = Lr((t) => ({
307
+ step: 1,
308
+ nextStep: () => t((e) => ({ step: e.step + 1 })),
309
+ prevStep: () => t((e) => ({ step: Math.max(e.step - 1, 1) })),
310
+ reset: () => t({ step: 1 })
311
+ })), Cs = 4, Rs = () => {
312
+ const { step: t } = mt();
313
+ return /* @__PURE__ */ p.jsx("div", { className: "w-full relative h-3 bg-gray-200 rounded-full", children: /* @__PURE__ */ p.jsx(
314
+ "div",
315
+ {
316
+ className: "absolute rounded-full bg-green-500",
317
+ style: {
318
+ width: `${t / Cs * 100}%`,
319
+ height: "100%",
320
+ transition: "width 0.3s ease-in-out"
321
+ }
322
+ }
323
+ ) });
324
+ }, Os = () => /* @__PURE__ */ p.jsxs("div", { className: "max-w-[800px] mx-auto py-10 flex flex-col gap-8", children: [
325
+ /* @__PURE__ */ p.jsx(Rs, {}),
326
+ /* @__PURE__ */ p.jsx(bs, {})
327
+ ] });
328
+ var Nt = (t) => t.type === "checkbox", qe = (t) => t instanceof Date, ae = (t) => t == null;
329
+ const $r = (t) => typeof t == "object";
330
+ var J = (t) => !ae(t) && !Array.isArray(t) && $r(t) && !qe(t), Ur = (t) => J(t) && t.target ? Nt(t.target) ? t.target.checked : t.target.value : t, Vs = (t) => t.substring(0, t.search(/\.\d+(\.|$)/)) || t, zr = (t, e) => t.has(Vs(e)), Fs = (t) => {
331
+ const e = t.constructor && t.constructor.prototype;
332
+ return J(e) && e.hasOwnProperty("isPrototypeOf");
333
+ }, ar = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
334
+ function ee(t) {
335
+ let e;
336
+ const r = Array.isArray(t), s = typeof FileList < "u" ? t instanceof FileList : !1;
337
+ if (t instanceof Date)
338
+ e = new Date(t);
339
+ else if (t instanceof Set)
340
+ e = new Set(t);
341
+ else if (!(ar && (t instanceof Blob || s)) && (r || J(t)))
342
+ if (e = r ? [] : {}, !r && !Fs(t))
343
+ e = t;
344
+ else
345
+ for (const n in t)
346
+ t.hasOwnProperty(n) && (e[n] = ee(t[n]));
347
+ else
348
+ return t;
349
+ return e;
350
+ }
351
+ var Wt = (t) => Array.isArray(t) ? t.filter(Boolean) : [], Y = (t) => t === void 0, x = (t, e, r) => {
352
+ if (!e || !J(t))
353
+ return r;
354
+ const s = Wt(e.split(/[,[\].]+?/)).reduce((n, a) => ae(n) ? n : n[a], t);
355
+ return Y(s) || s === t ? Y(t[e]) ? r : t[e] : s;
356
+ }, fe = (t) => typeof t == "boolean", ir = (t) => /^\w*$/.test(t), Br = (t) => Wt(t.replace(/["|']|\]/g, "").split(/\.|\[/)), D = (t, e, r) => {
357
+ let s = -1;
358
+ const n = ir(e) ? [e] : Br(e), a = n.length, i = a - 1;
359
+ for (; ++s < a; ) {
360
+ const o = n[s];
361
+ let d = r;
362
+ if (s !== i) {
363
+ const f = t[o];
364
+ d = J(f) || Array.isArray(f) ? f : isNaN(+n[s + 1]) ? {} : [];
365
+ }
366
+ if (o === "__proto__" || o === "constructor" || o === "prototype")
367
+ return;
368
+ t[o] = d, t = t[o];
369
+ }
370
+ };
371
+ const Ft = {
372
+ BLUR: "blur",
373
+ FOCUS_OUT: "focusout",
374
+ CHANGE: "change"
375
+ }, ye = {
376
+ onBlur: "onBlur",
377
+ onChange: "onChange",
378
+ onSubmit: "onSubmit",
379
+ onTouched: "onTouched",
380
+ all: "all"
381
+ }, Ce = {
382
+ max: "max",
383
+ min: "min",
384
+ maxLength: "maxLength",
385
+ minLength: "minLength",
386
+ pattern: "pattern",
387
+ required: "required",
388
+ validate: "validate"
389
+ }, Ps = P.createContext(null), or = () => P.useContext(Ps);
390
+ var Wr = (t, e, r, s = !0) => {
391
+ const n = {
392
+ defaultValues: e._defaultValues
393
+ };
394
+ for (const a in t)
395
+ Object.defineProperty(n, a, {
396
+ get: () => {
397
+ const i = a;
398
+ return e._proxyFormState[i] !== ye.all && (e._proxyFormState[i] = !s || ye.all), r && (r[i] = !0), t[i];
399
+ }
400
+ });
401
+ return n;
402
+ };
403
+ const cr = typeof window < "u" ? vr.useLayoutEffect : vr.useEffect;
404
+ function Is(t) {
405
+ const e = or(), { control: r = e.control, disabled: s, name: n, exact: a } = t || {}, [i, o] = P.useState(r._formState), d = P.useRef({
406
+ isDirty: !1,
407
+ isLoading: !1,
408
+ dirtyFields: !1,
409
+ touchedFields: !1,
410
+ validatingFields: !1,
411
+ isValidating: !1,
412
+ isValid: !1,
413
+ errors: !1
414
+ });
415
+ return cr(() => r._subscribe({
416
+ name: n,
417
+ formState: d.current,
418
+ exact: a,
419
+ callback: (f) => {
420
+ !s && o({
421
+ ...r._formState,
422
+ ...f
423
+ });
424
+ }
425
+ }), [n, s, a]), P.useEffect(() => {
426
+ d.current.isValid && r._setValid(!0);
427
+ }, [r]), P.useMemo(() => Wr(i, r, d.current, !1), [i, r]);
428
+ }
429
+ var Te = (t) => typeof t == "string", qr = (t, e, r, s, n) => Te(t) ? (s && e.watch.add(t), x(r, t, n)) : Array.isArray(t) ? t.map((a) => (s && e.watch.add(a), x(r, a))) : (s && (e.watchAll = !0), r);
430
+ function Ds(t) {
431
+ const e = or(), { control: r = e.control, name: s, defaultValue: n, disabled: a, exact: i } = t || {}, o = P.useRef(n), [d, f] = P.useState(r._getWatch(s, o.current));
432
+ return cr(() => r._subscribe({
433
+ name: s,
434
+ formState: {
435
+ values: !0
436
+ },
437
+ exact: i,
438
+ callback: (_) => !a && f(qr(s, r._names, _.values || r._formValues, !1, o.current))
439
+ }), [s, r, a, i]), P.useEffect(() => r._removeUnmounted()), d;
440
+ }
441
+ function Ms(t) {
442
+ const e = or(), { name: r, disabled: s, control: n = e.control, shouldUnregister: a } = t, i = zr(n._names.array, r), o = Ds({
443
+ control: n,
444
+ name: r,
445
+ defaultValue: x(n._formValues, r, x(n._defaultValues, r, t.defaultValue)),
446
+ exact: !0
447
+ }), d = Is({
448
+ control: n,
449
+ name: r,
450
+ exact: !0
451
+ }), f = P.useRef(t), _ = P.useRef(n.register(r, {
452
+ ...t.rules,
453
+ value: o,
454
+ ...fe(t.disabled) ? { disabled: t.disabled } : {}
455
+ })), y = P.useMemo(() => Object.defineProperties({}, {
456
+ invalid: {
457
+ enumerable: !0,
458
+ get: () => !!x(d.errors, r)
459
+ },
460
+ isDirty: {
461
+ enumerable: !0,
462
+ get: () => !!x(d.dirtyFields, r)
463
+ },
464
+ isTouched: {
465
+ enumerable: !0,
466
+ get: () => !!x(d.touchedFields, r)
467
+ },
468
+ isValidating: {
469
+ enumerable: !0,
470
+ get: () => !!x(d.validatingFields, r)
471
+ },
472
+ error: {
473
+ enumerable: !0,
474
+ get: () => x(d.errors, r)
475
+ }
476
+ }), [d, r]), v = P.useCallback((B) => _.current.onChange({
477
+ target: {
478
+ value: Ur(B),
479
+ name: r
480
+ },
481
+ type: Ft.CHANGE
482
+ }), [r]), W = P.useCallback(() => _.current.onBlur({
483
+ target: {
484
+ value: x(n._formValues, r),
485
+ name: r
486
+ },
487
+ type: Ft.BLUR
488
+ }), [r, n._formValues]), te = P.useCallback((B) => {
489
+ const pe = x(n._fields, r);
490
+ pe && B && (pe._f.ref = {
491
+ focus: () => B.focus(),
492
+ select: () => B.select(),
493
+ setCustomValidity: (R) => B.setCustomValidity(R),
494
+ reportValidity: () => B.reportValidity()
495
+ });
496
+ }, [n._fields, r]), Z = P.useMemo(() => ({
497
+ name: r,
498
+ value: o,
499
+ ...fe(s) || d.disabled ? { disabled: d.disabled || s } : {},
500
+ onChange: v,
501
+ onBlur: W,
502
+ ref: te
503
+ }), [r, s, d.disabled, v, W, te, o]);
504
+ return P.useEffect(() => {
505
+ const B = n._options.shouldUnregister || a;
506
+ n.register(r, {
507
+ ...f.current.rules,
508
+ ...fe(f.current.disabled) ? { disabled: f.current.disabled } : {}
509
+ });
510
+ const pe = (R, ce) => {
511
+ const re = x(n._fields, R);
512
+ re && re._f && (re._f.mount = ce);
513
+ };
514
+ if (pe(r, !0), B) {
515
+ const R = ee(x(n._options.defaultValues, r));
516
+ D(n._defaultValues, r, R), Y(x(n._formValues, r)) && D(n._formValues, r, R);
517
+ }
518
+ return !i && n.register(r), () => {
519
+ (i ? B && !n._state.action : B) ? n.unregister(r) : pe(r, !1);
520
+ };
521
+ }, [r, n, i, a]), P.useEffect(() => {
522
+ n._setDisabledField({
523
+ disabled: s,
524
+ name: r
525
+ });
526
+ }, [s, r, n]), P.useMemo(() => ({
527
+ field: Z,
528
+ formState: d,
529
+ fieldState: y
530
+ }), [Z, d, y]);
531
+ }
532
+ const De = (t) => t.render(Ms(t));
533
+ var Yr = (t, e, r, s, n) => e ? {
534
+ ...r[t],
535
+ types: {
536
+ ...r[t] && r[t].types ? r[t].types : {},
537
+ [s]: n || !0
538
+ }
539
+ } : {}, ft = (t) => Array.isArray(t) ? t : [t], Tr = () => {
540
+ let t = [];
541
+ return {
542
+ get observers() {
543
+ return t;
544
+ },
545
+ next: (n) => {
546
+ for (const a of t)
547
+ a.next && a.next(n);
548
+ },
549
+ subscribe: (n) => (t.push(n), {
550
+ unsubscribe: () => {
551
+ t = t.filter((a) => a !== n);
552
+ }
553
+ }),
554
+ unsubscribe: () => {
555
+ t = [];
556
+ }
557
+ };
558
+ }, Kt = (t) => ae(t) || !$r(t);
559
+ function Ze(t, e) {
560
+ if (Kt(t) || Kt(e))
561
+ return t === e;
562
+ if (qe(t) && qe(e))
563
+ return t.getTime() === e.getTime();
564
+ const r = Object.keys(t), s = Object.keys(e);
565
+ if (r.length !== s.length)
566
+ return !1;
567
+ for (const n of r) {
568
+ const a = t[n];
569
+ if (!s.includes(n))
570
+ return !1;
571
+ if (n !== "ref") {
572
+ const i = e[n];
573
+ if (qe(a) && qe(i) || J(a) && J(i) || Array.isArray(a) && Array.isArray(i) ? !Ze(a, i) : a !== i)
574
+ return !1;
575
+ }
576
+ }
577
+ return !0;
578
+ }
579
+ var ne = (t) => J(t) && !Object.keys(t).length, lr = (t) => t.type === "file", ge = (t) => typeof t == "function", Pt = (t) => {
580
+ if (!ar)
581
+ return !1;
582
+ const e = t ? t.ownerDocument : 0;
583
+ return t instanceof (e && e.defaultView ? e.defaultView.HTMLElement : HTMLElement);
584
+ }, Jr = (t) => t.type === "select-multiple", ur = (t) => t.type === "radio", Zs = (t) => ur(t) || Nt(t), Gt = (t) => Pt(t) && t.isConnected;
585
+ function Ls(t, e) {
586
+ const r = e.slice(0, -1).length;
587
+ let s = 0;
588
+ for (; s < r; )
589
+ t = Y(t) ? s++ : t[e[s++]];
590
+ return t;
591
+ }
592
+ function $s(t) {
593
+ for (const e in t)
594
+ if (t.hasOwnProperty(e) && !Y(t[e]))
595
+ return !1;
596
+ return !0;
597
+ }
598
+ function X(t, e) {
599
+ const r = Array.isArray(e) ? e : ir(e) ? [e] : Br(e), s = r.length === 1 ? t : Ls(t, r), n = r.length - 1, a = r[n];
600
+ return s && delete s[a], n !== 0 && (J(s) && ne(s) || Array.isArray(s) && $s(s)) && X(t, r.slice(0, -1)), t;
601
+ }
602
+ var Hr = (t) => {
603
+ for (const e in t)
604
+ if (ge(t[e]))
605
+ return !0;
606
+ return !1;
607
+ };
608
+ function It(t, e = {}) {
609
+ const r = Array.isArray(t);
610
+ if (J(t) || r)
611
+ for (const s in t)
612
+ Array.isArray(t[s]) || J(t[s]) && !Hr(t[s]) ? (e[s] = Array.isArray(t[s]) ? [] : {}, It(t[s], e[s])) : ae(t[s]) || (e[s] = !0);
613
+ return e;
614
+ }
615
+ function Gr(t, e, r) {
616
+ const s = Array.isArray(t);
617
+ if (J(t) || s)
618
+ for (const n in t)
619
+ Array.isArray(t[n]) || J(t[n]) && !Hr(t[n]) ? Y(e) || Kt(r[n]) ? r[n] = Array.isArray(t[n]) ? It(t[n], []) : { ...It(t[n]) } : Gr(t[n], ae(e) ? {} : e[n], r[n]) : r[n] = !Ze(t[n], e[n]);
620
+ return r;
621
+ }
622
+ var ut = (t, e) => Gr(t, e, It(e));
623
+ const Sr = {
624
+ value: !1,
625
+ isValid: !1
626
+ }, Ar = { value: !0, isValid: !0 };
627
+ var Xr = (t) => {
628
+ if (Array.isArray(t)) {
629
+ if (t.length > 1) {
630
+ const e = t.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
631
+ return { value: e, isValid: !!e.length };
632
+ }
633
+ return t[0].checked && !t[0].disabled ? (
634
+ // @ts-expect-error expected to work in the browser
635
+ t[0].attributes && !Y(t[0].attributes.value) ? Y(t[0].value) || t[0].value === "" ? Ar : { value: t[0].value, isValid: !0 } : Ar
636
+ ) : Sr;
637
+ }
638
+ return Sr;
639
+ }, Qr = (t, { valueAsNumber: e, valueAsDate: r, setValueAs: s }) => Y(t) ? t : e ? t === "" ? NaN : t && +t : r && Te(t) ? new Date(t) : s ? s(t) : t;
640
+ const jr = {
641
+ isValid: !1,
642
+ value: null
643
+ };
644
+ var Kr = (t) => Array.isArray(t) ? t.reduce((e, r) => r && r.checked && !r.disabled ? {
645
+ isValid: !0,
646
+ value: r.value
647
+ } : e, jr) : jr;
648
+ function Er(t) {
649
+ const e = t.ref;
650
+ return lr(e) ? e.files : ur(e) ? Kr(t.refs).value : Jr(e) ? [...e.selectedOptions].map(({ value: r }) => r) : Nt(e) ? Xr(t.refs).value : Qr(Y(e.value) ? t.ref.value : e.value, t);
651
+ }
652
+ var Us = (t, e, r, s) => {
653
+ const n = {};
654
+ for (const a of t) {
655
+ const i = x(e, a);
656
+ i && D(n, a, i._f);
657
+ }
658
+ return {
659
+ criteriaMode: r,
660
+ names: [...t],
661
+ fields: n,
662
+ shouldUseNativeValidation: s
663
+ };
664
+ }, Dt = (t) => t instanceof RegExp, dt = (t) => Y(t) ? t : Dt(t) ? t.source : J(t) ? Dt(t.value) ? t.value.source : t.value : t, Nr = (t) => ({
665
+ isOnSubmit: !t || t === ye.onSubmit,
666
+ isOnBlur: t === ye.onBlur,
667
+ isOnChange: t === ye.onChange,
668
+ isOnAll: t === ye.all,
669
+ isOnTouch: t === ye.onTouched
670
+ });
671
+ const Cr = "AsyncFunction";
672
+ var zs = (t) => !!t && !!t.validate && !!(ge(t.validate) && t.validate.constructor.name === Cr || J(t.validate) && Object.values(t.validate).find((e) => e.constructor.name === Cr)), Bs = (t) => t.mount && (t.required || t.min || t.max || t.maxLength || t.minLength || t.pattern || t.validate), Rr = (t, e, r) => !r && (e.watchAll || e.watch.has(t) || [...e.watch].some((s) => t.startsWith(s) && /^\.\w+/.test(t.slice(s.length))));
673
+ const ht = (t, e, r, s) => {
674
+ for (const n of r || Object.keys(t)) {
675
+ const a = x(t, n);
676
+ if (a) {
677
+ const { _f: i, ...o } = a;
678
+ if (i) {
679
+ if (i.refs && i.refs[0] && e(i.refs[0], n) && !s)
680
+ return !0;
681
+ if (i.ref && e(i.ref, i.name) && !s)
682
+ return !0;
683
+ if (ht(o, e))
684
+ break;
685
+ } else if (J(o) && ht(o, e))
686
+ break;
687
+ }
688
+ }
689
+ };
690
+ function Or(t, e, r) {
691
+ const s = x(t, r);
692
+ if (s || ir(r))
693
+ return {
694
+ error: s,
695
+ name: r
696
+ };
697
+ const n = r.split(".");
698
+ for (; n.length; ) {
699
+ const a = n.join("."), i = x(e, a), o = x(t, a);
700
+ if (i && !Array.isArray(i) && r !== a)
701
+ return { name: r };
702
+ if (o && o.type)
703
+ return {
704
+ name: a,
705
+ error: o
706
+ };
707
+ n.pop();
708
+ }
709
+ return {
710
+ name: r
711
+ };
712
+ }
713
+ var Ws = (t, e, r, s) => {
714
+ r(t);
715
+ const { name: n, ...a } = t;
716
+ return ne(a) || Object.keys(a).length >= Object.keys(e).length || Object.keys(a).find((i) => e[i] === (!s || ye.all));
717
+ }, qs = (t, e, r) => !t || !e || t === e || ft(t).some((s) => s && (r ? s === e : s.startsWith(e) || e.startsWith(s))), Ys = (t, e, r, s, n) => n.isOnAll ? !1 : !r && n.isOnTouch ? !(e || t) : (r ? s.isOnBlur : n.isOnBlur) ? !t : (r ? s.isOnChange : n.isOnChange) ? t : !0, Js = (t, e) => !Wt(x(t, e)).length && X(t, e), Hs = (t, e, r) => {
718
+ const s = ft(x(t, r));
719
+ return D(s, "root", e[r]), D(t, r, s), t;
720
+ }, Vt = (t) => Te(t);
721
+ function Vr(t, e, r = "validate") {
722
+ if (Vt(t) || Array.isArray(t) && t.every(Vt) || fe(t) && !t)
723
+ return {
724
+ type: r,
725
+ message: Vt(t) ? t : "",
726
+ ref: e
727
+ };
728
+ }
729
+ var et = (t) => J(t) && !Dt(t) ? t : {
730
+ value: t,
731
+ message: ""
732
+ }, Fr = async (t, e, r, s, n, a) => {
733
+ const { ref: i, refs: o, required: d, maxLength: f, minLength: _, min: y, max: v, pattern: W, validate: te, name: Z, valueAsNumber: B, mount: pe } = t._f, R = x(r, Z);
734
+ if (!pe || e.has(Z))
735
+ return {};
736
+ const ce = o ? o[0] : i, re = (V) => {
737
+ n && ce.reportValidity && (ce.setCustomValidity(fe(V) ? "" : V || ""), ce.reportValidity());
738
+ }, q = {}, Xe = ur(i), xe = Nt(i), Qe = Xe || xe, le = (B || lr(i)) && Y(i.value) && Y(R) || Pt(i) && i.value === "" || R === "" || Array.isArray(R) && !R.length, Ee = Yr.bind(null, Z, s, q), oe = (V, I, $, Q = Ce.maxLength, K = Ce.minLength) => {
739
+ const ue = V ? I : $;
740
+ q[Z] = {
741
+ type: V ? Q : K,
742
+ message: ue,
743
+ ref: i,
744
+ ...Ee(V ? Q : K, ue)
745
+ };
746
+ };
747
+ if (a ? !Array.isArray(R) || !R.length : d && (!Qe && (le || ae(R)) || fe(R) && !R || xe && !Xr(o).isValid || Xe && !Kr(o).isValid)) {
748
+ const { value: V, message: I } = Vt(d) ? { value: !!d, message: d } : et(d);
749
+ if (V && (q[Z] = {
750
+ type: Ce.required,
751
+ message: I,
752
+ ref: ce,
753
+ ...Ee(Ce.required, I)
754
+ }, !s))
755
+ return re(I), q;
756
+ }
757
+ if (!le && (!ae(y) || !ae(v))) {
758
+ let V, I;
759
+ const $ = et(v), Q = et(y);
760
+ if (!ae(R) && !isNaN(R)) {
761
+ const K = i.valueAsNumber || R && +R;
762
+ ae($.value) || (V = K > $.value), ae(Q.value) || (I = K < Q.value);
763
+ } else {
764
+ const K = i.valueAsDate || new Date(R), ue = (h) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + h), Pe = i.type == "time", Ne = i.type == "week";
765
+ Te($.value) && R && (V = Pe ? ue(R) > ue($.value) : Ne ? R > $.value : K > new Date($.value)), Te(Q.value) && R && (I = Pe ? ue(R) < ue(Q.value) : Ne ? R < Q.value : K < new Date(Q.value));
766
+ }
767
+ if ((V || I) && (oe(!!V, $.message, Q.message, Ce.max, Ce.min), !s))
768
+ return re(q[Z].message), q;
769
+ }
770
+ if ((f || _) && !le && (Te(R) || a && Array.isArray(R))) {
771
+ const V = et(f), I = et(_), $ = !ae(V.value) && R.length > +V.value, Q = !ae(I.value) && R.length < +I.value;
772
+ if (($ || Q) && (oe($, V.message, I.message), !s))
773
+ return re(q[Z].message), q;
774
+ }
775
+ if (W && !le && Te(R)) {
776
+ const { value: V, message: I } = et(W);
777
+ if (Dt(V) && !R.match(V) && (q[Z] = {
778
+ type: Ce.pattern,
779
+ message: I,
780
+ ref: i,
781
+ ...Ee(Ce.pattern, I)
782
+ }, !s))
783
+ return re(I), q;
784
+ }
785
+ if (te) {
786
+ if (ge(te)) {
787
+ const V = await te(R, r), I = Vr(V, ce);
788
+ if (I && (q[Z] = {
789
+ ...I,
790
+ ...Ee(Ce.validate, I.message)
791
+ }, !s))
792
+ return re(I.message), q;
793
+ } else if (J(te)) {
794
+ let V = {};
795
+ for (const I in te) {
796
+ if (!ne(V) && !s)
797
+ break;
798
+ const $ = Vr(await te[I](R, r), ce, I);
799
+ $ && (V = {
800
+ ...$,
801
+ ...Ee(I, $.message)
802
+ }, re($.message), s && (q[Z] = V));
803
+ }
804
+ if (!ne(V) && (q[Z] = {
805
+ ref: ce,
806
+ ...V
807
+ }, !s))
808
+ return q;
809
+ }
810
+ }
811
+ return re(!0), q;
812
+ };
813
+ const Gs = {
814
+ mode: ye.onSubmit,
815
+ reValidateMode: ye.onChange,
816
+ shouldFocusError: !0
817
+ };
818
+ function Xs(t = {}) {
819
+ let e = {
820
+ ...Gs,
821
+ ...t
822
+ }, r = {
823
+ submitCount: 0,
824
+ isDirty: !1,
825
+ isReady: !1,
826
+ isLoading: ge(e.defaultValues),
827
+ isValidating: !1,
828
+ isSubmitted: !1,
829
+ isSubmitting: !1,
830
+ isSubmitSuccessful: !1,
831
+ isValid: !1,
832
+ touchedFields: {},
833
+ dirtyFields: {},
834
+ validatingFields: {},
835
+ errors: e.errors || {},
836
+ disabled: e.disabled || !1
837
+ };
838
+ const s = {};
839
+ let n = J(e.defaultValues) || J(e.values) ? ee(e.defaultValues || e.values) || {} : {}, a = e.shouldUnregister ? {} : ee(n), i = {
840
+ action: !1,
841
+ mount: !1,
842
+ watch: !1
843
+ }, o = {
844
+ mount: /* @__PURE__ */ new Set(),
845
+ disabled: /* @__PURE__ */ new Set(),
846
+ unMount: /* @__PURE__ */ new Set(),
847
+ array: /* @__PURE__ */ new Set(),
848
+ watch: /* @__PURE__ */ new Set()
849
+ }, d, f = 0;
850
+ const _ = {
851
+ isDirty: !1,
852
+ dirtyFields: !1,
853
+ validatingFields: !1,
854
+ touchedFields: !1,
855
+ isValidating: !1,
856
+ isValid: !1,
857
+ errors: !1
858
+ };
859
+ let y = {
860
+ ..._
861
+ };
862
+ const v = {
863
+ array: Tr(),
864
+ state: Tr()
865
+ }, W = e.criteriaMode === ye.all, te = (c) => (l) => {
866
+ clearTimeout(f), f = setTimeout(c, l);
867
+ }, Z = async (c) => {
868
+ if (!e.disabled && (_.isValid || y.isValid || c)) {
869
+ const l = e.resolver ? ne((await xe()).errors) : await le(s, !0);
870
+ l !== r.isValid && v.state.next({
871
+ isValid: l
872
+ });
873
+ }
874
+ }, B = (c, l) => {
875
+ !e.disabled && (_.isValidating || _.validatingFields || y.isValidating || y.validatingFields) && ((c || Array.from(o.mount)).forEach((u) => {
876
+ u && (l ? D(r.validatingFields, u, l) : X(r.validatingFields, u));
877
+ }), v.state.next({
878
+ validatingFields: r.validatingFields,
879
+ isValidating: !ne(r.validatingFields)
880
+ }));
881
+ }, pe = (c, l = [], u, w, b = !0, g = !0) => {
882
+ if (w && u && !e.disabled) {
883
+ if (i.action = !0, g && Array.isArray(x(s, c))) {
884
+ const A = u(x(s, c), w.argA, w.argB);
885
+ b && D(s, c, A);
886
+ }
887
+ if (g && Array.isArray(x(r.errors, c))) {
888
+ const A = u(x(r.errors, c), w.argA, w.argB);
889
+ b && D(r.errors, c, A), Js(r.errors, c);
890
+ }
891
+ if ((_.touchedFields || y.touchedFields) && g && Array.isArray(x(r.touchedFields, c))) {
892
+ const A = u(x(r.touchedFields, c), w.argA, w.argB);
893
+ b && D(r.touchedFields, c, A);
894
+ }
895
+ (_.dirtyFields || y.dirtyFields) && (r.dirtyFields = ut(n, a)), v.state.next({
896
+ name: c,
897
+ isDirty: oe(c, l),
898
+ dirtyFields: r.dirtyFields,
899
+ errors: r.errors,
900
+ isValid: r.isValid
901
+ });
902
+ } else
903
+ D(a, c, l);
904
+ }, R = (c, l) => {
905
+ D(r.errors, c, l), v.state.next({
906
+ errors: r.errors
907
+ });
908
+ }, ce = (c) => {
909
+ r.errors = c, v.state.next({
910
+ errors: r.errors,
911
+ isValid: !1
912
+ });
913
+ }, re = (c, l, u, w) => {
914
+ const b = x(s, c);
915
+ if (b) {
916
+ const g = x(a, c, Y(u) ? x(n, c) : u);
917
+ Y(g) || w && w.defaultChecked || l ? D(a, c, l ? g : Er(b._f)) : $(c, g), i.mount && Z();
918
+ }
919
+ }, q = (c, l, u, w, b) => {
920
+ let g = !1, A = !1;
921
+ const M = {
922
+ name: c
923
+ };
924
+ if (!e.disabled) {
925
+ if (!u || w) {
926
+ (_.isDirty || y.isDirty) && (A = r.isDirty, r.isDirty = M.isDirty = oe(), g = A !== M.isDirty);
927
+ const L = Ze(x(n, c), l);
928
+ A = !!x(r.dirtyFields, c), L ? X(r.dirtyFields, c) : D(r.dirtyFields, c, !0), M.dirtyFields = r.dirtyFields, g = g || (_.dirtyFields || y.dirtyFields) && A !== !L;
929
+ }
930
+ if (u) {
931
+ const L = x(r.touchedFields, c);
932
+ L || (D(r.touchedFields, c, u), M.touchedFields = r.touchedFields, g = g || (_.touchedFields || y.touchedFields) && L !== u);
933
+ }
934
+ g && b && v.state.next(M);
935
+ }
936
+ return g ? M : {};
937
+ }, Xe = (c, l, u, w) => {
938
+ const b = x(r.errors, c), g = (_.isValid || y.isValid) && fe(l) && r.isValid !== l;
939
+ if (e.delayError && u ? (d = te(() => R(c, u)), d(e.delayError)) : (clearTimeout(f), d = null, u ? D(r.errors, c, u) : X(r.errors, c)), (u ? !Ze(b, u) : b) || !ne(w) || g) {
940
+ const A = {
941
+ ...w,
942
+ ...g && fe(l) ? { isValid: l } : {},
943
+ errors: r.errors,
944
+ name: c
945
+ };
946
+ r = {
947
+ ...r,
948
+ ...A
949
+ }, v.state.next(A);
950
+ }
951
+ }, xe = async (c) => {
952
+ B(c, !0);
953
+ const l = await e.resolver(a, e.context, Us(c || o.mount, s, e.criteriaMode, e.shouldUseNativeValidation));
954
+ return B(c), l;
955
+ }, Qe = async (c) => {
956
+ const { errors: l } = await xe(c);
957
+ if (c)
958
+ for (const u of c) {
959
+ const w = x(l, u);
960
+ w ? D(r.errors, u, w) : X(r.errors, u);
961
+ }
962
+ else
963
+ r.errors = l;
964
+ return l;
965
+ }, le = async (c, l, u = {
966
+ valid: !0
967
+ }) => {
968
+ for (const w in c) {
969
+ const b = c[w];
970
+ if (b) {
971
+ const { _f: g, ...A } = b;
972
+ if (g) {
973
+ const M = o.array.has(g.name), L = b._f && zs(b._f);
974
+ L && _.validatingFields && B([w], !0);
975
+ const me = await Fr(b, o.disabled, a, W, e.shouldUseNativeValidation && !l, M);
976
+ if (L && _.validatingFields && B([w]), me[g.name] && (u.valid = !1, l))
977
+ break;
978
+ !l && (x(me, g.name) ? M ? Hs(r.errors, me, g.name) : D(r.errors, g.name, me[g.name]) : X(r.errors, g.name));
979
+ }
980
+ !ne(A) && await le(A, l, u);
981
+ }
982
+ }
983
+ return u.valid;
984
+ }, Ee = () => {
985
+ for (const c of o.unMount) {
986
+ const l = x(s, c);
987
+ l && (l._f.refs ? l._f.refs.every((u) => !Gt(u)) : !Gt(l._f.ref)) && Be(c);
988
+ }
989
+ o.unMount = /* @__PURE__ */ new Set();
990
+ }, oe = (c, l) => !e.disabled && (c && l && D(a, c, l), !Ze(h(), n)), V = (c, l, u) => qr(c, o, {
991
+ ...i.mount ? a : Y(l) ? n : Te(c) ? { [c]: l } : l
992
+ }, u, l), I = (c) => Wt(x(i.mount ? a : n, c, e.shouldUnregister ? x(n, c, []) : [])), $ = (c, l, u = {}) => {
993
+ const w = x(s, c);
994
+ let b = l;
995
+ if (w) {
996
+ const g = w._f;
997
+ g && (!g.disabled && D(a, c, Qr(l, g)), b = Pt(g.ref) && ae(l) ? "" : l, Jr(g.ref) ? [...g.ref.options].forEach((A) => A.selected = b.includes(A.value)) : g.refs ? Nt(g.ref) ? g.refs.forEach((A) => {
998
+ (!A.defaultChecked || !A.disabled) && (Array.isArray(b) ? A.checked = !!b.find((M) => M === A.value) : A.checked = b === A.value || !!b);
999
+ }) : g.refs.forEach((A) => A.checked = A.value === b) : lr(g.ref) ? g.ref.value = "" : (g.ref.value = b, g.ref.type || v.state.next({
1000
+ name: c,
1001
+ values: ee(a)
1002
+ })));
1003
+ }
1004
+ (u.shouldDirty || u.shouldTouch) && q(c, b, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && Ne(c);
1005
+ }, Q = (c, l, u) => {
1006
+ for (const w in l) {
1007
+ if (!l.hasOwnProperty(w))
1008
+ return;
1009
+ const b = l[w], g = `${c}.${w}`, A = x(s, g);
1010
+ (o.array.has(c) || J(b) || A && !A._f) && !qe(b) ? Q(g, b, u) : $(g, b, u);
1011
+ }
1012
+ }, K = (c, l, u = {}) => {
1013
+ const w = x(s, c), b = o.array.has(c), g = ee(l);
1014
+ D(a, c, g), b ? (v.array.next({
1015
+ name: c,
1016
+ values: ee(a)
1017
+ }), (_.isDirty || _.dirtyFields || y.isDirty || y.dirtyFields) && u.shouldDirty && v.state.next({
1018
+ name: c,
1019
+ dirtyFields: ut(n, a),
1020
+ isDirty: oe(c, g)
1021
+ })) : w && !w._f && !ae(g) ? Q(c, g, u) : $(c, g, u), Rr(c, o) && v.state.next({ ...r }), v.state.next({
1022
+ name: i.mount ? c : void 0,
1023
+ values: ee(a)
1024
+ });
1025
+ }, ue = async (c) => {
1026
+ i.mount = !0;
1027
+ const l = c.target;
1028
+ let u = l.name, w = !0;
1029
+ const b = x(s, u), g = (L) => {
1030
+ w = Number.isNaN(L) || qe(L) && isNaN(L.getTime()) || Ze(L, x(a, u, L));
1031
+ }, A = Nr(e.mode), M = Nr(e.reValidateMode);
1032
+ if (b) {
1033
+ let L, me;
1034
+ const Rt = l.type ? Er(b._f) : Ur(c), Ie = c.type === Ft.BLUR || c.type === Ft.FOCUS_OUT, hs = !Bs(b._f) && !e.resolver && !x(r.errors, u) && !b._f.deps || Ys(Ie, x(r.touchedFields, u), r.isSubmitted, M, A), Jt = Rr(u, o, Ie);
1035
+ D(a, u, Rt), Ie ? (b._f.onBlur && b._f.onBlur(c), d && d(0)) : b._f.onChange && b._f.onChange(c);
1036
+ const Ht = q(u, Rt, Ie), ms = !ne(Ht) || Jt;
1037
+ if (!Ie && v.state.next({
1038
+ name: u,
1039
+ type: c.type,
1040
+ values: ee(a)
1041
+ }), hs)
1042
+ return (_.isValid || y.isValid) && (e.mode === "onBlur" ? Ie && Z() : Ie || Z()), ms && v.state.next({ name: u, ...Jt ? {} : Ht });
1043
+ if (!Ie && Jt && v.state.next({ ...r }), e.resolver) {
1044
+ const { errors: yr } = await xe([u]);
1045
+ if (g(Rt), w) {
1046
+ const ps = Or(r.errors, s, u), gr = Or(yr, s, ps.name || u);
1047
+ L = gr.error, u = gr.name, me = ne(yr);
1048
+ }
1049
+ } else
1050
+ B([u], !0), L = (await Fr(b, o.disabled, a, W, e.shouldUseNativeValidation))[u], B([u]), g(Rt), w && (L ? me = !1 : (_.isValid || y.isValid) && (me = await le(s, !0)));
1051
+ w && (b._f.deps && Ne(b._f.deps), Xe(u, me, L, Ht));
1052
+ }
1053
+ }, Pe = (c, l) => {
1054
+ if (x(r.errors, l) && c.focus)
1055
+ return c.focus(), 1;
1056
+ }, Ne = async (c, l = {}) => {
1057
+ let u, w;
1058
+ const b = ft(c);
1059
+ if (e.resolver) {
1060
+ const g = await Qe(Y(c) ? c : b);
1061
+ u = ne(g), w = c ? !b.some((A) => x(g, A)) : u;
1062
+ } else c ? (w = (await Promise.all(b.map(async (g) => {
1063
+ const A = x(s, g);
1064
+ return await le(A && A._f ? { [g]: A } : A);
1065
+ }))).every(Boolean), !(!w && !r.isValid) && Z()) : w = u = await le(s);
1066
+ return v.state.next({
1067
+ ...!Te(c) || (_.isValid || y.isValid) && u !== r.isValid ? {} : { name: c },
1068
+ ...e.resolver || !c ? { isValid: u } : {},
1069
+ errors: r.errors
1070
+ }), l.shouldFocus && !w && ht(s, Pe, c ? b : o.mount), w;
1071
+ }, h = (c) => {
1072
+ const l = {
1073
+ ...i.mount ? a : n
1074
+ };
1075
+ return Y(c) ? l : Te(c) ? x(l, c) : c.map((u) => x(l, u));
1076
+ }, C = (c, l) => ({
1077
+ invalid: !!x((l || r).errors, c),
1078
+ isDirty: !!x((l || r).dirtyFields, c),
1079
+ error: x((l || r).errors, c),
1080
+ isValidating: !!x(r.validatingFields, c),
1081
+ isTouched: !!x((l || r).touchedFields, c)
1082
+ }), U = (c) => {
1083
+ c && ft(c).forEach((l) => X(r.errors, l)), v.state.next({
1084
+ errors: c ? r.errors : {}
1085
+ });
1086
+ }, H = (c, l, u) => {
1087
+ const w = (x(s, c, { _f: {} })._f || {}).ref, b = x(r.errors, c) || {}, { ref: g, message: A, type: M, ...L } = b;
1088
+ D(r.errors, c, {
1089
+ ...L,
1090
+ ...l,
1091
+ ref: w
1092
+ }), v.state.next({
1093
+ name: c,
1094
+ errors: r.errors,
1095
+ isValid: !1
1096
+ }), u && u.shouldFocus && w && w.focus && w.focus();
1097
+ }, ke = (c, l) => ge(c) ? v.state.subscribe({
1098
+ next: (u) => c(V(void 0, l), u)
1099
+ }) : V(c, l, !0), de = (c) => v.state.subscribe({
1100
+ next: (l) => {
1101
+ qs(c.name, l.name, c.exact) && Ws(l, c.formState || _, fs, c.reRenderRoot) && c.callback({
1102
+ values: { ...a },
1103
+ ...r,
1104
+ ...l
1105
+ });
1106
+ }
1107
+ }).unsubscribe, ot = (c) => (i.mount = !0, y = {
1108
+ ...y,
1109
+ ...c.formState
1110
+ }, de({
1111
+ ...c,
1112
+ formState: y
1113
+ })), Be = (c, l = {}) => {
1114
+ for (const u of c ? ft(c) : o.mount)
1115
+ o.mount.delete(u), o.array.delete(u), l.keepValue || (X(s, u), X(a, u)), !l.keepError && X(r.errors, u), !l.keepDirty && X(r.dirtyFields, u), !l.keepTouched && X(r.touchedFields, u), !l.keepIsValidating && X(r.validatingFields, u), !e.shouldUnregister && !l.keepDefaultValue && X(n, u);
1116
+ v.state.next({
1117
+ values: ee(a)
1118
+ }), v.state.next({
1119
+ ...r,
1120
+ ...l.keepDirty ? { isDirty: oe() } : {}
1121
+ }), !l.keepIsValid && Z();
1122
+ }, G = ({ disabled: c, name: l }) => {
1123
+ (fe(c) && i.mount || c || o.disabled.has(l)) && (c ? o.disabled.add(l) : o.disabled.delete(l));
1124
+ }, we = (c, l = {}) => {
1125
+ let u = x(s, c);
1126
+ const w = fe(l.disabled) || fe(e.disabled);
1127
+ return D(s, c, {
1128
+ ...u || {},
1129
+ _f: {
1130
+ ...u && u._f ? u._f : { ref: { name: c } },
1131
+ name: c,
1132
+ mount: !0,
1133
+ ...l
1134
+ }
1135
+ }), o.mount.add(c), u ? G({
1136
+ disabled: fe(l.disabled) ? l.disabled : e.disabled,
1137
+ name: c
1138
+ }) : re(c, !0, l.value), {
1139
+ ...w ? { disabled: l.disabled || e.disabled } : {},
1140
+ ...e.progressive ? {
1141
+ required: !!l.required,
1142
+ min: dt(l.min),
1143
+ max: dt(l.max),
1144
+ minLength: dt(l.minLength),
1145
+ maxLength: dt(l.maxLength),
1146
+ pattern: dt(l.pattern)
1147
+ } : {},
1148
+ name: c,
1149
+ onChange: ue,
1150
+ onBlur: ue,
1151
+ ref: (b) => {
1152
+ if (b) {
1153
+ we(c, l), u = x(s, c);
1154
+ const g = Y(b.value) && b.querySelectorAll && b.querySelectorAll("input,select,textarea")[0] || b, A = Zs(g), M = u._f.refs || [];
1155
+ if (A ? M.find((L) => L === g) : g === u._f.ref)
1156
+ return;
1157
+ D(s, c, {
1158
+ _f: {
1159
+ ...u._f,
1160
+ ...A ? {
1161
+ refs: [
1162
+ ...M.filter(Gt),
1163
+ g,
1164
+ ...Array.isArray(x(n, c)) ? [{}] : []
1165
+ ],
1166
+ ref: { type: g.type, name: c }
1167
+ } : { ref: g }
1168
+ }
1169
+ }), re(c, !1, void 0, g);
1170
+ } else
1171
+ u = x(s, c, {}), u._f && (u._f.mount = !1), (e.shouldUnregister || l.shouldUnregister) && !(zr(o.array, c) && i.action) && o.unMount.add(c);
1172
+ }
1173
+ };
1174
+ }, Ke = () => e.shouldFocusError && ht(s, Pe, o.mount), Yt = (c) => {
1175
+ fe(c) && (v.state.next({ disabled: c }), ht(s, (l, u) => {
1176
+ const w = x(s, u);
1177
+ w && (l.disabled = w._f.disabled || c, Array.isArray(w._f.refs) && w._f.refs.forEach((b) => {
1178
+ b.disabled = w._f.disabled || c;
1179
+ }));
1180
+ }, 0, !1));
1181
+ }, fr = (c, l) => async (u) => {
1182
+ let w;
1183
+ u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
1184
+ let b = ee(a);
1185
+ if (v.state.next({
1186
+ isSubmitting: !0
1187
+ }), e.resolver) {
1188
+ const { errors: g, values: A } = await xe();
1189
+ r.errors = g, b = A;
1190
+ } else
1191
+ await le(s);
1192
+ if (o.disabled.size)
1193
+ for (const g of o.disabled)
1194
+ D(b, g, void 0);
1195
+ if (X(r.errors, "root"), ne(r.errors)) {
1196
+ v.state.next({
1197
+ errors: {}
1198
+ });
1199
+ try {
1200
+ await c(b, u);
1201
+ } catch (g) {
1202
+ w = g;
1203
+ }
1204
+ } else
1205
+ l && await l({ ...r.errors }, u), Ke(), setTimeout(Ke);
1206
+ if (v.state.next({
1207
+ isSubmitted: !0,
1208
+ isSubmitting: !1,
1209
+ isSubmitSuccessful: ne(r.errors) && !w,
1210
+ submitCount: r.submitCount + 1,
1211
+ errors: r.errors
1212
+ }), w)
1213
+ throw w;
1214
+ }, us = (c, l = {}) => {
1215
+ x(s, c) && (Y(l.defaultValue) ? K(c, ee(x(n, c))) : (K(c, l.defaultValue), D(n, c, ee(l.defaultValue))), l.keepTouched || X(r.touchedFields, c), l.keepDirty || (X(r.dirtyFields, c), r.isDirty = l.defaultValue ? oe(c, ee(x(n, c))) : oe()), l.keepError || (X(r.errors, c), _.isValid && Z()), v.state.next({ ...r }));
1216
+ }, hr = (c, l = {}) => {
1217
+ const u = c ? ee(c) : n, w = ee(u), b = ne(c), g = b ? n : w;
1218
+ if (l.keepDefaultValues || (n = u), !l.keepValues) {
1219
+ if (l.keepDirtyValues) {
1220
+ const A = /* @__PURE__ */ new Set([
1221
+ ...o.mount,
1222
+ ...Object.keys(ut(n, a))
1223
+ ]);
1224
+ for (const M of Array.from(A))
1225
+ x(r.dirtyFields, M) ? D(g, M, x(a, M)) : K(M, x(g, M));
1226
+ } else {
1227
+ if (ar && Y(c))
1228
+ for (const A of o.mount) {
1229
+ const M = x(s, A);
1230
+ if (M && M._f) {
1231
+ const L = Array.isArray(M._f.refs) ? M._f.refs[0] : M._f.ref;
1232
+ if (Pt(L)) {
1233
+ const me = L.closest("form");
1234
+ if (me) {
1235
+ me.reset();
1236
+ break;
1237
+ }
1238
+ }
1239
+ }
1240
+ }
1241
+ for (const A of o.mount)
1242
+ K(A, x(g, A));
1243
+ }
1244
+ a = ee(g), v.array.next({
1245
+ values: { ...g }
1246
+ }), v.state.next({
1247
+ values: { ...g }
1248
+ });
1249
+ }
1250
+ o = {
1251
+ mount: l.keepDirtyValues ? o.mount : /* @__PURE__ */ new Set(),
1252
+ unMount: /* @__PURE__ */ new Set(),
1253
+ array: /* @__PURE__ */ new Set(),
1254
+ disabled: /* @__PURE__ */ new Set(),
1255
+ watch: /* @__PURE__ */ new Set(),
1256
+ watchAll: !1,
1257
+ focus: ""
1258
+ }, i.mount = !_.isValid || !!l.keepIsValid || !!l.keepDirtyValues, i.watch = !!e.shouldUnregister, v.state.next({
1259
+ submitCount: l.keepSubmitCount ? r.submitCount : 0,
1260
+ isDirty: b ? !1 : l.keepDirty ? r.isDirty : !!(l.keepDefaultValues && !Ze(c, n)),
1261
+ isSubmitted: l.keepIsSubmitted ? r.isSubmitted : !1,
1262
+ dirtyFields: b ? {} : l.keepDirtyValues ? l.keepDefaultValues && a ? ut(n, a) : r.dirtyFields : l.keepDefaultValues && c ? ut(n, c) : l.keepDirty ? r.dirtyFields : {},
1263
+ touchedFields: l.keepTouched ? r.touchedFields : {},
1264
+ errors: l.keepErrors ? r.errors : {},
1265
+ isSubmitSuccessful: l.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
1266
+ isSubmitting: !1
1267
+ });
1268
+ }, mr = (c, l) => hr(ge(c) ? c(a) : c, l), ds = (c, l = {}) => {
1269
+ const u = x(s, c), w = u && u._f;
1270
+ if (w) {
1271
+ const b = w.refs ? w.refs[0] : w.ref;
1272
+ b.focus && (b.focus(), l.shouldSelect && ge(b.select) && b.select());
1273
+ }
1274
+ }, fs = (c) => {
1275
+ r = {
1276
+ ...r,
1277
+ ...c
1278
+ };
1279
+ }, pr = {
1280
+ control: {
1281
+ register: we,
1282
+ unregister: Be,
1283
+ getFieldState: C,
1284
+ handleSubmit: fr,
1285
+ setError: H,
1286
+ _subscribe: de,
1287
+ _runSchema: xe,
1288
+ _getWatch: V,
1289
+ _getDirty: oe,
1290
+ _setValid: Z,
1291
+ _setFieldArray: pe,
1292
+ _setDisabledField: G,
1293
+ _setErrors: ce,
1294
+ _getFieldArray: I,
1295
+ _reset: hr,
1296
+ _resetDefaultValues: () => ge(e.defaultValues) && e.defaultValues().then((c) => {
1297
+ mr(c, e.resetOptions), v.state.next({
1298
+ isLoading: !1
1299
+ });
1300
+ }),
1301
+ _removeUnmounted: Ee,
1302
+ _disableForm: Yt,
1303
+ _subjects: v,
1304
+ _proxyFormState: _,
1305
+ get _fields() {
1306
+ return s;
1307
+ },
1308
+ get _formValues() {
1309
+ return a;
1310
+ },
1311
+ get _state() {
1312
+ return i;
1313
+ },
1314
+ set _state(c) {
1315
+ i = c;
1316
+ },
1317
+ get _defaultValues() {
1318
+ return n;
1319
+ },
1320
+ get _names() {
1321
+ return o;
1322
+ },
1323
+ set _names(c) {
1324
+ o = c;
1325
+ },
1326
+ get _formState() {
1327
+ return r;
1328
+ },
1329
+ get _options() {
1330
+ return e;
1331
+ },
1332
+ set _options(c) {
1333
+ e = {
1334
+ ...e,
1335
+ ...c
1336
+ };
1337
+ }
1338
+ },
1339
+ subscribe: ot,
1340
+ trigger: Ne,
1341
+ register: we,
1342
+ handleSubmit: fr,
1343
+ watch: ke,
1344
+ setValue: K,
1345
+ getValues: h,
1346
+ reset: mr,
1347
+ resetField: us,
1348
+ clearErrors: U,
1349
+ unregister: Be,
1350
+ setError: H,
1351
+ setFocus: ds,
1352
+ getFieldState: C
1353
+ };
1354
+ return {
1355
+ ...pr,
1356
+ formControl: pr
1357
+ };
1358
+ }
1359
+ function Qs(t = {}) {
1360
+ const e = P.useRef(void 0), r = P.useRef(void 0), [s, n] = P.useState({
1361
+ isDirty: !1,
1362
+ isValidating: !1,
1363
+ isLoading: ge(t.defaultValues),
1364
+ isSubmitted: !1,
1365
+ isSubmitting: !1,
1366
+ isSubmitSuccessful: !1,
1367
+ isValid: !1,
1368
+ submitCount: 0,
1369
+ dirtyFields: {},
1370
+ touchedFields: {},
1371
+ validatingFields: {},
1372
+ errors: t.errors || {},
1373
+ disabled: t.disabled || !1,
1374
+ isReady: !1,
1375
+ defaultValues: ge(t.defaultValues) ? void 0 : t.defaultValues
1376
+ });
1377
+ e.current || (e.current = {
1378
+ ...t.formControl ? t.formControl : Xs(t),
1379
+ formState: s
1380
+ }, t.formControl && t.defaultValues && !ge(t.defaultValues) && t.formControl.reset(t.defaultValues, t.resetOptions));
1381
+ const a = e.current.control;
1382
+ return a._options = t, cr(() => {
1383
+ const i = a._subscribe({
1384
+ formState: a._proxyFormState,
1385
+ callback: () => n({ ...a._formState }),
1386
+ reRenderRoot: !0
1387
+ });
1388
+ return n((o) => ({
1389
+ ...o,
1390
+ isReady: !0
1391
+ })), a._formState.isReady = !0, i;
1392
+ }, [a]), P.useEffect(() => a._disableForm(t.disabled), [a, t.disabled]), P.useEffect(() => {
1393
+ t.mode && (a._options.mode = t.mode), t.reValidateMode && (a._options.reValidateMode = t.reValidateMode), t.errors && !ne(t.errors) && a._setErrors(t.errors);
1394
+ }, [a, t.errors, t.mode, t.reValidateMode]), P.useEffect(() => {
1395
+ t.shouldUnregister && a._subjects.state.next({
1396
+ values: a._getWatch()
1397
+ });
1398
+ }, [a, t.shouldUnregister]), P.useEffect(() => {
1399
+ if (a._proxyFormState.isDirty) {
1400
+ const i = a._getDirty();
1401
+ i !== s.isDirty && a._subjects.state.next({
1402
+ isDirty: i
1403
+ });
1404
+ }
1405
+ }, [a, s.isDirty]), P.useEffect(() => {
1406
+ t.values && !Ze(t.values, r.current) ? (a._reset(t.values, a._options.resetOptions), r.current = t.values, n((i) => ({ ...i }))) : a._resetDefaultValues();
1407
+ }, [a, t.values]), P.useEffect(() => {
1408
+ a._state.mount || (a._setValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
1409
+ }), e.current.formState = Wr(s, a), e.current;
1410
+ }
1411
+ const Pr = (t, e, r) => {
1412
+ if (t && "reportValidity" in t) {
1413
+ const s = x(r, e);
1414
+ t.setCustomValidity(s && s.message || ""), t.reportValidity();
1415
+ }
1416
+ }, es = (t, e) => {
1417
+ for (const r in e.fields) {
1418
+ const s = e.fields[r];
1419
+ s && s.ref && "reportValidity" in s.ref ? Pr(s.ref, r, t) : s && s.refs && s.refs.forEach((n) => Pr(n, r, t));
1420
+ }
1421
+ }, Ks = (t, e) => {
1422
+ e.shouldUseNativeValidation && es(t, e);
1423
+ const r = {};
1424
+ for (const s in t) {
1425
+ const n = x(e.fields, s), a = Object.assign(t[s] || {}, { ref: n && n.ref });
1426
+ if (en(e.names || Object.keys(t), s)) {
1427
+ const i = Object.assign({}, x(r, s));
1428
+ D(i, "root", a), D(r, s, i);
1429
+ } else D(r, s, a);
1430
+ }
1431
+ return r;
1432
+ }, en = (t, e) => {
1433
+ const r = Ir(e);
1434
+ return t.some((s) => Ir(s).match(`^${r}\\.\\d+`));
1435
+ };
1436
+ function Ir(t) {
1437
+ return t.replace(/\]|\[/g, "");
1438
+ }
1439
+ function tn(t, e) {
1440
+ for (var r = {}; t.length; ) {
1441
+ var s = t[0], n = s.code, a = s.message, i = s.path.join(".");
1442
+ if (!r[i]) if ("unionErrors" in s) {
1443
+ var o = s.unionErrors[0].errors[0];
1444
+ r[i] = { message: o.message, type: o.code };
1445
+ } else r[i] = { message: a, type: n };
1446
+ if ("unionErrors" in s && s.unionErrors.forEach(function(_) {
1447
+ return _.errors.forEach(function(y) {
1448
+ return t.push(y);
1449
+ });
1450
+ }), e) {
1451
+ var d = r[i].types, f = d && d[s.code];
1452
+ r[i] = Yr(i, e, r, n, f ? [].concat(f, s.message) : s.message);
1453
+ }
1454
+ t.shift();
1455
+ }
1456
+ return r;
1457
+ }
1458
+ function rn(t, e, r) {
1459
+ return r === void 0 && (r = {}), function(s, n, a) {
1460
+ try {
1461
+ return Promise.resolve(function(i, o) {
1462
+ try {
1463
+ var d = Promise.resolve(t[r.mode === "sync" ? "parse" : "parseAsync"](s, e)).then(function(f) {
1464
+ return a.shouldUseNativeValidation && es({}, a), { errors: {}, values: r.raw ? Object.assign({}, s) : f };
1465
+ });
1466
+ } catch (f) {
1467
+ return o(f);
1468
+ }
1469
+ return d && d.then ? d.then(void 0, o) : d;
1470
+ }(0, function(i) {
1471
+ if (function(o) {
1472
+ return Array.isArray(o == null ? void 0 : o.errors);
1473
+ }(i)) return { values: {}, errors: Ks(tn(i.errors, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a) };
1474
+ throw i;
1475
+ }));
1476
+ } catch (i) {
1477
+ return Promise.reject(i);
1478
+ }
1479
+ };
1480
+ }
1481
+ var F;
1482
+ (function(t) {
1483
+ t.assertEqual = (n) => {
1484
+ };
1485
+ function e(n) {
1486
+ }
1487
+ t.assertIs = e;
1488
+ function r(n) {
1489
+ throw new Error();
1490
+ }
1491
+ t.assertNever = r, t.arrayToEnum = (n) => {
1492
+ const a = {};
1493
+ for (const i of n)
1494
+ a[i] = i;
1495
+ return a;
1496
+ }, t.getValidEnumValues = (n) => {
1497
+ const a = t.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
1498
+ for (const o of a)
1499
+ i[o] = n[o];
1500
+ return t.objectValues(i);
1501
+ }, t.objectValues = (n) => t.objectKeys(n).map(function(a) {
1502
+ return n[a];
1503
+ }), t.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
1504
+ const a = [];
1505
+ for (const i in n)
1506
+ Object.prototype.hasOwnProperty.call(n, i) && a.push(i);
1507
+ return a;
1508
+ }, t.find = (n, a) => {
1509
+ for (const i of n)
1510
+ if (a(i))
1511
+ return i;
1512
+ }, t.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && Number.isFinite(n) && Math.floor(n) === n;
1513
+ function s(n, a = " | ") {
1514
+ return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
1515
+ }
1516
+ t.joinValues = s, t.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
1517
+ })(F || (F = {}));
1518
+ var er;
1519
+ (function(t) {
1520
+ t.mergeShapes = (e, r) => ({
1521
+ ...e,
1522
+ ...r
1523
+ // second overwrites first
1524
+ });
1525
+ })(er || (er = {}));
1526
+ const T = F.arrayToEnum([
1527
+ "string",
1528
+ "nan",
1529
+ "number",
1530
+ "integer",
1531
+ "float",
1532
+ "boolean",
1533
+ "date",
1534
+ "bigint",
1535
+ "symbol",
1536
+ "function",
1537
+ "undefined",
1538
+ "null",
1539
+ "array",
1540
+ "object",
1541
+ "unknown",
1542
+ "promise",
1543
+ "void",
1544
+ "never",
1545
+ "map",
1546
+ "set"
1547
+ ]), Ve = (t) => {
1548
+ switch (typeof t) {
1549
+ case "undefined":
1550
+ return T.undefined;
1551
+ case "string":
1552
+ return T.string;
1553
+ case "number":
1554
+ return Number.isNaN(t) ? T.nan : T.number;
1555
+ case "boolean":
1556
+ return T.boolean;
1557
+ case "function":
1558
+ return T.function;
1559
+ case "bigint":
1560
+ return T.bigint;
1561
+ case "symbol":
1562
+ return T.symbol;
1563
+ case "object":
1564
+ return Array.isArray(t) ? T.array : t === null ? T.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? T.promise : typeof Map < "u" && t instanceof Map ? T.map : typeof Set < "u" && t instanceof Set ? T.set : typeof Date < "u" && t instanceof Date ? T.date : T.object;
1565
+ default:
1566
+ return T.unknown;
1567
+ }
1568
+ }, m = F.arrayToEnum([
1569
+ "invalid_type",
1570
+ "invalid_literal",
1571
+ "custom",
1572
+ "invalid_union",
1573
+ "invalid_union_discriminator",
1574
+ "invalid_enum_value",
1575
+ "unrecognized_keys",
1576
+ "invalid_arguments",
1577
+ "invalid_return_type",
1578
+ "invalid_date",
1579
+ "invalid_string",
1580
+ "too_small",
1581
+ "too_big",
1582
+ "invalid_intersection_types",
1583
+ "not_multiple_of",
1584
+ "not_finite"
1585
+ ]), sn = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
1586
+ class he extends Error {
1587
+ get errors() {
1588
+ return this.issues;
1589
+ }
1590
+ constructor(e) {
1591
+ super(), this.issues = [], this.addIssue = (s) => {
1592
+ this.issues = [...this.issues, s];
1593
+ }, this.addIssues = (s = []) => {
1594
+ this.issues = [...this.issues, ...s];
1595
+ };
1596
+ const r = new.target.prototype;
1597
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, r) : this.__proto__ = r, this.name = "ZodError", this.issues = e;
1598
+ }
1599
+ format(e) {
1600
+ const r = e || function(a) {
1601
+ return a.message;
1602
+ }, s = { _errors: [] }, n = (a) => {
1603
+ for (const i of a.issues)
1604
+ if (i.code === "invalid_union")
1605
+ i.unionErrors.map(n);
1606
+ else if (i.code === "invalid_return_type")
1607
+ n(i.returnTypeError);
1608
+ else if (i.code === "invalid_arguments")
1609
+ n(i.argumentsError);
1610
+ else if (i.path.length === 0)
1611
+ s._errors.push(r(i));
1612
+ else {
1613
+ let o = s, d = 0;
1614
+ for (; d < i.path.length; ) {
1615
+ const f = i.path[d];
1616
+ d === i.path.length - 1 ? (o[f] = o[f] || { _errors: [] }, o[f]._errors.push(r(i))) : o[f] = o[f] || { _errors: [] }, o = o[f], d++;
1617
+ }
1618
+ }
1619
+ };
1620
+ return n(this), s;
1621
+ }
1622
+ static assert(e) {
1623
+ if (!(e instanceof he))
1624
+ throw new Error(`Not a ZodError: ${e}`);
1625
+ }
1626
+ toString() {
1627
+ return this.message;
1628
+ }
1629
+ get message() {
1630
+ return JSON.stringify(this.issues, F.jsonStringifyReplacer, 2);
1631
+ }
1632
+ get isEmpty() {
1633
+ return this.issues.length === 0;
1634
+ }
1635
+ flatten(e = (r) => r.message) {
1636
+ const r = {}, s = [];
1637
+ for (const n of this.issues)
1638
+ n.path.length > 0 ? (r[n.path[0]] = r[n.path[0]] || [], r[n.path[0]].push(e(n))) : s.push(e(n));
1639
+ return { formErrors: s, fieldErrors: r };
1640
+ }
1641
+ get formErrors() {
1642
+ return this.flatten();
1643
+ }
1644
+ }
1645
+ he.create = (t) => new he(t);
1646
+ const nt = (t, e) => {
1647
+ let r;
1648
+ switch (t.code) {
1649
+ case m.invalid_type:
1650
+ t.received === T.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
1651
+ break;
1652
+ case m.invalid_literal:
1653
+ r = `Invalid literal value, expected ${JSON.stringify(t.expected, F.jsonStringifyReplacer)}`;
1654
+ break;
1655
+ case m.unrecognized_keys:
1656
+ r = `Unrecognized key(s) in object: ${F.joinValues(t.keys, ", ")}`;
1657
+ break;
1658
+ case m.invalid_union:
1659
+ r = "Invalid input";
1660
+ break;
1661
+ case m.invalid_union_discriminator:
1662
+ r = `Invalid discriminator value. Expected ${F.joinValues(t.options)}`;
1663
+ break;
1664
+ case m.invalid_enum_value:
1665
+ r = `Invalid enum value. Expected ${F.joinValues(t.options)}, received '${t.received}'`;
1666
+ break;
1667
+ case m.invalid_arguments:
1668
+ r = "Invalid function arguments";
1669
+ break;
1670
+ case m.invalid_return_type:
1671
+ r = "Invalid function return type";
1672
+ break;
1673
+ case m.invalid_date:
1674
+ r = "Invalid date";
1675
+ break;
1676
+ case m.invalid_string:
1677
+ typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : F.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
1678
+ break;
1679
+ case m.too_small:
1680
+ t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
1681
+ break;
1682
+ case m.too_big:
1683
+ t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? r = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : r = "Invalid input";
1684
+ break;
1685
+ case m.custom:
1686
+ r = "Invalid input";
1687
+ break;
1688
+ case m.invalid_intersection_types:
1689
+ r = "Intersection results could not be merged";
1690
+ break;
1691
+ case m.not_multiple_of:
1692
+ r = `Number must be a multiple of ${t.multipleOf}`;
1693
+ break;
1694
+ case m.not_finite:
1695
+ r = "Number must be finite";
1696
+ break;
1697
+ default:
1698
+ r = e.defaultError, F.assertNever(t);
1699
+ }
1700
+ return { message: r };
1701
+ };
1702
+ let ts = nt;
1703
+ function nn(t) {
1704
+ ts = t;
1705
+ }
1706
+ function Mt() {
1707
+ return ts;
1708
+ }
1709
+ const Zt = (t) => {
1710
+ const { data: e, path: r, errorMaps: s, issueData: n } = t, a = [...r, ...n.path || []], i = {
1711
+ ...n,
1712
+ path: a
1713
+ };
1714
+ if (n.message !== void 0)
1715
+ return {
1716
+ ...n,
1717
+ path: a,
1718
+ message: n.message
1719
+ };
1720
+ let o = "";
1721
+ const d = s.filter((f) => !!f).slice().reverse();
1722
+ for (const f of d)
1723
+ o = f(i, { data: e, defaultError: o }).message;
1724
+ return {
1725
+ ...n,
1726
+ path: a,
1727
+ message: o
1728
+ };
1729
+ }, an = [];
1730
+ function k(t, e) {
1731
+ const r = Mt(), s = Zt({
1732
+ issueData: e,
1733
+ data: t.data,
1734
+ path: t.path,
1735
+ errorMaps: [
1736
+ t.common.contextualErrorMap,
1737
+ // contextual error map is first priority
1738
+ t.schemaErrorMap,
1739
+ // then schema-bound map if available
1740
+ r,
1741
+ // then global override map
1742
+ r === nt ? void 0 : nt
1743
+ // then global default map
1744
+ ].filter((n) => !!n)
1745
+ });
1746
+ t.common.issues.push(s);
1747
+ }
1748
+ class se {
1749
+ constructor() {
1750
+ this.value = "valid";
1751
+ }
1752
+ dirty() {
1753
+ this.value === "valid" && (this.value = "dirty");
1754
+ }
1755
+ abort() {
1756
+ this.value !== "aborted" && (this.value = "aborted");
1757
+ }
1758
+ static mergeArray(e, r) {
1759
+ const s = [];
1760
+ for (const n of r) {
1761
+ if (n.status === "aborted")
1762
+ return j;
1763
+ n.status === "dirty" && e.dirty(), s.push(n.value);
1764
+ }
1765
+ return { status: e.value, value: s };
1766
+ }
1767
+ static async mergeObjectAsync(e, r) {
1768
+ const s = [];
1769
+ for (const n of r) {
1770
+ const a = await n.key, i = await n.value;
1771
+ s.push({
1772
+ key: a,
1773
+ value: i
1774
+ });
1775
+ }
1776
+ return se.mergeObjectSync(e, s);
1777
+ }
1778
+ static mergeObjectSync(e, r) {
1779
+ const s = {};
1780
+ for (const n of r) {
1781
+ const { key: a, value: i } = n;
1782
+ if (a.status === "aborted" || i.status === "aborted")
1783
+ return j;
1784
+ a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || n.alwaysSet) && (s[a.value] = i.value);
1785
+ }
1786
+ return { status: e.value, value: s };
1787
+ }
1788
+ }
1789
+ const j = Object.freeze({
1790
+ status: "aborted"
1791
+ }), rt = (t) => ({ status: "dirty", value: t }), ie = (t) => ({ status: "valid", value: t }), tr = (t) => t.status === "aborted", rr = (t) => t.status === "dirty", Je = (t) => t.status === "valid", pt = (t) => typeof Promise < "u" && t instanceof Promise;
1792
+ var S;
1793
+ (function(t) {
1794
+ t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
1795
+ })(S || (S = {}));
1796
+ class Ae {
1797
+ constructor(e, r, s, n) {
1798
+ this._cachedPath = [], this.parent = e, this.data = r, this._path = s, this._key = n;
1799
+ }
1800
+ get path() {
1801
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
1802
+ }
1803
+ }
1804
+ const Dr = (t, e) => {
1805
+ if (Je(e))
1806
+ return { success: !0, data: e.value };
1807
+ if (!t.common.issues.length)
1808
+ throw new Error("Validation failed but no issues detected.");
1809
+ return {
1810
+ success: !1,
1811
+ get error() {
1812
+ if (this._error)
1813
+ return this._error;
1814
+ const r = new he(t.common.issues);
1815
+ return this._error = r, this._error;
1816
+ }
1817
+ };
1818
+ };
1819
+ function N(t) {
1820
+ if (!t)
1821
+ return {};
1822
+ const { errorMap: e, invalid_type_error: r, required_error: s, description: n } = t;
1823
+ if (e && (r || s))
1824
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
1825
+ return e ? { errorMap: e, description: n } : { errorMap: (i, o) => {
1826
+ const { message: d } = t;
1827
+ return i.code === "invalid_enum_value" ? { message: d ?? o.defaultError } : typeof o.data > "u" ? { message: d ?? s ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: d ?? r ?? o.defaultError };
1828
+ }, description: n };
1829
+ }
1830
+ class O {
1831
+ get description() {
1832
+ return this._def.description;
1833
+ }
1834
+ _getType(e) {
1835
+ return Ve(e.data);
1836
+ }
1837
+ _getOrReturnCtx(e, r) {
1838
+ return r || {
1839
+ common: e.parent.common,
1840
+ data: e.data,
1841
+ parsedType: Ve(e.data),
1842
+ schemaErrorMap: this._def.errorMap,
1843
+ path: e.path,
1844
+ parent: e.parent
1845
+ };
1846
+ }
1847
+ _processInputParams(e) {
1848
+ return {
1849
+ status: new se(),
1850
+ ctx: {
1851
+ common: e.parent.common,
1852
+ data: e.data,
1853
+ parsedType: Ve(e.data),
1854
+ schemaErrorMap: this._def.errorMap,
1855
+ path: e.path,
1856
+ parent: e.parent
1857
+ }
1858
+ };
1859
+ }
1860
+ _parseSync(e) {
1861
+ const r = this._parse(e);
1862
+ if (pt(r))
1863
+ throw new Error("Synchronous parse encountered promise.");
1864
+ return r;
1865
+ }
1866
+ _parseAsync(e) {
1867
+ const r = this._parse(e);
1868
+ return Promise.resolve(r);
1869
+ }
1870
+ parse(e, r) {
1871
+ const s = this.safeParse(e, r);
1872
+ if (s.success)
1873
+ return s.data;
1874
+ throw s.error;
1875
+ }
1876
+ safeParse(e, r) {
1877
+ const s = {
1878
+ common: {
1879
+ issues: [],
1880
+ async: (r == null ? void 0 : r.async) ?? !1,
1881
+ contextualErrorMap: r == null ? void 0 : r.errorMap
1882
+ },
1883
+ path: (r == null ? void 0 : r.path) || [],
1884
+ schemaErrorMap: this._def.errorMap,
1885
+ parent: null,
1886
+ data: e,
1887
+ parsedType: Ve(e)
1888
+ }, n = this._parseSync({ data: e, path: s.path, parent: s });
1889
+ return Dr(s, n);
1890
+ }
1891
+ "~validate"(e) {
1892
+ var s, n;
1893
+ const r = {
1894
+ common: {
1895
+ issues: [],
1896
+ async: !!this["~standard"].async
1897
+ },
1898
+ path: [],
1899
+ schemaErrorMap: this._def.errorMap,
1900
+ parent: null,
1901
+ data: e,
1902
+ parsedType: Ve(e)
1903
+ };
1904
+ if (!this["~standard"].async)
1905
+ try {
1906
+ const a = this._parseSync({ data: e, path: [], parent: r });
1907
+ return Je(a) ? {
1908
+ value: a.value
1909
+ } : {
1910
+ issues: r.common.issues
1911
+ };
1912
+ } catch (a) {
1913
+ (n = (s = a == null ? void 0 : a.message) == null ? void 0 : s.toLowerCase()) != null && n.includes("encountered") && (this["~standard"].async = !0), r.common = {
1914
+ issues: [],
1915
+ async: !0
1916
+ };
1917
+ }
1918
+ return this._parseAsync({ data: e, path: [], parent: r }).then((a) => Je(a) ? {
1919
+ value: a.value
1920
+ } : {
1921
+ issues: r.common.issues
1922
+ });
1923
+ }
1924
+ async parseAsync(e, r) {
1925
+ const s = await this.safeParseAsync(e, r);
1926
+ if (s.success)
1927
+ return s.data;
1928
+ throw s.error;
1929
+ }
1930
+ async safeParseAsync(e, r) {
1931
+ const s = {
1932
+ common: {
1933
+ issues: [],
1934
+ contextualErrorMap: r == null ? void 0 : r.errorMap,
1935
+ async: !0
1936
+ },
1937
+ path: (r == null ? void 0 : r.path) || [],
1938
+ schemaErrorMap: this._def.errorMap,
1939
+ parent: null,
1940
+ data: e,
1941
+ parsedType: Ve(e)
1942
+ }, n = this._parse({ data: e, path: s.path, parent: s }), a = await (pt(n) ? n : Promise.resolve(n));
1943
+ return Dr(s, a);
1944
+ }
1945
+ refine(e, r) {
1946
+ const s = (n) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(n) : r;
1947
+ return this._refinement((n, a) => {
1948
+ const i = e(n), o = () => a.addIssue({
1949
+ code: m.custom,
1950
+ ...s(n)
1951
+ });
1952
+ return typeof Promise < "u" && i instanceof Promise ? i.then((d) => d ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
1953
+ });
1954
+ }
1955
+ refinement(e, r) {
1956
+ return this._refinement((s, n) => e(s) ? !0 : (n.addIssue(typeof r == "function" ? r(s, n) : r), !1));
1957
+ }
1958
+ _refinement(e) {
1959
+ return new be({
1960
+ schema: this,
1961
+ typeName: E.ZodEffects,
1962
+ effect: { type: "refinement", refinement: e }
1963
+ });
1964
+ }
1965
+ superRefine(e) {
1966
+ return this._refinement(e);
1967
+ }
1968
+ constructor(e) {
1969
+ 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), this["~standard"] = {
1970
+ version: 1,
1971
+ vendor: "zod",
1972
+ validate: (r) => this["~validate"](r)
1973
+ };
1974
+ }
1975
+ optional() {
1976
+ return Se.create(this, this._def);
1977
+ }
1978
+ nullable() {
1979
+ return ze.create(this, this._def);
1980
+ }
1981
+ nullish() {
1982
+ return this.nullable().optional();
1983
+ }
1984
+ array() {
1985
+ return _e.create(this);
1986
+ }
1987
+ promise() {
1988
+ return it.create(this, this._def);
1989
+ }
1990
+ or(e) {
1991
+ return _t.create([this, e], this._def);
1992
+ }
1993
+ and(e) {
1994
+ return bt.create(this, e, this._def);
1995
+ }
1996
+ transform(e) {
1997
+ return new be({
1998
+ ...N(this._def),
1999
+ schema: this,
2000
+ typeName: E.ZodEffects,
2001
+ effect: { type: "transform", transform: e }
2002
+ });
2003
+ }
2004
+ default(e) {
2005
+ const r = typeof e == "function" ? e : () => e;
2006
+ return new St({
2007
+ ...N(this._def),
2008
+ innerType: this,
2009
+ defaultValue: r,
2010
+ typeName: E.ZodDefault
2011
+ });
2012
+ }
2013
+ brand() {
2014
+ return new dr({
2015
+ typeName: E.ZodBranded,
2016
+ type: this,
2017
+ ...N(this._def)
2018
+ });
2019
+ }
2020
+ catch(e) {
2021
+ const r = typeof e == "function" ? e : () => e;
2022
+ return new At({
2023
+ ...N(this._def),
2024
+ innerType: this,
2025
+ catchValue: r,
2026
+ typeName: E.ZodCatch
2027
+ });
2028
+ }
2029
+ describe(e) {
2030
+ const r = this.constructor;
2031
+ return new r({
2032
+ ...this._def,
2033
+ description: e
2034
+ });
2035
+ }
2036
+ pipe(e) {
2037
+ return Ct.create(this, e);
2038
+ }
2039
+ readonly() {
2040
+ return jt.create(this);
2041
+ }
2042
+ isOptional() {
2043
+ return this.safeParse(void 0).success;
2044
+ }
2045
+ isNullable() {
2046
+ return this.safeParse(null).success;
2047
+ }
2048
+ }
2049
+ const on = /^c[^\s-]{8,}$/i, cn = /^[0-9a-z]+$/, ln = /^[0-9A-HJKMNP-TV-Z]{26}$/i, un = /^[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, dn = /^[a-z0-9_-]{21}$/i, fn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, hn = /^[-+]?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)?)??$/, mn = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, pn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
2050
+ let Xt;
2051
+ const yn = /^(?:(?: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])$/, gn = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/, vn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, _n = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, bn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, xn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, rs = "((\\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])))", kn = new RegExp(`^${rs}$`);
2052
+ function ss(t) {
2053
+ let e = "[0-5]\\d";
2054
+ t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
2055
+ const r = t.precision ? "+" : "?";
2056
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
2057
+ }
2058
+ function wn(t) {
2059
+ return new RegExp(`^${ss(t)}$`);
2060
+ }
2061
+ function ns(t) {
2062
+ let e = `${rs}T${ss(t)}`;
2063
+ const r = [];
2064
+ return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
2065
+ }
2066
+ function Tn(t, e) {
2067
+ return !!((e === "v4" || !e) && yn.test(t) || (e === "v6" || !e) && vn.test(t));
2068
+ }
2069
+ function Sn(t, e) {
2070
+ if (!fn.test(t))
2071
+ return !1;
2072
+ try {
2073
+ const [r] = t.split("."), s = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), n = JSON.parse(atob(s));
2074
+ return !(typeof n != "object" || n === null || "typ" in n && (n == null ? void 0 : n.typ) !== "JWT" || !n.alg || e && n.alg !== e);
2075
+ } catch {
2076
+ return !1;
2077
+ }
2078
+ }
2079
+ function An(t, e) {
2080
+ return !!((e === "v4" || !e) && gn.test(t) || (e === "v6" || !e) && _n.test(t));
2081
+ }
2082
+ class ve extends O {
2083
+ _parse(e) {
2084
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== T.string) {
2085
+ const a = this._getOrReturnCtx(e);
2086
+ return k(a, {
2087
+ code: m.invalid_type,
2088
+ expected: T.string,
2089
+ received: a.parsedType
2090
+ }), j;
2091
+ }
2092
+ const s = new se();
2093
+ let n;
2094
+ for (const a of this._def.checks)
2095
+ if (a.kind === "min")
2096
+ e.data.length < a.value && (n = this._getOrReturnCtx(e, n), k(n, {
2097
+ code: m.too_small,
2098
+ minimum: a.value,
2099
+ type: "string",
2100
+ inclusive: !0,
2101
+ exact: !1,
2102
+ message: a.message
2103
+ }), s.dirty());
2104
+ else if (a.kind === "max")
2105
+ e.data.length > a.value && (n = this._getOrReturnCtx(e, n), k(n, {
2106
+ code: m.too_big,
2107
+ maximum: a.value,
2108
+ type: "string",
2109
+ inclusive: !0,
2110
+ exact: !1,
2111
+ message: a.message
2112
+ }), s.dirty());
2113
+ else if (a.kind === "length") {
2114
+ const i = e.data.length > a.value, o = e.data.length < a.value;
2115
+ (i || o) && (n = this._getOrReturnCtx(e, n), i ? k(n, {
2116
+ code: m.too_big,
2117
+ maximum: a.value,
2118
+ type: "string",
2119
+ inclusive: !0,
2120
+ exact: !0,
2121
+ message: a.message
2122
+ }) : o && k(n, {
2123
+ code: m.too_small,
2124
+ minimum: a.value,
2125
+ type: "string",
2126
+ inclusive: !0,
2127
+ exact: !0,
2128
+ message: a.message
2129
+ }), s.dirty());
2130
+ } else if (a.kind === "email")
2131
+ mn.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2132
+ validation: "email",
2133
+ code: m.invalid_string,
2134
+ message: a.message
2135
+ }), s.dirty());
2136
+ else if (a.kind === "emoji")
2137
+ Xt || (Xt = new RegExp(pn, "u")), Xt.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2138
+ validation: "emoji",
2139
+ code: m.invalid_string,
2140
+ message: a.message
2141
+ }), s.dirty());
2142
+ else if (a.kind === "uuid")
2143
+ un.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2144
+ validation: "uuid",
2145
+ code: m.invalid_string,
2146
+ message: a.message
2147
+ }), s.dirty());
2148
+ else if (a.kind === "nanoid")
2149
+ dn.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2150
+ validation: "nanoid",
2151
+ code: m.invalid_string,
2152
+ message: a.message
2153
+ }), s.dirty());
2154
+ else if (a.kind === "cuid")
2155
+ on.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2156
+ validation: "cuid",
2157
+ code: m.invalid_string,
2158
+ message: a.message
2159
+ }), s.dirty());
2160
+ else if (a.kind === "cuid2")
2161
+ cn.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2162
+ validation: "cuid2",
2163
+ code: m.invalid_string,
2164
+ message: a.message
2165
+ }), s.dirty());
2166
+ else if (a.kind === "ulid")
2167
+ ln.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2168
+ validation: "ulid",
2169
+ code: m.invalid_string,
2170
+ message: a.message
2171
+ }), s.dirty());
2172
+ else if (a.kind === "url")
2173
+ try {
2174
+ new URL(e.data);
2175
+ } catch {
2176
+ n = this._getOrReturnCtx(e, n), k(n, {
2177
+ validation: "url",
2178
+ code: m.invalid_string,
2179
+ message: a.message
2180
+ }), s.dirty();
2181
+ }
2182
+ else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2183
+ validation: "regex",
2184
+ code: m.invalid_string,
2185
+ message: a.message
2186
+ }), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), k(n, {
2187
+ code: m.invalid_string,
2188
+ validation: { includes: a.value, position: a.position },
2189
+ message: a.message
2190
+ }), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), k(n, {
2191
+ code: m.invalid_string,
2192
+ validation: { startsWith: a.value },
2193
+ message: a.message
2194
+ }), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), k(n, {
2195
+ code: m.invalid_string,
2196
+ validation: { endsWith: a.value },
2197
+ message: a.message
2198
+ }), s.dirty()) : a.kind === "datetime" ? ns(a).test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2199
+ code: m.invalid_string,
2200
+ validation: "datetime",
2201
+ message: a.message
2202
+ }), s.dirty()) : a.kind === "date" ? kn.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2203
+ code: m.invalid_string,
2204
+ validation: "date",
2205
+ message: a.message
2206
+ }), s.dirty()) : a.kind === "time" ? wn(a).test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2207
+ code: m.invalid_string,
2208
+ validation: "time",
2209
+ message: a.message
2210
+ }), s.dirty()) : a.kind === "duration" ? hn.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2211
+ validation: "duration",
2212
+ code: m.invalid_string,
2213
+ message: a.message
2214
+ }), s.dirty()) : a.kind === "ip" ? Tn(e.data, a.version) || (n = this._getOrReturnCtx(e, n), k(n, {
2215
+ validation: "ip",
2216
+ code: m.invalid_string,
2217
+ message: a.message
2218
+ }), s.dirty()) : a.kind === "jwt" ? Sn(e.data, a.alg) || (n = this._getOrReturnCtx(e, n), k(n, {
2219
+ validation: "jwt",
2220
+ code: m.invalid_string,
2221
+ message: a.message
2222
+ }), s.dirty()) : a.kind === "cidr" ? An(e.data, a.version) || (n = this._getOrReturnCtx(e, n), k(n, {
2223
+ validation: "cidr",
2224
+ code: m.invalid_string,
2225
+ message: a.message
2226
+ }), s.dirty()) : a.kind === "base64" ? bn.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2227
+ validation: "base64",
2228
+ code: m.invalid_string,
2229
+ message: a.message
2230
+ }), s.dirty()) : a.kind === "base64url" ? xn.test(e.data) || (n = this._getOrReturnCtx(e, n), k(n, {
2231
+ validation: "base64url",
2232
+ code: m.invalid_string,
2233
+ message: a.message
2234
+ }), s.dirty()) : F.assertNever(a);
2235
+ return { status: s.value, value: e.data };
2236
+ }
2237
+ _regex(e, r, s) {
2238
+ return this.refinement((n) => e.test(n), {
2239
+ validation: r,
2240
+ code: m.invalid_string,
2241
+ ...S.errToObj(s)
2242
+ });
2243
+ }
2244
+ _addCheck(e) {
2245
+ return new ve({
2246
+ ...this._def,
2247
+ checks: [...this._def.checks, e]
2248
+ });
2249
+ }
2250
+ email(e) {
2251
+ return this._addCheck({ kind: "email", ...S.errToObj(e) });
2252
+ }
2253
+ url(e) {
2254
+ return this._addCheck({ kind: "url", ...S.errToObj(e) });
2255
+ }
2256
+ emoji(e) {
2257
+ return this._addCheck({ kind: "emoji", ...S.errToObj(e) });
2258
+ }
2259
+ uuid(e) {
2260
+ return this._addCheck({ kind: "uuid", ...S.errToObj(e) });
2261
+ }
2262
+ nanoid(e) {
2263
+ return this._addCheck({ kind: "nanoid", ...S.errToObj(e) });
2264
+ }
2265
+ cuid(e) {
2266
+ return this._addCheck({ kind: "cuid", ...S.errToObj(e) });
2267
+ }
2268
+ cuid2(e) {
2269
+ return this._addCheck({ kind: "cuid2", ...S.errToObj(e) });
2270
+ }
2271
+ ulid(e) {
2272
+ return this._addCheck({ kind: "ulid", ...S.errToObj(e) });
2273
+ }
2274
+ base64(e) {
2275
+ return this._addCheck({ kind: "base64", ...S.errToObj(e) });
2276
+ }
2277
+ base64url(e) {
2278
+ return this._addCheck({
2279
+ kind: "base64url",
2280
+ ...S.errToObj(e)
2281
+ });
2282
+ }
2283
+ jwt(e) {
2284
+ return this._addCheck({ kind: "jwt", ...S.errToObj(e) });
2285
+ }
2286
+ ip(e) {
2287
+ return this._addCheck({ kind: "ip", ...S.errToObj(e) });
2288
+ }
2289
+ cidr(e) {
2290
+ return this._addCheck({ kind: "cidr", ...S.errToObj(e) });
2291
+ }
2292
+ datetime(e) {
2293
+ return typeof e == "string" ? this._addCheck({
2294
+ kind: "datetime",
2295
+ precision: null,
2296
+ offset: !1,
2297
+ local: !1,
2298
+ message: e
2299
+ }) : this._addCheck({
2300
+ kind: "datetime",
2301
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
2302
+ offset: (e == null ? void 0 : e.offset) ?? !1,
2303
+ local: (e == null ? void 0 : e.local) ?? !1,
2304
+ ...S.errToObj(e == null ? void 0 : e.message)
2305
+ });
2306
+ }
2307
+ date(e) {
2308
+ return this._addCheck({ kind: "date", message: e });
2309
+ }
2310
+ time(e) {
2311
+ return typeof e == "string" ? this._addCheck({
2312
+ kind: "time",
2313
+ precision: null,
2314
+ message: e
2315
+ }) : this._addCheck({
2316
+ kind: "time",
2317
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
2318
+ ...S.errToObj(e == null ? void 0 : e.message)
2319
+ });
2320
+ }
2321
+ duration(e) {
2322
+ return this._addCheck({ kind: "duration", ...S.errToObj(e) });
2323
+ }
2324
+ regex(e, r) {
2325
+ return this._addCheck({
2326
+ kind: "regex",
2327
+ regex: e,
2328
+ ...S.errToObj(r)
2329
+ });
2330
+ }
2331
+ includes(e, r) {
2332
+ return this._addCheck({
2333
+ kind: "includes",
2334
+ value: e,
2335
+ position: r == null ? void 0 : r.position,
2336
+ ...S.errToObj(r == null ? void 0 : r.message)
2337
+ });
2338
+ }
2339
+ startsWith(e, r) {
2340
+ return this._addCheck({
2341
+ kind: "startsWith",
2342
+ value: e,
2343
+ ...S.errToObj(r)
2344
+ });
2345
+ }
2346
+ endsWith(e, r) {
2347
+ return this._addCheck({
2348
+ kind: "endsWith",
2349
+ value: e,
2350
+ ...S.errToObj(r)
2351
+ });
2352
+ }
2353
+ min(e, r) {
2354
+ return this._addCheck({
2355
+ kind: "min",
2356
+ value: e,
2357
+ ...S.errToObj(r)
2358
+ });
2359
+ }
2360
+ max(e, r) {
2361
+ return this._addCheck({
2362
+ kind: "max",
2363
+ value: e,
2364
+ ...S.errToObj(r)
2365
+ });
2366
+ }
2367
+ length(e, r) {
2368
+ return this._addCheck({
2369
+ kind: "length",
2370
+ value: e,
2371
+ ...S.errToObj(r)
2372
+ });
2373
+ }
2374
+ /**
2375
+ * Equivalent to `.min(1)`
2376
+ */
2377
+ nonempty(e) {
2378
+ return this.min(1, S.errToObj(e));
2379
+ }
2380
+ trim() {
2381
+ return new ve({
2382
+ ...this._def,
2383
+ checks: [...this._def.checks, { kind: "trim" }]
2384
+ });
2385
+ }
2386
+ toLowerCase() {
2387
+ return new ve({
2388
+ ...this._def,
2389
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
2390
+ });
2391
+ }
2392
+ toUpperCase() {
2393
+ return new ve({
2394
+ ...this._def,
2395
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
2396
+ });
2397
+ }
2398
+ get isDatetime() {
2399
+ return !!this._def.checks.find((e) => e.kind === "datetime");
2400
+ }
2401
+ get isDate() {
2402
+ return !!this._def.checks.find((e) => e.kind === "date");
2403
+ }
2404
+ get isTime() {
2405
+ return !!this._def.checks.find((e) => e.kind === "time");
2406
+ }
2407
+ get isDuration() {
2408
+ return !!this._def.checks.find((e) => e.kind === "duration");
2409
+ }
2410
+ get isEmail() {
2411
+ return !!this._def.checks.find((e) => e.kind === "email");
2412
+ }
2413
+ get isURL() {
2414
+ return !!this._def.checks.find((e) => e.kind === "url");
2415
+ }
2416
+ get isEmoji() {
2417
+ return !!this._def.checks.find((e) => e.kind === "emoji");
2418
+ }
2419
+ get isUUID() {
2420
+ return !!this._def.checks.find((e) => e.kind === "uuid");
2421
+ }
2422
+ get isNANOID() {
2423
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
2424
+ }
2425
+ get isCUID() {
2426
+ return !!this._def.checks.find((e) => e.kind === "cuid");
2427
+ }
2428
+ get isCUID2() {
2429
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
2430
+ }
2431
+ get isULID() {
2432
+ return !!this._def.checks.find((e) => e.kind === "ulid");
2433
+ }
2434
+ get isIP() {
2435
+ return !!this._def.checks.find((e) => e.kind === "ip");
2436
+ }
2437
+ get isCIDR() {
2438
+ return !!this._def.checks.find((e) => e.kind === "cidr");
2439
+ }
2440
+ get isBase64() {
2441
+ return !!this._def.checks.find((e) => e.kind === "base64");
2442
+ }
2443
+ get isBase64url() {
2444
+ return !!this._def.checks.find((e) => e.kind === "base64url");
2445
+ }
2446
+ get minLength() {
2447
+ let e = null;
2448
+ for (const r of this._def.checks)
2449
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2450
+ return e;
2451
+ }
2452
+ get maxLength() {
2453
+ let e = null;
2454
+ for (const r of this._def.checks)
2455
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2456
+ return e;
2457
+ }
2458
+ }
2459
+ ve.create = (t) => new ve({
2460
+ checks: [],
2461
+ typeName: E.ZodString,
2462
+ coerce: (t == null ? void 0 : t.coerce) ?? !1,
2463
+ ...N(t)
2464
+ });
2465
+ function jn(t, e) {
2466
+ const r = (t.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, n = r > s ? r : s, a = Number.parseInt(t.toFixed(n).replace(".", "")), i = Number.parseInt(e.toFixed(n).replace(".", ""));
2467
+ return a % i / 10 ** n;
2468
+ }
2469
+ class Le extends O {
2470
+ constructor() {
2471
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
2472
+ }
2473
+ _parse(e) {
2474
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== T.number) {
2475
+ const a = this._getOrReturnCtx(e);
2476
+ return k(a, {
2477
+ code: m.invalid_type,
2478
+ expected: T.number,
2479
+ received: a.parsedType
2480
+ }), j;
2481
+ }
2482
+ let s;
2483
+ const n = new se();
2484
+ for (const a of this._def.checks)
2485
+ a.kind === "int" ? F.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), k(s, {
2486
+ code: m.invalid_type,
2487
+ expected: "integer",
2488
+ received: "float",
2489
+ message: a.message
2490
+ }), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), k(s, {
2491
+ code: m.too_small,
2492
+ minimum: a.value,
2493
+ type: "number",
2494
+ inclusive: a.inclusive,
2495
+ exact: !1,
2496
+ message: a.message
2497
+ }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), k(s, {
2498
+ code: m.too_big,
2499
+ maximum: a.value,
2500
+ type: "number",
2501
+ inclusive: a.inclusive,
2502
+ exact: !1,
2503
+ message: a.message
2504
+ }), n.dirty()) : a.kind === "multipleOf" ? jn(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), k(s, {
2505
+ code: m.not_multiple_of,
2506
+ multipleOf: a.value,
2507
+ message: a.message
2508
+ }), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), k(s, {
2509
+ code: m.not_finite,
2510
+ message: a.message
2511
+ }), n.dirty()) : F.assertNever(a);
2512
+ return { status: n.value, value: e.data };
2513
+ }
2514
+ gte(e, r) {
2515
+ return this.setLimit("min", e, !0, S.toString(r));
2516
+ }
2517
+ gt(e, r) {
2518
+ return this.setLimit("min", e, !1, S.toString(r));
2519
+ }
2520
+ lte(e, r) {
2521
+ return this.setLimit("max", e, !0, S.toString(r));
2522
+ }
2523
+ lt(e, r) {
2524
+ return this.setLimit("max", e, !1, S.toString(r));
2525
+ }
2526
+ setLimit(e, r, s, n) {
2527
+ return new Le({
2528
+ ...this._def,
2529
+ checks: [
2530
+ ...this._def.checks,
2531
+ {
2532
+ kind: e,
2533
+ value: r,
2534
+ inclusive: s,
2535
+ message: S.toString(n)
2536
+ }
2537
+ ]
2538
+ });
2539
+ }
2540
+ _addCheck(e) {
2541
+ return new Le({
2542
+ ...this._def,
2543
+ checks: [...this._def.checks, e]
2544
+ });
2545
+ }
2546
+ int(e) {
2547
+ return this._addCheck({
2548
+ kind: "int",
2549
+ message: S.toString(e)
2550
+ });
2551
+ }
2552
+ positive(e) {
2553
+ return this._addCheck({
2554
+ kind: "min",
2555
+ value: 0,
2556
+ inclusive: !1,
2557
+ message: S.toString(e)
2558
+ });
2559
+ }
2560
+ negative(e) {
2561
+ return this._addCheck({
2562
+ kind: "max",
2563
+ value: 0,
2564
+ inclusive: !1,
2565
+ message: S.toString(e)
2566
+ });
2567
+ }
2568
+ nonpositive(e) {
2569
+ return this._addCheck({
2570
+ kind: "max",
2571
+ value: 0,
2572
+ inclusive: !0,
2573
+ message: S.toString(e)
2574
+ });
2575
+ }
2576
+ nonnegative(e) {
2577
+ return this._addCheck({
2578
+ kind: "min",
2579
+ value: 0,
2580
+ inclusive: !0,
2581
+ message: S.toString(e)
2582
+ });
2583
+ }
2584
+ multipleOf(e, r) {
2585
+ return this._addCheck({
2586
+ kind: "multipleOf",
2587
+ value: e,
2588
+ message: S.toString(r)
2589
+ });
2590
+ }
2591
+ finite(e) {
2592
+ return this._addCheck({
2593
+ kind: "finite",
2594
+ message: S.toString(e)
2595
+ });
2596
+ }
2597
+ safe(e) {
2598
+ return this._addCheck({
2599
+ kind: "min",
2600
+ inclusive: !0,
2601
+ value: Number.MIN_SAFE_INTEGER,
2602
+ message: S.toString(e)
2603
+ })._addCheck({
2604
+ kind: "max",
2605
+ inclusive: !0,
2606
+ value: Number.MAX_SAFE_INTEGER,
2607
+ message: S.toString(e)
2608
+ });
2609
+ }
2610
+ get minValue() {
2611
+ let e = null;
2612
+ for (const r of this._def.checks)
2613
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2614
+ return e;
2615
+ }
2616
+ get maxValue() {
2617
+ let e = null;
2618
+ for (const r of this._def.checks)
2619
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2620
+ return e;
2621
+ }
2622
+ get isInt() {
2623
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && F.isInteger(e.value));
2624
+ }
2625
+ get isFinite() {
2626
+ let e = null, r = null;
2627
+ for (const s of this._def.checks) {
2628
+ if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
2629
+ return !0;
2630
+ s.kind === "min" ? (r === null || s.value > r) && (r = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
2631
+ }
2632
+ return Number.isFinite(r) && Number.isFinite(e);
2633
+ }
2634
+ }
2635
+ Le.create = (t) => new Le({
2636
+ checks: [],
2637
+ typeName: E.ZodNumber,
2638
+ coerce: (t == null ? void 0 : t.coerce) || !1,
2639
+ ...N(t)
2640
+ });
2641
+ class $e extends O {
2642
+ constructor() {
2643
+ super(...arguments), this.min = this.gte, this.max = this.lte;
2644
+ }
2645
+ _parse(e) {
2646
+ if (this._def.coerce)
2647
+ try {
2648
+ e.data = BigInt(e.data);
2649
+ } catch {
2650
+ return this._getInvalidInput(e);
2651
+ }
2652
+ if (this._getType(e) !== T.bigint)
2653
+ return this._getInvalidInput(e);
2654
+ let s;
2655
+ const n = new se();
2656
+ for (const a of this._def.checks)
2657
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), k(s, {
2658
+ code: m.too_small,
2659
+ type: "bigint",
2660
+ minimum: a.value,
2661
+ inclusive: a.inclusive,
2662
+ message: a.message
2663
+ }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), k(s, {
2664
+ code: m.too_big,
2665
+ type: "bigint",
2666
+ maximum: a.value,
2667
+ inclusive: a.inclusive,
2668
+ message: a.message
2669
+ }), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), k(s, {
2670
+ code: m.not_multiple_of,
2671
+ multipleOf: a.value,
2672
+ message: a.message
2673
+ }), n.dirty()) : F.assertNever(a);
2674
+ return { status: n.value, value: e.data };
2675
+ }
2676
+ _getInvalidInput(e) {
2677
+ const r = this._getOrReturnCtx(e);
2678
+ return k(r, {
2679
+ code: m.invalid_type,
2680
+ expected: T.bigint,
2681
+ received: r.parsedType
2682
+ }), j;
2683
+ }
2684
+ gte(e, r) {
2685
+ return this.setLimit("min", e, !0, S.toString(r));
2686
+ }
2687
+ gt(e, r) {
2688
+ return this.setLimit("min", e, !1, S.toString(r));
2689
+ }
2690
+ lte(e, r) {
2691
+ return this.setLimit("max", e, !0, S.toString(r));
2692
+ }
2693
+ lt(e, r) {
2694
+ return this.setLimit("max", e, !1, S.toString(r));
2695
+ }
2696
+ setLimit(e, r, s, n) {
2697
+ return new $e({
2698
+ ...this._def,
2699
+ checks: [
2700
+ ...this._def.checks,
2701
+ {
2702
+ kind: e,
2703
+ value: r,
2704
+ inclusive: s,
2705
+ message: S.toString(n)
2706
+ }
2707
+ ]
2708
+ });
2709
+ }
2710
+ _addCheck(e) {
2711
+ return new $e({
2712
+ ...this._def,
2713
+ checks: [...this._def.checks, e]
2714
+ });
2715
+ }
2716
+ positive(e) {
2717
+ return this._addCheck({
2718
+ kind: "min",
2719
+ value: BigInt(0),
2720
+ inclusive: !1,
2721
+ message: S.toString(e)
2722
+ });
2723
+ }
2724
+ negative(e) {
2725
+ return this._addCheck({
2726
+ kind: "max",
2727
+ value: BigInt(0),
2728
+ inclusive: !1,
2729
+ message: S.toString(e)
2730
+ });
2731
+ }
2732
+ nonpositive(e) {
2733
+ return this._addCheck({
2734
+ kind: "max",
2735
+ value: BigInt(0),
2736
+ inclusive: !0,
2737
+ message: S.toString(e)
2738
+ });
2739
+ }
2740
+ nonnegative(e) {
2741
+ return this._addCheck({
2742
+ kind: "min",
2743
+ value: BigInt(0),
2744
+ inclusive: !0,
2745
+ message: S.toString(e)
2746
+ });
2747
+ }
2748
+ multipleOf(e, r) {
2749
+ return this._addCheck({
2750
+ kind: "multipleOf",
2751
+ value: e,
2752
+ message: S.toString(r)
2753
+ });
2754
+ }
2755
+ get minValue() {
2756
+ let e = null;
2757
+ for (const r of this._def.checks)
2758
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2759
+ return e;
2760
+ }
2761
+ get maxValue() {
2762
+ let e = null;
2763
+ for (const r of this._def.checks)
2764
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2765
+ return e;
2766
+ }
2767
+ }
2768
+ $e.create = (t) => new $e({
2769
+ checks: [],
2770
+ typeName: E.ZodBigInt,
2771
+ coerce: (t == null ? void 0 : t.coerce) ?? !1,
2772
+ ...N(t)
2773
+ });
2774
+ class yt extends O {
2775
+ _parse(e) {
2776
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== T.boolean) {
2777
+ const s = this._getOrReturnCtx(e);
2778
+ return k(s, {
2779
+ code: m.invalid_type,
2780
+ expected: T.boolean,
2781
+ received: s.parsedType
2782
+ }), j;
2783
+ }
2784
+ return ie(e.data);
2785
+ }
2786
+ }
2787
+ yt.create = (t) => new yt({
2788
+ typeName: E.ZodBoolean,
2789
+ coerce: (t == null ? void 0 : t.coerce) || !1,
2790
+ ...N(t)
2791
+ });
2792
+ class He extends O {
2793
+ _parse(e) {
2794
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== T.date) {
2795
+ const a = this._getOrReturnCtx(e);
2796
+ return k(a, {
2797
+ code: m.invalid_type,
2798
+ expected: T.date,
2799
+ received: a.parsedType
2800
+ }), j;
2801
+ }
2802
+ if (Number.isNaN(e.data.getTime())) {
2803
+ const a = this._getOrReturnCtx(e);
2804
+ return k(a, {
2805
+ code: m.invalid_date
2806
+ }), j;
2807
+ }
2808
+ const s = new se();
2809
+ let n;
2810
+ for (const a of this._def.checks)
2811
+ a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), k(n, {
2812
+ code: m.too_small,
2813
+ message: a.message,
2814
+ inclusive: !0,
2815
+ exact: !1,
2816
+ minimum: a.value,
2817
+ type: "date"
2818
+ }), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), k(n, {
2819
+ code: m.too_big,
2820
+ message: a.message,
2821
+ inclusive: !0,
2822
+ exact: !1,
2823
+ maximum: a.value,
2824
+ type: "date"
2825
+ }), s.dirty()) : F.assertNever(a);
2826
+ return {
2827
+ status: s.value,
2828
+ value: new Date(e.data.getTime())
2829
+ };
2830
+ }
2831
+ _addCheck(e) {
2832
+ return new He({
2833
+ ...this._def,
2834
+ checks: [...this._def.checks, e]
2835
+ });
2836
+ }
2837
+ min(e, r) {
2838
+ return this._addCheck({
2839
+ kind: "min",
2840
+ value: e.getTime(),
2841
+ message: S.toString(r)
2842
+ });
2843
+ }
2844
+ max(e, r) {
2845
+ return this._addCheck({
2846
+ kind: "max",
2847
+ value: e.getTime(),
2848
+ message: S.toString(r)
2849
+ });
2850
+ }
2851
+ get minDate() {
2852
+ let e = null;
2853
+ for (const r of this._def.checks)
2854
+ r.kind === "min" && (e === null || r.value > e) && (e = r.value);
2855
+ return e != null ? new Date(e) : null;
2856
+ }
2857
+ get maxDate() {
2858
+ let e = null;
2859
+ for (const r of this._def.checks)
2860
+ r.kind === "max" && (e === null || r.value < e) && (e = r.value);
2861
+ return e != null ? new Date(e) : null;
2862
+ }
2863
+ }
2864
+ He.create = (t) => new He({
2865
+ checks: [],
2866
+ coerce: (t == null ? void 0 : t.coerce) || !1,
2867
+ typeName: E.ZodDate,
2868
+ ...N(t)
2869
+ });
2870
+ class Lt extends O {
2871
+ _parse(e) {
2872
+ if (this._getType(e) !== T.symbol) {
2873
+ const s = this._getOrReturnCtx(e);
2874
+ return k(s, {
2875
+ code: m.invalid_type,
2876
+ expected: T.symbol,
2877
+ received: s.parsedType
2878
+ }), j;
2879
+ }
2880
+ return ie(e.data);
2881
+ }
2882
+ }
2883
+ Lt.create = (t) => new Lt({
2884
+ typeName: E.ZodSymbol,
2885
+ ...N(t)
2886
+ });
2887
+ class gt extends O {
2888
+ _parse(e) {
2889
+ if (this._getType(e) !== T.undefined) {
2890
+ const s = this._getOrReturnCtx(e);
2891
+ return k(s, {
2892
+ code: m.invalid_type,
2893
+ expected: T.undefined,
2894
+ received: s.parsedType
2895
+ }), j;
2896
+ }
2897
+ return ie(e.data);
2898
+ }
2899
+ }
2900
+ gt.create = (t) => new gt({
2901
+ typeName: E.ZodUndefined,
2902
+ ...N(t)
2903
+ });
2904
+ class vt extends O {
2905
+ _parse(e) {
2906
+ if (this._getType(e) !== T.null) {
2907
+ const s = this._getOrReturnCtx(e);
2908
+ return k(s, {
2909
+ code: m.invalid_type,
2910
+ expected: T.null,
2911
+ received: s.parsedType
2912
+ }), j;
2913
+ }
2914
+ return ie(e.data);
2915
+ }
2916
+ }
2917
+ vt.create = (t) => new vt({
2918
+ typeName: E.ZodNull,
2919
+ ...N(t)
2920
+ });
2921
+ class at extends O {
2922
+ constructor() {
2923
+ super(...arguments), this._any = !0;
2924
+ }
2925
+ _parse(e) {
2926
+ return ie(e.data);
2927
+ }
2928
+ }
2929
+ at.create = (t) => new at({
2930
+ typeName: E.ZodAny,
2931
+ ...N(t)
2932
+ });
2933
+ class Ye extends O {
2934
+ constructor() {
2935
+ super(...arguments), this._unknown = !0;
2936
+ }
2937
+ _parse(e) {
2938
+ return ie(e.data);
2939
+ }
2940
+ }
2941
+ Ye.create = (t) => new Ye({
2942
+ typeName: E.ZodUnknown,
2943
+ ...N(t)
2944
+ });
2945
+ class Fe extends O {
2946
+ _parse(e) {
2947
+ const r = this._getOrReturnCtx(e);
2948
+ return k(r, {
2949
+ code: m.invalid_type,
2950
+ expected: T.never,
2951
+ received: r.parsedType
2952
+ }), j;
2953
+ }
2954
+ }
2955
+ Fe.create = (t) => new Fe({
2956
+ typeName: E.ZodNever,
2957
+ ...N(t)
2958
+ });
2959
+ class $t extends O {
2960
+ _parse(e) {
2961
+ if (this._getType(e) !== T.undefined) {
2962
+ const s = this._getOrReturnCtx(e);
2963
+ return k(s, {
2964
+ code: m.invalid_type,
2965
+ expected: T.void,
2966
+ received: s.parsedType
2967
+ }), j;
2968
+ }
2969
+ return ie(e.data);
2970
+ }
2971
+ }
2972
+ $t.create = (t) => new $t({
2973
+ typeName: E.ZodVoid,
2974
+ ...N(t)
2975
+ });
2976
+ class _e extends O {
2977
+ _parse(e) {
2978
+ const { ctx: r, status: s } = this._processInputParams(e), n = this._def;
2979
+ if (r.parsedType !== T.array)
2980
+ return k(r, {
2981
+ code: m.invalid_type,
2982
+ expected: T.array,
2983
+ received: r.parsedType
2984
+ }), j;
2985
+ if (n.exactLength !== null) {
2986
+ const i = r.data.length > n.exactLength.value, o = r.data.length < n.exactLength.value;
2987
+ (i || o) && (k(r, {
2988
+ code: i ? m.too_big : m.too_small,
2989
+ minimum: o ? n.exactLength.value : void 0,
2990
+ maximum: i ? n.exactLength.value : void 0,
2991
+ type: "array",
2992
+ inclusive: !0,
2993
+ exact: !0,
2994
+ message: n.exactLength.message
2995
+ }), s.dirty());
2996
+ }
2997
+ if (n.minLength !== null && r.data.length < n.minLength.value && (k(r, {
2998
+ code: m.too_small,
2999
+ minimum: n.minLength.value,
3000
+ type: "array",
3001
+ inclusive: !0,
3002
+ exact: !1,
3003
+ message: n.minLength.message
3004
+ }), s.dirty()), n.maxLength !== null && r.data.length > n.maxLength.value && (k(r, {
3005
+ code: m.too_big,
3006
+ maximum: n.maxLength.value,
3007
+ type: "array",
3008
+ inclusive: !0,
3009
+ exact: !1,
3010
+ message: n.maxLength.message
3011
+ }), s.dirty()), r.common.async)
3012
+ return Promise.all([...r.data].map((i, o) => n.type._parseAsync(new Ae(r, i, r.path, o)))).then((i) => se.mergeArray(s, i));
3013
+ const a = [...r.data].map((i, o) => n.type._parseSync(new Ae(r, i, r.path, o)));
3014
+ return se.mergeArray(s, a);
3015
+ }
3016
+ get element() {
3017
+ return this._def.type;
3018
+ }
3019
+ min(e, r) {
3020
+ return new _e({
3021
+ ...this._def,
3022
+ minLength: { value: e, message: S.toString(r) }
3023
+ });
3024
+ }
3025
+ max(e, r) {
3026
+ return new _e({
3027
+ ...this._def,
3028
+ maxLength: { value: e, message: S.toString(r) }
3029
+ });
3030
+ }
3031
+ length(e, r) {
3032
+ return new _e({
3033
+ ...this._def,
3034
+ exactLength: { value: e, message: S.toString(r) }
3035
+ });
3036
+ }
3037
+ nonempty(e) {
3038
+ return this.min(1, e);
3039
+ }
3040
+ }
3041
+ _e.create = (t, e) => new _e({
3042
+ type: t,
3043
+ minLength: null,
3044
+ maxLength: null,
3045
+ exactLength: null,
3046
+ typeName: E.ZodArray,
3047
+ ...N(e)
3048
+ });
3049
+ function tt(t) {
3050
+ if (t instanceof z) {
3051
+ const e = {};
3052
+ for (const r in t.shape) {
3053
+ const s = t.shape[r];
3054
+ e[r] = Se.create(tt(s));
3055
+ }
3056
+ return new z({
3057
+ ...t._def,
3058
+ shape: () => e
3059
+ });
3060
+ } else return t instanceof _e ? new _e({
3061
+ ...t._def,
3062
+ type: tt(t.element)
3063
+ }) : t instanceof Se ? Se.create(tt(t.unwrap())) : t instanceof ze ? ze.create(tt(t.unwrap())) : t instanceof je ? je.create(t.items.map((e) => tt(e))) : t;
3064
+ }
3065
+ class z extends O {
3066
+ constructor() {
3067
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
3068
+ }
3069
+ _getCached() {
3070
+ if (this._cached !== null)
3071
+ return this._cached;
3072
+ const e = this._def.shape(), r = F.objectKeys(e);
3073
+ return this._cached = { shape: e, keys: r }, this._cached;
3074
+ }
3075
+ _parse(e) {
3076
+ if (this._getType(e) !== T.object) {
3077
+ const f = this._getOrReturnCtx(e);
3078
+ return k(f, {
3079
+ code: m.invalid_type,
3080
+ expected: T.object,
3081
+ received: f.parsedType
3082
+ }), j;
3083
+ }
3084
+ const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
3085
+ if (!(this._def.catchall instanceof Fe && this._def.unknownKeys === "strip"))
3086
+ for (const f in n.data)
3087
+ i.includes(f) || o.push(f);
3088
+ const d = [];
3089
+ for (const f of i) {
3090
+ const _ = a[f], y = n.data[f];
3091
+ d.push({
3092
+ key: { status: "valid", value: f },
3093
+ value: _._parse(new Ae(n, y, n.path, f)),
3094
+ alwaysSet: f in n.data
3095
+ });
3096
+ }
3097
+ if (this._def.catchall instanceof Fe) {
3098
+ const f = this._def.unknownKeys;
3099
+ if (f === "passthrough")
3100
+ for (const _ of o)
3101
+ d.push({
3102
+ key: { status: "valid", value: _ },
3103
+ value: { status: "valid", value: n.data[_] }
3104
+ });
3105
+ else if (f === "strict")
3106
+ o.length > 0 && (k(n, {
3107
+ code: m.unrecognized_keys,
3108
+ keys: o
3109
+ }), s.dirty());
3110
+ else if (f !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
3111
+ } else {
3112
+ const f = this._def.catchall;
3113
+ for (const _ of o) {
3114
+ const y = n.data[_];
3115
+ d.push({
3116
+ key: { status: "valid", value: _ },
3117
+ value: f._parse(
3118
+ new Ae(n, y, n.path, _)
3119
+ //, ctx.child(key), value, getParsedType(value)
3120
+ ),
3121
+ alwaysSet: _ in n.data
3122
+ });
3123
+ }
3124
+ }
3125
+ return n.common.async ? Promise.resolve().then(async () => {
3126
+ const f = [];
3127
+ for (const _ of d) {
3128
+ const y = await _.key, v = await _.value;
3129
+ f.push({
3130
+ key: y,
3131
+ value: v,
3132
+ alwaysSet: _.alwaysSet
3133
+ });
3134
+ }
3135
+ return f;
3136
+ }).then((f) => se.mergeObjectSync(s, f)) : se.mergeObjectSync(s, d);
3137
+ }
3138
+ get shape() {
3139
+ return this._def.shape();
3140
+ }
3141
+ strict(e) {
3142
+ return S.errToObj, new z({
3143
+ ...this._def,
3144
+ unknownKeys: "strict",
3145
+ ...e !== void 0 ? {
3146
+ errorMap: (r, s) => {
3147
+ var a, i;
3148
+ const n = ((i = (a = this._def).errorMap) == null ? void 0 : i.call(a, r, s).message) ?? s.defaultError;
3149
+ return r.code === "unrecognized_keys" ? {
3150
+ message: S.errToObj(e).message ?? n
3151
+ } : {
3152
+ message: n
3153
+ };
3154
+ }
3155
+ } : {}
3156
+ });
3157
+ }
3158
+ strip() {
3159
+ return new z({
3160
+ ...this._def,
3161
+ unknownKeys: "strip"
3162
+ });
3163
+ }
3164
+ passthrough() {
3165
+ return new z({
3166
+ ...this._def,
3167
+ unknownKeys: "passthrough"
3168
+ });
3169
+ }
3170
+ // const AugmentFactory =
3171
+ // <Def extends ZodObjectDef>(def: Def) =>
3172
+ // <Augmentation extends ZodRawShape>(
3173
+ // augmentation: Augmentation
3174
+ // ): ZodObject<
3175
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
3176
+ // Def["unknownKeys"],
3177
+ // Def["catchall"]
3178
+ // > => {
3179
+ // return new ZodObject({
3180
+ // ...def,
3181
+ // shape: () => ({
3182
+ // ...def.shape(),
3183
+ // ...augmentation,
3184
+ // }),
3185
+ // }) as any;
3186
+ // };
3187
+ extend(e) {
3188
+ return new z({
3189
+ ...this._def,
3190
+ shape: () => ({
3191
+ ...this._def.shape(),
3192
+ ...e
3193
+ })
3194
+ });
3195
+ }
3196
+ /**
3197
+ * Prior to zod@1.0.12 there was a bug in the
3198
+ * inferred type of merged objects. Please
3199
+ * upgrade if you are experiencing issues.
3200
+ */
3201
+ merge(e) {
3202
+ return new z({
3203
+ unknownKeys: e._def.unknownKeys,
3204
+ catchall: e._def.catchall,
3205
+ shape: () => ({
3206
+ ...this._def.shape(),
3207
+ ...e._def.shape()
3208
+ }),
3209
+ typeName: E.ZodObject
3210
+ });
3211
+ }
3212
+ // merge<
3213
+ // Incoming extends AnyZodObject,
3214
+ // Augmentation extends Incoming["shape"],
3215
+ // NewOutput extends {
3216
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
3217
+ // ? Augmentation[k]["_output"]
3218
+ // : k extends keyof Output
3219
+ // ? Output[k]
3220
+ // : never;
3221
+ // },
3222
+ // NewInput extends {
3223
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
3224
+ // ? Augmentation[k]["_input"]
3225
+ // : k extends keyof Input
3226
+ // ? Input[k]
3227
+ // : never;
3228
+ // }
3229
+ // >(
3230
+ // merging: Incoming
3231
+ // ): ZodObject<
3232
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3233
+ // Incoming["_def"]["unknownKeys"],
3234
+ // Incoming["_def"]["catchall"],
3235
+ // NewOutput,
3236
+ // NewInput
3237
+ // > {
3238
+ // const merged: any = new ZodObject({
3239
+ // unknownKeys: merging._def.unknownKeys,
3240
+ // catchall: merging._def.catchall,
3241
+ // shape: () =>
3242
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3243
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
3244
+ // }) as any;
3245
+ // return merged;
3246
+ // }
3247
+ setKey(e, r) {
3248
+ return this.augment({ [e]: r });
3249
+ }
3250
+ // merge<Incoming extends AnyZodObject>(
3251
+ // merging: Incoming
3252
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
3253
+ // ZodObject<
3254
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3255
+ // Incoming["_def"]["unknownKeys"],
3256
+ // Incoming["_def"]["catchall"]
3257
+ // > {
3258
+ // // const mergedShape = objectUtil.mergeShapes(
3259
+ // // this._def.shape(),
3260
+ // // merging._def.shape()
3261
+ // // );
3262
+ // const merged: any = new ZodObject({
3263
+ // unknownKeys: merging._def.unknownKeys,
3264
+ // catchall: merging._def.catchall,
3265
+ // shape: () =>
3266
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3267
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
3268
+ // }) as any;
3269
+ // return merged;
3270
+ // }
3271
+ catchall(e) {
3272
+ return new z({
3273
+ ...this._def,
3274
+ catchall: e
3275
+ });
3276
+ }
3277
+ pick(e) {
3278
+ const r = {};
3279
+ for (const s of F.objectKeys(e))
3280
+ e[s] && this.shape[s] && (r[s] = this.shape[s]);
3281
+ return new z({
3282
+ ...this._def,
3283
+ shape: () => r
3284
+ });
3285
+ }
3286
+ omit(e) {
3287
+ const r = {};
3288
+ for (const s of F.objectKeys(this.shape))
3289
+ e[s] || (r[s] = this.shape[s]);
3290
+ return new z({
3291
+ ...this._def,
3292
+ shape: () => r
3293
+ });
3294
+ }
3295
+ /**
3296
+ * @deprecated
3297
+ */
3298
+ deepPartial() {
3299
+ return tt(this);
3300
+ }
3301
+ partial(e) {
3302
+ const r = {};
3303
+ for (const s of F.objectKeys(this.shape)) {
3304
+ const n = this.shape[s];
3305
+ e && !e[s] ? r[s] = n : r[s] = n.optional();
3306
+ }
3307
+ return new z({
3308
+ ...this._def,
3309
+ shape: () => r
3310
+ });
3311
+ }
3312
+ required(e) {
3313
+ const r = {};
3314
+ for (const s of F.objectKeys(this.shape))
3315
+ if (e && !e[s])
3316
+ r[s] = this.shape[s];
3317
+ else {
3318
+ let a = this.shape[s];
3319
+ for (; a instanceof Se; )
3320
+ a = a._def.innerType;
3321
+ r[s] = a;
3322
+ }
3323
+ return new z({
3324
+ ...this._def,
3325
+ shape: () => r
3326
+ });
3327
+ }
3328
+ keyof() {
3329
+ return as(F.objectKeys(this.shape));
3330
+ }
3331
+ }
3332
+ z.create = (t, e) => new z({
3333
+ shape: () => t,
3334
+ unknownKeys: "strip",
3335
+ catchall: Fe.create(),
3336
+ typeName: E.ZodObject,
3337
+ ...N(e)
3338
+ });
3339
+ z.strictCreate = (t, e) => new z({
3340
+ shape: () => t,
3341
+ unknownKeys: "strict",
3342
+ catchall: Fe.create(),
3343
+ typeName: E.ZodObject,
3344
+ ...N(e)
3345
+ });
3346
+ z.lazycreate = (t, e) => new z({
3347
+ shape: t,
3348
+ unknownKeys: "strip",
3349
+ catchall: Fe.create(),
3350
+ typeName: E.ZodObject,
3351
+ ...N(e)
3352
+ });
3353
+ class _t extends O {
3354
+ _parse(e) {
3355
+ const { ctx: r } = this._processInputParams(e), s = this._def.options;
3356
+ function n(a) {
3357
+ for (const o of a)
3358
+ if (o.result.status === "valid")
3359
+ return o.result;
3360
+ for (const o of a)
3361
+ if (o.result.status === "dirty")
3362
+ return r.common.issues.push(...o.ctx.common.issues), o.result;
3363
+ const i = a.map((o) => new he(o.ctx.common.issues));
3364
+ return k(r, {
3365
+ code: m.invalid_union,
3366
+ unionErrors: i
3367
+ }), j;
3368
+ }
3369
+ if (r.common.async)
3370
+ return Promise.all(s.map(async (a) => {
3371
+ const i = {
3372
+ ...r,
3373
+ common: {
3374
+ ...r.common,
3375
+ issues: []
3376
+ },
3377
+ parent: null
3378
+ };
3379
+ return {
3380
+ result: await a._parseAsync({
3381
+ data: r.data,
3382
+ path: r.path,
3383
+ parent: i
3384
+ }),
3385
+ ctx: i
3386
+ };
3387
+ })).then(n);
3388
+ {
3389
+ let a;
3390
+ const i = [];
3391
+ for (const d of s) {
3392
+ const f = {
3393
+ ...r,
3394
+ common: {
3395
+ ...r.common,
3396
+ issues: []
3397
+ },
3398
+ parent: null
3399
+ }, _ = d._parseSync({
3400
+ data: r.data,
3401
+ path: r.path,
3402
+ parent: f
3403
+ });
3404
+ if (_.status === "valid")
3405
+ return _;
3406
+ _.status === "dirty" && !a && (a = { result: _, ctx: f }), f.common.issues.length && i.push(f.common.issues);
3407
+ }
3408
+ if (a)
3409
+ return r.common.issues.push(...a.ctx.common.issues), a.result;
3410
+ const o = i.map((d) => new he(d));
3411
+ return k(r, {
3412
+ code: m.invalid_union,
3413
+ unionErrors: o
3414
+ }), j;
3415
+ }
3416
+ }
3417
+ get options() {
3418
+ return this._def.options;
3419
+ }
3420
+ }
3421
+ _t.create = (t, e) => new _t({
3422
+ options: t,
3423
+ typeName: E.ZodUnion,
3424
+ ...N(e)
3425
+ });
3426
+ const Oe = (t) => t instanceof kt ? Oe(t.schema) : t instanceof be ? Oe(t.innerType()) : t instanceof wt ? [t.value] : t instanceof Ue ? t.options : t instanceof Tt ? F.objectValues(t.enum) : t instanceof St ? Oe(t._def.innerType) : t instanceof gt ? [void 0] : t instanceof vt ? [null] : t instanceof Se ? [void 0, ...Oe(t.unwrap())] : t instanceof ze ? [null, ...Oe(t.unwrap())] : t instanceof dr || t instanceof jt ? Oe(t.unwrap()) : t instanceof At ? Oe(t._def.innerType) : [];
3427
+ class qt extends O {
3428
+ _parse(e) {
3429
+ const { ctx: r } = this._processInputParams(e);
3430
+ if (r.parsedType !== T.object)
3431
+ return k(r, {
3432
+ code: m.invalid_type,
3433
+ expected: T.object,
3434
+ received: r.parsedType
3435
+ }), j;
3436
+ const s = this.discriminator, n = r.data[s], a = this.optionsMap.get(n);
3437
+ return a ? r.common.async ? a._parseAsync({
3438
+ data: r.data,
3439
+ path: r.path,
3440
+ parent: r
3441
+ }) : a._parseSync({
3442
+ data: r.data,
3443
+ path: r.path,
3444
+ parent: r
3445
+ }) : (k(r, {
3446
+ code: m.invalid_union_discriminator,
3447
+ options: Array.from(this.optionsMap.keys()),
3448
+ path: [s]
3449
+ }), j);
3450
+ }
3451
+ get discriminator() {
3452
+ return this._def.discriminator;
3453
+ }
3454
+ get options() {
3455
+ return this._def.options;
3456
+ }
3457
+ get optionsMap() {
3458
+ return this._def.optionsMap;
3459
+ }
3460
+ /**
3461
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
3462
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
3463
+ * have a different value for each object in the union.
3464
+ * @param discriminator the name of the discriminator property
3465
+ * @param types an array of object schemas
3466
+ * @param params
3467
+ */
3468
+ static create(e, r, s) {
3469
+ const n = /* @__PURE__ */ new Map();
3470
+ for (const a of r) {
3471
+ const i = Oe(a.shape[e]);
3472
+ if (!i.length)
3473
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
3474
+ for (const o of i) {
3475
+ if (n.has(o))
3476
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
3477
+ n.set(o, a);
3478
+ }
3479
+ }
3480
+ return new qt({
3481
+ typeName: E.ZodDiscriminatedUnion,
3482
+ discriminator: e,
3483
+ options: r,
3484
+ optionsMap: n,
3485
+ ...N(s)
3486
+ });
3487
+ }
3488
+ }
3489
+ function sr(t, e) {
3490
+ const r = Ve(t), s = Ve(e);
3491
+ if (t === e)
3492
+ return { valid: !0, data: t };
3493
+ if (r === T.object && s === T.object) {
3494
+ const n = F.objectKeys(e), a = F.objectKeys(t).filter((o) => n.indexOf(o) !== -1), i = { ...t, ...e };
3495
+ for (const o of a) {
3496
+ const d = sr(t[o], e[o]);
3497
+ if (!d.valid)
3498
+ return { valid: !1 };
3499
+ i[o] = d.data;
3500
+ }
3501
+ return { valid: !0, data: i };
3502
+ } else if (r === T.array && s === T.array) {
3503
+ if (t.length !== e.length)
3504
+ return { valid: !1 };
3505
+ const n = [];
3506
+ for (let a = 0; a < t.length; a++) {
3507
+ const i = t[a], o = e[a], d = sr(i, o);
3508
+ if (!d.valid)
3509
+ return { valid: !1 };
3510
+ n.push(d.data);
3511
+ }
3512
+ return { valid: !0, data: n };
3513
+ } else return r === T.date && s === T.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
3514
+ }
3515
+ class bt extends O {
3516
+ _parse(e) {
3517
+ const { status: r, ctx: s } = this._processInputParams(e), n = (a, i) => {
3518
+ if (tr(a) || tr(i))
3519
+ return j;
3520
+ const o = sr(a.value, i.value);
3521
+ return o.valid ? ((rr(a) || rr(i)) && r.dirty(), { status: r.value, value: o.data }) : (k(s, {
3522
+ code: m.invalid_intersection_types
3523
+ }), j);
3524
+ };
3525
+ return s.common.async ? Promise.all([
3526
+ this._def.left._parseAsync({
3527
+ data: s.data,
3528
+ path: s.path,
3529
+ parent: s
3530
+ }),
3531
+ this._def.right._parseAsync({
3532
+ data: s.data,
3533
+ path: s.path,
3534
+ parent: s
3535
+ })
3536
+ ]).then(([a, i]) => n(a, i)) : n(this._def.left._parseSync({
3537
+ data: s.data,
3538
+ path: s.path,
3539
+ parent: s
3540
+ }), this._def.right._parseSync({
3541
+ data: s.data,
3542
+ path: s.path,
3543
+ parent: s
3544
+ }));
3545
+ }
3546
+ }
3547
+ bt.create = (t, e, r) => new bt({
3548
+ left: t,
3549
+ right: e,
3550
+ typeName: E.ZodIntersection,
3551
+ ...N(r)
3552
+ });
3553
+ class je extends O {
3554
+ _parse(e) {
3555
+ const { status: r, ctx: s } = this._processInputParams(e);
3556
+ if (s.parsedType !== T.array)
3557
+ return k(s, {
3558
+ code: m.invalid_type,
3559
+ expected: T.array,
3560
+ received: s.parsedType
3561
+ }), j;
3562
+ if (s.data.length < this._def.items.length)
3563
+ return k(s, {
3564
+ code: m.too_small,
3565
+ minimum: this._def.items.length,
3566
+ inclusive: !0,
3567
+ exact: !1,
3568
+ type: "array"
3569
+ }), j;
3570
+ !this._def.rest && s.data.length > this._def.items.length && (k(s, {
3571
+ code: m.too_big,
3572
+ maximum: this._def.items.length,
3573
+ inclusive: !0,
3574
+ exact: !1,
3575
+ type: "array"
3576
+ }), r.dirty());
3577
+ const a = [...s.data].map((i, o) => {
3578
+ const d = this._def.items[o] || this._def.rest;
3579
+ return d ? d._parse(new Ae(s, i, s.path, o)) : null;
3580
+ }).filter((i) => !!i);
3581
+ return s.common.async ? Promise.all(a).then((i) => se.mergeArray(r, i)) : se.mergeArray(r, a);
3582
+ }
3583
+ get items() {
3584
+ return this._def.items;
3585
+ }
3586
+ rest(e) {
3587
+ return new je({
3588
+ ...this._def,
3589
+ rest: e
3590
+ });
3591
+ }
3592
+ }
3593
+ je.create = (t, e) => {
3594
+ if (!Array.isArray(t))
3595
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
3596
+ return new je({
3597
+ items: t,
3598
+ typeName: E.ZodTuple,
3599
+ rest: null,
3600
+ ...N(e)
3601
+ });
3602
+ };
3603
+ class xt extends O {
3604
+ get keySchema() {
3605
+ return this._def.keyType;
3606
+ }
3607
+ get valueSchema() {
3608
+ return this._def.valueType;
3609
+ }
3610
+ _parse(e) {
3611
+ const { status: r, ctx: s } = this._processInputParams(e);
3612
+ if (s.parsedType !== T.object)
3613
+ return k(s, {
3614
+ code: m.invalid_type,
3615
+ expected: T.object,
3616
+ received: s.parsedType
3617
+ }), j;
3618
+ const n = [], a = this._def.keyType, i = this._def.valueType;
3619
+ for (const o in s.data)
3620
+ n.push({
3621
+ key: a._parse(new Ae(s, o, s.path, o)),
3622
+ value: i._parse(new Ae(s, s.data[o], s.path, o)),
3623
+ alwaysSet: o in s.data
3624
+ });
3625
+ return s.common.async ? se.mergeObjectAsync(r, n) : se.mergeObjectSync(r, n);
3626
+ }
3627
+ get element() {
3628
+ return this._def.valueType;
3629
+ }
3630
+ static create(e, r, s) {
3631
+ return r instanceof O ? new xt({
3632
+ keyType: e,
3633
+ valueType: r,
3634
+ typeName: E.ZodRecord,
3635
+ ...N(s)
3636
+ }) : new xt({
3637
+ keyType: ve.create(),
3638
+ valueType: e,
3639
+ typeName: E.ZodRecord,
3640
+ ...N(r)
3641
+ });
3642
+ }
3643
+ }
3644
+ class Ut extends O {
3645
+ get keySchema() {
3646
+ return this._def.keyType;
3647
+ }
3648
+ get valueSchema() {
3649
+ return this._def.valueType;
3650
+ }
3651
+ _parse(e) {
3652
+ const { status: r, ctx: s } = this._processInputParams(e);
3653
+ if (s.parsedType !== T.map)
3654
+ return k(s, {
3655
+ code: m.invalid_type,
3656
+ expected: T.map,
3657
+ received: s.parsedType
3658
+ }), j;
3659
+ const n = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, d], f) => ({
3660
+ key: n._parse(new Ae(s, o, s.path, [f, "key"])),
3661
+ value: a._parse(new Ae(s, d, s.path, [f, "value"]))
3662
+ }));
3663
+ if (s.common.async) {
3664
+ const o = /* @__PURE__ */ new Map();
3665
+ return Promise.resolve().then(async () => {
3666
+ for (const d of i) {
3667
+ const f = await d.key, _ = await d.value;
3668
+ if (f.status === "aborted" || _.status === "aborted")
3669
+ return j;
3670
+ (f.status === "dirty" || _.status === "dirty") && r.dirty(), o.set(f.value, _.value);
3671
+ }
3672
+ return { status: r.value, value: o };
3673
+ });
3674
+ } else {
3675
+ const o = /* @__PURE__ */ new Map();
3676
+ for (const d of i) {
3677
+ const f = d.key, _ = d.value;
3678
+ if (f.status === "aborted" || _.status === "aborted")
3679
+ return j;
3680
+ (f.status === "dirty" || _.status === "dirty") && r.dirty(), o.set(f.value, _.value);
3681
+ }
3682
+ return { status: r.value, value: o };
3683
+ }
3684
+ }
3685
+ }
3686
+ Ut.create = (t, e, r) => new Ut({
3687
+ valueType: e,
3688
+ keyType: t,
3689
+ typeName: E.ZodMap,
3690
+ ...N(r)
3691
+ });
3692
+ class Ge extends O {
3693
+ _parse(e) {
3694
+ const { status: r, ctx: s } = this._processInputParams(e);
3695
+ if (s.parsedType !== T.set)
3696
+ return k(s, {
3697
+ code: m.invalid_type,
3698
+ expected: T.set,
3699
+ received: s.parsedType
3700
+ }), j;
3701
+ const n = this._def;
3702
+ n.minSize !== null && s.data.size < n.minSize.value && (k(s, {
3703
+ code: m.too_small,
3704
+ minimum: n.minSize.value,
3705
+ type: "set",
3706
+ inclusive: !0,
3707
+ exact: !1,
3708
+ message: n.minSize.message
3709
+ }), r.dirty()), n.maxSize !== null && s.data.size > n.maxSize.value && (k(s, {
3710
+ code: m.too_big,
3711
+ maximum: n.maxSize.value,
3712
+ type: "set",
3713
+ inclusive: !0,
3714
+ exact: !1,
3715
+ message: n.maxSize.message
3716
+ }), r.dirty());
3717
+ const a = this._def.valueType;
3718
+ function i(d) {
3719
+ const f = /* @__PURE__ */ new Set();
3720
+ for (const _ of d) {
3721
+ if (_.status === "aborted")
3722
+ return j;
3723
+ _.status === "dirty" && r.dirty(), f.add(_.value);
3724
+ }
3725
+ return { status: r.value, value: f };
3726
+ }
3727
+ const o = [...s.data.values()].map((d, f) => a._parse(new Ae(s, d, s.path, f)));
3728
+ return s.common.async ? Promise.all(o).then((d) => i(d)) : i(o);
3729
+ }
3730
+ min(e, r) {
3731
+ return new Ge({
3732
+ ...this._def,
3733
+ minSize: { value: e, message: S.toString(r) }
3734
+ });
3735
+ }
3736
+ max(e, r) {
3737
+ return new Ge({
3738
+ ...this._def,
3739
+ maxSize: { value: e, message: S.toString(r) }
3740
+ });
3741
+ }
3742
+ size(e, r) {
3743
+ return this.min(e, r).max(e, r);
3744
+ }
3745
+ nonempty(e) {
3746
+ return this.min(1, e);
3747
+ }
3748
+ }
3749
+ Ge.create = (t, e) => new Ge({
3750
+ valueType: t,
3751
+ minSize: null,
3752
+ maxSize: null,
3753
+ typeName: E.ZodSet,
3754
+ ...N(e)
3755
+ });
3756
+ class st extends O {
3757
+ constructor() {
3758
+ super(...arguments), this.validate = this.implement;
3759
+ }
3760
+ _parse(e) {
3761
+ const { ctx: r } = this._processInputParams(e);
3762
+ if (r.parsedType !== T.function)
3763
+ return k(r, {
3764
+ code: m.invalid_type,
3765
+ expected: T.function,
3766
+ received: r.parsedType
3767
+ }), j;
3768
+ function s(o, d) {
3769
+ return Zt({
3770
+ data: o,
3771
+ path: r.path,
3772
+ errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, Mt(), nt].filter((f) => !!f),
3773
+ issueData: {
3774
+ code: m.invalid_arguments,
3775
+ argumentsError: d
3776
+ }
3777
+ });
3778
+ }
3779
+ function n(o, d) {
3780
+ return Zt({
3781
+ data: o,
3782
+ path: r.path,
3783
+ errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, Mt(), nt].filter((f) => !!f),
3784
+ issueData: {
3785
+ code: m.invalid_return_type,
3786
+ returnTypeError: d
3787
+ }
3788
+ });
3789
+ }
3790
+ const a = { errorMap: r.common.contextualErrorMap }, i = r.data;
3791
+ if (this._def.returns instanceof it) {
3792
+ const o = this;
3793
+ return ie(async function(...d) {
3794
+ const f = new he([]), _ = await o._def.args.parseAsync(d, a).catch((W) => {
3795
+ throw f.addIssue(s(d, W)), f;
3796
+ }), y = await Reflect.apply(i, this, _);
3797
+ return await o._def.returns._def.type.parseAsync(y, a).catch((W) => {
3798
+ throw f.addIssue(n(y, W)), f;
3799
+ });
3800
+ });
3801
+ } else {
3802
+ const o = this;
3803
+ return ie(function(...d) {
3804
+ const f = o._def.args.safeParse(d, a);
3805
+ if (!f.success)
3806
+ throw new he([s(d, f.error)]);
3807
+ const _ = Reflect.apply(i, this, f.data), y = o._def.returns.safeParse(_, a);
3808
+ if (!y.success)
3809
+ throw new he([n(_, y.error)]);
3810
+ return y.data;
3811
+ });
3812
+ }
3813
+ }
3814
+ parameters() {
3815
+ return this._def.args;
3816
+ }
3817
+ returnType() {
3818
+ return this._def.returns;
3819
+ }
3820
+ args(...e) {
3821
+ return new st({
3822
+ ...this._def,
3823
+ args: je.create(e).rest(Ye.create())
3824
+ });
3825
+ }
3826
+ returns(e) {
3827
+ return new st({
3828
+ ...this._def,
3829
+ returns: e
3830
+ });
3831
+ }
3832
+ implement(e) {
3833
+ return this.parse(e);
3834
+ }
3835
+ strictImplement(e) {
3836
+ return this.parse(e);
3837
+ }
3838
+ static create(e, r, s) {
3839
+ return new st({
3840
+ args: e || je.create([]).rest(Ye.create()),
3841
+ returns: r || Ye.create(),
3842
+ typeName: E.ZodFunction,
3843
+ ...N(s)
3844
+ });
3845
+ }
3846
+ }
3847
+ class kt extends O {
3848
+ get schema() {
3849
+ return this._def.getter();
3850
+ }
3851
+ _parse(e) {
3852
+ const { ctx: r } = this._processInputParams(e);
3853
+ return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
3854
+ }
3855
+ }
3856
+ kt.create = (t, e) => new kt({
3857
+ getter: t,
3858
+ typeName: E.ZodLazy,
3859
+ ...N(e)
3860
+ });
3861
+ class wt extends O {
3862
+ _parse(e) {
3863
+ if (e.data !== this._def.value) {
3864
+ const r = this._getOrReturnCtx(e);
3865
+ return k(r, {
3866
+ received: r.data,
3867
+ code: m.invalid_literal,
3868
+ expected: this._def.value
3869
+ }), j;
3870
+ }
3871
+ return { status: "valid", value: e.data };
3872
+ }
3873
+ get value() {
3874
+ return this._def.value;
3875
+ }
3876
+ }
3877
+ wt.create = (t, e) => new wt({
3878
+ value: t,
3879
+ typeName: E.ZodLiteral,
3880
+ ...N(e)
3881
+ });
3882
+ function as(t, e) {
3883
+ return new Ue({
3884
+ values: t,
3885
+ typeName: E.ZodEnum,
3886
+ ...N(e)
3887
+ });
3888
+ }
3889
+ class Ue extends O {
3890
+ _parse(e) {
3891
+ if (typeof e.data != "string") {
3892
+ const r = this._getOrReturnCtx(e), s = this._def.values;
3893
+ return k(r, {
3894
+ expected: F.joinValues(s),
3895
+ received: r.parsedType,
3896
+ code: m.invalid_type
3897
+ }), j;
3898
+ }
3899
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
3900
+ const r = this._getOrReturnCtx(e), s = this._def.values;
3901
+ return k(r, {
3902
+ received: r.data,
3903
+ code: m.invalid_enum_value,
3904
+ options: s
3905
+ }), j;
3906
+ }
3907
+ return ie(e.data);
3908
+ }
3909
+ get options() {
3910
+ return this._def.values;
3911
+ }
3912
+ get enum() {
3913
+ const e = {};
3914
+ for (const r of this._def.values)
3915
+ e[r] = r;
3916
+ return e;
3917
+ }
3918
+ get Values() {
3919
+ const e = {};
3920
+ for (const r of this._def.values)
3921
+ e[r] = r;
3922
+ return e;
3923
+ }
3924
+ get Enum() {
3925
+ const e = {};
3926
+ for (const r of this._def.values)
3927
+ e[r] = r;
3928
+ return e;
3929
+ }
3930
+ extract(e, r = this._def) {
3931
+ return Ue.create(e, {
3932
+ ...this._def,
3933
+ ...r
3934
+ });
3935
+ }
3936
+ exclude(e, r = this._def) {
3937
+ return Ue.create(this.options.filter((s) => !e.includes(s)), {
3938
+ ...this._def,
3939
+ ...r
3940
+ });
3941
+ }
3942
+ }
3943
+ Ue.create = as;
3944
+ class Tt extends O {
3945
+ _parse(e) {
3946
+ const r = F.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
3947
+ if (s.parsedType !== T.string && s.parsedType !== T.number) {
3948
+ const n = F.objectValues(r);
3949
+ return k(s, {
3950
+ expected: F.joinValues(n),
3951
+ received: s.parsedType,
3952
+ code: m.invalid_type
3953
+ }), j;
3954
+ }
3955
+ if (this._cache || (this._cache = new Set(F.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
3956
+ const n = F.objectValues(r);
3957
+ return k(s, {
3958
+ received: s.data,
3959
+ code: m.invalid_enum_value,
3960
+ options: n
3961
+ }), j;
3962
+ }
3963
+ return ie(e.data);
3964
+ }
3965
+ get enum() {
3966
+ return this._def.values;
3967
+ }
3968
+ }
3969
+ Tt.create = (t, e) => new Tt({
3970
+ values: t,
3971
+ typeName: E.ZodNativeEnum,
3972
+ ...N(e)
3973
+ });
3974
+ class it extends O {
3975
+ unwrap() {
3976
+ return this._def.type;
3977
+ }
3978
+ _parse(e) {
3979
+ const { ctx: r } = this._processInputParams(e);
3980
+ if (r.parsedType !== T.promise && r.common.async === !1)
3981
+ return k(r, {
3982
+ code: m.invalid_type,
3983
+ expected: T.promise,
3984
+ received: r.parsedType
3985
+ }), j;
3986
+ const s = r.parsedType === T.promise ? r.data : Promise.resolve(r.data);
3987
+ return ie(s.then((n) => this._def.type.parseAsync(n, {
3988
+ path: r.path,
3989
+ errorMap: r.common.contextualErrorMap
3990
+ })));
3991
+ }
3992
+ }
3993
+ it.create = (t, e) => new it({
3994
+ type: t,
3995
+ typeName: E.ZodPromise,
3996
+ ...N(e)
3997
+ });
3998
+ class be extends O {
3999
+ innerType() {
4000
+ return this._def.schema;
4001
+ }
4002
+ sourceType() {
4003
+ return this._def.schema._def.typeName === E.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
4004
+ }
4005
+ _parse(e) {
4006
+ const { status: r, ctx: s } = this._processInputParams(e), n = this._def.effect || null, a = {
4007
+ addIssue: (i) => {
4008
+ k(s, i), i.fatal ? r.abort() : r.dirty();
4009
+ },
4010
+ get path() {
4011
+ return s.path;
4012
+ }
4013
+ };
4014
+ if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
4015
+ const i = n.transform(s.data, a);
4016
+ if (s.common.async)
4017
+ return Promise.resolve(i).then(async (o) => {
4018
+ if (r.value === "aborted")
4019
+ return j;
4020
+ const d = await this._def.schema._parseAsync({
4021
+ data: o,
4022
+ path: s.path,
4023
+ parent: s
4024
+ });
4025
+ return d.status === "aborted" ? j : d.status === "dirty" || r.value === "dirty" ? rt(d.value) : d;
4026
+ });
4027
+ {
4028
+ if (r.value === "aborted")
4029
+ return j;
4030
+ const o = this._def.schema._parseSync({
4031
+ data: i,
4032
+ path: s.path,
4033
+ parent: s
4034
+ });
4035
+ return o.status === "aborted" ? j : o.status === "dirty" || r.value === "dirty" ? rt(o.value) : o;
4036
+ }
4037
+ }
4038
+ if (n.type === "refinement") {
4039
+ const i = (o) => {
4040
+ const d = n.refinement(o, a);
4041
+ if (s.common.async)
4042
+ return Promise.resolve(d);
4043
+ if (d instanceof Promise)
4044
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
4045
+ return o;
4046
+ };
4047
+ if (s.common.async === !1) {
4048
+ const o = this._def.schema._parseSync({
4049
+ data: s.data,
4050
+ path: s.path,
4051
+ parent: s
4052
+ });
4053
+ return o.status === "aborted" ? j : (o.status === "dirty" && r.dirty(), i(o.value), { status: r.value, value: o.value });
4054
+ } else
4055
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? j : (o.status === "dirty" && r.dirty(), i(o.value).then(() => ({ status: r.value, value: o.value }))));
4056
+ }
4057
+ if (n.type === "transform")
4058
+ if (s.common.async === !1) {
4059
+ const i = this._def.schema._parseSync({
4060
+ data: s.data,
4061
+ path: s.path,
4062
+ parent: s
4063
+ });
4064
+ if (!Je(i))
4065
+ return j;
4066
+ const o = n.transform(i.value, a);
4067
+ if (o instanceof Promise)
4068
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
4069
+ return { status: r.value, value: o };
4070
+ } else
4071
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => Je(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({
4072
+ status: r.value,
4073
+ value: o
4074
+ })) : j);
4075
+ F.assertNever(n);
4076
+ }
4077
+ }
4078
+ be.create = (t, e, r) => new be({
4079
+ schema: t,
4080
+ typeName: E.ZodEffects,
4081
+ effect: e,
4082
+ ...N(r)
4083
+ });
4084
+ be.createWithPreprocess = (t, e, r) => new be({
4085
+ schema: e,
4086
+ effect: { type: "preprocess", transform: t },
4087
+ typeName: E.ZodEffects,
4088
+ ...N(r)
4089
+ });
4090
+ class Se extends O {
4091
+ _parse(e) {
4092
+ return this._getType(e) === T.undefined ? ie(void 0) : this._def.innerType._parse(e);
4093
+ }
4094
+ unwrap() {
4095
+ return this._def.innerType;
4096
+ }
4097
+ }
4098
+ Se.create = (t, e) => new Se({
4099
+ innerType: t,
4100
+ typeName: E.ZodOptional,
4101
+ ...N(e)
4102
+ });
4103
+ class ze extends O {
4104
+ _parse(e) {
4105
+ return this._getType(e) === T.null ? ie(null) : this._def.innerType._parse(e);
4106
+ }
4107
+ unwrap() {
4108
+ return this._def.innerType;
4109
+ }
4110
+ }
4111
+ ze.create = (t, e) => new ze({
4112
+ innerType: t,
4113
+ typeName: E.ZodNullable,
4114
+ ...N(e)
4115
+ });
4116
+ class St extends O {
4117
+ _parse(e) {
4118
+ const { ctx: r } = this._processInputParams(e);
4119
+ let s = r.data;
4120
+ return r.parsedType === T.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
4121
+ data: s,
4122
+ path: r.path,
4123
+ parent: r
4124
+ });
4125
+ }
4126
+ removeDefault() {
4127
+ return this._def.innerType;
4128
+ }
4129
+ }
4130
+ St.create = (t, e) => new St({
4131
+ innerType: t,
4132
+ typeName: E.ZodDefault,
4133
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
4134
+ ...N(e)
4135
+ });
4136
+ class At extends O {
4137
+ _parse(e) {
4138
+ const { ctx: r } = this._processInputParams(e), s = {
4139
+ ...r,
4140
+ common: {
4141
+ ...r.common,
4142
+ issues: []
4143
+ }
4144
+ }, n = this._def.innerType._parse({
4145
+ data: s.data,
4146
+ path: s.path,
4147
+ parent: {
4148
+ ...s
4149
+ }
4150
+ });
4151
+ return pt(n) ? n.then((a) => ({
4152
+ status: "valid",
4153
+ value: a.status === "valid" ? a.value : this._def.catchValue({
4154
+ get error() {
4155
+ return new he(s.common.issues);
4156
+ },
4157
+ input: s.data
4158
+ })
4159
+ })) : {
4160
+ status: "valid",
4161
+ value: n.status === "valid" ? n.value : this._def.catchValue({
4162
+ get error() {
4163
+ return new he(s.common.issues);
4164
+ },
4165
+ input: s.data
4166
+ })
4167
+ };
4168
+ }
4169
+ removeCatch() {
4170
+ return this._def.innerType;
4171
+ }
4172
+ }
4173
+ At.create = (t, e) => new At({
4174
+ innerType: t,
4175
+ typeName: E.ZodCatch,
4176
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
4177
+ ...N(e)
4178
+ });
4179
+ class zt extends O {
4180
+ _parse(e) {
4181
+ if (this._getType(e) !== T.nan) {
4182
+ const s = this._getOrReturnCtx(e);
4183
+ return k(s, {
4184
+ code: m.invalid_type,
4185
+ expected: T.nan,
4186
+ received: s.parsedType
4187
+ }), j;
4188
+ }
4189
+ return { status: "valid", value: e.data };
4190
+ }
4191
+ }
4192
+ zt.create = (t) => new zt({
4193
+ typeName: E.ZodNaN,
4194
+ ...N(t)
4195
+ });
4196
+ const En = Symbol("zod_brand");
4197
+ class dr extends O {
4198
+ _parse(e) {
4199
+ const { ctx: r } = this._processInputParams(e), s = r.data;
4200
+ return this._def.type._parse({
4201
+ data: s,
4202
+ path: r.path,
4203
+ parent: r
4204
+ });
4205
+ }
4206
+ unwrap() {
4207
+ return this._def.type;
4208
+ }
4209
+ }
4210
+ class Ct extends O {
4211
+ _parse(e) {
4212
+ const { status: r, ctx: s } = this._processInputParams(e);
4213
+ if (s.common.async)
4214
+ return (async () => {
4215
+ const a = await this._def.in._parseAsync({
4216
+ data: s.data,
4217
+ path: s.path,
4218
+ parent: s
4219
+ });
4220
+ return a.status === "aborted" ? j : a.status === "dirty" ? (r.dirty(), rt(a.value)) : this._def.out._parseAsync({
4221
+ data: a.value,
4222
+ path: s.path,
4223
+ parent: s
4224
+ });
4225
+ })();
4226
+ {
4227
+ const n = this._def.in._parseSync({
4228
+ data: s.data,
4229
+ path: s.path,
4230
+ parent: s
4231
+ });
4232
+ return n.status === "aborted" ? j : n.status === "dirty" ? (r.dirty(), {
4233
+ status: "dirty",
4234
+ value: n.value
4235
+ }) : this._def.out._parseSync({
4236
+ data: n.value,
4237
+ path: s.path,
4238
+ parent: s
4239
+ });
4240
+ }
4241
+ }
4242
+ static create(e, r) {
4243
+ return new Ct({
4244
+ in: e,
4245
+ out: r,
4246
+ typeName: E.ZodPipeline
4247
+ });
4248
+ }
4249
+ }
4250
+ class jt extends O {
4251
+ _parse(e) {
4252
+ const r = this._def.innerType._parse(e), s = (n) => (Je(n) && (n.value = Object.freeze(n.value)), n);
4253
+ return pt(r) ? r.then((n) => s(n)) : s(r);
4254
+ }
4255
+ unwrap() {
4256
+ return this._def.innerType;
4257
+ }
4258
+ }
4259
+ jt.create = (t, e) => new jt({
4260
+ innerType: t,
4261
+ typeName: E.ZodReadonly,
4262
+ ...N(e)
4263
+ });
4264
+ function Mr(t, e) {
4265
+ const r = typeof t == "function" ? t(e) : typeof t == "string" ? { message: t } : t;
4266
+ return typeof r == "string" ? { message: r } : r;
4267
+ }
4268
+ function is(t, e = {}, r) {
4269
+ return t ? at.create().superRefine((s, n) => {
4270
+ const a = t(s);
4271
+ if (a instanceof Promise)
4272
+ return a.then((i) => {
4273
+ if (!i) {
4274
+ const o = Mr(e, s), d = o.fatal ?? r ?? !0;
4275
+ n.addIssue({ code: "custom", ...o, fatal: d });
4276
+ }
4277
+ });
4278
+ if (!a) {
4279
+ const i = Mr(e, s), o = i.fatal ?? r ?? !0;
4280
+ n.addIssue({ code: "custom", ...i, fatal: o });
4281
+ }
4282
+ }) : at.create();
4283
+ }
4284
+ const Nn = {
4285
+ object: z.lazycreate
4286
+ };
4287
+ var E;
4288
+ (function(t) {
4289
+ t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
4290
+ })(E || (E = {}));
4291
+ const Cn = (t, e = {
4292
+ message: `Input not instance of ${t.name}`
4293
+ }) => is((r) => r instanceof t, e), os = ve.create, cs = Le.create, Rn = zt.create, On = $e.create, ls = yt.create, Vn = He.create, Fn = Lt.create, Pn = gt.create, In = vt.create, Dn = at.create, Mn = Ye.create, Zn = Fe.create, Ln = $t.create, $n = _e.create, Un = z.create, zn = z.strictCreate, Bn = _t.create, Wn = qt.create, qn = bt.create, Yn = je.create, Jn = xt.create, Hn = Ut.create, Gn = Ge.create, Xn = st.create, Qn = kt.create, Kn = wt.create, ea = Ue.create, ta = Tt.create, ra = it.create, Zr = be.create, sa = Se.create, na = ze.create, aa = be.createWithPreprocess, ia = Ct.create, oa = () => os().optional(), ca = () => cs().optional(), la = () => ls().optional(), ua = {
4294
+ string: (t) => ve.create({ ...t, coerce: !0 }),
4295
+ number: (t) => Le.create({ ...t, coerce: !0 }),
4296
+ boolean: (t) => yt.create({
4297
+ ...t,
4298
+ coerce: !0
4299
+ }),
4300
+ bigint: (t) => $e.create({ ...t, coerce: !0 }),
4301
+ date: (t) => He.create({ ...t, coerce: !0 })
4302
+ }, da = j, Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4303
+ __proto__: null,
4304
+ BRAND: En,
4305
+ DIRTY: rt,
4306
+ EMPTY_PATH: an,
4307
+ INVALID: j,
4308
+ NEVER: da,
4309
+ OK: ie,
4310
+ ParseStatus: se,
4311
+ Schema: O,
4312
+ ZodAny: at,
4313
+ ZodArray: _e,
4314
+ ZodBigInt: $e,
4315
+ ZodBoolean: yt,
4316
+ ZodBranded: dr,
4317
+ ZodCatch: At,
4318
+ ZodDate: He,
4319
+ ZodDefault: St,
4320
+ ZodDiscriminatedUnion: qt,
4321
+ ZodEffects: be,
4322
+ ZodEnum: Ue,
4323
+ ZodError: he,
4324
+ get ZodFirstPartyTypeKind() {
4325
+ return E;
4326
+ },
4327
+ ZodFunction: st,
4328
+ ZodIntersection: bt,
4329
+ ZodIssueCode: m,
4330
+ ZodLazy: kt,
4331
+ ZodLiteral: wt,
4332
+ ZodMap: Ut,
4333
+ ZodNaN: zt,
4334
+ ZodNativeEnum: Tt,
4335
+ ZodNever: Fe,
4336
+ ZodNull: vt,
4337
+ ZodNullable: ze,
4338
+ ZodNumber: Le,
4339
+ ZodObject: z,
4340
+ ZodOptional: Se,
4341
+ ZodParsedType: T,
4342
+ ZodPipeline: Ct,
4343
+ ZodPromise: it,
4344
+ ZodReadonly: jt,
4345
+ ZodRecord: xt,
4346
+ ZodSchema: O,
4347
+ ZodSet: Ge,
4348
+ ZodString: ve,
4349
+ ZodSymbol: Lt,
4350
+ ZodTransformer: be,
4351
+ ZodTuple: je,
4352
+ ZodType: O,
4353
+ ZodUndefined: gt,
4354
+ ZodUnion: _t,
4355
+ ZodUnknown: Ye,
4356
+ ZodVoid: $t,
4357
+ addIssueToContext: k,
4358
+ any: Dn,
4359
+ array: $n,
4360
+ bigint: On,
4361
+ boolean: ls,
4362
+ coerce: ua,
4363
+ custom: is,
4364
+ date: Vn,
4365
+ datetimeRegex: ns,
4366
+ defaultErrorMap: nt,
4367
+ discriminatedUnion: Wn,
4368
+ effect: Zr,
4369
+ enum: ea,
4370
+ function: Xn,
4371
+ getErrorMap: Mt,
4372
+ getParsedType: Ve,
4373
+ instanceof: Cn,
4374
+ intersection: qn,
4375
+ isAborted: tr,
4376
+ isAsync: pt,
4377
+ isDirty: rr,
4378
+ isValid: Je,
4379
+ late: Nn,
4380
+ lazy: Qn,
4381
+ literal: Kn,
4382
+ makeIssue: Zt,
4383
+ map: Hn,
4384
+ nan: Rn,
4385
+ nativeEnum: ta,
4386
+ never: Zn,
4387
+ null: In,
4388
+ nullable: na,
4389
+ number: cs,
4390
+ object: Un,
4391
+ get objectUtil() {
4392
+ return er;
4393
+ },
4394
+ oboolean: la,
4395
+ onumber: ca,
4396
+ optional: sa,
4397
+ ostring: oa,
4398
+ pipeline: ia,
4399
+ preprocess: aa,
4400
+ promise: ra,
4401
+ quotelessJson: sn,
4402
+ record: Jn,
4403
+ set: Gn,
4404
+ setErrorMap: nn,
4405
+ strictObject: zn,
4406
+ string: os,
4407
+ symbol: Fn,
4408
+ transformer: Zr,
4409
+ tuple: Yn,
4410
+ undefined: Pn,
4411
+ union: Bn,
4412
+ unknown: Mn,
4413
+ get util() {
4414
+ return F;
4415
+ },
4416
+ void: Ln
4417
+ }, Symbol.toStringTag, { value: "Module" })), Bt = (t) => /* @__PURE__ */ p.jsx(
4418
+ "button",
4419
+ {
4420
+ type: t.type || "button",
4421
+ disabled: t.isDisabled,
4422
+ className: `bg-green-500 hover:bg-green-600 text-white px-6 py-2 rounded disabled:opacity-50 *:disabled:cursor-not-allowed ${t.className}`,
4423
+ onClick: t.handleClick,
4424
+ children: t.title
4425
+ }
4426
+ ), fa = ({
4427
+ label: t,
4428
+ required: e = !1,
4429
+ file: r,
4430
+ onFileChange: s,
4431
+ error: n
4432
+ }) => {
4433
+ const a = ys(null), [i, o] = Qt(null), [d, f] = Qt(!1), _ = (v) => {
4434
+ var te;
4435
+ const W = (te = v.target.files) == null ? void 0 : te[0];
4436
+ W && (s(W), o(URL.createObjectURL(W)));
4437
+ }, y = gs(() => {
4438
+ var v;
4439
+ (v = a.current) == null || v.click();
4440
+ }, []);
4441
+ return vs(() => {
4442
+ r && o(URL.createObjectURL(r));
4443
+ }, [r]), /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
4444
+ /* @__PURE__ */ p.jsxs("div", { className: "flex flex-col", children: [
4445
+ /* @__PURE__ */ p.jsxs("label", { className: "font-medium mb-1 text-gray-700", children: [
4446
+ t,
4447
+ e && /* @__PURE__ */ p.jsx("span", { className: "text-red-500 ml-1", children: "*" })
4448
+ ] }),
4449
+ /* @__PURE__ */ p.jsxs("div", { className: "flex items-center", children: [
4450
+ /* @__PURE__ */ p.jsx(
4451
+ "button",
4452
+ {
4453
+ type: "button",
4454
+ onClick: y,
4455
+ className: "bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded",
4456
+ children: "Upload file"
4457
+ }
4458
+ ),
4459
+ /* @__PURE__ */ p.jsx(
4460
+ "input",
4461
+ {
4462
+ ref: a,
4463
+ type: "file",
4464
+ accept: "image/*,.pdf",
4465
+ className: "hidden",
4466
+ onChange: _
4467
+ }
4468
+ )
4469
+ ] }),
4470
+ /* @__PURE__ */ p.jsx(
4471
+ "div",
4472
+ {
4473
+ className: "mt-2 h-40 w-full bg-gray-200 rounded overflow-hidden flex items-center justify-center cursor-pointer",
4474
+ onClick: () => i && f(!0),
4475
+ children: i ? (r == null ? void 0 : r.type) === "application/pdf" ? /* @__PURE__ */ p.jsx(
4476
+ "object",
4477
+ {
4478
+ data: i,
4479
+ type: "application/pdf",
4480
+ width: "100%",
4481
+ height: "100%",
4482
+ children: /* @__PURE__ */ p.jsxs("p", { className: "text-gray-600 text-sm", children: [
4483
+ "Cannot preview PDF.",
4484
+ " ",
4485
+ /* @__PURE__ */ p.jsx(
4486
+ "a",
4487
+ {
4488
+ href: i,
4489
+ target: "_blank",
4490
+ rel: "noreferrer",
4491
+ className: "text-blue-600 underline",
4492
+ children: "Download PDF"
4493
+ }
4494
+ )
4495
+ ] })
4496
+ }
4497
+ ) : /* @__PURE__ */ p.jsx(
4498
+ "img",
4499
+ {
4500
+ src: i,
4501
+ alt: "Preview",
4502
+ className: "h-full object-contain"
4503
+ }
4504
+ ) : /* @__PURE__ */ p.jsx("span", { className: "text-gray-500", children: "No file selected" })
4505
+ }
4506
+ ),
4507
+ n && /* @__PURE__ */ p.jsx("span", { className: "text-red-500 text-sm mt-1", children: n })
4508
+ ] }),
4509
+ d && i && /* @__PURE__ */ p.jsx(
4510
+ "div",
4511
+ {
4512
+ className: "fixed inset-0 bg-black bg-opacity-75 z-50 flex items-center justify-center",
4513
+ onClick: () => f(!1),
4514
+ children: /* @__PURE__ */ p.jsxs(
4515
+ "div",
4516
+ {
4517
+ className: "relative w-full h-full",
4518
+ onClick: (v) => v.stopPropagation(),
4519
+ children: [
4520
+ /* @__PURE__ */ p.jsx(
4521
+ "button",
4522
+ {
4523
+ onClick: () => f(!1),
4524
+ className: "absolute top-2 right-2 text-white text-2xl",
4525
+ "aria-label": "Close preview",
4526
+ children: "×"
4527
+ }
4528
+ ),
4529
+ (r == null ? void 0 : r.type) === "application/pdf" ? /* @__PURE__ */ p.jsx(
4530
+ "object",
4531
+ {
4532
+ data: i,
4533
+ type: "application/pdf",
4534
+ className: "w-full h-full object-contain"
4535
+ }
4536
+ ) : /* @__PURE__ */ p.jsx(
4537
+ "img",
4538
+ {
4539
+ src: i,
4540
+ alt: "Full Preview",
4541
+ className: "w-full h-full object-contain"
4542
+ }
4543
+ )
4544
+ ]
4545
+ }
4546
+ )
4547
+ }
4548
+ )
4549
+ ] });
4550
+ }, Me = _s(
4551
+ ({ label: t, required: e = !1, error: r, ...s }, n) => /* @__PURE__ */ p.jsxs("div", { className: "flex flex-col", children: [
4552
+ /* @__PURE__ */ p.jsxs(
4553
+ "label",
4554
+ {
4555
+ htmlFor: s.name,
4556
+ className: "font-medium mb-1 text-gray-700",
4557
+ children: [
4558
+ t,
4559
+ e && /* @__PURE__ */ p.jsx("span", { className: "text-red-500 ml-1", children: "*" })
4560
+ ]
4561
+ }
4562
+ ),
4563
+ /* @__PURE__ */ p.jsx(
4564
+ "input",
4565
+ {
4566
+ id: s.name,
4567
+ ref: n,
4568
+ ...s,
4569
+ className: `border rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 ${r ? "border-red-500" : "border-gray-300"}`
4570
+ }
4571
+ ),
4572
+ r && /* @__PURE__ */ p.jsx("span", { className: "text-red-500 text-sm mt-1", children: r })
4573
+ ] })
4574
+ );
4575
+ Me.displayName = "InputField";
4576
+ const Et = Lr((t) => ({
4577
+ selectedProvider: null,
4578
+ form: {
4579
+ taxCode: "",
4580
+ companyName: "",
4581
+ representative: "",
4582
+ position: "",
4583
+ email: "",
4584
+ phoneNumber: null,
4585
+ address: "",
4586
+ license: null
4587
+ },
4588
+ selectedPlan: null,
4589
+ setSelectedProvider: (e) => t({ selectedProvider: e }),
4590
+ setForm: (e) => t((r) => ({
4591
+ form: { ...r.form, ...e }
4592
+ })),
4593
+ setSelectedPlan: (e) => t({ selectedPlan: e }),
4594
+ reset: () => t({
4595
+ selectedProvider: null,
4596
+ form: {
4597
+ taxCode: "",
4598
+ companyName: "",
4599
+ representative: "",
4600
+ position: "",
4601
+ email: "",
4602
+ phoneNumber: null,
4603
+ address: "",
4604
+ license: null
4605
+ },
4606
+ selectedPlan: null
4607
+ })
4608
+ })), ha = Re.object({
4609
+ taxCode: Re.string().nonempty("Mã số thuế là bắt buộc"),
4610
+ representative: Re.string().nonempty("Người đại diện là bắt buộc"),
4611
+ email: Re.string().nonempty("Email là bắt buộc").email("Email không hợp lệ"),
4612
+ address: Re.string().nonempty("Địa chỉ là bắt buộc"),
4613
+ companyName: Re.string().nonempty("Tên công ty là bắt buộc"),
4614
+ position: Re.string().optional(),
4615
+ phone: Re.string().regex(/^[0-9()+\-\s]+$/, "SĐT không hợp lệ").optional(),
4616
+ // ← here we make it `.optional()`
4617
+ license: Re.instanceof(File, {
4618
+ message: "Giấy phép đăng ký kinh doanh là bắt buộc"
4619
+ }).optional()
4620
+ }), ma = () => {
4621
+ const t = nr(), e = Et((y) => y.form), {
4622
+ control: r,
4623
+ handleSubmit: s,
4624
+ formState: { errors: n, isSubmitting: a, isValid: i }
4625
+ } = Qs({
4626
+ resolver: rn(ha),
4627
+ defaultValues: {
4628
+ taxCode: e.taxCode || "",
4629
+ representative: e.representative || "",
4630
+ email: e.email || "",
4631
+ address: e.address || "",
4632
+ companyName: e.companyName || "",
4633
+ position: e.position || "",
4634
+ phone: e.phoneNumber || "",
4635
+ license: e.license || void 0
4636
+ // handle optional license
4637
+ }
4638
+ }), o = Et((y) => y.setForm), d = mt((y) => y.nextStep), f = mt((y) => y.prevStep), _ = (y) => {
4639
+ console.log(y), o({
4640
+ taxCode: y.taxCode,
4641
+ representative: y.representative,
4642
+ email: y.email,
4643
+ address: y.address,
4644
+ companyName: y.companyName,
4645
+ position: y.position,
4646
+ phoneNumber: y.phone || null,
4647
+ // handle optional phone
4648
+ license: y.license || null
4649
+ // handle optional license
4650
+ });
4651
+ };
4652
+ return /* @__PURE__ */ p.jsxs(
4653
+ "form",
4654
+ {
4655
+ onSubmit: s(_),
4656
+ className: "w-full mx-auto p-6 bg-white shadow rounded",
4657
+ children: [
4658
+ /* @__PURE__ */ p.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-8", children: [
4659
+ /* @__PURE__ */ p.jsxs("div", { className: "space-y-4", children: [
4660
+ /* @__PURE__ */ p.jsx(
4661
+ De,
4662
+ {
4663
+ name: "taxCode",
4664
+ control: r,
4665
+ render: ({ field: y }) => {
4666
+ var v;
4667
+ return /* @__PURE__ */ p.jsx(
4668
+ Me,
4669
+ {
4670
+ ...y,
4671
+ label: "Mã số thuế",
4672
+ required: !0,
4673
+ error: (v = n.taxCode) == null ? void 0 : v.message
4674
+ }
4675
+ );
4676
+ }
4677
+ }
4678
+ ),
4679
+ /* @__PURE__ */ p.jsx(
4680
+ De,
4681
+ {
4682
+ name: "representative",
4683
+ control: r,
4684
+ render: ({ field: y }) => {
4685
+ var v;
4686
+ return /* @__PURE__ */ p.jsx(
4687
+ Me,
4688
+ {
4689
+ ...y,
4690
+ label: "Người đại diện",
4691
+ required: !0,
4692
+ error: (v = n.representative) == null ? void 0 : v.message
4693
+ }
4694
+ );
4695
+ }
4696
+ }
4697
+ ),
4698
+ /* @__PURE__ */ p.jsx(
4699
+ De,
4700
+ {
4701
+ name: "email",
4702
+ control: r,
4703
+ render: ({ field: y }) => {
4704
+ var v;
4705
+ return /* @__PURE__ */ p.jsx(
4706
+ Me,
4707
+ {
4708
+ ...y,
4709
+ label: "Email",
4710
+ type: "email",
4711
+ required: !0,
4712
+ error: (v = n.email) == null ? void 0 : v.message
4713
+ }
4714
+ );
4715
+ }
4716
+ }
4717
+ ),
4718
+ /* @__PURE__ */ p.jsx(
4719
+ De,
4720
+ {
4721
+ name: "address",
4722
+ control: r,
4723
+ render: ({ field: y }) => {
4724
+ var v;
4725
+ return /* @__PURE__ */ p.jsx(
4726
+ Me,
4727
+ {
4728
+ ...y,
4729
+ label: "Địa chỉ",
4730
+ required: !0,
4731
+ error: (v = n.address) == null ? void 0 : v.message
4732
+ }
4733
+ );
4734
+ }
4735
+ }
4736
+ ),
4737
+ /* @__PURE__ */ p.jsx(
4738
+ De,
4739
+ {
4740
+ name: "license",
4741
+ control: r,
4742
+ render: ({ field: y }) => {
4743
+ var v;
4744
+ return /* @__PURE__ */ p.jsx(
4745
+ fa,
4746
+ {
4747
+ label: "Giấy phép đăng ký kinh doanh",
4748
+ required: !0,
4749
+ file: y.value ?? null,
4750
+ onFileChange: y.onChange,
4751
+ error: (v = n.license) == null ? void 0 : v.message
4752
+ }
4753
+ );
4754
+ }
4755
+ }
4756
+ )
4757
+ ] }),
4758
+ /* @__PURE__ */ p.jsxs("div", { className: "space-y-4", children: [
4759
+ /* @__PURE__ */ p.jsx(
4760
+ De,
4761
+ {
4762
+ name: "companyName",
4763
+ control: r,
4764
+ render: ({ field: y }) => {
4765
+ var v;
4766
+ return /* @__PURE__ */ p.jsx(
4767
+ Me,
4768
+ {
4769
+ ...y,
4770
+ label: "Tên công ty",
4771
+ required: !0,
4772
+ error: (v = n.companyName) == null ? void 0 : v.message
4773
+ }
4774
+ );
4775
+ }
4776
+ }
4777
+ ),
4778
+ /* @__PURE__ */ p.jsx(
4779
+ De,
4780
+ {
4781
+ name: "position",
4782
+ control: r,
4783
+ render: ({ field: y }) => {
4784
+ var v;
4785
+ return /* @__PURE__ */ p.jsx(
4786
+ Me,
4787
+ {
4788
+ ...y,
4789
+ label: "Chức vụ",
4790
+ error: (v = n.position) == null ? void 0 : v.message
4791
+ }
4792
+ );
4793
+ }
4794
+ }
4795
+ ),
4796
+ /* @__PURE__ */ p.jsx(
4797
+ De,
4798
+ {
4799
+ name: "phone",
4800
+ control: r,
4801
+ render: ({ field: y }) => {
4802
+ var v;
4803
+ return /* @__PURE__ */ p.jsx(
4804
+ Me,
4805
+ {
4806
+ ...y,
4807
+ label: "SĐT",
4808
+ type: "tel",
4809
+ error: (v = n.phone) == null ? void 0 : v.message
4810
+ }
4811
+ );
4812
+ }
4813
+ }
4814
+ )
4815
+ ] })
4816
+ ] }),
4817
+ /* @__PURE__ */ p.jsxs("div", { className: "flex items-center justify-end gap-2", children: [
4818
+ /* @__PURE__ */ p.jsx(
4819
+ Bt,
4820
+ {
4821
+ title: "Back",
4822
+ handleClick: () => {
4823
+ f(), t("/select-provider");
4824
+ },
4825
+ className: " !bg-gray-200 !text-gray-700 hover:!bg-gray-300 disabled:!bg-gray-200 disabled:!text-gray-500"
4826
+ }
4827
+ ),
4828
+ /* @__PURE__ */ p.jsx(
4829
+ Bt,
4830
+ {
4831
+ type: "submit",
4832
+ title: a ? "Submitting..." : "Submit",
4833
+ isDisabled: a || Object.keys(n).length > 0 || !i,
4834
+ handleClick: () => {
4835
+ d(), t("/select-plan");
4836
+ }
4837
+ }
4838
+ )
4839
+ ] })
4840
+ ]
4841
+ }
4842
+ );
4843
+ }, pa = ({
4844
+ options: t,
4845
+ value: e,
4846
+ onChange: r
4847
+ }) => /* @__PURE__ */ p.jsx(
4848
+ "fieldset",
4849
+ {
4850
+ role: "radiogroup",
4851
+ "aria-label": "Chọn gói đăng ký",
4852
+ className: "flex flex-col md:flex-row gap-4 md:gap-20",
4853
+ children: t.map((s) => {
4854
+ const n = s.value === e;
4855
+ return /* @__PURE__ */ p.jsxs(
4856
+ "label",
4857
+ {
4858
+ className: [
4859
+ "flex items-center cursor-pointer rounded-lg border p-4 transition",
4860
+ n ? "border-green-500 bg-green-50" : "border-gray-300 bg-white hover:bg-gray-50"
4861
+ ].join(" "),
4862
+ children: [
4863
+ /* @__PURE__ */ p.jsx(
4864
+ "input",
4865
+ {
4866
+ type: "radio",
4867
+ name: "subscription",
4868
+ value: s.value,
4869
+ checked: n,
4870
+ onChange: () => r(s.value),
4871
+ className: "sr-only"
4872
+ }
4873
+ ),
4874
+ /* @__PURE__ */ p.jsx(
4875
+ "span",
4876
+ {
4877
+ className: [
4878
+ "flex-shrink-0 flex items-center justify-center rounded-full mr-3",
4879
+ n ? "w-5 h-5 border-2 border-green-500 bg-green-500" : "w-4 h-4 border border-gray-400"
4880
+ ].join(" "),
4881
+ children: n && /* @__PURE__ */ p.jsx("span", { className: "block w-2 h-2 bg-white rounded-full" })
4882
+ }
4883
+ ),
4884
+ /* @__PURE__ */ p.jsx(
4885
+ "span",
4886
+ {
4887
+ className: n ? "text-green-700 font-medium" : "text-gray-700",
4888
+ children: s.label
4889
+ }
4890
+ )
4891
+ ]
4892
+ },
4893
+ s.value
4894
+ );
4895
+ })
4896
+ }
4897
+ ), ya = () => {
4898
+ const t = nr(), e = mt((a) => a.nextStep), [r, s] = Qt("300"), n = [
4899
+ { value: "100", label: "100 đơn/tháng" },
4900
+ { value: "300", label: "300 đơn/tháng" },
4901
+ { value: "500", label: "500 đơn/tháng" }
4902
+ ];
4903
+ return /* @__PURE__ */ p.jsxs("div", { className: "w-full flex flex-col gap-6", children: [
4904
+ /* @__PURE__ */ p.jsx("h2", { className: "heading", children: "Select subscription package" }),
4905
+ /* @__PURE__ */ p.jsx(
4906
+ pa,
4907
+ {
4908
+ options: n,
4909
+ value: r,
4910
+ onChange: s
4911
+ }
4912
+ ),
4913
+ /* @__PURE__ */ p.jsx("div", { className: "text-right", children: /* @__PURE__ */ p.jsx(
4914
+ Bt,
4915
+ {
4916
+ title: "Next",
4917
+ isDisabled: !r,
4918
+ handleClick: () => {
4919
+ e(), t("/status");
4920
+ }
4921
+ }
4922
+ ) })
4923
+ ] });
4924
+ }, ga = ({ checked: t, setChecked: e }) => /* @__PURE__ */ p.jsxs("label", { className: "relative inline-flex cursor-pointer items-center", children: [
4925
+ /* @__PURE__ */ p.jsx(
4926
+ "input",
4927
+ {
4928
+ type: "checkbox",
4929
+ className: "peer sr-only",
4930
+ checked: t,
4931
+ onChange: (r) => e(r.target.checked)
4932
+ }
4933
+ ),
4934
+ /* @__PURE__ */ p.jsx("div", { className: "border-[#ACADAE] relative h-5 w-5 rounded-full border-2 before:absolute before:left-1/2 before:top-1/2 before:hidden before:h-2.5 before:w-2.5 before:-translate-x-1/2 before:-translate-y-1/2 before:rounded-full before:bg-green-500 peer-checked:border-green-500 peer-checked:before:block" })
4935
+ ] }), va = [
4936
+ { name: "M-Invoice", route: "m-invoice" },
4937
+ { name: "FPT", route: "fpt" },
4938
+ { name: "Misa", route: "misa" }
4939
+ ], _a = ({ provider: t, handleProviderChange: e }) => {
4940
+ const r = Et((s) => s.selectedProvider);
4941
+ return /* @__PURE__ */ p.jsxs(
4942
+ "div",
4943
+ {
4944
+ "data-checked": r === t.route,
4945
+ className: `flex items-center justify-center gap-2 px-4 py-2 border border-gray-300 rounded-md hover:bg-gray-100 cursor-pointer\r
4946
+ transition-colors duration-200 data-[checked=true]:border-green-500 data-[checked=true]:text-green-700\r
4947
+ `,
4948
+ onClick: () => e(t.route),
4949
+ children: [
4950
+ /* @__PURE__ */ p.jsx(
4951
+ ga,
4952
+ {
4953
+ checked: r === t.route,
4954
+ setChecked: () => e(t.route)
4955
+ }
4956
+ ),
4957
+ /* @__PURE__ */ p.jsx("label", { className: "", children: t.name })
4958
+ ]
4959
+ }
4960
+ );
4961
+ }, ba = () => {
4962
+ const t = nr(), e = Et((a) => a.selectedProvider), r = Et((a) => a.setSelectedProvider), s = mt((a) => a.nextStep), n = (a) => {
4963
+ r(a);
4964
+ };
4965
+ return /* @__PURE__ */ p.jsxs("div", { className: "w-full flex flex-col gap-6", children: [
4966
+ /* @__PURE__ */ p.jsx("h2", { className: "heading", children: "Select Provider" }),
4967
+ /* @__PURE__ */ p.jsx("div", { className: "flex gap-20", children: va.map((a) => /* @__PURE__ */ p.jsx(_a, { provider: a, handleProviderChange: n }, a.route)) }),
4968
+ /* @__PURE__ */ p.jsx("div", { className: "text-right", children: /* @__PURE__ */ p.jsx(
4969
+ Bt,
4970
+ {
4971
+ title: "Next",
4972
+ isDisabled: !e,
4973
+ handleClick: () => {
4974
+ s(), t("/register");
4975
+ }
4976
+ }
4977
+ ) })
4978
+ ] });
4979
+ }, xa = () => /* @__PURE__ */ p.jsx("div", { children: "Status" });
4980
+ function Sa() {
4981
+ return /* @__PURE__ */ p.jsx(xs, { children: /* @__PURE__ */ p.jsx(ks, { children: /* @__PURE__ */ p.jsxs(We, { element: /* @__PURE__ */ p.jsx(Os, {}), children: [
4982
+ /* @__PURE__ */ p.jsx(We, { index: !0, element: /* @__PURE__ */ p.jsx(ws, { to: "/select-provider", replace: !0 }) }),
4983
+ /* @__PURE__ */ p.jsx(We, { path: "select-provider", element: /* @__PURE__ */ p.jsx(ba, {}) }),
4984
+ /* @__PURE__ */ p.jsx(We, { path: "register", element: /* @__PURE__ */ p.jsx(ma, {}) }),
4985
+ /* @__PURE__ */ p.jsx(We, { path: "select-plan", element: /* @__PURE__ */ p.jsx(ya, {}) }),
4986
+ /* @__PURE__ */ p.jsx(We, { path: "status", element: /* @__PURE__ */ p.jsx(xa, {}) }),
4987
+ /* @__PURE__ */ p.jsx(
4988
+ We,
4989
+ {
4990
+ path: "*",
4991
+ element: /* @__PURE__ */ p.jsx("div", { className: "text-center text-red-500", children: "404: Page Not Found" })
4992
+ }
4993
+ )
4994
+ ] }) }) });
4995
+ }
4996
+ export {
4997
+ Sa as default
4998
+ };