@scbt-ecom/ui 0.16.2 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/CustomLink-DmCJLTWC.js +4090 -0
  2. package/dist/CustomLink-DmCJLTWC.js.map +1 -0
  3. package/dist/api.d.ts +2 -0
  4. package/dist/api.js +26 -0
  5. package/dist/api.js.map +1 -0
  6. package/dist/cn-DIfn7EPB.js +2276 -0
  7. package/dist/cn-DIfn7EPB.js.map +1 -0
  8. package/dist/exports/api.d.ts +1 -0
  9. package/dist/exports/constants.d.ts +1 -0
  10. package/dist/exports/hooks.d.ts +1 -0
  11. package/dist/exports/types.d.ts +1 -0
  12. package/dist/exports/ui.d.ts +1 -0
  13. package/dist/exports/utils.d.ts +1 -0
  14. package/dist/exports/validation.d.ts +1 -0
  15. package/dist/exports/widgets.d.ts +1 -0
  16. package/dist/hooks.d.ts +2 -0
  17. package/dist/hooks.js +115 -0
  18. package/dist/hooks.js.map +1 -0
  19. package/dist/isClient-C9aZtt2Q.js +5 -0
  20. package/dist/isClient-C9aZtt2Q.js.map +1 -0
  21. package/dist/parse-Bv7rNn_R.js +5103 -0
  22. package/dist/parse-Bv7rNn_R.js.map +1 -0
  23. package/dist/scrollToElement-B-reg4jF.js +12 -0
  24. package/dist/scrollToElement-B-reg4jF.js.map +1 -0
  25. package/dist/shared/hooks/useDevice/index.d.ts +1 -0
  26. package/dist/shared/ui/button/Button.d.ts +1 -1
  27. package/dist/shared/ui/formElements/controlled/index.d.ts +1 -1
  28. package/dist/shared/ui/notification/ui/CustomToast.d.ts +1 -1
  29. package/dist/shared/ui/select/Select.d.ts +1 -1
  30. package/dist/style.css +1 -1
  31. package/dist/types.d.ts +2 -0
  32. package/dist/types.js +2 -0
  33. package/dist/types.js.map +1 -0
  34. package/dist/ui.d.ts +2 -0
  35. package/dist/{client.js → ui.js} +10487 -11777
  36. package/dist/ui.js.map +1 -0
  37. package/dist/useDebounce-m2rLy7nL.js +1110 -0
  38. package/dist/useDebounce-m2rLy7nL.js.map +1 -0
  39. package/dist/useDevice-L83kSsN7.js +28 -0
  40. package/dist/useDevice-L83kSsN7.js.map +1 -0
  41. package/dist/utils.d.ts +2 -0
  42. package/dist/utils.js +19 -0
  43. package/dist/utils.js.map +1 -0
  44. package/dist/validation.d.ts +2 -0
  45. package/dist/validation.js +82 -0
  46. package/dist/validation.js.map +1 -0
  47. package/dist/widgets/banner/ui/banners/BannerImageFull.d.ts +1 -1
  48. package/dist/widgets/banner/ui/banners/BannerWithSeparateImg.d.ts +1 -1
  49. package/dist/widgets.d.ts +2 -0
  50. package/dist/widgets.js +828 -0
  51. package/dist/widgets.js.map +1 -0
  52. package/package.json +24 -7
  53. package/dist/client.js.map +0 -1
  54. package/dist/hybrid.js +0 -1350
  55. package/dist/hybrid.js.map +0 -1
  56. package/dist/index-CexXWplL.js +0 -11391
  57. package/dist/index-CexXWplL.js.map +0 -1
  58. /package/dist/shared/hooks/{useDevice.d.ts → useDevice/useDevice.d.ts} +0 -0
