@gen-epix/ui-client-common 4.0.0 → 4.0.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.
Files changed (243) hide show
  1. package/dist/@types/{ui.d.ts → ui-client-common.d.ts} +1 -1
  2. package/dist/_chunks/ApplicationFooter.js +1 -1
  3. package/dist/_chunks/ApplicationFooter.js.map +1 -1
  4. package/dist/_chunks/Breadcrumbs.js +1 -1
  5. package/dist/_chunks/Breadcrumbs.js.map +1 -1
  6. package/dist/_chunks/CrudPage.js +293 -293
  7. package/dist/_chunks/CrudPage.js.map +1 -1
  8. package/dist/_chunks/GeoFilter.js +1 -1
  9. package/dist/_chunks/GeoFilter.js.map +1 -1
  10. package/dist/_chunks/Notifications.js.map +1 -1
  11. package/dist/_chunks/OutageList.js.map +1 -1
  12. package/dist/_chunks/QueryClientProvider.js +1 -1
  13. package/dist/_chunks/QueryClientProvider.js.map +1 -1
  14. package/dist/_chunks/QueryClientService.js +79 -66
  15. package/dist/_chunks/QueryClientService.js.map +1 -1
  16. package/dist/_chunks/Table.js +953 -945
  17. package/dist/_chunks/Table.js.map +1 -1
  18. package/dist/_chunks/TableUtil.js.map +1 -1
  19. package/dist/_chunks/TextFilter.js +4 -4
  20. package/dist/_chunks/TextFilter.js.map +1 -1
  21. package/dist/_chunks/UserInvitationsAdminPage.js +110 -110
  22. package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
  23. package/dist/_chunks/_baseFlatten.js +1 -1
  24. package/dist/_chunks/_baseGet.js +26 -26
  25. package/dist/_chunks/_baseGet.js.map +1 -1
  26. package/dist/_chunks/_baseIteratee.js +25 -26
  27. package/dist/_chunks/_baseIteratee.js.map +1 -1
  28. package/dist/_chunks/_setToString.js.map +1 -1
  29. package/dist/_chunks/{chunk-KS7C4IRE.js → chunk-BV7QT456.js} +1041 -1128
  30. package/dist/_chunks/chunk-BV7QT456.js.map +1 -0
  31. package/dist/_chunks/format.js +199 -198
  32. package/dist/_chunks/format.js.map +1 -1
  33. package/dist/_chunks/index.esm.js +797 -692
  34. package/dist/_chunks/index.esm.js.map +1 -1
  35. package/dist/_chunks/isArrayLike.js +1 -2
  36. package/dist/_chunks/isArrayLike.js.map +1 -1
  37. package/dist/_chunks/isObject.js +38 -2
  38. package/dist/_chunks/isObject.js.map +1 -1
  39. package/dist/_chunks/isSymbol.js +2 -2
  40. package/dist/_chunks/middleware.js +11 -9
  41. package/dist/_chunks/middleware.js.map +1 -1
  42. package/dist/_chunks/oidc-client-ts.js +12 -9
  43. package/dist/_chunks/oidc-client-ts.js.map +1 -1
  44. package/dist/_chunks/omit.js +38 -39
  45. package/dist/_chunks/omit.js.map +1 -1
  46. package/dist/_chunks/query.js +210 -228
  47. package/dist/_chunks/query.js.map +1 -1
  48. package/dist/_chunks/react-oidc-context.js +1 -1
  49. package/dist/_chunks/react-oidc-context.js.map +1 -1
  50. package/dist/_chunks/react.js +1 -1
  51. package/dist/_chunks/react.js.map +1 -1
  52. package/dist/_chunks/rolldown-runtime.js +2 -2
  53. package/dist/_chunks/tableStore.js +79 -78
  54. package/dist/_chunks/tableStore.js.map +1 -1
  55. package/dist/_chunks/toDate.js +1 -1
  56. package/dist/_chunks/toDate.js.map +1 -1
  57. package/dist/_chunks/uniq.js +1 -1
  58. package/dist/_chunks/uniq.js.map +1 -1
  59. package/dist/_chunks/useColumnsMenu.js +7 -6
  60. package/dist/_chunks/useColumnsMenu.js.map +1 -1
  61. package/dist/_chunks/useMutation.js +19 -16
  62. package/dist/_chunks/useMutation.js.map +1 -1
  63. package/dist/_chunks/useQueryMemo.js +156 -169
  64. package/dist/_chunks/useQueryMemo.js.map +1 -1
  65. package/dist/_chunks/vanilla.js +1 -1
  66. package/dist/_chunks/vanilla.js.map +1 -1
  67. package/dist/_chunks/yup.js +5 -5
  68. package/dist/_chunks/yup.js.map +1 -1
  69. package/dist/classes/filters/GeoFilter.d.ts +1 -1
  70. package/dist/classes/filters/MultiSelectFilter.d.ts +1 -1
  71. package/dist/classes/services/AuthenticationService/index.js +41 -44
  72. package/dist/classes/services/AuthenticationService/index.js.map +1 -1
  73. package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
  74. package/dist/classes/services/InactivityService/index.js +10 -11
  75. package/dist/classes/services/InactivityService/index.js.map +1 -1
  76. package/dist/classes/services/RouterService/index.js +1 -1
  77. package/dist/components/app/App/index.js +48 -38
  78. package/dist/components/app/App/index.js.map +1 -1
  79. package/dist/components/app/ApplicationBootstrap/index.js +54 -54
  80. package/dist/components/app/ApplicationBootstrap/index.js.map +1 -1
  81. package/dist/components/app/AuthenticationWrapper/index.js +45 -45
  82. package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
  83. package/dist/components/app/AuthorizationWrapper/index.js +7 -7
  84. package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
  85. package/dist/components/app/RouterRoot/index.js +53 -53
  86. package/dist/components/app/RouterRoot/index.js.map +1 -1
  87. package/dist/components/epi/EpiContactDetailsDialog/EpiContactDetailsDialog.d.ts +2 -2
  88. package/dist/components/epi/EpiContactDetailsDialog/index.js +28 -26
  89. package/dist/components/epi/EpiContactDetailsDialog/index.js.map +1 -1
  90. package/dist/components/filters/BooleanFilterField/index.js +1 -1
  91. package/dist/components/filters/BooleanFilterField/index.js.map +1 -1
  92. package/dist/components/filters/DateFilterField/index.js +1 -1
  93. package/dist/components/filters/DateFilterField/index.js.map +1 -1
  94. package/dist/components/filters/GeoFilterField/index.js +2 -2
  95. package/dist/components/filters/GeoFilterField/index.js.map +1 -1
  96. package/dist/components/filters/MultiSelectFilterField/index.js +2 -2
  97. package/dist/components/filters/MultiSelectFilterField/index.js.map +1 -1
  98. package/dist/components/filters/NumberRangeFilterField/index.js +1 -1
  99. package/dist/components/filters/NumberRangeFilterField/index.js.map +1 -1
  100. package/dist/components/filters/TextFilterField/index.js +1 -1
  101. package/dist/components/filters/TextFilterField/index.js.map +1 -1
  102. package/dist/components/ui/ApplicationBar/index.js +132 -132
  103. package/dist/components/ui/ApplicationBar/index.js.map +1 -1
  104. package/dist/components/ui/ConsentDialog/ConsentDialog.d.ts +2 -2
  105. package/dist/components/ui/ConsentDialog/index.js +11 -11
  106. package/dist/components/ui/ConsentDialog/index.js.map +1 -1
  107. package/dist/components/ui/GenericErrorMessage/index.js +1 -1
  108. package/dist/components/ui/GenericErrorMessage/index.js.map +1 -1
  109. package/dist/components/ui/LicensesDialog/LicensesDialog.d.ts +2 -2
  110. package/dist/components/ui/LicensesDialog/index.js +40 -40
  111. package/dist/components/ui/LicensesDialog/index.js.map +1 -1
  112. package/dist/components/ui/MyPermissionsDialog/MyPermissionsDialog.d.ts +2 -2
  113. package/dist/components/ui/MyPermissionsDialog/index.js +21 -21
  114. package/dist/components/ui/MyPermissionsDialog/index.js.map +1 -1
  115. package/dist/components/ui/NavLink/index.js +1 -1
  116. package/dist/components/ui/NavLink/index.js.map +1 -1
  117. package/dist/components/ui/OrganizationSwitcherDialog/OrganizationSwitcherDialog.d.ts +2 -2
  118. package/dist/components/ui/OrganizationSwitcherDialog/index.js +43 -43
  119. package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
  120. package/dist/components/ui/OutagesDialog/OutagesDialog.d.ts +2 -2
  121. package/dist/components/ui/OutagesDialog/index.js +14 -14
  122. package/dist/components/ui/OutagesDialog/index.js.map +1 -1
  123. package/dist/components/ui/PageContainer/index.js +2 -2
  124. package/dist/components/ui/PageContainer/index.js.map +1 -1
  125. package/dist/components/ui/ResponseHandler/index.js +8 -8
  126. package/dist/components/ui/ResponseHandler/index.js.map +1 -1
  127. package/dist/components/ui/Sidebar/index.js.map +1 -1
  128. package/dist/components/ui/Table/TableColumnsEditorDialog.d.ts +2 -2
  129. package/dist/components/ui/UserFeedbackDialog/UserFeedbackDialog.d.ts +2 -2
  130. package/dist/components/ui/UserFeedbackDialog/index.js +38 -38
  131. package/dist/components/ui/UserFeedbackDialog/index.js.map +1 -1
  132. package/dist/components/ui/UserInactivityConfirmation/index.js +14 -14
  133. package/dist/components/ui/UserInactivityConfirmation/index.js.map +1 -1
  134. package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContext.d.ts +5 -0
  135. package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContextProvider.d.ts +6 -0
  136. package/dist/context/uiClientCommonConfigContext/index.d.ts +3 -0
  137. package/dist/context/uiClientCommonConfigContext/index.js +18 -0
  138. package/dist/context/uiClientCommonConfigContext/index.js.map +1 -0
  139. package/dist/context/uiClientCommonConfigContext/useUiClientCommonConfigContext.d.ts +2 -0
  140. package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +4 -4
  141. package/dist/dataHooks/useIdentifierIssuerQuery/index.js +4 -4
  142. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +4 -4
  143. package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +4 -4
  144. package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +4 -4
  145. package/dist/dataHooks/useOrganizationsQuery/index.js +4 -4
  146. package/dist/dataHooks/useUsersQuery/index.js +4 -4
  147. package/dist/hooks/useColumnsMenu/useColumnsMenu.d.ts +1 -1
  148. package/dist/hooks/useEditMutation/index.js +6 -6
  149. package/dist/hooks/useEditMutation/index.js.map +1 -1
  150. package/dist/hooks/useItemQuery/index.js +8 -8
  151. package/dist/hooks/useItemQuery/index.js.map +1 -1
  152. package/dist/locale/en.json +0 -10
  153. package/dist/locale/nl.json +0 -10
  154. package/dist/models/dataHooks.d.ts +1 -1
  155. package/dist/models/table.d.ts +1 -1
  156. package/dist/models/table.js.map +1 -1
  157. package/dist/pages/AcceptInvitationPage/index.js +5 -5
  158. package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
  159. package/dist/pages/AdminPage/index.js +1 -1
  160. package/dist/pages/AdminPage/index.js.map +1 -1
  161. package/dist/pages/ChooseIdentityProviderPage/index.js.map +1 -1
  162. package/dist/pages/CrudPage/CrudPage.d.ts +2 -2
  163. package/dist/pages/CrudPage/CrudPageDeleteDialog.d.ts +2 -2
  164. package/dist/pages/CrudPage/CrudPageEditDialog.d.ts +4 -4
  165. package/dist/pages/ErrorPage/index.js.map +1 -1
  166. package/dist/pages/IdentifierIssuersAdminPage/index.js +2 -2
  167. package/dist/pages/IdentifierIssuersAdminPage/index.js.map +1 -1
  168. package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +1 -1
  169. package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js.map +1 -1
  170. package/dist/pages/OrganizationContactsAdminPage/index.js +3 -3
  171. package/dist/pages/OrganizationContactsAdminPage/index.js.map +1 -1
  172. package/dist/pages/OrganizationSitesAdminPage/index.js +3 -3
  173. package/dist/pages/OrganizationSitesAdminPage/index.js.map +1 -1
  174. package/dist/pages/OrganizationsAdminPage/index.js +2 -2
  175. package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
  176. package/dist/pages/OutagesAdminPage/index.js +2 -2
  177. package/dist/pages/OutagesAdminPage/index.js.map +1 -1
  178. package/dist/pages/PostLoginPage/index.js.map +1 -1
  179. package/dist/pages/PostLogoutPage/index.js.map +1 -1
  180. package/dist/pages/RouterErrorPage/index.js +1 -1
  181. package/dist/pages/RouterErrorPage/index.js.map +1 -1
  182. package/dist/pages/UserInvitationsAdminPage/UserInvitationConsumeDialog.d.ts +2 -2
  183. package/dist/pages/UserInvitationsAdminPage/UserInvitationShareDialog.d.ts +2 -2
  184. package/dist/pages/UsersAdminPage/index.js +47 -47
  185. package/dist/pages/UsersAdminPage/index.js.map +1 -1
  186. package/dist/setup/setup.js +1 -1
  187. package/dist/setup/setup.js.map +1 -1
  188. package/dist/utils/MenuDataUtil/MenuDataUtil.d.ts +1 -1
  189. package/dist/utils/MenuDataUtil/index.js.map +1 -1
  190. package/dist/utils/StandardConfigUtil/index.js +4 -4
  191. package/dist/utils/StandardConfigUtil/index.js.map +1 -1
  192. package/dist/utils/TableUtil/TableUtil.d.ts +1 -1
  193. package/package.json +7 -7
  194. package/dist/_chunks/chunk-KS7C4IRE.js.map +0 -1
  195. package/dist/_chunks/isObjectLike.js +0 -43
  196. package/dist/_chunks/isObjectLike.js.map +0 -1
  197. package/dist/components/ui/BackdropSpinner/BackdropSpinner.d.ts +0 -5
  198. package/dist/components/ui/BackdropSpinner/index.d.ts +0 -1
  199. package/dist/components/ui/BackdropSpinner/index.js +0 -19
  200. package/dist/components/ui/BackdropSpinner/index.js.map +0 -1
  201. package/dist/components/ui/Confirmation/Confirmation.d.ts +0 -2
  202. package/dist/components/ui/Confirmation/ConfirmationRender.d.ts +0 -11
  203. package/dist/components/ui/Confirmation/index.d.ts +0 -2
  204. package/dist/components/ui/Confirmation/index.js +0 -58
  205. package/dist/components/ui/Confirmation/index.js.map +0 -1
  206. package/dist/components/ui/CopyToClipboardButton/CopyToClipboardButton.d.ts +0 -13
  207. package/dist/components/ui/CopyToClipboardButton/index.d.ts +0 -1
  208. package/dist/components/ui/CopyToClipboardButton/index.js +0 -101
  209. package/dist/components/ui/CopyToClipboardButton/index.js.map +0 -1
  210. package/dist/components/ui/Dialog/Dialog.d.ts +0 -27
  211. package/dist/components/ui/Dialog/index.d.ts +0 -1
  212. package/dist/components/ui/Dialog/index.js +0 -83
  213. package/dist/components/ui/Dialog/index.js.map +0 -1
  214. package/dist/components/ui/LinearProgressWithLabel/LinearProgressWithLabel.d.ts +0 -5
  215. package/dist/components/ui/LinearProgressWithLabel/index.d.ts +0 -1
  216. package/dist/components/ui/LinearProgressWithLabel/index.js +0 -31
  217. package/dist/components/ui/LinearProgressWithLabel/index.js.map +0 -1
  218. package/dist/components/ui/LoadingIndicator/LoadingIndicator.d.ts +0 -2
  219. package/dist/components/ui/LoadingIndicator/index.d.ts +0 -1
  220. package/dist/components/ui/LoadingIndicator/index.js +0 -12
  221. package/dist/components/ui/LoadingIndicator/index.js.map +0 -1
  222. package/dist/components/ui/NestedMenu/IconMenuItem.d.ts +0 -18
  223. package/dist/components/ui/NestedMenu/NestedDropdown.d.ts +0 -17
  224. package/dist/components/ui/NestedMenu/NestedMenuItem.d.ts +0 -22
  225. package/dist/components/ui/NestedMenu/index.d.ts +0 -4
  226. package/dist/components/ui/NestedMenu/index.js +0 -240
  227. package/dist/components/ui/NestedMenu/index.js.map +0 -1
  228. package/dist/components/ui/NestedMenu/nestedMenuItemsFromObject.d.ts +0 -11
  229. package/dist/components/ui/Spinner/Spinner.d.ts +0 -11
  230. package/dist/components/ui/Spinner/index.d.ts +0 -1
  231. package/dist/components/ui/Spinner/index.js +0 -63
  232. package/dist/components/ui/Spinner/index.js.map +0 -1
  233. package/dist/components/ui/Stepper/Stepper.d.ts +0 -17
  234. package/dist/components/ui/Stepper/index.d.ts +0 -2
  235. package/dist/components/ui/Stepper/index.js +0 -126
  236. package/dist/components/ui/Stepper/index.js.map +0 -1
  237. package/dist/components/ui/Stepper/stepperModel.d.ts +0 -4
  238. package/dist/hoc/withDialog/index.d.ts +0 -1
  239. package/dist/hoc/withDialog/index.js +0 -69
  240. package/dist/hoc/withDialog/index.js.map +0 -1
  241. package/dist/hoc/withDialog/withDialog.d.ts +0 -33
  242. package/dist/models/nestedMenu.d.ts +0 -17
  243. package/dist/models/nestedMenu.js +0 -0
