suprform 1.0.11 → 1.0.12

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.
@@ -1,17 +1,17 @@
1
1
  import { jsx as ae, Fragment as jr, jsxs as cr } from "react/jsx-runtime";
2
- import b, { createContext as Qr, useContext as Gr, useMemo as We, useImperativeHandle as Fr, useEffect as zr, cloneElement as He, Children as Kr, isValidElement as Yr } from "react";
2
+ import b, { createContext as Qr, useContext as Gr, useMemo as We, useImperativeHandle as br, useEffect as zr, cloneElement as He, Children as Kr, isValidElement as Yr } from "react";
3
3
  var ve = (e) => e.type === "checkbox", le = (e) => e instanceof Date, G = (e) => e == null;
4
- const br = (e) => typeof e == "object";
5
- var M = (e) => !G(e) && !Array.isArray(e) && br(e) && !le(e), Ar = (e) => M(e) && e.target ? ve(e.target) ? e.target.checked : e.target.value : e, Jr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, pr = (e, t) => e.has(Jr(t)), Xr = (e) => {
4
+ const Fr = (e) => typeof e == "object";
5
+ var B = (e) => !G(e) && !Array.isArray(e) && Fr(e) && !le(e), Ar = (e) => B(e) && e.target ? ve(e.target) ? e.target.checked : e.target.value : e, Jr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, pr = (e, t) => e.has(Jr(t)), Xr = (e) => {
6
6
  const t = e.constructor && e.constructor.prototype;
7
- return M(t) && t.hasOwnProperty("isPrototypeOf");
7
+ return B(t) && t.hasOwnProperty("isPrototypeOf");
8
8
  }, ze = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
9
9
  function U(e) {
10
10
  let t;
11
11
  const r = Array.isArray(e), s = typeof FileList < "u" ? e instanceof FileList : !1;
12
12
  if (e instanceof Date)
13
13
  t = new Date(e);
14
- else if (!(ze && (e instanceof Blob || s)) && (r || M(e)))
14
+ else if (!(ze && (e instanceof Blob || s)) && (r || B(e)))
15
15
  if (t = r ? [] : Object.create(Object.getPrototypeOf(e)), !r && !Xr(e))
16
16
  t = e;
17
17
  else
@@ -22,7 +22,7 @@ function U(e) {
22
22
  return t;
23
23
  }
24
24
  var xe = (e) => /^\w*$/.test(e), T = (e) => e === void 0, Se = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Ke = (e) => Se(e.replace(/["|']|\]/g, "").split(/\.|\[/)), m = (e, t, r) => {
25
- if (!t || !M(e))
25
+ if (!t || !B(e))
26
26
  return r;
27
27
  const s = (xe(t) ? [t] : Ke(t)).reduce((u, i) => G(u) ? u : u[i], e);
28
28
  return T(s) || s === e ? T(e[t]) ? r : e[t] : s;
@@ -34,14 +34,14 @@ var xe = (e) => /^\w*$/.test(e), T = (e) => e === void 0, Se = (e) => Array.isAr
34
34
  let F = r;
35
35
  if (s !== l) {
36
36
  const h = e[c];
37
- F = M(h) || Array.isArray(h) ? h : isNaN(+u[s + 1]) ? {} : [];
37
+ F = B(h) || Array.isArray(h) ? h : isNaN(+u[s + 1]) ? {} : [];
38
38
  }
39
39
  if (c === "__proto__" || c === "constructor" || c === "prototype")
40
40
  return;
41
41
  e[c] = F, e = e[c];
42
42
  }
43
43
  };
44
- const be = {
44
+ const Fe = {
45
45
  BLUR: "blur",
46
46
  FOCUS_OUT: "focusout",
47
47
  CHANGE: "change"
@@ -104,7 +104,7 @@ function et(e) {
104
104
  F.current.isValid && r._setValid(!0);
105
105
  }, [r]), b.useMemo(() => xr(l, r, F.current, !1), [l, r]);
106
106
  }
107
- var Y = (e) => typeof e == "string", $e = (e, t, r, s, u) => Y(e) ? (s && t.watch.add(e), m(r, e, u)) : Array.isArray(e) ? e.map((i) => (s && t.watch.add(i), m(r, i))) : (s && (t.watchAll = !0), r), qe = (e) => G(e) || !br(e);
107
+ var Y = (e) => typeof e == "string", $e = (e, t, r, s, u) => Y(e) ? (s && t.watch.add(e), m(r, e, u)) : Array.isArray(e) ? e.map((i) => (s && t.watch.add(i), m(r, i))) : (s && (t.watchAll = !0), r), qe = (e) => G(e) || !Fr(e);
108
108
  function ee(e, t, r = /* @__PURE__ */ new WeakSet()) {
109
109
  if (qe(e) || qe(t))
110
110
  return Object.is(e, t);
@@ -122,7 +122,7 @@ function ee(e, t, r = /* @__PURE__ */ new WeakSet()) {
122
122
  return !1;
123
123
  if (i !== "ref") {
124
124
  const c = t[i];
125
- if (le(l) && le(c) || M(l) && M(c) || Array.isArray(l) && Array.isArray(c) ? !ee(l, c, r) : !Object.is(l, c))
125
+ if (le(l) && le(c) || B(l) && B(c) || Array.isArray(l) && Array.isArray(c) ? !ee(l, c, r) : !Object.is(l, c))
126
126
  return !1;
127
127
  }
128
128
  }
@@ -131,39 +131,39 @@ function ee(e, t, r = /* @__PURE__ */ new WeakSet()) {
131
131
  function Sr(e) {
132
132
  const t = _e(), { control: r = t.control, name: s, defaultValue: u, disabled: i, exact: l, compute: c } = e || {}, F = b.useRef(u), h = b.useRef(c), V = b.useRef(void 0), g = b.useRef(r), A = b.useRef(s);
133
133
  h.current = c;
134
- const [H, I] = b.useState(() => {
134
+ const [P, N] = b.useState(() => {
135
135
  const f = r._getWatch(s, F.current);
136
136
  return h.current ? h.current(f) : f;
137
- }), k = b.useCallback((f) => {
137
+ }), w = b.useCallback((f) => {
138
138
  const y = $e(s, r._names, f || r._formValues, !1, F.current);
139
139
  return h.current ? h.current(y) : y;
140
- }, [r._formValues, r._names, s]), B = b.useCallback((f) => {
140
+ }, [r._formValues, r._names, s]), L = b.useCallback((f) => {
141
141
  if (!i) {
142
142
  const y = $e(s, r._names, f || r._formValues, !1, F.current);
143
143
  if (h.current) {
144
144
  const x = h.current(y);
145
- ee(x, V.current) || (I(x), V.current = x);
145
+ ee(x, V.current) || (N(x), V.current = x);
146
146
  } else
147
- I(y);
147
+ N(y);
148
148
  }
149
149
  }, [r._formValues, r._names, i, s]);
150
- Ee(() => ((g.current !== r || !ee(A.current, s)) && (g.current = r, A.current = s, B()), r._subscribe({
150
+ Ee(() => ((g.current !== r || !ee(A.current, s)) && (g.current = r, A.current = s, L()), r._subscribe({
151
151
  name: s,
152
152
  formState: {
153
153
  values: !0
154
154
  },
155
155
  exact: l,
156
156
  callback: (f) => {
157
- B(f.values);
157
+ L(f.values);
158
158
  }
159
- })), [r, l, s, B]), b.useEffect(() => r._removeUnmounted());
160
- const j = g.current !== r, S = A.current, P = b.useMemo(() => {
159
+ })), [r, l, s, L]), b.useEffect(() => r._removeUnmounted());
160
+ const $ = g.current !== r, S = A.current, W = b.useMemo(() => {
161
161
  if (i)
162
162
  return null;
163
- const f = !j && !ee(S, s);
164
- return j || f ? k() : null;
165
- }, [i, j, s, S, k]);
166
- return P !== null ? P : H;
163
+ const f = !$ && !ee(S, s);
164
+ return $ || f ? w() : null;
165
+ }, [i, $, s, S, w]);
166
+ return W !== null ? W : P;
167
167
  }
168
168
  function rt(e) {
169
169
  const t = _e(), { name: r, disabled: s, control: u = t.control, shouldUnregister: i, defaultValue: l, exact: c = !0 } = e, F = pr(u._names.array, r), h = b.useMemo(() => m(u._formValues, r, m(u._defaultValues, r, l)), [u, r, l]), V = Sr({
@@ -175,13 +175,13 @@ function rt(e) {
175
175
  control: u,
176
176
  name: r,
177
177
  exact: c
178
- }), A = b.useRef(e), H = b.useRef(void 0), I = b.useRef(u.register(r, {
178
+ }), A = b.useRef(e), P = b.useRef(void 0), N = b.useRef(u.register(r, {
179
179
  ...e.rules,
180
180
  value: V,
181
181
  ...K(e.disabled) ? { disabled: e.disabled } : {}
182
182
  }));
183
183
  A.current = e;
184
- const k = b.useMemo(() => Object.defineProperties({}, {
184
+ const w = b.useMemo(() => Object.defineProperties({}, {
185
185
  invalid: {
186
186
  enumerable: !0,
187
187
  get: () => !!m(g.errors, r)
@@ -202,18 +202,18 @@ function rt(e) {
202
202
  enumerable: !0,
203
203
  get: () => m(g.errors, r)
204
204
  }
205
- }), [g, r]), B = b.useCallback((f) => I.current.onChange({
205
+ }), [g, r]), L = b.useCallback((f) => N.current.onChange({
206
206
  target: {
207
207
  value: Ar(f),
208
208
  name: r
209
209
  },
210
- type: be.CHANGE
211
- }), [r]), j = b.useCallback(() => I.current.onBlur({
210
+ type: Fe.CHANGE
211
+ }), [r]), $ = b.useCallback(() => N.current.onBlur({
212
212
  target: {
213
213
  value: m(u._formValues, r),
214
214
  name: r
215
215
  },
216
- type: be.BLUR
216
+ type: Fe.BLUR
217
217
  }), [r, u._formValues]), S = b.useCallback((f) => {
218
218
  const y = m(u._fields, r);
219
219
  y && f && (y._f.ref = {
@@ -222,29 +222,29 @@ function rt(e) {
222
222
  setCustomValidity: (x) => f.setCustomValidity(x),
223
223
  reportValidity: () => f.reportValidity()
224
224
  });
225
- }, [u._fields, r]), P = b.useMemo(() => ({
225
+ }, [u._fields, r]), W = b.useMemo(() => ({
226
226
  name: r,
227
227
  value: V,
228
228
  ...K(s) || g.disabled ? { disabled: g.disabled || s } : {},
229
- onChange: B,
230
- onBlur: j,
229
+ onChange: L,
230
+ onBlur: $,
231
231
  ref: S
232
- }), [r, s, g.disabled, B, j, S, V]);
232
+ }), [r, s, g.disabled, L, $, S, V]);
233
233
  return b.useEffect(() => {
234
- const f = u._options.shouldUnregister || i, y = H.current;
234
+ const f = u._options.shouldUnregister || i, y = P.current;
235
235
  y && y !== r && !F && u.unregister(y), u.register(r, {
236
236
  ...A.current.rules,
237
237
  ...K(A.current.disabled) ? { disabled: A.current.disabled } : {}
238
238
  });
239
239
  const x = (E, Z) => {
240
- const W = m(u._fields, E);
241
- W && W._f && (W._f.mount = Z);
240
+ const H = m(u._fields, E);
241
+ H && H._f && (H._f.mount = Z);
242
242
  };
243
243
  if (x(r, !0), f) {
244
244
  const E = U(m(u._options.defaultValues, r, A.current.defaultValue));
245
245
  R(u._defaultValues, r, E), T(m(u._formValues, r)) && R(u._formValues, r, E);
246
246
  }
247
- return !F && u.register(r), H.current = r, () => {
247
+ return !F && u.register(r), P.current = r, () => {
248
248
  (F ? f && !u._state.action : f) ? u.unregister(r) : x(r, !1);
249
249
  };
250
250
  }, [r, u, F, i]), b.useEffect(() => {
@@ -253,10 +253,10 @@ function rt(e) {
253
253
  name: r
254
254
  });
255
255
  }, [s, r, u]), b.useMemo(() => ({
256
- field: P,
256
+ field: W,
257
257
  formState: g,
258
- fieldState: k
259
- }), [P, g, k]);
258
+ fieldState: w
259
+ }), [W, g, w]);
260
260
  }
261
261
  const tt = (e) => e.render(rt(e));
262
262
  var st = (e, t, r, s, u) => t ? {
@@ -290,14 +290,14 @@ function Er(e, t) {
290
290
  for (const s in e)
291
291
  if (e.hasOwnProperty(s)) {
292
292
  const u = e[s], i = t[s];
293
- if (u && M(u) && i) {
293
+ if (u && B(u) && i) {
294
294
  const l = Er(u, i);
295
- M(l) && (r[s] = l);
295
+ B(l) && (r[s] = l);
296
296
  } else e[s] && (r[s] = i);
297
297
  }
298
298
  return r;
299
299
  }
300
- var $ = (e) => M(e) && !Object.keys(e).length, Je = (e) => e.type === "file", re = (e) => typeof e == "function", Ae = (e) => {
300
+ var q = (e) => B(e) && !Object.keys(e).length, Je = (e) => e.type === "file", re = (e) => typeof e == "function", Ae = (e) => {
301
301
  if (!ze)
302
302
  return !1;
303
303
  const t = e ? e.ownerDocument : 0;
@@ -316,9 +316,9 @@ function it(e) {
316
316
  return !1;
317
317
  return !0;
318
318
  }
319
- function L(e, t) {
319
+ function I(e, t) {
320
320
  const r = Array.isArray(t) ? t : xe(t) ? [t] : Ke(t), s = r.length === 1 ? e : nt(e, r), u = r.length - 1, i = r[u];
321
- return s && delete s[i], u !== 0 && (M(s) && $(s) || Array.isArray(s) && it(s)) && L(e, r.slice(0, -1)), e;
321
+ return s && delete s[i], u !== 0 && (B(s) && q(s) || Array.isArray(s) && it(s)) && I(e, r.slice(0, -1)), e;
322
322
  }
323
323
  var ut = (e) => {
324
324
  for (const t in e)
@@ -327,7 +327,7 @@ var ut = (e) => {
327
327
  return !1;
328
328
  };
329
329
  function kr(e) {
330
- return Array.isArray(e) || M(e) && !ut(e);
330
+ return Array.isArray(e) || B(e) && !ut(e);
331
331
  }
332
332
  function je(e, t = {}) {
333
333
  for (const r in e) {
@@ -390,7 +390,7 @@ var ot = (e, t, r, s) => {
390
390
  fields: u,
391
391
  shouldUseNativeValidation: s
392
392
  };
393
- }, pe = (e) => e instanceof RegExp, he = (e) => T(e) ? e : pe(e) ? e.source : M(e) ? pe(e.value) ? e.value.source : e.value : e, ye = (e) => ({
393
+ }, pe = (e) => e instanceof RegExp, he = (e) => T(e) ? e : pe(e) ? e.source : B(e) ? pe(e.value) ? e.value.source : e.value : e, ye = (e) => ({
394
394
  isOnSubmit: !e || e === X.onSubmit,
395
395
  isOnBlur: e === X.onBlur,
396
396
  isOnChange: e === X.onChange,
@@ -398,7 +398,7 @@ var ot = (e, t, r, s) => {
398
398
  isOnTouch: e === X.onTouched
399
399
  });
400
400
  const gr = "AsyncFunction";
401
- var lt = (e) => !!e && !!e.validate && !!(re(e.validate) && e.validate.constructor.name === gr || M(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === gr)), ct = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Qe = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
401
+ var lt = (e) => !!e && !!e.validate && !!(re(e.validate) && e.validate.constructor.name === gr || B(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === gr)), ct = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Qe = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
402
402
  const me = (e, t, r, s) => {
403
403
  for (const u of r || Object.keys(e)) {
404
404
  const i = m(e, u);
@@ -411,7 +411,7 @@ const me = (e, t, r, s) => {
411
411
  return !0;
412
412
  if (me(c, t))
413
413
  break;
414
- } else if (M(c) && me(c, t))
414
+ } else if (B(c) && me(c, t))
415
415
  break;
416
416
  }
417
417
  }
@@ -447,8 +447,8 @@ function hr(e, t, r) {
447
447
  var dt = (e, t, r, s) => {
448
448
  r(e);
449
449
  const { name: u, ...i } = e;
450
- return $(i) || Object.keys(i).length >= Object.keys(t).length || Object.keys(i).find((l) => t[l] === (!s || X.all));
451
- }, ft = (e, t, r) => !e || !t || e === t || z(e).some((s) => s && (r ? s === t : s.startsWith(t) || t.startsWith(s))), yt = (e, t, r, s, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(t || e) : (r ? s.isOnBlur : u.isOnBlur) ? !e : (r ? s.isOnChange : u.isOnChange) ? e : !0, mt = (e, t) => !Se(m(e, t)).length && L(e, t), Or = (e, t, r) => {
450
+ return q(i) || Object.keys(i).length >= Object.keys(t).length || Object.keys(i).find((l) => t[l] === (!s || X.all));
451
+ }, ft = (e, t, r) => !e || !t || e === t || z(e).some((s) => s && (r ? s === t : s.startsWith(t) || t.startsWith(s))), yt = (e, t, r, s, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(t || e) : (r ? s.isOnBlur : u.isOnBlur) ? !e : (r ? s.isOnChange : u.isOnChange) ? e : !0, mt = (e, t) => !Se(m(e, t)).length && I(e, t), Or = (e, t, r) => {
452
452
  const s = z(m(e, r));
453
453
  return R(s, "root", t[r]), R(e, r, s), e;
454
454
  };
@@ -460,55 +460,55 @@ function vr(e, t, r = "validate") {
460
460
  ref: t
461
461
  };
462
462
  }
463
- var de = (e) => M(e) && !pe(e) ? e : {
463
+ var de = (e) => B(e) && !pe(e) ? e : {
464
464
  value: e,
465
465
  message: ""
466
466
  }, Ge = async (e, t, r, s, u, i) => {
467
- const { ref: l, refs: c, required: F, maxLength: h, minLength: V, min: g, max: A, pattern: H, validate: I, name: k, valueAsNumber: B, mount: j } = e._f, S = m(r, k);
468
- if (!j || t.has(k))
467
+ const { ref: l, refs: c, required: F, maxLength: h, minLength: V, min: g, max: A, pattern: P, validate: N, name: w, valueAsNumber: L, mount: $ } = e._f, S = m(r, w);
468
+ if (!$ || t.has(w))
469
469
  return {};
470
- const P = c ? c[0] : l, f = (w) => {
471
- u && P.reportValidity && (P.setCustomValidity(K(w) ? "" : w || ""), P.reportValidity());
472
- }, y = {}, x = Xe(l), E = ve(l), Z = x || E, W = (B || Je(l)) && T(l.value) && T(S) || Ae(l) && l.value === "" || S === "" || Array.isArray(S) && !S.length, oe = st.bind(null, k, s, y), te = (w, D, N, q = ne.maxLength, Q = ne.minLength) => {
473
- const se = w ? D : N;
474
- y[k] = {
475
- type: w ? q : Q,
470
+ const W = c ? c[0] : l, f = (k) => {
471
+ u && W.reportValidity && (W.setCustomValidity(K(k) ? "" : k || ""), W.reportValidity());
472
+ }, y = {}, x = Xe(l), E = ve(l), Z = x || E, H = (L || Je(l)) && T(l.value) && T(S) || Ae(l) && l.value === "" || S === "" || Array.isArray(S) && !S.length, oe = st.bind(null, w, s, y), te = (k, D, M, j = ne.maxLength, Q = ne.minLength) => {
473
+ const se = k ? D : M;
474
+ y[w] = {
475
+ type: k ? j : Q,
476
476
  message: se,
477
477
  ref: l,
478
- ...oe(w ? q : Q, se)
478
+ ...oe(k ? j : Q, se)
479
479
  };
480
480
  };
481
- if (i ? !Array.isArray(S) || !S.length : F && (!Z && (W || G(S)) || K(S) && !S || E && !Cr(c).isValid || x && !Rr(c).isValid)) {
482
- const { value: w, message: D } = Y(F) ? { value: !!F, message: F } : de(F);
483
- if (w && (y[k] = {
481
+ if (i ? !Array.isArray(S) || !S.length : F && (!Z && (H || G(S)) || K(S) && !S || E && !Cr(c).isValid || x && !Rr(c).isValid)) {
482
+ const { value: k, message: D } = Y(F) ? { value: !!F, message: F } : de(F);
483
+ if (k && (y[w] = {
484
484
  type: ne.required,
485
485
  message: D,
486
- ref: P,
486
+ ref: W,
487
487
  ...oe(ne.required, D)
488
488
  }, !s))
489
489
  return f(D), y;
490
490
  }
491
- if (!W && (!G(g) || !G(A))) {
492
- let w, D;
493
- const N = de(A), q = de(g);
491
+ if (!H && (!G(g) || !G(A))) {
492
+ let k, D;
493
+ const M = de(A), j = de(g);
494
494
  if (!G(S) && !isNaN(S)) {
495
495
  const Q = l.valueAsNumber || S && +S;
496
- G(N.value) || (w = Q > N.value), G(q.value) || (D = Q < q.value);
496
+ G(M.value) || (k = Q > M.value), G(j.value) || (D = Q < j.value);
497
497
  } else {
498
498
  const Q = l.valueAsDate || new Date(S), se = (Ve) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Ve), ge = l.type == "time", ce = l.type == "week";
499
- Y(N.value) && S && (w = ge ? se(S) > se(N.value) : ce ? S > N.value : Q > new Date(N.value)), Y(q.value) && S && (D = ge ? se(S) < se(q.value) : ce ? S < q.value : Q < new Date(q.value));
499
+ Y(M.value) && S && (k = ge ? se(S) > se(M.value) : ce ? S > M.value : Q > new Date(M.value)), Y(j.value) && S && (D = ge ? se(S) < se(j.value) : ce ? S < j.value : Q < new Date(j.value));
500
500
  }
501
- if ((w || D) && (te(!!w, N.message, q.message, ne.max, ne.min), !s))
502
- return f(y[k].message), y;
501
+ if ((k || D) && (te(!!k, M.message, j.message, ne.max, ne.min), !s))
502
+ return f(y[w].message), y;
503
503
  }
504
- if ((h || V) && !W && (Y(S) || i && Array.isArray(S))) {
505
- const w = de(h), D = de(V), N = !G(w.value) && S.length > +w.value, q = !G(D.value) && S.length < +D.value;
506
- if ((N || q) && (te(N, w.message, D.message), !s))
507
- return f(y[k].message), y;
504
+ if ((h || V) && !H && (Y(S) || i && Array.isArray(S))) {
505
+ const k = de(h), D = de(V), M = !G(k.value) && S.length > +k.value, j = !G(D.value) && S.length < +D.value;
506
+ if ((M || j) && (te(M, k.message, D.message), !s))
507
+ return f(y[w].message), y;
508
508
  }
509
- if (H && !W && Y(S)) {
510
- const { value: w, message: D } = de(H);
511
- if (pe(w) && !S.match(w) && (y[k] = {
509
+ if (P && !H && Y(S)) {
510
+ const { value: k, message: D } = de(P);
511
+ if (pe(k) && !S.match(k) && (y[w] = {
512
512
  type: ne.pattern,
513
513
  message: D,
514
514
  ref: l,
@@ -516,28 +516,28 @@ var de = (e) => M(e) && !pe(e) ? e : {
516
516
  }, !s))
517
517
  return f(D), y;
518
518
  }
519
- if (I) {
520
- if (re(I)) {
521
- const w = await I(S, r), D = vr(w, P);
522
- if (D && (y[k] = {
519
+ if (N) {
520
+ if (re(N)) {
521
+ const k = await N(S, r), D = vr(k, W);
522
+ if (D && (y[w] = {
523
523
  ...D,
524
524
  ...oe(ne.validate, D.message)
525
525
  }, !s))
526
526
  return f(D.message), y;
527
- } else if (M(I)) {
528
- let w = {};
529
- for (const D in I) {
530
- if (!$(w) && !s)
527
+ } else if (B(N)) {
528
+ let k = {};
529
+ for (const D in N) {
530
+ if (!q(k) && !s)
531
531
  break;
532
- const N = vr(await I[D](S, r), P, D);
533
- N && (w = {
534
- ...N,
535
- ...oe(D, N.message)
536
- }, f(N.message), s && (y[k] = w));
532
+ const M = vr(await N[D](S, r), W, D);
533
+ M && (k = {
534
+ ...M,
535
+ ...oe(D, M.message)
536
+ }, f(M.message), s && (y[w] = k));
537
537
  }
538
- if (!$(w) && (y[k] = {
539
- ref: P,
540
- ...w
538
+ if (!q(k) && (y[w] = {
539
+ ref: W,
540
+ ...k
541
541
  }, !s))
542
542
  return y;
543
543
  }
@@ -568,7 +568,7 @@ function gt(e = {}) {
568
568
  validatingFields: {},
569
569
  errors: t.errors || {},
570
570
  disabled: t.disabled || !1
571
- }, s = {}, u = M(t.defaultValues) || M(t.values) ? U(t.defaultValues || t.values) || {} : {}, i = t.shouldUnregister ? {} : U(u), l = {
571
+ }, s = {}, u = B(t.defaultValues) || B(t.values) ? U(t.defaultValues || t.values) || {} : {}, i = t.shouldUnregister ? {} : U(u), l = {
572
572
  action: !1,
573
573
  mount: !1,
574
574
  watch: !1
@@ -594,23 +594,23 @@ function gt(e = {}) {
594
594
  const A = {
595
595
  array: dr(),
596
596
  state: dr()
597
- }, H = t.criteriaMode === X.all, I = (a) => (n) => {
597
+ }, P = t.criteriaMode === X.all, N = (a) => (n) => {
598
598
  clearTimeout(h), h = setTimeout(a, n);
599
- }, k = async (a) => {
599
+ }, w = async (a) => {
600
600
  if (!t.disabled && (V.isValid || g.isValid || a)) {
601
- const n = t.resolver ? $((await E()).errors) : await W(s, !0);
601
+ const n = t.resolver ? q((await E()).errors) : await H(s, !0);
602
602
  n !== r.isValid && A.state.next({
603
603
  isValid: n
604
604
  });
605
605
  }
606
- }, B = (a, n) => {
606
+ }, L = (a, n) => {
607
607
  !t.disabled && (V.isValidating || V.validatingFields || g.isValidating || g.validatingFields) && ((a || Array.from(c.mount)).forEach((o) => {
608
- o && (n ? R(r.validatingFields, o, n) : L(r.validatingFields, o));
608
+ o && (n ? R(r.validatingFields, o, n) : I(r.validatingFields, o));
609
609
  }), A.state.next({
610
610
  validatingFields: r.validatingFields,
611
- isValidating: !$(r.validatingFields)
611
+ isValidating: !q(r.validatingFields)
612
612
  }));
613
- }, j = (a, n = [], o, v, _ = !0, d = !0) => {
613
+ }, $ = (a, n = [], o, v, _ = !0, d = !0) => {
614
614
  if (v && o && !t.disabled) {
615
615
  if (l.action = !0, d && Array.isArray(m(s, a))) {
616
616
  const p = o(m(s, a), v.argA, v.argB);
@@ -637,7 +637,7 @@ function gt(e = {}) {
637
637
  R(r.errors, a, n), A.state.next({
638
638
  errors: r.errors
639
639
  });
640
- }, P = (a) => {
640
+ }, W = (a) => {
641
641
  r.errors = a, A.state.next({
642
642
  errors: r.errors,
643
643
  isValid: !1
@@ -646,7 +646,7 @@ function gt(e = {}) {
646
646
  const _ = m(s, a);
647
647
  if (_) {
648
648
  const d = m(i, a, T(o) ? m(u, a) : o);
649
- T(d) || v && v.defaultChecked || n ? R(i, a, n ? d : _r(_._f)) : N(a, d), l.mount && !l.action && k();
649
+ T(d) || v && v.defaultChecked || n ? R(i, a, n ? d : _r(_._f)) : M(a, d), l.mount && !l.action && w();
650
650
  }
651
651
  }, y = (a, n, o, v, _) => {
652
652
  let d = !1, p = !1;
@@ -657,7 +657,7 @@ function gt(e = {}) {
657
657
  if (!o || v) {
658
658
  (V.isDirty || g.isDirty) && (p = r.isDirty, r.isDirty = C.isDirty = te(), d = p !== C.isDirty);
659
659
  const O = ee(m(u, a), n);
660
- p = !!m(r.dirtyFields, a), O ? L(r.dirtyFields, a) : R(r.dirtyFields, a, !0), C.dirtyFields = r.dirtyFields, d = d || (V.dirtyFields || g.dirtyFields) && p !== !O;
660
+ p = !!m(r.dirtyFields, a), O ? I(r.dirtyFields, a) : R(r.dirtyFields, a, !0), C.dirtyFields = r.dirtyFields, d = d || (V.dirtyFields || g.dirtyFields) && p !== !O;
661
661
  }
662
662
  if (o) {
663
663
  const O = m(r.touchedFields, a);
@@ -668,7 +668,7 @@ function gt(e = {}) {
668
668
  return d ? C : {};
669
669
  }, x = (a, n, o, v) => {
670
670
  const _ = m(r.errors, a), d = (V.isValid || g.isValid) && K(n) && r.isValid !== n;
671
- if (t.delayError && o ? (F = I(() => S(a, o)), F(t.delayError)) : (clearTimeout(h), F = null, o ? R(r.errors, a, o) : L(r.errors, a)), (o ? !ee(_, o) : _) || !$(v) || d) {
671
+ if (t.delayError && o ? (F = N(() => S(a, o)), F(t.delayError)) : (clearTimeout(h), F = null, o ? R(r.errors, a, o) : I(r.errors, a)), (o ? !ee(_, o) : _) || !q(v) || d) {
672
672
  const p = {
673
673
  ...v,
674
674
  ...d && K(n) ? { isValid: n } : {},
@@ -681,20 +681,20 @@ function gt(e = {}) {
681
681
  }, A.state.next(p);
682
682
  }
683
683
  }, E = async (a) => {
684
- B(a, !0);
684
+ L(a, !0);
685
685
  const n = await t.resolver(i, t.context, ot(a || c.mount, s, t.criteriaMode, t.shouldUseNativeValidation));
686
- return B(a), n;
686
+ return L(a), n;
687
687
  }, Z = async (a) => {
688
688
  const { errors: n } = await E(a);
689
689
  if (a)
690
690
  for (const o of a) {
691
691
  const v = m(n, o);
692
- v ? R(r.errors, o, v) : L(r.errors, o);
692
+ v ? R(r.errors, o, v) : I(r.errors, o);
693
693
  }
694
694
  else
695
695
  r.errors = n;
696
696
  return n;
697
- }, W = async (a, n, o = {
697
+ }, H = async (a, n, o = {
698
698
  valid: !0
699
699
  }) => {
700
700
  for (const v in a) {
@@ -703,13 +703,13 @@ function gt(e = {}) {
703
703
  const { _f: d, ...p } = _;
704
704
  if (d) {
705
705
  const C = c.array.has(d.name), O = _._f && lt(_._f);
706
- O && V.validatingFields && B([d.name], !0);
707
- const J = await Ge(_, c.disabled, i, H, t.shouldUseNativeValidation && !n, C);
708
- if (O && V.validatingFields && B([d.name]), J[d.name] && (o.valid = !1, n))
706
+ O && V.validatingFields && L([d.name], !0);
707
+ const J = await Ge(_, c.disabled, i, P, t.shouldUseNativeValidation && !n, C);
708
+ if (O && V.validatingFields && L([d.name]), J[d.name] && (o.valid = !1, n))
709
709
  break;
710
- !n && (m(J, d.name) ? C ? Or(r.errors, J, d.name) : R(r.errors, d.name, J[d.name]) : L(r.errors, d.name));
710
+ !n && (m(J, d.name) ? C ? Or(r.errors, J, d.name) : R(r.errors, d.name, J[d.name]) : I(r.errors, d.name));
711
711
  }
712
- !$(p) && await W(p, n, o);
712
+ !q(p) && await H(p, n, o);
713
713
  }
714
714
  }
715
715
  return o.valid;
@@ -719,9 +719,9 @@ function gt(e = {}) {
719
719
  n && (n._f.refs ? n._f.refs.every((o) => !Oe(o)) : !Oe(n._f.ref)) && we(a);
720
720
  }
721
721
  c.unMount = /* @__PURE__ */ new Set();
722
- }, te = (a, n) => !t.disabled && (a && n && R(i, a, n), !ee(Ve(), u)), w = (a, n, o) => $e(a, c, {
722
+ }, te = (a, n) => !t.disabled && (a && n && R(i, a, n), !ee(Ve(), u)), k = (a, n, o) => $e(a, c, {
723
723
  ...l.mount ? i : T(n) ? u : Y(a) ? { [a]: n } : n
724
- }, o, n), D = (a) => Se(m(l.mount ? i : u, a, t.shouldUnregister ? m(u, a, []) : [])), N = (a, n, o = {}) => {
724
+ }, o, n), D = (a) => Se(m(l.mount ? i : u, a, t.shouldUnregister ? m(u, a, []) : [])), M = (a, n, o = {}) => {
725
725
  const v = m(s, a);
726
726
  let _ = n;
727
727
  if (v) {
@@ -734,12 +734,12 @@ function gt(e = {}) {
734
734
  })));
735
735
  }
736
736
  (o.shouldDirty || o.shouldTouch) && y(a, _, o.shouldTouch, o.shouldDirty, !0), o.shouldValidate && ce(a);
737
- }, q = (a, n, o) => {
737
+ }, j = (a, n, o) => {
738
738
  for (const v in n) {
739
739
  if (!n.hasOwnProperty(v))
740
740
  return;
741
741
  const _ = n[v], d = a + "." + v, p = m(s, d);
742
- (c.array.has(a) || M(_) || p && !p._f) && !le(_) ? q(d, _, o) : N(d, _, o);
742
+ (c.array.has(a) || B(_) || p && !p._f) && !le(_) ? j(d, _, o) : M(d, _, o);
743
743
  }
744
744
  }, Q = (a, n, o = {}) => {
745
745
  const v = m(s, a), _ = c.array.has(a), d = U(n);
@@ -750,7 +750,7 @@ function gt(e = {}) {
750
750
  name: a,
751
751
  dirtyFields: fe(u, i),
752
752
  isDirty: te(a, d)
753
- })) : v && !v._f && !G(d) ? q(a, d, o) : N(a, d, o), Qe(a, c) && A.state.next({ ...r, name: a }), A.state.next({
753
+ })) : v && !v._f && !G(d) ? j(a, d, o) : M(a, d, o), Qe(a, c) && A.state.next({ ...r, name: a }), A.state.next({
754
754
  name: l.mount ? a : void 0,
755
755
  values: U(i)
756
756
  });
@@ -763,23 +763,23 @@ function gt(e = {}) {
763
763
  }, p = ye(t.mode), C = ye(t.reValidateMode);
764
764
  if (_) {
765
765
  let O, J;
766
- const Fe = n.type ? _r(_._f) : Ar(a), ie = a.type === be.BLUR || a.type === be.FOCUS_OUT, Hr = !ct(_._f) && !t.resolver && !m(r.errors, o) && !_._f.deps || yt(ie, m(r.touchedFields, o), r.isSubmitted, C, p), De = Qe(o, c, ie);
767
- R(i, o, Fe), ie ? (!n || !n.readOnly) && (_._f.onBlur && _._f.onBlur(a), F && F(0)) : _._f.onChange && _._f.onChange(a);
768
- const Re = y(o, Fe, ie), $r = !$(Re) || De;
766
+ const be = n.type ? _r(_._f) : Ar(a), ie = a.type === Fe.BLUR || a.type === Fe.FOCUS_OUT, Hr = !ct(_._f) && !t.resolver && !m(r.errors, o) && !_._f.deps || yt(ie, m(r.touchedFields, o), r.isSubmitted, C, p), De = Qe(o, c, ie);
767
+ R(i, o, be), ie ? (!n || !n.readOnly) && (_._f.onBlur && _._f.onBlur(a), F && F(0)) : _._f.onChange && _._f.onChange(a);
768
+ const Re = y(o, be, ie), $r = !q(Re) || De;
769
769
  if (!ie && A.state.next({
770
770
  name: o,
771
771
  type: a.type,
772
772
  values: U(i)
773
773
  }), Hr)
774
- return (V.isValid || g.isValid) && (t.mode === "onBlur" ? ie && k() : ie || k()), $r && A.state.next({ name: o, ...De ? {} : Re });
774
+ return (V.isValid || g.isValid) && (t.mode === "onBlur" ? ie && w() : ie || w()), $r && A.state.next({ name: o, ...De ? {} : Re });
775
775
  if (!ie && De && A.state.next({ ...r }), t.resolver) {
776
776
  const { errors: or } = await E([o]);
777
- if (d(Fe), v) {
777
+ if (d(be), v) {
778
778
  const qr = hr(r.errors, s, o), lr = hr(or, s, qr.name || o);
779
- O = lr.error, o = lr.name, J = $(or);
779
+ O = lr.error, o = lr.name, J = q(or);
780
780
  }
781
781
  } else
782
- B([o], !0), O = (await Ge(_, c.disabled, i, H, t.shouldUseNativeValidation))[o], B([o]), d(Fe), v && (O ? J = !1 : (V.isValid || g.isValid) && (J = await W(s, !0)));
782
+ L([o], !0), O = (await Ge(_, c.disabled, i, P, t.shouldUseNativeValidation))[o], L([o]), d(be), v && (O ? J = !1 : (V.isValid || g.isValid) && (J = await H(s, !0)));
783
783
  v && (_._f.deps && (!Array.isArray(_._f.deps) || _._f.deps.length > 0) && ce(_._f.deps), x(o, J, O, Re));
784
784
  }
785
785
  }, ge = (a, n) => {
@@ -790,11 +790,11 @@ function gt(e = {}) {
790
790
  const _ = z(a);
791
791
  if (t.resolver) {
792
792
  const d = await Z(T(a) ? a : _);
793
- o = $(d), v = a ? !_.some((p) => m(d, p)) : o;
793
+ o = q(d), v = a ? !_.some((p) => m(d, p)) : o;
794
794
  } else a ? (v = (await Promise.all(_.map(async (d) => {
795
795
  const p = m(s, d);
796
- return await W(p && p._f ? { [d]: p } : p);
797
- }))).every(Boolean), !(!v && !r.isValid) && k()) : v = o = await W(s);
796
+ return await H(p && p._f ? { [d]: p } : p);
797
+ }))).every(Boolean), !(!v && !r.isValid) && w()) : v = o = await H(s);
798
798
  return A.state.next({
799
799
  ...!Y(a) || (V.isValid || g.isValid) && o !== r.isValid ? {} : { name: a },
800
800
  ...t.resolver || !a ? { isValid: o } : {},
@@ -812,7 +812,7 @@ function gt(e = {}) {
812
812
  isValidating: !!m(r.validatingFields, a),
813
813
  isTouched: !!m((n || r).touchedFields, a)
814
814
  }), Nr = (a) => {
815
- a && z(a).forEach((n) => L(r.errors, n)), A.state.next({
815
+ a && z(a).forEach((n) => I(r.errors, n)), A.state.next({
816
816
  errors: a ? r.errors : {}
817
817
  });
818
818
  }, rr = (a, n, o) => {
@@ -827,8 +827,8 @@ function gt(e = {}) {
827
827
  isValid: !1
828
828
  }), o && o.shouldFocus && v && v.focus && v.focus();
829
829
  }, Lr = (a, n) => re(a) ? A.state.subscribe({
830
- next: (o) => "values" in o && a(w(void 0, n), o)
831
- }) : w(a, n, !0), tr = (a) => A.state.subscribe({
830
+ next: (o) => "values" in o && a(k(void 0, n), o)
831
+ }) : k(a, n, !0), tr = (a) => A.state.subscribe({
832
832
  next: (n) => {
833
833
  ft(a.name, n.name, a.exact) && dt(n, a.formState || V, Wr, a.reRenderRoot) && a.callback({
834
834
  values: { ...i },
@@ -845,13 +845,13 @@ function gt(e = {}) {
845
845
  formState: g
846
846
  })), we = (a, n = {}) => {
847
847
  for (const o of a ? z(a) : c.mount)
848
- c.mount.delete(o), c.array.delete(o), n.keepValue || (L(s, o), L(i, o)), !n.keepError && L(r.errors, o), !n.keepDirty && L(r.dirtyFields, o), !n.keepTouched && L(r.touchedFields, o), !n.keepIsValidating && L(r.validatingFields, o), !t.shouldUnregister && !n.keepDefaultValue && L(u, o);
848
+ c.mount.delete(o), c.array.delete(o), n.keepValue || (I(s, o), I(i, o)), !n.keepError && I(r.errors, o), !n.keepDirty && I(r.dirtyFields, o), !n.keepTouched && I(r.touchedFields, o), !n.keepIsValidating && I(r.validatingFields, o), !t.shouldUnregister && !n.keepDefaultValue && I(u, o);
849
849
  A.state.next({
850
850
  values: U(i)
851
851
  }), A.state.next({
852
852
  ...r,
853
853
  ...n.keepDirty ? { isDirty: te() } : {}
854
- }), !n.keepIsValid && k();
854
+ }), !n.keepIsValid && w();
855
855
  }, sr = ({ disabled: a, name: n }) => {
856
856
  (K(a) && l.mount || a || c.disabled.has(n)) && (a ? c.disabled.add(n) : c.disabled.delete(n));
857
857
  }, ke = (a, n = {}) => {
@@ -921,11 +921,11 @@ function gt(e = {}) {
921
921
  const { errors: d, values: p } = await E();
922
922
  r.errors = d, _ = U(p);
923
923
  } else
924
- await W(s);
924
+ await H(s);
925
925
  if (c.disabled.size)
926
926
  for (const d of c.disabled)
927
- L(_, d);
928
- if (L(r.errors, "root"), $(r.errors)) {
927
+ I(_, d);
928
+ if (I(r.errors, "root"), q(r.errors)) {
929
929
  A.state.next({
930
930
  errors: {}
931
931
  });
@@ -939,15 +939,15 @@ function gt(e = {}) {
939
939
  if (A.state.next({
940
940
  isSubmitted: !0,
941
941
  isSubmitting: !1,
942
- isSubmitSuccessful: $(r.errors) && !v,
942
+ isSubmitSuccessful: q(r.errors) && !v,
943
943
  submitCount: r.submitCount + 1,
944
944
  errors: r.errors
945
945
  }), v)
946
946
  throw v;
947
947
  }, Br = (a, n = {}) => {
948
- m(s, a) && (T(n.defaultValue) ? Q(a, U(m(u, a))) : (Q(a, n.defaultValue), R(u, a, U(n.defaultValue))), n.keepTouched || L(r.touchedFields, a), n.keepDirty || (L(r.dirtyFields, a), r.isDirty = n.defaultValue ? te(a, U(m(u, a))) : te()), n.keepError || (L(r.errors, a), V.isValid && k()), A.state.next({ ...r }));
948
+ m(s, a) && (T(n.defaultValue) ? Q(a, U(m(u, a))) : (Q(a, n.defaultValue), R(u, a, U(n.defaultValue))), n.keepTouched || I(r.touchedFields, a), n.keepDirty || (I(r.dirtyFields, a), r.isDirty = n.defaultValue ? te(a, U(m(u, a))) : te()), n.keepError || (I(r.errors, a), V.isValid && w()), A.state.next({ ...r }));
949
949
  }, nr = (a, n = {}) => {
950
- const o = a ? U(a) : u, v = U(o), _ = $(a), d = _ ? u : v;
950
+ const o = a ? U(a) : u, v = U(o), _ = q(a), d = _ ? u : v;
951
951
  if (n.keepDefaultValues || (u = o), !n.keepValues) {
952
952
  if (n.keepDirtyValues) {
953
953
  const p = /* @__PURE__ */ new Set([
@@ -991,7 +991,7 @@ function gt(e = {}) {
991
991
  watch: /* @__PURE__ */ new Set(),
992
992
  watchAll: !1,
993
993
  focus: ""
994
- }, l.mount = !V.isValid || !!n.keepIsValid || !!n.keepDirtyValues || !t.shouldUnregister && !$(d), l.watch = !!t.shouldUnregister, l.action = !1, n.keepErrors || (r.errors = {}), A.state.next({
994
+ }, l.mount = !V.isValid || !!n.keepIsValid || !!n.keepDirtyValues || !t.shouldUnregister && !q(d), l.watch = !!t.shouldUnregister, l.action = !1, n.keepErrors || (r.errors = {}), A.state.next({
995
995
  submitCount: n.keepSubmitCount ? r.submitCount : 0,
996
996
  isDirty: _ ? !1 : n.keepDirty ? r.isDirty : !!(n.keepDefaultValues && !ee(a, u)),
997
997
  isSubmitted: n.keepIsSubmitted ? r.isSubmitted : !1,
@@ -1023,12 +1023,12 @@ function gt(e = {}) {
1023
1023
  _subscribe: tr,
1024
1024
  _runSchema: E,
1025
1025
  _focusError: Ce,
1026
- _getWatch: w,
1026
+ _getWatch: k,
1027
1027
  _getDirty: te,
1028
- _setValid: k,
1029
- _setFieldArray: j,
1028
+ _setValid: w,
1029
+ _setFieldArray: $,
1030
1030
  _setDisabledField: sr,
1031
- _setErrors: P,
1031
+ _setErrors: W,
1032
1032
  _getFieldArray: D,
1033
1033
  _reset: nr,
1034
1034
  _resetDefaultValues: () => re(t.defaultValues) && t.defaultValues().then((a) => {
@@ -1145,29 +1145,29 @@ function vt(e) {
1145
1145
  r._names.focus = Te(s, E.length - 1, y), h.current = Ue(h.current, x.map(ue)), g(E), F(E), r._setFieldArray(s, E, Ue, {
1146
1146
  argA: Ne(f)
1147
1147
  });
1148
- }, H = (f, y) => {
1148
+ }, P = (f, y) => {
1149
1149
  const x = z(U(f)), E = Ie(r._getFieldArray(s), x);
1150
1150
  r._names.focus = Te(s, 0, y), h.current = Ie(h.current, x.map(ue)), g(E), F(E), r._setFieldArray(s, E, Ie, {
1151
1151
  argA: Ne(f)
1152
1152
  });
1153
- }, I = (f) => {
1153
+ }, N = (f) => {
1154
1154
  const y = Be(r._getFieldArray(s), f);
1155
1155
  h.current = Be(h.current, f), g(y), F(y), !Array.isArray(m(r._fields, s)) && R(r._fields, s, void 0), r._setFieldArray(s, y, Be, {
1156
1156
  argA: f
1157
1157
  });
1158
- }, k = (f, y, x) => {
1158
+ }, w = (f, y, x) => {
1159
1159
  const E = z(U(y)), Z = Le(r._getFieldArray(s), f, E);
1160
1160
  r._names.focus = Te(s, f, x), h.current = Le(h.current, f, E.map(ue)), g(Z), F(Z), r._setFieldArray(s, Z, Le, {
1161
1161
  argA: f,
1162
1162
  argB: Ne(y)
1163
1163
  });
1164
- }, B = (f, y) => {
1164
+ }, L = (f, y) => {
1165
1165
  const x = r._getFieldArray(s);
1166
1166
  Pe(x, f, y), Pe(h.current, f, y), g(x), F(x), r._setFieldArray(s, x, Pe, {
1167
1167
  argA: f,
1168
1168
  argB: y
1169
1169
  }, !1);
1170
- }, j = (f, y) => {
1170
+ }, $ = (f, y) => {
1171
1171
  const x = r._getFieldArray(s);
1172
1172
  Me(x, f, y), Me(h.current, f, y), g(x), F(x), r._setFieldArray(s, x, Me, {
1173
1173
  argA: f,
@@ -1175,11 +1175,11 @@ function vt(e) {
1175
1175
  }, !1);
1176
1176
  }, S = (f, y) => {
1177
1177
  const x = U(y), E = Vr(r._getFieldArray(s), f, x);
1178
- h.current = [...E].map((Z, W) => !Z || W === f ? ue() : h.current[W]), g(E), F([...E]), r._setFieldArray(s, E, Vr, {
1178
+ h.current = [...E].map((Z, H) => !Z || H === f ? ue() : h.current[H]), g(E), F([...E]), r._setFieldArray(s, E, Vr, {
1179
1179
  argA: f,
1180
1180
  argB: x
1181
1181
  }, !0, !1);
1182
- }, P = (f) => {
1182
+ }, W = (f) => {
1183
1183
  const y = z(U(f));
1184
1184
  h.current = y.map(ue), g([...y]), F([...y]), r._setFieldArray(s, [...y], (x) => x, {}, !0, !1);
1185
1185
  };
@@ -1190,13 +1190,13 @@ function vt(e) {
1190
1190
  if (r._options.resolver)
1191
1191
  r._runSchema([s]).then((f) => {
1192
1192
  const y = m(f.errors, s), x = m(r._formState.errors, s);
1193
- (x ? !y && x.type || y && (x.type !== y.type || x.message !== y.message) : y && y.type) && (y ? R(r._formState.errors, s, y) : L(r._formState.errors, s), r._subjects.state.next({
1193
+ (x ? !y && x.type || y && (x.type !== y.type || x.message !== y.message) : y && y.type) && (y ? R(r._formState.errors, s, y) : I(r._formState.errors, s), r._subjects.state.next({
1194
1194
  errors: r._formState.errors
1195
1195
  }));
1196
1196
  });
1197
1197
  else {
1198
1198
  const f = m(r._fields, s);
1199
- f && f._f && !(ye(r._options.reValidateMode).isOnSubmit && ye(r._options.mode).isOnSubmit) && Ge(f, r._names.disabled, r._formValues, r._options.criteriaMode === X.all, r._options.shouldUseNativeValidation, !0).then((y) => !$(y) && r._subjects.state.next({
1199
+ f && f._f && !(ye(r._options.reValidateMode).isOnSubmit && ye(r._options.mode).isOnSubmit) && Ge(f, r._names.disabled, r._formValues, r._options.criteriaMode === X.all, r._options.shouldUseNativeValidation, !0).then((y) => !q(y) && r._subjects.state.next({
1200
1200
  errors: Or(r._formState.errors, y, s)
1201
1201
  }));
1202
1202
  }
@@ -1214,14 +1214,14 @@ function vt(e) {
1214
1214
  };
1215
1215
  r._options.shouldUnregister || i ? r.unregister(s) : f(s, !1);
1216
1216
  }), [s, r, u, i]), {
1217
- swap: b.useCallback(B, [g, s, r]),
1218
- move: b.useCallback(j, [g, s, r]),
1219
- prepend: b.useCallback(H, [g, s, r]),
1217
+ swap: b.useCallback(L, [g, s, r]),
1218
+ move: b.useCallback($, [g, s, r]),
1219
+ prepend: b.useCallback(P, [g, s, r]),
1220
1220
  append: b.useCallback(A, [g, s, r]),
1221
- remove: b.useCallback(I, [g, s, r]),
1222
- insert: b.useCallback(k, [g, s, r]),
1221
+ remove: b.useCallback(N, [g, s, r]),
1222
+ insert: b.useCallback(w, [g, s, r]),
1223
1223
  update: b.useCallback(S, [g, s, r]),
1224
- replace: b.useCallback(P, [g, s, r]),
1224
+ replace: b.useCallback(W, [g, s, r]),
1225
1225
  fields: b.useMemo(() => c.map((f, y) => ({
1226
1226
  ...f,
1227
1227
  [u]: h.current[y] || ue()
@@ -1295,7 +1295,7 @@ function Vt(e = {}) {
1295
1295
  i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
1296
1296
  }), t.current.formState = xr(s, i), t.current;
1297
1297
  }
1298
- const Tr = Qr(void 0), Ft = ({ showAsterisk: e, children: t }) => /* @__PURE__ */ ae(Tr.Provider, { value: { showAsterisk: e }, children: t }), bt = () => {
1298
+ const Tr = Qr(void 0), bt = ({ showAsterisk: e, children: t }) => /* @__PURE__ */ ae(Tr.Provider, { value: { showAsterisk: e }, children: t }), Ft = () => {
1299
1299
  const e = Gr(Tr);
1300
1300
  if (!e)
1301
1301
  throw new Error("useSuprFormContext must be used within a SuprFormProvider");
@@ -1356,7 +1356,7 @@ const Tr = Qr(void 0), Ft = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1356
1356
  shouldFocusError: !0,
1357
1357
  ...i
1358
1358
  });
1359
- return Fr(
1359
+ return br(
1360
1360
  c,
1361
1361
  () => ({
1362
1362
  setValue: h.setValue,
@@ -1377,7 +1377,7 @@ const Tr = Qr(void 0), Ft = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1377
1377
  F == null || F(g);
1378
1378
  });
1379
1379
  return () => V.unsubscribe();
1380
- }, [h.watch]), /* @__PURE__ */ ae(Ft, { showAsterisk: l, children: /* @__PURE__ */ ae(Zr, { ...h, children: /* @__PURE__ */ ae(
1380
+ }, [h.watch]), /* @__PURE__ */ ae(bt, { showAsterisk: l, children: /* @__PURE__ */ ae(Zr, { ...h, children: /* @__PURE__ */ ae(
1381
1381
  "form",
1382
1382
  {
1383
1383
  noValidate: !0,
@@ -1398,7 +1398,7 @@ const Tr = Qr(void 0), Ft = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1398
1398
  shouldUnregister: c,
1399
1399
  visibility: F
1400
1400
  }) => {
1401
- const { control: h } = _e(), V = e.props.value ?? "", { showAsterisk: g } = bt(), A = e.props.onChange, H = e.props.onBlur, I = We(() => i || crypto.randomUUID(), []), k = /* @__PURE__ */ ae(
1401
+ const { control: h } = _e(), V = e.props.value ?? "", { showAsterisk: g } = Ft(), A = e.props.onChange, P = e.props.onBlur, N = We(() => i || crypto.randomUUID(), []), w = /* @__PURE__ */ ae(
1402
1402
  tt,
1403
1403
  {
1404
1404
  control: h,
@@ -1407,27 +1407,27 @@ const Tr = Qr(void 0), Ft = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1407
1407
  defaultValue: V,
1408
1408
  disabled: l,
1409
1409
  shouldUnregister: c,
1410
- render: ({ field: { name: B, onBlur: j, value: S, onChange: P, ref: f }, fieldState: { error: y } }) => /* @__PURE__ */ cr(
1410
+ render: ({ field: { name: L, onBlur: $, value: S, onChange: W, ref: f }, fieldState: { error: y } }) => /* @__PURE__ */ cr(
1411
1411
  "div",
1412
1412
  {
1413
1413
  className: `controlled-field ${s}`,
1414
1414
  style: { display: "flex", flexDirection: "column", gap: "5px" },
1415
1415
  children: [
1416
- u && /* @__PURE__ */ cr("label", { htmlFor: I, className: "controlled-field-label", children: [
1416
+ u && /* @__PURE__ */ cr("label", { htmlFor: N, className: "controlled-field-label", children: [
1417
1417
  u,
1418
1418
  g && !!r && /* @__PURE__ */ ae("span", { style: { color: "red" }, children: " *" })
1419
1419
  ] }),
1420
1420
  He(e, {
1421
1421
  ...e.props,
1422
- id: I,
1423
- name: B,
1422
+ id: N,
1423
+ name: L,
1424
1424
  disabled: l,
1425
1425
  onChange: (...x) => {
1426
- P(...x), A == null || A(...x);
1426
+ W(...x), A == null || A(...x);
1427
1427
  },
1428
1428
  value: S,
1429
1429
  onBlur: (...x) => {
1430
- j(), H == null || H(...x);
1430
+ $(), P == null || P(...x);
1431
1431
  },
1432
1432
  ref: f
1433
1433
  }),
@@ -1437,40 +1437,54 @@ const Tr = Qr(void 0), Ft = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1437
1437
  )
1438
1438
  }
1439
1439
  );
1440
- return F ? /* @__PURE__ */ ae(At, { visibility: F, children: k }) : k;
1441
- }, pt = ({ name: e, rules: t, ref: r, children: s }) => {
1442
- const u = vt({
1440
+ return F ? /* @__PURE__ */ ae(At, { visibility: F, children: w }) : w;
1441
+ }, pt = ({
1442
+ name: e,
1443
+ rules: t,
1444
+ ref: r,
1445
+ children: s,
1446
+ visibility: u
1447
+ }) => {
1448
+ const i = vt({
1443
1449
  name: e,
1444
1450
  rules: t
1445
1451
  });
1446
- Fr(r, () => u, [u]);
1447
- const i = (l, c) => Kr.map(l, (F) => {
1448
- if (!Yr(F))
1449
- return F;
1450
- const h = F.props, V = F.type;
1451
- if (((V == null ? void 0 : V.displayName) === "SuprFormControl" || V === Ze || h.name !== void 0 && typeof V != "string") && h.name !== void 0) {
1452
- const A = {
1453
- ...h,
1454
- name: `${c}${h.name}`
1452
+ br(r, () => i, [i]);
1453
+ const l = (c, F) => Kr.map(c, (h) => {
1454
+ var P;
1455
+ if (!Yr(h))
1456
+ return h;
1457
+ const V = h.props, g = h.type;
1458
+ if (((g == null ? void 0 : g.displayName) === "SuprFormControl" || g === Ze || V.name !== void 0 && typeof g != "string") && V.name !== void 0) {
1459
+ const N = u ? u[V.name] : void 0, w = N ? {
1460
+ ...N,
1461
+ conditions: ((P = N.conditions) == null ? void 0 : P.map(($) => ({
1462
+ ...$,
1463
+ name: `${F}${$.name}`
1464
+ }))) || []
1465
+ } : void 0, L = {
1466
+ ...V,
1467
+ name: `${F}${V.name}`,
1468
+ visibility: w
1455
1469
  };
1456
- return h.id !== void 0 && (A.id = `${c}${h.id}`), He(F, A);
1470
+ return V.id !== void 0 && (L.id = `${F}${V.id}`), He(h, L);
1457
1471
  }
1458
- return h.children ? He(F, {
1459
- ...h,
1460
- children: i(h.children, c)
1461
- }) : F;
1472
+ return V.children ? He(h, {
1473
+ ...V,
1474
+ children: l(V.children, F)
1475
+ }) : h;
1462
1476
  });
1463
- return /* @__PURE__ */ ae(jr, { children: u.fields.map((l, c) => {
1464
- const F = `${e}.${c}.`;
1477
+ return /* @__PURE__ */ ae(jr, { children: i.fields.map((c, F) => {
1478
+ const h = `${e}.${F}.`;
1465
1479
  return /* @__PURE__ */ ae(
1466
1480
  "div",
1467
1481
  {
1468
- "data-index": c,
1482
+ "data-index": F,
1469
1483
  style: { display: "contents" },
1470
1484
  id: "field-array-item",
1471
- children: i(s, F)
1485
+ children: l(s, h)
1472
1486
  },
1473
- F
1487
+ h
1474
1488
  );
1475
1489
  }) });
1476
1490
  };