@@ -0,0 +1,1110 @@
1
+ import * as ce from "react";
2
+ import x from "react";
3
+ import { i as xt } from "./isClient-C9aZtt2Q.js";
4
+ const zt = (e, s) => {
5
+ const t = (u) => {
6
+ e.current && !e.current.contains(u.target) && s();
7
+ };
8
+ ce.useEffect(() => {
9
+ var u;
10
+ if (xt)
11
+ return (u = globalThis == null ? void 0 : globalThis.document) == null || u.addEventListener("mousedown", t), () => {
12
+ globalThis == null || globalThis.document.removeEventListener("mousedown", t);
13
+ };
14
+ }, [e, s]);
15
+ };
16
+ var ge = (e) => e.type === "checkbox", te = (e) => e instanceof Date, M = (e) => e == null;
17
+ const rt = (e) => typeof e == "object";
18
+ var S = (e) => !M(e) && !Array.isArray(e) && rt(e) && !te(e), st = (e) => S(e) && e.target ? ge(e.target) ? e.target.checked : e.target.value : e, Dt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, it = (e, s) => e.has(Dt(s)), wt = (e) => {
19
+ const s = e.constructor && e.constructor.prototype;
20
+ return S(s) && s.hasOwnProperty("isPrototypeOf");
21
+ }, Te = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
22
+ function N(e) {
23
+ let s;
24
+ const t = Array.isArray(e), u = typeof FileList < "u" ? e instanceof FileList : !1;
25
+ if (e instanceof Date)
26
+ s = new Date(e);
27
+ else if (e instanceof Set)
28
+ s = new Set(e);
29
+ else if (!(Te && (e instanceof Blob || u)) && (t || S(e)))
30
+ if (s = t ? [] : {}, !t && !wt(e))
31
+ s = e;
32
+ else
33
+ for (const n in e)
34
+ e.hasOwnProperty(n) && (s[n] = N(e[n]));
35
+ else
36
+ return e;
37
+ return s;
38
+ }
39
+ var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], w = (e) => e === void 0, c = (e, s, t) => {
40
+ if (!s || !S(e))
41
+ return t;
42
+ const u = Ae(s.split(/[,[\].]+?/)).reduce((n, a) => M(n) ? n : n[a], e);
43
+ return w(u) || u === e ? w(e[s]) ? t : e[s] : u;
44
+ }, q = (e) => typeof e == "boolean", Le = (e) => /^\w*$/.test(e), ut = (e) => Ae(e.replace(/["|']|\]/g, "").split(/\.|\[/)), D = (e, s, t) => {
45
+ let u = -1;
46
+ const n = Le(s) ? [s] : ut(s), a = n.length, y = a - 1;
47
+ for (; ++u < a; ) {
48
+ const g = n[u];
49
+ let A = t;
50
+ if (u !== y) {
51
+ const k = e[g];
52
+ A = S(k) || Array.isArray(k) ? k : isNaN(+n[u + 1]) ? {} : [];
53
+ }
54
+ if (g === "__proto__" || g === "constructor" || g === "prototype")
55
+ return;
56
+ e[g] = A, e = e[g];
57
+ }
58
+ return e;
59
+ };
60
+ const be = {
61
+ BLUR: "blur",
62
+ FOCUS_OUT: "focusout",
63
+ CHANGE: "change"
64
+ }, $ = {
65
+ onBlur: "onBlur",
66
+ onChange: "onChange",
67
+ onSubmit: "onSubmit",
68
+ onTouched: "onTouched",
69
+ all: "all"
70
+ }, J = {
71
+ max: "max",
72
+ min: "min",
73
+ maxLength: "maxLength",
74
+ minLength: "minLength",
75
+ pattern: "pattern",
76
+ required: "required",
77
+ validate: "validate"
78
+ }, St = x.createContext(null), Oe = () => x.useContext(St);
79
+ var nt = (e, s, t, u = !0) => {
80
+ const n = {
81
+ defaultValues: s._defaultValues
82
+ };
83
+ for (const a in e)
84
+ Object.defineProperty(n, a, {
85
+ get: () => {
86
+ const y = a;
87
+ return s._proxyFormState[y] !== $.all && (s._proxyFormState[y] = !u || $.all), t && (t[y] = !0), e[y];
88
+ }
89
+ });
90
+ return n;
91
+ }, P = (e) => S(e) && !Object.keys(e).length, at = (e, s, t, u) => {
92
+ t(e);
93
+ const { name: n, ...a } = e;
94
+ return P(a) || Object.keys(a).length >= Object.keys(s).length || Object.keys(a).find((y) => s[y] === (!u || $.all));
95
+ }, de = (e) => Array.isArray(e) ? e : [e], lt = (e, s, t) => !e || !s || e === s || de(e).some((u) => u && (t ? u === s : u.startsWith(s) || s.startsWith(u)));
96
+ function Re(e) {
97
+ const s = x.useRef(e);
98
+ s.current = e, x.useEffect(() => {
99
+ const t = !e.disabled && s.current.subject && s.current.subject.subscribe({
100
+ next: s.current.next
101
+ });
102
+ return () => {
103
+ t && t.unsubscribe();
104
+ };
105
+ }, [e.disabled]);
106
+ }
107
+ function Et(e) {
108
+ const s = Oe(), { control: t = s.control, disabled: u, name: n, exact: a } = e || {}, [y, g] = x.useState(t._formState), A = x.useRef(!0), k = x.useRef({
109
+ isDirty: !1,
110
+ isLoading: !1,
111
+ dirtyFields: !1,
112
+ touchedFields: !1,
113
+ validatingFields: !1,
114
+ isValidating: !1,
115
+ isValid: !1,
116
+ errors: !1
117
+ }), V = x.useRef(n);
118
+ return V.current = n, Re({
119
+ disabled: u,
120
+ next: (v) => A.current && lt(V.current, v.name, a) && at(v, k.current, t._updateFormState) && g({
121
+ ...t._formState,
122
+ ...v
123
+ }),
124
+ subject: t._subjects.state
125
+ }), x.useEffect(() => (A.current = !0, k.current.isValid && t._updateValid(!0), () => {
126
+ A.current = !1;
127
+ }), [t]), x.useMemo(() => nt(y, t, k.current, !1), [y, t]);
128
+ }
129
+ var G = (e) => typeof e == "string", ot = (e, s, t, u, n) => G(e) ? (u && s.watch.add(e), c(t, e, n)) : Array.isArray(e) ? e.map((a) => (u && s.watch.add(a), c(t, a))) : (u && (s.watchAll = !0), t);
130
+ function kt(e) {
131
+ const s = Oe(), { control: t = s.control, name: u, defaultValue: n, disabled: a, exact: y } = e || {}, g = x.useRef(u);
132
+ g.current = u, Re({
133
+ disabled: a,
134
+ subject: t._subjects.values,
135
+ next: (V) => {
136
+ lt(g.current, V.name, y) && k(N(ot(g.current, t._names, V.values || t._formValues, !1, n)));
137
+ }
138
+ });
139
+ const [A, k] = x.useState(t._getWatch(u, n));
140
+ return x.useEffect(() => t._removeUnmounted()), A;
141
+ }
142
+ function Ct(e) {
143
+ const s = Oe(), { name: t, disabled: u, control: n = s.control, shouldUnregister: a } = e, y = it(n._names.array, t), g = kt({
144
+ control: n,
145
+ name: t,
146
+ defaultValue: c(n._formValues, t, c(n._defaultValues, t, e.defaultValue)),
147
+ exact: !0
148
+ }), A = Et({
149
+ control: n,
150
+ name: t,
151
+ exact: !0
152
+ }), k = x.useRef(n.register(t, {
153
+ ...e.rules,
154
+ value: g,
155
+ ...q(e.disabled) ? { disabled: e.disabled } : {}
156
+ })), V = x.useMemo(() => Object.defineProperties({}, {
157
+ invalid: {
158
+ enumerable: !0,
159
+ get: () => !!c(A.errors, t)
160
+ },
161
+ isDirty: {
162
+ enumerable: !0,
163
+ get: () => !!c(A.dirtyFields, t)
164
+ },
165
+ isTouched: {
166
+ enumerable: !0,
167
+ get: () => !!c(A.touchedFields, t)
168
+ },
169
+ isValidating: {
170
+ enumerable: !0,
171
+ get: () => !!c(A.validatingFields, t)
172
+ },
173
+ error: {
174
+ enumerable: !0,
175
+ get: () => c(A.errors, t)
176
+ }
177
+ }), [A, t]), v = x.useMemo(() => ({
178
+ name: t,
179
+ value: g,
180
+ ...q(u) || A.disabled ? { disabled: A.disabled || u } : {},
181
+ onChange: (R) => k.current.onChange({
182
+ target: {
183
+ value: st(R),
184
+ name: t
185
+ },
186
+ type: be.CHANGE
187
+ }),
188
+ onBlur: () => k.current.onBlur({
189
+ target: {
190
+ value: c(n._formValues, t),
191
+ name: t
192
+ },
193
+ type: be.BLUR
194
+ }),
195
+ ref: (R) => {
196
+ const B = c(n._fields, t);
197
+ B && R && (B._f.ref = {
198
+ focus: () => R.focus(),
199
+ select: () => R.select(),
200
+ setCustomValidity: (E) => R.setCustomValidity(E),
201
+ reportValidity: () => R.reportValidity()
202
+ });
203
+ }
204
+ }), [
205
+ t,
206
+ n._formValues,
207
+ u,
208
+ A.disabled,
209
+ g,
210
+ n._fields
211
+ ]);
212
+ return x.useEffect(() => {
213
+ const R = n._options.shouldUnregister || a, B = (E, ue) => {
214
+ const I = c(n._fields, E);
215
+ I && I._f && (I._f.mount = ue);
216
+ };
217
+ if (B(t, !0), R) {
218
+ const E = N(c(n._options.defaultValues, t));
219
+ D(n._defaultValues, t, E), w(c(n._formValues, t)) && D(n._formValues, t, E);
220
+ }
221
+ return () => {
222
+ (y ? R && !n._state.action : R) ? n.unregister(t) : B(t, !1);
223
+ };
224
+ }, [t, n, y, a]), x.useEffect(() => {
225
+ q(u) && c(n._fields, t) && n._updateDisabledField({
226
+ disabled: u,
227
+ fields: n._fields,
228
+ name: t,
229
+ value: c(n._fields, t)._f.value
230
+ });
231
+ }, [u, t, n]), x.useMemo(() => ({
232
+ field: v,
233
+ formState: A,
234
+ fieldState: V
235
+ }), [v, A, V]);
236
+ }
237
+ const Jt = (e) => e.render(Ct(e));
238
+ var pt = (e, s, t, u, n) => s ? {
239
+ ...t[e],
240
+ types: {
241
+ ...t[e] && t[e].types ? t[e].types : {},
242
+ [u]: n || !0
243
+ }
244
+ } : {}, Ge = (e) => ({
245
+ isOnSubmit: !e || e === $.onSubmit,
246
+ isOnBlur: e === $.onBlur,
247
+ isOnChange: e === $.onChange,
248
+ isOnAll: e === $.all,
249
+ isOnTouch: e === $.onTouched
250
+ }), Ye = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((u) => e.startsWith(u) && /^\.\w+/.test(e.slice(u.length))));
251
+ const ye = (e, s, t, u) => {
252
+ for (const n of t || Object.keys(e)) {
253
+ const a = c(e, n);
254
+ if (a) {
255
+ const { _f: y, ...g } = a;
256
+ if (y) {
257
+ if (y.refs && y.refs[0] && s(y.refs[0], n) && !u)
258
+ return !0;
259
+ if (y.ref && s(y.ref, y.name) && !u)
260
+ return !0;
261
+ if (ye(g, s))
262
+ break;
263
+ } else if (S(g) && ye(g, s))
264
+ break;
265
+ }
266
+ }
267
+ };
268
+ var Tt = (e, s, t) => {
269
+ const u = de(c(e, t));
270
+ return D(u, "root", s[t]), D(e, t, u), e;
271
+ }, Ue = (e) => e.type === "file", K = (e) => typeof e == "function", Ve = (e) => {
272
+ if (!Te)
273
+ return !1;
274
+ const s = e ? e.ownerDocument : 0;
275
+ return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
276
+ }, _e = (e) => G(e), Me = (e) => e.type === "radio", Fe = (e) => e instanceof RegExp;
277
+ const ze = {
278
+ value: !1,
279
+ isValid: !1
280
+ }, Je = { value: !0, isValid: !0 };
281
+ var ft = (e) => {
282
+ if (Array.isArray(e)) {
283
+ if (e.length > 1) {
284
+ const s = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
285
+ return { value: s, isValid: !!s.length };
286
+ }
287
+ return e[0].checked && !e[0].disabled ? (
288
+ // @ts-expect-error expected to work in the browser
289
+ e[0].attributes && !w(e[0].attributes.value) ? w(e[0].value) || e[0].value === "" ? Je : { value: e[0].value, isValid: !0 } : Je
290
+ ) : ze;
291
+ }
292
+ return ze;
293
+ };
294
+ const Qe = {
295
+ isValid: !1,
296
+ value: null
297
+ };
298
+ var ct = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disabled ? {
299
+ isValid: !0,
300
+ value: t.value
301
+ } : s, Qe) : Qe;
302
+ function Xe(e, s, t = "validate") {
303
+ if (_e(e) || Array.isArray(e) && e.every(_e) || q(e) && !e)
304
+ return {
305
+ type: t,
306
+ message: _e(e) ? e : "",
307
+ ref: s
308
+ };
309
+ }
310
+ var ie = (e) => S(e) && !Fe(e) ? e : {
311
+ value: e,
312
+ message: ""
313
+ }, Ze = async (e, s, t, u, n) => {
314
+ const { ref: a, refs: y, required: g, maxLength: A, minLength: k, min: V, max: v, pattern: R, validate: B, name: E, valueAsNumber: ue, mount: I, disabled: Q } = e._f, F = c(s, E);
315
+ if (!I || Q)
316
+ return {};
317
+ const Y = y ? y[0] : a, z = (b) => {
318
+ u && Y.reportValidity && (Y.setCustomValidity(q(b) ? "" : b || ""), Y.reportValidity());
319
+ }, C = {}, re = Me(a), he = ge(a), Z = re || he, se = (ue || Ue(a)) && w(a.value) && w(F) || Ve(a) && a.value === "" || F === "" || Array.isArray(F) && !F.length, W = pt.bind(null, E, t, C), ve = (b, m, p, U = J.maxLength, H = J.minLength) => {
320
+ const j = b ? m : p;
321
+ C[E] = {
322
+ type: b ? U : H,
323
+ message: j,
324
+ ref: a,
325
+ ...W(b ? U : H, j)
326
+ };
327
+ };
328
+ if (n ? !Array.isArray(F) || !F.length : g && (!Z && (se || M(F)) || q(F) && !F || he && !ft(y).isValid || re && !ct(y).isValid)) {
329
+ const { value: b, message: m } = _e(g) ? { value: !!g, message: g } : ie(g);
330
+ if (b && (C[E] = {
331
+ type: J.required,
332
+ message: m,
333
+ ref: Y,
334
+ ...W(J.required, m)
335
+ }, !t))
336
+ return z(m), C;
337
+ }
338
+ if (!se && (!M(V) || !M(v))) {
339
+ let b, m;
340
+ const p = ie(v), U = ie(V);
341
+ if (!M(F) && !isNaN(F)) {
342
+ const H = a.valueAsNumber || F && +F;
343
+ M(p.value) || (b = H > p.value), M(U.value) || (m = H < U.value);
344
+ } else {
345
+ const H = a.valueAsDate || new Date(F), j = (le) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + le), ne = a.type == "time", ae = a.type == "week";
346
+ G(p.value) && F && (b = ne ? j(F) > j(p.value) : ae ? F > p.value : H > new Date(p.value)), G(U.value) && F && (m = ne ? j(F) < j(U.value) : ae ? F < U.value : H < new Date(U.value));
347
+ }
348
+ if ((b || m) && (ve(!!b, p.message, U.message, J.max, J.min), !t))
349
+ return z(C[E].message), C;
350
+ }
351
+ if ((A || k) && !se && (G(F) || n && Array.isArray(F))) {
352
+ const b = ie(A), m = ie(k), p = !M(b.value) && F.length > +b.value, U = !M(m.value) && F.length < +m.value;
353
+ if ((p || U) && (ve(p, b.message, m.message), !t))
354
+ return z(C[E].message), C;
355
+ }
356
+ if (R && !se && G(F)) {
357
+ const { value: b, message: m } = ie(R);
358
+ if (Fe(b) && !F.match(b) && (C[E] = {
359
+ type: J.pattern,
360
+ message: m,
361
+ ref: a,
362
+ ...W(J.pattern, m)
363
+ }, !t))
364
+ return z(m), C;
365
+ }
366
+ if (B) {
367
+ if (K(B)) {
368
+ const b = await B(F, s), m = Xe(b, Y);
369
+ if (m && (C[E] = {
370
+ ...m,
371
+ ...W(J.validate, m.message)
372
+ }, !t))
373
+ return z(m.message), C;
374
+ } else if (S(B)) {
375
+ let b = {};
376
+ for (const m in B) {
377
+ if (!P(b) && !t)
378
+ break;
379
+ const p = Xe(await B[m](F, s), Y, m);
380
+ p && (b = {
381
+ ...p,
382
+ ...W(m, p.message)
383
+ }, z(p.message), t && (C[E] = b));
384
+ }
385
+ if (!P(b) && (C[E] = {
386
+ ref: Y,
387
+ ...b
388
+ }, !t))
389
+ return C;
390
+ }
391
+ }
392
+ return z(!0), C;
393
+ };
394
+ function Lt(e, s) {
395
+ const t = s.slice(0, -1).length;
396
+ let u = 0;
397
+ for (; u < t; )
398
+ e = w(e) ? u++ : e[s[u++]];
399
+ return e;
400
+ }
401
+ function Ot(e) {
402
+ for (const s in e)
403
+ if (e.hasOwnProperty(s) && !w(e[s]))
404
+ return !1;
405
+ return !0;
406
+ }
407
+ function T(e, s) {
408
+ const t = Array.isArray(s) ? s : Le(s) ? [s] : ut(s), u = t.length === 1 ? e : Lt(e, t), n = t.length - 1, a = t[n];
409
+ return u && delete u[a], n !== 0 && (S(u) && P(u) || Array.isArray(u) && Ot(u)) && T(e, t.slice(0, -1)), e;
410
+ }
411
+ var Ee = () => {
412
+ let e = [];
413
+ return {
414
+ get observers() {
415
+ return e;
416
+ },
417
+ next: (n) => {
418
+ for (const a of e)
419
+ a.next && a.next(n);
420
+ },
421
+ subscribe: (n) => (e.push(n), {
422
+ unsubscribe: () => {
423
+ e = e.filter((a) => a !== n);
424
+ }
425
+ }),
426
+ unsubscribe: () => {
427
+ e = [];
428
+ }
429
+ };
430
+ }, pe = (e) => M(e) || !rt(e);
431
+ function X(e, s) {
432
+ if (pe(e) || pe(s))
433
+ return e === s;
434
+ if (te(e) && te(s))
435
+ return e.getTime() === s.getTime();
436
+ const t = Object.keys(e), u = Object.keys(s);
437
+ if (t.length !== u.length)
438
+ return !1;
439
+ for (const n of t) {
440
+ const a = e[n];
441
+ if (!u.includes(n))
442
+ return !1;
443
+ if (n !== "ref") {
444
+ const y = s[n];
445
+ if (te(a) && te(y) || S(a) && S(y) || Array.isArray(a) && Array.isArray(y) ? !X(a, y) : a !== y)
446
+ return !1;
447
+ }
448
+ }
449
+ return !0;
450
+ }
451
+ var dt = (e) => e.type === "select-multiple", Rt = (e) => Me(e) || ge(e), ke = (e) => Ve(e) && e.isConnected, yt = (e) => {
452
+ for (const s in e)
453
+ if (K(e[s]))
454
+ return !0;
455
+ return !1;
456
+ };
457
+ function me(e, s = {}) {
458
+ const t = Array.isArray(e);
459
+ if (S(e) || t)
460
+ for (const u in e)
461
+ Array.isArray(e[u]) || S(e[u]) && !yt(e[u]) ? (s[u] = Array.isArray(e[u]) ? [] : {}, me(e[u], s[u])) : M(e[u]) || (s[u] = !0);
462
+ return s;
463
+ }
464
+ function gt(e, s, t) {
465
+ const u = Array.isArray(e);
466
+ if (S(e) || u)
467
+ for (const n in e)
468
+ Array.isArray(e[n]) || S(e[n]) && !yt(e[n]) ? w(s) || pe(t[n]) ? t[n] = Array.isArray(e[n]) ? me(e[n], []) : { ...me(e[n]) } : gt(e[n], M(s) ? {} : s[n], t[n]) : t[n] = !X(e[n], s[n]);
469
+ return t;
470
+ }
471
+ var oe = (e, s) => gt(e, s, me(s)), ht = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: u }) => w(e) ? e : s ? e === "" ? NaN : e && +e : t && G(e) ? new Date(e) : u ? u(e) : e;
472
+ function Ce(e) {
473
+ const s = e.ref;
474
+ if (!(e.refs ? e.refs.every((t) => t.disabled) : s.disabled))
475
+ return Ue(s) ? s.files : Me(s) ? ct(e.refs).value : dt(s) ? [...s.selectedOptions].map(({ value: t }) => t) : ge(s) ? ft(e.refs).value : ht(w(s.value) ? e.ref.value : s.value, e);
476
+ }
477
+ var Ut = (e, s, t, u) => {
478
+ const n = {};
479
+ for (const a of e) {
480
+ const y = c(s, a);
481
+ y && D(n, a, y._f);
482
+ }
483
+ return {
484
+ criteriaMode: t,
485
+ names: [...e],
486
+ fields: n,
487
+ shouldUseNativeValidation: u
488
+ };
489
+ }, fe = (e) => w(e) ? e : Fe(e) ? e.source : S(e) ? Fe(e.value) ? e.value.source : e.value : e;
490
+ const et = "AsyncFunction";
491
+ var Mt = (e) => !!e && !!e.validate && !!(K(e.validate) && e.validate.constructor.name === et || S(e.validate) && Object.values(e.validate).find((s) => s.constructor.name === et)), Bt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
492
+ function tt(e, s, t) {
493
+ const u = c(e, t);
494
+ if (u || Le(t))
495
+ return {
496
+ error: u,
497
+ name: t
498
+ };
499
+ const n = t.split(".");
500
+ for (; n.length; ) {
501
+ const a = n.join("."), y = c(s, a), g = c(e, a);
502
+ if (y && !Array.isArray(y) && t !== a)
503
+ return { name: t };
504
+ if (g && g.type)
505
+ return {
506
+ name: a,
507
+ error: g
508
+ };
509
+ n.pop();
510
+ }
511
+ return {
512
+ name: t
513
+ };
514
+ }
515
+ var Nt = (e, s, t, u, n) => n.isOnAll ? !1 : !t && n.isOnTouch ? !(s || e) : (t ? u.isOnBlur : n.isOnBlur) ? !e : (t ? u.isOnChange : n.isOnChange) ? e : !0, Pt = (e, s) => !Ae(c(e, s)).length && T(e, s);
516
+ const It = {
517
+ mode: $.onSubmit,
518
+ reValidateMode: $.onChange,
519
+ shouldFocusError: !0
520
+ };
521
+ function qt(e = {}) {
522
+ let s = {
523
+ ...It,
524
+ ...e
525
+ }, t = {
526
+ submitCount: 0,
527
+ isDirty: !1,
528
+ isLoading: K(s.defaultValues),
529
+ isValidating: !1,
530
+ isSubmitted: !1,
531
+ isSubmitting: !1,
532
+ isSubmitSuccessful: !1,
533
+ isValid: !1,
534
+ touchedFields: {},
535
+ dirtyFields: {},
536
+ validatingFields: {},
537
+ errors: s.errors || {},
538
+ disabled: s.disabled || !1
539
+ }, u = {}, n = S(s.defaultValues) || S(s.values) ? N(s.defaultValues || s.values) || {} : {}, a = s.shouldUnregister ? {} : N(n), y = {
540
+ action: !1,
541
+ mount: !1,
542
+ watch: !1
543
+ }, g = {
544
+ mount: /* @__PURE__ */ new Set(),
545
+ unMount: /* @__PURE__ */ new Set(),
546
+ array: /* @__PURE__ */ new Set(),
547
+ watch: /* @__PURE__ */ new Set()
548
+ }, A, k = 0;
549
+ const V = {
550
+ isDirty: !1,
551
+ dirtyFields: !1,
552
+ validatingFields: !1,
553
+ touchedFields: !1,
554
+ isValidating: !1,
555
+ isValid: !1,
556
+ errors: !1
557
+ }, v = {
558
+ values: Ee(),
559
+ array: Ee(),
560
+ state: Ee()
561
+ }, R = Ge(s.mode), B = Ge(s.reValidateMode), E = s.criteriaMode === $.all, ue = (r) => (i) => {
562
+ clearTimeout(k), k = setTimeout(r, i);
563
+ }, I = async (r) => {
564
+ if (!s.disabled && (V.isValid || r)) {
565
+ const i = s.resolver ? P((await Z()).errors) : await W(u, !0);
566
+ i !== t.isValid && v.state.next({
567
+ isValid: i
568
+ });
569
+ }
570
+ }, Q = (r, i) => {
571
+ !s.disabled && (V.isValidating || V.validatingFields) && ((r || Array.from(g.mount)).forEach((l) => {
572
+ l && (i ? D(t.validatingFields, l, i) : T(t.validatingFields, l));
573
+ }), v.state.next({
574
+ validatingFields: t.validatingFields,
575
+ isValidating: !P(t.validatingFields)
576
+ }));
577
+ }, F = (r, i = [], l, d, f = !0, o = !0) => {
578
+ if (d && l && !s.disabled) {
579
+ if (y.action = !0, o && Array.isArray(c(u, r))) {
580
+ const h = l(c(u, r), d.argA, d.argB);
581
+ f && D(u, r, h);
582
+ }
583
+ if (o && Array.isArray(c(t.errors, r))) {
584
+ const h = l(c(t.errors, r), d.argA, d.argB);
585
+ f && D(t.errors, r, h), Pt(t.errors, r);
586
+ }
587
+ if (V.touchedFields && o && Array.isArray(c(t.touchedFields, r))) {
588
+ const h = l(c(t.touchedFields, r), d.argA, d.argB);
589
+ f && D(t.touchedFields, r, h);
590
+ }
591
+ V.dirtyFields && (t.dirtyFields = oe(n, a)), v.state.next({
592
+ name: r,
593
+ isDirty: b(r, i),
594
+ dirtyFields: t.dirtyFields,
595
+ errors: t.errors,
596
+ isValid: t.isValid
597
+ });
598
+ } else
599
+ D(a, r, i);
600
+ }, Y = (r, i) => {
601
+ D(t.errors, r, i), v.state.next({
602
+ errors: t.errors
603
+ });
604
+ }, z = (r) => {
605
+ t.errors = r, v.state.next({
606
+ errors: t.errors,
607
+ isValid: !1
608
+ });
609
+ }, C = (r, i, l, d) => {
610
+ const f = c(u, r);
611
+ if (f) {
612
+ const o = c(a, r, w(l) ? c(n, r) : l);
613
+ w(o) || d && d.defaultChecked || i ? D(a, r, i ? o : Ce(f._f)) : U(r, o), y.mount && I();
614
+ }
615
+ }, re = (r, i, l, d, f) => {
616
+ let o = !1, h = !1;
617
+ const _ = {
618
+ name: r
619
+ };
620
+ if (!s.disabled) {
621
+ const L = !!(c(u, r) && c(u, r)._f && c(u, r)._f.disabled);
622
+ if (!l || d) {
623
+ V.isDirty && (h = t.isDirty, t.isDirty = _.isDirty = b(), o = h !== _.isDirty);
624
+ const O = L || X(c(n, r), i);
625
+ h = !!(!L && c(t.dirtyFields, r)), O || L ? T(t.dirtyFields, r) : D(t.dirtyFields, r, !0), _.dirtyFields = t.dirtyFields, o = o || V.dirtyFields && h !== !O;
626
+ }
627
+ if (l) {
628
+ const O = c(t.touchedFields, r);
629
+ O || (D(t.touchedFields, r, l), _.touchedFields = t.touchedFields, o = o || V.touchedFields && O !== l);
630
+ }
631
+ o && f && v.state.next(_);
632
+ }
633
+ return o ? _ : {};
634
+ }, he = (r, i, l, d) => {
635
+ const f = c(t.errors, r), o = V.isValid && q(i) && t.isValid !== i;
636
+ if (s.delayError && l ? (A = ue(() => Y(r, l)), A(s.delayError)) : (clearTimeout(k), A = null, l ? D(t.errors, r, l) : T(t.errors, r)), (l ? !X(f, l) : f) || !P(d) || o) {
637
+ const h = {
638
+ ...d,
639
+ ...o && q(i) ? { isValid: i } : {},
640
+ errors: t.errors,
641
+ name: r
642
+ };
643
+ t = {
644
+ ...t,
645
+ ...h
646
+ }, v.state.next(h);
647
+ }
648
+ }, Z = async (r) => {
649
+ Q(r, !0);
650
+ const i = await s.resolver(a, s.context, Ut(r || g.mount, u, s.criteriaMode, s.shouldUseNativeValidation));
651
+ return Q(r), i;
652
+ }, se = async (r) => {
653
+ const { errors: i } = await Z(r);
654
+ if (r)
655
+ for (const l of r) {
656
+ const d = c(i, l);
657
+ d ? D(t.errors, l, d) : T(t.errors, l);
658
+ }
659
+ else
660
+ t.errors = i;
661
+ return i;
662
+ }, W = async (r, i, l = {
663
+ valid: !0
664
+ }) => {
665
+ for (const d in r) {
666
+ const f = r[d];
667
+ if (f) {
668
+ const { _f: o, ...h } = f;
669
+ if (o) {
670
+ const _ = g.array.has(o.name), L = f._f && Mt(f._f);
671
+ L && V.validatingFields && Q([d], !0);
672
+ const O = await Ze(f, a, E, s.shouldUseNativeValidation && !i, _);
673
+ if (L && V.validatingFields && Q([d]), O[o.name] && (l.valid = !1, i))
674
+ break;
675
+ !i && (c(O, o.name) ? _ ? Tt(t.errors, O, o.name) : D(t.errors, o.name, O[o.name]) : T(t.errors, o.name));
676
+ }
677
+ !P(h) && await W(h, i, l);
678
+ }
679
+ }
680
+ return l.valid;
681
+ }, ve = () => {
682
+ for (const r of g.unMount) {
683
+ const i = c(u, r);
684
+ i && (i._f.refs ? i._f.refs.every((l) => !ke(l)) : !ke(i._f.ref)) && xe(r);
685
+ }
686
+ g.unMount = /* @__PURE__ */ new Set();
687
+ }, b = (r, i) => !s.disabled && (r && i && D(a, r, i), !X(Be(), n)), m = (r, i, l) => ot(r, g, {
688
+ ...y.mount ? a : w(i) ? n : G(r) ? { [r]: i } : i
689
+ }, l, i), p = (r) => Ae(c(y.mount ? a : n, r, s.shouldUnregister ? c(n, r, []) : [])), U = (r, i, l = {}) => {
690
+ const d = c(u, r);
691
+ let f = i;
692
+ if (d) {
693
+ const o = d._f;
694
+ o && (!o.disabled && D(a, r, ht(i, o)), f = Ve(o.ref) && M(i) ? "" : i, dt(o.ref) ? [...o.ref.options].forEach((h) => h.selected = f.includes(h.value)) : o.refs ? ge(o.ref) ? o.refs.length > 1 ? o.refs.forEach((h) => (!h.defaultChecked || !h.disabled) && (h.checked = Array.isArray(f) ? !!f.find((_) => _ === h.value) : f === h.value)) : o.refs[0] && (o.refs[0].checked = !!f) : o.refs.forEach((h) => h.checked = h.value === f) : Ue(o.ref) ? o.ref.value = "" : (o.ref.value = f, o.ref.type || v.values.next({
695
+ name: r,
696
+ values: { ...a }
697
+ })));
698
+ }
699
+ (l.shouldDirty || l.shouldTouch) && re(r, f, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && le(r);
700
+ }, H = (r, i, l) => {
701
+ for (const d in i) {
702
+ const f = i[d], o = `${r}.${d}`, h = c(u, o);
703
+ (g.array.has(r) || S(f) || h && !h._f) && !te(f) ? H(o, f, l) : U(o, f, l);
704
+ }
705
+ }, j = (r, i, l = {}) => {
706
+ const d = c(u, r), f = g.array.has(r), o = N(i);
707
+ D(a, r, o), f ? (v.array.next({
708
+ name: r,
709
+ values: { ...a }
710
+ }), (V.isDirty || V.dirtyFields) && l.shouldDirty && v.state.next({
711
+ name: r,
712
+ dirtyFields: oe(n, a),
713
+ isDirty: b(r, o)
714
+ })) : d && !d._f && !M(o) ? H(r, o, l) : U(r, o, l), Ye(r, g) && v.state.next({ ...t }), v.values.next({
715
+ name: y.mount ? r : void 0,
716
+ values: { ...a }
717
+ });
718
+ }, ne = async (r) => {
719
+ y.mount = !0;
720
+ const i = r.target;
721
+ let l = i.name, d = !0;
722
+ const f = c(u, l), o = () => i.type ? Ce(f._f) : st(r), h = (_) => {
723
+ d = Number.isNaN(_) || te(_) && isNaN(_.getTime()) || X(_, c(a, l, _));
724
+ };
725
+ if (f) {
726
+ let _, L;
727
+ const O = o(), ee = r.type === be.BLUR || r.type === be.FOCUS_OUT, Ft = !Bt(f._f) && !s.resolver && !c(t.errors, l) && !f._f.deps || Nt(ee, c(t.touchedFields, l), t.isSubmitted, B, R), we = Ye(l, g, ee);
728
+ D(a, l, O), ee ? (f._f.onBlur && f._f.onBlur(r), A && A(0)) : f._f.onChange && f._f.onChange(r);
729
+ const Se = re(l, O, ee, !1), mt = !P(Se) || we;
730
+ if (!ee && v.values.next({
731
+ name: l,
732
+ type: r.type,
733
+ values: { ...a }
734
+ }), Ft)
735
+ return V.isValid && (s.mode === "onBlur" ? ee && I() : I()), mt && v.state.next({ name: l, ...we ? {} : Se });
736
+ if (!ee && we && v.state.next({ ...t }), s.resolver) {
737
+ const { errors: $e } = await Z([l]);
738
+ if (h(O), d) {
739
+ const At = tt(t.errors, u, l), Ke = tt($e, u, At.name || l);
740
+ _ = Ke.error, l = Ke.name, L = P($e);
741
+ }
742
+ } else
743
+ Q([l], !0), _ = (await Ze(f, a, E, s.shouldUseNativeValidation))[l], Q([l]), h(O), d && (_ ? L = !1 : V.isValid && (L = await W(u, !0)));
744
+ d && (f._f.deps && le(f._f.deps), he(l, L, _, Se));
745
+ }
746
+ }, ae = (r, i) => {
747
+ if (c(t.errors, i) && r.focus)
748
+ return r.focus(), 1;
749
+ }, le = async (r, i = {}) => {
750
+ let l, d;
751
+ const f = de(r);
752
+ if (s.resolver) {
753
+ const o = await se(w(r) ? r : f);
754
+ l = P(o), d = r ? !f.some((h) => c(o, h)) : l;
755
+ } else r ? (d = (await Promise.all(f.map(async (o) => {
756
+ const h = c(u, o);
757
+ return await W(h && h._f ? { [o]: h } : h);
758
+ }))).every(Boolean), !(!d && !t.isValid) && I()) : d = l = await W(u);
759
+ return v.state.next({
760
+ ...!G(r) || V.isValid && l !== t.isValid ? {} : { name: r },
761
+ ...s.resolver || !r ? { isValid: l } : {},
762
+ errors: t.errors
763
+ }), i.shouldFocus && !d && ye(u, ae, r ? f : g.mount), d;
764
+ }, Be = (r) => {
765
+ const i = {
766
+ ...y.mount ? a : n
767
+ };
768
+ return w(r) ? i : G(r) ? c(i, r) : r.map((l) => c(i, l));
769
+ }, Ne = (r, i) => ({
770
+ invalid: !!c((i || t).errors, r),
771
+ isDirty: !!c((i || t).dirtyFields, r),
772
+ error: c((i || t).errors, r),
773
+ isValidating: !!c(t.validatingFields, r),
774
+ isTouched: !!c((i || t).touchedFields, r)
775
+ }), vt = (r) => {
776
+ r && de(r).forEach((i) => T(t.errors, i)), v.state.next({
777
+ errors: r ? t.errors : {}
778
+ });
779
+ }, Pe = (r, i, l) => {
780
+ const d = (c(u, r, { _f: {} })._f || {}).ref, f = c(t.errors, r) || {}, { ref: o, message: h, type: _, ...L } = f;
781
+ D(t.errors, r, {
782
+ ...L,
783
+ ...i,
784
+ ref: d
785
+ }), v.state.next({
786
+ name: r,
787
+ errors: t.errors,
788
+ isValid: !1
789
+ }), l && l.shouldFocus && d && d.focus && d.focus();
790
+ }, _t = (r, i) => K(r) ? v.values.subscribe({
791
+ next: (l) => r(m(void 0, i), l)
792
+ }) : m(r, i, !0), xe = (r, i = {}) => {
793
+ for (const l of r ? de(r) : g.mount)
794
+ g.mount.delete(l), g.array.delete(l), i.keepValue || (T(u, l), T(a, l)), !i.keepError && T(t.errors, l), !i.keepDirty && T(t.dirtyFields, l), !i.keepTouched && T(t.touchedFields, l), !i.keepIsValidating && T(t.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && T(n, l);
795
+ v.values.next({
796
+ values: { ...a }
797
+ }), v.state.next({
798
+ ...t,
799
+ ...i.keepDirty ? { isDirty: b() } : {}
800
+ }), !i.keepIsValid && I();
801
+ }, Ie = ({ disabled: r, name: i, field: l, fields: d, value: f }) => {
802
+ if (q(r) && y.mount || r) {
803
+ const o = r ? void 0 : w(f) ? Ce(l ? l._f : c(d, i)._f) : f;
804
+ (r || !r && !w(o)) && D(a, i, o), re(i, o, !1, !1, !0);
805
+ }
806
+ }, De = (r, i = {}) => {
807
+ let l = c(u, r);
808
+ const d = q(i.disabled) || q(s.disabled);
809
+ return D(u, r, {
810
+ ...l || {},
811
+ _f: {
812
+ ...l && l._f ? l._f : { ref: { name: r } },
813
+ name: r,
814
+ mount: !0,
815
+ ...i
816
+ }
817
+ }), g.mount.add(r), l ? Ie({
818
+ field: l,
819
+ disabled: q(i.disabled) ? i.disabled : s.disabled,
820
+ name: r,
821
+ value: i.value
822
+ }) : C(r, !0, i.value), {
823
+ ...d ? { disabled: i.disabled || s.disabled } : {},
824
+ ...s.progressive ? {
825
+ required: !!i.required,
826
+ min: fe(i.min),
827
+ max: fe(i.max),
828
+ minLength: fe(i.minLength),
829
+ maxLength: fe(i.maxLength),
830
+ pattern: fe(i.pattern)
831
+ } : {},
832
+ name: r,
833
+ onChange: ne,
834
+ onBlur: ne,
835
+ ref: (f) => {
836
+ if (f) {
837
+ De(r, i), l = c(u, r);
838
+ const o = w(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, h = Rt(o), _ = l._f.refs || [];
839
+ if (h ? _.find((L) => L === o) : o === l._f.ref)
840
+ return;
841
+ D(u, r, {
842
+ _f: {
843
+ ...l._f,
844
+ ...h ? {
845
+ refs: [
846
+ ..._.filter(ke),
847
+ o,
848
+ ...Array.isArray(c(n, r)) ? [{}] : []
849
+ ],
850
+ ref: { type: o.type, name: r }
851
+ } : { ref: o }
852
+ }
853
+ }), C(r, !1, void 0, o);
854
+ } else
855
+ l = c(u, r, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(it(g.array, r) && y.action) && g.unMount.add(r);
856
+ }
857
+ };
858
+ }, qe = () => s.shouldFocusError && ye(u, ae, g.mount), bt = (r) => {
859
+ q(r) && (v.state.next({ disabled: r }), ye(u, (i, l) => {
860
+ const d = c(u, l);
861
+ d && (i.disabled = d._f.disabled || r, Array.isArray(d._f.refs) && d._f.refs.forEach((f) => {
862
+ f.disabled = d._f.disabled || r;
863
+ }));
864
+ }, 0, !1));
865
+ }, We = (r, i) => async (l) => {
866
+ let d;
867
+ if (l && (l.preventDefault && l.preventDefault(), l.persist && l.persist()), s.disabled) {
868
+ i && await i({ ...t.errors }, l);
869
+ return;
870
+ }
871
+ let f = N(a);
872
+ if (v.state.next({
873
+ isSubmitting: !0
874
+ }), s.resolver) {
875
+ const { errors: o, values: h } = await Z();
876
+ t.errors = o, f = h;
877
+ } else
878
+ await W(u);
879
+ if (T(t.errors, "root"), P(t.errors)) {
880
+ v.state.next({
881
+ errors: {}
882
+ });
883
+ try {
884
+ await r(f, l);
885
+ } catch (o) {
886
+ d = o;
887
+ }
888
+ } else
889
+ i && await i({ ...t.errors }, l), qe(), setTimeout(qe);
890
+ if (v.state.next({
891
+ isSubmitted: !0,
892
+ isSubmitting: !1,
893
+ isSubmitSuccessful: P(t.errors) && !d,
894
+ submitCount: t.submitCount + 1,
895
+ errors: t.errors
896
+ }), d)
897
+ throw d;
898
+ }, Vt = (r, i = {}) => {
899
+ c(u, r) && (w(i.defaultValue) ? j(r, N(c(n, r))) : (j(r, i.defaultValue), D(n, r, N(i.defaultValue))), i.keepTouched || T(t.touchedFields, r), i.keepDirty || (T(t.dirtyFields, r), t.isDirty = i.defaultValue ? b(r, N(c(n, r))) : b()), i.keepError || (T(t.errors, r), V.isValid && I()), v.state.next({ ...t }));
900
+ }, je = (r, i = {}) => {
901
+ const l = r ? N(r) : n, d = N(l), f = P(r), o = f ? n : d;
902
+ if (i.keepDefaultValues || (n = l), !i.keepValues) {
903
+ if (i.keepDirtyValues) {
904
+ const h = /* @__PURE__ */ new Set([
905
+ ...g.mount,
906
+ ...Object.keys(oe(n, a))
907
+ ]);
908
+ for (const _ of Array.from(h))
909
+ c(t.dirtyFields, _) ? D(o, _, c(a, _)) : j(_, c(o, _));
910
+ } else {
911
+ if (Te && w(r))
912
+ for (const h of g.mount) {
913
+ const _ = c(u, h);
914
+ if (_ && _._f) {
915
+ const L = Array.isArray(_._f.refs) ? _._f.refs[0] : _._f.ref;
916
+ if (Ve(L)) {
917
+ const O = L.closest("form");
918
+ if (O) {
919
+ O.reset();
920
+ break;
921
+ }
922
+ }
923
+ }
924
+ }
925
+ u = {};
926
+ }
927
+ a = s.shouldUnregister ? i.keepDefaultValues ? N(n) : {} : N(o), v.array.next({
928
+ values: { ...o }
929
+ }), v.values.next({
930
+ values: { ...o }
931
+ });
932
+ }
933
+ g = {
934
+ mount: i.keepDirtyValues ? g.mount : /* @__PURE__ */ new Set(),
935
+ unMount: /* @__PURE__ */ new Set(),
936
+ array: /* @__PURE__ */ new Set(),
937
+ watch: /* @__PURE__ */ new Set(),
938
+ watchAll: !1,
939
+ focus: ""
940
+ }, y.mount = !V.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!s.shouldUnregister, v.state.next({
941
+ submitCount: i.keepSubmitCount ? t.submitCount : 0,
942
+ isDirty: f ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !X(r, n)),
943
+ isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
944
+ dirtyFields: f ? {} : i.keepDirtyValues ? i.keepDefaultValues && a ? oe(n, a) : t.dirtyFields : i.keepDefaultValues && r ? oe(n, r) : i.keepDirty ? t.dirtyFields : {},
945
+ touchedFields: i.keepTouched ? t.touchedFields : {},
946
+ errors: i.keepErrors ? t.errors : {},
947
+ isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
948
+ isSubmitting: !1
949
+ });
950
+ }, He = (r, i) => je(K(r) ? r(a) : r, i);
951
+ return {
952
+ control: {
953
+ register: De,
954
+ unregister: xe,
955
+ getFieldState: Ne,
956
+ handleSubmit: We,
957
+ setError: Pe,
958
+ _executeSchema: Z,
959
+ _getWatch: m,
960
+ _getDirty: b,
961
+ _updateValid: I,
962
+ _removeUnmounted: ve,
963
+ _updateFieldArray: F,
964
+ _updateDisabledField: Ie,
965
+ _getFieldArray: p,
966
+ _reset: je,
967
+ _resetDefaultValues: () => K(s.defaultValues) && s.defaultValues().then((r) => {
968
+ He(r, s.resetOptions), v.state.next({
969
+ isLoading: !1
970
+ });
971
+ }),
972
+ _updateFormState: (r) => {
973
+ t = {
974
+ ...t,
975
+ ...r
976
+ };
977
+ },
978
+ _disableForm: bt,
979
+ _subjects: v,
980
+ _proxyFormState: V,
981
+ _setErrors: z,
982
+ get _fields() {
983
+ return u;
984
+ },
985
+ get _formValues() {
986
+ return a;
987
+ },
988
+ get _state() {
989
+ return y;
990
+ },
991
+ set _state(r) {
992
+ y = r;
993
+ },
994
+ get _defaultValues() {
995
+ return n;
996
+ },
997
+ get _names() {
998
+ return g;
999
+ },
1000
+ set _names(r) {
1001
+ g = r;
1002
+ },
1003
+ get _formState() {
1004
+ return t;
1005
+ },
1006
+ set _formState(r) {
1007
+ t = r;
1008
+ },
1009
+ get _options() {
1010
+ return s;
1011
+ },
1012
+ set _options(r) {
1013
+ s = {
1014
+ ...s,
1015
+ ...r
1016
+ };
1017
+ }
1018
+ },
1019
+ trigger: le,
1020
+ register: De,
1021
+ handleSubmit: We,
1022
+ watch: _t,
1023
+ setValue: j,
1024
+ getValues: Be,
1025
+ reset: He,
1026
+ resetField: Vt,
1027
+ clearErrors: vt,
1028
+ unregister: xe,
1029
+ setError: Pe,
1030
+ setFocus: (r, i = {}) => {
1031
+ const l = c(u, r), d = l && l._f;
1032
+ if (d) {
1033
+ const f = d.refs ? d.refs[0] : d.ref;
1034
+ f.focus && (f.focus(), i.shouldSelect && K(f.select) && f.select());
1035
+ }
1036
+ },
1037
+ getFieldState: Ne
1038
+ };
1039
+ }
1040
+ function Qt(e = {}) {
1041
+ const s = x.useRef(void 0), t = x.useRef(void 0), [u, n] = x.useState({
1042
+ isDirty: !1,
1043
+ isValidating: !1,
1044
+ isLoading: K(e.defaultValues),
1045
+ isSubmitted: !1,
1046
+ isSubmitting: !1,
1047
+ isSubmitSuccessful: !1,
1048
+ isValid: !1,
1049
+ submitCount: 0,
1050
+ dirtyFields: {},
1051
+ touchedFields: {},
1052
+ validatingFields: {},
1053
+ errors: e.errors || {},
1054
+ disabled: e.disabled || !1,
1055
+ defaultValues: K(e.defaultValues) ? void 0 : e.defaultValues
1056
+ });
1057
+ s.current || (s.current = {
1058
+ ...qt(e),
1059
+ formState: u
1060
+ });
1061
+ const a = s.current.control;
1062
+ return a._options = e, Re({
1063
+ subject: a._subjects.state,
1064
+ next: (y) => {
1065
+ at(y, a._proxyFormState, a._updateFormState, !0) && n({ ...a._formState });
1066
+ }
1067
+ }), x.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), x.useEffect(() => {
1068
+ if (a._proxyFormState.isDirty) {
1069
+ const y = a._getDirty();
1070
+ y !== u.isDirty && a._subjects.state.next({
1071
+ isDirty: y
1072
+ });
1073
+ }
1074
+ }, [a, u.isDirty]), x.useEffect(() => {
1075
+ e.values && !X(e.values, t.current) ? (a._reset(e.values, a._options.resetOptions), t.current = e.values, n((y) => ({ ...y }))) : a._resetDefaultValues();
1076
+ }, [e.values, a]), x.useEffect(() => {
1077
+ e.errors && a._setErrors(e.errors);
1078
+ }, [e.errors, a]), x.useEffect(() => {
1079
+ a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
1080
+ }), x.useEffect(() => {
1081
+ e.shouldUnregister && a._subjects.values.next({
1082
+ values: a._getWatch()
1083
+ });
1084
+ }, [e.shouldUnregister, a]), s.current.formState = nt(u, a), s.current;
1085
+ }
1086
+ const Wt = (e, s) => {
1087
+ let t;
1088
+ return function(...u) {
1089
+ clearTimeout(t), t = setTimeout(() => e(...u), s);
1090
+ };
1091
+ }, jt = (e, s) => ce.useMemo(() => Wt(e, s), [s]), Xt = (e, s) => {
1092
+ const t = ce.useRef(e), [u, n] = ce.useState(e), a = jt(n, s);
1093
+ return ce.useEffect(() => {
1094
+ t.current !== e && (a(e), t.current = e);
1095
+ }, [e]), u;
1096
+ };
1097
+ export {
1098
+ Jt as C,
1099
+ pt as a,
1100
+ kt as b,
1101
+ zt as c,
1102
+ Wt as d,
1103
+ jt as e,
1104
+ Xt as f,
1105
+ c as g,
1106
+ Ct as h,
1107
+ D as s,
1108
+ Qt as u
1109
+ };
1110
+ //# sourceMappingURL=useDebounce-m2rLy7nL.js.map