@@ -1,33 +1,31 @@
1
1
  import e from "react";
2
- //#region ../../node_modules/.pnpm/react-hook-form@7.80.0_react@19.2.7/node_modules/react-hook-form/dist/index.esm.mjs
3
- var t = (e) => e.type === "checkbox", n = (e) => e instanceof Date, r = (e) => e == null, i = (e) => typeof e == "object", a = (e) => !r(e) && !Array.isArray(e) && i(e) && !n(e), o = (e) => a(e) && e.target ? t(e.target) ? e.target.checked : e.target.value : e, s = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), c = (e) => {
4
- let t = e.constructor && e.constructor.prototype;
5
- return a(t) && t.hasOwnProperty("isPrototypeOf");
6
- }, l = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
7
- function u(e) {
2
+ //#region ../../node_modules/.pnpm/react-hook-form@7.87.0_react@19.2.8/node_modules/react-hook-form/dist/index.esm.mjs
3
+ var t = (e) => e.type === "checkbox", n = (e) => e.type === "file", r = (e) => e instanceof Date, i = (e) => e == null, a = (e) => typeof e == "object", o = (e) => !i(e) && !Array.isArray(e) && a(e) && !r(e), s = (e) => o(e) && e.target ? t(e.target) ? e.target.checked : n(e.target) ? e.target.files : e.target.value : e, c = /[.[\]'"]/, l = (e) => e.split(c).filter(Boolean), u = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), d = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
4
+ function f(e) {
5
+ if (typeof e != "object" || !e) return e;
8
6
  if (e instanceof Date) return new Date(e);
9
7
  let t = typeof FileList < "u" && e instanceof FileList;
10
- if (l && (e instanceof Blob || t)) return e;
8
+ if (d && (e instanceof Blob || t)) return e;
11
9
  let n = Array.isArray(e);
12
- if (!n && !(a(e) && c(e))) return e;
10
+ if (!n && e.constructor !== Object) return e;
13
11
  let r = n ? [] : Object.create(Object.getPrototypeOf(e));
14
- for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = u(e[t]));
12
+ for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (r[t] = f(e[t]));
15
13
  return r;
16
14
  }
17
- var d = {
15
+ var p = {
18
16
  BLUR: "blur",
19
17
  FOCUS_OUT: "focusout",
20
18
  CHANGE: "change",
21
19
  SUBMIT: "submit",
22
20
  TRIGGER: "trigger",
23
21
  VALID: "valid"
24
- }, f = {
22
+ }, m = {
25
23
  onBlur: "onBlur",
26
24
  onChange: "onChange",
27
25
  onSubmit: "onSubmit",
28
26
  onTouched: "onTouched",
29
27
  all: "all"
30
- }, p = {
28
+ }, h = {
31
29
  max: "max",
32
30
  min: "min",
33
31
  maxLength: "maxLength",
@@ -35,26 +33,26 @@ var d = {
35
33
  pattern: "pattern",
36
34
  required: "required",
37
35
  validate: "validate"
38
- }, m = "root", h = [
36
+ }, g = "root", _ = [
39
37
  "__proto__",
40
38
  "constructor",
41
39
  "prototype"
42
- ], g = /^\w*$/, _ = (e) => g.test(e), v = (e) => e === void 0, y = /[.[\]'"]/, b = (e) => e.split(y).filter(Boolean), x = (e, t, n) => {
43
- if (!t || !a(e)) return n;
44
- let i = _(t) ? [t] : b(t);
45
- if (i.some((e) => h.includes(e))) return n;
46
- let o = i.reduce((e, t) => r(e) ? void 0 : e[t], e);
47
- return v(o) || o === e ? v(e[t]) ? n : e[t] : o;
40
+ ], v = /^\w*$/, y = (e) => v.test(e), b = (e) => e === void 0, x = (e, t, n) => {
41
+ if (!t || !o(e)) return n;
42
+ let r = y(t) ? [t] : l(t);
43
+ if (r.some((e) => _.includes(e))) return n;
44
+ let a = r.reduce((e, t) => i(e) ? void 0 : e[t], e);
45
+ return b(a) || a === e ? b(e[t]) ? n : e[t] : a;
48
46
  }, S = (e) => typeof e == "boolean", C = (e) => typeof e == "function", w = (e, t, n) => {
49
- let r = -1, i = _(t) ? [t] : b(t), o = i.length, s = o - 1;
50
- for (; ++r < o;) {
51
- let t = i[r], o = n;
47
+ let r = -1, i = y(t) ? [t] : l(t), a = i.length, s = a - 1;
48
+ for (; ++r < a;) {
49
+ let t = i[r], a = n;
52
50
  if (r !== s) {
53
51
  let n = e[t];
54
- o = a(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
52
+ a = o(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
55
53
  }
56
- if (h.includes(t)) return;
57
- e[t] = o, e = e[t];
54
+ if (_.includes(t)) return;
55
+ e[t] = a, e = e[t];
58
56
  }
59
57
  }, T = e.createContext(null);
60
58
  T.displayName = "HookFormControlContext";
@@ -62,136 +60,338 @@ var E = () => e.useContext(T), D = (e, t, n, r = !0) => {
62
60
  let i = {};
63
61
  for (let a in e) Object.defineProperty(i, a, { get: () => {
64
62
  let i = a;
65
- return t._proxyFormState[i] !== f.all && (t._proxyFormState[i] = !r || f.all), n && (n[i] = !0), e[i];
63
+ return t._proxyFormState[i] !== m.all && (t._proxyFormState[i] = !r || m.all), n && (n[i] = !0), e[i];
66
64
  } });
67
65
  return i;
68
- }, O = l ? e.useLayoutEffect : e.useEffect, k = (e) => typeof e == "string", A = (e, t, n, r, i) => k(e) ? (r && t.watch.add(e), x(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), x(n, e))) : (r && (t.watchAll = !0), n), j = (e) => r(e) || !i(e), M = (e, t) => t.length === 0 && !Array.isArray(e) && !c(e);
69
- function N(e, t, r = /* @__PURE__ */ new WeakMap()) {
66
+ }, O = d ? e.useLayoutEffect : e.useEffect, k = (e) => {
67
+ let t = e.constructor && e.constructor.prototype;
68
+ return o(t) && t.hasOwnProperty("isPrototypeOf");
69
+ }, A = (e) => i(e) || !a(e), j = (e, t) => t.length === 0 && !Array.isArray(e) && !k(e);
70
+ function M(e, t, n = /* @__PURE__ */ new WeakMap()) {
70
71
  if (e === t) return !0;
71
- if (j(e) || j(t)) return Object.is(e, t);
72
- if (n(e) && n(t)) return Object.is(e.getTime(), t.getTime());
73
- let i = Object.keys(e), o = Object.keys(t);
74
- if (i.length !== o.length) return !1;
75
- if (M(e, i) || M(t, o)) return Object.is(e, t);
72
+ if (A(e) || A(t)) return Object.is(e, t);
73
+ if (r(e) && r(t)) return Object.is(e.getTime(), t.getTime());
74
+ let i = Object.keys(e), a = Object.keys(t);
75
+ if (i.length !== a.length) return !1;
76
+ if (j(e, i) || j(t, a)) return Object.is(e, t);
76
77
  if (!i.length && Array.isArray(e) !== Array.isArray(t)) return !1;
77
- let s = r.get(e);
78
+ let s = n.get(e);
78
79
  if (s && s.has(t)) return !0;
79
80
  if (s) s.add(t);
80
81
  else {
81
- let n = /* @__PURE__ */ new WeakSet();
82
- n.add(t), r.set(e, n);
82
+ let r = /* @__PURE__ */ new WeakSet();
83
+ r.add(t), n.set(e, r);
83
84
  }
84
- for (let o of i) {
85
- let i = e[o];
86
- if (!(o in t)) return !1;
87
- if (o !== "ref") {
88
- let e = t[o];
89
- if (n(i) && n(e) || (a(i) || Array.isArray(i)) && (a(e) || Array.isArray(e)) ? !N(i, e, r) : !Object.is(i, e)) return !1;
85
+ for (let a of i) {
86
+ let i = e[a];
87
+ if (!(a in t)) return !1;
88
+ if (a !== "ref") {
89
+ let e = t[a];
90
+ if (r(i) && r(e) || (o(i) || Array.isArray(i)) && (o(e) || Array.isArray(e)) ? !M(i, e, n) : !Object.is(i, e)) return !1;
90
91
  }
91
92
  }
92
93
  return !0;
93
94
  }
94
- function P(t) {
95
+ function N(t) {
96
+ let n = e.useRef(!1), r = e.useRef(!1), i = e.useRef(void 0), a = e.useRef(0);
97
+ return a.current++, !r.current && t && (r.current = !0, i.current = f(t())), {
98
+ resyncIfNeeded: e.useCallback((e, t, o) => {
99
+ if (e && (n.current || r.current && a.current > 1)) {
100
+ let e = t();
101
+ M(i.current, e) || o(e);
102
+ }
103
+ n.current = !0;
104
+ }, []),
105
+ snapshot: e.useCallback((e, t) => {
106
+ e && (i.current = f(t()));
107
+ }, [])
108
+ };
109
+ }
110
+ var P = (e) => typeof e == "string", ee = (e, t, n, r, i) => P(e) ? (r && t.watch.add(e), x(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), x(n, e, x(i, e)))) : (r && (t.watchAll = !0), n);
111
+ function F(t) {
95
112
  let n = E(), { control: r = n, name: i, defaultValue: a, disabled: o, exact: s, compute: c } = t || {}, l = e.useRef(a), u = e.useRef(c), d = e.useRef(void 0), f = e.useRef(r), p = e.useRef(i);
96
113
  u.current = c;
97
- let [m, h] = e.useState(() => {
114
+ let m = () => {
98
115
  let e = r._getWatch(i, l.current);
99
116
  return u.current ? u.current(e) : e;
100
- }), g = e.useCallback((e) => {
101
- let t = A(i, r._names, e || r._formValues, !1, l.current);
117
+ }, [h, g] = e.useState(m), _ = e.useCallback((e) => {
118
+ let t = ee(i, r._names, e || r._formValues, !1, l.current);
102
119
  return u.current ? u.current(t) : t;
103
120
  }, [
104
121
  r._formValues,
105
122
  r._names,
106
123
  i
107
- ]), _ = e.useCallback((e) => {
124
+ ]), v = e.useCallback((e) => {
108
125
  if (!o) {
109
- let t = A(i, r._names, e || r._formValues, !1, l.current);
126
+ let t = ee(i, r._names, e || r._formValues, !1, l.current);
110
127
  if (u.current) {
111
128
  let e = u.current(t);
112
- N(e, d.current) || (h(e), d.current = e);
113
- } else h(t);
129
+ M(e, d.current) || (g(e), d.current = e);
130
+ } else g(t);
114
131
  }
115
132
  }, [
116
133
  r._formValues,
117
134
  r._names,
118
135
  o,
119
136
  i
120
- ]);
121
- O(() => ((f.current !== r || !N(p.current, i)) && (f.current = r, p.current = i, _()), r._subscribe({
122
- name: i,
123
- formState: { values: !0 },
124
- exact: s,
125
- callback: (e) => {
126
- _(e.values);
127
- }
128
- })), [
137
+ ]), { resyncIfNeeded: y, snapshot: b } = N(m), x = e.useRef(v);
138
+ x.current = v;
139
+ let S = e.useRef(_);
140
+ S.current = _, O(() => {
141
+ f.current !== r || !M(p.current, i) ? (f.current = r, p.current = i, x.current()) : y(!o, () => S.current(), (e) => {
142
+ g(e), d.current = e;
143
+ });
144
+ let e = r._subscribe({
145
+ name: i,
146
+ formState: { values: !0 },
147
+ exact: s,
148
+ callback: (e) => {
149
+ x.current(e.values);
150
+ }
151
+ });
152
+ return () => {
153
+ e(), b(!o, () => S.current());
154
+ };
155
+ }, [
129
156
  r,
130
157
  s,
131
158
  i,
132
- _
159
+ o,
160
+ y,
161
+ b
133
162
  ]), e.useEffect(() => r._removeUnmounted());
134
- let v = f.current !== r, y = p.current, b = e.useMemo(() => {
135
- if (o) return null;
136
- let e = !v && !N(y, i);
137
- return v || e ? g() : null;
163
+ let C = f.current !== r, w = p.current;
164
+ return e.useMemo(() => {
165
+ if (o) return !1;
166
+ let e = !C && !M(w, i);
167
+ return C || e;
138
168
  }, [
139
169
  o,
140
- v,
170
+ C,
141
171
  i,
142
- y,
143
- g
144
- ]);
145
- return b === null ? m : b;
172
+ w
173
+ ]) ? _() : h;
174
+ }
175
+ var I = (e) => ({
176
+ isOnSubmit: !e || e === m.onSubmit,
177
+ isOnBlur: e === m.onBlur,
178
+ isOnChange: e === m.onChange,
179
+ isOnAll: e === m.all,
180
+ isOnTouch: e === m.onTouched
181
+ }), L = (e, t, n) => {
182
+ if (n) return !1;
183
+ if (t.watchAll || t.watch.has(e)) return !0;
184
+ for (let n of t.watch) if (e.startsWith(n) && e.charAt(n.length) === ".") return !0;
185
+ return !1;
186
+ }, R = (e, t, n, r) => {
187
+ for (let i of n || Object.keys(e)) {
188
+ if (i === "_f") continue;
189
+ let a = n ? x(e, i) : e[i];
190
+ if (a) {
191
+ let { _f: e } = a;
192
+ if (e) {
193
+ if (e.refs && e.refs[0] && t(e.refs[0], i) && !r || e.ref && t(e.ref, e.name) && !r) return !0;
194
+ if (R(a, t)) break;
195
+ } else if ((o(a) || Array.isArray(a)) && R(a, t)) break;
196
+ }
197
+ }
198
+ }, te = (e, t, n) => {
199
+ let r = x(e, n), i = Array.isArray(r) ? r : [];
200
+ return w(i, g, t[n]), w(e, n, i), e;
201
+ }, z = (e) => o(e) && !Object.keys(e).length, ne = (e) => {
202
+ if (!d) return !1;
203
+ let t = e ? e.ownerDocument : 0;
204
+ return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
205
+ }, B = (e) => e.type === "radio", V = (e) => e instanceof RegExp, H = (e, t, n, r, i) => t ? {
206
+ ...n[e],
207
+ types: {
208
+ ...n[e] && n[e].types ? n[e].types : {},
209
+ [r]: i || !0
210
+ }
211
+ } : {}, U = {
212
+ value: !1,
213
+ isValid: !1
214
+ }, re = {
215
+ value: !0,
216
+ isValid: !0
217
+ }, ie = (e) => {
218
+ if (!Array.isArray(e)) return U;
219
+ if (e.length > 1) {
220
+ let t = e.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
221
+ return {
222
+ value: t,
223
+ isValid: !!t.length
224
+ };
225
+ }
226
+ let t = e[0];
227
+ return !t || !t.checked || t.disabled ? U : !t.attributes || !("value" in t.attributes) || b(t.value) || t.value === "" ? re : {
228
+ value: t.value,
229
+ isValid: !0
230
+ };
231
+ }, W = {
232
+ isValid: !1,
233
+ value: null
234
+ }, G = (e) => Array.isArray(e) ? e.reduce((e, t) => t && t.checked && !t.disabled ? {
235
+ isValid: !0,
236
+ value: t.value
237
+ } : e, W) : W;
238
+ function ae(e, t, n = "validate") {
239
+ if (P(e) || Array.isArray(e) && e.every(P) || S(e) && !e) return {
240
+ type: n,
241
+ message: P(e) ? e : "",
242
+ ref: t
243
+ };
146
244
  }
147
- var F = e.createContext(null);
148
- F.displayName = "HookFormContext";
149
- var I = () => e.useContext(F), L = ({ children: t, watch: n, getValues: r, getFieldState: i, setError: a, clearErrors: o, setValue: s, setValues: c, trigger: l, formState: u, resetField: d, reset: f, handleSubmit: p, unregister: m, control: h, register: g, setFocus: _, subscribe: v }) => {
150
- let y = e.useMemo(() => ({
245
+ var K = (e) => o(e) && !V(e) ? e : {
246
+ value: e,
247
+ message: ""
248
+ }, oe = async (e, a, s, c, l, u) => {
249
+ let { ref: d, refs: f, required: p, maxLength: m, minLength: g, min: _, max: v, pattern: y, validate: w, name: T, valueAsNumber: E, mount: D } = e._f, O = x(s, T);
250
+ if (!D || a.has(T)) return {};
251
+ let k = f ? f[0] : d, A = (e) => {
252
+ if (l && k.reportValidity) {
253
+ let t = S(e) ? "" : e || "";
254
+ f ? f.forEach((e) => e.setCustomValidity(t)) : k.setCustomValidity(t), k.reportValidity();
255
+ }
256
+ }, j = {}, M = B(d), N = t(d), ee = M || N, F = (E || n(d)) && b(d.value) && b(O) || ne(d) && d.value === "" || O === "" || Array.isArray(O) && !O.length, I = H.bind(null, T, c, j), L = (e, t, n, r = h.maxLength, i = h.minLength) => {
257
+ let a = e ? t : n;
258
+ j[T] = {
259
+ type: e ? r : i,
260
+ message: a,
261
+ ref: d,
262
+ ...I(e ? r : i, a)
263
+ };
264
+ };
265
+ if (u ? !Array.isArray(O) || !O.length : p && (!ee && (F || i(O)) || S(O) && !O || N && !ie(f).isValid || M && !G(f).isValid)) {
266
+ let { value: e, message: t } = P(p) ? {
267
+ value: !!p,
268
+ message: p
269
+ } : K(p);
270
+ if (e && (j[T] = {
271
+ type: h.required,
272
+ message: t,
273
+ ref: k,
274
+ ...I(h.required, t)
275
+ }, !c)) return A(t), j;
276
+ }
277
+ if (!F && (!i(_) || !i(v))) {
278
+ let e, t, n = K(v), a = K(_);
279
+ if (!i(O) && !r(O) && !isNaN(O)) {
280
+ let r = d.valueAsNumber || O && +O;
281
+ i(n.value) || (e = r > n.value), i(a.value) || (t = r < a.value);
282
+ } else {
283
+ let r = d.valueAsDate || new Date(O), i = (e) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + e), o = d.type == "time", s = d.type == "week";
284
+ P(n.value) && O && (e = o ? i(O) > i(n.value) : s ? O > n.value : r > new Date(n.value)), P(a.value) && O && (t = o ? i(O) < i(a.value) : s ? O < a.value : r < new Date(a.value));
285
+ }
286
+ if ((e || t) && (L(!!e, n.message, a.message, h.max, h.min), !c)) return A(j[T].message), j;
287
+ }
288
+ if ((m || g) && !F && (P(O) || u && Array.isArray(O))) {
289
+ let e = K(m), t = K(g), n = !i(e.value) && O.length > +e.value, r = !i(t.value) && O.length < +t.value;
290
+ if ((n || r) && (L(n, e.message, t.message), !c)) return A(j[T].message), j;
291
+ }
292
+ if (y && !F && P(O)) {
293
+ let { value: e, message: t } = K(y);
294
+ if (V(e) && !O.match(e) && (j[T] = {
295
+ type: h.pattern,
296
+ message: t,
297
+ ref: d,
298
+ ...I(h.pattern, t)
299
+ }, !c)) return A(t), j;
300
+ }
301
+ if (w) {
302
+ if (C(w)) {
303
+ let e = ae(await w(O, s), k);
304
+ if (e && (j[T] = {
305
+ ...e,
306
+ ...I(h.validate, e.message)
307
+ }, !c)) return A(e.message), j;
308
+ } else if (o(w)) {
309
+ let e = {};
310
+ for (let t in w) {
311
+ if (!z(e) && !c) break;
312
+ let n = ae(await w[t](O, s), k, t);
313
+ n && (e = {
314
+ ...n,
315
+ ...I(t, n.message)
316
+ }, A(n.message), c && (j[T] = e));
317
+ }
318
+ if (!z(e) && (j[T] = {
319
+ ref: k,
320
+ ...e
321
+ }, !c)) return j;
322
+ }
323
+ }
324
+ let R = j[T];
325
+ return A(!R || R.message), j;
326
+ }, se = (e) => Array.isArray(e) ? e : [e], ce = (e) => Array.isArray(e) ? e.filter(Boolean) : [];
327
+ function le(e, t) {
328
+ let n = t.length - 1, r = 0;
329
+ for (; r < n;) {
330
+ if (i(e)) {
331
+ e = void 0;
332
+ break;
333
+ }
334
+ e = e[t[r]], r++;
335
+ }
336
+ return e;
337
+ }
338
+ function ue(e) {
339
+ for (let t in e) if (e.hasOwnProperty(t) && !b(e[t])) return !1;
340
+ return !0;
341
+ }
342
+ function q(e, t) {
343
+ if (P(t) && Object.prototype.hasOwnProperty.call(e, t)) return delete e[t], e;
344
+ let n = Array.isArray(t) ? t : y(t) ? [t] : l(t);
345
+ if (n.some((e) => _.includes(String(e)))) return e;
346
+ let r = n.length === 1 ? e : le(e, n), i = n.length - 1, a = n[i];
347
+ return r && delete r[a], i !== 0 && (o(r) && z(r) || Array.isArray(r) && ue(r)) && q(e, n.slice(0, -1)), e;
348
+ }
349
+ var de = e.createContext(null);
350
+ de.displayName = "HookFormContext";
351
+ var fe = () => e.useContext(de), pe = ({ children: t, watch: n, getValues: r, getErrors: i, getFieldState: a, setError: o, clearErrors: s, setValue: c, setValues: l, trigger: u, formState: d, resetField: f, reset: p, resetDefaultValues: m, handleSubmit: h, unregister: g, control: _, register: v, setFocus: y, subscribe: b }) => {
352
+ let x = e.useMemo(() => ({
151
353
  watch: n,
152
354
  getValues: r,
153
- getFieldState: i,
154
- setError: a,
155
- clearErrors: o,
156
- setValue: s,
157
- setValues: c,
158
- trigger: l,
159
- formState: u,
160
- resetField: d,
161
- reset: f,
162
- handleSubmit: p,
163
- unregister: m,
164
- control: h,
165
- register: g,
166
- setFocus: _,
167
- subscribe: v
355
+ getErrors: i,
356
+ getFieldState: a,
357
+ setError: o,
358
+ clearErrors: s,
359
+ setValue: c,
360
+ setValues: l,
361
+ trigger: u,
362
+ formState: d,
363
+ resetField: f,
364
+ reset: p,
365
+ resetDefaultValues: m,
366
+ handleSubmit: h,
367
+ unregister: g,
368
+ control: _,
369
+ register: v,
370
+ setFocus: y,
371
+ subscribe: b
168
372
  }), [
169
- o,
170
- h,
171
- u,
373
+ s,
374
+ _,
375
+ d,
172
376
  i,
377
+ a,
173
378
  r,
379
+ h,
380
+ v,
174
381
  p,
175
- g,
382
+ m,
176
383
  f,
177
- d,
178
- a,
179
- _,
180
- s,
384
+ o,
385
+ y,
181
386
  c,
182
- v,
183
387
  l,
184
- m,
388
+ b,
389
+ u,
390
+ g,
185
391
  n
186
392
  ]);
187
- return e.createElement(F.Provider, { value: y }, e.createElement(T.Provider, { value: y.control }, t));
188
- }, R = (e, t, n, r, i) => t ? {
189
- ...n[e],
190
- types: {
191
- ...n[e] && n[e].types ? n[e].types : {},
192
- [r]: i || !0
193
- }
194
- } : {}, ee = (e) => Array.isArray(e) ? e.filter(Boolean) : [], te = (e) => Array.isArray(e) ? e : [e], ne = () => {
393
+ return e.createElement(de.Provider, { value: x }, e.createElement(T.Provider, { value: x.control }, t));
394
+ }, me = () => {
195
395
  let e = [];
196
396
  return {
197
397
  get observers() {
@@ -208,118 +408,77 @@ var I = () => e.useContext(F), L = ({ children: t, watch: n, getValues: r, getFi
208
408
  }
209
409
  };
210
410
  };
211
- function re(e, t) {
411
+ function he(e, t) {
212
412
  let n = {};
213
413
  for (let r in e) if (e.hasOwnProperty(r)) {
214
- let i = e[r], o = t[r];
215
- if (i && a(i) && o) {
216
- let e = re(i, o);
217
- a(e) && (n[r] = e);
218
- } else e[r] && (n[r] = o);
414
+ let i = e[r], a = t[r];
415
+ if (i && o(i) && a) {
416
+ let e = he(i, a);
417
+ o(e) && (n[r] = e);
418
+ } else e[r] && (n[r] = a);
219
419
  }
220
420
  return n;
221
421
  }
222
- var z = (e) => a(e) && !Object.keys(e).length, ie = (e) => e.type === "file", ae = (e) => {
223
- if (!l) return !1;
224
- let t = e ? e.ownerDocument : 0;
225
- return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
226
- }, oe = (e) => e.type === "select-multiple", B = (e) => e.type === "radio", se = (e) => B(e) || t(e), ce = (e) => ae(e) && e.isConnected;
227
- function le(e, t) {
228
- let n = t.slice(0, -1).length, i = 0;
229
- for (; i < n;) {
230
- if (r(e)) {
231
- e = void 0;
232
- break;
233
- }
234
- e = e[t[i]], i++;
422
+ var ge = (e, t) => e !== null && a(e) && Object.prototype.hasOwnProperty.call(e, t), _e = (e, t) => {
423
+ if (!t) return !1;
424
+ let n = e;
425
+ for (let r of y(t) ? [t] : l(t)) {
426
+ if (!ge(n, r)) return ge(e, t);
427
+ n = n[r];
235
428
  }
236
- return e;
237
- }
238
- function V(e) {
239
- for (let t in e) if (e.hasOwnProperty(t) && !v(e[t])) return !1;
240
429
  return !0;
430
+ }, ve = (e) => e.type === "select-multiple", ye = (e) => B(e) || t(e), be = (e) => ne(e) && e.isConnected;
431
+ function xe(e) {
432
+ return Array.isArray(e) || o(e);
241
433
  }
242
- function H(e, t) {
243
- if (k(t) && Object.prototype.hasOwnProperty.call(e, t)) return delete e[t], e;
244
- let n = Array.isArray(t) ? t : _(t) ? [t] : b(t), r = n.length === 1 ? e : le(e, n), i = n.length - 1, o = n[i];
245
- return r && delete r[o], i !== 0 && (a(r) && z(r) || Array.isArray(r) && V(r)) && H(e, n.slice(0, -1)), e;
434
+ function Se(e, t, n = "", r = []) {
435
+ for (let i in e) {
436
+ let a = n ? `${n}.${i}` : i, o = e[i];
437
+ xe(o) && xe(x(t, a)) ? Se(o, t, a, r) : r.push(a);
438
+ }
439
+ return r;
246
440
  }
247
- var U = (e) => {
441
+ var J = (e) => {
248
442
  for (let t in e) if (C(e[t])) return !0;
249
443
  return !1;
250
444
  };
251
- function W(e) {
252
- return Array.isArray(e) || a(e) && !U(e);
445
+ function Ce(e) {
446
+ return Array.isArray(e) || o(e) && !J(e);
253
447
  }
254
- function ue(e, t = {}) {
255
- for (let n in e) {
256
- let r = e[n];
257
- W(r) ? (t[n] = Array.isArray(r) ? [] : {}, ue(r, t[n])) : v(r) || (t[n] = !0);
258
- }
259
- return t;
448
+ function we(e) {
449
+ return !!(e && "_f" in e);
260
450
  }
261
- function G(e) {
262
- if (e !== !1) {
263
- if (e === !0) return !0;
264
- if (Array.isArray(e)) {
265
- let t = e.map((e) => G(e));
266
- return t.some((e) => e !== void 0) ? t : void 0;
267
- }
268
- if (a(e)) {
269
- let t = {};
270
- for (let n in e) {
271
- let r = G(e[n]);
272
- v(r) || (t[n] = r);
273
- }
274
- return Object.keys(t).length ? t : void 0;
275
- }
276
- }
451
+ function Y(e) {
452
+ return Array.isArray(e) ? !e.some((e) => !b(e)) : !Object.keys(e).length;
277
453
  }
278
- function K(e, t, n) {
279
- n ||= ue(t);
280
- for (let i in e) {
281
- let a = e[i];
282
- if (W(a)) v(t) || j(n[i]) ? n[i] = ue(a, Array.isArray(a) ? [] : {}) : K(a, r(t) ? {} : t[i], n[i]);
283
- else {
284
- let e = t[i];
285
- n[i] = !N(a, e);
286
- }
454
+ function Te(e, t) {
455
+ Array.isArray(e) ? e[t] = void 0 : delete e[t];
456
+ }
457
+ function X(e, t = {}, n) {
458
+ for (let r in e) {
459
+ let i = e[r], a = n && n[r];
460
+ Ce(i) && (!Array.isArray(i) || !we(a)) ? (t[r] = Array.isArray(i) ? [] : {}, X(i, t[r], a), Y(t[r]) && Te(t, r)) : b(i) || (t[r] = !0);
287
461
  }
288
- return G(n) || {};
462
+ return t;
289
463
  }
290
- var de = {
291
- value: !1,
292
- isValid: !1
293
- }, fe = {
294
- value: !0,
295
- isValid: !0
296
- }, pe = (e) => {
297
- if (Array.isArray(e)) {
298
- if (e.length > 1) {
299
- let t = e.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
300
- return {
301
- value: t,
302
- isValid: !!t.length
303
- };
304
- }
305
- return e[0].checked && !e[0].disabled ? e[0].attributes && !v(e[0].attributes.value) ? v(e[0].value) || e[0].value === "" ? fe : {
306
- value: e[0].value,
307
- isValid: !0
308
- } : fe : de;
464
+ function Z(e, t, n, r) {
465
+ n ||= X(t, {}, r);
466
+ for (let a in e) {
467
+ let o = e[a], s = r && r[a];
468
+ Ce(o) && (!Array.isArray(o) || !we(s)) ? (b(t) || A(n[a]) ? n[a] = X(o, Array.isArray(o) ? [] : {}, s) : Z(o, i(t) ? {} : t[a], n[a], s), Y(n[a]) && Te(n, a)) : M(o, t[a]) ? Te(n, a) : n[a] = !0;
309
469
  }
310
- return de;
311
- }, me = (e, { valueAsNumber: t, valueAsDate: n, setValueAs: r }) => v(e) ? e : t ? e === "" ? NaN : e && +e : n && k(e) ? new Date(e) : r ? r(e) : e, he = {
312
- isValid: !1,
313
- value: null
314
- }, ge = (e) => Array.isArray(e) ? e.reduce((e, t) => t && t.checked && !t.disabled ? {
315
- isValid: !0,
316
- value: t.value
317
- } : e, he) : he;
318
- function _e(e) {
319
- let n = e.ref;
320
- return ie(n) ? n.files : B(n) ? ge(e.refs).value : oe(n) ? [...n.selectedOptions].map(({ value: e }) => e) : t(n) ? pe(e.refs).value : me(v(n.value) ? e.ref.value : n.value, e);
470
+ return n;
471
+ }
472
+ var Ee = (e, t) => {
473
+ let n = t.split("."), r = [], i = n[0];
474
+ for (let t = 1; t < n.length; i += "." + n[t++]) !isNaN(+n[t]) && e.has(i) && r.push(`${i}.${n[t]}`);
475
+ return r;
476
+ }, De = (e, { valueAsNumber: t, valueAsDate: n, setValueAs: r }) => b(e) ? e : t ? e === "" ? NaN : e && +e : n && P(e) ? new Date(e) : r ? r(e) : e;
477
+ function Oe(e) {
478
+ let r = e.ref;
479
+ return n(r) ? r.files : B(r) ? G(e.refs).value : ve(r) ? [...r.selectedOptions].map(({ value: e }) => e) : t(r) ? ie(e.refs).value : De(r.value, e);
321
480
  }
322
- var ve = (e, t, n, r) => {
481
+ var ke = (e, t, n, r) => {
323
482
  let i = {};
324
483
  for (let n of e) {
325
484
  let e = x(t, n);
@@ -331,39 +490,17 @@ var ve = (e, t, n, r) => {
331
490
  fields: i,
332
491
  shouldUseNativeValidation: r
333
492
  };
334
- }, q = (e) => e instanceof RegExp, J = (e) => v(e) ? e : q(e) ? e.source : a(e) ? q(e.value) ? e.value.source : e.value : e, ye = (e) => ({
335
- isOnSubmit: !e || e === f.onSubmit,
336
- isOnBlur: e === f.onBlur,
337
- isOnChange: e === f.onChange,
338
- isOnAll: e === f.all,
339
- isOnTouch: e === f.onTouched
340
- }), be = "AsyncFunction", xe = (e) => {
493
+ }, Q = (e) => b(e) ? e : V(e) ? e.source : o(e) ? V(e.value) ? e.value.source : e.value : e, $ = "AsyncFunction", Ae = (e) => {
341
494
  if (!e || !e.validate) return !1;
342
- if (C(e.validate)) return e.validate.constructor.name === be;
343
- if (a(e.validate)) {
344
- for (let t in e.validate) if (e.validate[t].constructor.name === be) return !0;
495
+ if (C(e.validate)) return e.validate.constructor.name === $;
496
+ if (o(e.validate)) {
497
+ for (let t in e.validate) if (e.validate[t].constructor.name === $) return !0;
345
498
  }
346
499
  return !1;
347
- }, Se = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Ce = (e, t, n) => {
348
- if (n) return !1;
349
- if (t.watchAll || t.watch.has(e)) return !0;
350
- for (let n of t.watch) if (e.startsWith(n) && e.charAt(n.length) === ".") return !0;
351
- return !1;
352
- }, Y = (e, t, n, r) => {
353
- for (let i of n || Object.keys(e)) {
354
- let n = x(e, i);
355
- if (n) {
356
- let { _f: e, ...o } = n;
357
- if (e) {
358
- if (e.refs && e.refs[0] && t(e.refs[0], i) && !r || e.ref && t(e.ref, e.name) && !r) return !0;
359
- if (Y(o, t)) break;
360
- } else if (a(o) && Y(o, t)) break;
361
- }
362
- }
363
- };
364
- function we(e, t, n) {
500
+ }, je = (e) => e.mount && (e.required || !b(e.required) && e.required !== !1 || !b(e.min) || !b(e.max) || !b(e.maxLength) || !b(e.minLength) || e.pattern || e.validate);
501
+ function Me(e, t, n) {
365
502
  let r = x(e, n);
366
- if (r || _(n)) return {
503
+ if (r || y(n)) return {
367
504
  error: r,
368
505
  name: n
369
506
  };
@@ -383,106 +520,21 @@ function we(e, t, n) {
383
520
  }
384
521
  return { name: n };
385
522
  }
386
- var Te = (e, t, n, r) => {
523
+ var Ne = (e, t, n, r) => {
387
524
  n(e);
388
- let { name: i, ...a } = e, o = Object.keys(a);
389
- return !o.length || r && o.length >= Object.keys(t).length || o.find((e) => t[e] === (!r || f.all));
390
- }, Ee = (e, t, n) => !e || !t || e === t || te(e).some((e) => e && (n ? e === t : e.startsWith(t) || t.startsWith(e))), De = (e, t, n, r, i) => i.isOnAll ? !1 : !n && i.isOnTouch ? !(t || e) : (n ? r.isOnBlur : i.isOnBlur) ? !e : (n ? r.isOnChange : i.isOnChange) ? e : !0, Oe = (e, t) => !ee(x(e, t)).length && H(e, t), ke = (e, t, n) => {
391
- let r = x(e, n), i = Array.isArray(r) ? r : [];
392
- return w(i, m, t[n]), w(e, n, i), e;
393
- };
394
- function Ae(e, t, n = "validate") {
395
- if (k(e) || Array.isArray(e) && e.every(k) || S(e) && !e) return {
396
- type: n,
397
- message: k(e) ? e : "",
398
- ref: t
399
- };
400
- }
401
- var X = (e) => a(e) && !q(e) ? e : {
402
- value: e,
403
- message: ""
404
- }, je = async (e, n, i, o, s, c) => {
405
- let { ref: l, refs: u, required: d, maxLength: f, minLength: m, min: h, max: g, pattern: _, validate: y, name: b, valueAsNumber: w, mount: T } = e._f, E = x(i, b);
406
- if (!T || n.has(b)) return {};
407
- let D = u ? u[0] : l, O = (e) => {
408
- if (s && D.reportValidity) {
409
- let t = S(e) ? "" : e || "";
410
- u ? u.forEach((e) => e.setCustomValidity(t)) : D.setCustomValidity(t), D.reportValidity();
411
- }
412
- }, A = {}, j = B(l), M = t(l), N = j || M, P = (w || ie(l)) && v(l.value) && v(E) || ae(l) && l.value === "" || E === "" || Array.isArray(E) && !E.length, F = R.bind(null, b, o, A), I = (e, t, n, r = p.maxLength, i = p.minLength) => {
413
- let a = e ? t : n;
414
- A[b] = {
415
- type: e ? r : i,
416
- message: a,
417
- ref: l,
418
- ...F(e ? r : i, a)
419
- };
420
- };
421
- if (c ? !Array.isArray(E) || !E.length : d && (!N && (P || r(E)) || S(E) && !E || M && !pe(u).isValid || j && !ge(u).isValid)) {
422
- let { value: e, message: t } = k(d) ? {
423
- value: !!d,
424
- message: d
425
- } : X(d);
426
- if (e && (A[b] = {
427
- type: p.required,
428
- message: t,
429
- ref: D,
430
- ...F(p.required, t)
431
- }, !o)) return O(t), A;
432
- }
433
- if (!P && (!r(h) || !r(g))) {
434
- let e, t, n = X(g), i = X(h);
435
- if (!r(E) && !isNaN(E)) {
436
- let a = l.valueAsNumber || E && +E;
437
- r(n.value) || (e = a > n.value), r(i.value) || (t = a < i.value);
438
- } else {
439
- let r = l.valueAsDate || new Date(E), a = (e) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + e), o = l.type == "time", s = l.type == "week";
440
- k(n.value) && E && (e = o ? a(E) > a(n.value) : s ? E > n.value : r > new Date(n.value)), k(i.value) && E && (t = o ? a(E) < a(i.value) : s ? E < i.value : r < new Date(i.value));
441
- }
442
- if ((e || t) && (I(!!e, n.message, i.message, p.max, p.min), !o)) return O(A[b].message), A;
443
- }
444
- if ((f || m) && !P && (k(E) || c && Array.isArray(E))) {
445
- let e = X(f), t = X(m), n = !r(e.value) && E.length > +e.value, i = !r(t.value) && E.length < +t.value;
446
- if ((n || i) && (I(n, e.message, t.message), !o)) return O(A[b].message), A;
447
- }
448
- if (_ && !P && k(E)) {
449
- let { value: e, message: t } = X(_);
450
- if (q(e) && !E.match(e) && (A[b] = {
451
- type: p.pattern,
452
- message: t,
453
- ref: l,
454
- ...F(p.pattern, t)
455
- }, !o)) return O(t), A;
456
- }
457
- if (y) {
458
- if (C(y)) {
459
- let e = Ae(await y(E, i), D);
460
- if (e && (A[b] = {
461
- ...e,
462
- ...F(p.validate, e.message)
463
- }, !o)) return O(e.message), A;
464
- } else if (a(y)) {
465
- let e = {};
466
- for (let t in y) {
467
- if (!z(e) && !o) break;
468
- let n = Ae(await y[t](E, i), D, t);
469
- n && (e = {
470
- ...n,
471
- ...F(t, n.message)
472
- }, O(n.message), o && (A[b] = e));
473
- }
474
- if (!z(e) && (A[b] = {
475
- ref: D,
476
- ...e
477
- }, !o)) return A;
478
- }
479
- }
480
- return O(!0), A;
481
- }, Me = {
482
- mode: f.onSubmit,
483
- reValidateMode: f.onChange,
525
+ let i = Object.keys(e).filter((e) => e !== "name");
526
+ return !i.length || r && i.length >= Object.keys(t).length || i.find((e) => t[e] === (!r || m.all));
527
+ }, Pe = (e, t, n) => !e || !t || e === t || se(e).some((e) => e && (n ? e === t || e.startsWith(t + ".") : e.startsWith(t) || t.startsWith(e))), Fe = (e, t, n, r, i) => i.isOnAll ? !1 : !n && i.isOnTouch ? !(t || e) : (n ? r.isOnBlur : i.isOnBlur) ? !e : !(n ? r.isOnChange : i.isOnChange) || e, Ie = (e, t) => {
528
+ let n = x(e, t);
529
+ !ce(n).length && !(n != null && n.root) && q(e, t);
530
+ }, Le = {
531
+ mode: m.onSubmit,
532
+ reValidateMode: m.onChange,
484
533
  shouldFocusError: !0
485
- }, Ne = "form", Pe = {
534
+ }, Re = "form", ze = (e, t) => {
535
+ for (let n in e) n in t || delete e[n];
536
+ Object.assign(e, t);
537
+ }, Be = {
486
538
  submitCount: 0,
487
539
  isDirty: !1,
488
540
  isReady: !1,
@@ -495,28 +547,29 @@ var X = (e) => a(e) && !q(e) ? e : {
495
547
  dirtyFields: {},
496
548
  validatingFields: {}
497
549
  };
498
- function Fe(e = {}) {
499
- let i = {
500
- ...Me,
550
+ function Ve(e = {}) {
551
+ let a = {
552
+ ...Le,
501
553
  ...e
502
554
  }, c = {
503
- ...u(Pe),
504
- isLoading: C(i.defaultValues),
505
- errors: i.errors || {},
506
- disabled: i.disabled || !1
507
- }, h = {}, g = (a(i.defaultValues) || a(i.values)) && u(i.defaultValues || i.values) || {}, y = i.shouldUnregister ? {} : u(g), T = {
555
+ ...f(Be),
556
+ isLoading: C(a.defaultValues),
557
+ errors: a.errors || {},
558
+ disabled: a.disabled || !1
559
+ }, _ = {}, v = (o(a.defaultValues) || o(a.values)) && f(a.defaultValues || a.values) || {}, T = a.shouldUnregister ? {} : f(v), E = {
508
560
  action: !1,
561
+ actionArrayLengths: /* @__PURE__ */ new Map(),
509
562
  mount: !1,
510
563
  watch: !1,
511
564
  keepIsValid: !1
512
- }, E = {
565
+ }, D = {
513
566
  mount: /* @__PURE__ */ new Set(),
514
567
  disabled: /* @__PURE__ */ new Set(),
515
568
  unMount: /* @__PURE__ */ new Set(),
516
569
  array: /* @__PURE__ */ new Set(),
517
570
  watch: /* @__PURE__ */ new Set(),
518
571
  registerName: /* @__PURE__ */ new Set()
519
- }, D, O = 0, j = 0, M = ye(i.mode), P = ye(i.reValidateMode), F = {
572
+ }, O = {}, k = {}, A = 0, j = I(a.mode), N = I(a.reValidateMode), F = {
520
573
  isDirty: !1,
521
574
  dirtyFields: !1,
522
575
  validatingFields: !1,
@@ -524,359 +577,392 @@ function Fe(e = {}) {
524
577
  isValidating: !1,
525
578
  isValid: !1,
526
579
  errors: !1
527
- }, I = { ...F }, L = { ...I }, R = {
528
- array: ne(),
529
- state: ne()
530
- }, B = i.criteriaMode === f.all, le = (e) => (t) => {
531
- clearTimeout(O), O = setTimeout(e, t);
532
- }, V = async (e) => {
533
- if (!T.keepIsValid && !i.disabled && (I.isValid || L.isValid || e)) {
534
- let e;
535
- i.resolver ? (e = z((await q()).errors), U()) : e = await X({
536
- fields: h,
580
+ }, B = { ...F }, V = { ...B }, H = {
581
+ array: me(),
582
+ state: me()
583
+ }, U = 0, re = a.criteriaMode === m.all, ie = (e, t) => (n) => {
584
+ clearTimeout(k[e]), k[e] = setTimeout(t, n);
585
+ }, W = async (e) => {
586
+ if (!E.keepIsValid && !a.disabled && (B.isValid || V.isValid || e)) {
587
+ let e = ++U, t;
588
+ a.resolver ? (t = z((await J()).errors), e === U && G()) : t = await Y({
589
+ fields: _,
537
590
  onlyCheckValid: !0,
538
- eventType: d.VALID
539
- }), e !== c.isValid && R.state.next({ isValid: e });
591
+ eventType: p.VALID
592
+ }), e === U && t !== c.isValid && H.state.next({ isValid: t });
540
593
  }
541
- }, U = (e, t) => {
542
- !i.disabled && (I.isValidating || I.validatingFields || L.isValidating || L.validatingFields) && ((e || Array.from(E.mount)).forEach((e) => {
543
- e && (t ? w(c.validatingFields, e, t) : H(c.validatingFields, e));
544
- }), R.state.next({
594
+ }, G = (e, t) => {
595
+ !a.disabled && (B.isValidating || B.validatingFields || V.isValidating || V.validatingFields) && ((e || D.mount).forEach((e) => {
596
+ e && (t ? w(c.validatingFields, e, t) : q(c.validatingFields, e));
597
+ }), H.state.next({
545
598
  validatingFields: c.validatingFields,
546
599
  isValidating: !z(c.validatingFields)
547
600
  }));
548
- }, W = () => {
549
- c.dirtyFields = K(g, y);
550
- }, ue = (e, t = [], n, r, a = !0, o = !0) => {
551
- if (r && n && !i.disabled) {
552
- if (T.action = !0, o && Array.isArray(x(h, e))) {
553
- let t = n(x(h, e), r.argA, r.argB);
554
- a && w(h, e, t);
601
+ }, ae = () => {
602
+ c.dirtyFields = Z(v, T, void 0, _);
603
+ }, K = (e, t = [], n, r, i = !0, o = !0) => {
604
+ if (r && n && !a.disabled) {
605
+ E.action = !0;
606
+ let a = x(_, e);
607
+ if (E.actionArrayLengths.has(e) || E.actionArrayLengths.set(e, Array.isArray(a) ? a.length : 0), o && Array.isArray(a)) {
608
+ let t = n(a, r.argA, r.argB);
609
+ i && w(_, e, t);
555
610
  }
556
- if (o && Array.isArray(x(c.errors, e))) {
557
- let t = n(x(c.errors, e), r.argA, r.argB);
558
- a && w(c.errors, e, t), Oe(c.errors, e);
611
+ let s = x(c.errors, e);
612
+ if (o && Array.isArray(s)) {
613
+ let t = s.root, a = n(s, r.argA, r.argB) || s;
614
+ t && (a.root = t), i && w(c.errors, e, a), Ie(c.errors, e);
559
615
  }
560
- if ((I.touchedFields || L.touchedFields) && o && Array.isArray(x(c.touchedFields, e))) {
561
- let t = n(x(c.touchedFields, e), r.argA, r.argB);
562
- a && w(c.touchedFields, e, t);
616
+ let l = x(c.touchedFields, e);
617
+ if ((B.touchedFields || V.touchedFields) && o && Array.isArray(l)) {
618
+ let t = n(l, r.argA, r.argB);
619
+ i && w(c.touchedFields, e, t);
563
620
  }
564
- (I.dirtyFields || L.dirtyFields) && W(), R.state.next({
621
+ (B.dirtyFields || V.dirtyFields) && ae(), H.state.next({
565
622
  name: e,
566
- isDirty: Z(e, t),
623
+ isDirty: X(e, t),
567
624
  dirtyFields: c.dirtyFields,
568
625
  errors: c.errors,
569
626
  isValid: c.isValid
570
627
  });
571
- } else w(y, e, t);
572
- }, G = (e, t) => {
573
- w(c.errors, e, t), c.errors = { ...c.errors }, R.state.next({ errors: c.errors });
574
- }, de = (e) => {
575
- c.errors = e, R.state.next({
628
+ } else w(T, e, t);
629
+ }, le = (e, t) => {
630
+ w(c.errors, e, t), c.errors = { ...c.errors }, H.state.next({ errors: c.errors });
631
+ }, ue = (e) => {
632
+ c.errors = e, H.state.next({
576
633
  errors: c.errors,
577
634
  isValid: !1
578
635
  });
579
- }, fe = (e) => {
580
- let t = _(e) ? [e] : b(e), n = y, i = g;
636
+ }, de = (e) => {
637
+ let t = y(e) ? [e] : l(e), n = T, r = v;
581
638
  for (let e = 0; e < t.length - 1; e++) {
582
639
  let a = t[e];
583
- if (n = r(n) ? n : n[a], i = r(i) ? i : i[a], n === null && i !== null) return !0;
640
+ if (n = i(n) ? n : n[a], r = i(r) ? r : r[a], n === null && r !== null) return !0;
641
+ }
642
+ return !1;
643
+ }, fe = (e) => {
644
+ if (!E.actionArrayLengths.size) return !1;
645
+ let t = y(e) ? [e] : l(e), n = T, r = "", a = -1, o = 0;
646
+ for (let e = 0; e < t.length; e++) {
647
+ if (i(n)) return !1;
648
+ let s = t[e];
649
+ if (r = r ? `${r}.${s}` : s, Array.isArray(n) && +s >= n.length) return a === -1 ? !1 : e !== a || +s < o;
650
+ E.actionArrayLengths.has(r) && (a = e + 1, o = E.actionArrayLengths.get(r)), n = n[s];
584
651
  }
585
652
  return !1;
586
653
  }, pe = (t, n, r, i) => {
587
- let a = x(h, t);
654
+ let a = x(_, t);
588
655
  if (a) {
589
- if (fe(t)) return;
590
- let o = v(x(y, t)), s = x(y, t, v(r) ? x(g, t) : r);
591
- v(s) || i && i.defaultChecked || n ? w(y, t, n ? s : _e(a._f)) : Re(t, s), T.mount && !T.action && (V(), o && c.isDirty && (I.isDirty || L.isDirty) && (Z() || (c.isDirty = !1, R.state.next({ ...c }))), e.shouldUnregister && o && !v(x(y, t)) && Ce(t, E) && (T.watch = !0));
656
+ if (de(t) || fe(t)) return;
657
+ let o = b(x(T, t)), s = x(T, t, b(r) ? x(v, t) : r);
658
+ b(s) || i && i.defaultChecked || n ? w(T, t, n ? s : Oe(a._f)) : He(t, s), E.mount && !E.action && (W(), o && c.isDirty && (B.isDirty || V.isDirty) && (X() || (c.isDirty = !1, H.state.next({ ...c }))), e.shouldUnregister && o && !b(x(T, t)) && L(t, D) && (E.watch = !0));
592
659
  }
593
- }, he = (e, t, n, r, a) => {
660
+ }, ge = (e, t, n, r, i) => {
594
661
  let o = !1, s = !1, l = { name: e };
595
- if (!i.disabled) {
662
+ if (!a.disabled || r === !0) {
596
663
  if (!n || r) {
597
- let n = N(x(g, e), t);
598
- (I.isDirty || L.isDirty) && (s = c.isDirty, c.isDirty = l.isDirty = !n || Z(), o = s !== l.isDirty), s = !!x(c.dirtyFields, e), n === c.isDirty ? n ? H(c.dirtyFields, e) : w(c.dirtyFields, e, !0) : c.dirtyFields = K(g, y), l.dirtyFields = c.dirtyFields, o ||= (I.dirtyFields || L.dirtyFields) && s !== !n;
664
+ let n = M(x(v, e), t);
665
+ (B.isDirty || V.isDirty) && (s = c.isDirty, c.isDirty = l.isDirty = !n || X(), o = s !== l.isDirty), s = !!x(c.dirtyFields, e), n === c.isDirty ? n ? q(c.dirtyFields, e) : w(c.dirtyFields, e, !0) : ze(c.dirtyFields, Z(v, T, void 0, _)), l.dirtyFields = c.dirtyFields, o ||= (B.dirtyFields || V.dirtyFields) && s !== !n;
599
666
  }
600
667
  if (n) {
601
668
  let t = x(c.touchedFields, e);
602
- t || (w(c.touchedFields, e, n), l.touchedFields = c.touchedFields, o ||= (I.touchedFields || L.touchedFields) && t !== n);
669
+ t || (w(c.touchedFields, e, n), l.touchedFields = c.touchedFields, o ||= (B.touchedFields || V.touchedFields) && t !== n);
603
670
  }
604
- o && a && R.state.next(l);
671
+ o && i && H.state.next(l);
605
672
  }
606
673
  return o ? l : {};
607
- }, ge = (e, t, n, r) => {
608
- let a = x(c.errors, e), o = (I.isValid || L.isValid) && S(t) && c.isValid !== t;
609
- if (i.delayError && n ? (D = le(() => G(e, n)), D(i.delayError)) : (clearTimeout(O), D = null, n ? w(c.errors, e, n) : H(c.errors, e), c.errors = { ...c.errors }), (n ? !N(a, n) : a) || !z(r) || o) {
674
+ }, xe = (e, t, n, r) => {
675
+ let i = x(c.errors, e), o = (B.isValid || V.isValid) && S(t) && c.isValid !== t;
676
+ if (a.delayError && n ? (O[e] = ie(e, () => le(e, n)), O[e](a.delayError)) : (clearTimeout(k[e]), delete O[e], n ? w(c.errors, e, n) : q(c.errors, e), c.errors = { ...c.errors }), (n ? !M(i, n) : i) || !z(r) || o) {
610
677
  let n = {
611
678
  ...r,
612
679
  ...o && S(t) ? { isValid: t } : {},
613
680
  errors: c.errors,
614
681
  name: e
615
682
  };
616
- c = {
617
- ...c,
618
- ...n
619
- }, R.state.next(n);
683
+ H.state.next(n);
620
684
  }
621
- }, q = async (e) => (U(e, !0), await i.resolver(y, i.context, ve(e || E.mount, h, i.criteriaMode, i.shouldUseNativeValidation))), be = async (e) => {
622
- let { errors: t } = await q(e);
623
- if (U(e), e) {
685
+ }, J = async (e) => (G(e, !0), await a.resolver(T, a.context, ke(e || D.mount, _, a.criteriaMode, a.shouldUseNativeValidation))), Ce = async (e) => {
686
+ let { errors: t } = await J(e);
687
+ if (G(e), e) {
624
688
  for (let n of e) {
625
689
  let e = x(t, n);
626
- e ? E.array.has(n) && a(e) && !Object.keys(e).some((e) => !Number.isNaN(Number(e))) ? ke(c.errors, { [n]: e }, n) : w(c.errors, n, e) : H(c.errors, n);
690
+ e ? D.array.has(n) && o(e) && !Object.keys(e).some((e) => !Number.isNaN(Number(e))) ? te(c.errors, { [n]: e }, n) : w(c.errors, n, e) : q(c.errors, n);
627
691
  }
628
692
  c.errors = { ...c.errors };
629
693
  } else c.errors = t;
630
694
  return t;
631
- }, Ae = async ({ name: t, eventType: n }) => {
695
+ }, we = async ({ name: t, eventType: n }) => {
632
696
  if (e.validate) {
633
697
  let r = await e.validate({
634
- formValues: y,
698
+ formValues: T,
635
699
  formState: c,
636
700
  name: t,
637
701
  eventType: n
638
702
  });
639
- if (a(r)) for (let e in r) {
703
+ if (o(r)) for (let e in r) {
640
704
  let t = r[e];
641
- t && $(`${Ne}.${e}`, {
642
- message: k(t.message) ? t.message : "",
643
- type: t.type || p.validate
705
+ t && et(`${Re}.${e}`, {
706
+ message: P(t.message) ? t.message : "",
707
+ type: t.type || h.validate
644
708
  });
645
709
  }
646
- else k(r) || !r ? $(Ne, {
710
+ else P(r) || !r ? et(Re, {
647
711
  message: r || "",
648
- type: p.validate
649
- }) : qe(Ne);
712
+ type: h.validate
713
+ }) : $e(Re);
650
714
  return r;
651
715
  }
652
716
  return !0;
653
- }, X = async ({ fields: t, onlyCheckValid: n, name: r, eventType: a, context: o = {
717
+ }, Y = async ({ fields: t, onlyCheckValid: n, name: r, eventType: i, context: o = {
654
718
  valid: !0,
655
719
  runRootValidation: !1
656
720
  } }) => {
657
- if (e.validate && (o.runRootValidation = !0, !await Ae({
721
+ if (e.validate && (o.runRootValidation = !0, !await we({
658
722
  name: r,
659
- eventType: a
723
+ eventType: i
660
724
  }) && (o.valid = !1, n))) return o.valid;
661
725
  for (let r in t) {
662
726
  let s = t[r];
663
727
  if (s) {
664
728
  let { _f: t, ...l } = s;
665
729
  if (t) {
666
- let r = E.array.has(t.name), a = s._f && xe(s._f), l = I.validatingFields || I.isValidating || L.validatingFields || L.isValidating;
667
- a && l && U([t.name], !0);
668
- let u = await je(s, E.disabled, y, B, i.shouldUseNativeValidation && !n, r);
669
- if (a && l && U([t.name]), u[t.name] && (o.valid = !1, n) || (!n && (x(u, t.name) ? r ? ke(c.errors, u, t.name) : w(c.errors, t.name, u[t.name]) : H(c.errors, t.name)), e.shouldUseNativeValidation && u[t.name])) break;
730
+ let r = D.array.has(t.name), i = s._f && Ae(s._f), l = B.validatingFields || B.isValidating || V.validatingFields || V.isValidating;
731
+ i && l && G([t.name], !0);
732
+ let u = await oe(s, D.disabled, T, re, a.shouldUseNativeValidation && !n, r);
733
+ if (i && l && G([t.name]), u[t.name] && (o.valid = !1, n) || (!n && (x(u, t.name) ? r ? te(c.errors, u, t.name) : w(c.errors, t.name, u[t.name]) : q(c.errors, t.name)), e.shouldUseNativeValidation && u[t.name])) break;
670
734
  }
671
- !z(l) && await X({
735
+ !z(l) && await Y({
672
736
  context: o,
673
737
  onlyCheckValid: n,
674
738
  fields: l,
675
739
  name: r,
676
- eventType: a
740
+ eventType: i
677
741
  });
678
742
  }
679
743
  }
680
744
  return o.valid;
681
- }, Fe = () => {
682
- for (let e of E.unMount) {
683
- let t = x(h, e);
684
- t && (t._f.refs ? t._f.refs.every((e) => !ce(e)) : !ce(t._f.ref)) && Ze(e);
745
+ }, Te = () => {
746
+ for (let e of D.unMount) {
747
+ let t = x(_, e);
748
+ t && (t._f.refs ? t._f.refs.every((e) => !be(e)) : !be(t._f.ref)) && it(e);
685
749
  }
686
- E.unMount = /* @__PURE__ */ new Set();
687
- }, Z = (e, t) => !i.disabled && (e && t && w(y, e, t), !N(T.mount ? y : g, g)), Ie = (e, t, n) => A(e, E, { ...T.mount ? y : v(t) ? g : k(e) ? { [e]: t } : t }, n, t), Le = (e) => ee(x(T.mount ? y : g, e, i.shouldUnregister ? x(g, e, []) : [])), Re = (e, n, i = {}, a = !1, o = !1) => {
688
- let s = x(h, e), c = n;
689
- if (s) {
690
- let i = s._f;
691
- i && (!i.disabled && w(y, e, me(n, i)), c = ae(i.ref) && r(n) ? "" : n, oe(i.ref) ? [...i.ref.options].forEach((e) => e.selected = c.includes(e.value)) : i.refs ? t(i.ref) ? i.refs.forEach((e) => {
692
- (!e.defaultChecked || !e.disabled) && (Array.isArray(c) ? e.checked = !!c.find((t) => t === e.value) : e.checked = c === e.value || !!c);
693
- }) : i.refs.forEach((e) => e.checked = e.value === c) : ie(i.ref) ? i.ref.value = "" : (i.ref.value = c, !i.ref.type && !o && R.state.next({
750
+ D.unMount = /* @__PURE__ */ new Set();
751
+ }, X = (e, t) => (e && t && w(T, e, t), !M(E.mount ? T : v, v)), $ = (e, t, n) => ee(e, D, { ...E.mount ? T : b(t) || P(e) ? v : t }, n, t), Ve = (e) => ce(x(E.mount ? T : v, e, a.shouldUnregister ? x(v, e, []) : [])), He = (e, r, a = {}, o = !1, s = !1, c = !1) => {
752
+ let l = x(_, e), u = r;
753
+ if (l) {
754
+ let a = l._f;
755
+ a && (!a.disabled && w(T, e, De(r, a)), u = ne(a.ref) && i(r) ? "" : r, ve(a.ref) ? [...a.ref.options].forEach((e) => e.selected = u.includes(e.value)) : a.refs ? t(a.ref) ? a.refs.forEach((e) => {
756
+ (!e.defaultChecked || !e.disabled) && (e.checked = Array.isArray(u) ? !!u.find((t) => t === e.value) : u === e.value || !!u);
757
+ }) : a.refs.forEach((e) => e.checked = e.value === u) : n(a.ref) ? a.ref.value = "" : (a.ref.value = u, !a.ref.type && !s && !c && H.state.next({
694
758
  name: e,
695
- values: a ? y : u(y)
759
+ values: o ? T : f(T)
696
760
  })));
697
761
  }
698
- (i.shouldDirty || i.shouldTouch) && he(e, c, i.shouldTouch, i.shouldDirty, !o), i.shouldValidate && We(e);
699
- }, ze = (e, t, r, i = !1, o = !1) => {
700
- for (let s in t) {
701
- if (!t.hasOwnProperty(s)) return;
702
- let c = t[s], l = e + "." + s, u = x(h, l);
703
- (E.array.has(e) || a(c) || u && !u._f) && !n(c) ? ze(l, c, r, i, o) : Re(l, c, r, i, o);
762
+ (a.shouldDirty || a.shouldTouch) && ge(e, u, a.shouldTouch, a.shouldDirty, !s), a.shouldValidate && Ye(e, { delayError: a.delayError });
763
+ }, Ue = (e, t, n, i = !1, a = !1, s = !1) => {
764
+ D.array.has(e) && H.array.next({
765
+ name: e,
766
+ values: i ? T : f(T)
767
+ });
768
+ for (let c in t) {
769
+ if (!t.hasOwnProperty(c)) continue;
770
+ let l = t[c], u = e + "." + c, d = x(_, u);
771
+ (D.array.has(e) || o(l) || d && !d._f) && !r(l) ? Ue(u, l, n, i, a, s) : He(u, l, n, i, a, s);
704
772
  }
705
- }, Be = (e, t, n, i, a = !1) => {
706
- let o = x(h, e), s = E.array.has(e), l = i ? t : u(t), d = N(x(y, e), l);
707
- if (d || w(y, e, l), s) R.array.next({
773
+ }, We = (e, t, n, r, a = !1) => {
774
+ let o = x(_, e), s = D.array.has(e), l = r ? t : f(t), u = M(x(T, e), l);
775
+ if (u || w(T, e, l), s) H.array.next({
708
776
  name: e,
709
- values: i ? y : u(y)
710
- }), (I.isDirty || I.dirtyFields || L.isDirty || L.dirtyFields) && n.shouldDirty && (W(), a || R.state.next({
777
+ values: r ? T : f(T)
778
+ }), (B.isDirty || B.dirtyFields || V.isDirty || V.dirtyFields) && n.shouldDirty && (ae(), a || H.state.next({
711
779
  name: e,
712
780
  dirtyFields: c.dirtyFields,
713
- isDirty: Z(e, l)
781
+ isDirty: X(e, l)
714
782
  }));
715
783
  else {
716
- let t = Array.isArray(l) && !l.length || z(l);
717
- !o || o._f || r(l) || t ? Re(e, l, n, i, a) : ze(e, l, n, i, a);
784
+ let t = Array.isArray(l) && !l.length || z(l), s = !u && !a;
785
+ !o || o._f || i(l) || t ? He(e, l, n, r, a, s) : Ue(e, l, n, r, a, s);
718
786
  }
719
- if (!d && !a) {
720
- let t = Ce(e, E), n = i ? y : u(y);
721
- R.state.next({
787
+ if (!u && !a) {
788
+ let t = L(e, D), n = r ? T : f(T);
789
+ if (H.state.next({
722
790
  ...t && c,
723
- name: T.mount || t ? e : void 0,
791
+ name: E.mount || t ? e : void 0,
792
+ values: n
793
+ }), !s) for (let t of Ee(D.array, e)) H.state.next({
794
+ name: t,
724
795
  values: n
725
796
  });
726
797
  }
727
- }, Q = (e, t, n = {}) => Be(e, t, n, !1), Ve = (e, t = {}) => {
728
- let n = C(e) ? e(y) : e;
729
- if (!N(y, n)) {
730
- y = {
731
- ...y,
798
+ }, Ge = (e, t, n = {}) => We(e, t, n, !1), Ke = (e, t = {}) => {
799
+ let n = C(e) ? e(T) : e;
800
+ if (!M(T, n)) {
801
+ T = {
802
+ ...T,
732
803
  ...n
733
804
  };
734
- for (let e of E.mount) Be(e, x(n, e), t, !0, !0);
735
- R.state.next({
805
+ for (let e of D.mount) _e(n, e) && We(e, x(n, e), t, !0, !0);
806
+ H.state.next({
736
807
  ...c,
737
808
  name: void 0,
738
809
  type: void 0,
739
- ...j ? { values: y } : {}
740
- }), t.shouldValidate && V();
810
+ ...A ? { values: T } : {}
811
+ }), t.shouldValidate && W();
741
812
  }
742
- }, He = async (t) => {
743
- T.mount = !0;
744
- let r = t.target, a = r.name, s = !0, l = x(h, a), f = (e) => {
745
- s = Number.isNaN(e) || n(e) && isNaN(e.getTime()) || N(e, x(y, a, e));
813
+ }, qe = async (t) => {
814
+ E.mount = !0;
815
+ let n = t.target, i = n.name, o = !0, l = x(_, i), u = (e) => {
816
+ o = Number.isNaN(e) || r(e) && isNaN(e.getTime()) || M(e, x(T, i, e));
746
817
  };
747
818
  if (l) {
748
- let n, p, m = r.type ? _e(l._f) : o(t), g = t.type === d.BLUR || t.type === d.FOCUS_OUT, _ = !Se(l._f) && !e.validate && !i.resolver && !x(c.errors, a) && !l._f.deps, v = _ || De(g, x(c.touchedFields, a), c.isSubmitted, P, M), b = Ce(a, E, g);
749
- w(y, a, m), g ? (!r || !r.readOnly) && (l._f.onBlur && l._f.onBlur(t), D && D(0)) : l._f.onChange && l._f.onChange(t);
750
- let S = he(a, m, g), C = !z(S) || b;
751
- if (!g && R.state.next({
752
- name: a,
819
+ let r, d, m = n.type ? Oe(l._f) : s(t), h = t.type === p.BLUR || t.type === p.FOCUS_OUT, g = !je(l._f) && !e.validate && !a.resolver && !x(c.errors, i) && !l._f.deps, v = g || Fe(h, x(c.touchedFields, i), c.isSubmitted, N, j), y = L(i, D, h);
820
+ if (w(T, i, f(m)), h) {
821
+ if (!n || !n.readOnly) {
822
+ l._f.onBlur && l._f.onBlur(t);
823
+ let e = O[i];
824
+ e && e(0);
825
+ }
826
+ } else l._f.onChange && l._f.onChange(t);
827
+ let b = ge(i, m, h), S = !z(b) || y;
828
+ if (!h && H.state.next({
829
+ name: i,
753
830
  type: t.type,
754
- ...j ? { values: u(y) } : {}
755
- }), v) return (!_ || !c.isValid) && (I.isValid || L.isValid) && (i.mode === "onBlur" ? g && V() : g || V()), C && R.state.next({
756
- name: a,
757
- ...b ? {} : S
831
+ ...A ? { values: f(T) } : {}
832
+ }), v) return (!g || !c.isValid) && (B.isValid || V.isValid) && (a.mode === "onBlur" ? h && W() : h || W()), S && H.state.next({
833
+ name: i,
834
+ ...y ? {} : b
758
835
  });
759
- if (!i.resolver && e.validate && await Ae({
760
- name: a,
836
+ if (!a.resolver && e.validate && await we({
837
+ name: i,
761
838
  eventType: t.type
762
- }), !g && b && R.state.next({ ...c }), i.resolver) {
763
- let { errors: e } = await q([a]);
764
- if (U([a]), f(m), !s) {
765
- !z(S) && R.state.next(S);
839
+ }), !h && y && H.state.next({ ...c }), a.resolver) {
840
+ let { errors: e } = await J([i]);
841
+ if (G([i]), u(m), !o) {
842
+ !z(b) && H.state.next(b);
766
843
  return;
767
844
  }
768
- let t = we(c.errors, h, a), r = we(e, h, t.name || a);
769
- n = r.error, a = r.name, p = z(e);
770
- } else U([a], !0), n = (await je(l, E.disabled, y, B, i.shouldUseNativeValidation))[a], U([a]), f(m), s && (n ? p = !1 : (I.isValid || L.isValid) && (p = await X({
771
- fields: h,
845
+ let t = Me(c.errors, _, i), n = Me(e, _, t.name || i);
846
+ r = n.error, i = n.name, d = z(e);
847
+ } else G([i], !0), r = (await oe(l, D.disabled, T, re, a.shouldUseNativeValidation))[i], G([i]), u(m), o && (r ? d = !1 : (B.isValid || V.isValid) && (d = await Y({
848
+ fields: _,
772
849
  onlyCheckValid: !0,
773
- name: a,
850
+ name: i,
774
851
  eventType: t.type
775
852
  })));
776
- s && (l._f.deps && (!Array.isArray(l._f.deps) || l._f.deps.length > 0) && We(l._f.deps), ge(a, p, n, S));
853
+ o && (l._f.deps && (!Array.isArray(l._f.deps) || l._f.deps.length > 0) && Ye(l._f.deps), xe(i, d, r, b));
777
854
  }
778
- }, Ue = (e, t) => {
855
+ }, Je = (e, t) => {
779
856
  if (x(c.errors, t) && e.focus) return e.focus(), 1;
780
- }, We = async (e, t = {}) => {
781
- let n, r, a = te(e);
782
- if (i.resolver) {
783
- let t = await be(v(e) ? e : a);
784
- n = z(t), r = e ? !a.some((e) => x(t, e)) : n;
785
- } else e ? (r = (await Promise.all(a.map(async (e) => {
786
- let t = x(h, e);
787
- return await X({
857
+ }, Ye = async (e, t = {}) => {
858
+ let n, r, i = se(e);
859
+ if (a.resolver) {
860
+ let t = await Ce(b(e) ? e : i);
861
+ n = z(t), r = e ? !i.some((e) => x(t, e)) : n;
862
+ } else e ? (r = (await Promise.all(i.map(async (e) => {
863
+ let t = x(_, e);
864
+ return await Y({
788
865
  fields: t && t._f ? { [e]: t } : t,
789
- eventType: d.TRIGGER
866
+ eventType: p.TRIGGER
790
867
  });
791
- }))).every(Boolean), !(!r && !c.isValid) && V()) : r = n = await X({
792
- fields: h,
868
+ }))).every(Boolean), !(!r && !c.isValid) && W()) : r = n = await Y({
869
+ fields: _,
793
870
  name: e,
794
- eventType: d.TRIGGER
871
+ eventType: p.TRIGGER
795
872
  });
796
- return R.state.next({
797
- ...!k(e) || (I.isValid || L.isValid) && n !== c.isValid ? {} : { name: e },
798
- ...i.resolver || !e ? { isValid: n } : {},
873
+ if (t.delayError && a.delayError && P(e)) {
874
+ let t = x(c.errors, e);
875
+ t ? (q(c.errors, e), O[e] = ie(e, () => le(e, t)), O[e](a.delayError)) : (clearTimeout(k[e]), delete O[e]);
876
+ }
877
+ if (t.shouldTouch) for (let t of e ? i : D.mount) !D.array.has(t) && w(c.touchedFields, t, !0);
878
+ return H.state.next({
879
+ ...!P(e) || (B.isValid || V.isValid) && n !== c.isValid ? {} : { name: e },
880
+ ...a.resolver || !e ? { isValid: n } : {},
881
+ ...t.shouldTouch && (B.touchedFields || V.touchedFields) ? { touchedFields: c.touchedFields } : {},
799
882
  errors: c.errors
800
- }), t.shouldFocus && !r && Y(h, Ue, e ? a : E.mount), r;
801
- }, Ge = (e, t) => {
802
- let n = { ...T.mount ? y : g };
803
- return t && (n = re(t.dirtyFields ? c.dirtyFields : c.touchedFields, n)), v(e) ? n : k(e) ? x(n, e) : e.map((e) => x(n, e));
804
- }, Ke = (e, t) => ({
805
- invalid: !!x((t || c).errors, e),
806
- isDirty: !!x((t || c).dirtyFields, e),
807
- error: x((t || c).errors, e),
808
- isValidating: !!x(c.validatingFields, e),
809
- isTouched: !!x((t || c).touchedFields, e)
810
- }), qe = (e) => {
811
- let t = e ? te(e) : void 0;
812
- t?.forEach((e) => H(c.errors, e)), t ? t.forEach((e) => {
813
- R.state.next({
883
+ }), t.shouldFocus && !r && R(_, Je, e ? i : D.mount), r;
884
+ }, Xe = (e, t) => {
885
+ let n = { ...E.mount ? T : v };
886
+ return t && (n = he(t.dirtyFields ? c.dirtyFields : c.touchedFields, n)), b(e) ? n : P(e) ? x(n, e) : e.map((e) => x(n, e));
887
+ }, Ze = (e) => b(e) ? { ...c.errors } : P(e) ? x(c.errors, e) : e.map((e) => x(c.errors, e)), Qe = (e, t) => {
888
+ let n = t || c, r = x(n.errors, e);
889
+ return {
890
+ invalid: !!r,
891
+ isDirty: !!x(n.dirtyFields, e),
892
+ error: r,
893
+ isValidating: !!x(c.validatingFields, e),
894
+ isTouched: !!x(n.touchedFields, e)
895
+ };
896
+ }, $e = (e) => {
897
+ let t = e ? se(e) : void 0;
898
+ t?.forEach((e) => q(c.errors, e)), t ? t.forEach((e) => {
899
+ H.state.next({
814
900
  name: e,
815
901
  errors: c.errors
816
902
  });
817
- }) : R.state.next({ errors: {} });
818
- }, $ = (e, t, n) => {
819
- let r = (x(h, e, { _f: {} })._f || {}).ref, { ref: i, message: a, type: o, ...s } = x(c.errors, e) || {};
903
+ }) : (c.errors = {}, H.state.next({ errors: c.errors }));
904
+ }, et = (e, t, n) => {
905
+ let r = (x(_, e, { _f: {} })._f || {}).ref, { ref: i, message: a, type: o, ...s } = x(c.errors, e) || {};
820
906
  w(c.errors, e, {
821
907
  ...s,
822
908
  ...t,
823
909
  ref: r
824
- }), R.state.next({
910
+ }), H.state.next({
825
911
  name: e,
826
912
  errors: c.errors,
827
913
  isValid: !1
828
914
  }), n && n.shouldFocus && r && r.focus && r.focus();
829
- }, Je = (e, t) => {
915
+ }, tt = (e, t) => {
830
916
  if (C(e)) {
831
- j++;
832
- let { unsubscribe: n } = R.state.subscribe({ next: (n) => "values" in n && e(n.values || Ie(void 0, t), n) }), r = !1;
917
+ A++;
918
+ let { unsubscribe: n } = H.state.subscribe({ next: (n) => "values" in n && e(n.values || $(void 0, t), n) }), r = !1;
833
919
  return { unsubscribe: () => {
834
- r || (r = !0, j--, n());
920
+ r || (r = !0, A--, n());
835
921
  } };
836
922
  }
837
- return Ie(e, t, !0);
838
- }, Ye = (e) => {
923
+ return $(e, t, !0);
924
+ }, nt = (e) => {
839
925
  let t = !!e.formState?.values;
840
- t && j++;
841
- let { unsubscribe: n } = R.state.subscribe({ next: (t) => {
842
- if (Ee(e.name, t.name, e.exact) && Te(t, e.formState || I, st, e.reRenderRoot)) {
843
- let n = { ...y };
926
+ t && A++;
927
+ let { unsubscribe: n } = H.state.subscribe({ next: (t) => {
928
+ if (Pe(e.name, t.name, e.exact) && Ne(t, e.formState || B, mt, e.reRenderRoot)) {
929
+ let n = { ...T };
844
930
  e.callback({
845
931
  values: n,
846
932
  ...c,
847
933
  ...t,
848
- defaultValues: g
934
+ defaultValues: v
849
935
  });
850
936
  }
851
937
  } });
852
938
  if (!t) return n;
853
939
  let r = !1;
854
940
  return () => {
855
- r || (r = !0, j--, n());
941
+ r || (r = !0, A--, n());
856
942
  };
857
- }, Xe = (e) => (T.mount = !0, L = {
858
- ...L,
943
+ }, rt = (e) => (E.mount = !0, V = {
944
+ ...V,
859
945
  ...e.formState
860
- }, Ye({
946
+ }, nt({
861
947
  ...e,
862
948
  formState: {
863
949
  ...F,
864
950
  ...e.formState
865
951
  }
866
- })), Ze = (e, t = {}) => {
867
- for (let n of e ? te(e) : E.mount) E.mount.delete(n), E.array.delete(n), t.keepValue || (H(h, n), H(y, n)), !t.keepError && H(c.errors, n), !t.keepDirty && H(c.dirtyFields, n), !t.keepTouched && H(c.touchedFields, n), !t.keepIsValidating && H(c.validatingFields, n), !i.shouldUnregister && !t.keepDefaultValue && H(g, n);
868
- R.state.next({ values: u(y) }), R.state.next({
952
+ })), it = (e, t = {}) => {
953
+ for (let n of e ? se(e) : D.mount) D.mount.delete(n), D.array.delete(n), t.keepValue || (q(_, n), q(T, n)), !t.keepError && q(c.errors, n), !t.keepDirty && q(c.dirtyFields, n), !t.keepTouched && q(c.touchedFields, n), !t.keepIsValidating && q(c.validatingFields, n), !a.shouldUnregister && !t.keepDefaultValue && q(v, n);
954
+ A && H.state.next({ values: f(T) }), H.state.next({
869
955
  ...c,
870
- ...t.keepDirty ? { isDirty: Z() } : {}
871
- }), !t.keepIsValid && V();
872
- }, Qe = ({ disabled: e, name: t }) => {
873
- if (S(e) && T.mount || e || E.disabled.has(t)) {
874
- let n = E.disabled.has(t) !== !!e;
875
- e ? E.disabled.add(t) : E.disabled.delete(t), n && T.mount && !T.action && V();
956
+ ...t.keepDirty ? {} : { isDirty: X() }
957
+ }), !t.keepIsValid && W();
958
+ }, at = ({ disabled: e, name: t }) => {
959
+ if (S(e) && E.mount || e || D.disabled.has(t)) {
960
+ let n = D.disabled.has(t) !== !!e;
961
+ e ? D.disabled.add(t) : D.disabled.delete(t), n && E.mount && !E.action && W();
876
962
  }
877
- }, $e = (e, t = {}) => {
878
- let n = x(h, e), r = S(t.disabled) || S(i.disabled), a = !E.registerName.has(e) && n && n._f && !n._f.mount;
879
- return w(h, e, {
963
+ }, ot = (e, t = {}) => {
964
+ let n = x(_, e), r = S(t.disabled) || S(a.disabled), i = !D.registerName.has(e) && n && n._f && !n._f.mount;
965
+ return w(_, e, {
880
966
  ...n || {},
881
967
  _f: {
882
968
  ...n && n._f ? n._f : { ref: { name: e } },
@@ -884,95 +970,91 @@ function Fe(e = {}) {
884
970
  mount: !0,
885
971
  ...t
886
972
  }
887
- }), E.mount.add(e), n && !a ? Qe({
888
- disabled: S(t.disabled) ? t.disabled : i.disabled,
973
+ }), D.mount.add(e), n && !i ? at({
974
+ disabled: S(t.disabled) ? t.disabled : a.disabled,
889
975
  name: e
890
976
  }) : pe(e, !0, t.value), {
891
- ...r ? { disabled: t.disabled || i.disabled } : {},
892
- ...i.progressive ? {
977
+ ...r ? { disabled: t.disabled || a.disabled } : {},
978
+ ...a.progressive ? {
893
979
  required: !!t.required,
894
- min: J(t.min),
895
- max: J(t.max),
896
- minLength: J(t.minLength),
897
- maxLength: J(t.maxLength),
898
- pattern: J(t.pattern)
980
+ min: Q(t.min),
981
+ max: Q(t.max),
982
+ minLength: Q(t.minLength),
983
+ maxLength: Q(t.maxLength),
984
+ pattern: Q(t.pattern)
899
985
  } : {},
900
986
  name: e,
901
- onChange: He,
902
- onBlur: He,
987
+ onChange: qe,
988
+ onBlur: qe,
903
989
  ref: (r) => {
904
990
  if (r) {
905
- E.registerName.add(e), $e(e, t), E.registerName.delete(e), n = x(h, e);
906
- let i = v(r.value) && r.querySelectorAll && r.querySelectorAll("input,select,textarea")[0] || r, a = se(i), o = n._f.refs || [];
991
+ D.registerName.add(e), ot(e, t), D.registerName.delete(e), n = x(_, e);
992
+ let i = b(r.value) && r.querySelectorAll && r.querySelectorAll("input,select,textarea")[0] || r, a = ye(i), o = n._f.refs || [];
907
993
  if (a ? o.find((e) => e === i) : i === n._f.ref) return;
908
- w(h, e, { _f: {
909
- ...n._f,
910
- ...a ? {
911
- refs: [
912
- ...o.filter(ce),
913
- i,
914
- ...Array.isArray(x(g, e)) ? [{}] : []
915
- ],
916
- ref: {
917
- type: i.type,
918
- name: e
919
- }
920
- } : { ref: i }
921
- } }), pe(e, !1, void 0, i);
922
- } else n = x(h, e, {}), n._f && (n._f.mount = !1), (i.shouldUnregister || t.shouldUnregister) && !(s(E.array, e) && T.action) && E.unMount.add(e);
994
+ let s = { ...n._f };
995
+ a ? (s.refs = [
996
+ ...o.filter(be),
997
+ i,
998
+ ...Array.isArray(x(v, e)) ? [{}] : []
999
+ ], s.ref = {
1000
+ type: i.type,
1001
+ name: e
1002
+ }) : (s.ref = i, delete s.refs), w(_, e, { _f: s }), pe(e, !1, void 0, i);
1003
+ } else n = x(_, e, {}), n._f && (n._f.mount = !1), (a.shouldUnregister || t.shouldUnregister) && !(u(D.array, e) && E.action) && D.unMount.add(e);
923
1004
  }
924
1005
  };
925
- }, et = () => i.shouldFocusError && !i.shouldUseNativeValidation && Y(h, Ue, E.mount), tt = (e) => {
926
- S(e) && (R.state.next({ disabled: e }), Y(h, (t, n) => {
927
- let r = x(h, n);
1006
+ }, st = () => a.shouldFocusError && !a.shouldUseNativeValidation && R(_, Je, D.mount), ct = (e) => {
1007
+ S(e) && (H.state.next({ disabled: e }), R(_, (t, n) => {
1008
+ let r = x(_, n);
928
1009
  r && (t.disabled = r._f.disabled || e, Array.isArray(r._f.refs) && r._f.refs.forEach((t) => {
929
1010
  t.disabled = r._f.disabled || e;
930
1011
  }));
931
1012
  }, 0, !1));
932
- }, nt = (e, t) => async (n) => {
933
- let r;
1013
+ }, lt = (e, t) => async (n) => {
1014
+ let r, i;
934
1015
  n && (n.preventDefault && n.preventDefault(), n.persist && n.persist());
935
- let a = u(y);
936
- if (R.state.next({ isSubmitting: !0 }), i.resolver) {
937
- let { errors: e, values: t } = await q();
938
- U(), c.errors = e, a = u(t);
939
- } else await X({
940
- fields: h,
941
- eventType: d.SUBMIT
1016
+ let o = f(T);
1017
+ if (H.state.next({ isSubmitting: !0 }), a.resolver) {
1018
+ let { errors: e, values: t } = await J();
1019
+ G(), c.errors = e, o = f(t);
1020
+ } else await Y({
1021
+ fields: _,
1022
+ eventType: p.SUBMIT
942
1023
  });
943
- if (E.disabled.size) for (let e of E.disabled) H(a, e);
944
- if (H(c.errors, m), z(c.errors)) {
945
- R.state.next({ errors: {} });
1024
+ if (D.disabled.size) for (let e of D.disabled) q(o, e);
1025
+ if (q(c.errors, g), z(c.errors)) {
1026
+ H.state.next({ errors: {} });
946
1027
  try {
947
- await e(a, n);
1028
+ r = await e(o, n);
948
1029
  } catch (e) {
949
- r = e;
1030
+ i = e;
950
1031
  }
951
- } else t && await t({ ...c.errors }, n), et(), setTimeout(et);
952
- if (R.state.next({
1032
+ } else t && await t({ ...c.errors }, n), st(), setTimeout(st);
1033
+ if (H.state.next({
953
1034
  isSubmitted: !0,
954
1035
  isSubmitting: !1,
955
- isSubmitSuccessful: z(c.errors) && !r,
1036
+ isSubmitSuccessful: z(c.errors) && !i,
956
1037
  submitCount: c.submitCount + 1,
957
1038
  errors: c.errors
958
- }), r) throw r;
959
- }, rt = (e, t = {}) => {
960
- x(h, e) && (v(t.defaultValue) ? Q(e, u(x(g, e))) : (Q(e, t.defaultValue), w(g, e, u(t.defaultValue))), t.keepTouched || H(c.touchedFields, e), t.keepDirty || (H(c.dirtyFields, e), c.isDirty = t.defaultValue ? Z(e, u(x(g, e))) : Z()), t.keepError || (H(c.errors, e), I.isValid && V()), R.state.next({ ...c }));
961
- }, it = (e, t = {}) => {
962
- let n = e ? u(e) : g, r = u(n), a = z(e), o = r;
963
- if (t.keepDefaultValues || (g = n), !t.keepValues) {
1039
+ }), i) throw i;
1040
+ return r;
1041
+ }, ut = (e, t = {}) => {
1042
+ x(_, e) && (b(t.defaultValue) ? Ge(e, f(x(v, e))) : (Ge(e, t.defaultValue), w(v, e, f(t.defaultValue))), t.keepTouched || q(c.touchedFields, e), t.keepDirty || (q(c.dirtyFields, e), c.isDirty = t.defaultValue ? X(e, f(x(v, e))) : X()), t.keepError || (q(c.errors, e), W()), H.state.next({ ...c }));
1043
+ }, dt = (e, t = {}) => {
1044
+ let n = e ? f(e) : v, r = f(n), i = z(e), o = r, s = _;
1045
+ if (t.keepDefaultValues || (v = n), !t.keepValues) {
964
1046
  if (t.keepDirtyValues) {
965
- let e = /* @__PURE__ */ new Set([...E.mount, ...Object.keys(K(g, y))]);
966
- for (let t of Array.from(e)) {
967
- let e = x(c.dirtyFields, t), n = x(y, t), r = x(o, t);
968
- e && !v(n) ? w(o, t, n) : !e && !v(r) && Q(t, r);
1047
+ let e = /* @__PURE__ */ new Set([...D.mount, ...Se(Z(v, T, void 0, s), c.dirtyFields)]);
1048
+ for (let t of e) {
1049
+ let e = x(c.dirtyFields, t), n = x(T, t), r = x(o, t);
1050
+ e && !b(n) ? w(o, t, n) : !e && !b(r) && Ge(t, r);
969
1051
  }
970
1052
  } else {
971
- if (l && v(e)) for (let e of E.mount) {
972
- let t = x(h, e);
1053
+ if (d && b(e)) for (let e of D.mount) {
1054
+ let t = x(_, e);
973
1055
  if (t && t._f) {
974
1056
  let e = Array.isArray(t._f.refs) ? t._f.refs[0] : t._f.ref;
975
- if (ae(e)) {
1057
+ if (ne(e)) {
976
1058
  let t = e.closest("form");
977
1059
  if (t) {
978
1060
  t.reset();
@@ -981,16 +1063,20 @@ function Fe(e = {}) {
981
1063
  }
982
1064
  }
983
1065
  }
984
- if (t.keepFieldsRef) for (let e of E.mount) Q(e, x(o, e));
985
- else h = {};
1066
+ if (t.keepFieldsRef) for (let e of D.mount) Ge(e, x(o, e));
1067
+ else _ = {};
986
1068
  }
987
- if (i.shouldUnregister) {
988
- if (y = t.keepDefaultValues ? u(g) : {}, t.keepFieldsRef) for (let e of E.mount) w(y, e, x(o, e));
989
- } else y = u(o);
990
- R.array.next({ values: { ...o } }), R.state.next({ values: { ...o } });
1069
+ if (a.shouldUnregister) {
1070
+ if (T = t.keepDefaultValues ? f(v) : {}, t.keepFieldsRef) for (let e of D.mount) w(T, e, x(o, e));
1071
+ } else T = f(o);
1072
+ H.array.next({ values: { ...o } }), H.state.next({
1073
+ name: void 0,
1074
+ type: void 0,
1075
+ values: { ...o }
1076
+ });
991
1077
  }
992
- E = {
993
- mount: t.keepDirtyValues ? E.mount : /* @__PURE__ */ new Set(),
1078
+ D = {
1079
+ mount: t.keepDirtyValues ? D.mount : /* @__PURE__ */ new Set(),
994
1080
  unMount: /* @__PURE__ */ new Set(),
995
1081
  array: /* @__PURE__ */ new Set(),
996
1082
  registerName: /* @__PURE__ */ new Set(),
@@ -998,146 +1084,159 @@ function Fe(e = {}) {
998
1084
  watch: /* @__PURE__ */ new Set(),
999
1085
  watchAll: !1,
1000
1086
  focus: ""
1001
- }, T.mount = !I.isValid || !!t.keepIsValid || !!t.keepDirtyValues || !i.shouldUnregister && !z(o), T.watch = !!i.shouldUnregister, T.keepIsValid = !!t.keepIsValid, T.action = !1, t.keepErrors || (c.errors = {}), R.state.next({
1087
+ }, E.mount = !B.isValid || !!t.keepIsValid || !!t.keepDirtyValues || !a.shouldUnregister && !z(o), E.watch = !!a.shouldUnregister, E.keepIsValid = !!t.keepIsValid, E.action = !1, E.actionArrayLengths.clear(), t.keepErrors || (c.errors = {}), H.state.next({
1002
1088
  submitCount: t.keepSubmitCount ? c.submitCount : 0,
1003
- isDirty: a ? !1 : t.keepDirty ? c.isDirty : t.keepValues ? Z() : !!(t.keepDefaultValues && !N(e, g)),
1089
+ isDirty: i ? !1 : t.keepDirty ? c.isDirty : t.keepValues ? X() : !!(t.keepDefaultValues && !M(e, v)),
1004
1090
  isSubmitted: t.keepIsSubmitted ? c.isSubmitted : !1,
1005
- dirtyFields: a ? {} : t.keepDirtyValues ? t.keepDefaultValues && y ? K(g, y) : c.dirtyFields : t.keepDefaultValues && e ? K(g, e) : t.keepDirty ? c.dirtyFields : {},
1091
+ dirtyFields: i ? {} : t.keepDirtyValues ? t.keepDefaultValues && T ? Z(v, T, void 0, s) : c.dirtyFields : t.keepDefaultValues && e ? Z(v, e, void 0, s) : t.keepDirty ? c.dirtyFields : {},
1006
1092
  touchedFields: t.keepTouched ? c.touchedFields : {},
1007
1093
  errors: t.keepErrors ? c.errors : {},
1008
1094
  isSubmitSuccessful: t.keepIsSubmitSuccessful ? c.isSubmitSuccessful : !1,
1009
1095
  isSubmitting: !1,
1010
- defaultValues: g
1096
+ defaultValues: v
1011
1097
  });
1012
- }, at = (e, t) => it(C(e) ? e(y) : e, {
1013
- ...i.resetOptions,
1098
+ }, ft = (e, t) => dt(C(e) ? e(T) : e, {
1099
+ ...a.resetOptions,
1014
1100
  ...t
1015
- }), ot = (e, t = {}) => {
1016
- let n = x(h, e), r = n && n._f;
1101
+ }), pt = (e, t = {}) => {
1102
+ let n = x(_, e), r = n && n._f;
1017
1103
  if (r) {
1018
1104
  let e = r.refs ? r.refs[0] : r.ref;
1019
1105
  e.focus && setTimeout(() => {
1020
1106
  e.focus(), t.shouldSelect && C(e.select) && e.select();
1021
1107
  });
1022
1108
  }
1023
- }, st = (e) => {
1109
+ }, mt = (e) => {
1110
+ let { name: t, type: n, values: r, ...i } = e;
1024
1111
  c = {
1025
1112
  ...c,
1026
- ...e
1113
+ ...i
1027
1114
  };
1028
- }, ct = {
1115
+ };
1116
+ H.state.subscribe({ next: mt });
1117
+ let ht = {
1029
1118
  control: {
1030
- register: $e,
1031
- unregister: Ze,
1032
- getFieldState: Ke,
1033
- handleSubmit: nt,
1034
- setError: $,
1035
- _subscribe: Ye,
1036
- _runSchema: q,
1037
- _updateIsValidating: U,
1038
- _focusError: et,
1039
- _getWatch: Ie,
1040
- _getDirty: Z,
1041
- _setValid: V,
1042
- _setFieldArray: ue,
1043
- _setDisabledField: Qe,
1044
- _setErrors: de,
1045
- _getFieldArray: Le,
1046
- _reset: it,
1047
- _resetDefaultValues: () => C(i.defaultValues) && i.defaultValues().then((e) => {
1048
- at(e, i.resetOptions), R.state.next({ isLoading: !1 });
1119
+ register: ot,
1120
+ unregister: it,
1121
+ getFieldState: Qe,
1122
+ handleSubmit: lt,
1123
+ setError: et,
1124
+ _subscribe: nt,
1125
+ _runSchema: J,
1126
+ _updateIsValidating: G,
1127
+ _focusError: st,
1128
+ _getWatch: $,
1129
+ _getDirty: X,
1130
+ _setValid: W,
1131
+ _setFieldArray: K,
1132
+ _setDisabledField: at,
1133
+ _setErrors: ue,
1134
+ _getFieldArray: Ve,
1135
+ _reset: dt,
1136
+ _resetDefaultValues: () => C(a.defaultValues) && a.defaultValues().then((e) => {
1137
+ ft(e, a.resetOptions), H.state.next({ isLoading: !1 });
1049
1138
  }),
1050
- _removeUnmounted: Fe,
1051
- _disableForm: tt,
1052
- _subjects: R,
1053
- _proxyFormState: I,
1139
+ _removeUnmounted: Te,
1140
+ _disableForm: ct,
1141
+ _subjects: H,
1142
+ _proxyFormState: B,
1054
1143
  get _fields() {
1055
- return h;
1144
+ return _;
1056
1145
  },
1057
1146
  get _formValues() {
1058
- return y;
1147
+ return T;
1059
1148
  },
1060
1149
  get _state() {
1061
- return T;
1150
+ return E;
1062
1151
  },
1063
1152
  set _state(e) {
1064
- T = e;
1153
+ E = e;
1065
1154
  },
1066
1155
  get _defaultValues() {
1067
- return g;
1156
+ return v;
1068
1157
  },
1069
1158
  get _names() {
1070
- return E;
1159
+ return D;
1071
1160
  },
1072
1161
  set _names(e) {
1073
- E = e;
1162
+ D = e;
1074
1163
  },
1075
1164
  get _formState() {
1076
1165
  return c;
1077
1166
  },
1078
1167
  get _options() {
1079
- return i;
1168
+ return a;
1080
1169
  },
1081
1170
  set _options(e) {
1082
- i = {
1083
- ...i,
1171
+ a = {
1172
+ ...a,
1084
1173
  ...e
1085
- }, M = ye(i.mode), P = ye(i.reValidateMode);
1174
+ }, j = I(a.mode), N = I(a.reValidateMode);
1086
1175
  }
1087
1176
  },
1088
- subscribe: Xe,
1089
- trigger: We,
1090
- register: $e,
1091
- handleSubmit: nt,
1092
- watch: Je,
1093
- setValue: Q,
1094
- setValues: Ve,
1095
- getValues: Ge,
1096
- reset: at,
1097
- resetField: rt,
1177
+ subscribe: rt,
1178
+ trigger: Ye,
1179
+ register: ot,
1180
+ handleSubmit: lt,
1181
+ watch: tt,
1182
+ setValue: Ge,
1183
+ setValues: Ke,
1184
+ getValues: Xe,
1185
+ getErrors: Ze,
1186
+ reset: ft,
1187
+ resetField: ut,
1098
1188
  resetDefaultValues: (e, t = {}) => {
1099
- if (g = u(e), !t.keepDirty) {
1100
- let e = K(g, y);
1189
+ if (v = f(e), !t.keepDirty) {
1190
+ let e = Z(v, T, void 0, _);
1101
1191
  c.dirtyFields = e, c.isDirty = !z(e);
1102
1192
  }
1103
- t.keepIsValid || V(), R.state.next({
1193
+ t.keepIsValid || W(), H.state.next({
1104
1194
  ...c,
1105
- defaultValues: g
1195
+ defaultValues: v
1106
1196
  });
1107
1197
  },
1108
- clearErrors: qe,
1109
- unregister: Ze,
1110
- setError: $,
1111
- setFocus: ot,
1112
- getFieldState: Ke
1198
+ clearErrors: $e,
1199
+ unregister: it,
1200
+ setError: et,
1201
+ setFocus: pt,
1202
+ getFieldState: Qe
1113
1203
  };
1114
1204
  return {
1115
- ...ct,
1116
- formControl: ct
1205
+ ...ht,
1206
+ formControl: ht
1117
1207
  };
1118
1208
  }
1119
- function Z(t = {}) {
1209
+ function He(t = {}) {
1120
1210
  let n = e.useRef(void 0), r = e.useRef(void 0), i = e.useRef(t.formControl), [a, o] = e.useState(() => ({
1121
- ...u(Pe),
1211
+ ...f(Be),
1122
1212
  isLoading: C(t.defaultValues),
1123
1213
  errors: t.errors || {},
1124
1214
  disabled: t.disabled || !1,
1125
1215
  defaultValues: C(t.defaultValues) ? void 0 : t.defaultValues
1126
1216
  }));
1127
- if (!n.current || t.formControl && i.current !== t.formControl) if (i.current = t.formControl, t.formControl) n.current = {
1128
- ...t.formControl,
1129
- formState: a
1130
- }, t.defaultValues && !C(t.defaultValues) && t.formControl.reset(t.defaultValues, t.resetOptions);
1131
- else {
1132
- let { formControl: e, ...r } = Fe(t);
1133
- n.current = {
1134
- ...r,
1217
+ if (!n.current || t.formControl && i.current !== t.formControl) {
1218
+ if (i.current = t.formControl, t.formControl) n.current = {
1219
+ ...t.formControl,
1135
1220
  formState: a
1136
- };
1221
+ }, t.defaultValues && !C(t.defaultValues) && t.formControl.reset(t.defaultValues, t.resetOptions);
1222
+ else {
1223
+ let { formControl: e, ...r } = Ve(t);
1224
+ n.current = {
1225
+ ...r,
1226
+ formState: a
1227
+ };
1228
+ }
1137
1229
  }
1138
1230
  let s = n.current.control;
1139
- return s._options = t, O(() => {
1140
- let e = s._subscribe({
1231
+ s._options = t;
1232
+ let { resyncIfNeeded: c, snapshot: l } = N();
1233
+ return O(() => {
1234
+ let e = () => ({
1235
+ ...s._formState,
1236
+ defaultValues: s._defaultValues
1237
+ });
1238
+ c(!0, e, o);
1239
+ let t = s._subscribe({
1141
1240
  formState: s._proxyFormState,
1142
1241
  callback: () => o({
1143
1242
  ...s._formState,
@@ -1148,8 +1247,14 @@ function Z(t = {}) {
1148
1247
  return o((e) => ({
1149
1248
  ...e,
1150
1249
  isReady: !0
1151
- })), s._formState.isReady = !0, e;
1152
- }, [s]), e.useEffect(() => s._disableForm(t.disabled), [s, t.disabled]), e.useEffect(() => {
1250
+ })), s._formState.isReady = !0, () => {
1251
+ t(), l(!0, e);
1252
+ };
1253
+ }, [
1254
+ s,
1255
+ c,
1256
+ l
1257
+ ]), e.useEffect(() => s._disableForm(t.disabled), [s, t.disabled]), e.useEffect(() => {
1153
1258
  t.mode && (s._options.mode = t.mode), t.reValidateMode && (s._options.reValidateMode = t.reValidateMode);
1154
1259
  }, [
1155
1260
  s,
@@ -1165,7 +1270,7 @@ function Z(t = {}) {
1165
1270
  e !== a.isDirty && s._subjects.state.next({ isDirty: e });
1166
1271
  }
1167
1272
  }, [s, a.isDirty]), e.useEffect(() => {
1168
- t.values && !N(t.values, r.current) ? (s._reset(t.values, {
1273
+ t.values && !M(t.values, r.current) ? (s._reset(t.values, {
1169
1274
  keepFieldsRef: !0,
1170
1275
  ...s._options.resetOptions
1171
1276
  }), s._options.resetOptions?.keepIsValid || s._setValid(), r.current = t.values, o((e) => ({ ...e }))) : s._resetDefaultValues();
@@ -1174,6 +1279,6 @@ function Z(t = {}) {
1174
1279
  }), n.current.formState = e.useMemo(() => D(a, s), [s, a]), n.current;
1175
1280
  }
1176
1281
  //#endregion
1177
- export { Z as a, w as i, R as n, I as o, x as r, P as s, L as t };
1282
+ export { He as a, w as i, H as n, fe as o, x as r, F as s, pe as t };
1178
1283
 
1179
1284
  //# sourceMappingURL=index.esm.js.map