react-simple-formkit 2.2.1 → 2.2.2

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,5 +1,5 @@
1
- import pe, { createContext as ye, useContext as Fe, useEffect as fe, useState as ae, useRef as j, useCallback as a, useMemo as ie, useLayoutEffect as de } from "react";
2
- var ce = { exports: {} }, re = {};
1
+ import ye, { createContext as we, useContext as Fe, useEffect as de, useState as ae, useRef as P, useCallback as d, useMemo as le, useLayoutEffect as be } from "react";
2
+ var ue = { exports: {} }, K = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.js
@@ -9,29 +9,29 @@ var ce = { exports: {} }, re = {};
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
- var be;
12
+ var he;
13
13
  function Te() {
14
- if (be) return re;
15
- be = 1;
16
- var s = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
17
- function i(g, E, h) {
18
- var l = null;
19
- if (h !== void 0 && (l = "" + h), E.key !== void 0 && (l = "" + E.key), "key" in E) {
20
- h = {};
21
- for (var p in E)
22
- p !== "key" && (h[p] = E[p]);
23
- } else h = E;
24
- return E = h.ref, {
25
- $$typeof: s,
26
- type: g,
27
- key: l,
28
- ref: E !== void 0 ? E : null,
29
- props: h
14
+ if (he) return K;
15
+ he = 1;
16
+ var t = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
17
+ function a(l, h, E) {
18
+ var g = null;
19
+ if (E !== void 0 && (g = "" + E), h.key !== void 0 && (g = "" + h.key), "key" in h) {
20
+ E = {};
21
+ for (var R in h)
22
+ R !== "key" && (E[R] = h[R]);
23
+ } else E = h;
24
+ return h = E.ref, {
25
+ $$typeof: t,
26
+ type: l,
27
+ key: g,
28
+ ref: h !== void 0 ? h : null,
29
+ props: E
30
30
  };
31
31
  }
32
- return re.Fragment = n, re.jsx = i, re.jsxs = i, re;
32
+ return K.Fragment = s, K.jsx = a, K.jsxs = a, K;
33
33
  }
34
- var te = {};
34
+ var ee = {};
35
35
  /**
36
36
  * @license React
37
37
  * react-jsx-runtime.development.js
@@ -41,125 +41,125 @@ var te = {};
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
43
  */
44
- var me;
44
+ var Ee;
45
45
  function _e() {
46
- return me || (me = 1, process.env.NODE_ENV !== "production" && function() {
47
- function s(e) {
46
+ return Ee || (Ee = 1, process.env.NODE_ENV !== "production" && function() {
47
+ function t(e) {
48
48
  if (e == null) return null;
49
49
  if (typeof e == "function")
50
- return e.$$typeof === H ? null : e.displayName || e.name || null;
50
+ return e.$$typeof === G ? null : e.displayName || e.name || null;
51
51
  if (typeof e == "string") return e;
52
52
  switch (e) {
53
- case b:
53
+ case f:
54
54
  return "Fragment";
55
- case B:
55
+ case N:
56
56
  return "Profiler";
57
57
  case O:
58
58
  return "StrictMode";
59
- case se:
59
+ case re:
60
60
  return "Suspense";
61
- case ne:
61
+ case te:
62
62
  return "SuspenseList";
63
- case P:
63
+ case j:
64
64
  return "Activity";
65
65
  }
66
66
  if (typeof e == "object")
67
67
  switch (typeof e.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
  ), e.$$typeof) {
70
- case d:
70
+ case b:
71
71
  return "Portal";
72
- case J:
72
+ case ie:
73
73
  return (e.displayName || "Context") + ".Provider";
74
- case $:
74
+ case M:
75
75
  return (e._context.displayName || "Context") + ".Consumer";
76
+ case J:
77
+ var u = e.render;
78
+ return e = e.displayName, e || (e = u.displayName || u.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
+ case ne:
80
+ return u = e.displayName || null, u !== null ? u : t(e.type) || "Memo";
76
81
  case z:
77
- var o = e.render;
78
- return e = e.displayName, e || (e = o.displayName || o.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
- case oe:
80
- return o = e.displayName || null, o !== null ? o : s(e.type) || "Memo";
81
- case G:
82
- o = e._payload, e = e._init;
82
+ u = e._payload, e = e._init;
83
83
  try {
84
- return s(e(o));
84
+ return t(e(u));
85
85
  } catch {
86
86
  }
87
87
  }
88
88
  return null;
89
89
  }
90
- function n(e) {
90
+ function s(e) {
91
91
  return "" + e;
92
92
  }
93
- function i(e) {
93
+ function a(e) {
94
94
  try {
95
- n(e);
96
- var o = !1;
95
+ s(e);
96
+ var u = !1;
97
97
  } catch {
98
- o = !0;
98
+ u = !0;
99
99
  }
100
- if (o) {
101
- o = console;
102
- var S = o.error, F = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
- return S.call(
104
- o,
100
+ if (u) {
101
+ u = console;
102
+ var v = u.error, w = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
+ return v.call(
104
+ u,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- F
107
- ), n(e);
106
+ w
107
+ ), s(e);
108
108
  }
109
109
  }
110
- function g(e) {
111
- if (e === b) return "<>";
112
- if (typeof e == "object" && e !== null && e.$$typeof === G)
110
+ function l(e) {
111
+ if (e === f) return "<>";
112
+ if (typeof e == "object" && e !== null && e.$$typeof === z)
113
113
  return "<...>";
114
114
  try {
115
- var o = s(e);
116
- return o ? "<" + o + ">" : "<...>";
115
+ var u = t(e);
116
+ return u ? "<" + u + ">" : "<...>";
117
117
  } catch {
118
118
  return "<...>";
119
119
  }
120
120
  }
121
- function E() {
122
- var e = V.A;
121
+ function h() {
122
+ var e = W.A;
123
123
  return e === null ? null : e.getOwner();
124
124
  }
125
- function h() {
125
+ function E() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
- function l(e) {
129
- if (M.call(e, "key")) {
130
- var o = Object.getOwnPropertyDescriptor(e, "key").get;
131
- if (o && o.isReactWarning) return !1;
128
+ function g(e) {
129
+ if (Y.call(e, "key")) {
130
+ var u = Object.getOwnPropertyDescriptor(e, "key").get;
131
+ if (u && u.isReactWarning) return !1;
132
132
  }
133
133
  return e.key !== void 0;
134
134
  }
135
- function p(e, o) {
136
- function S() {
137
- X || (X = !0, console.error(
135
+ function R(e, u) {
136
+ function v() {
137
+ H || (H = !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
- o
139
+ u
140
140
  ));
141
141
  }
142
- S.isReactWarning = !0, Object.defineProperty(e, "key", {
143
- get: S,
142
+ v.isReactWarning = !0, Object.defineProperty(e, "key", {
143
+ get: v,
144
144
  configurable: !0
145
145
  });
146
146
  }
147
- function y() {
148
- var e = s(this.type);
149
- return Z[e] || (Z[e] = !0, console.error(
147
+ function p() {
148
+ var e = t(this.type);
149
+ return X[e] || (X[e] = !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
  )), e = this.props.ref, e !== void 0 ? e : null;
152
152
  }
153
- function k(e, o, S, F, C, A, I, L) {
154
- return S = A.ref, e = {
155
- $$typeof: u,
153
+ function _(e, u, v, w, C, A, I, L) {
154
+ return v = A.ref, e = {
155
+ $$typeof: c,
156
156
  type: e,
157
- key: o,
157
+ key: u,
158
158
  props: A,
159
159
  _owner: C
160
- }, (S !== void 0 ? S : null) !== null ? Object.defineProperty(e, "ref", {
160
+ }, (v !== void 0 ? v : null) !== null ? Object.defineProperty(e, "ref", {
161
161
  enumerable: !1,
162
- get: y
162
+ get: p
163
163
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
164
164
  configurable: !1,
165
165
  enumerable: !1,
@@ -182,213 +182,224 @@ function _e() {
182
182
  value: L
183
183
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
184
184
  }
185
- function c(e, o, S, F, C, A, I, L) {
186
- var T = o.children;
187
- if (T !== void 0)
188
- if (F)
189
- if (D(T)) {
190
- for (F = 0; F < T.length; F++)
191
- m(T[F]);
192
- Object.freeze && Object.freeze(T);
185
+ function i(e, u, v, w, C, A, I, L) {
186
+ var F = u.children;
187
+ if (F !== void 0)
188
+ if (w)
189
+ if (D(F)) {
190
+ for (w = 0; w < F.length; w++)
191
+ m(F[w]);
192
+ Object.freeze && Object.freeze(F);
193
193
  } else
194
194
  console.error(
195
195
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
196
196
  );
197
- else m(T);
198
- if (M.call(o, "key")) {
199
- T = s(e);
200
- var N = Object.keys(o).filter(function(ue) {
201
- return ue !== "key";
197
+ else m(F);
198
+ if (Y.call(u, "key")) {
199
+ F = t(e);
200
+ var V = Object.keys(u).filter(function(se) {
201
+ return se !== "key";
202
202
  });
203
- F = 0 < N.length ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}", K[T + F] || (N = 0 < N.length ? "{" + N.join(": ..., ") + ": ...}" : "{}", console.error(
203
+ w = 0 < V.length ? "{key: someKey, " + V.join(": ..., ") + ": ...}" : "{key: someKey}", Q[F + w] || (V = 0 < V.length ? "{" + V.join(": ..., ") + ": ...}" : "{}", console.error(
204
204
  `A props object containing a "key" prop is being spread into JSX:
205
205
  let props = %s;
206
206
  <%s {...props} />
207
207
  React keys must be passed directly to JSX without using spread:
208
208
  let props = %s;
209
209
  <%s key={someKey} {...props} />`,
210
+ w,
210
211
  F,
211
- T,
212
- N,
213
- T
214
- ), K[T + F] = !0);
212
+ V,
213
+ F
214
+ ), Q[F + w] = !0);
215
215
  }
216
- if (T = null, S !== void 0 && (i(S), T = "" + S), l(o) && (i(o.key), T = "" + o.key), "key" in o) {
217
- S = {};
218
- for (var x in o)
219
- x !== "key" && (S[x] = o[x]);
220
- } else S = o;
221
- return T && p(
222
- S,
216
+ if (F = null, v !== void 0 && (a(v), F = "" + v), g(u) && (a(u.key), F = "" + u.key), "key" in u) {
217
+ v = {};
218
+ for (var x in u)
219
+ x !== "key" && (v[x] = u[x]);
220
+ } else v = u;
221
+ return F && R(
222
+ v,
223
223
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
224
- ), k(
224
+ ), _(
225
225
  e,
226
- T,
226
+ F,
227
227
  A,
228
228
  C,
229
- E(),
230
- S,
229
+ h(),
230
+ v,
231
231
  I,
232
232
  L
233
233
  );
234
234
  }
235
235
  function m(e) {
236
- typeof e == "object" && e !== null && e.$$typeof === u && e._store && (e._store.validated = 1);
236
+ typeof e == "object" && e !== null && e.$$typeof === c && e._store && (e._store.validated = 1);
237
237
  }
238
- var f = pe, u = Symbol.for("react.transitional.element"), d = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), B = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), J = Symbol.for("react.context"), z = Symbol.for("react.forward_ref"), se = Symbol.for("react.suspense"), ne = Symbol.for("react.suspense_list"), oe = Symbol.for("react.memo"), G = Symbol.for("react.lazy"), P = Symbol.for("react.activity"), H = Symbol.for("react.client.reference"), V = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, D = Array.isArray, W = console.createTask ? console.createTask : function() {
238
+ var o = ye, c = Symbol.for("react.transitional.element"), b = Symbol.for("react.portal"), f = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), M = Symbol.for("react.consumer"), ie = Symbol.for("react.context"), J = Symbol.for("react.forward_ref"), re = Symbol.for("react.suspense"), te = Symbol.for("react.suspense_list"), ne = Symbol.for("react.memo"), z = Symbol.for("react.lazy"), j = Symbol.for("react.activity"), G = Symbol.for("react.client.reference"), W = o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, D = Array.isArray, $ = console.createTask ? console.createTask : function() {
239
239
  return null;
240
240
  };
241
- f = {
241
+ o = {
242
242
  "react-stack-bottom-frame": function(e) {
243
243
  return e();
244
244
  }
245
245
  };
246
- var X, Z = {}, Q = f["react-stack-bottom-frame"].bind(
247
- f,
248
- h
249
- )(), v = W(g(h)), K = {};
250
- te.Fragment = b, te.jsx = function(e, o, S, F, C) {
251
- var A = 1e4 > V.recentlyCreatedOwnerStacks++;
252
- return c(
246
+ var H, X = {}, Z = o["react-stack-bottom-frame"].bind(
247
+ o,
248
+ E
249
+ )(), y = $(l(E)), Q = {};
250
+ ee.Fragment = f, ee.jsx = function(e, u, v, w, C) {
251
+ var A = 1e4 > W.recentlyCreatedOwnerStacks++;
252
+ return i(
253
253
  e,
254
- o,
255
- S,
254
+ u,
255
+ v,
256
256
  !1,
257
- F,
257
+ w,
258
258
  C,
259
- A ? Error("react-stack-top-frame") : Q,
260
- A ? W(g(e)) : v
259
+ A ? Error("react-stack-top-frame") : Z,
260
+ A ? $(l(e)) : y
261
261
  );
262
- }, te.jsxs = function(e, o, S, F, C) {
263
- var A = 1e4 > V.recentlyCreatedOwnerStacks++;
264
- return c(
262
+ }, ee.jsxs = function(e, u, v, w, C) {
263
+ var A = 1e4 > W.recentlyCreatedOwnerStacks++;
264
+ return i(
265
265
  e,
266
- o,
267
- S,
266
+ u,
267
+ v,
268
268
  !0,
269
- F,
269
+ w,
270
270
  C,
271
- A ? Error("react-stack-top-frame") : Q,
272
- A ? W(g(e)) : v
271
+ A ? Error("react-stack-top-frame") : Z,
272
+ A ? $(l(e)) : y
273
273
  );
274
274
  };
275
- }()), te;
275
+ }()), ee;
276
276
  }
277
- var Ee;
277
+ var ge;
278
278
  function ke() {
279
- return Ee || (Ee = 1, process.env.NODE_ENV === "production" ? ce.exports = Te() : ce.exports = _e()), ce.exports;
279
+ return ge || (ge = 1, process.env.NODE_ENV === "production" ? ue.exports = Te() : ue.exports = _e()), ue.exports;
280
280
  }
281
- var ge = ke();
282
- const R = () => {
283
- }, Se = ye({
281
+ var me = ke();
282
+ const S = () => {
283
+ }, Re = we({
284
284
  ref: null,
285
- watch: R,
285
+ watch: S,
286
286
  actions: {
287
- reset: R,
288
- resetField: R,
289
- setValue: R,
290
- getValues: R,
291
- getErrors: R,
292
- getFieldStates: R,
293
- getFormStates: R,
294
- setError: R,
295
- clearError: R,
296
- clearErrors: R,
297
- checkValidity: R,
298
- getNumberFields: R,
299
- getFieldValidity: R,
300
- getDefaultValues: R,
301
- setFieldState: R,
302
- resetFieldState: R,
303
- getControlledFields: R
287
+ reset: S,
288
+ resetField: S,
289
+ setValue: S,
290
+ getValues: S,
291
+ getErrors: S,
292
+ getFieldStates: S,
293
+ getFormStates: S,
294
+ setError: S,
295
+ clearError: S,
296
+ clearErrors: S,
297
+ checkValidity: S,
298
+ getNumberFields: S,
299
+ getFieldValidity: S,
300
+ getDefaultValues: S,
301
+ setFieldState: S,
302
+ resetFieldState: S,
303
+ getControlledFields: S
304
304
  },
305
- registerController: R,
306
- registerHookWatcher: R,
307
- lastReloadedAt: R,
308
- loadFormValues: R,
309
- getWatchValue: R,
305
+ registerController: S,
306
+ registerHookWatcher: S,
307
+ lastReloadedAt: S,
308
+ loadFormValues: S,
309
+ getWatchValue: S,
310
310
  channels: {}
311
- }), Re = () => Fe(Se), Ye = ({
312
- id: s,
313
- control: n,
314
- method: i,
315
- action: g,
316
- children: E,
317
- onSubmit: h = () => {
311
+ }), pe = () => Fe(Re), Ie = ({
312
+ id: t,
313
+ control: s,
314
+ method: a,
315
+ action: l,
316
+ children: h,
317
+ onSubmit: E = () => {
318
318
  },
319
- onInput: l = () => {
319
+ onInput: g = () => {
320
320
  },
321
- onChange: p = () => {
321
+ onChange: R = () => {
322
322
  },
323
- onBlur: y = () => {
323
+ onBlur: p = () => {
324
324
  },
325
- onReset: k = () => {
325
+ onReset: _ = () => {
326
326
  },
327
- numberFields: c = [],
327
+ numberFields: i = [],
328
328
  className: m,
329
- ...f
330
- }) => (fe(() => {
331
- const u = n.channels.subscribe("onChange", p), d = n.channels.subscribe("onBlur", y);
329
+ ...o
330
+ }) => (de(() => {
331
+ const c = s.channels.subscribe("onChange", R), b = s.channels.subscribe("onBlur", p);
332
332
  return () => {
333
- u(), d();
333
+ c(), b();
334
334
  };
335
- }, []), /* @__PURE__ */ ge.jsx(Se.Provider, { value: n, children: /* @__PURE__ */ ge.jsx(
335
+ }, []), /* @__PURE__ */ me.jsx(Re.Provider, { value: s, children: /* @__PURE__ */ me.jsx(
336
336
  "form",
337
337
  {
338
- id: s,
339
- ref: n.ref,
340
- action: g,
341
- method: i,
338
+ id: t,
339
+ ref: s.ref,
340
+ action: l,
341
+ method: a,
342
342
  className: m,
343
- onInput: l,
344
- onSubmit: (u) => {
345
- i || u.preventDefault();
346
- const d = n.loadFormValues();
347
- h(d);
343
+ onInput: g,
344
+ onSubmit: (c) => {
345
+ a || c.preventDefault();
346
+ const b = s.loadFormValues();
347
+ E(b);
348
348
  },
349
- onChange: (u) => {
350
- const d = u.target.name;
351
- n.actions.getControlledFields().has(d) || n.actions.setValue(d, u.target.value);
349
+ onChange: (c) => {
350
+ const b = c.target.name;
351
+ !b || s.actions.getControlledFields().has(b) || s.actions.setValue(b, c.target.value);
352
352
  },
353
- onBlur: (u) => {
354
- const d = u.target.name;
355
- if (n.actions.getControlledFields().has(d)) return;
356
- const b = u.target.value;
357
- n.channels.publish("onBlur", d, b, n.actions.getValues());
353
+ onBlur: (c) => {
354
+ const b = c.target.name;
355
+ if (!b || s.actions.getControlledFields().has(b)) return;
356
+ const f = c.target.value;
357
+ s.channels.publish("onBlur", b, f, s.actions.getValues());
358
358
  },
359
- onReset: (u) => {
360
- n.actions.reset(), k(u);
359
+ onReset: (c) => {
360
+ s.actions.reset(), _(c);
361
361
  },
362
- ...f,
363
- children: E
362
+ ...o,
363
+ children: h
364
364
  },
365
- n.lastReloadedAt
366
- ) })), we = ({ control: s, name: n, compute: i }) => {
367
- const { getWatchValue: g, registerHookWatcher: E } = s || Re(), h = g({ name: n, compute: i }), [l, p] = ae(h);
368
- return fe(() => {
369
- const y = E({ name: n, compute: i, value: l, setValue: p });
370
- return () => y.forEach((k) => k());
371
- }, []), l;
372
- }, Ae = ({ name: s, defaultValue: n }) => {
373
- const { actions: i, registerController: g, channels: E } = Re(), h = j(), l = i.getDefaultValues()[s] || n || "", [p, y] = ae(l), k = we({ name: `fieldStates.${s}.customState` }), c = a((u) => {
374
- i.setFieldState(s, "customState", u);
375
- }, []), m = a(
376
- (u, { shouldDirty: d = !0, shouldOnChange: b = !0 } = {}) => {
377
- y(u), i.setValue(s, u, { shouldDirty: d, shouldOnChange: b });
365
+ s.lastReloadedAt
366
+ ) })), Ae = ({ control: t, name: s, compute: a }) => {
367
+ const { getWatchValue: l, registerHookWatcher: h } = t || pe(), E = l({ name: s, compute: a }), [g, R] = ae(E);
368
+ return de(() => {
369
+ const p = h({ name: s, compute: a, value: g, setValue: R });
370
+ return () => p.forEach((_) => _());
371
+ }, []), g;
372
+ }, Oe = ({ name: t, defaultValue: s }) => {
373
+ const { actions: a, registerController: l, channels: h } = pe(), E = P(), g = a.getDefaultValues()[t] || s || "", [R, p] = ae(g), _ = Ae({ name: `fieldStates.${t}` }), i = d(
374
+ (o, { shouldDirty: c = !0, shouldOnChange: b = !0 } = {}) => {
375
+ var O, N;
376
+ let f = o;
377
+ (O = o == null ? void 0 : o.target) != null && O.value && (f = o.target.value), (N = o == null ? void 0 : o.target) != null && N.checked && (f = o.target.checked + ""), p(f), a.setValue(t, f, { shouldDirty: c, shouldOnChange: b });
378
378
  },
379
- [i.setValue]
380
- ), f = a(() => {
381
- E.publish("onBlur", s, p, i.getValues());
379
+ [a.setValue]
380
+ ), m = d((o) => {
381
+ const c = a.getValues(), b = o ?? c[t];
382
+ h.publish("onBlur", t, b, c);
382
383
  }, []);
383
- return fe(() => g(s, y), []), { ref: h, name: s, defaultValue: l, value: p, onChange: m, onBlur: f, customState: k, setCustomState: c };
384
- }, Be = ({
385
- name: s,
386
- defaultValue: n,
387
- render: i = ({ ref: g, name: E, defaultValue: h, value: l, onChange: p, onBlur: y, customState: k, setCustomState: c }) => null
384
+ return de(() => l(t, p), []), { ref: E, name: t, defaultValue: g, value: R, onChange: i, onBlur: m, fieldState: _ };
385
+ }, Le = ({
386
+ name: t,
387
+ defaultValue: s,
388
+ render: a = ({ ref: l, name: h, defaultValue: E, value: g, onChange: R, onBlur: p, customState: _, setCustomState: i }) => null
388
389
  }) => {
389
- const g = Ae({ name: s, defaultValue: n });
390
- return i(g);
391
- }, Oe = ["errors", "fieldStates", "formState"], q = (s) => Oe.some((n) => s.startsWith(n)) ? s : "values." + s, Ce = [
390
+ const l = Oe({ name: t, defaultValue: s });
391
+ return a(l);
392
+ }, Ce = ["errors", "fieldStates", "formState"], ce = (t = {}, s = "") => s.split(".").reduce((a, l) => a && a[l] !== void 0 ? a[l] : void 0, t), Pe = (t = {}, s = "", a) => {
393
+ let l = t;
394
+ const h = s.split(".");
395
+ return h.forEach((E, g) => {
396
+ if (g < h.length - 1) {
397
+ l[E] || (l[E] = {}), l = l[E];
398
+ return;
399
+ }
400
+ l[E] = a;
401
+ }), t;
402
+ }, q = (t) => Ce.some((s) => t.startsWith(s)) ? t : "values." + t, je = [
392
403
  "badInput",
393
404
  "customError",
394
405
  "patternMismatch",
@@ -399,313 +410,324 @@ const R = () => {
399
410
  "tooShort",
400
411
  "typeMismatch",
401
412
  "valueMissing"
402
- ], he = (s) => {
403
- typeof s.setCustomValidity == "function" && s.setCustomValidity("");
404
- let n = s.validity, i = Ce.find((g) => n[g]);
405
- if (i) return { type: i, message: s.validationMessage };
413
+ ], ve = (t) => {
414
+ typeof t.setCustomValidity == "function" && t.setCustomValidity("");
415
+ let s = t.validity, a = je.find((l) => s[l]);
416
+ if (a) return { type: a, message: t.validationMessage };
406
417
  };
407
- class je {
418
+ class xe {
408
419
  constructor() {
409
- this.events = /* @__PURE__ */ new Map();
420
+ this.events = /* @__PURE__ */ new Map(), this.watchEvents = /* @__PURE__ */ new Map();
421
+ }
422
+ getWatchEvents() {
423
+ return this.watchEvents;
410
424
  }
411
425
  getEvents() {
412
426
  return this.events;
413
427
  }
414
- subscribe(n, i) {
415
- return this.events.has(n) || this.events.set(n, /* @__PURE__ */ new Set()), this.events.get(n).add(i), () => {
416
- var g;
417
- return (g = this.events.get(n)) == null ? void 0 : g.delete(i);
428
+ subscribe(s, a) {
429
+ return this.events.has(s) || this.events.set(s, /* @__PURE__ */ new Set()), this.events.get(s).add(a), () => {
430
+ var l;
431
+ return (l = this.events.get(s)) == null ? void 0 : l.delete(a);
418
432
  };
419
433
  }
420
- publish(n, ...i) {
421
- const g = this.events.get(n);
422
- g && g.forEach((E) => E(...i)), this.events.forEach((E, h) => {
423
- h !== n && n.includes(h) && E.forEach((l) => l(...i));
434
+ subscribeWatch(s, a) {
435
+ this.watchEvents.has(s) || (this.watchEvents.set(s, /* @__PURE__ */ new Set()), this.watchEvents.get(s).add(a));
436
+ }
437
+ publish(s, ...a) {
438
+ this.events.forEach((l, h) => {
439
+ s.includes(h) && l.forEach((E) => E(...a));
440
+ }), this.watchEvents.forEach((l, h) => {
441
+ s.includes(h) && l.forEach((E) => E(...a));
424
442
  });
425
443
  }
426
444
  reset() {
427
- this.events.clear();
445
+ this.events.clear(), this.watchEvents.clear();
428
446
  }
429
447
  }
430
- const Pe = () => {
431
- const s = j(new je()), n = a((h, ...l) => {
432
- s.current.publish(h, ...l);
433
- }, []), i = a((h, l) => s.current.subscribe(h, l), []), g = a(() => s.current.getEvents(), []), E = a(() => {
434
- s.current.reset();
448
+ const Ne = () => {
449
+ const t = P(new xe()), s = d((R, ...p) => {
450
+ t.current.publish(R, ...p);
451
+ }, []), a = d((R, p) => t.current.subscribe(R, p), []), l = d((R, p) => {
452
+ t.current.subscribeWatch(R, p);
453
+ }, []), h = d(() => t.current.getEvents(), []), E = d(() => t.current.getWatchEvents(), []), g = d(() => {
454
+ t.current.reset();
435
455
  }, []);
436
- return { publish: n, subscribe: i, reset: E, getEvents: g };
437
- }, xe = () => {
438
- const [s, n] = ae(), i = a(() => n((/* @__PURE__ */ new Date()).toString()), []);
439
- return [s, i];
440
- }, Ne = () => {
441
- const [, s] = ae({});
442
- return a(() => s({}), []);
443
- }, Ve = ({ channels: s, getValues: n, getErrors: i, getFieldStates: g, getFormState: E }) => {
444
- const h = Ne(), l = a(({ name: c, compute: m }) => {
445
- if (typeof m == "function") return m(n());
446
- if (Array.isArray(c)) {
447
- const f = {};
448
- return c.forEach((u) => {
449
- f[u] = l({ name: u });
450
- }), f;
456
+ return { publish: s, subscribe: a, reset: g, getEvents: h, subscribeWatch: l, getWatchEvents: E };
457
+ }, Ve = () => {
458
+ const [t, s] = ae(), a = d(() => s((/* @__PURE__ */ new Date()).toString()), []);
459
+ return [t, a];
460
+ }, We = () => {
461
+ const [, t] = ae({});
462
+ return d(() => t({}), []);
463
+ }, De = ({ channels: t, getValues: s, getErrors: a, getFieldStates: l, getFormState: h }) => {
464
+ const E = We(), g = d(({ name: i, compute: m }) => {
465
+ if (typeof m == "function") return m(s());
466
+ if (Array.isArray(i)) {
467
+ const o = {};
468
+ return i.forEach((c) => {
469
+ o[c] = g({ name: c });
470
+ }), o;
451
471
  }
452
- return c.split(".").reduce(
453
- (f, u) => f && f[u] !== void 0 ? f[u] : void 0,
472
+ return ce(
454
473
  {
455
- ...n(),
456
- errors: { ...i() },
457
- formState: { ...E() },
458
- fieldStates: { ...g() }
459
- }
474
+ ...s(),
475
+ errors: { ...a() },
476
+ formState: { ...h() },
477
+ fieldStates: { ...l() }
478
+ },
479
+ i
460
480
  );
461
- }, []), p = a((c) => {
462
- if (!c)
463
- return s.subscribe("values", () => h()), n();
464
- if (typeof c == "string") {
465
- const m = q(c);
466
- return s.subscribe(m, () => h()), l({ name: c });
481
+ }, []), R = d((i) => {
482
+ if (!i)
483
+ return t.subscribeWatch("values", () => E()), s();
484
+ if (typeof i == "string") {
485
+ const m = q(i);
486
+ return t.subscribeWatch(m, () => E()), g({ name: i });
467
487
  }
468
- if (Array.isArray(c)) {
488
+ if (Array.isArray(i)) {
469
489
  const m = {};
470
- return c.forEach((f) => {
471
- const u = q(f);
472
- s.subscribe(u, () => h()), m[f] = l({ name: f });
490
+ return i.forEach((o) => {
491
+ const c = q(o);
492
+ t.subscribeWatch(c, () => E()), m[o] = g({ name: o });
473
493
  }), { ...m };
474
494
  }
475
495
  throw new Error("Parameters of watch must be string or array of string");
476
- }, []), y = a(({ name: c, compute: m, value: f, setValue: u }) => {
496
+ }, []), p = d(({ name: i, compute: m, setValue: o }) => {
477
497
  if (typeof m == "function")
478
- return [s.subscribe("values", () => {
479
- const b = l({ compute: m });
480
- u(b);
498
+ return [t.subscribe("values", () => {
499
+ const b = g({ compute: m });
500
+ o(b);
481
501
  })];
482
- if (!c)
483
- return [s.subscribe("values", () => {
484
- u(n());
502
+ if (!i)
503
+ return [t.subscribe("values", () => {
504
+ o(s());
485
505
  })];
486
- if (typeof c == "string") {
487
- const d = q(c);
488
- return [s.subscribe(d, () => {
489
- const O = l({ name: c });
490
- u(O);
506
+ if (typeof i == "string") {
507
+ const c = q(i);
508
+ return [t.subscribe(c, () => {
509
+ const f = g({ name: i });
510
+ o(f);
491
511
  })];
492
512
  }
493
- if (Array.isArray(c)) {
494
- const d = l({ name: c }), b = [];
495
- return c.forEach((O) => {
496
- const B = q(O), $ = s.subscribe(B, () => {
497
- const J = l({ name: O });
498
- d[O] = J, u({ ...d });
513
+ if (Array.isArray(i)) {
514
+ const c = g({ name: i }), b = [];
515
+ return i.forEach((f) => {
516
+ const O = q(f), N = t.subscribe(O, () => {
517
+ const M = g({ name: f });
518
+ c[f] = M, o({ ...c });
499
519
  });
500
- b.push($);
520
+ b.push(N);
501
521
  }), b;
502
522
  }
503
523
  throw new Error("Parameters of name must be string or array of string or compute must be a function");
504
- }, []), k = a(
505
- (c, m) => {
506
- if (!c)
507
- return s.subscribe("values", m);
508
- if (typeof c == "string") {
509
- const f = q(c);
510
- return s.subscribe(f, m);
524
+ }, []), _ = d(
525
+ (i, m) => {
526
+ if (!i)
527
+ return t.subscribe("values", m);
528
+ if (typeof i == "string") {
529
+ const o = q(i);
530
+ return t.subscribe(o, m);
511
531
  }
512
- if (Array.isArray(c)) {
513
- const f = {}, u = [];
514
- return c.forEach((d) => {
515
- const b = q(d), O = s.subscribe(b, () => {
516
- f[d] = l({ name: d }), m({ ...f });
532
+ if (Array.isArray(i)) {
533
+ const o = {}, c = [];
534
+ return i.forEach((b) => {
535
+ const f = q(b), O = t.subscribe(f, () => {
536
+ o[b] = g({ name: b }), m({ ...o });
517
537
  });
518
- u.push(O);
519
- }), u;
538
+ c.push(O);
539
+ }), c;
520
540
  }
521
541
  throw new Error("Parameters of name must be string or array of string");
522
542
  },
523
- [s]
543
+ [t]
524
544
  );
525
- return { watch: p, registerHookWatcher: y, getWatchValue: l, subscribe: k };
526
- }, le = { isError: !1, isDirty: !1, isTouched: !1, customState: null }, De = [], We = {}, Ie = ({
527
- numberFields: s = De,
528
- defaultValues: n = We,
529
- shouldUnRegister: i = !1,
530
- shouldConvertNumber: g = !1
545
+ return { watch: R, registerHookWatcher: p, getWatchValue: g, subscribe: _ };
546
+ }, fe = { isDirty: !1, isTouched: !1, error: null }, $e = [], Me = {}, Ue = ({
547
+ numberFields: t = $e,
548
+ defaultValues: s = Me,
549
+ shouldUnRegister: a = !1,
550
+ shouldConvertNumber: l = !1
531
551
  } = {}) => {
532
- const [E, h] = xe(), l = j(), p = j(!1), y = j(!1), k = j(s), c = j(/* @__PURE__ */ new Map()), m = j({}), f = j({}), u = j({ ...n }), d = j({ ...n }), b = Pe(), O = a(() => {
533
- f.current = Object.keys(d.current).reduce((r, t) => ({ ...r, [t]: { ...le } }), {});
534
- }, []), B = a((r = {}) => {
535
- d.current = { ...d.current, ...r }, u.current = { ...d.current }, c.current.forEach((t, _) => {
536
- t(d.current[_]);
537
- }), p.current = !1, m.current = {}, k.current = s, c.current = /* @__PURE__ */ new Map(), b.reset(), O(), s.length > 0 && (g = !0), h();
538
- }, []), $ = a(() => {
539
- const r = Object.fromEntries(new FormData(l.current));
540
- return c.current.forEach((_, w) => {
541
- r[w] = u.current[w];
542
- }), g && k.current.forEach(
543
- (_) => r.hasOwnProperty(_) && (r[_] = Number(r[_]) || 0)
544
- ), r;
545
- }, []), J = a(() => !!Object.values(M()).find((r) => r.isDirty), []), z = a(() => !!Object.values(V()).find((r) => !!r), []), se = a((r) => he(r.target), []), ne = a(() => d.current, []), oe = a(() => k.current, []), G = a(() => c.current, []), P = a((r, t) => t ? Array.isArray(t) ? t.map((_) => r[_]) : r[t] : { ...r }, []), H = a((r) => P(u.current, r), [P]), V = a((r) => P(m.current, r), [P]), M = a((r) => P(f.current, r), [P]), D = a(
546
- (r) => P(
552
+ const [h, E] = Ve(), g = P(), R = P(!1), p = P(!1), _ = P(t), i = P(/* @__PURE__ */ new Map()), m = P({}), o = P({}), c = P({ ...s }), b = P({ ...s }), f = Ne(), O = d(() => {
553
+ o.current = Object.keys(b.current).reduce((r, n) => ({ ...r, [n]: { ...fe } }), {});
554
+ }, []), N = d((r = {}) => {
555
+ b.current = { ...b.current, ...r }, c.current = { ...b.current }, i.current.forEach((n, T) => {
556
+ n(b.current[T]);
557
+ }), R.current = !1, m.current = {}, _.current = t, i.current = /* @__PURE__ */ new Map(), f.reset(), O(), t.length > 0 && (l = !0), E();
558
+ }, []), M = d(() => {
559
+ const r = Object.fromEntries(new FormData(g.current));
560
+ return i.current.forEach((T, k) => {
561
+ r[k] = c.current[k];
562
+ }), l && _.current.forEach(
563
+ (T) => r.hasOwnProperty(T) && (r[T] = Number(r[T]) || 0)
564
+ ), { ...c.current, ...r };
565
+ }, []), ie = d(() => !!Object.values(Y()).find((r) => r.isDirty), []), J = d(() => !!Object.values(W()).find((r) => !!r), []), re = d((r) => ve(r.target), []), te = d(() => b.current, []), ne = d(() => _.current, []), z = d(() => i.current, []), j = d((r, n) => n ? Array.isArray(n) ? n.reduce((T, k) => ({ ...T, [k]: ce(r, k) }), {}) : ce(r, n) : { ...r }, []), G = d((r) => j(c.current, r), [j]), W = d((r) => j(m.current, r), [j]), Y = d((r) => j(o.current, r), [j]), D = d(
566
+ (r) => j(
547
567
  {
548
- isDirty: p.current,
549
- isError: y.current,
550
- errorFields: Object.keys(m.current).filter((t) => !!m.current[t]),
551
- dirtyFields: Object.keys(f.current).filter((t) => f.current[t].isDirty),
552
- touchedFields: Object.keys(f.current).filter((t) => f.current[t].isTouched)
568
+ isDirty: R.current,
569
+ isError: p.current,
570
+ errorFields: Object.keys(m.current).filter((n) => !!m.current[n]),
571
+ dirtyFields: Object.keys(o.current).filter((n) => o.current[n].isDirty),
572
+ touchedFields: Object.keys(o.current).filter((n) => o.current[n].isTouched)
553
573
  },
554
574
  r
555
575
  ),
556
- [P]
557
- ), { watch: W, registerHookWatcher: X, getWatchValue: Z, subscribe: Q } = Ve({
558
- channels: b,
559
- getValues: H,
560
- getErrors: V,
561
- getFieldStates: M,
576
+ [j]
577
+ ), { watch: $, registerHookWatcher: H, getWatchValue: X, subscribe: Z } = De({
578
+ channels: f,
579
+ getValues: G,
580
+ getErrors: W,
581
+ getFieldStates: Y,
562
582
  getFormState: D
563
- }), v = a((r, t, _) => {
564
- const w = f.current[r] || { ...le };
565
- w[t] !== _ && (f.current[r] = { ...w, [t]: _ }, b.publish(`fieldStates.${r}.${t}`, _), t === "isError" && b.publish("formState.errorFields", D("errorFields")), t === "isDirty" && b.publish("formState.dirtyFields", D("dirtyFields")), t === "isTouched" && b.publish("formState.touchedFields", D("touchedFields")));
566
- }, []), K = a(
583
+ }), y = d((r, n, T) => {
584
+ const k = o.current[r] || { ...fe };
585
+ ce(k, n) !== T && (Pe(o.current, `${r}.${n}`, T), f.publish(`fieldStates.${r}.${n}`, T), n === "error" && f.publish("formState.errorFields", D("errorFields")), n === "isDirty" && f.publish("formState.dirtyFields", D("dirtyFields")), n === "isTouched" && f.publish("formState.touchedFields", D("touchedFields")));
586
+ }, []), Q = d(
567
587
  (r) => {
568
- v(r, "isError", !1), v(r, "isDirty", !1), v(r, "isTouched", !1), v(r, "customState", null);
588
+ y(r, "isDirty", !1), y(r, "isTouched", !1), y(r, "error", null);
569
589
  },
570
- [v]
571
- ), e = a(
572
- (r, t) => {
573
- if (m.current[r] === t) return;
574
- m.current[r] = t, v(r, "isError", !!t), b.publish(`errors.${r}`, t);
575
- const w = z();
576
- y.current !== w && (y.current = w, b.publish("formState.isError", w));
590
+ [y]
591
+ ), e = d(
592
+ (r, n) => {
593
+ if (m.current[r] === n) return;
594
+ m.current[r] = n, y(r, "error", n), f.publish(`errors.${r}`, n);
595
+ const k = J();
596
+ p.current !== k && (p.current = k, f.publish("formState.isError", k));
577
597
  },
578
- [v]
579
- ), o = a(
598
+ [y]
599
+ ), u = d(
580
600
  (r) => {
581
601
  if (!m.current[r]) return;
582
- m.current[r] = null, v(r, "isError", !1), b.publish(`errors.${r}`, null);
583
- const t = z();
584
- y.current !== t && (y.current = t, b.publish("formState.isError", t));
602
+ m.current[r] = null, y(r, "error", null), f.publish(`errors.${r}`, null);
603
+ const n = J();
604
+ p.current !== n && (p.current = n, f.publish("formState.isError", n));
585
605
  },
586
- [v]
587
- ), S = a(() => {
606
+ [y]
607
+ ), v = d(() => {
588
608
  if (Object.keys(m.current) === 0) return;
589
- Object.keys(m.current).forEach((t) => o(t)), m.current = {};
590
- const r = z();
591
- y.current !== r && (y.current = r, b.publish("formState.isError", r));
592
- }, []), F = a(
609
+ Object.keys(m.current).forEach((n) => u(n)), m.current = {};
610
+ const r = J();
611
+ p.current !== r && (p.current = r, f.publish("formState.isError", r));
612
+ }, []), w = d(
593
613
  (r) => {
594
- const t = he(r.target);
595
- t ? e(r.target.name, t) : o(r.target.name);
614
+ const n = ve(r.target);
615
+ n ? e(r.target.name, n) : u(r.target.name);
596
616
  },
597
- [e, o]
598
- ), C = a(
599
- (r, t, { shouldDirty: _ = !0, shouldOnChange: w = !0 } = {}) => {
600
- if (t === u.current[r]) return;
601
- g && k.current.includes(r) && (t = Number(t) || void 0), v(r, "isTouched", !0);
602
- const ee = t !== d.current[r];
603
- _ && f.current[r].isDirty !== ee && v(r, "isDirty", ee);
604
- const Y = J();
605
- p.current !== Y && (p.current = Y, b.publish("formState.isDirty", Y)), u.current[r] = t;
606
- const U = c.current.get(r);
607
- U && U(t), b.publish(`values.${r}`, t, { shouldDirty: _, shouldOnChange: w }), w && b.publish("onChange", r, t, u.current);
617
+ [e, u]
618
+ ), C = d(
619
+ (r, n, { shouldDirty: T = !0, shouldOnChange: k = !0 } = {}) => {
620
+ if (n === c.current[r]) return;
621
+ l && _.current.includes(r) && (n = Number(n) || void 0), y(r, "isTouched", !0);
622
+ const oe = n !== b.current[r];
623
+ T && o.current[r].isDirty !== oe && y(r, "isDirty", oe);
624
+ const B = ie();
625
+ R.current !== B && (R.current = B, f.publish("formState.isDirty", B)), c.current[r] = n;
626
+ const U = i.current.get(r);
627
+ U && U(n), f.publish(`values.${r}`, n, { shouldDirty: T, shouldOnChange: k }), k && f.publish("onChange", r, n, c.current);
608
628
  },
609
- [v]
610
- ), A = a((r, t) => (c.current.set(r, t), f.current[r] = { ...le }, () => {
611
- i && c.current.delete(r);
612
- }), []), I = a(
613
- (r, { keepError: t, keepDirty: _, keepTouched: w, keepCustomState: ee, defaultValue: Y }) => {
614
- const U = c.current.get(r);
629
+ [y]
630
+ ), A = d((r, n) => (i.current.set(r, n), o.current[r] = { ...fe }, () => {
631
+ a && i.current.delete(r);
632
+ }), []), I = d(
633
+ (r, { keepError: n, keepDirty: T, keepTouched: k, keepCustomState: oe, defaultValue: B }) => {
634
+ const U = i.current.get(r);
615
635
  if (!U)
616
636
  throw new Error(`Cannot reset "${r}" because it's uncontrolled field`);
617
- d.current[r] = Y, u.current[r] = Y, U && U(Y), t || o(r), _ || v(r, "isDirty", !1), w || v(r, "isTouched", !1), ee || v(r, "customState", null);
637
+ b.current[r] = B, c.current[r] = B, U && U(B), n || u(r), T || y(r, "isDirty", !1), k || y(r, "isTouched", !1);
618
638
  },
619
- [o, v]
620
- ), L = a((r, t = x.getValues(r)) => {
621
- b.publish("onBlur", r, t, x.getValues());
622
- }, []), T = a((r) => b.subscribe("onChange", r), []), N = a((r) => b.subscribe("onBlur", r), []), x = ie(
639
+ [u, y]
640
+ ), L = d((r, n = x.getValues(r)) => {
641
+ f.publish("onBlur", r, n, x.getValues());
642
+ }, []), F = d((r) => f.subscribe("onChange", r), []), V = d((r) => f.subscribe("onBlur", r), []), x = le(
623
643
  () => ({
624
- subscribe: Q,
625
- reset: B,
644
+ subscribe: Z,
645
+ reset: N,
626
646
  resetField: I,
627
647
  setValue: C,
628
- getValues: H,
629
- getErrors: V,
630
- getFieldStates: M,
648
+ getValues: G,
649
+ getErrors: W,
650
+ getFieldStates: Y,
631
651
  getFormState: D,
632
652
  setError: e,
633
- clearError: o,
634
- clearErrors: S,
635
- checkValidity: F,
636
- getNumberFields: oe,
637
- getFieldValidity: se,
638
- getDefaultValues: ne,
639
- setFieldState: v,
653
+ clearError: u,
654
+ clearErrors: v,
655
+ checkValidity: w,
656
+ getNumberFields: ne,
657
+ getFieldValidity: re,
658
+ getDefaultValues: te,
659
+ setFieldState: y,
640
660
  triggerFieldBlur: L,
641
- resetFieldState: K,
642
- getControlledFields: G,
643
- subscribeChange: T,
644
- subscribeBlur: N
661
+ resetFieldState: Q,
662
+ getControlledFields: z,
663
+ subscribeChange: F,
664
+ subscribeBlur: V,
665
+ getEvents: f.getEvents,
666
+ getWatchEvents: f.getWatchEvents
645
667
  }),
646
668
  [
647
- Q,
648
- B,
669
+ Z,
670
+ N,
649
671
  I,
650
672
  C,
651
- H,
652
- V,
653
- M,
673
+ G,
674
+ W,
675
+ Y,
654
676
  D,
655
677
  e,
656
- o,
657
- S,
658
- F,
659
- oe,
660
- se,
661
- ne,
678
+ u,
662
679
  v,
663
- K,
680
+ w,
681
+ ne,
682
+ re,
683
+ te,
684
+ y,
685
+ Q,
664
686
  L,
665
- G,
666
- T,
667
- N
687
+ z,
688
+ F,
689
+ V
668
690
  ]
669
- ), ue = ie(
691
+ ), se = le(
670
692
  () => ({
671
- ref: l,
672
- watch: W,
693
+ ref: g,
694
+ watch: $,
673
695
  actions: x,
674
696
  registerController: A,
675
- registerHookWatcher: X,
676
- lastReloadedAt: E,
677
- loadFormValues: $,
678
- getWatchValue: Z,
679
- channels: b
697
+ registerHookWatcher: H,
698
+ lastReloadedAt: h,
699
+ loadFormValues: M,
700
+ getWatchValue: X,
701
+ channels: f
680
702
  }),
681
703
  [
682
- l,
683
- W,
704
+ g,
705
+ $,
684
706
  x,
685
707
  A,
708
+ H,
709
+ h,
710
+ M,
686
711
  X,
687
- E,
688
- $,
689
- Z,
690
- b
712
+ f
691
713
  ]
692
- ), ve = ie(() => ({ control: ue, actions: x, watch: W }), [E, ue, x, W]);
693
- return de(() => {
694
- if ([...l.current.querySelectorAll("[name]")].forEach((t) => {
695
- !t.defaultValue && !c.current.has(t.name) && d.current[t.name] && (t.defaultValue = d.current[t.name]), t.type === "number" && !k.current.includes(t.name) && k.current.push(t.name);
696
- }), l.current) {
697
- const t = $();
698
- u.current = { ...t }, d.current = { ...t };
714
+ ), Se = le(() => ({ control: se, actions: x, watch: $ }), [h, se, x, $]);
715
+ return be(() => {
716
+ if ([...g.current.querySelectorAll("[name]")].forEach((n) => {
717
+ !n.defaultValue && !i.current.has(n.name) && b.current[n.name] && (n.defaultValue = b.current[n.name]), n.type === "number" && !_.current.includes(n.name) && _.current.push(n.name);
718
+ }), g.current) {
719
+ const n = M();
720
+ c.current = { ...n }, b.current = { ...n };
699
721
  }
700
- }, [E]), de(() => {
722
+ }, [h]), be(() => {
701
723
  O();
702
- }, []), ve;
724
+ }, []), Se;
703
725
  };
704
726
  export {
705
- Be as Controller,
706
- Ye as Form,
707
- Ae as useController,
708
- Ie as useForm,
709
- Re as useFormContext,
710
- we as useWatch
727
+ Le as Controller,
728
+ Ie as Form,
729
+ Oe as useController,
730
+ Ue as useForm,
731
+ pe as useFormContext,
732
+ Ae as useWatch
711
733
  };