autoforma 2.7.0 → 2.8.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.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import k, { useMemo as he, createContext as Mt, useContext as Bt, useState as $t, useEffect as Ce, useRef as Wt, useImperativeHandle as Yt } from "react";
1
+ import R, { useMemo as he, createContext as Bt, useContext as $t, useState as Wt, useEffect as Ce, useRef as xt, useImperativeHandle as Yt } from "react";
2
2
  var De = { exports: {} }, Ae = {};
3
3
  /**
4
4
  * @license React
@@ -15,8 +15,8 @@ function qt() {
15
15
  it = 1;
16
16
  var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
17
17
  function t(n, o, i) {
18
- var u = null;
19
- if (i !== void 0 && (u = "" + i), o.key !== void 0 && (u = "" + o.key), "key" in o) {
18
+ var l = null;
19
+ if (i !== void 0 && (l = "" + i), o.key !== void 0 && (l = "" + o.key), "key" in o) {
20
20
  i = {};
21
21
  for (var f in o)
22
22
  f !== "key" && (i[f] = o[f]);
@@ -24,7 +24,7 @@ function qt() {
24
24
  return o = i.ref, {
25
25
  $$typeof: e,
26
26
  type: n,
27
- key: u,
27
+ key: l,
28
28
  ref: o !== void 0 ? o : null,
29
29
  props: i
30
30
  };
@@ -50,15 +50,15 @@ function zt() {
50
50
  return c.$$typeof === ge ? null : c.displayName || c.name || null;
51
51
  if (typeof c == "string") return c;
52
52
  switch (c) {
53
- case B:
53
+ case z:
54
54
  return "Fragment";
55
- case E:
55
+ case V:
56
56
  return "Profiler";
57
- case $:
57
+ case U:
58
58
  return "StrictMode";
59
- case X:
59
+ case N:
60
60
  return "Suspense";
61
- case ce:
61
+ case le:
62
62
  return "SuspenseList";
63
63
  case Z:
64
64
  return "Activity";
@@ -67,18 +67,18 @@ function zt() {
67
67
  switch (typeof c.tag == "number" && console.error(
68
68
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
69
  ), c.$$typeof) {
70
- case M:
70
+ case L:
71
71
  return "Portal";
72
- case D:
72
+ case C:
73
73
  return c.displayName || "Context";
74
- case H:
74
+ case J:
75
75
  return (c._context.displayName || "Context") + ".Consumer";
76
- case _:
76
+ case k:
77
77
  var g = c.render;
78
78
  return c = c.displayName, c || (c = g.displayName || g.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c;
79
- case le:
79
+ case re:
80
80
  return g = c.displayName || null, g !== null ? g : e(c.type) || "Memo";
81
- case ie:
81
+ case ae:
82
82
  g = c._payload, c = c._init;
83
83
  try {
84
84
  return e(c(g));
@@ -99,17 +99,17 @@ function zt() {
99
99
  }
100
100
  if (g) {
101
101
  g = console;
102
- var C = g.error, P = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
103
- return C.call(
102
+ var j = g.error, I = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
103
+ return j.call(
104
104
  g,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- P
106
+ I
107
107
  ), r(c);
108
108
  }
109
109
  }
110
110
  function n(c) {
111
- if (c === B) return "<>";
112
- if (typeof c == "object" && c !== null && c.$$typeof === ie)
111
+ if (c === z) return "<>";
112
+ if (typeof c == "object" && c !== null && c.$$typeof === ae)
113
113
  return "<...>";
114
114
  try {
115
115
  var g = e(c);
@@ -119,48 +119,48 @@ function zt() {
119
119
  }
120
120
  }
121
121
  function o() {
122
- var c = x.A;
122
+ var c = _.A;
123
123
  return c === null ? null : c.getOwner();
124
124
  }
125
125
  function i() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
- function u(c) {
129
- if (R.call(c, "key")) {
128
+ function l(c) {
129
+ if (p.call(c, "key")) {
130
130
  var g = Object.getOwnPropertyDescriptor(c, "key").get;
131
131
  if (g && g.isReactWarning) return !1;
132
132
  }
133
133
  return c.key !== void 0;
134
134
  }
135
135
  function f(c, g) {
136
- function C() {
136
+ function j() {
137
137
  Q || (Q = !0, console.error(
138
138
  "%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)",
139
139
  g
140
140
  ));
141
141
  }
142
- C.isReactWarning = !0, Object.defineProperty(c, "key", {
143
- get: C,
142
+ j.isReactWarning = !0, Object.defineProperty(c, "key", {
143
+ get: j,
144
144
  configurable: !0
145
145
  });
146
146
  }
147
- function w() {
147
+ function E() {
148
148
  var c = e(this.type);
149
- return J[c] || (J[c] = !0, console.error(
149
+ return G[c] || (G[c] = !0, console.error(
150
150
  "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."
151
151
  )), c = this.props.ref, c !== void 0 ? c : null;
152
152
  }
153
- function p(c, g, C, P, _e, xe) {
154
- var L = C.ref;
153
+ function w(c, g, j, I, _e, xe) {
154
+ var B = j.ref;
155
155
  return c = {
156
- $$typeof: N,
156
+ $$typeof: O,
157
157
  type: c,
158
158
  key: g,
159
- props: C,
160
- _owner: P
161
- }, (L !== void 0 ? L : null) !== null ? Object.defineProperty(c, "ref", {
159
+ props: j,
160
+ _owner: I
161
+ }, (B !== void 0 ? B : null) !== null ? Object.defineProperty(c, "ref", {
162
162
  enumerable: !1,
163
- get: w
163
+ get: E
164
164
  }) : Object.defineProperty(c, "ref", { enumerable: !1, value: null }), c._store = {}, Object.defineProperty(c._store, "validated", {
165
165
  configurable: !1,
166
166
  enumerable: !1,
@@ -183,91 +183,91 @@ function zt() {
183
183
  value: xe
184
184
  }), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
185
185
  }
186
- function O(c, g, C, P, _e, xe) {
187
- var L = g.children;
188
- if (L !== void 0)
189
- if (P)
190
- if (I(L)) {
191
- for (P = 0; P < L.length; P++)
192
- V(L[P]);
193
- Object.freeze && Object.freeze(L);
186
+ function T(c, g, j, I, _e, xe) {
187
+ var B = g.children;
188
+ if (B !== void 0)
189
+ if (I)
190
+ if (M(B)) {
191
+ for (I = 0; I < B.length; I++)
192
+ x(B[I]);
193
+ Object.freeze && Object.freeze(B);
194
194
  } else
195
195
  console.error(
196
196
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
197
  );
198
- else V(L);
199
- if (R.call(g, "key")) {
200
- L = e(c);
201
- var ae = Object.keys(g).filter(function(we) {
202
- return we !== "key";
198
+ else x(B);
199
+ if (p.call(g, "key")) {
200
+ B = e(c);
201
+ var oe = Object.keys(g).filter(function(Fe) {
202
+ return Fe !== "key";
203
203
  });
204
- P = 0 < ae.length ? "{key: someKey, " + ae.join(": ..., ") + ": ...}" : "{key: someKey}", ye[L + P] || (ae = 0 < ae.length ? "{" + ae.join(": ..., ") + ": ...}" : "{}", console.error(
204
+ I = 0 < oe.length ? "{key: someKey, " + oe.join(": ..., ") + ": ...}" : "{key: someKey}", ye[B + I] || (oe = 0 < oe.length ? "{" + oe.join(": ..., ") + ": ...}" : "{}", console.error(
205
205
  `A props object containing a "key" prop is being spread into JSX:
206
206
  let props = %s;
207
207
  <%s {...props} />
208
208
  React keys must be passed directly to JSX without using spread:
209
209
  let props = %s;
210
210
  <%s key={someKey} {...props} />`,
211
- P,
212
- L,
213
- ae,
214
- L
215
- ), ye[L + P] = !0);
211
+ I,
212
+ B,
213
+ oe,
214
+ B
215
+ ), ye[B + I] = !0);
216
216
  }
217
- if (L = null, C !== void 0 && (t(C), L = "" + C), u(g) && (t(g.key), L = "" + g.key), "key" in g) {
218
- C = {};
217
+ if (B = null, j !== void 0 && (t(j), B = "" + j), l(g) && (t(g.key), B = "" + g.key), "key" in g) {
218
+ j = {};
219
219
  for (var Ee in g)
220
- Ee !== "key" && (C[Ee] = g[Ee]);
221
- } else C = g;
222
- return L && f(
223
- C,
220
+ Ee !== "key" && (j[Ee] = g[Ee]);
221
+ } else j = g;
222
+ return B && f(
223
+ j,
224
224
  typeof c == "function" ? c.displayName || c.name || "Unknown" : c
225
- ), p(
225
+ ), w(
226
226
  c,
227
- L,
228
- C,
227
+ B,
228
+ j,
229
229
  o(),
230
230
  _e,
231
231
  xe
232
232
  );
233
233
  }
234
- function V(c) {
235
- A(c) ? c._store && (c._store.validated = 1) : typeof c == "object" && c !== null && c.$$typeof === ie && (c._payload.status === "fulfilled" ? A(c._payload.value) && c._payload.value._store && (c._payload.value._store.validated = 1) : c._store && (c._store.validated = 1));
234
+ function x(c) {
235
+ F(c) ? c._store && (c._store.validated = 1) : typeof c == "object" && c !== null && c.$$typeof === ae && (c._payload.status === "fulfilled" ? F(c._payload.value) && c._payload.value._store && (c._payload.value._store.validated = 1) : c._store && (c._store.validated = 1));
236
236
  }
237
- function A(c) {
238
- return typeof c == "object" && c !== null && c.$$typeof === N;
237
+ function F(c) {
238
+ return typeof c == "object" && c !== null && c.$$typeof === O;
239
239
  }
240
- var v = k, N = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), B = Symbol.for("react.fragment"), $ = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), H = Symbol.for("react.consumer"), D = Symbol.for("react.context"), _ = Symbol.for("react.forward_ref"), X = Symbol.for("react.suspense"), ce = Symbol.for("react.suspense_list"), le = Symbol.for("react.memo"), ie = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), ge = Symbol.for("react.client.reference"), x = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, R = Object.prototype.hasOwnProperty, I = Array.isArray, W = console.createTask ? console.createTask : function() {
240
+ var b = R, O = Symbol.for("react.transitional.element"), L = Symbol.for("react.portal"), z = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), V = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), C = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), N = Symbol.for("react.suspense"), le = Symbol.for("react.suspense_list"), re = Symbol.for("react.memo"), ae = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), ge = Symbol.for("react.client.reference"), _ = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, p = Object.prototype.hasOwnProperty, M = Array.isArray, W = console.createTask ? console.createTask : function() {
241
241
  return null;
242
242
  };
243
- v = {
243
+ b = {
244
244
  react_stack_bottom_frame: function(c) {
245
245
  return c();
246
246
  }
247
247
  };
248
- var Q, J = {}, fe = v.react_stack_bottom_frame.bind(
249
- v,
248
+ var Q, G = {}, fe = b.react_stack_bottom_frame.bind(
249
+ b,
250
250
  i
251
251
  )(), de = W(n(i)), ye = {};
252
- pe.Fragment = B, pe.jsx = function(c, g, C) {
253
- var P = 1e4 > x.recentlyCreatedOwnerStacks++;
254
- return O(
252
+ pe.Fragment = z, pe.jsx = function(c, g, j) {
253
+ var I = 1e4 > _.recentlyCreatedOwnerStacks++;
254
+ return T(
255
255
  c,
256
256
  g,
257
- C,
257
+ j,
258
258
  !1,
259
- P ? Error("react-stack-top-frame") : fe,
260
- P ? W(n(c)) : de
259
+ I ? Error("react-stack-top-frame") : fe,
260
+ I ? W(n(c)) : de
261
261
  );
262
- }, pe.jsxs = function(c, g, C) {
263
- var P = 1e4 > x.recentlyCreatedOwnerStacks++;
264
- return O(
262
+ }, pe.jsxs = function(c, g, j) {
263
+ var I = 1e4 > _.recentlyCreatedOwnerStacks++;
264
+ return T(
265
265
  c,
266
266
  g,
267
- C,
267
+ j,
268
268
  !0,
269
- P ? Error("react-stack-top-frame") : fe,
270
- P ? W(n(c)) : de
269
+ I ? Error("react-stack-top-frame") : fe,
270
+ I ? W(n(c)) : de
271
271
  );
272
272
  };
273
273
  })()), pe;
@@ -276,13 +276,13 @@ var ot;
276
276
  function Ht() {
277
277
  return ot || (ot = 1, process.env.NODE_ENV === "production" ? De.exports = qt() : De.exports = zt()), De.exports;
278
278
  }
279
- var F = Ht(), Te = (e) => e.type === "checkbox", ve = (e) => e instanceof Date, K = (e) => e == null;
280
- const xt = (e) => typeof e == "object";
281
- var q = (e) => !K(e) && !Array.isArray(e) && xt(e) && !ve(e), Jt = (e) => q(e) && e.target ? Te(e.target) ? e.target.checked : e.target.value : e, Gt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Xt = (e, r) => e.has(Gt(r)), Zt = (e) => {
279
+ var A = Ht(), Te = (e) => e.type === "checkbox", ve = (e) => e instanceof Date, K = (e) => e == null;
280
+ const Et = (e) => typeof e == "object";
281
+ var q = (e) => !K(e) && !Array.isArray(e) && Et(e) && !ve(e), Jt = (e) => q(e) && e.target ? Te(e.target) ? e.target.checked : e.target.value : e, Gt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Xt = (e, r) => e.has(Gt(r)), Zt = (e) => {
282
282
  const r = e.constructor && e.constructor.prototype;
283
283
  return q(r) && r.hasOwnProperty("isPrototypeOf");
284
284
  }, ze = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
285
- function z(e) {
285
+ function H(e) {
286
286
  if (e instanceof Date)
287
287
  return new Date(e);
288
288
  const r = typeof FileList < "u" && e instanceof FileList;
@@ -293,39 +293,39 @@ function z(e) {
293
293
  return e;
294
294
  const n = t ? [] : Object.create(Object.getPrototypeOf(e));
295
295
  for (const o in e)
296
- Object.prototype.hasOwnProperty.call(e, o) && (n[o] = z(e[o]));
296
+ Object.prototype.hasOwnProperty.call(e, o) && (n[o] = H(e[o]));
297
297
  return n;
298
298
  }
299
- var Le = (e) => /^\w*$/.test(e), U = (e) => e === void 0, He = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Je = (e) => He(e.replace(/["|']|\]/g, "").split(/\.|\[/)), h = (e, r, t) => {
299
+ var Le = (e) => /^\w*$/.test(e), $ = (e) => e === void 0, He = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Je = (e) => He(e.replace(/["|']|\]/g, "").split(/\.|\[/)), h = (e, r, t) => {
300
300
  if (!r || !q(e))
301
301
  return t;
302
302
  const n = (Le(r) ? [r] : Je(r)).reduce((o, i) => K(o) ? o : o[i], e);
303
- return U(n) || n === e ? U(e[r]) ? t : e[r] : n;
304
- }, oe = (e) => typeof e == "boolean", re = (e) => typeof e == "function", j = (e, r, t) => {
303
+ return $(n) || n === e ? $(e[r]) ? t : e[r] : n;
304
+ }, ue = (e) => typeof e == "boolean", se = (e) => typeof e == "function", P = (e, r, t) => {
305
305
  let n = -1;
306
- const o = Le(r) ? [r] : Je(r), i = o.length, u = i - 1;
306
+ const o = Le(r) ? [r] : Je(r), i = o.length, l = i - 1;
307
307
  for (; ++n < i; ) {
308
308
  const f = o[n];
309
- let w = t;
310
- if (n !== u) {
311
- const p = e[f];
312
- w = q(p) || Array.isArray(p) ? p : isNaN(+o[n + 1]) ? {} : [];
309
+ let E = t;
310
+ if (n !== l) {
311
+ const w = e[f];
312
+ E = q(w) || Array.isArray(w) ? w : isNaN(+o[n + 1]) ? {} : [];
313
313
  }
314
314
  if (f === "__proto__" || f === "constructor" || f === "prototype")
315
315
  return;
316
- e[f] = w, e = e[f];
316
+ e[f] = E, e = e[f];
317
317
  }
318
318
  };
319
- const lt = {
319
+ const ut = {
320
320
  BLUR: "blur",
321
321
  FOCUS_OUT: "focusout"
322
- }, se = {
322
+ }, ne = {
323
323
  onBlur: "onBlur",
324
324
  onChange: "onChange",
325
325
  onSubmit: "onSubmit",
326
326
  onTouched: "onTouched",
327
327
  all: "all"
328
- }, ue = {
328
+ }, ce = {
329
329
  max: "max",
330
330
  min: "min",
331
331
  maxLength: "maxLength",
@@ -333,11 +333,11 @@ const lt = {
333
333
  pattern: "pattern",
334
334
  required: "required",
335
335
  validate: "validate"
336
- }, Ge = k.createContext(null);
336
+ }, Ge = R.createContext(null);
337
337
  Ge.displayName = "HookFormContext";
338
- const be = () => k.useContext(Ge), Qt = (e) => {
338
+ const be = () => R.useContext(Ge), Qt = (e) => {
339
339
  const { children: r, ...t } = e;
340
- return k.createElement(Ge.Provider, { value: t }, r);
340
+ return R.createElement(Ge.Provider, { value: t }, r);
341
341
  };
342
342
  var Kt = (e, r, t, n = !0) => {
343
343
  const o = {
@@ -346,15 +346,15 @@ var Kt = (e, r, t, n = !0) => {
346
346
  for (const i in e)
347
347
  Object.defineProperty(o, i, {
348
348
  get: () => {
349
- const u = i;
350
- return r._proxyFormState[u] !== se.all && (r._proxyFormState[u] = !n || se.all), e[u];
349
+ const l = i;
350
+ return r._proxyFormState[l] !== ne.all && (r._proxyFormState[l] = !n || ne.all), e[l];
351
351
  }
352
352
  });
353
353
  return o;
354
354
  };
355
- const Et = typeof window < "u" ? k.useLayoutEffect : k.useEffect;
356
- var ee = (e) => typeof e == "string", We = (e, r, t, n, o) => ee(e) ? (n && r.watch.add(e), h(t, e, o)) : Array.isArray(e) ? e.map((i) => (n && r.watch.add(i), h(t, i))) : (n && (r.watchAll = !0), t), Ye = (e) => K(e) || !xt(e);
357
- function ne(e, r, t = /* @__PURE__ */ new WeakSet()) {
355
+ const Vt = typeof window < "u" ? R.useLayoutEffect : R.useEffect;
356
+ var ee = (e) => typeof e == "string", We = (e, r, t, n, o) => ee(e) ? (n && r.watch.add(e), h(t, e, o)) : Array.isArray(e) ? e.map((i) => (n && r.watch.add(i), h(t, i))) : (n && (r.watchAll = !0), t), Ye = (e) => K(e) || !Et(e);
357
+ function ie(e, r, t = /* @__PURE__ */ new WeakSet()) {
358
358
  if (Ye(e) || Ye(r))
359
359
  return Object.is(e, r);
360
360
  if (ve(e) && ve(r))
@@ -366,53 +366,53 @@ function ne(e, r, t = /* @__PURE__ */ new WeakSet()) {
366
366
  return !0;
367
367
  t.add(e), t.add(r);
368
368
  for (const i of n) {
369
- const u = e[i];
369
+ const l = e[i];
370
370
  if (!o.includes(i))
371
371
  return !1;
372
372
  if (i !== "ref") {
373
373
  const f = r[i];
374
- if (ve(u) && ve(f) || q(u) && q(f) || Array.isArray(u) && Array.isArray(f) ? !ne(u, f, t) : !Object.is(u, f))
374
+ if (ve(l) && ve(f) || q(l) && q(f) || Array.isArray(l) && Array.isArray(f) ? !ie(l, f, t) : !Object.is(l, f))
375
375
  return !1;
376
376
  }
377
377
  }
378
378
  return !0;
379
379
  }
380
- function Xe(e) {
381
- const r = be(), { control: t = r.control, name: n, defaultValue: o, disabled: i, exact: u, compute: f } = e || {}, w = k.useRef(o), p = k.useRef(f), O = k.useRef(void 0), V = k.useRef(t), A = k.useRef(n);
382
- p.current = f;
383
- const [v, N] = k.useState(() => {
384
- const D = t._getWatch(n, w.current);
385
- return p.current ? p.current(D) : D;
386
- }), M = k.useCallback((D) => {
387
- const _ = We(n, t._names, D || t._formValues, !1, w.current);
388
- return p.current ? p.current(_) : _;
389
- }, [t._formValues, t._names, n]), B = k.useCallback((D) => {
380
+ function wt(e) {
381
+ const r = be(), { control: t = r.control, name: n, defaultValue: o, disabled: i, exact: l, compute: f } = e || {}, E = R.useRef(o), w = R.useRef(f), T = R.useRef(void 0), x = R.useRef(t), F = R.useRef(n);
382
+ w.current = f;
383
+ const [b, O] = R.useState(() => {
384
+ const C = t._getWatch(n, E.current);
385
+ return w.current ? w.current(C) : C;
386
+ }), L = R.useCallback((C) => {
387
+ const k = We(n, t._names, C || t._formValues, !1, E.current);
388
+ return w.current ? w.current(k) : k;
389
+ }, [t._formValues, t._names, n]), z = R.useCallback((C) => {
390
390
  if (!i) {
391
- const _ = We(n, t._names, D || t._formValues, !1, w.current);
392
- if (p.current) {
393
- const X = p.current(_);
394
- ne(X, O.current) || (N(X), O.current = X);
391
+ const k = We(n, t._names, C || t._formValues, !1, E.current);
392
+ if (w.current) {
393
+ const N = w.current(k);
394
+ ie(N, T.current) || (O(N), T.current = N);
395
395
  } else
396
- N(_);
396
+ O(k);
397
397
  }
398
398
  }, [t._formValues, t._names, i, n]);
399
- Et(() => ((V.current !== t || !ne(A.current, n)) && (V.current = t, A.current = n, B()), t._subscribe({
399
+ Vt(() => ((x.current !== t || !ie(F.current, n)) && (x.current = t, F.current = n, z()), t._subscribe({
400
400
  name: n,
401
401
  formState: {
402
402
  values: !0
403
403
  },
404
- exact: u,
405
- callback: (D) => {
406
- B(D.values);
404
+ exact: l,
405
+ callback: (C) => {
406
+ z(C.values);
407
407
  }
408
- })), [t, u, n, B]), k.useEffect(() => t._removeUnmounted());
409
- const $ = V.current !== t, E = A.current, H = k.useMemo(() => {
408
+ })), [t, l, n, z]), R.useEffect(() => t._removeUnmounted());
409
+ const U = x.current !== t, V = F.current, J = R.useMemo(() => {
410
410
  if (i)
411
411
  return null;
412
- const D = !$ && !ne(E, n);
413
- return $ || D ? M() : null;
414
- }, [i, $, n, E, M]);
415
- return H !== null ? H : v;
412
+ const C = !U && !ie(V, n);
413
+ return U || C ? L() : null;
414
+ }, [i, U, n, V, L]);
415
+ return J !== null ? J : b;
416
416
  }
417
417
  var er = (e, r, t, n, o) => r ? {
418
418
  ...t[e],
@@ -420,7 +420,7 @@ var er = (e, r, t, n, o) => r ? {
420
420
  ...t[e] && t[e].types ? t[e].types : {},
421
421
  [n]: o || !0
422
422
  }
423
- } : {}, ke = (e) => Array.isArray(e) ? e : [e], ut = () => {
423
+ } : {}, ke = (e) => Array.isArray(e) ? e : [e], lt = () => {
424
424
  let e = [];
425
425
  return {
426
426
  get observers() {
@@ -440,66 +440,66 @@ var er = (e, r, t, n, o) => r ? {
440
440
  }
441
441
  };
442
442
  };
443
- function Vt(e, r) {
443
+ function Ft(e, r) {
444
444
  const t = {};
445
445
  for (const n in e)
446
446
  if (e.hasOwnProperty(n)) {
447
447
  const o = e[n], i = r[n];
448
448
  if (o && q(o) && i) {
449
- const u = Vt(o, i);
450
- q(u) && (t[n] = u);
449
+ const l = Ft(o, i);
450
+ q(l) && (t[n] = l);
451
451
  } else e[n] && (t[n] = i);
452
452
  }
453
453
  return t;
454
454
  }
455
- var G = (e) => q(e) && !Object.keys(e).length, Ze = (e) => e.type === "file", je = (e) => {
455
+ var X = (e) => q(e) && !Object.keys(e).length, Xe = (e) => e.type === "file", je = (e) => {
456
456
  if (!ze)
457
457
  return !1;
458
458
  const r = e ? e.ownerDocument : 0;
459
459
  return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
460
- }, Ft = (e) => e.type === "select-multiple", Qe = (e) => e.type === "radio", tr = (e) => Qe(e) || Te(e), $e = (e) => je(e) && e.isConnected;
460
+ }, At = (e) => e.type === "select-multiple", Ze = (e) => e.type === "radio", tr = (e) => Ze(e) || Te(e), $e = (e) => je(e) && e.isConnected;
461
461
  function rr(e, r) {
462
462
  const t = r.slice(0, -1).length;
463
463
  let n = 0;
464
464
  for (; n < t; )
465
- e = U(e) ? n++ : e[r[n++]];
465
+ e = $(e) ? n++ : e[r[n++]];
466
466
  return e;
467
467
  }
468
468
  function sr(e) {
469
469
  for (const r in e)
470
- if (e.hasOwnProperty(r) && !U(e[r]))
470
+ if (e.hasOwnProperty(r) && !$(e[r]))
471
471
  return !1;
472
472
  return !0;
473
473
  }
474
474
  function Y(e, r) {
475
475
  const t = Array.isArray(r) ? r : Le(r) ? [r] : Je(r), n = t.length === 1 ? e : rr(e, t), o = t.length - 1, i = t[o];
476
- return n && delete n[i], o !== 0 && (q(n) && G(n) || Array.isArray(n) && sr(n)) && Y(e, t.slice(0, -1)), e;
476
+ return n && delete n[i], o !== 0 && (q(n) && X(n) || Array.isArray(n) && sr(n)) && Y(e, t.slice(0, -1)), e;
477
477
  }
478
478
  var nr = (e) => {
479
479
  for (const r in e)
480
- if (re(e[r]))
480
+ if (se(e[r]))
481
481
  return !0;
482
482
  return !1;
483
483
  };
484
- function wt(e) {
484
+ function pt(e) {
485
485
  return Array.isArray(e) || q(e) && !nr(e);
486
486
  }
487
487
  function qe(e, r = {}) {
488
488
  for (const t in e) {
489
489
  const n = e[t];
490
- wt(n) ? (r[t] = Array.isArray(n) ? [] : {}, qe(n, r[t])) : U(n) || (r[t] = !0);
490
+ pt(n) ? (r[t] = Array.isArray(n) ? [] : {}, qe(n, r[t])) : $(n) || (r[t] = !0);
491
491
  }
492
492
  return r;
493
493
  }
494
- function Fe(e, r, t) {
494
+ function we(e, r, t) {
495
495
  t || (t = qe(r));
496
496
  for (const n in e) {
497
497
  const o = e[n];
498
- if (wt(o))
499
- U(r) || Ye(t[n]) ? t[n] = qe(o, Array.isArray(o) ? [] : {}) : Fe(o, K(r) ? {} : r[n], t[n]);
498
+ if (pt(o))
499
+ $(r) || Ye(t[n]) ? t[n] = qe(o, Array.isArray(o) ? [] : {}) : we(o, K(r) ? {} : r[n], t[n]);
500
500
  else {
501
501
  const i = r[n];
502
- t[n] = !ne(o, i);
502
+ t[n] = !ie(o, i);
503
503
  }
504
504
  }
505
505
  return t;
@@ -508,7 +508,7 @@ const ct = {
508
508
  value: !1,
509
509
  isValid: !1
510
510
  }, ft = { value: !0, isValid: !0 };
511
- var At = (e) => {
511
+ var Rt = (e) => {
512
512
  if (Array.isArray(e)) {
513
513
  if (e.length > 1) {
514
514
  const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
@@ -516,28 +516,28 @@ var At = (e) => {
516
516
  }
517
517
  return e[0].checked && !e[0].disabled ? (
518
518
  // @ts-expect-error expected to work in the browser
519
- e[0].attributes && !U(e[0].attributes.value) ? U(e[0].value) || e[0].value === "" ? ft : { value: e[0].value, isValid: !0 } : ft
519
+ e[0].attributes && !$(e[0].attributes.value) ? $(e[0].value) || e[0].value === "" ? ft : { value: e[0].value, isValid: !0 } : ft
520
520
  ) : ct;
521
521
  }
522
522
  return ct;
523
- }, pt = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => U(e) ? e : r ? e === "" ? NaN : e && +e : t && ee(e) ? new Date(e) : n ? n(e) : e;
523
+ }, kt = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => $(e) ? e : r ? e === "" ? NaN : e && +e : t && ee(e) ? new Date(e) : n ? n(e) : e;
524
524
  const dt = {
525
525
  isValid: !1,
526
526
  value: null
527
527
  };
528
- var Rt = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
528
+ var St = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
529
529
  isValid: !0,
530
530
  value: t.value
531
531
  } : r, dt) : dt;
532
532
  function yt(e) {
533
533
  const r = e.ref;
534
- return Ze(r) ? r.files : Qe(r) ? Rt(e.refs).value : Ft(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Te(r) ? At(e.refs).value : pt(U(r.value) ? e.ref.value : r.value, e);
534
+ return Xe(r) ? r.files : Ze(r) ? St(e.refs).value : At(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Te(r) ? Rt(e.refs).value : kt($(r.value) ? e.ref.value : r.value, e);
535
535
  }
536
536
  var ir = (e, r, t, n) => {
537
537
  const o = {};
538
538
  for (const i of e) {
539
- const u = h(r, i);
540
- u && j(o, i, u._f);
539
+ const l = h(r, i);
540
+ l && P(o, i, l._f);
541
541
  }
542
542
  return {
543
543
  criteriaMode: t,
@@ -545,24 +545,24 @@ var ir = (e, r, t, n) => {
545
545
  fields: o,
546
546
  shouldUseNativeValidation: n
547
547
  };
548
- }, Pe = (e) => e instanceof RegExp, Re = (e) => U(e) ? e : Pe(e) ? e.source : q(e) ? Pe(e.value) ? e.value.source : e.value : e, mt = (e) => ({
549
- isOnSubmit: !e || e === se.onSubmit,
550
- isOnBlur: e === se.onBlur,
551
- isOnChange: e === se.onChange,
552
- isOnAll: e === se.all,
553
- isOnTouch: e === se.onTouched
548
+ }, Pe = (e) => e instanceof RegExp, Re = (e) => $(e) ? e : Pe(e) ? e.source : q(e) ? Pe(e.value) ? e.value.source : e.value : e, mt = (e) => ({
549
+ isOnSubmit: !e || e === ne.onSubmit,
550
+ isOnBlur: e === ne.onBlur,
551
+ isOnChange: e === ne.onChange,
552
+ isOnAll: e === ne.all,
553
+ isOnTouch: e === ne.onTouched
554
554
  });
555
555
  const ht = "AsyncFunction";
556
- var ar = (e) => !!e && !!e.validate && !!(re(e.validate) && e.validate.constructor.name === ht || q(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === ht)), or = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), vt = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
556
+ var ar = (e) => !!e && !!e.validate && !!(se(e.validate) && e.validate.constructor.name === ht || q(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === ht)), or = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), vt = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
557
557
  const Se = (e, r, t, n) => {
558
558
  for (const o of t || Object.keys(e)) {
559
559
  const i = h(e, o);
560
560
  if (i) {
561
- const { _f: u, ...f } = i;
562
- if (u) {
563
- if (u.refs && u.refs[0] && r(u.refs[0], o) && !n)
561
+ const { _f: l, ...f } = i;
562
+ if (l) {
563
+ if (l.refs && l.refs[0] && r(l.refs[0], o) && !n)
564
564
  return !0;
565
- if (u.ref && r(u.ref, u.name) && !n)
565
+ if (l.ref && r(l.ref, l.name) && !n)
566
566
  return !0;
567
567
  if (Se(f, r))
568
568
  break;
@@ -580,8 +580,8 @@ function bt(e, r, t) {
580
580
  };
581
581
  const o = t.split(".");
582
582
  for (; o.length; ) {
583
- const i = o.join("."), u = h(r, i), f = h(e, i);
584
- if (u && !Array.isArray(u) && t !== i)
583
+ const i = o.join("."), l = h(r, i), f = h(e, i);
584
+ if (l && !Array.isArray(l) && t !== i)
585
585
  return { name: t };
586
586
  if (f && f.type)
587
587
  return {
@@ -599,16 +599,16 @@ function bt(e, r, t) {
599
599
  name: t
600
600
  };
601
601
  }
602
- var lr = (e, r, t, n) => {
602
+ var ur = (e, r, t, n) => {
603
603
  t(e);
604
604
  const { name: o, ...i } = e;
605
- return G(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((u) => r[u] === (!n || se.all));
606
- }, ur = (e, r, t) => !e || !r || e === r || ke(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), cr = (e, r, t, n, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(r || e) : (t ? n.isOnBlur : o.isOnBlur) ? !e : (t ? n.isOnChange : o.isOnChange) ? e : !0, fr = (e, r) => !He(h(e, r)).length && Y(e, r), dr = (e, r, t) => {
605
+ return X(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((l) => r[l] === (!n || ne.all));
606
+ }, lr = (e, r, t) => !e || !r || e === r || ke(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), cr = (e, r, t, n, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(r || e) : (t ? n.isOnBlur : o.isOnBlur) ? !e : (t ? n.isOnChange : o.isOnChange) ? e : !0, fr = (e, r) => !He(h(e, r)).length && Y(e, r), dr = (e, r, t) => {
607
607
  const n = ke(h(e, t));
608
- return j(n, "root", r[t]), j(e, t, n), e;
608
+ return P(n, "root", r[t]), P(e, t, n), e;
609
609
  };
610
610
  function gt(e, r, t = "validate") {
611
- if (ee(e) || Array.isArray(e) && e.every(ee) || oe(e) && !e)
611
+ if (ee(e) || Array.isArray(e) && e.every(ee) || ue(e) && !e)
612
612
  return {
613
613
  type: t,
614
614
  message: ee(e) ? e : "",
@@ -619,89 +619,89 @@ var Ve = (e) => q(e) && !Pe(e) ? e : {
619
619
  value: e,
620
620
  message: ""
621
621
  }, _t = async (e, r, t, n, o, i) => {
622
- const { ref: u, refs: f, required: w, maxLength: p, minLength: O, min: V, max: A, pattern: v, validate: N, name: M, valueAsNumber: B, mount: $ } = e._f, E = h(t, M);
623
- if (!$ || r.has(M))
622
+ const { ref: l, refs: f, required: E, maxLength: w, minLength: T, min: x, max: F, pattern: b, validate: O, name: L, valueAsNumber: z, mount: U } = e._f, V = h(t, L);
623
+ if (!U || r.has(L))
624
624
  return {};
625
- const H = f ? f[0] : u, D = (x) => {
626
- o && H.reportValidity && (H.setCustomValidity(oe(x) ? "" : x || ""), H.reportValidity());
627
- }, _ = {}, X = Qe(u), ce = Te(u), le = X || ce, ie = (B || Ze(u)) && U(u.value) && U(E) || je(u) && u.value === "" || E === "" || Array.isArray(E) && !E.length, Z = er.bind(null, M, n, _), ge = (x, R, I, W = ue.maxLength, Q = ue.minLength) => {
628
- const J = x ? R : I;
629
- _[M] = {
630
- type: x ? W : Q,
631
- message: J,
632
- ref: u,
633
- ...Z(x ? W : Q, J)
625
+ const J = f ? f[0] : l, C = (_) => {
626
+ o && J.reportValidity && (J.setCustomValidity(ue(_) ? "" : _ || ""), J.reportValidity());
627
+ }, k = {}, N = Ze(l), le = Te(l), re = N || le, ae = (z || Xe(l)) && $(l.value) && $(V) || je(l) && l.value === "" || V === "" || Array.isArray(V) && !V.length, Z = er.bind(null, L, n, k), ge = (_, p, M, W = ce.maxLength, Q = ce.minLength) => {
628
+ const G = _ ? p : M;
629
+ k[L] = {
630
+ type: _ ? W : Q,
631
+ message: G,
632
+ ref: l,
633
+ ...Z(_ ? W : Q, G)
634
634
  };
635
635
  };
636
- if (i ? !Array.isArray(E) || !E.length : w && (!le && (ie || K(E)) || oe(E) && !E || ce && !At(f).isValid || X && !Rt(f).isValid)) {
637
- const { value: x, message: R } = ee(w) ? { value: !!w, message: w } : Ve(w);
638
- if (x && (_[M] = {
639
- type: ue.required,
640
- message: R,
641
- ref: H,
642
- ...Z(ue.required, R)
636
+ if (i ? !Array.isArray(V) || !V.length : E && (!re && (ae || K(V)) || ue(V) && !V || le && !Rt(f).isValid || N && !St(f).isValid)) {
637
+ const { value: _, message: p } = ee(E) ? { value: !!E, message: E } : Ve(E);
638
+ if (_ && (k[L] = {
639
+ type: ce.required,
640
+ message: p,
641
+ ref: J,
642
+ ...Z(ce.required, p)
643
643
  }, !n))
644
- return D(R), _;
644
+ return C(p), k;
645
645
  }
646
- if (!ie && (!K(V) || !K(A))) {
647
- let x, R;
648
- const I = Ve(A), W = Ve(V);
649
- if (!K(E) && !isNaN(E)) {
650
- const Q = u.valueAsNumber || E && +E;
651
- K(I.value) || (x = Q > I.value), K(W.value) || (R = Q < W.value);
646
+ if (!ae && (!K(x) || !K(F))) {
647
+ let _, p;
648
+ const M = Ve(F), W = Ve(x);
649
+ if (!K(V) && !isNaN(V)) {
650
+ const Q = l.valueAsNumber || V && +V;
651
+ K(M.value) || (_ = Q > M.value), K(W.value) || (p = Q < W.value);
652
652
  } else {
653
- const Q = u.valueAsDate || new Date(E), J = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), fe = u.type == "time", de = u.type == "week";
654
- ee(I.value) && E && (x = fe ? J(E) > J(I.value) : de ? E > I.value : Q > new Date(I.value)), ee(W.value) && E && (R = fe ? J(E) < J(W.value) : de ? E < W.value : Q < new Date(W.value));
653
+ const Q = l.valueAsDate || new Date(V), G = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), fe = l.type == "time", de = l.type == "week";
654
+ ee(M.value) && V && (_ = fe ? G(V) > G(M.value) : de ? V > M.value : Q > new Date(M.value)), ee(W.value) && V && (p = fe ? G(V) < G(W.value) : de ? V < W.value : Q < new Date(W.value));
655
655
  }
656
- if ((x || R) && (ge(!!x, I.message, W.message, ue.max, ue.min), !n))
657
- return D(_[M].message), _;
656
+ if ((_ || p) && (ge(!!_, M.message, W.message, ce.max, ce.min), !n))
657
+ return C(k[L].message), k;
658
658
  }
659
- if ((p || O) && !ie && (ee(E) || i && Array.isArray(E))) {
660
- const x = Ve(p), R = Ve(O), I = !K(x.value) && E.length > +x.value, W = !K(R.value) && E.length < +R.value;
661
- if ((I || W) && (ge(I, x.message, R.message), !n))
662
- return D(_[M].message), _;
659
+ if ((w || T) && !ae && (ee(V) || i && Array.isArray(V))) {
660
+ const _ = Ve(w), p = Ve(T), M = !K(_.value) && V.length > +_.value, W = !K(p.value) && V.length < +p.value;
661
+ if ((M || W) && (ge(M, _.message, p.message), !n))
662
+ return C(k[L].message), k;
663
663
  }
664
- if (v && !ie && ee(E)) {
665
- const { value: x, message: R } = Ve(v);
666
- if (Pe(x) && !E.match(x) && (_[M] = {
667
- type: ue.pattern,
668
- message: R,
669
- ref: u,
670
- ...Z(ue.pattern, R)
664
+ if (b && !ae && ee(V)) {
665
+ const { value: _, message: p } = Ve(b);
666
+ if (Pe(_) && !V.match(_) && (k[L] = {
667
+ type: ce.pattern,
668
+ message: p,
669
+ ref: l,
670
+ ...Z(ce.pattern, p)
671
671
  }, !n))
672
- return D(R), _;
672
+ return C(p), k;
673
673
  }
674
- if (N) {
675
- if (re(N)) {
676
- const x = await N(E, t), R = gt(x, H);
677
- if (R && (_[M] = {
678
- ...R,
679
- ...Z(ue.validate, R.message)
674
+ if (O) {
675
+ if (se(O)) {
676
+ const _ = await O(V, t), p = gt(_, J);
677
+ if (p && (k[L] = {
678
+ ...p,
679
+ ...Z(ce.validate, p.message)
680
680
  }, !n))
681
- return D(R.message), _;
682
- } else if (q(N)) {
683
- let x = {};
684
- for (const R in N) {
685
- if (!G(x) && !n)
681
+ return C(p.message), k;
682
+ } else if (q(O)) {
683
+ let _ = {};
684
+ for (const p in O) {
685
+ if (!X(_) && !n)
686
686
  break;
687
- const I = gt(await N[R](E, t), H, R);
688
- I && (x = {
689
- ...I,
690
- ...Z(R, I.message)
691
- }, D(I.message), n && (_[M] = x));
687
+ const M = gt(await O[p](V, t), J, p);
688
+ M && (_ = {
689
+ ...M,
690
+ ...Z(p, M.message)
691
+ }, C(M.message), n && (k[L] = _));
692
692
  }
693
- if (!G(x) && (_[M] = {
694
- ref: H,
695
- ...x
693
+ if (!X(_) && (k[L] = {
694
+ ref: J,
695
+ ..._
696
696
  }, !n))
697
- return _;
697
+ return k;
698
698
  }
699
699
  }
700
- return D(!0), _;
700
+ return C(!0), k;
701
701
  };
702
702
  const yr = {
703
- mode: se.onSubmit,
704
- reValidateMode: se.onChange,
703
+ mode: ne.onSubmit,
704
+ reValidateMode: ne.onChange,
705
705
  shouldFocusError: !0
706
706
  };
707
707
  function mr(e = {}) {
@@ -712,7 +712,7 @@ function mr(e = {}) {
712
712
  submitCount: 0,
713
713
  isDirty: !1,
714
714
  isReady: !1,
715
- isLoading: re(r.defaultValues),
715
+ isLoading: se(r.defaultValues),
716
716
  isValidating: !1,
717
717
  isSubmitted: !1,
718
718
  isSubmitting: !1,
@@ -723,7 +723,7 @@ function mr(e = {}) {
723
723
  validatingFields: {},
724
724
  errors: r.errors || {},
725
725
  disabled: r.disabled || !1
726
- }, n = {}, o = q(r.defaultValues) || q(r.values) ? z(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : z(o), u = {
726
+ }, n = {}, o = q(r.defaultValues) || q(r.values) ? H(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : H(o), l = {
727
727
  action: !1,
728
728
  mount: !1,
729
729
  watch: !1,
@@ -734,8 +734,8 @@ function mr(e = {}) {
734
734
  unMount: /* @__PURE__ */ new Set(),
735
735
  array: /* @__PURE__ */ new Set(),
736
736
  watch: /* @__PURE__ */ new Set()
737
- }, w, p = 0;
738
- const O = {
737
+ }, E, w = 0;
738
+ const T = {
739
739
  isDirty: !1,
740
740
  dirtyFields: !1,
741
741
  validatingFields: !1,
@@ -743,289 +743,289 @@ function mr(e = {}) {
743
743
  isValidating: !1,
744
744
  isValid: !1,
745
745
  errors: !1
746
- }, V = {
747
- ...O
746
+ }, x = {
747
+ ...T
748
748
  };
749
- let A = {
750
- ...V
749
+ let F = {
750
+ ...x
751
751
  };
752
- const v = {
753
- array: ut(),
754
- state: ut()
755
- }, N = r.criteriaMode === se.all, M = (s) => (a) => {
756
- clearTimeout(p), p = setTimeout(s, a);
757
- }, B = async (s) => {
758
- if (!u.keepIsValid && !r.disabled && (V.isValid || A.isValid || s)) {
752
+ const b = {
753
+ array: lt(),
754
+ state: lt()
755
+ }, O = r.criteriaMode === ne.all, L = (s) => (a) => {
756
+ clearTimeout(w), w = setTimeout(s, a);
757
+ }, z = async (s) => {
758
+ if (!l.keepIsValid && !r.disabled && (x.isValid || F.isValid || s)) {
759
759
  let a;
760
- r.resolver ? (a = G((await le()).errors), $()) : a = await Z(n, !0), a !== t.isValid && v.state.next({
760
+ r.resolver ? (a = X((await re()).errors), U()) : a = await Z(n, !0), a !== t.isValid && b.state.next({
761
761
  isValid: a
762
762
  });
763
763
  }
764
- }, $ = (s, a) => {
765
- !r.disabled && (V.isValidating || V.validatingFields || A.isValidating || A.validatingFields) && ((s || Array.from(f.mount)).forEach((l) => {
766
- l && (a ? j(t.validatingFields, l, a) : Y(t.validatingFields, l));
767
- }), v.state.next({
764
+ }, U = (s, a) => {
765
+ !r.disabled && (x.isValidating || x.validatingFields || F.isValidating || F.validatingFields) && ((s || Array.from(f.mount)).forEach((u) => {
766
+ u && (a ? P(t.validatingFields, u, a) : Y(t.validatingFields, u));
767
+ }), b.state.next({
768
768
  validatingFields: t.validatingFields,
769
- isValidating: !G(t.validatingFields)
769
+ isValidating: !X(t.validatingFields)
770
770
  }));
771
- }, E = (s, a = [], l, m, y = !0, d = !0) => {
772
- if (m && l && !r.disabled) {
773
- if (u.action = !0, d && Array.isArray(h(n, s))) {
774
- const b = l(h(n, s), m.argA, m.argB);
775
- y && j(n, s, b);
771
+ }, V = (s, a = [], u, m, y = !0, d = !0) => {
772
+ if (m && u && !r.disabled) {
773
+ if (l.action = !0, d && Array.isArray(h(n, s))) {
774
+ const v = u(h(n, s), m.argA, m.argB);
775
+ y && P(n, s, v);
776
776
  }
777
777
  if (d && Array.isArray(h(t.errors, s))) {
778
- const b = l(h(t.errors, s), m.argA, m.argB);
779
- y && j(t.errors, s, b), fr(t.errors, s);
778
+ const v = u(h(t.errors, s), m.argA, m.argB);
779
+ y && P(t.errors, s, v), fr(t.errors, s);
780
780
  }
781
- if ((V.touchedFields || A.touchedFields) && d && Array.isArray(h(t.touchedFields, s))) {
782
- const b = l(h(t.touchedFields, s), m.argA, m.argB);
783
- y && j(t.touchedFields, s, b);
781
+ if ((x.touchedFields || F.touchedFields) && d && Array.isArray(h(t.touchedFields, s))) {
782
+ const v = u(h(t.touchedFields, s), m.argA, m.argB);
783
+ y && P(t.touchedFields, s, v);
784
784
  }
785
- (V.dirtyFields || A.dirtyFields) && (t.dirtyFields = Fe(o, i)), v.state.next({
785
+ (x.dirtyFields || F.dirtyFields) && (t.dirtyFields = we(o, i)), b.state.next({
786
786
  name: s,
787
- isDirty: x(s, a),
787
+ isDirty: _(s, a),
788
788
  dirtyFields: t.dirtyFields,
789
789
  errors: t.errors,
790
790
  isValid: t.isValid
791
791
  });
792
792
  } else
793
- j(i, s, a);
794
- }, H = (s, a) => {
795
- j(t.errors, s, a), v.state.next({
793
+ P(i, s, a);
794
+ }, J = (s, a) => {
795
+ P(t.errors, s, a), b.state.next({
796
796
  errors: t.errors
797
797
  });
798
- }, D = (s) => {
799
- t.errors = s, v.state.next({
798
+ }, C = (s) => {
799
+ t.errors = s, b.state.next({
800
800
  errors: t.errors,
801
801
  isValid: !1
802
802
  });
803
- }, _ = (s, a, l, m) => {
803
+ }, k = (s, a, u, m) => {
804
804
  const y = h(n, s);
805
805
  if (y) {
806
- const d = h(i, s, U(l) ? h(o, s) : l);
807
- U(d) || m && m.defaultChecked || a ? j(i, s, a ? d : yt(y._f)) : W(s, d), u.mount && !u.action && B();
806
+ const d = h(i, s, $(u) ? h(o, s) : u);
807
+ $(d) || m && m.defaultChecked || a ? P(i, s, a ? d : yt(y._f)) : W(s, d), l.mount && !l.action && z();
808
808
  }
809
- }, X = (s, a, l, m, y) => {
810
- let d = !1, b = !1;
809
+ }, N = (s, a, u, m, y) => {
810
+ let d = !1, v = !1;
811
811
  const S = {
812
812
  name: s
813
813
  };
814
814
  if (!r.disabled) {
815
- if (!l || m) {
816
- (V.isDirty || A.isDirty) && (b = t.isDirty, t.isDirty = S.isDirty = x(), d = b !== S.isDirty);
817
- const T = ne(h(o, s), a);
818
- b = !!h(t.dirtyFields, s), T ? Y(t.dirtyFields, s) : j(t.dirtyFields, s, !0), S.dirtyFields = t.dirtyFields, d = d || (V.dirtyFields || A.dirtyFields) && b !== !T;
815
+ if (!u || m) {
816
+ (x.isDirty || F.isDirty) && (v = t.isDirty, t.isDirty = S.isDirty = _(), d = v !== S.isDirty);
817
+ const D = ie(h(o, s), a);
818
+ v = !!h(t.dirtyFields, s), D ? Y(t.dirtyFields, s) : P(t.dirtyFields, s, !0), S.dirtyFields = t.dirtyFields, d = d || (x.dirtyFields || F.dirtyFields) && v !== !D;
819
819
  }
820
- if (l) {
821
- const T = h(t.touchedFields, s);
822
- T || (j(t.touchedFields, s, l), S.touchedFields = t.touchedFields, d = d || (V.touchedFields || A.touchedFields) && T !== l);
820
+ if (u) {
821
+ const D = h(t.touchedFields, s);
822
+ D || (P(t.touchedFields, s, u), S.touchedFields = t.touchedFields, d = d || (x.touchedFields || F.touchedFields) && D !== u);
823
823
  }
824
- d && y && v.state.next(S);
824
+ d && y && b.state.next(S);
825
825
  }
826
826
  return d ? S : {};
827
- }, ce = (s, a, l, m) => {
828
- const y = h(t.errors, s), d = (V.isValid || A.isValid) && oe(a) && t.isValid !== a;
829
- if (r.delayError && l ? (w = M(() => H(s, l)), w(r.delayError)) : (clearTimeout(p), w = null, l ? j(t.errors, s, l) : Y(t.errors, s)), (l ? !ne(y, l) : y) || !G(m) || d) {
830
- const b = {
827
+ }, le = (s, a, u, m) => {
828
+ const y = h(t.errors, s), d = (x.isValid || F.isValid) && ue(a) && t.isValid !== a;
829
+ if (r.delayError && u ? (E = L(() => J(s, u)), E(r.delayError)) : (clearTimeout(w), E = null, u ? P(t.errors, s, u) : Y(t.errors, s)), (u ? !ie(y, u) : y) || !X(m) || d) {
830
+ const v = {
831
831
  ...m,
832
- ...d && oe(a) ? { isValid: a } : {},
832
+ ...d && ue(a) ? { isValid: a } : {},
833
833
  errors: t.errors,
834
834
  name: s
835
835
  };
836
836
  t = {
837
837
  ...t,
838
- ...b
839
- }, v.state.next(b);
838
+ ...v
839
+ }, b.state.next(v);
840
840
  }
841
- }, le = async (s) => ($(s, !0), await r.resolver(i, r.context, ir(s || f.mount, n, r.criteriaMode, r.shouldUseNativeValidation))), ie = async (s) => {
842
- const { errors: a } = await le(s);
843
- if ($(s), s)
844
- for (const l of s) {
845
- const m = h(a, l);
846
- m ? j(t.errors, l, m) : Y(t.errors, l);
841
+ }, re = async (s) => (U(s, !0), await r.resolver(i, r.context, ir(s || f.mount, n, r.criteriaMode, r.shouldUseNativeValidation))), ae = async (s) => {
842
+ const { errors: a } = await re(s);
843
+ if (U(s), s)
844
+ for (const u of s) {
845
+ const m = h(a, u);
846
+ m ? P(t.errors, u, m) : Y(t.errors, u);
847
847
  }
848
848
  else
849
849
  t.errors = a;
850
850
  return a;
851
- }, Z = async (s, a, l = {
851
+ }, Z = async (s, a, u = {
852
852
  valid: !0
853
853
  }) => {
854
854
  for (const m in s) {
855
855
  const y = s[m];
856
856
  if (y) {
857
- const { _f: d, ...b } = y;
857
+ const { _f: d, ...v } = y;
858
858
  if (d) {
859
- const S = f.array.has(d.name), T = y._f && ar(y._f);
860
- T && V.validatingFields && $([d.name], !0);
861
- const te = await _t(y, f.disabled, i, N, r.shouldUseNativeValidation && !a, S);
862
- if (T && V.validatingFields && $([d.name]), te[d.name] && (l.valid = !1, a))
859
+ const S = f.array.has(d.name), D = y._f && ar(y._f);
860
+ D && x.validatingFields && U([d.name], !0);
861
+ const te = await _t(y, f.disabled, i, O, r.shouldUseNativeValidation && !a, S);
862
+ if (D && x.validatingFields && U([d.name]), te[d.name] && (u.valid = !1, a))
863
863
  break;
864
- !a && (h(te, d.name) ? S ? dr(t.errors, te, d.name) : j(t.errors, d.name, te[d.name]) : Y(t.errors, d.name));
864
+ !a && (h(te, d.name) ? S ? dr(t.errors, te, d.name) : P(t.errors, d.name, te[d.name]) : Y(t.errors, d.name));
865
865
  }
866
- !G(b) && await Z(b, a, l);
866
+ !X(v) && await Z(v, a, u);
867
867
  }
868
868
  }
869
- return l.valid;
869
+ return u.valid;
870
870
  }, ge = () => {
871
871
  for (const s of f.unMount) {
872
872
  const a = h(n, s);
873
- a && (a._f.refs ? a._f.refs.every((l) => !$e(l)) : !$e(a._f.ref)) && ae(s);
873
+ a && (a._f.refs ? a._f.refs.every((u) => !$e(u)) : !$e(a._f.ref)) && oe(s);
874
874
  }
875
875
  f.unMount = /* @__PURE__ */ new Set();
876
- }, x = (s, a) => !r.disabled && (s && a && j(i, s, a), !ne(c(), o)), R = (s, a, l) => We(s, f, {
877
- ...u.mount ? i : U(a) ? o : ee(s) ? { [s]: a } : a
878
- }, l, a), I = (s) => He(h(u.mount ? i : o, s, r.shouldUnregister ? h(o, s, []) : [])), W = (s, a, l = {}) => {
876
+ }, _ = (s, a) => !r.disabled && (s && a && P(i, s, a), !ie(c(), o)), p = (s, a, u) => We(s, f, {
877
+ ...l.mount ? i : $(a) ? o : ee(s) ? { [s]: a } : a
878
+ }, u, a), M = (s) => He(h(l.mount ? i : o, s, r.shouldUnregister ? h(o, s, []) : [])), W = (s, a, u = {}) => {
879
879
  const m = h(n, s);
880
880
  let y = a;
881
881
  if (m) {
882
882
  const d = m._f;
883
- d && (!d.disabled && j(i, s, pt(a, d)), y = je(d.ref) && K(a) ? "" : a, Ft(d.ref) ? [...d.ref.options].forEach((b) => b.selected = y.includes(b.value)) : d.refs ? Te(d.ref) ? d.refs.forEach((b) => {
884
- (!b.defaultChecked || !b.disabled) && (Array.isArray(y) ? b.checked = !!y.find((S) => S === b.value) : b.checked = y === b.value || !!y);
885
- }) : d.refs.forEach((b) => b.checked = b.value === y) : Ze(d.ref) ? d.ref.value = "" : (d.ref.value = y, d.ref.type || v.state.next({
883
+ d && (!d.disabled && P(i, s, kt(a, d)), y = je(d.ref) && K(a) ? "" : a, At(d.ref) ? [...d.ref.options].forEach((v) => v.selected = y.includes(v.value)) : d.refs ? Te(d.ref) ? d.refs.forEach((v) => {
884
+ (!v.defaultChecked || !v.disabled) && (Array.isArray(y) ? v.checked = !!y.find((S) => S === v.value) : v.checked = y === v.value || !!y);
885
+ }) : d.refs.forEach((v) => v.checked = v.value === y) : Xe(d.ref) ? d.ref.value = "" : (d.ref.value = y, d.ref.type || b.state.next({
886
886
  name: s,
887
- values: z(i)
887
+ values: H(i)
888
888
  })));
889
889
  }
890
- (l.shouldDirty || l.shouldTouch) && X(s, y, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && ye(s);
891
- }, Q = (s, a, l) => {
890
+ (u.shouldDirty || u.shouldTouch) && N(s, y, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && ye(s);
891
+ }, Q = (s, a, u) => {
892
892
  for (const m in a) {
893
893
  if (!a.hasOwnProperty(m))
894
894
  return;
895
- const y = a[m], d = s + "." + m, b = h(n, d);
896
- (f.array.has(s) || q(y) || b && !b._f) && !ve(y) ? Q(d, y, l) : W(d, y, l);
895
+ const y = a[m], d = s + "." + m, v = h(n, d);
896
+ (f.array.has(s) || q(y) || v && !v._f) && !ve(y) ? Q(d, y, u) : W(d, y, u);
897
897
  }
898
- }, J = (s, a, l = {}) => {
899
- const m = h(n, s), y = f.array.has(s), d = z(a);
900
- j(i, s, d), y ? (v.array.next({
898
+ }, G = (s, a, u = {}) => {
899
+ const m = h(n, s), y = f.array.has(s), d = H(a);
900
+ P(i, s, d), y ? (b.array.next({
901
901
  name: s,
902
- values: z(i)
903
- }), (V.isDirty || V.dirtyFields || A.isDirty || A.dirtyFields) && l.shouldDirty && v.state.next({
902
+ values: H(i)
903
+ }), (x.isDirty || x.dirtyFields || F.isDirty || F.dirtyFields) && u.shouldDirty && b.state.next({
904
904
  name: s,
905
- dirtyFields: Fe(o, i),
906
- isDirty: x(s, d)
907
- })) : m && !m._f && !K(d) ? Q(s, d, l) : W(s, d, l), vt(s, f) && v.state.next({ ...t, name: s }), v.state.next({
908
- name: u.mount ? s : void 0,
909
- values: z(i)
905
+ dirtyFields: we(o, i),
906
+ isDirty: _(s, d)
907
+ })) : m && !m._f && !K(d) ? Q(s, d, u) : W(s, d, u), vt(s, f) && b.state.next({ ...t, name: s }), b.state.next({
908
+ name: l.mount ? s : void 0,
909
+ values: H(i)
910
910
  });
911
911
  }, fe = async (s) => {
912
- u.mount = !0;
912
+ l.mount = !0;
913
913
  const a = s.target;
914
- let l = a.name, m = !0;
915
- const y = h(n, l), d = (T) => {
916
- m = Number.isNaN(T) || ve(T) && isNaN(T.getTime()) || ne(T, h(i, l, T));
917
- }, b = mt(r.mode), S = mt(r.reValidateMode);
914
+ let u = a.name, m = !0;
915
+ const y = h(n, u), d = (D) => {
916
+ m = Number.isNaN(D) || ve(D) && isNaN(D.getTime()) || ie(D, h(i, u, D));
917
+ }, v = mt(r.mode), S = mt(r.reValidateMode);
918
918
  if (y) {
919
- let T, te;
920
- const Oe = a.type ? yt(y._f) : Jt(s), me = s.type === lt.BLUR || s.type === lt.FOCUS_OUT, It = !or(y._f) && !r.resolver && !h(t.errors, l) && !y._f.deps || cr(me, h(t.touchedFields, l), t.isSubmitted, S, b), Me = vt(l, f, me);
921
- j(i, l, Oe), me ? (!a || !a.readOnly) && (y._f.onBlur && y._f.onBlur(s), w && w(0)) : y._f.onChange && y._f.onChange(s);
922
- const Be = X(l, Oe, me), Lt = !G(Be) || Me;
923
- if (!me && v.state.next({
924
- name: l,
919
+ let D, te;
920
+ const Oe = a.type ? yt(y._f) : Jt(s), me = s.type === ut.BLUR || s.type === ut.FOCUS_OUT, Lt = !or(y._f) && !r.resolver && !h(t.errors, u) && !y._f.deps || cr(me, h(t.touchedFields, u), t.isSubmitted, S, v), Me = vt(u, f, me);
921
+ P(i, u, Oe), me ? (!a || !a.readOnly) && (y._f.onBlur && y._f.onBlur(s), E && E(0)) : y._f.onChange && y._f.onChange(s);
922
+ const Be = N(u, Oe, me), Ut = !X(Be) || Me;
923
+ if (!me && b.state.next({
924
+ name: u,
925
925
  type: s.type,
926
- values: z(i)
927
- }), It)
928
- return (V.isValid || A.isValid) && (r.mode === "onBlur" ? me && B() : me || B()), Lt && v.state.next({ name: l, ...Me ? {} : Be });
929
- if (!me && Me && v.state.next({ ...t }), r.resolver) {
930
- const { errors: st } = await le([l]);
931
- if ($([l]), d(Oe), m) {
932
- const Ut = bt(t.errors, n, l), nt = bt(st, n, Ut.name || l);
933
- T = nt.error, l = nt.name, te = G(st);
926
+ values: H(i)
927
+ }), Lt)
928
+ return (x.isValid || F.isValid) && (r.mode === "onBlur" ? me && z() : me || z()), Ut && b.state.next({ name: u, ...Me ? {} : Be });
929
+ if (!me && Me && b.state.next({ ...t }), r.resolver) {
930
+ const { errors: st } = await re([u]);
931
+ if (U([u]), d(Oe), m) {
932
+ const Mt = bt(t.errors, n, u), nt = bt(st, n, Mt.name || u);
933
+ D = nt.error, u = nt.name, te = X(st);
934
934
  }
935
935
  } else
936
- $([l], !0), T = (await _t(y, f.disabled, i, N, r.shouldUseNativeValidation))[l], $([l]), d(Oe), m && (T ? te = !1 : (V.isValid || A.isValid) && (te = await Z(n, !0)));
937
- m && (y._f.deps && (!Array.isArray(y._f.deps) || y._f.deps.length > 0) && ye(y._f.deps), ce(l, te, T, Be));
936
+ U([u], !0), D = (await _t(y, f.disabled, i, O, r.shouldUseNativeValidation))[u], U([u]), d(Oe), m && (D ? te = !1 : (x.isValid || F.isValid) && (te = await Z(n, !0)));
937
+ m && (y._f.deps && (!Array.isArray(y._f.deps) || y._f.deps.length > 0) && ye(y._f.deps), le(u, te, D, Be));
938
938
  }
939
939
  }, de = (s, a) => {
940
940
  if (h(t.errors, a) && s.focus)
941
941
  return s.focus(), 1;
942
942
  }, ye = async (s, a = {}) => {
943
- let l, m;
943
+ let u, m;
944
944
  const y = ke(s);
945
945
  if (r.resolver) {
946
- const d = await ie(U(s) ? s : y);
947
- l = G(d), m = s ? !y.some((b) => h(d, b)) : l;
946
+ const d = await ae($(s) ? s : y);
947
+ u = X(d), m = s ? !y.some((v) => h(d, v)) : u;
948
948
  } else s ? (m = (await Promise.all(y.map(async (d) => {
949
- const b = h(n, d);
950
- return await Z(b && b._f ? { [d]: b } : b);
951
- }))).every(Boolean), !(!m && !t.isValid) && B()) : m = l = await Z(n);
952
- return v.state.next({
953
- ...!ee(s) || (V.isValid || A.isValid) && l !== t.isValid ? {} : { name: s },
954
- ...r.resolver || !s ? { isValid: l } : {},
949
+ const v = h(n, d);
950
+ return await Z(v && v._f ? { [d]: v } : v);
951
+ }))).every(Boolean), !(!m && !t.isValid) && z()) : m = u = await Z(n);
952
+ return b.state.next({
953
+ ...!ee(s) || (x.isValid || F.isValid) && u !== t.isValid ? {} : { name: s },
954
+ ...r.resolver || !s ? { isValid: u } : {},
955
955
  errors: t.errors
956
956
  }), a.shouldFocus && !m && Se(n, de, s ? y : f.mount), m;
957
957
  }, c = (s, a) => {
958
- let l = {
959
- ...u.mount ? i : o
958
+ let u = {
959
+ ...l.mount ? i : o
960
960
  };
961
- return a && (l = Vt(a.dirtyFields ? t.dirtyFields : t.touchedFields, l)), U(s) ? l : ee(s) ? h(l, s) : s.map((m) => h(l, m));
961
+ return a && (u = Ft(a.dirtyFields ? t.dirtyFields : t.touchedFields, u)), $(s) ? u : ee(s) ? h(u, s) : s.map((m) => h(u, m));
962
962
  }, g = (s, a) => ({
963
963
  invalid: !!h((a || t).errors, s),
964
964
  isDirty: !!h((a || t).dirtyFields, s),
965
965
  error: h((a || t).errors, s),
966
966
  isValidating: !!h(t.validatingFields, s),
967
967
  isTouched: !!h((a || t).touchedFields, s)
968
- }), C = (s) => {
969
- s && ke(s).forEach((a) => Y(t.errors, a)), v.state.next({
968
+ }), j = (s) => {
969
+ s && ke(s).forEach((a) => Y(t.errors, a)), b.state.next({
970
970
  errors: s ? t.errors : {}
971
971
  });
972
- }, P = (s, a, l) => {
973
- const m = (h(n, s, { _f: {} })._f || {}).ref, y = h(t.errors, s) || {}, { ref: d, message: b, type: S, ...T } = y;
974
- j(t.errors, s, {
975
- ...T,
972
+ }, I = (s, a, u) => {
973
+ const m = (h(n, s, { _f: {} })._f || {}).ref, y = h(t.errors, s) || {}, { ref: d, message: v, type: S, ...D } = y;
974
+ P(t.errors, s, {
975
+ ...D,
976
976
  ...a,
977
977
  ref: m
978
- }), v.state.next({
978
+ }), b.state.next({
979
979
  name: s,
980
980
  errors: t.errors,
981
981
  isValid: !1
982
- }), l && l.shouldFocus && m && m.focus && m.focus();
983
- }, _e = (s, a) => re(s) ? v.state.subscribe({
984
- next: (l) => "values" in l && s(R(void 0, a), l)
985
- }) : R(s, a, !0), xe = (s) => v.state.subscribe({
982
+ }), u && u.shouldFocus && m && m.focus && m.focus();
983
+ }, _e = (s, a) => se(s) ? b.state.subscribe({
984
+ next: (u) => "values" in u && s(p(void 0, a), u)
985
+ }) : p(s, a, !0), xe = (s) => b.state.subscribe({
986
986
  next: (a) => {
987
- ur(s.name, a.name, s.exact) && lr(a, s.formState || V, Nt, s.reRenderRoot) && s.callback({
987
+ lr(s.name, a.name, s.exact) && ur(a, s.formState || x, It, s.reRenderRoot) && s.callback({
988
988
  values: { ...i },
989
989
  ...t,
990
990
  ...a,
991
991
  defaultValues: o
992
992
  });
993
993
  }
994
- }).unsubscribe, L = (s) => (u.mount = !0, A = {
995
- ...A,
994
+ }).unsubscribe, B = (s) => (l.mount = !0, F = {
995
+ ...F,
996
996
  ...s.formState
997
997
  }, xe({
998
998
  ...s,
999
999
  formState: {
1000
- ...O,
1000
+ ...T,
1001
1001
  ...s.formState
1002
1002
  }
1003
- })), ae = (s, a = {}) => {
1004
- for (const l of s ? ke(s) : f.mount)
1005
- f.mount.delete(l), f.array.delete(l), a.keepValue || (Y(n, l), Y(i, l)), !a.keepError && Y(t.errors, l), !a.keepDirty && Y(t.dirtyFields, l), !a.keepTouched && Y(t.touchedFields, l), !a.keepIsValidating && Y(t.validatingFields, l), !r.shouldUnregister && !a.keepDefaultValue && Y(o, l);
1006
- v.state.next({
1007
- values: z(i)
1008
- }), v.state.next({
1003
+ })), oe = (s, a = {}) => {
1004
+ for (const u of s ? ke(s) : f.mount)
1005
+ f.mount.delete(u), f.array.delete(u), a.keepValue || (Y(n, u), Y(i, u)), !a.keepError && Y(t.errors, u), !a.keepDirty && Y(t.dirtyFields, u), !a.keepTouched && Y(t.touchedFields, u), !a.keepIsValidating && Y(t.validatingFields, u), !r.shouldUnregister && !a.keepDefaultValue && Y(o, u);
1006
+ b.state.next({
1007
+ values: H(i)
1008
+ }), b.state.next({
1009
1009
  ...t,
1010
- ...a.keepDirty ? { isDirty: x() } : {}
1011
- }), !a.keepIsValid && B();
1010
+ ...a.keepDirty ? { isDirty: _() } : {}
1011
+ }), !a.keepIsValid && z();
1012
1012
  }, Ee = ({ disabled: s, name: a }) => {
1013
- (oe(s) && u.mount || s || f.disabled.has(a)) && (s ? f.disabled.add(a) : f.disabled.delete(a));
1014
- }, we = (s, a = {}) => {
1015
- let l = h(n, s);
1016
- const m = oe(a.disabled) || oe(r.disabled);
1017
- return j(n, s, {
1018
- ...l || {},
1013
+ (ue(s) && l.mount || s || f.disabled.has(a)) && (s ? f.disabled.add(a) : f.disabled.delete(a));
1014
+ }, Fe = (s, a = {}) => {
1015
+ let u = h(n, s);
1016
+ const m = ue(a.disabled) || ue(r.disabled);
1017
+ return P(n, s, {
1018
+ ...u || {},
1019
1019
  _f: {
1020
- ...l && l._f ? l._f : { ref: { name: s } },
1020
+ ...u && u._f ? u._f : { ref: { name: s } },
1021
1021
  name: s,
1022
1022
  mount: !0,
1023
1023
  ...a
1024
1024
  }
1025
- }), f.mount.add(s), l ? Ee({
1026
- disabled: oe(a.disabled) ? a.disabled : r.disabled,
1025
+ }), f.mount.add(s), u ? Ee({
1026
+ disabled: ue(a.disabled) ? a.disabled : r.disabled,
1027
1027
  name: s
1028
- }) : _(s, !0, a.value), {
1028
+ }) : k(s, !0, a.value), {
1029
1029
  ...m ? { disabled: a.disabled || r.disabled } : {},
1030
1030
  ...r.progressive ? {
1031
1031
  required: !!a.required,
@@ -1040,14 +1040,14 @@ function mr(e = {}) {
1040
1040
  onBlur: fe,
1041
1041
  ref: (y) => {
1042
1042
  if (y) {
1043
- we(s, a), l = h(n, s);
1044
- const d = U(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, b = tr(d), S = l._f.refs || [];
1045
- if (b ? S.find((T) => T === d) : d === l._f.ref)
1043
+ Fe(s, a), u = h(n, s);
1044
+ const d = $(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, v = tr(d), S = u._f.refs || [];
1045
+ if (v ? S.find((D) => D === d) : d === u._f.ref)
1046
1046
  return;
1047
- j(n, s, {
1047
+ P(n, s, {
1048
1048
  _f: {
1049
- ...l._f,
1050
- ...b ? {
1049
+ ...u._f,
1050
+ ...v ? {
1051
1051
  refs: [
1052
1052
  ...S.filter($e),
1053
1053
  d,
@@ -1056,71 +1056,71 @@ function mr(e = {}) {
1056
1056
  ref: { type: d.type, name: s }
1057
1057
  } : { ref: d }
1058
1058
  }
1059
- }), _(s, !1, void 0, d);
1059
+ }), k(s, !1, void 0, d);
1060
1060
  } else
1061
- l = h(n, s, {}), l._f && (l._f.mount = !1), (r.shouldUnregister || a.shouldUnregister) && !(Xt(f.array, s) && u.action) && f.unMount.add(s);
1061
+ u = h(n, s, {}), u._f && (u._f.mount = !1), (r.shouldUnregister || a.shouldUnregister) && !(Xt(f.array, s) && l.action) && f.unMount.add(s);
1062
1062
  }
1063
1063
  };
1064
- }, Ue = () => r.shouldFocusError && Se(n, de, f.mount), Ct = (s) => {
1065
- oe(s) && (v.state.next({ disabled: s }), Se(n, (a, l) => {
1066
- const m = h(n, l);
1064
+ }, Ue = () => r.shouldFocusError && Se(n, de, f.mount), jt = (s) => {
1065
+ ue(s) && (b.state.next({ disabled: s }), Se(n, (a, u) => {
1066
+ const m = h(n, u);
1067
1067
  m && (a.disabled = m._f.disabled || s, Array.isArray(m._f.refs) && m._f.refs.forEach((y) => {
1068
1068
  y.disabled = m._f.disabled || s;
1069
1069
  }));
1070
1070
  }, 0, !1));
1071
- }, Ke = (s, a) => async (l) => {
1071
+ }, Ke = (s, a) => async (u) => {
1072
1072
  let m;
1073
- l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
1074
- let y = z(i);
1075
- if (v.state.next({
1073
+ u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
1074
+ let y = H(i);
1075
+ if (b.state.next({
1076
1076
  isSubmitting: !0
1077
1077
  }), r.resolver) {
1078
- const { errors: d, values: b } = await le();
1079
- $(), t.errors = d, y = z(b);
1078
+ const { errors: d, values: v } = await re();
1079
+ U(), t.errors = d, y = H(v);
1080
1080
  } else
1081
1081
  await Z(n);
1082
1082
  if (f.disabled.size)
1083
1083
  for (const d of f.disabled)
1084
1084
  Y(y, d);
1085
- if (Y(t.errors, "root"), G(t.errors)) {
1086
- v.state.next({
1085
+ if (Y(t.errors, "root"), X(t.errors)) {
1086
+ b.state.next({
1087
1087
  errors: {}
1088
1088
  });
1089
1089
  try {
1090
- await s(y, l);
1090
+ await s(y, u);
1091
1091
  } catch (d) {
1092
1092
  m = d;
1093
1093
  }
1094
1094
  } else
1095
- a && await a({ ...t.errors }, l), Ue(), setTimeout(Ue);
1096
- if (v.state.next({
1095
+ a && await a({ ...t.errors }, u), Ue(), setTimeout(Ue);
1096
+ if (b.state.next({
1097
1097
  isSubmitted: !0,
1098
1098
  isSubmitting: !1,
1099
- isSubmitSuccessful: G(t.errors) && !m,
1099
+ isSubmitSuccessful: X(t.errors) && !m,
1100
1100
  submitCount: t.submitCount + 1,
1101
1101
  errors: t.errors
1102
1102
  }), m)
1103
1103
  throw m;
1104
- }, jt = (s, a = {}) => {
1105
- h(n, s) && (U(a.defaultValue) ? J(s, z(h(o, s))) : (J(s, a.defaultValue), j(o, s, z(a.defaultValue))), a.keepTouched || Y(t.touchedFields, s), a.keepDirty || (Y(t.dirtyFields, s), t.isDirty = a.defaultValue ? x(s, z(h(o, s))) : x()), a.keepError || (Y(t.errors, s), V.isValid && B()), v.state.next({ ...t }));
1104
+ }, Pt = (s, a = {}) => {
1105
+ h(n, s) && ($(a.defaultValue) ? G(s, H(h(o, s))) : (G(s, a.defaultValue), P(o, s, H(a.defaultValue))), a.keepTouched || Y(t.touchedFields, s), a.keepDirty || (Y(t.dirtyFields, s), t.isDirty = a.defaultValue ? _(s, H(h(o, s))) : _()), a.keepError || (Y(t.errors, s), x.isValid && z()), b.state.next({ ...t }));
1106
1106
  }, et = (s, a = {}) => {
1107
- const l = s ? z(s) : o, m = z(l), y = G(s), d = y ? o : m;
1108
- if (a.keepDefaultValues || (o = l), !a.keepValues) {
1107
+ const u = s ? H(s) : o, m = H(u), y = X(s), d = y ? o : m;
1108
+ if (a.keepDefaultValues || (o = u), !a.keepValues) {
1109
1109
  if (a.keepDirtyValues) {
1110
- const b = /* @__PURE__ */ new Set([
1110
+ const v = /* @__PURE__ */ new Set([
1111
1111
  ...f.mount,
1112
- ...Object.keys(Fe(o, i))
1112
+ ...Object.keys(we(o, i))
1113
1113
  ]);
1114
- for (const S of Array.from(b))
1115
- h(t.dirtyFields, S) ? j(d, S, h(i, S)) : J(S, h(d, S));
1114
+ for (const S of Array.from(v))
1115
+ h(t.dirtyFields, S) ? P(d, S, h(i, S)) : G(S, h(d, S));
1116
1116
  } else {
1117
- if (ze && U(s))
1118
- for (const b of f.mount) {
1119
- const S = h(n, b);
1117
+ if (ze && $(s))
1118
+ for (const v of f.mount) {
1119
+ const S = h(n, v);
1120
1120
  if (S && S._f) {
1121
- const T = Array.isArray(S._f.refs) ? S._f.refs[0] : S._f.ref;
1122
- if (je(T)) {
1123
- const te = T.closest("form");
1121
+ const D = Array.isArray(S._f.refs) ? S._f.refs[0] : S._f.ref;
1122
+ if (je(D)) {
1123
+ const te = D.closest("form");
1124
1124
  if (te) {
1125
1125
  te.reset();
1126
1126
  break;
@@ -1129,14 +1129,14 @@ function mr(e = {}) {
1129
1129
  }
1130
1130
  }
1131
1131
  if (a.keepFieldsRef)
1132
- for (const b of f.mount)
1133
- J(b, h(d, b));
1132
+ for (const v of f.mount)
1133
+ G(v, h(d, v));
1134
1134
  else
1135
1135
  n = {};
1136
1136
  }
1137
- i = r.shouldUnregister ? a.keepDefaultValues ? z(o) : {} : z(d), v.array.next({
1137
+ i = r.shouldUnregister ? a.keepDefaultValues ? H(o) : {} : H(d), b.array.next({
1138
1138
  values: { ...d }
1139
- }), v.state.next({
1139
+ }), b.state.next({
1140
1140
  values: { ...d }
1141
1141
  });
1142
1142
  }
@@ -1148,58 +1148,58 @@ function mr(e = {}) {
1148
1148
  watch: /* @__PURE__ */ new Set(),
1149
1149
  watchAll: !1,
1150
1150
  focus: ""
1151
- }, u.mount = !V.isValid || !!a.keepIsValid || !!a.keepDirtyValues || !r.shouldUnregister && !G(d), u.watch = !!r.shouldUnregister, u.keepIsValid = !!a.keepIsValid, u.action = !1, a.keepErrors || (t.errors = {}), v.state.next({
1151
+ }, l.mount = !x.isValid || !!a.keepIsValid || !!a.keepDirtyValues || !r.shouldUnregister && !X(d), l.watch = !!r.shouldUnregister, l.keepIsValid = !!a.keepIsValid, l.action = !1, a.keepErrors || (t.errors = {}), b.state.next({
1152
1152
  submitCount: a.keepSubmitCount ? t.submitCount : 0,
1153
- isDirty: y ? !1 : a.keepDirty ? t.isDirty : !!(a.keepDefaultValues && !ne(s, o)),
1153
+ isDirty: y ? !1 : a.keepDirty ? t.isDirty : !!(a.keepDefaultValues && !ie(s, o)),
1154
1154
  isSubmitted: a.keepIsSubmitted ? t.isSubmitted : !1,
1155
- dirtyFields: y ? {} : a.keepDirtyValues ? a.keepDefaultValues && i ? Fe(o, i) : t.dirtyFields : a.keepDefaultValues && s ? Fe(o, s) : a.keepDirty ? t.dirtyFields : {},
1155
+ dirtyFields: y ? {} : a.keepDirtyValues ? a.keepDefaultValues && i ? we(o, i) : t.dirtyFields : a.keepDefaultValues && s ? we(o, s) : a.keepDirty ? t.dirtyFields : {},
1156
1156
  touchedFields: a.keepTouched ? t.touchedFields : {},
1157
1157
  errors: a.keepErrors ? t.errors : {},
1158
1158
  isSubmitSuccessful: a.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1159
1159
  isSubmitting: !1,
1160
1160
  defaultValues: o
1161
1161
  });
1162
- }, tt = (s, a) => et(re(s) ? s(i) : s, { ...r.resetOptions, ...a }), Pt = (s, a = {}) => {
1163
- const l = h(n, s), m = l && l._f;
1162
+ }, tt = (s, a) => et(se(s) ? s(i) : s, { ...r.resetOptions, ...a }), Nt = (s, a = {}) => {
1163
+ const u = h(n, s), m = u && u._f;
1164
1164
  if (m) {
1165
1165
  const y = m.refs ? m.refs[0] : m.ref;
1166
1166
  y.focus && setTimeout(() => {
1167
- y.focus(), a.shouldSelect && re(y.select) && y.select();
1167
+ y.focus(), a.shouldSelect && se(y.select) && y.select();
1168
1168
  });
1169
1169
  }
1170
- }, Nt = (s) => {
1170
+ }, It = (s) => {
1171
1171
  t = {
1172
1172
  ...t,
1173
1173
  ...s
1174
1174
  };
1175
1175
  }, rt = {
1176
1176
  control: {
1177
- register: we,
1178
- unregister: ae,
1177
+ register: Fe,
1178
+ unregister: oe,
1179
1179
  getFieldState: g,
1180
1180
  handleSubmit: Ke,
1181
- setError: P,
1181
+ setError: I,
1182
1182
  _subscribe: xe,
1183
- _runSchema: le,
1184
- _updateIsValidating: $,
1183
+ _runSchema: re,
1184
+ _updateIsValidating: U,
1185
1185
  _focusError: Ue,
1186
- _getWatch: R,
1187
- _getDirty: x,
1188
- _setValid: B,
1189
- _setFieldArray: E,
1186
+ _getWatch: p,
1187
+ _getDirty: _,
1188
+ _setValid: z,
1189
+ _setFieldArray: V,
1190
1190
  _setDisabledField: Ee,
1191
- _setErrors: D,
1192
- _getFieldArray: I,
1191
+ _setErrors: C,
1192
+ _getFieldArray: M,
1193
1193
  _reset: et,
1194
- _resetDefaultValues: () => re(r.defaultValues) && r.defaultValues().then((s) => {
1195
- tt(s, r.resetOptions), v.state.next({
1194
+ _resetDefaultValues: () => se(r.defaultValues) && r.defaultValues().then((s) => {
1195
+ tt(s, r.resetOptions), b.state.next({
1196
1196
  isLoading: !1
1197
1197
  });
1198
1198
  }),
1199
1199
  _removeUnmounted: ge,
1200
- _disableForm: Ct,
1201
- _subjects: v,
1202
- _proxyFormState: V,
1200
+ _disableForm: jt,
1201
+ _subjects: b,
1202
+ _proxyFormState: x,
1203
1203
  get _fields() {
1204
1204
  return n;
1205
1205
  },
@@ -1207,10 +1207,10 @@ function mr(e = {}) {
1207
1207
  return i;
1208
1208
  },
1209
1209
  get _state() {
1210
- return u;
1210
+ return l;
1211
1211
  },
1212
1212
  set _state(s) {
1213
- u = s;
1213
+ l = s;
1214
1214
  },
1215
1215
  get _defaultValues() {
1216
1216
  return o;
@@ -1234,19 +1234,19 @@ function mr(e = {}) {
1234
1234
  };
1235
1235
  }
1236
1236
  },
1237
- subscribe: L,
1237
+ subscribe: B,
1238
1238
  trigger: ye,
1239
- register: we,
1239
+ register: Fe,
1240
1240
  handleSubmit: Ke,
1241
1241
  watch: _e,
1242
- setValue: J,
1242
+ setValue: G,
1243
1243
  getValues: c,
1244
1244
  reset: tt,
1245
- resetField: jt,
1246
- clearErrors: C,
1247
- unregister: ae,
1248
- setError: P,
1249
- setFocus: Pt,
1245
+ resetField: Pt,
1246
+ clearErrors: j,
1247
+ unregister: oe,
1248
+ setError: I,
1249
+ setFocus: Nt,
1250
1250
  getFieldState: g
1251
1251
  };
1252
1252
  return {
@@ -1255,10 +1255,10 @@ function mr(e = {}) {
1255
1255
  };
1256
1256
  }
1257
1257
  function hr(e = {}) {
1258
- const r = k.useRef(void 0), t = k.useRef(void 0), [n, o] = k.useState({
1258
+ const r = R.useRef(void 0), t = R.useRef(void 0), [n, o] = R.useState({
1259
1259
  isDirty: !1,
1260
1260
  isValidating: !1,
1261
- isLoading: re(e.defaultValues),
1261
+ isLoading: se(e.defaultValues),
1262
1262
  isSubmitted: !1,
1263
1263
  isSubmitting: !1,
1264
1264
  isSubmitSuccessful: !1,
@@ -1270,24 +1270,24 @@ function hr(e = {}) {
1270
1270
  errors: e.errors || {},
1271
1271
  disabled: e.disabled || !1,
1272
1272
  isReady: !1,
1273
- defaultValues: re(e.defaultValues) ? void 0 : e.defaultValues
1273
+ defaultValues: se(e.defaultValues) ? void 0 : e.defaultValues
1274
1274
  });
1275
1275
  if (!r.current)
1276
1276
  if (e.formControl)
1277
1277
  r.current = {
1278
1278
  ...e.formControl,
1279
1279
  formState: n
1280
- }, e.defaultValues && !re(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
1280
+ }, e.defaultValues && !se(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
1281
1281
  else {
1282
- const { formControl: u, ...f } = mr(e);
1282
+ const { formControl: l, ...f } = mr(e);
1283
1283
  r.current = {
1284
1284
  ...f,
1285
1285
  formState: n
1286
1286
  };
1287
1287
  }
1288
1288
  const i = r.current.control;
1289
- return i._options = e, Et(() => {
1290
- const u = i._subscribe({
1289
+ return i._options = e, Vt(() => {
1290
+ const l = i._subscribe({
1291
1291
  formState: i._proxyFormState,
1292
1292
  callback: () => o({ ...i._formState }),
1293
1293
  reRenderRoot: !0
@@ -1295,33 +1295,33 @@ function hr(e = {}) {
1295
1295
  return o((f) => ({
1296
1296
  ...f,
1297
1297
  isReady: !0
1298
- })), i._formState.isReady = !0, u;
1299
- }, [i]), k.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), k.useEffect(() => {
1298
+ })), i._formState.isReady = !0, l;
1299
+ }, [i]), R.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), R.useEffect(() => {
1300
1300
  e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
1301
- }, [i, e.mode, e.reValidateMode]), k.useEffect(() => {
1301
+ }, [i, e.mode, e.reValidateMode]), R.useEffect(() => {
1302
1302
  e.errors && (i._setErrors(e.errors), i._focusError());
1303
- }, [i, e.errors]), k.useEffect(() => {
1303
+ }, [i, e.errors]), R.useEffect(() => {
1304
1304
  e.shouldUnregister && i._subjects.state.next({
1305
1305
  values: i._getWatch()
1306
1306
  });
1307
- }, [i, e.shouldUnregister]), k.useEffect(() => {
1307
+ }, [i, e.shouldUnregister]), R.useEffect(() => {
1308
1308
  if (i._proxyFormState.isDirty) {
1309
- const u = i._getDirty();
1310
- u !== n.isDirty && i._subjects.state.next({
1311
- isDirty: u
1309
+ const l = i._getDirty();
1310
+ l !== n.isDirty && i._subjects.state.next({
1311
+ isDirty: l
1312
1312
  });
1313
1313
  }
1314
- }, [i, n.isDirty]), k.useEffect(() => {
1315
- var u;
1316
- e.values && !ne(e.values, t.current) ? (i._reset(e.values, {
1314
+ }, [i, n.isDirty]), R.useEffect(() => {
1315
+ var l;
1316
+ e.values && !ie(e.values, t.current) ? (i._reset(e.values, {
1317
1317
  keepFieldsRef: !0,
1318
1318
  ...i._options.resetOptions
1319
- }), !((u = i._options.resetOptions) === null || u === void 0) && u.keepIsValid || i._setValid(), t.current = e.values, o((f) => ({ ...f }))) : i._resetDefaultValues();
1320
- }, [i, e.values]), k.useEffect(() => {
1319
+ }), !((l = i._options.resetOptions) === null || l === void 0) && l.keepIsValid || i._setValid(), t.current = e.values, o((f) => ({ ...f }))) : i._resetDefaultValues();
1320
+ }, [i, e.values]), R.useEffect(() => {
1321
1321
  i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
1322
1322
  }), r.current.formState = Kt(n, i), r.current;
1323
1323
  }
1324
- const kt = Mt(null), vr = ({
1324
+ const Tt = Bt(null), vr = ({
1325
1325
  children: e,
1326
1326
  layout: r = "vertical",
1327
1327
  uiConfig: t,
@@ -1335,33 +1335,33 @@ const kt = Mt(null), vr = ({
1335
1335
  }),
1336
1336
  [r, t, n]
1337
1337
  );
1338
- return /* @__PURE__ */ F.jsx(kt.Provider, { value: o, children: e });
1339
- }, St = () => {
1340
- const e = Bt(kt);
1338
+ return /* @__PURE__ */ A.jsx(Tt.Provider, { value: o, children: e });
1339
+ }, Ot = () => {
1340
+ const e = $t(Tt);
1341
1341
  if (!e)
1342
1342
  throw new Error("useAutoFormRenderContext must be used within AutoFormRenderContextProvider");
1343
1343
  return e;
1344
1344
  }, br = (e) => {
1345
1345
  const { fieldSchema: r } = e, { register: t } = be(), n = t(r.name);
1346
- return /* @__PURE__ */ F.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
1347
- /* @__PURE__ */ F.jsx("label", { children: r.label }),
1348
- /* @__PURE__ */ F.jsx("input", { type: r.type, ...n, readOnly: r.readonly })
1346
+ return /* @__PURE__ */ A.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
1347
+ /* @__PURE__ */ A.jsx("label", { children: r.label }),
1348
+ /* @__PURE__ */ A.jsx("input", { type: r.type, ...n, readOnly: r.readonly })
1349
1349
  ] });
1350
1350
  }, gr = (e) => {
1351
1351
  const { fieldSchema: r } = e, { register: t } = be(), n = t(r.name), o = r.options;
1352
- return /* @__PURE__ */ F.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
1353
- /* @__PURE__ */ F.jsx("label", { children: r.label }),
1354
- /* @__PURE__ */ F.jsx("select", { ...n, disabled: r.readonly, children: o.map((i) => /* @__PURE__ */ F.jsx("option", { value: i.value, children: i.label }, i.value)) })
1352
+ return /* @__PURE__ */ A.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
1353
+ /* @__PURE__ */ A.jsx("label", { children: r.label }),
1354
+ /* @__PURE__ */ A.jsx("select", { ...n, disabled: r.readonly, children: o.map((i) => /* @__PURE__ */ A.jsx("option", { value: i.value, children: i.label }, i.value)) })
1355
1355
  ] });
1356
1356
  };
1357
1357
  function _r(e, r) {
1358
1358
  const t = {};
1359
1359
  return e.forEach((n, o) => {
1360
1360
  const i = n.split(".");
1361
- let u = t;
1362
- i.forEach((f, w) => {
1363
- const p = w === i.length - 1, O = !isNaN(Number(f));
1364
- p ? u[f] = r[o] : (f in u || (u[f] = O ? [] : {}), u = u[f]);
1361
+ let l = t;
1362
+ i.forEach((f, E) => {
1363
+ const w = E === i.length - 1, T = !isNaN(Number(f));
1364
+ w ? l[f] = r[o] : (f in l || (l[f] = T ? [] : {}), l = l[f]);
1365
1365
  });
1366
1366
  }), t;
1367
1367
  }
@@ -1389,7 +1389,7 @@ function xr(e) {
1389
1389
  return null;
1390
1390
  }
1391
1391
  }
1392
- function Tt(e) {
1392
+ function Qe(e) {
1393
1393
  return e.replace(/\.\d+\./g, ".");
1394
1394
  }
1395
1395
  function Er(e, r) {
@@ -1397,10 +1397,10 @@ function Er(e, r) {
1397
1397
  return t.forEach((o, i) => {
1398
1398
  isNaN(Number(o)) || n.push({ pos: i, value: o });
1399
1399
  }), r.map((o) => {
1400
- const u = [...o.split(".")];
1401
- return n.forEach(({ pos: f, value: w }) => {
1402
- f <= u.length && u.splice(f, 0, w);
1403
- }), u.join(".");
1400
+ const l = [...o.split(".")];
1401
+ return n.forEach(({ pos: f, value: E }) => {
1402
+ f <= l.length && l.splice(f, 0, E);
1403
+ }), l.join(".");
1404
1404
  });
1405
1405
  }
1406
1406
  function Ne(e, r = {}) {
@@ -1413,14 +1413,14 @@ function Ne(e, r = {}) {
1413
1413
  t[n.name] = (r == null ? void 0 : r[n.name]) ?? n.initialValue ?? xr(n.type);
1414
1414
  return t;
1415
1415
  }
1416
- function Ot(e) {
1416
+ function Dt(e) {
1417
1417
  return e.map((r) => {
1418
1418
  if (["object", "array"].includes(r.type)) {
1419
1419
  const t = r.fields;
1420
1420
  return {
1421
1421
  ...r,
1422
1422
  readonly: !0,
1423
- fields: Ot(t)
1423
+ fields: Dt(t)
1424
1424
  };
1425
1425
  }
1426
1426
  return {
@@ -1429,40 +1429,40 @@ function Ot(e) {
1429
1429
  };
1430
1430
  });
1431
1431
  }
1432
- const Vr = k.memo((e) => {
1433
- const { baseName: r, index: t, fields: n } = e, o = k.useMemo(
1432
+ const Vr = R.memo((e) => {
1433
+ const { baseName: r, index: t, fields: n } = e, o = R.useMemo(
1434
1434
  () => n.map((i) => ({
1435
1435
  ...i,
1436
1436
  name: `${r}.${t}.${i.name}`
1437
1437
  })),
1438
1438
  [r, t, n]
1439
1439
  );
1440
- return /* @__PURE__ */ F.jsxs("div", { children: [
1441
- /* @__PURE__ */ F.jsxs("div", { children: [
1440
+ return /* @__PURE__ */ A.jsxs("div", { children: [
1441
+ /* @__PURE__ */ A.jsxs("div", { children: [
1442
1442
  "row ",
1443
1443
  t
1444
1444
  ] }),
1445
- /* @__PURE__ */ F.jsx(Ie, { schema: o })
1445
+ /* @__PURE__ */ A.jsx(Ie, { schema: o })
1446
1446
  ] });
1447
- }), Fr = (e) => {
1448
- const { fieldSchema: r } = e, { control: t, getValues: n, setValue: o } = be(), u = Xe({
1447
+ }), wr = (e) => {
1448
+ const { fieldSchema: r } = e, { control: t, getValues: n, setValue: o } = be(), l = wt({
1449
1449
  control: t,
1450
1450
  name: r.name
1451
1451
  }) ?? [], f = () => {
1452
- const p = n(r.name) || [];
1453
- o(r.name, [...p, Ne(r.fields)]);
1454
- }, w = (p) => {
1455
- const V = (n(r.name) || []).filter((A, v) => v !== p);
1456
- o(r.name, V);
1452
+ const w = n(r.name) || [];
1453
+ o(r.name, [...w, Ne(r.fields)]);
1454
+ }, E = (w) => {
1455
+ const x = (n(r.name) || []).filter((F, b) => b !== w);
1456
+ o(r.name, x);
1457
1457
  };
1458
- return /* @__PURE__ */ F.jsxs("div", { children: [
1459
- u.map((p, O) => /* @__PURE__ */ F.jsxs("div", { children: [
1460
- /* @__PURE__ */ F.jsx(Vr, { baseName: r.name, index: O, fields: r.fields }),
1461
- !r.readonly && /* @__PURE__ */ F.jsx("button", { type: "button", onClick: () => w(O), children: "Remove" })
1462
- ] }, O)),
1463
- !r.readonly && /* @__PURE__ */ F.jsx("button", { type: "button", onClick: f, children: "Add Row" })
1458
+ return /* @__PURE__ */ A.jsxs("div", { children: [
1459
+ l.map((w, T) => /* @__PURE__ */ A.jsxs("div", { children: [
1460
+ /* @__PURE__ */ A.jsx(Vr, { baseName: r.name, index: T, fields: r.fields }),
1461
+ !r.readonly && /* @__PURE__ */ A.jsx("button", { type: "button", onClick: () => E(T), children: "Remove" })
1462
+ ] }, T)),
1463
+ !r.readonly && /* @__PURE__ */ A.jsx("button", { type: "button", onClick: f, children: "Add Row" })
1464
1464
  ] });
1465
- }, wr = k.memo(Fr), Ar = (e) => {
1465
+ }, Fr = R.memo(wr), Ar = (e) => {
1466
1466
  const { fieldSchema: r } = e;
1467
1467
  let t = he(
1468
1468
  () => r.fields.map((n) => ({
@@ -1471,7 +1471,7 @@ const Vr = k.memo((e) => {
1471
1471
  })),
1472
1472
  [r.fields]
1473
1473
  );
1474
- return /* @__PURE__ */ F.jsx(Ie, { schema: t });
1474
+ return /* @__PURE__ */ A.jsx(Ie, { schema: t });
1475
1475
  }, pr = [
1476
1476
  "text",
1477
1477
  "number",
@@ -1482,72 +1482,93 @@ const Vr = k.memo((e) => {
1482
1482
  "time",
1483
1483
  "array",
1484
1484
  "object"
1485
- ], Dt = ({ fieldSchema: e }) => {
1486
- var p, O;
1487
- const t = St().uiConfig, { register: n, control: o } = be(), i = Tt(e.name), u = n(e.name), f = (p = t == null ? void 0 : t.renderersByName) == null ? void 0 : p[i];
1485
+ ], Ct = ({ fieldSchema: e }) => {
1486
+ var w, T;
1487
+ const t = Ot().uiConfig, { register: n, control: o } = be(), i = Qe(e.name), l = n(e.name), f = (w = t == null ? void 0 : t.renderersByName) == null ? void 0 : w[i];
1488
1488
  if (f)
1489
- return /* @__PURE__ */ F.jsx(f, { fieldSchema: e, control: o, register: u });
1490
- const w = (O = t == null ? void 0 : t.renderersByType) == null ? void 0 : O[e.type];
1491
- if (w)
1492
- return /* @__PURE__ */ F.jsx(w, { fieldSchema: e, control: o, register: u });
1489
+ return /* @__PURE__ */ A.jsx(f, { fieldSchema: e, control: o, register: l });
1490
+ const E = (T = t == null ? void 0 : t.renderersByType) == null ? void 0 : T[e.type];
1491
+ if (E)
1492
+ return /* @__PURE__ */ A.jsx(E, { fieldSchema: e, control: o, register: l });
1493
1493
  if (pr.includes(e.type))
1494
- return e.type === "select" ? /* @__PURE__ */ F.jsx(gr, { fieldSchema: e }) : e.type === "array" ? /* @__PURE__ */ F.jsx(wr, { fieldSchema: e }) : e.type === "object" ? /* @__PURE__ */ F.jsx(Ar, { fieldSchema: e }) : /* @__PURE__ */ F.jsx(br, { fieldSchema: e });
1494
+ return e.type === "select" ? /* @__PURE__ */ A.jsx(gr, { fieldSchema: e }) : e.type === "array" ? /* @__PURE__ */ A.jsx(Fr, { fieldSchema: e }) : e.type === "object" ? /* @__PURE__ */ A.jsx(Ar, { fieldSchema: e }) : /* @__PURE__ */ A.jsx(br, { fieldSchema: e });
1495
1495
  throw new Error(
1496
1496
  `AutoForm: No renderer found for field "${e.name}" with type "${e.type}". If this is a custom field type, make sure to register a renderer via uiConfig.renderersByType.`
1497
1497
  );
1498
- }, Rr = ({ fieldSchema: e }) => /* @__PURE__ */ F.jsx(Dt, { fieldSchema: e }), kr = ({ fieldSchema: e }) => {
1499
- const { control: r } = be(), t = St(), n = e.dependsOn ?? [], o = he(
1498
+ }, Rr = ({ fieldSchema: e }) => /* @__PURE__ */ A.jsx(Ct, { fieldSchema: e }), kr = ({ fieldSchema: e }) => {
1499
+ const { control: r } = be(), t = Ot(), n = e.dependsOn ?? [], o = he(
1500
1500
  () => Er(e.name, n),
1501
1501
  [e.name, n]
1502
- ), i = Xe({
1502
+ ), i = wt({
1503
1503
  control: r,
1504
1504
  name: o
1505
- }), [u, f] = $t(e);
1505
+ }), [l, f] = Wt(e);
1506
1506
  return Ce(() => {
1507
1507
  if (!n.length) return;
1508
- let w = !1;
1508
+ let E = !1;
1509
1509
  return (async () => {
1510
- var N;
1511
- const O = Tt(e.name), V = _r(o, i ?? []), A = (N = t == null ? void 0 : t.updateFieldSchema) == null ? void 0 : N[O];
1512
- if (!A) return;
1513
- const v = await A(e.name, e, V);
1514
- !w && v && f({
1510
+ var O;
1511
+ const T = Qe(e.name), x = _r(o, i ?? []), F = (O = t == null ? void 0 : t.updateFieldSchema) == null ? void 0 : O[T];
1512
+ if (!F) return;
1513
+ const b = await F(e.name, e, x);
1514
+ !E && b && f({
1515
1515
  ...e,
1516
- ...v
1516
+ ...b
1517
1517
  });
1518
1518
  })(), () => {
1519
- w = !0;
1519
+ E = !0;
1520
1520
  };
1521
- }, [i]), /* @__PURE__ */ F.jsx(Dt, { fieldSchema: u });
1521
+ }, [i]), /* @__PURE__ */ A.jsx(Ct, { fieldSchema: l });
1522
1522
  }, Sr = (e) => {
1523
1523
  var t;
1524
1524
  const { fieldSchema: r } = e;
1525
- return (t = r.dependsOn) != null && t.length ? /* @__PURE__ */ F.jsx(kr, { fieldSchema: r }) : /* @__PURE__ */ F.jsx(Rr, { fieldSchema: r });
1525
+ return (t = r.dependsOn) != null && t.length ? /* @__PURE__ */ A.jsx(kr, { fieldSchema: r }) : /* @__PURE__ */ A.jsx(Rr, { fieldSchema: r });
1526
1526
  }, Tr = (e) => {
1527
1527
  const { fieldSchema: r } = e;
1528
1528
  if (r.visible !== !1)
1529
- return /* @__PURE__ */ F.jsx(Sr, { fieldSchema: r });
1530
- }, Ie = k.memo(
1529
+ return /* @__PURE__ */ A.jsx(Sr, { fieldSchema: r });
1530
+ }, Ie = R.memo(
1531
1531
  (e) => {
1532
1532
  const { schema: r } = e;
1533
- return r.map((t) => /* @__PURE__ */ F.jsx(Tr, { fieldSchema: t }, t.name));
1533
+ return r.map((t) => /* @__PURE__ */ A.jsx(Tr, { fieldSchema: t }, t.name));
1534
1534
  }
1535
- ), Or = (e) => {
1536
- const { onDirtyChange: r, onValuesChange: t } = e, { formState: n, control: o } = be(), i = Xe({
1537
- control: o
1538
- });
1535
+ );
1536
+ function Or(e, r) {
1537
+ const t = (i) => /^\d+$/.test(i), n = e.split(".");
1538
+ let o = r;
1539
+ for (const i of n) {
1540
+ if (o == null) return;
1541
+ const l = t(i) ? Number(i) : i;
1542
+ o = o[l];
1543
+ }
1544
+ return o;
1545
+ }
1546
+ const Dr = (e) => {
1547
+ const { onDirtyChange: r, onValuesChange: t, onFieldChange: n } = e, { formState: o, watch: i } = be(), l = xt(!0);
1539
1548
  return Ce(() => {
1540
- t(i);
1541
- }, [i]), Ce(() => {
1542
- r(n.isDirty);
1543
- }, [n.isDirty]), null;
1544
- }, Dr = ({
1549
+ const f = i((E, { name: w = "" }) => {
1550
+ var F;
1551
+ t(E);
1552
+ const T = Qe(w), x = Or(w, E);
1553
+ (F = n == null ? void 0 : n[T]) == null || F.call(n, w, x, E);
1554
+ });
1555
+ return () => f.unsubscribe();
1556
+ }, [i, t]), Ce(() => {
1557
+ if (l.current) {
1558
+ l.current = !1;
1559
+ return;
1560
+ }
1561
+ r(o.isDirty);
1562
+ }, [o.isDirty, r]), null;
1563
+ }, Cr = ({
1545
1564
  onValuesChange: e,
1546
- onDirtyChange: r
1547
- }) => (Or({
1548
1565
  onDirtyChange: r,
1549
- onValuesChange: e
1550
- }), null), Pr = k.forwardRef(
1566
+ onFieldChange: t
1567
+ }) => (Dr({
1568
+ onDirtyChange: r,
1569
+ onValuesChange: e,
1570
+ onFieldChange: t
1571
+ }), null), Nr = R.forwardRef(
1551
1572
  (e, r) => {
1552
1573
  const {
1553
1574
  schema: t,
@@ -1557,73 +1578,81 @@ const Vr = k.memo((e) => {
1557
1578
  renderersByType: {}
1558
1579
  },
1559
1580
  updateFieldSchema: i = {},
1560
- layout: u = "vertical",
1581
+ layout: l = "vertical",
1561
1582
  values: f = () => ({}),
1562
- hideSubmit: w = !1,
1563
- onDirtyChange: p = () => {
1583
+ hideSubmit: E = !1,
1584
+ onDirtyChange: w = () => {
1564
1585
  },
1565
- onValuesChange: O = () => {
1586
+ onValuesChange: T = () => {
1566
1587
  },
1567
- resolver: V,
1568
- readonly: A
1569
- } = e, v = hr({
1588
+ resolver: x,
1589
+ readonly: F,
1590
+ onFieldChange: b = {}
1591
+ } = e, O = hr({
1570
1592
  reValidateMode: "onSubmit",
1571
1593
  criteriaMode: "all",
1572
- resolver: V
1573
- }), N = Wt(!1), M = v.handleSubmit(n), B = he(() => {
1574
- let _ = t;
1575
- return A && (_ = Ot(_)), _;
1576
- }, [A, t]);
1594
+ resolver: x
1595
+ }), L = xt(!1), z = O.handleSubmit(n), U = he(() => {
1596
+ let N = t;
1597
+ return F && (N = Dt(N)), N;
1598
+ }, [F, t]);
1577
1599
  Ce(() => {
1578
- if (N.current) return;
1579
- let _ = !1;
1600
+ if (L.current) return;
1601
+ let N = !1;
1580
1602
  return (async () => {
1581
- const ce = await f();
1582
- _ || (v.reset(Ne(t, ce)), N.current = !0);
1603
+ const re = await f();
1604
+ N || (O.reset(Ne(t, re)), L.current = !0);
1583
1605
  })(), () => {
1584
- _ = !0;
1606
+ N = !0;
1585
1607
  };
1586
1608
  }, [f, t]), Yt(r, () => ({
1587
1609
  submit: async () => {
1588
- await v.handleSubmit(n)();
1610
+ await O.handleSubmit(n)();
1589
1611
  },
1590
- reset: (_) => {
1591
- v.reset(_ ? Ne(t, _) : void 0);
1612
+ reset: (N) => {
1613
+ O.reset(N ? Ne(t, N) : void 0);
1592
1614
  },
1593
- getValues: () => v.getValues(),
1594
- setValue: (_, X) => {
1595
- v.setValue(_, X);
1615
+ getValues: () => O.getValues(),
1616
+ setValue: (N, le) => {
1617
+ O.setValue(N, le);
1596
1618
  }
1597
1619
  }));
1598
- const $ = w || A, E = he(() => o, [o]), H = he(() => i, [i]), D = he(
1620
+ const V = E || F, J = he(() => o, [o]), C = he(() => i, [i]), k = he(
1599
1621
  () => ({
1600
- layout: u,
1622
+ layout: l,
1601
1623
  uiConfig: o,
1602
1624
  updateFieldSchema: i
1603
1625
  }),
1604
- [u, o, i]
1626
+ [l, o, i]
1605
1627
  );
1606
- return /* @__PURE__ */ F.jsxs(Qt, { ...v, children: [
1607
- /* @__PURE__ */ F.jsx(Dr, { onDirtyChange: p, onValuesChange: O }),
1608
- /* @__PURE__ */ F.jsxs(
1628
+ return /* @__PURE__ */ A.jsxs(Qt, { ...O, children: [
1629
+ /* @__PURE__ */ A.jsx(
1630
+ Cr,
1631
+ {
1632
+ onDirtyChange: w,
1633
+ onValuesChange: T,
1634
+ onFieldChange: b
1635
+ }
1636
+ ),
1637
+ /* @__PURE__ */ A.jsxs(
1609
1638
  vr,
1610
1639
  {
1611
- layout: D.layout,
1612
- uiConfig: E,
1613
- updateFieldSchema: H,
1640
+ layout: k.layout,
1641
+ uiConfig: J,
1642
+ updateFieldSchema: C,
1614
1643
  children: [
1615
- ["vertical", "horizontal"].includes(u) && /* @__PURE__ */ F.jsx(
1644
+ ["vertical", "horizontal"].includes(l) && /* @__PURE__ */ A.jsx(
1616
1645
  "div",
1617
1646
  {
1618
1647
  style: {
1619
1648
  display: "flex",
1620
- flexDirection: u === "vertical" ? "column" : "row"
1649
+ flexDirection: l === "vertical" ? "column" : "row"
1621
1650
  },
1622
- children: /* @__PURE__ */ F.jsx(Ie, { schema: B })
1651
+ children: /* @__PURE__ */ A.jsx(Ie, { schema: U })
1623
1652
  }
1624
1653
  ),
1625
- u === "custom" && /* @__PURE__ */ F.jsx(Ie, { schema: B }),
1626
- !$ && /* @__PURE__ */ F.jsx("button", { style: { marginTop: "1rem" }, onClick: M, children: "Submit" })
1654
+ l === "custom" && /* @__PURE__ */ A.jsx(Ie, { schema: U }),
1655
+ !V && /* @__PURE__ */ A.jsx("button", { style: { marginTop: "1rem" }, onClick: z, children: "Submit" })
1627
1656
  ]
1628
1657
  }
1629
1658
  )
@@ -1631,12 +1660,12 @@ const Vr = k.memo((e) => {
1631
1660
  }
1632
1661
  );
1633
1662
  export {
1634
- Pr as AutoForm,
1663
+ Nr as AutoForm,
1635
1664
  Ie as SchemaRenderer,
1636
1665
  _r as buildNestedPartialValues,
1637
1666
  Ne as generateInitialValues,
1638
1667
  xr as getDefaultValueForField,
1639
- Ot as makeSchemaReadOnly,
1640
- Tt as normalizeFieldPath,
1668
+ Dt as makeSchemaReadOnly,
1669
+ Qe as normalizeFieldPath,
1641
1670
  Er as resolveDependsOnNew
1642
1671
  };